@vkontakte/calls-sdk 2.8.13-beta.16 → 2.8.13-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +767 -655
- package/classes/stat/ConversationStats.d.ts +2 -0
- package/classes/stat/MlStats.d.ts +37 -0
- package/classes/transport/Transport.d.ts +5 -3
- package/classes/transport/VadGate.d.ts +39 -0
- package/enums/Stat.d.ts +2 -0
- package/package.json +2 -2
- package/utils/ErrorText.d.ts +2 -0
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-beta.
|
|
3
|
-
* Fri, 20 Nov 2026
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-beta.17
|
|
3
|
+
* Fri, 20 Nov 2026 12:43:50 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -2327,7 +2327,7 @@ var Tn = wn.getInstance(), N = class e {
|
|
|
2327
2327
|
return 1.1;
|
|
2328
2328
|
}
|
|
2329
2329
|
static get sdkVersion() {
|
|
2330
|
-
return "2.8.13-beta.
|
|
2330
|
+
return "2.8.13-beta.17";
|
|
2331
2331
|
}
|
|
2332
2332
|
static get debug() {
|
|
2333
2333
|
return e._params.debug;
|
|
@@ -3833,7 +3833,7 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
|
|
|
3833
3833
|
};
|
|
3834
3834
|
}
|
|
3835
3835
|
}, U = /* @__PURE__ */ function(e) {
|
|
3836
|
-
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.CONNECTION_STATE_CHANGED = "connection_state_changed", e.SIGNALING_STATE_CHANGED = "signaling_state_changed", e.GATHERING_STATE_CHANGED = "gathering_state_changed", e.ICE_RESTART = "ice_restart", e.ICE_CANDIDATES_CHANGED = "ice_candidates_changed", e.ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed", e.ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology", e.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3836
|
+
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.CONNECTION_STATE_CHANGED = "connection_state_changed", e.SIGNALING_STATE_CHANGED = "signaling_state_changed", e.GATHERING_STATE_CHANGED = "gathering_state_changed", e.ICE_RESTART = "ice_restart", e.ICE_CANDIDATES_CHANGED = "ice_candidates_changed", e.ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed", e.ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology", e.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter", e.ML_READY_TO_USE = "ml_ready_to_use", e.ML_ERROR = "ml_error", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3837
3837
|
}(U || {}), ar = 1e3;
|
|
3838
3838
|
function W(e, t, n = 0) {
|
|
3839
3839
|
return t in e && e[t] ? e[t] : n;
|
|
@@ -4461,7 +4461,7 @@ var ei = class {
|
|
|
4461
4461
|
worst: 320,
|
|
4462
4462
|
bad: 640,
|
|
4463
4463
|
good: 1280
|
|
4464
|
-
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new
|
|
4464
|
+
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ua(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new fi(n, this._debug), this._sdpStats = new Mr(this._statAggregator), this._peerConnectionStats = new Jr(this._statAggregator), this._networkAdaptationStats = new Zr(this._statAggregator), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Zt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
|
|
4465
4465
|
try {
|
|
4466
4466
|
this._pc = this._createPeerConnection();
|
|
4467
4467
|
} catch (e) {
|
|
@@ -6329,7 +6329,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6329
6329
|
await this._simulcast.sync();
|
|
6330
6330
|
}
|
|
6331
6331
|
_createPerfStatsReporter() {
|
|
6332
|
-
this._perfStatReporter?.destroy(), this._perfStatReporter = new
|
|
6332
|
+
this._perfStatReporter?.destroy(), this._perfStatReporter = new Ua(this, this._signaling, this._statAggregator, !1, this._debug);
|
|
6333
6333
|
}
|
|
6334
6334
|
_closeConnection() {
|
|
6335
6335
|
this._signaling.resetProducerConnection(), this._ssrcMap = {}, this._ssrcMapUpdated = !0, this._disposeFirstMediaSentProbe(), this._stopStatInterval(), this._stopSettingsInterval(), this._stopMonitorRtpShareInterval(), this._removeAsrTrack(), this._removeCaptureSender(), this._removeCaptureReceiver(), this._simulcast.reset(), this._pc && (this._rtpReceiversByStreamId = {}, this._disabledSenders.forEach((e) => e.track?.stop()), this._disabledSenders.clear(), this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._sdpStats.stop(), this._peerConnectionStats.stop(), this._participantIdRegistry = null, e._closeDataChannel(this._producerNotification), e._closeDataChannel(this._producerCommand), e._closeDataChannel(this._producerScreen), e._closeDataChannel(this._consumerScreen), e._closeDataChannel(this._asr), e._closeDataChannel(this._animojiDataChannel), this._pc.close(), this._pc = null, this._producerOfferIsProcessing = !1, this._producerNextOffer = null), this._triggerEvent(Y.PEER_CONNECTION_CLOSED);
|
|
@@ -6544,7 +6544,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6544
6544
|
}
|
|
6545
6545
|
_allocateConsumer() {
|
|
6546
6546
|
if (!this._signaling.ready) return;
|
|
6547
|
-
let e =
|
|
6547
|
+
let e = Ya.get();
|
|
6548
6548
|
!N.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
|
|
6549
6549
|
e instanceof An || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
|
|
6550
6550
|
});
|
|
@@ -6753,13 +6753,72 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6753
6753
|
_stopMonitorRtpShareInterval() {
|
|
6754
6754
|
this._monitorRtpShareInterval && (window.clearTimeout(this._monitorRtpShareInterval), this._monitorRtpShareInterval = null);
|
|
6755
6755
|
}
|
|
6756
|
+
}, Ma = class {
|
|
6757
|
+
constructor(e, t = z, n = null) {
|
|
6758
|
+
h(this, "_topology", void 0), h(this, "_participantsCount", 0), h(this, "_taTrackIds", /* @__PURE__ */ new Set()), h(this, "_sendTrack", null), h(this, "_controller", null), h(this, "_enabled", !1), h(this, "_updateTimer", null), h(this, "_initFailed", !1), h(this, "_destroyed", !1), h(this, "_debug", void 0), h(this, "_mlStats", void 0), this._topology = e, this._debug = t, this._mlStats = n;
|
|
6759
|
+
}
|
|
6760
|
+
setTopology(e) {
|
|
6761
|
+
this._topology = e, this._update();
|
|
6762
|
+
}
|
|
6763
|
+
setParticipantsCount(e) {
|
|
6764
|
+
this._participantsCount = e, this._update();
|
|
6765
|
+
}
|
|
6766
|
+
addRemoteTrack(e) {
|
|
6767
|
+
if (e.endsWith(hi.AUDIO_MIX)) this._taTrackIds.clear();
|
|
6768
|
+
else if (e.startsWith(`${hi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) this._taTrackIds.add(e);
|
|
6769
|
+
else return;
|
|
6770
|
+
this._update();
|
|
6771
|
+
}
|
|
6772
|
+
removeRemoteTrack(e) {
|
|
6773
|
+
this._taTrackIds.delete(e) && this._update();
|
|
6774
|
+
}
|
|
6775
|
+
resetRemoteTracks() {
|
|
6776
|
+
this._taTrackIds.size !== 0 && (this._taTrackIds.clear(), this._update());
|
|
6777
|
+
}
|
|
6778
|
+
setSendTrack(e) {
|
|
6779
|
+
this._sendTrack = e, this._enabled && this._controller?.setSendTrack(e);
|
|
6780
|
+
}
|
|
6781
|
+
destroy() {
|
|
6782
|
+
this._destroyed = !0, this._enabled = !1, this._updateTimer !== null && (window.clearTimeout(this._updateTimer), this._updateTimer = null), this._controller?.destroy(), this._controller = null;
|
|
6783
|
+
}
|
|
6784
|
+
_isAllowed() {
|
|
6785
|
+
if (!N.vad || this._initFailed) return !1;
|
|
6786
|
+
let e = this._taTrackIds.size;
|
|
6787
|
+
return this._topology !== J.DIRECT && e > 0 && this._participantsCount > e;
|
|
6788
|
+
}
|
|
6789
|
+
_update() {
|
|
6790
|
+
this._destroyed || this._updateTimer !== null || (this._updateTimer = window.setTimeout(() => {
|
|
6791
|
+
this._updateTimer = null, this._applyConditions();
|
|
6792
|
+
}, 0));
|
|
6793
|
+
}
|
|
6794
|
+
_applyConditions() {
|
|
6795
|
+
let e = this._isAllowed();
|
|
6796
|
+
e !== this._enabled && (this._enabled = e, this._debug.log(`[VadGate] VAD ${e ? "enabled" : "disabled"}`, {
|
|
6797
|
+
topology: this._topology,
|
|
6798
|
+
taTracks: this._taTrackIds.size,
|
|
6799
|
+
participants: this._participantsCount
|
|
6800
|
+
}), e && !this._controller ? this._createController() : this._applyState());
|
|
6801
|
+
}
|
|
6802
|
+
_createController() {
|
|
6803
|
+
if (!N.vad) return;
|
|
6804
|
+
let e = new N.vad.VadController(this._sendTrack, N.vadOptions);
|
|
6805
|
+
e.setLogger((e, ...t) => z.send(e, ...t), "VAD"), e.onModelReady = (e, t) => this._mlStats?.logModelReady(e, t), e.onModelError = (e, t) => this._mlStats?.logModelError(e, t), e.onInference = (e) => this._mlStats?.addVadInference(e), this._controller = e, e.init().then(() => {
|
|
6806
|
+
this._controller === e && this._applyState();
|
|
6807
|
+
}, (t) => {
|
|
6808
|
+
this._debug.warn("[VadGate] VAD init failed, continuing without VAD", t), this._initFailed = !0, e.destroy(), this._controller === e && (this._controller = null);
|
|
6809
|
+
});
|
|
6810
|
+
}
|
|
6811
|
+
_applyState() {
|
|
6812
|
+
let e = this._controller;
|
|
6813
|
+
e && (this._enabled ? (e.resume(), e.setSendTrack(this._sendTrack)) : (e.setSendTrack(null), e.pause()));
|
|
6814
|
+
}
|
|
6756
6815
|
}, Y = /* @__PURE__ */ function(e) {
|
|
6757
6816
|
return e.REMOTE_TRACK_ADDED = "REMOTE_TRACK_ADDED", e.REMOTE_TRACK_REMOVED = "REMOTE_TRACK_REMOVED", e.REMOTE_STREAM_SECOND = "REMOTE_STREAM_SECOND", e.AUDIO_MIX_STALL = "AUDIO_MIX_STALL", e.REMOTE_DATA_STATS = "REMOTE_DATA_STATS", e.STATE_CHANGED = "STATE_CHANGED", e.LOCAL_STATE_CHANGED = "LOCAL_STATE_CHANGED", e.SIGNALLED_ACTIVE_PARTICIPANTS = "SIGNALLED_ACTIVE_PARTICIPANTS", e.SIGNALLED_SPEAKER_CHANGED = "SIGNALLED_SPEAKER_CHANGED", e.SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS", e.TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED", e.NETWORK_STATUS = "NETWORK_STATUS", e.PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED", e.ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION", e.ANIMOJI_STREAM = "ANIMOJI_STREAM", e.ANIMOJI_ERROR = "ANIMOJI_ERROR", e.SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT", e;
|
|
6758
|
-
}({}),
|
|
6759
|
-
constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
|
|
6760
|
-
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "
|
|
6761
|
-
this.
|
|
6762
|
-
}), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Zt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_READY, this._updateVadTrack), this.
|
|
6817
|
+
}({}), Na = class extends Xe {
|
|
6818
|
+
constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null, l = () => !0, u = null) {
|
|
6819
|
+
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "_isParticipantAccepted", void 0), h(this, "_vadGate", void 0), h(this, "_updateVadTrack", () => {
|
|
6820
|
+
this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack());
|
|
6821
|
+
}), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this._isParticipantAccepted = l, this._vadGate = new Ma(e, i, u), this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack()), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Zt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_READY, this._updateVadTrack), this._createAnimojiTransport(), e === J.SERVER && (this._serverTransport = this._createServerTransport());
|
|
6763
6822
|
}
|
|
6764
6823
|
updateSettings(e) {
|
|
6765
6824
|
this._debug.log("Update transport settings", e), this._serverSettings = e, this._directTransport && this._directTransport.updateSettings(e), this._serverTransport && this._serverTransport.updateSettings(e);
|
|
@@ -6788,17 +6847,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6788
6847
|
}
|
|
6789
6848
|
this._opened.push(t), i = !0;
|
|
6790
6849
|
}
|
|
6791
|
-
i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
|
|
6850
|
+
this._updateVadParticipants(), i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
|
|
6792
6851
|
}
|
|
6793
6852
|
close(e) {
|
|
6794
6853
|
let t = this._allocated.indexOf(e), n = this._opened.indexOf(e);
|
|
6795
|
-
t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e];
|
|
6854
|
+
t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e], this._updateVadParticipants();
|
|
6796
6855
|
}
|
|
6797
6856
|
destroy() {
|
|
6798
6857
|
this.stopFirstMediaSentProbe(), this.unsubscribe();
|
|
6799
6858
|
for (let e of this._dtListeners) e.dispose();
|
|
6800
6859
|
for (let e of this._stListeners) e.dispose();
|
|
6801
|
-
this._removeAnimojiTransport(), N.audioEffects?.destroy(), this.
|
|
6860
|
+
this._removeAnimojiTransport(), N.audioEffects?.destroy(), this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
|
|
6802
6861
|
}
|
|
6803
6862
|
stopFirstMediaSentProbe() {
|
|
6804
6863
|
this._firstMediaSentProbeStopped || (this._firstMediaSentProbeStopped = !0, this._directTransport?.stopFirstMediaSentProbe(), this._serverTransport?.stopFirstMediaSentProbe());
|
|
@@ -6807,7 +6866,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6807
6866
|
this.unsubscribe();
|
|
6808
6867
|
for (let e of this._dtListeners) e.dispose();
|
|
6809
6868
|
for (let e of this._stListeners) e.dispose();
|
|
6810
|
-
this.
|
|
6869
|
+
this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
|
|
6811
6870
|
}
|
|
6812
6871
|
setRemoteHold(e) {
|
|
6813
6872
|
this._directTransport?.setRemoteHold(e);
|
|
@@ -6857,7 +6916,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6857
6916
|
}
|
|
6858
6917
|
_onTopologyChanged(e) {
|
|
6859
6918
|
if (e.topology !== this._topology) {
|
|
6860
|
-
if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
|
|
6919
|
+
if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._vadGate.setTopology(this._topology), this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
|
|
6861
6920
|
let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? M.composeParticipantId(t[0], n[0], r[0]) : null;
|
|
6862
6921
|
if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
|
|
6863
6922
|
this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
|
|
@@ -6889,7 +6948,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6889
6948
|
this._dtListeners = [];
|
|
6890
6949
|
}
|
|
6891
6950
|
_releaseServerTransport() {
|
|
6892
|
-
this._serverTransport?.close(), this._serverTransport = null;
|
|
6951
|
+
this._serverTransport?.close(), this._serverTransport = null, this._vadGate.resetRemoteTracks();
|
|
6893
6952
|
for (let e of this._stListeners) e.dispose();
|
|
6894
6953
|
this._stListeners = [];
|
|
6895
6954
|
}
|
|
@@ -6899,13 +6958,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6899
6958
|
let e = this._opened.indexOf(t);
|
|
6900
6959
|
e >= 0 && this._opened.splice(e, 1);
|
|
6901
6960
|
let n = this._allocated.indexOf(t);
|
|
6902
|
-
n >= 0 && this._allocated.splice(n, 1);
|
|
6961
|
+
n >= 0 && this._allocated.splice(n, 1), this._updateVadParticipants();
|
|
6903
6962
|
}
|
|
6904
6963
|
this._topology === J.DIRECT && t && (this._setStates([t], e), this._setLocalState(e));
|
|
6905
6964
|
}
|
|
6906
6965
|
_onServerTransportChanged(e) {
|
|
6907
6966
|
let t = this._opened.slice();
|
|
6908
|
-
e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [])), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
|
|
6967
|
+
e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [], this._updateVadParticipants())), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
|
|
6909
6968
|
}
|
|
6910
6969
|
_onTransportActiveParticipants(e) {
|
|
6911
6970
|
this._topology === J.SERVER && this._triggerEvent("SIGNALLED_ACTIVE_PARTICIPANTS", e);
|
|
@@ -6932,10 +6991,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6932
6991
|
this._triggerEvent("REMOTE_DATA_STATS", e);
|
|
6933
6992
|
}
|
|
6934
6993
|
_onRemoteTrackAdded(e, t, n) {
|
|
6935
|
-
this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
|
|
6994
|
+
this._vadGate.addRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
|
|
6936
6995
|
}
|
|
6937
6996
|
_onRemoteTrackRemoved(e, t, n) {
|
|
6938
|
-
this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
|
|
6997
|
+
this._vadGate.removeRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
|
|
6939
6998
|
}
|
|
6940
6999
|
_onAsrTranscription(e) {
|
|
6941
7000
|
this._triggerEvent("ASR_TRANSCRIPTION", e);
|
|
@@ -6950,10 +7009,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6950
7009
|
_onAnimojiStatus(e) {
|
|
6951
7010
|
e ? this._animojiSender?.resume() : this._animojiSender?.pause(), this._mediaSource.onAnimojiSender(e);
|
|
6952
7011
|
}
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
z.warn("[Transport] VAD init failed, continuing without VAD", e), this._vadController?.destroy(), this._vadController = null;
|
|
6956
|
-
}));
|
|
7012
|
+
_updateVadParticipants() {
|
|
7013
|
+
this._vadGate.setParticipantsCount(this._opened.filter(this._isParticipantAccepted).length);
|
|
6957
7014
|
}
|
|
6958
7015
|
_createAnimojiTransport() {
|
|
6959
7016
|
if (!N.vmoji) return;
|
|
@@ -6972,7 +7029,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6972
7029
|
getStreamWaitingTimeMs(e, t) {
|
|
6973
7030
|
return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(x.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(x.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
|
|
6974
7031
|
}
|
|
6975
|
-
},
|
|
7032
|
+
}, Pa = "videochat-epi", Fa = 32767, Ia = 1e4, La = 5e3, Ra = 500, za = 6e4, Ba = 1e4, Va = 1e3, Ha = 3e5, Ua = class extends Xe {
|
|
6976
7033
|
constructor(e, t, n = null, r = !1, i = z) {
|
|
6977
7034
|
super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCounters", /* @__PURE__ */ new Map()), h(this, "_previousRemoteInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousOutboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousCandidatePair", null), h(this, "_screenShareStats", []), h(this, "_signaling", void 0), h(this, "_directTopology", void 0), h(this, "_debug", void 0), h(this, "_statAggregator", void 0), h(this, "_handleScreenSharingStat", (e) => {
|
|
6978
7035
|
this._screenShareStats.push(e);
|
|
@@ -6985,7 +7042,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6985
7042
|
}
|
|
6986
7043
|
static getEstimatedPerformanceIndex() {
|
|
6987
7044
|
try {
|
|
6988
|
-
let e = parseInt(localStorage.getItem(
|
|
7045
|
+
let e = parseInt(localStorage.getItem(Pa) || "", 10);
|
|
6989
7046
|
return isNaN(e) ? 0 : e;
|
|
6990
7047
|
} catch {
|
|
6991
7048
|
return 0;
|
|
@@ -6994,9 +7051,9 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6994
7051
|
async _handleStats(e) {
|
|
6995
7052
|
if (!e.inbound || !e.inbound.rtps) return;
|
|
6996
7053
|
let t = Date.now();
|
|
6997
|
-
this._reportCandidatePair(e.inbound.transport.local, e.inbound.transport.remote), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t), !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp +
|
|
7054
|
+
this._reportCandidatePair(e.inbound.transport.local, e.inbound.transport.remote), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t), !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + La <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
|
|
6998
7055
|
let n = e.outbound.transport.local?.protocol === "tcp";
|
|
6999
|
-
!this._directTopology && n && this._previousNetworkStatReportTimestamp +
|
|
7056
|
+
!this._directTopology && n && this._previousNetworkStatReportTimestamp + Ra <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t);
|
|
7000
7057
|
}
|
|
7001
7058
|
async reportPerfStats(e) {
|
|
7002
7059
|
let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
|
|
@@ -7005,7 +7062,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
7005
7062
|
});
|
|
7006
7063
|
if (t.framesDecoded) try {
|
|
7007
7064
|
let e = await this._signaling.reportPerfStat(t);
|
|
7008
|
-
localStorage.setItem(
|
|
7065
|
+
localStorage.setItem(Pa, e.estimatedPerformanceIndex);
|
|
7009
7066
|
} catch {}
|
|
7010
7067
|
}
|
|
7011
7068
|
async reportNetworkStats(e) {
|
|
@@ -7045,11 +7102,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
7045
7102
|
rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
|
|
7046
7103
|
ss_freeze_count: 0,
|
|
7047
7104
|
ss_total_freezes_duration: 0,
|
|
7048
|
-
local_address:
|
|
7105
|
+
local_address: Ga(e.inbound.transport.local),
|
|
7049
7106
|
local_connection_type: e.inbound.transport.local?.type,
|
|
7050
7107
|
network_type: e.inbound.transport.local?.networkType,
|
|
7051
7108
|
transport: e.inbound.transport.local?.protocol,
|
|
7052
|
-
remote_address:
|
|
7109
|
+
remote_address: Ga(e.inbound.transport.remote),
|
|
7053
7110
|
remote_connection_type: e.inbound.transport.remote?.type
|
|
7054
7111
|
}, n = /* @__PURE__ */ new Map(), r = (e, t, r) => {
|
|
7055
7112
|
let i = `${e}:${t.kind}:${t.ssrc}`, a = this._previousCounters.get(i);
|
|
@@ -7070,24 +7127,24 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
7070
7127
|
fir_received: t.fir_received,
|
|
7071
7128
|
frames_dropped: t.frames_dropped
|
|
7072
7129
|
};
|
|
7073
|
-
if (t.rtt >= 0 && t.rtt <=
|
|
7130
|
+
if (t.rtt >= 0 && t.rtt <= za && (s.rtt = t.rtt), N.simulcast && (s.is_simulcast = !0), navigator.hardwareConcurrency && (s.cpu_hardware_concurrency = Number(navigator.hardwareConcurrency)), o > 0 && (s.audio_tracks = o), i && !Ka(t.jitter_video) && t.jitter_video <= Ba && (s.jitter_video = Math.round(t.jitter_video)), a && !Ka(t.jitter_audio) && t.jitter_audio <= Ba && (s.jitter_audio = Math.round(t.jitter_audio)), i && !Ka(t.interframe_delay_variance) && (s.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (s.freeze_count = t.freeze_count, s.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (s.ss_freeze_count = t.ss_freeze_count, s.ss_total_freezes_duration = t.ss_total_freezes_duration), a && !Ka(t.total_audio_samples_received)) {
|
|
7074
7131
|
let e = t.total_audio_samples_received, n = t.inserted_audio_samples_for_deceleration, r = t.removed_audio_samples_for_acceleration, i = t.concealed_audio_samples, a = t.silent_concealed_audio_samples, o = t.audio_concealment_events;
|
|
7075
|
-
s.inserted_audio_samples_for_deceleration =
|
|
7132
|
+
s.inserted_audio_samples_for_deceleration = qa(n / e * 1e3), s.removed_audio_samples_for_acceleration = qa(r / e * 1e3), s.concealed_audio_samples = qa(i / e * 1e3), s.concealed_silent_audio_samples = qa(a / e * 1e3), s.concealment_audio_avg_size = qa(i / o), s.total_audio_energy = t.total_audio_energy;
|
|
7076
7133
|
}
|
|
7077
|
-
|
|
7134
|
+
Wa(t, "local_address", "local_connection_type", "network_type", "transport") && (s.local_address = t.local_address, s.local_connection_type = t.local_connection_type, s.network_type = t.network_type, s.transport = t.transport), Wa(t, "remote_address", "remote_connection_type") && (s.remote_address = t.remote_address, s.remote_connection_type = t.remote_connection_type);
|
|
7078
7135
|
let c = this._calculateRemotePacketLoss(e.remoteInbound.rtps, e.outbound.rtps);
|
|
7079
7136
|
c.video !== void 0 && (s.video_loss = c.video), c.audio !== void 0 && (s.audio_loss = c.audio);
|
|
7080
7137
|
let l = this._calculatePacketLoss(e.inbound.rtps, this._previousInboundRtps);
|
|
7081
7138
|
this._previousInboundRtps = l.rtps, l.video !== void 0 && (s.in_video_loss = l.video), l.audio !== void 0 && (s.in_audio_loss = l.audio);
|
|
7082
7139
|
let u = this._calculateOutboundDeltas(e.outbound.rtps);
|
|
7083
|
-
if (u.audioLevel !== void 0 && (s.audio_level = Math.round(u.audioLevel *
|
|
7140
|
+
if (u.audioLevel !== void 0 && (s.audio_level = Math.round(u.audioLevel * Fa)), u.hasAudio && (s.audio_bytes_sent = u.audioBytesSent), u.hasCamera && (u.framesEncoded <= Ia && (s.frames_encoded = u.framesEncoded), s.stat_time_delta > 0)) {
|
|
7084
7141
|
let e = (e) => Math.round(e * 8 * 1e3 / (s.stat_time_delta * 1024));
|
|
7085
7142
|
s.br_transmit = e(u.cameraBytesSent), s.br_retransmit = e(u.cameraRetransmittedBytesSent), s.br_encode = e(Math.max(0, u.cameraBytesSent - u.cameraRetransmittedBytesSent));
|
|
7086
7143
|
}
|
|
7087
|
-
s.stat_time_delta >=
|
|
7144
|
+
s.stat_time_delta >= Va && s.stat_time_delta <= Ha && (this._statAggregator?.logCallStat(s), N.enableLogPerfStatReport && this._debug.log("Sent call stats", s)), this._previousCounters = n;
|
|
7088
7145
|
}
|
|
7089
7146
|
_reportCandidatePair(e, t) {
|
|
7090
|
-
let n =
|
|
7147
|
+
let n = Ga(e), r = Ga(t);
|
|
7091
7148
|
if (!n || !r) return;
|
|
7092
7149
|
let i = JSON.stringify({
|
|
7093
7150
|
local: e,
|
|
@@ -7190,26 +7247,26 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
7190
7247
|
return this._previousOutboundRtps = t, n;
|
|
7191
7248
|
}
|
|
7192
7249
|
};
|
|
7193
|
-
function
|
|
7250
|
+
function Wa(e, ...t) {
|
|
7194
7251
|
for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
|
|
7195
7252
|
return !0;
|
|
7196
7253
|
}
|
|
7197
|
-
function
|
|
7254
|
+
function Ga(e, t = !1) {
|
|
7198
7255
|
if (!(!e?.address || !Lr(e.address))) return e.address + (t ? `:${e.port}` : "");
|
|
7199
7256
|
}
|
|
7200
|
-
function
|
|
7257
|
+
function Ka(e) {
|
|
7201
7258
|
return e === void 0;
|
|
7202
7259
|
}
|
|
7203
|
-
function
|
|
7260
|
+
function qa(e) {
|
|
7204
7261
|
return Number.isNaN(e) ? 0 : e;
|
|
7205
7262
|
}
|
|
7206
7263
|
//#endregion
|
|
7207
7264
|
//#region src/static/Capabilities.ts
|
|
7208
|
-
var
|
|
7265
|
+
var Ja;
|
|
7209
7266
|
(function(e) {
|
|
7210
7267
|
function t() {
|
|
7211
7268
|
return {
|
|
7212
|
-
estimatedPerformanceIndex:
|
|
7269
|
+
estimatedPerformanceIndex: Ua.getEstimatedPerformanceIndex(),
|
|
7213
7270
|
audioMix: !0,
|
|
7214
7271
|
consumerUpdate: !0,
|
|
7215
7272
|
producerNotificationDataChannelVersion: 8,
|
|
@@ -7235,8 +7292,8 @@ var qa;
|
|
|
7235
7292
|
};
|
|
7236
7293
|
}
|
|
7237
7294
|
e.get = t;
|
|
7238
|
-
})(
|
|
7239
|
-
var
|
|
7295
|
+
})(Ja || (Ja = {}));
|
|
7296
|
+
var Ya = Ja, Xa = {
|
|
7240
7297
|
producerScreenTrack: () => !0,
|
|
7241
7298
|
videoTracksCount: () => N.videoTracksCount > 0,
|
|
7242
7299
|
waitingHall: () => !0,
|
|
@@ -7256,28 +7313,28 @@ var Ja = qa, Ya = {
|
|
|
7256
7313
|
p2pRelay: () => !1,
|
|
7257
7314
|
waitForAdmin: () => N.waitForAdminInGroupCalls,
|
|
7258
7315
|
hold: () => N.hold
|
|
7259
|
-
},
|
|
7316
|
+
}, Za = class {
|
|
7260
7317
|
static getFlags() {
|
|
7261
|
-
let e = Object.values(
|
|
7318
|
+
let e = Object.values(Xa), t = 0;
|
|
7262
7319
|
for (let n = 0; n < e.length; n++) e[n]() && (t |= 1 << n);
|
|
7263
7320
|
return t.toString(16).toUpperCase();
|
|
7264
7321
|
}
|
|
7265
7322
|
static parseCapabilities(e) {
|
|
7266
7323
|
let t = parseInt(e || "0", 16);
|
|
7267
|
-
return Object.keys(
|
|
7324
|
+
return Object.keys(Xa).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
|
|
7268
7325
|
}
|
|
7269
|
-
},
|
|
7326
|
+
}, Qa = 63n, $a = 16383n, eo = 1073741823, to = 4611686018427387903n, no = class {
|
|
7270
7327
|
encode(e) {
|
|
7271
7328
|
let t = typeof e == "number" ? BigInt(e) : e;
|
|
7272
|
-
if (t <=
|
|
7273
|
-
if (t <=
|
|
7274
|
-
if (t <= BigInt(
|
|
7329
|
+
if (t <= Qa) return new Uint8Array([Number(t)]);
|
|
7330
|
+
if (t <= $a) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
|
|
7331
|
+
if (t <= BigInt(eo)) return new Uint8Array([
|
|
7275
7332
|
128 | Number(t >> 24n),
|
|
7276
7333
|
Number(t >> 16n & 255n),
|
|
7277
7334
|
Number(t >> 8n & 255n),
|
|
7278
7335
|
Number(t & 255n)
|
|
7279
7336
|
]);
|
|
7280
|
-
if (t <=
|
|
7337
|
+
if (t <= to) return new Uint8Array([
|
|
7281
7338
|
192 | Number(t >> 56n),
|
|
7282
7339
|
Number(t >> 48n & 255n),
|
|
7283
7340
|
Number(t >> 40n & 255n),
|
|
@@ -7289,7 +7346,7 @@ var Ja = qa, Ya = {
|
|
|
7289
7346
|
]);
|
|
7290
7347
|
throw RangeError("Number is too large to encode using varint");
|
|
7291
7348
|
}
|
|
7292
|
-
},
|
|
7349
|
+
}, ro = class {
|
|
7293
7350
|
decode(e) {
|
|
7294
7351
|
let t = this.getNumBytesForLengthInteger(e);
|
|
7295
7352
|
if (t < 0) throw Error("Invalid length prefix");
|
|
@@ -7315,9 +7372,9 @@ var Ja = qa, Ya = {
|
|
|
7315
7372
|
let t = e[0] & 192;
|
|
7316
7373
|
return t === 0 ? 1 : t === 64 ? 2 : t === 128 ? 4 : t === 192 ? 8 : -1;
|
|
7317
7374
|
}
|
|
7318
|
-
},
|
|
7375
|
+
}, io = class {
|
|
7319
7376
|
constructor(e) {
|
|
7320
|
-
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new
|
|
7377
|
+
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new no(), this.compression = e ?? null;
|
|
7321
7378
|
}
|
|
7322
7379
|
encode(e) {
|
|
7323
7380
|
let t = this.encoder.encode(e);
|
|
@@ -7334,9 +7391,9 @@ var Ja = qa, Ya = {
|
|
|
7334
7391
|
default: return e;
|
|
7335
7392
|
}
|
|
7336
7393
|
}
|
|
7337
|
-
},
|
|
7394
|
+
}, ao = class {
|
|
7338
7395
|
constructor(e) {
|
|
7339
|
-
h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new
|
|
7396
|
+
h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new ro(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
|
|
7340
7397
|
}
|
|
7341
7398
|
decode(e) {
|
|
7342
7399
|
let t = [];
|
|
@@ -7366,12 +7423,12 @@ var Ja = qa, Ya = {
|
|
|
7366
7423
|
default: return e;
|
|
7367
7424
|
}
|
|
7368
7425
|
}
|
|
7369
|
-
},
|
|
7426
|
+
}, oo = class {
|
|
7370
7427
|
static isBrowserSupported() {
|
|
7371
7428
|
return !(!("WebTransport" in window && typeof WebTransport == "function") || C.browserName() === "Safari");
|
|
7372
7429
|
}
|
|
7373
7430
|
constructor(e, t = {}, n = z) {
|
|
7374
|
-
h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new
|
|
7431
|
+
h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new io(this.compression), this.decoder = new ao(this.compression), this.connect();
|
|
7375
7432
|
}
|
|
7376
7433
|
async send(e) {
|
|
7377
7434
|
if (this.readyState !== WebSocket.OPEN) throw this._debug.warn("[WebTransport] Attempt to send data before webtransport is open"), Error("WebTransport is not open");
|
|
@@ -7491,9 +7548,9 @@ var Ja = qa, Ya = {
|
|
|
7491
7548
|
compression: this.compression
|
|
7492
7549
|
}, n;
|
|
7493
7550
|
}
|
|
7494
|
-
},
|
|
7551
|
+
}, so = /* @__PURE__ */ function(e) {
|
|
7495
7552
|
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT", e.RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT", e.ABORTED = "ABORTED", e;
|
|
7496
|
-
}({}),
|
|
7553
|
+
}({}), co = class {
|
|
7497
7554
|
constructor(e = z, t) {
|
|
7498
7555
|
h(this, "_debug", void 0), h(this, "handlers", void 0), h(this, "socket", null), h(this, "state", "terminal"), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "retryTimer", 0), h(this, "connectionDeadlineTimer", 0), h(this, "attemptTimer", 0), h(this, "pingTimer", 0), h(this, "pingTimeoutMs", N.waitMessageDelay), h(this, "reconnectTimeoutMs", N.signalingReconnectMaxDuration), h(this, "forceWebSocket", !1), h(this, "hasEstablished", !1), h(this, "abortSignal", void 0), h(this, "currentType", Tr.WEBSOCKET), h(this, "onAbort", this._onAbort.bind(this)), this._debug = e, this.handlers = t;
|
|
7499
7556
|
}
|
|
@@ -7534,7 +7591,7 @@ var Ja = qa, Ya = {
|
|
|
7534
7591
|
}
|
|
7535
7592
|
_connect() {
|
|
7536
7593
|
this.state = "connecting";
|
|
7537
|
-
let e = !this.forceWebSocket &&
|
|
7594
|
+
let e = !this.forceWebSocket && oo.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
|
|
7538
7595
|
this.currentType = e ? Tr.WEBTRANSPORT : Tr.WEBSOCKET;
|
|
7539
7596
|
let t = e ? this.wtEndpoint : this.endpoint;
|
|
7540
7597
|
if (!t) {
|
|
@@ -7548,7 +7605,7 @@ var Ja = qa, Ya = {
|
|
|
7548
7605
|
let n;
|
|
7549
7606
|
try {
|
|
7550
7607
|
let r = this._buildUrl(t, e);
|
|
7551
|
-
n = e ? new
|
|
7608
|
+
n = e ? new oo(r, { congestionControl: "low-latency" }, this._debug) : new WebSocket(r);
|
|
7552
7609
|
} catch (e) {
|
|
7553
7610
|
let t = Object.assign(new Event("error"), { error: e });
|
|
7554
7611
|
this.handlers.onError(t), this.active && this._retry();
|
|
@@ -7566,7 +7623,7 @@ var Ja = qa, Ya = {
|
|
|
7566
7623
|
}
|
|
7567
7624
|
_buildUrl(e, t) {
|
|
7568
7625
|
let n = new URL(e), r = n.searchParams;
|
|
7569
|
-
return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities",
|
|
7626
|
+
return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Za.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === Cr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
|
|
7570
7627
|
}
|
|
7571
7628
|
_onMessage(e, t) {
|
|
7572
7629
|
if (e.data === "ping") {
|
|
@@ -7659,31 +7716,31 @@ var Ja = qa, Ya = {
|
|
|
7659
7716
|
...n === void 0 ? {} : { remote: n }
|
|
7660
7717
|
});
|
|
7661
7718
|
}
|
|
7662
|
-
},
|
|
7719
|
+
}, lo = "open", uo = 300, fo = 10, po = {
|
|
7663
7720
|
CONVERSATION_ENDED: "conversation-ended",
|
|
7664
7721
|
OBSOLETE_CLIENT: "gen.obsoleteClient",
|
|
7665
7722
|
INVALID_TOKEN: "invalid-token",
|
|
7666
7723
|
PARTICIPANT_NOT_FOUND: "participant-not-found",
|
|
7667
7724
|
ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
|
|
7668
7725
|
SERVICE_UNAVAILABLE: "service-unavailable"
|
|
7669
|
-
},
|
|
7670
|
-
[
|
|
7671
|
-
[
|
|
7672
|
-
[
|
|
7673
|
-
[
|
|
7674
|
-
[
|
|
7675
|
-
[
|
|
7726
|
+
}, mo = {
|
|
7727
|
+
[po.CONVERSATION_ENDED]: "conversation-ended",
|
|
7728
|
+
[po.OBSOLETE_CLIENT]: "obsolete-client",
|
|
7729
|
+
[po.INVALID_TOKEN]: "invalid-token",
|
|
7730
|
+
[po.PARTICIPANT_NOT_FOUND]: "participant-not-found",
|
|
7731
|
+
[po.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
|
|
7732
|
+
[po.SERVICE_UNAVAILABLE]: "service-unavailable"
|
|
7676
7733
|
};
|
|
7677
|
-
function
|
|
7734
|
+
function ho(e, t) {
|
|
7678
7735
|
return e.errorMessage ?? e.message ?? e.error ?? t;
|
|
7679
7736
|
}
|
|
7680
|
-
var
|
|
7737
|
+
var go = new Set([
|
|
7681
7738
|
p.CALLER_IS_BLOCKED,
|
|
7682
7739
|
p.ENDED,
|
|
7683
7740
|
p.NOT_FOUND,
|
|
7684
7741
|
p.PARTICIPANT_LIMIT_REACHED,
|
|
7685
7742
|
p.SERVICE_UNAVAILABLE
|
|
7686
|
-
]),
|
|
7743
|
+
]), _o = class e extends Xe {
|
|
7687
7744
|
static get WAIT_RESPONSE_DELAY() {
|
|
7688
7745
|
return N.waitResponseDelay;
|
|
7689
7746
|
}
|
|
@@ -7691,7 +7748,7 @@ var ho = new Set([
|
|
|
7691
7748
|
return !this.disposed && this.session.active;
|
|
7692
7749
|
}
|
|
7693
7750
|
constructor(e = z, t = null, n = null, r = null, i = null) {
|
|
7694
|
-
super(), h(this, "session", void 0), h(this, "sequence", 1), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "listenersReady", !1), h(this, "reconnectStartedAt", null), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new ir(e), this.session = new
|
|
7751
|
+
super(), h(this, "session", void 0), h(this, "sequence", 1), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "listenersReady", !1), h(this, "reconnectStartedAt", null), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new ir(e), this.session = new co(e, {
|
|
7695
7752
|
onConnecting: this._onTransportConnecting.bind(this),
|
|
7696
7753
|
onOpen: this._onOpen.bind(this),
|
|
7697
7754
|
onMessage: this._onMessage.bind(this),
|
|
@@ -7782,24 +7839,24 @@ var ho = new Set([
|
|
|
7782
7839
|
return this._send(V.TRANSMIT_DATA, {
|
|
7783
7840
|
participantId: e,
|
|
7784
7841
|
data: r
|
|
7785
|
-
}, !0,
|
|
7842
|
+
}, !0, fo);
|
|
7786
7843
|
}
|
|
7787
7844
|
async acceptCall(e) {
|
|
7788
7845
|
return this._send(V.ACCEPT_CALL, { mediaSettings: e });
|
|
7789
7846
|
}
|
|
7790
7847
|
async changeMediaSettings(e) {
|
|
7791
|
-
return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0,
|
|
7848
|
+
return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, fo);
|
|
7792
7849
|
}
|
|
7793
7850
|
async changeParticipantState(e, t) {
|
|
7794
7851
|
let n = { participantState: { state: e } };
|
|
7795
7852
|
return t && (n.participantId = t), this._sendRaw(V.CHANGE_PARTICIPANT_STATE, n);
|
|
7796
7853
|
}
|
|
7797
7854
|
async hold(e) {
|
|
7798
|
-
let t =
|
|
7855
|
+
let t = Ya.get();
|
|
7799
7856
|
return this._send(V.HOLD, {
|
|
7800
7857
|
hold: e,
|
|
7801
7858
|
capabilities: e ? void 0 : t
|
|
7802
|
-
}, !0,
|
|
7859
|
+
}, !0, fo);
|
|
7803
7860
|
}
|
|
7804
7861
|
async putHandsDown() {
|
|
7805
7862
|
return this._send(V.PUT_HANDS_DOWN);
|
|
@@ -8027,7 +8084,7 @@ var ho = new Set([
|
|
|
8027
8084
|
if (this.disposed) throw new An(e);
|
|
8028
8085
|
switch (t.route) {
|
|
8029
8086
|
case "producer":
|
|
8030
|
-
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState ===
|
|
8087
|
+
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === lo && this._handleCommandsQueue(this.datachannelCommandsQueue);
|
|
8031
8088
|
break;
|
|
8032
8089
|
case "websocket":
|
|
8033
8090
|
if (!this.session.active) {
|
|
@@ -8100,9 +8157,9 @@ var ho = new Set([
|
|
|
8100
8157
|
}
|
|
8101
8158
|
_handleErrorMessage(e) {
|
|
8102
8159
|
this._logger?.log(x.SOCKET_ACTION, `error-${e.error}`);
|
|
8103
|
-
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r =
|
|
8160
|
+
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = ho(e, "Unknown signaling error");
|
|
8104
8161
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
8105
|
-
case
|
|
8162
|
+
case po.SERVICE_UNAVAILABLE:
|
|
8106
8163
|
let t = new k(p.SERVICE_UNAVAILABLE, {
|
|
8107
8164
|
callError: n,
|
|
8108
8165
|
message: r,
|
|
@@ -8114,7 +8171,7 @@ var ho = new Set([
|
|
|
8114
8171
|
reason: p.SERVICE_UNAVAILABLE
|
|
8115
8172
|
});
|
|
8116
8173
|
break;
|
|
8117
|
-
case
|
|
8174
|
+
case po.CONVERSATION_ENDED:
|
|
8118
8175
|
this.conversationReject ? this.dispose(new k(e.reason || y.SIGNALING_FAILED, {
|
|
8119
8176
|
callError: n,
|
|
8120
8177
|
message: r,
|
|
@@ -8125,15 +8182,15 @@ var ho = new Set([
|
|
|
8125
8182
|
reason: e.reason
|
|
8126
8183
|
});
|
|
8127
8184
|
break;
|
|
8128
|
-
case
|
|
8129
|
-
case
|
|
8185
|
+
case po.ILLEGAL_PARTICIPANT_STATE:
|
|
8186
|
+
case po.PARTICIPANT_NOT_FOUND:
|
|
8130
8187
|
this._throwError(new k(y.SIGNALING_FAILED, {
|
|
8131
8188
|
callError: n,
|
|
8132
8189
|
message: r,
|
|
8133
8190
|
remote: !0
|
|
8134
8191
|
}));
|
|
8135
8192
|
break;
|
|
8136
|
-
case
|
|
8193
|
+
case po.OBSOLETE_CLIENT:
|
|
8137
8194
|
if (!this.conversationReject) break;
|
|
8138
8195
|
this.dispose(new k(e.reason || p.OBSOLETE_CLIENT, {
|
|
8139
8196
|
callError: n,
|
|
@@ -8141,7 +8198,7 @@ var ho = new Set([
|
|
|
8141
8198
|
remote: !0
|
|
8142
8199
|
}));
|
|
8143
8200
|
break;
|
|
8144
|
-
case
|
|
8201
|
+
case po.INVALID_TOKEN:
|
|
8145
8202
|
default:
|
|
8146
8203
|
if (e.sequence) break;
|
|
8147
8204
|
let i = new k(e.reason || y.SIGNALING_FAILED, {
|
|
@@ -8170,7 +8227,7 @@ var ho = new Set([
|
|
|
8170
8227
|
}
|
|
8171
8228
|
_describeErrorEvent(e) {
|
|
8172
8229
|
let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
|
|
8173
|
-
return (i ? `${i}: ${r}` : r).slice(0,
|
|
8230
|
+
return (i ? `${i}: ${r}` : r).slice(0, uo);
|
|
8174
8231
|
}
|
|
8175
8232
|
_onClose(e) {
|
|
8176
8233
|
this._logger?.log(x.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
|
|
@@ -8225,13 +8282,13 @@ var ho = new Set([
|
|
|
8225
8282
|
let r = this.responseHandlers[n.sequence];
|
|
8226
8283
|
window.clearTimeout(r.responseTimer);
|
|
8227
8284
|
let i = G.measureMark(r.statMarkName);
|
|
8228
|
-
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-error"), r.reject(Error(
|
|
8285
|
+
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-error"), r.reject(Error(ho(n, `Response error [${r.name}]`)), !0)) : (r.route === "producer" ? this.session.canSend : this.session.established) ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-timeout"), r.reject(Error(ho(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
8229
8286
|
}
|
|
8230
8287
|
_handleCommandsQueue(e) {
|
|
8231
8288
|
for (; e.length > 0;) {
|
|
8232
8289
|
let t = e.shift();
|
|
8233
8290
|
if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), t.route === "producer") {
|
|
8234
|
-
if (this.producerCommandDataChannel?.readyState !==
|
|
8291
|
+
if (this.producerCommandDataChannel?.readyState !== lo) {
|
|
8235
8292
|
t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
|
|
8236
8293
|
return;
|
|
8237
8294
|
}
|
|
@@ -8298,7 +8355,7 @@ var ho = new Set([
|
|
|
8298
8355
|
}
|
|
8299
8356
|
_onSessionFailed(e) {
|
|
8300
8357
|
switch (e.failure) {
|
|
8301
|
-
case
|
|
8358
|
+
case so.EMPTY_ENDPOINT:
|
|
8302
8359
|
this.dispose(new k(y.SIGNALING_FAILED, {
|
|
8303
8360
|
callError: {
|
|
8304
8361
|
scope: "internal",
|
|
@@ -8309,7 +8366,7 @@ var ho = new Set([
|
|
|
8309
8366
|
remote: e.remote
|
|
8310
8367
|
}));
|
|
8311
8368
|
break;
|
|
8312
|
-
case
|
|
8369
|
+
case so.CONNECTION_TIMEOUT:
|
|
8313
8370
|
this._logReconnectTimeout(), this._fail(new k(y.SIGNALING_FAILED, {
|
|
8314
8371
|
callError: {
|
|
8315
8372
|
scope: "network",
|
|
@@ -8321,7 +8378,7 @@ var ho = new Set([
|
|
|
8321
8378
|
remote: !0
|
|
8322
8379
|
}));
|
|
8323
8380
|
break;
|
|
8324
|
-
case
|
|
8381
|
+
case so.RECONNECT_TIMEOUT:
|
|
8325
8382
|
this._logReconnectTimeout(), this._fail(new k(p.NETWORK_ERROR, { callError: {
|
|
8326
8383
|
scope: "network",
|
|
8327
8384
|
source: e.source,
|
|
@@ -8329,7 +8386,7 @@ var ho = new Set([
|
|
|
8329
8386
|
description: "connection-failed"
|
|
8330
8387
|
} }));
|
|
8331
8388
|
break;
|
|
8332
|
-
case
|
|
8389
|
+
case so.ABORTED: {
|
|
8333
8390
|
this._debug.debug("[signaling] aborted reconnect");
|
|
8334
8391
|
let e = new k(p.CANCELED);
|
|
8335
8392
|
this.conversationReject ? this.dispose(e) : this._fail(e);
|
|
@@ -8347,7 +8404,7 @@ var ho = new Set([
|
|
|
8347
8404
|
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(Er.FAILED_PINGS);
|
|
8348
8405
|
}
|
|
8349
8406
|
_attachNotificationCallError(e) {
|
|
8350
|
-
e.callError || !e.reason || e.reason === p.FAILED || e.reason === p.UNKNOWN_ERROR || !
|
|
8407
|
+
e.callError || !e.reason || e.reason === p.FAILED || e.reason === p.UNKNOWN_ERROR || !go.has(e.reason) && !e.errorCode || (e.callError = {
|
|
8351
8408
|
scope: "server",
|
|
8352
8409
|
source: this._getSocketType(),
|
|
8353
8410
|
code: e.errorCode || "protocol",
|
|
@@ -8355,7 +8412,7 @@ var ho = new Set([
|
|
|
8355
8412
|
});
|
|
8356
8413
|
}
|
|
8357
8414
|
_createSignalingCallError(e, t, n) {
|
|
8358
|
-
let r =
|
|
8415
|
+
let r = mo[e];
|
|
8359
8416
|
if (r) return {
|
|
8360
8417
|
scope: "server",
|
|
8361
8418
|
source: n,
|
|
@@ -8381,39 +8438,39 @@ var ho = new Set([
|
|
|
8381
8438
|
let t = this._getSocketType(), n = Dr[e][t];
|
|
8382
8439
|
this._statAggregator?.logEventualStatSinceMark({ name: n });
|
|
8383
8440
|
}
|
|
8384
|
-
},
|
|
8441
|
+
}, vo = /* @__PURE__ */ function(e) {
|
|
8385
8442
|
return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
|
|
8386
|
-
}(_o || {}), vo = /* @__PURE__ */ function(e) {
|
|
8387
|
-
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
8388
8443
|
}(vo || {}), yo = /* @__PURE__ */ function(e) {
|
|
8389
|
-
return e.
|
|
8444
|
+
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
8390
8445
|
}(yo || {}), bo = /* @__PURE__ */ function(e) {
|
|
8391
|
-
return e.
|
|
8446
|
+
return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
|
|
8392
8447
|
}(bo || {}), xo = /* @__PURE__ */ function(e) {
|
|
8448
|
+
return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
|
|
8449
|
+
}(xo || {}), So = /* @__PURE__ */ function(e) {
|
|
8393
8450
|
return e.REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN", e.AUDIENCE_MODE = "AUDIENCE_MODE", e.WAITING_HALL = "WAITING_HALL", e.WAIT_FOR_ADMIN = "WAIT_FOR_ADMIN", e.ADMIN_IS_HERE = "ADMIN_IS_HERE", e.ASR = "ASR", e.FEEDBACK = "FEEDBACK", e.RECURRING = "RECURRING", e;
|
|
8394
|
-
}(
|
|
8395
|
-
function
|
|
8451
|
+
}(So || {});
|
|
8452
|
+
function Co(e, t) {
|
|
8396
8453
|
if (e.length !== t.length) return !1;
|
|
8397
8454
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
8398
8455
|
return !0;
|
|
8399
8456
|
}
|
|
8400
|
-
function
|
|
8457
|
+
function wo(e, t) {
|
|
8401
8458
|
let n = new Set(e);
|
|
8402
8459
|
for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
|
|
8403
8460
|
return Array.from(n);
|
|
8404
8461
|
}
|
|
8405
8462
|
//#endregion
|
|
8406
8463
|
//#region src/enums/MuteState.ts
|
|
8407
|
-
var
|
|
8464
|
+
var To = /* @__PURE__ */ function(e) {
|
|
8408
8465
|
return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
|
|
8409
|
-
}(
|
|
8466
|
+
}(To || {}), X = /* @__PURE__ */ function(e) {
|
|
8410
8467
|
return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
|
|
8411
|
-
}(X || {}),
|
|
8468
|
+
}(X || {}), Eo = /* @__PURE__ */ function(e) {
|
|
8412
8469
|
return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
|
|
8413
|
-
}(
|
|
8470
|
+
}(Eo || {}), Do = /* @__PURE__ */ function(e) {
|
|
8414
8471
|
return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
|
|
8415
|
-
}(
|
|
8416
|
-
function
|
|
8472
|
+
}(Do || {});
|
|
8473
|
+
function Oo(e) {
|
|
8417
8474
|
switch (e) {
|
|
8418
8475
|
case 1: return "no-available-tracks";
|
|
8419
8476
|
default: return "unknown-error";
|
|
@@ -8421,17 +8478,17 @@ function Do(e) {
|
|
|
8421
8478
|
}
|
|
8422
8479
|
//#endregion
|
|
8423
8480
|
//#region src/enums/UserRole.ts
|
|
8424
|
-
var
|
|
8481
|
+
var ko = /* @__PURE__ */ function(e) {
|
|
8425
8482
|
return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
|
|
8426
|
-
}(
|
|
8427
|
-
function
|
|
8483
|
+
}(ko || {});
|
|
8484
|
+
function Ao(e, t) {
|
|
8428
8485
|
if (e.length !== t.length) return !1;
|
|
8429
8486
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
8430
8487
|
return !0;
|
|
8431
8488
|
}
|
|
8432
8489
|
//#endregion
|
|
8433
8490
|
//#region src/static/ParticipantConnectionStatusUtils.ts
|
|
8434
|
-
var
|
|
8491
|
+
var jo;
|
|
8435
8492
|
(function(e) {
|
|
8436
8493
|
function t(e) {
|
|
8437
8494
|
let t = e?.transport ?? e?.lastEffective ?? P.WAITING, n = {
|
|
@@ -8483,8 +8540,8 @@ var Ao;
|
|
|
8483
8540
|
shouldNotify: !0
|
|
8484
8541
|
});
|
|
8485
8542
|
}
|
|
8486
|
-
})(
|
|
8487
|
-
var
|
|
8543
|
+
})(jo || (jo = {}));
|
|
8544
|
+
var Mo = jo, No = /* @__PURE__ */ function(e) {
|
|
8488
8545
|
return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
|
|
8489
8546
|
}({}), Z;
|
|
8490
8547
|
(function(e) {
|
|
@@ -8547,7 +8604,7 @@ var jo = Ao, Mo = /* @__PURE__ */ function(e) {
|
|
|
8547
8604
|
})(Z || (Z = {}));
|
|
8548
8605
|
//#endregion
|
|
8549
8606
|
//#region src/types/WaitingHall.ts
|
|
8550
|
-
function
|
|
8607
|
+
function Po(e) {
|
|
8551
8608
|
try {
|
|
8552
8609
|
return btoa(JSON.stringify(e));
|
|
8553
8610
|
} catch (t) {
|
|
@@ -8555,7 +8612,7 @@ function No(e) {
|
|
|
8555
8612
|
}
|
|
8556
8613
|
return null;
|
|
8557
8614
|
}
|
|
8558
|
-
function
|
|
8615
|
+
function Fo(e) {
|
|
8559
8616
|
try {
|
|
8560
8617
|
return JSON.parse(atob(e));
|
|
8561
8618
|
} catch (t) {
|
|
@@ -8565,12 +8622,12 @@ function Po(e) {
|
|
|
8565
8622
|
}
|
|
8566
8623
|
//#endregion
|
|
8567
8624
|
//#region src/utils/Conversation.ts
|
|
8568
|
-
var
|
|
8569
|
-
function
|
|
8625
|
+
var Io = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
|
|
8626
|
+
function Lo(e) {
|
|
8570
8627
|
if (e.conversation?.muteStates) return e.conversation.muteStates;
|
|
8571
8628
|
if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
|
|
8572
8629
|
}
|
|
8573
|
-
function
|
|
8630
|
+
function Ro(e, t) {
|
|
8574
8631
|
switch (e) {
|
|
8575
8632
|
case b.AUDIO: return !!t.isAudioEnabled;
|
|
8576
8633
|
case b.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
|
|
@@ -8579,12 +8636,12 @@ function Lo(e, t) {
|
|
|
8579
8636
|
default: return !1;
|
|
8580
8637
|
}
|
|
8581
8638
|
}
|
|
8582
|
-
function
|
|
8639
|
+
function zo(e, t) {
|
|
8583
8640
|
return M.objectReduce(e, (e, n, r) => {
|
|
8584
8641
|
switch (n) {
|
|
8585
|
-
case
|
|
8586
|
-
case
|
|
8587
|
-
|
|
8642
|
+
case To.MUTE:
|
|
8643
|
+
case To.MUTE_PERMANENT:
|
|
8644
|
+
Ro(r, t) || (e[r] = n);
|
|
8588
8645
|
break;
|
|
8589
8646
|
default:
|
|
8590
8647
|
e[r] = n;
|
|
@@ -8593,19 +8650,19 @@ function Ro(e, t) {
|
|
|
8593
8650
|
return e;
|
|
8594
8651
|
}, {});
|
|
8595
8652
|
}
|
|
8596
|
-
function
|
|
8653
|
+
function Bo(e) {
|
|
8597
8654
|
let { muteStates: t = {}, mediaSettings: n } = e;
|
|
8598
|
-
return
|
|
8655
|
+
return zo(t, n);
|
|
8599
8656
|
}
|
|
8600
|
-
function
|
|
8657
|
+
function Vo(e, t) {
|
|
8601
8658
|
let n = e.conversation.participants.find((t) => M.comparePeerId(t.peerId, e.peerId));
|
|
8602
8659
|
if (!n) return t;
|
|
8603
8660
|
let { mediaSettings: r } = n;
|
|
8604
|
-
return
|
|
8661
|
+
return zo(t, r);
|
|
8605
8662
|
}
|
|
8606
8663
|
//#endregion
|
|
8607
8664
|
//#region src/utils/IceServers.ts
|
|
8608
|
-
function
|
|
8665
|
+
function Ho(e) {
|
|
8609
8666
|
if (!e) return null;
|
|
8610
8667
|
let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
|
|
8611
8668
|
return t.length ? {
|
|
@@ -8613,8 +8670,8 @@ function Vo(e) {
|
|
|
8613
8670
|
urls: t
|
|
8614
8671
|
} : null;
|
|
8615
8672
|
}
|
|
8616
|
-
function
|
|
8617
|
-
let n = [], r =
|
|
8673
|
+
function Uo(e, t) {
|
|
8674
|
+
let n = [], r = Ho(e), i = Ho(t);
|
|
8618
8675
|
if (r && n.push(r), i) {
|
|
8619
8676
|
let e = [...i.urls];
|
|
8620
8677
|
e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
|
|
@@ -8626,7 +8683,7 @@ function Ho(e, t) {
|
|
|
8626
8683
|
}
|
|
8627
8684
|
//#endregion
|
|
8628
8685
|
//#region src/utils/Lz4.ts
|
|
8629
|
-
function
|
|
8686
|
+
function Wo(e, t) {
|
|
8630
8687
|
let n = new Uint8Array(t), r = 0, i = 0;
|
|
8631
8688
|
for (; r < e.length && i < t;) {
|
|
8632
8689
|
let a = e[r++], o = a >> 4, s = a & 15;
|
|
@@ -8653,7 +8710,7 @@ function Uo(e, t) {
|
|
|
8653
8710
|
}
|
|
8654
8711
|
//#endregion
|
|
8655
8712
|
//#region src/utils/SerializeLatest.ts
|
|
8656
|
-
function
|
|
8713
|
+
function Go(e) {
|
|
8657
8714
|
let t, n = !1, r, i = async () => {
|
|
8658
8715
|
let t = !1, i;
|
|
8659
8716
|
for (; n;) {
|
|
@@ -8674,7 +8731,7 @@ function Wo(e) {
|
|
|
8674
8731
|
}
|
|
8675
8732
|
//#endregion
|
|
8676
8733
|
//#region src/classes/AudioFix.ts
|
|
8677
|
-
var
|
|
8734
|
+
var Ko = class {
|
|
8678
8735
|
constructor(e, t = z, n = null) {
|
|
8679
8736
|
h(this, "_fixNoPacketsApplied", !1), h(this, "_fixNoPacketsChecked", !1), h(this, "_fixTooManyPacketsApplied", !1), h(this, "_fixTooManyPacketsSucceeded", !1), h(this, "_fixTooManyPacketsFailed", !1), h(this, "_fixTooManyPacketsTime", void 0), h(this, "_mediaSource", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_lastPacketsSent", void 0), h(this, "_lastPacketsSentTime", void 0), h(this, "_toggleAudioPromise", null), h(this, "_fixNoPacketsAppliedVideo", !1), this._mediaSource = e, this._debug = t, this._logger = n;
|
|
8680
8737
|
}
|
|
@@ -8712,7 +8769,7 @@ var Go = class {
|
|
|
8712
8769
|
this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
|
|
8713
8770
|
}));
|
|
8714
8771
|
}
|
|
8715
|
-
},
|
|
8772
|
+
}, qo = class {
|
|
8716
8773
|
constructor(e, t = !1, n = z, r = null) {
|
|
8717
8774
|
h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), h(this, "_autoplayRecoveryController", null), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
|
|
8718
8775
|
}
|
|
@@ -8833,13 +8890,13 @@ var Go = class {
|
|
|
8833
8890
|
};
|
|
8834
8891
|
//#endregion
|
|
8835
8892
|
//#region src/classes/conversation/ConversationResponseValidator.ts
|
|
8836
|
-
function
|
|
8837
|
-
e ||
|
|
8893
|
+
function Jo(e, t) {
|
|
8894
|
+
e || Xo(t, "response-empty"), e.id || Xo(t, "id-empty"), e.endpoint || Xo(t, "endpoint-empty"), !Yo(e.stun_server) && !Yo(e.turn_server) && Xo(t, "ice-servers-empty");
|
|
8838
8895
|
}
|
|
8839
|
-
function
|
|
8896
|
+
function Yo(e) {
|
|
8840
8897
|
return Array.isArray(e?.urls) && e.urls.length > 0;
|
|
8841
8898
|
}
|
|
8842
|
-
function
|
|
8899
|
+
function Xo(e, t) {
|
|
8843
8900
|
let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
|
|
8844
8901
|
throw new k(r ? e === "fastStart" ? p.FAST_START_ERROR : p.FAST_JOIN_ERROR : p.UNKNOWN_ERROR, {
|
|
8845
8902
|
message: `Invalid ${e} response: ${t}`,
|
|
@@ -8858,7 +8915,7 @@ function Yo(e, t) {
|
|
|
8858
8915
|
}
|
|
8859
8916
|
//#endregion
|
|
8860
8917
|
//#region src/classes/DebugInfo.ts
|
|
8861
|
-
var
|
|
8918
|
+
var Zo = 90, Qo = 3, $o = class extends Xe {
|
|
8862
8919
|
constructor(e = z) {
|
|
8863
8920
|
super(), h(this, "_lastMemoryStat", {
|
|
8864
8921
|
percent: 0,
|
|
@@ -8874,9 +8931,9 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
8874
8931
|
let e = window?.performance?.memory;
|
|
8875
8932
|
if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
|
|
8876
8933
|
let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
|
|
8877
|
-
t >
|
|
8934
|
+
t > Zo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Qo) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
|
|
8878
8935
|
}
|
|
8879
|
-
},
|
|
8936
|
+
}, es = class {
|
|
8880
8937
|
constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
|
|
8881
8938
|
h(this, "_api", void 0), h(this, "_debug", void 0), h(this, "_getParticipants", void 0), h(this, "_isMe", void 0), h(this, "_updateDisplayLayout", void 0), h(this, "_onNonFatalError", void 0), h(this, "_requestedLayouts", {}), h(this, "_uncertainLayouts", {}), h(this, "_pendingRequests", null), h(this, "_pendingPromises", []), h(this, "_lastRequests", null), h(this, "_timer", null), h(this, "_inFlight", !1), h(this, "_lastFlushAt", null), h(this, "_generation", 0), h(this, "_forceNextFlush", !1), this._api = e, this._debug = t, this._getParticipants = n, this._isMe = r, this._updateDisplayLayout = i, this._onNonFatalError = a;
|
|
8882
8939
|
}
|
|
@@ -8991,7 +9048,7 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
8991
9048
|
let n = e, r = t;
|
|
8992
9049
|
return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
|
|
8993
9050
|
}
|
|
8994
|
-
},
|
|
9051
|
+
}, ts = 44100, ns = class {
|
|
8995
9052
|
constructor(e, t) {
|
|
8996
9053
|
h(this, "_analyser", null), h(this, "_gainNode", null), h(this, "_fftBins", null), h(this, "_mediaStreamSource", null), h(this, "_lastSmoothedLevel", 0), h(this, "_trackId", void 0), h(this, "_track", void 0), h(this, "_stream", void 0), this._trackId = e, this._track = t, this._stream = new MediaStream([t]);
|
|
8997
9054
|
try {
|
|
@@ -9011,7 +9068,7 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9011
9068
|
_getBins() {
|
|
9012
9069
|
if (!this._fftBins || !this._analyser) return new Uint8Array();
|
|
9013
9070
|
this._analyser.getByteFrequencyData(this._fftBins);
|
|
9014
|
-
let e =
|
|
9071
|
+
let e = ts / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
|
|
9015
9072
|
return this._fftBins.subarray(t, n);
|
|
9016
9073
|
}
|
|
9017
9074
|
getLevel() {
|
|
@@ -9024,7 +9081,7 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9024
9081
|
destroy() {
|
|
9025
9082
|
this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track), D.releaseAudioContext(this);
|
|
9026
9083
|
}
|
|
9027
|
-
},
|
|
9084
|
+
}, rs = class extends Xe {
|
|
9028
9085
|
constructor(e) {
|
|
9029
9086
|
super(), h(this, "_detector", null), h(this, "_interval", null);
|
|
9030
9087
|
let t = () => {
|
|
@@ -9040,7 +9097,7 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9040
9097
|
}), this.subscribe(e, Zt.SOURCE_READY, n), n();
|
|
9041
9098
|
}
|
|
9042
9099
|
init(e) {
|
|
9043
|
-
this._stopDetector(), this._detector = new
|
|
9100
|
+
this._stopDetector(), this._detector = new ns("local", e.clone());
|
|
9044
9101
|
}
|
|
9045
9102
|
_stopDetector() {
|
|
9046
9103
|
this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
|
|
@@ -9048,7 +9105,7 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9048
9105
|
destroy() {
|
|
9049
9106
|
this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
|
|
9050
9107
|
}
|
|
9051
|
-
},
|
|
9108
|
+
}, is = class {
|
|
9052
9109
|
constructor(e, t = z) {
|
|
9053
9110
|
h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
|
|
9054
9111
|
}
|
|
@@ -9068,9 +9125,9 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9068
9125
|
this.isProcessing = !1;
|
|
9069
9126
|
}
|
|
9070
9127
|
}
|
|
9071
|
-
},
|
|
9128
|
+
}, as = /* @__PURE__ */ function(e) {
|
|
9072
9129
|
return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
|
|
9073
|
-
}({}),
|
|
9130
|
+
}({}), os = class extends Xe {
|
|
9074
9131
|
constructor(e) {
|
|
9075
9132
|
super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, Y.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
9076
9133
|
}
|
|
@@ -9078,7 +9135,7 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9078
9135
|
this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
|
|
9079
9136
|
}
|
|
9080
9137
|
_onRemoteTrackAdded(e, t, n) {
|
|
9081
|
-
if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new
|
|
9138
|
+
if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new ns(e, n)), !this._interval)) {
|
|
9082
9139
|
let e = () => {
|
|
9083
9140
|
this._collectVolumes(), this._interval = window.setTimeout(e, N.voiceParams.interval);
|
|
9084
9141
|
};
|
|
@@ -9132,11 +9189,11 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9132
9189
|
e.destroy();
|
|
9133
9190
|
}), this._detectors.clear();
|
|
9134
9191
|
}
|
|
9135
|
-
},
|
|
9192
|
+
}, ss = /* @__PURE__ */ function(e) {
|
|
9136
9193
|
return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
|
|
9137
|
-
}({}),
|
|
9194
|
+
}({}), cs = class extends Xe {
|
|
9138
9195
|
constructor(e, t, n) {
|
|
9139
|
-
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e,
|
|
9196
|
+
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, as.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, Y.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
9140
9197
|
}
|
|
9141
9198
|
destroy() {
|
|
9142
9199
|
this.unsubscribe();
|
|
@@ -9158,9 +9215,9 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9158
9215
|
_onTopologyChanged(e) {
|
|
9159
9216
|
this._serverSideSpeakerDetection = e === J.SERVER;
|
|
9160
9217
|
}
|
|
9161
|
-
},
|
|
9218
|
+
}, ls = 15e3, us = 15e3, ds = class extends Xe {
|
|
9162
9219
|
constructor(e, t, n, r = z, i = null) {
|
|
9163
|
-
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t,
|
|
9220
|
+
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, as.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
|
|
9164
9221
|
}
|
|
9165
9222
|
destroy() {
|
|
9166
9223
|
this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
|
|
@@ -9172,10 +9229,10 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9172
9229
|
this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
|
|
9173
9230
|
}
|
|
9174
9231
|
_getConnectionTimeout() {
|
|
9175
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
9232
|
+
return this._transport.getTopology() === J.DIRECT ? ls : N.specListenerParams.connectionTimeout;
|
|
9176
9233
|
}
|
|
9177
9234
|
_getVolumeTimeout() {
|
|
9178
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
9235
|
+
return this._transport.getTopology() === J.DIRECT ? us : N.specListenerParams.volumeTimeout;
|
|
9179
9236
|
}
|
|
9180
9237
|
_onTransportStateChanged(e, t) {
|
|
9181
9238
|
t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
|
|
@@ -9208,15 +9265,15 @@ var Xo = 90, Zo = 3, Qo = class extends Xe {
|
|
|
9208
9265
|
r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
|
|
9209
9266
|
}), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
|
|
9210
9267
|
}
|
|
9211
|
-
},
|
|
9268
|
+
}, fs = /* @__PURE__ */ function(e) {
|
|
9212
9269
|
return e[e.PARAM_SESSION_EXPIRED = 102] = "PARAM_SESSION_EXPIRED", e[e.PARAM_SESSION_KEY = 103] = "PARAM_SESSION_KEY", e[e.PARAM_SIGNATURE = 104] = "PARAM_SIGNATURE", e[e.AUTH_LOGIN = 401] = "AUTH_LOGIN", e;
|
|
9213
|
-
}(
|
|
9214
|
-
function
|
|
9270
|
+
}(fs || {});
|
|
9271
|
+
function ps(e) {
|
|
9215
9272
|
return e === 102 || e === 103 || e === 104;
|
|
9216
9273
|
}
|
|
9217
9274
|
//#endregion
|
|
9218
9275
|
//#region src/classes/stat/StatQueue.ts
|
|
9219
|
-
var
|
|
9276
|
+
var ms, hs = "ok-calls-sdk-stats", gs = 2, _s = "events", vs = "tails", ys = 100, bs = 5e3, xs = 10080 * 60 * 1e3, Ss = 5e3, Cs = 6e4, Q = class e {
|
|
9220
9277
|
static isSupported() {
|
|
9221
9278
|
return e._supported;
|
|
9222
9279
|
}
|
|
@@ -9233,30 +9290,30 @@ var ps, ms = "ok-calls-sdk-stats", hs = 2, gs = "events", _s = "tails", vs = 100
|
|
|
9233
9290
|
}
|
|
9234
9291
|
static async putTail(t) {
|
|
9235
9292
|
let n = await e._open();
|
|
9236
|
-
return n ? e._runTransaction(n, "readwrite", (e) => (e.put(t), !0), [
|
|
9293
|
+
return n ? e._runTransaction(n, "readwrite", (e) => (e.put(t), !0), [vs]).catch((e) => (z.error("[StatQueue] failed to put tail", e), !1)) : !1;
|
|
9237
9294
|
}
|
|
9238
9295
|
static async updateTail(t) {
|
|
9239
9296
|
let n = await e._open();
|
|
9240
|
-
return n ? e._runTransaction(n, "readwrite", async (n) => await e._request(n.count(t.key)) === 0 ? "missing" : (n.put(t), "updated"), [
|
|
9297
|
+
return n ? e._runTransaction(n, "readwrite", async (n) => await e._request(n.count(t.key)) === 0 ? "missing" : (n.put(t), "updated"), [vs]).catch((e) => (z.error("[StatQueue] failed to update tail", e), "failed")) : "failed";
|
|
9241
9298
|
}
|
|
9242
9299
|
static async removeTail(t) {
|
|
9243
9300
|
let n = await e._open();
|
|
9244
|
-
return n ? e._runTransaction(n, "readwrite", async (n) => await e._request(n.count(t)) === 0 ? "missing" : (n.delete(t), "removed"), [
|
|
9301
|
+
return n ? e._runTransaction(n, "readwrite", async (n) => await e._request(n.count(t)) === 0 ? "missing" : (n.delete(t), "removed"), [vs]).catch((e) => (z.error("[StatQueue] failed to remove tail", e), "failed")) : "failed";
|
|
9245
9302
|
}
|
|
9246
9303
|
static async listTailKeys() {
|
|
9247
9304
|
let t = await e._open();
|
|
9248
|
-
return t ? e._runTransaction(t, "readonly", (t) => e._request(t.getAllKeys()), [
|
|
9305
|
+
return t ? e._runTransaction(t, "readonly", (t) => e._request(t.getAllKeys()), [vs]).catch((e) => (z.error("[StatQueue] failed to list tails", e), [])) : [];
|
|
9249
9306
|
}
|
|
9250
9307
|
static async adoptTail(t) {
|
|
9251
9308
|
let n = await e._open();
|
|
9252
9309
|
if (!n) return "failed";
|
|
9253
9310
|
let r = 0, i = await e._runTransaction(n, "readwrite", async (n, i) => {
|
|
9254
|
-
let a = i.objectStore(
|
|
9311
|
+
let a = i.objectStore(vs), o = await e._request(a.get(t));
|
|
9255
9312
|
if (!o) return "missing";
|
|
9256
9313
|
if (o.ts < Date.now() - 6048e5) return a.delete(t), "expired";
|
|
9257
9314
|
let s = await e._request(n.index("by_vcid").getAll(IDBKeyRange.only(o.vcid)));
|
|
9258
9315
|
return a.delete(t), s.some((e) => e.uid === o.uid && e.ev.name === U.CALL_FINISH) ? "exists" : (o.entries.forEach((e) => n.add(e)), r = o.entries.length, "added");
|
|
9259
|
-
}, [
|
|
9316
|
+
}, [_s, vs]).catch((e) => (z.error("[StatQueue] failed to adopt tail", e), "failed"));
|
|
9260
9317
|
return i === "added" && await e._countAppend(r), i;
|
|
9261
9318
|
}
|
|
9262
9319
|
static async fillDelta(t, n) {
|
|
@@ -9358,11 +9415,11 @@ var ps, ms = "ok-calls-sdk-stats", hs = 2, gs = "events", _s = "tails", vs = 100
|
|
|
9358
9415
|
});
|
|
9359
9416
|
}
|
|
9360
9417
|
static async __resetForTests() {
|
|
9361
|
-
if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName ===
|
|
9418
|
+
if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === hs && (e._dbName = `${hs}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
|
|
9362
9419
|
let t = await e._open();
|
|
9363
9420
|
t && await e._runTransaction(t, "readwrite", (e, t) => {
|
|
9364
|
-
e.clear(), t.objectStore(
|
|
9365
|
-
}, [
|
|
9421
|
+
e.clear(), t.objectStore(vs).clear();
|
|
9422
|
+
}, [_s, vs]).catch((e) => {
|
|
9366
9423
|
z.error("[StatQueue] failed to reset storage", e);
|
|
9367
9424
|
});
|
|
9368
9425
|
}
|
|
@@ -9373,18 +9430,18 @@ var ps, ms = "ok-calls-sdk-stats", hs = 2, gs = "events", _s = "tails", vs = 100
|
|
|
9373
9430
|
static _open() {
|
|
9374
9431
|
if (!e._checkSupport()) return e._supported = !1, Promise.resolve(null);
|
|
9375
9432
|
if (e._dbPromise) return e._dbPromise;
|
|
9376
|
-
if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt <
|
|
9433
|
+
if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < Cs) return Promise.resolve(null);
|
|
9377
9434
|
let t = !1, n = new Promise((n) => {
|
|
9378
9435
|
let r = (r, i) => {
|
|
9379
9436
|
t || (t = !0, z.error(r, i), e._supported = !1, e._dbPromise = null, e._lastOpenFailureAt = Date.now(), n(null));
|
|
9380
9437
|
}, i;
|
|
9381
9438
|
try {
|
|
9382
|
-
i = window.indexedDB.open(e._dbName,
|
|
9439
|
+
i = window.indexedDB.open(e._dbName, gs);
|
|
9383
9440
|
} catch (e) {
|
|
9384
9441
|
r("[StatQueue] storage is not accessible", e);
|
|
9385
9442
|
return;
|
|
9386
9443
|
}
|
|
9387
|
-
let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"),
|
|
9444
|
+
let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), Ss);
|
|
9388
9445
|
i.onupgradeneeded = () => {
|
|
9389
9446
|
e._createSchema(i.result);
|
|
9390
9447
|
}, i.onsuccess = () => {
|
|
@@ -9402,22 +9459,22 @@ var ps, ms = "ok-calls-sdk-stats", hs = 2, gs = "events", _s = "tails", vs = 100
|
|
|
9402
9459
|
return t || (e._dbPromise = n), n;
|
|
9403
9460
|
}
|
|
9404
9461
|
static async _countAppend(t = 1) {
|
|
9405
|
-
e._appendsSinceEvictCheck += t, e._appendsSinceEvictCheck >=
|
|
9462
|
+
e._appendsSinceEvictCheck += t, e._appendsSinceEvictCheck >= ys && (e._appendsSinceEvictCheck = 0, await e.evictToLimit(bs));
|
|
9406
9463
|
}
|
|
9407
9464
|
static _close() {
|
|
9408
9465
|
e._db && (e._db.close(), e._db = null), e._dbPromise = null;
|
|
9409
9466
|
}
|
|
9410
9467
|
static _createSchema(e) {
|
|
9411
|
-
if (!e.objectStoreNames.contains(
|
|
9412
|
-
let t = e.createObjectStore(
|
|
9468
|
+
if (!e.objectStoreNames.contains(_s)) {
|
|
9469
|
+
let t = e.createObjectStore(_s, {
|
|
9413
9470
|
keyPath: "id",
|
|
9414
9471
|
autoIncrement: !0
|
|
9415
9472
|
});
|
|
9416
9473
|
t.createIndex("by_uid", "uid", { unique: !1 }), t.createIndex("by_vcid", "vcid", { unique: !1 });
|
|
9417
9474
|
}
|
|
9418
|
-
e.objectStoreNames.contains(
|
|
9475
|
+
e.objectStoreNames.contains(vs) || e.createObjectStore(vs, { keyPath: "key" });
|
|
9419
9476
|
}
|
|
9420
|
-
static _runTransaction(e, t, n, r = [
|
|
9477
|
+
static _runTransaction(e, t, n, r = [_s]) {
|
|
9421
9478
|
return new Promise((i, a) => {
|
|
9422
9479
|
let o = e.transaction(r, t), s;
|
|
9423
9480
|
o.oncomplete = () => i(s), o.onerror = () => a(o.error), o.onabort = () => a(o.error), Promise.resolve(n(o.objectStore(r[0]), o)).then((e) => {
|
|
@@ -9450,18 +9507,18 @@ var ps, ms = "ok-calls-sdk-stats", hs = 2, gs = "events", _s = "tails", vs = 100
|
|
|
9450
9507
|
});
|
|
9451
9508
|
}
|
|
9452
9509
|
};
|
|
9453
|
-
|
|
9510
|
+
ms = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", hs), h(Q, "_supported", ms._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
|
|
9454
9511
|
//#endregion
|
|
9455
9512
|
//#region src/static/ApiTransport.ts
|
|
9456
|
-
var
|
|
9457
|
-
function
|
|
9458
|
-
|
|
9513
|
+
var ws = null, Ts = null, Es = 64 * 1024;
|
|
9514
|
+
function Ds() {
|
|
9515
|
+
ws = null, Ts = null;
|
|
9459
9516
|
}
|
|
9460
|
-
function
|
|
9517
|
+
function Os(e) {
|
|
9461
9518
|
return e?.endsWith("/") ? e.slice(0, -1) : e;
|
|
9462
9519
|
}
|
|
9463
|
-
async function
|
|
9464
|
-
let n =
|
|
9520
|
+
async function ks(e = null, t) {
|
|
9521
|
+
let n = Os(e ?? N.apiBaseUrl);
|
|
9465
9522
|
if (n) return n;
|
|
9466
9523
|
if ((t ?? N.apiEnv) !== "AUTO") return N.apiEndpoint(t);
|
|
9467
9524
|
try {
|
|
@@ -9476,25 +9533,25 @@ async function Os(e = null, t) {
|
|
|
9476
9533
|
return z.warn("Failed to resolve API endpoint using DNS, default is used", e), N.apiEndpoint(t);
|
|
9477
9534
|
}
|
|
9478
9535
|
}
|
|
9479
|
-
async function
|
|
9480
|
-
return
|
|
9536
|
+
async function As() {
|
|
9537
|
+
return ws || Ts || (Ts = ks(), ws = await Ts, Ts = null, ws);
|
|
9481
9538
|
}
|
|
9482
|
-
async function
|
|
9539
|
+
async function js(e, t = {}, n = !1) {
|
|
9483
9540
|
if (!window.Blob || !window.navigator.sendBeacon) return !1;
|
|
9484
|
-
await
|
|
9485
|
-
let r =
|
|
9486
|
-
return window.navigator.sendBeacon(`${
|
|
9541
|
+
await As();
|
|
9542
|
+
let r = Ls(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
|
|
9543
|
+
return window.navigator.sendBeacon(`${ws}/fb.do`, i);
|
|
9487
9544
|
}
|
|
9488
|
-
async function
|
|
9489
|
-
return await
|
|
9545
|
+
async function Ms(e, t = {}, n = !1, r) {
|
|
9546
|
+
return await As(), Ps(Ls(e, t, n), r);
|
|
9490
9547
|
}
|
|
9491
|
-
async function
|
|
9492
|
-
await
|
|
9493
|
-
let r =
|
|
9494
|
-
return
|
|
9548
|
+
async function Ns(e, t = {}, n = !1) {
|
|
9549
|
+
await As();
|
|
9550
|
+
let r = Ls(e, t, n);
|
|
9551
|
+
return Ps(r, void 0, new Blob([r]).size <= Es);
|
|
9495
9552
|
}
|
|
9496
|
-
async function
|
|
9497
|
-
let r = `${t ??
|
|
9553
|
+
async function Ps(e, t, n = !1) {
|
|
9554
|
+
let r = `${t ?? ws}/fb.do`, i = new AbortController(), a = new k(y.NETWORK, { callError: {
|
|
9498
9555
|
scope: "network",
|
|
9499
9556
|
source: "api",
|
|
9500
9557
|
code: "timeout",
|
|
@@ -9513,16 +9570,16 @@ async function Ns(e, t, n = !1) {
|
|
|
9513
9570
|
} catch {
|
|
9514
9571
|
o = { result: a };
|
|
9515
9572
|
}
|
|
9516
|
-
if (!t.ok && !
|
|
9573
|
+
if (!t.ok && !Fs(o)) throw new k(y.API, { callError: {
|
|
9517
9574
|
scope: "server",
|
|
9518
9575
|
source: "api",
|
|
9519
9576
|
code: `http-${t.status}`,
|
|
9520
9577
|
description: "http-error"
|
|
9521
9578
|
} });
|
|
9522
|
-
if (
|
|
9579
|
+
if (Fs(o)) throw o;
|
|
9523
9580
|
return o;
|
|
9524
9581
|
} catch (e) {
|
|
9525
|
-
throw e instanceof k ? e : i.signal.aborted ? a :
|
|
9582
|
+
throw e instanceof k ? e : i.signal.aborted ? a : Fs(e) ? e : new k(y.NETWORK, { callError: {
|
|
9526
9583
|
scope: "network",
|
|
9527
9584
|
source: "api",
|
|
9528
9585
|
code: "fetch-failed",
|
|
@@ -9532,12 +9589,12 @@ async function Ns(e, t, n = !1) {
|
|
|
9532
9589
|
clearTimeout(o);
|
|
9533
9590
|
}
|
|
9534
9591
|
}
|
|
9535
|
-
function
|
|
9592
|
+
function Fs(e) {
|
|
9536
9593
|
if (typeof e != "object" || !e) return !1;
|
|
9537
9594
|
let t = e;
|
|
9538
9595
|
return typeof t.error_code == "number" && typeof t.error_msg == "string";
|
|
9539
9596
|
}
|
|
9540
|
-
async function
|
|
9597
|
+
async function Is(e, t) {
|
|
9541
9598
|
try {
|
|
9542
9599
|
let n = await fetch(e, {
|
|
9543
9600
|
method: "POST",
|
|
@@ -9550,7 +9607,7 @@ async function Fs(e, t) {
|
|
|
9550
9607
|
throw z.warn("Failed to send form data", e), e;
|
|
9551
9608
|
}
|
|
9552
9609
|
}
|
|
9553
|
-
function
|
|
9610
|
+
function Ls(e, t = {}, n = !1) {
|
|
9554
9611
|
t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (v.sessionKey ? t.session_key = v.sessionKey : v.accessToken && (t.access_token = v.accessToken));
|
|
9555
9612
|
for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
|
|
9556
9613
|
let r = "";
|
|
@@ -9559,7 +9616,7 @@ function Is(e, t = {}, n = !1) {
|
|
|
9559
9616
|
}
|
|
9560
9617
|
//#endregion
|
|
9561
9618
|
//#region src/static/SessionStore.ts
|
|
9562
|
-
var
|
|
9619
|
+
var Rs = "sessions", zs = 5, Bs = class e {
|
|
9563
9620
|
static remember(t, n) {
|
|
9564
9621
|
let r = e._read();
|
|
9565
9622
|
r[String(t)] = {
|
|
@@ -9567,7 +9624,7 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9567
9624
|
savedAt: Date.now()
|
|
9568
9625
|
};
|
|
9569
9626
|
let i = Object.keys(r);
|
|
9570
|
-
i.length >
|
|
9627
|
+
i.length > zs && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - zs).forEach((e) => delete r[e]), e._write(r);
|
|
9571
9628
|
}
|
|
9572
9629
|
static get(t) {
|
|
9573
9630
|
return e._read()[String(t)] ?? null;
|
|
@@ -9583,10 +9640,10 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9583
9640
|
}), r && e._write(n);
|
|
9584
9641
|
}
|
|
9585
9642
|
static currentEndpoint() {
|
|
9586
|
-
return String(
|
|
9643
|
+
return String(Os(N.apiBaseUrl) || N.apiEndpoint());
|
|
9587
9644
|
}
|
|
9588
9645
|
static _read() {
|
|
9589
|
-
let t = T.get(
|
|
9646
|
+
let t = T.get(Rs);
|
|
9590
9647
|
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
9591
9648
|
let n = {};
|
|
9592
9649
|
return Object.entries(t).forEach(([t, r]) => {
|
|
@@ -9595,26 +9652,26 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9595
9652
|
}
|
|
9596
9653
|
static _write(e) {
|
|
9597
9654
|
if (Object.keys(e).length === 0) {
|
|
9598
|
-
T.remove(
|
|
9655
|
+
T.remove(Rs);
|
|
9599
9656
|
return;
|
|
9600
9657
|
}
|
|
9601
|
-
T.set(
|
|
9658
|
+
T.set(Rs, e);
|
|
9602
9659
|
}
|
|
9603
9660
|
static _isValid(e) {
|
|
9604
9661
|
let t = e;
|
|
9605
9662
|
return typeof t == "object" && !!t && typeof t.sessionKey == "string" && t.sessionKey.length > 0 && typeof t.endpoint == "string" && typeof t.savedAt == "number";
|
|
9606
9663
|
}
|
|
9607
|
-
},
|
|
9664
|
+
}, Vs = 1e3, Hs = "okcls-stat-call.", Us = 3, Ws = { wallNow: () => Date.now() }, Gs = class e {
|
|
9608
9665
|
static get tabId() {
|
|
9609
9666
|
return e._tabId === null && (e._tabId = M.uuid()), e._tabId;
|
|
9610
9667
|
}
|
|
9611
9668
|
static lockName(e) {
|
|
9612
|
-
return
|
|
9669
|
+
return Hs + e;
|
|
9613
9670
|
}
|
|
9614
9671
|
static isSupported() {
|
|
9615
9672
|
return typeof navigator < "u" && !!navigator.locks && Q.isSupported();
|
|
9616
9673
|
}
|
|
9617
|
-
constructor(e, t, n =
|
|
9674
|
+
constructor(e, t, n = Ws) {
|
|
9618
9675
|
h(this, "_logger", void 0), h(this, "_summaries", void 0), h(this, "_clock", void 0), h(this, "_status", "idle"), h(this, "_vcid", null), h(this, "_key", null), h(this, "_creation", null), h(this, "_timer", null), h(this, "_releaseLock", null), h(this, "_lockFailures", 0), h(this, "_onAdopted", null), this._logger = e, this._summaries = t, this._clock = n;
|
|
9619
9676
|
}
|
|
9620
9677
|
start(t, n) {
|
|
@@ -9646,11 +9703,11 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9646
9703
|
let e = new Promise((e) => {
|
|
9647
9704
|
this._releaseLock = e;
|
|
9648
9705
|
});
|
|
9649
|
-
return this._status === "starting" && (this._status = "active", this._write(), this._timer = window.setInterval(() => this._onTimer(),
|
|
9706
|
+
return this._status === "starting" && (this._status = "active", this._write(), this._timer = window.setInterval(() => this._onTimer(), Vs)), e;
|
|
9650
9707
|
}
|
|
9651
9708
|
_onLockGone(e, t) {
|
|
9652
9709
|
if (this._releaseLock = null, this._status !== "starting" && this._status !== "active") return;
|
|
9653
|
-
if (e || (this._lockFailures += 1), this._lockFailures <
|
|
9710
|
+
if (e || (this._lockFailures += 1), this._lockFailures < Us) {
|
|
9654
9711
|
this._requestLock();
|
|
9655
9712
|
return;
|
|
9656
9713
|
}
|
|
@@ -9682,7 +9739,7 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9682
9739
|
if (e === null || t === null) return null;
|
|
9683
9740
|
let n = {
|
|
9684
9741
|
conversationId: e,
|
|
9685
|
-
occurredAt: this._clock.wallNow() +
|
|
9742
|
+
occurredAt: this._clock.wallNow() + Vs
|
|
9686
9743
|
}, r = this._logger.buildEntry({
|
|
9687
9744
|
name: U.CALL_FINISH,
|
|
9688
9745
|
reason: "terminated"
|
|
@@ -9725,10 +9782,10 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9725
9782
|
this._timer !== null && (window.clearInterval(this._timer), this._timer = null);
|
|
9726
9783
|
}
|
|
9727
9784
|
};
|
|
9728
|
-
h(
|
|
9785
|
+
h(Gs, "_tabId", null);
|
|
9729
9786
|
//#endregion
|
|
9730
9787
|
//#region src/classes/stat/StatClock.ts
|
|
9731
|
-
var
|
|
9788
|
+
var Ks = 15e3, qs = class e {
|
|
9732
9789
|
static setApi(t) {
|
|
9733
9790
|
e._api = t;
|
|
9734
9791
|
}
|
|
@@ -9739,7 +9796,7 @@ var Gs = 15e3, Ks = class e {
|
|
|
9739
9796
|
e._delta === null && e._api && e.get();
|
|
9740
9797
|
}
|
|
9741
9798
|
static get() {
|
|
9742
|
-
return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt <
|
|
9799
|
+
return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt < Ks ? Promise.resolve(0) : (e._pending || (e._pending = e._measure().finally(() => {
|
|
9743
9800
|
e._pending = null;
|
|
9744
9801
|
})), e._pending) : Promise.resolve(e._delta);
|
|
9745
9802
|
}
|
|
@@ -9769,32 +9826,32 @@ var Gs = 15e3, Ks = class e {
|
|
|
9769
9826
|
return e._idsAwaitingDelta = [], await Q.fillDelta(n, t), t;
|
|
9770
9827
|
}
|
|
9771
9828
|
};
|
|
9772
|
-
h(
|
|
9829
|
+
h(qs, "_api", null), h(qs, "_delta", null), h(qs, "_pending", null), h(qs, "_idsAwaitingDelta", []), h(qs, "_lastFailureAt", null);
|
|
9773
9830
|
//#endregion
|
|
9774
9831
|
//#region src/classes/stat/StatDrainScheduler.ts
|
|
9775
|
-
var
|
|
9832
|
+
var Js = 500, Ys = 100, Xs = 3e4, Zs = 1e3, Qs = 5e3, $s = 3e3, ec = 6e4, tc = "okcls-stat-drain", nc = class e {
|
|
9776
9833
|
static setApi(t) {
|
|
9777
|
-
e._api = t,
|
|
9834
|
+
e._api = t, qs.setApi(t);
|
|
9778
9835
|
}
|
|
9779
9836
|
static start(t) {
|
|
9780
9837
|
e.setApi(t), e._firstDrain().catch((e) => z.error("[StatDrainScheduler] failed to start", e));
|
|
9781
9838
|
}
|
|
9782
9839
|
static notifyAppended() {
|
|
9783
9840
|
if (e._api) {
|
|
9784
|
-
if (e._localCount += 1, e._localCount >=
|
|
9841
|
+
if (e._localCount += 1, e._localCount >= Ys) {
|
|
9785
9842
|
e._drain();
|
|
9786
9843
|
return;
|
|
9787
9844
|
}
|
|
9788
|
-
e._state === "IDLE" && e._arm(
|
|
9845
|
+
e._state === "IDLE" && e._arm(Xs);
|
|
9789
9846
|
}
|
|
9790
9847
|
}
|
|
9791
9848
|
static notifyCallFinished() {
|
|
9792
9849
|
if (e._api) {
|
|
9793
|
-
if (e._directBuffer.length > 0 && e._armDirect(
|
|
9850
|
+
if (e._directBuffer.length > 0 && e._armDirect(Zs), e._state === "DRAINING") {
|
|
9794
9851
|
e._callFinishedDuringDrain = !0;
|
|
9795
9852
|
return;
|
|
9796
9853
|
}
|
|
9797
|
-
e._arm(
|
|
9854
|
+
e._arm(Zs);
|
|
9798
9855
|
}
|
|
9799
9856
|
}
|
|
9800
9857
|
static drainOnce() {
|
|
@@ -9804,7 +9861,7 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9804
9861
|
await e._adoptCallTails();
|
|
9805
9862
|
let n = e._currentUserId(), r = await Q.listUids(), i = !1, a = null;
|
|
9806
9863
|
for (let o of r) try {
|
|
9807
|
-
(o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) ===
|
|
9864
|
+
(o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === Js && (i = !0);
|
|
9808
9865
|
} catch (e) {
|
|
9809
9866
|
a === null && (a = e);
|
|
9810
9867
|
}
|
|
@@ -9818,17 +9875,17 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9818
9875
|
z.error("[StatDrainScheduler] direct send skipped: event belongs to another user");
|
|
9819
9876
|
return;
|
|
9820
9877
|
}
|
|
9821
|
-
e._directBuffer.push(t), e._directTimer === null && e._armDirect(
|
|
9878
|
+
e._directBuffer.push(t), e._directTimer === null && e._armDirect($s);
|
|
9822
9879
|
}
|
|
9823
9880
|
}
|
|
9824
9881
|
static __resetForTests() {
|
|
9825
|
-
|
|
9882
|
+
qs.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._clearTailRecheckTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
|
|
9826
9883
|
}
|
|
9827
9884
|
static _currentUserId() {
|
|
9828
9885
|
return v.userId;
|
|
9829
9886
|
}
|
|
9830
9887
|
static async _firstDrain() {
|
|
9831
|
-
e._removeUnloadJournals(),
|
|
9888
|
+
e._removeUnloadJournals(), Bs.prune(), await Q.evictOlderThan(xs), await Q.evictToLimit(bs), await e._drain();
|
|
9832
9889
|
}
|
|
9833
9890
|
static _removeUnloadJournals() {
|
|
9834
9891
|
try {
|
|
@@ -9846,7 +9903,7 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9846
9903
|
if (typeof navigator > "u" || !navigator.locks) return 0;
|
|
9847
9904
|
let t = 0, n = !1;
|
|
9848
9905
|
try {
|
|
9849
|
-
for (let e of await Q.listTailKeys()) await navigator.locks.request(
|
|
9906
|
+
for (let e of await Q.listTailKeys()) await navigator.locks.request(Gs.lockName(e), { ifAvailable: !0 }, async (r) => {
|
|
9850
9907
|
if (r === null) {
|
|
9851
9908
|
n = !0;
|
|
9852
9909
|
return;
|
|
@@ -9863,16 +9920,16 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9863
9920
|
e._tailRecheckTimer = null, e._withLock(() => e._adoptCallTails()).then((t) => {
|
|
9864
9921
|
t > 0 && e.notifyCallFinished();
|
|
9865
9922
|
}).catch((e) => z.error("[StatDrainScheduler] failed to recheck call tails", e));
|
|
9866
|
-
},
|
|
9923
|
+
}, ec));
|
|
9867
9924
|
}
|
|
9868
9925
|
static _clearTailRecheckTimer() {
|
|
9869
9926
|
e._tailRecheckTimer !== null && (window.clearTimeout(e._tailRecheckTimer), e._tailRecheckTimer = null);
|
|
9870
9927
|
}
|
|
9871
9928
|
static async _drainCurrent(t, n) {
|
|
9872
9929
|
if (e._isSessionBlocked()) return 0;
|
|
9873
|
-
let r = await Q.readOldest(n,
|
|
9930
|
+
let r = await Q.readOldest(n, Js);
|
|
9874
9931
|
if (r.length === 0) return 0;
|
|
9875
|
-
let i = await
|
|
9932
|
+
let i = await qs.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
|
|
9876
9933
|
try {
|
|
9877
9934
|
await t.logClientStats(a);
|
|
9878
9935
|
} catch (t) {
|
|
@@ -9883,25 +9940,25 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9883
9940
|
return await Q.remove(o), r.length;
|
|
9884
9941
|
}
|
|
9885
9942
|
static async _drainStored(t, n) {
|
|
9886
|
-
let r =
|
|
9887
|
-
if (!r || r.endpoint !==
|
|
9888
|
-
let i = await Q.readOldest(n,
|
|
9943
|
+
let r = Bs.get(n);
|
|
9944
|
+
if (!r || r.endpoint !== Bs.currentEndpoint()) return 0;
|
|
9945
|
+
let i = await Q.readOldest(n, Js);
|
|
9889
9946
|
if (i.length === 0) return 0;
|
|
9890
|
-
let a = await
|
|
9947
|
+
let a = await qs.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
|
|
9891
9948
|
try {
|
|
9892
9949
|
await t.logClientStatsWith(r.sessionKey, o), z.debug("[StatDrainScheduler] delivered", i.length, "stored events of uid", n);
|
|
9893
9950
|
} catch (t) {
|
|
9894
|
-
if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n),
|
|
9951
|
+
if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), Bs.forget(n), 0;
|
|
9895
9952
|
if (e._isRetryable(t)) throw t;
|
|
9896
9953
|
return z.error("[StatDrainScheduler] batch rejected, dropping", t), await Q.remove(s), i.length;
|
|
9897
9954
|
}
|
|
9898
9955
|
return await Q.remove(s), i.length;
|
|
9899
9956
|
}
|
|
9900
9957
|
static _withLock(e) {
|
|
9901
|
-
return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(
|
|
9958
|
+
return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(tc, e);
|
|
9902
9959
|
}
|
|
9903
9960
|
static _isSessionError(e) {
|
|
9904
|
-
return
|
|
9961
|
+
return ps(e?.error_code);
|
|
9905
9962
|
}
|
|
9906
9963
|
static _isReauthorizeFailure(e) {
|
|
9907
9964
|
return e?.error === y.AUTH;
|
|
@@ -9914,7 +9971,7 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9914
9971
|
}
|
|
9915
9972
|
static _isAuthError(t) {
|
|
9916
9973
|
let n = t?.error_code;
|
|
9917
|
-
return e._isSessionError(t) || n ===
|
|
9974
|
+
return e._isSessionError(t) || n === fs.AUTH_LOGIN;
|
|
9918
9975
|
}
|
|
9919
9976
|
static _isRetryable(t) {
|
|
9920
9977
|
if (e._isSessionError(t)) return !0;
|
|
@@ -9939,7 +9996,7 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9939
9996
|
static async _flushDirect() {
|
|
9940
9997
|
let t = e._api, n = e._directBuffer;
|
|
9941
9998
|
if (e._directBuffer = [], !(!t || n.length === 0)) try {
|
|
9942
|
-
let r = await
|
|
9999
|
+
let r = await qs.get();
|
|
9943
10000
|
await t.logClientStats(n.map((t) => e._toClientStats(t, r)));
|
|
9944
10001
|
} catch (e) {
|
|
9945
10002
|
z.error("[StatDrainScheduler] direct send failed, events lost", e);
|
|
@@ -9958,28 +10015,28 @@ var qs = 500, Js = 100, Ys = 3e4, Xs = 1e3, Zs = 5e3, Qs = 3e3, $s = 6e4, ec = "
|
|
|
9958
10015
|
e._clearTimer(), e._state = "DRAINING", e._localCount = 0, e._callFinishedDuringDrain = !1;
|
|
9959
10016
|
try {
|
|
9960
10017
|
if (await e.drainOnce()) {
|
|
9961
|
-
e._arm(
|
|
10018
|
+
e._arm(Qs);
|
|
9962
10019
|
return;
|
|
9963
10020
|
}
|
|
9964
10021
|
if (e._callFinishedDuringDrain) {
|
|
9965
|
-
e._arm(
|
|
10022
|
+
e._arm(Zs);
|
|
9966
10023
|
return;
|
|
9967
10024
|
}
|
|
9968
10025
|
if (e._localCount > 0) {
|
|
9969
|
-
e._arm(
|
|
10026
|
+
e._arm(Xs);
|
|
9970
10027
|
return;
|
|
9971
10028
|
}
|
|
9972
10029
|
e._state = "IDLE";
|
|
9973
10030
|
} catch (t) {
|
|
9974
|
-
z.error("[StatDrainScheduler] drain failed", t), e._arm(
|
|
10031
|
+
z.error("[StatDrainScheduler] drain failed", t), e._arm(Xs);
|
|
9975
10032
|
}
|
|
9976
10033
|
}
|
|
9977
10034
|
}
|
|
9978
10035
|
};
|
|
9979
|
-
h(
|
|
10036
|
+
h(nc, "_api", null), h(nc, "_state", "IDLE"), h(nc, "_timer", null), h(nc, "_localCount", 0), h(nc, "_callFinishedDuringDrain", !1), h(nc, "_blockedSession", null), h(nc, "_directBuffer", []), h(nc, "_directTimer", null), h(nc, "_tailRecheckTimer", null);
|
|
9980
10037
|
//#endregion
|
|
9981
10038
|
//#region src/classes/StatsLogger.ts
|
|
9982
|
-
var
|
|
10039
|
+
var rc = class extends f {
|
|
9983
10040
|
constructor(e, t, n, r = () => void 0) {
|
|
9984
10041
|
super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), h(this, "_waitingForServerTime", !0), h(this, "_deferredClientStats", []), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._calculateServerTimeDelta();
|
|
9985
10042
|
}
|
|
@@ -10059,7 +10116,7 @@ var nc = class extends f {
|
|
|
10059
10116
|
_now() {
|
|
10060
10117
|
return Date.now() - this._serverTimeDelta;
|
|
10061
10118
|
}
|
|
10062
|
-
},
|
|
10119
|
+
}, ic = class e extends f {
|
|
10063
10120
|
static __resetForTests() {
|
|
10064
10121
|
e._pending = [], e._pendingOverflow = !1;
|
|
10065
10122
|
}
|
|
@@ -10075,7 +10132,7 @@ var nc = class extends f {
|
|
|
10075
10132
|
return e._pending = [], e._pendingOverflow = !1, t;
|
|
10076
10133
|
}
|
|
10077
10134
|
constructor(e, t, n, r = () => void 0) {
|
|
10078
|
-
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new
|
|
10135
|
+
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new rc(e, t, n, r);
|
|
10079
10136
|
}
|
|
10080
10137
|
log(e, t, n = !1) {
|
|
10081
10138
|
this._externalLogger && this._externalLogger.log(e, t, n);
|
|
@@ -10090,7 +10147,7 @@ var nc = class extends f {
|
|
|
10090
10147
|
this._legacy.logClientStats(t, n);
|
|
10091
10148
|
return;
|
|
10092
10149
|
}
|
|
10093
|
-
|
|
10150
|
+
qs.ensure();
|
|
10094
10151
|
let i = v.userId;
|
|
10095
10152
|
if (i === null) {
|
|
10096
10153
|
e._remember(r);
|
|
@@ -10108,7 +10165,7 @@ var nc = class extends f {
|
|
|
10108
10165
|
buildEntry(t, n = {}) {
|
|
10109
10166
|
if (this._legacy) return null;
|
|
10110
10167
|
let r = v.userId;
|
|
10111
|
-
return r === null || e._pending.length > 0 ? null : (
|
|
10168
|
+
return r === null || e._pending.length > 0 ? null : (qs.ensure(), {
|
|
10112
10169
|
uid: r,
|
|
10113
10170
|
...this._makeEntry(t, n)
|
|
10114
10171
|
});
|
|
@@ -10129,17 +10186,17 @@ var nc = class extends f {
|
|
|
10129
10186
|
}), {
|
|
10130
10187
|
vcid: n,
|
|
10131
10188
|
ts: r,
|
|
10132
|
-
delta:
|
|
10189
|
+
delta: qs.delta(),
|
|
10133
10190
|
ev: i
|
|
10134
10191
|
};
|
|
10135
10192
|
}
|
|
10136
10193
|
_store(e) {
|
|
10137
10194
|
Q.append(e).then((t) => {
|
|
10138
10195
|
if (t !== null) {
|
|
10139
|
-
typeof e.delta != "number" &&
|
|
10196
|
+
typeof e.delta != "number" && qs.noteAppended(t), nc.notifyAppended();
|
|
10140
10197
|
return;
|
|
10141
10198
|
}
|
|
10142
|
-
z.error("[StatEventCollector] failed to store event, sending directly"),
|
|
10199
|
+
z.error("[StatEventCollector] failed to store event, sending directly"), nc.sendDirect(e);
|
|
10143
10200
|
}).catch((e) => z.error("[StatEventCollector] failed to store event", e));
|
|
10144
10201
|
}
|
|
10145
10202
|
_getConversationId() {
|
|
@@ -10157,10 +10214,10 @@ var nc = class extends f {
|
|
|
10157
10214
|
}
|
|
10158
10215
|
}
|
|
10159
10216
|
};
|
|
10160
|
-
h(
|
|
10217
|
+
h(ic, "_pending", []), h(ic, "_pendingOverflow", !1);
|
|
10161
10218
|
//#endregion
|
|
10162
10219
|
//#region src/classes/stat/ApiCallStats.ts
|
|
10163
|
-
var
|
|
10220
|
+
var ac = class {
|
|
10164
10221
|
constructor(e) {
|
|
10165
10222
|
h(this, "_statAggregator", void 0), this._statAggregator = e;
|
|
10166
10223
|
}
|
|
@@ -10172,8 +10229,8 @@ var ic = class {
|
|
|
10172
10229
|
string_value: n
|
|
10173
10230
|
});
|
|
10174
10231
|
}
|
|
10175
|
-
},
|
|
10176
|
-
constructor(e, t =
|
|
10232
|
+
}, oc = { monotonicNow: () => performance.now() }, sc = class {
|
|
10233
|
+
constructor(e, t = oc) {
|
|
10177
10234
|
h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_battery", null), h(this, "_previous", null), h(this, "_destroyed", !1), h(this, "_handleChargingChange", () => {
|
|
10178
10235
|
this._previous = null;
|
|
10179
10236
|
}), h(this, "_handleLevelChange", () => {
|
|
@@ -10207,7 +10264,7 @@ var ic = class {
|
|
|
10207
10264
|
}
|
|
10208
10265
|
this._destroyed || (this._battery = t, t.addEventListener("levelchange", this._handleLevelChange), t.addEventListener("chargingchange", this._handleChargingChange));
|
|
10209
10266
|
}
|
|
10210
|
-
},
|
|
10267
|
+
}, cc = "invalid-error-metadata", lc = 64, uc = new Set(Object.values(p)), dc = new Set(Object.values(y)), fc = {
|
|
10211
10268
|
[p.CANCELED]: {
|
|
10212
10269
|
type: "semantic",
|
|
10213
10270
|
reason: "canceled"
|
|
@@ -10328,7 +10385,7 @@ var ic = class {
|
|
|
10328
10385
|
type: "semantic",
|
|
10329
10386
|
reason: "obsolete_client"
|
|
10330
10387
|
}
|
|
10331
|
-
},
|
|
10388
|
+
}, pc = {
|
|
10332
10389
|
[y.MIC_CAMERA_PERMISSION]: {
|
|
10333
10390
|
type: "direct-error",
|
|
10334
10391
|
error: {
|
|
@@ -10417,14 +10474,14 @@ var ic = class {
|
|
|
10417
10474
|
}
|
|
10418
10475
|
}
|
|
10419
10476
|
};
|
|
10420
|
-
function
|
|
10421
|
-
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return
|
|
10477
|
+
function mc(e) {
|
|
10478
|
+
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return cc;
|
|
10422
10479
|
let t = String(e).trim();
|
|
10423
|
-
if (!t) return
|
|
10480
|
+
if (!t) return cc;
|
|
10424
10481
|
let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
10425
|
-
return !n || !/^[a-z0-9.-]+$/.test(n) ?
|
|
10482
|
+
return !n || !/^[a-z0-9.-]+$/.test(n) ? cc : n.length > lc ? `${n.slice(0, lc - 3)}...` : n;
|
|
10426
10483
|
}
|
|
10427
|
-
function
|
|
10484
|
+
function hc(e) {
|
|
10428
10485
|
if (!e || typeof e != "object") return !1;
|
|
10429
10486
|
let t = e;
|
|
10430
10487
|
switch (t.scope) {
|
|
@@ -10436,49 +10493,49 @@ function mc(e) {
|
|
|
10436
10493
|
default: return !1;
|
|
10437
10494
|
}
|
|
10438
10495
|
}
|
|
10439
|
-
function
|
|
10440
|
-
let t =
|
|
10496
|
+
function gc(e) {
|
|
10497
|
+
let t = mc(e.description);
|
|
10441
10498
|
if (e.scope === "unknown") return `unknown:${t}`;
|
|
10442
|
-
let n =
|
|
10499
|
+
let n = mc(e.code);
|
|
10443
10500
|
return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
|
|
10444
10501
|
}
|
|
10445
|
-
function
|
|
10502
|
+
function _c(e, t) {
|
|
10446
10503
|
return t === null ? e.type === "direct-error" ? {
|
|
10447
10504
|
reason: "error",
|
|
10448
|
-
string_value:
|
|
10449
|
-
} : { reason: "failed" } :
|
|
10505
|
+
string_value: gc(e.error)
|
|
10506
|
+
} : { reason: "failed" } : hc(t) ? {
|
|
10450
10507
|
reason: "error",
|
|
10451
|
-
string_value:
|
|
10508
|
+
string_value: gc(t)
|
|
10452
10509
|
} : { reason: "failed" };
|
|
10453
10510
|
}
|
|
10454
|
-
function
|
|
10511
|
+
function vc(e) {
|
|
10455
10512
|
if (e.hangup) {
|
|
10456
|
-
let t =
|
|
10513
|
+
let t = fc[e.hangup];
|
|
10457
10514
|
return t ? t.type === "semantic" ? e.hangup === p.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
|
|
10458
10515
|
reason: t.reason,
|
|
10459
10516
|
string_value: e.custom_error.vchat_detailed_api_error.code
|
|
10460
|
-
} : { reason: t.reason } :
|
|
10517
|
+
} : { reason: t.reason } : _c(t, e.callError) : { reason: "failed" };
|
|
10461
10518
|
}
|
|
10462
10519
|
if (e.error) {
|
|
10463
|
-
let t =
|
|
10464
|
-
return t ?
|
|
10520
|
+
let t = pc[e.error];
|
|
10521
|
+
return t ? _c(t, e.callError) : { reason: "failed" };
|
|
10465
10522
|
}
|
|
10466
10523
|
return { reason: "failed" };
|
|
10467
10524
|
}
|
|
10468
|
-
function
|
|
10469
|
-
return e instanceof k ?
|
|
10525
|
+
function yc(e) {
|
|
10526
|
+
return e instanceof k ? vc(e) : typeof e == "string" && (uc.has(e) || dc.has(e)) ? vc(new k(e)) : { reason: "failed" };
|
|
10470
10527
|
}
|
|
10471
10528
|
//#endregion
|
|
10472
10529
|
//#region src/classes/stat/CallLifecycleStats.ts
|
|
10473
|
-
var
|
|
10530
|
+
var bc = {
|
|
10474
10531
|
wallNow: () => Date.now(),
|
|
10475
10532
|
monotonicNow: () => performance.now()
|
|
10476
10533
|
};
|
|
10477
|
-
function
|
|
10534
|
+
function xc(e) {
|
|
10478
10535
|
return e === "anonym_join" ? "join" : e;
|
|
10479
10536
|
}
|
|
10480
|
-
var
|
|
10481
|
-
constructor(e, t =
|
|
10537
|
+
var Sc = class {
|
|
10538
|
+
constructor(e, t = bc, n = null) {
|
|
10482
10539
|
h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_tail", void 0), h(this, "_conversationId", null), h(this, "_callStartLabel", null), h(this, "_lifecycleStartedAtMonotonic", 0), h(this, "_pendingEvents", []), h(this, "_callStarted", !1), h(this, "_accepted", !1), h(this, "_firstMediaSent", !1), h(this, "_finished", !1), h(this, "_destroyed", !1), this._logger = e, this._clock = t, this._tail = n;
|
|
10483
10540
|
}
|
|
10484
10541
|
get firstMediaSentReported() {
|
|
@@ -10490,7 +10547,7 @@ var xc = class {
|
|
|
10490
10547
|
markInitializationStarted({ source: e, conversationId: t }) {
|
|
10491
10548
|
if (this._destroyed || this._callStartLabel !== null) return;
|
|
10492
10549
|
let n = this._clock.wallNow();
|
|
10493
|
-
this._callStartLabel =
|
|
10550
|
+
this._callStartLabel = xc(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
|
|
10494
10551
|
name: U.CALL_INIT,
|
|
10495
10552
|
source: e
|
|
10496
10553
|
}, n), this._startTail();
|
|
@@ -10518,7 +10575,7 @@ var xc = class {
|
|
|
10518
10575
|
!this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: U.FIRST_MEDIA_SENT }));
|
|
10519
10576
|
}
|
|
10520
10577
|
markFinished(e) {
|
|
10521
|
-
this._finish(
|
|
10578
|
+
this._finish(yc(e));
|
|
10522
10579
|
}
|
|
10523
10580
|
markTerminated() {
|
|
10524
10581
|
this._finish({ reason: "terminated" });
|
|
@@ -10585,7 +10642,7 @@ var xc = class {
|
|
|
10585
10642
|
...n && { immediately: !0 }
|
|
10586
10643
|
});
|
|
10587
10644
|
}
|
|
10588
|
-
},
|
|
10645
|
+
}, Cc = 1e3, wc = class {
|
|
10589
10646
|
constructor(e, t = z) {
|
|
10590
10647
|
h(this, "_sources", void 0), h(this, "_debug", void 0), h(this, "_timer", null), h(this, "_participantsMax", 0), h(this, "_areaMpxMax", 0), h(this, "_features", /* @__PURE__ */ new Set()), h(this, "_sample", () => {
|
|
10591
10648
|
try {
|
|
@@ -10594,7 +10651,7 @@ var xc = class {
|
|
|
10594
10651
|
} catch (e) {
|
|
10595
10652
|
this._debug.warn("ClientResourceStats sample error", e);
|
|
10596
10653
|
}
|
|
10597
|
-
}), this._sources = e, this._debug = t, this._timer = window.setInterval(this._sample,
|
|
10654
|
+
}), this._sources = e, this._debug = t, this._timer = window.setInterval(this._sample, Cc);
|
|
10598
10655
|
}
|
|
10599
10656
|
takeReport() {
|
|
10600
10657
|
this._sample();
|
|
@@ -10608,7 +10665,7 @@ var xc = class {
|
|
|
10608
10665
|
let e = window.devicePixelRatio || 1, t = window.innerWidth * window.innerHeight * e * e;
|
|
10609
10666
|
return Math.round(t / 1e6);
|
|
10610
10667
|
}
|
|
10611
|
-
},
|
|
10668
|
+
}, Tc = class {
|
|
10612
10669
|
constructor(e, t) {
|
|
10613
10670
|
h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
|
|
10614
10671
|
}
|
|
@@ -10682,54 +10739,19 @@ var xc = class {
|
|
|
10682
10739
|
this.report(e);
|
|
10683
10740
|
}), this._codecUsages.clear();
|
|
10684
10741
|
}
|
|
10685
|
-
},
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
let t =
|
|
10691
|
-
|
|
10692
|
-
...this._resources?.takeReport() ?? {}
|
|
10693
|
-
};
|
|
10694
|
-
this._lastCallStatContext = this._getCallStatContext(t), this._flushEventualStats(), this._logger.logClientStats(t);
|
|
10695
|
-
}
|
|
10696
|
-
logEventualStat(e) {
|
|
10697
|
-
this._eventualLogs.add({
|
|
10698
|
-
data: e,
|
|
10699
|
-
occurredAt: Date.now()
|
|
10700
|
-
});
|
|
10701
|
-
}
|
|
10702
|
-
logEventualStatSinceMark(e) {
|
|
10703
|
-
let t = G.measureMark(e.name);
|
|
10704
|
-
t !== null && this.logEventualStat({
|
|
10705
|
-
...e,
|
|
10706
|
-
value: t
|
|
10707
|
-
});
|
|
10708
|
-
}
|
|
10709
|
-
destroy() {
|
|
10710
|
-
this._flushEventualStats();
|
|
10711
|
-
}
|
|
10712
|
-
_getCallStatContext(e) {
|
|
10713
|
-
return {
|
|
10714
|
-
call_topology: e.call_topology,
|
|
10715
|
-
local_address: e.local_address,
|
|
10716
|
-
local_connection_type: e.local_connection_type,
|
|
10717
|
-
network_type: e.network_type,
|
|
10718
|
-
remote_address: e.remote_address,
|
|
10719
|
-
remote_connection_type: e.remote_connection_type,
|
|
10720
|
-
transport: e.transport
|
|
10721
|
-
};
|
|
10722
|
-
}
|
|
10723
|
-
_flushEventualStats() {
|
|
10724
|
-
let e = [...this._eventualLogs];
|
|
10725
|
-
for (let t of e) this._logEventualStat(t), this._eventualLogs.delete(t);
|
|
10726
|
-
}
|
|
10727
|
-
_logEventualStat({ data: e, occurredAt: t }) {
|
|
10728
|
-
let n = { ...this._lastCallStatContext ?? {} };
|
|
10729
|
-
for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
|
|
10730
|
-
this._logger.logClientStats(n, { occurredAt: t });
|
|
10742
|
+
}, Ec = "unknown";
|
|
10743
|
+
function Dc(e) {
|
|
10744
|
+
if (typeof e == "string") return e || Ec;
|
|
10745
|
+
if (typeof e == "number") return String(e);
|
|
10746
|
+
if (typeof e == "object" && e) {
|
|
10747
|
+
let { name: t, message: n } = e, r = typeof t == "string" ? t : "", i = typeof n == "string" ? n : "";
|
|
10748
|
+
return r && i ? `${r}: ${i}` : r || i || Ec;
|
|
10731
10749
|
}
|
|
10732
|
-
|
|
10750
|
+
return Ec;
|
|
10751
|
+
}
|
|
10752
|
+
//#endregion
|
|
10753
|
+
//#region src/utils/P2Quantile.ts
|
|
10754
|
+
var Oc = class {
|
|
10733
10755
|
constructor(e) {
|
|
10734
10756
|
if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
|
|
10735
10757
|
1,
|
|
@@ -10788,7 +10810,7 @@ var xc = class {
|
|
|
10788
10810
|
5
|
|
10789
10811
|
];
|
|
10790
10812
|
}
|
|
10791
|
-
},
|
|
10813
|
+
}, kc = class {
|
|
10792
10814
|
constructor() {
|
|
10793
10815
|
h(this, "n", 0), h(this, "mean", 0);
|
|
10794
10816
|
}
|
|
@@ -10800,9 +10822,9 @@ var xc = class {
|
|
|
10800
10822
|
get avg() {
|
|
10801
10823
|
return this.n ? this.mean : NaN;
|
|
10802
10824
|
}
|
|
10803
|
-
},
|
|
10825
|
+
}, Ac = class {
|
|
10804
10826
|
constructor() {
|
|
10805
|
-
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new
|
|
10827
|
+
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new kc()), h(this, "p50", new Oc(.5)), h(this, "p95", new Oc(.95));
|
|
10806
10828
|
}
|
|
10807
10829
|
add(e) {
|
|
10808
10830
|
e < this.minVal && (this.minVal = e), e > this.maxVal && (this.maxVal = e), this.mean.add(e), this.p50.add(e), this.p95.add(e), this.count++;
|
|
@@ -10820,18 +10842,107 @@ var xc = class {
|
|
|
10820
10842
|
get hasData() {
|
|
10821
10843
|
return this.count > 0;
|
|
10822
10844
|
}
|
|
10823
|
-
},
|
|
10845
|
+
}, jc = "tmp.ml.vad", Mc = class {
|
|
10846
|
+
constructor(e, t = null) {
|
|
10847
|
+
h(this, "_statAggregator", void 0), h(this, "_logger", void 0), h(this, "_vadInference", new Ac()), h(this, "_readyModels", /* @__PURE__ */ new Set()), h(this, "_sentErrors", /* @__PURE__ */ new Set()), this._statAggregator = e, this._logger = t;
|
|
10848
|
+
}
|
|
10849
|
+
logModelReady(e, t) {
|
|
10850
|
+
!Number.isFinite(t) || this._readyModels.has(e) || (this._readyModels.add(e), this._statAggregator?.logEventualStat({
|
|
10851
|
+
name: U.ML_READY_TO_USE,
|
|
10852
|
+
value: Math.max(0, Math.round(t)),
|
|
10853
|
+
source: e
|
|
10854
|
+
}));
|
|
10855
|
+
}
|
|
10856
|
+
logModelError(e, t) {
|
|
10857
|
+
let n = Dc(t), r = `${e}:${n}`;
|
|
10858
|
+
this._sentErrors.has(r) || (this._sentErrors.add(r), this._statAggregator?.logEventualStat({
|
|
10859
|
+
name: U.ML_ERROR,
|
|
10860
|
+
source: e,
|
|
10861
|
+
string_value: n
|
|
10862
|
+
}));
|
|
10863
|
+
}
|
|
10864
|
+
addVadInference(e) {
|
|
10865
|
+
Number.isFinite(e) && e >= 0 && this._vadInference.add(Math.round(e * 1e3));
|
|
10866
|
+
}
|
|
10867
|
+
logSummaries() {
|
|
10868
|
+
this.summaries().forEach((e) => this._logger?.logClientStats(e));
|
|
10869
|
+
}
|
|
10870
|
+
summaries() {
|
|
10871
|
+
if (!this._vadInference.hasData) return [];
|
|
10872
|
+
let e = this._vadInference.snapshot();
|
|
10873
|
+
return [{
|
|
10874
|
+
name: U.SIGNALING_COMMAND_SUMMARY,
|
|
10875
|
+
api_method: jc,
|
|
10876
|
+
min_value: e.min,
|
|
10877
|
+
max_value: e.max,
|
|
10878
|
+
avg_value: e.avg,
|
|
10879
|
+
median_value: e.median,
|
|
10880
|
+
p95_value: e.p95,
|
|
10881
|
+
values_count: e.count
|
|
10882
|
+
}];
|
|
10883
|
+
}
|
|
10884
|
+
destroy() {
|
|
10885
|
+
this._vadInference = new Ac();
|
|
10886
|
+
}
|
|
10887
|
+
}, Nc = class {
|
|
10888
|
+
constructor(e, t = null) {
|
|
10889
|
+
h(this, "_logger", void 0), h(this, "_resources", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e, this._resources = t;
|
|
10890
|
+
}
|
|
10891
|
+
logCallStat(e) {
|
|
10892
|
+
let t = {
|
|
10893
|
+
...e,
|
|
10894
|
+
...this._resources?.takeReport() ?? {}
|
|
10895
|
+
};
|
|
10896
|
+
this._lastCallStatContext = this._getCallStatContext(t), this._flushEventualStats(), this._logger.logClientStats(t);
|
|
10897
|
+
}
|
|
10898
|
+
logEventualStat(e) {
|
|
10899
|
+
this._eventualLogs.add({
|
|
10900
|
+
data: e,
|
|
10901
|
+
occurredAt: Date.now()
|
|
10902
|
+
});
|
|
10903
|
+
}
|
|
10904
|
+
logEventualStatSinceMark(e) {
|
|
10905
|
+
let t = G.measureMark(e.name);
|
|
10906
|
+
t !== null && this.logEventualStat({
|
|
10907
|
+
...e,
|
|
10908
|
+
value: t
|
|
10909
|
+
});
|
|
10910
|
+
}
|
|
10911
|
+
destroy() {
|
|
10912
|
+
this._flushEventualStats();
|
|
10913
|
+
}
|
|
10914
|
+
_getCallStatContext(e) {
|
|
10915
|
+
return {
|
|
10916
|
+
call_topology: e.call_topology,
|
|
10917
|
+
local_address: e.local_address,
|
|
10918
|
+
local_connection_type: e.local_connection_type,
|
|
10919
|
+
network_type: e.network_type,
|
|
10920
|
+
remote_address: e.remote_address,
|
|
10921
|
+
remote_connection_type: e.remote_connection_type,
|
|
10922
|
+
transport: e.transport
|
|
10923
|
+
};
|
|
10924
|
+
}
|
|
10925
|
+
_flushEventualStats() {
|
|
10926
|
+
let e = [...this._eventualLogs];
|
|
10927
|
+
for (let t of e) this._logEventualStat(t), this._eventualLogs.delete(t);
|
|
10928
|
+
}
|
|
10929
|
+
_logEventualStat({ data: e, occurredAt: t }) {
|
|
10930
|
+
let n = { ...this._lastCallStatContext ?? {} };
|
|
10931
|
+
for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
|
|
10932
|
+
this._logger.logClientStats(n, { occurredAt: t });
|
|
10933
|
+
}
|
|
10934
|
+
}, Pc = 120 * 1e3, Fc = class {
|
|
10824
10935
|
constructor(e) {
|
|
10825
10936
|
h(this, "_logger", void 0), h(this, "trackerByTransport", {
|
|
10826
|
-
ws: new
|
|
10827
|
-
wt: new
|
|
10937
|
+
ws: new Ac(),
|
|
10938
|
+
wt: new Ac()
|
|
10828
10939
|
}), h(this, "lastSeen", {}), this._logger = e;
|
|
10829
10940
|
}
|
|
10830
10941
|
mark(e) {
|
|
10831
10942
|
let t = Date.now(), n = this.lastSeen[e];
|
|
10832
10943
|
if (typeof n == "number") {
|
|
10833
10944
|
let r = t - n;
|
|
10834
|
-
r >= 0 && r <=
|
|
10945
|
+
r >= 0 && r <= Pc && this.trackerByTransport[e].add(r);
|
|
10835
10946
|
}
|
|
10836
10947
|
this.lastSeen[e] = t;
|
|
10837
10948
|
}
|
|
@@ -10860,17 +10971,17 @@ var xc = class {
|
|
|
10860
10971
|
}
|
|
10861
10972
|
destroy() {
|
|
10862
10973
|
this.trackerByTransport = {
|
|
10863
|
-
ws: new
|
|
10864
|
-
wt: new
|
|
10974
|
+
ws: new Ac(),
|
|
10975
|
+
wt: new Ac()
|
|
10865
10976
|
}, this.lastSeen = {};
|
|
10866
10977
|
}
|
|
10867
|
-
},
|
|
10978
|
+
}, Ic = class {
|
|
10868
10979
|
constructor(e) {
|
|
10869
10980
|
h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
|
|
10870
10981
|
}
|
|
10871
10982
|
mark(e, t, n) {
|
|
10872
10983
|
let r = `${e}|${n}`, i;
|
|
10873
|
-
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new
|
|
10984
|
+
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new Ac(), this.trackerByCommand.set(r, i)), i.add(t);
|
|
10874
10985
|
}
|
|
10875
10986
|
logMetrics() {
|
|
10876
10987
|
this.summaries().forEach((e) => this._logger.logClientStats(e));
|
|
@@ -10897,9 +11008,9 @@ var xc = class {
|
|
|
10897
11008
|
destroy() {
|
|
10898
11009
|
this.trackerByCommand.clear();
|
|
10899
11010
|
}
|
|
10900
|
-
},
|
|
11011
|
+
}, Lc = class {
|
|
10901
11012
|
constructor(e, t, n, r, i) {
|
|
10902
|
-
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "resources", void 0), h(this, "battery", void 0), h(this, "_api", void 0), h(this, "_tail", void 0), this.logger = new
|
|
11013
|
+
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "resources", void 0), h(this, "battery", void 0), h(this, "ml", void 0), h(this, "_api", void 0), h(this, "_tail", void 0), this.logger = new ic(e, t, n, r), this._tail = N.statQueueEnabled && Gs.isSupported() ? new Gs(this.logger, () => this._callSummaries()) : null, this.lifecycle = new Sc(this.logger, void 0, this._tail), this.resources = new wc(i), this.statAggregator = new Nc(this.logger, this.resources), this.codecStatsAggregator = new Tc(this.logger, r), this.pings = new Fc(this.logger), this.signalingCommands = new Ic(this.logger), this.apiCalls = new ac(this.statAggregator), this.ml = new Mc(this.statAggregator, this.logger), this._api = e, this._api.setApiCallStats(this.apiCalls), this.battery = new sc(this.logger);
|
|
10903
11014
|
}
|
|
10904
11015
|
onPageHide() {
|
|
10905
11016
|
N.statQueueEnabled || this.destroy();
|
|
@@ -10911,19 +11022,20 @@ var xc = class {
|
|
|
10911
11022
|
this.lifecycle.markFinished(e);
|
|
10912
11023
|
}
|
|
10913
11024
|
flushCallMetrics() {
|
|
10914
|
-
this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy();
|
|
11025
|
+
this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy(), this.ml.logSummaries(), this.ml.destroy();
|
|
10915
11026
|
}
|
|
10916
11027
|
destroy() {
|
|
10917
|
-
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.resources.destroy(), this.battery.destroy(), this.logger.destroy(), N.statQueueEnabled &&
|
|
11028
|
+
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.ml.destroy(), this.resources.destroy(), this.battery.destroy(), this.logger.destroy(), N.statQueueEnabled && nc.notifyCallFinished();
|
|
10918
11029
|
}
|
|
10919
11030
|
_callSummaries() {
|
|
10920
11031
|
return [
|
|
10921
11032
|
...this.codecStatsAggregator.usageReports(),
|
|
10922
11033
|
...this.pings.summaries(),
|
|
10923
|
-
...this.signalingCommands.summaries()
|
|
11034
|
+
...this.signalingCommands.summaries(),
|
|
11035
|
+
...this.ml.summaries()
|
|
10924
11036
|
];
|
|
10925
11037
|
}
|
|
10926
|
-
},
|
|
11038
|
+
}, Rc = class {
|
|
10927
11039
|
constructor(e) {
|
|
10928
11040
|
h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
|
|
10929
11041
|
}
|
|
@@ -10948,8 +11060,8 @@ var xc = class {
|
|
|
10948
11060
|
call_type: this._callType
|
|
10949
11061
|
}));
|
|
10950
11062
|
}
|
|
10951
|
-
},
|
|
10952
|
-
function
|
|
11063
|
+
}, zc = 1e3, Bc = 1e4;
|
|
11064
|
+
function Vc(e, t, n, r) {
|
|
10953
11065
|
return new k(e, {
|
|
10954
11066
|
callError: {
|
|
10955
11067
|
scope: "external",
|
|
@@ -10960,13 +11072,13 @@ function Ic(e, t, n, r) {
|
|
|
10960
11072
|
message: r
|
|
10961
11073
|
});
|
|
10962
11074
|
}
|
|
10963
|
-
var
|
|
11075
|
+
var Hc = 15, $ = class e extends Xe {
|
|
10964
11076
|
constructor(e, t) {
|
|
10965
11077
|
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Gr()), h(this, "_serverTimeOffset", 0), h(this, "_serverConversationId", null), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_hangupReason", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_pendingId", null), h(this, "_resolveSignalingInitialization", void 0), h(this, "_signalingInitialization", new Promise((e) => {
|
|
10966
11078
|
this._resolveSignalingInitialization = e;
|
|
10967
|
-
})), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo",
|
|
11079
|
+
})), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Go((e) => {
|
|
10968
11080
|
if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
10969
|
-
})), h(this, "_toggleLocalAudio",
|
|
11081
|
+
})), h(this, "_toggleLocalAudio", Go((e) => {
|
|
10970
11082
|
if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
|
|
10971
11083
|
})), h(this, "_changeMediaSettings", M.debounce(async (e) => {
|
|
10972
11084
|
if (!(!this._signaling.ready || !this._transport || this.isCallHeld)) try {
|
|
@@ -10978,10 +11090,10 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
10978
11090
|
captureAudio: !1
|
|
10979
11091
|
});
|
|
10980
11092
|
}
|
|
10981
|
-
}, 100)), this._stats = new
|
|
11093
|
+
}, 100)), this._stats = new Lc(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology, {
|
|
10982
11094
|
getActiveFeatures: () => this._mediaSource?.activeFeatures ?? [],
|
|
10983
11095
|
getParticipantsCount: () => this._getParticipantsCount()
|
|
10984
|
-
}), this._api = e, this._signaling = new
|
|
11096
|
+
}), this._api = e, this._signaling = new _o(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new is(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new es({
|
|
10985
11097
|
api: this._api,
|
|
10986
11098
|
debug: this._debug,
|
|
10987
11099
|
getParticipants: () => this._participants,
|
|
@@ -10994,7 +11106,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
10994
11106
|
this._stats.resetPingBaseline();
|
|
10995
11107
|
}, this._onVisibilityChange = () => {
|
|
10996
11108
|
document.visibilityState === "hidden" && this._stats.resetPingBaseline();
|
|
10997
|
-
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), document.addEventListener("visibilitychange", this._onVisibilityChange), this._statFirstMediaReceived = new
|
|
11109
|
+
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), document.addEventListener("visibilitychange", this._onVisibilityChange), this._statFirstMediaReceived = new Rc(this._stats.statAggregator), this._audioOutput = new qo(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), zc));
|
|
10998
11110
|
}
|
|
10999
11111
|
static current() {
|
|
11000
11112
|
return B.getActive() ?? (N.hold ? null : B.getFirst());
|
|
@@ -11015,7 +11127,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11015
11127
|
return this._state === "HELD";
|
|
11016
11128
|
}
|
|
11017
11129
|
get isIncomingRinging() {
|
|
11018
|
-
return this._conversation?.direction ===
|
|
11130
|
+
return this._conversation?.direction === vo.INCOMING && this._state === "IDLE";
|
|
11019
11131
|
}
|
|
11020
11132
|
static debugSessionId() {
|
|
11021
11133
|
return e.current()?.debugSessionId ?? null;
|
|
@@ -11041,7 +11153,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11041
11153
|
R.onNonFatalError(Error(e), this.id);
|
|
11042
11154
|
}
|
|
11043
11155
|
getIncomingCallerExternalId() {
|
|
11044
|
-
return this._conversation?.direction ===
|
|
11156
|
+
return this._conversation?.direction === vo.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
|
|
11045
11157
|
}
|
|
11046
11158
|
get oneToOnePeer() {
|
|
11047
11159
|
let e = this._conversation;
|
|
@@ -11059,12 +11171,12 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11059
11171
|
platform: N.platform,
|
|
11060
11172
|
protocolVersion: N.protocolVersion,
|
|
11061
11173
|
domainId: N.domain,
|
|
11062
|
-
capabilities:
|
|
11174
|
+
capabilities: Za.getFlags()
|
|
11063
11175
|
};
|
|
11064
11176
|
return JSON.stringify(e);
|
|
11065
11177
|
}
|
|
11066
11178
|
async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
|
|
11067
|
-
let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t ===
|
|
11179
|
+
let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === yo.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
|
|
11068
11180
|
this._stats.lifecycle.markInitializationStarted({
|
|
11069
11181
|
source: "outgoing",
|
|
11070
11182
|
conversationId: u
|
|
@@ -11074,11 +11186,11 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11074
11186
|
let l = await this._requestLocalMedia(n);
|
|
11075
11187
|
this._throwIfClosed();
|
|
11076
11188
|
let d = this._mediaSource.mediaSettings;
|
|
11077
|
-
t ===
|
|
11189
|
+
t === yo.CHAT || e && e.length > 1 ? this._logWithMediaSettings(x.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(x.OUTGOING_CALL, d);
|
|
11078
11190
|
let m = await this._startConversation({
|
|
11079
11191
|
opponentIds: e,
|
|
11080
11192
|
opponentType: t,
|
|
11081
|
-
direction:
|
|
11193
|
+
direction: vo.OUTGOING,
|
|
11082
11194
|
mediaOptions: l,
|
|
11083
11195
|
payload: r,
|
|
11084
11196
|
joiningAllowed: i,
|
|
@@ -11196,11 +11308,11 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11196
11308
|
}
|
|
11197
11309
|
}
|
|
11198
11310
|
_isInWaitingHall(e) {
|
|
11199
|
-
return !e.conversation || !e.conversation.options.includes(
|
|
11311
|
+
return !e.conversation || !e.conversation.options.includes(So.WAITING_HALL) ? !1 : this._isRestricted(e);
|
|
11200
11312
|
}
|
|
11201
11313
|
_isWaitForAdmin(e) {
|
|
11202
11314
|
if (!e.conversation) return !1;
|
|
11203
|
-
let t = e.conversation.options.includes(
|
|
11315
|
+
let t = e.conversation.options.includes(So.WAIT_FOR_ADMIN), n = e.conversation.options.includes(So.ADMIN_IS_HERE);
|
|
11204
11316
|
return !t || t && n ? !1 : this._isRestricted(e);
|
|
11205
11317
|
}
|
|
11206
11318
|
_isRestricted(e) {
|
|
@@ -11208,7 +11320,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11208
11320
|
return t && t.restricted || !1;
|
|
11209
11321
|
}
|
|
11210
11322
|
_isAudienceMode(e) {
|
|
11211
|
-
return e.conversation?.options?.includes(
|
|
11323
|
+
return e.conversation?.options?.includes(So.AUDIENCE_MODE) || !1;
|
|
11212
11324
|
}
|
|
11213
11325
|
_isAudienceModeListener() {
|
|
11214
11326
|
return this._conversation?.audienceMode && this._conversation?.restricted;
|
|
@@ -11238,7 +11350,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11238
11350
|
let i = atob(n), a = new Uint8Array(i.length);
|
|
11239
11351
|
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
11240
11352
|
try {
|
|
11241
|
-
let e =
|
|
11353
|
+
let e = Wo(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
|
|
11242
11354
|
return {
|
|
11243
11355
|
token: i,
|
|
11244
11356
|
endpoint: l,
|
|
@@ -11477,10 +11589,10 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11477
11589
|
let t = await this._api.getConversationParams(e);
|
|
11478
11590
|
this._throwIfClosed(), this._debug.debug("Api.getConversationParams", t);
|
|
11479
11591
|
let { turn_server: n, stun_server: r } = t;
|
|
11480
|
-
return N.iceServers =
|
|
11592
|
+
return N.iceServers = Uo(r, n), N.wssBase = t.endpoint, t.wt_endpoint && (N.wtsBase = t.wt_endpoint), N.wssToken = t.token, t.client_type && (N.clientType = t.client_type), t.external_user_type && (N.externalUserType = t.external_user_type), t;
|
|
11481
11593
|
}
|
|
11482
11594
|
_setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
|
|
11483
|
-
N.iceServers =
|
|
11595
|
+
N.iceServers = Uo(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
|
|
11484
11596
|
}
|
|
11485
11597
|
_buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
|
|
11486
11598
|
let s = new URL(e), c = s.searchParams;
|
|
@@ -11512,10 +11624,10 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11512
11624
|
isVideo: f,
|
|
11513
11625
|
joiningAllowed: a,
|
|
11514
11626
|
requireAuthToJoin: o
|
|
11515
|
-
}, this._abortController?.signal), !e) throw
|
|
11627
|
+
}, this._abortController?.signal), !e) throw Vc(p.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
|
|
11516
11628
|
if (!e.internalCallerParams) {
|
|
11517
11629
|
let t = e.rejectedParticipants[0]?.status;
|
|
11518
|
-
throw
|
|
11630
|
+
throw Vc(p.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
11519
11631
|
}
|
|
11520
11632
|
} catch (e) {
|
|
11521
11633
|
throw this._state === "CLOSE" ? new k(p.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(p.FAST_START_ERROR, { message: e.message }) : new k(p.FAST_START_ERROR, { message: String(e) });
|
|
@@ -11537,10 +11649,10 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11537
11649
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
11538
11650
|
}, this._debug.debug("FastStart", m), ee = "fastStart";
|
|
11539
11651
|
} catch {
|
|
11540
|
-
throw
|
|
11652
|
+
throw Vc(p.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
11541
11653
|
}
|
|
11542
11654
|
} else m = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", m), ee = "startConversation";
|
|
11543
|
-
|
|
11655
|
+
Jo(m, ee), this._applyServerConversation(m.id), this._pendingId = m.id, this._setConversationParams(m), this._stats.lifecycle.bindConversationId(m.id);
|
|
11544
11656
|
let te = await this._connectSignaling(Cr.START, m);
|
|
11545
11657
|
return this._throwIfClosed(), this._setConversation(m, te, n), this._stats.lifecycle.markCallStarted(), te;
|
|
11546
11658
|
}
|
|
@@ -11565,9 +11677,9 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11565
11677
|
joinLink: i,
|
|
11566
11678
|
isVideo: c,
|
|
11567
11679
|
internalParams: this._buildInternalParams()
|
|
11568
|
-
}, this._abortController?.signal), !e) throw
|
|
11569
|
-
if (!e.internalCallerParams) throw
|
|
11570
|
-
if (!e.conversationId) throw
|
|
11680
|
+
}, this._abortController?.signal), !e) throw Vc(p.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
|
|
11681
|
+
if (!e.internalCallerParams) throw Vc(p.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
11682
|
+
if (!e.conversationId) throw Vc(p.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
11571
11683
|
} catch (e) {
|
|
11572
11684
|
throw this._state === "CLOSE" ? new k(p.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(p.FAST_JOIN_ERROR, { message: e.message }) : new k(p.FAST_JOIN_ERROR, { message: String(e) });
|
|
11573
11685
|
}
|
|
@@ -11585,7 +11697,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11585
11697
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
11586
11698
|
}, this._debug.debug("FastJoin", l), u = "fastJoin";
|
|
11587
11699
|
} catch (e) {
|
|
11588
|
-
throw e instanceof k ? e :
|
|
11700
|
+
throw e instanceof k ? e : Vc(p.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
|
|
11589
11701
|
}
|
|
11590
11702
|
} else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
|
|
11591
11703
|
else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
|
|
@@ -11594,13 +11706,13 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11594
11706
|
code: "join",
|
|
11595
11707
|
description: "target-missing"
|
|
11596
11708
|
} });
|
|
11597
|
-
if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id),
|
|
11709
|
+
if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), Jo(l, u), l.id) {
|
|
11598
11710
|
if (B.has(l.id, this)) throw new k(p.HAS_ACTIVE_CALL);
|
|
11599
11711
|
this._pendingId = l.id;
|
|
11600
11712
|
}
|
|
11601
11713
|
this._setConversationParams(l);
|
|
11602
11714
|
let d = await this._connectSignaling(Cr.JOIN, l);
|
|
11603
|
-
return this._throwIfClosed(), this._setConversation(l, d,
|
|
11715
|
+
return this._throwIfClosed(), this._setConversation(l, d, vo.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
11604
11716
|
}
|
|
11605
11717
|
async _prepareConversation(e, t = j.USER, n, r, i) {
|
|
11606
11718
|
G.setMark(U.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -11662,7 +11774,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11662
11774
|
}), l.wt_endpoint = c);
|
|
11663
11775
|
}
|
|
11664
11776
|
let u = await this._connectSignaling(Cr.ACCEPT, l);
|
|
11665
|
-
return this._throwIfClosed(), this._setConversation(l, u,
|
|
11777
|
+
return this._throwIfClosed(), this._setConversation(l, u, vo.INCOMING, t), u;
|
|
11666
11778
|
}
|
|
11667
11779
|
_createParticipant(e, t, n = !0) {
|
|
11668
11780
|
let r = Object.assign({
|
|
@@ -11689,7 +11801,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11689
11801
|
let e = this._getParticipantId(t ?? r.id);
|
|
11690
11802
|
e && (r.externalId = e);
|
|
11691
11803
|
}
|
|
11692
|
-
return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus =
|
|
11804
|
+
return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = Mo.create(r.connectionStatus), r;
|
|
11693
11805
|
}
|
|
11694
11806
|
_getParticipantId(e) {
|
|
11695
11807
|
let t = this._api.userId(e);
|
|
@@ -11759,7 +11871,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11759
11871
|
urlSharingInfoByRoom: /* @__PURE__ */ new Map()
|
|
11760
11872
|
}, this._debug.setConversationId(t.conversation.id || e.id), e.p2p_forbidden && (N.forceRelayPolicy = e.p2p_forbidden), this._stats.logger.log(x.RELAY_POLICY, N.forceRelayPolicy ? "1" : "0");
|
|
11761
11873
|
let u = B.get(this._conversation.id);
|
|
11762
|
-
if (u && u !== this && (this._conversation.concurrent = !0), n !==
|
|
11874
|
+
if (u && u !== this && (this._conversation.concurrent = !0), n !== vo.INCOMING && !u && !N.hold && B.getLive(this).some((e) => e.id !== this.id)) throw new k(p.HAS_ACTIVE_CALL);
|
|
11763
11875
|
this._changeFeatureSet(), this._changeFeaturesPerRole(), this._logDevices();
|
|
11764
11876
|
}
|
|
11765
11877
|
_updateConversation(e) {
|
|
@@ -11805,7 +11917,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11805
11917
|
}
|
|
11806
11918
|
_createMediaSource() {
|
|
11807
11919
|
let e = new $t(this._debug, this._stats.logger);
|
|
11808
|
-
return this.subscribe(e, Zt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Zt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new
|
|
11920
|
+
return this.subscribe(e, Zt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Zt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Ko(e, this._debug, this._stats.logger), e;
|
|
11809
11921
|
}
|
|
11810
11922
|
async _connectSignaling(e, t) {
|
|
11811
11923
|
this._throwIfClosed(), this.subscribe(this._signaling, wr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, wr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, wr.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
@@ -11820,7 +11932,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11820
11932
|
if (!B.canAcceptIncoming(this)) throw this._stats.logger.log(x.PUSH, "busy"), new k(p.BUSY);
|
|
11821
11933
|
if (!e.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(x.PUSH, "rejected"), new k(p.REJECTED);
|
|
11822
11934
|
}
|
|
11823
|
-
this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(
|
|
11935
|
+
this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(bo.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
11824
11936
|
}
|
|
11825
11937
|
_onConversationParticipantListChunk(e) {
|
|
11826
11938
|
let t = e.participants;
|
|
@@ -11909,7 +12021,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11909
12021
|
_registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
|
|
11910
12022
|
if (!e) return;
|
|
11911
12023
|
let n = async () => {
|
|
11912
|
-
let n =
|
|
12024
|
+
let n = Io(e, To.MUTE), r = Io(e, To.MUTE_PERMANENT);
|
|
11913
12025
|
for (let i of [n, r]) i.length && await this._onMuteParticipant({
|
|
11914
12026
|
muteStates: e,
|
|
11915
12027
|
unmuteOptions: t,
|
|
@@ -11923,8 +12035,8 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11923
12035
|
if (!(!N.enableSessionStateUpdates || this._isMe(e))) return t;
|
|
11924
12036
|
}
|
|
11925
12037
|
_buildConnectionStatus(e, t, n, r = !1) {
|
|
11926
|
-
return
|
|
11927
|
-
transport: r ? P.ONHOLD :
|
|
12038
|
+
return Mo.create({
|
|
12039
|
+
transport: r ? P.ONHOLD : Mo.fromTransportState(n) ?? P.WAITING,
|
|
11928
12040
|
sessionState: this._remoteParticipantSessionState(e, t),
|
|
11929
12041
|
sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
|
|
11930
12042
|
});
|
|
@@ -11933,12 +12045,12 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
11933
12045
|
return N.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
|
|
11934
12046
|
}
|
|
11935
12047
|
_setTransportStatus(e, t) {
|
|
11936
|
-
return
|
|
12048
|
+
return Mo.setTransport(e.connectionStatus, t);
|
|
11937
12049
|
}
|
|
11938
12050
|
_setSessionState(e, t) {
|
|
11939
|
-
let n =
|
|
12051
|
+
let n = Mo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
11940
12052
|
this._emitParticipantTransition(e, n);
|
|
11941
|
-
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i =
|
|
12053
|
+
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = Mo.setSessionState(e.connectionStatus, t, r);
|
|
11942
12054
|
return this._emitParticipantTransition(e, i), i;
|
|
11943
12055
|
}
|
|
11944
12056
|
_emitParticipantTransition(e, t, n = null) {
|
|
@@ -12012,11 +12124,11 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12012
12124
|
this._onRoomSwitched(t, !0);
|
|
12013
12125
|
}
|
|
12014
12126
|
_processMuteStates(e, t = !1) {
|
|
12015
|
-
let n =
|
|
12127
|
+
let n = Lo(e);
|
|
12016
12128
|
this._setMuteStatesForRoomId(n, null);
|
|
12017
12129
|
for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
|
|
12018
12130
|
let r = this._getMuteStatesForCurrentRoom();
|
|
12019
|
-
t && (r =
|
|
12131
|
+
t && (r = Vo(e, r));
|
|
12020
12132
|
let i = Object.keys(r), a = this._conversation?.roomId;
|
|
12021
12133
|
i.length && this._onMuteParticipant({
|
|
12022
12134
|
muteStates: r,
|
|
@@ -12036,15 +12148,15 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12036
12148
|
}
|
|
12037
12149
|
_allocateTransport() {
|
|
12038
12150
|
if (!this._conversation || !this._mediaSource || this.isCallHeld || this._transport) return;
|
|
12039
|
-
this._transport = new
|
|
12040
|
-
let e = this._conversation.direction ===
|
|
12151
|
+
this._transport = new Na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback(), (e) => this._participants[e]?.state === X.ACCEPTED, this._stats.ml), this._debugInfo = new $o(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
12152
|
+
let e = this._conversation.direction === vo.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
12041
12153
|
for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
12042
12154
|
}
|
|
12043
12155
|
_createSpeakerDetector() {
|
|
12044
|
-
this._transport && this._conversation && (this._volumesDetector = new
|
|
12156
|
+
this._transport && this._conversation && (this._volumesDetector = new os(this._transport), this.subscribe(this._volumesDetector, as.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new cs(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, ss.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new rs(this._mediaSource));
|
|
12045
12157
|
}
|
|
12046
12158
|
_createSpecListener() {
|
|
12047
|
-
this._transport && this._volumesDetector && (this._specListener = new
|
|
12159
|
+
this._transport && this._volumesDetector && (this._specListener = new ds(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
|
|
12048
12160
|
}
|
|
12049
12161
|
_logDevices() {
|
|
12050
12162
|
let e = D.getCameras().length, t = D.getMicrophones().length;
|
|
@@ -12143,7 +12255,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12143
12255
|
_onRemoveParticipant(e) {
|
|
12144
12256
|
this._debug.debug(`Remove participant [${e}]`);
|
|
12145
12257
|
let t = [], n = this._participants;
|
|
12146
|
-
for (let r = 0; r <=
|
|
12258
|
+
for (let r = 0; r <= Hc; r++) {
|
|
12147
12259
|
let i = n[M.compose(e, r)];
|
|
12148
12260
|
i && t.push(i);
|
|
12149
12261
|
}
|
|
@@ -12240,7 +12352,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12240
12352
|
await this._signaling.hold(!1), this._throwIfClosed(), this._restoreStateAfterHold();
|
|
12241
12353
|
let n = null;
|
|
12242
12354
|
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (n = Object.values(this._participants), n.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
12243
|
-
let e = this._conversation?.direction ===
|
|
12355
|
+
let e = this._conversation?.direction === vo.OUTGOING && !this._conversation.concurrent;
|
|
12244
12356
|
this._openTransport(n ?? Object.values(this._participants), e);
|
|
12245
12357
|
}
|
|
12246
12358
|
}
|
|
@@ -12363,13 +12475,13 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12363
12475
|
let n = Rn(e), a = i[n.participantId];
|
|
12364
12476
|
if (a) {
|
|
12365
12477
|
let e;
|
|
12366
|
-
typeof t == "number" ? e =
|
|
12478
|
+
typeof t == "number" ? e = Oo(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Do.UNKNOWN_ERROR), r.push({
|
|
12367
12479
|
externalId: a.externalId,
|
|
12368
12480
|
errorReason: e
|
|
12369
12481
|
});
|
|
12370
12482
|
}
|
|
12371
12483
|
}
|
|
12372
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
12484
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Uc("Could not allocate one or more participants", r);
|
|
12373
12485
|
}
|
|
12374
12486
|
async _cleanupCooldownQueue() {
|
|
12375
12487
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -12377,7 +12489,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12377
12489
|
let n = t.next();
|
|
12378
12490
|
if (n.done) break;
|
|
12379
12491
|
let r = n.value;
|
|
12380
|
-
if (r[1] +
|
|
12492
|
+
if (r[1] + Bc > Date.now()) break;
|
|
12381
12493
|
let i = r[0];
|
|
12382
12494
|
await this._stopStreaming(i), e[i] = { stopStream: !0 };
|
|
12383
12495
|
} while (!0);
|
|
@@ -12581,10 +12693,10 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12581
12693
|
throw Error("transport is not initialized");
|
|
12582
12694
|
}
|
|
12583
12695
|
_isCallAdmin() {
|
|
12584
|
-
return this._conversation ? M.includesOneOf(this._conversation.roles, [
|
|
12696
|
+
return this._conversation ? M.includesOneOf(this._conversation.roles, [ko.ADMIN, ko.CREATOR]) : !1;
|
|
12585
12697
|
}
|
|
12586
12698
|
_checkAdminRole() {
|
|
12587
|
-
if (this._conversation && !M.includesOneOf(this._conversation.roles, [
|
|
12699
|
+
if (this._conversation && !M.includesOneOf(this._conversation.roles, [ko.ADMIN, ko.CREATOR])) throw Error("You don't have the required permission");
|
|
12588
12700
|
}
|
|
12589
12701
|
_isCalledState() {
|
|
12590
12702
|
return this._participantState === X.CALLED;
|
|
@@ -12622,14 +12734,14 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12622
12734
|
async changeOptions(e) {
|
|
12623
12735
|
if (this._signaling.ready && this._conversation) {
|
|
12624
12736
|
this._checkAdminRole(), await this._signaling.changeOptions(e);
|
|
12625
|
-
let t =
|
|
12737
|
+
let t = wo(this._conversation.options, e);
|
|
12626
12738
|
this._onOptionsChanged(t);
|
|
12627
12739
|
}
|
|
12628
12740
|
}
|
|
12629
12741
|
async getWaitingHall(e, t, n) {
|
|
12630
12742
|
if (!this._signaling) return Promise.reject();
|
|
12631
12743
|
let r = null;
|
|
12632
|
-
if (e && (r =
|
|
12744
|
+
if (e && (r = Fo(e), r)) {
|
|
12633
12745
|
let e = this._api.getDecorativeIdByInitialId(r.id);
|
|
12634
12746
|
if (e) {
|
|
12635
12747
|
let { compositeUserId: t } = M.decomposeParticipantId(e);
|
|
@@ -12639,7 +12751,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12639
12751
|
let i = await this._signaling.getWaitingHall(r, t, n);
|
|
12640
12752
|
if (i.error) return Promise.reject(i.message);
|
|
12641
12753
|
let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
|
|
12642
|
-
return a.length && i.hasMore && (s =
|
|
12754
|
+
return a.length && i.hasMore && (s = Po(a[a.length - 1].id)), {
|
|
12643
12755
|
participants: o,
|
|
12644
12756
|
pageMarker: s,
|
|
12645
12757
|
totalCount: i.totalCount || 0
|
|
@@ -12673,7 +12785,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12673
12785
|
}
|
|
12674
12786
|
async promoteParticipant(e, t) {
|
|
12675
12787
|
if (this._signaling && this._conversation) try {
|
|
12676
|
-
if (!M.includesOneOf(this._conversation.options, [
|
|
12788
|
+
if (!M.includesOneOf(this._conversation.options, [So.WAITING_HALL, So.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
|
|
12677
12789
|
if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
|
|
12678
12790
|
await this._signaling.promoteParticipant(e, t);
|
|
12679
12791
|
} catch (t) {
|
|
@@ -12828,7 +12940,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12828
12940
|
let a = this._transport?.getState();
|
|
12829
12941
|
return n.participants.forEach((e) => {
|
|
12830
12942
|
let t = M.composeId(e), n = r[t];
|
|
12831
|
-
this._updateParticipantExternalId(n, Z.fromSignalingParticipant(e, !0, !0)), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n,
|
|
12943
|
+
this._updateParticipantExternalId(n, Z.fromSignalingParticipant(e, !0, !0)), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, Mo.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, O(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
|
|
12832
12944
|
}), this._participantListChunkToExternalChunk(n);
|
|
12833
12945
|
}
|
|
12834
12946
|
async _getInitialParticiapntListChunk() {
|
|
@@ -12842,7 +12954,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12842
12954
|
_onLocalMediaStreamChanged(e) {
|
|
12843
12955
|
if (!this._mediaSource) return;
|
|
12844
12956
|
let t = this._mediaSource.mediaSettings;
|
|
12845
|
-
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new
|
|
12957
|
+
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Ko(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), e.kind === A.video && !this._requestingLocalMedia && this._state !== "CLOSE" && R.onLocalStream(this._mediaSource.getStream(), t, this.id), this._conversation && !this._conversation.waitingHall && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
|
|
12846
12958
|
}
|
|
12847
12959
|
_onScreenSharingStatus(e) {
|
|
12848
12960
|
let t = this.mediaSettings;
|
|
@@ -12972,9 +13084,9 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12972
13084
|
for (let n of e.conversation.participants) {
|
|
12973
13085
|
let e = M.composeId(n), i = n.roles || [];
|
|
12974
13086
|
if (this._isMe(e)) {
|
|
12975
|
-
|
|
13087
|
+
Ao(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
|
|
12976
13088
|
this._registerParticipantLocalMuteState({
|
|
12977
|
-
muteStates:
|
|
13089
|
+
muteStates: Bo(n),
|
|
12978
13090
|
unmuteOptions: n.unmuteOptions
|
|
12979
13091
|
});
|
|
12980
13092
|
};
|
|
@@ -12988,7 +13100,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
12988
13100
|
Jt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
12989
13101
|
let r = M.mapParticipantState(n), o = a.participantState;
|
|
12990
13102
|
if (!M.isEqualParticipantState(r, o) && (await this._changeRemoteParticipantState(e, r), !this._conversation)) return;
|
|
12991
|
-
|
|
13103
|
+
Ao(i, a.roles) || this._onRolesChanged(a.id, i), this._reconcileParticipantHold(a, n);
|
|
12992
13104
|
} else if (await this._onJoinedParticipant({
|
|
12993
13105
|
participantId: n.id,
|
|
12994
13106
|
participant: n,
|
|
@@ -13016,7 +13128,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13016
13128
|
this._close(new k(p.ANOTHER_DEVICE), { errorText: "Call accepted on other device" });
|
|
13017
13129
|
return;
|
|
13018
13130
|
}
|
|
13019
|
-
this._conversation?.direction ===
|
|
13131
|
+
this._conversation?.direction === vo.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
|
|
13020
13132
|
let r = this._getParticipant(t);
|
|
13021
13133
|
if (!r) {
|
|
13022
13134
|
let n = this._api.getDecorativeIdByInitialId(t);
|
|
@@ -13029,7 +13141,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13029
13141
|
let t = Z.fromSignaling(e.externalId, e.deviceIdx);
|
|
13030
13142
|
r.externalId = t, this._api.cacheExternalId(r.id, t);
|
|
13031
13143
|
}
|
|
13032
|
-
r.state = X.ACCEPTED, r.mediaSettings = O(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction ===
|
|
13144
|
+
r.state = X.ACCEPTED, r.mediaSettings = O(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
|
|
13033
13145
|
let i = Object.keys(r.muteStates);
|
|
13034
13146
|
if (i.length && this._onMuteParticipant({
|
|
13035
13147
|
muteStates: r.muteStates,
|
|
@@ -13041,7 +13153,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13041
13153
|
this._reportMissingExternalIds([t], "ACCEPTED_CALL");
|
|
13042
13154
|
return;
|
|
13043
13155
|
}
|
|
13044
|
-
R.onAcceptedCall(r.externalId,
|
|
13156
|
+
R.onAcceptedCall(r.externalId, Za.parseCapabilities(e.capabilities), this.id);
|
|
13045
13157
|
}
|
|
13046
13158
|
}
|
|
13047
13159
|
async _onHungup(e) {
|
|
@@ -13078,7 +13190,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13078
13190
|
return;
|
|
13079
13191
|
}
|
|
13080
13192
|
if (e.connected) {
|
|
13081
|
-
let e =
|
|
13193
|
+
let e = Mo.fromTransportState(this._transport?.getState());
|
|
13082
13194
|
e && this._setTransportStatus(n, e);
|
|
13083
13195
|
}
|
|
13084
13196
|
this._setSessionState(n, { connected: e.connected });
|
|
@@ -13153,7 +13265,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13153
13265
|
isOnHold: !!r.onHold
|
|
13154
13266
|
}, i), n = this._getParticipant(t);
|
|
13155
13267
|
}
|
|
13156
|
-
this._conversation && this._conversation.direction ===
|
|
13268
|
+
this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = O(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], P.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), R.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
|
|
13157
13269
|
let i = Object.keys(n.muteStates);
|
|
13158
13270
|
i.length && this._onMuteParticipant({
|
|
13159
13271
|
muteStates: n.muteStates,
|
|
@@ -13344,15 +13456,15 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13344
13456
|
R.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
|
|
13345
13457
|
}
|
|
13346
13458
|
async _onRolesChanged(e, t) {
|
|
13347
|
-
if (this._conversation && this._isMe(e) && !
|
|
13459
|
+
if (this._conversation && this._isMe(e) && !Ao(this._conversation.roles, t)) {
|
|
13348
13460
|
this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, R.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
|
|
13349
|
-
mediaOptions:
|
|
13461
|
+
mediaOptions: Io(this._getMuteStatesForCurrentRoom(), To.MUTE_PERMANENT),
|
|
13350
13462
|
stateUpdated: !0
|
|
13351
|
-
}), M.includesOneOf(t, [
|
|
13463
|
+
}), M.includesOneOf(t, [ko.ADMIN, ko.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
|
|
13352
13464
|
return;
|
|
13353
13465
|
}
|
|
13354
13466
|
let n = this._getParticipant(e);
|
|
13355
|
-
n && !
|
|
13467
|
+
n && !Ao(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
|
|
13356
13468
|
}
|
|
13357
13469
|
async _onMuteParticipant(e, t = !1) {
|
|
13358
13470
|
if (!this._conversation) return;
|
|
@@ -13401,7 +13513,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13401
13513
|
let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
|
|
13402
13514
|
for (let [e, i] of d) {
|
|
13403
13515
|
let a = this._isCallAdmin() && n;
|
|
13404
|
-
if (!(i !==
|
|
13516
|
+
if (!(i !== To.MUTE && i !== To.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === To.MUTE_PERMANENT && !n && (l[e] = To.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
13405
13517
|
case b.VIDEO:
|
|
13406
13518
|
u.isVideoEnabled && (R.onDeviceSwitched(b.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
|
|
13407
13519
|
break;
|
|
@@ -13438,7 +13550,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13438
13550
|
this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
|
|
13439
13551
|
}
|
|
13440
13552
|
_onOptionsChanged(e) {
|
|
13441
|
-
this._conversation && !
|
|
13553
|
+
this._conversation && !Co(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(So.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(So.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
|
|
13442
13554
|
}
|
|
13443
13555
|
async _onNetworkStatus(e) {
|
|
13444
13556
|
if (this._conversation) {
|
|
@@ -13493,7 +13605,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13493
13605
|
}
|
|
13494
13606
|
_changeFeatureSet() {
|
|
13495
13607
|
if (this._conversation) {
|
|
13496
|
-
let e = this._state === "ACTIVE", t = this._conversation.features.includes(
|
|
13608
|
+
let e = this._state === "ACTIVE", t = this._conversation.features.includes(xo.ADD_PARTICIPANT);
|
|
13497
13609
|
R.onCallState(e, t, this._conversation, this.id);
|
|
13498
13610
|
}
|
|
13499
13611
|
}
|
|
@@ -13527,7 +13639,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13527
13639
|
let n = this._getParticipant(e);
|
|
13528
13640
|
if (n) {
|
|
13529
13641
|
if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
|
|
13530
|
-
let e =
|
|
13642
|
+
let e = Mo.fromTransportState(this._transport?.getState());
|
|
13531
13643
|
e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
|
|
13532
13644
|
let t = this._setTransportStatus(n, n.connectionStatus.transport);
|
|
13533
13645
|
this._emitParticipantTransition(n, t);
|
|
@@ -13537,7 +13649,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13537
13649
|
}
|
|
13538
13650
|
async _onTransportStateChanged(e, t) {
|
|
13539
13651
|
this._debug.debug(`Transport state has changed: ${t}`, e);
|
|
13540
|
-
let n =
|
|
13652
|
+
let n = Mo.fromTransportState(t);
|
|
13541
13653
|
if (!n) return;
|
|
13542
13654
|
let r = this._participants, i = [], a = e.reduce((e, n) => {
|
|
13543
13655
|
if (n in r) {
|
|
@@ -13616,7 +13728,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13616
13728
|
if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
|
|
13617
13729
|
this._conversation.topology = e;
|
|
13618
13730
|
for (let e of Object.values(this._participants)) {
|
|
13619
|
-
let t =
|
|
13731
|
+
let t = Mo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
13620
13732
|
this._emitParticipantTransition(e, t);
|
|
13621
13733
|
}
|
|
13622
13734
|
this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
|
|
@@ -13671,7 +13783,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13671
13783
|
].includes(t) ? null : this._setTransportStatus(e, t), n);
|
|
13672
13784
|
}
|
|
13673
13785
|
_setParticipantsStalled(e, t) {
|
|
13674
|
-
this._updateParticipantsStatus(e, (e) =>
|
|
13786
|
+
this._updateParticipantsStatus(e, (e) => Mo.setStalled(e.connectionStatus, t));
|
|
13675
13787
|
}
|
|
13676
13788
|
_updateParticipantsStatus(e, t, n = null) {
|
|
13677
13789
|
let r = e.reduce((e, n) => {
|
|
@@ -13690,7 +13802,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13690
13802
|
_onRoomsUpdated(e) {
|
|
13691
13803
|
if (this._isCalledState()) return;
|
|
13692
13804
|
let t = {}, n = [], r = [];
|
|
13693
|
-
for (let i of Object.keys(
|
|
13805
|
+
for (let i of Object.keys(Eo)) {
|
|
13694
13806
|
let a = e.updates[i];
|
|
13695
13807
|
a && (a?.rooms?.forEach((e) => {
|
|
13696
13808
|
let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
|
|
@@ -13705,7 +13817,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13705
13817
|
}
|
|
13706
13818
|
_onRoomUpdated(e) {
|
|
13707
13819
|
let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
|
|
13708
|
-
e.events.some((e) => e ===
|
|
13820
|
+
e.events.some((e) => e === Eo.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || (this._reportMissingExternalIds(n, "ROOM_UPDATED"), R.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id));
|
|
13709
13821
|
}
|
|
13710
13822
|
_convertRoomToExternal(e) {
|
|
13711
13823
|
if (!e) return {
|
|
@@ -13816,7 +13928,7 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13816
13928
|
n && r.push(n);
|
|
13817
13929
|
}
|
|
13818
13930
|
}
|
|
13819
|
-
r.length && !this._isCalledState() && R.onRoomsUpdated({ [
|
|
13931
|
+
r.length && !this._isCalledState() && R.onRoomsUpdated({ [Eo.UPDATE]: { rooms: r } }, this.id);
|
|
13820
13932
|
}
|
|
13821
13933
|
_onFeedback(e) {
|
|
13822
13934
|
let t = [];
|
|
@@ -13901,11 +14013,11 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13901
14013
|
_getParticipant(e) {
|
|
13902
14014
|
return this._participants[e];
|
|
13903
14015
|
}
|
|
13904
|
-
},
|
|
14016
|
+
}, Uc = class e extends Error {
|
|
13905
14017
|
constructor(t, n) {
|
|
13906
14018
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
13907
14019
|
}
|
|
13908
|
-
},
|
|
14020
|
+
}, Wc = class {
|
|
13909
14021
|
constructor() {
|
|
13910
14022
|
h(this, "_abortSignal", void 0), h(this, "_apiCallStats", null);
|
|
13911
14023
|
}
|
|
@@ -13952,14 +14064,14 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13952
14064
|
async getInbounds() {
|
|
13953
14065
|
return [];
|
|
13954
14066
|
}
|
|
13955
|
-
},
|
|
14067
|
+
}, Gc = class e {
|
|
13956
14068
|
constructor() {
|
|
13957
14069
|
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
13958
14070
|
}
|
|
13959
14071
|
static _normalizeType(e) {
|
|
13960
|
-
return e.type ===
|
|
14072
|
+
return e.type === No.GROUP ? {
|
|
13961
14073
|
...e,
|
|
13962
|
-
type:
|
|
14074
|
+
type: No.USER
|
|
13963
14075
|
} : e;
|
|
13964
14076
|
}
|
|
13965
14077
|
getExternalId(e) {
|
|
@@ -13987,27 +14099,27 @@ var Lc = 15, $ = class e extends Xe {
|
|
|
13987
14099
|
clear() {
|
|
13988
14100
|
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
13989
14101
|
}
|
|
13990
|
-
},
|
|
13991
|
-
function
|
|
14102
|
+
}, Kc = "anonymLogin:", qc = 700, Jc = 3e3;
|
|
14103
|
+
function Yc(e) {
|
|
13992
14104
|
let t = e.error_code;
|
|
13993
14105
|
switch (t) {
|
|
13994
|
-
case 2: return
|
|
13995
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
13996
|
-
case 300: return
|
|
13997
|
-
case 1101: return
|
|
13998
|
-
case 1102: return
|
|
13999
|
-
case 1103: return
|
|
14000
|
-
case 1104: return
|
|
14001
|
-
case 1106: return
|
|
14002
|
-
case 1113: return
|
|
14106
|
+
case 2: return Xc(p.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
14107
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? Xc(p.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Xc(y.API, t, "request-error");
|
|
14108
|
+
case 300: return Xc(p.NOT_FOUND, t, "not-found");
|
|
14109
|
+
case 1101: return Xc(p.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
14110
|
+
case 1102: return Xc(p.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
14111
|
+
case 1103: return Xc(p.NOT_FRIENDS, t, "friendship-required");
|
|
14112
|
+
case 1104: return Qc(t, "youla-api-error");
|
|
14113
|
+
case 1106: return Qc(t, "vk-api-error");
|
|
14114
|
+
case 1113: return Xc(p.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
14003
14115
|
case 1114: {
|
|
14004
14116
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
14005
|
-
return
|
|
14117
|
+
return Xc(r ? p.OBSOLETE_CLIENT : p.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
14006
14118
|
}
|
|
14007
|
-
default: return
|
|
14119
|
+
default: return Xc(y.API, t, "api-error");
|
|
14008
14120
|
}
|
|
14009
14121
|
}
|
|
14010
|
-
function
|
|
14122
|
+
function Xc(e, t, n, r) {
|
|
14011
14123
|
return {
|
|
14012
14124
|
type: e,
|
|
14013
14125
|
callError: {
|
|
@@ -14019,10 +14131,10 @@ function Gc(e, t, n, r) {
|
|
|
14019
14131
|
message: r
|
|
14020
14132
|
};
|
|
14021
14133
|
}
|
|
14022
|
-
function
|
|
14134
|
+
function Zc(e) {
|
|
14023
14135
|
return e?.error_code === void 0 ? e instanceof k && e.callError && "code" in e.callError ? String(e.callError.code) : e instanceof Error ? e.name : "network" : String(e.error_code);
|
|
14024
14136
|
}
|
|
14025
|
-
function
|
|
14137
|
+
function Qc(e, t) {
|
|
14026
14138
|
return {
|
|
14027
14139
|
type: p.EXTERNAL_API_ERROR,
|
|
14028
14140
|
callError: {
|
|
@@ -14033,21 +14145,21 @@ function qc(e, t) {
|
|
|
14033
14145
|
}
|
|
14034
14146
|
};
|
|
14035
14147
|
}
|
|
14036
|
-
var
|
|
14148
|
+
var $c = class extends Wc {
|
|
14037
14149
|
constructor() {
|
|
14038
|
-
super(), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
14150
|
+
super(), h(this, "_uuid", void 0), h(this, "_idCache", new Gc()), this._cacheSelfExternalId();
|
|
14039
14151
|
}
|
|
14040
14152
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
14041
14153
|
let r = async (i) => {
|
|
14042
14154
|
let a = performance.now();
|
|
14043
14155
|
try {
|
|
14044
|
-
let r = await
|
|
14156
|
+
let r = await Ms(e, t, n);
|
|
14045
14157
|
return this._apiCallStats?.log(e, performance.now() - a), r;
|
|
14046
14158
|
} catch (t) {
|
|
14047
|
-
if (this._apiCallStats?.log(e, performance.now() - a,
|
|
14159
|
+
if (this._apiCallStats?.log(e, performance.now() - a, Zc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
14048
14160
|
i++;
|
|
14049
14161
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
14050
|
-
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i *
|
|
14162
|
+
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * qc, Jc), { signal: this._abortSignal }), r(i);
|
|
14051
14163
|
}
|
|
14052
14164
|
throw z.warn(e, "error", t), t;
|
|
14053
14165
|
}
|
|
@@ -14059,13 +14171,13 @@ var Jc = class extends zc {
|
|
|
14059
14171
|
return await this._callUnsafe(e, t, n);
|
|
14060
14172
|
} catch (i) {
|
|
14061
14173
|
if (z.warn("Api call error", i), i instanceof k) throw i;
|
|
14062
|
-
if (
|
|
14174
|
+
if (ps(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
|
|
14063
14175
|
let a = {
|
|
14064
14176
|
message: i?.error_msg,
|
|
14065
14177
|
code: i?.error_code
|
|
14066
14178
|
};
|
|
14067
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
14068
|
-
let e =
|
|
14179
|
+
if (i.custom_error && (a.custom_error = i.custom_error), el(i)) {
|
|
14180
|
+
let e = Yc(i);
|
|
14069
14181
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
|
|
14070
14182
|
}
|
|
14071
14183
|
throw new k(y.API, a);
|
|
@@ -14095,7 +14207,7 @@ var Jc = class extends zc {
|
|
|
14095
14207
|
return this._anonymLogin(N.authToken).then((e) => {
|
|
14096
14208
|
this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
|
|
14097
14209
|
}).catch((e) => {
|
|
14098
|
-
throw e instanceof k ? e : (e?.error_code ===
|
|
14210
|
+
throw e instanceof k ? e : (e?.error_code === fs.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(y.AUTH, {
|
|
14099
14211
|
message: e?.error_msg,
|
|
14100
14212
|
code: e?.error_code,
|
|
14101
14213
|
callError: {
|
|
@@ -14117,22 +14229,22 @@ var Jc = class extends zc {
|
|
|
14117
14229
|
return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
|
|
14118
14230
|
}
|
|
14119
14231
|
_getAnonymLoginCacheKey() {
|
|
14120
|
-
return N.authToken ? `${
|
|
14232
|
+
return N.authToken ? `${Kc}${N.authToken}` : null;
|
|
14121
14233
|
}
|
|
14122
14234
|
_getCachedAnonymLogin() {
|
|
14123
14235
|
let e = this._getAnonymLoginCacheKey();
|
|
14124
14236
|
if (!e) return null;
|
|
14125
14237
|
let t = T.get(e);
|
|
14126
|
-
return
|
|
14238
|
+
return rl(t) ? t : (t && T.remove(e), null);
|
|
14127
14239
|
}
|
|
14128
14240
|
_setCachedAnonymLogin(e) {
|
|
14129
14241
|
let t = this._getAnonymLoginCacheKey();
|
|
14130
|
-
if (!t || !
|
|
14242
|
+
if (!t || !tl(e)) return;
|
|
14131
14243
|
let n = {
|
|
14132
14244
|
session_key: e.session_key,
|
|
14133
14245
|
session_secret_key: e.session_secret_key,
|
|
14134
14246
|
uid: e.uid,
|
|
14135
|
-
external_user_id:
|
|
14247
|
+
external_user_id: nl(e)
|
|
14136
14248
|
};
|
|
14137
14249
|
T.set(t, n);
|
|
14138
14250
|
}
|
|
@@ -14145,13 +14257,13 @@ var Jc = class extends zc {
|
|
|
14145
14257
|
}
|
|
14146
14258
|
_applyAnonymLogin(e) {
|
|
14147
14259
|
e.uid && (v.userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
|
|
14148
|
-
let t =
|
|
14260
|
+
let t = nl(e);
|
|
14149
14261
|
v.selfExternalId = e.uid && t !== null ? {
|
|
14150
14262
|
participantId: M.composeParticipantId(Number(e.uid), j.USER, 0),
|
|
14151
|
-
externalId: Z.fromId(t,
|
|
14152
|
-
} : null, this._cacheSelfExternalId(), N.statQueueEnabled && e.uid &&
|
|
14263
|
+
externalId: Z.fromId(t, No.USER, 0)
|
|
14264
|
+
} : null, this._cacheSelfExternalId(), N.statQueueEnabled && e.uid && Bs.remember(Number(e.uid), {
|
|
14153
14265
|
sessionKey: e.session_key,
|
|
14154
|
-
endpoint:
|
|
14266
|
+
endpoint: Bs.currentEndpoint()
|
|
14155
14267
|
});
|
|
14156
14268
|
}
|
|
14157
14269
|
_cacheSelfExternalId() {
|
|
@@ -14174,7 +14286,7 @@ var Jc = class extends zc {
|
|
|
14174
14286
|
});
|
|
14175
14287
|
}
|
|
14176
14288
|
async _sendClientStatsWith(e, t) {
|
|
14177
|
-
let n = await
|
|
14289
|
+
let n = await Ms("vchat.clientStats", {
|
|
14178
14290
|
...t,
|
|
14179
14291
|
session_key: e
|
|
14180
14292
|
}, !0);
|
|
@@ -14182,10 +14294,10 @@ var Jc = class extends zc {
|
|
|
14182
14294
|
}
|
|
14183
14295
|
async _sendClientStats(e, t, n = !0) {
|
|
14184
14296
|
try {
|
|
14185
|
-
let n = t ? await
|
|
14297
|
+
let n = t ? await Ns("vchat.clientStats", e) : await Ms("vchat.clientStats", e);
|
|
14186
14298
|
this._reportClientStatsItemErrors(n);
|
|
14187
14299
|
} catch (r) {
|
|
14188
|
-
if (!n || !
|
|
14300
|
+
if (!n || !ps(r?.error_code)) throw r;
|
|
14189
14301
|
await this._reauthorize(), await this._sendClientStats(e, t, !1);
|
|
14190
14302
|
}
|
|
14191
14303
|
}
|
|
@@ -14209,14 +14321,14 @@ var Jc = class extends zc {
|
|
|
14209
14321
|
}, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
|
|
14210
14322
|
o.append("file", s, "log.json");
|
|
14211
14323
|
let c = new URL(a.upload_url);
|
|
14212
|
-
return c.searchParams.append("size", s.size.toString()),
|
|
14324
|
+
return c.searchParams.append("size", s.size.toString()), Is(c.toString(), o);
|
|
14213
14325
|
}
|
|
14214
14326
|
async joinConversation(e, t = !1, n) {
|
|
14215
14327
|
let r = {
|
|
14216
14328
|
conversationId: e,
|
|
14217
14329
|
isVideo: t,
|
|
14218
14330
|
protocolVersion: N.protocolVersion,
|
|
14219
|
-
capabilities:
|
|
14331
|
+
capabilities: Za.getFlags()
|
|
14220
14332
|
};
|
|
14221
14333
|
return n && (r.chatId = n), this._call("vchat.joinConversation", r);
|
|
14222
14334
|
}
|
|
@@ -14248,13 +14360,13 @@ var Jc = class extends zc {
|
|
|
14248
14360
|
externalIds: l
|
|
14249
14361
|
});
|
|
14250
14362
|
if (t && t.length) switch (n) {
|
|
14251
|
-
case
|
|
14363
|
+
case yo.USER:
|
|
14252
14364
|
u.uids = t.join(",");
|
|
14253
14365
|
break;
|
|
14254
|
-
case
|
|
14366
|
+
case yo.GROUP:
|
|
14255
14367
|
u.gid = t[0];
|
|
14256
14368
|
break;
|
|
14257
|
-
case
|
|
14369
|
+
case yo.CHAT:
|
|
14258
14370
|
u.chatId = t[0];
|
|
14259
14371
|
break;
|
|
14260
14372
|
}
|
|
@@ -14297,7 +14409,7 @@ var Jc = class extends zc {
|
|
|
14297
14409
|
joinLink: e,
|
|
14298
14410
|
isVideo: t,
|
|
14299
14411
|
protocolVersion: N.protocolVersion,
|
|
14300
|
-
capabilities:
|
|
14412
|
+
capabilities: Za.getFlags()
|
|
14301
14413
|
};
|
|
14302
14414
|
return n?.length && (i.observedIds = n.join(",")), N.anonymToken && (i.anonymToken = N.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
|
|
14303
14415
|
}
|
|
@@ -14327,9 +14439,9 @@ var Jc = class extends zc {
|
|
|
14327
14439
|
return v.userId;
|
|
14328
14440
|
}
|
|
14329
14441
|
setUserId(e) {
|
|
14330
|
-
v.userId = e, N.statQueueEnabled && v.sessionKey &&
|
|
14442
|
+
v.userId = e, N.statQueueEnabled && v.sessionKey && Bs.remember(Number(e), {
|
|
14331
14443
|
sessionKey: v.sessionKey,
|
|
14332
|
-
endpoint:
|
|
14444
|
+
endpoint: Bs.currentEndpoint()
|
|
14333
14445
|
});
|
|
14334
14446
|
}
|
|
14335
14447
|
hangupConversation(e, t = p.HUNGUP, n) {
|
|
@@ -14337,7 +14449,7 @@ var Jc = class extends zc {
|
|
|
14337
14449
|
conversationId: e,
|
|
14338
14450
|
reason: t
|
|
14339
14451
|
};
|
|
14340
|
-
return N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId),
|
|
14452
|
+
return N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), js("vchat.hangupConversation", r);
|
|
14341
14453
|
}
|
|
14342
14454
|
async removeHistoryRecords(e) {
|
|
14343
14455
|
await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
|
|
@@ -14353,26 +14465,26 @@ var Jc = class extends zc {
|
|
|
14353
14465
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
14354
14466
|
}
|
|
14355
14467
|
};
|
|
14356
|
-
function
|
|
14468
|
+
function el(e) {
|
|
14357
14469
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
14358
14470
|
}
|
|
14359
|
-
function
|
|
14471
|
+
function tl(e) {
|
|
14360
14472
|
return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
|
|
14361
14473
|
}
|
|
14362
|
-
function
|
|
14474
|
+
function nl(e) {
|
|
14363
14475
|
let t = e?.external_user_id;
|
|
14364
14476
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
14365
14477
|
}
|
|
14366
|
-
function
|
|
14367
|
-
return
|
|
14478
|
+
function rl(e) {
|
|
14479
|
+
return tl(e) && "external_user_id" in e && (typeof e.external_user_id == "string" || e.external_user_id === null);
|
|
14368
14480
|
}
|
|
14369
14481
|
//#endregion
|
|
14370
14482
|
//#region src/enums/RecordRole.ts
|
|
14371
|
-
var
|
|
14483
|
+
var il = /* @__PURE__ */ function(e) {
|
|
14372
14484
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
14373
|
-
}(
|
|
14485
|
+
}(il || {}), al = /* @__PURE__ */ function(e) {
|
|
14374
14486
|
return e.OFF = "0", e.ON = "1", e;
|
|
14375
|
-
}({}),
|
|
14487
|
+
}({}), ol = class {
|
|
14376
14488
|
constructor(e) {
|
|
14377
14489
|
h(this, "_queue", void 0), h(this, "_readCursor", void 0), h(this, "_writeCursor", void 0), h(this, "_moveReadCursor", void 0), h(this, "_left", void 0), this._queue = Array(e).fill(null), this._readCursor = this._writeCursor = this._left = 0, this._moveReadCursor = !1;
|
|
14378
14490
|
}
|
|
@@ -14395,12 +14507,12 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14395
14507
|
let e = this._queue[this._readCursor];
|
|
14396
14508
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
14397
14509
|
}
|
|
14398
|
-
},
|
|
14510
|
+
}, sl = class {
|
|
14399
14511
|
constructor(e, t, n, r = null) {
|
|
14400
14512
|
h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
|
|
14401
14513
|
}
|
|
14402
14514
|
async authorize() {
|
|
14403
|
-
let e = await
|
|
14515
|
+
let e = await Ms("auth.anonymLogin", {
|
|
14404
14516
|
session_data: {
|
|
14405
14517
|
device_id: this._uuid,
|
|
14406
14518
|
client_version: N.apiClientVersion,
|
|
@@ -14409,7 +14521,7 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14409
14521
|
version: 3
|
|
14410
14522
|
},
|
|
14411
14523
|
application_key: this._apiKey
|
|
14412
|
-
}, !0, await
|
|
14524
|
+
}, !0, await ks(this._baseApiUrl, this._apiEnv));
|
|
14413
14525
|
return M.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
|
|
14414
14526
|
}
|
|
14415
14527
|
async hangupConversation(e, t) {
|
|
@@ -14419,9 +14531,9 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14419
14531
|
application_key: this._apiKey,
|
|
14420
14532
|
session_key: this._sessionKey
|
|
14421
14533
|
};
|
|
14422
|
-
t?.peerId && (n.peerId = t.peerId), await
|
|
14534
|
+
t?.peerId && (n.peerId = t.peerId), await Ms("vchat.hangupConversation", n, !0, await ks(this._baseApiUrl, this._apiEnv));
|
|
14423
14535
|
}
|
|
14424
|
-
},
|
|
14536
|
+
}, cl, ll = null, ul = !1, dl = {
|
|
14425
14537
|
getCameras: D.getCameras,
|
|
14426
14538
|
getMicrophones: D.getMicrophones,
|
|
14427
14539
|
getOutput: D.getOutput,
|
|
@@ -14452,27 +14564,27 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14452
14564
|
baseChromeVersion: C.baseChromeVersion,
|
|
14453
14565
|
getAudioContext: D.getAudioContext,
|
|
14454
14566
|
isAudioShareSupported: C.isAudioShareSupported
|
|
14455
|
-
},
|
|
14456
|
-
function
|
|
14457
|
-
|
|
14567
|
+
}, fl = { participantMarkerCompare: M.participantMarkerCompare };
|
|
14568
|
+
function pl(e) {
|
|
14569
|
+
ll = e;
|
|
14458
14570
|
}
|
|
14459
|
-
function
|
|
14571
|
+
function ml(e) {
|
|
14460
14572
|
N.videoEffects = e;
|
|
14461
14573
|
}
|
|
14462
|
-
function
|
|
14574
|
+
function hl(e) {
|
|
14463
14575
|
N.audioEffects = e;
|
|
14464
14576
|
}
|
|
14465
|
-
function
|
|
14577
|
+
function gl(e, t = {}) {
|
|
14466
14578
|
N.vad = e, N.vadOptions = t;
|
|
14467
14579
|
}
|
|
14468
|
-
function
|
|
14580
|
+
function _l(e, t = null, n = {}, r = 1) {
|
|
14469
14581
|
N.vmoji = e, N.vmojiOptions = {
|
|
14470
14582
|
protocolVersion: r,
|
|
14471
14583
|
renderingOptions: n
|
|
14472
14584
|
}, t && e.setSDK(t);
|
|
14473
14585
|
}
|
|
14474
|
-
async function
|
|
14475
|
-
N.set(t),
|
|
14586
|
+
async function vl(t) {
|
|
14587
|
+
N.set(t), cl || (cl = new $c()), N.statQueueEnabled && (qs.setApi(cl), N.autoStartStats && Tl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await D.init();
|
|
14476
14588
|
let n = C.getBrowserSupportFailure();
|
|
14477
14589
|
if (n) throw new k(y.UNSUPPORTED, { callError: {
|
|
14478
14590
|
scope: "internal",
|
|
@@ -14481,19 +14593,19 @@ async function pl(t) {
|
|
|
14481
14593
|
} });
|
|
14482
14594
|
z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${D.hasCameraPermission()}, Mic: ${D.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
|
|
14483
14595
|
}
|
|
14484
|
-
async function
|
|
14596
|
+
async function yl(e, t = [b.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
14485
14597
|
let c = [];
|
|
14486
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
14598
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), xl([], yo.USER, t, n, r, i, a, c, o, s);
|
|
14487
14599
|
}
|
|
14488
|
-
function
|
|
14600
|
+
function bl(e, t = []) {
|
|
14489
14601
|
let n = e.getIncomingCallerExternalId();
|
|
14490
14602
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
14491
14603
|
}
|
|
14492
|
-
async function
|
|
14604
|
+
async function xl(e, t = yo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
14493
14605
|
if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(p.HAS_ACTIVE_CALL);
|
|
14494
14606
|
let u = B.getAll().find((e) => e.isIncomingRinging);
|
|
14495
|
-
if (!N.hold && u && !
|
|
14496
|
-
return new $(new
|
|
14607
|
+
if (!N.hold && u && !bl(u, s)) throw z.error("There is already incoming call"), new k(p.HAS_ACTIVE_CALL);
|
|
14608
|
+
return new $(new $c(), ll).onStart({
|
|
14497
14609
|
opponentIds: e,
|
|
14498
14610
|
opponentType: t,
|
|
14499
14611
|
mediaOptions: n,
|
|
@@ -14506,49 +14618,49 @@ async function gl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
14506
14618
|
conversationId: l
|
|
14507
14619
|
});
|
|
14508
14620
|
}
|
|
14509
|
-
async function
|
|
14510
|
-
return
|
|
14621
|
+
async function Sl(e, t) {
|
|
14622
|
+
return Cl(e, j.USER, void 0, t);
|
|
14511
14623
|
}
|
|
14512
|
-
async function
|
|
14624
|
+
async function Cl(e, t = j.USER, n, r, i, a) {
|
|
14513
14625
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
14514
|
-
return new $(new
|
|
14626
|
+
return new $(new $c(), ll).onPush(e, t, n, r, i, a);
|
|
14515
14627
|
}
|
|
14516
|
-
async function
|
|
14517
|
-
return
|
|
14628
|
+
async function wl() {
|
|
14629
|
+
return cl.getInbounds();
|
|
14518
14630
|
}
|
|
14519
|
-
function
|
|
14631
|
+
function Tl() {
|
|
14520
14632
|
if (N.statQueueEnabled) {
|
|
14521
|
-
if (!
|
|
14633
|
+
if (!cl) {
|
|
14522
14634
|
z.error("[CallsSDK] startStats() called before init()");
|
|
14523
14635
|
return;
|
|
14524
14636
|
}
|
|
14525
|
-
|
|
14637
|
+
ul || (ul = !0, nc.start(cl));
|
|
14526
14638
|
}
|
|
14527
14639
|
}
|
|
14528
|
-
async function
|
|
14529
|
-
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t,
|
|
14640
|
+
async function El(e, t) {
|
|
14641
|
+
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Ds()), cl.authorize();
|
|
14530
14642
|
}
|
|
14531
|
-
async function
|
|
14532
|
-
return
|
|
14643
|
+
async function Dl(e = [b.AUDIO], t) {
|
|
14644
|
+
return Qu(t).accept(e);
|
|
14533
14645
|
}
|
|
14534
|
-
async function
|
|
14535
|
-
let t =
|
|
14646
|
+
async function Ol(e) {
|
|
14647
|
+
let t = Yu(e?.conversationId);
|
|
14536
14648
|
if (t) return t.decline(e);
|
|
14537
14649
|
}
|
|
14538
|
-
async function
|
|
14539
|
-
return
|
|
14650
|
+
async function kl(e, t = [b.AUDIO]) {
|
|
14651
|
+
return Al(e, t);
|
|
14540
14652
|
}
|
|
14541
|
-
async function
|
|
14653
|
+
async function Al(e, t, n) {
|
|
14542
14654
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(p.HAS_ACTIVE_CALL);
|
|
14543
|
-
return new $(new
|
|
14655
|
+
return new $(new $c(), ll).onJoin({
|
|
14544
14656
|
conversationId: e,
|
|
14545
14657
|
mediaOptions: t,
|
|
14546
14658
|
chatId: n
|
|
14547
14659
|
});
|
|
14548
14660
|
}
|
|
14549
|
-
async function
|
|
14661
|
+
async function jl(e, t = [b.AUDIO], n, r, i, a) {
|
|
14550
14662
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(p.HAS_ACTIVE_CALL);
|
|
14551
|
-
return n && (N.anonymToken = n), new $(new
|
|
14663
|
+
return n && (N.anonymToken = n), new $(new $c(), ll).onJoin({
|
|
14552
14664
|
joinLink: e,
|
|
14553
14665
|
mediaOptions: t,
|
|
14554
14666
|
observedIds: r,
|
|
@@ -14557,30 +14669,30 @@ async function El(e, t = [b.AUDIO], n, r, i, a) {
|
|
|
14557
14669
|
anonymous: !!N.anonymToken
|
|
14558
14670
|
});
|
|
14559
14671
|
}
|
|
14560
|
-
function
|
|
14672
|
+
function Ml(e) {
|
|
14561
14673
|
let t = B.getLocal(e?.conversationId);
|
|
14562
14674
|
return t ? t.hangup(e) : B.getHangup(e?.conversationId) ?? Promise.resolve();
|
|
14563
14675
|
}
|
|
14564
|
-
async function
|
|
14676
|
+
async function Nl(e, t) {
|
|
14565
14677
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
14566
14678
|
if (r) return r.addParticipant(n, t);
|
|
14567
14679
|
}
|
|
14568
|
-
async function
|
|
14680
|
+
async function Pl(e, t) {
|
|
14569
14681
|
let n = $.current();
|
|
14570
14682
|
if (n) {
|
|
14571
14683
|
let r = e.map((e) => M.composeUserId(e));
|
|
14572
14684
|
await n.addParticipantLegacy(r, t);
|
|
14573
14685
|
}
|
|
14574
14686
|
}
|
|
14575
|
-
async function
|
|
14576
|
-
let n =
|
|
14687
|
+
async function Fl(e, t = !1) {
|
|
14688
|
+
let n = $u(e, "removeParticipant");
|
|
14577
14689
|
if (n) try {
|
|
14578
14690
|
await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
14579
14691
|
} catch (e) {
|
|
14580
14692
|
z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
14581
14693
|
}
|
|
14582
14694
|
}
|
|
14583
|
-
async function
|
|
14695
|
+
async function Il(e, t = !1) {
|
|
14584
14696
|
let n = $.current();
|
|
14585
14697
|
if (n) try {
|
|
14586
14698
|
await n.removeParticipant(M.composeUserId(e), t);
|
|
@@ -14588,13 +14700,13 @@ async function jl(e, t = !1) {
|
|
|
14588
14700
|
z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
14589
14701
|
}
|
|
14590
14702
|
}
|
|
14591
|
-
async function
|
|
14703
|
+
async function Ll(e, t) {
|
|
14592
14704
|
let n = $.current();
|
|
14593
14705
|
if (e === "videoinput" && Lt.contains(t)) return N.videoFacingMode = t, n ? (C.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
14594
14706
|
if (!await D._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
14595
14707
|
if (n) return n.changeDevice(e);
|
|
14596
14708
|
}
|
|
14597
|
-
async function
|
|
14709
|
+
async function Rl(e, t) {
|
|
14598
14710
|
let n = typeof e == "object" ? {
|
|
14599
14711
|
...e,
|
|
14600
14712
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -14606,37 +14718,37 @@ async function Nl(e, t) {
|
|
|
14606
14718
|
}, r = B.getLocal(t);
|
|
14607
14719
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
14608
14720
|
}
|
|
14609
|
-
function
|
|
14721
|
+
function zl(e) {
|
|
14610
14722
|
let t = $.current();
|
|
14611
14723
|
t && t.toggleAnimojiCapturing(e);
|
|
14612
14724
|
}
|
|
14613
|
-
async function
|
|
14725
|
+
async function Bl(e, t = !1) {
|
|
14614
14726
|
let n = $.current();
|
|
14615
14727
|
n && await n.setVideoStream(e, t);
|
|
14616
14728
|
}
|
|
14617
|
-
async function
|
|
14729
|
+
async function Vl(e, t) {
|
|
14618
14730
|
let n = B.getLocal(t);
|
|
14619
14731
|
n && await n.toggleLocalVideo(e);
|
|
14620
14732
|
}
|
|
14621
|
-
async function
|
|
14733
|
+
async function Hl(e, t) {
|
|
14622
14734
|
let n = B.getLocal(t);
|
|
14623
14735
|
n && await n.toggleLocalAudio(e);
|
|
14624
14736
|
}
|
|
14625
|
-
async function
|
|
14737
|
+
async function Ul(e) {
|
|
14626
14738
|
let t = $.current();
|
|
14627
14739
|
if (t) return t.setLocalResolution(e);
|
|
14628
14740
|
}
|
|
14629
|
-
async function
|
|
14741
|
+
async function Wl(e) {
|
|
14630
14742
|
let t = $.current();
|
|
14631
14743
|
t && await t.changePriorities(e);
|
|
14632
14744
|
}
|
|
14633
|
-
async function
|
|
14745
|
+
async function Gl(e, t) {
|
|
14634
14746
|
let n = $.current();
|
|
14635
14747
|
if (n) {
|
|
14636
14748
|
if (t) {
|
|
14637
14749
|
let r = n.getCachedParticipantIdByExternalId(t);
|
|
14638
14750
|
if (!r) {
|
|
14639
|
-
|
|
14751
|
+
Xu(t, "changeParticipantState", n);
|
|
14640
14752
|
return;
|
|
14641
14753
|
}
|
|
14642
14754
|
let { compositeUserId: i } = M.decomposeParticipantId(r);
|
|
@@ -14646,161 +14758,161 @@ async function Bl(e, t) {
|
|
|
14646
14758
|
await n.changeParticipantState(e);
|
|
14647
14759
|
}
|
|
14648
14760
|
}
|
|
14649
|
-
async function
|
|
14761
|
+
async function Kl() {
|
|
14650
14762
|
let e = $.current();
|
|
14651
14763
|
e && await e.putHandsDown();
|
|
14652
14764
|
}
|
|
14653
|
-
async function
|
|
14765
|
+
async function ql(e) {
|
|
14654
14766
|
let t = $.current();
|
|
14655
14767
|
t && await t.updateDisplayLayout(e);
|
|
14656
14768
|
}
|
|
14657
|
-
async function
|
|
14769
|
+
async function Jl(e) {
|
|
14658
14770
|
let t = $.current();
|
|
14659
14771
|
t && await t.requestDisplayLayout(e);
|
|
14660
14772
|
}
|
|
14661
|
-
async function
|
|
14662
|
-
let r =
|
|
14773
|
+
async function Yl(e, t, n = !1) {
|
|
14774
|
+
let r = $u(e, "grantRoles");
|
|
14663
14775
|
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
14664
14776
|
}
|
|
14665
|
-
async function
|
|
14777
|
+
async function Xl(e, t, n, r = !1) {
|
|
14666
14778
|
let i = $.current();
|
|
14667
14779
|
i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
|
|
14668
14780
|
}
|
|
14669
|
-
async function
|
|
14781
|
+
async function Zl({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
14670
14782
|
if (e) {
|
|
14671
|
-
let i =
|
|
14783
|
+
let i = $u(e, "muteParticipant");
|
|
14672
14784
|
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
14673
14785
|
}
|
|
14674
14786
|
let i = $.current();
|
|
14675
14787
|
i && await i.muteParticipant(null, t, n, r);
|
|
14676
14788
|
}
|
|
14677
|
-
async function
|
|
14789
|
+
async function Ql({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
14678
14790
|
let a = $.current();
|
|
14679
14791
|
if (a) {
|
|
14680
14792
|
let o = e ? M.composeParticipantId(e, j.USER, r) : null;
|
|
14681
14793
|
await a.muteParticipant(o, t, n, i);
|
|
14682
14794
|
}
|
|
14683
14795
|
}
|
|
14684
|
-
async function
|
|
14685
|
-
let r =
|
|
14796
|
+
async function $l(e, t = !1, n = null) {
|
|
14797
|
+
let r = $u(e, "pinParticipant");
|
|
14686
14798
|
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
14687
14799
|
}
|
|
14688
|
-
async function
|
|
14800
|
+
async function eu(e, t = !1, n = 0, r = null) {
|
|
14689
14801
|
let i = $.current();
|
|
14690
14802
|
i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
|
|
14691
14803
|
}
|
|
14692
|
-
async function
|
|
14804
|
+
async function tu(e) {
|
|
14693
14805
|
let t = $.current();
|
|
14694
14806
|
t && await t.updateMediaModifiers(e);
|
|
14695
14807
|
}
|
|
14696
|
-
async function
|
|
14808
|
+
async function nu(e) {
|
|
14697
14809
|
let t = $.current();
|
|
14698
14810
|
t && await t.enableVideoSuspend(e);
|
|
14699
14811
|
}
|
|
14700
|
-
async function
|
|
14812
|
+
async function ru(e) {
|
|
14701
14813
|
let t = $.current();
|
|
14702
14814
|
t && await t.enableVideoSuspendSuggest(e);
|
|
14703
14815
|
}
|
|
14704
|
-
async function
|
|
14816
|
+
async function iu(e) {
|
|
14705
14817
|
let t = $.current();
|
|
14706
14818
|
t && await t.changeOptions(e);
|
|
14707
14819
|
}
|
|
14708
|
-
async function
|
|
14820
|
+
async function au(e, t = null) {
|
|
14709
14821
|
if (t) {
|
|
14710
|
-
let n =
|
|
14822
|
+
let n = $u(t, "chatMessage");
|
|
14711
14823
|
return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
14712
14824
|
}
|
|
14713
14825
|
let n = $.current();
|
|
14714
14826
|
n && await n.chatMessage(e, null);
|
|
14715
14827
|
}
|
|
14716
|
-
async function
|
|
14828
|
+
async function ou(e, t = null) {
|
|
14717
14829
|
let n = $.current();
|
|
14718
14830
|
if (n) {
|
|
14719
14831
|
let r = t ? M.composeUserId(t) : null;
|
|
14720
14832
|
await n.chatMessage(e, r);
|
|
14721
14833
|
}
|
|
14722
14834
|
}
|
|
14723
|
-
async function
|
|
14835
|
+
async function su(e = 10) {
|
|
14724
14836
|
let t = $.current();
|
|
14725
14837
|
if (t) return t.chatHistory(e);
|
|
14726
14838
|
}
|
|
14727
|
-
async function
|
|
14839
|
+
async function cu(e, t = null) {
|
|
14728
14840
|
if (t) {
|
|
14729
|
-
let n =
|
|
14841
|
+
let n = $u(t, "customData");
|
|
14730
14842
|
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
14731
14843
|
}
|
|
14732
14844
|
let n = $.current();
|
|
14733
14845
|
n && await n.customData(e, null);
|
|
14734
14846
|
}
|
|
14735
|
-
async function
|
|
14847
|
+
async function lu(e, t = null, n = 0) {
|
|
14736
14848
|
let r = $.current();
|
|
14737
14849
|
if (r) {
|
|
14738
14850
|
let i = t ? M.composeParticipantId(t, j.USER, n) : null;
|
|
14739
14851
|
await r.customData(e, i);
|
|
14740
14852
|
}
|
|
14741
14853
|
}
|
|
14742
|
-
async function
|
|
14743
|
-
return (await
|
|
14854
|
+
async function uu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
14855
|
+
return (await cl.createConversation(a ?? M.uuid(), e, t, {
|
|
14744
14856
|
onlyAdminCanShareMovie: n,
|
|
14745
14857
|
waitForAdmin: r,
|
|
14746
14858
|
closedConversation: i
|
|
14747
14859
|
})).join_link;
|
|
14748
14860
|
}
|
|
14749
|
-
async function
|
|
14861
|
+
async function du(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
14750
14862
|
let a = i.map((e) => Z.fromId(e));
|
|
14751
|
-
return (await
|
|
14863
|
+
return (await cl.createConversation(M.uuid(), e, t, {
|
|
14752
14864
|
onlyAdminCanShareMovie: n,
|
|
14753
14865
|
audienceMode: !0,
|
|
14754
14866
|
audioOnly: r
|
|
14755
14867
|
}, a)).join_link;
|
|
14756
14868
|
}
|
|
14757
|
-
async function
|
|
14869
|
+
async function fu() {
|
|
14758
14870
|
let e = $.current();
|
|
14759
14871
|
return e ? e.createJoinLink() : Promise.reject();
|
|
14760
14872
|
}
|
|
14761
|
-
async function
|
|
14873
|
+
async function pu() {
|
|
14762
14874
|
let e = $.current();
|
|
14763
14875
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
14764
14876
|
}
|
|
14765
|
-
async function
|
|
14766
|
-
return
|
|
14877
|
+
async function mu(e, t) {
|
|
14878
|
+
return cl.getAnonymTokenByLink(e, t);
|
|
14767
14879
|
}
|
|
14768
|
-
function
|
|
14880
|
+
function hu(e) {
|
|
14769
14881
|
let t = $.current();
|
|
14770
14882
|
t && t.setVolume(e);
|
|
14771
14883
|
}
|
|
14772
|
-
function
|
|
14884
|
+
function gu(e) {
|
|
14773
14885
|
N.forceRelayPolicy = e;
|
|
14774
14886
|
}
|
|
14775
|
-
async function
|
|
14887
|
+
async function _u(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
14776
14888
|
let o = $.current();
|
|
14777
14889
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
14778
14890
|
}
|
|
14779
|
-
async function
|
|
14891
|
+
async function vu(e = null, t) {
|
|
14780
14892
|
let n = $.current();
|
|
14781
14893
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
14782
14894
|
}
|
|
14783
|
-
async function
|
|
14895
|
+
async function yu(e = null) {
|
|
14784
14896
|
let t = $.current();
|
|
14785
14897
|
return t ? t.publishStream(e) : Promise.reject();
|
|
14786
14898
|
}
|
|
14787
|
-
async function
|
|
14899
|
+
async function bu() {
|
|
14788
14900
|
let e = $.current();
|
|
14789
14901
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
14790
14902
|
}
|
|
14791
|
-
async function
|
|
14903
|
+
async function xu(e) {
|
|
14792
14904
|
let t = $.current();
|
|
14793
14905
|
return t ? t.addMovie(e) : Promise.reject();
|
|
14794
14906
|
}
|
|
14795
|
-
async function
|
|
14907
|
+
async function Su(e) {
|
|
14796
14908
|
let t = $.current();
|
|
14797
14909
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
14798
14910
|
}
|
|
14799
|
-
async function
|
|
14911
|
+
async function Cu(e) {
|
|
14800
14912
|
let t = $.current();
|
|
14801
14913
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
14802
14914
|
}
|
|
14803
|
-
async function
|
|
14915
|
+
async function wu(e, t) {
|
|
14804
14916
|
let n = $.current();
|
|
14805
14917
|
if (n) {
|
|
14806
14918
|
let r = [], i = [];
|
|
@@ -14822,46 +14934,46 @@ async function yu(e, t) {
|
|
|
14822
14934
|
});
|
|
14823
14935
|
}
|
|
14824
14936
|
if (i.length) {
|
|
14825
|
-
|
|
14937
|
+
Zu(i, "updateRooms", n);
|
|
14826
14938
|
return;
|
|
14827
14939
|
}
|
|
14828
14940
|
return n.updateRooms(r, t);
|
|
14829
14941
|
}
|
|
14830
14942
|
return Promise.reject();
|
|
14831
14943
|
}
|
|
14832
|
-
async function
|
|
14944
|
+
async function Tu(e, t) {
|
|
14833
14945
|
let n = $.current();
|
|
14834
14946
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
14835
14947
|
}
|
|
14836
|
-
async function
|
|
14948
|
+
async function Eu(e = null, t = null) {
|
|
14837
14949
|
let n = $.current();
|
|
14838
14950
|
if (!n) return Promise.reject();
|
|
14839
14951
|
let r;
|
|
14840
14952
|
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
14841
|
-
|
|
14953
|
+
Xu(t, "switchRoom", n);
|
|
14842
14954
|
return;
|
|
14843
14955
|
}
|
|
14844
14956
|
return n.switchRoom(e, r);
|
|
14845
14957
|
}
|
|
14846
|
-
async function
|
|
14958
|
+
async function Du(e) {
|
|
14847
14959
|
let t = $.current();
|
|
14848
14960
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
14849
14961
|
}
|
|
14850
|
-
function
|
|
14962
|
+
function Ou(e) {
|
|
14851
14963
|
N.statisticsInterval = e;
|
|
14852
14964
|
let t = $.current();
|
|
14853
14965
|
if (t) return t.updateStatisticsInterval();
|
|
14854
14966
|
}
|
|
14855
|
-
function
|
|
14967
|
+
function ku(t) {
|
|
14856
14968
|
e.disableLog(!t), z.toggle(t);
|
|
14857
14969
|
}
|
|
14858
|
-
function
|
|
14970
|
+
function Au(e, ...t) {
|
|
14859
14971
|
N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
|
|
14860
14972
|
}
|
|
14861
|
-
function
|
|
14973
|
+
function ju(e, t, ...n) {
|
|
14862
14974
|
N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
|
|
14863
14975
|
}
|
|
14864
|
-
var
|
|
14976
|
+
var Mu = {
|
|
14865
14977
|
list: Fe,
|
|
14866
14978
|
get: Ie,
|
|
14867
14979
|
getJson: Le,
|
|
@@ -14869,7 +14981,7 @@ var Du = {
|
|
|
14869
14981
|
clear: ze,
|
|
14870
14982
|
stats: Be
|
|
14871
14983
|
};
|
|
14872
|
-
function
|
|
14984
|
+
function Nu() {
|
|
14873
14985
|
let e = [
|
|
14874
14986
|
[`Calls SDK ${N.sdkVersion}`, N.toJSON()],
|
|
14875
14987
|
["UserAgent:", navigator.userAgent],
|
|
@@ -14887,139 +14999,139 @@ function Ou() {
|
|
|
14887
14999
|
d: e
|
|
14888
15000
|
}));
|
|
14889
15001
|
}
|
|
14890
|
-
async function
|
|
15002
|
+
async function Pu() {
|
|
14891
15003
|
let e = $.id(), t = $.debugSessionId();
|
|
14892
15004
|
if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
14893
15005
|
let n = await Ie({ sessionId: t });
|
|
14894
15006
|
if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
14895
15007
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
14896
15008
|
try {
|
|
14897
|
-
return
|
|
15009
|
+
return cl?.uploadDebugLogs(e, r, i, JSON.stringify([...Nu(), ...n]));
|
|
14898
15010
|
} catch (e) {
|
|
14899
15011
|
throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
14900
15012
|
}
|
|
14901
15013
|
}
|
|
14902
|
-
async function
|
|
15014
|
+
async function Fu(e) {
|
|
14903
15015
|
let t = $.current();
|
|
14904
15016
|
if (t) return t.videoEffect(e);
|
|
14905
15017
|
}
|
|
14906
|
-
async function
|
|
15018
|
+
async function Iu(e, t) {
|
|
14907
15019
|
let n = $.current();
|
|
14908
15020
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
14909
15021
|
}
|
|
14910
|
-
async function
|
|
15022
|
+
async function Lu(e) {
|
|
14911
15023
|
let t = $.current();
|
|
14912
15024
|
t && await t.setAudioStream(e);
|
|
14913
15025
|
}
|
|
14914
|
-
async function
|
|
15026
|
+
async function Ru(e, t = null, n = null) {
|
|
14915
15027
|
let r = $.current();
|
|
14916
15028
|
if (!r) return;
|
|
14917
15029
|
let i = n ?? t?.id, a = null;
|
|
14918
15030
|
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
14919
|
-
|
|
15031
|
+
Xu(t, "setVmojiSvg", r);
|
|
14920
15032
|
return;
|
|
14921
15033
|
}
|
|
14922
15034
|
r.setAnimojiSvg(e, a, i);
|
|
14923
15035
|
}
|
|
14924
|
-
function
|
|
15036
|
+
function zu(e) {
|
|
14925
15037
|
let t = $.current();
|
|
14926
15038
|
t && t.setAnimojiFill(e);
|
|
14927
15039
|
}
|
|
14928
|
-
async function
|
|
14929
|
-
return
|
|
15040
|
+
async function Bu(e = null, t, n = !1) {
|
|
15041
|
+
return Qu().getWaitingHall(e, t, n);
|
|
14930
15042
|
}
|
|
14931
|
-
async function
|
|
14932
|
-
return
|
|
15043
|
+
async function Vu() {
|
|
15044
|
+
return Qu().getAudienceModeHands();
|
|
14933
15045
|
}
|
|
14934
|
-
async function
|
|
14935
|
-
let n =
|
|
15046
|
+
async function Hu(e, t = !1) {
|
|
15047
|
+
let n = Qu(), r;
|
|
14936
15048
|
if (e) {
|
|
14937
15049
|
let t = n.getCachedParticipantIdByExternalId(e);
|
|
14938
15050
|
if (!t) {
|
|
14939
|
-
|
|
15051
|
+
Xu(e, "promoteParticipant", n);
|
|
14940
15052
|
return;
|
|
14941
15053
|
}
|
|
14942
15054
|
r = M.decomposeParticipantId(t).compositeUserId;
|
|
14943
15055
|
}
|
|
14944
15056
|
return n.promoteParticipant(r, t);
|
|
14945
15057
|
}
|
|
14946
|
-
async function
|
|
14947
|
-
return
|
|
15058
|
+
async function Uu(e = !1) {
|
|
15059
|
+
return Qu().requestPromotion(e);
|
|
14948
15060
|
}
|
|
14949
|
-
async function
|
|
14950
|
-
return
|
|
15061
|
+
async function Wu(e = !1) {
|
|
15062
|
+
return Qu().acceptPromotion(e);
|
|
14951
15063
|
}
|
|
14952
|
-
async function
|
|
14953
|
-
return
|
|
15064
|
+
async function Gu(e) {
|
|
15065
|
+
return Qu().getParticipantListChunk(e);
|
|
14954
15066
|
}
|
|
14955
|
-
async function
|
|
14956
|
-
return
|
|
15067
|
+
async function Ku(e) {
|
|
15068
|
+
return Qu().getParticipants(e);
|
|
14957
15069
|
}
|
|
14958
|
-
async function
|
|
14959
|
-
return
|
|
15070
|
+
async function qu(e) {
|
|
15071
|
+
return Qu().feedback(e);
|
|
14960
15072
|
}
|
|
14961
|
-
async function
|
|
14962
|
-
return
|
|
15073
|
+
async function Ju(e, t, n) {
|
|
15074
|
+
return Qu(n).enableFeatureForRoles(e, t);
|
|
14963
15075
|
}
|
|
14964
|
-
function
|
|
15076
|
+
function Yu(e) {
|
|
14965
15077
|
return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
|
|
14966
15078
|
}
|
|
14967
|
-
function
|
|
15079
|
+
function Xu(e, t, n) {
|
|
14968
15080
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
14969
15081
|
}
|
|
14970
|
-
function
|
|
15082
|
+
function Zu(e, t, n) {
|
|
14971
15083
|
let r = Array.from(new Set(e));
|
|
14972
15084
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
14973
15085
|
}
|
|
14974
|
-
function
|
|
14975
|
-
let t =
|
|
15086
|
+
function Qu(e) {
|
|
15087
|
+
let t = Yu(e);
|
|
14976
15088
|
if (!t) throw Error("Conversation not found");
|
|
14977
15089
|
return t;
|
|
14978
15090
|
}
|
|
14979
|
-
function
|
|
15091
|
+
function $u(e, t) {
|
|
14980
15092
|
let n = $.current();
|
|
14981
15093
|
if (!n) return null;
|
|
14982
15094
|
let r = n.getCachedParticipantIdByExternalId(e);
|
|
14983
15095
|
return r ? {
|
|
14984
15096
|
conversation: n,
|
|
14985
15097
|
participantId: r
|
|
14986
|
-
} : (
|
|
15098
|
+
} : (Xu(e, t, n), null);
|
|
14987
15099
|
}
|
|
14988
|
-
async function
|
|
14989
|
-
await
|
|
15100
|
+
async function ed(e) {
|
|
15101
|
+
await cl.removeHistoryRecords(e);
|
|
14990
15102
|
}
|
|
14991
|
-
async function
|
|
15103
|
+
async function td(e) {
|
|
14992
15104
|
let t = $.current() ?? B.getFirst();
|
|
14993
15105
|
t && await t.startAsr(e);
|
|
14994
15106
|
}
|
|
14995
|
-
async function
|
|
15107
|
+
async function nd(e) {
|
|
14996
15108
|
let t = $.current() ?? B.getFirst();
|
|
14997
15109
|
t && await t.stopAsr(e);
|
|
14998
15110
|
}
|
|
14999
|
-
async function
|
|
15111
|
+
async function rd(e) {
|
|
15000
15112
|
let t = $.current() ?? B.getFirst();
|
|
15001
15113
|
t && await t.requestAsr(e);
|
|
15002
15114
|
}
|
|
15003
|
-
async function
|
|
15115
|
+
async function id(e) {
|
|
15004
15116
|
let t = $.current();
|
|
15005
15117
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
15006
15118
|
}
|
|
15007
|
-
async function
|
|
15119
|
+
async function ad() {
|
|
15008
15120
|
let e = $.current();
|
|
15009
15121
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
15010
15122
|
}
|
|
15011
|
-
async function
|
|
15123
|
+
async function od(e) {
|
|
15012
15124
|
await B.switchCall(e);
|
|
15013
15125
|
}
|
|
15014
|
-
function
|
|
15126
|
+
function sd() {
|
|
15015
15127
|
return B.getActiveId();
|
|
15016
15128
|
}
|
|
15017
|
-
function
|
|
15129
|
+
function cd() {
|
|
15018
15130
|
return $.getSyncedTime();
|
|
15019
15131
|
}
|
|
15020
|
-
function
|
|
15132
|
+
function ld() {
|
|
15021
15133
|
return N.sdkVersion;
|
|
15022
15134
|
}
|
|
15023
15135
|
typeof window < "u" && (window.__CALLS_SDK = Tn);
|
|
15024
15136
|
//#endregion
|
|
15025
|
-
export {
|
|
15137
|
+
export { $c as Api, sl as ApiExternal, ol as ArrayDequeue, v as AuthData, f as BaseLogger, vo as CallDirection, yo as CallType, bo as ChatRoomEventType, xo as ConversationFeature, So as ConversationOption, On as DebugMessageType, No as ExternalIdType, Lt as FacingMode, y as FatalError, k as HangupReason, p as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, To as MuteState, X as ParticipantState, al as ParticipantStateDataValue, P as ParticipantStatus, il as RecordRole, Eo as RoomsEventType, _o as Signaling, V as SignalingCommandType, Cr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, ko as UserRole, j as UserType, ns as VolumeDetector, Dl as acceptCall, Wu as acceptPromotion, Tu as activateRooms, xu as addMovie, Nl as addParticipant, Pl as addParticipantInternal, El as authorize, dl as browser, xl as callInternal, yl as callTo, Rl as captureScreen, zl as captureVmoji, Iu as changeAudioEffect, iu as changeConversationOptions, Ll as changeDevice, Gl as changeParticipantState, Wl as changePriorities, Fu as changeVideoEffect, su as chatHistory, au as chatMessage, ou as chatMessageInternal, fu as createJoinLink, cu as customData, lu as customDataInternal, ku as debug, Mu as debugLogs, Au as debugMessage, ju as debugMessageWithContext, Ol as declineCall, Ju as enableFeatureForRoles, nu as enableVideoSuspend, ru as enableVideoSuspendSuggest, qu as feedback, gu as forceRelayPolicy, sd as getActiveCallId, mu as getAnonymTokenByLink, Vu as getAudienceModeHands, wl as getInbounds, Gu as getParticipantListChunk, Ku as getParticipants, bu as getStreamInfo, cd as getSyncedTime, Bu as getWaitingHall, Yl as grantRoles, Xl as grantRolesInternal, Ml as hangup, vl as init, kl as joinCall, jl as joinCallByLink, Al as joinCallInternal, Zl as muteParticipant, Ql as muteParticipantInternal, $l as pinParticipant, eu as pinParticipantInternal, Sl as processPush, Cl as processPushInternal, Hu as promoteParticipant, yu as publishStream, Kl as putHandsDown, ed as removeHistoryRecords, pu as removeJoinLink, Cu as removeMovie, Fl as removeParticipant, Il as removeParticipantInternal, Du as removeRooms, rd as requestAsr, Jl as requestDisplayLayout, Uu as requestPromotion, hl as setAudioEffects, Lu as setAudioStream, Ul as setLocalResolution, pl as setLogger, tu as setMediaModifiers, Ou as setStatisticsInterval, gl as setVad, ml as setVideoEffects, Bl as setVideoStream, _l as setVmoji, zu as setVmojiFill, Ru as setVmojiSvg, hu as setVolume, td as startAsr, du as startAudienceConversation, uu as startConversation, Tl as startStats, _u as startStream, id as startUrlSharing, nd as stopAsr, vu as stopStream, ad as stopUrlSharing, od as switchCall, Eu as switchRoom, Hl as toggleLocalAudio, Vl as toggleLocalVideo, ql as updateDisplayLayout, Su as updateMovie, wu as updateRooms, Pu as uploadDebugLogs, fl as utils, ld as version };
|