From cc37200ac3cb8f62ecd8b6b0b6f706c70bf35689 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Fri, 25 Nov 2022 09:23:00 -0600 Subject: [PATCH] Version 3.1.0 Co-authored-by: Allan Niles <74841470+allancoding@users.noreply.github.com> --- .github/FUNDING.yml | 13 + CHANGES.md | 9 +- CNAME | 1 + README.md | 23 +- ads.txt | 1 + data/emu-main.js | 823 ++++++------ data/emulator.js | 2992 ++---------------------------------------- data/emulator.min.js | 2 +- data/loader.js | 5 +- data/v.json | 31 +- data/version.json | 2 +- docs/Systems/3DO.md | 58 +- index.html | 7 +- 13 files changed, 668 insertions(+), 3299 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 CNAME create mode 100644 ads.txt diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8692f15 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: EmulatorJS # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/CHANGES.md b/CHANGES.md index 7efd058..14ac778 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,13 @@ # Changes -# 3.0.5 +# 3.1.0 +- Added ability to drag and drop save states. +- Fixed some "update" and "cancel" and "close" button confustion +- Removed save state retroarch messages +- Beta netplay cleanup (not yet working) +- (Theoretically) fixed a bug that did not allow iOS devices to work + +# 3.0.5 [View Tree](https://github.com/ethanaobrien/emulatorjs/tree/44c31371fb3c314cd8dea36ccbaad89fb3ab98e6) - Fixed screen recording on devices that do not support getUserMedia api. - Added C label buttons to nintendo 64 virtual gamepad. - Fixed EJS_color bug. diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..7032dd5 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +demo.emulatorjs.org \ No newline at end of file diff --git a/README.md b/README.md index 68bbbe4..cb9a255 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,26 @@ Self-hosted **Javascript** emulation for various system.
+### Issues + +*If something doesn't work, please consider opening an* ***[Issue]***
+*with as many details as possible, as well as the console log.* + +
+ +### Ads + +*This project has no ads.*
+*Although, the demo page currently has an ad to help fund this project.*
+*Ads on the demo page may come and go depending on how many people are*
+*funding this project.*
+ +*You can help fund this project on* ***[patreon]*** + +
+ + + ### Issues *If something doesn't work, please consider opening an* ***[Issue]***
@@ -124,6 +144,7 @@ EJS_oldCores = true; [License]: LICENSE [Issue]: https://github.com/ethanaobrien/emulatorjs/issues +[patreon]: https://patreon.com/EmulatorJS @@ -138,7 +159,7 @@ EJS_oldCores = true; [Website]: https://emulatorjs.org/ [Legacy]: https://coldcast.org/games/1/Super-Mario-Bros [Usage]: https://emulatorjs.org/docs/ -[Demo]: https://emulatorjs.github.io/EmulatorJS/ +[Demo]: https://demo.emulatorjs.org/ diff --git a/ads.txt b/ads.txt new file mode 100644 index 0000000..4cad853 --- /dev/null +++ b/ads.txt @@ -0,0 +1 @@ +google.com, pub-8832864985153925, DIRECT, f08c47fec0942fa0 \ No newline at end of file diff --git a/data/emu-main.js b/data/emu-main.js index 350fd4c..54429c1 100644 --- a/data/emu-main.js +++ b/data/emu-main.js @@ -1057,7 +1057,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { 'melonds': ['nds'], 'mednafen_psx': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'], 'mednafen_psx_hw': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'], - 'nestopia': ['fds', 'nes', 'unif', 'unf'] + 'nestopia': ['fds', 'nes', 'unif', 'unf'], + 'opera': ['iso', 'bin', 'chd', 'cue'] } }, _0x29078e = { @@ -1107,7 +1108,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { 'nds': 'desmume2015', 'mame2003': 'mame2003', 'arcade': 'fbalpha2012_cps1', // I need to find a more compatible arcade core - 'psx': 'mednafen_psx_hw' + 'psx': 'mednafen_psx_hw', + '3do': 'opera' } }, newCoreTypes = { @@ -1125,7 +1127,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { 'mednafen_psx': 'psx', 'mednafen_psx_hw': 'psx', 'melonds': 'nds', - 'nestopia': 'nes' + 'nestopia': 'nes', + 'opera': '3do' }, getSystem = function(core, notRetroarch) { if (notRetroarch === true) { @@ -1859,9 +1862,9 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { _0x10b71a = function() { _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)).innerHTML = 'Game Core ready'; _0x4d7024.Module._supports_states && (_0x378b5c.statesSupported = _0x4d7024.Module.cwrap('supports_states', 'number', [])); - if (_0xdcec2a.statesSupported) { + if (_0x378b5c.statesSupported) { try { - _this.statesSupported = !!_0xdcec2a.statesSupported(); + _this.statesSupported = !!_0x378b5c.statesSupported(); _0x1e2c68.element(_this.elements.buttons.netplay) && _0x132da7(_this.elements.buttons.netplay, !_0x7f9f36.supportNetPlay.call(_this)); _0x1e2c68.element(_this.elements.buttons.saveState) && _0x132da7(_this.elements.buttons.saveState, !_this.statesSupported); _0x1e2c68.element(_this.elements.buttons.loadState) && _0x132da7(_this.elements.buttons.loadState, !_this.statesSupported); @@ -1872,9 +1875,10 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { let _0x17edbf = _this.config.biosUrl; _0xdcec2a.bindFunction.call(_this); _0xdcec2a.setGamepadDialog.call(_this); + _0xdcec2a.setMessageDialog.call(_this); _0xdcec2a.setCacheDialog.call(_this); _0xdcec2a.setLoadingDialog.call(_this); - //_0xdcec2a.setNetplayDialog.call(_this); + _0xdcec2a.setNetplayDialog.call(_this); _0xdcec2a.setCheatDialog.call(_this); _0xdcec2a.initGamepad.call(_this); _0xdcec2a.initKeyboard.call(_this); @@ -2875,9 +2879,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { const _0xa88a13 = shaders; for (let _0x17edbf = Object.keys(_0xa88a13), _0x2c1832 = '', _0x26fb6a = 0; _0x26fb6a < _0x17edbf.length; _0x26fb6a += 1) _0x2c1832 = _0xa88a13[_0x17edbf[_0x26fb6a]], _0x27f4c4.FS.writeFile('/shader/' .concat(_0x17edbf[_0x26fb6a]), _0x2c1832), _0x2593da.storage.get('shader') === _0x17edbf[_0x26fb6a] && _0x27f4c4.FS.writeFile('/shader/shader.glslp', _0x2c1832); }, + 'setMessageDialog': function() { + this.elements.dialogs.message.innerHTML = '

'+this.localization('Drop to load save state')+'

'; + }, 'setGamepadDialog': function() { let _this = this; - _this.elements.dialogs.gamepad.innerHTML = '\n
\n
\n

'+_this.localization('Control Settings')+'

\n
\n \n \n
\n
\n \n
\n
\n
\n '+_this.localization('Update')+'\n '+_this.localization('Reset')+'\n '+_this.localization('Clear')+'\n '+_this.localization('Cancel')+'\n
\n \n
\n '; + _this.elements.dialogs.gamepad.innerHTML = '\n
\n
\n

'+_this.localization('Control Settings')+'

