@webex/internal-media-core 2.5.2 → 2.5.3

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/cjs/index.js CHANGED
@@ -2867,7 +2867,8 @@ Object.keys(updatedStats).forEach(function(id){var report=updatedStats[id];if(re
2867
2867
  * @param timestamp - Time the event happened in milliseconds.
2868
2868
  */var trace=function trace(name,payload,timestamp){logger({timestamp:timestamp?Math.round(timestamp):Date.now(),name:name,payload:payload});};var origPeerConnection=window.RTCPeerConnection;pc.addEventListener('icecandidate',function(e){if(e.candidate){trace('onicecandidate',makeEvent(JSON.stringify(e.candidate)));}});pc.addEventListener('icecandidateerror',function(event){var url=event.url,errorCode=event.errorCode,errorText=event.errorText;trace('onicecandidateerror',makeEvent("[".concat(url,"] ").concat(errorCode,": ").concat(errorText)));});pc.addEventListener('track',function(e){trace('ontrack',makeEvent("".concat(e.track.kind,":").concat(e.track.id," ").concat(e.streams.map(function(stream){return "stream:".concat(stream.id);}).join(' '))));});pc.addEventListener('signalingstatechange',function(){trace('onsignalingstatechange',makeEvent(pc.signalingState));});pc.addEventListener('iceconnectionstatechange',function(){trace('oniceconnectionstatechange',makeEvent(pc.iceConnectionState));});pc.addEventListener('icegatheringstatechange',function(){trace('onicegatheringstatechange',makeEvent(pc.iceGatheringState));});pc.addEventListener('connectionstatechange',function(){trace('onconnectionstatechange',makeEvent(pc.connectionState));});pc.addEventListener('negotiationneeded',function(){trace('onnegotiationneeded',makeEvent('negotiationneeded'));});pc.addEventListener('datachannel',function(event){trace('ondatachannel',makeEvent("".concat(event.channel.id,": ").concat(event.channel.label)));});['createDataChannel','close'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){trace("on".concat(method),makeEvent(method));return nativeMethod.apply(this,arguments);};}});['addStream','removeStream'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var stream=arguments[0];var streamInfo=stream.getTracks().map(function(t){return "".concat(t.kind,":").concat(t.id);}).join(',');trace("on".concat(method),makeEvent("".concat(stream.id," ").concat(streamInfo)));return nativeMethod.apply(this,arguments);};}});['addTrack'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var track=arguments[0];var streams=[].slice.call(arguments,1);trace("on".concat(method),makeEvent("".concat(track.kind,":").concat(track.id," ").concat(streams.map(function(s){return "stream:".concat(s.id);}).join(';')||'-')));return nativeMethod.apply(this,arguments);};}});['removeTrack'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var track=arguments[0].track;trace("on".concat(method),makeEvent(track?"".concat(track.kind,":").concat(track.id):'null'));return nativeMethod.apply(this,arguments);};}});['createOffer','createAnswer'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var opts;var args=arguments;if(arguments.length===1&&typeof arguments[0]==='object'){// eslint-disable-next-line prefer-destructuring
2869
2869
  opts=arguments[0];}else if(arguments.length===3&&typeof arguments[2]==='object'){// eslint-disable-next-line prefer-destructuring
2870
- opts=arguments[2];}trace("on".concat(method),makeEvent(opts||''));return nativeMethod.apply(this,opts?[opts]:undefined).then(function(description){trace("on".concat(method,"OnSuccess"),makeEvent(description.sdp));if(args.length>0&&typeof args[0]==='function'){args[0].apply(null,[description]);return undefined;}return description;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>1&&typeof args[1]==='function'){args[1].apply(null,[err]);return;}throw err;});};}});['setLocalDescription','setRemoteDescription','addIceCandidate'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var _this=this;var args=arguments;trace("on".concat(method),makeEvent(method==='addIceCandidate'?arguments[0]:arguments[0].sdp));return nativeMethod.apply(this,[arguments[0]]).then(function(){trace("on".concat(method,"OnSuccess"),makeEvent('success'));if(method.endsWith('Description')){if(!_this.transportEventsPreviouslyAdded){var senders=_this.getSenders();var _loop_1=function _loop_1(sender){if(sender.transport){sender.transport.addEventListener('statechange',function(){if(sender&&sender.transport){trace("ondtlsStateChange",makeEvent(sender.transport.state));}});sender.transport.addEventListener('error',function(error){var errorEvent=error;trace("ondtlsError",makeEvent(errorEvent.error.errorDetail));});if(sender.transport.iceTransport){sender.transport.iceTransport.addEventListener('selectedcandidatepairchange',function(){var _a,_b,_c,_d,_e,_f;if(sender.transport&&sender.transport.iceTransport){var pair=sender.transport.iceTransport.getSelectedCandidatePair();var localCandidate="".concat((_a=pair===null||pair===void 0?void 0:pair.local)===null||_a===void 0?void 0:_a.address,":").concat((_b=pair===null||pair===void 0?void 0:pair.local)===null||_b===void 0?void 0:_b.port,"/").concat((_c=pair===null||pair===void 0?void 0:pair.local)===null||_c===void 0?void 0:_c.protocol);var remoteCandidate="".concat((_d=pair===null||pair===void 0?void 0:pair.remote)===null||_d===void 0?void 0:_d.address,":").concat((_e=pair===null||pair===void 0?void 0:pair.remote)===null||_e===void 0?void 0:_e.port,"/").concat((_f=pair===null||pair===void 0?void 0:pair.remote)===null||_f===void 0?void 0:_f.protocol);var pairString="local: ".concat(localCandidate,", remote: ").concat(remoteCandidate);trace('onselectedCandidatePairChange',makeEvent(pairString));}});}_this.transportEventsPreviouslyAdded=true;if(pc.getConfiguration().bundlePolicy==='max-bundle'){return "break";}}};for(var _i=0,senders_1=senders;_i<senders_1.length;_i++){var sender=senders_1[_i];var state_1=_loop_1(sender);if(state_1==="break")break;}}if(!_this.sctpEventsPreviouslyAdded){if(_this.sctp){_this.sctp.addEventListener('statechange',function(){trace('onsctpStateChange',makeEvent(_this.sctp.state));});_this.sctpEventsPreviouslyAdded=true;}}}if(args.length>=2&&typeof args[1]==='function'){args[1].apply(null,[]);return undefined;}return undefined;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>=3&&typeof args[2]==='function'){args[2].apply(null,[err]);return undefined;}throw err;});};}});if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var origGetUserMedia_1=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);var gum=function gum(){trace('onnavigator.mediaDevices.getUserMedia',makeEvent(JSON.stringify(arguments[0])));return origGetUserMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getUserMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getUserMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getUserMedia=gum.bind(navigator.mediaDevices);}if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){var origGetDisplayMedia_1=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);var gdm=function gdm(){trace('onnavigator.mediaDevices.getDisplayMedia',makeEvent(JSON.stringify(arguments[0])));return origGetDisplayMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getDisplayMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getDisplayMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getDisplayMedia=gdm.bind(navigator.mediaDevices);}var getStatsReport=function getStatsReport(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_a){return [2/*return*/,pc.getStats(null).then(function(res){// Convert from stats report to js Map in order to have values set in `statsPreProcessor`
2870
+ opts=arguments[2];}trace("on".concat(method),makeEvent(opts||''));return nativeMethod.apply(this,opts?[opts]:undefined).then(function(description){trace("on".concat(method,"OnSuccess"),makeEvent(description.sdp));if(args.length>0&&typeof args[0]==='function'){args[0].apply(null,[description]);return undefined;}return description;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>1&&typeof args[1]==='function'){args[1].apply(null,[err]);return;}throw err;});};}});['setLocalDescription','setRemoteDescription','addIceCandidate'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var _this=this;var args=arguments;trace("on".concat(method),makeEvent(method==='addIceCandidate'?arguments[0]:arguments[0].sdp));return nativeMethod.apply(this,[arguments[0]]).then(function(){var _a;trace("on".concat(method,"OnSuccess"),makeEvent('success'));if(method.endsWith('Description')){if(!_this.transportEventsPreviouslyAdded){var senders=_this.getSenders();var _loop_1=function _loop_1(sender){if(sender.transport){sender.transport.addEventListener('statechange',function(){if(sender&&sender.transport){trace("ondtlsStateChange",makeEvent(sender.transport.state));}});sender.transport.addEventListener('error',function(error){var errorEvent=error;trace("ondtlsError",makeEvent(errorEvent.error.errorDetail));});if(sender.transport.iceTransport){sender.transport.iceTransport.addEventListener('selectedcandidatepairchange',function(){var _a,_b,_c,_d,_e,_f;if(sender.transport&&sender.transport.iceTransport){var pair=sender.transport.iceTransport.getSelectedCandidatePair();var localCandidate="".concat((_a=pair===null||pair===void 0?void 0:pair.local)===null||_a===void 0?void 0:_a.address,":").concat((_b=pair===null||pair===void 0?void 0:pair.local)===null||_b===void 0?void 0:_b.port,"/").concat((_c=pair===null||pair===void 0?void 0:pair.local)===null||_c===void 0?void 0:_c.protocol);var remoteCandidate="".concat((_d=pair===null||pair===void 0?void 0:pair.remote)===null||_d===void 0?void 0:_d.address,":").concat((_e=pair===null||pair===void 0?void 0:pair.remote)===null||_e===void 0?void 0:_e.port,"/").concat((_f=pair===null||pair===void 0?void 0:pair.remote)===null||_f===void 0?void 0:_f.protocol);var pairString="local: ".concat(localCandidate,", remote: ").concat(remoteCandidate);trace('onselectedCandidatePairChange',makeEvent(pairString));}});}_this.transportEventsPreviouslyAdded=true;if(pc.getConfiguration().bundlePolicy==='max-bundle'){return "break";}}};for(var _i=0,senders_1=senders;_i<senders_1.length;_i++){var sender=senders_1[_i];var state_1=_loop_1(sender);if(state_1==="break")break;}}if(!_this.sctpEventsPreviouslyAdded){// Some Firefox versions prior to 113 have sctp defined but not the events, so check both here.
2871
+ if((_a=_this.sctp)===null||_a===void 0?void 0:_a.addEventListener){_this.sctp.addEventListener('statechange',function(){trace('onsctpStateChange',makeEvent(_this.sctp.state));});_this.sctpEventsPreviouslyAdded=true;}}}if(args.length>=2&&typeof args[1]==='function'){args[1].apply(null,[]);return undefined;}return undefined;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>=3&&typeof args[2]==='function'){args[2].apply(null,[err]);return undefined;}throw err;});};}});if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var origGetUserMedia_1=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);var gum=function gum(){trace('onnavigator.mediaDevices.getUserMedia',makeEvent(JSON.stringify(arguments[0])));return origGetUserMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getUserMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getUserMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getUserMedia=gum.bind(navigator.mediaDevices);}if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){var origGetDisplayMedia_1=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);var gdm=function gdm(){trace('onnavigator.mediaDevices.getDisplayMedia',makeEvent(JSON.stringify(arguments[0])));return origGetDisplayMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getDisplayMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getDisplayMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getDisplayMedia=gdm.bind(navigator.mediaDevices);}var getStatsReport=function getStatsReport(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_a){return [2/*return*/,pc.getStats(null).then(function(res){// Convert from stats report to js Map in order to have values set in `statsPreProcessor`
2871
2872
  var statsMap=new Map();res.forEach(function(stats,key){return statsMap.set(key,stats);});return statsPreProcessor(statsMap).then(function(){var now=map2obj(statsMap);var base=deepCopy$1(now);// our new prev
2872
2873
  var compressed=deltaCompression(prev,now);trace('stats-report',formatStatsReport(compressed),compressed.timestamp!==-Infinity?compressed.timestamp:undefined);prev=base;return Promise.resolve();});})];});});};var interval=window.setInterval(function(){if(pc.signalingState==='closed'){window.clearInterval(interval);return;}getStatsReport();},intervalTime);var forceStatsReport=function forceStatsReport(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_a){return [2/*return*/,getStatsReport()];});});};return {forceStatsReport:forceStatsReport};};rtcStats_1=rtcstats.rtcStats=rtcStats;var NUM$1='\\d+';var SDP_TOKEN$1="[!#$%&'*+\\-.^_`{|}~a-zA-Z0-9]+";var ANY_NON_WS$1='\\S+';var SP$1='\\s';var REST$1='.+';class Line$1{}var _a$5$1;class BandwidthLine$1 extends Line$1{constructor(bandwidthType,bandwidth){super();this.bandwidthType=bandwidthType;this.bandwidth=bandwidth;}static fromSdpLine(line){if(!BandwidthLine$1.regex.test(line)){return undefined;}var tokens=line.match(BandwidthLine$1.regex);var bandwidthType=tokens[1];var bandwidth=parseInt(tokens[2],10);return new BandwidthLine$1(bandwidthType,bandwidth);}toSdpLine(){return "b=".concat(this.bandwidthType,":").concat(this.bandwidth);}}_a$5$1=BandwidthLine$1;BandwidthLine$1.BW_TYPE_REGEX='CT|AS|TIAS';BandwidthLine$1.regex=new RegExp("^(".concat(_a$5$1.BW_TYPE_REGEX,"):(").concat(NUM$1,")"));class BundleGroupLine$1 extends Line$1{constructor(mids){super();this.mids=mids;}static fromSdpLine(line){if(!BundleGroupLine$1.regex.test(line)){return undefined;}var tokens=line.match(BundleGroupLine$1.regex);var mids=tokens[1].split(' ');return new BundleGroupLine$1(mids);}toSdpLine(){return "a=group:BUNDLE ".concat(this.mids.join(' '));}}BundleGroupLine$1.regex=new RegExp("^group:BUNDLE (".concat(REST$1,")"));var _a$4$1;class CandidateLine$1 extends Line$1{constructor(foundation,componentId,transport,priority,connectionAddress,port,candidateType,relAddr,relPort,candidateExtensions){super();this.foundation=foundation;this.componentId=componentId;this.transport=transport;this.priority=priority;this.connectionAddress=connectionAddress;this.port=port;this.candidateType=candidateType;this.relAddr=relAddr;this.relPort=relPort;this.candidateExtensions=candidateExtensions;}static fromSdpLine(line){if(!CandidateLine$1.regex.test(line)){return undefined;}var tokens=line.match(CandidateLine$1.regex);var foundation=tokens[1];var componentId=parseInt(tokens[2],10);var transport=tokens[3];var priority=parseInt(tokens[4],10);var connectionAddress=tokens[5];var port=parseInt(tokens[6],10);var candidateType=tokens[7];var relAddr=tokens[8];var relPort=tokens[9]?parseInt(tokens[9],10):undefined;var candidateExtensions=tokens[10];return new CandidateLine$1(foundation,componentId,transport,priority,connectionAddress,port,candidateType,relAddr,relPort,candidateExtensions);}toSdpLine(){var str='';str+="a=candidate:".concat(this.foundation," ").concat(this.componentId," ").concat(this.transport," ").concat(this.priority," ").concat(this.connectionAddress," ").concat(this.port," typ ").concat(this.candidateType);if(this.relAddr){str+=" raddr ".concat(this.relAddr);}if(this.relPort){str+=" rport ".concat(this.relPort);}if(this.candidateExtensions){str+=" ".concat(this.candidateExtensions);}return str;}}_a$4$1=CandidateLine$1;CandidateLine$1.ICE_CHARS="[a-zA-Z0-9+/]+";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,"))?"));class ConnectionLine$1 extends Line$1{constructor(netType,addrType,ipAddr){super();this.netType=netType;this.addrType=addrType;this.ipAddr=ipAddr;}static fromSdpLine(line){if(!ConnectionLine$1.regex.test(line)){return undefined;}var tokens=line.match(ConnectionLine$1.regex);var netType=tokens[1];var addrType=tokens[2];var ipAddr=tokens[3];return new ConnectionLine$1(netType,addrType,ipAddr);}toSdpLine(){return "c=".concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr);}}ConnectionLine$1.regex=new RegExp("^(".concat(ANY_NON_WS$1,") (").concat(ANY_NON_WS$1,") (").concat(ANY_NON_WS$1,")"));class ContentLine$1 extends Line$1{constructor(values){super();this.values=values;}static fromSdpLine(line){if(!ContentLine$1.regex.test(line)){return undefined;}var tokens=line.match(ContentLine$1.regex);var values=tokens[1].split(',');return new ContentLine$1(values);}toSdpLine(){return "a=content:".concat(this.values.join(','));}}ContentLine$1.regex=new RegExp("^content:(".concat(REST$1,")$"));class DirectionLine$1 extends Line$1{constructor(direction){super();this.direction=direction;}static fromSdpLine(line){if(!DirectionLine$1.regex.test(line)){return undefined;}var tokens=line.match(DirectionLine$1.regex);var direction=tokens[1];return new DirectionLine$1(direction);}toSdpLine(){return "a=".concat(this.direction);}}DirectionLine$1.regex=/^(sendrecv|sendonly|recvonly|inactive)$/;var _a$3$1;class ExtMapLine$1 extends Line$1{constructor(id,uri,direction,extensionAttributes){super();this.id=id;this.uri=uri;this.direction=direction;this.extensionAttributes=extensionAttributes;}static fromSdpLine(line){if(!ExtMapLine$1.regex.test(line)){return undefined;}var tokens=line.match(ExtMapLine$1.regex);var id=parseInt(tokens[1],10);var direction=tokens[2];var uri=tokens[3];var extensionAttributes=tokens[4];return new ExtMapLine$1(id,uri,direction,extensionAttributes);}toSdpLine(){var str='';str+="a=extmap:".concat(this.id);if(this.direction){str+="/".concat(this.direction);}str+=" ".concat(this.uri);if(this.extensionAttributes){str+=" ".concat(this.extensionAttributes);}return str;}}_a$3$1=ExtMapLine$1;ExtMapLine$1.EXTMAP_DIRECTION="sendonly|recvonly|sendrecv|inactive";ExtMapLine$1.regex=new RegExp("^extmap:(".concat(NUM$1,")(?:/(").concat(_a$3$1.EXTMAP_DIRECTION,"))? (").concat(ANY_NON_WS$1,")(?: (").concat(REST$1,"))?"));class FingerprintLine$1 extends Line$1{constructor(fingerprint){super();this.fingerprint=fingerprint;}static fromSdpLine(line){if(!FingerprintLine$1.regex.test(line)){return undefined;}var tokens=line.match(FingerprintLine$1.regex);var fingerprint=tokens[1];return new FingerprintLine$1(fingerprint);}toSdpLine(){return "a=fingerprint:".concat(this.fingerprint);}}FingerprintLine$1.regex=new RegExp("^fingerprint:(".concat(REST$1,")"));function parseFmtpParams$1(fmtpParams){fmtpParams=fmtpParams.replace(/^a=fmtp:\d+\x20/,'');var fmtpObj=new Map();if(/^\d+([,/-]\d+)+$/.test(fmtpParams)){fmtpObj.set(fmtpParams,undefined);return fmtpObj;}fmtpParams.split(';').forEach(param=>{var paramArr=param&&param.split('=');if(paramArr.length!==2||!paramArr[0]||!paramArr[1]){throw new Error("Fmtp params is invalid with ".concat(fmtpParams));}fmtpObj.set(paramArr[0],paramArr[1]);});return fmtpObj;}class FmtpLine$1 extends Line$1{constructor(payloadType,params){super();this.payloadType=payloadType;this.params=params;}static fromSdpLine(line){if(!FmtpLine$1.regex.test(line)){return undefined;}var tokens=line.match(FmtpLine$1.regex);var payloadType=parseInt(tokens[1],10);var params=tokens[2];return new FmtpLine$1(payloadType,parseFmtpParams$1(params));}toSdpLine(){var fmtParams=Array.from(this.params.keys()).map(key=>{if(this.params.get(key)!==undefined){return "".concat(key,"=").concat(this.params.get(key));}return "".concat(key);}).join(';');return "a=fmtp:".concat(this.payloadType," ").concat(fmtParams);}}FmtpLine$1.regex=new RegExp("^fmtp:(".concat(NUM$1,") (").concat(REST$1,")"));class IceOptionsLine$1 extends Line$1{constructor(options){super();this.options=options;}static fromSdpLine(line){if(!IceOptionsLine$1.regex.test(line)){return undefined;}var tokens=line.match(IceOptionsLine$1.regex);var options=tokens[1].split(' ');return new IceOptionsLine$1(options);}toSdpLine(){return "a=ice-options:".concat(this.options.join(' '));}}IceOptionsLine$1.regex=new RegExp("^ice-options:(".concat(REST$1,")$"));class IcePwdLine$1 extends Line$1{constructor(pwd){super();this.pwd=pwd;}static fromSdpLine(line){if(!IcePwdLine$1.regex.test(line)){return undefined;}var tokens=line.match(IcePwdLine$1.regex);var pwd=tokens[1];return new IcePwdLine$1(pwd);}toSdpLine(){return "a=ice-pwd:".concat(this.pwd);}}IcePwdLine$1.regex=new RegExp("^ice-pwd:(".concat(ANY_NON_WS$1,")$"));class IceUfragLine$1 extends Line$1{constructor(ufrag){super();this.ufrag=ufrag;}static fromSdpLine(line){if(!IceUfragLine$1.regex.test(line)){return undefined;}var tokens=line.match(IceUfragLine$1.regex);var ufrag=tokens[1];return new IceUfragLine$1(ufrag);}toSdpLine(){return "a=ice-ufrag:".concat(this.ufrag);}}IceUfragLine$1.regex=new RegExp("^ice-ufrag:(".concat(ANY_NON_WS$1,")$"));class MaxMessageSizeLine$1 extends Line$1{constructor(maxMessageSize){super();this.maxMessageSize=maxMessageSize;}static fromSdpLine(line){if(!MaxMessageSizeLine$1.regex.test(line)){return undefined;}var tokens=line.match(MaxMessageSizeLine$1.regex);var maxMessageSize=parseInt(tokens[1],10);return new MaxMessageSizeLine$1(maxMessageSize);}toSdpLine(){return "a=max-message-size:".concat(this.maxMessageSize);}}MaxMessageSizeLine$1.regex=new RegExp("^max-message-size:(".concat(NUM$1,")"));var _a$2$2;class MediaLine$1 extends Line$1{constructor(type,port,protocol,formats){super();this.type=type;this.port=port;this.protocol=protocol;this.formats=formats;}static fromSdpLine(line){if(!MediaLine$1.regex.test(line)){return undefined;}var tokens=line.match(MediaLine$1.regex);var type=tokens[1];var port=parseInt(tokens[2],10);var protocol=tokens[3];var formats=tokens[4].split(' ');return new MediaLine$1(type,port,protocol,formats);}toSdpLine(){return "m=".concat(this.type," ").concat(this.port," ").concat(this.protocol," ").concat(this.formats.join(' '));}}_a$2$2=MediaLine$1;MediaLine$1.MEDIA_TYPE='audio|video|application';MediaLine$1.regex=new RegExp("^(".concat(_a$2$2.MEDIA_TYPE,") (").concat(NUM$1,") (").concat(ANY_NON_WS$1,") (").concat(REST$1,")"));class MidLine$1 extends Line$1{constructor(mid){super();this.mid=mid;}static fromSdpLine(line){if(!MidLine$1.regex.test(line)){return undefined;}var tokens=line.match(MidLine$1.regex);var mid=tokens[1];return new MidLine$1(mid);}toSdpLine(){return "a=mid:".concat(this.mid);}}MidLine$1.regex=new RegExp("^mid:(".concat(ANY_NON_WS$1,")$"));class OriginLine$1 extends Line$1{constructor(username,sessionId,sessionVersion,netType,addrType,ipAddr){super();this.username=username;this.sessionId=sessionId;this.sessionVersion=sessionVersion;this.netType=netType;this.addrType=addrType;this.ipAddr=ipAddr;}static fromSdpLine(line){if(!OriginLine$1.regex.test(line)){return undefined;}var tokens=line.match(OriginLine$1.regex);var username=tokens[1];var sessionId=tokens[2];var sessionVersion=parseInt(tokens[3],10);var netType=tokens[4];var addrType=tokens[5];var ipAddr=tokens[6];return new OriginLine$1(username,sessionId,sessionVersion,netType,addrType,ipAddr);}toSdpLine(){return "o=".concat(this.username," ").concat(this.sessionId," ").concat(this.sessionVersion," ").concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr);}}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,")"));var _a$1$2;class RidLine$1 extends Line$1{constructor(id,direction,params){super();this.id=id;this.direction=direction;this.params=params;}static fromSdpLine(line){if(!RidLine$1.regex.test(line)){return undefined;}var tokens=line.match(RidLine$1.regex);var id=tokens[1];var direction=tokens[2];var params=tokens[3];return new RidLine$1(id,direction,params);}toSdpLine(){var str='';str+="a=rid:".concat(this.id," ").concat(this.direction);if(this.params){str+=" ".concat(this.params);}return str;}}_a$1$2=RidLine$1;RidLine$1.RID_ID="[\\w-]+";RidLine$1.RID_DIRECTION="\\bsend\\b|\\brecv\\b";RidLine$1.regex=new RegExp("^rid:(".concat(_a$1$2.RID_ID,") (").concat(_a$1$2.RID_DIRECTION,")(?:").concat(SP$1,"(").concat(REST$1,"))?"));class RtcpMuxLine$1 extends Line$1{static fromSdpLine(line){if(!RtcpMuxLine$1.regex.test(line)){return undefined;}return new RtcpMuxLine$1();}toSdpLine(){return "a=rtcp-mux";}}RtcpMuxLine$1.regex=/^rtcp-mux$/;class RtcpFbLine$1 extends Line$1{constructor(payloadType,feedback){super();this.payloadType=payloadType;this.feedback=feedback;}static fromSdpLine(line){if(!RtcpFbLine$1.regex.test(line)){return undefined;}var tokens=line.match(RtcpFbLine$1.regex);var payloadType=parseInt(tokens[1],10);var feedback=tokens[2];return new RtcpFbLine$1(payloadType,feedback);}toSdpLine(){return "a=rtcp-fb:".concat(this.payloadType," ").concat(this.feedback);}}RtcpFbLine$1.regex=new RegExp("^rtcp-fb:(".concat(NUM$1,") (").concat(REST$1,")"));var _a$7;class RtpMapLine$1 extends Line$1{constructor(payloadType,encodingName,clockRate,encodingParams){super();this.payloadType=payloadType;this.encodingName=encodingName;this.clockRate=clockRate;this.encodingParams=encodingParams;}static fromSdpLine(line){if(!RtpMapLine$1.regex.test(line)){return undefined;}var tokens=line.match(RtpMapLine$1.regex);var payloadType=parseInt(tokens[1],10);var encodingName=tokens[2];var clockRate=parseInt(tokens[3],10);var encodingParams=tokens[4];return new RtpMapLine$1(payloadType,encodingName,clockRate,encodingParams);}toSdpLine(){var str='';str+="a=rtpmap:".concat(this.payloadType," ").concat(this.encodingName,"/").concat(this.clockRate);if(this.encodingParams){str+="/".concat(this.encodingParams);}return str;}}_a$7=RtpMapLine$1;RtpMapLine$1.NON_SLASH_TOKEN='[^\\s/]+';RtpMapLine$1.regex=new RegExp("^rtpmap:(".concat(NUM$1,") (").concat(_a$7.NON_SLASH_TOKEN,")/(").concat(_a$7.NON_SLASH_TOKEN,")(?:/(").concat(_a$7.NON_SLASH_TOKEN,"))?"));class SctpPortLine$1 extends Line$1{constructor(port){super();this.port=port;}static fromSdpLine(line){if(!SctpPortLine$1.regex.test(line)){return undefined;}var tokens=line.match(SctpPortLine$1.regex);var port=parseInt(tokens[1],10);return new SctpPortLine$1(port);}toSdpLine(){return "a=sctp-port:".concat(this.port);}}SctpPortLine$1.regex=new RegExp("^sctp-port:(".concat(NUM$1,")"));class SessionInformationLine$1 extends Line$1{constructor(info){super();this.info=info;}static fromSdpLine(line){if(!SessionInformationLine$1.regex.test(line)){return undefined;}var tokens=line.match(SessionInformationLine$1.regex);var info=tokens[1];return new SessionInformationLine$1(info);}toSdpLine(){return "i=".concat(this.info);}}SessionInformationLine$1.regex=new RegExp("(".concat(REST$1,")"));class SessionNameLine$1 extends Line$1{constructor(name){super();this.name=name;}static fromSdpLine(line){if(!SessionNameLine$1.regex.test(line)){return undefined;}var tokens=line.match(SessionNameLine$1.regex);var name=tokens[1];return new SessionNameLine$1(name);}toSdpLine(){return "s=".concat(this.name);}}SessionNameLine$1.regex=new RegExp("^(".concat(REST$1,")"));class SetupLine$1 extends Line$1{constructor(setup){super();this.setup=setup;}static fromSdpLine(line){if(!SetupLine$1.regex.test(line)){return undefined;}var tokens=line.match(SetupLine$1.regex);var setup=tokens[1];return new SetupLine$1(setup);}toSdpLine(){return "a=setup:".concat(this.setup);}}SetupLine$1.regex=/^setup:(actpass|active|passive)$/;class SimulcastLayer$1{constructor(id,paused){this.id=id;this.paused=paused;}toString(){return this.paused?"~".concat(this.id):this.id;}}class SimulcastLayerList$1{constructor(){this.layers=[];}addLayer(layer){this.layers.push([layer]);}addLayerWithAlternatives(alternatives){this.layers.push(alternatives);}get length(){return this.layers.length;}get(index){return this.layers[index];}static fromString(str){var layerList=new SimulcastLayerList$1();var tokens=str.split(';');if(tokens.length===1&&!tokens[0].trim()){throw new Error('simulcast stream list empty');}tokens.forEach(token=>{if(!token){throw new Error('simulcast layer list empty');}var ridTokens=token.split(',');var layers=[];ridTokens.forEach(ridToken=>{if(!ridToken||ridToken==='~'){throw new Error('rid empty');}var paused=ridToken[0]==='~';var rid=paused?ridToken.substring(1):ridToken;layers.push(new SimulcastLayer$1(rid,paused));});layerList.addLayerWithAlternatives(layers);});return layerList;}toString(){return this.layers.map(altArray=>altArray.map(v=>v.toString()).join(',')).join(';');}}class SimulcastLine$1 extends Line$1{constructor(sendLayers,recvLayers){super();this.sendLayers=sendLayers;this.recvLayers=recvLayers;}static fromSdpLine(line){if(!SimulcastLine$1.regex.test(line)){return undefined;}var tokens=line.match(SimulcastLine$1.regex);var bidirectional=tokens[3]&&tokens[4];var firstDirection=tokens[1];var layerList1=SimulcastLayerList$1.fromString(tokens[2]);var layerList2=new SimulcastLayerList$1();if(bidirectional){var secondDirection=tokens[3];if(firstDirection===secondDirection){return undefined;}layerList2=SimulcastLayerList$1.fromString(tokens[4]);}var sendLayerList;var recvLayerList;if(firstDirection==='send'){sendLayerList=layerList1;recvLayerList=layerList2;}else {sendLayerList=layerList2;recvLayerList=layerList1;}return new SimulcastLine$1(sendLayerList,recvLayerList);}toSdpLine(){var str='a=simulcast:';if(this.sendLayers.length){str+="send ".concat(this.sendLayers.toString());if(this.recvLayers.length){str+=" ";}}if(this.recvLayers.length){str+="recv ".concat(this.recvLayers.toString());}return str;}}SimulcastLine$1.regex=new RegExp("^simulcast:(send|recv) (".concat(ANY_NON_WS$1,")(?: (send|recv) (").concat(ANY_NON_WS$1,"))?"));class SsrcLine$1 extends Line$1{constructor(ssrcId,attribute){var attributeValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:undefined;var attributeData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:undefined;super();this.ssrcId=ssrcId;this.attribute=attribute;this.attributeValue=attributeValue;this.attributeData=attributeData;}static fromSdpLine(line){if(!SsrcLine$1.regex.test(line)){return undefined;}var tokens=line.match(SsrcLine$1.regex);var ssrcId=parseInt(tokens[1],10);var attribute=tokens[2];var attributeValue=tokens[3];var attributeData=tokens[4];return new SsrcLine$1(ssrcId,attribute,attributeValue,attributeData);}toSdpLine(){var str="a=ssrc:".concat(this.ssrcId," ").concat(this.attribute);if(this.attributeValue){str+=":".concat(this.attributeValue);}if(this.attributeData){str+=" ".concat(this.attributeData);}return str;}}SsrcLine$1.regex=new RegExp("^ssrc:(".concat(NUM$1,") (").concat(SDP_TOKEN$1,")(?::(").concat(SDP_TOKEN$1,")?(?: (").concat(ANY_NON_WS$1,"))?)?$"));class SsrcGroupLine$1 extends Line$1{constructor(semantics,ssrcs){super();this.semantics=semantics;this.ssrcs=ssrcs;}static fromSdpLine(line){if(!SsrcGroupLine$1.regex.test(line)){return undefined;}var tokens=line.match(SsrcGroupLine$1.regex);var semantics=tokens[1];var ssrcs=tokens[2].split(' ').map(ssrcStr=>parseInt(ssrcStr,10));return new SsrcGroupLine$1(semantics,ssrcs);}toSdpLine(){return "a=ssrc-group:".concat(this.semantics," ").concat(this.ssrcs.join(' '));}}SsrcGroupLine$1.regex=new RegExp("^ssrc-group:(SIM|FID|FEC) ((?:".concat(NUM$1).concat(SP$1,"*)+)"));class TimingLine$1 extends Line$1{constructor(startTime,stopTime){super();this.startTime=startTime;this.stopTime=stopTime;}static fromSdpLine(line){if(!TimingLine$1.regex.test(line)){return undefined;}var tokens=line.match(TimingLine$1.regex);var startTime=parseInt(tokens[1],10);var stopTime=parseInt(tokens[2],10);return new TimingLine$1(startTime,stopTime);}toSdpLine(){return "t=".concat(this.startTime," ").concat(this.stopTime);}}TimingLine$1.regex=new RegExp("^(".concat(NUM$1,") (").concat(NUM$1,")"));class VersionLine$1 extends Line$1{constructor(version){super();this.version=version;}static fromSdpLine(line){if(!VersionLine$1.regex.test(line)){return undefined;}var tokens=line.match(VersionLine$1.regex);var version=parseInt(tokens[1],10);return new VersionLine$1(version);}toSdpLine(){return "v=".concat(this.version);}}VersionLine$1.regex=new RegExp("^(".concat(NUM$1,")$"));class UnknownLine$1 extends Line$1{constructor(value){super();this.value=value;}static fromSdpLine(line){var tokens=line.match(UnknownLine$1.regex);var value=tokens[1];return new UnknownLine$1(value);}toSdpLine(){return "".concat(this.value);}}UnknownLine$1.regex=new RegExp("(".concat(REST$1,")"));class IceInfo$1{constructor(){this.candidates=[];}addLine(line){if(line instanceof IceUfragLine$1){this.ufrag=line;return true;}if(line instanceof IcePwdLine$1){this.pwd=line;return true;}if(line instanceof IceOptionsLine$1){this.options=line;return true;}if(line instanceof CandidateLine$1){this.candidates.push(line);return true;}return false;}toLines(){var lines=[];if(this.ufrag){lines.push(this.ufrag);}if(this.pwd){lines.push(this.pwd);}if(this.options){lines.push(this.options);}this.candidates.forEach(candidate=>lines.push(candidate));return lines;}}class MediaDescription$1{constructor(type,port,protocol){this.iceInfo=new IceInfo$1();this.otherLines=[];this.type=type;this.port=port;this.protocol=protocol;}findOtherLine(ty){return this.otherLines.find(line=>line instanceof ty);}addLine(line){if(line instanceof BundleGroupLine$1){throw new Error("Error: bundle group line not allowed in media description");}if(line instanceof BandwidthLine$1){this.bandwidth=line;return true;}if(line instanceof MidLine$1){this.mid=line.mid;return true;}if(line instanceof FingerprintLine$1){this.fingerprint=line.fingerprint;return true;}if(line instanceof SetupLine$1){this.setup=line.setup;return true;}if(line instanceof ConnectionLine$1){this.connection=line;return true;}if(line instanceof ContentLine$1){this.content=line;return true;}return this.iceInfo.addLine(line);}}class ApplicationMediaDescription$1 extends MediaDescription$1{constructor(mediaLine){super(mediaLine.type,mediaLine.port,mediaLine.protocol);this.fmts=[];this.fmts=mediaLine.formats;}toLines(){var lines=[];lines.push(new MediaLine$1(this.type,this.port,this.protocol,this.fmts));if(this.connection){lines.push(this.connection);}if(this.bandwidth){lines.push(this.bandwidth);}lines.push(...this.iceInfo.toLines());if(this.fingerprint){lines.push(new FingerprintLine$1(this.fingerprint));}if(this.setup){lines.push(new SetupLine$1(this.setup));}if(this.mid){lines.push(new MidLine$1(this.mid));}if(this.content){lines.push(this.content);}if(this.sctpPort){lines.push(new SctpPortLine$1(this.sctpPort));}if(this.maxMessageSize){lines.push(new MaxMessageSizeLine$1(this.maxMessageSize));}lines.push(...this.otherLines);return lines;}addLine(line){if(super.addLine(line)){return true;}if(line instanceof MediaLine$1){throw new Error('Error: tried passing a MediaLine to an existing MediaInfo');}if(line instanceof SctpPortLine$1){this.sctpPort=line.port;return true;}if(line instanceof MaxMessageSizeLine$1){this.maxMessageSize=line.maxMessageSize;return true;}this.otherLines.push(line);return true;}}class CodecInfo$2{constructor(pt){this.fmtParams=new Map();this.feedback=[];this.pt=pt;}addLine(line){if(line instanceof RtpMapLine$1){this.name=line.encodingName;this.clockRate=line.clockRate;this.encodingParams=line.encodingParams;return true;}if(line instanceof FmtpLine$1){this.fmtParams=new Map([...Array.from(this.fmtParams.entries()),...Array.from(line.params.entries())]);if(line.params.has('apt')){var apt=line.params.get('apt');this.primaryCodecPt=parseInt(apt,10);}return true;}if(line instanceof RtcpFbLine$1){this.feedback.push(line.feedback);return true;}return false;}toLines(){var lines=[];if(this.name&&this.clockRate){lines.push(new RtpMapLine$1(this.pt,this.name,this.clockRate,this.encodingParams));}this.feedback.forEach(fb=>{lines.push(new RtcpFbLine$1(this.pt,fb));});if(this.fmtParams.size>0){lines.push(new FmtpLine$1(this.pt,this.fmtParams));}return lines;}}class AvMediaDescription$1 extends MediaDescription$1{constructor(mediaLine){super(mediaLine.type,mediaLine.port,mediaLine.protocol);this.pts=[];this.extMaps=new Map();this.rids=[];this.codecs=new Map();this.rtcpMux=false;this.ssrcs=[];this.ssrcGroups=[];this.pts=mediaLine.formats.map(fmt=>{return parseInt(fmt,10);});this.pts.forEach(pt=>this.codecs.set(pt,new CodecInfo$2(pt)));}toLines(){var lines=[];lines.push(new MediaLine$1(this.type,this.port,this.protocol,this.pts.map(pt=>"".concat(pt))));if(this.connection){lines.push(this.connection);}if(this.bandwidth){lines.push(this.bandwidth);}lines.push(...this.iceInfo.toLines());if(this.fingerprint){lines.push(new FingerprintLine$1(this.fingerprint));}if(this.setup){lines.push(new SetupLine$1(this.setup));}if(this.mid){lines.push(new MidLine$1(this.mid));}if(this.rtcpMux){lines.push(new RtcpMuxLine$1());}if(this.content){lines.push(this.content);}this.extMaps.forEach(extMap=>lines.push(extMap));this.rids.forEach(rid=>lines.push(rid));if(this.simulcast){lines.push(this.simulcast);}if(this.direction){lines.push(new DirectionLine$1(this.direction));}this.codecs.forEach(codec=>lines.push(...codec.toLines()));lines.push(...this.ssrcs);lines.push(...this.ssrcGroups);lines.push(...this.otherLines);return lines;}addLine(line){if(super.addLine(line)){return true;}if(line instanceof MediaLine$1){throw new Error('Error: tried passing a MediaLine to an existing MediaInfo');}if(line instanceof DirectionLine$1){this.direction=line.direction;return true;}if(line instanceof ExtMapLine$1){if(this.extMaps.has(line.id)){throw new Error("Tried to extension with duplicate ID: an extension already exists with ID ".concat(line.id));}this.extMaps.set(line.id,line);return true;}if(line instanceof RidLine$1){this.rids.push(line);return true;}if(line instanceof RtcpMuxLine$1){this.rtcpMux=true;return true;}if(line instanceof SimulcastLine$1){this.simulcast=line;return true;}if(line instanceof RtpMapLine$1||line instanceof FmtpLine$1||line instanceof RtcpFbLine$1){var codec=this.codecs.get(line.payloadType);if(!codec){throw new Error("Error: got line for unknown codec: ".concat(line.toSdpLine()));}codec.addLine(line);return true;}if(line instanceof SsrcLine$1){this.ssrcs.push(line);return true;}if(line instanceof SsrcGroupLine$1){this.ssrcGroups.push(line);return true;}this.otherLines.push(line);return true;}getCodecByPt(pt){return this.codecs.get(pt);}removePt(pt){var associatedPts=[...this.codecs.values()].filter(ci=>ci.primaryCodecPt===pt).map(ci=>ci.pt);var allPtsToRemove=[pt,...associatedPts];allPtsToRemove.forEach(ptToRemove=>{this.codecs.delete(ptToRemove);});this.pts=this.pts.filter(existingPt=>allPtsToRemove.indexOf(existingPt)===-1);}addExtension(_ref){var{uri,direction,attributes,id}=_ref;var getFirstFreeId=()=>{var freeId=1;for(;;){if(!this.extMaps.has(freeId)){break;}freeId+=1;}return freeId;};var extId=id||getFirstFreeId();if(this.extMaps.has(extId)){throw new Error("Extension with ID ".concat(id," already exists"));}if(extId===0){throw new Error("Extension ID 0 is reserved");}this.extMaps.set(extId,new ExtMapLine$1(extId,uri,direction,attributes));}}class SessionDescription$1{constructor(){this.groups=[];this.otherLines=[];}addLine(line){if(line instanceof VersionLine$1){this.version=line;return true;}if(line instanceof OriginLine$1){this.origin=line;return true;}if(line instanceof SessionNameLine$1){this.sessionName=line;return true;}if(line instanceof SessionInformationLine$1){this.information=line;return true;}if(line instanceof TimingLine$1){this.timing=line;return true;}if(line instanceof ConnectionLine$1){this.connection=line;return true;}if(line instanceof BandwidthLine$1){this.bandwidth=line;return true;}if(line instanceof BundleGroupLine$1){this.groups.push(line);return true;}this.otherLines.push(line);return true;}toLines(){var lines=[];if(this.version){lines.push(this.version);}if(this.origin){lines.push(this.origin);}if(this.sessionName){lines.push(this.sessionName);}if(this.information){lines.push(this.information);}if(this.connection){lines.push(this.connection);}if(this.bandwidth){lines.push(this.bandwidth);}if(this.timing){lines.push(this.timing);}if(this.groups){lines.push(...this.groups);}lines.push(...this.otherLines);return lines;}}class Sdp$1{constructor(){this.session=new SessionDescription$1();this.media=[];}get avMedia(){return this.media.filter(mi=>mi instanceof AvMediaDescription$1);}toString(){var lines=[];lines.push(...this.session.toLines());this.media.forEach(m=>lines.push(...m.toLines()));return "".concat(lines.map(l=>l.toSdpLine()).join('\r\n'),"\r\n");}}class Grammar$1{constructor(){this.parsers=new Map();}addParser(lineType,parser){var parsers=this.parsers.get(lineType)||[];parsers.push(parser);this.parsers.set(lineType,parsers);}getParsers(lineType){return this.parsers.get(lineType)||[];}}class SdpGrammar$1 extends Grammar$1{constructor(){super();this.addParser('v',VersionLine$1.fromSdpLine);this.addParser('o',OriginLine$1.fromSdpLine);this.addParser('c',ConnectionLine$1.fromSdpLine);this.addParser('i',SessionInformationLine$1.fromSdpLine);this.addParser('m',MediaLine$1.fromSdpLine);this.addParser('s',SessionNameLine$1.fromSdpLine);this.addParser('t',TimingLine$1.fromSdpLine);this.addParser('b',BandwidthLine$1.fromSdpLine);this.addParser('a',RtpMapLine$1.fromSdpLine);this.addParser('a',RtcpFbLine$1.fromSdpLine);this.addParser('a',FmtpLine$1.fromSdpLine);this.addParser('a',DirectionLine$1.fromSdpLine);this.addParser('a',ExtMapLine$1.fromSdpLine);this.addParser('a',MidLine$1.fromSdpLine);this.addParser('a',IceUfragLine$1.fromSdpLine);this.addParser('a',IcePwdLine$1.fromSdpLine);this.addParser('a',IceOptionsLine$1.fromSdpLine);this.addParser('a',FingerprintLine$1.fromSdpLine);this.addParser('a',SetupLine$1.fromSdpLine);this.addParser('a',SctpPortLine$1.fromSdpLine);this.addParser('a',MaxMessageSizeLine$1.fromSdpLine);this.addParser('a',RtcpMuxLine$1.fromSdpLine);this.addParser('a',BundleGroupLine$1.fromSdpLine);this.addParser('a',ContentLine$1.fromSdpLine);this.addParser('a',RidLine$1.fromSdpLine);this.addParser('a',CandidateLine$1.fromSdpLine);this.addParser('a',SimulcastLine$1.fromSdpLine);this.addParser('a',SsrcLine$1.fromSdpLine);this.addParser('a',SsrcGroupLine$1.fromSdpLine);}}var DefaultSdpGrammar$1=new SdpGrammar$1();function isValidLine$1(line){return line.length>2;}function parseToModel$1(lines){var sdp=new Sdp$1();var currBlock=sdp.session;lines.forEach(l=>{if(l instanceof MediaLine$1){var mediaInfo;if(l.type==='audio'||l.type==='video'){mediaInfo=new AvMediaDescription$1(l);}else if(l.type==='application'){mediaInfo=new ApplicationMediaDescription$1(l);}else {throw new Error("Unhandled media type: ".concat(l.type));}sdp.media.push(mediaInfo);currBlock=mediaInfo;}else {currBlock.addLine(l);}});return sdp;}function parseToLines$1(sdp,grammar){var lines=[];sdp.split(/(\r\n|\r|\n)/).filter(isValidLine$1).forEach(l=>{var lineType=l[0];var lineValue=l.slice(2);var parsers=grammar.getParsers(lineType);for(var parser of parsers){var _result=parser(lineValue);if(_result){lines.push(_result);return;}}var result=UnknownLine$1.fromSdpLine(l);lines.push(result);});return lines;}function parse$1(sdp){var grammar=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DefaultSdpGrammar$1;var lines=parseToLines$1(sdp,grammar);var parsed=parseToModel$1(lines);return parsed;}function disableRtcpFbValue(sdpOrAv,rtcpFbValue){var mediaDescriptions=sdpOrAv instanceof Sdp$1?sdpOrAv.avMedia:[sdpOrAv];mediaDescriptions.forEach(media=>{media.codecs.forEach(codec=>{codec.feedback=codec.feedback.filter(fb=>fb!==rtcpFbValue);});});}function disableTwcc(sdpOrAv){disableRtcpFbValue(sdpOrAv,'transport-cc');}function removeCodec(sdpOrAv,codecName){var mediaDescriptions=sdpOrAv instanceof Sdp$1?sdpOrAv.avMedia:[sdpOrAv];mediaDescriptions.forEach(media=>{var codecInfos=[...media.codecs.entries()].filter(_ref2=>{var[,ci]=_ref2;var _a;return ((_a=ci.name)===null||_a===void 0?void 0:_a.toLowerCase())===codecName.toLowerCase();});codecInfos.forEach(_ref3=>{var[pt]=_ref3;return media.removePt(pt);});});}function retainCodecs(sdpOrAv,allowedCodecNames){var avMediaDescriptions=sdpOrAv instanceof Sdp$1?sdpOrAv.avMedia:[sdpOrAv];var allowedLowerCase=allowedCodecNames.map(s=>s.toLowerCase());avMediaDescriptions.map(av=>{return [...av.codecs.values()].map(c=>c.name);}).flat().filter(codecName=>!allowedLowerCase.includes(codecName.toLowerCase())).forEach(unwantedCodec=>removeCodec(sdpOrAv,unwantedCodec));}function retainCandidates(sdpOrMedia,allowedTransportTypes){var mediaDescriptions=sdpOrMedia instanceof Sdp$1?sdpOrMedia.media:[sdpOrMedia];var filtered=false;mediaDescriptions.forEach(media=>{media.iceInfo.candidates=media.iceInfo.candidates.filter(candidate=>{if(allowedTransportTypes.includes(candidate.transport.toLowerCase())){return true;}filtered=true;return false;});});return filtered;}function hasCodec(codecName,mLine){return [...mLine.codecs.values()].some(ci=>{var _a;return ((_a=ci.name)===null||_a===void 0?void 0:_a.toLowerCase())===codecName.toLowerCase();});}var commonjsGlobal=typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global$1!=='undefined'?global$1:typeof self!=='undefined'?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,'default')?x['default']:x;}var es5={exports:{}};(function(module,exports){!function(e,t){module.exports=t();}(commonjsGlobal,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports;}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e){r.d(n,i,function(t){return e[t];}.bind(null,i));}return n;},r.n=function(e){var t=e&&e.__esModule?function(){return e.default;}:function(){return e;};return r.d(t,"a",t),t;},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t);},r.p="",r(r.s=90);}({17:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||"";},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||"";},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r;},e.getWindowsVersionName=function(e){switch(e){case"NT":return "NT";case"XP":return "XP";case"NT 5.0":return "2000";case"NT 5.1":return "XP";case"NT 5.2":return "2003";case"NT 6.0":return "Vista";case"NT 6.1":return "7";case"NT 6.2":return "8";case"NT 6.3":return "8.1";case"NT 10.0":return "10";default:return;}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0;});if(t.push(0),10===t[0])switch(t[1]){case 5:return "Leopard";case 6:return "Snow Leopard";case 7:return "Lion";case 8:return "Mountain Lion";case 9:return "Mavericks";case 10:return "Yosemite";case 11:return "El Capitan";case 12:return "Sierra";case 13:return "High Sierra";case 14:return "Mojave";case 15:return "Catalina";default:return;}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0;});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;},e.getVersionPrecision=function(e){return e.split(".").length;},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(r),a=Math.max(i,s),o=0,u=e.map([t,r],function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),function(e){return new Array(20-e.length).join("0")+e;}).reverse();});for(n&&(o=a-Math.min(i,s)),a-=1;a>=o;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===o)return 0;a-=1;}else if(u[0][a]<u[1][a])return -1;}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1){n.push(t(e[r]));}return n;},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i;}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++){s[a-1]=arguments[a];}if(Object.assign)return Object.assign.apply(Object,[e].concat(s));var o=function o(){var e=s[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach(function(t){n[t]=e[t];});};for(t=0,r=s.length;t<r;t+=1){o();}return e;},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e];},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||"";},e;}();t.default=i,e.exports=t.default;},18:function _(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0;t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"};t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"};t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"};t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"};t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};},90:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},s=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}var o=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t);},e.parse=function(e){return new i.default(e).getResult();},t=e,n=[{key:"BROWSER_MAP",get:function get(){return s.BROWSER_MAP;}},{key:"ENGINE_MAP",get:function get(){return s.ENGINE_MAP;}},{key:"OS_MAP",get:function get(){return s.OS_MAP;}},{key:"PLATFORMS_MAP",get:function get(){return s.PLATFORMS_MAP;}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e;}();t.default=o,e.exports=t.default;},91:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n=u(r(92)),i=u(r(93)),s=u(r(94)),a=u(r(95)),o=u(r(17));function u(e){return e&&e.__esModule?e:{default:e};}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse();}var t=e.prototype;return t.getUA=function(){return this._ua;},t.test=function(e){return e.test(this._ua);},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=o.default.find(n.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser;},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser();},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||"";},t.getBrowserVersion=function(){return this.getBrowser().version;},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS();},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os;},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||"";},t.getOSVersion=function(){return this.getOS().version;},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform();},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||"";},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=o.default.find(s.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform;},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine();},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||"";},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=o.default.find(a.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine;},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this;},t.getResult=function(){return o.default.assign({},this.parsedResult);},t.satisfies=function(e){var t=this,r={},n=0,i={},s=0;if(Object.keys(e).forEach(function(t){var a=e[t];"string"==typeof a?(i[t]=a,s+=1):"object"==typeof a&&(r[t]=a,n+=1);}),n>0){var a=Object.keys(r),u=o.default.find(a,function(e){return t.isOS(e);});if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d;}var c=o.default.find(a,function(e){return t.isPlatform(e);});if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f;}}if(s>0){var l=Object.keys(i),h=o.default.find(l,function(e){return t.isBrowser(e,!0);});if(void 0!==h)return this.compareVersion(i[h]);}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r;},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();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;},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase();},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase();},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase();},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e);},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e);});},e;}();t.default=d,e.exports=t.default;},92:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n};var s=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function describe(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/opera/i],describe:function describe(e){var t={name:"Opera"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/opr\/|opios/i],describe:function describe(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/SamsungBrowser/i],describe:function describe(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/Whale/i],describe:function describe(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/MZBrowser/i],describe:function describe(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/focus/i],describe:function describe(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/swing/i],describe:function describe(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/coast/i],describe:function describe(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function describe(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/yabrowser/i],describe:function describe(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/ucbrowser/i],describe:function describe(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/Maxthon|mxios/i],describe:function describe(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/epiphany/i],describe:function describe(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/puffin/i],describe:function describe(e){var t={name:"Puffin"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/sleipnir/i],describe:function describe(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/k-meleon/i],describe:function describe(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/micromessenger/i],describe:function describe(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/qqbrowser/i],describe:function describe(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/msie|trident/i],describe:function describe(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/\sedg\//i],describe:function describe(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/edg([ea]|ios)/i],describe:function describe(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/vivaldi/i],describe:function describe(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/seamonkey/i],describe:function describe(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/sailfish/i],describe:function describe(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t;}},{test:[/silk/i],describe:function describe(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/phantom/i],describe:function describe(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/slimerjs/i],describe:function describe(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function describe(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/(web|hpw)[o0]s/i],describe:function describe(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/bada/i],describe:function describe(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/tizen/i],describe:function describe(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/qupzilla/i],describe:function describe(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/firefox|iceweasel|fxios/i],describe:function describe(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/electron/i],describe:function describe(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/MiuiBrowser/i],describe:function describe(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/chromium/i],describe:function describe(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/chrome|crios|crmo/i],describe:function describe(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/GSA/i],describe:function describe(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:function test(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r;},describe:function describe(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/playstation 4/i],describe:function describe(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/safari|applewebkit/i],describe:function describe(e){var t={name:"Safari"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/.*/i],describe:function describe(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return {name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)};}}];t.default=a,e.exports=t.default;},93:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/Roku\/DVP/],describe:function describe(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return {name:s.OS_MAP.Roku,version:t};}},{test:[/windows phone/i],describe:function describe(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.WindowsPhone,version:t};}},{test:[/windows /i],describe:function describe(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return {name:s.OS_MAP.Windows,version:t,versionName:r};}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function describe(e){var t={name:s.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t;}},{test:[/macintosh/i],describe:function describe(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:s.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n;}},{test:[/(ipod|iphone|ipad)/i],describe:function describe(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return {name:s.OS_MAP.iOS,version:t};}},{test:function test(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r;},describe:function describe(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:s.OS_MAP.Android,version:t};return r&&(n.versionName=r),n;}},{test:[/(web|hpw)[o0]s/i],describe:function describe(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:s.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r;}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function describe(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return {name:s.OS_MAP.BlackBerry,version:t};}},{test:[/bada/i],describe:function describe(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.Bada,version:t};}},{test:[/tizen/i],describe:function describe(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.Tizen,version:t};}},{test:[/linux/i],describe:function describe(){return {name:s.OS_MAP.Linux};}},{test:[/CrOS/],describe:function describe(){return {name:s.OS_MAP.ChromeOS};}},{test:[/PlayStation 4/],describe:function describe(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.PlayStation4,version:t};}}];t.default=a,e.exports=t.default;},94:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/googlebot/i],describe:function describe(){return {type:"bot",vendor:"Google"};}},{test:[/huawei/i],describe:function describe(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r;}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"};}},{test:[/ipad/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"};}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"};}},{test:[/kftt build/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"};}},{test:[/silk/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"};}},{test:[/tablet(?! pc)/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet};}},{test:function test(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r;},describe:function describe(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return {type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t};}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function describe(){return {type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"};}},{test:[/[^-]mobi/i],describe:function describe(){return {type:s.PLATFORMS_MAP.mobile};}},{test:function test(e){return "blackberry"===e.getBrowserName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"};}},{test:function test(e){return "bada"===e.getBrowserName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile};}},{test:function test(e){return "windows phone"===e.getBrowserName();},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"};}},{test:function test(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return "android"===e.getOSName(!0)&&t>=3;},describe:function describe(){return {type:s.PLATFORMS_MAP.tablet};}},{test:function test(e){return "android"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile};}},{test:function test(e){return "macos"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.desktop,vendor:"Apple"};}},{test:function test(e){return "windows"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.desktop};}},{test:function test(e){return "linux"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.desktop};}},{test:function test(e){return "playstation 4"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.tv};}},{test:function test(e){return "roku"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.tv};}}];t.default=a,e.exports=t.default;},95:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:function test(e){return "microsoft edge"===e.getBrowserName(!0);},describe:function describe(e){if(/\sedg\//i.test(e))return {name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return {name:s.ENGINE_MAP.EdgeHTML,version:t};}},{test:[/trident/i],describe:function describe(e){var t={name:s.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:function test(e){return e.test(/presto/i);},describe:function describe(e){var t={name:s.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:function test(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r;},describe:function describe(e){var t={name:s.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/(apple)?webkit\/537\.36/i],describe:function describe(){return {name:s.ENGINE_MAP.Blink};}},{test:[/(apple)?webkit/i],describe:function describe(e){var t={name:s.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}}];t.default=a,e.exports=t.default;}});});})(es5);var Bowser=/*@__PURE__*/getDefaultExportFromCjs(es5.exports);var BrowserName;(function(BrowserName){BrowserName["CHROME"]="Chrome";BrowserName["FIREFOX"]="Firefox";BrowserName["EDGE"]="Microsoft Edge";BrowserName["SAFARI"]="Safari";})(BrowserName||(BrowserName={}));class BrowserInfo{static getBrowserDetails(){return this.browser.getBrowser();}static getOSDetails(){return this.browser.getOS();}static getPlatformDetails(){return this.browser.getPlatform();}static getEngineDetails(){return this.browser.getEngine();}static isChrome(){return this.browser.getBrowserName()===BrowserName.CHROME;}static isFirefox(){return this.browser.getBrowserName()===BrowserName.FIREFOX;}static isEdge(){return this.browser.getBrowserName()===BrowserName.EDGE;}static isSafari(){return this.browser.getBrowserName()===BrowserName.SAFARI;}static isVersionGreaterThan(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:">".concat(version)};return this.browser.satisfies(checkTree);}static isVersionGreaterThanOrEqualTo(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:">=".concat(version)};return this.browser.satisfies(checkTree);}static isVersionLessThan(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:"<".concat(version)};return this.browser.satisfies(checkTree);}static isVersionLessThanOrEqualTo(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:"<=".concat(version)};return this.browser.satisfies(checkTree);}static isSubVersionOf(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:"~".concat(version)};return this.browser.satisfies(checkTree);}}BrowserInfo.browser=Bowser.getParser(window.navigator.userAgent);var CapabilityState;(function(CapabilityState){CapabilityState["NOT_CAPABLE"]="not capable";CapabilityState["CAPABLE"]="capable";CapabilityState["UNKNOWN"]="unknown";})(CapabilityState||(CapabilityState={}));var simulcastMaxFrameSizes={0:'240',1:'2304',2:'8160'};class JmpLine extends Line$1{constructor(versions){super();this.versions=versions;}static fromSdpLine(line){if(!JmpLine.regex.test(line)){return undefined;}var tokens=line.match(JmpLine.regex);var versions=tokens[1].split(',').filter(v=>v.length);return new JmpLine(versions);}toSdpLine(){return "a=jmp:".concat(this.versions.join(','));}}JmpLine.regex=/^jmp:((?:v\d+,?)+)/;class JmpStreamIdModeLine extends Line$1{constructor(streamIdMode){super();this.streamIdMode=streamIdMode;}static fromSdpLine(line){if(!JmpStreamIdModeLine.regex.test(line)){return undefined;}var tokens=line.match(JmpStreamIdModeLine.regex);var mode=tokens[1];return new JmpStreamIdModeLine(mode);}toSdpLine(){return "a=jmp-stream-id-mode:".concat(this.streamIdMode);}}JmpStreamIdModeLine.regex=/^jmp-stream-id-mode:(MID-RID|SSRC)$/;class JmpSourceLine extends Line$1{constructor(source,csi){super();this.source=source;this.csi=csi;}static fromSdpLine(line){if(!JmpSourceLine.regex.test(line)){return undefined;}var tokens=line.match(JmpSourceLine.regex);var source=tokens[1];var csi=tokens[2];return new JmpSourceLine(source,csi);}toSdpLine(){var line="a=jmp-source:".concat(this.source);if(this.csi){line+=" csi=".concat(this.csi);}return line;}}JmpSourceLine.regex=new RegExp("^jmp-source:(".concat(ANY_NON_WS$1,") (?:csi=(").concat(ANY_NON_WS$1,"))"));DefaultSdpGrammar$1.addParser('a',JmpLine.fromSdpLine);DefaultSdpGrammar$1.addParser('a',JmpSourceLine.fromSdpLine);DefaultSdpGrammar$1.addParser('a',JmpStreamIdModeLine.fromSdpLine);function deepCopy(source){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)=>{Object.defineProperty(o,prop,Object.getOwnPropertyDescriptor(source,prop));o[prop]=deepCopy(source[prop]);return o;},Object.create(Object.getPrototypeOf(source))):source;}var ipv4Regex=/(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.)(\d{1,3}\b)/g;var ipv6Regex=/(\b[\da-fA-F]{1,4}(:[\da-fA-F]{1,4}){7}\b)/g;function matchMediaDescriptionsInAnswer(parsedOffer,parsedAnswer){parsedAnswer.session.groups=parsedOffer.session.groups;parsedAnswer.media=parsedOffer.media.map(offerMediaDescription=>{if(!offerMediaDescription.mid){logErrorAndThrow(exports.WcmeErrorType.OFFER_ANSWER_MISMATCH,"Named media groups can only be set for audio.");}var answerMediaDescription=parsedAnswer.media.find(m=>m.mid===offerMediaDescription.mid);if(answerMediaDescription){return answerMediaDescription;}if(!(offerMediaDescription instanceof AvMediaDescription$1)){logErrorAndThrow(exports.WcmeErrorType.OFFER_ANSWER_MISMATCH,"Answer is missing a non-AV media description for MID ".concat(offerMediaDescription.mid,"."));}var startingMediaDescription=parsedAnswer.avMedia.find(m=>m.type===offerMediaDescription.type);if(!startingMediaDescription){logErrorAndThrow(exports.WcmeErrorType.OFFER_ANSWER_MISMATCH,"Answer has no media description of type ".concat(offerMediaDescription.type,", can't generate synthetic answer media description for MID ").concat(offerMediaDescription.mid,"."));}var fakeCorrespondingDescription=deepCopy(startingMediaDescription);fakeCorrespondingDescription.mid=offerMediaDescription.mid;fakeCorrespondingDescription.simulcast=undefined;fakeCorrespondingDescription.bandwidth=undefined;if(offerMediaDescription.direction==='sendrecv'||offerMediaDescription.direction==='sendonly'){fakeCorrespondingDescription.direction='recvonly';}if(offerMediaDescription.direction==='recvonly'){fakeCorrespondingDescription.direction='sendonly';}return fakeCorrespondingDescription;});}function setupBundle(parsedSdp,bundlePolicy,midMap){if(bundlePolicy==='max-compat'){var audioMainMids=midMap.get(exports.MediaType.AudioMain);var videoMainMids=midMap.get(exports.MediaType.VideoMain);var audioContentMids=midMap.get(exports.MediaType.AudioSlides);var videoContentMids=midMap.get(exports.MediaType.VideoSlides);parsedSdp.session.groups.splice(0,parsedSdp.session.groups.length);if(audioMainMids){parsedSdp.session.groups.push(new BundleGroupLine$1(audioMainMids));}if(videoMainMids){parsedSdp.session.groups.push(new BundleGroupLine$1(videoMainMids));}if(audioContentMids){parsedSdp.session.groups.push(new BundleGroupLine$1(audioContentMids));}if(videoContentMids){parsedSdp.session.groups.push(new BundleGroupLine$1(videoContentMids));}}}function filterRecvOnlyMediaDescriptions(parsedSdp){var filteredMids=[];parsedSdp.media=parsedSdp.media.filter(media=>{if(media instanceof ApplicationMediaDescription$1||media instanceof AvMediaDescription$1&&media.direction!=='recvonly'){filteredMids.push(media.mid);return true;}return false;});parsedSdp.session.groups.forEach(g=>{g.mids=g.mids.filter(m=>filteredMids.includes(m));});}function injectContentType(mediaDescription,mediaContent){if(mediaContent===exports.MediaContent.Slides){mediaDescription.addLine(new ContentLine$1(['slides']));}}function injectJmpAttributes(mediaDescription,csi,streamSignalingMode){if(!mediaDescription.otherLines.find(line=>line instanceof JmpLine)){mediaDescription.addLine(new JmpLine(['v1']));}if(!mediaDescription.otherLines.find(line=>line instanceof JmpSourceLine)){mediaDescription.addLine(new JmpSourceLine(mediaDescription.mid,csi.toString()));}if(!mediaDescription.otherLines.find(line=>line instanceof JmpStreamIdModeLine)){mediaDescription.addLine(new JmpStreamIdModeLine(streamSignalingMode));}}function injectDummyCandidates(mediaDescription){mediaDescription.iceInfo.candidates=[];mediaDescription.addLine(new CandidateLine$1('dummy1',1,'udp',3,'0.0.0.0',9,'host'));mediaDescription.addLine(new CandidateLine$1('dummy2',1,'tcp',2,'0.0.0.0',9,'host'));mediaDescription.addLine(new CandidateLine$1('dummy3',1,'udp',1,'0.0.0.0',9,'relay'));}function maskIp(sdp){var maskedSdp=sdp.replace(ipv4Regex,(match,firstOctets)=>{return "".concat(firstOctets,"0");});maskedSdp=maskedSdp.replace(ipv6Regex,match=>{return match.replace(/:[\da-fA-F]{1,4}$/,':0');});return maskedSdp;}function removeMidRidExtensions(mediaDescription){mediaDescription.extMaps.forEach((extMapLine,extId,extMap)=>{if(/^urn:ietf:params:rtp-hdrext:sdes:(?:mid|rtp-stream-id|repaired-rtp-stream-id)$/.test(extMapLine.uri)){extMap.delete(extId);}});}function addVlaExtension(mediaDescription){var vlaExtensionUri='http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00';if(![...mediaDescription.extMaps.values()].some(extMapLine=>extMapLine.uri===vlaExtensionUri)){mediaDescription.addExtension({uri:vlaExtensionUri});}}function applyFormatParameters(mediaDescription,paramsMap){paramsMap.forEach((value,param)=>{[...mediaDescription.codecs.values()].filter(ci=>ci.name==='H264'||ci.name==='opus').forEach(ci=>{if(value===null){ci.fmtParams.delete(param);}else {ci.fmtParams.set(param,"".concat(value));}});});}function generateSsrc(){return Math.floor(Math.random()*0xffffffff)+1;}class EgressSdpMunger{constructor(){this.streamIds=[];this.customCodecParameters=new Map();}reset(){this.streamIds=[];}mungeLocalDescription(mediaDescription,options){var _a;retainCodecs(mediaDescription,['h264','opus','rtx']);if(mediaDescription.codecs.size===0){logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_MISSING_CODECS,"No codecs present in m-line with MID ".concat(mediaDescription.mid," after filtering."));}mediaDescription.rids=[];mediaDescription.simulcast=undefined;removeMidRidExtensions(mediaDescription);if(options.simulcastEnabled){addVlaExtension(mediaDescription);}var numStreams=options.simulcastEnabled?3:1;if(!this.streamIds.length){if(mediaDescription.ssrcs.length){var ssrcs=[...new Set(mediaDescription.ssrcs.map(ssrcLine=>ssrcLine.ssrcId))];mediaDescription.ssrcGroups.forEach(sg=>{if(!sg.ssrcs.every(ssrc=>ssrcs.includes(ssrc))){logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_FAILED,'SSRC present in SSRC groups is missing from SSRC lines.');}});var rtxSsrcGroups=mediaDescription.ssrcGroups.filter(sg=>sg.semantics==='FID');if(rtxSsrcGroups.length&&rtxSsrcGroups.length!==numStreams){logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_FAILED,"Expected ".concat(numStreams," RTX SSRC groups, got ").concat(rtxSsrcGroups.length,"."));}rtxSsrcGroups.forEach(sg=>{this.streamIds.push({ssrc:sg.ssrcs[0],rtxSsrc:sg.ssrcs[1]});});var simulcastSsrcs=(_a=mediaDescription.ssrcGroups.find(sg=>sg.semantics==='SIM'))===null||_a===void 0?void 0:_a.ssrcs;if(simulcastSsrcs){if(simulcastSsrcs.length!==numStreams||!this.streamIds.every(streamId=>simulcastSsrcs.includes(streamId.ssrc))){logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_FAILED,'SSRCs in simulcast SSRC group do not match primary SSRCs in RTX SSRC groups.');}this.streamIds.sort((a,b)=>simulcastSsrcs.indexOf(a.ssrc)-simulcastSsrcs.indexOf(b.ssrc));}else if(rtxSsrcGroups.length>1){logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_FAILED,'Multiple RTX SSRC groups but no simulcast SSRC group found.');}if(!this.streamIds.length){this.streamIds.push({ssrc:ssrcs[0]});}}else {[...Array(numStreams).keys()].forEach(()=>{var newStreamId={ssrc:generateSsrc()};if(options.rtxEnabled){newStreamId.rtxSsrc=generateSsrc();}this.streamIds.push(newStreamId);});}}mediaDescription.ssrcs=[];mediaDescription.ssrcGroups=[];this.streamIds.forEach(streamId=>{var rtpSsrc=streamId.ssrc;mediaDescription.addLine(new SsrcLine$1(rtpSsrc,'cname',"".concat(rtpSsrc,"-cname")));mediaDescription.addLine(new SsrcLine$1(rtpSsrc,'msid','-',"".concat(mediaDescription.mid)));if(options.rtxEnabled){var rtxSsrc=streamId.rtxSsrc;mediaDescription.addLine(new SsrcLine$1(rtxSsrc,'cname',"".concat(rtpSsrc,"-cname")));mediaDescription.addLine(new SsrcLine$1(rtxSsrc,'msid','-',"".concat(mediaDescription.mid)));mediaDescription.addLine(new SsrcGroupLine$1('FID',[rtpSsrc,rtxSsrc]));}});if(options.simulcastEnabled){mediaDescription.addLine(new SsrcGroupLine$1('SIM',this.streamIds.map(streamId=>streamId.ssrc)));}applyFormatParameters(mediaDescription,this.customCodecParameters);if(options.twccDisabled){disableTwcc(mediaDescription);}}mungeLocalDescriptionForRemoteServer(mediaDescription,mediaContent,csi){injectContentType(mediaDescription,mediaContent);injectJmpAttributes(mediaDescription,csi,'SSRC');injectDummyCandidates(mediaDescription);if(mediaDescription.type==='video'){var ssrcGroup=mediaDescription.ssrcGroups.find(sg=>sg.semantics==='SIM');if(ssrcGroup){ssrcGroup.ssrcs.forEach((ssrc,index)=>{mediaDescription.addLine(new SsrcLine$1(ssrc,'fmtp',"* max-fs=".concat(simulcastMaxFrameSizes[index])));});}}}mungeRemoteDescription(mediaDescription){if(retainCandidates(mediaDescription,['udp','tcp'])){logger.log("Some unsupported remote candidates have been removed from mid ".concat(mediaDescription.mid));}mediaDescription.bandwidth=undefined;[...mediaDescription.codecs.values()].forEach(ci=>{ci.fmtParams.set('x-google-start-bitrate','60000');});}getSenderIds(){return this.streamIds;}getEncodingIndexForStreamId(streamId){return this.streamIds.findIndex(currStreamId=>compareStreamIds(currStreamId,streamId));}setCodecParameters(parameters){Object.entries(parameters).forEach(_ref4=>{var[param,value]=_ref4;this.customCodecParameters.set(param,value);});}deleteCodecParameters(parameters){parameters.forEach(param=>{this.customCodecParameters.set(param,null);});}}var events$1={exports:{}};var R$1=typeof Reflect==='object'?Reflect:null;var ReflectApply$1=R$1&&typeof R$1.apply==='function'?R$1.apply:function ReflectApply(target,receiver,args){return Function.prototype.apply.call(target,receiver,args);};var ReflectOwnKeys$1;if(R$1&&typeof R$1.ownKeys==='function'){ReflectOwnKeys$1=R$1.ownKeys;}else if(Object.getOwnPropertySymbols){ReflectOwnKeys$1=function ReflectOwnKeys(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));};}else {ReflectOwnKeys$1=function ReflectOwnKeys(target){return Object.getOwnPropertyNames(target);};}function ProcessEmitWarning$1(warning){if(console&&console.warn)console.warn(warning);}var NumberIsNaN$1=Number.isNaN||function NumberIsNaN(value){return value!==value;};function EventEmitter$3(){EventEmitter$3.init.call(this);}events$1.exports=EventEmitter$3;events$1.exports.once=once$2;// Backwards-compat with node 0.10.x
2873
2874
  EventEmitter$3.EventEmitter=EventEmitter$3;EventEmitter$3.prototype._events=undefined;EventEmitter$3.prototype._eventsCount=0;EventEmitter$3.prototype._maxListeners=undefined;// By default EventEmitters will print a warning if more than 10 listeners are
package/dist/esm/index.js CHANGED
@@ -2856,7 +2856,8 @@ Object.keys(updatedStats).forEach(function(id){var report=updatedStats[id];if(re
2856
2856
  * @param timestamp - Time the event happened in milliseconds.
2857
2857
  */var trace=function trace(name,payload,timestamp){logger({timestamp:timestamp?Math.round(timestamp):Date.now(),name:name,payload:payload});};var origPeerConnection=window.RTCPeerConnection;pc.addEventListener('icecandidate',function(e){if(e.candidate){trace('onicecandidate',makeEvent(JSON.stringify(e.candidate)));}});pc.addEventListener('icecandidateerror',function(event){var url=event.url,errorCode=event.errorCode,errorText=event.errorText;trace('onicecandidateerror',makeEvent("[".concat(url,"] ").concat(errorCode,": ").concat(errorText)));});pc.addEventListener('track',function(e){trace('ontrack',makeEvent("".concat(e.track.kind,":").concat(e.track.id," ").concat(e.streams.map(function(stream){return "stream:".concat(stream.id);}).join(' '))));});pc.addEventListener('signalingstatechange',function(){trace('onsignalingstatechange',makeEvent(pc.signalingState));});pc.addEventListener('iceconnectionstatechange',function(){trace('oniceconnectionstatechange',makeEvent(pc.iceConnectionState));});pc.addEventListener('icegatheringstatechange',function(){trace('onicegatheringstatechange',makeEvent(pc.iceGatheringState));});pc.addEventListener('connectionstatechange',function(){trace('onconnectionstatechange',makeEvent(pc.connectionState));});pc.addEventListener('negotiationneeded',function(){trace('onnegotiationneeded',makeEvent('negotiationneeded'));});pc.addEventListener('datachannel',function(event){trace('ondatachannel',makeEvent("".concat(event.channel.id,": ").concat(event.channel.label)));});['createDataChannel','close'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){trace("on".concat(method),makeEvent(method));return nativeMethod.apply(this,arguments);};}});['addStream','removeStream'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var stream=arguments[0];var streamInfo=stream.getTracks().map(function(t){return "".concat(t.kind,":").concat(t.id);}).join(',');trace("on".concat(method),makeEvent("".concat(stream.id," ").concat(streamInfo)));return nativeMethod.apply(this,arguments);};}});['addTrack'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var track=arguments[0];var streams=[].slice.call(arguments,1);trace("on".concat(method),makeEvent("".concat(track.kind,":").concat(track.id," ").concat(streams.map(function(s){return "stream:".concat(s.id);}).join(';')||'-')));return nativeMethod.apply(this,arguments);};}});['removeTrack'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var track=arguments[0].track;trace("on".concat(method),makeEvent(track?"".concat(track.kind,":").concat(track.id):'null'));return nativeMethod.apply(this,arguments);};}});['createOffer','createAnswer'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var opts;var args=arguments;if(arguments.length===1&&typeof arguments[0]==='object'){// eslint-disable-next-line prefer-destructuring
2858
2858
  opts=arguments[0];}else if(arguments.length===3&&typeof arguments[2]==='object'){// eslint-disable-next-line prefer-destructuring
2859
- opts=arguments[2];}trace("on".concat(method),makeEvent(opts||''));return nativeMethod.apply(this,opts?[opts]:undefined).then(function(description){trace("on".concat(method,"OnSuccess"),makeEvent(description.sdp));if(args.length>0&&typeof args[0]==='function'){args[0].apply(null,[description]);return undefined;}return description;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>1&&typeof args[1]==='function'){args[1].apply(null,[err]);return;}throw err;});};}});['setLocalDescription','setRemoteDescription','addIceCandidate'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var _this=this;var args=arguments;trace("on".concat(method),makeEvent(method==='addIceCandidate'?arguments[0]:arguments[0].sdp));return nativeMethod.apply(this,[arguments[0]]).then(function(){trace("on".concat(method,"OnSuccess"),makeEvent('success'));if(method.endsWith('Description')){if(!_this.transportEventsPreviouslyAdded){var senders=_this.getSenders();var _loop_1=function _loop_1(sender){if(sender.transport){sender.transport.addEventListener('statechange',function(){if(sender&&sender.transport){trace("ondtlsStateChange",makeEvent(sender.transport.state));}});sender.transport.addEventListener('error',function(error){var errorEvent=error;trace("ondtlsError",makeEvent(errorEvent.error.errorDetail));});if(sender.transport.iceTransport){sender.transport.iceTransport.addEventListener('selectedcandidatepairchange',function(){var _a,_b,_c,_d,_e,_f;if(sender.transport&&sender.transport.iceTransport){var pair=sender.transport.iceTransport.getSelectedCandidatePair();var localCandidate="".concat((_a=pair===null||pair===void 0?void 0:pair.local)===null||_a===void 0?void 0:_a.address,":").concat((_b=pair===null||pair===void 0?void 0:pair.local)===null||_b===void 0?void 0:_b.port,"/").concat((_c=pair===null||pair===void 0?void 0:pair.local)===null||_c===void 0?void 0:_c.protocol);var remoteCandidate="".concat((_d=pair===null||pair===void 0?void 0:pair.remote)===null||_d===void 0?void 0:_d.address,":").concat((_e=pair===null||pair===void 0?void 0:pair.remote)===null||_e===void 0?void 0:_e.port,"/").concat((_f=pair===null||pair===void 0?void 0:pair.remote)===null||_f===void 0?void 0:_f.protocol);var pairString="local: ".concat(localCandidate,", remote: ").concat(remoteCandidate);trace('onselectedCandidatePairChange',makeEvent(pairString));}});}_this.transportEventsPreviouslyAdded=true;if(pc.getConfiguration().bundlePolicy==='max-bundle'){return "break";}}};for(var _i=0,senders_1=senders;_i<senders_1.length;_i++){var sender=senders_1[_i];var state_1=_loop_1(sender);if(state_1==="break")break;}}if(!_this.sctpEventsPreviouslyAdded){if(_this.sctp){_this.sctp.addEventListener('statechange',function(){trace('onsctpStateChange',makeEvent(_this.sctp.state));});_this.sctpEventsPreviouslyAdded=true;}}}if(args.length>=2&&typeof args[1]==='function'){args[1].apply(null,[]);return undefined;}return undefined;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>=3&&typeof args[2]==='function'){args[2].apply(null,[err]);return undefined;}throw err;});};}});if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var origGetUserMedia_1=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);var gum=function gum(){trace('onnavigator.mediaDevices.getUserMedia',makeEvent(JSON.stringify(arguments[0])));return origGetUserMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getUserMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getUserMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getUserMedia=gum.bind(navigator.mediaDevices);}if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){var origGetDisplayMedia_1=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);var gdm=function gdm(){trace('onnavigator.mediaDevices.getDisplayMedia',makeEvent(JSON.stringify(arguments[0])));return origGetDisplayMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getDisplayMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getDisplayMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getDisplayMedia=gdm.bind(navigator.mediaDevices);}var getStatsReport=function getStatsReport(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_a){return [2/*return*/,pc.getStats(null).then(function(res){// Convert from stats report to js Map in order to have values set in `statsPreProcessor`
2859
+ opts=arguments[2];}trace("on".concat(method),makeEvent(opts||''));return nativeMethod.apply(this,opts?[opts]:undefined).then(function(description){trace("on".concat(method,"OnSuccess"),makeEvent(description.sdp));if(args.length>0&&typeof args[0]==='function'){args[0].apply(null,[description]);return undefined;}return description;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>1&&typeof args[1]==='function'){args[1].apply(null,[err]);return;}throw err;});};}});['setLocalDescription','setRemoteDescription','addIceCandidate'].forEach(function(method){var nativeMethod=origPeerConnection.prototype[method];if(nativeMethod){origPeerConnection.prototype[method]=function(){var _this=this;var args=arguments;trace("on".concat(method),makeEvent(method==='addIceCandidate'?arguments[0]:arguments[0].sdp));return nativeMethod.apply(this,[arguments[0]]).then(function(){var _a;trace("on".concat(method,"OnSuccess"),makeEvent('success'));if(method.endsWith('Description')){if(!_this.transportEventsPreviouslyAdded){var senders=_this.getSenders();var _loop_1=function _loop_1(sender){if(sender.transport){sender.transport.addEventListener('statechange',function(){if(sender&&sender.transport){trace("ondtlsStateChange",makeEvent(sender.transport.state));}});sender.transport.addEventListener('error',function(error){var errorEvent=error;trace("ondtlsError",makeEvent(errorEvent.error.errorDetail));});if(sender.transport.iceTransport){sender.transport.iceTransport.addEventListener('selectedcandidatepairchange',function(){var _a,_b,_c,_d,_e,_f;if(sender.transport&&sender.transport.iceTransport){var pair=sender.transport.iceTransport.getSelectedCandidatePair();var localCandidate="".concat((_a=pair===null||pair===void 0?void 0:pair.local)===null||_a===void 0?void 0:_a.address,":").concat((_b=pair===null||pair===void 0?void 0:pair.local)===null||_b===void 0?void 0:_b.port,"/").concat((_c=pair===null||pair===void 0?void 0:pair.local)===null||_c===void 0?void 0:_c.protocol);var remoteCandidate="".concat((_d=pair===null||pair===void 0?void 0:pair.remote)===null||_d===void 0?void 0:_d.address,":").concat((_e=pair===null||pair===void 0?void 0:pair.remote)===null||_e===void 0?void 0:_e.port,"/").concat((_f=pair===null||pair===void 0?void 0:pair.remote)===null||_f===void 0?void 0:_f.protocol);var pairString="local: ".concat(localCandidate,", remote: ").concat(remoteCandidate);trace('onselectedCandidatePairChange',makeEvent(pairString));}});}_this.transportEventsPreviouslyAdded=true;if(pc.getConfiguration().bundlePolicy==='max-bundle'){return "break";}}};for(var _i=0,senders_1=senders;_i<senders_1.length;_i++){var sender=senders_1[_i];var state_1=_loop_1(sender);if(state_1==="break")break;}}if(!_this.sctpEventsPreviouslyAdded){// Some Firefox versions prior to 113 have sctp defined but not the events, so check both here.
2860
+ if((_a=_this.sctp)===null||_a===void 0?void 0:_a.addEventListener){_this.sctp.addEventListener('statechange',function(){trace('onsctpStateChange',makeEvent(_this.sctp.state));});_this.sctpEventsPreviouslyAdded=true;}}}if(args.length>=2&&typeof args[1]==='function'){args[1].apply(null,[]);return undefined;}return undefined;},function(err){trace("on".concat(method,"OnFailure"),makeEvent(err.toString()));if(args.length>=3&&typeof args[2]==='function'){args[2].apply(null,[err]);return undefined;}throw err;});};}});if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var origGetUserMedia_1=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);var gum=function gum(){trace('onnavigator.mediaDevices.getUserMedia',makeEvent(JSON.stringify(arguments[0])));return origGetUserMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getUserMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getUserMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getUserMedia=gum.bind(navigator.mediaDevices);}if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){var origGetDisplayMedia_1=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);var gdm=function gdm(){trace('onnavigator.mediaDevices.getDisplayMedia',makeEvent(JSON.stringify(arguments[0])));return origGetDisplayMedia_1.apply(navigator.mediaDevices,arguments).then(function(stream){trace('onnavigator.mediaDevices.getDisplayMediaOnSuccess',makeEvent(JSON.stringify(dumpStream(stream))));return stream;},function(err){trace('onnavigator.mediaDevices.getDisplayMediaOnFailure',makeEvent(err.name));return Promise.reject(err);});};navigator.mediaDevices.getDisplayMedia=gdm.bind(navigator.mediaDevices);}var getStatsReport=function getStatsReport(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_a){return [2/*return*/,pc.getStats(null).then(function(res){// Convert from stats report to js Map in order to have values set in `statsPreProcessor`
2860
2861
  var statsMap=new Map();res.forEach(function(stats,key){return statsMap.set(key,stats);});return statsPreProcessor(statsMap).then(function(){var now=map2obj(statsMap);var base=deepCopy$1(now);// our new prev
2861
2862
  var compressed=deltaCompression(prev,now);trace('stats-report',formatStatsReport(compressed),compressed.timestamp!==-Infinity?compressed.timestamp:undefined);prev=base;return Promise.resolve();});})];});});};var interval=window.setInterval(function(){if(pc.signalingState==='closed'){window.clearInterval(interval);return;}getStatsReport();},intervalTime);var forceStatsReport=function forceStatsReport(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(_a){return [2/*return*/,getStatsReport()];});});};return {forceStatsReport:forceStatsReport};};rtcStats_1=rtcstats.rtcStats=rtcStats;var NUM$1='\\d+';var SDP_TOKEN$1="[!#$%&'*+\\-.^_`{|}~a-zA-Z0-9]+";var ANY_NON_WS$1='\\S+';var SP$1='\\s';var REST$1='.+';class Line$1{}var _a$5$1;class BandwidthLine$1 extends Line$1{constructor(bandwidthType,bandwidth){super();this.bandwidthType=bandwidthType;this.bandwidth=bandwidth;}static fromSdpLine(line){if(!BandwidthLine$1.regex.test(line)){return undefined;}var tokens=line.match(BandwidthLine$1.regex);var bandwidthType=tokens[1];var bandwidth=parseInt(tokens[2],10);return new BandwidthLine$1(bandwidthType,bandwidth);}toSdpLine(){return "b=".concat(this.bandwidthType,":").concat(this.bandwidth);}}_a$5$1=BandwidthLine$1;BandwidthLine$1.BW_TYPE_REGEX='CT|AS|TIAS';BandwidthLine$1.regex=new RegExp("^(".concat(_a$5$1.BW_TYPE_REGEX,"):(").concat(NUM$1,")"));class BundleGroupLine$1 extends Line$1{constructor(mids){super();this.mids=mids;}static fromSdpLine(line){if(!BundleGroupLine$1.regex.test(line)){return undefined;}var tokens=line.match(BundleGroupLine$1.regex);var mids=tokens[1].split(' ');return new BundleGroupLine$1(mids);}toSdpLine(){return "a=group:BUNDLE ".concat(this.mids.join(' '));}}BundleGroupLine$1.regex=new RegExp("^group:BUNDLE (".concat(REST$1,")"));var _a$4$1;class CandidateLine$1 extends Line$1{constructor(foundation,componentId,transport,priority,connectionAddress,port,candidateType,relAddr,relPort,candidateExtensions){super();this.foundation=foundation;this.componentId=componentId;this.transport=transport;this.priority=priority;this.connectionAddress=connectionAddress;this.port=port;this.candidateType=candidateType;this.relAddr=relAddr;this.relPort=relPort;this.candidateExtensions=candidateExtensions;}static fromSdpLine(line){if(!CandidateLine$1.regex.test(line)){return undefined;}var tokens=line.match(CandidateLine$1.regex);var foundation=tokens[1];var componentId=parseInt(tokens[2],10);var transport=tokens[3];var priority=parseInt(tokens[4],10);var connectionAddress=tokens[5];var port=parseInt(tokens[6],10);var candidateType=tokens[7];var relAddr=tokens[8];var relPort=tokens[9]?parseInt(tokens[9],10):undefined;var candidateExtensions=tokens[10];return new CandidateLine$1(foundation,componentId,transport,priority,connectionAddress,port,candidateType,relAddr,relPort,candidateExtensions);}toSdpLine(){var str='';str+="a=candidate:".concat(this.foundation," ").concat(this.componentId," ").concat(this.transport," ").concat(this.priority," ").concat(this.connectionAddress," ").concat(this.port," typ ").concat(this.candidateType);if(this.relAddr){str+=" raddr ".concat(this.relAddr);}if(this.relPort){str+=" rport ".concat(this.relPort);}if(this.candidateExtensions){str+=" ".concat(this.candidateExtensions);}return str;}}_a$4$1=CandidateLine$1;CandidateLine$1.ICE_CHARS="[a-zA-Z0-9+/]+";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,"))?"));class ConnectionLine$1 extends Line$1{constructor(netType,addrType,ipAddr){super();this.netType=netType;this.addrType=addrType;this.ipAddr=ipAddr;}static fromSdpLine(line){if(!ConnectionLine$1.regex.test(line)){return undefined;}var tokens=line.match(ConnectionLine$1.regex);var netType=tokens[1];var addrType=tokens[2];var ipAddr=tokens[3];return new ConnectionLine$1(netType,addrType,ipAddr);}toSdpLine(){return "c=".concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr);}}ConnectionLine$1.regex=new RegExp("^(".concat(ANY_NON_WS$1,") (").concat(ANY_NON_WS$1,") (").concat(ANY_NON_WS$1,")"));class ContentLine$1 extends Line$1{constructor(values){super();this.values=values;}static fromSdpLine(line){if(!ContentLine$1.regex.test(line)){return undefined;}var tokens=line.match(ContentLine$1.regex);var values=tokens[1].split(',');return new ContentLine$1(values);}toSdpLine(){return "a=content:".concat(this.values.join(','));}}ContentLine$1.regex=new RegExp("^content:(".concat(REST$1,")$"));class DirectionLine$1 extends Line$1{constructor(direction){super();this.direction=direction;}static fromSdpLine(line){if(!DirectionLine$1.regex.test(line)){return undefined;}var tokens=line.match(DirectionLine$1.regex);var direction=tokens[1];return new DirectionLine$1(direction);}toSdpLine(){return "a=".concat(this.direction);}}DirectionLine$1.regex=/^(sendrecv|sendonly|recvonly|inactive)$/;var _a$3$1;class ExtMapLine$1 extends Line$1{constructor(id,uri,direction,extensionAttributes){super();this.id=id;this.uri=uri;this.direction=direction;this.extensionAttributes=extensionAttributes;}static fromSdpLine(line){if(!ExtMapLine$1.regex.test(line)){return undefined;}var tokens=line.match(ExtMapLine$1.regex);var id=parseInt(tokens[1],10);var direction=tokens[2];var uri=tokens[3];var extensionAttributes=tokens[4];return new ExtMapLine$1(id,uri,direction,extensionAttributes);}toSdpLine(){var str='';str+="a=extmap:".concat(this.id);if(this.direction){str+="/".concat(this.direction);}str+=" ".concat(this.uri);if(this.extensionAttributes){str+=" ".concat(this.extensionAttributes);}return str;}}_a$3$1=ExtMapLine$1;ExtMapLine$1.EXTMAP_DIRECTION="sendonly|recvonly|sendrecv|inactive";ExtMapLine$1.regex=new RegExp("^extmap:(".concat(NUM$1,")(?:/(").concat(_a$3$1.EXTMAP_DIRECTION,"))? (").concat(ANY_NON_WS$1,")(?: (").concat(REST$1,"))?"));class FingerprintLine$1 extends Line$1{constructor(fingerprint){super();this.fingerprint=fingerprint;}static fromSdpLine(line){if(!FingerprintLine$1.regex.test(line)){return undefined;}var tokens=line.match(FingerprintLine$1.regex);var fingerprint=tokens[1];return new FingerprintLine$1(fingerprint);}toSdpLine(){return "a=fingerprint:".concat(this.fingerprint);}}FingerprintLine$1.regex=new RegExp("^fingerprint:(".concat(REST$1,")"));function parseFmtpParams$1(fmtpParams){fmtpParams=fmtpParams.replace(/^a=fmtp:\d+\x20/,'');var fmtpObj=new Map();if(/^\d+([,/-]\d+)+$/.test(fmtpParams)){fmtpObj.set(fmtpParams,undefined);return fmtpObj;}fmtpParams.split(';').forEach(param=>{var paramArr=param&&param.split('=');if(paramArr.length!==2||!paramArr[0]||!paramArr[1]){throw new Error("Fmtp params is invalid with ".concat(fmtpParams));}fmtpObj.set(paramArr[0],paramArr[1]);});return fmtpObj;}class FmtpLine$1 extends Line$1{constructor(payloadType,params){super();this.payloadType=payloadType;this.params=params;}static fromSdpLine(line){if(!FmtpLine$1.regex.test(line)){return undefined;}var tokens=line.match(FmtpLine$1.regex);var payloadType=parseInt(tokens[1],10);var params=tokens[2];return new FmtpLine$1(payloadType,parseFmtpParams$1(params));}toSdpLine(){var fmtParams=Array.from(this.params.keys()).map(key=>{if(this.params.get(key)!==undefined){return "".concat(key,"=").concat(this.params.get(key));}return "".concat(key);}).join(';');return "a=fmtp:".concat(this.payloadType," ").concat(fmtParams);}}FmtpLine$1.regex=new RegExp("^fmtp:(".concat(NUM$1,") (").concat(REST$1,")"));class IceOptionsLine$1 extends Line$1{constructor(options){super();this.options=options;}static fromSdpLine(line){if(!IceOptionsLine$1.regex.test(line)){return undefined;}var tokens=line.match(IceOptionsLine$1.regex);var options=tokens[1].split(' ');return new IceOptionsLine$1(options);}toSdpLine(){return "a=ice-options:".concat(this.options.join(' '));}}IceOptionsLine$1.regex=new RegExp("^ice-options:(".concat(REST$1,")$"));class IcePwdLine$1 extends Line$1{constructor(pwd){super();this.pwd=pwd;}static fromSdpLine(line){if(!IcePwdLine$1.regex.test(line)){return undefined;}var tokens=line.match(IcePwdLine$1.regex);var pwd=tokens[1];return new IcePwdLine$1(pwd);}toSdpLine(){return "a=ice-pwd:".concat(this.pwd);}}IcePwdLine$1.regex=new RegExp("^ice-pwd:(".concat(ANY_NON_WS$1,")$"));class IceUfragLine$1 extends Line$1{constructor(ufrag){super();this.ufrag=ufrag;}static fromSdpLine(line){if(!IceUfragLine$1.regex.test(line)){return undefined;}var tokens=line.match(IceUfragLine$1.regex);var ufrag=tokens[1];return new IceUfragLine$1(ufrag);}toSdpLine(){return "a=ice-ufrag:".concat(this.ufrag);}}IceUfragLine$1.regex=new RegExp("^ice-ufrag:(".concat(ANY_NON_WS$1,")$"));class MaxMessageSizeLine$1 extends Line$1{constructor(maxMessageSize){super();this.maxMessageSize=maxMessageSize;}static fromSdpLine(line){if(!MaxMessageSizeLine$1.regex.test(line)){return undefined;}var tokens=line.match(MaxMessageSizeLine$1.regex);var maxMessageSize=parseInt(tokens[1],10);return new MaxMessageSizeLine$1(maxMessageSize);}toSdpLine(){return "a=max-message-size:".concat(this.maxMessageSize);}}MaxMessageSizeLine$1.regex=new RegExp("^max-message-size:(".concat(NUM$1,")"));var _a$2$2;class MediaLine$1 extends Line$1{constructor(type,port,protocol,formats){super();this.type=type;this.port=port;this.protocol=protocol;this.formats=formats;}static fromSdpLine(line){if(!MediaLine$1.regex.test(line)){return undefined;}var tokens=line.match(MediaLine$1.regex);var type=tokens[1];var port=parseInt(tokens[2],10);var protocol=tokens[3];var formats=tokens[4].split(' ');return new MediaLine$1(type,port,protocol,formats);}toSdpLine(){return "m=".concat(this.type," ").concat(this.port," ").concat(this.protocol," ").concat(this.formats.join(' '));}}_a$2$2=MediaLine$1;MediaLine$1.MEDIA_TYPE='audio|video|application';MediaLine$1.regex=new RegExp("^(".concat(_a$2$2.MEDIA_TYPE,") (").concat(NUM$1,") (").concat(ANY_NON_WS$1,") (").concat(REST$1,")"));class MidLine$1 extends Line$1{constructor(mid){super();this.mid=mid;}static fromSdpLine(line){if(!MidLine$1.regex.test(line)){return undefined;}var tokens=line.match(MidLine$1.regex);var mid=tokens[1];return new MidLine$1(mid);}toSdpLine(){return "a=mid:".concat(this.mid);}}MidLine$1.regex=new RegExp("^mid:(".concat(ANY_NON_WS$1,")$"));class OriginLine$1 extends Line$1{constructor(username,sessionId,sessionVersion,netType,addrType,ipAddr){super();this.username=username;this.sessionId=sessionId;this.sessionVersion=sessionVersion;this.netType=netType;this.addrType=addrType;this.ipAddr=ipAddr;}static fromSdpLine(line){if(!OriginLine$1.regex.test(line)){return undefined;}var tokens=line.match(OriginLine$1.regex);var username=tokens[1];var sessionId=tokens[2];var sessionVersion=parseInt(tokens[3],10);var netType=tokens[4];var addrType=tokens[5];var ipAddr=tokens[6];return new OriginLine$1(username,sessionId,sessionVersion,netType,addrType,ipAddr);}toSdpLine(){return "o=".concat(this.username," ").concat(this.sessionId," ").concat(this.sessionVersion," ").concat(this.netType," ").concat(this.addrType," ").concat(this.ipAddr);}}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,")"));var _a$1$2;class RidLine$1 extends Line$1{constructor(id,direction,params){super();this.id=id;this.direction=direction;this.params=params;}static fromSdpLine(line){if(!RidLine$1.regex.test(line)){return undefined;}var tokens=line.match(RidLine$1.regex);var id=tokens[1];var direction=tokens[2];var params=tokens[3];return new RidLine$1(id,direction,params);}toSdpLine(){var str='';str+="a=rid:".concat(this.id," ").concat(this.direction);if(this.params){str+=" ".concat(this.params);}return str;}}_a$1$2=RidLine$1;RidLine$1.RID_ID="[\\w-]+";RidLine$1.RID_DIRECTION="\\bsend\\b|\\brecv\\b";RidLine$1.regex=new RegExp("^rid:(".concat(_a$1$2.RID_ID,") (").concat(_a$1$2.RID_DIRECTION,")(?:").concat(SP$1,"(").concat(REST$1,"))?"));class RtcpMuxLine$1 extends Line$1{static fromSdpLine(line){if(!RtcpMuxLine$1.regex.test(line)){return undefined;}return new RtcpMuxLine$1();}toSdpLine(){return "a=rtcp-mux";}}RtcpMuxLine$1.regex=/^rtcp-mux$/;class RtcpFbLine$1 extends Line$1{constructor(payloadType,feedback){super();this.payloadType=payloadType;this.feedback=feedback;}static fromSdpLine(line){if(!RtcpFbLine$1.regex.test(line)){return undefined;}var tokens=line.match(RtcpFbLine$1.regex);var payloadType=parseInt(tokens[1],10);var feedback=tokens[2];return new RtcpFbLine$1(payloadType,feedback);}toSdpLine(){return "a=rtcp-fb:".concat(this.payloadType," ").concat(this.feedback);}}RtcpFbLine$1.regex=new RegExp("^rtcp-fb:(".concat(NUM$1,") (").concat(REST$1,")"));var _a$7;class RtpMapLine$1 extends Line$1{constructor(payloadType,encodingName,clockRate,encodingParams){super();this.payloadType=payloadType;this.encodingName=encodingName;this.clockRate=clockRate;this.encodingParams=encodingParams;}static fromSdpLine(line){if(!RtpMapLine$1.regex.test(line)){return undefined;}var tokens=line.match(RtpMapLine$1.regex);var payloadType=parseInt(tokens[1],10);var encodingName=tokens[2];var clockRate=parseInt(tokens[3],10);var encodingParams=tokens[4];return new RtpMapLine$1(payloadType,encodingName,clockRate,encodingParams);}toSdpLine(){var str='';str+="a=rtpmap:".concat(this.payloadType," ").concat(this.encodingName,"/").concat(this.clockRate);if(this.encodingParams){str+="/".concat(this.encodingParams);}return str;}}_a$7=RtpMapLine$1;RtpMapLine$1.NON_SLASH_TOKEN='[^\\s/]+';RtpMapLine$1.regex=new RegExp("^rtpmap:(".concat(NUM$1,") (").concat(_a$7.NON_SLASH_TOKEN,")/(").concat(_a$7.NON_SLASH_TOKEN,")(?:/(").concat(_a$7.NON_SLASH_TOKEN,"))?"));class SctpPortLine$1 extends Line$1{constructor(port){super();this.port=port;}static fromSdpLine(line){if(!SctpPortLine$1.regex.test(line)){return undefined;}var tokens=line.match(SctpPortLine$1.regex);var port=parseInt(tokens[1],10);return new SctpPortLine$1(port);}toSdpLine(){return "a=sctp-port:".concat(this.port);}}SctpPortLine$1.regex=new RegExp("^sctp-port:(".concat(NUM$1,")"));class SessionInformationLine$1 extends Line$1{constructor(info){super();this.info=info;}static fromSdpLine(line){if(!SessionInformationLine$1.regex.test(line)){return undefined;}var tokens=line.match(SessionInformationLine$1.regex);var info=tokens[1];return new SessionInformationLine$1(info);}toSdpLine(){return "i=".concat(this.info);}}SessionInformationLine$1.regex=new RegExp("(".concat(REST$1,")"));class SessionNameLine$1 extends Line$1{constructor(name){super();this.name=name;}static fromSdpLine(line){if(!SessionNameLine$1.regex.test(line)){return undefined;}var tokens=line.match(SessionNameLine$1.regex);var name=tokens[1];return new SessionNameLine$1(name);}toSdpLine(){return "s=".concat(this.name);}}SessionNameLine$1.regex=new RegExp("^(".concat(REST$1,")"));class SetupLine$1 extends Line$1{constructor(setup){super();this.setup=setup;}static fromSdpLine(line){if(!SetupLine$1.regex.test(line)){return undefined;}var tokens=line.match(SetupLine$1.regex);var setup=tokens[1];return new SetupLine$1(setup);}toSdpLine(){return "a=setup:".concat(this.setup);}}SetupLine$1.regex=/^setup:(actpass|active|passive)$/;class SimulcastLayer$1{constructor(id,paused){this.id=id;this.paused=paused;}toString(){return this.paused?"~".concat(this.id):this.id;}}class SimulcastLayerList$1{constructor(){this.layers=[];}addLayer(layer){this.layers.push([layer]);}addLayerWithAlternatives(alternatives){this.layers.push(alternatives);}get length(){return this.layers.length;}get(index){return this.layers[index];}static fromString(str){var layerList=new SimulcastLayerList$1();var tokens=str.split(';');if(tokens.length===1&&!tokens[0].trim()){throw new Error('simulcast stream list empty');}tokens.forEach(token=>{if(!token){throw new Error('simulcast layer list empty');}var ridTokens=token.split(',');var layers=[];ridTokens.forEach(ridToken=>{if(!ridToken||ridToken==='~'){throw new Error('rid empty');}var paused=ridToken[0]==='~';var rid=paused?ridToken.substring(1):ridToken;layers.push(new SimulcastLayer$1(rid,paused));});layerList.addLayerWithAlternatives(layers);});return layerList;}toString(){return this.layers.map(altArray=>altArray.map(v=>v.toString()).join(',')).join(';');}}class SimulcastLine$1 extends Line$1{constructor(sendLayers,recvLayers){super();this.sendLayers=sendLayers;this.recvLayers=recvLayers;}static fromSdpLine(line){if(!SimulcastLine$1.regex.test(line)){return undefined;}var tokens=line.match(SimulcastLine$1.regex);var bidirectional=tokens[3]&&tokens[4];var firstDirection=tokens[1];var layerList1=SimulcastLayerList$1.fromString(tokens[2]);var layerList2=new SimulcastLayerList$1();if(bidirectional){var secondDirection=tokens[3];if(firstDirection===secondDirection){return undefined;}layerList2=SimulcastLayerList$1.fromString(tokens[4]);}var sendLayerList;var recvLayerList;if(firstDirection==='send'){sendLayerList=layerList1;recvLayerList=layerList2;}else {sendLayerList=layerList2;recvLayerList=layerList1;}return new SimulcastLine$1(sendLayerList,recvLayerList);}toSdpLine(){var str='a=simulcast:';if(this.sendLayers.length){str+="send ".concat(this.sendLayers.toString());if(this.recvLayers.length){str+=" ";}}if(this.recvLayers.length){str+="recv ".concat(this.recvLayers.toString());}return str;}}SimulcastLine$1.regex=new RegExp("^simulcast:(send|recv) (".concat(ANY_NON_WS$1,")(?: (send|recv) (").concat(ANY_NON_WS$1,"))?"));class SsrcLine$1 extends Line$1{constructor(ssrcId,attribute){var attributeValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:undefined;var attributeData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:undefined;super();this.ssrcId=ssrcId;this.attribute=attribute;this.attributeValue=attributeValue;this.attributeData=attributeData;}static fromSdpLine(line){if(!SsrcLine$1.regex.test(line)){return undefined;}var tokens=line.match(SsrcLine$1.regex);var ssrcId=parseInt(tokens[1],10);var attribute=tokens[2];var attributeValue=tokens[3];var attributeData=tokens[4];return new SsrcLine$1(ssrcId,attribute,attributeValue,attributeData);}toSdpLine(){var str="a=ssrc:".concat(this.ssrcId," ").concat(this.attribute);if(this.attributeValue){str+=":".concat(this.attributeValue);}if(this.attributeData){str+=" ".concat(this.attributeData);}return str;}}SsrcLine$1.regex=new RegExp("^ssrc:(".concat(NUM$1,") (").concat(SDP_TOKEN$1,")(?::(").concat(SDP_TOKEN$1,")?(?: (").concat(ANY_NON_WS$1,"))?)?$"));class SsrcGroupLine$1 extends Line$1{constructor(semantics,ssrcs){super();this.semantics=semantics;this.ssrcs=ssrcs;}static fromSdpLine(line){if(!SsrcGroupLine$1.regex.test(line)){return undefined;}var tokens=line.match(SsrcGroupLine$1.regex);var semantics=tokens[1];var ssrcs=tokens[2].split(' ').map(ssrcStr=>parseInt(ssrcStr,10));return new SsrcGroupLine$1(semantics,ssrcs);}toSdpLine(){return "a=ssrc-group:".concat(this.semantics," ").concat(this.ssrcs.join(' '));}}SsrcGroupLine$1.regex=new RegExp("^ssrc-group:(SIM|FID|FEC) ((?:".concat(NUM$1).concat(SP$1,"*)+)"));class TimingLine$1 extends Line$1{constructor(startTime,stopTime){super();this.startTime=startTime;this.stopTime=stopTime;}static fromSdpLine(line){if(!TimingLine$1.regex.test(line)){return undefined;}var tokens=line.match(TimingLine$1.regex);var startTime=parseInt(tokens[1],10);var stopTime=parseInt(tokens[2],10);return new TimingLine$1(startTime,stopTime);}toSdpLine(){return "t=".concat(this.startTime," ").concat(this.stopTime);}}TimingLine$1.regex=new RegExp("^(".concat(NUM$1,") (").concat(NUM$1,")"));class VersionLine$1 extends Line$1{constructor(version){super();this.version=version;}static fromSdpLine(line){if(!VersionLine$1.regex.test(line)){return undefined;}var tokens=line.match(VersionLine$1.regex);var version=parseInt(tokens[1],10);return new VersionLine$1(version);}toSdpLine(){return "v=".concat(this.version);}}VersionLine$1.regex=new RegExp("^(".concat(NUM$1,")$"));class UnknownLine$1 extends Line$1{constructor(value){super();this.value=value;}static fromSdpLine(line){var tokens=line.match(UnknownLine$1.regex);var value=tokens[1];return new UnknownLine$1(value);}toSdpLine(){return "".concat(this.value);}}UnknownLine$1.regex=new RegExp("(".concat(REST$1,")"));class IceInfo$1{constructor(){this.candidates=[];}addLine(line){if(line instanceof IceUfragLine$1){this.ufrag=line;return true;}if(line instanceof IcePwdLine$1){this.pwd=line;return true;}if(line instanceof IceOptionsLine$1){this.options=line;return true;}if(line instanceof CandidateLine$1){this.candidates.push(line);return true;}return false;}toLines(){var lines=[];if(this.ufrag){lines.push(this.ufrag);}if(this.pwd){lines.push(this.pwd);}if(this.options){lines.push(this.options);}this.candidates.forEach(candidate=>lines.push(candidate));return lines;}}class MediaDescription$1{constructor(type,port,protocol){this.iceInfo=new IceInfo$1();this.otherLines=[];this.type=type;this.port=port;this.protocol=protocol;}findOtherLine(ty){return this.otherLines.find(line=>line instanceof ty);}addLine(line){if(line instanceof BundleGroupLine$1){throw new Error("Error: bundle group line not allowed in media description");}if(line instanceof BandwidthLine$1){this.bandwidth=line;return true;}if(line instanceof MidLine$1){this.mid=line.mid;return true;}if(line instanceof FingerprintLine$1){this.fingerprint=line.fingerprint;return true;}if(line instanceof SetupLine$1){this.setup=line.setup;return true;}if(line instanceof ConnectionLine$1){this.connection=line;return true;}if(line instanceof ContentLine$1){this.content=line;return true;}return this.iceInfo.addLine(line);}}class ApplicationMediaDescription$1 extends MediaDescription$1{constructor(mediaLine){super(mediaLine.type,mediaLine.port,mediaLine.protocol);this.fmts=[];this.fmts=mediaLine.formats;}toLines(){var lines=[];lines.push(new MediaLine$1(this.type,this.port,this.protocol,this.fmts));if(this.connection){lines.push(this.connection);}if(this.bandwidth){lines.push(this.bandwidth);}lines.push(...this.iceInfo.toLines());if(this.fingerprint){lines.push(new FingerprintLine$1(this.fingerprint));}if(this.setup){lines.push(new SetupLine$1(this.setup));}if(this.mid){lines.push(new MidLine$1(this.mid));}if(this.content){lines.push(this.content);}if(this.sctpPort){lines.push(new SctpPortLine$1(this.sctpPort));}if(this.maxMessageSize){lines.push(new MaxMessageSizeLine$1(this.maxMessageSize));}lines.push(...this.otherLines);return lines;}addLine(line){if(super.addLine(line)){return true;}if(line instanceof MediaLine$1){throw new Error('Error: tried passing a MediaLine to an existing MediaInfo');}if(line instanceof SctpPortLine$1){this.sctpPort=line.port;return true;}if(line instanceof MaxMessageSizeLine$1){this.maxMessageSize=line.maxMessageSize;return true;}this.otherLines.push(line);return true;}}class CodecInfo$2{constructor(pt){this.fmtParams=new Map();this.feedback=[];this.pt=pt;}addLine(line){if(line instanceof RtpMapLine$1){this.name=line.encodingName;this.clockRate=line.clockRate;this.encodingParams=line.encodingParams;return true;}if(line instanceof FmtpLine$1){this.fmtParams=new Map([...Array.from(this.fmtParams.entries()),...Array.from(line.params.entries())]);if(line.params.has('apt')){var apt=line.params.get('apt');this.primaryCodecPt=parseInt(apt,10);}return true;}if(line instanceof RtcpFbLine$1){this.feedback.push(line.feedback);return true;}return false;}toLines(){var lines=[];if(this.name&&this.clockRate){lines.push(new RtpMapLine$1(this.pt,this.name,this.clockRate,this.encodingParams));}this.feedback.forEach(fb=>{lines.push(new RtcpFbLine$1(this.pt,fb));});if(this.fmtParams.size>0){lines.push(new FmtpLine$1(this.pt,this.fmtParams));}return lines;}}class AvMediaDescription$1 extends MediaDescription$1{constructor(mediaLine){super(mediaLine.type,mediaLine.port,mediaLine.protocol);this.pts=[];this.extMaps=new Map();this.rids=[];this.codecs=new Map();this.rtcpMux=false;this.ssrcs=[];this.ssrcGroups=[];this.pts=mediaLine.formats.map(fmt=>{return parseInt(fmt,10);});this.pts.forEach(pt=>this.codecs.set(pt,new CodecInfo$2(pt)));}toLines(){var lines=[];lines.push(new MediaLine$1(this.type,this.port,this.protocol,this.pts.map(pt=>"".concat(pt))));if(this.connection){lines.push(this.connection);}if(this.bandwidth){lines.push(this.bandwidth);}lines.push(...this.iceInfo.toLines());if(this.fingerprint){lines.push(new FingerprintLine$1(this.fingerprint));}if(this.setup){lines.push(new SetupLine$1(this.setup));}if(this.mid){lines.push(new MidLine$1(this.mid));}if(this.rtcpMux){lines.push(new RtcpMuxLine$1());}if(this.content){lines.push(this.content);}this.extMaps.forEach(extMap=>lines.push(extMap));this.rids.forEach(rid=>lines.push(rid));if(this.simulcast){lines.push(this.simulcast);}if(this.direction){lines.push(new DirectionLine$1(this.direction));}this.codecs.forEach(codec=>lines.push(...codec.toLines()));lines.push(...this.ssrcs);lines.push(...this.ssrcGroups);lines.push(...this.otherLines);return lines;}addLine(line){if(super.addLine(line)){return true;}if(line instanceof MediaLine$1){throw new Error('Error: tried passing a MediaLine to an existing MediaInfo');}if(line instanceof DirectionLine$1){this.direction=line.direction;return true;}if(line instanceof ExtMapLine$1){if(this.extMaps.has(line.id)){throw new Error("Tried to extension with duplicate ID: an extension already exists with ID ".concat(line.id));}this.extMaps.set(line.id,line);return true;}if(line instanceof RidLine$1){this.rids.push(line);return true;}if(line instanceof RtcpMuxLine$1){this.rtcpMux=true;return true;}if(line instanceof SimulcastLine$1){this.simulcast=line;return true;}if(line instanceof RtpMapLine$1||line instanceof FmtpLine$1||line instanceof RtcpFbLine$1){var codec=this.codecs.get(line.payloadType);if(!codec){throw new Error("Error: got line for unknown codec: ".concat(line.toSdpLine()));}codec.addLine(line);return true;}if(line instanceof SsrcLine$1){this.ssrcs.push(line);return true;}if(line instanceof SsrcGroupLine$1){this.ssrcGroups.push(line);return true;}this.otherLines.push(line);return true;}getCodecByPt(pt){return this.codecs.get(pt);}removePt(pt){var associatedPts=[...this.codecs.values()].filter(ci=>ci.primaryCodecPt===pt).map(ci=>ci.pt);var allPtsToRemove=[pt,...associatedPts];allPtsToRemove.forEach(ptToRemove=>{this.codecs.delete(ptToRemove);});this.pts=this.pts.filter(existingPt=>allPtsToRemove.indexOf(existingPt)===-1);}addExtension(_ref){var{uri,direction,attributes,id}=_ref;var getFirstFreeId=()=>{var freeId=1;for(;;){if(!this.extMaps.has(freeId)){break;}freeId+=1;}return freeId;};var extId=id||getFirstFreeId();if(this.extMaps.has(extId)){throw new Error("Extension with ID ".concat(id," already exists"));}if(extId===0){throw new Error("Extension ID 0 is reserved");}this.extMaps.set(extId,new ExtMapLine$1(extId,uri,direction,attributes));}}class SessionDescription$1{constructor(){this.groups=[];this.otherLines=[];}addLine(line){if(line instanceof VersionLine$1){this.version=line;return true;}if(line instanceof OriginLine$1){this.origin=line;return true;}if(line instanceof SessionNameLine$1){this.sessionName=line;return true;}if(line instanceof SessionInformationLine$1){this.information=line;return true;}if(line instanceof TimingLine$1){this.timing=line;return true;}if(line instanceof ConnectionLine$1){this.connection=line;return true;}if(line instanceof BandwidthLine$1){this.bandwidth=line;return true;}if(line instanceof BundleGroupLine$1){this.groups.push(line);return true;}this.otherLines.push(line);return true;}toLines(){var lines=[];if(this.version){lines.push(this.version);}if(this.origin){lines.push(this.origin);}if(this.sessionName){lines.push(this.sessionName);}if(this.information){lines.push(this.information);}if(this.connection){lines.push(this.connection);}if(this.bandwidth){lines.push(this.bandwidth);}if(this.timing){lines.push(this.timing);}if(this.groups){lines.push(...this.groups);}lines.push(...this.otherLines);return lines;}}class Sdp$1{constructor(){this.session=new SessionDescription$1();this.media=[];}get avMedia(){return this.media.filter(mi=>mi instanceof AvMediaDescription$1);}toString(){var lines=[];lines.push(...this.session.toLines());this.media.forEach(m=>lines.push(...m.toLines()));return "".concat(lines.map(l=>l.toSdpLine()).join('\r\n'),"\r\n");}}class Grammar$1{constructor(){this.parsers=new Map();}addParser(lineType,parser){var parsers=this.parsers.get(lineType)||[];parsers.push(parser);this.parsers.set(lineType,parsers);}getParsers(lineType){return this.parsers.get(lineType)||[];}}class SdpGrammar$1 extends Grammar$1{constructor(){super();this.addParser('v',VersionLine$1.fromSdpLine);this.addParser('o',OriginLine$1.fromSdpLine);this.addParser('c',ConnectionLine$1.fromSdpLine);this.addParser('i',SessionInformationLine$1.fromSdpLine);this.addParser('m',MediaLine$1.fromSdpLine);this.addParser('s',SessionNameLine$1.fromSdpLine);this.addParser('t',TimingLine$1.fromSdpLine);this.addParser('b',BandwidthLine$1.fromSdpLine);this.addParser('a',RtpMapLine$1.fromSdpLine);this.addParser('a',RtcpFbLine$1.fromSdpLine);this.addParser('a',FmtpLine$1.fromSdpLine);this.addParser('a',DirectionLine$1.fromSdpLine);this.addParser('a',ExtMapLine$1.fromSdpLine);this.addParser('a',MidLine$1.fromSdpLine);this.addParser('a',IceUfragLine$1.fromSdpLine);this.addParser('a',IcePwdLine$1.fromSdpLine);this.addParser('a',IceOptionsLine$1.fromSdpLine);this.addParser('a',FingerprintLine$1.fromSdpLine);this.addParser('a',SetupLine$1.fromSdpLine);this.addParser('a',SctpPortLine$1.fromSdpLine);this.addParser('a',MaxMessageSizeLine$1.fromSdpLine);this.addParser('a',RtcpMuxLine$1.fromSdpLine);this.addParser('a',BundleGroupLine$1.fromSdpLine);this.addParser('a',ContentLine$1.fromSdpLine);this.addParser('a',RidLine$1.fromSdpLine);this.addParser('a',CandidateLine$1.fromSdpLine);this.addParser('a',SimulcastLine$1.fromSdpLine);this.addParser('a',SsrcLine$1.fromSdpLine);this.addParser('a',SsrcGroupLine$1.fromSdpLine);}}var DefaultSdpGrammar$1=new SdpGrammar$1();function isValidLine$1(line){return line.length>2;}function parseToModel$1(lines){var sdp=new Sdp$1();var currBlock=sdp.session;lines.forEach(l=>{if(l instanceof MediaLine$1){var mediaInfo;if(l.type==='audio'||l.type==='video'){mediaInfo=new AvMediaDescription$1(l);}else if(l.type==='application'){mediaInfo=new ApplicationMediaDescription$1(l);}else {throw new Error("Unhandled media type: ".concat(l.type));}sdp.media.push(mediaInfo);currBlock=mediaInfo;}else {currBlock.addLine(l);}});return sdp;}function parseToLines$1(sdp,grammar){var lines=[];sdp.split(/(\r\n|\r|\n)/).filter(isValidLine$1).forEach(l=>{var lineType=l[0];var lineValue=l.slice(2);var parsers=grammar.getParsers(lineType);for(var parser of parsers){var _result=parser(lineValue);if(_result){lines.push(_result);return;}}var result=UnknownLine$1.fromSdpLine(l);lines.push(result);});return lines;}function parse$1(sdp){var grammar=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DefaultSdpGrammar$1;var lines=parseToLines$1(sdp,grammar);var parsed=parseToModel$1(lines);return parsed;}function disableRtcpFbValue(sdpOrAv,rtcpFbValue){var mediaDescriptions=sdpOrAv instanceof Sdp$1?sdpOrAv.avMedia:[sdpOrAv];mediaDescriptions.forEach(media=>{media.codecs.forEach(codec=>{codec.feedback=codec.feedback.filter(fb=>fb!==rtcpFbValue);});});}function disableTwcc(sdpOrAv){disableRtcpFbValue(sdpOrAv,'transport-cc');}function removeCodec(sdpOrAv,codecName){var mediaDescriptions=sdpOrAv instanceof Sdp$1?sdpOrAv.avMedia:[sdpOrAv];mediaDescriptions.forEach(media=>{var codecInfos=[...media.codecs.entries()].filter(_ref2=>{var[,ci]=_ref2;var _a;return ((_a=ci.name)===null||_a===void 0?void 0:_a.toLowerCase())===codecName.toLowerCase();});codecInfos.forEach(_ref3=>{var[pt]=_ref3;return media.removePt(pt);});});}function retainCodecs(sdpOrAv,allowedCodecNames){var avMediaDescriptions=sdpOrAv instanceof Sdp$1?sdpOrAv.avMedia:[sdpOrAv];var allowedLowerCase=allowedCodecNames.map(s=>s.toLowerCase());avMediaDescriptions.map(av=>{return [...av.codecs.values()].map(c=>c.name);}).flat().filter(codecName=>!allowedLowerCase.includes(codecName.toLowerCase())).forEach(unwantedCodec=>removeCodec(sdpOrAv,unwantedCodec));}function retainCandidates(sdpOrMedia,allowedTransportTypes){var mediaDescriptions=sdpOrMedia instanceof Sdp$1?sdpOrMedia.media:[sdpOrMedia];var filtered=false;mediaDescriptions.forEach(media=>{media.iceInfo.candidates=media.iceInfo.candidates.filter(candidate=>{if(allowedTransportTypes.includes(candidate.transport.toLowerCase())){return true;}filtered=true;return false;});});return filtered;}function hasCodec(codecName,mLine){return [...mLine.codecs.values()].some(ci=>{var _a;return ((_a=ci.name)===null||_a===void 0?void 0:_a.toLowerCase())===codecName.toLowerCase();});}var commonjsGlobal=typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global$1!=='undefined'?global$1:typeof self!=='undefined'?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,'default')?x['default']:x;}var es5={exports:{}};(function(module,exports){!function(e,t){module.exports=t();}(commonjsGlobal,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports;}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e){r.d(n,i,function(t){return e[t];}.bind(null,i));}return n;},r.n=function(e){var t=e&&e.__esModule?function(){return e.default;}:function(){return e;};return r.d(t,"a",t),t;},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t);},r.p="",r(r.s=90);}({17:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||"";},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||"";},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r;},e.getWindowsVersionName=function(e){switch(e){case"NT":return "NT";case"XP":return "XP";case"NT 5.0":return "2000";case"NT 5.1":return "XP";case"NT 5.2":return "2003";case"NT 6.0":return "Vista";case"NT 6.1":return "7";case"NT 6.2":return "8";case"NT 6.3":return "8.1";case"NT 10.0":return "10";default:return;}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0;});if(t.push(0),10===t[0])switch(t[1]){case 5:return "Leopard";case 6:return "Snow Leopard";case 7:return "Lion";case 8:return "Mountain Lion";case 9:return "Mavericks";case 10:return "Yosemite";case 11:return "El Capitan";case 12:return "Sierra";case 13:return "High Sierra";case 14:return "Mojave";case 15:return "Catalina";default:return;}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0;});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;},e.getVersionPrecision=function(e){return e.split(".").length;},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(r),a=Math.max(i,s),o=0,u=e.map([t,r],function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),function(e){return new Array(20-e.length).join("0")+e;}).reverse();});for(n&&(o=a-Math.min(i,s)),a-=1;a>=o;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===o)return 0;a-=1;}else if(u[0][a]<u[1][a])return -1;}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1){n.push(t(e[r]));}return n;},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i;}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++){s[a-1]=arguments[a];}if(Object.assign)return Object.assign.apply(Object,[e].concat(s));var o=function o(){var e=s[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach(function(t){n[t]=e[t];});};for(t=0,r=s.length;t<r;t+=1){o();}return e;},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e];},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||"";},e;}();t.default=i,e.exports=t.default;},18:function _(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0;t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"};t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"};t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"};t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"};t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};},90:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},s=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}var o=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t);},e.parse=function(e){return new i.default(e).getResult();},t=e,n=[{key:"BROWSER_MAP",get:function get(){return s.BROWSER_MAP;}},{key:"ENGINE_MAP",get:function get(){return s.ENGINE_MAP;}},{key:"OS_MAP",get:function get(){return s.OS_MAP;}},{key:"PLATFORMS_MAP",get:function get(){return s.PLATFORMS_MAP;}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e;}();t.default=o,e.exports=t.default;},91:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n=u(r(92)),i=u(r(93)),s=u(r(94)),a=u(r(95)),o=u(r(17));function u(e){return e&&e.__esModule?e:{default:e};}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse();}var t=e.prototype;return t.getUA=function(){return this._ua;},t.test=function(e){return e.test(this._ua);},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=o.default.find(n.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser;},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser();},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||"";},t.getBrowserVersion=function(){return this.getBrowser().version;},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS();},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os;},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||"";},t.getOSVersion=function(){return this.getOS().version;},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform();},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||"";},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=o.default.find(s.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform;},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine();},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||"";},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=o.default.find(a.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t);});throw new Error("Browser's test function is not valid");});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine;},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this;},t.getResult=function(){return o.default.assign({},this.parsedResult);},t.satisfies=function(e){var t=this,r={},n=0,i={},s=0;if(Object.keys(e).forEach(function(t){var a=e[t];"string"==typeof a?(i[t]=a,s+=1):"object"==typeof a&&(r[t]=a,n+=1);}),n>0){var a=Object.keys(r),u=o.default.find(a,function(e){return t.isOS(e);});if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d;}var c=o.default.find(a,function(e){return t.isPlatform(e);});if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f;}}if(s>0){var l=Object.keys(i),h=o.default.find(l,function(e){return t.isBrowser(e,!0);});if(void 0!==h)return this.compareVersion(i[h]);}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r;},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();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;},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase();},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase();},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase();},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e);},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e);});},e;}();t.default=d,e.exports=t.default;},92:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n};var s=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function describe(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/opera/i],describe:function describe(e){var t={name:"Opera"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/opr\/|opios/i],describe:function describe(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/SamsungBrowser/i],describe:function describe(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/Whale/i],describe:function describe(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/MZBrowser/i],describe:function describe(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/focus/i],describe:function describe(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/swing/i],describe:function describe(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/coast/i],describe:function describe(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function describe(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/yabrowser/i],describe:function describe(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/ucbrowser/i],describe:function describe(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/Maxthon|mxios/i],describe:function describe(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/epiphany/i],describe:function describe(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/puffin/i],describe:function describe(e){var t={name:"Puffin"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/sleipnir/i],describe:function describe(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/k-meleon/i],describe:function describe(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/micromessenger/i],describe:function describe(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/qqbrowser/i],describe:function describe(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/msie|trident/i],describe:function describe(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/\sedg\//i],describe:function describe(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/edg([ea]|ios)/i],describe:function describe(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/vivaldi/i],describe:function describe(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/seamonkey/i],describe:function describe(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/sailfish/i],describe:function describe(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t;}},{test:[/silk/i],describe:function describe(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/phantom/i],describe:function describe(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/slimerjs/i],describe:function describe(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function describe(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/(web|hpw)[o0]s/i],describe:function describe(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/bada/i],describe:function describe(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/tizen/i],describe:function describe(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/qupzilla/i],describe:function describe(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/firefox|iceweasel|fxios/i],describe:function describe(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/electron/i],describe:function describe(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/MiuiBrowser/i],describe:function describe(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/chromium/i],describe:function describe(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/chrome|crios|crmo/i],describe:function describe(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/GSA/i],describe:function describe(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:function test(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r;},describe:function describe(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/playstation 4/i],describe:function describe(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/safari|applewebkit/i],describe:function describe(e){var t={name:"Safari"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t;}},{test:[/.*/i],describe:function describe(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return {name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)};}}];t.default=a,e.exports=t.default;},93:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/Roku\/DVP/],describe:function describe(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return {name:s.OS_MAP.Roku,version:t};}},{test:[/windows phone/i],describe:function describe(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.WindowsPhone,version:t};}},{test:[/windows /i],describe:function describe(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return {name:s.OS_MAP.Windows,version:t,versionName:r};}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function describe(e){var t={name:s.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t;}},{test:[/macintosh/i],describe:function describe(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:s.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n;}},{test:[/(ipod|iphone|ipad)/i],describe:function describe(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return {name:s.OS_MAP.iOS,version:t};}},{test:function test(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r;},describe:function describe(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:s.OS_MAP.Android,version:t};return r&&(n.versionName=r),n;}},{test:[/(web|hpw)[o0]s/i],describe:function describe(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:s.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r;}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function describe(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return {name:s.OS_MAP.BlackBerry,version:t};}},{test:[/bada/i],describe:function describe(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.Bada,version:t};}},{test:[/tizen/i],describe:function describe(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.Tizen,version:t};}},{test:[/linux/i],describe:function describe(){return {name:s.OS_MAP.Linux};}},{test:[/CrOS/],describe:function describe(){return {name:s.OS_MAP.ChromeOS};}},{test:[/PlayStation 4/],describe:function describe(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return {name:s.OS_MAP.PlayStation4,version:t};}}];t.default=a,e.exports=t.default;},94:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/googlebot/i],describe:function describe(){return {type:"bot",vendor:"Google"};}},{test:[/huawei/i],describe:function describe(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r;}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"};}},{test:[/ipad/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"};}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"};}},{test:[/kftt build/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"};}},{test:[/silk/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"};}},{test:[/tablet(?! pc)/i],describe:function describe(){return {type:s.PLATFORMS_MAP.tablet};}},{test:function test(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r;},describe:function describe(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return {type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t};}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function describe(){return {type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"};}},{test:[/[^-]mobi/i],describe:function describe(){return {type:s.PLATFORMS_MAP.mobile};}},{test:function test(e){return "blackberry"===e.getBrowserName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"};}},{test:function test(e){return "bada"===e.getBrowserName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile};}},{test:function test(e){return "windows phone"===e.getBrowserName();},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"};}},{test:function test(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return "android"===e.getOSName(!0)&&t>=3;},describe:function describe(){return {type:s.PLATFORMS_MAP.tablet};}},{test:function test(e){return "android"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.mobile};}},{test:function test(e){return "macos"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.desktop,vendor:"Apple"};}},{test:function test(e){return "windows"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.desktop};}},{test:function test(e){return "linux"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.desktop};}},{test:function test(e){return "playstation 4"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.tv};}},{test:function test(e){return "roku"===e.getOSName(!0);},describe:function describe(){return {type:s.PLATFORMS_MAP.tv};}}];t.default=a,e.exports=t.default;},95:function _(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:function test(e){return "microsoft edge"===e.getBrowserName(!0);},describe:function describe(e){if(/\sedg\//i.test(e))return {name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return {name:s.ENGINE_MAP.EdgeHTML,version:t};}},{test:[/trident/i],describe:function describe(e){var t={name:s.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:function test(e){return e.test(/presto/i);},describe:function describe(e){var t={name:s.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:function test(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r;},describe:function describe(e){var t={name:s.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}},{test:[/(apple)?webkit\/537\.36/i],describe:function describe(){return {name:s.ENGINE_MAP.Blink};}},{test:[/(apple)?webkit/i],describe:function describe(e){var t={name:s.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t;}}];t.default=a,e.exports=t.default;}});});})(es5);var Bowser=/*@__PURE__*/getDefaultExportFromCjs(es5.exports);var BrowserName;(function(BrowserName){BrowserName["CHROME"]="Chrome";BrowserName["FIREFOX"]="Firefox";BrowserName["EDGE"]="Microsoft Edge";BrowserName["SAFARI"]="Safari";})(BrowserName||(BrowserName={}));class BrowserInfo{static getBrowserDetails(){return this.browser.getBrowser();}static getOSDetails(){return this.browser.getOS();}static getPlatformDetails(){return this.browser.getPlatform();}static getEngineDetails(){return this.browser.getEngine();}static isChrome(){return this.browser.getBrowserName()===BrowserName.CHROME;}static isFirefox(){return this.browser.getBrowserName()===BrowserName.FIREFOX;}static isEdge(){return this.browser.getBrowserName()===BrowserName.EDGE;}static isSafari(){return this.browser.getBrowserName()===BrowserName.SAFARI;}static isVersionGreaterThan(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:">".concat(version)};return this.browser.satisfies(checkTree);}static isVersionGreaterThanOrEqualTo(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:">=".concat(version)};return this.browser.satisfies(checkTree);}static isVersionLessThan(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:"<".concat(version)};return this.browser.satisfies(checkTree);}static isVersionLessThanOrEqualTo(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:"<=".concat(version)};return this.browser.satisfies(checkTree);}static isSubVersionOf(version){var browserName=this.browser.getBrowserName();var checkTree={[browserName]:"~".concat(version)};return this.browser.satisfies(checkTree);}}BrowserInfo.browser=Bowser.getParser(window.navigator.userAgent);var CapabilityState;(function(CapabilityState){CapabilityState["NOT_CAPABLE"]="not capable";CapabilityState["CAPABLE"]="capable";CapabilityState["UNKNOWN"]="unknown";})(CapabilityState||(CapabilityState={}));var simulcastMaxFrameSizes={0:'240',1:'2304',2:'8160'};class JmpLine extends Line$1{constructor(versions){super();this.versions=versions;}static fromSdpLine(line){if(!JmpLine.regex.test(line)){return undefined;}var tokens=line.match(JmpLine.regex);var versions=tokens[1].split(',').filter(v=>v.length);return new JmpLine(versions);}toSdpLine(){return "a=jmp:".concat(this.versions.join(','));}}JmpLine.regex=/^jmp:((?:v\d+,?)+)/;class JmpStreamIdModeLine extends Line$1{constructor(streamIdMode){super();this.streamIdMode=streamIdMode;}static fromSdpLine(line){if(!JmpStreamIdModeLine.regex.test(line)){return undefined;}var tokens=line.match(JmpStreamIdModeLine.regex);var mode=tokens[1];return new JmpStreamIdModeLine(mode);}toSdpLine(){return "a=jmp-stream-id-mode:".concat(this.streamIdMode);}}JmpStreamIdModeLine.regex=/^jmp-stream-id-mode:(MID-RID|SSRC)$/;class JmpSourceLine extends Line$1{constructor(source,csi){super();this.source=source;this.csi=csi;}static fromSdpLine(line){if(!JmpSourceLine.regex.test(line)){return undefined;}var tokens=line.match(JmpSourceLine.regex);var source=tokens[1];var csi=tokens[2];return new JmpSourceLine(source,csi);}toSdpLine(){var line="a=jmp-source:".concat(this.source);if(this.csi){line+=" csi=".concat(this.csi);}return line;}}JmpSourceLine.regex=new RegExp("^jmp-source:(".concat(ANY_NON_WS$1,") (?:csi=(").concat(ANY_NON_WS$1,"))"));DefaultSdpGrammar$1.addParser('a',JmpLine.fromSdpLine);DefaultSdpGrammar$1.addParser('a',JmpSourceLine.fromSdpLine);DefaultSdpGrammar$1.addParser('a',JmpStreamIdModeLine.fromSdpLine);function deepCopy(source){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)=>{Object.defineProperty(o,prop,Object.getOwnPropertyDescriptor(source,prop));o[prop]=deepCopy(source[prop]);return o;},Object.create(Object.getPrototypeOf(source))):source;}var ipv4Regex=/(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.)(\d{1,3}\b)/g;var ipv6Regex=/(\b[\da-fA-F]{1,4}(:[\da-fA-F]{1,4}){7}\b)/g;function matchMediaDescriptionsInAnswer(parsedOffer,parsedAnswer){parsedAnswer.session.groups=parsedOffer.session.groups;parsedAnswer.media=parsedOffer.media.map(offerMediaDescription=>{if(!offerMediaDescription.mid){logErrorAndThrow(WcmeErrorType.OFFER_ANSWER_MISMATCH,"Named media groups can only be set for audio.");}var answerMediaDescription=parsedAnswer.media.find(m=>m.mid===offerMediaDescription.mid);if(answerMediaDescription){return answerMediaDescription;}if(!(offerMediaDescription instanceof AvMediaDescription$1)){logErrorAndThrow(WcmeErrorType.OFFER_ANSWER_MISMATCH,"Answer is missing a non-AV media description for MID ".concat(offerMediaDescription.mid,"."));}var startingMediaDescription=parsedAnswer.avMedia.find(m=>m.type===offerMediaDescription.type);if(!startingMediaDescription){logErrorAndThrow(WcmeErrorType.OFFER_ANSWER_MISMATCH,"Answer has no media description of type ".concat(offerMediaDescription.type,", can't generate synthetic answer media description for MID ").concat(offerMediaDescription.mid,"."));}var fakeCorrespondingDescription=deepCopy(startingMediaDescription);fakeCorrespondingDescription.mid=offerMediaDescription.mid;fakeCorrespondingDescription.simulcast=undefined;fakeCorrespondingDescription.bandwidth=undefined;if(offerMediaDescription.direction==='sendrecv'||offerMediaDescription.direction==='sendonly'){fakeCorrespondingDescription.direction='recvonly';}if(offerMediaDescription.direction==='recvonly'){fakeCorrespondingDescription.direction='sendonly';}return fakeCorrespondingDescription;});}function setupBundle(parsedSdp,bundlePolicy,midMap){if(bundlePolicy==='max-compat'){var audioMainMids=midMap.get(MediaType.AudioMain);var videoMainMids=midMap.get(MediaType.VideoMain);var audioContentMids=midMap.get(MediaType.AudioSlides);var videoContentMids=midMap.get(MediaType.VideoSlides);parsedSdp.session.groups.splice(0,parsedSdp.session.groups.length);if(audioMainMids){parsedSdp.session.groups.push(new BundleGroupLine$1(audioMainMids));}if(videoMainMids){parsedSdp.session.groups.push(new BundleGroupLine$1(videoMainMids));}if(audioContentMids){parsedSdp.session.groups.push(new BundleGroupLine$1(audioContentMids));}if(videoContentMids){parsedSdp.session.groups.push(new BundleGroupLine$1(videoContentMids));}}}function filterRecvOnlyMediaDescriptions(parsedSdp){var filteredMids=[];parsedSdp.media=parsedSdp.media.filter(media=>{if(media instanceof ApplicationMediaDescription$1||media instanceof AvMediaDescription$1&&media.direction!=='recvonly'){filteredMids.push(media.mid);return true;}return false;});parsedSdp.session.groups.forEach(g=>{g.mids=g.mids.filter(m=>filteredMids.includes(m));});}function injectContentType(mediaDescription,mediaContent){if(mediaContent===MediaContent.Slides){mediaDescription.addLine(new ContentLine$1(['slides']));}}function injectJmpAttributes(mediaDescription,csi,streamSignalingMode){if(!mediaDescription.otherLines.find(line=>line instanceof JmpLine)){mediaDescription.addLine(new JmpLine(['v1']));}if(!mediaDescription.otherLines.find(line=>line instanceof JmpSourceLine)){mediaDescription.addLine(new JmpSourceLine(mediaDescription.mid,csi.toString()));}if(!mediaDescription.otherLines.find(line=>line instanceof JmpStreamIdModeLine)){mediaDescription.addLine(new JmpStreamIdModeLine(streamSignalingMode));}}function injectDummyCandidates(mediaDescription){mediaDescription.iceInfo.candidates=[];mediaDescription.addLine(new CandidateLine$1('dummy1',1,'udp',3,'0.0.0.0',9,'host'));mediaDescription.addLine(new CandidateLine$1('dummy2',1,'tcp',2,'0.0.0.0',9,'host'));mediaDescription.addLine(new CandidateLine$1('dummy3',1,'udp',1,'0.0.0.0',9,'relay'));}function maskIp(sdp){var maskedSdp=sdp.replace(ipv4Regex,(match,firstOctets)=>{return "".concat(firstOctets,"0");});maskedSdp=maskedSdp.replace(ipv6Regex,match=>{return match.replace(/:[\da-fA-F]{1,4}$/,':0');});return maskedSdp;}function removeMidRidExtensions(mediaDescription){mediaDescription.extMaps.forEach((extMapLine,extId,extMap)=>{if(/^urn:ietf:params:rtp-hdrext:sdes:(?:mid|rtp-stream-id|repaired-rtp-stream-id)$/.test(extMapLine.uri)){extMap.delete(extId);}});}function addVlaExtension(mediaDescription){var vlaExtensionUri='http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00';if(![...mediaDescription.extMaps.values()].some(extMapLine=>extMapLine.uri===vlaExtensionUri)){mediaDescription.addExtension({uri:vlaExtensionUri});}}function applyFormatParameters(mediaDescription,paramsMap){paramsMap.forEach((value,param)=>{[...mediaDescription.codecs.values()].filter(ci=>ci.name==='H264'||ci.name==='opus').forEach(ci=>{if(value===null){ci.fmtParams.delete(param);}else {ci.fmtParams.set(param,"".concat(value));}});});}function generateSsrc(){return Math.floor(Math.random()*0xffffffff)+1;}class EgressSdpMunger{constructor(){this.streamIds=[];this.customCodecParameters=new Map();}reset(){this.streamIds=[];}mungeLocalDescription(mediaDescription,options){var _a;retainCodecs(mediaDescription,['h264','opus','rtx']);if(mediaDescription.codecs.size===0){logErrorAndThrow(WcmeErrorType.SDP_MUNGE_MISSING_CODECS,"No codecs present in m-line with MID ".concat(mediaDescription.mid," after filtering."));}mediaDescription.rids=[];mediaDescription.simulcast=undefined;removeMidRidExtensions(mediaDescription);if(options.simulcastEnabled){addVlaExtension(mediaDescription);}var numStreams=options.simulcastEnabled?3:1;if(!this.streamIds.length){if(mediaDescription.ssrcs.length){var ssrcs=[...new Set(mediaDescription.ssrcs.map(ssrcLine=>ssrcLine.ssrcId))];mediaDescription.ssrcGroups.forEach(sg=>{if(!sg.ssrcs.every(ssrc=>ssrcs.includes(ssrc))){logErrorAndThrow(WcmeErrorType.SDP_MUNGE_FAILED,'SSRC present in SSRC groups is missing from SSRC lines.');}});var rtxSsrcGroups=mediaDescription.ssrcGroups.filter(sg=>sg.semantics==='FID');if(rtxSsrcGroups.length&&rtxSsrcGroups.length!==numStreams){logErrorAndThrow(WcmeErrorType.SDP_MUNGE_FAILED,"Expected ".concat(numStreams," RTX SSRC groups, got ").concat(rtxSsrcGroups.length,"."));}rtxSsrcGroups.forEach(sg=>{this.streamIds.push({ssrc:sg.ssrcs[0],rtxSsrc:sg.ssrcs[1]});});var simulcastSsrcs=(_a=mediaDescription.ssrcGroups.find(sg=>sg.semantics==='SIM'))===null||_a===void 0?void 0:_a.ssrcs;if(simulcastSsrcs){if(simulcastSsrcs.length!==numStreams||!this.streamIds.every(streamId=>simulcastSsrcs.includes(streamId.ssrc))){logErrorAndThrow(WcmeErrorType.SDP_MUNGE_FAILED,'SSRCs in simulcast SSRC group do not match primary SSRCs in RTX SSRC groups.');}this.streamIds.sort((a,b)=>simulcastSsrcs.indexOf(a.ssrc)-simulcastSsrcs.indexOf(b.ssrc));}else if(rtxSsrcGroups.length>1){logErrorAndThrow(WcmeErrorType.SDP_MUNGE_FAILED,'Multiple RTX SSRC groups but no simulcast SSRC group found.');}if(!this.streamIds.length){this.streamIds.push({ssrc:ssrcs[0]});}}else {[...Array(numStreams).keys()].forEach(()=>{var newStreamId={ssrc:generateSsrc()};if(options.rtxEnabled){newStreamId.rtxSsrc=generateSsrc();}this.streamIds.push(newStreamId);});}}mediaDescription.ssrcs=[];mediaDescription.ssrcGroups=[];this.streamIds.forEach(streamId=>{var rtpSsrc=streamId.ssrc;mediaDescription.addLine(new SsrcLine$1(rtpSsrc,'cname',"".concat(rtpSsrc,"-cname")));mediaDescription.addLine(new SsrcLine$1(rtpSsrc,'msid','-',"".concat(mediaDescription.mid)));if(options.rtxEnabled){var rtxSsrc=streamId.rtxSsrc;mediaDescription.addLine(new SsrcLine$1(rtxSsrc,'cname',"".concat(rtpSsrc,"-cname")));mediaDescription.addLine(new SsrcLine$1(rtxSsrc,'msid','-',"".concat(mediaDescription.mid)));mediaDescription.addLine(new SsrcGroupLine$1('FID',[rtpSsrc,rtxSsrc]));}});if(options.simulcastEnabled){mediaDescription.addLine(new SsrcGroupLine$1('SIM',this.streamIds.map(streamId=>streamId.ssrc)));}applyFormatParameters(mediaDescription,this.customCodecParameters);if(options.twccDisabled){disableTwcc(mediaDescription);}}mungeLocalDescriptionForRemoteServer(mediaDescription,mediaContent,csi){injectContentType(mediaDescription,mediaContent);injectJmpAttributes(mediaDescription,csi,'SSRC');injectDummyCandidates(mediaDescription);if(mediaDescription.type==='video'){var ssrcGroup=mediaDescription.ssrcGroups.find(sg=>sg.semantics==='SIM');if(ssrcGroup){ssrcGroup.ssrcs.forEach((ssrc,index)=>{mediaDescription.addLine(new SsrcLine$1(ssrc,'fmtp',"* max-fs=".concat(simulcastMaxFrameSizes[index])));});}}}mungeRemoteDescription(mediaDescription){if(retainCandidates(mediaDescription,['udp','tcp'])){logger.log("Some unsupported remote candidates have been removed from mid ".concat(mediaDescription.mid));}mediaDescription.bandwidth=undefined;[...mediaDescription.codecs.values()].forEach(ci=>{ci.fmtParams.set('x-google-start-bitrate','60000');});}getSenderIds(){return this.streamIds;}getEncodingIndexForStreamId(streamId){return this.streamIds.findIndex(currStreamId=>compareStreamIds(currStreamId,streamId));}setCodecParameters(parameters){Object.entries(parameters).forEach(_ref4=>{var[param,value]=_ref4;this.customCodecParameters.set(param,value);});}deleteCodecParameters(parameters){parameters.forEach(param=>{this.customCodecParameters.set(param,null);});}}var events$1={exports:{}};var R$1=typeof Reflect==='object'?Reflect:null;var ReflectApply$1=R$1&&typeof R$1.apply==='function'?R$1.apply:function ReflectApply(target,receiver,args){return Function.prototype.apply.call(target,receiver,args);};var ReflectOwnKeys$1;if(R$1&&typeof R$1.ownKeys==='function'){ReflectOwnKeys$1=R$1.ownKeys;}else if(Object.getOwnPropertySymbols){ReflectOwnKeys$1=function ReflectOwnKeys(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));};}else {ReflectOwnKeys$1=function ReflectOwnKeys(target){return Object.getOwnPropertyNames(target);};}function ProcessEmitWarning$1(warning){if(console&&console.warn)console.warn(warning);}var NumberIsNaN$1=Number.isNaN||function NumberIsNaN(value){return value!==value;};function EventEmitter$3(){EventEmitter$3.init.call(this);}events$1.exports=EventEmitter$3;events$1.exports.once=once$2;// Backwards-compat with node 0.10.x
2862
2863
  EventEmitter$3.EventEmitter=EventEmitter$3;EventEmitter$3.prototype._events=undefined;EventEmitter$3.prototype._eventsCount=0;EventEmitter$3.prototype._maxListeners=undefined;// By default EventEmitters will print a warning if more than 10 listeners are
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/internal-media-core",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "files": [
5
5
  "dist/cjs",
6
6
  "dist/esm",
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@babel/runtime": "^7.18.9",
48
48
  "@webex/ts-sdp": "1.6.0",
49
- "@webex/web-client-media-engine": "3.20.3",
49
+ "@webex/web-client-media-engine": "3.20.4",
50
50
  "events": "^3.3.0",
51
51
  "typed-emitter": "^2.1.0",
52
52
  "uuid": "^8.3.2",