UNPKG

@liascript/exporter

Version:
1 lines 22.5 kB
!function(){function e(e,r,n,o){Object.defineProperty(e,r,{get:n,set:o,enumerable:!0,configurable:!0})}var r=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).parcelRequire55a5;r.register("kjbyJ",(function(n,o){e(n.exports,"Sync",(function(){return m}));var t=r("f1evb"),i=r("hnmIs"),a=r("9Klpk"),s=r("3bWnf"),c=r("eT7f3"),l=r("9WzNc"),d=r("div3d"),u=r("kb0qF"),p=r("bgoEC"),h=r("bWNdT"),f=r("32Euv"),v=r("auvHb"),g=r("48SmG"),y=r("733OA"),m=function(e){"use strict";(0,u.default)(n,e);var r=(0,h.default)(n);function n(){var e;return(0,a.default)(this,n),e=r.apply(this,arguments),(0,c.default)((0,t.default)(e),"syncFallbackTimer",null),e}return(0,s.default)(n,[{key:"destroy",value:function(){var e;null!==this.syncFallbackTimer&&(clearTimeout(this.syncFallbackTimer),this.syncFallbackTimer=null),(0,l.default)((0,d.default)(n.prototype),"destroy",this).call(this),null===(e=this.provider)||void 0===e||e.disconnect()}},{key:"connect",value:function(e){var r=this,o=this;return(0,i.default)((function(){var t,i,a,s;return(0,f.__generator)(this,(function(c){if((0,l.default)((0,d.default)(n.prototype),"connect",r).call(o,e),o.host=(null===(t=e.config)||void 0===t?void 0:t.host)||void 0,o.port=(null===(i=e.config)||void 0===i?void 0:i.port)?parseInt(e.config.port,10):void 0,o.peerPath=(null===(a=e.config)||void 0===a?void 0:a.path)||void 0,null===(s=e.config)||void 0===s?void 0:s.iceServers)try{o.iceServers=JSON.parse(e.config.iceServers)}catch(r){console.warn("PeerJS: invalid iceServers JSON, ignoring:",e.config.iceServers)}return window.Peer?o.init(!0):o.load(["//unpkg.com/peerjs@1.5.4/dist/peerjs.min.js"],o),[2]}))}))()}},{key:"init",value:function(e,r){var n=this,o=this.uniqueID();if(e&&window.Peer&&o)(function(e){return w.apply(this,arguments)})(o).then((function(e){var r={};n.host&&(r.host=n.host,r.secure=!0),void 0!==n.port&&(r.port=n.port),n.peerPath&&(r.path=n.peerPath),n.iceServers&&(r.config={iceServers:n.iceServers}),n.transport=new(0,g.PeerJSTransport)((0,p.default)({peer:window.Peer},Object.keys(r).length>0?{peerOptions:r}:{},n.password?{password:n.password}:{})),n.provider=new(0,y.GenericProvider)(n.db.doc,n.transport),n.db.setAwareness(n.provider.awareness);var o=!1,t=function(){o||(o=!0,null!==n.syncFallbackTimer&&(clearTimeout(n.syncFallbackTimer),n.syncFallbackTimer=null),n.sendConnect())};n.provider.on("synced",(function(e){console.log("PeerJS: document synchronized",e.synced),t()})),n.provider.on("status",(function(e){var r=e.state;console.log("PeerJS status: ".concat(r)),"connected"===r?n.syncFallbackTimer=setTimeout((function(){console.log("PeerJS: sync fallback, proceeding as first peer"),t()}),2e3):"disconnected"===r&&console.warn("PeerJS: disconnected")})),n.provider.pubsub.subscribe("*",(function(e,r){var o,t;null===(t=(o=n).onReceive)||void 0===t||t.call(o,r,e)})),n.provider.connect((0,p.default)({room:e},n.password?{password:n.password}:{}))}));else{var t="PeerJS unknown error";r?t="Could not load resource: "+r:window.Peer||(t="Could not load PeerJS library"),this.sendDisconnectError(t)}}},{key:"pubsubSend",value:function(e,r){var n;this.provider&&(this.provider.pubsub.publish(e,r),this.replyOnReceive&&(null===(n=this.onReceive)||void 0===n||n.call(this,e,r)))}}]),n}(v.Sync);function w(){return(w=(0,i.default)((function(e){var r,n;return(0,f.__generator)(this,(function(o){switch(o.label){case 0:return r=(new TextEncoder).encode(e),[4,crypto.subtle.digest("SHA-256",r)];case 1:return n=o.sent(),[2,Array.from(new Uint8Array(n)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")]}}))}))).apply(this,arguments)}})),r.register("9WzNc",(function(n,o){e(n.exports,"default",(function(){return a}));var t=r("jwduU");function i(e,r,n){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,n){var o=(0,t.default)(e,r);if(o){var i=Object.getOwnPropertyDescriptor(o,r);return i.get?i.get.call(n||e):i.value}},i(e,r,n)}function a(e,r,n){return i(e,r,n)}})),r.register("jwduU",(function(n,o){e(n.exports,"default",(function(){return i}));var t=r("div3d");function i(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=(0,t.default)(e)););return e}})),r.register("48SmG",(function(n,o){e(n.exports,"PeerJSTransport",(function(){return u}));var t=r("hnmIs"),i=r("9Klpk"),a=r("3bWnf"),s=r("bgoEC"),c=r("5ENmm"),l=r("6Wo7Q"),d=r("32Euv"),u=function(){"use strict";function e(r){if((0,i.default)(this,e),this._connected=!1,this._room="",this.peer=null,this.peerId="",this.peers=new Map,this.knownPeers=new Set,this.isCoordinator=!1,this.coordinatorPeerId="",this.roomPeers=new Set,this.reElectionInProgress=!1,!r.peer)throw new Error('PeerJSTransport requires the "peer" option. Please provide the PeerJS constructor: import Peer from "peerjs"; new PeerJSTransport({ peer: Peer, ... })');var n,o,t,a;this.options={peer:r.peer,peerOptions:null!==(n=r.peerOptions)&&void 0!==n?n:{},password:null!==(o=r.password)&&void 0!==o?o:"",maxConns:null!==(t=r.maxConns)&&void 0!==t?t:20+Math.floor(15*Math.random()),debug:null!==(a=r.debug)&&void 0!==a&&a}}return(0,a.default)(e,[{key:"connect",value:function(e){var r=this;return(0,t.default)((function(){return(0,d.__generator)(this,(function(n){if(r._connected)throw new Error("Already connected");return r._room=e.room,r.coordinatorPeerId="yjs-coordinator-".concat(r._room),[2,new Promise((function(e,n){try{var o=new r.options.peer(r.coordinatorPeerId,(0,s.default)({debug:r.options.debug?3:0},r.options.peerOptions)),t=setTimeout((function(){o.destroy(),r.createRegularPeer(e,n)}),3e3);o.on("open",(function(n){clearTimeout(t),n===r.coordinatorPeerId&&(r.log("Coordinator: claimed ID"),r.peer=o,r.peerId=n,r.isCoordinator=!0,r.roomPeers.add(r.peerId),r._connected=!0,r.setupPeerDiscovery(),r.peer.on("connection",(function(e){r.handleIncomingConnection(e)})),e())})),o.on("error",(function(i){clearTimeout(t),i.message.includes("ID is taken")||i.message.includes("taken")||i.message.includes("already")||"unavailable-id"===i.type?(o.destroy(),r.createRegularPeer(e,n)):(r.log("❌ Unexpected error claiming coordinator:",i),o.destroy(),r.createRegularPeer(e,n))}))}catch(e){n(e)}}))]}))}))()}},{key:"createRegularPeer",value:function(e,r){var n=this,o=Math.random().toString(36).substring(7);this.peerId="yjs-".concat(this._room,"-").concat(o),this.peer=new this.options.peer(this.peerId,(0,s.default)({debug:this.options.debug?3:0},this.options.peerOptions)),this.peer.on("open",(function(r){n.peerId=r,n._connected=!0,n.setupPeerDiscovery(),n.peer.on("connection",(function(e){n.handleIncomingConnection(e)})),n.setupCrossBrowserDiscovery().then((function(){e()})).catch((function(r){n.log("⚠️ Cross-browser discovery failed, continuing with BroadcastChannel only:",r),e()}))})),this.peer.on("error",(function(e){n.log("Peer error:",e),n._connected||r(e)})),this.peer.on("disconnected",(function(){n.log("Peer disconnected, attempting reconnect...")}))}},{key:"disconnect",value:function(){if(this._connected){if(this.discoveryInterval&&(clearInterval(this.discoveryInterval),this.discoveryInterval=void 0),this.broadcastChannel&&(this.broadcastChannel.postMessage({type:"leave",peerId:this.peerId}),this.broadcastChannel.close(),this.broadcastChannel=void 0),this.coordinatorConn){try{this.sendCoordinationMessage(this.coordinatorConn,{type:"leave",peerId:this.peerId}),this.coordinatorConn.close()}catch(e){}this.coordinatorConn=void 0}if(this.isCoordinator){var e=!0,r=!1,n=void 0;try{for(var o,t=this.roomPeers[Symbol.iterator]();!(e=(o=t.next()).done);e=!0){var i=o.value;if(i!==this.peerId){var a=this.peers.get(i);if(a&&a.connected)try{this.sendCoordinationMessage(a.conn,{type:"coordinator-leaving",peerId:this.peerId})}catch(e){}}}}catch(e){r=!0,n=e}finally{try{e||null==t.return||t.return()}finally{if(r)throw n}}this.isCoordinator=!1,this.roomPeers.clear()}var s=!0,c=!1,l=void 0;try{for(var d,u=this.peers.values()[Symbol.iterator]();!(s=(d=u.next()).done);s=!0){var p=d.value;try{p.conn.close()}catch(e){}}}catch(e){c=!0,l=e}finally{try{s||null==u.return||u.return()}finally{if(c)throw l}}this.peers.clear(),this.knownPeers.clear(),this.reElectionInProgress=!1,this.peer&&(this.peer.destroy(),this.peer=null),this._connected=!1}}},{key:"onPeerConnect",value:function(e){var r=this;return this._peerConnectCallback=e,function(){r._peerConnectCallback=void 0}}},{key:"send",value:function(e){if(this._connected){var r=this.options.password?this.encrypt(e,this.options.password):e,n=!0,o=!1,t=void 0;try{for(var i,a=this.peers.values()[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var s=i.value;if(s.connected)try{s.conn.send(r)}catch(e){this.log("Error sending to peer:",s.peerId,e)}}}catch(e){o=!0,t=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw t}}}else this.log("Not connected, cannot send")}},{key:"onMessage",value:function(e){var r=this;return this._callback=e,function(){r._callback=void 0}}},{key:"isConnected",get:function(){return this._connected}},{key:"connectedPeers",get:function(){return Array.from(this.peers.values()).filter((function(e){return e.connected})).length}},{key:"setupPeerDiscovery",value:function(){var e=this;if("undefined"!=typeof BroadcastChannel){var r="yjs-peerjs-".concat(this._room);this.broadcastChannel=new BroadcastChannel(r),this.broadcastChannel.onmessage=function(r){var n=r.data;n.peerId!==e.peerId&&("announce"===n.type?(e.knownPeers.add(n.peerId),e.connectToPeer(n.peerId)):"leave"===n.type&&(e.knownPeers.delete(n.peerId),e.removePeer(n.peerId)))},this.announcePeer(),this.discoveryInterval=setInterval((function(){e._connected&&e.peers.size<e.options.maxConns&&e.announcePeer()}),5e3)}else this.log("❌ BroadcastChannel not available in this browser")}},{key:"announcePeer",value:function(){if(this.broadcastChannel){var e={type:"announce",peerId:this.peerId};this.broadcastChannel.postMessage(e)}}},{key:"setupCrossBrowserDiscovery",value:function(){var e=this;return(0,t.default)((function(){return(0,d.__generator)(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,500)}))];case 1:return r.sent(),[2,new Promise((function(r,n){var o=!1,t=setTimeout((function(){if(!o){o=!0;var r=new Error("Timeout connecting to coordinator");e.log("⏱️ Timeout connecting to coordinator"),n(r)}}),5e3);try{var i=e.peer.connect(e.coordinatorPeerId,{reliable:!0,serialization:"binary",metadata:{role:"peer",peerId:e.peerId}});i.on("open",(function(){var n,a;if(!o){o=!0,clearTimeout(t),e.log("Connected to coordinator"),e.coordinatorConn=i;var s={conn:i,connected:!0,peerId:e.coordinatorPeerId};e.peers.set(e.coordinatorPeerId,s),e.knownPeers.add(e.coordinatorPeerId),null===(a=(n=e)._peerConnectCallback)||void 0===a||a.call(n,e.coordinatorPeerId),e.sendCoordinationMessage(i,{type:"join",peerId:e.peerId}),i.on("data",(function(r){var n=r instanceof Uint8Array?r:new Uint8Array(r),o=e.tryDecodeCoordinationMessage(n);if(o)e.handleCoordinatorMessage(o);else if(e._callback)try{var t=e.options.password?e.decrypt(n,e.options.password):n;e._callback(t)}catch(r){e.log("Error handling coordinator data:",r)}})),i.on("close",(function(){e.log("Coordinator disconnected"),e.peers.delete(e.coordinatorPeerId),e.knownPeers.delete(e.coordinatorPeerId),e.handleCoordinatorDisconnect()})),r()}})),i.on("error",(function(r){o||(o=!0,clearTimeout(t),e.log("❌ Failed to connect to coordinator:",r.message),n(r))}))}catch(r){o||(o=!0,clearTimeout(t),e.log("⚠️ Error connecting to coordinator:",r),n(r))}}))]}}))}))()}},{key:"becomeCoordinator",value:function(){var e=this;this.isCoordinator=!0,this.roomPeers.add(this.peerId),this.log("👑 I am now the coordinator. Room peers:",Array.from(this.roomPeers)),setInterval((function(){if(e.isCoordinator){var r=Array.from(e.roomPeers).sort();r.length>0&&r[0]!==e.peerId&&(e.log("⚠️ I am no longer the lowest ID peer, stepping down as coordinator"),e.isCoordinator=!1)}}),1e4)}},{key:"handleCoordinatorMessage",value:function(e){switch(e.type){case"peer-list":var r=!0,n=!1,o=void 0;try{for(var t,i=e.peers[Symbol.iterator]();!(r=(t=i.next()).done);r=!0){var a=t.value;a===this.peerId||this.peers.has(a)||(this.knownPeers.add(a),this.connectToPeer(a))}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}break;case"peer-joined":e.peerId===this.peerId||this.peers.has(e.peerId)||(this.knownPeers.add(e.peerId),this.connectToPeer(e.peerId));break;case"peer-left":this.knownPeers.delete(e.peerId),this.removePeer(e.peerId);break;case"coordinator-change":this.coordinatorPeerId=e.coordinatorId;break;case"coordinator-leaving":this.log("Coordinator leaving, re-election starting"),this.handleCoordinatorDisconnect()}}},{key:"handleCoordinatorDisconnect",value:function(){var e=this;if(this.reElectionInProgress)this.log("⏭️ Re-election already in progress, skipping");else if("undefined"==typeof navigator||navigator.onLine){this.log("🗳️ Coordinator disconnected, starting re-election"),this.reElectionInProgress=!0,this.coordinatorConn=void 0;var r=[this.peerId].concat((0,l.default)(Array.from(this.knownPeers)),(0,l.default)(Array.from(this.peers.keys()))).filter((function(r){return r!==e.coordinatorPeerId}));r.sort();var n=r[0];this.log("🗳️ Coordinator election: Lowest peer ID is",n),n===this.peerId?(this.log("👑 I have the lowest ID, attempting to claim coordinator role"),this.transitionToCoordinator()):(this.log("⏳ Waiting for new coordinator:",n),setTimeout((function(){e.attemptCoordinatorConnection()}),2e3))}else{this.log("📴 Offline – deferring re-election until network returns");window.addEventListener("online",(function(){e.log("🌐 Network restored – resuming re-election"),e.handleCoordinatorDisconnect()}),{once:!0})}}},{key:"attemptCoordinatorConnection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=this;if(e>=5)return this.log("❌ Failed to connect to coordinator after",5,"attempts"),this.log("🔄 Attempting to become coordinator as fallback"),void this.transitionToCoordinator();this.log("🔌 Attempting to connect to coordinator (attempt ".concat(e+1,"/").concat(5,")")),this.setupCrossBrowserDiscovery().then((function(){r.log("✅ Successfully connected to new coordinator"),r.reElectionInProgress=!1})).catch((function(n){r.log("⚠️ Failed to connect to coordinator (attempt ".concat(e+1,"):"),n);var o=1e3*Math.pow(1.5,e);setTimeout((function(){r.attemptCoordinatorConnection(e+1)}),o)}))}},{key:"transitionToCoordinator",value:function(){var e=this;return(0,t.default)((function(){var r,n,o;return(0,d.__generator)(this,(function(t){switch(t.label){case 0:e.log("🔄 Transitioning to coordinator role..."),r=Array.from(e.peers.entries()),n=e._callback,e._room,e.peer&&e.peer.destroy(),e.peers.clear(),e._connected=!1,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise((function(o,t){var i=new e.options.peer(e.coordinatorPeerId,(0,s.default)({debug:e.options.debug?3:0},e.options.peerOptions)),a=setTimeout((function(){e.log("❌ Timeout claiming coordinator ID"),i.destroy(),t(new Error("Timeout claiming coordinator ID"))}),5e3);i.on("open",(function(t){if(clearTimeout(a),t===e.coordinatorPeerId){e.log("✅ Successfully claimed coordinator ID:",t),e.peer=i,e.peerId=t,e.isCoordinator=!0,e.roomPeers.clear(),e.roomPeers.add(e.peerId),e._connected=!0,e._callback=n,e.reElectionInProgress=!1,e.setupPeerDiscovery(),e.peer.on("connection",(function(r){e.handleIncomingConnection(r)})),e.log("🔗 Re-establishing connections with",r.length,"known peers");var s=!0,l=!1,d=void 0;try{for(var u,p=r[Symbol.iterator]();!(s=(u=p.next()).done);s=!0){var h=(0,c.default)(u.value,2),f=h[0];h[1];f!==e.coordinatorPeerId&&(e.knownPeers.add(f),e.roomPeers.add(f))}}catch(e){l=!0,d=e}finally{try{s||null==p.return||p.return()}finally{if(l)throw d}}o()}})),i.on("error",(function(r){clearTimeout(a),e.log("❌ Error claiming coordinator ID:",r),i.destroy(),t(r)}))}))];case 2:return t.sent(),[3,4];case 3:return o=t.sent(),e.log("❌ Failed to transition to coordinator:",o),e.reElectionInProgress=!1,e.log("🔄 Falling back to regular peer"),e.reestablishAsRegularPeer(),[3,4];case 4:return[2]}}))}))()}},{key:"reestablishAsRegularPeer",value:function(){var e=this,r=Math.random().toString(36).substring(7);this.peerId="yjs-".concat(this._room,"-").concat(r),this.isCoordinator=!1,this.peer=new this.options.peer(this.peerId,(0,s.default)({debug:this.options.debug?3:0},this.options.peerOptions)),this.peer.on("open",(function(r){e.peerId=r,e._connected=!0,e.log("✅ Reestablished as regular peer:",r),e.setupPeerDiscovery(),e.peer.on("connection",(function(r){e.handleIncomingConnection(r)})),e.peer.on("disconnected",(function(){e.log("Peer disconnected, attempting reconnect...")})),e.attemptCoordinatorConnection()})),this.peer.on("error",(function(r){e.log("❌ Error reestablishing as regular peer:",r);try{var n;null===(n=e.peer)||void 0===n||n.destroy()}catch(e){}e.peer=null,e._connected=!1;var o=function(){e.log("🌐 Network restored – retrying reestablish as regular peer"),e.reestablishAsRegularPeer()};"undefined"==typeof navigator||navigator.onLine?setTimeout(o,3e3):window.addEventListener("online",o,{once:!0})}))}},{key:"connectToPeer",value:function(e){if(e!==this.peerId&&!this.peers.has(e)&&!(this.peers.size>=this.options.maxConns||this.peerId&&this.peerId>e))try{var r=this.peer.connect(e,{reliable:!0,serialization:"binary"});if(!r)return void this.log("Failed to create connection object for:",e);this.setupConnection(r,e)}catch(r){this.log("Error connecting to peer:",e,r)}}},{key:"handleIncomingConnection",value:function(e){var r=this,n=e.peer;if(this.peers.has(n))e.close();else{if(this.peers.size>=this.options.maxConns)return this.log("Max connections reached, rejecting peer:",n),void e.close();this.isCoordinator&&(this.roomPeers.add(n),e.on("close",(function(){r.roomPeers.delete(n);var e=!0,o=!1,t=void 0;try{for(var i,a=r.roomPeers[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var s=i.value;if(s!==r.peerId){var c=r.peers.get(s);if(c&&c.connected)try{r.sendCoordinationMessage(c.conn,{type:"peer-left",peerId:n})}catch(e){r.log("⚠️ Failed to notify peer of departure:",s)}}}}catch(e){o=!0,t=e}finally{try{e||null==a.return||a.return()}finally{if(o)throw t}}}))),this.setupConnection(e,n)}}},{key:"setupConnection",value:function(e,r){var n=this,o={conn:e,connected:!1,peerId:r};this.peers.set(r,o),e.on("open",(function(){var e,t;o.connected=!0,n.knownPeers.add(r),null===(t=(e=n)._peerConnectCallback)||void 0===t||t.call(e,r)})),e.on("data",(function(o){var t=o instanceof Uint8Array?o:new Uint8Array(o),i=n.tryDecodeCoordinationMessage(t);if(i){if("coordinator-change"===i.type||"coordinator-leaving"===i.type||"peer-joined"===i.type||"peer-left"===i.type||"peer-list"===i.type)return void n.handleCoordinatorMessage(i);if("join"===i.type&&n.isCoordinator){var a=Array.from(n.roomPeers).filter((function(e){return e!==n.peerId&&e!==r}));n.sendCoordinationMessage(e,{type:"peer-list",peers:a});var s=!0,c=!1,l=void 0;try{for(var d,u=n.roomPeers[Symbol.iterator]();!(s=(d=u.next()).done);s=!0){var p=d.value;if(p!==n.peerId&&p!==r){var h=n.peers.get(p);if(h&&h.connected)try{n.sendCoordinationMessage(h.conn,{type:"peer-joined",peerId:r})}catch(e){n.log("⚠️ Failed to notify peer of new joiner:",p)}}}}catch(e){c=!0,l=e}finally{try{s||null==u.return||u.return()}finally{if(c)throw l}}return}}if(n._callback)try{var f=n.options.password?n.decrypt(t,n.options.password):t;n._callback(f)}catch(e){n.log("Error handling peer data:",e)}})),e.on("close",(function(){n.removePeer(r)})),e.on("error",(function(e){n.log("⚠️ Connection error:",r,e),n.removePeer(r)})),setTimeout((function(){}),1e3)}},{key:"removePeer",value:function(e){var r=this.peers.get(e);if(r){try{r.conn.close()}catch(e){}this.peers.delete(e)}}},{key:"sendCoordinationMessage",value:function(e,r){try{var n=JSON.stringify(r),o=(new TextEncoder).encode(n);e.send(o)}catch(e){this.log("Error encoding coordination message:",e)}}},{key:"tryDecodeCoordinationMessage",value:function(e){try{var r=(new TextDecoder).decode(e),n=JSON.parse(r);return n&&"object"==typeof n&&n.type&&"string"==typeof n.type?n:null}catch(e){return null}}},{key:"encrypt",value:function(e,r){for(var n=this.hashPassword(r),o=new Uint8Array(e.length),t=0;t<e.length;t++)o[t]=e[t]^n[t%n.length];return o}},{key:"decrypt",value:function(e,r){return this.encrypt(e,r)}},{key:"hashPassword",value:function(e){return(new TextEncoder).encode(e)}},{key:"log",value:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o;this.options.debug&&(o=console).log.apply(o,["[PeerJSTransport]"].concat((0,l.default)(r)))}}]),e}()})),r.register("84cK9",(function(e,r){var n,o,t=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(r){try{return n.call(null,e,0)}catch(r){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var c,l=[],d=!1,u=-1;function p(){d&&c&&(d=!1,c.length?l=c.concat(l):u=-1,l.length&&h())}function h(){if(!d){var e=s(p);d=!0;for(var r=l.length;r;){for(c=l,l=[];++u<r;)c&&c[u].run();u=-1,r=l.length}c=null,d=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{return o(e)}catch(r){try{return o.call(null,e)}catch(r){return o.call(this,e)}}}(e)}}function f(e,r){this.fun=e,this.array=r}function v(){}t.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];l.push(new f(e,r)),1!==l.length||d||s(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=v,t.addListener=v,t.once=v,t.off=v,t.removeListener=v,t.removeAllListeners=v,t.emit=v,t.prependListener=v,t.prependOnceListener=v,t.listeners=function(e){return[]},t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}}))}();