@liascript/editor 1.1.4--0.14.10 → 1.1.4--0.14.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Edrys.74e9e834.js +1 -0
- package/dist/Edrys.f0cb7bde.js +1 -0
- package/dist/{Gun.ffb60d99.js → Gun.11528a5e.js} +1 -1
- package/dist/Gun.a8998ad8.js +1 -0
- package/dist/P2PT.54680aa5.js +1 -0
- package/dist/P2PT.e8e586dc.js +1 -0
- package/dist/{PubNub.7beee77f.js → PubNub.5e938410.js} +1 -1
- package/dist/{PubNub.84203343.js → PubNub.909274ea.js} +1 -1
- package/dist/Trystero.d69546d5.js +1 -0
- package/dist/Trystero.dde47cf4.js +1 -0
- package/dist/Worker.829d8233.js +1 -0
- package/dist/ace.js +1 -1
- package/dist/ext-inline_autocomplete.js +1 -1
- package/dist/ext-language_tools.js +1 -1
- package/dist/ext-modelist.js +1 -1
- package/dist/ext-options.js +1 -1
- package/dist/ext-prompt.js +1 -1
- package/dist/ext-settings_menu.js +1 -1
- package/dist/icon.000fa25d.woff +0 -0
- package/dist/icon.144405c4.ttf +0 -0
- package/dist/icon.192aa014.eot +0 -0
- package/dist/icon.b33d284a.svg +1 -0
- package/dist/icon.de36b718.woff2 +0 -0
- package/dist/index.2238fc60.js +6 -0
- package/dist/index.40c93815.js +1 -0
- package/dist/index.4ca86089.js +1 -0
- package/dist/index.7612a0f5.js +1 -0
- package/dist/index.7d9384fb.js +1 -0
- package/dist/index.8170c3eb.css +1 -0
- package/dist/index.b1f73fbe.js +1 -0
- package/dist/index.ef4f64b2.js +1 -0
- package/dist/index.fad28349.js +6 -0
- package/dist/index.html +1 -1
- package/dist/katex.min.css +1 -1
- package/dist/mode-assembly_arm32.js +1 -0
- package/dist/mode-swift.js +1 -1
- package/dist/mode-vue.js +1 -0
- package/dist/{p2pt.58cb98a2.js → p2pt.72acf006.js} +1 -1
- package/dist/{p2pt.34593e66.js → p2pt.ffc6565a.js} +2 -2
- package/dist/snippets/assembly_arm32.js +1 -0
- package/dist/snippets/vue.js +1 -0
- package/dist/theme-cloud_editor.js +1 -1
- package/dist/theme-cloud_editor_dark.js +1 -1
- package/dist/trystero-mqtt.min.797e6207.js +1 -0
- package/dist/trystero-mqtt.min.a3a16184.js +1 -0
- package/dist/trystero-nostr.min.24890b5b.js +1 -0
- package/dist/trystero-nostr.min.6e0fc857.js +1 -0
- package/dist/trystero-torrent.min.21aa41bd.js +1 -0
- package/dist/trystero-torrent.min.942f97c0.js +1 -0
- package/package.json +6 -5
- package/dist/Edrys.1fde52d9.js +0 -1
- package/dist/Edrys.44286897.js +0 -1
- package/dist/Gun.95d187b2.js +0 -1
- package/dist/Jitsi.7a4a598f.js +0 -1
- package/dist/Jitsi.c6d22fd3.js +0 -1
- package/dist/P2PT.9243c052.js +0 -1
- package/dist/P2PT.f1f62db2.js +0 -1
- package/dist/icon.2cd33ea1.woff2 +0 -0
- package/dist/icon.ac405c1a.svg +0 -1
- package/dist/icon.b61b5e3b.eot +0 -0
- package/dist/icon.dd6eb41b.woff +0 -0
- package/dist/icon.e4659f0c.ttf +0 -0
- package/dist/index.02bbc637.js +0 -6
- package/dist/index.1219afb6.js +0 -1
- package/dist/index.31736bc9.js +0 -1
- package/dist/index.3f7dab52.js +0 -1
- package/dist/index.6cdb2c92.js +0 -1
- package/dist/index.701b7785.js +0 -1
- package/dist/index.a8795024.js +0 -1
- package/dist/index.b8b2c658.js +0 -6
- package/dist/index.ebd7061d.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function t(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var n=e.parcelRequirea18f;n.register("5snUO",(function(e,t){var r=n("laHbQ").Buffer,i=n("9BVjm"),s=n("46vcE"),o=n("8fFK8"),a=n("hbmjh");const c=n("2kvC4")("p2pt");e.exports=class extends o{constructor(e=[],t=""){super(),this.announceURLs=e,this.trackers={},this.peers={},this.msgChunks={},this.responseWaiting={},t&&this.setIdentifier(t),this._peerIdBuffer=s(20),this._peerId=this._peerIdBuffer.toString("hex"),this._peerIdBinary=this._peerIdBuffer.toString("binary"),c("my peer id: "+this._peerId)}setIdentifier(e){this.identifierString=e,this.infoHash=a.sync(e).toLowerCase(),this._infoHashBuffer=r.from(this.infoHash,"hex"),this._infoHashBinary=this._infoHashBuffer.toString("binary")}start(){this.on("peer",(e=>{let t=!1;this.peers[e.id]||(t=!0,this.peers[e.id]={},this.responseWaiting[e.id]={}),e.on("connect",(()=>{this.peers[e.id][e.channelName]=e,t&&this.emit("peerconnect",e)})),e.on("data",(t=>{if(this.emit("data",e,t),t=t.toString(),c("got a message from "+e.id),"^"===t[0])try{t=JSON.parse(t.slice(1)),e.respond=this._peerRespond(e,t.id);let n=this._chunkHandler(t);!1!==n&&(t.o&&(n=JSON.parse(n)),this.responseWaiting[e.id][t.id]?(this.responseWaiting[e.id][t.id]([e,n]),delete this.responseWaiting[e.id][t.id]):this.emit("msg",e,n),this._destroyChunks(t.id))}catch(e){console.log(e)}})),e.on("error",(t=>{this._removePeer(e),c("Error in connection : "+t)})),e.on("close",(()=>{this._removePeer(e),c("Connection closed with "+e.id)}))})),this.on("update",(e=>{const t=this.trackers[this.announceURLs.indexOf(e.announce)];this.emit("trackerconnect",t,this.getTrackerStats())})),this.on("warning",(e=>{this.emit("trackerwarning",e,this.getTrackerStats())})),this._fetchPeers()}addTracker(e){if(-1!==this.announceURLs.indexOf(e))throw new Error("Tracker already added");const t=this.announceURLs.push(e);this.trackers[t]=new i(this,e),this.trackers[t].announce(this._defaultAnnounceOpts())}removeTracker(e){const t=this.announceURLs.indexOf(e);if(-1===t)throw new Error("Tracker does not exist");this.trackers[t].peers=[],this.trackers[t].destroy(),delete this.trackers[t],delete this.announceURLs[t]}_removePeer(e){if(!this.peers[e.id])return!1;delete this.peers[e.id][e.channelName],0===Object.keys(this.peers[e.id]).length&&(this.emit("peerclose",e),delete this.responseWaiting[e.id],delete this.peers[e.id])}send(e,t,n=""){return new Promise(((r,i)=>{const s={id:""!==n?n:Math.floor(1e5*Math.random()+1e5),msg:t};"object"==typeof t&&(s.msg=JSON.stringify(t),s.o=1);try{if(!e.connected)for(const t in this.peers[e.id])if((e=this.peers[e.id][t]).connected)break;this.responseWaiting[e.id]||(this.responseWaiting[e.id]={}),this.responseWaiting[e.id][s.id]=r}catch(e){return i(Error("Connection to peer closed"+e))}let o=0,a="";for(;s.msg.length>0;)s.c=o,a=s.msg.slice(16e3),s.msg=s.msg.slice(0,16e3),a||(s.last=!0),e.send("^"+JSON.stringify(s)),s.msg=a,o++;c("sent a message to "+e.id)}))}requestMorePeers(){return new Promise((e=>{for(const e in this.trackers)this.trackers[e].announce(this._defaultAnnounceOpts());e(this.peers)}))}getTrackerStats(){let e=0;for(const t in this.trackers)this.trackers[t].socket&&this.trackers[t].socket.connected&&e++;return{connected:e,total:this.announceURLs.length}}destroy(){let e;for(e in this.peers)for(const t in this.peers[e])this.peers[e][t].destroy();for(e in this.trackers)this.trackers[e].destroy()}_peerRespond(e,t){return n=>this.send(e,n,t)}_chunkHandler(e){return this.msgChunks[e.id]||(this.msgChunks[e.id]=[]),this.msgChunks[e.id][e.c]=e.msg,!!e.last&&this.msgChunks[e.id].join("")}_destroyChunks(e){delete this.msgChunks[e]}_defaultAnnounceOpts(e={}){return null==e.numwant&&(e.numwant=50),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),e}_fetchPeers(){for(const e in this.announceURLs)this.trackers[e]=new i(this,this.announceURLs[e]),this.trackers[e].announce(this._defaultAnnounceOpts())}}})),n.register("9BVjm",(function(e,t){var r=n("a87qH");const i=n("2kvC4")("bittorrent-tracker:websocket-tracker");var s=n("khaS7"),o=n("46vcE"),a=n("38IZd"),c=n("sslC9"),h=n("8han8"),l=n("3xnRy");const u={};class d extends l{constructor(e,t){super(e,t),i("new websocket tracker %s",t),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.announce(e)}));const t=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(t.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(t);else{const n=Math.min(e.numwant,5);this._generateOffers(n,(e=>{t.numwant=n,t.offers=e,this._send(t)}))}}scrape(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.scrape(e)}));const t={action:"scrape",info_hash:Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map((e=>e.toString("binary"))):e.infoHash&&e.infoHash.toString("binary")||this.client._infoHashBinary};this._send(t)}destroy(e=f){if(this.destroyed)return e(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const e in this.peers){const t=this.peers[e];clearTimeout(t.trackerTimeout),t.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,u[this.announceUrl]&&(u[this.announceUrl].consumers-=1),u[this.announceUrl].consumers>0)return e();let t,n=u[this.announceUrl];if(delete u[this.announceUrl],n.on("error",f),n.once("close",e),!this.expectingResponse)return r();function r(){t&&(clearTimeout(t),t=null),n.removeListener("data",r),n.destroy(),n=null}t=setTimeout(r,h.DESTROY_TIMEOUT),n.once("data",r)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=e=>{this._onSocketError(e)},this._onSocketDataBound=e=>{this._onSocketData(e)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=u[this.announceUrl],this.socket)u[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const e=new URL(this.announceUrl);let t;this.client._proxyOpts&&(t="wss:"===e.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!t&&this.client._proxyOpts.socksProxy&&(t=new c.Agent(r(this.client._proxyOpts.socksProxy),"wss:"===e.protocol))),this.socket=u[this.announceUrl]=new a({url:this.announceUrl,agent:t}),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)}this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(e){if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse(e)}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error(`invalid action in WS response: ${e.action}`))}}_onAnnounceResponse(e){if(e.info_hash!==this.client._infoHashBinary)return void i("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,h.binaryToHex(e.info_hash),this.client.infoHash);if(e.peer_id&&e.peer_id===this.client._peerIdBinary)return;i("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);const t=e["failure reason"];if(t)return this.client.emit("warning",new Error(t));const n=e["warning message"];n&&this.client.emit("warning",new Error(n));const r=e.interval||e["min interval"];r&&this.setInterval(1e3*r);const s=e["tracker id"];if(s&&(this._trackerId=s),null!=e.complete){const t=Object.assign({},e,{announce:this.announceUrl,infoHash:h.binaryToHex(e.info_hash)});this.client.emit("update",t)}let o;if(e.offer&&e.peer_id&&(i("creating peer (from remote offer)"),o=this._createPeer(),o.id=h.binaryToHex(e.peer_id),o.once("signal",(t=>{const n={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:e.peer_id,answer:t,offer_id:e.offer_id};this._trackerId&&(n.trackerid=this._trackerId),this._send(n)})),this.client.emit("peer",o),o.signal(e.offer)),e.answer&&e.peer_id){const t=h.binaryToHex(e.offer_id);o=this.peers[t],o?(o.id=h.binaryToHex(e.peer_id),this.client.emit("peer",o),o.signal(e.answer),clearTimeout(o.trackerTimeout),o.trackerTimeout=null,delete this.peers[t]):i(`got unexpected answer: ${JSON.stringify(e.answer)}`)}}_onScrapeResponse(e){e=e.files||{};const t=Object.keys(e);0!==t.length?t.forEach((t=>{const n=Object.assign(e[t],{announce:this.announceUrl,infoHash:h.binaryToHex(t)});this.client.emit("scrape",n)})):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}_startReconnectTimer(){const e=Math.floor(3e5*Math.random())+Math.min(1e4*Math.pow(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout((()=>{this.retries++,this._openSocket()}),e),this.reconnectTimer.unref&&this.reconnectTimer.unref(),i("reconnecting socket in %s ms",e)}_send(e){if(this.destroyed)return;this.expectingResponse=!0;const t=JSON.stringify(e);i("send %s",t),this.socket.send(t)}_generateOffers(e,t){const n=this,r=[];i("generating %s offers",e);for(let t=0;t<e;++t)s();function s(){const e=o(20).toString("hex");i("creating peer (from _generateOffers)");const t=n.peers[e]=n._createPeer({initiator:!0});t.once("signal",(t=>{r.push({offer:t,offer_id:h.hexToBinary(e)}),a()})),t.trackerTimeout=setTimeout((()=>{i("tracker timeout: destroying peer"),t.trackerTimeout=null,delete n.peers[e],t.destroy()}),5e4),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function a(){r.length===e&&(i("generated %s offers",e),t(r))}a()}_createPeer(e){const t=this;e=Object.assign({trickle:!1,config:t.client._rtcConfig,wrtc:t.client._wrtc},e);const n=new s(e);return n.once("error",r),n.once("connect",(function e(){n.removeListener("error",r),n.removeListener("connect",e)})),n;function r(e){t.client.emit("warning",new Error(`Connection error: ${e.message}`)),n.destroy()}}}function f(){}d.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,d._socketPool=u,e.exports=d})),n.register("a87qH",(function(e,t){var r=n("laHbQ").Buffer,i=function(){function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function s(o,c,h,l,u){"object"==typeof c&&(h=c.depth,l=c.prototype,u=c.includeNonEnumerable,c=c.circular);var d=[],f=[],p=void 0!==r;return void 0===c&&(c=!0),void 0===h&&(h=1/0),function o(h,g){if(null===h)return null;if(0===g)return h;var _,y;if("object"!=typeof h)return h;if(e(h,t))_=new t;else if(e(h,n))_=new n;else if(e(h,i))_=new i((function(e,t){h.then((function(t){e(o(t,g-1))}),(function(e){t(o(e,g-1))}))}));else if(s.__isArray(h))_=[];else if(s.__isRegExp(h))_=new RegExp(h.source,a(h)),h.lastIndex&&(_.lastIndex=h.lastIndex);else if(s.__isDate(h))_=new Date(h.getTime());else{if(p&&r.isBuffer(h))return _=r.allocUnsafe?r.allocUnsafe(h.length):new r(h.length),h.copy(_),_;e(h,Error)?_=Object.create(h):void 0===l?(y=Object.getPrototypeOf(h),_=Object.create(y)):(_=Object.create(l),y=l)}if(c){var b=d.indexOf(h);if(-1!=b)return f[b];d.push(h),f.push(_)}for(var m in e(h,t)&&h.forEach((function(e,t){var n=o(t,g-1),r=o(e,g-1);_.set(n,r)})),e(h,n)&&h.forEach((function(e){var t=o(e,g-1);_.add(t)})),h){var w;y&&(w=Object.getOwnPropertyDescriptor(y,m)),w&&null==w.set||(_[m]=o(h[m],g-1))}if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(h);for(m=0;m<v.length;m++){var C=v[m];(!(E=Object.getOwnPropertyDescriptor(h,C))||E.enumerable||u)&&(_[C]=o(h[C],g-1),E.enumerable||Object.defineProperty(_,C,{enumerable:!1}))}}if(u){var S=Object.getOwnPropertyNames(h);for(m=0;m<S.length;m++){var E,R=S[m];(E=Object.getOwnPropertyDescriptor(h,R))&&E.enumerable||(_[R]=o(h[R],g-1),Object.defineProperty(_,R,{enumerable:!1}))}}return _}(o,h)}function o(e){return Object.prototype.toString.call(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return s.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},s.__objToStr=o,s.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},s.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},s.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},s.__getRegExpFlags=a,s}();e.exports&&(e.exports=i)})),n.register("2kvC4",(function(e,t){var r=n("b3MRX");e.exports.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},e.exports.save=function(t){try{t?e.exports.storage.setItem("debug",t):e.exports.storage.removeItem("debug")}catch(e){}},e.exports.load=function(){let t;try{t=e.exports.storage.getItem("debug")}catch(e){}return!t&&void 0!==r&&"env"in r&&(t=void 0),t},e.exports.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.exports.storage=function(){try{return localStorage}catch(e){}}(),e.exports.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports.log=console.debug||console.log||(()=>{}),e.exports=n("jKp7z")(e.exports);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),n.register("jKp7z",(function(e,t){e.exports=function(e){function t(e){let n,i,s,o=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];n=s.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n("lKiFT"),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}})),n.register("lKiFT",(function(e,t){var n=1e3,r=6e4,i=36e5,s=864e5;function o(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var a,c,h=typeof e;if("string"===h&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var o=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*s;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*r;case"seconds":case"second":case"secs":case"sec":case"s":return o*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(e);if("number"===h&&isFinite(e))return t.long?(a=e,(c=Math.abs(a))>=s?o(a,c,s,"day"):c>=i?o(a,c,i,"hour"):c>=r?o(a,c,r,"minute"):c>=n?o(a,c,n,"second"):a+" ms"):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}})),n.register("khaS7",(function(e,t){
|
|
1
|
+
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function t(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var n=e.parcelRequirea18f;n.register("5snUO",(function(e,t){var r=n("laHbQ").Buffer,i=n("9BVjm"),s=n("46vcE"),o=n("8fFK8"),a=n("hbmjh");const c=n("2kvC4")("p2pt");e.exports=class extends o{constructor(e=[],t=""){super(),this.announceURLs=e,this.trackers={},this.peers={},this.msgChunks={},this.responseWaiting={},t&&this.setIdentifier(t),this._peerIdBuffer=s(20),this._peerId=this._peerIdBuffer.toString("hex"),this._peerIdBinary=this._peerIdBuffer.toString("binary"),c("my peer id: "+this._peerId)}setIdentifier(e){this.identifierString=e,this.infoHash=a.sync(e).toLowerCase(),this._infoHashBuffer=r.from(this.infoHash,"hex"),this._infoHashBinary=this._infoHashBuffer.toString("binary")}start(){this.on("peer",(e=>{let t=!1;this.peers[e.id]||(t=!0,this.peers[e.id]={},this.responseWaiting[e.id]={}),e.on("connect",(()=>{this.peers[e.id][e.channelName]=e,t&&this.emit("peerconnect",e)})),e.on("data",(t=>{if(this.emit("data",e,t),t=t.toString(),c("got a message from "+e.id),"^"===t[0])try{t=JSON.parse(t.slice(1)),e.respond=this._peerRespond(e,t.id);let n=this._chunkHandler(t);!1!==n&&(t.o&&(n=JSON.parse(n)),this.responseWaiting[e.id][t.id]?(this.responseWaiting[e.id][t.id]([e,n]),delete this.responseWaiting[e.id][t.id]):this.emit("msg",e,n),this._destroyChunks(t.id))}catch(e){console.log(e)}})),e.on("error",(t=>{this._removePeer(e),c("Error in connection : "+t)})),e.on("close",(()=>{this._removePeer(e),c("Connection closed with "+e.id)}))})),this.on("update",(e=>{const t=this.trackers[this.announceURLs.indexOf(e.announce)];this.emit("trackerconnect",t,this.getTrackerStats())})),this.on("warning",(e=>{this.emit("trackerwarning",e,this.getTrackerStats())})),this._fetchPeers()}addTracker(e){if(-1!==this.announceURLs.indexOf(e))throw new Error("Tracker already added");const t=this.announceURLs.push(e);this.trackers[t]=new i(this,e),this.trackers[t].announce(this._defaultAnnounceOpts())}removeTracker(e){const t=this.announceURLs.indexOf(e);if(-1===t)throw new Error("Tracker does not exist");this.trackers[t].peers=[],this.trackers[t].destroy(),delete this.trackers[t],delete this.announceURLs[t]}_removePeer(e){if(!this.peers[e.id])return!1;delete this.peers[e.id][e.channelName],0===Object.keys(this.peers[e.id]).length&&(this.emit("peerclose",e),delete this.responseWaiting[e.id],delete this.peers[e.id])}send(e,t,n=""){return new Promise(((r,i)=>{const s={id:""!==n?n:Math.floor(1e5*Math.random()+1e5),msg:t};"object"==typeof t&&(s.msg=JSON.stringify(t),s.o=1);try{if(!e.connected)for(const t in this.peers[e.id])if((e=this.peers[e.id][t]).connected)break;this.responseWaiting[e.id]||(this.responseWaiting[e.id]={}),this.responseWaiting[e.id][s.id]=r}catch(e){return i(Error("Connection to peer closed"+e))}let o=0,a="";for(;s.msg.length>0;)s.c=o,a=s.msg.slice(16e3),s.msg=s.msg.slice(0,16e3),a||(s.last=!0),e.send("^"+JSON.stringify(s)),s.msg=a,o++;c("sent a message to "+e.id)}))}requestMorePeers(){return new Promise((e=>{for(const e in this.trackers)this.trackers[e].announce(this._defaultAnnounceOpts());e(this.peers)}))}getTrackerStats(){let e=0;for(const t in this.trackers)this.trackers[t].socket&&this.trackers[t].socket.connected&&e++;return{connected:e,total:this.announceURLs.length}}destroy(){let e;for(e in this.peers)for(const t in this.peers[e])this.peers[e][t].destroy();for(e in this.trackers)this.trackers[e].destroy()}_peerRespond(e,t){return n=>this.send(e,n,t)}_chunkHandler(e){return this.msgChunks[e.id]||(this.msgChunks[e.id]=[]),this.msgChunks[e.id][e.c]=e.msg,!!e.last&&this.msgChunks[e.id].join("")}_destroyChunks(e){delete this.msgChunks[e]}_defaultAnnounceOpts(e={}){return null==e.numwant&&(e.numwant=50),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),e}_fetchPeers(){for(const e in this.announceURLs)this.trackers[e]=new i(this,this.announceURLs[e]),this.trackers[e].announce(this._defaultAnnounceOpts())}}})),n.register("9BVjm",(function(e,t){var r=n("a87qH");const i=n("2kvC4")("bittorrent-tracker:websocket-tracker");var s=n("khaS7"),o=n("46vcE"),a=n("38IZd"),c=n("sslC9"),h=n("8han8"),l=n("3xnRy");const u={};class d extends l{constructor(e,t){super(e,t),i("new websocket tracker %s",t),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.announce(e)}));const t=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(t.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(t);else{const n=Math.min(e.numwant,5);this._generateOffers(n,(e=>{t.numwant=n,t.offers=e,this._send(t)}))}}scrape(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.scrape(e)}));const t={action:"scrape",info_hash:Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map((e=>e.toString("binary"))):e.infoHash&&e.infoHash.toString("binary")||this.client._infoHashBinary};this._send(t)}destroy(e=f){if(this.destroyed)return e(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const e in this.peers){const t=this.peers[e];clearTimeout(t.trackerTimeout),t.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,u[this.announceUrl]&&(u[this.announceUrl].consumers-=1),u[this.announceUrl].consumers>0)return e();let t,n=u[this.announceUrl];if(delete u[this.announceUrl],n.on("error",f),n.once("close",e),!this.expectingResponse)return r();function r(){t&&(clearTimeout(t),t=null),n.removeListener("data",r),n.destroy(),n=null}t=setTimeout(r,h.DESTROY_TIMEOUT),n.once("data",r)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=e=>{this._onSocketError(e)},this._onSocketDataBound=e=>{this._onSocketData(e)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=u[this.announceUrl],this.socket)u[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const e=new URL(this.announceUrl);let t;this.client._proxyOpts&&(t="wss:"===e.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!t&&this.client._proxyOpts.socksProxy&&(t=new c.Agent(r(this.client._proxyOpts.socksProxy),"wss:"===e.protocol))),this.socket=u[this.announceUrl]=new a({url:this.announceUrl,agent:t}),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)}this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(e){if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse(e)}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error(`invalid action in WS response: ${e.action}`))}}_onAnnounceResponse(e){if(e.info_hash!==this.client._infoHashBinary)return void i("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,h.binaryToHex(e.info_hash),this.client.infoHash);if(e.peer_id&&e.peer_id===this.client._peerIdBinary)return;i("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);const t=e["failure reason"];if(t)return this.client.emit("warning",new Error(t));const n=e["warning message"];n&&this.client.emit("warning",new Error(n));const r=e.interval||e["min interval"];r&&this.setInterval(1e3*r);const s=e["tracker id"];if(s&&(this._trackerId=s),null!=e.complete){const t=Object.assign({},e,{announce:this.announceUrl,infoHash:h.binaryToHex(e.info_hash)});this.client.emit("update",t)}let o;if(e.offer&&e.peer_id&&(i("creating peer (from remote offer)"),o=this._createPeer(),o.id=h.binaryToHex(e.peer_id),o.once("signal",(t=>{const n={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:e.peer_id,answer:t,offer_id:e.offer_id};this._trackerId&&(n.trackerid=this._trackerId),this._send(n)})),this.client.emit("peer",o),o.signal(e.offer)),e.answer&&e.peer_id){const t=h.binaryToHex(e.offer_id);o=this.peers[t],o?(o.id=h.binaryToHex(e.peer_id),this.client.emit("peer",o),o.signal(e.answer),clearTimeout(o.trackerTimeout),o.trackerTimeout=null,delete this.peers[t]):i(`got unexpected answer: ${JSON.stringify(e.answer)}`)}}_onScrapeResponse(e){e=e.files||{};const t=Object.keys(e);0!==t.length?t.forEach((t=>{const n=Object.assign(e[t],{announce:this.announceUrl,infoHash:h.binaryToHex(t)});this.client.emit("scrape",n)})):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}_startReconnectTimer(){const e=Math.floor(3e5*Math.random())+Math.min(1e4*Math.pow(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout((()=>{this.retries++,this._openSocket()}),e),this.reconnectTimer.unref&&this.reconnectTimer.unref(),i("reconnecting socket in %s ms",e)}_send(e){if(this.destroyed)return;this.expectingResponse=!0;const t=JSON.stringify(e);i("send %s",t),this.socket.send(t)}_generateOffers(e,t){const n=this,r=[];i("generating %s offers",e);for(let t=0;t<e;++t)s();function s(){const e=o(20).toString("hex");i("creating peer (from _generateOffers)");const t=n.peers[e]=n._createPeer({initiator:!0});t.once("signal",(t=>{r.push({offer:t,offer_id:h.hexToBinary(e)}),a()})),t.trackerTimeout=setTimeout((()=>{i("tracker timeout: destroying peer"),t.trackerTimeout=null,delete n.peers[e],t.destroy()}),5e4),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function a(){r.length===e&&(i("generated %s offers",e),t(r))}a()}_createPeer(e){const t=this;(e=Object.assign({trickle:!1,config:t.client._rtcConfig,wrtc:t.client._wrtc},e)).config={iceServers:[{urls:"stun:stun.relay.metered.ca:80"},{urls:"turn:a.relay.metered.ca:80",username:"5cedc2adff8a8f714555bd79",credential:"azL7pmqh8DkgS50Y"},{urls:"turn:a.relay.metered.ca:80?transport=tcp",username:"5cedc2adff8a8f714555bd79",credential:"azL7pmqh8DkgS50Y"}]};const n=new s(e);return n.once("error",r),n.once("connect",(function e(){n.removeListener("error",r),n.removeListener("connect",e)})),n;function r(e){t.client.emit("warning",new Error(`Connection error: ${e.message}`)),n.destroy()}}}function f(){}d.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,d._socketPool=u,e.exports=d})),n.register("a87qH",(function(e,t){var r=n("laHbQ").Buffer,i=function(){function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function s(o,c,h,l,u){"object"==typeof c&&(h=c.depth,l=c.prototype,u=c.includeNonEnumerable,c=c.circular);var d=[],f=[],p=void 0!==r;return void 0===c&&(c=!0),void 0===h&&(h=1/0),function o(h,g){if(null===h)return null;if(0===g)return h;var _,y;if("object"!=typeof h)return h;if(e(h,t))_=new t;else if(e(h,n))_=new n;else if(e(h,i))_=new i((function(e,t){h.then((function(t){e(o(t,g-1))}),(function(e){t(o(e,g-1))}))}));else if(s.__isArray(h))_=[];else if(s.__isRegExp(h))_=new RegExp(h.source,a(h)),h.lastIndex&&(_.lastIndex=h.lastIndex);else if(s.__isDate(h))_=new Date(h.getTime());else{if(p&&r.isBuffer(h))return _=r.allocUnsafe?r.allocUnsafe(h.length):new r(h.length),h.copy(_),_;e(h,Error)?_=Object.create(h):void 0===l?(y=Object.getPrototypeOf(h),_=Object.create(y)):(_=Object.create(l),y=l)}if(c){var b=d.indexOf(h);if(-1!=b)return f[b];d.push(h),f.push(_)}for(var m in e(h,t)&&h.forEach((function(e,t){var n=o(t,g-1),r=o(e,g-1);_.set(n,r)})),e(h,n)&&h.forEach((function(e){var t=o(e,g-1);_.add(t)})),h){var w;y&&(w=Object.getOwnPropertyDescriptor(y,m)),w&&null==w.set||(_[m]=o(h[m],g-1))}if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(h);for(m=0;m<v.length;m++){var C=v[m];(!(E=Object.getOwnPropertyDescriptor(h,C))||E.enumerable||u)&&(_[C]=o(h[C],g-1),E.enumerable||Object.defineProperty(_,C,{enumerable:!1}))}}if(u){var S=Object.getOwnPropertyNames(h);for(m=0;m<S.length;m++){var E,R=S[m];(E=Object.getOwnPropertyDescriptor(h,R))&&E.enumerable||(_[R]=o(h[R],g-1),Object.defineProperty(_,R,{enumerable:!1}))}}return _}(o,h)}function o(e){return Object.prototype.toString.call(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return s.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},s.__objToStr=o,s.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},s.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},s.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},s.__getRegExpFlags=a,s}();e.exports&&(e.exports=i)})),n.register("2kvC4",(function(e,t){var r=n("b3MRX");e.exports.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},e.exports.save=function(t){try{t?e.exports.storage.setItem("debug",t):e.exports.storage.removeItem("debug")}catch(e){}},e.exports.load=function(){let t;try{t=e.exports.storage.getItem("debug")}catch(e){}return!t&&void 0!==r&&"env"in r&&(t=void 0),t},e.exports.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.exports.storage=function(){try{return localStorage}catch(e){}}(),e.exports.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports.log=console.debug||console.log||(()=>{}),e.exports=n("jKp7z")(e.exports);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),n.register("jKp7z",(function(e,t){e.exports=function(e){function t(e){let n,i,s,o=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];n=s.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n("lKiFT"),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}})),n.register("lKiFT",(function(e,t){var n=1e3,r=6e4,i=36e5,s=864e5;function o(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var a,c,h=typeof e;if("string"===h&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var o=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*s;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*r;case"seconds":case"second":case"secs":case"sec":case"s":return o*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(e);if("number"===h&&isFinite(e))return t.long?(a=e,(c=Math.abs(a))>=s?o(a,c,s,"day"):c>=i?o(a,c,i,"hour"):c>=r?o(a,c,r,"minute"):c>=n?o(a,c,n,"second"):a+" ms"):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}})),n.register("khaS7",(function(e,t){
|
|
2
2
|
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
3
|
const r=n("2kvC4")("simple-peer");var i=n("1jYnk"),s=n("46vcE"),o=n("8Amjo"),a=n("75EZr"),c=n("i54a9"),h=n("laHbQ").Buffer;const l=65536;function u(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class d extends o.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||d.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},d.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:i(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){return void this.destroy(c(e,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.destroy(c(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach((e=>{this.addStream(e)})),this._pc.ontrack=e=>{this._onTrack(e)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch((e=>{!t.address||t.address.endsWith(".local")?("Ignoring unsupported ICE candidate.",console.warn("Ignoring unsupported ICE candidate.")):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}}addStream(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),e.getTracks().forEach((t=>{this.addTrack(t,e)}))}}addTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const n=this._senderMap.get(e)||new Map;let r=n.get(t);if(r)throw r.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(e,t),n.set(t,r),this._senderMap.set(e,n),this._needsNegotiation()}replaceTrack(e,t,n){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const r=this._senderMap.get(e),i=r?r.get(n):null;if(!i)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,r),null!=i.replaceTrack?i.replaceTrack(t):this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const n=this._senderMap.get(e),r=n?n.get(t):null;if(!r)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(r):this.destroy(c(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),e.getTracks().forEach((t=>{this.removeTrack(t,e)}))}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a((()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1})))}negotiate(){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout((()=>{this._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(e){this._destroy(e,(()=>{}))}_destroy(e,t){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),a((()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()})))}_setupData(e){if(!e.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=l),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{const t=e.error instanceof Error?e.error:new Error(`Datachannel error: ${e.message} ${e.filename}:${e.lineno}:${e.colno}`);this.destroy(c(t,"ERR_DATA_CHANNEL"))};let t=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1}),5e3)}_read(){}_write(e,t,n){if(this.destroyed)return n(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>l?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout((()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))}),this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=u(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})};this._pc.setLocalDescription(e).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_OFFER"))}))}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach((e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=u(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()};this._pc.setLocalDescription(e).then((()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((t=>{Object.assign(e,t)})),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((n=>{const r=[];n.forEach((e=>{r.push(t(e))})),e(null,r)}),(t=>e(t))):this._pc.getStats.length>0?this._pc.getStats((n=>{if(this.destroyed)return;const r=[];n.result().forEach((e=>{const n={};e.names().forEach((t=>{n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,r.push(t(n))})),e(null,r)}),(t=>e(t))):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats(((t,n)=>{if(this.destroyed)return;t&&(n=[]);const r={},i={},s={};let o=!1;n.forEach((e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(r[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(i[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)}));const a=e=>{o=!0;let t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=r[e.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):"string"==typeof e.googRemoteAddress&&(n=e.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=Number(n[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach((e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)})),o||Object.keys(s).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(c(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)}))};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>l||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=h.from(t)),this.push(t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach((t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some((e=>e.id===t.id))||(this._remoteStreams.push(t),a((()=>{this._debug("on stream"),this.emit("stream",t)})))}))}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],r.apply(null,e)}}d.WEBRTC_SUPPORT=!!i(),d.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},d.channelConfig={},e.exports=d})),n.register("1jYnk",(function(e,t){e.exports=function(){if("undefined"==typeof globalThis)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}})),n.register("46vcE",(function(t,r){var i=n("b3MRX"),s=65536,o=n("fB9SF").Buffer,a=e.crypto||e.msCrypto;a&&a.getRandomValues?t.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=o.allocUnsafe(e);if(e>0)if(e>s)for(var r=0;r<e;r+=s)a.getRandomValues(n.slice(r,r+s));else a.getRandomValues(n);return"function"==typeof t?i.nextTick((function(){t(null,n)})):n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}})),n.register("fB9SF",(function(e,t){
|
|
4
4
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|