\n
\n \n \n
\n
\n \n
\n
\n
\n '+_this.localization('Reset')+'\n '+_this.localization('Clear')+'\n '+_this.localization('Close')+'\n
\n \n
\n '; let _0x17edbf = '\n '), _0x2c1832 = '\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n '+_this.localization('Set')+'\n
\n
\n
') @@ -3016,7 +3023,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { let _0x19d43b = _0x378b5c.controllers[_0x23d419][_0x21e62d]; _0x19d43b && (_0x19d43b.type && 1 !== parseInt(_0x19d43b.type, 0xa) ? _0x1849bc.value = '' : _0x19d43b.value && (_0x294e35.value = _0x378b5c.keyMap[_0x19d43b.value] || '', _0x294e35.setAttribute('data-value', _0x19d43b.value)), _0x19d43b.value2 && (_0x1849bc.value = isNaN(_0x19d43b.value2) ? (_0x19d43b.value2) : ('button ' .concat(parseInt(_0x19d43b.value2, 0xa) + 1)), _0x1849bc.setAttribute('data-value', _0x19d43b.value2))); }); - }), _0x1093f4.call(this, _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5f19bd) { + }), _0x1093f4.call(this, _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-close'])), 'click', function(_0x5f19bd) { let _0x2c1832 = _this.elements.dialogs.gamepad.querySelectorAll('input'), _0x2844f7 = {}; return Array.from(_0x2c1832).forEach(function(_0x33c024) { @@ -3064,8 +3071,6 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { _0x2c1832[i].value = ''; _0x2c1832[i].setAttribute('data-value', ''); } - }), _0x1093f4.call(this, _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x16d598) { - return _0x132da7(_this.elements.dialogs.gamepad, true), _this.elements.container.focus(), _0x16d598.stopPropagation(), false; }), Array.from(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li'))).forEach(function(_0x523f7b) { _0x1093f4.call(_this, _0x523f7b, 'mousedown', function(_0xa99a78) { _0x3a8e2f(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li')), _0x378b5c.classNames.active, false); @@ -3127,7 +3132,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { 'setCheatDialog': function() { let _this = this; if (_this.elements.dialogs.cheat) { - _this.elements.dialogs.cheat.innerHTML = '\n
\n
\n

Cheats

\n
\n
\n
\n \n
\n
\n
\n '+_this.localization('Add Cheat')+'\n '+_this.localization('OK')+'\n Close\n
\n
\n\n \n\n \n '); + _this.elements.dialogs.cheat.innerHTML = '\n
\n
\n

Cheats

\n
\n
\n
\n \n
\n
\n
\n '+_this.localization('Add Cheat')+'\n Close\n
\n
\n\n \n\n \n '); let _0x17edbf = _this.elements.dialogs.cheat.querySelector('#modal-85cd7a1c543a484b'); _0x1093f4.call(this, _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-add'])), 'click', function(_0x2a74b5) { return _0x4d8495.show('modal-85cd7a1c543a484b', { @@ -3186,9 +3191,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { return _0x576733.stopPropagation(), false; }), _0x1093f4.call(_this, _this.elements.container, 'start-game', function(_0x4c266e) { _0x257001(); - }), _0x1093f4.call(this, _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x4adb2c) { - return _0x132da7(_this.elements.dialogs.cheat, true), _0x4adb2c.stopPropagation(), _this.elements.container.focus(), false; - }), _0x1093f4.call(this, _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5785f6) { + }), _0x1093f4.call(this, _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x5785f6) { _0x378b5c.resetCheat(); _0x2c1832.querySelectorAll('input:checked').forEach(function(_0xeb7426, _0x45b02d) { let _0x27e2c1 = _this.cheats[_0xeb7426.value]; @@ -3204,376 +3207,394 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { var _0xa88a13 = this, _0x17edbf = this, _this = this; - if (_0x17edbf.elements.dialogs.netplay) { - _0x17edbf.elements.dialogs.netplay.innerHTML = '\n
\n
\n

'+_0x17edbf.localization('Netplay')+'

\n
\n
\n \n\n \n
\n
\n '+_0x17edbf.localization('Quit Room')+'\n '+_0x17edbf.localization('Create a Room')+'\n '+_0x17edbf.localization('Close')+'\n
\n
\n\n \n \n \n \n \n \n \n \n \n \n '), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x3d4554) { - return _0x132da7(_0x17edbf.elements.dialogs.netplay, true), _0x378b5c.disableControl(!0x1), _0x378b5c.stopLoadRooms(), _0x3d4554.stopPropagation(), _0x17edbf.elements.container.focus(), !0x1; - }), window.setInterval(function() { - var _0xa88a13 = '', _0x17edbf.elements.widgets.netplay.innerHTML = _0xa88a13; - }, 0x1f4); - var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-9de6c4e9ce2b9361'), - _0x36bde0 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-85cd7a1c543a484a'), - _0x5289c1 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-7d8fd50ed642340b'), - _0x325651 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-5aa765d61d8327de'), - _0x3d0d28 = {}; - _0x378b5c.connection = new _0x4a2390.a(); - var _0x10d51e = _0xa88a13.socketUrl; - if (! _0x10d51e.endsWith('/')) { - _0x10d51e += '/'; - }; - _0x378b5c.connection.socketURL = '/', _0x378b5c.connection.socketURL = _0x10d51e, _0x378b5c.connection.socketMessageEvent = 'emulatorjs-message', _0x378b5c.connection.socketCustomEvent = 'emulatorjs-custom-message'; - var _0xda20e9 = _0x59aa33.info(); - _0x378b5c.connection.extra = { - 'name': _0x378b5c.playerName, - 'game_id': _0x17edbf.config.gameId, - 'browser_name': _0xda20e9.name, - 'room_name': ' ', - 'domain': document.domain - } - _0x378b5c.connection.socketMessageEvent = 'netplay'; - _0x378b5c.connection.enableFileSharing = true; - _0x378b5c.connection.enableLogs = true; - _0x378b5c.connection.session = { - 'data': true - }; - _0x378b5c.connection.sdpConstraints.mandatory = { - 'OfferToReceiveAudio': false, - 'OfferToReceiveVideo': false - } - _0x378b5c.connection.onclose = function() {}; - - //TODO - I do not want to use webrtc - /* - _0x378b5c.connection.iceServers = [{ - 'urls': ['stun:webrtcweb.com:7788'], - 'username': 'muazkh', - 'credential': 'muazkh' - }, { - 'urls': ['turn:webrtcweb.com:7788', 'turn:webrtcweb.com:8877', 'turn:webrtcweb.com:4455'], - 'username': 'muazkh', - 'credential': 'muazkh' - }, { - 'urls': ['stun:stun.l.google.com:19302', 'stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302', 'stun:stun.l.google.com:19302?transport=udp'] - }]*/ - _0x378b5c.connection.maxParticipantsAllowed = 4; - _0x378b5c.netPlayInitFrame = 0; - var _0x1eb137 = 0, - _0x52eb7d = false; - Module.postMainLoop = function() { - var _0xa88a13; - if (_0x378b5c.currentFrame = parseInt(_0x378b5c.currentFrameNum(), 0xa), _0x378b5c.connected) { - if (_0x1eb137 += 0x1, _0x378b5c.connection.isInitiator) _0x1eb137 >= 0x1 && function() { - for (var _0xa88a13 = [], _0x17edbf = _0x378b5c.currentFrame - 0x1; _0x17edbf < _0x378b5c.currentFrame; _0x17edbf += 0x1) _0x378b5c.inputsData[_0x17edbf] ? _0x378b5c.inputsData[_0x17edbf].forEach(function(_0x2a02da, _0x1b2066) { - _0xa88a13.push('' .concat(_0x2a02da.index, '|').concat(_0x2a02da.key, '|').concat(_0x2a02da.status, '|').concat(_0x2a02da.frame)); - }) : _0xa88a13.push('-1|||' .concat(_0x17edbf)); - _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-control', - 'value': _0xa88a13 - })), _0x1eb137 = 0x0, _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3125e4, _0x31ea67) { - _0x3125e4 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3125e4] = null, delete _0x378b5c.inputsData[_0x3125e4]); - }); - }(); - else { - if (_0x378b5c.coreOptionData[_0x378b5c.currentFrame]) { - var _0x2c1832 = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].key, - _0x4fd0cc = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].value; - _0x2593da.updateCoreOptions.call(_0x17edbf, _0x2c1832, _0x4fd0cc), delete _0x378b5c.coreOptionData[_0x378b5c.currentFrame]; - } - if (_0x378b5c.currentFrame <= 0x0 || _0x378b5c.inputsData[_0x378b5c.currentFrame]) _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0xa88a13 = _0x378b5c.inputsData[_0x378b5c.currentFrame], _0x378b5c.inputsData[_0x378b5c.currentFrame] = null, delete _0x378b5c.inputsData[_0x378b5c.currentFrame], _0xa88a13 || (_0xa88a13 = []), _0xa88a13.forEach(function(_0x4bb42f, _0x28928a) { - _0x4bb42f.index >= 0x0 && _0x378b5c.simulateInputFn(_0x4bb42f.index, _0x4bb42f.key, _0x4bb42f.status); - }); - else { - _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(); - var _0x3a10d1 = !0x1, - _0x42763c = Object.keys(_0x378b5c.inputsData); - 0x0 == _0x42763c.length && (_0x3a10d1 = true); - for (var _0x58af15 = 0x0; _0x58af15 < _0x42763c.length; _0x58af15 += 0x1) { - if (_0x42763c[_0x58af15] > _0x378b5c.currentFrame) { - console.log('lost', _0x378b5c.currentFrame), _0x3a10d1 = true; - break; - } - } - _0x3a10d1 ? _0x378b5c.wait || (!_0x52eb7d || _0x52eb7d < new Date().valueOf() - 0xbb8) && (_0x378b5c.inputsData = {}, _0x52eb7d = new Date().valueOf(), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-mem', - 'value': _0x378b5c.connection.userid - }), _0x378b5c.roomMaster)) : (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()); - } - _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3aa393, _0x3a7829) { - _0x3aa393 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3aa393] = null, delete _0x378b5c.inputsData[_0x3aa393]); - }); + if (!_0x17edbf.elements.dialogs.netplay) return; + _0x17edbf.elements.dialogs.netplay.innerHTML = '\n
\n
\n

'+_0x17edbf.localization('Netplay')+'

\n
\n
\n \n\n \n
\n
\n '+_0x17edbf.localization('Quit Room')+'\n '+_0x17edbf.localization('Create a Room')+'\n '+_0x17edbf.localization('Close')+'\n
\n
\n\n \n \n \n \n \n \n \n \n \n \n '), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x3d4554) { + return _0x132da7(_0x17edbf.elements.dialogs.netplay, true), _0x378b5c.disableControl(!0x1), _0x378b5c.stopLoadRooms(), _0x3d4554.stopPropagation(), _0x17edbf.elements.container.focus(), !0x1; + }), window.setInterval(function() { + var _0xa88a13 = ''; + _0x17edbf.elements.widgets.netplay.innerHTML = _0xa88a13; + }, 0x1f4); + var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-9de6c4e9ce2b9361'), + _0x36bde0 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-85cd7a1c543a484a'), + _0x5289c1 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-7d8fd50ed642340b'), + _0x325651 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-5aa765d61d8327de'), + _0x3d0d28 = {}; + + _0x378b5c.connection = new _0x4a2390(); + var _0x10d51e = _0xa88a13.serverURL.replace('http:', 'ws:').replace('https:', 'wss:'); + if (! _0x10d51e.endsWith('/')) { + _0x10d51e += '/'; + }; + _0x378b5c.connection.socketURL = _0x10d51e; + var _0xda20e9 = _0x59aa33.info(); + _0x378b5c.connection.extra = { + 'name': _0x378b5c.playerName, + 'game_id': _0x17edbf.config.gameId, + 'browser_name': _0xda20e9.name, + 'room_name': ' ', + 'domain': document.domain + } + _0x378b5c.connection.maxParticipantsAllowed = 4; + _0x378b5c.netPlayInitFrame = 0; + var _0x1eb137 = 0, + _0x52eb7d = false; + Module.postMainLoop = function() { + var _0xa88a13; + if (_0x378b5c.currentFrame = parseInt(_0x378b5c.currentFrameNum(), 0xa), _0x378b5c.connected) { + if (_0x1eb137 += 0x1, _0x378b5c.connection.isInitiator) _0x1eb137 >= 0x1 && function() { + for (var _0xa88a13 = [], _0x17edbf = _0x378b5c.currentFrame - 0x1; _0x17edbf < _0x378b5c.currentFrame; _0x17edbf += 0x1) _0x378b5c.inputsData[_0x17edbf] ? _0x378b5c.inputsData[_0x17edbf].forEach(function(_0x2a02da, _0x1b2066) { + _0xa88a13.push('' .concat(_0x2a02da.index, '|').concat(_0x2a02da.key, '|').concat(_0x2a02da.status, '|').concat(_0x2a02da.frame)); + }) : _0xa88a13.push('-1|||' .concat(_0x17edbf)); + _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-control', + 'value': _0xa88a13 + })), _0x1eb137 = 0x0, _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3125e4, _0x31ea67) { + _0x3125e4 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3125e4] = null, delete _0x378b5c.inputsData[_0x3125e4]); + }); + }(); + else { + if (_0x378b5c.coreOptionData[_0x378b5c.currentFrame]) { + var _0x2c1832 = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].key, + _0x4fd0cc = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].value; + _0x2593da.updateCoreOptions.call(_0x17edbf, _0x2c1832, _0x4fd0cc), delete _0x378b5c.coreOptionData[_0x378b5c.currentFrame]; + } + if (_0x378b5c.currentFrame <= 0x0 || _0x378b5c.inputsData[_0x378b5c.currentFrame]) _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0xa88a13 = _0x378b5c.inputsData[_0x378b5c.currentFrame], _0x378b5c.inputsData[_0x378b5c.currentFrame] = null, delete _0x378b5c.inputsData[_0x378b5c.currentFrame], _0xa88a13 || (_0xa88a13 = []), _0xa88a13.forEach(function(_0x4bb42f, _0x28928a) { + _0x4bb42f.index >= 0x0 && _0x378b5c.simulateInputFn(_0x4bb42f.index, _0x4bb42f.key, _0x4bb42f.status); + }); + else { + _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(); + var _0x3a10d1 = !0x1, + _0x42763c = Object.keys(_0x378b5c.inputsData); + 0x0 == _0x42763c.length && (_0x3a10d1 = true); + for (var _0x58af15 = 0x0; _0x58af15 < _0x42763c.length; _0x58af15 += 0x1) { + if (_0x42763c[_0x58af15] > _0x378b5c.currentFrame) { + console.log('lost', _0x378b5c.currentFrame), _0x3a10d1 = true; + break; + } + } + _0x3a10d1 ? _0x378b5c.wait || (!_0x52eb7d || _0x52eb7d < new Date().valueOf() - 0xbb8) && (_0x378b5c.inputsData = {}, _0x52eb7d = new Date().valueOf(), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-mem', + 'value': _0x378b5c.connection.userid + }), _0x378b5c.roomMaster)) : (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()); + } + _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3aa393, _0x3a7829) { + _0x3aa393 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3aa393] = null, delete _0x378b5c.inputsData[_0x3aa393]); + }); } } - _0x378b5c.connection.onopen = function(userid) { - console.log('open', userid); - _0x378b5c.connected = true, _0x378b5c.connection.isInitiator && (-0x1 === _0x378b5c.players.indexOf(userid) && (_0x378b5c.players.filter(function(_0x3eafb3, _0xabd7b7) { - return null == _0x3eafb3; - }).length > 0x0 ? _0x378b5c.players.forEach(function(_0xbf0f19, _0xa9d540) { - null != _0xbf0f19 || _0x378b5c.players.includes(userid) || (_0x378b5c.players[_0xa9d540] = userid); - }) : _0x378b5c.players.push(userid)), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'get-players-result', - 'value': _0x378b5c.players, - 'coreOptions': _0x2593da.coreOptionsValues, - 'newuser': userid, - 'master': _0x378b5c.connection.userid - }))), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); - } - - _0x378b5c.connection.onFileStart = function(_0x50eb3a) { - var _0x2c1832 = _0x50eb3a.name.split('-'); - 'reset' !== _0x2c1832[0x0] && 0x0 != _0x2c1832[0x0] || (_0x378b5c.inputsData = {}, _0x378b5c.disableControl(true)); - _0x378b5c.showLoading.call(_0x17edbf); - _0x378b5c.connection.isInitiator ? (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()) : _0x378b5c.inputsData = {}; - } - _0x378b5c.connection.onFileEnd = function(_0x45d454) { - _0x378b5c.hideLoading.call(_0x17edbf); - var _0x2c1832 = _0x45d454.name.split('-'), - _0x3795d9 = _0x2c1832[0x0] >> 0x0; - 'reset' === _0x2c1832[0x0] ? (_0x3795d9 = 0x0, _0x378b5c.connection.isInitiator ? (_0x378b5c.systemPause(0x0), _0x378b5c.disableControl(!0x1), _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop()) : _0x550f17.a.get(_0x45d454.url, { - 'responseType': 'arraybuffer' - }).then(function(_0x37db4c) { + } + _0x378b5c.connection.onopen = function(userid) { + console.log('open', userid); + _0x378b5c.connected = true, _0x378b5c.connection.isInitiator && (-0x1 === _0x378b5c.players.indexOf(userid) && (_0x378b5c.players.filter(function(_0x3eafb3, _0xabd7b7) { + return null == _0x3eafb3; + }).length > 0x0 ? _0x378b5c.players.forEach(function(_0xbf0f19, _0xa9d540) { + null != _0xbf0f19 || _0x378b5c.players.includes(userid) || (_0x378b5c.players[_0xa9d540] = userid); + }) : _0x378b5c.players.push(userid)), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'get-players-result', + 'value': _0x378b5c.players, + 'coreOptions': _0x2593da.coreOptionsValues, + 'newuser': userid, + 'master': _0x378b5c.connection.userid + }))), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); + } + + _0x378b5c.connection.onFileStart = function(_0x50eb3a) { + var _0x2c1832 = _0x50eb3a.name.split('-'); + 'reset' !== _0x2c1832[0x0] && 0x0 != _0x2c1832[0x0] || (_0x378b5c.inputsData = {}, _0x378b5c.disableControl(true)); + _0x378b5c.showLoading.call(_0x17edbf); + _0x378b5c.connection.isInitiator ? (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()) : _0x378b5c.inputsData = {}; + } + _0x378b5c.connection.onFileEnd = function(_0x45d454) { + _0x378b5c.hideLoading.call(_0x17edbf); + var _0x2c1832 = _0x45d454.name.split('-'), + _0x3795d9 = _0x2c1832[0x0] >> 0x0; + if ('reset' === _0x2c1832[0x0]) { + _0x3795d9 = 0x0; + if (_0x378b5c.connection.isInitiator) { + _0x378b5c.systemPause(0x0); + _0x378b5c.disableControl(false); + _0x17edbf.playing = true; + _0x27f4c4.Module.resumeMainLoop() + } else { _0x378b5c.inputsData = {}; - var _0x2c1832 = new Uint8Array(_0x37db4c.data); - _0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop(); - })) : 'game.state' === _0x2c1832[0x1] && (_0x378b5c.connection.isInitiator ? (_0x378b5c.openRoom(_0x17edbf), _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop()) : (_0x378b5c.netPlayInitFrame = _0x3795d9, _0x550f17.a.get(_0x45d454.url, { - 'responseType': 'arraybuffer' - }).then(function(_0x4d241b) { - var _0x2c1832 = new Uint8Array(_0x4d241b.data); - _0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({ + var _0x2c1832 = _0x45d454.data; + _0x378b5c.loadState(_0x2c1832, _0x3795d9); + _0x378b5c.wait = !0x1; + _0x378b5c.systemPause(0x0); + _0x378b5c.disableInput = !0x1; + _0x17edbf.playing = true; + _0x27f4c4.Module.resumeMainLoop(); + } + } else if ('game.state' === _0x2c1832[0x1]) { + if (_0x378b5c.connection.isInitiator) { + _0x378b5c.openRoom(_0x17edbf); + _0x378b5c.wait = !0x1; + _0x378b5c.systemPause(0x0); + _0x27f4c4.Module.resumeMainLoop(); + } else { + _0x378b5c.netPlayInitFrame = _0x3795d9; + var _0x2c1832 = _0x45d454.data; + _0x378b5c.loadState(_0x2c1832, _0x3795d9); + _0x378b5c.wait = !0x1; + _0x378b5c.disableInput = !0x1; + _0x378b5c.connection.send(JSON.stringify({ 'act': 'wait-end', 'value': _0x378b5c.connection.userid - })), _0x378b5c.hideLoading.call(_0x17edbf), _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop(); - }))), _0x378b5c.connection.isInitiator || console.log('recv mem end', _0x378b5c.currentFrame, _0x45d454.name); - }; - - var _0x3bdb35 = !0x1; - _0x378b5c.connection.onmessage = function(_0x32e81a) { - var _0x2c1832, _0x2dca58 = _0x32e81a.data || _0x32e81a; - try { - _0x2c1832 = JSON.parse(_0x2dca58); - } catch (_0x3fb9cc) { - _0x2c1832 = null; + })) + _0x378b5c.hideLoading.call(_0x17edbf); + _0x17edbf.playing = true; + _0x27f4c4.Module.resumeMainLoop(); + } + } + _0x378b5c.connection.isInitiator || console.log('recv mem end', _0x378b5c.currentFrame, _0x45d454.name); + }; + + var _0x3bdb35 = !0x1; + _0x378b5c.connection.onmessage = function(_0x32e81a) { + var _0x2c1832, _0x2dca58 = _0x32e81a.data || _0x32e81a; + try { + _0x2c1832 = JSON.parse(_0x2dca58); + } catch (_0x3fb9cc) { + _0x2c1832 = null; + } + if (_0x2c1832) { + if ('room-master' === _0x2c1832.act && (_0x378b5c.roomMaster = _0x2c1832.value), _0x2c1832.act, 'short-pause' === _0x2c1832.act && (_0x3bdb35 || (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() { + _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; + }, 0x30))), 'sync-control' === _0x2c1832.act) { + var _0xb051c1 = _0x2c1832.value; + _0x17edbf.playing || _0x378b5c.wait; + var _0x2ef644 = _0x378b5c.connection.userid; + _0x378b5c.players.indexOf(_0x2ef644); + _0x378b5c.connection.isInitiator, _0xb051c1.forEach(function(_0x308105, _0x383237) { + var _0x2c1832 = _0x308105.split('|'), + _0x25a5c4 = _0x2c1832[0x0] >> 0x0, + _0x2b3afd = _0x2c1832[0x1] >> 0x0, + _0x4f5761 = _0x2c1832[0x2] >> 0x0, + _0x249303 = _0x2c1832[0x3] >> 0x0, + _0x54e0fd = _0x378b5c.currentFrame; + _0x378b5c.inputsData[_0x249303] || (_0x378b5c.inputsData[_0x249303] = []), -0x1 !== _0x25a5c4 && _0x249303 === _0x54e0fd && _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761), _0x378b5c.connection.isInitiator ? _0x25a5c4 >= 0x0 && (_0x378b5c.inputsData[_0x54e0fd] || (_0x378b5c.inputsData[_0x54e0fd] = []), -0x2 != _0x2b3afd && (_0x378b5c.inputsData[_0x54e0fd].push({ + 'index': _0x25a5c4, + 'key': _0x2b3afd, + 'status': _0x4f5761, + 'frame': _0x54e0fd + }), _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761)), _0x3bdb35 || _0x54e0fd - 0xa >= _0x249303 && (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() { + _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; + }, 0x30))) : ('' !== _0x25a5c4 && _0x378b5c.inputsData[_0x249303].push({ + 'index': _0x25a5c4, + 'key': _0x2b3afd, + 'status': _0x4f5761, + 'frame': _0x249303 + }), _0x378b5c.inputsData[_0x378b5c.currentFrame] && _0x27f4c4.Module.resumeMainLoop(), _0x54e0fd + 0xa <= _0x249303 && _0x249303 > _0x378b5c.netPlayInitFrame + 0x64 && _0x378b5c.connection.send(JSON.stringify({ + 'act': 'short-pause', + 'value': _0x2ef644 + }), _0x378b5c.roomMaster)); + }); } - if (_0x2c1832) { - if ('room-master' === _0x2c1832.act && (_0x378b5c.roomMaster = _0x2c1832.value), _0x2c1832.act, 'short-pause' === _0x2c1832.act && (_0x3bdb35 || (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() { - _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; - }, 0x30))), 'sync-control' === _0x2c1832.act) { - var _0xb051c1 = _0x2c1832.value; - _0x17edbf.playing || _0x378b5c.wait; - var _0x2ef644 = _0x378b5c.connection.userid; - _0x378b5c.players.indexOf(_0x2ef644); - _0x378b5c.connection.isInitiator, _0xb051c1.forEach(function(_0x308105, _0x383237) { - var _0x2c1832 = _0x308105.split('|'), - _0x25a5c4 = _0x2c1832[0x0] >> 0x0, - _0x2b3afd = _0x2c1832[0x1] >> 0x0, - _0x4f5761 = _0x2c1832[0x2] >> 0x0, - _0x249303 = _0x2c1832[0x3] >> 0x0, - _0x54e0fd = _0x378b5c.currentFrame; - _0x378b5c.inputsData[_0x249303] || (_0x378b5c.inputsData[_0x249303] = []), -0x1 !== _0x25a5c4 && _0x249303 === _0x54e0fd && _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761), _0x378b5c.connection.isInitiator ? _0x25a5c4 >= 0x0 && (_0x378b5c.inputsData[_0x54e0fd] || (_0x378b5c.inputsData[_0x54e0fd] = []), -0x2 != _0x2b3afd && (_0x378b5c.inputsData[_0x54e0fd].push({ - 'index': _0x25a5c4, - 'key': _0x2b3afd, - 'status': _0x4f5761, - 'frame': _0x54e0fd - }), _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761)), _0x3bdb35 || _0x54e0fd - 0xa >= _0x249303 && (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() { - _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; - }, 0x30))) : ('' !== _0x25a5c4 && _0x378b5c.inputsData[_0x249303].push({ - 'index': _0x25a5c4, - 'key': _0x2b3afd, - 'status': _0x4f5761, - 'frame': _0x249303 - }), _0x378b5c.inputsData[_0x378b5c.currentFrame] && _0x27f4c4.Module.resumeMainLoop(), _0x54e0fd + 0xa <= _0x249303 && _0x249303 > _0x378b5c.netPlayInitFrame + 0x64 && _0x378b5c.connection.send(JSON.stringify({ - 'act': 'short-pause', - 'value': _0x2ef644 - }), _0x378b5c.roomMaster)); - }); - } - if (_0x2c1832.act, _0x2c1832.act, 'update-core-option' === _0x2c1832.act && (_0x378b5c.connection.isInitiator || (_0x378b5c.coreOptionData[_0x2c1832.frame] = { - 'key': _0x2c1832.key, - 'value': _0x2c1832.value - })), 'restart-game' === _0x2c1832.act && (_0x378b5c.inputsData = {}, _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-mem', - 'value': _0x378b5c.connection.userid - }), _0x378b5c.roomMaster)), 'pause' === _0x2c1832.act && _0x27f4c4.Module.pauseMainLoop(), 'resume' === _0x2c1832.act && _0x27f4c4.Module.resumeMainLoop(), 'wait' === _0x2c1832.act && (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x2c1832.value !== _0x378b5c.connection.userid && (_0x378b5c.waitingList[_0x2c1832.value] = 0x1), _0x378b5c.disableControl(true)), 'wait-end' === _0x2c1832.act && (_0x378b5c.waitingList[_0x2c1832.value] && delete _0x378b5c.waitingList[_0x2c1832.value], 0x0 === Object.keys(_0x378b5c.waitingList).length && (_0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1)), 'sync-mem' === _0x2c1832.act) { - _0x378b5c.wait = true, _0x378b5c.systemPause(0x1); - var _0x2a5bce = _0x2c1832.value; - _0x378b5c.disableControl(true), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'wait', - 'value': _0x2a5bce - })); - (async () => { - const state = await _0x378b5c.saveState(); - _0x27f4c4.FS.createDataFile('/', 'game.state', state, true, true); - _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number'])('game.state', 0); - //_0x27f4c4.FS.unlink('game.state'); - _0x378b5c.inputsData = {}; - const file = new File([state], '0-game.state', { - 'type': '', - 'lastModified': new Date() - }); - _0x378b5c.connection.shareFile(file, _0x2a5bce); - })() - } - if (_0x2c1832.act, 'get-players-result' === _0x2c1832.act && (_0x378b5c.players = _0x2c1832.value, _0x378b5c.roomMaster = _0x2c1832.master, _0x2c1832.newuser === _0x378b5c.connection.userid)) { - var _0x418ccb = _0x2593da.coreOptionsValues; - _0x2c1832.coreOptions && Object.keys(_0x2c1832.coreOptions).forEach(function(_0x3f4c8f) { - _0x418ccb[_0x3f4c8f] !== _0x2c1832.coreOptions[_0x3f4c8f] && _0x2593da.updateCoreOptions.call(_0x17edbf, _0x3f4c8f, _0x2c1832.coreOptions[_0x3f4c8f]); - }), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.disableControl(true), setTimeout(function() { - _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-mem', - 'value': _0x378b5c.connection.userid - }), _0x378b5c.roomMaster); - }, 0x1), _0x378b5c.roomMaster && _0x378b5c.connection.peers[_0x378b5c.roomMaster] && (_0x378b5c.connection.extra.room_name = _0x378b5c.connection.peers[_0x378b5c.roomMaster].extra.room_name, _0x378b5c.connection.updateExtraData()), _0x378b5c.connection.peers[_0x378b5c.roomMaster] && (_0x3d0d28 = _0x378b5c.connection.peers[_0x378b5c.roomMaster].extra), _0x378b5c.openRoom(_0x17edbf); - } - } - }, _0x378b5c.connection.onUserStatusChanged = function(_0x4188ba) { - console.log('userstatuschanged', _0x4188ba); - if ('offline' === _0x4188ba.status) { - var _0x17edbf = _0x378b5c.players.indexOf(_0x4188ba.userid); - _0x17edbf >= 0x0 && (_0x378b5c.players[_0x17edbf] = null); - } - _0x4188ba.status; - }, _0x378b5c.connection.onExtraDataUpdated = function(_0x20ce61) { - console.log('onExtraDataUpdated', _0x20ce61, _0x378b5c.connection.peers); - _0x20ce61.userid === _0x378b5c.connection.userid && (_0x378b5c.connection.extra = _0x20ce61.extra); - }, _0x378b5c.connection.onleave = function(_0x30ebc6) { - console.log('onleave', _0x30ebc6); - if (_0x30ebc6.userid) { - var _0x2c1832 = _0x378b5c.players.indexOf(_0x30ebc6.userid); - _0x2c1832 >= 0x0 && (_0x378b5c.players[_0x2c1832] = null); - } - _0x378b5c.waitingList[_0x30ebc6.userid] && delete _0x378b5c.waitingList[_0x30ebc6.userid], _0x378b5c.connection.isInitiator && 0x0 === Object.keys(_0x378b5c.waitingList).length && _0x378b5c.wait && (_0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({ - 'act': 'wait-end', + if (_0x2c1832.act, _0x2c1832.act, 'update-core-option' === _0x2c1832.act && (_0x378b5c.connection.isInitiator || (_0x378b5c.coreOptionData[_0x2c1832.frame] = { + 'key': _0x2c1832.key, + 'value': _0x2c1832.value + })), 'restart-game' === _0x2c1832.act && (_0x378b5c.inputsData = {}, _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-mem', 'value': _0x378b5c.connection.userid - }))), _0x378b5c.openRoom(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf); - }; - var _0x2fba43 = function() { - _0x378b5c.connected = !0x1, _0x378b5c.connection.password = null, _0x378b5c.players = [], _0x378b5c.connection.peersBackup = [], _0x378b5c.waitingList = {}, _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf), _0x132da7(_0x17edbf.elements.buttons.restart, !0x1), _0x132da7(_0x17edbf.elements.buttons.loadState, !0x1), _0x132da7(_0x17edbf.elements.buttons.saveState, !0x1), _0x378b5c.allowCheat && _0x132da7(_0x17edbf.elements.buttons.cheat, !0x1), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !0x1), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !0x1), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x3d296d) { - _0x132da7(_0x3d296d, !0x1); - }), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); - }; - _0x378b5c.connection.close = _0x2fba43, _0x378b5c.connection.disconnect = _0x2fba43, _0x378b5c.connection.leave = _0x2fba43; - var _0x3f9c57, _0x10c0ad = function(_0x42ff74, _0x306f0b, _0x345d4d) { - _0x378b5c.hideLoading.call(_0x17edbf), _0x42ff74 ? (_0x378b5c.stopLoadRooms(), _0x132da7(_0x17edbf.elements.buttons.restart, true), _0x132da7(_0x17edbf.elements.buttons.loadState, true), _0x132da7(_0x17edbf.elements.buttons.saveState, true), _0x378b5c.resetCheat(), _0x132da7(_0x17edbf.elements.buttons.cheat, true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), true), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x2911fb) { + }), _0x378b5c.roomMaster)), 'pause' === _0x2c1832.act && _0x27f4c4.Module.pauseMainLoop(), 'resume' === _0x2c1832.act && _0x27f4c4.Module.resumeMainLoop(), 'wait' === _0x2c1832.act && (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x2c1832.value !== _0x378b5c.connection.userid && (_0x378b5c.waitingList[_0x2c1832.value] = 0x1), _0x378b5c.disableControl(true)), 'wait-end' === _0x2c1832.act && (_0x378b5c.waitingList[_0x2c1832.value] && delete _0x378b5c.waitingList[_0x2c1832.value], 0x0 === Object.keys(_0x378b5c.waitingList).length && (_0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1)), 'sync-mem' === _0x2c1832.act) { + _0x378b5c.wait = true, _0x378b5c.systemPause(0x1); + var _0x2a5bce = _0x2c1832.value; + _0x378b5c.disableControl(true), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'wait', + 'value': _0x2a5bce + })); + (async () => { + const state = await _0x378b5c.saveState(); + _0x27f4c4.FS.createDataFile('/', 'game.state', state, true, true); + _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number'])('game.state', 0); + //_0x27f4c4.FS.unlink('game.state'); + _0x378b5c.inputsData = {}; + const file = new File([state], '0-game.state', { + 'type': '', + 'lastModified': new Date() + }); + _0x378b5c.connection.shareFile(file, _0x2a5bce); + })() + } + if (_0x2c1832.act, 'get-players-result' === _0x2c1832.act && (_0x378b5c.players = _0x2c1832.value, _0x378b5c.roomMaster = _0x2c1832.master, _0x2c1832.newuser === _0x378b5c.connection.userid)) { + var _0x418ccb = _0x2593da.coreOptionsValues; + _0x2c1832.coreOptions && Object.keys(_0x2c1832.coreOptions).forEach(function(_0x3f4c8f) { + _0x418ccb[_0x3f4c8f] !== _0x2c1832.coreOptions[_0x3f4c8f] && _0x2593da.updateCoreOptions.call(_0x17edbf, _0x3f4c8f, _0x2c1832.coreOptions[_0x3f4c8f]); + }), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.disableControl(true), setTimeout(function() { + _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-mem', + 'value': _0x378b5c.connection.userid + }), _0x378b5c.roomMaster); + }, 0x1), _0x378b5c.roomMaster && _0x378b5c.connection.peers[_0x378b5c.roomMaster] && (_0x378b5c.connection.extra.room_name = _0x378b5c.connection.peers[_0x378b5c.roomMaster].extra.room_name, _0x378b5c.connection.updateExtraData()), _0x378b5c.connection.peers[_0x378b5c.roomMaster] && (_0x3d0d28 = _0x378b5c.connection.peers[_0x378b5c.roomMaster].extra), _0x378b5c.openRoom(_0x17edbf); + } + } + }, _0x378b5c.connection.onUserStatusChanged = function(_0x4188ba) { + console.log('userstatuschanged', _0x4188ba); + if ('offline' === _0x4188ba.status) { + var _0x17edbf = _0x378b5c.players.indexOf(_0x4188ba.userid); + _0x17edbf >= 0x0 && (_0x378b5c.players[_0x17edbf] = null); + } + }, _0x378b5c.connection.onleave = function(_0x30ebc6) { + console.log('onleave', _0x30ebc6); + if (_0x30ebc6.userid) { + var _0x2c1832 = _0x378b5c.players.indexOf(_0x30ebc6.userid); + _0x2c1832 >= 0x0 && (_0x378b5c.players[_0x2c1832] = null); + } + _0x378b5c.waitingList[_0x30ebc6.userid] && delete _0x378b5c.waitingList[_0x30ebc6.userid], _0x378b5c.connection.isInitiator && 0x0 === Object.keys(_0x378b5c.waitingList).length && _0x378b5c.wait && (_0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({ + 'act': 'wait-end', + 'value': _0x378b5c.connection.userid + }))), _0x378b5c.openRoom(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf); + }; + var _0x2fba43 = function() { + _0x378b5c.connected = !0x1, _0x378b5c.connection.password = null, _0x378b5c.players = [], _0x378b5c.connection.peersBackup = [], _0x378b5c.waitingList = {}, _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf), _0x132da7(_0x17edbf.elements.buttons.restart, !0x1), _0x132da7(_0x17edbf.elements.buttons.loadState, !0x1), _0x132da7(_0x17edbf.elements.buttons.saveState, !0x1), _0x378b5c.allowCheat && _0x132da7(_0x17edbf.elements.buttons.cheat, !0x1), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !0x1), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !0x1), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x3d296d) { + _0x132da7(_0x3d296d, !0x1); + }), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); + }; + _0x378b5c.connection.close = _0x2fba43, _0x378b5c.connection.disconnect = _0x2fba43, _0x378b5c.connection.leave = _0x2fba43; + var _0x3f9c57, _0x10c0ad = function(_0x42ff74, _0x306f0b, _0x345d4d) { + _0x378b5c.hideLoading.call(_0x17edbf); + if (_0x42ff74) { + _0x378b5c.stopLoadRooms(); + _0x132da7(_0x17edbf.elements.buttons.restart, true); + _0x132da7(_0x17edbf.elements.buttons.loadState, true); + _0x132da7(_0x17edbf.elements.buttons.saveState, true); + _0x378b5c.resetCheat(), _0x132da7(_0x17edbf.elements.buttons.cheat, true); + _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), true); + _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), true); + Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x2911fb) { _0x132da7(_0x2911fb, true); - }), _0x378b5c.connection.socket && _0x378b5c.connection.socket.on('set-isInitiator-true', function(_0x31da46) { + })/* + _0x378b5c.connection.socket && _0x378b5c.connection.socket.on('set-isInitiator-true', function(_0x31da46) { _0x31da46 === _0x378b5c.connection.sessionid && (_0x378b5c.connection.socket.emit('extra-data-updated', _0x378b5c.connection.extra), _0x378b5c.connection.send(JSON.stringify({ 'act': 'room-master', 'value': _0x378b5c.connection.userid })), _0x378b5c.roomMaster = _0x378b5c.connection.userid, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf), _0x132da7(_0x17edbf.elements.buttons.restart, !0x1), _0x132da7(_0x17edbf.elements.buttons.loadState, !0x1), _0x132da7(_0x17edbf.elements.buttons.saveState, !0x1), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x132034) { _0x132da7(_0x132034, !0x1); })); - })) : (_0x4d8495.close(), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = _0x345d4d, _0x4d8495.show('modal-7d8fd50ed642340b', { + })*/ + } else { + _0x4d8495.close(); + _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = _0x345d4d; + _0x4d8495.show('modal-7d8fd50ed642340b', { 'closeTrigger': 'data-modal-close' - })); - }, - _0x1e0cdb = function(_0x5b3f13) { - var _0x2c1832 = _0x5b3f13.target.getAttribute('data-id'); - if ('Y' === _0x5b3f13.target.getAttribute('data-password')) _0x4d8495.show('modal-5aa765d61d8327de', { - 'closeTrigger': 'data-modal-close' - }), _0x325651.setAttribute('data-id', _0x2c1832); - else { - _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.userid = _0x378b5c.connection.token(); - try { - _0x378b5c.connection.join(_0x2c1832, _0x10c0ad); - } catch (_0x2767b9) { - _0x378b5c.hideLoading.call(_0x17edbf), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = 'Error', _0x4d8495.show('modal-7d8fd50ed642340b', { - 'closeTrigger': 'data-modal-close' - }); - } - } - return _0x5b3f13.stopPropagation(), !0x1; - }; - _0x378b5c.loadRoomsList = function() { - _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), true), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), true); - var listUrl = _0x17edbf.listUrl - if (! listUrl.endsWith('/')) { - listUrl += '/'; - }; - var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])).querySelector('tbody'), - _0x5cf2be = [listUrl, 'list?game_id=', _0x17edbf.config.gameId, '&domain=', document.domain].join(''); - _0x550f17.a.get(_0x5cf2be, {}).then(function(_0x37c60b) { - if (_0x37c60b.data) { - var _0x4782da = [], - _0x28e87d = []; - _0x2c1832.querySelectorAll('tr').forEach(function(_0x1e5a22) { - _0x28e87d.push(_0x1e5a22.getAttribute('id')); - }), Object.keys(_0x37c60b.data).forEach(function(_0x47ae0e) { - var _0x4a8f4c = _0x37c60b.data[_0x47ae0e]; - if (_0x4782da.push(_0x47ae0e), _0x28e87d.includes(_0x47ae0e)) { - var _0x2d672f = _0x2c1832.querySelector('tr[id="' .concat(_0x47ae0e, '"]')); - _0x2c1832.removeChild(_0x2d672f); - } - var _0x295f41 = document.createElement('tr'); - _0x295f41.setAttribute('id', _0x47ae0e); - var _0xa2ea61 = _0x4a8f4c.password ? _0x378b5c.icons.lock : '', - _0x5452b6 = _0x4a8f4c.password ? 'Y' : 'N', - _0xb3121d = _0x4a8f4c.current < _0x4a8f4c.max ? 'Join') : '', - _0x5c8146 = _0x4a8f4c.country ? _0x4a8f4c.country : '?'; - _0x295f41.innerHTML = '[' .concat(_0x5c8146, '] ').concat(_0xa2ea61, ' ').concat(_0x4a8f4c.room_name, '').concat(_0x4a8f4c.current, '/').concat(_0x4a8f4c.max, '').concat(_0xb3121d, ''), _0x1093f4.call(_0xa88a13, _0x295f41.querySelector('.' .concat(_0x378b5c.classNames['btn-join-room'])), 'click', _0x1e0cdb), _0x2c1832.appendChild(_0x295f41); - }), _0x2c1832.querySelectorAll('tr').forEach(function(_0x24dcf7) { - _0x4782da.includes(_0x24dcf7.id) || _0x2c1832.removeChild(_0x24dcf7); + }) + } + }, + _0x1e0cdb = function(_0x5b3f13) { + var _0x2c1832 = _0x5b3f13.target.getAttribute('data-id'); + if ('Y' === _0x5b3f13.target.getAttribute('data-password')) _0x4d8495.show('modal-5aa765d61d8327de', { + 'closeTrigger': 'data-modal-close' + }), _0x325651.setAttribute('data-id', _0x2c1832); + else { + _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.userid = _0x378b5c.connection.token(); + try { + _0x378b5c.connection.join(_0x2c1832, _0x10c0ad); + } catch (_0x2767b9) { + _0x378b5c.hideLoading.call(_0x17edbf), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = 'Error', _0x4d8495.show('modal-7d8fd50ed642340b', { + 'closeTrigger': 'data-modal-close' }); } - _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); - }).catch(function(_0x227055) { - console.log('Network Error', _0x227055), _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); - }); - }, _0x378b5c.openRoom = function() { - _0x378b5c.stopLoadRooms(); - _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), true); - _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), !0x1); - _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), true); - _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), !0x1); - _0x378b5c.resetCheat(); - _0x132da7(_this.elements.buttons.cheat, true); - var _0x17edbf = _this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), - _0x2c1832 = _0x17edbf.querySelector('[data-room-password]'); - null === _0x378b5c.connection.password ? _0x132da7(_0x2c1832, true) : (_0x132da7(_0x2c1832, !0x1), _0x2c1832.querySelector('span').innerText = _0x378b5c.connection.password); - var _0x18c1cb = _0x17edbf.querySelector('tbody'); - _0x18c1cb.innerHTML = '', _0x17edbf.querySelector('strong').innerText = _0x3d0d28.room_name, _0x378b5c.players.forEach(function(_0x938d55, _0xf3d39a) { - var _0x2c1832 = null; - if (_0x938d55 && (_0x378b5c.connection.peers[_0x938d55] ? _0x2c1832 = _0x378b5c.connection.peers[_0x938d55].extra : _0x378b5c.connection.userid === _0x938d55 && (_0x2c1832 = _0x378b5c.connection.extra), _0x2c1832 && _0x2c1832.name)) { - var _0x564064 = document.createElement('tr'); - _0x564064.innerHTML = '' .concat(_0xf3d39a + 0x1, '').concat(_0x2c1832.name, ''), _0x18c1cb.appendChild(_0x564064); - } - }); - }, _0x1093f4.call(this, _0x325651.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x9ac969) { - var _0x2c1832 = _0x325651.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; - _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.password = _0x2c1832; - var _0xcf7207 = _0x325651.getAttribute('data-id'); - _0x378b5c.connection.join(_0xcf7207, function(_0x1a0deb, _0x1ef6c8, _0x1ad18e) { - _0x10c0ad(_0x1a0deb, 0x0, _0x1ad18e), _0x1a0deb && _0x325651.classList.remove(_0x449eac({ - 'is-open': true - })); - }), _0x9ac969.stopPropagation(); - }), _0x1093f4.call(this, _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x43f795) { - var _0x17edbf = _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['netplay-player-name'])).value; - _0x17edbf = _0x17edbf.replace(/<|>/g, ''), _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = '', _0x17edbf.trim() && (_0x378b5c.playerName = _0x17edbf.trim(), _0x378b5c.connection.extra.name = _0x17edbf.trim(), _0x4d8495.close()), _0x43f795.stopPropagation(); - }), _0x1093f4.call(this, _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x202cf6) { - var _0x2c1832 = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-name-input'])).value; - _0x2c1832 = _0x2c1832.replace(/<|>/g, ''); - var _0x3510ed = _0x36bde0.querySelector('select[data-max-players] option:checked').value; - _0x3510ed < 0x2 && (_0x3510ed = 0x2), _0x3510ed > 0x4 && (_0x3510ed = 0x4); - for (var _0x1264b2 = 0x0; _0x1264b2 < _0x3510ed; _0x1264b2++) _0x378b5c.players[_0x1264b2] = null; - _0x378b5c.connection.maxParticipantsAllowed = _0x3510ed; - var _0x140bcf = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; - _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = '', _0x2c1832.trim() ? (_0x378b5c.connection.extra.room_name = _0x2c1832.trim(), '' !== _0x140bcf.trim() && (_0x378b5c.connection.password = _0x140bcf.trim()), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.open(_0x378b5c.connection.token(), function(_0x3c6c26, _0x203288, _0x210547) { - _0x378b5c.hideLoading.call(_0x17edbf), _0x3c6c26 ? (_0x378b5c.players[0x0] = _0x378b5c.connection.userid, _0x378b5c.roomMaster = _0x378b5c.connection.userid, _0x3f9c57.closeModal(), _0x378b5c.stopLoadRooms(), _0x3d0d28 = _0x378b5c.connection.extra, _0x378b5c.openRoom(_0x17edbf), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), true)) : _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = _0x210547; - })) : _0x3f9c57.closeModal(), _0x202cf6.stopPropagation(); - }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), 'click', function(_0x48cb26) { - return _0x3f9c57 = _0x4d8495.show('modal-85cd7a1c543a484a', { - 'closeTrigger': 'data-modal-close', - 'onClose': function() { - _0x17edbf.elements.container.focus(); - } - }), _0x48cb26.stopPropagation(), !0x1; - }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), 'click', function(_0x68459d) { - return _0x378b5c.connection.close(), _0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList(), _0x378b5c.inputsData = {}, _0x68459d.stopPropagation(), !0x1; + } + return _0x5b3f13.stopPropagation(), !0x1; + }; + _0x378b5c.loadRoomsList = function() { + _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), true), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), true); + let listUrl = _0x17edbf.serverURL; + if (! listUrl.endsWith('/')) { + listUrl += '/'; + }; + var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])).querySelector('tbody'), + _0x5cf2be = [listUrl, 'list?game_id=', _0x17edbf.config.gameId, '&domain=', window.location.hostname].join(''); + _0x550f17.a.get(_0x5cf2be, {}).then(function(_0x37c60b) { + if (_0x37c60b.data) { + var _0x4782da = [], + _0x28e87d = []; + _0x2c1832.querySelectorAll('tr').forEach(function(_0x1e5a22) { + _0x28e87d.push(_0x1e5a22.getAttribute('id')); + }) + _0x37c60b.data.forEach(function(_0x4a8f4c) { + var _0x47ae0e = _0x4a8f4c.name; + if (_0x4782da.push(_0x47ae0e), _0x28e87d.includes(_0x47ae0e)) { + var _0x2d672f = _0x2c1832.querySelector('tr[id="' .concat(_0x47ae0e, '"]')); + _0x2c1832.removeChild(_0x2d672f); + } + var _0x295f41 = document.createElement('tr'); + _0x295f41.setAttribute('id', _0x47ae0e); + var _0xa2ea61 = _0x4a8f4c.password ? _0x378b5c.icons.lock : '', + _0x5452b6 = _0x4a8f4c.password ? 'Y' : 'N', + _0xb3121d = _0x4a8f4c.users < _0x4a8f4c.max_users ? 'Join') : ''; + _0x295f41.innerHTML = ''.concat(_0xa2ea61, ' ').concat(_0x4a8f4c.name, '').concat(_0x4a8f4c.users, '/').concat(_0x4a8f4c.max_users, '').concat(_0xb3121d, ''), _0x1093f4.call(_0xa88a13, _0x295f41.querySelector('.' .concat(_0x378b5c.classNames['btn-join-room'])), 'click', _0x1e0cdb), _0x2c1832.appendChild(_0x295f41); + }) + _0x2c1832.querySelectorAll('tr').forEach(function(_0x24dcf7) { + _0x4782da.includes(_0x24dcf7.id) || _0x2c1832.removeChild(_0x24dcf7); + }); + } + _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); + }).catch(function(_0x227055) { + console.log('Network Error', _0x227055), _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); }); - } + }, _0x378b5c.openRoom = function() { + _0x378b5c.stopLoadRooms(); + _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), true); + _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), !0x1); + _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), true); + _0x132da7(_this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), !0x1); + _0x378b5c.resetCheat(); + _0x132da7(_this.elements.buttons.cheat, true); + var _0x17edbf = _this.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), + _0x2c1832 = _0x17edbf.querySelector('[data-room-password]'); + null === _0x378b5c.connection.password ? _0x132da7(_0x2c1832, true) : (_0x132da7(_0x2c1832, !0x1), _0x2c1832.querySelector('span').innerText = _0x378b5c.connection.password); + var _0x18c1cb = _0x17edbf.querySelector('tbody'); + _0x18c1cb.innerHTML = '', _0x17edbf.querySelector('strong').innerText = _0x3d0d28.room_name, _0x378b5c.players.forEach(function(_0x938d55, _0xf3d39a) { + var _0x2c1832 = null; + if (_0x938d55 && (_0x378b5c.connection.peers[_0x938d55] ? _0x2c1832 = _0x378b5c.connection.peers[_0x938d55].extra : _0x378b5c.connection.userid === _0x938d55 && (_0x2c1832 = _0x378b5c.connection.extra), _0x2c1832 && _0x2c1832.name)) { + var _0x564064 = document.createElement('tr'); + _0x564064.innerHTML = '' .concat(_0xf3d39a + 0x1, '').concat(_0x2c1832.name, ''), _0x18c1cb.appendChild(_0x564064); + } + }); + }, _0x1093f4.call(this, _0x325651.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x9ac969) { + var _0x2c1832 = _0x325651.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; + _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.password = _0x2c1832; + var _0xcf7207 = _0x325651.getAttribute('data-id'); + _0x378b5c.connection.join(_0xcf7207, function(_0x1a0deb, _0x1ef6c8, _0x1ad18e) { + _0x10c0ad(_0x1a0deb, 0x0, _0x1ad18e), _0x1a0deb && _0x325651.classList.remove(_0x449eac({ + 'is-open': true + })); + }), _0x9ac969.stopPropagation(); + }), _0x1093f4.call(this, _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x43f795) { + var _0x17edbf = _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['netplay-player-name'])).value; + _0x17edbf = _0x17edbf.replace(/<|>/g, ''), _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = '', _0x17edbf.trim() && (_0x378b5c.playerName = _0x17edbf.trim(), _0x378b5c.connection.extra.name = _0x17edbf.trim(), _0x4d8495.close()), _0x43f795.stopPropagation(); + }), _0x1093f4.call(this, _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x202cf6) { + var _0x2c1832 = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-name-input'])).value; + _0x2c1832 = _0x2c1832.replace(/<|>/g, ''); + var _0x3510ed = _0x36bde0.querySelector('select[data-max-players] option:checked').value; + _0x3510ed < 0x2 && (_0x3510ed = 0x2), _0x3510ed > 0x4 && (_0x3510ed = 0x4); + for (var _0x1264b2 = 0x0; _0x1264b2 < _0x3510ed; _0x1264b2++) _0x378b5c.players[_0x1264b2] = null; + _0x378b5c.connection.maxParticipantsAllowed = _0x3510ed; + var _0x140bcf = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; + _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = '', _0x2c1832.trim() ? (_0x378b5c.connection.extra.room_name = _0x2c1832.trim(), '' !== _0x140bcf.trim() && (_0x378b5c.connection.password = _0x140bcf.trim()), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.open(_0x378b5c.connection.token(), function(_0x3c6c26, _0x203288, _0x210547) { + _0x378b5c.hideLoading.call(_0x17edbf), _0x3c6c26 ? (_0x378b5c.players[0x0] = _0x378b5c.connection.userid, _0x378b5c.roomMaster = _0x378b5c.connection.userid, _0x3f9c57.closeModal(), _0x378b5c.stopLoadRooms(), _0x3d0d28 = _0x378b5c.connection.extra, _0x378b5c.openRoom(_0x17edbf), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), true)) : _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = _0x210547; + })) : _0x3f9c57.closeModal(), _0x202cf6.stopPropagation(); + }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), 'click', function(_0x48cb26) { + return _0x3f9c57 = _0x4d8495.show('modal-85cd7a1c543a484a', { + 'closeTrigger': 'data-modal-close', + 'onClose': function() { + _0x17edbf.elements.container.focus(); + } + }), _0x48cb26.stopPropagation(), !0x1; + }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), 'click', function(_0x68459d) { + return _0x378b5c.connection.close(), _0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList(), _0x378b5c.inputsData = {}, _0x68459d.stopPropagation(), !0x1; + }); window._0x378b5c = _0x378b5c; }, 'initKeyboard': function() { @@ -4298,10 +4319,51 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { if (_this.started) { saveSaveFiles(); } - }, 300000) + }, 60000) //60000 = 1 minute }, 'listeners': function() { let _this = this; + const elem = _0x530042.call(_this, '.' .concat(getClass({ + 'ejs__dialogs': true + }))); + let counter = 0; + _0x1093f4.call(_this, elem, 'dragenter', function(e) { + e.preventDefault(); + counter++; + _0x132da7(_this.elements.dialogs.message, false); + }); + _0x1093f4.call(_this, elem, 'dragover', function(e) { + e.preventDefault(); + }); + _0x1093f4.call(_this, elem, 'dragleave', function(e) { + e.preventDefault(); + counter--; + if (counter === 0) { + _0x132da7(_this.elements.dialogs.message, true); + } + }); + _0x1093f4.call(_this, elem, 'dragend', function(e) { + e.preventDefault(); + counter = 0; + _0x132da7(_this.elements.dialogs.message, true); + }); + _0x1093f4.call(_this, elem, 'drop', function(e) { + e.preventDefault(); + _0x132da7(_this.elements.dialogs.message, true); + counter = 0; + const items = e.dataTransfer.items; + let file; + for (let i=0; i { + _0x378b5c.loadState(new Uint8Array(data), 0); + }) + }); _this.elements.buttons.restart && _0x1093f4.call(_this, _this.elements.buttons.restart, 'click', function(_0x5cfc51) { _0x378b5c.restartGame(); _0x378b5c.inputsData = {}; @@ -5407,12 +5469,9 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { return _0xa88a13; }, 'supportNetPlay': function() { - if (!this.listUrl || !this.socketUrl || !this.statesSupported) return false; + if (!this.serverURL || !this.statesSupported) return false; if (this.lightgun || this.mouse) return false; - let _0xa88a13 = window.RTCPeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection || window.mozRTCPeerConnection, - _0x17edbf = window.mozRTCIceCandidate || window.RTCIceCandidate, - _0x2c1832 = window.mozRTCSessionDescription || window.RTCSessionDescription; - return !!(_0xa88a13 && _0x17edbf && _0x2c1832) && !!(_0xa88a13 && 'createDataChannel' in _0xa88a13.prototype); + return true; }, 'isNetPlay': function() {}, 'findElements': function() { @@ -5957,6 +6016,20 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { }))).appendChild(_0x13c0e4); this.elements.dialogs.gamepad = _0x13c0e4; }, + 'setMessage': function(_0x4c3fdd, _0x289259) { + let _0x13c0e4 = _0x428003('div', { + 'class': getClass({ + 'ejs__dialog': true + }), + 'hidden': '' + }), + _0xe2c02a = _0x428003('div'); + _0x13c0e4.appendChild(_0xe2c02a); + _0x530042.call(this, '.' .concat(getClass({ + 'ejs__dialogs': true + }))).appendChild(_0x13c0e4); + this.elements.dialogs.message = _0x13c0e4; + }, 'setCheat': function(_0x328075, _0x21ca37) { let _0x2c1832 = _0x7f9f36.createButton.call(this, 'cheat', { 'aria-haspopup': true, @@ -5994,6 +6067,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { this.elements.widgets.stateInfoDiv = _0x17edbf; }, 'setNetplayWidgets': function() { + return; let _0xa88a13 = _0x428003('div', { 'class': getClass({ 'ejs__widget': true, @@ -6008,6 +6082,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { this.elements.widgets.netplay = _0xa88a13; }, 'setNetplay': function(_0x1859f4, _0x50544d) { + return; _0x1859f4.appendChild(_0x7f9f36.createButton.call(this, 'netplay', { 'aria-haspopup': true, 'aria-expanded': false @@ -6146,8 +6221,9 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { _0x7f9f36.setLoadState.call(this, _0x17edbf, _0x42e40d); _0x7f9f36.setScreenRecord.call(this, _0x17edbf, _0x42e40d); _0x7f9f36.setCacheManager.call(this, _0x17edbf, _0x42e40d); - //parseInt(this.config.gameId) > 0 && _0x7f9f36.setNetplay.call(this, _0x17edbf, _0x42e40d); + parseInt(this.config.gameId) > 0 && _0x7f9f36.setNetplay.call(this, _0x17edbf, _0x42e40d); _0x7f9f36.setGamepad.call(this, _0x17edbf, _0x42e40d); + _0x7f9f36.setMessage.call(this, _0x17edbf, _0x42e40d) _0x7f9f36.setStateInfoBarWidget.call(this, _0x17edbf, _0x42e40d); _0x7f9f36.setCheat.call(this, _0x17edbf, _0x42e40d); _0x17edbf.appendChild(_0x428003('span', { @@ -6752,7 +6828,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { return path } this.localization = e => {return e}; - this.version = '3.0.5'; + this.version = '3.1.0'; this.system = ''; this.adUrl = null; this.gameName = null; @@ -6786,6 +6862,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { this.mouse = this.config.mouse; this.multitap = this.config.multitap; this.cheats = this.config.cheats; + //this.serverURL = "http://127.0.0.1:8887"; this.cheats || (this.cheats = []); let server = function(newServer) { if (typeof newServer === 'string') { diff --git a/data/emulator.js b/data/emulator.js index feaad57..1cf5306 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -242,6 +242,7 @@ var EJS = function(_0x574f5e) { } catch(e) { reject(e); } + if (inUrl.startsWith('blob:')) URL.revokeObjectURL(inUrl); resolve({ data: res, headers: {} @@ -876,6 +877,7 @@ var EJS = function(_0x574f5e) { 'btn-cancel': 'ejs--ad20569e1449d7b8e99e6465960456', 'btn-reset': 'ejs--ad20569e1449d7b8e99e6465963825', 'btn-clear': 'ejs--ad20569e1449d7b8e99e6468571053', + 'btn-close': 'ejs--iehanqurh382hriwqoriuehqr83hq9', 'tabs': 'ejs--8e7922427f460a31935084b7acfb1a', 'active': 'ejs--68d337c212ec6a5bc43125440d422b', 'tabs-content': 'ejs--31eb28817642bb1bfe0a2c422108bb', @@ -1501,2889 +1503,125 @@ var EJS = function(_0x574f5e) { 'factory': _0x5c2a4b }; }); -}, null, function(_0x14da87, _0x57407e, _0x2fa590) { - 'use strict'; - (function(_0x227bc8, _0x21b268, _0x521a09) { - function _0x4ffbab(_0x13a3d0) { - return (_0x4ffbab = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(_0x5f01ef) { - return typeof _0x5f01ef; - } : function(_0x1020c7) { - return _0x1020c7 && 'function' == typeof Symbol && _0x1020c7.constructor === Symbol && _0x1020c7 !== Symbol.prototype ? 'symbol' : typeof _0x1020c7; - })(_0x13a3d0); +}, null, function(module) { + class EJS_NETPLAY { + + constructor() { + console.log(this); } - - function _0x375f8a() { - var _0x227bc8 = this, - _0x57407e = new _0x9828fc(); - _0x227bc8.chunks = {}, _0x227bc8.users = {}, _0x227bc8.readAsArrayBuffer = function(_0x58dfb2, _0x7626c2, _0x4af133) { - var _0x12911b = { - 'file': _0x58dfb2, - 'earlyCallback': function(_0x12782b) { - _0x7626c2(_0x7086f7(_0x12782b, { - 'currentPosition': -0x1 + token() { + const S4 = function() { + return (((1+Math.random())*0x10000)|0).toString(16).substring(1); + }; + return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); + } + open(userID, callback) { + this.password = this.password || ''; + this.userid = userID; + this.connectedCB = callback; + this.isInitiator = true; + this.openSocket(() => { + this.socket.send('OpenRoom\n'+this.extra.room_name+'\n'+this.extra.name+'\n'+this.extra.domain+'\n'+this.extra.game_id+'\n'+this.maxParticipantsAllowed+'\n'+this.password); + }) + } + join(room, callback) { + this.extra.room_name = room; + this.password = this.password || ''; + this.userid = this.token(); + this.connectedCB = callback; + this.isInitiator = false; + this.openSocket(() => { + this.socket.send('JoinRoom\n'+this.extra.room_name+'\n'+this.extra.name+'\n'+this.extra.domain+'\n'+this.extra.game_id+'\n'+this.maxParticipantsAllowed+'\n'+this.password); + }) + } + openSocket(callback) { + this.socket = new WebSocket(this.socketURL); + this.socket.binaryType = "arraybuffer"; + this.socket.addEventListener('open', callback); + this.socket.addEventListener('error', this.onError.bind(this)); + //this.socket.addEventListener('close', this.onClose.bind(this)); + this.socket.addEventListener('message', this.onMessage.bind(this)); + } + onError(e) { + console.log(e); + } + onMessage(e) { + //console.log("message", e); + let json; + try { + json = JSON.parse(e.data); + } catch(e) {} + if (json && !json.msg) { + console.log(json); + } + if (this.connectedCB) { + if (e.data === "Connected") { + this.peers = {}; + this.peers[this.userid] = {extra: this.extra, userid: this.userid}; + if (!this.isInitiator) { + this.socket.send(JSON.stringify({ + type: "join", + userid: this.userid, + extra: this.extra })); - }, - 'extra': _0x4af133 || { - 'userid': 0x0 } - }; - _0x58dfb2.extra && Object.keys(_0x58dfb2.extra).length && Object.keys(_0x58dfb2.extra).forEach(function(_0x558fd0) { - _0x12911b.extra[_0x558fd0] = _0x58dfb2.extra[_0x558fd0]; - }), _0x57407e.readAsArrayBuffer(_0x227bc8, _0x12911b); - }, _0x227bc8.getNextChunk = function(_0x37ae5a, _0x7972ae, _0x4c7a43) { - var _0x604a41; - void 0x0 !== _0x37ae5a.currentPosition && (_0x604a41 = _0x37ae5a.currentPosition, _0x37ae5a = _0x37ae5a.uuid); - var _0x476bde = _0x227bc8.chunks[_0x37ae5a]; - if (_0x476bde) { - void 0x0 !== _0x4c7a43 ? (_0x227bc8.users[_0x4c7a43 + ''] || (_0x227bc8.users[_0x4c7a43 + ''] = { - 'fileUUID': _0x37ae5a, - 'userid': _0x4c7a43, - 'currentPosition': -0x1 - }), void 0x0 !== _0x604a41 && (_0x227bc8.users[_0x4c7a43 + ''].currentPosition = _0x604a41), _0x227bc8.users[_0x4c7a43 + ''].currentPosition++, _0x604a41 = _0x227bc8.users[_0x4c7a43 + ''].currentPosition) : (void 0x0 !== _0x604a41 && (_0x227bc8.chunks[_0x37ae5a].currentPosition = _0x604a41), _0x227bc8.chunks[_0x37ae5a].currentPosition++, _0x604a41 = _0x227bc8.chunks[_0x37ae5a].currentPosition); - var _0x24854d = _0x476bde[_0x604a41]; - if (!_0x24854d) return delete _0x227bc8.chunks[_0x37ae5a], void _0x227bc8.convertToArrayBuffer({ - 'chunkMissing': true, - 'currentPosition': _0x604a41, - 'uuid': _0x37ae5a - }, _0x7972ae); - _0x24854d = _0x7086f7(_0x24854d), void 0x0 !== _0x4c7a43 && (_0x24854d.remoteUserId = _0x4c7a43 + ''), _0x24854d.start && _0x227bc8.onBegin(_0x24854d), _0x24854d.end && _0x227bc8.onEnd(_0x24854d), _0x227bc8.onProgress(_0x24854d), _0x227bc8.convertToArrayBuffer(_0x24854d, function(_0x28aba8) { - _0x24854d.currentPosition != _0x24854d.maxChunks ? _0x7972ae(_0x28aba8, !0x1) : _0x7972ae(_0x28aba8, true); - }); + this.onopen(this.userid); + this.connectedCB(true); + } else { + this.connectedCB(false, null, "Error"); + //error } - }; - var _0x2fa590 = new _0x16cb0d(_0x227bc8); - - function _0x7086f7(_0x5ae569, _0x132129) { - if (null == _0x5ae569 || 'object' != _0x4ffbab(_0x5ae569)) return _0x5ae569; - if (_0x5ae569.constructor != Object && _0x5ae569.constructor != Array) return _0x5ae569; - if (_0x5ae569.constructor == Date || _0x5ae569.constructor == RegExp || _0x5ae569.constructor == Function || _0x5ae569.constructor == String || _0x5ae569.constructor == Number || _0x5ae569.constructor == Boolean) return new _0x5ae569[('constructor')](_0x5ae569); - for (var _0x2fa590 in _0x132129 = _0x132129 || new _0x5ae569[('constructor')](), _0x5ae569) _0x132129[_0x2fa590] = void 0x0 === _0x132129[_0x2fa590] ? _0x7086f7(_0x5ae569[_0x2fa590], null) : _0x132129[_0x2fa590]; - return _0x132129; - } - _0x227bc8.addChunk = function(_0x1d353d, _0x2f8a6d) { - _0x1d353d && _0x2fa590.receive(_0x1d353d, function(_0x3b5f53) { - _0x227bc8.convertToArrayBuffer({ - 'readyForNextChunk': true, - 'currentPosition': _0x3b5f53.currentPosition, - 'uuid': _0x3b5f53.uuid - }, _0x2f8a6d); - }); - }, _0x227bc8.chunkMissing = function(_0x335036) { - delete _0x2fa590.chunks[_0x335036.uuid], delete _0x2fa590.chunksWaiters[_0x335036.uuid]; - }, _0x227bc8.onBegin = function() {}, _0x227bc8.onEnd = function() {}, _0x227bc8.onProgress = function() {}, _0x227bc8.convertToObject = _0x312465.ConvertToObject, _0x227bc8.convertToArrayBuffer = _0x312465.ConvertToArrayBuffer, _0x227bc8.setMultipleUsers = function() {}; - } - - function _0x9828fc() { - this.readAsArrayBuffer = function(_0x4dd34e, _0x4dcd47) { - var _0x2fa590 = _0x4dcd47.earlyCallback; - delete _0x4dcd47.earlyCallback, - function(_0x10728e, _0x4af117) { - _0x4af117 = _0x4af117 || function(_0x1b86cb) { - postMessage(_0x1b86cb); - }; - var _0x2fa590 = _0x10728e.file; - _0x2fa590.uuid || (_0x2fa590.uuid = (0x64 * Math.random()).toString().replace(/\./g, '')); - var _0x21b268 = _0x10728e.chunkSize || 0x3a98; - _0x10728e.extra && _0x10728e.extra.chunkSize && (_0x21b268 = _0x10728e.extra.chunkSize); - var _0x521a09, _0x501fda = 0x0, - _0x58b232 = _0x21b268, - _0x41e8e7 = Math.floor(Math.min(0x5f5e100, _0x58b232) / _0x21b268) * _0x21b268, - _0x24144f = Math.ceil(_0x2fa590.size / _0x21b268); - _0x2fa590.maxChunks = _0x24144f; - var _0x3a1fa3 = 0x0, - _0x36783 = []; - _0x4af117({ - 'currentPosition': _0x3a1fa3, - 'uuid': _0x2fa590.uuid, - 'maxChunks': _0x24144f, - 'size': _0x2fa590.size, - 'name': _0x2fa590.name, - 'type': _0x2fa590.type, - 'lastModifiedDate': (_0x2fa590.lastModifiedDate || new Date()).toString(), - 'start': true - }); - var _0x14ba6c, _0x11a93b = new FileReader(); - _0x11a93b.onloadend = function(_0x5ab3c3) { - _0x5ab3c3.target.readyState == FileReader.DONE && function(_0x1a8ac9, _0x25d2e6, _0x3fea4f) { - _0x521a09 = Math.ceil(_0x25d2e6.byteLength / _0x21b268); - for (var _0x26fcc7 = 0x0; _0x26fcc7 < _0x521a09; _0x26fcc7++) { - var _0x198455 = _0x26fcc7 * _0x21b268; - _0x36783[_0x3a1fa3] = _0x25d2e6.slice(_0x198455, Math.min(_0x198455 + _0x21b268, _0x25d2e6.byteLength)), _0x4af117({ - 'uuid': _0x2fa590.uuid, - 'buffer': _0x36783[_0x3a1fa3], - 'currentPosition': _0x3a1fa3, - 'maxChunks': _0x24144f, - 'size': _0x2fa590.size, - 'name': _0x2fa590.name, - 'lastModifiedDate': (_0x2fa590.lastModifiedDate || new Date()).toString(), - 'type': _0x2fa590.type - }), _0x3a1fa3++; - } - _0x3a1fa3 == _0x24144f && true, _0x3fea4f(); - }(_0x2fa590.name, _0x5ab3c3.target.result, function() { - (++_0x501fda + 0x1) * _0x41e8e7 < _0x2fa590.size ? (_0x14ba6c = _0x2fa590.slice(_0x501fda * _0x41e8e7, (_0x501fda + 0x1) * _0x41e8e7), _0x11a93b.readAsArrayBuffer(_0x14ba6c)) : _0x501fda * _0x41e8e7 < _0x2fa590.size ? (_0x14ba6c = _0x2fa590.slice(_0x501fda * _0x41e8e7, _0x2fa590.size), _0x11a93b.readAsArrayBuffer(_0x14ba6c)) : (_0x2fa590.url = URL.createObjectURL(_0x2fa590), _0x4af117({ - 'currentPosition': _0x3a1fa3, - 'uuid': _0x2fa590.uuid, - 'maxChunks': _0x24144f, - 'size': _0x2fa590.size, - 'name': _0x2fa590.name, - 'lastModifiedDate': (_0x2fa590.lastModifiedDate || new Date()).toString(), - 'url': URL.createObjectURL(_0x2fa590), - 'type': _0x2fa590.type, - 'end': true - })); - }); - }, _0x3a1fa3 += 0x1, _0x14ba6c = _0x2fa590.slice(_0x501fda * _0x41e8e7, (_0x501fda + 0x1) * _0x41e8e7), _0x11a93b.readAsArrayBuffer(_0x14ba6c); - }(_0x4dcd47, function(_0x4a4561) { - _0x4dd34e.chunks[_0x4a4561.uuid] || (_0x4dd34e.chunks[_0x4a4561.uuid] = { - 'currentPosition': -0x1 - }), _0x4dcd47.extra = _0x4dcd47.extra || { - 'userid': 0x0 - }, _0x4a4561.userid = _0x4dcd47.userid || _0x4dcd47.extra.userid || 0x0, _0x4a4561.extra = _0x4dcd47.extra, _0x4dd34e.chunks[_0x4a4561.uuid][_0x4a4561.currentPosition] = _0x4a4561, _0x4a4561.end && _0x2fa590 && (_0x2fa590(_0x4a4561.uuid), _0x2fa590 = null), _0x4a4561.maxChunks > 0xc8 && 0xc8 == _0x4a4561.currentPosition && _0x2fa590 && (_0x2fa590(_0x4a4561.uuid), _0x2fa590 = null); - }); - }; - } - - function _0x2e28ea() { - var _0x227bc8 = this, - _0x57407e = function() {}; - - function _0x35adf9(_0x1e577f, _0x35d31a, _0x142c1a) { - _0x1e577f = _0x1e577f || function() {}; - var _0x9eb682 = document.createElement('input'); - _0x9eb682.type = 'file', _0x35d31a && (_0x9eb682.multiple = true), _0x142c1a && (_0x9eb682.webkitdirectory = true), _0x9eb682.accept = _0x227bc8.accept, _0x9eb682.onclick = function() { - _0x9eb682.clickStarted = true; - }, document.body.onfocus = function() { - setTimeout(function() { - _0x9eb682.clickStarted && (_0x9eb682.clickStarted = !0x1, _0x9eb682.value || _0x57407e()); - }, 0x1f4); - }, _0x9eb682.onchange = function() { - if (_0x35d31a) { - if (!_0x9eb682.files.length) return void console.error('No file selected.'); - var _0x227bc8 = []; - return Array.from(_0x9eb682.files).forEach(function(_0x2af58c) { - _0x2af58c.url = _0x2af58c.webkitRelativePath, _0x227bc8.push(_0x2af58c); - }), void _0x1e577f(_0x227bc8); - } - _0x9eb682.files[0x0] ? (_0x1e577f(_0x9eb682.files[0x0]), _0x9eb682.parentNode.removeChild(_0x9eb682)) : console.error('No file selected.'); - }, _0x9eb682.style.display = 'none', (document.body || document.documentElement).appendChild(_0x9eb682), - function(_0x19672d) { - if ('function' == typeof _0x19672d.click) return void _0x19672d.click(); - if ('function' == typeof _0x19672d.change) return void _0x19672d.change(); - if (void 0x0 !== document.createEvent('Event')) { - if ('function' == typeof(_0x57407e = document.createEvent('Event')).initEvent && 'function' == typeof _0x19672d.dispatchEvent) return _0x57407e.initEvent('click', true, true), void _0x19672d.dispatchEvent(_0x57407e); - } - var _0x57407e = new MouseEvent('click', { - 'view': window, - 'bubbles': true, - 'cancelable': true - }); - _0x19672d.dispatchEvent(_0x57407e); - }(_0x9eb682); - } - _0x227bc8.selectSingleFile = function(_0x4fa940, _0x591d34) { - _0x591d34 && (_0x57407e = _0x591d34), _0x35adf9(_0x4fa940); - }, _0x227bc8.selectMultipleFiles = function(_0x425e11, _0x2ac31d) { - _0x2ac31d && (_0x57407e = _0x2ac31d), _0x35adf9(_0x425e11, true); - }, _0x227bc8.selectDirectory = function(_0x37cf39, _0x415668) { - _0x415668 && (_0x57407e = _0x415668), _0x35adf9(_0x37cf39, true, true); - }, _0x227bc8.accept = '*.*'; - } - - function _0x16cb0d(_0x8e4e9f) { - var _0x57407e = this; - _0x57407e.chunks = {}, _0x57407e.chunksWaiters = {}, _0x57407e.receive = function _0x2fa590(_0x15cb17, _0x5d669f) { - if (_0x15cb17.uuid) { - if (_0x15cb17.start && !_0x57407e.chunks[_0x15cb17.uuid] && (_0x57407e.chunks[_0x15cb17.uuid] = {}, _0x8e4e9f.onBegin && _0x8e4e9f.onBegin(_0x15cb17)), !_0x15cb17.end && _0x15cb17.buffer && (_0x57407e.chunks[_0x15cb17.uuid][_0x15cb17.currentPosition] = _0x15cb17.buffer), _0x15cb17.end) { - var _0x31fb82 = _0x57407e.chunks[_0x15cb17.uuid], - _0x32838f = []; - Object.keys(_0x31fb82).forEach(function(_0x5c3abb, _0x23c1e3) { - _0x32838f.push(_0x31fb82[_0x5c3abb]); - }); - var _0x2545f2 = new Blob(_0x32838f, { - 'type': _0x15cb17.type - }); - (_0x2545f2 = _0x1e6a28(_0x2545f2, _0x15cb17)).url = URL.createObjectURL(_0x2545f2), _0x2545f2.uuid = _0x15cb17.uuid, _0x2545f2.size || console.error('Something went wrong. Blob Size is 0.'), _0x8e4e9f.onEnd && _0x8e4e9f.onEnd(_0x2545f2), delete _0x57407e.chunks[_0x15cb17.uuid], delete _0x57407e.chunksWaiters[_0x15cb17.uuid]; - } - _0x15cb17.buffer && _0x8e4e9f.onProgress && _0x8e4e9f.onProgress(_0x15cb17), _0x15cb17.end || (_0x5d669f(_0x15cb17), _0x57407e.chunksWaiters[_0x15cb17.uuid] = function() { - setTimeout(function _0x8e4e9f() { - _0x15cb17.buffer && _0x57407e.chunks[_0x15cb17.uuid] && (_0x15cb17.currentPosition == _0x15cb17.maxChunks || _0x57407e.chunks[_0x15cb17.uuid][_0x15cb17.currentPosition] || (_0x5d669f(_0x15cb17), setTimeout(_0x8e4e9f, 0x1388))); - }, 0x1388); - }, _0x57407e.chunksWaiters[_0x15cb17.uuid]()); - } else _0x8e4e9f.convertToObject(_0x15cb17, function(_0x2fa56c) { - _0x2fa590(_0x2fa56c); - }); - }; - } - var _0x312465 = { - 'ConvertToArrayBuffer': function(_0x561864, _0x85e2e2) { - _0x4928e6.pack(_0x561864, function(_0xc97573) { - _0x85e2e2(_0xc97573.buffer); - }); - }, - 'ConvertToObject': function(_0xbedec5, _0x48182e) { - _0x4928e6.unpack(_0xbedec5, _0x48182e); - } - }; - - function _0x1e6a28(_0x51381f, _0x26556f) { - if (_0x51381f || (_0x51381f = {}), !_0x26556f) return _0x51381f; - for (var _0x2fa590 in _0x26556f) try { - _0x51381f[_0x2fa590] = _0x26556f[_0x2fa590]; - } catch (_0x1cadcb) {} - return _0x51381f; - } - var _0x37e2da = Uint8Array.BYTES_PER_ELEMENT, - _0x49bb1a = Uint16Array.BYTES_PER_ELEMENT, - _0x4929a3 = Uint32Array.BYTES_PER_ELEMENT, - _0x437498 = { - 'NULL': 0x0, - 'UNDEFINED': 0x1, - 'STRING': 0x2, - 'NUMBER': 0x3, - 'BOOLEAN': 0x4, - 'ARRAY': 0x5, - 'OBJECT': 0x6, - 'INT8ARRAY': 0x7, - 'INT16ARRAY': 0x8, - 'INT32ARRAY': 0x9, - 'UINT8ARRAY': 0xa, - 'UINT16ARRAY': 0xb, - 'UINT32ARRAY': 0xc, - 'FLOAT32ARRAY': 0xd, - 'FLOAT64ARRAY': 0xe, - 'ARRAYBUFFER': 0xf, - 'BLOB': 0x10, - 'FILE': 0x10, - 'BUFFER': 0x11 - }, - _0xb2a130 = [null, null, 'Uint16', 'Float64', 'Uint8', null, null, 'Int8', 'Int16', 'Int32', 'Uint8', 'Uint16', 'Uint32', 'Float32', 'Float64', 'Uint8', 'Uint8', 'Uint8'], - _0x274b69 = function(_0x297fe0) { - var _0x57407e = 0x0, - _0x2fa590 = 0x0, - _0x21b268 = 0x0, - _0x521a09 = new ArrayBuffer(_0x297fe0[0x0].byte_length + _0x297fe0[0x0].header_size), - _0x5e7442 = new DataView(_0x521a09); - for (_0x2fa590 = 0x0; _0x2fa590 < _0x297fe0.length; _0x2fa590++) { - _0x297fe0[_0x2fa590].header_size; - var _0x2227f0 = _0x297fe0[_0x2fa590].type, - _0x37072f = _0x297fe0[_0x2fa590].length, - _0x4841f8 = _0x297fe0[_0x2fa590].value, - _0x4015d6 = _0x297fe0[_0x2fa590].byte_length, - _0x5da52f = _0xb2a130[_0x2227f0], - _0x1b9cc6 = null === _0x5da52f ? 0x0 : window[_0x5da52f + 'Array'].BYTES_PER_ELEMENT; - switch (_0x2227f0 === _0x437498.BUFFER ? _0x5e7442.setUint8(_0x57407e, _0x437498.BLOB, !0x1) : _0x5e7442.setUint8(_0x57407e, _0x2227f0, !0x1), _0x57407e += _0x37e2da, _0x2227f0 !== _0x437498.ARRAY && _0x2227f0 !== _0x437498.OBJECT || (_0x5e7442.setUint16(_0x57407e, _0x37072f, !0x1), _0x57407e += _0x49bb1a), _0x5e7442.setUint32(_0x57407e, _0x4015d6, !0x1), _0x57407e += _0x4929a3, _0x2227f0) { - case _0x437498.NULL: - case _0x437498.UNDEFINED: - break; - case _0x437498.STRING: - for (_0x21b268 = 0x0; _0x21b268 < _0x37072f; _0x21b268++, _0x57407e += _0x1b9cc6) _0x5e7442.setUint16(_0x57407e, _0x4841f8.charCodeAt(_0x21b268), !0x1); - break; - case _0x437498.NUMBER: - case _0x437498.BOOLEAN: - 0x0, _0x5e7442['set' + _0x5da52f](_0x57407e, _0x4841f8, !0x1), _0x57407e += _0x1b9cc6; - break; - case _0x437498.INT8ARRAY: - case _0x437498.INT16ARRAY: - case _0x437498.INT32ARRAY: - case _0x437498.UINT8ARRAY: - case _0x437498.UINT16ARRAY: - case _0x437498.UINT32ARRAY: - case _0x437498.FLOAT32ARRAY: - case _0x437498.FLOAT64ARRAY: - new Uint8Array(_0x5e7442.buffer, _0x57407e, _0x4015d6).set(new Uint8Array(_0x4841f8.buffer)), _0x57407e += _0x4015d6; - break; - case _0x437498.ARRAYBUFFER: - case _0x437498.BUFFER: - new Uint8Array(_0x5e7442.buffer, _0x57407e, _0x4015d6).set(new Uint8Array(_0x4841f8)), _0x57407e += _0x4015d6; - break; - case _0x437498.BLOB: - case _0x437498.ARRAY: - case _0x437498.OBJECT: - break; - default: - throw 'TypeError: Unexpected type found.'; - } - 0x0; - } - return _0x5e7442; - }, - _0x2e9e54 = function _0x57407e(_0x37452e, _0x38040a) { - var _0x521a09, _0x26deb8, _0xfbd54a, _0x3f6107, _0x1535e7, _0x406eb5 = 0x0; - _0x521a09 = _0x37452e.getUint8(_0x38040a, !0x1), _0x38040a += _0x37e2da, _0x521a09 !== _0x437498.ARRAY && _0x521a09 !== _0x437498.OBJECT || (_0x26deb8 = _0x37452e.getUint16(_0x38040a, !0x1), _0x38040a += _0x49bb1a), _0xfbd54a = _0x37452e.getUint32(_0x38040a, !0x1), _0x38040a += _0x4929a3; - var _0x3b56e7 = _0xb2a130[_0x521a09], - _0x5b8ec5 = null === _0x3b56e7 ? 0x0 : window[_0x3b56e7 + 'Array'].BYTES_PER_ELEMENT; - switch (_0x521a09) { - case _0x437498.NULL: - case _0x437498.UNDEFINED: - 0x0, _0x3f6107 = null; - break; - case _0x437498.STRING: - _0x26deb8 = _0xfbd54a / _0x5b8ec5; - var _0x3316fc = []; - for (_0x406eb5 = 0x0; _0x406eb5 < _0x26deb8; _0x406eb5++) { - var _0x35da1f = _0x37452e.getUint16(_0x38040a, !0x1); - _0x38040a += _0x5b8ec5, _0x3316fc.push(String.fromCharCode(_0x35da1f)); - } - _0x3f6107 = _0x3316fc.join(''); - break; - case _0x437498.NUMBER: - _0x3f6107 = _0x37452e.getFloat64(_0x38040a, !0x1), _0x38040a += _0x5b8ec5; - break; - case _0x437498.BOOLEAN: - _0x3f6107 = 0x1 === _0x37452e.getUint8(_0x38040a, !0x1), _0x38040a += _0x5b8ec5; - break; - case _0x437498.INT8ARRAY: - case _0x437498.INT16ARRAY: - case _0x437498.INT32ARRAY: - case _0x437498.UINT8ARRAY: - case _0x437498.UINT16ARRAY: - case _0x437498.UINT32ARRAY: - case _0x437498.FLOAT32ARRAY: - case _0x437498.FLOAT64ARRAY: - case _0x437498.ARRAYBUFFER: - _0x1535e7 = _0x37452e.buffer.slice(_0x38040a, _0x38040a + _0xfbd54a), _0x38040a += _0xfbd54a, _0x3f6107 = _0x521a09 === _0x437498.ARRAYBUFFER ? _0x1535e7 : new window[_0x3b56e7 + ('Array')](_0x1535e7); - break; - case _0x437498.BLOB: - if (window.Blob) { - var _0x2161f5 = _0x57407e(_0x37452e, _0x38040a), - _0x5f11ba = _0x57407e(_0x37452e, _0x2161f5.cursor); - _0x38040a = _0x5f11ba.cursor, _0x3f6107 = new Blob([_0x5f11ba.value], { - 'type': _0x2161f5.value - }); - } else _0x1535e7 = _0x37452e.buffer.slice(_0x38040a, _0x38040a + _0xfbd54a), _0x38040a += _0xfbd54a, _0x3f6107 = new _0x227bc8(_0x1535e7); - break; - case _0x437498.ARRAY: - for (_0x3f6107 = [], _0x406eb5 = 0x0; _0x406eb5 < _0x26deb8; _0x406eb5++) _0x38040a = (_0x1535e7 = _0x57407e(_0x37452e, _0x38040a)).cursor, _0x3f6107.push(_0x1535e7.value); - break; - case _0x437498.OBJECT: - for (_0x3f6107 = {}, _0x406eb5 = 0x0; _0x406eb5 < _0x26deb8; _0x406eb5++) { - var _0x4fee35 = _0x57407e(_0x37452e, _0x38040a), - _0x118c66 = _0x57407e(_0x37452e, _0x4fee35.cursor); - _0x38040a = _0x118c66.cursor, _0x3f6107[_0x4fee35.value] = _0x118c66.value; - } - break; - default: - throw 'TypeError: Type not supported.'; - } - return { - 'value': _0x3f6107, - 'cursor': _0x38040a - }; - }, - _0x3cd888 = function(_0x7f4367, _0x498c64) { - for (var _0x2fa590 = _0x7f4367.length, _0x21b268 = [], _0x521a09 = 0x0, _0x3fb688 = 0x0, _0x48740b = 0x0; _0x48740b < _0x7f4367.length; _0x48740b++) ! function(_0x48a8b8) { - _0x131344(_0x7f4367[_0x48a8b8], function(_0x118c9f) { - if (_0x21b268[_0x48a8b8] = _0x118c9f, _0x3fb688 += _0x118c9f[0x0].header_size + _0x118c9f[0x0].byte_length, ++_0x521a09 === _0x2fa590) { - for (var _0x341601 = [], _0x44bc9f = 0x0; _0x44bc9f < _0x21b268.length; _0x44bc9f++) _0x341601 = _0x341601.concat(_0x21b268[_0x44bc9f]); - _0x498c64(_0x341601, _0x3fb688); - } - }); - }(_0x48740b); - }, - _0x131344 = function(_0x26bbec, _0x41d66e) { - var _0x21b268, _0x521a09, _0xcfca39 = _0x37e2da + _0x4929a3, - _0x1c90b5 = 0x0, - _0x5a7868 = 0x0, - _0x23293e = _0x26bbec; - switch (_0x521a09 = function(_0x54f8b4) { - var _0x41d66e = void 0x0; - if (void 0x0 === _0x54f8b4) _0x41d66e = _0x437498.UNDEFINED; - else if (null === _0x54f8b4) _0x41d66e = _0x437498.NULL; - else { - var _0x21b268 = _0x54f8b4.constructor.name, - _0x521a09 = _0x54f8b4.constructor.toString().match(/\w+/g)[0x1]; - if (void 0x0 !== _0x21b268 && void 0x0 !== _0x437498[_0x21b268.toUpperCase()]) _0x41d66e = _0x437498[_0x21b268.toUpperCase()]; - else if (void 0x0 !== _0x521a09 && void 0x0 !== _0x437498[_0x521a09.toUpperCase()]) _0x41d66e = _0x437498[_0x521a09.toUpperCase()]; - else switch (_0x4ffbab(_0x54f8b4)) { - case 'string': - _0x41d66e = _0x437498.STRING; - break; - case 'number': - _0x41d66e = _0x437498.NUMBER; - break; - case 'boolean': - _0x41d66e = _0x437498.BOOLEAN; - break; - case 'object': - _0x54f8b4 instanceof Array ? _0x41d66e = _0x437498.ARRAY : _0x54f8b4 instanceof Int8Array ? _0x41d66e = _0x437498.INT8ARRAY : _0x54f8b4 instanceof Int16Array ? _0x41d66e = _0x437498.INT16ARRAY : _0x54f8b4 instanceof Int32Array ? _0x41d66e = _0x437498.INT32ARRAY : _0x54f8b4 instanceof Uint8Array ? _0x41d66e = _0x437498.UINT8ARRAY : _0x54f8b4 instanceof Uint16Array ? _0x41d66e = _0x437498.UINT16ARRAY : _0x54f8b4 instanceof Uint32Array ? _0x41d66e = _0x437498.UINT32ARRAY : _0x54f8b4 instanceof Float32Array ? _0x41d66e = _0x437498.FLOAT32ARRAY : _0x54f8b4 instanceof Float64Array ? _0x41d66e = _0x437498.FLOAT64ARRAY : _0x54f8b4 instanceof ArrayBuffer ? _0x41d66e = _0x437498.ARRAYBUFFER : _0x54f8b4 instanceof Blob ? _0x41d66e = _0x437498.BLOB : _0x54f8b4 instanceof _0x227bc8 ? _0x41d66e = _0x437498.BUFFER : _0x54f8b4 instanceof Object && (_0x41d66e = _0x437498.OBJECT); - } - } - return _0x41d66e; - }(_0x26bbec), _0x21b268 = null == _0xb2a130[_0x521a09] ? 0x0 : window[_0xb2a130[_0x521a09] + 'Array'].BYTES_PER_ELEMENT, _0x521a09) { - case _0x437498.UNDEFINED: - case _0x437498.NULL: - break; - case _0x437498.NUMBER: - case _0x437498.BOOLEAN: - _0x1c90b5 = _0x21b268; - break; - case _0x437498.STRING: - _0x1c90b5 += (_0x5a7868 = _0x26bbec.length) * _0x21b268; - break; - case _0x437498.INT8ARRAY: - case _0x437498.INT16ARRAY: - case _0x437498.INT32ARRAY: - case _0x437498.UINT8ARRAY: - case _0x437498.UINT16ARRAY: - case _0x437498.UINT32ARRAY: - case _0x437498.FLOAT32ARRAY: - case _0x437498.FLOAT64ARRAY: - _0x1c90b5 += (_0x5a7868 = _0x26bbec.length) * _0x21b268; - break; - case _0x437498.ARRAY: - return void _0x3cd888(_0x26bbec, function(_0x4ce812, _0x3cc28c) { - _0x41d66e([{ - 'type': _0x521a09, - 'length': _0x26bbec.length, - 'header_size': _0xcfca39 + _0x49bb1a, - 'byte_length': _0x3cc28c, - 'value': null - }].concat(_0x4ce812)); - }); - case _0x437498.OBJECT: - var _0x1eb997 = []; - for (var _0x501244 in _0x26bbec) _0x26bbec.hasOwnProperty(_0x501244) && (_0x1eb997.push(_0x501244), _0x1eb997.push(_0x26bbec[_0x501244]), _0x5a7868++); - return void _0x3cd888(_0x1eb997, function(_0x57eeb8, _0x18e5d9) { - _0x41d66e([{ - 'type': _0x521a09, - 'length': _0x5a7868, - 'header_size': _0xcfca39 + _0x49bb1a, - 'byte_length': _0x18e5d9, - 'value': null - }].concat(_0x57eeb8)); - }); - case _0x437498.ARRAYBUFFER: - _0x1c90b5 += _0x26bbec.byteLength; - break; - case _0x437498.BLOB: - var _0x485cd2 = _0x26bbec.type, - _0x15ca13 = new FileReader(); - return _0x15ca13.onload = function(_0x238bf7) { - _0x3cd888([_0x485cd2, _0x238bf7.target.result], function(_0x2faa2d, _0x5dc863) { - _0x41d66e([{ - 'type': _0x521a09, - 'length': _0x5a7868, - 'header_size': _0xcfca39, - 'byte_length': _0x5dc863, - 'value': null - }].concat(_0x2faa2d)); - }); - }, _0x15ca13.onerror = function(_0x18343b) { - throw 'FileReader Error: ' + _0x18343b; - }, void _0x15ca13.readAsArrayBuffer(_0x26bbec); - case _0x437498.BUFFER: - _0x1c90b5 += _0x26bbec.length; - break; - default: - throw 'TypeError: Type "' + _0x26bbec.constructor.name + '" not supported.'; - } - _0x41d66e([{ - 'type': _0x521a09, - 'length': _0x5a7868, - 'header_size': _0xcfca39, - 'byte_length': _0x1c90b5, - 'value': _0x23293e - }].concat([])); - }, - _0x1913f9 = function(_0xbd3651, _0x26d417) { - var _0x2fa590 = _0xbd3651 instanceof DataView ? _0xbd3651 : new DataView(_0xbd3651); - return _0x2e9e54(_0x2fa590, 0x0).value; - }; - var _0x4928e6 = { - 'pack': function(_0x5aea7d, _0x22db9e) { - try { - 0x0, - _0x131344(_0x5aea7d, function(_0xf0091e) { - _0x22db9e(_0x274b69(_0xf0091e)); - }); - } - catch (_0x5adeaa) { - throw _0x5adeaa; - } - }, - 'unpack': function(_0x458a5d, _0x3c312b) { - try { - 0x0; - var _0x2fa590 = _0x1913f9(_0x458a5d); - 0x0, _0x3c312b(_0x2fa590); - } catch (_0x11220e) { - throw _0x11220e; - } - } - }; - _0x57407e.a = function(_0x1056a5, _0x326931) { - var _0x3a9045; - let io; -//socket.io library -!function(t,e){io=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var m=Object.create(null);m.open="0",m.close="1",m.ping="2",m.pong="3",m.message="4",m.upgrade="5",m.noop="6";var b=Object.create(null);Object.keys(m).forEach((function(t){b[m[t]]=t}));for(var k={type:"error",data:"parser error"},w="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),_="function"==typeof ArrayBuffer,O=function(t,e,n){var r,i=t.type,o=t.data;return w&&o instanceof Blob?e?n(o):A(o,n):_&&(o instanceof ArrayBuffer||(r=o,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer))?e?n(o):A(new Blob([o]),n):n(m[i]+(o||""))},A=function(t,e){var n=new FileReader;return n.onload=function(){var t=n.result.split(",")[1];e("b"+t)},n.readAsDataURL(t)},E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",R="undefined"==typeof Uint8Array?[]:new Uint8Array(256),T=0;T1?{type:b[n],data:t.substring(1)}:{type:b[n]}:k},S=function(t,e){if(C){var n=function(t){var e,n,r,i,o,s=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var u=new ArrayBuffer(s),h=new Uint8Array(u);for(e=0;e>4,h[c++]=(15&r)<<4|i>>2,h[c++]=(3&i)<<6|63&o;return u}(t);return N(n,e)}return{base64:!0,data:t}},N=function(t,e){return"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t},x=String.fromCharCode(30);function L(t){if(t)return function(t){for(var e in L.prototype)t[e]=L.prototype[e];return t}(t)}L.prototype.on=L.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},L.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},L.prototype.off=L.prototype.removeListener=L.prototype.removeAllListeners=L.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i1?e-1:0),r=1;r0);return e}function W(){var t=z(+new Date);return t!==F?(K=0,F=t):t+"."+z(K++)}for(;Y<64;Y++)H[V[Y]]=Y;function $(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function J(t){for(var e={},n=t.split("&"),r=0,i=n.length;r0&&void 0!==arguments[0]?arguments[0]:{};return i(t,{xd:this.xd,xs:this.xs},this.opts),new nt(this.uri(),t)}},{key:"doWrite",value:function(t,e){var n=this,r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",(function(t,e){n.onError("xhr post error",t,e)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e,n){t.onError("xhr poll error",e,n)})),this.pollXhr=e}}]),s}(U),nt=function(t){o(i,t);var n=p(i);function i(t,r){var o;return e(this,i),D(f(o=n.call(this)),r),o.opts=r,o.method=r.method||"GET",o.uri=t,o.async=!1!==r.async,o.data=void 0!==r.data?r.data:null,o.create(),o}return r(i,[{key:"create",value:function(){var t=this,e=j(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;var n=this.xhr=new Q(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var r in n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}catch(t){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{n.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=function(){4===n.readyState&&(200===n.status||1223===n.status?t.onLoad():t.setTimeoutFn((function(){t.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((function(){t.onError(e)}),0)}"undefined"!=typeof document&&(this.index=i.requestsCount++,i.requests[this.index]=this)}},{key:"onError",value:function(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Z,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete i.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}},{key:"abort",value:function(){this.cleanup()}}]),i}(L);if(nt.requestsCount=0,nt.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",rt);else if("function"==typeof addEventListener){addEventListener("onpagehide"in P?"pagehide":"unload",rt,!1)}function rt(){for(var t in nt.requests)nt.requests.hasOwnProperty(t)&&nt.requests[t].abort()}var it="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},ot=P.WebSocket||P.MozWebSocket,st="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),at=function(t){o(i,t);var n=p(i);function i(t){var r;return e(this,i),(r=n.call(this,t)).supportsBinary=!t.forceBase64,r}return r(i,[{key:"name",get:function(){return"websocket"}},{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,n=st?{}:j(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=st?new ot(t,e,n):e?new ot(t,e):new ot(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=function(e){return t.onClose({description:"websocket connection closed",context:e})},this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var n=function(n){var r=t[n],i=n===t.length-1;O(r,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}i&&it((function(){e.writable=!0,e.emitReserved("drain")}),e.setTimeoutFn)}))},r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),r=s.call(this),n&&"object"===t(n)&&(o=n,n=null),n?(n=ft(n),o.hostname=n.host,o.secure="https"===n.protocol||"wss"===n.protocol,o.port=n.port,n.query&&(o.query=n.query)):o.host&&(o.hostname=ft(o.host).host),D(f(r),o),r.secure=null!=o.secure?o.secure:"undefined"!=typeof location&&"https:"===location.protocol,o.hostname&&!o.port&&(o.port=r.secure?"443":"80"),r.hostname=o.hostname||("undefined"!=typeof location?location.hostname:"localhost"),r.port=o.port||("undefined"!=typeof location&&location.port?location.port:r.secure?"443":"80"),r.transports=o.transports||["polling","websocket"],r.readyState="",r.writeBuffer=[],r.prevBufferLen=0,r.opts=i({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},o),r.opts.path=r.opts.path.replace(/\/$/,"")+"/","string"==typeof r.opts.query&&(r.opts.query=J(r.opts.query)),r.id=null,r.upgrades=null,r.pingInterval=null,r.pingTimeout=null,r.pingTimeoutTimer=null,"function"==typeof addEventListener&&(r.opts.closeOnBeforeunload&&addEventListener("beforeunload",(function(){r.transport&&(r.transport.removeAllListeners(),r.transport.close())}),!1),"localhost"!==r.hostname&&(r.offlineEventListener=function(){r.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",r.offlineEventListener,!1))),r.open(),r}return r(a,[{key:"createTransport",value:function(t){var e=i({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var n=i({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new ct[t](n)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(t){return e.onClose("transport close",t)}))}},{key:"probe",value:function(t){var e=this,n=this.createTransport(t),r=!1;a.priorWebsocketSuccess=!1;var i=function(){r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",(function(t){if(!r)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emitReserved("upgrading",n),!n)return;a.priorWebsocketSuccess="websocket"===n.name,e.transport.pause((function(){r||"closed"!==e.readyState&&(f(),e.setTransport(n),n.send([{type:"upgrade"}]),e.emitReserved("upgrade",n),n=null,e.upgrading=!1,e.flush())}))}else{var i=new Error("probe error");i.transport=n.name,e.emitReserved("upgradeError",i)}})))};function o(){r||(r=!0,f(),n.close(),n=null)}var s=function(t){var r=new Error("probe error: "+t);r.transport=n.name,o(),e.emitReserved("upgradeError",r)};function c(){s("transport closed")}function u(){s("socket closed")}function h(t){n&&t.name!==n.name&&o()}var f=function(){n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",c),e.off("close",u),e.off("upgrading",h)};n.once("open",i),n.once("error",s),n.once("close",c),this.once("close",u),this.once("upgrading",h),n.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t1))return this.writeBuffer;for(var t,e=1,n=0;n=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}return this.writeBuffer}},{key:"write",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"send",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"sendPacket",value:function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var i={type:t,data:e,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},n=function n(){t.off("upgrade",n),t.off("upgradeError",n),e()},r=function(){t.once("upgrade",n),t.once("upgradeError",n)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?r():e()})):this.upgrading?r():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],n=0,r=t.length;n0;case Ot.ACK:case Ot.BINARY_ACK:return Array.isArray(n)}}}]),a}(L),Rt=function(){function t(n){e(this,t),this.packet=n,this.buffers=[],this.reconPack=n}return r(t,[{key:"takeBinaryData",value:function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=wt(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}},{key:"finishedReconstruction",value:function(){this.reconPack=null,this.buffers=[]}}]),t}(),Tt=Object.freeze({__proto__:null,protocol:5,get PacketType(){return Ot},Encoder:At,Decoder:Et});function Ct(t,e,n){return t.on(e,n),function(){t.off(e,n)}}var Bt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),St=function(t){o(i,t);var n=p(i);function i(t,r,o){var s;return e(this,i),(s=n.call(this)).connected=!1,s.receiveBuffer=[],s.sendBuffer=[],s.ids=0,s.acks={},s.flags={},s.io=t,s.nsp=r,o&&o.auth&&(s.auth=o.auth),s.io._autoConnect&&s.open(),s}return r(i,[{key:"disconnected",get:function(){return!this.connected}},{key:"subEvents",value:function(){if(!this.subs){var t=this.io;this.subs=[Ct(t,"open",this.onopen.bind(this)),Ct(t,"packet",this.onpacket.bind(this)),Ct(t,"error",this.onerror.bind(this)),Ct(t,"close",this.onclose.bind(this))]}}},{key:"active",get:function(){return!!this.subs}},{key:"connect",value:function(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}},{key:"open",value:function(){return this.connect()}},{key:"send",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1?e-1:0),r=1;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Nt.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},Nt.prototype.reset=function(){this.attempts=0},Nt.prototype.setMin=function(t){this.ms=t},Nt.prototype.setMax=function(t){this.max=t},Nt.prototype.setJitter=function(t){this.jitter=t};var xt=function(n){o(s,n);var i=p(s);function s(n,r){var o,a;e(this,s),(o=i.call(this)).nsps={},o.subs=[],n&&"object"===t(n)&&(r=n,n=void 0),(r=r||{}).path=r.path||"/socket.io",o.opts=r,D(f(o),r),o.reconnection(!1!==r.reconnection),o.reconnectionAttempts(r.reconnectionAttempts||1/0),o.reconnectionDelay(r.reconnectionDelay||1e3),o.reconnectionDelayMax(r.reconnectionDelayMax||5e3),o.randomizationFactor(null!==(a=r.randomizationFactor)&&void 0!==a?a:.5),o.backoff=new Nt({min:o.reconnectionDelay(),max:o.reconnectionDelayMax(),jitter:o.randomizationFactor()}),o.timeout(null==r.timeout?2e4:r.timeout),o._readyState="closed",o.uri=n;var c=r.parser||Tt;return o.encoder=new c.Encoder,o.decoder=new c.Decoder,o._autoConnect=!1!==r.autoConnect,o._autoConnect&&o.open(),o}return r(s,[{key:"reconnection",value:function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}},{key:"reconnectionAttempts",value:function(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}},{key:"reconnectionDelay",value:function(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}},{key:"randomizationFactor",value:function(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}},{key:"reconnectionDelayMax",value:function(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}},{key:"timeout",value:function(t){return arguments.length?(this._timeout=t,this):this._timeout}},{key:"maybeReconnectOnOpen",value:function(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}},{key:"open",value:function(t){var e=this;if(~this._readyState.indexOf("open"))return this;this.engine=new lt(this.uri,this.opts);var n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;var i=Ct(n,"open",(function(){r.onopen(),t&&t()})),o=Ct(n,"error",(function(n){r.cleanup(),r._readyState="closed",e.emitReserved("error",n),t?t(n):r.maybeReconnectOnOpen()}));if(!1!==this._timeout){var s=this._timeout;0===s&&i();var a=this.setTimeoutFn((function(){i(),n.close(),n.emit("error",new Error("timeout"))}),s);this.opts.autoUnref&&a.unref(),this.subs.push((function(){clearTimeout(a)}))}return this.subs.push(i),this.subs.push(o),this}},{key:"connect",value:function(t){return this.open(t)}},{key:"onopen",value:function(){this.cleanup(),this._readyState="open",this.emitReserved("open");var t=this.engine;this.subs.push(Ct(t,"ping",this.onping.bind(this)),Ct(t,"data",this.ondata.bind(this)),Ct(t,"error",this.onerror.bind(this)),Ct(t,"close",this.onclose.bind(this)),Ct(this.decoder,"decoded",this.ondecoded.bind(this)))}},{key:"onping",value:function(){this.emitReserved("ping")}},{key:"ondata",value:function(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error")}}},{key:"ondecoded",value:function(t){this.emitReserved("packet",t)}},{key:"onerror",value:function(t){this.emitReserved("error",t)}},{key:"socket",value:function(t,e){var n=this.nsps[t];return n||(n=new St(this,t,e),this.nsps[t]=n),n}},{key:"_destroy",value:function(t){for(var e=0,n=Object.keys(this.nsps);e=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{var n=this.backoff.duration();this._reconnecting=!0;var r=this.setTimeoutFn((function(){e.skipReconnect||(t.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((function(n){n?(e._reconnecting=!1,e.reconnect(),t.emitReserved("reconnect_error",n)):e.onreconnect()})))}),n);this.opts.autoUnref&&r.unref(),this.subs.push((function(){clearTimeout(r)}))}}},{key:"onreconnect",value:function(){var t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}]),s}(L),Lt={};function Pt(e,n){"object"===t(e)&&(n=e,e=void 0);var r,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=t;n=n||"undefined"!=typeof location&&location,null==t&&(t=n.protocol+"//"+n.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==n?n.protocol+"//"+t:"https://"+t),r=ft(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(n=n||{}).path||"/socket.io"),o=i.source,s=i.id,a=i.path,c=Lt[s]&&a in Lt[s].nsps;return n.forceNew||n["force new connection"]||!1===n.multiplex||c?r=new xt(o,n):(Lt[s]||(Lt[s]=new xt(o,n)),r=Lt[s]),i.query&&!n.query&&(n.query=i.queryKey),r.socket(i.path,n)}return i(Pt,{Manager:xt,Socket:St,io:Pt,connect:Pt}),Pt})); - - function _0x45c30f(_0xa98659, _0x1eb953) { - function _0x535f92(_0x27aced) { - return !_0x27aced.audio && !_0x27aced.video && !_0x27aced.screen && _0x27aced.data; - } - var _0x21b268 = ''; - _0x21b268 += '?userid=' + _0xa98659.userid, _0x21b268 += '&sessionid=' + _0xa98659.sessionid, _0x21b268 += '&msgEvent=' + _0xa98659.socketMessageEvent, _0x21b268 += '&socketCustomEvent=' + _0xa98659.socketCustomEvent, _0x21b268 += '&autoCloseEntireSession=' + !!_0xa98659.autoCloseEntireSession, true === _0xa98659.session.broadcast && (_0x21b268 += '&oneToMany=true'), _0x21b268 += '&maxParticipantsAllowed=' + _0xa98659.maxParticipantsAllowed, _0xa98659.enableScalableBroadcast && (_0x21b268 += '&enableScalableBroadcast=true', _0x21b268 += '&maxRelayLimitPerUser=' + (_0xa98659.maxRelayLimitPerUser || 0x2)), _0x21b268 += '&extra=' + JSON.stringify(_0xa98659.extra || {}), _0xa98659.socketCustomParameters && (_0x21b268 += _0xa98659.socketCustomParameters); - if (_0xa98659.socketURL || (_0xa98659.socketURL = '/'), '/' != _0xa98659.socketURL.substr(_0xa98659.socketURL.length - 0x1, 0x1)) throw '"socketURL" MUST end with a slash.'; - _0xa98659.enableLogs && ('/' == _0xa98659.socketURL ? console.info('socket.io url is: ', location.origin + '/') : console.info('socket.io url is: ', _0xa98659.socketURL)); - _0xa98659.socket = io(_0xa98659.socketURL + _0x21b268); - var _0x521a09 = _0xa98659.multiPeersHandler; - - function _0x370cbb(_0x2c02cf, _0x6d0458) { - _0xa98659.peersBackup[_0x2c02cf] || (_0xa98659.peersBackup[_0x2c02cf] = { - 'userid': _0x2c02cf, - 'extra': {} - }), _0xa98659.peersBackup[_0x2c02cf].extra = _0x6d0458; - } - _0xa98659.socket.on('extra-data-updated', function(_0x9c9848, _0x58a2b1) { - _0xa98659.peers[_0x9c9848] && (_0xa98659.peers[_0x9c9848].extra = _0x58a2b1, _0xa98659.onExtraDataUpdated({ - 'userid': _0x9c9848, - 'extra': _0x58a2b1 - }), _0x370cbb(_0x9c9848, _0x58a2b1)); - }), _0xa98659.socket.on(_0xa98659.socketMessageEvent, function _0x1eb953(_0x42ad3e) { - if (_0x42ad3e.remoteUserId == _0xa98659.userid) - if (_0xa98659.peers[_0x42ad3e.sender] && _0xa98659.peers[_0x42ad3e.sender].extra != _0x42ad3e.message.extra && (_0xa98659.peers[_0x42ad3e.sender].extra = _0x42ad3e.extra, _0xa98659.onExtraDataUpdated({ - 'userid': _0x42ad3e.sender, - 'extra': _0x42ad3e.extra - }), _0x370cbb(_0x42ad3e.sender, _0x42ad3e.extra)), _0x42ad3e.message.streamSyncNeeded && _0xa98659.peers[_0x42ad3e.sender]) { - var _0x12f90b = _0xa98659.streamEvents[_0x42ad3e.message.streamid]; - if (!_0x12f90b || !_0x12f90b.stream) return; - var _0x7f592a = _0x42ad3e.message.action; - if ('ended' === _0x7f592a || 'inactive' === _0x7f592a || 'stream-removed' === _0x7f592a) return _0xa98659.peersBackup[_0x12f90b.userid] && (_0x12f90b.extra = _0xa98659.peersBackup[_0x12f90b.userid].extra), void _0xa98659.onstreamended(_0x12f90b); - var _0x43403d = 'both' != _0x42ad3e.message.type ? _0x42ad3e.message.type : null; - 'function' == typeof _0x12f90b.stream[_0x7f592a] && _0x12f90b.stream[_0x7f592a](_0x43403d); - } else if ('dropPeerConnection' !== _0x42ad3e.message) { - if (_0x42ad3e.message.allParticipants) return -0x1 === _0x42ad3e.message.allParticipants.indexOf(_0x42ad3e.sender) && _0x42ad3e.message.allParticipants.push(_0x42ad3e.sender), void _0x42ad3e.message.allParticipants.forEach(function(_0x45f777) { - _0x521a09[_0xa98659.peers[_0x45f777] ? 'renegotiatePeer' : 'createNewPeer'](_0x45f777, { - 'localPeerSdpConstraints': { - 'OfferToReceiveAudio': _0xa98659.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0xa98659.sdpConstraints.mandatory.OfferToReceiveVideo - }, - 'remotePeerSdpConstraints': { - 'OfferToReceiveAudio': _0xa98659.session.oneway ? !!_0xa98659.session.audio : _0xa98659.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0xa98659.session.oneway ? !!_0xa98659.session.video || !!_0xa98659.session.screen : _0xa98659.sdpConstraints.mandatory.OfferToReceiveVideo - }, - 'isOneWay': !!_0xa98659.session.oneway || 'one-way' === _0xa98659.direction, - 'isDataOnly': _0x535f92(_0xa98659.session) - }); - }); - if (_0x42ad3e.message.newParticipant) { - if (_0x42ad3e.message.newParticipant == _0xa98659.userid) return; - if (_0xa98659.peers[_0x42ad3e.message.newParticipant]) return; - _0x521a09.createNewPeer(_0x42ad3e.message.newParticipant, _0x42ad3e.message.userPreferences || { - 'localPeerSdpConstraints': { - 'OfferToReceiveAudio': _0xa98659.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0xa98659.sdpConstraints.mandatory.OfferToReceiveVideo - }, - 'remotePeerSdpConstraints': { - 'OfferToReceiveAudio': _0xa98659.session.oneway ? !!_0xa98659.session.audio : _0xa98659.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0xa98659.session.oneway ? !!_0xa98659.session.video || !!_0xa98659.session.screen : _0xa98659.sdpConstraints.mandatory.OfferToReceiveVideo - }, - 'isOneWay': !!_0xa98659.session.oneway || 'one-way' === _0xa98659.direction, - 'isDataOnly': _0x535f92(_0xa98659.session) - }); - } else if (_0x42ad3e.message.readyForOffer && (_0xa98659.attachStreams.length && (_0xa98659.waitingForLocalMedia = !0x1), _0xa98659.waitingForLocalMedia)) setTimeout(function() { - _0x1eb953(_0x42ad3e); - }, 0x1); - else if (_0x42ad3e.message.newParticipationRequest && _0x42ad3e.sender !== _0xa98659.userid) { - _0xa98659.peers[_0x42ad3e.sender] && _0xa98659.deletePeer(_0x42ad3e.sender); - var _0x8b8a4a = { - 'extra': _0x42ad3e.extra || {}, - 'localPeerSdpConstraints': _0x42ad3e.message.remotePeerSdpConstraints || { - 'OfferToReceiveAudio': _0xa98659.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0xa98659.sdpConstraints.mandatory.OfferToReceiveVideo - }, - 'remotePeerSdpConstraints': _0x42ad3e.message.localPeerSdpConstraints || { - 'OfferToReceiveAudio': _0xa98659.session.oneway ? !!_0xa98659.session.audio : _0xa98659.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0xa98659.session.oneway ? !!_0xa98659.session.video || !!_0xa98659.session.screen : _0xa98659.sdpConstraints.mandatory.OfferToReceiveVideo - }, - 'isOneWay': void 0x0 !== _0x42ad3e.message.isOneWay ? _0x42ad3e.message.isOneWay : !!_0xa98659.session.oneway || 'one-way' === _0xa98659.direction, - 'isDataOnly': void 0x0 !== _0x42ad3e.message.isDataOnly ? _0x42ad3e.message.isDataOnly : _0x535f92(_0xa98659.session), - 'dontGetRemoteStream': void 0x0 !== _0x42ad3e.message.isOneWay ? _0x42ad3e.message.isOneWay : !!_0xa98659.session.oneway || 'one-way' === _0xa98659.direction, - 'dontAttachLocalStream': !!_0x42ad3e.message.dontGetRemoteStream, - 'connectionDescription': _0x42ad3e, - 'successCallback': function() {} - }; - _0xa98659.onNewParticipant(_0x42ad3e.sender, _0x8b8a4a); - } else { - if (_0x42ad3e.message.changedUUID && _0xa98659.peers[_0x42ad3e.message.oldUUID] && (_0xa98659.peers[_0x42ad3e.message.newUUID] = _0xa98659.peers[_0x42ad3e.message.oldUUID], delete _0xa98659.peers[_0x42ad3e.message.oldUUID]), _0x42ad3e.message.userLeft) return _0x521a09.onUserLeft(_0x42ad3e.sender), void(_0x42ad3e.message.autoCloseEntireSession && _0xa98659.leave()); - _0x521a09.addNegotiatedMessage(_0x42ad3e.message, _0x42ad3e.sender); - } - } else _0xa98659.deletePeer(_0x42ad3e.sender); - }); - var _0x56cf17 = !0x1; - _0xa98659.socket.resetProps = function() { - _0x56cf17 = !0x1; - }, _0xa98659.socket.on('connect', function() { - _0xa98659.onopen(_0xa98659.userid); - console.log(_0xa98659); - _0x56cf17 || (_0x56cf17 = true, _0xa98659.enableLogs && console.info('socket.io connection is opened.'), setTimeout(function() { - _0xa98659.socket.emit('extra-data-updated', _0xa98659.extra); - }, 0x3e8), _0x1eb953 && _0x1eb953(_0xa98659.socket)); - }), _0xa98659.socket.on('disconnect', function() { - _0xa98659.enableLogs && console.warn('socket.io connection is closed'), _0xa98659.close(); - }), _0xa98659.socket.on('user-disconnected', function(_0x54aa18) { - _0x54aa18 !== _0xa98659.userid && (_0xa98659.onUserStatusChanged({ - 'userid': _0x54aa18, - 'status': 'offline', - 'extra': _0xa98659.peers[_0x54aa18] && _0xa98659.peers[_0x54aa18].extra || {} - }), _0xa98659.deletePeer(_0x54aa18)); - }), _0xa98659.socket.on('user-connected', function(_0x5ca80a) { - if (_0x5ca80a !== _0xa98659.userid) { - _0xa98659.peers[_0x5ca80a] || (_0xa98659.peers[_0x5ca80a] = {}); - _0xa98659.onopen(_0x5ca80a); - _0xa98659.onUserStatusChanged({ - 'userid': _0x5ca80a, - 'status': 'online', - 'extra': _0xa98659.peers[_0x5ca80a] && _0xa98659.peers[_0x5ca80a].extra || {} - }); - } - }), _0xa98659.socket.on('closed-entire-session', function(_0x4808cd, _0x427eb3) { - _0xa98659.leave(), _0xa98659.onEntireSessionClosed({ - 'sessionid': _0x4808cd, - 'userid': _0x4808cd, - 'extra': _0x427eb3 - }); - }), _0xa98659.socket.on('userid-already-taken', function(_0x420cd1, _0x1408ae) { - _0xa98659.onUserIdAlreadyTaken(_0x420cd1, _0x1408ae); - }), _0xa98659.socket.on('logs', function(_0x5e50a8) { - _0xa98659.enableLogs && console.debug('server-logs', _0x5e50a8); - }), _0xa98659.socket.on('number-of-broadcast-viewers-updated', function(_0x6c7075) { - _0xa98659.onNumberOfBroadcastViewersUpdated(_0x6c7075); - }), _0xa98659.socket.on('set-isInitiator-true', function(_0x4f8f7b) { - _0x4f8f7b == _0xa98659.sessionid && (_0xa98659.isInitiator = true); - }), _0xa98659.socket.on('data-message', function(data) { - _0xa98659.onmessage(data); - }), _0xa98659.socket.on('file-message', async function(data) { - const url = URL.createObjectURL(new Blob([data.file])); - _0xa98659.onFileStart({name:data.name}); - _0xa98659.onFileEnd({url, name:data.name}); - }); - _0xa98659.shareFile = async function(file) { - const data = await file.arrayBuffer(); - _0xa98659.socket.emit('file-message', {file:data, name:file.name}); - } - _0xa98659.send = function(data) { - _0xa98659.socket && _0xa98659.socket.emit('data-message', data); - } - } - - function _0x11ea4f(_0x433d1d) { - var _0x326931 = this, - _0x2fa590 = ['getAllParticipants', 'getLength', 'selectFirst', 'streams', 'send', 'forEach']; - - function _0x2aa4ee() { - _0x433d1d.fbr = new _0x375f8a(), _0x433d1d.fbr.onProgress = function(_0x4fd092) { - _0x433d1d.onFileProgress(_0x4fd092); - }, _0x433d1d.fbr.onBegin = function(_0x4d54b6) { - _0x433d1d.onFileStart(_0x4d54b6); - }, _0x433d1d.fbr.onEnd = function(_0x50bc40) { - _0x433d1d.onFileEnd(_0x50bc40); - }; - } - _0x433d1d.peers = { - 'getLength': function() { - var _0x433d1d = 0x0; - for (var _0x326931 in this) - 0x1 == _0x2fa590.indexOf(_0x326931) && _0x433d1d++; - return _0x433d1d; - }, - 'selectFirst': function() { - var _0x433d1d; - for (var _0x326931 in this) - 0x1 == _0x2fa590.indexOf(_0x326931) && (_0x433d1d = this[_0x326931]); - return _0x433d1d; - }, - 'getAllParticipants': function(_0x3c84ce) { - var _0x326931 = []; - for (var _0x2aa4ee in this) - 0x1 == _0x2fa590.indexOf(_0x2aa4ee) && _0x2aa4ee != _0x3c84ce && _0x326931.push(_0x2aa4ee); - return _0x326931; - }, - 'forEach': function(_0x3602ec) { - this.getAllParticipants().forEach(function(_0x5a1e0f) { - _0x3602ec(_0x433d1d.peers[_0x5a1e0f]); - }); - }, - 'send': function(_0x5ba79e, _0x17c086) { - var _0x521a09 = this; - if (!_0x3b94ab(_0x5ba79e.size) && !_0x3b94ab(_0x5ba79e.type)) { - if (_0x433d1d.enableFileSharing) return void _0x326931.shareFile(_0x5ba79e, _0x17c086); - 'string' != typeof _0x5ba79e && (_0x5ba79e = JSON.stringify(_0x5ba79e)); - } - if ('text' === _0x5ba79e.type || _0x5ba79e instanceof ArrayBuffer || _0x5ba79e instanceof DataView) { - if ('text' === _0x5ba79e.type && (_0x5ba79e = JSON.stringify(_0x5ba79e)), _0x17c086) { - var _0x53f36f = _0x433d1d.peers[_0x17c086]; - if (_0x53f36f) return _0x53f36f.channels.length ? void _0x53f36f.channels.forEach(function(_0x157888) { - _0x157888.send(_0x5ba79e); - }) : (_0x433d1d.peers[_0x17c086].createDataChannel(), _0x433d1d.renegotiate(_0x17c086), void setTimeout(function() { - _0x521a09.send(_0x5ba79e, _0x17c086); - }, 0xbb8)); - } - this.getAllParticipants().forEach(function(_0x20abac) { - if (!_0x521a09[_0x20abac].channels.length) return _0x433d1d.peers[_0x20abac].createDataChannel(), _0x433d1d.renegotiate(_0x20abac), void setTimeout(function() { - _0x521a09[_0x20abac].channels.forEach(function(_0x3e199c) { - _0x3e199c.send(_0x5ba79e); - }); - }, 0xbb8); - _0x521a09[_0x20abac].channels.forEach(function(_0x35ed8c) { - _0x35ed8c.send(_0x5ba79e); - }); - }); - } else _0x21703b.send({ - 'text': _0x5ba79e, - 'channel': this, - 'connection': _0x433d1d, - 'remoteUserId': _0x17c086 - }); - } - }, this.uuid = _0x433d1d.userid, this.getLocalConfig = function(_0x137423, _0x261ef, _0x2d10e4) { - return _0x2d10e4 || (_0x2d10e4 = {}), { - 'streamsToShare': _0x2d10e4.streamsToShare || {}, - 'rtcMultiConnection': _0x433d1d, - 'connectionDescription': _0x2d10e4.connectionDescription, - 'userid': _0x261ef, - 'localPeerSdpConstraints': _0x2d10e4.localPeerSdpConstraints, - 'remotePeerSdpConstraints': _0x2d10e4.remotePeerSdpConstraints, - 'dontGetRemoteStream': !!_0x2d10e4.dontGetRemoteStream, - 'dontAttachLocalStream': !!_0x2d10e4.dontAttachLocalStream, - 'renegotiatingPeer': !!_0x2d10e4.renegotiatingPeer, - 'peerRef': _0x2d10e4.peerRef, - 'channels': _0x2d10e4.channels || [], - 'onLocalSdp': function(_0x44a3ae) { - _0x326931.onNegotiationNeeded(_0x44a3ae, _0x261ef); - }, - 'onLocalCandidate': function(_0x405c4b) { - (_0x405c4b = _0x2b9f47.processCandidates(_0x433d1d, _0x405c4b)) && _0x326931.onNegotiationNeeded(_0x405c4b, _0x261ef); - }, - 'remoteSdp': _0x137423, - 'onDataChannelMessage': function(_0x149155) { - if (!_0x433d1d.fbr && _0x433d1d.enableFileSharing && _0x2aa4ee(), 'string' != typeof _0x149155 && _0x433d1d.enableFileSharing) { - var _0x2d10e4 = this; - _0x149155 instanceof ArrayBuffer || _0x149155 instanceof DataView ? _0x433d1d.fbr.convertToObject(_0x149155, function(_0x2664a9) { - _0x2d10e4.onDataChannelMessage(_0x2664a9); - }) : _0x149155.readyForNextChunk ? _0x433d1d.fbr.getNextChunk(_0x149155, function(_0x1453bf, _0x8de0f1) { - _0x433d1d.peers[_0x261ef].channels.forEach(function(_0x5f29e7) { - _0x5f29e7.send(_0x1453bf); - }); - }, _0x261ef) : _0x149155.chunkMissing ? _0x433d1d.fbr.chunkMissing(_0x149155) : _0x433d1d.fbr.addChunk(_0x149155, function(_0x8e01c9) { - _0x433d1d.peers[_0x261ef].peer.channel.send(_0x8e01c9); - }); - } else _0x326931.onDataChannelMessage(_0x149155, _0x261ef); - }, - 'onDataChannelError': function(_0x300f94) { - _0x326931.onDataChannelError(_0x300f94, _0x261ef); - }, - 'onDataChannelOpened': function(_0x5919e5) { - _0x326931.onDataChannelOpened(_0x5919e5, _0x261ef); - }, - 'onDataChannelClosed': function(_0x37c3b1) { - _0x326931.onDataChannelClosed(_0x37c3b1, _0x261ef); - }, - 'onRemoteStream': function(_0x44e333) { - _0x433d1d.peers[_0x261ef] && _0x433d1d.peers[_0x261ef].streams.push(_0x44e333), _0x326931.onGettingRemoteMedia(_0x44e333, _0x261ef); - }, - 'onRemoteStreamRemoved': function(_0x1e2862) { - _0x326931.onRemovingRemoteMedia(_0x1e2862, _0x261ef); - }, - 'onPeerStateChanged': function(_0x483374) { - _0x326931.onPeerStateChanged(_0x483374), 'new' === _0x483374.iceConnectionState && _0x326931.onNegotiationStarted(_0x261ef, _0x483374), 'connected' === _0x483374.iceConnectionState && _0x326931.onNegotiationCompleted(_0x261ef, _0x483374), -0x1 !== _0x483374.iceConnectionState.search(/closed|failed/gi) && (_0x326931.onUserLeft(_0x261ef), _0x326931.disconnectWith(_0x261ef)); - } - }; - }, this.createNewPeer = function(_0x4f4c1b, _0x54114b) { - console.log('createNewPeer', _0x4f4c1b, _0x54114b) - if (!(_0x433d1d.maxParticipantsAllowed <= _0x433d1d.getAllParticipants().length)) { - if (_0x54114b = _0x54114b || {}, _0x433d1d.isInitiator && _0x433d1d.session.audio && 'two-way' === _0x433d1d.session.audio && !_0x54114b.streamsToShare && (_0x54114b.isOneWay = !0x1, _0x54114b.isDataOnly = !0x1, _0x54114b.session = _0x433d1d.session), !_0x54114b.isOneWay && !_0x54114b.isDataOnly) return _0x54114b.isOneWay = true, void this.onNegotiationNeeded({ - 'enableMedia': true, - 'userPreferences': _0x54114b - }, _0x4f4c1b); - _0x433d1d.peers[_0x4f4c1b] = _0x54114b; - } - }, this.createAnsweringPeer = function(_0x432071, _0x5d1056, _0x4e2b15) { - _0x4e2b15 = _0x433d1d.setUserPreferences(_0x4e2b15 || {}, _0x5d1056); - var _0x521a09 = this.getLocalConfig(_0x432071, _0x5d1056, _0x4e2b15); - _0x433d1d.peers[_0x5d1056] = new _0x4c6fdb(_0x521a09); - }, this.renegotiatePeer = function(_0xf6c803, _0x597405, _0x29d9b2) { - if (_0x433d1d.peers[_0xf6c803]) { - _0x597405 || (_0x597405 = {}), _0x597405.renegotiatingPeer = true, _0x597405.peerRef = _0x433d1d.peers[_0xf6c803].peer, _0x597405.channels = _0x433d1d.peers[_0xf6c803].channels; - var _0x521a09 = this.getLocalConfig(_0x29d9b2, _0xf6c803, _0x597405); - _0x433d1d.peers[_0xf6c803] = new _0x4c6fdb(_0x521a09); - } else _0x433d1d.enableLogs && console.error('Peer (' + _0xf6c803 + ') does not exist. Renegotiation skipped.'); - }, this.replaceTrack = function(_0x110184, _0x52c3ce, _0x25f6eb) { - if (!_0x433d1d.peers[_0x52c3ce]) throw 'This peer (' + _0x52c3ce + ') does not exist.'; - var _0x521a09 = _0x433d1d.peers[_0x52c3ce].peer; - _0x521a09.getSenders && 'function' == typeof _0x521a09.getSenders && _0x521a09.getSenders().length ? _0x521a09.getSenders().forEach(function(_0x96ed5f) { - _0x25f6eb && 'video' === _0x96ed5f.track.kind && (_0x433d1d.peers[_0x52c3ce].peer.lastVideoTrack = _0x96ed5f.track, _0x96ed5f.replaceTrack(_0x110184)), _0x25f6eb || 'audio' !== _0x96ed5f.track.kind || (_0x433d1d.peers[_0x52c3ce].peer.lastAudioTrack = _0x96ed5f.track, _0x96ed5f.replaceTrack(_0x110184)); - }) : (console.warn('RTPSender.replaceTrack is NOT supported.'), this.renegotiatePeer(_0x52c3ce)); - }, this.onNegotiationNeeded = function(_0x33db7a, _0x5f4a7c) {}, this.addNegotiatedMessage = function(_0x1d484a, _0x448bd9) { - if (_0x1d484a.type && _0x1d484a.sdp) return 'answer' == _0x1d484a.type && _0x433d1d.peers[_0x448bd9] && _0x433d1d.peers[_0x448bd9].addRemoteSdp(_0x1d484a), 'offer' == _0x1d484a.type && (_0x1d484a.renegotiatingPeer ? this.renegotiatePeer(_0x448bd9, null, _0x1d484a) : this.createAnsweringPeer(_0x1d484a, _0x448bd9)), void(_0x433d1d.enableLogs && console.log('Remote peer\x27s sdp:', _0x1d484a.sdp)); - if (_0x1d484a.candidate) return _0x433d1d.peers[_0x448bd9] && _0x433d1d.peers[_0x448bd9].addRemoteCandidate(_0x1d484a), void(_0x433d1d.enableLogs && console.log('Remote peer\'s candidate pairs:', _0x1d484a.candidate)); - if (_0x1d484a.enableMedia) { - _0x433d1d.session = _0x1d484a.userPreferences.session || _0x433d1d.session, _0x433d1d.session.oneway && _0x433d1d.attachStreams.length && (_0x433d1d.attachStreams = []), _0x1d484a.userPreferences.isDataOnly && _0x433d1d.attachStreams.length && (_0x433d1d.attachStreams.length = []); - var _0x521a09 = {}; - _0x433d1d.attachStreams.forEach(function(_0x549219) { - _0x521a09[_0x549219.streamid] = { - 'isAudio': !!_0x549219.isAudio, - 'isVideo': !!_0x549219.isVideo, - 'isScreen': !!_0x549219.isScreen - }; - }), _0x1d484a.userPreferences.streamsToShare = _0x521a09, _0x326931.onNegotiationNeeded({ - 'readyForOffer': true, - 'userPreferences': _0x1d484a.userPreferences - }, _0x448bd9); - } - _0x1d484a.readyForOffer && _0x433d1d.onReadyForOffer(_0x448bd9, _0x1d484a.userPreferences); - }, this.onGettingRemoteMedia = function(_0x1d2a39, _0x50fcf9) {}, this.onRemovingRemoteMedia = function(_0x2c048b, _0x238637) {}, this.onGettingLocalMedia = function(_0x10860a) {}, this.onLocalMediaError = function(_0x33725e, _0x45b7ee) { - _0x433d1d.onMediaError(_0x33725e, _0x45b7ee); - }; - var _0x521a09 = new _0x342039(_0x433d1d); - this.onDataChannelMessage = function(_0x5f266f, _0x384695) { - _0x521a09.receive(JSON.parse(_0x5f266f), _0x384695, _0x433d1d.peers[_0x384695] ? _0x433d1d.peers[_0x384695].extra : {}); - }, this.onDataChannelClosed = function(_0x5448c4, _0x5c5d37) { - _0x5448c4.userid = _0x5c5d37, _0x5448c4.extra = _0x433d1d.peers[_0x5c5d37] ? _0x433d1d.peers[_0x5c5d37].extra : {}, _0x433d1d.onclose(_0x5448c4); - }, this.onDataChannelError = function(_0x2a9d6, _0x55de25) { - _0x2a9d6.userid = _0x55de25, event.extra = _0x433d1d.peers[_0x55de25] ? _0x433d1d.peers[_0x55de25].extra : {}, _0x433d1d.onerror(_0x2a9d6); - }, this.onDataChannelOpened = function(_0x5d5514, _0x255c92) { - _0x433d1d.peers[_0x255c92].channels.length ? _0x433d1d.peers[_0x255c92].channels = [_0x5d5514] : (_0x433d1d.peers[_0x255c92].channels.push(_0x5d5514), _0x433d1d.onopen({ - 'userid': _0x255c92, - 'extra': _0x433d1d.peers[_0x255c92] ? _0x433d1d.peers[_0x255c92].extra : {}, - 'channel': _0x5d5514 + this.connectedCB = null; + } else if (json && json.msg) { + if (this.userid === json.user) return; + this.onmessage(json.data); + } else if (json && json.type === 'join') { + this.peers[json.userid] = {extra: json.extra, userid: json.userid}; + if (this.isInitiator) { + this.socket.send(JSON.stringify({ + type: "peersSync", + peers: this.peers })); - }, this.onPeerStateChanged = function(_0x463911) { - _0x433d1d.onPeerStateChanged(_0x463911); - }, this.onNegotiationStarted = function(_0x134c39, _0x554768) {}, this.onNegotiationCompleted = function(_0x40ab4e, _0x24f174) {}, this.getRemoteStreams = function(_0x196151) { - return _0x196151 = _0x196151 || _0x433d1d.peers.getAllParticipants()[0x0], _0x433d1d.peers[_0x196151] ? _0x433d1d.peers[_0x196151].streams : []; - }; - } - - function _0x121233(_0x421b61, _0x4c65b9, _0x1382be) { - if ('undefined' != typeof CustomEvent) { - var _0x21b268 = new CustomEvent(_0x4c65b9, { - 'arguments': _0x1382be, - '__exposedProps__': _0x1382be - }); - _0x421b61.dispatchEvent(_0x21b268); } + this.onopen(json.userid); + } else if (json && json.type === "incoming-file") { + this.incomingFile = {name:json.name}; + this.onFileStart({name:json.name}); + } else if (json && json.type === "file-data") { + this.incomingFile.data = Uint8Array.from(json.data); + } else if (json && json.type === "file-end") { + this.onFileEnd({name:this.incomingFile.name, data: Uint8Array.from(this.incomingFile.data)}); + this.incomingFile = null; + } else if (json && json.type === "peersSync") { + this.peers = json.peers; } - - function _0x57b754(_0x51d3ee, _0x17d2b8) { - _0x17d2b8.stream && _0x17d2b8.stream && _0x17d2b8.stream.addEventListener && (_0x17d2b8.stream.addEventListener('mute', function(_0x20fbf4) { - (_0x20fbf4 = _0x51d3ee.streamEvents[_0x17d2b8.streamid]).session = { - 'audio': 'audio' === _0x20fbf4.muteType, - 'video': 'video' === _0x20fbf4.muteType - }, _0x51d3ee.onmute(_0x20fbf4); - }, !0x1), _0x17d2b8.stream.addEventListener('unmute', function(_0x5b824c) { - (_0x5b824c = _0x51d3ee.streamEvents[_0x17d2b8.streamid]).session = { - 'audio': 'audio' === _0x5b824c.unmuteType, - 'video': 'video' === _0x5b824c.unmuteType - }, _0x51d3ee.onunmute(_0x5b824c); - }, !0x1)); - } - - function _0x5b8d5d() { - if (window.crypto && window.crypto.getRandomValues && -0x1 === navigator.userAgent.indexOf('Safari')) { - for (var _0x1056a5 = window.crypto.getRandomValues(new Uint32Array(0x3)), _0x326931 = '', _0x2fa590 = 0x0, _0x21b268 = _0x1056a5.length; _0x2fa590 < _0x21b268; _0x2fa590++) _0x326931 += _0x1056a5[_0x2fa590].toString(0x24); - return _0x326931; - } - return (Math.random() * new Date().getTime()).toString(0x24).replace(/\./g, ''); - } - - function _0x412d65(_0x385896, _0x40a9c8, _0x449aca) { - if (_0x449aca.autoCreateMediaElement) { - var _0x21b268 = !0x1; - _0x2cbba5(_0x385896, 'video').length || _0x385896.isVideo || _0x385896.isScreen || (_0x21b268 = true), 'Firefox' === DetectRTC.browser.name && (_0x449aca.session.video || _0x449aca.session.screen) && (_0x21b268 = !0x1); - var _0x521a09 = document.createElement(_0x21b268 ? 'audio' : 'video'); - _0x521a09.srcObject = _0x385896; - try { - _0x521a09.setAttributeNode(document.createAttribute('autoplay')), _0x521a09.setAttributeNode(document.createAttribute('playsinline')), _0x521a09.setAttributeNode(document.createAttribute('controls')); - } catch (_0x1440db) { - _0x521a09.setAttribute('autoplay', true), _0x521a09.setAttribute('playsinline', true), _0x521a09.setAttribute('controls', true); - } - if ('Firefox' === DetectRTC.browser.name) { - var _0x5e279f = 'ended'; - 'oninactive' in _0x521a09 && (_0x5e279f = 'inactive'), _0x521a09.addEventListener(_0x5e279f, function() { - if (currentUserMediaRequest.remove(_0x385896.idInstance), 'local' === _0x385896.type) { - _0x5e279f = 'ended', 'oninactive' in _0x385896 && (_0x5e279f = 'inactive'), _0x25e82e.onSyncNeeded(_0x385896.streamid, _0x5e279f), _0x449aca.attachStreams.forEach(function(_0x30209b, _0x17c711) { - _0x385896.streamid === _0x30209b.streamid && delete _0x449aca.attachStreams[_0x17c711]; - }); - var _0x40a9c8 = []; - _0x449aca.attachStreams.forEach(function(_0x2dbc3e) { - _0x2dbc3e && _0x40a9c8.push(_0x2dbc3e); - }), _0x449aca.attachStreams = _0x40a9c8; - var _0x21b268 = _0x449aca.streamEvents[_0x385896.streamid]; - if (_0x21b268) return void _0x449aca.onstreamended(_0x21b268); - this.parentNode && this.parentNode.removeChild(this); - } - }, !0x1); - } - var _0x2b737d = _0x521a09.play(); - if (void 0x0 !== _0x2b737d) { - var _0x1e20a0 = !0x1; - setTimeout(function() { - _0x1e20a0 || (_0x1e20a0 = true, _0x40a9c8(_0x521a09)); - }, 0x3e8), _0x2b737d.then(function() { - _0x1e20a0 || (_0x1e20a0 = true, _0x40a9c8(_0x521a09)); - }).catch(function(_0x336a06) { - _0x1e20a0 || (_0x1e20a0 = true, _0x40a9c8(_0x521a09)); - }); - } else _0x40a9c8(_0x521a09); - } else _0x40a9c8({}); - } - - function _0x1cbceb(_0x84132f, _0xd43fb8) { - window.removeEventListener(_0x84132f, _0xd43fb8), window.addEventListener(_0x84132f, _0xd43fb8, !0x1); - } - - function _0xf3acd(_0x3d2706) { - var _0x326931 = []; - return _0x3d2706.forEach(function(_0x1e0ee0) { - _0x1e0ee0 && _0x326931.push(_0x1e0ee0); - }), _0x326931; - } - - function _0x5deab2(_0x58c43e) { - return !_0x58c43e.audio && !_0x58c43e.video && !_0x58c43e.screen && _0x58c43e.data; - } - - function _0x3b94ab(_0x3fc589) { - return void 0x0 === _0x3fc589; - }(_0x3a9045 = void 0x0 !== _0x21b268 ? _0x21b268 : null) && 'undefined' == typeof window && void 0x0 !== _0x21b268 && (_0x21b268.navigator = { - 'userAgent': 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45', - 'getUserMedia': function() {} - }, _0x21b268.console || (_0x21b268.console = {}), void 0x0 === _0x21b268.console.debug && (_0x21b268.console.debug = _0x21b268.console.info = _0x21b268.console.error = _0x21b268.console.log = _0x21b268.console.log || function() { - console.log(arguments); - }), 'undefined' == typeof document && (_0x3a9045.document = {}, document.createElement = document.captureStream = document.mozCaptureStream = function() { - var _0x1056a5 = { - 'getContext': function() { - return _0x1056a5; - }, - 'play': function() {}, - 'pause': function() {}, - 'drawImage': function() {}, - 'toDataURL': function() { - return ''; - } - }; - return _0x1056a5; - }, document.addEventListener = document.removeEventListener = _0x3a9045.addEventListener = _0x3a9045.removeEventListener = function() {}, _0x3a9045.HTMLVideoElement = _0x3a9045.HTMLMediaElement = function() {}), void 0x0 === 'undefined' == typeof location && (_0x3a9045.location = { - 'protocol': 'file:', - 'href': '', - 'hash': '', - 'origin': 'self' - }), 'undefined' == typeof screen && (_0x3a9045.screen = { - 'width': 0x0, - 'height': 0x0 - }), 'undefined' == typeof URL && (_0x3a9045.URL = { - 'createObjectURL': function() { - return ''; - }, - 'revokeObjectURL': function() { - return ''; - } - }), _0x3a9045.window = _0x21b268), - function() { - var _0x1056a5 = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45'; - if (_0x3f6d71 = 'object' === (void 0x0 === _0x521a09 ? 'undefined' : _0x4ffbab(_0x521a09)) && 'object' === _0x4ffbab(_0x521a09.versions) && _0x521a09.versions.node && !_0x521a09.browser) { - var _0x326931 = _0x521a09.versions.node.toString().replace('v', ''); - _0x1056a5 = 'Nodejs/' + _0x326931 + ' (NodeOS) AppleWebKit/' + _0x326931 + ' (KHTML, like Gecko) Nodejs/' + _0x326931 + ' Nodejs/' + _0x326931; - }! function(_0x3f410a) { - 'undefined' == typeof window && ('undefined' == typeof window && void 0x0 !== _0x21b268 && (_0x21b268.navigator = { - 'userAgent': _0x1056a5, - 'getUserMedia': function() {} - }, _0x3f410a.window = _0x21b268), 'undefined' == typeof location && (_0x3f410a.location = { - 'protocol': 'file:', - 'href': '', - 'hash': '' - }), 'undefined' == typeof screen && (_0x3f410a.screen = { - 'width': 0x0, - 'height': 0x0 - })); - }(void 0x0 !== _0x21b268 ? _0x21b268 : window); - var _0xd38ed = window.navigator; - void 0x0 !== _0xd38ed ? (void 0x0 !== _0xd38ed.webkitGetUserMedia && (_0xd38ed.getUserMedia = _0xd38ed.webkitGetUserMedia), void 0x0 !== _0xd38ed.mozGetUserMedia && (_0xd38ed.getUserMedia = _0xd38ed.mozGetUserMedia)) : _0xd38ed = { - 'getUserMedia': function() {}, - 'userAgent': _0x1056a5 - }; - var _0x4aed46 = !!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i .test(_0xd38ed.userAgent || ''), - _0x4ba312 = !(-0x1 === _0xd38ed.userAgent.indexOf('Edge') || !_0xd38ed.msSaveOrOpenBlob && !_0xd38ed.msSaveBlob), - _0xa57f33 = !!window.opera || _0xd38ed.userAgent.indexOf(' OPR/') >= 0x0, - _0x111853 = void 0x0 !== window.InstallTrigger, - _0x2920ae = /^((?!chrome|android).)*safari/i .test(_0xd38ed.userAgent), - _0x5e24f4 = !!window.chrome && !_0xa57f33, - _0x566860 = 'undefined' != typeof document && !!document.documentMode && !_0x4ba312; - - function _0x8a78df(_0x409296, _0x319fb9) { - var _0x2fa590 = 0x0, - _0x21b268 = !0x1, - _0x521a09 = window.setInterval(function() { - _0x409296() && (window.clearInterval(_0x521a09), _0x319fb9(_0x21b268)), _0x2fa590++ > 0x32 && (window.clearInterval(_0x521a09), _0x319fb9(_0x21b268 = true)); - }, 0xa); - } - var _0x25725b = { - 'Android': function() { - return _0xd38ed.userAgent.match(/Android/i); - }, - 'BlackBerry': function() { - return _0xd38ed.userAgent.match(/BlackBerry|BB10/i); - }, - 'iOS': function() { - return _0xd38ed.userAgent.match(/iPhone|iPad|iPod/i); - }, - 'Opera': function() { - return _0xd38ed.userAgent.match(/Opera Mini/i); - }, - 'Windows': function() { - return _0xd38ed.userAgent.match(/IEMobile/i); - }, - 'any': function() { - return _0x25725b.Android() || _0x25725b.BlackBerry() || _0x25725b.iOS() || _0x25725b.Opera() || _0x25725b.Windows(); - }, - 'getOsName': function() { - var _0x1056a5 = 'Unknown OS'; - return _0x25725b.Android() && (_0x1056a5 = 'Android'), _0x25725b.BlackBerry() && (_0x1056a5 = 'BlackBerry'), _0x25725b.iOS() && (_0x1056a5 = 'iOS'), _0x25725b.Opera() && (_0x1056a5 = 'Opera Mini'), _0x25725b.Windows() && (_0x1056a5 = 'Windows'), _0x1056a5; - } - }; - var _0xfabbbb = 'Unknown OS', - _0x533b2e = 'Unknown OS Version'; - var _0x373254, _0x3c966e, _0x47d25f = function() { - for (var _0x1056a5, _0x326931 = _0xd38ed.appVersion, _0x2fa590 = _0xd38ed.userAgent, _0x21b268 = '-', _0x521a09 = [{ - 's': 'Windows 10', - 'r': /(Windows 10.0|Windows NT 10.0)/ - }, { - 's': 'Windows 8.1', - 'r': /(Windows 8.1|Windows NT 6.3)/ - }, { - 's': 'Windows 8', - 'r': /(Windows 8|Windows NT 6.2)/ - }, { - 's': 'Windows 7', - 'r': /(Windows 7|Windows NT 6.1)/ - }, { - 's': 'Windows Vista', - 'r': /Windows NT 6.0/ - }, { - 's': 'Windows Server 2003', - 'r': /Windows NT 5.2/ - }, { - 's': 'Windows XP', - 'r': /(Windows NT 5.1|Windows XP)/ - }, { - 's': 'Windows 2000', - 'r': /(Windows NT 5.0|Windows 2000)/ - }, { - 's': 'Windows ME', - 'r': /(Win 9x 4.90|Windows ME)/ - }, { - 's': 'Windows 98', - 'r': /(Windows 98|Win98)/ - }, { - 's': 'Windows 95', - 'r': /(Windows 95|Win95|Windows_95)/ - }, { - 's': 'Windows NT 4.0', - 'r': /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/ - }, { - 's': 'Windows CE', - 'r': /Windows CE/ - }, { - 's': 'Windows 3.11', - 'r': /Win16/ - }, { - 's': 'Android', - 'r': /Android/ - }, { - 's': 'Open BSD', - 'r': /OpenBSD/ - }, { - 's': 'Sun OS', - 'r': /SunOS/ - }, { - 's': 'Linux', - 'r': /(Linux|X11)/ - }, { - 's': 'iOS', - 'r': /(iPhone|iPad|iPod)/ - }, { - 's': 'Mac OS X', - 'r': /Mac OS X/ - }, { - 's': 'Mac OS', - 'r': /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ - }, { - 's': 'QNX', - 'r': /QNX/ - }, { - 's': 'UNIX', - 'r': /UNIX/ - }, { - 's': 'BeOS', - 'r': /BeOS/ - }, { - 's': 'OS/2', - 'r': /OS\/2/ - }, { - 's': 'Search Bot', - 'r': /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/ - }], _0x443861 = 0x0; _0x1056a5 = _0x521a09[_0x443861]; _0x443861++) - if (_0x1056a5.r.test(_0x2fa590)) { - _0x21b268 = _0x1056a5.s; - break; - } - var _0x434d96 = '-'; - switch (/Windows/ .test(_0x21b268) && (/Windows (.*)/ .test(_0x21b268) && (_0x434d96 = /Windows (.*)/ .exec(_0x21b268)[0x1]), _0x21b268 = 'Windows'), _0x21b268) { - case 'Mac OS X': - /Mac OS X (10[\.\_\d]+)/ .test(_0x2fa590) && (_0x434d96 = /Mac OS X (10[\.\_\d]+)/ .exec(_0x2fa590)[0x1]); - break; - case 'Android': - /Android ([\.\_\d]+)/ .test(_0x2fa590) && (_0x434d96 = /Android ([\.\_\d]+)/ .exec(_0x2fa590)[0x1]); - break; - case 'iOS': - /OS (\d+)_(\d+)_?(\d+)?/ .test(_0x2fa590) && (_0x434d96 = (_0x434d96 = /OS (\d+)_(\d+)_?(\d+)?/ .exec(_0x326931))[0x1] + '.' + _0x434d96[0x2] + '.' + (0x0 | _0x434d96[0x3])); - } - return { - 'osName': _0x21b268, - 'osVersion': _0x434d96 - }; - }(); - _0x47d25f && _0x47d25f.osName && '-' != _0x47d25f.osName ? (_0xfabbbb = _0x47d25f.osName, _0x533b2e = _0x47d25f.osVersion) : _0x25725b.any() && 'Android' == (_0xfabbbb = _0x25725b.getOsName()) && (_0x533b2e = !!(_0x3c966e = (_0x373254 = (_0x373254 || _0xd38ed.userAgent).toLowerCase()).match(/android\s([0-9\.]*)/)) && _0x3c966e[0x1]); - var _0x3f6d71 = 'object' === (void 0x0 === _0x521a09 ? 'undefined' : _0x4ffbab(_0x521a09)) && 'object' === _0x4ffbab(_0x521a09.versions) && _0x521a09.versions.node; - 'Unknown OS' === _0xfabbbb && _0x3f6d71 && (_0xfabbbb = 'Nodejs', _0x533b2e = _0x521a09.versions.node.toString().replace('v', '')); - var _0x233149 = !0x1, - _0x467217 = !0x1; - ['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function(_0x2dba73) { - 'undefined' != typeof document && 'function' == typeof document.createElement && (!_0x233149 && _0x2dba73 in document.createElement('canvas') && (_0x233149 = true), !_0x467217 && _0x2dba73 in document.createElement('video') && (_0x467217 = true)); - }); - var _0x327730 = /^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/, - _0x39bfae = /([0-9]{1,3}(\.[0-9]{1,3}){3})/, - _0xe1f7d = /[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}/; - var _0x37c2dd = [], - _0x47e1c4 = [], - _0x1e709a = [], - _0x536d10 = []; - _0xd38ed.mediaDevices && _0xd38ed.mediaDevices.enumerateDevices && (_0xd38ed.enumerateDevices = function(_0x101328) { - var _0x326931 = _0xd38ed.mediaDevices.enumerateDevices(); - _0x326931 && _0x326931.then ? _0xd38ed.mediaDevices.enumerateDevices().then(_0x101328).catch(function() { - _0x101328([]); - }) : _0x101328([]); - }); - var _0x1ec78f = !0x1; - void 0x0 !== _0x1d01b4 && 'getSources' in _0x1d01b4 ? _0x1ec78f = true : _0xd38ed.mediaDevices && _0xd38ed.mediaDevices.enumerateDevices && (_0x1ec78f = true); - var _0x1e6405 = !0x1, - _0x20f7ce = !0x1, - _0x528a8d = !0x1, - _0x242003 = !0x1, - _0x1583d5 = !0x1; - - function _0x5a290a(_0x5b8353) { - if (_0x1ec78f) - if (!_0xd38ed.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources && (_0xd38ed.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack)), !_0xd38ed.enumerateDevices && _0xd38ed.enumerateDevices && (_0xd38ed.enumerateDevices = _0xd38ed.enumerateDevices.bind(_0xd38ed)), _0xd38ed.enumerateDevices) { - _0x37c2dd = [], _0x47e1c4 = [], _0x1e709a = [], _0x536d10 = [], _0x1e6405 = !0x1, _0x20f7ce = !0x1, _0x528a8d = !0x1, _0x242003 = !0x1, _0x1583d5 = !0x1; - var _0x326931 = {}; - _0xd38ed.enumerateDevices(function(_0x11a0f9) { - _0x11a0f9.forEach(function(_0x210fa4) { - var _0x11a0f9 = {}; - for (var _0x21b268 in _0x210fa4) try { - 'function' != typeof _0x210fa4[_0x21b268] && (_0x11a0f9[_0x21b268] = _0x210fa4[_0x21b268]); - } catch (_0x1914ff) {} - _0x326931[_0x11a0f9.deviceId + _0x11a0f9.label + _0x11a0f9.kind] || ('audio' === _0x11a0f9.kind && (_0x11a0f9.kind = 'audioinput'), 'video' === _0x11a0f9.kind && (_0x11a0f9.kind = 'videoinput'), _0x11a0f9.deviceId || (_0x11a0f9.deviceId = _0x11a0f9.id), _0x11a0f9.id || (_0x11a0f9.id = _0x11a0f9.deviceId), _0x11a0f9.label ? ('videoinput' !== _0x11a0f9.kind || _0x1583d5 || (_0x1583d5 = true), 'audioinput' !== _0x11a0f9.kind || _0x242003 || (_0x242003 = true)) : (_0x11a0f9.isCustomLabel = true, 'videoinput' === _0x11a0f9.kind ? _0x11a0f9.label = 'Camera ' + (_0x536d10.length + 0x1) : 'audioinput' === _0x11a0f9.kind ? _0x11a0f9.label = 'Microphone ' + (_0x47e1c4.length + 0x1) : 'audiooutput' === _0x11a0f9.kind ? _0x11a0f9.label = 'Speaker ' + (_0x1e709a.length + 0x1) : _0x11a0f9.label = 'Please invoke getUserMedia once.', void 0x0 !== _0x444319 && _0x444319.browser.isChrome && _0x444319.browser.version >= 0x2e && !/^(https:|chrome-extension:)$/g .test(location.protocol || '') && 'undefined' != typeof document && 'string' == typeof document.domain && document.domain.search && -0x1 === document.domain.search(/localhost|127.0./g) && (_0x11a0f9.label = 'HTTPs is required to get label of this ' + _0x11a0f9.kind + ' device.')), 'audioinput' === _0x11a0f9.kind && (_0x1e6405 = true, -0x1 === _0x47e1c4.indexOf(_0x11a0f9) && _0x47e1c4.push(_0x11a0f9)), 'audiooutput' === _0x11a0f9.kind && (_0x20f7ce = true, -0x1 === _0x1e709a.indexOf(_0x11a0f9) && _0x1e709a.push(_0x11a0f9)), 'videoinput' === _0x11a0f9.kind && (_0x528a8d = true, -0x1 === _0x536d10.indexOf(_0x11a0f9) && _0x536d10.push(_0x11a0f9)), _0x37c2dd.push(_0x11a0f9), _0x326931[_0x11a0f9.deviceId + _0x11a0f9.label + _0x11a0f9.kind] = _0x11a0f9); - }), void 0x0 !== _0x444319 && (_0x444319.MediaDevices = _0x37c2dd, _0x444319.hasMicrophone = _0x1e6405, _0x444319.hasSpeakers = _0x20f7ce, _0x444319.hasWebcam = _0x528a8d, _0x444319.isWebsiteHasWebcamPermissions = _0x1583d5, _0x444319.isWebsiteHasMicrophonePermissions = _0x242003, _0x444319.audioInputDevices = _0x47e1c4, _0x444319.audioOutputDevices = _0x1e709a, _0x444319.videoInputDevices = _0x536d10), _0x5b8353 && _0x5b8353(); - }); - } else _0x5b8353 && _0x5b8353(); - else _0x5b8353 && _0x5b8353(); - } - var _0x444319 = window.DetectRTC || {}; - _0x444319.browser = function() { - _0xd38ed.appVersion; - var _0x1056a5, _0x326931, _0x2fa590, _0x21b268 = _0xd38ed.userAgent, - _0x521a09 = _0xd38ed.appName, - _0x441e45 = '' + parseFloat(_0xd38ed.appVersion), - _0x174a5c = parseInt(_0xd38ed.appVersion, 0xa); - if (_0x2920ae && !_0x5e24f4 && -0x1 !== _0x21b268.indexOf('CriOS') && (_0x2920ae = !0x1, _0x5e24f4 = true), _0xa57f33) { - _0x521a09 = 'Opera'; - try { - _0x174a5c = (_0x441e45 = _0xd38ed.userAgent.split('OPR/')[0x1].split(' ')[0x0]).split('.')[0x0]; - } catch (_0xbb1615) { - _0x441e45 = '0.0.0.0', _0x174a5c = 0x0; - } - } else _0x566860 ? ((_0x326931 = _0x21b268.indexOf('rv:')) > 0x0 ? _0x441e45 = _0x21b268.substring(_0x326931 + 0x3) : (_0x326931 = _0x21b268.indexOf('MSIE'), _0x441e45 = _0x21b268.substring(_0x326931 + 0x5)), _0x521a09 = 'IE') : _0x5e24f4 ? (_0x326931 = _0x21b268.indexOf('Chrome'), _0x521a09 = 'Chrome', _0x441e45 = _0x21b268.substring(_0x326931 + 0x7)) : _0x2920ae ? (_0x326931 = _0x21b268.indexOf('Safari'), _0x521a09 = 'Safari', _0x441e45 = _0x21b268.substring(_0x326931 + 0x7), -0x1 !== (_0x326931 = _0x21b268.indexOf('Version')) && (_0x441e45 = _0x21b268.substring(_0x326931 + 0x8)), -0x1 !== _0xd38ed.userAgent.indexOf('Version/') && (_0x441e45 = _0xd38ed.userAgent.split('Version/')[0x1].split(' ')[0x0])) : _0x111853 ? (_0x326931 = _0x21b268.indexOf('Firefox'), _0x521a09 = 'Firefox', _0x441e45 = _0x21b268.substring(_0x326931 + 0x8)) : (_0x1056a5 = _0x21b268.lastIndexOf(' ') + 0x1) < (_0x326931 = _0x21b268.lastIndexOf('/')) && (_0x521a09 = _0x21b268.substring(_0x1056a5, _0x326931), _0x441e45 = _0x21b268.substring(_0x326931 + 0x1), _0x521a09.toLowerCase() === _0x521a09.toUpperCase() && (_0x521a09 = _0xd38ed.appName)); - return _0x4ba312 && (_0x521a09 = 'Edge', _0x441e45 = _0xd38ed.userAgent.split('Edge/')[0x1]), -0x1 !== (_0x2fa590 = _0x441e45.search(/[; \)]/)) && (_0x441e45 = _0x441e45.substring(0x0, _0x2fa590)), _0x174a5c = parseInt('' + _0x441e45, 0xa), isNaN(_0x174a5c) && (_0x441e45 = '' + parseFloat(_0xd38ed.appVersion), _0x174a5c = parseInt(_0xd38ed.appVersion, 0xa)), { - 'fullVersion': _0x441e45, - 'version': _0x174a5c, - 'name': _0x521a09, - 'isPrivateBrowsing': !0x1 - }; - }(), - function(_0xbf5986) { - var _0x326931; - try { - if (window.webkitRequestFileSystem) window.webkitRequestFileSystem(window.TEMPORARY, 0x1, function() { - _0x326931 = !0x1; - }, function(_0x57feb9) { - _0x326931 = true; - }); - else if (window.indexedDB && /Firefox/ .test(window.navigator.userAgent)) { - var _0x2fa590; - try { - (_0x2fa590 = window.indexedDB.open('test')).onerror = function() { - return true; - }; - } catch (_0xe0bac4) { - _0x326931 = true; - } - void 0x0 === _0x326931 && _0x8a78df(function() { - return 'done' === _0x2fa590.readyState; - }, function(_0x236923) { - _0x236923 || (_0x326931 = !_0x2fa590.result); - }); - } else if (function(_0x8e13f) { - var _0x326931 = _0x8e13f.toLowerCase(); - if (0x0 === _0x326931.indexOf('msie') && 0x0 === _0x326931.indexOf('trident')) return !0x1; - var _0x2fa590 = /(?:msie|rv:)\s?([\d\.]+)/ .exec(_0x326931); - return !!(_0x2fa590 && parseInt(_0x2fa590[0x1], 0xa) >= 0xa); - }(window.navigator.userAgent)) { - _0x326931 = !0x1; - try { - window.indexedDB || (_0x326931 = true); - } catch (_0x4d0f1c) { - _0x326931 = true; - } - } else if (window.localStorage && /Safari/ .test(window.navigator.userAgent)) { - try { - window.localStorage.setItem('test', 0x1); - } catch (_0x217100) { - _0x326931 = true; - } - void 0x0 === _0x326931 && (_0x326931 = !0x1, window.localStorage.removeItem('test')); - } - } catch (_0x54458d) { - _0x326931 = !0x1; - } - _0x8a78df(function() { - return void 0x0 !== _0x326931; - }, function(_0x139aa5) { - _0xbf5986(_0x326931); - }); - }(function(_0x82ccf2) { - _0x444319.browser.isPrivateBrowsing = !!_0x82ccf2; - }), _0x444319.browser['is' + _0x444319.browser.name] = true, _0x444319.osName = _0xfabbbb, _0x444319.osVersion = _0x533b2e; - 'object' === (void 0x0 === _0x521a09 ? 'undefined' : _0x4ffbab(_0x521a09)) && 'object' === _0x4ffbab(_0x521a09.versions) && _0x521a09.versions['node-webkit']; - var _0xb774b1 = !0x1; - ['RTCPeerConnection', 'webkitRTCPeerConnection', 'mozRTCPeerConnection', 'RTCIceGatherer'].forEach(function(_0x1a220e) { - _0xb774b1 || _0x1a220e in window && (_0xb774b1 = true); - }), _0x444319.isWebRTCSupported = _0xb774b1, _0x444319.isORTCSupported = 'undefined' != typeof RTCIceGatherer; - var _0x20eef3 = !0x1; - (_0x444319.browser.isChrome && _0x444319.browser.version >= 0x23 ? _0x20eef3 = true : _0x444319.browser.isFirefox && _0x444319.browser.version >= 0x22 ? _0x20eef3 = true : _0x444319.browser.isEdge && _0x444319.browser.version >= 0x11 ? _0x20eef3 = true : 'Android' === _0x444319.osName && _0x444319.browser.isChrome && (_0x20eef3 = true), /^(https:|chrome-extension:)$/g .test(location.protocol || '')) || ('undefined' != typeof document && 'string' == typeof document.domain && document.domain.search && -0x1 === document.domain.search(/localhost|127.0./g) && (_0x444319.browser.isChrome || _0x444319.browser.isEdge || _0x444319.browser.isOpera) ? _0x20eef3 = !0x1 : _0x444319.browser.isFirefox && (_0x20eef3 = !0x1)); - _0x444319.isScreenCapturingSupported = _0x20eef3; - var _0x41f5bd = { - 'isSupported': !0x1, - 'isCreateMediaStreamSourceSupported': !0x1 - }; - ['AudioContext', 'webkitAudioContext', 'mozAudioContext', 'msAudioContext'].forEach(function(_0x6f8ee8) { - _0x41f5bd.isSupported || _0x6f8ee8 in window && (_0x41f5bd.isSupported = true, window[_0x6f8ee8] && 'createMediaStreamSource' in window[_0x6f8ee8].prototype && (_0x41f5bd.isCreateMediaStreamSourceSupported = true)); - }), _0x444319.isAudioContextSupported = _0x41f5bd.isSupported, _0x444319.isCreateMediaStreamSourceSupported = _0x41f5bd.isCreateMediaStreamSourceSupported; - var _0x3c8f54 = !0x1; - _0x444319.browser.isChrome && _0x444319.browser.version > 0x1f && (_0x3c8f54 = true), _0x444319.isRtpDataChannelsSupported = _0x3c8f54; - var _0x4e0543 = !0x1; - _0x444319.browser.isFirefox && _0x444319.browser.version > 0x1c ? _0x4e0543 = true : _0x444319.browser.isChrome && _0x444319.browser.version > 0x19 ? _0x4e0543 = true : _0x444319.browser.isOpera && _0x444319.browser.version >= 0xb && (_0x4e0543 = true), _0x444319.isSctpDataChannelsSupported = _0x4e0543, _0x444319.isMobileDevice = _0x4aed46; - var _0x27c37d = !0x1; - _0xd38ed.getUserMedia ? _0x27c37d = true : _0xd38ed.mediaDevices && _0xd38ed.mediaDevices.getUserMedia && (_0x27c37d = true), _0x444319.browser.isChrome && _0x444319.browser.version >= 0x2e && !/^(https:|chrome-extension:)$/g .test(location.protocol || '') && 'undefined' != typeof document && 'string' == typeof document.domain && document.domain.search && -0x1 === document.domain.search(/localhost|127.0./g) && (_0x27c37d = 'Requires HTTPs'), 'Nodejs' === _0x444319.osName && (_0x27c37d = !0x1), _0x444319.isGetUserMediaSupported = _0x27c37d; - var _0x5d3017, _0x4c1193, _0x5997d1, _0x4bd937 = ''; - screen.width && (_0x4bd937 += (screen.width ? screen.width : '') + ' x ' + (screen.height ? screen.height : '')); - _0x444319.displayResolution = _0x4bd937, _0x444319.displayAspectRatio = (_0x5d3017 = screen.width, _0x4c1193 = screen.height, _0x5997d1 = function _0x1056a5(_0x9f77a2, _0x157ff4) { - return 0x0 == _0x157ff4 ? _0x9f77a2 : _0x1056a5(_0x157ff4, _0x9f77a2 % _0x157ff4); - }(_0x5d3017, _0x4c1193), _0x5d3017 / _0x5997d1 / (_0x4c1193 / _0x5997d1)).toFixed(0x2), _0x444319.isCanvasSupportsStreamCapturing = _0x233149, _0x444319.isVideoSupportsStreamCapturing = _0x467217, 'Chrome' == _0x444319.browser.name && _0x444319.browser.version >= 0x35 && (_0x444319.isCanvasSupportsStreamCapturing || (_0x444319.isCanvasSupportsStreamCapturing = 'Requires chrome flag: enable-experimental-web-platform-features'), _0x444319.isVideoSupportsStreamCapturing || (_0x444319.isVideoSupportsStreamCapturing = 'Requires chrome flag: enable-experimental-web-platform-features')), _0x444319.DetectLocalIPAddress = function(_0x527d6a, _0x3e6338) { - if (_0x444319.isWebRTCSupported) { - var _0x2fa590 = true, - _0x21b268 = true; - ! function(_0x169ed4, _0x457465) { - if ('undefined' == typeof document || 'function' != typeof document.getElementById) return; - var _0x2fa590 = {}, - _0x21b268 = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; - if (!_0x21b268) { - var _0x521a09 = document.getElementById('iframe'); - if (!_0x521a09) return; - var _0x57dce2 = _0x521a09.contentWindow; - _0x21b268 = _0x57dce2.RTCPeerConnection || _0x57dce2.mozRTCPeerConnection || _0x57dce2.webkitRTCPeerConnection; - } - if (!_0x21b268) return; - var _0x1ebe24 = null; - 'Chrome' === _0x444319.browser && _0x444319.browser.version < 0x3a && (_0x1ebe24 = { - 'optional': [{ - 'RtpDataChannels': true - }] - }); - var _0x355289 = new _0x21b268({ - 'iceServers': [{ - 'urls': 'stun:stun.l.google.com:19302' - }] - }, _0x1ebe24); - _0x457465 && (_0x355289.addStream ? _0x355289.addStream(_0x457465) : _0x355289.addTrack && _0x457465.getTracks()[0x0] && _0x355289.addTrack(_0x457465.getTracks()[0x0], _0x457465)); - - function _0x367cf9(_0x23abd1) { - var _0x21b268 = _0x39bfae.exec(_0x23abd1); - if (_0x21b268) { - var _0x521a09 = _0x21b268[0x1], - _0x2faf0b = _0x23abd1.match(_0x327730); - void 0x0 === _0x2fa590[_0x521a09] && _0x169ed4(_0x521a09, _0x2faf0b, true), _0x2fa590[_0x521a09] = true; - } - } - if (_0x355289.onicecandidate = function(_0xd7031e) { - _0xd7031e.candidate && _0x367cf9(_0xd7031e.candidate.candidate); - }, !_0x457465) try { - _0x355289.createDataChannel('sctp', {}); - } catch (_0x1edf47) {} - _0x444319.isPromisesSupported ? _0x355289.createOffer().then(function(_0xedec09) { - _0x355289.setLocalDescription(_0xedec09).then(_0x45699b); - }) : _0x355289.createOffer(function(_0xf8592b) { - _0x355289.setLocalDescription(_0xf8592b, _0x45699b, function() {}); - }, function() {}); - - function _0x45699b() { - _0x355289.localDescription.sdp.split('\n').forEach(function(_0x4e78ca) { - 0x0 === _0x4e78ca.indexOf('a=candidate:') && _0x367cf9(_0x4e78ca); - }); - } - }(function(_0x2a2630) { - _0x2a2630.match(_0x327730) ? _0x527d6a('Local: ' + _0x2a2630, _0x2fa590 = !0x1, _0x21b268) : _0x2a2630.match(_0xe1f7d) ? _0x527d6a('Public: ' + _0x2a2630, _0x2fa590, _0x21b268 = !0x1) : _0x527d6a('Public: ' + _0x2a2630, _0x2fa590, _0x21b268); - }, _0x3e6338); - } - }, _0x444319.isWebSocketsSupported = 'WebSocket' in window && 0x2 === window.WebSocket.CLOSING, _0x444319.isWebSocketsBlocked = !_0x444319.isWebSocketsSupported, 'Nodejs' === _0x444319.osName && (_0x444319.isWebSocketsSupported = true, _0x444319.isWebSocketsBlocked = !0x1), _0x444319.checkWebSocketsSupport = function(_0x1102a1) { - _0x1102a1 = _0x1102a1 || function() {}; - try { - var _0x326931, _0x2fa590 = new WebSocket('wss://echo.websocket.org:443/'); - _0x2fa590.onopen = function() { - _0x444319.isWebSocketsBlocked = !0x1, _0x326931 = new Date().getTime(), _0x2fa590.send('ping'); - }, _0x2fa590.onmessage = function() { - _0x444319.WebsocketLatency = new Date().getTime() - _0x326931 + 'ms', _0x1102a1(), _0x2fa590.close(), _0x2fa590 = null; - }, _0x2fa590.onerror = function() { - _0x444319.isWebSocketsBlocked = true, _0x1102a1(); - }; - } catch (_0x11ac18) { - _0x444319.isWebSocketsBlocked = true, _0x1102a1(); - } - }, _0x444319.load = function(_0x83e5e9) { - _0x5a290a(_0x83e5e9 = _0x83e5e9 || function() {}); - }, _0x444319.MediaDevices = void 0x0 !== _0x37c2dd ? _0x37c2dd : [], _0x444319.hasMicrophone = _0x1e6405, _0x444319.hasSpeakers = _0x20f7ce, _0x444319.hasWebcam = _0x528a8d, _0x444319.isWebsiteHasWebcamPermissions = _0x1583d5, _0x444319.isWebsiteHasMicrophonePermissions = _0x242003, _0x444319.audioInputDevices = _0x47e1c4, _0x444319.audioOutputDevices = _0x1e709a, _0x444319.videoInputDevices = _0x536d10; - var _0x5da020 = !0x1; - 'undefined' != typeof document && 'function' == typeof document.createElement && 'setSinkId' in document.createElement('video') && (_0x5da020 = true), _0x444319.isSetSinkIdSupported = _0x5da020; - var _0x1b0b81 = !0x1; - _0x444319.browser.isFirefox && 'undefined' != typeof mozRTCPeerConnection ? 'getSenders' in mozRTCPeerConnection.prototype && (_0x1b0b81 = true) : _0x444319.browser.isChrome && 'undefined' != typeof webkitRTCPeerConnection && 'getSenders' in webkitRTCPeerConnection.prototype && (_0x1b0b81 = true), _0x444319.isRTPSenderReplaceTracksSupported = _0x1b0b81; - var _0x83ded = !0x1; - _0x444319.browser.isFirefox && _0x444319.browser.version > 0x26 && (_0x83ded = true), _0x444319.isRemoteStreamProcessingSupported = _0x83ded; - var _0x51520c = !0x1; - void 0x0 !== _0x1d01b4 && 'applyConstraints' in _0x1d01b4.prototype && (_0x51520c = true), _0x444319.isApplyConstraintsSupported = _0x51520c; - var _0x298a09 = !0x1; - _0x444319.browser.isFirefox && _0x444319.browser.version >= 0x2b && (_0x298a09 = true), _0x444319.isMultiMonitorScreenCapturingSupported = _0x298a09, _0x444319.isPromisesSupported = !!('Promise' in window), _0x444319.version = '1.3.7', void 0x0 === _0x444319 && (window.DetectRTC = {}); - var _0x187d8a = window.MediaStream; - void 0x0 === _0x187d8a && 'undefined' != typeof webkitMediaStream && (_0x187d8a = webkitMediaStream), _0x444319.MediaStream = void 0x0 !== _0x187d8a && 'function' == typeof _0x187d8a && Object.keys(_0x187d8a.prototype), _0x444319.MediaStreamTrack = void 0x0 !== _0x1d01b4 && Object.keys(_0x1d01b4.prototype); - var _0x5898a3 = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; - _0x444319.RTCPeerConnection = void 0x0 !== _0x5898a3 && Object.keys(_0x5898a3.prototype), window.DetectRTC = _0x444319, 'function' == typeof define && _0x2fa590(0x90) && define('DetectRTC', [], function() { - return _0x444319; - }); - }(), 'undefined' != typeof cordova && (DetectRTC.isMobileDevice = true, DetectRTC.browser.name = 'Chrome'), navigator && navigator.userAgent && -0x1 !== navigator.userAgent.indexOf('Crosswalk') && (DetectRTC.isMobileDevice = true, DetectRTC.browser.name = 'Chrome'), window.addEventListener || (window.addEventListener = function(_0x1e341e, _0x410d8a, _0x164ba3) { - _0x1e341e.attachEvent && _0x1e341e.attachEvent('on' + _0x410d8a, _0x164ba3); - }), window.attachEventListener = function(_0x28f783, _0xf32336, _0x5ddd69, _0x1e62b3) { - _0x28f783.addEventListener(_0xf32336, _0x5ddd69, _0x1e62b3); - }; - var _0x1d809b = window.MediaStream; - - function _0x93df62(_0x128905, _0x2d6fa0) { - return (!_0x128905.session.audio || 'two-way' !== _0x128905.session.audio) && ('Firefox' === DetectRTC.browser.name && !0x1 !== _0x2d6fa0 || !('Chrome' !== DetectRTC.browser.name || DetectRTC.browser.version < 0x32) && (true === typeof _0x2d6fa0 || !(void 0x0 !== _0x2d6fa0 || !_0x128905.session.audio || !_0x128905.session.screen || _0x128905.session.video) && (_0x2d6fa0 = true, true))); - } - - function _0x405170(_0x53fd0a) { - return 'Firefox' === DetectRTC.browser.name || 'Chrome' === DetectRTC.browser.name && { - 'mandatory': { - 'chromeMediaSource': _0x53fd0a.mandatory.chromeMediaSource, - 'chromeMediaSourceId': _0x53fd0a.mandatory.chromeMediaSourceId - } - }; - } - - function _0x2cbba5(_0x5f06c5, _0x3f8518) { - return _0x5f06c5 && _0x5f06c5.getTracks ? _0x5f06c5.getTracks().filter(function(_0x12aae8) { - return _0x12aae8.kind === (_0x3f8518 || 'audio'); - }) : []; - } - - function _0x5407aa() { - var _0x1056a5 = !0x1; - try { - if ('undefined' == typeof RTCRtpTransceiver) return !0x1; - if (!('currentDirection' in RTCRtpTransceiver.prototype)) return !0x1; - var _0x326931 = new _0x2a4be1(); - try { - _0x326931.addTransceiver('audio'), _0x1056a5 = true; - } catch (_0x365290) {} - _0x326931.close(); - } catch (_0x4e12a1) { - _0x1056a5 = !0x1; - } - return _0x1056a5 && function() { - var _0x1056a5 = !0x1; - try { - var _0x326931 = new _0x2a4be1({ - 'sdpSemantics': 'unified-plan' - }); - try { - var _0x2fa590 = _0x326931.getConfiguration(); - _0x1056a5 = 'unified-plan' == _0x2fa590.sdpSemantics || (_0x2fa590.sdpSemantics, !0x1); - } catch (_0x1ddaa9) { - _0x1056a5 = !0x1; - } - } catch (_0x30213a) { - _0x1056a5 = !0x1; - } - return _0x1056a5; - }(); - } - - function _0x2eda5b() { - if ('undefined' != typeof cordova && void 0x0 !== cordova.plugins && void 0x0 !== cordova.plugins.iosrtc) { - var _0x1056a5 = cordova.plugins.iosrtc; - window.webkitRTCPeerConnection = _0x1056a5.RTCPeerConnection, window.RTCSessionDescription = _0x1056a5.RTCSessionDescription, window.RTCIceCandidate = _0x1056a5.RTCIceCandidate, window.MediaStream = _0x1056a5.MediaStream, window.MediaStreamTrack = _0x1056a5.MediaStreamTrack, navigator.getUserMedia = navigator.webkitGetUserMedia = _0x1056a5.getUserMedia, _0x1056a5.debug.enable('iosrtc*'), 'function' == typeof _0x1056a5.selectAudioOutput && _0x1056a5.selectAudioOutput(window.iOSDefaultAudioOutputDevice || 'speaker'), _0x1056a5.registerGlobals(); - } - } - void 0x0 === _0x1d809b && 'undefined' != typeof webkitMediaStream && (_0x1d809b = webkitMediaStream), void 0x0 !== _0x1d809b && ('stop' in _0x1d809b.prototype || (_0x1d809b.prototype.stop = function() { - this.getTracks().forEach(function(_0x484c2d) { - _0x484c2d.stop(); - }); - })), window.iOSDefaultAudioOutputDevice = window.iOSDefaultAudioOutputDevice || 'speaker', document.addEventListener('deviceready', _0x2eda5b, !0x1), _0x2eda5b(); - var _0x2a4be1, _0x394dad = {}; - - function _0xe7bfb2(_0x5b2014) { - return { - 'OfferToReceiveAudio': !!_0x5b2014.OfferToReceiveAudio, - 'OfferToReceiveVideo': !!_0x5b2014.OfferToReceiveVideo - }; - } - void 0x0 !== window.RTCPeerConnection ? _0x2a4be1 = window.RTCPeerConnection : 'undefined' != typeof mozRTCPeerConnection ? _0x2a4be1 = mozRTCPeerConnection : 'undefined' != typeof webkitRTCPeerConnection && (_0x2a4be1 = webkitRTCPeerConnection); - var _0x28d3c1 = window.RTCSessionDescription || window.mozRTCSessionDescription, - _0x437c06 = window.RTCIceCandidate || window.mozRTCIceCandidate, - _0x1d01b4 = window.MediaStreamTrack; - - function _0x4c6fdb(_0xeb3993) { - //main webrtc function - return; - - if (void 0x0 !== window.RTCPeerConnection ? _0x2a4be1 = window.RTCPeerConnection : 'undefined' != typeof mozRTCPeerConnection ? _0x2a4be1 = mozRTCPeerConnection : 'undefined' != typeof webkitRTCPeerConnection && (_0x2a4be1 = webkitRTCPeerConnection), _0x28d3c1 = window.RTCSessionDescription || window.mozRTCSessionDescription, _0x437c06 = window.RTCIceCandidate || window.mozRTCIceCandidate, _0x1d01b4 = window.MediaStreamTrack, !_0x2a4be1) throw 'WebRTC 1.0 (RTCPeerConnection) API are NOT available in this browser.'; - var _0x326931 = _0xeb3993.rtcMultiConnection; - this.extra = _0xeb3993.remoteSdp ? _0xeb3993.remoteSdp.extra : _0x326931.extra, this.userid = _0xeb3993.userid, this.streams = [], this.channels = _0xeb3993.channels || [], this.connectionDescription = _0xeb3993.connectionDescription, this.addStream = function(_0x500ec1) { - _0x326931.addStream(_0x500ec1, _0x2fa590.userid); - }, this.removeStream = function(_0x1bebfb) { - _0x326931.removeStream(_0x1bebfb, _0x2fa590.userid); - }; - var _0x2fa590 = this; - _0xeb3993.remoteSdp && (this.connectionDescription = _0xeb3993.remoteSdp.connectionDescription); - var _0x21b268, _0x521a09 = {}; - _0x394dad.sdpConstraints = _0xe7bfb2({ - 'OfferToReceiveAudio': true, - 'OfferToReceiveVideo': true - }); - var _0x53652f = !!_0xeb3993.renegotiatingPeer; - _0xeb3993.remoteSdp && (_0x53652f = !!_0xeb3993.remoteSdp.renegotiatingPeer); - var _0x5aa3f5 = []; - if (_0x326931.attachStreams.forEach(function(_0x37ab43) { - _0x37ab43 && _0x5aa3f5.push(_0x37ab43); - }), _0x53652f) _0x21b268 = _0xeb3993.peerRef; - else { - var _0x3802e4 = 'all'; - (_0x326931.candidates.turn || _0x326931.candidates.relay) && (_0x326931.candidates.stun || _0x326931.candidates.reflexive || _0x326931.candidates.host || (_0x3802e4 = 'relay')); - try { - var _0xa206a4 = { - 'iceServers': _0x326931.iceServers, - 'iceTransportPolicy': _0x326931.iceTransportPolicy || _0x3802e4 - }; - void 0x0 !== _0x326931.iceCandidatePoolSize && (_0xa206a4.iceCandidatePoolSize = _0x326931.iceCandidatePoolSize), void 0x0 !== _0x326931.bundlePolicy && (_0xa206a4.bundlePolicy = _0x326931.bundlePolicy), void 0x0 !== _0x326931.rtcpMuxPolicy && (_0xa206a4.rtcpMuxPolicy = _0x326931.rtcpMuxPolicy), 'Chrome' === DetectRTC.browser.name && (_0xa206a4.sdpSemantics = _0x326931.sdpSemantics || 'unified-plan'), _0x326931.iceServers && _0x326931.iceServers.length || (_0xa206a4 = null, _0x326931.optionalArgument = null), _0x21b268 = new _0x2a4be1(_0xa206a4, _0x326931.optionalArgument); - } catch (_0x2cdc2c) { - try { - _0xa206a4 = { - 'iceServers': _0x326931.iceServers - }; - _0x21b268 = new _0x2a4be1(_0xa206a4); - } catch (_0x1cd6f4) { - _0x21b268 = new _0x2a4be1(); - } - } - }!_0x21b268.getRemoteStreams && _0x21b268.getReceivers && (_0x21b268.getRemoteStreams = function() { - var _0xeb3993 = new _0x1d809b(); - return _0x21b268.getReceivers().forEach(function(_0x210865) { - _0xeb3993.addTrack(_0x210865.track); - }), [_0xeb3993]; - }), !_0x21b268.getLocalStreams && _0x21b268.getSenders && (_0x21b268.getLocalStreams = function() { - var _0xeb3993 = new _0x1d809b(); - return _0x21b268.getSenders().forEach(function(_0x4bc1bd) { - _0xeb3993.addTrack(_0x4bc1bd.track); - }), [_0xeb3993]; - }), _0x21b268.onicecandidate = function(_0x345d0e) { - if (_0x345d0e.candidate) _0x326931.trickleIce && _0xeb3993.onLocalCandidate({ - 'candidate': _0x345d0e.candidate.candidate, - 'sdpMid': _0x345d0e.candidate.sdpMid, - 'sdpMLineIndex': _0x345d0e.candidate.sdpMLineIndex - }); - else if (!_0x326931.trickleIce) { - var _0x5cad6b = _0x21b268.localDescription; - _0xeb3993.onLocalSdp({ - 'type': _0x5cad6b.type, - 'sdp': _0x5cad6b.sdp, - 'remotePeerSdpConstraints': _0xeb3993.remotePeerSdpConstraints || !0x1, - 'renegotiatingPeer': !!_0xeb3993.renegotiatingPeer || !0x1, - 'connectionDescription': _0x2fa590.connectionDescription, - 'dontGetRemoteStream': !!_0xeb3993.dontGetRemoteStream, - 'extra': _0x326931 ? _0x326931.extra : {}, - 'streamsToShare': _0x5ed0e1 - }); - } - }, _0x5aa3f5.forEach(function(_0x20e839) { - _0xeb3993.remoteSdp && _0xeb3993.remoteSdp.remotePeerSdpConstraints && _0xeb3993.remoteSdp.remotePeerSdpConstraints.dontGetRemoteStream || _0xeb3993.dontAttachLocalStream || (_0x20e839 = _0x326931.beforeAddingStream(_0x20e839, _0x2fa590)) && (_0x21b268.getLocalStreams().forEach(function(_0x37c67d) { - _0x20e839 && _0x37c67d.id == _0x20e839.id && (_0x20e839 = null); - }), _0x20e839 && _0x20e839.getTracks && _0x20e839.getTracks().forEach(function(_0x891f5b) { - try { - _0x21b268.addTrack(_0x891f5b, _0x20e839); - } catch (_0x13e107) {} - })); - }), _0x21b268.oniceconnectionstatechange = _0x21b268.onsignalingstatechange = function() { - var _0x521a09 = _0x2fa590.extra; - _0x326931.peers[_0x2fa590.userid] && (_0x521a09 = _0x326931.peers[_0x2fa590.userid].extra || _0x521a09), _0x21b268 && (_0xeb3993.onPeerStateChanged({ - 'iceConnectionState': _0x21b268.iceConnectionState, - 'iceGatheringState': _0x21b268.iceGatheringState, - 'signalingState': _0x21b268.signalingState, - 'extra': _0x521a09, - 'userid': _0x2fa590.userid - }), _0x21b268 && _0x21b268.iceConnectionState && -0x1 !== _0x21b268.iceConnectionState.search(/closed|failed/gi) && _0x2fa590.streams instanceof Array && _0x2fa590.streams.forEach(function(_0x5d55e7) { - var _0x2fa590 = _0x326931.streamEvents[_0x5d55e7.id] || { - 'streamid': _0x5d55e7.id, - 'stream': _0x5d55e7, - 'type': 'remote' - }; - _0x326931.onstreamended(_0x2fa590); - })); - }; - var _0x57365f = { - 'OfferToReceiveAudio': !!_0x5aa3f5.length, - 'OfferToReceiveVideo': !!_0x5aa3f5.length - }; - _0xeb3993.localPeerSdpConstraints && (_0x57365f = _0xeb3993.localPeerSdpConstraints), _0x394dad.sdpConstraints = _0xe7bfb2(_0x57365f); - var _0x7e19c5 = {}; - _0x21b268.ontrack = function(_0x5f3745) { - if (_0x5f3745 && 'track' === _0x5f3745.type) - if (_0x5f3745.stream = _0x5f3745.streams[_0x5f3745.streams.length - 0x1], _0x5f3745.stream.id || (_0x5f3745.stream.id = _0x5f3745.track.id), _0x7e19c5[_0x5f3745.stream.id] && 'Safari' !== DetectRTC.browser.name) _0x5f3745.track && (_0x5f3745.track.onended = function() { - _0x21b268.onremovestream(_0x5f3745); - }); - else { - _0x7e19c5[_0x5f3745.stream.id] = _0x5f3745.stream.id; - var _0x2fa590 = {}; - _0xeb3993.remoteSdp && _0xeb3993.remoteSdp.streamsToShare ? _0x2fa590 = _0xeb3993.remoteSdp.streamsToShare : _0xeb3993.streamsToShare && (_0x2fa590 = _0xeb3993.streamsToShare); - var _0x3dbe04 = _0x2fa590[_0x5f3745.stream.id]; - _0x3dbe04 ? (_0x5f3745.stream.isAudio = _0x3dbe04.isAudio, _0x5f3745.stream.isVideo = _0x3dbe04.isVideo, _0x5f3745.stream.isScreen = _0x3dbe04.isScreen) : (_0x5f3745.stream.isVideo = !!_0x2cbba5(_0x5f3745.stream, 'video').length, _0x5f3745.stream.isAudio = !_0x5f3745.stream.isVideo, _0x5f3745.stream.isScreen = !0x1), _0x5f3745.stream.streamid = _0x5f3745.stream.id, _0x521a09[_0x5f3745.stream.id] = _0x5f3745.stream, _0xeb3993.onRemoteStream(_0x5f3745.stream), _0x5f3745.stream.getTracks().forEach(function(_0x4eaf37) { - _0x4eaf37.onended = function() { - _0x21b268.onremovestream(_0x5f3745); - }; - }), _0x5f3745.stream.onremovetrack = function() { - _0x21b268.onremovestream(_0x5f3745); - }; - } - }, _0x21b268.onremovestream = function(_0x5131d7) { - _0x5131d7.stream.streamid = _0x5131d7.stream.id, _0x521a09[_0x5131d7.stream.id] && delete _0x521a09[_0x5131d7.stream.id], _0xeb3993.onRemoteStreamRemoved(_0x5131d7.stream); - }, 'function' != typeof _0x21b268.removeStream && (_0x21b268.removeStream = function(_0x659c28) { - _0x659c28.getTracks().forEach(function(_0x592b51) { - _0x21b268.removeTrack(_0x592b51, _0x659c28); - }); - }), this.addRemoteCandidate = function(_0x3baf5e) { - _0x21b268.addIceCandidate(new _0x437c06(_0x3baf5e)); - }, this.addRemoteSdp = function(_0x5132c2, _0x2483a6) { - _0x2483a6 = _0x2483a6 || function() {}, 'Safari' !== DetectRTC.browser.name && (_0x5132c2.sdp = _0x326931.processSdp(_0x5132c2.sdp)), _0x21b268.setRemoteDescription(new _0x28d3c1(_0x5132c2)).then(_0x2483a6, function(_0xe5feda) { - _0x326931.enableLogs && console.error('setRemoteDescription failed', '\n', _0xe5feda, '\n', _0x5132c2.sdp), _0x2483a6(); - }).catch(function(_0x3f508b) { - _0x326931.enableLogs && console.error('setRemoteDescription failed', '\n', _0x3f508b, '\n', _0x5132c2.sdp), _0x2483a6(); - }); - }; - var _0x2c7e5e = true; - - function _0x2e887d(_0xfe9b95) { - _0xfe9b95.binaryType = 'arraybuffer', _0xfe9b95.onmessage = function(_0x4397bd) { - _0xeb3993.onDataChannelMessage(_0x4397bd.data); - }, _0xfe9b95.onopen = function() { - _0xeb3993.onDataChannelOpened(_0xfe9b95); - }, _0xfe9b95.onerror = function(_0xa12ba0) { - _0xeb3993.onDataChannelError(_0xa12ba0); - }, _0xfe9b95.onclose = function(_0x30e29d) { - _0xeb3993.onDataChannelClosed(_0x30e29d); - }, _0xfe9b95.internalSend = _0xfe9b95.send, _0xfe9b95.send = function(_0x2c62da) { - 'open' === _0xfe9b95.readyState && _0xfe9b95.internalSend(_0x2c62da); - }, _0x21b268.channel = _0xfe9b95; - } - _0xeb3993.remoteSdp && (_0x2c7e5e = !0x1), this.createDataChannel = function() { - _0x2e887d(_0x21b268.createDataChannel('sctp', {})); - }, true !== _0x326931.session.data || _0x53652f || (_0x2c7e5e ? this.createDataChannel() : _0x21b268.ondatachannel = function(_0x4c5e51) { - _0x2e887d(_0x4c5e51.channel); - }), this.enableDisableVideoEncoding = function(_0x3d2379) { - var _0x326931; - if (_0x21b268.getSenders().forEach(function(_0x4212ea) { - _0x326931 || 'video' !== _0x4212ea.track.kind || (_0x326931 = _0x4212ea); - }), _0x326931 && _0x326931.getParameters) { - var _0x2fa590 = _0x326931.getParameters(); - _0x2fa590.encodings[0x1] && (_0x2fa590.encodings[0x1].active = !!_0x3d2379), _0x2fa590.encodings[0x2] && (_0x2fa590.encodings[0x2].active = !!_0x3d2379), _0x326931.setParameters(_0x2fa590); - } - }, _0xeb3993.remoteSdp && (_0xeb3993.remoteSdp.remotePeerSdpConstraints && (_0x57365f = _0xeb3993.remoteSdp.remotePeerSdpConstraints), _0x394dad.sdpConstraints = _0xe7bfb2(_0x57365f), this.addRemoteSdp(_0xeb3993.remoteSdp, function() { - _0x308f2d('createAnswer'); - })), 'two-way' != _0x326931.session.audio && 'two-way' != _0x326931.session.video && 'two-way' != _0x326931.session.screen || (_0x394dad.sdpConstraints = _0xe7bfb2({ - 'OfferToReceiveAudio': 'two-way' == _0x326931.session.audio || _0xeb3993.remoteSdp && _0xeb3993.remoteSdp.remotePeerSdpConstraints && _0xeb3993.remoteSdp.remotePeerSdpConstraints.OfferToReceiveAudio, - 'OfferToReceiveVideo': 'two-way' == _0x326931.session.video || 'two-way' == _0x326931.session.screen || _0xeb3993.remoteSdp && _0xeb3993.remoteSdp.remotePeerSdpConstraints && _0xeb3993.remoteSdp.remotePeerSdpConstraints.OfferToReceiveAudio + } + send(data) { + this.socket.send(JSON.stringify({ + data, + user: this.userid, + msg: true + })); + } + shareFile(file) { + this.socket.send(JSON.stringify({ + type: "incoming-file", + name: file.name + })); + file.arrayBuffer().then(ab => { + this.socket.send(JSON.stringify({ + type: "file-data", + data: Array.from(new Uint8Array(ab)) })); - var _0x5ed0e1 = {}; - - function _0x308f2d(_0x41a457) { - _0x21b268[_0x41a457](_0x394dad.sdpConstraints).then(function(_0x2f9b8b) { - 'Safari' !== DetectRTC.browser.name && (_0x2f9b8b.sdp = _0x326931.processSdp(_0x2f9b8b.sdp)), _0x21b268.setLocalDescription(_0x2f9b8b).then(function() { - _0x326931.trickleIce && (_0xeb3993.onLocalSdp({ - 'type': _0x2f9b8b.type, - 'sdp': _0x2f9b8b.sdp, - 'remotePeerSdpConstraints': _0xeb3993.remotePeerSdpConstraints || !0x1, - 'renegotiatingPeer': !!_0xeb3993.renegotiatingPeer || !0x1, - 'connectionDescription': _0x2fa590.connectionDescription, - 'dontGetRemoteStream': !!_0xeb3993.dontGetRemoteStream, - 'extra': _0x326931 ? _0x326931.extra : {}, - 'streamsToShare': _0x5ed0e1 - }), _0x326931.onSettingLocalDescription(_0x2fa590)); - }, function(_0x41064c) { - _0x326931.enableLogs && console.error('setLocalDescription error', _0x41064c); - }); - }, function(_0x31a9a8) { - _0x326931.enableLogs && console.error('sdp-error', _0x31a9a8); - }); - } - _0x21b268.getLocalStreams().forEach(function(_0x4ee107) { - _0x5ed0e1[_0x4ee107.streamid] = { - 'isAudio': !!_0x4ee107.isAudio, - 'isVideo': !!_0x4ee107.isVideo, - 'isScreen': !!_0x4ee107.isScreen - }; - }), _0x2c7e5e && _0x308f2d('createOffer'), _0x21b268.nativeClose = _0x21b268.close, _0x21b268.close = function() { - if (_0x21b268) { - try { - _0x21b268.nativeClose !== _0x21b268.close && _0x21b268.nativeClose(); - } catch (_0x3c28da) {} - _0x21b268 = null, _0x2fa590.peer = null; - } - }, this.peer = _0x21b268; - - - - - - } - var _0x42fdaa = function() { - function _0x572b26(_0x16547c, _0x12b3cb) { - var _0x3623e4 = _0x5c82c5(_0x16547c); - return _0x3623e4.videoCodecNumbers ? 'vp8' === _0x12b3cb && _0x3623e4.vp8LineNumber === _0x3623e4.videoCodecNumbers[0x0] ? _0x16547c : 'vp9' === _0x12b3cb && _0x3623e4.vp9LineNumber === _0x3623e4.videoCodecNumbers[0x0] ? _0x16547c : 'h264' === _0x12b3cb && _0x3623e4.h264LineNumber === _0x3623e4.videoCodecNumbers[0x0] ? _0x16547c : _0x16547c = _0x249ace(_0x16547c, _0x12b3cb, _0x3623e4) : _0x16547c; - } - - function _0x249ace(_0x536ba9, _0x3e10ca, _0x141d2f, _0x1f707f) { - var _0x3623e4 = ''; - if ('vp8' === _0x3e10ca) { - if (!_0x141d2f.vp8LineNumber) return _0x536ba9; - _0x3623e4 = _0x141d2f.vp8LineNumber; - } - if ('vp9' === _0x3e10ca) { - if (!_0x141d2f.vp9LineNumber) return _0x536ba9; - _0x3623e4 = _0x141d2f.vp9LineNumber; - } - if ('h264' === _0x3e10ca) { - if (!_0x141d2f.h264LineNumber) return _0x536ba9; - _0x3623e4 = _0x141d2f.h264LineNumber; - } - var _0x314bfa = _0x141d2f.videoCodecNumbersOriginal.split('SAVPF')[0x0] + 'SAVPF ', - _0x52ac96 = [_0x3623e4]; - return _0x1f707f && (_0x52ac96 = []), _0x141d2f.videoCodecNumbers.forEach(function(_0x43af74) { - _0x43af74 !== _0x3623e4 && _0x52ac96.push(_0x43af74); - }), _0x314bfa += _0x52ac96.join(' '), _0x536ba9 = _0x536ba9.replace(_0x141d2f.videoCodecNumbersOriginal, _0x314bfa); - } - - function _0x5c82c5(_0x370eaf) { - var _0x249ace = {}; - return _0x370eaf.split('\n').forEach(function(_0x42cf6b) { - 0x0 === _0x42cf6b.indexOf('m=video') && (_0x249ace.videoCodecNumbers = [], _0x42cf6b.split('SAVPF')[0x1].split(' ').forEach(function(_0x340dfa) { - (_0x340dfa = _0x340dfa.trim()) && _0x340dfa.length && (_0x249ace.videoCodecNumbers.push(_0x340dfa), _0x249ace.videoCodecNumbersOriginal = _0x42cf6b); - })), -0x1 === _0x42cf6b.indexOf('VP8/90000') || _0x249ace.vp8LineNumber || (_0x249ace.vp8LineNumber = _0x42cf6b.replace('a=rtpmap:', '').split(' ')[0x0]), -0x1 === _0x42cf6b.indexOf('VP9/90000') || _0x249ace.vp9LineNumber || (_0x249ace.vp9LineNumber = _0x42cf6b.replace('a=rtpmap:', '').split(' ')[0x0]), -0x1 === _0x42cf6b.indexOf('H264/90000') || _0x249ace.h264LineNumber || (_0x249ace.h264LineNumber = _0x42cf6b.replace('a=rtpmap:', '').split(' ')[0x0]); - }), _0x249ace; - } - - function _0x4526d0(_0x39207b, _0x23a46a, _0x1ebb9d) { - return function(_0x20ed55, _0x5132ac, _0xcecfcd, _0x8459a8, _0x27ad22) { - for (var _0x2dbfb3 = -0x1 !== _0xcecfcd ? _0xcecfcd : _0x20ed55.length, _0x160b11 = _0x5132ac; _0x160b11 < _0x2dbfb3; ++_0x160b11) - if (0x0 === _0x20ed55[_0x160b11].indexOf(_0x8459a8) && (!_0x27ad22 || -0x1 !== _0x20ed55[_0x160b11].toLowerCase().indexOf(_0x27ad22.toLowerCase()))) return _0x160b11; - return null; - }(_0x39207b, 0x0, -0x1, _0x23a46a, _0x1ebb9d); - } - - function _0x3623e4(_0x46fa44) { - var _0x249ace = new RegExp('a=rtpmap:(\d+) \w+\/\d+'), - _0x5c82c5 = _0x46fa44.match(_0x249ace); - return _0x5c82c5 && 0x2 === _0x5c82c5.length ? _0x5c82c5[0x1] : null; - } - return { - 'removeVPX': function(_0x59de0e) { - var _0x4526d0 = _0x5c82c5(_0x59de0e); - return _0x59de0e = _0x249ace(_0x59de0e, 'vp9', _0x4526d0, true), _0x59de0e = _0x249ace(_0x59de0e, 'vp8', _0x4526d0, true); - }, - 'disableNACK': function(_0x376b0e) { - if (!_0x376b0e || 'string' != typeof _0x376b0e) throw 'Invalid arguments.'; - return _0x376b0e = (_0x376b0e = (_0x376b0e = (_0x376b0e = _0x376b0e.replace('a=rtcp-fb:126 nack\r\n', '')).replace('a=rtcp-fb:126 nack pli\x0d\n', 'a=rtcp-fb:126 pli\x0d\n')).replace('a=rtcp-fb:97 nack\r\n', '')).replace('a=rtcp-fb:97 nack pli\r\n', 'a=rtcp-fb:97 pli\r\n'); - }, - 'prioritize': function(_0x238652, _0x23ac58) { - if (_0x23ac58 && _0x23ac58.getSenders && _0x23ac58.getSenders().length) { - if (!_0x238652 || 'string' != typeof _0x238652) throw 'Invalid arguments.'; - _0x23ac58.getSenders().forEach(function(_0x4c4f96) { - for (var _0x5c82c5 = _0x4c4f96.getParameters(), _0x4526d0 = 0x0; _0x4526d0 < _0x5c82c5.codecs.length; _0x4526d0++) - if (_0x5c82c5.codecs[_0x4526d0].mimeType == _0x238652) { - _0x5c82c5.codecs.unshift(_0x5c82c5.codecs.splice(_0x4526d0, 0x1)); - break; - } - _0x4c4f96.setParameters(_0x5c82c5); - }); - } - }, - 'removeNonG722': function(_0x49005b) { - return _0x49005b.replace(/m=audio ([0-9]+) RTP\/SAVPF ([0-9 ]*)/g, 'm=audio $1 RTP/SAVPF 9'); - }, - 'setApplicationSpecificBandwidth': function(_0xa77e44, _0x517ea3, _0x4de140) { - return function(_0x58398a, _0x84509d, _0x378779) { - return _0x84509d ? void 0x0 !== _0x5c498f && _0x5c498f ? _0x58398a : (_0x378779 && (_0x84509d.screen ? _0x84509d.screen < 0x12c && console.warn('It seems that you are using wrong bandwidth value for screen. Screen sharing is expected to fail.') : console.warn('It seems that you are not using bandwidth for screen. Screen sharing is expected to fail.')), _0x84509d.screen && _0x378779 && (_0x58398a = (_0x58398a = _0x58398a.replace(/b=AS([^\r\n]+\r\n)/g, '')).replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + _0x84509d.screen + '\x0d\n')), (_0x84509d.audio || _0x84509d.video) && (_0x58398a = _0x58398a.replace(/b=AS([^\r\n]+\r\n)/g, '')), _0x84509d.audio && (_0x58398a = _0x58398a.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:' + _0x84509d.audio + '\x0d\n')), _0x84509d.screen ? _0x58398a = _0x58398a.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + _0x84509d.screen + '\x0d\n') : _0x84509d.video && (_0x58398a = _0x58398a.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + _0x84509d.video + '\x0d\n')), _0x58398a) : _0x58398a; - }(_0xa77e44, _0x517ea3, _0x4de140); - }, - 'setVideoBitrates': function(_0x6898ff, _0xf38daa) { - return function(_0x4260bb, _0x46dc63) { - var _0x5c82c5, _0xcddf99 = (_0x46dc63 = _0x46dc63 || {}).min, - _0x4d9e07 = _0x46dc63.max, - _0x1e0ad5 = _0x4260bb.split('\x0d\n'), - _0x4e244d = _0x4526d0(_0x1e0ad5, 'a=rtpmap', 'VP8/90000'); - if (_0x4e244d && (_0x5c82c5 = _0x3623e4(_0x1e0ad5[_0x4e244d])), !_0x5c82c5) return _0x4260bb; - var _0x4a75e7, _0x5d5b05 = _0x4526d0(_0x1e0ad5, 'a=rtpmap', 'rtx/90000'); - if (_0x5d5b05 && (_0x4a75e7 = _0x3623e4(_0x1e0ad5[_0x5d5b05])), !_0x5d5b05) return _0x4260bb; - var _0x56e025 = _0x4526d0(_0x1e0ad5, 'a=fmtp:' + _0x4a75e7.toString()); - if (null !== _0x56e025) { - var _0x30c498 = '\x0d\n'; - _0x30c498 += 'a=fmtp:' + _0x5c82c5 + ' x-google-min-bitrate=' + (_0xcddf99 || '228') + '; x-google-max-bitrate=' + (_0x4d9e07 || '228'), _0x1e0ad5[_0x56e025] = _0x1e0ad5[_0x56e025].concat(_0x30c498), _0x4260bb = _0x1e0ad5.join('\x0d\n'); - } - return _0x4260bb; - }(_0x6898ff, _0xf38daa); - }, - 'setOpusAttributes': function(_0x553630, _0x553bce) { - return function(_0x48ec07, _0x1e35c6) { - _0x1e35c6 = _0x1e35c6 || {}; - var _0x5c82c5, _0x1be3e1 = _0x48ec07.split('\x0d\n'), - _0x456381 = _0x4526d0(_0x1be3e1, 'a=rtpmap', 'opus/48000'); - if (_0x456381 && (_0x5c82c5 = _0x3623e4(_0x1be3e1[_0x456381])), !_0x5c82c5) return _0x48ec07; - var _0x2d8ac5 = _0x4526d0(_0x1be3e1, 'a=fmtp:' + _0x5c82c5.toString()); - if (null === _0x2d8ac5) return _0x48ec07; - var _0x8350e7 = ''; - return _0x8350e7 += '; stereo=' + (void 0x0 !== _0x1e35c6.stereo ? _0x1e35c6.stereo : '1'), _0x8350e7 += '; sprop-stereo=' + (void 0x0 !== _0x1e35c6['sprop-stereo'] ? _0x1e35c6['sprop-stereo'] : '1'), void 0x0 !== _0x1e35c6.maxaveragebitrate && (_0x8350e7 += '; maxaveragebitrate=' + (_0x1e35c6.maxaveragebitrate || 0x100000)), void 0x0 !== _0x1e35c6.maxplaybackrate && (_0x8350e7 += '; maxplaybackrate=' + (_0x1e35c6.maxplaybackrate || 0x100000)), void 0x0 !== _0x1e35c6.cbr && (_0x8350e7 += '; cbr=' + (void 0x0 !== _0x1e35c6.cbr ? _0x1e35c6.cbr : '1')), void 0x0 !== _0x1e35c6.useinbandfec && (_0x8350e7 += '; useinbandfec=' + _0x1e35c6.useinbandfec), void 0x0 !== _0x1e35c6.usedtx && (_0x8350e7 += '; usedtx=' + _0x1e35c6.usedtx), void 0x0 !== _0x1e35c6.maxptime && (_0x8350e7 += '\x0d\na=maxptime:' + _0x1e35c6.maxptime), _0x1be3e1[_0x2d8ac5] = _0x1be3e1[_0x2d8ac5].concat(_0x8350e7), _0x48ec07 = _0x1be3e1.join('\x0d\n'); - }(_0x553630, _0x553bce); - }, - 'preferVP9': function(_0x18deb7) { - return _0x572b26(_0x18deb7, 'vp9'); - }, - 'preferCodec': _0x572b26, - 'forceStereoAudio': function(_0x14ddc9) { - for (var _0x249ace = _0x14ddc9.split('\x0d\n'), _0x5c82c5 = null, _0x4526d0 = 0x0; _0x4526d0 < _0x249ace.length; _0x4526d0++) - if (-0x1 !== _0x249ace[_0x4526d0].search('opus/48000')) { - var _0x3623e4 = extractSdp(_0x249ace[_0x4526d0], /:(\d+) opus\/48000/i); - break; - } - for (_0x4526d0 = 0x0; _0x4526d0 < _0x249ace.length; _0x4526d0++) { - if (-0x1 !== _0x249ace[_0x4526d0].search('a=fmtp')) - if (extractSdp(_0x249ace[_0x4526d0], /a=fmtp:(\d+)/) === _0x3623e4) { - _0x5c82c5 = _0x4526d0; - break; - } - } - return null === _0x5c82c5 ? _0x14ddc9 : (_0x249ace[_0x5c82c5] = _0x249ace[_0x5c82c5].concat('; stereo=1; sprop-stereo=1'), _0x14ddc9 = _0x249ace.join('\x0d\n')); - } - }; - }(); - window.BandwidthHandler = _0x42fdaa; - var _0x2b9f47 = { - 'processCandidates': function(_0x3bf1a2, _0x390036) { - var _0x2fa590 = _0x390036.candidate, - _0x21b268 = _0x3bf1a2.candidates, - _0x521a09 = _0x21b268.stun, - _0x3e00fc = _0x21b268.turn; - if (_0x3b94ab(_0x21b268.reflexive) || (_0x521a09 = _0x21b268.reflexive), _0x3b94ab(_0x21b268.relay) || (_0x3e00fc = _0x21b268.relay), (_0x21b268.host || !_0x2fa590.match(/typ host/g)) && (_0x3e00fc || !_0x2fa590.match(/typ relay/g)) && (_0x521a09 || !_0x2fa590.match(/typ srflx/g))) { - var _0x2b6e29 = _0x3bf1a2.iceProtocols; - if ((_0x2b6e29.udp || !_0x2fa590.match(/ udp /g)) && (_0x2b6e29.tcp || !_0x2fa590.match(/ tcp /g))) return _0x3bf1a2.enableLogs && console.debug('Your candidate pairs:', _0x2fa590), { - 'candidate': _0x2fa590, - 'sdpMid': _0x390036.sdpMid, - 'sdpMLineIndex': _0x390036.sdpMLineIndex - }; - } - } - }, - _0x3b9609 = { - 'getIceServers': function(_0x488e7f) { - return [{ - 'urls': ['stun:webrtcweb.com:7788'], - 'username': 'muazkh', - 'credential': 'muazkh' - }, { - 'urls': ['turn:webrtcweb.com:7788', 'turn:webrtcweb.com:8877', 'turn:webrtcweb.com:4455'], - 'username': 'muazkh', - 'credential': 'muazkh' - }, { - 'urls': ['stun:stun.l.google.com:19302', 'stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302', 'stun:stun.l.google.com:19302?transport=udp'] - }]; - } - }; - - function _0x5adfda(_0x283137) { - if (true !== currentUserMediaRequest.mutex) { - currentUserMediaRequest.mutex = true; - var _0x326931 = JSON.stringify(_0x283137.localMediaConstraints); - if (currentUserMediaRequest.streams[_0x326931]) _0x196d8c(currentUserMediaRequest.streams[_0x326931].stream, true); - else { - if (!!/BB10|BlackBerry/i .test(navigator.userAgent || '') || void 0x0 === navigator.mediaDevices || 'function' != typeof navigator.mediaDevices.getUserMedia) return navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia, void navigator.getUserMedia(_0x283137.localMediaConstraints, function(_0x470b2a) { - _0x470b2a.streamid = _0x470b2a.streamid || _0x470b2a.id || _0x5b8d5d(), _0x470b2a.idInstance = _0x326931, _0x196d8c(_0x470b2a); - }, function(_0x3fd14c) { - _0x283137.onLocalMediaError(_0x3fd14c, _0x283137.localMediaConstraints); - }); - if (void 0x0 === navigator.mediaDevices) { - navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; - var _0x2fa590, _0x21b268, _0x521a09 = function() {}; - navigator.mediaDevices = { - 'getUserMedia': function(_0x1ddd61) { - return navigator.getUserMedia(_0x1ddd61, function(_0x4a0936) { - _0x4a0936(stream), _0x2fa590 = stream; - }, function(_0x15c59c) { - _0x521a09(_0x15c59c), _0x21b268 = _0x15c59c; - }), { - 'then': function(_0x3e20ef) { - if (!_0x2fa590) return _0x3e20ef, { - 'then': function(_0x444f48) { - _0x21b268 ? _0x444f48(_0x21b268) : _0x521a09 = _0x444f48; - } - }; - _0x3e20ef(_0x2fa590); - } - }; - } - }; - } - navigator.mediaDevices.getUserMedia(_0x283137.localMediaConstraints).then(function(_0x5a25ab) { - _0x5a25ab.streamid = _0x5a25ab.streamid || _0x5a25ab.id || _0x5b8d5d(), _0x5a25ab.idInstance = _0x326931, _0x196d8c(_0x5a25ab); - }).catch(function(_0x5f1ad4) { - _0x283137.onLocalMediaError(_0x5f1ad4, _0x283137.localMediaConstraints); - }); - } - } else currentUserMediaRequest.queueRequests.push(_0x283137); - - function _0x196d8c(_0x1f527b, _0x58cd7c) { - ! function(_0x3b5a94, _0x299595) { - _0x3b5a94.mandatory && _0x3b5a94.mandatory.chromeMediaSource ? _0x299595.isScreen = true : _0x3b5a94.mozMediaSource || _0x3b5a94.mediaSource ? _0x299595.isScreen = true : _0x3b5a94.video ? _0x299595.isVideo = true : _0x3b5a94.audio && (_0x299595.isAudio = true); - }(_0x283137.localMediaConstraints, _0x1f527b); - var _0x521a09 = 'ended'; - 'oninactive' in _0x1f527b && (_0x521a09 = 'inactive'), _0x1f527b.addEventListener(_0x521a09, function() { - delete currentUserMediaRequest.streams[_0x326931], currentUserMediaRequest.mutex = !0x1, currentUserMediaRequest.queueRequests.indexOf(_0x283137) && (delete currentUserMediaRequest.queueRequests[currentUserMediaRequest.queueRequests.indexOf(_0x283137)], currentUserMediaRequest.queueRequests = _0xf3acd(currentUserMediaRequest.queueRequests)); - }, !0x1), currentUserMediaRequest.streams[_0x326931] = { - 'stream': _0x1f527b - }, currentUserMediaRequest.mutex = !0x1, currentUserMediaRequest.queueRequests.length && _0x5adfda(currentUserMediaRequest.queueRequests.shift()), _0x283137.onGettingLocalMedia(_0x1f527b, _0x58cd7c); - } - } - window.currentUserMediaRequest = { - 'streams': [], - 'mutex': !0x1, - 'queueRequests': [], - 'remove': function(_0x1b91c8) { - this.mutex = !0x1; - var _0x326931 = this.streams[_0x1b91c8]; - if (_0x326931) { - var _0x2fa590 = (_0x326931 = _0x326931.stream).currentUserMediaRequestOptions; - this.queueRequests.indexOf(_0x2fa590) && (delete this.queueRequests[this.queueRequests.indexOf(_0x2fa590)], this.queueRequests = _0xf3acd(this.queueRequests)), this.streams[_0x1b91c8].stream = null, delete this.streams[_0x1b91c8]; - } - } - }; - var _0x25e82e = function() { - function _0xc80ee1(_0x19f0b1) { - if (_0x19f0b1) return 'string' == typeof _0x19f0b1 || void 0x0 === _0x19f0b1 ? _0x19f0b1 : _0x19f0b1.audio && _0x19f0b1.video ? null : _0x19f0b1.audio ? 'audio' : _0x19f0b1.video ? 'video' : void 0x0; - } - return { - 'setHandlers': function(_0x3d58a4, _0x57b7e9, _0x2faad3) { - if (_0x3d58a4 && _0x3d58a4.addEventListener) { - if (void 0x0 === _0x57b7e9 || 0x1 == _0x57b7e9) { - var _0x521a09 = 'ended'; - 'oninactive' in _0x3d58a4 && (_0x521a09 = 'inactive'), _0x3d58a4.addEventListener(_0x521a09, function() { - _0x25e82e.onSyncNeeded(this.streamid, _0x521a09); - }, !0x1); - } - _0x3d58a4.mute = function(_0x393c28, _0xb2bd8c) { - _0x393c28 = _0xc80ee1(_0x393c28), void 0x0 !== _0xb2bd8c && (_0x57b7e9 = _0xb2bd8c), void 0x0 !== _0x393c28 && 'audio' != _0x393c28 || _0x2cbba5(_0x3d58a4, 'audio').forEach(function(_0x3bbe2d) { - _0x3bbe2d.enabled = !0x1, _0x2faad3.streamEvents[_0x3d58a4.streamid].isAudioMuted = true; - }), void 0x0 !== _0x393c28 && 'video' != _0x393c28 || _0x2cbba5(_0x3d58a4, 'video').forEach(function(_0x2ba091) { - _0x2ba091.enabled = !0x1; - }), void 0x0 !== _0x57b7e9 && 0x1 != _0x57b7e9 || _0x25e82e.onSyncNeeded(_0x3d58a4.streamid, 'mute', _0x393c28), _0x2faad3.streamEvents[_0x3d58a4.streamid].muteType = _0x393c28 || 'both', _0x121233(_0x3d58a4, 'mute', _0x393c28); - }, _0x3d58a4.unmute = function(_0x557e65, _0x2dc6b7) { - _0x557e65 = _0xc80ee1(_0x557e65), void 0x0 !== _0x2dc6b7 && (_0x57b7e9 = _0x2dc6b7), - function() { - if (!_0x2faad3.streamEvents[_0x3d58a4.streamid].mediaElement) return; - var _0xc80ee1 = _0x2faad3.streamEvents[_0x3d58a4.streamid].mediaElement; - _0xc80ee1.volume = 0x0, - function _0xc80ee1(_0x537992, _0x12ab30, _0x212c93, _0x44a2b5) { - _0x44a2b5 = (_0x44a2b5 || 0x0) + 0x1; - if (_0x44a2b5 >= _0x12ab30) return; - setTimeout(function() { - _0x212c93(), _0xc80ee1(_0x537992, _0x12ab30, _0x212c93, _0x44a2b5); - }, _0x537992); - }(0xc8, 0x5, function() { - try { - _0xc80ee1.volume += 0.2; - } catch (_0x111824) { - _0xc80ee1.volume = 0x1; - } - }); - }(), void 0x0 !== _0x557e65 && 'audio' != _0x557e65 || _0x2cbba5(_0x3d58a4, 'audio').forEach(function(_0x39cdcf) { - _0x39cdcf.enabled = true, _0x2faad3.streamEvents[_0x3d58a4.streamid].isAudioMuted = !0x1; - }), void 0x0 !== _0x557e65 && 'video' != _0x557e65 || (_0x2cbba5(_0x3d58a4, 'video').forEach(function(_0x1bc1ac) { - _0x1bc1ac.enabled = true; - }), void 0x0 !== _0x557e65 && 'video' == _0x557e65 && _0x2faad3.streamEvents[_0x3d58a4.streamid].isAudioMuted && function _0xc80ee1(_0x2a12fa) { - _0x2a12fa || (_0x2a12fa = 0x0), ++_0x2a12fa < 0x64 && _0x2faad3.streamEvents[_0x3d58a4.streamid].isAudioMuted && (_0x3d58a4.mute('audio'), setTimeout(function() { - _0xc80ee1(_0x2a12fa); - }, 0x32)); - }()), void 0x0 !== _0x57b7e9 && 0x1 != _0x57b7e9 || _0x25e82e.onSyncNeeded(_0x3d58a4.streamid, 'unmute', _0x557e65), _0x2faad3.streamEvents[_0x3d58a4.streamid].unmuteType = _0x557e65 || 'both', _0x121233(_0x3d58a4, 'unmute', _0x557e65); - }; - } - }, - 'onSyncNeeded': function(_0x1963f6, _0x4e7716, _0x3963b) {} - }; - }(); - window.addEventListener('message', function(_0x48b05c) { - _0x48b05c.origin == window.location.origin && function(_0x53ae17) { - if ('PermissionDeniedError' == _0x53ae17) { - if (_0x301abf = 'PermissionDeniedError', _0x467e9d) return _0x467e9d('PermissionDeniedError'); - throw new Error('PermissionDeniedError'); - } - 'rtcmulticonnection-extension-loaded' == _0x53ae17 && (_0x301abf = 'desktop'); - _0x53ae17.sourceId && _0x467e9d && _0x467e9d(_0x427b66 = _0x53ae17.sourceId, true === _0x53ae17.canRequestAudioTrack); - }(_0x48b05c.data); - }); - var _0x427b66, _0x467e9d, _0x301abf = 'screen'; - - function _0x53da88(_0x14f9e0) { - if (_0x14f9e0) { - if ('desktop' == _0x301abf) return _0x14f9e0(true); - window.postMessage('are-you-there', '*'), setTimeout(function() { - _0x14f9e0('screen' != _0x301abf); - }, 0x7d0); - } - } - var _0x5c498f = void 0x0 !== window.InstallTrigger, - _0x1ea249 = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0x0; - window.chrome; - - function _0x1f670d(_0x4bd5c8, _0x3b2cbe) { - if (_0x5c498f) return _0x3b2cbe('not-chrome'); - 0x2 != arguments.length && (_0x3b2cbe = _0x4bd5c8, _0x4bd5c8 = 'ajhifddimkapgcifgcodmmfdlknahffk'); - var _0x2fa590 = document.createElement('img'); - _0x2fa590.src = 'chrome-extension://' + _0x4bd5c8 + '/icon.png', _0x2fa590.onload = function() { - _0x301abf = 'screen', window.postMessage('are-you-there', '*'), setTimeout(function() { - _0x3b2cbe('screen' == _0x301abf ? 'installed-disabled' : 'installed-enabled'); - }, 0x7d0); - }, _0x2fa590.onerror = function() { - _0x3b2cbe('not-installed'); - }; - } - - function _0x1c050b(_0xe24308, _0x3ebcd4) { - if (_0x5c498f) return _0xe24308(null, { - 'mozMediaSource': 'window', - 'mediaSource': 'window' - }); - var _0x2fa590 = { - 'mandatory': { - 'chromeMediaSource': _0x301abf, - 'maxWidth': screen.width > 0x780 ? screen.width : 0x780, - 'maxHeight': screen.height > 0x438 ? screen.height : 0x438 - }, - 'optional': [] - }; - 'desktop' != _0x301abf || _0x427b66 ? ('desktop' == _0x301abf && (_0x2fa590.mandatory.chromeMediaSourceId = _0x427b66), _0xe24308(null, _0x2fa590)) : _0x3ebcd4 ? function(_0x16e1da) { - if (!_0x16e1da) throw '"callback" parameter is mandatory.'; - if (_0x427b66) return _0x16e1da(_0x427b66); - _0x467e9d = _0x16e1da, window.postMessage('audio-plus-tab', '*'); - }(function(_0x240030, _0x41af1b) { - _0x2fa590.mandatory.chromeMediaSourceId = _0x240030, _0x41af1b && (_0x2fa590.canRequestAudioTrack = true), _0xe24308('PermissionDeniedError' == _0x240030 ? _0x240030 : null, _0x2fa590); - }) : function(_0x465509) { - if (!_0x465509) throw '"callback" parameter is mandatory.'; - if (_0x427b66) return _0x465509(_0x427b66); - _0x467e9d = _0x465509, window.postMessage('get-sourceId', '*'); - }(function(_0x13bb7e) { - _0x2fa590.mandatory.chromeMediaSourceId = _0x13bb7e, _0xe24308('PermissionDeniedError' == _0x13bb7e ? _0x13bb7e : null, _0x2fa590); - }); - } - - function _0x342039(_0x4dbb06) { - var _0x326931 = {}; - return { - 'receive': function(_0x5d1473, _0x43133d, _0x584294) { - var _0x547cf6 = _0x5d1473.uuid; - if (_0x326931[_0x547cf6] || (_0x326931[_0x547cf6] = []), _0x326931[_0x547cf6].push(_0x5d1473.message), _0x5d1473.last) { - var _0x967e71 = _0x326931[_0x547cf6].join(''); - _0x5d1473.isobject && (_0x967e71 = JSON.parse(_0x967e71)); - var _0x33399d = { - 'data': _0x967e71, - 'userid': _0x43133d, - 'extra': _0x584294, - 'latency': new Date().getTime() - _0x5d1473.sendingTime - }; - _0x4dbb06.autoTranslateText ? (_0x33399d.original = _0x33399d.data, _0x4dbb06.Translator.TranslateText(_0x33399d.data, function(_0x420bda) { - _0x33399d.data = _0x420bda, _0x4dbb06.onmessage(_0x33399d); - })) : _0x4dbb06.onmessage(_0x33399d), delete _0x326931[_0x547cf6]; - } - } - }; - } - var _0x21703b = { - 'send': function(_0x3eb04b) { - var _0x326931 = _0x3eb04b.connection, - _0x2fa590 = _0x3eb04b.channel, - _0x21b268 = _0x3eb04b.remoteUserId, - _0x521a09 = _0x3eb04b.text, - _0x477fc1 = _0x326931.chunkSize || 0x3e8, - _0x2406ca = '', - _0x2b3340 = !0x1; - 'string' != typeof _0x521a09 && (_0x2b3340 = true, _0x521a09 = JSON.stringify(_0x521a09)); - var _0x5093c5 = _0x5b8d5d(), - _0x53bd37 = new Date().getTime(); - ! function _0x3eb04b(_0x452fc6, _0x2486ef) { - var _0x4068b1 = { - 'type': 'text', - 'uuid': _0x5093c5, - 'sendingTime': _0x53bd37 - }; - _0x452fc6 && (_0x2486ef = _0x452fc6, _0x4068b1.packets = parseInt(_0x2486ef.length / _0x477fc1)); - _0x2486ef.length > _0x477fc1 ? _0x4068b1.message = _0x2486ef.slice(0x0, _0x477fc1) : (_0x4068b1.message = _0x2486ef, _0x4068b1.last = true, _0x4068b1.isobject = _0x2b3340); - _0x2fa590.send(_0x4068b1, _0x21b268); - _0x2406ca = _0x2486ef.slice(_0x4068b1.message.length); - _0x2406ca.length && setTimeout(function() { - _0x3eb04b(null, _0x2406ca); - }, _0x326931.chunkInterval || 0x64); - }(_0x521a09); - } - }, - _0x2cf1f3 = { - 'handle': function(_0x519a30) { - var _0x326931 = {}; - _0x519a30.onFileStart = function(_0x2a3aa7) { - var _0x21b268 = document.createElement('div'); - if (_0x21b268.title = _0x2a3aa7.name, _0x21b268.innerHTML = ' ', _0x2a3aa7.remoteUserId && (_0x21b268.innerHTML += ' (Sharing with:' + _0x2a3aa7.remoteUserId + ')'), _0x519a30.filesContainer || (_0x519a30.filesContainer = document.body || document.documentElement), _0x519a30.filesContainer.insertBefore(_0x21b268, _0x519a30.filesContainer.firstChild), !_0x2a3aa7.remoteUserId) return _0x326931[_0x2a3aa7.uuid] = { - 'div': _0x21b268, - 'progress': _0x21b268.querySelector('progress'), - 'label': _0x21b268.querySelector('label') - }, void(_0x326931[_0x2a3aa7.uuid].progress.max = _0x2a3aa7.maxChunks); - _0x326931[_0x2a3aa7.uuid] || (_0x326931[_0x2a3aa7.uuid] = {}), _0x326931[_0x2a3aa7.uuid][_0x2a3aa7.remoteUserId] = { - 'div': _0x21b268, - 'progress': _0x21b268.querySelector('progress'), - 'label': _0x21b268.querySelector('label') - }, _0x326931[_0x2a3aa7.uuid][_0x2a3aa7.remoteUserId].progress.max = _0x2a3aa7.maxChunks; - }, _0x519a30.onFileProgress = function(_0x4330ac) { - var _0x2fa590 = _0x326931[_0x4330ac.uuid]; - _0x2fa590 && (_0x4330ac.remoteUserId && !(_0x2fa590 = _0x326931[_0x4330ac.uuid][_0x4330ac.remoteUserId]) || (_0x2fa590.progress.value = _0x4330ac.currentPosition || _0x4330ac.maxChunks || _0x2fa590.progress.max, function(_0x5df338, _0x284eff) { - if (-0x1 !== _0x5df338.position) { - var _0x2fa590 = +_0x5df338.position.toFixed(0x2).split('.')[0x1] || 0x64; - _0x284eff.innerHTML = _0x2fa590 + '%'; - } - }(_0x2fa590.progress, _0x2fa590.label))); - }, _0x519a30.onFileEnd = function(_0x60ee3b) { - var _0x2fa590 = _0x326931[_0x60ee3b.uuid]; - if (_0x2fa590) { - if (!_0x60ee3b.remoteUserId || (_0x2fa590 = _0x326931[_0x60ee3b.uuid][_0x60ee3b.remoteUserId])) { - var _0x21b268 = _0x2fa590.div; - 0x1 != _0x60ee3b.type.indexOf('image') ? _0x21b268.innerHTML = 'Download ' + _0x60ee3b.name + '
' : _0x21b268.innerHTML = 'Download ' + _0x60ee3b.name + '
'; - } - } else console.error('No such progress-helper element exist.', _0x60ee3b); - }; - } - }, - _0x400337 = { - 'handle': function(_0x386b1a) { - _0x386b1a.autoTranslateText = !0x1, _0x386b1a.language = 'en', _0x386b1a.googKey = 'AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE', _0x386b1a.Translator = { - 'TranslateText': function(_0x211215, _0x254987) { - var _0x21b268 = document.createElement('script'); - _0x21b268.type = 'text/javascript'; - var _0x521a09 = encodeURIComponent(_0x211215), - _0x4a4191 = 'method' + _0x386b1a.token(); - window[_0x4a4191] = function(_0x9cc9a) { - _0x9cc9a.data && _0x9cc9a.data.translations[0x0] && _0x254987 ? _0x254987(_0x9cc9a.data.translations[0x0].translatedText) : _0x9cc9a.error && 'Daily Limit Exceeded' === _0x9cc9a.error.message ? console.error('Text translation failed. Error message: "Daily Limit Exceeded."') : _0x9cc9a.error ? console.error(_0x9cc9a.error.message) : console.error(_0x9cc9a); - }; - var _0xfca442 = 'https://www.googleapis.com/language/translate/v2?key=' + _0x386b1a.googKey + '&target=' + (_0x386b1a.language || 'en-US') + '&callback=window.' + _0x4a4191 + '&q=' + _0x521a09; - _0x21b268.src = _0xfca442, document.getElementsByTagName('head')[0x0].appendChild(_0x21b268); - }, - 'getListOfLanguages': function(_0x36cf7f) { - var _0x2fa590 = new XMLHttpRequest(); - _0x2fa590.onreadystatechange = function() { - if (_0x2fa590.readyState == XMLHttpRequest.DONE) { - var _0x386b1a = JSON.parse(_0x2fa590.responseText); - if (_0x386b1a && _0x386b1a.data && _0x386b1a.data.languages) return void _0x36cf7f(_0x386b1a.data.languages); - if (_0x386b1a.error && 'Daily Limit Exceeded' === _0x386b1a.error.message) return void console.error('Text translation failed. Error message: "Daily Limit Exceeded."'); - if (_0x386b1a.error) return void console.error(_0x386b1a.error.message); - console.error(_0x386b1a); - } - }; - var _0x21b268 = 'https://www.googleapis.com/language/translate/v2/languages?key=' + _0x386b1a.googKey + '&target=en'; - _0x2fa590.open('GET', _0x21b268, true), _0x2fa590.send(null); - } - }; - } - }; - ! function(_0x51c1c9) { - _0x326931 = _0x326931 || { - 'useDefaultDevices': true - }, _0x51c1c9.channel = _0x51c1c9.sessionid = (_0x1056a5 || location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g, '').split('\n').join('').split('\x0d').join('')) + ''; - var _0x21b268 = new _0x11ea4f(_0x51c1c9), - _0x521a09 = {}; - - function _0x2db9d8(_0x3112a3) { - new _0x45c30f(_0x51c1c9, function(_0xbc287b) { - _0x3112a3 && _0x3112a3(_0x51c1c9.socket); - }); - } - - function _0x6a70ac(_0x2eb7ca, _0x54a40d) { - _0x51c1c9.socket.emit('join-room', { - 'sessionid': _0x51c1c9.sessionid, - 'session': _0x51c1c9.session, - 'mediaConstraints': _0x51c1c9.mediaConstraints, - 'sdpConstraints': _0x51c1c9.sdpConstraints, - 'streams': _0x3121c9(), - 'extra': _0x51c1c9.extra, - 'password': void 0x0 !== _0x51c1c9.password && 'object' !== _0x4ffbab(_0x51c1c9.password) ? _0x51c1c9.password : '' - }, function(_0x35f814, _0x1c1c0b) { - if (true === _0x35f814) { - if (_0x51c1c9.enableLogs && console.log('isRoomJoined: ', _0x35f814, ' roomid: ', _0x51c1c9.sessionid), _0x51c1c9.peers[_0x51c1c9.sessionid]) return; - _0x21b268.onNegotiationNeeded(_0x2eb7ca); - }!0x1 === _0x35f814 && _0x51c1c9.enableLogs && console.warn('isRoomJoined: ', _0x1c1c0b, ' roomid: ', _0x51c1c9.sessionid), _0x54a40d(_0x35f814, _0x51c1c9.sessionid, _0x1c1c0b); - }); - } - - function _0x484896(_0xaeb629) { - _0x51c1c9.enableLogs && console.log('Sending open-room signal to socket.io'), _0x51c1c9.waitingForLocalMedia = !0x1, _0x51c1c9.socket.emit('open-room', { - 'sessionid': _0x51c1c9.sessionid, - 'session': _0x51c1c9.session, - 'mediaConstraints': _0x51c1c9.mediaConstraints, - 'sdpConstraints': _0x51c1c9.sdpConstraints, - 'streams': _0x3121c9(), - 'extra': _0x51c1c9.extra, - 'identifier': _0x51c1c9.publicRoomIdentifier, - 'password': void 0x0 !== _0x51c1c9.password && 'object' !== _0x4ffbab(_0x51c1c9.password) ? _0x51c1c9.password : '' - }, function(_0x5de645, _0x24b2b1) { - true === _0x5de645 && (_0x51c1c9.enableLogs && console.log('isRoomOpened: ', _0x5de645, ' roomid: ', _0x51c1c9.sessionid), _0xaeb629(_0x5de645, _0x51c1c9.sessionid)), !0x1 === _0x5de645 && (_0x51c1c9.enableLogs && console.warn('isRoomOpened: ', _0x24b2b1, ' roomid: ', _0x51c1c9.sessionid), _0xaeb629(_0x5de645, _0x51c1c9.sessionid, _0x24b2b1)); - }); - } - - function _0x3121c9() { - try { - return _0x51c1c9.streamEvents.selectAll('local').map(function(_0x4301e9) { - return { - 'streamid': _0x4301e9.streamid, - 'tracks': _0x4301e9.stream.getTracks().length - }; - }); - } catch (_0x64ac4b) { - return []; - } - } - - function _0x373dce(_0x510ce7, _0xd10b33) { - if (_0x51c1c9.dontCaptureUserMedia || _0x510ce7.isDataOnly) _0xd10b33(); - else { - var _0x521a09 = {}; - _0x510ce7.localPeerSdpConstraints.OfferToReceiveAudio && (_0x521a09.audio = _0x51c1c9.mediaConstraints.audio), _0x510ce7.localPeerSdpConstraints.OfferToReceiveVideo && (_0x521a09.video = _0x51c1c9.mediaConstraints.video); - var _0x27fd08 = _0x510ce7.session || _0x51c1c9.session; - _0x27fd08.oneway && 'two-way' !== _0x27fd08.audio && 'two-way' !== _0x27fd08.video && 'two-way' !== _0x27fd08.screen ? _0xd10b33() : (_0x27fd08.oneway && _0x27fd08.audio && 'two-way' === _0x27fd08.audio && (_0x27fd08 = { - 'audio': true - }), (_0x27fd08.audio || _0x27fd08.video || _0x27fd08.screen) && (_0x27fd08.screen ? 'Edge' === DetectRTC.browser.name ? navigator.getDisplayMedia({ - 'video': true, - 'audio': _0x93df62(_0x51c1c9) - }).then(function(_0xceda9e) { - _0xceda9e.isScreen = true, _0x21b268.onGettingLocalMedia(_0xceda9e), !_0x27fd08.audio && !_0x27fd08.video || _0x93df62(_0x51c1c9) ? _0xd10b33(_0xceda9e) : _0x51c1c9.invokeGetUserMedia(null, _0xd10b33); - }, function(_0x15d180) { - console.error('Unable to capture screen on Edge. HTTPs and version 17+ is required.'); - }) : _0x51c1c9.getScreenConstraints(function(_0x81d091, _0x38bce3) { - _0x51c1c9.invokeGetUserMedia({ - 'audio': !!_0x93df62(_0x51c1c9) && _0x405170(_0x38bce3), - 'video': _0x38bce3, - 'isScreen': true - }, !_0x27fd08.audio && !_0x27fd08.video || _0x93df62(_0x51c1c9) ? _0xd10b33 : _0x51c1c9.invokeGetUserMedia(null, _0xd10b33)); - }) : (_0x27fd08.audio || _0x27fd08.video) && _0x51c1c9.invokeGetUserMedia(null, _0xd10b33, _0x27fd08))); - } - } - - function _0x2559f7(_0x54aa63, _0x15ef31) { - _0x54aa63 ? (_0x15ef31.audio && _0x2cbba5(_0x54aa63, 'audio').forEach(function(_0x3eb0f7) { - _0x3eb0f7.applyConstraints(_0x15ef31.audio); - }), _0x15ef31.video && _0x2cbba5(_0x54aa63, 'video').forEach(function(_0x404e22) { - _0x404e22.applyConstraints(_0x15ef31.video); - })) : _0x51c1c9.enableLogs && console.error('No stream to applyConstraints.'); - } - - function _0x44cd42(_0xa4ae78, _0xd64125, _0x3b5c67) { - _0xd64125 ? _0x21b268.replaceTrack(_0xa4ae78, _0xd64125, _0x3b5c67) : _0x51c1c9.peers.getAllParticipants().forEach(function(_0x67f7c1) { - _0x21b268.replaceTrack(_0xa4ae78, _0x67f7c1, _0x3b5c67); - }); - } - _0x21b268.onGettingLocalMedia = function(_0x399d43, _0x84fca0) { - if (_0x84fca0 = _0x84fca0 || function() {}, _0x521a09[_0x399d43.streamid]) _0x84fca0(); - else { - _0x521a09[_0x399d43.streamid] = true; - try { - _0x399d43.type = 'local'; - } catch (_0x17f6f2) {} - _0x51c1c9.setStreamEndHandler(_0x399d43), _0x412d65(_0x399d43, function(_0x2ad0da) { - _0x2ad0da.id = _0x399d43.streamid, _0x2ad0da.muted = true, _0x2ad0da.volume = 0x0, -0x1 === _0x51c1c9.attachStreams.indexOf(_0x399d43) && _0x51c1c9.attachStreams.push(_0x399d43), void 0x0 !== _0x25e82e && _0x25e82e.setHandlers(_0x399d43, true, _0x51c1c9), _0x51c1c9.streamEvents[_0x399d43.streamid] = { - 'stream': _0x399d43, - 'type': 'local', - 'mediaElement': _0x2ad0da, - 'userid': _0x51c1c9.userid, - 'extra': _0x51c1c9.extra, - 'streamid': _0x399d43.streamid, - 'isAudioMuted': true - }; - try { - ! function(_0x535d1c, _0x240dfe) { - if (_0x240dfe.stream && _0x2cbba5(_0x240dfe.stream, 'audio').length) { - if (!_0x535d1c || !_0x240dfe) throw 'Both arguments are required.'; - if (_0x535d1c.onspeaking && _0x535d1c.onsilence) { - if ('undefined' == typeof hark) throw 'hark.js not found.'; - hark(_0x240dfe.stream, { - 'onspeaking': function() { - _0x535d1c.onspeaking(_0x240dfe); - }, - 'onsilence': function() { - _0x535d1c.onsilence(_0x240dfe); - }, - 'onvolumechange': function(_0x114490, _0x4f35b0) { - _0x535d1c.onvolumechange && _0x535d1c.onvolumechange(_0x1e6a28({ - 'volume': _0x114490, - 'threshold': _0x4f35b0 - }, _0x240dfe)); - } - }); - } - } - }(_0x51c1c9, _0x51c1c9.streamEvents[_0x399d43.streamid]), _0x57b754(_0x51c1c9, _0x51c1c9.streamEvents[_0x399d43.streamid]), _0x51c1c9.onstream(_0x51c1c9.streamEvents[_0x399d43.streamid]); - } catch (_0x459936) {} - _0x84fca0(); - }, _0x51c1c9); - } - }, _0x21b268.onGettingRemoteMedia = function(_0x54dff5, _0x2bab67) { - try { - _0x54dff5.type = 'remote'; - } catch (_0x2b68f0) {} - _0x51c1c9.setStreamEndHandler(_0x54dff5, 'remote-stream'), _0x412d65(_0x54dff5, function(_0x291e4f) { - _0x291e4f.id = _0x54dff5.streamid, void 0x0 !== _0x25e82e && _0x25e82e.setHandlers(_0x54dff5, !0x1, _0x51c1c9), _0x51c1c9.streamEvents[_0x54dff5.streamid] = { - 'stream': _0x54dff5, - 'type': 'remote', - 'userid': _0x2bab67, - 'extra': _0x51c1c9.peers[_0x2bab67] ? _0x51c1c9.peers[_0x2bab67].extra : {}, - 'mediaElement': _0x291e4f, - 'streamid': _0x54dff5.streamid - }, _0x57b754(_0x51c1c9, _0x51c1c9.streamEvents[_0x54dff5.streamid]), _0x51c1c9.onstream(_0x51c1c9.streamEvents[_0x54dff5.streamid]); - }, _0x51c1c9); - }, _0x21b268.onRemovingRemoteMedia = function(_0x5e7396, _0x1a735c) { - var _0x21b268 = _0x51c1c9.streamEvents[_0x5e7396.streamid]; - _0x21b268 || (_0x21b268 = { - 'stream': _0x5e7396, - 'type': 'remote', - 'userid': _0x1a735c, - 'extra': _0x51c1c9.peers[_0x1a735c] ? _0x51c1c9.peers[_0x1a735c].extra : {}, - 'streamid': _0x5e7396.streamid, - 'mediaElement': _0x51c1c9.streamEvents[_0x5e7396.streamid] ? _0x51c1c9.streamEvents[_0x5e7396.streamid].mediaElement : null - }), _0x51c1c9.peersBackup[_0x21b268.userid] && (_0x21b268.extra = _0x51c1c9.peersBackup[_0x21b268.userid].extra), _0x51c1c9.onstreamended(_0x21b268), delete _0x51c1c9.streamEvents[_0x5e7396.streamid]; - }, _0x21b268.onNegotiationNeeded = function(_0x2d936f, _0x4e2d94, _0x5d7bb5) { - _0x5d7bb5 = _0x5d7bb5 || function() {}; - var _0x521a09 = { - 'remoteUserId': _0x4e2d94 = _0x4e2d94 || _0x2d936f.remoteUserId, - 'message': _0x2d936f = _0x2d936f || '', - 'sender': _0x51c1c9.userid - }; - _0x2d936f.remoteUserId && _0x2d936f.message && _0x2d936f.sender && (_0x521a09 = _0x2d936f), _0x2db9d8(function() { - _0x51c1c9.socket.emit(_0x51c1c9.socketMessageEvent, _0x521a09, _0x5d7bb5); - }); - }, _0x21b268.onUserLeft = function(_0x76e281) { - _0x51c1c9.deletePeer(_0x76e281); - }, _0x21b268.disconnectWith = function(_0x88879c, _0x323747) { - _0x51c1c9.socket && _0x51c1c9.socket.emit('disconnect-with', _0x88879c, _0x323747 || function() {}), _0x51c1c9.deletePeer(_0x88879c); - }, _0x51c1c9.socketOptions = { - 'transport': 'polling' - }, _0x51c1c9.openOrJoin = function(_0x66fc69, _0xba3fb1) { - _0xba3fb1 = _0xba3fb1 || function() {}, _0x51c1c9.checkPresence(_0x66fc69, function(_0x1c5cec, _0x207cb3) { - if (_0x1c5cec) { - _0x51c1c9.sessionid = _0x207cb3; - var _0x521a09, _0x429662, _0x22a5af = !!_0x51c1c9.session.oneway, - _0x5851c5 = _0x5deab2(_0x51c1c9.session); - _0x429662 = { - 'OfferToReceiveAudio': _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveVideo - }, _0x521a09 = { - 'OfferToReceiveAudio': _0x22a5af ? !!_0x51c1c9.session.audio : _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0x22a5af ? !!_0x51c1c9.session.video || !!_0x51c1c9.session.screen : _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveVideo - }; - var _0x3fb79d = { - 'remoteUserId': _0x51c1c9.sessionid, - 'message': { - 'newParticipationRequest': true, - 'isOneWay': _0x22a5af, - 'isDataOnly': _0x5851c5, - 'localPeerSdpConstraints': _0x521a09, - 'remotePeerSdpConstraints': _0x429662 - }, - 'sender': _0x51c1c9.userid - }; - _0x373dce(_0x3fb79d.message, function() { - _0x6a70ac(_0x3fb79d, _0xba3fb1); - }); - } else _0x51c1c9.waitingForLocalMedia = true, _0x51c1c9.isInitiator = true, _0x51c1c9.sessionid = _0x207cb3 || _0x51c1c9.sessionid, _0x5deab2(_0x51c1c9.session) ? _0x484896(_0xba3fb1) : _0x51c1c9.captureUserMedia(function() { - _0x484896(_0xba3fb1); - }); - }); - }, _0x51c1c9.waitingForLocalMedia = !0x1, _0x51c1c9.open = function(_0x572e80, _0x37b154) { - _0x37b154 = _0x37b154 || function() {}, _0x51c1c9.waitingForLocalMedia = true, _0x51c1c9.isInitiator = true, _0x51c1c9.sessionid = _0x572e80 || _0x51c1c9.sessionid, _0x2db9d8(function() { - _0x5deab2(_0x51c1c9.session) ? _0x484896(_0x37b154) : _0x51c1c9.captureUserMedia(function() { - _0x484896(_0x37b154); - }); - }); - }, _0x51c1c9.peersBackup = {}, _0x51c1c9.deletePeer = function(_0x31e4e4) { - if (_0x31e4e4 && _0x51c1c9.peers[_0x31e4e4]) { - var _0x326931 = { - 'userid': _0x31e4e4, - 'extra': _0x51c1c9.peers[_0x31e4e4] ? _0x51c1c9.peers[_0x31e4e4].extra : {} - }; - if (_0x51c1c9.peersBackup[_0x326931.userid] && (_0x326931.extra = _0x51c1c9.peersBackup[_0x326931.userid].extra), _0x51c1c9.onleave(_0x326931), _0x51c1c9.peers[_0x31e4e4]) { - _0x51c1c9.peers[_0x31e4e4].streams.forEach(function(_0x424150) { - _0x424150.stop(); - }); - var _0x21b268 = _0x51c1c9.peers[_0x31e4e4].peer; - if (_0x21b268 && 'closed' !== _0x21b268.iceConnectionState) try { - _0x21b268.close(); - } catch (_0x24b95f) {} - _0x51c1c9.peers[_0x31e4e4] && (_0x51c1c9.peers[_0x31e4e4].peer = null, delete _0x51c1c9.peers[_0x31e4e4]); - } - } - }, _0x51c1c9.rejoin = function(_0x22fd47) { - if (!_0x51c1c9.isInitiator && _0x22fd47 && Object.keys(_0x22fd47).length) { - var _0x326931 = {}; - _0x51c1c9.peers[_0x22fd47.remoteUserId] && (_0x326931 = _0x51c1c9.peers[_0x22fd47.remoteUserId].extra, _0x51c1c9.deletePeer(_0x22fd47.remoteUserId)), _0x22fd47 && _0x22fd47.remoteUserId && (_0x51c1c9.join(_0x22fd47.remoteUserId), _0x51c1c9.onReConnecting({ - 'userid': _0x22fd47.remoteUserId, - 'extra': _0x326931 - })); - } - }, _0x51c1c9.join = function(_0x4b656a, _0x35b82f) { - _0x51c1c9.sessionid = !!_0x4b656a && (_0x4b656a.sessionid || _0x4b656a.remoteUserId || _0x4b656a) || _0x51c1c9.sessionid, _0x51c1c9.sessionid += ''; - var _0x21b268 = !0x1, - _0x521a09 = !0x1, - _0x20e7ef = !0x1, - _0x4b614d = !0x1; - if (_0x4b656a && _0x4b656a.session || !_0x4b656a || 'string' == typeof _0x4b656a) { - var _0x447147 = _0x4b656a && _0x4b656a.session || _0x51c1c9.session; - _0x20e7ef = !!_0x447147.oneway, _0x4b614d = _0x5deab2(_0x447147), _0x521a09 = { - 'OfferToReceiveAudio': _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveVideo - }, _0x21b268 = { - 'OfferToReceiveAudio': _0x20e7ef ? !!_0x51c1c9.session.audio : _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveAudio, - 'OfferToReceiveVideo': _0x20e7ef ? !!_0x51c1c9.session.video || !!_0x51c1c9.session.screen : _0x51c1c9.sdpConstraints.mandatory.OfferToReceiveVideo - }; - } - var _0x13518b = function() {}; - 'function' == typeof(_0x35b82f = _0x35b82f || {}) && (_0x13518b = _0x35b82f, _0x35b82f = {}), void 0x0 !== _0x35b82f.localPeerSdpConstraints && (_0x21b268 = _0x35b82f.localPeerSdpConstraints), void 0x0 !== _0x35b82f.remotePeerSdpConstraints && (_0x521a09 = _0x35b82f.remotePeerSdpConstraints), void 0x0 !== _0x35b82f.isOneWay && (_0x20e7ef = _0x35b82f.isOneWay), void 0x0 !== _0x35b82f.isDataOnly && (_0x4b614d = _0x35b82f.isDataOnly); - var _0xcceebc = { - 'remoteUserId': _0x51c1c9.sessionid, - 'message': { - 'newParticipationRequest': true, - 'isOneWay': _0x20e7ef, - 'isDataOnly': _0x4b614d, - 'localPeerSdpConstraints': _0x21b268, - 'remotePeerSdpConstraints': _0x521a09 - }, - 'sender': _0x51c1c9.userid - }; - return _0x373dce(_0xcceebc.message, function() { - _0x2db9d8(function() { - _0x6a70ac(_0xcceebc, _0x13518b); - }); - }), _0xcceebc; - }, _0x51c1c9.publicRoomIdentifier = '', _0x51c1c9.getUserMedia = _0x51c1c9.captureUserMedia = function(_0x3ae868, _0x4adbb1) { - _0x3ae868 = _0x3ae868 || function() {}; - var _0x521a09 = _0x4adbb1 || _0x51c1c9.session; - _0x51c1c9.dontCaptureUserMedia || _0x5deab2(_0x521a09) ? _0x3ae868() : (_0x521a09.audio || _0x521a09.video || _0x521a09.screen) && (_0x521a09.screen ? 'Edge' === DetectRTC.browser.name ? navigator.getDisplayMedia({ - 'video': true, - 'audio': _0x93df62(_0x51c1c9) - }).then(function(_0x31597a) { - if (_0x31597a.isScreen = true, _0x21b268.onGettingLocalMedia(_0x31597a), !_0x521a09.audio && !_0x521a09.video || _0x93df62(_0x51c1c9)) _0x3ae868(_0x31597a); - else { - var _0x76c694 = {}; - for (var _0x1bab2d in _0x521a09) 'screen' !== _0x1bab2d && (_0x76c694[_0x1bab2d] = _0x521a09[_0x1bab2d]); - _0x51c1c9.invokeGetUserMedia(_0x4adbb1, _0x3ae868, _0x76c694); - } - }, function(_0x286f92) { - console.error('Unable to capture screen on Edge. HTTPs and version 17+ is required.'); - }) : _0x51c1c9.getScreenConstraints(function(_0x33fd74, _0x4af197) { - if (_0x33fd74) throw _0x33fd74; - _0x51c1c9.invokeGetUserMedia({ - 'audio': !!_0x93df62(_0x51c1c9) && _0x405170(_0x4af197), - 'video': _0x4af197, - 'isScreen': true - }, function(_0x295451) { - if (!_0x521a09.audio && !_0x521a09.video || _0x93df62(_0x51c1c9)) _0x3ae868(_0x295451); - else { - var _0x4af197 = {}; - for (var _0x3fbf75 in _0x521a09) 'screen' !== _0x3fbf75 && (_0x4af197[_0x3fbf75] = _0x521a09[_0x3fbf75]); - _0x51c1c9.invokeGetUserMedia(_0x4adbb1, _0x3ae868, _0x4af197); - } - }); - }) : (_0x521a09.audio || _0x521a09.video) && _0x51c1c9.invokeGetUserMedia(_0x4adbb1, _0x3ae868, _0x521a09)); - }, _0x51c1c9.onbeforeunload = function(_0x403853, _0xcfe5cf) { - _0x51c1c9.closeBeforeUnload && (_0x51c1c9.peers.getAllParticipants().forEach(function(_0x135225) { - _0x21b268.onNegotiationNeeded({ - 'userLeft': true - }, _0x135225), _0x51c1c9.peers[_0x135225] && _0x51c1c9.peers[_0x135225].peer && _0x51c1c9.peers[_0x135225].peer.close(), delete _0x51c1c9.peers[_0x135225]; - }), _0xcfe5cf || _0x51c1c9.closeSocket(), _0x51c1c9.isInitiator = !0x1); - }, window.ignoreBeforeUnload ? _0x51c1c9.closeBeforeUnload = !0x1 : (_0x51c1c9.closeBeforeUnload = true, window.addEventListener('beforeunload', _0x51c1c9.onbeforeunload, !0x1)), _0x51c1c9.userid = _0x5b8d5d(), _0x51c1c9.changeUserId = function(_0x305ce9, _0x4c71e8) { - _0x4c71e8 = _0x4c71e8 || function() {}, _0x51c1c9.userid = _0x305ce9 || _0x5b8d5d(), _0x51c1c9.socket.emit('changed-uuid', _0x51c1c9.userid, _0x4c71e8); - }, _0x51c1c9.extra = {}, _0x51c1c9.attachStreams = [], _0x51c1c9.session = { - 'audio': true, - 'video': true - }, _0x51c1c9.enableFileSharing = !0x1, _0x51c1c9.bandwidth = { - 'screen': !0x1, - 'audio': !0x1, - 'video': !0x1 - }, _0x51c1c9.codecs = { - 'audio': 'opus', - 'video': 'VP9' - }, _0x51c1c9.processSdp = function(_0xec5090) { - return _0x5407aa() ? _0xec5090 : 'Safari' === DetectRTC.browser.name ? _0xec5090 : ('VP8' === _0x51c1c9.codecs.video.toUpperCase() && (_0xec5090 = _0x42fdaa.preferCodec(_0xec5090, 'vp8')), 'VP9' === _0x51c1c9.codecs.video.toUpperCase() && (_0xec5090 = _0x42fdaa.preferCodec(_0xec5090, 'vp9')), 'H264' === _0x51c1c9.codecs.video.toUpperCase() && (_0xec5090 = _0x42fdaa.preferCodec(_0xec5090, 'h264')), 'G722' === _0x51c1c9.codecs.audio && (_0xec5090 = _0x42fdaa.removeNonG722(_0xec5090)), 'Firefox' === DetectRTC.browser.name ? _0xec5090 : ((_0x51c1c9.bandwidth.video || _0x51c1c9.bandwidth.screen) && (_0xec5090 = _0x42fdaa.setApplicationSpecificBandwidth(_0xec5090, _0x51c1c9.bandwidth, !!_0x51c1c9.session.screen)), _0x51c1c9.bandwidth.video && (_0xec5090 = _0x42fdaa.setVideoBitrates(_0xec5090, { - 'min': 0x8 * _0x51c1c9.bandwidth.video * 0x400, - 'max': 0x8 * _0x51c1c9.bandwidth.video * 0x400 - })), _0x51c1c9.bandwidth.audio && (_0xec5090 = _0x42fdaa.setOpusAttributes(_0xec5090, { - 'maxaveragebitrate': 0x8 * _0x51c1c9.bandwidth.audio * 0x400, - 'maxplaybackrate': 0x8 * _0x51c1c9.bandwidth.audio * 0x400, - 'stereo': 0x1, - 'maxptime': 0x3 - })), _0xec5090)); - }, void 0x0 !== _0x42fdaa && (_0x51c1c9.BandwidthHandler = _0x51c1c9.CodecsHandler = _0x42fdaa), _0x51c1c9.mediaConstraints = { - 'audio': { - 'mandatory': {}, - 'optional': _0x51c1c9.bandwidth.audio ? [{ - 'bandwidth': 0x8 * _0x51c1c9.bandwidth.audio * 0x400 || 0x100000 - }] : [] - }, - 'video': { - 'mandatory': {}, - 'optional': _0x51c1c9.bandwidth.video ? [{ - 'bandwidth': 0x8 * _0x51c1c9.bandwidth.video * 0x400 || 0x100000 - }, { - 'facingMode': 'user' - }] : [{ - 'facingMode': 'user' - }] - } - }, 'Firefox' === DetectRTC.browser.name && (_0x51c1c9.mediaConstraints = { - 'audio': true, - 'video': true - }), _0x326931.useDefaultDevices || DetectRTC.isMobileDevice || DetectRTC.load(function() { - var _0x1056a5, _0x326931; - if (DetectRTC.MediaDevices.forEach(function(_0x1e1549) { - 'audioinput' === _0x1e1549.kind && !0x1 !== _0x51c1c9.mediaConstraints.audio && (_0x1056a5 = _0x1e1549), 'videoinput' === _0x1e1549.kind && !0x1 !== _0x51c1c9.mediaConstraints.video && (_0x326931 = _0x1e1549); - }), _0x1056a5) { - if ('Firefox' === DetectRTC.browser.name) return void(true !== _0x51c1c9.mediaConstraints.audio ? _0x51c1c9.mediaConstraints.audio.deviceId = _0x1056a5.id : _0x51c1c9.mediaConstraints.audio = { - 'deviceId': _0x1056a5.id - }); - 0x1 == _0x51c1c9.mediaConstraints.audio && (_0x51c1c9.mediaConstraints.audio = { - 'mandatory': {}, - 'optional': [] - }), _0x51c1c9.mediaConstraints.audio.optional || (_0x51c1c9.mediaConstraints.audio.optional = []); - var _0x21b268 = [{ - 'sourceId': _0x1056a5.id - }]; - _0x51c1c9.mediaConstraints.audio.optional = _0x21b268.concat(_0x51c1c9.mediaConstraints.audio.optional); - } - if (_0x326931) { - if ('Firefox' === DetectRTC.browser.name) return void(true !== _0x51c1c9.mediaConstraints.video ? _0x51c1c9.mediaConstraints.video.deviceId = _0x326931.id : _0x51c1c9.mediaConstraints.video = { - 'deviceId': _0x326931.id - }); - 0x1 == _0x51c1c9.mediaConstraints.video && (_0x51c1c9.mediaConstraints.video = { - 'mandatory': {}, - 'optional': [] - }), _0x51c1c9.mediaConstraints.video.optional || (_0x51c1c9.mediaConstraints.video.optional = []); - _0x21b268 = [{ - 'sourceId': _0x326931.id - }]; - _0x51c1c9.mediaConstraints.video.optional = _0x21b268.concat(_0x51c1c9.mediaConstraints.video.optional); - } - }), _0x51c1c9.sdpConstraints = { - 'mandatory': { - 'OfferToReceiveAudio': true, - 'OfferToReceiveVideo': true - }, - 'optional': [{ - 'VoiceActivityDetection': !0x1 - }] - }, _0x51c1c9.sdpSemantics = null, _0x51c1c9.iceCandidatePoolSize = null, _0x51c1c9.bundlePolicy = null, _0x51c1c9.rtcpMuxPolicy = null, _0x51c1c9.iceTransportPolicy = null, _0x51c1c9.optionalArgument = { - 'optional': [{ - 'DtlsSrtpKeyAgreement': true - }, { - 'googImprovedWifiBwe': true - }, { - 'googScreencastMinBitrate': 0x12c - }, { - 'googIPv6': true - }, { - 'googDscp': true - }, { - 'googCpuUnderuseThreshold': 0x37 - }, { - 'googCpuOveruseThreshold': 0x55 - }, { - 'googSuspendBelowMinBitrate': true - }, { - 'googCpuOveruseDetection': true - }], - 'mandatory': {} - }, _0x51c1c9.iceServers = _0x3b9609.getIceServers(_0x51c1c9), _0x51c1c9.candidates = { - 'host': true, - 'stun': true, - 'turn': true - }, _0x51c1c9.iceProtocols = { - 'tcp': true, - 'udp': true - }, _0x51c1c9.onopen = function(_0x44d923) { - _0x51c1c9.enableLogs && console.info('Data connection has been opened between you & ', _0x44d923.userid); - }, _0x51c1c9.onclose = function(_0x4bc33b) { - _0x51c1c9.enableLogs && console.warn('Data connection has been closed between you & ', _0x4bc33b.userid); - }, _0x51c1c9.onerror = function(_0x119131) { - _0x51c1c9.enableLogs && console.error(_0x119131.userid, 'data-error', _0x119131); - }, _0x51c1c9.onmessage = function(_0x377929) { - _0x51c1c9.enableLogs && console.debug('data-message', _0x377929.userid, _0x377929.data); - }, _0x51c1c9.send = function(_0x21e29b, _0x2e0c9a) { - _0x51c1c9.peers.send(_0x21e29b, _0x2e0c9a); - }, _0x51c1c9.close = _0x51c1c9.disconnect = _0x51c1c9.leave = function() { - _0x51c1c9.onbeforeunload(!0x1, true); - }, _0x51c1c9.closeEntireSession = function(_0x5971f7) { - _0x5971f7 = _0x5971f7 || function() {}, _0x51c1c9.socket.emit('close-entire-session', function _0x326931() { - _0x51c1c9.getAllParticipants().length ? setTimeout(_0x326931, 0x64) : (_0x51c1c9.onEntireSessionClosed({ - 'sessionid': _0x51c1c9.sessionid, - 'userid': _0x51c1c9.userid, - 'extra': _0x51c1c9.extra - }), _0x51c1c9.changeUserId(null, function() { - _0x51c1c9.close(), _0x5971f7(); - })); - }); - }, _0x51c1c9.onEntireSessionClosed = function(_0x308fc8) { - _0x51c1c9.enableLogs && console.info('Entire session is closed: ', _0x308fc8.sessionid, _0x308fc8.extra); - }, _0x51c1c9.onstream = function(_0x2795c9) { - var _0x326931 = _0x51c1c9.videosContainer; - _0x326931.insertBefore(_0x2795c9.mediaElement, _0x326931.firstChild); - var _0x21b268 = _0x2795c9.mediaElement.play(); - void 0x0 === _0x21b268 ? setTimeout(function() { - _0x2795c9.mediaElement.play(); - }, 0x7d0) : _0x21b268.catch(function() {}).then(function() { - setTimeout(function() { - _0x2795c9.mediaElement.play(); - }, 0x7d0); - }); - }, _0x51c1c9.onstreamended = function(_0x22b684) { - _0x22b684.mediaElement || (_0x22b684.mediaElement = document.getElementById(_0x22b684.streamid)), _0x22b684.mediaElement && _0x22b684.mediaElement.parentNode && _0x22b684.mediaElement.parentNode.removeChild(_0x22b684.mediaElement); - }, _0x51c1c9.direction = 'many-to-many', _0x51c1c9.removeStream = function(_0x5af7be, _0x17537a) { - var _0x21b268; - _0x51c1c9.attachStreams.forEach(function(_0xc4fbb0) { - _0xc4fbb0.id === _0x5af7be && (_0x21b268 = _0xc4fbb0); - }), _0x21b268 ? (_0x51c1c9.peers.getAllParticipants().forEach(function(_0x2bd479) { - if (!_0x17537a || _0x2bd479 === _0x17537a) { - var _0x521a09 = _0x51c1c9.peers[_0x2bd479]; - try { - _0x521a09.peer.removeStream(_0x21b268); - } catch (_0x159ea4) {} - } - }), _0x51c1c9.renegotiate()) : console.warn('No such stream exist.', _0x5af7be); - }, _0x51c1c9.addStream = function(_0x44d589, _0x5d1f28) { - if (_0x44d589.getTracks) return -0x1 === _0x51c1c9.attachStreams.indexOf(_0x44d589) && (_0x44d589.streamid || (_0x44d589.streamid = _0x44d589.id), _0x51c1c9.attachStreams.push(_0x44d589)), void _0x51c1c9.renegotiate(_0x5d1f28); - - function _0x5a47df(_0x4cd18b) { - _0x44d589.streamCallback && _0x44d589.streamCallback(_0x4cd18b), _0x51c1c9.renegotiate(_0x5d1f28); - } - _0x5deab2(_0x44d589) ? _0x51c1c9.renegotiate(_0x5d1f28) : (_0x44d589.audio || _0x44d589.video || _0x44d589.screen) && (_0x44d589.screen ? 'Edge' === DetectRTC.browser.name ? navigator.getDisplayMedia({ - 'video': true, - 'audio': _0x93df62(_0x51c1c9) - }).then(function(_0x3bef4d) { - _0x3bef4d.isScreen = true, _0x21b268.onGettingLocalMedia(_0x3bef4d), !_0x44d589.audio && !_0x44d589.video || _0x93df62(_0x51c1c9) ? _0x5a47df(_0x3bef4d) : _0x51c1c9.invokeGetUserMedia(null, function(_0x108d5e) { - _0x5a47df(_0x108d5e); - }); - }, function(_0x107d05) { - console.error('Unable to capture screen on Edge. HTTPs and version 17+ is required.'); - }) : _0x51c1c9.getScreenConstraints(function(_0x247e33, _0x20dba5) { - if (_0x247e33) return 'PermissionDeniedError' === _0x247e33 ? (_0x44d589.streamCallback && _0x44d589.streamCallback(null), void(_0x51c1c9.enableLogs && console.error('User rejected to share his screen.'))) : alert(_0x247e33); - _0x51c1c9.invokeGetUserMedia({ - 'audio': !!_0x93df62(_0x51c1c9) && _0x405170(_0x20dba5), - 'video': _0x20dba5, - 'isScreen': true - }, function(_0x3558fb) { - !_0x44d589.audio && !_0x44d589.video || _0x93df62(_0x51c1c9) ? _0x5a47df(_0x3558fb) : _0x51c1c9.invokeGetUserMedia(null, function(_0x301cff) { - _0x5a47df(_0x301cff); - }); - }); - }) : (_0x44d589.audio || _0x44d589.video) && _0x51c1c9.invokeGetUserMedia(null, _0x5a47df)); - }, _0x51c1c9.invokeGetUserMedia = function(_0x39db84, _0x4c2007, _0x587a84) { - _0x587a84 || (_0x587a84 = _0x51c1c9.session), _0x39db84 || (_0x39db84 = _0x51c1c9.mediaConstraints), _0x5adfda({ - 'onGettingLocalMedia': function(_0x4608af) { - var _0x587a84 = _0x39db84.video; - _0x587a84 && (_0x587a84.mediaSource || _0x587a84.mozMediaSource ? _0x4608af.isScreen = true : _0x587a84.mandatory && _0x587a84.mandatory.chromeMediaSource && (_0x4608af.isScreen = true)), _0x4608af.isScreen || (_0x4608af.isVideo = !!_0x2cbba5(_0x4608af, 'video').length, _0x4608af.isAudio = !_0x4608af.isVideo && _0x2cbba5(_0x4608af, 'audio').length), _0x21b268.onGettingLocalMedia(_0x4608af, function() { - 'function' == typeof _0x4c2007 && _0x4c2007(_0x4608af); - }); - }, - 'onLocalMediaError': function(_0x290ef1, _0x3a75f5) { - _0x21b268.onLocalMediaError(_0x290ef1, _0x3a75f5); - }, - 'localMediaConstraints': _0x39db84 || { - 'audio': !!_0x587a84.audio && _0x39db84.audio, - 'video': !!_0x587a84.video && _0x39db84.video - } - }); - }, _0x51c1c9.applyConstraints = function(_0x314dfa, _0x295b4a) { - if (_0x1d01b4 && _0x1d01b4.prototype.applyConstraints) { - var _0x21b268; - if (_0x295b4a) return _0x51c1c9.streamEvents[_0x295b4a] && (_0x21b268 = _0x51c1c9.streamEvents[_0x295b4a].stream), void _0x2559f7(_0x21b268, _0x314dfa); - _0x51c1c9.attachStreams.forEach(function(_0x4e7a56) { - _0x2559f7(_0x4e7a56, _0x314dfa); - }); - } else alert('track.applyConstraints is NOT supported in your browser.'); - }, _0x51c1c9.replaceTrack = function(_0x3642cb, _0xd04c26, _0x485038) { - if (_0x3642cb = _0x3642cb || {}, _0x2a4be1.prototype.getSenders) - if (_0x3642cb instanceof _0x1d01b4) _0x44cd42(_0x3642cb, _0xd04c26, _0x485038); - else { - if (_0x3642cb instanceof _0x1d809b) return _0x2cbba5(_0x3642cb, 'video').length && _0x44cd42(_0x2cbba5(_0x3642cb, 'video')[0x0], _0xd04c26, true), void(_0x2cbba5(_0x3642cb, 'audio').length && _0x44cd42(_0x2cbba5(_0x3642cb, 'audio')[0x0], _0xd04c26, !0x1)); - if (_0x5deab2(_0x3642cb)) throw 'connection.replaceTrack requires audio and/or video and/or screen.'; - (_0x3642cb.audio || _0x3642cb.video || _0x3642cb.screen) && (_0x3642cb.screen ? 'Edge' === DetectRTC.browser.name ? navigator.getDisplayMedia({ - 'video': true, - 'audio': _0x93df62(_0x51c1c9) - }).then(function(_0x675faf) { - _0x675faf.isScreen = true, _0x21b268.onGettingLocalMedia(_0x675faf), !_0x3642cb.audio && !_0x3642cb.video || _0x93df62(_0x51c1c9) ? _0x564a08(_0x675faf) : _0x51c1c9.invokeGetUserMedia(null, _0x564a08); - }, function(_0x4219c9) { - console.error('Unable to capture screen on Edge. HTTPs and version 17+ is required.'); - }) : _0x51c1c9.getScreenConstraints(function(_0x38cb24, _0x2fa66e) { - if (_0x38cb24) return alert(_0x38cb24); - _0x51c1c9.invokeGetUserMedia({ - 'audio': !!_0x93df62(_0x51c1c9) && _0x405170(_0x2fa66e), - 'video': _0x2fa66e, - 'isScreen': true - }, !_0x3642cb.audio && !_0x3642cb.video || _0x93df62(_0x51c1c9) ? _0x564a08 : _0x51c1c9.invokeGetUserMedia(null, _0x564a08)); - }) : (_0x3642cb.audio || _0x3642cb.video) && _0x51c1c9.invokeGetUserMedia(null, _0x564a08)); - } - else _0x51c1c9.addStream(_0x3642cb); - - function _0x564a08(_0x547ff0) { - _0x51c1c9.replaceTrack(_0x547ff0, _0xd04c26, _0x485038 || _0x3642cb.video || _0x3642cb.screen); - } - }, _0x51c1c9.resetTrack = function(_0x1215de, _0x3d0c09) { - _0x1215de || (_0x1215de = _0x51c1c9.getAllParticipants()), 'string' == typeof _0x1215de && (_0x1215de = [_0x1215de]), _0x1215de.forEach(function(_0x17e765) { - var _0x21b268 = _0x51c1c9.peers[_0x17e765].peer; - void 0x0 !== _0x3d0c09 && true !== _0x3d0c09 || !_0x21b268.lastVideoTrack || _0x51c1c9.replaceTrack(_0x21b268.lastVideoTrack, _0x17e765, true), void 0x0 !== _0x3d0c09 && !0x1 !== _0x3d0c09 || !_0x21b268.lastAudioTrack || _0x51c1c9.replaceTrack(_0x21b268.lastAudioTrack, _0x17e765, !0x1); - }); - }, _0x51c1c9.renegotiate = function(_0x2ea770) { - _0x2ea770 ? _0x21b268.renegotiatePeer(_0x2ea770) : _0x51c1c9.peers.getAllParticipants().forEach(function(_0x428915) { - _0x21b268.renegotiatePeer(_0x428915); - }); - }, _0x51c1c9.setStreamEndHandler = function(_0x46fab4, _0x3cea1b) { - if (_0x46fab4 && _0x46fab4.addEventListener && (_0x3cea1b = !!_0x3cea1b, !_0x46fab4.alreadySetEndHandler)) { - _0x46fab4.alreadySetEndHandler = true; - var _0x21b268 = 'ended'; - 'oninactive' in _0x46fab4 && (_0x21b268 = 'inactive'), _0x46fab4.addEventListener(_0x21b268, function() { - if (_0x46fab4.idInstance && currentUserMediaRequest.remove(_0x46fab4.idInstance), !_0x3cea1b) { - var _0x21b268 = []; - _0x51c1c9.attachStreams.forEach(function(_0x35d5da) { - _0x35d5da.id != _0x46fab4.id && _0x21b268.push(_0x35d5da); - }), _0x51c1c9.attachStreams = _0x21b268; - } - var _0x521a09 = _0x51c1c9.streamEvents[_0x46fab4.streamid]; - if (_0x521a09 || (_0x521a09 = { - 'stream': _0x46fab4, - 'streamid': _0x46fab4.streamid, - 'type': _0x3cea1b ? 'remote' : 'local', - 'userid': _0x51c1c9.userid, - 'extra': _0x51c1c9.extra, - 'mediaElement': _0x51c1c9.streamEvents[_0x46fab4.streamid] ? _0x51c1c9.streamEvents[_0x46fab4.streamid].mediaElement : null - }), _0x3cea1b && _0x51c1c9.peers[_0x521a09.userid]) { - var _0x38a800 = _0x51c1c9.peers[_0x521a09.userid].peer; - _0x21b268 = []; - _0x38a800.getRemoteStreams().forEach(function(_0x59d565) { - _0x59d565.id != _0x46fab4.id && _0x21b268.push(_0x59d565); - }), _0x51c1c9.peers[_0x521a09.userid].streams = _0x21b268; - } - _0x521a09.userid === _0x51c1c9.userid && 'remote' === _0x521a09.type || (_0x51c1c9.peersBackup[_0x521a09.userid] && (_0x521a09.extra = _0x51c1c9.peersBackup[_0x521a09.userid].extra), _0x51c1c9.onstreamended(_0x521a09), delete _0x51c1c9.streamEvents[_0x46fab4.streamid]); - }, !0x1); - } - }, _0x51c1c9.onMediaError = function(_0x77c67c, _0x3533b2) { - _0x51c1c9.enableLogs && console.error(_0x77c67c, _0x3533b2); - }, _0x51c1c9.autoCloseEntireSession = !0x1, _0x51c1c9.filesContainer = _0x51c1c9.videosContainer = document.body || document.documentElement, _0x51c1c9.isInitiator = !0x1, _0x51c1c9.shareFile = _0x21b268.shareFile, void 0x0 !== _0x2cf1f3 && _0x2cf1f3.handle(_0x51c1c9), void 0x0 !== _0x400337 && _0x400337.handle(_0x51c1c9), _0x51c1c9.token = _0x5b8d5d, _0x51c1c9.onNewParticipant = function(_0xeb9f65, _0xbff370) { - _0x51c1c9.acceptParticipationRequest(_0xeb9f65, _0xbff370); - }, _0x51c1c9.acceptParticipationRequest = function(_0xdc5fa8, _0x444726) { - _0x444726.successCallback && (_0x444726.successCallback(), delete _0x444726.successCallback), _0x21b268.createNewPeer(_0xdc5fa8, _0x444726); - }, void 0x0 !== _0x25e82e && (_0x51c1c9.StreamsHandler = _0x25e82e), _0x51c1c9.onleave = function(_0x256c0a) {}, _0x51c1c9.invokeSelectFileDialog = function(_0x54e1d5) { - var _0x326931 = new _0x2e28ea(); - _0x326931.accept = '*.*', _0x326931.selectSingleFile(_0x54e1d5); - }, _0x51c1c9.onmute = function(_0x4cea9f) { - if (_0x4cea9f && _0x4cea9f.mediaElement) - if ('both' === _0x4cea9f.muteType || 'video' === _0x4cea9f.muteType) { - _0x4cea9f.mediaElement.src = null; - var _0x326931 = _0x4cea9f.mediaElement.pause(); - void 0x0 !== _0x326931 ? _0x326931.then(function() { - _0x4cea9f.mediaElement.poster = _0x4cea9f.snapshot || 'https://cdn.webrtc-experiment.com/images/muted.png'; - }) : _0x4cea9f.mediaElement.poster = _0x4cea9f.snapshot || 'https://cdn.webrtc-experiment.com/images/muted.png'; - } else 'audio' === _0x4cea9f.muteType && (_0x4cea9f.mediaElement.muted = true); - }, _0x51c1c9.onunmute = function(_0x59c1a4) { - _0x59c1a4 && _0x59c1a4.mediaElement && _0x59c1a4.stream && ('both' === _0x59c1a4.unmuteType || 'video' === _0x59c1a4.unmuteType ? (_0x59c1a4.mediaElement.poster = null, _0x59c1a4.mediaElement.srcObject = _0x59c1a4.stream, _0x59c1a4.mediaElement.play()) : 'audio' === _0x59c1a4.unmuteType && (_0x59c1a4.mediaElement.muted = !0x1)); - }, _0x51c1c9.onExtraDataUpdated = function(_0x429b15) { - _0x429b15.status = 'online', _0x51c1c9.onUserStatusChanged(_0x429b15, true); - }, _0x51c1c9.getAllParticipants = function(_0x57626c) { - return _0x51c1c9.peers.getAllParticipants(_0x57626c); - }, void 0x0 !== _0x25e82e && (_0x25e82e.onSyncNeeded = function(_0x45be06, _0x6b0c44, _0xe6bdb1) { - _0x51c1c9.peers.getAllParticipants().forEach(function(_0x26b256) { - _0x21b268.onNegotiationNeeded({ - 'streamid': _0x45be06, - 'action': _0x6b0c44, - 'streamSyncNeeded': true, - 'type': _0xe6bdb1 || 'both' - }, _0x26b256); - }); - }), _0x51c1c9.connectSocket = function(_0x5d44b4) { - _0x2db9d8(_0x5d44b4); - }, _0x51c1c9.closeSocket = function() { - try { - _0x31267b.a.sockets = {}; - } catch (_0x3aa9a3) {} - _0x51c1c9.socket && ('function' == typeof _0x51c1c9.socket.disconnect && _0x51c1c9.socket.disconnect(), 'function' == typeof _0x51c1c9.socket.resetProps && _0x51c1c9.socket.resetProps(), _0x51c1c9.socket = null); - }, _0x51c1c9.getSocket = function(_0x456c98) { - return !_0x456c98 && _0x51c1c9.enableLogs && console.warn('getSocket.callback paramter is required.'), _0x456c98 = _0x456c98 || function() {}, _0x51c1c9.socket ? _0x456c98(_0x51c1c9.socket) : _0x2db9d8(function() { - _0x456c98(_0x51c1c9.socket); - }), _0x51c1c9.socket; - }, _0x51c1c9.getRemoteStreams = _0x21b268.getRemoteStreams; - var _0x521c36 = ['selectFirst', 'selectAll', 'forEach']; - if (_0x51c1c9.streamEvents = { - 'selectFirst': function(_0x38ce07) { - return _0x51c1c9.streamEvents.selectAll(_0x38ce07)[0x0]; - }, - 'selectAll': function(_0x4b13fa) { - _0x4b13fa || (_0x4b13fa = { - 'local': true, - 'remote': true, - 'isScreen': true, - 'isAudio': true, - 'isVideo': true - }), 'local' == _0x4b13fa && (_0x4b13fa = { - 'local': true - }), 'remote' == _0x4b13fa && (_0x4b13fa = { - 'remote': true - }), 'screen' == _0x4b13fa && (_0x4b13fa = { - 'isScreen': true - }), 'audio' == _0x4b13fa && (_0x4b13fa = { - 'isAudio': true - }), 'video' == _0x4b13fa && (_0x4b13fa = { - 'isVideo': true - }); - var _0x326931 = []; - return Object.keys(_0x51c1c9.streamEvents).forEach(function(_0x59aced) { - var _0x521a09 = _0x51c1c9.streamEvents[_0x59aced]; - if (-0x1 === _0x521c36.indexOf(_0x59aced)) { - var _0x293b8c = true; - _0x4b13fa.local && 'local' === _0x521a09.type && (_0x293b8c = !0x1), _0x4b13fa.remote && 'remote' === _0x521a09.type && (_0x293b8c = !0x1), _0x4b13fa.isScreen && _0x521a09.stream.isScreen && (_0x293b8c = !0x1), _0x4b13fa.isVideo && _0x521a09.stream.isVideo && (_0x293b8c = !0x1), _0x4b13fa.isAudio && _0x521a09.stream.isAudio && (_0x293b8c = !0x1), _0x4b13fa.userid && _0x521a09.userid === _0x4b13fa.userid && (_0x293b8c = !0x1), !0x1 === _0x293b8c && _0x326931.push(_0x521a09); - } - }), _0x326931; - } - }, _0x51c1c9.socketURL = '/', _0x51c1c9.socketMessageEvent = 'RTCMultiConnection-Message', _0x51c1c9.socketCustomEvent = 'RTCMultiConnection-Custom-Message', _0x51c1c9.DetectRTC = DetectRTC, _0x51c1c9.setCustomSocketEvent = function(_0x1a650b) { - _0x1a650b && (_0x51c1c9.socketCustomEvent = _0x1a650b), _0x51c1c9.socket && _0x51c1c9.socket.emit('set-custom-socket-event-listener', _0x51c1c9.socketCustomEvent); - }, _0x51c1c9.getNumberOfBroadcastViewers = function(_0x2acdba, _0x377d0c) { - _0x51c1c9.socket && _0x2acdba && _0x377d0c && _0x51c1c9.socket.emit('get-number-of-users-in-specific-broadcast', _0x2acdba, _0x377d0c); - }, _0x51c1c9.onNumberOfBroadcastViewersUpdated = function(_0x617e81) { - _0x51c1c9.enableLogs && _0x51c1c9.isInitiator && console.info('Number of broadcast (', _0x617e81.broadcastId, ') viewers', _0x617e81.numberOfBroadcastViewers); - }, _0x51c1c9.onUserStatusChanged = function(_0x49e25f, _0x405028) { - _0x51c1c9.enableLogs && !_0x405028 && console.info(_0x49e25f.userid, _0x49e25f.status); - }, _0x51c1c9.getUserMediaHandler = _0x5adfda, _0x51c1c9.multiPeersHandler = _0x21b268, _0x51c1c9.enableLogs = true, _0x51c1c9.setCustomSocketHandler = function(_0x5840b1) { - void 0x0 !== _0x45c30f && (_0x45c30f = _0x5840b1); - }, _0x51c1c9.chunkSize = 0x9c40, _0x51c1c9.maxParticipantsAllowed = 0x3e8, _0x51c1c9.disconnectWith = _0x21b268.disconnectWith, _0x51c1c9.checkPresence = function(_0x2c66c1, _0xdf4545) { - _0x2c66c1 = _0x2c66c1 || _0x51c1c9.sessionid, 'SSEConnection' !== _0x45c30f.name ? _0x51c1c9.socket ? _0x51c1c9.socket.emit('check-presence', _0x2c66c1 + '', function(_0x4d585b, _0xfb6315, _0x414b29) { - _0x51c1c9.enableLogs && console.log('checkPresence.isRoomExist: ', _0x4d585b, ' roomid: ', _0xfb6315), _0xdf4545(_0x4d585b, _0xfb6315, _0x414b29); - }) : _0x51c1c9.connectSocket(function() { - _0x51c1c9.checkPresence(_0x2c66c1, _0xdf4545); - }) : SSEConnection.checkPresence(_0x2c66c1, function(_0x2d2553, _0x169410, _0x48e686) { - if (!_0x51c1c9.socket) return _0x2d2553 || (_0x51c1c9.userid = _0x169410), void _0x51c1c9.connectSocket(function() { - _0xdf4545(_0x2d2553, _0x169410, _0x48e686); - }); - _0xdf4545(_0x2d2553, _0x169410); - }); - }, _0x51c1c9.onReadyForOffer = function(_0x3f207b, _0x32ccc2) { - _0x51c1c9.multiPeersHandler.createNewPeer(_0x3f207b, _0x32ccc2); - }, _0x51c1c9.setUserPreferences = function(_0x371937) { - return _0x51c1c9.dontAttachStream && (_0x371937.dontAttachLocalStream = true), _0x51c1c9.dontGetRemoteStream && (_0x371937.dontGetRemoteStream = true), _0x371937; - }, _0x51c1c9.updateExtraData = function() { - _0x51c1c9.socket.emit('extra-data-updated', _0x51c1c9.extra); - }, _0x51c1c9.enableScalableBroadcast = !0x1, _0x51c1c9.maxRelayLimitPerUser = 0x3, _0x51c1c9.dontCaptureUserMedia = !0x1, _0x51c1c9.dontAttachStream = !0x1, _0x51c1c9.dontGetRemoteStream = !0x1, _0x51c1c9.onReConnecting = function(_0x4ffc93) { - _0x51c1c9.enableLogs && console.info('ReConnecting with', _0x4ffc93.userid, '...'); - }, _0x51c1c9.beforeAddingStream = function(_0xdd57a4) { - return _0xdd57a4; - }, _0x51c1c9.beforeRemovingStream = function(_0x191d70) { - return _0x191d70; - }, _0x51c1c9.checkIfChromeExtensionAvailable = _0x53da88, 'undefined' != typeof isFirefoxExtensionAvailable && (_0x51c1c9.checkIfChromeExtensionAvailable = isFirefoxExtensionAvailable), _0x51c1c9.getChromeExtensionStatus = _0x1f670d, _0x51c1c9.getScreenConstraints = function(_0x3b0f5e, _0x32535a) { - _0x93df62(_0x51c1c9, _0x32535a) && (_0x32535a = true), _0x1c050b(function(_0x19ad7c, _0x5c7f16) { - _0x19ad7c || (_0x5c7f16 = _0x51c1c9.modifyScreenConstraints(_0x5c7f16), _0x3b0f5e(_0x19ad7c, _0x5c7f16)); - }, _0x32535a); - }, _0x51c1c9.modifyScreenConstraints = function(_0x13a10e) { - return _0x13a10e; - }, _0x51c1c9.onPeerStateChanged = function(_0x5d030a) { - _0x51c1c9.enableLogs && -0x1 !== _0x5d030a.iceConnectionState.search(/closed|failed/gi) && console.error('Peer connection is closed between you & ', _0x5d030a.userid, _0x5d030a.extra, 'state:', _0x5d030a.iceConnectionState); - }, _0x51c1c9.isOnline = true, _0x1cbceb('online', function() { - _0x51c1c9.isOnline = true; - }), _0x1cbceb('offline', function() { - _0x51c1c9.isOnline = !0x1; - }), _0x51c1c9.isLowBandwidth = !0x1, navigator && navigator.connection && navigator.connection.type && (_0x51c1c9.isLowBandwidth = -0x1 !== navigator.connection.type.toString().toLowerCase().search(/wifi|cell/g), _0x51c1c9.isLowBandwidth)) { - if (_0x51c1c9.bandwidth = { - 'audio': !0x1, - 'video': !0x1, - 'screen': !0x1 - }, _0x51c1c9.mediaConstraints.audio && _0x51c1c9.mediaConstraints.audio.optional && _0x51c1c9.mediaConstraints.audio.optional.length) { - var _0x4c7586 = []; - _0x51c1c9.mediaConstraints.audio.optional.forEach(function(_0x330c5b) { - void 0x0 === _0x330c5b.bandwidth && _0x4c7586.push(_0x330c5b); - }), _0x51c1c9.mediaConstraints.audio.optional = _0x4c7586; - } - if (_0x51c1c9.mediaConstraints.video && _0x51c1c9.mediaConstraints.video.optional && _0x51c1c9.mediaConstraints.video.optional.length) { - _0x4c7586 = []; - _0x51c1c9.mediaConstraints.video.optional.forEach(function(_0x427f57) { - void 0x0 === _0x427f57.bandwidth && _0x4c7586.push(_0x427f57); - }), _0x51c1c9.mediaConstraints.video.optional = _0x4c7586; - } - } - _0x51c1c9.getExtraData = function(_0xeb7d85, _0x11bbdf) { - if (!_0xeb7d85) throw 'remoteUserId is required.'; - if (!_0x11bbdf) return _0x51c1c9.peers[_0xeb7d85] ? _0x51c1c9.peers[_0xeb7d85].extra : _0x51c1c9.peersBackup[_0xeb7d85] ? _0x51c1c9.peersBackup[_0xeb7d85].extra : {}; - _0x51c1c9.socket.emit('get-remote-user-extra-data', _0xeb7d85, function(_0x2b3ef8, _0x272a14, _0x50b4c5) { - _0x11bbdf(_0x2b3ef8, _0x272a14, _0x50b4c5); - }); - }, _0x326931.autoOpenOrJoin && _0x51c1c9.openOrJoin(_0x51c1c9.sessionid), _0x51c1c9.onUserIdAlreadyTaken = function(_0x375333, _0x594a1c) { - _0x51c1c9.close(), _0x51c1c9.closeSocket(), _0x51c1c9.isInitiator = !0x1, _0x51c1c9.userid = _0x51c1c9.token(), _0x51c1c9.join(_0x51c1c9.sessionid), _0x51c1c9.enableLogs && console.warn('Userid already taken.', _0x375333, 'Your new userid:', _0x51c1c9.userid); - }, _0x51c1c9.trickleIce = true, _0x51c1c9.version = '3.6.5', _0x51c1c9.onSettingLocalDescription = function(_0x5cd808) { - _0x51c1c9.enableLogs && console.info('Set local description for remote user', _0x5cd808.userid); - }, _0x51c1c9.resetScreen = function() { - _0x427b66 = null, DetectRTC && DetectRTC.screen && delete DetectRTC.screen.sourceId, currentUserMediaRequest = { - 'streams': [], - 'mutex': !0x1, - 'queueRequests': [] - }; - }, _0x51c1c9.autoCreateMediaElement = true, _0x51c1c9.password = null, _0x51c1c9.setPassword = function(_0x3fec38, _0x196913) { - _0x196913 = _0x196913 || function() {}, _0x51c1c9.socket ? _0x51c1c9.socket.emit('set-password', _0x3fec38, _0x196913) : (_0x51c1c9.password = _0x3fec38, _0x196913(true, _0x51c1c9.sessionid, null)); - }, _0x51c1c9.errors = { - 'ROOM_NOT_AVAILABLE': 'Room not available', - 'INVALID_PASSWORD': 'Invalid password', - 'USERID_NOT_AVAILABLE': 'User ID does not exist', - 'ROOM_PERMISSION_DENIED': 'Room permission denied', - 'ROOM_FULL': 'Room full', - 'DID_NOT_JOIN_ANY_ROOM': 'Did not join any room yet', - 'INVALID_SOCKET': 'Invalid socket', - 'PUBLIC_IDENTIFIER_MISSING': 'publicRoomIdentifier is required', - 'INVALID_ADMIN_CREDENTIAL': 'Invalid username or password attempted' - }; - }(this); - }; - }.call(this, _0x2fa590(0x49).Buffer, _0x2fa590(0x1f), _0x2fa590(0x31))); + this.socket.send(JSON.stringify({ + type: "file-end", + name: file.name + })); + }) + } + updateExtraData() { + console.log(arguments); + } + } + module.exports = EJS_NETPLAY; }, window.EJS_main]).default; diff --git a/data/emulator.min.js b/data/emulator.min.js index c40b7b1..d20b38f 100644 --- a/data/emulator.min.js +++ b/data/emulator.min.js @@ -1 +1 @@ -var EJS=function(o){window.EJS_MODULES=o;var n={},i=[];function a(e){if(n[e])return n[e].exports;i.push(e);var t=n[e]={i:e,l:!1,exports:{}};return o[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}return window.getUsedModules=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){e.exports=class{gamepads;timeout;listeners;constructor(){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)throw new Error("Get gamepads not found!");if(!window.setTimeout)throw new Error("setTimeout was not found!");this.gamepads=[],this.listeners={},this.timeout=null,this.loop()}terminate(){window.clearTimeout(this.timeout)}getGamepads(){return navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]}loop(){this.updateGamepadState(),this.timeout=setTimeout(this.loop.bind(this),10)}updateGamepadState(){const o=this.getGamepads();o.forEach((a,n)=>{if(a){let t=!1;this.gamepads.forEach((i,e)=>{i.index===a.index&&(t=!0,i.axes.forEach((e,t)=>{if(a.axes[t]!==e){const e=function(){switch(t){case 0:return"LEFT_STICK_X";case 1:return"LEFT_STICK_Y";case 2:return"RIGHT_STICK_X";case 3:return"RIGHT_STICK_Y";default:return null}}();e&&this.dispatchEvent("axischanged",{axis:e,value:a.axes[t],index:a.index,gamepadIndex:a.index})}}),a.buttons.forEach((e,t)=>{let n=1===i.buttons[t],o=("object"==typeof i.buttons[t]&&(n=i.buttons[t].pressed),1===e);"object"==typeof e&&(o=e.pressed),n!==o&&(o?this.dispatchEvent("buttondown",{index:t,gamepadIndex:a.index}):this.dispatchEvent("buttonup",{index:t,gamepadIndex:a.index}))}),this.gamepads[e]=o[n])}),t||(this.gamepads.push(o[n]),this.dispatchEvent("connected",{gamepadIndex:a.index}))}});for(let 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=d.from(t,o)),d.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,u=n;u>>10&1023|55296),u=56320|1023&u),o.push(u),i+=d}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+=" ... "),""},d.prototype.compare=function(e,t,n,o,i){if(M(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.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),u=0;u>>=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,u=!1;;)switch(o){case"hex":var d=this,f=e,p=t,h=n,m=(p=Number(p)||0,d.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(u)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),u=!0}},d.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 _(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}d.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]},d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||l(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||l(e,2,this.length),this[e]<<8|this[e+1]},d.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]},d.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])},d.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},d.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},d.prototype.readInt8=function(e,t){return e>>>=0,t||l(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.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},d.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},d.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},d.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]},d.prototype.readFloatLE=function(e,t){return e>>>=0,t||l(e,4,this.length),a.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||l(e,4,this.length),a.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||l(e,8,this.length),a.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||l(e,8,this.length),a.read(this,e,!1,52,8)},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.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},d.prototype.writeFloatLE=function(e,t,n){return b(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return b(this,e,t,!1,n)},d.prototype.writeDoubleLE=function(e,t,n){return _(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return _(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,o){if(!d.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(w,"")).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 M(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function A(e){return e!=e}}.call(this)}.call(this,O("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,u=-7,d=n?i-1:0,f=n?-1:1,i=e[t+d];for(d+=f,a=i&(1<<-u)-1,i>>=-u,u+=s;0>=-u,u+=o;0>1,d=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+u?d/o:d*Math.pow(2,1-u))*o&&(r++,o/=2),l<=r+u?(s=0,r=l):1<=r+u?(s=(t*o-1)*Math.pow(2,i),r+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),r=0));8<=i;e[n+f]=255&s,f+=p,s/=256,i-=8);for(r=r<this.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