From 7c7f31c6a15ca4863795a9b9d98a7a111b526253 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Wed, 10 Aug 2022 15:18:48 -0500 Subject: [PATCH] bug fixes --- data/emu-main.js | 228 ++++++++++++++++++++++++------------------- data/emulator.min.js | 2 +- index.html | 1 + 3 files changed, 129 insertions(+), 102 deletions(-) diff --git a/data/emu-main.js b/data/emu-main.js index 2084d28..2ecaf54 100644 --- a/data/emu-main.js +++ b/data/emu-main.js @@ -1155,9 +1155,14 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { } } var _0x18a437 = window.URL || window.webkitURL; - var _0x394c59 = function(_0x571737) { - var _0x17edbf; - return 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x3 === _0x571737[0x2] && 0x4 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x5 === _0x571737[0x2] && 0x6 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x7 === _0x571737[0x2] && 0x8 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x37 === _0x571737[0x0] && 0x7a === _0x571737[0x1] && 0xbc === _0x571737[0x2] && 0xaf === _0x571737[0x3] && 0x27 === _0x571737[0x4] && 0x1c === _0x571737[0x5] ? _0x17edbf = '7z' : 0x52 === _0x571737[0x0] && 0x61 === _0x571737[0x1] && 0x72 === _0x571737[0x2] && 0x21 === _0x571737[0x3] && 0x1a === _0x571737[0x4] && 0x7 === _0x571737[0x5] && 0x0 == _0x571737[0x6] && (_0x17edbf = 'rar'), _0x17edbf; + var isCompressed = function(data) { + 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) { + 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) { + return 'rar'; + } }, _0xa24f60 = function(_0xbf2b8b) { var _0x17edbf = 'importScripts("'+_0xbf2b8b+'");', @@ -1438,7 +1443,6 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { var _0x55627a = _0xa88a13, _0x1cfda7 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), _0x429d6b = (_0x1bc287.split('.').pop(), _0x29078e[_0x1143c5]), - _0xb0c5d8 = -0x1, _0x567713 = '', _0x567717 = function() { if (_0x55627a.coreVer === 2) { @@ -1456,8 +1460,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { if (typeof _0x55627a.loadStateOnStart == 'string') { fetch(_0x55627a.loadStateOnStart).then(function(response) { response.arrayBuffer().then(function(ab) { - var a = new Uint8Array(ab) - EJS_loadState(a) + var a = new Uint8Array(ab); + EJS_loadState(a); }) }) } @@ -1490,78 +1494,88 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { } } } - var _0x99321 = function(_0x52e6f3) { - if (_0x52e6f3.data) { - if (0x1 === _0x52e6f3.data.t) { - _0x1cfda7.innerHTML = 'Game Data ready', _0x52e6f3.target.terminate(); - try { - _0x4bd781(), _0x5f3757(_0x55627a), _0x16cf3e(); - !_0x55627a.startName && _0x567713 && (_0x55627a.startName = _0x567713); - var _0x2c1832 = [_0x55627a.startName, - [_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('') - ]; - 'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x2c1832.unshift('-v'); - _0x4d7024.Module.callMain(_0x2c1832); - if (_0xc6823.coreVer === 2) { - _0x4d7024.Module.resumeMainLoop(); - _0x4d7024.Module.setCanvasSize(800, 600); - } - _0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game'); - } catch (_0x4a1471) { - console.log(_0x4a1471), _0x1cfda7.innerHTML = 'Doesn\'t look like your browser is supported'; - } - try{_0x567717();}catch(e){} - } - if (0x2 === _0x52e6f3.data.t) { - var _0x25aae3 = _0x52e6f3.data.file.split('/'), - _0x1bc287 = _0x25aae3.pop(), - _0x1844e3 = _0x1bc287.split('.').pop(); - _0x1bc287 = _0x1bc287.replace(/\#/g, ''), _0x4d7024._FS.createPath('/', _0x25aae3.join('/'), true, true); - for (var _0x36bace = _0x1e0766[_0x429d6b].length - 0x1; _0x36bace >= 0x0; _0x36bace -= 0x1) _0x1e0766[_0x429d6b][_0x36bace] === _0x1844e3.toLowerCase() && _0x36bace > _0xb0c5d8 && (_0xb0c5d8 = _0x36bace, _0x55627a.startName = ['', _0x25aae3.join('/'), _0x1bc287].join('/'), _0x55627a.startName = _0x55627a.startName.replace(/\/+/, '/')); - _0x1bc287 && (_0x4d7024._FS.createDataFile('/' .concat(_0x25aae3.join('/')), _0x1bc287, _0x52e6f3.data.data, true, !0x1), _0x468801 += _0x52e6f3.data.data.length), _0x567713 = '/' .concat(_0x25aae3.join('/'), '/').concat(_0x1bc287); - } - if (0x4 === _0x52e6f3.data.t && _0x52e6f3.data.total > 0x0) { - var _0x163fc4 = Math.floor(_0x52e6f3.data.current / _0x52e6f3.data.total * 0x64), - _0x5448a3 = _0x52e6f3.data.name || ''; - _0x163fc4 <= 0x64 && _0x163fc4 > 0x0 && (_0x1cfda7.innerHTML = _0xa88a13.localization('Decompress Game Data')+' ' .concat(_0x5448a3, ' ').concat(_0x163fc4, '%')); - } - } - }, - _0x1e67c4 = !0x1; - if (!['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x55627a.system)) { - var _0x20a78c = _0x1844e3.slice ? _0x1844e3.slice(0x0, 0xa) : _0x1844e3.subarray(0x0, 0xa), - _0x1761cf = _0x394c59(_0x20a78c); - '7z' === _0x1761cf ? (_0xa24f60(_0x17edbf).then(function(_0xea623e) { - _0xea623e.onmessage = _0x99321, _0xea623e.postMessage(_0x1844e3); - }), _0x1e67c4 = true) : 'zip' === _0x1761cf ? (_0xa24f60(_0x2c1832).then(function(_0x5a81e4) { - _0x5a81e4.onmessage = _0x99321, _0x5a81e4.postMessage(_0x1844e3); - }), _0x1e67c4 = true) : 'rar' == _0x1761cf && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x5f204f) { - _0x5f204f.onmessage = _0x99321, _0x5f204f.postMessage(_0x1844e3); - }), _0x1e67c4 = true); - } - if (!_0x1e67c4) { - var _0x1c661d = _0x1bc287.replace(/\#/g, ''); + var start = function(startName) { + _0x1cfda7.innerHTML = 'Game Data ready'; try { - _0x468801 += _0x1844e3.length, _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x1844e3, true, !0x1); - } catch (_0x210043) { - console.log(_0x210043); - } - _0x4bd781(), _0x55627a.startName = _0x1c661d, _0x5f3757(_0x55627a), _0x16cf3e(); - try { - var _0x4dd87f = [_0x55627a.startName, - [_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('') - ]; - 'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x4dd87f.unshift('-v'); - _0x4d7024.Module.callMain(_0x4dd87f); + _0x4bd781(); + _0x5f3757(_0x55627a); + _0x16cf3e(); + var _0x2c1832 = [startName, + [_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('') + ]; + 'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x2c1832.unshift('-v'); + _0x4d7024.Module.callMain(_0x2c1832); if (_0xc6823.coreVer === 2) { _0x4d7024.Module.resumeMainLoop(); _0x4d7024.Module.setCanvasSize(800, 600); } _0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game'); - } catch (_0x42970c) { - console.log(_0x42970c), _0x1cfda7.innerHTML = 'Doesn\'t look like your browser is supported'; + try{_0x567717();}catch(e){} + } catch (_0x4a1471) { + console.log(_0x4a1471); + _0x1cfda7.innerHTML = 'Doesn\'t look like your browser is supported'; } - try{_0x567717();}catch(e){} + } + var _0x99321 = function(_0x52e6f3) { + if (_0x52e6f3.data) { + if (1 === _0x52e6f3.data.t) { + !_0x55627a.startName && _0x567713 && (_0x55627a.startName = _0x567713); + _0x52e6f3.target.terminate(); + start(_0x55627a.startName); + } + if (2 === _0x52e6f3.data.t) { + var _0x1c661d = _0x52e6f3.data.file.replace(/\#/g, ''); + try { + _0x468801 += _0x52e6f3.data.data.length; + _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x52e6f3.data.data, true, false); + _0x55627a.startName = _0x52e6f3.data.file; + } catch (_0x210043) { + console.log(_0x210043); + } + } + if (4 === _0x52e6f3.data.t && _0x52e6f3.data.total > 0) { + var _0x163fc4 = Math.floor(_0x52e6f3.data.current / _0x52e6f3.data.total * 100), + _0x5448a3 = _0x52e6f3.data.name || ''; + if (_0x163fc4 <= 100 && _0x163fc4 > 0) { + _0x1cfda7.innerHTML = _0xa88a13.localization('Decompress Game Data')+_0x5448a3+' '+_0x163fc4+'%'; + } + } + } + }, + _0x1e67c4 = false; + if (!['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x55627a.system)) { + var _0x20a78c = _0x1844e3.slice ? _0x1844e3.slice(0, 10) : _0x1844e3.subarray(0, 10), + _0x1761cf = isCompressed(_0x20a78c); + if (_0x1761cf === "7z") { + _0xa24f60(_0x17edbf).then(function(_0xea623e) { + _0xea623e.onmessage = _0x99321; + _0xea623e.postMessage(_0x1844e3); + }) + _0x1e67c4 = true; + } else if (_0x1761cf === 'zip') { + _0xa24f60(_0x2c1832).then(function(_0x5a81e4) { + _0x5a81e4.onmessage = _0x99321; + _0x5a81e4.postMessage(_0x1844e3); + }) + _0x1e67c4 = true; + } else if (_0x1761cf === 'rar') { + _0x41d0bd(_0x4ce206, 'rar').then(function(_0x5f204f) { + _0x5f204f.onmessage = _0x99321; + _0x5f204f.postMessage(_0x1844e3); + }) + _0x1e67c4 = true; + } + } + if (!_0x1e67c4) { + var _0x1c661d = _0x1bc287.replace(/\#/g, ''); + try { + _0x468801 += _0x1844e3.length; + _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x1844e3, true, false); + } catch (_0x210043) { + console.log(_0x210043); + } + _0x55627a.startName = _0x1c661d; + start(_0x55627a.startName); } }, _0x5048db = function() { @@ -1674,35 +1688,47 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { }, 'responseType': 'arraybuffer' }).then(function(_0x159ae9) { - var _0x39a81f = new Uint8Array(_0x159ae9.data); - ! function(_0xe531f0, _0x1097ca) { - var _0xf6806b = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), - _0x59c7c1 = (_0xe531f0.split('.').pop(), function(_0x36004e) { - if (_0x36004e.data) { - if (0x1 === _0x36004e.data.t && (_0x36004e.target.terminate(), _0x5048db()), 0x2 === _0x36004e.data.t) { - var _0x17edbf = _0x36004e.data.file.split('/'), - _0x2c1832 = _0x17edbf.pop(), - _0x2b320e = _0x2c1832.split('.').pop(); - _0x4d7024._FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024._FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, !0x1), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832); - } - if (0x4 === _0x36004e.data.t && _0x36004e.data.total > 0x0) { - var _0x1097ca = Math.floor(_0x36004e.data.current / _0x36004e.data.total * 0x64), - _0x95ac83 = _0x36004e.data.name || ''; - _0x1097ca <= 0x64 && _0x1097ca > 0x0 && (_0xf6806b.innerHTML = _0xa88a13.localization('Decompress Game Patch')+' ' .concat(_0x95ac83, ' ').concat(_0x1097ca, '%')); - } + var _0x1097ca = new Uint8Array(_0x159ae9.data), + _0xe531f0 = _0x179b43.split('.').pop(), + _0xf6806b = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), + _0x59c7c1 = function(_0x36004e) { + if (_0x36004e.data) { + if (0x1 === _0x36004e.data.t && (_0x36004e.target.terminate(), _0x5048db()), 0x2 === _0x36004e.data.t) { + var _0x17edbf = _0x36004e.data.file.split('/'), + _0x2c1832 = _0x17edbf.pop(), + _0x2b320e = _0x2c1832.split('.').pop(); + _0x4d7024._FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024._FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, !0x1), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832); } - }), - _0x4c332a = !0x1, - _0x3de3e4 = _0x1097ca.slice ? _0x1097ca.slice(0x0, 0xa) : _0x1097ca.subarray(0x0, 0xa), - _0x17f736 = _0x394c59(_0x3de3e4); - '7z' === _0x17f736 ? (_0xa24f60(_0x17edbf).then(function(_0x20601d) { - _0x20601d.onmessage = _0x59c7c1, _0x20601d.postMessage(_0x1097ca); - }), _0x4c332a = true) : 'zip' === _0x17f736 ? (_0xa24f60(_0x2c1832).then(function(_0x46622d) { - _0x46622d.onmessage = _0x59c7c1, _0x46622d.postMessage(_0x1097ca); - }), _0x4c332a = true) : 'rar' == _0x17f736 && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x2ecd24) { - _0x2ecd24.onmessage = messageCallBack, _0x2ecd24.postMessage(_0x1097ca); - }), _0x4c332a = true), _0x4c332a || (_0x468801 += _0x1097ca.length, _0x4d7024.gamePatch = '/' .concat(_0xe531f0), _0x4d7024._FS.createDataFile('/', _0xe531f0, _0x1097ca, true, !0x1), _0x5048db()); - }(_0x179b43, _0x39a81f); + if (0x4 === _0x36004e.data.t && _0x36004e.data.total > 0x0) { + var _0x1097ca = Math.floor(_0x36004e.data.current / _0x36004e.data.total * 0x64), + _0x95ac83 = _0x36004e.data.name || ''; + _0x1097ca <= 0x64 && _0x1097ca > 0x0 && (_0xf6806b.innerHTML = _0xa88a13.localization('Decompress Game Patch')+' ' .concat(_0x95ac83, ' ').concat(_0x1097ca, '%')); + } + } + }, + _0x3de3e4 = _0x1097ca.slice ? _0x1097ca.slice(0, 10) : _0x1097ca.subarray(0, 10), + _0x17f736 = isCompressed(_0x3de3e4); + if (_0x17f736 === '7z') { + _0xa24f60(_0x17edbf).then(function(_0x20601d) { + _0x20601d.onmessage = _0x59c7c1; + _0x20601d.postMessage(_0x1097ca); + }) + } else if (_0x17f736 === 'zip') { + _0xa24f60(_0x2c1832).then(function(_0x46622d) { + _0x46622d.onmessage = _0x59c7c1; + _0x46622d.postMessage(_0x1097ca); + }) + } else if (_0x17f736 === 'rar') { + _0x41d0bd(_0x4ce206, 'rar').then(function(_0x2ecd24) { + _0x2ecd24.onmessage = _0x59c7c1; + _0x2ecd24.postMessage(_0x1097ca); + }) + } else { + _0x468801 += _0x1097ca.length; + _0x4d7024.gamePatch = '/'+_0xe531f0; + _0x4d7024._FS.createDataFile('/', _0xe531f0, _0x1097ca, true, false); + _0x5048db(); + } }).catch(function(_0x314293) { renderErrorPage(_0x314293, _0x2c1832, _0xa88a13); }); @@ -1813,11 +1839,11 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { }), _0x3a6560 = !0x1, _0x12e229 = _0x3cff36.slice ? _0x3cff36.slice(0x0, 0xa) : _0x3cff36.subarray(0x0, 0xa), - _0x80852b = _0x394c59(_0x12e229); + _0x80852b = isCompressed(_0x12e229); '7z' === _0x80852b ? (_0xa24f60(_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) { - _0x259be0.onmessage = messageCallBack, _0x259be0.postMessage(_0x3cff36); + _0x259be0.onmessage = _0x19a43e, _0x259be0.postMessage(_0x3cff36); }), _0x3a6560 = true) : (_0xa24f60(_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()); diff --git a/data/emulator.min.js b/data/emulator.min.js index dec4da3..23ccd4a 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