@webex/internal-media-core 0.0.16-beta → 1.31.1

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/dist/esm/index.js CHANGED
@@ -2522,7 +2522,8 @@ var getErrorDescription = error => {
2522
2522
  };
2523
2523
 
2524
2524
  var NUM$1 = '\\d+';
2525
- var TOKEN = '\\S+';
2525
+ var SDP_TOKEN$1 = "[!#$%&'*+\\-.^_`{|}~a-zA-Z0-9]+";
2526
+ var ANY_NON_WS$1 = '\\S+';
2526
2527
  var SP$1 = '\\s';
2527
2528
  var REST$1 = '.+';
2528
2529
  class Line$1 {}
@@ -2616,7 +2617,7 @@ class CandidateLine$1 extends Line$1 {
2616
2617
  }
2617
2618
  _a$4$1 = CandidateLine$1;
2618
2619
  CandidateLine$1.ICE_CHARS = "[a-zA-Z0-9+/]+";
2619
- CandidateLine$1.regex = new RegExp("^candidate:(".concat(_a$4$1.ICE_CHARS, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(NUM$1, ") typ (").concat(TOKEN, ")(?: raddr (").concat(TOKEN, "))?(?: rport (").concat(NUM$1, "))?(?: (").concat(REST$1, "))?"));
2620
+ CandidateLine$1.regex = new RegExp("^candidate:(".concat(_a$4$1.ICE_CHARS, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(NUM$1, ") typ (").concat(ANY_NON_WS$1, ")(?: raddr (").concat(ANY_NON_WS$1, "))?(?: rport (").concat(NUM$1, "))?(?: (").concat(REST$1, "))?"));
2620
2621
  class ConnectionLine$1 extends Line$1 {
2621
2622
  constructor(netType, addrType, ipAddr) {
2622
2623
  super();
@@ -2638,7 +2639,7 @@ class ConnectionLine$1 extends Line$1 {
2638
2639
  return "c=".concat(this.netType, " ").concat(this.addrType, " ").concat(this.ipAddr);
2639
2640
  }
2640
2641
  }
2641
- ConnectionLine$1.regex = new RegExp("^(".concat(TOKEN, ") (").concat(TOKEN, ") (").concat(TOKEN, ")"));
2642
+ ConnectionLine$1.regex = new RegExp("^(".concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ")"));
2642
2643
  class ContentLine$1 extends Line$1 {
2643
2644
  constructor(values) {
2644
2645
  super();
@@ -2710,7 +2711,7 @@ class ExtMapLine$1 extends Line$1 {
2710
2711
  }
2711
2712
  _a$3$1 = ExtMapLine$1;
2712
2713
  ExtMapLine$1.EXTMAP_DIRECTION = "sendonly|recvonly|sendrecv|inactive";
2713
- ExtMapLine$1.regex = new RegExp("^extmap:(".concat(NUM$1, ")(?:/(").concat(_a$3$1.EXTMAP_DIRECTION, "))? (").concat(TOKEN, ")(?: (").concat(REST$1, "))?"));
2714
+ ExtMapLine$1.regex = new RegExp("^extmap:(".concat(NUM$1, ")(?:/(").concat(_a$3$1.EXTMAP_DIRECTION, "))? (").concat(ANY_NON_WS$1, ")(?: (").concat(REST$1, "))?"));
2714
2715
  class FingerprintLine$1 extends Line$1 {
2715
2716
  constructor(fingerprint) {
2716
2717
  super();
@@ -2784,7 +2785,7 @@ class IcePwdLine$1 extends Line$1 {
2784
2785
  return "a=ice-pwd:".concat(this.pwd);
2785
2786
  }
2786
2787
  }
2787
- IcePwdLine$1.regex = new RegExp("^ice-pwd:(".concat(TOKEN, ")$"));
2788
+ IcePwdLine$1.regex = new RegExp("^ice-pwd:(".concat(ANY_NON_WS$1, ")$"));
2788
2789
  class IceUfragLine$1 extends Line$1 {
2789
2790
  constructor(ufrag) {
2790
2791
  super();
@@ -2802,7 +2803,7 @@ class IceUfragLine$1 extends Line$1 {
2802
2803
  return "a=ice-ufrag:".concat(this.ufrag);
2803
2804
  }
2804
2805
  }
2805
- IceUfragLine$1.regex = new RegExp("^ice-ufrag:(".concat(TOKEN, ")$"));
2806
+ IceUfragLine$1.regex = new RegExp("^ice-ufrag:(".concat(ANY_NON_WS$1, ")$"));
2806
2807
  class MaxMessageSizeLine$1 extends Line$1 {
2807
2808
  constructor(maxMessageSize) {
2808
2809
  super();
@@ -2847,7 +2848,7 @@ class MediaLine$1 extends Line$1 {
2847
2848
  }
2848
2849
  _a$2$1 = MediaLine$1;
2849
2850
  MediaLine$1.MEDIA_TYPE = 'audio|video|application';
2850
- MediaLine$1.regex = new RegExp("^(".concat(_a$2$1.MEDIA_TYPE, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(REST$1, ")"));
2851
+ MediaLine$1.regex = new RegExp("^(".concat(_a$2$1.MEDIA_TYPE, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(REST$1, ")"));
2851
2852
  class MidLine$1 extends Line$1 {
2852
2853
  constructor(mid) {
2853
2854
  super();
@@ -2865,7 +2866,7 @@ class MidLine$1 extends Line$1 {
2865
2866
  return "a=mid:".concat(this.mid);
2866
2867
  }
2867
2868
  }
2868
- MidLine$1.regex = new RegExp("^mid:(".concat(TOKEN, ")$"));
2869
+ MidLine$1.regex = new RegExp("^mid:(".concat(ANY_NON_WS$1, ")$"));
2869
2870
  class OriginLine$1 extends Line$1 {
2870
2871
  constructor(username, sessionId, sessionVersion, netType, addrType, ipAddr) {
2871
2872
  super();
@@ -2893,7 +2894,7 @@ class OriginLine$1 extends Line$1 {
2893
2894
  return "o=".concat(this.username, " ").concat(this.sessionId, " ").concat(this.sessionVersion, " ").concat(this.netType, " ").concat(this.addrType, " ").concat(this.ipAddr);
2894
2895
  }
2895
2896
  }
2896
- OriginLine$1.regex = new RegExp("^(".concat(TOKEN, ") (").concat(TOKEN, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(TOKEN, ") (").concat(TOKEN, ")"));
2897
+ OriginLine$1.regex = new RegExp("^(".concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ")"));
2897
2898
  var _a$1$1;
2898
2899
  class RidLine$1 extends Line$1 {
2899
2900
  constructor(id, direction, params) {
@@ -3161,7 +3162,60 @@ class SimulcastLine$1 extends Line$1 {
3161
3162
  return str;
3162
3163
  }
3163
3164
  }
3164
- SimulcastLine$1.regex = new RegExp("^simulcast:(send|recv) (".concat(TOKEN, ")(?: (send|recv) (").concat(TOKEN, "))?"));
3165
+ SimulcastLine$1.regex = new RegExp("^simulcast:(send|recv) (".concat(ANY_NON_WS$1, ")(?: (send|recv) (").concat(ANY_NON_WS$1, "))?"));
3166
+ class SsrcLine$1 extends Line$1 {
3167
+ constructor(ssrcId, attribute) {
3168
+ var attributeValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3169
+ var attributeData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
3170
+ super();
3171
+ this.ssrcId = ssrcId;
3172
+ this.attribute = attribute;
3173
+ this.attributeValue = attributeValue;
3174
+ this.attributeData = attributeData;
3175
+ }
3176
+ static fromSdpLine(line) {
3177
+ if (!SsrcLine$1.regex.test(line)) {
3178
+ return undefined;
3179
+ }
3180
+ var tokens = line.match(SsrcLine$1.regex);
3181
+ var ssrcId = parseInt(tokens[1], 10);
3182
+ var attribute = tokens[2];
3183
+ var attributeValue = tokens[3];
3184
+ var attributeData = tokens[4];
3185
+ return new SsrcLine$1(ssrcId, attribute, attributeValue, attributeData);
3186
+ }
3187
+ toSdpLine() {
3188
+ var str = "a=ssrc:".concat(this.ssrcId, " ").concat(this.attribute);
3189
+ if (this.attributeValue) {
3190
+ str += ":".concat(this.attributeValue);
3191
+ }
3192
+ if (this.attributeData) {
3193
+ str += " ".concat(this.attributeData);
3194
+ }
3195
+ return str;
3196
+ }
3197
+ }
3198
+ SsrcLine$1.regex = new RegExp("^ssrc:(".concat(NUM$1, ") (").concat(SDP_TOKEN$1, ")(?::(").concat(SDP_TOKEN$1, ")?(?: (").concat(ANY_NON_WS$1, "))?)?$"));
3199
+ class SsrcGroupLine$1 extends Line$1 {
3200
+ constructor(semantics, ssrcs) {
3201
+ super();
3202
+ this.semantics = semantics;
3203
+ this.ssrcs = ssrcs;
3204
+ }
3205
+ static fromSdpLine(line) {
3206
+ if (!SsrcGroupLine$1.regex.test(line)) {
3207
+ return undefined;
3208
+ }
3209
+ var tokens = line.match(SsrcGroupLine$1.regex);
3210
+ var semantics = tokens[1];
3211
+ var ssrcs = tokens[2].split(' ').map(ssrcStr => parseInt(ssrcStr, 10));
3212
+ return new SsrcGroupLine$1(semantics, ssrcs);
3213
+ }
3214
+ toSdpLine() {
3215
+ return "a=ssrc-group:".concat(this.semantics, " ").concat(this.ssrcs.join(' '));
3216
+ }
3217
+ }
3218
+ SsrcGroupLine$1.regex = new RegExp("^ssrc-group:(SIM|FID|FEC) ((?:".concat(NUM$1).concat(SP$1, "*)+)"));
3165
3219
  class TimingLine$1 extends Line$1 {
3166
3220
  constructor(startTime, stopTime) {
3167
3221
  super();
@@ -3398,6 +3452,8 @@ class AvMediaDescription$1 extends MediaDescription$1 {
3398
3452
  this.rids = [];
3399
3453
  this.codecs = new Map();
3400
3454
  this.rtcpMux = false;
3455
+ this.ssrcs = [];
3456
+ this.ssrcGroups = [];
3401
3457
  this.pts = mediaLine.formats.map(fmt => {
3402
3458
  return parseInt(fmt, 10);
3403
3459
  });
@@ -3437,6 +3493,8 @@ class AvMediaDescription$1 extends MediaDescription$1 {
3437
3493
  lines.push(new DirectionLine$1(this.direction));
3438
3494
  }
3439
3495
  this.codecs.forEach(codec => lines.push(...codec.toLines()));
3496
+ lines.push(...this.ssrcs);
3497
+ lines.push(...this.ssrcGroups);
3440
3498
  lines.push(...this.otherLines);
3441
3499
  return lines;
3442
3500
  }
@@ -3475,6 +3533,14 @@ class AvMediaDescription$1 extends MediaDescription$1 {
3475
3533
  codec.addLine(line);
3476
3534
  return true;
3477
3535
  }
3536
+ if (line instanceof SsrcLine$1) {
3537
+ this.ssrcs.push(line);
3538
+ return true;
3539
+ }
3540
+ if (line instanceof SsrcGroupLine$1) {
3541
+ this.ssrcGroups.push(line);
3542
+ return true;
3543
+ }
3478
3544
  this.otherLines.push(line);
3479
3545
  return true;
3480
3546
  }
@@ -3619,6 +3685,8 @@ class SdpGrammar$1 extends Grammar$1 {
3619
3685
  this.addParser('a', RidLine$1.fromSdpLine);
3620
3686
  this.addParser('a', CandidateLine$1.fromSdpLine);
3621
3687
  this.addParser('a', SimulcastLine$1.fromSdpLine);
3688
+ this.addParser('a', SsrcLine$1.fromSdpLine);
3689
+ this.addParser('a', SsrcGroupLine$1.fromSdpLine);
3622
3690
  }
3623
3691
  }
3624
3692
  var DefaultSdpGrammar$1 = new SdpGrammar$1();
@@ -4846,7 +4914,12 @@ class LocalTrack extends EventEmitter$2 {
4846
4914
  * Cleanup local microphone track.
4847
4915
  */
4848
4916
  disposeEffects() {
4849
- this.effects.forEach(effect => effect.dispose());
4917
+ if (this.effects.size > 0) {
4918
+ this.effects.forEach(effect => effect.dispose());
4919
+ this.effects.clear();
4920
+ this.underlyingStream = this.originalStream;
4921
+ this.emit(LocalTrackEvents.UnderlyingTrackChange);
4922
+ }
4850
4923
  }
4851
4924
  }
4852
4925
  LocalTrack.Events = LocalTrackEvents;
@@ -8033,10 +8106,11 @@ adapterFactory$1({
8033
8106
  /**
8034
8107
  * Creates an RTCPeerConnection.
8035
8108
  *
8109
+ * @param configuration - Config to the RTCPeerConnection constructor.
8036
8110
  * @returns An RTCPeerConnection instance.
8037
8111
  */
8038
- function createRTCPeerConnection() {
8039
- return new RTCPeerConnection();
8112
+ function createRTCPeerConnection(configuration) {
8113
+ return new RTCPeerConnection(configuration);
8040
8114
  }
8041
8115
 
8042
8116
  /**
@@ -8058,11 +8132,13 @@ var PeerConnectionEvents;
8058
8132
  class PeerConnection extends EventEmitter$2 {
8059
8133
  /**
8060
8134
  * Creates an instance of the RTCPeerConnection.
8135
+ *
8136
+ * @param configuration - Config to the RTCPeerConnection constructor.
8061
8137
  */
8062
- constructor() {
8138
+ constructor(configuration) {
8063
8139
  super();
8064
8140
  logger$3.log('PeerConnection init');
8065
- this.pc = createRTCPeerConnection();
8141
+ this.pc = createRTCPeerConnection(configuration);
8066
8142
  this.connectionStateHandler = new ConnectionStateHandler(() => {
8067
8143
  return {
8068
8144
  connectionState: this.pc.connectionState,
@@ -8254,6 +8330,17 @@ class PeerConnection extends EventEmitter$2 {
8254
8330
  getTransceivers() {
8255
8331
  return this.pc.getTransceivers();
8256
8332
  }
8333
+ /**
8334
+ * Get statistics about either the overall connection or about the specified MediaStreamTrack.
8335
+ *
8336
+ * @param selector - An optional MediaStreamTrack for which to gather statistics. If not provided,
8337
+ * statistics will be gathered for the entire underlying RTCPeerConnection.
8338
+ * @returns - A Promise which resolves with an RTCStatsReport object providing connection
8339
+ * statistics.
8340
+ */
8341
+ getStats(selector) {
8342
+ return this.pc.getStats(selector);
8343
+ }
8257
8344
  /**
8258
8345
  * Returns a string that describes the connections' ICE gathering state.
8259
8346
  *
@@ -8839,7 +8926,11 @@ class JmpSession extends EventEmitter$4 {
8839
8926
  }
8840
8927
  updateSourceIndication(numTotalSources, numLiveSources, sources) {
8841
8928
  var _a;
8842
- var sourceIndicationMsg = new SourceIndicationMsg(this.currSourceIndicationSeqNum++, numTotalSources, numLiveSources, sources);
8929
+ var filteredSources = sources.filter(source => {
8930
+ var _a;
8931
+ return (_a = this.lastReceivedScr) === null || _a === void 0 ? void 0 : _a.requests.some(req => req.ids.find(streamId => compareStreamIds(streamId, source.id)));
8932
+ });
8933
+ var sourceIndicationMsg = new SourceIndicationMsg(this.currSourceIndicationSeqNum++, numTotalSources, numLiveSources, filteredSources);
8843
8934
  var jmpMsg = new JmpMsg(this.mediaFamily, this.mediaContent, {
8844
8935
  msgType: JmpMsgType$1.SourceIndication,
8845
8936
  payload: sourceIndicationMsg
@@ -8984,94 +9075,13 @@ class JmpSession extends EventEmitter$4 {
8984
9075
  (_a = this.txCallback) === null || _a === void 0 ? void 0 : _a.call(this, JSON.stringify(homerMsg));
8985
9076
  }
8986
9077
  }
8987
- var MediaCodecMimeType;
8988
- (function (MediaCodecMimeType) {
8989
- MediaCodecMimeType["H264"] = "video/H264";
8990
- MediaCodecMimeType["AV1"] = "video/AV1";
8991
- MediaCodecMimeType["OPUS"] = "audio/opus";
8992
- })(MediaCodecMimeType || (MediaCodecMimeType = {}));
8993
- var defaultGlobalMaxVideoFrameSize = 8160;
8994
- var defaultGlobalMaxVideoMbps = 244800;
8995
- var defaultMaxFrameSize = 3600;
8996
- var maxFrameSizeToMaxBitrateMap = new Map([[60, 99000], [240, 199000], [576, 300000], [920, 640000], [1296, 720000], [2304, 880000], [3600, 2500000], [8160, 4000000]]);
8997
- function parseFmtpParams(fmtpParams) {
8998
- fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
8999
- var fmtpObj = {};
9000
- fmtpParams.split(';').forEach(param => {
9001
- var paramArr = param && param.split('=');
9002
- if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
9003
- throw new Error("Fmtp params is invalid with ".concat(fmtpParams));
9004
- }
9005
- fmtpObj[paramArr[0]] = paramArr[1];
9006
- });
9007
- return fmtpObj;
9008
- }
9009
- function areProfileLevelIdsCompatible(senderProfileLevelId, receiverProfileLevelId, levelAsymmetryAllowed) {
9010
- var senderProfile = Number.parseInt("0x".concat(senderProfileLevelId), 16);
9011
- var recvProfile = Number.parseInt("0x".concat(receiverProfileLevelId), 16);
9012
- var senderProfileIdc = senderProfile >> 16;
9013
- var recvProfileIdc = recvProfile >> 16;
9014
- var senderProfileIop = (senderProfile & 0x00ff00) >> 8;
9015
- var recvProfileIop = (recvProfile & 0x00ff00) >> 8;
9016
- var senderLevelIdc = senderProfile & 0x0000ff;
9017
- var recvLevelIdc = recvProfile & 0x0000ff;
9018
- var areProfileCompatible = senderProfileIdc === recvProfileIdc && senderProfileIop === recvProfileIop || senderProfileIdc === 0x42 && recvProfileIdc === 0x42 && (senderProfileIop & 0x40) === (recvProfileIop & 0x40);
9019
- var isLevelIdcCompatible = levelAsymmetryAllowed ? true : senderLevelIdc <= recvLevelIdc;
9020
- return areProfileCompatible && isLevelIdcCompatible;
9021
- }
9022
- function areCodecsCompatible(senderCodec, receiverCodec) {
9023
- return Object.keys(receiverCodec).every(key => {
9024
- if (!senderCodec[key] || !receiverCodec[key]) {
9025
- return false;
9026
- }
9027
- if (key === 'payloadType') {
9028
- return true;
9029
- }
9030
- if (key === 'sdpFmtpLine') {
9031
- var fmtpForSender = parseFmtpParams(senderCodec[key]);
9032
- var fmtpForReceiver = parseFmtpParams(receiverCodec[key]);
9033
- var levelAsymmetryAllowed = Object.keys(fmtpForSender).some(senderFmtpParamKey => {
9034
- return senderFmtpParamKey === 'level-asymmetry-allowed' && fmtpForReceiver[senderFmtpParamKey] === '1' && fmtpForSender[senderFmtpParamKey] === '1';
9035
- });
9036
- return Object.keys(fmtpForSender).every(senderFmtpParamKey => {
9037
- if (fmtpForReceiver[senderFmtpParamKey]) {
9038
- if (senderFmtpParamKey === 'profile-level-id') {
9039
- return areProfileLevelIdsCompatible(fmtpForSender[senderFmtpParamKey], fmtpForReceiver[senderFmtpParamKey], levelAsymmetryAllowed);
9040
- }
9041
- }
9042
- if (senderFmtpParamKey === 'packetization-mode') {
9043
- return fmtpForSender[senderFmtpParamKey] === fmtpForReceiver[senderFmtpParamKey];
9044
- }
9045
- return true;
9046
- });
9047
- }
9048
- return senderCodec[key] === receiverCodec[key];
9049
- });
9050
- }
9051
- function gcd(a, b) {
9052
- return b === 0 ? a : gcd(b, a % b);
9053
- }
9054
- function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
9055
- var _gcd = gcd(sourceAspectRatio[0], sourceAspectRatio[1]);
9056
- var minNumberRatiosForWidth = sourceAspectRatio[0] / _gcd;
9057
- var minNumberRatiosForHeight = sourceAspectRatio[1] / _gcd;
9058
- return Math.floor(Math.sqrt(requestedMaxFs * 16 * 16 / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight;
9059
- }
9060
- function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
9061
- return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
9062
- }
9063
- function getMaxBitrate(requestedMaxFs) {
9064
- var maxFs = requestedMaxFs || defaultMaxFrameSize;
9065
- var expectedHeight = [...maxFrameSizeToMaxBitrateMap.keys()].sort((a, b) => b - a).find(h => maxFs >= h);
9066
- return maxFrameSizeToMaxBitrateMap.get(expectedHeight);
9067
- }
9068
9078
  class MediaRequest {
9069
- constructor(policy, policySpecificInfo, receiveSlots, codecInfos) {
9070
- var _a, _b;
9079
+ constructor(policy, policySpecificInfo, receiveSlots, maxPayloadBitsPerSecond) {
9080
+ var codecInfos = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
9071
9081
  this.policy = policy;
9072
9082
  this.policySpecificInfo = policySpecificInfo;
9073
9083
  this.receiveSlots = receiveSlots;
9074
- this.maxPayloadBitsPerSecond = getMaxBitrate((_b = (_a = codecInfos === null || codecInfos === void 0 ? void 0 : codecInfos[0]) === null || _a === void 0 ? void 0 : _a.h264) === null || _b === void 0 ? void 0 : _b.maxFs);
9084
+ this.maxPayloadBitsPerSecond = maxPayloadBitsPerSecond;
9075
9085
  this.codecInfos = codecInfos;
9076
9086
  }
9077
9087
  _toJmpScrRequest() {
@@ -9671,6 +9681,41 @@ var uuid_1 = require$$0;
9671
9681
  var deepCopy$1 = function deepCopy$1(value) {
9672
9682
  return JSON.parse(JSON.stringify(value));
9673
9683
  };
9684
+ /**
9685
+ * Check deep equality between two values.
9686
+ *
9687
+ * @param value1 - First value to check.
9688
+ * @param value2 - Second value to check.
9689
+ * @returns True if values are deeply equal, false otherwise.
9690
+ */
9691
+ var deepEqual = function deepEqual(value1, value2) {
9692
+ // If both immutable values are equal, return true.
9693
+ if (value1 === value2) {
9694
+ return true;
9695
+ }
9696
+ // If both are objects, we check the length and properties of each.
9697
+ if (value1 && value2 && typeof value1 === 'object' && typeof value2 === 'object') {
9698
+ if (value1.constructor !== value2.constructor) return false;
9699
+ // Return false if the objects are of different sizes.
9700
+ if (Object.keys(value1).length !== Object.keys(value2).length) {
9701
+ return false;
9702
+ }
9703
+ // Deep equal check each property in the opject.
9704
+ for (var prop in value1) {
9705
+ if (value2.hasOwnProperty(prop)) {
9706
+ if (!deepEqual(value1[prop], value2[prop])) {
9707
+ return false;
9708
+ }
9709
+ } else {
9710
+ return false;
9711
+ }
9712
+ }
9713
+ // Return true if we found no differing properties.
9714
+ return true;
9715
+ }
9716
+ // Return false if no other conditions are met.
9717
+ return false;
9718
+ };
9674
9719
  /**
9675
9720
  * Translates a RTCStatsReport into an object.
9676
9721
  *
@@ -9687,6 +9732,18 @@ var map2obj = function map2obj(report) {
9687
9732
  });
9688
9733
  return o;
9689
9734
  };
9735
+ var persistedKeys = ['type', 'id', 'timestamp'];
9736
+ /**
9737
+ * Check to see if the report consists of more than just the persisted metadata.
9738
+ *
9739
+ * @param report - The report line being checked.
9740
+ * @returns True if the report item contains non-persisted keys, false otherwise.
9741
+ */
9742
+ var hasNonMetadata = function hasNonMetadata(report) {
9743
+ return !!Object.keys(report).filter(function (key) {
9744
+ return !persistedKeys.includes(key);
9745
+ }).length;
9746
+ };
9690
9747
  /**
9691
9748
  * Apply a delta compression to the stats report. Reduces size by ~90%.
9692
9749
  * To reduce further, report keys could be compressed.
@@ -9699,19 +9756,21 @@ var deltaCompression = function deltaCompression(oldStats, newStats) {
9699
9756
  var updatedStats = deepCopy$1(newStats);
9700
9757
  Object.keys(updatedStats).forEach(function (id) {
9701
9758
  var report = updatedStats[id];
9702
- delete report.id;
9703
9759
  if (!oldStats[id]) {
9704
9760
  return;
9705
9761
  }
9762
+ // Persist specific values beyond delta compression, as long as they
9763
+ // aren't the only non-deduped keys.
9706
9764
  Object.keys(report).forEach(function (name) {
9707
- if (report[name] === oldStats[id][name]) {
9765
+ if (deepEqual(report[name], oldStats[id][name]) && !persistedKeys.includes(name)) {
9708
9766
  delete updatedStats[id][name];
9709
9767
  }
9710
- if (Object.keys(report).length === 0 || Object.keys(report).length === 1 && report.timestamp) {
9768
+ if (!hasNonMetadata(report)) {
9711
9769
  delete updatedStats[id];
9712
9770
  }
9713
9771
  });
9714
9772
  });
9773
+ // Use the most recent timestamp.
9715
9774
  var timestamp = -Infinity;
9716
9775
  Object.keys(updatedStats).forEach(function (id) {
9717
9776
  var report = updatedStats[id];
@@ -9719,15 +9778,42 @@ var deltaCompression = function deltaCompression(oldStats, newStats) {
9719
9778
  timestamp = report.timestamp;
9720
9779
  }
9721
9780
  });
9781
+ // Delete the timestamps on each item.
9722
9782
  Object.keys(updatedStats).forEach(function (id) {
9723
9783
  var report = updatedStats[id];
9724
9784
  if (report.timestamp === timestamp) {
9725
- report.timestamp = 0;
9785
+ delete report.timestamp;
9726
9786
  }
9727
9787
  });
9728
9788
  updatedStats.timestamp = timestamp;
9729
9789
  return updatedStats;
9730
9790
  };
9791
+ /**
9792
+ * Format the stats report into an array.
9793
+ *
9794
+ * @param report - A WebRTC stats report.
9795
+ * @returns - An array of Stats Report items.
9796
+ */
9797
+ var formatStatsReport = function formatStatsReport(report) {
9798
+ return Object.keys(report).filter(function (name) {
9799
+ return name !== 'timestamp';
9800
+ }).map(function (name) {
9801
+ return report[name];
9802
+ });
9803
+ };
9804
+ /**
9805
+ * Parametrize a single string event to contain type and an (empty) id.
9806
+ *
9807
+ * @param value - The value to parametrize.
9808
+ * @returns An event object.
9809
+ */
9810
+ var makeEvent = function makeEvent(value) {
9811
+ return [{
9812
+ value: value,
9813
+ type: 'string',
9814
+ id: ''
9815
+ }];
9816
+ };
9731
9817
  /**
9732
9818
  * Attach a Peer Connection to periodically get updated on events and stats.
9733
9819
  *
@@ -9750,51 +9836,50 @@ var rtcStats = function rtcStats(pc, logger, intervalTime, id, statsPreProcessor
9750
9836
  /**
9751
9837
  * Log stats or event data with additional tracking information.
9752
9838
  *
9753
- * @param args - Array of parameters to log of any type.
9839
+ * @param name - Name of the event to log.
9840
+ * @param payload - Log data pertaining to the event.
9754
9841
  */
9755
- var trace = function trace(eventName, data) {
9842
+ var trace = function trace(name, payload, timestamp) {
9756
9843
  logger({
9757
- name: '[rtcstats]',
9758
9844
  id: id,
9759
- eventName: eventName,
9760
- data: data
9845
+ timestamp: timestamp ? Math.round(timestamp) : Date.now(),
9846
+ name: name,
9847
+ payload: payload
9761
9848
  });
9762
9849
  };
9763
- trace('creating stats report');
9764
9850
  pc.addEventListener('icecandidate', function (e) {
9765
- trace('onicecandidate', e.candidate);
9851
+ if (e.candidate) {
9852
+ trace('onicecandidate', makeEvent(JSON.stringify(e.candidate)));
9853
+ }
9766
9854
  });
9767
9855
  pc.addEventListener('icecandidateerror', function (event) {
9768
9856
  var _a = event,
9769
9857
  errorCode = _a.errorCode,
9770
9858
  errorText = _a.errorText;
9771
- trace('onicecandidateerror', {
9772
- errorText: errorText,
9773
- errorCode: errorCode
9774
- });
9859
+ trace('onicecandidateerror', makeEvent("".concat(errorCode, ": ").concat(errorText)));
9775
9860
  });
9776
9861
  pc.addEventListener('track', function (e) {
9777
- trace('ontrack', "".concat(e.track.kind, ":").concat(e.track.id, " ").concat(e.streams.map(function (stream) {
9862
+ trace('ontrack', makeEvent("".concat(e.track.kind, ":").concat(e.track.id, " ").concat(e.streams.map(function (stream) {
9778
9863
  return "stream:".concat(stream.id);
9779
- })));
9864
+ }).join(' '))));
9780
9865
  });
9781
9866
  pc.addEventListener('signalingstatechange', function () {
9782
- trace('onsignalingstatechange', pc.signalingState);
9867
+ trace('onsignalingstatechange', makeEvent(pc.signalingState));
9783
9868
  });
9784
9869
  pc.addEventListener('iceconnectionstatechange', function () {
9785
- trace('oniceconnectionstatechange', pc.iceConnectionState);
9870
+ trace('oniceconnectionstatechange', makeEvent(pc.iceConnectionState));
9786
9871
  });
9787
9872
  pc.addEventListener('icegatheringstatechange', function () {
9788
- trace('onicegatheringstatechange', pc.iceGatheringState);
9873
+ trace('onicegatheringstatechange', makeEvent(pc.iceGatheringState));
9789
9874
  });
9790
9875
  pc.addEventListener('connectionstatechange', function () {
9791
- trace('onconnectionstatechange', pc.connectionState);
9876
+ trace('onconnectionstatechange', makeEvent(pc.connectionState));
9792
9877
  });
9793
9878
  pc.addEventListener('negotiationneeded', function () {
9794
- trace('onnegotiationneeded');
9879
+ trace('onnegotiationneeded', makeEvent('negotiationneeded'));
9795
9880
  });
9796
9881
  pc.addEventListener('datachannel', function (event) {
9797
- trace('ondatachannel', [event.channel.id, event.channel.label]);
9882
+ trace('ondatachannel', makeEvent("".concat(event.channel.id, ": ").concat(event.channel.label)));
9798
9883
  });
9799
9884
  var interval = window.setInterval(function () {
9800
9885
  if (pc.signalingState === 'closed') {
@@ -9805,7 +9890,8 @@ var rtcStats = function rtcStats(pc, logger, intervalTime, id, statsPreProcessor
9805
9890
  var now = map2obj(res);
9806
9891
  statsPreProcessor(now).then(function () {
9807
9892
  var base = deepCopy$1(now); // our new prev
9808
- trace('stats-report', deltaCompression(prev, now));
9893
+ var compressed = deltaCompression(prev, now);
9894
+ trace('stats-report', formatStatsReport(compressed), compressed.timestamp !== -Infinity ? compressed.timestamp : undefined);
9809
9895
  prev = base;
9810
9896
  });
9811
9897
  });
@@ -10021,6 +10107,22 @@ class FingerprintLine extends Line {
10021
10107
  }
10022
10108
  }
10023
10109
  FingerprintLine.regex = new RegExp("^fingerprint:(".concat(REST, ")"));
10110
+ function parseFmtpParams(fmtpParams) {
10111
+ fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
10112
+ var fmtpObj = new Map();
10113
+ if (/^\d+([/-]\d+)+$/.test(fmtpParams)) {
10114
+ fmtpObj.set(fmtpParams, undefined);
10115
+ return fmtpObj;
10116
+ }
10117
+ fmtpParams.split(';').forEach(param => {
10118
+ var paramArr = param && param.split('=');
10119
+ if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
10120
+ throw new Error("Fmtp params is invalid with ".concat(fmtpParams));
10121
+ }
10122
+ fmtpObj.set(paramArr[0], paramArr[1]);
10123
+ });
10124
+ return fmtpObj;
10125
+ }
10024
10126
  class FmtpLine extends Line {
10025
10127
  constructor(payloadType, params) {
10026
10128
  super();
@@ -10034,10 +10136,16 @@ class FmtpLine extends Line {
10034
10136
  var tokens = line.match(FmtpLine.regex);
10035
10137
  var payloadType = parseInt(tokens[1], 10);
10036
10138
  var params = tokens[2];
10037
- return new FmtpLine(payloadType, params);
10139
+ return new FmtpLine(payloadType, parseFmtpParams(params));
10038
10140
  }
10039
10141
  toSdpLine() {
10040
- return "a=fmtp:".concat(this.payloadType, " ").concat(this.params);
10142
+ var fmtParams = Array.from(this.params.keys()).map(key => {
10143
+ if (this.params.get(key) !== undefined) {
10144
+ return "".concat(key, "=").concat(this.params.get(key));
10145
+ }
10146
+ return "".concat(key);
10147
+ }).join(';');
10148
+ return "a=fmtp:".concat(this.payloadType, " ").concat(fmtParams);
10041
10149
  }
10042
10150
  }
10043
10151
  FmtpLine.regex = new RegExp("^fmtp:(".concat(NUM, ") (").concat(REST, ")"));
@@ -10698,7 +10806,7 @@ class ApplicationMediaDescription extends MediaDescription {
10698
10806
  }
10699
10807
  class CodecInfo$1 {
10700
10808
  constructor(pt) {
10701
- this.fmtParams = [];
10809
+ this.fmtParams = new Map();
10702
10810
  this.feedback = [];
10703
10811
  this.pt = pt;
10704
10812
  }
@@ -10710,9 +10818,9 @@ class CodecInfo$1 {
10710
10818
  return true;
10711
10819
  }
10712
10820
  if (line instanceof FmtpLine) {
10713
- this.fmtParams.push(line.params);
10714
- if (line.params.indexOf('apt') !== -1) {
10715
- var apt = line.params.split('=')[1];
10821
+ this.fmtParams = new Map([...Array.from(this.fmtParams.entries()), ...Array.from(line.params.entries())]);
10822
+ if (line.params.has('apt')) {
10823
+ var apt = line.params.get('apt');
10716
10824
  this.primaryCodecPt = parseInt(apt, 10);
10717
10825
  }
10718
10826
  return true;
@@ -10729,9 +10837,9 @@ class CodecInfo$1 {
10729
10837
  this.feedback.forEach(fb => {
10730
10838
  lines.push(new RtcpFbLine(this.pt, fb));
10731
10839
  });
10732
- this.fmtParams.forEach(fmt => {
10733
- lines.push(new FmtpLine(this.pt, fmt));
10734
- });
10840
+ if (this.fmtParams.size > 0) {
10841
+ lines.push(new FmtpLine(this.pt, this.fmtParams));
10842
+ }
10735
10843
  return lines;
10736
10844
  }
10737
10845
  }
@@ -11048,6 +11156,76 @@ function hasCodec(codecName, mLine) {
11048
11156
  return ((_a = ci.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === codecName.toLowerCase();
11049
11157
  });
11050
11158
  }
11159
+ var MediaCodecMimeType;
11160
+ (function (MediaCodecMimeType) {
11161
+ MediaCodecMimeType["H264"] = "video/H264";
11162
+ MediaCodecMimeType["AV1"] = "video/AV1";
11163
+ MediaCodecMimeType["OPUS"] = "audio/opus";
11164
+ })(MediaCodecMimeType || (MediaCodecMimeType = {}));
11165
+ var defaultMaxVideoEncodeFrameSize = 8160;
11166
+ var defaultMaxVideoEncodeMbps = 244800;
11167
+ var RecommendedOpusBitrates;
11168
+ (function (RecommendedOpusBitrates) {
11169
+ RecommendedOpusBitrates[RecommendedOpusBitrates["NB"] = 12000] = "NB";
11170
+ RecommendedOpusBitrates[RecommendedOpusBitrates["WB"] = 20000] = "WB";
11171
+ RecommendedOpusBitrates[RecommendedOpusBitrates["FB"] = 40000] = "FB";
11172
+ RecommendedOpusBitrates[RecommendedOpusBitrates["FB_MONO_MUSIC"] = 64000] = "FB_MONO_MUSIC";
11173
+ RecommendedOpusBitrates[RecommendedOpusBitrates["FB_STEREO_MUSIC"] = 128000] = "FB_STEREO_MUSIC";
11174
+ })(RecommendedOpusBitrates || (RecommendedOpusBitrates = {}));
11175
+ function areProfileLevelIdsCompatible(senderProfileLevelId, receiverProfileLevelId, levelAsymmetryAllowed) {
11176
+ var senderProfile = Number.parseInt("0x".concat(senderProfileLevelId), 16);
11177
+ var recvProfile = Number.parseInt("0x".concat(receiverProfileLevelId), 16);
11178
+ var senderProfileIdc = senderProfile >> 16;
11179
+ var recvProfileIdc = recvProfile >> 16;
11180
+ var senderProfileIop = (senderProfile & 0x00ff00) >> 8;
11181
+ var recvProfileIop = (recvProfile & 0x00ff00) >> 8;
11182
+ var senderLevelIdc = senderProfile & 0x0000ff;
11183
+ var recvLevelIdc = recvProfile & 0x0000ff;
11184
+ var areProfileCompatible = senderProfileIdc === recvProfileIdc && senderProfileIop === recvProfileIop || senderProfileIdc === 0x42 && recvProfileIdc === 0x42 && (senderProfileIop & 0x40) === (recvProfileIop & 0x40);
11185
+ var isLevelIdcCompatible = levelAsymmetryAllowed ? true : senderLevelIdc <= recvLevelIdc;
11186
+ return areProfileCompatible && isLevelIdcCompatible;
11187
+ }
11188
+ function areCodecsCompatible(senderCodec, receiverCodec) {
11189
+ return Object.keys(receiverCodec).every(key => {
11190
+ if (!senderCodec[key] || !receiverCodec[key]) {
11191
+ return false;
11192
+ }
11193
+ if (key === 'payloadType') {
11194
+ return true;
11195
+ }
11196
+ if (key === 'sdpFmtpLine') {
11197
+ var fmtpForSender = Object.fromEntries(parseFmtpParams(senderCodec[key]));
11198
+ var fmtpForReceiver = Object.fromEntries(parseFmtpParams(receiverCodec[key]));
11199
+ var levelAsymmetryAllowed = Object.keys(fmtpForSender).some(senderFmtpParamKey => {
11200
+ return senderFmtpParamKey === 'level-asymmetry-allowed' && fmtpForReceiver[senderFmtpParamKey] === '1' && fmtpForSender[senderFmtpParamKey] === '1';
11201
+ });
11202
+ return Object.keys(fmtpForSender).every(senderFmtpParamKey => {
11203
+ if (fmtpForReceiver[senderFmtpParamKey]) {
11204
+ if (senderFmtpParamKey === 'profile-level-id') {
11205
+ return areProfileLevelIdsCompatible(fmtpForSender[senderFmtpParamKey], fmtpForReceiver[senderFmtpParamKey], levelAsymmetryAllowed);
11206
+ }
11207
+ }
11208
+ if (senderFmtpParamKey === 'packetization-mode') {
11209
+ return fmtpForSender[senderFmtpParamKey] === fmtpForReceiver[senderFmtpParamKey];
11210
+ }
11211
+ return true;
11212
+ });
11213
+ }
11214
+ return senderCodec[key] === receiverCodec[key];
11215
+ });
11216
+ }
11217
+ function gcd(a, b) {
11218
+ return b === 0 ? a : gcd(b, a % b);
11219
+ }
11220
+ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
11221
+ var _gcd = gcd(sourceAspectRatio[0], sourceAspectRatio[1]);
11222
+ var minNumberRatiosForWidth = sourceAspectRatio[0] / _gcd;
11223
+ var minNumberRatiosForHeight = sourceAspectRatio[1] / _gcd;
11224
+ return Math.floor(Math.sqrt(requestedMaxFs * 16 * 16 / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight;
11225
+ }
11226
+ function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
11227
+ return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
11228
+ }
11051
11229
  var events = {
11052
11230
  exports: {}
11053
11231
  };
@@ -11437,814 +11615,1429 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
11437
11615
  }
11438
11616
  }
11439
11617
  class EventEmitter extends events.exports.EventEmitter {}
11440
- var es5 = {
11441
- exports: {}
11442
- };
11443
- (function (module, exports) {
11444
- !function (e, t) {
11445
- module.exports = t();
11446
- }(commonjsGlobal$3, function () {
11447
- return function (e) {
11448
- var t = {};
11449
- function r(n) {
11450
- if (t[n]) return t[n].exports;
11451
- var i = t[n] = {
11452
- i: n,
11453
- l: !1,
11454
- exports: {}
11455
- };
11456
- return e[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
11618
+ var OveruseState;
11619
+ (function (OveruseState) {
11620
+ OveruseState[OveruseState["NOT_OVERUSED"] = 0] = "NOT_OVERUSED";
11621
+ OveruseState[OveruseState["OVERUSED"] = 1] = "OVERUSED";
11622
+ })(OveruseState || (OveruseState = {}));
11623
+ class OveruseStateManager {
11624
+ constructor(callback) {
11625
+ this.monitors = [];
11626
+ this.lastOverallOveruseState = OveruseState.NOT_OVERUSED;
11627
+ this.isRunning = false;
11628
+ this.overuseUpdateCallback = callback;
11629
+ }
11630
+ addMonitor(monitor) {
11631
+ this.monitors.push(monitor);
11632
+ if (this.isRunning) {
11633
+ monitor.startMonitoring(() => this.onMonitorOveruseUpdate());
11634
+ }
11635
+ }
11636
+ start() {
11637
+ this.isRunning = true;
11638
+ this.monitors.forEach(monitor => monitor.startMonitoring(() => this.onMonitorOveruseUpdate()));
11639
+ }
11640
+ stop() {
11641
+ this.isRunning = false;
11642
+ this.monitors.forEach(monitor => monitor.stopMonitoring());
11643
+ }
11644
+ onMonitorOveruseUpdate() {
11645
+ var overuseStates = this.monitors.map(monitor => monitor.getLastOveruseState());
11646
+ var overallOveruseState = overuseStates.some(overuseState => overuseState === OveruseState.OVERUSED) ? OveruseState.OVERUSED : OveruseState.NOT_OVERUSED;
11647
+ if (overallOveruseState !== this.lastOverallOveruseState) {
11648
+ this.lastOverallOveruseState = overallOveruseState;
11649
+ this.overuseUpdateCallback(overallOveruseState);
11650
+ }
11651
+ }
11652
+ }
11653
+ var ReceiveSlotEvents;
11654
+ (function (ReceiveSlotEvents) {
11655
+ ReceiveSlotEvents["MediaStarted"] = "media-started";
11656
+ ReceiveSlotEvents["MediaStopped"] = "media-stopped";
11657
+ ReceiveSlotEvents["SourceUpdate"] = "source-update";
11658
+ })(ReceiveSlotEvents || (ReceiveSlotEvents = {}));
11659
+ class ReceiveSlot extends EventEmitter {
11660
+ constructor(idGetter, track) {
11661
+ super();
11662
+ this._idGetter = idGetter;
11663
+ this.handleTrackMuted = this.handleTrackMuted.bind(this);
11664
+ this.handleTrackUnmuted = this.handleTrackUnmuted.bind(this);
11665
+ this._stream = new MediaStream([track]);
11666
+ this.addTrackHandlers(track);
11667
+ }
11668
+ addTrackHandlers(track) {
11669
+ track.addEventListener('mute', this.handleTrackMuted);
11670
+ track.addEventListener('unmute', this.handleTrackUnmuted);
11671
+ }
11672
+ handleTrackMuted() {
11673
+ this.emit(ReceiveSlotEvents.MediaStopped);
11674
+ }
11675
+ handleTrackUnmuted() {
11676
+ this.emit(ReceiveSlotEvents.MediaStarted);
11677
+ }
11678
+ removeTrackHandlers(track) {
11679
+ track.removeEventListener('mute', this.handleTrackMuted);
11680
+ track.removeEventListener('unmute', this.handleTrackUnmuted);
11681
+ }
11682
+ replaceTrack(newTrack) {
11683
+ var _a;
11684
+ var trackToRemove = (_a = this._stream.getTracks()) === null || _a === void 0 ? void 0 : _a[0];
11685
+ if (trackToRemove) {
11686
+ this._stream.removeTrack(trackToRemove);
11687
+ this.removeTrackHandlers(trackToRemove);
11688
+ }
11689
+ this.addTrackHandlers(newTrack);
11690
+ this._stream.addTrack(newTrack);
11691
+ }
11692
+ _updateSource(state, csi) {
11693
+ this.currentRxCsi = csi;
11694
+ this.emit(ReceiveSlotEvents.SourceUpdate, state, csi);
11695
+ }
11696
+ close() {
11697
+ this._stream.getTracks().forEach(t => {
11698
+ this.removeTrackHandlers(t);
11699
+ });
11700
+ }
11701
+ get id() {
11702
+ return this._idGetter();
11703
+ }
11704
+ get stream() {
11705
+ return this._stream;
11706
+ }
11707
+ }
11708
+ ReceiveSlot.Events = ReceiveSlotEvents;
11709
+ class Transceiver {
11710
+ constructor(rtcRtpTransceiver) {
11711
+ this._rtcRtpTransceiver = rtcRtpTransceiver;
11712
+ }
11713
+ replaceTransceiver(newRtcRtpTransceiver) {
11714
+ this._rtcRtpTransceiver = newRtcRtpTransceiver;
11715
+ }
11716
+ get receiver() {
11717
+ return this._rtcRtpTransceiver.receiver;
11718
+ }
11719
+ get sender() {
11720
+ return this._rtcRtpTransceiver.sender;
11721
+ }
11722
+ get mid() {
11723
+ return this._rtcRtpTransceiver.mid;
11724
+ }
11725
+ close() {
11726
+ this._rtcRtpTransceiver.stop();
11727
+ }
11728
+ }
11729
+ class ReceiveOnlyTransceiver extends Transceiver {
11730
+ constructor(rtcRtpTransceiver, idGetter) {
11731
+ super(rtcRtpTransceiver);
11732
+ this._receiveSlot = new ReceiveSlot(() => {
11733
+ if (!this._rtcRtpTransceiver.mid) {
11734
+ return null;
11457
11735
  }
11458
- return r.m = e, r.c = t, r.d = function (e, t, n) {
11459
- r.o(e, t) || Object.defineProperty(e, t, {
11460
- enumerable: !0,
11461
- get: n
11462
- });
11463
- }, r.r = function (e) {
11464
- "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
11465
- value: "Module"
11466
- }), Object.defineProperty(e, "__esModule", {
11467
- value: !0
11736
+ return idGetter(this._rtcRtpTransceiver.mid);
11737
+ }, this._rtcRtpTransceiver.receiver.track);
11738
+ }
11739
+ replaceTransceiver(newRtcRtpTransceiver) {
11740
+ super.replaceTransceiver(newRtcRtpTransceiver);
11741
+ this._receiveSlot.replaceTrack(newRtcRtpTransceiver.receiver.track);
11742
+ }
11743
+ close() {
11744
+ super.close();
11745
+ this._receiveSlot.close();
11746
+ }
11747
+ get receiveSlot() {
11748
+ return this._receiveSlot;
11749
+ }
11750
+ getStats() {
11751
+ return this.receiver.getStats();
11752
+ }
11753
+ }
11754
+ ReceiveOnlyTransceiver.rid = '1';
11755
+ class JmpLine extends Line {
11756
+ static fromSdpLine(line) {
11757
+ if (!JmpLine.regex.test(line)) {
11758
+ return undefined;
11759
+ }
11760
+ return new JmpLine();
11761
+ }
11762
+ toSdpLine() {
11763
+ return "a=jmp";
11764
+ }
11765
+ }
11766
+ JmpLine.regex = /^jmp$/;
11767
+ class JmpStreamIdModeLine extends Line {
11768
+ constructor(streamIdMode) {
11769
+ super();
11770
+ this.streamIdMode = streamIdMode;
11771
+ }
11772
+ static fromSdpLine(line) {
11773
+ if (!JmpStreamIdModeLine.regex.test(line)) {
11774
+ return undefined;
11775
+ }
11776
+ var tokens = line.match(JmpStreamIdModeLine.regex);
11777
+ var mode = tokens[1];
11778
+ return new JmpStreamIdModeLine(mode);
11779
+ }
11780
+ toSdpLine() {
11781
+ return "a=jmp-stream-id-mode:".concat(this.streamIdMode);
11782
+ }
11783
+ }
11784
+ JmpStreamIdModeLine.regex = /^jmp-stream-id-mode:(MID-RID|SSRC)$/;
11785
+ class JmpSourceLine extends Line {
11786
+ constructor(source, csi) {
11787
+ super();
11788
+ this.source = source;
11789
+ this.csi = csi;
11790
+ }
11791
+ static fromSdpLine(line) {
11792
+ if (!JmpSourceLine.regex.test(line)) {
11793
+ return undefined;
11794
+ }
11795
+ var tokens = line.match(JmpSourceLine.regex);
11796
+ var source = tokens[1];
11797
+ var csi = tokens[2];
11798
+ return new JmpSourceLine(source, csi);
11799
+ }
11800
+ toSdpLine() {
11801
+ var line = "a=jmp-source:".concat(this.source);
11802
+ if (this.csi) {
11803
+ line += " csi=".concat(this.csi);
11804
+ }
11805
+ return line;
11806
+ }
11807
+ }
11808
+ JmpSourceLine.regex = new RegExp("^jmp-source:(".concat(ANY_NON_WS, ") (?:csi=(").concat(ANY_NON_WS, "))"));
11809
+ DefaultSdpGrammar.addParser('a', JmpLine.fromSdpLine);
11810
+ DefaultSdpGrammar.addParser('a', JmpSourceLine.fromSdpLine);
11811
+ DefaultSdpGrammar.addParser('a', JmpStreamIdModeLine.fromSdpLine);
11812
+ function deepCopy(source) {
11813
+ return Array.isArray(source) ? source.map(item => deepCopy(item)) : source instanceof Map ? new Map(source) : source instanceof Date ? new Date(source.getTime()) : source && typeof source === 'object' ? Object.getOwnPropertyNames(source).reduce((o, prop) => {
11814
+ Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
11815
+ o[prop] = deepCopy(source[prop]);
11816
+ return o;
11817
+ }, Object.create(Object.getPrototypeOf(source))) : source;
11818
+ }
11819
+ function getMediaTypeForMline(mLine) {
11820
+ var _a, _b;
11821
+ var mediaFamily;
11822
+ if (mLine.type.toLowerCase() === MediaFamily$1.Audio.toLowerCase()) {
11823
+ mediaFamily = MediaFamily$1.Audio;
11824
+ } else if (mLine.type.toLowerCase() === MediaFamily$1.Video.toLowerCase()) {
11825
+ mediaFamily = MediaFamily$1.Video;
11826
+ } else {
11827
+ throw Error("Mline type doesn't match any known MediaFamily: ".concat(mLine.type));
11828
+ }
11829
+ var mediaContent;
11830
+ if ((_b = (_a = mLine.content) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.some(v => v.toLowerCase() === 'slides')) {
11831
+ mediaContent = MediaContent$1.Slides;
11832
+ } else {
11833
+ mediaContent = MediaContent$1.Main;
11834
+ }
11835
+ return getMediaType(mediaFamily, mediaContent);
11836
+ }
11837
+ function filterCodecs(parsedSdp, allowedCodecs) {
11838
+ var allowedLowerCase = allowedCodecs.map(s => s.toLowerCase());
11839
+ parsedSdp.avMedia.map(m => [...m.codecs.values()].map(c => c.name)).flat().filter(codecName => !allowedLowerCase.includes(codecName.toLowerCase())).forEach(c => removeCodec(parsedSdp, c));
11840
+ }
11841
+ function setMaxBandwidth(parsedSdp, maxBandwidth) {
11842
+ parsedSdp.avMedia.forEach(mline => {
11843
+ mline.bandwidth = new BandwidthLine('TIAS', maxBandwidth);
11844
+ });
11845
+ }
11846
+ function setupBundle(parsedSdp, bundlePolicy) {
11847
+ if (bundlePolicy === 'compat') {
11848
+ var audioMids = parsedSdp.avMedia.filter(m => m.type === 'audio').map(m => m.mid);
11849
+ var videoMids = parsedSdp.avMedia.filter(m => m.type === 'video').map(m => m.mid);
11850
+ parsedSdp.session.groups.splice(0, parsedSdp.session.groups.length);
11851
+ parsedSdp.session.groups.push(new BundleGroupLine(audioMids));
11852
+ parsedSdp.session.groups.push(new BundleGroupLine(videoMids));
11853
+ }
11854
+ }
11855
+ function filterRecvOnlyMlines(parsedSdp) {
11856
+ var filteredMids = [];
11857
+ parsedSdp.media = parsedSdp.media.filter(mLine => {
11858
+ if (mLine instanceof ApplicationMediaDescription || mLine instanceof AvMediaDescription && mLine.direction !== 'recvonly') {
11859
+ filteredMids.push(mLine.mid);
11860
+ return true;
11861
+ }
11862
+ return false;
11863
+ });
11864
+ parsedSdp.session.groups.forEach(g => {
11865
+ g.mids = g.mids.filter(m => filteredMids.includes(m));
11866
+ });
11867
+ }
11868
+ function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
11869
+ parsedAnswer.session.groups = parsedOffer.session.groups;
11870
+ parsedAnswer.media = parsedOffer.media.map(offerMline => {
11871
+ if (!offerMline.mid) {
11872
+ throw new Error("Offer mline is missing MID");
11873
+ }
11874
+ var answerMline = parsedAnswer.media.find(m => m.mid === offerMline.mid);
11875
+ if (answerMline) {
11876
+ if (answerMline instanceof AvMediaDescription) {
11877
+ [...answerMline.codecs.values()].forEach(ci => {
11878
+ ci.fmtParams.set('x-google-start-bitrate', '60000');
11468
11879
  });
11469
- }, r.t = function (e, t) {
11470
- if (1 & t && (e = r(e)), 8 & t) return e;
11471
- if (4 & t && "object" == typeof e && e && e.__esModule) return e;
11472
- var n = Object.create(null);
11473
- if (r.r(n), Object.defineProperty(n, "default", {
11474
- enumerable: !0,
11475
- value: e
11476
- }), 2 & t && "string" != typeof e) for (var i in e) {
11477
- r.d(n, i, function (t) {
11478
- return e[t];
11479
- }.bind(null, i));
11880
+ }
11881
+ return answerMline;
11882
+ }
11883
+ if (!(offerMline instanceof AvMediaDescription)) {
11884
+ throw new Error("Answer is missing a non-media mline: ".concat(offerMline.mid));
11885
+ }
11886
+ var startingMline = parsedAnswer.avMedia.find(m => m.type === offerMline.type);
11887
+ if (!startingMline) {
11888
+ throw new Error("Answer has no mline of type ".concat(offerMline.type, ", can't generate synthetic answer mline for mid ").concat(offerMline.mid));
11889
+ }
11890
+ var fakeCorrespondingMline = deepCopy(startingMline);
11891
+ fakeCorrespondingMline.mid = offerMline.mid;
11892
+ fakeCorrespondingMline.simulcast = undefined;
11893
+ if (offerMline.direction === 'sendrecv' || offerMline.direction === 'sendonly') {
11894
+ fakeCorrespondingMline.direction = 'recvonly';
11895
+ }
11896
+ if (offerMline.direction === 'recvonly') {
11897
+ fakeCorrespondingMline.direction = 'sendonly';
11898
+ var ingressSignaler = streamSignalerManager.getIngressStreamSignalerOrThrow(offerMline.mid);
11899
+ ingressSignaler.signalRemoteStreams(fakeCorrespondingMline);
11900
+ }
11901
+ return fakeCorrespondingMline;
11902
+ });
11903
+ }
11904
+ function injectContentTypes(sdp, contentTypeMap) {
11905
+ contentTypeMap.forEach((mediaContent, mid) => {
11906
+ var mline = sdp.media.find(m => m.mid === mid);
11907
+ if (!mline) {
11908
+ throw new Error("Error trying to set content type for mid ".concat(mid, ": not found in SDP"));
11909
+ }
11910
+ if (mediaContent === MediaContent$1.Slides) {
11911
+ mline.addLine(new ContentLine(['slides']));
11912
+ }
11913
+ });
11914
+ }
11915
+ function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
11916
+ parsedSdp.avMedia.filter(mLine => mLine.direction === 'sendrecv' || mLine.direction === 'sendonly').forEach(mLine => {
11917
+ if (!mLine.otherLines.find(line => line instanceof JmpLine)) {
11918
+ mLine.addLine(new JmpLine());
11919
+ }
11920
+ if (!mLine.otherLines.find(line => line instanceof JmpSourceLine)) {
11921
+ var mediaType = getMediaTypeForMline(mLine);
11922
+ var csi = csiMap.get(mediaType);
11923
+ if (!csi) {
11924
+ throw new Error("Unable to find CSI for MediaType ".concat(mediaType));
11925
+ }
11926
+ mLine.addLine(new JmpSourceLine(mLine.mid, csi.toString()));
11927
+ }
11928
+ if (!mLine.otherLines.find(line => line instanceof JmpStreamIdModeLine)) {
11929
+ mLine.addLine(new JmpStreamIdModeLine(streamSignalingMode));
11930
+ }
11931
+ });
11932
+ }
11933
+ class SendOnlyTransceiver extends Transceiver {
11934
+ constructor(rtcpRtpTransceiver, csi) {
11935
+ super(rtcpRtpTransceiver);
11936
+ this.requested = false;
11937
+ this.csi = csi;
11938
+ this.handleTrackChange = this.handleTrackChange.bind(this);
11939
+ }
11940
+ handleTrackChange() {
11941
+ var _a;
11942
+ return __awaiter(this, void 0, void 0, function* () {
11943
+ if (this.requested) {
11944
+ yield this.sender.replaceTrack(((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null);
11945
+ }
11946
+ });
11947
+ }
11948
+ replacePublishedTrack(newTrack) {
11949
+ var _a, _b;
11950
+ return __awaiter(this, void 0, void 0, function* () {
11951
+ (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.off(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
11952
+ (_b = this.publishedTrack) === null || _b === void 0 ? void 0 : _b.setPublished(false);
11953
+ if (this.requested) {
11954
+ yield this.sender.replaceTrack((newTrack === null || newTrack === void 0 ? void 0 : newTrack.underlyingTrack) || null);
11955
+ }
11956
+ this.publishedTrack = newTrack;
11957
+ newTrack === null || newTrack === void 0 ? void 0 : newTrack.on(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
11958
+ newTrack === null || newTrack === void 0 ? void 0 : newTrack.setPublished(true);
11959
+ });
11960
+ }
11961
+ setTrackRequested(requested) {
11962
+ var _a;
11963
+ return __awaiter(this, void 0, void 0, function* () {
11964
+ if (this.requested !== requested) {
11965
+ this.requested = requested;
11966
+ var newTrack = requested ? ((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null : null;
11967
+ yield this.sender.replaceTrack(newTrack);
11968
+ }
11969
+ });
11970
+ }
11971
+ updateSimulcastStreamStates(requestedIdEncodingParamsMap) {
11972
+ return __awaiter(this, void 0, void 0, function* () {
11973
+ var sendParameters = this.sender.getParameters();
11974
+ sendParameters.encodings.forEach((encoding, index) => {
11975
+ var encodingParams = requestedIdEncodingParamsMap.get(index);
11976
+ encoding.active = Boolean(encodingParams);
11977
+ if (encodingParams) {
11978
+ if (encodingParams.scaleDownRatio >= 1 && encoding.scaleResolutionDownBy !== encodingParams.scaleDownRatio) {
11979
+ encoding.scaleResolutionDownBy = encodingParams.scaleDownRatio;
11980
+ }
11981
+ if (encodingParams.maxPayloadBitsPerSecond) {
11982
+ encoding.maxBitrate = encodingParams.maxPayloadBitsPerSecond;
11983
+ }
11480
11984
  }
11481
- return n;
11482
- }, r.n = function (e) {
11483
- var t = e && e.__esModule ? function () {
11484
- return e.default;
11485
- } : function () {
11486
- return e;
11487
- };
11488
- return r.d(t, "a", t), t;
11489
- }, r.o = function (e, t) {
11490
- return Object.prototype.hasOwnProperty.call(e, t);
11491
- }, r.p = "", r(r.s = 90);
11492
- }({
11493
- 17: function _(e, t, r) {
11494
- t.__esModule = !0, t.default = void 0;
11495
- var n = r(18),
11496
- i = function () {
11497
- function e() {}
11498
- return e.getFirstMatch = function (e, t) {
11499
- var r = t.match(e);
11500
- return r && r.length > 0 && r[1] || "";
11501
- }, e.getSecondMatch = function (e, t) {
11502
- var r = t.match(e);
11503
- return r && r.length > 1 && r[2] || "";
11504
- }, e.matchAndReturnConst = function (e, t, r) {
11505
- if (e.test(t)) return r;
11506
- }, e.getWindowsVersionName = function (e) {
11507
- switch (e) {
11508
- case "NT":
11509
- return "NT";
11510
- case "XP":
11511
- return "XP";
11512
- case "NT 5.0":
11513
- return "2000";
11514
- case "NT 5.1":
11515
- return "XP";
11516
- case "NT 5.2":
11517
- return "2003";
11518
- case "NT 6.0":
11519
- return "Vista";
11520
- case "NT 6.1":
11521
- return "7";
11522
- case "NT 6.2":
11523
- return "8";
11524
- case "NT 6.3":
11525
- return "8.1";
11526
- case "NT 10.0":
11527
- return "10";
11528
- default:
11529
- return;
11530
- }
11531
- }, e.getMacOSVersionName = function (e) {
11532
- var t = e.split(".").splice(0, 2).map(function (e) {
11533
- return parseInt(e, 10) || 0;
11534
- });
11535
- if (t.push(0), 10 === t[0]) switch (t[1]) {
11536
- case 5:
11537
- return "Leopard";
11538
- case 6:
11539
- return "Snow Leopard";
11540
- case 7:
11541
- return "Lion";
11542
- case 8:
11543
- return "Mountain Lion";
11544
- case 9:
11545
- return "Mavericks";
11546
- case 10:
11547
- return "Yosemite";
11548
- case 11:
11549
- return "El Capitan";
11550
- case 12:
11551
- return "Sierra";
11552
- case 13:
11553
- return "High Sierra";
11554
- case 14:
11555
- return "Mojave";
11556
- case 15:
11557
- return "Catalina";
11558
- default:
11559
- return;
11560
- }
11561
- }, e.getAndroidVersionName = function (e) {
11562
- var t = e.split(".").splice(0, 2).map(function (e) {
11563
- return parseInt(e, 10) || 0;
11564
- });
11565
- if (t.push(0), !(1 === t[0] && t[1] < 5)) return 1 === t[0] && t[1] < 6 ? "Cupcake" : 1 === t[0] && t[1] >= 6 ? "Donut" : 2 === t[0] && t[1] < 2 ? "Eclair" : 2 === t[0] && 2 === t[1] ? "Froyo" : 2 === t[0] && t[1] > 2 ? "Gingerbread" : 3 === t[0] ? "Honeycomb" : 4 === t[0] && t[1] < 1 ? "Ice Cream Sandwich" : 4 === t[0] && t[1] < 4 ? "Jelly Bean" : 4 === t[0] && t[1] >= 4 ? "KitKat" : 5 === t[0] ? "Lollipop" : 6 === t[0] ? "Marshmallow" : 7 === t[0] ? "Nougat" : 8 === t[0] ? "Oreo" : 9 === t[0] ? "Pie" : void 0;
11566
- }, e.getVersionPrecision = function (e) {
11567
- return e.split(".").length;
11568
- }, e.compareVersions = function (t, r, n) {
11569
- void 0 === n && (n = !1);
11570
- var i = e.getVersionPrecision(t),
11571
- s = e.getVersionPrecision(r),
11572
- a = Math.max(i, s),
11573
- o = 0,
11574
- u = e.map([t, r], function (t) {
11575
- var r = a - e.getVersionPrecision(t),
11576
- n = t + new Array(r + 1).join(".0");
11577
- return e.map(n.split("."), function (e) {
11578
- return new Array(20 - e.length).join("0") + e;
11579
- }).reverse();
11580
- });
11581
- for (n && (o = a - Math.min(i, s)), a -= 1; a >= o;) {
11582
- if (u[0][a] > u[1][a]) return 1;
11583
- if (u[0][a] === u[1][a]) {
11584
- if (a === o) return 0;
11585
- a -= 1;
11586
- } else if (u[0][a] < u[1][a]) return -1;
11587
- }
11588
- }, e.map = function (e, t) {
11589
- var r,
11590
- n = [];
11591
- if (Array.prototype.map) return Array.prototype.map.call(e, t);
11592
- for (r = 0; r < e.length; r += 1) {
11593
- n.push(t(e[r]));
11594
- }
11595
- return n;
11596
- }, e.find = function (e, t) {
11597
- var r, n;
11598
- if (Array.prototype.find) return Array.prototype.find.call(e, t);
11599
- for (r = 0, n = e.length; r < n; r += 1) {
11600
- var i = e[r];
11601
- if (t(i, r)) return i;
11602
- }
11603
- }, e.assign = function (e) {
11604
- for (var t, r, n = e, i = arguments.length, s = new Array(i > 1 ? i - 1 : 0), a = 1; a < i; a++) {
11605
- s[a - 1] = arguments[a];
11606
- }
11607
- if (Object.assign) return Object.assign.apply(Object, [e].concat(s));
11608
- var o = function o() {
11609
- var e = s[t];
11610
- "object" == typeof e && null !== e && Object.keys(e).forEach(function (t) {
11611
- n[t] = e[t];
11612
- });
11613
- };
11614
- for (t = 0, r = s.length; t < r; t += 1) {
11615
- o();
11616
- }
11617
- return e;
11618
- }, e.getBrowserAlias = function (e) {
11619
- return n.BROWSER_ALIASES_MAP[e];
11620
- }, e.getBrowserTypeByAlias = function (e) {
11621
- return n.BROWSER_MAP[e] || "";
11622
- }, e;
11623
- }();
11624
- t.default = i, e.exports = t.default;
11625
- },
11626
- 18: function _(e, t, r) {
11627
- t.__esModule = !0, t.ENGINE_MAP = t.OS_MAP = t.PLATFORMS_MAP = t.BROWSER_MAP = t.BROWSER_ALIASES_MAP = void 0;
11628
- t.BROWSER_ALIASES_MAP = {
11629
- "Amazon Silk": "amazon_silk",
11630
- "Android Browser": "android",
11631
- Bada: "bada",
11632
- BlackBerry: "blackberry",
11633
- Chrome: "chrome",
11634
- Chromium: "chromium",
11635
- Electron: "electron",
11636
- Epiphany: "epiphany",
11637
- Firefox: "firefox",
11638
- Focus: "focus",
11639
- Generic: "generic",
11640
- "Google Search": "google_search",
11641
- Googlebot: "googlebot",
11642
- "Internet Explorer": "ie",
11643
- "K-Meleon": "k_meleon",
11644
- Maxthon: "maxthon",
11645
- "Microsoft Edge": "edge",
11646
- "MZ Browser": "mz",
11647
- "NAVER Whale Browser": "naver",
11648
- Opera: "opera",
11649
- "Opera Coast": "opera_coast",
11650
- PhantomJS: "phantomjs",
11651
- Puffin: "puffin",
11652
- QupZilla: "qupzilla",
11653
- QQ: "qq",
11654
- QQLite: "qqlite",
11655
- Safari: "safari",
11656
- Sailfish: "sailfish",
11657
- "Samsung Internet for Android": "samsung_internet",
11658
- SeaMonkey: "seamonkey",
11659
- Sleipnir: "sleipnir",
11660
- Swing: "swing",
11661
- Tizen: "tizen",
11662
- "UC Browser": "uc",
11663
- Vivaldi: "vivaldi",
11664
- "WebOS Browser": "webos",
11665
- WeChat: "wechat",
11666
- "Yandex Browser": "yandex",
11667
- Roku: "roku"
11668
- };
11669
- t.BROWSER_MAP = {
11670
- amazon_silk: "Amazon Silk",
11671
- android: "Android Browser",
11672
- bada: "Bada",
11673
- blackberry: "BlackBerry",
11674
- chrome: "Chrome",
11675
- chromium: "Chromium",
11676
- electron: "Electron",
11677
- epiphany: "Epiphany",
11678
- firefox: "Firefox",
11679
- focus: "Focus",
11680
- generic: "Generic",
11681
- googlebot: "Googlebot",
11682
- google_search: "Google Search",
11683
- ie: "Internet Explorer",
11684
- k_meleon: "K-Meleon",
11685
- maxthon: "Maxthon",
11686
- edge: "Microsoft Edge",
11687
- mz: "MZ Browser",
11688
- naver: "NAVER Whale Browser",
11689
- opera: "Opera",
11690
- opera_coast: "Opera Coast",
11691
- phantomjs: "PhantomJS",
11692
- puffin: "Puffin",
11693
- qupzilla: "QupZilla",
11694
- qq: "QQ Browser",
11695
- qqlite: "QQ Browser Lite",
11696
- safari: "Safari",
11697
- sailfish: "Sailfish",
11698
- samsung_internet: "Samsung Internet for Android",
11699
- seamonkey: "SeaMonkey",
11700
- sleipnir: "Sleipnir",
11701
- swing: "Swing",
11702
- tizen: "Tizen",
11703
- uc: "UC Browser",
11704
- vivaldi: "Vivaldi",
11705
- webos: "WebOS Browser",
11706
- wechat: "WeChat",
11707
- yandex: "Yandex Browser"
11708
- };
11709
- t.PLATFORMS_MAP = {
11710
- tablet: "tablet",
11711
- mobile: "mobile",
11712
- desktop: "desktop",
11713
- tv: "tv"
11714
- };
11715
- t.OS_MAP = {
11716
- WindowsPhone: "Windows Phone",
11717
- Windows: "Windows",
11718
- MacOS: "macOS",
11719
- iOS: "iOS",
11720
- Android: "Android",
11721
- WebOS: "WebOS",
11722
- BlackBerry: "BlackBerry",
11723
- Bada: "Bada",
11724
- Tizen: "Tizen",
11725
- Linux: "Linux",
11726
- ChromeOS: "Chrome OS",
11727
- PlayStation4: "PlayStation 4",
11728
- Roku: "Roku"
11729
- };
11730
- t.ENGINE_MAP = {
11731
- EdgeHTML: "EdgeHTML",
11732
- Blink: "Blink",
11733
- Trident: "Trident",
11734
- Presto: "Presto",
11735
- Gecko: "Gecko",
11736
- WebKit: "WebKit"
11985
+ });
11986
+ yield this.sender.setParameters(sendParameters);
11987
+ });
11988
+ }
11989
+ getScaleDownRatio(expectedMaxFs) {
11990
+ var _a;
11991
+ if (!expectedMaxFs) {
11992
+ return -1;
11993
+ }
11994
+ if (!this.publishedTrack) {
11995
+ return -1;
11996
+ }
11997
+ var setting = (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
11998
+ var sourceHeight = setting === null || setting === void 0 ? void 0 : setting.height;
11999
+ var sourceWidth = setting === null || setting === void 0 ? void 0 : setting.width;
12000
+ if (!sourceWidth || !sourceHeight) {
12001
+ return -1;
12002
+ }
12003
+ return Math.max(getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, expectedMaxFs), 1.0);
12004
+ }
12005
+ publishTrack(track) {
12006
+ return this.replacePublishedTrack(track);
12007
+ }
12008
+ unpublishTrack() {
12009
+ return this.replacePublishedTrack();
12010
+ }
12011
+ setActive(enabled) {
12012
+ var direction = enabled ? 'sendrecv' : 'inactive';
12013
+ this._rtcRtpTransceiver.direction = direction;
12014
+ return this._rtcRtpTransceiver.direction !== this._rtcRtpTransceiver.currentDirection;
12015
+ }
12016
+ getIngressPayloadType(mimeType) {
12017
+ var senderCodecs = this.sender.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
12018
+ var receiverCodecs = this.receiver.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
12019
+ if (!senderCodecs || !receiverCodecs || senderCodecs.length === 0 || receiverCodecs.length === 0) {
12020
+ throw new Error("sender codecs or receiver codecs is undefined or empty");
12021
+ }
12022
+ var senderCodec = senderCodecs[0];
12023
+ var targetCodec = receiverCodecs.find(receiverCodec => {
12024
+ return areCodecsCompatible(senderCodec, receiverCodec);
12025
+ });
12026
+ if (!targetCodec || !targetCodec.payloadType) {
12027
+ throw new Error("ingress payload type is not well defined in receiver codecs");
12028
+ }
12029
+ return targetCodec.payloadType;
12030
+ }
12031
+ getStats() {
12032
+ return this.sender.getStats();
12033
+ }
12034
+ }
12035
+ class StatsManager {
12036
+ constructor(statsGetter) {
12037
+ var statsPreprocessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => __awaiter(this, void 0, void 0, function* () {});
12038
+ this.statsGetter = statsGetter;
12039
+ this.statsPreProcessor = statsPreprocessor;
12040
+ }
12041
+ getStats() {
12042
+ return __awaiter(this, void 0, void 0, function* () {
12043
+ var statsReport = yield this.statsGetter();
12044
+ var statsObject = {};
12045
+ statsReport.forEach((value, key) => {
12046
+ statsObject[key] = value;
12047
+ });
12048
+ yield this.statsPreProcessor(statsObject);
12049
+ return statsObject;
12050
+ });
12051
+ }
12052
+ }
12053
+ var simulcastMaxFrameSizes = {
12054
+ 0: '240',
12055
+ 1: '2304',
12056
+ 2: '8160'
12057
+ };
12058
+ class RidIngressStreamSignaler {
12059
+ constructor(mid) {
12060
+ this.mid = mid;
12061
+ }
12062
+ getReceiverId() {
12063
+ return {
12064
+ mid: this.mid,
12065
+ rid: '1'
12066
+ };
12067
+ }
12068
+ signalLocalStreams(mLine) {}
12069
+ signalRemoteStreams(mLine) {}
12070
+ }
12071
+ class RidEgressStreamSignaler {
12072
+ constructor(mid) {
12073
+ this.streamIds = [];
12074
+ this.mid = mid;
12075
+ }
12076
+ signalStreams(simulcastEnabled, _rtxEnabled, mLine) {
12077
+ mLine.ssrcGroups = [];
12078
+ if (this.streamIds.length === 0) {
12079
+ if (simulcastEnabled) {
12080
+ this.streamIds = [{
12081
+ mid: this.mid,
12082
+ rid: 'low'
12083
+ }, {
12084
+ mid: this.mid,
12085
+ rid: 'medium'
12086
+ }, {
12087
+ mid: this.mid,
12088
+ rid: 'high'
12089
+ }];
12090
+ } else {
12091
+ this.streamIds = [{
12092
+ mid: this.mid
12093
+ }];
12094
+ }
12095
+ }
12096
+ if (simulcastEnabled) {
12097
+ mLine.rids = this.streamIds.map((streamId, index) => new RidLine(streamId.rid, 'send', "max-fs=".concat(simulcastMaxFrameSizes[index])));
12098
+ mLine.simulcast = new SimulcastLine(SimulcastLayerList.fromString('low;medium;high'), new SimulcastLayerList());
12099
+ }
12100
+ }
12101
+ getSenderIds() {
12102
+ return this.streamIds;
12103
+ }
12104
+ getEncodingIndexForStreamId(streamId) {
12105
+ return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
12106
+ }
12107
+ }
12108
+ function generateSsrc() {
12109
+ return Math.floor(Math.random() * 0xffffffff) + 1;
12110
+ }
12111
+ class SsrcIngressStreamSignaler {
12112
+ constructor() {
12113
+ this.ssrc = generateSsrc();
12114
+ }
12115
+ getReceiverId() {
12116
+ return Object.assign({
12117
+ ssrc: this.ssrc
12118
+ }, this.rtxSsrc ? {
12119
+ rtxSsrc: this.rtxSsrc
12120
+ } : {});
12121
+ }
12122
+ signalLocalStreams(_mLine) {}
12123
+ signalRemoteStreams(mLine) {
12124
+ mLine.addLine(new SsrcLine(this.ssrc, 'cname', "".concat(this.ssrc, "-cname")));
12125
+ mLine.addLine(new SsrcLine(this.ssrc, 'msid', '-', '1'));
12126
+ if (hasCodec('rtx', mLine)) {
12127
+ this.rtxSsrc = generateSsrc();
12128
+ mLine.addLine(new SsrcLine(this.rtxSsrc, 'cname', "".concat(this.ssrc, "-cname")));
12129
+ mLine.addLine(new SsrcLine(this.rtxSsrc, 'msid', '-', '1'));
12130
+ mLine.addLine(new SsrcGroupLine('FID', [this.ssrc, this.rtxSsrc]));
12131
+ }
12132
+ }
12133
+ }
12134
+ class SsrcEgressStreamSignaler {
12135
+ constructor() {
12136
+ this.streamIds = [];
12137
+ }
12138
+ signalStreams(simulcastEnabled, rtxEnabled, mLine) {
12139
+ mLine.rids = [];
12140
+ mLine.simulcast = undefined;
12141
+ mLine.ssrcs = [];
12142
+ mLine.ssrcGroups = [];
12143
+ if (this.streamIds.length === 0) {
12144
+ var numStreams = simulcastEnabled ? 3 : 1;
12145
+ [...Array(numStreams).keys()].forEach(() => {
12146
+ var newStreamId = {
12147
+ ssrc: generateSsrc()
11737
12148
  };
11738
- },
11739
- 90: function _(e, t, r) {
11740
- t.__esModule = !0, t.default = void 0;
11741
- var n,
11742
- i = (n = r(91)) && n.__esModule ? n : {
11743
- default: n
11744
- },
11745
- s = r(18);
11746
- function a(e, t) {
11747
- for (var r = 0; r < t.length; r++) {
11748
- var n = t[r];
11749
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
11750
- }
12149
+ if (rtxEnabled) {
12150
+ newStreamId.rtxSsrc = generateSsrc();
11751
12151
  }
11752
- var o = function () {
11753
- function e() {}
11754
- var t, r, n;
11755
- return e.getParser = function (e, t) {
11756
- if (void 0 === t && (t = !1), "string" != typeof e) throw new Error("UserAgent should be a string");
11757
- return new i.default(e, t);
11758
- }, e.parse = function (e) {
11759
- return new i.default(e).getResult();
11760
- }, t = e, n = [{
11761
- key: "BROWSER_MAP",
11762
- get: function get() {
11763
- return s.BROWSER_MAP;
11764
- }
11765
- }, {
11766
- key: "ENGINE_MAP",
11767
- get: function get() {
11768
- return s.ENGINE_MAP;
11769
- }
11770
- }, {
11771
- key: "OS_MAP",
11772
- get: function get() {
11773
- return s.OS_MAP;
11774
- }
11775
- }, {
11776
- key: "PLATFORMS_MAP",
11777
- get: function get() {
11778
- return s.PLATFORMS_MAP;
11779
- }
11780
- }], (r = null) && a(t.prototype, r), n && a(t, n), e;
11781
- }();
11782
- t.default = o, e.exports = t.default;
11783
- },
11784
- 91: function _(e, t, r) {
11785
- t.__esModule = !0, t.default = void 0;
11786
- var n = u(r(92)),
11787
- i = u(r(93)),
11788
- s = u(r(94)),
11789
- a = u(r(95)),
11790
- o = u(r(17));
11791
- function u(e) {
11792
- return e && e.__esModule ? e : {
11793
- default: e
11794
- };
12152
+ this.streamIds.push(newStreamId);
12153
+ });
12154
+ }
12155
+ this.streamIds.forEach(streamId => {
12156
+ var rtpSsrc = streamId.ssrc;
12157
+ mLine.addLine(new SsrcLine(rtpSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
12158
+ mLine.addLine(new SsrcLine(rtpSsrc, 'msid', '-', '1'));
12159
+ if (rtxEnabled) {
12160
+ var rtxSsrc = streamId.rtxSsrc;
12161
+ mLine.addLine(new SsrcLine(rtxSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
12162
+ mLine.addLine(new SsrcLine(rtxSsrc, 'msid', '-', '1'));
12163
+ mLine.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
12164
+ }
12165
+ });
12166
+ if (simulcastEnabled) {
12167
+ mLine.addLine(new SsrcGroupLine('SIM', this.streamIds.map(streamId => streamId.ssrc)));
12168
+ }
12169
+ }
12170
+ getSenderIds() {
12171
+ return this.streamIds;
12172
+ }
12173
+ getEncodingIndexForStreamId(streamId) {
12174
+ return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
12175
+ }
12176
+ }
12177
+ class StreamSignalerManager {
12178
+ constructor(streamSignalingMode) {
12179
+ this.egressStreamSignalersByMid = new Map();
12180
+ this.ingressStreamsSignalersByMid = new Map();
12181
+ this.ingressStreamSignalingMode = streamSignalingMode;
12182
+ this.egressStreamSignalingMode = streamSignalingMode;
12183
+ }
12184
+ getOrCreateEgressStreamSignaler(mid) {
12185
+ var existing = this.getEgressStreamSignaler(mid);
12186
+ if (existing) {
12187
+ return existing;
12188
+ }
12189
+ var newSignaler;
12190
+ if (this.egressStreamSignalingMode === 'MID-RID') {
12191
+ newSignaler = new RidEgressStreamSignaler(mid);
12192
+ } else {
12193
+ newSignaler = new SsrcEgressStreamSignaler();
12194
+ }
12195
+ this.egressStreamSignalersByMid.set(mid, newSignaler);
12196
+ return newSignaler;
12197
+ }
12198
+ getEgressStreamSignalerOrThrow(mid) {
12199
+ var existing = this.getEgressStreamSignaler(mid);
12200
+ if (!existing) {
12201
+ throw new Error("Couldn't find EgressStreamSignaler for mid ".concat(mid));
12202
+ }
12203
+ return existing;
12204
+ }
12205
+ getEgressStreamSignaler(mid) {
12206
+ return this.egressStreamSignalersByMid.get(mid);
12207
+ }
12208
+ getOrCreateIngressStreamSignaler(mid) {
12209
+ var existing = this.getIngressStreamSignaler(mid);
12210
+ if (existing) {
12211
+ return existing;
12212
+ }
12213
+ var newSignaler;
12214
+ if (this.ingressStreamSignalingMode === 'MID-RID') {
12215
+ newSignaler = new RidIngressStreamSignaler(mid);
12216
+ } else {
12217
+ newSignaler = new SsrcIngressStreamSignaler();
12218
+ }
12219
+ this.ingressStreamsSignalersByMid.set(mid, newSignaler);
12220
+ return newSignaler;
12221
+ }
12222
+ getIngressStreamSignaler(mid) {
12223
+ return this.ingressStreamsSignalersByMid.get(mid);
12224
+ }
12225
+ getIngressStreamSignalerOrThrow(mid) {
12226
+ var existing = this.getIngressStreamSignaler(mid);
12227
+ if (!existing) {
12228
+ throw new Error("Couldn't find IngressStreamSignaler for mid ".concat(mid));
12229
+ }
12230
+ return existing;
12231
+ }
12232
+ }
12233
+ var es5 = {
12234
+ exports: {}
12235
+ };
12236
+ (function (module, exports) {
12237
+ !function (e, t) {
12238
+ module.exports = t();
12239
+ }(commonjsGlobal$3, function () {
12240
+ return function (e) {
12241
+ var t = {};
12242
+ function r(n) {
12243
+ if (t[n]) return t[n].exports;
12244
+ var i = t[n] = {
12245
+ i: n,
12246
+ l: !1,
12247
+ exports: {}
12248
+ };
12249
+ return e[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
12250
+ }
12251
+ return r.m = e, r.c = t, r.d = function (e, t, n) {
12252
+ r.o(e, t) || Object.defineProperty(e, t, {
12253
+ enumerable: !0,
12254
+ get: n
12255
+ });
12256
+ }, r.r = function (e) {
12257
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
12258
+ value: "Module"
12259
+ }), Object.defineProperty(e, "__esModule", {
12260
+ value: !0
12261
+ });
12262
+ }, r.t = function (e, t) {
12263
+ if (1 & t && (e = r(e)), 8 & t) return e;
12264
+ if (4 & t && "object" == typeof e && e && e.__esModule) return e;
12265
+ var n = Object.create(null);
12266
+ if (r.r(n), Object.defineProperty(n, "default", {
12267
+ enumerable: !0,
12268
+ value: e
12269
+ }), 2 & t && "string" != typeof e) for (var i in e) {
12270
+ r.d(n, i, function (t) {
12271
+ return e[t];
12272
+ }.bind(null, i));
11795
12273
  }
11796
- var d = function () {
11797
- function e(e, t) {
11798
- if (void 0 === t && (t = !1), null == e || "" === e) throw new Error("UserAgent parameter can't be empty");
11799
- this._ua = e, this.parsedResult = {}, !0 !== t && this.parse();
11800
- }
11801
- var t = e.prototype;
11802
- return t.getUA = function () {
11803
- return this._ua;
11804
- }, t.test = function (e) {
11805
- return e.test(this._ua);
11806
- }, t.parseBrowser = function () {
11807
- var e = this;
11808
- this.parsedResult.browser = {};
11809
- var t = o.default.find(n.default, function (t) {
11810
- if ("function" == typeof t.test) return t.test(e);
11811
- if (t.test instanceof Array) return t.test.some(function (t) {
11812
- return e.test(t);
12274
+ return n;
12275
+ }, r.n = function (e) {
12276
+ var t = e && e.__esModule ? function () {
12277
+ return e.default;
12278
+ } : function () {
12279
+ return e;
12280
+ };
12281
+ return r.d(t, "a", t), t;
12282
+ }, r.o = function (e, t) {
12283
+ return Object.prototype.hasOwnProperty.call(e, t);
12284
+ }, r.p = "", r(r.s = 90);
12285
+ }({
12286
+ 17: function _(e, t, r) {
12287
+ t.__esModule = !0, t.default = void 0;
12288
+ var n = r(18),
12289
+ i = function () {
12290
+ function e() {}
12291
+ return e.getFirstMatch = function (e, t) {
12292
+ var r = t.match(e);
12293
+ return r && r.length > 0 && r[1] || "";
12294
+ }, e.getSecondMatch = function (e, t) {
12295
+ var r = t.match(e);
12296
+ return r && r.length > 1 && r[2] || "";
12297
+ }, e.matchAndReturnConst = function (e, t, r) {
12298
+ if (e.test(t)) return r;
12299
+ }, e.getWindowsVersionName = function (e) {
12300
+ switch (e) {
12301
+ case "NT":
12302
+ return "NT";
12303
+ case "XP":
12304
+ return "XP";
12305
+ case "NT 5.0":
12306
+ return "2000";
12307
+ case "NT 5.1":
12308
+ return "XP";
12309
+ case "NT 5.2":
12310
+ return "2003";
12311
+ case "NT 6.0":
12312
+ return "Vista";
12313
+ case "NT 6.1":
12314
+ return "7";
12315
+ case "NT 6.2":
12316
+ return "8";
12317
+ case "NT 6.3":
12318
+ return "8.1";
12319
+ case "NT 10.0":
12320
+ return "10";
12321
+ default:
12322
+ return;
12323
+ }
12324
+ }, e.getMacOSVersionName = function (e) {
12325
+ var t = e.split(".").splice(0, 2).map(function (e) {
12326
+ return parseInt(e, 10) || 0;
11813
12327
  });
11814
- throw new Error("Browser's test function is not valid");
11815
- });
11816
- return t && (this.parsedResult.browser = t.describe(this.getUA())), this.parsedResult.browser;
11817
- }, t.getBrowser = function () {
11818
- return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser();
11819
- }, t.getBrowserName = function (e) {
11820
- return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || "";
11821
- }, t.getBrowserVersion = function () {
11822
- return this.getBrowser().version;
11823
- }, t.getOS = function () {
11824
- return this.parsedResult.os ? this.parsedResult.os : this.parseOS();
11825
- }, t.parseOS = function () {
11826
- var e = this;
11827
- this.parsedResult.os = {};
11828
- var t = o.default.find(i.default, function (t) {
11829
- if ("function" == typeof t.test) return t.test(e);
11830
- if (t.test instanceof Array) return t.test.some(function (t) {
11831
- return e.test(t);
11832
- });
11833
- throw new Error("Browser's test function is not valid");
11834
- });
11835
- return t && (this.parsedResult.os = t.describe(this.getUA())), this.parsedResult.os;
11836
- }, t.getOSName = function (e) {
11837
- var t = this.getOS().name;
11838
- return e ? String(t).toLowerCase() || "" : t || "";
11839
- }, t.getOSVersion = function () {
11840
- return this.getOS().version;
11841
- }, t.getPlatform = function () {
11842
- return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform();
11843
- }, t.getPlatformType = function (e) {
11844
- void 0 === e && (e = !1);
11845
- var t = this.getPlatform().type;
11846
- return e ? String(t).toLowerCase() || "" : t || "";
11847
- }, t.parsePlatform = function () {
11848
- var e = this;
11849
- this.parsedResult.platform = {};
11850
- var t = o.default.find(s.default, function (t) {
11851
- if ("function" == typeof t.test) return t.test(e);
11852
- if (t.test instanceof Array) return t.test.some(function (t) {
11853
- return e.test(t);
11854
- });
11855
- throw new Error("Browser's test function is not valid");
11856
- });
11857
- return t && (this.parsedResult.platform = t.describe(this.getUA())), this.parsedResult.platform;
11858
- }, t.getEngine = function () {
11859
- return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine();
11860
- }, t.getEngineName = function (e) {
11861
- return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || "";
11862
- }, t.parseEngine = function () {
11863
- var e = this;
11864
- this.parsedResult.engine = {};
11865
- var t = o.default.find(a.default, function (t) {
11866
- if ("function" == typeof t.test) return t.test(e);
11867
- if (t.test instanceof Array) return t.test.some(function (t) {
11868
- return e.test(t);
12328
+ if (t.push(0), 10 === t[0]) switch (t[1]) {
12329
+ case 5:
12330
+ return "Leopard";
12331
+ case 6:
12332
+ return "Snow Leopard";
12333
+ case 7:
12334
+ return "Lion";
12335
+ case 8:
12336
+ return "Mountain Lion";
12337
+ case 9:
12338
+ return "Mavericks";
12339
+ case 10:
12340
+ return "Yosemite";
12341
+ case 11:
12342
+ return "El Capitan";
12343
+ case 12:
12344
+ return "Sierra";
12345
+ case 13:
12346
+ return "High Sierra";
12347
+ case 14:
12348
+ return "Mojave";
12349
+ case 15:
12350
+ return "Catalina";
12351
+ default:
12352
+ return;
12353
+ }
12354
+ }, e.getAndroidVersionName = function (e) {
12355
+ var t = e.split(".").splice(0, 2).map(function (e) {
12356
+ return parseInt(e, 10) || 0;
11869
12357
  });
11870
- throw new Error("Browser's test function is not valid");
11871
- });
11872
- return t && (this.parsedResult.engine = t.describe(this.getUA())), this.parsedResult.engine;
11873
- }, t.parse = function () {
11874
- return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this;
11875
- }, t.getResult = function () {
11876
- return o.default.assign({}, this.parsedResult);
11877
- }, t.satisfies = function (e) {
11878
- var t = this,
11879
- r = {},
11880
- n = 0,
11881
- i = {},
11882
- s = 0;
11883
- if (Object.keys(e).forEach(function (t) {
11884
- var a = e[t];
11885
- "string" == typeof a ? (i[t] = a, s += 1) : "object" == typeof a && (r[t] = a, n += 1);
11886
- }), n > 0) {
11887
- var a = Object.keys(r),
11888
- u = o.default.find(a, function (e) {
11889
- return t.isOS(e);
12358
+ if (t.push(0), !(1 === t[0] && t[1] < 5)) return 1 === t[0] && t[1] < 6 ? "Cupcake" : 1 === t[0] && t[1] >= 6 ? "Donut" : 2 === t[0] && t[1] < 2 ? "Eclair" : 2 === t[0] && 2 === t[1] ? "Froyo" : 2 === t[0] && t[1] > 2 ? "Gingerbread" : 3 === t[0] ? "Honeycomb" : 4 === t[0] && t[1] < 1 ? "Ice Cream Sandwich" : 4 === t[0] && t[1] < 4 ? "Jelly Bean" : 4 === t[0] && t[1] >= 4 ? "KitKat" : 5 === t[0] ? "Lollipop" : 6 === t[0] ? "Marshmallow" : 7 === t[0] ? "Nougat" : 8 === t[0] ? "Oreo" : 9 === t[0] ? "Pie" : void 0;
12359
+ }, e.getVersionPrecision = function (e) {
12360
+ return e.split(".").length;
12361
+ }, e.compareVersions = function (t, r, n) {
12362
+ void 0 === n && (n = !1);
12363
+ var i = e.getVersionPrecision(t),
12364
+ s = e.getVersionPrecision(r),
12365
+ a = Math.max(i, s),
12366
+ o = 0,
12367
+ u = e.map([t, r], function (t) {
12368
+ var r = a - e.getVersionPrecision(t),
12369
+ n = t + new Array(r + 1).join(".0");
12370
+ return e.map(n.split("."), function (e) {
12371
+ return new Array(20 - e.length).join("0") + e;
12372
+ }).reverse();
11890
12373
  });
11891
- if (u) {
11892
- var d = this.satisfies(r[u]);
11893
- if (void 0 !== d) return d;
12374
+ for (n && (o = a - Math.min(i, s)), a -= 1; a >= o;) {
12375
+ if (u[0][a] > u[1][a]) return 1;
12376
+ if (u[0][a] === u[1][a]) {
12377
+ if (a === o) return 0;
12378
+ a -= 1;
12379
+ } else if (u[0][a] < u[1][a]) return -1;
11894
12380
  }
11895
- var c = o.default.find(a, function (e) {
11896
- return t.isPlatform(e);
11897
- });
11898
- if (c) {
11899
- var f = this.satisfies(r[c]);
11900
- if (void 0 !== f) return f;
12381
+ }, e.map = function (e, t) {
12382
+ var r,
12383
+ n = [];
12384
+ if (Array.prototype.map) return Array.prototype.map.call(e, t);
12385
+ for (r = 0; r < e.length; r += 1) {
12386
+ n.push(t(e[r]));
11901
12387
  }
11902
- }
11903
- if (s > 0) {
11904
- var l = Object.keys(i),
11905
- h = o.default.find(l, function (e) {
11906
- return t.isBrowser(e, !0);
12388
+ return n;
12389
+ }, e.find = function (e, t) {
12390
+ var r, n;
12391
+ if (Array.prototype.find) return Array.prototype.find.call(e, t);
12392
+ for (r = 0, n = e.length; r < n; r += 1) {
12393
+ var i = e[r];
12394
+ if (t(i, r)) return i;
12395
+ }
12396
+ }, e.assign = function (e) {
12397
+ for (var t, r, n = e, i = arguments.length, s = new Array(i > 1 ? i - 1 : 0), a = 1; a < i; a++) {
12398
+ s[a - 1] = arguments[a];
12399
+ }
12400
+ if (Object.assign) return Object.assign.apply(Object, [e].concat(s));
12401
+ var o = function o() {
12402
+ var e = s[t];
12403
+ "object" == typeof e && null !== e && Object.keys(e).forEach(function (t) {
12404
+ n[t] = e[t];
11907
12405
  });
11908
- if (void 0 !== h) return this.compareVersion(i[h]);
11909
- }
11910
- }, t.isBrowser = function (e, t) {
11911
- void 0 === t && (t = !1);
11912
- var r = this.getBrowserName().toLowerCase(),
11913
- n = e.toLowerCase(),
11914
- i = o.default.getBrowserTypeByAlias(n);
11915
- return t && i && (n = i.toLowerCase()), n === r;
11916
- }, t.compareVersion = function (e) {
11917
- var t = [0],
11918
- r = e,
11919
- n = !1,
11920
- i = this.getBrowserVersion();
11921
- if ("string" == typeof i) return ">" === e[0] || "<" === e[0] ? (r = e.substr(1), "=" === e[1] ? (n = !0, r = e.substr(2)) : t = [], ">" === e[0] ? t.push(1) : t.push(-1)) : "=" === e[0] ? r = e.substr(1) : "~" === e[0] && (n = !0, r = e.substr(1)), t.indexOf(o.default.compareVersions(i, r, n)) > -1;
11922
- }, t.isOS = function (e) {
11923
- return this.getOSName(!0) === String(e).toLowerCase();
11924
- }, t.isPlatform = function (e) {
11925
- return this.getPlatformType(!0) === String(e).toLowerCase();
11926
- }, t.isEngine = function (e) {
11927
- return this.getEngineName(!0) === String(e).toLowerCase();
11928
- }, t.is = function (e, t) {
11929
- return void 0 === t && (t = !1), this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
11930
- }, t.some = function (e) {
11931
- var t = this;
11932
- return void 0 === e && (e = []), e.some(function (e) {
11933
- return t.is(e);
11934
- });
11935
- }, e;
11936
- }();
11937
- t.default = d, e.exports = t.default;
12406
+ };
12407
+ for (t = 0, r = s.length; t < r; t += 1) {
12408
+ o();
12409
+ }
12410
+ return e;
12411
+ }, e.getBrowserAlias = function (e) {
12412
+ return n.BROWSER_ALIASES_MAP[e];
12413
+ }, e.getBrowserTypeByAlias = function (e) {
12414
+ return n.BROWSER_MAP[e] || "";
12415
+ }, e;
12416
+ }();
12417
+ t.default = i, e.exports = t.default;
11938
12418
  },
11939
- 92: function _(e, t, r) {
11940
- t.__esModule = !0, t.default = void 0;
11941
- var n,
11942
- i = (n = r(17)) && n.__esModule ? n : {
11943
- default: n
11944
- };
11945
- var s = /version\/(\d+(\.?_?\d+)+)/i,
11946
- a = [{
11947
- test: [/googlebot/i],
11948
- describe: function describe(e) {
11949
- var t = {
11950
- name: "Googlebot"
11951
- },
11952
- r = i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, e) || i.default.getFirstMatch(s, e);
11953
- return r && (t.version = r), t;
11954
- }
11955
- }, {
11956
- test: [/opera/i],
11957
- describe: function describe(e) {
11958
- var t = {
11959
- name: "Opera"
11960
- },
11961
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, e);
11962
- return r && (t.version = r), t;
11963
- }
11964
- }, {
11965
- test: [/opr\/|opios/i],
11966
- describe: function describe(e) {
11967
- var t = {
11968
- name: "Opera"
11969
- },
11970
- r = i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, e) || i.default.getFirstMatch(s, e);
11971
- return r && (t.version = r), t;
11972
- }
11973
- }, {
11974
- test: [/SamsungBrowser/i],
11975
- describe: function describe(e) {
11976
- var t = {
11977
- name: "Samsung Internet for Android"
11978
- },
11979
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
11980
- return r && (t.version = r), t;
11981
- }
11982
- }, {
11983
- test: [/Whale/i],
11984
- describe: function describe(e) {
11985
- var t = {
11986
- name: "NAVER Whale Browser"
11987
- },
11988
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, e);
11989
- return r && (t.version = r), t;
11990
- }
11991
- }, {
11992
- test: [/MZBrowser/i],
11993
- describe: function describe(e) {
11994
- var t = {
11995
- name: "MZ Browser"
11996
- },
11997
- r = i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
11998
- return r && (t.version = r), t;
11999
- }
12000
- }, {
12001
- test: [/focus/i],
12002
- describe: function describe(e) {
12003
- var t = {
12004
- name: "Focus"
12005
- },
12006
- r = i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12007
- return r && (t.version = r), t;
12008
- }
12009
- }, {
12010
- test: [/swing/i],
12011
- describe: function describe(e) {
12012
- var t = {
12013
- name: "Swing"
12014
- },
12015
- r = i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12016
- return r && (t.version = r), t;
12017
- }
12018
- }, {
12019
- test: [/coast/i],
12020
- describe: function describe(e) {
12021
- var t = {
12022
- name: "Opera Coast"
12023
- },
12024
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, e);
12025
- return r && (t.version = r), t;
12026
- }
12027
- }, {
12028
- test: [/opt\/\d+(?:.?_?\d+)+/i],
12029
- describe: function describe(e) {
12030
- var t = {
12031
- name: "Opera Touch"
12032
- },
12033
- r = i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12034
- return r && (t.version = r), t;
12035
- }
12036
- }, {
12037
- test: [/yabrowser/i],
12038
- describe: function describe(e) {
12039
- var t = {
12040
- name: "Yandex Browser"
12041
- },
12042
- r = i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12043
- return r && (t.version = r), t;
12044
- }
12045
- }, {
12046
- test: [/ucbrowser/i],
12047
- describe: function describe(e) {
12048
- var t = {
12049
- name: "UC Browser"
12050
- },
12051
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
12052
- return r && (t.version = r), t;
12053
- }
12054
- }, {
12055
- test: [/Maxthon|mxios/i],
12056
- describe: function describe(e) {
12057
- var t = {
12058
- name: "Maxthon"
12059
- },
12060
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, e);
12061
- return r && (t.version = r), t;
12062
- }
12063
- }, {
12064
- test: [/epiphany/i],
12065
- describe: function describe(e) {
12066
- var t = {
12067
- name: "Epiphany"
12068
- },
12069
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, e);
12070
- return r && (t.version = r), t;
12071
- }
12072
- }, {
12073
- test: [/puffin/i],
12074
- describe: function describe(e) {
12075
- var t = {
12076
- name: "Puffin"
12077
- },
12078
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, e);
12079
- return r && (t.version = r), t;
12080
- }
12081
- }, {
12082
- test: [/sleipnir/i],
12083
- describe: function describe(e) {
12084
- var t = {
12085
- name: "Sleipnir"
12086
- },
12087
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, e);
12088
- return r && (t.version = r), t;
12419
+ 18: function _(e, t, r) {
12420
+ t.__esModule = !0, t.ENGINE_MAP = t.OS_MAP = t.PLATFORMS_MAP = t.BROWSER_MAP = t.BROWSER_ALIASES_MAP = void 0;
12421
+ t.BROWSER_ALIASES_MAP = {
12422
+ "Amazon Silk": "amazon_silk",
12423
+ "Android Browser": "android",
12424
+ Bada: "bada",
12425
+ BlackBerry: "blackberry",
12426
+ Chrome: "chrome",
12427
+ Chromium: "chromium",
12428
+ Electron: "electron",
12429
+ Epiphany: "epiphany",
12430
+ Firefox: "firefox",
12431
+ Focus: "focus",
12432
+ Generic: "generic",
12433
+ "Google Search": "google_search",
12434
+ Googlebot: "googlebot",
12435
+ "Internet Explorer": "ie",
12436
+ "K-Meleon": "k_meleon",
12437
+ Maxthon: "maxthon",
12438
+ "Microsoft Edge": "edge",
12439
+ "MZ Browser": "mz",
12440
+ "NAVER Whale Browser": "naver",
12441
+ Opera: "opera",
12442
+ "Opera Coast": "opera_coast",
12443
+ PhantomJS: "phantomjs",
12444
+ Puffin: "puffin",
12445
+ QupZilla: "qupzilla",
12446
+ QQ: "qq",
12447
+ QQLite: "qqlite",
12448
+ Safari: "safari",
12449
+ Sailfish: "sailfish",
12450
+ "Samsung Internet for Android": "samsung_internet",
12451
+ SeaMonkey: "seamonkey",
12452
+ Sleipnir: "sleipnir",
12453
+ Swing: "swing",
12454
+ Tizen: "tizen",
12455
+ "UC Browser": "uc",
12456
+ Vivaldi: "vivaldi",
12457
+ "WebOS Browser": "webos",
12458
+ WeChat: "wechat",
12459
+ "Yandex Browser": "yandex",
12460
+ Roku: "roku"
12461
+ };
12462
+ t.BROWSER_MAP = {
12463
+ amazon_silk: "Amazon Silk",
12464
+ android: "Android Browser",
12465
+ bada: "Bada",
12466
+ blackberry: "BlackBerry",
12467
+ chrome: "Chrome",
12468
+ chromium: "Chromium",
12469
+ electron: "Electron",
12470
+ epiphany: "Epiphany",
12471
+ firefox: "Firefox",
12472
+ focus: "Focus",
12473
+ generic: "Generic",
12474
+ googlebot: "Googlebot",
12475
+ google_search: "Google Search",
12476
+ ie: "Internet Explorer",
12477
+ k_meleon: "K-Meleon",
12478
+ maxthon: "Maxthon",
12479
+ edge: "Microsoft Edge",
12480
+ mz: "MZ Browser",
12481
+ naver: "NAVER Whale Browser",
12482
+ opera: "Opera",
12483
+ opera_coast: "Opera Coast",
12484
+ phantomjs: "PhantomJS",
12485
+ puffin: "Puffin",
12486
+ qupzilla: "QupZilla",
12487
+ qq: "QQ Browser",
12488
+ qqlite: "QQ Browser Lite",
12489
+ safari: "Safari",
12490
+ sailfish: "Sailfish",
12491
+ samsung_internet: "Samsung Internet for Android",
12492
+ seamonkey: "SeaMonkey",
12493
+ sleipnir: "Sleipnir",
12494
+ swing: "Swing",
12495
+ tizen: "Tizen",
12496
+ uc: "UC Browser",
12497
+ vivaldi: "Vivaldi",
12498
+ webos: "WebOS Browser",
12499
+ wechat: "WeChat",
12500
+ yandex: "Yandex Browser"
12501
+ };
12502
+ t.PLATFORMS_MAP = {
12503
+ tablet: "tablet",
12504
+ mobile: "mobile",
12505
+ desktop: "desktop",
12506
+ tv: "tv"
12507
+ };
12508
+ t.OS_MAP = {
12509
+ WindowsPhone: "Windows Phone",
12510
+ Windows: "Windows",
12511
+ MacOS: "macOS",
12512
+ iOS: "iOS",
12513
+ Android: "Android",
12514
+ WebOS: "WebOS",
12515
+ BlackBerry: "BlackBerry",
12516
+ Bada: "Bada",
12517
+ Tizen: "Tizen",
12518
+ Linux: "Linux",
12519
+ ChromeOS: "Chrome OS",
12520
+ PlayStation4: "PlayStation 4",
12521
+ Roku: "Roku"
12522
+ };
12523
+ t.ENGINE_MAP = {
12524
+ EdgeHTML: "EdgeHTML",
12525
+ Blink: "Blink",
12526
+ Trident: "Trident",
12527
+ Presto: "Presto",
12528
+ Gecko: "Gecko",
12529
+ WebKit: "WebKit"
12530
+ };
12531
+ },
12532
+ 90: function _(e, t, r) {
12533
+ t.__esModule = !0, t.default = void 0;
12534
+ var n,
12535
+ i = (n = r(91)) && n.__esModule ? n : {
12536
+ default: n
12537
+ },
12538
+ s = r(18);
12539
+ function a(e, t) {
12540
+ for (var r = 0; r < t.length; r++) {
12541
+ var n = t[r];
12542
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
12543
+ }
12544
+ }
12545
+ var o = function () {
12546
+ function e() {}
12547
+ var t, r, n;
12548
+ return e.getParser = function (e, t) {
12549
+ if (void 0 === t && (t = !1), "string" != typeof e) throw new Error("UserAgent should be a string");
12550
+ return new i.default(e, t);
12551
+ }, e.parse = function (e) {
12552
+ return new i.default(e).getResult();
12553
+ }, t = e, n = [{
12554
+ key: "BROWSER_MAP",
12555
+ get: function get() {
12556
+ return s.BROWSER_MAP;
12089
12557
  }
12090
12558
  }, {
12091
- test: [/k-meleon/i],
12092
- describe: function describe(e) {
12093
- var t = {
12094
- name: "K-Meleon"
12095
- },
12096
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, e);
12097
- return r && (t.version = r), t;
12559
+ key: "ENGINE_MAP",
12560
+ get: function get() {
12561
+ return s.ENGINE_MAP;
12098
12562
  }
12099
12563
  }, {
12100
- test: [/micromessenger/i],
12101
- describe: function describe(e) {
12102
- var t = {
12103
- name: "WeChat"
12104
- },
12105
- r = i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12106
- return r && (t.version = r), t;
12564
+ key: "OS_MAP",
12565
+ get: function get() {
12566
+ return s.OS_MAP;
12107
12567
  }
12108
12568
  }, {
12109
- test: [/qqbrowser/i],
12110
- describe: function describe(e) {
12111
- var t = {
12112
- name: /qqbrowserlite/i.test(e) ? "QQ Browser Lite" : "QQ Browser"
12113
- },
12114
- r = i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12115
- return r && (t.version = r), t;
12569
+ key: "PLATFORMS_MAP",
12570
+ get: function get() {
12571
+ return s.PLATFORMS_MAP;
12116
12572
  }
12117
- }, {
12118
- test: [/msie|trident/i],
12573
+ }], (r = null) && a(t.prototype, r), n && a(t, n), e;
12574
+ }();
12575
+ t.default = o, e.exports = t.default;
12576
+ },
12577
+ 91: function _(e, t, r) {
12578
+ t.__esModule = !0, t.default = void 0;
12579
+ var n = u(r(92)),
12580
+ i = u(r(93)),
12581
+ s = u(r(94)),
12582
+ a = u(r(95)),
12583
+ o = u(r(17));
12584
+ function u(e) {
12585
+ return e && e.__esModule ? e : {
12586
+ default: e
12587
+ };
12588
+ }
12589
+ var d = function () {
12590
+ function e(e, t) {
12591
+ if (void 0 === t && (t = !1), null == e || "" === e) throw new Error("UserAgent parameter can't be empty");
12592
+ this._ua = e, this.parsedResult = {}, !0 !== t && this.parse();
12593
+ }
12594
+ var t = e.prototype;
12595
+ return t.getUA = function () {
12596
+ return this._ua;
12597
+ }, t.test = function (e) {
12598
+ return e.test(this._ua);
12599
+ }, t.parseBrowser = function () {
12600
+ var e = this;
12601
+ this.parsedResult.browser = {};
12602
+ var t = o.default.find(n.default, function (t) {
12603
+ if ("function" == typeof t.test) return t.test(e);
12604
+ if (t.test instanceof Array) return t.test.some(function (t) {
12605
+ return e.test(t);
12606
+ });
12607
+ throw new Error("Browser's test function is not valid");
12608
+ });
12609
+ return t && (this.parsedResult.browser = t.describe(this.getUA())), this.parsedResult.browser;
12610
+ }, t.getBrowser = function () {
12611
+ return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser();
12612
+ }, t.getBrowserName = function (e) {
12613
+ return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || "";
12614
+ }, t.getBrowserVersion = function () {
12615
+ return this.getBrowser().version;
12616
+ }, t.getOS = function () {
12617
+ return this.parsedResult.os ? this.parsedResult.os : this.parseOS();
12618
+ }, t.parseOS = function () {
12619
+ var e = this;
12620
+ this.parsedResult.os = {};
12621
+ var t = o.default.find(i.default, function (t) {
12622
+ if ("function" == typeof t.test) return t.test(e);
12623
+ if (t.test instanceof Array) return t.test.some(function (t) {
12624
+ return e.test(t);
12625
+ });
12626
+ throw new Error("Browser's test function is not valid");
12627
+ });
12628
+ return t && (this.parsedResult.os = t.describe(this.getUA())), this.parsedResult.os;
12629
+ }, t.getOSName = function (e) {
12630
+ var t = this.getOS().name;
12631
+ return e ? String(t).toLowerCase() || "" : t || "";
12632
+ }, t.getOSVersion = function () {
12633
+ return this.getOS().version;
12634
+ }, t.getPlatform = function () {
12635
+ return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform();
12636
+ }, t.getPlatformType = function (e) {
12637
+ void 0 === e && (e = !1);
12638
+ var t = this.getPlatform().type;
12639
+ return e ? String(t).toLowerCase() || "" : t || "";
12640
+ }, t.parsePlatform = function () {
12641
+ var e = this;
12642
+ this.parsedResult.platform = {};
12643
+ var t = o.default.find(s.default, function (t) {
12644
+ if ("function" == typeof t.test) return t.test(e);
12645
+ if (t.test instanceof Array) return t.test.some(function (t) {
12646
+ return e.test(t);
12647
+ });
12648
+ throw new Error("Browser's test function is not valid");
12649
+ });
12650
+ return t && (this.parsedResult.platform = t.describe(this.getUA())), this.parsedResult.platform;
12651
+ }, t.getEngine = function () {
12652
+ return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine();
12653
+ }, t.getEngineName = function (e) {
12654
+ return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || "";
12655
+ }, t.parseEngine = function () {
12656
+ var e = this;
12657
+ this.parsedResult.engine = {};
12658
+ var t = o.default.find(a.default, function (t) {
12659
+ if ("function" == typeof t.test) return t.test(e);
12660
+ if (t.test instanceof Array) return t.test.some(function (t) {
12661
+ return e.test(t);
12662
+ });
12663
+ throw new Error("Browser's test function is not valid");
12664
+ });
12665
+ return t && (this.parsedResult.engine = t.describe(this.getUA())), this.parsedResult.engine;
12666
+ }, t.parse = function () {
12667
+ return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this;
12668
+ }, t.getResult = function () {
12669
+ return o.default.assign({}, this.parsedResult);
12670
+ }, t.satisfies = function (e) {
12671
+ var t = this,
12672
+ r = {},
12673
+ n = 0,
12674
+ i = {},
12675
+ s = 0;
12676
+ if (Object.keys(e).forEach(function (t) {
12677
+ var a = e[t];
12678
+ "string" == typeof a ? (i[t] = a, s += 1) : "object" == typeof a && (r[t] = a, n += 1);
12679
+ }), n > 0) {
12680
+ var a = Object.keys(r),
12681
+ u = o.default.find(a, function (e) {
12682
+ return t.isOS(e);
12683
+ });
12684
+ if (u) {
12685
+ var d = this.satisfies(r[u]);
12686
+ if (void 0 !== d) return d;
12687
+ }
12688
+ var c = o.default.find(a, function (e) {
12689
+ return t.isPlatform(e);
12690
+ });
12691
+ if (c) {
12692
+ var f = this.satisfies(r[c]);
12693
+ if (void 0 !== f) return f;
12694
+ }
12695
+ }
12696
+ if (s > 0) {
12697
+ var l = Object.keys(i),
12698
+ h = o.default.find(l, function (e) {
12699
+ return t.isBrowser(e, !0);
12700
+ });
12701
+ if (void 0 !== h) return this.compareVersion(i[h]);
12702
+ }
12703
+ }, t.isBrowser = function (e, t) {
12704
+ void 0 === t && (t = !1);
12705
+ var r = this.getBrowserName().toLowerCase(),
12706
+ n = e.toLowerCase(),
12707
+ i = o.default.getBrowserTypeByAlias(n);
12708
+ return t && i && (n = i.toLowerCase()), n === r;
12709
+ }, t.compareVersion = function (e) {
12710
+ var t = [0],
12711
+ r = e,
12712
+ n = !1,
12713
+ i = this.getBrowserVersion();
12714
+ if ("string" == typeof i) return ">" === e[0] || "<" === e[0] ? (r = e.substr(1), "=" === e[1] ? (n = !0, r = e.substr(2)) : t = [], ">" === e[0] ? t.push(1) : t.push(-1)) : "=" === e[0] ? r = e.substr(1) : "~" === e[0] && (n = !0, r = e.substr(1)), t.indexOf(o.default.compareVersions(i, r, n)) > -1;
12715
+ }, t.isOS = function (e) {
12716
+ return this.getOSName(!0) === String(e).toLowerCase();
12717
+ }, t.isPlatform = function (e) {
12718
+ return this.getPlatformType(!0) === String(e).toLowerCase();
12719
+ }, t.isEngine = function (e) {
12720
+ return this.getEngineName(!0) === String(e).toLowerCase();
12721
+ }, t.is = function (e, t) {
12722
+ return void 0 === t && (t = !1), this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
12723
+ }, t.some = function (e) {
12724
+ var t = this;
12725
+ return void 0 === e && (e = []), e.some(function (e) {
12726
+ return t.is(e);
12727
+ });
12728
+ }, e;
12729
+ }();
12730
+ t.default = d, e.exports = t.default;
12731
+ },
12732
+ 92: function _(e, t, r) {
12733
+ t.__esModule = !0, t.default = void 0;
12734
+ var n,
12735
+ i = (n = r(17)) && n.__esModule ? n : {
12736
+ default: n
12737
+ };
12738
+ var s = /version\/(\d+(\.?_?\d+)+)/i,
12739
+ a = [{
12740
+ test: [/googlebot/i],
12119
12741
  describe: function describe(e) {
12120
12742
  var t = {
12121
- name: "Internet Explorer"
12743
+ name: "Googlebot"
12122
12744
  },
12123
- r = i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, e);
12745
+ r = i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, e) || i.default.getFirstMatch(s, e);
12124
12746
  return r && (t.version = r), t;
12125
12747
  }
12126
12748
  }, {
12127
- test: [/\sedg\//i],
12749
+ test: [/opera/i],
12128
12750
  describe: function describe(e) {
12129
12751
  var t = {
12130
- name: "Microsoft Edge"
12752
+ name: "Opera"
12131
12753
  },
12132
- r = i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, e);
12754
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, e);
12133
12755
  return r && (t.version = r), t;
12134
12756
  }
12135
12757
  }, {
12136
- test: [/edg([ea]|ios)/i],
12758
+ test: [/opr\/|opios/i],
12137
12759
  describe: function describe(e) {
12138
12760
  var t = {
12139
- name: "Microsoft Edge"
12761
+ name: "Opera"
12140
12762
  },
12141
- r = i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, e);
12763
+ r = i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, e) || i.default.getFirstMatch(s, e);
12142
12764
  return r && (t.version = r), t;
12143
12765
  }
12144
12766
  }, {
12145
- test: [/vivaldi/i],
12767
+ test: [/SamsungBrowser/i],
12146
12768
  describe: function describe(e) {
12147
12769
  var t = {
12148
- name: "Vivaldi"
12770
+ name: "Samsung Internet for Android"
12149
12771
  },
12150
- r = i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, e);
12772
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
12151
12773
  return r && (t.version = r), t;
12152
12774
  }
12153
12775
  }, {
12154
- test: [/seamonkey/i],
12776
+ test: [/Whale/i],
12155
12777
  describe: function describe(e) {
12156
12778
  var t = {
12157
- name: "SeaMonkey"
12779
+ name: "NAVER Whale Browser"
12158
12780
  },
12159
- r = i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, e);
12781
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, e);
12160
12782
  return r && (t.version = r), t;
12161
12783
  }
12162
12784
  }, {
12163
- test: [/sailfish/i],
12785
+ test: [/MZBrowser/i],
12164
12786
  describe: function describe(e) {
12165
12787
  var t = {
12166
- name: "Sailfish"
12788
+ name: "MZ Browser"
12167
12789
  },
12168
- r = i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, e);
12790
+ r = i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12169
12791
  return r && (t.version = r), t;
12170
12792
  }
12171
12793
  }, {
12172
- test: [/silk/i],
12794
+ test: [/focus/i],
12173
12795
  describe: function describe(e) {
12174
12796
  var t = {
12175
- name: "Amazon Silk"
12797
+ name: "Focus"
12176
12798
  },
12177
- r = i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, e);
12799
+ r = i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12178
12800
  return r && (t.version = r), t;
12179
12801
  }
12180
12802
  }, {
12181
- test: [/phantom/i],
12803
+ test: [/swing/i],
12182
12804
  describe: function describe(e) {
12183
12805
  var t = {
12184
- name: "PhantomJS"
12806
+ name: "Swing"
12185
12807
  },
12186
- r = i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, e);
12808
+ r = i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12187
12809
  return r && (t.version = r), t;
12188
12810
  }
12189
12811
  }, {
12190
- test: [/slimerjs/i],
12812
+ test: [/coast/i],
12191
12813
  describe: function describe(e) {
12192
12814
  var t = {
12193
- name: "SlimerJS"
12815
+ name: "Opera Coast"
12194
12816
  },
12195
- r = i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, e);
12817
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, e);
12196
12818
  return r && (t.version = r), t;
12197
12819
  }
12198
12820
  }, {
12199
- test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
12821
+ test: [/opt\/\d+(?:.?_?\d+)+/i],
12200
12822
  describe: function describe(e) {
12201
12823
  var t = {
12202
- name: "BlackBerry"
12824
+ name: "Opera Touch"
12203
12825
  },
12204
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, e);
12826
+ r = i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12205
12827
  return r && (t.version = r), t;
12206
12828
  }
12207
12829
  }, {
12208
- test: [/(web|hpw)[o0]s/i],
12830
+ test: [/yabrowser/i],
12209
12831
  describe: function describe(e) {
12210
12832
  var t = {
12211
- name: "WebOS Browser"
12833
+ name: "Yandex Browser"
12212
12834
  },
12213
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, e);
12835
+ r = i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12214
12836
  return r && (t.version = r), t;
12215
12837
  }
12216
12838
  }, {
12217
- test: [/bada/i],
12839
+ test: [/ucbrowser/i],
12218
12840
  describe: function describe(e) {
12219
12841
  var t = {
12220
- name: "Bada"
12842
+ name: "UC Browser"
12221
12843
  },
12222
- r = i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, e);
12844
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
12223
12845
  return r && (t.version = r), t;
12224
12846
  }
12225
12847
  }, {
12226
- test: [/tizen/i],
12848
+ test: [/Maxthon|mxios/i],
12227
12849
  describe: function describe(e) {
12228
12850
  var t = {
12229
- name: "Tizen"
12851
+ name: "Maxthon"
12230
12852
  },
12231
- r = i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12853
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, e);
12232
12854
  return r && (t.version = r), t;
12233
12855
  }
12234
12856
  }, {
12235
- test: [/qupzilla/i],
12857
+ test: [/epiphany/i],
12236
12858
  describe: function describe(e) {
12237
12859
  var t = {
12238
- name: "QupZilla"
12860
+ name: "Epiphany"
12239
12861
  },
12240
- r = i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12862
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, e);
12241
12863
  return r && (t.version = r), t;
12242
12864
  }
12243
12865
  }, {
12244
- test: [/firefox|iceweasel|fxios/i],
12866
+ test: [/puffin/i],
12245
12867
  describe: function describe(e) {
12246
12868
  var t = {
12247
- name: "Firefox"
12869
+ name: "Puffin"
12870
+ },
12871
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, e);
12872
+ return r && (t.version = r), t;
12873
+ }
12874
+ }, {
12875
+ test: [/sleipnir/i],
12876
+ describe: function describe(e) {
12877
+ var t = {
12878
+ name: "Sleipnir"
12879
+ },
12880
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, e);
12881
+ return r && (t.version = r), t;
12882
+ }
12883
+ }, {
12884
+ test: [/k-meleon/i],
12885
+ describe: function describe(e) {
12886
+ var t = {
12887
+ name: "K-Meleon"
12888
+ },
12889
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, e);
12890
+ return r && (t.version = r), t;
12891
+ }
12892
+ }, {
12893
+ test: [/micromessenger/i],
12894
+ describe: function describe(e) {
12895
+ var t = {
12896
+ name: "WeChat"
12897
+ },
12898
+ r = i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12899
+ return r && (t.version = r), t;
12900
+ }
12901
+ }, {
12902
+ test: [/qqbrowser/i],
12903
+ describe: function describe(e) {
12904
+ var t = {
12905
+ name: /qqbrowserlite/i.test(e) ? "QQ Browser Lite" : "QQ Browser"
12906
+ },
12907
+ r = i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12908
+ return r && (t.version = r), t;
12909
+ }
12910
+ }, {
12911
+ test: [/msie|trident/i],
12912
+ describe: function describe(e) {
12913
+ var t = {
12914
+ name: "Internet Explorer"
12915
+ },
12916
+ r = i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, e);
12917
+ return r && (t.version = r), t;
12918
+ }
12919
+ }, {
12920
+ test: [/\sedg\//i],
12921
+ describe: function describe(e) {
12922
+ var t = {
12923
+ name: "Microsoft Edge"
12924
+ },
12925
+ r = i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, e);
12926
+ return r && (t.version = r), t;
12927
+ }
12928
+ }, {
12929
+ test: [/edg([ea]|ios)/i],
12930
+ describe: function describe(e) {
12931
+ var t = {
12932
+ name: "Microsoft Edge"
12933
+ },
12934
+ r = i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, e);
12935
+ return r && (t.version = r), t;
12936
+ }
12937
+ }, {
12938
+ test: [/vivaldi/i],
12939
+ describe: function describe(e) {
12940
+ var t = {
12941
+ name: "Vivaldi"
12942
+ },
12943
+ r = i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, e);
12944
+ return r && (t.version = r), t;
12945
+ }
12946
+ }, {
12947
+ test: [/seamonkey/i],
12948
+ describe: function describe(e) {
12949
+ var t = {
12950
+ name: "SeaMonkey"
12951
+ },
12952
+ r = i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, e);
12953
+ return r && (t.version = r), t;
12954
+ }
12955
+ }, {
12956
+ test: [/sailfish/i],
12957
+ describe: function describe(e) {
12958
+ var t = {
12959
+ name: "Sailfish"
12960
+ },
12961
+ r = i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, e);
12962
+ return r && (t.version = r), t;
12963
+ }
12964
+ }, {
12965
+ test: [/silk/i],
12966
+ describe: function describe(e) {
12967
+ var t = {
12968
+ name: "Amazon Silk"
12969
+ },
12970
+ r = i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, e);
12971
+ return r && (t.version = r), t;
12972
+ }
12973
+ }, {
12974
+ test: [/phantom/i],
12975
+ describe: function describe(e) {
12976
+ var t = {
12977
+ name: "PhantomJS"
12978
+ },
12979
+ r = i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, e);
12980
+ return r && (t.version = r), t;
12981
+ }
12982
+ }, {
12983
+ test: [/slimerjs/i],
12984
+ describe: function describe(e) {
12985
+ var t = {
12986
+ name: "SlimerJS"
12987
+ },
12988
+ r = i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, e);
12989
+ return r && (t.version = r), t;
12990
+ }
12991
+ }, {
12992
+ test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
12993
+ describe: function describe(e) {
12994
+ var t = {
12995
+ name: "BlackBerry"
12996
+ },
12997
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, e);
12998
+ return r && (t.version = r), t;
12999
+ }
13000
+ }, {
13001
+ test: [/(web|hpw)[o0]s/i],
13002
+ describe: function describe(e) {
13003
+ var t = {
13004
+ name: "WebOS Browser"
13005
+ },
13006
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, e);
13007
+ return r && (t.version = r), t;
13008
+ }
13009
+ }, {
13010
+ test: [/bada/i],
13011
+ describe: function describe(e) {
13012
+ var t = {
13013
+ name: "Bada"
13014
+ },
13015
+ r = i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, e);
13016
+ return r && (t.version = r), t;
13017
+ }
13018
+ }, {
13019
+ test: [/tizen/i],
13020
+ describe: function describe(e) {
13021
+ var t = {
13022
+ name: "Tizen"
13023
+ },
13024
+ r = i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
13025
+ return r && (t.version = r), t;
13026
+ }
13027
+ }, {
13028
+ test: [/qupzilla/i],
13029
+ describe: function describe(e) {
13030
+ var t = {
13031
+ name: "QupZilla"
13032
+ },
13033
+ r = i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
13034
+ return r && (t.version = r), t;
13035
+ }
13036
+ }, {
13037
+ test: [/firefox|iceweasel|fxios/i],
13038
+ describe: function describe(e) {
13039
+ var t = {
13040
+ name: "Firefox"
12248
13041
  },
12249
13042
  r = i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, e);
12250
13043
  return r && (t.version = r), t;
@@ -12525,806 +13318,241 @@ var es5 = {
12525
13318
  test: [/Macintosh(.*?) FxiOS(.*?)\//],
12526
13319
  describe: function describe() {
12527
13320
  return {
12528
- type: s.PLATFORMS_MAP.tablet,
12529
- vendor: "Apple",
12530
- model: "iPad"
12531
- };
12532
- }
12533
- }, {
12534
- test: [/kftt build/i],
12535
- describe: function describe() {
12536
- return {
12537
- type: s.PLATFORMS_MAP.tablet,
12538
- vendor: "Amazon",
12539
- model: "Kindle Fire HD 7"
12540
- };
12541
- }
12542
- }, {
12543
- test: [/silk/i],
12544
- describe: function describe() {
12545
- return {
12546
- type: s.PLATFORMS_MAP.tablet,
12547
- vendor: "Amazon"
12548
- };
12549
- }
12550
- }, {
12551
- test: [/tablet(?! pc)/i],
12552
- describe: function describe() {
12553
- return {
12554
- type: s.PLATFORMS_MAP.tablet
12555
- };
12556
- }
12557
- }, {
12558
- test: function test(e) {
12559
- var t = e.test(/ipod|iphone/i),
12560
- r = e.test(/like (ipod|iphone)/i);
12561
- return t && !r;
12562
- },
12563
- describe: function describe(e) {
12564
- var t = i.default.getFirstMatch(/(ipod|iphone)/i, e);
12565
- return {
12566
- type: s.PLATFORMS_MAP.mobile,
12567
- vendor: "Apple",
12568
- model: t
12569
- };
12570
- }
12571
- }, {
12572
- test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
12573
- describe: function describe() {
12574
- return {
12575
- type: s.PLATFORMS_MAP.mobile,
12576
- vendor: "Nexus"
12577
- };
12578
- }
12579
- }, {
12580
- test: [/[^-]mobi/i],
12581
- describe: function describe() {
12582
- return {
12583
- type: s.PLATFORMS_MAP.mobile
12584
- };
12585
- }
12586
- }, {
12587
- test: function test(e) {
12588
- return "blackberry" === e.getBrowserName(!0);
12589
- },
12590
- describe: function describe() {
12591
- return {
12592
- type: s.PLATFORMS_MAP.mobile,
12593
- vendor: "BlackBerry"
12594
- };
12595
- }
12596
- }, {
12597
- test: function test(e) {
12598
- return "bada" === e.getBrowserName(!0);
12599
- },
12600
- describe: function describe() {
12601
- return {
12602
- type: s.PLATFORMS_MAP.mobile
12603
- };
12604
- }
12605
- }, {
12606
- test: function test(e) {
12607
- return "windows phone" === e.getBrowserName();
12608
- },
12609
- describe: function describe() {
12610
- return {
12611
- type: s.PLATFORMS_MAP.mobile,
12612
- vendor: "Microsoft"
12613
- };
12614
- }
12615
- }, {
12616
- test: function test(e) {
12617
- var t = Number(String(e.getOSVersion()).split(".")[0]);
12618
- return "android" === e.getOSName(!0) && t >= 3;
12619
- },
12620
- describe: function describe() {
12621
- return {
12622
- type: s.PLATFORMS_MAP.tablet
12623
- };
12624
- }
12625
- }, {
12626
- test: function test(e) {
12627
- return "android" === e.getOSName(!0);
12628
- },
12629
- describe: function describe() {
12630
- return {
12631
- type: s.PLATFORMS_MAP.mobile
12632
- };
12633
- }
12634
- }, {
12635
- test: function test(e) {
12636
- return "macos" === e.getOSName(!0);
12637
- },
12638
- describe: function describe() {
12639
- return {
12640
- type: s.PLATFORMS_MAP.desktop,
12641
- vendor: "Apple"
12642
- };
12643
- }
12644
- }, {
12645
- test: function test(e) {
12646
- return "windows" === e.getOSName(!0);
12647
- },
12648
- describe: function describe() {
12649
- return {
12650
- type: s.PLATFORMS_MAP.desktop
12651
- };
12652
- }
12653
- }, {
12654
- test: function test(e) {
12655
- return "linux" === e.getOSName(!0);
12656
- },
12657
- describe: function describe() {
12658
- return {
12659
- type: s.PLATFORMS_MAP.desktop
12660
- };
12661
- }
12662
- }, {
12663
- test: function test(e) {
12664
- return "playstation 4" === e.getOSName(!0);
12665
- },
12666
- describe: function describe() {
12667
- return {
12668
- type: s.PLATFORMS_MAP.tv
12669
- };
12670
- }
12671
- }, {
12672
- test: function test(e) {
12673
- return "roku" === e.getOSName(!0);
12674
- },
12675
- describe: function describe() {
12676
- return {
12677
- type: s.PLATFORMS_MAP.tv
12678
- };
12679
- }
12680
- }];
12681
- t.default = a, e.exports = t.default;
12682
- },
12683
- 95: function _(e, t, r) {
12684
- t.__esModule = !0, t.default = void 0;
12685
- var n,
12686
- i = (n = r(17)) && n.__esModule ? n : {
12687
- default: n
12688
- },
12689
- s = r(18);
12690
- var a = [{
12691
- test: function test(e) {
12692
- return "microsoft edge" === e.getBrowserName(!0);
12693
- },
12694
- describe: function describe(e) {
12695
- if (/\sedg\//i.test(e)) return {
12696
- name: s.ENGINE_MAP.Blink
12697
- };
12698
- var t = i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, e);
12699
- return {
12700
- name: s.ENGINE_MAP.EdgeHTML,
12701
- version: t
12702
- };
12703
- }
12704
- }, {
12705
- test: [/trident/i],
12706
- describe: function describe(e) {
12707
- var t = {
12708
- name: s.ENGINE_MAP.Trident
12709
- },
12710
- r = i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, e);
12711
- return r && (t.version = r), t;
12712
- }
12713
- }, {
12714
- test: function test(e) {
12715
- return e.test(/presto/i);
12716
- },
12717
- describe: function describe(e) {
12718
- var t = {
12719
- name: s.ENGINE_MAP.Presto
12720
- },
12721
- r = i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, e);
12722
- return r && (t.version = r), t;
12723
- }
12724
- }, {
12725
- test: function test(e) {
12726
- var t = e.test(/gecko/i),
12727
- r = e.test(/like gecko/i);
12728
- return t && !r;
12729
- },
12730
- describe: function describe(e) {
12731
- var t = {
12732
- name: s.ENGINE_MAP.Gecko
12733
- },
12734
- r = i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, e);
12735
- return r && (t.version = r), t;
12736
- }
12737
- }, {
12738
- test: [/(apple)?webkit\/537\.36/i],
12739
- describe: function describe() {
12740
- return {
12741
- name: s.ENGINE_MAP.Blink
12742
- };
12743
- }
12744
- }, {
12745
- test: [/(apple)?webkit/i],
12746
- describe: function describe(e) {
12747
- var t = {
12748
- name: s.ENGINE_MAP.WebKit
12749
- },
12750
- r = i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, e);
12751
- return r && (t.version = r), t;
12752
- }
12753
- }];
12754
- t.default = a, e.exports = t.default;
12755
- }
12756
- });
12757
- });
12758
- })(es5);
12759
- var Bowser = /*@__PURE__*/getDefaultExportFromCjs(es5.exports);
12760
- function getBrowserDetails() {
12761
- var browser = Bowser.getParser(window.navigator.userAgent);
12762
- return browser.getBrowser();
12763
- }
12764
- var ReceiveSlotEvents;
12765
- (function (ReceiveSlotEvents) {
12766
- ReceiveSlotEvents["MediaStarted"] = "media-started";
12767
- ReceiveSlotEvents["MediaStopped"] = "media-stopped";
12768
- ReceiveSlotEvents["SourceUpdate"] = "source-update";
12769
- })(ReceiveSlotEvents || (ReceiveSlotEvents = {}));
12770
- class ReceiveSlot extends EventEmitter {
12771
- constructor(idGetter, track) {
12772
- super();
12773
- this._idGetter = idGetter;
12774
- this.handleTrackMuted = this.handleTrackMuted.bind(this);
12775
- this.handleTrackUnmuted = this.handleTrackUnmuted.bind(this);
12776
- this._stream = new MediaStream([track]);
12777
- this.addTrackHandlers(track);
12778
- }
12779
- addTrackHandlers(track) {
12780
- track.addEventListener('mute', this.handleTrackMuted);
12781
- track.addEventListener('unmute', this.handleTrackUnmuted);
12782
- }
12783
- handleTrackMuted() {
12784
- this.emit(ReceiveSlotEvents.MediaStopped);
12785
- }
12786
- handleTrackUnmuted() {
12787
- this.emit(ReceiveSlotEvents.MediaStarted);
12788
- }
12789
- removeTrackHandlers(track) {
12790
- track.removeEventListener('mute', this.handleTrackMuted);
12791
- track.removeEventListener('unmute', this.handleTrackUnmuted);
12792
- }
12793
- replaceTrack(newTrack) {
12794
- var _a;
12795
- var trackToRemove = (_a = this._stream.getTracks()) === null || _a === void 0 ? void 0 : _a[0];
12796
- if (trackToRemove) {
12797
- this._stream.removeTrack(trackToRemove);
12798
- this.removeTrackHandlers(trackToRemove);
12799
- }
12800
- this.addTrackHandlers(newTrack);
12801
- this._stream.addTrack(newTrack);
12802
- }
12803
- _updateSource(state, csi) {
12804
- this.currentRxCsi = csi;
12805
- this.emit(ReceiveSlotEvents.SourceUpdate, state, csi);
12806
- }
12807
- close() {
12808
- this._stream.getTracks().forEach(t => {
12809
- this.removeTrackHandlers(t);
12810
- });
12811
- }
12812
- get id() {
12813
- return this._idGetter();
12814
- }
12815
- get stream() {
12816
- return this._stream;
12817
- }
12818
- }
12819
- ReceiveSlot.Events = ReceiveSlotEvents;
12820
- class Transceiver {
12821
- constructor(rtcRtpTransceiver) {
12822
- this._rtcRtpTransceiver = rtcRtpTransceiver;
12823
- }
12824
- replaceTransceiver(newRtcRtpTransceiver) {
12825
- this._rtcRtpTransceiver = newRtcRtpTransceiver;
12826
- }
12827
- getReceiverStats() {
12828
- return this._rtcRtpTransceiver.receiver.getStats();
12829
- }
12830
- getSenderStats() {
12831
- return this._rtcRtpTransceiver.sender.getStats();
12832
- }
12833
- get receiver() {
12834
- return this._rtcRtpTransceiver.receiver;
12835
- }
12836
- get sender() {
12837
- return this._rtcRtpTransceiver.sender;
12838
- }
12839
- get mid() {
12840
- return this._rtcRtpTransceiver.mid;
12841
- }
12842
- close() {
12843
- this._rtcRtpTransceiver.stop();
12844
- }
12845
- }
12846
- class ReceiveOnlyTransceiver extends Transceiver {
12847
- constructor(rtcRtpTransceiver, idGetter) {
12848
- super(rtcRtpTransceiver);
12849
- this._receiveSlot = new ReceiveSlot(() => {
12850
- if (!this._rtcRtpTransceiver.mid) {
12851
- return null;
12852
- }
12853
- return idGetter(this._rtcRtpTransceiver.mid);
12854
- }, this._rtcRtpTransceiver.receiver.track);
12855
- }
12856
- replaceTransceiver(newRtcRtpTransceiver) {
12857
- super.replaceTransceiver(newRtcRtpTransceiver);
12858
- this._receiveSlot.replaceTrack(newRtcRtpTransceiver.receiver.track);
12859
- }
12860
- close() {
12861
- super.close();
12862
- this._receiveSlot.close();
12863
- }
12864
- get receiveSlot() {
12865
- return this._receiveSlot;
12866
- }
12867
- }
12868
- ReceiveOnlyTransceiver.rid = '1';
12869
- class JmpLine extends Line {
12870
- static fromSdpLine(line) {
12871
- if (!JmpLine.regex.test(line)) {
12872
- return undefined;
12873
- }
12874
- return new JmpLine();
12875
- }
12876
- toSdpLine() {
12877
- return "a=jmp";
12878
- }
12879
- }
12880
- JmpLine.regex = /^jmp$/;
12881
- class JmpStreamIdModeLine extends Line {
12882
- constructor(streamIdMode) {
12883
- super();
12884
- this.streamIdMode = streamIdMode;
12885
- }
12886
- static fromSdpLine(line) {
12887
- if (!JmpStreamIdModeLine.regex.test(line)) {
12888
- return undefined;
12889
- }
12890
- var tokens = line.match(JmpStreamIdModeLine.regex);
12891
- var mode = tokens[1];
12892
- return new JmpStreamIdModeLine(mode);
12893
- }
12894
- toSdpLine() {
12895
- return "a=jmp-stream-id-mode:".concat(this.streamIdMode);
12896
- }
12897
- }
12898
- JmpStreamIdModeLine.regex = /^jmp-stream-id-mode:(MID-RID|SSRC)$/;
12899
- class JmpSourceLine extends Line {
12900
- constructor(source, csi) {
12901
- super();
12902
- this.source = source;
12903
- this.csi = csi;
12904
- }
12905
- static fromSdpLine(line) {
12906
- if (!JmpSourceLine.regex.test(line)) {
12907
- return undefined;
12908
- }
12909
- var tokens = line.match(JmpSourceLine.regex);
12910
- var source = tokens[1];
12911
- var csi = tokens[2];
12912
- return new JmpSourceLine(source, csi);
12913
- }
12914
- toSdpLine() {
12915
- var line = "a=jmp-source:".concat(this.source);
12916
- if (this.csi) {
12917
- line += " csi=".concat(this.csi);
12918
- }
12919
- return line;
12920
- }
12921
- }
12922
- JmpSourceLine.regex = new RegExp("^jmp-source:(".concat(ANY_NON_WS, ") (?:csi=(").concat(ANY_NON_WS, "))"));
12923
- DefaultSdpGrammar.addParser('a', JmpLine.fromSdpLine);
12924
- DefaultSdpGrammar.addParser('a', JmpSourceLine.fromSdpLine);
12925
- DefaultSdpGrammar.addParser('a', JmpStreamIdModeLine.fromSdpLine);
12926
- function deepCopy(source) {
12927
- return Array.isArray(source) ? source.map(item => deepCopy(item)) : source instanceof Map ? new Map(source) : source instanceof Date ? new Date(source.getTime()) : source && typeof source === 'object' ? Object.getOwnPropertyNames(source).reduce((o, prop) => {
12928
- Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
12929
- o[prop] = deepCopy(source[prop]);
12930
- return o;
12931
- }, Object.create(Object.getPrototypeOf(source))) : source;
12932
- }
12933
- function getMediaTypeForMline(mLine) {
12934
- var _a, _b;
12935
- var mediaFamily;
12936
- if (mLine.type.toLowerCase() === MediaFamily$1.Audio.toLowerCase()) {
12937
- mediaFamily = MediaFamily$1.Audio;
12938
- } else if (mLine.type.toLowerCase() === MediaFamily$1.Video.toLowerCase()) {
12939
- mediaFamily = MediaFamily$1.Video;
12940
- } else {
12941
- throw Error("Mline type doesn't match any known MediaFamily: ".concat(mLine.type));
12942
- }
12943
- var mediaContent;
12944
- if ((_b = (_a = mLine.content) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.some(v => v.toLowerCase() === 'slides')) {
12945
- mediaContent = MediaContent$1.Slides;
12946
- } else {
12947
- mediaContent = MediaContent$1.Main;
12948
- }
12949
- return getMediaType(mediaFamily, mediaContent);
12950
- }
12951
- function filterCodecs(parsedSdp, allowedCodecs) {
12952
- var allowedLowerCase = allowedCodecs.map(s => s.toLowerCase());
12953
- parsedSdp.avMedia.map(m => [...m.codecs.values()].map(c => c.name)).flat().filter(codecName => !allowedLowerCase.includes(codecName.toLowerCase())).forEach(c => removeCodec(parsedSdp, c));
12954
- }
12955
- function setMaxBandwidth(parsedSdp, maxBandwidth) {
12956
- parsedSdp.avMedia.forEach(mline => {
12957
- mline.bandwidth = new BandwidthLine('TIAS', maxBandwidth);
12958
- });
12959
- }
12960
- function setupBundle(parsedSdp, bundlePolicy) {
12961
- if (bundlePolicy === 'compat') {
12962
- var audioMids = parsedSdp.avMedia.filter(m => m.type === 'audio').map(m => m.mid);
12963
- var videoMids = parsedSdp.avMedia.filter(m => m.type === 'video').map(m => m.mid);
12964
- parsedSdp.session.groups.splice(0, parsedSdp.session.groups.length);
12965
- parsedSdp.session.groups.push(new BundleGroupLine(audioMids));
12966
- parsedSdp.session.groups.push(new BundleGroupLine(videoMids));
12967
- }
12968
- }
12969
- function filterRecvOnlyMlines(parsedSdp) {
12970
- var filteredMids = [];
12971
- parsedSdp.media = parsedSdp.media.filter(mLine => {
12972
- if (mLine instanceof ApplicationMediaDescription || mLine instanceof AvMediaDescription && mLine.direction !== 'recvonly') {
12973
- filteredMids.push(mLine.mid);
12974
- return true;
12975
- }
12976
- return false;
12977
- });
12978
- parsedSdp.session.groups.forEach(g => {
12979
- g.mids = g.mids.filter(m => filteredMids.includes(m));
12980
- });
12981
- }
12982
- function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
12983
- parsedAnswer.session.groups = parsedOffer.session.groups;
12984
- parsedAnswer.media = parsedOffer.media.map(offerMline => {
12985
- if (!offerMline.mid) {
12986
- throw new Error("Offer mline is missing MID");
12987
- }
12988
- var answerMline = parsedAnswer.media.find(m => m.mid === offerMline.mid);
12989
- if (answerMline) {
12990
- if (answerMline instanceof AvMediaDescription) {
12991
- [...answerMline.codecs.values()].forEach(ci => {
12992
- ci.fmtParams.push('x-google-start-bitrate=60000');
12993
- });
12994
- }
12995
- return answerMline;
12996
- }
12997
- if (!(offerMline instanceof AvMediaDescription)) {
12998
- throw new Error("Answer is missing a non-media mline: ".concat(offerMline.mid));
12999
- }
13000
- var startingMline = parsedAnswer.avMedia.find(m => m.type === offerMline.type);
13001
- if (!startingMline) {
13002
- throw new Error("Answer has no mline of type ".concat(offerMline.type, ", can't generate synthetic answer mline for mid ").concat(offerMline.mid));
13003
- }
13004
- var fakeCorrespondingMline = deepCopy(startingMline);
13005
- fakeCorrespondingMline.mid = offerMline.mid;
13006
- fakeCorrespondingMline.simulcast = undefined;
13007
- if (offerMline.direction === 'sendrecv' || offerMline.direction === 'sendonly') {
13008
- fakeCorrespondingMline.direction = 'recvonly';
13009
- }
13010
- if (offerMline.direction === 'recvonly') {
13011
- fakeCorrespondingMline.direction = 'sendonly';
13012
- var ingressSignaler = streamSignalerManager.getIngressStreamSignalerOrThrow(offerMline.mid);
13013
- ingressSignaler.signalRemoteStreams(fakeCorrespondingMline);
13014
- }
13015
- return fakeCorrespondingMline;
13016
- });
13017
- }
13018
- function injectContentTypes(sdp, contentTypeMap) {
13019
- contentTypeMap.forEach((mediaContent, mid) => {
13020
- var mline = sdp.media.find(m => m.mid === mid);
13021
- if (!mline) {
13022
- throw new Error("Error trying to set content type for mid ".concat(mid, ": not found in SDP"));
13023
- }
13024
- if (mediaContent === MediaContent$1.Slides) {
13025
- mline.addLine(new ContentLine(['slides']));
13026
- }
13027
- });
13028
- }
13029
- function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
13030
- parsedSdp.avMedia.filter(mLine => mLine.direction === 'sendrecv' || mLine.direction === 'sendonly').forEach(mLine => {
13031
- if (!mLine.otherLines.find(line => line instanceof JmpLine)) {
13032
- mLine.addLine(new JmpLine());
13033
- }
13034
- if (!mLine.otherLines.find(line => line instanceof JmpSourceLine)) {
13035
- var mediaType = getMediaTypeForMline(mLine);
13036
- var csi = csiMap.get(mediaType);
13037
- if (!csi) {
13038
- throw new Error("Unable to find CSI for MediaType ".concat(mediaType));
13039
- }
13040
- mLine.addLine(new JmpSourceLine(mLine.mid, csi.toString()));
13041
- }
13042
- if (!mLine.otherLines.find(line => line instanceof JmpStreamIdModeLine)) {
13043
- mLine.addLine(new JmpStreamIdModeLine(streamSignalingMode));
13044
- }
13045
- });
13046
- }
13047
- class SendOnlyTransceiver extends Transceiver {
13048
- constructor(rtcpRtpTransceiver, csi) {
13049
- super(rtcpRtpTransceiver);
13050
- this.requested = false;
13051
- this.csi = csi;
13052
- this.handleTrackChange = this.handleTrackChange.bind(this);
13053
- }
13054
- handleTrackChange() {
13055
- var _a;
13056
- return __awaiter(this, void 0, void 0, function* () {
13057
- if (this.requested) {
13058
- yield this.sender.replaceTrack(((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null);
13059
- }
13060
- });
13061
- }
13062
- replacePublishedTrack(newTrack) {
13063
- var _a, _b;
13064
- return __awaiter(this, void 0, void 0, function* () {
13065
- (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.off(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
13066
- (_b = this.publishedTrack) === null || _b === void 0 ? void 0 : _b.setPublished(false);
13067
- if (this.requested) {
13068
- yield this.sender.replaceTrack((newTrack === null || newTrack === void 0 ? void 0 : newTrack.underlyingTrack) || null);
13069
- }
13070
- this.publishedTrack = newTrack;
13071
- newTrack === null || newTrack === void 0 ? void 0 : newTrack.on(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
13072
- newTrack === null || newTrack === void 0 ? void 0 : newTrack.setPublished(true);
13073
- });
13074
- }
13075
- setTrackRequested(requested) {
13076
- var _a;
13077
- return __awaiter(this, void 0, void 0, function* () {
13078
- if (this.requested !== requested) {
13079
- this.requested = requested;
13080
- var newTrack = requested ? ((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null : null;
13081
- yield this.sender.replaceTrack(newTrack);
13082
- }
13083
- });
13084
- }
13085
- updateSimulcastStreamStates(requestedIdEncodingParamsMap) {
13086
- return __awaiter(this, void 0, void 0, function* () {
13087
- var sendParameters = this.sender.getParameters();
13088
- sendParameters.encodings.forEach((encoding, index) => {
13089
- var encodingParams = requestedIdEncodingParamsMap.get(index);
13090
- encoding.active = Boolean(encodingParams);
13091
- if (encodingParams) {
13092
- if (encodingParams.scaleDownRatio >= 1 && encoding.scaleResolutionDownBy !== encodingParams.scaleDownRatio) {
13093
- encoding.scaleResolutionDownBy = encodingParams.scaleDownRatio;
13321
+ type: s.PLATFORMS_MAP.tablet,
13322
+ vendor: "Apple",
13323
+ model: "iPad"
13324
+ };
13094
13325
  }
13095
- if (encodingParams.maxPayloadBitsPerSecond) {
13096
- encoding.maxBitrate = encodingParams.maxPayloadBitsPerSecond;
13326
+ }, {
13327
+ test: [/kftt build/i],
13328
+ describe: function describe() {
13329
+ return {
13330
+ type: s.PLATFORMS_MAP.tablet,
13331
+ vendor: "Amazon",
13332
+ model: "Kindle Fire HD 7"
13333
+ };
13334
+ }
13335
+ }, {
13336
+ test: [/silk/i],
13337
+ describe: function describe() {
13338
+ return {
13339
+ type: s.PLATFORMS_MAP.tablet,
13340
+ vendor: "Amazon"
13341
+ };
13342
+ }
13343
+ }, {
13344
+ test: [/tablet(?! pc)/i],
13345
+ describe: function describe() {
13346
+ return {
13347
+ type: s.PLATFORMS_MAP.tablet
13348
+ };
13349
+ }
13350
+ }, {
13351
+ test: function test(e) {
13352
+ var t = e.test(/ipod|iphone/i),
13353
+ r = e.test(/like (ipod|iphone)/i);
13354
+ return t && !r;
13355
+ },
13356
+ describe: function describe(e) {
13357
+ var t = i.default.getFirstMatch(/(ipod|iphone)/i, e);
13358
+ return {
13359
+ type: s.PLATFORMS_MAP.mobile,
13360
+ vendor: "Apple",
13361
+ model: t
13362
+ };
13363
+ }
13364
+ }, {
13365
+ test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
13366
+ describe: function describe() {
13367
+ return {
13368
+ type: s.PLATFORMS_MAP.mobile,
13369
+ vendor: "Nexus"
13370
+ };
13371
+ }
13372
+ }, {
13373
+ test: [/[^-]mobi/i],
13374
+ describe: function describe() {
13375
+ return {
13376
+ type: s.PLATFORMS_MAP.mobile
13377
+ };
13378
+ }
13379
+ }, {
13380
+ test: function test(e) {
13381
+ return "blackberry" === e.getBrowserName(!0);
13382
+ },
13383
+ describe: function describe() {
13384
+ return {
13385
+ type: s.PLATFORMS_MAP.mobile,
13386
+ vendor: "BlackBerry"
13387
+ };
13388
+ }
13389
+ }, {
13390
+ test: function test(e) {
13391
+ return "bada" === e.getBrowserName(!0);
13392
+ },
13393
+ describe: function describe() {
13394
+ return {
13395
+ type: s.PLATFORMS_MAP.mobile
13396
+ };
13397
+ }
13398
+ }, {
13399
+ test: function test(e) {
13400
+ return "windows phone" === e.getBrowserName();
13401
+ },
13402
+ describe: function describe() {
13403
+ return {
13404
+ type: s.PLATFORMS_MAP.mobile,
13405
+ vendor: "Microsoft"
13406
+ };
13407
+ }
13408
+ }, {
13409
+ test: function test(e) {
13410
+ var t = Number(String(e.getOSVersion()).split(".")[0]);
13411
+ return "android" === e.getOSName(!0) && t >= 3;
13412
+ },
13413
+ describe: function describe() {
13414
+ return {
13415
+ type: s.PLATFORMS_MAP.tablet
13416
+ };
13417
+ }
13418
+ }, {
13419
+ test: function test(e) {
13420
+ return "android" === e.getOSName(!0);
13421
+ },
13422
+ describe: function describe() {
13423
+ return {
13424
+ type: s.PLATFORMS_MAP.mobile
13425
+ };
13426
+ }
13427
+ }, {
13428
+ test: function test(e) {
13429
+ return "macos" === e.getOSName(!0);
13430
+ },
13431
+ describe: function describe() {
13432
+ return {
13433
+ type: s.PLATFORMS_MAP.desktop,
13434
+ vendor: "Apple"
13435
+ };
13436
+ }
13437
+ }, {
13438
+ test: function test(e) {
13439
+ return "windows" === e.getOSName(!0);
13440
+ },
13441
+ describe: function describe() {
13442
+ return {
13443
+ type: s.PLATFORMS_MAP.desktop
13444
+ };
13445
+ }
13446
+ }, {
13447
+ test: function test(e) {
13448
+ return "linux" === e.getOSName(!0);
13449
+ },
13450
+ describe: function describe() {
13451
+ return {
13452
+ type: s.PLATFORMS_MAP.desktop
13453
+ };
13454
+ }
13455
+ }, {
13456
+ test: function test(e) {
13457
+ return "playstation 4" === e.getOSName(!0);
13458
+ },
13459
+ describe: function describe() {
13460
+ return {
13461
+ type: s.PLATFORMS_MAP.tv
13462
+ };
13463
+ }
13464
+ }, {
13465
+ test: function test(e) {
13466
+ return "roku" === e.getOSName(!0);
13467
+ },
13468
+ describe: function describe() {
13469
+ return {
13470
+ type: s.PLATFORMS_MAP.tv
13471
+ };
13472
+ }
13473
+ }];
13474
+ t.default = a, e.exports = t.default;
13475
+ },
13476
+ 95: function _(e, t, r) {
13477
+ t.__esModule = !0, t.default = void 0;
13478
+ var n,
13479
+ i = (n = r(17)) && n.__esModule ? n : {
13480
+ default: n
13481
+ },
13482
+ s = r(18);
13483
+ var a = [{
13484
+ test: function test(e) {
13485
+ return "microsoft edge" === e.getBrowserName(!0);
13486
+ },
13487
+ describe: function describe(e) {
13488
+ if (/\sedg\//i.test(e)) return {
13489
+ name: s.ENGINE_MAP.Blink
13490
+ };
13491
+ var t = i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, e);
13492
+ return {
13493
+ name: s.ENGINE_MAP.EdgeHTML,
13494
+ version: t
13495
+ };
13496
+ }
13497
+ }, {
13498
+ test: [/trident/i],
13499
+ describe: function describe(e) {
13500
+ var t = {
13501
+ name: s.ENGINE_MAP.Trident
13502
+ },
13503
+ r = i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, e);
13504
+ return r && (t.version = r), t;
13097
13505
  }
13098
- }
13099
- });
13100
- yield this.sender.setParameters(sendParameters);
13101
- });
13102
- }
13103
- getScaleDownRatio(expectedMaxFs) {
13104
- var _a;
13105
- if (!expectedMaxFs) {
13106
- return -1;
13107
- }
13108
- if (!this.publishedTrack) {
13109
- return -1;
13110
- }
13111
- var setting = (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
13112
- var sourceHeight = setting === null || setting === void 0 ? void 0 : setting.height;
13113
- var sourceWidth = setting === null || setting === void 0 ? void 0 : setting.width;
13114
- if (!sourceWidth || !sourceHeight) {
13115
- return -1;
13116
- }
13117
- return getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, expectedMaxFs);
13118
- }
13119
- publishTrack(track) {
13120
- return this.replacePublishedTrack(track);
13121
- }
13122
- unpublishTrack() {
13123
- return this.replacePublishedTrack();
13124
- }
13125
- setActive(enabled) {
13126
- var direction = enabled ? 'sendrecv' : 'inactive';
13127
- this._rtcRtpTransceiver.direction = direction;
13128
- return this._rtcRtpTransceiver.direction !== this._rtcRtpTransceiver.currentDirection;
13129
- }
13130
- getIngressPayloadType(mimeType) {
13131
- var senderCodecs = this.sender.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
13132
- var receiverCodecs = this.receiver.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
13133
- if (!senderCodecs || !receiverCodecs || senderCodecs.length === 0 || receiverCodecs.length === 0) {
13134
- throw new Error("sender codecs or receiver codecs is undefined or empty");
13135
- }
13136
- var senderCodec = senderCodecs[0];
13137
- var targetCodec = receiverCodecs.find(receiverCodec => {
13138
- return areCodecsCompatible(senderCodec, receiverCodec);
13139
- });
13140
- if (!targetCodec || !targetCodec.payloadType) {
13141
- throw new Error("ingress payload type is not well defined in receiver codecs");
13142
- }
13143
- return targetCodec.payloadType;
13144
- }
13145
- }
13146
- var simulcastMaxFrameSizes = {
13147
- 0: '240',
13148
- 1: '2304',
13149
- 2: '8160'
13150
- };
13151
- class RidIngressStreamSignaler {
13152
- constructor(mid) {
13153
- this.mid = mid;
13154
- }
13155
- getReceiverId() {
13156
- return {
13157
- mid: this.mid,
13158
- rid: '1'
13159
- };
13160
- }
13161
- signalLocalStreams(mLine) {}
13162
- signalRemoteStreams(mLine) {}
13163
- }
13164
- class RidEgressStreamSignaler {
13165
- constructor(mid) {
13166
- this.streamIds = [];
13167
- this.mid = mid;
13168
- }
13169
- signalStreams(simulcastEnabled, _rtxEnabled, mLine) {
13170
- mLine.ssrcGroups = [];
13171
- if (this.streamIds.length === 0) {
13172
- if (simulcastEnabled) {
13173
- this.streamIds = [{
13174
- mid: this.mid,
13175
- rid: 'low'
13176
13506
  }, {
13177
- mid: this.mid,
13178
- rid: 'medium'
13507
+ test: function test(e) {
13508
+ return e.test(/presto/i);
13509
+ },
13510
+ describe: function describe(e) {
13511
+ var t = {
13512
+ name: s.ENGINE_MAP.Presto
13513
+ },
13514
+ r = i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, e);
13515
+ return r && (t.version = r), t;
13516
+ }
13179
13517
  }, {
13180
- mid: this.mid,
13181
- rid: 'high'
13182
- }];
13183
- } else {
13184
- this.streamIds = [{
13185
- mid: this.mid
13518
+ test: function test(e) {
13519
+ var t = e.test(/gecko/i),
13520
+ r = e.test(/like gecko/i);
13521
+ return t && !r;
13522
+ },
13523
+ describe: function describe(e) {
13524
+ var t = {
13525
+ name: s.ENGINE_MAP.Gecko
13526
+ },
13527
+ r = i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, e);
13528
+ return r && (t.version = r), t;
13529
+ }
13530
+ }, {
13531
+ test: [/(apple)?webkit\/537\.36/i],
13532
+ describe: function describe() {
13533
+ return {
13534
+ name: s.ENGINE_MAP.Blink
13535
+ };
13536
+ }
13537
+ }, {
13538
+ test: [/(apple)?webkit/i],
13539
+ describe: function describe(e) {
13540
+ var t = {
13541
+ name: s.ENGINE_MAP.WebKit
13542
+ },
13543
+ r = i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, e);
13544
+ return r && (t.version = r), t;
13545
+ }
13186
13546
  }];
13187
- }
13188
- }
13189
- if (simulcastEnabled) {
13190
- mLine.rids = this.streamIds.map((streamId, index) => new RidLine(streamId.rid, 'send', "max-fs=".concat(simulcastMaxFrameSizes[index])));
13191
- mLine.simulcast = new SimulcastLine(SimulcastLayerList.fromString('low;medium;high'), new SimulcastLayerList());
13192
- }
13193
- }
13194
- getSenderIds() {
13195
- return this.streamIds;
13196
- }
13197
- getEncodingIndexForStreamId(streamId) {
13198
- return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
13199
- }
13200
- }
13201
- function generateSsrc() {
13202
- return Math.floor(Math.random() * 0xffffffff);
13203
- }
13204
- class SsrcIngressStreamSignaler {
13205
- constructor() {
13206
- this.ssrc = generateSsrc();
13207
- }
13208
- getReceiverId() {
13209
- return Object.assign({
13210
- ssrc: this.ssrc
13211
- }, this.rtxSsrc ? {
13212
- rtxSsrc: this.rtxSsrc
13213
- } : {});
13214
- }
13215
- signalLocalStreams(_mLine) {}
13216
- signalRemoteStreams(mLine) {
13217
- mLine.addLine(new SsrcLine(this.ssrc, 'cname', "".concat(this.ssrc, "-cname")));
13218
- mLine.addLine(new SsrcLine(this.ssrc, 'msid', '-', '1'));
13219
- if (hasCodec('rtx', mLine)) {
13220
- this.rtxSsrc = generateSsrc();
13221
- mLine.addLine(new SsrcLine(this.rtxSsrc, 'cname', "".concat(this.ssrc, "-cname")));
13222
- mLine.addLine(new SsrcLine(this.rtxSsrc, 'msid', '-', '1'));
13223
- mLine.addLine(new SsrcGroupLine('FID', [this.ssrc, this.rtxSsrc]));
13224
- }
13225
- }
13226
- }
13227
- class SsrcEgressStreamSignaler {
13228
- constructor() {
13229
- this.streamIds = [];
13230
- }
13231
- signalStreams(simulcastEnabled, rtxEnabled, mLine) {
13232
- mLine.rids = [];
13233
- mLine.simulcast = undefined;
13234
- mLine.ssrcs = [];
13235
- mLine.ssrcGroups = [];
13236
- if (this.streamIds.length === 0) {
13237
- var numStreams = simulcastEnabled ? 3 : 1;
13238
- [...Array(numStreams).keys()].forEach(() => {
13239
- var newStreamId = {
13240
- ssrc: generateSsrc()
13241
- };
13242
- if (rtxEnabled) {
13243
- newStreamId.rtxSsrc = generateSsrc();
13244
- }
13245
- this.streamIds.push(newStreamId);
13246
- });
13247
- }
13248
- this.streamIds.forEach((streamId, index) => {
13249
- var rtpSsrc = streamId.ssrc;
13250
- mLine.addLine(new SsrcLine(rtpSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
13251
- mLine.addLine(new SsrcLine(rtpSsrc, 'msid', '-', '1'));
13252
- if (simulcastEnabled) {
13253
- mLine.addLine(new SsrcLine(rtpSsrc, 'fmtp', "* max-fs=".concat(simulcastMaxFrameSizes[index])));
13254
- }
13255
- if (rtxEnabled) {
13256
- var rtxSsrc = streamId.rtxSsrc;
13257
- mLine.addLine(new SsrcLine(rtxSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
13258
- mLine.addLine(new SsrcLine(rtxSsrc, 'msid', '-', '1'));
13259
- mLine.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
13547
+ t.default = a, e.exports = t.default;
13260
13548
  }
13261
13549
  });
13262
- if (simulcastEnabled) {
13263
- mLine.addLine(new SsrcGroupLine('SIM', this.streamIds.map(streamId => streamId.ssrc)));
13264
- }
13265
- }
13266
- getSenderIds() {
13267
- return this.streamIds;
13268
- }
13269
- getEncodingIndexForStreamId(streamId) {
13270
- return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
13271
- }
13272
- }
13273
- class StreamSignalerManager {
13274
- constructor(streamSignalingMode) {
13275
- this.egressStreamSignalersByMid = new Map();
13276
- this.ingressStreamsSignalersByMid = new Map();
13277
- this.ingressStreamSignalingMode = streamSignalingMode;
13278
- this.egressStreamSignalingMode = streamSignalingMode;
13279
- }
13280
- getOrCreateEgressStreamSignaler(mid) {
13281
- var existing = this.getEgressStreamSignaler(mid);
13282
- if (existing) {
13283
- return existing;
13284
- }
13285
- var newSignaler;
13286
- if (this.egressStreamSignalingMode === 'MID-RID') {
13287
- newSignaler = new RidEgressStreamSignaler(mid);
13288
- } else {
13289
- newSignaler = new SsrcEgressStreamSignaler();
13290
- }
13291
- this.egressStreamSignalersByMid.set(mid, newSignaler);
13292
- return newSignaler;
13293
- }
13294
- getEgressStreamSignalerOrThrow(mid) {
13295
- var existing = this.getEgressStreamSignaler(mid);
13296
- if (!existing) {
13297
- throw new Error("Couldn't find EgressStreamSignaler for mid ".concat(mid));
13298
- }
13299
- return existing;
13300
- }
13301
- getEgressStreamSignaler(mid) {
13302
- return this.egressStreamSignalersByMid.get(mid);
13303
- }
13304
- getOrCreateIngressStreamSignaler(mid) {
13305
- var existing = this.getIngressStreamSignaler(mid);
13306
- if (existing) {
13307
- return existing;
13308
- }
13309
- var newSignaler;
13310
- if (this.ingressStreamSignalingMode === 'MID-RID') {
13311
- newSignaler = new RidIngressStreamSignaler(mid);
13312
- } else {
13313
- newSignaler = new SsrcIngressStreamSignaler();
13314
- }
13315
- this.ingressStreamsSignalersByMid.set(mid, newSignaler);
13316
- return newSignaler;
13317
- }
13318
- getIngressStreamSignaler(mid) {
13319
- return this.ingressStreamsSignalersByMid.get(mid);
13320
- }
13321
- getIngressStreamSignalerOrThrow(mid) {
13322
- var existing = this.getIngressStreamSignaler(mid);
13323
- if (!existing) {
13324
- throw new Error("Couldn't find IngressStreamSignaler for mid ".concat(mid));
13325
- }
13326
- return existing;
13327
- }
13550
+ });
13551
+ })(es5);
13552
+ var Bowser = /*@__PURE__*/getDefaultExportFromCjs(es5.exports);
13553
+ function getBrowserDetails() {
13554
+ var browser = Bowser.getParser(window.navigator.userAgent);
13555
+ return browser.getBrowser();
13328
13556
  }
13329
13557
  var logger$1 = {
13330
13558
  exports: {}
@@ -13617,8 +13845,9 @@ var MultistreamConnectionEventNames;
13617
13845
  var defaultMultistreamConnectionOptions = {
13618
13846
  floorControlledPresentation: false,
13619
13847
  disableSimulcast: false,
13620
- streamSignalingMode: 'MID-RID',
13621
- bundlePolicy: 'compat'
13848
+ streamSignalingMode: 'SSRC',
13849
+ bundlePolicy: 'compat',
13850
+ iceServers: undefined
13622
13851
  };
13623
13852
  class MultistreamConnection extends EventEmitter {
13624
13853
  constructor() {
@@ -13629,43 +13858,51 @@ class MultistreamConnection extends EventEmitter {
13629
13858
  this.jmpSessions = new Map();
13630
13859
  this.pendingJmpTasks = [];
13631
13860
  this.metricsCallback = () => {};
13861
+ this.overuseUpdateCallback = () => {};
13632
13862
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
13633
13863
  logger$4.info("Creating multistream connection with options ".concat(JSON.stringify(this.options)));
13634
- this.pc = new PeerConnection();
13635
- this.pc.on(PeerConnection.Events.ConnectionStateChange, state => this.emit(MultistreamConnectionEventNames.ConnectionStateUpdate, state));
13864
+ this.initializePeerConnection();
13636
13865
  this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
13637
- this.attachMetricsObserver();
13866
+ this.overuseStateManager = new OveruseStateManager(overuseState => this.overuseUpdateCallback(overuseState));
13867
+ this.overuseStateManager.start();
13868
+ this.statsManager = new StatsManager(() => this.pc.getStats(), stats => this.preProcessStats(stats));
13638
13869
  var mainSceneId = generateSceneId();
13639
- var videoMainEncodingOptions = !this.options.disableSimulcast ? [{
13640
- scaleResolutionDownBy: 4,
13641
- active: true
13642
- }, {
13643
- scaleResolutionDownBy: 2,
13644
- active: true
13645
- }, {
13646
- active: true
13647
- }] : [];
13870
+ var videoMainEncodingOptions = this.getVideoEncodingOptions();
13648
13871
  this.createSendTransceiver(MediaType$1.VideoMain, mainSceneId, videoMainEncodingOptions);
13649
13872
  this.createSendTransceiver(MediaType$1.AudioMain, mainSceneId);
13650
13873
  if (this.options.floorControlledPresentation) {
13651
- var videoPresentationEncodingOptions = !this.options.disableSimulcast ? [{
13652
- scaleResolutionDownBy: 4,
13653
- active: true
13654
- }, {
13655
- scaleResolutionDownBy: 2,
13656
- active: true
13657
- }, {
13658
- active: true
13659
- }] : [];
13874
+ var videoPresentationEncodingOptions = this.getVideoEncodingOptions();
13660
13875
  var contentSceneId = generateSceneId();
13661
13876
  this.createSendTransceiver(MediaType$1.VideoSlides, contentSceneId, videoPresentationEncodingOptions);
13662
13877
  this.createSendTransceiver(MediaType$1.AudioSlides, contentSceneId);
13663
13878
  }
13879
+ }
13880
+ initializePeerConnection() {
13881
+ var _a;
13882
+ (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
13883
+ this.pc = new PeerConnection({
13884
+ iceServers: this.options.iceServers
13885
+ });
13886
+ this.pc.on(PeerConnection.Events.ConnectionStateChange, state => this.emit(MultistreamConnectionEventNames.ConnectionStateUpdate, state));
13887
+ this.attachMetricsObserver();
13664
13888
  this.createDataChannel();
13665
13889
  }
13666
13890
  getConnectionState() {
13667
13891
  return this.pc.getConnectionState();
13668
13892
  }
13893
+ getVideoEncodingOptions() {
13894
+ return !this.options.disableSimulcast ? [{
13895
+ scaleResolutionDownBy: 4,
13896
+ active: false
13897
+ }, {
13898
+ scaleResolutionDownBy: 2,
13899
+ active: false
13900
+ }, {
13901
+ active: false
13902
+ }] : [{
13903
+ active: false
13904
+ }];
13905
+ }
13669
13906
  createSendTransceiver(mediaType, sceneId, sendEncodingsOptions) {
13670
13907
  var rtcTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
13671
13908
  direction: 'sendrecv',
@@ -13673,6 +13910,9 @@ class MultistreamConnection extends EventEmitter {
13673
13910
  });
13674
13911
  var csi = generateCsi(getMediaFamily(mediaType), sceneId);
13675
13912
  this.sendTransceivers.set(mediaType, new SendOnlyTransceiver(rtcTransceiver, csi));
13913
+ this.createJmpSession(mediaType);
13914
+ }
13915
+ createJmpSession(mediaType) {
13676
13916
  var jmpSession = new JmpSession(getMediaFamily(mediaType), getMediaContent(mediaType));
13677
13917
  jmpSession.setTxCallback(msg => {
13678
13918
  var _a;
@@ -13791,14 +14031,16 @@ class MultistreamConnection extends EventEmitter {
13791
14031
  maxPayloadBitsPerSecond
13792
14032
  });
13793
14033
  } else {
13794
- logger$4.warn("Unable to get encoding index for stream ID: ".concat(JSON.stringify(id)));
14034
+ logger$4.warn("".concat(mediaType, ": Unable to get encoding index for stream ID: ").concat(JSON.stringify(id)));
13795
14035
  }
13796
14036
  } else {
13797
- logger$4.warn("Unable to find matching stream ID for requested ID: ".concat(JSON.stringify(id)));
14037
+ logger$4.warn("".concat(mediaType, ": Unable to find matching stream ID for requested ID: ").concat(JSON.stringify(id)));
13798
14038
  }
13799
14039
  });
13800
14040
  sendTransceiver.setTrackRequested(requestedIdEncodingParamsMap.size > 0);
13801
- sendTransceiver.updateSimulcastStreamStates(requestedIdEncodingParamsMap);
14041
+ if (getMediaFamily(mediaType) === MediaFamily$1.Video) {
14042
+ sendTransceiver.updateSimulcastStreamStates(requestedIdEncodingParamsMap);
14043
+ }
13802
14044
  }
13803
14045
  createDataChannel() {
13804
14046
  var dataChannel = this.pc.createDataChannel('datachannel', {});
@@ -14040,8 +14282,8 @@ class MultistreamConnection extends EventEmitter {
14040
14282
  egressSignaler.signalStreams(simulcastEnabled, rtxEnabled, av);
14041
14283
  if (av.type === 'video') {
14042
14284
  [...av.codecs.values()].filter(ci => ci.name === 'H264').forEach(ci => {
14043
- ci.fmtParams.push("max-mbps=".concat(defaultGlobalMaxVideoMbps));
14044
- ci.fmtParams.push("max-fs=".concat(defaultGlobalMaxVideoFrameSize));
14285
+ ci.fmtParams.set('max-mbps', "".concat(defaultMaxVideoEncodeMbps));
14286
+ ci.fmtParams.set('max-fs', "".concat(defaultMaxVideoEncodeFrameSize));
14045
14287
  });
14046
14288
  }
14047
14289
  });
@@ -14063,6 +14305,14 @@ class MultistreamConnection extends EventEmitter {
14063
14305
  });
14064
14306
  injectJmpAttributes(parsed, csiMap, this.options.streamSignalingMode);
14065
14307
  filterRecvOnlyMlines(parsed);
14308
+ parsed.avMedia.filter(av => av.direction === 'sendrecv' && av.type === 'video').forEach(av => {
14309
+ var ssrcGroup = av.ssrcGroups.find(sg => sg.semantics === 'SIM');
14310
+ if (ssrcGroup) {
14311
+ ssrcGroup.ssrcs.forEach((ssrc, index) => {
14312
+ av.addLine(new SsrcLine(ssrc, 'fmtp', "* max-fs=".concat(simulcastMaxFrameSizes[index])));
14313
+ });
14314
+ }
14315
+ });
14066
14316
  return parsed.toString();
14067
14317
  }
14068
14318
  preProcessRemoteAnswer(answer) {
@@ -14105,13 +14355,24 @@ class MultistreamConnection extends EventEmitter {
14105
14355
  this.pendingJmpTasks.push(task);
14106
14356
  }
14107
14357
  }
14108
- renewPeerConnection() {
14109
- var _a;
14110
- (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
14111
- this.pc = new PeerConnection();
14112
- this.attachMetricsObserver();
14113
- this.createDataChannel();
14114
- this.sendTransceivers.forEach((transceiver, mediaType) => transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType))));
14358
+ renewPeerConnection(userOptions) {
14359
+ if (userOptions) {
14360
+ this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
14361
+ }
14362
+ logger$4.info("Renewing multistream connection with options ".concat(JSON.stringify(this.options)));
14363
+ this.initializePeerConnection();
14364
+ this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
14365
+ var mainSceneId = generateSceneId();
14366
+ this.sendTransceivers.forEach((transceiver, mediaType) => {
14367
+ var _a;
14368
+ transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
14369
+ direction: 'sendrecv',
14370
+ sendEncodings: getMediaFamily(mediaType) === MediaFamily$1.Video ? this.getVideoEncodingOptions() : undefined
14371
+ }));
14372
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), mainSceneId);
14373
+ (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
14374
+ this.createJmpSession(mediaType);
14375
+ });
14115
14376
  this.recvTransceivers.forEach((transceivers, mediaType) => {
14116
14377
  transceivers.forEach(t => {
14117
14378
  t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
@@ -14126,17 +14387,25 @@ class MultistreamConnection extends EventEmitter {
14126
14387
  return Object.keys(receiveSlotId).length === Object.keys(id).length && Object.keys(receiveSlotId).every(key => Object.prototype.hasOwnProperty.call(id, key) && receiveSlotId[key] === id[key]);
14127
14388
  });
14128
14389
  }
14390
+ getStats() {
14391
+ return this.statsManager.getStats();
14392
+ }
14129
14393
  preProcessStats(stats) {
14130
14394
  return __awaiter(this, void 0, void 0, function* () {
14131
14395
  yield Promise.all([...this.sendTransceivers.entries()].map(_ref5 => {
14132
14396
  var [mediaType, transceiver] = _ref5;
14133
14397
  return __awaiter(this, void 0, void 0, function* () {
14134
- (yield transceiver.getSenderStats()).forEach(senderStats => {
14398
+ (yield transceiver.getStats()).forEach(senderStats => {
14399
+ var _a;
14135
14400
  if (senderStats.type === 'outbound-rtp') {
14136
14401
  var statsToModify = stats[senderStats.id];
14137
14402
  statsToModify.mid = transceiver.mid;
14138
14403
  statsToModify.csi = transceiver.csi;
14139
14404
  statsToModify.mediaType = mediaType;
14405
+ var trackSettings = (_a = transceiver.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
14406
+ if (trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate) {
14407
+ statsToModify.targetFrameRate = trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate;
14408
+ }
14140
14409
  }
14141
14410
  });
14142
14411
  });
@@ -14145,7 +14414,7 @@ class MultistreamConnection extends EventEmitter {
14145
14414
  var [mediaType, transceivers] = _ref6;
14146
14415
  return __awaiter(this, void 0, void 0, function* () {
14147
14416
  yield Promise.all(transceivers.map(transceiver => __awaiter(this, void 0, void 0, function* () {
14148
- (yield transceiver.getReceiverStats()).forEach(receiverStats => {
14417
+ (yield transceiver.getStats()).forEach(receiverStats => {
14149
14418
  var _a;
14150
14419
  if (receiverStats.type === 'inbound-rtp') {
14151
14420
  var statsToModify = stats[receiverStats.id];
@@ -14169,6 +14438,9 @@ class MultistreamConnection extends EventEmitter {
14169
14438
  setMetricsCallback(callback) {
14170
14439
  this.metricsCallback = callback;
14171
14440
  }
14441
+ setOveruseUpdateCallback(callback) {
14442
+ this.overuseUpdateCallback = callback;
14443
+ }
14172
14444
  getCsiByMediaType(mediaType) {
14173
14445
  var _a;
14174
14446
  return (_a = this.sendTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.csi;
@@ -23202,6 +23474,9 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
23202
23474
  this.log('getConnectionState()', "called, returning ".concat(connectionState));
23203
23475
  return connectionState;
23204
23476
  }
23477
+ getStats() {
23478
+ return this.multistreamConnection.getStats();
23479
+ }
23205
23480
  roapMessageReceived(roapMessage) {
23206
23481
  this.log('roapMessageReceived()', "called with messageType=".concat(roapMessage.messageType, ", seq=").concat(roapMessage.seq));
23207
23482
  if (!this.sdpNegotiationStarted && roapMessage.messageType === 'OFFER') {
@@ -23209,17 +23484,43 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
23209
23484
  }
23210
23485
  this.roap.roapMessageReceived(roapMessage);
23211
23486
  }
23212
- publishTrack(track) {
23213
- if (track.kind === 'audio') {
23214
- return this.multistreamConnection.publishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23215
- }
23216
- return this.multistreamConnection.publishTrack(new LocalCameraTrack(new MediaStream([track])));
23487
+ publishTrack(track, mediaContent) {
23488
+ var _this = this;
23489
+ return _asyncToGenerator(function* () {
23490
+ _this.log('publishTrack()', "called with track.kind=".concat(track.kind, ", mediaContent=").concat(mediaContent));
23491
+ if (track.kind === 'audio') {
23492
+ if (mediaContent === 'main') {
23493
+ yield _this.multistreamConnection.publishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23494
+ } else {
23495
+ yield _this.multistreamConnection.publishTrack(new LocalDisplayTrack(new MediaStream([track])));
23496
+ }
23497
+ } else if (track.kind === 'video') {
23498
+ if (mediaContent === 'main') {
23499
+ yield _this.multistreamConnection.publishTrack(new LocalCameraTrack(new MediaStream([track])));
23500
+ } else {
23501
+ yield _this.multistreamConnection.publishTrack(new LocalDisplayTrack(new MediaStream([track])));
23502
+ }
23503
+ }
23504
+ })();
23217
23505
  }
23218
- unpublishTrack(track) {
23219
- if (track.kind === 'audio') {
23220
- return this.multistreamConnection.unpublishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23221
- }
23222
- return this.multistreamConnection.unpublishTrack(new LocalCameraTrack(new MediaStream([track])));
23506
+ unpublishTrack(track, mediaContent) {
23507
+ var _this2 = this;
23508
+ return _asyncToGenerator(function* () {
23509
+ _this2.log('unpublishTrack()', "called with track.kind=".concat(track.kind, ", mediaContent=").concat(mediaContent));
23510
+ if (track.kind === 'audio') {
23511
+ if (mediaContent === 'main') {
23512
+ yield _this2.multistreamConnection.unpublishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23513
+ } else {
23514
+ yield _this2.multistreamConnection.unpublishTrack(new LocalDisplayTrack(new MediaStream([track])));
23515
+ }
23516
+ } else if (track.kind === 'video') {
23517
+ if (mediaContent === 'main') {
23518
+ yield _this2.multistreamConnection.unpublishTrack(new LocalCameraTrack(new MediaStream([track])));
23519
+ } else {
23520
+ yield _this2.multistreamConnection.unpublishTrack(new LocalDisplayTrack(new MediaStream([track])));
23521
+ }
23522
+ }
23523
+ })();
23223
23524
  }
23224
23525
  createReceiveSlot(mediaType) {
23225
23526
  this.log('createReceiveSlot()', "called");