diff --git a/data/emu-main.js b/data/emu-main.js index fda47ba..a7118c2 100644 --- a/data/emu-main.js +++ b/data/emu-main.js @@ -1155,35 +1155,31 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { } } var _0x18a437 = window.URL || window.webkitURL; - var isCompressed = function(data) { + var isCompressed = function(data) { //https://www.garykessler.net/library/file_sigs.html if ((data[0] === 80 && data[1] === 75) && ((data[2] === 3 && data[3] === 4) || (data[2] === 5 && data[3] === 6) || (data[2] === 7 && data[3] === 8))) { return 'zip'; - } else if (data[0] === 55 && data[1] === 122 && data[2] === 188 && data[3] === 175 && data[3] === 39 && data[5] === 28) { + } else if (data[0] === 55 && data[1] === 122 && data[2] === 188 && data[3] === 175 && data[4] === 39 && data[5] === 28) { return '7z'; - } else if (data[0] === 82 && data[1] === 97 && data[2] === 114 && data[3] === 33 && data[3] === 26 && data[5] === 7 && data[6] === 0) { + } else if ((data[0] === 82 && data[1] === 97 && data[2] === 114 && data[3] === 33 && data[4] === 26 && data[5] === 7) && ((data[6] === 0) || (data[6] === 1 && data[7] == 0))) { return 'rar'; } }, - _0xa24f60 = function(_0xbf2b8b) { - var _0x17edbf = 'importScripts("'+_0xbf2b8b+'");', - _0x2c1832 = new Blob([_0x17edbf], { + extractFile = async function(url) { + var fileData = await (await fetch(url)).text(), + _0x2c1832 = new Blob([fileData], { 'type': 'application/javascript' }), _0x501a8e = window.URL.createObjectURL(_0x2c1832); - return new Promise(function(_0x2d8147, _0x1b03b2) { - _0x2d8147(new Worker(_0x501a8e)); - }); + return new Worker(_0x501a8e); }, - _0x41d0bd = function(_0x3a41ff, _0x2b541e) { - var _0x2c1832 = ''; - if ('rar' == _0x2b541e) _0x2c1832 = '\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return \'' .concat(_0x3a41ff+'.mem', '\';\n }\n};\nimportScripts("').concat(_0x3a41ff, '");\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '); - var _0x22326b = new Blob([_0x2c1832], { - 'type': 'application/javascript' - }), - _0x3635b1 = window.URL.createObjectURL(_0x22326b); - return new Promise(function(_0x2d169f, _0x341b0d) { - _0x2d169f(new Worker(_0x3635b1)); - }); + extractRar = async function(url) { + var fileData = await (await fetch(url)).text(); + var _0x2c1832 = '\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return \''+url+'.mem\';\n }\n};\n'+fileData+'\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '; + var _0x22326b = new Blob([_0x2c1832], { + 'type': 'application/javascript' + }), + _0x3635b1 = window.URL.createObjectURL(_0x22326b); + return new Worker(_0x3635b1); }, _0x24de8d = null, _0x4e171c = null, @@ -1496,6 +1492,10 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { } var start = function(startName) { _0x1cfda7.innerHTML = 'Game Data ready'; + if (!startName) { + _0x1cfda7.innerHTML = 'Invalid Rom'; + return; + } try { _0x4bd781(); _0x5f3757(_0x55627a); @@ -1529,6 +1529,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { _0x468801 += _0x52e6f3.data.data.length; _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x52e6f3.data.data, true, false); _0x55627a.startName = _0x52e6f3.data.file; + _0x52e6f3.target.terminate(); + start(_0x55627a.startName); } catch (_0x210043) { console.log(_0x210043); } @@ -1547,19 +1549,19 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { var _0x20a78c = _0x1844e3.slice ? _0x1844e3.slice(0, 10) : _0x1844e3.subarray(0, 10), _0x1761cf = isCompressed(_0x20a78c); if (_0x1761cf === "7z") { - _0xa24f60(_0x17edbf).then(function(_0xea623e) { + extractFile(_0x17edbf).then(function(_0xea623e) { _0xea623e.onmessage = _0x99321; _0xea623e.postMessage(_0x1844e3); }) _0x1e67c4 = true; } else if (_0x1761cf === 'zip') { - _0xa24f60(_0x2c1832).then(function(_0x5a81e4) { + extractFile(_0x2c1832).then(function(_0x5a81e4) { _0x5a81e4.onmessage = _0x99321; _0x5a81e4.postMessage(_0x1844e3); }) _0x1e67c4 = true; } else if (_0x1761cf === 'rar') { - _0x41d0bd(_0x4ce206, 'rar').then(function(_0x5f204f) { + extractRar(_0x4ce206).then(function(_0x5f204f) { _0x5f204f.onmessage = _0x99321; _0x5f204f.postMessage(_0x1844e3); }) @@ -1709,17 +1711,17 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { _0x3de3e4 = _0x1097ca.slice ? _0x1097ca.slice(0, 10) : _0x1097ca.subarray(0, 10), _0x17f736 = isCompressed(_0x3de3e4); if (_0x17f736 === '7z') { - _0xa24f60(_0x17edbf).then(function(_0x20601d) { + extractFile(_0x17edbf).then(function(_0x20601d) { _0x20601d.onmessage = _0x59c7c1; _0x20601d.postMessage(_0x1097ca); }) } else if (_0x17f736 === 'zip') { - _0xa24f60(_0x2c1832).then(function(_0x46622d) { + extractFile(_0x2c1832).then(function(_0x46622d) { _0x46622d.onmessage = _0x59c7c1; _0x46622d.postMessage(_0x1097ca); }) } else if (_0x17f736 === 'rar') { - _0x41d0bd(_0x4ce206, 'rar').then(function(_0x2ecd24) { + extractRar(_0x4ce206).then(function(_0x2ecd24) { _0x2ecd24.onmessage = _0x59c7c1; _0x2ecd24.postMessage(_0x1097ca); }) @@ -1840,11 +1842,11 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { _0x3a6560 = !0x1, _0x12e229 = _0x3cff36.slice ? _0x3cff36.slice(0x0, 0xa) : _0x3cff36.subarray(0x0, 0xa), _0x80852b = isCompressed(_0x12e229); - '7z' === _0x80852b ? (_0xa24f60(_0x17edbf).then(function(_0x1b6a80) { + '7z' === _0x80852b ? (extractFile(_0x17edbf).then(function(_0x1b6a80) { _0x1b6a80.onmessage = _0x19a43e, _0x1b6a80.postMessage(_0x3cff36); - }), _0x3a6560 = true) : 'zip' !== _0x80852b || ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x3ea97.system) ? 'rar' === _0x80852b && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x259be0) { + }), _0x3a6560 = true) : 'zip' !== _0x80852b || ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x3ea97.system) ? 'rar' === _0x80852b && (extractRar(_0x4ce206).then(function(_0x259be0) { _0x259be0.onmessage = _0x19a43e, _0x259be0.postMessage(_0x3cff36); - }), _0x3a6560 = true) : (_0xa24f60(_0x2c1832).then(function(_0x31c70d) { + }), _0x3a6560 = true) : (extractFile(_0x2c1832).then(function(_0x31c70d) { _0x31c70d.onmessage = _0x19a43e, _0x31c70d.postMessage(_0x3cff36); }), _0x3a6560 = true), _0x3a6560 || (_0x468801 += _0x3cff36.length, _0x50119.innerHTML = 'BIOS ready', _0x4d7024._FS.createDataFile('/', _0x5e7c8b, _0x3cff36, true, !0x1), _0x452592()); }, @@ -2001,8 +2003,9 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { 0x4 === _0x3f49ec.data.t && _0x3f49ec.data.total > 0x0 && (_0x2c1832.innerHTML = _0xa88a13.localization('Decompress Game Core')+' ' .concat(Math.floor(_0x3f49ec.data.current / _0x3f49ec.data.total * 0x64), '%')); } }; - _0xa24f60(_0x17edbf).then(function(_0x48c633) { - _0x48c633.onmessage = _0x21d6a1, _0x48c633.postMessage(_0x18cb26); + extractFile(_0x17edbf).then(function(_0x48c633) { + _0x48c633.onmessage = _0x21d6a1; + _0x48c633.postMessage(_0x18cb26); }); }, _this = this, diff --git a/data/emulator.min.js b/data/emulator.min.js index d489cdf..39f73d3 100644 --- a/data/emulator.min.js +++ b/data/emulator.min.js @@ -1 +1 @@ -var EJS=function(n){window.EJS_MODULES=n;var o={},i=[];function a(e){if(o[e])return o[e].exports;i.push(e);var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}return window.aba=function(){return i.sort(function(e,t){return t'+n.localization("CORS Error")+"":t.innerHTML=''+n.localization("Network Error")+""}},null,null,null,null,null,function(e,t,n){!function(e){"use strict";function o(){}function t(e){var t=this,n=window;this.update=o,this.requestAnimationFrame=e||n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame,this.tickFunction=function(){t.update(),t.startTicker()},this.startTicker=function(){t.requestAnimationFrame.apply(n,[t.tickFunction])}}function n(){}function i(e,t){this.listener=e,this.gamepadGetter=t,this.knownGamepads=[]}function a(t){this.listener=t,window.addEventListener("gamepadconnected",function(e){t._connect(e.gamepad)}),window.addEventListener("gamepaddisconnected",function(e){t._disconnect(e.gamepad)})}function l(e){this.updateStrategy=e||new t,this.gamepads=[],this.listeners={},this.platform=r,this.deadzone=.03,this.maximizeThreshold=.97}var r={getType:function(){return"null"},isSupported:function(){return!1},update:o};t.prototype.start=function(e){this.update=e||o,this.startTicker()},n.prototype.update=o,n.prototype.start=function(e){this.update=e||o},i.factory=function(e){var t=r,n=window&&window.navigator;return n&&(void 0!==n.getGamepads?t=new i(e,function(){return n.getGamepads()}):void 0!==n.webkitGamepads?t=new i(e,function(){return n.webkitGamepads()}):void 0!==n.webkitGetGamepads&&(t=new i(e,function(){return n.webkitGetGamepads()}))),t},i.getType=function(){return"WebKit"},i.prototype.getType=function(){return i.getType()},i.prototype.isSupported=function(){return!0},i.prototype.update=function(){for(var e,t=Array.prototype.slice.call(this.gamepadGetter(),0),n=this.knownGamepads.length-1;0<=n;n--)e=this.knownGamepads[n],t.indexOf(e)<0&&(this.knownGamepads.splice(n,1),this.listener._disconnect(e));for(n=0;n>16&255,i[a++]=t>>8&255,i[a++]=255&t;return 2===n&&(t=c[e.charCodeAt(s)]<<2|c[e.charCodeAt(s+1)]>>4,i[a++]=255&t),1===n&&(t=c[e.charCodeAt(s)]<<10|c[e.charCodeAt(s+1)]<<4|c[e.charCodeAt(s+2)]>>2,i[a++]=t>>8&255,i[a++]=255&t),i},n.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,r=n-o;a>18&63]+s[o>>12&63]+s[o>>6&63]+s[63&o]);return i.join("")}(e,a,r>2]+s[t<<4&63]+"==")):2==o&&(t=(e[n-2]<<8)+e[n-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"=")),i.join("")};for(var s=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=o.length;i>>1;case"base64":return T(e).length;default:if(i)return o?-1:S(e).length;t=(""+t).toLowerCase(),i=!0}}function n(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function s(e,t,n,o,i){if(0===e.length)return-1;if("string"==typeof n?(o=n,n=0):2147483647=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:c(e,t,n,o,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,n):c(e,[t],n,o,i);throw new TypeError("val must be string, number or Buffer")}function c(e,t,n,o,i){var a=1,r=e.length,s=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;r/=a=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i)for(var l=-1,d=n;d>>10&1023|55296),d=56320|1023&d),o.push(d),i+=u}var f=o,p=f.length;if(p<=g)return String.fromCharCode.apply(String,f);for(var h="",m=0;mthis.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var a=this,r=t,s=n,c=a.length;(!s||s<0||ct&&(e+=" ... "),""},u.prototype.compare=function(e,t,n,o,i){if(A(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===n&&(n=e?e.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(i<=o&&n<=t)return 0;if(i<=o)return-1;if(n<=t)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(o>>>=0),r=(n>>>=0)-(t>>>=0),s=Math.min(a,r),c=this.slice(o,i),l=e.slice(t,n),d=0;d>>=0,isFinite(n)?(n>>>=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var i=this.length-t;if((void 0===n||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");o=o||"utf8";for(var a,r,s,c,l,d=!1;;)switch(o){case"hex":var u=this,f=e,p=t,h=n,m=(p=Number(p)||0,u.length-p);(!h||(h=Number(h))>m)&&(h=m),(m=f.length)/2>8,i.push(n%256),i.push(o);return i}(e,(a=this).length-s),a,s,r);default:if(d)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),d=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var g=4096;function l(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(ne.length)throw new RangeError("Index out of range")}function v(e,t,n,o){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function b(e,t,n,o,i){return t=+t,n>>>=0,i||v(e,0,n,4),a.write(e,t,n,o,23,4),n+4}function w(e,t,n,o,i){return t=+t,n>>>=0,i||v(e,0,n,8),a.write(e,t,n,o,52,8),n+8}u.prototype.slice=function(e,t){var n=this.length,n=((e=~~e)<0?(e+=n)<0&&(e=0):n>>=0,t>>>=0,n||l(e,t,this.length);for(var o=this[e],i=1,a=0;++a>>=0,t>>>=0,n||l(e,t,this.length);for(var o=this[e+--t],i=1;0>>=0,t||l(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||l(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||l(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||l(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||l(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||l(e,t,this.length);for(var o=this[e],i=1,a=0;++a=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||l(e,t,this.length);for(var o=t,i=1,a=this[e+--o];0=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||l(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||l(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt16BE=function(e,t){e>>>=0,t||l(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||l(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||l(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return e>>>=0,t||l(e,4,this.length),a.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||l(e,4,this.length),a.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||l(e,8,this.length),a.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||l(e,8,this.length),a.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,o){e=+e,t>>>=0,n>>>=0,o||m(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,o||m(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;0<=--i&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeIntLE=function(e,t,n,o){e=+e,t>>>=0,o||m(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=0,a=1,r=0;for(this[t]=255&e;++i>0)-r&255;return t+n},u.prototype.writeIntBE=function(e,t,n,o){e=+e,t>>>=0,o||m(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=n-1,a=1,r=0;for(this[t+i]=255&e;0<=--i&&(a*=256);)e<0&&0===r&&0!==this[t+i+1]&&(r=1),this[t+i]=(e/a>>0)-r&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeFloatLE=function(e,t,n){return b(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return b(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return w(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return w(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,o){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n=n||0,o||0===o||(o=this.length),t>=e.length&&(t=e.length),(o=0=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length);var i=(o=e.length-t>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(e=e||0))for(a=t;a>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function T(e){return x.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function E(e,t,n,o){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function M(e){return e!=e}}.call(this)}.call(this,k("buffer").Buffer)},{"base64-js":2,buffer:3,ieee754:4}],4:[function(e,t,n){n.read=function(e,t,n,o,i){var a,r,s=8*i-o-1,c=(1<>1,d=-7,u=n?i-1:0,f=n?-1:1,i=e[t+u];for(u+=f,a=i&(1<<-d)-1,i>>=-d,d+=s;0>=-d,d+=o;0>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:a-1,p=o?1:-1,a=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-r))<1&&(r--,o*=2),2<=(t+=1<=r+d?u/o:u*Math.pow(2,1-d))*o&&(r++,o/=2),l<=r+d?(s=0,r=l):1<=r+d?(s=(t*o-1)*Math.pow(2,i),r+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),r=0));8<=i;e[n+f]=255&s,f+=p,s/=256,i-=8);for(r=r<=this._reconnectionAttempts?(d("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1):(e=this.backoff.duration(),d("will wait %dms before reconnect attempt",e),this.reconnecting=!0,t=setTimeout(function(){n.skipReconnect||(d("attempting reconnect"),n.emitAll("reconnect_attempt",n.backoff.attempts),n.emitAll("reconnecting",n.backoff.attempts),n.skipReconnect||n.open(function(e){e?(d("reconnect attempt error"),n.reconnecting=!1,n.reconnect(),n.emitAll("reconnect_error",e.data)):(d("reconnect success"),n.onreconnect())}))},e),this.subs.push({destroy:function(){clearTimeout(t)}}))},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(106),s=n(381),c=n(390),n=n(391);t.polling=function(e){var t,n,o=!1,i=!1,a=!1!==e.jsonp;if("undefined"!=typeof location&&(t="https:"===location.protocol,n=(n=location.port)||(t?443:80),o=e.hostname!==location.hostname||n!==e.port,i=e.secure!==t),e.xdomain=o,e.xscheme=i,"open"in new r(e)&&!e.forceJSONP)return new s(e);if(a)return new c(e);throw new Error("JSONP disabled")},t.websocket=n},function(e,t,n){var o=n(107),i=n(75),a=n(51),r=n(76),s=n(152),c=n(77)("engine.io-client:polling"),l=(e.exports=d,null!=new(n(106))({xdomain:!1}).responseType);function d(e){var t=e&&e.forceBase64;l&&!t||(this.supportsBinary=!1),o.call(this,e)}r(d,o),d.prototype.name="polling",d.prototype.doOpen=function(){this.poll()},d.prototype.pause=function(e){var t,n=this;function o(){c("paused"),n.readyState="paused",e()}this.readyState="pausing",this.polling||!this.writable?(t=0,this.polling&&(c("we are currently polling - waiting to pause"),t++,this.once("pollComplete",function(){c("pre-pause polling complete"),--t||o()})),this.writable||(c("we are currently writing - waiting to pause"),t++,this.once("drain",function(){c("pre-pause writing complete"),--t||o()}))):o()},d.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},d.prototype.onData=function(e){var o=this;c("polling got data %s",e),a.decodePayload(e,this.socket.binaryType,function(e,t,n){if("opening"===o.readyState&&o.onOpen(),"close"===e.type)return o.onClose(),!1;o.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},d.prototype.doClose=function(){var e=this;function t(){c("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(c("transport open - closing"),t()):(c("transport not open - deferring close"),this.once("open",t))},d.prototype.write=function(e){function t(){n.writable=!0,n.emit("drain")}var n=this;this.writable=!1;a.encodePayload(e,this.supportsBinary,function(e){n.doWrite(e,t)})},d.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=s()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"==t&&443!==Number(this.port)||"http"==t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(t,e,n){!function(a){var e=Object.prototype.toString,r="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);t.exports=function e(t){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(var n=0,o=t.length;nthis.options.threshold){var s={};for(c in this.direction)this.direction.hasOwnProperty(c)&&(s[c]=this.direction[c]);var c,l={};for(c in this.direction={x:n,y:o,angle:t},e.direction=this.direction,s)s[c]===this.direction[c]&&(l[c]=!0);if(l.x&&l.y&&l.angle)return e;l.x&&l.y||this.trigger("plain",e),l.x||this.trigger("plain:"+n,e),l.y||this.trigger("plain:"+o,e),l.angle||this.trigger("dir dir:"+t,e)}return e},o.prototype=new e,(o.constructor=o).id=0,o.prototype.prepareNipples=function(){var e=this,o=e.nipples;o.on=e.on.bind(e),o.off=e.off.bind(e),o.options=e.options,o.destroy=e.destroy.bind(e),o.ids=e.ids,o.id=e.id,o.processOnMove=e.processOnMove.bind(e),o.processOnEnd=e.processOnEnd.bind(e),o.get=function(e){if(void 0===e)return o[0];for(var t=0,n=o.length;t