@flashphoner/websdk 2.0.218 → 2.0.219

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.
@@ -17,7 +17,7 @@
17
17
  * @license MIT License
18
18
  * @preserve
19
19
  */
20
- var KalmanFilter=function(){function KalmanFilter(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},_ref$R=_ref.R,R=void 0===_ref$R?1:_ref$R,_ref$Q=_ref.Q,Q=void 0===_ref$Q?1:_ref$Q,_ref$A=_ref.A,A=void 0===_ref$A?1:_ref$A,_ref$B=_ref.B,B=void 0===_ref$B?0:_ref$B,_ref$C=_ref.C,C=void 0===_ref$C?1:_ref$C;_classCallCheck(this,KalmanFilter),this.R=R,this.Q=Q,this.A=A,this.C=C,this.B=B,this.cov=NaN,this.x=NaN}var Constructor,protoProps,staticProps;return Constructor=KalmanFilter,(protoProps=[{key:"filter",value:function(z){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(isNaN(this.x))this.x=1/this.C*z,this.cov=1/this.C*this.Q*(1/this.C);else{var predX=this.predict(u),predCov=this.uncertainty(),K=predCov*this.C*(1/(this.C*predCov*this.C+this.Q));this.x=predX+K*(z-this.C*predX),this.cov=predCov-K*this.C*predCov}return this.x}},{key:"predict",value:function(){var u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.A*this.x+this.B*u}},{key:"uncertainty",value:function(){return this.A*this.cov*this.A+this.R}},{key:"lastMeasurement",value:function(){return this.x}},{key:"setMeasurementNoise",value:function(noise){this.Q=noise}},{key:"setProcessNoise",value:function(noise){this.R=noise}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),KalmanFilter}();module.exports=KalmanFilter},{}],3:[function(require,module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],4:[function(require,module,exports){(function(setImmediate){(function(){!function(root){var setTimeoutFunc=setTimeout;function noop(){}function Promise(fn){if(!(this instanceof Promise))throw new TypeError("Promises must be constructed via new");if("function"!=typeof fn)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],doResolve(fn,this)}function handle(self,deferred){for(;3===self._state;)self=self._value;0!==self._state?(self._handled=!0,Promise._immediateFn((function(){var cb=1===self._state?deferred.onFulfilled:deferred.onRejected;if(null!==cb){var ret;try{ret=cb(self._value)}catch(e){return void reject(deferred.promise,e)}resolve(deferred.promise,ret)}else(1===self._state?resolve:reject)(deferred.promise,self._value)}))):self._deferreds.push(deferred)}function resolve(self,newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&("object"==typeof newValue||"function"==typeof newValue)){var then=newValue.then;if(newValue instanceof Promise)return self._state=3,self._value=newValue,void finale(self);if("function"==typeof then)return void doResolve((fn=then,thisArg=newValue,function(){fn.apply(thisArg,arguments)}),self)}self._state=1,self._value=newValue,finale(self)}catch(e){reject(self,e)}var fn,thisArg}function reject(self,newValue){self._state=2,self._value=newValue,finale(self)}function finale(self){2===self._state&&0===self._deferreds.length&&Promise._immediateFn((function(){self._handled||Promise._unhandledRejectionFn(self._value)}));for(var i=0,len=self._deferreds.length;i<len;i++)handle(self,self._deferreds[i]);self._deferreds=null}function Handler(onFulfilled,onRejected,promise){this.onFulfilled="function"==typeof onFulfilled?onFulfilled:null,this.onRejected="function"==typeof onRejected?onRejected:null,this.promise=promise}function doResolve(fn,self){var done=!1;try{fn((function(value){done||(done=!0,resolve(self,value))}),(function(reason){done||(done=!0,reject(self,reason))}))}catch(ex){if(done)return;done=!0,reject(self,ex)}}Promise.prototype.catch=function(onRejected){return this.then(null,onRejected)},Promise.prototype.then=function(onFulfilled,onRejected){var prom=new this.constructor(noop);return handle(this,new Handler(onFulfilled,onRejected,prom)),prom},Promise.all=function(arr){return new Promise((function(resolve,reject){if(!arr||"undefined"==typeof arr.length)throw new TypeError("Promise.all accepts an array");var args=Array.prototype.slice.call(arr);if(0===args.length)return resolve([]);var remaining=args.length;function res(i,val){try{if(val&&("object"==typeof val||"function"==typeof val)){var then=val.then;if("function"==typeof then)return void then.call(val,(function(val){res(i,val)}),reject)}args[i]=val,0==--remaining&&resolve(args)}catch(ex){reject(ex)}}for(var i=0;i<args.length;i++)res(i,args[i])}))},Promise.resolve=function(value){return value&&"object"==typeof value&&value.constructor===Promise?value:new Promise((function(resolve){resolve(value)}))},Promise.reject=function(value){return new Promise((function(resolve,reject){reject(value)}))},Promise.race=function(values){return new Promise((function(resolve,reject){for(var i=0,len=values.length;i<len;i++)values[i].then(resolve,reject)}))},Promise._immediateFn="function"==typeof setImmediate&&function(fn){setImmediate(fn)}||function(fn){setTimeoutFunc(fn,0)},Promise._unhandledRejectionFn=function(err){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",err)},Promise._setImmediateFn=function(fn){Promise._immediateFn=fn},Promise._setUnhandledRejectionFn=function(fn){Promise._unhandledRejectionFn=fn},"undefined"!=typeof module&&module.exports?module.exports=Promise:root.Promise||(root.Promise=Promise)}(this)}).call(this)}).call(this,require("timers").setImmediate)},{timers:8}],5:[function(require,module,exports){"use strict";var SDPUtils=require("sdp");function writeMediaSection(transceiver,caps,type,stream,dtlsRole){var sdp=SDPUtils.writeRtpDescription(transceiver.kind,caps);if(sdp+=SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters()),sdp+=SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(),"offer"===type?"actpass":dtlsRole||"active"),sdp+="a=mid:"+transceiver.mid+"\r\n",transceiver.rtpSender&&transceiver.rtpReceiver?sdp+="a=sendrecv\r\n":transceiver.rtpSender?sdp+="a=sendonly\r\n":transceiver.rtpReceiver?sdp+="a=recvonly\r\n":sdp+="a=inactive\r\n",transceiver.rtpSender){var trackId=transceiver.rtpSender._initialTrackId||transceiver.rtpSender.track.id;transceiver.rtpSender._initialTrackId=trackId;var msid="msid:"+(stream?stream.id:"-")+" "+trackId+"\r\n";sdp+="a="+msid,sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" "+msid,transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" "+msid,sdp+="a=ssrc-group:FID "+transceiver.sendEncodingParameters[0].ssrc+" "+transceiver.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" cname:"+SDPUtils.localCName+"\r\n",transceiver.rtpSender&&transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" cname:"+SDPUtils.localCName+"\r\n"),sdp}function getCommonCapabilities(localCapabilities,remoteCapabilities){var commonCapabilities={codecs:[],headerExtensions:[],fecMechanisms:[]},findCodecByPayloadType=function(pt,codecs){pt=parseInt(pt,10);for(var i=0;i<codecs.length;i++)if(codecs[i].payloadType===pt||codecs[i].preferredPayloadType===pt)return codecs[i]},rtxCapabilityMatches=function(lRtx,rRtx,lCodecs,rCodecs){var lCodec=findCodecByPayloadType(lRtx.parameters.apt,lCodecs),rCodec=findCodecByPayloadType(rRtx.parameters.apt,rCodecs);return lCodec&&rCodec&&lCodec.name.toLowerCase()===rCodec.name.toLowerCase()};return localCapabilities.codecs.forEach((function(lCodec){for(var i=0;i<remoteCapabilities.codecs.length;i++){var rCodec=remoteCapabilities.codecs[i];if(lCodec.name.toLowerCase()===rCodec.name.toLowerCase()&&lCodec.clockRate===rCodec.clockRate){if("rtx"===lCodec.name.toLowerCase()&&lCodec.parameters&&rCodec.parameters.apt&&!rtxCapabilityMatches(lCodec,rCodec,localCapabilities.codecs,remoteCapabilities.codecs))continue;(rCodec=JSON.parse(JSON.stringify(rCodec))).numChannels=Math.min(lCodec.numChannels,rCodec.numChannels),commonCapabilities.codecs.push(rCodec),rCodec.rtcpFeedback=rCodec.rtcpFeedback.filter((function(fb){for(var j=0;j<lCodec.rtcpFeedback.length;j++)if(lCodec.rtcpFeedback[j].type===fb.type&&lCodec.rtcpFeedback[j].parameter===fb.parameter)return!0;return!1}));break}}})),localCapabilities.headerExtensions.forEach((function(lHeaderExtension){for(var i=0;i<remoteCapabilities.headerExtensions.length;i++){var rHeaderExtension=remoteCapabilities.headerExtensions[i];if(lHeaderExtension.uri===rHeaderExtension.uri){commonCapabilities.headerExtensions.push(rHeaderExtension);break}}})),commonCapabilities}function isActionAllowedInSignalingState(action,type,signalingState){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[type][action].indexOf(signalingState)}function maybeAddCandidate(iceTransport,candidate){var alreadyAdded=iceTransport.getRemoteCandidates().find((function(remoteCandidate){return candidate.foundation===remoteCandidate.foundation&&candidate.ip===remoteCandidate.ip&&candidate.port===remoteCandidate.port&&candidate.priority===remoteCandidate.priority&&candidate.protocol===remoteCandidate.protocol&&candidate.type===remoteCandidate.type}));return alreadyAdded||iceTransport.addRemoteCandidate(candidate),!alreadyAdded}function makeError(name,description){var e=new Error(description);return e.name=name,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[name],e}module.exports=function(window,edgeVersion){function addTrackToStreamAndFireEvent(track,stream){stream.addTrack(track),stream.dispatchEvent(new window.MediaStreamTrackEvent("addtrack",{track:track}))}function fireAddTrack(pc,track,receiver,streams){var trackEvent=new Event("track");trackEvent.track=track,trackEvent.receiver=receiver,trackEvent.transceiver={receiver:receiver},trackEvent.streams=streams,window.setTimeout((function(){pc._dispatchEvent("track",trackEvent)}))}var RTCPeerConnection=function(config){var pc=this,_eventTarget=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(method){pc[method]=_eventTarget[method].bind(_eventTarget)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",config=JSON.parse(JSON.stringify(config||{})),this.usingBundle="max-bundle"===config.bundlePolicy,"negotiate"===config.rtcpMuxPolicy)throw makeError("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(config.rtcpMuxPolicy||(config.rtcpMuxPolicy="require"),config.iceTransportPolicy){case"all":case"relay":break;default:config.iceTransportPolicy="all"}switch(config.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:config.bundlePolicy="balanced"}if(config.iceServers=function(iceServers,edgeVersion){var hasTurn=!1;return(iceServers=JSON.parse(JSON.stringify(iceServers))).filter((function(server){if(server&&(server.urls||server.url)){var urls=server.urls||server.url;server.url&&!server.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var isString="string"==typeof urls;return isString&&(urls=[urls]),urls=urls.filter((function(url){return 0===url.indexOf("turn:")&&-1!==url.indexOf("transport=udp")&&-1===url.indexOf("turn:[")&&!hasTurn?(hasTurn=!0,!0):0===url.indexOf("stun:")&&edgeVersion>=14393&&-1===url.indexOf("?transport=udp")})),delete server.url,server.urls=isString?urls[0]:urls,!!urls.length}}))}(config.iceServers||[],edgeVersion),this._iceGatherers=[],config.iceCandidatePoolSize)for(var i=config.iceCandidatePoolSize;i>0;i--)this._iceGatherers.push(new window.RTCIceGatherer({iceServers:config.iceServers,gatherPolicy:config.iceTransportPolicy}));else config.iceCandidatePoolSize=0;this._config=config,this.transceivers=[],this._sdpSessionId=SDPUtils.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(RTCPeerConnection.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(RTCPeerConnection.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),RTCPeerConnection.prototype.onicecandidate=null,RTCPeerConnection.prototype.onaddstream=null,RTCPeerConnection.prototype.ontrack=null,RTCPeerConnection.prototype.onremovestream=null,RTCPeerConnection.prototype.onsignalingstatechange=null,RTCPeerConnection.prototype.oniceconnectionstatechange=null,RTCPeerConnection.prototype.onconnectionstatechange=null,RTCPeerConnection.prototype.onicegatheringstatechange=null,RTCPeerConnection.prototype.onnegotiationneeded=null,RTCPeerConnection.prototype.ondatachannel=null,RTCPeerConnection.prototype._dispatchEvent=function(name,event){this._isClosed||(this.dispatchEvent(event),"function"==typeof this["on"+name]&&this["on"+name](event))},RTCPeerConnection.prototype._emitGatheringStateChange=function(){var event=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",event)},RTCPeerConnection.prototype.getConfiguration=function(){return this._config},RTCPeerConnection.prototype.getLocalStreams=function(){return this.localStreams},RTCPeerConnection.prototype.getRemoteStreams=function(){return this.remoteStreams},RTCPeerConnection.prototype._createTransceiver=function(kind,doNotAdd){var hasBundleTransport=this.transceivers.length>0,transceiver={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:kind,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&hasBundleTransport)transceiver.iceTransport=this.transceivers[0].iceTransport,transceiver.dtlsTransport=this.transceivers[0].dtlsTransport;else{var transports=this._createIceAndDtlsTransports();transceiver.iceTransport=transports.iceTransport,transceiver.dtlsTransport=transports.dtlsTransport}return doNotAdd||this.transceivers.push(transceiver),transceiver},RTCPeerConnection.prototype.addTrack=function(track,stream){if(this._isClosed)throw makeError("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var transceiver;if(this.transceivers.find((function(s){return s.track===track})))throw makeError("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==track.kind||(transceiver=this.transceivers[i]);return transceiver||(transceiver=this._createTransceiver(track.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(stream)&&this.localStreams.push(stream),transceiver.track=track,transceiver.stream=stream,transceiver.rtpSender=new window.RTCRtpSender(track,transceiver.dtlsTransport),transceiver.rtpSender},RTCPeerConnection.prototype.addStream=function(stream){var pc=this;if(edgeVersion>=15025)stream.getTracks().forEach((function(track){pc.addTrack(track,stream)}));else{var clonedStream=stream.clone();stream.getTracks().forEach((function(track,idx){var clonedTrack=clonedStream.getTracks()[idx];track.addEventListener("enabled",(function(event){clonedTrack.enabled=event.enabled}))})),clonedStream.getTracks().forEach((function(track){pc.addTrack(track,clonedStream)}))}},RTCPeerConnection.prototype.removeTrack=function(sender){if(this._isClosed)throw makeError("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(sender instanceof window.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var transceiver=this.transceivers.find((function(t){return t.rtpSender===sender}));if(!transceiver)throw makeError("InvalidAccessError","Sender was not created by this connection.");var stream=transceiver.stream;transceiver.rtpSender.stop(),transceiver.rtpSender=null,transceiver.track=null,transceiver.stream=null,-1===this.transceivers.map((function(t){return t.stream})).indexOf(stream)&&this.localStreams.indexOf(stream)>-1&&this.localStreams.splice(this.localStreams.indexOf(stream),1),this._maybeFireNegotiationNeeded()},RTCPeerConnection.prototype.removeStream=function(stream){var pc=this;stream.getTracks().forEach((function(track){var sender=pc.getSenders().find((function(s){return s.track===track}));sender&&pc.removeTrack(sender)}))},RTCPeerConnection.prototype.getSenders=function(){return this.transceivers.filter((function(transceiver){return!!transceiver.rtpSender})).map((function(transceiver){return transceiver.rtpSender}))},RTCPeerConnection.prototype.getReceivers=function(){return this.transceivers.filter((function(transceiver){return!!transceiver.rtpReceiver})).map((function(transceiver){return transceiver.rtpReceiver}))},RTCPeerConnection.prototype._createIceGatherer=function(sdpMLineIndex,usingBundle){var pc=this;if(usingBundle&&sdpMLineIndex>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var iceGatherer=new window.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(iceGatherer,"state",{value:"new",writable:!0}),this.transceivers[sdpMLineIndex].bufferedCandidateEvents=[],this.transceivers[sdpMLineIndex].bufferCandidates=function(event){var end=!event.candidate||0===Object.keys(event.candidate).length;iceGatherer.state=end?"completed":"gathering",null!==pc.transceivers[sdpMLineIndex].bufferedCandidateEvents&&pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event)},iceGatherer.addEventListener("localcandidate",this.transceivers[sdpMLineIndex].bufferCandidates),iceGatherer},RTCPeerConnection.prototype._gather=function(mid,sdpMLineIndex){var pc=this,iceGatherer=this.transceivers[sdpMLineIndex].iceGatherer;if(!iceGatherer.onlocalcandidate){var bufferedCandidateEvents=this.transceivers[sdpMLineIndex].bufferedCandidateEvents;this.transceivers[sdpMLineIndex].bufferedCandidateEvents=null,iceGatherer.removeEventListener("localcandidate",this.transceivers[sdpMLineIndex].bufferCandidates),iceGatherer.onlocalcandidate=function(evt){if(!(pc.usingBundle&&sdpMLineIndex>0)){var event=new Event("icecandidate");event.candidate={sdpMid:mid,sdpMLineIndex:sdpMLineIndex};var cand=evt.candidate,end=!cand||0===Object.keys(cand).length;if(end)"new"!==iceGatherer.state&&"gathering"!==iceGatherer.state||(iceGatherer.state="completed");else{"new"===iceGatherer.state&&(iceGatherer.state="gathering"),cand.component=1,cand.ufrag=iceGatherer.getLocalParameters().usernameFragment;var serializedCandidate=SDPUtils.writeCandidate(cand);event.candidate=Object.assign(event.candidate,SDPUtils.parseCandidate(serializedCandidate)),event.candidate.candidate=serializedCandidate,event.candidate.toJSON=function(){return{candidate:event.candidate.candidate,sdpMid:event.candidate.sdpMid,sdpMLineIndex:event.candidate.sdpMLineIndex,usernameFragment:event.candidate.usernameFragment}}}var sections=SDPUtils.getMediaSections(pc._localDescription.sdp);sections[event.candidate.sdpMLineIndex]+=end?"a=end-of-candidates\r\n":"a="+event.candidate.candidate+"\r\n",pc._localDescription.sdp=SDPUtils.getDescription(pc._localDescription.sdp)+sections.join("");var complete=pc.transceivers.every((function(transceiver){return transceiver.iceGatherer&&"completed"===transceiver.iceGatherer.state}));"gathering"!==pc.iceGatheringState&&(pc.iceGatheringState="gathering",pc._emitGatheringStateChange()),end||pc._dispatchEvent("icecandidate",event),complete&&(pc._dispatchEvent("icecandidate",new Event("icecandidate")),pc.iceGatheringState="complete",pc._emitGatheringStateChange())}},window.setTimeout((function(){bufferedCandidateEvents.forEach((function(e){iceGatherer.onlocalcandidate(e)}))}),0)}},RTCPeerConnection.prototype._createIceAndDtlsTransports=function(){var pc=this,iceTransport=new window.RTCIceTransport(null);iceTransport.onicestatechange=function(){pc._updateIceConnectionState(),pc._updateConnectionState()};var dtlsTransport=new window.RTCDtlsTransport(iceTransport);return dtlsTransport.ondtlsstatechange=function(){pc._updateConnectionState()},dtlsTransport.onerror=function(){Object.defineProperty(dtlsTransport,"state",{value:"failed",writable:!0}),pc._updateConnectionState()},{iceTransport:iceTransport,dtlsTransport:dtlsTransport}},RTCPeerConnection.prototype._disposeIceAndDtlsTransports=function(sdpMLineIndex){var iceGatherer=this.transceivers[sdpMLineIndex].iceGatherer;iceGatherer&&(delete iceGatherer.onlocalcandidate,delete this.transceivers[sdpMLineIndex].iceGatherer);var iceTransport=this.transceivers[sdpMLineIndex].iceTransport;iceTransport&&(delete iceTransport.onicestatechange,delete this.transceivers[sdpMLineIndex].iceTransport);var dtlsTransport=this.transceivers[sdpMLineIndex].dtlsTransport;dtlsTransport&&(delete dtlsTransport.ondtlsstatechange,delete dtlsTransport.onerror,delete this.transceivers[sdpMLineIndex].dtlsTransport)},RTCPeerConnection.prototype._transceive=function(transceiver,send,recv){var params=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);send&&transceiver.rtpSender&&(params.encodings=transceiver.sendEncodingParameters,params.rtcp={cname:SDPUtils.localCName,compound:transceiver.rtcpParameters.compound},transceiver.recvEncodingParameters.length&&(params.rtcp.ssrc=transceiver.recvEncodingParameters[0].ssrc),transceiver.rtpSender.send(params)),recv&&transceiver.rtpReceiver&&params.codecs.length>0&&("video"===transceiver.kind&&transceiver.recvEncodingParameters&&edgeVersion<15019&&transceiver.recvEncodingParameters.forEach((function(p){delete p.rtx})),transceiver.recvEncodingParameters.length?params.encodings=transceiver.recvEncodingParameters:params.encodings=[{}],params.rtcp={compound:transceiver.rtcpParameters.compound},transceiver.rtcpParameters.cname&&(params.rtcp.cname=transceiver.rtcpParameters.cname),transceiver.sendEncodingParameters.length&&(params.rtcp.ssrc=transceiver.sendEncodingParameters[0].ssrc),transceiver.rtpReceiver.receive(params))},RTCPeerConnection.prototype.setLocalDescription=function(description){var sections,sessionpart,pc=this;if(-1===["offer","answer"].indexOf(description.type))return Promise.reject(makeError("TypeError",'Unsupported type "'+description.type+'"'));if(!isActionAllowedInSignalingState("setLocalDescription",description.type,pc.signalingState)||pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not set local "+description.type+" in state "+pc.signalingState));if("offer"===description.type)sections=SDPUtils.splitSections(description.sdp),sessionpart=sections.shift(),sections.forEach((function(mediaSection,sdpMLineIndex){var caps=SDPUtils.parseRtpParameters(mediaSection);pc.transceivers[sdpMLineIndex].localCapabilities=caps})),pc.transceivers.forEach((function(transceiver,sdpMLineIndex){pc._gather(transceiver.mid,sdpMLineIndex)}));else if("answer"===description.type){sections=SDPUtils.splitSections(pc._remoteDescription.sdp),sessionpart=sections.shift();var isIceLite=SDPUtils.matchPrefix(sessionpart,"a=ice-lite").length>0;sections.forEach((function(mediaSection,sdpMLineIndex){var transceiver=pc.transceivers[sdpMLineIndex],iceGatherer=transceiver.iceGatherer,iceTransport=transceiver.iceTransport,dtlsTransport=transceiver.dtlsTransport,localCapabilities=transceiver.localCapabilities,remoteCapabilities=transceiver.remoteCapabilities;if(!(SDPUtils.isRejected(mediaSection)&&0===SDPUtils.matchPrefix(mediaSection,"a=bundle-only").length)&&!transceiver.rejected){var remoteIceParameters=SDPUtils.getIceParameters(mediaSection,sessionpart),remoteDtlsParameters=SDPUtils.getDtlsParameters(mediaSection,sessionpart);isIceLite&&(remoteDtlsParameters.role="server"),pc.usingBundle&&0!==sdpMLineIndex||(pc._gather(transceiver.mid,sdpMLineIndex),"new"===iceTransport.state&&iceTransport.start(iceGatherer,remoteIceParameters,isIceLite?"controlling":"controlled"),"new"===dtlsTransport.state&&dtlsTransport.start(remoteDtlsParameters));var params=getCommonCapabilities(localCapabilities,remoteCapabilities);pc._transceive(transceiver,params.codecs.length>0,!1)}}))}return pc._localDescription={type:description.type,sdp:description.sdp},"offer"===description.type?pc._updateSignalingState("have-local-offer"):pc._updateSignalingState("stable"),Promise.resolve()},RTCPeerConnection.prototype.setRemoteDescription=function(description){var pc=this;if(-1===["offer","answer"].indexOf(description.type))return Promise.reject(makeError("TypeError",'Unsupported type "'+description.type+'"'));if(!isActionAllowedInSignalingState("setRemoteDescription",description.type,pc.signalingState)||pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not set remote "+description.type+" in state "+pc.signalingState));var streams={};pc.remoteStreams.forEach((function(stream){streams[stream.id]=stream}));var receiverList=[],sections=SDPUtils.splitSections(description.sdp),sessionpart=sections.shift(),isIceLite=SDPUtils.matchPrefix(sessionpart,"a=ice-lite").length>0,usingBundle=SDPUtils.matchPrefix(sessionpart,"a=group:BUNDLE ").length>0;pc.usingBundle=usingBundle;var iceOptions=SDPUtils.matchPrefix(sessionpart,"a=ice-options:")[0];return pc.canTrickleIceCandidates=!!iceOptions&&iceOptions.substr(14).split(" ").indexOf("trickle")>=0,sections.forEach((function(mediaSection,sdpMLineIndex){var lines=SDPUtils.splitLines(mediaSection),kind=SDPUtils.getKind(mediaSection),rejected=SDPUtils.isRejected(mediaSection)&&0===SDPUtils.matchPrefix(mediaSection,"a=bundle-only").length,protocol=lines[0].substr(2).split(" ")[2],direction=SDPUtils.getDirection(mediaSection,sessionpart),remoteMsid=SDPUtils.parseMsid(mediaSection),mid=SDPUtils.getMid(mediaSection)||SDPUtils.generateIdentifier();if(rejected||"application"===kind&&("DTLS/SCTP"===protocol||"UDP/DTLS/SCTP"===protocol))pc.transceivers[sdpMLineIndex]={mid:mid,kind:kind,protocol:protocol,rejected:!0};else{var transceiver,iceGatherer,iceTransport,dtlsTransport,rtpReceiver,sendEncodingParameters,recvEncodingParameters,localCapabilities,track;!rejected&&pc.transceivers[sdpMLineIndex]&&pc.transceivers[sdpMLineIndex].rejected&&(pc.transceivers[sdpMLineIndex]=pc._createTransceiver(kind,!0));var remoteIceParameters,remoteDtlsParameters,remoteCapabilities=SDPUtils.parseRtpParameters(mediaSection);rejected||(remoteIceParameters=SDPUtils.getIceParameters(mediaSection,sessionpart),(remoteDtlsParameters=SDPUtils.getDtlsParameters(mediaSection,sessionpart)).role="client"),recvEncodingParameters=SDPUtils.parseRtpEncodingParameters(mediaSection);var rtcpParameters=SDPUtils.parseRtcpParameters(mediaSection),isComplete=SDPUtils.matchPrefix(mediaSection,"a=end-of-candidates",sessionpart).length>0,cands=SDPUtils.matchPrefix(mediaSection,"a=candidate:").map((function(cand){return SDPUtils.parseCandidate(cand)})).filter((function(cand){return 1===cand.component}));if(("offer"===description.type||"answer"===description.type)&&!rejected&&usingBundle&&sdpMLineIndex>0&&pc.transceivers[sdpMLineIndex]&&(pc._disposeIceAndDtlsTransports(sdpMLineIndex),pc.transceivers[sdpMLineIndex].iceGatherer=pc.transceivers[0].iceGatherer,pc.transceivers[sdpMLineIndex].iceTransport=pc.transceivers[0].iceTransport,pc.transceivers[sdpMLineIndex].dtlsTransport=pc.transceivers[0].dtlsTransport,pc.transceivers[sdpMLineIndex].rtpSender&&pc.transceivers[sdpMLineIndex].rtpSender.setTransport(pc.transceivers[0].dtlsTransport),pc.transceivers[sdpMLineIndex].rtpReceiver&&pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport(pc.transceivers[0].dtlsTransport)),"offer"!==description.type||rejected){if("answer"===description.type&&!rejected){iceGatherer=(transceiver=pc.transceivers[sdpMLineIndex]).iceGatherer,iceTransport=transceiver.iceTransport,dtlsTransport=transceiver.dtlsTransport,rtpReceiver=transceiver.rtpReceiver,sendEncodingParameters=transceiver.sendEncodingParameters,localCapabilities=transceiver.localCapabilities,pc.transceivers[sdpMLineIndex].recvEncodingParameters=recvEncodingParameters,pc.transceivers[sdpMLineIndex].remoteCapabilities=remoteCapabilities,pc.transceivers[sdpMLineIndex].rtcpParameters=rtcpParameters,cands.length&&"new"===iceTransport.state&&(!isIceLite&&!isComplete||usingBundle&&0!==sdpMLineIndex?cands.forEach((function(candidate){maybeAddCandidate(transceiver.iceTransport,candidate)})):iceTransport.setRemoteCandidates(cands)),usingBundle&&0!==sdpMLineIndex||("new"===iceTransport.state&&iceTransport.start(iceGatherer,remoteIceParameters,"controlling"),"new"===dtlsTransport.state&&dtlsTransport.start(remoteDtlsParameters)),!getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities).codecs.filter((function(c){return"rtx"===c.name.toLowerCase()})).length&&transceiver.sendEncodingParameters[0].rtx&&delete transceiver.sendEncodingParameters[0].rtx,pc._transceive(transceiver,"sendrecv"===direction||"recvonly"===direction,"sendrecv"===direction||"sendonly"===direction),!rtpReceiver||"sendrecv"!==direction&&"sendonly"!==direction?delete transceiver.rtpReceiver:(track=rtpReceiver.track,remoteMsid?(streams[remoteMsid.stream]||(streams[remoteMsid.stream]=new window.MediaStream),addTrackToStreamAndFireEvent(track,streams[remoteMsid.stream]),receiverList.push([track,rtpReceiver,streams[remoteMsid.stream]])):(streams.default||(streams.default=new window.MediaStream),addTrackToStreamAndFireEvent(track,streams.default),receiverList.push([track,rtpReceiver,streams.default])))}}else{(transceiver=pc.transceivers[sdpMLineIndex]||pc._createTransceiver(kind)).mid=mid,transceiver.iceGatherer||(transceiver.iceGatherer=pc._createIceGatherer(sdpMLineIndex,usingBundle)),cands.length&&"new"===transceiver.iceTransport.state&&(!isComplete||usingBundle&&0!==sdpMLineIndex?cands.forEach((function(candidate){maybeAddCandidate(transceiver.iceTransport,candidate)})):transceiver.iceTransport.setRemoteCandidates(cands)),localCapabilities=window.RTCRtpReceiver.getCapabilities(kind),edgeVersion<15019&&(localCapabilities.codecs=localCapabilities.codecs.filter((function(codec){return"rtx"!==codec.name}))),sendEncodingParameters=transceiver.sendEncodingParameters||[{ssrc:1001*(2*sdpMLineIndex+2)}];var stream,isNewTrack=!1;if("sendrecv"===direction||"sendonly"===direction){if(isNewTrack=!transceiver.rtpReceiver,rtpReceiver=transceiver.rtpReceiver||new window.RTCRtpReceiver(transceiver.dtlsTransport,kind),isNewTrack)track=rtpReceiver.track,remoteMsid&&"-"===remoteMsid.stream||(remoteMsid?(streams[remoteMsid.stream]||(streams[remoteMsid.stream]=new window.MediaStream,Object.defineProperty(streams[remoteMsid.stream],"id",{get:function(){return remoteMsid.stream}})),Object.defineProperty(track,"id",{get:function(){return remoteMsid.track}}),stream=streams[remoteMsid.stream]):(streams.default||(streams.default=new window.MediaStream),stream=streams.default)),stream&&(addTrackToStreamAndFireEvent(track,stream),transceiver.associatedRemoteMediaStreams.push(stream)),receiverList.push([track,rtpReceiver,stream])}else transceiver.rtpReceiver&&transceiver.rtpReceiver.track&&(transceiver.associatedRemoteMediaStreams.forEach((function(s){var nativeTrack=s.getTracks().find((function(t){return t.id===transceiver.rtpReceiver.track.id}));nativeTrack&&function(track,stream){stream.removeTrack(track),stream.dispatchEvent(new window.MediaStreamTrackEvent("removetrack",{track:track}))}(nativeTrack,s)})),transceiver.associatedRemoteMediaStreams=[]);transceiver.localCapabilities=localCapabilities,transceiver.remoteCapabilities=remoteCapabilities,transceiver.rtpReceiver=rtpReceiver,transceiver.rtcpParameters=rtcpParameters,transceiver.sendEncodingParameters=sendEncodingParameters,transceiver.recvEncodingParameters=recvEncodingParameters,pc._transceive(pc.transceivers[sdpMLineIndex],!1,isNewTrack)}}})),void 0===pc._dtlsRole&&(pc._dtlsRole="offer"===description.type?"active":"passive"),pc._remoteDescription={type:description.type,sdp:description.sdp},"offer"===description.type?pc._updateSignalingState("have-remote-offer"):pc._updateSignalingState("stable"),Object.keys(streams).forEach((function(sid){var stream=streams[sid];if(stream.getTracks().length){if(-1===pc.remoteStreams.indexOf(stream)){pc.remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,window.setTimeout((function(){pc._dispatchEvent("addstream",event)}))}receiverList.forEach((function(item){var track=item[0],receiver=item[1];stream.id===item[2].id&&fireAddTrack(pc,track,receiver,[stream])}))}})),receiverList.forEach((function(item){item[2]||fireAddTrack(pc,item[0],item[1],[])})),window.setTimeout((function(){pc&&pc.transceivers&&pc.transceivers.forEach((function(transceiver){transceiver.iceTransport&&"new"===transceiver.iceTransport.state&&transceiver.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),transceiver.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},RTCPeerConnection.prototype.close=function(){this.transceivers.forEach((function(transceiver){transceiver.iceTransport&&transceiver.iceTransport.stop(),transceiver.dtlsTransport&&transceiver.dtlsTransport.stop(),transceiver.rtpSender&&transceiver.rtpSender.stop(),transceiver.rtpReceiver&&transceiver.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},RTCPeerConnection.prototype._updateSignalingState=function(newState){this.signalingState=newState;var event=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",event)},RTCPeerConnection.prototype._maybeFireNegotiationNeeded=function(){var pc=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,window.setTimeout((function(){if(pc.needNegotiation){pc.needNegotiation=!1;var event=new Event("negotiationneeded");pc._dispatchEvent("negotiationneeded",event)}}),0))},RTCPeerConnection.prototype._updateIceConnectionState=function(){var newState,states={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(transceiver){transceiver.iceTransport&&!transceiver.rejected&&states[transceiver.iceTransport.state]++})),newState="new",states.failed>0?newState="failed":states.checking>0?newState="checking":states.disconnected>0?newState="disconnected":states.new>0?newState="new":states.connected>0?newState="connected":states.completed>0&&(newState="completed"),newState!==this.iceConnectionState){this.iceConnectionState=newState;var event=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",event)}},RTCPeerConnection.prototype._updateConnectionState=function(){var newState,states={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(transceiver){transceiver.iceTransport&&transceiver.dtlsTransport&&!transceiver.rejected&&(states[transceiver.iceTransport.state]++,states[transceiver.dtlsTransport.state]++)})),states.connected+=states.completed,newState="new",states.failed>0?newState="failed":states.connecting>0?newState="connecting":states.disconnected>0?newState="disconnected":states.new>0?newState="new":states.connected>0&&(newState="connected"),newState!==this.connectionState){this.connectionState=newState;var event=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",event)}},RTCPeerConnection.prototype.createOffer=function(){var pc=this;if(pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not call createOffer after close"));var numAudioTracks=pc.transceivers.filter((function(t){return"audio"===t.kind})).length,numVideoTracks=pc.transceivers.filter((function(t){return"video"===t.kind})).length,offerOptions=arguments[0];if(offerOptions){if(offerOptions.mandatory||offerOptions.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==offerOptions.offerToReceiveAudio&&(numAudioTracks=!0===offerOptions.offerToReceiveAudio?1:!1===offerOptions.offerToReceiveAudio?0:offerOptions.offerToReceiveAudio),void 0!==offerOptions.offerToReceiveVideo&&(numVideoTracks=!0===offerOptions.offerToReceiveVideo?1:!1===offerOptions.offerToReceiveVideo?0:offerOptions.offerToReceiveVideo)}for(pc.transceivers.forEach((function(transceiver){"audio"===transceiver.kind?--numAudioTracks<0&&(transceiver.wantReceive=!1):"video"===transceiver.kind&&--numVideoTracks<0&&(transceiver.wantReceive=!1)}));numAudioTracks>0||numVideoTracks>0;)numAudioTracks>0&&(pc._createTransceiver("audio"),numAudioTracks--),numVideoTracks>0&&(pc._createTransceiver("video"),numVideoTracks--);var sdp=SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,pc._sdpSessionVersion++);pc.transceivers.forEach((function(transceiver,sdpMLineIndex){var track=transceiver.track,kind=transceiver.kind,mid=transceiver.mid||SDPUtils.generateIdentifier();transceiver.mid=mid,transceiver.iceGatherer||(transceiver.iceGatherer=pc._createIceGatherer(sdpMLineIndex,pc.usingBundle));var localCapabilities=window.RTCRtpSender.getCapabilities(kind);edgeVersion<15019&&(localCapabilities.codecs=localCapabilities.codecs.filter((function(codec){return"rtx"!==codec.name}))),localCapabilities.codecs.forEach((function(codec){"H264"===codec.name&&void 0===codec.parameters["level-asymmetry-allowed"]&&(codec.parameters["level-asymmetry-allowed"]="1"),transceiver.remoteCapabilities&&transceiver.remoteCapabilities.codecs&&transceiver.remoteCapabilities.codecs.forEach((function(remoteCodec){codec.name.toLowerCase()===remoteCodec.name.toLowerCase()&&codec.clockRate===remoteCodec.clockRate&&(codec.preferredPayloadType=remoteCodec.payloadType)}))})),localCapabilities.headerExtensions.forEach((function(hdrExt){(transceiver.remoteCapabilities&&transceiver.remoteCapabilities.headerExtensions||[]).forEach((function(rHdrExt){hdrExt.uri===rHdrExt.uri&&(hdrExt.id=rHdrExt.id)}))}));var sendEncodingParameters=transceiver.sendEncodingParameters||[{ssrc:1001*(2*sdpMLineIndex+1)}];track&&edgeVersion>=15019&&"video"===kind&&!sendEncodingParameters[0].rtx&&(sendEncodingParameters[0].rtx={ssrc:sendEncodingParameters[0].ssrc+1}),transceiver.wantReceive&&(transceiver.rtpReceiver=new window.RTCRtpReceiver(transceiver.dtlsTransport,kind)),transceiver.localCapabilities=localCapabilities,transceiver.sendEncodingParameters=sendEncodingParameters})),"max-compat"!==pc._config.bundlePolicy&&(sdp+="a=group:BUNDLE "+pc.transceivers.map((function(t){return t.mid})).join(" ")+"\r\n"),sdp+="a=ice-options:trickle\r\n",pc.transceivers.forEach((function(transceiver,sdpMLineIndex){sdp+=writeMediaSection(transceiver,transceiver.localCapabilities,"offer",transceiver.stream,pc._dtlsRole),sdp+="a=rtcp-rsize\r\n",!transceiver.iceGatherer||"new"===pc.iceGatheringState||0!==sdpMLineIndex&&pc.usingBundle||(transceiver.iceGatherer.getLocalCandidates().forEach((function(cand){cand.component=1,sdp+="a="+SDPUtils.writeCandidate(cand)+"\r\n"})),"completed"===transceiver.iceGatherer.state&&(sdp+="a=end-of-candidates\r\n"))}));var desc=new window.RTCSessionDescription({type:"offer",sdp:sdp});return Promise.resolve(desc)},RTCPeerConnection.prototype.createAnswer=function(){var pc=this;if(pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==pc.signalingState&&"have-local-pranswer"!==pc.signalingState)return Promise.reject(makeError("InvalidStateError","Can not call createAnswer in signalingState "+pc.signalingState));var sdp=SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,pc._sdpSessionVersion++);pc.usingBundle&&(sdp+="a=group:BUNDLE "+pc.transceivers.map((function(t){return t.mid})).join(" ")+"\r\n"),sdp+="a=ice-options:trickle\r\n";var mediaSectionsInOffer=SDPUtils.getMediaSections(pc._remoteDescription.sdp).length;pc.transceivers.forEach((function(transceiver,sdpMLineIndex){if(!(sdpMLineIndex+1>mediaSectionsInOffer)){if(transceiver.rejected)return"application"===transceiver.kind?"DTLS/SCTP"===transceiver.protocol?sdp+="m=application 0 DTLS/SCTP 5000\r\n":sdp+="m=application 0 "+transceiver.protocol+" webrtc-datachannel\r\n":"audio"===transceiver.kind?sdp+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===transceiver.kind&&(sdp+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(sdp+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+transceiver.mid+"\r\n");var localTrack;if(transceiver.stream)"audio"===transceiver.kind?localTrack=transceiver.stream.getAudioTracks()[0]:"video"===transceiver.kind&&(localTrack=transceiver.stream.getVideoTracks()[0]),localTrack&&edgeVersion>=15019&&"video"===transceiver.kind&&!transceiver.sendEncodingParameters[0].rtx&&(transceiver.sendEncodingParameters[0].rtx={ssrc:transceiver.sendEncodingParameters[0].ssrc+1});var commonCapabilities=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);!commonCapabilities.codecs.filter((function(c){return"rtx"===c.name.toLowerCase()})).length&&transceiver.sendEncodingParameters[0].rtx&&delete transceiver.sendEncodingParameters[0].rtx,sdp+=writeMediaSection(transceiver,commonCapabilities,"answer",transceiver.stream,pc._dtlsRole),transceiver.rtcpParameters&&transceiver.rtcpParameters.reducedSize&&(sdp+="a=rtcp-rsize\r\n")}}));var desc=new window.RTCSessionDescription({type:"answer",sdp:sdp});return Promise.resolve(desc)},RTCPeerConnection.prototype.addIceCandidate=function(candidate){var sections,pc=this;return candidate&&void 0===candidate.sdpMLineIndex&&!candidate.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(resolve,reject){if(!pc._remoteDescription)return reject(makeError("InvalidStateError","Can not add ICE candidate without a remote description"));if(candidate&&""!==candidate.candidate){var sdpMLineIndex=candidate.sdpMLineIndex;if(candidate.sdpMid)for(var i=0;i<pc.transceivers.length;i++)if(pc.transceivers[i].mid===candidate.sdpMid){sdpMLineIndex=i;break}var transceiver=pc.transceivers[sdpMLineIndex];if(!transceiver)return reject(makeError("OperationError","Can not add ICE candidate"));if(transceiver.rejected)return resolve();var cand=Object.keys(candidate.candidate).length>0?SDPUtils.parseCandidate(candidate.candidate):{};if("tcp"===cand.protocol&&(0===cand.port||9===cand.port))return resolve();if(cand.component&&1!==cand.component)return resolve();if((0===sdpMLineIndex||sdpMLineIndex>0&&transceiver.iceTransport!==pc.transceivers[0].iceTransport)&&!maybeAddCandidate(transceiver.iceTransport,cand))return reject(makeError("OperationError","Can not add ICE candidate"));var candidateString=candidate.candidate.trim();0===candidateString.indexOf("a=")&&(candidateString=candidateString.substr(2)),(sections=SDPUtils.getMediaSections(pc._remoteDescription.sdp))[sdpMLineIndex]+="a="+(cand.type?candidateString:"end-of-candidates")+"\r\n",pc._remoteDescription.sdp=SDPUtils.getDescription(pc._remoteDescription.sdp)+sections.join("")}else for(var j=0;j<pc.transceivers.length&&(pc.transceivers[j].rejected||(pc.transceivers[j].iceTransport.addRemoteCandidate({}),(sections=SDPUtils.getMediaSections(pc._remoteDescription.sdp))[j]+="a=end-of-candidates\r\n",pc._remoteDescription.sdp=SDPUtils.getDescription(pc._remoteDescription.sdp)+sections.join(""),!pc.usingBundle));j++);resolve()}))},RTCPeerConnection.prototype.getStats=function(selector){if(selector&&selector instanceof window.MediaStreamTrack){var senderOrReceiver=null;if(this.transceivers.forEach((function(transceiver){transceiver.rtpSender&&transceiver.rtpSender.track===selector?senderOrReceiver=transceiver.rtpSender:transceiver.rtpReceiver&&transceiver.rtpReceiver.track===selector&&(senderOrReceiver=transceiver.rtpReceiver)})),!senderOrReceiver)throw makeError("InvalidAccessError","Invalid selector.");return senderOrReceiver.getStats()}var promises=[];return this.transceivers.forEach((function(transceiver){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(method){transceiver[method]&&promises.push(transceiver[method].getStats())}))})),Promise.all(promises).then((function(allStats){var results=new Map;return allStats.forEach((function(stats){stats.forEach((function(stat){results.set(stat.id,stat)}))})),results}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(ortcObjectName){var obj=window[ortcObjectName];if(obj&&obj.prototype&&obj.prototype.getStats){var nativeGetstats=obj.prototype.getStats;obj.prototype.getStats=function(){return nativeGetstats.apply(this).then((function(nativeStats){var mapStats=new Map;return Object.keys(nativeStats).forEach((function(id){var stat;nativeStats[id].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(stat=nativeStats[id]).type]||stat.type,mapStats.set(id,nativeStats[id])})),mapStats}))}}}));var methods=["createOffer","createAnswer"];return methods.forEach((function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;return"function"==typeof args[0]||"function"==typeof args[1]?nativeMethod.apply(this,[arguments[2]]).then((function(description){"function"==typeof args[0]&&args[0].apply(null,[description])}),(function(error){"function"==typeof args[1]&&args[1].apply(null,[error])})):nativeMethod.apply(this,arguments)}})),(methods=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;return"function"==typeof args[1]||"function"==typeof args[2]?nativeMethod.apply(this,arguments).then((function(){"function"==typeof args[1]&&args[1].apply(null)}),(function(error){"function"==typeof args[2]&&args[2].apply(null,[error])})):nativeMethod.apply(this,arguments)}})),["getStats"].forEach((function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;return"function"==typeof args[1]?nativeMethod.apply(this,arguments).then((function(){"function"==typeof args[1]&&args[1].apply(null)})):nativeMethod.apply(this,arguments)}})),RTCPeerConnection}},{sdp:6}],6:[function(require,module,exports){"use strict";var SDPUtils={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};SDPUtils.localCName=SDPUtils.generateIdentifier(),SDPUtils.splitLines=function(blob){return blob.trim().split("\n").map((function(line){return line.trim()}))},SDPUtils.splitSections=function(blob){return blob.split("\nm=").map((function(part,index){return(index>0?"m="+part:part).trim()+"\r\n"}))},SDPUtils.getDescription=function(blob){var sections=SDPUtils.splitSections(blob);return sections&&sections[0]},SDPUtils.getMediaSections=function(blob){var sections=SDPUtils.splitSections(blob);return sections.shift(),sections},SDPUtils.matchPrefix=function(blob,prefix){return SDPUtils.splitLines(blob).filter((function(line){return 0===line.indexOf(prefix)}))},SDPUtils.parseCandidate=function(line){for(var parts,candidate={foundation:(parts=0===line.indexOf("a=candidate:")?line.substring(12).split(" "):line.substring(10).split(" "))[0],component:parseInt(parts[1],10),protocol:parts[2].toLowerCase(),priority:parseInt(parts[3],10),ip:parts[4],address:parts[4],port:parseInt(parts[5],10),type:parts[7]},i=8;i<parts.length;i+=2)switch(parts[i]){case"raddr":candidate.relatedAddress=parts[i+1];break;case"rport":candidate.relatedPort=parseInt(parts[i+1],10);break;case"tcptype":candidate.tcpType=parts[i+1];break;case"ufrag":candidate.ufrag=parts[i+1],candidate.usernameFragment=parts[i+1];break;default:candidate[parts[i]]=parts[i+1]}return candidate},SDPUtils.writeCandidate=function(candidate){var sdp=[];sdp.push(candidate.foundation),sdp.push(candidate.component),sdp.push(candidate.protocol.toUpperCase()),sdp.push(candidate.priority),sdp.push(candidate.address||candidate.ip),sdp.push(candidate.port);var type=candidate.type;return sdp.push("typ"),sdp.push(type),"host"!==type&&candidate.relatedAddress&&candidate.relatedPort&&(sdp.push("raddr"),sdp.push(candidate.relatedAddress),sdp.push("rport"),sdp.push(candidate.relatedPort)),candidate.tcpType&&"tcp"===candidate.protocol.toLowerCase()&&(sdp.push("tcptype"),sdp.push(candidate.tcpType)),(candidate.usernameFragment||candidate.ufrag)&&(sdp.push("ufrag"),sdp.push(candidate.usernameFragment||candidate.ufrag)),"candidate:"+sdp.join(" ")},SDPUtils.parseIceOptions=function(line){return line.substr(14).split(" ")},SDPUtils.parseRtpMap=function(line){var parts=line.substr(9).split(" "),parsed={payloadType:parseInt(parts.shift(),10)};return parts=parts[0].split("/"),parsed.name=parts[0],parsed.clockRate=parseInt(parts[1],10),parsed.channels=3===parts.length?parseInt(parts[2],10):1,parsed.numChannels=parsed.channels,parsed},SDPUtils.writeRtpMap=function(codec){var pt=codec.payloadType;void 0!==codec.preferredPayloadType&&(pt=codec.preferredPayloadType);var channels=codec.channels||codec.numChannels||1;return"a=rtpmap:"+pt+" "+codec.name+"/"+codec.clockRate+(1!==channels?"/"+channels:"")+"\r\n"},SDPUtils.parseExtmap=function(line){var parts=line.substr(9).split(" ");return{id:parseInt(parts[0],10),direction:parts[0].indexOf("/")>0?parts[0].split("/")[1]:"sendrecv",uri:parts[1]}},SDPUtils.writeExtmap=function(headerExtension){return"a=extmap:"+(headerExtension.id||headerExtension.preferredId)+(headerExtension.direction&&"sendrecv"!==headerExtension.direction?"/"+headerExtension.direction:"")+" "+headerExtension.uri+"\r\n"},SDPUtils.parseFmtp=function(line){for(var kv,parsed={},parts=line.substr(line.indexOf(" ")+1).split(";"),j=0;j<parts.length;j++)parsed[(kv=parts[j].trim().split("="))[0].trim()]=kv[1];return parsed},SDPUtils.writeFmtp=function(codec){var line="",pt=codec.payloadType;if(void 0!==codec.preferredPayloadType&&(pt=codec.preferredPayloadType),codec.parameters&&Object.keys(codec.parameters).length){var params=[];Object.keys(codec.parameters).forEach((function(param){codec.parameters[param]?params.push(param+"="+codec.parameters[param]):params.push(param)})),line+="a=fmtp:"+pt+" "+params.join(";")+"\r\n"}return line},SDPUtils.parseRtcpFb=function(line){var parts=line.substr(line.indexOf(" ")+1).split(" ");return{type:parts.shift(),parameter:parts.join(" ")}},SDPUtils.writeRtcpFb=function(codec){var lines="",pt=codec.payloadType;return void 0!==codec.preferredPayloadType&&(pt=codec.preferredPayloadType),codec.rtcpFeedback&&codec.rtcpFeedback.length&&codec.rtcpFeedback.forEach((function(fb){lines+="a=rtcp-fb:"+pt+" "+fb.type+(fb.parameter&&fb.parameter.length?" "+fb.parameter:"")+"\r\n"})),lines},SDPUtils.parseSsrcMedia=function(line){var sp=line.indexOf(" "),parts={ssrc:parseInt(line.substr(7,sp-7),10)},colon=line.indexOf(":",sp);return colon>-1?(parts.attribute=line.substr(sp+1,colon-sp-1),parts.value=line.substr(colon+1)):parts.attribute=line.substr(sp+1),parts},SDPUtils.parseSsrcGroup=function(line){var parts=line.substr(13).split(" ");return{semantics:parts.shift(),ssrcs:parts.map((function(ssrc){return parseInt(ssrc,10)}))}},SDPUtils.getMid=function(mediaSection){var mid=SDPUtils.matchPrefix(mediaSection,"a=mid:")[0];if(mid)return mid.substr(6)},SDPUtils.parseFingerprint=function(line){var parts=line.substr(14).split(" ");return{algorithm:parts[0].toLowerCase(),value:parts[1]}},SDPUtils.getDtlsParameters=function(mediaSection,sessionpart){return{role:"auto",fingerprints:SDPUtils.matchPrefix(mediaSection+sessionpart,"a=fingerprint:").map(SDPUtils.parseFingerprint)}},SDPUtils.writeDtlsParameters=function(params,setupType){var sdp="a=setup:"+setupType+"\r\n";return params.fingerprints.forEach((function(fp){sdp+="a=fingerprint:"+fp.algorithm+" "+fp.value+"\r\n"})),sdp},SDPUtils.parseCryptoLine=function(line){var parts=line.substr(9).split(" ");return{tag:parseInt(parts[0],10),cryptoSuite:parts[1],keyParams:parts[2],sessionParams:parts.slice(3)}},SDPUtils.writeCryptoLine=function(parameters){return"a=crypto:"+parameters.tag+" "+parameters.cryptoSuite+" "+("object"==typeof parameters.keyParams?SDPUtils.writeCryptoKeyParams(parameters.keyParams):parameters.keyParams)+(parameters.sessionParams?" "+parameters.sessionParams.join(" "):"")+"\r\n"},SDPUtils.parseCryptoKeyParams=function(keyParams){if(0!==keyParams.indexOf("inline:"))return null;var parts=keyParams.substr(7).split("|");return{keyMethod:"inline",keySalt:parts[0],lifeTime:parts[1],mkiValue:parts[2]?parts[2].split(":")[0]:void 0,mkiLength:parts[2]?parts[2].split(":")[1]:void 0}},SDPUtils.writeCryptoKeyParams=function(keyParams){return keyParams.keyMethod+":"+keyParams.keySalt+(keyParams.lifeTime?"|"+keyParams.lifeTime:"")+(keyParams.mkiValue&&keyParams.mkiLength?"|"+keyParams.mkiValue+":"+keyParams.mkiLength:"")},SDPUtils.getCryptoParameters=function(mediaSection,sessionpart){return SDPUtils.matchPrefix(mediaSection+sessionpart,"a=crypto:").map(SDPUtils.parseCryptoLine)},SDPUtils.getIceParameters=function(mediaSection,sessionpart){var ufrag=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-ufrag:")[0],pwd=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-pwd:")[0];return ufrag&&pwd?{usernameFragment:ufrag.substr(12),password:pwd.substr(10)}:null},SDPUtils.writeIceParameters=function(params){return"a=ice-ufrag:"+params.usernameFragment+"\r\na=ice-pwd:"+params.password+"\r\n"},SDPUtils.parseRtpParameters=function(mediaSection){for(var description={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},mline=SDPUtils.splitLines(mediaSection)[0].split(" "),i=3;i<mline.length;i++){var pt=mline[i],rtpmapline=SDPUtils.matchPrefix(mediaSection,"a=rtpmap:"+pt+" ")[0];if(rtpmapline){var codec=SDPUtils.parseRtpMap(rtpmapline),fmtps=SDPUtils.matchPrefix(mediaSection,"a=fmtp:"+pt+" ");switch(codec.parameters=fmtps.length?SDPUtils.parseFmtp(fmtps[0]):{},codec.rtcpFeedback=SDPUtils.matchPrefix(mediaSection,"a=rtcp-fb:"+pt+" ").map(SDPUtils.parseRtcpFb),description.codecs.push(codec),codec.name.toUpperCase()){case"RED":case"ULPFEC":description.fecMechanisms.push(codec.name.toUpperCase())}}}return SDPUtils.matchPrefix(mediaSection,"a=extmap:").forEach((function(line){description.headerExtensions.push(SDPUtils.parseExtmap(line))})),description},SDPUtils.writeRtpDescription=function(kind,caps){var sdp="";sdp+="m="+kind+" ",sdp+=caps.codecs.length>0?"9":"0",sdp+=" UDP/TLS/RTP/SAVPF ",sdp+=caps.codecs.map((function(codec){return void 0!==codec.preferredPayloadType?codec.preferredPayloadType:codec.payloadType})).join(" ")+"\r\n",sdp+="c=IN IP4 0.0.0.0\r\n",sdp+="a=rtcp:9 IN IP4 0.0.0.0\r\n",caps.codecs.forEach((function(codec){sdp+=SDPUtils.writeRtpMap(codec),sdp+=SDPUtils.writeFmtp(codec),sdp+=SDPUtils.writeRtcpFb(codec)}));var maxptime=0;return caps.codecs.forEach((function(codec){codec.maxptime>maxptime&&(maxptime=codec.maxptime)})),maxptime>0&&(sdp+="a=maxptime:"+maxptime+"\r\n"),sdp+="a=rtcp-mux\r\n",caps.headerExtensions&&caps.headerExtensions.forEach((function(extension){sdp+=SDPUtils.writeExtmap(extension)})),sdp},SDPUtils.parseRtpEncodingParameters=function(mediaSection){var secondarySsrc,encodingParameters=[],description=SDPUtils.parseRtpParameters(mediaSection),hasRed=-1!==description.fecMechanisms.indexOf("RED"),hasUlpfec=-1!==description.fecMechanisms.indexOf("ULPFEC"),ssrcs=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(parts){return"cname"===parts.attribute})),primarySsrc=ssrcs.length>0&&ssrcs[0].ssrc,flows=SDPUtils.matchPrefix(mediaSection,"a=ssrc-group:FID").map((function(line){return line.substr(17).split(" ").map((function(part){return parseInt(part,10)}))}));flows.length>0&&flows[0].length>1&&flows[0][0]===primarySsrc&&(secondarySsrc=flows[0][1]),description.codecs.forEach((function(codec){if("RTX"===codec.name.toUpperCase()&&codec.parameters.apt){var encParam={ssrc:primarySsrc,codecPayloadType:parseInt(codec.parameters.apt,10)};primarySsrc&&secondarySsrc&&(encParam.rtx={ssrc:secondarySsrc}),encodingParameters.push(encParam),hasRed&&((encParam=JSON.parse(JSON.stringify(encParam))).fec={ssrc:primarySsrc,mechanism:hasUlpfec?"red+ulpfec":"red"},encodingParameters.push(encParam))}})),0===encodingParameters.length&&primarySsrc&&encodingParameters.push({ssrc:primarySsrc});var bandwidth=SDPUtils.matchPrefix(mediaSection,"b=");return bandwidth.length&&(bandwidth=0===bandwidth[0].indexOf("b=TIAS:")?parseInt(bandwidth[0].substr(7),10):0===bandwidth[0].indexOf("b=AS:")?1e3*parseInt(bandwidth[0].substr(5),10)*.95-16e3:void 0,encodingParameters.forEach((function(params){params.maxBitrate=bandwidth}))),encodingParameters},SDPUtils.parseRtcpParameters=function(mediaSection){var rtcpParameters={},remoteSsrc=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(obj){return"cname"===obj.attribute}))[0];remoteSsrc&&(rtcpParameters.cname=remoteSsrc.value,rtcpParameters.ssrc=remoteSsrc.ssrc);var rsize=SDPUtils.matchPrefix(mediaSection,"a=rtcp-rsize");rtcpParameters.reducedSize=rsize.length>0,rtcpParameters.compound=0===rsize.length;var mux=SDPUtils.matchPrefix(mediaSection,"a=rtcp-mux");return rtcpParameters.mux=mux.length>0,rtcpParameters},SDPUtils.parseMsid=function(mediaSection){var parts,spec=SDPUtils.matchPrefix(mediaSection,"a=msid:");if(1===spec.length)return{stream:(parts=spec[0].substr(7).split(" "))[0],track:parts[1]};var planB=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(msidParts){return"msid"===msidParts.attribute}));return planB.length>0?{stream:(parts=planB[0].value.split(" "))[0],track:parts[1]}:void 0},SDPUtils.parseSctpDescription=function(mediaSection){var maxMessageSize,mline=SDPUtils.parseMLine(mediaSection),maxSizeLine=SDPUtils.matchPrefix(mediaSection,"a=max-message-size:");maxSizeLine.length>0&&(maxMessageSize=parseInt(maxSizeLine[0].substr(19),10)),isNaN(maxMessageSize)&&(maxMessageSize=65536);var sctpPort=SDPUtils.matchPrefix(mediaSection,"a=sctp-port:");if(sctpPort.length>0)return{port:parseInt(sctpPort[0].substr(12),10),protocol:mline.fmt,maxMessageSize:maxMessageSize};if(SDPUtils.matchPrefix(mediaSection,"a=sctpmap:").length>0){var parts=SDPUtils.matchPrefix(mediaSection,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(parts[0],10),protocol:parts[1],maxMessageSize:maxMessageSize}}},SDPUtils.writeSctpDescription=function(media,sctp){var output=[];return output="DTLS/SCTP"!==media.protocol?["m="+media.kind+" 9 "+media.protocol+" "+sctp.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+sctp.port+"\r\n"]:["m="+media.kind+" 9 "+media.protocol+" "+sctp.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+sctp.port+" "+sctp.protocol+" 65535\r\n"],void 0!==sctp.maxMessageSize&&output.push("a=max-message-size:"+sctp.maxMessageSize+"\r\n"),output.join("")},SDPUtils.generateSessionId=function(){return Math.random().toString().substr(2,21)},SDPUtils.writeSessionBoilerplate=function(sessId,sessVer,sessUser){var version=void 0!==sessVer?sessVer:2;return"v=0\r\no="+(sessUser||"thisisadapterortc")+" "+(sessId||SDPUtils.generateSessionId())+" "+version+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},SDPUtils.writeMediaSection=function(transceiver,caps,type,stream){var sdp=SDPUtils.writeRtpDescription(transceiver.kind,caps);if(sdp+=SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters()),sdp+=SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(),"offer"===type?"actpass":"active"),sdp+="a=mid:"+transceiver.mid+"\r\n",transceiver.direction?sdp+="a="+transceiver.direction+"\r\n":transceiver.rtpSender&&transceiver.rtpReceiver?sdp+="a=sendrecv\r\n":transceiver.rtpSender?sdp+="a=sendonly\r\n":transceiver.rtpReceiver?sdp+="a=recvonly\r\n":sdp+="a=inactive\r\n",transceiver.rtpSender){var msid="msid:"+stream.id+" "+transceiver.rtpSender.track.id+"\r\n";sdp+="a="+msid,sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" "+msid,transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" "+msid,sdp+="a=ssrc-group:FID "+transceiver.sendEncodingParameters[0].ssrc+" "+transceiver.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" cname:"+SDPUtils.localCName+"\r\n",transceiver.rtpSender&&transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" cname:"+SDPUtils.localCName+"\r\n"),sdp},SDPUtils.getDirection=function(mediaSection,sessionpart){for(var lines=SDPUtils.splitLines(mediaSection),i=0;i<lines.length;i++)switch(lines[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return lines[i].substr(2)}return sessionpart?SDPUtils.getDirection(sessionpart):"sendrecv"},SDPUtils.getKind=function(mediaSection){return SDPUtils.splitLines(mediaSection)[0].split(" ")[0].substr(2)},SDPUtils.isRejected=function(mediaSection){return"0"===mediaSection.split(" ",2)[1]},SDPUtils.parseMLine=function(mediaSection){var parts=SDPUtils.splitLines(mediaSection)[0].substr(2).split(" ");return{kind:parts[0],port:parseInt(parts[1],10),protocol:parts[2],fmt:parts.slice(3).join(" ")}},SDPUtils.parseOLine=function(mediaSection){var parts=SDPUtils.matchPrefix(mediaSection,"o=")[0].substr(2).split(" ");return{username:parts[0],sessionId:parts[1],sessionVersion:parseInt(parts[2],10),netType:parts[3],addressType:parts[4],address:parts[5]}},SDPUtils.isValidSDP=function(blob){if("string"!=typeof blob||0===blob.length)return!1;for(var lines=SDPUtils.splitLines(blob),i=0;i<lines.length;i++)if(lines[i].length<2||"="!==lines[i].charAt(1))return!1;return!0},"object"==typeof module&&(module.exports=SDPUtils)},{}],7:[function(require,module,exports){var swfobject=function(){var l,Q,E,B,n,G,D="undefined",r="object",S="Shockwave Flash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=!1,U=[function(){T?function(){var X=j.getElementsByTagName("body")[0],aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;!function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");ab&&(ab=ab.split(" ")[1].split(","),M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)])}else if(Y<10)return Y++,void setTimeout(arguments.callee,10);X.removeChild(aa),Z=null,H()}()}else H()}():H()}],o=[],N=[],I=[],J=!1,a=!1,m=!0,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=/win/.test(Y||ah),ac=/mac/.test(Y||ah),af=!!/webkit/.test(ah)&&parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")),X=!1,ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r)!(ab=t.plugins[S].description)||typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin||(T=!0,X=!1,ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10),ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10),ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof O[["Active"].concat("Object").join("X")]!=D)try{var ad=new(window[["Active"].concat("Object").join("X")])("ShockwaveFlash.ShockwaveFlash");ad&&(ab=ad.GetVariable("$version"))&&(X=!0,ab=ab.split(" ")[1].split(","),ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)])}catch(Z){}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}();M.w3&&((typeof j.readyState!=D&&"complete"==j.readyState||typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))&&f(),J||(typeof j.addEventListener!=D&&j.addEventListener("DOMContentLoaded",f,!1),M.ie&&M.win&&(j.attachEvent(x,(function(){"complete"==j.readyState&&(j.detachEvent(x,arguments.callee),f())})),O==top&&function(){if(!J){try{j.documentElement.doScroll("left")}catch(X){return void setTimeout(arguments.callee,0)}f()}}()),M.wk&&function(){J||(/loaded|complete/.test(j.readyState)?f():setTimeout(arguments.callee,0))}(),s(f)));function f(){if(!J){try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=!0;for(var X=U.length,Y=0;Y<X;Y++)U[Y]()}}function K(X){J?X():U[U.length]=X}function s(Y){if(typeof O.addEventListener!=D)O.addEventListener("load",Y,!1);else if(typeof j.addEventListener!=D)j.addEventListener("load",Y,!1);else if(typeof O.attachEvent!=D)!function(Z,X,Y){Z.attachEvent(X,Y),I[I.length]=[Z,X,Y]}(O,"onload",Y);else if("function"==typeof O.onload){var X=O.onload;O.onload=function(){X(),Y()}}else O.onload=Y}function H(){var ag=o.length;if(ag>0)for(var af=0;af<ag;af++){var Y=o[af].id,ab=o[af].callbackFn,aa={success:!1,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae)if(!F(o[af].swfVersion)||M.wk&&M.wk<312)if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall,ai.width=ae.getAttribute("width")||"0",ai.height=ae.getAttribute("height")||"0",ae.getAttribute("class")&&(ai.styleclass=ae.getAttribute("class")),ae.getAttribute("align")&&(ai.align=ae.getAttribute("align"));for(var ah={},X=ae.getElementsByTagName("param"),ac=X.length,ad=0;ad<ac;ad++)"movie"!=X[ad].getAttribute("name").toLowerCase()&&(ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value"));P(ai,ah,Y,ab)}else p(ae),ab&&ab(aa);else w(Y,!0),ab&&(aa.success=!0,aa.ref=z(Y),ab(aa))}else if(w(Y,!0),ab){var Z=z(Y);Z&&typeof Z.SetVariable!=D&&(aa.success=!0,aa.ref=Z),ab(aa)}}}function z(aa){var X=null,Y=c(aa);if(Y&&"OBJECT"==Y.nodeName)if(typeof Y.SetVariable!=D)X=Y;else{var Z=Y.getElementsByTagName(r)[0];Z&&(X=Z)}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=!0,E=Z||null,B={success:!1,id:X};var ae=c(X);if(ae){"OBJECT"==ae.nodeName?(l=g(ae),Q=null):(l=ae,Q=X),aa.id=R,(typeof aa.width==D||!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)&&(aa.width="310"),(typeof aa.height==D||!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)&&(aa.height="137"),j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?["Active"].concat("").join("X"):"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D?ab.flashvars+="&"+ac:ab.flashvars=ac,M.ie&&M.win&&4!=ae.readyState){var Y=C("div");X+="SWFObjectNew",Y.setAttribute("id",X),ae.parentNode.insertBefore(Y,ae),ae.style.display="none",function(){4==ae.readyState?ae.parentNode.removeChild(ae):setTimeout(arguments.callee,10)}()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&4!=Y.readyState){var X=C("div");Y.parentNode.insertBefore(X,Y),X.parentNode.replaceChild(g(Y),X),Y.style.display="none",function(){4==Y.readyState?Y.parentNode.removeChild(Y):setTimeout(arguments.callee,10)}()}else Y.parentNode.replaceChild(g(Y),Y)}function g(ab){var aa=C("div");if(M.win&&M.ie)aa.innerHTML=ab.innerHTML;else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad)for(var X=ad.length,Z=0;Z<X;Z++)1==ad[Z].nodeType&&"PARAM"==ad[Z].nodeName||8==ad[Z].nodeType||aa.appendChild(ad[Z].cloneNode(!0))}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312)return X;if(aa)if(typeof ai.id==D&&(ai.id=Y),M.ie&&M.win){var ah="";for(var ae in ai)ai[ae]!=Object.prototype[ae]&&("data"==ae.toLowerCase()?ag.movie=ai[ae]:"styleclass"==ae.toLowerCase()?ah+=' class="'+ai[ae]+'"':"classid"!=ae.toLowerCase()&&(ah+=" "+ae+'="'+ai[ae]+'"'));var af="";for(var ad in ag)ag[ad]!=Object.prototype[ad]&&(af+='<param name="'+ad+'" value="'+ag[ad]+'" />');aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>",N[N.length]=ai.id,X=c(ai.id)}else{var Z=C(r);for(var ac in Z.setAttribute("type",q),ai)ai[ac]!=Object.prototype[ac]&&("styleclass"==ac.toLowerCase()?Z.setAttribute("class",ai[ac]):"classid"!=ac.toLowerCase()&&Z.setAttribute(ac,ai[ac]));for(var ab in ag)ag[ab]!=Object.prototype[ab]&&"movie"!=ab.toLowerCase()&&e(Z,ab,ag[ab]);aa.parentNode.replaceChild(Z,aa),X=Z}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X),aa.setAttribute("value",Y),Z.appendChild(aa)}function y(Y){var X=c(Y);X&&"OBJECT"==X.nodeName&&(M.ie&&M.win?(X.style.display="none",function(){4==X.readyState?b(Y):setTimeout(arguments.callee,10)}()):X.parentNode.removeChild(X))}function b(Z){var Y=c(Z);if(Y){for(var X in Y)"function"==typeof Y[X]&&(Y[X]=null);Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function F(Z){var Y=M.pv,X=Z.split(".");return X[0]=parseInt(X[0],10),X[1]=parseInt(X[1],10)||0,X[2]=parseInt(X[2],10)||0,Y[0]>X[0]||Y[0]==X[0]&&Y[1]>X[1]||Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]}function v(ac,Y,ad,ab){if(!M.ie||!M.mac){var aa=j.getElementsByTagName("head")[0];if(aa){var X=ad&&"string"==typeof ad?ad:"screen";if(ab&&(n=null,G=null),!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css"),Z.setAttribute("media",X),n=aa.appendChild(Z),M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0&&(n=j.styleSheets[j.styleSheets.length-1]),G=X}M.ie&&M.win?n&&typeof n.addRule==r&&n.addRule(ac,Y):n&&typeof j.createTextNode!=D&&n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(m){var Y=X?"visible":"hidden";J&&c(Z)?c(Z).style.visibility=Y:v("#"+Z,"visibility:"+Y)}}function L(Y){return null!=/[\\\"<>\.;]/.exec(Y)&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}M.ie&&M.win&&window.attachEvent("onunload",(function(){for(var ac=I.length,ab=0;ab<ac;ab++)I[ab][0].detachEvent(I[ab][1],I[ab][2]);for(var Z=N.length,aa=0;aa<Z;aa++)y(N[aa]);for(var Y in M)M[Y]=null;for(var X in M=null,swfobject)swfobject[X]=null;swfobject=null}));return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab,Y.swfVersion=X,Y.expressInstall=aa,Y.callbackFn=Z,o[o.length]=Y,w(ab,!1)}else Z&&Z({success:!1,id:ab})},getObjectById:function(X){if(M.w3)return z(X)},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:!1,id:ah};M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y?(w(ah,!1),K((function(){ae+="",ag+="";var aj={};if(af&&typeof af===r)for(var al in af)aj[al]=af[al];aj.data=ab,aj.width=ae,aj.height=ag;var am={};if(ad&&typeof ad===r)for(var ak in ad)am[ak]=ad[ak];if(Z&&typeof Z===r)for(var ai in Z)typeof am.flashvars!=D?am.flashvars+="&"+ai+"="+Z[ai]:am.flashvars=ai+"="+Z[ai];if(F(Y)){var an=u(aj,am,ah);aj.id==ah&&w(ah,!0),X.success=!0,X.ref=an}else{if(aa&&A())return aj.data=aa,void P(aj,am,ah,ac);w(ah,!0)}ac&&ac(X)}))):ac&&ac(X)},switchOffAutoHideShow:function(){m=!1},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){return M.w3?u(Z,Y,X):void 0},showExpressInstall:function(Z,aa,X,Y){M.w3&&A()&&P(Z,aa,X,Y)},removeSWF:function(X){M.w3&&y(X)},createCSS:function(aa,Z,Y,X){M.w3&&v(aa,Z,Y,X)},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)&&(Z=Z.split("?")[1]),null==aa)return L(Z);for(var Y=Z.split("&"),X=0;X<Y.length;X++)if(Y[X].substring(0,Y[X].indexOf("="))==aa)return L(Y[X].substring(Y[X].indexOf("=")+1))}return""},expressInstallCallback:function(){if(a){var X=c(R);X&&l&&(X.parentNode.replaceChild(l,X),Q&&(w(Q,!0),M.ie&&M.win&&(l.style.display="block")),E&&E(B)),a=!1}}}}();module.exports=swfobject},{}],8:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;msecs>=0&&(item._idleTimeoutId=setTimeout((function(){item._onTimeout&&item._onTimeout()}),msecs))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(fn){var id=nextImmediateId++,args=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[id]=!0,nextTick((function(){immediateIds[id]&&(args?fn.apply(null,args):fn.call(null),exports.clearImmediate(id))})),id},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":3,timers:8}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"v1",{enumerable:!0,get:function(){return _v.default}}),Object.defineProperty(exports,"v3",{enumerable:!0,get:function(){return _v2.default}}),Object.defineProperty(exports,"v4",{enumerable:!0,get:function(){return _v3.default}}),Object.defineProperty(exports,"v5",{enumerable:!0,get:function(){return _v4.default}}),Object.defineProperty(exports,"NIL",{enumerable:!0,get:function(){return _nil.default}}),Object.defineProperty(exports,"version",{enumerable:!0,get:function(){return _version.default}}),Object.defineProperty(exports,"validate",{enumerable:!0,get:function(){return _validate.default}}),Object.defineProperty(exports,"stringify",{enumerable:!0,get:function(){return _stringify.default}}),Object.defineProperty(exports,"parse",{enumerable:!0,get:function(){return _parse.default}});var _v=_interopRequireDefault(require("./v1.js")),_v2=_interopRequireDefault(require("./v3.js")),_v3=_interopRequireDefault(require("./v4.js")),_v4=_interopRequireDefault(require("./v5.js")),_nil=_interopRequireDefault(require("./nil.js")),_version=_interopRequireDefault(require("./version.js")),_validate=_interopRequireDefault(require("./validate.js")),_stringify=_interopRequireDefault(require("./stringify.js")),_parse=_interopRequireDefault(require("./parse.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}},{"./nil.js":11,"./parse.js":12,"./stringify.js":16,"./v1.js":17,"./v3.js":18,"./v4.js":20,"./v5.js":21,"./validate.js":22,"./version.js":23}],10:[function(require,module,exports){"use strict";function getOutputLength(inputLength8){return 14+(inputLength8+64>>>9<<4)+1}function safeAdd(x,y){const lsw=(65535&x)+(65535&y);return(x>>16)+(y>>16)+(lsw>>16)<<16|65535&lsw}function md5cmn(q,a,b,x,s,t){return safeAdd((num=safeAdd(safeAdd(a,q),safeAdd(x,t)))<<(cnt=s)|num>>>32-cnt,b);var num,cnt}function md5ff(a,b,c,d,x,s,t){return md5cmn(b&c|~b&d,a,b,x,s,t)}function md5gg(a,b,c,d,x,s,t){return md5cmn(b&d|c&~d,a,b,x,s,t)}function md5hh(a,b,c,d,x,s,t){return md5cmn(b^c^d,a,b,x,s,t)}function md5ii(a,b,c,d,x,s,t){return md5cmn(c^(b|~d),a,b,x,s,t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(bytes){if("string"==typeof bytes){const msg=unescape(encodeURIComponent(bytes));bytes=new Uint8Array(msg.length);for(let i=0;i<msg.length;++i)bytes[i]=msg.charCodeAt(i)}return function(input){const output=[],length32=32*input.length;for(let i=0;i<length32;i+=8){const x=input[i>>5]>>>i%32&255,hex=parseInt("0123456789abcdef".charAt(x>>>4&15)+"0123456789abcdef".charAt(15&x),16);output.push(hex)}return output}(function(x,len){x[len>>5]|=128<<len%32,x[getOutputLength(len)-1]=len;let a=1732584193,b=-271733879,c=-1732584194,d=271733878;for(let i=0;i<x.length;i+=16){const olda=a,oldb=b,oldc=c,oldd=d;a=md5ff(a,b,c,d,x[i],7,-680876936),d=md5ff(d,a,b,c,x[i+1],12,-389564586),c=md5ff(c,d,a,b,x[i+2],17,606105819),b=md5ff(b,c,d,a,x[i+3],22,-1044525330),a=md5ff(a,b,c,d,x[i+4],7,-176418897),d=md5ff(d,a,b,c,x[i+5],12,1200080426),c=md5ff(c,d,a,b,x[i+6],17,-1473231341),b=md5ff(b,c,d,a,x[i+7],22,-45705983),a=md5ff(a,b,c,d,x[i+8],7,1770035416),d=md5ff(d,a,b,c,x[i+9],12,-1958414417),c=md5ff(c,d,a,b,x[i+10],17,-42063),b=md5ff(b,c,d,a,x[i+11],22,-1990404162),a=md5ff(a,b,c,d,x[i+12],7,1804603682),d=md5ff(d,a,b,c,x[i+13],12,-40341101),c=md5ff(c,d,a,b,x[i+14],17,-1502002290),b=md5ff(b,c,d,a,x[i+15],22,1236535329),a=md5gg(a,b,c,d,x[i+1],5,-165796510),d=md5gg(d,a,b,c,x[i+6],9,-1069501632),c=md5gg(c,d,a,b,x[i+11],14,643717713),b=md5gg(b,c,d,a,x[i],20,-373897302),a=md5gg(a,b,c,d,x[i+5],5,-701558691),d=md5gg(d,a,b,c,x[i+10],9,38016083),c=md5gg(c,d,a,b,x[i+15],14,-660478335),b=md5gg(b,c,d,a,x[i+4],20,-405537848),a=md5gg(a,b,c,d,x[i+9],5,568446438),d=md5gg(d,a,b,c,x[i+14],9,-1019803690),c=md5gg(c,d,a,b,x[i+3],14,-187363961),b=md5gg(b,c,d,a,x[i+8],20,1163531501),a=md5gg(a,b,c,d,x[i+13],5,-1444681467),d=md5gg(d,a,b,c,x[i+2],9,-51403784),c=md5gg(c,d,a,b,x[i+7],14,1735328473),b=md5gg(b,c,d,a,x[i+12],20,-1926607734),a=md5hh(a,b,c,d,x[i+5],4,-378558),d=md5hh(d,a,b,c,x[i+8],11,-2022574463),c=md5hh(c,d,a,b,x[i+11],16,1839030562),b=md5hh(b,c,d,a,x[i+14],23,-35309556),a=md5hh(a,b,c,d,x[i+1],4,-1530992060),d=md5hh(d,a,b,c,x[i+4],11,1272893353),c=md5hh(c,d,a,b,x[i+7],16,-155497632),b=md5hh(b,c,d,a,x[i+10],23,-1094730640),a=md5hh(a,b,c,d,x[i+13],4,681279174),d=md5hh(d,a,b,c,x[i],11,-358537222),c=md5hh(c,d,a,b,x[i+3],16,-722521979),b=md5hh(b,c,d,a,x[i+6],23,76029189),a=md5hh(a,b,c,d,x[i+9],4,-640364487),d=md5hh(d,a,b,c,x[i+12],11,-421815835),c=md5hh(c,d,a,b,x[i+15],16,530742520),b=md5hh(b,c,d,a,x[i+2],23,-995338651),a=md5ii(a,b,c,d,x[i],6,-198630844),d=md5ii(d,a,b,c,x[i+7],10,1126891415),c=md5ii(c,d,a,b,x[i+14],15,-1416354905),b=md5ii(b,c,d,a,x[i+5],21,-57434055),a=md5ii(a,b,c,d,x[i+12],6,1700485571),d=md5ii(d,a,b,c,x[i+3],10,-1894986606),c=md5ii(c,d,a,b,x[i+10],15,-1051523),b=md5ii(b,c,d,a,x[i+1],21,-2054922799),a=md5ii(a,b,c,d,x[i+8],6,1873313359),d=md5ii(d,a,b,c,x[i+15],10,-30611744),c=md5ii(c,d,a,b,x[i+6],15,-1560198380),b=md5ii(b,c,d,a,x[i+13],21,1309151649),a=md5ii(a,b,c,d,x[i+4],6,-145523070),d=md5ii(d,a,b,c,x[i+11],10,-1120210379),c=md5ii(c,d,a,b,x[i+2],15,718787259),b=md5ii(b,c,d,a,x[i+9],21,-343485551),a=safeAdd(a,olda),b=safeAdd(b,oldb),c=safeAdd(c,oldc),d=safeAdd(d,oldd)}return[a,b,c,d]}(function(input){if(0===input.length)return[];const length8=8*input.length,output=new Uint32Array(getOutputLength(length8));for(let i=0;i<length8;i+=8)output[i>>5]|=(255&input[i/8])<<i%32;return output}(bytes),8*bytes.length))};exports.default=_default},{}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;exports.default="00000000-0000-0000-0000-000000000000"},{}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_validate=(obj=require("./validate.js"))&&obj.__esModule?obj:{default:obj};var _default=function(uuid){if(!(0,_validate.default)(uuid))throw TypeError("Invalid UUID");let v;const arr=new Uint8Array(16);return arr[0]=(v=parseInt(uuid.slice(0,8),16))>>>24,arr[1]=v>>>16&255,arr[2]=v>>>8&255,arr[3]=255&v,arr[4]=(v=parseInt(uuid.slice(9,13),16))>>>8,arr[5]=255&v,arr[6]=(v=parseInt(uuid.slice(14,18),16))>>>8,arr[7]=255&v,arr[8]=(v=parseInt(uuid.slice(19,23),16))>>>8,arr[9]=255&v,arr[10]=(v=parseInt(uuid.slice(24,36),16))/1099511627776&255,arr[11]=v/4294967296&255,arr[12]=v>>>24&255,arr[13]=v>>>16&255,arr[14]=v>>>8&255,arr[15]=255&v,arr};exports.default=_default},{"./validate.js":22}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;exports.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],14:[function(require,module,exports){"use strict";let getRandomValues;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){if(!getRandomValues&&(getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)};const rnds8=new Uint8Array(16)},{}],15:[function(require,module,exports){"use strict";function f(s,x,y,z){switch(s){case 0:return x&y^~x&z;case 1:return x^y^z;case 2:return x&y^x&z^y&z;case 3:return x^y^z}}function ROTL(x,n){return x<<n|x>>>32-n}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(bytes){const K=[1518500249,1859775393,2400959708,3395469782],H=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof bytes){const msg=unescape(encodeURIComponent(bytes));bytes=[];for(let i=0;i<msg.length;++i)bytes.push(msg.charCodeAt(i))}else Array.isArray(bytes)||(bytes=Array.prototype.slice.call(bytes));bytes.push(128);const l=bytes.length/4+2,N=Math.ceil(l/16),M=new Array(N);for(let i=0;i<N;++i){const arr=new Uint32Array(16);for(let j=0;j<16;++j)arr[j]=bytes[64*i+4*j]<<24|bytes[64*i+4*j+1]<<16|bytes[64*i+4*j+2]<<8|bytes[64*i+4*j+3];M[i]=arr}M[N-1][14]=8*(bytes.length-1)/Math.pow(2,32),M[N-1][14]=Math.floor(M[N-1][14]),M[N-1][15]=8*(bytes.length-1)&4294967295;for(let i=0;i<N;++i){const W=new Uint32Array(80);for(let t=0;t<16;++t)W[t]=M[i][t];for(let t=16;t<80;++t)W[t]=ROTL(W[t-3]^W[t-8]^W[t-14]^W[t-16],1);let a=H[0],b=H[1],c=H[2],d=H[3],e=H[4];for(let t=0;t<80;++t){const s=Math.floor(t/20),T=ROTL(a,5)+f(s,b,c,d)+e+K[s]+W[t]>>>0;e=d,d=c,c=ROTL(b,30)>>>0,b=a,a=T}H[0]=H[0]+a>>>0,H[1]=H[1]+b>>>0,H[2]=H[2]+c>>>0,H[3]=H[3]+d>>>0,H[4]=H[4]+e>>>0}return[H[0]>>24&255,H[0]>>16&255,H[0]>>8&255,255&H[0],H[1]>>24&255,H[1]>>16&255,H[1]>>8&255,255&H[1],H[2]>>24&255,H[2]>>16&255,H[2]>>8&255,255&H[2],H[3]>>24&255,H[3]>>16&255,H[3]>>8&255,255&H[3],H[4]>>24&255,H[4]>>16&255,H[4]>>8&255,255&H[4]]};exports.default=_default},{}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_validate=(obj=require("./validate.js"))&&obj.__esModule?obj:{default:obj};const byteToHex=[];for(let i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));var _default=function(arr,offset=0){const uuid=(byteToHex[arr[offset+0]]+byteToHex[arr[offset+1]]+byteToHex[arr[offset+2]]+byteToHex[arr[offset+3]]+"-"+byteToHex[arr[offset+4]]+byteToHex[arr[offset+5]]+"-"+byteToHex[arr[offset+6]]+byteToHex[arr[offset+7]]+"-"+byteToHex[arr[offset+8]]+byteToHex[arr[offset+9]]+"-"+byteToHex[arr[offset+10]]+byteToHex[arr[offset+11]]+byteToHex[arr[offset+12]]+byteToHex[arr[offset+13]]+byteToHex[arr[offset+14]]+byteToHex[arr[offset+15]]).toLowerCase();if(!(0,_validate.default)(uuid))throw TypeError("Stringified UUID is invalid");return uuid};exports.default=_default},{"./validate.js":22}],17:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _rng=_interopRequireDefault(require("./rng.js")),_stringify=_interopRequireDefault(require("./stringify.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}let _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;var _default=function(options,buf,offset){let i=buf&&offset||0;const b=buf||new Array(16);let node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){const seedBytes=options.random||(options.rng||_rng.default)();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}let msecs=void 0!==options.msecs?options.msecs:Date.now(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1;const dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq,msecs+=122192928e5;const tl=(1e4*(268435455&msecs)+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;const tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(let n=0;n<6;++n)b[i+n]=node[n];return buf||(0,_stringify.default)(b)};exports.default=_default},{"./rng.js":14,"./stringify.js":16}],18:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _v=_interopRequireDefault(require("./v35.js")),_md=_interopRequireDefault(require("./md5.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=(0,_v.default)("v3",48,_md.default);exports.default=_default},{"./md5.js":10,"./v35.js":19}],19:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(name,version,hashfunc){function generateUUID(value,namespace,buf,offset){if("string"==typeof value&&(value=function(str){str=unescape(encodeURIComponent(str));const bytes=[];for(let i=0;i<str.length;++i)bytes.push(str.charCodeAt(i));return bytes}(value)),"string"==typeof namespace&&(namespace=(0,_parse.default)(namespace)),16!==namespace.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let bytes=new Uint8Array(16+value.length);if(bytes.set(namespace),bytes.set(value,namespace.length),bytes=hashfunc(bytes),bytes[6]=15&bytes[6]|version,bytes[8]=63&bytes[8]|128,buf){offset=offset||0;for(let i=0;i<16;++i)buf[offset+i]=bytes[i];return buf}return(0,_stringify.default)(bytes)}try{generateUUID.name=name}catch(err){}return generateUUID.DNS=DNS,generateUUID.URL=URL,generateUUID},exports.URL=exports.DNS=void 0;var _stringify=_interopRequireDefault(require("./stringify.js")),_parse=_interopRequireDefault(require("./parse.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}const DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";exports.DNS=DNS;const URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";exports.URL=URL},{"./parse.js":12,"./stringify.js":16}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _rng=_interopRequireDefault(require("./rng.js")),_stringify=_interopRequireDefault(require("./stringify.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=function(options,buf,offset){const rnds=(options=options||{}).random||(options.rng||_rng.default)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf){offset=offset||0;for(let i=0;i<16;++i)buf[offset+i]=rnds[i];return buf}return(0,_stringify.default)(rnds)};exports.default=_default},{"./rng.js":14,"./stringify.js":16}],21:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _v=_interopRequireDefault(require("./v35.js")),_sha=_interopRequireDefault(require("./sha1.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=(0,_v.default)("v5",80,_sha.default);exports.default=_default},{"./sha1.js":15,"./v35.js":19}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_regex=(obj=require("./regex.js"))&&obj.__esModule?obj:{default:obj};var _default=function(uuid){return"string"==typeof uuid&&_regex.default.test(uuid)};exports.default=_default},{"./regex.js":13}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_validate=(obj=require("./validate.js"))&&obj.__esModule?obj:{default:obj};var _default=function(uuid){if(!(0,_validate.default)(uuid))throw TypeError("Invalid UUID");return parseInt(uuid.substr(14,1),16)};exports.default=_default},{"./validate.js":22}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var adapter=(0,require("./adapter_factory.js").adapterFactory)({window:"undefined"==typeof window?void 0:window});exports.default=adapter},{"./adapter_factory.js":25}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.adapterFactory=function(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},window=_ref.window,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},logging=utils.log,browserDetails=utils.detectBrowser(window),adapter={browserDetails:browserDetails,commonShim:commonShim,extractVersion:utils.extractVersion,disableLog:utils.disableLog,disableWarnings:utils.disableWarnings};switch(browserDetails.browser){case"chrome":if(!chromeShim||!chromeShim.shimPeerConnection||!options.shimChrome)return logging("Chrome shim is not included in this adapter release."),adapter;if(null===browserDetails.version)return logging("Chrome shim can not determine version, not shimming."),adapter;logging("adapter.js shimming chrome."),adapter.browserShim=chromeShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),chromeShim.shimGetUserMedia(window,browserDetails),chromeShim.shimMediaStream(window,browserDetails),chromeShim.shimPeerConnection(window,browserDetails),chromeShim.shimOnTrack(window,browserDetails),chromeShim.shimAddTrackRemoveTrack(window,browserDetails),chromeShim.shimGetSendersWithDtmf(window,browserDetails),chromeShim.shimGetStats(window,browserDetails),chromeShim.shimSenderReceiverGetStats(window,browserDetails),chromeShim.fixNegotiationNeeded(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;case"firefox":if(!firefoxShim||!firefoxShim.shimPeerConnection||!options.shimFirefox)return logging("Firefox shim is not included in this adapter release."),adapter;logging("adapter.js shimming firefox."),adapter.browserShim=firefoxShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),firefoxShim.shimGetUserMedia(window,browserDetails),firefoxShim.shimPeerConnection(window,browserDetails),firefoxShim.shimOnTrack(window,browserDetails),firefoxShim.shimRemoveStream(window,browserDetails),firefoxShim.shimSenderGetStats(window,browserDetails),firefoxShim.shimReceiverGetStats(window,browserDetails),firefoxShim.shimRTCDataChannel(window,browserDetails),firefoxShim.shimAddTransceiver(window,browserDetails),firefoxShim.shimGetParameters(window,browserDetails),firefoxShim.shimCreateOffer(window,browserDetails),firefoxShim.shimCreateAnswer(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails);break;case"edge":if(!edgeShim||!edgeShim.shimPeerConnection||!options.shimEdge)return logging("MS edge shim is not included in this adapter release."),adapter;logging("adapter.js shimming edge."),adapter.browserShim=edgeShim,edgeShim.shimGetUserMedia(window,browserDetails),edgeShim.shimGetDisplayMedia(window,browserDetails),edgeShim.shimPeerConnection(window,browserDetails),edgeShim.shimReplaceTrack(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails);break;case"safari":if(!safariShim||!options.shimSafari)return logging("Safari shim is not included in this adapter release."),adapter;logging("adapter.js shimming safari."),adapter.browserShim=safariShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),safariShim.shimRTCIceServerUrls(window,browserDetails),safariShim.shimCreateOfferLegacy(window,browserDetails),safariShim.shimCallbacksAPI(window,browserDetails),safariShim.shimLocalStreamsAPI(window,browserDetails),safariShim.shimRemoteStreamsAPI(window,browserDetails),safariShim.shimTrackEventTransceiver(window,browserDetails),safariShim.shimGetUserMedia(window,browserDetails),safariShim.shimAudioContext(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;default:logging("Unsupported browser!")}return adapter};var utils=_interopRequireWildcard(require("./utils")),chromeShim=_interopRequireWildcard(require("./chrome/chrome_shim")),edgeShim=_interopRequireWildcard(require("./edge/edge_shim")),firefoxShim=_interopRequireWildcard(require("./firefox/firefox_shim")),safariShim=_interopRequireWildcard(require("./safari/safari_shim")),commonShim=_interopRequireWildcard(require("./common_shim"));function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}},{"./chrome/chrome_shim":26,"./common_shim":29,"./edge/edge_shim":30,"./firefox/firefox_shim":34,"./safari/safari_shim":37,"./utils":38}],26:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimMediaStream=function(window){window.MediaStream=window.MediaStream||window.webkitMediaStream},exports.shimOnTrack=function(window){if("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("ontrack"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(f){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=f)},enumerable:!0,configurable:!0});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var _this=this;return this._ontrackpoly||(this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",(function(te){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===te.track.id})):{track:te.track};var event=new Event("track");event.track=te.track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)})),e.stream.getTracks().forEach((function(track){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===track.id})):{track:track};var event=new Event("track");event.track=track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)}))},this.addEventListener("addstream",this._ontrackpoly)),origSetRemoteDescription.apply(this,arguments)}}else utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))},exports.shimGetSendersWithDtmf=function(window){if("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("getSenders"in window.RTCPeerConnection.prototype)&&"createDTMFSender"in window.RTCPeerConnection.prototype){var shimSenderWithDtmf=function(pc,track){return{track:track,get dtmf(){return void 0===this._dtmf&&("audio"===track.kind?this._dtmf=pc.createDTMFSender(track):this._dtmf=null),this._dtmf},_pc:pc}};if(!window.RTCPeerConnection.prototype.getSenders){window.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){var sender=origAddTrack.apply(this,arguments);return sender||(sender=shimSenderWithDtmf(this,track),this._senders.push(sender)),sender};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){origRemoveTrack.apply(this,arguments);var idx=this._senders.indexOf(sender);-1!==idx&&this._senders.splice(idx,1)}}var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this2=this;this._senders=this._senders||[],origAddStream.apply(this,[stream]),stream.getTracks().forEach((function(track){_this2._senders.push(shimSenderWithDtmf(_this2,track))}))};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._senders=this._senders||[],origRemoveStream.apply(this,[stream]),stream.getTracks().forEach((function(track){var sender=_this3._senders.find((function(s){return s.track===track}));sender&&_this3._senders.splice(_this3._senders.indexOf(sender),1)}))}}else if("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&"getSenders"in window.RTCPeerConnection.prototype&&"createDTMFSender"in window.RTCPeerConnection.prototype&&window.RTCRtpSender&&!("dtmf"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;window.RTCPeerConnection.prototype.getSenders=function(){var _this4=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this4})),senders},Object.defineProperty(window.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},exports.shimGetStats=function(window){if(!window.RTCPeerConnection)return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _this5=this,_arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];if(arguments.length>0&&"function"==typeof selector)return origGetStats.apply(this,arguments);if(0===origGetStats.length&&(0===arguments.length||"function"!=typeof selector))return origGetStats.apply(this,[]);var fixChromeStats_=function(response){var standardReport={};return response.result().forEach((function(report){var standardStats={id:report.id,timestamp:report.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[report.type]||report.type};report.names().forEach((function(name){standardStats[name]=report.stat(name)})),standardReport[standardStats.id]=standardStats})),standardReport},makeMapStats=function(stats){return new Map(Object.keys(stats).map((function(key){return[key,stats[key]]})))};if(arguments.length>=2){var successCallbackWrapper_=function(response){onSucc(makeMapStats(fixChromeStats_(response)))};return origGetStats.apply(this,[successCallbackWrapper_,selector])}return new Promise((function(resolve,reject){origGetStats.apply(_this5,[function(response){resolve(makeMapStats(fixChromeStats_(response)))},reject])})).then(onSucc,onErr)}},exports.shimSenderReceiverGetStats=function(window){if(!("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&window.RTCRtpSender&&window.RTCRtpReceiver))return;if(!("getStats"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this6=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this6})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender}),window.RTCRtpSender.prototype.getStats=function(){var sender=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,sender.track,!0)}))}}if(!("getStats"in window.RTCRtpReceiver.prototype)){var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this7=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this7})),receivers}),utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){var receiver=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,receiver.track,!1)}))}}if(!("getStats"in window.RTCRtpSender.prototype)||!("getStats"in window.RTCRtpReceiver.prototype))return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof window.MediaStreamTrack){var track=arguments[0],sender=void 0,receiver=void 0,err=void 0;return this.getSenders().forEach((function(s){s.track===track&&(sender?err=!0:sender=s)})),this.getReceivers().forEach((function(r){return r.track===track&&(receiver?err=!0:receiver=r),r.track===track})),err||sender&&receiver?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):sender?sender.getStats():receiver?receiver.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return origGetStats.apply(this,arguments)}},exports.shimAddTrackRemoveTrackWithNative=shimAddTrackRemoveTrackWithNative,exports.shimAddTrackRemoveTrack=function(window,browserDetails){if(!window.RTCPeerConnection)return;if(window.RTCPeerConnection.prototype.addTrack&&browserDetails.version>=65)return shimAddTrackRemoveTrackWithNative(window);var origGetLocalStreams=window.RTCPeerConnection.prototype.getLocalStreams;window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this11=this,nativeStreams=origGetLocalStreams.apply(this);return this._reverseStreams=this._reverseStreams||{},nativeStreams.map((function(stream){return _this11._reverseStreams[stream.id]}))};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this12=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},stream.getTracks().forEach((function(track){if(_this12.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[stream.id]){var newStream=new window.MediaStream(stream.getTracks());this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,stream=newStream}origAddStream.apply(this,[stream])};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(internalStream.id,"g"),externalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}function replaceExternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(externalStream.id,"g"),internalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}window.RTCPeerConnection.prototype.removeStream=function(stream){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},origRemoveStream.apply(this,[this._streams[stream.id]||stream]),delete this._reverseStreams[this._streams[stream.id]?this._streams[stream.id].id:stream.id],delete this._streams[stream.id]},window.RTCPeerConnection.prototype.addTrack=function(track,stream){var _this13=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var streams=[].slice.call(arguments,1);if(1!==streams.length||!streams[0].getTracks().find((function(t){return t===track})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var alreadyExists=this.getSenders().find((function(s){return s.track===track}));if(alreadyExists)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var oldStream=this._streams[stream.id];if(oldStream)oldStream.addTrack(track),Promise.resolve().then((function(){_this13.dispatchEvent(new Event("negotiationneeded"))}));else{var newStream=new window.MediaStream([track]);this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,this.addStream(newStream)}return this.getSenders().find((function(s){return s.track===track}))},["createOffer","createAnswer"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){var _this14=this,args=arguments,isLegacyCall=arguments.length&&"function"==typeof arguments[0];return isLegacyCall?nativeMethod.apply(this,[function(description){var desc=replaceInternalStreamId(_this14,description);args[0].apply(null,[desc])},function(err){args[1]&&args[1].apply(null,err)},arguments[2]]):nativeMethod.apply(this,arguments).then((function(description){return replaceInternalStreamId(_this14,description)}))}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var origSetLocalDescription=window.RTCPeerConnection.prototype.setLocalDescription;window.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),origSetLocalDescription.apply(this,arguments)):origSetLocalDescription.apply(this,arguments)};var origLocalDescription=Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(window.RTCPeerConnection.prototype,"localDescription",{get:function(){var description=origLocalDescription.get.apply(this);return""===description.type?description:replaceInternalStreamId(this,description)}}),window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this15=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!sender._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(sender._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var stream=void 0;Object.keys(this._streams).forEach((function(streamid){_this15._streams[streamid].getTracks().find((function(track){return sender.track===track}))&&(stream=_this15._streams[streamid])})),stream&&(1===stream.getTracks().length?this.removeStream(this._reverseStreams[stream.id]):stream.removeTrack(sender.track),this.dispatchEvent(new Event("negotiationneeded")))}},exports.shimPeerConnection=function(window,browserDetails){!window.RTCPeerConnection&&window.webkitRTCPeerConnection&&(window.RTCPeerConnection=window.webkitRTCPeerConnection);if(!window.RTCPeerConnection)return;browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}))},exports.fixNegotiationNeeded=function(window,browserDetails){utils.wrapPeerConnectionEvent(window,"negotiationneeded",(function(e){var pc=e.target;if(!(browserDetails.version<72||pc.getConfiguration&&"plan-b"===pc.getConfiguration().sdpSemantics)||"stable"===pc.signalingState)return e}))};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js"));function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function shimAddTrackRemoveTrackWithNative(window){window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this8=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(streamId){return _this8._shimmedLocalStreams[streamId][0]}))};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){if(!stream)return origAddTrack.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var sender=origAddTrack.apply(this,arguments);return this._shimmedLocalStreams[stream.id]?-1===this._shimmedLocalStreams[stream.id].indexOf(sender)&&this._shimmedLocalStreams[stream.id].push(sender):this._shimmedLocalStreams[stream.id]=[stream,sender],sender};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this9=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},stream.getTracks().forEach((function(track){if(_this9.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")}));var existingSenders=this.getSenders();origAddStream.apply(this,arguments);var newSenders=this.getSenders().filter((function(newSender){return-1===existingSenders.indexOf(newSender)}));this._shimmedLocalStreams[stream.id]=[stream].concat(newSenders)};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[stream.id],origRemoveStream.apply(this,arguments)};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this10=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},sender&&Object.keys(this._shimmedLocalStreams).forEach((function(streamId){var idx=_this10._shimmedLocalStreams[streamId].indexOf(sender);-1!==idx&&_this10._shimmedLocalStreams[streamId].splice(idx,1),1===_this10._shimmedLocalStreams[streamId].length&&delete _this10._shimmedLocalStreams[streamId]})),origRemoveTrack.apply(this,arguments)}}},{"../utils.js":38,"./getdisplaymedia":27,"./getusermedia":28}],27:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,getSourceId){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;if("function"!=typeof getSourceId)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");window.navigator.mediaDevices.getDisplayMedia=function(constraints){return getSourceId(constraints).then((function(sourceId){var widthSpecified=constraints.video&&constraints.video.width,heightSpecified=constraints.video&&constraints.video.height,frameRateSpecified=constraints.video&&constraints.video.frameRate;return constraints.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:sourceId,maxFrameRate:frameRateSpecified||3}},widthSpecified&&(constraints.video.mandatory.maxWidth=widthSpecified),heightSpecified&&(constraints.video.mandatory.maxHeight=heightSpecified),window.navigator.mediaDevices.getUserMedia(constraints)}))}}},{}],28:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator;if(!navigator.mediaDevices)return;var constraintsToChrome_=function(c){if("object"!==("undefined"==typeof c?"undefined":_typeof(c))||c.mandatory||c.optional)return c;var cc={};return Object.keys(c).forEach((function(key){if("require"!==key&&"advanced"!==key&&"mediaSource"!==key){var r="object"===_typeof(c[key])?c[key]:{ideal:c[key]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var oldname_=function(prefix,name){return prefix?prefix+name.charAt(0).toUpperCase()+name.slice(1):"deviceId"===name?"sourceId":name};if(void 0!==r.ideal){cc.optional=cc.optional||[];var oc={};"number"==typeof r.ideal?(oc[oldname_("min",key)]=r.ideal,cc.optional.push(oc),(oc={})[oldname_("max",key)]=r.ideal,cc.optional.push(oc)):(oc[oldname_("",key)]=r.ideal,cc.optional.push(oc))}void 0!==r.exact&&"number"!=typeof r.exact?(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_("",key)]=r.exact):["min","max"].forEach((function(mix){void 0!==r[mix]&&(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_(mix,key)]=r[mix])}))}})),c.advanced&&(cc.optional=(cc.optional||[]).concat(c.advanced)),cc},shimConstraints_=function(constraints,func){if(browserDetails.version>=61)return func(constraints);if((constraints=JSON.parse(JSON.stringify(constraints)))&&"object"===_typeof(constraints.audio)){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])};remap((constraints=JSON.parse(JSON.stringify(constraints))).audio,"autoGainControl","googAutoGainControl"),remap(constraints.audio,"noiseSuppression","googNoiseSuppression"),constraints.audio=constraintsToChrome_(constraints.audio)}if(constraints&&"object"===_typeof(constraints.video)){var face=constraints.video.facingMode;face=face&&("object"===("undefined"==typeof face?"undefined":_typeof(face))?face:{ideal:face});var getSupportedFacingModeLies=browserDetails.version<66;if(face&&("user"===face.exact||"environment"===face.exact||"user"===face.ideal||"environment"===face.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode||getSupportedFacingModeLies)){delete constraints.video.facingMode;var matches=void 0;if("environment"===face.exact||"environment"===face.ideal?matches=["back","rear"]:"user"!==face.exact&&"user"!==face.ideal||(matches=["front"]),matches)return navigator.mediaDevices.enumerateDevices().then((function(devices){var dev=(devices=devices.filter((function(d){return"videoinput"===d.kind}))).find((function(d){return matches.some((function(match){return d.label.toLowerCase().includes(match)}))}));return!dev&&devices.length&&matches.includes("back")&&(dev=devices[devices.length-1]),dev&&(constraints.video.deviceId=face.exact?{exact:dev.deviceId}:{ideal:dev.deviceId}),constraints.video=constraintsToChrome_(constraints.video),logging("chrome: "+JSON.stringify(constraints)),func(constraints)}))}constraints.video=constraintsToChrome_(constraints.video)}return logging("chrome: "+JSON.stringify(constraints)),func(constraints)},shimError_=function(e){return browserDetails.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(navigator.getUserMedia=function(constraints,onSuccess,onError){shimConstraints_(constraints,(function(c){navigator.webkitGetUserMedia(c,onSuccess,(function(e){onError&&onError(shimError_(e))}))}))}.bind(navigator),navigator.mediaDevices.getUserMedia){var origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(cs){return shimConstraints_(cs,(function(c){return origGetUserMedia(c).then((function(stream){if(c.audio&&!stream.getAudioTracks().length||c.video&&!stream.getVideoTracks().length)throw stream.getTracks().forEach((function(track){track.stop()})),new DOMException("","NotFoundError");return stream}),(function(e){return Promise.reject(shimError_(e))}))}))}}};var logging=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js")).log},{"../utils.js":38}],29:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimRTCIceCandidate=function(window){if(!window.RTCIceCandidate||window.RTCIceCandidate&&"foundation"in window.RTCIceCandidate.prototype)return;var NativeRTCIceCandidate=window.RTCIceCandidate;window.RTCIceCandidate=function(args){if("object"===("undefined"==typeof args?"undefined":_typeof(args))&&args.candidate&&0===args.candidate.indexOf("a=")&&((args=JSON.parse(JSON.stringify(args))).candidate=args.candidate.substr(2)),args.candidate&&args.candidate.length){var nativeCandidate=new NativeRTCIceCandidate(args),parsedCandidate=_sdp2.default.parseCandidate(args.candidate),augmentedCandidate=Object.assign(nativeCandidate,parsedCandidate);return augmentedCandidate.toJSON=function(){return{candidate:augmentedCandidate.candidate,sdpMid:augmentedCandidate.sdpMid,sdpMLineIndex:augmentedCandidate.sdpMLineIndex,usernameFragment:augmentedCandidate.usernameFragment}},augmentedCandidate}return new NativeRTCIceCandidate(args)},window.RTCIceCandidate.prototype=NativeRTCIceCandidate.prototype,utils.wrapPeerConnectionEvent(window,"icecandidate",(function(e){return e.candidate&&Object.defineProperty(e,"candidate",{value:new window.RTCIceCandidate(e.candidate),writable:"false"}),e}))},exports.shimMaxMessageSize=function(window,browserDetails){if(!window.RTCPeerConnection)return;"sctp"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp}});var sctpInDescription=function(description){if(!description||!description.sdp)return!1;var sections=_sdp2.default.splitSections(description.sdp);return sections.shift(),sections.some((function(mediaSection){var mLine=_sdp2.default.parseMLine(mediaSection);return mLine&&"application"===mLine.kind&&-1!==mLine.protocol.indexOf("SCTP")}))},getRemoteFirefoxVersion=function(description){var match=description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===match||match.length<2)return-1;var version=parseInt(match[1],10);return version!=version?-1:version},getCanSendMaxMessageSize=function(remoteIsFirefox){var canSendMaxMessageSize=65536;return"firefox"===browserDetails.browser&&(canSendMaxMessageSize=browserDetails.version<57?-1===remoteIsFirefox?16384:2147483637:browserDetails.version<60?57===browserDetails.version?65535:65536:2147483637),canSendMaxMessageSize},getMaxMessageSize=function(description,remoteIsFirefox){var maxMessageSize=65536;"firefox"===browserDetails.browser&&57===browserDetails.version&&(maxMessageSize=65535);var match=_sdp2.default.matchPrefix(description.sdp,"a=max-message-size:");return match.length>0?maxMessageSize=parseInt(match[0].substr(19),10):"firefox"===browserDetails.browser&&-1!==remoteIsFirefox&&(maxMessageSize=2147483637),maxMessageSize},origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===browserDetails.browser&&browserDetails.version>=76){var _getConfiguration=this.getConfiguration(),sdpSemantics=_getConfiguration.sdpSemantics;"plan-b"===sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){var isFirefox=getRemoteFirefoxVersion(arguments[0]),canSendMMS=getCanSendMaxMessageSize(isFirefox),remoteMMS=getMaxMessageSize(arguments[0],isFirefox),maxMessageSize=void 0;maxMessageSize=0===canSendMMS&&0===remoteMMS?Number.POSITIVE_INFINITY:0===canSendMMS||0===remoteMMS?Math.max(canSendMMS,remoteMMS):Math.min(canSendMMS,remoteMMS);var sctp={};Object.defineProperty(sctp,"maxMessageSize",{get:function(){return maxMessageSize}}),this._sctp=sctp}return origSetRemoteDescription.apply(this,arguments)}},exports.shimSendThrowTypeError=function(window){if(!window.RTCPeerConnection||!("createDataChannel"in window.RTCPeerConnection.prototype))return;function wrapDcSend(dc,pc){var origDataChannelSend=dc.send;dc.send=function(){var data=arguments[0],length=data.length||data.size||data.byteLength;if("open"===dc.readyState&&pc.sctp&&length>pc.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+pc.sctp.maxMessageSize+" bytes)");return origDataChannelSend.apply(dc,arguments)}}var origCreateDataChannel=window.RTCPeerConnection.prototype.createDataChannel;window.RTCPeerConnection.prototype.createDataChannel=function(){var dataChannel=origCreateDataChannel.apply(this,arguments);return wrapDcSend(dataChannel,this),dataChannel},utils.wrapPeerConnectionEvent(window,"datachannel",(function(e){return wrapDcSend(e.channel,e.target),e}))},exports.shimConnectionState=function(window){if(!window.RTCPeerConnection||"connectionState"in window.RTCPeerConnection.prototype)return;var proto=window.RTCPeerConnection.prototype;Object.defineProperty(proto,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(proto,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(cb){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),cb&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=cb)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(method){var origMethod=proto[method];proto[method]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var pc=e.target;if(pc._lastConnectionState!==pc.connectionState){pc._lastConnectionState=pc.connectionState;var newEvent=new Event("connectionstatechange",e);pc.dispatchEvent(newEvent)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),origMethod.apply(this,arguments)}}))},exports.removeExtmapAllowMixed=function(window,browserDetails){if(!window.RTCPeerConnection)return;if("chrome"===browserDetails.browser&&browserDetails.version>=71)return;if("safari"===browserDetails.browser&&browserDetails.version>=605)return;var nativeSRD=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(desc){if(desc&&desc.sdp&&-1!==desc.sdp.indexOf("\na=extmap-allow-mixed")){var sdp=desc.sdp.split("\n").filter((function(line){return"a=extmap-allow-mixed"!==line.trim()})).join("\n");window.RTCSessionDescription&&desc instanceof window.RTCSessionDescription?arguments[0]=new window.RTCSessionDescription({type:desc.type,sdp:sdp}):desc.sdp=sdp}return nativeSRD.apply(this,arguments)}},exports.shimAddIceCandidateNullOrEmpty=function(window,browserDetails){if(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype)return;var nativeAddIceCandidate=window.RTCPeerConnection.prototype.addIceCandidate;if(!nativeAddIceCandidate||0===nativeAddIceCandidate.length)return;window.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===browserDetails.browser&&browserDetails.version<78||"firefox"===browserDetails.browser&&browserDetails.version<68||"safari"===browserDetails.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():nativeAddIceCandidate.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}};var obj,_sdp=require("sdp"),_sdp2=(obj=_sdp)&&obj.__esModule?obj:{default:obj},utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("./utils"))},{"./utils":38,sdp:6}],30:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimPeerConnection=function(window,browserDetails){if(window.RTCIceGatherer&&(window.RTCIceCandidate||(window.RTCIceCandidate=function(args){return args}),window.RTCSessionDescription||(window.RTCSessionDescription=function(args){return args}),browserDetails.version<15025)){var origMSTEnabled=Object.getOwnPropertyDescriptor(window.MediaStreamTrack.prototype,"enabled");Object.defineProperty(window.MediaStreamTrack.prototype,"enabled",{set:function(value){origMSTEnabled.set.call(this,value);var ev=new Event("enabled");ev.enabled=value,this.dispatchEvent(ev)}})}window.RTCRtpSender&&!("dtmf"in window.RTCRtpSender.prototype)&&Object.defineProperty(window.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new window.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}});window.RTCDtmfSender&&!window.RTCDTMFSender&&(window.RTCDTMFSender=window.RTCDtmfSender);var RTCPeerConnectionShim=(0,_rtcpeerconnectionShim2.default)(window,browserDetails.version);window.RTCPeerConnection=function(config){return config&&config.iceServers&&(config.iceServers=(0,_filtericeservers.filterIceServers)(config.iceServers,browserDetails.version),utils.log("ICE servers after filtering:",config.iceServers)),new RTCPeerConnectionShim(config)},window.RTCPeerConnection.prototype=RTCPeerConnectionShim.prototype},exports.shimReplaceTrack=function(window){window.RTCRtpSender&&!("replaceTrack"in window.RTCRtpSender.prototype)&&(window.RTCRtpSender.prototype.replaceTrack=window.RTCRtpSender.prototype.setTrack)};var obj,utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils")),_filtericeservers=require("./filtericeservers"),_rtcpeerconnectionShim=require("rtcpeerconnection-shim"),_rtcpeerconnectionShim2=(obj=_rtcpeerconnectionShim)&&obj.__esModule?obj:{default:obj}},{"../utils":38,"./filtericeservers":31,"./getdisplaymedia":32,"./getusermedia":33,"rtcpeerconnection-shim":5}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterIceServers=function(iceServers,edgeVersion){var hasTurn=!1;return(iceServers=JSON.parse(JSON.stringify(iceServers))).filter((function(server){if(server&&(server.urls||server.url)){var urls=server.urls||server.url;server.url&&!server.urls&&utils.deprecated("RTCIceServer.url","RTCIceServer.urls");var isString="string"==typeof urls;return isString&&(urls=[urls]),urls=urls.filter((function(url){if(0===url.indexOf("stun:"))return!1;var validTurn=url.startsWith("turn")&&!url.startsWith("turn:[")&&url.includes("transport=udp");return validTurn&&!hasTurn?(hasTurn=!0,!0):validTurn&&!hasTurn})),delete server.url,server.urls=isString?urls[0]:urls,!!urls.length}}))};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":38}],32:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window){if(!("getDisplayMedia"in window.navigator))return;if(!window.navigator.mediaDevices)return;if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;window.navigator.mediaDevices.getDisplayMedia=window.navigator.getDisplayMedia.bind(window.navigator)}},{}],33:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetUserMedia=function(window){var navigator=window&&window.navigator,origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(c){return origGetUserMedia(c).catch((function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))}))}}},{}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimOnTrack=function(window){"object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCTrackEvent&&"receiver"in window.RTCTrackEvent.prototype&&!("transceiver"in window.RTCTrackEvent.prototype)&&Object.defineProperty(window.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},exports.shimPeerConnection=function(window,browserDetails){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection&&!window.mozRTCPeerConnection)return;!window.RTCPeerConnection&&window.mozRTCPeerConnection&&(window.RTCPeerConnection=window.mozRTCPeerConnection);browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value;return obj}({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var modernStatsTypes={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},nativeGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];return nativeGetStats.apply(this,[selector||null]).then((function(stats){if(browserDetails.version<53&&!onSucc)try{stats.forEach((function(stat){stat.type=modernStatsTypes[stat.type]||stat.type}))}catch(e){if("TypeError"!==e.name)throw e;stats.forEach((function(stat,i){stats.set(i,Object.assign({},stat,{type:modernStatsTypes[stat.type]||stat.type}))}))}return stats})).then(onSucc,onErr)}},exports.shimSenderGetStats=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpSender.prototype)return;var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender});window.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},exports.shimReceiverGetStats=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpReceiver.prototype)return;var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this2=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this2})),receivers});utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},exports.shimRemoveStream=function(window){if(!window.RTCPeerConnection||"removeStream"in window.RTCPeerConnection.prototype)return;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;utils.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(sender){sender.track&&stream.getTracks().includes(sender.track)&&_this3.removeTrack(sender)}))}},exports.shimRTCDataChannel=function(window){window.DataChannel&&!window.RTCDataChannel&&(window.RTCDataChannel=window.DataChannel)},exports.shimAddTransceiver=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origAddTransceiver=window.RTCPeerConnection.prototype.addTransceiver;origAddTransceiver&&(window.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var initParameters=arguments[1],shouldPerformCheck=initParameters&&"sendEncodings"in initParameters;shouldPerformCheck&&initParameters.sendEncodings.forEach((function(encodingParam){if("rid"in encodingParam){if(!/^[a-z0-9]{0,16}$/i.test(encodingParam.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in encodingParam&&!(parseFloat(encodingParam.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in encodingParam&&!(parseFloat(encodingParam.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var transceiver=origAddTransceiver.apply(this,arguments);if(shouldPerformCheck){var sender=transceiver.sender,params=sender.getParameters();(!("encodings"in params)||1===params.encodings.length&&0===Object.keys(params.encodings[0]).length)&&(params.encodings=initParameters.sendEncodings,sender.sendEncodings=initParameters.sendEncodings,this.setParametersPromises.push(sender.setParameters(params).then((function(){delete sender.sendEncodings})).catch((function(){delete sender.sendEncodings}))))}return transceiver})},exports.shimGetParameters=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCRtpSender)return;var origGetParameters=window.RTCRtpSender.prototype.getParameters;origGetParameters&&(window.RTCRtpSender.prototype.getParameters=function(){var params=origGetParameters.apply(this,arguments);return"encodings"in params||(params.encodings=[].concat(this.sendEncodings||[{}])),params})},exports.shimCreateOffer=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateOffer=window.RTCPeerConnection.prototype.createOffer;window.RTCPeerConnection.prototype.createOffer=function(){var _this4=this,_arguments2=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateOffer.apply(_this4,_arguments2)})).finally((function(){_this4.setParametersPromises=[]})):origCreateOffer.apply(this,arguments)}},exports.shimCreateAnswer=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateAnswer=window.RTCPeerConnection.prototype.createAnswer;window.RTCPeerConnection.prototype.createAnswer=function(){var _this5=this,_arguments3=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateAnswer.apply(_this5,_arguments3)})).finally((function(){_this5.setParametersPromises=[]})):origCreateAnswer.apply(this,arguments)}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":38,"./getdisplaymedia":35,"./getusermedia":36}],35:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,preferredMediaSource){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;window.navigator.mediaDevices.getDisplayMedia=function(constraints){if(!constraints||!constraints.video){var err=new DOMException("getDisplayMedia without video constraints is undefined");return err.name="NotFoundError",err.code=8,Promise.reject(err)}return!0===constraints.video?constraints.video={mediaSource:preferredMediaSource}:constraints.video.mediaSource=preferredMediaSource,window.navigator.mediaDevices.getUserMedia(constraints)}}},{}],36:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator,MediaStreamTrack=window&&window.MediaStreamTrack;if(navigator.getUserMedia=function(constraints,onSuccess,onError){utils.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),navigator.mediaDevices.getUserMedia(constraints).then(onSuccess,onError)},!(browserDetails.version>55&&"autoGainControl"in navigator.mediaDevices.getSupportedConstraints())){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])},nativeGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);if(navigator.mediaDevices.getUserMedia=function(c){return"object"===("undefined"==typeof c?"undefined":_typeof(c))&&"object"===_typeof(c.audio)&&(c=JSON.parse(JSON.stringify(c)),remap(c.audio,"autoGainControl","mozAutoGainControl"),remap(c.audio,"noiseSuppression","mozNoiseSuppression")),nativeGetUserMedia(c)},MediaStreamTrack&&MediaStreamTrack.prototype.getSettings){var nativeGetSettings=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var obj=nativeGetSettings.apply(this,arguments);return remap(obj,"mozAutoGainControl","autoGainControl"),remap(obj,"mozNoiseSuppression","noiseSuppression"),obj}}if(MediaStreamTrack&&MediaStreamTrack.prototype.applyConstraints){var nativeApplyConstraints=MediaStreamTrack.prototype.applyConstraints;MediaStreamTrack.prototype.applyConstraints=function(c){return"audio"===this.kind&&"object"===("undefined"==typeof c?"undefined":_typeof(c))&&(c=JSON.parse(JSON.stringify(c)),remap(c,"autoGainControl","mozAutoGainControl"),remap(c,"noiseSuppression","mozNoiseSuppression")),nativeApplyConstraints.apply(this,[c])}}}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":38}],37:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimLocalStreamsAPI=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getLocalStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams});if(!("addStream"in window.RTCPeerConnection.prototype)){var _addTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addStream=function(stream){var _this=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(stream)||this._localStreams.push(stream),stream.getAudioTracks().forEach((function(track){return _addTrack.call(_this,track,stream)})),stream.getVideoTracks().forEach((function(track){return _addTrack.call(_this,track,stream)}))},window.RTCPeerConnection.prototype.addTrack=function(track){for(var _this2=this,_len=arguments.length,streams=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)streams[_key-1]=arguments[_key];return streams&&streams.forEach((function(stream){_this2._localStreams?_this2._localStreams.includes(stream)||_this2._localStreams.push(stream):_this2._localStreams=[stream]})),_addTrack.apply(this,arguments)}}"removeStream"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._localStreams||(this._localStreams=[]);var index=this._localStreams.indexOf(stream);if(-1!==index){this._localStreams.splice(index,1);var tracks=stream.getTracks();this.getSenders().forEach((function(sender){tracks.includes(sender.track)&&_this3.removeTrack(sender)}))}})},exports.shimRemoteStreamsAPI=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getRemoteStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]});if(!("onaddstream"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(f){var _this4=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=f),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(_this4._remoteStreams||(_this4._remoteStreams=[]),!_this4._remoteStreams.includes(stream)){_this4._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,_this4.dispatchEvent(event)}}))})}});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var pc=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(pc._remoteStreams||(pc._remoteStreams=[]),!(pc._remoteStreams.indexOf(stream)>=0)){pc._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,pc.dispatchEvent(event)}}))}),origSetRemoteDescription.apply(pc,arguments)}}},exports.shimCallbacksAPI=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var prototype=window.RTCPeerConnection.prototype,origCreateOffer=prototype.createOffer,origCreateAnswer=prototype.createAnswer,setLocalDescription=prototype.setLocalDescription,setRemoteDescription=prototype.setRemoteDescription,addIceCandidate=prototype.addIceCandidate;prototype.createOffer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateOffer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.createAnswer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateAnswer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};var withCallback=function(description,successCallback,failureCallback){var promise=setLocalDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};prototype.setLocalDescription=withCallback,withCallback=function(description,successCallback,failureCallback){var promise=setRemoteDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.setRemoteDescription=withCallback,withCallback=function(candidate,successCallback,failureCallback){var promise=addIceCandidate.apply(this,[candidate]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.addIceCandidate=withCallback},exports.shimGetUserMedia=function(window){var navigator=window&&window.navigator;if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var mediaDevices=navigator.mediaDevices,_getUserMedia=mediaDevices.getUserMedia.bind(mediaDevices);navigator.mediaDevices.getUserMedia=function(constraints){return _getUserMedia(shimConstraints(constraints))}}!navigator.getUserMedia&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(navigator.getUserMedia=function(constraints,cb,errcb){navigator.mediaDevices.getUserMedia(constraints).then(cb,errcb)}.bind(navigator))},exports.shimConstraints=shimConstraints,exports.shimRTCIceServerUrls=function(window){if(!window.RTCPeerConnection)return;var OrigPeerConnection=window.RTCPeerConnection;window.RTCPeerConnection=function(pcConfig,pcConstraints){if(pcConfig&&pcConfig.iceServers){for(var newIceServers=[],i=0;i<pcConfig.iceServers.length;i++){var server=pcConfig.iceServers[i];!server.hasOwnProperty("urls")&&server.hasOwnProperty("url")?(utils.deprecated("RTCIceServer.url","RTCIceServer.urls"),(server=JSON.parse(JSON.stringify(server))).urls=server.url,delete server.url,newIceServers.push(server)):newIceServers.push(pcConfig.iceServers[i])}pcConfig.iceServers=newIceServers}return new OrigPeerConnection(pcConfig,pcConstraints)},window.RTCPeerConnection.prototype=OrigPeerConnection.prototype,"generateCertificate"in OrigPeerConnection&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return OrigPeerConnection.generateCertificate}})},exports.shimTrackEventTransceiver=function(window){"object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCTrackEvent&&"receiver"in window.RTCTrackEvent.prototype&&!("transceiver"in window.RTCTrackEvent.prototype)&&Object.defineProperty(window.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},exports.shimCreateOfferLegacy=function(window){var origCreateOffer=window.RTCPeerConnection.prototype.createOffer;window.RTCPeerConnection.prototype.createOffer=function(offerOptions){if(offerOptions){"undefined"!=typeof offerOptions.offerToReceiveAudio&&(offerOptions.offerToReceiveAudio=!!offerOptions.offerToReceiveAudio);var audioTransceiver=this.getTransceivers().find((function(transceiver){return"audio"===transceiver.receiver.track.kind}));!1===offerOptions.offerToReceiveAudio&&audioTransceiver?"sendrecv"===audioTransceiver.direction?audioTransceiver.setDirection?audioTransceiver.setDirection("sendonly"):audioTransceiver.direction="sendonly":"recvonly"===audioTransceiver.direction&&(audioTransceiver.setDirection?audioTransceiver.setDirection("inactive"):audioTransceiver.direction="inactive"):!0!==offerOptions.offerToReceiveAudio||audioTransceiver||this.addTransceiver("audio"),"undefined"!=typeof offerOptions.offerToReceiveVideo&&(offerOptions.offerToReceiveVideo=!!offerOptions.offerToReceiveVideo);var videoTransceiver=this.getTransceivers().find((function(transceiver){return"video"===transceiver.receiver.track.kind}));!1===offerOptions.offerToReceiveVideo&&videoTransceiver?"sendrecv"===videoTransceiver.direction?videoTransceiver.setDirection?videoTransceiver.setDirection("sendonly"):videoTransceiver.direction="sendonly":"recvonly"===videoTransceiver.direction&&(videoTransceiver.setDirection?videoTransceiver.setDirection("inactive"):videoTransceiver.direction="inactive"):!0!==offerOptions.offerToReceiveVideo||videoTransceiver||this.addTransceiver("video")}return origCreateOffer.apply(this,arguments)}},exports.shimAudioContext=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||window.AudioContext)return;window.AudioContext=window.webkitAudioContext};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"));function shimConstraints(constraints){return constraints&&void 0!==constraints.video?Object.assign({},constraints,{video:utils.compactObject(constraints.video)}):constraints}},{"../utils":38}],38:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.extractVersion=extractVersion,exports.wrapPeerConnectionEvent=function(window,eventNameToWrap,wrapper){if(!window.RTCPeerConnection)return;var proto=window.RTCPeerConnection.prototype,nativeAddEventListener=proto.addEventListener;proto.addEventListener=function(nativeEventName,cb){if(nativeEventName!==eventNameToWrap)return nativeAddEventListener.apply(this,arguments);var wrappedCallback=function(e){var modifiedEvent=wrapper(e);modifiedEvent&&(cb.handleEvent?cb.handleEvent(modifiedEvent):cb(modifiedEvent))};return this._eventMap=this._eventMap||{},this._eventMap[eventNameToWrap]||(this._eventMap[eventNameToWrap]=new Map),this._eventMap[eventNameToWrap].set(cb,wrappedCallback),nativeAddEventListener.apply(this,[nativeEventName,wrappedCallback])};var nativeRemoveEventListener=proto.removeEventListener;proto.removeEventListener=function(nativeEventName,cb){if(nativeEventName!==eventNameToWrap||!this._eventMap||!this._eventMap[eventNameToWrap])return nativeRemoveEventListener.apply(this,arguments);if(!this._eventMap[eventNameToWrap].has(cb))return nativeRemoveEventListener.apply(this,arguments);var unwrappedCb=this._eventMap[eventNameToWrap].get(cb);return this._eventMap[eventNameToWrap].delete(cb),0===this._eventMap[eventNameToWrap].size&&delete this._eventMap[eventNameToWrap],0===Object.keys(this._eventMap).length&&delete this._eventMap,nativeRemoveEventListener.apply(this,[nativeEventName,unwrappedCb])},Object.defineProperty(proto,"on"+eventNameToWrap,{get:function(){return this["_on"+eventNameToWrap]},set:function(cb){this["_on"+eventNameToWrap]&&(this.removeEventListener(eventNameToWrap,this["_on"+eventNameToWrap]),delete this["_on"+eventNameToWrap]),cb&&this.addEventListener(eventNameToWrap,this["_on"+eventNameToWrap]=cb)},enumerable:!0,configurable:!0})},exports.disableLog=function(bool){if("boolean"!=typeof bool)return new Error("Argument type: "+("undefined"==typeof bool?"undefined":_typeof(bool))+". Please use a boolean.");return logDisabled_=bool,bool?"adapter.js logging disabled":"adapter.js logging enabled"},exports.disableWarnings=function(bool){if("boolean"!=typeof bool)return new Error("Argument type: "+("undefined"==typeof bool?"undefined":_typeof(bool))+". Please use a boolean.");return deprecationWarnings_=!bool,"adapter.js deprecation warnings "+(bool?"disabled":"enabled")},exports.log=function(){if("object"===("undefined"==typeof window?"undefined":_typeof(window))){if(logDisabled_)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},exports.deprecated=function(oldMethod,newMethod){if(!deprecationWarnings_)return;console.warn(oldMethod+" is deprecated, please use "+newMethod+" instead.")},exports.detectBrowser=function(window){var result={browser:null,version:null};if("undefined"==typeof window||!window.navigator)return result.browser="Not a browser.",result;var navigator=window.navigator;if(navigator.mozGetUserMedia)result.browser="firefox",result.version=extractVersion(navigator.userAgent,/Firefox\/(\d+)\./,1);else if(navigator.webkitGetUserMedia||!1===window.isSecureContext&&window.webkitRTCPeerConnection&&!window.RTCIceGatherer)result.browser="chrome",result.version=extractVersion(navigator.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))result.browser="edge",result.version=extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!window.RTCPeerConnection||!navigator.userAgent.match(/AppleWebKit\/(\d+)\./))return result.browser="Not a supported browser.",result;result.browser="safari",result.version=extractVersion(navigator.userAgent,/AppleWebKit\/(\d+)\./,1),result.supportsUnifiedPlan=window.RTCRtpTransceiver&&"currentDirection"in window.RTCRtpTransceiver.prototype}return result},exports.compactObject=function compactObject(data){if(!isObject(data))return data;return Object.keys(data).reduce((function(accumulator,key){var isObj=isObject(data[key]),value=isObj?compactObject(data[key]):data[key],isEmptyObject=isObj&&!Object.keys(value).length;return void 0===value||isEmptyObject?accumulator:Object.assign(accumulator,function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value;return obj}({},key,value))}),{})},exports.walkStats=walkStats,exports.filterStats=function(result,track,outbound){var streamStatsType=outbound?"outbound-rtp":"inbound-rtp",filteredResult=new Map;if(null===track)return filteredResult;var trackStats=[];return result.forEach((function(value){"track"===value.type&&value.trackIdentifier===track.id&&trackStats.push(value)})),trackStats.forEach((function(trackStat){result.forEach((function(stats){stats.type===streamStatsType&&stats.trackId===trackStat.id&&walkStats(result,stats,filteredResult)}))})),filteredResult};var logDisabled_=!0,deprecationWarnings_=!0;function extractVersion(uastring,expr,pos){var match=uastring.match(expr);return match&&match.length>=pos&&parseInt(match[pos],10)}function isObject(val){return"[object Object]"===Object.prototype.toString.call(val)}function walkStats(stats,base,resultSet){base&&!resultSet.has(base.id)&&(resultSet.set(base.id,base),Object.keys(base).forEach((function(name){name.endsWith("Id")?walkStats(stats,stats.get(base[name]),resultSet):name.endsWith("Ids")&&base[name].forEach((function(id){walkStats(stats,stats.get(id),resultSet)}))})))}},{}],39:[function(require,module,exports){var _0x56e2ba,_0x54ffbb,_0x8674=["feedDecoder","postMessage","now","getBufferTimeLength","Unknown request","bind","audioChunkLength","context","sampleRate","videoWidth","videoHeight","token","dropDelayMultiplier","Failed to init stream receiver ","videoDecoder","decoderPath","onmessage","No timestamp available for decoded picture, discarding","shift","STOPPED","audioBuffer","sync","start","setVolume","requestVideoFrameCallback","Failed to init video decoder ","fps","framesRendered","noDataSince","prototype","receivedIframe","lastPlayedVideoTime","kframe","decode","payload","play","stream","STARTUP","playFirstSound","createBuffer","getChannelData","random","createBufferSource","buffer","connect","destination","mute","PAUSED","unmute","resume","getVolume","lastFpsTime","lastPlayedVideoTimestamp","log","trace","requestVideoFrameCallback, audio player time "," callback timestamp ","render","playing","dispatchEvent","riseApiEvent","lastEventRised","PLAYBACK_PROBLEM","logToCanvas","ctx2D","height","fillStyle","black","font","textAlign","center","width","40pt","fillText","initLogger","verbosity","console","apply","warn","wsLogger","debug","renderFunction","force2D","YTexture","CBTexture","CRTexture","RGBTexture","rgbaBuffer","mbWidth","codedWidth","halfWidth","precision mediump float;","uniform sampler2D CBTexture;","void main() {","float y = texture2D(YTexture, texCoord).r;","float cb = texture2D(CBTexture, texCoord).r - 0.5;","gl_FragColor = vec4(","y + -0.343 * cb - 0.711 * cr,","1.0","join","attribute vec2 vertex;","varying vec2 texCoord;","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","SHADER_VERTEX_IDENTITY_RGBA","varying vec2 tc;","void main(){","gl_Position = vertex;","SHADER_FRAGMENT_RGBA","uniform sampler2D RGBTexture;","gl_FragColor = texture2D(RGBTexture, tc);","getContext","experimental-webgl","inputFormat","rgba","initWebGLRGB","initWebGLYUV","renderFrame2D","bindBuffer","ARRAY_BUFFER","bufferData","STATIC_DRAW","program","attachShader","compileShader","SHADER_VERTEX_IDENTITY_YUV","FRAGMENT_SHADER","SHADER_FRAGMENT_YCBCRTORGBA","linkProgram","getProgramParameter","Failed to init WebGL! Message ","getProgramInfoLog","useProgram","createTexture","getAttribLocation","vertex","enableVertexAttribArray","vertexAttribPointer","createProgram","bindAttribLocation","FLOAT","renderFrameGLRGB","undefined","createImageData","putImageData","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","TEXTURE_2D","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","CLAMP_TO_EDGE","TEXTURE_WRAP_T","getUniformLocation","createShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","isUsingWebGL","activeTexture","bindTexture","texImage2D","LUMINANCE","UNSIGNED_BYTE","TEXTURE1","TEXTURE2","drawArrays","TRIANGLE_STRIP","TEXTURE0","RGBA","TRIANGLES","type","YCbCrToRGBA","set","Changing canvas resolution from "," to ","lastTimeRendered","getLastTimeRendered","nodeConnected","gainNode","createGain","abs","Audio node buffer size ","internalBufferSize","createScriptProcessor","audioJSNode","previousSync","lastSync","lastSyncTime","playbackTime","value","disconnect","resetBuffers","playAudio","getBufferLength","currentTime","audioChunkTimeLength","No audio! ","previousSyncTime","Audio player mute","gain","Audio player resume","setTimeout","state","initialized","init","canvas","api","configuration","initBuffers","initialVolume","audioPlayer","error","Failed to init audio player ","yuv","videoRenderer","Failed to init video renderer ","receiver","terminate","receiverPath","addEventListener","message","data","status","failed","closed","stop","AVData","audioLength","audioReceived","audio","length","videoLength","Received video, frames:","videoReceived","video","videoBuffer","push","videoFrameTimeLength","getCurrentSync","PLAYING","muted","decodedVideoBuffer","tsVideoWaitingList"];_0x56e2ba=_0x8674,_0x54ffbb=450,function(_0x5bd6fa){for(;--_0x5bd6fa;)_0x56e2ba.push(_0x56e2ba.shift())}(++_0x54ffbb);var _0x162a=function(_0x289e5c,_0x18e4c1){return _0x8674[_0x289e5c-=0]},requestAnimFrame=function(_0x452c50){window[_0x162a("0x0")](_0x452c50,1e3/30)};function WSPlayer(){this[_0x162a("0x1")]=WSPlayerState.STOPPED,this[_0x162a("0x2")]=!1}WSPlayer.prototype[_0x162a("0x3")]=function(_0x566b31,_0x2633b5,_0x439354){this.canvas=_0x566b31[_0x162a("0x4")],this[_0x162a("0x5")]=_0x566b31[_0x162a("0x5")],this[_0x162a("0x6")]=_0x566b31,this[_0x162a("0x7")](),this[_0x162a("0x8")]=-1;try{this[_0x162a("0x9")]=new AudioPlayer(_0x2633b5)}catch(_0x388ad2){return void wsLogger[_0x162a("0xa")](_0x162a("0xb")+_0x388ad2)}try{this.videoRenderer=new VideoRenderer(this[_0x162a("0x4")],!1,_0x162a("0xc")),this[_0x162a("0xd")].init()}catch(_0x4a3ba3){return void wsLogger.error(_0x162a("0xe")+_0x4a3ba3)}if(!_0x439354)try{this[_0x162a("0xf")]&&this[_0x162a("0xf")][_0x162a("0x10")](),this[_0x162a("0xf")]=new Worker(_0x566b31[_0x162a("0x11")]),this.receiver[_0x162a("0x12")](_0x162a("0x13"),function(_0xd32be3){switch(_0xd32be3[_0x162a("0x14")][_0x162a("0x13")]){case"connection":_0xd32be3[_0x162a("0x14")][_0x162a("0x15")]!=_0x162a("0x16")&&_0xd32be3[_0x162a("0x14")][_0x162a("0x15")]!=_0x162a("0x17")||(this[_0x162a("0x18")](),this[_0x162a("0x2")]=!1);break;case _0x162a("0x19"):var _0x223990;if(_0xd32be3[_0x162a("0x14")][_0x162a("0x1a")]>0)for(this[_0x162a("0x1b")]=!0,_0x223990=0;_0x223990<_0xd32be3[_0x162a("0x14")][_0x162a("0x1c")][_0x162a("0x1d")];_0x223990++)this[_0x162a("0x9")].playAudio(_0xd32be3.data.audio[_0x223990]);if(_0xd32be3[_0x162a("0x14")][_0x162a("0x1e")]>0){for(wsLogger.debug(_0x162a("0x1f")+_0xd32be3[_0x162a("0x14")].videoLength),this[_0x162a("0x20")]=!0,_0x223990=0;_0x223990<_0xd32be3[_0x162a("0x14")][_0x162a("0x21")][_0x162a("0x1d")];_0x223990++)this[_0x162a("0x22")][_0x162a("0x23")](_0xd32be3[_0x162a("0x14")].video[_0x223990]);this[_0x162a("0x24")]=_0xd32be3[_0x162a("0x14")][_0x162a("0x1e")]/_0xd32be3.data.video[_0x162a("0x1d")]}var _0x3677b1=this[_0x162a("0x9")][_0x162a("0x25")]();if(this[_0x162a("0x22")][_0x162a("0x1d")]>0)if(this[_0x162a("0x1")]==WSPlayerState[_0x162a("0x26")])if(this[_0x162a("0xd")][_0x162a("0x27")])for(this[_0x162a("0x28")][_0x162a("0x1d")]=0,this[_0x162a("0x29")][_0x162a("0x1d")]=0;this[_0x162a("0x22")][_0x162a("0x1d")]>0&&this.videoBuffer[0].ts<_0x3677b1+50;)this.feedDecoder();else this[_0x162a("0x29")][_0x162a("0x1d")]<2&&this.feedDecoder();else for(;this[_0x162a("0x2a")](););this.receiver[_0x162a("0x2b")]({message:"ack",data:{seq:_0xd32be3[_0x162a("0x14")].seq,time:Date[_0x162a("0x2c")](),audioReceivedLength:_0xd32be3[_0x162a("0x14")][_0x162a("0x1a")],videoReceivedLength:_0xd32be3[_0x162a("0x14")][_0x162a("0x1e")],audioCurrentTime:_0x3677b1,audioBufferTimeLength:this.audioPlayer[_0x162a("0x2d")](),videoBufferTimeLength:(this[_0x162a("0x22")].length+this[_0x162a("0x29")][_0x162a("0x1d")]+this[_0x162a("0x28")].length)*this[_0x162a("0x24")]}});break;default:wsLogger[_0x162a("0xa")](_0x162a("0x2e"))}}[_0x162a("0x2f")](this),!1);var _0x56370c={};_0x56370c[_0x162a("0x30")]=this[_0x162a("0x9")].internalBufferSize,_0x56370c.audioContextSampleRate=this[_0x162a("0x9")][_0x162a("0x31")][_0x162a("0x32")],_0x56370c[_0x162a("0x33")]=_0x566b31[_0x162a("0x33")],_0x56370c[_0x162a("0x34")]=_0x566b31[_0x162a("0x34")],_0x56370c.urlWsServer=_0x566b31.urlWsServer,_0x56370c[_0x162a("0x35")]=_0x566b31[_0x162a("0x35")],_0x56370c.audioBufferWaitFor=_0x566b31.audioBufferWaitFor,_0x56370c.videoBufferWaitFor=_0x566b31.videoBufferWaitFor,_0x56370c.dropDelayMultiplier=_0x566b31[_0x162a("0x36")],this[_0x162a("0xf")][_0x162a("0x2b")]({message:_0x162a("0x3"),data:_0x56370c})}catch(_0x2e5046){return void wsLogger[_0x162a("0xa")](_0x162a("0x37")+_0x2e5046)}try{this[_0x162a("0x38")]&&this[_0x162a("0x38")][_0x162a("0x10")](),this[_0x162a("0x38")]=new Worker(_0x566b31[_0x162a("0x39")]),this.videoDecoder[_0x162a("0x3a")]=function(_0x67846e){0!=this[_0x162a("0x29")][_0x162a("0x1d")]?(_0x67846e.data.sync=this[_0x162a("0x29")][_0x162a("0x3c")](),this.decodedVideoBuffer.push(_0x67846e[_0x162a("0x14")]),this.state!=WSPlayerState.PLAYING&&this[_0x162a("0x1")]!=WSPlayerState[_0x162a("0x3d")]?this[_0x162a("0x28")][_0x162a("0x1d")]<5?(this[_0x162a("0x28")].length>1&&this[_0x162a("0x9")][_0x162a("0x3e")][_0x162a("0x1d")]>0&&this[_0x162a("0x9")][_0x162a("0x3e")][0][_0x162a("0x3f")]>this.decodedVideoBuffer[0].sync&&(this[_0x162a("0x28")][0]=null,this[_0x162a("0x28")].shift()),this[_0x162a("0x2a")]()):(this[_0x162a("0x1")]=WSPlayerState.PLAYING,this.audioPlayer[_0x162a("0x40")](),-1!=this[_0x162a("0x8")]&&(this[_0x162a("0x41")](this[_0x162a("0x8")]),this[_0x162a("0x8")]=-1),requestAnimFrame(this[_0x162a("0x42")].bind(this))):this[_0x162a("0x29")][_0x162a("0x1d")]<2&&this.feedDecoder()):wsLogger.warn(_0x162a("0x3b"))}[_0x162a("0x2f")](this),this[_0x162a("0x38")][_0x162a("0x2b")]({message:"init",width:_0x566b31[_0x162a("0x33")],height:_0x566b31[_0x162a("0x34")],outputGl:!0})}catch(_0x5236ab){return void wsLogger[_0x162a("0xa")](_0x162a("0x43")+_0x5236ab)}this[_0x162a("0x44")]=0,this.lastFpsTime=0,this[_0x162a("0x45")]=0,this.noDataFlag=!1,this[_0x162a("0x46")]=0,this.initialized=!0},WSPlayer[_0x162a("0x47")][_0x162a("0x7")]=function(){this[_0x162a("0x1b")]=!1,this[_0x162a("0x20")]=!1,this[_0x162a("0x22")]?this[_0x162a("0x22")][_0x162a("0x1d")]=0:this[_0x162a("0x22")]=[],this.tsVideoWaitingList?this[_0x162a("0x29")][_0x162a("0x1d")]=0:this[_0x162a("0x29")]=[],this.decodedVideoBuffer?this[_0x162a("0x28")].length=0:this[_0x162a("0x28")]=[],this[_0x162a("0x48")]=!1,this[_0x162a("0x49")]=0,this.lastPlayedVideoTimestamp=0},WSPlayer.prototype[_0x162a("0x2a")]=function(){if(this[_0x162a("0x22")][_0x162a("0x1d")]>0){if(this[_0x162a("0x48")]||this[_0x162a("0x22")][0][_0x162a("0x4a")])return this[_0x162a("0x48")]=!0,this.videoRenderer[_0x162a("0x27")]||this.tsVideoWaitingList[_0x162a("0x23")](this[_0x162a("0x22")][0].ts),this.videoDecoder[_0x162a("0x2b")]({message:_0x162a("0x4b"),skip:this[_0x162a("0xd")][_0x162a("0x27")],data:this[_0x162a("0x22")][0][_0x162a("0x4c")]},[this.videoBuffer[0][_0x162a("0x4c")].buffer]),this[_0x162a("0x22")][0]=null,this[_0x162a("0x22")][_0x162a("0x3c")](),!0;this[_0x162a("0x22")][0]=null,this.videoBuffer[_0x162a("0x3c")]()}},WSPlayer.prototype[_0x162a("0x4d")]=function(_0x394048){this.initialized?(this[_0x162a("0x7")](),this.receiver[_0x162a("0x2b")]({message:_0x162a("0x4d")}),this[_0x162a("0x4e")]=_0x394048,this.unmute(),this[_0x162a("0x1")]=WSPlayerState[_0x162a("0x4f")]):wsLogger.error("Can't play stream, player not initialized!")},WSPlayer[_0x162a("0x47")][_0x162a("0x50")]=function(){for(var _0x17a93a=this[_0x162a("0x9")][_0x162a("0x31")][_0x162a("0x51")](1,441,44100),_0x311ab3=_0x17a93a[_0x162a("0x52")](0),_0x455a72=0;_0x455a72<_0x311ab3.length;_0x455a72++)_0x311ab3[_0x455a72]=2*Math[_0x162a("0x53")]()-1;var _0x2b7b90=this[_0x162a("0x9")][_0x162a("0x31")][_0x162a("0x54")]();_0x2b7b90[_0x162a("0x55")]=_0x17a93a,_0x2b7b90[_0x162a("0x56")](this.audioPlayer[_0x162a("0x31")][_0x162a("0x57")]),_0x2b7b90[_0x162a("0x40")](0)},WSPlayer[_0x162a("0x47")].pause=function(){this[_0x162a("0x58")](),this[_0x162a("0xf")][_0x162a("0x2b")]({message:"pause"}),this[_0x162a("0x1")]=WSPlayerState[_0x162a("0x59")]},WSPlayer.prototype[_0x162a("0x58")]=function(){this[_0x162a("0x9")]&&this[_0x162a("0x9")][_0x162a("0x58")](!0),this[_0x162a("0xd")]&&this[_0x162a("0xd")][_0x162a("0x58")](!0)},WSPlayer[_0x162a("0x47")][_0x162a("0x5a")]=function(){this.audioPlayer&&this[_0x162a("0x9")].mute(!1),this.videoRenderer&&this[_0x162a("0xd")][_0x162a("0x58")](!1)},WSPlayer[_0x162a("0x47")][_0x162a("0x5b")]=function(){this[_0x162a("0x7")](),this[_0x162a("0x1")]=WSPlayerState[_0x162a("0x4f")],this[_0x162a("0xf")][_0x162a("0x2b")]({message:_0x162a("0x5b")}),this.unmute()},WSPlayer.prototype.setVolume=function(_0x5a1f09){this[_0x162a("0x1")]==WSPlayerState[_0x162a("0x26")]?this[_0x162a("0x9")][_0x162a("0x41")](_0x5a1f09):this[_0x162a("0x8")]=_0x5a1f09},WSPlayer[_0x162a("0x47")][_0x162a("0x5c")]=function(){return this[_0x162a("0x9")].getVolume()},WSPlayer[_0x162a("0x47")][_0x162a("0x18")]=function(){this.state=WSPlayerState[_0x162a("0x3d")],this[_0x162a("0xf")]&&this[_0x162a("0xf")][_0x162a("0x2b")]({message:_0x162a("0x18")}),this[_0x162a("0x9")]&&this[_0x162a("0x9")].stop(),this[_0x162a("0xd")]&&this[_0x162a("0xd")][_0x162a("0x18")](),this.fps=0,this[_0x162a("0x5d")]=0,this[_0x162a("0x45")]=0},WSPlayer[_0x162a("0x47")][_0x162a("0x42")]=function(_0x253d91){if(this[_0x162a("0x1")]==WSPlayerState[_0x162a("0x26")]){if(this[_0x162a("0x28")][_0x162a("0x1d")]>0){var _0x813081=this[_0x162a("0x9")][_0x162a("0x25")]();if(-1==_0x813081){var _0x44a14e=Date[_0x162a("0x2c")]();if(0==this[_0x162a("0x49")])_0x813081=this[_0x162a("0x28")][0].sync,this[_0x162a("0x49")]=_0x44a14e,this[_0x162a("0x5e")]=_0x813081,wsLogger[_0x162a("0x5f")]("Init Video playout without sync, currentTime "+_0x44a14e+", timestamp "+this.lastPlayedVideoTimestamp);else{var _0x393d46=_0x44a14e-this[_0x162a("0x49")],_0x160d46=this.decodedVideoBuffer[0][_0x162a("0x3f")]-this.lastPlayedVideoTimestamp;_0x393d46>=_0x160d46?(_0x813081=this[_0x162a("0x28")][0].sync,this[_0x162a("0x49")]+=_0x160d46,this[_0x162a("0x5e")]=_0x813081):_0x813081=this[_0x162a("0x28")][0][_0x162a("0x3f")]-1}}if(wsLogger[_0x162a("0x60")](_0x162a("0x61")+_0x813081+_0x162a("0x62")+_0x253d91),_0x813081-this[_0x162a("0x28")][0][_0x162a("0x3f")]>100&&this[_0x162a("0x28")].length>1&&this[_0x162a("0x28")][_0x162a("0x3c")](),this[_0x162a("0x28")][0][_0x162a("0x3f")]<=_0x813081&&(this.videoRenderer[_0x162a("0x63")](this[_0x162a("0x28")].shift()),this.framesRendered++,1==this[_0x162a("0x45")])){var _0x2e90ca=this[_0x162a("0x4")];setTimeout((function(){var _0x1e1c6f=new CustomEvent(_0x162a("0x64"));_0x2e90ca[_0x162a("0x65")](_0x1e1c6f)}),10)}}this[_0x162a("0x29")][_0x162a("0x1d")]<3&&this.feedDecoder(),requestAnimFrame(this[_0x162a("0x42")].bind(this))}},WSPlayer[_0x162a("0x47")][_0x162a("0x66")]=function(_0x35dabe){if(!(this[_0x162a("0x67")]&&Date[_0x162a("0x2c")]()-this.lastEventRised<1e3)){var _0x54b410={status:_0x162a("0x68"),info:_0x35dabe};this[_0x162a("0x5")](_0x54b410),this[_0x162a("0x67")]=Date.now()}},WSPlayer[_0x162a("0x47")][_0x162a("0x69")]=function(_0x3c7c23){var _0x248bc3=this[_0x162a("0xd")][_0x162a("0x6a")];if(_0x248bc3){_0x248bc3.measureText(_0x3c7c23);_0x248bc3.fillStyle="white";_0x248bc3.fillRect(0,this.canvas[_0x162a("0x6b")]/2-15,this[_0x162a("0x4")].width,30),_0x248bc3[_0x162a("0x6c")]=_0x162a("0x6d"),_0x248bc3[_0x162a("0x6e")]="30pt",_0x248bc3[_0x162a("0x6f")]=_0x162a("0x70"),_0x248bc3.fillText(_0x3c7c23,this[_0x162a("0x4")][_0x162a("0x71")]/2,this[_0x162a("0x4")][_0x162a("0x6b")]/2)}},WSPlayer[_0x162a("0x47")].fpsToCanvas=function(_0x48eb03){var _0x4b03da=this[_0x162a("0xd")][_0x162a("0x6a")];_0x4b03da&&(_0x4b03da[_0x162a("0x6c")]="red",_0x4b03da[_0x162a("0x6e")]=_0x162a("0x72"),_0x4b03da[_0x162a("0x73")](_0x48eb03,20,this.canvas[_0x162a("0x6b")]-20))},WSPlayer.prototype[_0x162a("0x74")]=function(_0x43edeb){this[_0x162a("0x75")]=_0x43edeb||2;var _0x556035=this;null==window.wsLogger&&(window.wsLogger={log:function(){_0x556035[_0x162a("0x75")]>=2&&window[_0x162a("0x76")][_0x162a("0x5f")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)},warn:function(){_0x556035[_0x162a("0x75")]>=1&&window[_0x162a("0x76")][_0x162a("0x78")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)},error:function(){_0x556035[_0x162a("0x75")]>=0&&window[_0x162a("0x76")][_0x162a("0xa")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)},debug:function(){_0x556035[_0x162a("0x75")]>=3&&window.console[_0x162a("0x5f")][_0x162a("0x77")](window.console,arguments)},trace:function(){_0x556035[_0x162a("0x75")]>=4&&window.console[_0x162a("0x5f")].apply(window[_0x162a("0x76")],arguments)}}),null==window[_0x162a("0x79")][_0x162a("0x7a")]&&(window.wsLogger.debug=function(){_0x556035[_0x162a("0x75")]>=3&&window[_0x162a("0x76")][_0x162a("0x5f")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)}),null==window.wsLogger[_0x162a("0x60")]&&(window.wsLogger[_0x162a("0x60")]=function(){_0x556035[_0x162a("0x75")]>=4&&window[_0x162a("0x76")][_0x162a("0x5f")].apply(window[_0x162a("0x76")],arguments)})},WSPlayer[_0x162a("0x47")].getStreamStatistics=function(_0x351dd5){return _0x351dd5==_0x162a("0x1c")?this.audioReceived:_0x351dd5==_0x162a("0x21")?this[_0x162a("0x20")]:void 0};var VideoRenderer=function(_0x2008fb,_0x328799,_0x5c39da){this[_0x162a("0x4")]=_0x2008fb,this[_0x162a("0x71")]=_0x2008fb[_0x162a("0x71")],this.height=_0x2008fb.height,this[_0x162a("0x7b")]=null,this[_0x162a("0x6a")]=null,this[_0x162a("0x7c")]=_0x328799,this.inputFormat=_0x5c39da,this.gl=null,this.program=null,this[_0x162a("0x55")]=null,this[_0x162a("0x7d")]=null,this[_0x162a("0x7e")]=null,this[_0x162a("0x7f")]=null,this[_0x162a("0x80")]=null,this[_0x162a("0x81")]=null,this[_0x162a("0x82")]=null,this[_0x162a("0x83")]=null,this[_0x162a("0x84")]=null,this.muted=!1,this.SHADER_FRAGMENT_YCBCRTORGBA=[_0x162a("0x85"),"uniform sampler2D YTexture;",_0x162a("0x86"),"uniform sampler2D CRTexture;","varying vec2 texCoord;",_0x162a("0x87"),_0x162a("0x88"),"float cr = texture2D(CRTexture, texCoord).r - 0.5;",_0x162a("0x89"),_0x162a("0x8a"),"y + 1.4 * cr,",_0x162a("0x8b"),"y + 1.765 * cb,",_0x162a("0x8c"),");","}"][_0x162a("0x8d")]("\n"),this.SHADER_VERTEX_IDENTITY_YUV=[_0x162a("0x8e"),_0x162a("0x8f"),"void main() {",_0x162a("0x90"),_0x162a("0x91"),"}"][_0x162a("0x8d")]("\n"),this[_0x162a("0x92")]=["attribute vec4 vertex;",_0x162a("0x93"),_0x162a("0x94"),_0x162a("0x95"),"tc = vertex.xy*0.5+0.5;","}"][_0x162a("0x8d")]("\n"),this[_0x162a("0x96")]=["precision mediump float;",_0x162a("0x97"),"varying vec2 tc;","void main(){",_0x162a("0x98"),"}"][_0x162a("0x8d")]("\n")};function AudioPlayer(_0x21395c){var _0xfdbf8=this;this[_0x162a("0x7")](),this[_0x162a("0xde")]=!1,this[_0x162a("0x31")]=_0x21395c,this[_0x162a("0xdf")]=_0x21395c[_0x162a("0xe0")](),this[_0x162a("0xdf")][_0x162a("0x56")](_0x21395c.destination),this[_0x162a("0x58")](!0),wsLogger[_0x162a("0x5f")]("Sample rate "+this[_0x162a("0x31")][_0x162a("0x32")]);var _0x4a5353,_0x363810=[];for(_0x4a5353=256;_0x4a5353<=16384;_0x4a5353*=2)_0x363810[_0x162a("0x23")](_0x4a5353);var _0x4d6dd9=this[_0x162a("0x31")][_0x162a("0x32")]/1,_0x3b65d4=_0x363810[0],_0x4e4e5e=Math[_0x162a("0xe1")](_0x4d6dd9-_0x3b65d4);for(_0x4a5353=0;_0x4a5353<_0x363810.length;_0x4a5353++){var _0xec6c77=Math[_0x162a("0xe1")](_0x4d6dd9-_0x363810[_0x4a5353]);_0xec6c77<_0x4e4e5e&&(_0x4e4e5e=_0xec6c77,_0x3b65d4=_0x363810[_0x4a5353])}wsLogger[_0x162a("0x5f")](_0x162a("0xe2")+_0x3b65d4),this[_0x162a("0xe3")]=_0x3b65d4,this.audioChunkTimeLength=this.internalBufferSize/this[_0x162a("0x31")][_0x162a("0x32")]*1e3;try{this[_0x162a("0x31")][_0x162a("0xe4")]=this[_0x162a("0x31")].createScriptProcessor||this.context.createJavaScriptNode,this.audioJSNode=this[_0x162a("0x31")].createScriptProcessor(this[_0x162a("0xe3")],1,1)}catch(_0x5e2288){wsLogger[_0x162a("0xa")]("JS Audio Node is not supported in this browser"+_0x5e2288)}this[_0x162a("0xe5")].onaudioprocess=function(_0x26db61){var _0x4a5353,_0x163877=_0x26db61.outputBuffer[_0x162a("0x52")](0);if(_0xfdbf8[_0x162a("0x3e")][_0x162a("0x1d")]>0){var _0x1d8762=_0xfdbf8[_0x162a("0x3e")][_0x162a("0x3c")]();for(_0x4a5353=0;_0x4a5353<_0x163877.length;_0x4a5353++)_0x163877[_0x4a5353]=_0x1d8762[_0x162a("0x4c")][_0x4a5353];_0xfdbf8.lastSync?_0xfdbf8[_0x162a("0xe6")]=_0xfdbf8[_0x162a("0xe7")]:_0xfdbf8.previousSync=_0x1d8762[_0x162a("0x3f")],_0xfdbf8.lastSync=_0x1d8762[_0x162a("0x3f")],_0xfdbf8[_0x162a("0xe8")]?_0xfdbf8.previousSyncTime=_0xfdbf8[_0x162a("0xe8")]:_0xfdbf8.previousSyncTime=1e3*_0x26db61[_0x162a("0xe9")],_0xfdbf8.lastSyncTime=1e3*_0x26db61[_0x162a("0xe9")],_0xfdbf8.bufferExhausted=!1}else{for(_0x4a5353=0;_0x4a5353<_0x163877.length;_0x4a5353++)_0x163877[_0x4a5353]=0;_0xfdbf8.bufferExhausted=!0,0!=_0xfdbf8[_0x162a("0xdf")].gain[_0x162a("0xea")]&&wsLogger[_0x162a("0x7a")]("No audio in audio buffer!")}}}VideoRenderer[_0x162a("0x47")].init=function(){if(!this[_0x162a("0x7c")])try{var _0x1a7035=this.gl=this[_0x162a("0x4")][_0x162a("0x99")]("webgl")||this[_0x162a("0x4")][_0x162a("0x99")](_0x162a("0x9a"))}catch(_0x1fa2db){wsLogger[_0x162a("0xa")]("Failed to get webgl context, error "+_0x1fa2db)}_0x1a7035?this[_0x162a("0x9b")]==_0x162a("0x9c")?this[_0x162a("0x9d")](_0x1a7035):this[_0x162a("0x9e")](_0x1a7035):(this[_0x162a("0x6a")]=this[_0x162a("0x4")][_0x162a("0x99")]("2d"),this.renderFunction=this[_0x162a("0x9f")]),this[_0x162a("0x7")]()},VideoRenderer[_0x162a("0x47")][_0x162a("0x9e")]=function(_0x4f5fef){if(this[_0x162a("0x55")]=_0x4f5fef[_0x162a("0x51")](),_0x4f5fef[_0x162a("0xa0")](_0x4f5fef[_0x162a("0xa1")],this.buffer),_0x4f5fef[_0x162a("0xa2")](_0x4f5fef[_0x162a("0xa1")],new Float32Array([0,0,0,1,1,0,1,1]),_0x4f5fef[_0x162a("0xa3")]),this[_0x162a("0xa4")]=_0x4f5fef.createProgram(),_0x4f5fef[_0x162a("0xa5")](this.program,this[_0x162a("0xa6")](_0x4f5fef.VERTEX_SHADER,this[_0x162a("0xa7")])),_0x4f5fef[_0x162a("0xa5")](this[_0x162a("0xa4")],this[_0x162a("0xa6")](_0x4f5fef[_0x162a("0xa8")],this[_0x162a("0xa9")])),_0x4f5fef[_0x162a("0xaa")](this[_0x162a("0xa4")]),!_0x4f5fef[_0x162a("0xab")](this.program,_0x4f5fef.LINK_STATUS))return wsLogger[_0x162a("0xa")](_0x162a("0xac")+_0x4f5fef[_0x162a("0xad")](this[_0x162a("0xa4")])),this.ctx2D=this[_0x162a("0x4")][_0x162a("0x99")]("2d"),void(this.renderFunction=this[_0x162a("0x9f")]);_0x4f5fef[_0x162a("0xae")](this[_0x162a("0xa4")]),this.YTexture=this.createTexture(0,_0x162a("0x7d")),this[_0x162a("0x7f")]=this[_0x162a("0xaf")](1,_0x162a("0x7f")),this[_0x162a("0x7e")]=this.createTexture(2,"CBTexture");var _0x441c07=_0x4f5fef[_0x162a("0xb0")](this[_0x162a("0xa4")],_0x162a("0xb1"));_0x4f5fef[_0x162a("0xb2")](_0x441c07),_0x4f5fef[_0x162a("0xb3")](_0x441c07,2,_0x4f5fef.FLOAT,!1,0,0),this[_0x162a("0x7b")]=this.renderFrameGLYUV},VideoRenderer[_0x162a("0x47")][_0x162a("0x9d")]=function(_0x45a8b0){if(this[_0x162a("0x55")]=_0x45a8b0[_0x162a("0x51")](),_0x45a8b0.bindBuffer(_0x45a8b0[_0x162a("0xa1")],this[_0x162a("0x55")]),_0x45a8b0[_0x162a("0xa2")](_0x45a8b0[_0x162a("0xa1")],new Float32Array([-1,-1,1,-1,1,1,1,1,-1,1,-1,-1]),_0x45a8b0[_0x162a("0xa3")]),this[_0x162a("0xa4")]=_0x45a8b0[_0x162a("0xb4")](),_0x45a8b0.attachShader(this[_0x162a("0xa4")],this[_0x162a("0xa6")](_0x45a8b0.VERTEX_SHADER,this[_0x162a("0x92")])),_0x45a8b0.attachShader(this[_0x162a("0xa4")],this.compileShader(_0x45a8b0[_0x162a("0xa8")],this.SHADER_FRAGMENT_RGBA)),_0x45a8b0[_0x162a("0xb5")](this[_0x162a("0xa4")],0,_0x162a("0xb1")),_0x45a8b0[_0x162a("0xaa")](this.program),!_0x45a8b0.getProgramParameter(this[_0x162a("0xa4")],_0x45a8b0.LINK_STATUS))return wsLogger.error(_0x162a("0xac")+_0x45a8b0[_0x162a("0xad")](this[_0x162a("0xa4")])),this[_0x162a("0x6a")]=this[_0x162a("0x4")][_0x162a("0x99")]("2d"),void(this[_0x162a("0x7b")]=this[_0x162a("0x9f")]);_0x45a8b0[_0x162a("0xae")](this[_0x162a("0xa4")]),_0x45a8b0[_0x162a("0xb2")](0),_0x45a8b0[_0x162a("0xb3")](0,2,_0x45a8b0[_0x162a("0xb6")],!1,0,0),this.RGBTexture=this[_0x162a("0xaf")](0,"RGBTexture"),this.renderFunction=this[_0x162a("0xb7")]},VideoRenderer[_0x162a("0x47")][_0x162a("0x7")]=function(){var _0xe37a89;if(this[_0x162a("0x71")]=this[_0x162a("0x4")].width,this[_0x162a("0x6b")]=this[_0x162a("0x4")][_0x162a("0x6b")],this[_0x162a("0x82")]=parseInt(this[_0x162a("0x71")])+15>>4,this[_0x162a("0x83")]=this.mbWidth<<4,this[_0x162a("0x84")]=this[_0x162a("0x82")]<<3,_0xe37a89=typeof Uint8ClampedArray!==_0x162a("0xb8")?Uint8ClampedArray:Uint8Array,this.ctx2D){this[_0x162a("0x81")]=new _0xe37a89(this.canvas.width*this.canvas.height*4);for(var _0x46edaf=0,_0x9090eb=this[_0x162a("0x81")][_0x162a("0x1d")];_0x46edaf<_0x9090eb;_0x46edaf++)this[_0x162a("0x81")][_0x46edaf]=255}else this.gl&&this.gl.viewport(0,0,this[_0x162a("0x71")],this.height)},VideoRenderer[_0x162a("0x47")][_0x162a("0x18")]=function(){if(this[_0x162a("0x6a")]){var _0x2083e7=this[_0x162a("0x6a")][_0x162a("0xb9")](this[_0x162a("0x71")],this[_0x162a("0x6b")]);this.ctx2D[_0x162a("0xba")](_0x2083e7,0,0)}else this.gl&&this.gl[_0x162a("0xbb")](this.gl[_0x162a("0xbc")]|this.gl[_0x162a("0xbd")])},VideoRenderer[_0x162a("0x47")][_0x162a("0xaf")]=function(_0x10fdad,_0x34889c){var _0x6b3e76=this.gl,_0x18fcea=_0x6b3e76[_0x162a("0xaf")]();return _0x6b3e76.bindTexture(_0x6b3e76[_0x162a("0xbe")],_0x18fcea),_0x6b3e76[_0x162a("0xbf")](_0x6b3e76[_0x162a("0xbe")],_0x6b3e76[_0x162a("0xc0")],_0x6b3e76[_0x162a("0xc1")]),_0x6b3e76.texParameteri(_0x6b3e76[_0x162a("0xbe")],_0x6b3e76[_0x162a("0xc2")],_0x6b3e76[_0x162a("0xc1")]),_0x6b3e76[_0x162a("0xbf")](_0x6b3e76[_0x162a("0xbe")],_0x6b3e76.TEXTURE_WRAP_S,_0x6b3e76[_0x162a("0xc3")]),_0x6b3e76[_0x162a("0xbf")](_0x6b3e76.TEXTURE_2D,_0x6b3e76[_0x162a("0xc4")],_0x6b3e76[_0x162a("0xc3")]),_0x6b3e76.uniform1i(_0x6b3e76[_0x162a("0xc5")](this.program,_0x34889c),_0x10fdad),_0x18fcea},VideoRenderer.prototype.compileShader=function(_0x41c03b,_0x5f4578){var _0x4f8efd=this.gl,_0x57e0eb=_0x4f8efd[_0x162a("0xc6")](_0x41c03b);if(_0x4f8efd.shaderSource(_0x57e0eb,_0x5f4578),_0x4f8efd[_0x162a("0xa6")](_0x57e0eb),!_0x4f8efd[_0x162a("0xc7")](_0x57e0eb,_0x4f8efd[_0x162a("0xc8")]))throw new Error(_0x4f8efd[_0x162a("0xc9")](_0x57e0eb));return _0x57e0eb},VideoRenderer[_0x162a("0x47")][_0x162a("0xca")]=function(){return!(null===this.gl&&void 0===this.gl||null!=this.ctx2D&&null!=this[_0x162a("0x6a")])},VideoRenderer[_0x162a("0x47")].renderFrameGLYUV=function(_0x24528e){var _0x5c538d=this.gl;_0x5c538d[_0x162a("0xcb")](_0x5c538d.TEXTURE0),_0x5c538d[_0x162a("0xcc")](_0x5c538d[_0x162a("0xbe")],this[_0x162a("0x7d")]),_0x5c538d[_0x162a("0xcd")](_0x5c538d[_0x162a("0xbe")],0,_0x5c538d[_0x162a("0xce")],this[_0x162a("0x83")],this[_0x162a("0x6b")],0,_0x5c538d[_0x162a("0xce")],_0x5c538d[_0x162a("0xcf")],_0x24528e.y),_0x5c538d[_0x162a("0xcb")](_0x5c538d[_0x162a("0xd0")]),_0x5c538d.bindTexture(_0x5c538d[_0x162a("0xbe")],this.CRTexture),_0x5c538d[_0x162a("0xcd")](_0x5c538d.TEXTURE_2D,0,_0x5c538d[_0x162a("0xce")],this[_0x162a("0x84")],this[_0x162a("0x6b")]/2,0,_0x5c538d[_0x162a("0xce")],_0x5c538d[_0x162a("0xcf")],_0x24528e.cr),_0x5c538d[_0x162a("0xcb")](_0x5c538d[_0x162a("0xd1")]),_0x5c538d[_0x162a("0xcc")](_0x5c538d.TEXTURE_2D,this[_0x162a("0x7e")]),_0x5c538d[_0x162a("0xcd")](_0x5c538d[_0x162a("0xbe")],0,_0x5c538d.LUMINANCE,this[_0x162a("0x84")],this.height/2,0,_0x5c538d[_0x162a("0xce")],_0x5c538d[_0x162a("0xcf")],_0x24528e.cb),_0x5c538d[_0x162a("0xd2")](_0x5c538d[_0x162a("0xd3")],0,4)},VideoRenderer.prototype[_0x162a("0xb7")]=function(_0x5982ea){var _0x36021f=this.gl;_0x36021f[_0x162a("0xcb")](_0x36021f[_0x162a("0xd4")]),_0x36021f.bindTexture(_0x36021f[_0x162a("0xbe")],this.RGBTexture),_0x36021f[_0x162a("0xcd")](_0x36021f.TEXTURE_2D,0,_0x36021f[_0x162a("0xd5")],_0x5982ea[_0x162a("0x71")],_0x5982ea.height,0,_0x36021f[_0x162a("0xd5")],_0x36021f.UNSIGNED_BYTE,_0x5982ea[_0x162a("0x14")]),_0x36021f[_0x162a("0xd2")](_0x36021f[_0x162a("0xd6")],0,6)},VideoRenderer[_0x162a("0x47")].renderFrame2D=function(_0x4d5a01){var _0x84c411=this[_0x162a("0x6a")][_0x162a("0xb9")](_0x4d5a01.width,_0x4d5a01[_0x162a("0x6b")]);_0x4d5a01[_0x162a("0xd7")]==_0x162a("0xc")?(this[_0x162a("0xd8")](_0x4d5a01),_0x84c411.data[_0x162a("0xd9")](this[_0x162a("0x81")])):_0x84c411[_0x162a("0x14")].set(_0x4d5a01[_0x162a("0x14")]),this[_0x162a("0x6a")][_0x162a("0xba")](_0x84c411,0,0)},VideoRenderer[_0x162a("0x47")].render=function(_0x467dad){if(!this[_0x162a("0x27")]){if(this[_0x162a("0x4")][_0x162a("0x71")]!=_0x467dad.width||this[_0x162a("0x4")][_0x162a("0x6b")]!=_0x467dad[_0x162a("0x6b")]){wsLogger[_0x162a("0x5f")](_0x162a("0xda")+this[_0x162a("0x4")][_0x162a("0x71")]+"x"+this[_0x162a("0x4")].height+_0x162a("0xdb")+_0x467dad[_0x162a("0x71")]+"x"+_0x467dad[_0x162a("0x6b")]),this[_0x162a("0x4")].width=_0x467dad[_0x162a("0x71")],this[_0x162a("0x4")][_0x162a("0x6b")]=_0x467dad[_0x162a("0x6b")];var _0x44e234=new Event("resize");this[_0x162a("0x4")][_0x162a("0x65")](_0x44e234),this[_0x162a("0x7")]()}this[_0x162a("0x7b")](_0x467dad)}this[_0x162a("0xdc")]=Date[_0x162a("0x2c")]()},VideoRenderer[_0x162a("0x47")].YCbCrToRGBA=function(_0x3a6afc){for(var _0x356f54,_0x42843a,_0x402f62,_0x1fe8a6,_0xb3c8fd,_0x2d188b=_0x3a6afc.y,_0x31895c=_0x3a6afc.cb,_0x1a9970=_0x3a6afc.cr,_0x410b7d=this[_0x162a("0x81")],_0x599197=0,_0x7186b7=this[_0x162a("0x83")],_0xfec764=this.codedWidth+(this[_0x162a("0x83")]-_0x3a6afc[_0x162a("0x71")]),_0x48cdb2=0,_0x5adcf1=this[_0x162a("0x84")]-(_0x3a6afc.width>>1),_0x1efcdf=0,_0x306a15=4*_0x3a6afc[_0x162a("0x71")],_0x5b89c9=4*_0x3a6afc[_0x162a("0x71")],_0x83a94e=_0x3a6afc[_0x162a("0x71")]>>1,_0x46e569=_0x3a6afc[_0x162a("0x6b")]>>1,_0x4574e3=0;_0x4574e3<_0x46e569;_0x4574e3++){for(var _0x33b5b4=0;_0x33b5b4<_0x83a94e;_0x33b5b4++){_0x356f54=_0x31895c[_0x48cdb2],_0x42843a=_0x1a9970[_0x48cdb2],_0x48cdb2++,_0x402f62=_0x42843a+(103*_0x42843a>>8)-179,_0x1fe8a6=(88*_0x356f54>>8)-44+(183*_0x42843a>>8)-91,_0xb3c8fd=_0x356f54+(198*_0x356f54>>8)-227;var _0xba7424=_0x2d188b[_0x599197++],_0x5ab42c=_0x2d188b[_0x599197++];_0x410b7d[_0x1efcdf]=_0xba7424+_0x402f62,_0x410b7d[_0x1efcdf+1]=_0xba7424-_0x1fe8a6,_0x410b7d[_0x1efcdf+2]=_0xba7424+_0xb3c8fd,_0x410b7d[_0x1efcdf+4]=_0x5ab42c+_0x402f62,_0x410b7d[_0x1efcdf+5]=_0x5ab42c-_0x1fe8a6,_0x410b7d[_0x1efcdf+6]=_0x5ab42c+_0xb3c8fd,_0x1efcdf+=8;var _0x2dbbbe=_0x2d188b[_0x7186b7++],_0x1e85ab=_0x2d188b[_0x7186b7++];_0x410b7d[_0x306a15]=_0x2dbbbe+_0x402f62,_0x410b7d[_0x306a15+1]=_0x2dbbbe-_0x1fe8a6,_0x410b7d[_0x306a15+2]=_0x2dbbbe+_0xb3c8fd,_0x410b7d[_0x306a15+4]=_0x1e85ab+_0x402f62,_0x410b7d[_0x306a15+5]=_0x1e85ab-_0x1fe8a6,_0x410b7d[_0x306a15+6]=_0x1e85ab+_0xb3c8fd,_0x306a15+=8}_0x599197+=_0xfec764,_0x7186b7+=_0xfec764,_0x1efcdf+=_0x5b89c9,_0x306a15+=_0x5b89c9,_0x48cdb2+=_0x5adcf1}},VideoRenderer.prototype[_0x162a("0xdd")]=function(){return this.lastTimeRendered},VideoRenderer[_0x162a("0x47")][_0x162a("0x58")]=function(_0x282d57){_0x282d57?this.muted=!0:this[_0x162a("0x27")]=!1},AudioPlayer[_0x162a("0x47")][_0x162a("0x40")]=function(){this[_0x162a("0xde")]||(this.audioJSNode[_0x162a("0x56")](this.gainNode),this[_0x162a("0xde")]=!0),this[_0x162a("0x58")](!1)},AudioPlayer[_0x162a("0x47")].stop=function(){this.audioJSNode[_0x162a("0xeb")](),this[_0x162a("0xde")]=!1,this[_0x162a("0xe7")]=void 0,this[_0x162a("0xe8")]=void 0,this[_0x162a("0x3e")]=[],this.mute(!0)},AudioPlayer[_0x162a("0x47")][_0x162a("0x7")]=function(){this[_0x162a("0x3e")]?this[_0x162a("0x3e")].length=0:this[_0x162a("0x3e")]=[]},AudioPlayer[_0x162a("0x47")][_0x162a("0xec")]=function(){this.initBuffers()},AudioPlayer[_0x162a("0x47")][_0x162a("0xed")]=function(_0x554ebf){this.audioBuffer[_0x162a("0x23")](_0x554ebf)},AudioPlayer[_0x162a("0x47")][_0x162a("0xee")]=function(){return this[_0x162a("0x3e")].length},AudioPlayer[_0x162a("0x47")][_0x162a("0x25")]=function(){if(this[_0x162a("0xe7")]&&this.lastSyncTime){var _0x21f724=1e3*this[_0x162a("0x31")][_0x162a("0xef")];return _0x21f724>=this[_0x162a("0xe8")]?_0x21f724-this[_0x162a("0xe8")]>this[_0x162a("0xf0")]?(wsLogger[_0x162a("0x7a")](_0x162a("0xf1")+(_0x21f724-this[_0x162a("0xf0")]-this[_0x162a("0xe8")])),this.lastSync+this[_0x162a("0xf0")]):_0x21f724-this[_0x162a("0xe8")]+this.lastSync:_0x21f724-this[_0x162a("0xf2")]+this[_0x162a("0xe6")]}return-1},AudioPlayer[_0x162a("0x47")][_0x162a("0x2d")]=function(){var _0x4d5368=1e3*this[_0x162a("0x31")][_0x162a("0xef")]-this[_0x162a("0xe8")],_0xd6ff56=this[_0x162a("0xf0")]-_0x4d5368;return _0xd6ff56>0?this.audioChunkTimeLength*this[_0x162a("0x3e")].length+_0xd6ff56:this[_0x162a("0xf0")]*this.audioBuffer[_0x162a("0x1d")]},AudioPlayer[_0x162a("0x47")].getLastTimePlayed=function(){return this[_0x162a("0xe8")]},AudioPlayer.prototype[_0x162a("0x58")]=function(_0x197c70){_0x197c70?(wsLogger[_0x162a("0x5f")](_0x162a("0xf3")),this.gainNode[_0x162a("0xf4")].value=0):(wsLogger.log(_0x162a("0xf5")),this[_0x162a("0xdf")][_0x162a("0xf4")][_0x162a("0xea")]=1)},AudioPlayer.prototype[_0x162a("0x41")]=function(_0x36b36f){this[_0x162a("0xdf")][_0x162a("0xf4")][_0x162a("0xea")]=_0x36b36f/100},AudioPlayer.prototype[_0x162a("0x5c")]=function(){return 100*this.gainNode[_0x162a("0xf4")][_0x162a("0xea")]};var WSPlayerState=function(){};WSPlayerState[_0x162a("0x3d")]=_0x162a("0x3d"),WSPlayerState[_0x162a("0x26")]="PLAYING",WSPlayerState[_0x162a("0x59")]="PAUSED",WSPlayerState.STARTUP="STARTUP",exports.WSPlayer=WSPlayer},{}],40:[function(require,module,exports){"use strict";const SESSION_STATUS=Object.freeze({CONNECTED:"CONNECTED",ESTABLISHED:"ESTABLISHED",DISCONNECTED:"DISCONNECTED",WARN:"WARN",FAILED:"FAILED",DEBUG:"DEBUG",APP_DATA:"APP_DATA",SEND_DATA_STATUS:"SEND_DATA_STATUS",PENDING:"PENDING",REGISTERED:"REGISTERED",UNREGISTERED:"UNREGISTERED",INCOMING_CALL:"INCOMING_CALL"}),STREAM_STATUS=Object.freeze({NEW:"NEW",PENDING:"PENDING",PUBLISHING:"PUBLISHING",PLAYING:"PLAYING",PAUSED:"PAUSED",UNPUBLISHED:"UNPUBLISHED",STOPPED:"STOPPED",FAILED:"FAILED",PLAYBACK_PROBLEM:"PLAYBACK_PROBLEM",RESIZE:"RESIZE",SNAPSHOT_COMPLETE:"SNAPSHOT_COMPLETE",NOT_ENOUGH_BANDWIDTH:"NOT_ENOUGH_BANDWIDTH"}),CALL_STATUS=Object.freeze({NEW:"NEW",RING:"RING",RING_MEDIA:"RING_MEDIA",HOLD:"HOLD",ESTABLISHED:"ESTABLISHED",FINISH:"FINISH",BUSY:"BUSY",SESSION_PROGRESS:"SESSION_PROGRESS",FAILED:"FAILED",PENDING:"PENDING",TRYING:"TRYING"}),STREAM_STATUS_INFO=Object.freeze({FAILED_BY_ICE_ERROR:"Failed by ICE error",FAILED_BY_ICE_TIMEOUT:"Failed by ICE timeout",FAILED_BY_KEEP_ALIVE:"Failed by ICE keep alive",FAILED_BY_DTLS_FINGERPRINT_ERROR:"Failed by DTLS fingerprint error",FAILED_BY_DTLS_ERROR:"Failed by DTLS error",FAILED_BY_HLS_WRITER_ERROR:"Failed by HLS writer error",FAILED_BY_RTMP_WRITER_ERROR:"Failed by RTMP writer error",FAILED_BY_RTP_ACTIVITY:"Failed by RTP activity",STOPPED_BY_SESSION_DISCONNECT:"Stopped by session disconnect",STOPPED_BY_REST_TERMINATE:"Stopped by rest /terminate",STOPPED_BY_PUBLISHER_STOP:"Stopped by publisher stop",STOPPED_BY_USER:"Stopped by user",FAILED_BY_ERROR:"Failed by error",FAILED_TO_ADD_STREAM_TO_PROXY:"Failed to add stream to proxy",DISTRIBUTOR_STOPPED:"Distributor stopped",PUBLISH_STREAM_IS_NOT_READY:"Publish stream is not ready",STREAM_NOT_FOUND:"Stream not found",STREAM_NAME_ALREADY_IN_USE:"Stream name is already in use",MEDIASESSION_ID_NULL:"MediaSessionId is null",MEDIASESSION_ID_ALREADY_IN_USE:"MediaSessionId is already in use",SESSION_NOT_READY:"Session not ready",SESSION_DOES_NOT_EXIST:"Session does not exist",RTSP_HAS_WRONG_FORMAT:"Rtsp has wrong format",FILE_HAS_WRONG_FORMAT:"File has wrong format",FAILED_TO_CONNECT_TO_RTSP_STREAM:"Failed to connect to rtsp stream",RTSP_STREAM_NOT_FOUND:"Rtsp stream not found",RTSPAGENT_SHUTDOWN:"RtspAgent shutdown",STREAM_FAILED:"Stream failed",NO_COMMON_CODECS:"No common codecs",BAD_URI:"Bad URI",GOT_EXCEPTION_WHILE_STREAMING_FILE:"Got exception while streaming file",REQUESTED_STREAM_SHUTDOWN:"Requested stream shutdown",FAILED_TO_READ_FILE:"Failed to read file",FILE_NOT_FOUND:"File not found",FAILED_TO_CONNECT_TO_ORIGIN_STREAM:"Failed to connect to origin stream",CDN_STREAM_NOT_FOUND:"CDN stream not found",FAILED_TO_GET_AGENT_STORAGE:"Failed to get agent storage",AGENT_SERVICING_ORIGIN_STREAM_IS_SHUTTING_DOWN:"Agent servicing origin stream is shutting down",TERMINATED_BY_KEEP_ALIVE:"Terminated by keep-alive",TRANSCODING_REQUIRED_BUT_DISABLED:"Transcoding required, but disabled",RESTRICTED_ACCESS:"Restricted access",NO_AVAILABLE_TRANSCODERS:"No available transcoders"}),CALL_STATUS_INFO=Object.freeze({NORMAL_CALL_CLEARING:"Normal call clearing",FAILED_BY_SESSION_CREATION:"Failed by session creation",FAILED_BY_ICE_ERROR:"Failed by ICE error",FAILED_BY_RTP_ACTIVITY:"Failed by RTP activity",FAILED_BY_RTMP_WRITER_ERROR:"Failed by RTMP writer error",FAILED_BY_DTLS_FINGERPRINT_ERROR:"Failed by DTLS fingerprint error",NO_COMMON_CODECS:"No common codecs",FAILED_BY_DTLS_ERROR:"Failed by DTLS error",FAILED_BY_ERROR:"Failed by error",FAILED_BY_REQUEST_TIMEOUT:"Failed by request timeout",TRANSCODING_REQUIRED_BUT_DISABLED:"Transcoding required, but disabled"}),ERROR_INFO=Object.freeze({NONE_OF_MEDIAPROVIDERS_AVAILABLE:"None of MediaProviders available",NONE_OF_PREFERRED_MEDIAPROVIDERS_AVAILABLE:"None of preferred MediaProviders available",FLASHPHONER_API_NOT_INITIALIZED:"Flashphoner API is not initialized",OPTIONS_URLSERVER_MUST_BE_PROVIDED:"options.urlServer must be provided",INVALID_SESSION_STATE:"Invalid session state",OPTIONS_MUST_BE_PROVIDED:"options must be provided",INVALID_CALL_STATE:"Invalid call state",EVENT_CANT_BE_NULL:"Event can't be null",CALLBACK_NEEDS_TO_BE_A_VALID_FUNCTION:"Callback needs to be a valid function",OPTIONS_NAME_MUST_BE_PROVIDED:"options.name must be provided",CAN_NOT_SWITCH_CAM:"Number of cams is less than 2 or camera is already used by other application",CAN_NOT_SWITCH_MIC:"Number of mics is less than 2 or microphone is already used by other application",LOCAL_ERROR:"Local error"}),MEDIA_DEVICE_KIND=Object.freeze({OUTPUT:"output",INPUT:"input",ALL:"all"}),TRANSPORT_TYPE=Object.freeze({UDP:"UDP",TCP:"TCP"}),CONNECTION_QUALITY=Object.freeze({PERFECT:"PERFECT",GOOD:"GOOD",BAD:"BAD",UNKNOWN:"UNKNOWN",UPDATE:"UPDATE"}),STREAM_EVENT_TYPE=Object.freeze({AUDIO_MUTED:"audioMuted",AUDIO_UNMUTED:"audioUnmuted",VIDEO_MUTED:"videoMuted",VIDEO_UNMUTED:"videoUnmuted",DATA:"data"}),CONTENT_HINT_TYPE=Object.freeze({MOTION:"motion",DETAIL:"detail",TEXT:"text"});module.exports={SESSION_STATUS:SESSION_STATUS,STREAM_STATUS:STREAM_STATUS,CALL_STATUS:CALL_STATUS,STREAM_STATUS_INFO:STREAM_STATUS_INFO,CALL_STATUS_INFO:CALL_STATUS_INFO,ERROR_INFO:ERROR_INFO,MEDIA_DEVICE_KIND:MEDIA_DEVICE_KIND,TRANSPORT_TYPE:TRANSPORT_TYPE,CONNECTION_QUALITY:CONNECTION_QUALITY,STREAM_EVENT:"STREAM_EVENT",STREAM_EVENT_TYPE:STREAM_EVENT_TYPE,CONTENT_HINT_TYPE:CONTENT_HINT_TYPE}},{}],41:[function(require,module,exports){"use strict";var swfobject=require("swfobject"),Promise=require("promise-polyfill");const{v1:uuid_v1}=require("uuid");var flashScope,defaultConstraints,logger,connections={},swfLocation="media-provider.swf",DEFAULT_SDP="v=0\r\no=- 1988962254 1988962254 IN IP4 0.0.0.0\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\na=sdplang:en\r\nm=video 0 RTP/AVP 112\r\na=rtpmap:112 H264/90000\r\na=fmtp:112 packetization-mode=1; profile-level-id=420020\r\na=VIDEO_STATE\r\nm=audio 0 RTP/AVP 8 0 100 102 103 104 105 106 107 108 109 110\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:100 SPEEX/16000\r\na=rtpmap:102 mpeg4-generic/48000/1\r\na=rtpmap:103 mpeg4-generic/8000/1\r\na=rtpmap:104 mpeg4-generic/11025/1\r\na=rtpmap:105 mpeg4-generic/12000/1\r\na=rtpmap:106 mpeg4-generic/16000/1\r\na=rtpmap:107 mpeg4-generic/22050/1\r\na=rtpmap:108 mpeg4-generic/24000/1\r\na=rtpmap:109 mpeg4-generic/32000/1\r\na=rtpmap:110 mpeg4-generic/44100/1\r\na=AUDIO_STATE\r\n";function installCallback(id,name,value){!function(){if(null==flashScope){var globalApiObject=window.Flashphoner;if(null==globalApiObject)throw new Error("Can't install global scope, there is no window.Flashphoner variable.");globalApiObject.FlashApiScope={},flashScope=window.Flashphoner.FlashApiScope}}();var scopeId=getInstanceScopeId(id);null==flashScope[scopeId]&&(flashScope[scopeId]={}),flashScope[scopeId][name]=value}function removeCallback(id,name){delete flashScope[getInstanceScopeId(id)][name]}function clearCallbacks(id){delete flashScope[getInstanceScopeId(id)]}function getInstanceScopeId(flash){if("string"==typeof flash)return flash;for(var i=0;i<flash.children.length;i++)if("scopeId"==flash.children[i].name)return flash.children[i].value}var loadSwf=function(id,display,showFullScreenButton){return new Promise((function(resolve,reject){var swf,divWrapper=document.createElement("div");divWrapper.id=id,display.appendChild(divWrapper);var flashvars={id:id,showFullScreenButton:showFullScreenButton||"false"},params={menu:"true",swliveconnect:"true",allowFullScreen:"true",allowscriptaccess:"always",wmode:"opaque"};params.scopeId=id;var attributes={allowfullscreen:"true"};installCallback(id,"addLogMessage",(function(message){logger.info("flash","Flash["+id+"]:"+message)})),installCallback(id,"initialized",(function(){resolve(swf)})),installCallback(id,"videoResolution",(function(width,height){swf.videoWidth=width,swf.videoHeight=height,setTimeout((function(){var event=new CustomEvent("resize");swf.dispatchEvent(event)}),10),setTimeout((function(){var event=new CustomEvent("playing");swf.dispatchEvent(event)}),10)})),swfobject.embedSWF(swfLocation,id,"100%","100%","11.2.0","expressInstall.swf",flashvars,params,attributes,(function(ret){swf=ret.ref,ret.success||reject(new Error("Failed to load flash media provider swf with id "+id))}))}))};function getCacheInstance(display){var i;for(i=0;i<display.children.length;i++)if(display.children[i]&&-1!=display.children[i].id.indexOf("CACHED_FLASH_INSTANCE"))return logger.info("flash","FOUND FLASH CACHED INSTANCE, id "+display.children[i].id),display.children[i]}function normalizeConstraints(constraints){if(constraints&&"undefined"!=typeof constraints.video){if(constraints.video.hasOwnProperty("frameRate")&&"object"!==constraints.video.frameRate){var frameRate=constraints.video.frameRate;(0==frameRate||isNaN(frameRate))&&delete constraints.video.frameRate}if(!1===constraints.video)delete constraints.video;else if(!0===constraints.video)constraints.video={width:320,height:240};else{if(constraints.video.hasOwnProperty("width")){var width=constraints.video.width;(isNaN(width)||0==width)&&(logger.warn("flash","Width or height property has zero/NaN value, set default resolution 320x240"),constraints.video.width=320,constraints.video.height=240),"object"==typeof width&&(constraints.video.width=constraints.video.width.exact||constraints.video.width.max||constraints.video.width.min)}if(constraints.video.hasOwnProperty("height")){var height=constraints.video.height;(isNaN(height)||0==height)&&(logger.warn("flash","Width or height property has zero/NaN value, set default resolution 320x240"),constraints.video.width=320,constraints.video.height=240),"object"==typeof height&&(constraints.video.height=constraints.video.height.exact||constraints.video.height.max||constraints.video.height.min)}}}return constraints}!function(){function CustomEvent(event,params){params=params||{bubbles:!1,cancelable:!1,detail:void 0};var evt=document.createEvent("CustomEvent");return evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail),evt}CustomEvent.prototype=window.Event.prototype,window.CustomEvent=CustomEvent}();module.exports={createConnection:function(options){return new Promise((function(resolve,reject){var id=options.id,authToken=options.authToken,display=options.display||options.localDisplay,flashBufferTime=options.flashBufferTime||0;options.logger&&(logger=options.logger);var mainUrl,proto,port,a,url=(mainUrl=options.mainUrl,proto=options.flashProto,port=options.flashPort,(a=document.createElement("a")).href=mainUrl,proto+"://"+a.hostname+":"+port+"/"),flash=getCacheInstance(display);flash?(flash.reset(id),flash.id=id,installCallback(flash,"addLogMessage",(function(message){logger.info("flash","Flash["+id+"]:"+message)})),installCallback(flash,"connectionStatus",(function(status){removeCallback(flash,"connectionStatus"),"Success"===status?(connections[id]=exports,resolve(exports)):reject(new Error("Flash connection returned status "+status))})),flash.connect(url,authToken,options.login)):loadSwf(id,display,options.flashShowFullScreenButton||"false").then((function(swf){installCallback(swf,"connectionStatus",(function(status){removeCallback(swf,"connectionStatus"),"Success"===status?(connections[id]=exports,resolve(exports)):reject(new Error("Flash connection returned status "+status))})),(flash=swf).connect(url,authToken,options.login)})).catch(reject);var exports={state:function(){return"new"},createOffer:function(options){return new Promise((function(resolve,reject){var receiveAudio=null!=options.receiveAudio&&options.receiveAudio,receiveVideo=null!=options.receiveVideo&&options.receiveVideo,sendAudio=flash.isHasAudio(),sendVideo=flash.isHasVideo(),sdp=DEFAULT_SDP;sdp=receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendrecv"):receiveAudio&&!sendAudio?sdp.replace("AUDIO_STATE","recvonly"):!receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendonly"):sdp.replace("AUDIO_STATE","inactive"),sdp=receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendrecv"):receiveVideo&&!sendVideo?sdp.replace("VIDEO_STATE","recvonly"):!receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendonly"):sdp.replace("VIDEO_STATE","inactive");var o={};o.sdp=sdp,o.hasAudio=flash.isHasAudio(),o.hasVideo=flash.isHasVideo(),resolve(o)}))},createAnswer:function(options){return new Promise((function(resolve,reject){var receiveAudio=null==options.receiveAudio||options.receiveAudio,receiveVideo=null!=options.receiveVideo&&options.receiveVideo,sendAudio=flash.isHasAudio(),sendVideo=flash.isHasVideo(),sdp=DEFAULT_SDP;sdp=receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendrecv"):receiveAudio&&!sendAudio?sdp.replace("AUDIO_STATE","recvonly"):!receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendonly"):sdp.replace("AUDIO_STATE","inactive"),resolve(sdp=receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendrecv"):receiveVideo&&!sendVideo?sdp.replace("VIDEO_STATE","recvonly"):!receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendonly"):sdp.replace("VIDEO_STATE","inactive"))}))},setRemoteSdp:function(sdp,reinit,id){return logger.debug("flash","setRemoteSDP:"),logger.debug("flash",sdp),new Promise((function(resolve,reject){var state=function(sdp){var state={incoming:!1,outgoing:!1};-1!=sdp.indexOf("a=sendrecv")?(state.incoming=!0,state.outgoing=!0):-1!=sdp.indexOf("a=recvonly")?state.outgoing=!0:-1!=sdp.indexOf("a=sendonly")&&(state.incoming=!0);return state}(sdp);reinit&&flash.updateId(id),flash.setup(state.incoming,state.outgoing,flash.isHasAudio(),flash.isHasVideo(),flashBufferTime,reinit),resolve(connections[id])}))},changeAudioCodec:function(codec){flash.changeAudioCodec(codec)}};exports.close=function(cacheCamera){flash&&(flash.disconnect(),!getCacheInstance(display)&&flash.hasAccessToAudio()&&cacheCamera?function(flash){installCallback(flash,"addLogMessage",(function(message){logger.info("flash","Flash["+flash.id+"]:"+message)})),removeCallback(flash,"connectionStatus"),flash.reset(flash.id+"CACHED_FLASH_INSTANCE"),flash.id=flash.id+"CACHED_FLASH_INSTANCE"}(flash):(clearCallbacks(flash),swfobject.removeSWF(flash.id)),flash=null)},exports.setVolume=function(volume){flash&&flash.setVolume(volume)},exports.setMicrophoneGain=function(volume){},exports.getVolume=function(){return flash?flash.getVolume():-1},exports.muteAudio=function(){flash&&flash.muteAudio()},exports.unmuteAudio=function(){flash&&flash.unmuteAudio()},exports.isAudioMuted=function(){return!flash||flash.isAudioMuted()},exports.muteVideo=function(){flash&&flash.muteVideo()},exports.unmuteVideo=function(){flash&&flash.unmuteVideo()},exports.isVideoMuted=function(){return!flash||flash.isVideoMuted()},exports.getStats=function(callbackFn){if(flash){var param,statistics=flash.getStats();if(statistics.hasOwnProperty("incoming")){for(param in statistics.incoming.info)param.indexOf("audio")>-1&&(statistics.incoming.audio[param]=statistics.incoming.info[param]),param.indexOf("video")>-1&&(statistics.incoming.video[param]=statistics.incoming.info[param]);delete statistics.incoming.info}if(statistics.hasOwnProperty("outgoing")){for(param in statistics.outgoing.info)param.indexOf("audio")>-1&&(statistics.outgoing.audio[param]=statistics.outgoing.info[param]),param.indexOf("video")>-1&&(statistics.outgoing.video[param]=statistics.outgoing.info[param]);delete statistics.outgoing.info}statistics.type="flash",callbackFn(statistics)}},exports.fullScreen=function(){flash&&flash.fullScreen()},exports.switchCam=function(){},exports.switchMic=function(){},exports.switchToScreen=function(){},exports.switchToCam=function(){}}))},getMediaAccess:function(constraints,display){return new Promise((function(resolve,reject){var flash=getCacheInstance(display);if(flash)installCallback(flash,"accessGranted",(function(){removeCallback(flash,"accessGranted"),resolve(display)})),installCallback(flash,"accessDenied",(function(){removeCallback(flash,"accessDenied"),reject(new Error("Failed to get access to audio and video"))})),flash.getMediaAccess(normalizeConstraints(constraints))||reject(new Error("Failed to get access to audio and video"));else{var id=uuid_v1()+"CACHED_FLASH_INSTANCE";loadSwf(id,display).then((function(swf){installCallback(swf,"accessGranted",(function(){removeCallback(swf,"accessGranted"),resolve(display)})),installCallback(swf,"accessDenied",(function(){removeCallback(swf,"accessDenied"),reject(new Error("Failed to get access to audio and video"))})),constraints||(constraints=defaultConstraints),swf.getMediaAccess(normalizeConstraints(constraints))||reject(new Error("Failed to get access to audio and video"))}))}}))},releaseMedia:function(display){var flash=getCacheInstance(display);return!!flash&&(clearCallbacks(flash),swfobject.removeSWF(flash.id),!0)},available:function(){return swfobject.hasFlashPlayerVersion("11.2.0")},listDevices:function(){return new Promise((function(resolve,reject){var display=document.createElement("div");display.setAttribute("style","width:1px;height:1px");var id=uuid_v1();document.body.appendChild(display),loadSwf(id,display).then((function(swf){var list=swf.listDevices();swfobject.removeSWF(id),document.body.removeChild(display),resolve(list)}),reject)}))},playFirstSound:function(){return!0},playFirstVideo:function(){return new Promise((function(resolve,reject){resolve()}))},configure:function(configuration){swfLocation=configuration.flashMediaProviderSwfLocation,defaultConstraints=configuration.constraints,(logger=configuration.logger).info("flash","Initialized")}}},{"promise-polyfill":4,swfobject:7,uuid:9}],42:[function(require,module,exports){"use strict";const{v1:uuid_v1}=require("uuid");var coreLogger,disableConnectionQualityCalculation,constants=require("./constants"),util=require("./util"),LoggerObject=require("./util").logger,loggerConf={push:!1,severity:"INFO"},Promise=require("promise-polyfill"),KalmanFilter=require("kalmanjs"),browserDetails=require("webrtc-adapter").default.browserDetails,isUsingTemasysPlugin=!1,SESSION_STATUS=constants.SESSION_STATUS,STREAM_EVENT=constants.STREAM_EVENT,STREAM_EVENT_TYPE=constants.STREAM_EVENT_TYPE,STREAM_STATUS=constants.STREAM_STATUS,CALL_STATUS=constants.CALL_STATUS,CONNECTION_QUALITY=(constants.TRANSPORT_TYPE,constants.CONNECTION_QUALITY),ERROR_INFO=constants.ERROR_INFO,MediaProvider={},sessions={},initialized=!1,getMediaProviders=function(){return Object.keys(MediaProvider)},getDefaultMediaConstraints=function(){return"safari"==browserDetails.browser?{audio:!0,video:{width:{min:320,max:640},height:{min:180,max:360}}}:{audio:!0,video:{width:320,height:240}}};function getConstraintsProperty(constraints,property,defaultValue){if(!constraints||!property)return defaultValue;var res,properties=property.split(".");for(var prop in constraints)if(prop==properties[0])res=constraints[prop],properties.length>1&&(res=getConstraintsProperty(constraints[prop],properties[1],defaultValue));else if("object"==typeof constraints[prop])for(var p in constraints[prop])p==property&&(res=constraints[prop][p]);return"boolean"==typeof res?res:res||defaultValue}var releaseLocalMedia=function(display,mediaProvider){if(!initialized)throw new Error("Flashphoner API is not initialized");return mediaProvider||(mediaProvider=getMediaProviders()[0]),MediaProvider[mediaProvider].releaseMedia(display)},getLoggerConf=function(loggerOptions){var conf=loggerOptions||loggerConf;return null!==loggerOptions&&(conf.enableLogs=!0),conf},createLogger=function(loggerOptions,parentLogger=coreLogger){var newLogger=parentLogger;if(void 0===newLogger||null!=loggerOptions){var loggerConf=getLoggerConf(loggerOptions);(newLogger=new LoggerObject).init(loggerConf.severity||"INFO",loggerConf.push||!1,loggerConf.customLogger,loggerConf.enableLogs)}return newLogger};module.exports={init:function(options){if(!initialized){options||(options={}),coreLogger=createLogger(options.logger);var waitingTemasys=!1;try{var audioContext=new(window.AudioContext||window.webkitAudioContext)}catch(e){console.warn("Failed to create audio context")}disableConnectionQualityCalculation=options.disableConnectionQualityCalculation;var webRtcProvider=require("./webrtc-media-provider");if(webRtcProvider&&webRtcProvider.hasOwnProperty("available")&&webRtcProvider.available()){MediaProvider.WebRTC=webRtcProvider;var enableGainNode=!util.Browser.isSamsungBrowser()&&!util.Browser.isAndroidFirefox()&&options.createMicGainNode,webRtcConf={constraints:options.constraints||getDefaultMediaConstraints(),extensionId:options.screenSharingExtensionId,audioContext:audioContext,logger:coreLogger,createMicGainNode:enableGainNode};webRtcProvider.configure(webRtcConf)}else(webRtcProvider=require("./temasys-media-provider"))&&webRtcProvider.hasOwnProperty("available")&&AdapterJS&&(waitingTemasys=!0,AdapterJS.webRTCReady((function(isUsingPlugin){if(isUsingTemasysPlugin=isUsingPlugin,isUsingPlugin||webRtcProvider.available()){MediaProvider.WebRTC=webRtcProvider;var webRtcConf={constraints:options.constraints||getDefaultMediaConstraints(),extensionId:options.screenSharingExtensionId,logger:coreLogger};webRtcProvider.configure(webRtcConf);var _MediaProvider={};for(var p in _MediaProvider.WebRTC=MediaProvider.WebRTC,MediaProvider)_MediaProvider[p]=MediaProvider[p];MediaProvider=_MediaProvider}options.mediaProvidersReadyCallback&&options.mediaProvidersReadyCallback(Object.keys(MediaProvider))})));var flashProvider=require("./flash-media-provider");if(flashProvider&&flashProvider.hasOwnProperty("available")&&flashProvider.available()&&(!MediaProvider.WebRTC||options.preferredMediaProviders&&options.preferredMediaProviders.indexOf("Flash")>=0)){MediaProvider.Flash=flashProvider;var flashConf={constraints:options.constraints||getDefaultMediaConstraints(),flashMediaProviderSwfLocation:options.flashMediaProviderSwfLocation,logger:coreLogger};flashProvider.configure(flashConf)}var mediaSourceMediaProvider=require("./media-source-media-provider");if(mediaSourceMediaProvider&&mediaSourceMediaProvider.hasOwnProperty("available")&&mediaSourceMediaProvider.available()){MediaProvider.MSE=mediaSourceMediaProvider;var mseConf={audioContext:audioContext,browserDetails:browserDetails.browser};mediaSourceMediaProvider.configure(mseConf)}var websocketProvider=require("./websocket-media-provider");if(websocketProvider&&websocketProvider.hasOwnProperty("available")&&websocketProvider.available(audioContext)){MediaProvider.WSPlayer=websocketProvider;var wsConf={receiverLocation:options.receiverLocation,decoderLocation:options.decoderLocation,audioContext:audioContext,logger:coreLogger};websocketProvider.configure(wsConf)}if(0==getMediaProviders().length)throw new Error("None of MediaProviders available");if(options.preferredMediaProvider)if(MediaProvider.hasOwnProperty(options.preferredMediaProvider)){if(getMediaProviders()[0]!=options.preferredMediaProvider){var _MediaProvider={};for(var p in _MediaProvider[options.preferredMediaProvider]=MediaProvider[options.preferredMediaProvider],MediaProvider)_MediaProvider[p]=MediaProvider[p];MediaProvider=_MediaProvider}}else corelogger.warn("core","Preferred media provider is not available.");if(options.preferredMediaProviders&&options.preferredMediaProviders.length>0){var newMediaProvider={};for(var i in options.preferredMediaProviders)if(options.preferredMediaProviders.hasOwnProperty(i)){var pMP=options.preferredMediaProviders[i];MediaProvider.hasOwnProperty(pMP)&&(newMediaProvider[pMP]=MediaProvider[pMP])}if(util.isEmptyObject(newMediaProvider))throw new Error("None of preferred MediaProviders available");MediaProvider=newMediaProvider}!waitingTemasys&&options.mediaProvidersReadyCallback&&options.mediaProvidersReadyCallback(Object.keys(MediaProvider)),coreLogger.info("core","Initialized"),initialized=!0}},isUsingTemasys:function(){return isUsingTemasysPlugin},getMediaProviders:getMediaProviders,getMediaDevices:function(mediaProvider,labels,kind,deviceConstraints){if(!initialized)throw new Error("Flashphoner API is not initialized");return mediaProvider||(mediaProvider=getMediaProviders()[0]),MediaProvider[mediaProvider].listDevices(labels,kind,deviceConstraints)},getMediaAccess:function(constraints,display,mediaProvider,disableConstraintsNormalization){if(!initialized)throw new Error("Flashphoner API is not initialized");return mediaProvider||(mediaProvider=getMediaProviders()[0]),MediaProvider[mediaProvider].getMediaAccess(constraints,display,disableConstraintsNormalization)},releaseLocalMedia:releaseLocalMedia,getSessions:function(){return util.copyObjectToArray(sessions)},getSession:function(id){return sessions[id]},createSession:function(options){if(!initialized)throw new Error("Flashphoner API is not initialized");if(!options||!options.urlServer)throw new TypeError("options.urlServer must be provided");var connectionTimeout,cConfig,sipConfig,sessionLogger=createLogger(options.logger),logger=sessionLogger,id_=uuid_v1(),sessionStatus=SESSION_STATUS.PENDING,urlServer=options.urlServer,lbUrl=options.lbUrl,flashProto=options.flashProto||"rtmfp",flashPort=options.flashPort||1935,appKey=options.appKey||"defaultApp",mediaOptions=options.mediaOptions,keepAlive=options.keepAlive,timeout=options.timeout,wsPingSender=new function(interval){return this.interval=interval||0,this.intervalId=null,this.start=function(){this.interval>0&&(this.intervalId=setInterval((function(){send("ping",null)}),this.interval))},this.stop=function(){this.intervalId&&clearInterval(this.intervalId)},this}(options.pingInterval||0),wsPingReceiver=new function(receiveProbes,probesInterval){return this.maxPings=receiveProbes||0,this.interval=probesInterval||0,this.intervalId=null,this.pingsMissing=0,this.start=function(){if(this.maxPings>0&&this.interval>0){let receiver=this;this.intervalId=setInterval((function(){receiver.checkPingsReceived()}),this.interval)}},this.stop=function(){this.intervalId&&clearInterval(this.intervalId),this.pingsMissing=0},this.checkPingsReceived=function(){this.pingsMissing++,this.pingsMissing>=this.maxPings&&this.failure()},this.success=function(){this.pingsMissing=0},this.failure=function(){logger.info("core","Missing "+this.pingsMissing+" pings from server, connection seems to be down"),onSessionStatusChange(SESSION_STATUS.FAILED),wsConnection.close()},this}(options.receiveProbes||0,options.probesInterval||0);options.sipOptions&&(sipConfig={sipLogin:options.sipOptions.login,sipAuthenticationName:options.sipOptions.authenticationName,sipPassword:options.sipOptions.password,sipDomain:options.sipOptions.domain,sipOutboundProxy:options.sipOptions.outboundProxy,sipProxy:options.sipOptions.proxy,sipPort:options.sipOptions.port,sipRegisterRequired:options.sipOptions.registerRequired});var wsConnection,url,request,authToken=options.authToken,streams={},calls={},mediaConnections={},streamEventRefreshHandlers={},streamRefreshHandlers={},callRefreshHandlers={},session={},callbacks={};lbUrl?(url=lbUrl,(request=new XMLHttpRequest).open("GET",url,!0),request.timeout=5e3,request.ontimeout=function(){logger.warn("core","Timeout during geting url from balancer!"),createWS(urlServer)},request.error=function(){logger.warn("core","Error during geting url from balancer!"),createWS(urlServer)},request.onload=function(e){if(200==request.status&&4==request.readyState){var result=JSON.parse(request.responseText);urlServer=-1!==urlServer.indexOf("wss://")?"wss://"+result.server+":"+result.wss:"ws://"+result.server+":"+result.ws,flashPort=result.flash,logger.debug("core","Got url from load balancer "+result.server),createWS(urlServer)}},request.send()):createWS(urlServer);var remoteSdpCache={};function createWS(url){wsConnection=new WebSocket(url),null!=timeout&&timeout>0&&(connectionTimeout=setTimeout((function(){0==wsConnection.readyState&&(logger.warn("core","WS connection timeout"),wsConnection.close())}),timeout)),wsConnection.onerror=function(){onSessionStatusChange(SESSION_STATUS.FAILED)},wsConnection.onclose=function(){sessionStatus!==SESSION_STATUS.FAILED&&onSessionStatusChange(SESSION_STATUS.DISCONNECTED)},wsConnection.onopen=function(){onSessionStatusChange(SESSION_STATUS.CONNECTED),clearTimeout(connectionTimeout),cConfig={appKey:appKey,mediaProviders:Object.keys(MediaProvider),keepAlive:keepAlive,authToken:authToken,clientVersion:"2.0.218",clientOSVersion:window.navigator.appVersion,clientBrowserVersion:window.navigator.userAgent,msePacketizationVersion:2,custom:options.custom},sipConfig&&util.copyObjectPropsToAnotherObject(sipConfig,cConfig),send("connection",cConfig),logger.setConnection(wsConnection),wsPingSender.start(),wsPingReceiver.start()},wsConnection.onmessage=function(event){var data={};if(event.data instanceof Blob)data.message="binaryData";else var obj=(data=JSON.parse(event.data)).data[0];switch(data.message){case"ping":send("pong",null),wsPingReceiver.success();break;case"getUserData":authToken=obj.authToken,cConfig=obj,onSessionStatusChange(SESSION_STATUS.ESTABLISHED,obj);break;case"setRemoteSDP":var mediaSessionId=data.data[0],sdp=data.data[1];streamRefreshHandlers[mediaSessionId]?streamRefreshHandlers[mediaSessionId](null,sdp):callRefreshHandlers[mediaSessionId]?callRefreshHandlers[mediaSessionId](null,sdp):(remoteSdpCache[mediaSessionId]=sdp,logger.info("core","Media not found, id "+mediaSessionId));break;case"notifyVideoFormat":case"notifyStreamStatusEvent":streamRefreshHandlers[obj.mediaSessionId]&&streamRefreshHandlers[obj.mediaSessionId](obj);break;case"notifyStreamEvent":streamEventRefreshHandlers[obj.mediaSessionId]&&streamEventRefreshHandlers[obj.mediaSessionId](obj);break;case"DataStatusEvent":restAppCommunicator.resolveData(obj);break;case"OnDataEvent":callbacks[SESSION_STATUS.APP_DATA]&&callbacks[SESSION_STATUS.APP_DATA](obj);break;case"fail":obj.apiMethod&&"StreamStatusEvent"==obj.apiMethod&&streamRefreshHandlers[obj.id]&&streamRefreshHandlers[obj.id](obj),callbacks[SESSION_STATUS.WARN]&&callbacks[SESSION_STATUS.WARN](obj);break;case"registered":onSessionStatusChange(SESSION_STATUS.REGISTERED);break;case"notifyAudioCodec":mediaSessionId=data.data[0];var codec=data.data[1];callRefreshHandlers[mediaSessionId]&&callRefreshHandlers[mediaSessionId](null,null,codec);break;case"notifyTransferEvent":callRefreshHandlers[obj.callId](null,null,null,obj);break;case"notifyTryingResponse":case"hold":case"ring":case"talk":case"finish":callRefreshHandlers[obj.callId]&&callRefreshHandlers[obj.callId](obj);break;case"notifyIncomingCall":callRefreshHandlers[obj.callId]&&logger.error("core","Call already exists, id "+obj.callId),callbacks[SESSION_STATUS.INCOMING_CALL]&&callbacks[SESSION_STATUS.INCOMING_CALL](createCall(obj));break;case"notifySessionDebugEvent":logger.info("core","Session debug status "+obj.status),callbacks[SESSION_STATUS.DEBUG]&&callbacks[SESSION_STATUS.DEBUG](obj);break;case"availableStream":var availableStream={};availableStream.mediaSessionId=obj.id,availableStream.available=obj.status,availableStream.reason=obj.info,streamRefreshHandlers[availableStream.mediaSessionId]&&streamRefreshHandlers[availableStream.mediaSessionId](availableStream);break;case"outboundVideoRate":case"inboundVideoRate":streamRefreshHandlers[obj.mediaSessionId]&&(obj.status=data.message,streamRefreshHandlers[obj.mediaSessionId](obj))}}}function send(message,data){wsConnection.send(JSON.stringify({message:message,data:[data]}))}function onSessionStatusChange(newStatus,obj){if((sessionStatus=newStatus)==SESSION_STATUS.DISCONNECTED||sessionStatus==SESSION_STATUS.FAILED){for(var prop in wsPingSender.stop(),wsPingReceiver.stop(),streamRefreshHandlers)streamRefreshHandlers.hasOwnProperty(prop)&&"function"==typeof streamRefreshHandlers[prop]&&streamRefreshHandlers[prop]({status:STREAM_STATUS.FAILED});delete sessions[id_]}callbacks[sessionStatus]&&callbacks[sessionStatus](session,obj)}var createCall=function(options){if(sessionStatus!==SESSION_STATUS.REGISTERED&&sessionStatus!==SESSION_STATUS.ESTABLISHED)throw new Error("Invalid session state "+sessionStatus);if(!options)throw new TypeError("options must be provided");var mediaConnection,info_,errorInfo_,audioOutputId,callLogger=createLogger(options.logger,sessionLogger),logger=callLogger,login="clickToCallApp"==appKey?"":cConfig.sipLogin,caller_=options.incoming?options.caller:login,callee_=options.callee,visibleName_=options.visibleName||login,id_=options.callId||uuid_v1(),mediaProvider=options.mediaProvider||getMediaProviders()[0],localDisplay=options.localVideoDisplay,remoteDisplay=options.remoteVideoDisplay;if(options.constraints)var constraints=options.constraints;if(options.disableConstraintsNormalization)var disableConstraintsNormalization=options.disableConstraintsNormalization;var audioProperty=getConstraintsProperty(constraints,"audio",void 0);"object"==typeof audioProperty&&(audioOutputId=getConstraintsProperty(audioProperty,"outputId",0));var stripCodecs=options.stripCodecs||[],receiveAudio="undefined"==typeof options.receiveAudio||options.receiveAudio,receiveVideo="undefined"==typeof options.receiveVideo||options.receiveVideo,cacheLocalResources=options.cacheLocalResources,status_=CALL_STATUS.NEW,callbacks={},hasTransferredCall=!1,sdpHook=options.sdpHook,sipSDP=options.sipSDP,videoContentHint=(options.sipHeaders,options.videoContentHint),call={};callRefreshHandlers[id_]=function(callInfo,sdp,codec,transfer){if(transfer)return mediaConnections[id_]||(mediaConnections[id_]=mediaConnection),void("COMPLETED"==transfer.status&&delete mediaConnections[id_]);if(!mediaConnection&&0!=Object.keys(mediaConnections).length)for(var mc in mediaConnections)mediaConnection=mediaConnections[mc],hasTransferredCall=!0,delete mediaConnections[mc];if(codec)"Flash"==mediaProvider&&mediaConnection.changeAudioCodec(codec.name);else{if(sdp&&""!==sdp)return sdp=sdpHookHandler(sdp,sdpHook),void mediaConnection.setRemoteSdp(sdp,hasTransferredCall,id_).then((function(){}));var event=callInfo.status;status_=event,event!=CALL_STATUS.FAILED&&event!=CALL_STATUS.FINISH&&event!=CALL_STATUS.BUSY||(delete calls[id_],delete callRefreshHandlers[id_],0==Object.keys(calls).length&&mediaConnection&&mediaConnection.close(cacheLocalResources)),callbacks[event]&&callbacks[event](call)}};var hangup=function(){if(status_!=CALL_STATUS.NEW){if(status_==CALL_STATUS.PENDING)return cacheLocalResources||releaseLocalMedia(localDisplay,mediaProvider),callRefreshHandlers[id_]({status:CALL_STATUS.FAILED}),void(options.incoming&&send("hangup",{callId:id_}));send("hangup",{callId:id_}),mediaConnection&&mediaConnection.close(cacheLocalResources)}else callRefreshHandlers[id_]({status:CALL_STATUS.FAILED})};return call.call=function(){if(status_!==CALL_STATUS.NEW)throw new Error("Invalid call state");status_=CALL_STATUS.PENDING;MediaProvider[mediaProvider].getMediaAccess(constraints,localDisplay,disableConstraintsNormalization).then((function(){status_!=CALL_STATUS.FAILED?MediaProvider[mediaProvider].createConnection({id:id_,localDisplay:localDisplay,remoteDisplay:remoteDisplay,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,bidirectional:!0,login:login,constraints:constraints,connectionConfig:mediaOptions,audioOutputId:audioOutputId,videoContentHint:videoContentHint,logger:logger}).then((function(newConnection){return(mediaConnection=newConnection).createOffer({sendAudio:!0,sendVideo:!0,receiveAudio:receiveAudio,receiveVideo:receiveVideo,stripCodecs:stripCodecs})})).then((function(offer){send("call",{callId:id_,incoming:!1,hasVideo:offer.hasVideo,hasAudio:offer.hasAudio,status:status_,mediaProvider:mediaProvider,sdp:offer.sdp,sipSDP:sipSDP,caller:login,callee:callee_,custom:options.custom,visibleName:visibleName_})})):cacheLocalResources||releaseLocalMedia(localDisplay,mediaProvider)})).catch((function(error){logger.error("core",error),status_=CALL_STATUS.FAILED,info_=ERROR_INFO.LOCAL_ERROR,errorInfo_=error.message,callRefreshHandlers[id_]({status:CALL_STATUS.FAILED}),hangup()}))},call.answer=function(answerOptions){if(status_!==CALL_STATUS.NEW&&status_!==CALL_STATUS.RING)throw new Error("Invalid call state");var sdp;localDisplay=answerOptions.localVideoDisplay,remoteDisplay=answerOptions.remoteVideoDisplay,constraints=answerOptions.constraints||getDefaultMediaConstraints(),status_=CALL_STATUS.PENDING;var sdpHook=answerOptions.sdpHook;if(sipSDP=answerOptions.sipSDP,answerOptions.sipHeaders,!remoteSdpCache[id_])throw logger.error("core","No remote sdp available"),new Error("No remote sdp available");sdp=sdpHookHandler(remoteSdpCache[id_],sdpHook),delete remoteSdpCache[id_],0==util.SDP.matchPrefix(sdp,"m=video").length&&(constraints.video=!1);var stripCodecs=answerOptions.stripCodecs||[];MediaProvider[mediaProvider].getMediaAccess(constraints,localDisplay,disableConstraintsNormalization).then((function(){status_!=CALL_STATUS.FAILED?MediaProvider[mediaProvider].createConnection({id:id_,localDisplay:localDisplay,remoteDisplay:remoteDisplay,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,bidirectional:!0,login:cConfig.sipLogin,constraints:constraints,connectionConfig:mediaOptions,audioOutputId:audioOutputId}).then((function(newConnection){return(mediaConnection=newConnection).setRemoteSdp(sdp)})).then((function(){return mediaConnection.createAnswer({receiveAudio:options.receiveAudio,receiveVideo:options.receiveVideo,stripCodecs:stripCodecs})})).then((function(sdp){status_!=CALL_STATUS.FINISH&&status_!=CALL_STATUS.FAILED?send("answer",{callId:id_,incoming:!0,hasVideo:!0,hasAudio:!0,status:status_,mediaProvider:mediaProvider,sdp:sdp,sipSDP:sipSDP,caller:cConfig.login,callee:callee_,custom:options.custom}):hangup()})):cacheLocalResources||releaseLocalMedia(localDisplay,mediaProvider)})).catch((function(error){logger.error("core",error),info_=ERROR_INFO.LOCAL_ERROR,errorInfo_=error.message,status_=CALL_STATUS.FAILED,callRefreshHandlers[id_]({status:CALL_STATUS.FAILED})}))},call.hangup=hangup,call.id=function(){return id_},call.getInfo=function(){return info_},call.getErrorInfo=function(){return errorInfo_},call.status=function(){return status_},call.getStats=function(callbackFn,nativeStats){mediaConnection&&mediaConnection.getStats(callbackFn,nativeStats)},call.setAudioOutputId=function(id){if(audioOutputId=id,mediaConnection&&mediaConnection.setAudioOutputId)return mediaConnection.setAudioOutputId(id)},call.setVolume=function(volume){mediaConnection&&mediaConnection.setVolume(volume)},call.getVolume=function(){return mediaConnection?mediaConnection.getVolume():-1},call.muteAudio=function(){mediaConnection&&mediaConnection.muteAudio()},call.unmuteAudio=function(){mediaConnection&&mediaConnection.unmuteAudio()},call.isAudioMuted=function(){return!mediaConnection||mediaConnection.isAudioMuted()},call.muteVideo=function(){mediaConnection&&mediaConnection.muteVideo()},call.unmuteVideo=function(){mediaConnection&&mediaConnection.unmuteVideo()},call.isVideoMuted=function(){return!mediaConnection||mediaConnection.isVideoMuted()},call.caller=function(){return caller_},call.callee=function(){return callee_},call.visibleName=function(){return visibleName_},call.hold=function(){send("hold",{callId:id_})},call.holdForTransfer=function(){send("hold",{callId:id_,holdForTransfer:!0})},call.unhold=function(){send("unhold",{callId:id_})},call.sendDTMF=function(number,type){send("sendDtmf",{callId:id_,type:type||"RFC2833",dtmf:number})},call.transfer=function(target){send("transfer",{callId:id_,target:target})},call.on=function(event,callback){if(!event)throw new TypeError("Event can't be null");if(!callback||"function"!=typeof callback)throw new Error("Callback needs to be a valid function");return callbacks[event]=callback,call},call.switchCam=function(deviceId){if(status_!==CALL_STATUS.ESTABLISHED&&!constraints.video&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");return mediaConnection.switchCam(deviceId)},call.switchMic=function(deviceId){if(status_!==CALL_STATUS.ESTABLISHED&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");return mediaConnection.switchMic(deviceId)},call.switchToScreen=function(source,woExtension){if(status_!==CALL_STATUS.ESTABLISHED&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");return mediaConnection.switchToScreen(source,woExtension)},call.switchToCam=function(){if(status_!==CALL_STATUS.ESTABLISHED&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");mediaConnection.switchToCam()},call.getLogger=function(){return callLogger},calls[id_]=call,call},restAppCommunicator=function(){var pending={},exports={sendData:function(data){return new Promise((function(resolve,reject){var obj={operationId:uuid_v1(),payload:data};pending[obj.operationId]={FAILED:function(info){reject(info)},ACCEPTED:function(info){resolve(info)}},send("sendData",obj)}))},resolveData:function(data){if(pending[data.operationId]){var handler=pending[data.operationId];delete pending[data.operationId],delete data.operationId,handler[data.status](data)}}};return exports}(),sdpHookHandler=function(sdp,sdpHook){if(null!=sdpHook&&"function"==typeof sdpHook){var newSdp=sdpHook({sdpString:sdp});return null!=newSdp&&""!=newSdp?newSdp:sdp}return sdp};return session.id=function(){return id_},session.status=function(){return sessionStatus},session.getServerUrl=function(){return urlServer},session.createStream=function(options){var availableCallbacks=[];if(sessionStatus!==SESSION_STATUS.ESTABLISHED)throw new Error("Invalid session state "+sessionStatus);if(!options)throw new TypeError("options must be provided");if(!options.name)throw new TypeError("options.name must be provided");var mediaConnection,streamLogger=createLogger(options.logger,sessionLogger),logger=streamLogger,clientKf=new KalmanFilter,serverKf=new KalmanFilter,id_=uuid_v1(),name_=options.name,mediaProvider=options.mediaProvider||getMediaProviders()[0],display=options.display;if(options.constraints&&0!=Object.keys(options.constraints).length)var constraints=options.constraints;if(options.disableConstraintsNormalization)var disableConstraintsNormalization=options.disableConstraintsNormalization;var receiveAudio,audioOutputId,receiveVideo,mediaConnectionConstraints=options.mediaConnectionConstraints,audioProperty=getConstraintsProperty(constraints,"audio",void 0);if("boolean"==typeof audioProperty)receiveAudio=audioProperty;else if("object"==typeof audioProperty){receiveAudio=!0;var _stereo=getConstraintsProperty(audioProperty,"stereo",0),_bitrate=getConstraintsProperty(audioProperty,"bitrate",0),_fec=getConstraintsProperty(audioProperty,"fec",0);audioOutputId=getConstraintsProperty(audioProperty,"outputId",0);var _codecOptions="";_bitrate&&(_codecOptions+="maxaveragebitrate="+_bitrate+";"),_stereo&&(_codecOptions+="stereo=1;sprop-stereo=1;"),_fec&&(_codecOptions+="useinbandfec=1;")}else receiveAudio="undefined"==typeof options.receiveAudio||options.receiveAudio;var videoProperty=getConstraintsProperty(constraints,"video",void 0);receiveVideo="boolean"==typeof videoProperty?videoProperty:"object"==typeof videoProperty||("undefined"==typeof options.receiveVideo||options.receiveVideo);var bitrate=getConstraintsProperty(constraints,"video.bitrate",0),minBitrate=getConstraintsProperty(constraints,"video.minBitrate",0),maxBitrate=getConstraintsProperty(constraints,"video.maxBitrate",0),quality=getConstraintsProperty(constraints,"video.quality",0);quality>100&&(quality=100);var info_,errorInfo_,audioState_,videoState_,connectionQuality,playWidth="undefined"!=typeof options.playWidth?options.playWidth:getConstraintsProperty(constraints,"video.width",0),playHeight="undefined"!=typeof options.playHeight?options.playHeight:getConstraintsProperty(constraints,"video.height",0),stripCodecs=options.stripCodecs||[],resolution={},published_=!1,record_=options.record||!1,recordFileName=null,cacheLocalResources=options.cacheLocalResources,status_=STREAM_STATUS.NEW,rtmpUrl=options.rtmpUrl,remoteBitrate=-1,networkBandwidth=-1,sdpHook=options.sdpHook,transportType=options.transport,cvoExtension=options.cvoExtension,remoteVideo=options.remoteVideo,callbacks={},playoutDelay=options.playoutDelay,useCanvasMediaStream=options.useCanvasMediaStream,videoContentHint=options.videoContentHint,unmutePlayOnStart=options.unmutePlayOnStart,videoBytes=0,stream={};streamEventRefreshHandlers[id_]=function(streamEvent){callbacks[STREAM_EVENT]&&callbacks[STREAM_EVENT](streamEvent)},streamRefreshHandlers[id_]=function(streamInfo,sdp){if(sdp&&""!==sdp){var _sdp=sdp;return _codecOptions&&(_sdp=util.SDP.writeFmtp(sdp,_codecOptions,"opus")),_sdp=sdpHookHandler(_sdp,sdpHook),void mediaConnection.setRemoteSdp(_sdp).then((function(){}))}if(null==streamInfo.available){var event=streamInfo.status;if("inboundVideoRate"!=event&&"outboundVideoRate"!=event){if(event==STREAM_STATUS.RESIZE)resolution.width=streamInfo.streamerVideoWidth,resolution.height=streamInfo.streamerVideoHeight;else if(event==STREAM_STATUS.SNAPSHOT_COMPLETE);else if(event==STREAM_STATUS.NOT_ENOUGH_BANDWIDTH){var info=streamInfo.info.split("/");remoteBitrate=info[0],networkBandwidth=info[1]}else status_=event;audioState_=streamInfo.audioState,videoState_=streamInfo.videoState,streamInfo.info&&(info_=streamInfo.info),event!=STREAM_STATUS.FAILED&&event!=STREAM_STATUS.STOPPED&&event!=STREAM_STATUS.UNPUBLISHED||(delete streams[id_],delete streamRefreshHandlers[id_],delete streamEventRefreshHandlers[id_],mediaConnection&&mediaConnection.close(cacheLocalResources)),record_&&"undefined"!=typeof streamInfo.recordName&&(recordFileName=streamInfo.recordName),callbacks[event]&&callbacks[event](stream)}else detectConnectionQuality(event,streamInfo)}else{for(var i=0;i<availableCallbacks.length;i++)info_=streamInfo.reason,"true"==streamInfo.available?availableCallbacks[i].resolve(stream):availableCallbacks[i].reject(stream);availableCallbacks=[]}};var detectConnectionQuality=function(event,streamInfo){disableConnectionQualityCalculation||mediaConnection.getStats((function(stats){var bytesSentReceived=0;if(stats)if("outboundVideoRate"==event&&stats.inboundStream&&stats.inboundStream.video&&stats.inboundStream.video.bytesReceived>0)bytesSentReceived=stats.inboundStream.video.bytesReceived;else{if(!(stats.outboundStream&&stats.outboundStream.video&&stats.outboundStream.video.bytesSent>0))return;bytesSentReceived=stats.outboundStream.video.bytesSent}if(videoBytes){var currentVideoRate=8*(bytesSentReceived-videoBytes);if(0!=currentVideoRate){var currentQuality,clientFiltered=clientKf.filter(currentVideoRate),serverFiltered=serverKf.filter(streamInfo.videoRate),videoRateDifference=100*Math.abs((serverFiltered-clientFiltered)/((serverFiltered+clientFiltered)/2));currentQuality=serverFiltered<5e4||clientFiltered<5e4?videoRateDifference>150?CONNECTION_QUALITY.BAD:CONNECTION_QUALITY.PERFECT:videoRateDifference>50?CONNECTION_QUALITY.BAD:videoRateDifference>20?CONNECTION_QUALITY.GOOD:CONNECTION_QUALITY.PERFECT,callbacks[CONNECTION_QUALITY.UPDATE]&&(connectionQuality=currentQuality,callbacks[CONNECTION_QUALITY.UPDATE](connectionQuality,clientFiltered,serverFiltered)),videoBytes=bytesSentReceived}}else videoBytes=bytesSentReceived}))},stop=function(){if(logger.debug("core","Stop stream "+name_),status_!=STREAM_STATUS.NEW)return status_==STREAM_STATUS.PENDING?(logger.warn("core","Stopping stream before server response "+id_),void setTimeout(stop,200)):void(status_!=STREAM_STATUS.FAILED?(send(published_?"unPublishStream":"stopStream",{mediaSessionId:id_,name:name_,published:published_,hasVideo:!0,hasAudio:!0,status:status_,record:!1}),mediaConnection&&mediaConnection.close(cacheLocalResources)):logger.warn("core","Stream status FAILED"));streamRefreshHandlers[id_]({status:STREAM_STATUS.FAILED})},published=function(){return published_};function sendStreamEvent(type,payload){send("sendStreamEvent",{mediaSessionId:id_,type:type,payload:payload})}return stream.play=function(){if(logger.debug("core","Play stream "+name_),status_!==STREAM_STATUS.NEW)throw new Error("Invalid stream state "+status_);status_=STREAM_STATUS.PENDING,MediaProvider[mediaProvider].createConnection({id:id_,display:display,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,flashBufferTime:options.flashBufferTime||0,flashShowFullScreenButton:options.flashShowFullScreenButton||!1,connectionConfig:mediaOptions,connectionConstraints:mediaConnectionConstraints,audioOutputId:audioOutputId,remoteVideo:remoteVideo,playoutDelay:playoutDelay,unmutePlayOnStart:unmutePlayOnStart,logger:logger},streamRefreshHandlers[id_]).then((function(newConnection){mediaConnection=newConnection;try{streamRefreshHandlers[id_]({status:status_})}catch(e){console.warn(e)}return mediaConnection.createOffer({receiveAudio:receiveAudio,receiveVideo:receiveVideo,stripCodecs:stripCodecs,stereo:_stereo})})).then((function(offer){logger.debug("core","Offer SDP:\n"+offer.sdp),send("playStream",{mediaSessionId:id_,name:name_,published:published_,hasVideo:!0,hasAudio:!0,status:status_,record:!1,width:playWidth,height:playHeight,mediaProvider:mediaProvider,sdp:offer.sdp,custom:options.custom,bitrate:bitrate,minBitrate:minBitrate,maxBitrate:maxBitrate,quality:quality,constraints:constraints,transport:transportType,cvoExtension:cvoExtension}),offer.player&&offer.player.play(id_)})).catch((function(error){throw error}))},stream.publish=function(){if(logger.debug("core","Publish stream "+name_),status_!==STREAM_STATUS.NEW)throw new Error("Invalid stream state "+status_);status_=STREAM_STATUS.PENDING,published_=!0;constraints&&constraints.video&&constraints.video.type&&constraints.video.type,MediaProvider[mediaProvider].getMediaAccess(constraints,display,disableConstraintsNormalization,useCanvasMediaStream).then((function(){status_!=STREAM_STATUS.FAILED?MediaProvider[mediaProvider].createConnection({id:id_,display:display,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,constraints:constraints,connectionConfig:mediaOptions,connectionConstraints:mediaConnectionConstraints,customStream:!(!constraints||!constraints.customStream)&&constraints.customStream,videoContentHint:videoContentHint,logger:logger}).then((function(newConnection){return(mediaConnection=newConnection).createOffer({stripCodecs:stripCodecs})})).then((function(offer){logger.debug("core","Offer SDP:\n"+offer.sdp),send("publishStream",{mediaSessionId:id_,name:name_,published:published_,hasVideo:offer.hasVideo,hasAudio:offer.hasAudio,status:status_,record:record_,mediaProvider:mediaProvider,sdp:offer.sdp,custom:options.custom,bitrate:bitrate,minBitrate:minBitrate,maxBitrate:maxBitrate,rtmpUrl:rtmpUrl,constraints:constraints,transport:transportType,cvoExtension:cvoExtension})})):cacheLocalResources||releaseLocalMedia(display,mediaProvider)})).catch((function(error){logger.warn("core",error),info_=ERROR_INFO.LOCAL_ERROR,errorInfo_=error.message,status_=STREAM_STATUS.FAILED,callbacks[status_]&&callbacks[status_](stream)}))},stream.stop=stop,stream.id=function(){return id_},stream.status=function(){return status_},stream.name=function(){return name_},stream.published=published,stream.getRecordInfo=function(){return recordFileName},stream.getInfo=function(){return info_},stream.getErrorInfo=function(){return errorInfo_},stream.videoResolution=function(){if(published_)throw new Error("This function available only on playing stream");return resolution},stream.setAudioOutputId=function(id){if(audioOutputId=id,mediaConnection&&mediaConnection.setAudioOutputId)return mediaConnection.setAudioOutputId(id)},stream.setVolume=function(volume){mediaConnection&&mediaConnection.setVolume(volume)},stream.unmuteRemoteAudio=function(){mediaConnection&&"Flash"!=mediaProvider&&mediaConnection.unmuteRemoteAudio()},stream.muteRemoteAudio=function(){mediaConnection&&"Flash"!=mediaProvider&&mediaConnection.muteRemoteAudio()},stream.isRemoteAudioMuted=function(){return!(!mediaConnection||"Flash"==mediaProvider)&&mediaConnection.isRemoteAudioMuted()},stream.setMicrophoneGain=function(volume){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");mediaConnection.setMicrophoneGain(volume)},stream.getVolume=function(){return mediaConnection?mediaConnection.getVolume():-1},stream.muteAudio=function(){mediaConnection&&(mediaConnection.muteAudio(),sendStreamEvent(STREAM_EVENT_TYPE.AUDIO_MUTED))},stream.unmuteAudio=function(){mediaConnection&&(mediaConnection.unmuteAudio(),sendStreamEvent(STREAM_EVENT_TYPE.AUDIO_UNMUTED))},stream.isAudioMuted=function(){return!mediaConnection||mediaConnection.isAudioMuted()},stream.muteVideo=function(){mediaConnection&&(mediaConnection.muteVideo(),sendStreamEvent(STREAM_EVENT_TYPE.VIDEO_MUTED))},stream.unmuteVideo=function(){mediaConnection&&(mediaConnection.unmuteVideo(),sendStreamEvent(STREAM_EVENT_TYPE.VIDEO_UNMUTED))},stream.isVideoMuted=function(){return!mediaConnection||mediaConnection.isVideoMuted()},stream.getStats=function(callbackFn,nativeStats){mediaConnection&&mediaConnection.getStats(callbackFn,nativeStats)},stream.snapshot=function(){if(logger.debug("core","Request snapshot, stream "+name_),status_!==STREAM_STATUS.NEW&&status_!==STREAM_STATUS.PLAYING&&status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");send("snapshot",{name:name_,mediaSessionId:id_})},stream.getAudioState=function(){return audioState_},stream.getVideoState=function(){return videoState_},stream.getNetworkBandwidth=function(){return networkBandwidth},stream.getRemoteBitrate=function(){return remoteBitrate},stream.fullScreen=function(){published()?logger.warn("core","Full screen is allowed only for played streams"):mediaConnection&&mediaConnection.fullScreen()},stream.on=function(event,callback){if(!event)throw new TypeError("Event can't be null");if(!callback||"function"!=typeof callback)throw new Error("Callback needs to be a valid function");return callbacks[event]=callback,stream},stream.available=function(){return new Promise((function(resolve,reject){send("availableStream",{mediaSessionId:id_,name:name_});var promise={};promise.resolve=resolve,promise.reject=reject,availableCallbacks.push(promise)}))},stream.switchCam=function(deviceId){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");return mediaConnection.switchCam(deviceId)},stream.switchMic=function(deviceId){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");return mediaConnection.switchMic(deviceId)},stream.switchToScreen=function(source,woExtension){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");return mediaConnection.switchToScreen(source,woExtension)},stream.switchToCam=function(){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");mediaConnection.switchToCam()},stream.sendData=function(payload){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");sendStreamEvent(STREAM_EVENT_TYPE.DATA,payload)},stream.getLogger=function(){return streamLogger},streams[id_]=stream,stream},session.createCall=createCall,session.getStream=function(streamId){return streams[streamId]},session.getStreams=function(){return util.copyObjectToArray(streams)},session.sendData=restAppCommunicator.sendData,session.disconnect=function(){wsConnection&&wsConnection.close()},session.submitBugReport=function(reportObject){send("submitBugReport",reportObject)},session.startDebug=function(){logger.setPushLogs(!0),logger.setLevel("DEBUG"),send("sessionDebug",{command:"start"})},session.stopDebug=function(){logger.setLevel("INFO"),send("sessionDebug",{command:"stop"})},session.on=function(event,callback){if(!event)throw new Error("Event can't be null","TypeError");if(!callback||"function"!=typeof callback)throw new Error("Callback needs to be a valid function");return callbacks[event]=callback,session},session.getLogger=function(){return sessionLogger},sessions[id_]=session,session},playFirstSound:function(noise){var mediaProvider=getMediaProviders()[0];MediaProvider[mediaProvider].playFirstSound(noise)},playFirstVideo:function(display,isLocal,src){for(var mp in MediaProvider)return MediaProvider[mp].playFirstVideo(display,isLocal,src)},getLogger:function(){if(initialized)return coreLogger;console.warn("Initialize API first.")},constants:constants,firefoxScreenSharingExtensionInstalled:!0,Browser:util.Browser}},{"./constants":40,"./flash-media-provider":41,"./media-source-media-provider":43,"./temasys-media-provider":45,"./util":46,"./webrtc-media-provider":47,"./websocket-media-provider":48,kalmanjs:2,"promise-polyfill":4,uuid:9,"webrtc-adapter":24}],43:[function(require,module,exports){(function(global){(function(){!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MediaSourceMediaProvider=t()}((function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var f="function"==typeof require&&require;if(!s&&f)return f(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){e.exports=function(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var r=new DataView(t),n=new DataView(e),i=t.byteLength;i--;)if(r.getUint8(i)!==n.getUint8(i))return!1;return!0}},{}],2:[function(t,e,r){"use strict";const n=r;n.bignum=t(16),n.define=t(3).define,n.base=t(5),n.constants=t(9),n.decoders=t(11),n.encoders=t(14)},{11:11,14:14,16:16,3:3,5:5,9:9}],3:[function(t,e,r){"use strict";const n=t(14),i=t(11),o=t(467);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}r.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return o(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},{11:11,14:14,467:467}],4:[function(t,e,r){"use strict";const n=t(467),i=t(7).Reporter,o=t(514).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(a,i),r.DecoderBuffer=a,a.isDecoderBuffer=function(t){return t instanceof a||"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},r.EncoderBuffer=s,s.isEncoderBuffer=function(t){return t instanceof s||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},{467:467,514:514,7:7}],5:[function(t,e,r){"use strict";const n=r;n.Reporter=t(7).Reporter,n.DecoderBuffer=t(4).DecoderBuffer,n.EncoderBuffer=t(4).EncoderBuffer,n.Node=t(6)},{4:4,6:6,7:7}],6:[function(t,e,r){"use strict";const n=t(7).Reporter,i=t(4).EncoderBuffer,o=t(4).DecoderBuffer,a=t(472),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],f=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function u(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}e.exports=u;const c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){const t=this._baseState,e={};c.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},u.prototype._wrap=function(){const t=this._baseState;f.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},u.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},u.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){u.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){u.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),u.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},u.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},u.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},u.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},u.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},u.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},u.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,i=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(a=this._peekTag(t,n,r.any),t.isError(a))return a}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(n)}}if(r.obj&&a&&(n=t.enterObject()),a){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&a&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,i),i},u.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},u.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},u.prototype._decodeChoice=function(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(o){const a=t.save(),s=r.choice[o];try{const r=s._decode(t,e);if(t.isError(r))return!1;n={type:o,value:r},i=!0}catch(e){return t.restore(a),!1}return!0}),this),i?n:t.error("Choice not matched")},u.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},u.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},u.prototype._encodeValue=function(t,e,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new n);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let a=null,s=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)a=this._getUse(i.contains,r)._encode(t,e),s=!0;else if(i.children)a=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),r))}else null!==i.use?o=this._getUse(i.use,r)._encode(t,e):(a=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,s,r,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},u.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},u.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},u.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},u.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},{4:4,472:472,7:7}],7:[function(t,e,r){"use strict";const n=t(467);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}r.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},{467:467}],8:[function(t,e,r){"use strict";function n(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e}r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=n(r.tag)},{}],9:[function(t,e,r){"use strict";const n=r;n._reverse=function(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e},n.der=t(8)},{8:8}],10:[function(t,e,r){"use strict";const n=t(467),i=t(16),o=t(4).DecoderBuffer,a=t(6),s=t(8);function f(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){a.call(this,"der",t)}function c(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const n=s.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function h(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;e<i;e++){n<<=8;const e=t.readUInt8(r);if(t.isError(e))return e;n|=e}return n}e.exports=f,f.prototype.decode=function(t,e){return o.isDecoderBuffer(t)||(t=new o(t,e)),this.tree._decode(t,e)},n(u,a),u.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;const n=t.save(),i=c(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||r)},u.prototype._decodeTag=function(t,e,r){const n=c(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;let i=h(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');const o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},u.prototype._skipUntilEnd=function(t,e){for(;;){const r=c(t,e);if(t.isError(r))return r;const n=h(t,r.primitive,e);if(t.isError(n))return n;let i;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},u.prototype._decodeList=function(t,e,r,n){const i=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=r.decode(t,"der",n);if(t.isError(o)&&e)break;i.push(o)}return i},u.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},u.prototype._decodeObjid=function(t,e,r){let n;const i=[];let o=0,a=0;for(;!t.isEmpty();)a=t.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,f=i[0]%40;if(n=r?i:[s,f].concat(i.slice(1)),e){let t=e[n.join(" ")];void 0===t&&(t=e[n.join(".")]),void 0!==t&&(n=t)}return n},u.prototype._decodeTime=function(t,e){const r=t.raw().toString();let n,i,o,a,s,f;if("gentime"===e)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),f=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),f=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,a,s,f,0)},u.prototype._decodeNull=function(){return null},u.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},u.prototype._decodeInt=function(t,e){const r=t.raw();let n=new i(r);return e&&(n=e[n.toString(10)]||n),n},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},{16:16,4:4,467:467,6:6,8:8}],11:[function(t,e,r){"use strict";const n=r;n.der=t(10),n.pem=t(12)},{10:10,12:12}],12:[function(t,e,r){"use strict";const n=t(467),i=t(514).Buffer,o=t(10);function a(t){o.call(this,t),this.enc="pem"}n(a,o),e.exports=a,a.prototype.decode=function(t,e){const r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let s=-1,f=-1;for(let t=0;t<r.length;t++){const e=r[t].match(a);if(null!==e&&e[2]===n){if(-1!==s){if("END"!==e[1])break;f=t;break}if("BEGIN"!==e[1])break;s=t}}if(-1===s||-1===f)throw new Error("PEM section not found for: "+n);const u=r.slice(s+1,f).join("");u.replace(/[^a-z0-9+/=]+/gi,"");const c=i.from(u,"base64");return o.prototype.decode.call(this,c,e)}},{10:10,467:467,514:514}],13:[function(t,e,r){"use strict";const n=t(467),i=t(514).Buffer,o=t(6),a=t(8);function s(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new f,this.tree._init(t.body)}function f(t){o.call(this,"der",t)}function u(t){return t<10?"0"+t:t}e.exports=s,s.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},n(f,o),f.prototype._encodeComposite=function(t,e,r,n){const o=function(t,e,r,n){let i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),a.tagByName.hasOwnProperty(t))i=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=a.tagClassByName[r||"universal"]<<6,i)}(t,e,r,this.reporter);if(n.length<128){const t=i.alloc(2);return t[0]=o,t[1]=n.length,this._createEncoderBuffer([t,n])}let s=1;for(let t=n.length;t>=256;t>>=8)s++;const f=i.alloc(2+s);f[0]=o,f[1]=128|s;for(let t=1+s,e=n.length;e>0;t--,e>>=8)f[t]=255&e;return this._createEncoderBuffer([f,n])},f.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},f.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let n=0;for(let e=0;e<t.length;e++){let r=t[e];for(n++;r>=128;r>>=7)n++}const o=i.alloc(n);let a=o.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(o[a--]=127&r;(r>>=7)>0;)o[a--]=128|127&r}return this._createEncoderBuffer(o)},f.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[u(n.getUTCFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(n.getUTCFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},f.prototype._encodeNull=function(){return this._createEncoderBuffer("")},f.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=i.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const n=new Array(r);for(let e=n.length-1;e>=0;e--)n[e]=255&t,t>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},f.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},f.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},f.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},{467:467,514:514,6:6,8:8}],14:[function(t,e,r){"use strict";const n=r;n.der=t(13),n.pem=t(15)},{13:13,15:15}],15:[function(t,e,r){"use strict";const n=t(467),i=t(13);function o(t){i.call(this,t),this.enc="pem"}n(o,i),e.exports=o,o.prototype.encode=function(t,e){const r=i.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"];for(let t=0;t<r.length;t+=64)n.push(r.slice(t,t+64));return n.push("-----END "+e.label+"-----"),n.join("\n")}},{13:13,467:467}],16:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof e?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(21).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function f(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c<s;c+=n)f=u(t,c,c+n,e),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var h=1;for(f=u(t,c,t.length,e),c=0;c<a;c++)h*=e;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var c=f>>>26,h=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;c+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[u]=0|h,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],f=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-f.length]+f+r:f+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=h[t],l=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:c[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,f="le"===e,u=new t(o),c=this.clone();if(f){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,a=t.words,s=e.words,f=r.words,u=0,c=0|a[0],h=8191&c,d=c>>>13,l=0|a[1],p=8191&l,b=l>>>13,v=0|a[2],g=8191&v,y=v>>>13,m=0|a[3],w=8191&m,_=m>>>13,S=0|a[4],M=8191&S,E=S>>>13,k=0|a[5],x=8191&k,A=k>>>13,R=0|a[6],I=8191&R,T=R>>>13,B=0|a[7],P=8191&B,O=B>>>13,C=0|a[8],L=8191&C,j=C>>>13,N=0|a[9],D=8191&N,U=N>>>13,F=0|s[0],q=8191&F,z=F>>>13,W=0|s[1],V=8191&W,H=W>>>13,G=0|s[2],K=8191&G,X=G>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,dt=ct>>>13,lt=0|s[9],pt=8191&lt,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(b,q)|0,o=Math.imul(b,z);var gt=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,q),i=(i=Math.imul(g,z))+Math.imul(y,q)|0,o=Math.imul(y,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,H)|0;var yt=(u+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,H)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,X)|0;var mt=(u+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;u=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,z))+Math.imul(E,q)|0,o=Math.imul(E,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0;var wt=(u+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(A,q)|0,o=Math.imul(A,z),n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(T,q)|0,o=Math.imul(T,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,H)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var St=(u+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(O,q)|0,o=Math.imul(O,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var Mt=(u+(n=n+Math.imul(h,ft)|0)|0)+((8191&(i=(i=i+Math.imul(h,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(j,q)|0,o=Math.imul(j,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ut)|0;var Et=(u+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,z))+Math.imul(U,q)|0,o=Math.imul(U,z),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(j,V)|0,o=o+Math.imul(j,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var kt=(u+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(j,K)|0,o=o+Math.imul(j,X)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,X))+Math.imul(U,K)|0,o=Math.imul(U,X),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,dt)|0;var At=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((o=o+Math.imul(y,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,ut)|0,n=n+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,dt)|0;var Rt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,ut)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,bt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ut)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,ut)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,dt)|0;var Bt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((o=o+Math.imul(T,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ut))+Math.imul(U,ft)|0,o=Math.imul(U,ut),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,dt)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,dt))+Math.imul(U,ht)|0,o=Math.imul(U,dt);var Ot=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,bt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(u+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,bt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,f[0]=vt,f[1]=gt,f[2]=yt,f[3]=mt,f[4]=wt,f[5]=_t,f[6]=St,f[7]=Mt,f[8]=Et,f[9]=kt,f[10]=xt,f[11]=At,f[12]=Rt,f[13]=It,f[14]=Tt,f[15]=Bt,f[16]=Pt,f[17]=Ot,f[18]=Ct,0!==u&&(f[19]=u,r.length++),r};function b(t,e,r){return(new v).mulp(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(p=l),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?l(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,f=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=f;u++){var c=o-u,h=(0|t.words[c])*(0|e.words[u]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},v.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,f=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var h=f,d=u,l=0;l<a;l++){var p=r[c+l],b=n[c+l],v=r[c+l+a],g=n[c+l+a],y=h*v-d*g;g=h*g+d*v,v=y,r[c+l]=p+v,n[c+l]=b+g,r[c+l+a]=p-v,n[c+l+a]=b-g,l!==s&&(y=f*h-u*d,d=f*d+u*h,h=y)}},v.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},v.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},v.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},v.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),f=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,u,n),this.transform(a,o,s,f,n,i),this.transform(u,o,c,h,n,i);for(var l=0;l<n;l++){var p=s[l]*c[l]-f[l]*h[l];f[l]=s[l]*h[l]+f[l]*c[l],s[l]=p}return this.conjugate(s,f,n),this.transform(s,f,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,f=(0|this.words[e])-s<<r;this.words[e]=f|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,f=r;if(i-=a,i=Math.max(0,i),f){for(var u=0;u<a;u++)f.words[u]=this.words[u];f.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;u>=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var f=(0|t.words[i])*e;s=((o-=67108863&f)>>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,f=n.length-i.length;if("mod"!==e){(s=new o(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var c=n.clone()._ishlnsubmul(i,1,f);0===c.negative&&(n=c,s&&(s.words[f]=1));for(var h=f-1;h>=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),f=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(c),f.isub(h)),s.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(f)):(r.isub(e),s.isub(i),f.isub(a))}return{a:s,b:f,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),f=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(m,y),m.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},m.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,y),i(_,y),i(S,y),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new m;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,v=0;0!==b.cmp(s);v++)b=b.redSqr();n(v<p);var g=this.pow(h,new o(1).iushln(p-v-1));d=d.redMul(g),h=g.redSqr(),l=l.redMul(h),p=v}return d},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,f=e.bitLength()%26;for(0===f&&(f=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],c=f-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{21:21}],17:[function(t,e,r){(function(e){(function(){"use strict";if(t(397),t(511),t(69),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");function r(t,e,r){t[e]||Object.defineProperty(t,e,{writable:!0,configurable:!0,value:r})}e._babelPolyfill=!0,r(String.prototype,"padLeft","".padStart),r(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach((function(t){[][t]&&r(Array,t,Function.call.bind([][t]))}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{397:397,511:511,69:69}],18:[function(t,e,r){"use strict";r.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;return 2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,f[c++]=255&e),1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e),f},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=16383,s=0,f=r-i;s<f;s+=a)o.push(c(t,s,s+a>f?f:s+a));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,f=a.length;s<f;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],19:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof e?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(21).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function f(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),f=e;f<s;f++){var u=t.charCodeAt(f)-48;o*=i,a=u>=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c<s;c+=n)f=u(t,c,c+n,e),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var h=1;for(f=u(t,c,t.length,e),c=0;c<a;c++)h*=e;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){c(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var c=f>>>26,h=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;c+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[u]=0|h,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],f=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?d[6-f.length]+f+r:f+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],c=p[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var b=h.modrn(c).toString(t);r=(h=h.idivn(c)).isZero()?b+r:d[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var v=function(t,e,r){var n,i,o,a=t.words,s=e.words,f=r.words,u=0,c=0|a[0],h=8191&c,d=c>>>13,l=0|a[1],p=8191&l,b=l>>>13,v=0|a[2],g=8191&v,y=v>>>13,m=0|a[3],w=8191&m,_=m>>>13,S=0|a[4],M=8191&S,E=S>>>13,k=0|a[5],x=8191&k,A=k>>>13,R=0|a[6],I=8191&R,T=R>>>13,B=0|a[7],P=8191&B,O=B>>>13,C=0|a[8],L=8191&C,j=C>>>13,N=0|a[9],D=8191&N,U=N>>>13,F=0|s[0],q=8191&F,z=F>>>13,W=0|s[1],V=8191&W,H=W>>>13,G=0|s[2],K=8191&G,X=G>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,dt=ct>>>13,lt=0|s[9],pt=8191&lt,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(b,q)|0,o=Math.imul(b,z);var gt=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,q),i=(i=Math.imul(g,z))+Math.imul(y,q)|0,o=Math.imul(y,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,H)|0;var yt=(u+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,H)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,X)|0;var mt=(u+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;u=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,z))+Math.imul(E,q)|0,o=Math.imul(E,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0;var wt=(u+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(A,q)|0,o=Math.imul(A,z),n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(T,q)|0,o=Math.imul(T,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,H)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var St=(u+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(O,q)|0,o=Math.imul(O,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var Mt=(u+(n=n+Math.imul(h,ft)|0)|0)+((8191&(i=(i=i+Math.imul(h,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(j,q)|0,o=Math.imul(j,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ut)|0;var Et=(u+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,z))+Math.imul(U,q)|0,o=Math.imul(U,z),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(j,V)|0,o=o+Math.imul(j,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var kt=(u+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(j,K)|0,o=o+Math.imul(j,X)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,X))+Math.imul(U,K)|0,o=Math.imul(U,X),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,dt)|0;var At=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((o=o+Math.imul(y,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,ut)|0,n=n+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,dt)|0;var Rt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,ut)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,bt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ut)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,ut)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,dt)|0;var Bt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((o=o+Math.imul(T,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ut))+Math.imul(U,ft)|0,o=Math.imul(U,ut),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,dt)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,dt))+Math.imul(U,ht)|0,o=Math.imul(U,dt);var Ot=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,bt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(u+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,bt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,f[0]=vt,f[1]=gt,f[2]=yt,f[3]=mt,f[4]=wt,f[5]=_t,f[6]=St,f[7]=Mt,f[8]=Et,f[9]=kt,f[10]=xt,f[11]=At,f[12]=Rt,f[13]=It,f[14]=Tt,f[15]=Bt,f[16]=Pt,f[17]=Ot,f[18]=Ct,0!==u&&(f[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,f=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=f;u++){var c=o-u,h=(0|t.words[c])*(0|e.words[u]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(v=b),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?v(this,t,e):r<63?b(this,t,e):r<1024?g(this,t,e):y(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,f=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var h=f,d=u,l=0;l<a;l++){var p=r[c+l],b=n[c+l],v=r[c+l+a],g=n[c+l+a],y=h*v-d*g;g=h*g+d*v,v=y,r[c+l]=p+v,n[c+l]=b+g,r[c+l+a]=p-v,n[c+l+a]=b-g,l!==s&&(y=f*h-u*d,d=f*d+u*h,h=y)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),f=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,u,n),this.transform(a,o,s,f,n,i),this.transform(u,o,c,h,n,i);for(var l=0;l<n;l++){var p=s[l]*c[l]-f[l]*h[l];f[l]=s[l]*h[l]+f[l]*c[l],s[l]=p}return this.conjugate(s,f,n),this.transform(s,f,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,f=(0|this.words[e])-s<<r;this.words[e]=f|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,f=r;if(i-=a,i=Math.max(0,i),f){for(var u=0;u<a;u++)f.words[u]=this.words[u];f.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;u>=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var f=(0|t.words[i])*e;s=((o-=67108863&f)>>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,f=n.length-i.length;if("mod"!==e){(s=new o(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var c=n.clone()._ishlnsubmul(i,1,f);0===c.negative&&(n=c,s&&(s.words[f]=1));for(var h=f-1;h>=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),f=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(c),f.isub(h)),s.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(f)):(r.isub(e),s.isub(i),f.isub(a))}return{a:s,b:f,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),f=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(S,_),S.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(M,_),i(E,_),i(k,_),k.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new M;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return w[t]=e,e},x.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,v=0;0!==b.cmp(s);v++)b=b.redSqr();n(v<p);var g=this.pow(h,new o(1).iushln(p-v-1));d=d.redMul(g),h=g.redSqr(),l=l.redMul(h),p=v}return d},x.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},x.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,f=e.bitLength()%26;for(0===f&&(f=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],c=f-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,x),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{21:21}],20:[function(t,e,r){var n;function i(t){this.rand=t}if(e.exports=function(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=t(21);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},{21:21}],21:[function(t,e,r){},{}],22:[function(t,e,r){var n=t(513).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i<e;i++)r[i]=t.readUInt32BE(4*i);return r}function o(t){for(;0<t.length;t++)t[0]=0}function a(t,e,r,n,i){for(var o,a,s,f,u=r[0],c=r[1],h=r[2],d=r[3],l=t[0]^e[0],p=t[1]^e[1],b=t[2]^e[2],v=t[3]^e[3],g=4,y=1;y<i;y++)o=u[l>>>24]^c[p>>>16&255]^h[b>>>8&255]^d[255&v]^e[g++],a=u[p>>>24]^c[b>>>16&255]^h[v>>>8&255]^d[255&l]^e[g++],s=u[b>>>24]^c[v>>>16&255]^h[l>>>8&255]^d[255&p]^e[g++],f=u[v>>>24]^c[l>>>16&255]^h[p>>>8&255]^d[255&b]^e[g++],l=o,p=a,b=s,v=f;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&v])^e[g++],a=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[v>>>8&255]<<8|n[255&l])^e[g++],s=(n[b>>>24]<<24|n[v>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[g++],f=(n[v>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[g++],[o>>>=0,a>>>=0,s>>>=0,f>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],f=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,f=0;f<256;++f){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[a]=u,n[u]=a;var c=t[a],h=t[c],d=t[h],l=257*t[u]^16843008*u;i[0][a]=l<<24|l>>>8,i[1][a]=l<<16|l>>>16,i[2][a]=l<<8|l>>>24,i[3][a]=l,l=16843009*d^65537*h^257*c^16843008*a,o[0][u]=l<<24|l>>>8,o[1][u]=l<<16|l>>>16,o[2][u]=l<<8|l>>>24,o[3][u]=l,0===a?a=s=1:(a=c^t[t[t[d^c]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function u(t){this._key=i(t),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>24,a=f.SBOX[a>>>24]<<24|f.SBOX[a>>>16&255]<<16|f.SBOX[a>>>8&255]<<8|f.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=f.SBOX[a>>>24]<<24|f.SBOX[a>>>16&255]<<16|f.SBOX[a>>>8&255]<<8|f.SBOX[255&a]),i[o]=i[o-e]^a}for(var u=[],c=0;c<n;c++){var h=n-c,d=i[h-(c%4?0:4)];u[c]=c<4||h<=4?d:f.INV_SUB_MIX[0][f.SBOX[d>>>24]]^f.INV_SUB_MIX[1][f.SBOX[d>>>16&255]]^f.INV_SUB_MIX[2][f.SBOX[d>>>8&255]]^f.INV_SUB_MIX[3][f.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,f.SUB_MIX,f.SBOX,this._nRounds)},u.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},u.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,f.INV_SUB_MIX,f.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=u},{513:513}],23:[function(t,e,r){var n=t(22),i=t(513).Buffer,o=t(68),a=t(467),s=t(27),f=t(66),u=t(28);function c(t,e,r,a){o.call(this);var f=i.alloc(4,0);this._cipher=new n.AES(e);var c=this._cipher.encryptBlock(f);this._ghash=new s(c),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new s(r),o=e.length,a=o%16;n.update(e),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var f=8*o,c=i.alloc(8);c.writeUIntBE(f,0,8),n.update(c),t._finID=n.state;var h=i.from(t._finID);return u(h),h}(this,r,c),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(c,o),c.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=f(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},c.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},c.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},c.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},e.exports=c},{22:22,27:27,28:28,467:467,513:513,66:66,68:68}],24:[function(t,e,r){var n=t(26),i=t(25),o=t(36);r.createCipher=r.Cipher=n.createCipher,r.createCipheriv=r.Cipheriv=n.createCipheriv,r.createDecipher=r.Decipher=i.createDecipher,r.createDecipheriv=r.Decipheriv=i.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(o)}},{25:25,26:26,36:36}],25:[function(t,e,r){var n=t(23),i=t(513).Buffer,o=t(35),a=t(38),s=t(68),f=t(22),u=t(435);function c(t,e,r){s.call(this),this._cache=new h,this._last=void 0,this._cipher=new f.AES(e),this._prev=i.from(r),this._mode=t,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function d(t,e,r){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=i.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=i.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,r,!0):"auth"===s.type?new n(s.module,e,r,!0):new c(s.module,e,r)}t(467)(c,s),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return i.concat(n)},c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var r=-1;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(16!==e)return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=i.concat([this.cache,t])},h.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=u(e,!1,r.key,r.iv);return d(t,n.key,n.iv)},r.createDecipheriv=d},{22:22,23:23,35:35,38:38,435:435,467:467,513:513,68:68}],26:[function(t,e,r){var n=t(35),i=t(23),o=t(513).Buffer,a=t(38),s=t(68),f=t(22),u=t(435);function c(t,e,r){s.call(this),this._cache=new d,this._cipher=new f.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}t(467)(c,s),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var h=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function l(t,e,r){var s=n[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,e,r):"auth"===s.type?new i(s.module,e,r):new c(s.module,e,r)}c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},d.prototype.add=function(t){this.cache=o.concat([this.cache,t])},d.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return o.concat([this.cache,e])},r.createCipheriv=l,r.createCipher=function(t,e){var r=n[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=u(e,!1,r.key,r.iv);return l(t,i.key,i.iv)}},{22:22,23:23,35:35,38:38,435:435,467:467,513:513,68:68}],27:[function(t,e,r){var n=t(513).Buffer,i=n.alloc(16,0);function o(t){var e=n.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,r,n=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),r=0!=(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},e.exports=a},{513:513}],28:[function(t,e,r){e.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},{}],29:[function(t,e,r){var n=t(66);r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{66:66}],30:[function(t,e,r){var n=t(513).Buffer,i=t(66);function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}r.encrypt=function(t,e,r){for(var i,a=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},{513:513,66:66}],31:[function(t,e,r){var n=t(513).Buffer;function i(t,e,r){for(var n,i,a=-1,s=0;++a<8;)n=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>a%8,t._prev=o(t._prev,r?n:i);return s}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i<r;)o[i]=t[i]<<1|t[i+1]>>7;return o}r.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},{513:513}],32:[function(t,e,r){var n=t(513).Buffer;function i(t,e,r){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=n.concat([t._prev.slice(1),n.from([r?e:i])]),i}r.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},{513:513}],33:[function(t,e,r){var n=t(66),i=t(513).Buffer,o=t(28);function a(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}r.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var f=a(t),u=o+16*s;t._cache.writeUInt32BE(f[0],u+0),t._cache.writeUInt32BE(f[1],u+4),t._cache.writeUInt32BE(f[2],u+8),t._cache.writeUInt32BE(f[3],u+12)}var c=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),n(e,c)}},{28:28,513:513,66:66}],34:[function(t,e,r){r.encrypt=function(t,e){return t._cipher.encryptBlock(e)},r.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},{}],35:[function(t,e,r){var n={ECB:t(34),CBC:t(29),CFB:t(30),CFB8:t(32),CFB1:t(31),OFB:t(37),CTR:t(33),GCM:t(33)},i=t(36);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},{29:29,30:30,31:31,32:32,33:33,34:34,36:36,37:37}],36:[function(t,e,r){e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},{}],37:[function(t,e,r){(function(e){(function(){var n=t(66);function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}r.encrypt=function(t,r){for(;t._cache.length<r.length;)t._cache=e.concat([t._cache,i(t)]);var o=t._cache.slice(0,r.length);return t._cache=t._cache.slice(r.length),n(r,o)}}).call(this)}).call(this,t(67).Buffer)},{66:66,67:67}],38:[function(t,e,r){var n=t(22),i=t(513).Buffer,o=t(68);function a(t,e,r,a){o.call(this),this._cipher=new n.AES(e),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}t(467)(a,o),a.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},e.exports=a},{22:22,467:467,513:513,68:68}],39:[function(t,e,r){var n=t(40),i=t(24),o=t(35),a=t(41),s=t(435);function f(t,e,r){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function u(t,e,r){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}r.createCipher=r.Cipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return f(t,i.key,i.iv)},r.createCipheriv=r.Cipheriv=f,r.createDecipher=r.Decipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return u(t,i.key,i.iv)},r.createDecipheriv=r.Decipheriv=u,r.listCiphers=r.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},{24:24,35:35,40:40,41:41,435:435}],40:[function(t,e,r){var n=t(68),i=t(406),o=t(467),a=t(513).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function f(t){n.call(this);var e,r=t.mode.toLowerCase(),i=s[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=a.concat([o,o.slice(0,8)]));var f=t.iv;a.isBuffer(f)||(f=a.from(f)),this._des=i.create({key:o,iv:f,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=f,o(f,n),f.prototype._update=function(t){return a.from(this._des.update(t))},f.prototype._final=function(){return a.from(this._des.final())}},{406:406,467:467,513:513,68:68}],41:[function(t,e,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],42:[function(t,e,r){(function(r){(function(){var n=t(19),i=t(496);function o(t){var e,r=t.modulus.byteLength();do{e=new n(i(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var i=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),a=e.modulus.byteLength(),s=new n(t).mul(i.blinder).umod(e.modulus),f=s.toRed(n.mont(e.prime1)),u=s.toRed(n.mont(e.prime2)),c=e.coefficient,h=e.prime1,d=e.prime2,l=f.redPow(e.exponent1).fromRed(),p=u.redPow(e.exponent2).fromRed(),b=l.isub(p).imul(c).umod(h).imul(d);return p.iadd(b).imul(i.unblinder).umod(e.modulus).toArrayLike(r,"be",a)}a.getr=o,e.exports=a}).call(this)}).call(this,t(67).Buffer)},{19:19,496:496,67:67}],43:[function(t,e,r){e.exports=t(44)},{44:44}],44:[function(t,e,r){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],45:[function(t,e,r){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],46:[function(t,e,r){var n=t(64).Buffer,i=t(401),o=t(63),a=t(467),s=t(47),f=t(48),u=t(44);function c(t){o.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){o.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function d(t){return new c(t)}function l(t){return new h(t)}Object.keys(u).forEach((function(t){u[t].id=n.from(u[t].id,"hex"),u[t.toLowerCase()]=u[t]})),a(c,o.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},c.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=s(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},a(h,o.Writable),h.prototype._write=function(t,e,r){this._hash.update(t),r()},h.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},h.prototype.verify=function(t,e,r){"string"==typeof e&&(e=n.from(e,r)),this.end();var i=this._hash.digest();return f(e,i,t,this._signType,this._tag)},e.exports={Sign:d,Verify:l,createSign:d,createVerify:l}},{401:401,44:44,467:467,47:47,48:48,63:63,64:64}],47:[function(t,e,r){var n=t(64).Buffer,i=t(403),o=t(42),a=t(417).ec,s=t(19),f=t(479),u=t(45);function c(t,e,r,o){if((t=n.from(t.toArray())).length<e.byteLength()){var a=n.alloc(e.byteLength()-t.length);t=n.concat([a,t])}var s=r.length,f=function(t,e){t=(t=h(t,e)).mod(e);var r=n.from(t.toArray());if(r.length<e.byteLength()){var i=n.alloc(e.byteLength()-r.length);r=n.concat([i,r])}return r}(r,e),u=n.alloc(s);u.fill(1);var c=n.alloc(s);return c=i(o,c).update(u).update(n.from([0])).update(t).update(f).digest(),u=i(o,c).update(u).digest(),{k:c=i(o,c).update(u).update(n.from([1])).update(t).update(f).digest(),v:u=i(o,c).update(u).digest()}}function h(t,e){var r=new s(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function d(t,e,r){var o,a;do{for(o=n.alloc(0);8*o.length<t.bitLength();)e.v=i(r,e.k).update(e.v).digest(),o=n.concat([o,e.v]);a=h(o,t),e.k=i(r,e.k).update(e.v).update(n.from([0])).digest(),e.v=i(r,e.k).update(e.v).digest()}while(-1!==a.cmp(t));return a}function l(t,e,r,n){return t.toRed(s.mont(r)).redPow(e).fromRed().mod(n)}e.exports=function(t,e,r,i,p){var b=f(e);if(b.curve){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");return function(t,e){var r=u[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var i=new a(r).keyFromPrivate(e.privateKey).sign(t);return n.from(i.toDER())}(t,b)}if("dsa"===b.type){if("dsa"!==i)throw new Error("wrong private key type");return function(t,e,r){for(var i,o=e.params.priv_key,a=e.params.p,f=e.params.q,u=e.params.g,p=new s(0),b=h(t,f).mod(f),v=!1,g=c(o,f,t,r);!1===v;)p=l(u,i=d(f,g,r),a,f),0===(v=i.invm(f).imul(b.add(o.mul(p))).mod(f)).cmpn(0)&&(v=!1,p=new s(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t)),128&e[0]&&(e=[0].concat(e));var r=[48,t.length+e.length+4,2,t.length];return r=r.concat(t,[2,e.length],e),n.from(r)}(p,v)}(t,b,r)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");t=n.concat([p,t]);for(var v=b.modulus.byteLength(),g=[0,1];t.length+g.length+1<v;)g.push(255);g.push(0);for(var y=-1;++y<t.length;)g.push(t[y]);return o(g,b)},e.exports.getKey=c,e.exports.makeKey=d},{19:19,403:403,417:417,42:42,45:45,479:479,64:64}],48:[function(t,e,r){var n=t(64).Buffer,i=t(19),o=t(417).ec,a=t(479),s=t(45);function f(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}e.exports=function(t,e,r,u,c){var h=a(r);if("ec"===h.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),a=r.data.subjectPrivateKey.data;return i.verify(e,t,a)}(t,e,h)}if("dsa"===h.type){if("dsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,o=r.data.q,s=r.data.g,u=r.data.pub_key,c=a.signature.decode(t,"der"),h=c.s,d=c.r;f(h,o),f(d,o);var l=i.mont(n),p=h.invm(o);return 0===s.toRed(l).redPow(new i(e).mul(p).mod(o)).fromRed().mul(u.toRed(l).redPow(d.mul(p).mod(o)).fromRed()).mod(n).mod(o).cmp(d)}(t,e,h)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");e=n.concat([c,e]);for(var d=h.modulus.byteLength(),l=[1],p=0;e.length+l.length+2<d;)l.push(255),p++;l.push(0);for(var b=-1;++b<e.length;)l.push(e[b]);l=n.from(l);var v=i.mont(h.modulus);t=(t=new i(t).toRed(v)).redPow(new i(h.publicExponent)),t=n.from(t.fromRed().toArray());var g=p<8?1:0;for(d=Math.min(t.length,l.length),t.length!==l.length&&(g=1),b=-1;++b<d;)g|=t[b]^l[b];return 0===g}},{19:19,417:417,45:45,479:479,64:64}],49:[function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,s;if("string"==typeof e&&(i="not ",e.substr(0,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var f=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";s='The "'.concat(t,'" ').concat(f," ").concat(n," ").concat(o(e,"type"))}return s+". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],50:[function(t,e,r){(function(r){(function(){"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=u;var i=t(52),o=t(54);t(467)(u,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var f=a[s];u.prototype[f]||(u.prototype[f]=o.prototype[f])}function u(t){if(!(this instanceof u))return new u(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||r.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t(487))},{467:467,487:487,52:52,54:54}],51:[function(t,e,r){"use strict";e.exports=i;var n=t(53);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}t(467)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},{467:467,53:53}],52:[function(t,e,r){(function(r,n){(function(){"use strict";var i;e.exports=k,k.ReadableState=E,t(434).EventEmitter;var u,o=function(t,e){return t.listeners(e).length},a=t(62),s=t(67).Buffer,f=n.Uint8Array||function(){},c=t(21);u=c&&c.debuglog?c.debuglog("stream"):function(){};var h,d,l,p=t(56),b=t(57),v=t(61).getHighWaterMark,g=t(49).codes,y=g.ERR_INVALID_ARG_TYPE,m=g.ERR_STREAM_PUSH_AFTER_EOF,w=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t(467)(k,a);var S=b.errorOrDestroy,M=["error","close","destroy","pause","resume"];function E(e,r,n){i=i||t(50),e=e||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=v(this,e,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=t(525).StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function k(e){if(i=i||t(50),!(this instanceof k))return new k(e);var r=this instanceof i;this._readableState=new E(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function x(t,e,r,n,i){u("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(u("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?T(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(o=function(t,e){var r,n;return n=e,s.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e)),r}(a,e)),o)S(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?S(t,new _):A(t,a,e,!0);else if(a.ended)S(t,new m);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?A(t,a,e,!1):P(t,a)):A(t,a,e,!1)}else n||(a.reading=!1,P(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function A(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&T(t)),P(t,e)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),k.prototype.destroy=b.destroy,k.prototype._undestroy=b.undestroy,k.prototype._destroy=function(t,e){e(t)},k.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},k.prototype.unshift=function(t){return x(this,t,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(e){h||(h=t(525).StringDecoder);var r=new h(e);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var R=1073741824;function I(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=R?t=R:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(B,t))}function B(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function P(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(O,t,e))}function O(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(u("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function C(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){u("readable nexttick read 0"),t.read(0)}function j(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function D(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(F,e,t))}function F(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function q(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}k.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):T(this),null;if(0===(t=I(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=I(r,e))),null===(n=t>0?D(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},k.prototype._read=function(t){S(this,new w("_read()"))},k.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var a=e&&!1===e.end||t===r.stdout||t===r.stderr?v:f;function f(){u("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",(function s(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),t.removeListener("drain",c),t.removeListener("error",l),t.removeListener("unpipe",s),n.removeListener("end",f),n.removeListener("end",v),n.removeListener("data",d),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",c);var h=!1;function d(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==q(i.pipes,t))&&!h&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function l(e){u("onerror",e),v(),t.removeListener("error",l),0===o(t,"error")&&S(t,e)}function p(){t.removeListener("finish",b),v()}function b(){u("onfinish"),t.removeListener("close",p),v()}function v(){u("unpipe"),n.unpipe(t)}return n.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",p),t.once("finish",b),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},k.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=q(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},k.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?T(this):i.reading||r.nextTick(L,this))),n},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(C,this),n},k.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(C,this),e},k.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(j,t,e))}(this,t)),t.paused=!1,this},k.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<M.length;o++)t.on(M[o],this.emit.bind(this,M[o]));return this._read=function(e){u("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=t(55)),d(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),k._fromList=D,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(e,r){return void 0===l&&(l=t(59)),l(k,e,r)})}).call(this)}).call(this,t(487),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{21:21,434:434,467:467,487:487,49:49,50:50,525:525,55:55,56:56,57:57,59:59,61:61,62:62,67:67}],53:[function(t,e,r){"use strict";e.exports=c;var n=t(49).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,f=t(50);function u(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(t){if(!(this instanceof c))return new c(t);f.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,r){d(t,e,r)}))}function d(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}t(467)(c,f),c.prototype.push=function(t,e){return this._transformState.needTransform=!1,f.prototype.push.call(this,t,e)},c.prototype._transform=function(t,e,r){r(new i("_transform()"))},c.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},c.prototype._destroy=function(t,e){f.prototype._destroy.call(this,t,(function(t){e(t)}))}},{467:467,49:49,50:50}],54:[function(t,e,r){(function(r,n){(function(){"use strict";function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(void 0),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;e.exports=k,k.WritableState=E;var c,a={deprecate:t(527)},s=t(62),f=t(67).Buffer,u=n.Uint8Array||function(){},h=t(57),d=t(61).getHighWaterMark,l=t(49).codes,p=l.ERR_INVALID_ARG_TYPE,b=l.ERR_METHOD_NOT_IMPLEMENTED,v=l.ERR_MULTIPLE_CALLBACK,g=l.ERR_STREAM_CANNOT_PIPE,y=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,_=l.ERR_UNKNOWN_ENCODING,S=h.errorOrDestroy;function M(){}function E(e,n,a){o=o||t(50),e=e||{},"boolean"!=typeof a&&(a=n instanceof o),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new v;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(B,t,e),t._writableState.errorEmitted=!0,S(t,i)):(o(i),t._writableState.errorEmitted=!0,S(t,i),B(t,e))}(t,n,i,e,o);else{var a=I(n)||t.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||R(t,n),i?r.nextTick(A,t,n,a,o):A(t,n,a,o)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function k(e){var r=this instanceof(o=o||t(50));if(!r&&!c.call(k,this))return new k(e);this._writableState=new E(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function x(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function A(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),B(t,e)}function R(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,f=!0;r;)o[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;o.allBuffers=f,x(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(x(t,e,!1,e.objectMode?1:u.length,u,c,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function I(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function T(t,e){t._final((function(r){e.pendingcb--,r&&S(t,r),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=I(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(T,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}t(467)(k,s),E.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(E.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===k&&t&&t._writableState instanceof E}})):c=function(t){return t instanceof this},k.prototype.pipe=function(){S(this,new g)},k.prototype.write=function(t,e,n){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,f.isBuffer(i)||i instanceof u);return s&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new w;S(t,n),r.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var o;return null===n?o=new m:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(S(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else x(t,e,!1,s,n,i,o);return u}(this,o,s,t,e,n)),a},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||R(this,t))},k.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(t,e,r){r(new b("_write()"))},k.prototype._writev=null,k.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),k.prototype.destroy=h.destroy,k.prototype._undestroy=h.undestroy,k.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t(487),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{467:467,487:487,49:49,50:50,527:527,57:57,61:61,62:62,67:67}],55:[function(t,e,r){(function(r){(function(){"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t(58),a=Symbol("lastResolve"),s=Symbol("lastReject"),f=Symbol("error"),u=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function l(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[c]=null,t[a]=null,t[s]=null,e(l(r,!1)))}}function b(t){r.nextTick(p,t)}var v=Object.getPrototypeOf((function(){})),g=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(l(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){r.nextTick((function(){t[f]?n(t[f]):e(l(void 0,!0))}))}));var n,i=this[c];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[u]?r(l(void 0,!0)):e[h](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(l(o,!1));n=new Promise(this[h])}return this[c]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(l(void 0,!0))}))}))})),n),v);e.exports=function(t){var e,r=Object.create(g,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,f,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var n=r[d].read();n?(r[c]=null,r[a]=null,r[s]=null,t(l(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[c]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[c]=null,r[a]=null,r[s]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[c]=null,r[a]=null,r[s]=null,n(l(void 0,!0))),r[u]=!0})),t.on("readable",b.bind(null,r)),r}}).call(this)}).call(this,t(487))},{487:487,58:58}],56:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=t(67).Buffer,s=t(21).inspect,f=s&&s.custom||"inspect";e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:f,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),t}()},{21:21,67:67}],57:[function(t,e,r){(function(t){(function(){"use strict";function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}e.exports={destroy:function(e,o){var a=this,s=this._readableState&&this._readableState.destroyed,f=this._writableState&&this._writableState.destroyed;return s||f?(o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!o&&e?a._writableState?a._writableState.errorEmitted?t.nextTick(n,a):(a._writableState.errorEmitted=!0,t.nextTick(r,a,e)):t.nextTick(r,a,e):o?(t.nextTick(n,a),o(e)):t.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this)}).call(this,t(487))},{487:487}],58:[function(t,e,r){"use strict";var n=t(49).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,f=function(){e.writable||c()},u=e._writableState&&e._writableState.finished,c=function(){s=!1,u=!0,a||o.call(e)},h=e._readableState&&e._readableState.endEmitted,d=function(){a=!1,h=!0,s||o.call(e)},l=function(t){o.call(e,t)},p=function(){var t;return a&&!h?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!u?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},b=function(){e.req.on("finish",c)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",c),e.on("abort",p),e.req?b():e.on("request",b)):s&&!e._writableState&&(e.on("end",f),e.on("close",f)),e.on("end",d),e.on("finish",c),!1!==r.error&&e.on("error",l),e.on("close",p),function(){e.removeListener("complete",c),e.removeListener("abort",p),e.removeListener("request",b),e.req&&e.req.removeListener("finish",c),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("end",d),e.removeListener("error",l),e.removeListener("close",p)}}},{49:49}],59:[function(t,e,r){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],60:[function(t,e,r){"use strict";var n,i=t(49).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function f(e,r,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=t(58)),n(e,{readable:r,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var f=!1;return function(t){if(!s&&!f)return f=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}function u(t){t()}function c(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}e.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=h(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,r){var o=r<e.length-1;return f(t,o,r>0,(function(t){n||(n=t),t&&a.forEach(u),o||(a.forEach(u),i(n))}))}));return e.reduce(c)}},{49:49,58:58}],61:[function(t,e,r){"use strict";var n=t(49).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},{49:49}],62:[function(t,e,r){e.exports=t(434).EventEmitter},{434:434}],63:[function(t,e,r){(r=e.exports=t(52)).Stream=r,r.Readable=r,r.Writable=t(54),r.Duplex=t(50),r.Transform=t(53),r.PassThrough=t(51),r.finished=t(58),r.pipeline=t(60)},{50:50,51:51,52:52,53:53,54:54,58:58,60:60}],64:[function(t,e,r){
20
+ var KalmanFilter=function(){function KalmanFilter(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},_ref$R=_ref.R,R=void 0===_ref$R?1:_ref$R,_ref$Q=_ref.Q,Q=void 0===_ref$Q?1:_ref$Q,_ref$A=_ref.A,A=void 0===_ref$A?1:_ref$A,_ref$B=_ref.B,B=void 0===_ref$B?0:_ref$B,_ref$C=_ref.C,C=void 0===_ref$C?1:_ref$C;_classCallCheck(this,KalmanFilter),this.R=R,this.Q=Q,this.A=A,this.C=C,this.B=B,this.cov=NaN,this.x=NaN}var Constructor,protoProps,staticProps;return Constructor=KalmanFilter,(protoProps=[{key:"filter",value:function(z){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(isNaN(this.x))this.x=1/this.C*z,this.cov=1/this.C*this.Q*(1/this.C);else{var predX=this.predict(u),predCov=this.uncertainty(),K=predCov*this.C*(1/(this.C*predCov*this.C+this.Q));this.x=predX+K*(z-this.C*predX),this.cov=predCov-K*this.C*predCov}return this.x}},{key:"predict",value:function(){var u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.A*this.x+this.B*u}},{key:"uncertainty",value:function(){return this.A*this.cov*this.A+this.R}},{key:"lastMeasurement",value:function(){return this.x}},{key:"setMeasurementNoise",value:function(noise){this.Q=noise}},{key:"setProcessNoise",value:function(noise){this.R=noise}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),KalmanFilter}();module.exports=KalmanFilter},{}],3:[function(require,module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],4:[function(require,module,exports){(function(setImmediate){(function(){!function(root){var setTimeoutFunc=setTimeout;function noop(){}function Promise(fn){if(!(this instanceof Promise))throw new TypeError("Promises must be constructed via new");if("function"!=typeof fn)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],doResolve(fn,this)}function handle(self,deferred){for(;3===self._state;)self=self._value;0!==self._state?(self._handled=!0,Promise._immediateFn((function(){var cb=1===self._state?deferred.onFulfilled:deferred.onRejected;if(null!==cb){var ret;try{ret=cb(self._value)}catch(e){return void reject(deferred.promise,e)}resolve(deferred.promise,ret)}else(1===self._state?resolve:reject)(deferred.promise,self._value)}))):self._deferreds.push(deferred)}function resolve(self,newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&("object"==typeof newValue||"function"==typeof newValue)){var then=newValue.then;if(newValue instanceof Promise)return self._state=3,self._value=newValue,void finale(self);if("function"==typeof then)return void doResolve((fn=then,thisArg=newValue,function(){fn.apply(thisArg,arguments)}),self)}self._state=1,self._value=newValue,finale(self)}catch(e){reject(self,e)}var fn,thisArg}function reject(self,newValue){self._state=2,self._value=newValue,finale(self)}function finale(self){2===self._state&&0===self._deferreds.length&&Promise._immediateFn((function(){self._handled||Promise._unhandledRejectionFn(self._value)}));for(var i=0,len=self._deferreds.length;i<len;i++)handle(self,self._deferreds[i]);self._deferreds=null}function Handler(onFulfilled,onRejected,promise){this.onFulfilled="function"==typeof onFulfilled?onFulfilled:null,this.onRejected="function"==typeof onRejected?onRejected:null,this.promise=promise}function doResolve(fn,self){var done=!1;try{fn((function(value){done||(done=!0,resolve(self,value))}),(function(reason){done||(done=!0,reject(self,reason))}))}catch(ex){if(done)return;done=!0,reject(self,ex)}}Promise.prototype.catch=function(onRejected){return this.then(null,onRejected)},Promise.prototype.then=function(onFulfilled,onRejected){var prom=new this.constructor(noop);return handle(this,new Handler(onFulfilled,onRejected,prom)),prom},Promise.all=function(arr){return new Promise((function(resolve,reject){if(!arr||"undefined"==typeof arr.length)throw new TypeError("Promise.all accepts an array");var args=Array.prototype.slice.call(arr);if(0===args.length)return resolve([]);var remaining=args.length;function res(i,val){try{if(val&&("object"==typeof val||"function"==typeof val)){var then=val.then;if("function"==typeof then)return void then.call(val,(function(val){res(i,val)}),reject)}args[i]=val,0==--remaining&&resolve(args)}catch(ex){reject(ex)}}for(var i=0;i<args.length;i++)res(i,args[i])}))},Promise.resolve=function(value){return value&&"object"==typeof value&&value.constructor===Promise?value:new Promise((function(resolve){resolve(value)}))},Promise.reject=function(value){return new Promise((function(resolve,reject){reject(value)}))},Promise.race=function(values){return new Promise((function(resolve,reject){for(var i=0,len=values.length;i<len;i++)values[i].then(resolve,reject)}))},Promise._immediateFn="function"==typeof setImmediate&&function(fn){setImmediate(fn)}||function(fn){setTimeoutFunc(fn,0)},Promise._unhandledRejectionFn=function(err){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",err)},Promise._setImmediateFn=function(fn){Promise._immediateFn=fn},Promise._setUnhandledRejectionFn=function(fn){Promise._unhandledRejectionFn=fn},"undefined"!=typeof module&&module.exports?module.exports=Promise:root.Promise||(root.Promise=Promise)}(this)}).call(this)}).call(this,require("timers").setImmediate)},{timers:8}],5:[function(require,module,exports){"use strict";var SDPUtils=require("sdp");function writeMediaSection(transceiver,caps,type,stream,dtlsRole){var sdp=SDPUtils.writeRtpDescription(transceiver.kind,caps);if(sdp+=SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters()),sdp+=SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(),"offer"===type?"actpass":dtlsRole||"active"),sdp+="a=mid:"+transceiver.mid+"\r\n",transceiver.rtpSender&&transceiver.rtpReceiver?sdp+="a=sendrecv\r\n":transceiver.rtpSender?sdp+="a=sendonly\r\n":transceiver.rtpReceiver?sdp+="a=recvonly\r\n":sdp+="a=inactive\r\n",transceiver.rtpSender){var trackId=transceiver.rtpSender._initialTrackId||transceiver.rtpSender.track.id;transceiver.rtpSender._initialTrackId=trackId;var msid="msid:"+(stream?stream.id:"-")+" "+trackId+"\r\n";sdp+="a="+msid,sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" "+msid,transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" "+msid,sdp+="a=ssrc-group:FID "+transceiver.sendEncodingParameters[0].ssrc+" "+transceiver.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" cname:"+SDPUtils.localCName+"\r\n",transceiver.rtpSender&&transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" cname:"+SDPUtils.localCName+"\r\n"),sdp}function getCommonCapabilities(localCapabilities,remoteCapabilities){var commonCapabilities={codecs:[],headerExtensions:[],fecMechanisms:[]},findCodecByPayloadType=function(pt,codecs){pt=parseInt(pt,10);for(var i=0;i<codecs.length;i++)if(codecs[i].payloadType===pt||codecs[i].preferredPayloadType===pt)return codecs[i]},rtxCapabilityMatches=function(lRtx,rRtx,lCodecs,rCodecs){var lCodec=findCodecByPayloadType(lRtx.parameters.apt,lCodecs),rCodec=findCodecByPayloadType(rRtx.parameters.apt,rCodecs);return lCodec&&rCodec&&lCodec.name.toLowerCase()===rCodec.name.toLowerCase()};return localCapabilities.codecs.forEach((function(lCodec){for(var i=0;i<remoteCapabilities.codecs.length;i++){var rCodec=remoteCapabilities.codecs[i];if(lCodec.name.toLowerCase()===rCodec.name.toLowerCase()&&lCodec.clockRate===rCodec.clockRate){if("rtx"===lCodec.name.toLowerCase()&&lCodec.parameters&&rCodec.parameters.apt&&!rtxCapabilityMatches(lCodec,rCodec,localCapabilities.codecs,remoteCapabilities.codecs))continue;(rCodec=JSON.parse(JSON.stringify(rCodec))).numChannels=Math.min(lCodec.numChannels,rCodec.numChannels),commonCapabilities.codecs.push(rCodec),rCodec.rtcpFeedback=rCodec.rtcpFeedback.filter((function(fb){for(var j=0;j<lCodec.rtcpFeedback.length;j++)if(lCodec.rtcpFeedback[j].type===fb.type&&lCodec.rtcpFeedback[j].parameter===fb.parameter)return!0;return!1}));break}}})),localCapabilities.headerExtensions.forEach((function(lHeaderExtension){for(var i=0;i<remoteCapabilities.headerExtensions.length;i++){var rHeaderExtension=remoteCapabilities.headerExtensions[i];if(lHeaderExtension.uri===rHeaderExtension.uri){commonCapabilities.headerExtensions.push(rHeaderExtension);break}}})),commonCapabilities}function isActionAllowedInSignalingState(action,type,signalingState){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[type][action].indexOf(signalingState)}function maybeAddCandidate(iceTransport,candidate){var alreadyAdded=iceTransport.getRemoteCandidates().find((function(remoteCandidate){return candidate.foundation===remoteCandidate.foundation&&candidate.ip===remoteCandidate.ip&&candidate.port===remoteCandidate.port&&candidate.priority===remoteCandidate.priority&&candidate.protocol===remoteCandidate.protocol&&candidate.type===remoteCandidate.type}));return alreadyAdded||iceTransport.addRemoteCandidate(candidate),!alreadyAdded}function makeError(name,description){var e=new Error(description);return e.name=name,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[name],e}module.exports=function(window,edgeVersion){function addTrackToStreamAndFireEvent(track,stream){stream.addTrack(track),stream.dispatchEvent(new window.MediaStreamTrackEvent("addtrack",{track:track}))}function fireAddTrack(pc,track,receiver,streams){var trackEvent=new Event("track");trackEvent.track=track,trackEvent.receiver=receiver,trackEvent.transceiver={receiver:receiver},trackEvent.streams=streams,window.setTimeout((function(){pc._dispatchEvent("track",trackEvent)}))}var RTCPeerConnection=function(config){var pc=this,_eventTarget=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(method){pc[method]=_eventTarget[method].bind(_eventTarget)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",config=JSON.parse(JSON.stringify(config||{})),this.usingBundle="max-bundle"===config.bundlePolicy,"negotiate"===config.rtcpMuxPolicy)throw makeError("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(config.rtcpMuxPolicy||(config.rtcpMuxPolicy="require"),config.iceTransportPolicy){case"all":case"relay":break;default:config.iceTransportPolicy="all"}switch(config.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:config.bundlePolicy="balanced"}if(config.iceServers=function(iceServers,edgeVersion){var hasTurn=!1;return(iceServers=JSON.parse(JSON.stringify(iceServers))).filter((function(server){if(server&&(server.urls||server.url)){var urls=server.urls||server.url;server.url&&!server.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var isString="string"==typeof urls;return isString&&(urls=[urls]),urls=urls.filter((function(url){return 0===url.indexOf("turn:")&&-1!==url.indexOf("transport=udp")&&-1===url.indexOf("turn:[")&&!hasTurn?(hasTurn=!0,!0):0===url.indexOf("stun:")&&edgeVersion>=14393&&-1===url.indexOf("?transport=udp")})),delete server.url,server.urls=isString?urls[0]:urls,!!urls.length}}))}(config.iceServers||[],edgeVersion),this._iceGatherers=[],config.iceCandidatePoolSize)for(var i=config.iceCandidatePoolSize;i>0;i--)this._iceGatherers.push(new window.RTCIceGatherer({iceServers:config.iceServers,gatherPolicy:config.iceTransportPolicy}));else config.iceCandidatePoolSize=0;this._config=config,this.transceivers=[],this._sdpSessionId=SDPUtils.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(RTCPeerConnection.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(RTCPeerConnection.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),RTCPeerConnection.prototype.onicecandidate=null,RTCPeerConnection.prototype.onaddstream=null,RTCPeerConnection.prototype.ontrack=null,RTCPeerConnection.prototype.onremovestream=null,RTCPeerConnection.prototype.onsignalingstatechange=null,RTCPeerConnection.prototype.oniceconnectionstatechange=null,RTCPeerConnection.prototype.onconnectionstatechange=null,RTCPeerConnection.prototype.onicegatheringstatechange=null,RTCPeerConnection.prototype.onnegotiationneeded=null,RTCPeerConnection.prototype.ondatachannel=null,RTCPeerConnection.prototype._dispatchEvent=function(name,event){this._isClosed||(this.dispatchEvent(event),"function"==typeof this["on"+name]&&this["on"+name](event))},RTCPeerConnection.prototype._emitGatheringStateChange=function(){var event=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",event)},RTCPeerConnection.prototype.getConfiguration=function(){return this._config},RTCPeerConnection.prototype.getLocalStreams=function(){return this.localStreams},RTCPeerConnection.prototype.getRemoteStreams=function(){return this.remoteStreams},RTCPeerConnection.prototype._createTransceiver=function(kind,doNotAdd){var hasBundleTransport=this.transceivers.length>0,transceiver={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:kind,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&hasBundleTransport)transceiver.iceTransport=this.transceivers[0].iceTransport,transceiver.dtlsTransport=this.transceivers[0].dtlsTransport;else{var transports=this._createIceAndDtlsTransports();transceiver.iceTransport=transports.iceTransport,transceiver.dtlsTransport=transports.dtlsTransport}return doNotAdd||this.transceivers.push(transceiver),transceiver},RTCPeerConnection.prototype.addTrack=function(track,stream){if(this._isClosed)throw makeError("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var transceiver;if(this.transceivers.find((function(s){return s.track===track})))throw makeError("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==track.kind||(transceiver=this.transceivers[i]);return transceiver||(transceiver=this._createTransceiver(track.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(stream)&&this.localStreams.push(stream),transceiver.track=track,transceiver.stream=stream,transceiver.rtpSender=new window.RTCRtpSender(track,transceiver.dtlsTransport),transceiver.rtpSender},RTCPeerConnection.prototype.addStream=function(stream){var pc=this;if(edgeVersion>=15025)stream.getTracks().forEach((function(track){pc.addTrack(track,stream)}));else{var clonedStream=stream.clone();stream.getTracks().forEach((function(track,idx){var clonedTrack=clonedStream.getTracks()[idx];track.addEventListener("enabled",(function(event){clonedTrack.enabled=event.enabled}))})),clonedStream.getTracks().forEach((function(track){pc.addTrack(track,clonedStream)}))}},RTCPeerConnection.prototype.removeTrack=function(sender){if(this._isClosed)throw makeError("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(sender instanceof window.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var transceiver=this.transceivers.find((function(t){return t.rtpSender===sender}));if(!transceiver)throw makeError("InvalidAccessError","Sender was not created by this connection.");var stream=transceiver.stream;transceiver.rtpSender.stop(),transceiver.rtpSender=null,transceiver.track=null,transceiver.stream=null,-1===this.transceivers.map((function(t){return t.stream})).indexOf(stream)&&this.localStreams.indexOf(stream)>-1&&this.localStreams.splice(this.localStreams.indexOf(stream),1),this._maybeFireNegotiationNeeded()},RTCPeerConnection.prototype.removeStream=function(stream){var pc=this;stream.getTracks().forEach((function(track){var sender=pc.getSenders().find((function(s){return s.track===track}));sender&&pc.removeTrack(sender)}))},RTCPeerConnection.prototype.getSenders=function(){return this.transceivers.filter((function(transceiver){return!!transceiver.rtpSender})).map((function(transceiver){return transceiver.rtpSender}))},RTCPeerConnection.prototype.getReceivers=function(){return this.transceivers.filter((function(transceiver){return!!transceiver.rtpReceiver})).map((function(transceiver){return transceiver.rtpReceiver}))},RTCPeerConnection.prototype._createIceGatherer=function(sdpMLineIndex,usingBundle){var pc=this;if(usingBundle&&sdpMLineIndex>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var iceGatherer=new window.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(iceGatherer,"state",{value:"new",writable:!0}),this.transceivers[sdpMLineIndex].bufferedCandidateEvents=[],this.transceivers[sdpMLineIndex].bufferCandidates=function(event){var end=!event.candidate||0===Object.keys(event.candidate).length;iceGatherer.state=end?"completed":"gathering",null!==pc.transceivers[sdpMLineIndex].bufferedCandidateEvents&&pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event)},iceGatherer.addEventListener("localcandidate",this.transceivers[sdpMLineIndex].bufferCandidates),iceGatherer},RTCPeerConnection.prototype._gather=function(mid,sdpMLineIndex){var pc=this,iceGatherer=this.transceivers[sdpMLineIndex].iceGatherer;if(!iceGatherer.onlocalcandidate){var bufferedCandidateEvents=this.transceivers[sdpMLineIndex].bufferedCandidateEvents;this.transceivers[sdpMLineIndex].bufferedCandidateEvents=null,iceGatherer.removeEventListener("localcandidate",this.transceivers[sdpMLineIndex].bufferCandidates),iceGatherer.onlocalcandidate=function(evt){if(!(pc.usingBundle&&sdpMLineIndex>0)){var event=new Event("icecandidate");event.candidate={sdpMid:mid,sdpMLineIndex:sdpMLineIndex};var cand=evt.candidate,end=!cand||0===Object.keys(cand).length;if(end)"new"!==iceGatherer.state&&"gathering"!==iceGatherer.state||(iceGatherer.state="completed");else{"new"===iceGatherer.state&&(iceGatherer.state="gathering"),cand.component=1,cand.ufrag=iceGatherer.getLocalParameters().usernameFragment;var serializedCandidate=SDPUtils.writeCandidate(cand);event.candidate=Object.assign(event.candidate,SDPUtils.parseCandidate(serializedCandidate)),event.candidate.candidate=serializedCandidate,event.candidate.toJSON=function(){return{candidate:event.candidate.candidate,sdpMid:event.candidate.sdpMid,sdpMLineIndex:event.candidate.sdpMLineIndex,usernameFragment:event.candidate.usernameFragment}}}var sections=SDPUtils.getMediaSections(pc._localDescription.sdp);sections[event.candidate.sdpMLineIndex]+=end?"a=end-of-candidates\r\n":"a="+event.candidate.candidate+"\r\n",pc._localDescription.sdp=SDPUtils.getDescription(pc._localDescription.sdp)+sections.join("");var complete=pc.transceivers.every((function(transceiver){return transceiver.iceGatherer&&"completed"===transceiver.iceGatherer.state}));"gathering"!==pc.iceGatheringState&&(pc.iceGatheringState="gathering",pc._emitGatheringStateChange()),end||pc._dispatchEvent("icecandidate",event),complete&&(pc._dispatchEvent("icecandidate",new Event("icecandidate")),pc.iceGatheringState="complete",pc._emitGatheringStateChange())}},window.setTimeout((function(){bufferedCandidateEvents.forEach((function(e){iceGatherer.onlocalcandidate(e)}))}),0)}},RTCPeerConnection.prototype._createIceAndDtlsTransports=function(){var pc=this,iceTransport=new window.RTCIceTransport(null);iceTransport.onicestatechange=function(){pc._updateIceConnectionState(),pc._updateConnectionState()};var dtlsTransport=new window.RTCDtlsTransport(iceTransport);return dtlsTransport.ondtlsstatechange=function(){pc._updateConnectionState()},dtlsTransport.onerror=function(){Object.defineProperty(dtlsTransport,"state",{value:"failed",writable:!0}),pc._updateConnectionState()},{iceTransport:iceTransport,dtlsTransport:dtlsTransport}},RTCPeerConnection.prototype._disposeIceAndDtlsTransports=function(sdpMLineIndex){var iceGatherer=this.transceivers[sdpMLineIndex].iceGatherer;iceGatherer&&(delete iceGatherer.onlocalcandidate,delete this.transceivers[sdpMLineIndex].iceGatherer);var iceTransport=this.transceivers[sdpMLineIndex].iceTransport;iceTransport&&(delete iceTransport.onicestatechange,delete this.transceivers[sdpMLineIndex].iceTransport);var dtlsTransport=this.transceivers[sdpMLineIndex].dtlsTransport;dtlsTransport&&(delete dtlsTransport.ondtlsstatechange,delete dtlsTransport.onerror,delete this.transceivers[sdpMLineIndex].dtlsTransport)},RTCPeerConnection.prototype._transceive=function(transceiver,send,recv){var params=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);send&&transceiver.rtpSender&&(params.encodings=transceiver.sendEncodingParameters,params.rtcp={cname:SDPUtils.localCName,compound:transceiver.rtcpParameters.compound},transceiver.recvEncodingParameters.length&&(params.rtcp.ssrc=transceiver.recvEncodingParameters[0].ssrc),transceiver.rtpSender.send(params)),recv&&transceiver.rtpReceiver&&params.codecs.length>0&&("video"===transceiver.kind&&transceiver.recvEncodingParameters&&edgeVersion<15019&&transceiver.recvEncodingParameters.forEach((function(p){delete p.rtx})),transceiver.recvEncodingParameters.length?params.encodings=transceiver.recvEncodingParameters:params.encodings=[{}],params.rtcp={compound:transceiver.rtcpParameters.compound},transceiver.rtcpParameters.cname&&(params.rtcp.cname=transceiver.rtcpParameters.cname),transceiver.sendEncodingParameters.length&&(params.rtcp.ssrc=transceiver.sendEncodingParameters[0].ssrc),transceiver.rtpReceiver.receive(params))},RTCPeerConnection.prototype.setLocalDescription=function(description){var sections,sessionpart,pc=this;if(-1===["offer","answer"].indexOf(description.type))return Promise.reject(makeError("TypeError",'Unsupported type "'+description.type+'"'));if(!isActionAllowedInSignalingState("setLocalDescription",description.type,pc.signalingState)||pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not set local "+description.type+" in state "+pc.signalingState));if("offer"===description.type)sections=SDPUtils.splitSections(description.sdp),sessionpart=sections.shift(),sections.forEach((function(mediaSection,sdpMLineIndex){var caps=SDPUtils.parseRtpParameters(mediaSection);pc.transceivers[sdpMLineIndex].localCapabilities=caps})),pc.transceivers.forEach((function(transceiver,sdpMLineIndex){pc._gather(transceiver.mid,sdpMLineIndex)}));else if("answer"===description.type){sections=SDPUtils.splitSections(pc._remoteDescription.sdp),sessionpart=sections.shift();var isIceLite=SDPUtils.matchPrefix(sessionpart,"a=ice-lite").length>0;sections.forEach((function(mediaSection,sdpMLineIndex){var transceiver=pc.transceivers[sdpMLineIndex],iceGatherer=transceiver.iceGatherer,iceTransport=transceiver.iceTransport,dtlsTransport=transceiver.dtlsTransport,localCapabilities=transceiver.localCapabilities,remoteCapabilities=transceiver.remoteCapabilities;if(!(SDPUtils.isRejected(mediaSection)&&0===SDPUtils.matchPrefix(mediaSection,"a=bundle-only").length)&&!transceiver.rejected){var remoteIceParameters=SDPUtils.getIceParameters(mediaSection,sessionpart),remoteDtlsParameters=SDPUtils.getDtlsParameters(mediaSection,sessionpart);isIceLite&&(remoteDtlsParameters.role="server"),pc.usingBundle&&0!==sdpMLineIndex||(pc._gather(transceiver.mid,sdpMLineIndex),"new"===iceTransport.state&&iceTransport.start(iceGatherer,remoteIceParameters,isIceLite?"controlling":"controlled"),"new"===dtlsTransport.state&&dtlsTransport.start(remoteDtlsParameters));var params=getCommonCapabilities(localCapabilities,remoteCapabilities);pc._transceive(transceiver,params.codecs.length>0,!1)}}))}return pc._localDescription={type:description.type,sdp:description.sdp},"offer"===description.type?pc._updateSignalingState("have-local-offer"):pc._updateSignalingState("stable"),Promise.resolve()},RTCPeerConnection.prototype.setRemoteDescription=function(description){var pc=this;if(-1===["offer","answer"].indexOf(description.type))return Promise.reject(makeError("TypeError",'Unsupported type "'+description.type+'"'));if(!isActionAllowedInSignalingState("setRemoteDescription",description.type,pc.signalingState)||pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not set remote "+description.type+" in state "+pc.signalingState));var streams={};pc.remoteStreams.forEach((function(stream){streams[stream.id]=stream}));var receiverList=[],sections=SDPUtils.splitSections(description.sdp),sessionpart=sections.shift(),isIceLite=SDPUtils.matchPrefix(sessionpart,"a=ice-lite").length>0,usingBundle=SDPUtils.matchPrefix(sessionpart,"a=group:BUNDLE ").length>0;pc.usingBundle=usingBundle;var iceOptions=SDPUtils.matchPrefix(sessionpart,"a=ice-options:")[0];return pc.canTrickleIceCandidates=!!iceOptions&&iceOptions.substr(14).split(" ").indexOf("trickle")>=0,sections.forEach((function(mediaSection,sdpMLineIndex){var lines=SDPUtils.splitLines(mediaSection),kind=SDPUtils.getKind(mediaSection),rejected=SDPUtils.isRejected(mediaSection)&&0===SDPUtils.matchPrefix(mediaSection,"a=bundle-only").length,protocol=lines[0].substr(2).split(" ")[2],direction=SDPUtils.getDirection(mediaSection,sessionpart),remoteMsid=SDPUtils.parseMsid(mediaSection),mid=SDPUtils.getMid(mediaSection)||SDPUtils.generateIdentifier();if(rejected||"application"===kind&&("DTLS/SCTP"===protocol||"UDP/DTLS/SCTP"===protocol))pc.transceivers[sdpMLineIndex]={mid:mid,kind:kind,protocol:protocol,rejected:!0};else{var transceiver,iceGatherer,iceTransport,dtlsTransport,rtpReceiver,sendEncodingParameters,recvEncodingParameters,localCapabilities,track;!rejected&&pc.transceivers[sdpMLineIndex]&&pc.transceivers[sdpMLineIndex].rejected&&(pc.transceivers[sdpMLineIndex]=pc._createTransceiver(kind,!0));var remoteIceParameters,remoteDtlsParameters,remoteCapabilities=SDPUtils.parseRtpParameters(mediaSection);rejected||(remoteIceParameters=SDPUtils.getIceParameters(mediaSection,sessionpart),(remoteDtlsParameters=SDPUtils.getDtlsParameters(mediaSection,sessionpart)).role="client"),recvEncodingParameters=SDPUtils.parseRtpEncodingParameters(mediaSection);var rtcpParameters=SDPUtils.parseRtcpParameters(mediaSection),isComplete=SDPUtils.matchPrefix(mediaSection,"a=end-of-candidates",sessionpart).length>0,cands=SDPUtils.matchPrefix(mediaSection,"a=candidate:").map((function(cand){return SDPUtils.parseCandidate(cand)})).filter((function(cand){return 1===cand.component}));if(("offer"===description.type||"answer"===description.type)&&!rejected&&usingBundle&&sdpMLineIndex>0&&pc.transceivers[sdpMLineIndex]&&(pc._disposeIceAndDtlsTransports(sdpMLineIndex),pc.transceivers[sdpMLineIndex].iceGatherer=pc.transceivers[0].iceGatherer,pc.transceivers[sdpMLineIndex].iceTransport=pc.transceivers[0].iceTransport,pc.transceivers[sdpMLineIndex].dtlsTransport=pc.transceivers[0].dtlsTransport,pc.transceivers[sdpMLineIndex].rtpSender&&pc.transceivers[sdpMLineIndex].rtpSender.setTransport(pc.transceivers[0].dtlsTransport),pc.transceivers[sdpMLineIndex].rtpReceiver&&pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport(pc.transceivers[0].dtlsTransport)),"offer"!==description.type||rejected){if("answer"===description.type&&!rejected){iceGatherer=(transceiver=pc.transceivers[sdpMLineIndex]).iceGatherer,iceTransport=transceiver.iceTransport,dtlsTransport=transceiver.dtlsTransport,rtpReceiver=transceiver.rtpReceiver,sendEncodingParameters=transceiver.sendEncodingParameters,localCapabilities=transceiver.localCapabilities,pc.transceivers[sdpMLineIndex].recvEncodingParameters=recvEncodingParameters,pc.transceivers[sdpMLineIndex].remoteCapabilities=remoteCapabilities,pc.transceivers[sdpMLineIndex].rtcpParameters=rtcpParameters,cands.length&&"new"===iceTransport.state&&(!isIceLite&&!isComplete||usingBundle&&0!==sdpMLineIndex?cands.forEach((function(candidate){maybeAddCandidate(transceiver.iceTransport,candidate)})):iceTransport.setRemoteCandidates(cands)),usingBundle&&0!==sdpMLineIndex||("new"===iceTransport.state&&iceTransport.start(iceGatherer,remoteIceParameters,"controlling"),"new"===dtlsTransport.state&&dtlsTransport.start(remoteDtlsParameters)),!getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities).codecs.filter((function(c){return"rtx"===c.name.toLowerCase()})).length&&transceiver.sendEncodingParameters[0].rtx&&delete transceiver.sendEncodingParameters[0].rtx,pc._transceive(transceiver,"sendrecv"===direction||"recvonly"===direction,"sendrecv"===direction||"sendonly"===direction),!rtpReceiver||"sendrecv"!==direction&&"sendonly"!==direction?delete transceiver.rtpReceiver:(track=rtpReceiver.track,remoteMsid?(streams[remoteMsid.stream]||(streams[remoteMsid.stream]=new window.MediaStream),addTrackToStreamAndFireEvent(track,streams[remoteMsid.stream]),receiverList.push([track,rtpReceiver,streams[remoteMsid.stream]])):(streams.default||(streams.default=new window.MediaStream),addTrackToStreamAndFireEvent(track,streams.default),receiverList.push([track,rtpReceiver,streams.default])))}}else{(transceiver=pc.transceivers[sdpMLineIndex]||pc._createTransceiver(kind)).mid=mid,transceiver.iceGatherer||(transceiver.iceGatherer=pc._createIceGatherer(sdpMLineIndex,usingBundle)),cands.length&&"new"===transceiver.iceTransport.state&&(!isComplete||usingBundle&&0!==sdpMLineIndex?cands.forEach((function(candidate){maybeAddCandidate(transceiver.iceTransport,candidate)})):transceiver.iceTransport.setRemoteCandidates(cands)),localCapabilities=window.RTCRtpReceiver.getCapabilities(kind),edgeVersion<15019&&(localCapabilities.codecs=localCapabilities.codecs.filter((function(codec){return"rtx"!==codec.name}))),sendEncodingParameters=transceiver.sendEncodingParameters||[{ssrc:1001*(2*sdpMLineIndex+2)}];var stream,isNewTrack=!1;if("sendrecv"===direction||"sendonly"===direction){if(isNewTrack=!transceiver.rtpReceiver,rtpReceiver=transceiver.rtpReceiver||new window.RTCRtpReceiver(transceiver.dtlsTransport,kind),isNewTrack)track=rtpReceiver.track,remoteMsid&&"-"===remoteMsid.stream||(remoteMsid?(streams[remoteMsid.stream]||(streams[remoteMsid.stream]=new window.MediaStream,Object.defineProperty(streams[remoteMsid.stream],"id",{get:function(){return remoteMsid.stream}})),Object.defineProperty(track,"id",{get:function(){return remoteMsid.track}}),stream=streams[remoteMsid.stream]):(streams.default||(streams.default=new window.MediaStream),stream=streams.default)),stream&&(addTrackToStreamAndFireEvent(track,stream),transceiver.associatedRemoteMediaStreams.push(stream)),receiverList.push([track,rtpReceiver,stream])}else transceiver.rtpReceiver&&transceiver.rtpReceiver.track&&(transceiver.associatedRemoteMediaStreams.forEach((function(s){var nativeTrack=s.getTracks().find((function(t){return t.id===transceiver.rtpReceiver.track.id}));nativeTrack&&function(track,stream){stream.removeTrack(track),stream.dispatchEvent(new window.MediaStreamTrackEvent("removetrack",{track:track}))}(nativeTrack,s)})),transceiver.associatedRemoteMediaStreams=[]);transceiver.localCapabilities=localCapabilities,transceiver.remoteCapabilities=remoteCapabilities,transceiver.rtpReceiver=rtpReceiver,transceiver.rtcpParameters=rtcpParameters,transceiver.sendEncodingParameters=sendEncodingParameters,transceiver.recvEncodingParameters=recvEncodingParameters,pc._transceive(pc.transceivers[sdpMLineIndex],!1,isNewTrack)}}})),void 0===pc._dtlsRole&&(pc._dtlsRole="offer"===description.type?"active":"passive"),pc._remoteDescription={type:description.type,sdp:description.sdp},"offer"===description.type?pc._updateSignalingState("have-remote-offer"):pc._updateSignalingState("stable"),Object.keys(streams).forEach((function(sid){var stream=streams[sid];if(stream.getTracks().length){if(-1===pc.remoteStreams.indexOf(stream)){pc.remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,window.setTimeout((function(){pc._dispatchEvent("addstream",event)}))}receiverList.forEach((function(item){var track=item[0],receiver=item[1];stream.id===item[2].id&&fireAddTrack(pc,track,receiver,[stream])}))}})),receiverList.forEach((function(item){item[2]||fireAddTrack(pc,item[0],item[1],[])})),window.setTimeout((function(){pc&&pc.transceivers&&pc.transceivers.forEach((function(transceiver){transceiver.iceTransport&&"new"===transceiver.iceTransport.state&&transceiver.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),transceiver.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},RTCPeerConnection.prototype.close=function(){this.transceivers.forEach((function(transceiver){transceiver.iceTransport&&transceiver.iceTransport.stop(),transceiver.dtlsTransport&&transceiver.dtlsTransport.stop(),transceiver.rtpSender&&transceiver.rtpSender.stop(),transceiver.rtpReceiver&&transceiver.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},RTCPeerConnection.prototype._updateSignalingState=function(newState){this.signalingState=newState;var event=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",event)},RTCPeerConnection.prototype._maybeFireNegotiationNeeded=function(){var pc=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,window.setTimeout((function(){if(pc.needNegotiation){pc.needNegotiation=!1;var event=new Event("negotiationneeded");pc._dispatchEvent("negotiationneeded",event)}}),0))},RTCPeerConnection.prototype._updateIceConnectionState=function(){var newState,states={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(transceiver){transceiver.iceTransport&&!transceiver.rejected&&states[transceiver.iceTransport.state]++})),newState="new",states.failed>0?newState="failed":states.checking>0?newState="checking":states.disconnected>0?newState="disconnected":states.new>0?newState="new":states.connected>0?newState="connected":states.completed>0&&(newState="completed"),newState!==this.iceConnectionState){this.iceConnectionState=newState;var event=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",event)}},RTCPeerConnection.prototype._updateConnectionState=function(){var newState,states={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(transceiver){transceiver.iceTransport&&transceiver.dtlsTransport&&!transceiver.rejected&&(states[transceiver.iceTransport.state]++,states[transceiver.dtlsTransport.state]++)})),states.connected+=states.completed,newState="new",states.failed>0?newState="failed":states.connecting>0?newState="connecting":states.disconnected>0?newState="disconnected":states.new>0?newState="new":states.connected>0&&(newState="connected"),newState!==this.connectionState){this.connectionState=newState;var event=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",event)}},RTCPeerConnection.prototype.createOffer=function(){var pc=this;if(pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not call createOffer after close"));var numAudioTracks=pc.transceivers.filter((function(t){return"audio"===t.kind})).length,numVideoTracks=pc.transceivers.filter((function(t){return"video"===t.kind})).length,offerOptions=arguments[0];if(offerOptions){if(offerOptions.mandatory||offerOptions.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==offerOptions.offerToReceiveAudio&&(numAudioTracks=!0===offerOptions.offerToReceiveAudio?1:!1===offerOptions.offerToReceiveAudio?0:offerOptions.offerToReceiveAudio),void 0!==offerOptions.offerToReceiveVideo&&(numVideoTracks=!0===offerOptions.offerToReceiveVideo?1:!1===offerOptions.offerToReceiveVideo?0:offerOptions.offerToReceiveVideo)}for(pc.transceivers.forEach((function(transceiver){"audio"===transceiver.kind?--numAudioTracks<0&&(transceiver.wantReceive=!1):"video"===transceiver.kind&&--numVideoTracks<0&&(transceiver.wantReceive=!1)}));numAudioTracks>0||numVideoTracks>0;)numAudioTracks>0&&(pc._createTransceiver("audio"),numAudioTracks--),numVideoTracks>0&&(pc._createTransceiver("video"),numVideoTracks--);var sdp=SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,pc._sdpSessionVersion++);pc.transceivers.forEach((function(transceiver,sdpMLineIndex){var track=transceiver.track,kind=transceiver.kind,mid=transceiver.mid||SDPUtils.generateIdentifier();transceiver.mid=mid,transceiver.iceGatherer||(transceiver.iceGatherer=pc._createIceGatherer(sdpMLineIndex,pc.usingBundle));var localCapabilities=window.RTCRtpSender.getCapabilities(kind);edgeVersion<15019&&(localCapabilities.codecs=localCapabilities.codecs.filter((function(codec){return"rtx"!==codec.name}))),localCapabilities.codecs.forEach((function(codec){"H264"===codec.name&&void 0===codec.parameters["level-asymmetry-allowed"]&&(codec.parameters["level-asymmetry-allowed"]="1"),transceiver.remoteCapabilities&&transceiver.remoteCapabilities.codecs&&transceiver.remoteCapabilities.codecs.forEach((function(remoteCodec){codec.name.toLowerCase()===remoteCodec.name.toLowerCase()&&codec.clockRate===remoteCodec.clockRate&&(codec.preferredPayloadType=remoteCodec.payloadType)}))})),localCapabilities.headerExtensions.forEach((function(hdrExt){(transceiver.remoteCapabilities&&transceiver.remoteCapabilities.headerExtensions||[]).forEach((function(rHdrExt){hdrExt.uri===rHdrExt.uri&&(hdrExt.id=rHdrExt.id)}))}));var sendEncodingParameters=transceiver.sendEncodingParameters||[{ssrc:1001*(2*sdpMLineIndex+1)}];track&&edgeVersion>=15019&&"video"===kind&&!sendEncodingParameters[0].rtx&&(sendEncodingParameters[0].rtx={ssrc:sendEncodingParameters[0].ssrc+1}),transceiver.wantReceive&&(transceiver.rtpReceiver=new window.RTCRtpReceiver(transceiver.dtlsTransport,kind)),transceiver.localCapabilities=localCapabilities,transceiver.sendEncodingParameters=sendEncodingParameters})),"max-compat"!==pc._config.bundlePolicy&&(sdp+="a=group:BUNDLE "+pc.transceivers.map((function(t){return t.mid})).join(" ")+"\r\n"),sdp+="a=ice-options:trickle\r\n",pc.transceivers.forEach((function(transceiver,sdpMLineIndex){sdp+=writeMediaSection(transceiver,transceiver.localCapabilities,"offer",transceiver.stream,pc._dtlsRole),sdp+="a=rtcp-rsize\r\n",!transceiver.iceGatherer||"new"===pc.iceGatheringState||0!==sdpMLineIndex&&pc.usingBundle||(transceiver.iceGatherer.getLocalCandidates().forEach((function(cand){cand.component=1,sdp+="a="+SDPUtils.writeCandidate(cand)+"\r\n"})),"completed"===transceiver.iceGatherer.state&&(sdp+="a=end-of-candidates\r\n"))}));var desc=new window.RTCSessionDescription({type:"offer",sdp:sdp});return Promise.resolve(desc)},RTCPeerConnection.prototype.createAnswer=function(){var pc=this;if(pc._isClosed)return Promise.reject(makeError("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==pc.signalingState&&"have-local-pranswer"!==pc.signalingState)return Promise.reject(makeError("InvalidStateError","Can not call createAnswer in signalingState "+pc.signalingState));var sdp=SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,pc._sdpSessionVersion++);pc.usingBundle&&(sdp+="a=group:BUNDLE "+pc.transceivers.map((function(t){return t.mid})).join(" ")+"\r\n"),sdp+="a=ice-options:trickle\r\n";var mediaSectionsInOffer=SDPUtils.getMediaSections(pc._remoteDescription.sdp).length;pc.transceivers.forEach((function(transceiver,sdpMLineIndex){if(!(sdpMLineIndex+1>mediaSectionsInOffer)){if(transceiver.rejected)return"application"===transceiver.kind?"DTLS/SCTP"===transceiver.protocol?sdp+="m=application 0 DTLS/SCTP 5000\r\n":sdp+="m=application 0 "+transceiver.protocol+" webrtc-datachannel\r\n":"audio"===transceiver.kind?sdp+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===transceiver.kind&&(sdp+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(sdp+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+transceiver.mid+"\r\n");var localTrack;if(transceiver.stream)"audio"===transceiver.kind?localTrack=transceiver.stream.getAudioTracks()[0]:"video"===transceiver.kind&&(localTrack=transceiver.stream.getVideoTracks()[0]),localTrack&&edgeVersion>=15019&&"video"===transceiver.kind&&!transceiver.sendEncodingParameters[0].rtx&&(transceiver.sendEncodingParameters[0].rtx={ssrc:transceiver.sendEncodingParameters[0].ssrc+1});var commonCapabilities=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);!commonCapabilities.codecs.filter((function(c){return"rtx"===c.name.toLowerCase()})).length&&transceiver.sendEncodingParameters[0].rtx&&delete transceiver.sendEncodingParameters[0].rtx,sdp+=writeMediaSection(transceiver,commonCapabilities,"answer",transceiver.stream,pc._dtlsRole),transceiver.rtcpParameters&&transceiver.rtcpParameters.reducedSize&&(sdp+="a=rtcp-rsize\r\n")}}));var desc=new window.RTCSessionDescription({type:"answer",sdp:sdp});return Promise.resolve(desc)},RTCPeerConnection.prototype.addIceCandidate=function(candidate){var sections,pc=this;return candidate&&void 0===candidate.sdpMLineIndex&&!candidate.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(resolve,reject){if(!pc._remoteDescription)return reject(makeError("InvalidStateError","Can not add ICE candidate without a remote description"));if(candidate&&""!==candidate.candidate){var sdpMLineIndex=candidate.sdpMLineIndex;if(candidate.sdpMid)for(var i=0;i<pc.transceivers.length;i++)if(pc.transceivers[i].mid===candidate.sdpMid){sdpMLineIndex=i;break}var transceiver=pc.transceivers[sdpMLineIndex];if(!transceiver)return reject(makeError("OperationError","Can not add ICE candidate"));if(transceiver.rejected)return resolve();var cand=Object.keys(candidate.candidate).length>0?SDPUtils.parseCandidate(candidate.candidate):{};if("tcp"===cand.protocol&&(0===cand.port||9===cand.port))return resolve();if(cand.component&&1!==cand.component)return resolve();if((0===sdpMLineIndex||sdpMLineIndex>0&&transceiver.iceTransport!==pc.transceivers[0].iceTransport)&&!maybeAddCandidate(transceiver.iceTransport,cand))return reject(makeError("OperationError","Can not add ICE candidate"));var candidateString=candidate.candidate.trim();0===candidateString.indexOf("a=")&&(candidateString=candidateString.substr(2)),(sections=SDPUtils.getMediaSections(pc._remoteDescription.sdp))[sdpMLineIndex]+="a="+(cand.type?candidateString:"end-of-candidates")+"\r\n",pc._remoteDescription.sdp=SDPUtils.getDescription(pc._remoteDescription.sdp)+sections.join("")}else for(var j=0;j<pc.transceivers.length&&(pc.transceivers[j].rejected||(pc.transceivers[j].iceTransport.addRemoteCandidate({}),(sections=SDPUtils.getMediaSections(pc._remoteDescription.sdp))[j]+="a=end-of-candidates\r\n",pc._remoteDescription.sdp=SDPUtils.getDescription(pc._remoteDescription.sdp)+sections.join(""),!pc.usingBundle));j++);resolve()}))},RTCPeerConnection.prototype.getStats=function(selector){if(selector&&selector instanceof window.MediaStreamTrack){var senderOrReceiver=null;if(this.transceivers.forEach((function(transceiver){transceiver.rtpSender&&transceiver.rtpSender.track===selector?senderOrReceiver=transceiver.rtpSender:transceiver.rtpReceiver&&transceiver.rtpReceiver.track===selector&&(senderOrReceiver=transceiver.rtpReceiver)})),!senderOrReceiver)throw makeError("InvalidAccessError","Invalid selector.");return senderOrReceiver.getStats()}var promises=[];return this.transceivers.forEach((function(transceiver){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(method){transceiver[method]&&promises.push(transceiver[method].getStats())}))})),Promise.all(promises).then((function(allStats){var results=new Map;return allStats.forEach((function(stats){stats.forEach((function(stat){results.set(stat.id,stat)}))})),results}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(ortcObjectName){var obj=window[ortcObjectName];if(obj&&obj.prototype&&obj.prototype.getStats){var nativeGetstats=obj.prototype.getStats;obj.prototype.getStats=function(){return nativeGetstats.apply(this).then((function(nativeStats){var mapStats=new Map;return Object.keys(nativeStats).forEach((function(id){var stat;nativeStats[id].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(stat=nativeStats[id]).type]||stat.type,mapStats.set(id,nativeStats[id])})),mapStats}))}}}));var methods=["createOffer","createAnswer"];return methods.forEach((function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;return"function"==typeof args[0]||"function"==typeof args[1]?nativeMethod.apply(this,[arguments[2]]).then((function(description){"function"==typeof args[0]&&args[0].apply(null,[description])}),(function(error){"function"==typeof args[1]&&args[1].apply(null,[error])})):nativeMethod.apply(this,arguments)}})),(methods=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;return"function"==typeof args[1]||"function"==typeof args[2]?nativeMethod.apply(this,arguments).then((function(){"function"==typeof args[1]&&args[1].apply(null)}),(function(error){"function"==typeof args[2]&&args[2].apply(null,[error])})):nativeMethod.apply(this,arguments)}})),["getStats"].forEach((function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;return"function"==typeof args[1]?nativeMethod.apply(this,arguments).then((function(){"function"==typeof args[1]&&args[1].apply(null)})):nativeMethod.apply(this,arguments)}})),RTCPeerConnection}},{sdp:6}],6:[function(require,module,exports){"use strict";var SDPUtils={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};SDPUtils.localCName=SDPUtils.generateIdentifier(),SDPUtils.splitLines=function(blob){return blob.trim().split("\n").map((function(line){return line.trim()}))},SDPUtils.splitSections=function(blob){return blob.split("\nm=").map((function(part,index){return(index>0?"m="+part:part).trim()+"\r\n"}))},SDPUtils.getDescription=function(blob){var sections=SDPUtils.splitSections(blob);return sections&&sections[0]},SDPUtils.getMediaSections=function(blob){var sections=SDPUtils.splitSections(blob);return sections.shift(),sections},SDPUtils.matchPrefix=function(blob,prefix){return SDPUtils.splitLines(blob).filter((function(line){return 0===line.indexOf(prefix)}))},SDPUtils.parseCandidate=function(line){for(var parts,candidate={foundation:(parts=0===line.indexOf("a=candidate:")?line.substring(12).split(" "):line.substring(10).split(" "))[0],component:parseInt(parts[1],10),protocol:parts[2].toLowerCase(),priority:parseInt(parts[3],10),ip:parts[4],address:parts[4],port:parseInt(parts[5],10),type:parts[7]},i=8;i<parts.length;i+=2)switch(parts[i]){case"raddr":candidate.relatedAddress=parts[i+1];break;case"rport":candidate.relatedPort=parseInt(parts[i+1],10);break;case"tcptype":candidate.tcpType=parts[i+1];break;case"ufrag":candidate.ufrag=parts[i+1],candidate.usernameFragment=parts[i+1];break;default:candidate[parts[i]]=parts[i+1]}return candidate},SDPUtils.writeCandidate=function(candidate){var sdp=[];sdp.push(candidate.foundation),sdp.push(candidate.component),sdp.push(candidate.protocol.toUpperCase()),sdp.push(candidate.priority),sdp.push(candidate.address||candidate.ip),sdp.push(candidate.port);var type=candidate.type;return sdp.push("typ"),sdp.push(type),"host"!==type&&candidate.relatedAddress&&candidate.relatedPort&&(sdp.push("raddr"),sdp.push(candidate.relatedAddress),sdp.push("rport"),sdp.push(candidate.relatedPort)),candidate.tcpType&&"tcp"===candidate.protocol.toLowerCase()&&(sdp.push("tcptype"),sdp.push(candidate.tcpType)),(candidate.usernameFragment||candidate.ufrag)&&(sdp.push("ufrag"),sdp.push(candidate.usernameFragment||candidate.ufrag)),"candidate:"+sdp.join(" ")},SDPUtils.parseIceOptions=function(line){return line.substr(14).split(" ")},SDPUtils.parseRtpMap=function(line){var parts=line.substr(9).split(" "),parsed={payloadType:parseInt(parts.shift(),10)};return parts=parts[0].split("/"),parsed.name=parts[0],parsed.clockRate=parseInt(parts[1],10),parsed.channels=3===parts.length?parseInt(parts[2],10):1,parsed.numChannels=parsed.channels,parsed},SDPUtils.writeRtpMap=function(codec){var pt=codec.payloadType;void 0!==codec.preferredPayloadType&&(pt=codec.preferredPayloadType);var channels=codec.channels||codec.numChannels||1;return"a=rtpmap:"+pt+" "+codec.name+"/"+codec.clockRate+(1!==channels?"/"+channels:"")+"\r\n"},SDPUtils.parseExtmap=function(line){var parts=line.substr(9).split(" ");return{id:parseInt(parts[0],10),direction:parts[0].indexOf("/")>0?parts[0].split("/")[1]:"sendrecv",uri:parts[1]}},SDPUtils.writeExtmap=function(headerExtension){return"a=extmap:"+(headerExtension.id||headerExtension.preferredId)+(headerExtension.direction&&"sendrecv"!==headerExtension.direction?"/"+headerExtension.direction:"")+" "+headerExtension.uri+"\r\n"},SDPUtils.parseFmtp=function(line){for(var kv,parsed={},parts=line.substr(line.indexOf(" ")+1).split(";"),j=0;j<parts.length;j++)parsed[(kv=parts[j].trim().split("="))[0].trim()]=kv[1];return parsed},SDPUtils.writeFmtp=function(codec){var line="",pt=codec.payloadType;if(void 0!==codec.preferredPayloadType&&(pt=codec.preferredPayloadType),codec.parameters&&Object.keys(codec.parameters).length){var params=[];Object.keys(codec.parameters).forEach((function(param){codec.parameters[param]?params.push(param+"="+codec.parameters[param]):params.push(param)})),line+="a=fmtp:"+pt+" "+params.join(";")+"\r\n"}return line},SDPUtils.parseRtcpFb=function(line){var parts=line.substr(line.indexOf(" ")+1).split(" ");return{type:parts.shift(),parameter:parts.join(" ")}},SDPUtils.writeRtcpFb=function(codec){var lines="",pt=codec.payloadType;return void 0!==codec.preferredPayloadType&&(pt=codec.preferredPayloadType),codec.rtcpFeedback&&codec.rtcpFeedback.length&&codec.rtcpFeedback.forEach((function(fb){lines+="a=rtcp-fb:"+pt+" "+fb.type+(fb.parameter&&fb.parameter.length?" "+fb.parameter:"")+"\r\n"})),lines},SDPUtils.parseSsrcMedia=function(line){var sp=line.indexOf(" "),parts={ssrc:parseInt(line.substr(7,sp-7),10)},colon=line.indexOf(":",sp);return colon>-1?(parts.attribute=line.substr(sp+1,colon-sp-1),parts.value=line.substr(colon+1)):parts.attribute=line.substr(sp+1),parts},SDPUtils.parseSsrcGroup=function(line){var parts=line.substr(13).split(" ");return{semantics:parts.shift(),ssrcs:parts.map((function(ssrc){return parseInt(ssrc,10)}))}},SDPUtils.getMid=function(mediaSection){var mid=SDPUtils.matchPrefix(mediaSection,"a=mid:")[0];if(mid)return mid.substr(6)},SDPUtils.parseFingerprint=function(line){var parts=line.substr(14).split(" ");return{algorithm:parts[0].toLowerCase(),value:parts[1]}},SDPUtils.getDtlsParameters=function(mediaSection,sessionpart){return{role:"auto",fingerprints:SDPUtils.matchPrefix(mediaSection+sessionpart,"a=fingerprint:").map(SDPUtils.parseFingerprint)}},SDPUtils.writeDtlsParameters=function(params,setupType){var sdp="a=setup:"+setupType+"\r\n";return params.fingerprints.forEach((function(fp){sdp+="a=fingerprint:"+fp.algorithm+" "+fp.value+"\r\n"})),sdp},SDPUtils.parseCryptoLine=function(line){var parts=line.substr(9).split(" ");return{tag:parseInt(parts[0],10),cryptoSuite:parts[1],keyParams:parts[2],sessionParams:parts.slice(3)}},SDPUtils.writeCryptoLine=function(parameters){return"a=crypto:"+parameters.tag+" "+parameters.cryptoSuite+" "+("object"==typeof parameters.keyParams?SDPUtils.writeCryptoKeyParams(parameters.keyParams):parameters.keyParams)+(parameters.sessionParams?" "+parameters.sessionParams.join(" "):"")+"\r\n"},SDPUtils.parseCryptoKeyParams=function(keyParams){if(0!==keyParams.indexOf("inline:"))return null;var parts=keyParams.substr(7).split("|");return{keyMethod:"inline",keySalt:parts[0],lifeTime:parts[1],mkiValue:parts[2]?parts[2].split(":")[0]:void 0,mkiLength:parts[2]?parts[2].split(":")[1]:void 0}},SDPUtils.writeCryptoKeyParams=function(keyParams){return keyParams.keyMethod+":"+keyParams.keySalt+(keyParams.lifeTime?"|"+keyParams.lifeTime:"")+(keyParams.mkiValue&&keyParams.mkiLength?"|"+keyParams.mkiValue+":"+keyParams.mkiLength:"")},SDPUtils.getCryptoParameters=function(mediaSection,sessionpart){return SDPUtils.matchPrefix(mediaSection+sessionpart,"a=crypto:").map(SDPUtils.parseCryptoLine)},SDPUtils.getIceParameters=function(mediaSection,sessionpart){var ufrag=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-ufrag:")[0],pwd=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-pwd:")[0];return ufrag&&pwd?{usernameFragment:ufrag.substr(12),password:pwd.substr(10)}:null},SDPUtils.writeIceParameters=function(params){return"a=ice-ufrag:"+params.usernameFragment+"\r\na=ice-pwd:"+params.password+"\r\n"},SDPUtils.parseRtpParameters=function(mediaSection){for(var description={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},mline=SDPUtils.splitLines(mediaSection)[0].split(" "),i=3;i<mline.length;i++){var pt=mline[i],rtpmapline=SDPUtils.matchPrefix(mediaSection,"a=rtpmap:"+pt+" ")[0];if(rtpmapline){var codec=SDPUtils.parseRtpMap(rtpmapline),fmtps=SDPUtils.matchPrefix(mediaSection,"a=fmtp:"+pt+" ");switch(codec.parameters=fmtps.length?SDPUtils.parseFmtp(fmtps[0]):{},codec.rtcpFeedback=SDPUtils.matchPrefix(mediaSection,"a=rtcp-fb:"+pt+" ").map(SDPUtils.parseRtcpFb),description.codecs.push(codec),codec.name.toUpperCase()){case"RED":case"ULPFEC":description.fecMechanisms.push(codec.name.toUpperCase())}}}return SDPUtils.matchPrefix(mediaSection,"a=extmap:").forEach((function(line){description.headerExtensions.push(SDPUtils.parseExtmap(line))})),description},SDPUtils.writeRtpDescription=function(kind,caps){var sdp="";sdp+="m="+kind+" ",sdp+=caps.codecs.length>0?"9":"0",sdp+=" UDP/TLS/RTP/SAVPF ",sdp+=caps.codecs.map((function(codec){return void 0!==codec.preferredPayloadType?codec.preferredPayloadType:codec.payloadType})).join(" ")+"\r\n",sdp+="c=IN IP4 0.0.0.0\r\n",sdp+="a=rtcp:9 IN IP4 0.0.0.0\r\n",caps.codecs.forEach((function(codec){sdp+=SDPUtils.writeRtpMap(codec),sdp+=SDPUtils.writeFmtp(codec),sdp+=SDPUtils.writeRtcpFb(codec)}));var maxptime=0;return caps.codecs.forEach((function(codec){codec.maxptime>maxptime&&(maxptime=codec.maxptime)})),maxptime>0&&(sdp+="a=maxptime:"+maxptime+"\r\n"),sdp+="a=rtcp-mux\r\n",caps.headerExtensions&&caps.headerExtensions.forEach((function(extension){sdp+=SDPUtils.writeExtmap(extension)})),sdp},SDPUtils.parseRtpEncodingParameters=function(mediaSection){var secondarySsrc,encodingParameters=[],description=SDPUtils.parseRtpParameters(mediaSection),hasRed=-1!==description.fecMechanisms.indexOf("RED"),hasUlpfec=-1!==description.fecMechanisms.indexOf("ULPFEC"),ssrcs=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(parts){return"cname"===parts.attribute})),primarySsrc=ssrcs.length>0&&ssrcs[0].ssrc,flows=SDPUtils.matchPrefix(mediaSection,"a=ssrc-group:FID").map((function(line){return line.substr(17).split(" ").map((function(part){return parseInt(part,10)}))}));flows.length>0&&flows[0].length>1&&flows[0][0]===primarySsrc&&(secondarySsrc=flows[0][1]),description.codecs.forEach((function(codec){if("RTX"===codec.name.toUpperCase()&&codec.parameters.apt){var encParam={ssrc:primarySsrc,codecPayloadType:parseInt(codec.parameters.apt,10)};primarySsrc&&secondarySsrc&&(encParam.rtx={ssrc:secondarySsrc}),encodingParameters.push(encParam),hasRed&&((encParam=JSON.parse(JSON.stringify(encParam))).fec={ssrc:primarySsrc,mechanism:hasUlpfec?"red+ulpfec":"red"},encodingParameters.push(encParam))}})),0===encodingParameters.length&&primarySsrc&&encodingParameters.push({ssrc:primarySsrc});var bandwidth=SDPUtils.matchPrefix(mediaSection,"b=");return bandwidth.length&&(bandwidth=0===bandwidth[0].indexOf("b=TIAS:")?parseInt(bandwidth[0].substr(7),10):0===bandwidth[0].indexOf("b=AS:")?1e3*parseInt(bandwidth[0].substr(5),10)*.95-16e3:void 0,encodingParameters.forEach((function(params){params.maxBitrate=bandwidth}))),encodingParameters},SDPUtils.parseRtcpParameters=function(mediaSection){var rtcpParameters={},remoteSsrc=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(obj){return"cname"===obj.attribute}))[0];remoteSsrc&&(rtcpParameters.cname=remoteSsrc.value,rtcpParameters.ssrc=remoteSsrc.ssrc);var rsize=SDPUtils.matchPrefix(mediaSection,"a=rtcp-rsize");rtcpParameters.reducedSize=rsize.length>0,rtcpParameters.compound=0===rsize.length;var mux=SDPUtils.matchPrefix(mediaSection,"a=rtcp-mux");return rtcpParameters.mux=mux.length>0,rtcpParameters},SDPUtils.parseMsid=function(mediaSection){var parts,spec=SDPUtils.matchPrefix(mediaSection,"a=msid:");if(1===spec.length)return{stream:(parts=spec[0].substr(7).split(" "))[0],track:parts[1]};var planB=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(msidParts){return"msid"===msidParts.attribute}));return planB.length>0?{stream:(parts=planB[0].value.split(" "))[0],track:parts[1]}:void 0},SDPUtils.parseSctpDescription=function(mediaSection){var maxMessageSize,mline=SDPUtils.parseMLine(mediaSection),maxSizeLine=SDPUtils.matchPrefix(mediaSection,"a=max-message-size:");maxSizeLine.length>0&&(maxMessageSize=parseInt(maxSizeLine[0].substr(19),10)),isNaN(maxMessageSize)&&(maxMessageSize=65536);var sctpPort=SDPUtils.matchPrefix(mediaSection,"a=sctp-port:");if(sctpPort.length>0)return{port:parseInt(sctpPort[0].substr(12),10),protocol:mline.fmt,maxMessageSize:maxMessageSize};if(SDPUtils.matchPrefix(mediaSection,"a=sctpmap:").length>0){var parts=SDPUtils.matchPrefix(mediaSection,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(parts[0],10),protocol:parts[1],maxMessageSize:maxMessageSize}}},SDPUtils.writeSctpDescription=function(media,sctp){var output=[];return output="DTLS/SCTP"!==media.protocol?["m="+media.kind+" 9 "+media.protocol+" "+sctp.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+sctp.port+"\r\n"]:["m="+media.kind+" 9 "+media.protocol+" "+sctp.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+sctp.port+" "+sctp.protocol+" 65535\r\n"],void 0!==sctp.maxMessageSize&&output.push("a=max-message-size:"+sctp.maxMessageSize+"\r\n"),output.join("")},SDPUtils.generateSessionId=function(){return Math.random().toString().substr(2,21)},SDPUtils.writeSessionBoilerplate=function(sessId,sessVer,sessUser){var version=void 0!==sessVer?sessVer:2;return"v=0\r\no="+(sessUser||"thisisadapterortc")+" "+(sessId||SDPUtils.generateSessionId())+" "+version+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},SDPUtils.writeMediaSection=function(transceiver,caps,type,stream){var sdp=SDPUtils.writeRtpDescription(transceiver.kind,caps);if(sdp+=SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters()),sdp+=SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(),"offer"===type?"actpass":"active"),sdp+="a=mid:"+transceiver.mid+"\r\n",transceiver.direction?sdp+="a="+transceiver.direction+"\r\n":transceiver.rtpSender&&transceiver.rtpReceiver?sdp+="a=sendrecv\r\n":transceiver.rtpSender?sdp+="a=sendonly\r\n":transceiver.rtpReceiver?sdp+="a=recvonly\r\n":sdp+="a=inactive\r\n",transceiver.rtpSender){var msid="msid:"+stream.id+" "+transceiver.rtpSender.track.id+"\r\n";sdp+="a="+msid,sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" "+msid,transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" "+msid,sdp+="a=ssrc-group:FID "+transceiver.sendEncodingParameters[0].ssrc+" "+transceiver.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].ssrc+" cname:"+SDPUtils.localCName+"\r\n",transceiver.rtpSender&&transceiver.sendEncodingParameters[0].rtx&&(sdp+="a=ssrc:"+transceiver.sendEncodingParameters[0].rtx.ssrc+" cname:"+SDPUtils.localCName+"\r\n"),sdp},SDPUtils.getDirection=function(mediaSection,sessionpart){for(var lines=SDPUtils.splitLines(mediaSection),i=0;i<lines.length;i++)switch(lines[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return lines[i].substr(2)}return sessionpart?SDPUtils.getDirection(sessionpart):"sendrecv"},SDPUtils.getKind=function(mediaSection){return SDPUtils.splitLines(mediaSection)[0].split(" ")[0].substr(2)},SDPUtils.isRejected=function(mediaSection){return"0"===mediaSection.split(" ",2)[1]},SDPUtils.parseMLine=function(mediaSection){var parts=SDPUtils.splitLines(mediaSection)[0].substr(2).split(" ");return{kind:parts[0],port:parseInt(parts[1],10),protocol:parts[2],fmt:parts.slice(3).join(" ")}},SDPUtils.parseOLine=function(mediaSection){var parts=SDPUtils.matchPrefix(mediaSection,"o=")[0].substr(2).split(" ");return{username:parts[0],sessionId:parts[1],sessionVersion:parseInt(parts[2],10),netType:parts[3],addressType:parts[4],address:parts[5]}},SDPUtils.isValidSDP=function(blob){if("string"!=typeof blob||0===blob.length)return!1;for(var lines=SDPUtils.splitLines(blob),i=0;i<lines.length;i++)if(lines[i].length<2||"="!==lines[i].charAt(1))return!1;return!0},"object"==typeof module&&(module.exports=SDPUtils)},{}],7:[function(require,module,exports){var swfobject=function(){var l,Q,E,B,n,G,D="undefined",r="object",S="Shockwave Flash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=!1,U=[function(){T?function(){var X=j.getElementsByTagName("body")[0],aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;!function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");ab&&(ab=ab.split(" ")[1].split(","),M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)])}else if(Y<10)return Y++,void setTimeout(arguments.callee,10);X.removeChild(aa),Z=null,H()}()}else H()}():H()}],o=[],N=[],I=[],J=!1,a=!1,m=!0,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=/win/.test(Y||ah),ac=/mac/.test(Y||ah),af=!!/webkit/.test(ah)&&parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")),X=!1,ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r)!(ab=t.plugins[S].description)||typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin||(T=!0,X=!1,ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10),ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10),ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof O[["Active"].concat("Object").join("X")]!=D)try{var ad=new(window[["Active"].concat("Object").join("X")])("ShockwaveFlash.ShockwaveFlash");ad&&(ab=ad.GetVariable("$version"))&&(X=!0,ab=ab.split(" ")[1].split(","),ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)])}catch(Z){}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}();M.w3&&((typeof j.readyState!=D&&"complete"==j.readyState||typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))&&f(),J||(typeof j.addEventListener!=D&&j.addEventListener("DOMContentLoaded",f,!1),M.ie&&M.win&&(j.attachEvent(x,(function(){"complete"==j.readyState&&(j.detachEvent(x,arguments.callee),f())})),O==top&&function(){if(!J){try{j.documentElement.doScroll("left")}catch(X){return void setTimeout(arguments.callee,0)}f()}}()),M.wk&&function(){J||(/loaded|complete/.test(j.readyState)?f():setTimeout(arguments.callee,0))}(),s(f)));function f(){if(!J){try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=!0;for(var X=U.length,Y=0;Y<X;Y++)U[Y]()}}function K(X){J?X():U[U.length]=X}function s(Y){if(typeof O.addEventListener!=D)O.addEventListener("load",Y,!1);else if(typeof j.addEventListener!=D)j.addEventListener("load",Y,!1);else if(typeof O.attachEvent!=D)!function(Z,X,Y){Z.attachEvent(X,Y),I[I.length]=[Z,X,Y]}(O,"onload",Y);else if("function"==typeof O.onload){var X=O.onload;O.onload=function(){X(),Y()}}else O.onload=Y}function H(){var ag=o.length;if(ag>0)for(var af=0;af<ag;af++){var Y=o[af].id,ab=o[af].callbackFn,aa={success:!1,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae)if(!F(o[af].swfVersion)||M.wk&&M.wk<312)if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall,ai.width=ae.getAttribute("width")||"0",ai.height=ae.getAttribute("height")||"0",ae.getAttribute("class")&&(ai.styleclass=ae.getAttribute("class")),ae.getAttribute("align")&&(ai.align=ae.getAttribute("align"));for(var ah={},X=ae.getElementsByTagName("param"),ac=X.length,ad=0;ad<ac;ad++)"movie"!=X[ad].getAttribute("name").toLowerCase()&&(ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value"));P(ai,ah,Y,ab)}else p(ae),ab&&ab(aa);else w(Y,!0),ab&&(aa.success=!0,aa.ref=z(Y),ab(aa))}else if(w(Y,!0),ab){var Z=z(Y);Z&&typeof Z.SetVariable!=D&&(aa.success=!0,aa.ref=Z),ab(aa)}}}function z(aa){var X=null,Y=c(aa);if(Y&&"OBJECT"==Y.nodeName)if(typeof Y.SetVariable!=D)X=Y;else{var Z=Y.getElementsByTagName(r)[0];Z&&(X=Z)}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=!0,E=Z||null,B={success:!1,id:X};var ae=c(X);if(ae){"OBJECT"==ae.nodeName?(l=g(ae),Q=null):(l=ae,Q=X),aa.id=R,(typeof aa.width==D||!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)&&(aa.width="310"),(typeof aa.height==D||!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)&&(aa.height="137"),j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?["Active"].concat("").join("X"):"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D?ab.flashvars+="&"+ac:ab.flashvars=ac,M.ie&&M.win&&4!=ae.readyState){var Y=C("div");X+="SWFObjectNew",Y.setAttribute("id",X),ae.parentNode.insertBefore(Y,ae),ae.style.display="none",function(){4==ae.readyState?ae.parentNode.removeChild(ae):setTimeout(arguments.callee,10)}()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&4!=Y.readyState){var X=C("div");Y.parentNode.insertBefore(X,Y),X.parentNode.replaceChild(g(Y),X),Y.style.display="none",function(){4==Y.readyState?Y.parentNode.removeChild(Y):setTimeout(arguments.callee,10)}()}else Y.parentNode.replaceChild(g(Y),Y)}function g(ab){var aa=C("div");if(M.win&&M.ie)aa.innerHTML=ab.innerHTML;else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad)for(var X=ad.length,Z=0;Z<X;Z++)1==ad[Z].nodeType&&"PARAM"==ad[Z].nodeName||8==ad[Z].nodeType||aa.appendChild(ad[Z].cloneNode(!0))}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312)return X;if(aa)if(typeof ai.id==D&&(ai.id=Y),M.ie&&M.win){var ah="";for(var ae in ai)ai[ae]!=Object.prototype[ae]&&("data"==ae.toLowerCase()?ag.movie=ai[ae]:"styleclass"==ae.toLowerCase()?ah+=' class="'+ai[ae]+'"':"classid"!=ae.toLowerCase()&&(ah+=" "+ae+'="'+ai[ae]+'"'));var af="";for(var ad in ag)ag[ad]!=Object.prototype[ad]&&(af+='<param name="'+ad+'" value="'+ag[ad]+'" />');aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>",N[N.length]=ai.id,X=c(ai.id)}else{var Z=C(r);for(var ac in Z.setAttribute("type",q),ai)ai[ac]!=Object.prototype[ac]&&("styleclass"==ac.toLowerCase()?Z.setAttribute("class",ai[ac]):"classid"!=ac.toLowerCase()&&Z.setAttribute(ac,ai[ac]));for(var ab in ag)ag[ab]!=Object.prototype[ab]&&"movie"!=ab.toLowerCase()&&e(Z,ab,ag[ab]);aa.parentNode.replaceChild(Z,aa),X=Z}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X),aa.setAttribute("value",Y),Z.appendChild(aa)}function y(Y){var X=c(Y);X&&"OBJECT"==X.nodeName&&(M.ie&&M.win?(X.style.display="none",function(){4==X.readyState?b(Y):setTimeout(arguments.callee,10)}()):X.parentNode.removeChild(X))}function b(Z){var Y=c(Z);if(Y){for(var X in Y)"function"==typeof Y[X]&&(Y[X]=null);Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function F(Z){var Y=M.pv,X=Z.split(".");return X[0]=parseInt(X[0],10),X[1]=parseInt(X[1],10)||0,X[2]=parseInt(X[2],10)||0,Y[0]>X[0]||Y[0]==X[0]&&Y[1]>X[1]||Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]}function v(ac,Y,ad,ab){if(!M.ie||!M.mac){var aa=j.getElementsByTagName("head")[0];if(aa){var X=ad&&"string"==typeof ad?ad:"screen";if(ab&&(n=null,G=null),!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css"),Z.setAttribute("media",X),n=aa.appendChild(Z),M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0&&(n=j.styleSheets[j.styleSheets.length-1]),G=X}M.ie&&M.win?n&&typeof n.addRule==r&&n.addRule(ac,Y):n&&typeof j.createTextNode!=D&&n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(m){var Y=X?"visible":"hidden";J&&c(Z)?c(Z).style.visibility=Y:v("#"+Z,"visibility:"+Y)}}function L(Y){return null!=/[\\\"<>\.;]/.exec(Y)&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}M.ie&&M.win&&window.attachEvent("onunload",(function(){for(var ac=I.length,ab=0;ab<ac;ab++)I[ab][0].detachEvent(I[ab][1],I[ab][2]);for(var Z=N.length,aa=0;aa<Z;aa++)y(N[aa]);for(var Y in M)M[Y]=null;for(var X in M=null,swfobject)swfobject[X]=null;swfobject=null}));return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab,Y.swfVersion=X,Y.expressInstall=aa,Y.callbackFn=Z,o[o.length]=Y,w(ab,!1)}else Z&&Z({success:!1,id:ab})},getObjectById:function(X){if(M.w3)return z(X)},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:!1,id:ah};M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y?(w(ah,!1),K((function(){ae+="",ag+="";var aj={};if(af&&typeof af===r)for(var al in af)aj[al]=af[al];aj.data=ab,aj.width=ae,aj.height=ag;var am={};if(ad&&typeof ad===r)for(var ak in ad)am[ak]=ad[ak];if(Z&&typeof Z===r)for(var ai in Z)typeof am.flashvars!=D?am.flashvars+="&"+ai+"="+Z[ai]:am.flashvars=ai+"="+Z[ai];if(F(Y)){var an=u(aj,am,ah);aj.id==ah&&w(ah,!0),X.success=!0,X.ref=an}else{if(aa&&A())return aj.data=aa,void P(aj,am,ah,ac);w(ah,!0)}ac&&ac(X)}))):ac&&ac(X)},switchOffAutoHideShow:function(){m=!1},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){return M.w3?u(Z,Y,X):void 0},showExpressInstall:function(Z,aa,X,Y){M.w3&&A()&&P(Z,aa,X,Y)},removeSWF:function(X){M.w3&&y(X)},createCSS:function(aa,Z,Y,X){M.w3&&v(aa,Z,Y,X)},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)&&(Z=Z.split("?")[1]),null==aa)return L(Z);for(var Y=Z.split("&"),X=0;X<Y.length;X++)if(Y[X].substring(0,Y[X].indexOf("="))==aa)return L(Y[X].substring(Y[X].indexOf("=")+1))}return""},expressInstallCallback:function(){if(a){var X=c(R);X&&l&&(X.parentNode.replaceChild(l,X),Q&&(w(Q,!0),M.ie&&M.win&&(l.style.display="block")),E&&E(B)),a=!1}}}}();module.exports=swfobject},{}],8:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;msecs>=0&&(item._idleTimeoutId=setTimeout((function(){item._onTimeout&&item._onTimeout()}),msecs))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(fn){var id=nextImmediateId++,args=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[id]=!0,nextTick((function(){immediateIds[id]&&(args?fn.apply(null,args):fn.call(null),exports.clearImmediate(id))})),id},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":3,timers:8}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"v1",{enumerable:!0,get:function(){return _v.default}}),Object.defineProperty(exports,"v3",{enumerable:!0,get:function(){return _v2.default}}),Object.defineProperty(exports,"v4",{enumerable:!0,get:function(){return _v3.default}}),Object.defineProperty(exports,"v5",{enumerable:!0,get:function(){return _v4.default}}),Object.defineProperty(exports,"NIL",{enumerable:!0,get:function(){return _nil.default}}),Object.defineProperty(exports,"version",{enumerable:!0,get:function(){return _version.default}}),Object.defineProperty(exports,"validate",{enumerable:!0,get:function(){return _validate.default}}),Object.defineProperty(exports,"stringify",{enumerable:!0,get:function(){return _stringify.default}}),Object.defineProperty(exports,"parse",{enumerable:!0,get:function(){return _parse.default}});var _v=_interopRequireDefault(require("./v1.js")),_v2=_interopRequireDefault(require("./v3.js")),_v3=_interopRequireDefault(require("./v4.js")),_v4=_interopRequireDefault(require("./v5.js")),_nil=_interopRequireDefault(require("./nil.js")),_version=_interopRequireDefault(require("./version.js")),_validate=_interopRequireDefault(require("./validate.js")),_stringify=_interopRequireDefault(require("./stringify.js")),_parse=_interopRequireDefault(require("./parse.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}},{"./nil.js":11,"./parse.js":12,"./stringify.js":16,"./v1.js":17,"./v3.js":18,"./v4.js":20,"./v5.js":21,"./validate.js":22,"./version.js":23}],10:[function(require,module,exports){"use strict";function getOutputLength(inputLength8){return 14+(inputLength8+64>>>9<<4)+1}function safeAdd(x,y){const lsw=(65535&x)+(65535&y);return(x>>16)+(y>>16)+(lsw>>16)<<16|65535&lsw}function md5cmn(q,a,b,x,s,t){return safeAdd((num=safeAdd(safeAdd(a,q),safeAdd(x,t)))<<(cnt=s)|num>>>32-cnt,b);var num,cnt}function md5ff(a,b,c,d,x,s,t){return md5cmn(b&c|~b&d,a,b,x,s,t)}function md5gg(a,b,c,d,x,s,t){return md5cmn(b&d|c&~d,a,b,x,s,t)}function md5hh(a,b,c,d,x,s,t){return md5cmn(b^c^d,a,b,x,s,t)}function md5ii(a,b,c,d,x,s,t){return md5cmn(c^(b|~d),a,b,x,s,t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(bytes){if("string"==typeof bytes){const msg=unescape(encodeURIComponent(bytes));bytes=new Uint8Array(msg.length);for(let i=0;i<msg.length;++i)bytes[i]=msg.charCodeAt(i)}return function(input){const output=[],length32=32*input.length;for(let i=0;i<length32;i+=8){const x=input[i>>5]>>>i%32&255,hex=parseInt("0123456789abcdef".charAt(x>>>4&15)+"0123456789abcdef".charAt(15&x),16);output.push(hex)}return output}(function(x,len){x[len>>5]|=128<<len%32,x[getOutputLength(len)-1]=len;let a=1732584193,b=-271733879,c=-1732584194,d=271733878;for(let i=0;i<x.length;i+=16){const olda=a,oldb=b,oldc=c,oldd=d;a=md5ff(a,b,c,d,x[i],7,-680876936),d=md5ff(d,a,b,c,x[i+1],12,-389564586),c=md5ff(c,d,a,b,x[i+2],17,606105819),b=md5ff(b,c,d,a,x[i+3],22,-1044525330),a=md5ff(a,b,c,d,x[i+4],7,-176418897),d=md5ff(d,a,b,c,x[i+5],12,1200080426),c=md5ff(c,d,a,b,x[i+6],17,-1473231341),b=md5ff(b,c,d,a,x[i+7],22,-45705983),a=md5ff(a,b,c,d,x[i+8],7,1770035416),d=md5ff(d,a,b,c,x[i+9],12,-1958414417),c=md5ff(c,d,a,b,x[i+10],17,-42063),b=md5ff(b,c,d,a,x[i+11],22,-1990404162),a=md5ff(a,b,c,d,x[i+12],7,1804603682),d=md5ff(d,a,b,c,x[i+13],12,-40341101),c=md5ff(c,d,a,b,x[i+14],17,-1502002290),b=md5ff(b,c,d,a,x[i+15],22,1236535329),a=md5gg(a,b,c,d,x[i+1],5,-165796510),d=md5gg(d,a,b,c,x[i+6],9,-1069501632),c=md5gg(c,d,a,b,x[i+11],14,643717713),b=md5gg(b,c,d,a,x[i],20,-373897302),a=md5gg(a,b,c,d,x[i+5],5,-701558691),d=md5gg(d,a,b,c,x[i+10],9,38016083),c=md5gg(c,d,a,b,x[i+15],14,-660478335),b=md5gg(b,c,d,a,x[i+4],20,-405537848),a=md5gg(a,b,c,d,x[i+9],5,568446438),d=md5gg(d,a,b,c,x[i+14],9,-1019803690),c=md5gg(c,d,a,b,x[i+3],14,-187363961),b=md5gg(b,c,d,a,x[i+8],20,1163531501),a=md5gg(a,b,c,d,x[i+13],5,-1444681467),d=md5gg(d,a,b,c,x[i+2],9,-51403784),c=md5gg(c,d,a,b,x[i+7],14,1735328473),b=md5gg(b,c,d,a,x[i+12],20,-1926607734),a=md5hh(a,b,c,d,x[i+5],4,-378558),d=md5hh(d,a,b,c,x[i+8],11,-2022574463),c=md5hh(c,d,a,b,x[i+11],16,1839030562),b=md5hh(b,c,d,a,x[i+14],23,-35309556),a=md5hh(a,b,c,d,x[i+1],4,-1530992060),d=md5hh(d,a,b,c,x[i+4],11,1272893353),c=md5hh(c,d,a,b,x[i+7],16,-155497632),b=md5hh(b,c,d,a,x[i+10],23,-1094730640),a=md5hh(a,b,c,d,x[i+13],4,681279174),d=md5hh(d,a,b,c,x[i],11,-358537222),c=md5hh(c,d,a,b,x[i+3],16,-722521979),b=md5hh(b,c,d,a,x[i+6],23,76029189),a=md5hh(a,b,c,d,x[i+9],4,-640364487),d=md5hh(d,a,b,c,x[i+12],11,-421815835),c=md5hh(c,d,a,b,x[i+15],16,530742520),b=md5hh(b,c,d,a,x[i+2],23,-995338651),a=md5ii(a,b,c,d,x[i],6,-198630844),d=md5ii(d,a,b,c,x[i+7],10,1126891415),c=md5ii(c,d,a,b,x[i+14],15,-1416354905),b=md5ii(b,c,d,a,x[i+5],21,-57434055),a=md5ii(a,b,c,d,x[i+12],6,1700485571),d=md5ii(d,a,b,c,x[i+3],10,-1894986606),c=md5ii(c,d,a,b,x[i+10],15,-1051523),b=md5ii(b,c,d,a,x[i+1],21,-2054922799),a=md5ii(a,b,c,d,x[i+8],6,1873313359),d=md5ii(d,a,b,c,x[i+15],10,-30611744),c=md5ii(c,d,a,b,x[i+6],15,-1560198380),b=md5ii(b,c,d,a,x[i+13],21,1309151649),a=md5ii(a,b,c,d,x[i+4],6,-145523070),d=md5ii(d,a,b,c,x[i+11],10,-1120210379),c=md5ii(c,d,a,b,x[i+2],15,718787259),b=md5ii(b,c,d,a,x[i+9],21,-343485551),a=safeAdd(a,olda),b=safeAdd(b,oldb),c=safeAdd(c,oldc),d=safeAdd(d,oldd)}return[a,b,c,d]}(function(input){if(0===input.length)return[];const length8=8*input.length,output=new Uint32Array(getOutputLength(length8));for(let i=0;i<length8;i+=8)output[i>>5]|=(255&input[i/8])<<i%32;return output}(bytes),8*bytes.length))};exports.default=_default},{}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;exports.default="00000000-0000-0000-0000-000000000000"},{}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_validate=(obj=require("./validate.js"))&&obj.__esModule?obj:{default:obj};var _default=function(uuid){if(!(0,_validate.default)(uuid))throw TypeError("Invalid UUID");let v;const arr=new Uint8Array(16);return arr[0]=(v=parseInt(uuid.slice(0,8),16))>>>24,arr[1]=v>>>16&255,arr[2]=v>>>8&255,arr[3]=255&v,arr[4]=(v=parseInt(uuid.slice(9,13),16))>>>8,arr[5]=255&v,arr[6]=(v=parseInt(uuid.slice(14,18),16))>>>8,arr[7]=255&v,arr[8]=(v=parseInt(uuid.slice(19,23),16))>>>8,arr[9]=255&v,arr[10]=(v=parseInt(uuid.slice(24,36),16))/1099511627776&255,arr[11]=v/4294967296&255,arr[12]=v>>>24&255,arr[13]=v>>>16&255,arr[14]=v>>>8&255,arr[15]=255&v,arr};exports.default=_default},{"./validate.js":22}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;exports.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],14:[function(require,module,exports){"use strict";let getRandomValues;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){if(!getRandomValues&&(getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)};const rnds8=new Uint8Array(16)},{}],15:[function(require,module,exports){"use strict";function f(s,x,y,z){switch(s){case 0:return x&y^~x&z;case 1:return x^y^z;case 2:return x&y^x&z^y&z;case 3:return x^y^z}}function ROTL(x,n){return x<<n|x>>>32-n}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=function(bytes){const K=[1518500249,1859775393,2400959708,3395469782],H=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof bytes){const msg=unescape(encodeURIComponent(bytes));bytes=[];for(let i=0;i<msg.length;++i)bytes.push(msg.charCodeAt(i))}else Array.isArray(bytes)||(bytes=Array.prototype.slice.call(bytes));bytes.push(128);const l=bytes.length/4+2,N=Math.ceil(l/16),M=new Array(N);for(let i=0;i<N;++i){const arr=new Uint32Array(16);for(let j=0;j<16;++j)arr[j]=bytes[64*i+4*j]<<24|bytes[64*i+4*j+1]<<16|bytes[64*i+4*j+2]<<8|bytes[64*i+4*j+3];M[i]=arr}M[N-1][14]=8*(bytes.length-1)/Math.pow(2,32),M[N-1][14]=Math.floor(M[N-1][14]),M[N-1][15]=8*(bytes.length-1)&4294967295;for(let i=0;i<N;++i){const W=new Uint32Array(80);for(let t=0;t<16;++t)W[t]=M[i][t];for(let t=16;t<80;++t)W[t]=ROTL(W[t-3]^W[t-8]^W[t-14]^W[t-16],1);let a=H[0],b=H[1],c=H[2],d=H[3],e=H[4];for(let t=0;t<80;++t){const s=Math.floor(t/20),T=ROTL(a,5)+f(s,b,c,d)+e+K[s]+W[t]>>>0;e=d,d=c,c=ROTL(b,30)>>>0,b=a,a=T}H[0]=H[0]+a>>>0,H[1]=H[1]+b>>>0,H[2]=H[2]+c>>>0,H[3]=H[3]+d>>>0,H[4]=H[4]+e>>>0}return[H[0]>>24&255,H[0]>>16&255,H[0]>>8&255,255&H[0],H[1]>>24&255,H[1]>>16&255,H[1]>>8&255,255&H[1],H[2]>>24&255,H[2]>>16&255,H[2]>>8&255,255&H[2],H[3]>>24&255,H[3]>>16&255,H[3]>>8&255,255&H[3],H[4]>>24&255,H[4]>>16&255,H[4]>>8&255,255&H[4]]};exports.default=_default},{}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_validate=(obj=require("./validate.js"))&&obj.__esModule?obj:{default:obj};const byteToHex=[];for(let i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));var _default=function(arr,offset=0){const uuid=(byteToHex[arr[offset+0]]+byteToHex[arr[offset+1]]+byteToHex[arr[offset+2]]+byteToHex[arr[offset+3]]+"-"+byteToHex[arr[offset+4]]+byteToHex[arr[offset+5]]+"-"+byteToHex[arr[offset+6]]+byteToHex[arr[offset+7]]+"-"+byteToHex[arr[offset+8]]+byteToHex[arr[offset+9]]+"-"+byteToHex[arr[offset+10]]+byteToHex[arr[offset+11]]+byteToHex[arr[offset+12]]+byteToHex[arr[offset+13]]+byteToHex[arr[offset+14]]+byteToHex[arr[offset+15]]).toLowerCase();if(!(0,_validate.default)(uuid))throw TypeError("Stringified UUID is invalid");return uuid};exports.default=_default},{"./validate.js":22}],17:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _rng=_interopRequireDefault(require("./rng.js")),_stringify=_interopRequireDefault(require("./stringify.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}let _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;var _default=function(options,buf,offset){let i=buf&&offset||0;const b=buf||new Array(16);let node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){const seedBytes=options.random||(options.rng||_rng.default)();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}let msecs=void 0!==options.msecs?options.msecs:Date.now(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1;const dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq,msecs+=122192928e5;const tl=(1e4*(268435455&msecs)+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;const tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(let n=0;n<6;++n)b[i+n]=node[n];return buf||(0,_stringify.default)(b)};exports.default=_default},{"./rng.js":14,"./stringify.js":16}],18:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _v=_interopRequireDefault(require("./v35.js")),_md=_interopRequireDefault(require("./md5.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=(0,_v.default)("v3",48,_md.default);exports.default=_default},{"./md5.js":10,"./v35.js":19}],19:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(name,version,hashfunc){function generateUUID(value,namespace,buf,offset){if("string"==typeof value&&(value=function(str){str=unescape(encodeURIComponent(str));const bytes=[];for(let i=0;i<str.length;++i)bytes.push(str.charCodeAt(i));return bytes}(value)),"string"==typeof namespace&&(namespace=(0,_parse.default)(namespace)),16!==namespace.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let bytes=new Uint8Array(16+value.length);if(bytes.set(namespace),bytes.set(value,namespace.length),bytes=hashfunc(bytes),bytes[6]=15&bytes[6]|version,bytes[8]=63&bytes[8]|128,buf){offset=offset||0;for(let i=0;i<16;++i)buf[offset+i]=bytes[i];return buf}return(0,_stringify.default)(bytes)}try{generateUUID.name=name}catch(err){}return generateUUID.DNS=DNS,generateUUID.URL=URL,generateUUID},exports.URL=exports.DNS=void 0;var _stringify=_interopRequireDefault(require("./stringify.js")),_parse=_interopRequireDefault(require("./parse.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}const DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";exports.DNS=DNS;const URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";exports.URL=URL},{"./parse.js":12,"./stringify.js":16}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _rng=_interopRequireDefault(require("./rng.js")),_stringify=_interopRequireDefault(require("./stringify.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=function(options,buf,offset){const rnds=(options=options||{}).random||(options.rng||_rng.default)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf){offset=offset||0;for(let i=0;i<16;++i)buf[offset+i]=rnds[i];return buf}return(0,_stringify.default)(rnds)};exports.default=_default},{"./rng.js":14,"./stringify.js":16}],21:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _v=_interopRequireDefault(require("./v35.js")),_sha=_interopRequireDefault(require("./sha1.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=(0,_v.default)("v5",80,_sha.default);exports.default=_default},{"./sha1.js":15,"./v35.js":19}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_regex=(obj=require("./regex.js"))&&obj.__esModule?obj:{default:obj};var _default=function(uuid){return"string"==typeof uuid&&_regex.default.test(uuid)};exports.default=_default},{"./regex.js":13}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var obj,_validate=(obj=require("./validate.js"))&&obj.__esModule?obj:{default:obj};var _default=function(uuid){if(!(0,_validate.default)(uuid))throw TypeError("Invalid UUID");return parseInt(uuid.substr(14,1),16)};exports.default=_default},{"./validate.js":22}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var adapter=(0,require("./adapter_factory.js").adapterFactory)({window:"undefined"==typeof window?void 0:window});exports.default=adapter},{"./adapter_factory.js":25}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.adapterFactory=function(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},window=_ref.window,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},logging=utils.log,browserDetails=utils.detectBrowser(window),adapter={browserDetails:browserDetails,commonShim:commonShim,extractVersion:utils.extractVersion,disableLog:utils.disableLog,disableWarnings:utils.disableWarnings};switch(browserDetails.browser){case"chrome":if(!chromeShim||!chromeShim.shimPeerConnection||!options.shimChrome)return logging("Chrome shim is not included in this adapter release."),adapter;if(null===browserDetails.version)return logging("Chrome shim can not determine version, not shimming."),adapter;logging("adapter.js shimming chrome."),adapter.browserShim=chromeShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),chromeShim.shimGetUserMedia(window,browserDetails),chromeShim.shimMediaStream(window,browserDetails),chromeShim.shimPeerConnection(window,browserDetails),chromeShim.shimOnTrack(window,browserDetails),chromeShim.shimAddTrackRemoveTrack(window,browserDetails),chromeShim.shimGetSendersWithDtmf(window,browserDetails),chromeShim.shimGetStats(window,browserDetails),chromeShim.shimSenderReceiverGetStats(window,browserDetails),chromeShim.fixNegotiationNeeded(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;case"firefox":if(!firefoxShim||!firefoxShim.shimPeerConnection||!options.shimFirefox)return logging("Firefox shim is not included in this adapter release."),adapter;logging("adapter.js shimming firefox."),adapter.browserShim=firefoxShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),firefoxShim.shimGetUserMedia(window,browserDetails),firefoxShim.shimPeerConnection(window,browserDetails),firefoxShim.shimOnTrack(window,browserDetails),firefoxShim.shimRemoveStream(window,browserDetails),firefoxShim.shimSenderGetStats(window,browserDetails),firefoxShim.shimReceiverGetStats(window,browserDetails),firefoxShim.shimRTCDataChannel(window,browserDetails),firefoxShim.shimAddTransceiver(window,browserDetails),firefoxShim.shimGetParameters(window,browserDetails),firefoxShim.shimCreateOffer(window,browserDetails),firefoxShim.shimCreateAnswer(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails);break;case"edge":if(!edgeShim||!edgeShim.shimPeerConnection||!options.shimEdge)return logging("MS edge shim is not included in this adapter release."),adapter;logging("adapter.js shimming edge."),adapter.browserShim=edgeShim,edgeShim.shimGetUserMedia(window,browserDetails),edgeShim.shimGetDisplayMedia(window,browserDetails),edgeShim.shimPeerConnection(window,browserDetails),edgeShim.shimReplaceTrack(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails);break;case"safari":if(!safariShim||!options.shimSafari)return logging("Safari shim is not included in this adapter release."),adapter;logging("adapter.js shimming safari."),adapter.browserShim=safariShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),safariShim.shimRTCIceServerUrls(window,browserDetails),safariShim.shimCreateOfferLegacy(window,browserDetails),safariShim.shimCallbacksAPI(window,browserDetails),safariShim.shimLocalStreamsAPI(window,browserDetails),safariShim.shimRemoteStreamsAPI(window,browserDetails),safariShim.shimTrackEventTransceiver(window,browserDetails),safariShim.shimGetUserMedia(window,browserDetails),safariShim.shimAudioContext(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;default:logging("Unsupported browser!")}return adapter};var utils=_interopRequireWildcard(require("./utils")),chromeShim=_interopRequireWildcard(require("./chrome/chrome_shim")),edgeShim=_interopRequireWildcard(require("./edge/edge_shim")),firefoxShim=_interopRequireWildcard(require("./firefox/firefox_shim")),safariShim=_interopRequireWildcard(require("./safari/safari_shim")),commonShim=_interopRequireWildcard(require("./common_shim"));function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}},{"./chrome/chrome_shim":26,"./common_shim":29,"./edge/edge_shim":30,"./firefox/firefox_shim":34,"./safari/safari_shim":37,"./utils":38}],26:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimMediaStream=function(window){window.MediaStream=window.MediaStream||window.webkitMediaStream},exports.shimOnTrack=function(window){if("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("ontrack"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(f){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=f)},enumerable:!0,configurable:!0});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var _this=this;return this._ontrackpoly||(this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",(function(te){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===te.track.id})):{track:te.track};var event=new Event("track");event.track=te.track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)})),e.stream.getTracks().forEach((function(track){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===track.id})):{track:track};var event=new Event("track");event.track=track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)}))},this.addEventListener("addstream",this._ontrackpoly)),origSetRemoteDescription.apply(this,arguments)}}else utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))},exports.shimGetSendersWithDtmf=function(window){if("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("getSenders"in window.RTCPeerConnection.prototype)&&"createDTMFSender"in window.RTCPeerConnection.prototype){var shimSenderWithDtmf=function(pc,track){return{track:track,get dtmf(){return void 0===this._dtmf&&("audio"===track.kind?this._dtmf=pc.createDTMFSender(track):this._dtmf=null),this._dtmf},_pc:pc}};if(!window.RTCPeerConnection.prototype.getSenders){window.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){var sender=origAddTrack.apply(this,arguments);return sender||(sender=shimSenderWithDtmf(this,track),this._senders.push(sender)),sender};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){origRemoveTrack.apply(this,arguments);var idx=this._senders.indexOf(sender);-1!==idx&&this._senders.splice(idx,1)}}var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this2=this;this._senders=this._senders||[],origAddStream.apply(this,[stream]),stream.getTracks().forEach((function(track){_this2._senders.push(shimSenderWithDtmf(_this2,track))}))};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._senders=this._senders||[],origRemoveStream.apply(this,[stream]),stream.getTracks().forEach((function(track){var sender=_this3._senders.find((function(s){return s.track===track}));sender&&_this3._senders.splice(_this3._senders.indexOf(sender),1)}))}}else if("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&"getSenders"in window.RTCPeerConnection.prototype&&"createDTMFSender"in window.RTCPeerConnection.prototype&&window.RTCRtpSender&&!("dtmf"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;window.RTCPeerConnection.prototype.getSenders=function(){var _this4=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this4})),senders},Object.defineProperty(window.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},exports.shimGetStats=function(window){if(!window.RTCPeerConnection)return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _this5=this,_arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];if(arguments.length>0&&"function"==typeof selector)return origGetStats.apply(this,arguments);if(0===origGetStats.length&&(0===arguments.length||"function"!=typeof selector))return origGetStats.apply(this,[]);var fixChromeStats_=function(response){var standardReport={};return response.result().forEach((function(report){var standardStats={id:report.id,timestamp:report.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[report.type]||report.type};report.names().forEach((function(name){standardStats[name]=report.stat(name)})),standardReport[standardStats.id]=standardStats})),standardReport},makeMapStats=function(stats){return new Map(Object.keys(stats).map((function(key){return[key,stats[key]]})))};if(arguments.length>=2){var successCallbackWrapper_=function(response){onSucc(makeMapStats(fixChromeStats_(response)))};return origGetStats.apply(this,[successCallbackWrapper_,selector])}return new Promise((function(resolve,reject){origGetStats.apply(_this5,[function(response){resolve(makeMapStats(fixChromeStats_(response)))},reject])})).then(onSucc,onErr)}},exports.shimSenderReceiverGetStats=function(window){if(!("object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCPeerConnection&&window.RTCRtpSender&&window.RTCRtpReceiver))return;if(!("getStats"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this6=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this6})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender}),window.RTCRtpSender.prototype.getStats=function(){var sender=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,sender.track,!0)}))}}if(!("getStats"in window.RTCRtpReceiver.prototype)){var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this7=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this7})),receivers}),utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){var receiver=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,receiver.track,!1)}))}}if(!("getStats"in window.RTCRtpSender.prototype)||!("getStats"in window.RTCRtpReceiver.prototype))return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof window.MediaStreamTrack){var track=arguments[0],sender=void 0,receiver=void 0,err=void 0;return this.getSenders().forEach((function(s){s.track===track&&(sender?err=!0:sender=s)})),this.getReceivers().forEach((function(r){return r.track===track&&(receiver?err=!0:receiver=r),r.track===track})),err||sender&&receiver?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):sender?sender.getStats():receiver?receiver.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return origGetStats.apply(this,arguments)}},exports.shimAddTrackRemoveTrackWithNative=shimAddTrackRemoveTrackWithNative,exports.shimAddTrackRemoveTrack=function(window,browserDetails){if(!window.RTCPeerConnection)return;if(window.RTCPeerConnection.prototype.addTrack&&browserDetails.version>=65)return shimAddTrackRemoveTrackWithNative(window);var origGetLocalStreams=window.RTCPeerConnection.prototype.getLocalStreams;window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this11=this,nativeStreams=origGetLocalStreams.apply(this);return this._reverseStreams=this._reverseStreams||{},nativeStreams.map((function(stream){return _this11._reverseStreams[stream.id]}))};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this12=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},stream.getTracks().forEach((function(track){if(_this12.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[stream.id]){var newStream=new window.MediaStream(stream.getTracks());this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,stream=newStream}origAddStream.apply(this,[stream])};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(internalStream.id,"g"),externalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}function replaceExternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(externalStream.id,"g"),internalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}window.RTCPeerConnection.prototype.removeStream=function(stream){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},origRemoveStream.apply(this,[this._streams[stream.id]||stream]),delete this._reverseStreams[this._streams[stream.id]?this._streams[stream.id].id:stream.id],delete this._streams[stream.id]},window.RTCPeerConnection.prototype.addTrack=function(track,stream){var _this13=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var streams=[].slice.call(arguments,1);if(1!==streams.length||!streams[0].getTracks().find((function(t){return t===track})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var alreadyExists=this.getSenders().find((function(s){return s.track===track}));if(alreadyExists)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var oldStream=this._streams[stream.id];if(oldStream)oldStream.addTrack(track),Promise.resolve().then((function(){_this13.dispatchEvent(new Event("negotiationneeded"))}));else{var newStream=new window.MediaStream([track]);this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,this.addStream(newStream)}return this.getSenders().find((function(s){return s.track===track}))},["createOffer","createAnswer"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){var _this14=this,args=arguments,isLegacyCall=arguments.length&&"function"==typeof arguments[0];return isLegacyCall?nativeMethod.apply(this,[function(description){var desc=replaceInternalStreamId(_this14,description);args[0].apply(null,[desc])},function(err){args[1]&&args[1].apply(null,err)},arguments[2]]):nativeMethod.apply(this,arguments).then((function(description){return replaceInternalStreamId(_this14,description)}))}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var origSetLocalDescription=window.RTCPeerConnection.prototype.setLocalDescription;window.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),origSetLocalDescription.apply(this,arguments)):origSetLocalDescription.apply(this,arguments)};var origLocalDescription=Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(window.RTCPeerConnection.prototype,"localDescription",{get:function(){var description=origLocalDescription.get.apply(this);return""===description.type?description:replaceInternalStreamId(this,description)}}),window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this15=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!sender._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(sender._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var stream=void 0;Object.keys(this._streams).forEach((function(streamid){_this15._streams[streamid].getTracks().find((function(track){return sender.track===track}))&&(stream=_this15._streams[streamid])})),stream&&(1===stream.getTracks().length?this.removeStream(this._reverseStreams[stream.id]):stream.removeTrack(sender.track),this.dispatchEvent(new Event("negotiationneeded")))}},exports.shimPeerConnection=function(window,browserDetails){!window.RTCPeerConnection&&window.webkitRTCPeerConnection&&(window.RTCPeerConnection=window.webkitRTCPeerConnection);if(!window.RTCPeerConnection)return;browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}))},exports.fixNegotiationNeeded=function(window,browserDetails){utils.wrapPeerConnectionEvent(window,"negotiationneeded",(function(e){var pc=e.target;if(!(browserDetails.version<72||pc.getConfiguration&&"plan-b"===pc.getConfiguration().sdpSemantics)||"stable"===pc.signalingState)return e}))};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js"));function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function shimAddTrackRemoveTrackWithNative(window){window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this8=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(streamId){return _this8._shimmedLocalStreams[streamId][0]}))};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){if(!stream)return origAddTrack.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var sender=origAddTrack.apply(this,arguments);return this._shimmedLocalStreams[stream.id]?-1===this._shimmedLocalStreams[stream.id].indexOf(sender)&&this._shimmedLocalStreams[stream.id].push(sender):this._shimmedLocalStreams[stream.id]=[stream,sender],sender};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this9=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},stream.getTracks().forEach((function(track){if(_this9.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")}));var existingSenders=this.getSenders();origAddStream.apply(this,arguments);var newSenders=this.getSenders().filter((function(newSender){return-1===existingSenders.indexOf(newSender)}));this._shimmedLocalStreams[stream.id]=[stream].concat(newSenders)};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[stream.id],origRemoveStream.apply(this,arguments)};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this10=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},sender&&Object.keys(this._shimmedLocalStreams).forEach((function(streamId){var idx=_this10._shimmedLocalStreams[streamId].indexOf(sender);-1!==idx&&_this10._shimmedLocalStreams[streamId].splice(idx,1),1===_this10._shimmedLocalStreams[streamId].length&&delete _this10._shimmedLocalStreams[streamId]})),origRemoveTrack.apply(this,arguments)}}},{"../utils.js":38,"./getdisplaymedia":27,"./getusermedia":28}],27:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,getSourceId){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;if("function"!=typeof getSourceId)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");window.navigator.mediaDevices.getDisplayMedia=function(constraints){return getSourceId(constraints).then((function(sourceId){var widthSpecified=constraints.video&&constraints.video.width,heightSpecified=constraints.video&&constraints.video.height,frameRateSpecified=constraints.video&&constraints.video.frameRate;return constraints.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:sourceId,maxFrameRate:frameRateSpecified||3}},widthSpecified&&(constraints.video.mandatory.maxWidth=widthSpecified),heightSpecified&&(constraints.video.mandatory.maxHeight=heightSpecified),window.navigator.mediaDevices.getUserMedia(constraints)}))}}},{}],28:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator;if(!navigator.mediaDevices)return;var constraintsToChrome_=function(c){if("object"!==("undefined"==typeof c?"undefined":_typeof(c))||c.mandatory||c.optional)return c;var cc={};return Object.keys(c).forEach((function(key){if("require"!==key&&"advanced"!==key&&"mediaSource"!==key){var r="object"===_typeof(c[key])?c[key]:{ideal:c[key]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var oldname_=function(prefix,name){return prefix?prefix+name.charAt(0).toUpperCase()+name.slice(1):"deviceId"===name?"sourceId":name};if(void 0!==r.ideal){cc.optional=cc.optional||[];var oc={};"number"==typeof r.ideal?(oc[oldname_("min",key)]=r.ideal,cc.optional.push(oc),(oc={})[oldname_("max",key)]=r.ideal,cc.optional.push(oc)):(oc[oldname_("",key)]=r.ideal,cc.optional.push(oc))}void 0!==r.exact&&"number"!=typeof r.exact?(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_("",key)]=r.exact):["min","max"].forEach((function(mix){void 0!==r[mix]&&(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_(mix,key)]=r[mix])}))}})),c.advanced&&(cc.optional=(cc.optional||[]).concat(c.advanced)),cc},shimConstraints_=function(constraints,func){if(browserDetails.version>=61)return func(constraints);if((constraints=JSON.parse(JSON.stringify(constraints)))&&"object"===_typeof(constraints.audio)){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])};remap((constraints=JSON.parse(JSON.stringify(constraints))).audio,"autoGainControl","googAutoGainControl"),remap(constraints.audio,"noiseSuppression","googNoiseSuppression"),constraints.audio=constraintsToChrome_(constraints.audio)}if(constraints&&"object"===_typeof(constraints.video)){var face=constraints.video.facingMode;face=face&&("object"===("undefined"==typeof face?"undefined":_typeof(face))?face:{ideal:face});var getSupportedFacingModeLies=browserDetails.version<66;if(face&&("user"===face.exact||"environment"===face.exact||"user"===face.ideal||"environment"===face.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode||getSupportedFacingModeLies)){delete constraints.video.facingMode;var matches=void 0;if("environment"===face.exact||"environment"===face.ideal?matches=["back","rear"]:"user"!==face.exact&&"user"!==face.ideal||(matches=["front"]),matches)return navigator.mediaDevices.enumerateDevices().then((function(devices){var dev=(devices=devices.filter((function(d){return"videoinput"===d.kind}))).find((function(d){return matches.some((function(match){return d.label.toLowerCase().includes(match)}))}));return!dev&&devices.length&&matches.includes("back")&&(dev=devices[devices.length-1]),dev&&(constraints.video.deviceId=face.exact?{exact:dev.deviceId}:{ideal:dev.deviceId}),constraints.video=constraintsToChrome_(constraints.video),logging("chrome: "+JSON.stringify(constraints)),func(constraints)}))}constraints.video=constraintsToChrome_(constraints.video)}return logging("chrome: "+JSON.stringify(constraints)),func(constraints)},shimError_=function(e){return browserDetails.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(navigator.getUserMedia=function(constraints,onSuccess,onError){shimConstraints_(constraints,(function(c){navigator.webkitGetUserMedia(c,onSuccess,(function(e){onError&&onError(shimError_(e))}))}))}.bind(navigator),navigator.mediaDevices.getUserMedia){var origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(cs){return shimConstraints_(cs,(function(c){return origGetUserMedia(c).then((function(stream){if(c.audio&&!stream.getAudioTracks().length||c.video&&!stream.getVideoTracks().length)throw stream.getTracks().forEach((function(track){track.stop()})),new DOMException("","NotFoundError");return stream}),(function(e){return Promise.reject(shimError_(e))}))}))}}};var logging=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js")).log},{"../utils.js":38}],29:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimRTCIceCandidate=function(window){if(!window.RTCIceCandidate||window.RTCIceCandidate&&"foundation"in window.RTCIceCandidate.prototype)return;var NativeRTCIceCandidate=window.RTCIceCandidate;window.RTCIceCandidate=function(args){if("object"===("undefined"==typeof args?"undefined":_typeof(args))&&args.candidate&&0===args.candidate.indexOf("a=")&&((args=JSON.parse(JSON.stringify(args))).candidate=args.candidate.substr(2)),args.candidate&&args.candidate.length){var nativeCandidate=new NativeRTCIceCandidate(args),parsedCandidate=_sdp2.default.parseCandidate(args.candidate),augmentedCandidate=Object.assign(nativeCandidate,parsedCandidate);return augmentedCandidate.toJSON=function(){return{candidate:augmentedCandidate.candidate,sdpMid:augmentedCandidate.sdpMid,sdpMLineIndex:augmentedCandidate.sdpMLineIndex,usernameFragment:augmentedCandidate.usernameFragment}},augmentedCandidate}return new NativeRTCIceCandidate(args)},window.RTCIceCandidate.prototype=NativeRTCIceCandidate.prototype,utils.wrapPeerConnectionEvent(window,"icecandidate",(function(e){return e.candidate&&Object.defineProperty(e,"candidate",{value:new window.RTCIceCandidate(e.candidate),writable:"false"}),e}))},exports.shimMaxMessageSize=function(window,browserDetails){if(!window.RTCPeerConnection)return;"sctp"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp}});var sctpInDescription=function(description){if(!description||!description.sdp)return!1;var sections=_sdp2.default.splitSections(description.sdp);return sections.shift(),sections.some((function(mediaSection){var mLine=_sdp2.default.parseMLine(mediaSection);return mLine&&"application"===mLine.kind&&-1!==mLine.protocol.indexOf("SCTP")}))},getRemoteFirefoxVersion=function(description){var match=description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===match||match.length<2)return-1;var version=parseInt(match[1],10);return version!=version?-1:version},getCanSendMaxMessageSize=function(remoteIsFirefox){var canSendMaxMessageSize=65536;return"firefox"===browserDetails.browser&&(canSendMaxMessageSize=browserDetails.version<57?-1===remoteIsFirefox?16384:2147483637:browserDetails.version<60?57===browserDetails.version?65535:65536:2147483637),canSendMaxMessageSize},getMaxMessageSize=function(description,remoteIsFirefox){var maxMessageSize=65536;"firefox"===browserDetails.browser&&57===browserDetails.version&&(maxMessageSize=65535);var match=_sdp2.default.matchPrefix(description.sdp,"a=max-message-size:");return match.length>0?maxMessageSize=parseInt(match[0].substr(19),10):"firefox"===browserDetails.browser&&-1!==remoteIsFirefox&&(maxMessageSize=2147483637),maxMessageSize},origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===browserDetails.browser&&browserDetails.version>=76){var _getConfiguration=this.getConfiguration(),sdpSemantics=_getConfiguration.sdpSemantics;"plan-b"===sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){var isFirefox=getRemoteFirefoxVersion(arguments[0]),canSendMMS=getCanSendMaxMessageSize(isFirefox),remoteMMS=getMaxMessageSize(arguments[0],isFirefox),maxMessageSize=void 0;maxMessageSize=0===canSendMMS&&0===remoteMMS?Number.POSITIVE_INFINITY:0===canSendMMS||0===remoteMMS?Math.max(canSendMMS,remoteMMS):Math.min(canSendMMS,remoteMMS);var sctp={};Object.defineProperty(sctp,"maxMessageSize",{get:function(){return maxMessageSize}}),this._sctp=sctp}return origSetRemoteDescription.apply(this,arguments)}},exports.shimSendThrowTypeError=function(window){if(!window.RTCPeerConnection||!("createDataChannel"in window.RTCPeerConnection.prototype))return;function wrapDcSend(dc,pc){var origDataChannelSend=dc.send;dc.send=function(){var data=arguments[0],length=data.length||data.size||data.byteLength;if("open"===dc.readyState&&pc.sctp&&length>pc.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+pc.sctp.maxMessageSize+" bytes)");return origDataChannelSend.apply(dc,arguments)}}var origCreateDataChannel=window.RTCPeerConnection.prototype.createDataChannel;window.RTCPeerConnection.prototype.createDataChannel=function(){var dataChannel=origCreateDataChannel.apply(this,arguments);return wrapDcSend(dataChannel,this),dataChannel},utils.wrapPeerConnectionEvent(window,"datachannel",(function(e){return wrapDcSend(e.channel,e.target),e}))},exports.shimConnectionState=function(window){if(!window.RTCPeerConnection||"connectionState"in window.RTCPeerConnection.prototype)return;var proto=window.RTCPeerConnection.prototype;Object.defineProperty(proto,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(proto,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(cb){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),cb&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=cb)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(method){var origMethod=proto[method];proto[method]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var pc=e.target;if(pc._lastConnectionState!==pc.connectionState){pc._lastConnectionState=pc.connectionState;var newEvent=new Event("connectionstatechange",e);pc.dispatchEvent(newEvent)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),origMethod.apply(this,arguments)}}))},exports.removeExtmapAllowMixed=function(window,browserDetails){if(!window.RTCPeerConnection)return;if("chrome"===browserDetails.browser&&browserDetails.version>=71)return;if("safari"===browserDetails.browser&&browserDetails.version>=605)return;var nativeSRD=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(desc){if(desc&&desc.sdp&&-1!==desc.sdp.indexOf("\na=extmap-allow-mixed")){var sdp=desc.sdp.split("\n").filter((function(line){return"a=extmap-allow-mixed"!==line.trim()})).join("\n");window.RTCSessionDescription&&desc instanceof window.RTCSessionDescription?arguments[0]=new window.RTCSessionDescription({type:desc.type,sdp:sdp}):desc.sdp=sdp}return nativeSRD.apply(this,arguments)}},exports.shimAddIceCandidateNullOrEmpty=function(window,browserDetails){if(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype)return;var nativeAddIceCandidate=window.RTCPeerConnection.prototype.addIceCandidate;if(!nativeAddIceCandidate||0===nativeAddIceCandidate.length)return;window.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===browserDetails.browser&&browserDetails.version<78||"firefox"===browserDetails.browser&&browserDetails.version<68||"safari"===browserDetails.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():nativeAddIceCandidate.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}};var obj,_sdp=require("sdp"),_sdp2=(obj=_sdp)&&obj.__esModule?obj:{default:obj},utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("./utils"))},{"./utils":38,sdp:6}],30:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimPeerConnection=function(window,browserDetails){if(window.RTCIceGatherer&&(window.RTCIceCandidate||(window.RTCIceCandidate=function(args){return args}),window.RTCSessionDescription||(window.RTCSessionDescription=function(args){return args}),browserDetails.version<15025)){var origMSTEnabled=Object.getOwnPropertyDescriptor(window.MediaStreamTrack.prototype,"enabled");Object.defineProperty(window.MediaStreamTrack.prototype,"enabled",{set:function(value){origMSTEnabled.set.call(this,value);var ev=new Event("enabled");ev.enabled=value,this.dispatchEvent(ev)}})}window.RTCRtpSender&&!("dtmf"in window.RTCRtpSender.prototype)&&Object.defineProperty(window.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new window.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}});window.RTCDtmfSender&&!window.RTCDTMFSender&&(window.RTCDTMFSender=window.RTCDtmfSender);var RTCPeerConnectionShim=(0,_rtcpeerconnectionShim2.default)(window,browserDetails.version);window.RTCPeerConnection=function(config){return config&&config.iceServers&&(config.iceServers=(0,_filtericeservers.filterIceServers)(config.iceServers,browserDetails.version),utils.log("ICE servers after filtering:",config.iceServers)),new RTCPeerConnectionShim(config)},window.RTCPeerConnection.prototype=RTCPeerConnectionShim.prototype},exports.shimReplaceTrack=function(window){window.RTCRtpSender&&!("replaceTrack"in window.RTCRtpSender.prototype)&&(window.RTCRtpSender.prototype.replaceTrack=window.RTCRtpSender.prototype.setTrack)};var obj,utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils")),_filtericeservers=require("./filtericeservers"),_rtcpeerconnectionShim=require("rtcpeerconnection-shim"),_rtcpeerconnectionShim2=(obj=_rtcpeerconnectionShim)&&obj.__esModule?obj:{default:obj}},{"../utils":38,"./filtericeservers":31,"./getdisplaymedia":32,"./getusermedia":33,"rtcpeerconnection-shim":5}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterIceServers=function(iceServers,edgeVersion){var hasTurn=!1;return(iceServers=JSON.parse(JSON.stringify(iceServers))).filter((function(server){if(server&&(server.urls||server.url)){var urls=server.urls||server.url;server.url&&!server.urls&&utils.deprecated("RTCIceServer.url","RTCIceServer.urls");var isString="string"==typeof urls;return isString&&(urls=[urls]),urls=urls.filter((function(url){if(0===url.indexOf("stun:"))return!1;var validTurn=url.startsWith("turn")&&!url.startsWith("turn:[")&&url.includes("transport=udp");return validTurn&&!hasTurn?(hasTurn=!0,!0):validTurn&&!hasTurn})),delete server.url,server.urls=isString?urls[0]:urls,!!urls.length}}))};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":38}],32:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window){if(!("getDisplayMedia"in window.navigator))return;if(!window.navigator.mediaDevices)return;if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;window.navigator.mediaDevices.getDisplayMedia=window.navigator.getDisplayMedia.bind(window.navigator)}},{}],33:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetUserMedia=function(window){var navigator=window&&window.navigator,origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(c){return origGetUserMedia(c).catch((function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))}))}}},{}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimOnTrack=function(window){"object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCTrackEvent&&"receiver"in window.RTCTrackEvent.prototype&&!("transceiver"in window.RTCTrackEvent.prototype)&&Object.defineProperty(window.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},exports.shimPeerConnection=function(window,browserDetails){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection&&!window.mozRTCPeerConnection)return;!window.RTCPeerConnection&&window.mozRTCPeerConnection&&(window.RTCPeerConnection=window.mozRTCPeerConnection);browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value;return obj}({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var modernStatsTypes={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},nativeGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];return nativeGetStats.apply(this,[selector||null]).then((function(stats){if(browserDetails.version<53&&!onSucc)try{stats.forEach((function(stat){stat.type=modernStatsTypes[stat.type]||stat.type}))}catch(e){if("TypeError"!==e.name)throw e;stats.forEach((function(stat,i){stats.set(i,Object.assign({},stat,{type:modernStatsTypes[stat.type]||stat.type}))}))}return stats})).then(onSucc,onErr)}},exports.shimSenderGetStats=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpSender.prototype)return;var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender});window.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},exports.shimReceiverGetStats=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpReceiver.prototype)return;var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this2=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this2})),receivers});utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},exports.shimRemoveStream=function(window){if(!window.RTCPeerConnection||"removeStream"in window.RTCPeerConnection.prototype)return;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;utils.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(sender){sender.track&&stream.getTracks().includes(sender.track)&&_this3.removeTrack(sender)}))}},exports.shimRTCDataChannel=function(window){window.DataChannel&&!window.RTCDataChannel&&(window.RTCDataChannel=window.DataChannel)},exports.shimAddTransceiver=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origAddTransceiver=window.RTCPeerConnection.prototype.addTransceiver;origAddTransceiver&&(window.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var initParameters=arguments[1],shouldPerformCheck=initParameters&&"sendEncodings"in initParameters;shouldPerformCheck&&initParameters.sendEncodings.forEach((function(encodingParam){if("rid"in encodingParam){if(!/^[a-z0-9]{0,16}$/i.test(encodingParam.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in encodingParam&&!(parseFloat(encodingParam.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in encodingParam&&!(parseFloat(encodingParam.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var transceiver=origAddTransceiver.apply(this,arguments);if(shouldPerformCheck){var sender=transceiver.sender,params=sender.getParameters();(!("encodings"in params)||1===params.encodings.length&&0===Object.keys(params.encodings[0]).length)&&(params.encodings=initParameters.sendEncodings,sender.sendEncodings=initParameters.sendEncodings,this.setParametersPromises.push(sender.setParameters(params).then((function(){delete sender.sendEncodings})).catch((function(){delete sender.sendEncodings}))))}return transceiver})},exports.shimGetParameters=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCRtpSender)return;var origGetParameters=window.RTCRtpSender.prototype.getParameters;origGetParameters&&(window.RTCRtpSender.prototype.getParameters=function(){var params=origGetParameters.apply(this,arguments);return"encodings"in params||(params.encodings=[].concat(this.sendEncodings||[{}])),params})},exports.shimCreateOffer=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateOffer=window.RTCPeerConnection.prototype.createOffer;window.RTCPeerConnection.prototype.createOffer=function(){var _this4=this,_arguments2=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateOffer.apply(_this4,_arguments2)})).finally((function(){_this4.setParametersPromises=[]})):origCreateOffer.apply(this,arguments)}},exports.shimCreateAnswer=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateAnswer=window.RTCPeerConnection.prototype.createAnswer;window.RTCPeerConnection.prototype.createAnswer=function(){var _this5=this,_arguments3=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateAnswer.apply(_this5,_arguments3)})).finally((function(){_this5.setParametersPromises=[]})):origCreateAnswer.apply(this,arguments)}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":38,"./getdisplaymedia":35,"./getusermedia":36}],35:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,preferredMediaSource){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;window.navigator.mediaDevices.getDisplayMedia=function(constraints){if(!constraints||!constraints.video){var err=new DOMException("getDisplayMedia without video constraints is undefined");return err.name="NotFoundError",err.code=8,Promise.reject(err)}return!0===constraints.video?constraints.video={mediaSource:preferredMediaSource}:constraints.video.mediaSource=preferredMediaSource,window.navigator.mediaDevices.getUserMedia(constraints)}}},{}],36:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator,MediaStreamTrack=window&&window.MediaStreamTrack;if(navigator.getUserMedia=function(constraints,onSuccess,onError){utils.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),navigator.mediaDevices.getUserMedia(constraints).then(onSuccess,onError)},!(browserDetails.version>55&&"autoGainControl"in navigator.mediaDevices.getSupportedConstraints())){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])},nativeGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);if(navigator.mediaDevices.getUserMedia=function(c){return"object"===("undefined"==typeof c?"undefined":_typeof(c))&&"object"===_typeof(c.audio)&&(c=JSON.parse(JSON.stringify(c)),remap(c.audio,"autoGainControl","mozAutoGainControl"),remap(c.audio,"noiseSuppression","mozNoiseSuppression")),nativeGetUserMedia(c)},MediaStreamTrack&&MediaStreamTrack.prototype.getSettings){var nativeGetSettings=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var obj=nativeGetSettings.apply(this,arguments);return remap(obj,"mozAutoGainControl","autoGainControl"),remap(obj,"mozNoiseSuppression","noiseSuppression"),obj}}if(MediaStreamTrack&&MediaStreamTrack.prototype.applyConstraints){var nativeApplyConstraints=MediaStreamTrack.prototype.applyConstraints;MediaStreamTrack.prototype.applyConstraints=function(c){return"audio"===this.kind&&"object"===("undefined"==typeof c?"undefined":_typeof(c))&&(c=JSON.parse(JSON.stringify(c)),remap(c,"autoGainControl","mozAutoGainControl"),remap(c,"noiseSuppression","mozNoiseSuppression")),nativeApplyConstraints.apply(this,[c])}}}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":38}],37:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimLocalStreamsAPI=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getLocalStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams});if(!("addStream"in window.RTCPeerConnection.prototype)){var _addTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addStream=function(stream){var _this=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(stream)||this._localStreams.push(stream),stream.getAudioTracks().forEach((function(track){return _addTrack.call(_this,track,stream)})),stream.getVideoTracks().forEach((function(track){return _addTrack.call(_this,track,stream)}))},window.RTCPeerConnection.prototype.addTrack=function(track){for(var _this2=this,_len=arguments.length,streams=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)streams[_key-1]=arguments[_key];return streams&&streams.forEach((function(stream){_this2._localStreams?_this2._localStreams.includes(stream)||_this2._localStreams.push(stream):_this2._localStreams=[stream]})),_addTrack.apply(this,arguments)}}"removeStream"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._localStreams||(this._localStreams=[]);var index=this._localStreams.indexOf(stream);if(-1!==index){this._localStreams.splice(index,1);var tracks=stream.getTracks();this.getSenders().forEach((function(sender){tracks.includes(sender.track)&&_this3.removeTrack(sender)}))}})},exports.shimRemoteStreamsAPI=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getRemoteStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]});if(!("onaddstream"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(f){var _this4=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=f),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(_this4._remoteStreams||(_this4._remoteStreams=[]),!_this4._remoteStreams.includes(stream)){_this4._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,_this4.dispatchEvent(event)}}))})}});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var pc=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(pc._remoteStreams||(pc._remoteStreams=[]),!(pc._remoteStreams.indexOf(stream)>=0)){pc._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,pc.dispatchEvent(event)}}))}),origSetRemoteDescription.apply(pc,arguments)}}},exports.shimCallbacksAPI=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var prototype=window.RTCPeerConnection.prototype,origCreateOffer=prototype.createOffer,origCreateAnswer=prototype.createAnswer,setLocalDescription=prototype.setLocalDescription,setRemoteDescription=prototype.setRemoteDescription,addIceCandidate=prototype.addIceCandidate;prototype.createOffer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateOffer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.createAnswer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateAnswer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};var withCallback=function(description,successCallback,failureCallback){var promise=setLocalDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};prototype.setLocalDescription=withCallback,withCallback=function(description,successCallback,failureCallback){var promise=setRemoteDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.setRemoteDescription=withCallback,withCallback=function(candidate,successCallback,failureCallback){var promise=addIceCandidate.apply(this,[candidate]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.addIceCandidate=withCallback},exports.shimGetUserMedia=function(window){var navigator=window&&window.navigator;if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var mediaDevices=navigator.mediaDevices,_getUserMedia=mediaDevices.getUserMedia.bind(mediaDevices);navigator.mediaDevices.getUserMedia=function(constraints){return _getUserMedia(shimConstraints(constraints))}}!navigator.getUserMedia&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(navigator.getUserMedia=function(constraints,cb,errcb){navigator.mediaDevices.getUserMedia(constraints).then(cb,errcb)}.bind(navigator))},exports.shimConstraints=shimConstraints,exports.shimRTCIceServerUrls=function(window){if(!window.RTCPeerConnection)return;var OrigPeerConnection=window.RTCPeerConnection;window.RTCPeerConnection=function(pcConfig,pcConstraints){if(pcConfig&&pcConfig.iceServers){for(var newIceServers=[],i=0;i<pcConfig.iceServers.length;i++){var server=pcConfig.iceServers[i];!server.hasOwnProperty("urls")&&server.hasOwnProperty("url")?(utils.deprecated("RTCIceServer.url","RTCIceServer.urls"),(server=JSON.parse(JSON.stringify(server))).urls=server.url,delete server.url,newIceServers.push(server)):newIceServers.push(pcConfig.iceServers[i])}pcConfig.iceServers=newIceServers}return new OrigPeerConnection(pcConfig,pcConstraints)},window.RTCPeerConnection.prototype=OrigPeerConnection.prototype,"generateCertificate"in OrigPeerConnection&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return OrigPeerConnection.generateCertificate}})},exports.shimTrackEventTransceiver=function(window){"object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.RTCTrackEvent&&"receiver"in window.RTCTrackEvent.prototype&&!("transceiver"in window.RTCTrackEvent.prototype)&&Object.defineProperty(window.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},exports.shimCreateOfferLegacy=function(window){var origCreateOffer=window.RTCPeerConnection.prototype.createOffer;window.RTCPeerConnection.prototype.createOffer=function(offerOptions){if(offerOptions){"undefined"!=typeof offerOptions.offerToReceiveAudio&&(offerOptions.offerToReceiveAudio=!!offerOptions.offerToReceiveAudio);var audioTransceiver=this.getTransceivers().find((function(transceiver){return"audio"===transceiver.receiver.track.kind}));!1===offerOptions.offerToReceiveAudio&&audioTransceiver?"sendrecv"===audioTransceiver.direction?audioTransceiver.setDirection?audioTransceiver.setDirection("sendonly"):audioTransceiver.direction="sendonly":"recvonly"===audioTransceiver.direction&&(audioTransceiver.setDirection?audioTransceiver.setDirection("inactive"):audioTransceiver.direction="inactive"):!0!==offerOptions.offerToReceiveAudio||audioTransceiver||this.addTransceiver("audio"),"undefined"!=typeof offerOptions.offerToReceiveVideo&&(offerOptions.offerToReceiveVideo=!!offerOptions.offerToReceiveVideo);var videoTransceiver=this.getTransceivers().find((function(transceiver){return"video"===transceiver.receiver.track.kind}));!1===offerOptions.offerToReceiveVideo&&videoTransceiver?"sendrecv"===videoTransceiver.direction?videoTransceiver.setDirection?videoTransceiver.setDirection("sendonly"):videoTransceiver.direction="sendonly":"recvonly"===videoTransceiver.direction&&(videoTransceiver.setDirection?videoTransceiver.setDirection("inactive"):videoTransceiver.direction="inactive"):!0!==offerOptions.offerToReceiveVideo||videoTransceiver||this.addTransceiver("video")}return origCreateOffer.apply(this,arguments)}},exports.shimAudioContext=function(window){if("object"!==("undefined"==typeof window?"undefined":_typeof(window))||window.AudioContext)return;window.AudioContext=window.webkitAudioContext};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"));function shimConstraints(constraints){return constraints&&void 0!==constraints.video?Object.assign({},constraints,{video:utils.compactObject(constraints.video)}):constraints}},{"../utils":38}],38:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.extractVersion=extractVersion,exports.wrapPeerConnectionEvent=function(window,eventNameToWrap,wrapper){if(!window.RTCPeerConnection)return;var proto=window.RTCPeerConnection.prototype,nativeAddEventListener=proto.addEventListener;proto.addEventListener=function(nativeEventName,cb){if(nativeEventName!==eventNameToWrap)return nativeAddEventListener.apply(this,arguments);var wrappedCallback=function(e){var modifiedEvent=wrapper(e);modifiedEvent&&(cb.handleEvent?cb.handleEvent(modifiedEvent):cb(modifiedEvent))};return this._eventMap=this._eventMap||{},this._eventMap[eventNameToWrap]||(this._eventMap[eventNameToWrap]=new Map),this._eventMap[eventNameToWrap].set(cb,wrappedCallback),nativeAddEventListener.apply(this,[nativeEventName,wrappedCallback])};var nativeRemoveEventListener=proto.removeEventListener;proto.removeEventListener=function(nativeEventName,cb){if(nativeEventName!==eventNameToWrap||!this._eventMap||!this._eventMap[eventNameToWrap])return nativeRemoveEventListener.apply(this,arguments);if(!this._eventMap[eventNameToWrap].has(cb))return nativeRemoveEventListener.apply(this,arguments);var unwrappedCb=this._eventMap[eventNameToWrap].get(cb);return this._eventMap[eventNameToWrap].delete(cb),0===this._eventMap[eventNameToWrap].size&&delete this._eventMap[eventNameToWrap],0===Object.keys(this._eventMap).length&&delete this._eventMap,nativeRemoveEventListener.apply(this,[nativeEventName,unwrappedCb])},Object.defineProperty(proto,"on"+eventNameToWrap,{get:function(){return this["_on"+eventNameToWrap]},set:function(cb){this["_on"+eventNameToWrap]&&(this.removeEventListener(eventNameToWrap,this["_on"+eventNameToWrap]),delete this["_on"+eventNameToWrap]),cb&&this.addEventListener(eventNameToWrap,this["_on"+eventNameToWrap]=cb)},enumerable:!0,configurable:!0})},exports.disableLog=function(bool){if("boolean"!=typeof bool)return new Error("Argument type: "+("undefined"==typeof bool?"undefined":_typeof(bool))+". Please use a boolean.");return logDisabled_=bool,bool?"adapter.js logging disabled":"adapter.js logging enabled"},exports.disableWarnings=function(bool){if("boolean"!=typeof bool)return new Error("Argument type: "+("undefined"==typeof bool?"undefined":_typeof(bool))+". Please use a boolean.");return deprecationWarnings_=!bool,"adapter.js deprecation warnings "+(bool?"disabled":"enabled")},exports.log=function(){if("object"===("undefined"==typeof window?"undefined":_typeof(window))){if(logDisabled_)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},exports.deprecated=function(oldMethod,newMethod){if(!deprecationWarnings_)return;console.warn(oldMethod+" is deprecated, please use "+newMethod+" instead.")},exports.detectBrowser=function(window){var result={browser:null,version:null};if("undefined"==typeof window||!window.navigator)return result.browser="Not a browser.",result;var navigator=window.navigator;if(navigator.mozGetUserMedia)result.browser="firefox",result.version=extractVersion(navigator.userAgent,/Firefox\/(\d+)\./,1);else if(navigator.webkitGetUserMedia||!1===window.isSecureContext&&window.webkitRTCPeerConnection&&!window.RTCIceGatherer)result.browser="chrome",result.version=extractVersion(navigator.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))result.browser="edge",result.version=extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!window.RTCPeerConnection||!navigator.userAgent.match(/AppleWebKit\/(\d+)\./))return result.browser="Not a supported browser.",result;result.browser="safari",result.version=extractVersion(navigator.userAgent,/AppleWebKit\/(\d+)\./,1),result.supportsUnifiedPlan=window.RTCRtpTransceiver&&"currentDirection"in window.RTCRtpTransceiver.prototype}return result},exports.compactObject=function compactObject(data){if(!isObject(data))return data;return Object.keys(data).reduce((function(accumulator,key){var isObj=isObject(data[key]),value=isObj?compactObject(data[key]):data[key],isEmptyObject=isObj&&!Object.keys(value).length;return void 0===value||isEmptyObject?accumulator:Object.assign(accumulator,function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value;return obj}({},key,value))}),{})},exports.walkStats=walkStats,exports.filterStats=function(result,track,outbound){var streamStatsType=outbound?"outbound-rtp":"inbound-rtp",filteredResult=new Map;if(null===track)return filteredResult;var trackStats=[];return result.forEach((function(value){"track"===value.type&&value.trackIdentifier===track.id&&trackStats.push(value)})),trackStats.forEach((function(trackStat){result.forEach((function(stats){stats.type===streamStatsType&&stats.trackId===trackStat.id&&walkStats(result,stats,filteredResult)}))})),filteredResult};var logDisabled_=!0,deprecationWarnings_=!0;function extractVersion(uastring,expr,pos){var match=uastring.match(expr);return match&&match.length>=pos&&parseInt(match[pos],10)}function isObject(val){return"[object Object]"===Object.prototype.toString.call(val)}function walkStats(stats,base,resultSet){base&&!resultSet.has(base.id)&&(resultSet.set(base.id,base),Object.keys(base).forEach((function(name){name.endsWith("Id")?walkStats(stats,stats.get(base[name]),resultSet):name.endsWith("Ids")&&base[name].forEach((function(id){walkStats(stats,stats.get(id),resultSet)}))})))}},{}],39:[function(require,module,exports){var _0x56e2ba,_0x54ffbb,_0x8674=["feedDecoder","postMessage","now","getBufferTimeLength","Unknown request","bind","audioChunkLength","context","sampleRate","videoWidth","videoHeight","token","dropDelayMultiplier","Failed to init stream receiver ","videoDecoder","decoderPath","onmessage","No timestamp available for decoded picture, discarding","shift","STOPPED","audioBuffer","sync","start","setVolume","requestVideoFrameCallback","Failed to init video decoder ","fps","framesRendered","noDataSince","prototype","receivedIframe","lastPlayedVideoTime","kframe","decode","payload","play","stream","STARTUP","playFirstSound","createBuffer","getChannelData","random","createBufferSource","buffer","connect","destination","mute","PAUSED","unmute","resume","getVolume","lastFpsTime","lastPlayedVideoTimestamp","log","trace","requestVideoFrameCallback, audio player time "," callback timestamp ","render","playing","dispatchEvent","riseApiEvent","lastEventRised","PLAYBACK_PROBLEM","logToCanvas","ctx2D","height","fillStyle","black","font","textAlign","center","width","40pt","fillText","initLogger","verbosity","console","apply","warn","wsLogger","debug","renderFunction","force2D","YTexture","CBTexture","CRTexture","RGBTexture","rgbaBuffer","mbWidth","codedWidth","halfWidth","precision mediump float;","uniform sampler2D CBTexture;","void main() {","float y = texture2D(YTexture, texCoord).r;","float cb = texture2D(CBTexture, texCoord).r - 0.5;","gl_FragColor = vec4(","y + -0.343 * cb - 0.711 * cr,","1.0","join","attribute vec2 vertex;","varying vec2 texCoord;","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","SHADER_VERTEX_IDENTITY_RGBA","varying vec2 tc;","void main(){","gl_Position = vertex;","SHADER_FRAGMENT_RGBA","uniform sampler2D RGBTexture;","gl_FragColor = texture2D(RGBTexture, tc);","getContext","experimental-webgl","inputFormat","rgba","initWebGLRGB","initWebGLYUV","renderFrame2D","bindBuffer","ARRAY_BUFFER","bufferData","STATIC_DRAW","program","attachShader","compileShader","SHADER_VERTEX_IDENTITY_YUV","FRAGMENT_SHADER","SHADER_FRAGMENT_YCBCRTORGBA","linkProgram","getProgramParameter","Failed to init WebGL! Message ","getProgramInfoLog","useProgram","createTexture","getAttribLocation","vertex","enableVertexAttribArray","vertexAttribPointer","createProgram","bindAttribLocation","FLOAT","renderFrameGLRGB","undefined","createImageData","putImageData","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","TEXTURE_2D","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","CLAMP_TO_EDGE","TEXTURE_WRAP_T","getUniformLocation","createShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","isUsingWebGL","activeTexture","bindTexture","texImage2D","LUMINANCE","UNSIGNED_BYTE","TEXTURE1","TEXTURE2","drawArrays","TRIANGLE_STRIP","TEXTURE0","RGBA","TRIANGLES","type","YCbCrToRGBA","set","Changing canvas resolution from "," to ","lastTimeRendered","getLastTimeRendered","nodeConnected","gainNode","createGain","abs","Audio node buffer size ","internalBufferSize","createScriptProcessor","audioJSNode","previousSync","lastSync","lastSyncTime","playbackTime","value","disconnect","resetBuffers","playAudio","getBufferLength","currentTime","audioChunkTimeLength","No audio! ","previousSyncTime","Audio player mute","gain","Audio player resume","setTimeout","state","initialized","init","canvas","api","configuration","initBuffers","initialVolume","audioPlayer","error","Failed to init audio player ","yuv","videoRenderer","Failed to init video renderer ","receiver","terminate","receiverPath","addEventListener","message","data","status","failed","closed","stop","AVData","audioLength","audioReceived","audio","length","videoLength","Received video, frames:","videoReceived","video","videoBuffer","push","videoFrameTimeLength","getCurrentSync","PLAYING","muted","decodedVideoBuffer","tsVideoWaitingList"];_0x56e2ba=_0x8674,_0x54ffbb=450,function(_0x5bd6fa){for(;--_0x5bd6fa;)_0x56e2ba.push(_0x56e2ba.shift())}(++_0x54ffbb);var _0x162a=function(_0x289e5c,_0x18e4c1){return _0x8674[_0x289e5c-=0]},requestAnimFrame=function(_0x452c50){window[_0x162a("0x0")](_0x452c50,1e3/30)};function WSPlayer(){this[_0x162a("0x1")]=WSPlayerState.STOPPED,this[_0x162a("0x2")]=!1}WSPlayer.prototype[_0x162a("0x3")]=function(_0x566b31,_0x2633b5,_0x439354){this.canvas=_0x566b31[_0x162a("0x4")],this[_0x162a("0x5")]=_0x566b31[_0x162a("0x5")],this[_0x162a("0x6")]=_0x566b31,this[_0x162a("0x7")](),this[_0x162a("0x8")]=-1;try{this[_0x162a("0x9")]=new AudioPlayer(_0x2633b5)}catch(_0x388ad2){return void wsLogger[_0x162a("0xa")](_0x162a("0xb")+_0x388ad2)}try{this.videoRenderer=new VideoRenderer(this[_0x162a("0x4")],!1,_0x162a("0xc")),this[_0x162a("0xd")].init()}catch(_0x4a3ba3){return void wsLogger.error(_0x162a("0xe")+_0x4a3ba3)}if(!_0x439354)try{this[_0x162a("0xf")]&&this[_0x162a("0xf")][_0x162a("0x10")](),this[_0x162a("0xf")]=new Worker(_0x566b31[_0x162a("0x11")]),this.receiver[_0x162a("0x12")](_0x162a("0x13"),function(_0xd32be3){switch(_0xd32be3[_0x162a("0x14")][_0x162a("0x13")]){case"connection":_0xd32be3[_0x162a("0x14")][_0x162a("0x15")]!=_0x162a("0x16")&&_0xd32be3[_0x162a("0x14")][_0x162a("0x15")]!=_0x162a("0x17")||(this[_0x162a("0x18")](),this[_0x162a("0x2")]=!1);break;case _0x162a("0x19"):var _0x223990;if(_0xd32be3[_0x162a("0x14")][_0x162a("0x1a")]>0)for(this[_0x162a("0x1b")]=!0,_0x223990=0;_0x223990<_0xd32be3[_0x162a("0x14")][_0x162a("0x1c")][_0x162a("0x1d")];_0x223990++)this[_0x162a("0x9")].playAudio(_0xd32be3.data.audio[_0x223990]);if(_0xd32be3[_0x162a("0x14")][_0x162a("0x1e")]>0){for(wsLogger.debug(_0x162a("0x1f")+_0xd32be3[_0x162a("0x14")].videoLength),this[_0x162a("0x20")]=!0,_0x223990=0;_0x223990<_0xd32be3[_0x162a("0x14")][_0x162a("0x21")][_0x162a("0x1d")];_0x223990++)this[_0x162a("0x22")][_0x162a("0x23")](_0xd32be3[_0x162a("0x14")].video[_0x223990]);this[_0x162a("0x24")]=_0xd32be3[_0x162a("0x14")][_0x162a("0x1e")]/_0xd32be3.data.video[_0x162a("0x1d")]}var _0x3677b1=this[_0x162a("0x9")][_0x162a("0x25")]();if(this[_0x162a("0x22")][_0x162a("0x1d")]>0)if(this[_0x162a("0x1")]==WSPlayerState[_0x162a("0x26")])if(this[_0x162a("0xd")][_0x162a("0x27")])for(this[_0x162a("0x28")][_0x162a("0x1d")]=0,this[_0x162a("0x29")][_0x162a("0x1d")]=0;this[_0x162a("0x22")][_0x162a("0x1d")]>0&&this.videoBuffer[0].ts<_0x3677b1+50;)this.feedDecoder();else this[_0x162a("0x29")][_0x162a("0x1d")]<2&&this.feedDecoder();else for(;this[_0x162a("0x2a")](););this.receiver[_0x162a("0x2b")]({message:"ack",data:{seq:_0xd32be3[_0x162a("0x14")].seq,time:Date[_0x162a("0x2c")](),audioReceivedLength:_0xd32be3[_0x162a("0x14")][_0x162a("0x1a")],videoReceivedLength:_0xd32be3[_0x162a("0x14")][_0x162a("0x1e")],audioCurrentTime:_0x3677b1,audioBufferTimeLength:this.audioPlayer[_0x162a("0x2d")](),videoBufferTimeLength:(this[_0x162a("0x22")].length+this[_0x162a("0x29")][_0x162a("0x1d")]+this[_0x162a("0x28")].length)*this[_0x162a("0x24")]}});break;default:wsLogger[_0x162a("0xa")](_0x162a("0x2e"))}}[_0x162a("0x2f")](this),!1);var _0x56370c={};_0x56370c[_0x162a("0x30")]=this[_0x162a("0x9")].internalBufferSize,_0x56370c.audioContextSampleRate=this[_0x162a("0x9")][_0x162a("0x31")][_0x162a("0x32")],_0x56370c[_0x162a("0x33")]=_0x566b31[_0x162a("0x33")],_0x56370c[_0x162a("0x34")]=_0x566b31[_0x162a("0x34")],_0x56370c.urlWsServer=_0x566b31.urlWsServer,_0x56370c[_0x162a("0x35")]=_0x566b31[_0x162a("0x35")],_0x56370c.audioBufferWaitFor=_0x566b31.audioBufferWaitFor,_0x56370c.videoBufferWaitFor=_0x566b31.videoBufferWaitFor,_0x56370c.dropDelayMultiplier=_0x566b31[_0x162a("0x36")],this[_0x162a("0xf")][_0x162a("0x2b")]({message:_0x162a("0x3"),data:_0x56370c})}catch(_0x2e5046){return void wsLogger[_0x162a("0xa")](_0x162a("0x37")+_0x2e5046)}try{this[_0x162a("0x38")]&&this[_0x162a("0x38")][_0x162a("0x10")](),this[_0x162a("0x38")]=new Worker(_0x566b31[_0x162a("0x39")]),this.videoDecoder[_0x162a("0x3a")]=function(_0x67846e){0!=this[_0x162a("0x29")][_0x162a("0x1d")]?(_0x67846e.data.sync=this[_0x162a("0x29")][_0x162a("0x3c")](),this.decodedVideoBuffer.push(_0x67846e[_0x162a("0x14")]),this.state!=WSPlayerState.PLAYING&&this[_0x162a("0x1")]!=WSPlayerState[_0x162a("0x3d")]?this[_0x162a("0x28")][_0x162a("0x1d")]<5?(this[_0x162a("0x28")].length>1&&this[_0x162a("0x9")][_0x162a("0x3e")][_0x162a("0x1d")]>0&&this[_0x162a("0x9")][_0x162a("0x3e")][0][_0x162a("0x3f")]>this.decodedVideoBuffer[0].sync&&(this[_0x162a("0x28")][0]=null,this[_0x162a("0x28")].shift()),this[_0x162a("0x2a")]()):(this[_0x162a("0x1")]=WSPlayerState.PLAYING,this.audioPlayer[_0x162a("0x40")](),-1!=this[_0x162a("0x8")]&&(this[_0x162a("0x41")](this[_0x162a("0x8")]),this[_0x162a("0x8")]=-1),requestAnimFrame(this[_0x162a("0x42")].bind(this))):this[_0x162a("0x29")][_0x162a("0x1d")]<2&&this.feedDecoder()):wsLogger.warn(_0x162a("0x3b"))}[_0x162a("0x2f")](this),this[_0x162a("0x38")][_0x162a("0x2b")]({message:"init",width:_0x566b31[_0x162a("0x33")],height:_0x566b31[_0x162a("0x34")],outputGl:!0})}catch(_0x5236ab){return void wsLogger[_0x162a("0xa")](_0x162a("0x43")+_0x5236ab)}this[_0x162a("0x44")]=0,this.lastFpsTime=0,this[_0x162a("0x45")]=0,this.noDataFlag=!1,this[_0x162a("0x46")]=0,this.initialized=!0},WSPlayer[_0x162a("0x47")][_0x162a("0x7")]=function(){this[_0x162a("0x1b")]=!1,this[_0x162a("0x20")]=!1,this[_0x162a("0x22")]?this[_0x162a("0x22")][_0x162a("0x1d")]=0:this[_0x162a("0x22")]=[],this.tsVideoWaitingList?this[_0x162a("0x29")][_0x162a("0x1d")]=0:this[_0x162a("0x29")]=[],this.decodedVideoBuffer?this[_0x162a("0x28")].length=0:this[_0x162a("0x28")]=[],this[_0x162a("0x48")]=!1,this[_0x162a("0x49")]=0,this.lastPlayedVideoTimestamp=0},WSPlayer.prototype[_0x162a("0x2a")]=function(){if(this[_0x162a("0x22")][_0x162a("0x1d")]>0){if(this[_0x162a("0x48")]||this[_0x162a("0x22")][0][_0x162a("0x4a")])return this[_0x162a("0x48")]=!0,this.videoRenderer[_0x162a("0x27")]||this.tsVideoWaitingList[_0x162a("0x23")](this[_0x162a("0x22")][0].ts),this.videoDecoder[_0x162a("0x2b")]({message:_0x162a("0x4b"),skip:this[_0x162a("0xd")][_0x162a("0x27")],data:this[_0x162a("0x22")][0][_0x162a("0x4c")]},[this.videoBuffer[0][_0x162a("0x4c")].buffer]),this[_0x162a("0x22")][0]=null,this[_0x162a("0x22")][_0x162a("0x3c")](),!0;this[_0x162a("0x22")][0]=null,this.videoBuffer[_0x162a("0x3c")]()}},WSPlayer.prototype[_0x162a("0x4d")]=function(_0x394048){this.initialized?(this[_0x162a("0x7")](),this.receiver[_0x162a("0x2b")]({message:_0x162a("0x4d")}),this[_0x162a("0x4e")]=_0x394048,this.unmute(),this[_0x162a("0x1")]=WSPlayerState[_0x162a("0x4f")]):wsLogger.error("Can't play stream, player not initialized!")},WSPlayer[_0x162a("0x47")][_0x162a("0x50")]=function(){for(var _0x17a93a=this[_0x162a("0x9")][_0x162a("0x31")][_0x162a("0x51")](1,441,44100),_0x311ab3=_0x17a93a[_0x162a("0x52")](0),_0x455a72=0;_0x455a72<_0x311ab3.length;_0x455a72++)_0x311ab3[_0x455a72]=2*Math[_0x162a("0x53")]()-1;var _0x2b7b90=this[_0x162a("0x9")][_0x162a("0x31")][_0x162a("0x54")]();_0x2b7b90[_0x162a("0x55")]=_0x17a93a,_0x2b7b90[_0x162a("0x56")](this.audioPlayer[_0x162a("0x31")][_0x162a("0x57")]),_0x2b7b90[_0x162a("0x40")](0)},WSPlayer[_0x162a("0x47")].pause=function(){this[_0x162a("0x58")](),this[_0x162a("0xf")][_0x162a("0x2b")]({message:"pause"}),this[_0x162a("0x1")]=WSPlayerState[_0x162a("0x59")]},WSPlayer.prototype[_0x162a("0x58")]=function(){this[_0x162a("0x9")]&&this[_0x162a("0x9")][_0x162a("0x58")](!0),this[_0x162a("0xd")]&&this[_0x162a("0xd")][_0x162a("0x58")](!0)},WSPlayer[_0x162a("0x47")][_0x162a("0x5a")]=function(){this.audioPlayer&&this[_0x162a("0x9")].mute(!1),this.videoRenderer&&this[_0x162a("0xd")][_0x162a("0x58")](!1)},WSPlayer[_0x162a("0x47")][_0x162a("0x5b")]=function(){this[_0x162a("0x7")](),this[_0x162a("0x1")]=WSPlayerState[_0x162a("0x4f")],this[_0x162a("0xf")][_0x162a("0x2b")]({message:_0x162a("0x5b")}),this.unmute()},WSPlayer.prototype.setVolume=function(_0x5a1f09){this[_0x162a("0x1")]==WSPlayerState[_0x162a("0x26")]?this[_0x162a("0x9")][_0x162a("0x41")](_0x5a1f09):this[_0x162a("0x8")]=_0x5a1f09},WSPlayer[_0x162a("0x47")][_0x162a("0x5c")]=function(){return this[_0x162a("0x9")].getVolume()},WSPlayer[_0x162a("0x47")][_0x162a("0x18")]=function(){this.state=WSPlayerState[_0x162a("0x3d")],this[_0x162a("0xf")]&&this[_0x162a("0xf")][_0x162a("0x2b")]({message:_0x162a("0x18")}),this[_0x162a("0x9")]&&this[_0x162a("0x9")].stop(),this[_0x162a("0xd")]&&this[_0x162a("0xd")][_0x162a("0x18")](),this.fps=0,this[_0x162a("0x5d")]=0,this[_0x162a("0x45")]=0},WSPlayer[_0x162a("0x47")][_0x162a("0x42")]=function(_0x253d91){if(this[_0x162a("0x1")]==WSPlayerState[_0x162a("0x26")]){if(this[_0x162a("0x28")][_0x162a("0x1d")]>0){var _0x813081=this[_0x162a("0x9")][_0x162a("0x25")]();if(-1==_0x813081){var _0x44a14e=Date[_0x162a("0x2c")]();if(0==this[_0x162a("0x49")])_0x813081=this[_0x162a("0x28")][0].sync,this[_0x162a("0x49")]=_0x44a14e,this[_0x162a("0x5e")]=_0x813081,wsLogger[_0x162a("0x5f")]("Init Video playout without sync, currentTime "+_0x44a14e+", timestamp "+this.lastPlayedVideoTimestamp);else{var _0x393d46=_0x44a14e-this[_0x162a("0x49")],_0x160d46=this.decodedVideoBuffer[0][_0x162a("0x3f")]-this.lastPlayedVideoTimestamp;_0x393d46>=_0x160d46?(_0x813081=this[_0x162a("0x28")][0].sync,this[_0x162a("0x49")]+=_0x160d46,this[_0x162a("0x5e")]=_0x813081):_0x813081=this[_0x162a("0x28")][0][_0x162a("0x3f")]-1}}if(wsLogger[_0x162a("0x60")](_0x162a("0x61")+_0x813081+_0x162a("0x62")+_0x253d91),_0x813081-this[_0x162a("0x28")][0][_0x162a("0x3f")]>100&&this[_0x162a("0x28")].length>1&&this[_0x162a("0x28")][_0x162a("0x3c")](),this[_0x162a("0x28")][0][_0x162a("0x3f")]<=_0x813081&&(this.videoRenderer[_0x162a("0x63")](this[_0x162a("0x28")].shift()),this.framesRendered++,1==this[_0x162a("0x45")])){var _0x2e90ca=this[_0x162a("0x4")];setTimeout((function(){var _0x1e1c6f=new CustomEvent(_0x162a("0x64"));_0x2e90ca[_0x162a("0x65")](_0x1e1c6f)}),10)}}this[_0x162a("0x29")][_0x162a("0x1d")]<3&&this.feedDecoder(),requestAnimFrame(this[_0x162a("0x42")].bind(this))}},WSPlayer[_0x162a("0x47")][_0x162a("0x66")]=function(_0x35dabe){if(!(this[_0x162a("0x67")]&&Date[_0x162a("0x2c")]()-this.lastEventRised<1e3)){var _0x54b410={status:_0x162a("0x68"),info:_0x35dabe};this[_0x162a("0x5")](_0x54b410),this[_0x162a("0x67")]=Date.now()}},WSPlayer[_0x162a("0x47")][_0x162a("0x69")]=function(_0x3c7c23){var _0x248bc3=this[_0x162a("0xd")][_0x162a("0x6a")];if(_0x248bc3){_0x248bc3.measureText(_0x3c7c23);_0x248bc3.fillStyle="white";_0x248bc3.fillRect(0,this.canvas[_0x162a("0x6b")]/2-15,this[_0x162a("0x4")].width,30),_0x248bc3[_0x162a("0x6c")]=_0x162a("0x6d"),_0x248bc3[_0x162a("0x6e")]="30pt",_0x248bc3[_0x162a("0x6f")]=_0x162a("0x70"),_0x248bc3.fillText(_0x3c7c23,this[_0x162a("0x4")][_0x162a("0x71")]/2,this[_0x162a("0x4")][_0x162a("0x6b")]/2)}},WSPlayer[_0x162a("0x47")].fpsToCanvas=function(_0x48eb03){var _0x4b03da=this[_0x162a("0xd")][_0x162a("0x6a")];_0x4b03da&&(_0x4b03da[_0x162a("0x6c")]="red",_0x4b03da[_0x162a("0x6e")]=_0x162a("0x72"),_0x4b03da[_0x162a("0x73")](_0x48eb03,20,this.canvas[_0x162a("0x6b")]-20))},WSPlayer.prototype[_0x162a("0x74")]=function(_0x43edeb){this[_0x162a("0x75")]=_0x43edeb||2;var _0x556035=this;null==window.wsLogger&&(window.wsLogger={log:function(){_0x556035[_0x162a("0x75")]>=2&&window[_0x162a("0x76")][_0x162a("0x5f")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)},warn:function(){_0x556035[_0x162a("0x75")]>=1&&window[_0x162a("0x76")][_0x162a("0x78")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)},error:function(){_0x556035[_0x162a("0x75")]>=0&&window[_0x162a("0x76")][_0x162a("0xa")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)},debug:function(){_0x556035[_0x162a("0x75")]>=3&&window.console[_0x162a("0x5f")][_0x162a("0x77")](window.console,arguments)},trace:function(){_0x556035[_0x162a("0x75")]>=4&&window.console[_0x162a("0x5f")].apply(window[_0x162a("0x76")],arguments)}}),null==window[_0x162a("0x79")][_0x162a("0x7a")]&&(window.wsLogger.debug=function(){_0x556035[_0x162a("0x75")]>=3&&window[_0x162a("0x76")][_0x162a("0x5f")][_0x162a("0x77")](window[_0x162a("0x76")],arguments)}),null==window.wsLogger[_0x162a("0x60")]&&(window.wsLogger[_0x162a("0x60")]=function(){_0x556035[_0x162a("0x75")]>=4&&window[_0x162a("0x76")][_0x162a("0x5f")].apply(window[_0x162a("0x76")],arguments)})},WSPlayer[_0x162a("0x47")].getStreamStatistics=function(_0x351dd5){return _0x351dd5==_0x162a("0x1c")?this.audioReceived:_0x351dd5==_0x162a("0x21")?this[_0x162a("0x20")]:void 0};var VideoRenderer=function(_0x2008fb,_0x328799,_0x5c39da){this[_0x162a("0x4")]=_0x2008fb,this[_0x162a("0x71")]=_0x2008fb[_0x162a("0x71")],this.height=_0x2008fb.height,this[_0x162a("0x7b")]=null,this[_0x162a("0x6a")]=null,this[_0x162a("0x7c")]=_0x328799,this.inputFormat=_0x5c39da,this.gl=null,this.program=null,this[_0x162a("0x55")]=null,this[_0x162a("0x7d")]=null,this[_0x162a("0x7e")]=null,this[_0x162a("0x7f")]=null,this[_0x162a("0x80")]=null,this[_0x162a("0x81")]=null,this[_0x162a("0x82")]=null,this[_0x162a("0x83")]=null,this[_0x162a("0x84")]=null,this.muted=!1,this.SHADER_FRAGMENT_YCBCRTORGBA=[_0x162a("0x85"),"uniform sampler2D YTexture;",_0x162a("0x86"),"uniform sampler2D CRTexture;","varying vec2 texCoord;",_0x162a("0x87"),_0x162a("0x88"),"float cr = texture2D(CRTexture, texCoord).r - 0.5;",_0x162a("0x89"),_0x162a("0x8a"),"y + 1.4 * cr,",_0x162a("0x8b"),"y + 1.765 * cb,",_0x162a("0x8c"),");","}"][_0x162a("0x8d")]("\n"),this.SHADER_VERTEX_IDENTITY_YUV=[_0x162a("0x8e"),_0x162a("0x8f"),"void main() {",_0x162a("0x90"),_0x162a("0x91"),"}"][_0x162a("0x8d")]("\n"),this[_0x162a("0x92")]=["attribute vec4 vertex;",_0x162a("0x93"),_0x162a("0x94"),_0x162a("0x95"),"tc = vertex.xy*0.5+0.5;","}"][_0x162a("0x8d")]("\n"),this[_0x162a("0x96")]=["precision mediump float;",_0x162a("0x97"),"varying vec2 tc;","void main(){",_0x162a("0x98"),"}"][_0x162a("0x8d")]("\n")};function AudioPlayer(_0x21395c){var _0xfdbf8=this;this[_0x162a("0x7")](),this[_0x162a("0xde")]=!1,this[_0x162a("0x31")]=_0x21395c,this[_0x162a("0xdf")]=_0x21395c[_0x162a("0xe0")](),this[_0x162a("0xdf")][_0x162a("0x56")](_0x21395c.destination),this[_0x162a("0x58")](!0),wsLogger[_0x162a("0x5f")]("Sample rate "+this[_0x162a("0x31")][_0x162a("0x32")]);var _0x4a5353,_0x363810=[];for(_0x4a5353=256;_0x4a5353<=16384;_0x4a5353*=2)_0x363810[_0x162a("0x23")](_0x4a5353);var _0x4d6dd9=this[_0x162a("0x31")][_0x162a("0x32")]/1,_0x3b65d4=_0x363810[0],_0x4e4e5e=Math[_0x162a("0xe1")](_0x4d6dd9-_0x3b65d4);for(_0x4a5353=0;_0x4a5353<_0x363810.length;_0x4a5353++){var _0xec6c77=Math[_0x162a("0xe1")](_0x4d6dd9-_0x363810[_0x4a5353]);_0xec6c77<_0x4e4e5e&&(_0x4e4e5e=_0xec6c77,_0x3b65d4=_0x363810[_0x4a5353])}wsLogger[_0x162a("0x5f")](_0x162a("0xe2")+_0x3b65d4),this[_0x162a("0xe3")]=_0x3b65d4,this.audioChunkTimeLength=this.internalBufferSize/this[_0x162a("0x31")][_0x162a("0x32")]*1e3;try{this[_0x162a("0x31")][_0x162a("0xe4")]=this[_0x162a("0x31")].createScriptProcessor||this.context.createJavaScriptNode,this.audioJSNode=this[_0x162a("0x31")].createScriptProcessor(this[_0x162a("0xe3")],1,1)}catch(_0x5e2288){wsLogger[_0x162a("0xa")]("JS Audio Node is not supported in this browser"+_0x5e2288)}this[_0x162a("0xe5")].onaudioprocess=function(_0x26db61){var _0x4a5353,_0x163877=_0x26db61.outputBuffer[_0x162a("0x52")](0);if(_0xfdbf8[_0x162a("0x3e")][_0x162a("0x1d")]>0){var _0x1d8762=_0xfdbf8[_0x162a("0x3e")][_0x162a("0x3c")]();for(_0x4a5353=0;_0x4a5353<_0x163877.length;_0x4a5353++)_0x163877[_0x4a5353]=_0x1d8762[_0x162a("0x4c")][_0x4a5353];_0xfdbf8.lastSync?_0xfdbf8[_0x162a("0xe6")]=_0xfdbf8[_0x162a("0xe7")]:_0xfdbf8.previousSync=_0x1d8762[_0x162a("0x3f")],_0xfdbf8.lastSync=_0x1d8762[_0x162a("0x3f")],_0xfdbf8[_0x162a("0xe8")]?_0xfdbf8.previousSyncTime=_0xfdbf8[_0x162a("0xe8")]:_0xfdbf8.previousSyncTime=1e3*_0x26db61[_0x162a("0xe9")],_0xfdbf8.lastSyncTime=1e3*_0x26db61[_0x162a("0xe9")],_0xfdbf8.bufferExhausted=!1}else{for(_0x4a5353=0;_0x4a5353<_0x163877.length;_0x4a5353++)_0x163877[_0x4a5353]=0;_0xfdbf8.bufferExhausted=!0,0!=_0xfdbf8[_0x162a("0xdf")].gain[_0x162a("0xea")]&&wsLogger[_0x162a("0x7a")]("No audio in audio buffer!")}}}VideoRenderer[_0x162a("0x47")].init=function(){if(!this[_0x162a("0x7c")])try{var _0x1a7035=this.gl=this[_0x162a("0x4")][_0x162a("0x99")]("webgl")||this[_0x162a("0x4")][_0x162a("0x99")](_0x162a("0x9a"))}catch(_0x1fa2db){wsLogger[_0x162a("0xa")]("Failed to get webgl context, error "+_0x1fa2db)}_0x1a7035?this[_0x162a("0x9b")]==_0x162a("0x9c")?this[_0x162a("0x9d")](_0x1a7035):this[_0x162a("0x9e")](_0x1a7035):(this[_0x162a("0x6a")]=this[_0x162a("0x4")][_0x162a("0x99")]("2d"),this.renderFunction=this[_0x162a("0x9f")]),this[_0x162a("0x7")]()},VideoRenderer[_0x162a("0x47")][_0x162a("0x9e")]=function(_0x4f5fef){if(this[_0x162a("0x55")]=_0x4f5fef[_0x162a("0x51")](),_0x4f5fef[_0x162a("0xa0")](_0x4f5fef[_0x162a("0xa1")],this.buffer),_0x4f5fef[_0x162a("0xa2")](_0x4f5fef[_0x162a("0xa1")],new Float32Array([0,0,0,1,1,0,1,1]),_0x4f5fef[_0x162a("0xa3")]),this[_0x162a("0xa4")]=_0x4f5fef.createProgram(),_0x4f5fef[_0x162a("0xa5")](this.program,this[_0x162a("0xa6")](_0x4f5fef.VERTEX_SHADER,this[_0x162a("0xa7")])),_0x4f5fef[_0x162a("0xa5")](this[_0x162a("0xa4")],this[_0x162a("0xa6")](_0x4f5fef[_0x162a("0xa8")],this[_0x162a("0xa9")])),_0x4f5fef[_0x162a("0xaa")](this[_0x162a("0xa4")]),!_0x4f5fef[_0x162a("0xab")](this.program,_0x4f5fef.LINK_STATUS))return wsLogger[_0x162a("0xa")](_0x162a("0xac")+_0x4f5fef[_0x162a("0xad")](this[_0x162a("0xa4")])),this.ctx2D=this[_0x162a("0x4")][_0x162a("0x99")]("2d"),void(this.renderFunction=this[_0x162a("0x9f")]);_0x4f5fef[_0x162a("0xae")](this[_0x162a("0xa4")]),this.YTexture=this.createTexture(0,_0x162a("0x7d")),this[_0x162a("0x7f")]=this[_0x162a("0xaf")](1,_0x162a("0x7f")),this[_0x162a("0x7e")]=this.createTexture(2,"CBTexture");var _0x441c07=_0x4f5fef[_0x162a("0xb0")](this[_0x162a("0xa4")],_0x162a("0xb1"));_0x4f5fef[_0x162a("0xb2")](_0x441c07),_0x4f5fef[_0x162a("0xb3")](_0x441c07,2,_0x4f5fef.FLOAT,!1,0,0),this[_0x162a("0x7b")]=this.renderFrameGLYUV},VideoRenderer[_0x162a("0x47")][_0x162a("0x9d")]=function(_0x45a8b0){if(this[_0x162a("0x55")]=_0x45a8b0[_0x162a("0x51")](),_0x45a8b0.bindBuffer(_0x45a8b0[_0x162a("0xa1")],this[_0x162a("0x55")]),_0x45a8b0[_0x162a("0xa2")](_0x45a8b0[_0x162a("0xa1")],new Float32Array([-1,-1,1,-1,1,1,1,1,-1,1,-1,-1]),_0x45a8b0[_0x162a("0xa3")]),this[_0x162a("0xa4")]=_0x45a8b0[_0x162a("0xb4")](),_0x45a8b0.attachShader(this[_0x162a("0xa4")],this[_0x162a("0xa6")](_0x45a8b0.VERTEX_SHADER,this[_0x162a("0x92")])),_0x45a8b0.attachShader(this[_0x162a("0xa4")],this.compileShader(_0x45a8b0[_0x162a("0xa8")],this.SHADER_FRAGMENT_RGBA)),_0x45a8b0[_0x162a("0xb5")](this[_0x162a("0xa4")],0,_0x162a("0xb1")),_0x45a8b0[_0x162a("0xaa")](this.program),!_0x45a8b0.getProgramParameter(this[_0x162a("0xa4")],_0x45a8b0.LINK_STATUS))return wsLogger.error(_0x162a("0xac")+_0x45a8b0[_0x162a("0xad")](this[_0x162a("0xa4")])),this[_0x162a("0x6a")]=this[_0x162a("0x4")][_0x162a("0x99")]("2d"),void(this[_0x162a("0x7b")]=this[_0x162a("0x9f")]);_0x45a8b0[_0x162a("0xae")](this[_0x162a("0xa4")]),_0x45a8b0[_0x162a("0xb2")](0),_0x45a8b0[_0x162a("0xb3")](0,2,_0x45a8b0[_0x162a("0xb6")],!1,0,0),this.RGBTexture=this[_0x162a("0xaf")](0,"RGBTexture"),this.renderFunction=this[_0x162a("0xb7")]},VideoRenderer[_0x162a("0x47")][_0x162a("0x7")]=function(){var _0xe37a89;if(this[_0x162a("0x71")]=this[_0x162a("0x4")].width,this[_0x162a("0x6b")]=this[_0x162a("0x4")][_0x162a("0x6b")],this[_0x162a("0x82")]=parseInt(this[_0x162a("0x71")])+15>>4,this[_0x162a("0x83")]=this.mbWidth<<4,this[_0x162a("0x84")]=this[_0x162a("0x82")]<<3,_0xe37a89=typeof Uint8ClampedArray!==_0x162a("0xb8")?Uint8ClampedArray:Uint8Array,this.ctx2D){this[_0x162a("0x81")]=new _0xe37a89(this.canvas.width*this.canvas.height*4);for(var _0x46edaf=0,_0x9090eb=this[_0x162a("0x81")][_0x162a("0x1d")];_0x46edaf<_0x9090eb;_0x46edaf++)this[_0x162a("0x81")][_0x46edaf]=255}else this.gl&&this.gl.viewport(0,0,this[_0x162a("0x71")],this.height)},VideoRenderer[_0x162a("0x47")][_0x162a("0x18")]=function(){if(this[_0x162a("0x6a")]){var _0x2083e7=this[_0x162a("0x6a")][_0x162a("0xb9")](this[_0x162a("0x71")],this[_0x162a("0x6b")]);this.ctx2D[_0x162a("0xba")](_0x2083e7,0,0)}else this.gl&&this.gl[_0x162a("0xbb")](this.gl[_0x162a("0xbc")]|this.gl[_0x162a("0xbd")])},VideoRenderer[_0x162a("0x47")][_0x162a("0xaf")]=function(_0x10fdad,_0x34889c){var _0x6b3e76=this.gl,_0x18fcea=_0x6b3e76[_0x162a("0xaf")]();return _0x6b3e76.bindTexture(_0x6b3e76[_0x162a("0xbe")],_0x18fcea),_0x6b3e76[_0x162a("0xbf")](_0x6b3e76[_0x162a("0xbe")],_0x6b3e76[_0x162a("0xc0")],_0x6b3e76[_0x162a("0xc1")]),_0x6b3e76.texParameteri(_0x6b3e76[_0x162a("0xbe")],_0x6b3e76[_0x162a("0xc2")],_0x6b3e76[_0x162a("0xc1")]),_0x6b3e76[_0x162a("0xbf")](_0x6b3e76[_0x162a("0xbe")],_0x6b3e76.TEXTURE_WRAP_S,_0x6b3e76[_0x162a("0xc3")]),_0x6b3e76[_0x162a("0xbf")](_0x6b3e76.TEXTURE_2D,_0x6b3e76[_0x162a("0xc4")],_0x6b3e76[_0x162a("0xc3")]),_0x6b3e76.uniform1i(_0x6b3e76[_0x162a("0xc5")](this.program,_0x34889c),_0x10fdad),_0x18fcea},VideoRenderer.prototype.compileShader=function(_0x41c03b,_0x5f4578){var _0x4f8efd=this.gl,_0x57e0eb=_0x4f8efd[_0x162a("0xc6")](_0x41c03b);if(_0x4f8efd.shaderSource(_0x57e0eb,_0x5f4578),_0x4f8efd[_0x162a("0xa6")](_0x57e0eb),!_0x4f8efd[_0x162a("0xc7")](_0x57e0eb,_0x4f8efd[_0x162a("0xc8")]))throw new Error(_0x4f8efd[_0x162a("0xc9")](_0x57e0eb));return _0x57e0eb},VideoRenderer[_0x162a("0x47")][_0x162a("0xca")]=function(){return!(null===this.gl&&void 0===this.gl||null!=this.ctx2D&&null!=this[_0x162a("0x6a")])},VideoRenderer[_0x162a("0x47")].renderFrameGLYUV=function(_0x24528e){var _0x5c538d=this.gl;_0x5c538d[_0x162a("0xcb")](_0x5c538d.TEXTURE0),_0x5c538d[_0x162a("0xcc")](_0x5c538d[_0x162a("0xbe")],this[_0x162a("0x7d")]),_0x5c538d[_0x162a("0xcd")](_0x5c538d[_0x162a("0xbe")],0,_0x5c538d[_0x162a("0xce")],this[_0x162a("0x83")],this[_0x162a("0x6b")],0,_0x5c538d[_0x162a("0xce")],_0x5c538d[_0x162a("0xcf")],_0x24528e.y),_0x5c538d[_0x162a("0xcb")](_0x5c538d[_0x162a("0xd0")]),_0x5c538d.bindTexture(_0x5c538d[_0x162a("0xbe")],this.CRTexture),_0x5c538d[_0x162a("0xcd")](_0x5c538d.TEXTURE_2D,0,_0x5c538d[_0x162a("0xce")],this[_0x162a("0x84")],this[_0x162a("0x6b")]/2,0,_0x5c538d[_0x162a("0xce")],_0x5c538d[_0x162a("0xcf")],_0x24528e.cr),_0x5c538d[_0x162a("0xcb")](_0x5c538d[_0x162a("0xd1")]),_0x5c538d[_0x162a("0xcc")](_0x5c538d.TEXTURE_2D,this[_0x162a("0x7e")]),_0x5c538d[_0x162a("0xcd")](_0x5c538d[_0x162a("0xbe")],0,_0x5c538d.LUMINANCE,this[_0x162a("0x84")],this.height/2,0,_0x5c538d[_0x162a("0xce")],_0x5c538d[_0x162a("0xcf")],_0x24528e.cb),_0x5c538d[_0x162a("0xd2")](_0x5c538d[_0x162a("0xd3")],0,4)},VideoRenderer.prototype[_0x162a("0xb7")]=function(_0x5982ea){var _0x36021f=this.gl;_0x36021f[_0x162a("0xcb")](_0x36021f[_0x162a("0xd4")]),_0x36021f.bindTexture(_0x36021f[_0x162a("0xbe")],this.RGBTexture),_0x36021f[_0x162a("0xcd")](_0x36021f.TEXTURE_2D,0,_0x36021f[_0x162a("0xd5")],_0x5982ea[_0x162a("0x71")],_0x5982ea.height,0,_0x36021f[_0x162a("0xd5")],_0x36021f.UNSIGNED_BYTE,_0x5982ea[_0x162a("0x14")]),_0x36021f[_0x162a("0xd2")](_0x36021f[_0x162a("0xd6")],0,6)},VideoRenderer[_0x162a("0x47")].renderFrame2D=function(_0x4d5a01){var _0x84c411=this[_0x162a("0x6a")][_0x162a("0xb9")](_0x4d5a01.width,_0x4d5a01[_0x162a("0x6b")]);_0x4d5a01[_0x162a("0xd7")]==_0x162a("0xc")?(this[_0x162a("0xd8")](_0x4d5a01),_0x84c411.data[_0x162a("0xd9")](this[_0x162a("0x81")])):_0x84c411[_0x162a("0x14")].set(_0x4d5a01[_0x162a("0x14")]),this[_0x162a("0x6a")][_0x162a("0xba")](_0x84c411,0,0)},VideoRenderer[_0x162a("0x47")].render=function(_0x467dad){if(!this[_0x162a("0x27")]){if(this[_0x162a("0x4")][_0x162a("0x71")]!=_0x467dad.width||this[_0x162a("0x4")][_0x162a("0x6b")]!=_0x467dad[_0x162a("0x6b")]){wsLogger[_0x162a("0x5f")](_0x162a("0xda")+this[_0x162a("0x4")][_0x162a("0x71")]+"x"+this[_0x162a("0x4")].height+_0x162a("0xdb")+_0x467dad[_0x162a("0x71")]+"x"+_0x467dad[_0x162a("0x6b")]),this[_0x162a("0x4")].width=_0x467dad[_0x162a("0x71")],this[_0x162a("0x4")][_0x162a("0x6b")]=_0x467dad[_0x162a("0x6b")];var _0x44e234=new Event("resize");this[_0x162a("0x4")][_0x162a("0x65")](_0x44e234),this[_0x162a("0x7")]()}this[_0x162a("0x7b")](_0x467dad)}this[_0x162a("0xdc")]=Date[_0x162a("0x2c")]()},VideoRenderer[_0x162a("0x47")].YCbCrToRGBA=function(_0x3a6afc){for(var _0x356f54,_0x42843a,_0x402f62,_0x1fe8a6,_0xb3c8fd,_0x2d188b=_0x3a6afc.y,_0x31895c=_0x3a6afc.cb,_0x1a9970=_0x3a6afc.cr,_0x410b7d=this[_0x162a("0x81")],_0x599197=0,_0x7186b7=this[_0x162a("0x83")],_0xfec764=this.codedWidth+(this[_0x162a("0x83")]-_0x3a6afc[_0x162a("0x71")]),_0x48cdb2=0,_0x5adcf1=this[_0x162a("0x84")]-(_0x3a6afc.width>>1),_0x1efcdf=0,_0x306a15=4*_0x3a6afc[_0x162a("0x71")],_0x5b89c9=4*_0x3a6afc[_0x162a("0x71")],_0x83a94e=_0x3a6afc[_0x162a("0x71")]>>1,_0x46e569=_0x3a6afc[_0x162a("0x6b")]>>1,_0x4574e3=0;_0x4574e3<_0x46e569;_0x4574e3++){for(var _0x33b5b4=0;_0x33b5b4<_0x83a94e;_0x33b5b4++){_0x356f54=_0x31895c[_0x48cdb2],_0x42843a=_0x1a9970[_0x48cdb2],_0x48cdb2++,_0x402f62=_0x42843a+(103*_0x42843a>>8)-179,_0x1fe8a6=(88*_0x356f54>>8)-44+(183*_0x42843a>>8)-91,_0xb3c8fd=_0x356f54+(198*_0x356f54>>8)-227;var _0xba7424=_0x2d188b[_0x599197++],_0x5ab42c=_0x2d188b[_0x599197++];_0x410b7d[_0x1efcdf]=_0xba7424+_0x402f62,_0x410b7d[_0x1efcdf+1]=_0xba7424-_0x1fe8a6,_0x410b7d[_0x1efcdf+2]=_0xba7424+_0xb3c8fd,_0x410b7d[_0x1efcdf+4]=_0x5ab42c+_0x402f62,_0x410b7d[_0x1efcdf+5]=_0x5ab42c-_0x1fe8a6,_0x410b7d[_0x1efcdf+6]=_0x5ab42c+_0xb3c8fd,_0x1efcdf+=8;var _0x2dbbbe=_0x2d188b[_0x7186b7++],_0x1e85ab=_0x2d188b[_0x7186b7++];_0x410b7d[_0x306a15]=_0x2dbbbe+_0x402f62,_0x410b7d[_0x306a15+1]=_0x2dbbbe-_0x1fe8a6,_0x410b7d[_0x306a15+2]=_0x2dbbbe+_0xb3c8fd,_0x410b7d[_0x306a15+4]=_0x1e85ab+_0x402f62,_0x410b7d[_0x306a15+5]=_0x1e85ab-_0x1fe8a6,_0x410b7d[_0x306a15+6]=_0x1e85ab+_0xb3c8fd,_0x306a15+=8}_0x599197+=_0xfec764,_0x7186b7+=_0xfec764,_0x1efcdf+=_0x5b89c9,_0x306a15+=_0x5b89c9,_0x48cdb2+=_0x5adcf1}},VideoRenderer.prototype[_0x162a("0xdd")]=function(){return this.lastTimeRendered},VideoRenderer[_0x162a("0x47")][_0x162a("0x58")]=function(_0x282d57){_0x282d57?this.muted=!0:this[_0x162a("0x27")]=!1},AudioPlayer[_0x162a("0x47")][_0x162a("0x40")]=function(){this[_0x162a("0xde")]||(this.audioJSNode[_0x162a("0x56")](this.gainNode),this[_0x162a("0xde")]=!0),this[_0x162a("0x58")](!1)},AudioPlayer[_0x162a("0x47")].stop=function(){this.audioJSNode[_0x162a("0xeb")](),this[_0x162a("0xde")]=!1,this[_0x162a("0xe7")]=void 0,this[_0x162a("0xe8")]=void 0,this[_0x162a("0x3e")]=[],this.mute(!0)},AudioPlayer[_0x162a("0x47")][_0x162a("0x7")]=function(){this[_0x162a("0x3e")]?this[_0x162a("0x3e")].length=0:this[_0x162a("0x3e")]=[]},AudioPlayer[_0x162a("0x47")][_0x162a("0xec")]=function(){this.initBuffers()},AudioPlayer[_0x162a("0x47")][_0x162a("0xed")]=function(_0x554ebf){this.audioBuffer[_0x162a("0x23")](_0x554ebf)},AudioPlayer[_0x162a("0x47")][_0x162a("0xee")]=function(){return this[_0x162a("0x3e")].length},AudioPlayer[_0x162a("0x47")][_0x162a("0x25")]=function(){if(this[_0x162a("0xe7")]&&this.lastSyncTime){var _0x21f724=1e3*this[_0x162a("0x31")][_0x162a("0xef")];return _0x21f724>=this[_0x162a("0xe8")]?_0x21f724-this[_0x162a("0xe8")]>this[_0x162a("0xf0")]?(wsLogger[_0x162a("0x7a")](_0x162a("0xf1")+(_0x21f724-this[_0x162a("0xf0")]-this[_0x162a("0xe8")])),this.lastSync+this[_0x162a("0xf0")]):_0x21f724-this[_0x162a("0xe8")]+this.lastSync:_0x21f724-this[_0x162a("0xf2")]+this[_0x162a("0xe6")]}return-1},AudioPlayer[_0x162a("0x47")][_0x162a("0x2d")]=function(){var _0x4d5368=1e3*this[_0x162a("0x31")][_0x162a("0xef")]-this[_0x162a("0xe8")],_0xd6ff56=this[_0x162a("0xf0")]-_0x4d5368;return _0xd6ff56>0?this.audioChunkTimeLength*this[_0x162a("0x3e")].length+_0xd6ff56:this[_0x162a("0xf0")]*this.audioBuffer[_0x162a("0x1d")]},AudioPlayer[_0x162a("0x47")].getLastTimePlayed=function(){return this[_0x162a("0xe8")]},AudioPlayer.prototype[_0x162a("0x58")]=function(_0x197c70){_0x197c70?(wsLogger[_0x162a("0x5f")](_0x162a("0xf3")),this.gainNode[_0x162a("0xf4")].value=0):(wsLogger.log(_0x162a("0xf5")),this[_0x162a("0xdf")][_0x162a("0xf4")][_0x162a("0xea")]=1)},AudioPlayer.prototype[_0x162a("0x41")]=function(_0x36b36f){this[_0x162a("0xdf")][_0x162a("0xf4")][_0x162a("0xea")]=_0x36b36f/100},AudioPlayer.prototype[_0x162a("0x5c")]=function(){return 100*this.gainNode[_0x162a("0xf4")][_0x162a("0xea")]};var WSPlayerState=function(){};WSPlayerState[_0x162a("0x3d")]=_0x162a("0x3d"),WSPlayerState[_0x162a("0x26")]="PLAYING",WSPlayerState[_0x162a("0x59")]="PAUSED",WSPlayerState.STARTUP="STARTUP",exports.WSPlayer=WSPlayer},{}],40:[function(require,module,exports){"use strict";const SESSION_STATUS=Object.freeze({CONNECTED:"CONNECTED",ESTABLISHED:"ESTABLISHED",DISCONNECTED:"DISCONNECTED",WARN:"WARN",FAILED:"FAILED",DEBUG:"DEBUG",APP_DATA:"APP_DATA",SEND_DATA_STATUS:"SEND_DATA_STATUS",PENDING:"PENDING",REGISTERED:"REGISTERED",UNREGISTERED:"UNREGISTERED",INCOMING_CALL:"INCOMING_CALL"}),STREAM_STATUS=Object.freeze({NEW:"NEW",PENDING:"PENDING",PUBLISHING:"PUBLISHING",PLAYING:"PLAYING",PAUSED:"PAUSED",UNPUBLISHED:"UNPUBLISHED",STOPPED:"STOPPED",FAILED:"FAILED",PLAYBACK_PROBLEM:"PLAYBACK_PROBLEM",RESIZE:"RESIZE",SNAPSHOT_COMPLETE:"SNAPSHOT_COMPLETE",NOT_ENOUGH_BANDWIDTH:"NOT_ENOUGH_BANDWIDTH"}),CALL_STATUS=Object.freeze({NEW:"NEW",RING:"RING",RING_MEDIA:"RING_MEDIA",HOLD:"HOLD",ESTABLISHED:"ESTABLISHED",FINISH:"FINISH",BUSY:"BUSY",SESSION_PROGRESS:"SESSION_PROGRESS",FAILED:"FAILED",PENDING:"PENDING",TRYING:"TRYING"}),STREAM_STATUS_INFO=Object.freeze({FAILED_BY_ICE_ERROR:"Failed by ICE error",FAILED_BY_ICE_TIMEOUT:"Failed by ICE timeout",FAILED_BY_KEEP_ALIVE:"Failed by ICE keep alive",FAILED_BY_DTLS_FINGERPRINT_ERROR:"Failed by DTLS fingerprint error",FAILED_BY_DTLS_ERROR:"Failed by DTLS error",FAILED_BY_HLS_WRITER_ERROR:"Failed by HLS writer error",FAILED_BY_RTMP_WRITER_ERROR:"Failed by RTMP writer error",FAILED_BY_RTP_ACTIVITY:"Failed by RTP activity",STOPPED_BY_SESSION_DISCONNECT:"Stopped by session disconnect",STOPPED_BY_REST_TERMINATE:"Stopped by rest /terminate",STOPPED_BY_PUBLISHER_STOP:"Stopped by publisher stop",STOPPED_BY_USER:"Stopped by user",FAILED_BY_ERROR:"Failed by error",FAILED_TO_ADD_STREAM_TO_PROXY:"Failed to add stream to proxy",DISTRIBUTOR_STOPPED:"Distributor stopped",PUBLISH_STREAM_IS_NOT_READY:"Publish stream is not ready",STREAM_NOT_FOUND:"Stream not found",STREAM_NAME_ALREADY_IN_USE:"Stream name is already in use",MEDIASESSION_ID_NULL:"MediaSessionId is null",MEDIASESSION_ID_ALREADY_IN_USE:"MediaSessionId is already in use",SESSION_NOT_READY:"Session not ready",SESSION_DOES_NOT_EXIST:"Session does not exist",RTSP_HAS_WRONG_FORMAT:"Rtsp has wrong format",FILE_HAS_WRONG_FORMAT:"File has wrong format",FAILED_TO_CONNECT_TO_RTSP_STREAM:"Failed to connect to rtsp stream",RTSP_STREAM_NOT_FOUND:"Rtsp stream not found",RTSPAGENT_SHUTDOWN:"RtspAgent shutdown",STREAM_FAILED:"Stream failed",NO_COMMON_CODECS:"No common codecs",BAD_URI:"Bad URI",GOT_EXCEPTION_WHILE_STREAMING_FILE:"Got exception while streaming file",REQUESTED_STREAM_SHUTDOWN:"Requested stream shutdown",FAILED_TO_READ_FILE:"Failed to read file",FILE_NOT_FOUND:"File not found",FAILED_TO_CONNECT_TO_ORIGIN_STREAM:"Failed to connect to origin stream",CDN_STREAM_NOT_FOUND:"CDN stream not found",FAILED_TO_GET_AGENT_STORAGE:"Failed to get agent storage",AGENT_SERVICING_ORIGIN_STREAM_IS_SHUTTING_DOWN:"Agent servicing origin stream is shutting down",TERMINATED_BY_KEEP_ALIVE:"Terminated by keep-alive",TRANSCODING_REQUIRED_BUT_DISABLED:"Transcoding required, but disabled",RESTRICTED_ACCESS:"Restricted access",NO_AVAILABLE_TRANSCODERS:"No available transcoders"}),CALL_STATUS_INFO=Object.freeze({NORMAL_CALL_CLEARING:"Normal call clearing",FAILED_BY_SESSION_CREATION:"Failed by session creation",FAILED_BY_ICE_ERROR:"Failed by ICE error",FAILED_BY_RTP_ACTIVITY:"Failed by RTP activity",FAILED_BY_RTMP_WRITER_ERROR:"Failed by RTMP writer error",FAILED_BY_DTLS_FINGERPRINT_ERROR:"Failed by DTLS fingerprint error",NO_COMMON_CODECS:"No common codecs",FAILED_BY_DTLS_ERROR:"Failed by DTLS error",FAILED_BY_ERROR:"Failed by error",FAILED_BY_REQUEST_TIMEOUT:"Failed by request timeout",TRANSCODING_REQUIRED_BUT_DISABLED:"Transcoding required, but disabled"}),ERROR_INFO=Object.freeze({NONE_OF_MEDIAPROVIDERS_AVAILABLE:"None of MediaProviders available",NONE_OF_PREFERRED_MEDIAPROVIDERS_AVAILABLE:"None of preferred MediaProviders available",FLASHPHONER_API_NOT_INITIALIZED:"Flashphoner API is not initialized",OPTIONS_URLSERVER_MUST_BE_PROVIDED:"options.urlServer must be provided",INVALID_SESSION_STATE:"Invalid session state",OPTIONS_MUST_BE_PROVIDED:"options must be provided",INVALID_CALL_STATE:"Invalid call state",EVENT_CANT_BE_NULL:"Event can't be null",CALLBACK_NEEDS_TO_BE_A_VALID_FUNCTION:"Callback needs to be a valid function",OPTIONS_NAME_MUST_BE_PROVIDED:"options.name must be provided",CAN_NOT_SWITCH_CAM:"Number of cams is less than 2 or camera is already used by other application",CAN_NOT_SWITCH_MIC:"Number of mics is less than 2 or microphone is already used by other application",LOCAL_ERROR:"Local error"}),MEDIA_DEVICE_KIND=Object.freeze({OUTPUT:"output",INPUT:"input",ALL:"all"}),TRANSPORT_TYPE=Object.freeze({UDP:"UDP",TCP:"TCP"}),CONNECTION_QUALITY=Object.freeze({PERFECT:"PERFECT",GOOD:"GOOD",BAD:"BAD",UNKNOWN:"UNKNOWN",UPDATE:"UPDATE"}),STREAM_EVENT_TYPE=Object.freeze({AUDIO_MUTED:"audioMuted",AUDIO_UNMUTED:"audioUnmuted",VIDEO_MUTED:"videoMuted",VIDEO_UNMUTED:"videoUnmuted",DATA:"data",SNAPSHOT_COMPLETED:"snapshotCompleted",SNAPSHOT_FAILED:"snapshotFailed",RESIZE:"resize",NOT_ENOUGH_BANDWIDTH:"notEnoughBandwidth"}),CONTENT_HINT_TYPE=Object.freeze({MOTION:"motion",DETAIL:"detail",TEXT:"text"});module.exports={SESSION_STATUS:SESSION_STATUS,STREAM_STATUS:STREAM_STATUS,CALL_STATUS:CALL_STATUS,STREAM_STATUS_INFO:STREAM_STATUS_INFO,CALL_STATUS_INFO:CALL_STATUS_INFO,ERROR_INFO:ERROR_INFO,MEDIA_DEVICE_KIND:MEDIA_DEVICE_KIND,TRANSPORT_TYPE:TRANSPORT_TYPE,CONNECTION_QUALITY:CONNECTION_QUALITY,STREAM_EVENT:"STREAM_EVENT",STREAM_EVENT_TYPE:STREAM_EVENT_TYPE,CONTENT_HINT_TYPE:CONTENT_HINT_TYPE}},{}],41:[function(require,module,exports){"use strict";var swfobject=require("swfobject"),Promise=require("promise-polyfill");const{v1:uuid_v1}=require("uuid");var flashScope,defaultConstraints,logger,connections={},swfLocation="media-provider.swf",DEFAULT_SDP="v=0\r\no=- 1988962254 1988962254 IN IP4 0.0.0.0\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\na=sdplang:en\r\nm=video 0 RTP/AVP 112\r\na=rtpmap:112 H264/90000\r\na=fmtp:112 packetization-mode=1; profile-level-id=420020\r\na=VIDEO_STATE\r\nm=audio 0 RTP/AVP 8 0 100 102 103 104 105 106 107 108 109 110\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:100 SPEEX/16000\r\na=rtpmap:102 mpeg4-generic/48000/1\r\na=rtpmap:103 mpeg4-generic/8000/1\r\na=rtpmap:104 mpeg4-generic/11025/1\r\na=rtpmap:105 mpeg4-generic/12000/1\r\na=rtpmap:106 mpeg4-generic/16000/1\r\na=rtpmap:107 mpeg4-generic/22050/1\r\na=rtpmap:108 mpeg4-generic/24000/1\r\na=rtpmap:109 mpeg4-generic/32000/1\r\na=rtpmap:110 mpeg4-generic/44100/1\r\na=AUDIO_STATE\r\n";function installCallback(id,name,value){!function(){if(null==flashScope){var globalApiObject=window.Flashphoner;if(null==globalApiObject)throw new Error("Can't install global scope, there is no window.Flashphoner variable.");globalApiObject.FlashApiScope={},flashScope=window.Flashphoner.FlashApiScope}}();var scopeId=getInstanceScopeId(id);null==flashScope[scopeId]&&(flashScope[scopeId]={}),flashScope[scopeId][name]=value}function removeCallback(id,name){delete flashScope[getInstanceScopeId(id)][name]}function clearCallbacks(id){delete flashScope[getInstanceScopeId(id)]}function getInstanceScopeId(flash){if("string"==typeof flash)return flash;for(var i=0;i<flash.children.length;i++)if("scopeId"==flash.children[i].name)return flash.children[i].value}var loadSwf=function(id,display,showFullScreenButton){return new Promise((function(resolve,reject){var swf,divWrapper=document.createElement("div");divWrapper.id=id,display.appendChild(divWrapper);var flashvars={id:id,showFullScreenButton:showFullScreenButton||"false"},params={menu:"true",swliveconnect:"true",allowFullScreen:"true",allowscriptaccess:"always",wmode:"opaque"};params.scopeId=id;var attributes={allowfullscreen:"true"};installCallback(id,"addLogMessage",(function(message){logger.info("flash","Flash["+id+"]:"+message)})),installCallback(id,"initialized",(function(){resolve(swf)})),installCallback(id,"videoResolution",(function(width,height){swf.videoWidth=width,swf.videoHeight=height,setTimeout((function(){var event=new CustomEvent("resize");swf.dispatchEvent(event)}),10),setTimeout((function(){var event=new CustomEvent("playing");swf.dispatchEvent(event)}),10)})),swfobject.embedSWF(swfLocation,id,"100%","100%","11.2.0","expressInstall.swf",flashvars,params,attributes,(function(ret){swf=ret.ref,ret.success||reject(new Error("Failed to load flash media provider swf with id "+id))}))}))};function getCacheInstance(display){var i;for(i=0;i<display.children.length;i++)if(display.children[i]&&-1!=display.children[i].id.indexOf("CACHED_FLASH_INSTANCE"))return logger.info("flash","FOUND FLASH CACHED INSTANCE, id "+display.children[i].id),display.children[i]}function normalizeConstraints(constraints){if(constraints&&"undefined"!=typeof constraints.video){if(constraints.video.hasOwnProperty("frameRate")&&"object"!==constraints.video.frameRate){var frameRate=constraints.video.frameRate;(0==frameRate||isNaN(frameRate))&&delete constraints.video.frameRate}if(!1===constraints.video)delete constraints.video;else if(!0===constraints.video)constraints.video={width:320,height:240};else{if(constraints.video.hasOwnProperty("width")){var width=constraints.video.width;(isNaN(width)||0==width)&&(logger.warn("flash","Width or height property has zero/NaN value, set default resolution 320x240"),constraints.video.width=320,constraints.video.height=240),"object"==typeof width&&(constraints.video.width=constraints.video.width.exact||constraints.video.width.max||constraints.video.width.min)}if(constraints.video.hasOwnProperty("height")){var height=constraints.video.height;(isNaN(height)||0==height)&&(logger.warn("flash","Width or height property has zero/NaN value, set default resolution 320x240"),constraints.video.width=320,constraints.video.height=240),"object"==typeof height&&(constraints.video.height=constraints.video.height.exact||constraints.video.height.max||constraints.video.height.min)}}}return constraints}!function(){function CustomEvent(event,params){params=params||{bubbles:!1,cancelable:!1,detail:void 0};var evt=document.createEvent("CustomEvent");return evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail),evt}CustomEvent.prototype=window.Event.prototype,window.CustomEvent=CustomEvent}();module.exports={createConnection:function(options){return new Promise((function(resolve,reject){var id=options.id,authToken=options.authToken,display=options.display||options.localDisplay,flashBufferTime=options.flashBufferTime||0;options.logger&&(logger=options.logger);var mainUrl,proto,port,a,url=(mainUrl=options.mainUrl,proto=options.flashProto,port=options.flashPort,(a=document.createElement("a")).href=mainUrl,proto+"://"+a.hostname+":"+port+"/"),flash=getCacheInstance(display);flash?(flash.reset(id),flash.id=id,installCallback(flash,"addLogMessage",(function(message){logger.info("flash","Flash["+id+"]:"+message)})),installCallback(flash,"connectionStatus",(function(status){removeCallback(flash,"connectionStatus"),"Success"===status?(connections[id]=exports,resolve(exports)):reject(new Error("Flash connection returned status "+status))})),flash.connect(url,authToken,options.login)):loadSwf(id,display,options.flashShowFullScreenButton||"false").then((function(swf){installCallback(swf,"connectionStatus",(function(status){removeCallback(swf,"connectionStatus"),"Success"===status?(connections[id]=exports,resolve(exports)):reject(new Error("Flash connection returned status "+status))})),(flash=swf).connect(url,authToken,options.login)})).catch(reject);var exports={state:function(){return"new"},createOffer:function(options){return new Promise((function(resolve,reject){var receiveAudio=null!=options.receiveAudio&&options.receiveAudio,receiveVideo=null!=options.receiveVideo&&options.receiveVideo,sendAudio=flash.isHasAudio(),sendVideo=flash.isHasVideo(),sdp=DEFAULT_SDP;sdp=receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendrecv"):receiveAudio&&!sendAudio?sdp.replace("AUDIO_STATE","recvonly"):!receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendonly"):sdp.replace("AUDIO_STATE","inactive"),sdp=receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendrecv"):receiveVideo&&!sendVideo?sdp.replace("VIDEO_STATE","recvonly"):!receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendonly"):sdp.replace("VIDEO_STATE","inactive");var o={};o.sdp=sdp,o.hasAudio=flash.isHasAudio(),o.hasVideo=flash.isHasVideo(),resolve(o)}))},createAnswer:function(options){return new Promise((function(resolve,reject){var receiveAudio=null==options.receiveAudio||options.receiveAudio,receiveVideo=null!=options.receiveVideo&&options.receiveVideo,sendAudio=flash.isHasAudio(),sendVideo=flash.isHasVideo(),sdp=DEFAULT_SDP;sdp=receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendrecv"):receiveAudio&&!sendAudio?sdp.replace("AUDIO_STATE","recvonly"):!receiveAudio&&sendAudio?sdp.replace("AUDIO_STATE","sendonly"):sdp.replace("AUDIO_STATE","inactive"),resolve(sdp=receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendrecv"):receiveVideo&&!sendVideo?sdp.replace("VIDEO_STATE","recvonly"):!receiveVideo&&sendVideo?sdp.replace("VIDEO_STATE","sendonly"):sdp.replace("VIDEO_STATE","inactive"))}))},setRemoteSdp:function(sdp,reinit,id){return logger.debug("flash","setRemoteSDP:"),logger.debug("flash",sdp),new Promise((function(resolve,reject){var state=function(sdp){var state={incoming:!1,outgoing:!1};-1!=sdp.indexOf("a=sendrecv")?(state.incoming=!0,state.outgoing=!0):-1!=sdp.indexOf("a=recvonly")?state.outgoing=!0:-1!=sdp.indexOf("a=sendonly")&&(state.incoming=!0);return state}(sdp);reinit&&flash.updateId(id),flash.setup(state.incoming,state.outgoing,flash.isHasAudio(),flash.isHasVideo(),flashBufferTime,reinit),resolve(connections[id])}))},changeAudioCodec:function(codec){flash.changeAudioCodec(codec)}};exports.close=function(cacheCamera){flash&&(flash.disconnect(),!getCacheInstance(display)&&flash.hasAccessToAudio()&&cacheCamera?function(flash){installCallback(flash,"addLogMessage",(function(message){logger.info("flash","Flash["+flash.id+"]:"+message)})),removeCallback(flash,"connectionStatus"),flash.reset(flash.id+"CACHED_FLASH_INSTANCE"),flash.id=flash.id+"CACHED_FLASH_INSTANCE"}(flash):(clearCallbacks(flash),swfobject.removeSWF(flash.id)),flash=null)},exports.setVolume=function(volume){flash&&flash.setVolume(volume)},exports.setMicrophoneGain=function(volume){},exports.getVolume=function(){return flash?flash.getVolume():-1},exports.muteAudio=function(){flash&&flash.muteAudio()},exports.unmuteAudio=function(){flash&&flash.unmuteAudio()},exports.isAudioMuted=function(){return!flash||flash.isAudioMuted()},exports.muteVideo=function(){flash&&flash.muteVideo()},exports.unmuteVideo=function(){flash&&flash.unmuteVideo()},exports.isVideoMuted=function(){return!flash||flash.isVideoMuted()},exports.getStats=function(callbackFn){if(flash){var param,statistics=flash.getStats();if(statistics.hasOwnProperty("incoming")){for(param in statistics.incoming.info)param.indexOf("audio")>-1&&(statistics.incoming.audio[param]=statistics.incoming.info[param]),param.indexOf("video")>-1&&(statistics.incoming.video[param]=statistics.incoming.info[param]);delete statistics.incoming.info}if(statistics.hasOwnProperty("outgoing")){for(param in statistics.outgoing.info)param.indexOf("audio")>-1&&(statistics.outgoing.audio[param]=statistics.outgoing.info[param]),param.indexOf("video")>-1&&(statistics.outgoing.video[param]=statistics.outgoing.info[param]);delete statistics.outgoing.info}statistics.type="flash",callbackFn(statistics)}},exports.fullScreen=function(){flash&&flash.fullScreen()},exports.switchCam=function(){},exports.switchMic=function(){},exports.switchToScreen=function(){},exports.switchToCam=function(){}}))},getMediaAccess:function(constraints,display){return new Promise((function(resolve,reject){var flash=getCacheInstance(display);if(flash)installCallback(flash,"accessGranted",(function(){removeCallback(flash,"accessGranted"),resolve(display)})),installCallback(flash,"accessDenied",(function(){removeCallback(flash,"accessDenied"),reject(new Error("Failed to get access to audio and video"))})),flash.getMediaAccess(normalizeConstraints(constraints))||reject(new Error("Failed to get access to audio and video"));else{var id=uuid_v1()+"CACHED_FLASH_INSTANCE";loadSwf(id,display).then((function(swf){installCallback(swf,"accessGranted",(function(){removeCallback(swf,"accessGranted"),resolve(display)})),installCallback(swf,"accessDenied",(function(){removeCallback(swf,"accessDenied"),reject(new Error("Failed to get access to audio and video"))})),constraints||(constraints=defaultConstraints),swf.getMediaAccess(normalizeConstraints(constraints))||reject(new Error("Failed to get access to audio and video"))}))}}))},releaseMedia:function(display){var flash=getCacheInstance(display);return!!flash&&(clearCallbacks(flash),swfobject.removeSWF(flash.id),!0)},available:function(){return swfobject.hasFlashPlayerVersion("11.2.0")},listDevices:function(){return new Promise((function(resolve,reject){var display=document.createElement("div");display.setAttribute("style","width:1px;height:1px");var id=uuid_v1();document.body.appendChild(display),loadSwf(id,display).then((function(swf){var list=swf.listDevices();swfobject.removeSWF(id),document.body.removeChild(display),resolve(list)}),reject)}))},playFirstSound:function(){return!0},playFirstVideo:function(){return new Promise((function(resolve,reject){resolve()}))},configure:function(configuration){swfLocation=configuration.flashMediaProviderSwfLocation,defaultConstraints=configuration.constraints,(logger=configuration.logger).info("flash","Initialized")}}},{"promise-polyfill":4,swfobject:7,uuid:9}],42:[function(require,module,exports){"use strict";const{v1:uuid_v1}=require("uuid");var coreLogger,disableConnectionQualityCalculation,constants=require("./constants"),util=require("./util"),LoggerObject=require("./util").logger,loggerConf={push:!1,severity:"INFO"},Promise=require("promise-polyfill"),KalmanFilter=require("kalmanjs"),browserDetails=require("webrtc-adapter").default.browserDetails,isUsingTemasysPlugin=!1,SESSION_STATUS=constants.SESSION_STATUS,STREAM_EVENT=constants.STREAM_EVENT,STREAM_EVENT_TYPE=constants.STREAM_EVENT_TYPE,STREAM_STATUS=constants.STREAM_STATUS,CALL_STATUS=constants.CALL_STATUS,CONNECTION_QUALITY=(constants.TRANSPORT_TYPE,constants.CONNECTION_QUALITY),ERROR_INFO=constants.ERROR_INFO,MediaProvider={},sessions={},initialized=!1,getMediaProviders=function(){return Object.keys(MediaProvider)},getDefaultMediaConstraints=function(){return"safari"==browserDetails.browser?{audio:!0,video:{width:{min:320,max:640},height:{min:180,max:360}}}:{audio:!0,video:{width:320,height:240}}};function getConstraintsProperty(constraints,property,defaultValue){if(!constraints||!property)return defaultValue;var res,properties=property.split(".");for(var prop in constraints)if(prop==properties[0])res=constraints[prop],properties.length>1&&(res=getConstraintsProperty(constraints[prop],properties[1],defaultValue));else if("object"==typeof constraints[prop])for(var p in constraints[prop])p==property&&(res=constraints[prop][p]);return"boolean"==typeof res?res:res||defaultValue}var releaseLocalMedia=function(display,mediaProvider){if(!initialized)throw new Error("Flashphoner API is not initialized");return mediaProvider||(mediaProvider=getMediaProviders()[0]),MediaProvider[mediaProvider].releaseMedia(display)},getLoggerConf=function(loggerOptions){var conf=loggerOptions||loggerConf;return null!==loggerOptions&&(conf.enableLogs=!0),conf},createLogger=function(loggerOptions,parentLogger=coreLogger){var newLogger=parentLogger;if(void 0===newLogger||null!=loggerOptions){var loggerConf=getLoggerConf(loggerOptions);(newLogger=new LoggerObject).init(loggerConf.severity||"INFO",loggerConf.push||!1,loggerConf.customLogger,loggerConf.enableLogs)}return newLogger};module.exports={init:function(options){if(!initialized){options||(options={}),coreLogger=createLogger(options.logger);var waitingTemasys=!1;try{var audioContext=new(window.AudioContext||window.webkitAudioContext)}catch(e){console.warn("Failed to create audio context")}disableConnectionQualityCalculation=options.disableConnectionQualityCalculation;var webRtcProvider=require("./webrtc-media-provider");if(webRtcProvider&&webRtcProvider.hasOwnProperty("available")&&webRtcProvider.available()){MediaProvider.WebRTC=webRtcProvider;var enableGainNode=!util.Browser.isSamsungBrowser()&&!util.Browser.isAndroidFirefox()&&options.createMicGainNode,webRtcConf={constraints:options.constraints||getDefaultMediaConstraints(),extensionId:options.screenSharingExtensionId,audioContext:audioContext,logger:coreLogger,createMicGainNode:enableGainNode};webRtcProvider.configure(webRtcConf)}else(webRtcProvider=require("./temasys-media-provider"))&&webRtcProvider.hasOwnProperty("available")&&AdapterJS&&(waitingTemasys=!0,AdapterJS.webRTCReady((function(isUsingPlugin){if(isUsingTemasysPlugin=isUsingPlugin,isUsingPlugin||webRtcProvider.available()){MediaProvider.WebRTC=webRtcProvider;var webRtcConf={constraints:options.constraints||getDefaultMediaConstraints(),extensionId:options.screenSharingExtensionId,logger:coreLogger};webRtcProvider.configure(webRtcConf);var _MediaProvider={};for(var p in _MediaProvider.WebRTC=MediaProvider.WebRTC,MediaProvider)_MediaProvider[p]=MediaProvider[p];MediaProvider=_MediaProvider}options.mediaProvidersReadyCallback&&options.mediaProvidersReadyCallback(Object.keys(MediaProvider))})));var flashProvider=require("./flash-media-provider");if(flashProvider&&flashProvider.hasOwnProperty("available")&&flashProvider.available()&&(!MediaProvider.WebRTC||options.preferredMediaProviders&&options.preferredMediaProviders.indexOf("Flash")>=0)){MediaProvider.Flash=flashProvider;var flashConf={constraints:options.constraints||getDefaultMediaConstraints(),flashMediaProviderSwfLocation:options.flashMediaProviderSwfLocation,logger:coreLogger};flashProvider.configure(flashConf)}var mediaSourceMediaProvider=require("./media-source-media-provider");if(mediaSourceMediaProvider&&mediaSourceMediaProvider.hasOwnProperty("available")&&mediaSourceMediaProvider.available()){MediaProvider.MSE=mediaSourceMediaProvider;var mseConf={audioContext:audioContext,browserDetails:browserDetails.browser};mediaSourceMediaProvider.configure(mseConf)}var websocketProvider=require("./websocket-media-provider");if(websocketProvider&&websocketProvider.hasOwnProperty("available")&&websocketProvider.available(audioContext)){MediaProvider.WSPlayer=websocketProvider;var wsConf={receiverLocation:options.receiverLocation,decoderLocation:options.decoderLocation,audioContext:audioContext,logger:coreLogger};websocketProvider.configure(wsConf)}if(0==getMediaProviders().length)throw new Error("None of MediaProviders available");if(options.preferredMediaProvider)if(MediaProvider.hasOwnProperty(options.preferredMediaProvider)){if(getMediaProviders()[0]!=options.preferredMediaProvider){var _MediaProvider={};for(var p in _MediaProvider[options.preferredMediaProvider]=MediaProvider[options.preferredMediaProvider],MediaProvider)_MediaProvider[p]=MediaProvider[p];MediaProvider=_MediaProvider}}else corelogger.warn("core","Preferred media provider is not available.");if(options.preferredMediaProviders&&options.preferredMediaProviders.length>0){var newMediaProvider={};for(var i in options.preferredMediaProviders)if(options.preferredMediaProviders.hasOwnProperty(i)){var pMP=options.preferredMediaProviders[i];MediaProvider.hasOwnProperty(pMP)&&(newMediaProvider[pMP]=MediaProvider[pMP])}if(util.isEmptyObject(newMediaProvider))throw new Error("None of preferred MediaProviders available");MediaProvider=newMediaProvider}!waitingTemasys&&options.mediaProvidersReadyCallback&&options.mediaProvidersReadyCallback(Object.keys(MediaProvider)),coreLogger.info("core","Initialized"),initialized=!0}},isUsingTemasys:function(){return isUsingTemasysPlugin},getMediaProviders:getMediaProviders,getMediaDevices:function(mediaProvider,labels,kind,deviceConstraints){if(!initialized)throw new Error("Flashphoner API is not initialized");return mediaProvider||(mediaProvider=getMediaProviders()[0]),MediaProvider[mediaProvider].listDevices(labels,kind,deviceConstraints)},getMediaAccess:function(constraints,display,mediaProvider,disableConstraintsNormalization){if(!initialized)throw new Error("Flashphoner API is not initialized");return mediaProvider||(mediaProvider=getMediaProviders()[0]),MediaProvider[mediaProvider].getMediaAccess(constraints,display,disableConstraintsNormalization)},releaseLocalMedia:releaseLocalMedia,getSessions:function(){return util.copyObjectToArray(sessions)},getSession:function(id){return sessions[id]},createSession:function(options){if(!initialized)throw new Error("Flashphoner API is not initialized");if(!options||!options.urlServer)throw new TypeError("options.urlServer must be provided");var connectionTimeout,cConfig,sipConfig,sessionLogger=createLogger(options.logger),logger=sessionLogger,id_=uuid_v1(),sessionStatus=SESSION_STATUS.PENDING,urlServer=options.urlServer,lbUrl=options.lbUrl,flashProto=options.flashProto||"rtmfp",flashPort=options.flashPort||1935,appKey=options.appKey||"defaultApp",mediaOptions=options.mediaOptions,keepAlive=options.keepAlive,timeout=options.timeout,wsPingSender=new function(interval){return this.interval=interval||0,this.intervalId=null,this.start=function(){this.interval>0&&(this.intervalId=setInterval((function(){send("ping",null)}),this.interval))},this.stop=function(){this.intervalId&&clearInterval(this.intervalId)},this}(options.pingInterval||0),wsPingReceiver=new function(receiveProbes,probesInterval){return this.maxPings=receiveProbes||0,this.interval=probesInterval||0,this.intervalId=null,this.pingsMissing=0,this.start=function(){if(this.maxPings>0&&this.interval>0){let receiver=this;this.intervalId=setInterval((function(){receiver.checkPingsReceived()}),this.interval)}},this.stop=function(){this.intervalId&&clearInterval(this.intervalId),this.pingsMissing=0},this.checkPingsReceived=function(){this.pingsMissing++,this.pingsMissing>=this.maxPings&&this.failure()},this.success=function(){this.pingsMissing=0},this.failure=function(){logger.info("core","Missing "+this.pingsMissing+" pings from server, connection seems to be down"),onSessionStatusChange(SESSION_STATUS.FAILED),wsConnection.close()},this}(options.receiveProbes||0,options.probesInterval||0);options.sipOptions&&(sipConfig={sipLogin:options.sipOptions.login,sipAuthenticationName:options.sipOptions.authenticationName,sipPassword:options.sipOptions.password,sipDomain:options.sipOptions.domain,sipOutboundProxy:options.sipOptions.outboundProxy,sipProxy:options.sipOptions.proxy,sipPort:options.sipOptions.port,sipRegisterRequired:options.sipOptions.registerRequired});var wsConnection,url,request,authToken=options.authToken,streams={},calls={},mediaConnections={},streamEventRefreshHandlers={},streamRefreshHandlers={},callRefreshHandlers={},session={},callbacks={};lbUrl?(url=lbUrl,(request=new XMLHttpRequest).open("GET",url,!0),request.timeout=5e3,request.ontimeout=function(){logger.warn("core","Timeout during geting url from balancer!"),createWS(urlServer)},request.error=function(){logger.warn("core","Error during geting url from balancer!"),createWS(urlServer)},request.onload=function(e){if(200==request.status&&4==request.readyState){var result=JSON.parse(request.responseText);urlServer=-1!==urlServer.indexOf("wss://")?"wss://"+result.server+":"+result.wss:"ws://"+result.server+":"+result.ws,flashPort=result.flash,logger.debug("core","Got url from load balancer "+result.server),createWS(urlServer)}},request.send()):createWS(urlServer);var remoteSdpCache={};function createWS(url){wsConnection=new WebSocket(url),null!=timeout&&timeout>0&&(connectionTimeout=setTimeout((function(){0==wsConnection.readyState&&(logger.warn("core","WS connection timeout"),wsConnection.close())}),timeout)),wsConnection.onerror=function(){onSessionStatusChange(SESSION_STATUS.FAILED)},wsConnection.onclose=function(){sessionStatus!==SESSION_STATUS.FAILED&&onSessionStatusChange(SESSION_STATUS.DISCONNECTED)},wsConnection.onopen=function(){onSessionStatusChange(SESSION_STATUS.CONNECTED),clearTimeout(connectionTimeout),cConfig={appKey:appKey,mediaProviders:Object.keys(MediaProvider),keepAlive:keepAlive,authToken:authToken,clientVersion:"2.0",clientOSVersion:window.navigator.appVersion,clientBrowserVersion:window.navigator.userAgent,msePacketizationVersion:2,custom:options.custom},sipConfig&&util.copyObjectPropsToAnotherObject(sipConfig,cConfig),send("connection",cConfig),logger.setConnection(wsConnection),wsPingSender.start(),wsPingReceiver.start()},wsConnection.onmessage=function(event){var data={};if(event.data instanceof Blob)data.message="binaryData";else var obj=(data=JSON.parse(event.data)).data[0];switch(data.message){case"ping":send("pong",null),wsPingReceiver.success();break;case"getUserData":authToken=obj.authToken,cConfig=obj,onSessionStatusChange(SESSION_STATUS.ESTABLISHED,obj);break;case"setRemoteSDP":var mediaSessionId=data.data[0],sdp=data.data[1];streamRefreshHandlers[mediaSessionId]?streamRefreshHandlers[mediaSessionId](null,sdp):callRefreshHandlers[mediaSessionId]?callRefreshHandlers[mediaSessionId](null,sdp):(remoteSdpCache[mediaSessionId]=sdp,logger.info("core","Media not found, id "+mediaSessionId));break;case"notifyVideoFormat":case"notifyStreamStatusEvent":streamRefreshHandlers[obj.mediaSessionId]&&streamRefreshHandlers[obj.mediaSessionId](obj);break;case"notifyStreamEvent":streamEventRefreshHandlers[obj.mediaSessionId]&&streamEventRefreshHandlers[obj.mediaSessionId](obj);break;case"DataStatusEvent":restAppCommunicator.resolveData(obj);break;case"OnDataEvent":callbacks[SESSION_STATUS.APP_DATA]&&callbacks[SESSION_STATUS.APP_DATA](obj);break;case"fail":obj.apiMethod&&"StreamStatusEvent"==obj.apiMethod&&streamRefreshHandlers[obj.id]&&streamRefreshHandlers[obj.id](obj),callbacks[SESSION_STATUS.WARN]&&callbacks[SESSION_STATUS.WARN](obj);break;case"registered":onSessionStatusChange(SESSION_STATUS.REGISTERED);break;case"notifyAudioCodec":mediaSessionId=data.data[0];var codec=data.data[1];callRefreshHandlers[mediaSessionId]&&callRefreshHandlers[mediaSessionId](null,null,codec);break;case"notifyTransferEvent":callRefreshHandlers[obj.callId](null,null,null,obj);break;case"notifyTryingResponse":case"hold":case"ring":case"talk":case"finish":callRefreshHandlers[obj.callId]&&callRefreshHandlers[obj.callId](obj);break;case"notifyIncomingCall":callRefreshHandlers[obj.callId]&&logger.error("core","Call already exists, id "+obj.callId),callbacks[SESSION_STATUS.INCOMING_CALL]&&callbacks[SESSION_STATUS.INCOMING_CALL](createCall(obj));break;case"notifySessionDebugEvent":logger.info("core","Session debug status "+obj.status),callbacks[SESSION_STATUS.DEBUG]&&callbacks[SESSION_STATUS.DEBUG](obj);break;case"availableStream":var availableStream={};availableStream.mediaSessionId=obj.id,availableStream.available=obj.status,availableStream.reason=obj.info,streamRefreshHandlers[availableStream.mediaSessionId]&&streamRefreshHandlers[availableStream.mediaSessionId](availableStream);break;case"outboundVideoRate":case"inboundVideoRate":streamRefreshHandlers[obj.mediaSessionId]&&(obj.status=data.message,streamRefreshHandlers[obj.mediaSessionId](obj))}}}function send(message,data){wsConnection.send(JSON.stringify({message:message,data:[data]}))}function onSessionStatusChange(newStatus,obj){if((sessionStatus=newStatus)==SESSION_STATUS.DISCONNECTED||sessionStatus==SESSION_STATUS.FAILED){for(var prop in wsPingSender.stop(),wsPingReceiver.stop(),streamRefreshHandlers)streamRefreshHandlers.hasOwnProperty(prop)&&"function"==typeof streamRefreshHandlers[prop]&&streamRefreshHandlers[prop]({status:STREAM_STATUS.FAILED});delete sessions[id_]}callbacks[sessionStatus]&&callbacks[sessionStatus](session,obj)}var createCall=function(options){if(sessionStatus!==SESSION_STATUS.REGISTERED&&sessionStatus!==SESSION_STATUS.ESTABLISHED)throw new Error("Invalid session state "+sessionStatus);if(!options)throw new TypeError("options must be provided");var mediaConnection,info_,errorInfo_,audioOutputId,callLogger=createLogger(options.logger,sessionLogger),logger=callLogger,login="clickToCallApp"==appKey?"":cConfig.sipLogin,caller_=options.incoming?options.caller:login,callee_=options.callee,visibleName_=options.visibleName||login,id_=options.callId||uuid_v1(),mediaProvider=options.mediaProvider||getMediaProviders()[0],localDisplay=options.localVideoDisplay,remoteDisplay=options.remoteVideoDisplay;if(options.constraints)var constraints=options.constraints;if(options.disableConstraintsNormalization)var disableConstraintsNormalization=options.disableConstraintsNormalization;var audioProperty=getConstraintsProperty(constraints,"audio",void 0);"object"==typeof audioProperty&&(audioOutputId=getConstraintsProperty(audioProperty,"outputId",0));var stripCodecs=options.stripCodecs||[],receiveAudio="undefined"==typeof options.receiveAudio||options.receiveAudio,receiveVideo="undefined"==typeof options.receiveVideo||options.receiveVideo,cacheLocalResources=options.cacheLocalResources,status_=CALL_STATUS.NEW,callbacks={},hasTransferredCall=!1,sdpHook=options.sdpHook,sipSDP=options.sipSDP,videoContentHint=(options.sipHeaders,options.videoContentHint),call={};callRefreshHandlers[id_]=function(callInfo,sdp,codec,transfer){if(transfer)return mediaConnections[id_]||(mediaConnections[id_]=mediaConnection),void("COMPLETED"==transfer.status&&delete mediaConnections[id_]);if(!mediaConnection&&0!=Object.keys(mediaConnections).length)for(var mc in mediaConnections)mediaConnection=mediaConnections[mc],hasTransferredCall=!0,delete mediaConnections[mc];if(codec)"Flash"==mediaProvider&&mediaConnection.changeAudioCodec(codec.name);else{if(sdp&&""!==sdp)return sdp=sdpHookHandler(sdp,sdpHook),void mediaConnection.setRemoteSdp(sdp,hasTransferredCall,id_).then((function(){}));var event=callInfo.status;status_=event,event!=CALL_STATUS.FAILED&&event!=CALL_STATUS.FINISH&&event!=CALL_STATUS.BUSY||(delete calls[id_],delete callRefreshHandlers[id_],0==Object.keys(calls).length&&mediaConnection&&mediaConnection.close(cacheLocalResources)),callbacks[event]&&callbacks[event](call)}};var hangup=function(){if(status_!=CALL_STATUS.NEW){if(status_==CALL_STATUS.PENDING)return cacheLocalResources||releaseLocalMedia(localDisplay,mediaProvider),callRefreshHandlers[id_]({status:CALL_STATUS.FAILED}),void(options.incoming&&send("hangup",{callId:id_}));send("hangup",{callId:id_}),mediaConnection&&mediaConnection.close(cacheLocalResources)}else callRefreshHandlers[id_]({status:CALL_STATUS.FAILED})};return call.call=function(){if(status_!==CALL_STATUS.NEW)throw new Error("Invalid call state");status_=CALL_STATUS.PENDING;MediaProvider[mediaProvider].getMediaAccess(constraints,localDisplay,disableConstraintsNormalization).then((function(){status_!=CALL_STATUS.FAILED?MediaProvider[mediaProvider].createConnection({id:id_,localDisplay:localDisplay,remoteDisplay:remoteDisplay,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,bidirectional:!0,login:login,constraints:constraints,connectionConfig:mediaOptions,audioOutputId:audioOutputId,videoContentHint:videoContentHint,logger:logger}).then((function(newConnection){return(mediaConnection=newConnection).createOffer({sendAudio:!0,sendVideo:!0,receiveAudio:receiveAudio,receiveVideo:receiveVideo,stripCodecs:stripCodecs})})).then((function(offer){send("call",{callId:id_,incoming:!1,hasVideo:offer.hasVideo,hasAudio:offer.hasAudio,status:status_,mediaProvider:mediaProvider,sdp:offer.sdp,sipSDP:sipSDP,caller:login,callee:callee_,custom:options.custom,visibleName:visibleName_})})):cacheLocalResources||releaseLocalMedia(localDisplay,mediaProvider)})).catch((function(error){logger.error("core",error),status_=CALL_STATUS.FAILED,info_=ERROR_INFO.LOCAL_ERROR,errorInfo_=error.message,callRefreshHandlers[id_]({status:CALL_STATUS.FAILED}),hangup()}))},call.answer=function(answerOptions){if(status_!==CALL_STATUS.NEW&&status_!==CALL_STATUS.RING)throw new Error("Invalid call state");var sdp;localDisplay=answerOptions.localVideoDisplay,remoteDisplay=answerOptions.remoteVideoDisplay,constraints=answerOptions.constraints||getDefaultMediaConstraints(),status_=CALL_STATUS.PENDING;var sdpHook=answerOptions.sdpHook;if(sipSDP=answerOptions.sipSDP,answerOptions.sipHeaders,!remoteSdpCache[id_])throw logger.error("core","No remote sdp available"),new Error("No remote sdp available");sdp=sdpHookHandler(remoteSdpCache[id_],sdpHook),delete remoteSdpCache[id_],0==util.SDP.matchPrefix(sdp,"m=video").length&&(constraints.video=!1);var stripCodecs=answerOptions.stripCodecs||[];MediaProvider[mediaProvider].getMediaAccess(constraints,localDisplay,disableConstraintsNormalization).then((function(){status_!=CALL_STATUS.FAILED?MediaProvider[mediaProvider].createConnection({id:id_,localDisplay:localDisplay,remoteDisplay:remoteDisplay,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,bidirectional:!0,login:cConfig.sipLogin,constraints:constraints,connectionConfig:mediaOptions,audioOutputId:audioOutputId}).then((function(newConnection){return(mediaConnection=newConnection).setRemoteSdp(sdp)})).then((function(){return mediaConnection.createAnswer({receiveAudio:options.receiveAudio,receiveVideo:options.receiveVideo,stripCodecs:stripCodecs})})).then((function(sdp){status_!=CALL_STATUS.FINISH&&status_!=CALL_STATUS.FAILED?send("answer",{callId:id_,incoming:!0,hasVideo:!0,hasAudio:!0,status:status_,mediaProvider:mediaProvider,sdp:sdp,sipSDP:sipSDP,caller:cConfig.login,callee:callee_,custom:options.custom}):hangup()})):cacheLocalResources||releaseLocalMedia(localDisplay,mediaProvider)})).catch((function(error){logger.error("core",error),info_=ERROR_INFO.LOCAL_ERROR,errorInfo_=error.message,status_=CALL_STATUS.FAILED,callRefreshHandlers[id_]({status:CALL_STATUS.FAILED})}))},call.hangup=hangup,call.id=function(){return id_},call.getInfo=function(){return info_},call.getErrorInfo=function(){return errorInfo_},call.status=function(){return status_},call.getStats=function(callbackFn,nativeStats){mediaConnection&&mediaConnection.getStats(callbackFn,nativeStats)},call.setAudioOutputId=function(id){if(audioOutputId=id,mediaConnection&&mediaConnection.setAudioOutputId)return mediaConnection.setAudioOutputId(id)},call.setVolume=function(volume){mediaConnection&&mediaConnection.setVolume(volume)},call.getVolume=function(){return mediaConnection?mediaConnection.getVolume():-1},call.muteAudio=function(){mediaConnection&&mediaConnection.muteAudio()},call.unmuteAudio=function(){mediaConnection&&mediaConnection.unmuteAudio()},call.isAudioMuted=function(){return!mediaConnection||mediaConnection.isAudioMuted()},call.muteVideo=function(){mediaConnection&&mediaConnection.muteVideo()},call.unmuteVideo=function(){mediaConnection&&mediaConnection.unmuteVideo()},call.isVideoMuted=function(){return!mediaConnection||mediaConnection.isVideoMuted()},call.caller=function(){return caller_},call.callee=function(){return callee_},call.visibleName=function(){return visibleName_},call.hold=function(){send("hold",{callId:id_})},call.holdForTransfer=function(){send("hold",{callId:id_,holdForTransfer:!0})},call.unhold=function(){send("unhold",{callId:id_})},call.sendDTMF=function(number,type){send("sendDtmf",{callId:id_,type:type||"RFC2833",dtmf:number})},call.transfer=function(target){send("transfer",{callId:id_,target:target})},call.on=function(event,callback){if(!event)throw new TypeError("Event can't be null");if(!callback||"function"!=typeof callback)throw new Error("Callback needs to be a valid function");return callbacks[event]=callback,call},call.switchCam=function(deviceId){if(status_!==CALL_STATUS.ESTABLISHED&&!constraints.video&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");return mediaConnection.switchCam(deviceId)},call.switchMic=function(deviceId){if(status_!==CALL_STATUS.ESTABLISHED&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");return mediaConnection.switchMic(deviceId)},call.switchToScreen=function(source,woExtension){if(status_!==CALL_STATUS.ESTABLISHED&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");return mediaConnection.switchToScreen(source,woExtension)},call.switchToCam=function(){if(status_!==CALL_STATUS.ESTABLISHED&&status_!==CALL_STATUS.HOLD)throw new Error("Invalid call state");mediaConnection.switchToCam()},call.getLogger=function(){return callLogger},calls[id_]=call,call},restAppCommunicator=function(){var pending={},exports={sendData:function(data){return new Promise((function(resolve,reject){var obj={operationId:uuid_v1(),payload:data};pending[obj.operationId]={FAILED:function(info){reject(info)},ACCEPTED:function(info){resolve(info)}},send("sendData",obj)}))},resolveData:function(data){if(pending[data.operationId]){var handler=pending[data.operationId];delete pending[data.operationId],delete data.operationId,handler[data.status](data)}}};return exports}(),sdpHookHandler=function(sdp,sdpHook){if(null!=sdpHook&&"function"==typeof sdpHook){var newSdp=sdpHook({sdpString:sdp});return null!=newSdp&&""!=newSdp?newSdp:sdp}return sdp};return session.id=function(){return id_},session.status=function(){return sessionStatus},session.getServerUrl=function(){return urlServer},session.createStream=function(options){var availableCallbacks=[];if(sessionStatus!==SESSION_STATUS.ESTABLISHED)throw new Error("Invalid session state "+sessionStatus);if(!options)throw new TypeError("options must be provided");if(!options.name)throw new TypeError("options.name must be provided");var mediaConnection,streamLogger=createLogger(options.logger,sessionLogger),logger=streamLogger,clientKf=new KalmanFilter,serverKf=new KalmanFilter,id_=uuid_v1(),name_=options.name,mediaProvider=options.mediaProvider||getMediaProviders()[0],display=options.display;if(options.constraints&&0!=Object.keys(options.constraints).length)var constraints=options.constraints;if(options.disableConstraintsNormalization)var disableConstraintsNormalization=options.disableConstraintsNormalization;var receiveAudio,audioOutputId,receiveVideo,mediaConnectionConstraints=options.mediaConnectionConstraints,audioProperty=getConstraintsProperty(constraints,"audio",void 0);if("boolean"==typeof audioProperty)receiveAudio=audioProperty;else if("object"==typeof audioProperty){receiveAudio=!0;var _stereo=getConstraintsProperty(audioProperty,"stereo",0),_bitrate=getConstraintsProperty(audioProperty,"bitrate",0),_fec=getConstraintsProperty(audioProperty,"fec",0);audioOutputId=getConstraintsProperty(audioProperty,"outputId",0);var _codecOptions="";_bitrate&&(_codecOptions+="maxaveragebitrate="+_bitrate+";"),_stereo&&(_codecOptions+="stereo=1;sprop-stereo=1;"),_fec&&(_codecOptions+="useinbandfec=1;")}else receiveAudio="undefined"==typeof options.receiveAudio||options.receiveAudio;var videoProperty=getConstraintsProperty(constraints,"video",void 0);receiveVideo="boolean"==typeof videoProperty?videoProperty:"object"==typeof videoProperty||("undefined"==typeof options.receiveVideo||options.receiveVideo);var bitrate=getConstraintsProperty(constraints,"video.bitrate",0),minBitrate=getConstraintsProperty(constraints,"video.minBitrate",0),maxBitrate=getConstraintsProperty(constraints,"video.maxBitrate",0),quality=getConstraintsProperty(constraints,"video.quality",0);quality>100&&(quality=100);var info_,errorInfo_,audioState_,videoState_,connectionQuality,playWidth="undefined"!=typeof options.playWidth?options.playWidth:getConstraintsProperty(constraints,"video.width",0),playHeight="undefined"!=typeof options.playHeight?options.playHeight:getConstraintsProperty(constraints,"video.height",0),stripCodecs=options.stripCodecs||[],resolution={},published_=!1,record_=options.record||!1,recordFileName=null,cacheLocalResources=options.cacheLocalResources,status_=STREAM_STATUS.NEW,rtmpUrl=options.rtmpUrl,remoteBitrate=-1,networkBandwidth=-1,sdpHook=options.sdpHook,transportType=options.transport,cvoExtension=options.cvoExtension,remoteVideo=options.remoteVideo,callbacks={},playoutDelay=options.playoutDelay,useCanvasMediaStream=options.useCanvasMediaStream,videoContentHint=options.videoContentHint,unmutePlayOnStart=options.unmutePlayOnStart,videoBytes=0,stream={};streamEventRefreshHandlers[id_]=function(streamEvent){if(streamEvent.type==STREAM_EVENT_TYPE.NOT_ENOUGH_BANDWIDTH){var info=streamEvent.payload.info.split("/");remoteBitrate=info[0],networkBandwidth=info[1]}else streamEvent.type==STREAM_EVENT_TYPE.RESIZE&&(resolution.width=streamEvent.payload.streamerVideoWidth,resolution.height=streamEvent.payload.streamerVideoHeight);callbacks[STREAM_EVENT]&&callbacks[STREAM_EVENT](streamEvent)},streamRefreshHandlers[id_]=function(streamInfo,sdp){if(sdp&&""!==sdp){var _sdp=sdp;return _codecOptions&&(_sdp=util.SDP.writeFmtp(sdp,_codecOptions,"opus")),_sdp=sdpHookHandler(_sdp,sdpHook),void mediaConnection.setRemoteSdp(_sdp).then((function(){}))}if(null==streamInfo.available){var event=streamInfo.status;if("inboundVideoRate"!=event&&"outboundVideoRate"!=event){if(event==STREAM_STATUS.RESIZE)resolution.width=streamInfo.streamerVideoWidth,resolution.height=streamInfo.streamerVideoHeight;else if(event==STREAM_STATUS.SNAPSHOT_COMPLETE);else if(event==STREAM_STATUS.NOT_ENOUGH_BANDWIDTH){var info=streamInfo.info.split("/");remoteBitrate=info[0],networkBandwidth=info[1]}else status_=event;audioState_=streamInfo.audioState,videoState_=streamInfo.videoState,streamInfo.info&&(info_=streamInfo.info),event!=STREAM_STATUS.FAILED&&event!=STREAM_STATUS.STOPPED&&event!=STREAM_STATUS.UNPUBLISHED||(delete streams[id_],delete streamRefreshHandlers[id_],delete streamEventRefreshHandlers[id_],mediaConnection&&mediaConnection.close(cacheLocalResources)),record_&&"undefined"!=typeof streamInfo.recordName&&(recordFileName=streamInfo.recordName),callbacks[event]&&callbacks[event](stream)}else detectConnectionQuality(event,streamInfo)}else{for(var i=0;i<availableCallbacks.length;i++)info_=streamInfo.reason,"true"==streamInfo.available?availableCallbacks[i].resolve(stream):availableCallbacks[i].reject(stream);availableCallbacks=[]}};var detectConnectionQuality=function(event,streamInfo){disableConnectionQualityCalculation||mediaConnection.getStats((function(stats){var bytesSentReceived=0;if(stats)if("outboundVideoRate"==event&&stats.inboundStream&&stats.inboundStream.video&&stats.inboundStream.video.bytesReceived>0)bytesSentReceived=stats.inboundStream.video.bytesReceived;else{if(!(stats.outboundStream&&stats.outboundStream.video&&stats.outboundStream.video.bytesSent>0))return;bytesSentReceived=stats.outboundStream.video.bytesSent}if(videoBytes){var currentVideoRate=8*(bytesSentReceived-videoBytes);if(0!=currentVideoRate){var currentQuality,clientFiltered=clientKf.filter(currentVideoRate),serverFiltered=serverKf.filter(streamInfo.videoRate),videoRateDifference=100*Math.abs((serverFiltered-clientFiltered)/((serverFiltered+clientFiltered)/2));currentQuality=serverFiltered<5e4||clientFiltered<5e4?videoRateDifference>150?CONNECTION_QUALITY.BAD:CONNECTION_QUALITY.PERFECT:videoRateDifference>50?CONNECTION_QUALITY.BAD:videoRateDifference>20?CONNECTION_QUALITY.GOOD:CONNECTION_QUALITY.PERFECT,callbacks[CONNECTION_QUALITY.UPDATE]&&(connectionQuality=currentQuality,callbacks[CONNECTION_QUALITY.UPDATE](connectionQuality,clientFiltered,serverFiltered)),videoBytes=bytesSentReceived}}else videoBytes=bytesSentReceived}))},stop=function(){if(logger.debug("core","Stop stream "+name_),status_!=STREAM_STATUS.NEW)return status_==STREAM_STATUS.PENDING?(logger.warn("core","Stopping stream before server response "+id_),void setTimeout(stop,200)):void(status_!=STREAM_STATUS.FAILED?(send(published_?"unPublishStream":"stopStream",{mediaSessionId:id_,name:name_,published:published_,hasVideo:!0,hasAudio:!0,status:status_,record:!1}),mediaConnection&&mediaConnection.close(cacheLocalResources)):logger.warn("core","Stream status FAILED"));streamRefreshHandlers[id_]({status:STREAM_STATUS.FAILED})},published=function(){return published_};function sendStreamEvent(type,payload){send("sendStreamEvent",{mediaSessionId:id_,type:type,payload:payload})}return stream.play=function(){if(logger.debug("core","Play stream "+name_),status_!==STREAM_STATUS.NEW)throw new Error("Invalid stream state "+status_);status_=STREAM_STATUS.PENDING,MediaProvider[mediaProvider].createConnection({id:id_,display:display,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,flashBufferTime:options.flashBufferTime||0,flashShowFullScreenButton:options.flashShowFullScreenButton||!1,connectionConfig:mediaOptions,connectionConstraints:mediaConnectionConstraints,audioOutputId:audioOutputId,remoteVideo:remoteVideo,playoutDelay:playoutDelay,unmutePlayOnStart:unmutePlayOnStart,logger:logger},streamRefreshHandlers[id_]).then((function(newConnection){mediaConnection=newConnection;try{streamRefreshHandlers[id_]({status:status_})}catch(e){console.warn(e)}return mediaConnection.createOffer({receiveAudio:receiveAudio,receiveVideo:receiveVideo,stripCodecs:stripCodecs,stereo:_stereo})})).then((function(offer){logger.debug("core","Offer SDP:\n"+offer.sdp),send("playStream",{mediaSessionId:id_,name:name_,published:published_,hasVideo:!0,hasAudio:!0,status:status_,record:!1,width:playWidth,height:playHeight,mediaProvider:mediaProvider,sdp:offer.sdp,custom:options.custom,bitrate:bitrate,minBitrate:minBitrate,maxBitrate:maxBitrate,quality:quality,constraints:constraints,transport:transportType,cvoExtension:cvoExtension}),offer.player&&offer.player.play(id_)})).catch((function(error){throw error}))},stream.publish=function(){if(logger.debug("core","Publish stream "+name_),status_!==STREAM_STATUS.NEW)throw new Error("Invalid stream state "+status_);status_=STREAM_STATUS.PENDING,published_=!0;constraints&&constraints.video&&constraints.video.type&&constraints.video.type,MediaProvider[mediaProvider].getMediaAccess(constraints,display,disableConstraintsNormalization,useCanvasMediaStream).then((function(){status_!=STREAM_STATUS.FAILED?MediaProvider[mediaProvider].createConnection({id:id_,display:display,authToken:authToken,mainUrl:urlServer,flashProto:flashProto,flashPort:flashPort,constraints:constraints,connectionConfig:mediaOptions,connectionConstraints:mediaConnectionConstraints,customStream:!(!constraints||!constraints.customStream)&&constraints.customStream,videoContentHint:videoContentHint,logger:logger}).then((function(newConnection){return(mediaConnection=newConnection).createOffer({stripCodecs:stripCodecs})})).then((function(offer){logger.debug("core","Offer SDP:\n"+offer.sdp),send("publishStream",{mediaSessionId:id_,name:name_,published:published_,hasVideo:offer.hasVideo,hasAudio:offer.hasAudio,status:status_,record:record_,mediaProvider:mediaProvider,sdp:offer.sdp,custom:options.custom,bitrate:bitrate,minBitrate:minBitrate,maxBitrate:maxBitrate,rtmpUrl:rtmpUrl,constraints:constraints,transport:transportType,cvoExtension:cvoExtension})})):cacheLocalResources||releaseLocalMedia(display,mediaProvider)})).catch((function(error){logger.warn("core",error),info_=ERROR_INFO.LOCAL_ERROR,errorInfo_=error.message,status_=STREAM_STATUS.FAILED,callbacks[status_]&&callbacks[status_](stream)}))},stream.stop=stop,stream.id=function(){return id_},stream.status=function(){return status_},stream.name=function(){return name_},stream.published=published,stream.getRecordInfo=function(){return recordFileName},stream.getInfo=function(){return info_},stream.getErrorInfo=function(){return errorInfo_},stream.videoResolution=function(){if(published_)throw new Error("This function available only on playing stream");return resolution},stream.setAudioOutputId=function(id){if(audioOutputId=id,mediaConnection&&mediaConnection.setAudioOutputId)return mediaConnection.setAudioOutputId(id)},stream.setVolume=function(volume){mediaConnection&&mediaConnection.setVolume(volume)},stream.unmuteRemoteAudio=function(){mediaConnection&&"Flash"!=mediaProvider&&mediaConnection.unmuteRemoteAudio()},stream.muteRemoteAudio=function(){mediaConnection&&"Flash"!=mediaProvider&&mediaConnection.muteRemoteAudio()},stream.isRemoteAudioMuted=function(){return!(!mediaConnection||"Flash"==mediaProvider)&&mediaConnection.isRemoteAudioMuted()},stream.setMicrophoneGain=function(volume){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");mediaConnection.setMicrophoneGain(volume)},stream.getVolume=function(){return mediaConnection?mediaConnection.getVolume():-1},stream.muteAudio=function(){mediaConnection&&(mediaConnection.muteAudio(),sendStreamEvent(STREAM_EVENT_TYPE.AUDIO_MUTED))},stream.unmuteAudio=function(){mediaConnection&&(mediaConnection.unmuteAudio(),sendStreamEvent(STREAM_EVENT_TYPE.AUDIO_UNMUTED))},stream.isAudioMuted=function(){return!mediaConnection||mediaConnection.isAudioMuted()},stream.muteVideo=function(){mediaConnection&&(mediaConnection.muteVideo(),sendStreamEvent(STREAM_EVENT_TYPE.VIDEO_MUTED))},stream.unmuteVideo=function(){mediaConnection&&(mediaConnection.unmuteVideo(),sendStreamEvent(STREAM_EVENT_TYPE.VIDEO_UNMUTED))},stream.isVideoMuted=function(){return!mediaConnection||mediaConnection.isVideoMuted()},stream.getStats=function(callbackFn,nativeStats){mediaConnection&&mediaConnection.getStats(callbackFn,nativeStats)},stream.snapshot=function(){if(logger.debug("core","Request snapshot, stream "+name_),status_!==STREAM_STATUS.NEW&&status_!==STREAM_STATUS.PLAYING&&status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");send("snapshot",{name:name_,mediaSessionId:id_})},stream.getAudioState=function(){return audioState_},stream.getVideoState=function(){return videoState_},stream.getNetworkBandwidth=function(){return networkBandwidth},stream.getRemoteBitrate=function(){return remoteBitrate},stream.fullScreen=function(){published()?logger.warn("core","Full screen is allowed only for played streams"):mediaConnection&&mediaConnection.fullScreen()},stream.on=function(event,callback){if(!event)throw new TypeError("Event can't be null");if(!callback||"function"!=typeof callback)throw new Error("Callback needs to be a valid function");return callbacks[event]=callback,stream},stream.available=function(){return new Promise((function(resolve,reject){send("availableStream",{mediaSessionId:id_,name:name_});var promise={};promise.resolve=resolve,promise.reject=reject,availableCallbacks.push(promise)}))},stream.switchCam=function(deviceId){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");return mediaConnection.switchCam(deviceId)},stream.switchMic=function(deviceId){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");return mediaConnection.switchMic(deviceId)},stream.switchToScreen=function(source,woExtension){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");return mediaConnection.switchToScreen(source,woExtension)},stream.switchToCam=function(){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");mediaConnection.switchToCam()},stream.sendData=function(payload){if(status_!==STREAM_STATUS.PUBLISHING)throw new Error("Invalid stream state");sendStreamEvent(STREAM_EVENT_TYPE.DATA,payload)},stream.getLogger=function(){return streamLogger},streams[id_]=stream,stream},session.createCall=createCall,session.getStream=function(streamId){return streams[streamId]},session.getStreams=function(){return util.copyObjectToArray(streams)},session.sendData=restAppCommunicator.sendData,session.disconnect=function(){wsConnection&&wsConnection.close()},session.submitBugReport=function(reportObject){send("submitBugReport",reportObject)},session.startDebug=function(){logger.setPushLogs(!0),logger.setLevel("DEBUG"),send("sessionDebug",{command:"start"})},session.stopDebug=function(){logger.setLevel("INFO"),send("sessionDebug",{command:"stop"})},session.on=function(event,callback){if(!event)throw new Error("Event can't be null","TypeError");if(!callback||"function"!=typeof callback)throw new Error("Callback needs to be a valid function");return callbacks[event]=callback,session},session.getLogger=function(){return sessionLogger},sessions[id_]=session,session},playFirstSound:function(noise){var mediaProvider=getMediaProviders()[0];MediaProvider[mediaProvider].playFirstSound(noise)},playFirstVideo:function(display,isLocal,src){for(var mp in MediaProvider)return MediaProvider[mp].playFirstVideo(display,isLocal,src)},getLogger:function(){if(initialized)return coreLogger;console.warn("Initialize API first.")},constants:constants,firefoxScreenSharingExtensionInstalled:!0,Browser:util.Browser}},{"./constants":40,"./flash-media-provider":41,"./media-source-media-provider":43,"./temasys-media-provider":45,"./util":46,"./webrtc-media-provider":47,"./websocket-media-provider":48,kalmanjs:2,"promise-polyfill":4,uuid:9,"webrtc-adapter":24}],43:[function(require,module,exports){(function(global){(function(){!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MediaSourceMediaProvider=t()}((function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var f="function"==typeof require&&require;if(!s&&f)return f(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){e.exports=function(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var r=new DataView(t),n=new DataView(e),i=t.byteLength;i--;)if(r.getUint8(i)!==n.getUint8(i))return!1;return!0}},{}],2:[function(t,e,r){"use strict";const n=r;n.bignum=t(16),n.define=t(3).define,n.base=t(5),n.constants=t(9),n.decoders=t(11),n.encoders=t(14)},{11:11,14:14,16:16,3:3,5:5,9:9}],3:[function(t,e,r){"use strict";const n=t(14),i=t(11),o=t(467);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}r.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return o(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},{11:11,14:14,467:467}],4:[function(t,e,r){"use strict";const n=t(467),i=t(7).Reporter,o=t(514).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(a,i),r.DecoderBuffer=a,a.isDecoderBuffer=function(t){return t instanceof a||"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},r.EncoderBuffer=s,s.isEncoderBuffer=function(t){return t instanceof s||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},{467:467,514:514,7:7}],5:[function(t,e,r){"use strict";const n=r;n.Reporter=t(7).Reporter,n.DecoderBuffer=t(4).DecoderBuffer,n.EncoderBuffer=t(4).EncoderBuffer,n.Node=t(6)},{4:4,6:6,7:7}],6:[function(t,e,r){"use strict";const n=t(7).Reporter,i=t(4).EncoderBuffer,o=t(4).DecoderBuffer,a=t(472),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],f=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function u(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}e.exports=u;const c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){const t=this._baseState,e={};c.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},u.prototype._wrap=function(){const t=this._baseState;f.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},u.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},u.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){u.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){u.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),u.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},u.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},u.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},u.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},u.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},u.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},u.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,i=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(a=this._peekTag(t,n,r.any),t.isError(a))return a}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(n)}}if(r.obj&&a&&(n=t.enterObject()),a){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&a&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,i),i},u.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},u.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},u.prototype._decodeChoice=function(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(o){const a=t.save(),s=r.choice[o];try{const r=s._decode(t,e);if(t.isError(r))return!1;n={type:o,value:r},i=!0}catch(e){return t.restore(a),!1}return!0}),this),i?n:t.error("Choice not matched")},u.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},u.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},u.prototype._encodeValue=function(t,e,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new n);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let a=null,s=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)a=this._getUse(i.contains,r)._encode(t,e),s=!0;else if(i.children)a=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),r))}else null!==i.use?o=this._getUse(i.use,r)._encode(t,e):(a=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,s,r,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},u.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},u.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},u.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},u.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},{4:4,472:472,7:7}],7:[function(t,e,r){"use strict";const n=t(467);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}r.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},{467:467}],8:[function(t,e,r){"use strict";function n(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e}r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=n(r.tag)},{}],9:[function(t,e,r){"use strict";const n=r;n._reverse=function(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e},n.der=t(8)},{8:8}],10:[function(t,e,r){"use strict";const n=t(467),i=t(16),o=t(4).DecoderBuffer,a=t(6),s=t(8);function f(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){a.call(this,"der",t)}function c(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const n=s.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function h(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;e<i;e++){n<<=8;const e=t.readUInt8(r);if(t.isError(e))return e;n|=e}return n}e.exports=f,f.prototype.decode=function(t,e){return o.isDecoderBuffer(t)||(t=new o(t,e)),this.tree._decode(t,e)},n(u,a),u.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;const n=t.save(),i=c(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||r)},u.prototype._decodeTag=function(t,e,r){const n=c(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;let i=h(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');const o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},u.prototype._skipUntilEnd=function(t,e){for(;;){const r=c(t,e);if(t.isError(r))return r;const n=h(t,r.primitive,e);if(t.isError(n))return n;let i;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},u.prototype._decodeList=function(t,e,r,n){const i=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=r.decode(t,"der",n);if(t.isError(o)&&e)break;i.push(o)}return i},u.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},u.prototype._decodeObjid=function(t,e,r){let n;const i=[];let o=0,a=0;for(;!t.isEmpty();)a=t.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,f=i[0]%40;if(n=r?i:[s,f].concat(i.slice(1)),e){let t=e[n.join(" ")];void 0===t&&(t=e[n.join(".")]),void 0!==t&&(n=t)}return n},u.prototype._decodeTime=function(t,e){const r=t.raw().toString();let n,i,o,a,s,f;if("gentime"===e)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),f=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),f=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,a,s,f,0)},u.prototype._decodeNull=function(){return null},u.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},u.prototype._decodeInt=function(t,e){const r=t.raw();let n=new i(r);return e&&(n=e[n.toString(10)]||n),n},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},{16:16,4:4,467:467,6:6,8:8}],11:[function(t,e,r){"use strict";const n=r;n.der=t(10),n.pem=t(12)},{10:10,12:12}],12:[function(t,e,r){"use strict";const n=t(467),i=t(514).Buffer,o=t(10);function a(t){o.call(this,t),this.enc="pem"}n(a,o),e.exports=a,a.prototype.decode=function(t,e){const r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let s=-1,f=-1;for(let t=0;t<r.length;t++){const e=r[t].match(a);if(null!==e&&e[2]===n){if(-1!==s){if("END"!==e[1])break;f=t;break}if("BEGIN"!==e[1])break;s=t}}if(-1===s||-1===f)throw new Error("PEM section not found for: "+n);const u=r.slice(s+1,f).join("");u.replace(/[^a-z0-9+/=]+/gi,"");const c=i.from(u,"base64");return o.prototype.decode.call(this,c,e)}},{10:10,467:467,514:514}],13:[function(t,e,r){"use strict";const n=t(467),i=t(514).Buffer,o=t(6),a=t(8);function s(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new f,this.tree._init(t.body)}function f(t){o.call(this,"der",t)}function u(t){return t<10?"0"+t:t}e.exports=s,s.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},n(f,o),f.prototype._encodeComposite=function(t,e,r,n){const o=function(t,e,r,n){let i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),a.tagByName.hasOwnProperty(t))i=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=a.tagClassByName[r||"universal"]<<6,i)}(t,e,r,this.reporter);if(n.length<128){const t=i.alloc(2);return t[0]=o,t[1]=n.length,this._createEncoderBuffer([t,n])}let s=1;for(let t=n.length;t>=256;t>>=8)s++;const f=i.alloc(2+s);f[0]=o,f[1]=128|s;for(let t=1+s,e=n.length;e>0;t--,e>>=8)f[t]=255&e;return this._createEncoderBuffer([f,n])},f.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},f.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let n=0;for(let e=0;e<t.length;e++){let r=t[e];for(n++;r>=128;r>>=7)n++}const o=i.alloc(n);let a=o.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(o[a--]=127&r;(r>>=7)>0;)o[a--]=128|127&r}return this._createEncoderBuffer(o)},f.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[u(n.getUTCFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(n.getUTCFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},f.prototype._encodeNull=function(){return this._createEncoderBuffer("")},f.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=i.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const n=new Array(r);for(let e=n.length-1;e>=0;e--)n[e]=255&t,t>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},f.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},f.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},f.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},{467:467,514:514,6:6,8:8}],14:[function(t,e,r){"use strict";const n=r;n.der=t(13),n.pem=t(15)},{13:13,15:15}],15:[function(t,e,r){"use strict";const n=t(467),i=t(13);function o(t){i.call(this,t),this.enc="pem"}n(o,i),e.exports=o,o.prototype.encode=function(t,e){const r=i.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"];for(let t=0;t<r.length;t+=64)n.push(r.slice(t,t+64));return n.push("-----END "+e.label+"-----"),n.join("\n")}},{13:13,467:467}],16:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof e?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(21).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function f(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c<s;c+=n)f=u(t,c,c+n,e),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var h=1;for(f=u(t,c,t.length,e),c=0;c<a;c++)h*=e;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var c=f>>>26,h=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;c+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[u]=0|h,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],f=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-f.length]+f+r:f+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=h[t],l=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:c[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,f="le"===e,u=new t(o),c=this.clone();if(f){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,a=t.words,s=e.words,f=r.words,u=0,c=0|a[0],h=8191&c,d=c>>>13,l=0|a[1],p=8191&l,b=l>>>13,v=0|a[2],g=8191&v,y=v>>>13,m=0|a[3],w=8191&m,_=m>>>13,S=0|a[4],M=8191&S,E=S>>>13,k=0|a[5],x=8191&k,A=k>>>13,R=0|a[6],I=8191&R,T=R>>>13,B=0|a[7],P=8191&B,O=B>>>13,C=0|a[8],L=8191&C,j=C>>>13,N=0|a[9],D=8191&N,U=N>>>13,F=0|s[0],q=8191&F,z=F>>>13,W=0|s[1],V=8191&W,H=W>>>13,G=0|s[2],K=8191&G,X=G>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,dt=ct>>>13,lt=0|s[9],pt=8191&lt,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(b,q)|0,o=Math.imul(b,z);var gt=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,q),i=(i=Math.imul(g,z))+Math.imul(y,q)|0,o=Math.imul(y,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,H)|0;var yt=(u+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,H)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,X)|0;var mt=(u+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;u=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,z))+Math.imul(E,q)|0,o=Math.imul(E,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0;var wt=(u+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(A,q)|0,o=Math.imul(A,z),n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(T,q)|0,o=Math.imul(T,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,H)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var St=(u+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(O,q)|0,o=Math.imul(O,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var Mt=(u+(n=n+Math.imul(h,ft)|0)|0)+((8191&(i=(i=i+Math.imul(h,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(j,q)|0,o=Math.imul(j,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ut)|0;var Et=(u+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,z))+Math.imul(U,q)|0,o=Math.imul(U,z),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(j,V)|0,o=o+Math.imul(j,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var kt=(u+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(j,K)|0,o=o+Math.imul(j,X)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,X))+Math.imul(U,K)|0,o=Math.imul(U,X),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,dt)|0;var At=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((o=o+Math.imul(y,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,ut)|0,n=n+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,dt)|0;var Rt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,ut)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,bt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ut)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,ut)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,dt)|0;var Bt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((o=o+Math.imul(T,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ut))+Math.imul(U,ft)|0,o=Math.imul(U,ut),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,dt)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,dt))+Math.imul(U,ht)|0,o=Math.imul(U,dt);var Ot=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,bt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(u+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,bt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,f[0]=vt,f[1]=gt,f[2]=yt,f[3]=mt,f[4]=wt,f[5]=_t,f[6]=St,f[7]=Mt,f[8]=Et,f[9]=kt,f[10]=xt,f[11]=At,f[12]=Rt,f[13]=It,f[14]=Tt,f[15]=Bt,f[16]=Pt,f[17]=Ot,f[18]=Ct,0!==u&&(f[19]=u,r.length++),r};function b(t,e,r){return(new v).mulp(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(p=l),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?l(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,f=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=f;u++){var c=o-u,h=(0|t.words[c])*(0|e.words[u]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},v.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,f=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var h=f,d=u,l=0;l<a;l++){var p=r[c+l],b=n[c+l],v=r[c+l+a],g=n[c+l+a],y=h*v-d*g;g=h*g+d*v,v=y,r[c+l]=p+v,n[c+l]=b+g,r[c+l+a]=p-v,n[c+l+a]=b-g,l!==s&&(y=f*h-u*d,d=f*d+u*h,h=y)}},v.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},v.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},v.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},v.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),f=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,u,n),this.transform(a,o,s,f,n,i),this.transform(u,o,c,h,n,i);for(var l=0;l<n;l++){var p=s[l]*c[l]-f[l]*h[l];f[l]=s[l]*h[l]+f[l]*c[l],s[l]=p}return this.conjugate(s,f,n),this.transform(s,f,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,f=(0|this.words[e])-s<<r;this.words[e]=f|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,f=r;if(i-=a,i=Math.max(0,i),f){for(var u=0;u<a;u++)f.words[u]=this.words[u];f.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;u>=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var f=(0|t.words[i])*e;s=((o-=67108863&f)>>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,f=n.length-i.length;if("mod"!==e){(s=new o(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var c=n.clone()._ishlnsubmul(i,1,f);0===c.negative&&(n=c,s&&(s.words[f]=1));for(var h=f-1;h>=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),f=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(c),f.isub(h)),s.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(f)):(r.isub(e),s.isub(i),f.isub(a))}return{a:s,b:f,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),f=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(m,y),m.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},m.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,y),i(_,y),i(S,y),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new m;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,v=0;0!==b.cmp(s);v++)b=b.redSqr();n(v<p);var g=this.pow(h,new o(1).iushln(p-v-1));d=d.redMul(g),h=g.redSqr(),l=l.redMul(h),p=v}return d},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,f=e.bitLength()%26;for(0===f&&(f=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],c=f-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new E(t)},i(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{21:21}],17:[function(t,e,r){(function(e){(function(){"use strict";if(t(397),t(511),t(69),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");function r(t,e,r){t[e]||Object.defineProperty(t,e,{writable:!0,configurable:!0,value:r})}e._babelPolyfill=!0,r(String.prototype,"padLeft","".padStart),r(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach((function(t){[][t]&&r(Array,t,Function.call.bind([][t]))}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{397:397,511:511,69:69}],18:[function(t,e,r){"use strict";r.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;return 2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,f[c++]=255&e),1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e),f},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=16383,s=0,f=r-i;s<f;s+=a)o.push(c(t,s,s+a>f?f:s+a));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,f=a.length;s<f;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],19:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof e?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(21).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function f(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),f=e;f<s;f++){var u=t.charCodeAt(f)-48;o*=i,a=u>=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=f(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c<s;c+=n)f=u(t,c,c+n,e),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var h=1;for(f=u(t,c,t.length,e),c=0;c<a;c++)h*=e;this.imuln(h),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){c(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var c=f>>>26,h=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;c+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[u]=0|h,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],f=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-f.length]+f+r:f+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],c=p[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var b=h.modrn(c).toString(t);r=(h=h.idivn(c)).isZero()?b+r:d[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var v=function(t,e,r){var n,i,o,a=t.words,s=e.words,f=r.words,u=0,c=0|a[0],h=8191&c,d=c>>>13,l=0|a[1],p=8191&l,b=l>>>13,v=0|a[2],g=8191&v,y=v>>>13,m=0|a[3],w=8191&m,_=m>>>13,S=0|a[4],M=8191&S,E=S>>>13,k=0|a[5],x=8191&k,A=k>>>13,R=0|a[6],I=8191&R,T=R>>>13,B=0|a[7],P=8191&B,O=B>>>13,C=0|a[8],L=8191&C,j=C>>>13,N=0|a[9],D=8191&N,U=N>>>13,F=0|s[0],q=8191&F,z=F>>>13,W=0|s[1],V=8191&W,H=W>>>13,G=0|s[2],K=8191&G,X=G>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,dt=ct>>>13,lt=0|s[9],pt=8191&lt,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,q)|0))<<13)|0;u=((o=Math.imul(d,z))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(b,q)|0,o=Math.imul(b,z);var gt=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,q),i=(i=Math.imul(g,z))+Math.imul(y,q)|0,o=Math.imul(y,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,H)|0;var yt=(u+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,H)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,X)|0;var mt=(u+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;u=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,z))+Math.imul(E,q)|0,o=Math.imul(E,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0;var wt=(u+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(A,q)|0,o=Math.imul(A,z),n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(g,Y)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(T,q)|0,o=Math.imul(T,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,H)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,X)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var St=(u+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(O,q)|0,o=Math.imul(O,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var Mt=(u+(n=n+Math.imul(h,ft)|0)|0)+((8191&(i=(i=i+Math.imul(h,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(j,q)|0,o=Math.imul(j,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ut)|0;var Et=(u+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,z))+Math.imul(U,q)|0,o=Math.imul(U,z),n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,H)|0)+Math.imul(j,V)|0,o=o+Math.imul(j,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,ut)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var kt=(u+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(j,K)|0,o=o+Math.imul(j,X)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,X))+Math.imul(U,K)|0,o=Math.imul(U,X),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,ut)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,dt)|0;var At=(u+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,bt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((o=o+Math.imul(y,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,J))+Math.imul(U,Y)|0,o=Math.imul(U,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,ut)|0,n=n+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,dt)|0;var Rt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,ut)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,bt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((o=o+Math.imul(E,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ut)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,ut)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,dt)|0)+Math.imul(O,ht)|0,o=o+Math.imul(O,dt)|0;var Bt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((o=o+Math.imul(T,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,ut))+Math.imul(U,ft)|0,o=Math.imul(U,ut),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,dt)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,bt)|0)+Math.imul(O,pt)|0))<<13)|0;u=((o=o+Math.imul(O,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ht),i=(i=Math.imul(D,dt))+Math.imul(U,ht)|0,o=Math.imul(U,dt);var Ot=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(j,pt)|0))<<13)|0;u=((o=o+Math.imul(j,bt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(u+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,bt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,bt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,f[0]=vt,f[1]=gt,f[2]=yt,f[3]=mt,f[4]=wt,f[5]=_t,f[6]=St,f[7]=Mt,f[8]=Et,f[9]=kt,f[10]=xt,f[11]=At,f[12]=Rt,f[13]=It,f[14]=Tt,f[15]=Bt,f[16]=Pt,f[17]=Ot,f[18]=Ct,0!==u&&(f[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,f=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=f;u++){var c=o-u,h=(0|t.words[c])*(0|e.words[u]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(v=b),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?v(this,t,e):r<63?b(this,t,e):r<1024?g(this,t,e):y(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,f=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var h=f,d=u,l=0;l<a;l++){var p=r[c+l],b=n[c+l],v=r[c+l+a],g=n[c+l+a],y=h*v-d*g;g=h*g+d*v,v=y,r[c+l]=p+v,n[c+l]=b+g,r[c+l+a]=p-v,n[c+l+a]=b-g,l!==s&&(y=f*h-u*d,d=f*d+u*h,h=y)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),f=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,u,n),this.transform(a,o,s,f,n,i),this.transform(u,o,c,h,n,i);for(var l=0;l<n;l++){var p=s[l]*c[l]-f[l]*h[l];f[l]=s[l]*h[l]+f[l]*c[l],s[l]=p}return this.conjugate(s,f,n),this.transform(s,f,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,f=(0|this.words[e])-s<<r;this.words[e]=f|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,f=r;if(i-=a,i=Math.max(0,i),f){for(var u=0;u<a;u++)f.words[u]=this.words[u];f.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;u>=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var f=(0|t.words[i])*e;s=((o-=67108863&f)>>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,f=n.length-i.length;if("mod"!==e){(s=new o(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var c=n.clone()._ishlnsubmul(i,1,f);0===c.negative&&(n=c,s&&(s.words[f]=1));for(var h=f-1;h>=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),f=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(c),f.isub(h)),s.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(f)):(r.isub(e),s.isub(i),f.isub(a))}return{a:s,b:f,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),f=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(S,_),S.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(M,_),i(E,_),i(k,_),k.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new M;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return w[t]=e,e},x.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,v=0;0!==b.cmp(s);v++)b=b.redSqr();n(v<p);var g=this.pow(h,new o(1).iushln(p-v-1));d=d.redMul(g),h=g.redSqr(),l=l.redMul(h),p=v}return d},x.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},x.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,f=e.bitLength()%26;for(0===f&&(f=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],c=f-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,x),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{21:21}],20:[function(t,e,r){var n;function i(t){this.rand=t}if(e.exports=function(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=t(21);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},{21:21}],21:[function(t,e,r){},{}],22:[function(t,e,r){var n=t(513).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i<e;i++)r[i]=t.readUInt32BE(4*i);return r}function o(t){for(;0<t.length;t++)t[0]=0}function a(t,e,r,n,i){for(var o,a,s,f,u=r[0],c=r[1],h=r[2],d=r[3],l=t[0]^e[0],p=t[1]^e[1],b=t[2]^e[2],v=t[3]^e[3],g=4,y=1;y<i;y++)o=u[l>>>24]^c[p>>>16&255]^h[b>>>8&255]^d[255&v]^e[g++],a=u[p>>>24]^c[b>>>16&255]^h[v>>>8&255]^d[255&l]^e[g++],s=u[b>>>24]^c[v>>>16&255]^h[l>>>8&255]^d[255&p]^e[g++],f=u[v>>>24]^c[l>>>16&255]^h[p>>>8&255]^d[255&b]^e[g++],l=o,p=a,b=s,v=f;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&v])^e[g++],a=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[v>>>8&255]<<8|n[255&l])^e[g++],s=(n[b>>>24]<<24|n[v>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[g++],f=(n[v>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[g++],[o>>>=0,a>>>=0,s>>>=0,f>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],f=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,f=0;f<256;++f){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[a]=u,n[u]=a;var c=t[a],h=t[c],d=t[h],l=257*t[u]^16843008*u;i[0][a]=l<<24|l>>>8,i[1][a]=l<<16|l>>>16,i[2][a]=l<<8|l>>>24,i[3][a]=l,l=16843009*d^65537*h^257*c^16843008*a,o[0][u]=l<<24|l>>>8,o[1][u]=l<<16|l>>>16,o[2][u]=l<<8|l>>>24,o[3][u]=l,0===a?a=s=1:(a=c^t[t[t[d^c]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function u(t){this._key=i(t),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>24,a=f.SBOX[a>>>24]<<24|f.SBOX[a>>>16&255]<<16|f.SBOX[a>>>8&255]<<8|f.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=f.SBOX[a>>>24]<<24|f.SBOX[a>>>16&255]<<16|f.SBOX[a>>>8&255]<<8|f.SBOX[255&a]),i[o]=i[o-e]^a}for(var u=[],c=0;c<n;c++){var h=n-c,d=i[h-(c%4?0:4)];u[c]=c<4||h<=4?d:f.INV_SUB_MIX[0][f.SBOX[d>>>24]]^f.INV_SUB_MIX[1][f.SBOX[d>>>16&255]]^f.INV_SUB_MIX[2][f.SBOX[d>>>8&255]]^f.INV_SUB_MIX[3][f.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,f.SUB_MIX,f.SBOX,this._nRounds)},u.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},u.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,f.INV_SUB_MIX,f.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},u.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=u},{513:513}],23:[function(t,e,r){var n=t(22),i=t(513).Buffer,o=t(68),a=t(467),s=t(27),f=t(66),u=t(28);function c(t,e,r,a){o.call(this);var f=i.alloc(4,0);this._cipher=new n.AES(e);var c=this._cipher.encryptBlock(f);this._ghash=new s(c),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new s(r),o=e.length,a=o%16;n.update(e),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var f=8*o,c=i.alloc(8);c.writeUIntBE(f,0,8),n.update(c),t._finID=n.state;var h=i.from(t._finID);return u(h),h}(this,r,c),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(c,o),c.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=f(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},c.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},c.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},c.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},e.exports=c},{22:22,27:27,28:28,467:467,513:513,66:66,68:68}],24:[function(t,e,r){var n=t(26),i=t(25),o=t(36);r.createCipher=r.Cipher=n.createCipher,r.createCipheriv=r.Cipheriv=n.createCipheriv,r.createDecipher=r.Decipher=i.createDecipher,r.createDecipheriv=r.Decipheriv=i.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(o)}},{25:25,26:26,36:36}],25:[function(t,e,r){var n=t(23),i=t(513).Buffer,o=t(35),a=t(38),s=t(68),f=t(22),u=t(435);function c(t,e,r){s.call(this),this._cache=new h,this._last=void 0,this._cipher=new f.AES(e),this._prev=i.from(r),this._mode=t,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function d(t,e,r){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=i.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=i.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,r,!0):"auth"===s.type?new n(s.module,e,r,!0):new c(s.module,e,r)}t(467)(c,s),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return i.concat(n)},c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var r=-1;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(16!==e)return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=i.concat([this.cache,t])},h.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=u(e,!1,r.key,r.iv);return d(t,n.key,n.iv)},r.createDecipheriv=d},{22:22,23:23,35:35,38:38,435:435,467:467,513:513,68:68}],26:[function(t,e,r){var n=t(35),i=t(23),o=t(513).Buffer,a=t(38),s=t(68),f=t(22),u=t(435);function c(t,e,r){s.call(this),this._cache=new d,this._cipher=new f.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}t(467)(c,s),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var h=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function l(t,e,r){var s=n[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,e,r):"auth"===s.type?new i(s.module,e,r):new c(s.module,e,r)}c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},d.prototype.add=function(t){this.cache=o.concat([this.cache,t])},d.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return o.concat([this.cache,e])},r.createCipheriv=l,r.createCipher=function(t,e){var r=n[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=u(e,!1,r.key,r.iv);return l(t,i.key,i.iv)}},{22:22,23:23,35:35,38:38,435:435,467:467,513:513,68:68}],27:[function(t,e,r){var n=t(513).Buffer,i=n.alloc(16,0);function o(t){var e=n.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,r,n=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),r=0!=(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},e.exports=a},{513:513}],28:[function(t,e,r){e.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},{}],29:[function(t,e,r){var n=t(66);r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{66:66}],30:[function(t,e,r){var n=t(513).Buffer,i=t(66);function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}r.encrypt=function(t,e,r){for(var i,a=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},{513:513,66:66}],31:[function(t,e,r){var n=t(513).Buffer;function i(t,e,r){for(var n,i,a=-1,s=0;++a<8;)n=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>a%8,t._prev=o(t._prev,r?n:i);return s}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i<r;)o[i]=t[i]<<1|t[i+1]>>7;return o}r.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},{513:513}],32:[function(t,e,r){var n=t(513).Buffer;function i(t,e,r){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=n.concat([t._prev.slice(1),n.from([r?e:i])]),i}r.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},{513:513}],33:[function(t,e,r){var n=t(66),i=t(513).Buffer,o=t(28);function a(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}r.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var f=a(t),u=o+16*s;t._cache.writeUInt32BE(f[0],u+0),t._cache.writeUInt32BE(f[1],u+4),t._cache.writeUInt32BE(f[2],u+8),t._cache.writeUInt32BE(f[3],u+12)}var c=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),n(e,c)}},{28:28,513:513,66:66}],34:[function(t,e,r){r.encrypt=function(t,e){return t._cipher.encryptBlock(e)},r.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},{}],35:[function(t,e,r){var n={ECB:t(34),CBC:t(29),CFB:t(30),CFB8:t(32),CFB1:t(31),OFB:t(37),CTR:t(33),GCM:t(33)},i=t(36);for(var o in i)i[o].module=n[i[o].mode];e.exports=i},{29:29,30:30,31:31,32:32,33:33,34:34,36:36,37:37}],36:[function(t,e,r){e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},{}],37:[function(t,e,r){(function(e){(function(){var n=t(66);function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}r.encrypt=function(t,r){for(;t._cache.length<r.length;)t._cache=e.concat([t._cache,i(t)]);var o=t._cache.slice(0,r.length);return t._cache=t._cache.slice(r.length),n(r,o)}}).call(this)}).call(this,t(67).Buffer)},{66:66,67:67}],38:[function(t,e,r){var n=t(22),i=t(513).Buffer,o=t(68);function a(t,e,r,a){o.call(this),this._cipher=new n.AES(e),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}t(467)(a,o),a.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},e.exports=a},{22:22,467:467,513:513,68:68}],39:[function(t,e,r){var n=t(40),i=t(24),o=t(35),a=t(41),s=t(435);function f(t,e,r){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function u(t,e,r){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}r.createCipher=r.Cipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return f(t,i.key,i.iv)},r.createCipheriv=r.Cipheriv=f,r.createDecipher=r.Decipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return u(t,i.key,i.iv)},r.createDecipheriv=r.Decipheriv=u,r.listCiphers=r.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},{24:24,35:35,40:40,41:41,435:435}],40:[function(t,e,r){var n=t(68),i=t(406),o=t(467),a=t(513).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function f(t){n.call(this);var e,r=t.mode.toLowerCase(),i=s[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=a.concat([o,o.slice(0,8)]));var f=t.iv;a.isBuffer(f)||(f=a.from(f)),this._des=i.create({key:o,iv:f,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=f,o(f,n),f.prototype._update=function(t){return a.from(this._des.update(t))},f.prototype._final=function(){return a.from(this._des.final())}},{406:406,467:467,513:513,68:68}],41:[function(t,e,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],42:[function(t,e,r){(function(r){(function(){var n=t(19),i=t(496);function o(t){var e,r=t.modulus.byteLength();do{e=new n(i(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var i=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),a=e.modulus.byteLength(),s=new n(t).mul(i.blinder).umod(e.modulus),f=s.toRed(n.mont(e.prime1)),u=s.toRed(n.mont(e.prime2)),c=e.coefficient,h=e.prime1,d=e.prime2,l=f.redPow(e.exponent1).fromRed(),p=u.redPow(e.exponent2).fromRed(),b=l.isub(p).imul(c).umod(h).imul(d);return p.iadd(b).imul(i.unblinder).umod(e.modulus).toArrayLike(r,"be",a)}a.getr=o,e.exports=a}).call(this)}).call(this,t(67).Buffer)},{19:19,496:496,67:67}],43:[function(t,e,r){e.exports=t(44)},{44:44}],44:[function(t,e,r){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],45:[function(t,e,r){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],46:[function(t,e,r){var n=t(64).Buffer,i=t(401),o=t(63),a=t(467),s=t(47),f=t(48),u=t(44);function c(t){o.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){o.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function d(t){return new c(t)}function l(t){return new h(t)}Object.keys(u).forEach((function(t){u[t].id=n.from(u[t].id,"hex"),u[t.toLowerCase()]=u[t]})),a(c,o.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},c.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=s(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},a(h,o.Writable),h.prototype._write=function(t,e,r){this._hash.update(t),r()},h.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},h.prototype.verify=function(t,e,r){"string"==typeof e&&(e=n.from(e,r)),this.end();var i=this._hash.digest();return f(e,i,t,this._signType,this._tag)},e.exports={Sign:d,Verify:l,createSign:d,createVerify:l}},{401:401,44:44,467:467,47:47,48:48,63:63,64:64}],47:[function(t,e,r){var n=t(64).Buffer,i=t(403),o=t(42),a=t(417).ec,s=t(19),f=t(479),u=t(45);function c(t,e,r,o){if((t=n.from(t.toArray())).length<e.byteLength()){var a=n.alloc(e.byteLength()-t.length);t=n.concat([a,t])}var s=r.length,f=function(t,e){t=(t=h(t,e)).mod(e);var r=n.from(t.toArray());if(r.length<e.byteLength()){var i=n.alloc(e.byteLength()-r.length);r=n.concat([i,r])}return r}(r,e),u=n.alloc(s);u.fill(1);var c=n.alloc(s);return c=i(o,c).update(u).update(n.from([0])).update(t).update(f).digest(),u=i(o,c).update(u).digest(),{k:c=i(o,c).update(u).update(n.from([1])).update(t).update(f).digest(),v:u=i(o,c).update(u).digest()}}function h(t,e){var r=new s(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function d(t,e,r){var o,a;do{for(o=n.alloc(0);8*o.length<t.bitLength();)e.v=i(r,e.k).update(e.v).digest(),o=n.concat([o,e.v]);a=h(o,t),e.k=i(r,e.k).update(e.v).update(n.from([0])).digest(),e.v=i(r,e.k).update(e.v).digest()}while(-1!==a.cmp(t));return a}function l(t,e,r,n){return t.toRed(s.mont(r)).redPow(e).fromRed().mod(n)}e.exports=function(t,e,r,i,p){var b=f(e);if(b.curve){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");return function(t,e){var r=u[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var i=new a(r).keyFromPrivate(e.privateKey).sign(t);return n.from(i.toDER())}(t,b)}if("dsa"===b.type){if("dsa"!==i)throw new Error("wrong private key type");return function(t,e,r){for(var i,o=e.params.priv_key,a=e.params.p,f=e.params.q,u=e.params.g,p=new s(0),b=h(t,f).mod(f),v=!1,g=c(o,f,t,r);!1===v;)p=l(u,i=d(f,g,r),a,f),0===(v=i.invm(f).imul(b.add(o.mul(p))).mod(f)).cmpn(0)&&(v=!1,p=new s(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t)),128&e[0]&&(e=[0].concat(e));var r=[48,t.length+e.length+4,2,t.length];return r=r.concat(t,[2,e.length],e),n.from(r)}(p,v)}(t,b,r)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");t=n.concat([p,t]);for(var v=b.modulus.byteLength(),g=[0,1];t.length+g.length+1<v;)g.push(255);g.push(0);for(var y=-1;++y<t.length;)g.push(t[y]);return o(g,b)},e.exports.getKey=c,e.exports.makeKey=d},{19:19,403:403,417:417,42:42,45:45,479:479,64:64}],48:[function(t,e,r){var n=t(64).Buffer,i=t(19),o=t(417).ec,a=t(479),s=t(45);function f(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}e.exports=function(t,e,r,u,c){var h=a(r);if("ec"===h.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),a=r.data.subjectPrivateKey.data;return i.verify(e,t,a)}(t,e,h)}if("dsa"===h.type){if("dsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,o=r.data.q,s=r.data.g,u=r.data.pub_key,c=a.signature.decode(t,"der"),h=c.s,d=c.r;f(h,o),f(d,o);var l=i.mont(n),p=h.invm(o);return 0===s.toRed(l).redPow(new i(e).mul(p).mod(o)).fromRed().mul(u.toRed(l).redPow(d.mul(p).mod(o)).fromRed()).mod(n).mod(o).cmp(d)}(t,e,h)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");e=n.concat([c,e]);for(var d=h.modulus.byteLength(),l=[1],p=0;e.length+l.length+2<d;)l.push(255),p++;l.push(0);for(var b=-1;++b<e.length;)l.push(e[b]);l=n.from(l);var v=i.mont(h.modulus);t=(t=new i(t).toRed(v)).redPow(new i(h.publicExponent)),t=n.from(t.fromRed().toArray());var g=p<8?1:0;for(d=Math.min(t.length,l.length),t.length!==l.length&&(g=1),b=-1;++b<d;)g|=t[b]^l[b];return 0===g}},{19:19,417:417,45:45,479:479,64:64}],49:[function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,s;if("string"==typeof e&&(i="not ",e.substr(0,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var f=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";s='The "'.concat(t,'" ').concat(f," ").concat(n," ").concat(o(e,"type"))}return s+". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],50:[function(t,e,r){(function(r){(function(){"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=u;var i=t(52),o=t(54);t(467)(u,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var f=a[s];u.prototype[f]||(u.prototype[f]=o.prototype[f])}function u(t){if(!(this instanceof u))return new u(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||r.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t(487))},{467:467,487:487,52:52,54:54}],51:[function(t,e,r){"use strict";e.exports=i;var n=t(53);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}t(467)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},{467:467,53:53}],52:[function(t,e,r){(function(r,n){(function(){"use strict";var i;e.exports=k,k.ReadableState=E,t(434).EventEmitter;var u,o=function(t,e){return t.listeners(e).length},a=t(62),s=t(67).Buffer,f=n.Uint8Array||function(){},c=t(21);u=c&&c.debuglog?c.debuglog("stream"):function(){};var h,d,l,p=t(56),b=t(57),v=t(61).getHighWaterMark,g=t(49).codes,y=g.ERR_INVALID_ARG_TYPE,m=g.ERR_STREAM_PUSH_AFTER_EOF,w=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t(467)(k,a);var S=b.errorOrDestroy,M=["error","close","destroy","pause","resume"];function E(e,r,n){i=i||t(50),e=e||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=v(this,e,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=t(525).StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function k(e){if(i=i||t(50),!(this instanceof k))return new k(e);var r=this instanceof i;this._readableState=new E(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function x(t,e,r,n,i){u("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(u("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?T(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}}(t,a);else if(i||(o=function(t,e){var r,n;return n=e,s.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e)),r}(a,e)),o)S(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?S(t,new _):A(t,a,e,!0);else if(a.ended)S(t,new m);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?A(t,a,e,!1):P(t,a)):A(t,a,e,!1)}else n||(a.reading=!1,P(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function A(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&T(t)),P(t,e)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),k.prototype.destroy=b.destroy,k.prototype._undestroy=b.undestroy,k.prototype._destroy=function(t,e){e(t)},k.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},k.prototype.unshift=function(t){return x(this,t,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(e){h||(h=t(525).StringDecoder);var r=new h(e);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var R=1073741824;function I(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=R?t=R:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(B,t))}function B(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function P(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(O,t,e))}function O(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(u("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function C(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){u("readable nexttick read 0"),t.read(0)}function j(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function D(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(F,e,t))}function F(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function q(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}k.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):T(this),null;if(0===(t=I(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",i=!0),e.ended||e.reading?u("reading or ended",i=!1):i&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=I(r,e))),null===(n=t>0?D(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},k.prototype._read=function(t){S(this,new w("_read()"))},k.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var a=e&&!1===e.end||t===r.stdout||t===r.stderr?v:f;function f(){u("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",(function s(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),t.removeListener("drain",c),t.removeListener("error",l),t.removeListener("unpipe",s),n.removeListener("end",f),n.removeListener("end",v),n.removeListener("data",d),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",c);var h=!1;function d(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==q(i.pipes,t))&&!h&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function l(e){u("onerror",e),v(),t.removeListener("error",l),0===o(t,"error")&&S(t,e)}function p(){t.removeListener("finish",b),v()}function b(){u("onfinish"),t.removeListener("close",p),v()}function v(){u("unpipe"),n.unpipe(t)}return n.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",p),t.once("finish",b),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},k.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=q(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},k.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?T(this):i.reading||r.nextTick(L,this))),n},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(C,this),n},k.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(C,this),e},k.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(j,t,e))}(this,t)),t.paused=!1,this},k.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<M.length;o++)t.on(M[o],this.emit.bind(this,M[o]));return this._read=function(e){u("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=t(55)),d(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),k._fromList=D,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(e,r){return void 0===l&&(l=t(59)),l(k,e,r)})}).call(this)}).call(this,t(487),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{21:21,434:434,467:467,487:487,49:49,50:50,525:525,55:55,56:56,57:57,59:59,61:61,62:62,67:67}],53:[function(t,e,r){"use strict";e.exports=c;var n=t(49).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,f=t(50);function u(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(t){if(!(this instanceof c))return new c(t);f.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,r){d(t,e,r)}))}function d(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}t(467)(c,f),c.prototype.push=function(t,e){return this._transformState.needTransform=!1,f.prototype.push.call(this,t,e)},c.prototype._transform=function(t,e,r){r(new i("_transform()"))},c.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},c.prototype._destroy=function(t,e){f.prototype._destroy.call(this,t,(function(t){e(t)}))}},{467:467,49:49,50:50}],54:[function(t,e,r){(function(r,n){(function(){"use strict";function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(void 0),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;e.exports=k,k.WritableState=E;var c,a={deprecate:t(527)},s=t(62),f=t(67).Buffer,u=n.Uint8Array||function(){},h=t(57),d=t(61).getHighWaterMark,l=t(49).codes,p=l.ERR_INVALID_ARG_TYPE,b=l.ERR_METHOD_NOT_IMPLEMENTED,v=l.ERR_MULTIPLE_CALLBACK,g=l.ERR_STREAM_CANNOT_PIPE,y=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,_=l.ERR_UNKNOWN_ENCODING,S=h.errorOrDestroy;function M(){}function E(e,n,a){o=o||t(50),e=e||{},"boolean"!=typeof a&&(a=n instanceof o),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new v;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(B,t,e),t._writableState.errorEmitted=!0,S(t,i)):(o(i),t._writableState.errorEmitted=!0,S(t,i),B(t,e))}(t,n,i,e,o);else{var a=I(n)||t.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||R(t,n),i?r.nextTick(A,t,n,a,o):A(t,n,a,o)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function k(e){var r=this instanceof(o=o||t(50));if(!r&&!c.call(k,this))return new k(e);this._writableState=new E(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function x(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function A(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),B(t,e)}function R(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,f=!0;r;)o[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;o.allBuffers=f,x(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,h=r.callback;if(x(t,e,!1,e.objectMode?1:u.length,u,c,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function I(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function T(t,e){t._final((function(r){e.pendingcb--,r&&S(t,r),e.prefinished=!0,t.emit("prefinish"),B(t,e)}))}function B(t,e){var n=I(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(T,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}t(467)(k,s),E.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(E.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===k&&t&&t._writableState instanceof E}})):c=function(t){return t instanceof this},k.prototype.pipe=function(){S(this,new g)},k.prototype.write=function(t,e,n){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,f.isBuffer(i)||i instanceof u);return s&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=M),o.ending?function(t,e){var n=new w;S(t,n),r.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var o;return null===n?o=new m:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(S(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else x(t,e,!1,s,n,i,o);return u}(this,o,s,t,e,n)),a},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||R(this,t))},k.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(t,e,r){r(new b("_write()"))},k.prototype._writev=null,k.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,B(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),k.prototype.destroy=h.destroy,k.prototype._undestroy=h.undestroy,k.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t(487),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{467:467,487:487,49:49,50:50,527:527,57:57,61:61,62:62,67:67}],55:[function(t,e,r){(function(r){(function(){"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t(58),a=Symbol("lastResolve"),s=Symbol("lastReject"),f=Symbol("error"),u=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function l(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[c]=null,t[a]=null,t[s]=null,e(l(r,!1)))}}function b(t){r.nextTick(p,t)}var v=Object.getPrototypeOf((function(){})),g=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(l(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){r.nextTick((function(){t[f]?n(t[f]):e(l(void 0,!0))}))}));var n,i=this[c];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[u]?r(l(void 0,!0)):e[h](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(l(o,!1));n=new Promise(this[h])}return this[c]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(l(void 0,!0))}))}))})),n),v);e.exports=function(t){var e,r=Object.create(g,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,f,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var n=r[d].read();n?(r[c]=null,r[a]=null,r[s]=null,t(l(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[c]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[c]=null,r[a]=null,r[s]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[c]=null,r[a]=null,r[s]=null,n(l(void 0,!0))),r[u]=!0})),t.on("readable",b.bind(null,r)),r}}).call(this)}).call(this,t(487))},{487:487,58:58}],56:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=t(67).Buffer,s=t(21).inspect,f=s&&s.custom||"inspect";e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:f,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),t}()},{21:21,67:67}],57:[function(t,e,r){(function(t){(function(){"use strict";function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}e.exports={destroy:function(e,o){var a=this,s=this._readableState&&this._readableState.destroyed,f=this._writableState&&this._writableState.destroyed;return s||f?(o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!o&&e?a._writableState?a._writableState.errorEmitted?t.nextTick(n,a):(a._writableState.errorEmitted=!0,t.nextTick(r,a,e)):t.nextTick(r,a,e):o?(t.nextTick(n,a),o(e)):t.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this)}).call(this,t(487))},{487:487}],58:[function(t,e,r){"use strict";var n=t(49).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,f=function(){e.writable||c()},u=e._writableState&&e._writableState.finished,c=function(){s=!1,u=!0,a||o.call(e)},h=e._readableState&&e._readableState.endEmitted,d=function(){a=!1,h=!0,s||o.call(e)},l=function(t){o.call(e,t)},p=function(){var t;return a&&!h?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!u?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},b=function(){e.req.on("finish",c)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",c),e.on("abort",p),e.req?b():e.on("request",b)):s&&!e._writableState&&(e.on("end",f),e.on("close",f)),e.on("end",d),e.on("finish",c),!1!==r.error&&e.on("error",l),e.on("close",p),function(){e.removeListener("complete",c),e.removeListener("abort",p),e.removeListener("request",b),e.req&&e.req.removeListener("finish",c),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("end",d),e.removeListener("error",l),e.removeListener("close",p)}}},{49:49}],59:[function(t,e,r){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],60:[function(t,e,r){"use strict";var n,i=t(49).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function f(e,r,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=t(58)),n(e,{readable:r,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var f=!1;return function(t){if(!s&&!f)return f=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}function u(t){t()}function c(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}e.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=h(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,r){var o=r<e.length-1;return f(t,o,r>0,(function(t){n||(n=t),t&&a.forEach(u),o||(a.forEach(u),i(n))}))}));return e.reduce(c)}},{49:49,58:58}],61:[function(t,e,r){"use strict";var n=t(49).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},{49:49}],62:[function(t,e,r){e.exports=t(434).EventEmitter},{434:434}],63:[function(t,e,r){(r=e.exports=t(52)).Stream=r,r.Readable=r,r.Writable=t(54),r.Duplex=t(50),r.Transform=t(53),r.PassThrough=t(51),r.finished=t(58),r.pipeline=t(60)},{50:50,51:51,52:52,53:53,54:54,58:58,60:60}],64:[function(t,e,r){
21
21
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
22
22
  var n=t(67),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{67:67}],65:[function(t,e,r){"use strict";var n=t(513).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=f,this.end=u,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:-1}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�".repeat(r);if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�".repeat(r+1);if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�".repeat(r+2)}}(this,t,e);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function f(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�".repeat(this.lastTotal-this.lastNeed):e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=a(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r?0:(i=a(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r?0:(i=a(e[n]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{513:513}],66:[function(t,e,r){(function(t){(function(){e.exports=function(e,r){for(var n=Math.min(e.length,r.length),i=new t(n),o=0;o<n;++o)i[o]=e[o]^r[o];return i}}).call(this)}).call(this,t(67).Buffer)},{67:67}],67:[function(t,e,r){(function(e){(function(){
23
23
  /*!