twitst4tz

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 83cb22751bbd9619f978829dc03c97b9a5d944ac
parent 2dbc6ecc80a7509df7828fa9d23805f12b36cf30
Author: underd0g <underd0g@underd0gs-MacBook-Air.local>
Date:   Fri, 24 Apr 2020 21:03:13 -0400

added callbacks / port change

Diffstat:
Mindex.js | 38++++++++++++++++++++------------------
Anode_modules/after/.npmignore | 2++
Anode_modules/after/.travis.yml | 12++++++++++++
Anode_modules/after/LICENCE | 20++++++++++++++++++++
Anode_modules/after/README.md | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/after/index.js | 28++++++++++++++++++++++++++++
Anode_modules/after/package.json | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/after/test/after-test.js | 120+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/arraybuffer.slice/.npmignore | 17+++++++++++++++++
Anode_modules/arraybuffer.slice/LICENCE | 18++++++++++++++++++
Anode_modules/arraybuffer.slice/Makefile | 8++++++++
Anode_modules/arraybuffer.slice/README.md | 17+++++++++++++++++
Anode_modules/arraybuffer.slice/index.js | 29+++++++++++++++++++++++++++++
Anode_modules/arraybuffer.slice/package.json | 44++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/arraybuffer.slice/test/slice-buffer.js | 227+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/async-limiter/.eslintignore | 3+++
Anode_modules/async-limiter/.nycrc | 11+++++++++++
Anode_modules/async-limiter/.travis.yml | 9+++++++++
Anode_modules/async-limiter/LICENSE | 8++++++++
Anode_modules/async-limiter/index.js | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/async-limiter/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/async-limiter/readme.md | 132+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/backo2/.npmignore | 1+
Anode_modules/backo2/History.md | 12++++++++++++
Anode_modules/backo2/Makefile | 9+++++++++
Anode_modules/backo2/Readme.md | 34++++++++++++++++++++++++++++++++++
Anode_modules/backo2/component.json | 11+++++++++++
Anode_modules/backo2/index.js | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/backo2/package.json | 47+++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/backo2/test/index.js | 19+++++++++++++++++++
Anode_modules/base64-arraybuffer/.npmignore | 3+++
Anode_modules/base64-arraybuffer/.travis.yml | 19+++++++++++++++++++
Anode_modules/base64-arraybuffer/LICENSE-MIT | 22++++++++++++++++++++++
Anode_modules/base64-arraybuffer/README.md | 20++++++++++++++++++++
Anode_modules/base64-arraybuffer/lib/base64-arraybuffer.js | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/base64-arraybuffer/package.json | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/base64id/CHANGELOG.md | 16++++++++++++++++
Anode_modules/base64id/LICENSE | 22++++++++++++++++++++++
Anode_modules/base64id/README.md | 18++++++++++++++++++
Anode_modules/base64id/lib/base64id.js | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/base64id/package.json | 47+++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/better-assert/.npmignore | 4++++
Anode_modules/better-assert/History.md | 15+++++++++++++++
Anode_modules/better-assert/Makefile | 6++++++
Anode_modules/better-assert/Readme.md | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/better-assert/example.js | 11+++++++++++
Anode_modules/better-assert/index.js | 38++++++++++++++++++++++++++++++++++++++
Anode_modules/better-assert/package.json | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/blob/.idea/blob.iml | 13+++++++++++++
Anode_modules/blob/.idea/inspectionProfiles/profiles_settings.xml | 6++++++
Anode_modules/blob/.idea/markdown-navigator.xml | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/blob/.idea/markdown-navigator/profiles_settings.xml | 4++++
Anode_modules/blob/.idea/modules.xml | 9+++++++++
Anode_modules/blob/.idea/vcs.xml | 7+++++++
Anode_modules/blob/.idea/workspace.xml | 391+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/blob/.zuul.yml | 14++++++++++++++
Anode_modules/blob/LICENSE | 21+++++++++++++++++++++
Anode_modules/blob/Makefile | 14++++++++++++++
Anode_modules/blob/README.md | 21+++++++++++++++++++++
Anode_modules/blob/component.json | 11+++++++++++
Anode_modules/blob/index.js | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/blob/package.json | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/blob/test/index.js | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/callsite/.npmignore | 4++++
Anode_modules/callsite/History.md | 10++++++++++
Anode_modules/callsite/Makefile | 7+++++++
Anode_modules/callsite/Readme.md | 44++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/callsite/index.js | 10++++++++++
Anode_modules/callsite/package.json | 48++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-bind/.npmignore | 4++++
Anode_modules/component-bind/History.md | 13+++++++++++++
Anode_modules/component-bind/Makefile | 8++++++++
Anode_modules/component-bind/Readme.md | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-bind/component.json | 13+++++++++++++
Anode_modules/component-bind/index.js | 23+++++++++++++++++++++++
Anode_modules/component-bind/package.json | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-emitter/History.md | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-emitter/LICENSE | 24++++++++++++++++++++++++
Anode_modules/component-emitter/Readme.md | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-emitter/index.js | 163+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-emitter/package.json | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-inherit/.npmignore | 3+++
Anode_modules/component-inherit/History.md | 5+++++
Anode_modules/component-inherit/Makefile | 16++++++++++++++++
Anode_modules/component-inherit/Readme.md | 24++++++++++++++++++++++++
Anode_modules/component-inherit/component.json | 10++++++++++
Anode_modules/component-inherit/index.js | 8++++++++
Anode_modules/component-inherit/package.json | 48++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/component-inherit/test/inherit.js | 22++++++++++++++++++++++
Anode_modules/ejs/LICENSE | 202+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/README.md | 273+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/ejs.js | 1532+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/ejs.min.js | 1+
Anode_modules/ejs/jakefile.js | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/lib/ejs.js | 904+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/lib/utils.js | 167+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ejs/postinstall.js | 17+++++++++++++++++
Anode_modules/engine.io-client/CHANGELOG.md | 9+++++++++
Anode_modules/engine.io-client/LICENSE | 22++++++++++++++++++++++
Anode_modules/engine.io-client/README.md | 300+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/engine.io.js | 4717+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/globalThis.browser.js | 9+++++++++
Anode_modules/engine.io-client/lib/globalThis.js | 1+
Anode_modules/engine.io-client/lib/index.js | 10++++++++++
Anode_modules/engine.io-client/lib/socket.js | 748+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/transport.js | 161+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/transports/index.js | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/transports/polling-jsonp.js | 230+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/transports/polling-xhr.js | 418+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/transports/polling.js | 245+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/transports/websocket.js | 295+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/lib/xmlhttprequest.js | 38++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/CHANGELOG.md | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/LICENSE | 19+++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/README.md | 455+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/dist/debug.js | 912+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/package.json | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/src/browser.js | 264+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/src/common.js | 266+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/debug/src/index.js | 10++++++++++
Anode_modules/engine.io-client/node_modules/debug/src/node.js | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ms/index.js | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ms/license.md | 21+++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ms/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ms/readme.md | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/LICENSE | 21+++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/README.md | 449+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/browser.js | 8++++++++
Anode_modules/engine.io-client/node_modules/ws/index.js | 9+++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/buffer-util.js | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/constants.js | 10++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/event-target.js | 170+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/extension.js | 222+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js | 502+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/receiver.js | 515+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/sender.js | 416+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/validation.js | 30++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/websocket-server.js | 389+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/lib/websocket.js | 852+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/node_modules/ws/package.json | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-client/package.json | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-parser/LICENSE | 23+++++++++++++++++++++++
Anode_modules/engine.io-parser/Readme.md | 202+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-parser/lib/browser.js | 605+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-parser/lib/index.js | 473+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-parser/lib/keys.js | 19+++++++++++++++++++
Anode_modules/engine.io-parser/lib/utf8.js | 210+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io-parser/package.json | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/CHANGELOG.md | 10++++++++++
Anode_modules/engine.io/LICENSE | 19+++++++++++++++++++
Anode_modules/engine.io/README.md | 564+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/engine.io.js | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/server.js | 591+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/socket.js | 486+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/transport.js | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/transports/index.js | 36++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/transports/polling-jsonp.js | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/transports/polling-xhr.js | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/transports/polling.js | 407+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/lib/transports/websocket.js | 134+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/cookie/HISTORY.md | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/cookie/LICENSE | 24++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/cookie/README.md | 220+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/cookie/index.js | 195+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/cookie/package.json | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/CHANGELOG.md | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/LICENSE | 19+++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/README.md | 455+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/dist/debug.js | 912+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/package.json | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/src/browser.js | 264+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/src/common.js | 266+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/debug/src/index.js | 10++++++++++
Anode_modules/engine.io/node_modules/debug/src/node.js | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/ms/index.js | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/ms/license.md | 21+++++++++++++++++++++
Anode_modules/engine.io/node_modules/ms/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/node_modules/ms/readme.md | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/engine.io/package.json | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/has-binary2/History.md | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/has-binary2/LICENSE | 20++++++++++++++++++++
Anode_modules/has-binary2/README.md | 4++++
Anode_modules/has-binary2/index.js | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/has-binary2/package.json | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/has-cors/.npmignore | 3+++
Anode_modules/has-cors/History.md | 21+++++++++++++++++++++
Anode_modules/has-cors/Makefile | 11+++++++++++
Anode_modules/has-cors/Readme.md | 24++++++++++++++++++++++++
Anode_modules/has-cors/component.json | 13+++++++++++++
Anode_modules/has-cors/index.js | 17+++++++++++++++++
Anode_modules/has-cors/package.json | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/has-cors/test.js | 24++++++++++++++++++++++++
Anode_modules/indexof/.npmignore | 2++
Anode_modules/indexof/Makefile | 11+++++++++++
Anode_modules/indexof/Readme.md | 16++++++++++++++++
Anode_modules/indexof/component.json | 11+++++++++++
Anode_modules/indexof/index.js | 11+++++++++++
Anode_modules/indexof/package.json | 42++++++++++++++++++++++++++++++++++++++++++
Anode_modules/isarray/README.md | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/isarray/index.js | 5+++++
Anode_modules/isarray/package.json | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/object-component/.npmignore | 3+++
Anode_modules/object-component/History.md | 10++++++++++
Anode_modules/object-component/Makefile | 16++++++++++++++++
Anode_modules/object-component/Readme.md | 32++++++++++++++++++++++++++++++++
Anode_modules/object-component/component.json | 11+++++++++++
Anode_modules/object-component/index.js | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/object-component/package.json | 39+++++++++++++++++++++++++++++++++++++++
Anode_modules/object-component/test/object.js | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/parseqs/.npmignore | 4++++
Anode_modules/parseqs/LICENSE | 21+++++++++++++++++++++
Anode_modules/parseqs/Makefile | 3+++
Anode_modules/parseqs/README.md | 1+
Anode_modules/parseqs/index.js | 37+++++++++++++++++++++++++++++++++++++
Anode_modules/parseqs/package.json | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/parseqs/test.js | 27+++++++++++++++++++++++++++
Anode_modules/parseuri/.npmignore | 3+++
Anode_modules/parseuri/History.md | 5+++++
Anode_modules/parseuri/LICENSE | 21+++++++++++++++++++++
Anode_modules/parseuri/Makefile | 3+++
Anode_modules/parseuri/README.md | 2++
Anode_modules/parseuri/index.js | 39+++++++++++++++++++++++++++++++++++++++
Anode_modules/parseuri/package.json | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/parseuri/test.js | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-adapter/.idea/$CACHE_FILE$ | 26++++++++++++++++++++++++++
Anode_modules/socket.io-adapter/.idea/inspectionProfiles/profiles_settings.xml | 6++++++
Anode_modules/socket.io-adapter/.idea/misc.xml | 7+++++++
Anode_modules/socket.io-adapter/.idea/modules.xml | 9+++++++++
Anode_modules/socket.io-adapter/.idea/socket.io-adapter.iml | 13+++++++++++++
Anode_modules/socket.io-adapter/.idea/vcs.xml | 7+++++++
Anode_modules/socket.io-adapter/.idea/workspace.xml | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-adapter/LICENSE | 20++++++++++++++++++++
Anode_modules/socket.io-adapter/Readme.md | 16++++++++++++++++
Anode_modules/socket.io-adapter/index.js | 263+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-adapter/package.json | 39+++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/LICENSE | 23+++++++++++++++++++++++
Anode_modules/socket.io-client/README.md | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/dist/socket.io.dev.js | 7255+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/dist/socket.io.dev.js.map | 2++
Anode_modules/socket.io-client/dist/socket.io.js | 10++++++++++
Anode_modules/socket.io-client/dist/socket.io.js.map | 2++
Anode_modules/socket.io-client/dist/socket.io.slim.dev.js | 5854+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/dist/socket.io.slim.dev.js.map | 2++
Anode_modules/socket.io-client/dist/socket.io.slim.js | 10++++++++++
Anode_modules/socket.io-client/dist/socket.io.slim.js.map | 2++
Anode_modules/socket.io-client/lib/index.js | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/lib/manager.js | 573+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/lib/on.js | 24++++++++++++++++++++++++
Anode_modules/socket.io-client/lib/socket.js | 438+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/lib/url.js | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/CHANGELOG.md | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/LICENSE | 19+++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/README.md | 455+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/dist/debug.js | 912+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/package.json | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/src/browser.js | 264+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/src/common.js | 266+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/debug/src/index.js | 10++++++++++
Anode_modules/socket.io-client/node_modules/debug/src/node.js | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/ms/index.js | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/ms/license.md | 21+++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/ms/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/ms/readme.md | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/LICENSE | 20++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/Readme.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/binary.js | 141+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/index.js | 415+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/is-buffer.js | 20++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.coveralls.yml | 1+
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.eslintrc | 14++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.npmignore | 9+++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.travis.yml | 20++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/CHANGELOG.md | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/LICENSE | 19+++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/Makefile | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/README.md | 368+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/karma.conf.js | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/node.js | 1+
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/package.json | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/browser.js | 195+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/debug.js | 225+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/index.js | 10++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/node.js | 186+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/index.js | 152+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/license.md | 21+++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/readme.md | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/node_modules/socket.io-parser/package.json | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-client/package.json | 121+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/LICENSE | 20++++++++++++++++++++
Anode_modules/socket.io-parser/Readme.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/binary.js | 141+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/index.js | 415+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/is-buffer.js | 20++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/CHANGELOG.md | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/LICENSE | 19+++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/README.md | 455+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/dist/debug.js | 912+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/package.json | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/src/browser.js | 264+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/src/common.js | 266+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/debug/src/index.js | 10++++++++++
Anode_modules/socket.io-parser/node_modules/debug/src/node.js | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/ms/index.js | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/ms/license.md | 21+++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/ms/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/node_modules/ms/readme.md | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io-parser/package.json | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/LICENSE | 22++++++++++++++++++++++
Anode_modules/socket.io/Readme.md | 243+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/lib/client.js | 273+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/lib/index.js | 523+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/lib/namespace.js | 299+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/lib/parent-namespace.js | 39+++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/lib/socket.js | 572+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/CHANGELOG.md | 395+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/LICENSE | 19+++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/README.md | 455+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/dist/debug.js | 912+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/package.json | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/src/browser.js | 264+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/src/common.js | 266+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/debug/src/index.js | 10++++++++++
Anode_modules/socket.io/node_modules/debug/src/node.js | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/ms/index.js | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/ms/license.md | 21+++++++++++++++++++++
Anode_modules/socket.io/node_modules/ms/package.json | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/node_modules/ms/readme.md | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/socket.io/package.json | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/to-array/.npmignore | 4++++
Anode_modules/to-array/LICENCE | 20++++++++++++++++++++
Anode_modules/to-array/README.md | 22++++++++++++++++++++++
Anode_modules/to-array/index.js | 13+++++++++++++
Anode_modules/to-array/package.json | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/LICENSE | 21+++++++++++++++++++++
Anode_modules/ws/README.md | 494+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/browser.js | 8++++++++
Anode_modules/ws/index.js | 10++++++++++
Anode_modules/ws/lib/buffer-util.js | 146+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/constants.js | 10++++++++++
Anode_modules/ws/lib/event-target.js | 170+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/extension.js | 223+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/limiter.js | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/permessage-deflate.js | 512+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/receiver.js | 506+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/sender.js | 390+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/stream.js | 164+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/validation.js | 30++++++++++++++++++++++++++++++
Anode_modules/ws/lib/websocket-server.js | 406+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/lib/websocket.js | 909+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/ws/package.json | 97+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/LICENSE | 22++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/README.md | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/autotest.watchr | 8++++++++
Anode_modules/xmlhttprequest-ssl/example/demo.js | 16++++++++++++++++
Anode_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js | 651+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/package.json | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-constants.js | 13+++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-events.js | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-exceptions.js | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-headers.js | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-redirect-302.js | 41+++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-redirect-303.js | 41+++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-redirect-307.js | 43+++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-request-methods.js | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/test-request-protocols.js | 32++++++++++++++++++++++++++++++++
Anode_modules/xmlhttprequest-ssl/tests/testdata.txt | 2++
Anode_modules/yeast/LICENSE | 22++++++++++++++++++++++
Anode_modules/yeast/README.md | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/yeast/index.js | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anode_modules/yeast/package.json | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpackage-lock.json | 337+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpackage.json | 2++
Mviews/index.ejs | 8+++-----
Aviews/index.html | 11+++++++++++
376 files changed, 65563 insertions(+), 23 deletions(-)

diff --git a/index.js b/index.js @@ -6,37 +6,39 @@ var creds = require('./config.js'); var app = express(); var router = express.Router(); const bodyparser = require('body-parser'); +var io = require('socket.io').listen(server); +var http = require('http'); +var server = http.createServer(app); -var t = new twit(creds); -app.set('view engine', 'ejs'); -app.use(bodyparser.urlencoded({extended: true})); -app.use(express.static(__dirname + '/public')); +server.listen(8080, function(){ + console.log("you are now rockin with port 8080 and... localhost"); +}); -app.get("/",function(req,res){ - - res.render('index',{ +// routing +app.get('/', function (req, res) { +res.sendFile(__dirname + '/views/index.html'); +console.log('got request made on / route!'); +}); - name: name +var watchList = ['love', 'hate']; - }); +var T = new twit(creds); -}); +io.sockets.on('connection', function (socket) { +console.log('Connected'); -t.get('search/tweets', { q: '350z since:2011-07-11', count: 3 }, function(err, data, response) { - console.log(data) +var stream = T.stream('statuses/filter', { track: '#coding' }) - }) +stream.on('tweet', function (tweet) { + io.sockets.emit('stream',tweet.text); + console.log(tweet.text); -app.listen(3000,function(){ - console.log("Live at Port 3000"); }); - - -//set up a stream to send and recieve the data from node server to the actual web server +}); diff --git a/node_modules/after/.npmignore b/node_modules/after/.npmignore @@ -0,0 +1,2 @@ +node_modules +.monitor diff --git a/node_modules/after/.travis.yml b/node_modules/after/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.9 + - 0.10 + - 0.12 + - 4.2.4 + - 5.4.1 + - iojs-1 + - iojs-2 + - iojs-3 diff --git a/node_modules/after/LICENCE b/node_modules/after/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.+ \ No newline at end of file diff --git a/node_modules/after/README.md b/node_modules/after/README.md @@ -0,0 +1,115 @@ +# After [![Build Status][1]][2] + +Invoke callback after n calls + +## Status: production ready + +## Example + +```js +var after = require("after") +var db = require("./db") // some db. + +var updateUser = function (req, res) { + // use after to run two tasks in parallel, + // namely get request body and get session + // then run updateUser with the results + var next = after(2, updateUser) + var results = {} + + getJSONBody(req, res, function (err, body) { + if (err) return next(err) + + results.body = body + next(null, results) + }) + + getSessionUser(req, res, function (err, user) { + if (err) return next(err) + + results.user = user + next(null, results) + }) + + // now do the thing! + function updateUser(err, result) { + if (err) { + res.statusCode = 500 + return res.end("Unexpected Error") + } + + if (!result.user || result.user.role !== "admin") { + res.statusCode = 403 + return res.end("Permission Denied") + } + + db.put("users:" + req.params.userId, result.body, function (err) { + if (err) { + res.statusCode = 500 + return res.end("Unexpected Error") + } + + res.statusCode = 200 + res.end("Ok") + }) + } +} +``` + +## Naive Example + +```js +var after = require("after") + , next = after(3, logItWorks) + +next() +next() +next() // it works + +function logItWorks() { + console.log("it works!") +} +``` + +## Example with error handling + +```js +var after = require("after") + , next = after(3, logError) + +next() +next(new Error("oops")) // logs oops +next() // does nothing + +// This callback is only called once. +// If there is an error the callback gets called immediately +// this avoids the situation where errors get lost. +function logError(err) { + console.log(err) +} +``` + +## Installation + +`npm install after` + +## Tests + +`npm test` + +## Contributors + + - Raynos + - defunctzombie + +## MIT Licenced + + [1]: https://secure.travis-ci.org/Raynos/after.png + [2]: http://travis-ci.org/Raynos/after + [3]: http://raynos.org/blog/2/Flow-control-in-node.js + [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307 + [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031 + [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419 + [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091 + [8]: http://github.com/Raynos/iterators + [9]: http://github.com/Raynos/composite diff --git a/node_modules/after/index.js b/node_modules/after/index.js @@ -0,0 +1,28 @@ +module.exports = after + +function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } +} + +function noop() {} diff --git a/node_modules/after/package.json b/node_modules/after/package.json @@ -0,0 +1,63 @@ +{ + "_from": "after@0.8.2", + "_id": "after@0.8.2", + "_inBundle": false, + "_integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "_location": "/after", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "after@0.8.2", + "name": "after", + "escapedName": "after", + "rawSpec": "0.8.2", + "saveSpec": null, + "fetchSpec": "0.8.2" + }, + "_requiredBy": [ + "/engine.io-parser" + ], + "_resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "_shasum": "fedb394f9f0e02aa9768e702bda23b505fae7e1f", + "_spec": "after@0.8.2", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-parser", + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "bugs": { + "url": "https://github.com/Raynos/after/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Raynos", + "email": "raynos2@gmail.com", + "url": "http://raynos.org" + } + ], + "deprecated": false, + "description": "after - tiny flow control", + "devDependencies": { + "mocha": "~1.8.1" + }, + "homepage": "https://github.com/Raynos/after#readme", + "keywords": [ + "flowcontrol", + "after", + "flow", + "control", + "arch" + ], + "license": "MIT", + "name": "after", + "repository": { + "type": "git", + "url": "git://github.com/Raynos/after.git" + }, + "scripts": { + "test": "mocha --ui tdd --reporter spec test/*.js" + }, + "version": "0.8.2" +} diff --git a/node_modules/after/test/after-test.js b/node_modules/after/test/after-test.js @@ -0,0 +1,120 @@ +/*global suite, test*/ + +var assert = require("assert") + , after = require("../") + +test("exists", function () { + assert(typeof after === "function", "after is not a function") +}) + +test("after when called with 0 invokes", function (done) { + after(0, done) +}); + +test("after 1", function (done) { + var next = after(1, done) + next() +}) + +test("after 5", function (done) { + var next = after(5, done) + , i = 5 + + while (i--) { + next() + } +}) + +test("manipulate count", function (done) { + var next = after(1, done) + , i = 5 + + next.count = i + while (i--) { + next() + } +}) + +test("after terminates on error", function (done) { + var next = after(2, function(err) { + assert.equal(err.message, 'test'); + done(); + }) + next(new Error('test')) + next(new Error('test2')) +}) + +test('gee', function(done) { + done = after(2, done) + + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + assert.equal(err.message, 2) + done() + }); + + next() + next(new Error(1)) + next(new Error(2)) +}) + +test('eee', function(done) { + done = after(3, done) + + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + assert.equal(err.message, 2) + done() + }); + + next(new Error(1)) + next(new Error(2)) + next(new Error(2)) +}) + +test('gge', function(done) { + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + // should not happen + assert.ok(false); + }); + + next() + next() + next(new Error(1)) +}) + +test('egg', function(done) { + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + // should not happen + assert.ok(false); + }); + + next(new Error(1)) + next() + next() +}) + +test('throws on too many calls', function(done) { + var next = after(1, done); + next() + assert.throws(next, /after called too many times/); +}); + diff --git a/node_modules/arraybuffer.slice/.npmignore b/node_modules/arraybuffer.slice/.npmignore @@ -0,0 +1,17 @@ +lib-cov +lcov.info +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results +build +.grunt + +node_modules diff --git a/node_modules/arraybuffer.slice/LICENCE b/node_modules/arraybuffer.slice/LICENCE @@ -0,0 +1,18 @@ +Copyright (C) 2013 Rase- + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/arraybuffer.slice/Makefile b/node_modules/arraybuffer.slice/Makefile @@ -0,0 +1,8 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) + +.PHONY: test diff --git a/node_modules/arraybuffer.slice/README.md b/node_modules/arraybuffer.slice/README.md @@ -0,0 +1,17 @@ +# How to +```javascript +var sliceBuffer = require('arraybuffer.slice'); +var ab = (new Int8Array(5)).buffer; +var sliced = sliceBuffer(ab, 1, 3); +sliced = sliceBuffer(ab, 1); +``` + +# Licence (MIT) +Copyright (C) 2013 Rase- + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/arraybuffer.slice/index.js b/node_modules/arraybuffer.slice/index.js @@ -0,0 +1,29 @@ +/** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + +module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; +}; diff --git a/node_modules/arraybuffer.slice/package.json b/node_modules/arraybuffer.slice/package.json @@ -0,0 +1,44 @@ +{ + "_from": "arraybuffer.slice@~0.0.7", + "_id": "arraybuffer.slice@0.0.7", + "_inBundle": false, + "_integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", + "_location": "/arraybuffer.slice", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "arraybuffer.slice@~0.0.7", + "name": "arraybuffer.slice", + "escapedName": "arraybuffer.slice", + "rawSpec": "~0.0.7", + "saveSpec": null, + "fetchSpec": "~0.0.7" + }, + "_requiredBy": [ + "/engine.io-parser" + ], + "_resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "_shasum": "3bbc4275dd584cc1b10809b89d4e8b63a69e7675", + "_spec": "arraybuffer.slice@~0.0.7", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-parser", + "bugs": { + "url": "https://github.com/rase-/arraybuffer.slice/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Exports a function for slicing ArrayBuffers (no polyfilling)", + "devDependencies": { + "expect.js": "0.2.0", + "mocha": "1.17.1" + }, + "homepage": "https://github.com/rase-/arraybuffer.slice", + "license": "MIT", + "name": "arraybuffer.slice", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/rase-/arraybuffer.slice.git" + }, + "version": "0.0.7" +} diff --git a/node_modules/arraybuffer.slice/test/slice-buffer.js b/node_modules/arraybuffer.slice/test/slice-buffer.js @@ -0,0 +1,227 @@ +/* + * Test dependencies + */ + +var sliceBuffer = require('../index.js'); +var expect = require('expect.js'); + +/** + * Tests + */ + +describe('sliceBuffer', function() { + describe('using standard slice', function() { + it('should slice correctly with only start provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 3); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with start and end provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 3, 8); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < 8; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 0, -3); + var sabv = new Uint8Array(sliced); + for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, -6, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with equal start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 1, 1); + expect(sliced.byteLength).to.equal(0); + }); + + it('should slice correctly when end larger than buffer', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 0, 100); + expect(new Uint8Array(sliced)).to.eql(abv); + }); + + it('shoud slice correctly when start larger than end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 6, 5); + expect(sliced.byteLength).to.equal(0); + }); + }); + + describe('using fallback', function() { + it('should slice correctly with only start provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 3); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with start and end provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + + var sliced = sliceBuffer(ab, 3, 8); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < 8; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + + var sliced = sliceBuffer(ab, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 0, -3); + var sabv = new Uint8Array(sliced); + for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, -6, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with equal start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 1, 1); + expect(sliced.byteLength).to.equal(0); + }); + + it('should slice correctly when end larger than buffer', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 0, 100); + var sabv = new Uint8Array(sliced); + for (var i = 0; i < abv.length; i++) { + expect(abv[i]).to.equal(sabv[i]); + } + }); + + it('shoud slice correctly when start larger than end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 6, 5); + expect(sliced.byteLength).to.equal(0); + }); + }); +}); diff --git a/node_modules/async-limiter/.eslintignore b/node_modules/async-limiter/.eslintignore @@ -0,0 +1,2 @@ +coverage +.nyc_output+ \ No newline at end of file diff --git a/node_modules/async-limiter/.nycrc b/node_modules/async-limiter/.nycrc @@ -0,0 +1,10 @@ +{ + "check-coverage": false, + "lines": 99, + "statements": 99, + "functions": 99, + "branches": 99, + "include": [ + "index.js" + ] +}+ \ No newline at end of file diff --git a/node_modules/async-limiter/.travis.yml b/node_modules/async-limiter/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "6" + - "8" + - "10" + - "node" +script: npm run travis +cache: + yarn: true diff --git a/node_modules/async-limiter/LICENSE b/node_modules/async-limiter/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2017 Samuel Reed <samuel.trace.reed@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/async-limiter/index.js b/node_modules/async-limiter/index.js @@ -0,0 +1,67 @@ +'use strict'; + +function Queue(options) { + if (!(this instanceof Queue)) { + return new Queue(options); + } + + options = options || {}; + this.concurrency = options.concurrency || Infinity; + this.pending = 0; + this.jobs = []; + this.cbs = []; + this._done = done.bind(this); +} + +var arrayAddMethods = [ + 'push', + 'unshift', + 'splice' +]; + +arrayAddMethods.forEach(function(method) { + Queue.prototype[method] = function() { + var methodResult = Array.prototype[method].apply(this.jobs, arguments); + this._run(); + return methodResult; + }; +}); + +Object.defineProperty(Queue.prototype, 'length', { + get: function() { + return this.pending + this.jobs.length; + } +}); + +Queue.prototype._run = function() { + if (this.pending === this.concurrency) { + return; + } + if (this.jobs.length) { + var job = this.jobs.shift(); + this.pending++; + job(this._done); + this._run(); + } + + if (this.pending === 0) { + while (this.cbs.length !== 0) { + var cb = this.cbs.pop(); + process.nextTick(cb); + } + } +}; + +Queue.prototype.onDone = function(cb) { + if (typeof cb === 'function') { + this.cbs.push(cb); + this._run(); + } +}; + +function done() { + this.pending--; + this._run(); +} + +module.exports = Queue; diff --git a/node_modules/async-limiter/package.json b/node_modules/async-limiter/package.json @@ -0,0 +1,69 @@ +{ + "_from": "async-limiter@~1.0.0", + "_id": "async-limiter@1.0.1", + "_inBundle": false, + "_integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "_location": "/async-limiter", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "async-limiter@~1.0.0", + "name": "async-limiter", + "escapedName": "async-limiter", + "rawSpec": "~1.0.0", + "saveSpec": null, + "fetchSpec": "~1.0.0" + }, + "_requiredBy": [ + "/engine.io-client/ws" + ], + "_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "_shasum": "dd379e94f0db8310b08291f9d64c3209766617fd", + "_spec": "async-limiter@~1.0.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client/node_modules/ws", + "author": { + "name": "Samuel Reed" + }, + "bugs": { + "url": "https://github.com/strml/async-limiter/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "asynchronous function queue with adjustable concurrency", + "devDependencies": { + "coveralls": "^3.0.3", + "eslint": "^5.16.0", + "eslint-plugin-mocha": "^5.3.0", + "intelli-espower-loader": "^1.0.1", + "mocha": "^6.1.4", + "nyc": "^14.1.1", + "power-assert": "^1.6.1" + }, + "homepage": "https://github.com/strml/async-limiter#readme", + "keywords": [ + "throttle", + "async", + "limiter", + "asynchronous", + "job", + "task", + "concurrency", + "concurrent" + ], + "license": "MIT", + "name": "async-limiter", + "repository": { + "type": "git", + "url": "git+https://github.com/strml/async-limiter.git" + }, + "scripts": { + "coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls", + "example": "node example", + "lint": "eslint .", + "test": "mocha --require intelli-espower-loader test/", + "travis": "npm run lint && npm run test" + }, + "version": "1.0.1" +} diff --git a/node_modules/async-limiter/readme.md b/node_modules/async-limiter/readme.md @@ -0,0 +1,132 @@ +# Async-Limiter + +A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue). + +[![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter) +[![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter) +[![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter) + +This module exports a class `Limiter` that implements some of the `Array` API. +Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods. + +## Motivation + +Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when +run at infinite concurrency. + +In this case, it is actually faster, and takes far less memory, to limit concurrency. + +This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would +make this module faster or lighter, but new functionality is not desired. + +Style should confirm to nodejs/node style. + +## Example + +``` javascript +var Limiter = require('async-limiter') + +var t = new Limiter({concurrency: 2}); +var results = [] + +// add jobs using the familiar Array API +t.push(function (cb) { + results.push('two') + cb() +}) + +t.push( + function (cb) { + results.push('four') + cb() + }, + function (cb) { + results.push('five') + cb() + } +) + +t.unshift(function (cb) { + results.push('one') + cb() +}) + +t.splice(2, 0, function (cb) { + results.push('three') + cb() +}) + +// Jobs run automatically. If you want a callback when all are done, +// call 'onDone()'. +t.onDone(function () { + console.log('all done:', results) +}) +``` + +## Zlib Example + +```js +const zlib = require('zlib'); +const Limiter = require('async-limiter'); + +const message = {some: "data"}; +const payload = new Buffer(JSON.stringify(message)); + +// Try with different concurrency values to see how this actually +// slows significantly with higher concurrency! +// +// 5: 1398.607ms +// 10: 1375.668ms +// Infinity: 4423.300ms +// +const t = new Limiter({concurrency: 5}); +function deflate(payload, cb) { + t.push(function(done) { + zlib.deflate(payload, function(err, buffer) { + done(); + cb(err, buffer); + }); + }); +} + +console.time('deflate'); +for(let i = 0; i < 30000; ++i) { + deflate(payload, function (err, buffer) {}); +} +t.onDone(function() { + console.timeEnd('deflate'); +}); +``` + +## Install + +`npm install async-limiter` + +## Test + +`npm test` + +## API + +### `var t = new Limiter([opts])` +Constructor. `opts` may contain inital values for: +* `t.concurrency` + +## Instance methods + +### `t.onDone(fn)` +`fn` will be called once and only once, when the queue is empty. + +## Instance methods mixed in from `Array` +Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). +### `t.push(element1, ..., elementN)` +### `t.unshift(element1, ..., elementN)` +### `t.splice(index , howMany[, element1[, ...[, elementN]]])` + +## Properties +### `t.concurrency` +Max number of jobs the queue should process concurrently, defaults to `Infinity`. + +### `t.length` +Jobs pending + jobs to process (readonly). + diff --git a/node_modules/backo2/.npmignore b/node_modules/backo2/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/backo2/History.md b/node_modules/backo2/History.md @@ -0,0 +1,12 @@ + +1.0.1 / 2014-02-17 +================== + + * go away decimal point + * history + +1.0.0 / 2014-02-17 +================== + + * add jitter option + * Initial commit diff --git a/node_modules/backo2/Makefile b/node_modules/backo2/Makefile @@ -0,0 +1,8 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter dot \ + --bail + +.PHONY: test+ \ No newline at end of file diff --git a/node_modules/backo2/Readme.md b/node_modules/backo2/Readme.md @@ -0,0 +1,34 @@ +# backo + + Simple exponential backoff because the others seem to have weird abstractions. + +## Installation + +``` +$ npm install backo +``` + +## Options + + - `min` initial timeout in milliseconds [100] + - `max` max timeout [10000] + - `jitter` [0] + - `factor` [2] + +## Example + +```js +var Backoff = require('backo'); +var backoff = new Backoff({ min: 100, max: 20000 }); + +setTimeout(function(){ + something.reconnect(); +}, backoff.duration()); + +// later when something works +backoff.reset() +``` + +# License + + MIT diff --git a/node_modules/backo2/component.json b/node_modules/backo2/component.json @@ -0,0 +1,11 @@ +{ + "name": "backo", + "repo": "segmentio/backo", + "dependencies": {}, + "version": "1.0.1", + "description": "simple backoff without the weird abstractions", + "keywords": ["backoff"], + "license": "MIT", + "scripts": ["index.js"], + "main": "index.js" +} diff --git a/node_modules/backo2/index.js b/node_modules/backo2/index.js @@ -0,0 +1,85 @@ + +/** + * Expose `Backoff`. + */ + +module.exports = Backoff; + +/** + * Initialize backoff timer with `opts`. + * + * - `min` initial timeout in milliseconds [100] + * - `max` max timeout [10000] + * - `jitter` [0] + * - `factor` [2] + * + * @param {Object} opts + * @api public + */ + +function Backoff(opts) { + opts = opts || {}; + this.ms = opts.min || 100; + this.max = opts.max || 10000; + this.factor = opts.factor || 2; + this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; + this.attempts = 0; +} + +/** + * Return the backoff duration. + * + * @return {Number} + * @api public + */ + +Backoff.prototype.duration = function(){ + var ms = this.ms * Math.pow(this.factor, this.attempts++); + if (this.jitter) { + var rand = Math.random(); + var deviation = Math.floor(rand * this.jitter * ms); + ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; + } + return Math.min(ms, this.max) | 0; +}; + +/** + * Reset the number of attempts. + * + * @api public + */ + +Backoff.prototype.reset = function(){ + this.attempts = 0; +}; + +/** + * Set the minimum duration + * + * @api public + */ + +Backoff.prototype.setMin = function(min){ + this.ms = min; +}; + +/** + * Set the maximum duration + * + * @api public + */ + +Backoff.prototype.setMax = function(max){ + this.max = max; +}; + +/** + * Set the jitter + * + * @api public + */ + +Backoff.prototype.setJitter = function(jitter){ + this.jitter = jitter; +}; + diff --git a/node_modules/backo2/package.json b/node_modules/backo2/package.json @@ -0,0 +1,47 @@ +{ + "_from": "backo2@1.0.2", + "_id": "backo2@1.0.2", + "_inBundle": false, + "_integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "_location": "/backo2", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "backo2@1.0.2", + "name": "backo2", + "escapedName": "backo2", + "rawSpec": "1.0.2", + "saveSpec": null, + "fetchSpec": "1.0.2" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "_shasum": "31ab1ac8b129363463e35b3ebb69f4dfcfba7947", + "_spec": "backo2@1.0.2", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "bugs": { + "url": "https://github.com/mokesmokes/backo/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "simple backoff based on segmentio/backo", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "homepage": "https://github.com/mokesmokes/backo#readme", + "keywords": [ + "backoff" + ], + "license": "MIT", + "name": "backo2", + "repository": { + "type": "git", + "url": "git+https://github.com/mokesmokes/backo.git" + }, + "version": "1.0.2" +} diff --git a/node_modules/backo2/test/index.js b/node_modules/backo2/test/index.js @@ -0,0 +1,18 @@ + +var Backoff = require('..'); +var assert = require('assert'); + +describe('.duration()', function(){ + it('should increase the backoff', function(){ + var b = new Backoff; + + assert(100 == b.duration()); + assert(200 == b.duration()); + assert(400 == b.duration()); + assert(800 == b.duration()); + + b.reset(); + assert(100 == b.duration()); + assert(200 == b.duration()); + }) +})+ \ No newline at end of file diff --git a/node_modules/base64-arraybuffer/.npmignore b/node_modules/base64-arraybuffer/.npmignore @@ -0,0 +1,3 @@ +/node_modules/ +Gruntfile.js +/test/ diff --git a/node_modules/base64-arraybuffer/.travis.yml b/node_modules/base64-arraybuffer/.travis.yml @@ -0,0 +1,19 @@ +language: node_js +node_js: +- '0.12' +- iojs-1 +- iojs-2 +- iojs-3 +- '4.1' +before_script: +- npm install +before_install: npm install -g npm@'>=2.13.5' +deploy: + provider: npm + email: niklasvh@gmail.com + api_key: + secure: oHV9ArprTj5WOk7MP1UF7QMJ70huXw+y7xXb5wF4+V2H8Hyfa5TfE0DiOmqrube1WXTeH1FLgq54shp/sJWi47Hkg/GyeoB5NnsPhYEaJkaON9UG5blML+ODiNVsEnq/1kNBQ8e0+0JItMPLGySKyFmuZ3yflulXKS8O88mfINo= + on: + tags: true + branch: master + repo: niklasvh/base64-arraybuffer diff --git a/node_modules/base64-arraybuffer/LICENSE-MIT b/node_modules/base64-arraybuffer/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2012 Niklas von Hertzen + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/base64-arraybuffer/README.md b/node_modules/base64-arraybuffer/README.md @@ -0,0 +1,20 @@ +# base64-arraybuffer + +[![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer) +[![NPM Downloads](https://img.shields.io/npm/dm/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer) +[![NPM Version](https://img.shields.io/npm/v/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer) + +Encode/decode base64 data into ArrayBuffers + +## Getting Started +Install the module with: `npm install base64-arraybuffer` + +## API +The library encodes and decodes base64 to and from ArrayBuffers + + - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string + - __decode(str)__ - Decodes base64 string to `ArrayBuffer` + +## License +Copyright (c) 2012 Niklas von Hertzen +Licensed under the MIT license. diff --git a/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js b/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js @@ -0,0 +1,67 @@ +/* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ +(function(){ + "use strict"; + + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // Use a lookup table to find the index. + var lookup = new Uint8Array(256); + for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; + } + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i+1)]; + encoded3 = lookup[base64.charCodeAt(i+2)]; + encoded4 = lookup[base64.charCodeAt(i+3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; +})(); diff --git a/node_modules/base64-arraybuffer/package.json b/node_modules/base64-arraybuffer/package.json @@ -0,0 +1,65 @@ +{ + "_from": "base64-arraybuffer@0.1.5", + "_id": "base64-arraybuffer@0.1.5", + "_inBundle": false, + "_integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "_location": "/base64-arraybuffer", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "base64-arraybuffer@0.1.5", + "name": "base64-arraybuffer", + "escapedName": "base64-arraybuffer", + "rawSpec": "0.1.5", + "saveSpec": null, + "fetchSpec": "0.1.5" + }, + "_requiredBy": [ + "/engine.io-parser", + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "_shasum": "73926771923b5a19747ad666aa5cd4bf9c6e9ce8", + "_spec": "base64-arraybuffer@0.1.5", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-parser", + "author": { + "name": "Niklas von Hertzen", + "email": "niklasvh@gmail.com", + "url": "http://hertzen.com" + }, + "bugs": { + "url": "https://github.com/niklasvh/base64-arraybuffer/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Encode/decode base64 data into ArrayBuffers", + "devDependencies": { + "grunt": "^0.4.5", + "grunt-cli": "^0.1.13", + "grunt-contrib-jshint": "^0.11.2", + "grunt-contrib-nodeunit": "^0.4.1", + "grunt-contrib-watch": "^0.6.1" + }, + "engines": { + "node": ">= 0.6.0" + }, + "homepage": "https://github.com/niklasvh/base64-arraybuffer", + "keywords": [], + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT" + } + ], + "main": "lib/base64-arraybuffer", + "name": "base64-arraybuffer", + "repository": { + "type": "git", + "url": "git+https://github.com/niklasvh/base64-arraybuffer.git" + }, + "scripts": { + "test": "grunt nodeunit" + }, + "version": "0.1.5" +} diff --git a/node_modules/base64id/CHANGELOG.md b/node_modules/base64id/CHANGELOG.md @@ -0,0 +1,16 @@ +# [2.0.0](https://github.com/faeldt/base64id/compare/1.0.0...2.0.0) (2019-05-27) + + +### Code Refactoring + +* **buffer:** replace deprecated Buffer constructor usage ([#11](https://github.com/faeldt/base64id/issues/11)) ([ccfba54](https://github.com/faeldt/base64id/commit/ccfba54)) + + +### BREAKING CHANGES + +* **buffer:** drop support for Node.js ≤ 4.4.x and 5.0.0 - 5.9.x + +See: https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/ + + + diff --git a/node_modules/base64id/LICENSE b/node_modules/base64id/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2012-2016 Kristian Faeldt <faeldt_kristian@cyberagent.co.jp> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/base64id/README.md b/node_modules/base64id/README.md @@ -0,0 +1,18 @@ +base64id +======== + +Node.js module that generates a base64 id. + +Uses crypto.randomBytes when available, falls back to unsafe methods for node.js <= 0.4. + +To increase performance, random bytes are buffered to minimize the number of synchronous calls to crypto.randomBytes. + +## Installation + + $ npm install base64id + +## Usage + + var base64id = require('base64id'); + + var id = base64id.generateId(); diff --git a/node_modules/base64id/lib/base64id.js b/node_modules/base64id/lib/base64id.js @@ -0,0 +1,103 @@ +/*! + * base64id v0.1.0 + */ + +/** + * Module dependencies + */ + +var crypto = require('crypto'); + +/** + * Constructor + */ + +var Base64Id = function() { }; + +/** + * Get random bytes + * + * Uses a buffer if available, falls back to crypto.randomBytes + */ + +Base64Id.prototype.getRandomBytes = function(bytes) { + + var BUFFER_SIZE = 4096 + var self = this; + + bytes = bytes || 12; + + if (bytes > BUFFER_SIZE) { + return crypto.randomBytes(bytes); + } + + var bytesInBuffer = parseInt(BUFFER_SIZE/bytes); + var threshold = parseInt(bytesInBuffer*0.85); + + if (!threshold) { + return crypto.randomBytes(bytes); + } + + if (this.bytesBufferIndex == null) { + this.bytesBufferIndex = -1; + } + + if (this.bytesBufferIndex == bytesInBuffer) { + this.bytesBuffer = null; + this.bytesBufferIndex = -1; + } + + // No buffered bytes available or index above threshold + if (this.bytesBufferIndex == -1 || this.bytesBufferIndex > threshold) { + + if (!this.isGeneratingBytes) { + this.isGeneratingBytes = true; + crypto.randomBytes(BUFFER_SIZE, function(err, bytes) { + self.bytesBuffer = bytes; + self.bytesBufferIndex = 0; + self.isGeneratingBytes = false; + }); + } + + // Fall back to sync call when no buffered bytes are available + if (this.bytesBufferIndex == -1) { + return crypto.randomBytes(bytes); + } + } + + var result = this.bytesBuffer.slice(bytes*this.bytesBufferIndex, bytes*(this.bytesBufferIndex+1)); + this.bytesBufferIndex++; + + return result; +} + +/** + * Generates a base64 id + * + * (Original version from socket.io <http://socket.io>) + */ + +Base64Id.prototype.generateId = function () { + var rand = Buffer.alloc(15); // multiple of 3 for base64 + if (!rand.writeInt32BE) { + return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString() + + Math.abs(Math.random() * Math.random() * Date.now() | 0).toString(); + } + this.sequenceNumber = (this.sequenceNumber + 1) | 0; + rand.writeInt32BE(this.sequenceNumber, 11); + if (crypto.randomBytes) { + this.getRandomBytes(12).copy(rand); + } else { + // not secure for node 0.4 + [0, 4, 8].forEach(function(i) { + rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i); + }); + } + return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-'); +}; + +/** + * Export + */ + +exports = module.exports = new Base64Id(); diff --git a/node_modules/base64id/package.json b/node_modules/base64id/package.json @@ -0,0 +1,47 @@ +{ + "_from": "base64id@2.0.0", + "_id": "base64id@2.0.0", + "_inBundle": false, + "_integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "_location": "/base64id", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "base64id@2.0.0", + "name": "base64id", + "escapedName": "base64id", + "rawSpec": "2.0.0", + "saveSpec": null, + "fetchSpec": "2.0.0" + }, + "_requiredBy": [ + "/engine.io" + ], + "_resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "_shasum": "2770ac6bc47d312af97a8bf9a634342e0cd25cb6", + "_spec": "base64id@2.0.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io", + "author": { + "name": "Kristian Faeldt", + "email": "faeldt_kristian@cyberagent.co.jp" + }, + "bugs": { + "url": "https://github.com/faeldt/base64id/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Generates a base64 id", + "engines": { + "node": "^4.5.0 || >= 5.9" + }, + "homepage": "https://github.com/faeldt/base64id#readme", + "license": "MIT", + "main": "./lib/base64id.js", + "name": "base64id", + "repository": { + "type": "git", + "url": "git+https://github.com/faeldt/base64id.git" + }, + "version": "2.0.0" +} diff --git a/node_modules/better-assert/.npmignore b/node_modules/better-assert/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/better-assert/History.md b/node_modules/better-assert/History.md @@ -0,0 +1,15 @@ + +1.0.0 / 2013-02-03 +================== + + * Stop using the removed magic __stack global getter + +0.1.0 / 2012-10-04 +================== + + * add throwing of AssertionError for test frameworks etc + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/better-assert/Makefile b/node_modules/better-assert/Makefile @@ -0,0 +1,5 @@ + +test: + @echo "populate me" + +.PHONY: test+ \ No newline at end of file diff --git a/node_modules/better-assert/Readme.md b/node_modules/better-assert/Readme.md @@ -0,0 +1,61 @@ + +# better-assert + + Better c-style assertions using [callsite](https://github.com/visionmedia/callsite) for + self-documenting failure messages. + +## Installation + + $ npm install better-assert + +## Example + + By default assertions are enabled, however the __NO_ASSERT__ environment variable + will deactivate them when truthy. + +```js +var assert = require('better-assert'); + +test(); + +function test() { + var user = { name: 'tobi' }; + assert('tobi' == user.name); + assert('number' == typeof user.age); +} + +AssertionError: 'number' == typeof user.age + at test (/Users/tj/projects/better-assert/example.js:9:3) + at Object.<anonymous> (/Users/tj/projects/better-assert/example.js:4:1) + at Module._compile (module.js:449:26) + at Object.Module._extensions..js (module.js:467:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + at Module.runMain (module.js:492:10) + at process.startup.processNextTick.process._tickCallback (node.js:244:9) +``` + +## License + +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+ \ No newline at end of file diff --git a/node_modules/better-assert/example.js b/node_modules/better-assert/example.js @@ -0,0 +1,10 @@ + +var assert = require('./'); + +test(); + +function test() { + var user = { name: 'tobi' }; + assert('tobi' == user.name); + assert('number' == typeof user.age); +}+ \ No newline at end of file diff --git a/node_modules/better-assert/index.js b/node_modules/better-assert/index.js @@ -0,0 +1,38 @@ +/** + * Module dependencies. + */ + +var AssertionError = require('assert').AssertionError + , callsite = require('callsite') + , fs = require('fs') + +/** + * Expose `assert`. + */ + +module.exports = process.env.NO_ASSERT + ? function(){} + : assert; + +/** + * Assert the given `expr`. + */ + +function assert(expr) { + if (expr) return; + + var stack = callsite(); + var call = stack[1]; + var file = call.getFileName(); + var lineno = call.getLineNumber(); + var src = fs.readFileSync(file, 'utf8'); + var line = src.split('\n')[lineno-1]; + var src = line.match(/assert\((.*)\)/)[1]; + + var err = new AssertionError({ + message: src, + stackStartFunction: stack[0].getFunction() + }); + + throw err; +} diff --git a/node_modules/better-assert/package.json b/node_modules/better-assert/package.json @@ -0,0 +1,65 @@ +{ + "_from": "better-assert@~1.0.0", + "_id": "better-assert@1.0.2", + "_inBundle": false, + "_integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "_location": "/better-assert", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "better-assert@~1.0.0", + "name": "better-assert", + "escapedName": "better-assert", + "rawSpec": "~1.0.0", + "saveSpec": null, + "fetchSpec": "~1.0.0" + }, + "_requiredBy": [ + "/parseqs", + "/parseuri" + ], + "_resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "_shasum": "40866b9e1b9e0b55b481894311e68faffaebc522", + "_spec": "better-assert@~1.0.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/parseqs", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "bugs": { + "url": "https://github.com/visionmedia/better-assert/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "TonyHe", + "email": "coolhzb@163.com" + }, + { + "name": "ForbesLindesay" + } + ], + "dependencies": { + "callsite": "1.0.0" + }, + "deprecated": false, + "description": "Better assertions for node, reporting the expr, filename, lineno etc", + "engines": { + "node": "*" + }, + "homepage": "https://github.com/visionmedia/better-assert#readme", + "keywords": [ + "assert", + "stack", + "trace", + "debug" + ], + "main": "index", + "name": "better-assert", + "repository": { + "type": "git", + "url": "git+https://github.com/visionmedia/better-assert.git" + }, + "version": "1.0.2" +} diff --git a/node_modules/blob/.idea/blob.iml b/node_modules/blob/.idea/blob.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="WEB_MODULE" version="4"> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/.tmp" /> + <excludeFolder url="file://$MODULE_DIR$/temp" /> + <excludeFolder url="file://$MODULE_DIR$/tmp" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>+ \ No newline at end of file diff --git a/node_modules/blob/.idea/inspectionProfiles/profiles_settings.xml b/node_modules/blob/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,5 @@ +<component name="InspectionProjectProfileManager"> + <settings> + <option name="PROJECT_PROFILE" /> + </settings> +</component>+ \ No newline at end of file diff --git a/node_modules/blob/.idea/markdown-navigator.xml b/node_modules/blob/.idea/markdown-navigator.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="MarkdownProjectSettings" wasCopied="true"> + <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true" replaceUnicodeEmoji="false" lastLayoutSetsDefault="false"> + <PanelProvider> + <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" /> + </PanelProvider> + </PreviewSettings> + <ParserSettings gitHubSyntaxChange="false" emojiShortcuts="1" emojiImages="0"> + <PegdownExtensions> + <option name="ABBREVIATIONS" value="false" /> + <option name="ANCHORLINKS" value="true" /> + <option name="ASIDE" value="false" /> + <option name="ATXHEADERSPACE" value="true" /> + <option name="AUTOLINKS" value="true" /> + <option name="DEFINITIONS" value="false" /> + <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" /> + <option name="FENCED_CODE_BLOCKS" value="true" /> + <option name="FOOTNOTES" value="false" /> + <option name="HARDWRAPS" value="false" /> + <option name="HTML_DEEP_PARSER" value="false" /> + <option name="INSERTED" value="false" /> + <option name="QUOTES" value="false" /> + <option name="RELAXEDHRULES" value="true" /> + <option name="SMARTS" value="false" /> + <option name="STRIKETHROUGH" value="true" /> + <option name="SUBSCRIPT" value="false" /> + <option name="SUPERSCRIPT" value="false" /> + <option name="SUPPRESS_HTML_BLOCKS" value="false" /> + <option name="SUPPRESS_INLINE_HTML" value="false" /> + <option name="TABLES" value="true" /> + <option name="TASKLISTITEMS" value="true" /> + <option name="TOC" value="false" /> + <option name="WIKILINKS" value="true" /> + </PegdownExtensions> + <ParserOptions> + <option name="ADMONITION_EXT" value="false" /> + <option name="ATTRIBUTES_EXT" value="false" /> + <option name="COMMONMARK_LISTS" value="true" /> + <option name="DUMMY" value="false" /> + <option name="EMOJI_SHORTCUTS" value="true" /> + <option name="ENUMERATED_REFERENCES_EXT" value="false" /> + <option name="FLEXMARK_FRONT_MATTER" value="false" /> + <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" /> + <option name="GFM_TABLE_RENDERING" value="true" /> + <option name="GITBOOK_URL_ENCODING" value="false" /> + <option name="GITHUB_LISTS" value="false" /> + <option name="GITHUB_WIKI_LINKS" value="true" /> + <option name="HEADER_ID_NO_DUPED_DASHES" value="false" /> + <option name="JEKYLL_FRONT_MATTER" value="false" /> + <option name="NO_TEXT_ATTRIBUTES" value="false" /> + <option name="PARSE_HTML_ANCHOR_ID" value="false" /> + <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" /> + </ParserOptions> + </ParserSettings> + <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true" embedImages="false" embedHttpImages="false" imageUriSerials="false"> + <GeneratorProvider> + <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" /> + </GeneratorProvider> + <headerTop /> + <headerBottom /> + <bodyTop /> + <bodyBottom /> + </HtmlSettings> + <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="false" isCssTextEnabled="false" isDynamicPageWidth="true"> + <StylesheetProvider> + <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" /> + </StylesheetProvider> + <ScriptProviders /> + <cssText /> + <cssUriHistory /> + </CssSettings> + <HtmlExportSettings updateOnSave="false" parentDir="" targetDir="" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" /> + <LinkMapSettings> + <textMaps /> + </LinkMapSettings> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/blob/.idea/markdown-navigator/profiles_settings.xml b/node_modules/blob/.idea/markdown-navigator/profiles_settings.xml @@ -0,0 +1,3 @@ +<component name="MarkdownNavigator.ProfileManager"> + <settings default="" pdf-export="" /> +</component>+ \ No newline at end of file diff --git a/node_modules/blob/.idea/modules.xml b/node_modules/blob/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/blob.iml" filepath="$PROJECT_DIR$/.idea/blob.iml" /> + </modules> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/blob/.idea/vcs.xml b/node_modules/blob/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/blob/.idea/workspace.xml b/node_modules/blob/.idea/workspace.xml @@ -0,0 +1,390 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <list default="true" id="584fee10-991c-4143-af70-57730369b503" name="Default Changelist" comment="" /> + <ignored path="$PROJECT_DIR$/.tmp/" /> + <ignored path="$PROJECT_DIR$/temp/" /> + <ignored path="$PROJECT_DIR$/tmp/" /> + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <option name="SHOW_DIALOG" value="false" /> + <option name="HIGHLIGHT_CONFLICTS" value="true" /> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> + <option name="LAST_RESOLUTION" value="IGNORE" /> + </component> + <component name="FUSProjectUsageTrigger"> + <session id="424275792"> + <usages-collector id="statistics.lifecycle.project"> + <counts> + <entry key="project.open.time.3" value="1" /> + <entry key="project.opened" value="1" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.extensions.open"> + <counts> + <entry key="Makefile" value="3" /> + <entry key="gitignore" value="3" /> + <entry key="js" value="6" /> + <entry key="json" value="4" /> + <entry key="md" value="3" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.types.open"> + <counts> + <entry key="Git file" value="3" /> + <entry key="JSON" value="4" /> + <entry key="JavaScript" value="6" /> + <entry key="Markdown" value="3" /> + <entry key="PLAIN_TEXT" value="3" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.extensions.edit"> + <counts> + <entry key="json" value="9" /> + <entry key="txt" value="34" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.types.edit"> + <counts> + <entry key="JSON" value="9" /> + <entry key="PLAIN_TEXT" value="34" /> + </counts> + </usages-collector> + <usages-collector id="statistics.vcs.git.usages"> + <counts> + <entry key="git.branch.checkout.local" value="2" /> + <entry key="git.branch.checkout.remote" value="2" /> + <entry key="git.branch.delete.local" value="2" /> + <entry key="git.branch.merge" value="2" /> + <entry key="git.branch.rebase" value="2" /> + </counts> + </usages-collector> + </session> + </component> + <component name="FileEditorManager"> + <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/index.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="578"> + <caret line="34" column="3" selection-start-line="34" selection-start-column="3" selection-end-line="34" selection-end-column="3" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/package.json"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="137"> + <caret line="11" column="24" selection-start-line="11" selection-start-column="24" selection-end-line="11" selection-end-column="24" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/.gitignore"> + <provider selected="true" editor-type-id="text-editor" /> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/Makefile"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="136"> + <caret line="8" column="46" selection-start-line="8" selection-start-column="25" selection-end-line="8" selection-end-column="46" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/test/index.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="136"> + <caret line="8" column="26" selection-start-line="8" selection-start-column="26" selection-end-line="8" selection-end-column="26" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/README.md"> + <provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]"> + <state split_layout="SPLIT"> + <first_editor relative-caret-position="204"> + <caret line="12" selection-start-line="12" selection-end-line="12" /> + </first_editor> + <second_editor> + <markdownNavigatorState /> + </second_editor> + </state> + </provider> + </entry> + </file> + </leaf> + </component> + <component name="FindInProjectRecents"> + <findStrings> + <find>esprima-six</find> + </findStrings> + </component> + <component name="Git.Settings"> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> + <option name="RECENT_BRANCH_BY_REPOSITORY"> + <map> + <entry key="$PROJECT_DIR$" value="patch-1" /> + </map> + </option> + <option name="RESET_MODE" value="KEEP" /> + </component> + <component name="IdeDocumentHistory"> + <option name="CHANGED_PATHS"> + <list> + <option value="$PROJECT_DIR$/package.json" /> + </list> + </option> + </component> + <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" /> + <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER"> + <package-json value="$PROJECT_DIR$/package.json" /> + </component> + <component name="JsGulpfileManager"> + <detection-done>true</detection-done> + <sorting>DEFINITION_ORDER</sorting> + </component> + <component name="NodeModulesDirectoryManager"> + <handled-path value="$PROJECT_DIR$/node_modules" /> + </component> + <component name="NodePackageJsonFileManager"> + <packageJsonPaths> + <path value="$PROJECT_DIR$/package.json" /> + </packageJsonPaths> + </component> + <component name="ProjectFrameBounds" extendedState="6"> + <option name="x" value="-9" /> + <option name="width" value="1935" /> + <option name="height" value="1029" /> + </component> + <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> + <component name="ProjectView"> + <navigator proportions="" version="1"> + <foldersAlwaysOnTop value="true" /> + </navigator> + <panes> + <pane id="ProjectPane"> + <subPane> + <expand> + <path> + <item name="blob" type="b2602c69:ProjectViewProjectNode" /> + <item name="blob" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="blob" type="b2602c69:ProjectViewProjectNode" /> + <item name="blob" type="462c0819:PsiDirectoryNode" /> + <item name="test" type="462c0819:PsiDirectoryNode" /> + </path> + </expand> + <select /> + </subPane> + </pane> + <pane id="Scope" /> + </panes> + </component> + <component name="PropertiesComponent"> + <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="nodejs.mocha.mocha_node_package_dir" value="$PROJECT_DIR$/node_modules/mocha" /> + <property name="nodejs_interpreter_path.stuck_in_default_project" value="C:/Program Files/nodejs/node" /> + <property name="nodejs_npm_path_reset_for_default_project" value="true" /> + <property name="nodejs_package_manager_path" value="npm" /> + </component> + <component name="RunDashboard"> + <option name="ruleStates"> + <list> + <RuleState> + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> + </RuleState> + <RuleState> + <option name="name" value="StatusDashboardGroupingRule" /> + </RuleState> + </list> + </option> + </component> + <component name="RunManager" selected="Mocha.blob"> + <configuration name="test" type="js.build_tools.npm" factoryName="npm" temporary="true" nameIsGenerated="true"> + <package-json value="$PROJECT_DIR$/package.json" /> + <command value="run" /> + <scripts> + <script value="test" /> + </scripts> + <node-interpreter value="project" /> + <envs /> + <method v="2" /> + </configuration> + <configuration name="blob" type="mocha-javascript-test-runner" factoryName="Mocha" temporary="true" nameIsGenerated="true"> + <node-interpreter>project</node-interpreter> + <node-options /> + <working-directory>$PROJECT_DIR$</working-directory> + <pass-parent-env>true</pass-parent-env> + <ui>bdd</ui> + <extra-mocha-options /> + <test-kind>SUITE</test-kind> + <test-file>$PROJECT_DIR$/test/index.js</test-file> + <test-names> + <name value="blob" /> + </test-names> + <method v="2" /> + </configuration> + <list> + <item itemvalue="npm.test" /> + <item itemvalue="Mocha.blob" /> + </list> + <recent_temporary> + <list> + <item itemvalue="Mocha.blob" /> + <item itemvalue="npm.test" /> + <item itemvalue="Mocha.blob" /> + <item itemvalue="npm.test" /> + <item itemvalue="Mocha.blob" /> + </list> + </recent_temporary> + </component> + <component name="SvnConfiguration"> + <configuration /> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"> + <changelist id="584fee10-991c-4143-af70-57730369b503" name="Default Changelist" comment="" /> + <created>1541010775450</created> + <option name="number" value="Default" /> + <option name="presentableId" value="Default" /> + <updated>1541010775450</updated> + <workItem from="1541010778407" duration="2946000" /> + </task> + <task id="LOCAL-00001" summary="update browserify and zuul to avoid esprima-six issue"> + <created>1541013247794</created> + <option name="number" value="00001" /> + <option name="presentableId" value="LOCAL-00001" /> + <option name="project" value="LOCAL" /> + <updated>1541013247795</updated> + </task> + <option name="localTasksCounter" value="2" /> + <servers /> + </component> + <component name="TestHistory"> + <history-entry file="blob - 2018.10.31 at 21h 11m 12s.xml"> + <configuration name="blob" configurationId="mocha-javascript-test-runner" /> + </history-entry> + </component> + <component name="TimeTrackingManager"> + <option name="totallyTimeSpent" value="2946000" /> + </component> + <component name="TodoView"> + <todo-panel id="selected-file"> + <is-autoscroll-to-source value="true" /> + </todo-panel> + <todo-panel id="all"> + <are-packages-shown value="true" /> + <is-autoscroll-to-source value="true" /> + </todo-panel> + </component> + <component name="ToolWindowManager"> + <frame x="-7" y="-7" width="1550" height="838" extended-state="6" /> + <layout> + <window_info id="npm" side_tool="true" /> + <window_info id="Favorites" side_tool="true" /> + <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24983476" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info anchor="bottom" id="Docker" show_stripe_button="false" /> + <window_info anchor="bottom" id="Version Control" visible="true" weight="0.44948757" /> + <window_info anchor="bottom" id="Terminal" weight="0.55051243" /> + <window_info anchor="bottom" id="Event Log" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="0" /> + <window_info anchor="bottom" id="Find" order="1" /> + <window_info anchor="bottom" id="Run" order="2" weight="0.47291362" /> + <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="6" weight="0.329429" /> + <window_info anchor="right" id="Commander" order="0" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + </layout> + </component> + <component name="TypeScriptGeneratedFilesManager"> + <option name="version" value="1" /> + </component> + <component name="Vcs.Log.Tabs.Properties"> + <option name="TAB_STATES"> + <map> + <entry key="MAIN"> + <value> + <State> + <option name="RECENTLY_FILTERED_USER_GROUPS"> + <collection /> + </option> + <option name="RECENTLY_FILTERED_BRANCH_GROUPS"> + <collection /> + </option> + <option name="COLUMN_ORDER"> + <list> + <option value="0" /> + <option value="1" /> + <option value="2" /> + <option value="3" /> + </list> + </option> + </State> + </value> + </entry> + </map> + </option> + </component> + <component name="VcsContentAnnotationSettings"> + <option name="myLimit" value="2678400000" /> + </component> + <component name="VcsManagerConfiguration"> + <MESSAGE value="update browserify and zuul to avoid esprima-six issue" /> + <option name="LAST_COMMIT_MESSAGE" value="update browserify and zuul to avoid esprima-six issue" /> + </component> + <component name="editorHistoryManager"> + <entry file="file://$PROJECT_DIR$/index.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="578"> + <caret line="34" column="3" selection-start-line="34" selection-start-column="3" selection-end-line="34" selection-end-column="3" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/.gitignore"> + <provider selected="true" editor-type-id="text-editor" /> + </entry> + <entry file="file://$PROJECT_DIR$/Makefile"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="136"> + <caret line="8" column="46" selection-start-line="8" selection-start-column="25" selection-end-line="8" selection-end-column="46" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/test/index.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="136"> + <caret line="8" column="26" selection-start-line="8" selection-start-column="26" selection-end-line="8" selection-end-column="26" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/README.md"> + <provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]"> + <state split_layout="SPLIT"> + <first_editor relative-caret-position="204"> + <caret line="12" selection-start-line="12" selection-end-line="12" /> + </first_editor> + <second_editor> + <markdownNavigatorState /> + </second_editor> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/package.json"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="137"> + <caret line="11" column="24" selection-start-line="11" selection-start-column="24" selection-end-line="11" selection-end-column="24" /> + </state> + </provider> + </entry> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/blob/.zuul.yml b/node_modules/blob/.zuul.yml @@ -0,0 +1,14 @@ +ui: mocha-bdd +browsers: + - name: chrome + version: 8..latest + - name: firefox + version: 7..latest + - name: safari + version: 6..latest + - name: opera + version: 12.1..latest + - name: ie + version: 10..latest + - name: android + version: latest diff --git a/node_modules/blob/LICENSE b/node_modules/blob/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (C) 2014 Rase- + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/blob/Makefile b/node_modules/blob/Makefile @@ -0,0 +1,14 @@ +REPORTER = dot + +build: blob.js + +blob.js: + @./node_modules/.bin/browserify --standalone blob index.js > blob.js + +test: + @./node_modules/.bin/zuul -- test/index.js + +clean: + rm blob.js + +.PHONY: test blob.js diff --git a/node_modules/blob/README.md b/node_modules/blob/README.md @@ -0,0 +1,21 @@ +# Blob + +A cross-browser `Blob` that falls back to `BlobBuilder` when appropriate. +If neither is available, it exports `undefined`. + +## Installation + +``` bash +$ npm install blob +``` + +## Example + +``` js +var Blob = require('blob'); +var b = new Blob(['hi', 'constructing', 'a', 'blob']); +``` + +## License + +MIT diff --git a/node_modules/blob/component.json b/node_modules/blob/component.json @@ -0,0 +1,11 @@ +{ + "name": "blob", + "repo": "webmodules/blob", + "description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.", + "version": "0.0.4", + "license": "MIT", + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/node_modules/blob/index.js b/node_modules/blob/index.js @@ -0,0 +1,100 @@ +/** + * Create a blob builder even when vendor prefixes exist + */ + +var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : + typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder : + typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : + typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : + false; + +/** + * Check if Blob constructor is supported + */ + +var blobSupported = (function() { + try { + var a = new Blob(['hi']); + return a.size === 2; + } catch(e) { + return false; + } +})(); + +/** + * Check if Blob constructor supports ArrayBufferViews + * Fails in Safari 6, so we need to map to ArrayBuffers there. + */ + +var blobSupportsArrayBufferView = blobSupported && (function() { + try { + var b = new Blob([new Uint8Array([1,2])]); + return b.size === 2; + } catch(e) { + return false; + } +})(); + +/** + * Check if BlobBuilder is supported + */ + +var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + +/** + * Helper function that maps ArrayBufferViews to ArrayBuffers + * Used by BlobBuilder constructor and old browsers that didn't + * support it in the Blob constructor. + */ + +function mapArrayBufferViews(ary) { + return ary.map(function(chunk) { + if (chunk.buffer instanceof ArrayBuffer) { + var buf = chunk.buffer; + + // if this is a subarray, make a copy so we only + // include the subarray region from the underlying buffer + if (chunk.byteLength !== buf.byteLength) { + var copy = new Uint8Array(chunk.byteLength); + copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); + buf = copy.buffer; + } + + return buf; + } + + return chunk; + }); +} + +function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + mapArrayBufferViews(ary).forEach(function(part) { + bb.append(part); + }); + + return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); +}; + +function BlobConstructor(ary, options) { + return new Blob(mapArrayBufferViews(ary), options || {}); +}; + +if (typeof Blob !== 'undefined') { + BlobBuilderConstructor.prototype = Blob.prototype; + BlobConstructor.prototype = Blob.prototype; +} + +module.exports = (function() { + if (blobSupported) { + return blobSupportsArrayBufferView ? Blob : BlobConstructor; + } else if (blobBuilderSupported) { + return BlobBuilderConstructor; + } else { + return undefined; + } +})(); diff --git a/node_modules/blob/package.json b/node_modules/blob/package.json @@ -0,0 +1,49 @@ +{ + "_from": "blob@0.0.5", + "_id": "blob@0.0.5", + "_inBundle": false, + "_integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==", + "_location": "/blob", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "blob@0.0.5", + "name": "blob", + "escapedName": "blob", + "rawSpec": "0.0.5", + "saveSpec": null, + "fetchSpec": "0.0.5" + }, + "_requiredBy": [ + "/engine.io-parser" + ], + "_resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "_shasum": "d680eeef25f8cd91ad533f5b01eed48e64caf683", + "_spec": "blob@0.0.5", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-parser", + "bugs": { + "url": "https://github.com/webmodules/blob/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.", + "devDependencies": { + "browserify": "4.2.3", + "expect.js": "0.2.0", + "mocha": "1.17.1", + "zuul": "1.10.2" + }, + "homepage": "https://github.com/webmodules/blob", + "license": "MIT", + "name": "blob", + "repository": { + "type": "git", + "url": "git://github.com/webmodules/blob.git" + }, + "scripts": { + "test": "make test" + }, + "version": "0.0.5" +} diff --git a/node_modules/blob/test/index.js b/node_modules/blob/test/index.js @@ -0,0 +1,100 @@ +var Blob = require('../'); +var expect = require('expect.js'); + +describe('blob', function() { + if (!Blob) { + it('should not have a blob or a blob builder in the global namespace, or blob should not be a constructor function if the module exports false', function() { + try { + var ab = (new Uint8Array(5)).buffer; + global.Blob([ab]); + expect().fail('Blob shouldn\'t be constructable'); + } catch (e) {} + + var BlobBuilder = global.BlobBuilder + || global.WebKitBlobBuilder + || global.MSBlobBuilder + || global.MozBlobBuilder; + expect(BlobBuilder).to.be(undefined); + }); + } else { + it('should encode a proper sized blob when given a string argument', function() { + var b = new Blob(['hi']); + expect(b.size).to.be(2); + }); + + it('should encode a blob with proper size when given two strings as arguments', function() { + var b = new Blob(['hi', 'hello']); + expect(b.size).to.be(7); + }); + + it('should encode arraybuffers with right content', function(done) { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([ary.buffer]); + var fr = new FileReader(); + fr.onload = function() { + var newAry = new Uint8Array(this.result); + for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); + done(); + }; + fr.readAsArrayBuffer(b); + }); + + it('should encode typed arrays with right content', function(done) { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([ary]); + var fr = new FileReader(); + fr.onload = function() { + var newAry = new Uint8Array(this.result); + for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); + done(); + }; + fr.readAsArrayBuffer(b); + }); + + it('should encode sliced typed arrays with right content', function(done) { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([ary.subarray(2)]); + var fr = new FileReader(); + fr.onload = function() { + var newAry = new Uint8Array(this.result); + for (var i = 0; i < 3; i++) expect(newAry[i]).to.be(i + 2); + done(); + }; + fr.readAsArrayBuffer(b); + }); + + it('should encode with blobs', function(done) { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([new Blob([ary.buffer])]); + var fr = new FileReader(); + fr.onload = function() { + var newAry = new Uint8Array(this.result); + for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i); + done(); + }; + fr.readAsArrayBuffer(b); + }); + + it('should enode mixed contents to right size', function() { + var ary = new Uint8Array(5); + for (var i = 0; i < 5; i++) ary[i] = i; + var b = new Blob([ary.buffer, 'hello']); + expect(b.size).to.be(10); + }); + + it('should accept mime type', function() { + var b = new Blob(['hi', 'hello'], { type: 'text/html' }); + expect(b.type).to.be('text/html'); + }); + + it('should be an instance of constructor', function() { + var b = new Blob(['hi']); + expect(b).to.be.a(Blob); + expect(b).to.be.a(global.Blob); + }); + } +}); diff --git a/node_modules/callsite/.npmignore b/node_modules/callsite/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/callsite/History.md b/node_modules/callsite/History.md @@ -0,0 +1,10 @@ + +1.0.0 / 2013-01-24 +================== + + * remove lame magical getters + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/callsite/Makefile b/node_modules/callsite/Makefile @@ -0,0 +1,6 @@ + +test: + @./node_modules/.bin/mocha \ + --require should + +.PHONY: test+ \ No newline at end of file diff --git a/node_modules/callsite/Readme.md b/node_modules/callsite/Readme.md @@ -0,0 +1,44 @@ +# callstack + + Access to v8's "raw" `CallSite`s. + +## Installation + + $ npm install callsite + +## Example + +```js +var stack = require('callsite'); + +foo(); + +function foo() { + bar(); +} + +function bar() { + baz(); +} + +function baz() { + console.log(); + stack().forEach(function(site){ + console.log(' \033[36m%s\033[90m in %s:%d\033[0m' + , site.getFunctionName() || 'anonymous' + , site.getFileName() + , site.getLineNumber()); + }); + console.log(); +} +``` + +## Why? + + Because you can do weird, stupid, clever, wacky things such as: + + - [better-assert](https://github.com/visionmedia/better-assert) + +## License + + MIT diff --git a/node_modules/callsite/index.js b/node_modules/callsite/index.js @@ -0,0 +1,10 @@ + +module.exports = function(){ + var orig = Error.prepareStackTrace; + Error.prepareStackTrace = function(_, stack){ return stack; }; + var err = new Error; + Error.captureStackTrace(err, arguments.callee); + var stack = err.stack; + Error.prepareStackTrace = orig; + return stack; +}; diff --git a/node_modules/callsite/package.json b/node_modules/callsite/package.json @@ -0,0 +1,48 @@ +{ + "_from": "callsite@1.0.0", + "_id": "callsite@1.0.0", + "_inBundle": false, + "_integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "_location": "/callsite", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "callsite@1.0.0", + "name": "callsite", + "escapedName": "callsite", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/better-assert" + ], + "_resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "_shasum": "280398e5d664bd74038b6f0905153e6e8af1bc20", + "_spec": "callsite@1.0.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/better-assert", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "access to v8's CallSites", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": "*" + }, + "keywords": [ + "stack", + "trace", + "line" + ], + "main": "index", + "name": "callsite", + "version": "1.0.0" +} diff --git a/node_modules/component-bind/.npmignore b/node_modules/component-bind/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/component-bind/History.md b/node_modules/component-bind/History.md @@ -0,0 +1,13 @@ + +1.0.0 / 2014-05-27 +================== + + * index: use slice ref (#7, @viatropos) + * package: rename package to "component-bind" + * package: add "repository" field (#6, @repoify) + * package: add "component" section + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/component-bind/Makefile b/node_modules/component-bind/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test+ \ No newline at end of file diff --git a/node_modules/component-bind/Readme.md b/node_modules/component-bind/Readme.md @@ -0,0 +1,64 @@ +# bind + + Function binding utility. + +## Installation + +``` +$ component install component/bind +``` + +## API + + - [bind(obj, fn)](#bindobj-fn) + - [bind(obj, fn, ...)](#bindobj-fn-) + - [bind(obj, name)](#bindobj-name) +<a name=""></a> + +<a name="bindobj-fn"></a> +### bind(obj, fn) +should bind the function to the given object. + +```js +var tobi = { name: 'tobi' }; + +function name() { + return this.name; +} + +var fn = bind(tobi, name); +fn().should.equal('tobi'); +``` + +<a name="bindobj-fn-"></a> +### bind(obj, fn, ...) +should curry the remaining arguments. + +```js +function add(a, b) { + return a + b; +} + +bind(null, add)(1, 2).should.equal(3); +bind(null, add, 1)(2).should.equal(3); +bind(null, add, 1, 2)().should.equal(3); +``` + +<a name="bindobj-name"></a> +### bind(obj, name) +should bind the method of the given name. + +```js +var tobi = { name: 'tobi' }; + +tobi.getName = function() { + return this.name; +}; + +var fn = bind(tobi, 'getName'); +fn().should.equal('tobi'); +``` + +## License + + MIT+ \ No newline at end of file diff --git a/node_modules/component-bind/component.json b/node_modules/component-bind/component.json @@ -0,0 +1,13 @@ +{ + "name": "bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/node_modules/component-bind/index.js b/node_modules/component-bind/index.js @@ -0,0 +1,23 @@ +/** + * Slice reference. + */ + +var slice = [].slice; + +/** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + +module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } +}; diff --git a/node_modules/component-bind/package.json b/node_modules/component-bind/package.json @@ -0,0 +1,51 @@ +{ + "_from": "component-bind@1.0.0", + "_id": "component-bind@1.0.0", + "_inBundle": false, + "_integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "_location": "/component-bind", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "component-bind@1.0.0", + "name": "component-bind", + "escapedName": "component-bind", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "_shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", + "_spec": "component-bind@1.0.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "bugs": { + "url": "https://github.com/component/bind/issues" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "bind/index.js": "index.js" + } + }, + "deprecated": false, + "description": "function binding utility", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "homepage": "https://github.com/component/bind#readme", + "keywords": [ + "bind", + "utility" + ], + "name": "component-bind", + "repository": { + "type": "git", + "url": "git+https://github.com/component/bind.git" + }, + "version": "1.0.0" +} diff --git a/node_modules/component-emitter/History.md b/node_modules/component-emitter/History.md @@ -0,0 +1,68 @@ + +1.2.1 / 2016-04-18 +================== + + * enable client side use + +1.2.0 / 2014-02-12 +================== + + * prefix events with `$` to support object prototype method names + +1.1.3 / 2014-06-20 +================== + + * republish for npm + * add LICENSE file + +1.1.2 / 2014-02-10 +================== + + * package: rename to "component-emitter" + * package: update "main" and "component" fields + * Add license to Readme (same format as the other components) + * created .npmignore + * travis stuff + +1.1.1 / 2013-12-01 +================== + + * fix .once adding .on to the listener + * docs: Emitter#off() + * component: add `.repo` prop + +1.1.0 / 2013-10-20 +================== + + * add `.addEventListener()` and `.removeEventListener()` aliases + +1.0.1 / 2013-06-27 +================== + + * add support for legacy ie + +1.0.0 / 2013-02-26 +================== + + * add `.off()` support for removing all listeners + +0.0.6 / 2012-10-08 +================== + + * add `this._callbacks` initialization to prevent funky gotcha + +0.0.5 / 2012-09-07 +================== + + * fix `Emitter.call(this)` usage + +0.0.3 / 2012-07-11 +================== + + * add `.listeners()` + * rename `.has()` to `.hasListeners()` + +0.0.2 / 2012-06-28 +================== + + * fix `.off()` with `.once()`-registered callbacks diff --git a/node_modules/component-emitter/LICENSE b/node_modules/component-emitter/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 Component contributors <dev@component.io> + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/component-emitter/Readme.md b/node_modules/component-emitter/Readme.md @@ -0,0 +1,74 @@ +# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter) + + Event emitter component. + +## Installation + +``` +$ component install component/emitter +``` + +## API + +### Emitter(obj) + + The `Emitter` may also be used as a mixin. For example + a "plain" object may become an emitter, or you may + extend an existing prototype. + + As an `Emitter` instance: + +```js +var Emitter = require('emitter'); +var emitter = new Emitter; +emitter.emit('something'); +``` + + As a mixin: + +```js +var Emitter = require('emitter'); +var user = { name: 'tobi' }; +Emitter(user); + +user.emit('im a user'); +``` + + As a prototype mixin: + +```js +var Emitter = require('emitter'); +Emitter(User.prototype); +``` + +### Emitter#on(event, fn) + + Register an `event` handler `fn`. + +### Emitter#once(event, fn) + + Register a single-shot `event` handler `fn`, + removed immediately after it is invoked the + first time. + +### Emitter#off(event, fn) + + * Pass `event` and `fn` to remove a listener. + * Pass `event` to remove all listeners on that event. + * Pass nothing to remove all listeners on all events. + +### Emitter#emit(event, ...) + + Emit an `event` with variable option args. + +### Emitter#listeners(event) + + Return an array of callbacks, or an empty array. + +### Emitter#hasListeners(event) + + Check if this emitter has `event` handlers. + +## License + +MIT diff --git a/node_modules/component-emitter/index.js b/node_modules/component-emitter/index.js @@ -0,0 +1,163 @@ + +/** + * Expose `Emitter`. + */ + +if (typeof module !== 'undefined') { + module.exports = Emitter; +} + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; diff --git a/node_modules/component-emitter/package.json b/node_modules/component-emitter/package.json @@ -0,0 +1,59 @@ +{ + "_from": "component-emitter@1.2.1", + "_id": "component-emitter@1.2.1", + "_inBundle": false, + "_integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "_location": "/component-emitter", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "component-emitter@1.2.1", + "name": "component-emitter", + "escapedName": "component-emitter", + "rawSpec": "1.2.1", + "saveSpec": null, + "fetchSpec": "1.2.1" + }, + "_requiredBy": [ + "/engine.io-client", + "/socket.io-client", + "/socket.io-client/socket.io-parser", + "/socket.io-parser" + ], + "_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "_shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6", + "_spec": "component-emitter@1.2.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "bugs": { + "url": "https://github.com/component/emitter/issues" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "emitter/index.js": "index.js" + } + }, + "deprecated": false, + "description": "Event emitter", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "files": [ + "index.js", + "LICENSE" + ], + "homepage": "https://github.com/component/emitter#readme", + "license": "MIT", + "main": "index.js", + "name": "component-emitter", + "repository": { + "type": "git", + "url": "git+https://github.com/component/emitter.git" + }, + "scripts": { + "test": "make test" + }, + "version": "1.2.1" +} diff --git a/node_modules/component-inherit/.npmignore b/node_modules/component-inherit/.npmignore @@ -0,0 +1,3 @@ +components +build +node_modules diff --git a/node_modules/component-inherit/History.md b/node_modules/component-inherit/History.md @@ -0,0 +1,5 @@ + +0.0.2 / 2012-09-03 +================== + + * fix typo in package.json diff --git a/node_modules/component-inherit/Makefile b/node_modules/component-inherit/Makefile @@ -0,0 +1,16 @@ + +build: components index.js + @component build + +components: + @Component install + +clean: + rm -fr build components template.js + +test: + @node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: clean test diff --git a/node_modules/component-inherit/Readme.md b/node_modules/component-inherit/Readme.md @@ -0,0 +1,24 @@ +# inherit + + Prototype inheritance utility. + +## Installation + +``` +$ component install component/inherit +``` + +## Example + +```js +var inherit = require('inherit'); + +function Human() {} +function Woman() {} + +inherit(Woman, Human); +``` + +## License + + MIT diff --git a/node_modules/component-inherit/component.json b/node_modules/component-inherit/component.json @@ -0,0 +1,10 @@ +{ + "name": "inherit", + "description": "Prototype inheritance utility", + "version": "0.0.3", + "keywords": ["inherit", "utility"], + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/node_modules/component-inherit/index.js b/node_modules/component-inherit/index.js @@ -0,0 +1,7 @@ + +module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; +};+ \ No newline at end of file diff --git a/node_modules/component-inherit/package.json b/node_modules/component-inherit/package.json @@ -0,0 +1,48 @@ +{ + "_from": "component-inherit@0.0.3", + "_id": "component-inherit@0.0.3", + "_inBundle": false, + "_integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "_location": "/component-inherit", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "component-inherit@0.0.3", + "name": "component-inherit", + "escapedName": "component-inherit", + "rawSpec": "0.0.3", + "saveSpec": null, + "fetchSpec": "0.0.3" + }, + "_requiredBy": [ + "/engine.io-client" + ], + "_resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "_shasum": "645fc4adf58b72b649d5cae65135619db26ff143", + "_spec": "component-inherit@0.0.3", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client", + "bugs": { + "url": "https://github.com/component/inherit/issues" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "inherit/index.js": "index.js" + } + }, + "dependencies": {}, + "deprecated": false, + "description": "Prototype inheritance utility", + "homepage": "https://github.com/component/inherit#readme", + "keywords": [ + "inherit", + "utility" + ], + "name": "component-inherit", + "repository": { + "type": "git", + "url": "git+https://github.com/component/inherit.git" + }, + "version": "0.0.3" +} diff --git a/node_modules/component-inherit/test/inherit.js b/node_modules/component-inherit/test/inherit.js @@ -0,0 +1,21 @@ + +/** + * Module dependencies. + */ + +var inherit = require('..'); + +describe('inherit(a, b)', function(){ + it('should inherit b\'s prototype', function(){ + function Loki(){} + function Animal(){} + + Animal.prototype.species = 'unknown'; + + inherit(Loki, Animal); + + var loki = new Loki; + loki.species.should.equal('unknown'); + loki.constructor.should.equal(Loki); + }) +})+ \ No newline at end of file diff --git a/node_modules/ejs/LICENSE b/node_modules/ejs/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/ejs/README.md b/node_modules/ejs/README.md @@ -0,0 +1,273 @@ +# EJS + +Embedded JavaScript templates + +[![Build Status](https://img.shields.io/travis/mde/ejs/master.svg?style=flat)](https://travis-ci.org/mde/ejs) +[![Developing Dependencies](https://img.shields.io/david/dev/mde/ejs.svg?style=flat)](https://david-dm.org/mde/ejs?type=dev) +[![Known Vulnerabilities](https://snyk.io/test/npm/ejs/badge.svg?style=flat)](https://snyk.io/test/npm/ejs) + +## Installation + +```bash +$ npm install ejs +``` + +## Features + + * Control flow with `<% %>` + * Escaped output with `<%= %>` (escape function configurable) + * Unescaped raw output with `<%- %>` + * Newline-trim mode ('newline slurping') with `-%>` ending tag + * Whitespace-trim mode (slurp all whitespace) for control flow with `<%_ _%>` + * Custom delimiters (e.g., use `<? ?>` instead of `<% %>`) + * Includes + * Client-side support + * Static caching of intermediate JavaScript + * Static caching of templates + * Complies with the [Express](http://expressjs.com) view system + +## Example + +```ejs +<% if (user) { %> + <h2><%= user.name %></h2> +<% } %> +``` + +Try EJS online at: https://ionicabizau.github.io/ejs-playground/. + +## Usage + +```javascript +let template = ejs.compile(str, options); +template(data); +// => Rendered HTML string + +ejs.render(str, data, options); +// => Rendered HTML string + +ejs.renderFile(filename, data, options, function(err, str){ + // str => Rendered HTML string +}); +``` + +It is also possible to use `ejs.render(dataAndOptions);` where you pass +everything in a single object. In that case, you'll end up with local variables +for all the passed options. However, be aware that your code could break if we +add an option with the same name as one of your data object's properties. +Therefore, we do not recommend using this shortcut. + +## Options + + - `cache` Compiled functions are cached, requires `filename` + - `filename` The name of the file being rendered. Not required if you + are using `renderFile()`. Used by `cache` to key caches, and for includes. + - `root` Set project root for includes with an absolute path (/file.ejs). + - `context` Function execution context + - `compileDebug` When `false` no debug instrumentation is compiled + - `client` When `true`, compiles a function that can be rendered + in the browser without needing to load the EJS Runtime + ([ejs.min.js](https://github.com/mde/ejs/releases/latest)). + - `delimiter` Character to use with angle brackets for open/close + - `debug` Output generated function body + - `strict` When set to `true`, generated function is in strict mode + - `_with` Whether or not to use `with() {}` constructs. If `false` + then the locals will be stored in the `locals` object. Set to `false` in strict mode. + - `destructuredLocals` An array of local variables that are always destructured from + the locals object, available even in strict mode. + - `localsName` Name to use for the object storing local variables when not using + `with` Defaults to `locals` + - `rmWhitespace` Remove all safe-to-remove whitespace, including leading + and trailing whitespace. It also enables a safer version of `-%>` line + slurping for all scriptlet tags (it does not strip new lines of tags in + the middle of a line). + - `escape` The escaping function used with `<%=` construct. It is + used in rendering and is `.toString()`ed in the generation of client functions. + (By default escapes XML). + - `outputFunctionName` Set to a string (e.g., 'echo' or 'print') for a function to print + output inside scriptlet tags. + - `async` When `true`, EJS will use an async function for rendering. (Depends + on async/await support in the JS runtime. + +This project uses [JSDoc](http://usejsdoc.org/). For the full public API +documentation, clone the repository and run `npm run doc`. This will run JSDoc +with the proper options and output the documentation to `out/`. If you want +the both the public & private API docs, run `npm run devdoc` instead. + +## Tags + + - `<%` 'Scriptlet' tag, for control-flow, no output + - `<%_` 'Whitespace Slurping' Scriptlet tag, strips all whitespace before it + - `<%=` Outputs the value into the template (escaped) + - `<%-` Outputs the unescaped value into the template + - `<%#` Comment tag, no execution, no output + - `<%%` Outputs a literal '<%' + - `%%>` Outputs a literal '%>' + - `%>` Plain ending tag + - `-%>` Trim-mode ('newline slurp') tag, trims following newline + - `_%>` 'Whitespace Slurping' ending tag, removes all whitespace after it + +For the full syntax documentation, please see [docs/syntax.md](https://github.com/mde/ejs/blob/master/docs/syntax.md). + +## Includes + +Includes either have to be an absolute path, or, if not, are assumed as +relative to the template with the `include` call. For example if you are +including `./views/user/show.ejs` from `./views/users.ejs` you would +use `<%- include('user/show') %>`. + +You must specify the `filename` option for the template with the `include` +call unless you are using `renderFile()`. + +You'll likely want to use the raw output tag (`<%-`) with your include to avoid +double-escaping the HTML output. + +```ejs +<ul> + <% users.forEach(function(user){ %> + <%- include('user/show', {user: user}) %> + <% }); %> +</ul> +``` + +Includes are inserted at runtime, so you can use variables for the path in the +`include` call (for example `<%- include(somePath) %>`). Variables in your +top-level data object are available to all your includes, but local variables +need to be passed down. + +NOTE: Include preprocessor directives (`<% include user/show %>`) are +still supported. + +## Custom delimiters + +Custom delimiters can be applied on a per-template basis, or globally: + +```javascript +let ejs = require('ejs'), + users = ['geddy', 'neil', 'alex']; + +// Just one template +ejs.render('<?= users.join(" | "); ?>', {users: users}, {delimiter: '?'}); +// => 'geddy | neil | alex' + +// Or globally +ejs.delimiter = '$'; +ejs.render('<$= users.join(" | "); $>', {users: users}); +// => 'geddy | neil | alex' +``` + +## Caching + +EJS ships with a basic in-process cache for caching the intermediate JavaScript +functions used to render templates. It's easy to plug in LRU caching using +Node's `lru-cache` library: + +```javascript +let ejs = require('ejs'), + LRU = require('lru-cache'); +ejs.cache = LRU(100); // LRU cache with 100-item limit +``` + +If you want to clear the EJS cache, call `ejs.clearCache`. If you're using the +LRU cache and need a different limit, simple reset `ejs.cache` to a new instance +of the LRU. + +## Custom file loader + +The default file loader is `fs.readFileSync`, if you want to customize it, you can set ejs.fileLoader. + +```javascript +let ejs = require('ejs'); +let myFileLoad = function (filePath) { + return 'myFileLoad: ' + fs.readFileSync(filePath); +}; + +ejs.fileLoader = myFileLoad; +``` + +With this feature, you can preprocess the template before reading it. + +## Layouts + +EJS does not specifically support blocks, but layouts can be implemented by +including headers and footers, like so: + + +```ejs +<%- include('header') -%> +<h1> + Title +</h1> +<p> + My page +</p> +<%- include('footer') -%> +``` + +## Client-side support + +Go to the [Latest Release](https://github.com/mde/ejs/releases/latest), download +`./ejs.js` or `./ejs.min.js`. Alternately, you can compile it yourself by cloning +the repository and running `jake build` (or `$(npm bin)/jake build` if jake is +not installed globally). + +Include one of these files on your page, and `ejs` should be available globally. + +### Example + +```html +<div id="output"></div> +<script src="ejs.min.js"></script> +<script> + let people = ['geddy', 'neil', 'alex'], + html = ejs.render('<%= people.join(", "); %>', {people: people}); + // With jQuery: + $('#output').html(html); + // Vanilla JS: + document.getElementById('output').innerHTML = html; +</script> +``` + +### Caveats + +Most of EJS will work as expected; however, there are a few things to note: + +1. Obviously, since you do not have access to the filesystem, `ejs.renderFile()` won't work. +2. For the same reason, `include`s do not work unless you use an `include callback`. Here is an example: + ```javascript + let str = "Hello <%= include('file', {person: 'John'}); %>", + fn = ejs.compile(str, {client: true}); + + fn(data, null, function(path, d){ // include callback + // path -> 'file' + // d -> {person: 'John'} + // Put your code here + // Return the contents of file as a string + }); // returns rendered string + ``` + +See the [examples folder](https://github.com/mde/ejs/tree/master/examples) for more details. + +### IDE Integration with Syntax Highlighting + +VSCode:Javascript EJS by *DigitalBrainstem* + +## Related projects + +There are a number of implementations of EJS: + + * TJ's implementation, the v1 of this library: https://github.com/tj/ejs + * Jupiter Consulting's EJS: http://www.embeddedjs.com/ + * EJS Embedded JavaScript Framework on Google Code: https://code.google.com/p/embeddedjavascript/ + * Sam Stephenson's Ruby implementation: https://rubygems.org/gems/ejs + * Erubis, an ERB implementation which also runs JavaScript: http://www.kuwata-lab.com/erubis/users-guide.04.html#lang-javascript + * DigitalBrainstem EJS Language support: https://github.com/Digitalbrainstem/ejs-grammar + +## License + +Licensed under the Apache License, Version 2.0 +(<http://www.apache.org/licenses/LICENSE-2.0>) + +- - - +EJS Embedded JavaScript templates copyright 2112 +mde@fleegix.org. diff --git a/node_modules/ejs/ejs.js b/node_modules/ejs/ejs.js @@ -0,0 +1,1532 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ejs = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +'use strict'; + +/** + * @file Embedded JavaScript templating engine. {@link http://ejs.co} + * @author Matthew Eernisse <mde@fleegix.org> + * @author Tiancheng "Timothy" Gu <timothygu99@gmail.com> + * @project EJS + * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} + */ + +/** + * EJS internal functions. + * + * Technically this "module" lies in the same file as {@link module:ejs}, for + * the sake of organization all the private functions re grouped into this + * module. + * + * @module ejs-internal + * @private + */ + +/** + * Embedded JavaScript templating engine. + * + * @module ejs + * @public + */ + +var fs = require('fs'); +var path = require('path'); +var utils = require('./utils'); + +var scopeOptionWarned = false; +var _VERSION_STRING = require('../package.json').version; +var _DEFAULT_OPEN_DELIMITER = '<'; +var _DEFAULT_CLOSE_DELIMITER = '>'; +var _DEFAULT_DELIMITER = '%'; +var _DEFAULT_LOCALS_NAME = 'locals'; +var _NAME = 'ejs'; +var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)'; +var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compileDebug', + 'client', '_with', 'rmWhitespace', 'strict', 'filename', 'async']; +// We don't allow 'cache' option to be passed in the data obj for +// the normal `render` call, but this is where Express 2 & 3 put it +// so we make an exception for `renderFile` +var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache'); +var _BOM = /^\uFEFF/; + +/** + * EJS template function cache. This can be a LRU object from lru-cache NPM + * module. By default, it is {@link module:utils.cache}, a simple in-process + * cache that grows continuously. + * + * @type {Cache} + */ + +exports.cache = utils.cache; + +/** + * Custom file loader. Useful for template preprocessing or restricting access + * to a certain part of the filesystem. + * + * @type {fileLoader} + */ + +exports.fileLoader = fs.readFileSync; + +/** + * Name of the object containing the locals. + * + * This variable is overridden by {@link Options}`.localsName` if it is not + * `undefined`. + * + * @type {String} + * @public + */ + +exports.localsName = _DEFAULT_LOCALS_NAME; + +/** + * Promise implementation -- defaults to the native implementation if available + * This is mostly just for testability + * + * @type {Function} + * @public + */ + +exports.promiseImpl = (new Function('return this;'))().Promise; + +/** + * Get the path to the included file from the parent file path and the + * specified path. + * + * @param {String} name specified path + * @param {String} filename parent file path + * @param {Boolean} isDir parent file path whether is directory + * @return {String} + */ +exports.resolveInclude = function(name, filename, isDir) { + var dirname = path.dirname; + var extname = path.extname; + var resolve = path.resolve; + var includePath = resolve(isDir ? filename : dirname(filename), name); + var ext = extname(name); + if (!ext) { + includePath += '.ejs'; + } + return includePath; +}; + +/** + * Get the path to the included file by Options + * + * @param {String} path specified path + * @param {Options} options compilation options + * @return {String} + */ +function getIncludePath(path, options) { + var includePath; + var filePath; + var views = options.views; + var match = /^[A-Za-z]+:\\|^\//.exec(path); + + // Abs path + if (match && match.length) { + includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true); + } + // Relative paths + else { + // Look relative to a passed filename first + if (options.filename) { + filePath = exports.resolveInclude(path, options.filename); + if (fs.existsSync(filePath)) { + includePath = filePath; + } + } + // Then look in any views directories + if (!includePath) { + if (Array.isArray(views) && views.some(function (v) { + filePath = exports.resolveInclude(path, v, true); + return fs.existsSync(filePath); + })) { + includePath = filePath; + } + } + if (!includePath) { + throw new Error('Could not find the include file "' + + options.escapeFunction(path) + '"'); + } + } + return includePath; +} + +/** + * Get the template from a string or a file, either compiled on-the-fly or + * read from cache (if enabled), and cache the template if needed. + * + * If `template` is not set, the file specified in `options.filename` will be + * read. + * + * If `options.cache` is true, this function reads the file from + * `options.filename` so it must be set prior to calling this function. + * + * @memberof module:ejs-internal + * @param {Options} options compilation options + * @param {String} [template] template source + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `options.client`, either type might be returned. + * @static + */ + +function handleCache(options, template) { + var func; + var filename = options.filename; + var hasTemplate = arguments.length > 1; + + if (options.cache) { + if (!filename) { + throw new Error('cache option requires a filename'); + } + func = exports.cache.get(filename); + if (func) { + return func; + } + if (!hasTemplate) { + template = fileLoader(filename).toString().replace(_BOM, ''); + } + } + else if (!hasTemplate) { + // istanbul ignore if: should not happen at all + if (!filename) { + throw new Error('Internal EJS error: no file name or template ' + + 'provided'); + } + template = fileLoader(filename).toString().replace(_BOM, ''); + } + func = exports.compile(template, options); + if (options.cache) { + exports.cache.set(filename, func); + } + return func; +} + +/** + * Try calling handleCache with the given options and data and call the + * callback with the result. If an error occurs, call the callback with + * the error. Used by renderFile(). + * + * @memberof module:ejs-internal + * @param {Options} options compilation options + * @param {Object} data template data + * @param {RenderFileCallback} cb callback + * @static + */ + +function tryHandleCache(options, data, cb) { + var result; + if (!cb) { + if (typeof exports.promiseImpl == 'function') { + return new exports.promiseImpl(function (resolve, reject) { + try { + result = handleCache(options)(data); + resolve(result); + } + catch (err) { + reject(err); + } + }); + } + else { + throw new Error('Please provide a callback function'); + } + } + else { + try { + result = handleCache(options)(data); + } + catch (err) { + return cb(err); + } + + cb(null, result); + } +} + +/** + * fileLoader is independent + * + * @param {String} filePath ejs file path. + * @return {String} The contents of the specified file. + * @static + */ + +function fileLoader(filePath){ + return exports.fileLoader(filePath); +} + +/** + * Get the template function. + * + * If `options.cache` is `true`, then the template is cached. + * + * @memberof module:ejs-internal + * @param {String} path path for the specified file + * @param {Options} options compilation options + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `options.client`, either type might be returned + * @static + */ + +function includeFile(path, options) { + var opts = utils.shallowCopy({}, options); + opts.filename = getIncludePath(path, opts); + return handleCache(opts); +} + +/** + * Re-throw the given `err` in context to the `str` of ejs, `filename`, and + * `lineno`. + * + * @implements RethrowCallback + * @memberof module:ejs-internal + * @param {Error} err Error object + * @param {String} str EJS source + * @param {String} filename file name of the EJS file + * @param {String} lineno line number of the error + * @static + */ + +function rethrow(err, str, flnm, lineno, esc){ + var lines = str.split('\n'); + var start = Math.max(lineno - 3, 0); + var end = Math.min(lines.length, lineno + 3); + var filename = esc(flnm); // eslint-disable-line + // Error context + var context = lines.slice(start, end).map(function (line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +function stripSemi(str){ + return str.replace(/;(\s*$)/, '$1'); +} + +/** + * Compile the given `str` of ejs into a template function. + * + * @param {String} template EJS template + * + * @param {Options} opts compilation options + * + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `opts.client`, either type might be returned. + * Note that the return type of the function also depends on the value of `opts.async`. + * @public + */ + +exports.compile = function compile(template, opts) { + var templ; + + // v1 compat + // 'scope' is 'context' + // FIXME: Remove this in a future version + if (opts && opts.scope) { + if (!scopeOptionWarned){ + console.warn('`scope` option is deprecated and will be removed in EJS 3'); + scopeOptionWarned = true; + } + if (!opts.context) { + opts.context = opts.scope; + } + delete opts.scope; + } + templ = new Template(template, opts); + return templ.compile(); +}; + +/** + * Render the given `template` of ejs. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + * + * @param {String} template EJS template + * @param {Object} [data={}] template data + * @param {Options} [opts={}] compilation and rendering options + * @return {(String|Promise<String>)} + * Return value type depends on `opts.async`. + * @public + */ + +exports.render = function (template, d, o) { + var data = d || {}; + var opts = o || {}; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 2) { + utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA); + } + + return handleCache(opts, template)(data); +}; + +/** + * Render an EJS file at the given `path` and callback `cb(err, str)`. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + * + * @param {String} path path to the EJS file + * @param {Object} [data={}] template data + * @param {Options} [opts={}] compilation and rendering options + * @param {RenderFileCallback} cb callback + * @public + */ + +exports.renderFile = function () { + var args = Array.prototype.slice.call(arguments); + var filename = args.shift(); + var cb; + var opts = {filename: filename}; + var data; + var viewOpts; + + // Do we have a callback? + if (typeof arguments[arguments.length - 1] == 'function') { + cb = args.pop(); + } + // Do we have data/opts? + if (args.length) { + // Should always have data obj + data = args.shift(); + // Normal passed opts (data obj + opts obj) + if (args.length) { + // Use shallowCopy so we don't pollute passed in opts obj with new vals + utils.shallowCopy(opts, args.pop()); + } + // Special casing for Express (settings + opts-in-data) + else { + // Express 3 and 4 + if (data.settings) { + // Pull a few things from known locations + if (data.settings.views) { + opts.views = data.settings.views; + } + if (data.settings['view cache']) { + opts.cache = true; + } + // Undocumented after Express 2, but still usable, esp. for + // items that are unsafe to be passed along with data, like `root` + viewOpts = data.settings['view options']; + if (viewOpts) { + utils.shallowCopy(opts, viewOpts); + } + } + // Express 2 and lower, values set in app.locals, or people who just + // want to pass options in their data. NOTE: These values will override + // anything previously set in settings or settings['view options'] + utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS); + } + opts.filename = filename; + } + else { + data = {}; + } + + return tryHandleCache(opts, data, cb); +}; + +/** + * Clear intermediate JavaScript cache. Calls {@link Cache#reset}. + * @public + */ + +/** + * EJS template class + * @public + */ +exports.Template = Template; + +exports.clearCache = function () { + exports.cache.reset(); +}; + +function Template(text, opts) { + opts = opts || {}; + var options = {}; + this.templateText = text; + this.mode = null; + this.truncate = false; + this.currentLine = 1; + this.source = ''; + this.dependencies = []; + options.client = opts.client || false; + options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML; + options.compileDebug = opts.compileDebug !== false; + options.debug = !!opts.debug; + options.filename = opts.filename; + options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER; + options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER; + options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER; + options.strict = opts.strict || false; + options.context = opts.context; + options.cache = opts.cache || false; + options.rmWhitespace = opts.rmWhitespace; + options.root = opts.root; + options.outputFunctionName = opts.outputFunctionName; + options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME; + options.views = opts.views; + options.async = opts.async; + options.destructuredLocals = opts.destructuredLocals; + options.legacyInclude = typeof opts.legacyInclude != 'undefined' ? !!opts.legacyInclude : true; + + if (options.strict) { + options._with = false; + } + else { + options._with = typeof opts._with != 'undefined' ? opts._with : true; + } + + this.opts = options; + + this.regex = this.createRegex(); +} + +Template.modes = { + EVAL: 'eval', + ESCAPED: 'escaped', + RAW: 'raw', + COMMENT: 'comment', + LITERAL: 'literal' +}; + +Template.prototype = { + createRegex: function () { + var str = _REGEX_STRING; + var delim = utils.escapeRegExpChars(this.opts.delimiter); + var open = utils.escapeRegExpChars(this.opts.openDelimiter); + var close = utils.escapeRegExpChars(this.opts.closeDelimiter); + str = str.replace(/%/g, delim) + .replace(/</g, open) + .replace(/>/g, close); + return new RegExp(str); + }, + + compile: function () { + var src; + var fn; + var opts = this.opts; + var prepended = ''; + var appended = ''; + var escapeFn = opts.escapeFunction; + var ctor; + + if (!this.source) { + this.generateSource(); + prepended += + ' var __output = "";\n' + + ' function __append(s) { if (s !== undefined && s !== null) __output += s }\n'; + if (opts.outputFunctionName) { + prepended += ' var ' + opts.outputFunctionName + ' = __append;' + '\n'; + } + if (opts.destructuredLocals && opts.destructuredLocals.length) { + var destructuring = ' var __locals = (' + opts.localsName + ' || {}),\n'; + for (var i = 0; i < opts.destructuredLocals.length; i++) { + var name = opts.destructuredLocals[i]; + if (i > 0) { + destructuring += ',\n '; + } + destructuring += name + ' = __locals.' + name; + } + prepended += destructuring + ';\n'; + } + if (opts._with !== false) { + prepended += ' with (' + opts.localsName + ' || {}) {' + '\n'; + appended += ' }' + '\n'; + } + appended += ' return __output;' + '\n'; + this.source = prepended + this.source + appended; + } + + if (opts.compileDebug) { + src = 'var __line = 1' + '\n' + + ' , __lines = ' + JSON.stringify(this.templateText) + '\n' + + ' , __filename = ' + (opts.filename ? + JSON.stringify(opts.filename) : 'undefined') + ';' + '\n' + + 'try {' + '\n' + + this.source + + '} catch (e) {' + '\n' + + ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n' + + '}' + '\n'; + } + else { + src = this.source; + } + + if (opts.client) { + src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src; + if (opts.compileDebug) { + src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src; + } + } + + if (opts.strict) { + src = '"use strict";\n' + src; + } + if (opts.debug) { + console.log(src); + } + if (opts.compileDebug && opts.filename) { + src = src + '\n' + + '//# sourceURL=' + opts.filename + '\n'; + } + + try { + if (opts.async) { + // Have to use generated function for this, since in envs without support, + // it breaks in parsing + try { + ctor = (new Function('return (async function(){}).constructor;'))(); + } + catch(e) { + if (e instanceof SyntaxError) { + throw new Error('This environment does not support async/await'); + } + else { + throw e; + } + } + } + else { + ctor = Function; + } + fn = new ctor(opts.localsName + ', escapeFn, include, rethrow', src); + } + catch(e) { + // istanbul ignore else + if (e instanceof SyntaxError) { + if (opts.filename) { + e.message += ' in ' + opts.filename; + } + e.message += ' while compiling ejs\n\n'; + e.message += 'If the above error is not helpful, you may want to try EJS-Lint:\n'; + e.message += 'https://github.com/RyanZim/EJS-Lint'; + if (!opts.async) { + e.message += '\n'; + e.message += 'Or, if you meant to create an async function, pass `async: true` as an option.'; + } + } + throw e; + } + + // Return a callable function which will execute the function + // created by the source-code, with the passed data as locals + // Adds a local `include` function which allows full recursive include + var returnedFn = opts.client ? fn : function anonymous(data) { + var include = function (path, includeData) { + var d = utils.shallowCopy({}, data); + if (includeData) { + d = utils.shallowCopy(d, includeData); + } + return includeFile(path, opts)(d); + }; + return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]); + }; + returnedFn.dependencies = this.dependencies; + if (opts.filename && typeof Object.defineProperty === 'function') { + var filename = opts.filename; + var basename = path.basename(filename, path.extname(filename)); + try { + Object.defineProperty(returnedFn, 'name', { + value: basename, + writable: false, + enumerable: false, + configurable: true + }); + } catch (e) {/* ignore */} + } + return returnedFn; + }, + + generateSource: function () { + var opts = this.opts; + + if (opts.rmWhitespace) { + // Have to use two separate replace here as `^` and `$` operators don't + // work well with `\r` and empty lines don't work well with the `m` flag. + this.templateText = + this.templateText.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, ''); + } + + // Slurp spaces and tabs before <%_ and after _%> + this.templateText = + this.templateText.replace(/[ \t]*<%_/gm, '<%_').replace(/_%>[ \t]*/gm, '_%>'); + + var self = this; + var matches = this.parseTemplateText(); + var d = this.opts.delimiter; + var o = this.opts.openDelimiter; + var c = this.opts.closeDelimiter; + + if (matches && matches.length) { + matches.forEach(function (line, index) { + var closing; + // If this is an opening tag, check for closing tags + // FIXME: May end up with some false positives here + // Better to store modes as k/v with openDelimiter + delimiter as key + // Then this can simply check against the map + if ( line.indexOf(o + d) === 0 // If it is a tag + && line.indexOf(o + d + d) !== 0) { // and is not escaped + closing = matches[index + 2]; + if (!(closing == d + c || closing == '-' + d + c || closing == '_' + d + c)) { + throw new Error('Could not find matching close tag for "' + line + '".'); + } + } + self.scanLine(line); + }); + } + + }, + + parseTemplateText: function () { + var str = this.templateText; + var pat = this.regex; + var result = pat.exec(str); + var arr = []; + var firstPos; + + while (result) { + firstPos = result.index; + + if (firstPos !== 0) { + arr.push(str.substring(0, firstPos)); + str = str.slice(firstPos); + } + + arr.push(result[0]); + str = str.slice(result[0].length); + result = pat.exec(str); + } + + if (str) { + arr.push(str); + } + + return arr; + }, + + _addOutput: function (line) { + if (this.truncate) { + // Only replace single leading linebreak in the line after + // -%> tag -- this is the single, trailing linebreak + // after the tag that the truncation mode replaces + // Handle Win / Unix / old Mac linebreaks -- do the \r\n + // combo first in the regex-or + line = line.replace(/^(?:\r\n|\r|\n)/, ''); + this.truncate = false; + } + if (!line) { + return line; + } + + // Preserve literal slashes + line = line.replace(/\\/g, '\\\\'); + + // Convert linebreaks + line = line.replace(/\n/g, '\\n'); + line = line.replace(/\r/g, '\\r'); + + // Escape double-quotes + // - this will be the delimiter during execution + line = line.replace(/"/g, '\\"'); + this.source += ' ; __append("' + line + '")' + '\n'; + }, + + scanLine: function (line) { + var self = this; + var d = this.opts.delimiter; + var o = this.opts.openDelimiter; + var c = this.opts.closeDelimiter; + var newLineCount = 0; + + newLineCount = (line.split('\n').length - 1); + + switch (line) { + case o + d: + case o + d + '_': + this.mode = Template.modes.EVAL; + break; + case o + d + '=': + this.mode = Template.modes.ESCAPED; + break; + case o + d + '-': + this.mode = Template.modes.RAW; + break; + case o + d + '#': + this.mode = Template.modes.COMMENT; + break; + case o + d + d: + this.mode = Template.modes.LITERAL; + this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")' + '\n'; + break; + case d + d + c: + this.mode = Template.modes.LITERAL; + this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")' + '\n'; + break; + case d + c: + case '-' + d + c: + case '_' + d + c: + if (this.mode == Template.modes.LITERAL) { + this._addOutput(line); + } + + this.mode = null; + this.truncate = line.indexOf('-') === 0 || line.indexOf('_') === 0; + break; + default: + // In script mode, depends on type of tag + if (this.mode) { + // If '//' is found without a line break, add a line break. + switch (this.mode) { + case Template.modes.EVAL: + case Template.modes.ESCAPED: + case Template.modes.RAW: + if (line.lastIndexOf('//') > line.lastIndexOf('\n')) { + line += '\n'; + } + } + switch (this.mode) { + // Just executing code + case Template.modes.EVAL: + this.source += ' ; ' + line + '\n'; + break; + // Exec, esc, and output + case Template.modes.ESCAPED: + this.source += ' ; __append(escapeFn(' + stripSemi(line) + '))' + '\n'; + break; + // Exec and output + case Template.modes.RAW: + this.source += ' ; __append(' + stripSemi(line) + ')' + '\n'; + break; + case Template.modes.COMMENT: + // Do nothing + break; + // Literal <%% mode, append as raw output + case Template.modes.LITERAL: + this._addOutput(line); + break; + } + } + // In string mode, just add the output + else { + this._addOutput(line); + } + } + + if (self.opts.compileDebug && newLineCount) { + this.currentLine += newLineCount; + this.source += ' ; __line = ' + this.currentLine + '\n'; + } + } +}; + +/** + * Escape characters reserved in XML. + * + * This is simply an export of {@link module:utils.escapeXML}. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + * + * @param {String} markup Input string + * @return {String} Escaped string + * @public + * @func + * */ +exports.escapeXML = utils.escapeXML; + +/** + * Express.js support. + * + * This is an alias for {@link module:ejs.renderFile}, in order to support + * Express.js out-of-the-box. + * + * @func + */ + +exports.__express = exports.renderFile; + +/** + * Version of EJS. + * + * @readonly + * @type {String} + * @public + */ + +exports.VERSION = _VERSION_STRING; + +/** + * Name for detection of EJS. + * + * @readonly + * @type {String} + * @public + */ + +exports.name = _NAME; + +/* istanbul ignore if */ +if (typeof window != 'undefined') { + window.ejs = exports; +} + +},{"../package.json":6,"./utils":2,"fs":3,"path":4}],2:[function(require,module,exports){ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +/** + * Private utility functions + * @module utils + * @private + */ + +'use strict'; + +var regExpChars = /[|\\{}()[\]^$+*?.]/g; + +/** + * Escape characters reserved in regular expressions. + * + * If `string` is `undefined` or `null`, the empty string is returned. + * + * @param {String} string Input string + * @return {String} Escaped string + * @static + * @private + */ +exports.escapeRegExpChars = function (string) { + // istanbul ignore if + if (!string) { + return ''; + } + return String(string).replace(regExpChars, '\\$&'); +}; + +var _ENCODE_HTML_RULES = { + '&': '&amp;', + '<': '&lt;', + '>': '&gt;', + '"': '&#34;', + "'": '&#39;' +}; +var _MATCH_HTML = /[&<>'"]/g; + +function encode_char(c) { + return _ENCODE_HTML_RULES[c] || c; +} + +/** + * Stringified version of constants used by {@link module:utils.escapeXML}. + * + * It is used in the process of generating {@link ClientFunction}s. + * + * @readonly + * @type {String} + */ + +var escapeFuncStr = + 'var _ENCODE_HTML_RULES = {\n' ++ ' "&": "&amp;"\n' ++ ' , "<": "&lt;"\n' ++ ' , ">": "&gt;"\n' ++ ' , \'"\': "&#34;"\n' ++ ' , "\'": "&#39;"\n' ++ ' }\n' ++ ' , _MATCH_HTML = /[&<>\'"]/g;\n' ++ 'function encode_char(c) {\n' ++ ' return _ENCODE_HTML_RULES[c] || c;\n' ++ '};\n'; + +/** + * Escape characters reserved in XML. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + * + * @implements {EscapeCallback} + * @param {String} markup Input string + * @return {String} Escaped string + * @static + * @private + */ + +exports.escapeXML = function (markup) { + return markup == undefined + ? '' + : String(markup) + .replace(_MATCH_HTML, encode_char); +}; +exports.escapeXML.toString = function () { + return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr; +}; + +/** + * Naive copy of properties from one object to another. + * Does not recurse into non-scalar properties + * Does not check to see if the property has a value before copying + * + * @param {Object} to Destination object + * @param {Object} from Source object + * @return {Object} Destination object + * @static + * @private + */ +exports.shallowCopy = function (to, from) { + from = from || {}; + for (var p in from) { + to[p] = from[p]; + } + return to; +}; + +/** + * Naive copy of a list of key names, from one object to another. + * Only copies property if it is actually defined + * Does not recurse into non-scalar properties + * + * @param {Object} to Destination object + * @param {Object} from Source object + * @param {Array} list List of properties to copy + * @return {Object} Destination object + * @static + * @private + */ +exports.shallowCopyFromList = function (to, from, list) { + for (var i = 0; i < list.length; i++) { + var p = list[i]; + if (typeof from[p] != 'undefined') { + to[p] = from[p]; + } + } + return to; +}; + +/** + * Simple in-process cache implementation. Does not implement limits of any + * sort. + * + * @implements Cache + * @static + * @private + */ +exports.cache = { + _data: {}, + set: function (key, val) { + this._data[key] = val; + }, + get: function (key) { + return this._data[key]; + }, + remove: function (key) { + delete this._data[key]; + }, + reset: function () { + this._data = {}; + } +}; + +},{}],3:[function(require,module,exports){ + +},{}],4:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +}).call(this,require('_process')) +},{"_process":5}],5:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],6:[function(require,module,exports){ +module.exports={ + "name": "ejs", + "description": "Embedded JavaScript templates", + "keywords": [ + "template", + "engine", + "ejs" + ], + "version": "3.0.1", + "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", + "license": "Apache-2.0", + "main": "./lib/ejs.js", + "repository": { + "type": "git", + "url": "git://github.com/mde/ejs.git" + }, + "bugs": "https://github.com/mde/ejs/issues", + "homepage": "https://github.com/mde/ejs", + "dependencies": {}, + "devDependencies": { + "browserify": "^13.1.1", + "eslint": "^4.14.0", + "git-directory-deploy": "^1.5.1", + "jake": "^10.3.1", + "jsdoc": "^3.4.0", + "lru-cache": "^4.0.1", + "mocha": "^5.0.5", + "uglify-js": "^3.3.16" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "postinstall": "node ./postinstall.js" + } +} + +},{}]},{},[1])(1) +}); diff --git a/node_modules/ejs/ejs.min.js b/node_modules/ejs/ejs.min.js @@ -0,0 +1 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ejs=f()}})(function(){var define,module,exports;return function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e}()({1:[function(require,module,exports){"use strict";var fs=require("fs");var path=require("path");var utils=require("./utils");var scopeOptionWarned=false;var _VERSION_STRING=require("../package.json").version;var _DEFAULT_OPEN_DELIMITER="<";var _DEFAULT_CLOSE_DELIMITER=">";var _DEFAULT_DELIMITER="%";var _DEFAULT_LOCALS_NAME="locals";var _NAME="ejs";var _REGEX_STRING="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";var _OPTS_PASSABLE_WITH_DATA=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"];var _OPTS_PASSABLE_WITH_DATA_EXPRESS=_OPTS_PASSABLE_WITH_DATA.concat("cache");var _BOM=/^\uFEFF/;exports.cache=utils.cache;exports.fileLoader=fs.readFileSync;exports.localsName=_DEFAULT_LOCALS_NAME;exports.promiseImpl=new Function("return this;")().Promise;exports.resolveInclude=function(name,filename,isDir){var dirname=path.dirname;var extname=path.extname;var resolve=path.resolve;var includePath=resolve(isDir?filename:dirname(filename),name);var ext=extname(name);if(!ext){includePath+=".ejs"}return includePath};function getIncludePath(path,options){var includePath;var filePath;var views=options.views;var match=/^[A-Za-z]+:\\|^\//.exec(path);if(match&&match.length){includePath=exports.resolveInclude(path.replace(/^\/*/,""),options.root||"/",true)}else{if(options.filename){filePath=exports.resolveInclude(path,options.filename);if(fs.existsSync(filePath)){includePath=filePath}}if(!includePath){if(Array.isArray(views)&&views.some(function(v){filePath=exports.resolveInclude(path,v,true);return fs.existsSync(filePath)})){includePath=filePath}}if(!includePath){throw new Error('Could not find the include file "'+options.escapeFunction(path)+'"')}}return includePath}function handleCache(options,template){var func;var filename=options.filename;var hasTemplate=arguments.length>1;if(options.cache){if(!filename){throw new Error("cache option requires a filename")}func=exports.cache.get(filename);if(func){return func}if(!hasTemplate){template=fileLoader(filename).toString().replace(_BOM,"")}}else if(!hasTemplate){if(!filename){throw new Error("Internal EJS error: no file name or template "+"provided")}template=fileLoader(filename).toString().replace(_BOM,"")}func=exports.compile(template,options);if(options.cache){exports.cache.set(filename,func)}return func}function tryHandleCache(options,data,cb){var result;if(!cb){if(typeof exports.promiseImpl=="function"){return new exports.promiseImpl(function(resolve,reject){try{result=handleCache(options)(data);resolve(result)}catch(err){reject(err)}})}else{throw new Error("Please provide a callback function")}}else{try{result=handleCache(options)(data)}catch(err){return cb(err)}cb(null,result)}}function fileLoader(filePath){return exports.fileLoader(filePath)}function includeFile(path,options){var opts=utils.shallowCopy({},options);opts.filename=getIncludePath(path,opts);return handleCache(opts)}function rethrow(err,str,flnm,lineno,esc){var lines=str.split("\n");var start=Math.max(lineno-3,0);var end=Math.min(lines.length,lineno+3);var filename=esc(flnm);var context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");err.path=filename;err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function stripSemi(str){return str.replace(/;(\s*$)/,"$1")}exports.compile=function compile(template,opts){var templ;if(opts&&opts.scope){if(!scopeOptionWarned){console.warn("`scope` option is deprecated and will be removed in EJS 3");scopeOptionWarned=true}if(!opts.context){opts.context=opts.scope}delete opts.scope}templ=new Template(template,opts);return templ.compile()};exports.render=function(template,d,o){var data=d||{};var opts=o||{};if(arguments.length==2){utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA)}return handleCache(opts,template)(data)};exports.renderFile=function(){var args=Array.prototype.slice.call(arguments);var filename=args.shift();var cb;var opts={filename:filename};var data;var viewOpts;if(typeof arguments[arguments.length-1]=="function"){cb=args.pop()}if(args.length){data=args.shift();if(args.length){utils.shallowCopy(opts,args.pop())}else{if(data.settings){if(data.settings.views){opts.views=data.settings.views}if(data.settings["view cache"]){opts.cache=true}viewOpts=data.settings["view options"];if(viewOpts){utils.shallowCopy(opts,viewOpts)}}utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA_EXPRESS)}opts.filename=filename}else{data={}}return tryHandleCache(opts,data,cb)};exports.Template=Template;exports.clearCache=function(){exports.cache.reset()};function Template(text,opts){opts=opts||{};var options={};this.templateText=text;this.mode=null;this.truncate=false;this.currentLine=1;this.source="";this.dependencies=[];options.client=opts.client||false;options.escapeFunction=opts.escape||opts.escapeFunction||utils.escapeXML;options.compileDebug=opts.compileDebug!==false;options.debug=!!opts.debug;options.filename=opts.filename;options.openDelimiter=opts.openDelimiter||exports.openDelimiter||_DEFAULT_OPEN_DELIMITER;options.closeDelimiter=opts.closeDelimiter||exports.closeDelimiter||_DEFAULT_CLOSE_DELIMITER;options.delimiter=opts.delimiter||exports.delimiter||_DEFAULT_DELIMITER;options.strict=opts.strict||false;options.context=opts.context;options.cache=opts.cache||false;options.rmWhitespace=opts.rmWhitespace;options.root=opts.root;options.outputFunctionName=opts.outputFunctionName;options.localsName=opts.localsName||exports.localsName||_DEFAULT_LOCALS_NAME;options.views=opts.views;options.async=opts.async;options.destructuredLocals=opts.destructuredLocals;options.legacyInclude=typeof opts.legacyInclude!="undefined"?!!opts.legacyInclude:true;if(options.strict){options._with=false}else{options._with=typeof opts._with!="undefined"?opts._with:true}this.opts=options;this.regex=this.createRegex()}Template.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Template.prototype={createRegex:function(){var str=_REGEX_STRING;var delim=utils.escapeRegExpChars(this.opts.delimiter);var open=utils.escapeRegExpChars(this.opts.openDelimiter);var close=utils.escapeRegExpChars(this.opts.closeDelimiter);str=str.replace(/%/g,delim).replace(/</g,open).replace(/>/g,close);return new RegExp(str)},compile:function(){var src;var fn;var opts=this.opts;var prepended="";var appended="";var escapeFn=opts.escapeFunction;var ctor;if(!this.source){this.generateSource();prepended+=' var __output = "";\n'+" function __append(s) { if (s !== undefined && s !== null) __output += s }\n";if(opts.outputFunctionName){prepended+=" var "+opts.outputFunctionName+" = __append;"+"\n"}if(opts.destructuredLocals&&opts.destructuredLocals.length){var destructuring=" var __locals = ("+opts.localsName+" || {}),\n";for(var i=0;i<opts.destructuredLocals.length;i++){var name=opts.destructuredLocals[i];if(i>0){destructuring+=",\n "}destructuring+=name+" = __locals."+name}prepended+=destructuring+";\n"}if(opts._with!==false){prepended+=" with ("+opts.localsName+" || {}) {"+"\n";appended+=" }"+"\n"}appended+=" return __output;"+"\n";this.source=prepended+this.source+appended}if(opts.compileDebug){src="var __line = 1"+"\n"+" , __lines = "+JSON.stringify(this.templateText)+"\n"+" , __filename = "+(opts.filename?JSON.stringify(opts.filename):"undefined")+";"+"\n"+"try {"+"\n"+this.source+"} catch (e) {"+"\n"+" rethrow(e, __lines, __filename, __line, escapeFn);"+"\n"+"}"+"\n"}else{src=this.source}if(opts.client){src="escapeFn = escapeFn || "+escapeFn.toString()+";"+"\n"+src;if(opts.compileDebug){src="rethrow = rethrow || "+rethrow.toString()+";"+"\n"+src}}if(opts.strict){src='"use strict";\n'+src}if(opts.debug){console.log(src)}if(opts.compileDebug&&opts.filename){src=src+"\n"+"//# sourceURL="+opts.filename+"\n"}try{if(opts.async){try{ctor=new Function("return (async function(){}).constructor;")()}catch(e){if(e instanceof SyntaxError){throw new Error("This environment does not support async/await")}else{throw e}}}else{ctor=Function}fn=new ctor(opts.localsName+", escapeFn, include, rethrow",src)}catch(e){if(e instanceof SyntaxError){if(opts.filename){e.message+=" in "+opts.filename}e.message+=" while compiling ejs\n\n";e.message+="If the above error is not helpful, you may want to try EJS-Lint:\n";e.message+="https://github.com/RyanZim/EJS-Lint";if(!opts.async){e.message+="\n";e.message+="Or, if you meant to create an async function, pass `async: true` as an option."}}throw e}var returnedFn=opts.client?fn:function anonymous(data){var include=function(path,includeData){var d=utils.shallowCopy({},data);if(includeData){d=utils.shallowCopy(d,includeData)}return includeFile(path,opts)(d)};return fn.apply(opts.context,[data||{},escapeFn,include,rethrow])};returnedFn.dependencies=this.dependencies;if(opts.filename&&typeof Object.defineProperty==="function"){var filename=opts.filename;var basename=path.basename(filename,path.extname(filename));try{Object.defineProperty(returnedFn,"name",{value:basename,writable:false,enumerable:false,configurable:true})}catch(e){}}return returnedFn},generateSource:function(){var opts=this.opts;if(opts.rmWhitespace){this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var self=this;var matches=this.parseTemplateText();var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;if(matches&&matches.length){matches.forEach(function(line,index){var closing;if(line.indexOf(o+d)===0&&line.indexOf(o+d+d)!==0){closing=matches[index+2];if(!(closing==d+c||closing=="-"+d+c||closing=="_"+d+c)){throw new Error('Could not find matching close tag for "'+line+'".')}}self.scanLine(line)})}},parseTemplateText:function(){var str=this.templateText;var pat=this.regex;var result=pat.exec(str);var arr=[];var firstPos;while(result){firstPos=result.index;if(firstPos!==0){arr.push(str.substring(0,firstPos));str=str.slice(firstPos)}arr.push(result[0]);str=str.slice(result[0].length);result=pat.exec(str)}if(str){arr.push(str)}return arr},_addOutput:function(line){if(this.truncate){line=line.replace(/^(?:\r\n|\r|\n)/,"");this.truncate=false}if(!line){return line}line=line.replace(/\\/g,"\\\\");line=line.replace(/\n/g,"\\n");line=line.replace(/\r/g,"\\r");line=line.replace(/"/g,'\\"');this.source+=' ; __append("'+line+'")'+"\n"},scanLine:function(line){var self=this;var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;var newLineCount=0;newLineCount=line.split("\n").length-1;switch(line){case o+d:case o+d+"_":this.mode=Template.modes.EVAL;break;case o+d+"=":this.mode=Template.modes.ESCAPED;break;case o+d+"-":this.mode=Template.modes.RAW;break;case o+d+"#":this.mode=Template.modes.COMMENT;break;case o+d+d:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(o+d+d,o+d)+'")'+"\n";break;case d+d+c:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(d+d+c,d+c)+'")'+"\n";break;case d+c:case"-"+d+c:case"_"+d+c:if(this.mode==Template.modes.LITERAL){this._addOutput(line)}this.mode=null;this.truncate=line.indexOf("-")===0||line.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case Template.modes.EVAL:case Template.modes.ESCAPED:case Template.modes.RAW:if(line.lastIndexOf("//")>line.lastIndexOf("\n")){line+="\n"}}switch(this.mode){case Template.modes.EVAL:this.source+=" ; "+line+"\n";break;case Template.modes.ESCAPED:this.source+=" ; __append(escapeFn("+stripSemi(line)+"))"+"\n";break;case Template.modes.RAW:this.source+=" ; __append("+stripSemi(line)+")"+"\n";break;case Template.modes.COMMENT:break;case Template.modes.LITERAL:this._addOutput(line);break}}else{this._addOutput(line)}}if(self.opts.compileDebug&&newLineCount){this.currentLine+=newLineCount;this.source+=" ; __line = "+this.currentLine+"\n"}}};exports.escapeXML=utils.escapeXML;exports.__express=exports.renderFile;exports.VERSION=_VERSION_STRING;exports.name=_NAME;if(typeof window!="undefined"){window.ejs=exports}},{"../package.json":6,"./utils":2,fs:3,path:4}],2:[function(require,module,exports){"use strict";var regExpChars=/[|\\{}()[\]^$+*?.]/g;exports.escapeRegExpChars=function(string){if(!string){return""}return String(string).replace(regExpChars,"\\$&")};var _ENCODE_HTML_RULES={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"};var _MATCH_HTML=/[&<>'"]/g;function encode_char(c){return _ENCODE_HTML_RULES[c]||c}var escapeFuncStr="var _ENCODE_HTML_RULES = {\n"+' "&": "&amp;"\n'+' , "<": "&lt;"\n'+' , ">": "&gt;"\n'+' , \'"\': "&#34;"\n'+' , "\'": "&#39;"\n'+" }\n"+" , _MATCH_HTML = /[&<>'\"]/g;\n"+"function encode_char(c) {\n"+" return _ENCODE_HTML_RULES[c] || c;\n"+"};\n";exports.escapeXML=function(markup){return markup==undefined?"":String(markup).replace(_MATCH_HTML,encode_char)};exports.escapeXML.toString=function(){return Function.prototype.toString.call(this)+";\n"+escapeFuncStr};exports.shallowCopy=function(to,from){from=from||{};for(var p in from){to[p]=from[p]}return to};exports.shallowCopyFromList=function(to,from,list){for(var i=0;i<list.length;i++){var p=list[i];if(typeof from[p]!="undefined"){to[p]=from[p]}}return to};exports.cache={_data:{},set:function(key,val){this._data[key]=val},get:function(key){return this._data[key]},remove:function(key){delete this._data[key]},reset:function(){this._data={}}}},{}],3:[function(require,module,exports){},{}],4:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:5}],5:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],6:[function(require,module,exports){module.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.0.1",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",main:"./lib/ejs.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{},devDependencies:{browserify:"^13.1.1",eslint:"^4.14.0","git-directory-deploy":"^1.5.1",jake:"^10.3.1",jsdoc:"^3.4.0","lru-cache":"^4.0.1",mocha:"^5.0.5","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"mocha",postinstall:"node ./postinstall.js"}}},{}]},{},[1])(1)}); diff --git a/node_modules/ejs/jakefile.js b/node_modules/ejs/jakefile.js @@ -0,0 +1,74 @@ +var fs = require('fs'); +var execSync = require('child_process').execSync; +var exec = function (cmd) { + execSync(cmd, {stdio: 'inherit'}); +}; + +/* global jake, task, desc, publishTask */ + +task('build', ['lint', 'clean', 'browserify', 'minify'], function () { + console.log('Build completed.'); +}); + +desc('Cleans browerified/minified files and package files'); +task('clean', ['clobber'], function () { + jake.rmRf('./ejs.js'); + jake.rmRf('./ejs.min.js'); + console.log('Cleaned up compiled files.'); +}); + +desc('Lints the source code'); +task('lint', ['clean'], function () { + exec('./node_modules/.bin/eslint "**/*.js"'); + console.log('Linting completed.'); +}); + +task('browserify', function () { + exec('./node_modules/browserify/bin/cmd.js --standalone ejs lib/ejs.js > ejs.js'); + console.log('Browserification completed.'); +}); + +task('minify', function () { + exec('./node_modules/uglify-js/bin/uglifyjs ejs.js > ejs.min.js'); + console.log('Minification completed.'); +}); + +desc('Generates the EJS API docs'); +task('doc', function (dev) { + jake.rmRf('out'); + var p = dev ? '-p' : ''; + exec('./node_modules/.bin/jsdoc ' + p + ' -c jsdoc.json lib/* docs/jsdoc/*'); + console.log('Documentation generated.'); +}); + +desc('Publishes the EJS API docs'); +task('docPublish', ['doc'], function () { + fs.writeFileSync('out/CNAME', 'api.ejs.co'); + console.log('Pushing docs to gh-pages...'); + exec('./node_modules/.bin/git-directory-deploy --directory out/'); + console.log('Docs published to gh-pages.'); +}); + +desc('Runs the EJS test suite'); +task('test', ['lint'], function () { + exec('./node_modules/.bin/mocha'); +}); + +publishTask('ejs', ['build'], function () { + this.packageFiles.include([ + 'jakefile.js', + 'README.md', + 'LICENSE', + 'package.json', + 'postinstall.js', + 'ejs.js', + 'ejs.min.js', + 'lib/**' + ]); +}); + +jake.Task.publish.on('complete', function () { + console.log('Updating hosted docs...'); + console.log('If this fails, run jake docPublish to re-try.'); + jake.Task.docPublish.invoke(); +}); diff --git a/node_modules/ejs/lib/ejs.js b/node_modules/ejs/lib/ejs.js @@ -0,0 +1,904 @@ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +'use strict'; + +/** + * @file Embedded JavaScript templating engine. {@link http://ejs.co} + * @author Matthew Eernisse <mde@fleegix.org> + * @author Tiancheng "Timothy" Gu <timothygu99@gmail.com> + * @project EJS + * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} + */ + +/** + * EJS internal functions. + * + * Technically this "module" lies in the same file as {@link module:ejs}, for + * the sake of organization all the private functions re grouped into this + * module. + * + * @module ejs-internal + * @private + */ + +/** + * Embedded JavaScript templating engine. + * + * @module ejs + * @public + */ + +var fs = require('fs'); +var path = require('path'); +var utils = require('./utils'); + +var scopeOptionWarned = false; +var _VERSION_STRING = require('../package.json').version; +var _DEFAULT_OPEN_DELIMITER = '<'; +var _DEFAULT_CLOSE_DELIMITER = '>'; +var _DEFAULT_DELIMITER = '%'; +var _DEFAULT_LOCALS_NAME = 'locals'; +var _NAME = 'ejs'; +var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)'; +var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compileDebug', + 'client', '_with', 'rmWhitespace', 'strict', 'filename', 'async']; +// We don't allow 'cache' option to be passed in the data obj for +// the normal `render` call, but this is where Express 2 & 3 put it +// so we make an exception for `renderFile` +var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache'); +var _BOM = /^\uFEFF/; + +/** + * EJS template function cache. This can be a LRU object from lru-cache NPM + * module. By default, it is {@link module:utils.cache}, a simple in-process + * cache that grows continuously. + * + * @type {Cache} + */ + +exports.cache = utils.cache; + +/** + * Custom file loader. Useful for template preprocessing or restricting access + * to a certain part of the filesystem. + * + * @type {fileLoader} + */ + +exports.fileLoader = fs.readFileSync; + +/** + * Name of the object containing the locals. + * + * This variable is overridden by {@link Options}`.localsName` if it is not + * `undefined`. + * + * @type {String} + * @public + */ + +exports.localsName = _DEFAULT_LOCALS_NAME; + +/** + * Promise implementation -- defaults to the native implementation if available + * This is mostly just for testability + * + * @type {Function} + * @public + */ + +exports.promiseImpl = (new Function('return this;'))().Promise; + +/** + * Get the path to the included file from the parent file path and the + * specified path. + * + * @param {String} name specified path + * @param {String} filename parent file path + * @param {Boolean} isDir parent file path whether is directory + * @return {String} + */ +exports.resolveInclude = function(name, filename, isDir) { + var dirname = path.dirname; + var extname = path.extname; + var resolve = path.resolve; + var includePath = resolve(isDir ? filename : dirname(filename), name); + var ext = extname(name); + if (!ext) { + includePath += '.ejs'; + } + return includePath; +}; + +/** + * Get the path to the included file by Options + * + * @param {String} path specified path + * @param {Options} options compilation options + * @return {String} + */ +function getIncludePath(path, options) { + var includePath; + var filePath; + var views = options.views; + var match = /^[A-Za-z]+:\\|^\//.exec(path); + + // Abs path + if (match && match.length) { + includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true); + } + // Relative paths + else { + // Look relative to a passed filename first + if (options.filename) { + filePath = exports.resolveInclude(path, options.filename); + if (fs.existsSync(filePath)) { + includePath = filePath; + } + } + // Then look in any views directories + if (!includePath) { + if (Array.isArray(views) && views.some(function (v) { + filePath = exports.resolveInclude(path, v, true); + return fs.existsSync(filePath); + })) { + includePath = filePath; + } + } + if (!includePath) { + throw new Error('Could not find the include file "' + + options.escapeFunction(path) + '"'); + } + } + return includePath; +} + +/** + * Get the template from a string or a file, either compiled on-the-fly or + * read from cache (if enabled), and cache the template if needed. + * + * If `template` is not set, the file specified in `options.filename` will be + * read. + * + * If `options.cache` is true, this function reads the file from + * `options.filename` so it must be set prior to calling this function. + * + * @memberof module:ejs-internal + * @param {Options} options compilation options + * @param {String} [template] template source + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `options.client`, either type might be returned. + * @static + */ + +function handleCache(options, template) { + var func; + var filename = options.filename; + var hasTemplate = arguments.length > 1; + + if (options.cache) { + if (!filename) { + throw new Error('cache option requires a filename'); + } + func = exports.cache.get(filename); + if (func) { + return func; + } + if (!hasTemplate) { + template = fileLoader(filename).toString().replace(_BOM, ''); + } + } + else if (!hasTemplate) { + // istanbul ignore if: should not happen at all + if (!filename) { + throw new Error('Internal EJS error: no file name or template ' + + 'provided'); + } + template = fileLoader(filename).toString().replace(_BOM, ''); + } + func = exports.compile(template, options); + if (options.cache) { + exports.cache.set(filename, func); + } + return func; +} + +/** + * Try calling handleCache with the given options and data and call the + * callback with the result. If an error occurs, call the callback with + * the error. Used by renderFile(). + * + * @memberof module:ejs-internal + * @param {Options} options compilation options + * @param {Object} data template data + * @param {RenderFileCallback} cb callback + * @static + */ + +function tryHandleCache(options, data, cb) { + var result; + if (!cb) { + if (typeof exports.promiseImpl == 'function') { + return new exports.promiseImpl(function (resolve, reject) { + try { + result = handleCache(options)(data); + resolve(result); + } + catch (err) { + reject(err); + } + }); + } + else { + throw new Error('Please provide a callback function'); + } + } + else { + try { + result = handleCache(options)(data); + } + catch (err) { + return cb(err); + } + + cb(null, result); + } +} + +/** + * fileLoader is independent + * + * @param {String} filePath ejs file path. + * @return {String} The contents of the specified file. + * @static + */ + +function fileLoader(filePath){ + return exports.fileLoader(filePath); +} + +/** + * Get the template function. + * + * If `options.cache` is `true`, then the template is cached. + * + * @memberof module:ejs-internal + * @param {String} path path for the specified file + * @param {Options} options compilation options + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `options.client`, either type might be returned + * @static + */ + +function includeFile(path, options) { + var opts = utils.shallowCopy({}, options); + opts.filename = getIncludePath(path, opts); + return handleCache(opts); +} + +/** + * Re-throw the given `err` in context to the `str` of ejs, `filename`, and + * `lineno`. + * + * @implements RethrowCallback + * @memberof module:ejs-internal + * @param {Error} err Error object + * @param {String} str EJS source + * @param {String} filename file name of the EJS file + * @param {String} lineno line number of the error + * @static + */ + +function rethrow(err, str, flnm, lineno, esc){ + var lines = str.split('\n'); + var start = Math.max(lineno - 3, 0); + var end = Math.min(lines.length, lineno + 3); + var filename = esc(flnm); // eslint-disable-line + // Error context + var context = lines.slice(start, end).map(function (line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +function stripSemi(str){ + return str.replace(/;(\s*$)/, '$1'); +} + +/** + * Compile the given `str` of ejs into a template function. + * + * @param {String} template EJS template + * + * @param {Options} opts compilation options + * + * @return {(TemplateFunction|ClientFunction)} + * Depending on the value of `opts.client`, either type might be returned. + * Note that the return type of the function also depends on the value of `opts.async`. + * @public + */ + +exports.compile = function compile(template, opts) { + var templ; + + // v1 compat + // 'scope' is 'context' + // FIXME: Remove this in a future version + if (opts && opts.scope) { + if (!scopeOptionWarned){ + console.warn('`scope` option is deprecated and will be removed in EJS 3'); + scopeOptionWarned = true; + } + if (!opts.context) { + opts.context = opts.scope; + } + delete opts.scope; + } + templ = new Template(template, opts); + return templ.compile(); +}; + +/** + * Render the given `template` of ejs. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + * + * @param {String} template EJS template + * @param {Object} [data={}] template data + * @param {Options} [opts={}] compilation and rendering options + * @return {(String|Promise<String>)} + * Return value type depends on `opts.async`. + * @public + */ + +exports.render = function (template, d, o) { + var data = d || {}; + var opts = o || {}; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 2) { + utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA); + } + + return handleCache(opts, template)(data); +}; + +/** + * Render an EJS file at the given `path` and callback `cb(err, str)`. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + * + * @param {String} path path to the EJS file + * @param {Object} [data={}] template data + * @param {Options} [opts={}] compilation and rendering options + * @param {RenderFileCallback} cb callback + * @public + */ + +exports.renderFile = function () { + var args = Array.prototype.slice.call(arguments); + var filename = args.shift(); + var cb; + var opts = {filename: filename}; + var data; + var viewOpts; + + // Do we have a callback? + if (typeof arguments[arguments.length - 1] == 'function') { + cb = args.pop(); + } + // Do we have data/opts? + if (args.length) { + // Should always have data obj + data = args.shift(); + // Normal passed opts (data obj + opts obj) + if (args.length) { + // Use shallowCopy so we don't pollute passed in opts obj with new vals + utils.shallowCopy(opts, args.pop()); + } + // Special casing for Express (settings + opts-in-data) + else { + // Express 3 and 4 + if (data.settings) { + // Pull a few things from known locations + if (data.settings.views) { + opts.views = data.settings.views; + } + if (data.settings['view cache']) { + opts.cache = true; + } + // Undocumented after Express 2, but still usable, esp. for + // items that are unsafe to be passed along with data, like `root` + viewOpts = data.settings['view options']; + if (viewOpts) { + utils.shallowCopy(opts, viewOpts); + } + } + // Express 2 and lower, values set in app.locals, or people who just + // want to pass options in their data. NOTE: These values will override + // anything previously set in settings or settings['view options'] + utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS); + } + opts.filename = filename; + } + else { + data = {}; + } + + return tryHandleCache(opts, data, cb); +}; + +/** + * Clear intermediate JavaScript cache. Calls {@link Cache#reset}. + * @public + */ + +/** + * EJS template class + * @public + */ +exports.Template = Template; + +exports.clearCache = function () { + exports.cache.reset(); +}; + +function Template(text, opts) { + opts = opts || {}; + var options = {}; + this.templateText = text; + this.mode = null; + this.truncate = false; + this.currentLine = 1; + this.source = ''; + this.dependencies = []; + options.client = opts.client || false; + options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML; + options.compileDebug = opts.compileDebug !== false; + options.debug = !!opts.debug; + options.filename = opts.filename; + options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER; + options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER; + options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER; + options.strict = opts.strict || false; + options.context = opts.context; + options.cache = opts.cache || false; + options.rmWhitespace = opts.rmWhitespace; + options.root = opts.root; + options.outputFunctionName = opts.outputFunctionName; + options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME; + options.views = opts.views; + options.async = opts.async; + options.destructuredLocals = opts.destructuredLocals; + options.legacyInclude = typeof opts.legacyInclude != 'undefined' ? !!opts.legacyInclude : true; + + if (options.strict) { + options._with = false; + } + else { + options._with = typeof opts._with != 'undefined' ? opts._with : true; + } + + this.opts = options; + + this.regex = this.createRegex(); +} + +Template.modes = { + EVAL: 'eval', + ESCAPED: 'escaped', + RAW: 'raw', + COMMENT: 'comment', + LITERAL: 'literal' +}; + +Template.prototype = { + createRegex: function () { + var str = _REGEX_STRING; + var delim = utils.escapeRegExpChars(this.opts.delimiter); + var open = utils.escapeRegExpChars(this.opts.openDelimiter); + var close = utils.escapeRegExpChars(this.opts.closeDelimiter); + str = str.replace(/%/g, delim) + .replace(/</g, open) + .replace(/>/g, close); + return new RegExp(str); + }, + + compile: function () { + var src; + var fn; + var opts = this.opts; + var prepended = ''; + var appended = ''; + var escapeFn = opts.escapeFunction; + var ctor; + + if (!this.source) { + this.generateSource(); + prepended += + ' var __output = "";\n' + + ' function __append(s) { if (s !== undefined && s !== null) __output += s }\n'; + if (opts.outputFunctionName) { + prepended += ' var ' + opts.outputFunctionName + ' = __append;' + '\n'; + } + if (opts.destructuredLocals && opts.destructuredLocals.length) { + var destructuring = ' var __locals = (' + opts.localsName + ' || {}),\n'; + for (var i = 0; i < opts.destructuredLocals.length; i++) { + var name = opts.destructuredLocals[i]; + if (i > 0) { + destructuring += ',\n '; + } + destructuring += name + ' = __locals.' + name; + } + prepended += destructuring + ';\n'; + } + if (opts._with !== false) { + prepended += ' with (' + opts.localsName + ' || {}) {' + '\n'; + appended += ' }' + '\n'; + } + appended += ' return __output;' + '\n'; + this.source = prepended + this.source + appended; + } + + if (opts.compileDebug) { + src = 'var __line = 1' + '\n' + + ' , __lines = ' + JSON.stringify(this.templateText) + '\n' + + ' , __filename = ' + (opts.filename ? + JSON.stringify(opts.filename) : 'undefined') + ';' + '\n' + + 'try {' + '\n' + + this.source + + '} catch (e) {' + '\n' + + ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n' + + '}' + '\n'; + } + else { + src = this.source; + } + + if (opts.client) { + src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src; + if (opts.compileDebug) { + src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src; + } + } + + if (opts.strict) { + src = '"use strict";\n' + src; + } + if (opts.debug) { + console.log(src); + } + if (opts.compileDebug && opts.filename) { + src = src + '\n' + + '//# sourceURL=' + opts.filename + '\n'; + } + + try { + if (opts.async) { + // Have to use generated function for this, since in envs without support, + // it breaks in parsing + try { + ctor = (new Function('return (async function(){}).constructor;'))(); + } + catch(e) { + if (e instanceof SyntaxError) { + throw new Error('This environment does not support async/await'); + } + else { + throw e; + } + } + } + else { + ctor = Function; + } + fn = new ctor(opts.localsName + ', escapeFn, include, rethrow', src); + } + catch(e) { + // istanbul ignore else + if (e instanceof SyntaxError) { + if (opts.filename) { + e.message += ' in ' + opts.filename; + } + e.message += ' while compiling ejs\n\n'; + e.message += 'If the above error is not helpful, you may want to try EJS-Lint:\n'; + e.message += 'https://github.com/RyanZim/EJS-Lint'; + if (!opts.async) { + e.message += '\n'; + e.message += 'Or, if you meant to create an async function, pass `async: true` as an option.'; + } + } + throw e; + } + + // Return a callable function which will execute the function + // created by the source-code, with the passed data as locals + // Adds a local `include` function which allows full recursive include + var returnedFn = opts.client ? fn : function anonymous(data) { + var include = function (path, includeData) { + var d = utils.shallowCopy({}, data); + if (includeData) { + d = utils.shallowCopy(d, includeData); + } + return includeFile(path, opts)(d); + }; + return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]); + }; + returnedFn.dependencies = this.dependencies; + if (opts.filename && typeof Object.defineProperty === 'function') { + var filename = opts.filename; + var basename = path.basename(filename, path.extname(filename)); + try { + Object.defineProperty(returnedFn, 'name', { + value: basename, + writable: false, + enumerable: false, + configurable: true + }); + } catch (e) {/* ignore */} + } + return returnedFn; + }, + + generateSource: function () { + var opts = this.opts; + + if (opts.rmWhitespace) { + // Have to use two separate replace here as `^` and `$` operators don't + // work well with `\r` and empty lines don't work well with the `m` flag. + this.templateText = + this.templateText.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, ''); + } + + // Slurp spaces and tabs before <%_ and after _%> + this.templateText = + this.templateText.replace(/[ \t]*<%_/gm, '<%_').replace(/_%>[ \t]*/gm, '_%>'); + + var self = this; + var matches = this.parseTemplateText(); + var d = this.opts.delimiter; + var o = this.opts.openDelimiter; + var c = this.opts.closeDelimiter; + + if (matches && matches.length) { + matches.forEach(function (line, index) { + var closing; + // If this is an opening tag, check for closing tags + // FIXME: May end up with some false positives here + // Better to store modes as k/v with openDelimiter + delimiter as key + // Then this can simply check against the map + if ( line.indexOf(o + d) === 0 // If it is a tag + && line.indexOf(o + d + d) !== 0) { // and is not escaped + closing = matches[index + 2]; + if (!(closing == d + c || closing == '-' + d + c || closing == '_' + d + c)) { + throw new Error('Could not find matching close tag for "' + line + '".'); + } + } + self.scanLine(line); + }); + } + + }, + + parseTemplateText: function () { + var str = this.templateText; + var pat = this.regex; + var result = pat.exec(str); + var arr = []; + var firstPos; + + while (result) { + firstPos = result.index; + + if (firstPos !== 0) { + arr.push(str.substring(0, firstPos)); + str = str.slice(firstPos); + } + + arr.push(result[0]); + str = str.slice(result[0].length); + result = pat.exec(str); + } + + if (str) { + arr.push(str); + } + + return arr; + }, + + _addOutput: function (line) { + if (this.truncate) { + // Only replace single leading linebreak in the line after + // -%> tag -- this is the single, trailing linebreak + // after the tag that the truncation mode replaces + // Handle Win / Unix / old Mac linebreaks -- do the \r\n + // combo first in the regex-or + line = line.replace(/^(?:\r\n|\r|\n)/, ''); + this.truncate = false; + } + if (!line) { + return line; + } + + // Preserve literal slashes + line = line.replace(/\\/g, '\\\\'); + + // Convert linebreaks + line = line.replace(/\n/g, '\\n'); + line = line.replace(/\r/g, '\\r'); + + // Escape double-quotes + // - this will be the delimiter during execution + line = line.replace(/"/g, '\\"'); + this.source += ' ; __append("' + line + '")' + '\n'; + }, + + scanLine: function (line) { + var self = this; + var d = this.opts.delimiter; + var o = this.opts.openDelimiter; + var c = this.opts.closeDelimiter; + var newLineCount = 0; + + newLineCount = (line.split('\n').length - 1); + + switch (line) { + case o + d: + case o + d + '_': + this.mode = Template.modes.EVAL; + break; + case o + d + '=': + this.mode = Template.modes.ESCAPED; + break; + case o + d + '-': + this.mode = Template.modes.RAW; + break; + case o + d + '#': + this.mode = Template.modes.COMMENT; + break; + case o + d + d: + this.mode = Template.modes.LITERAL; + this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")' + '\n'; + break; + case d + d + c: + this.mode = Template.modes.LITERAL; + this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")' + '\n'; + break; + case d + c: + case '-' + d + c: + case '_' + d + c: + if (this.mode == Template.modes.LITERAL) { + this._addOutput(line); + } + + this.mode = null; + this.truncate = line.indexOf('-') === 0 || line.indexOf('_') === 0; + break; + default: + // In script mode, depends on type of tag + if (this.mode) { + // If '//' is found without a line break, add a line break. + switch (this.mode) { + case Template.modes.EVAL: + case Template.modes.ESCAPED: + case Template.modes.RAW: + if (line.lastIndexOf('//') > line.lastIndexOf('\n')) { + line += '\n'; + } + } + switch (this.mode) { + // Just executing code + case Template.modes.EVAL: + this.source += ' ; ' + line + '\n'; + break; + // Exec, esc, and output + case Template.modes.ESCAPED: + this.source += ' ; __append(escapeFn(' + stripSemi(line) + '))' + '\n'; + break; + // Exec and output + case Template.modes.RAW: + this.source += ' ; __append(' + stripSemi(line) + ')' + '\n'; + break; + case Template.modes.COMMENT: + // Do nothing + break; + // Literal <%% mode, append as raw output + case Template.modes.LITERAL: + this._addOutput(line); + break; + } + } + // In string mode, just add the output + else { + this._addOutput(line); + } + } + + if (self.opts.compileDebug && newLineCount) { + this.currentLine += newLineCount; + this.source += ' ; __line = ' + this.currentLine + '\n'; + } + } +}; + +/** + * Escape characters reserved in XML. + * + * This is simply an export of {@link module:utils.escapeXML}. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + * + * @param {String} markup Input string + * @return {String} Escaped string + * @public + * @func + * */ +exports.escapeXML = utils.escapeXML; + +/** + * Express.js support. + * + * This is an alias for {@link module:ejs.renderFile}, in order to support + * Express.js out-of-the-box. + * + * @func + */ + +exports.__express = exports.renderFile; + +/** + * Version of EJS. + * + * @readonly + * @type {String} + * @public + */ + +exports.VERSION = _VERSION_STRING; + +/** + * Name for detection of EJS. + * + * @readonly + * @type {String} + * @public + */ + +exports.name = _NAME; + +/* istanbul ignore if */ +if (typeof window != 'undefined') { + window.ejs = exports; +} diff --git a/node_modules/ejs/lib/utils.js b/node_modules/ejs/lib/utils.js @@ -0,0 +1,167 @@ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +/** + * Private utility functions + * @module utils + * @private + */ + +'use strict'; + +var regExpChars = /[|\\{}()[\]^$+*?.]/g; + +/** + * Escape characters reserved in regular expressions. + * + * If `string` is `undefined` or `null`, the empty string is returned. + * + * @param {String} string Input string + * @return {String} Escaped string + * @static + * @private + */ +exports.escapeRegExpChars = function (string) { + // istanbul ignore if + if (!string) { + return ''; + } + return String(string).replace(regExpChars, '\\$&'); +}; + +var _ENCODE_HTML_RULES = { + '&': '&amp;', + '<': '&lt;', + '>': '&gt;', + '"': '&#34;', + "'": '&#39;' +}; +var _MATCH_HTML = /[&<>'"]/g; + +function encode_char(c) { + return _ENCODE_HTML_RULES[c] || c; +} + +/** + * Stringified version of constants used by {@link module:utils.escapeXML}. + * + * It is used in the process of generating {@link ClientFunction}s. + * + * @readonly + * @type {String} + */ + +var escapeFuncStr = + 'var _ENCODE_HTML_RULES = {\n' ++ ' "&": "&amp;"\n' ++ ' , "<": "&lt;"\n' ++ ' , ">": "&gt;"\n' ++ ' , \'"\': "&#34;"\n' ++ ' , "\'": "&#39;"\n' ++ ' }\n' ++ ' , _MATCH_HTML = /[&<>\'"]/g;\n' ++ 'function encode_char(c) {\n' ++ ' return _ENCODE_HTML_RULES[c] || c;\n' ++ '};\n'; + +/** + * Escape characters reserved in XML. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + * + * @implements {EscapeCallback} + * @param {String} markup Input string + * @return {String} Escaped string + * @static + * @private + */ + +exports.escapeXML = function (markup) { + return markup == undefined + ? '' + : String(markup) + .replace(_MATCH_HTML, encode_char); +}; +exports.escapeXML.toString = function () { + return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr; +}; + +/** + * Naive copy of properties from one object to another. + * Does not recurse into non-scalar properties + * Does not check to see if the property has a value before copying + * + * @param {Object} to Destination object + * @param {Object} from Source object + * @return {Object} Destination object + * @static + * @private + */ +exports.shallowCopy = function (to, from) { + from = from || {}; + for (var p in from) { + to[p] = from[p]; + } + return to; +}; + +/** + * Naive copy of a list of key names, from one object to another. + * Only copies property if it is actually defined + * Does not recurse into non-scalar properties + * + * @param {Object} to Destination object + * @param {Object} from Source object + * @param {Array} list List of properties to copy + * @return {Object} Destination object + * @static + * @private + */ +exports.shallowCopyFromList = function (to, from, list) { + for (var i = 0; i < list.length; i++) { + var p = list[i]; + if (typeof from[p] != 'undefined') { + to[p] = from[p]; + } + } + return to; +}; + +/** + * Simple in-process cache implementation. Does not implement limits of any + * sort. + * + * @implements Cache + * @static + * @private + */ +exports.cache = { + _data: {}, + set: function (key, val) { + this._data[key] = val; + }, + get: function (key) { + return this._data[key]; + }, + remove: function (key) { + delete this._data[key]; + }, + reset: function () { + this._data = {}; + } +}; diff --git a/node_modules/ejs/package.json b/node_modules/ejs/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ejs@^3.0.1", + "_id": "ejs@3.0.1", + "_inBundle": false, + "_integrity": "sha512-cuIMtJwxvzumSAkqaaoGY/L6Fc/t6YvoP9/VIaK0V/CyqKLEQ8sqODmYfy/cjXEdZ9+OOL8TecbJu+1RsofGDw==", + "_location": "/ejs", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ejs@^3.0.1", + "name": "ejs", + "escapedName": "ejs", + "rawSpec": "^3.0.1", + "saveSpec": null, + "fetchSpec": "^3.0.1" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/ejs/-/ejs-3.0.1.tgz", + "_shasum": "30c8f6ee9948502cc32e85c37a3f8b39b5a614a5", + "_spec": "ejs@^3.0.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph", + "author": { + "name": "Matthew Eernisse", + "email": "mde@fleegix.org", + "url": "http://fleegix.org" + }, + "bugs": { + "url": "https://github.com/mde/ejs/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Embedded JavaScript templates", + "devDependencies": { + "browserify": "^13.1.1", + "eslint": "^4.14.0", + "git-directory-deploy": "^1.5.1", + "jake": "^10.3.1", + "jsdoc": "^3.4.0", + "lru-cache": "^4.0.1", + "mocha": "^5.0.5", + "uglify-js": "^3.3.16" + }, + "engines": { + "node": ">=0.10.0" + }, + "homepage": "https://github.com/mde/ejs", + "keywords": [ + "template", + "engine", + "ejs" + ], + "license": "Apache-2.0", + "main": "./lib/ejs.js", + "name": "ejs", + "repository": { + "type": "git", + "url": "git://github.com/mde/ejs.git" + }, + "scripts": { + "postinstall": "node ./postinstall.js", + "test": "mocha" + }, + "version": "3.0.1" +} diff --git a/node_modules/ejs/postinstall.js b/node_modules/ejs/postinstall.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node + +'use strict'; + +function isTrue(value) { + return !!value && value !== '0' && value !== 'false'; +} + +let envDisable = isTrue(process.env.DISABLE_OPENCOLLECTIVE) || isTrue(process.env.CI); +let logLevel = process.env.npm_config_loglevel; +let logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1; + +if (!envDisable && !logLevelDisplay) { + console.log('Thank you for installing \u001b[35mEJS\u001b[0m: built with the \u001b[32mJake\u001b[0m JavaScript build tool (\u001b[32mhttps://jakejs.com/\u001b[0m)\n'); +} + + diff --git a/node_modules/engine.io-client/CHANGELOG.md b/node_modules/engine.io-client/CHANGELOG.md @@ -0,0 +1,9 @@ +## [3.4.1](https://github.com/socketio/engine.io-client/compare/3.4.0...3.4.1) (2020-04-17) + + +### Bug Fixes + +* use globalThis polyfill instead of self/global ([357f01d](https://github.com/socketio/engine.io-client/commit/357f01d90448d8565b650377bc7cabb351d991bd)) + + + diff --git a/node_modules/engine.io-client/LICENSE b/node_modules/engine.io-client/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2015 Automattic <dev@cloudup.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/engine.io-client/README.md b/node_modules/engine.io-client/README.md @@ -0,0 +1,300 @@ + +# Engine.IO client + +[![Build Status](https://travis-ci.org/socketio/engine.io-client.svg?branch=master)](http://travis-ci.org/socketio/engine.io-client) +[![NPM version](https://badge.fury.io/js/engine.io-client.svg)](http://badge.fury.io/js/engine.io-client) + +This is the client for [Engine.IO](http://github.com/socketio/engine.io), +the implementation of transport-based cross-browser/cross-device +bi-directional communication layer for [Socket.IO](http://github.com/socketio/socket.io). + +## How to use + +### Standalone + +You can find an `engine.io.js` file in this repository, which is a +standalone build you can use as follows: + +```html +<script src="/path/to/engine.io.js"></script> +<script> + // eio = Socket + var socket = eio('ws://localhost'); + socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); + }); +</script> +``` + +### With browserify + +Engine.IO is a commonjs module, which means you can include it by using +`require` on the browser and package using [browserify](http://browserify.org/): + +1. install the client package + + ```bash + $ npm install engine.io-client + ``` + +1. write your app code + + ```js + var socket = require('engine.io-client')('ws://localhost'); + socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); + }); + ``` + +1. build your app bundle + + ```bash + $ browserify app.js > bundle.js + ``` + +1. include on your page + + ```html + <script src="/path/to/bundle.js"></script> + ``` + +### Sending and receiving binary + +```html +<script src="/path/to/engine.io.js"></script> +<script> + var socket = new eio.Socket('ws://localhost/'); + socket.binaryType = 'blob'; + socket.on('open', function () { + socket.send(new Int8Array(5)); + socket.on('message', function(blob){}); + socket.on('close', function(){ }); + }); +</script> +``` + +### Node.JS + +Add `engine.io-client` to your `package.json` and then: + +```js +var socket = require('engine.io-client')('ws://localhost'); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +### Node.js with certificates +```js +var opts = { + key: fs.readFileSync('test/fixtures/client.key'), + cert: fs.readFileSync('test/fixtures/client.crt'), + ca: fs.readFileSync('test/fixtures/ca.crt') +}; + +var socket = require('engine.io-client')('ws://localhost', opts); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +### Node.js with extraHeaders +```js +var opts = { + extraHeaders: { + 'X-Custom-Header-For-My-Project': 'my-secret-access-token', + 'Cookie': 'user_session=NI2JlCKF90aE0sJZD9ZzujtdsUqNYSBYxzlTsvdSUe35ZzdtVRGqYFr0kdGxbfc5gUOkR9RGp20GVKza; path=/; expires=Tue, 07-Apr-2015 18:18:08 GMT; secure; HttpOnly' + } +}; + +var socket = require('engine.io-client')('ws://localhost', opts); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +## Features + +- Lightweight +- Runs on browser and node.js seamlessly +- Transports are independent of `Engine` + - Easy to debug + - Easy to unit test +- Runs inside HTML5 WebWorker +- Can send and receive binary data + - Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer + in Node + - When XHR2 or WebSockets are used, binary is emitted directly. Otherwise + binary is encoded into base64 strings, and decoded when binary types are + supported. + - With browsers that don't support ArrayBuffer, an object { base64: true, + data: dataAsBase64String } is emitted on the `message` event. + +## API + +### Socket + +The client class. Mixes in [Emitter](http://github.com/component/emitter). +Exposed as `eio` in the browser standalone build. + +#### Properties + +- `protocol` _(Number)_: protocol revision number +- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers, + and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's + supported. + +#### Events + +- `open` + - Fired upon successful connection. +- `message` + - Fired when data is received from the server. + - **Arguments** + - `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing + binary data +- `close` + - Fired upon disconnection. In compliance with the WebSocket API spec, this event may be + fired even if the `open` event does not occur (i.e. due to connection error or `close()`). +- `error` + - Fired when an error occurs. +- `flush` + - Fired upon completing a buffer flush +- `drain` + - Fired after `drain` event of transport if writeBuffer is empty +- `upgradeError` + - Fired if an error occurs with a transport we're trying to upgrade to. +- `upgrade` + - Fired upon upgrade success, after the new transport is set +- `ping` + - Fired upon _flushing_ a ping packet (ie: actual packet write out) +- `pong` + - Fired upon receiving a pong packet. + +#### Methods + +- **constructor** + - Initializes the client + - **Parameters** + - `String` uri + - `Object`: optional, options object + - **Options** + - `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only) + - `upgrade` (`Boolean`): defaults to true, whether the client should try + to upgrade the transport from long-polling to something better. + - `forceJSONP` (`Boolean`): forces JSONP for polling transport. + - `jsonp` (`Boolean`): determines whether to use JSONP when + necessary for polling. If disabled (by settings to false) an error will + be emitted (saying "No transports available") if no other transports + are available. If another transport is available for opening a + connection (e.g. WebSocket) that transport + will be used instead. + - `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary. + - `enablesXDR` (`Boolean`): enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to `false` because XDomainRequest has a flaw of not sending cookie. + - `withCredentials` (`Boolean`): defaults to `true`, whether to include credentials (cookies, authorization headers, TLS client certificates, etc.) with cross-origin XHR polling requests. + - `timestampRequests` (`Boolean`): whether to add the timestamp with each + transport request. Note: polling requests are always stamped unless this + option is explicitly set to `false` (`false`) + - `timestampParam` (`String`): timestamp parameter (`t`) + - `policyPort` (`Number`): port the policy server listens on (`843`) + - `path` (`String`): path to connect to, default is `/engine.io` + - `transports` (`Array`): a list of transports to try (in order). + Defaults to `['polling', 'websocket']`. `Engine` + always attempts to connect directly with the first one, provided the + feature detection test for it passes. + - `transportOptions` (`Object`): hash of options, indexed by transport name, overriding the common options for the given transport + - `rememberUpgrade` (`Boolean`): defaults to false. + If true and if the previous websocket connection to the server succeeded, + the connection attempt will bypass the normal upgrade process and will initially + try websocket. A connection attempt following a transport error will use the + normal upgrade process. It is recommended you turn this on only when using + SSL/TLS connections, or if you know that your network does not block websockets. + - `pfx` (`String`|`Buffer`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information. + - `key` (`String`): Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information. + - `passphrase` (`String`): A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information. + - `cert` (`String`): Public x509 certificate to use. Can be used in Node.js client environment to manually specify certificate information. + - `ca` (`String`|`Array`): An authority certificate or array of authority certificates to check the remote host against.. Can be used in Node.js client environment to manually specify certificate information. + - `ciphers` (`String`): A string describing the ciphers to use or exclude. Consult the [cipher format list](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details on the format. Can be used in Node.js client environment to manually specify certificate information. + - `rejectUnauthorized` (`Boolean`): If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Can be used in Node.js client environment to manually specify certificate information. + - `perMessageDeflate` (`Object|Boolean`): parameters of the WebSocket permessage-deflate extension + (see [ws module](https://github.com/einaros/ws) api docs). Set to `false` to disable. (`true`) + - `threshold` (`Number`): data is compressed only if the byte size is above this value. This option is ignored on the browser. (`1024`) + - `extraHeaders` (`Object`): Headers that will be passed for each request to the server (via xhr-polling and via websockets). These values then can be used during handshake or for special proxies. Can only be used in Node.js client environment. + - `onlyBinaryUpgrades` (`Boolean`): whether transport upgrades should be restricted to transports supporting binary data (`false`) + - `forceNode` (`Boolean`): Uses NodeJS implementation for websockets - even if there is a native Browser-Websocket available, which is preferred by default over the NodeJS implementation. (This is useful when using hybrid platforms like nw.js or electron) (`false`, NodeJS only) + - `localAddress` (`String`): the local IP address to connect to + - **Polling-only options** + - `requestTimeout` (`Number`): Timeout for xhr-polling requests in milliseconds (`0`) + - **Websocket-only options** + - `protocols` (`Array`): a list of subprotocols (see [MDN reference](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Subprotocols)) +- `send` + - Sends a message to the server + - **Parameters** + - `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send + - `Object`: optional, options object + - `Function`: optional, callback upon `drain` + - **Options** + - `compress` (`Boolean`): whether to compress sending data. This option is ignored and forced to be `true` on the browser. (`true`) +- `close` + - Disconnects the client. + +### Transport + +The transport class. Private. _Inherits from EventEmitter_. + +#### Events + +- `poll`: emitted by polling transports upon starting a new request +- `pollComplete`: emitted by polling transports upon completing a request +- `drain`: emitted by polling transports upon a buffer drain + +## Tests + +`engine.io-client` is used to test +[engine](http://github.com/socketio/engine.io). Running the `engine.io` +test suite ensures the client works and vice-versa. + +Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can +run the tests locally using the following command. + +``` +./node_modules/.bin/zuul --local 8080 -- test/index.js +``` + +Additionally, `engine.io-client` has a standalone test suite you can run +with `make test` which will run node.js and browser tests. You must have zuul setup with +a saucelabs account. + +## Support + +The support channels for `engine.io-client` are the same as `socket.io`: + - irc.freenode.net **#socket.io** + - [Google Groups](http://groups.google.com/group/socket_io) + - [Website](http://socket.io) + +## Development + +To contribute patches, run tests or benchmarks, make sure to clone the +repository: + +```bash +git clone git://github.com/socketio/engine.io-client.git +``` + +Then: + +```bash +cd engine.io-client +npm install +``` + +See the `Tests` section above for how to run tests before submitting any patches. + +## License + +MIT - Copyright (c) 2014 Automattic, Inc. diff --git a/node_modules/engine.io-client/engine.io.js b/node_modules/engine.io-client/engine.io.js @@ -0,0 +1,4716 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["eio"] = factory(); + else + root["eio"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + + module.exports = __webpack_require__(1); + + /** + * Exports parser + * + * @api public + * + */ + module.exports.parser = __webpack_require__(9); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var transports = __webpack_require__(2); + var Emitter = __webpack_require__(18); + var debug = __webpack_require__(22)('engine.io-client:socket'); + var index = __webpack_require__(29); + var parser = __webpack_require__(9); + var parseuri = __webpack_require__(30); + var parseqs = __webpack_require__(19); + + /** + * Module exports. + */ + + module.exports = Socket; + + /** + * Socket constructor. + * + * @param {String|Object} uri or options + * @param {Object} options + * @api public + */ + + function Socket (uri, opts) { + if (!(this instanceof Socket)) return new Socket(uri, opts); + + opts = opts || {}; + + if (uri && 'object' === typeof uri) { + opts = uri; + uri = null; + } + + if (uri) { + uri = parseuri(uri); + opts.hostname = uri.host; + opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; + opts.port = uri.port; + if (uri.query) opts.query = uri.query; + } else if (opts.host) { + opts.hostname = parseuri(opts.host).host; + } + + this.secure = null != opts.secure ? opts.secure + : (typeof location !== 'undefined' && 'https:' === location.protocol); + + if (opts.hostname && !opts.port) { + // if no port is specified manually, use the protocol default + opts.port = this.secure ? '443' : '80'; + } + + this.agent = opts.agent || false; + this.hostname = opts.hostname || + (typeof location !== 'undefined' ? location.hostname : 'localhost'); + this.port = opts.port || (typeof location !== 'undefined' && location.port + ? location.port + : (this.secure ? 443 : 80)); + this.query = opts.query || {}; + if ('string' === typeof this.query) this.query = parseqs.decode(this.query); + this.upgrade = false !== opts.upgrade; + this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; + this.forceJSONP = !!opts.forceJSONP; + this.jsonp = false !== opts.jsonp; + this.forceBase64 = !!opts.forceBase64; + this.enablesXDR = !!opts.enablesXDR; + this.withCredentials = false !== opts.withCredentials; + this.timestampParam = opts.timestampParam || 't'; + this.timestampRequests = opts.timestampRequests; + this.transports = opts.transports || ['polling', 'websocket']; + this.transportOptions = opts.transportOptions || {}; + this.readyState = ''; + this.writeBuffer = []; + this.prevBufferLen = 0; + this.policyPort = opts.policyPort || 843; + this.rememberUpgrade = opts.rememberUpgrade || false; + this.binaryType = null; + this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; + this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; + + if (true === this.perMessageDeflate) this.perMessageDeflate = {}; + if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { + this.perMessageDeflate.threshold = 1024; + } + + // SSL options for Node.js client + this.pfx = opts.pfx || null; + this.key = opts.key || null; + this.passphrase = opts.passphrase || null; + this.cert = opts.cert || null; + this.ca = opts.ca || null; + this.ciphers = opts.ciphers || null; + this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; + this.forceNode = !!opts.forceNode; + + // detect ReactNative environment + this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative'); + + // other options for Node.js or ReactNative client + if (typeof self === 'undefined' || this.isReactNative) { + if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { + this.extraHeaders = opts.extraHeaders; + } + + if (opts.localAddress) { + this.localAddress = opts.localAddress; + } + } + + // set on handshake + this.id = null; + this.upgrades = null; + this.pingInterval = null; + this.pingTimeout = null; + + // set on heartbeat + this.pingIntervalTimer = null; + this.pingTimeoutTimer = null; + + this.open(); + } + + Socket.priorWebsocketSuccess = false; + + /** + * Mix in `Emitter`. + */ + + Emitter(Socket.prototype); + + /** + * Protocol version. + * + * @api public + */ + + Socket.protocol = parser.protocol; // this is an int + + /** + * Expose deps for legacy compatibility + * and standalone browser access. + */ + + Socket.Socket = Socket; + Socket.Transport = __webpack_require__(8); + Socket.transports = __webpack_require__(2); + Socket.parser = __webpack_require__(9); + + /** + * Creates transport of the given type. + * + * @param {String} transport name + * @return {Transport} + * @api private + */ + + Socket.prototype.createTransport = function (name) { + debug('creating transport "%s"', name); + var query = clone(this.query); + + // append engine.io protocol identifier + query.EIO = parser.protocol; + + // transport name + query.transport = name; + + // per-transport options + var options = this.transportOptions[name] || {}; + + // session id if we already have one + if (this.id) query.sid = this.id; + + var transport = new transports[name]({ + query: query, + socket: this, + agent: options.agent || this.agent, + hostname: options.hostname || this.hostname, + port: options.port || this.port, + secure: options.secure || this.secure, + path: options.path || this.path, + forceJSONP: options.forceJSONP || this.forceJSONP, + jsonp: options.jsonp || this.jsonp, + forceBase64: options.forceBase64 || this.forceBase64, + enablesXDR: options.enablesXDR || this.enablesXDR, + withCredentials: options.withCredentials || this.withCredentials, + timestampRequests: options.timestampRequests || this.timestampRequests, + timestampParam: options.timestampParam || this.timestampParam, + policyPort: options.policyPort || this.policyPort, + pfx: options.pfx || this.pfx, + key: options.key || this.key, + passphrase: options.passphrase || this.passphrase, + cert: options.cert || this.cert, + ca: options.ca || this.ca, + ciphers: options.ciphers || this.ciphers, + rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized, + perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate, + extraHeaders: options.extraHeaders || this.extraHeaders, + forceNode: options.forceNode || this.forceNode, + localAddress: options.localAddress || this.localAddress, + requestTimeout: options.requestTimeout || this.requestTimeout, + protocols: options.protocols || void (0), + isReactNative: this.isReactNative + }); + + return transport; + }; + + function clone (obj) { + var o = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + o[i] = obj[i]; + } + } + return o; + } + + /** + * Initializes transport to use and starts probe. + * + * @api private + */ + Socket.prototype.open = function () { + var transport; + if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { + transport = 'websocket'; + } else if (0 === this.transports.length) { + // Emit error on next tick so it can be listened to + var self = this; + setTimeout(function () { + self.emit('error', 'No transports available'); + }, 0); + return; + } else { + transport = this.transports[0]; + } + this.readyState = 'opening'; + + // Retry with the next transport if the transport is disabled (jsonp: false) + try { + transport = this.createTransport(transport); + } catch (e) { + this.transports.shift(); + this.open(); + return; + } + + transport.open(); + this.setTransport(transport); + }; + + /** + * Sets the current transport. Disables the existing one (if any). + * + * @api private + */ + + Socket.prototype.setTransport = function (transport) { + debug('setting transport %s', transport.name); + var self = this; + + if (this.transport) { + debug('clearing existing transport %s', this.transport.name); + this.transport.removeAllListeners(); + } + + // set up transport + this.transport = transport; + + // set up transport listeners + transport + .on('drain', function () { + self.onDrain(); + }) + .on('packet', function (packet) { + self.onPacket(packet); + }) + .on('error', function (e) { + self.onError(e); + }) + .on('close', function () { + self.onClose('transport close'); + }); + }; + + /** + * Probes a transport. + * + * @param {String} transport name + * @api private + */ + + Socket.prototype.probe = function (name) { + debug('probing transport "%s"', name); + var transport = this.createTransport(name, { probe: 1 }); + var failed = false; + var self = this; + + Socket.priorWebsocketSuccess = false; + + function onTransportOpen () { + if (self.onlyBinaryUpgrades) { + var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; + failed = failed || upgradeLosesBinary; + } + if (failed) return; + + debug('probe transport "%s" opened', name); + transport.send([{ type: 'ping', data: 'probe' }]); + transport.once('packet', function (msg) { + if (failed) return; + if ('pong' === msg.type && 'probe' === msg.data) { + debug('probe transport "%s" pong', name); + self.upgrading = true; + self.emit('upgrading', transport); + if (!transport) return; + Socket.priorWebsocketSuccess = 'websocket' === transport.name; + + debug('pausing current transport "%s"', self.transport.name); + self.transport.pause(function () { + if (failed) return; + if ('closed' === self.readyState) return; + debug('changing transport and sending upgrade packet'); + + cleanup(); + + self.setTransport(transport); + transport.send([{ type: 'upgrade' }]); + self.emit('upgrade', transport); + transport = null; + self.upgrading = false; + self.flush(); + }); + } else { + debug('probe transport "%s" failed', name); + var err = new Error('probe error'); + err.transport = transport.name; + self.emit('upgradeError', err); + } + }); + } + + function freezeTransport () { + if (failed) return; + + // Any callback called by transport should be ignored since now + failed = true; + + cleanup(); + + transport.close(); + transport = null; + } + + // Handle any error that happens while probing + function onerror (err) { + var error = new Error('probe error: ' + err); + error.transport = transport.name; + + freezeTransport(); + + debug('probe transport "%s" failed because of error: %s', name, err); + + self.emit('upgradeError', error); + } + + function onTransportClose () { + onerror('transport closed'); + } + + // When the socket is closed while we're probing + function onclose () { + onerror('socket closed'); + } + + // When the socket is upgraded while we're probing + function onupgrade (to) { + if (transport && to.name !== transport.name) { + debug('"%s" works - aborting "%s"', to.name, transport.name); + freezeTransport(); + } + } + + // Remove all listeners on the transport and on self + function cleanup () { + transport.removeListener('open', onTransportOpen); + transport.removeListener('error', onerror); + transport.removeListener('close', onTransportClose); + self.removeListener('close', onclose); + self.removeListener('upgrading', onupgrade); + } + + transport.once('open', onTransportOpen); + transport.once('error', onerror); + transport.once('close', onTransportClose); + + this.once('close', onclose); + this.once('upgrading', onupgrade); + + transport.open(); + }; + + /** + * Called when connection is deemed open. + * + * @api public + */ + + Socket.prototype.onOpen = function () { + debug('socket open'); + this.readyState = 'open'; + Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; + this.emit('open'); + this.flush(); + + // we check for `readyState` in case an `open` + // listener already closed the socket + if ('open' === this.readyState && this.upgrade && this.transport.pause) { + debug('starting upgrade probes'); + for (var i = 0, l = this.upgrades.length; i < l; i++) { + this.probe(this.upgrades[i]); + } + } + }; + + /** + * Handles a packet. + * + * @api private + */ + + Socket.prototype.onPacket = function (packet) { + if ('opening' === this.readyState || 'open' === this.readyState || + 'closing' === this.readyState) { + debug('socket receive: type "%s", data "%s"', packet.type, packet.data); + + this.emit('packet', packet); + + // Socket is live - any packet counts + this.emit('heartbeat'); + + switch (packet.type) { + case 'open': + this.onHandshake(JSON.parse(packet.data)); + break; + + case 'pong': + this.setPing(); + this.emit('pong'); + break; + + case 'error': + var err = new Error('server error'); + err.code = packet.data; + this.onError(err); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + debug('packet received with socket readyState "%s"', this.readyState); + } + }; + + /** + * Called upon handshake completion. + * + * @param {Object} handshake obj + * @api private + */ + + Socket.prototype.onHandshake = function (data) { + this.emit('handshake', data); + this.id = data.sid; + this.transport.query.sid = data.sid; + this.upgrades = this.filterUpgrades(data.upgrades); + this.pingInterval = data.pingInterval; + this.pingTimeout = data.pingTimeout; + this.onOpen(); + // In case open handler closes socket + if ('closed' === this.readyState) return; + this.setPing(); + + // Prolong liveness of socket on heartbeat + this.removeListener('heartbeat', this.onHeartbeat); + this.on('heartbeat', this.onHeartbeat); + }; + + /** + * Resets ping timeout. + * + * @api private + */ + + Socket.prototype.onHeartbeat = function (timeout) { + clearTimeout(this.pingTimeoutTimer); + var self = this; + self.pingTimeoutTimer = setTimeout(function () { + if ('closed' === self.readyState) return; + self.onClose('ping timeout'); + }, timeout || (self.pingInterval + self.pingTimeout)); + }; + + /** + * Pings server every `this.pingInterval` and expects response + * within `this.pingTimeout` or closes connection. + * + * @api private + */ + + Socket.prototype.setPing = function () { + var self = this; + clearTimeout(self.pingIntervalTimer); + self.pingIntervalTimer = setTimeout(function () { + debug('writing ping packet - expecting pong within %sms', self.pingTimeout); + self.ping(); + self.onHeartbeat(self.pingTimeout); + }, self.pingInterval); + }; + + /** + * Sends a ping packet. + * + * @api private + */ + + Socket.prototype.ping = function () { + var self = this; + this.sendPacket('ping', function () { + self.emit('ping'); + }); + }; + + /** + * Called on `drain` event + * + * @api private + */ + + Socket.prototype.onDrain = function () { + this.writeBuffer.splice(0, this.prevBufferLen); + + // setting prevBufferLen = 0 is very important + // for example, when upgrading, upgrade packet is sent over, + // and a nonzero prevBufferLen could cause problems on `drain` + this.prevBufferLen = 0; + + if (0 === this.writeBuffer.length) { + this.emit('drain'); + } else { + this.flush(); + } + }; + + /** + * Flush write buffers. + * + * @api private + */ + + Socket.prototype.flush = function () { + if ('closed' !== this.readyState && this.transport.writable && + !this.upgrading && this.writeBuffer.length) { + debug('flushing %d packets in socket', this.writeBuffer.length); + this.transport.send(this.writeBuffer); + // keep track of current length of writeBuffer + // splice writeBuffer and callbackBuffer on `drain` + this.prevBufferLen = this.writeBuffer.length; + this.emit('flush'); + } + }; + + /** + * Sends a message. + * + * @param {String} message. + * @param {Function} callback function. + * @param {Object} options. + * @return {Socket} for chaining. + * @api public + */ + + Socket.prototype.write = + Socket.prototype.send = function (msg, options, fn) { + this.sendPacket('message', msg, options, fn); + return this; + }; + + /** + * Sends a packet. + * + * @param {String} packet type. + * @param {String} data. + * @param {Object} options. + * @param {Function} callback function. + * @api private + */ + + Socket.prototype.sendPacket = function (type, data, options, fn) { + if ('function' === typeof data) { + fn = data; + data = undefined; + } + + if ('function' === typeof options) { + fn = options; + options = null; + } + + if ('closing' === this.readyState || 'closed' === this.readyState) { + return; + } + + options = options || {}; + options.compress = false !== options.compress; + + var packet = { + type: type, + data: data, + options: options + }; + this.emit('packetCreate', packet); + this.writeBuffer.push(packet); + if (fn) this.once('flush', fn); + this.flush(); + }; + + /** + * Closes the connection. + * + * @api private + */ + + Socket.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.readyState = 'closing'; + + var self = this; + + if (this.writeBuffer.length) { + this.once('drain', function () { + if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + }); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + } + + function close () { + self.onClose('forced close'); + debug('socket closing - telling transport to close'); + self.transport.close(); + } + + function cleanupAndClose () { + self.removeListener('upgrade', cleanupAndClose); + self.removeListener('upgradeError', cleanupAndClose); + close(); + } + + function waitForUpgrade () { + // wait for upgrade to finish since we can't send packets while pausing a transport + self.once('upgrade', cleanupAndClose); + self.once('upgradeError', cleanupAndClose); + } + + return this; + }; + + /** + * Called upon transport error + * + * @api private + */ + + Socket.prototype.onError = function (err) { + debug('socket error %j', err); + Socket.priorWebsocketSuccess = false; + this.emit('error', err); + this.onClose('transport error', err); + }; + + /** + * Called upon transport close. + * + * @api private + */ + + Socket.prototype.onClose = function (reason, desc) { + if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { + debug('socket close with reason: "%s"', reason); + var self = this; + + // clear timers + clearTimeout(this.pingIntervalTimer); + clearTimeout(this.pingTimeoutTimer); + + // stop event from firing again for transport + this.transport.removeAllListeners('close'); + + // ensure transport won't stay open + this.transport.close(); + + // ignore further transport communication + this.transport.removeAllListeners(); + + // set ready state + this.readyState = 'closed'; + + // clear session id + this.id = null; + + // emit close event + this.emit('close', reason, desc); + + // clean buffers after, so users can still + // grab the buffers on `close` event + self.writeBuffer = []; + self.prevBufferLen = 0; + } + }; + + /** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + + Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i < j; i++) { + if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); + } + return filteredUpgrades; + }; + + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module dependencies + */ + + var XMLHttpRequest = __webpack_require__(3); + var XHR = __webpack_require__(6); + var JSONP = __webpack_require__(26); + var websocket = __webpack_require__(27); + + /** + * Export transports. + */ + + exports.polling = polling; + exports.websocket = websocket; + + /** + * Polling transport polymorphic constructor. + * Decides on xhr vs jsonp based on feature detection. + * + * @api private + */ + + function polling (opts) { + var xhr; + var xd = false; + var xs = false; + var jsonp = false !== opts.jsonp; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + xd = opts.hostname !== location.hostname || port !== opts.port; + xs = opts.secure !== isSSL; + } + + opts.xdomain = xd; + opts.xscheme = xs; + xhr = new XMLHttpRequest(opts); + + if ('open' in xhr && !opts.forceJSONP) { + return new XHR(opts); + } else { + if (!jsonp) throw new Error('JSONP disabled'); + return new JSONP(opts); + } + } + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + // browser shim for xmlhttprequest module + + var hasCORS = __webpack_require__(4); + var globalThis = __webpack_require__(5); + + module.exports = function (opts) { + var xdomain = opts.xdomain; + + // scheme must be same when usign XDomainRequest + // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx + var xscheme = opts.xscheme; + + // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. + // https://github.com/Automattic/engine.io-client/pull/217 + var enablesXDR = opts.enablesXDR; + + // XMLHttpRequest can be disabled on IE + try { + if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e) { } + + // Use XDomainRequest for IE8 if enablesXDR is true + // because loading bar keeps flashing when using jsonp-polling + // https://github.com/yujiosaka/socke.io-ie8-loading-example + try { + if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { + return new XDomainRequest(); + } + } catch (e) { } + + if (!xdomain) { + try { + return new globalThis[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); + } catch (e) { } + } + }; + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + + /** + * Module exports. + * + * Logic borrowed from Modernizr: + * + * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js + */ + + try { + module.exports = typeof XMLHttpRequest !== 'undefined' && + 'withCredentials' in new XMLHttpRequest(); + } catch (err) { + // if XMLHttp support is disabled in IE then it will throw + // when trying to create + module.exports = false; + } + + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + module.exports = (function () { + if (typeof self !== 'undefined') { + return self; + } else if (typeof window !== 'undefined') { + return window; + } else { + return Function('return this')(); // eslint-disable-line no-new-func + } + })(); + + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + /* global attachEvent */ + + /** + * Module requirements. + */ + + var XMLHttpRequest = __webpack_require__(3); + var Polling = __webpack_require__(7); + var Emitter = __webpack_require__(18); + var inherit = __webpack_require__(20); + var debug = __webpack_require__(22)('engine.io-client:polling-xhr'); + var globalThis = __webpack_require__(5); + + /** + * Module exports. + */ + + module.exports = XHR; + module.exports.Request = Request; + + /** + * Empty function + */ + + function empty () {} + + /** + * XHR Polling constructor. + * + * @param {Object} opts + * @api public + */ + + function XHR (opts) { + Polling.call(this, opts); + this.requestTimeout = opts.requestTimeout; + this.extraHeaders = opts.extraHeaders; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) || + port !== opts.port; + this.xs = opts.secure !== isSSL; + } + } + + /** + * Inherits from Polling. + */ + + inherit(XHR, Polling); + + /** + * XHR supports binary + */ + + XHR.prototype.supportsBinary = true; + + /** + * Creates a request. + * + * @param {String} method + * @api private + */ + + XHR.prototype.request = function (opts) { + opts = opts || {}; + opts.uri = this.uri(); + opts.xd = this.xd; + opts.xs = this.xs; + opts.agent = this.agent || false; + opts.supportsBinary = this.supportsBinary; + opts.enablesXDR = this.enablesXDR; + opts.withCredentials = this.withCredentials; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + opts.requestTimeout = this.requestTimeout; + + // other options for Node.js client + opts.extraHeaders = this.extraHeaders; + + return new Request(opts); + }; + + /** + * Sends data. + * + * @param {String} data to send. + * @param {Function} called upon flush. + * @api private + */ + + XHR.prototype.doWrite = function (data, fn) { + var isBinary = typeof data !== 'string' && data !== undefined; + var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); + var self = this; + req.on('success', fn); + req.on('error', function (err) { + self.onError('xhr post error', err); + }); + this.sendXhr = req; + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + XHR.prototype.doPoll = function () { + debug('xhr poll'); + var req = this.request(); + var self = this; + req.on('data', function (data) { + self.onData(data); + }); + req.on('error', function (err) { + self.onError('xhr poll error', err); + }); + this.pollXhr = req; + }; + + /** + * Request constructor + * + * @param {Object} options + * @api public + */ + + function Request (opts) { + this.method = opts.method || 'GET'; + this.uri = opts.uri; + this.xd = !!opts.xd; + this.xs = !!opts.xs; + this.async = false !== opts.async; + this.data = undefined !== opts.data ? opts.data : null; + this.agent = opts.agent; + this.isBinary = opts.isBinary; + this.supportsBinary = opts.supportsBinary; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + this.requestTimeout = opts.requestTimeout; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + + this.create(); + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Request.prototype); + + /** + * Creates the XHR object and sends the request. + * + * @api private + */ + + Request.prototype.create = function () { + var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + + var xhr = this.xhr = new XMLHttpRequest(opts); + var self = this; + + try { + debug('xhr open %s: %s', this.method, this.uri); + xhr.open(this.method, this.uri, this.async); + try { + if (this.extraHeaders) { + xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); + for (var i in this.extraHeaders) { + if (this.extraHeaders.hasOwnProperty(i)) { + xhr.setRequestHeader(i, this.extraHeaders[i]); + } + } + } + } catch (e) {} + + if ('POST' === this.method) { + try { + if (this.isBinary) { + xhr.setRequestHeader('Content-type', 'application/octet-stream'); + } else { + xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); + } + } catch (e) {} + } + + try { + xhr.setRequestHeader('Accept', '*/*'); + } catch (e) {} + + // ie6 check + if ('withCredentials' in xhr) { + xhr.withCredentials = this.withCredentials; + } + + if (this.requestTimeout) { + xhr.timeout = this.requestTimeout; + } + + if (this.hasXDR()) { + xhr.onload = function () { + self.onLoad(); + }; + xhr.onerror = function () { + self.onError(xhr.responseText); + }; + } else { + xhr.onreadystatechange = function () { + if (xhr.readyState === 2) { + try { + var contentType = xhr.getResponseHeader('Content-Type'); + if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + xhr.responseType = 'arraybuffer'; + } + } catch (e) {} + } + if (4 !== xhr.readyState) return; + if (200 === xhr.status || 1223 === xhr.status) { + self.onLoad(); + } else { + // make sure the `error` event handler that's user-set + // does not throw in the same tick and gets caught here + setTimeout(function () { + self.onError(typeof xhr.status === 'number' ? xhr.status : 0); + }, 0); + } + }; + } + + debug('xhr data %s', this.data); + xhr.send(this.data); + } catch (e) { + // Need to defer since .create() is called directly fhrom the constructor + // and thus the 'error' event can only be only bound *after* this exception + // occurs. Therefore, also, we cannot throw here at all. + setTimeout(function () { + self.onError(e); + }, 0); + return; + } + + if (typeof document !== 'undefined') { + this.index = Request.requestsCount++; + Request.requests[this.index] = this; + } + }; + + /** + * Called upon successful response. + * + * @api private + */ + + Request.prototype.onSuccess = function () { + this.emit('success'); + this.cleanup(); + }; + + /** + * Called if we have data. + * + * @api private + */ + + Request.prototype.onData = function (data) { + this.emit('data', data); + this.onSuccess(); + }; + + /** + * Called upon error. + * + * @api private + */ + + Request.prototype.onError = function (err) { + this.emit('error', err); + this.cleanup(true); + }; + + /** + * Cleans up house. + * + * @api private + */ + + Request.prototype.cleanup = function (fromError) { + if ('undefined' === typeof this.xhr || null === this.xhr) { + return; + } + // xmlhttprequest + if (this.hasXDR()) { + this.xhr.onload = this.xhr.onerror = empty; + } else { + this.xhr.onreadystatechange = empty; + } + + if (fromError) { + try { + this.xhr.abort(); + } catch (e) {} + } + + if (typeof document !== 'undefined') { + delete Request.requests[this.index]; + } + + this.xhr = null; + }; + + /** + * Called upon load. + * + * @api private + */ + + Request.prototype.onLoad = function () { + var data; + try { + var contentType; + try { + contentType = this.xhr.getResponseHeader('Content-Type'); + } catch (e) {} + if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + data = this.xhr.response || this.xhr.responseText; + } else { + data = this.xhr.responseText; + } + } catch (e) { + this.onError(e); + } + if (null != data) { + this.onData(data); + } + }; + + /** + * Check if it has XDomainRequest. + * + * @api private + */ + + Request.prototype.hasXDR = function () { + return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR; + }; + + /** + * Aborts the request. + * + * @api public + */ + + Request.prototype.abort = function () { + this.cleanup(); + }; + + /** + * Aborts pending requests when unloading the window. This is needed to prevent + * memory leaks (e.g. when using IE) and to ensure that no spurious error is + * emitted. + */ + + Request.requestsCount = 0; + Request.requests = {}; + + if (typeof document !== 'undefined') { + if (typeof attachEvent === 'function') { + attachEvent('onunload', unloadHandler); + } else if (typeof addEventListener === 'function') { + var terminationEvent = 'onpagehide' in globalThis ? 'pagehide' : 'unload'; + addEventListener(terminationEvent, unloadHandler, false); + } + } + + function unloadHandler () { + for (var i in Request.requests) { + if (Request.requests.hasOwnProperty(i)) { + Request.requests[i].abort(); + } + } + } + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(8); + var parseqs = __webpack_require__(19); + var parser = __webpack_require__(9); + var inherit = __webpack_require__(20); + var yeast = __webpack_require__(21); + var debug = __webpack_require__(22)('engine.io-client:polling'); + + /** + * Module exports. + */ + + module.exports = Polling; + + /** + * Is XHR2 supported? + */ + + var hasXHR2 = (function () { + var XMLHttpRequest = __webpack_require__(3); + var xhr = new XMLHttpRequest({ xdomain: false }); + return null != xhr.responseType; + })(); + + /** + * Polling interface. + * + * @param {Object} opts + * @api private + */ + + function Polling (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (!hasXHR2 || forceBase64) { + this.supportsBinary = false; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(Polling, Transport); + + /** + * Transport name. + */ + + Polling.prototype.name = 'polling'; + + /** + * Opens the socket (triggers polling). We write a PING message to determine + * when the transport is open. + * + * @api private + */ + + Polling.prototype.doOpen = function () { + this.poll(); + }; + + /** + * Pauses polling. + * + * @param {Function} callback upon buffers are flushed and transport is paused + * @api private + */ + + Polling.prototype.pause = function (onPause) { + var self = this; + + this.readyState = 'pausing'; + + function pause () { + debug('paused'); + self.readyState = 'paused'; + onPause(); + } + + if (this.polling || !this.writable) { + var total = 0; + + if (this.polling) { + debug('we are currently polling - waiting to pause'); + total++; + this.once('pollComplete', function () { + debug('pre-pause polling complete'); + --total || pause(); + }); + } + + if (!this.writable) { + debug('we are currently writing - waiting to pause'); + total++; + this.once('drain', function () { + debug('pre-pause writing complete'); + --total || pause(); + }); + } + } else { + pause(); + } + }; + + /** + * Starts polling cycle. + * + * @api public + */ + + Polling.prototype.poll = function () { + debug('polling'); + this.polling = true; + this.doPoll(); + this.emit('poll'); + }; + + /** + * Overloads onData to detect payloads. + * + * @api private + */ + + Polling.prototype.onData = function (data) { + var self = this; + debug('polling got data %s', data); + var callback = function (packet, index, total) { + // if its the first message we consider the transport open + if ('opening' === self.readyState) { + self.onOpen(); + } + + // if its a close packet, we close the ongoing requests + if ('close' === packet.type) { + self.onClose(); + return false; + } + + // otherwise bypass onData and handle the message + self.onPacket(packet); + }; + + // decode payload + parser.decodePayload(data, this.socket.binaryType, callback); + + // if an event did not trigger closing + if ('closed' !== this.readyState) { + // if we got data we're not polling + this.polling = false; + this.emit('pollComplete'); + + if ('open' === this.readyState) { + this.poll(); + } else { + debug('ignoring poll - transport state "%s"', this.readyState); + } + } + }; + + /** + * For polling, send a close packet. + * + * @api private + */ + + Polling.prototype.doClose = function () { + var self = this; + + function close () { + debug('writing close packet'); + self.write([{ type: 'close' }]); + } + + if ('open' === this.readyState) { + debug('transport open - closing'); + close(); + } else { + // in case we're trying to close while + // handshaking is in progress (GH-164) + debug('transport not open - deferring close'); + this.once('open', close); + } + }; + + /** + * Writes a packets payload. + * + * @param {Array} data packets + * @param {Function} drain callback + * @api private + */ + + Polling.prototype.write = function (packets) { + var self = this; + this.writable = false; + var callbackfn = function () { + self.writable = true; + self.emit('drain'); + }; + + parser.encodePayload(packets, this.supportsBinary, function (data) { + self.doWrite(data, callbackfn); + }); + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + Polling.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'https' : 'http'; + var port = ''; + + // cache busting is forced + if (false !== this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + if (!this.supportsBinary && !query.sid) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // avoid port if default for schema + if (this.port && (('https' === schema && Number(this.port) !== 443) || + ('http' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var parser = __webpack_require__(9); + var Emitter = __webpack_require__(18); + + /** + * Module exports. + */ + + module.exports = Transport; + + /** + * Transport abstract constructor. + * + * @param {Object} options. + * @api private + */ + + function Transport (opts) { + this.path = opts.path; + this.hostname = opts.hostname; + this.port = opts.port; + this.secure = opts.secure; + this.query = opts.query; + this.timestampParam = opts.timestampParam; + this.timestampRequests = opts.timestampRequests; + this.readyState = ''; + this.agent = opts.agent || false; + this.socket = opts.socket; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + this.forceNode = opts.forceNode; + + // results of ReactNative environment detection + this.isReactNative = opts.isReactNative; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + this.localAddress = opts.localAddress; + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Transport.prototype); + + /** + * Emits an error. + * + * @param {String} str + * @return {Transport} for chaining + * @api public + */ + + Transport.prototype.onError = function (msg, desc) { + var err = new Error(msg); + err.type = 'TransportError'; + err.description = desc; + this.emit('error', err); + return this; + }; + + /** + * Opens the transport. + * + * @api public + */ + + Transport.prototype.open = function () { + if ('closed' === this.readyState || '' === this.readyState) { + this.readyState = 'opening'; + this.doOpen(); + } + + return this; + }; + + /** + * Closes the transport. + * + * @api private + */ + + Transport.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.doClose(); + this.onClose(); + } + + return this; + }; + + /** + * Sends multiple packets. + * + * @param {Array} packets + * @api private + */ + + Transport.prototype.send = function (packets) { + if ('open' === this.readyState) { + this.write(packets); + } else { + throw new Error('Transport not open'); + } + }; + + /** + * Called upon open + * + * @api private + */ + + Transport.prototype.onOpen = function () { + this.readyState = 'open'; + this.writable = true; + this.emit('open'); + }; + + /** + * Called with data. + * + * @param {String} data + * @api private + */ + + Transport.prototype.onData = function (data) { + var packet = parser.decodePacket(data, this.socket.binaryType); + this.onPacket(packet); + }; + + /** + * Called with a decoded packet. + */ + + Transport.prototype.onPacket = function (packet) { + this.emit('packet', packet); + }; + + /** + * Called upon close. + * + * @api private + */ + + Transport.prototype.onClose = function () { + this.readyState = 'closed'; + this.emit('close'); + }; + + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var keys = __webpack_require__(10); + var hasBinary = __webpack_require__(11); + var sliceBuffer = __webpack_require__(13); + var after = __webpack_require__(14); + var utf8 = __webpack_require__(15); + + var base64encoder; + if (typeof ArrayBuffer !== 'undefined') { + base64encoder = __webpack_require__(16); + } + + /** + * Check if we are running an android browser. That requires us to use + * ArrayBuffer with polling transports... + * + * http://ghinda.net/jpeg-blob-ajax-android/ + */ + + var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); + + /** + * Check if we are running in PhantomJS. + * Uploading a Blob with PhantomJS does not work correctly, as reported here: + * https://github.com/ariya/phantomjs/issues/11395 + * @type boolean + */ + var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); + + /** + * When true, avoids using Blobs to encode payloads. + * @type boolean + */ + var dontSendBlobs = isAndroid || isPhantomJS; + + /** + * Current protocol version. + */ + + exports.protocol = 3; + + /** + * Packet types. + */ + + var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 + }; + + var packetslist = keys(packets); + + /** + * Premade error packet. + */ + + var err = { type: 'error', data: 'parser error' }; + + /** + * Create a blob api even for blob builder when vendor prefixes exist + */ + + var Blob = __webpack_require__(17); + + /** + * Encodes a packet. + * + * <packet type id> [ <data> ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + + exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = false; + } + + if (typeof utf8encode === 'function') { + callback = utf8encode; + utf8encode = null; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } else if (typeof Blob !== 'undefined' && data instanceof Blob) { + return encodeBlob(packet, supportsBinary, callback); + } + + // might be an object with { base64: true, data: dataAsBase64String } + if (data && data.base64) { + return encodeBase64Object(packet, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); + } + + return callback('' + encoded); + + }; + + function encodeBase64Object(packet, callback) { + // packet data is an object { base64: true, data: dataAsBase64String } + var message = 'b' + exports.packets[packet.type] + packet.data.data; + return callback(message); + } + + /** + * Encode packet helpers for binary types + */ + + function encodeArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var contentArray = new Uint8Array(data); + var resultBuffer = new Uint8Array(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++) { + resultBuffer[i+1] = contentArray[i]; + } + + return callback(resultBuffer.buffer); + } + + function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var fr = new FileReader(); + fr.onload = function() { + exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback); + }; + return fr.readAsArrayBuffer(packet.data); + } + + function encodeBlob(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + if (dontSendBlobs) { + return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); + } + + var length = new Uint8Array(1); + length[0] = packets[packet.type]; + var blob = new Blob([length.buffer, packet.data]); + + return callback(blob); + } + + /** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + + exports.encodeBase64Packet = function(packet, callback) { + var message = 'b' + exports.packets[packet.type]; + if (typeof Blob !== 'undefined' && packet.data instanceof Blob) { + var fr = new FileReader(); + fr.onload = function() { + var b64 = fr.result.split(',')[1]; + callback(message + b64); + }; + return fr.readAsDataURL(packet.data); + } + + var b64data; + try { + b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); + } catch (e) { + // iPhone Safari doesn't let you apply with typed arrays + var typed = new Uint8Array(packet.data); + var basic = new Array(typed.length); + for (var i = 0; i < typed.length; i++) { + basic[i] = typed[i]; + } + b64data = String.fromCharCode.apply(null, basic); + } + message += btoa(b64data); + return callback(message); + }; + + /** + * Decodes a packet. Changes format to Blob if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + + exports.decodePacket = function (data, binaryType, utf8decode) { + if (data === undefined) { + return err; + } + // String data + if (typeof data === 'string') { + if (data.charAt(0) === 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + if (utf8decode) { + data = tryDecode(data); + if (data === false) { + return err; + } + } + var type = data.charAt(0); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + var asArray = new Uint8Array(data); + var type = asArray[0]; + var rest = sliceBuffer(data, 1); + if (Blob && binaryType === 'blob') { + rest = new Blob([rest]); + } + return { type: packetslist[type], data: rest }; + }; + + function tryDecode(data) { + try { + data = utf8.decode(data, { strict: false }); + } catch (e) { + return false; + } + return data; + } + + /** + * Decodes a packet encoded in a base64 string + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + + exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + if (!base64encoder) { + return { type: type, data: { base64: true, data: msg.substr(1) } }; + } + + var data = base64encoder.decode(msg.substr(1)); + + if (binaryType === 'blob' && Blob) { + data = new Blob([data]); + } + + return { type: type, data: data }; + }; + + /** + * Encodes multiple messages (payload). + * + * <length>:data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + + exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + var isBinary = hasBinary(packets); + + if (supportsBinary && isBinary) { + if (Blob && !dontSendBlobs) { + return exports.encodePayloadAsBlob(packets, callback); + } + + return exports.encodePayloadAsArrayBuffer(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); + }; + + /** + * Async array map using after + */ + + function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } + } + + /* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + + exports.decodePayload = function (data, binaryType, callback) { + if (typeof data !== 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data === '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '', n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (chr !== ':') { + length += chr; + continue; + } + + if (length === '' || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType, false); + + if (err.type === packet.type && err.data === packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + + if (length !== '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + }; + + /** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number + * 255><data> + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {ArrayBuffer} encoded payload + * @api private + */ + + exports.encodePayloadAsArrayBuffer = function(packets, callback) { + if (!packets.length) { + return callback(new ArrayBuffer(0)); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(data) { + return doneCallback(null, data); + }); + } + + map(packets, encodeOne, function(err, encodedPackets) { + var totalLength = encodedPackets.reduce(function(acc, p) { + var len; + if (typeof p === 'string'){ + len = p.length; + } else { + len = p.byteLength; + } + return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 + }, 0); + + var resultArray = new Uint8Array(totalLength); + + var bufferIndex = 0; + encodedPackets.forEach(function(p) { + var isString = typeof p === 'string'; + var ab = p; + if (isString) { + var view = new Uint8Array(p.length); + for (var i = 0; i < p.length; i++) { + view[i] = p.charCodeAt(i); + } + ab = view.buffer; + } + + if (isString) { // not true binary + resultArray[bufferIndex++] = 0; + } else { // true binary + resultArray[bufferIndex++] = 1; + } + + var lenStr = ab.byteLength.toString(); + for (var i = 0; i < lenStr.length; i++) { + resultArray[bufferIndex++] = parseInt(lenStr[i]); + } + resultArray[bufferIndex++] = 255; + + var view = new Uint8Array(ab); + for (var i = 0; i < view.length; i++) { + resultArray[bufferIndex++] = view[i]; + } + }); + + return callback(resultArray.buffer); + }); + }; + + /** + * Encode as Blob + */ + + exports.encodePayloadAsBlob = function(packets, callback) { + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(encoded) { + var binaryIdentifier = new Uint8Array(1); + binaryIdentifier[0] = 1; + if (typeof encoded === 'string') { + var view = new Uint8Array(encoded.length); + for (var i = 0; i < encoded.length; i++) { + view[i] = encoded.charCodeAt(i); + } + encoded = view.buffer; + binaryIdentifier[0] = 0; + } + + var len = (encoded instanceof ArrayBuffer) + ? encoded.byteLength + : encoded.size; + + var lenStr = len.toString(); + var lengthAry = new Uint8Array(lenStr.length + 1); + for (var i = 0; i < lenStr.length; i++) { + lengthAry[i] = parseInt(lenStr[i]); + } + lengthAry[lenStr.length] = 255; + + if (Blob) { + var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); + doneCallback(null, blob); + } + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(new Blob(results)); + }); + }; + + /* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + * + * @param {ArrayBuffer} data, callback method + * @api public + */ + + exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.byteLength > 0) { + var tailArray = new Uint8Array(bufferTail); + var isString = tailArray[0] === 0; + var msgLength = ''; + + for (var i = 1; ; i++) { + if (tailArray[i] === 255) break; + + // 310 = char length of Number.MAX_VALUE + if (msgLength.length > 310) { + return callback(err, 0, 1); + } + + msgLength += tailArray[i]; + } + + bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); + msgLength = parseInt(msgLength); + + var msg = sliceBuffer(bufferTail, 0, msgLength); + if (isString) { + try { + msg = String.fromCharCode.apply(null, new Uint8Array(msg)); + } catch (e) { + // iPhone Safari doesn't let you apply to typed arrays + var typed = new Uint8Array(msg); + msg = ''; + for (var i = 0; i < typed.length; i++) { + msg += String.fromCharCode(typed[i]); + } + } + } + + buffers.push(msg); + bufferTail = sliceBuffer(bufferTail, msgLength); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType, true), i, total); + }); + }; + + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + + /** + * Gets the keys for an object. + * + * @return {Array} keys + * @api private + */ + + module.exports = Object.keys || function keys (obj){ + var arr = []; + var has = Object.prototype.hasOwnProperty; + + for (var i in obj) { + if (has.call(obj, i)) { + arr.push(i); + } + } + return arr; + }; + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + /* global Blob File */ + + /* + * Module requirements. + */ + + var isArray = __webpack_require__(12); + + var toString = Object.prototype.toString; + var withNativeBlob = typeof Blob === 'function' || + typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'; + var withNativeFile = typeof File === 'function' || + typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'; + + /** + * Module exports. + */ + + module.exports = hasBinary; + + /** + * Checks for binary data. + * + * Supports Buffer, ArrayBuffer, Blob and File. + * + * @param {Object} anything + * @api public + */ + + function hasBinary (obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + if (isArray(obj)) { + for (var i = 0, l = obj.length; i < l; i++) { + if (hasBinary(obj[i])) { + return true; + } + } + return false; + } + + if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) || + (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) || + (withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File) + ) { + return true; + } + + // see: https://github.com/Automattic/has-binary/pull/4 + if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) { + return hasBinary(obj.toJSON(), true); + } + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { + return true; + } + } + + return false; + } + + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + var toString = {}.toString; + + module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + /** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + + module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; + }; + + +/***/ }, +/* 14 */ +/***/ function(module, exports) { + + module.exports = after + + function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } + } + + function noop() {} + + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + /*! https://mths.be/utf8js v2.1.2 by @mathias */ + + var stringFromCharCode = String.fromCharCode; + + // Taken from https://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + // Taken from https://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; + } + + function checkScalarValue(codePoint, strict) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + if (strict) { + throw Error( + 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() + + ' is not a scalar value' + ); + } + return false; + } + return true; + } + /*--------------------------------------------------------------------------*/ + + function createByte(codePoint, shift) { + return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); + } + + function encodeCodePoint(codePoint, strict) { + if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence + symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); + } + else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence + if (!checkScalarValue(codePoint, strict)) { + codePoint = 0xFFFD; + } + symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); + symbol += createByte(codePoint, 6); + } + else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence + symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); + return symbol; + } + + function utf8encode(string, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint, strict); + } + return byteString; + } + + /*--------------------------------------------------------------------------*/ + + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } + + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; + + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); + } + + function decodeSymbol(strict) { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; + + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } + + if (byteIndex == byteCount) { + return false; + } + + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; + + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } + + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + byte2 = readContinuationByte(); + codePoint = ((byte1 & 0x1F) << 6) | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; + if (codePoint >= 0x0800) { + return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) | + (byte3 << 0x06) | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); + } + + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol(strict)) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); + } + + module.exports = { + version: '2.1.2', + encode: utf8encode, + decode: utf8decode + }; + + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + /* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ + (function(){ + "use strict"; + + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // Use a lookup table to find the index. + var lookup = new Uint8Array(256); + for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; + } + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i+1)]; + encoded3 = lookup[base64.charCodeAt(i+2)]; + encoded4 = lookup[base64.charCodeAt(i+3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; + })(); + + +/***/ }, +/* 17 */ +/***/ function(module, exports) { + + /** + * Create a blob builder even when vendor prefixes exist + */ + + var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : + typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder : + typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : + typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : + false; + + /** + * Check if Blob constructor is supported + */ + + var blobSupported = (function() { + try { + var a = new Blob(['hi']); + return a.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if Blob constructor supports ArrayBufferViews + * Fails in Safari 6, so we need to map to ArrayBuffers there. + */ + + var blobSupportsArrayBufferView = blobSupported && (function() { + try { + var b = new Blob([new Uint8Array([1,2])]); + return b.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if BlobBuilder is supported + */ + + var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + + /** + * Helper function that maps ArrayBufferViews to ArrayBuffers + * Used by BlobBuilder constructor and old browsers that didn't + * support it in the Blob constructor. + */ + + function mapArrayBufferViews(ary) { + return ary.map(function(chunk) { + if (chunk.buffer instanceof ArrayBuffer) { + var buf = chunk.buffer; + + // if this is a subarray, make a copy so we only + // include the subarray region from the underlying buffer + if (chunk.byteLength !== buf.byteLength) { + var copy = new Uint8Array(chunk.byteLength); + copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); + buf = copy.buffer; + } + + return buf; + } + + return chunk; + }); + } + + function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + mapArrayBufferViews(ary).forEach(function(part) { + bb.append(part); + }); + + return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); + }; + + function BlobConstructor(ary, options) { + return new Blob(mapArrayBufferViews(ary), options || {}); + }; + + if (typeof Blob !== 'undefined') { + BlobBuilderConstructor.prototype = Blob.prototype; + BlobConstructor.prototype = Blob.prototype; + } + + module.exports = (function() { + if (blobSupported) { + return blobSupportsArrayBufferView ? Blob : BlobConstructor; + } else if (blobBuilderSupported) { + return BlobBuilderConstructor; + } else { + return undefined; + } + })(); + + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + if (true) { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + /** + * Compiles a querystring + * Returns string representation of the object + * + * @param {Object} + * @api private + */ + + exports.encode = function (obj) { + var str = ''; + + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (str.length) str += '&'; + str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); + } + } + + return str; + }; + + /** + * Parses a simple querystring into an object + * + * @param {String} qs + * @api private + */ + + exports.decode = function(qs){ + var qry = {}; + var pairs = qs.split('&'); + for (var i = 0, l = pairs.length; i < l; i++) { + var pair = pairs[i].split('='); + qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + return qry; + }; + + +/***/ }, +/* 20 */ +/***/ function(module, exports) { + + + module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; + }; + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + 'use strict'; + + var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') + , length = 64 + , map = {} + , seed = 0 + , i = 0 + , prev; + + /** + * Return a string representing the specified number. + * + * @param {Number} num The number to convert. + * @returns {String} The string representation of the number. + * @api public + */ + function encode(num) { + var encoded = ''; + + do { + encoded = alphabet[num % length] + encoded; + num = Math.floor(num / length); + } while (num > 0); + + return encoded; + } + + /** + * Return the integer value specified by the given string. + * + * @param {String} str The string to convert. + * @returns {Number} The integer value represented by the string. + * @api public + */ + function decode(str) { + var decoded = 0; + + for (i = 0; i < str.length; i++) { + decoded = decoded * length + map[str.charAt(i)]; + } + + return decoded; + } + + /** + * Yeast: A tiny growing id generator. + * + * @returns {String} A unique id. + * @api public + */ + function yeast() { + var now = encode(+new Date()); + + if (now !== prev) return seed = 0, prev = now; + return now +'.'+ encode(seed++); + } + + // + // Map each character to its index. + // + for (; i < length; i++) map[alphabet[i]] = i; + + // + // Expose the `yeast`, `encode` and `decode` functions. + // + yeast.encode = encode; + yeast.decode = decode; + module.exports = yeast; + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + // eslint-disable-next-line complexity + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || + // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || + // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === 'undefined' ? 'undefined' : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + function load() { + var r = void 0; + try { + r = exports.storage.getItem('debug'); + } catch (error) {} + // Swallow + // XXX (@Qix-) should we be logging these? + + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = __webpack_require__(24)(exports); + + var formatters = module.exports.formatters; + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(23))) + +/***/ }, +/* 23 */ +/***/ function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __webpack_require__(25); + + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + var prevTime = void 0; + + function debug() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; + + // Set `diff` timestamp + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + var formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + var i = void 0; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i = void 0; + var len = void 0; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; + } + + module.exports = setup; + +/***/ }, +/* 25 */ +/***/ function(module, exports) { + + /** + * Helpers. + */ + + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); + }; + + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; + } + + /** + * Pluralization helper. + */ + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module requirements. + */ + + var Polling = __webpack_require__(7); + var inherit = __webpack_require__(20); + var globalThis = __webpack_require__(5); + + /** + * Module exports. + */ + + module.exports = JSONPPolling; + + /** + * Cached regular expressions. + */ + + var rNewline = /\n/g; + var rEscapedNewline = /\\n/g; + + /** + * Global JSONP callbacks. + */ + + var callbacks; + + /** + * Noop. + */ + + function empty () { } + + /** + * JSONP Polling constructor. + * + * @param {Object} opts. + * @api public + */ + + function JSONPPolling (opts) { + Polling.call(this, opts); + + this.query = this.query || {}; + + // define global callbacks array if not present + // we do this here (lazily) to avoid unneeded global pollution + if (!callbacks) { + // we need to consider multiple engines in the same page + callbacks = globalThis.___eio = (globalThis.___eio || []); + } + + // callback identifier + this.index = callbacks.length; + + // add callback to jsonp global + var self = this; + callbacks.push(function (msg) { + self.onData(msg); + }); + + // append to query string + this.query.j = this.index; + + // prevent spurious errors from being emitted when the window is unloaded + if (typeof addEventListener === 'function') { + addEventListener('beforeunload', function () { + if (self.script) self.script.onerror = empty; + }, false); + } + } + + /** + * Inherits from Polling. + */ + + inherit(JSONPPolling, Polling); + + /* + * JSONP only supports binary as base64 encoded strings + */ + + JSONPPolling.prototype.supportsBinary = false; + + /** + * Closes the socket. + * + * @api private + */ + + JSONPPolling.prototype.doClose = function () { + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + if (this.form) { + this.form.parentNode.removeChild(this.form); + this.form = null; + this.iframe = null; + } + + Polling.prototype.doClose.call(this); + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + JSONPPolling.prototype.doPoll = function () { + var self = this; + var script = document.createElement('script'); + + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + script.async = true; + script.src = this.uri(); + script.onerror = function (e) { + self.onError('jsonp poll error', e); + }; + + var insertAt = document.getElementsByTagName('script')[0]; + if (insertAt) { + insertAt.parentNode.insertBefore(script, insertAt); + } else { + (document.head || document.body).appendChild(script); + } + this.script = script; + + var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); + + if (isUAgecko) { + setTimeout(function () { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + document.body.removeChild(iframe); + }, 100); + } + }; + + /** + * Writes with a hidden iframe. + * + * @param {String} data to send + * @param {Function} called upon flush. + * @api private + */ + + JSONPPolling.prototype.doWrite = function (data, fn) { + var self = this; + + if (!this.form) { + var form = document.createElement('form'); + var area = document.createElement('textarea'); + var id = this.iframeId = 'eio_iframe_' + this.index; + var iframe; + + form.className = 'socketio'; + form.style.position = 'absolute'; + form.style.top = '-1000px'; + form.style.left = '-1000px'; + form.target = id; + form.method = 'POST'; + form.setAttribute('accept-charset', 'utf-8'); + area.name = 'd'; + form.appendChild(area); + document.body.appendChild(form); + + this.form = form; + this.area = area; + } + + this.form.action = this.uri(); + + function complete () { + initIframe(); + fn(); + } + + function initIframe () { + if (self.iframe) { + try { + self.form.removeChild(self.iframe); + } catch (e) { + self.onError('jsonp polling iframe removal error', e); + } + } + + try { + // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) + var html = '<iframe src="javascript:0" name="' + self.iframeId + '">'; + iframe = document.createElement(html); + } catch (e) { + iframe = document.createElement('iframe'); + iframe.name = self.iframeId; + iframe.src = 'javascript:0'; + } + + iframe.id = self.iframeId; + + self.form.appendChild(iframe); + self.iframe = iframe; + } + + initIframe(); + + // escape \n to prevent it from being converted into \r\n by some UAs + // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side + data = data.replace(rEscapedNewline, '\\\n'); + this.area.value = data.replace(rNewline, '\\n'); + + try { + this.form.submit(); + } catch (e) {} + + if (this.iframe.attachEvent) { + this.iframe.onreadystatechange = function () { + if (self.iframe.readyState === 'complete') { + complete(); + } + }; + } else { + this.iframe.onload = complete; + } + }; + + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(8); + var parser = __webpack_require__(9); + var parseqs = __webpack_require__(19); + var inherit = __webpack_require__(20); + var yeast = __webpack_require__(21); + var debug = __webpack_require__(22)('engine.io-client:websocket'); + + var BrowserWebSocket, NodeWebSocket; + + if (typeof WebSocket !== 'undefined') { + BrowserWebSocket = WebSocket; + } else if (typeof self !== 'undefined') { + BrowserWebSocket = self.WebSocket || self.MozWebSocket; + } + + if (typeof window === 'undefined') { + try { + NodeWebSocket = __webpack_require__(28); + } catch (e) { } + } + + /** + * Get either the `WebSocket` or `MozWebSocket` globals + * in the browser or try to resolve WebSocket-compatible + * interface exposed by `ws` for Node-like environment. + */ + + var WebSocketImpl = BrowserWebSocket || NodeWebSocket; + + /** + * Module exports. + */ + + module.exports = WS; + + /** + * WebSocket transport constructor. + * + * @api {Object} connection options + * @api public + */ + + function WS (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (forceBase64) { + this.supportsBinary = false; + } + this.perMessageDeflate = opts.perMessageDeflate; + this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; + this.protocols = opts.protocols; + if (!this.usingBrowserWebSocket) { + WebSocketImpl = NodeWebSocket; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(WS, Transport); + + /** + * Transport name. + * + * @api public + */ + + WS.prototype.name = 'websocket'; + + /* + * WebSockets support binary + */ + + WS.prototype.supportsBinary = true; + + /** + * Opens socket. + * + * @api private + */ + + WS.prototype.doOpen = function () { + if (!this.check()) { + // let probe timeout + return; + } + + var uri = this.uri(); + var protocols = this.protocols; + var opts = { + agent: this.agent, + perMessageDeflate: this.perMessageDeflate + }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + if (this.extraHeaders) { + opts.headers = this.extraHeaders; + } + if (this.localAddress) { + opts.localAddress = this.localAddress; + } + + try { + this.ws = + this.usingBrowserWebSocket && !this.isReactNative + ? protocols + ? new WebSocketImpl(uri, protocols) + : new WebSocketImpl(uri) + : new WebSocketImpl(uri, protocols, opts); + } catch (err) { + return this.emit('error', err); + } + + if (this.ws.binaryType === undefined) { + this.supportsBinary = false; + } + + if (this.ws.supports && this.ws.supports.binary) { + this.supportsBinary = true; + this.ws.binaryType = 'nodebuffer'; + } else { + this.ws.binaryType = 'arraybuffer'; + } + + this.addEventListeners(); + }; + + /** + * Adds event listeners to the socket + * + * @api private + */ + + WS.prototype.addEventListeners = function () { + var self = this; + + this.ws.onopen = function () { + self.onOpen(); + }; + this.ws.onclose = function () { + self.onClose(); + }; + this.ws.onmessage = function (ev) { + self.onData(ev.data); + }; + this.ws.onerror = function (e) { + self.onError('websocket error', e); + }; + }; + + /** + * Writes data to socket. + * + * @param {Array} array of packets. + * @api private + */ + + WS.prototype.write = function (packets) { + var self = this; + this.writable = false; + + // encodePacket efficient as it uses WS framing + // no need for encodePayload + var total = packets.length; + for (var i = 0, l = total; i < l; i++) { + (function (packet) { + parser.encodePacket(packet, self.supportsBinary, function (data) { + if (!self.usingBrowserWebSocket) { + // always create a new object (GH-437) + var opts = {}; + if (packet.options) { + opts.compress = packet.options.compress; + } + + if (self.perMessageDeflate) { + var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length; + if (len < self.perMessageDeflate.threshold) { + opts.compress = false; + } + } + } + + // Sometimes the websocket has already been closed but the browser didn't + // have a chance of informing us about it yet, in that case send will + // throw an error + try { + if (self.usingBrowserWebSocket) { + // TypeError is thrown when passing the second argument on Safari + self.ws.send(data); + } else { + self.ws.send(data, opts); + } + } catch (e) { + debug('websocket closed before onclose event'); + } + + --total || done(); + }); + })(packets[i]); + } + + function done () { + self.emit('flush'); + + // fake drain + // defer to next tick to allow Socket to clear writeBuffer + setTimeout(function () { + self.writable = true; + self.emit('drain'); + }, 0); + } + }; + + /** + * Called upon close + * + * @api private + */ + + WS.prototype.onClose = function () { + Transport.prototype.onClose.call(this); + }; + + /** + * Closes socket. + * + * @api private + */ + + WS.prototype.doClose = function () { + if (typeof this.ws !== 'undefined') { + this.ws.close(); + } + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + WS.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'wss' : 'ws'; + var port = ''; + + // avoid port if default for schema + if (this.port && (('wss' === schema && Number(this.port) !== 443) || + ('ws' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // append timestamp to URI + if (this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + // communicate binary support capabilities + if (!this.supportsBinary) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + + /** + * Feature detection for WebSocket. + * + * @return {Boolean} whether this transport is available. + * @api public + */ + + WS.prototype.check = function () { + return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name); + }; + + +/***/ }, +/* 28 */ +/***/ function(module, exports) { + + /* (ignored) */ + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + + var indexOf = [].indexOf; + + module.exports = function(arr, obj){ + if (indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; + }; + +/***/ }, +/* 30 */ +/***/ function(module, exports) { + + /** + * Parses an URI + * + * @author Steven Levithan <stevenlevithan.com> (MIT license) + * @api private + */ + + var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; + + var parts = [ + 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor' + ]; + + module.exports = function parseuri(str) { + var src = str, + b = str.indexOf('['), + e = str.indexOf(']'); + + if (b != -1 && e != -1) { + str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length); + } + + var m = re.exec(str || ''), + uri = {}, + i = 14; + + while (i--) { + uri[parts[i]] = m[i] || ''; + } + + if (b != -1 && e != -1) { + uri.source = src; + uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':'); + uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':'); + uri.ipv6uri = true; + } + + return uri; + }; + + +/***/ } +/******/ ]) +}); +;+ \ No newline at end of file diff --git a/node_modules/engine.io-client/lib/globalThis.browser.js b/node_modules/engine.io-client/lib/globalThis.browser.js @@ -0,0 +1,9 @@ +module.exports = (function () { + if (typeof self !== 'undefined') { + return self; + } else if (typeof window !== 'undefined') { + return window; + } else { + return Function('return this')(); // eslint-disable-line no-new-func + } +})(); diff --git a/node_modules/engine.io-client/lib/globalThis.js b/node_modules/engine.io-client/lib/globalThis.js @@ -0,0 +1 @@ +module.exports = global; diff --git a/node_modules/engine.io-client/lib/index.js b/node_modules/engine.io-client/lib/index.js @@ -0,0 +1,10 @@ + +module.exports = require('./socket'); + +/** + * Exports parser + * + * @api public + * + */ +module.exports.parser = require('engine.io-parser'); diff --git a/node_modules/engine.io-client/lib/socket.js b/node_modules/engine.io-client/lib/socket.js @@ -0,0 +1,748 @@ +/** + * Module dependencies. + */ + +var transports = require('./transports/index'); +var Emitter = require('component-emitter'); +var debug = require('debug')('engine.io-client:socket'); +var index = require('indexof'); +var parser = require('engine.io-parser'); +var parseuri = require('parseuri'); +var parseqs = require('parseqs'); + +/** + * Module exports. + */ + +module.exports = Socket; + +/** + * Socket constructor. + * + * @param {String|Object} uri or options + * @param {Object} options + * @api public + */ + +function Socket (uri, opts) { + if (!(this instanceof Socket)) return new Socket(uri, opts); + + opts = opts || {}; + + if (uri && 'object' === typeof uri) { + opts = uri; + uri = null; + } + + if (uri) { + uri = parseuri(uri); + opts.hostname = uri.host; + opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; + opts.port = uri.port; + if (uri.query) opts.query = uri.query; + } else if (opts.host) { + opts.hostname = parseuri(opts.host).host; + } + + this.secure = null != opts.secure ? opts.secure + : (typeof location !== 'undefined' && 'https:' === location.protocol); + + if (opts.hostname && !opts.port) { + // if no port is specified manually, use the protocol default + opts.port = this.secure ? '443' : '80'; + } + + this.agent = opts.agent || false; + this.hostname = opts.hostname || + (typeof location !== 'undefined' ? location.hostname : 'localhost'); + this.port = opts.port || (typeof location !== 'undefined' && location.port + ? location.port + : (this.secure ? 443 : 80)); + this.query = opts.query || {}; + if ('string' === typeof this.query) this.query = parseqs.decode(this.query); + this.upgrade = false !== opts.upgrade; + this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; + this.forceJSONP = !!opts.forceJSONP; + this.jsonp = false !== opts.jsonp; + this.forceBase64 = !!opts.forceBase64; + this.enablesXDR = !!opts.enablesXDR; + this.withCredentials = false !== opts.withCredentials; + this.timestampParam = opts.timestampParam || 't'; + this.timestampRequests = opts.timestampRequests; + this.transports = opts.transports || ['polling', 'websocket']; + this.transportOptions = opts.transportOptions || {}; + this.readyState = ''; + this.writeBuffer = []; + this.prevBufferLen = 0; + this.policyPort = opts.policyPort || 843; + this.rememberUpgrade = opts.rememberUpgrade || false; + this.binaryType = null; + this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; + this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; + + if (true === this.perMessageDeflate) this.perMessageDeflate = {}; + if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { + this.perMessageDeflate.threshold = 1024; + } + + // SSL options for Node.js client + this.pfx = opts.pfx || null; + this.key = opts.key || null; + this.passphrase = opts.passphrase || null; + this.cert = opts.cert || null; + this.ca = opts.ca || null; + this.ciphers = opts.ciphers || null; + this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; + this.forceNode = !!opts.forceNode; + + // detect ReactNative environment + this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative'); + + // other options for Node.js or ReactNative client + if (typeof self === 'undefined' || this.isReactNative) { + if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { + this.extraHeaders = opts.extraHeaders; + } + + if (opts.localAddress) { + this.localAddress = opts.localAddress; + } + } + + // set on handshake + this.id = null; + this.upgrades = null; + this.pingInterval = null; + this.pingTimeout = null; + + // set on heartbeat + this.pingIntervalTimer = null; + this.pingTimeoutTimer = null; + + this.open(); +} + +Socket.priorWebsocketSuccess = false; + +/** + * Mix in `Emitter`. + */ + +Emitter(Socket.prototype); + +/** + * Protocol version. + * + * @api public + */ + +Socket.protocol = parser.protocol; // this is an int + +/** + * Expose deps for legacy compatibility + * and standalone browser access. + */ + +Socket.Socket = Socket; +Socket.Transport = require('./transport'); +Socket.transports = require('./transports/index'); +Socket.parser = require('engine.io-parser'); + +/** + * Creates transport of the given type. + * + * @param {String} transport name + * @return {Transport} + * @api private + */ + +Socket.prototype.createTransport = function (name) { + debug('creating transport "%s"', name); + var query = clone(this.query); + + // append engine.io protocol identifier + query.EIO = parser.protocol; + + // transport name + query.transport = name; + + // per-transport options + var options = this.transportOptions[name] || {}; + + // session id if we already have one + if (this.id) query.sid = this.id; + + var transport = new transports[name]({ + query: query, + socket: this, + agent: options.agent || this.agent, + hostname: options.hostname || this.hostname, + port: options.port || this.port, + secure: options.secure || this.secure, + path: options.path || this.path, + forceJSONP: options.forceJSONP || this.forceJSONP, + jsonp: options.jsonp || this.jsonp, + forceBase64: options.forceBase64 || this.forceBase64, + enablesXDR: options.enablesXDR || this.enablesXDR, + withCredentials: options.withCredentials || this.withCredentials, + timestampRequests: options.timestampRequests || this.timestampRequests, + timestampParam: options.timestampParam || this.timestampParam, + policyPort: options.policyPort || this.policyPort, + pfx: options.pfx || this.pfx, + key: options.key || this.key, + passphrase: options.passphrase || this.passphrase, + cert: options.cert || this.cert, + ca: options.ca || this.ca, + ciphers: options.ciphers || this.ciphers, + rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized, + perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate, + extraHeaders: options.extraHeaders || this.extraHeaders, + forceNode: options.forceNode || this.forceNode, + localAddress: options.localAddress || this.localAddress, + requestTimeout: options.requestTimeout || this.requestTimeout, + protocols: options.protocols || void (0), + isReactNative: this.isReactNative + }); + + return transport; +}; + +function clone (obj) { + var o = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + o[i] = obj[i]; + } + } + return o; +} + +/** + * Initializes transport to use and starts probe. + * + * @api private + */ +Socket.prototype.open = function () { + var transport; + if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { + transport = 'websocket'; + } else if (0 === this.transports.length) { + // Emit error on next tick so it can be listened to + var self = this; + setTimeout(function () { + self.emit('error', 'No transports available'); + }, 0); + return; + } else { + transport = this.transports[0]; + } + this.readyState = 'opening'; + + // Retry with the next transport if the transport is disabled (jsonp: false) + try { + transport = this.createTransport(transport); + } catch (e) { + this.transports.shift(); + this.open(); + return; + } + + transport.open(); + this.setTransport(transport); +}; + +/** + * Sets the current transport. Disables the existing one (if any). + * + * @api private + */ + +Socket.prototype.setTransport = function (transport) { + debug('setting transport %s', transport.name); + var self = this; + + if (this.transport) { + debug('clearing existing transport %s', this.transport.name); + this.transport.removeAllListeners(); + } + + // set up transport + this.transport = transport; + + // set up transport listeners + transport + .on('drain', function () { + self.onDrain(); + }) + .on('packet', function (packet) { + self.onPacket(packet); + }) + .on('error', function (e) { + self.onError(e); + }) + .on('close', function () { + self.onClose('transport close'); + }); +}; + +/** + * Probes a transport. + * + * @param {String} transport name + * @api private + */ + +Socket.prototype.probe = function (name) { + debug('probing transport "%s"', name); + var transport = this.createTransport(name, { probe: 1 }); + var failed = false; + var self = this; + + Socket.priorWebsocketSuccess = false; + + function onTransportOpen () { + if (self.onlyBinaryUpgrades) { + var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; + failed = failed || upgradeLosesBinary; + } + if (failed) return; + + debug('probe transport "%s" opened', name); + transport.send([{ type: 'ping', data: 'probe' }]); + transport.once('packet', function (msg) { + if (failed) return; + if ('pong' === msg.type && 'probe' === msg.data) { + debug('probe transport "%s" pong', name); + self.upgrading = true; + self.emit('upgrading', transport); + if (!transport) return; + Socket.priorWebsocketSuccess = 'websocket' === transport.name; + + debug('pausing current transport "%s"', self.transport.name); + self.transport.pause(function () { + if (failed) return; + if ('closed' === self.readyState) return; + debug('changing transport and sending upgrade packet'); + + cleanup(); + + self.setTransport(transport); + transport.send([{ type: 'upgrade' }]); + self.emit('upgrade', transport); + transport = null; + self.upgrading = false; + self.flush(); + }); + } else { + debug('probe transport "%s" failed', name); + var err = new Error('probe error'); + err.transport = transport.name; + self.emit('upgradeError', err); + } + }); + } + + function freezeTransport () { + if (failed) return; + + // Any callback called by transport should be ignored since now + failed = true; + + cleanup(); + + transport.close(); + transport = null; + } + + // Handle any error that happens while probing + function onerror (err) { + var error = new Error('probe error: ' + err); + error.transport = transport.name; + + freezeTransport(); + + debug('probe transport "%s" failed because of error: %s', name, err); + + self.emit('upgradeError', error); + } + + function onTransportClose () { + onerror('transport closed'); + } + + // When the socket is closed while we're probing + function onclose () { + onerror('socket closed'); + } + + // When the socket is upgraded while we're probing + function onupgrade (to) { + if (transport && to.name !== transport.name) { + debug('"%s" works - aborting "%s"', to.name, transport.name); + freezeTransport(); + } + } + + // Remove all listeners on the transport and on self + function cleanup () { + transport.removeListener('open', onTransportOpen); + transport.removeListener('error', onerror); + transport.removeListener('close', onTransportClose); + self.removeListener('close', onclose); + self.removeListener('upgrading', onupgrade); + } + + transport.once('open', onTransportOpen); + transport.once('error', onerror); + transport.once('close', onTransportClose); + + this.once('close', onclose); + this.once('upgrading', onupgrade); + + transport.open(); +}; + +/** + * Called when connection is deemed open. + * + * @api public + */ + +Socket.prototype.onOpen = function () { + debug('socket open'); + this.readyState = 'open'; + Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; + this.emit('open'); + this.flush(); + + // we check for `readyState` in case an `open` + // listener already closed the socket + if ('open' === this.readyState && this.upgrade && this.transport.pause) { + debug('starting upgrade probes'); + for (var i = 0, l = this.upgrades.length; i < l; i++) { + this.probe(this.upgrades[i]); + } + } +}; + +/** + * Handles a packet. + * + * @api private + */ + +Socket.prototype.onPacket = function (packet) { + if ('opening' === this.readyState || 'open' === this.readyState || + 'closing' === this.readyState) { + debug('socket receive: type "%s", data "%s"', packet.type, packet.data); + + this.emit('packet', packet); + + // Socket is live - any packet counts + this.emit('heartbeat'); + + switch (packet.type) { + case 'open': + this.onHandshake(JSON.parse(packet.data)); + break; + + case 'pong': + this.setPing(); + this.emit('pong'); + break; + + case 'error': + var err = new Error('server error'); + err.code = packet.data; + this.onError(err); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + debug('packet received with socket readyState "%s"', this.readyState); + } +}; + +/** + * Called upon handshake completion. + * + * @param {Object} handshake obj + * @api private + */ + +Socket.prototype.onHandshake = function (data) { + this.emit('handshake', data); + this.id = data.sid; + this.transport.query.sid = data.sid; + this.upgrades = this.filterUpgrades(data.upgrades); + this.pingInterval = data.pingInterval; + this.pingTimeout = data.pingTimeout; + this.onOpen(); + // In case open handler closes socket + if ('closed' === this.readyState) return; + this.setPing(); + + // Prolong liveness of socket on heartbeat + this.removeListener('heartbeat', this.onHeartbeat); + this.on('heartbeat', this.onHeartbeat); +}; + +/** + * Resets ping timeout. + * + * @api private + */ + +Socket.prototype.onHeartbeat = function (timeout) { + clearTimeout(this.pingTimeoutTimer); + var self = this; + self.pingTimeoutTimer = setTimeout(function () { + if ('closed' === self.readyState) return; + self.onClose('ping timeout'); + }, timeout || (self.pingInterval + self.pingTimeout)); +}; + +/** + * Pings server every `this.pingInterval` and expects response + * within `this.pingTimeout` or closes connection. + * + * @api private + */ + +Socket.prototype.setPing = function () { + var self = this; + clearTimeout(self.pingIntervalTimer); + self.pingIntervalTimer = setTimeout(function () { + debug('writing ping packet - expecting pong within %sms', self.pingTimeout); + self.ping(); + self.onHeartbeat(self.pingTimeout); + }, self.pingInterval); +}; + +/** +* Sends a ping packet. +* +* @api private +*/ + +Socket.prototype.ping = function () { + var self = this; + this.sendPacket('ping', function () { + self.emit('ping'); + }); +}; + +/** + * Called on `drain` event + * + * @api private + */ + +Socket.prototype.onDrain = function () { + this.writeBuffer.splice(0, this.prevBufferLen); + + // setting prevBufferLen = 0 is very important + // for example, when upgrading, upgrade packet is sent over, + // and a nonzero prevBufferLen could cause problems on `drain` + this.prevBufferLen = 0; + + if (0 === this.writeBuffer.length) { + this.emit('drain'); + } else { + this.flush(); + } +}; + +/** + * Flush write buffers. + * + * @api private + */ + +Socket.prototype.flush = function () { + if ('closed' !== this.readyState && this.transport.writable && + !this.upgrading && this.writeBuffer.length) { + debug('flushing %d packets in socket', this.writeBuffer.length); + this.transport.send(this.writeBuffer); + // keep track of current length of writeBuffer + // splice writeBuffer and callbackBuffer on `drain` + this.prevBufferLen = this.writeBuffer.length; + this.emit('flush'); + } +}; + +/** + * Sends a message. + * + * @param {String} message. + * @param {Function} callback function. + * @param {Object} options. + * @return {Socket} for chaining. + * @api public + */ + +Socket.prototype.write = +Socket.prototype.send = function (msg, options, fn) { + this.sendPacket('message', msg, options, fn); + return this; +}; + +/** + * Sends a packet. + * + * @param {String} packet type. + * @param {String} data. + * @param {Object} options. + * @param {Function} callback function. + * @api private + */ + +Socket.prototype.sendPacket = function (type, data, options, fn) { + if ('function' === typeof data) { + fn = data; + data = undefined; + } + + if ('function' === typeof options) { + fn = options; + options = null; + } + + if ('closing' === this.readyState || 'closed' === this.readyState) { + return; + } + + options = options || {}; + options.compress = false !== options.compress; + + var packet = { + type: type, + data: data, + options: options + }; + this.emit('packetCreate', packet); + this.writeBuffer.push(packet); + if (fn) this.once('flush', fn); + this.flush(); +}; + +/** + * Closes the connection. + * + * @api private + */ + +Socket.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.readyState = 'closing'; + + var self = this; + + if (this.writeBuffer.length) { + this.once('drain', function () { + if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + }); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + } + + function close () { + self.onClose('forced close'); + debug('socket closing - telling transport to close'); + self.transport.close(); + } + + function cleanupAndClose () { + self.removeListener('upgrade', cleanupAndClose); + self.removeListener('upgradeError', cleanupAndClose); + close(); + } + + function waitForUpgrade () { + // wait for upgrade to finish since we can't send packets while pausing a transport + self.once('upgrade', cleanupAndClose); + self.once('upgradeError', cleanupAndClose); + } + + return this; +}; + +/** + * Called upon transport error + * + * @api private + */ + +Socket.prototype.onError = function (err) { + debug('socket error %j', err); + Socket.priorWebsocketSuccess = false; + this.emit('error', err); + this.onClose('transport error', err); +}; + +/** + * Called upon transport close. + * + * @api private + */ + +Socket.prototype.onClose = function (reason, desc) { + if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { + debug('socket close with reason: "%s"', reason); + var self = this; + + // clear timers + clearTimeout(this.pingIntervalTimer); + clearTimeout(this.pingTimeoutTimer); + + // stop event from firing again for transport + this.transport.removeAllListeners('close'); + + // ensure transport won't stay open + this.transport.close(); + + // ignore further transport communication + this.transport.removeAllListeners(); + + // set ready state + this.readyState = 'closed'; + + // clear session id + this.id = null; + + // emit close event + this.emit('close', reason, desc); + + // clean buffers after, so users can still + // grab the buffers on `close` event + self.writeBuffer = []; + self.prevBufferLen = 0; + } +}; + +/** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + +Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i < j; i++) { + if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); + } + return filteredUpgrades; +}; diff --git a/node_modules/engine.io-client/lib/transport.js b/node_modules/engine.io-client/lib/transport.js @@ -0,0 +1,161 @@ +/** + * Module dependencies. + */ + +var parser = require('engine.io-parser'); +var Emitter = require('component-emitter'); + +/** + * Module exports. + */ + +module.exports = Transport; + +/** + * Transport abstract constructor. + * + * @param {Object} options. + * @api private + */ + +function Transport (opts) { + this.path = opts.path; + this.hostname = opts.hostname; + this.port = opts.port; + this.secure = opts.secure; + this.query = opts.query; + this.timestampParam = opts.timestampParam; + this.timestampRequests = opts.timestampRequests; + this.readyState = ''; + this.agent = opts.agent || false; + this.socket = opts.socket; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + this.forceNode = opts.forceNode; + + // results of ReactNative environment detection + this.isReactNative = opts.isReactNative; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + this.localAddress = opts.localAddress; +} + +/** + * Mix in `Emitter`. + */ + +Emitter(Transport.prototype); + +/** + * Emits an error. + * + * @param {String} str + * @return {Transport} for chaining + * @api public + */ + +Transport.prototype.onError = function (msg, desc) { + var err = new Error(msg); + err.type = 'TransportError'; + err.description = desc; + this.emit('error', err); + return this; +}; + +/** + * Opens the transport. + * + * @api public + */ + +Transport.prototype.open = function () { + if ('closed' === this.readyState || '' === this.readyState) { + this.readyState = 'opening'; + this.doOpen(); + } + + return this; +}; + +/** + * Closes the transport. + * + * @api private + */ + +Transport.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.doClose(); + this.onClose(); + } + + return this; +}; + +/** + * Sends multiple packets. + * + * @param {Array} packets + * @api private + */ + +Transport.prototype.send = function (packets) { + if ('open' === this.readyState) { + this.write(packets); + } else { + throw new Error('Transport not open'); + } +}; + +/** + * Called upon open + * + * @api private + */ + +Transport.prototype.onOpen = function () { + this.readyState = 'open'; + this.writable = true; + this.emit('open'); +}; + +/** + * Called with data. + * + * @param {String} data + * @api private + */ + +Transport.prototype.onData = function (data) { + var packet = parser.decodePacket(data, this.socket.binaryType); + this.onPacket(packet); +}; + +/** + * Called with a decoded packet. + */ + +Transport.prototype.onPacket = function (packet) { + this.emit('packet', packet); +}; + +/** + * Called upon close. + * + * @api private + */ + +Transport.prototype.onClose = function () { + this.readyState = 'closed'; + this.emit('close'); +}; diff --git a/node_modules/engine.io-client/lib/transports/index.js b/node_modules/engine.io-client/lib/transports/index.js @@ -0,0 +1,53 @@ +/** + * Module dependencies + */ + +var XMLHttpRequest = require('xmlhttprequest-ssl'); +var XHR = require('./polling-xhr'); +var JSONP = require('./polling-jsonp'); +var websocket = require('./websocket'); + +/** + * Export transports. + */ + +exports.polling = polling; +exports.websocket = websocket; + +/** + * Polling transport polymorphic constructor. + * Decides on xhr vs jsonp based on feature detection. + * + * @api private + */ + +function polling (opts) { + var xhr; + var xd = false; + var xs = false; + var jsonp = false !== opts.jsonp; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + xd = opts.hostname !== location.hostname || port !== opts.port; + xs = opts.secure !== isSSL; + } + + opts.xdomain = xd; + opts.xscheme = xs; + xhr = new XMLHttpRequest(opts); + + if ('open' in xhr && !opts.forceJSONP) { + return new XHR(opts); + } else { + if (!jsonp) throw new Error('JSONP disabled'); + return new JSONP(opts); + } +} diff --git a/node_modules/engine.io-client/lib/transports/polling-jsonp.js b/node_modules/engine.io-client/lib/transports/polling-jsonp.js @@ -0,0 +1,230 @@ +/** + * Module requirements. + */ + +var Polling = require('./polling'); +var inherit = require('component-inherit'); +var globalThis = require('../globalThis'); + +/** + * Module exports. + */ + +module.exports = JSONPPolling; + +/** + * Cached regular expressions. + */ + +var rNewline = /\n/g; +var rEscapedNewline = /\\n/g; + +/** + * Global JSONP callbacks. + */ + +var callbacks; + +/** + * Noop. + */ + +function empty () { } + +/** + * JSONP Polling constructor. + * + * @param {Object} opts. + * @api public + */ + +function JSONPPolling (opts) { + Polling.call(this, opts); + + this.query = this.query || {}; + + // define global callbacks array if not present + // we do this here (lazily) to avoid unneeded global pollution + if (!callbacks) { + // we need to consider multiple engines in the same page + callbacks = globalThis.___eio = (globalThis.___eio || []); + } + + // callback identifier + this.index = callbacks.length; + + // add callback to jsonp global + var self = this; + callbacks.push(function (msg) { + self.onData(msg); + }); + + // append to query string + this.query.j = this.index; + + // prevent spurious errors from being emitted when the window is unloaded + if (typeof addEventListener === 'function') { + addEventListener('beforeunload', function () { + if (self.script) self.script.onerror = empty; + }, false); + } +} + +/** + * Inherits from Polling. + */ + +inherit(JSONPPolling, Polling); + +/* + * JSONP only supports binary as base64 encoded strings + */ + +JSONPPolling.prototype.supportsBinary = false; + +/** + * Closes the socket. + * + * @api private + */ + +JSONPPolling.prototype.doClose = function () { + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + if (this.form) { + this.form.parentNode.removeChild(this.form); + this.form = null; + this.iframe = null; + } + + Polling.prototype.doClose.call(this); +}; + +/** + * Starts a poll cycle. + * + * @api private + */ + +JSONPPolling.prototype.doPoll = function () { + var self = this; + var script = document.createElement('script'); + + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + script.async = true; + script.src = this.uri(); + script.onerror = function (e) { + self.onError('jsonp poll error', e); + }; + + var insertAt = document.getElementsByTagName('script')[0]; + if (insertAt) { + insertAt.parentNode.insertBefore(script, insertAt); + } else { + (document.head || document.body).appendChild(script); + } + this.script = script; + + var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); + + if (isUAgecko) { + setTimeout(function () { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + document.body.removeChild(iframe); + }, 100); + } +}; + +/** + * Writes with a hidden iframe. + * + * @param {String} data to send + * @param {Function} called upon flush. + * @api private + */ + +JSONPPolling.prototype.doWrite = function (data, fn) { + var self = this; + + if (!this.form) { + var form = document.createElement('form'); + var area = document.createElement('textarea'); + var id = this.iframeId = 'eio_iframe_' + this.index; + var iframe; + + form.className = 'socketio'; + form.style.position = 'absolute'; + form.style.top = '-1000px'; + form.style.left = '-1000px'; + form.target = id; + form.method = 'POST'; + form.setAttribute('accept-charset', 'utf-8'); + area.name = 'd'; + form.appendChild(area); + document.body.appendChild(form); + + this.form = form; + this.area = area; + } + + this.form.action = this.uri(); + + function complete () { + initIframe(); + fn(); + } + + function initIframe () { + if (self.iframe) { + try { + self.form.removeChild(self.iframe); + } catch (e) { + self.onError('jsonp polling iframe removal error', e); + } + } + + try { + // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) + var html = '<iframe src="javascript:0" name="' + self.iframeId + '">'; + iframe = document.createElement(html); + } catch (e) { + iframe = document.createElement('iframe'); + iframe.name = self.iframeId; + iframe.src = 'javascript:0'; + } + + iframe.id = self.iframeId; + + self.form.appendChild(iframe); + self.iframe = iframe; + } + + initIframe(); + + // escape \n to prevent it from being converted into \r\n by some UAs + // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side + data = data.replace(rEscapedNewline, '\\\n'); + this.area.value = data.replace(rNewline, '\\n'); + + try { + this.form.submit(); + } catch (e) {} + + if (this.iframe.attachEvent) { + this.iframe.onreadystatechange = function () { + if (self.iframe.readyState === 'complete') { + complete(); + } + }; + } else { + this.iframe.onload = complete; + } +}; diff --git a/node_modules/engine.io-client/lib/transports/polling-xhr.js b/node_modules/engine.io-client/lib/transports/polling-xhr.js @@ -0,0 +1,418 @@ +/* global attachEvent */ + +/** + * Module requirements. + */ + +var XMLHttpRequest = require('xmlhttprequest-ssl'); +var Polling = require('./polling'); +var Emitter = require('component-emitter'); +var inherit = require('component-inherit'); +var debug = require('debug')('engine.io-client:polling-xhr'); +var globalThis = require('../globalThis'); + +/** + * Module exports. + */ + +module.exports = XHR; +module.exports.Request = Request; + +/** + * Empty function + */ + +function empty () {} + +/** + * XHR Polling constructor. + * + * @param {Object} opts + * @api public + */ + +function XHR (opts) { + Polling.call(this, opts); + this.requestTimeout = opts.requestTimeout; + this.extraHeaders = opts.extraHeaders; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) || + port !== opts.port; + this.xs = opts.secure !== isSSL; + } +} + +/** + * Inherits from Polling. + */ + +inherit(XHR, Polling); + +/** + * XHR supports binary + */ + +XHR.prototype.supportsBinary = true; + +/** + * Creates a request. + * + * @param {String} method + * @api private + */ + +XHR.prototype.request = function (opts) { + opts = opts || {}; + opts.uri = this.uri(); + opts.xd = this.xd; + opts.xs = this.xs; + opts.agent = this.agent || false; + opts.supportsBinary = this.supportsBinary; + opts.enablesXDR = this.enablesXDR; + opts.withCredentials = this.withCredentials; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + opts.requestTimeout = this.requestTimeout; + + // other options for Node.js client + opts.extraHeaders = this.extraHeaders; + + return new Request(opts); +}; + +/** + * Sends data. + * + * @param {String} data to send. + * @param {Function} called upon flush. + * @api private + */ + +XHR.prototype.doWrite = function (data, fn) { + var isBinary = typeof data !== 'string' && data !== undefined; + var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); + var self = this; + req.on('success', fn); + req.on('error', function (err) { + self.onError('xhr post error', err); + }); + this.sendXhr = req; +}; + +/** + * Starts a poll cycle. + * + * @api private + */ + +XHR.prototype.doPoll = function () { + debug('xhr poll'); + var req = this.request(); + var self = this; + req.on('data', function (data) { + self.onData(data); + }); + req.on('error', function (err) { + self.onError('xhr poll error', err); + }); + this.pollXhr = req; +}; + +/** + * Request constructor + * + * @param {Object} options + * @api public + */ + +function Request (opts) { + this.method = opts.method || 'GET'; + this.uri = opts.uri; + this.xd = !!opts.xd; + this.xs = !!opts.xs; + this.async = false !== opts.async; + this.data = undefined !== opts.data ? opts.data : null; + this.agent = opts.agent; + this.isBinary = opts.isBinary; + this.supportsBinary = opts.supportsBinary; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + this.requestTimeout = opts.requestTimeout; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + + this.create(); +} + +/** + * Mix in `Emitter`. + */ + +Emitter(Request.prototype); + +/** + * Creates the XHR object and sends the request. + * + * @api private + */ + +Request.prototype.create = function () { + var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + + var xhr = this.xhr = new XMLHttpRequest(opts); + var self = this; + + try { + debug('xhr open %s: %s', this.method, this.uri); + xhr.open(this.method, this.uri, this.async); + try { + if (this.extraHeaders) { + xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); + for (var i in this.extraHeaders) { + if (this.extraHeaders.hasOwnProperty(i)) { + xhr.setRequestHeader(i, this.extraHeaders[i]); + } + } + } + } catch (e) {} + + if ('POST' === this.method) { + try { + if (this.isBinary) { + xhr.setRequestHeader('Content-type', 'application/octet-stream'); + } else { + xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); + } + } catch (e) {} + } + + try { + xhr.setRequestHeader('Accept', '*/*'); + } catch (e) {} + + // ie6 check + if ('withCredentials' in xhr) { + xhr.withCredentials = this.withCredentials; + } + + if (this.requestTimeout) { + xhr.timeout = this.requestTimeout; + } + + if (this.hasXDR()) { + xhr.onload = function () { + self.onLoad(); + }; + xhr.onerror = function () { + self.onError(xhr.responseText); + }; + } else { + xhr.onreadystatechange = function () { + if (xhr.readyState === 2) { + try { + var contentType = xhr.getResponseHeader('Content-Type'); + if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + xhr.responseType = 'arraybuffer'; + } + } catch (e) {} + } + if (4 !== xhr.readyState) return; + if (200 === xhr.status || 1223 === xhr.status) { + self.onLoad(); + } else { + // make sure the `error` event handler that's user-set + // does not throw in the same tick and gets caught here + setTimeout(function () { + self.onError(typeof xhr.status === 'number' ? xhr.status : 0); + }, 0); + } + }; + } + + debug('xhr data %s', this.data); + xhr.send(this.data); + } catch (e) { + // Need to defer since .create() is called directly fhrom the constructor + // and thus the 'error' event can only be only bound *after* this exception + // occurs. Therefore, also, we cannot throw here at all. + setTimeout(function () { + self.onError(e); + }, 0); + return; + } + + if (typeof document !== 'undefined') { + this.index = Request.requestsCount++; + Request.requests[this.index] = this; + } +}; + +/** + * Called upon successful response. + * + * @api private + */ + +Request.prototype.onSuccess = function () { + this.emit('success'); + this.cleanup(); +}; + +/** + * Called if we have data. + * + * @api private + */ + +Request.prototype.onData = function (data) { + this.emit('data', data); + this.onSuccess(); +}; + +/** + * Called upon error. + * + * @api private + */ + +Request.prototype.onError = function (err) { + this.emit('error', err); + this.cleanup(true); +}; + +/** + * Cleans up house. + * + * @api private + */ + +Request.prototype.cleanup = function (fromError) { + if ('undefined' === typeof this.xhr || null === this.xhr) { + return; + } + // xmlhttprequest + if (this.hasXDR()) { + this.xhr.onload = this.xhr.onerror = empty; + } else { + this.xhr.onreadystatechange = empty; + } + + if (fromError) { + try { + this.xhr.abort(); + } catch (e) {} + } + + if (typeof document !== 'undefined') { + delete Request.requests[this.index]; + } + + this.xhr = null; +}; + +/** + * Called upon load. + * + * @api private + */ + +Request.prototype.onLoad = function () { + var data; + try { + var contentType; + try { + contentType = this.xhr.getResponseHeader('Content-Type'); + } catch (e) {} + if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + data = this.xhr.response || this.xhr.responseText; + } else { + data = this.xhr.responseText; + } + } catch (e) { + this.onError(e); + } + if (null != data) { + this.onData(data); + } +}; + +/** + * Check if it has XDomainRequest. + * + * @api private + */ + +Request.prototype.hasXDR = function () { + return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR; +}; + +/** + * Aborts the request. + * + * @api public + */ + +Request.prototype.abort = function () { + this.cleanup(); +}; + +/** + * Aborts pending requests when unloading the window. This is needed to prevent + * memory leaks (e.g. when using IE) and to ensure that no spurious error is + * emitted. + */ + +Request.requestsCount = 0; +Request.requests = {}; + +if (typeof document !== 'undefined') { + if (typeof attachEvent === 'function') { + attachEvent('onunload', unloadHandler); + } else if (typeof addEventListener === 'function') { + var terminationEvent = 'onpagehide' in globalThis ? 'pagehide' : 'unload'; + addEventListener(terminationEvent, unloadHandler, false); + } +} + +function unloadHandler () { + for (var i in Request.requests) { + if (Request.requests.hasOwnProperty(i)) { + Request.requests[i].abort(); + } + } +} diff --git a/node_modules/engine.io-client/lib/transports/polling.js b/node_modules/engine.io-client/lib/transports/polling.js @@ -0,0 +1,245 @@ +/** + * Module dependencies. + */ + +var Transport = require('../transport'); +var parseqs = require('parseqs'); +var parser = require('engine.io-parser'); +var inherit = require('component-inherit'); +var yeast = require('yeast'); +var debug = require('debug')('engine.io-client:polling'); + +/** + * Module exports. + */ + +module.exports = Polling; + +/** + * Is XHR2 supported? + */ + +var hasXHR2 = (function () { + var XMLHttpRequest = require('xmlhttprequest-ssl'); + var xhr = new XMLHttpRequest({ xdomain: false }); + return null != xhr.responseType; +})(); + +/** + * Polling interface. + * + * @param {Object} opts + * @api private + */ + +function Polling (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (!hasXHR2 || forceBase64) { + this.supportsBinary = false; + } + Transport.call(this, opts); +} + +/** + * Inherits from Transport. + */ + +inherit(Polling, Transport); + +/** + * Transport name. + */ + +Polling.prototype.name = 'polling'; + +/** + * Opens the socket (triggers polling). We write a PING message to determine + * when the transport is open. + * + * @api private + */ + +Polling.prototype.doOpen = function () { + this.poll(); +}; + +/** + * Pauses polling. + * + * @param {Function} callback upon buffers are flushed and transport is paused + * @api private + */ + +Polling.prototype.pause = function (onPause) { + var self = this; + + this.readyState = 'pausing'; + + function pause () { + debug('paused'); + self.readyState = 'paused'; + onPause(); + } + + if (this.polling || !this.writable) { + var total = 0; + + if (this.polling) { + debug('we are currently polling - waiting to pause'); + total++; + this.once('pollComplete', function () { + debug('pre-pause polling complete'); + --total || pause(); + }); + } + + if (!this.writable) { + debug('we are currently writing - waiting to pause'); + total++; + this.once('drain', function () { + debug('pre-pause writing complete'); + --total || pause(); + }); + } + } else { + pause(); + } +}; + +/** + * Starts polling cycle. + * + * @api public + */ + +Polling.prototype.poll = function () { + debug('polling'); + this.polling = true; + this.doPoll(); + this.emit('poll'); +}; + +/** + * Overloads onData to detect payloads. + * + * @api private + */ + +Polling.prototype.onData = function (data) { + var self = this; + debug('polling got data %s', data); + var callback = function (packet, index, total) { + // if its the first message we consider the transport open + if ('opening' === self.readyState) { + self.onOpen(); + } + + // if its a close packet, we close the ongoing requests + if ('close' === packet.type) { + self.onClose(); + return false; + } + + // otherwise bypass onData and handle the message + self.onPacket(packet); + }; + + // decode payload + parser.decodePayload(data, this.socket.binaryType, callback); + + // if an event did not trigger closing + if ('closed' !== this.readyState) { + // if we got data we're not polling + this.polling = false; + this.emit('pollComplete'); + + if ('open' === this.readyState) { + this.poll(); + } else { + debug('ignoring poll - transport state "%s"', this.readyState); + } + } +}; + +/** + * For polling, send a close packet. + * + * @api private + */ + +Polling.prototype.doClose = function () { + var self = this; + + function close () { + debug('writing close packet'); + self.write([{ type: 'close' }]); + } + + if ('open' === this.readyState) { + debug('transport open - closing'); + close(); + } else { + // in case we're trying to close while + // handshaking is in progress (GH-164) + debug('transport not open - deferring close'); + this.once('open', close); + } +}; + +/** + * Writes a packets payload. + * + * @param {Array} data packets + * @param {Function} drain callback + * @api private + */ + +Polling.prototype.write = function (packets) { + var self = this; + this.writable = false; + var callbackfn = function () { + self.writable = true; + self.emit('drain'); + }; + + parser.encodePayload(packets, this.supportsBinary, function (data) { + self.doWrite(data, callbackfn); + }); +}; + +/** + * Generates uri for connection. + * + * @api private + */ + +Polling.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'https' : 'http'; + var port = ''; + + // cache busting is forced + if (false !== this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + if (!this.supportsBinary && !query.sid) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // avoid port if default for schema + if (this.port && (('https' === schema && Number(this.port) !== 443) || + ('http' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; +}; diff --git a/node_modules/engine.io-client/lib/transports/websocket.js b/node_modules/engine.io-client/lib/transports/websocket.js @@ -0,0 +1,295 @@ +/** + * Module dependencies. + */ + +var Transport = require('../transport'); +var parser = require('engine.io-parser'); +var parseqs = require('parseqs'); +var inherit = require('component-inherit'); +var yeast = require('yeast'); +var debug = require('debug')('engine.io-client:websocket'); + +var BrowserWebSocket, NodeWebSocket; + +if (typeof WebSocket !== 'undefined') { + BrowserWebSocket = WebSocket; +} else if (typeof self !== 'undefined') { + BrowserWebSocket = self.WebSocket || self.MozWebSocket; +} + +if (typeof window === 'undefined') { + try { + NodeWebSocket = require('ws'); + } catch (e) { } +} + +/** + * Get either the `WebSocket` or `MozWebSocket` globals + * in the browser or try to resolve WebSocket-compatible + * interface exposed by `ws` for Node-like environment. + */ + +var WebSocketImpl = BrowserWebSocket || NodeWebSocket; + +/** + * Module exports. + */ + +module.exports = WS; + +/** + * WebSocket transport constructor. + * + * @api {Object} connection options + * @api public + */ + +function WS (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (forceBase64) { + this.supportsBinary = false; + } + this.perMessageDeflate = opts.perMessageDeflate; + this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; + this.protocols = opts.protocols; + if (!this.usingBrowserWebSocket) { + WebSocketImpl = NodeWebSocket; + } + Transport.call(this, opts); +} + +/** + * Inherits from Transport. + */ + +inherit(WS, Transport); + +/** + * Transport name. + * + * @api public + */ + +WS.prototype.name = 'websocket'; + +/* + * WebSockets support binary + */ + +WS.prototype.supportsBinary = true; + +/** + * Opens socket. + * + * @api private + */ + +WS.prototype.doOpen = function () { + if (!this.check()) { + // let probe timeout + return; + } + + var uri = this.uri(); + var protocols = this.protocols; + var opts = { + agent: this.agent, + perMessageDeflate: this.perMessageDeflate + }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + if (this.extraHeaders) { + opts.headers = this.extraHeaders; + } + if (this.localAddress) { + opts.localAddress = this.localAddress; + } + + try { + this.ws = + this.usingBrowserWebSocket && !this.isReactNative + ? protocols + ? new WebSocketImpl(uri, protocols) + : new WebSocketImpl(uri) + : new WebSocketImpl(uri, protocols, opts); + } catch (err) { + return this.emit('error', err); + } + + if (this.ws.binaryType === undefined) { + this.supportsBinary = false; + } + + if (this.ws.supports && this.ws.supports.binary) { + this.supportsBinary = true; + this.ws.binaryType = 'nodebuffer'; + } else { + this.ws.binaryType = 'arraybuffer'; + } + + this.addEventListeners(); +}; + +/** + * Adds event listeners to the socket + * + * @api private + */ + +WS.prototype.addEventListeners = function () { + var self = this; + + this.ws.onopen = function () { + self.onOpen(); + }; + this.ws.onclose = function () { + self.onClose(); + }; + this.ws.onmessage = function (ev) { + self.onData(ev.data); + }; + this.ws.onerror = function (e) { + self.onError('websocket error', e); + }; +}; + +/** + * Writes data to socket. + * + * @param {Array} array of packets. + * @api private + */ + +WS.prototype.write = function (packets) { + var self = this; + this.writable = false; + + // encodePacket efficient as it uses WS framing + // no need for encodePayload + var total = packets.length; + for (var i = 0, l = total; i < l; i++) { + (function (packet) { + parser.encodePacket(packet, self.supportsBinary, function (data) { + if (!self.usingBrowserWebSocket) { + // always create a new object (GH-437) + var opts = {}; + if (packet.options) { + opts.compress = packet.options.compress; + } + + if (self.perMessageDeflate) { + var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length; + if (len < self.perMessageDeflate.threshold) { + opts.compress = false; + } + } + } + + // Sometimes the websocket has already been closed but the browser didn't + // have a chance of informing us about it yet, in that case send will + // throw an error + try { + if (self.usingBrowserWebSocket) { + // TypeError is thrown when passing the second argument on Safari + self.ws.send(data); + } else { + self.ws.send(data, opts); + } + } catch (e) { + debug('websocket closed before onclose event'); + } + + --total || done(); + }); + })(packets[i]); + } + + function done () { + self.emit('flush'); + + // fake drain + // defer to next tick to allow Socket to clear writeBuffer + setTimeout(function () { + self.writable = true; + self.emit('drain'); + }, 0); + } +}; + +/** + * Called upon close + * + * @api private + */ + +WS.prototype.onClose = function () { + Transport.prototype.onClose.call(this); +}; + +/** + * Closes socket. + * + * @api private + */ + +WS.prototype.doClose = function () { + if (typeof this.ws !== 'undefined') { + this.ws.close(); + } +}; + +/** + * Generates uri for connection. + * + * @api private + */ + +WS.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'wss' : 'ws'; + var port = ''; + + // avoid port if default for schema + if (this.port && (('wss' === schema && Number(this.port) !== 443) || + ('ws' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // append timestamp to URI + if (this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + // communicate binary support capabilities + if (!this.supportsBinary) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; +}; + +/** + * Feature detection for WebSocket. + * + * @return {Boolean} whether this transport is available. + * @api public + */ + +WS.prototype.check = function () { + return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name); +}; diff --git a/node_modules/engine.io-client/lib/xmlhttprequest.js b/node_modules/engine.io-client/lib/xmlhttprequest.js @@ -0,0 +1,38 @@ +// browser shim for xmlhttprequest module + +var hasCORS = require('has-cors'); +var globalThis = require('./globalThis'); + +module.exports = function (opts) { + var xdomain = opts.xdomain; + + // scheme must be same when usign XDomainRequest + // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx + var xscheme = opts.xscheme; + + // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. + // https://github.com/Automattic/engine.io-client/pull/217 + var enablesXDR = opts.enablesXDR; + + // XMLHttpRequest can be disabled on IE + try { + if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e) { } + + // Use XDomainRequest for IE8 if enablesXDR is true + // because loading bar keeps flashing when using jsonp-polling + // https://github.com/yujiosaka/socke.io-ie8-loading-example + try { + if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { + return new XDomainRequest(); + } + } catch (e) { } + + if (!xdomain) { + try { + return new globalThis[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); + } catch (e) { } + } +}; diff --git a/node_modules/engine.io-client/node_modules/debug/CHANGELOG.md b/node_modules/engine.io-client/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/engine.io-client/node_modules/debug/LICENSE b/node_modules/engine.io-client/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/engine.io-client/node_modules/debug/README.md b/node_modules/engine.io-client/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + +<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png"> + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + +<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png"> + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png"> + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + +<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + +<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a> + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/engine.io-client/node_modules/debug/dist/debug.js b/node_modules/engine.io-client/node_modules/debug/dist/debug.js @@ -0,0 +1,912 @@ +"use strict"; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + + g.debug = f(); + } +})(function () { + var define, module, exports; + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require; + if (!f && c) return c(i, !0); + if (u) return u(i, !0); + var a = new Error("Cannot find module '" + i + "'"); + throw a.code = "MODULE_NOT_FOUND", a; + } + + var p = n[i] = { + exports: {} + }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + + return n[i].exports; + } + + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + } + + return o; + } + + return r; + }()({ + 1: [function (require, module, exports) { + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + + var type = _typeof(val); + + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(str) { + str = String(str); + + if (str.length > 100) { + return; + } + + var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + + if (!match) { + return; + } + + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + + case 'weeks': + case 'week': + case 'w': + return n * w; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + + default: + return undefined; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + + return ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + }, {}], + 2: [function (require, module, exports) { + // shim for using process in browser + var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; // v8 likes predictible objects + + + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { + return '/'; + }; + + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + + process.umask = function () { + return 0; + }; + }, {}], + 3: [function (require, module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + + + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + + + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; + } + + module.exports = setup; + }, { + "ms": 1 + }], + 4: [function (require, module, exports) { + (function (process) { + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + // eslint-disable-next-line complexity + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + + function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = require('./common')(exports); + var formatters = module.exports.formatters; + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + }).call(this, require('_process')); + }, { + "./common": 3, + "_process": 2 + }] + }, {}, [4])(4); +}); diff --git a/node_modules/engine.io-client/node_modules/debug/package.json b/node_modules/engine.io-client/node_modules/debug/package.json @@ -0,0 +1,102 @@ +{ + "_from": "debug@~4.1.0", + "_id": "debug@4.1.1", + "_inBundle": false, + "_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "_location": "/engine.io-client/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@~4.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "~4.1.0", + "saveSpec": null, + "fetchSpec": "~4.1.0" + }, + "_requiredBy": [ + "/engine.io-client" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "_shasum": "3b72260255109c6b589cee050f1d516139664791", + "_spec": "debug@~4.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "scripts": { + "build": "npm run build:debug && npm run build:test", + "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", + "build:test": "babel -d dist test.js", + "clean": "rimraf dist coverage", + "lint": "xo", + "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", + "pretest:browser": "npm run build", + "test": "npm run test:node && npm run test:browser", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "unpkg": "./dist/debug.js", + "version": "4.1.1" +} diff --git a/node_modules/engine.io-client/node_modules/debug/src/browser.js b/node_modules/engine.io-client/node_modules/debug/src/browser.js @@ -0,0 +1,264 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/engine.io-client/node_modules/debug/src/common.js b/node_modules/engine.io-client/node_modules/debug/src/common.js @@ -0,0 +1,266 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/engine.io-client/node_modules/debug/src/index.js b/node_modules/engine.io-client/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/engine.io-client/node_modules/debug/src/node.js b/node_modules/engine.io-client/node_modules/debug/src/node.js @@ -0,0 +1,257 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/engine.io-client/node_modules/ms/index.js b/node_modules/engine.io-client/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/engine.io-client/node_modules/ms/license.md b/node_modules/engine.io-client/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/engine.io-client/node_modules/ms/package.json b/node_modules/engine.io-client/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/engine.io-client/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/engine.io-client/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@^2.1.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/node_modules/engine.io-client/node_modules/ms/readme.md b/node_modules/engine.io-client/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/engine.io-client/node_modules/ws/LICENSE b/node_modules/engine.io-client/node_modules/ws/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/engine.io-client/node_modules/ws/README.md b/node_modules/engine.io-client/node_modules/ws/README.md @@ -0,0 +1,449 @@ +# ws: a Node.js WebSocket library + +[![Version npm](https://img.shields.io/npm/v/ws.svg)](https://www.npmjs.com/package/ws) +[![Linux Build](https://img.shields.io/travis/websockets/ws/master.svg)](https://travis-ci.org/websockets/ws) +[![Windows Build](https://ci.appveyor.com/api/projects/status/github/websockets/ws?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/ws) +[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg)](https://coveralls.io/r/websockets/ws?branch=master) + +ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and +server implementation. + +Passes the quite extensive Autobahn test suite: [server][server-report], +[client][client-report]. + +**Note**: This module does not work in the browser. The client in the docs is a +reference to a back end with the role of a client in the WebSocket +communication. Browser clients must use the native +[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) +object. To make the same code work seamlessly on Node.js and the browser, you +can use one of the many wrappers available on npm, like +[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). + +## Table of Contents + +- [Protocol support](#protocol-support) +- [Installing](#installing) + - [Opt-in for performance and spec compliance](#opt-in-for-performance-and-spec-compliance) +- [API docs](#api-docs) +- [WebSocket compression](#websocket-compression) +- [Usage examples](#usage-examples) + - [Sending and receiving text data](#sending-and-receiving-text-data) + - [Sending binary data](#sending-binary-data) + - [Simple server](#simple-server) + - [External HTTP/S server](#external-https-server) + - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) + - [Server broadcast](#server-broadcast) + - [echo.websocket.org demo](#echowebsocketorg-demo) + - [Other examples](#other-examples) +- [Error handling best practices](#error-handling-best-practices) +- [FAQ](#faq) + - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) + - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) + - [How to connect via a proxy?](#how-to-connect-via-a-proxy) +- [Changelog](#changelog) +- [License](#license) + +## Protocol support + +- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +- **HyBi drafts 13-17** (Current default, alternatively option + `protocolVersion: 13`) + +## Installing + +``` +npm install ws +``` + +### Opt-in for performance and spec compliance + +There are 2 optional modules that can be installed along side with the ws +module. These modules are binary addons which improve certain operations. +Prebuilt binaries are available for the most popular platforms so you don't +necessarily need to have a C++ compiler installed on your machine. + +- `npm install --save-optional bufferutil`: Allows to efficiently perform + operations such as masking and unmasking the data payload of the WebSocket + frames. +- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a + message contains valid UTF-8 as required by the spec. + +## API docs + +See [`/doc/ws.md`](./doc/ws.md) for Node.js-like docs for the ws classes. + +## WebSocket compression + +ws supports the [permessage-deflate extension][permessage-deflate] which enables +the client and server to negotiate a compression algorithm and its parameters, +and then selectively apply it to the data payloads of each WebSocket message. + +The extension is disabled by default on the server and enabled by default on the +client. It adds a significant overhead in terms of performance and memory +consumption so we suggest to enable it only if it is really needed. + +Note that Node.js has a variety of issues with high-performance compression, +where increased concurrency, especially on Linux, can lead to [catastrophic +memory fragmentation][node-zlib-bug] and slow performance. If you intend to use +permessage-deflate in production, it is worthwhile to set up a test +representative of your workload and ensure Node.js/zlib will handle it with +acceptable performance and memory usage. + +Tuning of permessage-deflate can be done via the options defined below. You can +also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly +into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. + +See [the docs][ws-server-options] for more options. + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ + port: 8080, + perMessageDeflate: { + zlibDeflateOptions: { + // See zlib defaults. + chunkSize: 1024, + memLevel: 7, + level: 3 + }, + zlibInflateOptions: { + chunkSize: 10 * 1024 + }, + // Other options settable: + clientNoContextTakeover: true, // Defaults to negotiated value. + serverNoContextTakeover: true, // Defaults to negotiated value. + serverMaxWindowBits: 10, // Defaults to negotiated value. + // Below options specified as default values. + concurrencyLimit: 10, // Limits zlib concurrency for perf. + threshold: 1024 // Size (in bytes) below which messages + // should not be compressed. + } +}); +``` + +The client will only use the extension if it is supported and enabled on the +server. To always disable the extension on the client set the +`perMessageDeflate` option to `false`. + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('ws://www.host.com/path', { + perMessageDeflate: false +}); +``` + +## Usage examples + +### Sending and receiving text data + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function incoming(data) { + console.log(data); +}); +``` + +### Sending binary data + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + const array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array); +}); +``` + +### Simple server + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(message) { + console.log('received: %s', message); + }); + + ws.send('something'); +}); +``` + +### External HTTP/S server + +```js +const fs = require('fs'); +const https = require('https'); +const WebSocket = require('ws'); + +const server = new https.createServer({ + cert: fs.readFileSync('/path/to/cert.pem'), + key: fs.readFileSync('/path/to/key.pem') +}); +const wss = new WebSocket.Server({ server }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(message) { + console.log('received: %s', message); + }); + + ws.send('something'); +}); + +server.listen(8080); +``` + +### Multiple servers sharing a single HTTP/S server + +```js +const http = require('http'); +const WebSocket = require('ws'); + +const server = http.createServer(); +const wss1 = new WebSocket.Server({ noServer: true }); +const wss2 = new WebSocket.Server({ noServer: true }); + +wss1.on('connection', function connection(ws) { + // ... +}); + +wss2.on('connection', function connection(ws) { + // ... +}); + +server.on('upgrade', function upgrade(request, socket, head) { + const pathname = url.parse(request.url).pathname; + + if (pathname === '/foo') { + wss1.handleUpgrade(request, socket, head, function done(ws) { + wss1.emit('connection', ws, request); + }); + } else if (pathname === '/bar') { + wss2.handleUpgrade(request, socket, head, function done(ws) { + wss2.emit('connection', ws, request); + }); + } else { + socket.destroy(); + } +}); + +server.listen(8080); +``` + +### Server broadcast + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +// Broadcast to all. +wss.broadcast = function broadcast(data) { + wss.clients.forEach(function each(client) { + if (client.readyState === WebSocket.OPEN) { + client.send(data); + } + }); +}; + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(data) { + // Broadcast to everyone else. + wss.clients.forEach(function each(client) { + if (client !== ws && client.readyState === WebSocket.OPEN) { + client.send(data); + } + }); + }); +}); +``` + +### echo.websocket.org demo + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('wss://echo.websocket.org/', { + origin: 'https://websocket.org' +}); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now()); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function incoming(data) { + console.log(`Roundtrip time: ${Date.now() - data} ms`); + + setTimeout(function timeout() { + ws.send(Date.now()); + }, 500); +}); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Otherwise, see the test cases. + +## Error handling best practices + +```js +// If the WebSocket is closed before the following send is attempted +ws.send('something'); + +// Errors (both immediate and async write errors) can be detected in an optional +// callback. The callback is also the only way of being notified that data has +// actually been sent. +ws.send('something', function ack(error) { + // If error is not defined, the send has been completed, otherwise the error + // object will indicate what failed. +}); + +// Immediate errors can also be handled with `try...catch`, but **note** that +// since sends are inherently asynchronous, socket write failures will *not* be +// captured when this technique is used. +try { + ws.send('something'); +} catch (e) { + /* handle error */ +} +``` + +## FAQ + +### How to get the IP address of the client? + +The remote IP address can be obtained from the raw socket. + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws, req) { + const ip = req.connection.remoteAddress; +}); +``` + +When the server runs behind a proxy like NGINX, the de-facto standard is to use +the `X-Forwarded-For` header. + +```js +wss.on('connection', function connection(ws, req) { + const ip = req.headers['x-forwarded-for'].split(/\s*,\s*/)[0]; +}); +``` + +### How to detect and close broken connections? + +Sometimes the link between the server and the client can be interrupted in a way +that keeps both the server and the client unaware of the broken state of the +connection (e.g. when pulling the cord). + +In these cases ping messages can be used as a means to verify that the remote +endpoint is still responsive. + +```js +const WebSocket = require('ws'); + +function noop() {} + +function heartbeat() { + this.isAlive = true; +} + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.isAlive = true; + ws.on('pong', heartbeat); +}); + +const interval = setInterval(function ping() { + wss.clients.forEach(function each(ws) { + if (ws.isAlive === false) return ws.terminate(); + + ws.isAlive = false; + ws.ping(noop); + }); +}, 30000); +``` + +Pong messages are automatically sent in response to ping messages as required by +the spec. + +Just like the server example above your clients might as well lose connection +without knowing it. You might want to add a ping listener on your clients to +prevent that. A simple implementation would be: + +```js +const WebSocket = require('ws'); + +function heartbeat() { + clearTimeout(this.pingTimeout); + + // Use `WebSocket#terminate()` and not `WebSocket#close()`. Delay should be + // equal to the interval at which your server sends out pings plus a + // conservative assumption of the latency. + this.pingTimeout = setTimeout(() => { + this.terminate(); + }, 30000 + 1000); +} + +const client = new WebSocket('wss://echo.websocket.org/'); + +client.on('open', heartbeat); +client.on('ping', heartbeat); +client.on('close', function clear() { + clearTimeout(this.pingTimeout); +}); +``` + +### How to connect via a proxy? + +Use a custom `http.Agent` implementation like [https-proxy-agent][] or +[socks-proxy-agent][]. + +## Changelog + +We're using the GitHub [releases][changelog] for changelog entries. + +## License + +[MIT](LICENSE) + +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent +[client-report]: http://websockets.github.io/ws/autobahn/clients/ +[server-report]: http://websockets.github.io/ws/autobahn/servers/ +[permessage-deflate]: https://tools.ietf.org/html/rfc7692 +[changelog]: https://github.com/websockets/ws/releases +[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 +[node-zlib-deflaterawdocs]: + https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options +[ws-server-options]: + https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback diff --git a/node_modules/engine.io-client/node_modules/ws/browser.js b/node_modules/engine.io-client/node_modules/ws/browser.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function() { + throw new Error( + 'ws does not work in the browser. Browser clients must use the native ' + + 'WebSocket object' + ); +}; diff --git a/node_modules/engine.io-client/node_modules/ws/index.js b/node_modules/engine.io-client/node_modules/ws/index.js @@ -0,0 +1,9 @@ +'use strict'; + +const WebSocket = require('./lib/websocket'); + +WebSocket.Server = require('./lib/websocket-server'); +WebSocket.Receiver = require('./lib/receiver'); +WebSocket.Sender = require('./lib/sender'); + +module.exports = WebSocket; diff --git a/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js b/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js @@ -0,0 +1,72 @@ +'use strict'; + +/** + * Merges an array of buffers into a new buffer. + * + * @param {Buffer[]} list The array of buffers to concat + * @param {Number} totalLength The total length of buffers in the list + * @return {Buffer} The resulting buffer + * @public + */ +function concat(list, totalLength) { + const target = Buffer.allocUnsafe(totalLength); + var offset = 0; + + for (var i = 0; i < list.length; i++) { + const buf = list[i]; + buf.copy(target, offset); + offset += buf.length; + } + + return target; +} + +/** + * Masks a buffer using the given mask. + * + * @param {Buffer} source The buffer to mask + * @param {Buffer} mask The mask to use + * @param {Buffer} output The buffer where to store the result + * @param {Number} offset The offset at which to start writing + * @param {Number} length The number of bytes to mask. + * @public + */ +function _mask(source, mask, output, offset, length) { + for (var i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } +} + +/** + * Unmasks a buffer using the given mask. + * + * @param {Buffer} buffer The buffer to unmask + * @param {Buffer} mask The mask to use + * @public + */ +function _unmask(buffer, mask) { + // Required until https://github.com/nodejs/node/issues/9006 is resolved. + const length = buffer.length; + for (var i = 0; i < length; i++) { + buffer[i] ^= mask[i & 3]; + } +} + +try { + const bufferUtil = require('bufferutil'); + const bu = bufferUtil.BufferUtil || bufferUtil; + + module.exports = { + mask(source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bu.mask(source, mask, output, offset, length); + }, + unmask(buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bu.unmask(buffer, mask); + }, + concat + }; +} catch (e) /* istanbul ignore next */ { + module.exports = { concat, mask: _mask, unmask: _unmask }; +} diff --git a/node_modules/engine.io-client/node_modules/ws/lib/constants.js b/node_modules/engine.io-client/node_modules/ws/lib/constants.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], + GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', + kStatusCode: Symbol('status-code'), + kWebSocket: Symbol('websocket'), + EMPTY_BUFFER: Buffer.alloc(0), + NOOP: () => {} +}; diff --git a/node_modules/engine.io-client/node_modules/ws/lib/event-target.js b/node_modules/engine.io-client/node_modules/ws/lib/event-target.js @@ -0,0 +1,170 @@ +'use strict'; + +/** + * Class representing an event. + * + * @private + */ +class Event { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @param {Object} target A reference to the target to which the event was dispatched + */ + constructor(type, target) { + this.target = target; + this.type = type; + } +} + +/** + * Class representing a message event. + * + * @extends Event + * @private + */ +class MessageEvent extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(data, target) { + super('message', target); + + this.data = data; + } +} + +/** + * Class representing a close event. + * + * @extends Event + * @private + */ +class CloseEvent extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {Number} code The status code explaining why the connection is being closed + * @param {String} reason A human-readable string explaining why the connection is closing + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(code, reason, target) { + super('close', target); + + this.wasClean = target._closeFrameReceived && target._closeFrameSent; + this.reason = reason; + this.code = code; + } +} + +/** + * Class representing an open event. + * + * @extends Event + * @private + */ +class OpenEvent extends Event { + /** + * Create a new `OpenEvent`. + * + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(target) { + super('open', target); + } +} + +/** + * Class representing an error event. + * + * @extends Event + * @private + */ +class ErrorEvent extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {Object} error The error that generated this event + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(error, target) { + super('error', target); + + this.message = error.message; + this.error = error; + } +} + +/** + * This provides methods for emulating the `EventTarget` interface. It's not + * meant to be used directly. + * + * @mixin + */ +const EventTarget = { + /** + * Register an event listener. + * + * @param {String} method A string representing the event type to listen for + * @param {Function} listener The listener to add + * @public + */ + addEventListener(method, listener) { + if (typeof listener !== 'function') return; + + function onMessage(data) { + listener.call(this, new MessageEvent(data, this)); + } + + function onClose(code, message) { + listener.call(this, new CloseEvent(code, message, this)); + } + + function onError(error) { + listener.call(this, new ErrorEvent(error, this)); + } + + function onOpen() { + listener.call(this, new OpenEvent(this)); + } + + if (method === 'message') { + onMessage._listener = listener; + this.on(method, onMessage); + } else if (method === 'close') { + onClose._listener = listener; + this.on(method, onClose); + } else if (method === 'error') { + onError._listener = listener; + this.on(method, onError); + } else if (method === 'open') { + onOpen._listener = listener; + this.on(method, onOpen); + } else { + this.on(method, listener); + } + }, + + /** + * Remove an event listener. + * + * @param {String} method A string representing the event type to remove + * @param {Function} listener The listener to remove + * @public + */ + removeEventListener(method, listener) { + const listeners = this.listeners(method); + + for (var i = 0; i < listeners.length; i++) { + if (listeners[i] === listener || listeners[i]._listener === listener) { + this.removeListener(method, listeners[i]); + } + } + } +}; + +module.exports = EventTarget; diff --git a/node_modules/engine.io-client/node_modules/ws/lib/extension.js b/node_modules/engine.io-client/node_modules/ws/lib/extension.js @@ -0,0 +1,222 @@ +'use strict'; + +// +// Allowed token characters: +// +// '!', '#', '$', '%', '&', ''', '*', '+', '-', +// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' +// +// tokenChars[32] === 0 // ' ' +// tokenChars[33] === 1 // '!' +// tokenChars[34] === 0 // '"' +// ... +// +// prettier-ignore +const tokenChars = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 + 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 +]; + +/** + * Adds an offer to the map of extension offers or a parameter to the map of + * parameters. + * + * @param {Object} dest The map of extension offers or parameters + * @param {String} name The extension or parameter name + * @param {(Object|Boolean|String)} elem The extension parameters or the + * parameter value + * @private + */ +function push(dest, name, elem) { + if (Object.prototype.hasOwnProperty.call(dest, name)) dest[name].push(elem); + else dest[name] = [elem]; +} + +/** + * Parses the `Sec-WebSocket-Extensions` header into an object. + * + * @param {String} header The field value of the header + * @return {Object} The parsed object + * @public + */ +function parse(header) { + const offers = {}; + + if (header === undefined || header === '') return offers; + + var params = {}; + var mustUnescape = false; + var isEscaping = false; + var inQuotes = false; + var extensionName; + var paramName; + var start = -1; + var end = -1; + + for (var i = 0; i < header.length; i++) { + const code = header.charCodeAt(i); + + if (extensionName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 /* ' ' */ || code === 0x09 /* '\t' */) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + const name = header.slice(start, end); + if (code === 0x2c) { + push(offers, name, params); + params = {}; + } else { + extensionName = name; + } + + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 || code === 0x09) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 0x2c) { + push(offers, extensionName, params); + params = {}; + extensionName = undefined; + } + + start = end = -1; + } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + // + // The value of a quoted-string after unescaping must conform to the + // token ABNF, so only token characters are valid. + // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 + // + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x22 /* '"' */ && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 0x5c /* '\' */) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 0x20 || code === 0x09)) { + if (end === -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + var value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ''); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 0x2c) { + push(offers, extensionName, params); + params = {}; + extensionName = undefined; + } + + paramName = undefined; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + + if (start === -1 || inQuotes) { + throw new SyntaxError('Unexpected end of input'); + } + + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === undefined) { + push(offers, token, {}); + } else { + if (paramName === undefined) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, '')); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + + return offers; +} + +/** + * Builds the `Sec-WebSocket-Extensions` header field value. + * + * @param {Object} extensions The map of extensions and parameters to format + * @return {String} A string representing the given object + * @public + */ +function format(extensions) { + return Object.keys(extensions) + .map((extension) => { + var configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations + .map((params) => { + return [extension] + .concat( + Object.keys(params).map((k) => { + var values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values + .map((v) => (v === true ? k : `${k}=${v}`)) + .join('; '); + }) + ) + .join('; '); + }) + .join(', '); + }) + .join(', '); +} + +module.exports = { format, parse }; diff --git a/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js b/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js @@ -0,0 +1,502 @@ +'use strict'; + +const Limiter = require('async-limiter'); +const zlib = require('zlib'); + +const bufferUtil = require('./buffer-util'); +const { kStatusCode, NOOP } = require('./constants'); + +const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); +const EMPTY_BLOCK = Buffer.from([0x00]); + +const kPerMessageDeflate = Symbol('permessage-deflate'); +const kTotalLength = Symbol('total-length'); +const kCallback = Symbol('callback'); +const kBuffers = Symbol('buffers'); +const kError = Symbol('error'); + +// +// We limit zlib concurrency, which prevents severe memory fragmentation +// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 +// and https://github.com/websockets/ws/issues/1202 +// +// Intentionally global; it's the global thread pool that's an issue. +// +let zlibLimiter; + +/** + * permessage-deflate implementation. + */ +class PerMessageDeflate { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} options Configuration options + * @param {Boolean} options.serverNoContextTakeover Request/accept disabling + * of server context takeover + * @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge + * disabling of client context takeover + * @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the + * use of a custom server window size + * @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support + * for, or request, a custom client window size + * @param {Object} options.zlibDeflateOptions Options to pass to zlib on deflate + * @param {Object} options.zlibInflateOptions Options to pass to zlib on inflate + * @param {Number} options.threshold Size (in bytes) below which messages + * should not be compressed + * @param {Number} options.concurrencyLimit The number of concurrent calls to + * zlib + * @param {Boolean} isServer Create the instance in either server or client + * mode + * @param {Number} maxPayload The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = + this._options.threshold !== undefined ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + + this.params = null; + + if (!zlibLimiter) { + const concurrency = + this._options.concurrencyLimit !== undefined + ? this._options.concurrencyLimit + : 10; + zlibLimiter = new Limiter({ concurrency }); + } + } + + /** + * @type {String} + */ + static get extensionName() { + return 'permessage-deflate'; + } + + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + + return params; + } + + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + + this.params = this._isServer + ? this.acceptAsServer(configurations) + : this.acceptAsClient(configurations); + + return this.params; + } + + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + + if (this._deflate) { + this._deflate.close(); + this._deflate = null; + } + } + + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if ( + (opts.serverNoContextTakeover === false && + params.server_no_context_takeover) || + (params.server_max_window_bits && + (opts.serverMaxWindowBits === false || + (typeof opts.serverMaxWindowBits === 'number' && + opts.serverMaxWindowBits > params.server_max_window_bits))) || + (typeof opts.clientMaxWindowBits === 'number' && + !params.client_max_window_bits) + ) { + return false; + } + + return true; + }); + + if (!accepted) { + throw new Error('None of the extension offers can be accepted'); + } + + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if ( + accepted.client_max_window_bits === true || + opts.clientMaxWindowBits === false + ) { + delete accepted.client_max_window_bits; + } + + return accepted; + } + + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + + if ( + this._options.clientNoContextTakeover === false && + params.client_no_context_takeover + ) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === 'number') { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if ( + this._options.clientMaxWindowBits === false || + (typeof this._options.clientMaxWindowBits === 'number' && + params.client_max_window_bits > this._options.clientMaxWindowBits) + ) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + + return params; + } + + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + var value = params[key]; + + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + + value = value[0]; + + if (key === 'client_max_window_bits') { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === 'server_max_window_bits') { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if ( + key === 'client_no_context_takeover' || + key === 'server_no_context_takeover' + ) { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + + params[key] = value; + }); + }); + + return configurations; + } + + /** + * Decompress data. Concurrency limited by async-limiter. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.push((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Compress data. Concurrency limited by async-limiter. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.push((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._inflate = zlib.createInflateRaw( + Object.assign({}, this._options.zlibInflateOptions, { windowBits }) + ); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on('error', inflateOnError); + this._inflate.on('data', inflateOnData); + } + + this._inflate[kCallback] = callback; + + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + + this._inflate.flush(() => { + const err = this._inflate[kError]; + + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + + const data = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + } + + callback(null, data); + }); + } + + /** + * Compress data. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + if (!data || data.length === 0) { + process.nextTick(callback, null, EMPTY_BLOCK); + return; + } + + const endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._deflate = zlib.createDeflateRaw( + Object.assign({}, this._options.zlibDeflateOptions, { windowBits }) + ); + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + // + // An `'error'` event is emitted, only on Node.js < 10.0.0, if the + // `zlib.DeflateRaw` instance is closed while data is being processed. + // This can happen if `PerMessageDeflate#cleanup()` is called at the wrong + // time due to an abnormal WebSocket closure. + // + this._deflate.on('error', NOOP); + this._deflate.on('data', deflateOnData); + } + + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + // + // This `if` statement is only needed for Node.js < 10.0.0 because as of + // commit https://github.com/nodejs/node/commit/5e3f5164, the flush + // callback is no longer called if the deflate stream is closed while + // data is being processed. + // + return; + } + + var data = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + + if (fin) data = data.slice(0, data.length - 4); + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.close(); + this._deflate = null; + } else { + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + } + + callback(null, data); + }); + } +} + +module.exports = PerMessageDeflate; + +/** + * The listener of the `zlib.DeflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; +} + +/** + * The listener of the `zlib.InflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + + if ( + this[kPerMessageDeflate]._maxPayload < 1 || + this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload + ) { + this[kBuffers].push(chunk); + return; + } + + this[kError] = new RangeError('Max payload size exceeded'); + this[kError][kStatusCode] = 1009; + this.removeListener('data', inflateOnData); + this.reset(); +} + +/** + * The listener of the `zlib.InflateRaw` stream `'error'` event. + * + * @param {Error} err The emitted error + * @private + */ +function inflateOnError(err) { + // + // There is no need to call `Zlib#close()` as the handle is automatically + // closed when an error is emitted. + // + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); +} diff --git a/node_modules/engine.io-client/node_modules/ws/lib/receiver.js b/node_modules/engine.io-client/node_modules/ws/lib/receiver.js @@ -0,0 +1,515 @@ +'use strict'; + +const stream = require('stream'); + +const PerMessageDeflate = require('./permessage-deflate'); +const bufferUtil = require('./buffer-util'); +const validation = require('./validation'); +const constants = require('./constants'); + +const GET_INFO = 0; +const GET_PAYLOAD_LENGTH_16 = 1; +const GET_PAYLOAD_LENGTH_64 = 2; +const GET_MASK = 3; +const GET_DATA = 4; +const INFLATING = 5; + +/** + * HyBi Receiver implementation. + * + * @extends stream.Writable + */ +class Receiver extends stream.Writable { + /** + * Creates a Receiver instance. + * + * @param {String} binaryType The type for binary data + * @param {Object} extensions An object containing the negotiated extensions + * @param {Number} maxPayload The maximum allowed message length + */ + constructor(binaryType, extensions, maxPayload) { + super(); + + this._binaryType = binaryType || constants.BINARY_TYPES[0]; + this[constants.kWebSocket] = undefined; + this._extensions = extensions || {}; + this._maxPayload = maxPayload | 0; + + this._bufferedBytes = 0; + this._buffers = []; + + this._compressed = false; + this._payloadLength = 0; + this._mask = undefined; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + + this._state = GET_INFO; + this._loop = false; + } + + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + */ + _write(chunk, encoding, cb) { + if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); + + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + + if (n === this._buffers[0].length) return this._buffers.shift(); + + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = buf.slice(n); + return buf.slice(0, n); + } + + const dst = Buffer.allocUnsafe(n); + + do { + const buf = this._buffers[0]; + + if (n >= buf.length) { + this._buffers.shift().copy(dst, dst.length - n); + } else { + buf.copy(dst, dst.length - n, 0, n); + this._buffers[0] = buf.slice(n); + } + + n -= buf.length; + } while (n > 0); + + return dst; + } + + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + var err; + this._loop = true; + + do { + switch (this._state) { + case GET_INFO: + err = this.getInfo(); + break; + case GET_PAYLOAD_LENGTH_16: + err = this.getPayloadLength16(); + break; + case GET_PAYLOAD_LENGTH_64: + err = this.getPayloadLength64(); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + err = this.getData(cb); + break; + default: + // `INFLATING` + this._loop = false; + return; + } + } while (this._loop); + + cb(err); + } + + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + const buf = this.consume(2); + + if ((buf[0] & 0x30) !== 0x00) { + this._loop = false; + return error(RangeError, 'RSV2 and RSV3 must be clear', true, 1002); + } + + const compressed = (buf[0] & 0x40) === 0x40; + + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + this._loop = false; + return error(RangeError, 'RSV1 must be clear', true, 1002); + } + + this._fin = (buf[0] & 0x80) === 0x80; + this._opcode = buf[0] & 0x0f; + this._payloadLength = buf[1] & 0x7f; + + if (this._opcode === 0x00) { + if (compressed) { + this._loop = false; + return error(RangeError, 'RSV1 must be clear', true, 1002); + } + + if (!this._fragmented) { + this._loop = false; + return error(RangeError, 'invalid opcode 0', true, 1002); + } + + this._opcode = this._fragmented; + } else if (this._opcode === 0x01 || this._opcode === 0x02) { + if (this._fragmented) { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + + this._compressed = compressed; + } else if (this._opcode > 0x07 && this._opcode < 0x0b) { + if (!this._fin) { + this._loop = false; + return error(RangeError, 'FIN must be set', true, 1002); + } + + if (compressed) { + this._loop = false; + return error(RangeError, 'RSV1 must be clear', true, 1002); + } + + if (this._payloadLength > 0x7d) { + this._loop = false; + return error( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002 + ); + } + } else { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 0x80) === 0x80; + + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else return this.haveLength(); + } + + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + this._payloadLength = this.consume(2).readUInt16BE(0); + return this.haveLength(); + } + + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + + // + // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned + // if payload length is greater than this number. + // + if (num > Math.pow(2, 53 - 32) - 1) { + this._loop = false; + return error( + RangeError, + 'Unsupported WebSocket frame: payload length > 2^53 - 1', + false, + 1009 + ); + } + + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + return this.haveLength(); + } + + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 0x08) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + this._loop = false; + return error(RangeError, 'Max payload size exceeded', false, 1009); + } + } + + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + + this._mask = this.consume(4); + this._state = GET_DATA; + } + + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(cb) { + var data = constants.EMPTY_BUFFER; + + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + + data = this.consume(this._payloadLength); + if (this._masked) bufferUtil.unmask(data, this._mask); + } + + if (this._opcode > 0x07) return this.controlMessage(data); + + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + + if (data.length) { + // + // This message is not compressed so its lenght is the sum of the payload + // length of all fragments. + // + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + + return this.dataMessage(); + } + + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + return cb( + error(RangeError, 'Max payload size exceeded', false, 1009) + ); + } + + this._fragments.push(buf); + } + + const er = this.dataMessage(); + if (er) return cb(er); + + this.startLoop(cb); + }); + } + + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const messageLength = this._messageLength; + const fragments = this._fragments; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + + if (this._opcode === 2) { + var data; + + if (this._binaryType === 'nodebuffer') { + data = toBuffer(fragments, messageLength); + } else if (this._binaryType === 'arraybuffer') { + data = toArrayBuffer(toBuffer(fragments, messageLength)); + } else { + data = fragments; + } + + this.emit('message', data); + } else { + const buf = toBuffer(fragments, messageLength); + + if (!validation.isValidUTF8(buf)) { + this._loop = false; + return error(Error, 'invalid UTF-8 sequence', true, 1007); + } + + this.emit('message', buf.toString()); + } + } + + this._state = GET_INFO; + } + + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data) { + if (this._opcode === 0x08) { + this._loop = false; + + if (data.length === 0) { + this.emit('conclude', 1005, ''); + this.end(); + } else if (data.length === 1) { + return error(RangeError, 'invalid payload length 1', true, 1002); + } else { + const code = data.readUInt16BE(0); + + if (!validation.isValidStatusCode(code)) { + return error(RangeError, `invalid status code ${code}`, true, 1002); + } + + const buf = data.slice(2); + + if (!validation.isValidUTF8(buf)) { + return error(Error, 'invalid UTF-8 sequence', true, 1007); + } + + this.emit('conclude', code, buf.toString()); + this.end(); + } + } else if (this._opcode === 0x09) { + this.emit('ping', data); + } else { + this.emit('pong', data); + } + + this._state = GET_INFO; + } +} + +module.exports = Receiver; + +/** + * Builds an error object. + * + * @param {(Error|RangeError)} ErrorCtor The error constructor + * @param {String} message The error message + * @param {Boolean} prefix Specifies whether or not to add a default prefix to + * `message` + * @param {Number} statusCode The status code + * @return {(Error|RangeError)} The error + * @private + */ +function error(ErrorCtor, message, prefix, statusCode) { + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + + Error.captureStackTrace(err, error); + err[constants.kStatusCode] = statusCode; + return err; +} + +/** + * Makes a buffer from a list of fragments. + * + * @param {Buffer[]} fragments The list of fragments composing the message + * @param {Number} messageLength The length of the message + * @return {Buffer} + * @private + */ +function toBuffer(fragments, messageLength) { + if (fragments.length === 1) return fragments[0]; + if (fragments.length > 1) return bufferUtil.concat(fragments, messageLength); + return constants.EMPTY_BUFFER; +} + +/** + * Converts a buffer to an `ArrayBuffer`. + * + * @param {Buffer} buf The buffer to convert + * @return {ArrayBuffer} Converted buffer + */ +function toArrayBuffer(buf) { + if (buf.byteLength === buf.buffer.byteLength) { + return buf.buffer; + } + + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); +} diff --git a/node_modules/engine.io-client/node_modules/ws/lib/sender.js b/node_modules/engine.io-client/node_modules/ws/lib/sender.js @@ -0,0 +1,416 @@ +'use strict'; + +const crypto = require('crypto'); + +const PerMessageDeflate = require('./permessage-deflate'); +const bufferUtil = require('./buffer-util'); +const validation = require('./validation'); +const constants = require('./constants'); + +/** + * HyBi Sender implementation. + */ +class Sender { + /** + * Creates a Sender instance. + * + * @param {net.Socket} socket The connection socket + * @param {Object} extensions An object containing the negotiated extensions + */ + constructor(socket, extensions) { + this._extensions = extensions || {}; + this._socket = socket; + + this._firstFragment = true; + this._compress = false; + + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {Buffer} data The data to frame + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} options.readOnly Specifies whether `data` can be modified + * @param {Boolean} options.fin Specifies whether or not to set the FIN bit + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit + * @return {Buffer[]} The framed data as a list of `Buffer` instances + * @public + */ + static frame(data, options) { + const merge = data.length < 1024 || (options.mask && options.readOnly); + var offset = options.mask ? 6 : 2; + var payloadLength = data.length; + + if (data.length >= 65536) { + offset += 8; + payloadLength = 127; + } else if (data.length > 125) { + offset += 2; + payloadLength = 126; + } + + const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); + + target[0] = options.fin ? options.opcode | 0x80 : options.opcode; + if (options.rsv1) target[0] |= 0x40; + + if (payloadLength === 126) { + target.writeUInt16BE(data.length, 2); + } else if (payloadLength === 127) { + target.writeUInt32BE(0, 2); + target.writeUInt32BE(data.length, 6); + } + + if (!options.mask) { + target[1] = payloadLength; + if (merge) { + data.copy(target, offset); + return [target]; + } + + return [target, data]; + } + + const mask = crypto.randomBytes(4); + + target[1] = payloadLength | 0x80; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + + if (merge) { + bufferUtil.mask(data, mask, target, offset, data.length); + return [target]; + } + + bufferUtil.mask(data, mask, data, 0, data.length); + return [target, data]; + } + + /** + * Sends a close message to the other peer. + * + * @param {(Number|undefined)} code The status code component of the body + * @param {String} data The message component of the body + * @param {Boolean} mask Specifies whether or not to mask the message + * @param {Function} cb Callback + * @public + */ + close(code, data, mask, cb) { + var buf; + + if (code === undefined) { + buf = constants.EMPTY_BUFFER; + } else if ( + typeof code !== 'number' || + !validation.isValidStatusCode(code) + ) { + throw new TypeError('First argument must be a valid error code number'); + } else if (data === undefined || data === '') { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + buf = Buffer.allocUnsafe(2 + Buffer.byteLength(data)); + buf.writeUInt16BE(code, 0); + buf.write(data, 2); + } + + if (this._deflating) { + this.enqueue([this.doClose, buf, mask, cb]); + } else { + this.doClose(buf, mask, cb); + } + } + + /** + * Frames and sends a close message. + * + * @param {Buffer} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @private + */ + doClose(data, mask, cb) { + this.sendFrame( + Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 0x08, + mask, + readOnly: false + }), + cb + ); + } + + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @public + */ + ping(data, mask, cb) { + var readOnly = true; + + if (!Buffer.isBuffer(data)) { + if (data instanceof ArrayBuffer) { + data = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + data = viewToBuffer(data); + } else { + data = Buffer.from(data); + readOnly = false; + } + } + + if (this._deflating) { + this.enqueue([this.doPing, data, mask, readOnly, cb]); + } else { + this.doPing(data, mask, readOnly, cb); + } + } + + /** + * Frames and sends a ping message. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Boolean} readOnly Specifies whether `data` can be modified + * @param {Function} cb Callback + * @private + */ + doPing(data, mask, readOnly, cb) { + this.sendFrame( + Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 0x09, + mask, + readOnly + }), + cb + ); + } + + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @public + */ + pong(data, mask, cb) { + var readOnly = true; + + if (!Buffer.isBuffer(data)) { + if (data instanceof ArrayBuffer) { + data = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + data = viewToBuffer(data); + } else { + data = Buffer.from(data); + readOnly = false; + } + } + + if (this._deflating) { + this.enqueue([this.doPong, data, mask, readOnly, cb]); + } else { + this.doPong(data, mask, readOnly, cb); + } + } + + /** + * Frames and sends a pong message. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Boolean} readOnly Specifies whether `data` can be modified + * @param {Function} cb Callback + * @private + */ + doPong(data, mask, readOnly, cb) { + this.sendFrame( + Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 0x0a, + mask, + readOnly + }), + cb + ); + } + + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} options.compress Specifies whether or not to compress `data` + * @param {Boolean} options.binary Specifies whether `data` is binary or text + * @param {Boolean} options.fin Specifies whether the fragment is the last one + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @public + */ + send(data, options, cb) { + var opcode = options.binary ? 2 : 1; + var rsv1 = options.compress; + var readOnly = true; + + if (!Buffer.isBuffer(data)) { + if (data instanceof ArrayBuffer) { + data = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + data = viewToBuffer(data); + } else { + data = Buffer.from(data); + readOnly = false; + } + } + + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + if (this._firstFragment) { + this._firstFragment = false; + if (rsv1 && perMessageDeflate) { + rsv1 = data.length >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + + if (options.fin) this._firstFragment = true; + + if (perMessageDeflate) { + const opts = { + fin: options.fin, + rsv1, + opcode, + mask: options.mask, + readOnly + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, this._compress, opts, cb]); + } else { + this.dispatch(data, this._compress, opts, cb); + } + } else { + this.sendFrame( + Sender.frame(data, { + fin: options.fin, + rsv1: false, + opcode, + mask: options.mask, + readOnly + }), + cb + ); + } + } + + /** + * Dispatches a data message. + * + * @param {Buffer} data The message to send + * @param {Boolean} compress Specifies whether or not to compress `data` + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} options.readOnly Specifies whether `data` can be modified + * @param {Boolean} options.fin Specifies whether or not to set the FIN bit + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit + * @param {Function} cb Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(Sender.frame(data, options), cb); + return; + } + + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + this._deflating = false; + options.readOnly = false; + this.sendFrame(Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + + this._bufferedBytes -= params[1].length; + params[0].apply(this, params.slice(1)); + } + } + + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[1].length; + this._queue.push(params); + } + + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} cb Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.write(list[0]); + this._socket.write(list[1], cb); + } else { + this._socket.write(list[0], cb); + } + } +} + +module.exports = Sender; + +/** + * Converts an `ArrayBuffer` view into a buffer. + * + * @param {(DataView|TypedArray)} view The view to convert + * @return {Buffer} Converted view + * @private + */ +function viewToBuffer(view) { + const buf = Buffer.from(view.buffer); + + if (view.byteLength !== view.buffer.byteLength) { + return buf.slice(view.byteOffset, view.byteOffset + view.byteLength); + } + + return buf; +} diff --git a/node_modules/engine.io-client/node_modules/ws/lib/validation.js b/node_modules/engine.io-client/node_modules/ws/lib/validation.js @@ -0,0 +1,30 @@ +'use strict'; + +try { + const isValidUTF8 = require('utf-8-validate'); + + exports.isValidUTF8 = + typeof isValidUTF8 === 'object' + ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0 + : isValidUTF8; +} catch (e) /* istanbul ignore next */ { + exports.isValidUTF8 = () => true; +} + +/** + * Checks if a status code is allowed in a close frame. + * + * @param {Number} code The status code + * @return {Boolean} `true` if the status code is valid, else `false` + * @public + */ +exports.isValidStatusCode = (code) => { + return ( + (code >= 1000 && + code <= 1013 && + code !== 1004 && + code !== 1005 && + code !== 1006) || + (code >= 3000 && code <= 4999) + ); +}; diff --git a/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js b/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js @@ -0,0 +1,389 @@ +'use strict'; + +const EventEmitter = require('events'); +const crypto = require('crypto'); +const http = require('http'); + +const PerMessageDeflate = require('./permessage-deflate'); +const extension = require('./extension'); +const constants = require('./constants'); +const WebSocket = require('./websocket'); + +/** + * Class representing a WebSocket server. + * + * @extends EventEmitter + */ +class WebSocketServer extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {String} options.host The hostname where to bind the server + * @param {Number} options.port The port where to bind the server + * @param {http.Server} options.server A pre-created HTTP/S server to use + * @param {Function} options.verifyClient An hook to reject connections + * @param {Function} options.handleProtocols An hook to handle protocols + * @param {String} options.path Accept only connections matching this path + * @param {Boolean} options.noServer Enable no server mode + * @param {Boolean} options.clientTracking Specifies whether or not to track clients + * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate + * @param {Number} options.maxPayload The maximum allowed message size + * @param {Function} callback A listener for the `listening` event + */ + constructor(options, callback) { + super(); + + options = Object.assign( + { + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null + }, + options + ); + + if (options.port == null && !options.server && !options.noServer) { + throw new TypeError( + 'One of the "port", "server", or "noServer" options must be specified' + ); + } + + if (options.port != null) { + this._server = http.createServer((req, res) => { + const body = http.STATUS_CODES[426]; + + res.writeHead(426, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + + if (this._server) { + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, 'listening'), + error: this.emit.bind(this, 'error'), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, (ws) => { + this.emit('connection', ws, req); + }); + } + }); + } + + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) this.clients = new Set(); + this.options = options; + } + + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + + if (!this._server) return null; + return this._server.address(); + } + + /** + * Close the server. + * + * @param {Function} cb Callback + * @public + */ + close(cb) { + if (cb) this.once('close', cb); + + // + // Terminate all associated clients. + // + if (this.clients) { + for (const client of this.clients) client.terminate(); + } + + const server = this._server; + + if (server) { + this._removeListeners(); + this._removeListeners = this._server = null; + + // + // Close the http server if it was internally created. + // + if (this.options.port != null) { + server.close(() => this.emit('close')); + return; + } + } + + process.nextTick(emitClose, this); + } + + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf('?'); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + + if (pathname !== this.options.path) return false; + } + + return true; + } + + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on('error', socketOnError); + + const version = +req.headers['sec-websocket-version']; + const extensions = {}; + + if ( + req.method !== 'GET' || + req.headers.upgrade.toLowerCase() !== 'websocket' || + !req.headers['sec-websocket-key'] || + (version !== 8 && version !== 13) || + !this.shouldHandle(req) + ) { + return abortHandshake(socket, 400); + } + + if (this.options.perMessageDeflate) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + + try { + const offers = extension.parse(req.headers['sec-websocket-extensions']); + + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + return abortHandshake(socket, 400); + } + } + + // + // Optionally call external client verification handler. + // + if (this.options.verifyClient) { + const info = { + origin: + req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], + secure: !!(req.connection.authorized || req.connection.encrypted), + req + }; + + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + + this.completeUpgrade(extensions, req, socket, head, cb); + }); + return; + } + + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + + this.completeUpgrade(extensions, req, socket, head, cb); + } + + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @private + */ + completeUpgrade(extensions, req, socket, head, cb) { + // + // Destroy the socket if the client has already sent a FIN packet. + // + if (!socket.readable || !socket.writable) return socket.destroy(); + + const key = crypto + .createHash('sha1') + .update(req.headers['sec-websocket-key'] + constants.GUID, 'binary') + .digest('base64'); + + const headers = [ + 'HTTP/1.1 101 Switching Protocols', + 'Upgrade: websocket', + 'Connection: Upgrade', + `Sec-WebSocket-Accept: ${key}` + ]; + + const ws = new WebSocket(null); + var protocol = req.headers['sec-websocket-protocol']; + + if (protocol) { + protocol = protocol.trim().split(/ *, */); + + // + // Optionally call external protocol selection handler. + // + if (this.options.handleProtocols) { + protocol = this.options.handleProtocols(protocol, req); + } else { + protocol = protocol[0]; + } + + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws.protocol = protocol; + } + } + + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = extension.format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + + // + // Allow external modification/inspection of handshake headers. + // + this.emit('headers', headers, req); + + socket.write(headers.concat('\r\n').join('\r\n')); + socket.removeListener('error', socketOnError); + + ws.setSocket(socket, head, this.options.maxPayload); + + if (this.clients) { + this.clients.add(ws); + ws.on('close', () => this.clients.delete(ws)); + } + + cb(ws); + } +} + +module.exports = WebSocketServer; + +/** + * Add event listeners on an `EventEmitter` using a map of <event, listener> + * pairs. + * + * @param {EventEmitter} server The event emitter + * @param {Object.<String, Function>} map The listeners to add + * @return {Function} A function that will remove the added listeners when called + * @private + */ +function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; +} + +/** + * Emit a `'close'` event on an `EventEmitter`. + * + * @param {EventEmitter} server The event emitter + * @private + */ +function emitClose(server) { + server.emit('close'); +} + +/** + * Handle premature socket errors. + * + * @private + */ +function socketOnError() { + this.destroy(); +} + +/** + * Close the connection when preconditions are not fulfilled. + * + * @param {net.Socket} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} [message] The HTTP response body + * @param {Object} [headers] Additional HTTP response headers + * @private + */ +function abortHandshake(socket, code, message, headers) { + if (socket.writable) { + message = message || http.STATUS_CODES[code]; + headers = Object.assign( + { + Connection: 'close', + 'Content-type': 'text/html', + 'Content-Length': Buffer.byteLength(message) + }, + headers + ); + + socket.write( + `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + + Object.keys(headers) + .map((h) => `${h}: ${headers[h]}`) + .join('\r\n') + + '\r\n\r\n' + + message + ); + } + + socket.removeListener('error', socketOnError); + socket.destroy(); +} diff --git a/node_modules/engine.io-client/node_modules/ws/lib/websocket.js b/node_modules/engine.io-client/node_modules/ws/lib/websocket.js @@ -0,0 +1,852 @@ +'use strict'; + +const EventEmitter = require('events'); +const crypto = require('crypto'); +const https = require('https'); +const http = require('http'); +const net = require('net'); +const tls = require('tls'); +const url = require('url'); + +const PerMessageDeflate = require('./permessage-deflate'); +const EventTarget = require('./event-target'); +const extension = require('./extension'); +const constants = require('./constants'); +const Receiver = require('./receiver'); +const Sender = require('./sender'); + +const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; +const kWebSocket = constants.kWebSocket; +const protocolVersions = [8, 13]; +const closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly. + +/** + * Class representing a WebSocket. + * + * @extends EventEmitter + */ +class WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|url.Url|url.URL)} address The URL to which to connect + * @param {(String|String[])} protocols The subprotocols + * @param {Object} options Connection options + */ + constructor(address, protocols, options) { + super(); + + this.readyState = WebSocket.CONNECTING; + this.protocol = ''; + + this._binaryType = constants.BINARY_TYPES[0]; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = ''; + this._closeTimer = null; + this._closeCode = 1006; + this._extensions = {}; + this._isServer = true; + this._receiver = null; + this._sender = null; + this._socket = null; + + if (address !== null) { + if (Array.isArray(protocols)) { + protocols = protocols.join(', '); + } else if (typeof protocols === 'object' && protocols !== null) { + options = protocols; + protocols = undefined; + } + + initAsClient.call(this, address, protocols, options); + } + } + + get CONNECTING() { + return WebSocket.CONNECTING; + } + get CLOSING() { + return WebSocket.CLOSING; + } + get CLOSED() { + return WebSocket.CLOSED; + } + get OPEN() { + return WebSocket.OPEN; + } + + /** + * This deviates from the WHATWG interface since ws doesn't support the required + * default "blob" type (instead we define a custom "nodebuffer" type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + + set binaryType(type) { + if (!constants.BINARY_TYPES.includes(type)) return; + + this._binaryType = type; + + // + // Allow to change `binaryType` on the fly. + // + if (this._receiver) this._receiver._binaryType = type; + } + + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return 0; + + // + // `socket.bufferSize` is `undefined` if the socket is closed. + // + return (this._socket.bufferSize || 0) + this._sender._bufferedBytes; + } + + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + + /** + * Set up the socket and the internal resources. + * + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Number} maxPayload The maximum allowed message size + * @private + */ + setSocket(socket, head, maxPayload) { + const receiver = new Receiver( + this._binaryType, + this._extensions, + maxPayload + ); + + this._sender = new Sender(socket, this._extensions); + this._receiver = receiver; + this._socket = socket; + + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + + receiver.on('conclude', receiverOnConclude); + receiver.on('drain', receiverOnDrain); + receiver.on('error', receiverOnError); + receiver.on('message', receiverOnMessage); + receiver.on('ping', receiverOnPing); + receiver.on('pong', receiverOnPong); + + socket.setTimeout(0); + socket.setNoDelay(); + + if (head.length > 0) socket.unshift(head); + + socket.on('close', socketOnClose); + socket.on('data', socketOnData); + socket.on('end', socketOnEnd); + socket.on('error', socketOnError); + + this.readyState = WebSocket.OPEN; + this.emit('open'); + } + + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + this.readyState = WebSocket.CLOSED; + + if (!this._socket) { + this.emit('close', this._closeCode, this._closeMessage); + return; + } + + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + + this._receiver.removeAllListeners(); + this.emit('close', this._closeCode, this._closeMessage); + } + + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} code Status code explaining why the connection is closing + * @param {String} data A string explaining why the connection is closing + * @public + */ + close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + return abortHandshake(this, this._req, msg); + } + + if (this.readyState === WebSocket.CLOSING) { + if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); + return; + } + + this.readyState = WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + // + // This error is handled by the `'error'` listener on the socket. We only + // want to know if the close frame has been sent here. + // + if (err) return; + + this._closeFrameSent = true; + + if (this._socket.writable) { + if (this._closeFrameReceived) this._socket.end(); + + // + // Ensure that the connection is closed even if the closing handshake + // fails. + // + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + }); + } + + /** + * Send a ping. + * + * @param {*} data The data to send + * @param {Boolean} mask Indicates whether or not to mask `data` + * @param {Function} cb Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (this.readyState !== WebSocket.OPEN) { + const err = new Error( + `WebSocket is not open: readyState ${this.readyState} ` + + `(${readyStates[this.readyState]})` + ); + + if (cb) return cb(err); + throw err; + } + + if (typeof data === 'number') data = data.toString(); + if (mask === undefined) mask = !this._isServer; + this._sender.ping(data || constants.EMPTY_BUFFER, mask, cb); + } + + /** + * Send a pong. + * + * @param {*} data The data to send + * @param {Boolean} mask Indicates whether or not to mask `data` + * @param {Function} cb Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (this.readyState !== WebSocket.OPEN) { + const err = new Error( + `WebSocket is not open: readyState ${this.readyState} ` + + `(${readyStates[this.readyState]})` + ); + + if (cb) return cb(err); + throw err; + } + + if (typeof data === 'number') data = data.toString(); + if (mask === undefined) mask = !this._isServer; + this._sender.pong(data || constants.EMPTY_BUFFER, mask, cb); + } + + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} options.compress Specifies whether or not to compress `data` + * @param {Boolean} options.binary Specifies whether `data` is binary or text + * @param {Boolean} options.fin Specifies whether the fragment is the last one + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Function} cb Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (this.readyState !== WebSocket.OPEN) { + const err = new Error( + `WebSocket is not open: readyState ${this.readyState} ` + + `(${readyStates[this.readyState]})` + ); + + if (cb) return cb(err); + throw err; + } + + if (typeof data === 'number') data = data.toString(); + + const opts = Object.assign( + { + binary: typeof data !== 'string', + mask: !this._isServer, + compress: true, + fin: true + }, + options + ); + + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + + this._sender.send(data || constants.EMPTY_BUFFER, opts, cb); + } + + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + return abortHandshake(this, this._req, msg); + } + + if (this._socket) { + this.readyState = WebSocket.CLOSING; + this._socket.destroy(); + } + } +} + +readyStates.forEach((readyState, i) => { + WebSocket[readyState] = i; +}); + +// +// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. +// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface +// +['open', 'error', 'close', 'message'].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + /** + * Return the listener of the event. + * + * @return {(Function|undefined)} The event listener or `undefined` + * @public + */ + get() { + const listeners = this.listeners(method); + for (var i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) return listeners[i]._listener; + } + + return undefined; + }, + /** + * Add a listener for the event. + * + * @param {Function} listener The listener to add + * @public + */ + set(listener) { + const listeners = this.listeners(method); + for (var i = 0; i < listeners.length; i++) { + // + // Remove only the listeners added via `addEventListener`. + // + if (listeners[i]._listener) this.removeListener(method, listeners[i]); + } + this.addEventListener(method, listener); + } + }); +}); + +WebSocket.prototype.addEventListener = EventTarget.addEventListener; +WebSocket.prototype.removeEventListener = EventTarget.removeEventListener; + +module.exports = WebSocket; + +/** + * Initialize a WebSocket client. + * + * @param {(String|url.Url|url.URL)} address The URL to which to connect + * @param {String} protocols The subprotocols + * @param {Object} options Connection options + * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate + * @param {Number} options.handshakeTimeout Timeout in milliseconds for the handshake request + * @param {Number} options.protocolVersion Value of the `Sec-WebSocket-Version` header + * @param {String} options.origin Value of the `Origin` or `Sec-WebSocket-Origin` header + * @param {Number} options.maxPayload The maximum allowed message size + * @private + */ +function initAsClient(address, protocols, options) { + options = Object.assign( + { + protocolVersion: protocolVersions[1], + perMessageDeflate: true, + maxPayload: 100 * 1024 * 1024 + }, + options, + { + createConnection: undefined, + socketPath: undefined, + hostname: undefined, + protocol: undefined, + timeout: undefined, + method: undefined, + auth: undefined, + host: undefined, + path: undefined, + port: undefined + } + ); + + if (!protocolVersions.includes(options.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${options.protocolVersion} ` + + `(supported versions: ${protocolVersions.join(', ')})` + ); + } + + this._isServer = false; + + var parsedUrl; + + if (typeof address === 'object' && address.href !== undefined) { + parsedUrl = address; + this.url = address.href; + } else { + // + // The WHATWG URL constructor is not available on Node.js < 6.13.0 + // + parsedUrl = url.URL ? new url.URL(address) : url.parse(address); + this.url = address; + } + + const isUnixSocket = parsedUrl.protocol === 'ws+unix:'; + + if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { + throw new Error(`Invalid URL: ${this.url}`); + } + + const isSecure = + parsedUrl.protocol === 'wss:' || parsedUrl.protocol === 'https:'; + const defaultPort = isSecure ? 443 : 80; + const key = crypto.randomBytes(16).toString('base64'); + const httpObj = isSecure ? https : http; + const path = parsedUrl.search + ? `${parsedUrl.pathname || '/'}${parsedUrl.search}` + : parsedUrl.pathname || '/'; + var perMessageDeflate; + + options.createConnection = isSecure ? tlsConnect : netConnect; + options.defaultPort = options.defaultPort || defaultPort; + options.port = parsedUrl.port || defaultPort; + options.host = parsedUrl.hostname.startsWith('[') + ? parsedUrl.hostname.slice(1, -1) + : parsedUrl.hostname; + options.headers = Object.assign( + { + 'Sec-WebSocket-Version': options.protocolVersion, + 'Sec-WebSocket-Key': key, + Connection: 'Upgrade', + Upgrade: 'websocket' + }, + options.headers + ); + options.path = path; + options.timeout = options.handshakeTimeout; + + if (options.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + options.perMessageDeflate !== true ? options.perMessageDeflate : {}, + false, + options.maxPayload + ); + options.headers['Sec-WebSocket-Extensions'] = extension.format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols) { + options.headers['Sec-WebSocket-Protocol'] = protocols; + } + if (options.origin) { + if (options.protocolVersion < 13) { + options.headers['Sec-WebSocket-Origin'] = options.origin; + } else { + options.headers.Origin = options.origin; + } + } + if (parsedUrl.auth) { + options.auth = parsedUrl.auth; + } else if (parsedUrl.username || parsedUrl.password) { + options.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + + if (isUnixSocket) { + const parts = path.split(':'); + + options.socketPath = parts[0]; + options.path = parts[1]; + } + + var req = (this._req = httpObj.get(options)); + + if (options.handshakeTimeout) { + req.on('timeout', () => { + abortHandshake(this, req, 'Opening handshake has timed out'); + }); + } + + req.on('error', (err) => { + if (this._req.aborted) return; + + req = this._req = null; + this.readyState = WebSocket.CLOSING; + this.emit('error', err); + this.emitClose(); + }); + + req.on('response', (res) => { + if (this.emit('unexpected-response', req, res)) return; + + abortHandshake(this, req, `Unexpected server response: ${res.statusCode}`); + }); + + req.on('upgrade', (res, socket, head) => { + this.emit('upgrade', res); + + // + // The user may have closed the connection from a listener of the `upgrade` + // event. + // + if (this.readyState !== WebSocket.CONNECTING) return; + + req = this._req = null; + + const digest = crypto + .createHash('sha1') + .update(key + constants.GUID, 'binary') + .digest('base64'); + + if (res.headers['sec-websocket-accept'] !== digest) { + abortHandshake(this, socket, 'Invalid Sec-WebSocket-Accept header'); + return; + } + + const serverProt = res.headers['sec-websocket-protocol']; + const protList = (protocols || '').split(/, */); + var protError; + + if (!protocols && serverProt) { + protError = 'Server sent a subprotocol but none was requested'; + } else if (protocols && !serverProt) { + protError = 'Server sent no subprotocol'; + } else if (serverProt && !protList.includes(serverProt)) { + protError = 'Server sent an invalid subprotocol'; + } + + if (protError) { + abortHandshake(this, socket, protError); + return; + } + + if (serverProt) this.protocol = serverProt; + + if (perMessageDeflate) { + try { + const extensions = extension.parse( + res.headers['sec-websocket-extensions'] + ); + + if (extensions[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + this._extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + abortHandshake(this, socket, 'Invalid Sec-WebSocket-Extensions header'); + return; + } + } + + this.setSocket(socket, head, options.maxPayload); + }); +} + +/** + * Create a `net.Socket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {net.Socket} The newly created socket used to start the connection + * @private + */ +function netConnect(options) { + // + // Override `options.path` only if `options` is a copy of the original options + // object. This is always true on Node.js >= 8 but not on Node.js 6 where + // `options.socketPath` might be `undefined` even if the `socketPath` option + // was originally set. + // + if (options.protocolVersion) options.path = options.socketPath; + return net.connect(options); +} + +/** + * Create a `tls.TLSSocket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {tls.TLSSocket} The newly created socket used to start the connection + * @private + */ +function tlsConnect(options) { + options.path = undefined; + options.servername = options.servername || options.host; + return tls.connect(options); +} + +/** + * Abort the handshake and emit an error. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {(http.ClientRequest|net.Socket)} stream The request to abort or the + * socket to destroy + * @param {String} message The error message + * @private + */ +function abortHandshake(websocket, stream, message) { + websocket.readyState = WebSocket.CLOSING; + + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + + if (stream.setHeader) { + stream.abort(); + stream.once('abort', websocket.emitClose.bind(websocket)); + websocket.emit('error', err); + } else { + stream.destroy(err); + stream.once('error', websocket.emit.bind(websocket, 'error')); + stream.once('close', websocket.emitClose.bind(websocket)); + } +} + +/** + * The listener of the `Receiver` `'conclude'` event. + * + * @param {Number} code The status code + * @param {String} reason The reason for closing + * @private + */ +function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + + websocket._socket.removeListener('data', socketOnData); + websocket._socket.resume(); + + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + + if (code === 1005) websocket.close(); + else websocket.close(code, reason); +} + +/** + * The listener of the `Receiver` `'drain'` event. + * + * @private + */ +function receiverOnDrain() { + this[kWebSocket]._socket.resume(); +} + +/** + * The listener of the `Receiver` `'error'` event. + * + * @param {(RangeError|Error)} err The emitted error + * @private + */ +function receiverOnError(err) { + const websocket = this[kWebSocket]; + + websocket._socket.removeListener('data', socketOnData); + + websocket.readyState = WebSocket.CLOSING; + websocket._closeCode = err[constants.kStatusCode]; + websocket.emit('error', err); + websocket._socket.destroy(); +} + +/** + * The listener of the `Receiver` `'finish'` event. + * + * @private + */ +function receiverOnFinish() { + this[kWebSocket].emitClose(); +} + +/** + * The listener of the `Receiver` `'message'` event. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The message + * @private + */ +function receiverOnMessage(data) { + this[kWebSocket].emit('message', data); +} + +/** + * The listener of the `Receiver` `'ping'` event. + * + * @param {Buffer} data The data included in the ping frame + * @private + */ +function receiverOnPing(data) { + const websocket = this[kWebSocket]; + + websocket.pong(data, !websocket._isServer, constants.NOOP); + websocket.emit('ping', data); +} + +/** + * The listener of the `Receiver` `'pong'` event. + * + * @param {Buffer} data The data included in the pong frame + * @private + */ +function receiverOnPong(data) { + this[kWebSocket].emit('pong', data); +} + +/** + * The listener of the `net.Socket` `'close'` event. + * + * @private + */ +function socketOnClose() { + const websocket = this[kWebSocket]; + + this.removeListener('close', socketOnClose); + this.removeListener('end', socketOnEnd); + + websocket.readyState = WebSocket.CLOSING; + + // + // The close frame might not have been received or the `'end'` event emitted, + // for example, if the socket was destroyed due to an error. Ensure that the + // `receiver` stream is closed after writing any remaining buffered data to + // it. If the readable side of the socket is in flowing mode then there is no + // buffered data as everything has been already written and `readable.read()` + // will return `null`. If instead, the socket is paused, any possible buffered + // data will be read as a single chunk and emitted synchronously in a single + // `'data'` event. + // + websocket._socket.read(); + websocket._receiver.end(); + + this.removeListener('data', socketOnData); + this[kWebSocket] = undefined; + + clearTimeout(websocket._closeTimer); + + if ( + websocket._receiver._writableState.finished || + websocket._receiver._writableState.errorEmitted + ) { + websocket.emitClose(); + } else { + websocket._receiver.on('error', receiverOnFinish); + websocket._receiver.on('finish', receiverOnFinish); + } +} + +/** + * The listener of the `net.Socket` `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } +} + +/** + * The listener of the `net.Socket` `'end'` event. + * + * @private + */ +function socketOnEnd() { + const websocket = this[kWebSocket]; + + websocket.readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); +} + +/** + * The listener of the `net.Socket` `'error'` event. + * + * @private + */ +function socketOnError() { + const websocket = this[kWebSocket]; + + this.removeListener('error', socketOnError); + this.on('error', constants.NOOP); + + if (websocket) { + websocket.readyState = WebSocket.CLOSING; + this.destroy(); + } +} diff --git a/node_modules/engine.io-client/node_modules/ws/package.json b/node_modules/engine.io-client/node_modules/ws/package.json @@ -0,0 +1,79 @@ +{ + "_from": "ws@~6.1.0", + "_id": "ws@6.1.4", + "_inBundle": false, + "_integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "_location": "/engine.io-client/ws", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ws@~6.1.0", + "name": "ws", + "escapedName": "ws", + "rawSpec": "~6.1.0", + "saveSpec": null, + "fetchSpec": "~6.1.0" + }, + "_requiredBy": [ + "/engine.io-client" + ], + "_resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "_shasum": "5b5c8800afab925e94ccb29d153c8d02c1776ef9", + "_spec": "ws@~6.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client", + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/websockets/ws/issues" + }, + "bundleDependencies": false, + "dependencies": { + "async-limiter": "~1.0.0" + }, + "deprecated": false, + "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", + "devDependencies": { + "benchmark": "~2.1.4", + "bufferutil": "~4.0.0", + "eslint": "~5.14.0", + "eslint-config-prettier": "~4.0.0", + "eslint-plugin-prettier": "~3.0.0", + "mocha": "~5.2.0", + "nyc": "~13.3.0", + "prettier": "~1.16.1", + "prettylint": "~1.0.0", + "utf-8-validate": "~5.0.0" + }, + "files": [ + "browser.js", + "index.js", + "lib/*.js" + ], + "homepage": "https://github.com/websockets/ws", + "keywords": [ + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "license": "MIT", + "main": "index.js", + "name": "ws", + "repository": { + "type": "git", + "url": "git+https://github.com/websockets/ws.git" + }, + "scripts": { + "integration": "npm run lint && mocha test/*.integration.js", + "lint": "eslint . --ignore-path .gitignore && prettylint '**/*.{json,md}' --ignore-path .gitignore", + "test": "npm run lint && nyc --reporter=html --reporter=text mocha test/*.test.js" + }, + "version": "6.1.4" +} diff --git a/node_modules/engine.io-client/package.json b/node_modules/engine.io-client/package.json @@ -0,0 +1,114 @@ +{ + "_from": "engine.io-client@~3.4.0", + "_id": "engine.io-client@3.4.1", + "_inBundle": false, + "_integrity": "sha512-RJNmA+A9Js+8Aoq815xpGAsgWH1VoSYM//2VgIiu9lNOaHFfLpTjH4tOzktBpjIs5lvOfiNY1dwf+NuU6D38Mw==", + "_location": "/engine.io-client", + "_phantomChildren": { + "async-limiter": "1.0.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "engine.io-client@~3.4.0", + "name": "engine.io-client", + "escapedName": "engine.io-client", + "rawSpec": "~3.4.0", + "saveSpec": null, + "fetchSpec": "~3.4.0" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.1.tgz", + "_shasum": "922ddb47eecdcb541136a93aeead24718fd05461", + "_spec": "engine.io-client@~3.4.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "browser": { + "ws": false, + "xmlhttprequest-ssl": "./lib/xmlhttprequest.js", + "./lib/globalThis.js": "./lib/globalThis.browser.js" + }, + "bugs": { + "url": "https://github.com/socketio/engine.io-client/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Guillermo Rauch", + "email": "rauchg@gmail.com" + }, + { + "name": "Vladimir Dronnikov", + "email": "dronnikov@gmail.com" + }, + { + "name": "Christoph Dorn", + "url": "https://github.com/cadorn" + }, + { + "name": "Mark Mokryn", + "email": "mokesmokes@gmail.com" + } + ], + "dependencies": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "deprecated": false, + "description": "Client for the realtime Engine", + "devDependencies": { + "babel-core": "^6.24.0", + "babel-eslint": "4.1.7", + "babel-loader": "^6.4.1", + "babel-preset-es2015": "^6.24.0", + "blob": "^0.0.4", + "concat-stream": "^1.6.0", + "del": "^2.2.2", + "derequire": "^2.0.6", + "engine.io": "3.4.0", + "eslint-config-standard": "4.4.0", + "eslint-plugin-standard": "1.3.1", + "expect.js": "^0.3.1", + "express": "4.15.2", + "gulp": "3.9.1", + "gulp-eslint": "1.1.1", + "gulp-file": "^0.3.0", + "gulp-istanbul": "^1.1.1", + "gulp-mocha": "^4.3.0", + "gulp-task-listing": "1.0.1", + "istanbul": "^0.4.5", + "mocha": "^3.2.0", + "webpack": "1.12.12", + "webpack-stream": "^3.2.0", + "zuul": "3.11.1", + "zuul-builder-webpack": "^1.2.0", + "zuul-ngrok": "4.0.0" + }, + "files": [ + "index.js", + "lib/", + "engine.io.js" + ], + "homepage": "https://github.com/socketio/engine.io-client", + "license": "MIT", + "main": "lib/index.js", + "name": "engine.io-client", + "repository": { + "type": "git", + "url": "git+https://github.com/socketio/engine.io-client.git" + }, + "scripts": { + "test": "gulp test" + }, + "version": "3.4.1" +} diff --git a/node_modules/engine.io-parser/LICENSE b/node_modules/engine.io-parser/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Guillermo Rauch (@rauchg) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+ \ No newline at end of file diff --git a/node_modules/engine.io-parser/Readme.md b/node_modules/engine.io-parser/Readme.md @@ -0,0 +1,202 @@ + +# engine.io-parser + +[![Build Status](https://secure.travis-ci.org/socketio/engine.io-parser.svg?branch=master)](https://travis-ci.org/socketio/engine.io-parser) +[![NPM version](https://badge.fury.io/js/engine.io-parser.svg)](https://npmjs.com/package/engine.io-parser) + +This is the JavaScript parser for the engine.io protocol encoding, +shared by both +[engine.io-client](https://github.com/socketio/engine.io-client) and +[engine.io](https://github.com/socketio/engine.io). + +## How to use + +### Standalone + +The parser can encode/decode packets, payloads, and payloads as binary +with the following methods: `encodePacket`, `decodePacket`, `encodePayload`, +`decodePayload`, `encodePayloadAsBinary`, `decodePayloadAsBinary`. + +The browser-side parser also includes `encodePayloadAsArrayBuffer` and `encodePayloadAsBlob`. + +Example: + +```js +var parser = require('engine.io-parser'); + +var data = new Buffer(5); +for (var i = 0; i < data.length; i++) { data[i] = i; } + +parser.encodePacket({ type: 'message', data: data }, function(encoded) { + var decodedData = parser.decodePacket(encoded); // { type: 'message', data: data } +}); +``` + +### With browserify + +Engine.IO Parser is a commonjs module, which means you can include it by using +`require` on the browser and package using [browserify](http://browserify.org/): + +1. install the parser package + + ```shell + npm install engine.io-parser + ``` + +1. write your app code + + ```js + var parser = require('engine.io-parser'); + + var testBuffer = new Int8Array(10); + for (var i = 0; i < testBuffer.length; i++) testBuffer[i] = i; + + var packets = [{ type: 'message', data: testBuffer.buffer }, { type: 'message', data: 'hello' }]; + + parser.encodePayload(packets, function(encoded) { + parser.decodePayload(encoded, + function(packet, index, total) { + var isLast = index + 1 == total; + if (!isLast) { + var buffer = new Int8Array(packet.data); // testBuffer + } else { + var message = packet.data; // 'hello' + } + }); + }); + ``` + +1. build your app bundle + + ```bash + $ browserify app.js > bundle.js + ``` + +1. include on your page + + ```html + <script src="/path/to/bundle.js"></script> + ``` + +## Features + +- Runs on browser and node.js seamlessly +- Runs inside HTML5 WebWorker +- Can encode and decode packets + - Encodes from/to ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer in Node + +## API + +Note: `cb(type)` means the type is a callback function that contains a parameter of type `type` when called. + +### Node + +- `encodePacket` + - Encodes a packet. + - **Parameters** + - `Object`: the packet to encode, has `type` and `data`. + - `data`: can be a `String`, `Number`, `Buffer`, `ArrayBuffer` + - `Boolean`: optional, binary support + - `Function`: callback, returns the encoded packet (`cb(String)`) +- `decodePacket` + - Decodes a packet. Data also available as an ArrayBuffer if requested. + - Returns data as `String` or (`Blob` on browser, `ArrayBuffer` on Node) + - **Parameters** + - `String` | `ArrayBuffer`: the packet to decode, has `type` and `data` + - `String`: optional, the binary type + +- `encodeBase64Packet` + - Encodes a packet with binary data in a base64 string (`String`) + - **Parameters** + - `Object`: the packet to encode, has `type` and `data` + - `Function`: callback, returns the base64 encoded message (`cb(String)`) +- `decodeBase64Packet` + - Decodes a packet encoded in a base64 string. + - **Parameters** + - `String`: the base64 encoded message + - `String`: optional, the binary type + +- `encodePayload` + - Encodes multiple messages (payload). + - If any contents are binary, they will be encoded as base64 strings. Base64 + encoded strings are marked with a b before the length specifier + - **Parameters** + - `Array`: an array of packets + - `Boolean`: optional, binary support + - `Function`: callback, returns the encoded payload (`cb(String)`) +- `decodePayload` + - Decodes data when a payload is maybe expected. Possible binary contents are + decoded from their base64 representation. + - **Parameters** + - `String`: the payload + - `String`: optional, the binary type + - `Function`: callback, returns (cb(`Object`: packet, `Number`:packet index, `Number`:packet total)) + +- `encodePayloadAsBinary` + - Encodes multiple messages (payload) as binary. + - **Parameters** + - `Array`: an array of packets + - `Function`: callback, returns the encoded payload (`cb(Buffer)`) +- `decodePayloadAsBinary` + - Decodes data when a payload is maybe expected. Strings are decoded by + interpreting each byte as a key code for entries marked to start with 0. See + description of encodePayloadAsBinary. + - **Parameters** + - `Buffer`: the buffer + - `String`: optional, the binary type + - `Function`: callback, returns the decoded packet (`cb(Object)`) + +### Browser + +- `encodePayloadAsArrayBuffer` + - Encodes multiple messages (payload) as binary. + - **Parameters** + - `Array`: an array of packets + - `Function`: callback, returns the encoded payload (`cb(ArrayBuffer)`) +- `encodePayloadAsBlob` + - Encodes multiple messages (payload) as blob. + - **Parameters** + - `Array`: an array of packets + - `Function`: callback, returns the encoded payload (`cb(Blob)`) + +## Tests + +Standalone tests can be run with `make test` which will run both node.js and browser tests. + +Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). +(You must have zuul setup with a saucelabs account.) + +You can run the tests locally using the following command: + +``` +./node_modules/.bin/zuul --local 8080 -- test/index.js +``` + +## Support + +The support channels for `engine.io-parser` are the same as `socket.io`: + - irc.freenode.net **#socket.io** + - [Google Groups](http://groups.google.com/group/socket_io) + - [Website](http://socket.io) + +## Development + +To contribute patches, run tests or benchmarks, make sure to clone the +repository: + +```bash +git clone git://github.com/LearnBoost/engine.io-parser.git +``` + +Then: + +```bash +cd engine.io-parser +npm install +``` + +See the `Tests` section above for how to run tests before submitting any patches. + +## License + +MIT diff --git a/node_modules/engine.io-parser/lib/browser.js b/node_modules/engine.io-parser/lib/browser.js @@ -0,0 +1,605 @@ +/** + * Module dependencies. + */ + +var keys = require('./keys'); +var hasBinary = require('has-binary2'); +var sliceBuffer = require('arraybuffer.slice'); +var after = require('after'); +var utf8 = require('./utf8'); + +var base64encoder; +if (typeof ArrayBuffer !== 'undefined') { + base64encoder = require('base64-arraybuffer'); +} + +/** + * Check if we are running an android browser. That requires us to use + * ArrayBuffer with polling transports... + * + * http://ghinda.net/jpeg-blob-ajax-android/ + */ + +var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); + +/** + * Check if we are running in PhantomJS. + * Uploading a Blob with PhantomJS does not work correctly, as reported here: + * https://github.com/ariya/phantomjs/issues/11395 + * @type boolean + */ +var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); + +/** + * When true, avoids using Blobs to encode payloads. + * @type boolean + */ +var dontSendBlobs = isAndroid || isPhantomJS; + +/** + * Current protocol version. + */ + +exports.protocol = 3; + +/** + * Packet types. + */ + +var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 +}; + +var packetslist = keys(packets); + +/** + * Premade error packet. + */ + +var err = { type: 'error', data: 'parser error' }; + +/** + * Create a blob api even for blob builder when vendor prefixes exist + */ + +var Blob = require('blob'); + +/** + * Encodes a packet. + * + * <packet type id> [ <data> ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + +exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = false; + } + + if (typeof utf8encode === 'function') { + callback = utf8encode; + utf8encode = null; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } else if (typeof Blob !== 'undefined' && data instanceof Blob) { + return encodeBlob(packet, supportsBinary, callback); + } + + // might be an object with { base64: true, data: dataAsBase64String } + if (data && data.base64) { + return encodeBase64Object(packet, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); + } + + return callback('' + encoded); + +}; + +function encodeBase64Object(packet, callback) { + // packet data is an object { base64: true, data: dataAsBase64String } + var message = 'b' + exports.packets[packet.type] + packet.data.data; + return callback(message); +} + +/** + * Encode packet helpers for binary types + */ + +function encodeArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var contentArray = new Uint8Array(data); + var resultBuffer = new Uint8Array(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++) { + resultBuffer[i+1] = contentArray[i]; + } + + return callback(resultBuffer.buffer); +} + +function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var fr = new FileReader(); + fr.onload = function() { + exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback); + }; + return fr.readAsArrayBuffer(packet.data); +} + +function encodeBlob(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + if (dontSendBlobs) { + return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); + } + + var length = new Uint8Array(1); + length[0] = packets[packet.type]; + var blob = new Blob([length.buffer, packet.data]); + + return callback(blob); +} + +/** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + +exports.encodeBase64Packet = function(packet, callback) { + var message = 'b' + exports.packets[packet.type]; + if (typeof Blob !== 'undefined' && packet.data instanceof Blob) { + var fr = new FileReader(); + fr.onload = function() { + var b64 = fr.result.split(',')[1]; + callback(message + b64); + }; + return fr.readAsDataURL(packet.data); + } + + var b64data; + try { + b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); + } catch (e) { + // iPhone Safari doesn't let you apply with typed arrays + var typed = new Uint8Array(packet.data); + var basic = new Array(typed.length); + for (var i = 0; i < typed.length; i++) { + basic[i] = typed[i]; + } + b64data = String.fromCharCode.apply(null, basic); + } + message += btoa(b64data); + return callback(message); +}; + +/** + * Decodes a packet. Changes format to Blob if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + +exports.decodePacket = function (data, binaryType, utf8decode) { + if (data === undefined) { + return err; + } + // String data + if (typeof data === 'string') { + if (data.charAt(0) === 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + if (utf8decode) { + data = tryDecode(data); + if (data === false) { + return err; + } + } + var type = data.charAt(0); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + var asArray = new Uint8Array(data); + var type = asArray[0]; + var rest = sliceBuffer(data, 1); + if (Blob && binaryType === 'blob') { + rest = new Blob([rest]); + } + return { type: packetslist[type], data: rest }; +}; + +function tryDecode(data) { + try { + data = utf8.decode(data, { strict: false }); + } catch (e) { + return false; + } + return data; +} + +/** + * Decodes a packet encoded in a base64 string + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + +exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + if (!base64encoder) { + return { type: type, data: { base64: true, data: msg.substr(1) } }; + } + + var data = base64encoder.decode(msg.substr(1)); + + if (binaryType === 'blob' && Blob) { + data = new Blob([data]); + } + + return { type: type, data: data }; +}; + +/** + * Encodes multiple messages (payload). + * + * <length>:data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + +exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + var isBinary = hasBinary(packets); + + if (supportsBinary && isBinary) { + if (Blob && !dontSendBlobs) { + return exports.encodePayloadAsBlob(packets, callback); + } + + return exports.encodePayloadAsArrayBuffer(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); +}; + +/** + * Async array map using after + */ + +function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } +} + +/* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + +exports.decodePayload = function (data, binaryType, callback) { + if (typeof data !== 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data === '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '', n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (chr !== ':') { + length += chr; + continue; + } + + if (length === '' || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType, false); + + if (err.type === packet.type && err.data === packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + + if (length !== '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + +}; + +/** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number + * 255><data> + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {ArrayBuffer} encoded payload + * @api private + */ + +exports.encodePayloadAsArrayBuffer = function(packets, callback) { + if (!packets.length) { + return callback(new ArrayBuffer(0)); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(data) { + return doneCallback(null, data); + }); + } + + map(packets, encodeOne, function(err, encodedPackets) { + var totalLength = encodedPackets.reduce(function(acc, p) { + var len; + if (typeof p === 'string'){ + len = p.length; + } else { + len = p.byteLength; + } + return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 + }, 0); + + var resultArray = new Uint8Array(totalLength); + + var bufferIndex = 0; + encodedPackets.forEach(function(p) { + var isString = typeof p === 'string'; + var ab = p; + if (isString) { + var view = new Uint8Array(p.length); + for (var i = 0; i < p.length; i++) { + view[i] = p.charCodeAt(i); + } + ab = view.buffer; + } + + if (isString) { // not true binary + resultArray[bufferIndex++] = 0; + } else { // true binary + resultArray[bufferIndex++] = 1; + } + + var lenStr = ab.byteLength.toString(); + for (var i = 0; i < lenStr.length; i++) { + resultArray[bufferIndex++] = parseInt(lenStr[i]); + } + resultArray[bufferIndex++] = 255; + + var view = new Uint8Array(ab); + for (var i = 0; i < view.length; i++) { + resultArray[bufferIndex++] = view[i]; + } + }); + + return callback(resultArray.buffer); + }); +}; + +/** + * Encode as Blob + */ + +exports.encodePayloadAsBlob = function(packets, callback) { + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(encoded) { + var binaryIdentifier = new Uint8Array(1); + binaryIdentifier[0] = 1; + if (typeof encoded === 'string') { + var view = new Uint8Array(encoded.length); + for (var i = 0; i < encoded.length; i++) { + view[i] = encoded.charCodeAt(i); + } + encoded = view.buffer; + binaryIdentifier[0] = 0; + } + + var len = (encoded instanceof ArrayBuffer) + ? encoded.byteLength + : encoded.size; + + var lenStr = len.toString(); + var lengthAry = new Uint8Array(lenStr.length + 1); + for (var i = 0; i < lenStr.length; i++) { + lengthAry[i] = parseInt(lenStr[i]); + } + lengthAry[lenStr.length] = 255; + + if (Blob) { + var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); + doneCallback(null, blob); + } + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(new Blob(results)); + }); +}; + +/* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + * + * @param {ArrayBuffer} data, callback method + * @api public + */ + +exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.byteLength > 0) { + var tailArray = new Uint8Array(bufferTail); + var isString = tailArray[0] === 0; + var msgLength = ''; + + for (var i = 1; ; i++) { + if (tailArray[i] === 255) break; + + // 310 = char length of Number.MAX_VALUE + if (msgLength.length > 310) { + return callback(err, 0, 1); + } + + msgLength += tailArray[i]; + } + + bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); + msgLength = parseInt(msgLength); + + var msg = sliceBuffer(bufferTail, 0, msgLength); + if (isString) { + try { + msg = String.fromCharCode.apply(null, new Uint8Array(msg)); + } catch (e) { + // iPhone Safari doesn't let you apply to typed arrays + var typed = new Uint8Array(msg); + msg = ''; + for (var i = 0; i < typed.length; i++) { + msg += String.fromCharCode(typed[i]); + } + } + } + + buffers.push(msg); + bufferTail = sliceBuffer(bufferTail, msgLength); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType, true), i, total); + }); +}; diff --git a/node_modules/engine.io-parser/lib/index.js b/node_modules/engine.io-parser/lib/index.js @@ -0,0 +1,473 @@ +/** + * Module dependencies. + */ + +var utf8 = require('./utf8'); +var hasBinary = require('has-binary2'); +var after = require('after'); +var keys = require('./keys'); + +/** + * Current protocol version. + */ +exports.protocol = 3; + +/** + * Packet types. + */ + +var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 +}; + +var packetslist = keys(packets); + +/** + * Premade error packet. + */ + +var err = { type: 'error', data: 'parser error' }; + +const EMPTY_BUFFER = Buffer.concat([]); + +/** + * Encodes a packet. + * + * <packet type id> [ <data> ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + +exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + if (typeof utf8encode === 'function') { + callback = utf8encode; + utf8encode = null; + } + + if (Buffer.isBuffer(packet.data)) { + return encodeBuffer(packet, supportsBinary, callback); + } else if (packet.data && (packet.data.buffer || packet.data) instanceof ArrayBuffer) { + return encodeBuffer({ type: packet.type, data: arrayBufferToBuffer(packet.data) }, supportsBinary, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); + } + + return callback('' + encoded); +}; + +/** + * Encode Buffer data + */ + +function encodeBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var typeBuffer = Buffer.allocUnsafe(1); + typeBuffer[0] = packets[packet.type]; + return callback(Buffer.concat([typeBuffer, data])); +} + +/** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + +exports.encodeBase64Packet = function(packet, callback){ + var data = Buffer.isBuffer(packet.data) ? packet.data : arrayBufferToBuffer(packet.data); + var message = 'b' + packets[packet.type]; + message += data.toString('base64'); + return callback(message); +}; + +/** + * Decodes a packet. Data also available as an ArrayBuffer if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + +exports.decodePacket = function (data, binaryType, utf8decode) { + if (data === undefined) { + return err; + } + + var type; + + // String data + if (typeof data === 'string') { + + type = data.charAt(0); + + if (type === 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + if (utf8decode) { + data = tryDecode(data); + if (data === false) { + return err; + } + } + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + // Binary data + if (binaryType === 'arraybuffer') { + // wrap Buffer/ArrayBuffer data into an Uint8Array + var intArray = new Uint8Array(data); + type = intArray[0]; + return { type: packetslist[type], data: intArray.buffer.slice(1) }; + } + + if (data instanceof ArrayBuffer) { + data = arrayBufferToBuffer(data); + } + type = data[0]; + return { type: packetslist[type], data: data.slice(1) }; +}; + +function tryDecode(data) { + try { + data = utf8.decode(data, { strict: false }); + } catch (e) { + return false; + } + return data; +} + +/** + * Decodes a packet encoded in a base64 string. + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + +exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + var data = Buffer.from(msg.substr(1), 'base64'); + if (binaryType === 'arraybuffer') { + var abv = new Uint8Array(data.length); + for (var i = 0; i < abv.length; i++){ + abv[i] = data[i]; + } + data = abv.buffer; + } + return { type: type, data: data }; +}; + +/** + * Encodes multiple messages (payload). + * + * <length>:data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + +exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + if (supportsBinary && hasBinary(packets)) { + return exports.encodePayloadAsBinary(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, supportsBinary, false, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); +}; + +function setLengthHeader(message) { + return message.length + ':' + message; +} + +/** + * Async array map using after + */ + +function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + for (var i = 0; i < ary.length; i++) { + each(ary[i], function(error, msg) { + result[i] = msg; + next(error, result); + }); + } +} + +/* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + +exports.decodePayload = function (data, binaryType, callback) { + if (typeof data !== 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + if (data === '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '', n, msg, packet; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (chr !== ':') { + length += chr; + continue; + } + + if (length === '' || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType, false); + + if (err.type === packet.type && err.data === packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var more = callback(packet, i + n, l); + if (false === more) return; + } + + // advance cursor + i += n; + length = ''; + } + + if (length !== '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + +}; + +/** + * + * Converts a buffer to a utf8.js encoded string + * + * @api private + */ + +function bufferToString(buffer) { + var str = ''; + for (var i = 0, l = buffer.length; i < l; i++) { + str += String.fromCharCode(buffer[i]); + } + return str; +} + +/** + * + * Converts a utf8.js encoded string to a buffer + * + * @api private + */ + +function stringToBuffer(string) { + var buf = Buffer.allocUnsafe(string.length); + for (var i = 0, l = string.length; i < l; i++) { + buf.writeUInt8(string.charCodeAt(i), i); + } + return buf; +} + +/** + * + * Converts an ArrayBuffer to a Buffer + * + * @api private + */ + +function arrayBufferToBuffer(data) { + // data is either an ArrayBuffer or ArrayBufferView. + var length = data.byteLength || data.length; + var offset = data.byteOffset || 0; + + return Buffer.from(data.buffer || data, offset, length); +} + +/** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number + * 255><data> + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {Buffer} encoded payload + * @api private + */ + +exports.encodePayloadAsBinary = function (packets, callback) { + if (!packets.length) { + return callback(EMPTY_BUFFER); + } + + map(packets, encodeOneBinaryPacket, function(err, results) { + return callback(Buffer.concat(results)); + }); +}; + +function encodeOneBinaryPacket(p, doneCallback) { + + function onBinaryPacketEncode(packet) { + + var encodingLength = '' + packet.length; + var sizeBuffer; + + if (typeof packet === 'string') { + sizeBuffer = Buffer.allocUnsafe(encodingLength.length + 2); + sizeBuffer[0] = 0; // is a string (not true binary = 0) + for (var i = 0; i < encodingLength.length; i++) { + sizeBuffer[i + 1] = parseInt(encodingLength[i], 10); + } + sizeBuffer[sizeBuffer.length - 1] = 255; + return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)])); + } + + sizeBuffer = Buffer.allocUnsafe(encodingLength.length + 2); + sizeBuffer[0] = 1; // is binary (true binary = 1) + for (var i = 0; i < encodingLength.length; i++) { + sizeBuffer[i + 1] = parseInt(encodingLength[i], 10); + } + sizeBuffer[sizeBuffer.length - 1] = 255; + + doneCallback(null, Buffer.concat([sizeBuffer, packet])); + } + + exports.encodePacket(p, true, true, onBinaryPacketEncode); + +} + + +/* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + + * @param {Buffer} data, callback method + * @api public + */ + +exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + var i; + + while (bufferTail.length > 0) { + var strLen = ''; + var isString = bufferTail[0] === 0; + for (i = 1; ; i++) { + if (bufferTail[i] === 255) break; + // 310 = char length of Number.MAX_VALUE + if (strLen.length > 310) { + return callback(err, 0, 1); + } + strLen += '' + bufferTail[i]; + } + bufferTail = bufferTail.slice(strLen.length + 1); + + var msgLength = parseInt(strLen, 10); + + var msg = bufferTail.slice(1, msgLength + 1); + if (isString) msg = bufferToString(msg); + buffers.push(msg); + bufferTail = bufferTail.slice(msgLength + 1); + } + + var total = buffers.length; + for (i = 0; i < total; i++) { + var buffer = buffers[i]; + callback(exports.decodePacket(buffer, binaryType, true), i, total); + } +}; diff --git a/node_modules/engine.io-parser/lib/keys.js b/node_modules/engine.io-parser/lib/keys.js @@ -0,0 +1,19 @@ + +/** + * Gets the keys for an object. + * + * @return {Array} keys + * @api private + */ + +module.exports = Object.keys || function keys (obj){ + var arr = []; + var has = Object.prototype.hasOwnProperty; + + for (var i in obj) { + if (has.call(obj, i)) { + arr.push(i); + } + } + return arr; +}; diff --git a/node_modules/engine.io-parser/lib/utf8.js b/node_modules/engine.io-parser/lib/utf8.js @@ -0,0 +1,210 @@ +/*! https://mths.be/utf8js v2.1.2 by @mathias */ + +var stringFromCharCode = String.fromCharCode; + +// Taken from https://mths.be/punycode +function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; +} + +// Taken from https://mths.be/punycode +function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; +} + +function checkScalarValue(codePoint, strict) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + if (strict) { + throw Error( + 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() + + ' is not a scalar value' + ); + } + return false; + } + return true; +} +/*--------------------------------------------------------------------------*/ + +function createByte(codePoint, shift) { + return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); +} + +function encodeCodePoint(codePoint, strict) { + if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence + symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); + } + else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence + if (!checkScalarValue(codePoint, strict)) { + codePoint = 0xFFFD; + } + symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); + symbol += createByte(codePoint, 6); + } + else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence + symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); + return symbol; +} + +function utf8encode(string, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint, strict); + } + return byteString; +} + +/*--------------------------------------------------------------------------*/ + +function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } + + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; + + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); +} + +function decodeSymbol(strict) { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; + + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } + + if (byteIndex == byteCount) { + return false; + } + + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; + + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } + + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + byte2 = readContinuationByte(); + codePoint = ((byte1 & 0x1F) << 6) | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; + if (codePoint >= 0x0800) { + return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) | + (byte3 << 0x06) | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); +} + +var byteArray; +var byteCount; +var byteIndex; +function utf8decode(byteString, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol(strict)) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); +} + +module.exports = { + version: '2.1.2', + encode: utf8encode, + decode: utf8decode +}; diff --git a/node_modules/engine.io-parser/package.json b/node_modules/engine.io-parser/package.json @@ -0,0 +1,63 @@ +{ + "_from": "engine.io-parser@~2.2.0", + "_id": "engine.io-parser@2.2.0", + "_inBundle": false, + "_integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==", + "_location": "/engine.io-parser", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "engine.io-parser@~2.2.0", + "name": "engine.io-parser", + "escapedName": "engine.io-parser", + "rawSpec": "~2.2.0", + "saveSpec": null, + "fetchSpec": "~2.2.0" + }, + "_requiredBy": [ + "/engine.io", + "/engine.io-client" + ], + "_resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz", + "_shasum": "312c4894f57d52a02b420868da7b5c1c84af80ed", + "_spec": "engine.io-parser@~2.2.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io", + "browser": "./lib/browser.js", + "bugs": { + "url": "https://github.com/socketio/engine.io-parser/issues" + }, + "bundleDependencies": false, + "dependencies": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + }, + "deprecated": false, + "description": "Parser for the client for the realtime Engine", + "devDependencies": { + "benchmark": "^2.1.4", + "expect.js": "0.3.1", + "mocha": "^5.2.0", + "socket.io-browsers": "^1.0.2", + "zuul": "3.11.1", + "zuul-ngrok": "4.0.0" + }, + "files": [ + "lib/" + ], + "homepage": "https://github.com/socketio/engine.io-parser", + "license": "MIT", + "main": "lib/index.js", + "name": "engine.io-parser", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/socketio/engine.io-parser.git" + }, + "scripts": { + "test": "make test" + }, + "version": "2.2.0" +} diff --git a/node_modules/engine.io/CHANGELOG.md b/node_modules/engine.io/CHANGELOG.md @@ -0,0 +1,10 @@ +## [3.4.1](https://github.com/socketio/engine.io/compare/3.4.0...3.4.1) (2020-04-17) + + +### Bug Fixes + +* ignore errors when forcefully closing the socket ([da851ec](https://github.com/socketio/engine.io/commit/da851ec4ec89d96df2ee5c711f328b5d795423e9)) +* use SameSite=Strict by default ([001ca62](https://github.com/socketio/engine.io/commit/001ca62cc4a8f511f3b2fbd9e4493ad274a6a0e5)) + + + diff --git a/node_modules/engine.io/LICENSE b/node_modules/engine.io/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch <guillermo@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/engine.io/README.md b/node_modules/engine.io/README.md @@ -0,0 +1,564 @@ + +# Engine.IO: the realtime engine + +[![Build Status](https://travis-ci.org/socketio/engine.io.svg?branch=master)](http://travis-ci.org/socketio/engine.io) +[![NPM version](https://badge.fury.io/js/engine.io.svg)](http://badge.fury.io/js/engine.io) + +`Engine.IO` is the implementation of transport-based +cross-browser/cross-device bi-directional communication layer for +[Socket.IO](http://github.com/socketio/socket.io). + +## How to use + +### Server + +#### (A) Listening on a port + +```js +var engine = require('engine.io'); +var server = engine.listen(80); + +server.on('connection', function(socket){ + socket.send('utf 8 string'); + socket.send(Buffer.from([0, 1, 2, 3, 4, 5])); // binary data +}); +``` + +#### (B) Intercepting requests for a http.Server + +```js +var engine = require('engine.io'); +var http = require('http').createServer().listen(3000); +var server = engine.attach(http); + +server.on('connection', function (socket) { + socket.on('message', function(data){ }); + socket.on('close', function(){ }); +}); +``` + +#### (C) Passing in requests + +```js +var engine = require('engine.io'); +var server = new engine.Server(); + +server.on('connection', function(socket){ + socket.send('hi'); +}); + +// … +httpServer.on('upgrade', function(req, socket, head){ + server.handleUpgrade(req, socket, head); +}); +httpServer.on('request', function(req, res){ + server.handleRequest(req, res); +}); +``` + +### Client + +```html +<script src="/path/to/engine.io.js"></script> +<script> + var socket = new eio.Socket('ws://localhost/'); + socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); + }); +</script> +``` + +For more information on the client refer to the +[engine-client](http://github.com/learnboost/engine.io-client) repository. + +## What features does it have? + +- **Maximum reliability**. Connections are established even in the presence of: + - proxies and load balancers. + - personal firewall and antivirus software. + - for more information refer to **Goals** and **Architecture** sections +- **Minimal client size** aided by: + - lazy loading of flash transports. + - lack of redundant transports. +- **Scalable** + - load balancer friendly +- **Future proof** +- **100% Node.JS core style** + - No API sugar (left for higher level projects) + - Written in readable vanilla JavaScript + +## API + +### Server + +<hr><br> + +#### Top-level + +These are exposed by `require('engine.io')`: + +##### Events + +- `flush` + - Called when a socket buffer is being flushed. + - **Arguments** + - `Socket`: socket being flushed + - `Array`: write buffer +- `drain` + - Called when a socket buffer is drained + - **Arguments** + - `Socket`: socket being flushed + +##### Properties + +- `protocol` _(Number)_: protocol revision number +- `Server`: Server class constructor +- `Socket`: Socket class constructor +- `Transport` _(Function)_: transport constructor +- `transports` _(Object)_: map of available transports + +##### Methods + +- `()` + - Returns a new `Server` instance. If the first argument is an `http.Server` then the + new `Server` instance will be attached to it. Otherwise, the arguments are passed + directly to the `Server` constructor. + - **Parameters** + - `http.Server`: optional, server to attach to. + - `Object`: optional, options object (see `Server#constructor` api docs below) + + The following are identical ways to instantiate a server and then attach it. + +```js +var httpServer; // previously created with `http.createServer();` from node.js api. + +// create a server first, and then attach +var eioServer = require('engine.io').Server(); +eioServer.attach(httpServer); + +// or call the module as a function to get `Server` +var eioServer = require('engine.io')(); +eioServer.attach(httpServer); + +// immediately attach +var eioServer = require('engine.io')(httpServer); + +// with custom options +var eioServer = require('engine.io')(httpServer, { + maxHttpBufferSize: 1e3 +}); +``` + +- `listen` + - Creates an `http.Server` which listens on the given port and attaches WS + to it. It returns `501 Not Implemented` for regular http requests. + - **Parameters** + - `Number`: port to listen on. + - `Object`: optional, options object + - `Function`: callback for `listen`. + - **Options** + - All options from `Server.attach` method, documented below. + - **Additionally** See Server `constructor` below for options you can pass for creating the new Server + - **Returns** `Server` + +```js +var engine = require('engine.io'); +var server = engine.listen(3000, { + pingTimeout: 2000, + pingInterval: 10000 +}); + +server.on('connection', /* ... */); +``` + +- `attach` + - Captures `upgrade` requests for a `http.Server`. In other words, makes + a regular http.Server WebSocket-compatible. + - **Parameters** + - `http.Server`: server to attach to. + - `Object`: optional, options object + - **Options** + - All options from `Server.attach` method, documented below. + - **Additionally** See Server `constructor` below for options you can pass for creating the new Server + - **Returns** `Server` a new Server instance. + +```js +var engine = require('engine.io'); +var httpServer = require('http').createServer().listen(3000); +var server = engine.attach(httpServer, { + wsEngine: 'uws' // requires having uws as dependency +}); + +server.on('connection', /* ... */); +``` + +#### Server + +The main server/manager. _Inherits from EventEmitter_. + +##### Events + +- `connection` + - Fired when a new connection is established. + - **Arguments** + - `Socket`: a Socket object + +##### Properties + +**Important**: if you plan to use Engine.IO in a scalable way, please +keep in mind the properties below will only reflect the clients connected +to a single process. + +- `clients` _(Object)_: hash of connected clients by id. +- `clientsCount` _(Number)_: number of connected clients. + +##### Methods + +- **constructor** + - Initializes the server + - **Parameters** + - `Object`: optional, options object + - **Options** + - `pingTimeout` (`Number`): how many ms without a pong packet to + consider the connection closed (`5000`) + - `pingInterval` (`Number`): how many ms before sending a new ping + packet (`25000`) + - `upgradeTimeout` (`Number`): how many ms before an uncompleted transport upgrade is cancelled (`10000`) + - `maxHttpBufferSize` (`Number`): how many bytes or characters a message + can be, before closing the session (to avoid DoS). Default + value is `10E7`. + - `allowRequest` (`Function`): A function that receives a given handshake + or upgrade request as its first parameter, and can decide whether to + continue or not. The second argument is a function that needs to be + called with the decided information: `fn(err, success)`, where + `success` is a boolean value where false means that the request is + rejected, and err is an error code. + - `transports` (`<Array> String`): transports to allow connections + to (`['polling', 'websocket']`) + - `allowUpgrades` (`Boolean`): whether to allow transport upgrades + (`true`) + - `perMessageDeflate` (`Object|Boolean`): parameters of the WebSocket permessage-deflate extension + (see [ws module](https://github.com/einaros/ws) api docs). Set to `false` to disable. (`true`) + - `threshold` (`Number`): data is compressed only if the byte size is above this value (`1024`) + - `httpCompression` (`Object|Boolean`): parameters of the http compression for the polling transports + (see [zlib](http://nodejs.org/api/zlib.html#zlib_options) api docs). Set to `false` to disable. (`true`) + - `threshold` (`Number`): data is compressed only if the byte size is above this value (`1024`) + - `cookie` (`String|Boolean`): name of the HTTP cookie that + contains the client sid to send as part of handshake response + headers. Set to `false` to not send one. (`io`) + - `cookiePath` (`String|Boolean`): path of the above `cookie` + option. If false, no path will be sent, which means browsers will only send the cookie on the engine.io attached path (`/engine.io`). + Set false to not save io cookie on all requests. (`/`) + - `cookieHttpOnly` (`Boolean`): If `true` HttpOnly io cookie cannot be accessed by client-side APIs, such as JavaScript. (`true`) _This option has no effect if `cookie` or `cookiePath` is set to `false`._ + - `wsEngine` (`String`): what WebSocket server implementation to use. Specified module must conform to the `ws` interface (see [ws module api docs](https://github.com/websockets/ws/blob/master/doc/ws.md)). Default value is `ws`. An alternative c++ addon is also available by installing `uws` module. + - `initialPacket` (`Object`): an optional packet which will be concatenated to the handshake packet emitted by Engine.IO. +- `close` + - Closes all clients + - **Returns** `Server` for chaining +- `handleRequest` + - Called internally when a `Engine` request is intercepted. + - **Parameters** + - `http.IncomingMessage`: a node request object + - `http.ServerResponse`: a node response object + - **Returns** `Server` for chaining +- `handleUpgrade` + - Called internally when a `Engine` ws upgrade is intercepted. + - **Parameters** (same as `upgrade` event) + - `http.IncomingMessage`: a node request object + - `net.Stream`: TCP socket for the request + - `Buffer`: legacy tail bytes + - **Returns** `Server` for chaining +- `attach` + - Attach this Server instance to an `http.Server` + - Captures `upgrade` requests for a `http.Server`. In other words, makes + a regular http.Server WebSocket-compatible. + - **Parameters** + - `http.Server`: server to attach to. + - `Object`: optional, options object + - **Options** + - `path` (`String`): name of the path to capture (`/engine.io`). + - `destroyUpgrade` (`Boolean`): destroy unhandled upgrade requests (`true`) + - `destroyUpgradeTimeout` (`Number`): milliseconds after which unhandled requests are ended (`1000`) + - `handlePreflightRequest` (`Boolean|Function`): whether to let engine.io handle the OPTIONS requests. You can also pass a custom function to handle the requests (`true`) +- `generateId` + - Generate a socket id. + - Overwrite this method to generate your custom socket id. + - **Parameters** + - `http.IncomingMessage`: a node request object + - **Returns** A socket id for connected client. + +<hr><br> + +#### Socket + +A representation of a client. _Inherits from EventEmitter_. + +##### Events + +- `close` + - Fired when the client is disconnected. + - **Arguments** + - `String`: reason for closing + - `Object`: description object (optional) +- `message` + - Fired when the client sends a message. + - **Arguments** + - `String` or `Buffer`: Unicode string or Buffer with binary contents +- `error` + - Fired when an error occurs. + - **Arguments** + - `Error`: error object +- `flush` + - Called when the write buffer is being flushed. + - **Arguments** + - `Array`: write buffer +- `drain` + - Called when the write buffer is drained +- `packet` + - Called when a socket received a packet (`message`, `ping`) + - **Arguments** + - `type`: packet type + - `data`: packet data (if type is message) +- `packetCreate` + - Called before a socket sends a packet (`message`, `pong`) + - **Arguments** + - `type`: packet type + - `data`: packet data (if type is message) + +##### Properties + +- `id` _(String)_: unique identifier +- `server` _(Server)_: engine parent reference +- `request` _(http.IncomingMessage)_: request that originated the Socket +- `upgraded` _(Boolean)_: whether the transport has been upgraded +- `readyState` _(String)_: opening|open|closing|closed +- `transport` _(Transport)_: transport reference + +##### Methods + +- `send`: + - Sends a message, performing `message = toString(arguments[0])` unless + sending binary data, which is sent as is. + - **Parameters** + - `String` | `Buffer` | `ArrayBuffer` | `ArrayBufferView`: a string or any object implementing `toString()`, with outgoing data, or a Buffer or ArrayBuffer with binary data. Also any ArrayBufferView can be sent as is. + - `Object`: optional, options object + - `Function`: optional, a callback executed when the message gets flushed out by the transport + - **Options** + - `compress` (`Boolean`): whether to compress sending data. This option might be ignored and forced to be `true` when using polling. (`true`) + - **Returns** `Socket` for chaining +- `close` + - Disconnects the client + - **Returns** `Socket` for chaining + +### Client + +<hr><br> + +Exposed in the `eio` global namespace (in the browser), or by +`require('engine.io-client')` (in Node.JS). + +For the client API refer to the +[engine-client](http://github.com/learnboost/engine.io-client) repository. + +## Debug / logging + +Engine.IO is powered by [debug](http://github.com/visionmedia/debug). +In order to see all the debug output, run your app with the environment variable +`DEBUG` including the desired scope. + +To see the output from all of Engine.IO's debugging scopes you can use: + +``` +DEBUG=engine* node myapp +``` + +## Transports + +- `polling`: XHR / JSONP polling transport. +- `websocket`: WebSocket transport. + +## Plugins + +- [engine.io-conflation](https://github.com/EugenDueck/engine.io-conflation): Makes **conflation and aggregation** of messages straightforward. + +## Support + +The support channels for `engine.io` are the same as `socket.io`: + - irc.freenode.net **#socket.io** + - [Google Groups](http://groups.google.com/group/socket_io) + - [Website](http://socket.io) + +## Development + +To contribute patches, run tests or benchmarks, make sure to clone the +repository: + +``` +git clone git://github.com/LearnBoost/engine.io.git +``` + +Then: + +``` +cd engine.io +npm install +``` + +## Tests + +Tests run with `npm test`. It runs the server tests that are aided by +the usage of `engine.io-client`. + +Make sure `npm install` is run first. + +## Goals + +The main goal of `Engine` is ensuring the most reliable realtime communication. +Unlike the previous Socket.IO core, it always establishes a long-polling +connection first, then tries to upgrade to better transports that are "tested" on +the side. + +During the lifetime of the Socket.IO projects, we've found countless drawbacks +to relying on `HTML5 WebSocket` or `Flash Socket` as the first connection +mechanisms. + +Both are clearly the _right way_ of establishing a bidirectional communication, +with HTML5 WebSocket being the way of the future. However, to answer most business +needs, alternative traditional HTTP 1.1 mechanisms are just as good as delivering +the same solution. + +WebSocket based connections have two fundamental benefits: + +1. **Better server performance** + - _A: Load balancers_<br> + Load balancing a long polling connection poses a serious architectural nightmare + since requests can come from any number of open sockets by the user agent, but + they all need to be routed to the process and computer that owns the `Engine` + connection. This negatively impacts RAM and CPU usage. + - _B: Network traffic_<br> + WebSocket is designed around the premise that each message frame has to be + surrounded by the least amount of data. In HTTP 1.1 transports, each message + frame is surrounded by HTTP headers and chunked encoding frames. If you try to + send the message _"Hello world"_ with xhr-polling, the message ultimately + becomes larger than if you were to send it with WebSocket. + - _C: Lightweight parser_<br> + As an effect of **B**, the server has to do a lot more work to parse the network + data and figure out the message when traditional HTTP requests are used + (as in long polling). This means that another advantage of WebSocket is + less server CPU usage. + +2. **Better user experience** + + Due to the reasons stated in point **1**, the most important effect of being able + to establish a WebSocket connection is raw data transfer speed, which translates + in _some_ cases in better user experience. + + Applications with heavy realtime interaction (such as games) will benefit greatly, + whereas applications like realtime chat (Gmail/Facebook), newsfeeds (Facebook) or + timelines (Twitter) will have negligible user experience improvements. + +Having said this, attempting to establish a WebSocket connection directly so far has +proven problematic: + +1. **Proxies**<br> + Many corporate proxies block WebSocket traffic. + +2. **Personal firewall and antivirus software**<br> + As a result of our research, we've found that at least 3 personal security + applications block WebSocket traffic. + +3. **Cloud application platforms**<br> + Platforms like Heroku or No.de have had trouble keeping up with the fast-paced + nature of the evolution of the WebSocket protocol. Applications therefore end up + inevitably using long polling, but the seamless installation experience of + Socket.IO we strive for (_"require() it and it just works"_) disappears. + +Some of these problems have solutions. In the case of proxies and personal programs, +however, the solutions many times involve upgrading software. Experience has shown +that relying on client software upgrades to deliver a business solution is +fruitless: the very existence of this project has to do with a fragmented panorama +of user agent distribution, with clients connecting with latest versions of the most +modern user agents (Chrome, Firefox and Safari), but others with versions as low as +IE 5.5. + +From the user perspective, an unsuccessful WebSocket connection can translate in +up to at least 10 seconds of waiting for the realtime application to begin +exchanging data. This **perceptively** hurts user experience. + +To summarize, **Engine** focuses on reliability and user experience first, marginal +potential UX improvements and increased server performance second. `Engine` is the +result of all the lessons learned with WebSocket in the wild. + +## Architecture + +The main premise of `Engine`, and the core of its existence, is the ability to +swap transports on the fly. A connection starts as xhr-polling, but it can +switch to WebSocket. + +The central problem this poses is: how do we switch transports without losing +messages? + +`Engine` only switches from polling to another transport in between polling +cycles. Since the server closes the connection after a certain timeout when +there's no activity, and the polling transport implementation buffers messages +in between connections, this ensures no message loss and optimal performance. + +Another benefit of this design is that we workaround almost all the limitations +of **Flash Socket**, such as slow connection times, increased file size (we can +safely lazy load it without hurting user experience), etc. + +## FAQ + +### Can I use engine without Socket.IO ? + +Absolutely. Although the recommended framework for building realtime applications +is Socket.IO, since it provides fundamental features for real-world applications +such as multiplexing, reconnection support, etc. + +`Engine` is to Socket.IO what Connect is to Express. An essential piece for building +realtime frameworks, but something you _probably_ won't be using for building +actual applications. + +### Does the server serve the client? + +No. The main reason is that `Engine` is meant to be bundled with frameworks. +Socket.IO includes `Engine`, therefore serving two clients is not necessary. If +you use Socket.IO, including + +```html +<script src="/socket.io/socket.io.js"> +``` + +has you covered. + +### Can I implement `Engine` in other languages? + +Absolutely. The [engine.io-protocol](https://github.com/LearnBoost/engine.io-protocol) +repository contains the most up to date description of the specification +at all times, and the parser implementation in JavaScript. + +## License + +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch &lt;guillermo@learnboost.com&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/engine.io/lib/engine.io.js b/node_modules/engine.io/lib/engine.io.js @@ -0,0 +1,126 @@ +/** + * Module dependencies. + */ + +var http = require('http'); + +/** + * Invoking the library as a function delegates to attach if the first argument + * is an `http.Server`. + * + * If there are no arguments or the first argument is an options object, then + * a new Server instance is returned. + * + * @param {http.Server} server (if specified, will be attached to by the new Server instance) + * @param {Object} options + * @return {Server} engine server + * @api public + */ + +exports = module.exports = function () { + // backwards compatible use as `.attach` + // if first argument is an http server + if (arguments.length && arguments[0] instanceof http.Server) { + return attach.apply(this, arguments); + } + + // if first argument is not an http server, then just make a regular eio server + return exports.Server.apply(null, arguments); +}; + +/** + * Protocol revision number. + * + * @api public + */ + +exports.protocol = 1; + +/** + * Expose Server constructor. + * + * @api public + */ + +exports.Server = require('./server'); + +/** + * Expose Socket constructor. + * + * @api public + */ + +exports.Socket = require('./socket'); + +/** + * Expose Transport constructor. + * + * @api public + */ + +exports.Transport = require('./transport'); + +/** + * Expose mutable list of available transports. + * + * @api public + */ + +exports.transports = require('./transports'); + +/** + * Exports parser. + * + * @api public + */ + +exports.parser = require('engine.io-parser'); + +/** + * Creates an http.Server exclusively used for WS upgrades. + * + * @param {Number} port + * @param {Function} callback + * @param {Object} options + * @return {Server} websocket.io server + * @api public + */ + +exports.listen = listen; + +function listen (port, options, fn) { + if ('function' === typeof options) { + fn = options; + options = {}; + } + + var server = http.createServer(function (req, res) { + res.writeHead(501); + res.end('Not Implemented'); + }); + + // create engine server + var engine = exports.attach(server, options); + engine.httpServer = server; + + server.listen(port, fn); + + return engine; +} + +/** + * Captures upgrade requests for a http.Server. + * + * @param {http.Server} server + * @param {Object} options + * @return {Server} engine server + * @api public + */ + +exports.attach = attach; + +function attach (server, options) { + var engine = new exports.Server(options); + engine.attach(server, options); + return engine; +} diff --git a/node_modules/engine.io/lib/server.js b/node_modules/engine.io/lib/server.js @@ -0,0 +1,591 @@ + +/** + * Module dependencies. + */ + +var qs = require('querystring'); +var parse = require('url').parse; +var base64id = require('base64id'); +var transports = require('./transports'); +var EventEmitter = require('events').EventEmitter; +var Socket = require('./socket'); +var util = require('util'); +var debug = require('debug')('engine'); +var cookieMod = require('cookie'); + +/** + * Module exports. + */ + +module.exports = Server; + +/** + * Server constructor. + * + * @param {Object} options + * @api public + */ + +function Server (opts) { + if (!(this instanceof Server)) { + return new Server(opts); + } + + this.clients = {}; + this.clientsCount = 0; + + opts = opts || {}; + + this.wsEngine = opts.wsEngine || process.env.EIO_WS_ENGINE || 'ws'; + this.pingTimeout = opts.pingTimeout || 5000; + this.pingInterval = opts.pingInterval || 25000; + this.upgradeTimeout = opts.upgradeTimeout || 10000; + this.maxHttpBufferSize = opts.maxHttpBufferSize || 10E7; + this.transports = opts.transports || Object.keys(transports); + this.allowUpgrades = false !== opts.allowUpgrades; + this.allowRequest = opts.allowRequest; + this.cookie = false !== opts.cookie ? (opts.cookie || 'io') : false; + this.cookiePath = false !== opts.cookiePath ? (opts.cookiePath || '/') : false; + this.cookieHttpOnly = false !== opts.cookieHttpOnly; + this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || true) : false; + this.httpCompression = false !== opts.httpCompression ? (opts.httpCompression || {}) : false; + this.initialPacket = opts.initialPacket; + + var self = this; + + // initialize compression options + ['perMessageDeflate', 'httpCompression'].forEach(function (type) { + var compression = self[type]; + if (true === compression) self[type] = compression = {}; + if (compression && null == compression.threshold) { + compression.threshold = 1024; + } + }); + + this.init(); +} + +/** + * Protocol errors mappings. + */ + +Server.errors = { + UNKNOWN_TRANSPORT: 0, + UNKNOWN_SID: 1, + BAD_HANDSHAKE_METHOD: 2, + BAD_REQUEST: 3, + FORBIDDEN: 4 +}; + +Server.errorMessages = { + 0: 'Transport unknown', + 1: 'Session ID unknown', + 2: 'Bad handshake method', + 3: 'Bad request', + 4: 'Forbidden' +}; + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Server, EventEmitter); + +/** + * Initialize websocket server + * + * @api private + */ + +Server.prototype.init = function () { + if (!~this.transports.indexOf('websocket')) return; + + if (this.ws) this.ws.close(); + + var wsModule; + switch (this.wsEngine) { + case 'uws': wsModule = require('uws'); break; + case 'ws': wsModule = require('ws'); break; + default: throw new Error('unknown wsEngine'); + } + this.ws = new wsModule.Server({ + noServer: true, + clientTracking: false, + perMessageDeflate: this.perMessageDeflate, + maxPayload: this.maxHttpBufferSize + }); +}; + +/** + * Returns a list of available transports for upgrade given a certain transport. + * + * @return {Array} + * @api public + */ + +Server.prototype.upgrades = function (transport) { + if (!this.allowUpgrades) return []; + return transports[transport].upgradesTo || []; +}; + +/** + * Verifies a request. + * + * @param {http.IncomingMessage} + * @return {Boolean} whether the request is valid + * @api private + */ + +Server.prototype.verify = function (req, upgrade, fn) { + // transport check + var transport = req._query.transport; + if (!~this.transports.indexOf(transport)) { + debug('unknown transport "%s"', transport); + return fn(Server.errors.UNKNOWN_TRANSPORT, false); + } + + // 'Origin' header check + var isOriginInvalid = checkInvalidHeaderChar(req.headers.origin); + if (isOriginInvalid) { + req.headers.origin = null; + debug('origin header invalid'); + return fn(Server.errors.BAD_REQUEST, false); + } + + // sid check + var sid = req._query.sid; + if (sid) { + if (!this.clients.hasOwnProperty(sid)) { + debug('unknown sid "%s"', sid); + return fn(Server.errors.UNKNOWN_SID, false); + } + if (!upgrade && this.clients[sid].transport.name !== transport) { + debug('bad request: unexpected transport without upgrade'); + return fn(Server.errors.BAD_REQUEST, false); + } + } else { + // handshake is GET only + if ('GET' !== req.method) return fn(Server.errors.BAD_HANDSHAKE_METHOD, false); + if (!this.allowRequest) return fn(null, true); + return this.allowRequest(req, fn); + } + + fn(null, true); +}; + +/** + * Prepares a request by processing the query string. + * + * @api private + */ + +Server.prototype.prepare = function (req) { + // try to leverage pre-existing `req._query` (e.g: from connect) + if (!req._query) { + req._query = ~req.url.indexOf('?') ? qs.parse(parse(req.url).query) : {}; + } +}; + +/** + * Closes all clients. + * + * @api public + */ + +Server.prototype.close = function () { + debug('closing all open clients'); + for (var i in this.clients) { + if (this.clients.hasOwnProperty(i)) { + this.clients[i].close(true); + } + } + if (this.ws) { + debug('closing webSocketServer'); + this.ws.close(); + // don't delete this.ws because it can be used again if the http server starts listening again + } + return this; +}; + +/** + * Handles an Engine.IO HTTP request. + * + * @param {http.IncomingMessage} request + * @param {http.ServerResponse|http.OutgoingMessage} response + * @api public + */ + +Server.prototype.handleRequest = function (req, res) { + debug('handling "%s" http request "%s"', req.method, req.url); + this.prepare(req); + req.res = res; + + var self = this; + this.verify(req, false, function (err, success) { + if (!success) { + sendErrorMessage(req, res, err); + return; + } + + if (req._query.sid) { + debug('setting new request for existing client'); + self.clients[req._query.sid].transport.onRequest(req); + } else { + self.handshake(req._query.transport, req); + } + }); +}; + +/** + * Sends an Engine.IO Error Message + * + * @param {http.ServerResponse} response + * @param {code} error code + * @api private + */ + +function sendErrorMessage (req, res, code) { + var headers = { 'Content-Type': 'application/json' }; + + var isForbidden = !Server.errorMessages.hasOwnProperty(code); + if (isForbidden) { + res.writeHead(403, headers); + res.end(JSON.stringify({ + code: Server.errors.FORBIDDEN, + message: code || Server.errorMessages[Server.errors.FORBIDDEN] + })); + return; + } + if (req.headers.origin) { + headers['Access-Control-Allow-Credentials'] = 'true'; + headers['Access-Control-Allow-Origin'] = req.headers.origin; + } else { + headers['Access-Control-Allow-Origin'] = '*'; + } + if (res !== undefined) { + res.writeHead(400, headers); + res.end(JSON.stringify({ + code: code, + message: Server.errorMessages[code] + })); + } +} + +/** + * generate a socket id. + * Overwrite this method to generate your custom socket id + * + * @param {Object} request object + * @api public + */ + +Server.prototype.generateId = function (req) { + return base64id.generateId(); +}; + +/** + * Handshakes a new client. + * + * @param {String} transport name + * @param {Object} request object + * @api private + */ + +Server.prototype.handshake = function (transportName, req) { + var id = this.generateId(req); + + debug('handshaking client "%s"', id); + + try { + var transport = new transports[transportName](req); + if ('polling' === transportName) { + transport.maxHttpBufferSize = this.maxHttpBufferSize; + transport.httpCompression = this.httpCompression; + } else if ('websocket' === transportName) { + transport.perMessageDeflate = this.perMessageDeflate; + } + + if (req._query && req._query.b64) { + transport.supportsBinary = false; + } else { + transport.supportsBinary = true; + } + } catch (e) { + debug('error handshaking to transport "%s"', transportName); + sendErrorMessage(req, req.res, Server.errors.BAD_REQUEST); + return; + } + var socket = new Socket(id, this, transport, req); + var self = this; + + if (false !== this.cookie) { + transport.on('headers', function (headers) { + headers['Set-Cookie'] = cookieMod.serialize(self.cookie, id, + { + path: self.cookiePath, + httpOnly: self.cookiePath ? self.cookieHttpOnly : false, + sameSite: true + }); + }); + } + + transport.onRequest(req); + + this.clients[id] = socket; + this.clientsCount++; + + socket.once('close', function () { + delete self.clients[id]; + self.clientsCount--; + }); + + this.emit('connection', socket); +}; + +/** + * Handles an Engine.IO HTTP Upgrade. + * + * @api public + */ + +Server.prototype.handleUpgrade = function (req, socket, upgradeHead) { + this.prepare(req); + + var self = this; + this.verify(req, true, function (err, success) { + if (!success) { + abortConnection(socket, err); + return; + } + + var head = Buffer.from(upgradeHead); // eslint-disable-line node/no-deprecated-api + upgradeHead = null; + + // delegate to ws + self.ws.handleUpgrade(req, socket, head, function (conn) { + self.onWebSocket(req, conn); + }); + }); +}; + +/** + * Called upon a ws.io connection. + * + * @param {ws.Socket} websocket + * @api private + */ + +Server.prototype.onWebSocket = function (req, socket) { + socket.on('error', onUpgradeError); + + if (transports[req._query.transport] !== undefined && !transports[req._query.transport].prototype.handlesUpgrades) { + debug('transport doesnt handle upgraded requests'); + socket.close(); + return; + } + + // get client id + var id = req._query.sid; + + // keep a reference to the ws.Socket + req.websocket = socket; + + if (id) { + var client = this.clients[id]; + if (!client) { + debug('upgrade attempt for closed client'); + socket.close(); + } else if (client.upgrading) { + debug('transport has already been trying to upgrade'); + socket.close(); + } else if (client.upgraded) { + debug('transport had already been upgraded'); + socket.close(); + } else { + debug('upgrading existing transport'); + + // transport error handling takes over + socket.removeListener('error', onUpgradeError); + + var transport = new transports[req._query.transport](req); + if (req._query && req._query.b64) { + transport.supportsBinary = false; + } else { + transport.supportsBinary = true; + } + transport.perMessageDeflate = this.perMessageDeflate; + client.maybeUpgrade(transport); + } + } else { + // transport error handling takes over + socket.removeListener('error', onUpgradeError); + + this.handshake(req._query.transport, req); + } + + function onUpgradeError () { + debug('websocket error before upgrade'); + // socket.close() not needed + } +}; + +/** + * Captures upgrade requests for a http.Server. + * + * @param {http.Server} server + * @param {Object} options + * @api public + */ + +Server.prototype.attach = function (server, options) { + var self = this; + options = options || {}; + var path = (options.path || '/engine.io').replace(/\/$/, ''); + + var destroyUpgradeTimeout = options.destroyUpgradeTimeout || 1000; + + // normalize path + path += '/'; + + function check (req) { + if ('OPTIONS' === req.method && false === options.handlePreflightRequest) { + return false; + } + return path === req.url.substr(0, path.length); + } + + // cache and clean up listeners + var listeners = server.listeners('request').slice(0); + server.removeAllListeners('request'); + server.on('close', self.close.bind(self)); + server.on('listening', self.init.bind(self)); + + // add request handler + server.on('request', function (req, res) { + if (check(req)) { + debug('intercepting request for path "%s"', path); + if ('OPTIONS' === req.method && 'function' === typeof options.handlePreflightRequest) { + options.handlePreflightRequest.call(server, req, res); + } else { + self.handleRequest(req, res); + } + } else { + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i].call(server, req, res); + } + } + }); + + if (~self.transports.indexOf('websocket')) { + server.on('upgrade', function (req, socket, head) { + if (check(req)) { + self.handleUpgrade(req, socket, head); + } else if (false !== options.destroyUpgrade) { + // default node behavior is to disconnect when no handlers + // but by adding a handler, we prevent that + // and if no eio thing handles the upgrade + // then the socket needs to die! + setTimeout(function () { + if (socket.writable && socket.bytesWritten <= 0) { + return socket.end(); + } + }, destroyUpgradeTimeout); + } + }); + } +}; + +/** + * Closes the connection + * + * @param {net.Socket} socket + * @param {code} error code + * @api private + */ + +function abortConnection (socket, code) { + socket.on('error', () => { + debug('ignoring error from closed connection'); + }); + if (socket.writable) { + var message = Server.errorMessages.hasOwnProperty(code) ? Server.errorMessages[code] : String(code || ''); + var length = Buffer.byteLength(message); + socket.write( + 'HTTP/1.1 400 Bad Request\r\n' + + 'Connection: close\r\n' + + 'Content-type: text/html\r\n' + + 'Content-Length: ' + length + '\r\n' + + '\r\n' + + message + ); + } + socket.destroy(); +} + +/* eslint-disable */ + +/** + * From https://github.com/nodejs/node/blob/v8.4.0/lib/_http_common.js#L303-L354 + * + * True if val contains an invalid field-vchar + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * + * checkInvalidHeaderChar() is currently designed to be inlinable by v8, + * so take care when making changes to the implementation so that the source + * code size does not exceed v8's default max_inlined_source_size setting. + **/ +var validHdrChars = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, // 0 - 15 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 32 - 47 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 48 - 63 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 80 - 95 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 112 - 127 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 128 ... + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // ... 255 +]; + +function checkInvalidHeaderChar(val) { + val += ''; + if (val.length < 1) + return false; + if (!validHdrChars[val.charCodeAt(0)]) { + debug('invalid header, index 0, char "%s"', val.charCodeAt(0)); + return true; + } + if (val.length < 2) + return false; + if (!validHdrChars[val.charCodeAt(1)]) { + debug('invalid header, index 1, char "%s"', val.charCodeAt(1)); + return true; + } + if (val.length < 3) + return false; + if (!validHdrChars[val.charCodeAt(2)]) { + debug('invalid header, index 2, char "%s"', val.charCodeAt(2)); + return true; + } + if (val.length < 4) + return false; + if (!validHdrChars[val.charCodeAt(3)]) { + debug('invalid header, index 3, char "%s"', val.charCodeAt(3)); + return true; + } + for (var i = 4; i < val.length; ++i) { + if (!validHdrChars[val.charCodeAt(i)]) { + debug('invalid header, index "%i", char "%s"', i, val.charCodeAt(i)); + return true; + } + } + return false; +} diff --git a/node_modules/engine.io/lib/socket.js b/node_modules/engine.io/lib/socket.js @@ -0,0 +1,486 @@ +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter; +var util = require('util'); +var debug = require('debug')('engine:socket'); + +/** + * Module exports. + */ + +module.exports = Socket; + +/** + * Client class (abstract). + * + * @api private + */ + +function Socket (id, server, transport, req) { + this.id = id; + this.server = server; + this.upgrading = false; + this.upgraded = false; + this.readyState = 'opening'; + this.writeBuffer = []; + this.packetsFn = []; + this.sentCallbackFn = []; + this.cleanupFn = []; + this.request = req; + + // Cache IP since it might not be in the req later + if (req.websocket && req.websocket._socket) { + this.remoteAddress = req.websocket._socket.remoteAddress; + } else { + this.remoteAddress = req.connection.remoteAddress; + } + + this.checkIntervalTimer = null; + this.upgradeTimeoutTimer = null; + this.pingTimeoutTimer = null; + + this.setTransport(transport); + this.onOpen(); +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Socket, EventEmitter); + +/** + * Called upon transport considered open. + * + * @api private + */ + +Socket.prototype.onOpen = function () { + this.readyState = 'open'; + + // sends an `open` packet + this.transport.sid = this.id; + this.sendPacket('open', JSON.stringify({ + sid: this.id, + upgrades: this.getAvailableUpgrades(), + pingInterval: this.server.pingInterval, + pingTimeout: this.server.pingTimeout + })); + + if (this.server.initialPacket) { + this.sendPacket('message', this.server.initialPacket); + } + + this.emit('open'); + this.setPingTimeout(); +}; + +/** + * Called upon transport packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onPacket = function (packet) { + if ('open' === this.readyState) { + // export packet event + debug('packet'); + this.emit('packet', packet); + + // Reset ping timeout on any packet, incoming data is a good sign of + // other side's liveness + this.setPingTimeout(); + + switch (packet.type) { + case 'ping': + debug('got ping'); + this.sendPacket('pong'); + this.emit('heartbeat'); + break; + + case 'error': + this.onClose('parse error'); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + debug('packet received with closed socket'); + } +}; + +/** + * Called upon transport error. + * + * @param {Error} error object + * @api private + */ + +Socket.prototype.onError = function (err) { + debug('transport error'); + this.onClose('transport error', err); +}; + +/** + * Sets and resets ping timeout timer based on client pings. + * + * @api private + */ + +Socket.prototype.setPingTimeout = function () { + var self = this; + clearTimeout(self.pingTimeoutTimer); + self.pingTimeoutTimer = setTimeout(function () { + self.onClose('ping timeout'); + }, self.server.pingInterval + self.server.pingTimeout); +}; + +/** + * Attaches handlers for the given transport. + * + * @param {Transport} transport + * @api private + */ + +Socket.prototype.setTransport = function (transport) { + var onError = this.onError.bind(this); + var onPacket = this.onPacket.bind(this); + var flush = this.flush.bind(this); + var onClose = this.onClose.bind(this, 'transport close'); + + this.transport = transport; + this.transport.once('error', onError); + this.transport.on('packet', onPacket); + this.transport.on('drain', flush); + this.transport.once('close', onClose); + // this function will manage packet events (also message callbacks) + this.setupSendCallback(); + + this.cleanupFn.push(function () { + transport.removeListener('error', onError); + transport.removeListener('packet', onPacket); + transport.removeListener('drain', flush); + transport.removeListener('close', onClose); + }); +}; + +/** + * Upgrades socket to the given transport + * + * @param {Transport} transport + * @api private + */ + +Socket.prototype.maybeUpgrade = function (transport) { + debug('might upgrade socket transport from "%s" to "%s"' + , this.transport.name, transport.name); + + this.upgrading = true; + + var self = this; + + // set transport upgrade timer + self.upgradeTimeoutTimer = setTimeout(function () { + debug('client did not complete upgrade - closing transport'); + cleanup(); + if ('open' === transport.readyState) { + transport.close(); + } + }, this.server.upgradeTimeout); + + function onPacket (packet) { + if ('ping' === packet.type && 'probe' === packet.data) { + transport.send([{ type: 'pong', data: 'probe' }]); + self.emit('upgrading', transport); + clearInterval(self.checkIntervalTimer); + self.checkIntervalTimer = setInterval(check, 100); + } else if ('upgrade' === packet.type && self.readyState !== 'closed') { + debug('got upgrade packet - upgrading'); + cleanup(); + self.transport.discard(); + self.upgraded = true; + self.clearTransport(); + self.setTransport(transport); + self.emit('upgrade', transport); + self.setPingTimeout(); + self.flush(); + if (self.readyState === 'closing') { + transport.close(function () { + self.onClose('forced close'); + }); + } + } else { + cleanup(); + transport.close(); + } + } + + // we force a polling cycle to ensure a fast upgrade + function check () { + if ('polling' === self.transport.name && self.transport.writable) { + debug('writing a noop packet to polling for fast upgrade'); + self.transport.send([{ type: 'noop' }]); + } + } + + function cleanup () { + self.upgrading = false; + + clearInterval(self.checkIntervalTimer); + self.checkIntervalTimer = null; + + clearTimeout(self.upgradeTimeoutTimer); + self.upgradeTimeoutTimer = null; + + transport.removeListener('packet', onPacket); + transport.removeListener('close', onTransportClose); + transport.removeListener('error', onError); + self.removeListener('close', onClose); + } + + function onError (err) { + debug('client did not complete upgrade - %s', err); + cleanup(); + transport.close(); + transport = null; + } + + function onTransportClose () { + onError('transport closed'); + } + + function onClose () { + onError('socket closed'); + } + + transport.on('packet', onPacket); + transport.once('close', onTransportClose); + transport.once('error', onError); + + self.once('close', onClose); +}; + +/** + * Clears listeners and timers associated with current transport. + * + * @api private + */ + +Socket.prototype.clearTransport = function () { + var cleanup; + + var toCleanUp = this.cleanupFn.length; + + for (var i = 0; i < toCleanUp; i++) { + cleanup = this.cleanupFn.shift(); + cleanup(); + } + + // silence further transport errors and prevent uncaught exceptions + this.transport.on('error', function () { + debug('error triggered by discarded transport'); + }); + + // ensure transport won't stay open + this.transport.close(); + + clearTimeout(this.pingTimeoutTimer); +}; + +/** + * Called upon transport considered closed. + * Possible reasons: `ping timeout`, `client error`, `parse error`, + * `transport error`, `server close`, `transport close` + */ + +Socket.prototype.onClose = function (reason, description) { + if ('closed' !== this.readyState) { + this.readyState = 'closed'; + clearTimeout(this.pingTimeoutTimer); + clearInterval(this.checkIntervalTimer); + this.checkIntervalTimer = null; + clearTimeout(this.upgradeTimeoutTimer); + var self = this; + // clean writeBuffer in next tick, so developers can still + // grab the writeBuffer on 'close' event + process.nextTick(function () { + self.writeBuffer = []; + }); + this.packetsFn = []; + this.sentCallbackFn = []; + this.clearTransport(); + this.emit('close', reason, description); + } +}; + +/** + * Setup and manage send callback + * + * @api private + */ + +Socket.prototype.setupSendCallback = function () { + var self = this; + this.transport.on('drain', onDrain); + + this.cleanupFn.push(function () { + self.transport.removeListener('drain', onDrain); + }); + + // the message was sent successfully, execute the callback + function onDrain () { + if (self.sentCallbackFn.length > 0) { + var seqFn = self.sentCallbackFn.splice(0, 1)[0]; + if ('function' === typeof seqFn) { + debug('executing send callback'); + seqFn(self.transport); + } else if (Array.isArray(seqFn)) { + debug('executing batch send callback'); + for (var l = seqFn.length, i = 0; i < l; i++) { + if ('function' === typeof seqFn[i]) { + seqFn[i](self.transport); + } + } + } + } + } +}; + +/** + * Sends a message packet. + * + * @param {String} message + * @param {Object} options + * @param {Function} callback + * @return {Socket} for chaining + * @api public + */ + +Socket.prototype.send = +Socket.prototype.write = function (data, options, callback) { + this.sendPacket('message', data, options, callback); + return this; +}; + +/** + * Sends a packet. + * + * @param {String} packet type + * @param {String} optional, data + * @param {Object} options + * @api private + */ + +Socket.prototype.sendPacket = function (type, data, options, callback) { + if ('function' === typeof options) { + callback = options; + options = null; + } + + options = options || {}; + options.compress = false !== options.compress; + + if ('closing' !== this.readyState && 'closed' !== this.readyState) { + debug('sending packet "%s" (%s)', type, data); + + var packet = { + type: type, + options: options + }; + if (data) packet.data = data; + + // exports packetCreate event + this.emit('packetCreate', packet); + + this.writeBuffer.push(packet); + + // add send callback to object, if defined + if (callback) this.packetsFn.push(callback); + + this.flush(); + } +}; + +/** + * Attempts to flush the packets buffer. + * + * @api private + */ + +Socket.prototype.flush = function () { + if ('closed' !== this.readyState && + this.transport.writable && + this.writeBuffer.length) { + debug('flushing buffer to transport'); + this.emit('flush', this.writeBuffer); + this.server.emit('flush', this, this.writeBuffer); + var wbuf = this.writeBuffer; + this.writeBuffer = []; + if (!this.transport.supportsFraming) { + this.sentCallbackFn.push(this.packetsFn); + } else { + this.sentCallbackFn.push.apply(this.sentCallbackFn, this.packetsFn); + } + this.packetsFn = []; + this.transport.send(wbuf); + this.emit('drain'); + this.server.emit('drain', this); + } +}; + +/** + * Get available upgrades for this socket. + * + * @api private + */ + +Socket.prototype.getAvailableUpgrades = function () { + var availableUpgrades = []; + var allUpgrades = this.server.upgrades(this.transport.name); + for (var i = 0, l = allUpgrades.length; i < l; ++i) { + var upg = allUpgrades[i]; + if (this.server.transports.indexOf(upg) !== -1) { + availableUpgrades.push(upg); + } + } + return availableUpgrades; +}; + +/** + * Closes the socket and underlying transport. + * + * @param {Boolean} optional, discard + * @return {Socket} for chaining + * @api public + */ + +Socket.prototype.close = function (discard) { + if ('open' !== this.readyState) return; + + this.readyState = 'closing'; + + if (this.writeBuffer.length) { + this.once('drain', this.closeTransport.bind(this, discard)); + return; + } + + this.closeTransport(discard); +}; + +/** + * Closes the underlying transport. + * + * @param {Boolean} discard + * @api private + */ + +Socket.prototype.closeTransport = function (discard) { + if (discard) this.transport.discard(); + this.transport.close(this.onClose.bind(this, 'forced close')); +}; diff --git a/node_modules/engine.io/lib/transport.js b/node_modules/engine.io/lib/transport.js @@ -0,0 +1,128 @@ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter; +var parser = require('engine.io-parser'); +var util = require('util'); +var debug = require('debug')('engine:transport'); + +/** + * Expose the constructor. + */ + +module.exports = Transport; + +/** + * Noop function. + * + * @api private + */ + +function noop () {} + +/** + * Transport constructor. + * + * @param {http.IncomingMessage} request + * @api public + */ + +function Transport (req) { + this.readyState = 'open'; + this.discarded = false; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Transport, EventEmitter); + +/** + * Flags the transport as discarded. + * + * @api private + */ + +Transport.prototype.discard = function () { + this.discarded = true; +}; + +/** + * Called with an incoming HTTP request. + * + * @param {http.IncomingMessage} request + * @api private + */ + +Transport.prototype.onRequest = function (req) { + debug('setting request'); + this.req = req; +}; + +/** + * Closes the transport. + * + * @api private + */ + +Transport.prototype.close = function (fn) { + if ('closed' === this.readyState || 'closing' === this.readyState) return; + + this.readyState = 'closing'; + this.doClose(fn || noop); +}; + +/** + * Called with a transport error. + * + * @param {String} message error + * @param {Object} error description + * @api private + */ + +Transport.prototype.onError = function (msg, desc) { + if (this.listeners('error').length) { + var err = new Error(msg); + err.type = 'TransportError'; + err.description = desc; + this.emit('error', err); + } else { + debug('ignored transport error %s (%s)', msg, desc); + } +}; + +/** + * Called with parsed out a packets from the data stream. + * + * @param {Object} packet + * @api private + */ + +Transport.prototype.onPacket = function (packet) { + this.emit('packet', packet); +}; + +/** + * Called with the encoded packet data. + * + * @param {String} data + * @api private + */ + +Transport.prototype.onData = function (data) { + this.onPacket(parser.decodePacket(data)); +}; + +/** + * Called upon transport close. + * + * @api private + */ + +Transport.prototype.onClose = function () { + this.readyState = 'closed'; + this.emit('close'); +}; diff --git a/node_modules/engine.io/lib/transports/index.js b/node_modules/engine.io/lib/transports/index.js @@ -0,0 +1,36 @@ + +/** + * Module dependencies. + */ + +var XHR = require('./polling-xhr'); +var JSONP = require('./polling-jsonp'); + +/** + * Export transports. + */ + +module.exports = exports = { + polling: polling, + websocket: require('./websocket') +}; + +/** + * Export upgrades map. + */ + +exports.polling.upgradesTo = ['websocket']; + +/** + * Polling polymorphic constructor. + * + * @api private + */ + +function polling (req) { + if ('string' === typeof req._query.j) { + return new JSONP(req); + } else { + return new XHR(req); + } +} diff --git a/node_modules/engine.io/lib/transports/polling-jsonp.js b/node_modules/engine.io/lib/transports/polling-jsonp.js @@ -0,0 +1,75 @@ + +/** + * Module dependencies. + */ + +var Polling = require('./polling'); +var qs = require('querystring'); +var rDoubleSlashes = /\\\\n/g; +var rSlashes = /(\\)?\\n/g; +var util = require('util'); + +/** + * Module exports. + */ + +module.exports = JSONP; + +/** + * JSON-P polling transport. + * + * @api public + */ + +function JSONP (req) { + Polling.call(this, req); + + this.head = '___eio[' + (req._query.j || '').replace(/[^0-9]/g, '') + ']('; + this.foot = ');'; +} + +/** + * Inherits from Polling. + */ + +util.inherits(JSONP, Polling); + +/** + * Handles incoming data. + * Due to a bug in \n handling by browsers, we expect a escaped string. + * + * @api private + */ + +JSONP.prototype.onData = function (data) { + // we leverage the qs module so that we get built-in DoS protection + // and the fast alternative to decodeURIComponent + data = qs.parse(data).d; + if ('string' === typeof data) { + // client will send already escaped newlines as \\\\n and newlines as \\n + // \\n must be replaced with \n and \\\\n with \\n + data = data.replace(rSlashes, function (match, slashes) { + return slashes ? match : '\n'; + }); + Polling.prototype.onData.call(this, data.replace(rDoubleSlashes, '\\n')); + } +}; + +/** + * Performs the write. + * + * @api private + */ + +JSONP.prototype.doWrite = function (data, options, callback) { + // we must output valid javascript, not valid json + // see: http://timelessrepo.com/json-isnt-a-javascript-subset + var js = JSON.stringify(data) + .replace(/\u2028/g, '\\u2028') + .replace(/\u2029/g, '\\u2029'); + + // prepare response + data = this.head + js + this.foot; + + Polling.prototype.doWrite.call(this, data, options, callback); +}; diff --git a/node_modules/engine.io/lib/transports/polling-xhr.js b/node_modules/engine.io/lib/transports/polling-xhr.js @@ -0,0 +1,69 @@ + +/** + * Module dependencies. + */ + +var Polling = require('./polling'); +var util = require('util'); + +/** + * Module exports. + */ + +module.exports = XHR; + +/** + * Ajax polling transport. + * + * @api public + */ + +function XHR (req) { + Polling.call(this, req); +} + +/** + * Inherits from Polling. + */ + +util.inherits(XHR, Polling); + +/** + * Overrides `onRequest` to handle `OPTIONS`.. + * + * @param {http.IncomingMessage} + * @api private + */ + +XHR.prototype.onRequest = function (req) { + if ('OPTIONS' === req.method) { + var res = req.res; + var headers = this.headers(req); + headers['Access-Control-Allow-Headers'] = 'Content-Type'; + res.writeHead(200, headers); + res.end(); + } else { + Polling.prototype.onRequest.call(this, req); + } +}; + +/** + * Returns headers for a response. + * + * @param {http.IncomingMessage} request + * @param {Object} extra headers + * @api private + */ + +XHR.prototype.headers = function (req, headers) { + headers = headers || {}; + + if (req.headers.origin) { + headers['Access-Control-Allow-Credentials'] = 'true'; + headers['Access-Control-Allow-Origin'] = req.headers.origin; + } else { + headers['Access-Control-Allow-Origin'] = '*'; + } + + return Polling.prototype.headers.call(this, req, headers); +}; diff --git a/node_modules/engine.io/lib/transports/polling.js b/node_modules/engine.io/lib/transports/polling.js @@ -0,0 +1,407 @@ + +/** + * Module requirements. + */ + +var Transport = require('../transport'); +var parser = require('engine.io-parser'); +var zlib = require('zlib'); +var accepts = require('accepts'); +var util = require('util'); +var debug = require('debug')('engine:polling'); + +var compressionMethods = { + gzip: zlib.createGzip, + deflate: zlib.createDeflate +}; + +/** + * Exports the constructor. + */ + +module.exports = Polling; + +/** + * HTTP polling constructor. + * + * @api public. + */ + +function Polling (req) { + Transport.call(this, req); + + this.closeTimeout = 30 * 1000; + this.maxHttpBufferSize = null; + this.httpCompression = null; +} + +/** + * Inherits from Transport. + * + * @api public. + */ + +util.inherits(Polling, Transport); + +/** + * Transport name + * + * @api public + */ + +Polling.prototype.name = 'polling'; + +/** + * Overrides onRequest. + * + * @param {http.IncomingMessage} + * @api private + */ + +Polling.prototype.onRequest = function (req) { + var res = req.res; + + if ('GET' === req.method) { + this.onPollRequest(req, res); + } else if ('POST' === req.method) { + this.onDataRequest(req, res); + } else { + res.writeHead(500); + res.end(); + } +}; + +/** + * The client sends a request awaiting for us to send data. + * + * @api private + */ + +Polling.prototype.onPollRequest = function (req, res) { + if (this.req) { + debug('request overlap'); + // assert: this.res, '.req and .res should be (un)set together' + this.onError('overlap from client'); + res.writeHead(500); + res.end(); + return; + } + + debug('setting request'); + + this.req = req; + this.res = res; + + var self = this; + + function onClose () { + self.onError('poll connection closed prematurely'); + } + + function cleanup () { + req.removeListener('close', onClose); + self.req = self.res = null; + } + + req.cleanup = cleanup; + req.on('close', onClose); + + this.writable = true; + this.emit('drain'); + + // if we're still writable but had a pending close, trigger an empty send + if (this.writable && this.shouldClose) { + debug('triggering empty send to append close packet'); + this.send([{ type: 'noop' }]); + } +}; + +/** + * The client sends a request with data. + * + * @api private + */ + +Polling.prototype.onDataRequest = function (req, res) { + if (this.dataReq) { + // assert: this.dataRes, '.dataReq and .dataRes should be (un)set together' + this.onError('data request overlap from client'); + res.writeHead(500); + res.end(); + return; + } + + var isBinary = 'application/octet-stream' === req.headers['content-type']; + + this.dataReq = req; + this.dataRes = res; + + var chunks = isBinary ? Buffer.concat([]) : ''; + var self = this; + + function cleanup () { + req.removeListener('data', onData); + req.removeListener('end', onEnd); + req.removeListener('close', onClose); + self.dataReq = self.dataRes = chunks = null; + } + + function onClose () { + cleanup(); + self.onError('data request connection closed prematurely'); + } + + function onData (data) { + var contentLength; + if (isBinary) { + chunks = Buffer.concat([chunks, data]); + contentLength = chunks.length; + } else { + chunks += data; + contentLength = Buffer.byteLength(chunks); + } + + if (contentLength > self.maxHttpBufferSize) { + chunks = isBinary ? Buffer.concat([]) : ''; + req.connection.destroy(); + } + } + + function onEnd () { + self.onData(chunks); + + var headers = { + // text/html is required instead of text/plain to avoid an + // unwanted download dialog on certain user-agents (GH-43) + 'Content-Type': 'text/html', + 'Content-Length': 2 + }; + + res.writeHead(200, self.headers(req, headers)); + res.end('ok'); + cleanup(); + } + + req.on('close', onClose); + if (!isBinary) req.setEncoding('utf8'); + req.on('data', onData); + req.on('end', onEnd); +}; + +/** + * Processes the incoming data payload. + * + * @param {String} encoded payload + * @api private + */ + +Polling.prototype.onData = function (data) { + debug('received "%s"', data); + var self = this; + var callback = function (packet) { + if ('close' === packet.type) { + debug('got xhr close packet'); + self.onClose(); + return false; + } + + self.onPacket(packet); + }; + + parser.decodePayload(data, callback); +}; + +/** + * Overrides onClose. + * + * @api private + */ + +Polling.prototype.onClose = function () { + if (this.writable) { + // close pending poll request + this.send([{ type: 'noop' }]); + } + Transport.prototype.onClose.call(this); +}; + +/** + * Writes a packet payload. + * + * @param {Object} packet + * @api private + */ + +Polling.prototype.send = function (packets) { + this.writable = false; + + if (this.shouldClose) { + debug('appending close packet to payload'); + packets.push({ type: 'close' }); + this.shouldClose(); + this.shouldClose = null; + } + + var self = this; + parser.encodePayload(packets, this.supportsBinary, function (data) { + var compress = packets.some(function (packet) { + return packet.options && packet.options.compress; + }); + self.write(data, { compress: compress }); + }); +}; + +/** + * Writes data as response to poll request. + * + * @param {String} data + * @param {Object} options + * @api private + */ + +Polling.prototype.write = function (data, options) { + debug('writing "%s"', data); + var self = this; + this.doWrite(data, options, function () { + self.req.cleanup(); + }); +}; + +/** + * Performs the write. + * + * @api private + */ + +Polling.prototype.doWrite = function (data, options, callback) { + var self = this; + + // explicit UTF-8 is required for pages not served under utf + var isString = typeof data === 'string'; + var contentType = isString + ? 'text/plain; charset=UTF-8' + : 'application/octet-stream'; + + var headers = { + 'Content-Type': contentType + }; + + if (!this.httpCompression || !options.compress) { + respond(data); + return; + } + + var len = isString ? Buffer.byteLength(data) : data.length; + if (len < this.httpCompression.threshold) { + respond(data); + return; + } + + var encoding = accepts(this.req).encodings(['gzip', 'deflate']); + if (!encoding) { + respond(data); + return; + } + + this.compress(data, encoding, function (err, data) { + if (err) { + self.res.writeHead(500); + self.res.end(); + callback(err); + return; + } + + headers['Content-Encoding'] = encoding; + respond(data); + }); + + function respond (data) { + headers['Content-Length'] = 'string' === typeof data ? Buffer.byteLength(data) : data.length; + self.res.writeHead(200, self.headers(self.req, headers)); + self.res.end(data); + callback(); + } +}; + +/** + * Compresses data. + * + * @api private + */ + +Polling.prototype.compress = function (data, encoding, callback) { + debug('compressing'); + + var buffers = []; + var nread = 0; + + compressionMethods[encoding](this.httpCompression) + .on('error', callback) + .on('data', function (chunk) { + buffers.push(chunk); + nread += chunk.length; + }) + .on('end', function () { + callback(null, Buffer.concat(buffers, nread)); + }) + .end(data); +}; + +/** + * Closes the transport. + * + * @api private + */ + +Polling.prototype.doClose = function (fn) { + debug('closing'); + + var self = this; + var closeTimeoutTimer; + + if (this.dataReq) { + debug('aborting ongoing data request'); + this.dataReq.destroy(); + } + + if (this.writable) { + debug('transport writable - closing right away'); + this.send([{ type: 'close' }]); + onClose(); + } else if (this.discarded) { + debug('transport discarded - closing right away'); + onClose(); + } else { + debug('transport not writable - buffering orderly close'); + this.shouldClose = onClose; + closeTimeoutTimer = setTimeout(onClose, this.closeTimeout); + } + + function onClose () { + clearTimeout(closeTimeoutTimer); + fn(); + self.onClose(); + } +}; + +/** + * Returns headers for a response. + * + * @param {http.IncomingMessage} request + * @param {Object} extra headers + * @api private + */ + +Polling.prototype.headers = function (req, headers) { + headers = headers || {}; + + // prevent XSS warnings on IE + // https://github.com/LearnBoost/socket.io/pull/1333 + var ua = req.headers['user-agent']; + if (ua && (~ua.indexOf(';MSIE') || ~ua.indexOf('Trident/'))) { + headers['X-XSS-Protection'] = '0'; + } + + this.emit('headers', headers); + return headers; +}; diff --git a/node_modules/engine.io/lib/transports/websocket.js b/node_modules/engine.io/lib/transports/websocket.js @@ -0,0 +1,134 @@ + +/** + * Module dependencies. + */ + +var Transport = require('../transport'); +var parser = require('engine.io-parser'); +var util = require('util'); +var debug = require('debug')('engine:ws'); + +/** + * Export the constructor. + */ + +module.exports = WebSocket; + +/** + * WebSocket transport + * + * @param {http.IncomingMessage} + * @api public + */ + +function WebSocket (req) { + Transport.call(this, req); + var self = this; + this.socket = req.websocket; + this.socket.on('message', this.onData.bind(this)); + this.socket.once('close', this.onClose.bind(this)); + this.socket.on('error', this.onError.bind(this)); + this.socket.on('headers', onHeaders); + this.writable = true; + this.perMessageDeflate = null; + + function onHeaders (headers) { + self.emit('headers', headers); + } +} + +/** + * Inherits from Transport. + */ + +util.inherits(WebSocket, Transport); + +/** + * Transport name + * + * @api public + */ + +WebSocket.prototype.name = 'websocket'; + +/** + * Advertise upgrade support. + * + * @api public + */ + +WebSocket.prototype.handlesUpgrades = true; + +/** + * Advertise framing support. + * + * @api public + */ + +WebSocket.prototype.supportsFraming = true; + +/** + * Processes the incoming data. + * + * @param {String} encoded packet + * @api private + */ + +WebSocket.prototype.onData = function (data) { + debug('received "%s"', data); + Transport.prototype.onData.call(this, data); +}; + +/** + * Writes a packet payload. + * + * @param {Array} packets + * @api private + */ + +WebSocket.prototype.send = function (packets) { + var self = this; + + for (var i = 0; i < packets.length; i++) { + var packet = packets[i]; + parser.encodePacket(packet, self.supportsBinary, send); + } + + function send (data) { + debug('writing "%s"', data); + + // always creates a new object since ws modifies it + var opts = {}; + if (packet.options) { + opts.compress = packet.options.compress; + } + + if (self.perMessageDeflate) { + var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length; + if (len < self.perMessageDeflate.threshold) { + opts.compress = false; + } + } + + self.writable = false; + self.socket.send(data, opts, onEnd); + } + + function onEnd (err) { + if (err) return self.onError('write error', err.stack); + self.writable = true; + self.emit('drain'); + } +}; + +/** + * Closes the transport. + * + * @api private + */ + +WebSocket.prototype.doClose = function (fn) { + debug('closing'); + this.socket.close(); + fn && fn(); +}; diff --git a/node_modules/engine.io/node_modules/cookie/HISTORY.md b/node_modules/engine.io/node_modules/cookie/HISTORY.md @@ -0,0 +1,118 @@ +0.3.1 / 2016-05-26 +================== + + * Fix `sameSite: true` to work with draft-7 clients + - `true` now sends `SameSite=Strict` instead of `SameSite` + +0.3.0 / 2016-05-26 +================== + + * Add `sameSite` option + - Replaces `firstPartyOnly` option, never implemented by browsers + * Improve error message when `encode` is not a function + * Improve error message when `expires` is not a `Date` + +0.2.4 / 2016-05-20 +================== + + * perf: enable strict mode + * perf: use for loop in parse + * perf: use string concatination for serialization + +0.2.3 / 2015-10-25 +================== + + * Fix cookie `Max-Age` to never be a floating point number + +0.2.2 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.2.1 / 2015-09-17 +================== + + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.2.0 / 2015-08-13 +================== + + * Add `firstPartyOnly` option + * Throw better error for invalid argument to parse + * perf: hoist regular expression + +0.1.5 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.1.4 / 2015-09-17 +================== + + * Throw better error for invalid argument to parse + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.1.3 / 2015-05-19 +================== + + * Reduce the scope of try-catch deopt + * Remove argument reassignments + +0.1.2 / 2014-04-16 +================== + + * Remove unnecessary files from npm package + +0.1.1 / 2014-02-23 +================== + + * Fix bad parse when cookie value contained a comma + * Fix support for `maxAge` of `0` + +0.1.0 / 2013-05-01 +================== + + * Add `decode` option + * Add `encode` option + +0.0.6 / 2013-04-08 +================== + + * Ignore cookie parts missing `=` + +0.0.5 / 2012-10-29 +================== + + * Return raw cookie value if value unescape errors + +0.0.4 / 2012-06-21 +================== + + * Use encode/decodeURIComponent for cookie encoding/decoding + - Improve server/client interoperability + +0.0.3 / 2012-06-06 +================== + + * Only escape special characters per the cookie RFC + +0.0.2 / 2012-06-01 +================== + + * Fix `maxAge` option to not throw error + +0.0.1 / 2012-05-28 +================== + + * Add more tests + +0.0.0 / 2012-05-28 +================== + + * Initial release diff --git a/node_modules/engine.io/node_modules/cookie/LICENSE b/node_modules/engine.io/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com> +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/engine.io/node_modules/cookie/README.md b/node_modules/engine.io/node_modules/cookie/README.md @@ -0,0 +1,220 @@ +# cookie + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +```sh +$ npm install cookie +``` + +## API + +```js +var cookie = require('cookie'); +``` + +### cookie.parse(str, options) + +Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +`cookie.parse` accepts these properties in the options object. + +##### decode + +Specifies a function that will be used to decode a cookie's value. Since the value of a cookie +has a limited character set (and must be a simple string), this function can be used to decode +a previously-encoded cookie value into a JavaScript string or other object. + +The default function is the global `decodeURIComponent`, which will decode any URL-encoded +sequences into their byte representations. + +**note** if an error is thrown from this function, the original, non-decoded cookie value will +be returned as the cookie's value. + +### cookie.serialize(name, value, options) + +Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the +name for the cookie, the `value` argument is the value to set the cookie to, and the `options` +argument is an optional object containing additional serialization options. + +```js +var setCookie = cookie.serialize('foo', 'bar'); +// foo=bar +``` + +#### Options + +`cookie.serialize` accepts these properties in the options object. + +##### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6266-5.2.3]. By default, no +domain is set, and most clients will consider the cookie to apply to only the current domain. + +##### encode + +Specifies a function that will be used to encode a cookie's value. Since value of a cookie +has a limited character set (and must be a simple string), this function can be used to encode +a value into a string suited for a cookie's value. + +The default function is the global `ecodeURIComponent`, which will encode a JavaScript string +into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. + +##### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6266-5.2.1]. +By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and +will delete it on a condition like exiting a web browser application. + +**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and +`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### httpOnly + +Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6266-5.2.6]. When truthy, +the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not allow client-side +JavaScript to see the cookie in `document.cookie`. + +##### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6266-5.2.2]. +The given number will be converted to an integer by rounding down. By default, no maximum age is set. + +**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and +`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### path + +Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6266-5.2.4]. By default, the path +is considered the ["default path"][rfc-6266-5.1.4]. By default, no maximum age is set, and most +clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting +a web browser application. + +##### sameSite + +Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][draft-west-first-party-cookies-07]. + + - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + - `false` will not set the `SameSite` attribute. + - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about the different enforcement levels can be found in the specification +https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1 + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### secure + +Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6266-5.2.5]. When truthy, +the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to +the server in the future if the browser does not have an HTTPS connection. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require('cookie'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var url = require('url'); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { + httpOnly: true, + maxAge: 60 * 60 * 24 * 7 // 1 week + })); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader('Location', req.headers.referer || '/'); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parse(req.headers.cookie || ''); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader('Content-Type', 'text/html; charset=UTF-8'); + + if (name) { + res.write('<p>Welcome back, <b>' + escapeHtml(name) + '</b>!</p>'); + } else { + res.write('<p>Hello, new visitor!</p>'); + } + + res.write('<form method="GET">'); + res.write('<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">'); + res.end('</form'); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +$ npm test +``` + +## References + +- [RFC 6266: HTTP State Management Mechanism][rfc-6266] +- [Same-site Cookies][draft-west-first-party-cookies-07] + +[draft-west-first-party-cookies-07]: https://tools.ietf.org/html/draft-west-first-party-cookies-07 +[rfc-6266]: https://tools.ietf.org/html/rfc6266 +[rfc-6266-5.1.4]: https://tools.ietf.org/html/rfc6266#section-5.1.4 +[rfc-6266-5.2.1]: https://tools.ietf.org/html/rfc6266#section-5.2.1 +[rfc-6266-5.2.2]: https://tools.ietf.org/html/rfc6266#section-5.2.2 +[rfc-6266-5.2.3]: https://tools.ietf.org/html/rfc6266#section-5.2.3 +[rfc-6266-5.2.4]: https://tools.ietf.org/html/rfc6266#section-5.2.4 +[rfc-6266-5.3]: https://tools.ietf.org/html/rfc6266#section-5.3 + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/cookie.svg +[npm-url]: https://npmjs.org/package/cookie +[node-version-image]: https://img.shields.io/node/v/cookie.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/jshttp/cookie/master.svg +[travis-url]: https://travis-ci.org/jshttp/cookie +[coveralls-image]: https://img.shields.io/coveralls/jshttp/cookie/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master +[downloads-image]: https://img.shields.io/npm/dm/cookie.svg +[downloads-url]: https://npmjs.org/package/cookie diff --git a/node_modules/engine.io/node_modules/cookie/index.js b/node_modules/engine.io/node_modules/cookie/index.js @@ -0,0 +1,195 @@ +/*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +exports.parse = parse; +exports.serialize = serialize; + +/** + * Module variables. + * @private + */ + +var decode = decodeURIComponent; +var encode = encodeURIComponent; +var pairSplitRegExp = /; */; + +/** + * RegExp to match field-content in RFC 7230 sec 3.2 + * + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * obs-text = %x80-FF + */ + +var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; + +/** + * Parse a cookie header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + * + * @param {string} str + * @param {object} [options] + * @return {object} + * @public + */ + +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + + var obj = {} + var opt = options || {}; + var pairs = str.split(pairSplitRegExp); + var dec = opt.decode || decode; + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + var eq_idx = pair.indexOf('='); + + // skip things that don't look like key=value + if (eq_idx < 0) { + continue; + } + + var key = pair.substr(0, eq_idx).trim() + var val = pair.substr(++eq_idx, pair.length).trim(); + + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + } + + return obj; +} + +/** + * Serialize data into a cookie header. + * + * Serialize the a name value pair into a cookie string suitable for + * http headers. An optional options object specified cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + * + * @param {string} name + * @param {string} val + * @param {object} [options] + * @return {string} + * @public + */ + +function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + + if (typeof enc !== 'function') { + throw new TypeError('option encode is invalid'); + } + + if (!fieldContentRegExp.test(name)) { + throw new TypeError('argument name is invalid'); + } + + var value = enc(val); + + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError('argument val is invalid'); + } + + var str = name + '=' + value; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); + str += '; Max-Age=' + Math.floor(maxAge); + } + + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError('option domain is invalid'); + } + + str += '; Domain=' + opt.domain; + } + + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError('option path is invalid'); + } + + str += '; Path=' + opt.path; + } + + if (opt.expires) { + if (typeof opt.expires.toUTCString !== 'function') { + throw new TypeError('option expires is invalid'); + } + + str += '; Expires=' + opt.expires.toUTCString(); + } + + if (opt.httpOnly) { + str += '; HttpOnly'; + } + + if (opt.secure) { + str += '; Secure'; + } + + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === 'string' + ? opt.sameSite.toLowerCase() : opt.sameSite; + + switch (sameSite) { + case true: + str += '; SameSite=Strict'; + break; + case 'lax': + str += '; SameSite=Lax'; + break; + case 'strict': + str += '; SameSite=Strict'; + break; + default: + throw new TypeError('option sameSite is invalid'); + } + } + + return str; +} + +/** + * Try decoding a string using a decoding function. + * + * @param {string} str + * @param {function} decode + * @private + */ + +function tryDecode(str, decode) { + try { + return decode(str); + } catch (e) { + return str; + } +} diff --git a/node_modules/engine.io/node_modules/cookie/package.json b/node_modules/engine.io/node_modules/cookie/package.json @@ -0,0 +1,71 @@ +{ + "_from": "cookie@0.3.1", + "_id": "cookie@0.3.1", + "_inBundle": false, + "_integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "_location": "/engine.io/cookie", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "cookie@0.3.1", + "name": "cookie", + "escapedName": "cookie", + "rawSpec": "0.3.1", + "saveSpec": null, + "fetchSpec": "0.3.1" + }, + "_requiredBy": [ + "/engine.io" + ], + "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "_shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb", + "_spec": "cookie@0.3.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io", + "author": { + "name": "Roman Shtylman", + "email": "shtylman@gmail.com" + }, + "bugs": { + "url": "https://github.com/jshttp/cookie/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + } + ], + "deprecated": false, + "description": "HTTP server cookie parsing and serialization", + "devDependencies": { + "istanbul": "0.4.3", + "mocha": "1.21.5" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/cookie#readme", + "keywords": [ + "cookie", + "cookies" + ], + "license": "MIT", + "name": "cookie", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/cookie.git" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + }, + "version": "0.3.1" +} diff --git a/node_modules/engine.io/node_modules/debug/CHANGELOG.md b/node_modules/engine.io/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/engine.io/node_modules/debug/LICENSE b/node_modules/engine.io/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/engine.io/node_modules/debug/README.md b/node_modules/engine.io/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + +<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png"> + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + +<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png"> + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png"> + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + +<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + +<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a> + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/engine.io/node_modules/debug/dist/debug.js b/node_modules/engine.io/node_modules/debug/dist/debug.js @@ -0,0 +1,912 @@ +"use strict"; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + + g.debug = f(); + } +})(function () { + var define, module, exports; + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require; + if (!f && c) return c(i, !0); + if (u) return u(i, !0); + var a = new Error("Cannot find module '" + i + "'"); + throw a.code = "MODULE_NOT_FOUND", a; + } + + var p = n[i] = { + exports: {} + }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + + return n[i].exports; + } + + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + } + + return o; + } + + return r; + }()({ + 1: [function (require, module, exports) { + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + + var type = _typeof(val); + + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(str) { + str = String(str); + + if (str.length > 100) { + return; + } + + var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + + if (!match) { + return; + } + + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + + case 'weeks': + case 'week': + case 'w': + return n * w; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + + default: + return undefined; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + + return ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + }, {}], + 2: [function (require, module, exports) { + // shim for using process in browser + var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; // v8 likes predictible objects + + + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { + return '/'; + }; + + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + + process.umask = function () { + return 0; + }; + }, {}], + 3: [function (require, module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + + + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + + + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; + } + + module.exports = setup; + }, { + "ms": 1 + }], + 4: [function (require, module, exports) { + (function (process) { + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + // eslint-disable-next-line complexity + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + + function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = require('./common')(exports); + var formatters = module.exports.formatters; + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + }).call(this, require('_process')); + }, { + "./common": 3, + "_process": 2 + }] + }, {}, [4])(4); +}); diff --git a/node_modules/engine.io/node_modules/debug/package.json b/node_modules/engine.io/node_modules/debug/package.json @@ -0,0 +1,102 @@ +{ + "_from": "debug@~4.1.0", + "_id": "debug@4.1.1", + "_inBundle": false, + "_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "_location": "/engine.io/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@~4.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "~4.1.0", + "saveSpec": null, + "fetchSpec": "~4.1.0" + }, + "_requiredBy": [ + "/engine.io" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "_shasum": "3b72260255109c6b589cee050f1d516139664791", + "_spec": "debug@~4.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "scripts": { + "build": "npm run build:debug && npm run build:test", + "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", + "build:test": "babel -d dist test.js", + "clean": "rimraf dist coverage", + "lint": "xo", + "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", + "pretest:browser": "npm run build", + "test": "npm run test:node && npm run test:browser", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "unpkg": "./dist/debug.js", + "version": "4.1.1" +} diff --git a/node_modules/engine.io/node_modules/debug/src/browser.js b/node_modules/engine.io/node_modules/debug/src/browser.js @@ -0,0 +1,264 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/engine.io/node_modules/debug/src/common.js b/node_modules/engine.io/node_modules/debug/src/common.js @@ -0,0 +1,266 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/engine.io/node_modules/debug/src/index.js b/node_modules/engine.io/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/engine.io/node_modules/debug/src/node.js b/node_modules/engine.io/node_modules/debug/src/node.js @@ -0,0 +1,257 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/engine.io/node_modules/ms/index.js b/node_modules/engine.io/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/engine.io/node_modules/ms/license.md b/node_modules/engine.io/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/engine.io/node_modules/ms/package.json b/node_modules/engine.io/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/engine.io/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/engine.io/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@^2.1.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/node_modules/engine.io/node_modules/ms/readme.md b/node_modules/engine.io/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/engine.io/package.json b/node_modules/engine.io/package.json @@ -0,0 +1,96 @@ +{ + "_from": "engine.io@~3.4.0", + "_id": "engine.io@3.4.1", + "_inBundle": false, + "_integrity": "sha512-8MfIfF1/IIfxuc2gv5K+XlFZczw/BpTvqBdl0E2fBLkYQp4miv4LuDTVtYt4yMyaIFLEr4vtaSgV4mjvll8Crw==", + "_location": "/engine.io", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "engine.io@~3.4.0", + "name": "engine.io", + "escapedName": "engine.io", + "rawSpec": "~3.4.0", + "saveSpec": null, + "fetchSpec": "~3.4.0" + }, + "_requiredBy": [ + "/socket.io" + ], + "_resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.1.tgz", + "_shasum": "a61cbc13fa0cb27d9453fd079a29ee980564b069", + "_spec": "engine.io@~3.4.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io", + "author": { + "name": "Guillermo Rauch", + "email": "guillermo@learnboost.com" + }, + "bugs": { + "url": "https://github.com/socketio/engine.io/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Eugen Dueck", + "url": "https://github.com/EugenDueck" + }, + { + "name": "Afshin Mehrabani", + "url": "https://github.com/afshinm" + }, + { + "name": "Christoph Dorn", + "url": "https://github.com/cadorn" + }, + { + "name": "Mark Mokryn", + "email": "mokesmokes@gmail.com" + } + ], + "dependencies": { + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "0.3.1", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "ws": "^7.1.2" + }, + "deprecated": false, + "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", + "devDependencies": { + "babel-eslint": "^8.0.2", + "babel-preset-es2015": "^6.24.0", + "engine.io-client": "3.4.1", + "eslint": "^4.5.0", + "eslint-config-standard": "^10.2.1", + "eslint-plugin-import": "^2.7.0", + "eslint-plugin-node": "^5.1.1", + "eslint-plugin-promise": "^3.5.0", + "eslint-plugin-standard": "^3.0.1", + "expect.js": "^0.3.1", + "mocha": "^4.0.1", + "s": "0.1.1", + "superagent": "^3.8.1", + "uws": "~9.14.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "files": [ + "lib/" + ], + "homepage": "https://github.com/socketio/engine.io", + "license": "MIT", + "main": "lib/engine.io", + "name": "engine.io", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/socketio/engine.io.git" + }, + "scripts": { + "lint": "eslint lib/ test/ *.js", + "test": "npm run lint && mocha && EIO_WS_ENGINE=uws mocha" + }, + "version": "3.4.1" +} diff --git a/node_modules/has-binary2/History.md b/node_modules/has-binary2/History.md @@ -0,0 +1,57 @@ +<a name="1.0.3"></a> +## [1.0.3](https://github.com/darrachequesne/has-binary/compare/1.0.2...1.0.3) (2018-05-14) + + +### Bug Fixes + +* avoid use of global ([#4](https://github.com/darrachequesne/has-binary/issues/4)) ([91aa21e](https://github.com/darrachequesne/has-binary/commit/91aa21e)) + + + +<a name="1.0.2"></a> +## [1.0.2](https://github.com/darrachequesne/has-binary/compare/1.0.1...1.0.2) (2017-04-27) + + +### Bug Fixes + +* Fix Blob detection for iOS 8/9 ([2a7b25c](https://github.com/darrachequesne/has-binary/commit/2a7b25c)) + + + +<a name="1.0.1"></a> +## [1.0.1](https://github.com/darrachequesne/has-binary/compare/1.0.0...1.0.1) (2017-04-05) + + + +<a name="1.0.0"></a> +# [1.0.0](https://github.com/darrachequesne/has-binary/compare/0.1.7...1.0.0) (2017-04-05) + + +### Bug Fixes + +* do not call toJSON more than once ([#7](https://github.com/darrachequesne/has-binary/issues/7)) ([27165d2](https://github.com/darrachequesne/has-binary/commit/27165d2)) +* Ensure globals are functions before running `instanceof` checks against them. ([#4](https://github.com/darrachequesne/has-binary/issues/4)) ([f9be9b3](https://github.com/darrachequesne/has-binary/commit/f9be9b3)) +* fix the case when toJSON() returns a Buffer ([#6](https://github.com/darrachequesne/has-binary/issues/6)) ([518747d](https://github.com/darrachequesne/has-binary/commit/518747d)) + + +### Performance Improvements + +* Performance improvements ([#3](https://github.com/darrachequesne/has-binary/issues/3)) ([3e88e81](https://github.com/darrachequesne/has-binary/commit/3e88e81)) + + + +<a name="0.1.7"></a> +## [0.1.7](https://github.com/darrachequesne/has-binary/compare/0.1.6...0.1.7) (2015-11-19) + + + +<a name="0.1.6"></a> +## [0.1.6](https://github.com/darrachequesne/has-binary/compare/0.1.5...0.1.6) (2015-01-24) + + + +<a name="0.1.5"></a> +## 0.1.5 (2014-09-04) + + + diff --git a/node_modules/has-binary2/LICENSE b/node_modules/has-binary2/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Kevin Roark + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/has-binary2/README.md b/node_modules/has-binary2/README.md @@ -0,0 +1,4 @@ +has-binarydata.js +================= + +Simple module to test if an object contains binary data diff --git a/node_modules/has-binary2/index.js b/node_modules/has-binary2/index.js @@ -0,0 +1,64 @@ +/* global Blob File */ + +/* + * Module requirements. + */ + +var isArray = require('isarray'); + +var toString = Object.prototype.toString; +var withNativeBlob = typeof Blob === 'function' || + typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'; +var withNativeFile = typeof File === 'function' || + typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'; + +/** + * Module exports. + */ + +module.exports = hasBinary; + +/** + * Checks for binary data. + * + * Supports Buffer, ArrayBuffer, Blob and File. + * + * @param {Object} anything + * @api public + */ + +function hasBinary (obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + if (isArray(obj)) { + for (var i = 0, l = obj.length; i < l; i++) { + if (hasBinary(obj[i])) { + return true; + } + } + return false; + } + + if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) || + (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) || + (withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File) + ) { + return true; + } + + // see: https://github.com/Automattic/has-binary/pull/4 + if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) { + return hasBinary(obj.toJSON(), true); + } + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { + return true; + } + } + + return false; +} diff --git a/node_modules/has-binary2/package.json b/node_modules/has-binary2/package.json @@ -0,0 +1,51 @@ +{ + "_from": "has-binary2@~1.0.2", + "_id": "has-binary2@1.0.3", + "_inBundle": false, + "_integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "_location": "/has-binary2", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "has-binary2@~1.0.2", + "name": "has-binary2", + "escapedName": "has-binary2", + "rawSpec": "~1.0.2", + "saveSpec": null, + "fetchSpec": "~1.0.2" + }, + "_requiredBy": [ + "/engine.io-parser", + "/socket.io", + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "_shasum": "7776ac627f3ea77250cfc332dab7ddf5e4f5d11d", + "_spec": "has-binary2@~1.0.2", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io", + "author": { + "name": "Kevin Roark" + }, + "bundleDependencies": false, + "dependencies": { + "isarray": "2.0.1" + }, + "deprecated": false, + "description": "A function that takes anything in javascript and returns true if its argument contains binary data.", + "devDependencies": { + "better-assert": "^1.0.2", + "mocha": "^3.2.0", + "semistandard": "^9.2.1" + }, + "files": [ + "index.js" + ], + "license": "MIT", + "name": "has-binary2", + "scripts": { + "checkstyle": "semistandard", + "test": "npm run checkstyle && mocha --bail" + }, + "version": "1.0.3" +} diff --git a/node_modules/has-cors/.npmignore b/node_modules/has-cors/.npmignore @@ -0,0 +1,3 @@ +components +build +node_modules diff --git a/node_modules/has-cors/History.md b/node_modules/has-cors/History.md @@ -0,0 +1,21 @@ + +1.1.0 / 2014-11-12 +================== + + * remove "global" module dependency (#2, @achingbrain) + +1.0.2 / 2013-08-27 +================== + + * explicitly use `global` instead of being implicit + * pin "component/global" to v2.0.1 + +1.0.1 / 2013-08-23 +================== + + * package: add "component" section + +1.0.0 / 2013-08-22 +================== + + * Initial release diff --git a/node_modules/has-cors/Makefile b/node_modules/has-cors/Makefile @@ -0,0 +1,11 @@ + +build: components index.js + @component build --dev + +components: component.json + @component install --dev + +clean: + rm -fr build components template.js + +.PHONY: clean diff --git a/node_modules/has-cors/Readme.md b/node_modules/has-cors/Readme.md @@ -0,0 +1,24 @@ + +# has-cors + + Detects support for Cross-Origin Resource Sharing + +## Installation + + Install with [component(1)](http://component.io): + + $ component install component/has-cors + +## API + +Exports `true` if the user-agent supports CORS, or `false` otherwise. + +``` js +var hasCORS = require('has-cors'); +console.log(hasCORS); +// true +``` + +## License + + MIT diff --git a/node_modules/has-cors/component.json b/node_modules/has-cors/component.json @@ -0,0 +1,13 @@ +{ + "name": "has-cors", + "repo": "component/has-cors", + "description": "Detects support for Cross-Origin Resource Sharing", + "version": "1.1.0", + "keywords": [], + "development": {}, + "license": "MIT", + "main": "index.js", + "scripts": [ + "index.js" + ] +} diff --git a/node_modules/has-cors/index.js b/node_modules/has-cors/index.js @@ -0,0 +1,17 @@ + +/** + * Module exports. + * + * Logic borrowed from Modernizr: + * + * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js + */ + +try { + module.exports = typeof XMLHttpRequest !== 'undefined' && + 'withCredentials' in new XMLHttpRequest(); +} catch (err) { + // if XMLHttp support is disabled in IE then it will throw + // when trying to create + module.exports = false; +} diff --git a/node_modules/has-cors/package.json b/node_modules/has-cors/package.json @@ -0,0 +1,66 @@ +{ + "_from": "has-cors@1.1.0", + "_id": "has-cors@1.1.0", + "_inBundle": false, + "_integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "_location": "/has-cors", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "has-cors@1.1.0", + "name": "has-cors", + "escapedName": "has-cors", + "rawSpec": "1.1.0", + "saveSpec": null, + "fetchSpec": "1.1.0" + }, + "_requiredBy": [ + "/engine.io-client", + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "_shasum": "5e474793f7ea9843d1bb99c23eef49ff126fff39", + "_spec": "has-cors@1.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io/" + }, + "bugs": { + "url": "https://github.com/component/has-cors/issues" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "has-cors/index.js": "index.js" + } + }, + "deprecated": false, + "description": "Detects support for Cross-Origin Resource Sharing", + "devDependencies": { + "chai": "^1.10", + "mocha": "^2.0" + }, + "homepage": "https://github.com/component/has-cors#readme", + "keywords": [ + "cors", + "cross", + "origin", + "resource", + "sharing", + "domain" + ], + "license": "MIT", + "main": "index.js", + "name": "has-cors", + "repository": { + "type": "git", + "url": "git://github.com/component/has-cors.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.1.0" +} diff --git a/node_modules/has-cors/test.js b/node_modules/has-cors/test.js @@ -0,0 +1,24 @@ +var expect = require('chai').expect; + +describe('has-cors', function() { + beforeEach(function() { + // make sure result is not cached + delete require.cache[require.resolve('./')]; + }); + + it('should not have cors', function() { + var hasCors = require('./'); + + expect(hasCors).to.be.false; + }); + + it('should have cors', function() { + global.XMLHttpRequest = function() { + this.withCredentials = true; + }; + + var hasCors = require('./'); + + expect(hasCors).to.be.true; + }); +}); diff --git a/node_modules/indexof/.npmignore b/node_modules/indexof/.npmignore @@ -0,0 +1,2 @@ +components +build diff --git a/node_modules/indexof/Makefile b/node_modules/indexof/Makefile @@ -0,0 +1,11 @@ + +build: components index.js + @component build + +components: + @Component install + +clean: + rm -fr build components template.js + +.PHONY: clean diff --git a/node_modules/indexof/Readme.md b/node_modules/indexof/Readme.md @@ -0,0 +1,15 @@ + +# indexOf + + Lame indexOf thing, thanks microsoft + +## Example + +```js +var index = require('indexof'); +index(arr, obj); +``` + +## License + + MIT+ \ No newline at end of file diff --git a/node_modules/indexof/component.json b/node_modules/indexof/component.json @@ -0,0 +1,10 @@ +{ + "name": "indexof", + "description": "Microsoft sucks", + "version": "0.0.1", + "keywords": ["index", "array", "indexOf"], + "dependencies": {}, + "scripts": [ + "index.js" + ] +}+ \ No newline at end of file diff --git a/node_modules/indexof/index.js b/node_modules/indexof/index.js @@ -0,0 +1,10 @@ + +var indexOf = [].indexOf; + +module.exports = function(arr, obj){ + if (indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; +};+ \ No newline at end of file diff --git a/node_modules/indexof/package.json b/node_modules/indexof/package.json @@ -0,0 +1,42 @@ +{ + "_from": "indexof@0.0.1", + "_id": "indexof@0.0.1", + "_inBundle": false, + "_integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "_location": "/indexof", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "indexof@0.0.1", + "name": "indexof", + "escapedName": "indexof", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/engine.io-client", + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "_shasum": "82dc336d232b9062179d05ab3293a66059fd435d", + "_spec": "indexof@0.0.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "bundleDependencies": false, + "component": { + "scripts": { + "indexof/index.js": "index.js" + } + }, + "dependencies": {}, + "deprecated": false, + "description": "Microsoft sucks", + "keywords": [ + "index", + "array", + "indexOf" + ], + "name": "indexof", + "version": "0.0.1" +} diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](https://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/node-browserify). + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt; + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js @@ -0,0 +1,5 @@ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json @@ -0,0 +1,78 @@ +{ + "_from": "isarray@2.0.1", + "_id": "isarray@2.0.1", + "_inBundle": false, + "_integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "_location": "/isarray", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "isarray@2.0.1", + "name": "isarray", + "escapedName": "isarray", + "rawSpec": "2.0.1", + "saveSpec": null, + "fetchSpec": "2.0.1" + }, + "_requiredBy": [ + "/has-binary2", + "/socket.io-client/socket.io-parser", + "/socket.io-parser" + ], + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "_shasum": "a37d94ed9cda2d59865c9f76fe596ee1f338741e", + "_spec": "isarray@2.0.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/has-binary2", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Array#isArray for older browsers", + "devDependencies": { + "tape": "~2.13.4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/juliangruber/isarray", + "keywords": [ + "browser", + "isarray", + "array" + ], + "license": "MIT", + "main": "index.js", + "name": "isarray", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "scripts": { + "test": "tape test.js" + }, + "testling": { + "files": "test.js", + "browsers": [ + "ie/8..latest", + "firefox/17..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "2.0.1" +} diff --git a/node_modules/object-component/.npmignore b/node_modules/object-component/.npmignore @@ -0,0 +1,3 @@ +components +build +node_modules diff --git a/node_modules/object-component/History.md b/node_modules/object-component/History.md @@ -0,0 +1,10 @@ + +0.0.3 / 2012-10-15 +================== + + * package: added `component` namespace (fixes #1) + +0.0.2 / 2012-09-20 +================== + + * add code smell to `.merge()` diff --git a/node_modules/object-component/Makefile b/node_modules/object-component/Makefile @@ -0,0 +1,16 @@ + +build: components index.js + @component build + +components: + @Component install + +clean: + rm -fr build components template.js + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: clean test diff --git a/node_modules/object-component/Readme.md b/node_modules/object-component/Readme.md @@ -0,0 +1,31 @@ + +# object + + Object utils. + +## API + +### .keys(obj) + + Return the keys for `obj`. + +### .values(obj) + + Return the values for `obj`. + +### .length(obj) + + Return the number of keys for `obj`. + +### .isEmpty(obj) + + Check if `obj` is empty. + +### .merge(a, b) + + Merge object `b` into `a`, returns `a`. + Precedence is given to `b`. + +## License + + MIT+ \ No newline at end of file diff --git a/node_modules/object-component/component.json b/node_modules/object-component/component.json @@ -0,0 +1,10 @@ +{ + "name": "object", + "description": "Object keys / values / length", + "version": "0.0.3", + "keywords": ["object", "keys", "utility"], + "dependencies": {}, + "scripts": [ + "index.js" + ] +}+ \ No newline at end of file diff --git a/node_modules/object-component/index.js b/node_modules/object-component/index.js @@ -0,0 +1,84 @@ + +/** + * HOP ref. + */ + +var has = Object.prototype.hasOwnProperty; + +/** + * Return own keys in `obj`. + * + * @param {Object} obj + * @return {Array} + * @api public + */ + +exports.keys = Object.keys || function(obj){ + var keys = []; + for (var key in obj) { + if (has.call(obj, key)) { + keys.push(key); + } + } + return keys; +}; + +/** + * Return own values in `obj`. + * + * @param {Object} obj + * @return {Array} + * @api public + */ + +exports.values = function(obj){ + var vals = []; + for (var key in obj) { + if (has.call(obj, key)) { + vals.push(obj[key]); + } + } + return vals; +}; + +/** + * Merge `b` into `a`. + * + * @param {Object} a + * @param {Object} b + * @return {Object} a + * @api public + */ + +exports.merge = function(a, b){ + for (var key in b) { + if (has.call(b, key)) { + a[key] = b[key]; + } + } + return a; +}; + +/** + * Return length of `obj`. + * + * @param {Object} obj + * @return {Number} + * @api public + */ + +exports.length = function(obj){ + return exports.keys(obj).length; +}; + +/** + * Check if `obj` is empty. + * + * @param {Object} obj + * @return {Boolean} + * @api public + */ + +exports.isEmpty = function(obj){ + return 0 == exports.length(obj); +};+ \ No newline at end of file diff --git a/node_modules/object-component/package.json b/node_modules/object-component/package.json @@ -0,0 +1,39 @@ +{ + "_from": "object-component@0.0.3", + "_id": "object-component@0.0.3", + "_inBundle": false, + "_integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "_location": "/object-component", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "object-component@0.0.3", + "name": "object-component", + "escapedName": "object-component", + "rawSpec": "0.0.3", + "saveSpec": null, + "fetchSpec": "0.0.3" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "_shasum": "f0c69aa50efc95b866c186f400a33769cb2f1291", + "_spec": "object-component@0.0.3", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "bundleDependencies": false, + "component": { + "scripts": { + "object/index.js": "index.js" + } + }, + "deprecated": false, + "description": "Object utils.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "name": "object-component", + "version": "0.0.3" +} diff --git a/node_modules/object-component/test/object.js b/node_modules/object-component/test/object.js @@ -0,0 +1,48 @@ + +/** + * Module dependencies. + */ + +var object = require('..'); + +describe('.keys(obj)', function(){ + it('should return the keys of an object', function(){ + var obj = { name: 'tobi', age: 1 }; + object.keys(obj).should.eql(['name', 'age']); + }) +}) + +describe('.values(obj)', function(){ + it('should return the values of an object', function(){ + var obj = { name: 'tobi', age: 1 }; + object.values(obj).should.eql(['tobi', 1]); + }) +}) + +describe('.length(obj)', function(){ + it('should return key count', function(){ + var obj = { name: 'tobi', age: 1 }; + object.length(obj).should.equal(2); + }) +}) + +describe('.merge(a, b)', function(){ + it('should merge two objects', function(){ + var a = { foo: 'bar' }; + var b = { bar: 'baz' }; + object.merge(a, b).should.eql({ foo: 'bar', bar: 'baz' }); + }) + + it('should give precedence to b', function(){ + var a = { foo: 'bar' }; + var b = { foo: 'baz' }; + object.merge(a, b).should.eql({ foo: 'baz' }); + }) +}) + +describe('.isEmpty()', function(){ + it('should check if the object is empty', function(){ + object.isEmpty({}).should.be.true; + object.isEmpty({ foo: 'bar' }).should.be.false; + }) +})+ \ No newline at end of file diff --git a/node_modules/parseqs/.npmignore b/node_modules/parseqs/.npmignore @@ -0,0 +1,3 @@ +.DS_Store +node_modules +npm-debug.log+ \ No newline at end of file diff --git a/node_modules/parseqs/LICENSE b/node_modules/parseqs/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Gal Koren + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/parseqs/Makefile b/node_modules/parseqs/Makefile @@ -0,0 +1,3 @@ + +test: + @./node_modules/.bin/mocha test.js diff --git a/node_modules/parseqs/README.md b/node_modules/parseqs/README.md @@ -0,0 +1 @@ +Provides methods for converting an object into string representation, and vice versa. diff --git a/node_modules/parseqs/index.js b/node_modules/parseqs/index.js @@ -0,0 +1,37 @@ +/** + * Compiles a querystring + * Returns string representation of the object + * + * @param {Object} + * @api private + */ + +exports.encode = function (obj) { + var str = ''; + + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (str.length) str += '&'; + str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); + } + } + + return str; +}; + +/** + * Parses a simple querystring into an object + * + * @param {String} qs + * @api private + */ + +exports.decode = function(qs){ + var qry = {}; + var pairs = qs.split('&'); + for (var i = 0, l = pairs.length; i < l; i++) { + var pair = pairs[i].split('='); + qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + return qry; +}; diff --git a/node_modules/parseqs/package.json b/node_modules/parseqs/package.json @@ -0,0 +1,53 @@ +{ + "_from": "parseqs@0.0.5", + "_id": "parseqs@0.0.5", + "_inBundle": false, + "_integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "_location": "/parseqs", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "parseqs@0.0.5", + "name": "parseqs", + "escapedName": "parseqs", + "rawSpec": "0.0.5", + "saveSpec": null, + "fetchSpec": "0.0.5" + }, + "_requiredBy": [ + "/engine.io-client", + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "_shasum": "d5208a3738e46766e291ba2ea173684921a8b89d", + "_spec": "parseqs@0.0.5", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "author": { + "name": "Gal Koren" + }, + "bugs": { + "url": "https://github.com/get/querystring/issues" + }, + "bundleDependencies": false, + "dependencies": { + "better-assert": "~1.0.0" + }, + "deprecated": false, + "description": "Provides methods for parsing a query string into an object, and vice versa.", + "devDependencies": { + "better-assert": "~1.0.0", + "mocha": "1.17.1" + }, + "homepage": "https://github.com/get/querystring", + "license": "MIT", + "name": "parseqs", + "repository": { + "type": "git", + "url": "git+https://github.com/get/querystring.git" + }, + "scripts": { + "test": "make test" + }, + "version": "0.0.5" +} diff --git a/node_modules/parseqs/test.js b/node_modules/parseqs/test.js @@ -0,0 +1,27 @@ +var assert = require('better-assert'); +var expect = require('expect.js'); +var util = require('./index.js'); + +describe('querystring test suite', function(){ + it('should parse a querystring and return an object', function () { + + // Single assignment + var queryObj = util.decode("foo=bar"); + expect(queryObj.foo).to.be("bar"); + + // Multiple assignments + queryObj = util.decode("france=paris&germany=berlin"); + expect(queryObj.france).to.be("paris"); + expect(queryObj.germany).to.be("berlin"); + + // Assignments containing non-alphanumeric characters + queryObj = util.decode("india=new%20delhi"); + expect(queryObj.india).to.be("new delhi"); + }); + + it('should construct a query string from an object', function () { + expect(util.encode({ a: 'b' })).to.be('a=b'); + expect(util.encode({ a: 'b', c: 'd' })).to.be('a=b&c=d'); + expect(util.encode({ a: 'b', c: 'tobi rocks' })).to.be('a=b&c=tobi%20rocks'); + }); +}); diff --git a/node_modules/parseuri/.npmignore b/node_modules/parseuri/.npmignore @@ -0,0 +1,2 @@ +.DS_Store +.node_modules/*+ \ No newline at end of file diff --git a/node_modules/parseuri/History.md b/node_modules/parseuri/History.md @@ -0,0 +1,5 @@ + +n.n.n / 2014-02-09 +================== + + * parseuri first commit diff --git a/node_modules/parseuri/LICENSE b/node_modules/parseuri/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Gal Koren + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/parseuri/Makefile b/node_modules/parseuri/Makefile @@ -0,0 +1,3 @@ + +test: + @./node_modules/.bin/mocha test.js diff --git a/node_modules/parseuri/README.md b/node_modules/parseuri/README.md @@ -0,0 +1,2 @@ +# parseuri +Module for parsing URI's in engine.io-client diff --git a/node_modules/parseuri/index.js b/node_modules/parseuri/index.js @@ -0,0 +1,39 @@ +/** + * Parses an URI + * + * @author Steven Levithan <stevenlevithan.com> (MIT license) + * @api private + */ + +var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; + +var parts = [ + 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor' +]; + +module.exports = function parseuri(str) { + var src = str, + b = str.indexOf('['), + e = str.indexOf(']'); + + if (b != -1 && e != -1) { + str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length); + } + + var m = re.exec(str || ''), + uri = {}, + i = 14; + + while (i--) { + uri[parts[i]] = m[i] || ''; + } + + if (b != -1 && e != -1) { + uri.source = src; + uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':'); + uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':'); + uri.ipv6uri = true; + } + + return uri; +}; diff --git a/node_modules/parseuri/package.json b/node_modules/parseuri/package.json @@ -0,0 +1,51 @@ +{ + "_from": "parseuri@0.0.5", + "_id": "parseuri@0.0.5", + "_inBundle": false, + "_integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "_location": "/parseuri", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "parseuri@0.0.5", + "name": "parseuri", + "escapedName": "parseuri", + "rawSpec": "0.0.5", + "saveSpec": null, + "fetchSpec": "0.0.5" + }, + "_requiredBy": [ + "/engine.io-client", + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "_shasum": "80204a50d4dbb779bfdc6ebe2778d90e4bce320a", + "_spec": "parseuri@0.0.5", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "author": "", + "bugs": { + "url": "https://github.com/get/parseuri/issues" + }, + "bundleDependencies": false, + "dependencies": { + "better-assert": "~1.0.0" + }, + "deprecated": false, + "description": "Method that parses a URI and returns an array of its components", + "devDependencies": { + "better-assert": "1.0.0", + "mocha": "1.17.1" + }, + "homepage": "https://github.com/get/parseuri", + "license": "MIT", + "name": "parseuri", + "repository": { + "type": "git", + "url": "git+https://github.com/get/parseuri.git" + }, + "scripts": { + "test": "make test" + }, + "version": "0.0.5" +} diff --git a/node_modules/parseuri/test.js b/node_modules/parseuri/test.js @@ -0,0 +1,51 @@ +var assert = require('better-assert'); +var expect = require('expect.js'); +var parseuri = require('./index.js'); + +describe('my suite', function(){ + it('should parse an uri', function () { + var http = parseuri('http://google.com') + , https = parseuri('https://www.google.com:80') + , query = parseuri('google.com:8080/foo/bar?foo=bar') + , localhost = parseuri('localhost:8080') + , ipv6 = parseuri('2001:0db8:85a3:0042:1000:8a2e:0370:7334') + , ipv6short = parseuri('2001:db8:85a3:42:1000:8a2e:370:7334') + , ipv6port = parseuri('2001:db8:85a3:42:1000:8a2e:370:7334:80') + , ipv6abbrev = parseuri('2001::7334:a:80') + , ipv6http = parseuri('http://[2001::7334:a]:80') + , ipv6query = parseuri('http://[2001::7334:a]:80/foo/bar?foo=bar') + + expect(http.protocol).to.be('http'); + expect(http.port).to.be(''); + expect(http.host).to.be('google.com'); + expect(https.protocol).to.be('https'); + expect(https.port).to.be('80'); + expect(https.host).to.be('www.google.com'); + expect(query.port).to.be('8080'); + expect(query.query).to.be('foo=bar'); + expect(query.path).to.be('/foo/bar'); + expect(query.relative).to.be('/foo/bar?foo=bar'); + expect(localhost.protocol).to.be(''); + expect(localhost.host).to.be('localhost'); + expect(localhost.port).to.be('8080'); + expect(ipv6.protocol).to.be(''); + expect(ipv6.host).to.be('2001:0db8:85a3:0042:1000:8a2e:0370:7334'); + expect(ipv6.port).to.be(''); + expect(ipv6short.protocol).to.be(''); + expect(ipv6short.host).to.be('2001:db8:85a3:42:1000:8a2e:370:7334'); + expect(ipv6short.port).to.be(''); + expect(ipv6port.protocol).to.be(''); + expect(ipv6port.host).to.be('2001:db8:85a3:42:1000:8a2e:370:7334'); + expect(ipv6port.port).to.be('80'); + expect(ipv6abbrev.protocol).to.be(''); + expect(ipv6abbrev.host).to.be('2001::7334:a:80'); + expect(ipv6abbrev.port).to.be(''); + expect(ipv6http.protocol).to.be('http'); + expect(ipv6http.port).to.be('80'); + expect(ipv6http.host).to.be('2001::7334:a'); + expect(ipv6query.protocol).to.be('http'); + expect(ipv6query.port).to.be('80'); + expect(ipv6query.host).to.be('2001::7334:a'); + expect(ipv6query.relative).to.be('/foo/bar?foo=bar'); + }); +}); diff --git a/node_modules/socket.io-adapter/.idea/$CACHE_FILE$ b/node_modules/socket.io-adapter/.idea/$CACHE_FILE$ @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectInspectionProfilesVisibleTreeState"> + <entry key="Project Default"> + <profile-state> + <expanded-state> + <State> + <id /> + </State> + <State> + <id>General</id> + </State> + <State> + <id>XPath</id> + </State> + </expanded-state> + <selected-state> + <State> + <id>AngularJS</id> + </State> + </selected-state> + </profile-state> + </entry> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/.idea/inspectionProfiles/profiles_settings.xml b/node_modules/socket.io-adapter/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,5 @@ +<component name="InspectionProjectProfileManager"> + <settings> + <option name="PROJECT_PROFILE" /> + </settings> +</component>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/.idea/misc.xml b/node_modules/socket.io-adapter/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="JavaScriptSettings"> + <option name="languageLevel" value="ES6" /> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/.idea/modules.xml b/node_modules/socket.io-adapter/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/socket.io-adapter.iml" filepath="$PROJECT_DIR$/.idea/socket.io-adapter.iml" /> + </modules> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/.idea/socket.io-adapter.iml b/node_modules/socket.io-adapter/.idea/socket.io-adapter.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="WEB_MODULE" version="4"> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/.tmp" /> + <excludeFolder url="file://$MODULE_DIR$/temp" /> + <excludeFolder url="file://$MODULE_DIR$/tmp" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/.idea/vcs.xml b/node_modules/socket.io-adapter/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/.idea/workspace.xml b/node_modules/socket.io-adapter/.idea/workspace.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <list default="true" id="8eb8a9e4-bb46-4154-84dd-8a1398682382" name="Default Changelist" comment=""> + <change afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" /> + </list> + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <option name="SHOW_DIALOG" value="false" /> + <option name="HIGHLIGHT_CONFLICTS" value="true" /> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> + <option name="LAST_RESOLUTION" value="IGNORE" /> + </component> + <component name="Git.Settings"> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> + </component> + <component name="JsFlowSettings"> + <service-enabled>true</service-enabled> + <exe-path /> + <annotation-enable>false</annotation-enable> + <other-services-enabled>true</other-services-enabled> + <auto-save>true</auto-save> + </component> + <component name="ProjectId" id="1U6jPzQEt3o8mt2AnrjVrsfgg2l" /> + <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> + <component name="PropertiesComponent"> + <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="nodejs_interpreter_path" value="$USER_HOME$/.nvm/versions/node/v6.10.3/bin/node" /> + <property name="settings.editor.selected.configurable" value="configurable.group.editor" /> + </component> + <component name="RunDashboard"> + <option name="ruleStates"> + <list> + <RuleState> + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> + </RuleState> + <RuleState> + <option name="name" value="StatusDashboardGroupingRule" /> + </RuleState> + </list> + </option> + </component> + <component name="SvnConfiguration"> + <configuration /> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"> + <changelist id="8eb8a9e4-bb46-4154-84dd-8a1398682382" name="Default Changelist" comment="" /> + <created>1574683918794</created> + <option name="number" value="Default" /> + <option name="presentableId" value="Default" /> + <updated>1574683918794</updated> + <workItem from="1574683921646" duration="413000" /> + </task> + <servers /> + </component> + <component name="TypeScriptGeneratedFilesManager"> + <option name="version" value="1" /> + </component> + <component name="Vcs.Log.Tabs.Properties"> + <option name="TAB_STATES"> + <map> + <entry key="MAIN"> + <value> + <State /> + </value> + </entry> + </map> + </option> + </component> +</project>+ \ No newline at end of file diff --git a/node_modules/socket.io-adapter/LICENSE b/node_modules/socket.io-adapter/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch <guillermo@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the 'Software'), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io-adapter/Readme.md b/node_modules/socket.io-adapter/Readme.md @@ -0,0 +1,16 @@ + +# socket.io-adapter + +Default socket.io in-memory adapter class. + +## How to use + +This module is not intended for end-user usage, but can be used as an +interface to inherit from other adapters you might want to build. + +As an example of an adapter that builds on top of this, please take a look +at [socket.io-redis](https://github.com/learnboost/socket.io-redis). + +## License + +MIT diff --git a/node_modules/socket.io-adapter/index.js b/node_modules/socket.io-adapter/index.js @@ -0,0 +1,263 @@ + +/** + * Module dependencies. + */ + +var Emitter = require('events').EventEmitter; + +/** + * Module exports. + */ + +module.exports = Adapter; + +/** + * Memory adapter constructor. + * + * @param {Namespace} nsp + * @api public + */ + +function Adapter(nsp){ + this.nsp = nsp; + this.rooms = {}; + this.sids = {}; + this.encoder = nsp.server.encoder; +} + +/** + * Inherits from `EventEmitter`. + */ + +Adapter.prototype.__proto__ = Emitter.prototype; + +/** + * Adds a socket to a room. + * + * @param {String} socket id + * @param {String} room name + * @param {Function} callback + * @api public + */ + +Adapter.prototype.add = function(id, room, fn){ + return this.addAll(id, [ room ], fn); +}; + +/** + * Adds a socket to a list of room. + * + * @param {String} socket id + * @param {String} rooms + * @param {Function} callback + * @api public + */ + +Adapter.prototype.addAll = function(id, rooms, fn){ + for (var i = 0; i < rooms.length; i++) { + var room = rooms[i]; + this.sids[id] = this.sids[id] || {}; + this.sids[id][room] = true; + this.rooms[room] = this.rooms[room] || Room(); + this.rooms[room].add(id); + } + if (fn) process.nextTick(fn.bind(null, null)); +}; + +/** + * Removes a socket from a room. + * + * @param {String} socket id + * @param {String} room name + * @param {Function} callback + * @api public + */ + +Adapter.prototype.del = function(id, room, fn){ + if (this.sids[id]) delete this.sids[id][room]; + + if (this.rooms.hasOwnProperty(room)) { + this.rooms[room].del(id); + if (this.rooms[room].length === 0) delete this.rooms[room]; + } + + if (fn) process.nextTick(fn.bind(null, null)); +}; + +/** + * Removes a socket from all rooms it's joined. + * + * @param {String} socket id + * @param {Function} callback + * @api public + */ + +Adapter.prototype.delAll = function(id, fn){ + var rooms = this.sids[id]; + if (rooms) { + for (var room in rooms) { + if (this.rooms.hasOwnProperty(room)) { + this.rooms[room].del(id); + if (this.rooms[room].length === 0) delete this.rooms[room]; + } + } + } + delete this.sids[id]; + + if (fn) process.nextTick(fn.bind(null, null)); +}; + +/** + * Broadcasts a packet. + * + * Options: + * - `flags` {Object} flags for this packet + * - `except` {Array} sids that should be excluded + * - `rooms` {Array} list of rooms to broadcast to + * + * @param {Object} packet object + * @api public + */ + +Adapter.prototype.broadcast = function(packet, opts){ + var rooms = opts.rooms || []; + var except = opts.except || []; + var flags = opts.flags || {}; + var packetOpts = { + preEncoded: true, + volatile: flags.volatile, + compress: flags.compress + }; + var ids = {}; + var self = this; + var socket; + + packet.nsp = this.nsp.name; + this.encoder.encode(packet, function(encodedPackets) { + if (rooms.length) { + for (var i = 0; i < rooms.length; i++) { + var room = self.rooms[rooms[i]]; + if (!room) continue; + var sockets = room.sockets; + for (var id in sockets) { + if (sockets.hasOwnProperty(id)) { + if (ids[id] || ~except.indexOf(id)) continue; + socket = self.nsp.connected[id]; + if (socket) { + socket.packet(encodedPackets, packetOpts); + ids[id] = true; + } + } + } + } + } else { + for (var id in self.sids) { + if (self.sids.hasOwnProperty(id)) { + if (~except.indexOf(id)) continue; + socket = self.nsp.connected[id]; + if (socket) socket.packet(encodedPackets, packetOpts); + } + } + } + }); +}; + +/** + * Gets a list of clients by sid. + * + * @param {Array} explicit set of rooms to check. + * @param {Function} callback + * @api public + */ + +Adapter.prototype.clients = function(rooms, fn){ + if ('function' == typeof rooms){ + fn = rooms; + rooms = null; + } + + rooms = rooms || []; + + var ids = {}; + var sids = []; + var socket; + + if (rooms.length) { + for (var i = 0; i < rooms.length; i++) { + var room = this.rooms[rooms[i]]; + if (!room) continue; + var sockets = room.sockets; + for (var id in sockets) { + if (sockets.hasOwnProperty(id)) { + if (ids[id]) continue; + socket = this.nsp.connected[id]; + if (socket) { + sids.push(id); + ids[id] = true; + } + } + } + } + } else { + for (var id in this.sids) { + if (this.sids.hasOwnProperty(id)) { + socket = this.nsp.connected[id]; + if (socket) sids.push(id); + } + } + } + + if (fn) process.nextTick(fn.bind(null, null, sids)); +}; + +/** + * Gets the list of rooms a given client has joined. + * + * @param {String} socket id + * @param {Function} callback + * @api public + */ +Adapter.prototype.clientRooms = function(id, fn){ + var rooms = this.sids[id]; + if (fn) process.nextTick(fn.bind(null, null, rooms ? Object.keys(rooms) : null)); +}; + +/** +* Room constructor. +* +* @api private +*/ + +function Room(){ + if (!(this instanceof Room)) return new Room(); + this.sockets = {}; + this.length = 0; +} + +/** + * Adds a socket to a room. + * + * @param {String} socket id + * @api private + */ + +Room.prototype.add = function(id){ + if (!this.sockets.hasOwnProperty(id)) { + this.sockets[id] = true; + this.length++; + } +}; + +/** + * Removes a socket from a room. + * + * @param {String} socket id + * @api private + */ + +Room.prototype.del = function(id){ + if (this.sockets.hasOwnProperty(id)) { + delete this.sockets[id]; + this.length--; + } +}; diff --git a/node_modules/socket.io-adapter/package.json b/node_modules/socket.io-adapter/package.json @@ -0,0 +1,39 @@ +{ + "_from": "socket.io-adapter@~1.1.0", + "_id": "socket.io-adapter@1.1.2", + "_inBundle": false, + "_integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==", + "_location": "/socket.io-adapter", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "socket.io-adapter@~1.1.0", + "name": "socket.io-adapter", + "escapedName": "socket.io-adapter", + "rawSpec": "~1.1.0", + "saveSpec": null, + "fetchSpec": "~1.1.0" + }, + "_requiredBy": [ + "/socket.io" + ], + "_resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", + "_shasum": "ab3f0d6f66b8fc7fca3959ab5991f82221789be9", + "_spec": "socket.io-adapter@~1.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io", + "bugs": { + "url": "https://github.com/socketio/socket.io-adapter/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "default socket.io in-memory adapter", + "homepage": "https://github.com/socketio/socket.io-adapter#readme", + "license": "MIT", + "name": "socket.io-adapter", + "repository": { + "type": "git", + "url": "git://github.com/socketio/socket.io-adapter.git" + }, + "version": "1.1.2" +} diff --git a/node_modules/socket.io-client/LICENSE b/node_modules/socket.io-client/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Guillermo Rauch + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.+ \ No newline at end of file diff --git a/node_modules/socket.io-client/README.md b/node_modules/socket.io-client/README.md @@ -0,0 +1,57 @@ + +# socket.io-client + +[![Build Status](https://secure.travis-ci.org/socketio/socket.io-client.svg?branch=master)](http://travis-ci.org/socketio/socket.io-client) +[![Dependency Status](https://david-dm.org/socketio/socket.io-client.svg)](https://david-dm.org/socketio/socket.io-client) +[![devDependency Status](https://david-dm.org/socketio/socket.io-client/dev-status.svg)](https://david-dm.org/socketio/socket.io-client#info=devDependencies) +[![NPM version](https://badge.fury.io/js/socket.io-client.svg)](https://www.npmjs.com/package/socket.io-client) +![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg?style=flat) +[![](http://slack.socket.io/badge.svg?)](http://slack.socket.io) + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/socket.svg)](https://saucelabs.com/u/socket) + +## How to use + +A standalone build of `socket.io-client` is exposed automatically by the +socket.io server as `/socket.io/socket.io.js`. Alternatively you can +serve the file `socket.io.js` found in the `dist` folder or include it via [CDN](https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js). + +```html +<script src="/socket.io/socket.io.js"></script> +<script> + var socket = io('http://localhost'); + socket.on('connect', function(){}); + socket.on('event', function(data){}); + socket.on('disconnect', function(){}); +</script> +``` + +```js +// with ES6 import +import io from 'socket.io-client'; + +const socket = io('http://localhost'); +``` + +A slim build (without `JSON3`, a JSON polyfill for IE6/IE7, and `debug`) is also available: `socket.io.slim.js`. + +Socket.IO is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/) (see example [there](https://github.com/socketio/socket.io/tree/2.0.3/examples/webpack-build)). + +### Node.JS (server-side usage) + + Add `socket.io-client` to your `package.json` and then: + + ```js + var socket = require('socket.io-client')('http://localhost'); + socket.on('connect', function(){}); + socket.on('event', function(data){}); + socket.on('disconnect', function(){}); + ``` + +## API + +See [API](/docs/API.md) + +## License + +[MIT](/LICENSE) diff --git a/node_modules/socket.io-client/dist/socket.io.dev.js b/node_modules/socket.io-client/dist/socket.io.dev.js @@ -0,0 +1,7254 @@ +/*! + * Socket.IO v2.3.0 + * (c) 2014-2019 Guillermo Rauch + * Released under the MIT License. + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["io"] = factory(); + else + root["io"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var url = __webpack_require__(1); + var parser = __webpack_require__(7); + var Manager = __webpack_require__(15); + var debug = __webpack_require__(3)('socket.io-client'); + + /** + * Module exports. + */ + + module.exports = exports = lookup; + + /** + * Managers cache. + */ + + var cache = exports.managers = {}; + + /** + * Looks up an existing `Manager` for multiplexing. + * If the user summons: + * + * `io('http://localhost/a');` + * `io('http://localhost/b');` + * + * We reuse the existing instance based on same scheme/port/host, + * and we initialize sockets for each namespace. + * + * @api public + */ + + function lookup (uri, opts) { + if (typeof uri === 'object') { + opts = uri; + uri = undefined; + } + + opts = opts || {}; + + var parsed = url(uri); + var source = parsed.source; + var id = parsed.id; + var path = parsed.path; + var sameNamespace = cache[id] && path in cache[id].nsps; + var newConnection = opts.forceNew || opts['force new connection'] || + false === opts.multiplex || sameNamespace; + + var io; + + if (newConnection) { + debug('ignoring socket cache for %s', source); + io = Manager(source, opts); + } else { + if (!cache[id]) { + debug('new io instance for %s', source); + cache[id] = Manager(source, opts); + } + io = cache[id]; + } + if (parsed.query && !opts.query) { + opts.query = parsed.query; + } + return io.socket(parsed.path, opts); + } + + /** + * Protocol version. + * + * @api public + */ + + exports.protocol = parser.protocol; + + /** + * `connect`. + * + * @param {String} uri + * @api public + */ + + exports.connect = lookup; + + /** + * Expose constructors for standalone build. + * + * @api public + */ + + exports.Manager = __webpack_require__(15); + exports.Socket = __webpack_require__(39); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var parseuri = __webpack_require__(2); + var debug = __webpack_require__(3)('socket.io-client:url'); + + /** + * Module exports. + */ + + module.exports = url; + + /** + * URL parser. + * + * @param {String} url + * @param {Object} An object meant to mimic window.location. + * Defaults to window.location. + * @api public + */ + + function url (uri, loc) { + var obj = uri; + + // default to window.location + loc = loc || (typeof location !== 'undefined' && location); + if (null == uri) uri = loc.protocol + '//' + loc.host; + + // relative path support + if ('string' === typeof uri) { + if ('/' === uri.charAt(0)) { + if ('/' === uri.charAt(1)) { + uri = loc.protocol + uri; + } else { + uri = loc.host + uri; + } + } + + if (!/^(https?|wss?):\/\//.test(uri)) { + debug('protocol-less url %s', uri); + if ('undefined' !== typeof loc) { + uri = loc.protocol + '//' + uri; + } else { + uri = 'https://' + uri; + } + } + + // parse + debug('parse %s', uri); + obj = parseuri(uri); + } + + // make sure we treat `localhost:80` and `localhost` equally + if (!obj.port) { + if (/^(http|ws)$/.test(obj.protocol)) { + obj.port = '80'; + } else if (/^(http|ws)s$/.test(obj.protocol)) { + obj.port = '443'; + } + } + + obj.path = obj.path || '/'; + + var ipv6 = obj.host.indexOf(':') !== -1; + var host = ipv6 ? '[' + obj.host + ']' : obj.host; + + // define unique id + obj.id = obj.protocol + '://' + host + ':' + obj.port; + // define href + obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port)); + + return obj; + } + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + + /** + * Parses an URI + * + * @author Steven Levithan <stevenlevithan.com> (MIT license) + * @api private + */ + + var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; + + var parts = [ + 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor' + ]; + + module.exports = function parseuri(str) { + var src = str, + b = str.indexOf('['), + e = str.indexOf(']'); + + if (b != -1 && e != -1) { + str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length); + } + + var m = re.exec(str || ''), + uri = {}, + i = 14; + + while (i--) { + uri[parts[i]] = m[i] || ''; + } + + if (b != -1 && e != -1) { + uri.source = src; + uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':'); + uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':'); + uri.ipv6uri = true; + } + + return uri; + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + // eslint-disable-next-line complexity + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || + // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || + // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === 'undefined' ? 'undefined' : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + function load() { + var r = void 0; + try { + r = exports.storage.getItem('debug'); + } catch (error) {} + // Swallow + // XXX (@Qix-) should we be logging these? + + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = __webpack_require__(5)(exports); + + var formatters = module.exports.formatters; + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __webpack_require__(6); + + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + var prevTime = void 0; + + function debug() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; + + // Set `diff` timestamp + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + var formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + var i = void 0; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i = void 0; + var len = void 0; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; + } + + module.exports = setup; + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + + /** + * Helpers. + */ + + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); + }; + + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; + } + + /** + * Pluralization helper. + */ + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var debug = __webpack_require__(8)('socket.io-parser'); + var Emitter = __webpack_require__(11); + var binary = __webpack_require__(12); + var isArray = __webpack_require__(13); + var isBuf = __webpack_require__(14); + + /** + * Protocol version. + * + * @api public + */ + + exports.protocol = 4; + + /** + * Packet types. + * + * @api public + */ + + exports.types = [ + 'CONNECT', + 'DISCONNECT', + 'EVENT', + 'ACK', + 'ERROR', + 'BINARY_EVENT', + 'BINARY_ACK' + ]; + + /** + * Packet type `connect`. + * + * @api public + */ + + exports.CONNECT = 0; + + /** + * Packet type `disconnect`. + * + * @api public + */ + + exports.DISCONNECT = 1; + + /** + * Packet type `event`. + * + * @api public + */ + + exports.EVENT = 2; + + /** + * Packet type `ack`. + * + * @api public + */ + + exports.ACK = 3; + + /** + * Packet type `error`. + * + * @api public + */ + + exports.ERROR = 4; + + /** + * Packet type 'binary event' + * + * @api public + */ + + exports.BINARY_EVENT = 5; + + /** + * Packet type `binary ack`. For acks with binary arguments. + * + * @api public + */ + + exports.BINARY_ACK = 6; + + /** + * Encoder constructor. + * + * @api public + */ + + exports.Encoder = Encoder; + + /** + * Decoder constructor. + * + * @api public + */ + + exports.Decoder = Decoder; + + /** + * A socket.io Encoder instance + * + * @api public + */ + + function Encoder() {} + + var ERROR_PACKET = exports.ERROR + '"encode error"'; + + /** + * Encode a packet as a single string if non-binary, or as a + * buffer sequence, depending on packet type. + * + * @param {Object} obj - packet object + * @param {Function} callback - function to handle encodings (likely engine.write) + * @return Calls callback with Array of encodings + * @api public + */ + + Encoder.prototype.encode = function(obj, callback){ + debug('encoding packet %j', obj); + + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + encodeAsBinary(obj, callback); + } else { + var encoding = encodeAsString(obj); + callback([encoding]); + } + }; + + /** + * Encode packet as string. + * + * @param {Object} packet + * @return {String} encoded + * @api private + */ + + function encodeAsString(obj) { + + // first is type + var str = '' + obj.type; + + // attachments if we have them + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + str += obj.attachments + '-'; + } + + // if we have a namespace other than `/` + // we append it followed by a comma `,` + if (obj.nsp && '/' !== obj.nsp) { + str += obj.nsp + ','; + } + + // immediately followed by the id + if (null != obj.id) { + str += obj.id; + } + + // json data + if (null != obj.data) { + var payload = tryStringify(obj.data); + if (payload !== false) { + str += payload; + } else { + return ERROR_PACKET; + } + } + + debug('encoded %j as %s', obj, str); + return str; + } + + function tryStringify(str) { + try { + return JSON.stringify(str); + } catch(e){ + return false; + } + } + + /** + * Encode packet as 'buffer sequence' by removing blobs, and + * deconstructing packet into object with placeholders and + * a list of buffers. + * + * @param {Object} packet + * @return {Buffer} encoded + * @api private + */ + + function encodeAsBinary(obj, callback) { + + function writeEncoding(bloblessData) { + var deconstruction = binary.deconstructPacket(bloblessData); + var pack = encodeAsString(deconstruction.packet); + var buffers = deconstruction.buffers; + + buffers.unshift(pack); // add packet info to beginning of data list + callback(buffers); // write all the buffers + } + + binary.removeBlobs(obj, writeEncoding); + } + + /** + * A socket.io Decoder instance + * + * @return {Object} decoder + * @api public + */ + + function Decoder() { + this.reconstructor = null; + } + + /** + * Mix in `Emitter` with Decoder. + */ + + Emitter(Decoder.prototype); + + /** + * Decodes an encoded packet string into packet JSON. + * + * @param {String} obj - encoded packet + * @return {Object} packet + * @api public + */ + + Decoder.prototype.add = function(obj) { + var packet; + if (typeof obj === 'string') { + packet = decodeString(obj); + if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json + this.reconstructor = new BinaryReconstructor(packet); + + // no attachments, labeled binary but no binary data to follow + if (this.reconstructor.reconPack.attachments === 0) { + this.emit('decoded', packet); + } + } else { // non-binary full packet + this.emit('decoded', packet); + } + } else if (isBuf(obj) || obj.base64) { // raw binary data + if (!this.reconstructor) { + throw new Error('got binary data when not reconstructing a packet'); + } else { + packet = this.reconstructor.takeBinaryData(obj); + if (packet) { // received final buffer + this.reconstructor = null; + this.emit('decoded', packet); + } + } + } else { + throw new Error('Unknown type: ' + obj); + } + }; + + /** + * Decode a packet String (JSON data) + * + * @param {String} str + * @return {Object} packet + * @api private + */ + + function decodeString(str) { + var i = 0; + // look up type + var p = { + type: Number(str.charAt(0)) + }; + + if (null == exports.types[p.type]) { + return error('unknown packet type ' + p.type); + } + + // look up attachments if type binary + if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) { + var buf = ''; + while (str.charAt(++i) !== '-') { + buf += str.charAt(i); + if (i == str.length) break; + } + if (buf != Number(buf) || str.charAt(i) !== '-') { + throw new Error('Illegal attachments'); + } + p.attachments = Number(buf); + } + + // look up namespace (if any) + if ('/' === str.charAt(i + 1)) { + p.nsp = ''; + while (++i) { + var c = str.charAt(i); + if (',' === c) break; + p.nsp += c; + if (i === str.length) break; + } + } else { + p.nsp = '/'; + } + + // look up id + var next = str.charAt(i + 1); + if ('' !== next && Number(next) == next) { + p.id = ''; + while (++i) { + var c = str.charAt(i); + if (null == c || Number(c) != c) { + --i; + break; + } + p.id += str.charAt(i); + if (i === str.length) break; + } + p.id = Number(p.id); + } + + // look up json data + if (str.charAt(++i)) { + var payload = tryParse(str.substr(i)); + var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload)); + if (isPayloadValid) { + p.data = payload; + } else { + return error('invalid payload'); + } + } + + debug('decoded %s as %j', str, p); + return p; + } + + function tryParse(str) { + try { + return JSON.parse(str); + } catch(e){ + return false; + } + } + + /** + * Deallocates a parser's resources + * + * @api public + */ + + Decoder.prototype.destroy = function() { + if (this.reconstructor) { + this.reconstructor.finishedReconstruction(); + } + }; + + /** + * A manager of a binary event's 'buffer sequence'. Should + * be constructed whenever a packet of type BINARY_EVENT is + * decoded. + * + * @param {Object} packet + * @return {BinaryReconstructor} initialized reconstructor + * @api private + */ + + function BinaryReconstructor(packet) { + this.reconPack = packet; + this.buffers = []; + } + + /** + * Method to be called when binary data received from connection + * after a BINARY_EVENT packet. + * + * @param {Buffer | ArrayBuffer} binData - the raw binary data received + * @return {null | Object} returns null if more binary data is expected or + * a reconstructed packet object if all buffers have been received. + * @api private + */ + + BinaryReconstructor.prototype.takeBinaryData = function(binData) { + this.buffers.push(binData); + if (this.buffers.length === this.reconPack.attachments) { // done with buffer list + var packet = binary.reconstructPacket(this.reconPack, this.buffers); + this.finishedReconstruction(); + return packet; + } + return null; + }; + + /** + * Cleans up binary packet reconstruction variables. + * + * @api private + */ + + BinaryReconstructor.prototype.finishedReconstruction = function() { + this.reconPack = null; + this.buffers = []; + }; + + function error(msg) { + return { + type: exports.ERROR, + data: 'parser error: ' + msg + }; + } + + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = __webpack_require__(9); + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); + + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || + // is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || + // double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + exports.formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } + }; + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === 'undefined' ? 'undefined' : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch (e) {} + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + function load() { + var r; + try { + r = exports.storage.debug; + } catch (e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ + + exports.enable(load()); + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage() { + try { + return window.localStorage; + } catch (e) {} + } + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = __webpack_require__(10); + + /** + * Active `debug` instances. + */ + exports.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + exports.names = []; + exports.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + exports.formatters = {}; + + /** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + + function selectColor(namespace) { + var hash = 0, + i; + + for (i in namespace) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; + } + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; + } + + function destroy() { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @api public + */ + + function disable() { + exports.enable(''); + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + + /** + * Helpers. + */ + + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); + }; + + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; + } + + /** + * Pluralization helper. + */ + + function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; + } + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + if (true) { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + /*global Blob,File*/ + + /** + * Module requirements + */ + + var isArray = __webpack_require__(13); + var isBuf = __webpack_require__(14); + var toString = Object.prototype.toString; + var withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'); + var withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'); + + /** + * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder. + * Anything with blobs or files should be fed through removeBlobs before coming + * here. + * + * @param {Object} packet - socket.io event packet + * @return {Object} with deconstructed packet and list of buffers + * @api public + */ + + exports.deconstructPacket = function(packet) { + var buffers = []; + var packetData = packet.data; + var pack = packet; + pack.data = _deconstructPacket(packetData, buffers); + pack.attachments = buffers.length; // number of binary 'attachments' + return {packet: pack, buffers: buffers}; + }; + + function _deconstructPacket(data, buffers) { + if (!data) return data; + + if (isBuf(data)) { + var placeholder = { _placeholder: true, num: buffers.length }; + buffers.push(data); + return placeholder; + } else if (isArray(data)) { + var newData = new Array(data.length); + for (var i = 0; i < data.length; i++) { + newData[i] = _deconstructPacket(data[i], buffers); + } + return newData; + } else if (typeof data === 'object' && !(data instanceof Date)) { + var newData = {}; + for (var key in data) { + newData[key] = _deconstructPacket(data[key], buffers); + } + return newData; + } + return data; + } + + /** + * Reconstructs a binary packet from its placeholder packet and buffers + * + * @param {Object} packet - event packet with placeholders + * @param {Array} buffers - binary buffers to put in placeholder positions + * @return {Object} reconstructed packet + * @api public + */ + + exports.reconstructPacket = function(packet, buffers) { + packet.data = _reconstructPacket(packet.data, buffers); + packet.attachments = undefined; // no longer useful + return packet; + }; + + function _reconstructPacket(data, buffers) { + if (!data) return data; + + if (data && data._placeholder) { + return buffers[data.num]; // appropriate buffer (should be natural order anyway) + } else if (isArray(data)) { + for (var i = 0; i < data.length; i++) { + data[i] = _reconstructPacket(data[i], buffers); + } + } else if (typeof data === 'object') { + for (var key in data) { + data[key] = _reconstructPacket(data[key], buffers); + } + } + + return data; + } + + /** + * Asynchronously removes Blobs or Files from data via + * FileReader's readAsArrayBuffer method. Used before encoding + * data as msgpack. Calls callback with the blobless data. + * + * @param {Object} data + * @param {Function} callback + * @api private + */ + + exports.removeBlobs = function(data, callback) { + function _removeBlobs(obj, curKey, containingObject) { + if (!obj) return obj; + + // convert any blob + if ((withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File)) { + pendingBlobs++; + + // async filereader + var fileReader = new FileReader(); + fileReader.onload = function() { // this.result == arraybuffer + if (containingObject) { + containingObject[curKey] = this.result; + } + else { + bloblessData = this.result; + } + + // if nothing pending its callback time + if(! --pendingBlobs) { + callback(bloblessData); + } + }; + + fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer + } else if (isArray(obj)) { // handle array + for (var i = 0; i < obj.length; i++) { + _removeBlobs(obj[i], i, obj); + } + } else if (typeof obj === 'object' && !isBuf(obj)) { // and object + for (var key in obj) { + _removeBlobs(obj[key], key, obj); + } + } + } + + var pendingBlobs = 0; + var bloblessData = data; + _removeBlobs(bloblessData); + if (!pendingBlobs) { + callback(bloblessData); + } + }; + + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + + var toString = {}.toString; + + module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + + + module.exports = isBuf; + + var withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function'; + var withNativeArrayBuffer = typeof ArrayBuffer === 'function'; + + var isView = function (obj) { + return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer); + }; + + /** + * Returns true if obj is a buffer or an arraybuffer. + * + * @api private + */ + + function isBuf(obj) { + return (withNativeBuffer && Buffer.isBuffer(obj)) || + (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))); + } + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var eio = __webpack_require__(16); + var Socket = __webpack_require__(39); + var Emitter = __webpack_require__(11); + var parser = __webpack_require__(7); + var on = __webpack_require__(41); + var bind = __webpack_require__(42); + var debug = __webpack_require__(3)('socket.io-client:manager'); + var indexOf = __webpack_require__(38); + var Backoff = __webpack_require__(43); + + /** + * IE6+ hasOwnProperty + */ + + var has = Object.prototype.hasOwnProperty; + + /** + * Module exports + */ + + module.exports = Manager; + + /** + * `Manager` constructor. + * + * @param {String} engine instance or engine uri/opts + * @param {Object} options + * @api public + */ + + function Manager (uri, opts) { + if (!(this instanceof Manager)) return new Manager(uri, opts); + if (uri && ('object' === typeof uri)) { + opts = uri; + uri = undefined; + } + opts = opts || {}; + + opts.path = opts.path || '/socket.io'; + this.nsps = {}; + this.subs = []; + this.opts = opts; + this.reconnection(opts.reconnection !== false); + this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); + this.reconnectionDelay(opts.reconnectionDelay || 1000); + this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); + this.randomizationFactor(opts.randomizationFactor || 0.5); + this.backoff = new Backoff({ + min: this.reconnectionDelay(), + max: this.reconnectionDelayMax(), + jitter: this.randomizationFactor() + }); + this.timeout(null == opts.timeout ? 20000 : opts.timeout); + this.readyState = 'closed'; + this.uri = uri; + this.connecting = []; + this.lastPing = null; + this.encoding = false; + this.packetBuffer = []; + var _parser = opts.parser || parser; + this.encoder = new _parser.Encoder(); + this.decoder = new _parser.Decoder(); + this.autoConnect = opts.autoConnect !== false; + if (this.autoConnect) this.open(); + } + + /** + * Propagate given event to sockets and emit on `this` + * + * @api private + */ + + Manager.prototype.emitAll = function () { + this.emit.apply(this, arguments); + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); + } + } + }; + + /** + * Update `socket.id` of all sockets + * + * @api private + */ + + Manager.prototype.updateSocketIds = function () { + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].id = this.generateId(nsp); + } + } + }; + + /** + * generate `socket.id` for the given `nsp` + * + * @param {String} nsp + * @return {String} + * @api private + */ + + Manager.prototype.generateId = function (nsp) { + return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id; + }; + + /** + * Mix in `Emitter`. + */ + + Emitter(Manager.prototype); + + /** + * Sets the `reconnection` config. + * + * @param {Boolean} true/false if it should automatically reconnect + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnection = function (v) { + if (!arguments.length) return this._reconnection; + this._reconnection = !!v; + return this; + }; + + /** + * Sets the reconnection attempts config. + * + * @param {Number} max reconnection attempts before giving up + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnectionAttempts = function (v) { + if (!arguments.length) return this._reconnectionAttempts; + this._reconnectionAttempts = v; + return this; + }; + + /** + * Sets the delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnectionDelay = function (v) { + if (!arguments.length) return this._reconnectionDelay; + this._reconnectionDelay = v; + this.backoff && this.backoff.setMin(v); + return this; + }; + + Manager.prototype.randomizationFactor = function (v) { + if (!arguments.length) return this._randomizationFactor; + this._randomizationFactor = v; + this.backoff && this.backoff.setJitter(v); + return this; + }; + + /** + * Sets the maximum delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnectionDelayMax = function (v) { + if (!arguments.length) return this._reconnectionDelayMax; + this._reconnectionDelayMax = v; + this.backoff && this.backoff.setMax(v); + return this; + }; + + /** + * Sets the connection timeout. `false` to disable + * + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.timeout = function (v) { + if (!arguments.length) return this._timeout; + this._timeout = v; + return this; + }; + + /** + * Starts trying to reconnect if reconnection is enabled and we have not + * started reconnecting yet + * + * @api private + */ + + Manager.prototype.maybeReconnectOnOpen = function () { + // Only try to reconnect if it's the first time we're connecting + if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) { + // keeps reconnection from firing twice for the same reconnection loop + this.reconnect(); + } + }; + + /** + * Sets the current transport `socket`. + * + * @param {Function} optional, callback + * @return {Manager} self + * @api public + */ + + Manager.prototype.open = + Manager.prototype.connect = function (fn, opts) { + debug('readyState %s', this.readyState); + if (~this.readyState.indexOf('open')) return this; + + debug('opening %s', this.uri); + this.engine = eio(this.uri, this.opts); + var socket = this.engine; + var self = this; + this.readyState = 'opening'; + this.skipReconnect = false; + + // emit `open` + var openSub = on(socket, 'open', function () { + self.onopen(); + fn && fn(); + }); + + // emit `connect_error` + var errorSub = on(socket, 'error', function (data) { + debug('connect_error'); + self.cleanup(); + self.readyState = 'closed'; + self.emitAll('connect_error', data); + if (fn) { + var err = new Error('Connection error'); + err.data = data; + fn(err); + } else { + // Only do this if there is no fn to handle the error + self.maybeReconnectOnOpen(); + } + }); + + // emit `connect_timeout` + if (false !== this._timeout) { + var timeout = this._timeout; + debug('connect attempt will timeout after %d', timeout); + + // set timer + var timer = setTimeout(function () { + debug('connect attempt timed out after %d', timeout); + openSub.destroy(); + socket.close(); + socket.emit('error', 'timeout'); + self.emitAll('connect_timeout', timeout); + }, timeout); + + this.subs.push({ + destroy: function () { + clearTimeout(timer); + } + }); + } + + this.subs.push(openSub); + this.subs.push(errorSub); + + return this; + }; + + /** + * Called upon transport open. + * + * @api private + */ + + Manager.prototype.onopen = function () { + debug('open'); + + // clear old subs + this.cleanup(); + + // mark as open + this.readyState = 'open'; + this.emit('open'); + + // add new subs + var socket = this.engine; + this.subs.push(on(socket, 'data', bind(this, 'ondata'))); + this.subs.push(on(socket, 'ping', bind(this, 'onping'))); + this.subs.push(on(socket, 'pong', bind(this, 'onpong'))); + this.subs.push(on(socket, 'error', bind(this, 'onerror'))); + this.subs.push(on(socket, 'close', bind(this, 'onclose'))); + this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); + }; + + /** + * Called upon a ping. + * + * @api private + */ + + Manager.prototype.onping = function () { + this.lastPing = new Date(); + this.emitAll('ping'); + }; + + /** + * Called upon a packet. + * + * @api private + */ + + Manager.prototype.onpong = function () { + this.emitAll('pong', new Date() - this.lastPing); + }; + + /** + * Called with data. + * + * @api private + */ + + Manager.prototype.ondata = function (data) { + this.decoder.add(data); + }; + + /** + * Called when parser fully decodes a packet. + * + * @api private + */ + + Manager.prototype.ondecoded = function (packet) { + this.emit('packet', packet); + }; + + /** + * Called upon socket error. + * + * @api private + */ + + Manager.prototype.onerror = function (err) { + debug('error', err); + this.emitAll('error', err); + }; + + /** + * Creates a new socket for the given `nsp`. + * + * @return {Socket} + * @api public + */ + + Manager.prototype.socket = function (nsp, opts) { + var socket = this.nsps[nsp]; + if (!socket) { + socket = new Socket(this, nsp, opts); + this.nsps[nsp] = socket; + var self = this; + socket.on('connecting', onConnecting); + socket.on('connect', function () { + socket.id = self.generateId(nsp); + }); + + if (this.autoConnect) { + // manually call here since connecting event is fired before listening + onConnecting(); + } + } + + function onConnecting () { + if (!~indexOf(self.connecting, socket)) { + self.connecting.push(socket); + } + } + + return socket; + }; + + /** + * Called upon a socket close. + * + * @param {Socket} socket + */ + + Manager.prototype.destroy = function (socket) { + var index = indexOf(this.connecting, socket); + if (~index) this.connecting.splice(index, 1); + if (this.connecting.length) return; + + this.close(); + }; + + /** + * Writes a packet. + * + * @param {Object} packet + * @api private + */ + + Manager.prototype.packet = function (packet) { + debug('writing packet %j', packet); + var self = this; + if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query; + + if (!self.encoding) { + // encode, then write to engine with result + self.encoding = true; + this.encoder.encode(packet, function (encodedPackets) { + for (var i = 0; i < encodedPackets.length; i++) { + self.engine.write(encodedPackets[i], packet.options); + } + self.encoding = false; + self.processPacketQueue(); + }); + } else { // add packet to the queue + self.packetBuffer.push(packet); + } + }; + + /** + * If packet buffer is non-empty, begins encoding the + * next packet in line. + * + * @api private + */ + + Manager.prototype.processPacketQueue = function () { + if (this.packetBuffer.length > 0 && !this.encoding) { + var pack = this.packetBuffer.shift(); + this.packet(pack); + } + }; + + /** + * Clean up transport subscriptions and packet buffer. + * + * @api private + */ + + Manager.prototype.cleanup = function () { + debug('cleanup'); + + var subsLength = this.subs.length; + for (var i = 0; i < subsLength; i++) { + var sub = this.subs.shift(); + sub.destroy(); + } + + this.packetBuffer = []; + this.encoding = false; + this.lastPing = null; + + this.decoder.destroy(); + }; + + /** + * Close the current socket. + * + * @api private + */ + + Manager.prototype.close = + Manager.prototype.disconnect = function () { + debug('disconnect'); + this.skipReconnect = true; + this.reconnecting = false; + if ('opening' === this.readyState) { + // `onclose` will not fire because + // an open event never happened + this.cleanup(); + } + this.backoff.reset(); + this.readyState = 'closed'; + if (this.engine) this.engine.close(); + }; + + /** + * Called upon engine close. + * + * @api private + */ + + Manager.prototype.onclose = function (reason) { + debug('onclose'); + + this.cleanup(); + this.backoff.reset(); + this.readyState = 'closed'; + this.emit('close', reason); + + if (this._reconnection && !this.skipReconnect) { + this.reconnect(); + } + }; + + /** + * Attempt a reconnection. + * + * @api private + */ + + Manager.prototype.reconnect = function () { + if (this.reconnecting || this.skipReconnect) return this; + + var self = this; + + if (this.backoff.attempts >= this._reconnectionAttempts) { + debug('reconnect failed'); + this.backoff.reset(); + this.emitAll('reconnect_failed'); + this.reconnecting = false; + } else { + var delay = this.backoff.duration(); + debug('will wait %dms before reconnect attempt', delay); + + this.reconnecting = true; + var timer = setTimeout(function () { + if (self.skipReconnect) return; + + debug('attempting reconnect'); + self.emitAll('reconnect_attempt', self.backoff.attempts); + self.emitAll('reconnecting', self.backoff.attempts); + + // check again for the case socket closed in above events + if (self.skipReconnect) return; + + self.open(function (err) { + if (err) { + debug('reconnect attempt error'); + self.reconnecting = false; + self.reconnect(); + self.emitAll('reconnect_error', err.data); + } else { + debug('reconnect success'); + self.onreconnect(); + } + }); + }, delay); + + this.subs.push({ + destroy: function () { + clearTimeout(timer); + } + }); + } + }; + + /** + * Called upon successful reconnect. + * + * @api private + */ + + Manager.prototype.onreconnect = function () { + var attempt = this.backoff.attempts; + this.reconnecting = false; + this.backoff.reset(); + this.updateSocketIds(); + this.emitAll('reconnect', attempt); + }; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + + + module.exports = __webpack_require__(17); + + /** + * Exports parser + * + * @api public + * + */ + module.exports.parser = __webpack_require__(24); + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var transports = __webpack_require__(18); + var Emitter = __webpack_require__(11); + var debug = __webpack_require__(3)('engine.io-client:socket'); + var index = __webpack_require__(38); + var parser = __webpack_require__(24); + var parseuri = __webpack_require__(2); + var parseqs = __webpack_require__(32); + + /** + * Module exports. + */ + + module.exports = Socket; + + /** + * Socket constructor. + * + * @param {String|Object} uri or options + * @param {Object} options + * @api public + */ + + function Socket (uri, opts) { + if (!(this instanceof Socket)) return new Socket(uri, opts); + + opts = opts || {}; + + if (uri && 'object' === typeof uri) { + opts = uri; + uri = null; + } + + if (uri) { + uri = parseuri(uri); + opts.hostname = uri.host; + opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; + opts.port = uri.port; + if (uri.query) opts.query = uri.query; + } else if (opts.host) { + opts.hostname = parseuri(opts.host).host; + } + + this.secure = null != opts.secure ? opts.secure + : (typeof location !== 'undefined' && 'https:' === location.protocol); + + if (opts.hostname && !opts.port) { + // if no port is specified manually, use the protocol default + opts.port = this.secure ? '443' : '80'; + } + + this.agent = opts.agent || false; + this.hostname = opts.hostname || + (typeof location !== 'undefined' ? location.hostname : 'localhost'); + this.port = opts.port || (typeof location !== 'undefined' && location.port + ? location.port + : (this.secure ? 443 : 80)); + this.query = opts.query || {}; + if ('string' === typeof this.query) this.query = parseqs.decode(this.query); + this.upgrade = false !== opts.upgrade; + this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; + this.forceJSONP = !!opts.forceJSONP; + this.jsonp = false !== opts.jsonp; + this.forceBase64 = !!opts.forceBase64; + this.enablesXDR = !!opts.enablesXDR; + this.withCredentials = false !== opts.withCredentials; + this.timestampParam = opts.timestampParam || 't'; + this.timestampRequests = opts.timestampRequests; + this.transports = opts.transports || ['polling', 'websocket']; + this.transportOptions = opts.transportOptions || {}; + this.readyState = ''; + this.writeBuffer = []; + this.prevBufferLen = 0; + this.policyPort = opts.policyPort || 843; + this.rememberUpgrade = opts.rememberUpgrade || false; + this.binaryType = null; + this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; + this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; + + if (true === this.perMessageDeflate) this.perMessageDeflate = {}; + if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { + this.perMessageDeflate.threshold = 1024; + } + + // SSL options for Node.js client + this.pfx = opts.pfx || null; + this.key = opts.key || null; + this.passphrase = opts.passphrase || null; + this.cert = opts.cert || null; + this.ca = opts.ca || null; + this.ciphers = opts.ciphers || null; + this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; + this.forceNode = !!opts.forceNode; + + // detect ReactNative environment + this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative'); + + // other options for Node.js or ReactNative client + if (typeof self === 'undefined' || this.isReactNative) { + if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { + this.extraHeaders = opts.extraHeaders; + } + + if (opts.localAddress) { + this.localAddress = opts.localAddress; + } + } + + // set on handshake + this.id = null; + this.upgrades = null; + this.pingInterval = null; + this.pingTimeout = null; + + // set on heartbeat + this.pingIntervalTimer = null; + this.pingTimeoutTimer = null; + + this.open(); + } + + Socket.priorWebsocketSuccess = false; + + /** + * Mix in `Emitter`. + */ + + Emitter(Socket.prototype); + + /** + * Protocol version. + * + * @api public + */ + + Socket.protocol = parser.protocol; // this is an int + + /** + * Expose deps for legacy compatibility + * and standalone browser access. + */ + + Socket.Socket = Socket; + Socket.Transport = __webpack_require__(23); + Socket.transports = __webpack_require__(18); + Socket.parser = __webpack_require__(24); + + /** + * Creates transport of the given type. + * + * @param {String} transport name + * @return {Transport} + * @api private + */ + + Socket.prototype.createTransport = function (name) { + debug('creating transport "%s"', name); + var query = clone(this.query); + + // append engine.io protocol identifier + query.EIO = parser.protocol; + + // transport name + query.transport = name; + + // per-transport options + var options = this.transportOptions[name] || {}; + + // session id if we already have one + if (this.id) query.sid = this.id; + + var transport = new transports[name]({ + query: query, + socket: this, + agent: options.agent || this.agent, + hostname: options.hostname || this.hostname, + port: options.port || this.port, + secure: options.secure || this.secure, + path: options.path || this.path, + forceJSONP: options.forceJSONP || this.forceJSONP, + jsonp: options.jsonp || this.jsonp, + forceBase64: options.forceBase64 || this.forceBase64, + enablesXDR: options.enablesXDR || this.enablesXDR, + withCredentials: options.withCredentials || this.withCredentials, + timestampRequests: options.timestampRequests || this.timestampRequests, + timestampParam: options.timestampParam || this.timestampParam, + policyPort: options.policyPort || this.policyPort, + pfx: options.pfx || this.pfx, + key: options.key || this.key, + passphrase: options.passphrase || this.passphrase, + cert: options.cert || this.cert, + ca: options.ca || this.ca, + ciphers: options.ciphers || this.ciphers, + rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized, + perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate, + extraHeaders: options.extraHeaders || this.extraHeaders, + forceNode: options.forceNode || this.forceNode, + localAddress: options.localAddress || this.localAddress, + requestTimeout: options.requestTimeout || this.requestTimeout, + protocols: options.protocols || void (0), + isReactNative: this.isReactNative + }); + + return transport; + }; + + function clone (obj) { + var o = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + o[i] = obj[i]; + } + } + return o; + } + + /** + * Initializes transport to use and starts probe. + * + * @api private + */ + Socket.prototype.open = function () { + var transport; + if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { + transport = 'websocket'; + } else if (0 === this.transports.length) { + // Emit error on next tick so it can be listened to + var self = this; + setTimeout(function () { + self.emit('error', 'No transports available'); + }, 0); + return; + } else { + transport = this.transports[0]; + } + this.readyState = 'opening'; + + // Retry with the next transport if the transport is disabled (jsonp: false) + try { + transport = this.createTransport(transport); + } catch (e) { + this.transports.shift(); + this.open(); + return; + } + + transport.open(); + this.setTransport(transport); + }; + + /** + * Sets the current transport. Disables the existing one (if any). + * + * @api private + */ + + Socket.prototype.setTransport = function (transport) { + debug('setting transport %s', transport.name); + var self = this; + + if (this.transport) { + debug('clearing existing transport %s', this.transport.name); + this.transport.removeAllListeners(); + } + + // set up transport + this.transport = transport; + + // set up transport listeners + transport + .on('drain', function () { + self.onDrain(); + }) + .on('packet', function (packet) { + self.onPacket(packet); + }) + .on('error', function (e) { + self.onError(e); + }) + .on('close', function () { + self.onClose('transport close'); + }); + }; + + /** + * Probes a transport. + * + * @param {String} transport name + * @api private + */ + + Socket.prototype.probe = function (name) { + debug('probing transport "%s"', name); + var transport = this.createTransport(name, { probe: 1 }); + var failed = false; + var self = this; + + Socket.priorWebsocketSuccess = false; + + function onTransportOpen () { + if (self.onlyBinaryUpgrades) { + var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; + failed = failed || upgradeLosesBinary; + } + if (failed) return; + + debug('probe transport "%s" opened', name); + transport.send([{ type: 'ping', data: 'probe' }]); + transport.once('packet', function (msg) { + if (failed) return; + if ('pong' === msg.type && 'probe' === msg.data) { + debug('probe transport "%s" pong', name); + self.upgrading = true; + self.emit('upgrading', transport); + if (!transport) return; + Socket.priorWebsocketSuccess = 'websocket' === transport.name; + + debug('pausing current transport "%s"', self.transport.name); + self.transport.pause(function () { + if (failed) return; + if ('closed' === self.readyState) return; + debug('changing transport and sending upgrade packet'); + + cleanup(); + + self.setTransport(transport); + transport.send([{ type: 'upgrade' }]); + self.emit('upgrade', transport); + transport = null; + self.upgrading = false; + self.flush(); + }); + } else { + debug('probe transport "%s" failed', name); + var err = new Error('probe error'); + err.transport = transport.name; + self.emit('upgradeError', err); + } + }); + } + + function freezeTransport () { + if (failed) return; + + // Any callback called by transport should be ignored since now + failed = true; + + cleanup(); + + transport.close(); + transport = null; + } + + // Handle any error that happens while probing + function onerror (err) { + var error = new Error('probe error: ' + err); + error.transport = transport.name; + + freezeTransport(); + + debug('probe transport "%s" failed because of error: %s', name, err); + + self.emit('upgradeError', error); + } + + function onTransportClose () { + onerror('transport closed'); + } + + // When the socket is closed while we're probing + function onclose () { + onerror('socket closed'); + } + + // When the socket is upgraded while we're probing + function onupgrade (to) { + if (transport && to.name !== transport.name) { + debug('"%s" works - aborting "%s"', to.name, transport.name); + freezeTransport(); + } + } + + // Remove all listeners on the transport and on self + function cleanup () { + transport.removeListener('open', onTransportOpen); + transport.removeListener('error', onerror); + transport.removeListener('close', onTransportClose); + self.removeListener('close', onclose); + self.removeListener('upgrading', onupgrade); + } + + transport.once('open', onTransportOpen); + transport.once('error', onerror); + transport.once('close', onTransportClose); + + this.once('close', onclose); + this.once('upgrading', onupgrade); + + transport.open(); + }; + + /** + * Called when connection is deemed open. + * + * @api public + */ + + Socket.prototype.onOpen = function () { + debug('socket open'); + this.readyState = 'open'; + Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; + this.emit('open'); + this.flush(); + + // we check for `readyState` in case an `open` + // listener already closed the socket + if ('open' === this.readyState && this.upgrade && this.transport.pause) { + debug('starting upgrade probes'); + for (var i = 0, l = this.upgrades.length; i < l; i++) { + this.probe(this.upgrades[i]); + } + } + }; + + /** + * Handles a packet. + * + * @api private + */ + + Socket.prototype.onPacket = function (packet) { + if ('opening' === this.readyState || 'open' === this.readyState || + 'closing' === this.readyState) { + debug('socket receive: type "%s", data "%s"', packet.type, packet.data); + + this.emit('packet', packet); + + // Socket is live - any packet counts + this.emit('heartbeat'); + + switch (packet.type) { + case 'open': + this.onHandshake(JSON.parse(packet.data)); + break; + + case 'pong': + this.setPing(); + this.emit('pong'); + break; + + case 'error': + var err = new Error('server error'); + err.code = packet.data; + this.onError(err); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + debug('packet received with socket readyState "%s"', this.readyState); + } + }; + + /** + * Called upon handshake completion. + * + * @param {Object} handshake obj + * @api private + */ + + Socket.prototype.onHandshake = function (data) { + this.emit('handshake', data); + this.id = data.sid; + this.transport.query.sid = data.sid; + this.upgrades = this.filterUpgrades(data.upgrades); + this.pingInterval = data.pingInterval; + this.pingTimeout = data.pingTimeout; + this.onOpen(); + // In case open handler closes socket + if ('closed' === this.readyState) return; + this.setPing(); + + // Prolong liveness of socket on heartbeat + this.removeListener('heartbeat', this.onHeartbeat); + this.on('heartbeat', this.onHeartbeat); + }; + + /** + * Resets ping timeout. + * + * @api private + */ + + Socket.prototype.onHeartbeat = function (timeout) { + clearTimeout(this.pingTimeoutTimer); + var self = this; + self.pingTimeoutTimer = setTimeout(function () { + if ('closed' === self.readyState) return; + self.onClose('ping timeout'); + }, timeout || (self.pingInterval + self.pingTimeout)); + }; + + /** + * Pings server every `this.pingInterval` and expects response + * within `this.pingTimeout` or closes connection. + * + * @api private + */ + + Socket.prototype.setPing = function () { + var self = this; + clearTimeout(self.pingIntervalTimer); + self.pingIntervalTimer = setTimeout(function () { + debug('writing ping packet - expecting pong within %sms', self.pingTimeout); + self.ping(); + self.onHeartbeat(self.pingTimeout); + }, self.pingInterval); + }; + + /** + * Sends a ping packet. + * + * @api private + */ + + Socket.prototype.ping = function () { + var self = this; + this.sendPacket('ping', function () { + self.emit('ping'); + }); + }; + + /** + * Called on `drain` event + * + * @api private + */ + + Socket.prototype.onDrain = function () { + this.writeBuffer.splice(0, this.prevBufferLen); + + // setting prevBufferLen = 0 is very important + // for example, when upgrading, upgrade packet is sent over, + // and a nonzero prevBufferLen could cause problems on `drain` + this.prevBufferLen = 0; + + if (0 === this.writeBuffer.length) { + this.emit('drain'); + } else { + this.flush(); + } + }; + + /** + * Flush write buffers. + * + * @api private + */ + + Socket.prototype.flush = function () { + if ('closed' !== this.readyState && this.transport.writable && + !this.upgrading && this.writeBuffer.length) { + debug('flushing %d packets in socket', this.writeBuffer.length); + this.transport.send(this.writeBuffer); + // keep track of current length of writeBuffer + // splice writeBuffer and callbackBuffer on `drain` + this.prevBufferLen = this.writeBuffer.length; + this.emit('flush'); + } + }; + + /** + * Sends a message. + * + * @param {String} message. + * @param {Function} callback function. + * @param {Object} options. + * @return {Socket} for chaining. + * @api public + */ + + Socket.prototype.write = + Socket.prototype.send = function (msg, options, fn) { + this.sendPacket('message', msg, options, fn); + return this; + }; + + /** + * Sends a packet. + * + * @param {String} packet type. + * @param {String} data. + * @param {Object} options. + * @param {Function} callback function. + * @api private + */ + + Socket.prototype.sendPacket = function (type, data, options, fn) { + if ('function' === typeof data) { + fn = data; + data = undefined; + } + + if ('function' === typeof options) { + fn = options; + options = null; + } + + if ('closing' === this.readyState || 'closed' === this.readyState) { + return; + } + + options = options || {}; + options.compress = false !== options.compress; + + var packet = { + type: type, + data: data, + options: options + }; + this.emit('packetCreate', packet); + this.writeBuffer.push(packet); + if (fn) this.once('flush', fn); + this.flush(); + }; + + /** + * Closes the connection. + * + * @api private + */ + + Socket.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.readyState = 'closing'; + + var self = this; + + if (this.writeBuffer.length) { + this.once('drain', function () { + if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + }); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + } + + function close () { + self.onClose('forced close'); + debug('socket closing - telling transport to close'); + self.transport.close(); + } + + function cleanupAndClose () { + self.removeListener('upgrade', cleanupAndClose); + self.removeListener('upgradeError', cleanupAndClose); + close(); + } + + function waitForUpgrade () { + // wait for upgrade to finish since we can't send packets while pausing a transport + self.once('upgrade', cleanupAndClose); + self.once('upgradeError', cleanupAndClose); + } + + return this; + }; + + /** + * Called upon transport error + * + * @api private + */ + + Socket.prototype.onError = function (err) { + debug('socket error %j', err); + Socket.priorWebsocketSuccess = false; + this.emit('error', err); + this.onClose('transport error', err); + }; + + /** + * Called upon transport close. + * + * @api private + */ + + Socket.prototype.onClose = function (reason, desc) { + if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { + debug('socket close with reason: "%s"', reason); + var self = this; + + // clear timers + clearTimeout(this.pingIntervalTimer); + clearTimeout(this.pingTimeoutTimer); + + // stop event from firing again for transport + this.transport.removeAllListeners('close'); + + // ensure transport won't stay open + this.transport.close(); + + // ignore further transport communication + this.transport.removeAllListeners(); + + // set ready state + this.readyState = 'closed'; + + // clear session id + this.id = null; + + // emit close event + this.emit('close', reason, desc); + + // clean buffers after, so users can still + // grab the buffers on `close` event + self.writeBuffer = []; + self.prevBufferLen = 0; + } + }; + + /** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + + Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i < j; i++) { + if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); + } + return filteredUpgrades; + }; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies + */ + + var XMLHttpRequest = __webpack_require__(19); + var XHR = __webpack_require__(21); + var JSONP = __webpack_require__(35); + var websocket = __webpack_require__(36); + + /** + * Export transports. + */ + + exports.polling = polling; + exports.websocket = websocket; + + /** + * Polling transport polymorphic constructor. + * Decides on xhr vs jsonp based on feature detection. + * + * @api private + */ + + function polling (opts) { + var xhr; + var xd = false; + var xs = false; + var jsonp = false !== opts.jsonp; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + xd = opts.hostname !== location.hostname || port !== opts.port; + xs = opts.secure !== isSSL; + } + + opts.xdomain = xd; + opts.xscheme = xs; + xhr = new XMLHttpRequest(opts); + + if ('open' in xhr && !opts.forceJSONP) { + return new XHR(opts); + } else { + if (!jsonp) throw new Error('JSONP disabled'); + return new JSONP(opts); + } + } + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + // browser shim for xmlhttprequest module + + var hasCORS = __webpack_require__(20); + + module.exports = function (opts) { + var xdomain = opts.xdomain; + + // scheme must be same when usign XDomainRequest + // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx + var xscheme = opts.xscheme; + + // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. + // https://github.com/Automattic/engine.io-client/pull/217 + var enablesXDR = opts.enablesXDR; + + // XMLHttpRequest can be disabled on IE + try { + if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e) { } + + // Use XDomainRequest for IE8 if enablesXDR is true + // because loading bar keeps flashing when using jsonp-polling + // https://github.com/yujiosaka/socke.io-ie8-loading-example + try { + if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { + return new XDomainRequest(); + } + } catch (e) { } + + if (!xdomain) { + try { + return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); + } catch (e) { } + } + }; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + + + /** + * Module exports. + * + * Logic borrowed from Modernizr: + * + * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js + */ + + try { + module.exports = typeof XMLHttpRequest !== 'undefined' && + 'withCredentials' in new XMLHttpRequest(); + } catch (err) { + // if XMLHttp support is disabled in IE then it will throw + // when trying to create + module.exports = false; + } + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + + /* global attachEvent */ + + /** + * Module requirements. + */ + + var XMLHttpRequest = __webpack_require__(19); + var Polling = __webpack_require__(22); + var Emitter = __webpack_require__(11); + var inherit = __webpack_require__(33); + var debug = __webpack_require__(3)('engine.io-client:polling-xhr'); + + /** + * Module exports. + */ + + module.exports = XHR; + module.exports.Request = Request; + + /** + * Empty function + */ + + function empty () {} + + /** + * XHR Polling constructor. + * + * @param {Object} opts + * @api public + */ + + function XHR (opts) { + Polling.call(this, opts); + this.requestTimeout = opts.requestTimeout; + this.extraHeaders = opts.extraHeaders; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) || + port !== opts.port; + this.xs = opts.secure !== isSSL; + } + } + + /** + * Inherits from Polling. + */ + + inherit(XHR, Polling); + + /** + * XHR supports binary + */ + + XHR.prototype.supportsBinary = true; + + /** + * Creates a request. + * + * @param {String} method + * @api private + */ + + XHR.prototype.request = function (opts) { + opts = opts || {}; + opts.uri = this.uri(); + opts.xd = this.xd; + opts.xs = this.xs; + opts.agent = this.agent || false; + opts.supportsBinary = this.supportsBinary; + opts.enablesXDR = this.enablesXDR; + opts.withCredentials = this.withCredentials; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + opts.requestTimeout = this.requestTimeout; + + // other options for Node.js client + opts.extraHeaders = this.extraHeaders; + + return new Request(opts); + }; + + /** + * Sends data. + * + * @param {String} data to send. + * @param {Function} called upon flush. + * @api private + */ + + XHR.prototype.doWrite = function (data, fn) { + var isBinary = typeof data !== 'string' && data !== undefined; + var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); + var self = this; + req.on('success', fn); + req.on('error', function (err) { + self.onError('xhr post error', err); + }); + this.sendXhr = req; + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + XHR.prototype.doPoll = function () { + debug('xhr poll'); + var req = this.request(); + var self = this; + req.on('data', function (data) { + self.onData(data); + }); + req.on('error', function (err) { + self.onError('xhr poll error', err); + }); + this.pollXhr = req; + }; + + /** + * Request constructor + * + * @param {Object} options + * @api public + */ + + function Request (opts) { + this.method = opts.method || 'GET'; + this.uri = opts.uri; + this.xd = !!opts.xd; + this.xs = !!opts.xs; + this.async = false !== opts.async; + this.data = undefined !== opts.data ? opts.data : null; + this.agent = opts.agent; + this.isBinary = opts.isBinary; + this.supportsBinary = opts.supportsBinary; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + this.requestTimeout = opts.requestTimeout; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + + this.create(); + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Request.prototype); + + /** + * Creates the XHR object and sends the request. + * + * @api private + */ + + Request.prototype.create = function () { + var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + + var xhr = this.xhr = new XMLHttpRequest(opts); + var self = this; + + try { + debug('xhr open %s: %s', this.method, this.uri); + xhr.open(this.method, this.uri, this.async); + try { + if (this.extraHeaders) { + xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); + for (var i in this.extraHeaders) { + if (this.extraHeaders.hasOwnProperty(i)) { + xhr.setRequestHeader(i, this.extraHeaders[i]); + } + } + } + } catch (e) {} + + if ('POST' === this.method) { + try { + if (this.isBinary) { + xhr.setRequestHeader('Content-type', 'application/octet-stream'); + } else { + xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); + } + } catch (e) {} + } + + try { + xhr.setRequestHeader('Accept', '*/*'); + } catch (e) {} + + // ie6 check + if ('withCredentials' in xhr) { + xhr.withCredentials = this.withCredentials; + } + + if (this.requestTimeout) { + xhr.timeout = this.requestTimeout; + } + + if (this.hasXDR()) { + xhr.onload = function () { + self.onLoad(); + }; + xhr.onerror = function () { + self.onError(xhr.responseText); + }; + } else { + xhr.onreadystatechange = function () { + if (xhr.readyState === 2) { + try { + var contentType = xhr.getResponseHeader('Content-Type'); + if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + xhr.responseType = 'arraybuffer'; + } + } catch (e) {} + } + if (4 !== xhr.readyState) return; + if (200 === xhr.status || 1223 === xhr.status) { + self.onLoad(); + } else { + // make sure the `error` event handler that's user-set + // does not throw in the same tick and gets caught here + setTimeout(function () { + self.onError(typeof xhr.status === 'number' ? xhr.status : 0); + }, 0); + } + }; + } + + debug('xhr data %s', this.data); + xhr.send(this.data); + } catch (e) { + // Need to defer since .create() is called directly fhrom the constructor + // and thus the 'error' event can only be only bound *after* this exception + // occurs. Therefore, also, we cannot throw here at all. + setTimeout(function () { + self.onError(e); + }, 0); + return; + } + + if (typeof document !== 'undefined') { + this.index = Request.requestsCount++; + Request.requests[this.index] = this; + } + }; + + /** + * Called upon successful response. + * + * @api private + */ + + Request.prototype.onSuccess = function () { + this.emit('success'); + this.cleanup(); + }; + + /** + * Called if we have data. + * + * @api private + */ + + Request.prototype.onData = function (data) { + this.emit('data', data); + this.onSuccess(); + }; + + /** + * Called upon error. + * + * @api private + */ + + Request.prototype.onError = function (err) { + this.emit('error', err); + this.cleanup(true); + }; + + /** + * Cleans up house. + * + * @api private + */ + + Request.prototype.cleanup = function (fromError) { + if ('undefined' === typeof this.xhr || null === this.xhr) { + return; + } + // xmlhttprequest + if (this.hasXDR()) { + this.xhr.onload = this.xhr.onerror = empty; + } else { + this.xhr.onreadystatechange = empty; + } + + if (fromError) { + try { + this.xhr.abort(); + } catch (e) {} + } + + if (typeof document !== 'undefined') { + delete Request.requests[this.index]; + } + + this.xhr = null; + }; + + /** + * Called upon load. + * + * @api private + */ + + Request.prototype.onLoad = function () { + var data; + try { + var contentType; + try { + contentType = this.xhr.getResponseHeader('Content-Type'); + } catch (e) {} + if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + data = this.xhr.response || this.xhr.responseText; + } else { + data = this.xhr.responseText; + } + } catch (e) { + this.onError(e); + } + if (null != data) { + this.onData(data); + } + }; + + /** + * Check if it has XDomainRequest. + * + * @api private + */ + + Request.prototype.hasXDR = function () { + return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR; + }; + + /** + * Aborts the request. + * + * @api public + */ + + Request.prototype.abort = function () { + this.cleanup(); + }; + + /** + * Aborts pending requests when unloading the window. This is needed to prevent + * memory leaks (e.g. when using IE) and to ensure that no spurious error is + * emitted. + */ + + Request.requestsCount = 0; + Request.requests = {}; + + if (typeof document !== 'undefined') { + if (typeof attachEvent === 'function') { + attachEvent('onunload', unloadHandler); + } else if (typeof addEventListener === 'function') { + var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload'; + addEventListener(terminationEvent, unloadHandler, false); + } + } + + function unloadHandler () { + for (var i in Request.requests) { + if (Request.requests.hasOwnProperty(i)) { + Request.requests[i].abort(); + } + } + } + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(23); + var parseqs = __webpack_require__(32); + var parser = __webpack_require__(24); + var inherit = __webpack_require__(33); + var yeast = __webpack_require__(34); + var debug = __webpack_require__(3)('engine.io-client:polling'); + + /** + * Module exports. + */ + + module.exports = Polling; + + /** + * Is XHR2 supported? + */ + + var hasXHR2 = (function () { + var XMLHttpRequest = __webpack_require__(19); + var xhr = new XMLHttpRequest({ xdomain: false }); + return null != xhr.responseType; + })(); + + /** + * Polling interface. + * + * @param {Object} opts + * @api private + */ + + function Polling (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (!hasXHR2 || forceBase64) { + this.supportsBinary = false; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(Polling, Transport); + + /** + * Transport name. + */ + + Polling.prototype.name = 'polling'; + + /** + * Opens the socket (triggers polling). We write a PING message to determine + * when the transport is open. + * + * @api private + */ + + Polling.prototype.doOpen = function () { + this.poll(); + }; + + /** + * Pauses polling. + * + * @param {Function} callback upon buffers are flushed and transport is paused + * @api private + */ + + Polling.prototype.pause = function (onPause) { + var self = this; + + this.readyState = 'pausing'; + + function pause () { + debug('paused'); + self.readyState = 'paused'; + onPause(); + } + + if (this.polling || !this.writable) { + var total = 0; + + if (this.polling) { + debug('we are currently polling - waiting to pause'); + total++; + this.once('pollComplete', function () { + debug('pre-pause polling complete'); + --total || pause(); + }); + } + + if (!this.writable) { + debug('we are currently writing - waiting to pause'); + total++; + this.once('drain', function () { + debug('pre-pause writing complete'); + --total || pause(); + }); + } + } else { + pause(); + } + }; + + /** + * Starts polling cycle. + * + * @api public + */ + + Polling.prototype.poll = function () { + debug('polling'); + this.polling = true; + this.doPoll(); + this.emit('poll'); + }; + + /** + * Overloads onData to detect payloads. + * + * @api private + */ + + Polling.prototype.onData = function (data) { + var self = this; + debug('polling got data %s', data); + var callback = function (packet, index, total) { + // if its the first message we consider the transport open + if ('opening' === self.readyState) { + self.onOpen(); + } + + // if its a close packet, we close the ongoing requests + if ('close' === packet.type) { + self.onClose(); + return false; + } + + // otherwise bypass onData and handle the message + self.onPacket(packet); + }; + + // decode payload + parser.decodePayload(data, this.socket.binaryType, callback); + + // if an event did not trigger closing + if ('closed' !== this.readyState) { + // if we got data we're not polling + this.polling = false; + this.emit('pollComplete'); + + if ('open' === this.readyState) { + this.poll(); + } else { + debug('ignoring poll - transport state "%s"', this.readyState); + } + } + }; + + /** + * For polling, send a close packet. + * + * @api private + */ + + Polling.prototype.doClose = function () { + var self = this; + + function close () { + debug('writing close packet'); + self.write([{ type: 'close' }]); + } + + if ('open' === this.readyState) { + debug('transport open - closing'); + close(); + } else { + // in case we're trying to close while + // handshaking is in progress (GH-164) + debug('transport not open - deferring close'); + this.once('open', close); + } + }; + + /** + * Writes a packets payload. + * + * @param {Array} data packets + * @param {Function} drain callback + * @api private + */ + + Polling.prototype.write = function (packets) { + var self = this; + this.writable = false; + var callbackfn = function () { + self.writable = true; + self.emit('drain'); + }; + + parser.encodePayload(packets, this.supportsBinary, function (data) { + self.doWrite(data, callbackfn); + }); + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + Polling.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'https' : 'http'; + var port = ''; + + // cache busting is forced + if (false !== this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + if (!this.supportsBinary && !query.sid) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // avoid port if default for schema + if (this.port && (('https' === schema && Number(this.port) !== 443) || + ('http' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var parser = __webpack_require__(24); + var Emitter = __webpack_require__(11); + + /** + * Module exports. + */ + + module.exports = Transport; + + /** + * Transport abstract constructor. + * + * @param {Object} options. + * @api private + */ + + function Transport (opts) { + this.path = opts.path; + this.hostname = opts.hostname; + this.port = opts.port; + this.secure = opts.secure; + this.query = opts.query; + this.timestampParam = opts.timestampParam; + this.timestampRequests = opts.timestampRequests; + this.readyState = ''; + this.agent = opts.agent || false; + this.socket = opts.socket; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + this.forceNode = opts.forceNode; + + // results of ReactNative environment detection + this.isReactNative = opts.isReactNative; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + this.localAddress = opts.localAddress; + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Transport.prototype); + + /** + * Emits an error. + * + * @param {String} str + * @return {Transport} for chaining + * @api public + */ + + Transport.prototype.onError = function (msg, desc) { + var err = new Error(msg); + err.type = 'TransportError'; + err.description = desc; + this.emit('error', err); + return this; + }; + + /** + * Opens the transport. + * + * @api public + */ + + Transport.prototype.open = function () { + if ('closed' === this.readyState || '' === this.readyState) { + this.readyState = 'opening'; + this.doOpen(); + } + + return this; + }; + + /** + * Closes the transport. + * + * @api private + */ + + Transport.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.doClose(); + this.onClose(); + } + + return this; + }; + + /** + * Sends multiple packets. + * + * @param {Array} packets + * @api private + */ + + Transport.prototype.send = function (packets) { + if ('open' === this.readyState) { + this.write(packets); + } else { + throw new Error('Transport not open'); + } + }; + + /** + * Called upon open + * + * @api private + */ + + Transport.prototype.onOpen = function () { + this.readyState = 'open'; + this.writable = true; + this.emit('open'); + }; + + /** + * Called with data. + * + * @param {String} data + * @api private + */ + + Transport.prototype.onData = function (data) { + var packet = parser.decodePacket(data, this.socket.binaryType); + this.onPacket(packet); + }; + + /** + * Called with a decoded packet. + */ + + Transport.prototype.onPacket = function (packet) { + this.emit('packet', packet); + }; + + /** + * Called upon close. + * + * @api private + */ + + Transport.prototype.onClose = function () { + this.readyState = 'closed'; + this.emit('close'); + }; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var keys = __webpack_require__(25); + var hasBinary = __webpack_require__(26); + var sliceBuffer = __webpack_require__(27); + var after = __webpack_require__(28); + var utf8 = __webpack_require__(29); + + var base64encoder; + if (typeof ArrayBuffer !== 'undefined') { + base64encoder = __webpack_require__(30); + } + + /** + * Check if we are running an android browser. That requires us to use + * ArrayBuffer with polling transports... + * + * http://ghinda.net/jpeg-blob-ajax-android/ + */ + + var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); + + /** + * Check if we are running in PhantomJS. + * Uploading a Blob with PhantomJS does not work correctly, as reported here: + * https://github.com/ariya/phantomjs/issues/11395 + * @type boolean + */ + var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); + + /** + * When true, avoids using Blobs to encode payloads. + * @type boolean + */ + var dontSendBlobs = isAndroid || isPhantomJS; + + /** + * Current protocol version. + */ + + exports.protocol = 3; + + /** + * Packet types. + */ + + var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 + }; + + var packetslist = keys(packets); + + /** + * Premade error packet. + */ + + var err = { type: 'error', data: 'parser error' }; + + /** + * Create a blob api even for blob builder when vendor prefixes exist + */ + + var Blob = __webpack_require__(31); + + /** + * Encodes a packet. + * + * <packet type id> [ <data> ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + + exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = false; + } + + if (typeof utf8encode === 'function') { + callback = utf8encode; + utf8encode = null; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } else if (typeof Blob !== 'undefined' && data instanceof Blob) { + return encodeBlob(packet, supportsBinary, callback); + } + + // might be an object with { base64: true, data: dataAsBase64String } + if (data && data.base64) { + return encodeBase64Object(packet, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); + } + + return callback('' + encoded); + + }; + + function encodeBase64Object(packet, callback) { + // packet data is an object { base64: true, data: dataAsBase64String } + var message = 'b' + exports.packets[packet.type] + packet.data.data; + return callback(message); + } + + /** + * Encode packet helpers for binary types + */ + + function encodeArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var contentArray = new Uint8Array(data); + var resultBuffer = new Uint8Array(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++) { + resultBuffer[i+1] = contentArray[i]; + } + + return callback(resultBuffer.buffer); + } + + function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var fr = new FileReader(); + fr.onload = function() { + exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback); + }; + return fr.readAsArrayBuffer(packet.data); + } + + function encodeBlob(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + if (dontSendBlobs) { + return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); + } + + var length = new Uint8Array(1); + length[0] = packets[packet.type]; + var blob = new Blob([length.buffer, packet.data]); + + return callback(blob); + } + + /** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + + exports.encodeBase64Packet = function(packet, callback) { + var message = 'b' + exports.packets[packet.type]; + if (typeof Blob !== 'undefined' && packet.data instanceof Blob) { + var fr = new FileReader(); + fr.onload = function() { + var b64 = fr.result.split(',')[1]; + callback(message + b64); + }; + return fr.readAsDataURL(packet.data); + } + + var b64data; + try { + b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); + } catch (e) { + // iPhone Safari doesn't let you apply with typed arrays + var typed = new Uint8Array(packet.data); + var basic = new Array(typed.length); + for (var i = 0; i < typed.length; i++) { + basic[i] = typed[i]; + } + b64data = String.fromCharCode.apply(null, basic); + } + message += btoa(b64data); + return callback(message); + }; + + /** + * Decodes a packet. Changes format to Blob if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + + exports.decodePacket = function (data, binaryType, utf8decode) { + if (data === undefined) { + return err; + } + // String data + if (typeof data === 'string') { + if (data.charAt(0) === 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + if (utf8decode) { + data = tryDecode(data); + if (data === false) { + return err; + } + } + var type = data.charAt(0); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + var asArray = new Uint8Array(data); + var type = asArray[0]; + var rest = sliceBuffer(data, 1); + if (Blob && binaryType === 'blob') { + rest = new Blob([rest]); + } + return { type: packetslist[type], data: rest }; + }; + + function tryDecode(data) { + try { + data = utf8.decode(data, { strict: false }); + } catch (e) { + return false; + } + return data; + } + + /** + * Decodes a packet encoded in a base64 string + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + + exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + if (!base64encoder) { + return { type: type, data: { base64: true, data: msg.substr(1) } }; + } + + var data = base64encoder.decode(msg.substr(1)); + + if (binaryType === 'blob' && Blob) { + data = new Blob([data]); + } + + return { type: type, data: data }; + }; + + /** + * Encodes multiple messages (payload). + * + * <length>:data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + + exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + var isBinary = hasBinary(packets); + + if (supportsBinary && isBinary) { + if (Blob && !dontSendBlobs) { + return exports.encodePayloadAsBlob(packets, callback); + } + + return exports.encodePayloadAsArrayBuffer(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); + }; + + /** + * Async array map using after + */ + + function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } + } + + /* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + + exports.decodePayload = function (data, binaryType, callback) { + if (typeof data !== 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data === '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '', n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (chr !== ':') { + length += chr; + continue; + } + + if (length === '' || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType, false); + + if (err.type === packet.type && err.data === packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + + if (length !== '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + }; + + /** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number + * 255><data> + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {ArrayBuffer} encoded payload + * @api private + */ + + exports.encodePayloadAsArrayBuffer = function(packets, callback) { + if (!packets.length) { + return callback(new ArrayBuffer(0)); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(data) { + return doneCallback(null, data); + }); + } + + map(packets, encodeOne, function(err, encodedPackets) { + var totalLength = encodedPackets.reduce(function(acc, p) { + var len; + if (typeof p === 'string'){ + len = p.length; + } else { + len = p.byteLength; + } + return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 + }, 0); + + var resultArray = new Uint8Array(totalLength); + + var bufferIndex = 0; + encodedPackets.forEach(function(p) { + var isString = typeof p === 'string'; + var ab = p; + if (isString) { + var view = new Uint8Array(p.length); + for (var i = 0; i < p.length; i++) { + view[i] = p.charCodeAt(i); + } + ab = view.buffer; + } + + if (isString) { // not true binary + resultArray[bufferIndex++] = 0; + } else { // true binary + resultArray[bufferIndex++] = 1; + } + + var lenStr = ab.byteLength.toString(); + for (var i = 0; i < lenStr.length; i++) { + resultArray[bufferIndex++] = parseInt(lenStr[i]); + } + resultArray[bufferIndex++] = 255; + + var view = new Uint8Array(ab); + for (var i = 0; i < view.length; i++) { + resultArray[bufferIndex++] = view[i]; + } + }); + + return callback(resultArray.buffer); + }); + }; + + /** + * Encode as Blob + */ + + exports.encodePayloadAsBlob = function(packets, callback) { + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(encoded) { + var binaryIdentifier = new Uint8Array(1); + binaryIdentifier[0] = 1; + if (typeof encoded === 'string') { + var view = new Uint8Array(encoded.length); + for (var i = 0; i < encoded.length; i++) { + view[i] = encoded.charCodeAt(i); + } + encoded = view.buffer; + binaryIdentifier[0] = 0; + } + + var len = (encoded instanceof ArrayBuffer) + ? encoded.byteLength + : encoded.size; + + var lenStr = len.toString(); + var lengthAry = new Uint8Array(lenStr.length + 1); + for (var i = 0; i < lenStr.length; i++) { + lengthAry[i] = parseInt(lenStr[i]); + } + lengthAry[lenStr.length] = 255; + + if (Blob) { + var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); + doneCallback(null, blob); + } + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(new Blob(results)); + }); + }; + + /* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + * + * @param {ArrayBuffer} data, callback method + * @api public + */ + + exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.byteLength > 0) { + var tailArray = new Uint8Array(bufferTail); + var isString = tailArray[0] === 0; + var msgLength = ''; + + for (var i = 1; ; i++) { + if (tailArray[i] === 255) break; + + // 310 = char length of Number.MAX_VALUE + if (msgLength.length > 310) { + return callback(err, 0, 1); + } + + msgLength += tailArray[i]; + } + + bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); + msgLength = parseInt(msgLength); + + var msg = sliceBuffer(bufferTail, 0, msgLength); + if (isString) { + try { + msg = String.fromCharCode.apply(null, new Uint8Array(msg)); + } catch (e) { + // iPhone Safari doesn't let you apply to typed arrays + var typed = new Uint8Array(msg); + msg = ''; + for (var i = 0; i < typed.length; i++) { + msg += String.fromCharCode(typed[i]); + } + } + } + + buffers.push(msg); + bufferTail = sliceBuffer(bufferTail, msgLength); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType, true), i, total); + }); + }; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + + + /** + * Gets the keys for an object. + * + * @return {Array} keys + * @api private + */ + + module.exports = Object.keys || function keys (obj){ + var arr = []; + var has = Object.prototype.hasOwnProperty; + + for (var i in obj) { + if (has.call(obj, i)) { + arr.push(i); + } + } + return arr; + }; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + + /* global Blob File */ + + /* + * Module requirements. + */ + + var isArray = __webpack_require__(13); + + var toString = Object.prototype.toString; + var withNativeBlob = typeof Blob === 'function' || + typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'; + var withNativeFile = typeof File === 'function' || + typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'; + + /** + * Module exports. + */ + + module.exports = hasBinary; + + /** + * Checks for binary data. + * + * Supports Buffer, ArrayBuffer, Blob and File. + * + * @param {Object} anything + * @api public + */ + + function hasBinary (obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + if (isArray(obj)) { + for (var i = 0, l = obj.length; i < l; i++) { + if (hasBinary(obj[i])) { + return true; + } + } + return false; + } + + if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) || + (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) || + (withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File) + ) { + return true; + } + + // see: https://github.com/Automattic/has-binary/pull/4 + if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) { + return hasBinary(obj.toJSON(), true); + } + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { + return true; + } + } + + return false; + } + + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + + /** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + + module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; + }; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + + module.exports = after + + function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } + } + + function noop() {} + + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + + /*! https://mths.be/utf8js v2.1.2 by @mathias */ + + var stringFromCharCode = String.fromCharCode; + + // Taken from https://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + // Taken from https://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; + } + + function checkScalarValue(codePoint, strict) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + if (strict) { + throw Error( + 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() + + ' is not a scalar value' + ); + } + return false; + } + return true; + } + /*--------------------------------------------------------------------------*/ + + function createByte(codePoint, shift) { + return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); + } + + function encodeCodePoint(codePoint, strict) { + if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence + symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); + } + else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence + if (!checkScalarValue(codePoint, strict)) { + codePoint = 0xFFFD; + } + symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); + symbol += createByte(codePoint, 6); + } + else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence + symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); + return symbol; + } + + function utf8encode(string, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint, strict); + } + return byteString; + } + + /*--------------------------------------------------------------------------*/ + + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } + + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; + + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); + } + + function decodeSymbol(strict) { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; + + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } + + if (byteIndex == byteCount) { + return false; + } + + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; + + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } + + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + byte2 = readContinuationByte(); + codePoint = ((byte1 & 0x1F) << 6) | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; + if (codePoint >= 0x0800) { + return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) | + (byte3 << 0x06) | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); + } + + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol(strict)) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); + } + + module.exports = { + version: '2.1.2', + encode: utf8encode, + decode: utf8decode + }; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports) { + + /* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ + (function(){ + "use strict"; + + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // Use a lookup table to find the index. + var lookup = new Uint8Array(256); + for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; + } + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i+1)]; + encoded3 = lookup[base64.charCodeAt(i+2)]; + encoded4 = lookup[base64.charCodeAt(i+3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; + })(); + + +/***/ }), +/* 31 */ +/***/ (function(module, exports) { + + /** + * Create a blob builder even when vendor prefixes exist + */ + + var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : + typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder : + typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : + typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : + false; + + /** + * Check if Blob constructor is supported + */ + + var blobSupported = (function() { + try { + var a = new Blob(['hi']); + return a.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if Blob constructor supports ArrayBufferViews + * Fails in Safari 6, so we need to map to ArrayBuffers there. + */ + + var blobSupportsArrayBufferView = blobSupported && (function() { + try { + var b = new Blob([new Uint8Array([1,2])]); + return b.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if BlobBuilder is supported + */ + + var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + + /** + * Helper function that maps ArrayBufferViews to ArrayBuffers + * Used by BlobBuilder constructor and old browsers that didn't + * support it in the Blob constructor. + */ + + function mapArrayBufferViews(ary) { + return ary.map(function(chunk) { + if (chunk.buffer instanceof ArrayBuffer) { + var buf = chunk.buffer; + + // if this is a subarray, make a copy so we only + // include the subarray region from the underlying buffer + if (chunk.byteLength !== buf.byteLength) { + var copy = new Uint8Array(chunk.byteLength); + copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); + buf = copy.buffer; + } + + return buf; + } + + return chunk; + }); + } + + function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + mapArrayBufferViews(ary).forEach(function(part) { + bb.append(part); + }); + + return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); + }; + + function BlobConstructor(ary, options) { + return new Blob(mapArrayBufferViews(ary), options || {}); + }; + + if (typeof Blob !== 'undefined') { + BlobBuilderConstructor.prototype = Blob.prototype; + BlobConstructor.prototype = Blob.prototype; + } + + module.exports = (function() { + if (blobSupported) { + return blobSupportsArrayBufferView ? Blob : BlobConstructor; + } else if (blobBuilderSupported) { + return BlobBuilderConstructor; + } else { + return undefined; + } + })(); + + +/***/ }), +/* 32 */ +/***/ (function(module, exports) { + + /** + * Compiles a querystring + * Returns string representation of the object + * + * @param {Object} + * @api private + */ + + exports.encode = function (obj) { + var str = ''; + + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (str.length) str += '&'; + str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); + } + } + + return str; + }; + + /** + * Parses a simple querystring into an object + * + * @param {String} qs + * @api private + */ + + exports.decode = function(qs){ + var qry = {}; + var pairs = qs.split('&'); + for (var i = 0, l = pairs.length; i < l; i++) { + var pair = pairs[i].split('='); + qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + return qry; + }; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports) { + + + module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; + }; + +/***/ }), +/* 34 */ +/***/ (function(module, exports) { + + 'use strict'; + + var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') + , length = 64 + , map = {} + , seed = 0 + , i = 0 + , prev; + + /** + * Return a string representing the specified number. + * + * @param {Number} num The number to convert. + * @returns {String} The string representation of the number. + * @api public + */ + function encode(num) { + var encoded = ''; + + do { + encoded = alphabet[num % length] + encoded; + num = Math.floor(num / length); + } while (num > 0); + + return encoded; + } + + /** + * Return the integer value specified by the given string. + * + * @param {String} str The string to convert. + * @returns {Number} The integer value represented by the string. + * @api public + */ + function decode(str) { + var decoded = 0; + + for (i = 0; i < str.length; i++) { + decoded = decoded * length + map[str.charAt(i)]; + } + + return decoded; + } + + /** + * Yeast: A tiny growing id generator. + * + * @returns {String} A unique id. + * @api public + */ + function yeast() { + var now = encode(+new Date()); + + if (now !== prev) return seed = 0, prev = now; + return now +'.'+ encode(seed++); + } + + // + // Map each character to its index. + // + for (; i < length; i++) map[alphabet[i]] = i; + + // + // Expose the `yeast`, `encode` and `decode` functions. + // + yeast.encode = encode; + yeast.decode = decode; + module.exports = yeast; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {/** + * Module requirements. + */ + + var Polling = __webpack_require__(22); + var inherit = __webpack_require__(33); + + /** + * Module exports. + */ + + module.exports = JSONPPolling; + + /** + * Cached regular expressions. + */ + + var rNewline = /\n/g; + var rEscapedNewline = /\\n/g; + + /** + * Global JSONP callbacks. + */ + + var callbacks; + + /** + * Noop. + */ + + function empty () { } + + /** + * Until https://github.com/tc39/proposal-global is shipped. + */ + function glob () { + return typeof self !== 'undefined' ? self + : typeof window !== 'undefined' ? window + : typeof global !== 'undefined' ? global : {}; + } + + /** + * JSONP Polling constructor. + * + * @param {Object} opts. + * @api public + */ + + function JSONPPolling (opts) { + Polling.call(this, opts); + + this.query = this.query || {}; + + // define global callbacks array if not present + // we do this here (lazily) to avoid unneeded global pollution + if (!callbacks) { + // we need to consider multiple engines in the same page + var global = glob(); + callbacks = global.___eio = (global.___eio || []); + } + + // callback identifier + this.index = callbacks.length; + + // add callback to jsonp global + var self = this; + callbacks.push(function (msg) { + self.onData(msg); + }); + + // append to query string + this.query.j = this.index; + + // prevent spurious errors from being emitted when the window is unloaded + if (typeof addEventListener === 'function') { + addEventListener('beforeunload', function () { + if (self.script) self.script.onerror = empty; + }, false); + } + } + + /** + * Inherits from Polling. + */ + + inherit(JSONPPolling, Polling); + + /* + * JSONP only supports binary as base64 encoded strings + */ + + JSONPPolling.prototype.supportsBinary = false; + + /** + * Closes the socket. + * + * @api private + */ + + JSONPPolling.prototype.doClose = function () { + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + if (this.form) { + this.form.parentNode.removeChild(this.form); + this.form = null; + this.iframe = null; + } + + Polling.prototype.doClose.call(this); + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + JSONPPolling.prototype.doPoll = function () { + var self = this; + var script = document.createElement('script'); + + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + script.async = true; + script.src = this.uri(); + script.onerror = function (e) { + self.onError('jsonp poll error', e); + }; + + var insertAt = document.getElementsByTagName('script')[0]; + if (insertAt) { + insertAt.parentNode.insertBefore(script, insertAt); + } else { + (document.head || document.body).appendChild(script); + } + this.script = script; + + var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); + + if (isUAgecko) { + setTimeout(function () { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + document.body.removeChild(iframe); + }, 100); + } + }; + + /** + * Writes with a hidden iframe. + * + * @param {String} data to send + * @param {Function} called upon flush. + * @api private + */ + + JSONPPolling.prototype.doWrite = function (data, fn) { + var self = this; + + if (!this.form) { + var form = document.createElement('form'); + var area = document.createElement('textarea'); + var id = this.iframeId = 'eio_iframe_' + this.index; + var iframe; + + form.className = 'socketio'; + form.style.position = 'absolute'; + form.style.top = '-1000px'; + form.style.left = '-1000px'; + form.target = id; + form.method = 'POST'; + form.setAttribute('accept-charset', 'utf-8'); + area.name = 'd'; + form.appendChild(area); + document.body.appendChild(form); + + this.form = form; + this.area = area; + } + + this.form.action = this.uri(); + + function complete () { + initIframe(); + fn(); + } + + function initIframe () { + if (self.iframe) { + try { + self.form.removeChild(self.iframe); + } catch (e) { + self.onError('jsonp polling iframe removal error', e); + } + } + + try { + // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) + var html = '<iframe src="javascript:0" name="' + self.iframeId + '">'; + iframe = document.createElement(html); + } catch (e) { + iframe = document.createElement('iframe'); + iframe.name = self.iframeId; + iframe.src = 'javascript:0'; + } + + iframe.id = self.iframeId; + + self.form.appendChild(iframe); + self.iframe = iframe; + } + + initIframe(); + + // escape \n to prevent it from being converted into \r\n by some UAs + // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side + data = data.replace(rEscapedNewline, '\\\n'); + this.area.value = data.replace(rNewline, '\\n'); + + try { + this.form.submit(); + } catch (e) {} + + if (this.iframe.attachEvent) { + this.iframe.onreadystatechange = function () { + if (self.iframe.readyState === 'complete') { + complete(); + } + }; + } else { + this.iframe.onload = complete; + } + }; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(23); + var parser = __webpack_require__(24); + var parseqs = __webpack_require__(32); + var inherit = __webpack_require__(33); + var yeast = __webpack_require__(34); + var debug = __webpack_require__(3)('engine.io-client:websocket'); + + var BrowserWebSocket, NodeWebSocket; + + if (typeof WebSocket !== 'undefined') { + BrowserWebSocket = WebSocket; + } else if (typeof self !== 'undefined') { + BrowserWebSocket = self.WebSocket || self.MozWebSocket; + } + + if (typeof window === 'undefined') { + try { + NodeWebSocket = __webpack_require__(37); + } catch (e) { } + } + + /** + * Get either the `WebSocket` or `MozWebSocket` globals + * in the browser or try to resolve WebSocket-compatible + * interface exposed by `ws` for Node-like environment. + */ + + var WebSocketImpl = BrowserWebSocket || NodeWebSocket; + + /** + * Module exports. + */ + + module.exports = WS; + + /** + * WebSocket transport constructor. + * + * @api {Object} connection options + * @api public + */ + + function WS (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (forceBase64) { + this.supportsBinary = false; + } + this.perMessageDeflate = opts.perMessageDeflate; + this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; + this.protocols = opts.protocols; + if (!this.usingBrowserWebSocket) { + WebSocketImpl = NodeWebSocket; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(WS, Transport); + + /** + * Transport name. + * + * @api public + */ + + WS.prototype.name = 'websocket'; + + /* + * WebSockets support binary + */ + + WS.prototype.supportsBinary = true; + + /** + * Opens socket. + * + * @api private + */ + + WS.prototype.doOpen = function () { + if (!this.check()) { + // let probe timeout + return; + } + + var uri = this.uri(); + var protocols = this.protocols; + var opts = { + agent: this.agent, + perMessageDeflate: this.perMessageDeflate + }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + if (this.extraHeaders) { + opts.headers = this.extraHeaders; + } + if (this.localAddress) { + opts.localAddress = this.localAddress; + } + + try { + this.ws = + this.usingBrowserWebSocket && !this.isReactNative + ? protocols + ? new WebSocketImpl(uri, protocols) + : new WebSocketImpl(uri) + : new WebSocketImpl(uri, protocols, opts); + } catch (err) { + return this.emit('error', err); + } + + if (this.ws.binaryType === undefined) { + this.supportsBinary = false; + } + + if (this.ws.supports && this.ws.supports.binary) { + this.supportsBinary = true; + this.ws.binaryType = 'nodebuffer'; + } else { + this.ws.binaryType = 'arraybuffer'; + } + + this.addEventListeners(); + }; + + /** + * Adds event listeners to the socket + * + * @api private + */ + + WS.prototype.addEventListeners = function () { + var self = this; + + this.ws.onopen = function () { + self.onOpen(); + }; + this.ws.onclose = function () { + self.onClose(); + }; + this.ws.onmessage = function (ev) { + self.onData(ev.data); + }; + this.ws.onerror = function (e) { + self.onError('websocket error', e); + }; + }; + + /** + * Writes data to socket. + * + * @param {Array} array of packets. + * @api private + */ + + WS.prototype.write = function (packets) { + var self = this; + this.writable = false; + + // encodePacket efficient as it uses WS framing + // no need for encodePayload + var total = packets.length; + for (var i = 0, l = total; i < l; i++) { + (function (packet) { + parser.encodePacket(packet, self.supportsBinary, function (data) { + if (!self.usingBrowserWebSocket) { + // always create a new object (GH-437) + var opts = {}; + if (packet.options) { + opts.compress = packet.options.compress; + } + + if (self.perMessageDeflate) { + var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length; + if (len < self.perMessageDeflate.threshold) { + opts.compress = false; + } + } + } + + // Sometimes the websocket has already been closed but the browser didn't + // have a chance of informing us about it yet, in that case send will + // throw an error + try { + if (self.usingBrowserWebSocket) { + // TypeError is thrown when passing the second argument on Safari + self.ws.send(data); + } else { + self.ws.send(data, opts); + } + } catch (e) { + debug('websocket closed before onclose event'); + } + + --total || done(); + }); + })(packets[i]); + } + + function done () { + self.emit('flush'); + + // fake drain + // defer to next tick to allow Socket to clear writeBuffer + setTimeout(function () { + self.writable = true; + self.emit('drain'); + }, 0); + } + }; + + /** + * Called upon close + * + * @api private + */ + + WS.prototype.onClose = function () { + Transport.prototype.onClose.call(this); + }; + + /** + * Closes socket. + * + * @api private + */ + + WS.prototype.doClose = function () { + if (typeof this.ws !== 'undefined') { + this.ws.close(); + } + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + WS.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'wss' : 'ws'; + var port = ''; + + // avoid port if default for schema + if (this.port && (('wss' === schema && Number(this.port) !== 443) || + ('ws' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // append timestamp to URI + if (this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + // communicate binary support capabilities + if (!this.supportsBinary) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + + /** + * Feature detection for WebSocket. + * + * @return {Boolean} whether this transport is available. + * @api public + */ + + WS.prototype.check = function () { + return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name); + }; + + +/***/ }), +/* 37 */ +/***/ (function(module, exports) { + + /* (ignored) */ + +/***/ }), +/* 38 */ +/***/ (function(module, exports) { + + + var indexOf = [].indexOf; + + module.exports = function(arr, obj){ + if (indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; + }; + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var parser = __webpack_require__(7); + var Emitter = __webpack_require__(11); + var toArray = __webpack_require__(40); + var on = __webpack_require__(41); + var bind = __webpack_require__(42); + var debug = __webpack_require__(3)('socket.io-client:socket'); + var parseqs = __webpack_require__(32); + var hasBin = __webpack_require__(26); + + /** + * Module exports. + */ + + module.exports = exports = Socket; + + /** + * Internal events (blacklisted). + * These events can't be emitted by the user. + * + * @api private + */ + + var events = { + connect: 1, + connect_error: 1, + connect_timeout: 1, + connecting: 1, + disconnect: 1, + error: 1, + reconnect: 1, + reconnect_attempt: 1, + reconnect_failed: 1, + reconnect_error: 1, + reconnecting: 1, + ping: 1, + pong: 1 + }; + + /** + * Shortcut to `Emitter#emit`. + */ + + var emit = Emitter.prototype.emit; + + /** + * `Socket` constructor. + * + * @api public + */ + + function Socket (io, nsp, opts) { + this.io = io; + this.nsp = nsp; + this.json = this; // compat + this.ids = 0; + this.acks = {}; + this.receiveBuffer = []; + this.sendBuffer = []; + this.connected = false; + this.disconnected = true; + this.flags = {}; + if (opts && opts.query) { + this.query = opts.query; + } + if (this.io.autoConnect) this.open(); + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Socket.prototype); + + /** + * Subscribe to open, close and packet events + * + * @api private + */ + + Socket.prototype.subEvents = function () { + if (this.subs) return; + + var io = this.io; + this.subs = [ + on(io, 'open', bind(this, 'onopen')), + on(io, 'packet', bind(this, 'onpacket')), + on(io, 'close', bind(this, 'onclose')) + ]; + }; + + /** + * "Opens" the socket. + * + * @api public + */ + + Socket.prototype.open = + Socket.prototype.connect = function () { + if (this.connected) return this; + + this.subEvents(); + this.io.open(); // ensure open + if ('open' === this.io.readyState) this.onopen(); + this.emit('connecting'); + return this; + }; + + /** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + + Socket.prototype.send = function () { + var args = toArray(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; + }; + + /** + * Override `emit`. + * If the event is in `events`, it's emitted normally. + * + * @param {String} event name + * @return {Socket} self + * @api public + */ + + Socket.prototype.emit = function (ev) { + if (events.hasOwnProperty(ev)) { + emit.apply(this, arguments); + return this; + } + + var args = toArray(arguments); + var packet = { + type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT, + data: args + }; + + packet.options = {}; + packet.options.compress = !this.flags || false !== this.flags.compress; + + // event ack callback + if ('function' === typeof args[args.length - 1]) { + debug('emitting packet with ack id %d', this.ids); + this.acks[this.ids] = args.pop(); + packet.id = this.ids++; + } + + if (this.connected) { + this.packet(packet); + } else { + this.sendBuffer.push(packet); + } + + this.flags = {}; + + return this; + }; + + /** + * Sends a packet. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.packet = function (packet) { + packet.nsp = this.nsp; + this.io.packet(packet); + }; + + /** + * Called upon engine `open`. + * + * @api private + */ + + Socket.prototype.onopen = function () { + debug('transport is open - connecting'); + + // write connect packet if necessary + if ('/' !== this.nsp) { + if (this.query) { + var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query; + debug('sending connect packet with query %s', query); + this.packet({type: parser.CONNECT, query: query}); + } else { + this.packet({type: parser.CONNECT}); + } + } + }; + + /** + * Called upon engine `close`. + * + * @param {String} reason + * @api private + */ + + Socket.prototype.onclose = function (reason) { + debug('close (%s)', reason); + this.connected = false; + this.disconnected = true; + delete this.id; + this.emit('disconnect', reason); + }; + + /** + * Called with socket packet. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.onpacket = function (packet) { + var sameNamespace = packet.nsp === this.nsp; + var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/'; + + if (!sameNamespace && !rootNamespaceError) return; + + switch (packet.type) { + case parser.CONNECT: + this.onconnect(); + break; + + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.emit('error', packet.data); + break; + } + }; + + /** + * Called upon a server event. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.onevent = function (packet) { + var args = packet.data || []; + debug('emitting event %j', args); + + if (null != packet.id) { + debug('attaching ack callback to event'); + args.push(this.ack(packet.id)); + } + + if (this.connected) { + emit.apply(this, args); + } else { + this.receiveBuffer.push(args); + } + }; + + /** + * Produces an ack callback to emit with an event. + * + * @api private + */ + + Socket.prototype.ack = function (id) { + var self = this; + var sent = false; + return function () { + // prevent double callbacks + if (sent) return; + sent = true; + var args = toArray(arguments); + debug('sending ack %j', args); + + self.packet({ + type: hasBin(args) ? parser.BINARY_ACK : parser.ACK, + id: id, + data: args + }); + }; + }; + + /** + * Called upon a server acknowlegement. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.onack = function (packet) { + var ack = this.acks[packet.id]; + if ('function' === typeof ack) { + debug('calling ack %s with %j', packet.id, packet.data); + ack.apply(this, packet.data); + delete this.acks[packet.id]; + } else { + debug('bad ack %s', packet.id); + } + }; + + /** + * Called upon server connect. + * + * @api private + */ + + Socket.prototype.onconnect = function () { + this.connected = true; + this.disconnected = false; + this.emit('connect'); + this.emitBuffered(); + }; + + /** + * Emit buffered events (received and emitted). + * + * @api private + */ + + Socket.prototype.emitBuffered = function () { + var i; + for (i = 0; i < this.receiveBuffer.length; i++) { + emit.apply(this, this.receiveBuffer[i]); + } + this.receiveBuffer = []; + + for (i = 0; i < this.sendBuffer.length; i++) { + this.packet(this.sendBuffer[i]); + } + this.sendBuffer = []; + }; + + /** + * Called upon server disconnect. + * + * @api private + */ + + Socket.prototype.ondisconnect = function () { + debug('server disconnect (%s)', this.nsp); + this.destroy(); + this.onclose('io server disconnect'); + }; + + /** + * Called upon forced client/server side disconnections, + * this method ensures the manager stops tracking us and + * that reconnections don't get triggered for this. + * + * @api private. + */ + + Socket.prototype.destroy = function () { + if (this.subs) { + // clean subscriptions to avoid reconnections + for (var i = 0; i < this.subs.length; i++) { + this.subs[i].destroy(); + } + this.subs = null; + } + + this.io.destroy(this); + }; + + /** + * Disconnects the socket manually. + * + * @return {Socket} self + * @api public + */ + + Socket.prototype.close = + Socket.prototype.disconnect = function () { + if (this.connected) { + debug('performing disconnect (%s)', this.nsp); + this.packet({ type: parser.DISCONNECT }); + } + + // remove socket from pool + this.destroy(); + + if (this.connected) { + // fire events + this.onclose('io client disconnect'); + } + return this; + }; + + /** + * Sets the compress flag. + * + * @param {Boolean} if `true`, compresses the sending data + * @return {Socket} self + * @api public + */ + + Socket.prototype.compress = function (compress) { + this.flags.compress = compress; + return this; + }; + + /** + * Sets the binary flag + * + * @param {Boolean} whether the emitted data contains binary + * @return {Socket} self + * @api public + */ + + Socket.prototype.binary = function (binary) { + this.flags.binary = binary; + return this; + }; + + +/***/ }), +/* 40 */ +/***/ (function(module, exports) { + + module.exports = toArray + + function toArray(list, index) { + var array = [] + + index = index || 0 + + for (var i = index || 0; i < list.length; i++) { + array[i - index] = list[i] + } + + return array + } + + +/***/ }), +/* 41 */ +/***/ (function(module, exports) { + + + /** + * Module exports. + */ + + module.exports = on; + + /** + * Helper for subscriptions. + * + * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` + * @param {String} event name + * @param {Function} callback + * @api public + */ + + function on (obj, ev, fn) { + obj.on(ev, fn); + return { + destroy: function () { + obj.removeListener(ev, fn); + } + }; + } + + +/***/ }), +/* 42 */ +/***/ (function(module, exports) { + + /** + * Slice reference. + */ + + var slice = [].slice; + + /** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + + module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } + }; + + +/***/ }), +/* 43 */ +/***/ (function(module, exports) { + + + /** + * Expose `Backoff`. + */ + + module.exports = Backoff; + + /** + * Initialize backoff timer with `opts`. + * + * - `min` initial timeout in milliseconds [100] + * - `max` max timeout [10000] + * - `jitter` [0] + * - `factor` [2] + * + * @param {Object} opts + * @api public + */ + + function Backoff(opts) { + opts = opts || {}; + this.ms = opts.min || 100; + this.max = opts.max || 10000; + this.factor = opts.factor || 2; + this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; + this.attempts = 0; + } + + /** + * Return the backoff duration. + * + * @return {Number} + * @api public + */ + + Backoff.prototype.duration = function(){ + var ms = this.ms * Math.pow(this.factor, this.attempts++); + if (this.jitter) { + var rand = Math.random(); + var deviation = Math.floor(rand * this.jitter * ms); + ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; + } + return Math.min(ms, this.max) | 0; + }; + + /** + * Reset the number of attempts. + * + * @api public + */ + + Backoff.prototype.reset = function(){ + this.attempts = 0; + }; + + /** + * Set the minimum duration + * + * @api public + */ + + Backoff.prototype.setMin = function(min){ + this.ms = min; + }; + + /** + * Set the maximum duration + * + * @api public + */ + + Backoff.prototype.setMax = function(max){ + this.max = max; + }; + + /** + * Set the jitter + * + * @api public + */ + + Backoff.prototype.setJitter = function(jitter){ + this.jitter = jitter; + }; + + + +/***/ }) +/******/ ]) +}); +; +//# sourceMappingURL=socket.io.dev.js.map+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.dev.js.map b/node_modules/socket.io-client/dist/socket.io.dev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 8eaf0a29f3d9e985ff91","webpack:///./lib/index.js","webpack:///./lib/url.js","webpack:///./~/parseuri/index.js","webpack:///./~/debug/src/browser.js","webpack:///./~/process/browser.js","webpack:///./~/debug/src/common.js","webpack:///./~/ms/index.js","webpack:///./~/socket.io-parser/index.js","webpack:///./~/socket.io-parser/~/debug/src/browser.js","webpack:///./~/socket.io-parser/~/debug/src/debug.js","webpack:///./~/socket.io-parser/~/ms/index.js","webpack:///./~/component-emitter/index.js","webpack:///./~/socket.io-parser/binary.js","webpack:///./~/isarray/index.js","webpack:///./~/socket.io-parser/is-buffer.js","webpack:///./lib/manager.js","webpack:///./~/engine.io-client/lib/index.js","webpack:///./~/engine.io-client/lib/socket.js","webpack:///./~/engine.io-client/lib/transports/index.js","webpack:///./~/engine.io-client/lib/xmlhttprequest.js","webpack:///./~/has-cors/index.js","webpack:///./~/engine.io-client/lib/transports/polling-xhr.js","webpack:///./~/engine.io-client/lib/transports/polling.js","webpack:///./~/engine.io-client/lib/transport.js","webpack:///./~/engine.io-parser/lib/browser.js","webpack:///./~/engine.io-parser/lib/keys.js","webpack:///./~/has-binary2/index.js","webpack:///./~/arraybuffer.slice/index.js","webpack:///./~/after/index.js","webpack:///./~/engine.io-parser/lib/utf8.js","webpack:///./~/base64-arraybuffer/lib/base64-arraybuffer.js","webpack:///./~/blob/index.js","webpack:///./~/parseqs/index.js","webpack:///./~/component-inherit/index.js","webpack:///./~/yeast/index.js","webpack:///./~/engine.io-client/lib/transports/polling-jsonp.js","webpack:///./~/engine.io-client/lib/transports/websocket.js","webpack:///ws (ignored)","webpack:///./~/indexof/index.js","webpack:///./lib/socket.js","webpack:///./~/to-array/index.js","webpack:///./lib/on.js","webpack:///./~/component-bind/index.js","webpack:///./~/backo2/index.js"],"names":["exports","log","formatArgs","save","load","useColors","storage","localstorage","colors","window","process","type","__nwjs","navigator","userAgent","toLowerCase","match","document","documentElement","style","WebkitAppearance","console","firebug","exception","table","parseInt","RegExp","$1","args","namespace","module","humanize","diff","c","color","splice","index","lastC","replace","namespaces","setItem","removeItem","error","r","getItem","env","DEBUG","localStorage","require","formatters","j","v","JSON","stringify","message","setup","createDebug","debug","default","coerce","disable","enable","enabled","Object","keys","forEach","key","instances","names","skips","selectColor","hash","i","length","charCodeAt","Math","abs","prevTime","self","curr","Number","Date","ms","prev","unshift","format","formatter","val","call","logFn","apply","destroy","extend","init","push","indexOf","delimiter","newDebug","split","len","substr","instance","map","toNamespace","join","name","test","regexp","toString","substring","Error","stack","chrome","local","err","Function","prototype","arguments","e","Array","bind"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;ACrCA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gCAA+B;AAC/B,gCAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AC5FA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC1EA;AACA;AACA;AACA;AACA;AACA;;AAEA,0GAAyG,IAAI,GAAG,IAAI,SAAS,IAAI;;AAEjI;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yEAAwE;AACxE;;AAEA;AACA,iBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yEAAwE;AACxE,mFAAkF;AAClF;AACA;;AAEA;AACA;;;;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAqC;;AAErC;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;;;;;ACtLtC;;;;;AAKA,UAASC,KAAT,CAAeV,GAAf,EAAoB;AACnBW,cAAYC,KAAZ,GAAoBD,WAApB;AACAA,cAAYE,OAAZ,GAAsBF,WAAtB;AACAA,cAAYG,MAAZ,GAAqBA,MAArB;AACAH,cAAYI,OAAZ,GAAsBA,OAAtB;AACAJ,cAAYK,MAAZ,GAAqBA,MAArB;AACAL,cAAYM,OAAZ,GAAsBA,OAAtB;AACAN,cAAYzB,QAAZ,GAAuB,mBAAAiB,CAAQ,CAAR,CAAvB;;AAEAe,SAAOC,IAAP,CAAYnB,GAAZ,EAAiBoB,OAAjB,CAAyB,eAAO;AAC/BT,eAAYU,GAAZ,IAAmBrB,IAAIqB,GAAJ,CAAnB;AACA,GAFD;;AAIA;;;AAGAV,cAAYW,SAAZ,G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AA4CD,IAAI2B,GAAhD,EAAqD3B,GAArD,EAA0D;AACzD,QAAIhB,YAAYY,KAAZ,CAAkBI,CAAlB,EAAqBkC,IAArB,CAA0BD,IAA1B,CAAJ,EAAqC;AACpC,YAAO,IAAP;AACA;AACD;;AAED,UAAO,KAAP;AACA;;AAED;;;;;;;AAOA,WAASF,WAAT,CAAqBI,MAArB,EAA6B;AAC5B,UAAOA,OAAOC,QAAP,GACLC,SADK,CACK,CADL,EACQF,OAAOC,QAAP,GAAkBnC,MAAlB,GAA2B,CADnC,EAELnC,OAFK,CAEG,SAFH,EAEc,GAFd,CAAP;AAGA;;AAED;;;;;;;AAOA,WAASqB,MAAT,CAAgB4B,GAAhB,EAAqB;AACpB,OAAIA,eAAeuB,KAAnB,EAA0B;AACzB,WAAOvB,IAAIwB,KAAJ,IAAaxB,IAAIjC,OAAxB;AACA;AACD,UAAOiC,GAAP;AACA;;AAED/B,cAAYK,MAAZ,CAAmBL,YAAYpD,IAAZ,EAAnB;;AAEA,SAAOoD,WAAP;AACA;;AAED1B,QAAO9B,OAAP,GAAiBuD,KAAjB,C;;;;;;ACzQA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,OAAO;AAClB,aAAY,MAAM;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;AChKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA0B;AAC1B,uBAAsB;AACtB;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA,sFAAqF;AACrF;;AAEA;AACA;AACA;AACA;AACA,MAAK,OAAO;AACZ;AACA;AACA,IAAG,qCAAqC;AACxC;AACA;AACA,MAAK;AACL;AACA,oBAAmB;AACnB;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,oBAAoB;AAChC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,qBAAqB;AAChC,aAAY,cAAc;AAC1B;AACA;AACA;;AAEA;AACA;AACA,4DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;A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,aAAY,MAAM;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtJA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,aAAY;AACZ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA2C,SAAS;AACpD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;;;;;;;AClKA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qCAAoC;AACpC,WAAU;AACV;;AAEA;AACA;;AAEA;AACA,wBAAuB;AACvB;AACA;AACA,IAAG;AACH;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA,kCAAiC;AACjC;AACA;;AAEA;AACA;;AAEA;AACA,8BAA6B;AAC7B,IAAG;AACH,oBAAmB,iBAAiB;AACpC;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,yCAAwC;AACxC,MAAK,yBAAyB;AAC9B,sBAAqB,gBAAgB;AACrC;AACA;AACA,MAAK,mDAAmD;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC5IA,kBAAiB;;AAEjB;AACA;AACA;;;;;;;;ACHA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;AClBA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,QAAQ;AACnB,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAqB,2BAA2B;AAChD;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG,OAAO;AACV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3jBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACTA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA2F;;AAE3F;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mCAAkC;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,MAAK;AACL;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA,+CAA8C,WAAW;AACzD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAqB,8BAA8B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,4BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA6C,OAAO;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;AACA;;AAEA;AACA;AACA,uCAAsC,OAAO;AAC7C;AACA;AACA;AACA;;;;;;;AC3uBA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;;;;;;ACpDA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG,YAAY;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG,YAAY;;AAEf;AACA;AACA;AACA,MAAK,YAAY;AACjB;AACA;;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;;;;;;;AChBA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA,2BAA0B,iDAAiD;AAC3E;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA,UAAS;AACT,4DAA2D;AAC3D;AACA,QAAO;AACP;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,gIAA+H;AAC/H;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,iGAAgG;AAChG;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChaA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iCAAgC,iBAAiB;AACjD;AACA,EAAC;;AAED;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;ACpPA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;AChKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,YAAW;;AAEX;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+DAA8D,gBAAgB;AAC9E;;AAEA;;AAEA;;AAEA;AACA,gCAA+B;AAC/B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAiB,yBAAyB;AAC1C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA0B,qCAAqC;AAC/D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAc;AACd,MAAK;AACL,eAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAU;AACV;;AAEA;AACA;AACA,+BAA8B,gBAAgB;AAC9C,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;;AAEA;AACA;AACA;AACA,aAAY,oBAAoB,oCAAoC;AACpE;;AAEA;;AAEA;AACA;AACA;;AAEA,WAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA,kBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mCAAkC,OAAO;AACzC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,aAAY,YAAY;AACxB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,oDAAmD;AACnD,MAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,cAAc;AACrC;AACA;AACA;AACA;;AAEA,sBAAqB;AACrB;AACA,QAAO,OAAO;AACd;AACA;;AAEA;AACA,sBAAqB,mBAAmB;AACxC;AACA;AACA;;AAEA;AACA,sBAAqB,iBAAiB;AACtC;AACA;AACA,MAAK;;AAEL;AACA,IAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAqB,mBAAmB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,YAAY;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAmB,EAAE;AACrB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,wBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;;;;;;;;AC3lBA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AClBA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC/DA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA0B,sCAAsC;;AAEhE,mBAAkB,gBAAgB;AAClC,iBAAgB,cAAc;AAC9B,qBAAoB,aAAa;;AAEjC;AACA;AACA;;AAEA;AACA;AACA,8BAA6B,SAAS;AACtC;AACA;AACA;AACA;;;;;;;AC5BA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;;;;;;;AC3BA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAoC;AACpC;AACA,KAAI;AACJ,4BAA2B;AAC3B;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sCAAqC;AACrC;AACA;AACA;AACA,sCAAqC;AACrC;AACA;AACA,2CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,2CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAiB,kBAAkB;AACnC;AACA;;AAEA;AACA;AACA;;AAEA,gBAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAe,SAAS;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;;;;;;AClED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,EAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,IAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA,0DAAyD;AACzD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA,EAAC;;;;;;;ACnGD;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,cAAa,gBAAgB;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAM,YAAY;;AAElB;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,oBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;;;;;;;AC9OA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAC;AACD;AACA;;AAEA;AACA;AACA;AACA,IAAG,YAAY;AACf;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,UAAS,OAAO;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA4B,OAAO;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA,QAAO;AACP,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;;;;;;;ACtSA,gB;;;;;;;ACCA;;AAEA;AACA;AACA,kBAAiB,gBAAgB;AACjC;AACA;AACA;AACA,G;;;;;;;ACRA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAmB,mCAAmC;AACtD,MAAK;AACL,oBAAmB,qBAAqB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa,+BAA+B;AAC5C;AACA;AACA;;AAEA,cAAa,4BAA4B;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAiB,0BAA0B;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,QAAQ;AACnB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,QAAQ;AACnB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;;;;;;;ACrbA;;AAEA;AACA;;AAEA;;AAEA,6BAA4B,iBAAiB;AAC7C;AACA;;AAEA;AACA;;;;;;;;ACXA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,oBAAoB;AAC/B,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACvBA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,gBAAgB;AAC3B,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrBA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","file":"socket.io.dev.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8eaf0a29f3d9e985ff91","\n/**\n * Module dependencies.\n */\n\nvar url = require('./url');\nvar parser = require('socket.io-parser');\nvar Manager = require('./manager');\nvar debug = require('debug')('socket.io-client');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = lookup;\n\n/**\n * Managers cache.\n */\n\nvar cache = exports.managers = {};\n\n/**\n * Looks up an existing `Manager` for multiplexing.\n * If the user summons:\n *\n * `io('http://localhost/a');`\n * `io('http://localhost/b');`\n *\n * We reuse the existing instance based on same scheme/port/host,\n * and we initialize sockets for each namespace.\n *\n * @api public\n */\n\nfunction lookup (uri, opts) {\n if (typeof uri === 'object') {\n opts = uri;\n uri = undefined;\n }\n\n opts = opts || {};\n\n var parsed = url(uri);\n var source = parsed.source;\n var id = parsed.id;\n var path = parsed.path;\n var sameNamespace = cache[id] && path in cache[id].nsps;\n var newConnection = opts.forceNew || opts['force new connection'] ||\n false === opts.multiplex || sameNamespace;\n\n var io;\n\n if (newConnection) {\n debug('ignoring socket cache for %s', source);\n io = Manager(source, opts);\n } else {\n if (!cache[id]) {\n debug('new io instance for %s', source);\n cache[id] = Manager(source, opts);\n }\n io = cache[id];\n }\n if (parsed.query && !opts.query) {\n opts.query = parsed.query;\n }\n return io.socket(parsed.path, opts);\n}\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = parser.protocol;\n\n/**\n * `connect`.\n *\n * @param {String} uri\n * @api public\n */\n\nexports.connect = lookup;\n\n/**\n * Expose constructors for standalone build.\n *\n * @api public\n */\n\nexports.Manager = require('./manager');\nexports.Socket = require('./socket');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/index.js\n// module id = 0\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar parseuri = require('parseuri');\nvar debug = require('debug')('socket.io-client:url');\n\n/**\n * Module exports.\n */\n\nmodule.exports = url;\n\n/**\n * URL parser.\n *\n * @param {String} url\n * @param {Object} An object meant to mimic window.location.\n * Defaults to window.location.\n * @api public\n */\n\nfunction url (uri, loc) {\n var obj = uri;\n\n // default to window.location\n loc = loc || (typeof location !== 'undefined' && location);\n if (null == uri) uri = loc.protocol + '//' + loc.host;\n\n // relative path support\n if ('string' === typeof uri) {\n if ('/' === uri.charAt(0)) {\n if ('/' === uri.charAt(1)) {\n uri = loc.protocol + uri;\n } else {\n uri = loc.host + uri;\n }\n }\n\n if (!/^(https?|wss?):\\/\\//.test(uri)) {\n debug('protocol-less url %s', uri);\n if ('undefined' !== typeof loc) {\n uri = loc.protocol + '//' + uri;\n } else {\n uri = 'https://' + uri;\n }\n }\n\n // parse\n debug('parse %s', uri);\n obj = parseuri(uri);\n }\n\n // make sure we treat `localhost:80` and `localhost` equally\n if (!obj.port) {\n if (/^(http|ws)$/.test(obj.protocol)) {\n obj.port = '80';\n } else if (/^(http|ws)s$/.test(obj.protocol)) {\n obj.port = '443';\n }\n }\n\n obj.path = obj.path || '/';\n\n var ipv6 = obj.host.indexOf(':') !== -1;\n var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\n // define unique id\n obj.id = obj.protocol + '://' + host + ':' + obj.port;\n // define href\n obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));\n\n return obj;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/url.js\n// module id = 1\n// module chunks = 0","/**\r\n * Parses an URI\r\n *\r\n * @author Steven Levithan <stevenlevithan.com> (MIT license)\r\n * @api private\r\n */\r\n\r\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\r\n\r\nvar parts = [\r\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\r\n];\r\n\r\nmodule.exports = function parseuri(str) {\r\n var src = str,\r\n b = str.indexOf('['),\r\n e = str.indexOf(']');\r\n\r\n if (b != -1 && e != -1) {\r\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\r\n }\r\n\r\n var m = re.exec(str || ''),\r\n uri = {},\r\n i = 14;\r\n\r\n while (i--) {\r\n uri[parts[i]] = m[i] || '';\r\n }\r\n\r\n if (b != -1 && e != -1) {\r\n uri.source = src;\r\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\r\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\r\n uri.ipv6uri = true;\r\n }\r\n\r\n return uri;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseuri/index.js\n// module id = 2\n// module chunks = 0","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\nfunction log(...args) {\n\t// This hackery is required for IE8/9, where\n\t// the `console.log` function doesn't have 'apply'\n\treturn typeof console === 'object' &&\n\t\tconsole.log &&\n\t\tconsole.log(...args);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/debug/src/browser.js","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 4\n// module chunks = 0","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* Active `debug` instances.\n\t*/\n\tcreateDebug.instances = [];\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn match;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.enabled = createDebug.enabled(namespace);\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = selectColor(namespace);\n\t\tdebug.destroy = destroy;\n\t\tdebug.extend = extend;\n\t\t// Debug.formatArgs = formatArgs;\n\t\t// debug.rawLog = rawLog;\n\n\t\t// env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\tcreateDebug.instances.push(debug);\n\n\t\treturn debug;\n\t}\n\n\tfunction destroy() {\n\t\tconst index = createDebug.instances.indexOf(this);\n\t\tif (index !== -1) {\n\t\t\tcreateDebug.instances.splice(index, 1);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0; i < createDebug.instances.length; i++) {\n\t\t\tconst instance = createDebug.instances[i];\n\t\t\tinstance.enabled = createDebug.enabled(instance.namespace);\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n\n\n\n// WEBPACK FOOTER //\n// ./~/debug/src/common.js","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ms/index.js\n// module id = 6\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar binary = require('./binary');\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = 4;\n\n/**\n * Packet types.\n *\n * @api public\n */\n\nexports.types = [\n 'CONNECT',\n 'DISCONNECT',\n 'EVENT',\n 'ACK',\n 'ERROR',\n 'BINARY_EVENT',\n 'BINARY_ACK'\n];\n\n/**\n * Packet type `connect`.\n *\n * @api public\n */\n\nexports.CONNECT = 0;\n\n/**\n * Packet type `disconnect`.\n *\n * @api public\n */\n\nexports.DISCONNECT = 1;\n\n/**\n * Packet type `event`.\n *\n * @api public\n */\n\nexports.EVENT = 2;\n\n/**\n * Packet type `ack`.\n *\n * @api public\n */\n\nexports.ACK = 3;\n\n/**\n * Packet type `error`.\n *\n * @api public\n */\n\nexports.ERROR = 4;\n\n/**\n * Packet type 'binary event'\n *\n * @api public\n */\n\nexports.BINARY_EVENT = 5;\n\n/**\n * Packet type `binary ack`. For acks with binary arguments.\n *\n * @api public\n */\n\nexports.BINARY_ACK = 6;\n\n/**\n * Encoder constructor.\n *\n * @api public\n */\n\nexports.Encoder = Encoder;\n\n/**\n * Decoder constructor.\n *\n * @api public\n */\n\nexports.Decoder = Decoder;\n\n/**\n * A socket.io Encoder instance\n *\n * @api public\n */\n\nfunction Encoder() {}\n\nvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\n/**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n * @param {Function} callback - function to handle encodings (likely engine.write)\n * @return Calls callback with Array of encodings\n * @api public\n */\n\nEncoder.prototype.encode = function(obj, callback){\n debug('encoding packet %j', obj);\n\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n encodeAsBinary(obj, callback);\n } else {\n var encoding = encodeAsString(obj);\n callback([encoding]);\n }\n};\n\n/**\n * Encode packet as string.\n *\n * @param {Object} packet\n * @return {String} encoded\n * @api private\n */\n\nfunction encodeAsString(obj) {\n\n // first is type\n var str = '' + obj.type;\n\n // attachments if we have them\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n str += obj.attachments + '-';\n }\n\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && '/' !== obj.nsp) {\n str += obj.nsp + ',';\n }\n\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n\n // json data\n if (null != obj.data) {\n var payload = tryStringify(obj.data);\n if (payload !== false) {\n str += payload;\n } else {\n return ERROR_PACKET;\n }\n }\n\n debug('encoded %j as %s', obj, str);\n return str;\n}\n\nfunction tryStringify(str) {\n try {\n return JSON.stringify(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n *\n * @param {Object} packet\n * @return {Buffer} encoded\n * @api private\n */\n\nfunction encodeAsBinary(obj, callback) {\n\n function writeEncoding(bloblessData) {\n var deconstruction = binary.deconstructPacket(bloblessData);\n var pack = encodeAsString(deconstruction.packet);\n var buffers = deconstruction.buffers;\n\n buffers.unshift(pack); // add packet info to beginning of data list\n callback(buffers); // write all the buffers\n }\n\n binary.removeBlobs(obj, writeEncoding);\n}\n\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n * @api public\n */\n\nfunction Decoder() {\n this.reconstructor = null;\n}\n\n/**\n * Mix in `Emitter` with Decoder.\n */\n\nEmitter(Decoder.prototype);\n\n/**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n * @return {Object} packet\n * @api public\n */\n\nDecoder.prototype.add = function(obj) {\n var packet;\n if (typeof obj === 'string') {\n packet = decodeString(obj);\n if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n\n // no attachments, labeled binary but no binary data to follow\n if (this.reconstructor.reconPack.attachments === 0) {\n this.emit('decoded', packet);\n }\n } else { // non-binary full packet\n this.emit('decoded', packet);\n }\n } else if (isBuf(obj) || obj.base64) { // raw binary data\n if (!this.reconstructor) {\n throw new Error('got binary data when not reconstructing a packet');\n } else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) { // received final buffer\n this.reconstructor = null;\n this.emit('decoded', packet);\n }\n }\n } else {\n throw new Error('Unknown type: ' + obj);\n }\n};\n\n/**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n * @api private\n */\n\nfunction decodeString(str) {\n var i = 0;\n // look up type\n var p = {\n type: Number(str.charAt(0))\n };\n\n if (null == exports.types[p.type]) {\n return error('unknown packet type ' + p.type);\n }\n\n // look up attachments if type binary\n if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n var buf = '';\n while (str.charAt(++i) !== '-') {\n buf += str.charAt(i);\n if (i == str.length) break;\n }\n if (buf != Number(buf) || str.charAt(i) !== '-') {\n throw new Error('Illegal attachments');\n }\n p.attachments = Number(buf);\n }\n\n // look up namespace (if any)\n if ('/' === str.charAt(i + 1)) {\n p.nsp = '';\n while (++i) {\n var c = str.charAt(i);\n if (',' === c) break;\n p.nsp += c;\n if (i === str.length) break;\n }\n } else {\n p.nsp = '/';\n }\n\n // look up id\n var next = str.charAt(i + 1);\n if ('' !== next && Number(next) == next) {\n p.id = '';\n while (++i) {\n var c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n p.id += str.charAt(i);\n if (i === str.length) break;\n }\n p.id = Number(p.id);\n }\n\n // look up json data\n if (str.charAt(++i)) {\n var payload = tryParse(str.substr(i));\n var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n if (isPayloadValid) {\n p.data = payload;\n } else {\n return error('invalid payload');\n }\n }\n\n debug('decoded %s as %j', str, p);\n return p;\n}\n\nfunction tryParse(str) {\n try {\n return JSON.parse(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Deallocates a parser's resources\n *\n * @api public\n */\n\nDecoder.prototype.destroy = function() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n }\n};\n\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n * @api private\n */\n\nfunction BinaryReconstructor(packet) {\n this.reconPack = packet;\n this.buffers = [];\n}\n\n/**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n * @api private\n */\n\nBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n};\n\n/**\n * Cleans up binary packet reconstruction variables.\n *\n * @api private\n */\n\nBinaryReconstructor.prototype.finishedReconstruction = function() {\n this.reconPack = null;\n this.buffers = [];\n};\n\nfunction error(msg) {\n return {\n type: exports.ERROR,\n data: 'parser error: ' + msg\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/index.js\n// module id = 7\n// module chunks = 0","/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',\n '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',\n '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',\n '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',\n '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',\n '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',\n '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',\n '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',\n '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',\n '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',\n '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {\n return true;\n }\n\n // Internet Explorer and Edge do not support colors.\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n\n // is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n // double check webkit in userAgent just in case we are in a worker\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (err) {\n return '[UnexpectedJSONParseError]: ' + err.message;\n }\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return;\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit')\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n try {\n return window.localStorage;\n } catch (e) {}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/socket.io-parser/~/debug/src/browser.js","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = createDebug.debug = createDebug['default'] = createDebug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * Active `debug` instances.\n */\nexports.instances = [];\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\nexports.formatters = {};\n\n/**\n * Select a color.\n * @param {String} namespace\n * @return {Number}\n * @api private\n */\n\nfunction selectColor(namespace) {\n var hash = 0, i;\n\n for (i in namespace) {\n hash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return exports.colors[Math.abs(hash) % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction createDebug(namespace) {\n\n var prevTime;\n\n function debug() {\n // disabled?\n if (!debug.enabled) return;\n\n var self = debug;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // turn the `arguments` into a proper Array\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %O\n args.unshift('%O');\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n // apply env-specific formatting (colors, etc.)\n exports.formatArgs.call(self, args);\n\n var logFn = debug.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = exports.enabled(namespace);\n debug.useColors = exports.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n\n // env-specific initialization logic for debug instances\n if ('function' === typeof exports.init) {\n exports.init(debug);\n }\n\n exports.instances.push(debug);\n\n return debug;\n}\n\nfunction destroy () {\n var index = exports.instances.indexOf(this);\n if (index !== -1) {\n exports.instances.splice(index, 1);\n return true;\n } else {\n return false;\n }\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n exports.names = [];\n exports.skips = [];\n\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < exports.instances.length; i++) {\n var instance = exports.instances[i];\n instance.enabled = exports.enabled(instance.namespace);\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/socket.io-parser/~/debug/src/debug.js","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isNaN(val) === false) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n if (ms >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (ms >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (ms >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (ms >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n return plural(ms, d, 'day') ||\n plural(ms, h, 'hour') ||\n plural(ms, m, 'minute') ||\n plural(ms, s, 'second') ||\n ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) {\n return;\n }\n if (ms < n * 1.5) {\n return Math.floor(ms / n) + ' ' + name;\n }\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/~/ms/index.js\n// module id = 10\n// module chunks = 0","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-emitter/index.js\n// module id = 11\n// module chunks = 0","/*global Blob,File*/\n\n/**\n * Module requirements\n */\n\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\nvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\n/**\n * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n * Anything with blobs or files should be fed through removeBlobs before coming\n * here.\n *\n * @param {Object} packet - socket.io event packet\n * @return {Object} with deconstructed packet and list of buffers\n * @api public\n */\n\nexports.deconstructPacket = function(packet) {\n var buffers = [];\n var packetData = packet.data;\n var pack = packet;\n pack.data = _deconstructPacket(packetData, buffers);\n pack.attachments = buffers.length; // number of binary 'attachments'\n return {packet: pack, buffers: buffers};\n};\n\nfunction _deconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (isBuf(data)) {\n var placeholder = { _placeholder: true, num: buffers.length };\n buffers.push(data);\n return placeholder;\n } else if (isArray(data)) {\n var newData = new Array(data.length);\n for (var i = 0; i < data.length; i++) {\n newData[i] = _deconstructPacket(data[i], buffers);\n }\n return newData;\n } else if (typeof data === 'object' && !(data instanceof Date)) {\n var newData = {};\n for (var key in data) {\n newData[key] = _deconstructPacket(data[key], buffers);\n }\n return newData;\n }\n return data;\n}\n\n/**\n * Reconstructs a binary packet from its placeholder packet and buffers\n *\n * @param {Object} packet - event packet with placeholders\n * @param {Array} buffers - binary buffers to put in placeholder positions\n * @return {Object} reconstructed packet\n * @api public\n */\n\nexports.reconstructPacket = function(packet, buffers) {\n packet.data = _reconstructPacket(packet.data, buffers);\n packet.attachments = undefined; // no longer useful\n return packet;\n};\n\nfunction _reconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (data && data._placeholder) {\n return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n } else if (isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n data[i] = _reconstructPacket(data[i], buffers);\n }\n } else if (typeof data === 'object') {\n for (var key in data) {\n data[key] = _reconstructPacket(data[key], buffers);\n }\n }\n\n return data;\n}\n\n/**\n * Asynchronously removes Blobs or Files from data via\n * FileReader's readAsArrayBuffer method. Used before encoding\n * data as msgpack. Calls callback with the blobless data.\n *\n * @param {Object} data\n * @param {Function} callback\n * @api private\n */\n\nexports.removeBlobs = function(data, callback) {\n function _removeBlobs(obj, curKey, containingObject) {\n if (!obj) return obj;\n\n // convert any blob\n if ((withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)) {\n pendingBlobs++;\n\n // async filereader\n var fileReader = new FileReader();\n fileReader.onload = function() { // this.result == arraybuffer\n if (containingObject) {\n containingObject[curKey] = this.result;\n }\n else {\n bloblessData = this.result;\n }\n\n // if nothing pending its callback time\n if(! --pendingBlobs) {\n callback(bloblessData);\n }\n };\n\n fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n } else if (isArray(obj)) { // handle array\n for (var i = 0; i < obj.length; i++) {\n _removeBlobs(obj[i], i, obj);\n }\n } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n for (var key in obj) {\n _removeBlobs(obj[key], key, obj);\n }\n }\n }\n\n var pendingBlobs = 0;\n var bloblessData = data;\n _removeBlobs(bloblessData);\n if (!pendingBlobs) {\n callback(bloblessData);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/binary.js\n// module id = 12\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 13\n// module chunks = 0","\nmodule.exports = isBuf;\n\nvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\nvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\nvar isView = function (obj) {\n return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n};\n\n/**\n * Returns true if obj is a buffer or an arraybuffer.\n *\n * @api private\n */\n\nfunction isBuf(obj) {\n return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/is-buffer.js\n// module id = 14\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar eio = require('engine.io-client');\nvar Socket = require('./socket');\nvar Emitter = require('component-emitter');\nvar parser = require('socket.io-parser');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:manager');\nvar indexOf = require('indexof');\nvar Backoff = require('backo2');\n\n/**\n * IE6+ hasOwnProperty\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Module exports\n */\n\nmodule.exports = Manager;\n\n/**\n * `Manager` constructor.\n *\n * @param {String} engine instance or engine uri/opts\n * @param {Object} options\n * @api public\n */\n\nfunction Manager (uri, opts) {\n if (!(this instanceof Manager)) return new Manager(uri, opts);\n if (uri && ('object' === typeof uri)) {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n\n opts.path = opts.path || '/socket.io';\n this.nsps = {};\n this.subs = [];\n this.opts = opts;\n this.reconnection(opts.reconnection !== false);\n this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n this.reconnectionDelay(opts.reconnectionDelay || 1000);\n this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n this.randomizationFactor(opts.randomizationFactor || 0.5);\n this.backoff = new Backoff({\n min: this.reconnectionDelay(),\n max: this.reconnectionDelayMax(),\n jitter: this.randomizationFactor()\n });\n this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n this.readyState = 'closed';\n this.uri = uri;\n this.connecting = [];\n this.lastPing = null;\n this.encoding = false;\n this.packetBuffer = [];\n var _parser = opts.parser || parser;\n this.encoder = new _parser.Encoder();\n this.decoder = new _parser.Decoder();\n this.autoConnect = opts.autoConnect !== false;\n if (this.autoConnect) this.open();\n}\n\n/**\n * Propagate given event to sockets and emit on `this`\n *\n * @api private\n */\n\nManager.prototype.emitAll = function () {\n this.emit.apply(this, arguments);\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n }\n }\n};\n\n/**\n * Update `socket.id` of all sockets\n *\n * @api private\n */\n\nManager.prototype.updateSocketIds = function () {\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].id = this.generateId(nsp);\n }\n }\n};\n\n/**\n * generate `socket.id` for the given `nsp`\n *\n * @param {String} nsp\n * @return {String}\n * @api private\n */\n\nManager.prototype.generateId = function (nsp) {\n return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;\n};\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Manager.prototype);\n\n/**\n * Sets the `reconnection` config.\n *\n * @param {Boolean} true/false if it should automatically reconnect\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnection = function (v) {\n if (!arguments.length) return this._reconnection;\n this._reconnection = !!v;\n return this;\n};\n\n/**\n * Sets the reconnection attempts config.\n *\n * @param {Number} max reconnection attempts before giving up\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionAttempts = function (v) {\n if (!arguments.length) return this._reconnectionAttempts;\n this._reconnectionAttempts = v;\n return this;\n};\n\n/**\n * Sets the delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelay = function (v) {\n if (!arguments.length) return this._reconnectionDelay;\n this._reconnectionDelay = v;\n this.backoff && this.backoff.setMin(v);\n return this;\n};\n\nManager.prototype.randomizationFactor = function (v) {\n if (!arguments.length) return this._randomizationFactor;\n this._randomizationFactor = v;\n this.backoff && this.backoff.setJitter(v);\n return this;\n};\n\n/**\n * Sets the maximum delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelayMax = function (v) {\n if (!arguments.length) return this._reconnectionDelayMax;\n this._reconnectionDelayMax = v;\n this.backoff && this.backoff.setMax(v);\n return this;\n};\n\n/**\n * Sets the connection timeout. `false` to disable\n *\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.timeout = function (v) {\n if (!arguments.length) return this._timeout;\n this._timeout = v;\n return this;\n};\n\n/**\n * Starts trying to reconnect if reconnection is enabled and we have not\n * started reconnecting yet\n *\n * @api private\n */\n\nManager.prototype.maybeReconnectOnOpen = function () {\n // Only try to reconnect if it's the first time we're connecting\n if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n // keeps reconnection from firing twice for the same reconnection loop\n this.reconnect();\n }\n};\n\n/**\n * Sets the current transport `socket`.\n *\n * @param {Function} optional, callback\n * @return {Manager} self\n * @api public\n */\n\nManager.prototype.open =\nManager.prototype.connect = function (fn, opts) {\n debug('readyState %s', this.readyState);\n if (~this.readyState.indexOf('open')) return this;\n\n debug('opening %s', this.uri);\n this.engine = eio(this.uri, this.opts);\n var socket = this.engine;\n var self = this;\n this.readyState = 'opening';\n this.skipReconnect = false;\n\n // emit `open`\n var openSub = on(socket, 'open', function () {\n self.onopen();\n fn && fn();\n });\n\n // emit `connect_error`\n var errorSub = on(socket, 'error', function (data) {\n debug('connect_error');\n self.cleanup();\n self.readyState = 'closed';\n self.emitAll('connect_error', data);\n if (fn) {\n var err = new Error('Connection error');\n err.data = data;\n fn(err);\n } else {\n // Only do this if there is no fn to handle the error\n self.maybeReconnectOnOpen();\n }\n });\n\n // emit `connect_timeout`\n if (false !== this._timeout) {\n var timeout = this._timeout;\n debug('connect attempt will timeout after %d', timeout);\n\n // set timer\n var timer = setTimeout(function () {\n debug('connect attempt timed out after %d', timeout);\n openSub.destroy();\n socket.close();\n socket.emit('error', 'timeout');\n self.emitAll('connect_timeout', timeout);\n }, timeout);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n\n this.subs.push(openSub);\n this.subs.push(errorSub);\n\n return this;\n};\n\n/**\n * Called upon transport open.\n *\n * @api private\n */\n\nManager.prototype.onopen = function () {\n debug('open');\n\n // clear old subs\n this.cleanup();\n\n // mark as open\n this.readyState = 'open';\n this.emit('open');\n\n // add new subs\n var socket = this.engine;\n this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n};\n\n/**\n * Called upon a ping.\n *\n * @api private\n */\n\nManager.prototype.onping = function () {\n this.lastPing = new Date();\n this.emitAll('ping');\n};\n\n/**\n * Called upon a packet.\n *\n * @api private\n */\n\nManager.prototype.onpong = function () {\n this.emitAll('pong', new Date() - this.lastPing);\n};\n\n/**\n * Called with data.\n *\n * @api private\n */\n\nManager.prototype.ondata = function (data) {\n this.decoder.add(data);\n};\n\n/**\n * Called when parser fully decodes a packet.\n *\n * @api private\n */\n\nManager.prototype.ondecoded = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon socket error.\n *\n * @api private\n */\n\nManager.prototype.onerror = function (err) {\n debug('error', err);\n this.emitAll('error', err);\n};\n\n/**\n * Creates a new socket for the given `nsp`.\n *\n * @return {Socket}\n * @api public\n */\n\nManager.prototype.socket = function (nsp, opts) {\n var socket = this.nsps[nsp];\n if (!socket) {\n socket = new Socket(this, nsp, opts);\n this.nsps[nsp] = socket;\n var self = this;\n socket.on('connecting', onConnecting);\n socket.on('connect', function () {\n socket.id = self.generateId(nsp);\n });\n\n if (this.autoConnect) {\n // manually call here since connecting event is fired before listening\n onConnecting();\n }\n }\n\n function onConnecting () {\n if (!~indexOf(self.connecting, socket)) {\n self.connecting.push(socket);\n }\n }\n\n return socket;\n};\n\n/**\n * Called upon a socket close.\n *\n * @param {Socket} socket\n */\n\nManager.prototype.destroy = function (socket) {\n var index = indexOf(this.connecting, socket);\n if (~index) this.connecting.splice(index, 1);\n if (this.connecting.length) return;\n\n this.close();\n};\n\n/**\n * Writes a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nManager.prototype.packet = function (packet) {\n debug('writing packet %j', packet);\n var self = this;\n if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\n if (!self.encoding) {\n // encode, then write to engine with result\n self.encoding = true;\n this.encoder.encode(packet, function (encodedPackets) {\n for (var i = 0; i < encodedPackets.length; i++) {\n self.engine.write(encodedPackets[i], packet.options);\n }\n self.encoding = false;\n self.processPacketQueue();\n });\n } else { // add packet to the queue\n self.packetBuffer.push(packet);\n }\n};\n\n/**\n * If packet buffer is non-empty, begins encoding the\n * next packet in line.\n *\n * @api private\n */\n\nManager.prototype.processPacketQueue = function () {\n if (this.packetBuffer.length > 0 && !this.encoding) {\n var pack = this.packetBuffer.shift();\n this.packet(pack);\n }\n};\n\n/**\n * Clean up transport subscriptions and packet buffer.\n *\n * @api private\n */\n\nManager.prototype.cleanup = function () {\n debug('cleanup');\n\n var subsLength = this.subs.length;\n for (var i = 0; i < subsLength; i++) {\n var sub = this.subs.shift();\n sub.destroy();\n }\n\n this.packetBuffer = [];\n this.encoding = false;\n this.lastPing = null;\n\n this.decoder.destroy();\n};\n\n/**\n * Close the current socket.\n *\n * @api private\n */\n\nManager.prototype.close =\nManager.prototype.disconnect = function () {\n debug('disconnect');\n this.skipReconnect = true;\n this.reconnecting = false;\n if ('opening' === this.readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this.readyState = 'closed';\n if (this.engine) this.engine.close();\n};\n\n/**\n * Called upon engine close.\n *\n * @api private\n */\n\nManager.prototype.onclose = function (reason) {\n debug('onclose');\n\n this.cleanup();\n this.backoff.reset();\n this.readyState = 'closed';\n this.emit('close', reason);\n\n if (this._reconnection && !this.skipReconnect) {\n this.reconnect();\n }\n};\n\n/**\n * Attempt a reconnection.\n *\n * @api private\n */\n\nManager.prototype.reconnect = function () {\n if (this.reconnecting || this.skipReconnect) return this;\n\n var self = this;\n\n if (this.backoff.attempts >= this._reconnectionAttempts) {\n debug('reconnect failed');\n this.backoff.reset();\n this.emitAll('reconnect_failed');\n this.reconnecting = false;\n } else {\n var delay = this.backoff.duration();\n debug('will wait %dms before reconnect attempt', delay);\n\n this.reconnecting = true;\n var timer = setTimeout(function () {\n if (self.skipReconnect) return;\n\n debug('attempting reconnect');\n self.emitAll('reconnect_attempt', self.backoff.attempts);\n self.emitAll('reconnecting', self.backoff.attempts);\n\n // check again for the case socket closed in above events\n if (self.skipReconnect) return;\n\n self.open(function (err) {\n if (err) {\n debug('reconnect attempt error');\n self.reconnecting = false;\n self.reconnect();\n self.emitAll('reconnect_error', err.data);\n } else {\n debug('reconnect success');\n self.onreconnect();\n }\n });\n }, delay);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n};\n\n/**\n * Called upon successful reconnect.\n *\n * @api private\n */\n\nManager.prototype.onreconnect = function () {\n var attempt = this.backoff.attempts;\n this.reconnecting = false;\n this.backoff.reset();\n this.updateSocketIds();\n this.emitAll('reconnect', attempt);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/manager.js\n// module id = 15\n// module chunks = 0","\nmodule.exports = require('./socket');\n\n/**\n * Exports parser\n *\n * @api public\n *\n */\nmodule.exports.parser = require('engine.io-parser');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/index.js\n// module id = 16\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar transports = require('./transports/index');\nvar Emitter = require('component-emitter');\nvar debug = require('debug')('engine.io-client:socket');\nvar index = require('indexof');\nvar parser = require('engine.io-parser');\nvar parseuri = require('parseuri');\nvar parseqs = require('parseqs');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Socket;\n\n/**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n\nfunction Socket (uri, opts) {\n if (!(this instanceof Socket)) return new Socket(uri, opts);\n\n opts = opts || {};\n\n if (uri && 'object' === typeof uri) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n this.secure = null != opts.secure ? opts.secure\n : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = this.secure ? '443' : '80';\n }\n\n this.agent = opts.agent || false;\n this.hostname = opts.hostname ||\n (typeof location !== 'undefined' ? location.hostname : 'localhost');\n this.port = opts.port || (typeof location !== 'undefined' && location.port\n ? location.port\n : (this.secure ? 443 : 80));\n this.query = opts.query || {};\n if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n this.upgrade = false !== opts.upgrade;\n this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n this.forceJSONP = !!opts.forceJSONP;\n this.jsonp = false !== opts.jsonp;\n this.forceBase64 = !!opts.forceBase64;\n this.enablesXDR = !!opts.enablesXDR;\n this.withCredentials = false !== opts.withCredentials;\n this.timestampParam = opts.timestampParam || 't';\n this.timestampRequests = opts.timestampRequests;\n this.transports = opts.transports || ['polling', 'websocket'];\n this.transportOptions = opts.transportOptions || {};\n this.readyState = '';\n this.writeBuffer = [];\n this.prevBufferLen = 0;\n this.policyPort = opts.policyPort || 843;\n this.rememberUpgrade = opts.rememberUpgrade || false;\n this.binaryType = null;\n this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\n if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n this.perMessageDeflate.threshold = 1024;\n }\n\n // SSL options for Node.js client\n this.pfx = opts.pfx || null;\n this.key = opts.key || null;\n this.passphrase = opts.passphrase || null;\n this.cert = opts.cert || null;\n this.ca = opts.ca || null;\n this.ciphers = opts.ciphers || null;\n this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n this.forceNode = !!opts.forceNode;\n\n // detect ReactNative environment\n this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\n // other options for Node.js or ReactNative client\n if (typeof self === 'undefined' || this.isReactNative) {\n if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n this.extraHeaders = opts.extraHeaders;\n }\n\n if (opts.localAddress) {\n this.localAddress = opts.localAddress;\n }\n }\n\n // set on handshake\n this.id = null;\n this.upgrades = null;\n this.pingInterval = null;\n this.pingTimeout = null;\n\n // set on heartbeat\n this.pingIntervalTimer = null;\n this.pingTimeoutTimer = null;\n\n this.open();\n}\n\nSocket.priorWebsocketSuccess = false;\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\nSocket.Socket = Socket;\nSocket.Transport = require('./transport');\nSocket.transports = require('./transports/index');\nSocket.parser = require('engine.io-parser');\n\n/**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n\nSocket.prototype.createTransport = function (name) {\n debug('creating transport \"%s\"', name);\n var query = clone(this.query);\n\n // append engine.io protocol identifier\n query.EIO = parser.protocol;\n\n // transport name\n query.transport = name;\n\n // per-transport options\n var options = this.transportOptions[name] || {};\n\n // session id if we already have one\n if (this.id) query.sid = this.id;\n\n var transport = new transports[name]({\n query: query,\n socket: this,\n agent: options.agent || this.agent,\n hostname: options.hostname || this.hostname,\n port: options.port || this.port,\n secure: options.secure || this.secure,\n path: options.path || this.path,\n forceJSONP: options.forceJSONP || this.forceJSONP,\n jsonp: options.jsonp || this.jsonp,\n forceBase64: options.forceBase64 || this.forceBase64,\n enablesXDR: options.enablesXDR || this.enablesXDR,\n withCredentials: options.withCredentials || this.withCredentials,\n timestampRequests: options.timestampRequests || this.timestampRequests,\n timestampParam: options.timestampParam || this.timestampParam,\n policyPort: options.policyPort || this.policyPort,\n pfx: options.pfx || this.pfx,\n key: options.key || this.key,\n passphrase: options.passphrase || this.passphrase,\n cert: options.cert || this.cert,\n ca: options.ca || this.ca,\n ciphers: options.ciphers || this.ciphers,\n rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n extraHeaders: options.extraHeaders || this.extraHeaders,\n forceNode: options.forceNode || this.forceNode,\n localAddress: options.localAddress || this.localAddress,\n requestTimeout: options.requestTimeout || this.requestTimeout,\n protocols: options.protocols || void (0),\n isReactNative: this.isReactNative\n });\n\n return transport;\n};\n\nfunction clone (obj) {\n var o = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n return o;\n}\n\n/**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\nSocket.prototype.open = function () {\n var transport;\n if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n transport = 'websocket';\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n var self = this;\n setTimeout(function () {\n self.emit('error', 'No transports available');\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n this.readyState = 'opening';\n\n // Retry with the next transport if the transport is disabled (jsonp: false)\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n};\n\n/**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n\nSocket.prototype.setTransport = function (transport) {\n debug('setting transport %s', transport.name);\n var self = this;\n\n if (this.transport) {\n debug('clearing existing transport %s', this.transport.name);\n this.transport.removeAllListeners();\n }\n\n // set up transport\n this.transport = transport;\n\n // set up transport listeners\n transport\n .on('drain', function () {\n self.onDrain();\n })\n .on('packet', function (packet) {\n self.onPacket(packet);\n })\n .on('error', function (e) {\n self.onError(e);\n })\n .on('close', function () {\n self.onClose('transport close');\n });\n};\n\n/**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n\nSocket.prototype.probe = function (name) {\n debug('probing transport \"%s\"', name);\n var transport = this.createTransport(name, { probe: 1 });\n var failed = false;\n var self = this;\n\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen () {\n if (self.onlyBinaryUpgrades) {\n var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n if (failed) return;\n\n debug('probe transport \"%s\" opened', name);\n transport.send([{ type: 'ping', data: 'probe' }]);\n transport.once('packet', function (msg) {\n if (failed) return;\n if ('pong' === msg.type && 'probe' === msg.data) {\n debug('probe transport \"%s\" pong', name);\n self.upgrading = true;\n self.emit('upgrading', transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\n debug('pausing current transport \"%s\"', self.transport.name);\n self.transport.pause(function () {\n if (failed) return;\n if ('closed' === self.readyState) return;\n debug('changing transport and sending upgrade packet');\n\n cleanup();\n\n self.setTransport(transport);\n transport.send([{ type: 'upgrade' }]);\n self.emit('upgrade', transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n debug('probe transport \"%s\" failed', name);\n var err = new Error('probe error');\n err.transport = transport.name;\n self.emit('upgradeError', err);\n }\n });\n }\n\n function freezeTransport () {\n if (failed) return;\n\n // Any callback called by transport should be ignored since now\n failed = true;\n\n cleanup();\n\n transport.close();\n transport = null;\n }\n\n // Handle any error that happens while probing\n function onerror (err) {\n var error = new Error('probe error: ' + err);\n error.transport = transport.name;\n\n freezeTransport();\n\n debug('probe transport \"%s\" failed because of error: %s', name, err);\n\n self.emit('upgradeError', error);\n }\n\n function onTransportClose () {\n onerror('transport closed');\n }\n\n // When the socket is closed while we're probing\n function onclose () {\n onerror('socket closed');\n }\n\n // When the socket is upgraded while we're probing\n function onupgrade (to) {\n if (transport && to.name !== transport.name) {\n debug('\"%s\" works - aborting \"%s\"', to.name, transport.name);\n freezeTransport();\n }\n }\n\n // Remove all listeners on the transport and on self\n function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }\n\n transport.once('open', onTransportOpen);\n transport.once('error', onerror);\n transport.once('close', onTransportClose);\n\n this.once('close', onclose);\n this.once('upgrading', onupgrade);\n\n transport.open();\n};\n\n/**\n * Called when connection is deemed open.\n *\n * @api public\n */\n\nSocket.prototype.onOpen = function () {\n debug('socket open');\n this.readyState = 'open';\n Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n this.emit('open');\n this.flush();\n\n // we check for `readyState` in case an `open`\n // listener already closed the socket\n if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n debug('starting upgrade probes');\n for (var i = 0, l = this.upgrades.length; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n};\n\n/**\n * Handles a packet.\n *\n * @api private\n */\n\nSocket.prototype.onPacket = function (packet) {\n if ('opening' === this.readyState || 'open' === this.readyState ||\n 'closing' === this.readyState) {\n debug('socket receive: type \"%s\", data \"%s\"', packet.type, packet.data);\n\n this.emit('packet', packet);\n\n // Socket is live - any packet counts\n this.emit('heartbeat');\n\n switch (packet.type) {\n case 'open':\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case 'pong':\n this.setPing();\n this.emit('pong');\n break;\n\n case 'error':\n var err = new Error('server error');\n err.code = packet.data;\n this.onError(err);\n break;\n\n case 'message':\n this.emit('data', packet.data);\n this.emit('message', packet.data);\n break;\n }\n } else {\n debug('packet received with socket readyState \"%s\"', this.readyState);\n }\n};\n\n/**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n\nSocket.prototype.onHandshake = function (data) {\n this.emit('handshake', data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen();\n // In case open handler closes socket\n if ('closed' === this.readyState) return;\n this.setPing();\n\n // Prolong liveness of socket on heartbeat\n this.removeListener('heartbeat', this.onHeartbeat);\n this.on('heartbeat', this.onHeartbeat);\n};\n\n/**\n * Resets ping timeout.\n *\n * @api private\n */\n\nSocket.prototype.onHeartbeat = function (timeout) {\n clearTimeout(this.pingTimeoutTimer);\n var self = this;\n self.pingTimeoutTimer = setTimeout(function () {\n if ('closed' === self.readyState) return;\n self.onClose('ping timeout');\n }, timeout || (self.pingInterval + self.pingTimeout));\n};\n\n/**\n * Pings server every `this.pingInterval` and expects response\n * within `this.pingTimeout` or closes connection.\n *\n * @api private\n */\n\nSocket.prototype.setPing = function () {\n var self = this;\n clearTimeout(self.pingIntervalTimer);\n self.pingIntervalTimer = setTimeout(function () {\n debug('writing ping packet - expecting pong within %sms', self.pingTimeout);\n self.ping();\n self.onHeartbeat(self.pingTimeout);\n }, self.pingInterval);\n};\n\n/**\n* Sends a ping packet.\n*\n* @api private\n*/\n\nSocket.prototype.ping = function () {\n var self = this;\n this.sendPacket('ping', function () {\n self.emit('ping');\n });\n};\n\n/**\n * Called on `drain` event\n *\n * @api private\n */\n\nSocket.prototype.onDrain = function () {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit('drain');\n } else {\n this.flush();\n }\n};\n\n/**\n * Flush write buffers.\n *\n * @api private\n */\n\nSocket.prototype.flush = function () {\n if ('closed' !== this.readyState && this.transport.writable &&\n !this.upgrading && this.writeBuffer.length) {\n debug('flushing %d packets in socket', this.writeBuffer.length);\n this.transport.send(this.writeBuffer);\n // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n this.prevBufferLen = this.writeBuffer.length;\n this.emit('flush');\n }\n};\n\n/**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n\nSocket.prototype.write =\nSocket.prototype.send = function (msg, options, fn) {\n this.sendPacket('message', msg, options, fn);\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n\nSocket.prototype.sendPacket = function (type, data, options, fn) {\n if ('function' === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if ('function' === typeof options) {\n fn = options;\n options = null;\n }\n\n if ('closing' === this.readyState || 'closed' === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n\n var packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit('packetCreate', packet);\n this.writeBuffer.push(packet);\n if (fn) this.once('flush', fn);\n this.flush();\n};\n\n/**\n * Closes the connection.\n *\n * @api private\n */\n\nSocket.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.readyState = 'closing';\n\n var self = this;\n\n if (this.writeBuffer.length) {\n this.once('drain', function () {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close () {\n self.onClose('forced close');\n debug('socket closing - telling transport to close');\n self.transport.close();\n }\n\n function cleanupAndClose () {\n self.removeListener('upgrade', cleanupAndClose);\n self.removeListener('upgradeError', cleanupAndClose);\n close();\n }\n\n function waitForUpgrade () {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once('upgrade', cleanupAndClose);\n self.once('upgradeError', cleanupAndClose);\n }\n\n return this;\n};\n\n/**\n * Called upon transport error\n *\n * @api private\n */\n\nSocket.prototype.onError = function (err) {\n debug('socket error %j', err);\n Socket.priorWebsocketSuccess = false;\n this.emit('error', err);\n this.onClose('transport error', err);\n};\n\n/**\n * Called upon transport close.\n *\n * @api private\n */\n\nSocket.prototype.onClose = function (reason, desc) {\n if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n debug('socket close with reason: \"%s\"', reason);\n var self = this;\n\n // clear timers\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer);\n\n // stop event from firing again for transport\n this.transport.removeAllListeners('close');\n\n // ensure transport won't stay open\n this.transport.close();\n\n // ignore further transport communication\n this.transport.removeAllListeners();\n\n // set ready state\n this.readyState = 'closed';\n\n // clear session id\n this.id = null;\n\n // emit close event\n this.emit('close', reason, desc);\n\n // clean buffers after, so users can still\n // grab the buffers on `close` event\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n};\n\n/**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n\nSocket.prototype.filterUpgrades = function (upgrades) {\n var filteredUpgrades = [];\n for (var i = 0, j = upgrades.length; i < j; i++) {\n if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n }\n return filteredUpgrades;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/socket.js\n// module id = 17\n// module chunks = 0","/**\n * Module dependencies\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar XHR = require('./polling-xhr');\nvar JSONP = require('./polling-jsonp');\nvar websocket = require('./websocket');\n\n/**\n * Export transports.\n */\n\nexports.polling = polling;\nexports.websocket = websocket;\n\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling (opts) {\n var xhr;\n var xd = false;\n var xs = false;\n var jsonp = false !== opts.jsonp;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if ('open' in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error('JSONP disabled');\n return new JSONP(opts);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/index.js\n// module id = 18\n// module chunks = 0","// browser shim for xmlhttprequest module\n\nvar hasCORS = require('has-cors');\n\nmodule.exports = function (opts) {\n var xdomain = opts.xdomain;\n\n // scheme must be same when usign XDomainRequest\n // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n var xscheme = opts.xscheme;\n\n // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n // https://github.com/Automattic/engine.io-client/pull/217\n var enablesXDR = opts.enablesXDR;\n\n // XMLHttpRequest can be disabled on IE\n try {\n if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n return new XMLHttpRequest();\n }\n } catch (e) { }\n\n // Use XDomainRequest for IE8 if enablesXDR is true\n // because loading bar keeps flashing when using jsonp-polling\n // https://github.com/yujiosaka/socke.io-ie8-loading-example\n try {\n if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n return new XDomainRequest();\n }\n } catch (e) { }\n\n if (!xdomain) {\n try {\n return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n } catch (e) { }\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/xmlhttprequest.js\n// module id = 19\n// module chunks = 0","\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-cors/index.js\n// module id = 20\n// module chunks = 0","/* global attachEvent */\n\n/**\n * Module requirements.\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar Polling = require('./polling');\nvar Emitter = require('component-emitter');\nvar inherit = require('component-inherit');\nvar debug = require('debug')('engine.io-client:polling-xhr');\n\n/**\n * Module exports.\n */\n\nmodule.exports = XHR;\nmodule.exports.Request = Request;\n\n/**\n * Empty function\n */\n\nfunction empty () {}\n\n/**\n * XHR Polling constructor.\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction XHR (opts) {\n Polling.call(this, opts);\n this.requestTimeout = opts.requestTimeout;\n this.extraHeaders = opts.extraHeaders;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n port !== opts.port;\n this.xs = opts.secure !== isSSL;\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(XHR, Polling);\n\n/**\n * XHR supports binary\n */\n\nXHR.prototype.supportsBinary = true;\n\n/**\n * Creates a request.\n *\n * @param {String} method\n * @api private\n */\n\nXHR.prototype.request = function (opts) {\n opts = opts || {};\n opts.uri = this.uri();\n opts.xd = this.xd;\n opts.xs = this.xs;\n opts.agent = this.agent || false;\n opts.supportsBinary = this.supportsBinary;\n opts.enablesXDR = this.enablesXDR;\n opts.withCredentials = this.withCredentials;\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n opts.requestTimeout = this.requestTimeout;\n\n // other options for Node.js client\n opts.extraHeaders = this.extraHeaders;\n\n return new Request(opts);\n};\n\n/**\n * Sends data.\n *\n * @param {String} data to send.\n * @param {Function} called upon flush.\n * @api private\n */\n\nXHR.prototype.doWrite = function (data, fn) {\n var isBinary = typeof data !== 'string' && data !== undefined;\n var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n var self = this;\n req.on('success', fn);\n req.on('error', function (err) {\n self.onError('xhr post error', err);\n });\n this.sendXhr = req;\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nXHR.prototype.doPoll = function () {\n debug('xhr poll');\n var req = this.request();\n var self = this;\n req.on('data', function (data) {\n self.onData(data);\n });\n req.on('error', function (err) {\n self.onError('xhr poll error', err);\n });\n this.pollXhr = req;\n};\n\n/**\n * Request constructor\n *\n * @param {Object} options\n * @api public\n */\n\nfunction Request (opts) {\n this.method = opts.method || 'GET';\n this.uri = opts.uri;\n this.xd = !!opts.xd;\n this.xs = !!opts.xs;\n this.async = false !== opts.async;\n this.data = undefined !== opts.data ? opts.data : null;\n this.agent = opts.agent;\n this.isBinary = opts.isBinary;\n this.supportsBinary = opts.supportsBinary;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n this.requestTimeout = opts.requestTimeout;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n\n this.create();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Request.prototype);\n\n/**\n * Creates the XHR object and sends the request.\n *\n * @api private\n */\n\nRequest.prototype.create = function () {\n var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n\n var xhr = this.xhr = new XMLHttpRequest(opts);\n var self = this;\n\n try {\n debug('xhr open %s: %s', this.method, this.uri);\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (var i in this.extraHeaders) {\n if (this.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if ('POST' === this.method) {\n try {\n if (this.isBinary) {\n xhr.setRequestHeader('Content-type', 'application/octet-stream');\n } else {\n xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n }\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader('Accept', '*/*');\n } catch (e) {}\n\n // ie6 check\n if ('withCredentials' in xhr) {\n xhr.withCredentials = this.withCredentials;\n }\n\n if (this.requestTimeout) {\n xhr.timeout = this.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function () {\n self.onLoad();\n };\n xhr.onerror = function () {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 2) {\n try {\n var contentType = xhr.getResponseHeader('Content-Type');\n if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n xhr.responseType = 'arraybuffer';\n }\n } catch (e) {}\n }\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function () {\n self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n debug('xhr data %s', this.data);\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly fhrom the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function () {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== 'undefined') {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n};\n\n/**\n * Called upon successful response.\n *\n * @api private\n */\n\nRequest.prototype.onSuccess = function () {\n this.emit('success');\n this.cleanup();\n};\n\n/**\n * Called if we have data.\n *\n * @api private\n */\n\nRequest.prototype.onData = function (data) {\n this.emit('data', data);\n this.onSuccess();\n};\n\n/**\n * Called upon error.\n *\n * @api private\n */\n\nRequest.prototype.onError = function (err) {\n this.emit('error', err);\n this.cleanup(true);\n};\n\n/**\n * Cleans up house.\n *\n * @api private\n */\n\nRequest.prototype.cleanup = function (fromError) {\n if ('undefined' === typeof this.xhr || null === this.xhr) {\n return;\n }\n // xmlhttprequest\n if (this.hasXDR()) {\n this.xhr.onload = this.xhr.onerror = empty;\n } else {\n this.xhr.onreadystatechange = empty;\n }\n\n if (fromError) {\n try {\n this.xhr.abort();\n } catch (e) {}\n }\n\n if (typeof document !== 'undefined') {\n delete Request.requests[this.index];\n }\n\n this.xhr = null;\n};\n\n/**\n * Called upon load.\n *\n * @api private\n */\n\nRequest.prototype.onLoad = function () {\n var data;\n try {\n var contentType;\n try {\n contentType = this.xhr.getResponseHeader('Content-Type');\n } catch (e) {}\n if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n data = this.xhr.response || this.xhr.responseText;\n } else {\n data = this.xhr.responseText;\n }\n } catch (e) {\n this.onError(e);\n }\n if (null != data) {\n this.onData(data);\n }\n};\n\n/**\n * Check if it has XDomainRequest.\n *\n * @api private\n */\n\nRequest.prototype.hasXDR = function () {\n return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n};\n\n/**\n * Aborts the request.\n *\n * @api public\n */\n\nRequest.prototype.abort = function () {\n this.cleanup();\n};\n\n/**\n * Aborts pending requests when unloading the window. This is needed to prevent\n * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n * emitted.\n */\n\nRequest.requestsCount = 0;\nRequest.requests = {};\n\nif (typeof document !== 'undefined') {\n if (typeof attachEvent === 'function') {\n attachEvent('onunload', unloadHandler);\n } else if (typeof addEventListener === 'function') {\n var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';\n addEventListener(terminationEvent, unloadHandler, false);\n }\n}\n\nfunction unloadHandler () {\n for (var i in Request.requests) {\n if (Request.requests.hasOwnProperty(i)) {\n Request.requests[i].abort();\n }\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-xhr.js\n// module id = 21\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parseqs = require('parseqs');\nvar parser = require('engine.io-parser');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:polling');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Polling;\n\n/**\n * Is XHR2 supported?\n */\n\nvar hasXHR2 = (function () {\n var XMLHttpRequest = require('xmlhttprequest-ssl');\n var xhr = new XMLHttpRequest({ xdomain: false });\n return null != xhr.responseType;\n})();\n\n/**\n * Polling interface.\n *\n * @param {Object} opts\n * @api private\n */\n\nfunction Polling (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (!hasXHR2 || forceBase64) {\n this.supportsBinary = false;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(Polling, Transport);\n\n/**\n * Transport name.\n */\n\nPolling.prototype.name = 'polling';\n\n/**\n * Opens the socket (triggers polling). We write a PING message to determine\n * when the transport is open.\n *\n * @api private\n */\n\nPolling.prototype.doOpen = function () {\n this.poll();\n};\n\n/**\n * Pauses polling.\n *\n * @param {Function} callback upon buffers are flushed and transport is paused\n * @api private\n */\n\nPolling.prototype.pause = function (onPause) {\n var self = this;\n\n this.readyState = 'pausing';\n\n function pause () {\n debug('paused');\n self.readyState = 'paused';\n onPause();\n }\n\n if (this.polling || !this.writable) {\n var total = 0;\n\n if (this.polling) {\n debug('we are currently polling - waiting to pause');\n total++;\n this.once('pollComplete', function () {\n debug('pre-pause polling complete');\n --total || pause();\n });\n }\n\n if (!this.writable) {\n debug('we are currently writing - waiting to pause');\n total++;\n this.once('drain', function () {\n debug('pre-pause writing complete');\n --total || pause();\n });\n }\n } else {\n pause();\n }\n};\n\n/**\n * Starts polling cycle.\n *\n * @api public\n */\n\nPolling.prototype.poll = function () {\n debug('polling');\n this.polling = true;\n this.doPoll();\n this.emit('poll');\n};\n\n/**\n * Overloads onData to detect payloads.\n *\n * @api private\n */\n\nPolling.prototype.onData = function (data) {\n var self = this;\n debug('polling got data %s', data);\n var callback = function (packet, index, total) {\n // if its the first message we consider the transport open\n if ('opening' === self.readyState) {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if ('close' === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType, callback);\n\n // if an event did not trigger closing\n if ('closed' !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit('pollComplete');\n\n if ('open' === this.readyState) {\n this.poll();\n } else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n};\n\n/**\n * For polling, send a close packet.\n *\n * @api private\n */\n\nPolling.prototype.doClose = function () {\n var self = this;\n\n function close () {\n debug('writing close packet');\n self.write([{ type: 'close' }]);\n }\n\n if ('open' === this.readyState) {\n debug('transport open - closing');\n close();\n } else {\n // in case we're trying to close while\n // handshaking is in progress (GH-164)\n debug('transport not open - deferring close');\n this.once('open', close);\n }\n};\n\n/**\n * Writes a packets payload.\n *\n * @param {Array} data packets\n * @param {Function} drain callback\n * @api private\n */\n\nPolling.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n var callbackfn = function () {\n self.writable = true;\n self.emit('drain');\n };\n\n parser.encodePayload(packets, this.supportsBinary, function (data) {\n self.doWrite(data, callbackfn);\n });\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nPolling.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'https' : 'http';\n var port = '';\n\n // cache busting is forced\n if (false !== this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n if (!this.supportsBinary && !query.sid) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // avoid port if default for schema\n if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n ('http' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling.js\n// module id = 22\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar parser = require('engine.io-parser');\nvar Emitter = require('component-emitter');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Transport;\n\n/**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n\nfunction Transport (opts) {\n this.path = opts.path;\n this.hostname = opts.hostname;\n this.port = opts.port;\n this.secure = opts.secure;\n this.query = opts.query;\n this.timestampParam = opts.timestampParam;\n this.timestampRequests = opts.timestampRequests;\n this.readyState = '';\n this.agent = opts.agent || false;\n this.socket = opts.socket;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n this.forceNode = opts.forceNode;\n\n // results of ReactNative environment detection\n this.isReactNative = opts.isReactNative;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n this.localAddress = opts.localAddress;\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Transport.prototype);\n\n/**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n\nTransport.prototype.onError = function (msg, desc) {\n var err = new Error(msg);\n err.type = 'TransportError';\n err.description = desc;\n this.emit('error', err);\n return this;\n};\n\n/**\n * Opens the transport.\n *\n * @api public\n */\n\nTransport.prototype.open = function () {\n if ('closed' === this.readyState || '' === this.readyState) {\n this.readyState = 'opening';\n this.doOpen();\n }\n\n return this;\n};\n\n/**\n * Closes the transport.\n *\n * @api private\n */\n\nTransport.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n};\n\n/**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n\nTransport.prototype.send = function (packets) {\n if ('open' === this.readyState) {\n this.write(packets);\n } else {\n throw new Error('Transport not open');\n }\n};\n\n/**\n * Called upon open\n *\n * @api private\n */\n\nTransport.prototype.onOpen = function () {\n this.readyState = 'open';\n this.writable = true;\n this.emit('open');\n};\n\n/**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n\nTransport.prototype.onData = function (data) {\n var packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n};\n\n/**\n * Called with a decoded packet.\n */\n\nTransport.prototype.onPacket = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon close.\n *\n * @api private\n */\n\nTransport.prototype.onClose = function () {\n this.readyState = 'closed';\n this.emit('close');\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transport.js\n// module id = 23\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar keys = require('./keys');\nvar hasBinary = require('has-binary2');\nvar sliceBuffer = require('arraybuffer.slice');\nvar after = require('after');\nvar utf8 = require('./utf8');\n\nvar base64encoder;\nif (typeof ArrayBuffer !== 'undefined') {\n base64encoder = require('base64-arraybuffer');\n}\n\n/**\n * Check if we are running an android browser. That requires us to use\n * ArrayBuffer with polling transports...\n *\n * http://ghinda.net/jpeg-blob-ajax-android/\n */\n\nvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\n/**\n * Check if we are running in PhantomJS.\n * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n * https://github.com/ariya/phantomjs/issues/11395\n * @type boolean\n */\nvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\n/**\n * When true, avoids using Blobs to encode payloads.\n * @type boolean\n */\nvar dontSendBlobs = isAndroid || isPhantomJS;\n\n/**\n * Current protocol version.\n */\n\nexports.protocol = 3;\n\n/**\n * Packet types.\n */\n\nvar packets = exports.packets = {\n open: 0 // non-ws\n , close: 1 // non-ws\n , ping: 2\n , pong: 3\n , message: 4\n , upgrade: 5\n , noop: 6\n};\n\nvar packetslist = keys(packets);\n\n/**\n * Premade error packet.\n */\n\nvar err = { type: 'error', data: 'parser error' };\n\n/**\n * Create a blob api even for blob builder when vendor prefixes exist\n */\n\nvar Blob = require('blob');\n\n/**\n * Encodes a packet.\n *\n * <packet type id> [ <data> ]\n *\n * Example:\n *\n * 5hello world\n * 3\n * 4\n *\n * Binary is encoded in an identical principle\n *\n * @api private\n */\n\nexports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = false;\n }\n\n if (typeof utf8encode === 'function') {\n callback = utf8encode;\n utf8encode = null;\n }\n\n var data = (packet.data === undefined)\n ? undefined\n : packet.data.buffer || packet.data;\n\n if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n return encodeArrayBuffer(packet, supportsBinary, callback);\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return encodeBlob(packet, supportsBinary, callback);\n }\n\n // might be an object with { base64: true, data: dataAsBase64String }\n if (data && data.base64) {\n return encodeBase64Object(packet, callback);\n }\n\n // Sending data as a utf-8 string\n var encoded = packets[packet.type];\n\n // data fragment is optional\n if (undefined !== packet.data) {\n encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n }\n\n return callback('' + encoded);\n\n};\n\nfunction encodeBase64Object(packet, callback) {\n // packet data is an object { base64: true, data: dataAsBase64String }\n var message = 'b' + exports.packets[packet.type] + packet.data.data;\n return callback(message);\n}\n\n/**\n * Encode packet helpers for binary types\n */\n\nfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var data = packet.data;\n var contentArray = new Uint8Array(data);\n var resultBuffer = new Uint8Array(1 + data.byteLength);\n\n resultBuffer[0] = packets[packet.type];\n for (var i = 0; i < contentArray.length; i++) {\n resultBuffer[i+1] = contentArray[i];\n }\n\n return callback(resultBuffer.buffer);\n}\n\nfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var fr = new FileReader();\n fr.onload = function() {\n exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n };\n return fr.readAsArrayBuffer(packet.data);\n}\n\nfunction encodeBlob(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n if (dontSendBlobs) {\n return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n }\n\n var length = new Uint8Array(1);\n length[0] = packets[packet.type];\n var blob = new Blob([length.buffer, packet.data]);\n\n return callback(blob);\n}\n\n/**\n * Encodes a packet with binary data in a base64 string\n *\n * @param {Object} packet, has `type` and `data`\n * @return {String} base64 encoded message\n */\n\nexports.encodeBase64Packet = function(packet, callback) {\n var message = 'b' + exports.packets[packet.type];\n if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n var fr = new FileReader();\n fr.onload = function() {\n var b64 = fr.result.split(',')[1];\n callback(message + b64);\n };\n return fr.readAsDataURL(packet.data);\n }\n\n var b64data;\n try {\n b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n } catch (e) {\n // iPhone Safari doesn't let you apply with typed arrays\n var typed = new Uint8Array(packet.data);\n var basic = new Array(typed.length);\n for (var i = 0; i < typed.length; i++) {\n basic[i] = typed[i];\n }\n b64data = String.fromCharCode.apply(null, basic);\n }\n message += btoa(b64data);\n return callback(message);\n};\n\n/**\n * Decodes a packet. Changes format to Blob if requested.\n *\n * @return {Object} with `type` and `data` (if any)\n * @api private\n */\n\nexports.decodePacket = function (data, binaryType, utf8decode) {\n if (data === undefined) {\n return err;\n }\n // String data\n if (typeof data === 'string') {\n if (data.charAt(0) === 'b') {\n return exports.decodeBase64Packet(data.substr(1), binaryType);\n }\n\n if (utf8decode) {\n data = tryDecode(data);\n if (data === false) {\n return err;\n }\n }\n var type = data.charAt(0);\n\n if (Number(type) != type || !packetslist[type]) {\n return err;\n }\n\n if (data.length > 1) {\n return { type: packetslist[type], data: data.substring(1) };\n } else {\n return { type: packetslist[type] };\n }\n }\n\n var asArray = new Uint8Array(data);\n var type = asArray[0];\n var rest = sliceBuffer(data, 1);\n if (Blob && binaryType === 'blob') {\n rest = new Blob([rest]);\n }\n return { type: packetslist[type], data: rest };\n};\n\nfunction tryDecode(data) {\n try {\n data = utf8.decode(data, { strict: false });\n } catch (e) {\n return false;\n }\n return data;\n}\n\n/**\n * Decodes a packet encoded in a base64 string\n *\n * @param {String} base64 encoded message\n * @return {Object} with `type` and `data` (if any)\n */\n\nexports.decodeBase64Packet = function(msg, binaryType) {\n var type = packetslist[msg.charAt(0)];\n if (!base64encoder) {\n return { type: type, data: { base64: true, data: msg.substr(1) } };\n }\n\n var data = base64encoder.decode(msg.substr(1));\n\n if (binaryType === 'blob' && Blob) {\n data = new Blob([data]);\n }\n\n return { type: type, data: data };\n};\n\n/**\n * Encodes multiple messages (payload).\n *\n * <length>:data\n *\n * Example:\n *\n * 11:hello world2:hi\n *\n * If any contents are binary, they will be encoded as base64 strings. Base64\n * encoded strings are marked with a b before the length specifier\n *\n * @param {Array} packets\n * @api private\n */\n\nexports.encodePayload = function (packets, supportsBinary, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = null;\n }\n\n var isBinary = hasBinary(packets);\n\n if (supportsBinary && isBinary) {\n if (Blob && !dontSendBlobs) {\n return exports.encodePayloadAsBlob(packets, callback);\n }\n\n return exports.encodePayloadAsArrayBuffer(packets, callback);\n }\n\n if (!packets.length) {\n return callback('0:');\n }\n\n function setLengthHeader(message) {\n return message.length + ':' + message;\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n doneCallback(null, setLengthHeader(message));\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(results.join(''));\n });\n};\n\n/**\n * Async array map using after\n */\n\nfunction map(ary, each, done) {\n var result = new Array(ary.length);\n var next = after(ary.length, done);\n\n var eachWithIndex = function(i, el, cb) {\n each(el, function(error, msg) {\n result[i] = msg;\n cb(error, result);\n });\n };\n\n for (var i = 0; i < ary.length; i++) {\n eachWithIndex(i, ary[i], next);\n }\n}\n\n/*\n * Decodes data when a payload is maybe expected. Possible binary contents are\n * decoded from their base64 representation\n *\n * @param {String} data, callback method\n * @api public\n */\n\nexports.decodePayload = function (data, binaryType, callback) {\n if (typeof data !== 'string') {\n return exports.decodePayloadAsBinary(data, binaryType, callback);\n }\n\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var packet;\n if (data === '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n var length = '', n, msg;\n\n for (var i = 0, l = data.length; i < l; i++) {\n var chr = data.charAt(i);\n\n if (chr !== ':') {\n length += chr;\n continue;\n }\n\n if (length === '' || (length != (n = Number(length)))) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n msg = data.substr(i + 1, n);\n\n if (length != msg.length) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n if (msg.length) {\n packet = exports.decodePacket(msg, binaryType, false);\n\n if (err.type === packet.type && err.data === packet.data) {\n // parser error in individual packet - ignoring payload\n return callback(err, 0, 1);\n }\n\n var ret = callback(packet, i + n, l);\n if (false === ret) return;\n }\n\n // advance cursor\n i += n;\n length = '';\n }\n\n if (length !== '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n};\n\n/**\n * Encodes multiple messages (payload) as binary.\n *\n * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n * 255><data>\n *\n * Example:\n * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n *\n * @param {Array} packets\n * @return {ArrayBuffer} encoded payload\n * @api private\n */\n\nexports.encodePayloadAsArrayBuffer = function(packets, callback) {\n if (!packets.length) {\n return callback(new ArrayBuffer(0));\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(data) {\n return doneCallback(null, data);\n });\n }\n\n map(packets, encodeOne, function(err, encodedPackets) {\n var totalLength = encodedPackets.reduce(function(acc, p) {\n var len;\n if (typeof p === 'string'){\n len = p.length;\n } else {\n len = p.byteLength;\n }\n return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n }, 0);\n\n var resultArray = new Uint8Array(totalLength);\n\n var bufferIndex = 0;\n encodedPackets.forEach(function(p) {\n var isString = typeof p === 'string';\n var ab = p;\n if (isString) {\n var view = new Uint8Array(p.length);\n for (var i = 0; i < p.length; i++) {\n view[i] = p.charCodeAt(i);\n }\n ab = view.buffer;\n }\n\n if (isString) { // not true binary\n resultArray[bufferIndex++] = 0;\n } else { // true binary\n resultArray[bufferIndex++] = 1;\n }\n\n var lenStr = ab.byteLength.toString();\n for (var i = 0; i < lenStr.length; i++) {\n resultArray[bufferIndex++] = parseInt(lenStr[i]);\n }\n resultArray[bufferIndex++] = 255;\n\n var view = new Uint8Array(ab);\n for (var i = 0; i < view.length; i++) {\n resultArray[bufferIndex++] = view[i];\n }\n });\n\n return callback(resultArray.buffer);\n });\n};\n\n/**\n * Encode as Blob\n */\n\nexports.encodePayloadAsBlob = function(packets, callback) {\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(encoded) {\n var binaryIdentifier = new Uint8Array(1);\n binaryIdentifier[0] = 1;\n if (typeof encoded === 'string') {\n var view = new Uint8Array(encoded.length);\n for (var i = 0; i < encoded.length; i++) {\n view[i] = encoded.charCodeAt(i);\n }\n encoded = view.buffer;\n binaryIdentifier[0] = 0;\n }\n\n var len = (encoded instanceof ArrayBuffer)\n ? encoded.byteLength\n : encoded.size;\n\n var lenStr = len.toString();\n var lengthAry = new Uint8Array(lenStr.length + 1);\n for (var i = 0; i < lenStr.length; i++) {\n lengthAry[i] = parseInt(lenStr[i]);\n }\n lengthAry[lenStr.length] = 255;\n\n if (Blob) {\n var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n doneCallback(null, blob);\n }\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(new Blob(results));\n });\n};\n\n/*\n * Decodes data when a payload is maybe expected. Strings are decoded by\n * interpreting each byte as a key code for entries marked to start with 0. See\n * description of encodePayloadAsBinary\n *\n * @param {ArrayBuffer} data, callback method\n * @api public\n */\n\nexports.decodePayloadAsBinary = function (data, binaryType, callback) {\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var bufferTail = data;\n var buffers = [];\n\n while (bufferTail.byteLength > 0) {\n var tailArray = new Uint8Array(bufferTail);\n var isString = tailArray[0] === 0;\n var msgLength = '';\n\n for (var i = 1; ; i++) {\n if (tailArray[i] === 255) break;\n\n // 310 = char length of Number.MAX_VALUE\n if (msgLength.length > 310) {\n return callback(err, 0, 1);\n }\n\n msgLength += tailArray[i];\n }\n\n bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n msgLength = parseInt(msgLength);\n\n var msg = sliceBuffer(bufferTail, 0, msgLength);\n if (isString) {\n try {\n msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n } catch (e) {\n // iPhone Safari doesn't let you apply to typed arrays\n var typed = new Uint8Array(msg);\n msg = '';\n for (var i = 0; i < typed.length; i++) {\n msg += String.fromCharCode(typed[i]);\n }\n }\n }\n\n buffers.push(msg);\n bufferTail = sliceBuffer(bufferTail, msgLength);\n }\n\n var total = buffers.length;\n buffers.forEach(function(buffer, i) {\n callback(exports.decodePacket(buffer, binaryType, true), i, total);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/browser.js\n// module id = 24\n// module chunks = 0","\n/**\n * Gets the keys for an object.\n *\n * @return {Array} keys\n * @api private\n */\n\nmodule.exports = Object.keys || function keys (obj){\n var arr = [];\n var has = Object.prototype.hasOwnProperty;\n\n for (var i in obj) {\n if (has.call(obj, i)) {\n arr.push(i);\n }\n }\n return arr;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/keys.js\n// module id = 25\n// module chunks = 0","/* global Blob File */\n\n/*\n * Module requirements.\n */\n\nvar isArray = require('isarray');\n\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' ||\n typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\nvar withNativeFile = typeof File === 'function' ||\n typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\n/**\n * Module exports.\n */\n\nmodule.exports = hasBinary;\n\n/**\n * Checks for binary data.\n *\n * Supports Buffer, ArrayBuffer, Blob and File.\n *\n * @param {Object} anything\n * @api public\n */\n\nfunction hasBinary (obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n if (isArray(obj)) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (hasBinary(obj[i])) {\n return true;\n }\n }\n return false;\n }\n\n if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n (withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)\n ) {\n return true;\n }\n\n // see: https://github.com/Automattic/has-binary/pull/4\n if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n return hasBinary(obj.toJSON(), true);\n }\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n return true;\n }\n }\n\n return false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-binary2/index.js\n// module id = 26\n// module chunks = 0","/**\n * An abstraction for slicing an arraybuffer even when\n * ArrayBuffer.prototype.slice is not supported\n *\n * @api public\n */\n\nmodule.exports = function(arraybuffer, start, end) {\n var bytes = arraybuffer.byteLength;\n start = start || 0;\n end = end || bytes;\n\n if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\n if (start < 0) { start += bytes; }\n if (end < 0) { end += bytes; }\n if (end > bytes) { end = bytes; }\n\n if (start >= bytes || start >= end || bytes === 0) {\n return new ArrayBuffer(0);\n }\n\n var abv = new Uint8Array(arraybuffer);\n var result = new Uint8Array(end - start);\n for (var i = start, ii = 0; i < end; i++, ii++) {\n result[ii] = abv[i];\n }\n return result.buffer;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/arraybuffer.slice/index.js\n// module id = 27\n// module chunks = 0","module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/after/index.js\n// module id = 28\n// module chunks = 0","/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\nvar stringFromCharCode = String.fromCharCode;\n\n// Taken from https://mths.be/punycode\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\tvar value;\n\tvar extra;\n\twhile (counter < length) {\n\t\tvalue = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// high surrogate, and there is a next character\n\t\t\textra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n// Taken from https://mths.be/punycode\nfunction ucs2encode(array) {\n\tvar length = array.length;\n\tvar index = -1;\n\tvar value;\n\tvar output = '';\n\twhile (++index < length) {\n\t\tvalue = array[index];\n\t\tif (value > 0xFFFF) {\n\t\t\tvalue -= 0x10000;\n\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t}\n\t\toutput += stringFromCharCode(value);\n\t}\n\treturn output;\n}\n\nfunction checkScalarValue(codePoint, strict) {\n\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\tif (strict) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n/*--------------------------------------------------------------------------*/\n\nfunction createByte(codePoint, shift) {\n\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n}\n\nfunction encodeCodePoint(codePoint, strict) {\n\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\treturn stringFromCharCode(codePoint);\n\t}\n\tvar symbol = '';\n\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t}\n\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\tcodePoint = 0xFFFD;\n\t\t}\n\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\tsymbol += createByte(codePoint, 12);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\treturn symbol;\n}\n\nfunction utf8encode(string, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tvar codePoints = ucs2decode(string);\n\tvar length = codePoints.length;\n\tvar index = -1;\n\tvar codePoint;\n\tvar byteString = '';\n\twhile (++index < length) {\n\t\tcodePoint = codePoints[index];\n\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t}\n\treturn byteString;\n}\n\n/*--------------------------------------------------------------------------*/\n\nfunction readContinuationByte() {\n\tif (byteIndex >= byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\tif ((continuationByte & 0xC0) == 0x80) {\n\t\treturn continuationByte & 0x3F;\n\t}\n\n\t// If we end up here, it’s not a continuation byte\n\tthrow Error('Invalid continuation byte');\n}\n\nfunction decodeSymbol(strict) {\n\tvar byte1;\n\tvar byte2;\n\tvar byte3;\n\tvar byte4;\n\tvar codePoint;\n\n\tif (byteIndex > byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tif (byteIndex == byteCount) {\n\t\treturn false;\n\t}\n\n\t// Read first byte\n\tbyte1 = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\t// 1-byte sequence (no continuation bytes)\n\tif ((byte1 & 0x80) == 0) {\n\t\treturn byte1;\n\t}\n\n\t// 2-byte sequence\n\tif ((byte1 & 0xE0) == 0xC0) {\n\t\tbyte2 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\tif (codePoint >= 0x80) {\n\t\t\treturn codePoint;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 3-byte sequence (may include unpaired surrogates)\n\tif ((byte1 & 0xF0) == 0xE0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\tif (codePoint >= 0x0800) {\n\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 4-byte sequence\n\tif ((byte1 & 0xF8) == 0xF0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tbyte4 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t(byte3 << 0x06) | byte4;\n\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\treturn codePoint;\n\t\t}\n\t}\n\n\tthrow Error('Invalid UTF-8 detected');\n}\n\nvar byteArray;\nvar byteCount;\nvar byteIndex;\nfunction utf8decode(byteString, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tbyteArray = ucs2decode(byteString);\n\tbyteCount = byteArray.length;\n\tbyteIndex = 0;\n\tvar codePoints = [];\n\tvar tmp;\n\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\tcodePoints.push(tmp);\n\t}\n\treturn ucs2encode(codePoints);\n}\n\nmodule.exports = {\n\tversion: '2.1.2',\n\tencode: utf8encode,\n\tdecode: utf8decode\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/utf8.js\n// module id = 29\n// module chunks = 0","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(){\n \"use strict\";\n\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n // Use a lookup table to find the index.\n var lookup = new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i+1)];\n encoded3 = lookup[base64.charCodeAt(i+2)];\n encoded4 = lookup[base64.charCodeAt(i+3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-arraybuffer/lib/base64-arraybuffer.js\n// module id = 30\n// module chunks = 0","/**\r\n * Create a blob builder even when vendor prefixes exist\r\n */\r\n\r\nvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n false;\r\n\r\n/**\r\n * Check if Blob constructor is supported\r\n */\r\n\r\nvar blobSupported = (function() {\r\n try {\r\n var a = new Blob(['hi']);\r\n return a.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if Blob constructor supports ArrayBufferViews\r\n * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n */\r\n\r\nvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n try {\r\n var b = new Blob([new Uint8Array([1,2])]);\r\n return b.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if BlobBuilder is supported\r\n */\r\n\r\nvar blobBuilderSupported = BlobBuilder\r\n && BlobBuilder.prototype.append\r\n && BlobBuilder.prototype.getBlob;\r\n\r\n/**\r\n * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n * Used by BlobBuilder constructor and old browsers that didn't\r\n * support it in the Blob constructor.\r\n */\r\n\r\nfunction mapArrayBufferViews(ary) {\r\n return ary.map(function(chunk) {\r\n if (chunk.buffer instanceof ArrayBuffer) {\r\n var buf = chunk.buffer;\r\n\r\n // if this is a subarray, make a copy so we only\r\n // include the subarray region from the underlying buffer\r\n if (chunk.byteLength !== buf.byteLength) {\r\n var copy = new Uint8Array(chunk.byteLength);\r\n copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n buf = copy.buffer;\r\n }\r\n\r\n return buf;\r\n }\r\n\r\n return chunk;\r\n });\r\n}\r\n\r\nfunction BlobBuilderConstructor(ary, options) {\r\n options = options || {};\r\n\r\n var bb = new BlobBuilder();\r\n mapArrayBufferViews(ary).forEach(function(part) {\r\n bb.append(part);\r\n });\r\n\r\n return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n};\r\n\r\nfunction BlobConstructor(ary, options) {\r\n return new Blob(mapArrayBufferViews(ary), options || {});\r\n};\r\n\r\nif (typeof Blob !== 'undefined') {\r\n BlobBuilderConstructor.prototype = Blob.prototype;\r\n BlobConstructor.prototype = Blob.prototype;\r\n}\r\n\r\nmodule.exports = (function() {\r\n if (blobSupported) {\r\n return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n } else if (blobBuilderSupported) {\r\n return BlobBuilderConstructor;\r\n } else {\r\n return undefined;\r\n }\r\n})();\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/blob/index.js\n// module id = 31\n// module chunks = 0","/**\r\n * Compiles a querystring\r\n * Returns string representation of the object\r\n *\r\n * @param {Object}\r\n * @api private\r\n */\r\n\r\nexports.encode = function (obj) {\r\n var str = '';\r\n\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n if (str.length) str += '&';\r\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\r\n }\r\n }\r\n\r\n return str;\r\n};\r\n\r\n/**\r\n * Parses a simple querystring into an object\r\n *\r\n * @param {String} qs\r\n * @api private\r\n */\r\n\r\nexports.decode = function(qs){\r\n var qry = {};\r\n var pairs = qs.split('&');\r\n for (var i = 0, l = pairs.length; i < l; i++) {\r\n var pair = pairs[i].split('=');\r\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\r\n }\r\n return qry;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseqs/index.js\n// module id = 32\n// module chunks = 0","\nmodule.exports = function(a, b){\n var fn = function(){};\n fn.prototype = b.prototype;\n a.prototype = new fn;\n a.prototype.constructor = a;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-inherit/index.js\n// module id = 33\n// module chunks = 0","'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/yeast/index.js\n// module id = 34\n// module chunks = 0","/**\n * Module requirements.\n */\n\nvar Polling = require('./polling');\nvar inherit = require('component-inherit');\n\n/**\n * Module exports.\n */\n\nmodule.exports = JSONPPolling;\n\n/**\n * Cached regular expressions.\n */\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n\n/**\n * Noop.\n */\n\nfunction empty () { }\n\n/**\n * Until https://github.com/tc39/proposal-global is shipped.\n */\nfunction glob () {\n return typeof self !== 'undefined' ? self\n : typeof window !== 'undefined' ? window\n : typeof global !== 'undefined' ? global : {};\n}\n\n/**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n\nfunction JSONPPolling (opts) {\n Polling.call(this, opts);\n\n this.query = this.query || {};\n\n // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n var global = glob();\n callbacks = global.___eio = (global.___eio || []);\n }\n\n // callback identifier\n this.index = callbacks.length;\n\n // add callback to jsonp global\n var self = this;\n callbacks.push(function (msg) {\n self.onData(msg);\n });\n\n // append to query string\n this.query.j = this.index;\n\n // prevent spurious errors from being emitted when the window is unloaded\n if (typeof addEventListener === 'function') {\n addEventListener('beforeunload', function () {\n if (self.script) self.script.onerror = empty;\n }, false);\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(JSONPPolling, Polling);\n\n/*\n * JSONP only supports binary as base64 encoded strings\n */\n\nJSONPPolling.prototype.supportsBinary = false;\n\n/**\n * Closes the socket.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doClose = function () {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n Polling.prototype.doClose.call(this);\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doPoll = function () {\n var self = this;\n var script = document.createElement('script');\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n script.onerror = function (e) {\n self.onError('jsonp poll error', e);\n };\n\n var insertAt = document.getElementsByTagName('script')[0];\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n this.script = script;\n\n var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function () {\n var iframe = document.createElement('iframe');\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n};\n\n/**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n\nJSONPPolling.prototype.doWrite = function (data, fn) {\n var self = this;\n\n if (!this.form) {\n var form = document.createElement('form');\n var area = document.createElement('textarea');\n var id = this.iframeId = 'eio_iframe_' + this.index;\n var iframe;\n\n form.className = 'socketio';\n form.style.position = 'absolute';\n form.style.top = '-1000px';\n form.style.left = '-1000px';\n form.target = id;\n form.method = 'POST';\n form.setAttribute('accept-charset', 'utf-8');\n area.name = 'd';\n form.appendChild(area);\n document.body.appendChild(form);\n\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete () {\n initIframe();\n fn();\n }\n\n function initIframe () {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError('jsonp polling iframe removal error', e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n iframe = document.createElement(html);\n } catch (e) {\n iframe = document.createElement('iframe');\n iframe.name = self.iframeId;\n iframe.src = 'javascript:0';\n }\n\n iframe.id = self.iframeId;\n\n self.form.appendChild(iframe);\n self.iframe = iframe;\n }\n\n initIframe();\n\n // escape \\n to prevent it from being converted into \\r\\n by some UAs\n // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n data = data.replace(rEscapedNewline, '\\\\\\n');\n this.area.value = data.replace(rNewline, '\\\\n');\n\n try {\n this.form.submit();\n } catch (e) {}\n\n if (this.iframe.attachEvent) {\n this.iframe.onreadystatechange = function () {\n if (self.iframe.readyState === 'complete') {\n complete();\n }\n };\n } else {\n this.iframe.onload = complete;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-jsonp.js\n// module id = 35\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parser = require('engine.io-parser');\nvar parseqs = require('parseqs');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:websocket');\n\nvar BrowserWebSocket, NodeWebSocket;\n\nif (typeof WebSocket !== 'undefined') {\n BrowserWebSocket = WebSocket;\n} else if (typeof self !== 'undefined') {\n BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n}\n\nif (typeof window === 'undefined') {\n try {\n NodeWebSocket = require('ws');\n } catch (e) { }\n}\n\n/**\n * Get either the `WebSocket` or `MozWebSocket` globals\n * in the browser or try to resolve WebSocket-compatible\n * interface exposed by `ws` for Node-like environment.\n */\n\nvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\n/**\n * Module exports.\n */\n\nmodule.exports = WS;\n\n/**\n * WebSocket transport constructor.\n *\n * @api {Object} connection options\n * @api public\n */\n\nfunction WS (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (forceBase64) {\n this.supportsBinary = false;\n }\n this.perMessageDeflate = opts.perMessageDeflate;\n this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n this.protocols = opts.protocols;\n if (!this.usingBrowserWebSocket) {\n WebSocketImpl = NodeWebSocket;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(WS, Transport);\n\n/**\n * Transport name.\n *\n * @api public\n */\n\nWS.prototype.name = 'websocket';\n\n/*\n * WebSockets support binary\n */\n\nWS.prototype.supportsBinary = true;\n\n/**\n * Opens socket.\n *\n * @api private\n */\n\nWS.prototype.doOpen = function () {\n if (!this.check()) {\n // let probe timeout\n return;\n }\n\n var uri = this.uri();\n var protocols = this.protocols;\n var opts = {\n agent: this.agent,\n perMessageDeflate: this.perMessageDeflate\n };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n if (this.extraHeaders) {\n opts.headers = this.extraHeaders;\n }\n if (this.localAddress) {\n opts.localAddress = this.localAddress;\n }\n\n try {\n this.ws =\n this.usingBrowserWebSocket && !this.isReactNative\n ? protocols\n ? new WebSocketImpl(uri, protocols)\n : new WebSocketImpl(uri)\n : new WebSocketImpl(uri, protocols, opts);\n } catch (err) {\n return this.emit('error', err);\n }\n\n if (this.ws.binaryType === undefined) {\n this.supportsBinary = false;\n }\n\n if (this.ws.supports && this.ws.supports.binary) {\n this.supportsBinary = true;\n this.ws.binaryType = 'nodebuffer';\n } else {\n this.ws.binaryType = 'arraybuffer';\n }\n\n this.addEventListeners();\n};\n\n/**\n * Adds event listeners to the socket\n *\n * @api private\n */\n\nWS.prototype.addEventListeners = function () {\n var self = this;\n\n this.ws.onopen = function () {\n self.onOpen();\n };\n this.ws.onclose = function () {\n self.onClose();\n };\n this.ws.onmessage = function (ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function (e) {\n self.onError('websocket error', e);\n };\n};\n\n/**\n * Writes data to socket.\n *\n * @param {Array} array of packets.\n * @api private\n */\n\nWS.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n\n // encodePacket efficient as it uses WS framing\n // no need for encodePayload\n var total = packets.length;\n for (var i = 0, l = total; i < l; i++) {\n (function (packet) {\n parser.encodePacket(packet, self.supportsBinary, function (data) {\n if (!self.usingBrowserWebSocket) {\n // always create a new object (GH-437)\n var opts = {};\n if (packet.options) {\n opts.compress = packet.options.compress;\n }\n\n if (self.perMessageDeflate) {\n var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n if (len < self.perMessageDeflate.threshold) {\n opts.compress = false;\n }\n }\n }\n\n // Sometimes the websocket has already been closed but the browser didn't\n // have a chance of informing us about it yet, in that case send will\n // throw an error\n try {\n if (self.usingBrowserWebSocket) {\n // TypeError is thrown when passing the second argument on Safari\n self.ws.send(data);\n } else {\n self.ws.send(data, opts);\n }\n } catch (e) {\n debug('websocket closed before onclose event');\n }\n\n --total || done();\n });\n })(packets[i]);\n }\n\n function done () {\n self.emit('flush');\n\n // fake drain\n // defer to next tick to allow Socket to clear writeBuffer\n setTimeout(function () {\n self.writable = true;\n self.emit('drain');\n }, 0);\n }\n};\n\n/**\n * Called upon close\n *\n * @api private\n */\n\nWS.prototype.onClose = function () {\n Transport.prototype.onClose.call(this);\n};\n\n/**\n * Closes socket.\n *\n * @api private\n */\n\nWS.prototype.doClose = function () {\n if (typeof this.ws !== 'undefined') {\n this.ws.close();\n }\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nWS.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'wss' : 'ws';\n var port = '';\n\n // avoid port if default for schema\n if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n ('ws' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // append timestamp to URI\n if (this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n/**\n * Feature detection for WebSocket.\n *\n * @return {Boolean} whether this transport is available.\n * @api public\n */\n\nWS.prototype.check = function () {\n return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/websocket.js\n// module id = 36\n// module chunks = 0","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// ws (ignored)\n// module id = 37\n// module chunks = 0","\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/indexof/index.js\n// module id = 38\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar parser = require('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar toArray = require('to-array');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:socket');\nvar parseqs = require('parseqs');\nvar hasBin = require('has-binary2');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = Socket;\n\n/**\n * Internal events (blacklisted).\n * These events can't be emitted by the user.\n *\n * @api private\n */\n\nvar events = {\n connect: 1,\n connect_error: 1,\n connect_timeout: 1,\n connecting: 1,\n disconnect: 1,\n error: 1,\n reconnect: 1,\n reconnect_attempt: 1,\n reconnect_failed: 1,\n reconnect_error: 1,\n reconnecting: 1,\n ping: 1,\n pong: 1\n};\n\n/**\n * Shortcut to `Emitter#emit`.\n */\n\nvar emit = Emitter.prototype.emit;\n\n/**\n * `Socket` constructor.\n *\n * @api public\n */\n\nfunction Socket (io, nsp, opts) {\n this.io = io;\n this.nsp = nsp;\n this.json = this; // compat\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.connected = false;\n this.disconnected = true;\n this.flags = {};\n if (opts && opts.query) {\n this.query = opts.query;\n }\n if (this.io.autoConnect) this.open();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Subscribe to open, close and packet events\n *\n * @api private\n */\n\nSocket.prototype.subEvents = function () {\n if (this.subs) return;\n\n var io = this.io;\n this.subs = [\n on(io, 'open', bind(this, 'onopen')),\n on(io, 'packet', bind(this, 'onpacket')),\n on(io, 'close', bind(this, 'onclose'))\n ];\n};\n\n/**\n * \"Opens\" the socket.\n *\n * @api public\n */\n\nSocket.prototype.open =\nSocket.prototype.connect = function () {\n if (this.connected) return this;\n\n this.subEvents();\n this.io.open(); // ensure open\n if ('open' === this.io.readyState) this.onopen();\n this.emit('connecting');\n return this;\n};\n\n/**\n * Sends a `message` event.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.send = function () {\n var args = toArray(arguments);\n args.unshift('message');\n this.emit.apply(this, args);\n return this;\n};\n\n/**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @param {String} event name\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.emit = function (ev) {\n if (events.hasOwnProperty(ev)) {\n emit.apply(this, arguments);\n return this;\n }\n\n var args = toArray(arguments);\n var packet = {\n type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n data: args\n };\n\n packet.options = {};\n packet.options.compress = !this.flags || false !== this.flags.compress;\n\n // event ack callback\n if ('function' === typeof args[args.length - 1]) {\n debug('emitting packet with ack id %d', this.ids);\n this.acks[this.ids] = args.pop();\n packet.id = this.ids++;\n }\n\n if (this.connected) {\n this.packet(packet);\n } else {\n this.sendBuffer.push(packet);\n }\n\n this.flags = {};\n\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.packet = function (packet) {\n packet.nsp = this.nsp;\n this.io.packet(packet);\n};\n\n/**\n * Called upon engine `open`.\n *\n * @api private\n */\n\nSocket.prototype.onopen = function () {\n debug('transport is open - connecting');\n\n // write connect packet if necessary\n if ('/' !== this.nsp) {\n if (this.query) {\n var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;\n debug('sending connect packet with query %s', query);\n this.packet({type: parser.CONNECT, query: query});\n } else {\n this.packet({type: parser.CONNECT});\n }\n }\n};\n\n/**\n * Called upon engine `close`.\n *\n * @param {String} reason\n * @api private\n */\n\nSocket.prototype.onclose = function (reason) {\n debug('close (%s)', reason);\n this.connected = false;\n this.disconnected = true;\n delete this.id;\n this.emit('disconnect', reason);\n};\n\n/**\n * Called with socket packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onpacket = function (packet) {\n var sameNamespace = packet.nsp === this.nsp;\n var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\n if (!sameNamespace && !rootNamespaceError) return;\n\n switch (packet.type) {\n case parser.CONNECT:\n this.onconnect();\n break;\n\n case parser.EVENT:\n this.onevent(packet);\n break;\n\n case parser.BINARY_EVENT:\n this.onevent(packet);\n break;\n\n case parser.ACK:\n this.onack(packet);\n break;\n\n case parser.BINARY_ACK:\n this.onack(packet);\n break;\n\n case parser.DISCONNECT:\n this.ondisconnect();\n break;\n\n case parser.ERROR:\n this.emit('error', packet.data);\n break;\n }\n};\n\n/**\n * Called upon a server event.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onevent = function (packet) {\n var args = packet.data || [];\n debug('emitting event %j', args);\n\n if (null != packet.id) {\n debug('attaching ack callback to event');\n args.push(this.ack(packet.id));\n }\n\n if (this.connected) {\n emit.apply(this, args);\n } else {\n this.receiveBuffer.push(args);\n }\n};\n\n/**\n * Produces an ack callback to emit with an event.\n *\n * @api private\n */\n\nSocket.prototype.ack = function (id) {\n var self = this;\n var sent = false;\n return function () {\n // prevent double callbacks\n if (sent) return;\n sent = true;\n var args = toArray(arguments);\n debug('sending ack %j', args);\n\n self.packet({\n type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n id: id,\n data: args\n });\n };\n};\n\n/**\n * Called upon a server acknowlegement.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onack = function (packet) {\n var ack = this.acks[packet.id];\n if ('function' === typeof ack) {\n debug('calling ack %s with %j', packet.id, packet.data);\n ack.apply(this, packet.data);\n delete this.acks[packet.id];\n } else {\n debug('bad ack %s', packet.id);\n }\n};\n\n/**\n * Called upon server connect.\n *\n * @api private\n */\n\nSocket.prototype.onconnect = function () {\n this.connected = true;\n this.disconnected = false;\n this.emit('connect');\n this.emitBuffered();\n};\n\n/**\n * Emit buffered events (received and emitted).\n *\n * @api private\n */\n\nSocket.prototype.emitBuffered = function () {\n var i;\n for (i = 0; i < this.receiveBuffer.length; i++) {\n emit.apply(this, this.receiveBuffer[i]);\n }\n this.receiveBuffer = [];\n\n for (i = 0; i < this.sendBuffer.length; i++) {\n this.packet(this.sendBuffer[i]);\n }\n this.sendBuffer = [];\n};\n\n/**\n * Called upon server disconnect.\n *\n * @api private\n */\n\nSocket.prototype.ondisconnect = function () {\n debug('server disconnect (%s)', this.nsp);\n this.destroy();\n this.onclose('io server disconnect');\n};\n\n/**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @api private.\n */\n\nSocket.prototype.destroy = function () {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n for (var i = 0; i < this.subs.length; i++) {\n this.subs[i].destroy();\n }\n this.subs = null;\n }\n\n this.io.destroy(this);\n};\n\n/**\n * Disconnects the socket manually.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.close =\nSocket.prototype.disconnect = function () {\n if (this.connected) {\n debug('performing disconnect (%s)', this.nsp);\n this.packet({ type: parser.DISCONNECT });\n }\n\n // remove socket from pool\n this.destroy();\n\n if (this.connected) {\n // fire events\n this.onclose('io client disconnect');\n }\n return this;\n};\n\n/**\n * Sets the compress flag.\n *\n * @param {Boolean} if `true`, compresses the sending data\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.compress = function (compress) {\n this.flags.compress = compress;\n return this;\n};\n\n/**\n * Sets the binary flag\n *\n * @param {Boolean} whether the emitted data contains binary\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.binary = function (binary) {\n this.flags.binary = binary;\n return this;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/socket.js\n// module id = 39\n// module chunks = 0","module.exports = toArray\n\nfunction toArray(list, index) {\n var array = []\n\n index = index || 0\n\n for (var i = index || 0; i < list.length; i++) {\n array[i - index] = list[i]\n }\n\n return array\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/to-array/index.js\n// module id = 40\n// module chunks = 0","\n/**\n * Module exports.\n */\n\nmodule.exports = on;\n\n/**\n * Helper for subscriptions.\n *\n * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n * @param {String} event name\n * @param {Function} callback\n * @api public\n */\n\nfunction on (obj, ev, fn) {\n obj.on(ev, fn);\n return {\n destroy: function () {\n obj.removeListener(ev, fn);\n }\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/on.js\n// module id = 41\n// module chunks = 0","/**\n * Slice reference.\n */\n\nvar slice = [].slice;\n\n/**\n * Bind `obj` to `fn`.\n *\n * @param {Object} obj\n * @param {Function|String} fn or string\n * @return {Function}\n * @api public\n */\n\nmodule.exports = function(obj, fn){\n if ('string' == typeof fn) fn = obj[fn];\n if ('function' != typeof fn) throw new Error('bind() requires a function');\n var args = slice.call(arguments, 2);\n return function(){\n return fn.apply(obj, args.concat(slice.call(arguments)));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-bind/index.js\n// module id = 42\n// module chunks = 0","\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/backo2/index.js\n// module id = 43\n// module chunks = 0"],"sourceRoot":""}+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.js b/node_modules/socket.io-client/dist/socket.io.js @@ -0,0 +1,9 @@ +/*! + * Socket.IO v2.3.0 + * (c) 2014-2019 Guillermo Rauch + * Released under the MIT License. + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){function r(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,r=o(t),i=r.source,u=r.id,p=r.path,h=c[u]&&p in c[u].nsps,f=e.forceNew||e["force new connection"]||!1===e.multiplex||h;return f?(a("ignoring socket cache for %s",i),n=s(i,e)):(c[u]||(a("new io instance for %s",i),c[u]=s(i,e)),n=c[u]),r.query&&!e.query&&(e.query=r.query),n.socket(r.path,e)}var o=n(1),i=n(7),s=n(15),a=n(3)("socket.io-client");t.exports=e=r;var c=e.managers={};e.protocol=i.protocol,e.connect=r,e.Manager=n(15),e.Socket=n(39)},function(t,e,n){function r(t,e){var n=t;e=e||"undefined"!=typeof location&&location,null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(i("protocol-less url %s",t),t="undefined"!=typeof e?e.protocol+"//"+t:"https://"+t),i("parse %s",t),n=o(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var r=n.host.indexOf(":")!==-1,s=r?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(e&&e.port===n.port?"":":"+n.port),n}var o=n(2),i=n(3)("socket.io-client:url");t.exports=r},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");o!=-1&&i!=-1&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=n.exec(t||""),a={},c=14;c--;)a[r[c]]=s[c]||"";return o!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e,n){(function(r){"use strict";function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)}}function s(){var t;return"object"===("undefined"==typeof console?"undefined":p(console))&&console.log&&(t=console).log.apply(t,arguments)}function a(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(n){}}function c(){var t=void 0;try{t=e.storage.getItem("debug")}catch(n){}return!t&&"undefined"!=typeof r&&"env"in r&&(t=r.env.DEBUG),t}function u(){try{return localStorage}catch(t){}}var p="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};e.log=s,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.storage=u(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=n(5)(e);var h=t.exports.formatters;h.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(e,n(4))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(p===setTimeout)return setTimeout(t,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function i(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){y&&l&&(y=!1,l.length?d=l.concat(d):m=-1,d.length&&a())}function a(){if(!y){var t=o(s);y=!0;for(var e=d.length;e;){for(l=d,d=[];++m<e;)l&&l[m].run();m=-1,e=d.length}l=null,y=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function u(){}var p,h,f=t.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:n}catch(t){p=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(t){h=r}}();var l,d=[],y=!1,m=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new c(t,e)),1!==d.length||y||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t){function e(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return o.colors[Math.abs(e)%o.colors.length]}function o(t){function n(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];if(n.enabled){var s=n,a=Number(new Date),c=a-(r||a);s.diff=c,s.prev=r,s.curr=a,r=a,e[0]=o.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");var u=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,function(t,n){if("%%"===t)return t;u++;var r=o.formatters[n];if("function"==typeof r){var i=e[u];t=r.call(s,i),e.splice(u,1),u--}return t}),o.formatArgs.call(s,e);var p=s.log||o.log;p.apply(s,e)}}var r=void 0;return n.namespace=t,n.enabled=o.enabled(t),n.useColors=o.useColors(),n.color=e(t),n.destroy=i,n.extend=s,"function"==typeof o.init&&o.init(n),o.instances.push(n),n}function i(){var t=o.instances.indexOf(this);return t!==-1&&(o.instances.splice(t,1),!0)}function s(t,e){var n=o(this.namespace+("undefined"==typeof e?":":e)+t);return n.log=this.log,n}function a(t){o.save(t),o.names=[],o.skips=[];var e=void 0,n=("string"==typeof t?t:"").split(/[\s,]+/),r=n.length;for(e=0;e<r;e++)n[e]&&(t=n[e].replace(/\*/g,".*?"),"-"===t[0]?o.skips.push(new RegExp("^"+t.substr(1)+"$")):o.names.push(new RegExp("^"+t+"$")));for(e=0;e<o.instances.length;e++){var i=o.instances[e];i.enabled=o.enabled(i.namespace)}}function c(){var t=[].concat(r(o.names.map(p)),r(o.skips.map(p).map(function(t){return"-"+t}))).join(",");return o.enable(""),t}function u(t){if("*"===t[t.length-1])return!0;var e=void 0,n=void 0;for(e=0,n=o.skips.length;e<n;e++)if(o.skips[e].test(t))return!1;for(e=0,n=o.names.length;e<n;e++)if(o.names[e].test(t))return!0;return!1}function p(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}function h(t){return t instanceof Error?t.stack||t.message:t}return o.debug=o,o["default"]=o,o.coerce=h,o.disable=c,o.enable=a,o.enabled=u,o.humanize=n(6),Object.keys(t).forEach(function(e){o[e]=t[e]}),o.instances=[],o.names=[],o.skips=[],o.formatters={},o.selectColor=e,o.enable(o.load()),o}t.exports=o},function(t,e){function n(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*h;case"weeks":case"week":case"w":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){var e=Math.abs(t);return e>=u?Math.round(t/u)+"d":e>=c?Math.round(t/c)+"h":e>=a?Math.round(t/a)+"m":e>=s?Math.round(t/s)+"s":t+"ms"}function o(t){var e=Math.abs(t);return e>=u?i(t,e,u,"day"):e>=c?i(t,e,c,"hour"):e>=a?i(t,e,a,"minute"):e>=s?i(t,e,s,"second"):t+" ms"}function i(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}var s=1e3,a=60*s,c=60*a,u=24*c,p=7*u,h=365.25*u;t.exports=function(t,e){e=e||{};var i=typeof t;if("string"===i&&t.length>0)return n(t);if("number"===i&&isFinite(t))return e["long"]?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){function r(){}function o(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var r=i(t.data);if(r===!1)return g;n+=r}return f("encoded %j as %s",t,n),n}function i(t){try{return JSON.stringify(t)}catch(e){return!1}}function s(t,e){function n(t){var n=d.deconstructPacket(t),r=o(n.packet),i=n.buffers;i.unshift(r),e(i)}d.removeBlobs(t,n)}function a(){this.reconstructor=null}function c(t){var n=0,r={type:Number(t.charAt(0))};if(null==e.types[r.type])return h("unknown packet type "+r.type);if(e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type){for(var o="";"-"!==t.charAt(++n)&&(o+=t.charAt(n),n!=t.length););if(o!=Number(o)||"-"!==t.charAt(n))throw new Error("Illegal attachments");r.attachments=Number(o)}if("/"===t.charAt(n+1))for(r.nsp="";++n;){var i=t.charAt(n);if(","===i)break;if(r.nsp+=i,n===t.length)break}else r.nsp="/";var s=t.charAt(n+1);if(""!==s&&Number(s)==s){for(r.id="";++n;){var i=t.charAt(n);if(null==i||Number(i)!=i){--n;break}if(r.id+=t.charAt(n),n===t.length)break}r.id=Number(r.id)}if(t.charAt(++n)){var a=u(t.substr(n)),c=a!==!1&&(r.type===e.ERROR||y(a));if(!c)return h("invalid payload");r.data=a}return f("decoded %s as %j",t,r),r}function u(t){try{return JSON.parse(t)}catch(e){return!1}}function p(t){this.reconPack=t,this.buffers=[]}function h(t){return{type:e.ERROR,data:"parser error: "+t}}var f=n(8)("socket.io-parser"),l=n(11),d=n(12),y=n(13),m=n(14);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=r,e.Decoder=a;var g=e.ERROR+'"encode error"';r.prototype.encode=function(t,n){if(f("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)s(t,n);else{var r=o(t);n([r])}},l(a.prototype),a.prototype.add=function(t){var n;if("string"==typeof t)n=c(t),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!m(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,this.emit("decoded",n))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=d.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){(function(r){"use strict";function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r)}}function s(){return"object"===("undefined"==typeof console?"undefined":p(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(n){}}function c(){var t;try{t=e.storage.debug}catch(n){}return!t&&"undefined"!=typeof r&&"env"in r&&(t=r.env.DEBUG),t}function u(){try{return window.localStorage}catch(t){}}var p="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};e=t.exports=n(9),e.log=s,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},e.enable(c())}).call(e,n(4))},function(t,e,n){"use strict";function r(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function o(t){function n(){if(n.enabled){var t=n,r=+new Date,i=r-(o||r);t.diff=i,t.prev=o,t.curr=r,o=r;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;c++;var o=e.formatters[r];if("function"==typeof o){var i=s[c];n=o.call(t,i),s.splice(c,1),c--}return n}),e.formatArgs.call(t,s);var u=n.log||e.log||console.log.bind(console);u.apply(t,s)}}var o;return n.namespace=t,n.enabled=e.enabled(t),n.useColors=e.useColors(),n.color=r(t),n.destroy=i,"function"==typeof e.init&&e.init(n),e.instances.push(n),n}function i(){var t=e.instances.indexOf(this);return t!==-1&&(e.instances.splice(t,1),!0)}function s(t){e.save(t),e.names=[],e.skips=[];var n,r=("string"==typeof t?t:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&(t=r[n].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(n=0;n<e.instances.length;n++){var i=e.instances[n];i.enabled=e.enabled(i.namespace)}}function a(){e.enable("")}function c(t){if("*"===t[t.length-1])return!0;var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1}function u(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o.debug=o["default"]=o,e.coerce=u,e.disable=a,e.enable=s,e.enabled=c,e.humanize=n(10),e.instances=[],e.names=[],e.skips=[],e.formatters={}},function(t,e){function n(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){return t>=u?Math.round(t/u)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=s?Math.round(t/s)+"s":t+"ms"}function o(t){return i(t,u,"day")||i(t,c,"hour")||i(t,a,"minute")||i(t,s,"second")||t+" ms"}function i(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var s=1e3,a=60*s,c=60*a,u=24*c,p=365.25*u;t.exports=function(t,e){e=e||{};var i=typeof t;if("string"===i&&t.length>0)return n(t);if("number"===i&&isNaN(t)===!1)return e["long"]?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){function r(t,e){if(!t)return t;if(s(t)){var n={_placeholder:!0,num:e.length};return e.push(t),n}if(i(t)){for(var o=new Array(t.length),a=0;a<t.length;a++)o[a]=r(t[a],e);return o}if("object"==typeof t&&!(t instanceof Date)){var o={};for(var c in t)o[c]=r(t[c],e);return o}return t}function o(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(i(t))for(var n=0;n<t.length;n++)t[n]=o(t[n],e);else if("object"==typeof t)for(var r in t)t[r]=o(t[r],e);return t}var i=n(13),s=n(14),a=Object.prototype.toString,c="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===a.call(Blob),u="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===a.call(File);e.deconstructPacket=function(t){var e=[],n=t.data,o=t;return o.data=r(n,e),o.attachments=e.length,{packet:o,buffers:e}},e.reconstructPacket=function(t,e){return t.data=o(t.data,e),t.attachments=void 0,t},e.removeBlobs=function(t,e){function n(t,a,p){if(!t)return t;if(c&&t instanceof Blob||u&&t instanceof File){r++;var h=new FileReader;h.onload=function(){p?p[a]=this.result:o=this.result,--r||e(o)},h.readAsArrayBuffer(t)}else if(i(t))for(var f=0;f<t.length;f++)n(t[f],f,t);else if("object"==typeof t&&!s(t))for(var l in t)n(t[l],l,t)}var r=0,o=t;n(o),r||e(o)}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){function n(t){return r&&Buffer.isBuffer(t)||o&&(t instanceof ArrayBuffer||i(t))}t.exports=n;var r="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,o="function"==typeof ArrayBuffer,i=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer}},function(t,e,n){function r(t,e){if(!(this instanceof r))return new r(t,e);t&&"object"==typeof t&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||a;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}var o=n(16),i=n(39),s=n(11),a=n(7),c=n(41),u=n(42),p=n(3)("socket.io-client:manager"),h=n(38),f=n(43),l=Object.prototype.hasOwnProperty;t.exports=r,r.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)l.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},r.prototype.updateSocketIds=function(){for(var t in this.nsps)l.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},r.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},s(r.prototype),r.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},r.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},r.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},r.prototype.open=r.prototype.connect=function(t,e){if(p("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;p("opening %s",this.uri),this.engine=o(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var i=c(n,"open",function(){r.onopen(),t&&t()}),s=c(n,"error",function(e){if(p("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else r.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout;p("connect attempt will timeout after %d",a);var u=setTimeout(function(){p("connect attempt timed out after %d",a),i.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(u)}})}return this.subs.push(i),this.subs.push(s),this},r.prototype.onopen=function(){p("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(c(t,"data",u(this,"ondata"))),this.subs.push(c(t,"ping",u(this,"onping"))),this.subs.push(c(t,"pong",u(this,"onpong"))),this.subs.push(c(t,"error",u(this,"onerror"))),this.subs.push(c(t,"close",u(this,"onclose"))),this.subs.push(c(this.decoder,"decoded",u(this,"ondecoded")))},r.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},r.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},r.prototype.ondata=function(t){this.decoder.add(t)},r.prototype.ondecoded=function(t){this.emit("packet",t)},r.prototype.onerror=function(t){p("error",t),this.emitAll("error",t)},r.prototype.socket=function(t,e){function n(){~h(o.connecting,r)||o.connecting.push(r)}var r=this.nsps[t];if(!r){r=new i(this,t,e),this.nsps[t]=r;var o=this;r.on("connecting",n),r.on("connect",function(){r.id=o.generateId(t)}),this.autoConnect&&n()}return r},r.prototype.destroy=function(t){var e=h(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},r.prototype.packet=function(t){p("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()}))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},r.prototype.cleanup=function(){p("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var n=this.subs.shift();n.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){p("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(t){p("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)p("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();p("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(p("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(p("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(p("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},r.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){t.exports=n(17),t.exports.parser=n(24)},function(t,e,n){function r(t,e){return this instanceof r?(e=e||{},t&&"object"==typeof t&&(e=t,t=null),t?(t=p(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=p(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=!1!==e.withCredentials,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,void this.open()):new r(t,e)}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var i=n(18),s=n(11),a=n(3)("engine.io-client:socket"),c=n(38),u=n(24),p=n(2),h=n(32);t.exports=r,r.priorWebsocketSuccess=!1,s(r.prototype),r.protocol=u.protocol,r.Socket=r,r.Transport=n(23),r.transports=n(18),r.parser=n(24),r.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=o(this.query);e.EIO=u.protocol,e.transport=t;var n=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var r=new i[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,withCredentials:n.withCredentials||this.withCredentials,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return r},r.prototype.open=function(){var t;if(this.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{ +if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},r.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},r.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;h=h||e}h||(a('probe transport "%s" opened',t),p.send([{type:"ping",data:"probe"}]),p.once("packet",function(e){if(!h)if("pong"===e.type&&"probe"===e.data){if(a('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",p),!p)return;r.priorWebsocketSuccess="websocket"===p.name,a('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){h||"closed"!==f.readyState&&(a("changing transport and sending upgrade packet"),u(),f.setTransport(p),p.send([{type:"upgrade"}]),f.emit("upgrade",p),p=null,f.upgrading=!1,f.flush())})}else{a('probe transport "%s" failed',t);var n=new Error("probe error");n.transport=p.name,f.emit("upgradeError",n)}}))}function n(){h||(h=!0,u(),p.close(),p=null)}function o(e){var r=new Error("probe error: "+e);r.transport=p.name,n(),a('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",r)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){p&&t.name!==p.name&&(a('"%s" works - aborting "%s"',t.name,p.name),n())}function u(){p.removeListener("open",e),p.removeListener("error",o),p.removeListener("close",i),f.removeListener("close",s),f.removeListener("upgrading",c)}a('probing transport "%s"',t);var p=this.createTransport(t,{probe:1}),h=!1,f=this;r.priorWebsocketSuccess=!1,p.once("open",e),p.once("error",o),p.once("close",i),this.once("close",s),this.once("upgrading",c),p.open()},r.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",r.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},r.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(a('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else a('packet received with socket readyState "%s"',this.readyState)},r.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},r.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},r.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){a("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},r.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},r.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},r.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(a("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},r.prototype.write=r.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},r.prototype.sendPacket=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||{},n.compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},r.prototype.close=function(){function t(){r.onClose("forced close"),a("socket closing - telling transport to close"),r.transport.close()}function e(){r.removeListener("upgrade",e),r.removeListener("upgradeError",e),t()}function n(){r.once("upgrade",e),r.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var r=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}return this},r.prototype.onError=function(t){a("socket error %j",t),r.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},r.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){a('socket close with reason: "%s"',t);var n=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),n.writeBuffer=[],n.prevBufferLen=0}},r.prototype.filterUpgrades=function(t){for(var e=[],n=0,r=t.length;n<r;n++)~c(this.transports,t[n])&&e.push(t[n]);return e}},function(t,e,n){function r(t){var e,n=!1,r=!1,a=!1!==t.jsonp;if("undefined"!=typeof location){var c="https:"===location.protocol,u=location.port;u||(u=c?443:80),n=t.hostname!==location.hostname||u!==t.port,r=t.secure!==c}if(t.xdomain=n,t.xscheme=r,e=new o(t),"open"in e&&!t.forceJSONP)return new i(t);if(!a)throw new Error("JSONP disabled");return new s(t)}var o=n(19),i=n(21),s=n(35),a=n(36);e.polling=r,e.websocket=a},function(t,e,n){var r=n(20);t.exports=function(t){var e=t.xdomain,n=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(i){}try{if("undefined"!=typeof XDomainRequest&&!n&&o)return new XDomainRequest}catch(i){}if(!e)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(i){}}},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){t.exports=!1}},function(t,e,n){function r(){}function o(t){if(c.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,"undefined"!=typeof location){var e="https:"===location.protocol,n=location.port;n||(n=e?443:80),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||n!==t.port,this.xs=t.secure!==e}}function i(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function s(){for(var t in i.requests)i.requests.hasOwnProperty(t)&&i.requests[t].abort()}var a=n(19),c=n(22),u=n(11),p=n(33),h=n(3)("engine.io-client:polling-xhr");if(t.exports=o,t.exports.Request=i,p(o,c),o.prototype.supportsBinary=!0,o.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new i(t)},o.prototype.doWrite=function(t,e){var n="string"!=typeof t&&void 0!==t,r=this.request({method:"POST",data:t,isBinary:n}),o=this;r.on("success",e),r.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=r},o.prototype.doPoll=function(){h("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},u(i.prototype),i.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new a(t),n=this;try{h("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var r in this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&e.setRequestHeader(r,this.extraHeaders[r])}}catch(o){}if("POST"===this.method)try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(o){}try{e.setRequestHeader("Accept","*/*")}catch(o){}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){n.onLoad()},e.onerror=function(){n.onError(e.responseText)}):e.onreadystatechange=function(){if(2===e.readyState)try{var t=e.getResponseHeader("Content-Type");(n.supportsBinary&&"application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&(e.responseType="arraybuffer")}catch(r){}4===e.readyState&&(200===e.status||1223===e.status?n.onLoad():setTimeout(function(){n.onError("number"==typeof e.status?e.status:0)},0))},h("xhr data %s",this.data),e.send(this.data)}catch(o){return void setTimeout(function(){n.onError(o)},0)}"undefined"!=typeof document&&(this.index=i.requestsCount++,i.requests[this.index]=this)},i.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},i.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},i.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},i.prototype.cleanup=function(t){if("undefined"!=typeof this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=r:this.xhr.onreadystatechange=r,t)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete i.requests[this.index],this.xhr=null}},i.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(n){}t="application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(n){this.onError(n)}null!=t&&this.onData(t)},i.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},i.prototype.abort=function(){this.cleanup()},i.requestsCount=0,i.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",s);else if("function"==typeof addEventListener){var f="onpagehide"in self?"pagehide":"unload";addEventListener(f,s,!1)}},function(t,e,n){function r(t){var e=t&&t.forceBase64;p&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=n(23),i=n(32),s=n(24),a=n(33),c=n(34),u=n(3)("engine.io-client:polling");t.exports=r;var p=function(){var t=n(19),e=new t({xdomain:!1});return null!=e.responseType}();a(r,o),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(t){function e(){u("paused"),n.readyState="paused",t()}var n=this;if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(u("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){u("pre-pause polling complete"),--r||e()})),this.writable||(u("we are currently writing - waiting to pause"),r++,this.once("drain",function(){u("pre-pause writing complete"),--r||e()}))}else e()},r.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(t){var e=this;u("polling got data %s",t);var n=function(t,n,r){return"opening"===e.readyState&&e.onOpen(),"close"===t.type?(e.onClose(),!1):void e.onPacket(t)};s.decodePayload(t,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},r.prototype.doClose=function(){function t(){u("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},r.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};s.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},r.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";!1!==this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t);var r=this.hostname.indexOf(":")!==-1;return e+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+t}},function(t,e,n){function r(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var o=n(24),i=n(11);t.exports=r,i(r.prototype),r.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},r.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},r.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},r.prototype.onPacket=function(t){this.emit("packet",t)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,n){function r(t,n){var r="b"+e.packets[t.type]+t.data.data;return n(r)}function o(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=v[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return r(s.buffer)}function i(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=new FileReader;return o.onload=function(){e.encodePacket({type:t.type,data:o.result},n,!0,r)},o.readAsArrayBuffer(t.data)}function s(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(g)return i(t,n,r);var o=new Uint8Array(1);o[0]=v[t.type];var s=new w([o.buffer,t.data]);return r(s)}function a(t){try{t=d.decode(t,{strict:!1})}catch(e){return!1}return t}function c(t,e,n){for(var r=new Array(t.length),o=l(t.length,n),i=function(t,n,o){e(n,function(e,n){r[t]=n,o(e,r)})},s=0;s<t.length;s++)i(s,t[s],o)}var u,p=n(25),h=n(26),f=n(27),l=n(28),d=n(29);"undefined"!=typeof ArrayBuffer&&(u=n(30));var y="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),m="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),g=y||m;e.protocol=3;var v=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},b=p(v),C={type:"error",data:"parser error"},w=n(31);e.encodePacket=function(t,e,n,i){"function"==typeof e&&(i=e,e=!1),"function"==typeof n&&(i=n,n=null);var a=void 0===t.data?void 0:t.data.buffer||t.data;if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer)return o(t,e,i);if("undefined"!=typeof w&&a instanceof w)return s(t,e,i);if(a&&a.base64)return r(t,i);var c=v[t.type];return void 0!==t.data&&(c+=n?d.encode(String(t.data),{strict:!1}):String(t.data)),i(""+c)},e.encodeBase64Packet=function(t,n){var r="b"+e.packets[t.type];if("undefined"!=typeof w&&t.data instanceof w){var o=new FileReader;return o.onload=function(){var t=o.result.split(",")[1];n(r+t)},o.readAsDataURL(t.data)}var i;try{i=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(s){for(var a=new Uint8Array(t.data),c=new Array(a.length),u=0;u<a.length;u++)c[u]=a[u];i=String.fromCharCode.apply(null,c)}return r+=btoa(i),n(r)},e.decodePacket=function(t,n,r){if(void 0===t)return C;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r&&(t=a(t),t===!1))return C;var o=t.charAt(0);return Number(o)==o&&b[o]?t.length>1?{type:b[o],data:t.substring(1)}:{type:b[o]}:C}var i=new Uint8Array(t),o=i[0],s=f(t,1);return w&&"blob"===n&&(s=new w([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var n=b[t.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:t.substr(1)}};var r=u.decode(t.substr(1));return"blob"===e&&w&&(r=new w([r])),{type:n,data:r}},e.encodePayload=function(t,n,r){function o(t){return t.length+":"+t}function i(t,r){e.encodePacket(t,!!s&&n,!1,function(t){r(null,o(t))})}"function"==typeof n&&(r=n,n=null);var s=h(t);return n&&s?w&&!g?e.encodePayloadAsBlob(t,r):e.encodePayloadAsArrayBuffer(t,r):t.length?void c(t,i,function(t,e){return r(e.join(""))}):r("0:")},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);"function"==typeof n&&(r=n,n=null);var o;if(""===t)return r(C,0,1);for(var i,s,a="",c=0,u=t.length;c<u;c++){var p=t.charAt(c);if(":"===p){if(""===a||a!=(i=Number(a)))return r(C,0,1);if(s=t.substr(c+1,i),a!=s.length)return r(C,0,1);if(s.length){if(o=e.decodePacket(s,n,!1),C.type===o.type&&C.data===o.data)return r(C,0,1);var h=r(o,c+i,u);if(!1===h)return}c+=i,a=""}else a+=p}return""!==a?r(C,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){function r(t,n){e.encodePacket(t,!0,!0,function(t){return n(null,t)})}return t.length?void c(t,r,function(t,e){var r=e.reduce(function(t,e){var n;return n="string"==typeof e?e.length:e.byteLength,t+n.toString().length+n+2},0),o=new Uint8Array(r),i=0;return e.forEach(function(t){var e="string"==typeof t,n=t;if(e){for(var r=new Uint8Array(t.length),s=0;s<t.length;s++)r[s]=t.charCodeAt(s);n=r.buffer}e?o[i++]=0:o[i++]=1;for(var a=n.byteLength.toString(),s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(var r=new Uint8Array(n),s=0;s<r.length;s++)o[i++]=r[s]}),n(o.buffer)}):n(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,n){function r(t,n){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var r=new Uint8Array(t.length),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);t=r.buffer,e[0]=0}for(var i=t instanceof ArrayBuffer?t.byteLength:t.size,s=i.toString(),a=new Uint8Array(s.length+1),o=0;o<s.length;o++)a[o]=parseInt(s[o]);if(a[s.length]=255,w){var c=new w([e.buffer,a.buffer,t]);n(null,c)}})}c(t,r,function(t,e){return n(new w(e))})},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var o=t,i=[];o.byteLength>0;){for(var s=new Uint8Array(o),a=0===s[0],c="",u=1;255!==s[u];u++){if(c.length>310)return r(C,0,1);c+=s[u]}o=f(o,2+c.length),c=parseInt(c);var p=f(o,0,c);if(a)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(h){var l=new Uint8Array(p);p="";for(var u=0;u<l.length;u++)p+=String.fromCharCode(l[u])}i.push(p),o=f(o,c)}var d=i.length;i.forEach(function(t,o){r(e.decodePacket(t,n,!0),o,d)})}},function(t,e){t.exports=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e}},function(t,e,n){function r(t){if(!t||"object"!=typeof t)return!1;if(o(t)){for(var e=0,n=t.length;e<n;e++)if(r(t[e]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||s&&t instanceof Blob||a&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return r(t.toJSON(),!0);for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&r(t[i]))return!0;return!1}var o=n(13),i=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);t.exports=r},function(t,e){t.exports=function(t,e,n){var r=t.byteLength;if(e=e||0,n=n||r,t.slice)return t.slice(e,n);if(e<0&&(e+=r),n<0&&(n+=r),n>r&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s<n;s++,a++)i[a]=o[s];return i.buffer}},function(t,e){function n(t,e,n){function o(t,r){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(i=!0,e(t),e=n):0!==o.count||i||e(null,r)}var i=!1;return n=n||r,o.count=t,0===t?e():o}function r(){}t.exports=n},function(t,e){function n(t){for(var e,n,r=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function r(t){for(var e,n=t.length,r=-1,o="";++r<n;)e=t[r],e>65535&&(e-=65536,o+=d(e>>>10&1023|55296),e=56320|1023&e),o+=d(e);return o}function o(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function i(t,e){return d(t>>e&63|128)}function s(t,e){if(0==(4294967168&t))return d(t);var n="";return 0==(4294965248&t)?n=d(t>>6&31|192):0==(4294901760&t)?(o(t,e)||(t=65533),n=d(t>>12&15|224),n+=i(t,6)):0==(4292870144&t)&&(n=d(t>>18&7|240),n+=i(t,12),n+=i(t,6)),n+=d(63&t|128)}function a(t,e){e=e||{};for(var r,o=!1!==e.strict,i=n(t),a=i.length,c=-1,u="";++c<a;)r=i[c],u+=s(r,o);return u}function c(){if(l>=f)throw Error("Invalid byte index");var t=255&h[l];if(l++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function u(t){var e,n,r,i,s;if(l>f)throw Error("Invalid byte index");if(l==f)return!1;if(e=255&h[l],l++,0==(128&e))return e;if(192==(224&e)){if(n=c(),s=(31&e)<<6|n,s>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&e)){if(n=c(),r=c(),s=(15&e)<<12|n<<6|r,s>=2048)return o(s,t)?s:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=c(),r=c(),i=c(),s=(7&e)<<18|n<<12|r<<6|i,s>=65536&&s<=1114111))return s;throw Error("Invalid UTF-8 detected")}function p(t,e){e=e||{};var o=!1!==e.strict;h=n(t),f=h.length,l=0;for(var i,s=[];(i=u(o))!==!1;)s.push(i);return r(s)}/*! https://mths.be/utf8js v2.1.2 by @mathias */ +var h,f,l,d=String.fromCharCode;t.exports={version:"2.1.2",encode:a,decode:p}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;e.encode=function(e){var n,r=new Uint8Array(e),o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,r,o,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e<c;e+=4)r=n[t.charCodeAt(e)],o=n[t.charCodeAt(e+1)],i=n[t.charCodeAt(e+2)],s=n[t.charCodeAt(e+3)],h[u++]=r<<2|o>>4,h[u++]=(15&o)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}}()},function(t,e){function n(t){return t.map(function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=n.buffer}return e}return t})}function r(t,e){e=e||{};var r=new i;return n(t).forEach(function(t){r.append(t)}),e.type?r.getBlob(e.type):r.getBlob()}function o(t,e){return new Blob(n(t),e||{})}var i="undefined"!=typeof i?i:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,s=function(){try{var t=new Blob(["hi"]);return 2===t.size}catch(e){return!1}}(),a=s&&function(){try{var t=new Blob([new Uint8Array([1,2])]);return 2===t.size}catch(e){return!1}}(),c=i&&i.prototype.append&&i.prototype.getBlob;"undefined"!=typeof Blob&&(r.prototype=Blob.prototype,o.prototype=Blob.prototype),t.exports=function(){return s?a?Blob:o:c?r:void 0}()},function(t,e){e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e){t.exports=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e){"use strict";function n(t){var e="";do e=s[t%a]+e,t=Math.floor(t/a);while(t>0);return e}function r(t){var e=0;for(p=0;p<t.length;p++)e=e*a+c[t.charAt(p)];return e}function o(){var t=n(+new Date);return t!==i?(u=0,i=t):t+"."+n(u++)}for(var i,s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},u=0,p=0;p<a;p++)c[s[p]]=p;o.encode=n,o.decode=r,t.exports=o},function(t,e,n){(function(e){function r(){}function o(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof e?e:{}}function i(t){if(s.call(this,t),this.query=this.query||{},!c){var e=o();c=e.___eio=e.___eio||[]}this.index=c.length;var n=this;c.push(function(t){n.onData(t)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){n.script&&(n.script.onerror=r)},!1)}var s=n(22),a=n(33);t.exports=i;var c,u=/\n/g,p=/\\n/g;a(i,s),i.prototype.supportsBinary=!1,i.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),s.prototype.doClose.call(this)},i.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e;var r="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},i.prototype.doWrite=function(t,e){function n(){r(),e()}function r(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var e='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(e)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=c,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),r(),t=t.replace(p,"\\\n"),this.area.value=t.replace(u,"\\n");try{this.form.submit()}catch(h){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&n()}:this.iframe.onload=n}}).call(e,function(){return this}())},function(t,e,n){function r(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=o&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(l=i),s.call(this,t)}var o,i,s=n(23),a=n(24),c=n(32),u=n(33),p=n(34),h=n(3)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?o=WebSocket:"undefined"!=typeof self&&(o=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{i=n(37)}catch(f){}var l=o||i;t.exports=r,u(r,s),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new l(t,e):new l(t):new l(t,e,n)}catch(r){return this.emit("error",r)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},r.prototype.write=function(t){function e(){n.emit("flush"),setTimeout(function(){n.writable=!0,n.emit("drain")},0)}var n=this;this.writable=!1;for(var r=t.length,o=0,i=r;o<i;o++)!function(t){a.encodePacket(t,n.supportsBinary,function(o){if(!n.usingBrowserWebSocket){var i={};if(t.options&&(i.compress=t.options.compress),n.perMessageDeflate){var s="string"==typeof o?Buffer.byteLength(o):o.length;s<n.perMessageDeflate.threshold&&(i.compress=!1)}}try{n.usingBrowserWebSocket?n.ws.send(o):n.ws.send(o,i)}catch(a){h("websocket closed before onclose event")}--r||e()})}(t[o])},r.prototype.onClose=function(){s.prototype.onClose.call(this)},r.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},r.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=p()),this.supportsBinary||(t.b64=1),t=c.encode(t),t.length&&(t="?"+t);var r=this.hostname.indexOf(":")!==-1;return e+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+t},r.prototype.check=function(){return!(!l||"__initialize"in l&&this.name===r.prototype.name)}},function(t,e){},function(t,e){var n=[].indexOf;t.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}},function(t,e,n){function r(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}var o=n(7),i=n(11),s=n(40),a=n(41),c=n(42),u=n(3)("socket.io-client:socket"),p=n(32),h=n(26);t.exports=e=r;var f={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},l=i.prototype.emit;i(r.prototype),r.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[a(t,"open",c(this,"onopen")),a(t,"packet",c(this,"onpacket")),a(t,"close",c(this,"onclose"))]}},r.prototype.open=r.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},r.prototype.send=function(){var t=s(arguments);return t.unshift("message"),this.emit.apply(this,t),this},r.prototype.emit=function(t){if(f.hasOwnProperty(t))return l.apply(this,arguments),this;var e=s(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:h(e))?o.BINARY_EVENT:o.EVENT,data:e};return n.options={},n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(u("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},r.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},r.prototype.onopen=function(){if(u("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"==typeof this.query?p.encode(this.query):this.query;u("sending connect packet with query %s",t),this.packet({type:o.CONNECT,query:t})}else this.packet({type:o.CONNECT})},r.prototype.onclose=function(t){u("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},r.prototype.onpacket=function(t){var e=t.nsp===this.nsp,n=t.type===o.ERROR&&"/"===t.nsp;if(e||n)switch(t.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(t);break;case o.BINARY_EVENT:this.onevent(t);break;case o.ACK:this.onack(t);break;case o.BINARY_ACK:this.onack(t);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",t.data)}},r.prototype.onevent=function(t){var e=t.data||[];u("emitting event %j",e),null!=t.id&&(u("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?l.apply(this,e):this.receiveBuffer.push(e)},r.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=s(arguments);u("sending ack %j",r),e.packet({type:h(r)?o.BINARY_ACK:o.ACK,id:t,data:r})}}},r.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(u("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):u("bad ack %s",t.id)},r.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},r.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)l.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},r.prototype.ondisconnect=function(){u("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},r.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},r.prototype.close=r.prototype.disconnect=function(){return this.connected&&(u("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},r.prototype.compress=function(t){return this.flags.compress=t,this},r.prototype.binary=function(t){return this.flags.binary=t,this}},function(t,e){function n(t,e){var n=[];e=e||0;for(var r=e||0;r<t.length;r++)n[r-e]=t[r];return n}t.exports=n},function(t,e){function n(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}t.exports=n},function(t,e){var n=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},function(t,e){function n(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.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)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}])}); +//# sourceMappingURL=socket.io.js.map+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.js.map b/node_modules/socket.io-client/dist/socket.io.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///socket.io.js","webpack:///webpack/bootstrap 9e45fccfabd75c66dd47","webpack:///./lib/index.js","webpack:///./lib/url.js","webpack:///./~/parseuri/index.js","webpack:///./~/debug/src/browser.js","webpack:///./~/process/browser.js","webpack:///./~/debug/src/common.js","webpack:///./~/ms/index.js","webpack:///./~/socket.io-parser/index.js","webpack:///./~/socket.io-parser/~/debug/src/browser.js","webpack:///./~/socket.io-parser/~/debug/src/debug.js","webpack:///./~/socket.io-parser/~/ms/index.js","webpack:///./~/component-emitter/index.js","webpack:///./~/socket.io-parser/binary.js","webpack:///./~/isarray/index.js","webpack:///./~/socket.io-parser/is-buffer.js","webpack:///./lib/manager.js","webpack:///./~/engine.io-client/lib/index.js","webpack:///./~/engine.io-client/lib/socket.js","webpack:///./~/engine.io-client/lib/transports/index.js","webpack:///./~/engine.io-client/lib/xmlhttprequest.js","webpack:///./~/has-cors/index.js","webpack:///./~/engine.io-client/lib/transports/polling-xhr.js","webpack:///./~/engine.io-client/lib/transports/polling.js","webpack:///./~/engine.io-client/lib/transport.js","webpack:///./~/engine.io-parser/lib/browser.js","webpack:///./~/engine.io-parser/lib/keys.js","webpack:///./~/has-binary2/index.js","webpack:///./~/arraybuffer.slice/index.js","webpack:///./~/after/index.js","webpack:///./~/engine.io-parser/lib/utf8.js","webpack:///./~/base64-arraybuffer/lib/base64-arraybuffer.js","webpack:///./~/blob/index.js","webpack:///./~/parseqs/index.js","webpack:///./~/component-inherit/index.js","webpack:///./~/yeast/index.js","webpack:///./~/engine.io-client/lib/transports/polling-jsonp.js","webpack:///./~/engine.io-client/lib/transports/websocket.js","webpack:///./~/indexof/index.js","webpack:///./lib/socket.js","webpack:///./~/to-array/index.js","webpack:///./lib/on.js","webpack:///./~/component-bind/index.js","webpack:///./~/backo2/index.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","lookup","uri","opts","undefined","io","parsed","url","source","path","sameNamespace","cache","nsps","newConnection","forceNew","multiplex","debug","Manager","query","socket","parser","managers","protocol","connect","Socket","loc","obj","location","host","charAt","test","parseuri","port","ipv6","indexOf","href","re","parts","str","src","b","e","substring","replace","length","exec","i","authority","ipv6uri","process","useColors","window","type","__nwjs","navigator","userAgent","toLowerCase","match","document","documentElement","style","WebkitAppearance","console","firebug","exception","table","parseInt","RegExp","$1","formatArgs","args","namespace","humanize","diff","color","splice","index","lastC","log","_console","_typeof","apply","arguments","save","namespaces","storage","setItem","removeItem","error","load","r","getItem","env","DEBUG","localstorage","localStorage","Symbol","iterator","constructor","prototype","colors","formatters","j","v","JSON","stringify","message","defaultSetTimout","Error","defaultClearTimeout","runTimeout","fun","cachedSetTimeout","setTimeout","runClearTimeout","marker","cachedClearTimeout","clearTimeout","cleanUpNextTick","draining","currentQueue","queue","concat","queueIndex","drainQueue","timeout","len","run","Item","array","noop","nextTick","Array","push","title","browser","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","name","binding","cwd","chdir","dir","umask","_toConsumableArray","arr","isArray","arr2","from","setup","selectColor","hash","charCodeAt","createDebug","Math","abs","_len","_key","enabled","self","curr","Number","Date","ms","prevTime","prev","coerce","unshift","format","formatter","val","logFn","destroy","extend","init","instances","delimiter","newDebug","enable","names","skips","split","substr","instance","disable","map","toNamespace","join","regexp","toString","stack","Object","keys","forEach","key","parse","String","n","parseFloat","y","w","d","h","s","fmtShort","msAbs","round","fmtLong","plural","isPlural","options","isFinite","Encoder","encodeAsString","BINARY_EVENT","BINARY_ACK","attachments","nsp","data","payload","tryStringify","ERROR_PACKET","encodeAsBinary","callback","writeEncoding","bloblessData","deconstruction","binary","deconstructPacket","pack","packet","buffers","removeBlobs","Decoder","reconstructor","decodeString","types","buf","next","tryParse","isPayloadValid","ERROR","BinaryReconstructor","reconPack","msg","Emitter","isBuf","CONNECT","DISCONNECT","EVENT","ACK","encode","encoding","add","base64","takeBinaryData","finishedReconstruction","binData","reconstructPacket","Function","chrome","local","err","bind","floor","ceil","isNaN","mixin","addEventListener","event","fn","_callbacks","removeEventListener","callbacks","cb","slice","hasListeners","_deconstructPacket","placeholder","_placeholder","num","newData","_reconstructPacket","withNativeBlob","Blob","withNativeFile","File","packetData","_removeBlobs","curKey","containingObject","pendingBlobs","fileReader","FileReader","onload","result","readAsArrayBuffer","withNativeBuffer","Buffer","isBuffer","withNativeArrayBuffer","ArrayBuffer","isView","buffer","subs","reconnection","reconnectionAttempts","Infinity","reconnectionDelay","reconnectionDelayMax","randomizationFactor","backoff","Backoff","min","max","jitter","readyState","connecting","lastPing","packetBuffer","_parser","encoder","decoder","autoConnect","open","eio","has","hasOwnProperty","emitAll","updateSocketIds","generateId","engine","_reconnection","_reconnectionAttempts","_reconnectionDelay","setMin","_randomizationFactor","setJitter","_reconnectionDelayMax","setMax","_timeout","maybeReconnectOnOpen","reconnecting","attempts","reconnect","skipReconnect","openSub","onopen","errorSub","cleanup","timer","close","onping","onpong","ondata","ondecoded","onerror","onConnecting","encodedPackets","write","processPacketQueue","shift","subsLength","sub","disconnect","reset","onclose","reason","delay","duration","onreconnect","attempt","hostname","secure","agent","parseqs","decode","upgrade","forceJSONP","jsonp","forceBase64","enablesXDR","withCredentials","timestampParam","timestampRequests","transports","transportOptions","writeBuffer","prevBufferLen","policyPort","rememberUpgrade","binaryType","onlyBinaryUpgrades","perMessageDeflate","threshold","pfx","passphrase","cert","ca","ciphers","rejectUnauthorized","forceNode","isReactNative","product","extraHeaders","localAddress","upgrades","pingInterval","pingTimeout","pingIntervalTimer","pingTimeoutTimer","clone","o","priorWebsocketSuccess","Transport","createTransport","EIO","transport","sid","requestTimeout","protocols","setTransport","onDrain","onPacket","onError","onClose","probe","onTransportOpen","upgradeLosesBinary","supportsBinary","failed","send","upgrading","pause","flush","freezeTransport","onTransportClose","onupgrade","to","onOpen","l","onHandshake","setPing","code","filterUpgrades","onHeartbeat","ping","sendPacket","writable","compress","cleanupAndClose","waitForUpgrade","desc","filteredUpgrades","polling","xhr","xd","xs","isSSL","xdomain","xscheme","XMLHttpRequest","XHR","JSONP","websocket","hasCORS","XDomainRequest","empty","Polling","Request","method","async","isBinary","create","unloadHandler","requests","abort","inherit","request","doWrite","req","sendXhr","doPoll","onData","pollXhr","setDisableHeaderCheck","setRequestHeader","hasXDR","onLoad","responseText","onreadystatechange","contentType","getResponseHeader","responseType","status","requestsCount","onSuccess","fromError","response","attachEvent","terminationEvent","hasXHR2","yeast","doOpen","poll","onPause","total","decodePayload","doClose","packets","callbackfn","encodePayload","schema","b64","description","decodePacket","encodeBase64Object","encodeArrayBuffer","encodeBase64Packet","contentArray","Uint8Array","resultBuffer","byteLength","encodeBlobAsArrayBuffer","fr","encodePacket","encodeBlob","dontSendBlobs","blob","tryDecode","utf8","strict","ary","each","done","after","eachWithIndex","el","base64encoder","hasBinary","sliceBuffer","isAndroid","isPhantomJS","pong","packetslist","utf8encode","encoded","readAsDataURL","b64data","fromCharCode","typed","basic","btoa","utf8decode","decodeBase64Packet","asArray","rest","setLengthHeader","encodeOne","doneCallback","encodePayloadAsBlob","encodePayloadAsArrayBuffer","results","decodePayloadAsBinary","chr","ret","totalLength","reduce","acc","resultArray","bufferIndex","isString","ab","view","lenStr","binaryIdentifier","size","lengthAry","bufferTail","tailArray","msgLength","toJSON","arraybuffer","start","end","bytes","abv","ii","count","err_cb","proxy","bail","ucs2decode","string","value","extra","output","counter","ucs2encode","stringFromCharCode","checkScalarValue","codePoint","toUpperCase","createByte","encodeCodePoint","symbol","codePoints","byteString","readContinuationByte","byteIndex","byteCount","continuationByte","byteArray","decodeSymbol","byte1","byte2","byte3","byte4","tmp","chars","encoded1","encoded2","encoded3","encoded4","bufferLength","mapArrayBufferViews","chunk","copy","set","byteOffset","BlobBuilderConstructor","bb","BlobBuilder","part","append","getBlob","BlobConstructor","WebKitBlobBuilder","MSBlobBuilder","MozBlobBuilder","blobSupported","a","blobSupportsArrayBufferView","blobBuilderSupported","encodeURIComponent","qs","qry","pairs","pair","decodeURIComponent","alphabet","decoded","now","seed","global","glob","JSONPPolling","___eio","script","rNewline","rEscapedNewline","parentNode","removeChild","form","iframe","createElement","insertAt","getElementsByTagName","insertBefore","head","body","appendChild","isUAgecko","complete","initIframe","html","iframeId","area","className","position","top","left","target","setAttribute","action","submit","WS","usingBrowserWebSocket","BrowserWebSocket","WebSocketImpl","NodeWebSocket","WebSocket","MozWebSocket","check","headers","ws","supports","addEventListeners","onmessage","ev","json","ids","acks","receiveBuffer","sendBuffer","connected","disconnected","flags","toArray","hasBin","events","connect_error","connect_timeout","reconnect_attempt","reconnect_failed","reconnect_error","subEvents","pop","onpacket","rootNamespaceError","onconnect","onevent","onack","ondisconnect","ack","sent","emitBuffered","list","factor","pow","rand","random","deviation"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,GAAAD,IAEAD,EAAA,GAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAAUL,EAAQD,EAASM,GEnBjC,QAAAS,GAAAC,EAAAC,GACA,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OAAA,EACAhV,KAAA4W,SAAA,EApBA/W,EAAAD,QAAAiV,EA8BAA,EAAAhO,UAAAyR,SAAA,WACA,GAAA9M,GAAAxL,KAAAwL,GAAAT,KAAA+jB,IAAA9uB,KAAA6uB,OAAA7uB,KAAA4W,WACA,IAAA5W,KAAAgV,OAAA,CACA,GAAA+Z,GAAAhkB,KAAAikB,SACAC,EAAAlkB,KAAA8G,MAAAkd,EAAA/uB,KAAAgV,OAAAxJ,EACAA,GAAA,MAAAT,KAAA8G,MAAA,GAAAkd,IAAAvjB,EAAAyjB,EAAAzjB,EAAAyjB,EAEA,SAAAlkB,KAAA+J,IAAAtJ,EAAAxL,KAAA+U,MASAF,EAAAhO,UAAAqR,MAAA,WACAlY,KAAA4W,SAAA,GASA/B,EAAAhO,UAAAuP,OAAA,SAAAtB,GACA9U,KAAAwL,GAAAsJ,GASAD,EAAAhO,UAAA2P,OAAA,SAAAzB,GACA/U,KAAA+U,OASAF,EAAAhO,UAAAyP,UAAA,SAAAtB,GACAhV,KAAAgV","file":"socket.io.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar url = __webpack_require__(1);\n\tvar parser = __webpack_require__(7);\n\tvar Manager = __webpack_require__(15);\n\tvar debug = __webpack_require__(3)('socket.io-client');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = exports = lookup;\n\t\n\t/**\n\t * Managers cache.\n\t */\n\t\n\tvar cache = exports.managers = {};\n\t\n\t/**\n\t * Looks up an existing `Manager` for multiplexing.\n\t * If the user summons:\n\t *\n\t * `io('http://localhost/a');`\n\t * `io('http://localhost/b');`\n\t *\n\t * We reuse the existing instance based on same scheme/port/host,\n\t * and we initialize sockets for each namespace.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction lookup (uri, opts) {\n\t if (typeof uri === 'object') {\n\t opts = uri;\n\t uri = undefined;\n\t }\n\t\n\t opts = opts || {};\n\t\n\t var parsed = url(uri);\n\t var source = parsed.source;\n\t var id = parsed.id;\n\t var path = parsed.path;\n\t var sameNamespace = cache[id] && path in cache[id].nsps;\n\t var newConnection = opts.forceNew || opts['force new connection'] ||\n\t false === opts.multiplex || sameNamespace;\n\t\n\t var io;\n\t\n\t if (newConnection) {\n\t debug('ignoring socket cache for %s', source);\n\t io = Manager(source, opts);\n\t } else {\n\t if (!cache[id]) {\n\t debug('new io instance for %s', source);\n\t cache[id] = Manager(source, opts);\n\t }\n\t io = cache[id];\n\t }\n\t if (parsed.query && !opts.query) {\n\t opts.query = parsed.query;\n\t }\n\t return io.socket(parsed.path, opts);\n\t}\n\t\n\t/**\n\t * Protocol version.\n\t *\n\t * @api public\n\t */\n\t\n\texports.protocol = parser.protocol;\n\t\n\t/**\n\t * `connect`.\n\t *\n\t * @param {String} uri\n\t * @api public\n\t */\n\t\n\texports.connect = lookup;\n\t\n\t/**\n\t * Expose constructors for standalone build.\n\t *\n\t * @api public\n\t */\n\t\n\texports.Manager = __webpack_require__(15);\n\texports.Socket = __webpack_require__(39);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar parseuri = __webpack_require__(2);\n\tvar debug = __webpack_require__(3)('socket.io-client:url');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = url;\n\t\n\t/**\n\t * URL parser.\n\t *\n\t * @param {String} url\n\t * @param {Object} An object meant to mimic window.location.\n\t * Defaults to window.location.\n\t * @api public\n\t */\n\t\n\tfunction url (uri, loc) {\n\t var obj = uri;\n\t\n\t // default to window.location\n\t loc = loc || (typeof location !== 'undefined' && location);\n\t if (null == uri) uri = loc.protocol + '//' + loc.host;\n\t\n\t // relative path support\n\t if ('string' === typeof uri) {\n\t if ('/' === uri.charAt(0)) {\n\t if ('/' === uri.charAt(1)) {\n\t uri = loc.protocol + uri;\n\t } else {\n\t uri = loc.host + uri;\n\t }\n\t }\n\t\n\t if (!/^(https?|wss?):\\/\\//.test(uri)) {\n\t debug('protocol-less url %s', uri);\n\t if ('undefined' !== typeof loc) {\n\t uri = loc.protocol + '//' + uri;\n\t } else {\n\t uri = 'https://' + uri;\n\t }\n\t }\n\t\n\t // parse\n\t debug('parse %s', uri);\n\t obj = parseuri(uri);\n\t }\n\t\n\t // make sure we treat `localhost:80` and `localhost` equally\n\t if (!obj.port) {\n\t if (/^(http|ws)$/.test(obj.protocol)) {\n\t obj.port = '80';\n\t } else if (/^(http|ws)s$/.test(obj.protocol)) {\n\t obj.port = '443';\n\t }\n\t }\n\t\n\t obj.path = obj.path || '/';\n\t\n\t var ipv6 = obj.host.indexOf(':') !== -1;\n\t var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\t\n\t // define unique id\n\t obj.id = obj.protocol + '://' + host + ':' + obj.port;\n\t // define href\n\t obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));\n\t\n\t return obj;\n\t}\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n\t/**\r\n\t * Parses an URI\r\n\t *\r\n\t * @author Steven Levithan <stevenlevithan.com> (MIT license)\r\n\t * @api private\r\n\t */\r\n\t\r\n\tvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\r\n\t\r\n\tvar parts = [\r\n\t 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\r\n\t];\r\n\t\r\n\tmodule.exports = function parseuri(str) {\r\n\t var src = str,\r\n\t b = str.indexOf('['),\r\n\t e = str.indexOf(']');\r\n\t\r\n\t if (b != -1 && e != -1) {\r\n\t str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\r\n\t }\r\n\t\r\n\t var m = re.exec(str || ''),\r\n\t uri = {},\r\n\t i = 14;\r\n\t\r\n\t while (i--) {\r\n\t uri[parts[i]] = m[i] || '';\r\n\t }\r\n\t\r\n\t if (b != -1 && e != -1) {\r\n\t uri.source = src;\r\n\t uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\r\n\t uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\r\n\t uri.ipv6uri = true;\r\n\t }\r\n\t\r\n\t return uri;\r\n\t};\r\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\t\n\t/* eslint-env browser */\n\t\n\t/**\n\t * This is the web browser implementation of `debug()`.\n\t */\n\t\n\texports.log = log;\n\texports.formatArgs = formatArgs;\n\texports.save = save;\n\texports.load = load;\n\texports.useColors = useColors;\n\texports.storage = localstorage();\n\t\n\t/**\n\t * Colors.\n\t */\n\t\n\texports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];\n\t\n\t/**\n\t * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n\t * and the Firebug extension (any Firefox version) are known\n\t * to support \"%c\" CSS customizations.\n\t *\n\t * TODO: add a `localStorage` variable to explicitly enable/disable colors\n\t */\n\t\n\t// eslint-disable-next-line complexity\n\tfunction useColors() {\n\t\t// NB: In an Electron preload script, document will be defined but not fully\n\t\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t\t// explicitly\n\t\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\t\treturn true;\n\t\t}\n\t\n\t\t// Internet Explorer and Edge do not support colors.\n\t\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\t\treturn false;\n\t\t}\n\t\n\t\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t\treturn typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\ttypeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\ttypeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\ttypeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n\t}\n\t\n\t/**\n\t * Colorize log arguments if enabled.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction formatArgs(args) {\n\t\targs[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\t\n\t\tif (!this.useColors) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar c = 'color: ' + this.color;\n\t\targs.splice(1, 0, c, 'color: inherit');\n\t\n\t\t// The final \"%c\" is somewhat tricky, because there could be other\n\t\t// arguments passed either before or after the %c, so we need to\n\t\t// figure out the correct index to insert the CSS into\n\t\tvar index = 0;\n\t\tvar lastC = 0;\n\t\targs[0].replace(/%[a-zA-Z%]/g, function (match) {\n\t\t\tif (match === '%%') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tindex++;\n\t\t\tif (match === '%c') {\n\t\t\t\t// We only are interested in the *last* %c\n\t\t\t\t// (the user may have provided their own)\n\t\t\t\tlastC = index;\n\t\t\t}\n\t\t});\n\t\n\t\targs.splice(lastC, 0, c);\n\t}\n\t\n\t/**\n\t * Invokes `console.log()` when available.\n\t * No-op when `console.log` is not a \"function\".\n\t *\n\t * @api public\n\t */\n\tfunction log() {\n\t\tvar _console;\n\t\n\t\t// This hackery is required for IE8/9, where\n\t\t// the `console.log` function doesn't have 'apply'\n\t\treturn (typeof console === 'undefined' ? 'undefined' : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);\n\t}\n\t\n\t/**\n\t * Save `namespaces`.\n\t *\n\t * @param {String} namespaces\n\t * @api private\n\t */\n\tfunction save(namespaces) {\n\t\ttry {\n\t\t\tif (namespaces) {\n\t\t\t\texports.storage.setItem('debug', namespaces);\n\t\t\t} else {\n\t\t\t\texports.storage.removeItem('debug');\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Swallow\n\t\t\t// XXX (@Qix-) should we be logging these?\n\t\t}\n\t}\n\t\n\t/**\n\t * Load `namespaces`.\n\t *\n\t * @return {String} returns the previously persisted debug modes\n\t * @api private\n\t */\n\tfunction load() {\n\t\tvar r = void 0;\n\t\ttry {\n\t\t\tr = exports.storage.getItem('debug');\n\t\t} catch (error) {}\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t\n\t\n\t\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\t\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\t\tr = process.env.DEBUG;\n\t\t}\n\t\n\t\treturn r;\n\t}\n\t\n\t/**\n\t * Localstorage attempts to return the localstorage.\n\t *\n\t * This is necessary because safari throws\n\t * when a user disables cookies/localstorage\n\t * and you attempt to access it.\n\t *\n\t * @return {LocalStorage}\n\t * @api private\n\t */\n\t\n\tfunction localstorage() {\n\t\ttry {\n\t\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t\t// The Browser also has localStorage in the global context.\n\t\t\treturn localStorage;\n\t\t} catch (error) {\n\t\t\t// Swallow\n\t\t\t// XXX (@Qix-) should we be logging these?\n\t\t}\n\t}\n\t\n\tmodule.exports = __webpack_require__(5)(exports);\n\t\n\tvar formatters = module.exports.formatters;\n\t\n\t/**\n\t * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n\t */\n\t\n\tformatters.j = function (v) {\n\t\ttry {\n\t\t\treturn JSON.stringify(v);\n\t\t} catch (error) {\n\t\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t\t}\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\n\t// shim for using process in browser\n\tvar process = module.exports = {};\n\t\n\t// cached from whatever global is present so that test runners that stub it\n\t// don't break things. But we need to wrap it in a try catch in case it is\n\t// wrapped in strict mode code which doesn't define any globals. It's inside a\n\t// function because try/catches deoptimize in certain engines.\n\t\n\tvar cachedSetTimeout;\n\tvar cachedClearTimeout;\n\t\n\tfunction defaultSetTimout() {\n\t throw new Error('setTimeout has not been defined');\n\t}\n\tfunction defaultClearTimeout () {\n\t throw new Error('clearTimeout has not been defined');\n\t}\n\t(function () {\n\t try {\n\t if (typeof setTimeout === 'function') {\n\t cachedSetTimeout = setTimeout;\n\t } else {\n\t cachedSetTimeout = defaultSetTimout;\n\t }\n\t } catch (e) {\n\t cachedSetTimeout = defaultSetTimout;\n\t }\n\t try {\n\t if (typeof clearTimeout === 'function') {\n\t cachedClearTimeout = clearTimeout;\n\t } else {\n\t cachedClearTimeout = defaultClearTimeout;\n\t }\n\t } catch (e) {\n\t cachedClearTimeout = defaultClearTimeout;\n\t }\n\t} ())\n\tfunction runTimeout(fun) {\n\t if (cachedSetTimeout === setTimeout) {\n\t //normal enviroments in sane situations\n\t return setTimeout(fun, 0);\n\t }\n\t // if setTimeout wasn't available but was latter defined\n\t if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n\t cachedSetTimeout = setTimeout;\n\t return setTimeout(fun, 0);\n\t }\n\t try {\n\t // when when somebody has screwed with setTimeout but no I.E. maddness\n\t return cachedSetTimeout(fun, 0);\n\t } catch(e){\n\t try {\n\t // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n\t return cachedSetTimeout.call(null, fun, 0);\n\t } catch(e){\n\t // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n\t return cachedSetTimeout.call(this, fun, 0);\n\t }\n\t }\n\t\n\t\n\t}\n\tfunction runClearTimeout(marker) {\n\t if (cachedClearTimeout === clearTimeout) {\n\t //normal enviroments in sane situations\n\t return clearTimeout(marker);\n\t }\n\t // if clearTimeout wasn't available but was latter defined\n\t if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n\t cachedClearTimeout = clearTimeout;\n\t return clearTimeout(marker);\n\t }\n\t try {\n\t // when when somebody has screwed with setTimeout but no I.E. maddness\n\t return cachedClearTimeout(marker);\n\t } catch (e){\n\t try {\n\t // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n\t return cachedClearTimeout.call(null, marker);\n\t } catch (e){\n\t // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n\t // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n\t return cachedClearTimeout.call(this, marker);\n\t }\n\t }\n\t\n\t\n\t\n\t}\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t if (!draining || !currentQueue) {\n\t return;\n\t }\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = runTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t runClearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t runTimeout(drainQueue);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\tprocess.prependListener = noop;\n\tprocess.prependOnceListener = noop;\n\t\n\tprocess.listeners = function (name) { return [] }\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\t\n\t/**\n\t * This is the common logic for both the Node.js and web browser\n\t * implementations of `debug()`.\n\t */\n\t\n\tfunction setup(env) {\n\t\tcreateDebug.debug = createDebug;\n\t\tcreateDebug.default = createDebug;\n\t\tcreateDebug.coerce = coerce;\n\t\tcreateDebug.disable = disable;\n\t\tcreateDebug.enable = enable;\n\t\tcreateDebug.enabled = enabled;\n\t\tcreateDebug.humanize = __webpack_require__(6);\n\t\n\t\tObject.keys(env).forEach(function (key) {\n\t\t\tcreateDebug[key] = env[key];\n\t\t});\n\t\n\t\t/**\n\t * Active `debug` instances.\n\t */\n\t\tcreateDebug.instances = [];\n\t\n\t\t/**\n\t * The currently active debug mode names, and names to skip.\n\t */\n\t\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\t\n\t\t/**\n\t * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t *\n\t * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t */\n\t\tcreateDebug.formatters = {};\n\t\n\t\t/**\n\t * Selects a color for a debug namespace\n\t * @param {String} namespace The namespace string for the for the debug instance to be colored\n\t * @return {Number|String} An ANSI color code for the given namespace\n\t * @api private\n\t */\n\t\tfunction selectColor(namespace) {\n\t\t\tvar hash = 0;\n\t\n\t\t\tfor (var i = 0; i < namespace.length; i++) {\n\t\t\t\thash = (hash << 5) - hash + namespace.charCodeAt(i);\n\t\t\t\thash |= 0; // Convert to 32bit integer\n\t\t\t}\n\t\n\t\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t\t}\n\t\tcreateDebug.selectColor = selectColor;\n\t\n\t\t/**\n\t * Create a debugger with the given `namespace`.\n\t *\n\t * @param {String} namespace\n\t * @return {Function}\n\t * @api public\n\t */\n\t\tfunction createDebug(namespace) {\n\t\t\tvar prevTime = void 0;\n\t\n\t\t\tfunction debug() {\n\t\t\t\tfor (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t\t\t\t\targs[_key] = arguments[_key];\n\t\t\t\t}\n\t\n\t\t\t\t// Disabled?\n\t\t\t\tif (!debug.enabled) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tvar self = debug;\n\t\n\t\t\t\t// Set `diff` timestamp\n\t\t\t\tvar curr = Number(new Date());\n\t\t\t\tvar ms = curr - (prevTime || curr);\n\t\t\t\tself.diff = ms;\n\t\t\t\tself.prev = prevTime;\n\t\t\t\tself.curr = curr;\n\t\t\t\tprevTime = curr;\n\t\n\t\t\t\targs[0] = createDebug.coerce(args[0]);\n\t\n\t\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\t\targs.unshift('%O');\n\t\t\t\t}\n\t\n\t\t\t\t// Apply any `formatters` transformations\n\t\t\t\tvar index = 0;\n\t\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {\n\t\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\t\tif (match === '%%') {\n\t\t\t\t\t\treturn match;\n\t\t\t\t\t}\n\t\t\t\t\tindex++;\n\t\t\t\t\tvar formatter = createDebug.formatters[format];\n\t\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\t\tvar val = args[index];\n\t\t\t\t\t\tmatch = formatter.call(self, val);\n\t\n\t\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\t\tindex--;\n\t\t\t\t\t}\n\t\t\t\t\treturn match;\n\t\t\t\t});\n\t\n\t\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\t\tcreateDebug.formatArgs.call(self, args);\n\t\n\t\t\t\tvar logFn = self.log || createDebug.log;\n\t\t\t\tlogFn.apply(self, args);\n\t\t\t}\n\t\n\t\t\tdebug.namespace = namespace;\n\t\t\tdebug.enabled = createDebug.enabled(namespace);\n\t\t\tdebug.useColors = createDebug.useColors();\n\t\t\tdebug.color = selectColor(namespace);\n\t\t\tdebug.destroy = destroy;\n\t\t\tdebug.extend = extend;\n\t\t\t// Debug.formatArgs = formatArgs;\n\t\t\t// debug.rawLog = rawLog;\n\t\n\t\t\t// env-specific initialization logic for debug instances\n\t\t\tif (typeof createDebug.init === 'function') {\n\t\t\t\tcreateDebug.init(debug);\n\t\t\t}\n\t\n\t\t\tcreateDebug.instances.push(debug);\n\t\n\t\t\treturn debug;\n\t\t}\n\t\n\t\tfunction destroy() {\n\t\t\tvar index = createDebug.instances.indexOf(this);\n\t\t\tif (index !== -1) {\n\t\t\t\tcreateDebug.instances.splice(index, 1);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\n\t\tfunction extend(namespace, delimiter) {\n\t\t\tvar newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\t\tnewDebug.log = this.log;\n\t\t\treturn newDebug;\n\t\t}\n\t\n\t\t/**\n\t * Enables a debug mode by namespaces. This can include modes\n\t * separated by a colon and wildcards.\n\t *\n\t * @param {String} namespaces\n\t * @api public\n\t */\n\t\tfunction enable(namespaces) {\n\t\t\tcreateDebug.save(namespaces);\n\t\n\t\t\tcreateDebug.names = [];\n\t\t\tcreateDebug.skips = [];\n\t\n\t\t\tvar i = void 0;\n\t\t\tvar split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\t\tvar len = split.length;\n\t\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tif (!split[i]) {\n\t\t\t\t\t// ignore empty strings\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\n\t\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\t\n\t\t\t\tif (namespaces[0] === '-') {\n\t\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t\t} else {\n\t\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (i = 0; i < createDebug.instances.length; i++) {\n\t\t\t\tvar instance = createDebug.instances[i];\n\t\t\t\tinstance.enabled = createDebug.enabled(instance.namespace);\n\t\t\t}\n\t\t}\n\t\n\t\t/**\n\t * Disable debug output.\n\t *\n\t * @return {String} namespaces\n\t * @api public\n\t */\n\t\tfunction disable() {\n\t\t\tvar namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {\n\t\t\t\treturn '-' + namespace;\n\t\t\t}))).join(',');\n\t\t\tcreateDebug.enable('');\n\t\t\treturn namespaces;\n\t\t}\n\t\n\t\t/**\n\t * Returns true if the given mode name is enabled, false otherwise.\n\t *\n\t * @param {String} name\n\t * @return {Boolean}\n\t * @api public\n\t */\n\t\tfunction enabled(name) {\n\t\t\tif (name[name.length - 1] === '*') {\n\t\t\t\treturn true;\n\t\t\t}\n\t\n\t\t\tvar i = void 0;\n\t\t\tvar len = void 0;\n\t\n\t\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn false;\n\t\t}\n\t\n\t\t/**\n\t * Convert regexp to namespace\n\t *\n\t * @param {RegExp} regxep\n\t * @return {String} namespace\n\t * @api private\n\t */\n\t\tfunction toNamespace(regexp) {\n\t\t\treturn regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\.\\*\\?$/, '*');\n\t\t}\n\t\n\t\t/**\n\t * Coerce `val`.\n\t *\n\t * @param {Mixed} val\n\t * @return {Mixed}\n\t * @api private\n\t */\n\t\tfunction coerce(val) {\n\t\t\tif (val instanceof Error) {\n\t\t\t\treturn val.stack || val.message;\n\t\t\t}\n\t\t\treturn val;\n\t\t}\n\t\n\t\tcreateDebug.enable(createDebug.load());\n\t\n\t\treturn createDebug;\n\t}\n\t\n\tmodule.exports = setup;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\n\t/**\n\t * Helpers.\n\t */\n\t\n\tvar s = 1000;\n\tvar m = s * 60;\n\tvar h = m * 60;\n\tvar d = h * 24;\n\tvar w = d * 7;\n\tvar y = d * 365.25;\n\t\n\t/**\n\t * Parse or format the given `val`.\n\t *\n\t * Options:\n\t *\n\t * - `long` verbose formatting [false]\n\t *\n\t * @param {String|Number} val\n\t * @param {Object} [options]\n\t * @throws {Error} throw an error if val is not a non-empty string or a number\n\t * @return {String|Number}\n\t * @api public\n\t */\n\t\n\tmodule.exports = function(val, options) {\n\t options = options || {};\n\t var type = typeof val;\n\t if (type === 'string' && val.length > 0) {\n\t return parse(val);\n\t } else if (type === 'number' && isFinite(val)) {\n\t return options.long ? fmtLong(val) : fmtShort(val);\n\t }\n\t throw new Error(\n\t 'val is not a non-empty string or a valid number. val=' +\n\t JSON.stringify(val)\n\t );\n\t};\n\t\n\t/**\n\t * Parse the given `str` and return milliseconds.\n\t *\n\t * @param {String} str\n\t * @return {Number}\n\t * @api private\n\t */\n\t\n\tfunction parse(str) {\n\t str = String(str);\n\t if (str.length > 100) {\n\t return;\n\t }\n\t var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n\t str\n\t );\n\t if (!match) {\n\t return;\n\t }\n\t var n = parseFloat(match[1]);\n\t var type = (match[2] || 'ms').toLowerCase();\n\t switch (type) {\n\t case 'years':\n\t case 'year':\n\t case 'yrs':\n\t case 'yr':\n\t case 'y':\n\t return n * y;\n\t case 'weeks':\n\t case 'week':\n\t case 'w':\n\t return n * w;\n\t case 'days':\n\t case 'day':\n\t case 'd':\n\t return n * d;\n\t case 'hours':\n\t case 'hour':\n\t case 'hrs':\n\t case 'hr':\n\t case 'h':\n\t return n * h;\n\t case 'minutes':\n\t case 'minute':\n\t case 'mins':\n\t case 'min':\n\t case 'm':\n\t return n * m;\n\t case 'seconds':\n\t case 'second':\n\t case 'secs':\n\t case 'sec':\n\t case 's':\n\t return n * s;\n\t case 'milliseconds':\n\t case 'millisecond':\n\t case 'msecs':\n\t case 'msec':\n\t case 'ms':\n\t return n;\n\t default:\n\t return undefined;\n\t }\n\t}\n\t\n\t/**\n\t * Short format for `ms`.\n\t *\n\t * @param {Number} ms\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tfunction fmtShort(ms) {\n\t var msAbs = Math.abs(ms);\n\t if (msAbs >= d) {\n\t return Math.round(ms / d) + 'd';\n\t }\n\t if (msAbs >= h) {\n\t return Math.round(ms / h) + 'h';\n\t }\n\t if (msAbs >= m) {\n\t return Math.round(ms / m) + 'm';\n\t }\n\t if (msAbs >= s) {\n\t return Math.round(ms / s) + 's';\n\t }\n\t return ms + 'ms';\n\t}\n\t\n\t/**\n\t * Long format for `ms`.\n\t *\n\t * @param {Number} ms\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tfunction fmtLong(ms) {\n\t var msAbs = Math.abs(ms);\n\t if (msAbs >= d) {\n\t return plural(ms, msAbs, d, 'day');\n\t }\n\t if (msAbs >= h) {\n\t return plural(ms, msAbs, h, 'hour');\n\t }\n\t if (msAbs >= m) {\n\t return plural(ms, msAbs, m, 'minute');\n\t }\n\t if (msAbs >= s) {\n\t return plural(ms, msAbs, s, 'second');\n\t }\n\t return ms + ' ms';\n\t}\n\t\n\t/**\n\t * Pluralization helper.\n\t */\n\t\n\tfunction plural(ms, msAbs, n, name) {\n\t var isPlural = msAbs >= n * 1.5;\n\t return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n\t}\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(8)('socket.io-parser');\n\tvar Emitter = __webpack_require__(11);\n\tvar binary = __webpack_require__(12);\n\tvar isArray = __webpack_require__(13);\n\tvar isBuf = __webpack_require__(14);\n\t\n\t/**\n\t * Protocol version.\n\t *\n\t * @api public\n\t */\n\t\n\texports.protocol = 4;\n\t\n\t/**\n\t * Packet types.\n\t *\n\t * @api public\n\t */\n\t\n\texports.types = [\n\t 'CONNECT',\n\t 'DISCONNECT',\n\t 'EVENT',\n\t 'ACK',\n\t 'ERROR',\n\t 'BINARY_EVENT',\n\t 'BINARY_ACK'\n\t];\n\t\n\t/**\n\t * Packet type `connect`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.CONNECT = 0;\n\t\n\t/**\n\t * Packet type `disconnect`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.DISCONNECT = 1;\n\t\n\t/**\n\t * Packet type `event`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.EVENT = 2;\n\t\n\t/**\n\t * Packet type `ack`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.ACK = 3;\n\t\n\t/**\n\t * Packet type `error`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.ERROR = 4;\n\t\n\t/**\n\t * Packet type 'binary event'\n\t *\n\t * @api public\n\t */\n\t\n\texports.BINARY_EVENT = 5;\n\t\n\t/**\n\t * Packet type `binary ack`. For acks with binary arguments.\n\t *\n\t * @api public\n\t */\n\t\n\texports.BINARY_ACK = 6;\n\t\n\t/**\n\t * Encoder constructor.\n\t *\n\t * @api public\n\t */\n\t\n\texports.Encoder = Encoder;\n\t\n\t/**\n\t * Decoder constructor.\n\t *\n\t * @api public\n\t */\n\t\n\texports.Decoder = Decoder;\n\t\n\t/**\n\t * A socket.io Encoder instance\n\t *\n\t * @api public\n\t */\n\t\n\tfunction Encoder() {}\n\t\n\tvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\t\n\t/**\n\t * Encode a packet as a single string if non-binary, or as a\n\t * buffer sequence, depending on packet type.\n\t *\n\t * @param {Object} obj - packet object\n\t * @param {Function} callback - function to handle encodings (likely engine.write)\n\t * @return Calls callback with Array of encodings\n\t * @api public\n\t */\n\t\n\tEncoder.prototype.encode = function(obj, callback){\n\t debug('encoding packet %j', obj);\n\t\n\t if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n\t encodeAsBinary(obj, callback);\n\t } else {\n\t var encoding = encodeAsString(obj);\n\t callback([encoding]);\n\t }\n\t};\n\t\n\t/**\n\t * Encode packet as string.\n\t *\n\t * @param {Object} packet\n\t * @return {String} encoded\n\t * @api private\n\t */\n\t\n\tfunction encodeAsString(obj) {\n\t\n\t // first is type\n\t var str = '' + obj.type;\n\t\n\t // attachments if we have them\n\t if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n\t str += obj.attachments + '-';\n\t }\n\t\n\t // if we have a namespace other than `/`\n\t // we append it followed by a comma `,`\n\t if (obj.nsp && '/' !== obj.nsp) {\n\t str += obj.nsp + ',';\n\t }\n\t\n\t // immediately followed by the id\n\t if (null != obj.id) {\n\t str += obj.id;\n\t }\n\t\n\t // json data\n\t if (null != obj.data) {\n\t var payload = tryStringify(obj.data);\n\t if (payload !== false) {\n\t str += payload;\n\t } else {\n\t return ERROR_PACKET;\n\t }\n\t }\n\t\n\t debug('encoded %j as %s', obj, str);\n\t return str;\n\t}\n\t\n\tfunction tryStringify(str) {\n\t try {\n\t return JSON.stringify(str);\n\t } catch(e){\n\t return false;\n\t }\n\t}\n\t\n\t/**\n\t * Encode packet as 'buffer sequence' by removing blobs, and\n\t * deconstructing packet into object with placeholders and\n\t * a list of buffers.\n\t *\n\t * @param {Object} packet\n\t * @return {Buffer} encoded\n\t * @api private\n\t */\n\t\n\tfunction encodeAsBinary(obj, callback) {\n\t\n\t function writeEncoding(bloblessData) {\n\t var deconstruction = binary.deconstructPacket(bloblessData);\n\t var pack = encodeAsString(deconstruction.packet);\n\t var buffers = deconstruction.buffers;\n\t\n\t buffers.unshift(pack); // add packet info to beginning of data list\n\t callback(buffers); // write all the buffers\n\t }\n\t\n\t binary.removeBlobs(obj, writeEncoding);\n\t}\n\t\n\t/**\n\t * A socket.io Decoder instance\n\t *\n\t * @return {Object} decoder\n\t * @api public\n\t */\n\t\n\tfunction Decoder() {\n\t this.reconstructor = null;\n\t}\n\t\n\t/**\n\t * Mix in `Emitter` with Decoder.\n\t */\n\t\n\tEmitter(Decoder.prototype);\n\t\n\t/**\n\t * Decodes an encoded packet string into packet JSON.\n\t *\n\t * @param {String} obj - encoded packet\n\t * @return {Object} packet\n\t * @api public\n\t */\n\t\n\tDecoder.prototype.add = function(obj) {\n\t var packet;\n\t if (typeof obj === 'string') {\n\t packet = decodeString(obj);\n\t if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n\t this.reconstructor = new BinaryReconstructor(packet);\n\t\n\t // no attachments, labeled binary but no binary data to follow\n\t if (this.reconstructor.reconPack.attachments === 0) {\n\t this.emit('decoded', packet);\n\t }\n\t } else { // non-binary full packet\n\t this.emit('decoded', packet);\n\t }\n\t } else if (isBuf(obj) || obj.base64) { // raw binary data\n\t if (!this.reconstructor) {\n\t throw new Error('got binary data when not reconstructing a packet');\n\t } else {\n\t packet = this.reconstructor.takeBinaryData(obj);\n\t if (packet) { // received final buffer\n\t this.reconstructor = null;\n\t this.emit('decoded', packet);\n\t }\n\t }\n\t } else {\n\t throw new Error('Unknown type: ' + obj);\n\t }\n\t};\n\t\n\t/**\n\t * Decode a packet String (JSON data)\n\t *\n\t * @param {String} str\n\t * @return {Object} packet\n\t * @api private\n\t */\n\t\n\tfunction decodeString(str) {\n\t var i = 0;\n\t // look up type\n\t var p = {\n\t type: Number(str.charAt(0))\n\t };\n\t\n\t if (null == exports.types[p.type]) {\n\t return error('unknown packet type ' + p.type);\n\t }\n\t\n\t // look up attachments if type binary\n\t if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n\t var buf = '';\n\t while (str.charAt(++i) !== '-') {\n\t buf += str.charAt(i);\n\t if (i == str.length) break;\n\t }\n\t if (buf != Number(buf) || str.charAt(i) !== '-') {\n\t throw new Error('Illegal attachments');\n\t }\n\t p.attachments = Number(buf);\n\t }\n\t\n\t // look up namespace (if any)\n\t if ('/' === str.charAt(i + 1)) {\n\t p.nsp = '';\n\t while (++i) {\n\t var c = str.charAt(i);\n\t if (',' === c) break;\n\t p.nsp += c;\n\t if (i === str.length) break;\n\t }\n\t } else {\n\t p.nsp = '/';\n\t }\n\t\n\t // look up id\n\t var next = str.charAt(i + 1);\n\t if ('' !== next && Number(next) == next) {\n\t p.id = '';\n\t while (++i) {\n\t var c = str.charAt(i);\n\t if (null == c || Number(c) != c) {\n\t --i;\n\t break;\n\t }\n\t p.id += str.charAt(i);\n\t if (i === str.length) break;\n\t }\n\t p.id = Number(p.id);\n\t }\n\t\n\t // look up json data\n\t if (str.charAt(++i)) {\n\t var payload = tryParse(str.substr(i));\n\t var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n\t if (isPayloadValid) {\n\t p.data = payload;\n\t } else {\n\t return error('invalid payload');\n\t }\n\t }\n\t\n\t debug('decoded %s as %j', str, p);\n\t return p;\n\t}\n\t\n\tfunction tryParse(str) {\n\t try {\n\t return JSON.parse(str);\n\t } catch(e){\n\t return false;\n\t }\n\t}\n\t\n\t/**\n\t * Deallocates a parser's resources\n\t *\n\t * @api public\n\t */\n\t\n\tDecoder.prototype.destroy = function() {\n\t if (this.reconstructor) {\n\t this.reconstructor.finishedReconstruction();\n\t }\n\t};\n\t\n\t/**\n\t * A manager of a binary event's 'buffer sequence'. Should\n\t * be constructed whenever a packet of type BINARY_EVENT is\n\t * decoded.\n\t *\n\t * @param {Object} packet\n\t * @return {BinaryReconstructor} initialized reconstructor\n\t * @api private\n\t */\n\t\n\tfunction BinaryReconstructor(packet) {\n\t this.reconPack = packet;\n\t this.buffers = [];\n\t}\n\t\n\t/**\n\t * Method to be called when binary data received from connection\n\t * after a BINARY_EVENT packet.\n\t *\n\t * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n\t * @return {null | Object} returns null if more binary data is expected or\n\t * a reconstructed packet object if all buffers have been received.\n\t * @api private\n\t */\n\t\n\tBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n\t this.buffers.push(binData);\n\t if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n\t var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n\t this.finishedReconstruction();\n\t return packet;\n\t }\n\t return null;\n\t};\n\t\n\t/**\n\t * Cleans up binary packet reconstruction variables.\n\t *\n\t * @api private\n\t */\n\t\n\tBinaryReconstructor.prototype.finishedReconstruction = function() {\n\t this.reconPack = null;\n\t this.buffers = [];\n\t};\n\t\n\tfunction error(msg) {\n\t return {\n\t type: exports.ERROR,\n\t data: 'parser error: ' + msg\n\t };\n\t}\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\t\n\t/**\n\t * This is the web browser implementation of `debug()`.\n\t *\n\t * Expose `debug()` as the module.\n\t */\n\t\n\texports = module.exports = __webpack_require__(9);\n\texports.log = log;\n\texports.formatArgs = formatArgs;\n\texports.save = save;\n\texports.load = load;\n\texports.useColors = useColors;\n\texports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();\n\t\n\t/**\n\t * Colors.\n\t */\n\t\n\texports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];\n\t\n\t/**\n\t * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n\t * and the Firebug extension (any Firefox version) are known\n\t * to support \"%c\" CSS customizations.\n\t *\n\t * TODO: add a `localStorage` variable to explicitly enable/disable colors\n\t */\n\t\n\tfunction useColors() {\n\t // NB: In an Electron preload script, document will be defined but not fully\n\t // initialized. Since we know we're in Chrome, we'll just detect this case\n\t // explicitly\n\t if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {\n\t return true;\n\t }\n\t\n\t // Internet Explorer and Edge do not support colors.\n\t if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t return false;\n\t }\n\t\n\t // is webkit? http://stackoverflow.com/a/16459606/376773\n\t // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||\n\t // is firebug? http://stackoverflow.com/a/398120/376773\n\t typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||\n\t // is firefox >= v31?\n\t // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||\n\t // double check webkit in userAgent just in case we are in a worker\n\t typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n\t}\n\t\n\t/**\n\t * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n\t */\n\t\n\texports.formatters.j = function (v) {\n\t try {\n\t return JSON.stringify(v);\n\t } catch (err) {\n\t return '[UnexpectedJSONParseError]: ' + err.message;\n\t }\n\t};\n\t\n\t/**\n\t * Colorize log arguments if enabled.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction formatArgs(args) {\n\t var useColors = this.useColors;\n\t\n\t args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);\n\t\n\t if (!useColors) return;\n\t\n\t var c = 'color: ' + this.color;\n\t args.splice(1, 0, c, 'color: inherit');\n\t\n\t // the final \"%c\" is somewhat tricky, because there could be other\n\t // arguments passed either before or after the %c, so we need to\n\t // figure out the correct index to insert the CSS into\n\t var index = 0;\n\t var lastC = 0;\n\t args[0].replace(/%[a-zA-Z%]/g, function (match) {\n\t if ('%%' === match) return;\n\t index++;\n\t if ('%c' === match) {\n\t // we only are interested in the *last* %c\n\t // (the user may have provided their own)\n\t lastC = index;\n\t }\n\t });\n\t\n\t args.splice(lastC, 0, c);\n\t}\n\t\n\t/**\n\t * Invokes `console.log()` when available.\n\t * No-op when `console.log` is not a \"function\".\n\t *\n\t * @api public\n\t */\n\t\n\tfunction log() {\n\t // this hackery is required for IE8/9, where\n\t // the `console.log` function doesn't have 'apply'\n\t return 'object' === (typeof console === 'undefined' ? 'undefined' : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments);\n\t}\n\t\n\t/**\n\t * Save `namespaces`.\n\t *\n\t * @param {String} namespaces\n\t * @api private\n\t */\n\t\n\tfunction save(namespaces) {\n\t try {\n\t if (null == namespaces) {\n\t exports.storage.removeItem('debug');\n\t } else {\n\t exports.storage.debug = namespaces;\n\t }\n\t } catch (e) {}\n\t}\n\t\n\t/**\n\t * Load `namespaces`.\n\t *\n\t * @return {String} returns the previously persisted debug modes\n\t * @api private\n\t */\n\t\n\tfunction load() {\n\t var r;\n\t try {\n\t r = exports.storage.debug;\n\t } catch (e) {}\n\t\n\t // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\t if (!r && typeof process !== 'undefined' && 'env' in process) {\n\t r = process.env.DEBUG;\n\t }\n\t\n\t return r;\n\t}\n\t\n\t/**\n\t * Enable namespaces listed in `localStorage.debug` initially.\n\t */\n\t\n\texports.enable(load());\n\t\n\t/**\n\t * Localstorage attempts to return the localstorage.\n\t *\n\t * This is necessary because safari throws\n\t * when a user disables cookies/localstorage\n\t * and you attempt to access it.\n\t *\n\t * @return {LocalStorage}\n\t * @api private\n\t */\n\t\n\tfunction localstorage() {\n\t try {\n\t return window.localStorage;\n\t } catch (e) {}\n\t}\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\t/**\n\t * This is the common logic for both the Node.js and web browser\n\t * implementations of `debug()`.\n\t *\n\t * Expose `debug()` as the module.\n\t */\n\t\n\texports = module.exports = createDebug.debug = createDebug['default'] = createDebug;\n\texports.coerce = coerce;\n\texports.disable = disable;\n\texports.enable = enable;\n\texports.enabled = enabled;\n\texports.humanize = __webpack_require__(10);\n\t\n\t/**\n\t * Active `debug` instances.\n\t */\n\texports.instances = [];\n\t\n\t/**\n\t * The currently active debug mode names, and names to skip.\n\t */\n\t\n\texports.names = [];\n\texports.skips = [];\n\t\n\t/**\n\t * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t *\n\t * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t */\n\t\n\texports.formatters = {};\n\t\n\t/**\n\t * Select a color.\n\t * @param {String} namespace\n\t * @return {Number}\n\t * @api private\n\t */\n\t\n\tfunction selectColor(namespace) {\n\t var hash = 0,\n\t i;\n\t\n\t for (i in namespace) {\n\t hash = (hash << 5) - hash + namespace.charCodeAt(i);\n\t hash |= 0; // Convert to 32bit integer\n\t }\n\t\n\t return exports.colors[Math.abs(hash) % exports.colors.length];\n\t}\n\t\n\t/**\n\t * Create a debugger with the given `namespace`.\n\t *\n\t * @param {String} namespace\n\t * @return {Function}\n\t * @api public\n\t */\n\t\n\tfunction createDebug(namespace) {\n\t\n\t var prevTime;\n\t\n\t function debug() {\n\t // disabled?\n\t if (!debug.enabled) return;\n\t\n\t var self = debug;\n\t\n\t // set `diff` timestamp\n\t var curr = +new Date();\n\t var ms = curr - (prevTime || curr);\n\t self.diff = ms;\n\t self.prev = prevTime;\n\t self.curr = curr;\n\t prevTime = curr;\n\t\n\t // turn the `arguments` into a proper Array\n\t var args = new Array(arguments.length);\n\t for (var i = 0; i < args.length; i++) {\n\t args[i] = arguments[i];\n\t }\n\t\n\t args[0] = exports.coerce(args[0]);\n\t\n\t if ('string' !== typeof args[0]) {\n\t // anything else let's inspect with %O\n\t args.unshift('%O');\n\t }\n\t\n\t // apply any `formatters` transformations\n\t var index = 0;\n\t args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {\n\t // if we encounter an escaped % then don't increase the array index\n\t if (match === '%%') return match;\n\t index++;\n\t var formatter = exports.formatters[format];\n\t if ('function' === typeof formatter) {\n\t var val = args[index];\n\t match = formatter.call(self, val);\n\t\n\t // now we need to remove `args[index]` since it's inlined in the `format`\n\t args.splice(index, 1);\n\t index--;\n\t }\n\t return match;\n\t });\n\t\n\t // apply env-specific formatting (colors, etc.)\n\t exports.formatArgs.call(self, args);\n\t\n\t var logFn = debug.log || exports.log || console.log.bind(console);\n\t logFn.apply(self, args);\n\t }\n\t\n\t debug.namespace = namespace;\n\t debug.enabled = exports.enabled(namespace);\n\t debug.useColors = exports.useColors();\n\t debug.color = selectColor(namespace);\n\t debug.destroy = destroy;\n\t\n\t // env-specific initialization logic for debug instances\n\t if ('function' === typeof exports.init) {\n\t exports.init(debug);\n\t }\n\t\n\t exports.instances.push(debug);\n\t\n\t return debug;\n\t}\n\t\n\tfunction destroy() {\n\t var index = exports.instances.indexOf(this);\n\t if (index !== -1) {\n\t exports.instances.splice(index, 1);\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t}\n\t\n\t/**\n\t * Enables a debug mode by namespaces. This can include modes\n\t * separated by a colon and wildcards.\n\t *\n\t * @param {String} namespaces\n\t * @api public\n\t */\n\t\n\tfunction enable(namespaces) {\n\t exports.save(namespaces);\n\t\n\t exports.names = [];\n\t exports.skips = [];\n\t\n\t var i;\n\t var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t var len = split.length;\n\t\n\t for (i = 0; i < len; i++) {\n\t if (!split[i]) continue; // ignore empty strings\n\t namespaces = split[i].replace(/\\*/g, '.*?');\n\t if (namespaces[0] === '-') {\n\t exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t } else {\n\t exports.names.push(new RegExp('^' + namespaces + '$'));\n\t }\n\t }\n\t\n\t for (i = 0; i < exports.instances.length; i++) {\n\t var instance = exports.instances[i];\n\t instance.enabled = exports.enabled(instance.namespace);\n\t }\n\t}\n\t\n\t/**\n\t * Disable debug output.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction disable() {\n\t exports.enable('');\n\t}\n\t\n\t/**\n\t * Returns true if the given mode name is enabled, false otherwise.\n\t *\n\t * @param {String} name\n\t * @return {Boolean}\n\t * @api public\n\t */\n\t\n\tfunction enabled(name) {\n\t if (name[name.length - 1] === '*') {\n\t return true;\n\t }\n\t var i, len;\n\t for (i = 0, len = exports.skips.length; i < len; i++) {\n\t if (exports.skips[i].test(name)) {\n\t return false;\n\t }\n\t }\n\t for (i = 0, len = exports.names.length; i < len; i++) {\n\t if (exports.names[i].test(name)) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Coerce `val`.\n\t *\n\t * @param {Mixed} val\n\t * @return {Mixed}\n\t * @api private\n\t */\n\t\n\tfunction coerce(val) {\n\t if (val instanceof Error) return val.stack || val.message;\n\t return val;\n\t}\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports) {\n\n\t/**\n\t * Helpers.\n\t */\n\t\n\tvar s = 1000;\n\tvar m = s * 60;\n\tvar h = m * 60;\n\tvar d = h * 24;\n\tvar y = d * 365.25;\n\t\n\t/**\n\t * Parse or format the given `val`.\n\t *\n\t * Options:\n\t *\n\t * - `long` verbose formatting [false]\n\t *\n\t * @param {String|Number} val\n\t * @param {Object} [options]\n\t * @throws {Error} throw an error if val is not a non-empty string or a number\n\t * @return {String|Number}\n\t * @api public\n\t */\n\t\n\tmodule.exports = function(val, options) {\n\t options = options || {};\n\t var type = typeof val;\n\t if (type === 'string' && val.length > 0) {\n\t return parse(val);\n\t } else if (type === 'number' && isNaN(val) === false) {\n\t return options.long ? fmtLong(val) : fmtShort(val);\n\t }\n\t throw new Error(\n\t 'val is not a non-empty string or a valid number. val=' +\n\t JSON.stringify(val)\n\t );\n\t};\n\t\n\t/**\n\t * Parse the given `str` and return milliseconds.\n\t *\n\t * @param {String} str\n\t * @return {Number}\n\t * @api private\n\t */\n\t\n\tfunction parse(str) {\n\t str = String(str);\n\t if (str.length > 100) {\n\t return;\n\t }\n\t var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(\n\t str\n\t );\n\t if (!match) {\n\t return;\n\t }\n\t var n = parseFloat(match[1]);\n\t var type = (match[2] || 'ms').toLowerCase();\n\t switch (type) {\n\t case 'years':\n\t case 'year':\n\t case 'yrs':\n\t case 'yr':\n\t case 'y':\n\t return n * y;\n\t case 'days':\n\t case 'day':\n\t case 'd':\n\t return n * d;\n\t case 'hours':\n\t case 'hour':\n\t case 'hrs':\n\t case 'hr':\n\t case 'h':\n\t return n * h;\n\t case 'minutes':\n\t case 'minute':\n\t case 'mins':\n\t case 'min':\n\t case 'm':\n\t return n * m;\n\t case 'seconds':\n\t case 'second':\n\t case 'secs':\n\t case 'sec':\n\t case 's':\n\t return n * s;\n\t case 'milliseconds':\n\t case 'millisecond':\n\t case 'msecs':\n\t case 'msec':\n\t case 'ms':\n\t return n;\n\t default:\n\t return undefined;\n\t }\n\t}\n\t\n\t/**\n\t * Short format for `ms`.\n\t *\n\t * @param {Number} ms\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tfunction fmtShort(ms) {\n\t if (ms >= d) {\n\t return Math.round(ms / d) + 'd';\n\t }\n\t if (ms >= h) {\n\t return Math.round(ms / h) + 'h';\n\t }\n\t if (ms >= m) {\n\t return Math.round(ms / m) + 'm';\n\t }\n\t if (ms >= s) {\n\t return Math.round(ms / s) + 's';\n\t }\n\t return ms + 'ms';\n\t}\n\t\n\t/**\n\t * Long format for `ms`.\n\t *\n\t * @param {Number} ms\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tfunction fmtLong(ms) {\n\t return plural(ms, d, 'day') ||\n\t plural(ms, h, 'hour') ||\n\t plural(ms, m, 'minute') ||\n\t plural(ms, s, 'second') ||\n\t ms + ' ms';\n\t}\n\t\n\t/**\n\t * Pluralization helper.\n\t */\n\t\n\tfunction plural(ms, n, name) {\n\t if (ms < n) {\n\t return;\n\t }\n\t if (ms < n * 1.5) {\n\t return Math.floor(ms / n) + ' ' + name;\n\t }\n\t return Math.ceil(ms / n) + ' ' + name + 's';\n\t}\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\r\n\t/**\r\n\t * Expose `Emitter`.\r\n\t */\r\n\t\r\n\tif (true) {\r\n\t module.exports = Emitter;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Initialize a new `Emitter`.\r\n\t *\r\n\t * @api public\r\n\t */\r\n\t\r\n\tfunction Emitter(obj) {\r\n\t if (obj) return mixin(obj);\r\n\t};\r\n\t\r\n\t/**\r\n\t * Mixin the emitter properties.\r\n\t *\r\n\t * @param {Object} obj\r\n\t * @return {Object}\r\n\t * @api private\r\n\t */\r\n\t\r\n\tfunction mixin(obj) {\r\n\t for (var key in Emitter.prototype) {\r\n\t obj[key] = Emitter.prototype[key];\r\n\t }\r\n\t return obj;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Listen on the given `event` with `fn`.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.on =\r\n\tEmitter.prototype.addEventListener = function(event, fn){\r\n\t this._callbacks = this._callbacks || {};\r\n\t (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n\t .push(fn);\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Adds an `event` listener that will be invoked a single\r\n\t * time then automatically removed.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.once = function(event, fn){\r\n\t function on() {\r\n\t this.off(event, on);\r\n\t fn.apply(this, arguments);\r\n\t }\r\n\t\r\n\t on.fn = fn;\r\n\t this.on(event, on);\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Remove the given callback for `event` or all\r\n\t * registered callbacks.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.off =\r\n\tEmitter.prototype.removeListener =\r\n\tEmitter.prototype.removeAllListeners =\r\n\tEmitter.prototype.removeEventListener = function(event, fn){\r\n\t this._callbacks = this._callbacks || {};\r\n\t\r\n\t // all\r\n\t if (0 == arguments.length) {\r\n\t this._callbacks = {};\r\n\t return this;\r\n\t }\r\n\t\r\n\t // specific event\r\n\t var callbacks = this._callbacks['$' + event];\r\n\t if (!callbacks) return this;\r\n\t\r\n\t // remove all handlers\r\n\t if (1 == arguments.length) {\r\n\t delete this._callbacks['$' + event];\r\n\t return this;\r\n\t }\r\n\t\r\n\t // remove specific handler\r\n\t var cb;\r\n\t for (var i = 0; i < callbacks.length; i++) {\r\n\t cb = callbacks[i];\r\n\t if (cb === fn || cb.fn === fn) {\r\n\t callbacks.splice(i, 1);\r\n\t break;\r\n\t }\r\n\t }\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Emit `event` with the given args.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Mixed} ...\r\n\t * @return {Emitter}\r\n\t */\r\n\t\r\n\tEmitter.prototype.emit = function(event){\r\n\t this._callbacks = this._callbacks || {};\r\n\t var args = [].slice.call(arguments, 1)\r\n\t , callbacks = this._callbacks['$' + event];\r\n\t\r\n\t if (callbacks) {\r\n\t callbacks = callbacks.slice(0);\r\n\t for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n\t callbacks[i].apply(this, args);\r\n\t }\r\n\t }\r\n\t\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Return array of callbacks for `event`.\r\n\t *\r\n\t * @param {String} event\r\n\t * @return {Array}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.listeners = function(event){\r\n\t this._callbacks = this._callbacks || {};\r\n\t return this._callbacks['$' + event] || [];\r\n\t};\r\n\t\r\n\t/**\r\n\t * Check if this emitter has `event` handlers.\r\n\t *\r\n\t * @param {String} event\r\n\t * @return {Boolean}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.hasListeners = function(event){\r\n\t return !! this.listeners(event).length;\r\n\t};\r\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/*global Blob,File*/\n\t\n\t/**\n\t * Module requirements\n\t */\n\t\n\tvar isArray = __webpack_require__(13);\n\tvar isBuf = __webpack_require__(14);\n\tvar toString = Object.prototype.toString;\n\tvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\n\tvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\t\n\t/**\n\t * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n\t * Anything with blobs or files should be fed through removeBlobs before coming\n\t * here.\n\t *\n\t * @param {Object} packet - socket.io event packet\n\t * @return {Object} with deconstructed packet and list of buffers\n\t * @api public\n\t */\n\t\n\texports.deconstructPacket = function(packet) {\n\t var buffers = [];\n\t var packetData = packet.data;\n\t var pack = packet;\n\t pack.data = _deconstructPacket(packetData, buffers);\n\t pack.attachments = buffers.length; // number of binary 'attachments'\n\t return {packet: pack, buffers: buffers};\n\t};\n\t\n\tfunction _deconstructPacket(data, buffers) {\n\t if (!data) return data;\n\t\n\t if (isBuf(data)) {\n\t var placeholder = { _placeholder: true, num: buffers.length };\n\t buffers.push(data);\n\t return placeholder;\n\t } else if (isArray(data)) {\n\t var newData = new Array(data.length);\n\t for (var i = 0; i < data.length; i++) {\n\t newData[i] = _deconstructPacket(data[i], buffers);\n\t }\n\t return newData;\n\t } else if (typeof data === 'object' && !(data instanceof Date)) {\n\t var newData = {};\n\t for (var key in data) {\n\t newData[key] = _deconstructPacket(data[key], buffers);\n\t }\n\t return newData;\n\t }\n\t return data;\n\t}\n\t\n\t/**\n\t * Reconstructs a binary packet from its placeholder packet and buffers\n\t *\n\t * @param {Object} packet - event packet with placeholders\n\t * @param {Array} buffers - binary buffers to put in placeholder positions\n\t * @return {Object} reconstructed packet\n\t * @api public\n\t */\n\t\n\texports.reconstructPacket = function(packet, buffers) {\n\t packet.data = _reconstructPacket(packet.data, buffers);\n\t packet.attachments = undefined; // no longer useful\n\t return packet;\n\t};\n\t\n\tfunction _reconstructPacket(data, buffers) {\n\t if (!data) return data;\n\t\n\t if (data && data._placeholder) {\n\t return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n\t } else if (isArray(data)) {\n\t for (var i = 0; i < data.length; i++) {\n\t data[i] = _reconstructPacket(data[i], buffers);\n\t }\n\t } else if (typeof data === 'object') {\n\t for (var key in data) {\n\t data[key] = _reconstructPacket(data[key], buffers);\n\t }\n\t }\n\t\n\t return data;\n\t}\n\t\n\t/**\n\t * Asynchronously removes Blobs or Files from data via\n\t * FileReader's readAsArrayBuffer method. Used before encoding\n\t * data as msgpack. Calls callback with the blobless data.\n\t *\n\t * @param {Object} data\n\t * @param {Function} callback\n\t * @api private\n\t */\n\t\n\texports.removeBlobs = function(data, callback) {\n\t function _removeBlobs(obj, curKey, containingObject) {\n\t if (!obj) return obj;\n\t\n\t // convert any blob\n\t if ((withNativeBlob && obj instanceof Blob) ||\n\t (withNativeFile && obj instanceof File)) {\n\t pendingBlobs++;\n\t\n\t // async filereader\n\t var fileReader = new FileReader();\n\t fileReader.onload = function() { // this.result == arraybuffer\n\t if (containingObject) {\n\t containingObject[curKey] = this.result;\n\t }\n\t else {\n\t bloblessData = this.result;\n\t }\n\t\n\t // if nothing pending its callback time\n\t if(! --pendingBlobs) {\n\t callback(bloblessData);\n\t }\n\t };\n\t\n\t fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n\t } else if (isArray(obj)) { // handle array\n\t for (var i = 0; i < obj.length; i++) {\n\t _removeBlobs(obj[i], i, obj);\n\t }\n\t } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n\t for (var key in obj) {\n\t _removeBlobs(obj[key], key, obj);\n\t }\n\t }\n\t }\n\t\n\t var pendingBlobs = 0;\n\t var bloblessData = data;\n\t _removeBlobs(bloblessData);\n\t if (!pendingBlobs) {\n\t callback(bloblessData);\n\t }\n\t};\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports) {\n\n\tvar toString = {}.toString;\n\t\n\tmodule.exports = Array.isArray || function (arr) {\n\t return toString.call(arr) == '[object Array]';\n\t};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports) {\n\n\t\n\tmodule.exports = isBuf;\n\t\n\tvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\n\tvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\t\n\tvar isView = function (obj) {\n\t return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n\t};\n\t\n\t/**\n\t * Returns true if obj is a buffer or an arraybuffer.\n\t *\n\t * @api private\n\t */\n\t\n\tfunction isBuf(obj) {\n\t return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n\t (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n\t}\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar eio = __webpack_require__(16);\n\tvar Socket = __webpack_require__(39);\n\tvar Emitter = __webpack_require__(11);\n\tvar parser = __webpack_require__(7);\n\tvar on = __webpack_require__(41);\n\tvar bind = __webpack_require__(42);\n\tvar debug = __webpack_require__(3)('socket.io-client:manager');\n\tvar indexOf = __webpack_require__(38);\n\tvar Backoff = __webpack_require__(43);\n\t\n\t/**\n\t * IE6+ hasOwnProperty\n\t */\n\t\n\tvar has = Object.prototype.hasOwnProperty;\n\t\n\t/**\n\t * Module exports\n\t */\n\t\n\tmodule.exports = Manager;\n\t\n\t/**\n\t * `Manager` constructor.\n\t *\n\t * @param {String} engine instance or engine uri/opts\n\t * @param {Object} options\n\t * @api public\n\t */\n\t\n\tfunction Manager (uri, opts) {\n\t if (!(this instanceof Manager)) return new Manager(uri, opts);\n\t if (uri && ('object' === typeof uri)) {\n\t opts = uri;\n\t uri = undefined;\n\t }\n\t opts = opts || {};\n\t\n\t opts.path = opts.path || '/socket.io';\n\t this.nsps = {};\n\t this.subs = [];\n\t this.opts = opts;\n\t this.reconnection(opts.reconnection !== false);\n\t this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n\t this.reconnectionDelay(opts.reconnectionDelay || 1000);\n\t this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n\t this.randomizationFactor(opts.randomizationFactor || 0.5);\n\t this.backoff = new Backoff({\n\t min: this.reconnectionDelay(),\n\t max: this.reconnectionDelayMax(),\n\t jitter: this.randomizationFactor()\n\t });\n\t this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n\t this.readyState = 'closed';\n\t this.uri = uri;\n\t this.connecting = [];\n\t this.lastPing = null;\n\t this.encoding = false;\n\t this.packetBuffer = [];\n\t var _parser = opts.parser || parser;\n\t this.encoder = new _parser.Encoder();\n\t this.decoder = new _parser.Decoder();\n\t this.autoConnect = opts.autoConnect !== false;\n\t if (this.autoConnect) this.open();\n\t}\n\t\n\t/**\n\t * Propagate given event to sockets and emit on `this`\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.emitAll = function () {\n\t this.emit.apply(this, arguments);\n\t for (var nsp in this.nsps) {\n\t if (has.call(this.nsps, nsp)) {\n\t this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Update `socket.id` of all sockets\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.updateSocketIds = function () {\n\t for (var nsp in this.nsps) {\n\t if (has.call(this.nsps, nsp)) {\n\t this.nsps[nsp].id = this.generateId(nsp);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * generate `socket.id` for the given `nsp`\n\t *\n\t * @param {String} nsp\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tManager.prototype.generateId = function (nsp) {\n\t return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;\n\t};\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Manager.prototype);\n\t\n\t/**\n\t * Sets the `reconnection` config.\n\t *\n\t * @param {Boolean} true/false if it should automatically reconnect\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnection = function (v) {\n\t if (!arguments.length) return this._reconnection;\n\t this._reconnection = !!v;\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the reconnection attempts config.\n\t *\n\t * @param {Number} max reconnection attempts before giving up\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnectionAttempts = function (v) {\n\t if (!arguments.length) return this._reconnectionAttempts;\n\t this._reconnectionAttempts = v;\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the delay between reconnections.\n\t *\n\t * @param {Number} delay\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnectionDelay = function (v) {\n\t if (!arguments.length) return this._reconnectionDelay;\n\t this._reconnectionDelay = v;\n\t this.backoff && this.backoff.setMin(v);\n\t return this;\n\t};\n\t\n\tManager.prototype.randomizationFactor = function (v) {\n\t if (!arguments.length) return this._randomizationFactor;\n\t this._randomizationFactor = v;\n\t this.backoff && this.backoff.setJitter(v);\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the maximum delay between reconnections.\n\t *\n\t * @param {Number} delay\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnectionDelayMax = function (v) {\n\t if (!arguments.length) return this._reconnectionDelayMax;\n\t this._reconnectionDelayMax = v;\n\t this.backoff && this.backoff.setMax(v);\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the connection timeout. `false` to disable\n\t *\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.timeout = function (v) {\n\t if (!arguments.length) return this._timeout;\n\t this._timeout = v;\n\t return this;\n\t};\n\t\n\t/**\n\t * Starts trying to reconnect if reconnection is enabled and we have not\n\t * started reconnecting yet\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.maybeReconnectOnOpen = function () {\n\t // Only try to reconnect if it's the first time we're connecting\n\t if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n\t // keeps reconnection from firing twice for the same reconnection loop\n\t this.reconnect();\n\t }\n\t};\n\t\n\t/**\n\t * Sets the current transport `socket`.\n\t *\n\t * @param {Function} optional, callback\n\t * @return {Manager} self\n\t * @api public\n\t */\n\t\n\tManager.prototype.open =\n\tManager.prototype.connect = function (fn, opts) {\n\t debug('readyState %s', this.readyState);\n\t if (~this.readyState.indexOf('open')) return this;\n\t\n\t debug('opening %s', this.uri);\n\t this.engine = eio(this.uri, this.opts);\n\t var socket = this.engine;\n\t var self = this;\n\t this.readyState = 'opening';\n\t this.skipReconnect = false;\n\t\n\t // emit `open`\n\t var openSub = on(socket, 'open', function () {\n\t self.onopen();\n\t fn && fn();\n\t });\n\t\n\t // emit `connect_error`\n\t var errorSub = on(socket, 'error', function (data) {\n\t debug('connect_error');\n\t self.cleanup();\n\t self.readyState = 'closed';\n\t self.emitAll('connect_error', data);\n\t if (fn) {\n\t var err = new Error('Connection error');\n\t err.data = data;\n\t fn(err);\n\t } else {\n\t // Only do this if there is no fn to handle the error\n\t self.maybeReconnectOnOpen();\n\t }\n\t });\n\t\n\t // emit `connect_timeout`\n\t if (false !== this._timeout) {\n\t var timeout = this._timeout;\n\t debug('connect attempt will timeout after %d', timeout);\n\t\n\t // set timer\n\t var timer = setTimeout(function () {\n\t debug('connect attempt timed out after %d', timeout);\n\t openSub.destroy();\n\t socket.close();\n\t socket.emit('error', 'timeout');\n\t self.emitAll('connect_timeout', timeout);\n\t }, timeout);\n\t\n\t this.subs.push({\n\t destroy: function () {\n\t clearTimeout(timer);\n\t }\n\t });\n\t }\n\t\n\t this.subs.push(openSub);\n\t this.subs.push(errorSub);\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Called upon transport open.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onopen = function () {\n\t debug('open');\n\t\n\t // clear old subs\n\t this.cleanup();\n\t\n\t // mark as open\n\t this.readyState = 'open';\n\t this.emit('open');\n\t\n\t // add new subs\n\t var socket = this.engine;\n\t this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n\t this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n\t this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n\t this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n\t this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n\t this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n\t};\n\t\n\t/**\n\t * Called upon a ping.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onping = function () {\n\t this.lastPing = new Date();\n\t this.emitAll('ping');\n\t};\n\t\n\t/**\n\t * Called upon a packet.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onpong = function () {\n\t this.emitAll('pong', new Date() - this.lastPing);\n\t};\n\t\n\t/**\n\t * Called with data.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.ondata = function (data) {\n\t this.decoder.add(data);\n\t};\n\t\n\t/**\n\t * Called when parser fully decodes a packet.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.ondecoded = function (packet) {\n\t this.emit('packet', packet);\n\t};\n\t\n\t/**\n\t * Called upon socket error.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onerror = function (err) {\n\t debug('error', err);\n\t this.emitAll('error', err);\n\t};\n\t\n\t/**\n\t * Creates a new socket for the given `nsp`.\n\t *\n\t * @return {Socket}\n\t * @api public\n\t */\n\t\n\tManager.prototype.socket = function (nsp, opts) {\n\t var socket = this.nsps[nsp];\n\t if (!socket) {\n\t socket = new Socket(this, nsp, opts);\n\t this.nsps[nsp] = socket;\n\t var self = this;\n\t socket.on('connecting', onConnecting);\n\t socket.on('connect', function () {\n\t socket.id = self.generateId(nsp);\n\t });\n\t\n\t if (this.autoConnect) {\n\t // manually call here since connecting event is fired before listening\n\t onConnecting();\n\t }\n\t }\n\t\n\t function onConnecting () {\n\t if (!~indexOf(self.connecting, socket)) {\n\t self.connecting.push(socket);\n\t }\n\t }\n\t\n\t return socket;\n\t};\n\t\n\t/**\n\t * Called upon a socket close.\n\t *\n\t * @param {Socket} socket\n\t */\n\t\n\tManager.prototype.destroy = function (socket) {\n\t var index = indexOf(this.connecting, socket);\n\t if (~index) this.connecting.splice(index, 1);\n\t if (this.connecting.length) return;\n\t\n\t this.close();\n\t};\n\t\n\t/**\n\t * Writes a packet.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tManager.prototype.packet = function (packet) {\n\t debug('writing packet %j', packet);\n\t var self = this;\n\t if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\t\n\t if (!self.encoding) {\n\t // encode, then write to engine with result\n\t self.encoding = true;\n\t this.encoder.encode(packet, function (encodedPackets) {\n\t for (var i = 0; i < encodedPackets.length; i++) {\n\t self.engine.write(encodedPackets[i], packet.options);\n\t }\n\t self.encoding = false;\n\t self.processPacketQueue();\n\t });\n\t } else { // add packet to the queue\n\t self.packetBuffer.push(packet);\n\t }\n\t};\n\t\n\t/**\n\t * If packet buffer is non-empty, begins encoding the\n\t * next packet in line.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.processPacketQueue = function () {\n\t if (this.packetBuffer.length > 0 && !this.encoding) {\n\t var pack = this.packetBuffer.shift();\n\t this.packet(pack);\n\t }\n\t};\n\t\n\t/**\n\t * Clean up transport subscriptions and packet buffer.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.cleanup = function () {\n\t debug('cleanup');\n\t\n\t var subsLength = this.subs.length;\n\t for (var i = 0; i < subsLength; i++) {\n\t var sub = this.subs.shift();\n\t sub.destroy();\n\t }\n\t\n\t this.packetBuffer = [];\n\t this.encoding = false;\n\t this.lastPing = null;\n\t\n\t this.decoder.destroy();\n\t};\n\t\n\t/**\n\t * Close the current socket.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.close =\n\tManager.prototype.disconnect = function () {\n\t debug('disconnect');\n\t this.skipReconnect = true;\n\t this.reconnecting = false;\n\t if ('opening' === this.readyState) {\n\t // `onclose` will not fire because\n\t // an open event never happened\n\t this.cleanup();\n\t }\n\t this.backoff.reset();\n\t this.readyState = 'closed';\n\t if (this.engine) this.engine.close();\n\t};\n\t\n\t/**\n\t * Called upon engine close.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onclose = function (reason) {\n\t debug('onclose');\n\t\n\t this.cleanup();\n\t this.backoff.reset();\n\t this.readyState = 'closed';\n\t this.emit('close', reason);\n\t\n\t if (this._reconnection && !this.skipReconnect) {\n\t this.reconnect();\n\t }\n\t};\n\t\n\t/**\n\t * Attempt a reconnection.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.reconnect = function () {\n\t if (this.reconnecting || this.skipReconnect) return this;\n\t\n\t var self = this;\n\t\n\t if (this.backoff.attempts >= this._reconnectionAttempts) {\n\t debug('reconnect failed');\n\t this.backoff.reset();\n\t this.emitAll('reconnect_failed');\n\t this.reconnecting = false;\n\t } else {\n\t var delay = this.backoff.duration();\n\t debug('will wait %dms before reconnect attempt', delay);\n\t\n\t this.reconnecting = true;\n\t var timer = setTimeout(function () {\n\t if (self.skipReconnect) return;\n\t\n\t debug('attempting reconnect');\n\t self.emitAll('reconnect_attempt', self.backoff.attempts);\n\t self.emitAll('reconnecting', self.backoff.attempts);\n\t\n\t // check again for the case socket closed in above events\n\t if (self.skipReconnect) return;\n\t\n\t self.open(function (err) {\n\t if (err) {\n\t debug('reconnect attempt error');\n\t self.reconnecting = false;\n\t self.reconnect();\n\t self.emitAll('reconnect_error', err.data);\n\t } else {\n\t debug('reconnect success');\n\t self.onreconnect();\n\t }\n\t });\n\t }, delay);\n\t\n\t this.subs.push({\n\t destroy: function () {\n\t clearTimeout(timer);\n\t }\n\t });\n\t }\n\t};\n\t\n\t/**\n\t * Called upon successful reconnect.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onreconnect = function () {\n\t var attempt = this.backoff.attempts;\n\t this.reconnecting = false;\n\t this.backoff.reset();\n\t this.updateSocketIds();\n\t this.emitAll('reconnect', attempt);\n\t};\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\tmodule.exports = __webpack_require__(17);\n\t\n\t/**\n\t * Exports parser\n\t *\n\t * @api public\n\t *\n\t */\n\tmodule.exports.parser = __webpack_require__(24);\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar transports = __webpack_require__(18);\n\tvar Emitter = __webpack_require__(11);\n\tvar debug = __webpack_require__(3)('engine.io-client:socket');\n\tvar index = __webpack_require__(38);\n\tvar parser = __webpack_require__(24);\n\tvar parseuri = __webpack_require__(2);\n\tvar parseqs = __webpack_require__(32);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = Socket;\n\t\n\t/**\n\t * Socket constructor.\n\t *\n\t * @param {String|Object} uri or options\n\t * @param {Object} options\n\t * @api public\n\t */\n\t\n\tfunction Socket (uri, opts) {\n\t if (!(this instanceof Socket)) return new Socket(uri, opts);\n\t\n\t opts = opts || {};\n\t\n\t if (uri && 'object' === typeof uri) {\n\t opts = uri;\n\t uri = null;\n\t }\n\t\n\t if (uri) {\n\t uri = parseuri(uri);\n\t opts.hostname = uri.host;\n\t opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n\t opts.port = uri.port;\n\t if (uri.query) opts.query = uri.query;\n\t } else if (opts.host) {\n\t opts.hostname = parseuri(opts.host).host;\n\t }\n\t\n\t this.secure = null != opts.secure ? opts.secure\n\t : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\t\n\t if (opts.hostname && !opts.port) {\n\t // if no port is specified manually, use the protocol default\n\t opts.port = this.secure ? '443' : '80';\n\t }\n\t\n\t this.agent = opts.agent || false;\n\t this.hostname = opts.hostname ||\n\t (typeof location !== 'undefined' ? location.hostname : 'localhost');\n\t this.port = opts.port || (typeof location !== 'undefined' && location.port\n\t ? location.port\n\t : (this.secure ? 443 : 80));\n\t this.query = opts.query || {};\n\t if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n\t this.upgrade = false !== opts.upgrade;\n\t this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n\t this.forceJSONP = !!opts.forceJSONP;\n\t this.jsonp = false !== opts.jsonp;\n\t this.forceBase64 = !!opts.forceBase64;\n\t this.enablesXDR = !!opts.enablesXDR;\n\t this.withCredentials = false !== opts.withCredentials;\n\t this.timestampParam = opts.timestampParam || 't';\n\t this.timestampRequests = opts.timestampRequests;\n\t this.transports = opts.transports || ['polling', 'websocket'];\n\t this.transportOptions = opts.transportOptions || {};\n\t this.readyState = '';\n\t this.writeBuffer = [];\n\t this.prevBufferLen = 0;\n\t this.policyPort = opts.policyPort || 843;\n\t this.rememberUpgrade = opts.rememberUpgrade || false;\n\t this.binaryType = null;\n\t this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n\t this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\t\n\t if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n\t if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n\t this.perMessageDeflate.threshold = 1024;\n\t }\n\t\n\t // SSL options for Node.js client\n\t this.pfx = opts.pfx || null;\n\t this.key = opts.key || null;\n\t this.passphrase = opts.passphrase || null;\n\t this.cert = opts.cert || null;\n\t this.ca = opts.ca || null;\n\t this.ciphers = opts.ciphers || null;\n\t this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n\t this.forceNode = !!opts.forceNode;\n\t\n\t // detect ReactNative environment\n\t this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\t\n\t // other options for Node.js or ReactNative client\n\t if (typeof self === 'undefined' || this.isReactNative) {\n\t if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n\t this.extraHeaders = opts.extraHeaders;\n\t }\n\t\n\t if (opts.localAddress) {\n\t this.localAddress = opts.localAddress;\n\t }\n\t }\n\t\n\t // set on handshake\n\t this.id = null;\n\t this.upgrades = null;\n\t this.pingInterval = null;\n\t this.pingTimeout = null;\n\t\n\t // set on heartbeat\n\t this.pingIntervalTimer = null;\n\t this.pingTimeoutTimer = null;\n\t\n\t this.open();\n\t}\n\t\n\tSocket.priorWebsocketSuccess = false;\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Socket.prototype);\n\t\n\t/**\n\t * Protocol version.\n\t *\n\t * @api public\n\t */\n\t\n\tSocket.protocol = parser.protocol; // this is an int\n\t\n\t/**\n\t * Expose deps for legacy compatibility\n\t * and standalone browser access.\n\t */\n\t\n\tSocket.Socket = Socket;\n\tSocket.Transport = __webpack_require__(23);\n\tSocket.transports = __webpack_require__(18);\n\tSocket.parser = __webpack_require__(24);\n\t\n\t/**\n\t * Creates transport of the given type.\n\t *\n\t * @param {String} transport name\n\t * @return {Transport}\n\t * @api private\n\t */\n\t\n\tSocket.prototype.createTransport = function (name) {\n\t debug('creating transport \"%s\"', name);\n\t var query = clone(this.query);\n\t\n\t // append engine.io protocol identifier\n\t query.EIO = parser.protocol;\n\t\n\t // transport name\n\t query.transport = name;\n\t\n\t // per-transport options\n\t var options = this.transportOptions[name] || {};\n\t\n\t // session id if we already have one\n\t if (this.id) query.sid = this.id;\n\t\n\t var transport = new transports[name]({\n\t query: query,\n\t socket: this,\n\t agent: options.agent || this.agent,\n\t hostname: options.hostname || this.hostname,\n\t port: options.port || this.port,\n\t secure: options.secure || this.secure,\n\t path: options.path || this.path,\n\t forceJSONP: options.forceJSONP || this.forceJSONP,\n\t jsonp: options.jsonp || this.jsonp,\n\t forceBase64: options.forceBase64 || this.forceBase64,\n\t enablesXDR: options.enablesXDR || this.enablesXDR,\n\t withCredentials: options.withCredentials || this.withCredentials,\n\t timestampRequests: options.timestampRequests || this.timestampRequests,\n\t timestampParam: options.timestampParam || this.timestampParam,\n\t policyPort: options.policyPort || this.policyPort,\n\t pfx: options.pfx || this.pfx,\n\t key: options.key || this.key,\n\t passphrase: options.passphrase || this.passphrase,\n\t cert: options.cert || this.cert,\n\t ca: options.ca || this.ca,\n\t ciphers: options.ciphers || this.ciphers,\n\t rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n\t perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n\t extraHeaders: options.extraHeaders || this.extraHeaders,\n\t forceNode: options.forceNode || this.forceNode,\n\t localAddress: options.localAddress || this.localAddress,\n\t requestTimeout: options.requestTimeout || this.requestTimeout,\n\t protocols: options.protocols || void (0),\n\t isReactNative: this.isReactNative\n\t });\n\t\n\t return transport;\n\t};\n\t\n\tfunction clone (obj) {\n\t var o = {};\n\t for (var i in obj) {\n\t if (obj.hasOwnProperty(i)) {\n\t o[i] = obj[i];\n\t }\n\t }\n\t return o;\n\t}\n\t\n\t/**\n\t * Initializes transport to use and starts probe.\n\t *\n\t * @api private\n\t */\n\tSocket.prototype.open = function () {\n\t var transport;\n\t if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n\t transport = 'websocket';\n\t } else if (0 === this.transports.length) {\n\t // Emit error on next tick so it can be listened to\n\t var self = this;\n\t setTimeout(function () {\n\t self.emit('error', 'No transports available');\n\t }, 0);\n\t return;\n\t } else {\n\t transport = this.transports[0];\n\t }\n\t this.readyState = 'opening';\n\t\n\t // Retry with the next transport if the transport is disabled (jsonp: false)\n\t try {\n\t transport = this.createTransport(transport);\n\t } catch (e) {\n\t this.transports.shift();\n\t this.open();\n\t return;\n\t }\n\t\n\t transport.open();\n\t this.setTransport(transport);\n\t};\n\t\n\t/**\n\t * Sets the current transport. Disables the existing one (if any).\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.setTransport = function (transport) {\n\t debug('setting transport %s', transport.name);\n\t var self = this;\n\t\n\t if (this.transport) {\n\t debug('clearing existing transport %s', this.transport.name);\n\t this.transport.removeAllListeners();\n\t }\n\t\n\t // set up transport\n\t this.transport = transport;\n\t\n\t // set up transport listeners\n\t transport\n\t .on('drain', function () {\n\t self.onDrain();\n\t })\n\t .on('packet', function (packet) {\n\t self.onPacket(packet);\n\t })\n\t .on('error', function (e) {\n\t self.onError(e);\n\t })\n\t .on('close', function () {\n\t self.onClose('transport close');\n\t });\n\t};\n\t\n\t/**\n\t * Probes a transport.\n\t *\n\t * @param {String} transport name\n\t * @api private\n\t */\n\t\n\tSocket.prototype.probe = function (name) {\n\t debug('probing transport \"%s\"', name);\n\t var transport = this.createTransport(name, { probe: 1 });\n\t var failed = false;\n\t var self = this;\n\t\n\t Socket.priorWebsocketSuccess = false;\n\t\n\t function onTransportOpen () {\n\t if (self.onlyBinaryUpgrades) {\n\t var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n\t failed = failed || upgradeLosesBinary;\n\t }\n\t if (failed) return;\n\t\n\t debug('probe transport \"%s\" opened', name);\n\t transport.send([{ type: 'ping', data: 'probe' }]);\n\t transport.once('packet', function (msg) {\n\t if (failed) return;\n\t if ('pong' === msg.type && 'probe' === msg.data) {\n\t debug('probe transport \"%s\" pong', name);\n\t self.upgrading = true;\n\t self.emit('upgrading', transport);\n\t if (!transport) return;\n\t Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\t\n\t debug('pausing current transport \"%s\"', self.transport.name);\n\t self.transport.pause(function () {\n\t if (failed) return;\n\t if ('closed' === self.readyState) return;\n\t debug('changing transport and sending upgrade packet');\n\t\n\t cleanup();\n\t\n\t self.setTransport(transport);\n\t transport.send([{ type: 'upgrade' }]);\n\t self.emit('upgrade', transport);\n\t transport = null;\n\t self.upgrading = false;\n\t self.flush();\n\t });\n\t } else {\n\t debug('probe transport \"%s\" failed', name);\n\t var err = new Error('probe error');\n\t err.transport = transport.name;\n\t self.emit('upgradeError', err);\n\t }\n\t });\n\t }\n\t\n\t function freezeTransport () {\n\t if (failed) return;\n\t\n\t // Any callback called by transport should be ignored since now\n\t failed = true;\n\t\n\t cleanup();\n\t\n\t transport.close();\n\t transport = null;\n\t }\n\t\n\t // Handle any error that happens while probing\n\t function onerror (err) {\n\t var error = new Error('probe error: ' + err);\n\t error.transport = transport.name;\n\t\n\t freezeTransport();\n\t\n\t debug('probe transport \"%s\" failed because of error: %s', name, err);\n\t\n\t self.emit('upgradeError', error);\n\t }\n\t\n\t function onTransportClose () {\n\t onerror('transport closed');\n\t }\n\t\n\t // When the socket is closed while we're probing\n\t function onclose () {\n\t onerror('socket closed');\n\t }\n\t\n\t // When the socket is upgraded while we're probing\n\t function onupgrade (to) {\n\t if (transport && to.name !== transport.name) {\n\t debug('\"%s\" works - aborting \"%s\"', to.name, transport.name);\n\t freezeTransport();\n\t }\n\t }\n\t\n\t // Remove all listeners on the transport and on self\n\t function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }\n\t\n\t transport.once('open', onTransportOpen);\n\t transport.once('error', onerror);\n\t transport.once('close', onTransportClose);\n\t\n\t this.once('close', onclose);\n\t this.once('upgrading', onupgrade);\n\t\n\t transport.open();\n\t};\n\t\n\t/**\n\t * Called when connection is deemed open.\n\t *\n\t * @api public\n\t */\n\t\n\tSocket.prototype.onOpen = function () {\n\t debug('socket open');\n\t this.readyState = 'open';\n\t Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n\t this.emit('open');\n\t this.flush();\n\t\n\t // we check for `readyState` in case an `open`\n\t // listener already closed the socket\n\t if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n\t debug('starting upgrade probes');\n\t for (var i = 0, l = this.upgrades.length; i < l; i++) {\n\t this.probe(this.upgrades[i]);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Handles a packet.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onPacket = function (packet) {\n\t if ('opening' === this.readyState || 'open' === this.readyState ||\n\t 'closing' === this.readyState) {\n\t debug('socket receive: type \"%s\", data \"%s\"', packet.type, packet.data);\n\t\n\t this.emit('packet', packet);\n\t\n\t // Socket is live - any packet counts\n\t this.emit('heartbeat');\n\t\n\t switch (packet.type) {\n\t case 'open':\n\t this.onHandshake(JSON.parse(packet.data));\n\t break;\n\t\n\t case 'pong':\n\t this.setPing();\n\t this.emit('pong');\n\t break;\n\t\n\t case 'error':\n\t var err = new Error('server error');\n\t err.code = packet.data;\n\t this.onError(err);\n\t break;\n\t\n\t case 'message':\n\t this.emit('data', packet.data);\n\t this.emit('message', packet.data);\n\t break;\n\t }\n\t } else {\n\t debug('packet received with socket readyState \"%s\"', this.readyState);\n\t }\n\t};\n\t\n\t/**\n\t * Called upon handshake completion.\n\t *\n\t * @param {Object} handshake obj\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onHandshake = function (data) {\n\t this.emit('handshake', data);\n\t this.id = data.sid;\n\t this.transport.query.sid = data.sid;\n\t this.upgrades = this.filterUpgrades(data.upgrades);\n\t this.pingInterval = data.pingInterval;\n\t this.pingTimeout = data.pingTimeout;\n\t this.onOpen();\n\t // In case open handler closes socket\n\t if ('closed' === this.readyState) return;\n\t this.setPing();\n\t\n\t // Prolong liveness of socket on heartbeat\n\t this.removeListener('heartbeat', this.onHeartbeat);\n\t this.on('heartbeat', this.onHeartbeat);\n\t};\n\t\n\t/**\n\t * Resets ping timeout.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onHeartbeat = function (timeout) {\n\t clearTimeout(this.pingTimeoutTimer);\n\t var self = this;\n\t self.pingTimeoutTimer = setTimeout(function () {\n\t if ('closed' === self.readyState) return;\n\t self.onClose('ping timeout');\n\t }, timeout || (self.pingInterval + self.pingTimeout));\n\t};\n\t\n\t/**\n\t * Pings server every `this.pingInterval` and expects response\n\t * within `this.pingTimeout` or closes connection.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.setPing = function () {\n\t var self = this;\n\t clearTimeout(self.pingIntervalTimer);\n\t self.pingIntervalTimer = setTimeout(function () {\n\t debug('writing ping packet - expecting pong within %sms', self.pingTimeout);\n\t self.ping();\n\t self.onHeartbeat(self.pingTimeout);\n\t }, self.pingInterval);\n\t};\n\t\n\t/**\n\t* Sends a ping packet.\n\t*\n\t* @api private\n\t*/\n\t\n\tSocket.prototype.ping = function () {\n\t var self = this;\n\t this.sendPacket('ping', function () {\n\t self.emit('ping');\n\t });\n\t};\n\t\n\t/**\n\t * Called on `drain` event\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onDrain = function () {\n\t this.writeBuffer.splice(0, this.prevBufferLen);\n\t\n\t // setting prevBufferLen = 0 is very important\n\t // for example, when upgrading, upgrade packet is sent over,\n\t // and a nonzero prevBufferLen could cause problems on `drain`\n\t this.prevBufferLen = 0;\n\t\n\t if (0 === this.writeBuffer.length) {\n\t this.emit('drain');\n\t } else {\n\t this.flush();\n\t }\n\t};\n\t\n\t/**\n\t * Flush write buffers.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.flush = function () {\n\t if ('closed' !== this.readyState && this.transport.writable &&\n\t !this.upgrading && this.writeBuffer.length) {\n\t debug('flushing %d packets in socket', this.writeBuffer.length);\n\t this.transport.send(this.writeBuffer);\n\t // keep track of current length of writeBuffer\n\t // splice writeBuffer and callbackBuffer on `drain`\n\t this.prevBufferLen = this.writeBuffer.length;\n\t this.emit('flush');\n\t }\n\t};\n\t\n\t/**\n\t * Sends a message.\n\t *\n\t * @param {String} message.\n\t * @param {Function} callback function.\n\t * @param {Object} options.\n\t * @return {Socket} for chaining.\n\t * @api public\n\t */\n\t\n\tSocket.prototype.write =\n\tSocket.prototype.send = function (msg, options, fn) {\n\t this.sendPacket('message', msg, options, fn);\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends a packet.\n\t *\n\t * @param {String} packet type.\n\t * @param {String} data.\n\t * @param {Object} options.\n\t * @param {Function} callback function.\n\t * @api private\n\t */\n\t\n\tSocket.prototype.sendPacket = function (type, data, options, fn) {\n\t if ('function' === typeof data) {\n\t fn = data;\n\t data = undefined;\n\t }\n\t\n\t if ('function' === typeof options) {\n\t fn = options;\n\t options = null;\n\t }\n\t\n\t if ('closing' === this.readyState || 'closed' === this.readyState) {\n\t return;\n\t }\n\t\n\t options = options || {};\n\t options.compress = false !== options.compress;\n\t\n\t var packet = {\n\t type: type,\n\t data: data,\n\t options: options\n\t };\n\t this.emit('packetCreate', packet);\n\t this.writeBuffer.push(packet);\n\t if (fn) this.once('flush', fn);\n\t this.flush();\n\t};\n\t\n\t/**\n\t * Closes the connection.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.close = function () {\n\t if ('opening' === this.readyState || 'open' === this.readyState) {\n\t this.readyState = 'closing';\n\t\n\t var self = this;\n\t\n\t if (this.writeBuffer.length) {\n\t this.once('drain', function () {\n\t if (this.upgrading) {\n\t waitForUpgrade();\n\t } else {\n\t close();\n\t }\n\t });\n\t } else if (this.upgrading) {\n\t waitForUpgrade();\n\t } else {\n\t close();\n\t }\n\t }\n\t\n\t function close () {\n\t self.onClose('forced close');\n\t debug('socket closing - telling transport to close');\n\t self.transport.close();\n\t }\n\t\n\t function cleanupAndClose () {\n\t self.removeListener('upgrade', cleanupAndClose);\n\t self.removeListener('upgradeError', cleanupAndClose);\n\t close();\n\t }\n\t\n\t function waitForUpgrade () {\n\t // wait for upgrade to finish since we can't send packets while pausing a transport\n\t self.once('upgrade', cleanupAndClose);\n\t self.once('upgradeError', cleanupAndClose);\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Called upon transport error\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onError = function (err) {\n\t debug('socket error %j', err);\n\t Socket.priorWebsocketSuccess = false;\n\t this.emit('error', err);\n\t this.onClose('transport error', err);\n\t};\n\t\n\t/**\n\t * Called upon transport close.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onClose = function (reason, desc) {\n\t if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n\t debug('socket close with reason: \"%s\"', reason);\n\t var self = this;\n\t\n\t // clear timers\n\t clearTimeout(this.pingIntervalTimer);\n\t clearTimeout(this.pingTimeoutTimer);\n\t\n\t // stop event from firing again for transport\n\t this.transport.removeAllListeners('close');\n\t\n\t // ensure transport won't stay open\n\t this.transport.close();\n\t\n\t // ignore further transport communication\n\t this.transport.removeAllListeners();\n\t\n\t // set ready state\n\t this.readyState = 'closed';\n\t\n\t // clear session id\n\t this.id = null;\n\t\n\t // emit close event\n\t this.emit('close', reason, desc);\n\t\n\t // clean buffers after, so users can still\n\t // grab the buffers on `close` event\n\t self.writeBuffer = [];\n\t self.prevBufferLen = 0;\n\t }\n\t};\n\t\n\t/**\n\t * Filters upgrades, returning only those matching client transports.\n\t *\n\t * @param {Array} server upgrades\n\t * @api private\n\t *\n\t */\n\t\n\tSocket.prototype.filterUpgrades = function (upgrades) {\n\t var filteredUpgrades = [];\n\t for (var i = 0, j = upgrades.length; i < j; i++) {\n\t if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n\t }\n\t return filteredUpgrades;\n\t};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies\n\t */\n\t\n\tvar XMLHttpRequest = __webpack_require__(19);\n\tvar XHR = __webpack_require__(21);\n\tvar JSONP = __webpack_require__(35);\n\tvar websocket = __webpack_require__(36);\n\t\n\t/**\n\t * Export transports.\n\t */\n\t\n\texports.polling = polling;\n\texports.websocket = websocket;\n\t\n\t/**\n\t * Polling transport polymorphic constructor.\n\t * Decides on xhr vs jsonp based on feature detection.\n\t *\n\t * @api private\n\t */\n\t\n\tfunction polling (opts) {\n\t var xhr;\n\t var xd = false;\n\t var xs = false;\n\t var jsonp = false !== opts.jsonp;\n\t\n\t if (typeof location !== 'undefined') {\n\t var isSSL = 'https:' === location.protocol;\n\t var port = location.port;\n\t\n\t // some user agents have empty `location.port`\n\t if (!port) {\n\t port = isSSL ? 443 : 80;\n\t }\n\t\n\t xd = opts.hostname !== location.hostname || port !== opts.port;\n\t xs = opts.secure !== isSSL;\n\t }\n\t\n\t opts.xdomain = xd;\n\t opts.xscheme = xs;\n\t xhr = new XMLHttpRequest(opts);\n\t\n\t if ('open' in xhr && !opts.forceJSONP) {\n\t return new XHR(opts);\n\t } else {\n\t if (!jsonp) throw new Error('JSONP disabled');\n\t return new JSONP(opts);\n\t }\n\t}\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t// browser shim for xmlhttprequest module\n\t\n\tvar hasCORS = __webpack_require__(20);\n\t\n\tmodule.exports = function (opts) {\n\t var xdomain = opts.xdomain;\n\t\n\t // scheme must be same when usign XDomainRequest\n\t // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n\t var xscheme = opts.xscheme;\n\t\n\t // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n\t // https://github.com/Automattic/engine.io-client/pull/217\n\t var enablesXDR = opts.enablesXDR;\n\t\n\t // XMLHttpRequest can be disabled on IE\n\t try {\n\t if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n\t return new XMLHttpRequest();\n\t }\n\t } catch (e) { }\n\t\n\t // Use XDomainRequest for IE8 if enablesXDR is true\n\t // because loading bar keeps flashing when using jsonp-polling\n\t // https://github.com/yujiosaka/socke.io-ie8-loading-example\n\t try {\n\t if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n\t return new XDomainRequest();\n\t }\n\t } catch (e) { }\n\t\n\t if (!xdomain) {\n\t try {\n\t return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n\t } catch (e) { }\n\t }\n\t};\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Module exports.\n\t *\n\t * Logic borrowed from Modernizr:\n\t *\n\t * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n\t */\n\t\n\ttry {\n\t module.exports = typeof XMLHttpRequest !== 'undefined' &&\n\t 'withCredentials' in new XMLHttpRequest();\n\t} catch (err) {\n\t // if XMLHttp support is disabled in IE then it will throw\n\t // when trying to create\n\t module.exports = false;\n\t}\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* global attachEvent */\n\t\n\t/**\n\t * Module requirements.\n\t */\n\t\n\tvar XMLHttpRequest = __webpack_require__(19);\n\tvar Polling = __webpack_require__(22);\n\tvar Emitter = __webpack_require__(11);\n\tvar inherit = __webpack_require__(33);\n\tvar debug = __webpack_require__(3)('engine.io-client:polling-xhr');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = XHR;\n\tmodule.exports.Request = Request;\n\t\n\t/**\n\t * Empty function\n\t */\n\t\n\tfunction empty () {}\n\t\n\t/**\n\t * XHR Polling constructor.\n\t *\n\t * @param {Object} opts\n\t * @api public\n\t */\n\t\n\tfunction XHR (opts) {\n\t Polling.call(this, opts);\n\t this.requestTimeout = opts.requestTimeout;\n\t this.extraHeaders = opts.extraHeaders;\n\t\n\t if (typeof location !== 'undefined') {\n\t var isSSL = 'https:' === location.protocol;\n\t var port = location.port;\n\t\n\t // some user agents have empty `location.port`\n\t if (!port) {\n\t port = isSSL ? 443 : 80;\n\t }\n\t\n\t this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n\t port !== opts.port;\n\t this.xs = opts.secure !== isSSL;\n\t }\n\t}\n\t\n\t/**\n\t * Inherits from Polling.\n\t */\n\t\n\tinherit(XHR, Polling);\n\t\n\t/**\n\t * XHR supports binary\n\t */\n\t\n\tXHR.prototype.supportsBinary = true;\n\t\n\t/**\n\t * Creates a request.\n\t *\n\t * @param {String} method\n\t * @api private\n\t */\n\t\n\tXHR.prototype.request = function (opts) {\n\t opts = opts || {};\n\t opts.uri = this.uri();\n\t opts.xd = this.xd;\n\t opts.xs = this.xs;\n\t opts.agent = this.agent || false;\n\t opts.supportsBinary = this.supportsBinary;\n\t opts.enablesXDR = this.enablesXDR;\n\t opts.withCredentials = this.withCredentials;\n\t\n\t // SSL options for Node.js client\n\t opts.pfx = this.pfx;\n\t opts.key = this.key;\n\t opts.passphrase = this.passphrase;\n\t opts.cert = this.cert;\n\t opts.ca = this.ca;\n\t opts.ciphers = this.ciphers;\n\t opts.rejectUnauthorized = this.rejectUnauthorized;\n\t opts.requestTimeout = this.requestTimeout;\n\t\n\t // other options for Node.js client\n\t opts.extraHeaders = this.extraHeaders;\n\t\n\t return new Request(opts);\n\t};\n\t\n\t/**\n\t * Sends data.\n\t *\n\t * @param {String} data to send.\n\t * @param {Function} called upon flush.\n\t * @api private\n\t */\n\t\n\tXHR.prototype.doWrite = function (data, fn) {\n\t var isBinary = typeof data !== 'string' && data !== undefined;\n\t var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n\t var self = this;\n\t req.on('success', fn);\n\t req.on('error', function (err) {\n\t self.onError('xhr post error', err);\n\t });\n\t this.sendXhr = req;\n\t};\n\t\n\t/**\n\t * Starts a poll cycle.\n\t *\n\t * @api private\n\t */\n\t\n\tXHR.prototype.doPoll = function () {\n\t debug('xhr poll');\n\t var req = this.request();\n\t var self = this;\n\t req.on('data', function (data) {\n\t self.onData(data);\n\t });\n\t req.on('error', function (err) {\n\t self.onError('xhr poll error', err);\n\t });\n\t this.pollXhr = req;\n\t};\n\t\n\t/**\n\t * Request constructor\n\t *\n\t * @param {Object} options\n\t * @api public\n\t */\n\t\n\tfunction Request (opts) {\n\t this.method = opts.method || 'GET';\n\t this.uri = opts.uri;\n\t this.xd = !!opts.xd;\n\t this.xs = !!opts.xs;\n\t this.async = false !== opts.async;\n\t this.data = undefined !== opts.data ? opts.data : null;\n\t this.agent = opts.agent;\n\t this.isBinary = opts.isBinary;\n\t this.supportsBinary = opts.supportsBinary;\n\t this.enablesXDR = opts.enablesXDR;\n\t this.withCredentials = opts.withCredentials;\n\t this.requestTimeout = opts.requestTimeout;\n\t\n\t // SSL options for Node.js client\n\t this.pfx = opts.pfx;\n\t this.key = opts.key;\n\t this.passphrase = opts.passphrase;\n\t this.cert = opts.cert;\n\t this.ca = opts.ca;\n\t this.ciphers = opts.ciphers;\n\t this.rejectUnauthorized = opts.rejectUnauthorized;\n\t\n\t // other options for Node.js client\n\t this.extraHeaders = opts.extraHeaders;\n\t\n\t this.create();\n\t}\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Request.prototype);\n\t\n\t/**\n\t * Creates the XHR object and sends the request.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.create = function () {\n\t var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\t\n\t // SSL options for Node.js client\n\t opts.pfx = this.pfx;\n\t opts.key = this.key;\n\t opts.passphrase = this.passphrase;\n\t opts.cert = this.cert;\n\t opts.ca = this.ca;\n\t opts.ciphers = this.ciphers;\n\t opts.rejectUnauthorized = this.rejectUnauthorized;\n\t\n\t var xhr = this.xhr = new XMLHttpRequest(opts);\n\t var self = this;\n\t\n\t try {\n\t debug('xhr open %s: %s', this.method, this.uri);\n\t xhr.open(this.method, this.uri, this.async);\n\t try {\n\t if (this.extraHeaders) {\n\t xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n\t for (var i in this.extraHeaders) {\n\t if (this.extraHeaders.hasOwnProperty(i)) {\n\t xhr.setRequestHeader(i, this.extraHeaders[i]);\n\t }\n\t }\n\t }\n\t } catch (e) {}\n\t\n\t if ('POST' === this.method) {\n\t try {\n\t if (this.isBinary) {\n\t xhr.setRequestHeader('Content-type', 'application/octet-stream');\n\t } else {\n\t xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n\t }\n\t } catch (e) {}\n\t }\n\t\n\t try {\n\t xhr.setRequestHeader('Accept', '*/*');\n\t } catch (e) {}\n\t\n\t // ie6 check\n\t if ('withCredentials' in xhr) {\n\t xhr.withCredentials = this.withCredentials;\n\t }\n\t\n\t if (this.requestTimeout) {\n\t xhr.timeout = this.requestTimeout;\n\t }\n\t\n\t if (this.hasXDR()) {\n\t xhr.onload = function () {\n\t self.onLoad();\n\t };\n\t xhr.onerror = function () {\n\t self.onError(xhr.responseText);\n\t };\n\t } else {\n\t xhr.onreadystatechange = function () {\n\t if (xhr.readyState === 2) {\n\t try {\n\t var contentType = xhr.getResponseHeader('Content-Type');\n\t if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n\t xhr.responseType = 'arraybuffer';\n\t }\n\t } catch (e) {}\n\t }\n\t if (4 !== xhr.readyState) return;\n\t if (200 === xhr.status || 1223 === xhr.status) {\n\t self.onLoad();\n\t } else {\n\t // make sure the `error` event handler that's user-set\n\t // does not throw in the same tick and gets caught here\n\t setTimeout(function () {\n\t self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n\t }, 0);\n\t }\n\t };\n\t }\n\t\n\t debug('xhr data %s', this.data);\n\t xhr.send(this.data);\n\t } catch (e) {\n\t // Need to defer since .create() is called directly fhrom the constructor\n\t // and thus the 'error' event can only be only bound *after* this exception\n\t // occurs. Therefore, also, we cannot throw here at all.\n\t setTimeout(function () {\n\t self.onError(e);\n\t }, 0);\n\t return;\n\t }\n\t\n\t if (typeof document !== 'undefined') {\n\t this.index = Request.requestsCount++;\n\t Request.requests[this.index] = this;\n\t }\n\t};\n\t\n\t/**\n\t * Called upon successful response.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onSuccess = function () {\n\t this.emit('success');\n\t this.cleanup();\n\t};\n\t\n\t/**\n\t * Called if we have data.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onData = function (data) {\n\t this.emit('data', data);\n\t this.onSuccess();\n\t};\n\t\n\t/**\n\t * Called upon error.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onError = function (err) {\n\t this.emit('error', err);\n\t this.cleanup(true);\n\t};\n\t\n\t/**\n\t * Cleans up house.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.cleanup = function (fromError) {\n\t if ('undefined' === typeof this.xhr || null === this.xhr) {\n\t return;\n\t }\n\t // xmlhttprequest\n\t if (this.hasXDR()) {\n\t this.xhr.onload = this.xhr.onerror = empty;\n\t } else {\n\t this.xhr.onreadystatechange = empty;\n\t }\n\t\n\t if (fromError) {\n\t try {\n\t this.xhr.abort();\n\t } catch (e) {}\n\t }\n\t\n\t if (typeof document !== 'undefined') {\n\t delete Request.requests[this.index];\n\t }\n\t\n\t this.xhr = null;\n\t};\n\t\n\t/**\n\t * Called upon load.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onLoad = function () {\n\t var data;\n\t try {\n\t var contentType;\n\t try {\n\t contentType = this.xhr.getResponseHeader('Content-Type');\n\t } catch (e) {}\n\t if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n\t data = this.xhr.response || this.xhr.responseText;\n\t } else {\n\t data = this.xhr.responseText;\n\t }\n\t } catch (e) {\n\t this.onError(e);\n\t }\n\t if (null != data) {\n\t this.onData(data);\n\t }\n\t};\n\t\n\t/**\n\t * Check if it has XDomainRequest.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.hasXDR = function () {\n\t return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n\t};\n\t\n\t/**\n\t * Aborts the request.\n\t *\n\t * @api public\n\t */\n\t\n\tRequest.prototype.abort = function () {\n\t this.cleanup();\n\t};\n\t\n\t/**\n\t * Aborts pending requests when unloading the window. This is needed to prevent\n\t * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n\t * emitted.\n\t */\n\t\n\tRequest.requestsCount = 0;\n\tRequest.requests = {};\n\t\n\tif (typeof document !== 'undefined') {\n\t if (typeof attachEvent === 'function') {\n\t attachEvent('onunload', unloadHandler);\n\t } else if (typeof addEventListener === 'function') {\n\t var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';\n\t addEventListener(terminationEvent, unloadHandler, false);\n\t }\n\t}\n\t\n\tfunction unloadHandler () {\n\t for (var i in Request.requests) {\n\t if (Request.requests.hasOwnProperty(i)) {\n\t Request.requests[i].abort();\n\t }\n\t }\n\t}\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Transport = __webpack_require__(23);\n\tvar parseqs = __webpack_require__(32);\n\tvar parser = __webpack_require__(24);\n\tvar inherit = __webpack_require__(33);\n\tvar yeast = __webpack_require__(34);\n\tvar debug = __webpack_require__(3)('engine.io-client:polling');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = Polling;\n\t\n\t/**\n\t * Is XHR2 supported?\n\t */\n\t\n\tvar hasXHR2 = (function () {\n\t var XMLHttpRequest = __webpack_require__(19);\n\t var xhr = new XMLHttpRequest({ xdomain: false });\n\t return null != xhr.responseType;\n\t})();\n\t\n\t/**\n\t * Polling interface.\n\t *\n\t * @param {Object} opts\n\t * @api private\n\t */\n\t\n\tfunction Polling (opts) {\n\t var forceBase64 = (opts && opts.forceBase64);\n\t if (!hasXHR2 || forceBase64) {\n\t this.supportsBinary = false;\n\t }\n\t Transport.call(this, opts);\n\t}\n\t\n\t/**\n\t * Inherits from Transport.\n\t */\n\t\n\tinherit(Polling, Transport);\n\t\n\t/**\n\t * Transport name.\n\t */\n\t\n\tPolling.prototype.name = 'polling';\n\t\n\t/**\n\t * Opens the socket (triggers polling). We write a PING message to determine\n\t * when the transport is open.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.doOpen = function () {\n\t this.poll();\n\t};\n\t\n\t/**\n\t * Pauses polling.\n\t *\n\t * @param {Function} callback upon buffers are flushed and transport is paused\n\t * @api private\n\t */\n\t\n\tPolling.prototype.pause = function (onPause) {\n\t var self = this;\n\t\n\t this.readyState = 'pausing';\n\t\n\t function pause () {\n\t debug('paused');\n\t self.readyState = 'paused';\n\t onPause();\n\t }\n\t\n\t if (this.polling || !this.writable) {\n\t var total = 0;\n\t\n\t if (this.polling) {\n\t debug('we are currently polling - waiting to pause');\n\t total++;\n\t this.once('pollComplete', function () {\n\t debug('pre-pause polling complete');\n\t --total || pause();\n\t });\n\t }\n\t\n\t if (!this.writable) {\n\t debug('we are currently writing - waiting to pause');\n\t total++;\n\t this.once('drain', function () {\n\t debug('pre-pause writing complete');\n\t --total || pause();\n\t });\n\t }\n\t } else {\n\t pause();\n\t }\n\t};\n\t\n\t/**\n\t * Starts polling cycle.\n\t *\n\t * @api public\n\t */\n\t\n\tPolling.prototype.poll = function () {\n\t debug('polling');\n\t this.polling = true;\n\t this.doPoll();\n\t this.emit('poll');\n\t};\n\t\n\t/**\n\t * Overloads onData to detect payloads.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.onData = function (data) {\n\t var self = this;\n\t debug('polling got data %s', data);\n\t var callback = function (packet, index, total) {\n\t // if its the first message we consider the transport open\n\t if ('opening' === self.readyState) {\n\t self.onOpen();\n\t }\n\t\n\t // if its a close packet, we close the ongoing requests\n\t if ('close' === packet.type) {\n\t self.onClose();\n\t return false;\n\t }\n\t\n\t // otherwise bypass onData and handle the message\n\t self.onPacket(packet);\n\t };\n\t\n\t // decode payload\n\t parser.decodePayload(data, this.socket.binaryType, callback);\n\t\n\t // if an event did not trigger closing\n\t if ('closed' !== this.readyState) {\n\t // if we got data we're not polling\n\t this.polling = false;\n\t this.emit('pollComplete');\n\t\n\t if ('open' === this.readyState) {\n\t this.poll();\n\t } else {\n\t debug('ignoring poll - transport state \"%s\"', this.readyState);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * For polling, send a close packet.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.doClose = function () {\n\t var self = this;\n\t\n\t function close () {\n\t debug('writing close packet');\n\t self.write([{ type: 'close' }]);\n\t }\n\t\n\t if ('open' === this.readyState) {\n\t debug('transport open - closing');\n\t close();\n\t } else {\n\t // in case we're trying to close while\n\t // handshaking is in progress (GH-164)\n\t debug('transport not open - deferring close');\n\t this.once('open', close);\n\t }\n\t};\n\t\n\t/**\n\t * Writes a packets payload.\n\t *\n\t * @param {Array} data packets\n\t * @param {Function} drain callback\n\t * @api private\n\t */\n\t\n\tPolling.prototype.write = function (packets) {\n\t var self = this;\n\t this.writable = false;\n\t var callbackfn = function () {\n\t self.writable = true;\n\t self.emit('drain');\n\t };\n\t\n\t parser.encodePayload(packets, this.supportsBinary, function (data) {\n\t self.doWrite(data, callbackfn);\n\t });\n\t};\n\t\n\t/**\n\t * Generates uri for connection.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.uri = function () {\n\t var query = this.query || {};\n\t var schema = this.secure ? 'https' : 'http';\n\t var port = '';\n\t\n\t // cache busting is forced\n\t if (false !== this.timestampRequests) {\n\t query[this.timestampParam] = yeast();\n\t }\n\t\n\t if (!this.supportsBinary && !query.sid) {\n\t query.b64 = 1;\n\t }\n\t\n\t query = parseqs.encode(query);\n\t\n\t // avoid port if default for schema\n\t if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n\t ('http' === schema && Number(this.port) !== 80))) {\n\t port = ':' + this.port;\n\t }\n\t\n\t // prepend ? to query\n\t if (query.length) {\n\t query = '?' + query;\n\t }\n\t\n\t var ipv6 = this.hostname.indexOf(':') !== -1;\n\t return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n\t};\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar parser = __webpack_require__(24);\n\tvar Emitter = __webpack_require__(11);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = Transport;\n\t\n\t/**\n\t * Transport abstract constructor.\n\t *\n\t * @param {Object} options.\n\t * @api private\n\t */\n\t\n\tfunction Transport (opts) {\n\t this.path = opts.path;\n\t this.hostname = opts.hostname;\n\t this.port = opts.port;\n\t this.secure = opts.secure;\n\t this.query = opts.query;\n\t this.timestampParam = opts.timestampParam;\n\t this.timestampRequests = opts.timestampRequests;\n\t this.readyState = '';\n\t this.agent = opts.agent || false;\n\t this.socket = opts.socket;\n\t this.enablesXDR = opts.enablesXDR;\n\t this.withCredentials = opts.withCredentials;\n\t\n\t // SSL options for Node.js client\n\t this.pfx = opts.pfx;\n\t this.key = opts.key;\n\t this.passphrase = opts.passphrase;\n\t this.cert = opts.cert;\n\t this.ca = opts.ca;\n\t this.ciphers = opts.ciphers;\n\t this.rejectUnauthorized = opts.rejectUnauthorized;\n\t this.forceNode = opts.forceNode;\n\t\n\t // results of ReactNative environment detection\n\t this.isReactNative = opts.isReactNative;\n\t\n\t // other options for Node.js client\n\t this.extraHeaders = opts.extraHeaders;\n\t this.localAddress = opts.localAddress;\n\t}\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Transport.prototype);\n\t\n\t/**\n\t * Emits an error.\n\t *\n\t * @param {String} str\n\t * @return {Transport} for chaining\n\t * @api public\n\t */\n\t\n\tTransport.prototype.onError = function (msg, desc) {\n\t var err = new Error(msg);\n\t err.type = 'TransportError';\n\t err.description = desc;\n\t this.emit('error', err);\n\t return this;\n\t};\n\t\n\t/**\n\t * Opens the transport.\n\t *\n\t * @api public\n\t */\n\t\n\tTransport.prototype.open = function () {\n\t if ('closed' === this.readyState || '' === this.readyState) {\n\t this.readyState = 'opening';\n\t this.doOpen();\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Closes the transport.\n\t *\n\t * @api private\n\t */\n\t\n\tTransport.prototype.close = function () {\n\t if ('opening' === this.readyState || 'open' === this.readyState) {\n\t this.doClose();\n\t this.onClose();\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends multiple packets.\n\t *\n\t * @param {Array} packets\n\t * @api private\n\t */\n\t\n\tTransport.prototype.send = function (packets) {\n\t if ('open' === this.readyState) {\n\t this.write(packets);\n\t } else {\n\t throw new Error('Transport not open');\n\t }\n\t};\n\t\n\t/**\n\t * Called upon open\n\t *\n\t * @api private\n\t */\n\t\n\tTransport.prototype.onOpen = function () {\n\t this.readyState = 'open';\n\t this.writable = true;\n\t this.emit('open');\n\t};\n\t\n\t/**\n\t * Called with data.\n\t *\n\t * @param {String} data\n\t * @api private\n\t */\n\t\n\tTransport.prototype.onData = function (data) {\n\t var packet = parser.decodePacket(data, this.socket.binaryType);\n\t this.onPacket(packet);\n\t};\n\t\n\t/**\n\t * Called with a decoded packet.\n\t */\n\t\n\tTransport.prototype.onPacket = function (packet) {\n\t this.emit('packet', packet);\n\t};\n\t\n\t/**\n\t * Called upon close.\n\t *\n\t * @api private\n\t */\n\t\n\tTransport.prototype.onClose = function () {\n\t this.readyState = 'closed';\n\t this.emit('close');\n\t};\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar keys = __webpack_require__(25);\n\tvar hasBinary = __webpack_require__(26);\n\tvar sliceBuffer = __webpack_require__(27);\n\tvar after = __webpack_require__(28);\n\tvar utf8 = __webpack_require__(29);\n\t\n\tvar base64encoder;\n\tif (typeof ArrayBuffer !== 'undefined') {\n\t base64encoder = __webpack_require__(30);\n\t}\n\t\n\t/**\n\t * Check if we are running an android browser. That requires us to use\n\t * ArrayBuffer with polling transports...\n\t *\n\t * http://ghinda.net/jpeg-blob-ajax-android/\n\t */\n\t\n\tvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\t\n\t/**\n\t * Check if we are running in PhantomJS.\n\t * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n\t * https://github.com/ariya/phantomjs/issues/11395\n\t * @type boolean\n\t */\n\tvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\t\n\t/**\n\t * When true, avoids using Blobs to encode payloads.\n\t * @type boolean\n\t */\n\tvar dontSendBlobs = isAndroid || isPhantomJS;\n\t\n\t/**\n\t * Current protocol version.\n\t */\n\t\n\texports.protocol = 3;\n\t\n\t/**\n\t * Packet types.\n\t */\n\t\n\tvar packets = exports.packets = {\n\t open: 0 // non-ws\n\t , close: 1 // non-ws\n\t , ping: 2\n\t , pong: 3\n\t , message: 4\n\t , upgrade: 5\n\t , noop: 6\n\t};\n\t\n\tvar packetslist = keys(packets);\n\t\n\t/**\n\t * Premade error packet.\n\t */\n\t\n\tvar err = { type: 'error', data: 'parser error' };\n\t\n\t/**\n\t * Create a blob api even for blob builder when vendor prefixes exist\n\t */\n\t\n\tvar Blob = __webpack_require__(31);\n\t\n\t/**\n\t * Encodes a packet.\n\t *\n\t * <packet type id> [ <data> ]\n\t *\n\t * Example:\n\t *\n\t * 5hello world\n\t * 3\n\t * 4\n\t *\n\t * Binary is encoded in an identical principle\n\t *\n\t * @api private\n\t */\n\t\n\texports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n\t if (typeof supportsBinary === 'function') {\n\t callback = supportsBinary;\n\t supportsBinary = false;\n\t }\n\t\n\t if (typeof utf8encode === 'function') {\n\t callback = utf8encode;\n\t utf8encode = null;\n\t }\n\t\n\t var data = (packet.data === undefined)\n\t ? undefined\n\t : packet.data.buffer || packet.data;\n\t\n\t if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n\t return encodeArrayBuffer(packet, supportsBinary, callback);\n\t } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n\t return encodeBlob(packet, supportsBinary, callback);\n\t }\n\t\n\t // might be an object with { base64: true, data: dataAsBase64String }\n\t if (data && data.base64) {\n\t return encodeBase64Object(packet, callback);\n\t }\n\t\n\t // Sending data as a utf-8 string\n\t var encoded = packets[packet.type];\n\t\n\t // data fragment is optional\n\t if (undefined !== packet.data) {\n\t encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n\t }\n\t\n\t return callback('' + encoded);\n\t\n\t};\n\t\n\tfunction encodeBase64Object(packet, callback) {\n\t // packet data is an object { base64: true, data: dataAsBase64String }\n\t var message = 'b' + exports.packets[packet.type] + packet.data.data;\n\t return callback(message);\n\t}\n\t\n\t/**\n\t * Encode packet helpers for binary types\n\t */\n\t\n\tfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n\t if (!supportsBinary) {\n\t return exports.encodeBase64Packet(packet, callback);\n\t }\n\t\n\t var data = packet.data;\n\t var contentArray = new Uint8Array(data);\n\t var resultBuffer = new Uint8Array(1 + data.byteLength);\n\t\n\t resultBuffer[0] = packets[packet.type];\n\t for (var i = 0; i < contentArray.length; i++) {\n\t resultBuffer[i+1] = contentArray[i];\n\t }\n\t\n\t return callback(resultBuffer.buffer);\n\t}\n\t\n\tfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n\t if (!supportsBinary) {\n\t return exports.encodeBase64Packet(packet, callback);\n\t }\n\t\n\t var fr = new FileReader();\n\t fr.onload = function() {\n\t exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n\t };\n\t return fr.readAsArrayBuffer(packet.data);\n\t}\n\t\n\tfunction encodeBlob(packet, supportsBinary, callback) {\n\t if (!supportsBinary) {\n\t return exports.encodeBase64Packet(packet, callback);\n\t }\n\t\n\t if (dontSendBlobs) {\n\t return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n\t }\n\t\n\t var length = new Uint8Array(1);\n\t length[0] = packets[packet.type];\n\t var blob = new Blob([length.buffer, packet.data]);\n\t\n\t return callback(blob);\n\t}\n\t\n\t/**\n\t * Encodes a packet with binary data in a base64 string\n\t *\n\t * @param {Object} packet, has `type` and `data`\n\t * @return {String} base64 encoded message\n\t */\n\t\n\texports.encodeBase64Packet = function(packet, callback) {\n\t var message = 'b' + exports.packets[packet.type];\n\t if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n\t var fr = new FileReader();\n\t fr.onload = function() {\n\t var b64 = fr.result.split(',')[1];\n\t callback(message + b64);\n\t };\n\t return fr.readAsDataURL(packet.data);\n\t }\n\t\n\t var b64data;\n\t try {\n\t b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n\t } catch (e) {\n\t // iPhone Safari doesn't let you apply with typed arrays\n\t var typed = new Uint8Array(packet.data);\n\t var basic = new Array(typed.length);\n\t for (var i = 0; i < typed.length; i++) {\n\t basic[i] = typed[i];\n\t }\n\t b64data = String.fromCharCode.apply(null, basic);\n\t }\n\t message += btoa(b64data);\n\t return callback(message);\n\t};\n\t\n\t/**\n\t * Decodes a packet. Changes format to Blob if requested.\n\t *\n\t * @return {Object} with `type` and `data` (if any)\n\t * @api private\n\t */\n\t\n\texports.decodePacket = function (data, binaryType, utf8decode) {\n\t if (data === undefined) {\n\t return err;\n\t }\n\t // String data\n\t if (typeof data === 'string') {\n\t if (data.charAt(0) === 'b') {\n\t return exports.decodeBase64Packet(data.substr(1), binaryType);\n\t }\n\t\n\t if (utf8decode) {\n\t data = tryDecode(data);\n\t if (data === false) {\n\t return err;\n\t }\n\t }\n\t var type = data.charAt(0);\n\t\n\t if (Number(type) != type || !packetslist[type]) {\n\t return err;\n\t }\n\t\n\t if (data.length > 1) {\n\t return { type: packetslist[type], data: data.substring(1) };\n\t } else {\n\t return { type: packetslist[type] };\n\t }\n\t }\n\t\n\t var asArray = new Uint8Array(data);\n\t var type = asArray[0];\n\t var rest = sliceBuffer(data, 1);\n\t if (Blob && binaryType === 'blob') {\n\t rest = new Blob([rest]);\n\t }\n\t return { type: packetslist[type], data: rest };\n\t};\n\t\n\tfunction tryDecode(data) {\n\t try {\n\t data = utf8.decode(data, { strict: false });\n\t } catch (e) {\n\t return false;\n\t }\n\t return data;\n\t}\n\t\n\t/**\n\t * Decodes a packet encoded in a base64 string\n\t *\n\t * @param {String} base64 encoded message\n\t * @return {Object} with `type` and `data` (if any)\n\t */\n\t\n\texports.decodeBase64Packet = function(msg, binaryType) {\n\t var type = packetslist[msg.charAt(0)];\n\t if (!base64encoder) {\n\t return { type: type, data: { base64: true, data: msg.substr(1) } };\n\t }\n\t\n\t var data = base64encoder.decode(msg.substr(1));\n\t\n\t if (binaryType === 'blob' && Blob) {\n\t data = new Blob([data]);\n\t }\n\t\n\t return { type: type, data: data };\n\t};\n\t\n\t/**\n\t * Encodes multiple messages (payload).\n\t *\n\t * <length>:data\n\t *\n\t * Example:\n\t *\n\t * 11:hello world2:hi\n\t *\n\t * If any contents are binary, they will be encoded as base64 strings. Base64\n\t * encoded strings are marked with a b before the length specifier\n\t *\n\t * @param {Array} packets\n\t * @api private\n\t */\n\t\n\texports.encodePayload = function (packets, supportsBinary, callback) {\n\t if (typeof supportsBinary === 'function') {\n\t callback = supportsBinary;\n\t supportsBinary = null;\n\t }\n\t\n\t var isBinary = hasBinary(packets);\n\t\n\t if (supportsBinary && isBinary) {\n\t if (Blob && !dontSendBlobs) {\n\t return exports.encodePayloadAsBlob(packets, callback);\n\t }\n\t\n\t return exports.encodePayloadAsArrayBuffer(packets, callback);\n\t }\n\t\n\t if (!packets.length) {\n\t return callback('0:');\n\t }\n\t\n\t function setLengthHeader(message) {\n\t return message.length + ':' + message;\n\t }\n\t\n\t function encodeOne(packet, doneCallback) {\n\t exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n\t doneCallback(null, setLengthHeader(message));\n\t });\n\t }\n\t\n\t map(packets, encodeOne, function(err, results) {\n\t return callback(results.join(''));\n\t });\n\t};\n\t\n\t/**\n\t * Async array map using after\n\t */\n\t\n\tfunction map(ary, each, done) {\n\t var result = new Array(ary.length);\n\t var next = after(ary.length, done);\n\t\n\t var eachWithIndex = function(i, el, cb) {\n\t each(el, function(error, msg) {\n\t result[i] = msg;\n\t cb(error, result);\n\t });\n\t };\n\t\n\t for (var i = 0; i < ary.length; i++) {\n\t eachWithIndex(i, ary[i], next);\n\t }\n\t}\n\t\n\t/*\n\t * Decodes data when a payload is maybe expected. Possible binary contents are\n\t * decoded from their base64 representation\n\t *\n\t * @param {String} data, callback method\n\t * @api public\n\t */\n\t\n\texports.decodePayload = function (data, binaryType, callback) {\n\t if (typeof data !== 'string') {\n\t return exports.decodePayloadAsBinary(data, binaryType, callback);\n\t }\n\t\n\t if (typeof binaryType === 'function') {\n\t callback = binaryType;\n\t binaryType = null;\n\t }\n\t\n\t var packet;\n\t if (data === '') {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t var length = '', n, msg;\n\t\n\t for (var i = 0, l = data.length; i < l; i++) {\n\t var chr = data.charAt(i);\n\t\n\t if (chr !== ':') {\n\t length += chr;\n\t continue;\n\t }\n\t\n\t if (length === '' || (length != (n = Number(length)))) {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t msg = data.substr(i + 1, n);\n\t\n\t if (length != msg.length) {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t if (msg.length) {\n\t packet = exports.decodePacket(msg, binaryType, false);\n\t\n\t if (err.type === packet.type && err.data === packet.data) {\n\t // parser error in individual packet - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t var ret = callback(packet, i + n, l);\n\t if (false === ret) return;\n\t }\n\t\n\t // advance cursor\n\t i += n;\n\t length = '';\n\t }\n\t\n\t if (length !== '') {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t};\n\t\n\t/**\n\t * Encodes multiple messages (payload) as binary.\n\t *\n\t * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n\t * 255><data>\n\t *\n\t * Example:\n\t * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n\t *\n\t * @param {Array} packets\n\t * @return {ArrayBuffer} encoded payload\n\t * @api private\n\t */\n\t\n\texports.encodePayloadAsArrayBuffer = function(packets, callback) {\n\t if (!packets.length) {\n\t return callback(new ArrayBuffer(0));\n\t }\n\t\n\t function encodeOne(packet, doneCallback) {\n\t exports.encodePacket(packet, true, true, function(data) {\n\t return doneCallback(null, data);\n\t });\n\t }\n\t\n\t map(packets, encodeOne, function(err, encodedPackets) {\n\t var totalLength = encodedPackets.reduce(function(acc, p) {\n\t var len;\n\t if (typeof p === 'string'){\n\t len = p.length;\n\t } else {\n\t len = p.byteLength;\n\t }\n\t return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n\t }, 0);\n\t\n\t var resultArray = new Uint8Array(totalLength);\n\t\n\t var bufferIndex = 0;\n\t encodedPackets.forEach(function(p) {\n\t var isString = typeof p === 'string';\n\t var ab = p;\n\t if (isString) {\n\t var view = new Uint8Array(p.length);\n\t for (var i = 0; i < p.length; i++) {\n\t view[i] = p.charCodeAt(i);\n\t }\n\t ab = view.buffer;\n\t }\n\t\n\t if (isString) { // not true binary\n\t resultArray[bufferIndex++] = 0;\n\t } else { // true binary\n\t resultArray[bufferIndex++] = 1;\n\t }\n\t\n\t var lenStr = ab.byteLength.toString();\n\t for (var i = 0; i < lenStr.length; i++) {\n\t resultArray[bufferIndex++] = parseInt(lenStr[i]);\n\t }\n\t resultArray[bufferIndex++] = 255;\n\t\n\t var view = new Uint8Array(ab);\n\t for (var i = 0; i < view.length; i++) {\n\t resultArray[bufferIndex++] = view[i];\n\t }\n\t });\n\t\n\t return callback(resultArray.buffer);\n\t });\n\t};\n\t\n\t/**\n\t * Encode as Blob\n\t */\n\t\n\texports.encodePayloadAsBlob = function(packets, callback) {\n\t function encodeOne(packet, doneCallback) {\n\t exports.encodePacket(packet, true, true, function(encoded) {\n\t var binaryIdentifier = new Uint8Array(1);\n\t binaryIdentifier[0] = 1;\n\t if (typeof encoded === 'string') {\n\t var view = new Uint8Array(encoded.length);\n\t for (var i = 0; i < encoded.length; i++) {\n\t view[i] = encoded.charCodeAt(i);\n\t }\n\t encoded = view.buffer;\n\t binaryIdentifier[0] = 0;\n\t }\n\t\n\t var len = (encoded instanceof ArrayBuffer)\n\t ? encoded.byteLength\n\t : encoded.size;\n\t\n\t var lenStr = len.toString();\n\t var lengthAry = new Uint8Array(lenStr.length + 1);\n\t for (var i = 0; i < lenStr.length; i++) {\n\t lengthAry[i] = parseInt(lenStr[i]);\n\t }\n\t lengthAry[lenStr.length] = 255;\n\t\n\t if (Blob) {\n\t var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n\t doneCallback(null, blob);\n\t }\n\t });\n\t }\n\t\n\t map(packets, encodeOne, function(err, results) {\n\t return callback(new Blob(results));\n\t });\n\t};\n\t\n\t/*\n\t * Decodes data when a payload is maybe expected. Strings are decoded by\n\t * interpreting each byte as a key code for entries marked to start with 0. See\n\t * description of encodePayloadAsBinary\n\t *\n\t * @param {ArrayBuffer} data, callback method\n\t * @api public\n\t */\n\t\n\texports.decodePayloadAsBinary = function (data, binaryType, callback) {\n\t if (typeof binaryType === 'function') {\n\t callback = binaryType;\n\t binaryType = null;\n\t }\n\t\n\t var bufferTail = data;\n\t var buffers = [];\n\t\n\t while (bufferTail.byteLength > 0) {\n\t var tailArray = new Uint8Array(bufferTail);\n\t var isString = tailArray[0] === 0;\n\t var msgLength = '';\n\t\n\t for (var i = 1; ; i++) {\n\t if (tailArray[i] === 255) break;\n\t\n\t // 310 = char length of Number.MAX_VALUE\n\t if (msgLength.length > 310) {\n\t return callback(err, 0, 1);\n\t }\n\t\n\t msgLength += tailArray[i];\n\t }\n\t\n\t bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n\t msgLength = parseInt(msgLength);\n\t\n\t var msg = sliceBuffer(bufferTail, 0, msgLength);\n\t if (isString) {\n\t try {\n\t msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n\t } catch (e) {\n\t // iPhone Safari doesn't let you apply to typed arrays\n\t var typed = new Uint8Array(msg);\n\t msg = '';\n\t for (var i = 0; i < typed.length; i++) {\n\t msg += String.fromCharCode(typed[i]);\n\t }\n\t }\n\t }\n\t\n\t buffers.push(msg);\n\t bufferTail = sliceBuffer(bufferTail, msgLength);\n\t }\n\t\n\t var total = buffers.length;\n\t buffers.forEach(function(buffer, i) {\n\t callback(exports.decodePacket(buffer, binaryType, true), i, total);\n\t });\n\t};\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Gets the keys for an object.\n\t *\n\t * @return {Array} keys\n\t * @api private\n\t */\n\t\n\tmodule.exports = Object.keys || function keys (obj){\n\t var arr = [];\n\t var has = Object.prototype.hasOwnProperty;\n\t\n\t for (var i in obj) {\n\t if (has.call(obj, i)) {\n\t arr.push(i);\n\t }\n\t }\n\t return arr;\n\t};\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* global Blob File */\n\t\n\t/*\n\t * Module requirements.\n\t */\n\t\n\tvar isArray = __webpack_require__(13);\n\t\n\tvar toString = Object.prototype.toString;\n\tvar withNativeBlob = typeof Blob === 'function' ||\n\t typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\n\tvar withNativeFile = typeof File === 'function' ||\n\t typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = hasBinary;\n\t\n\t/**\n\t * Checks for binary data.\n\t *\n\t * Supports Buffer, ArrayBuffer, Blob and File.\n\t *\n\t * @param {Object} anything\n\t * @api public\n\t */\n\t\n\tfunction hasBinary (obj) {\n\t if (!obj || typeof obj !== 'object') {\n\t return false;\n\t }\n\t\n\t if (isArray(obj)) {\n\t for (var i = 0, l = obj.length; i < l; i++) {\n\t if (hasBinary(obj[i])) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t }\n\t\n\t if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n\t (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n\t (withNativeBlob && obj instanceof Blob) ||\n\t (withNativeFile && obj instanceof File)\n\t ) {\n\t return true;\n\t }\n\t\n\t // see: https://github.com/Automattic/has-binary/pull/4\n\t if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n\t return hasBinary(obj.toJSON(), true);\n\t }\n\t\n\t for (var key in obj) {\n\t if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n\t return true;\n\t }\n\t }\n\t\n\t return false;\n\t}\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports) {\n\n\t/**\n\t * An abstraction for slicing an arraybuffer even when\n\t * ArrayBuffer.prototype.slice is not supported\n\t *\n\t * @api public\n\t */\n\t\n\tmodule.exports = function(arraybuffer, start, end) {\n\t var bytes = arraybuffer.byteLength;\n\t start = start || 0;\n\t end = end || bytes;\n\t\n\t if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\t\n\t if (start < 0) { start += bytes; }\n\t if (end < 0) { end += bytes; }\n\t if (end > bytes) { end = bytes; }\n\t\n\t if (start >= bytes || start >= end || bytes === 0) {\n\t return new ArrayBuffer(0);\n\t }\n\t\n\t var abv = new Uint8Array(arraybuffer);\n\t var result = new Uint8Array(end - start);\n\t for (var i = start, ii = 0; i < end; i++, ii++) {\n\t result[ii] = abv[i];\n\t }\n\t return result.buffer;\n\t};\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = after\n\t\n\tfunction after(count, callback, err_cb) {\n\t var bail = false\n\t err_cb = err_cb || noop\n\t proxy.count = count\n\t\n\t return (count === 0) ? callback() : proxy\n\t\n\t function proxy(err, result) {\n\t if (proxy.count <= 0) {\n\t throw new Error('after called too many times')\n\t }\n\t --proxy.count\n\t\n\t // after first error, rest are passed to err_cb\n\t if (err) {\n\t bail = true\n\t callback(err)\n\t // future error callbacks will go to error handler\n\t callback = err_cb\n\t } else if (proxy.count === 0 && !bail) {\n\t callback(null, result)\n\t }\n\t }\n\t}\n\t\n\tfunction noop() {}\n\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports) {\n\n\t/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\t\n\tvar stringFromCharCode = String.fromCharCode;\n\t\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2decode(string) {\n\t\tvar output = [];\n\t\tvar counter = 0;\n\t\tvar length = string.length;\n\t\tvar value;\n\t\tvar extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\t\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2encode(array) {\n\t\tvar length = array.length;\n\t\tvar index = -1;\n\t\tvar value;\n\t\tvar output = '';\n\t\twhile (++index < length) {\n\t\t\tvalue = array[index];\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t}\n\t\treturn output;\n\t}\n\t\n\tfunction checkScalarValue(codePoint, strict) {\n\t\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\t\tif (strict) {\n\t\t\t\tthrow Error(\n\t\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t\t' is not a scalar value'\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\t/*--------------------------------------------------------------------------*/\n\t\n\tfunction createByte(codePoint, shift) {\n\t\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n\t}\n\t\n\tfunction encodeCodePoint(codePoint, strict) {\n\t\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\t\treturn stringFromCharCode(codePoint);\n\t\t}\n\t\tvar symbol = '';\n\t\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t\t}\n\t\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\t\tcodePoint = 0xFFFD;\n\t\t\t}\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\t\tsymbol += createByte(codePoint, 12);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\t\treturn symbol;\n\t}\n\t\n\tfunction utf8encode(string, opts) {\n\t\topts = opts || {};\n\t\tvar strict = false !== opts.strict;\n\t\n\t\tvar codePoints = ucs2decode(string);\n\t\tvar length = codePoints.length;\n\t\tvar index = -1;\n\t\tvar codePoint;\n\t\tvar byteString = '';\n\t\twhile (++index < length) {\n\t\t\tcodePoint = codePoints[index];\n\t\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t\t}\n\t\treturn byteString;\n\t}\n\t\n\t/*--------------------------------------------------------------------------*/\n\t\n\tfunction readContinuationByte() {\n\t\tif (byteIndex >= byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\t\n\t\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\t\n\t\tif ((continuationByte & 0xC0) == 0x80) {\n\t\t\treturn continuationByte & 0x3F;\n\t\t}\n\t\n\t\t// If we end up here, it’s not a continuation byte\n\t\tthrow Error('Invalid continuation byte');\n\t}\n\t\n\tfunction decodeSymbol(strict) {\n\t\tvar byte1;\n\t\tvar byte2;\n\t\tvar byte3;\n\t\tvar byte4;\n\t\tvar codePoint;\n\t\n\t\tif (byteIndex > byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\t\n\t\tif (byteIndex == byteCount) {\n\t\t\treturn false;\n\t\t}\n\t\n\t\t// Read first byte\n\t\tbyte1 = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\t\n\t\t// 1-byte sequence (no continuation bytes)\n\t\tif ((byte1 & 0x80) == 0) {\n\t\t\treturn byte1;\n\t\t}\n\t\n\t\t// 2-byte sequence\n\t\tif ((byte1 & 0xE0) == 0xC0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\t\tif (codePoint >= 0x80) {\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\t\n\t\t// 3-byte sequence (may include unpaired surrogates)\n\t\tif ((byte1 & 0xF0) == 0xE0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\t\tif (codePoint >= 0x0800) {\n\t\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\t\n\t\t// 4-byte sequence\n\t\tif ((byte1 & 0xF8) == 0xF0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tbyte4 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t\t(byte3 << 0x06) | byte4;\n\t\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\t\treturn codePoint;\n\t\t\t}\n\t\t}\n\t\n\t\tthrow Error('Invalid UTF-8 detected');\n\t}\n\t\n\tvar byteArray;\n\tvar byteCount;\n\tvar byteIndex;\n\tfunction utf8decode(byteString, opts) {\n\t\topts = opts || {};\n\t\tvar strict = false !== opts.strict;\n\t\n\t\tbyteArray = ucs2decode(byteString);\n\t\tbyteCount = byteArray.length;\n\t\tbyteIndex = 0;\n\t\tvar codePoints = [];\n\t\tvar tmp;\n\t\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\t\tcodePoints.push(tmp);\n\t\t}\n\t\treturn ucs2encode(codePoints);\n\t}\n\t\n\tmodule.exports = {\n\t\tversion: '2.1.2',\n\t\tencode: utf8encode,\n\t\tdecode: utf8decode\n\t};\n\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports) {\n\n\t/*\n\t * base64-arraybuffer\n\t * https://github.com/niklasvh/base64-arraybuffer\n\t *\n\t * Copyright (c) 2012 Niklas von Hertzen\n\t * Licensed under the MIT license.\n\t */\n\t(function(){\n\t \"use strict\";\n\t\n\t var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\t\n\t // Use a lookup table to find the index.\n\t var lookup = new Uint8Array(256);\n\t for (var i = 0; i < chars.length; i++) {\n\t lookup[chars.charCodeAt(i)] = i;\n\t }\n\t\n\t exports.encode = function(arraybuffer) {\n\t var bytes = new Uint8Array(arraybuffer),\n\t i, len = bytes.length, base64 = \"\";\n\t\n\t for (i = 0; i < len; i+=3) {\n\t base64 += chars[bytes[i] >> 2];\n\t base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n\t base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n\t base64 += chars[bytes[i + 2] & 63];\n\t }\n\t\n\t if ((len % 3) === 2) {\n\t base64 = base64.substring(0, base64.length - 1) + \"=\";\n\t } else if (len % 3 === 1) {\n\t base64 = base64.substring(0, base64.length - 2) + \"==\";\n\t }\n\t\n\t return base64;\n\t };\n\t\n\t exports.decode = function(base64) {\n\t var bufferLength = base64.length * 0.75,\n\t len = base64.length, i, p = 0,\n\t encoded1, encoded2, encoded3, encoded4;\n\t\n\t if (base64[base64.length - 1] === \"=\") {\n\t bufferLength--;\n\t if (base64[base64.length - 2] === \"=\") {\n\t bufferLength--;\n\t }\n\t }\n\t\n\t var arraybuffer = new ArrayBuffer(bufferLength),\n\t bytes = new Uint8Array(arraybuffer);\n\t\n\t for (i = 0; i < len; i+=4) {\n\t encoded1 = lookup[base64.charCodeAt(i)];\n\t encoded2 = lookup[base64.charCodeAt(i+1)];\n\t encoded3 = lookup[base64.charCodeAt(i+2)];\n\t encoded4 = lookup[base64.charCodeAt(i+3)];\n\t\n\t bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n\t bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n\t bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n\t }\n\t\n\t return arraybuffer;\n\t };\n\t})();\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports) {\n\n\t/**\r\n\t * Create a blob builder even when vendor prefixes exist\r\n\t */\r\n\t\r\n\tvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n\t typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n\t typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n\t typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n\t false;\r\n\t\r\n\t/**\r\n\t * Check if Blob constructor is supported\r\n\t */\r\n\t\r\n\tvar blobSupported = (function() {\r\n\t try {\r\n\t var a = new Blob(['hi']);\r\n\t return a.size === 2;\r\n\t } catch(e) {\r\n\t return false;\r\n\t }\r\n\t})();\r\n\t\r\n\t/**\r\n\t * Check if Blob constructor supports ArrayBufferViews\r\n\t * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n\t */\r\n\t\r\n\tvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n\t try {\r\n\t var b = new Blob([new Uint8Array([1,2])]);\r\n\t return b.size === 2;\r\n\t } catch(e) {\r\n\t return false;\r\n\t }\r\n\t})();\r\n\t\r\n\t/**\r\n\t * Check if BlobBuilder is supported\r\n\t */\r\n\t\r\n\tvar blobBuilderSupported = BlobBuilder\r\n\t && BlobBuilder.prototype.append\r\n\t && BlobBuilder.prototype.getBlob;\r\n\t\r\n\t/**\r\n\t * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n\t * Used by BlobBuilder constructor and old browsers that didn't\r\n\t * support it in the Blob constructor.\r\n\t */\r\n\t\r\n\tfunction mapArrayBufferViews(ary) {\r\n\t return ary.map(function(chunk) {\r\n\t if (chunk.buffer instanceof ArrayBuffer) {\r\n\t var buf = chunk.buffer;\r\n\t\r\n\t // if this is a subarray, make a copy so we only\r\n\t // include the subarray region from the underlying buffer\r\n\t if (chunk.byteLength !== buf.byteLength) {\r\n\t var copy = new Uint8Array(chunk.byteLength);\r\n\t copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n\t buf = copy.buffer;\r\n\t }\r\n\t\r\n\t return buf;\r\n\t }\r\n\t\r\n\t return chunk;\r\n\t });\r\n\t}\r\n\t\r\n\tfunction BlobBuilderConstructor(ary, options) {\r\n\t options = options || {};\r\n\t\r\n\t var bb = new BlobBuilder();\r\n\t mapArrayBufferViews(ary).forEach(function(part) {\r\n\t bb.append(part);\r\n\t });\r\n\t\r\n\t return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n\t};\r\n\t\r\n\tfunction BlobConstructor(ary, options) {\r\n\t return new Blob(mapArrayBufferViews(ary), options || {});\r\n\t};\r\n\t\r\n\tif (typeof Blob !== 'undefined') {\r\n\t BlobBuilderConstructor.prototype = Blob.prototype;\r\n\t BlobConstructor.prototype = Blob.prototype;\r\n\t}\r\n\t\r\n\tmodule.exports = (function() {\r\n\t if (blobSupported) {\r\n\t return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n\t } else if (blobBuilderSupported) {\r\n\t return BlobBuilderConstructor;\r\n\t } else {\r\n\t return undefined;\r\n\t }\r\n\t})();\r\n\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports) {\n\n\t/**\r\n\t * Compiles a querystring\r\n\t * Returns string representation of the object\r\n\t *\r\n\t * @param {Object}\r\n\t * @api private\r\n\t */\r\n\t\r\n\texports.encode = function (obj) {\r\n\t var str = '';\r\n\t\r\n\t for (var i in obj) {\r\n\t if (obj.hasOwnProperty(i)) {\r\n\t if (str.length) str += '&';\r\n\t str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\r\n\t }\r\n\t }\r\n\t\r\n\t return str;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Parses a simple querystring into an object\r\n\t *\r\n\t * @param {String} qs\r\n\t * @api private\r\n\t */\r\n\t\r\n\texports.decode = function(qs){\r\n\t var qry = {};\r\n\t var pairs = qs.split('&');\r\n\t for (var i = 0, l = pairs.length; i < l; i++) {\r\n\t var pair = pairs[i].split('=');\r\n\t qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\r\n\t }\r\n\t return qry;\r\n\t};\r\n\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports) {\n\n\t\n\tmodule.exports = function(a, b){\n\t var fn = function(){};\n\t fn.prototype = b.prototype;\n\t a.prototype = new fn;\n\t a.prototype.constructor = a;\n\t};\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n\t , length = 64\n\t , map = {}\n\t , seed = 0\n\t , i = 0\n\t , prev;\n\t\n\t/**\n\t * Return a string representing the specified number.\n\t *\n\t * @param {Number} num The number to convert.\n\t * @returns {String} The string representation of the number.\n\t * @api public\n\t */\n\tfunction encode(num) {\n\t var encoded = '';\n\t\n\t do {\n\t encoded = alphabet[num % length] + encoded;\n\t num = Math.floor(num / length);\n\t } while (num > 0);\n\t\n\t return encoded;\n\t}\n\t\n\t/**\n\t * Return the integer value specified by the given string.\n\t *\n\t * @param {String} str The string to convert.\n\t * @returns {Number} The integer value represented by the string.\n\t * @api public\n\t */\n\tfunction decode(str) {\n\t var decoded = 0;\n\t\n\t for (i = 0; i < str.length; i++) {\n\t decoded = decoded * length + map[str.charAt(i)];\n\t }\n\t\n\t return decoded;\n\t}\n\t\n\t/**\n\t * Yeast: A tiny growing id generator.\n\t *\n\t * @returns {String} A unique id.\n\t * @api public\n\t */\n\tfunction yeast() {\n\t var now = encode(+new Date());\n\t\n\t if (now !== prev) return seed = 0, prev = now;\n\t return now +'.'+ encode(seed++);\n\t}\n\t\n\t//\n\t// Map each character to its index.\n\t//\n\tfor (; i < length; i++) map[alphabet[i]] = i;\n\t\n\t//\n\t// Expose the `yeast`, `encode` and `decode` functions.\n\t//\n\tyeast.encode = encode;\n\tyeast.decode = decode;\n\tmodule.exports = yeast;\n\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {/**\n\t * Module requirements.\n\t */\n\t\n\tvar Polling = __webpack_require__(22);\n\tvar inherit = __webpack_require__(33);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = JSONPPolling;\n\t\n\t/**\n\t * Cached regular expressions.\n\t */\n\t\n\tvar rNewline = /\\n/g;\n\tvar rEscapedNewline = /\\\\n/g;\n\t\n\t/**\n\t * Global JSONP callbacks.\n\t */\n\t\n\tvar callbacks;\n\t\n\t/**\n\t * Noop.\n\t */\n\t\n\tfunction empty () { }\n\t\n\t/**\n\t * Until https://github.com/tc39/proposal-global is shipped.\n\t */\n\tfunction glob () {\n\t return typeof self !== 'undefined' ? self\n\t : typeof window !== 'undefined' ? window\n\t : typeof global !== 'undefined' ? global : {};\n\t}\n\t\n\t/**\n\t * JSONP Polling constructor.\n\t *\n\t * @param {Object} opts.\n\t * @api public\n\t */\n\t\n\tfunction JSONPPolling (opts) {\n\t Polling.call(this, opts);\n\t\n\t this.query = this.query || {};\n\t\n\t // define global callbacks array if not present\n\t // we do this here (lazily) to avoid unneeded global pollution\n\t if (!callbacks) {\n\t // we need to consider multiple engines in the same page\n\t var global = glob();\n\t callbacks = global.___eio = (global.___eio || []);\n\t }\n\t\n\t // callback identifier\n\t this.index = callbacks.length;\n\t\n\t // add callback to jsonp global\n\t var self = this;\n\t callbacks.push(function (msg) {\n\t self.onData(msg);\n\t });\n\t\n\t // append to query string\n\t this.query.j = this.index;\n\t\n\t // prevent spurious errors from being emitted when the window is unloaded\n\t if (typeof addEventListener === 'function') {\n\t addEventListener('beforeunload', function () {\n\t if (self.script) self.script.onerror = empty;\n\t }, false);\n\t }\n\t}\n\t\n\t/**\n\t * Inherits from Polling.\n\t */\n\t\n\tinherit(JSONPPolling, Polling);\n\t\n\t/*\n\t * JSONP only supports binary as base64 encoded strings\n\t */\n\t\n\tJSONPPolling.prototype.supportsBinary = false;\n\t\n\t/**\n\t * Closes the socket.\n\t *\n\t * @api private\n\t */\n\t\n\tJSONPPolling.prototype.doClose = function () {\n\t if (this.script) {\n\t this.script.parentNode.removeChild(this.script);\n\t this.script = null;\n\t }\n\t\n\t if (this.form) {\n\t this.form.parentNode.removeChild(this.form);\n\t this.form = null;\n\t this.iframe = null;\n\t }\n\t\n\t Polling.prototype.doClose.call(this);\n\t};\n\t\n\t/**\n\t * Starts a poll cycle.\n\t *\n\t * @api private\n\t */\n\t\n\tJSONPPolling.prototype.doPoll = function () {\n\t var self = this;\n\t var script = document.createElement('script');\n\t\n\t if (this.script) {\n\t this.script.parentNode.removeChild(this.script);\n\t this.script = null;\n\t }\n\t\n\t script.async = true;\n\t script.src = this.uri();\n\t script.onerror = function (e) {\n\t self.onError('jsonp poll error', e);\n\t };\n\t\n\t var insertAt = document.getElementsByTagName('script')[0];\n\t if (insertAt) {\n\t insertAt.parentNode.insertBefore(script, insertAt);\n\t } else {\n\t (document.head || document.body).appendChild(script);\n\t }\n\t this.script = script;\n\t\n\t var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\t\n\t if (isUAgecko) {\n\t setTimeout(function () {\n\t var iframe = document.createElement('iframe');\n\t document.body.appendChild(iframe);\n\t document.body.removeChild(iframe);\n\t }, 100);\n\t }\n\t};\n\t\n\t/**\n\t * Writes with a hidden iframe.\n\t *\n\t * @param {String} data to send\n\t * @param {Function} called upon flush.\n\t * @api private\n\t */\n\t\n\tJSONPPolling.prototype.doWrite = function (data, fn) {\n\t var self = this;\n\t\n\t if (!this.form) {\n\t var form = document.createElement('form');\n\t var area = document.createElement('textarea');\n\t var id = this.iframeId = 'eio_iframe_' + this.index;\n\t var iframe;\n\t\n\t form.className = 'socketio';\n\t form.style.position = 'absolute';\n\t form.style.top = '-1000px';\n\t form.style.left = '-1000px';\n\t form.target = id;\n\t form.method = 'POST';\n\t form.setAttribute('accept-charset', 'utf-8');\n\t area.name = 'd';\n\t form.appendChild(area);\n\t document.body.appendChild(form);\n\t\n\t this.form = form;\n\t this.area = area;\n\t }\n\t\n\t this.form.action = this.uri();\n\t\n\t function complete () {\n\t initIframe();\n\t fn();\n\t }\n\t\n\t function initIframe () {\n\t if (self.iframe) {\n\t try {\n\t self.form.removeChild(self.iframe);\n\t } catch (e) {\n\t self.onError('jsonp polling iframe removal error', e);\n\t }\n\t }\n\t\n\t try {\n\t // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n\t var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n\t iframe = document.createElement(html);\n\t } catch (e) {\n\t iframe = document.createElement('iframe');\n\t iframe.name = self.iframeId;\n\t iframe.src = 'javascript:0';\n\t }\n\t\n\t iframe.id = self.iframeId;\n\t\n\t self.form.appendChild(iframe);\n\t self.iframe = iframe;\n\t }\n\t\n\t initIframe();\n\t\n\t // escape \\n to prevent it from being converted into \\r\\n by some UAs\n\t // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n\t data = data.replace(rEscapedNewline, '\\\\\\n');\n\t this.area.value = data.replace(rNewline, '\\\\n');\n\t\n\t try {\n\t this.form.submit();\n\t } catch (e) {}\n\t\n\t if (this.iframe.attachEvent) {\n\t this.iframe.onreadystatechange = function () {\n\t if (self.iframe.readyState === 'complete') {\n\t complete();\n\t }\n\t };\n\t } else {\n\t this.iframe.onload = complete;\n\t }\n\t};\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Transport = __webpack_require__(23);\n\tvar parser = __webpack_require__(24);\n\tvar parseqs = __webpack_require__(32);\n\tvar inherit = __webpack_require__(33);\n\tvar yeast = __webpack_require__(34);\n\tvar debug = __webpack_require__(3)('engine.io-client:websocket');\n\t\n\tvar BrowserWebSocket, NodeWebSocket;\n\t\n\tif (typeof WebSocket !== 'undefined') {\n\t BrowserWebSocket = WebSocket;\n\t} else if (typeof self !== 'undefined') {\n\t BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n\t}\n\t\n\tif (typeof window === 'undefined') {\n\t try {\n\t NodeWebSocket = __webpack_require__(37);\n\t } catch (e) { }\n\t}\n\t\n\t/**\n\t * Get either the `WebSocket` or `MozWebSocket` globals\n\t * in the browser or try to resolve WebSocket-compatible\n\t * interface exposed by `ws` for Node-like environment.\n\t */\n\t\n\tvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = WS;\n\t\n\t/**\n\t * WebSocket transport constructor.\n\t *\n\t * @api {Object} connection options\n\t * @api public\n\t */\n\t\n\tfunction WS (opts) {\n\t var forceBase64 = (opts && opts.forceBase64);\n\t if (forceBase64) {\n\t this.supportsBinary = false;\n\t }\n\t this.perMessageDeflate = opts.perMessageDeflate;\n\t this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n\t this.protocols = opts.protocols;\n\t if (!this.usingBrowserWebSocket) {\n\t WebSocketImpl = NodeWebSocket;\n\t }\n\t Transport.call(this, opts);\n\t}\n\t\n\t/**\n\t * Inherits from Transport.\n\t */\n\t\n\tinherit(WS, Transport);\n\t\n\t/**\n\t * Transport name.\n\t *\n\t * @api public\n\t */\n\t\n\tWS.prototype.name = 'websocket';\n\t\n\t/*\n\t * WebSockets support binary\n\t */\n\t\n\tWS.prototype.supportsBinary = true;\n\t\n\t/**\n\t * Opens socket.\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.doOpen = function () {\n\t if (!this.check()) {\n\t // let probe timeout\n\t return;\n\t }\n\t\n\t var uri = this.uri();\n\t var protocols = this.protocols;\n\t var opts = {\n\t agent: this.agent,\n\t perMessageDeflate: this.perMessageDeflate\n\t };\n\t\n\t // SSL options for Node.js client\n\t opts.pfx = this.pfx;\n\t opts.key = this.key;\n\t opts.passphrase = this.passphrase;\n\t opts.cert = this.cert;\n\t opts.ca = this.ca;\n\t opts.ciphers = this.ciphers;\n\t opts.rejectUnauthorized = this.rejectUnauthorized;\n\t if (this.extraHeaders) {\n\t opts.headers = this.extraHeaders;\n\t }\n\t if (this.localAddress) {\n\t opts.localAddress = this.localAddress;\n\t }\n\t\n\t try {\n\t this.ws =\n\t this.usingBrowserWebSocket && !this.isReactNative\n\t ? protocols\n\t ? new WebSocketImpl(uri, protocols)\n\t : new WebSocketImpl(uri)\n\t : new WebSocketImpl(uri, protocols, opts);\n\t } catch (err) {\n\t return this.emit('error', err);\n\t }\n\t\n\t if (this.ws.binaryType === undefined) {\n\t this.supportsBinary = false;\n\t }\n\t\n\t if (this.ws.supports && this.ws.supports.binary) {\n\t this.supportsBinary = true;\n\t this.ws.binaryType = 'nodebuffer';\n\t } else {\n\t this.ws.binaryType = 'arraybuffer';\n\t }\n\t\n\t this.addEventListeners();\n\t};\n\t\n\t/**\n\t * Adds event listeners to the socket\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.addEventListeners = function () {\n\t var self = this;\n\t\n\t this.ws.onopen = function () {\n\t self.onOpen();\n\t };\n\t this.ws.onclose = function () {\n\t self.onClose();\n\t };\n\t this.ws.onmessage = function (ev) {\n\t self.onData(ev.data);\n\t };\n\t this.ws.onerror = function (e) {\n\t self.onError('websocket error', e);\n\t };\n\t};\n\t\n\t/**\n\t * Writes data to socket.\n\t *\n\t * @param {Array} array of packets.\n\t * @api private\n\t */\n\t\n\tWS.prototype.write = function (packets) {\n\t var self = this;\n\t this.writable = false;\n\t\n\t // encodePacket efficient as it uses WS framing\n\t // no need for encodePayload\n\t var total = packets.length;\n\t for (var i = 0, l = total; i < l; i++) {\n\t (function (packet) {\n\t parser.encodePacket(packet, self.supportsBinary, function (data) {\n\t if (!self.usingBrowserWebSocket) {\n\t // always create a new object (GH-437)\n\t var opts = {};\n\t if (packet.options) {\n\t opts.compress = packet.options.compress;\n\t }\n\t\n\t if (self.perMessageDeflate) {\n\t var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n\t if (len < self.perMessageDeflate.threshold) {\n\t opts.compress = false;\n\t }\n\t }\n\t }\n\t\n\t // Sometimes the websocket has already been closed but the browser didn't\n\t // have a chance of informing us about it yet, in that case send will\n\t // throw an error\n\t try {\n\t if (self.usingBrowserWebSocket) {\n\t // TypeError is thrown when passing the second argument on Safari\n\t self.ws.send(data);\n\t } else {\n\t self.ws.send(data, opts);\n\t }\n\t } catch (e) {\n\t debug('websocket closed before onclose event');\n\t }\n\t\n\t --total || done();\n\t });\n\t })(packets[i]);\n\t }\n\t\n\t function done () {\n\t self.emit('flush');\n\t\n\t // fake drain\n\t // defer to next tick to allow Socket to clear writeBuffer\n\t setTimeout(function () {\n\t self.writable = true;\n\t self.emit('drain');\n\t }, 0);\n\t }\n\t};\n\t\n\t/**\n\t * Called upon close\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.onClose = function () {\n\t Transport.prototype.onClose.call(this);\n\t};\n\t\n\t/**\n\t * Closes socket.\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.doClose = function () {\n\t if (typeof this.ws !== 'undefined') {\n\t this.ws.close();\n\t }\n\t};\n\t\n\t/**\n\t * Generates uri for connection.\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.uri = function () {\n\t var query = this.query || {};\n\t var schema = this.secure ? 'wss' : 'ws';\n\t var port = '';\n\t\n\t // avoid port if default for schema\n\t if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n\t ('ws' === schema && Number(this.port) !== 80))) {\n\t port = ':' + this.port;\n\t }\n\t\n\t // append timestamp to URI\n\t if (this.timestampRequests) {\n\t query[this.timestampParam] = yeast();\n\t }\n\t\n\t // communicate binary support capabilities\n\t if (!this.supportsBinary) {\n\t query.b64 = 1;\n\t }\n\t\n\t query = parseqs.encode(query);\n\t\n\t // prepend ? to query\n\t if (query.length) {\n\t query = '?' + query;\n\t }\n\t\n\t var ipv6 = this.hostname.indexOf(':') !== -1;\n\t return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n\t};\n\t\n\t/**\n\t * Feature detection for WebSocket.\n\t *\n\t * @return {Boolean} whether this transport is available.\n\t * @api public\n\t */\n\t\n\tWS.prototype.check = function () {\n\t return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n\t};\n\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports) {\n\n\t/* (ignored) */\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports) {\n\n\t\n\tvar indexOf = [].indexOf;\n\t\n\tmodule.exports = function(arr, obj){\n\t if (indexOf) return arr.indexOf(obj);\n\t for (var i = 0; i < arr.length; ++i) {\n\t if (arr[i] === obj) return i;\n\t }\n\t return -1;\n\t};\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar parser = __webpack_require__(7);\n\tvar Emitter = __webpack_require__(11);\n\tvar toArray = __webpack_require__(40);\n\tvar on = __webpack_require__(41);\n\tvar bind = __webpack_require__(42);\n\tvar debug = __webpack_require__(3)('socket.io-client:socket');\n\tvar parseqs = __webpack_require__(32);\n\tvar hasBin = __webpack_require__(26);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = exports = Socket;\n\t\n\t/**\n\t * Internal events (blacklisted).\n\t * These events can't be emitted by the user.\n\t *\n\t * @api private\n\t */\n\t\n\tvar events = {\n\t connect: 1,\n\t connect_error: 1,\n\t connect_timeout: 1,\n\t connecting: 1,\n\t disconnect: 1,\n\t error: 1,\n\t reconnect: 1,\n\t reconnect_attempt: 1,\n\t reconnect_failed: 1,\n\t reconnect_error: 1,\n\t reconnecting: 1,\n\t ping: 1,\n\t pong: 1\n\t};\n\t\n\t/**\n\t * Shortcut to `Emitter#emit`.\n\t */\n\t\n\tvar emit = Emitter.prototype.emit;\n\t\n\t/**\n\t * `Socket` constructor.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction Socket (io, nsp, opts) {\n\t this.io = io;\n\t this.nsp = nsp;\n\t this.json = this; // compat\n\t this.ids = 0;\n\t this.acks = {};\n\t this.receiveBuffer = [];\n\t this.sendBuffer = [];\n\t this.connected = false;\n\t this.disconnected = true;\n\t this.flags = {};\n\t if (opts && opts.query) {\n\t this.query = opts.query;\n\t }\n\t if (this.io.autoConnect) this.open();\n\t}\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Socket.prototype);\n\t\n\t/**\n\t * Subscribe to open, close and packet events\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.subEvents = function () {\n\t if (this.subs) return;\n\t\n\t var io = this.io;\n\t this.subs = [\n\t on(io, 'open', bind(this, 'onopen')),\n\t on(io, 'packet', bind(this, 'onpacket')),\n\t on(io, 'close', bind(this, 'onclose'))\n\t ];\n\t};\n\t\n\t/**\n\t * \"Opens\" the socket.\n\t *\n\t * @api public\n\t */\n\t\n\tSocket.prototype.open =\n\tSocket.prototype.connect = function () {\n\t if (this.connected) return this;\n\t\n\t this.subEvents();\n\t this.io.open(); // ensure open\n\t if ('open' === this.io.readyState) this.onopen();\n\t this.emit('connecting');\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends a `message` event.\n\t *\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.send = function () {\n\t var args = toArray(arguments);\n\t args.unshift('message');\n\t this.emit.apply(this, args);\n\t return this;\n\t};\n\t\n\t/**\n\t * Override `emit`.\n\t * If the event is in `events`, it's emitted normally.\n\t *\n\t * @param {String} event name\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.emit = function (ev) {\n\t if (events.hasOwnProperty(ev)) {\n\t emit.apply(this, arguments);\n\t return this;\n\t }\n\t\n\t var args = toArray(arguments);\n\t var packet = {\n\t type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n\t data: args\n\t };\n\t\n\t packet.options = {};\n\t packet.options.compress = !this.flags || false !== this.flags.compress;\n\t\n\t // event ack callback\n\t if ('function' === typeof args[args.length - 1]) {\n\t debug('emitting packet with ack id %d', this.ids);\n\t this.acks[this.ids] = args.pop();\n\t packet.id = this.ids++;\n\t }\n\t\n\t if (this.connected) {\n\t this.packet(packet);\n\t } else {\n\t this.sendBuffer.push(packet);\n\t }\n\t\n\t this.flags = {};\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends a packet.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.packet = function (packet) {\n\t packet.nsp = this.nsp;\n\t this.io.packet(packet);\n\t};\n\t\n\t/**\n\t * Called upon engine `open`.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onopen = function () {\n\t debug('transport is open - connecting');\n\t\n\t // write connect packet if necessary\n\t if ('/' !== this.nsp) {\n\t if (this.query) {\n\t var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;\n\t debug('sending connect packet with query %s', query);\n\t this.packet({type: parser.CONNECT, query: query});\n\t } else {\n\t this.packet({type: parser.CONNECT});\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Called upon engine `close`.\n\t *\n\t * @param {String} reason\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onclose = function (reason) {\n\t debug('close (%s)', reason);\n\t this.connected = false;\n\t this.disconnected = true;\n\t delete this.id;\n\t this.emit('disconnect', reason);\n\t};\n\t\n\t/**\n\t * Called with socket packet.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onpacket = function (packet) {\n\t var sameNamespace = packet.nsp === this.nsp;\n\t var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\t\n\t if (!sameNamespace && !rootNamespaceError) return;\n\t\n\t switch (packet.type) {\n\t case parser.CONNECT:\n\t this.onconnect();\n\t break;\n\t\n\t case parser.EVENT:\n\t this.onevent(packet);\n\t break;\n\t\n\t case parser.BINARY_EVENT:\n\t this.onevent(packet);\n\t break;\n\t\n\t case parser.ACK:\n\t this.onack(packet);\n\t break;\n\t\n\t case parser.BINARY_ACK:\n\t this.onack(packet);\n\t break;\n\t\n\t case parser.DISCONNECT:\n\t this.ondisconnect();\n\t break;\n\t\n\t case parser.ERROR:\n\t this.emit('error', packet.data);\n\t break;\n\t }\n\t};\n\t\n\t/**\n\t * Called upon a server event.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onevent = function (packet) {\n\t var args = packet.data || [];\n\t debug('emitting event %j', args);\n\t\n\t if (null != packet.id) {\n\t debug('attaching ack callback to event');\n\t args.push(this.ack(packet.id));\n\t }\n\t\n\t if (this.connected) {\n\t emit.apply(this, args);\n\t } else {\n\t this.receiveBuffer.push(args);\n\t }\n\t};\n\t\n\t/**\n\t * Produces an ack callback to emit with an event.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.ack = function (id) {\n\t var self = this;\n\t var sent = false;\n\t return function () {\n\t // prevent double callbacks\n\t if (sent) return;\n\t sent = true;\n\t var args = toArray(arguments);\n\t debug('sending ack %j', args);\n\t\n\t self.packet({\n\t type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n\t id: id,\n\t data: args\n\t });\n\t };\n\t};\n\t\n\t/**\n\t * Called upon a server acknowlegement.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onack = function (packet) {\n\t var ack = this.acks[packet.id];\n\t if ('function' === typeof ack) {\n\t debug('calling ack %s with %j', packet.id, packet.data);\n\t ack.apply(this, packet.data);\n\t delete this.acks[packet.id];\n\t } else {\n\t debug('bad ack %s', packet.id);\n\t }\n\t};\n\t\n\t/**\n\t * Called upon server connect.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onconnect = function () {\n\t this.connected = true;\n\t this.disconnected = false;\n\t this.emit('connect');\n\t this.emitBuffered();\n\t};\n\t\n\t/**\n\t * Emit buffered events (received and emitted).\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.emitBuffered = function () {\n\t var i;\n\t for (i = 0; i < this.receiveBuffer.length; i++) {\n\t emit.apply(this, this.receiveBuffer[i]);\n\t }\n\t this.receiveBuffer = [];\n\t\n\t for (i = 0; i < this.sendBuffer.length; i++) {\n\t this.packet(this.sendBuffer[i]);\n\t }\n\t this.sendBuffer = [];\n\t};\n\t\n\t/**\n\t * Called upon server disconnect.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.ondisconnect = function () {\n\t debug('server disconnect (%s)', this.nsp);\n\t this.destroy();\n\t this.onclose('io server disconnect');\n\t};\n\t\n\t/**\n\t * Called upon forced client/server side disconnections,\n\t * this method ensures the manager stops tracking us and\n\t * that reconnections don't get triggered for this.\n\t *\n\t * @api private.\n\t */\n\t\n\tSocket.prototype.destroy = function () {\n\t if (this.subs) {\n\t // clean subscriptions to avoid reconnections\n\t for (var i = 0; i < this.subs.length; i++) {\n\t this.subs[i].destroy();\n\t }\n\t this.subs = null;\n\t }\n\t\n\t this.io.destroy(this);\n\t};\n\t\n\t/**\n\t * Disconnects the socket manually.\n\t *\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.close =\n\tSocket.prototype.disconnect = function () {\n\t if (this.connected) {\n\t debug('performing disconnect (%s)', this.nsp);\n\t this.packet({ type: parser.DISCONNECT });\n\t }\n\t\n\t // remove socket from pool\n\t this.destroy();\n\t\n\t if (this.connected) {\n\t // fire events\n\t this.onclose('io client disconnect');\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the compress flag.\n\t *\n\t * @param {Boolean} if `true`, compresses the sending data\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.compress = function (compress) {\n\t this.flags.compress = compress;\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the binary flag\n\t *\n\t * @param {Boolean} whether the emitted data contains binary\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.binary = function (binary) {\n\t this.flags.binary = binary;\n\t return this;\n\t};\n\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = toArray\n\t\n\tfunction toArray(list, index) {\n\t var array = []\n\t\n\t index = index || 0\n\t\n\t for (var i = index || 0; i < list.length; i++) {\n\t array[i - index] = list[i]\n\t }\n\t\n\t return array\n\t}\n\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = on;\n\t\n\t/**\n\t * Helper for subscriptions.\n\t *\n\t * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n\t * @param {String} event name\n\t * @param {Function} callback\n\t * @api public\n\t */\n\t\n\tfunction on (obj, ev, fn) {\n\t obj.on(ev, fn);\n\t return {\n\t destroy: function () {\n\t obj.removeListener(ev, fn);\n\t }\n\t };\n\t}\n\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports) {\n\n\t/**\n\t * Slice reference.\n\t */\n\t\n\tvar slice = [].slice;\n\t\n\t/**\n\t * Bind `obj` to `fn`.\n\t *\n\t * @param {Object} obj\n\t * @param {Function|String} fn or string\n\t * @return {Function}\n\t * @api public\n\t */\n\t\n\tmodule.exports = function(obj, fn){\n\t if ('string' == typeof fn) fn = obj[fn];\n\t if ('function' != typeof fn) throw new Error('bind() requires a function');\n\t var args = slice.call(arguments, 2);\n\t return function(){\n\t return fn.apply(obj, args.concat(slice.call(arguments)));\n\t }\n\t};\n\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Expose `Backoff`.\n\t */\n\t\n\tmodule.exports = Backoff;\n\t\n\t/**\n\t * Initialize backoff timer with `opts`.\n\t *\n\t * - `min` initial timeout in milliseconds [100]\n\t * - `max` max timeout [10000]\n\t * - `jitter` [0]\n\t * - `factor` [2]\n\t *\n\t * @param {Object} opts\n\t * @api public\n\t */\n\t\n\tfunction Backoff(opts) {\n\t opts = opts || {};\n\t this.ms = opts.min || 100;\n\t this.max = opts.max || 10000;\n\t this.factor = opts.factor || 2;\n\t this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n\t this.attempts = 0;\n\t}\n\t\n\t/**\n\t * Return the backoff duration.\n\t *\n\t * @return {Number}\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.duration = function(){\n\t var ms = this.ms * Math.pow(this.factor, this.attempts++);\n\t if (this.jitter) {\n\t var rand = Math.random();\n\t var deviation = Math.floor(rand * this.jitter * ms);\n\t ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n\t }\n\t return Math.min(ms, this.max) | 0;\n\t};\n\t\n\t/**\n\t * Reset the number of attempts.\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.reset = function(){\n\t this.attempts = 0;\n\t};\n\t\n\t/**\n\t * Set the minimum duration\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.setMin = function(min){\n\t this.ms = min;\n\t};\n\t\n\t/**\n\t * Set the maximum duration\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.setMax = function(max){\n\t this.max = max;\n\t};\n\t\n\t/**\n\t * Set the jitter\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.setJitter = function(jitter){\n\t this.jitter = jitter;\n\t};\n\t\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// socket.io.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9e45fccfabd75c66dd47","\n/**\n * Module dependencies.\n */\n\nvar url = require('./url');\nvar parser = require('socket.io-parser');\nvar Manager = require('./manager');\nvar debug = require('debug')('socket.io-client');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = lookup;\n\n/**\n * Managers cache.\n */\n\nvar cache = exports.managers = {};\n\n/**\n * Looks up an existing `Manager` for multiplexing.\n * If the user summons:\n *\n * `io('http://localhost/a');`\n * `io('http://localhost/b');`\n *\n * We reuse the existing instance based on same scheme/port/host,\n * and we initialize sockets for each namespace.\n *\n * @api public\n */\n\nfunction lookup (uri, opts) {\n if (typeof uri === 'object') {\n opts = uri;\n uri = undefined;\n }\n\n opts = opts || {};\n\n var parsed = url(uri);\n var source = parsed.source;\n var id = parsed.id;\n var path = parsed.path;\n var sameNamespace = cache[id] && path in cache[id].nsps;\n var newConnection = opts.forceNew || opts['force new connection'] ||\n false === opts.multiplex || sameNamespace;\n\n var io;\n\n if (newConnection) {\n debug('ignoring socket cache for %s', source);\n io = Manager(source, opts);\n } else {\n if (!cache[id]) {\n debug('new io instance for %s', source);\n cache[id] = Manager(source, opts);\n }\n io = cache[id];\n }\n if (parsed.query && !opts.query) {\n opts.query = parsed.query;\n }\n return io.socket(parsed.path, opts);\n}\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = parser.protocol;\n\n/**\n * `connect`.\n *\n * @param {String} uri\n * @api public\n */\n\nexports.connect = lookup;\n\n/**\n * Expose constructors for standalone build.\n *\n * @api public\n */\n\nexports.Manager = require('./manager');\nexports.Socket = require('./socket');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/index.js\n// module id = 0\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar parseuri = require('parseuri');\nvar debug = require('debug')('socket.io-client:url');\n\n/**\n * Module exports.\n */\n\nmodule.exports = url;\n\n/**\n * URL parser.\n *\n * @param {String} url\n * @param {Object} An object meant to mimic window.location.\n * Defaults to window.location.\n * @api public\n */\n\nfunction url (uri, loc) {\n var obj = uri;\n\n // default to window.location\n loc = loc || (typeof location !== 'undefined' && location);\n if (null == uri) uri = loc.protocol + '//' + loc.host;\n\n // relative path support\n if ('string' === typeof uri) {\n if ('/' === uri.charAt(0)) {\n if ('/' === uri.charAt(1)) {\n uri = loc.protocol + uri;\n } else {\n uri = loc.host + uri;\n }\n }\n\n if (!/^(https?|wss?):\\/\\//.test(uri)) {\n debug('protocol-less url %s', uri);\n if ('undefined' !== typeof loc) {\n uri = loc.protocol + '//' + uri;\n } else {\n uri = 'https://' + uri;\n }\n }\n\n // parse\n debug('parse %s', uri);\n obj = parseuri(uri);\n }\n\n // make sure we treat `localhost:80` and `localhost` equally\n if (!obj.port) {\n if (/^(http|ws)$/.test(obj.protocol)) {\n obj.port = '80';\n } else if (/^(http|ws)s$/.test(obj.protocol)) {\n obj.port = '443';\n }\n }\n\n obj.path = obj.path || '/';\n\n var ipv6 = obj.host.indexOf(':') !== -1;\n var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\n // define unique id\n obj.id = obj.protocol + '://' + host + ':' + obj.port;\n // define href\n obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));\n\n return obj;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/url.js\n// module id = 1\n// module chunks = 0","/**\r\n * Parses an URI\r\n *\r\n * @author Steven Levithan <stevenlevithan.com> (MIT license)\r\n * @api private\r\n */\r\n\r\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\r\n\r\nvar parts = [\r\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\r\n];\r\n\r\nmodule.exports = function parseuri(str) {\r\n var src = str,\r\n b = str.indexOf('['),\r\n e = str.indexOf(']');\r\n\r\n if (b != -1 && e != -1) {\r\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\r\n }\r\n\r\n var m = re.exec(str || ''),\r\n uri = {},\r\n i = 14;\r\n\r\n while (i--) {\r\n uri[parts[i]] = m[i] || '';\r\n }\r\n\r\n if (b != -1 && e != -1) {\r\n uri.source = src;\r\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\r\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\r\n uri.ipv6uri = true;\r\n }\r\n\r\n return uri;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseuri/index.js\n// module id = 2\n// module chunks = 0","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\nfunction log(...args) {\n\t// This hackery is required for IE8/9, where\n\t// the `console.log` function doesn't have 'apply'\n\treturn typeof console === 'object' &&\n\t\tconsole.log &&\n\t\tconsole.log(...args);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n\n\n\n// WEBPACK FOOTER //\n// ./~/debug/src/browser.js","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 4\n// module chunks = 0","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* Active `debug` instances.\n\t*/\n\tcreateDebug.instances = [];\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn match;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.enabled = createDebug.enabled(namespace);\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = selectColor(namespace);\n\t\tdebug.destroy = destroy;\n\t\tdebug.extend = extend;\n\t\t// Debug.formatArgs = formatArgs;\n\t\t// debug.rawLog = rawLog;\n\n\t\t// env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\tcreateDebug.instances.push(debug);\n\n\t\treturn debug;\n\t}\n\n\tfunction destroy() {\n\t\tconst index = createDebug.instances.indexOf(this);\n\t\tif (index !== -1) {\n\t\t\tcreateDebug.instances.splice(index, 1);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0; i < createDebug.instances.length; i++) {\n\t\t\tconst instance = createDebug.instances[i];\n\t\t\tinstance.enabled = createDebug.enabled(instance.namespace);\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n\n\n\n// WEBPACK FOOTER //\n// ./~/debug/src/common.js","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ms/index.js\n// module id = 6\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar binary = require('./binary');\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = 4;\n\n/**\n * Packet types.\n *\n * @api public\n */\n\nexports.types = [\n 'CONNECT',\n 'DISCONNECT',\n 'EVENT',\n 'ACK',\n 'ERROR',\n 'BINARY_EVENT',\n 'BINARY_ACK'\n];\n\n/**\n * Packet type `connect`.\n *\n * @api public\n */\n\nexports.CONNECT = 0;\n\n/**\n * Packet type `disconnect`.\n *\n * @api public\n */\n\nexports.DISCONNECT = 1;\n\n/**\n * Packet type `event`.\n *\n * @api public\n */\n\nexports.EVENT = 2;\n\n/**\n * Packet type `ack`.\n *\n * @api public\n */\n\nexports.ACK = 3;\n\n/**\n * Packet type `error`.\n *\n * @api public\n */\n\nexports.ERROR = 4;\n\n/**\n * Packet type 'binary event'\n *\n * @api public\n */\n\nexports.BINARY_EVENT = 5;\n\n/**\n * Packet type `binary ack`. For acks with binary arguments.\n *\n * @api public\n */\n\nexports.BINARY_ACK = 6;\n\n/**\n * Encoder constructor.\n *\n * @api public\n */\n\nexports.Encoder = Encoder;\n\n/**\n * Decoder constructor.\n *\n * @api public\n */\n\nexports.Decoder = Decoder;\n\n/**\n * A socket.io Encoder instance\n *\n * @api public\n */\n\nfunction Encoder() {}\n\nvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\n/**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n * @param {Function} callback - function to handle encodings (likely engine.write)\n * @return Calls callback with Array of encodings\n * @api public\n */\n\nEncoder.prototype.encode = function(obj, callback){\n debug('encoding packet %j', obj);\n\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n encodeAsBinary(obj, callback);\n } else {\n var encoding = encodeAsString(obj);\n callback([encoding]);\n }\n};\n\n/**\n * Encode packet as string.\n *\n * @param {Object} packet\n * @return {String} encoded\n * @api private\n */\n\nfunction encodeAsString(obj) {\n\n // first is type\n var str = '' + obj.type;\n\n // attachments if we have them\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n str += obj.attachments + '-';\n }\n\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && '/' !== obj.nsp) {\n str += obj.nsp + ',';\n }\n\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n\n // json data\n if (null != obj.data) {\n var payload = tryStringify(obj.data);\n if (payload !== false) {\n str += payload;\n } else {\n return ERROR_PACKET;\n }\n }\n\n debug('encoded %j as %s', obj, str);\n return str;\n}\n\nfunction tryStringify(str) {\n try {\n return JSON.stringify(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n *\n * @param {Object} packet\n * @return {Buffer} encoded\n * @api private\n */\n\nfunction encodeAsBinary(obj, callback) {\n\n function writeEncoding(bloblessData) {\n var deconstruction = binary.deconstructPacket(bloblessData);\n var pack = encodeAsString(deconstruction.packet);\n var buffers = deconstruction.buffers;\n\n buffers.unshift(pack); // add packet info to beginning of data list\n callback(buffers); // write all the buffers\n }\n\n binary.removeBlobs(obj, writeEncoding);\n}\n\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n * @api public\n */\n\nfunction Decoder() {\n this.reconstructor = null;\n}\n\n/**\n * Mix in `Emitter` with Decoder.\n */\n\nEmitter(Decoder.prototype);\n\n/**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n * @return {Object} packet\n * @api public\n */\n\nDecoder.prototype.add = function(obj) {\n var packet;\n if (typeof obj === 'string') {\n packet = decodeString(obj);\n if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n\n // no attachments, labeled binary but no binary data to follow\n if (this.reconstructor.reconPack.attachments === 0) {\n this.emit('decoded', packet);\n }\n } else { // non-binary full packet\n this.emit('decoded', packet);\n }\n } else if (isBuf(obj) || obj.base64) { // raw binary data\n if (!this.reconstructor) {\n throw new Error('got binary data when not reconstructing a packet');\n } else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) { // received final buffer\n this.reconstructor = null;\n this.emit('decoded', packet);\n }\n }\n } else {\n throw new Error('Unknown type: ' + obj);\n }\n};\n\n/**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n * @api private\n */\n\nfunction decodeString(str) {\n var i = 0;\n // look up type\n var p = {\n type: Number(str.charAt(0))\n };\n\n if (null == exports.types[p.type]) {\n return error('unknown packet type ' + p.type);\n }\n\n // look up attachments if type binary\n if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n var buf = '';\n while (str.charAt(++i) !== '-') {\n buf += str.charAt(i);\n if (i == str.length) break;\n }\n if (buf != Number(buf) || str.charAt(i) !== '-') {\n throw new Error('Illegal attachments');\n }\n p.attachments = Number(buf);\n }\n\n // look up namespace (if any)\n if ('/' === str.charAt(i + 1)) {\n p.nsp = '';\n while (++i) {\n var c = str.charAt(i);\n if (',' === c) break;\n p.nsp += c;\n if (i === str.length) break;\n }\n } else {\n p.nsp = '/';\n }\n\n // look up id\n var next = str.charAt(i + 1);\n if ('' !== next && Number(next) == next) {\n p.id = '';\n while (++i) {\n var c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n p.id += str.charAt(i);\n if (i === str.length) break;\n }\n p.id = Number(p.id);\n }\n\n // look up json data\n if (str.charAt(++i)) {\n var payload = tryParse(str.substr(i));\n var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n if (isPayloadValid) {\n p.data = payload;\n } else {\n return error('invalid payload');\n }\n }\n\n debug('decoded %s as %j', str, p);\n return p;\n}\n\nfunction tryParse(str) {\n try {\n return JSON.parse(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Deallocates a parser's resources\n *\n * @api public\n */\n\nDecoder.prototype.destroy = function() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n }\n};\n\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n * @api private\n */\n\nfunction BinaryReconstructor(packet) {\n this.reconPack = packet;\n this.buffers = [];\n}\n\n/**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n * @api private\n */\n\nBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n};\n\n/**\n * Cleans up binary packet reconstruction variables.\n *\n * @api private\n */\n\nBinaryReconstructor.prototype.finishedReconstruction = function() {\n this.reconPack = null;\n this.buffers = [];\n};\n\nfunction error(msg) {\n return {\n type: exports.ERROR,\n data: 'parser error: ' + msg\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/index.js\n// module id = 7\n// module chunks = 0","/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',\n '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',\n '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',\n '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',\n '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',\n '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',\n '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',\n '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',\n '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',\n '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',\n '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {\n return true;\n }\n\n // Internet Explorer and Edge do not support colors.\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n\n // is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n // double check webkit in userAgent just in case we are in a worker\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (err) {\n return '[UnexpectedJSONParseError]: ' + err.message;\n }\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return;\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit')\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n try {\n return window.localStorage;\n } catch (e) {}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/socket.io-parser/~/debug/src/browser.js","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = createDebug.debug = createDebug['default'] = createDebug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * Active `debug` instances.\n */\nexports.instances = [];\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\nexports.formatters = {};\n\n/**\n * Select a color.\n * @param {String} namespace\n * @return {Number}\n * @api private\n */\n\nfunction selectColor(namespace) {\n var hash = 0, i;\n\n for (i in namespace) {\n hash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return exports.colors[Math.abs(hash) % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction createDebug(namespace) {\n\n var prevTime;\n\n function debug() {\n // disabled?\n if (!debug.enabled) return;\n\n var self = debug;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // turn the `arguments` into a proper Array\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %O\n args.unshift('%O');\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n // apply env-specific formatting (colors, etc.)\n exports.formatArgs.call(self, args);\n\n var logFn = debug.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = exports.enabled(namespace);\n debug.useColors = exports.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n\n // env-specific initialization logic for debug instances\n if ('function' === typeof exports.init) {\n exports.init(debug);\n }\n\n exports.instances.push(debug);\n\n return debug;\n}\n\nfunction destroy () {\n var index = exports.instances.indexOf(this);\n if (index !== -1) {\n exports.instances.splice(index, 1);\n return true;\n } else {\n return false;\n }\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n exports.names = [];\n exports.skips = [];\n\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < exports.instances.length; i++) {\n var instance = exports.instances[i];\n instance.enabled = exports.enabled(instance.namespace);\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/socket.io-parser/~/debug/src/debug.js","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isNaN(val) === false) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n if (ms >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (ms >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (ms >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (ms >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n return plural(ms, d, 'day') ||\n plural(ms, h, 'hour') ||\n plural(ms, m, 'minute') ||\n plural(ms, s, 'second') ||\n ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) {\n return;\n }\n if (ms < n * 1.5) {\n return Math.floor(ms / n) + ' ' + name;\n }\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/~/ms/index.js\n// module id = 10\n// module chunks = 0","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-emitter/index.js\n// module id = 11\n// module chunks = 0","/*global Blob,File*/\n\n/**\n * Module requirements\n */\n\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\nvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\n/**\n * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n * Anything with blobs or files should be fed through removeBlobs before coming\n * here.\n *\n * @param {Object} packet - socket.io event packet\n * @return {Object} with deconstructed packet and list of buffers\n * @api public\n */\n\nexports.deconstructPacket = function(packet) {\n var buffers = [];\n var packetData = packet.data;\n var pack = packet;\n pack.data = _deconstructPacket(packetData, buffers);\n pack.attachments = buffers.length; // number of binary 'attachments'\n return {packet: pack, buffers: buffers};\n};\n\nfunction _deconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (isBuf(data)) {\n var placeholder = { _placeholder: true, num: buffers.length };\n buffers.push(data);\n return placeholder;\n } else if (isArray(data)) {\n var newData = new Array(data.length);\n for (var i = 0; i < data.length; i++) {\n newData[i] = _deconstructPacket(data[i], buffers);\n }\n return newData;\n } else if (typeof data === 'object' && !(data instanceof Date)) {\n var newData = {};\n for (var key in data) {\n newData[key] = _deconstructPacket(data[key], buffers);\n }\n return newData;\n }\n return data;\n}\n\n/**\n * Reconstructs a binary packet from its placeholder packet and buffers\n *\n * @param {Object} packet - event packet with placeholders\n * @param {Array} buffers - binary buffers to put in placeholder positions\n * @return {Object} reconstructed packet\n * @api public\n */\n\nexports.reconstructPacket = function(packet, buffers) {\n packet.data = _reconstructPacket(packet.data, buffers);\n packet.attachments = undefined; // no longer useful\n return packet;\n};\n\nfunction _reconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (data && data._placeholder) {\n return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n } else if (isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n data[i] = _reconstructPacket(data[i], buffers);\n }\n } else if (typeof data === 'object') {\n for (var key in data) {\n data[key] = _reconstructPacket(data[key], buffers);\n }\n }\n\n return data;\n}\n\n/**\n * Asynchronously removes Blobs or Files from data via\n * FileReader's readAsArrayBuffer method. Used before encoding\n * data as msgpack. Calls callback with the blobless data.\n *\n * @param {Object} data\n * @param {Function} callback\n * @api private\n */\n\nexports.removeBlobs = function(data, callback) {\n function _removeBlobs(obj, curKey, containingObject) {\n if (!obj) return obj;\n\n // convert any blob\n if ((withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)) {\n pendingBlobs++;\n\n // async filereader\n var fileReader = new FileReader();\n fileReader.onload = function() { // this.result == arraybuffer\n if (containingObject) {\n containingObject[curKey] = this.result;\n }\n else {\n bloblessData = this.result;\n }\n\n // if nothing pending its callback time\n if(! --pendingBlobs) {\n callback(bloblessData);\n }\n };\n\n fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n } else if (isArray(obj)) { // handle array\n for (var i = 0; i < obj.length; i++) {\n _removeBlobs(obj[i], i, obj);\n }\n } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n for (var key in obj) {\n _removeBlobs(obj[key], key, obj);\n }\n }\n }\n\n var pendingBlobs = 0;\n var bloblessData = data;\n _removeBlobs(bloblessData);\n if (!pendingBlobs) {\n callback(bloblessData);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/binary.js\n// module id = 12\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 13\n// module chunks = 0","\nmodule.exports = isBuf;\n\nvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\nvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\nvar isView = function (obj) {\n return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n};\n\n/**\n * Returns true if obj is a buffer or an arraybuffer.\n *\n * @api private\n */\n\nfunction isBuf(obj) {\n return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/is-buffer.js\n// module id = 14\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar eio = require('engine.io-client');\nvar Socket = require('./socket');\nvar Emitter = require('component-emitter');\nvar parser = require('socket.io-parser');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:manager');\nvar indexOf = require('indexof');\nvar Backoff = require('backo2');\n\n/**\n * IE6+ hasOwnProperty\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Module exports\n */\n\nmodule.exports = Manager;\n\n/**\n * `Manager` constructor.\n *\n * @param {String} engine instance or engine uri/opts\n * @param {Object} options\n * @api public\n */\n\nfunction Manager (uri, opts) {\n if (!(this instanceof Manager)) return new Manager(uri, opts);\n if (uri && ('object' === typeof uri)) {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n\n opts.path = opts.path || '/socket.io';\n this.nsps = {};\n this.subs = [];\n this.opts = opts;\n this.reconnection(opts.reconnection !== false);\n this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n this.reconnectionDelay(opts.reconnectionDelay || 1000);\n this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n this.randomizationFactor(opts.randomizationFactor || 0.5);\n this.backoff = new Backoff({\n min: this.reconnectionDelay(),\n max: this.reconnectionDelayMax(),\n jitter: this.randomizationFactor()\n });\n this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n this.readyState = 'closed';\n this.uri = uri;\n this.connecting = [];\n this.lastPing = null;\n this.encoding = false;\n this.packetBuffer = [];\n var _parser = opts.parser || parser;\n this.encoder = new _parser.Encoder();\n this.decoder = new _parser.Decoder();\n this.autoConnect = opts.autoConnect !== false;\n if (this.autoConnect) this.open();\n}\n\n/**\n * Propagate given event to sockets and emit on `this`\n *\n * @api private\n */\n\nManager.prototype.emitAll = function () {\n this.emit.apply(this, arguments);\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n }\n }\n};\n\n/**\n * Update `socket.id` of all sockets\n *\n * @api private\n */\n\nManager.prototype.updateSocketIds = function () {\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].id = this.generateId(nsp);\n }\n }\n};\n\n/**\n * generate `socket.id` for the given `nsp`\n *\n * @param {String} nsp\n * @return {String}\n * @api private\n */\n\nManager.prototype.generateId = function (nsp) {\n return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;\n};\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Manager.prototype);\n\n/**\n * Sets the `reconnection` config.\n *\n * @param {Boolean} true/false if it should automatically reconnect\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnection = function (v) {\n if (!arguments.length) return this._reconnection;\n this._reconnection = !!v;\n return this;\n};\n\n/**\n * Sets the reconnection attempts config.\n *\n * @param {Number} max reconnection attempts before giving up\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionAttempts = function (v) {\n if (!arguments.length) return this._reconnectionAttempts;\n this._reconnectionAttempts = v;\n return this;\n};\n\n/**\n * Sets the delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelay = function (v) {\n if (!arguments.length) return this._reconnectionDelay;\n this._reconnectionDelay = v;\n this.backoff && this.backoff.setMin(v);\n return this;\n};\n\nManager.prototype.randomizationFactor = function (v) {\n if (!arguments.length) return this._randomizationFactor;\n this._randomizationFactor = v;\n this.backoff && this.backoff.setJitter(v);\n return this;\n};\n\n/**\n * Sets the maximum delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelayMax = function (v) {\n if (!arguments.length) return this._reconnectionDelayMax;\n this._reconnectionDelayMax = v;\n this.backoff && this.backoff.setMax(v);\n return this;\n};\n\n/**\n * Sets the connection timeout. `false` to disable\n *\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.timeout = function (v) {\n if (!arguments.length) return this._timeout;\n this._timeout = v;\n return this;\n};\n\n/**\n * Starts trying to reconnect if reconnection is enabled and we have not\n * started reconnecting yet\n *\n * @api private\n */\n\nManager.prototype.maybeReconnectOnOpen = function () {\n // Only try to reconnect if it's the first time we're connecting\n if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n // keeps reconnection from firing twice for the same reconnection loop\n this.reconnect();\n }\n};\n\n/**\n * Sets the current transport `socket`.\n *\n * @param {Function} optional, callback\n * @return {Manager} self\n * @api public\n */\n\nManager.prototype.open =\nManager.prototype.connect = function (fn, opts) {\n debug('readyState %s', this.readyState);\n if (~this.readyState.indexOf('open')) return this;\n\n debug('opening %s', this.uri);\n this.engine = eio(this.uri, this.opts);\n var socket = this.engine;\n var self = this;\n this.readyState = 'opening';\n this.skipReconnect = false;\n\n // emit `open`\n var openSub = on(socket, 'open', function () {\n self.onopen();\n fn && fn();\n });\n\n // emit `connect_error`\n var errorSub = on(socket, 'error', function (data) {\n debug('connect_error');\n self.cleanup();\n self.readyState = 'closed';\n self.emitAll('connect_error', data);\n if (fn) {\n var err = new Error('Connection error');\n err.data = data;\n fn(err);\n } else {\n // Only do this if there is no fn to handle the error\n self.maybeReconnectOnOpen();\n }\n });\n\n // emit `connect_timeout`\n if (false !== this._timeout) {\n var timeout = this._timeout;\n debug('connect attempt will timeout after %d', timeout);\n\n // set timer\n var timer = setTimeout(function () {\n debug('connect attempt timed out after %d', timeout);\n openSub.destroy();\n socket.close();\n socket.emit('error', 'timeout');\n self.emitAll('connect_timeout', timeout);\n }, timeout);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n\n this.subs.push(openSub);\n this.subs.push(errorSub);\n\n return this;\n};\n\n/**\n * Called upon transport open.\n *\n * @api private\n */\n\nManager.prototype.onopen = function () {\n debug('open');\n\n // clear old subs\n this.cleanup();\n\n // mark as open\n this.readyState = 'open';\n this.emit('open');\n\n // add new subs\n var socket = this.engine;\n this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n};\n\n/**\n * Called upon a ping.\n *\n * @api private\n */\n\nManager.prototype.onping = function () {\n this.lastPing = new Date();\n this.emitAll('ping');\n};\n\n/**\n * Called upon a packet.\n *\n * @api private\n */\n\nManager.prototype.onpong = function () {\n this.emitAll('pong', new Date() - this.lastPing);\n};\n\n/**\n * Called with data.\n *\n * @api private\n */\n\nManager.prototype.ondata = function (data) {\n this.decoder.add(data);\n};\n\n/**\n * Called when parser fully decodes a packet.\n *\n * @api private\n */\n\nManager.prototype.ondecoded = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon socket error.\n *\n * @api private\n */\n\nManager.prototype.onerror = function (err) {\n debug('error', err);\n this.emitAll('error', err);\n};\n\n/**\n * Creates a new socket for the given `nsp`.\n *\n * @return {Socket}\n * @api public\n */\n\nManager.prototype.socket = function (nsp, opts) {\n var socket = this.nsps[nsp];\n if (!socket) {\n socket = new Socket(this, nsp, opts);\n this.nsps[nsp] = socket;\n var self = this;\n socket.on('connecting', onConnecting);\n socket.on('connect', function () {\n socket.id = self.generateId(nsp);\n });\n\n if (this.autoConnect) {\n // manually call here since connecting event is fired before listening\n onConnecting();\n }\n }\n\n function onConnecting () {\n if (!~indexOf(self.connecting, socket)) {\n self.connecting.push(socket);\n }\n }\n\n return socket;\n};\n\n/**\n * Called upon a socket close.\n *\n * @param {Socket} socket\n */\n\nManager.prototype.destroy = function (socket) {\n var index = indexOf(this.connecting, socket);\n if (~index) this.connecting.splice(index, 1);\n if (this.connecting.length) return;\n\n this.close();\n};\n\n/**\n * Writes a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nManager.prototype.packet = function (packet) {\n debug('writing packet %j', packet);\n var self = this;\n if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\n if (!self.encoding) {\n // encode, then write to engine with result\n self.encoding = true;\n this.encoder.encode(packet, function (encodedPackets) {\n for (var i = 0; i < encodedPackets.length; i++) {\n self.engine.write(encodedPackets[i], packet.options);\n }\n self.encoding = false;\n self.processPacketQueue();\n });\n } else { // add packet to the queue\n self.packetBuffer.push(packet);\n }\n};\n\n/**\n * If packet buffer is non-empty, begins encoding the\n * next packet in line.\n *\n * @api private\n */\n\nManager.prototype.processPacketQueue = function () {\n if (this.packetBuffer.length > 0 && !this.encoding) {\n var pack = this.packetBuffer.shift();\n this.packet(pack);\n }\n};\n\n/**\n * Clean up transport subscriptions and packet buffer.\n *\n * @api private\n */\n\nManager.prototype.cleanup = function () {\n debug('cleanup');\n\n var subsLength = this.subs.length;\n for (var i = 0; i < subsLength; i++) {\n var sub = this.subs.shift();\n sub.destroy();\n }\n\n this.packetBuffer = [];\n this.encoding = false;\n this.lastPing = null;\n\n this.decoder.destroy();\n};\n\n/**\n * Close the current socket.\n *\n * @api private\n */\n\nManager.prototype.close =\nManager.prototype.disconnect = function () {\n debug('disconnect');\n this.skipReconnect = true;\n this.reconnecting = false;\n if ('opening' === this.readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this.readyState = 'closed';\n if (this.engine) this.engine.close();\n};\n\n/**\n * Called upon engine close.\n *\n * @api private\n */\n\nManager.prototype.onclose = function (reason) {\n debug('onclose');\n\n this.cleanup();\n this.backoff.reset();\n this.readyState = 'closed';\n this.emit('close', reason);\n\n if (this._reconnection && !this.skipReconnect) {\n this.reconnect();\n }\n};\n\n/**\n * Attempt a reconnection.\n *\n * @api private\n */\n\nManager.prototype.reconnect = function () {\n if (this.reconnecting || this.skipReconnect) return this;\n\n var self = this;\n\n if (this.backoff.attempts >= this._reconnectionAttempts) {\n debug('reconnect failed');\n this.backoff.reset();\n this.emitAll('reconnect_failed');\n this.reconnecting = false;\n } else {\n var delay = this.backoff.duration();\n debug('will wait %dms before reconnect attempt', delay);\n\n this.reconnecting = true;\n var timer = setTimeout(function () {\n if (self.skipReconnect) return;\n\n debug('attempting reconnect');\n self.emitAll('reconnect_attempt', self.backoff.attempts);\n self.emitAll('reconnecting', self.backoff.attempts);\n\n // check again for the case socket closed in above events\n if (self.skipReconnect) return;\n\n self.open(function (err) {\n if (err) {\n debug('reconnect attempt error');\n self.reconnecting = false;\n self.reconnect();\n self.emitAll('reconnect_error', err.data);\n } else {\n debug('reconnect success');\n self.onreconnect();\n }\n });\n }, delay);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n};\n\n/**\n * Called upon successful reconnect.\n *\n * @api private\n */\n\nManager.prototype.onreconnect = function () {\n var attempt = this.backoff.attempts;\n this.reconnecting = false;\n this.backoff.reset();\n this.updateSocketIds();\n this.emitAll('reconnect', attempt);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/manager.js\n// module id = 15\n// module chunks = 0","\nmodule.exports = require('./socket');\n\n/**\n * Exports parser\n *\n * @api public\n *\n */\nmodule.exports.parser = require('engine.io-parser');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/index.js\n// module id = 16\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar transports = require('./transports/index');\nvar Emitter = require('component-emitter');\nvar debug = require('debug')('engine.io-client:socket');\nvar index = require('indexof');\nvar parser = require('engine.io-parser');\nvar parseuri = require('parseuri');\nvar parseqs = require('parseqs');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Socket;\n\n/**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n\nfunction Socket (uri, opts) {\n if (!(this instanceof Socket)) return new Socket(uri, opts);\n\n opts = opts || {};\n\n if (uri && 'object' === typeof uri) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n this.secure = null != opts.secure ? opts.secure\n : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = this.secure ? '443' : '80';\n }\n\n this.agent = opts.agent || false;\n this.hostname = opts.hostname ||\n (typeof location !== 'undefined' ? location.hostname : 'localhost');\n this.port = opts.port || (typeof location !== 'undefined' && location.port\n ? location.port\n : (this.secure ? 443 : 80));\n this.query = opts.query || {};\n if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n this.upgrade = false !== opts.upgrade;\n this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n this.forceJSONP = !!opts.forceJSONP;\n this.jsonp = false !== opts.jsonp;\n this.forceBase64 = !!opts.forceBase64;\n this.enablesXDR = !!opts.enablesXDR;\n this.withCredentials = false !== opts.withCredentials;\n this.timestampParam = opts.timestampParam || 't';\n this.timestampRequests = opts.timestampRequests;\n this.transports = opts.transports || ['polling', 'websocket'];\n this.transportOptions = opts.transportOptions || {};\n this.readyState = '';\n this.writeBuffer = [];\n this.prevBufferLen = 0;\n this.policyPort = opts.policyPort || 843;\n this.rememberUpgrade = opts.rememberUpgrade || false;\n this.binaryType = null;\n this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\n if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n this.perMessageDeflate.threshold = 1024;\n }\n\n // SSL options for Node.js client\n this.pfx = opts.pfx || null;\n this.key = opts.key || null;\n this.passphrase = opts.passphrase || null;\n this.cert = opts.cert || null;\n this.ca = opts.ca || null;\n this.ciphers = opts.ciphers || null;\n this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n this.forceNode = !!opts.forceNode;\n\n // detect ReactNative environment\n this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\n // other options for Node.js or ReactNative client\n if (typeof self === 'undefined' || this.isReactNative) {\n if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n this.extraHeaders = opts.extraHeaders;\n }\n\n if (opts.localAddress) {\n this.localAddress = opts.localAddress;\n }\n }\n\n // set on handshake\n this.id = null;\n this.upgrades = null;\n this.pingInterval = null;\n this.pingTimeout = null;\n\n // set on heartbeat\n this.pingIntervalTimer = null;\n this.pingTimeoutTimer = null;\n\n this.open();\n}\n\nSocket.priorWebsocketSuccess = false;\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\nSocket.Socket = Socket;\nSocket.Transport = require('./transport');\nSocket.transports = require('./transports/index');\nSocket.parser = require('engine.io-parser');\n\n/**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n\nSocket.prototype.createTransport = function (name) {\n debug('creating transport \"%s\"', name);\n var query = clone(this.query);\n\n // append engine.io protocol identifier\n query.EIO = parser.protocol;\n\n // transport name\n query.transport = name;\n\n // per-transport options\n var options = this.transportOptions[name] || {};\n\n // session id if we already have one\n if (this.id) query.sid = this.id;\n\n var transport = new transports[name]({\n query: query,\n socket: this,\n agent: options.agent || this.agent,\n hostname: options.hostname || this.hostname,\n port: options.port || this.port,\n secure: options.secure || this.secure,\n path: options.path || this.path,\n forceJSONP: options.forceJSONP || this.forceJSONP,\n jsonp: options.jsonp || this.jsonp,\n forceBase64: options.forceBase64 || this.forceBase64,\n enablesXDR: options.enablesXDR || this.enablesXDR,\n withCredentials: options.withCredentials || this.withCredentials,\n timestampRequests: options.timestampRequests || this.timestampRequests,\n timestampParam: options.timestampParam || this.timestampParam,\n policyPort: options.policyPort || this.policyPort,\n pfx: options.pfx || this.pfx,\n key: options.key || this.key,\n passphrase: options.passphrase || this.passphrase,\n cert: options.cert || this.cert,\n ca: options.ca || this.ca,\n ciphers: options.ciphers || this.ciphers,\n rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n extraHeaders: options.extraHeaders || this.extraHeaders,\n forceNode: options.forceNode || this.forceNode,\n localAddress: options.localAddress || this.localAddress,\n requestTimeout: options.requestTimeout || this.requestTimeout,\n protocols: options.protocols || void (0),\n isReactNative: this.isReactNative\n });\n\n return transport;\n};\n\nfunction clone (obj) {\n var o = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n return o;\n}\n\n/**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\nSocket.prototype.open = function () {\n var transport;\n if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n transport = 'websocket';\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n var self = this;\n setTimeout(function () {\n self.emit('error', 'No transports available');\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n this.readyState = 'opening';\n\n // Retry with the next transport if the transport is disabled (jsonp: false)\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n};\n\n/**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n\nSocket.prototype.setTransport = function (transport) {\n debug('setting transport %s', transport.name);\n var self = this;\n\n if (this.transport) {\n debug('clearing existing transport %s', this.transport.name);\n this.transport.removeAllListeners();\n }\n\n // set up transport\n this.transport = transport;\n\n // set up transport listeners\n transport\n .on('drain', function () {\n self.onDrain();\n })\n .on('packet', function (packet) {\n self.onPacket(packet);\n })\n .on('error', function (e) {\n self.onError(e);\n })\n .on('close', function () {\n self.onClose('transport close');\n });\n};\n\n/**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n\nSocket.prototype.probe = function (name) {\n debug('probing transport \"%s\"', name);\n var transport = this.createTransport(name, { probe: 1 });\n var failed = false;\n var self = this;\n\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen () {\n if (self.onlyBinaryUpgrades) {\n var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n if (failed) return;\n\n debug('probe transport \"%s\" opened', name);\n transport.send([{ type: 'ping', data: 'probe' }]);\n transport.once('packet', function (msg) {\n if (failed) return;\n if ('pong' === msg.type && 'probe' === msg.data) {\n debug('probe transport \"%s\" pong', name);\n self.upgrading = true;\n self.emit('upgrading', transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\n debug('pausing current transport \"%s\"', self.transport.name);\n self.transport.pause(function () {\n if (failed) return;\n if ('closed' === self.readyState) return;\n debug('changing transport and sending upgrade packet');\n\n cleanup();\n\n self.setTransport(transport);\n transport.send([{ type: 'upgrade' }]);\n self.emit('upgrade', transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n debug('probe transport \"%s\" failed', name);\n var err = new Error('probe error');\n err.transport = transport.name;\n self.emit('upgradeError', err);\n }\n });\n }\n\n function freezeTransport () {\n if (failed) return;\n\n // Any callback called by transport should be ignored since now\n failed = true;\n\n cleanup();\n\n transport.close();\n transport = null;\n }\n\n // Handle any error that happens while probing\n function onerror (err) {\n var error = new Error('probe error: ' + err);\n error.transport = transport.name;\n\n freezeTransport();\n\n debug('probe transport \"%s\" failed because of error: %s', name, err);\n\n self.emit('upgradeError', error);\n }\n\n function onTransportClose () {\n onerror('transport closed');\n }\n\n // When the socket is closed while we're probing\n function onclose () {\n onerror('socket closed');\n }\n\n // When the socket is upgraded while we're probing\n function onupgrade (to) {\n if (transport && to.name !== transport.name) {\n debug('\"%s\" works - aborting \"%s\"', to.name, transport.name);\n freezeTransport();\n }\n }\n\n // Remove all listeners on the transport and on self\n function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }\n\n transport.once('open', onTransportOpen);\n transport.once('error', onerror);\n transport.once('close', onTransportClose);\n\n this.once('close', onclose);\n this.once('upgrading', onupgrade);\n\n transport.open();\n};\n\n/**\n * Called when connection is deemed open.\n *\n * @api public\n */\n\nSocket.prototype.onOpen = function () {\n debug('socket open');\n this.readyState = 'open';\n Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n this.emit('open');\n this.flush();\n\n // we check for `readyState` in case an `open`\n // listener already closed the socket\n if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n debug('starting upgrade probes');\n for (var i = 0, l = this.upgrades.length; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n};\n\n/**\n * Handles a packet.\n *\n * @api private\n */\n\nSocket.prototype.onPacket = function (packet) {\n if ('opening' === this.readyState || 'open' === this.readyState ||\n 'closing' === this.readyState) {\n debug('socket receive: type \"%s\", data \"%s\"', packet.type, packet.data);\n\n this.emit('packet', packet);\n\n // Socket is live - any packet counts\n this.emit('heartbeat');\n\n switch (packet.type) {\n case 'open':\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case 'pong':\n this.setPing();\n this.emit('pong');\n break;\n\n case 'error':\n var err = new Error('server error');\n err.code = packet.data;\n this.onError(err);\n break;\n\n case 'message':\n this.emit('data', packet.data);\n this.emit('message', packet.data);\n break;\n }\n } else {\n debug('packet received with socket readyState \"%s\"', this.readyState);\n }\n};\n\n/**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n\nSocket.prototype.onHandshake = function (data) {\n this.emit('handshake', data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen();\n // In case open handler closes socket\n if ('closed' === this.readyState) return;\n this.setPing();\n\n // Prolong liveness of socket on heartbeat\n this.removeListener('heartbeat', this.onHeartbeat);\n this.on('heartbeat', this.onHeartbeat);\n};\n\n/**\n * Resets ping timeout.\n *\n * @api private\n */\n\nSocket.prototype.onHeartbeat = function (timeout) {\n clearTimeout(this.pingTimeoutTimer);\n var self = this;\n self.pingTimeoutTimer = setTimeout(function () {\n if ('closed' === self.readyState) return;\n self.onClose('ping timeout');\n }, timeout || (self.pingInterval + self.pingTimeout));\n};\n\n/**\n * Pings server every `this.pingInterval` and expects response\n * within `this.pingTimeout` or closes connection.\n *\n * @api private\n */\n\nSocket.prototype.setPing = function () {\n var self = this;\n clearTimeout(self.pingIntervalTimer);\n self.pingIntervalTimer = setTimeout(function () {\n debug('writing ping packet - expecting pong within %sms', self.pingTimeout);\n self.ping();\n self.onHeartbeat(self.pingTimeout);\n }, self.pingInterval);\n};\n\n/**\n* Sends a ping packet.\n*\n* @api private\n*/\n\nSocket.prototype.ping = function () {\n var self = this;\n this.sendPacket('ping', function () {\n self.emit('ping');\n });\n};\n\n/**\n * Called on `drain` event\n *\n * @api private\n */\n\nSocket.prototype.onDrain = function () {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit('drain');\n } else {\n this.flush();\n }\n};\n\n/**\n * Flush write buffers.\n *\n * @api private\n */\n\nSocket.prototype.flush = function () {\n if ('closed' !== this.readyState && this.transport.writable &&\n !this.upgrading && this.writeBuffer.length) {\n debug('flushing %d packets in socket', this.writeBuffer.length);\n this.transport.send(this.writeBuffer);\n // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n this.prevBufferLen = this.writeBuffer.length;\n this.emit('flush');\n }\n};\n\n/**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n\nSocket.prototype.write =\nSocket.prototype.send = function (msg, options, fn) {\n this.sendPacket('message', msg, options, fn);\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n\nSocket.prototype.sendPacket = function (type, data, options, fn) {\n if ('function' === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if ('function' === typeof options) {\n fn = options;\n options = null;\n }\n\n if ('closing' === this.readyState || 'closed' === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n\n var packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit('packetCreate', packet);\n this.writeBuffer.push(packet);\n if (fn) this.once('flush', fn);\n this.flush();\n};\n\n/**\n * Closes the connection.\n *\n * @api private\n */\n\nSocket.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.readyState = 'closing';\n\n var self = this;\n\n if (this.writeBuffer.length) {\n this.once('drain', function () {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close () {\n self.onClose('forced close');\n debug('socket closing - telling transport to close');\n self.transport.close();\n }\n\n function cleanupAndClose () {\n self.removeListener('upgrade', cleanupAndClose);\n self.removeListener('upgradeError', cleanupAndClose);\n close();\n }\n\n function waitForUpgrade () {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once('upgrade', cleanupAndClose);\n self.once('upgradeError', cleanupAndClose);\n }\n\n return this;\n};\n\n/**\n * Called upon transport error\n *\n * @api private\n */\n\nSocket.prototype.onError = function (err) {\n debug('socket error %j', err);\n Socket.priorWebsocketSuccess = false;\n this.emit('error', err);\n this.onClose('transport error', err);\n};\n\n/**\n * Called upon transport close.\n *\n * @api private\n */\n\nSocket.prototype.onClose = function (reason, desc) {\n if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n debug('socket close with reason: \"%s\"', reason);\n var self = this;\n\n // clear timers\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer);\n\n // stop event from firing again for transport\n this.transport.removeAllListeners('close');\n\n // ensure transport won't stay open\n this.transport.close();\n\n // ignore further transport communication\n this.transport.removeAllListeners();\n\n // set ready state\n this.readyState = 'closed';\n\n // clear session id\n this.id = null;\n\n // emit close event\n this.emit('close', reason, desc);\n\n // clean buffers after, so users can still\n // grab the buffers on `close` event\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n};\n\n/**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n\nSocket.prototype.filterUpgrades = function (upgrades) {\n var filteredUpgrades = [];\n for (var i = 0, j = upgrades.length; i < j; i++) {\n if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n }\n return filteredUpgrades;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/socket.js\n// module id = 17\n// module chunks = 0","/**\n * Module dependencies\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar XHR = require('./polling-xhr');\nvar JSONP = require('./polling-jsonp');\nvar websocket = require('./websocket');\n\n/**\n * Export transports.\n */\n\nexports.polling = polling;\nexports.websocket = websocket;\n\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling (opts) {\n var xhr;\n var xd = false;\n var xs = false;\n var jsonp = false !== opts.jsonp;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if ('open' in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error('JSONP disabled');\n return new JSONP(opts);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/index.js\n// module id = 18\n// module chunks = 0","// browser shim for xmlhttprequest module\n\nvar hasCORS = require('has-cors');\n\nmodule.exports = function (opts) {\n var xdomain = opts.xdomain;\n\n // scheme must be same when usign XDomainRequest\n // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n var xscheme = opts.xscheme;\n\n // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n // https://github.com/Automattic/engine.io-client/pull/217\n var enablesXDR = opts.enablesXDR;\n\n // XMLHttpRequest can be disabled on IE\n try {\n if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n return new XMLHttpRequest();\n }\n } catch (e) { }\n\n // Use XDomainRequest for IE8 if enablesXDR is true\n // because loading bar keeps flashing when using jsonp-polling\n // https://github.com/yujiosaka/socke.io-ie8-loading-example\n try {\n if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n return new XDomainRequest();\n }\n } catch (e) { }\n\n if (!xdomain) {\n try {\n return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n } catch (e) { }\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/xmlhttprequest.js\n// module id = 19\n// module chunks = 0","\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-cors/index.js\n// module id = 20\n// module chunks = 0","/* global attachEvent */\n\n/**\n * Module requirements.\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar Polling = require('./polling');\nvar Emitter = require('component-emitter');\nvar inherit = require('component-inherit');\nvar debug = require('debug')('engine.io-client:polling-xhr');\n\n/**\n * Module exports.\n */\n\nmodule.exports = XHR;\nmodule.exports.Request = Request;\n\n/**\n * Empty function\n */\n\nfunction empty () {}\n\n/**\n * XHR Polling constructor.\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction XHR (opts) {\n Polling.call(this, opts);\n this.requestTimeout = opts.requestTimeout;\n this.extraHeaders = opts.extraHeaders;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n port !== opts.port;\n this.xs = opts.secure !== isSSL;\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(XHR, Polling);\n\n/**\n * XHR supports binary\n */\n\nXHR.prototype.supportsBinary = true;\n\n/**\n * Creates a request.\n *\n * @param {String} method\n * @api private\n */\n\nXHR.prototype.request = function (opts) {\n opts = opts || {};\n opts.uri = this.uri();\n opts.xd = this.xd;\n opts.xs = this.xs;\n opts.agent = this.agent || false;\n opts.supportsBinary = this.supportsBinary;\n opts.enablesXDR = this.enablesXDR;\n opts.withCredentials = this.withCredentials;\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n opts.requestTimeout = this.requestTimeout;\n\n // other options for Node.js client\n opts.extraHeaders = this.extraHeaders;\n\n return new Request(opts);\n};\n\n/**\n * Sends data.\n *\n * @param {String} data to send.\n * @param {Function} called upon flush.\n * @api private\n */\n\nXHR.prototype.doWrite = function (data, fn) {\n var isBinary = typeof data !== 'string' && data !== undefined;\n var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n var self = this;\n req.on('success', fn);\n req.on('error', function (err) {\n self.onError('xhr post error', err);\n });\n this.sendXhr = req;\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nXHR.prototype.doPoll = function () {\n debug('xhr poll');\n var req = this.request();\n var self = this;\n req.on('data', function (data) {\n self.onData(data);\n });\n req.on('error', function (err) {\n self.onError('xhr poll error', err);\n });\n this.pollXhr = req;\n};\n\n/**\n * Request constructor\n *\n * @param {Object} options\n * @api public\n */\n\nfunction Request (opts) {\n this.method = opts.method || 'GET';\n this.uri = opts.uri;\n this.xd = !!opts.xd;\n this.xs = !!opts.xs;\n this.async = false !== opts.async;\n this.data = undefined !== opts.data ? opts.data : null;\n this.agent = opts.agent;\n this.isBinary = opts.isBinary;\n this.supportsBinary = opts.supportsBinary;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n this.requestTimeout = opts.requestTimeout;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n\n this.create();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Request.prototype);\n\n/**\n * Creates the XHR object and sends the request.\n *\n * @api private\n */\n\nRequest.prototype.create = function () {\n var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n\n var xhr = this.xhr = new XMLHttpRequest(opts);\n var self = this;\n\n try {\n debug('xhr open %s: %s', this.method, this.uri);\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (var i in this.extraHeaders) {\n if (this.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if ('POST' === this.method) {\n try {\n if (this.isBinary) {\n xhr.setRequestHeader('Content-type', 'application/octet-stream');\n } else {\n xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n }\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader('Accept', '*/*');\n } catch (e) {}\n\n // ie6 check\n if ('withCredentials' in xhr) {\n xhr.withCredentials = this.withCredentials;\n }\n\n if (this.requestTimeout) {\n xhr.timeout = this.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function () {\n self.onLoad();\n };\n xhr.onerror = function () {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 2) {\n try {\n var contentType = xhr.getResponseHeader('Content-Type');\n if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n xhr.responseType = 'arraybuffer';\n }\n } catch (e) {}\n }\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function () {\n self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n debug('xhr data %s', this.data);\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly fhrom the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function () {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== 'undefined') {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n};\n\n/**\n * Called upon successful response.\n *\n * @api private\n */\n\nRequest.prototype.onSuccess = function () {\n this.emit('success');\n this.cleanup();\n};\n\n/**\n * Called if we have data.\n *\n * @api private\n */\n\nRequest.prototype.onData = function (data) {\n this.emit('data', data);\n this.onSuccess();\n};\n\n/**\n * Called upon error.\n *\n * @api private\n */\n\nRequest.prototype.onError = function (err) {\n this.emit('error', err);\n this.cleanup(true);\n};\n\n/**\n * Cleans up house.\n *\n * @api private\n */\n\nRequest.prototype.cleanup = function (fromError) {\n if ('undefined' === typeof this.xhr || null === this.xhr) {\n return;\n }\n // xmlhttprequest\n if (this.hasXDR()) {\n this.xhr.onload = this.xhr.onerror = empty;\n } else {\n this.xhr.onreadystatechange = empty;\n }\n\n if (fromError) {\n try {\n this.xhr.abort();\n } catch (e) {}\n }\n\n if (typeof document !== 'undefined') {\n delete Request.requests[this.index];\n }\n\n this.xhr = null;\n};\n\n/**\n * Called upon load.\n *\n * @api private\n */\n\nRequest.prototype.onLoad = function () {\n var data;\n try {\n var contentType;\n try {\n contentType = this.xhr.getResponseHeader('Content-Type');\n } catch (e) {}\n if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n data = this.xhr.response || this.xhr.responseText;\n } else {\n data = this.xhr.responseText;\n }\n } catch (e) {\n this.onError(e);\n }\n if (null != data) {\n this.onData(data);\n }\n};\n\n/**\n * Check if it has XDomainRequest.\n *\n * @api private\n */\n\nRequest.prototype.hasXDR = function () {\n return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n};\n\n/**\n * Aborts the request.\n *\n * @api public\n */\n\nRequest.prototype.abort = function () {\n this.cleanup();\n};\n\n/**\n * Aborts pending requests when unloading the window. This is needed to prevent\n * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n * emitted.\n */\n\nRequest.requestsCount = 0;\nRequest.requests = {};\n\nif (typeof document !== 'undefined') {\n if (typeof attachEvent === 'function') {\n attachEvent('onunload', unloadHandler);\n } else if (typeof addEventListener === 'function') {\n var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';\n addEventListener(terminationEvent, unloadHandler, false);\n }\n}\n\nfunction unloadHandler () {\n for (var i in Request.requests) {\n if (Request.requests.hasOwnProperty(i)) {\n Request.requests[i].abort();\n }\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-xhr.js\n// module id = 21\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parseqs = require('parseqs');\nvar parser = require('engine.io-parser');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:polling');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Polling;\n\n/**\n * Is XHR2 supported?\n */\n\nvar hasXHR2 = (function () {\n var XMLHttpRequest = require('xmlhttprequest-ssl');\n var xhr = new XMLHttpRequest({ xdomain: false });\n return null != xhr.responseType;\n})();\n\n/**\n * Polling interface.\n *\n * @param {Object} opts\n * @api private\n */\n\nfunction Polling (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (!hasXHR2 || forceBase64) {\n this.supportsBinary = false;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(Polling, Transport);\n\n/**\n * Transport name.\n */\n\nPolling.prototype.name = 'polling';\n\n/**\n * Opens the socket (triggers polling). We write a PING message to determine\n * when the transport is open.\n *\n * @api private\n */\n\nPolling.prototype.doOpen = function () {\n this.poll();\n};\n\n/**\n * Pauses polling.\n *\n * @param {Function} callback upon buffers are flushed and transport is paused\n * @api private\n */\n\nPolling.prototype.pause = function (onPause) {\n var self = this;\n\n this.readyState = 'pausing';\n\n function pause () {\n debug('paused');\n self.readyState = 'paused';\n onPause();\n }\n\n if (this.polling || !this.writable) {\n var total = 0;\n\n if (this.polling) {\n debug('we are currently polling - waiting to pause');\n total++;\n this.once('pollComplete', function () {\n debug('pre-pause polling complete');\n --total || pause();\n });\n }\n\n if (!this.writable) {\n debug('we are currently writing - waiting to pause');\n total++;\n this.once('drain', function () {\n debug('pre-pause writing complete');\n --total || pause();\n });\n }\n } else {\n pause();\n }\n};\n\n/**\n * Starts polling cycle.\n *\n * @api public\n */\n\nPolling.prototype.poll = function () {\n debug('polling');\n this.polling = true;\n this.doPoll();\n this.emit('poll');\n};\n\n/**\n * Overloads onData to detect payloads.\n *\n * @api private\n */\n\nPolling.prototype.onData = function (data) {\n var self = this;\n debug('polling got data %s', data);\n var callback = function (packet, index, total) {\n // if its the first message we consider the transport open\n if ('opening' === self.readyState) {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if ('close' === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType, callback);\n\n // if an event did not trigger closing\n if ('closed' !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit('pollComplete');\n\n if ('open' === this.readyState) {\n this.poll();\n } else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n};\n\n/**\n * For polling, send a close packet.\n *\n * @api private\n */\n\nPolling.prototype.doClose = function () {\n var self = this;\n\n function close () {\n debug('writing close packet');\n self.write([{ type: 'close' }]);\n }\n\n if ('open' === this.readyState) {\n debug('transport open - closing');\n close();\n } else {\n // in case we're trying to close while\n // handshaking is in progress (GH-164)\n debug('transport not open - deferring close');\n this.once('open', close);\n }\n};\n\n/**\n * Writes a packets payload.\n *\n * @param {Array} data packets\n * @param {Function} drain callback\n * @api private\n */\n\nPolling.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n var callbackfn = function () {\n self.writable = true;\n self.emit('drain');\n };\n\n parser.encodePayload(packets, this.supportsBinary, function (data) {\n self.doWrite(data, callbackfn);\n });\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nPolling.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'https' : 'http';\n var port = '';\n\n // cache busting is forced\n if (false !== this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n if (!this.supportsBinary && !query.sid) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // avoid port if default for schema\n if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n ('http' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling.js\n// module id = 22\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar parser = require('engine.io-parser');\nvar Emitter = require('component-emitter');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Transport;\n\n/**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n\nfunction Transport (opts) {\n this.path = opts.path;\n this.hostname = opts.hostname;\n this.port = opts.port;\n this.secure = opts.secure;\n this.query = opts.query;\n this.timestampParam = opts.timestampParam;\n this.timestampRequests = opts.timestampRequests;\n this.readyState = '';\n this.agent = opts.agent || false;\n this.socket = opts.socket;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n this.forceNode = opts.forceNode;\n\n // results of ReactNative environment detection\n this.isReactNative = opts.isReactNative;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n this.localAddress = opts.localAddress;\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Transport.prototype);\n\n/**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n\nTransport.prototype.onError = function (msg, desc) {\n var err = new Error(msg);\n err.type = 'TransportError';\n err.description = desc;\n this.emit('error', err);\n return this;\n};\n\n/**\n * Opens the transport.\n *\n * @api public\n */\n\nTransport.prototype.open = function () {\n if ('closed' === this.readyState || '' === this.readyState) {\n this.readyState = 'opening';\n this.doOpen();\n }\n\n return this;\n};\n\n/**\n * Closes the transport.\n *\n * @api private\n */\n\nTransport.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n};\n\n/**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n\nTransport.prototype.send = function (packets) {\n if ('open' === this.readyState) {\n this.write(packets);\n } else {\n throw new Error('Transport not open');\n }\n};\n\n/**\n * Called upon open\n *\n * @api private\n */\n\nTransport.prototype.onOpen = function () {\n this.readyState = 'open';\n this.writable = true;\n this.emit('open');\n};\n\n/**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n\nTransport.prototype.onData = function (data) {\n var packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n};\n\n/**\n * Called with a decoded packet.\n */\n\nTransport.prototype.onPacket = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon close.\n *\n * @api private\n */\n\nTransport.prototype.onClose = function () {\n this.readyState = 'closed';\n this.emit('close');\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transport.js\n// module id = 23\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar keys = require('./keys');\nvar hasBinary = require('has-binary2');\nvar sliceBuffer = require('arraybuffer.slice');\nvar after = require('after');\nvar utf8 = require('./utf8');\n\nvar base64encoder;\nif (typeof ArrayBuffer !== 'undefined') {\n base64encoder = require('base64-arraybuffer');\n}\n\n/**\n * Check if we are running an android browser. That requires us to use\n * ArrayBuffer with polling transports...\n *\n * http://ghinda.net/jpeg-blob-ajax-android/\n */\n\nvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\n/**\n * Check if we are running in PhantomJS.\n * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n * https://github.com/ariya/phantomjs/issues/11395\n * @type boolean\n */\nvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\n/**\n * When true, avoids using Blobs to encode payloads.\n * @type boolean\n */\nvar dontSendBlobs = isAndroid || isPhantomJS;\n\n/**\n * Current protocol version.\n */\n\nexports.protocol = 3;\n\n/**\n * Packet types.\n */\n\nvar packets = exports.packets = {\n open: 0 // non-ws\n , close: 1 // non-ws\n , ping: 2\n , pong: 3\n , message: 4\n , upgrade: 5\n , noop: 6\n};\n\nvar packetslist = keys(packets);\n\n/**\n * Premade error packet.\n */\n\nvar err = { type: 'error', data: 'parser error' };\n\n/**\n * Create a blob api even for blob builder when vendor prefixes exist\n */\n\nvar Blob = require('blob');\n\n/**\n * Encodes a packet.\n *\n * <packet type id> [ <data> ]\n *\n * Example:\n *\n * 5hello world\n * 3\n * 4\n *\n * Binary is encoded in an identical principle\n *\n * @api private\n */\n\nexports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = false;\n }\n\n if (typeof utf8encode === 'function') {\n callback = utf8encode;\n utf8encode = null;\n }\n\n var data = (packet.data === undefined)\n ? undefined\n : packet.data.buffer || packet.data;\n\n if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n return encodeArrayBuffer(packet, supportsBinary, callback);\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return encodeBlob(packet, supportsBinary, callback);\n }\n\n // might be an object with { base64: true, data: dataAsBase64String }\n if (data && data.base64) {\n return encodeBase64Object(packet, callback);\n }\n\n // Sending data as a utf-8 string\n var encoded = packets[packet.type];\n\n // data fragment is optional\n if (undefined !== packet.data) {\n encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n }\n\n return callback('' + encoded);\n\n};\n\nfunction encodeBase64Object(packet, callback) {\n // packet data is an object { base64: true, data: dataAsBase64String }\n var message = 'b' + exports.packets[packet.type] + packet.data.data;\n return callback(message);\n}\n\n/**\n * Encode packet helpers for binary types\n */\n\nfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var data = packet.data;\n var contentArray = new Uint8Array(data);\n var resultBuffer = new Uint8Array(1 + data.byteLength);\n\n resultBuffer[0] = packets[packet.type];\n for (var i = 0; i < contentArray.length; i++) {\n resultBuffer[i+1] = contentArray[i];\n }\n\n return callback(resultBuffer.buffer);\n}\n\nfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var fr = new FileReader();\n fr.onload = function() {\n exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n };\n return fr.readAsArrayBuffer(packet.data);\n}\n\nfunction encodeBlob(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n if (dontSendBlobs) {\n return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n }\n\n var length = new Uint8Array(1);\n length[0] = packets[packet.type];\n var blob = new Blob([length.buffer, packet.data]);\n\n return callback(blob);\n}\n\n/**\n * Encodes a packet with binary data in a base64 string\n *\n * @param {Object} packet, has `type` and `data`\n * @return {String} base64 encoded message\n */\n\nexports.encodeBase64Packet = function(packet, callback) {\n var message = 'b' + exports.packets[packet.type];\n if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n var fr = new FileReader();\n fr.onload = function() {\n var b64 = fr.result.split(',')[1];\n callback(message + b64);\n };\n return fr.readAsDataURL(packet.data);\n }\n\n var b64data;\n try {\n b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n } catch (e) {\n // iPhone Safari doesn't let you apply with typed arrays\n var typed = new Uint8Array(packet.data);\n var basic = new Array(typed.length);\n for (var i = 0; i < typed.length; i++) {\n basic[i] = typed[i];\n }\n b64data = String.fromCharCode.apply(null, basic);\n }\n message += btoa(b64data);\n return callback(message);\n};\n\n/**\n * Decodes a packet. Changes format to Blob if requested.\n *\n * @return {Object} with `type` and `data` (if any)\n * @api private\n */\n\nexports.decodePacket = function (data, binaryType, utf8decode) {\n if (data === undefined) {\n return err;\n }\n // String data\n if (typeof data === 'string') {\n if (data.charAt(0) === 'b') {\n return exports.decodeBase64Packet(data.substr(1), binaryType);\n }\n\n if (utf8decode) {\n data = tryDecode(data);\n if (data === false) {\n return err;\n }\n }\n var type = data.charAt(0);\n\n if (Number(type) != type || !packetslist[type]) {\n return err;\n }\n\n if (data.length > 1) {\n return { type: packetslist[type], data: data.substring(1) };\n } else {\n return { type: packetslist[type] };\n }\n }\n\n var asArray = new Uint8Array(data);\n var type = asArray[0];\n var rest = sliceBuffer(data, 1);\n if (Blob && binaryType === 'blob') {\n rest = new Blob([rest]);\n }\n return { type: packetslist[type], data: rest };\n};\n\nfunction tryDecode(data) {\n try {\n data = utf8.decode(data, { strict: false });\n } catch (e) {\n return false;\n }\n return data;\n}\n\n/**\n * Decodes a packet encoded in a base64 string\n *\n * @param {String} base64 encoded message\n * @return {Object} with `type` and `data` (if any)\n */\n\nexports.decodeBase64Packet = function(msg, binaryType) {\n var type = packetslist[msg.charAt(0)];\n if (!base64encoder) {\n return { type: type, data: { base64: true, data: msg.substr(1) } };\n }\n\n var data = base64encoder.decode(msg.substr(1));\n\n if (binaryType === 'blob' && Blob) {\n data = new Blob([data]);\n }\n\n return { type: type, data: data };\n};\n\n/**\n * Encodes multiple messages (payload).\n *\n * <length>:data\n *\n * Example:\n *\n * 11:hello world2:hi\n *\n * If any contents are binary, they will be encoded as base64 strings. Base64\n * encoded strings are marked with a b before the length specifier\n *\n * @param {Array} packets\n * @api private\n */\n\nexports.encodePayload = function (packets, supportsBinary, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = null;\n }\n\n var isBinary = hasBinary(packets);\n\n if (supportsBinary && isBinary) {\n if (Blob && !dontSendBlobs) {\n return exports.encodePayloadAsBlob(packets, callback);\n }\n\n return exports.encodePayloadAsArrayBuffer(packets, callback);\n }\n\n if (!packets.length) {\n return callback('0:');\n }\n\n function setLengthHeader(message) {\n return message.length + ':' + message;\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n doneCallback(null, setLengthHeader(message));\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(results.join(''));\n });\n};\n\n/**\n * Async array map using after\n */\n\nfunction map(ary, each, done) {\n var result = new Array(ary.length);\n var next = after(ary.length, done);\n\n var eachWithIndex = function(i, el, cb) {\n each(el, function(error, msg) {\n result[i] = msg;\n cb(error, result);\n });\n };\n\n for (var i = 0; i < ary.length; i++) {\n eachWithIndex(i, ary[i], next);\n }\n}\n\n/*\n * Decodes data when a payload is maybe expected. Possible binary contents are\n * decoded from their base64 representation\n *\n * @param {String} data, callback method\n * @api public\n */\n\nexports.decodePayload = function (data, binaryType, callback) {\n if (typeof data !== 'string') {\n return exports.decodePayloadAsBinary(data, binaryType, callback);\n }\n\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var packet;\n if (data === '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n var length = '', n, msg;\n\n for (var i = 0, l = data.length; i < l; i++) {\n var chr = data.charAt(i);\n\n if (chr !== ':') {\n length += chr;\n continue;\n }\n\n if (length === '' || (length != (n = Number(length)))) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n msg = data.substr(i + 1, n);\n\n if (length != msg.length) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n if (msg.length) {\n packet = exports.decodePacket(msg, binaryType, false);\n\n if (err.type === packet.type && err.data === packet.data) {\n // parser error in individual packet - ignoring payload\n return callback(err, 0, 1);\n }\n\n var ret = callback(packet, i + n, l);\n if (false === ret) return;\n }\n\n // advance cursor\n i += n;\n length = '';\n }\n\n if (length !== '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n};\n\n/**\n * Encodes multiple messages (payload) as binary.\n *\n * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n * 255><data>\n *\n * Example:\n * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n *\n * @param {Array} packets\n * @return {ArrayBuffer} encoded payload\n * @api private\n */\n\nexports.encodePayloadAsArrayBuffer = function(packets, callback) {\n if (!packets.length) {\n return callback(new ArrayBuffer(0));\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(data) {\n return doneCallback(null, data);\n });\n }\n\n map(packets, encodeOne, function(err, encodedPackets) {\n var totalLength = encodedPackets.reduce(function(acc, p) {\n var len;\n if (typeof p === 'string'){\n len = p.length;\n } else {\n len = p.byteLength;\n }\n return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n }, 0);\n\n var resultArray = new Uint8Array(totalLength);\n\n var bufferIndex = 0;\n encodedPackets.forEach(function(p) {\n var isString = typeof p === 'string';\n var ab = p;\n if (isString) {\n var view = new Uint8Array(p.length);\n for (var i = 0; i < p.length; i++) {\n view[i] = p.charCodeAt(i);\n }\n ab = view.buffer;\n }\n\n if (isString) { // not true binary\n resultArray[bufferIndex++] = 0;\n } else { // true binary\n resultArray[bufferIndex++] = 1;\n }\n\n var lenStr = ab.byteLength.toString();\n for (var i = 0; i < lenStr.length; i++) {\n resultArray[bufferIndex++] = parseInt(lenStr[i]);\n }\n resultArray[bufferIndex++] = 255;\n\n var view = new Uint8Array(ab);\n for (var i = 0; i < view.length; i++) {\n resultArray[bufferIndex++] = view[i];\n }\n });\n\n return callback(resultArray.buffer);\n });\n};\n\n/**\n * Encode as Blob\n */\n\nexports.encodePayloadAsBlob = function(packets, callback) {\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(encoded) {\n var binaryIdentifier = new Uint8Array(1);\n binaryIdentifier[0] = 1;\n if (typeof encoded === 'string') {\n var view = new Uint8Array(encoded.length);\n for (var i = 0; i < encoded.length; i++) {\n view[i] = encoded.charCodeAt(i);\n }\n encoded = view.buffer;\n binaryIdentifier[0] = 0;\n }\n\n var len = (encoded instanceof ArrayBuffer)\n ? encoded.byteLength\n : encoded.size;\n\n var lenStr = len.toString();\n var lengthAry = new Uint8Array(lenStr.length + 1);\n for (var i = 0; i < lenStr.length; i++) {\n lengthAry[i] = parseInt(lenStr[i]);\n }\n lengthAry[lenStr.length] = 255;\n\n if (Blob) {\n var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n doneCallback(null, blob);\n }\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(new Blob(results));\n });\n};\n\n/*\n * Decodes data when a payload is maybe expected. Strings are decoded by\n * interpreting each byte as a key code for entries marked to start with 0. See\n * description of encodePayloadAsBinary\n *\n * @param {ArrayBuffer} data, callback method\n * @api public\n */\n\nexports.decodePayloadAsBinary = function (data, binaryType, callback) {\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var bufferTail = data;\n var buffers = [];\n\n while (bufferTail.byteLength > 0) {\n var tailArray = new Uint8Array(bufferTail);\n var isString = tailArray[0] === 0;\n var msgLength = '';\n\n for (var i = 1; ; i++) {\n if (tailArray[i] === 255) break;\n\n // 310 = char length of Number.MAX_VALUE\n if (msgLength.length > 310) {\n return callback(err, 0, 1);\n }\n\n msgLength += tailArray[i];\n }\n\n bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n msgLength = parseInt(msgLength);\n\n var msg = sliceBuffer(bufferTail, 0, msgLength);\n if (isString) {\n try {\n msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n } catch (e) {\n // iPhone Safari doesn't let you apply to typed arrays\n var typed = new Uint8Array(msg);\n msg = '';\n for (var i = 0; i < typed.length; i++) {\n msg += String.fromCharCode(typed[i]);\n }\n }\n }\n\n buffers.push(msg);\n bufferTail = sliceBuffer(bufferTail, msgLength);\n }\n\n var total = buffers.length;\n buffers.forEach(function(buffer, i) {\n callback(exports.decodePacket(buffer, binaryType, true), i, total);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/browser.js\n// module id = 24\n// module chunks = 0","\n/**\n * Gets the keys for an object.\n *\n * @return {Array} keys\n * @api private\n */\n\nmodule.exports = Object.keys || function keys (obj){\n var arr = [];\n var has = Object.prototype.hasOwnProperty;\n\n for (var i in obj) {\n if (has.call(obj, i)) {\n arr.push(i);\n }\n }\n return arr;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/keys.js\n// module id = 25\n// module chunks = 0","/* global Blob File */\n\n/*\n * Module requirements.\n */\n\nvar isArray = require('isarray');\n\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' ||\n typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\nvar withNativeFile = typeof File === 'function' ||\n typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\n/**\n * Module exports.\n */\n\nmodule.exports = hasBinary;\n\n/**\n * Checks for binary data.\n *\n * Supports Buffer, ArrayBuffer, Blob and File.\n *\n * @param {Object} anything\n * @api public\n */\n\nfunction hasBinary (obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n if (isArray(obj)) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (hasBinary(obj[i])) {\n return true;\n }\n }\n return false;\n }\n\n if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n (withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)\n ) {\n return true;\n }\n\n // see: https://github.com/Automattic/has-binary/pull/4\n if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n return hasBinary(obj.toJSON(), true);\n }\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n return true;\n }\n }\n\n return false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-binary2/index.js\n// module id = 26\n// module chunks = 0","/**\n * An abstraction for slicing an arraybuffer even when\n * ArrayBuffer.prototype.slice is not supported\n *\n * @api public\n */\n\nmodule.exports = function(arraybuffer, start, end) {\n var bytes = arraybuffer.byteLength;\n start = start || 0;\n end = end || bytes;\n\n if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\n if (start < 0) { start += bytes; }\n if (end < 0) { end += bytes; }\n if (end > bytes) { end = bytes; }\n\n if (start >= bytes || start >= end || bytes === 0) {\n return new ArrayBuffer(0);\n }\n\n var abv = new Uint8Array(arraybuffer);\n var result = new Uint8Array(end - start);\n for (var i = start, ii = 0; i < end; i++, ii++) {\n result[ii] = abv[i];\n }\n return result.buffer;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/arraybuffer.slice/index.js\n// module id = 27\n// module chunks = 0","module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/after/index.js\n// module id = 28\n// module chunks = 0","/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\nvar stringFromCharCode = String.fromCharCode;\n\n// Taken from https://mths.be/punycode\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\tvar value;\n\tvar extra;\n\twhile (counter < length) {\n\t\tvalue = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// high surrogate, and there is a next character\n\t\t\textra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n// Taken from https://mths.be/punycode\nfunction ucs2encode(array) {\n\tvar length = array.length;\n\tvar index = -1;\n\tvar value;\n\tvar output = '';\n\twhile (++index < length) {\n\t\tvalue = array[index];\n\t\tif (value > 0xFFFF) {\n\t\t\tvalue -= 0x10000;\n\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t}\n\t\toutput += stringFromCharCode(value);\n\t}\n\treturn output;\n}\n\nfunction checkScalarValue(codePoint, strict) {\n\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\tif (strict) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n/*--------------------------------------------------------------------------*/\n\nfunction createByte(codePoint, shift) {\n\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n}\n\nfunction encodeCodePoint(codePoint, strict) {\n\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\treturn stringFromCharCode(codePoint);\n\t}\n\tvar symbol = '';\n\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t}\n\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\tcodePoint = 0xFFFD;\n\t\t}\n\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\tsymbol += createByte(codePoint, 12);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\treturn symbol;\n}\n\nfunction utf8encode(string, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tvar codePoints = ucs2decode(string);\n\tvar length = codePoints.length;\n\tvar index = -1;\n\tvar codePoint;\n\tvar byteString = '';\n\twhile (++index < length) {\n\t\tcodePoint = codePoints[index];\n\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t}\n\treturn byteString;\n}\n\n/*--------------------------------------------------------------------------*/\n\nfunction readContinuationByte() {\n\tif (byteIndex >= byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\tif ((continuationByte & 0xC0) == 0x80) {\n\t\treturn continuationByte & 0x3F;\n\t}\n\n\t// If we end up here, it’s not a continuation byte\n\tthrow Error('Invalid continuation byte');\n}\n\nfunction decodeSymbol(strict) {\n\tvar byte1;\n\tvar byte2;\n\tvar byte3;\n\tvar byte4;\n\tvar codePoint;\n\n\tif (byteIndex > byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tif (byteIndex == byteCount) {\n\t\treturn false;\n\t}\n\n\t// Read first byte\n\tbyte1 = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\t// 1-byte sequence (no continuation bytes)\n\tif ((byte1 & 0x80) == 0) {\n\t\treturn byte1;\n\t}\n\n\t// 2-byte sequence\n\tif ((byte1 & 0xE0) == 0xC0) {\n\t\tbyte2 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\tif (codePoint >= 0x80) {\n\t\t\treturn codePoint;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 3-byte sequence (may include unpaired surrogates)\n\tif ((byte1 & 0xF0) == 0xE0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\tif (codePoint >= 0x0800) {\n\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 4-byte sequence\n\tif ((byte1 & 0xF8) == 0xF0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tbyte4 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t(byte3 << 0x06) | byte4;\n\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\treturn codePoint;\n\t\t}\n\t}\n\n\tthrow Error('Invalid UTF-8 detected');\n}\n\nvar byteArray;\nvar byteCount;\nvar byteIndex;\nfunction utf8decode(byteString, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tbyteArray = ucs2decode(byteString);\n\tbyteCount = byteArray.length;\n\tbyteIndex = 0;\n\tvar codePoints = [];\n\tvar tmp;\n\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\tcodePoints.push(tmp);\n\t}\n\treturn ucs2encode(codePoints);\n}\n\nmodule.exports = {\n\tversion: '2.1.2',\n\tencode: utf8encode,\n\tdecode: utf8decode\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/utf8.js\n// module id = 29\n// module chunks = 0","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(){\n \"use strict\";\n\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n // Use a lookup table to find the index.\n var lookup = new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i+1)];\n encoded3 = lookup[base64.charCodeAt(i+2)];\n encoded4 = lookup[base64.charCodeAt(i+3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-arraybuffer/lib/base64-arraybuffer.js\n// module id = 30\n// module chunks = 0","/**\r\n * Create a blob builder even when vendor prefixes exist\r\n */\r\n\r\nvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n false;\r\n\r\n/**\r\n * Check if Blob constructor is supported\r\n */\r\n\r\nvar blobSupported = (function() {\r\n try {\r\n var a = new Blob(['hi']);\r\n return a.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if Blob constructor supports ArrayBufferViews\r\n * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n */\r\n\r\nvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n try {\r\n var b = new Blob([new Uint8Array([1,2])]);\r\n return b.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if BlobBuilder is supported\r\n */\r\n\r\nvar blobBuilderSupported = BlobBuilder\r\n && BlobBuilder.prototype.append\r\n && BlobBuilder.prototype.getBlob;\r\n\r\n/**\r\n * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n * Used by BlobBuilder constructor and old browsers that didn't\r\n * support it in the Blob constructor.\r\n */\r\n\r\nfunction mapArrayBufferViews(ary) {\r\n return ary.map(function(chunk) {\r\n if (chunk.buffer instanceof ArrayBuffer) {\r\n var buf = chunk.buffer;\r\n\r\n // if this is a subarray, make a copy so we only\r\n // include the subarray region from the underlying buffer\r\n if (chunk.byteLength !== buf.byteLength) {\r\n var copy = new Uint8Array(chunk.byteLength);\r\n copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n buf = copy.buffer;\r\n }\r\n\r\n return buf;\r\n }\r\n\r\n return chunk;\r\n });\r\n}\r\n\r\nfunction BlobBuilderConstructor(ary, options) {\r\n options = options || {};\r\n\r\n var bb = new BlobBuilder();\r\n mapArrayBufferViews(ary).forEach(function(part) {\r\n bb.append(part);\r\n });\r\n\r\n return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n};\r\n\r\nfunction BlobConstructor(ary, options) {\r\n return new Blob(mapArrayBufferViews(ary), options || {});\r\n};\r\n\r\nif (typeof Blob !== 'undefined') {\r\n BlobBuilderConstructor.prototype = Blob.prototype;\r\n BlobConstructor.prototype = Blob.prototype;\r\n}\r\n\r\nmodule.exports = (function() {\r\n if (blobSupported) {\r\n return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n } else if (blobBuilderSupported) {\r\n return BlobBuilderConstructor;\r\n } else {\r\n return undefined;\r\n }\r\n})();\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/blob/index.js\n// module id = 31\n// module chunks = 0","/**\r\n * Compiles a querystring\r\n * Returns string representation of the object\r\n *\r\n * @param {Object}\r\n * @api private\r\n */\r\n\r\nexports.encode = function (obj) {\r\n var str = '';\r\n\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n if (str.length) str += '&';\r\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\r\n }\r\n }\r\n\r\n return str;\r\n};\r\n\r\n/**\r\n * Parses a simple querystring into an object\r\n *\r\n * @param {String} qs\r\n * @api private\r\n */\r\n\r\nexports.decode = function(qs){\r\n var qry = {};\r\n var pairs = qs.split('&');\r\n for (var i = 0, l = pairs.length; i < l; i++) {\r\n var pair = pairs[i].split('=');\r\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\r\n }\r\n return qry;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseqs/index.js\n// module id = 32\n// module chunks = 0","\nmodule.exports = function(a, b){\n var fn = function(){};\n fn.prototype = b.prototype;\n a.prototype = new fn;\n a.prototype.constructor = a;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-inherit/index.js\n// module id = 33\n// module chunks = 0","'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/yeast/index.js\n// module id = 34\n// module chunks = 0","/**\n * Module requirements.\n */\n\nvar Polling = require('./polling');\nvar inherit = require('component-inherit');\n\n/**\n * Module exports.\n */\n\nmodule.exports = JSONPPolling;\n\n/**\n * Cached regular expressions.\n */\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n\n/**\n * Noop.\n */\n\nfunction empty () { }\n\n/**\n * Until https://github.com/tc39/proposal-global is shipped.\n */\nfunction glob () {\n return typeof self !== 'undefined' ? self\n : typeof window !== 'undefined' ? window\n : typeof global !== 'undefined' ? global : {};\n}\n\n/**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n\nfunction JSONPPolling (opts) {\n Polling.call(this, opts);\n\n this.query = this.query || {};\n\n // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n var global = glob();\n callbacks = global.___eio = (global.___eio || []);\n }\n\n // callback identifier\n this.index = callbacks.length;\n\n // add callback to jsonp global\n var self = this;\n callbacks.push(function (msg) {\n self.onData(msg);\n });\n\n // append to query string\n this.query.j = this.index;\n\n // prevent spurious errors from being emitted when the window is unloaded\n if (typeof addEventListener === 'function') {\n addEventListener('beforeunload', function () {\n if (self.script) self.script.onerror = empty;\n }, false);\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(JSONPPolling, Polling);\n\n/*\n * JSONP only supports binary as base64 encoded strings\n */\n\nJSONPPolling.prototype.supportsBinary = false;\n\n/**\n * Closes the socket.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doClose = function () {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n Polling.prototype.doClose.call(this);\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doPoll = function () {\n var self = this;\n var script = document.createElement('script');\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n script.onerror = function (e) {\n self.onError('jsonp poll error', e);\n };\n\n var insertAt = document.getElementsByTagName('script')[0];\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n this.script = script;\n\n var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function () {\n var iframe = document.createElement('iframe');\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n};\n\n/**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n\nJSONPPolling.prototype.doWrite = function (data, fn) {\n var self = this;\n\n if (!this.form) {\n var form = document.createElement('form');\n var area = document.createElement('textarea');\n var id = this.iframeId = 'eio_iframe_' + this.index;\n var iframe;\n\n form.className = 'socketio';\n form.style.position = 'absolute';\n form.style.top = '-1000px';\n form.style.left = '-1000px';\n form.target = id;\n form.method = 'POST';\n form.setAttribute('accept-charset', 'utf-8');\n area.name = 'd';\n form.appendChild(area);\n document.body.appendChild(form);\n\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete () {\n initIframe();\n fn();\n }\n\n function initIframe () {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError('jsonp polling iframe removal error', e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n iframe = document.createElement(html);\n } catch (e) {\n iframe = document.createElement('iframe');\n iframe.name = self.iframeId;\n iframe.src = 'javascript:0';\n }\n\n iframe.id = self.iframeId;\n\n self.form.appendChild(iframe);\n self.iframe = iframe;\n }\n\n initIframe();\n\n // escape \\n to prevent it from being converted into \\r\\n by some UAs\n // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n data = data.replace(rEscapedNewline, '\\\\\\n');\n this.area.value = data.replace(rNewline, '\\\\n');\n\n try {\n this.form.submit();\n } catch (e) {}\n\n if (this.iframe.attachEvent) {\n this.iframe.onreadystatechange = function () {\n if (self.iframe.readyState === 'complete') {\n complete();\n }\n };\n } else {\n this.iframe.onload = complete;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-jsonp.js\n// module id = 35\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parser = require('engine.io-parser');\nvar parseqs = require('parseqs');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:websocket');\n\nvar BrowserWebSocket, NodeWebSocket;\n\nif (typeof WebSocket !== 'undefined') {\n BrowserWebSocket = WebSocket;\n} else if (typeof self !== 'undefined') {\n BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n}\n\nif (typeof window === 'undefined') {\n try {\n NodeWebSocket = require('ws');\n } catch (e) { }\n}\n\n/**\n * Get either the `WebSocket` or `MozWebSocket` globals\n * in the browser or try to resolve WebSocket-compatible\n * interface exposed by `ws` for Node-like environment.\n */\n\nvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\n/**\n * Module exports.\n */\n\nmodule.exports = WS;\n\n/**\n * WebSocket transport constructor.\n *\n * @api {Object} connection options\n * @api public\n */\n\nfunction WS (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (forceBase64) {\n this.supportsBinary = false;\n }\n this.perMessageDeflate = opts.perMessageDeflate;\n this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n this.protocols = opts.protocols;\n if (!this.usingBrowserWebSocket) {\n WebSocketImpl = NodeWebSocket;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(WS, Transport);\n\n/**\n * Transport name.\n *\n * @api public\n */\n\nWS.prototype.name = 'websocket';\n\n/*\n * WebSockets support binary\n */\n\nWS.prototype.supportsBinary = true;\n\n/**\n * Opens socket.\n *\n * @api private\n */\n\nWS.prototype.doOpen = function () {\n if (!this.check()) {\n // let probe timeout\n return;\n }\n\n var uri = this.uri();\n var protocols = this.protocols;\n var opts = {\n agent: this.agent,\n perMessageDeflate: this.perMessageDeflate\n };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n if (this.extraHeaders) {\n opts.headers = this.extraHeaders;\n }\n if (this.localAddress) {\n opts.localAddress = this.localAddress;\n }\n\n try {\n this.ws =\n this.usingBrowserWebSocket && !this.isReactNative\n ? protocols\n ? new WebSocketImpl(uri, protocols)\n : new WebSocketImpl(uri)\n : new WebSocketImpl(uri, protocols, opts);\n } catch (err) {\n return this.emit('error', err);\n }\n\n if (this.ws.binaryType === undefined) {\n this.supportsBinary = false;\n }\n\n if (this.ws.supports && this.ws.supports.binary) {\n this.supportsBinary = true;\n this.ws.binaryType = 'nodebuffer';\n } else {\n this.ws.binaryType = 'arraybuffer';\n }\n\n this.addEventListeners();\n};\n\n/**\n * Adds event listeners to the socket\n *\n * @api private\n */\n\nWS.prototype.addEventListeners = function () {\n var self = this;\n\n this.ws.onopen = function () {\n self.onOpen();\n };\n this.ws.onclose = function () {\n self.onClose();\n };\n this.ws.onmessage = function (ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function (e) {\n self.onError('websocket error', e);\n };\n};\n\n/**\n * Writes data to socket.\n *\n * @param {Array} array of packets.\n * @api private\n */\n\nWS.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n\n // encodePacket efficient as it uses WS framing\n // no need for encodePayload\n var total = packets.length;\n for (var i = 0, l = total; i < l; i++) {\n (function (packet) {\n parser.encodePacket(packet, self.supportsBinary, function (data) {\n if (!self.usingBrowserWebSocket) {\n // always create a new object (GH-437)\n var opts = {};\n if (packet.options) {\n opts.compress = packet.options.compress;\n }\n\n if (self.perMessageDeflate) {\n var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n if (len < self.perMessageDeflate.threshold) {\n opts.compress = false;\n }\n }\n }\n\n // Sometimes the websocket has already been closed but the browser didn't\n // have a chance of informing us about it yet, in that case send will\n // throw an error\n try {\n if (self.usingBrowserWebSocket) {\n // TypeError is thrown when passing the second argument on Safari\n self.ws.send(data);\n } else {\n self.ws.send(data, opts);\n }\n } catch (e) {\n debug('websocket closed before onclose event');\n }\n\n --total || done();\n });\n })(packets[i]);\n }\n\n function done () {\n self.emit('flush');\n\n // fake drain\n // defer to next tick to allow Socket to clear writeBuffer\n setTimeout(function () {\n self.writable = true;\n self.emit('drain');\n }, 0);\n }\n};\n\n/**\n * Called upon close\n *\n * @api private\n */\n\nWS.prototype.onClose = function () {\n Transport.prototype.onClose.call(this);\n};\n\n/**\n * Closes socket.\n *\n * @api private\n */\n\nWS.prototype.doClose = function () {\n if (typeof this.ws !== 'undefined') {\n this.ws.close();\n }\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nWS.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'wss' : 'ws';\n var port = '';\n\n // avoid port if default for schema\n if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n ('ws' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // append timestamp to URI\n if (this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n/**\n * Feature detection for WebSocket.\n *\n * @return {Boolean} whether this transport is available.\n * @api public\n */\n\nWS.prototype.check = function () {\n return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/websocket.js\n// module id = 36\n// module chunks = 0","\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/indexof/index.js\n// module id = 38\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar parser = require('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar toArray = require('to-array');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:socket');\nvar parseqs = require('parseqs');\nvar hasBin = require('has-binary2');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = Socket;\n\n/**\n * Internal events (blacklisted).\n * These events can't be emitted by the user.\n *\n * @api private\n */\n\nvar events = {\n connect: 1,\n connect_error: 1,\n connect_timeout: 1,\n connecting: 1,\n disconnect: 1,\n error: 1,\n reconnect: 1,\n reconnect_attempt: 1,\n reconnect_failed: 1,\n reconnect_error: 1,\n reconnecting: 1,\n ping: 1,\n pong: 1\n};\n\n/**\n * Shortcut to `Emitter#emit`.\n */\n\nvar emit = Emitter.prototype.emit;\n\n/**\n * `Socket` constructor.\n *\n * @api public\n */\n\nfunction Socket (io, nsp, opts) {\n this.io = io;\n this.nsp = nsp;\n this.json = this; // compat\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.connected = false;\n this.disconnected = true;\n this.flags = {};\n if (opts && opts.query) {\n this.query = opts.query;\n }\n if (this.io.autoConnect) this.open();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Subscribe to open, close and packet events\n *\n * @api private\n */\n\nSocket.prototype.subEvents = function () {\n if (this.subs) return;\n\n var io = this.io;\n this.subs = [\n on(io, 'open', bind(this, 'onopen')),\n on(io, 'packet', bind(this, 'onpacket')),\n on(io, 'close', bind(this, 'onclose'))\n ];\n};\n\n/**\n * \"Opens\" the socket.\n *\n * @api public\n */\n\nSocket.prototype.open =\nSocket.prototype.connect = function () {\n if (this.connected) return this;\n\n this.subEvents();\n this.io.open(); // ensure open\n if ('open' === this.io.readyState) this.onopen();\n this.emit('connecting');\n return this;\n};\n\n/**\n * Sends a `message` event.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.send = function () {\n var args = toArray(arguments);\n args.unshift('message');\n this.emit.apply(this, args);\n return this;\n};\n\n/**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @param {String} event name\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.emit = function (ev) {\n if (events.hasOwnProperty(ev)) {\n emit.apply(this, arguments);\n return this;\n }\n\n var args = toArray(arguments);\n var packet = {\n type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n data: args\n };\n\n packet.options = {};\n packet.options.compress = !this.flags || false !== this.flags.compress;\n\n // event ack callback\n if ('function' === typeof args[args.length - 1]) {\n debug('emitting packet with ack id %d', this.ids);\n this.acks[this.ids] = args.pop();\n packet.id = this.ids++;\n }\n\n if (this.connected) {\n this.packet(packet);\n } else {\n this.sendBuffer.push(packet);\n }\n\n this.flags = {};\n\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.packet = function (packet) {\n packet.nsp = this.nsp;\n this.io.packet(packet);\n};\n\n/**\n * Called upon engine `open`.\n *\n * @api private\n */\n\nSocket.prototype.onopen = function () {\n debug('transport is open - connecting');\n\n // write connect packet if necessary\n if ('/' !== this.nsp) {\n if (this.query) {\n var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;\n debug('sending connect packet with query %s', query);\n this.packet({type: parser.CONNECT, query: query});\n } else {\n this.packet({type: parser.CONNECT});\n }\n }\n};\n\n/**\n * Called upon engine `close`.\n *\n * @param {String} reason\n * @api private\n */\n\nSocket.prototype.onclose = function (reason) {\n debug('close (%s)', reason);\n this.connected = false;\n this.disconnected = true;\n delete this.id;\n this.emit('disconnect', reason);\n};\n\n/**\n * Called with socket packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onpacket = function (packet) {\n var sameNamespace = packet.nsp === this.nsp;\n var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\n if (!sameNamespace && !rootNamespaceError) return;\n\n switch (packet.type) {\n case parser.CONNECT:\n this.onconnect();\n break;\n\n case parser.EVENT:\n this.onevent(packet);\n break;\n\n case parser.BINARY_EVENT:\n this.onevent(packet);\n break;\n\n case parser.ACK:\n this.onack(packet);\n break;\n\n case parser.BINARY_ACK:\n this.onack(packet);\n break;\n\n case parser.DISCONNECT:\n this.ondisconnect();\n break;\n\n case parser.ERROR:\n this.emit('error', packet.data);\n break;\n }\n};\n\n/**\n * Called upon a server event.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onevent = function (packet) {\n var args = packet.data || [];\n debug('emitting event %j', args);\n\n if (null != packet.id) {\n debug('attaching ack callback to event');\n args.push(this.ack(packet.id));\n }\n\n if (this.connected) {\n emit.apply(this, args);\n } else {\n this.receiveBuffer.push(args);\n }\n};\n\n/**\n * Produces an ack callback to emit with an event.\n *\n * @api private\n */\n\nSocket.prototype.ack = function (id) {\n var self = this;\n var sent = false;\n return function () {\n // prevent double callbacks\n if (sent) return;\n sent = true;\n var args = toArray(arguments);\n debug('sending ack %j', args);\n\n self.packet({\n type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n id: id,\n data: args\n });\n };\n};\n\n/**\n * Called upon a server acknowlegement.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onack = function (packet) {\n var ack = this.acks[packet.id];\n if ('function' === typeof ack) {\n debug('calling ack %s with %j', packet.id, packet.data);\n ack.apply(this, packet.data);\n delete this.acks[packet.id];\n } else {\n debug('bad ack %s', packet.id);\n }\n};\n\n/**\n * Called upon server connect.\n *\n * @api private\n */\n\nSocket.prototype.onconnect = function () {\n this.connected = true;\n this.disconnected = false;\n this.emit('connect');\n this.emitBuffered();\n};\n\n/**\n * Emit buffered events (received and emitted).\n *\n * @api private\n */\n\nSocket.prototype.emitBuffered = function () {\n var i;\n for (i = 0; i < this.receiveBuffer.length; i++) {\n emit.apply(this, this.receiveBuffer[i]);\n }\n this.receiveBuffer = [];\n\n for (i = 0; i < this.sendBuffer.length; i++) {\n this.packet(this.sendBuffer[i]);\n }\n this.sendBuffer = [];\n};\n\n/**\n * Called upon server disconnect.\n *\n * @api private\n */\n\nSocket.prototype.ondisconnect = function () {\n debug('server disconnect (%s)', this.nsp);\n this.destroy();\n this.onclose('io server disconnect');\n};\n\n/**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @api private.\n */\n\nSocket.prototype.destroy = function () {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n for (var i = 0; i < this.subs.length; i++) {\n this.subs[i].destroy();\n }\n this.subs = null;\n }\n\n this.io.destroy(this);\n};\n\n/**\n * Disconnects the socket manually.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.close =\nSocket.prototype.disconnect = function () {\n if (this.connected) {\n debug('performing disconnect (%s)', this.nsp);\n this.packet({ type: parser.DISCONNECT });\n }\n\n // remove socket from pool\n this.destroy();\n\n if (this.connected) {\n // fire events\n this.onclose('io client disconnect');\n }\n return this;\n};\n\n/**\n * Sets the compress flag.\n *\n * @param {Boolean} if `true`, compresses the sending data\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.compress = function (compress) {\n this.flags.compress = compress;\n return this;\n};\n\n/**\n * Sets the binary flag\n *\n * @param {Boolean} whether the emitted data contains binary\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.binary = function (binary) {\n this.flags.binary = binary;\n return this;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/socket.js\n// module id = 39\n// module chunks = 0","module.exports = toArray\n\nfunction toArray(list, index) {\n var array = []\n\n index = index || 0\n\n for (var i = index || 0; i < list.length; i++) {\n array[i - index] = list[i]\n }\n\n return array\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/to-array/index.js\n// module id = 40\n// module chunks = 0","\n/**\n * Module exports.\n */\n\nmodule.exports = on;\n\n/**\n * Helper for subscriptions.\n *\n * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n * @param {String} event name\n * @param {Function} callback\n * @api public\n */\n\nfunction on (obj, ev, fn) {\n obj.on(ev, fn);\n return {\n destroy: function () {\n obj.removeListener(ev, fn);\n }\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/on.js\n// module id = 41\n// module chunks = 0","/**\n * Slice reference.\n */\n\nvar slice = [].slice;\n\n/**\n * Bind `obj` to `fn`.\n *\n * @param {Object} obj\n * @param {Function|String} fn or string\n * @return {Function}\n * @api public\n */\n\nmodule.exports = function(obj, fn){\n if ('string' == typeof fn) fn = obj[fn];\n if ('function' != typeof fn) throw new Error('bind() requires a function');\n var args = slice.call(arguments, 2);\n return function(){\n return fn.apply(obj, args.concat(slice.call(arguments)));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-bind/index.js\n// module id = 42\n// module chunks = 0","\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/backo2/index.js\n// module id = 43\n// module chunks = 0"],"sourceRoot":""}+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.slim.dev.js b/node_modules/socket.io-client/dist/socket.io.slim.dev.js @@ -0,0 +1,5853 @@ +/*! + * Socket.IO v2.3.0 + * (c) 2014-2019 Guillermo Rauch + * Released under the MIT License. + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["io"] = factory(); + else + root["io"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Module dependencies. + */ + + var url = __webpack_require__(1); + var parser = __webpack_require__(4); + var Manager = __webpack_require__(9); + var debug = __webpack_require__(3)('socket.io-client'); + + /** + * Module exports. + */ + + module.exports = exports = lookup; + + /** + * Managers cache. + */ + + var cache = exports.managers = {}; + + /** + * Looks up an existing `Manager` for multiplexing. + * If the user summons: + * + * `io('http://localhost/a');` + * `io('http://localhost/b');` + * + * We reuse the existing instance based on same scheme/port/host, + * and we initialize sockets for each namespace. + * + * @api public + */ + + function lookup(uri, opts) { + if ((typeof uri === 'undefined' ? 'undefined' : _typeof(uri)) === 'object') { + opts = uri; + uri = undefined; + } + + opts = opts || {}; + + var parsed = url(uri); + var source = parsed.source; + var id = parsed.id; + var path = parsed.path; + var sameNamespace = cache[id] && path in cache[id].nsps; + var newConnection = opts.forceNew || opts['force new connection'] || false === opts.multiplex || sameNamespace; + + var io; + + if (newConnection) { + + io = Manager(source, opts); + } else { + if (!cache[id]) { + + cache[id] = Manager(source, opts); + } + io = cache[id]; + } + if (parsed.query && !opts.query) { + opts.query = parsed.query; + } + return io.socket(parsed.path, opts); + } + + /** + * Protocol version. + * + * @api public + */ + + exports.protocol = parser.protocol; + + /** + * `connect`. + * + * @param {String} uri + * @api public + */ + + exports.connect = lookup; + + /** + * Expose constructors for standalone build. + * + * @api public + */ + + exports.Manager = __webpack_require__(9); + exports.Socket = __webpack_require__(33); + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + /** + * Module dependencies. + */ + + var parseuri = __webpack_require__(2); + var debug = __webpack_require__(3)('socket.io-client:url'); + + /** + * Module exports. + */ + + module.exports = url; + + /** + * URL parser. + * + * @param {String} url + * @param {Object} An object meant to mimic window.location. + * Defaults to window.location. + * @api public + */ + + function url(uri, loc) { + var obj = uri; + + // default to window.location + loc = loc || typeof location !== 'undefined' && location; + if (null == uri) uri = loc.protocol + '//' + loc.host; + + // relative path support + if ('string' === typeof uri) { + if ('/' === uri.charAt(0)) { + if ('/' === uri.charAt(1)) { + uri = loc.protocol + uri; + } else { + uri = loc.host + uri; + } + } + + if (!/^(https?|wss?):\/\//.test(uri)) { + + if ('undefined' !== typeof loc) { + uri = loc.protocol + '//' + uri; + } else { + uri = 'https://' + uri; + } + } + + // parse + + obj = parseuri(uri); + } + + // make sure we treat `localhost:80` and `localhost` equally + if (!obj.port) { + if (/^(http|ws)$/.test(obj.protocol)) { + obj.port = '80'; + } else if (/^(http|ws)s$/.test(obj.protocol)) { + obj.port = '443'; + } + } + + obj.path = obj.path || '/'; + + var ipv6 = obj.host.indexOf(':') !== -1; + var host = ipv6 ? '[' + obj.host + ']' : obj.host; + + // define unique id + obj.id = obj.protocol + '://' + host + ':' + obj.port; + // define href + obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : ':' + obj.port); + + return obj; + } + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + + /** + * Parses an URI + * + * @author Steven Levithan <stevenlevithan.com> (MIT license) + * @api private + */ + + var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; + + var parts = [ + 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor' + ]; + + module.exports = function parseuri(str) { + var src = str, + b = str.indexOf('['), + e = str.indexOf(']'); + + if (b != -1 && e != -1) { + str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length); + } + + var m = re.exec(str || ''), + uri = {}, + i = 14; + + while (i--) { + uri[parts[i]] = m[i] || ''; + } + + if (b != -1 && e != -1) { + uri.source = src; + uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':'); + uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':'); + uri.ipv6uri = true; + } + + return uri; + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + "use strict"; + + module.exports = function () { + return function () {}; + }; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Module dependencies. + */ + + var debug = __webpack_require__(3)('socket.io-parser'); + var Emitter = __webpack_require__(5); + var binary = __webpack_require__(6); + var isArray = __webpack_require__(7); + var isBuf = __webpack_require__(8); + + /** + * Protocol version. + * + * @api public + */ + + exports.protocol = 4; + + /** + * Packet types. + * + * @api public + */ + + exports.types = [ + 'CONNECT', + 'DISCONNECT', + 'EVENT', + 'ACK', + 'ERROR', + 'BINARY_EVENT', + 'BINARY_ACK' + ]; + + /** + * Packet type `connect`. + * + * @api public + */ + + exports.CONNECT = 0; + + /** + * Packet type `disconnect`. + * + * @api public + */ + + exports.DISCONNECT = 1; + + /** + * Packet type `event`. + * + * @api public + */ + + exports.EVENT = 2; + + /** + * Packet type `ack`. + * + * @api public + */ + + exports.ACK = 3; + + /** + * Packet type `error`. + * + * @api public + */ + + exports.ERROR = 4; + + /** + * Packet type 'binary event' + * + * @api public + */ + + exports.BINARY_EVENT = 5; + + /** + * Packet type `binary ack`. For acks with binary arguments. + * + * @api public + */ + + exports.BINARY_ACK = 6; + + /** + * Encoder constructor. + * + * @api public + */ + + exports.Encoder = Encoder; + + /** + * Decoder constructor. + * + * @api public + */ + + exports.Decoder = Decoder; + + /** + * A socket.io Encoder instance + * + * @api public + */ + + function Encoder() {} + + var ERROR_PACKET = exports.ERROR + '"encode error"'; + + /** + * Encode a packet as a single string if non-binary, or as a + * buffer sequence, depending on packet type. + * + * @param {Object} obj - packet object + * @param {Function} callback - function to handle encodings (likely engine.write) + * @return Calls callback with Array of encodings + * @api public + */ + + Encoder.prototype.encode = function(obj, callback){ + + + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + encodeAsBinary(obj, callback); + } else { + var encoding = encodeAsString(obj); + callback([encoding]); + } + }; + + /** + * Encode packet as string. + * + * @param {Object} packet + * @return {String} encoded + * @api private + */ + + function encodeAsString(obj) { + + // first is type + var str = '' + obj.type; + + // attachments if we have them + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + str += obj.attachments + '-'; + } + + // if we have a namespace other than `/` + // we append it followed by a comma `,` + if (obj.nsp && '/' !== obj.nsp) { + str += obj.nsp + ','; + } + + // immediately followed by the id + if (null != obj.id) { + str += obj.id; + } + + // json data + if (null != obj.data) { + var payload = tryStringify(obj.data); + if (payload !== false) { + str += payload; + } else { + return ERROR_PACKET; + } + } + + + return str; + } + + function tryStringify(str) { + try { + return JSON.stringify(str); + } catch(e){ + return false; + } + } + + /** + * Encode packet as 'buffer sequence' by removing blobs, and + * deconstructing packet into object with placeholders and + * a list of buffers. + * + * @param {Object} packet + * @return {Buffer} encoded + * @api private + */ + + function encodeAsBinary(obj, callback) { + + function writeEncoding(bloblessData) { + var deconstruction = binary.deconstructPacket(bloblessData); + var pack = encodeAsString(deconstruction.packet); + var buffers = deconstruction.buffers; + + buffers.unshift(pack); // add packet info to beginning of data list + callback(buffers); // write all the buffers + } + + binary.removeBlobs(obj, writeEncoding); + } + + /** + * A socket.io Decoder instance + * + * @return {Object} decoder + * @api public + */ + + function Decoder() { + this.reconstructor = null; + } + + /** + * Mix in `Emitter` with Decoder. + */ + + Emitter(Decoder.prototype); + + /** + * Decodes an encoded packet string into packet JSON. + * + * @param {String} obj - encoded packet + * @return {Object} packet + * @api public + */ + + Decoder.prototype.add = function(obj) { + var packet; + if (typeof obj === 'string') { + packet = decodeString(obj); + if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json + this.reconstructor = new BinaryReconstructor(packet); + + // no attachments, labeled binary but no binary data to follow + if (this.reconstructor.reconPack.attachments === 0) { + this.emit('decoded', packet); + } + } else { // non-binary full packet + this.emit('decoded', packet); + } + } else if (isBuf(obj) || obj.base64) { // raw binary data + if (!this.reconstructor) { + throw new Error('got binary data when not reconstructing a packet'); + } else { + packet = this.reconstructor.takeBinaryData(obj); + if (packet) { // received final buffer + this.reconstructor = null; + this.emit('decoded', packet); + } + } + } else { + throw new Error('Unknown type: ' + obj); + } + }; + + /** + * Decode a packet String (JSON data) + * + * @param {String} str + * @return {Object} packet + * @api private + */ + + function decodeString(str) { + var i = 0; + // look up type + var p = { + type: Number(str.charAt(0)) + }; + + if (null == exports.types[p.type]) { + return error('unknown packet type ' + p.type); + } + + // look up attachments if type binary + if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) { + var buf = ''; + while (str.charAt(++i) !== '-') { + buf += str.charAt(i); + if (i == str.length) break; + } + if (buf != Number(buf) || str.charAt(i) !== '-') { + throw new Error('Illegal attachments'); + } + p.attachments = Number(buf); + } + + // look up namespace (if any) + if ('/' === str.charAt(i + 1)) { + p.nsp = ''; + while (++i) { + var c = str.charAt(i); + if (',' === c) break; + p.nsp += c; + if (i === str.length) break; + } + } else { + p.nsp = '/'; + } + + // look up id + var next = str.charAt(i + 1); + if ('' !== next && Number(next) == next) { + p.id = ''; + while (++i) { + var c = str.charAt(i); + if (null == c || Number(c) != c) { + --i; + break; + } + p.id += str.charAt(i); + if (i === str.length) break; + } + p.id = Number(p.id); + } + + // look up json data + if (str.charAt(++i)) { + var payload = tryParse(str.substr(i)); + var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload)); + if (isPayloadValid) { + p.data = payload; + } else { + return error('invalid payload'); + } + } + + + return p; + } + + function tryParse(str) { + try { + return JSON.parse(str); + } catch(e){ + return false; + } + } + + /** + * Deallocates a parser's resources + * + * @api public + */ + + Decoder.prototype.destroy = function() { + if (this.reconstructor) { + this.reconstructor.finishedReconstruction(); + } + }; + + /** + * A manager of a binary event's 'buffer sequence'. Should + * be constructed whenever a packet of type BINARY_EVENT is + * decoded. + * + * @param {Object} packet + * @return {BinaryReconstructor} initialized reconstructor + * @api private + */ + + function BinaryReconstructor(packet) { + this.reconPack = packet; + this.buffers = []; + } + + /** + * Method to be called when binary data received from connection + * after a BINARY_EVENT packet. + * + * @param {Buffer | ArrayBuffer} binData - the raw binary data received + * @return {null | Object} returns null if more binary data is expected or + * a reconstructed packet object if all buffers have been received. + * @api private + */ + + BinaryReconstructor.prototype.takeBinaryData = function(binData) { + this.buffers.push(binData); + if (this.buffers.length === this.reconPack.attachments) { // done with buffer list + var packet = binary.reconstructPacket(this.reconPack, this.buffers); + this.finishedReconstruction(); + return packet; + } + return null; + }; + + /** + * Cleans up binary packet reconstruction variables. + * + * @api private + */ + + BinaryReconstructor.prototype.finishedReconstruction = function() { + this.reconPack = null; + this.buffers = []; + }; + + function error(msg) { + return { + type: exports.ERROR, + data: 'parser error: ' + msg + }; + } + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + if (true) { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + /*global Blob,File*/ + + /** + * Module requirements + */ + + var isArray = __webpack_require__(7); + var isBuf = __webpack_require__(8); + var toString = Object.prototype.toString; + var withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'); + var withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'); + + /** + * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder. + * Anything with blobs or files should be fed through removeBlobs before coming + * here. + * + * @param {Object} packet - socket.io event packet + * @return {Object} with deconstructed packet and list of buffers + * @api public + */ + + exports.deconstructPacket = function(packet) { + var buffers = []; + var packetData = packet.data; + var pack = packet; + pack.data = _deconstructPacket(packetData, buffers); + pack.attachments = buffers.length; // number of binary 'attachments' + return {packet: pack, buffers: buffers}; + }; + + function _deconstructPacket(data, buffers) { + if (!data) return data; + + if (isBuf(data)) { + var placeholder = { _placeholder: true, num: buffers.length }; + buffers.push(data); + return placeholder; + } else if (isArray(data)) { + var newData = new Array(data.length); + for (var i = 0; i < data.length; i++) { + newData[i] = _deconstructPacket(data[i], buffers); + } + return newData; + } else if (typeof data === 'object' && !(data instanceof Date)) { + var newData = {}; + for (var key in data) { + newData[key] = _deconstructPacket(data[key], buffers); + } + return newData; + } + return data; + } + + /** + * Reconstructs a binary packet from its placeholder packet and buffers + * + * @param {Object} packet - event packet with placeholders + * @param {Array} buffers - binary buffers to put in placeholder positions + * @return {Object} reconstructed packet + * @api public + */ + + exports.reconstructPacket = function(packet, buffers) { + packet.data = _reconstructPacket(packet.data, buffers); + packet.attachments = undefined; // no longer useful + return packet; + }; + + function _reconstructPacket(data, buffers) { + if (!data) return data; + + if (data && data._placeholder) { + return buffers[data.num]; // appropriate buffer (should be natural order anyway) + } else if (isArray(data)) { + for (var i = 0; i < data.length; i++) { + data[i] = _reconstructPacket(data[i], buffers); + } + } else if (typeof data === 'object') { + for (var key in data) { + data[key] = _reconstructPacket(data[key], buffers); + } + } + + return data; + } + + /** + * Asynchronously removes Blobs or Files from data via + * FileReader's readAsArrayBuffer method. Used before encoding + * data as msgpack. Calls callback with the blobless data. + * + * @param {Object} data + * @param {Function} callback + * @api private + */ + + exports.removeBlobs = function(data, callback) { + function _removeBlobs(obj, curKey, containingObject) { + if (!obj) return obj; + + // convert any blob + if ((withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File)) { + pendingBlobs++; + + // async filereader + var fileReader = new FileReader(); + fileReader.onload = function() { // this.result == arraybuffer + if (containingObject) { + containingObject[curKey] = this.result; + } + else { + bloblessData = this.result; + } + + // if nothing pending its callback time + if(! --pendingBlobs) { + callback(bloblessData); + } + }; + + fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer + } else if (isArray(obj)) { // handle array + for (var i = 0; i < obj.length; i++) { + _removeBlobs(obj[i], i, obj); + } + } else if (typeof obj === 'object' && !isBuf(obj)) { // and object + for (var key in obj) { + _removeBlobs(obj[key], key, obj); + } + } + } + + var pendingBlobs = 0; + var bloblessData = data; + _removeBlobs(bloblessData); + if (!pendingBlobs) { + callback(bloblessData); + } + }; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports) { + + var toString = {}.toString; + + module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + + module.exports = isBuf; + + var withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function'; + var withNativeArrayBuffer = typeof ArrayBuffer === 'function'; + + var isView = function (obj) { + return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer); + }; + + /** + * Returns true if obj is a buffer or an arraybuffer. + * + * @api private + */ + + function isBuf(obj) { + return (withNativeBuffer && Buffer.isBuffer(obj)) || + (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))); + } + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Module dependencies. + */ + + var eio = __webpack_require__(10); + var Socket = __webpack_require__(33); + var Emitter = __webpack_require__(5); + var parser = __webpack_require__(4); + var on = __webpack_require__(35); + var bind = __webpack_require__(36); + var debug = __webpack_require__(3)('socket.io-client:manager'); + var indexOf = __webpack_require__(32); + var Backoff = __webpack_require__(37); + + /** + * IE6+ hasOwnProperty + */ + + var has = Object.prototype.hasOwnProperty; + + /** + * Module exports + */ + + module.exports = Manager; + + /** + * `Manager` constructor. + * + * @param {String} engine instance or engine uri/opts + * @param {Object} options + * @api public + */ + + function Manager(uri, opts) { + if (!(this instanceof Manager)) return new Manager(uri, opts); + if (uri && 'object' === (typeof uri === 'undefined' ? 'undefined' : _typeof(uri))) { + opts = uri; + uri = undefined; + } + opts = opts || {}; + + opts.path = opts.path || '/socket.io'; + this.nsps = {}; + this.subs = []; + this.opts = opts; + this.reconnection(opts.reconnection !== false); + this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); + this.reconnectionDelay(opts.reconnectionDelay || 1000); + this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); + this.randomizationFactor(opts.randomizationFactor || 0.5); + this.backoff = new Backoff({ + min: this.reconnectionDelay(), + max: this.reconnectionDelayMax(), + jitter: this.randomizationFactor() + }); + this.timeout(null == opts.timeout ? 20000 : opts.timeout); + this.readyState = 'closed'; + this.uri = uri; + this.connecting = []; + this.lastPing = null; + this.encoding = false; + this.packetBuffer = []; + var _parser = opts.parser || parser; + this.encoder = new _parser.Encoder(); + this.decoder = new _parser.Decoder(); + this.autoConnect = opts.autoConnect !== false; + if (this.autoConnect) this.open(); + } + + /** + * Propagate given event to sockets and emit on `this` + * + * @api private + */ + + Manager.prototype.emitAll = function () { + this.emit.apply(this, arguments); + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); + } + } + }; + + /** + * Update `socket.id` of all sockets + * + * @api private + */ + + Manager.prototype.updateSocketIds = function () { + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].id = this.generateId(nsp); + } + } + }; + + /** + * generate `socket.id` for the given `nsp` + * + * @param {String} nsp + * @return {String} + * @api private + */ + + Manager.prototype.generateId = function (nsp) { + return (nsp === '/' ? '' : nsp + '#') + this.engine.id; + }; + + /** + * Mix in `Emitter`. + */ + + Emitter(Manager.prototype); + + /** + * Sets the `reconnection` config. + * + * @param {Boolean} true/false if it should automatically reconnect + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnection = function (v) { + if (!arguments.length) return this._reconnection; + this._reconnection = !!v; + return this; + }; + + /** + * Sets the reconnection attempts config. + * + * @param {Number} max reconnection attempts before giving up + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnectionAttempts = function (v) { + if (!arguments.length) return this._reconnectionAttempts; + this._reconnectionAttempts = v; + return this; + }; + + /** + * Sets the delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnectionDelay = function (v) { + if (!arguments.length) return this._reconnectionDelay; + this._reconnectionDelay = v; + this.backoff && this.backoff.setMin(v); + return this; + }; + + Manager.prototype.randomizationFactor = function (v) { + if (!arguments.length) return this._randomizationFactor; + this._randomizationFactor = v; + this.backoff && this.backoff.setJitter(v); + return this; + }; + + /** + * Sets the maximum delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.reconnectionDelayMax = function (v) { + if (!arguments.length) return this._reconnectionDelayMax; + this._reconnectionDelayMax = v; + this.backoff && this.backoff.setMax(v); + return this; + }; + + /** + * Sets the connection timeout. `false` to disable + * + * @return {Manager} self or value + * @api public + */ + + Manager.prototype.timeout = function (v) { + if (!arguments.length) return this._timeout; + this._timeout = v; + return this; + }; + + /** + * Starts trying to reconnect if reconnection is enabled and we have not + * started reconnecting yet + * + * @api private + */ + + Manager.prototype.maybeReconnectOnOpen = function () { + // Only try to reconnect if it's the first time we're connecting + if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) { + // keeps reconnection from firing twice for the same reconnection loop + this.reconnect(); + } + }; + + /** + * Sets the current transport `socket`. + * + * @param {Function} optional, callback + * @return {Manager} self + * @api public + */ + + Manager.prototype.open = Manager.prototype.connect = function (fn, opts) { + + if (~this.readyState.indexOf('open')) return this; + + this.engine = eio(this.uri, this.opts); + var socket = this.engine; + var self = this; + this.readyState = 'opening'; + this.skipReconnect = false; + + // emit `open` + var openSub = on(socket, 'open', function () { + self.onopen(); + fn && fn(); + }); + + // emit `connect_error` + var errorSub = on(socket, 'error', function (data) { + + self.cleanup(); + self.readyState = 'closed'; + self.emitAll('connect_error', data); + if (fn) { + var err = new Error('Connection error'); + err.data = data; + fn(err); + } else { + // Only do this if there is no fn to handle the error + self.maybeReconnectOnOpen(); + } + }); + + // emit `connect_timeout` + if (false !== this._timeout) { + var timeout = this._timeout; + + // set timer + var timer = setTimeout(function () { + + openSub.destroy(); + socket.close(); + socket.emit('error', 'timeout'); + self.emitAll('connect_timeout', timeout); + }, timeout); + + this.subs.push({ + destroy: function destroy() { + clearTimeout(timer); + } + }); + } + + this.subs.push(openSub); + this.subs.push(errorSub); + + return this; + }; + + /** + * Called upon transport open. + * + * @api private + */ + + Manager.prototype.onopen = function () { + + // clear old subs + this.cleanup(); + + // mark as open + this.readyState = 'open'; + this.emit('open'); + + // add new subs + var socket = this.engine; + this.subs.push(on(socket, 'data', bind(this, 'ondata'))); + this.subs.push(on(socket, 'ping', bind(this, 'onping'))); + this.subs.push(on(socket, 'pong', bind(this, 'onpong'))); + this.subs.push(on(socket, 'error', bind(this, 'onerror'))); + this.subs.push(on(socket, 'close', bind(this, 'onclose'))); + this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); + }; + + /** + * Called upon a ping. + * + * @api private + */ + + Manager.prototype.onping = function () { + this.lastPing = new Date(); + this.emitAll('ping'); + }; + + /** + * Called upon a packet. + * + * @api private + */ + + Manager.prototype.onpong = function () { + this.emitAll('pong', new Date() - this.lastPing); + }; + + /** + * Called with data. + * + * @api private + */ + + Manager.prototype.ondata = function (data) { + this.decoder.add(data); + }; + + /** + * Called when parser fully decodes a packet. + * + * @api private + */ + + Manager.prototype.ondecoded = function (packet) { + this.emit('packet', packet); + }; + + /** + * Called upon socket error. + * + * @api private + */ + + Manager.prototype.onerror = function (err) { + + this.emitAll('error', err); + }; + + /** + * Creates a new socket for the given `nsp`. + * + * @return {Socket} + * @api public + */ + + Manager.prototype.socket = function (nsp, opts) { + var socket = this.nsps[nsp]; + if (!socket) { + socket = new Socket(this, nsp, opts); + this.nsps[nsp] = socket; + var self = this; + socket.on('connecting', onConnecting); + socket.on('connect', function () { + socket.id = self.generateId(nsp); + }); + + if (this.autoConnect) { + // manually call here since connecting event is fired before listening + onConnecting(); + } + } + + function onConnecting() { + if (!~indexOf(self.connecting, socket)) { + self.connecting.push(socket); + } + } + + return socket; + }; + + /** + * Called upon a socket close. + * + * @param {Socket} socket + */ + + Manager.prototype.destroy = function (socket) { + var index = indexOf(this.connecting, socket); + if (~index) this.connecting.splice(index, 1); + if (this.connecting.length) return; + + this.close(); + }; + + /** + * Writes a packet. + * + * @param {Object} packet + * @api private + */ + + Manager.prototype.packet = function (packet) { + + var self = this; + if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query; + + if (!self.encoding) { + // encode, then write to engine with result + self.encoding = true; + this.encoder.encode(packet, function (encodedPackets) { + for (var i = 0; i < encodedPackets.length; i++) { + self.engine.write(encodedPackets[i], packet.options); + } + self.encoding = false; + self.processPacketQueue(); + }); + } else { + // add packet to the queue + self.packetBuffer.push(packet); + } + }; + + /** + * If packet buffer is non-empty, begins encoding the + * next packet in line. + * + * @api private + */ + + Manager.prototype.processPacketQueue = function () { + if (this.packetBuffer.length > 0 && !this.encoding) { + var pack = this.packetBuffer.shift(); + this.packet(pack); + } + }; + + /** + * Clean up transport subscriptions and packet buffer. + * + * @api private + */ + + Manager.prototype.cleanup = function () { + + var subsLength = this.subs.length; + for (var i = 0; i < subsLength; i++) { + var sub = this.subs.shift(); + sub.destroy(); + } + + this.packetBuffer = []; + this.encoding = false; + this.lastPing = null; + + this.decoder.destroy(); + }; + + /** + * Close the current socket. + * + * @api private + */ + + Manager.prototype.close = Manager.prototype.disconnect = function () { + + this.skipReconnect = true; + this.reconnecting = false; + if ('opening' === this.readyState) { + // `onclose` will not fire because + // an open event never happened + this.cleanup(); + } + this.backoff.reset(); + this.readyState = 'closed'; + if (this.engine) this.engine.close(); + }; + + /** + * Called upon engine close. + * + * @api private + */ + + Manager.prototype.onclose = function (reason) { + + this.cleanup(); + this.backoff.reset(); + this.readyState = 'closed'; + this.emit('close', reason); + + if (this._reconnection && !this.skipReconnect) { + this.reconnect(); + } + }; + + /** + * Attempt a reconnection. + * + * @api private + */ + + Manager.prototype.reconnect = function () { + if (this.reconnecting || this.skipReconnect) return this; + + var self = this; + + if (this.backoff.attempts >= this._reconnectionAttempts) { + + this.backoff.reset(); + this.emitAll('reconnect_failed'); + this.reconnecting = false; + } else { + var delay = this.backoff.duration(); + + this.reconnecting = true; + var timer = setTimeout(function () { + if (self.skipReconnect) return; + + self.emitAll('reconnect_attempt', self.backoff.attempts); + self.emitAll('reconnecting', self.backoff.attempts); + + // check again for the case socket closed in above events + if (self.skipReconnect) return; + + self.open(function (err) { + if (err) { + + self.reconnecting = false; + self.reconnect(); + self.emitAll('reconnect_error', err.data); + } else { + + self.onreconnect(); + } + }); + }, delay); + + this.subs.push({ + destroy: function destroy() { + clearTimeout(timer); + } + }); + } + }; + + /** + * Called upon successful reconnect. + * + * @api private + */ + + Manager.prototype.onreconnect = function () { + var attempt = this.backoff.attempts; + this.reconnecting = false; + this.backoff.reset(); + this.updateSocketIds(); + this.emitAll('reconnect', attempt); + }; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + + module.exports = __webpack_require__(11); + + /** + * Exports parser + * + * @api public + * + */ + module.exports.parser = __webpack_require__(18); + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var transports = __webpack_require__(12); + var Emitter = __webpack_require__(5); + var debug = __webpack_require__(3)('engine.io-client:socket'); + var index = __webpack_require__(32); + var parser = __webpack_require__(18); + var parseuri = __webpack_require__(2); + var parseqs = __webpack_require__(26); + + /** + * Module exports. + */ + + module.exports = Socket; + + /** + * Socket constructor. + * + * @param {String|Object} uri or options + * @param {Object} options + * @api public + */ + + function Socket (uri, opts) { + if (!(this instanceof Socket)) return new Socket(uri, opts); + + opts = opts || {}; + + if (uri && 'object' === typeof uri) { + opts = uri; + uri = null; + } + + if (uri) { + uri = parseuri(uri); + opts.hostname = uri.host; + opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; + opts.port = uri.port; + if (uri.query) opts.query = uri.query; + } else if (opts.host) { + opts.hostname = parseuri(opts.host).host; + } + + this.secure = null != opts.secure ? opts.secure + : (typeof location !== 'undefined' && 'https:' === location.protocol); + + if (opts.hostname && !opts.port) { + // if no port is specified manually, use the protocol default + opts.port = this.secure ? '443' : '80'; + } + + this.agent = opts.agent || false; + this.hostname = opts.hostname || + (typeof location !== 'undefined' ? location.hostname : 'localhost'); + this.port = opts.port || (typeof location !== 'undefined' && location.port + ? location.port + : (this.secure ? 443 : 80)); + this.query = opts.query || {}; + if ('string' === typeof this.query) this.query = parseqs.decode(this.query); + this.upgrade = false !== opts.upgrade; + this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; + this.forceJSONP = !!opts.forceJSONP; + this.jsonp = false !== opts.jsonp; + this.forceBase64 = !!opts.forceBase64; + this.enablesXDR = !!opts.enablesXDR; + this.withCredentials = false !== opts.withCredentials; + this.timestampParam = opts.timestampParam || 't'; + this.timestampRequests = opts.timestampRequests; + this.transports = opts.transports || ['polling', 'websocket']; + this.transportOptions = opts.transportOptions || {}; + this.readyState = ''; + this.writeBuffer = []; + this.prevBufferLen = 0; + this.policyPort = opts.policyPort || 843; + this.rememberUpgrade = opts.rememberUpgrade || false; + this.binaryType = null; + this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; + this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; + + if (true === this.perMessageDeflate) this.perMessageDeflate = {}; + if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { + this.perMessageDeflate.threshold = 1024; + } + + // SSL options for Node.js client + this.pfx = opts.pfx || null; + this.key = opts.key || null; + this.passphrase = opts.passphrase || null; + this.cert = opts.cert || null; + this.ca = opts.ca || null; + this.ciphers = opts.ciphers || null; + this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; + this.forceNode = !!opts.forceNode; + + // detect ReactNative environment + this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative'); + + // other options for Node.js or ReactNative client + if (typeof self === 'undefined' || this.isReactNative) { + if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { + this.extraHeaders = opts.extraHeaders; + } + + if (opts.localAddress) { + this.localAddress = opts.localAddress; + } + } + + // set on handshake + this.id = null; + this.upgrades = null; + this.pingInterval = null; + this.pingTimeout = null; + + // set on heartbeat + this.pingIntervalTimer = null; + this.pingTimeoutTimer = null; + + this.open(); + } + + Socket.priorWebsocketSuccess = false; + + /** + * Mix in `Emitter`. + */ + + Emitter(Socket.prototype); + + /** + * Protocol version. + * + * @api public + */ + + Socket.protocol = parser.protocol; // this is an int + + /** + * Expose deps for legacy compatibility + * and standalone browser access. + */ + + Socket.Socket = Socket; + Socket.Transport = __webpack_require__(17); + Socket.transports = __webpack_require__(12); + Socket.parser = __webpack_require__(18); + + /** + * Creates transport of the given type. + * + * @param {String} transport name + * @return {Transport} + * @api private + */ + + Socket.prototype.createTransport = function (name) { + + var query = clone(this.query); + + // append engine.io protocol identifier + query.EIO = parser.protocol; + + // transport name + query.transport = name; + + // per-transport options + var options = this.transportOptions[name] || {}; + + // session id if we already have one + if (this.id) query.sid = this.id; + + var transport = new transports[name]({ + query: query, + socket: this, + agent: options.agent || this.agent, + hostname: options.hostname || this.hostname, + port: options.port || this.port, + secure: options.secure || this.secure, + path: options.path || this.path, + forceJSONP: options.forceJSONP || this.forceJSONP, + jsonp: options.jsonp || this.jsonp, + forceBase64: options.forceBase64 || this.forceBase64, + enablesXDR: options.enablesXDR || this.enablesXDR, + withCredentials: options.withCredentials || this.withCredentials, + timestampRequests: options.timestampRequests || this.timestampRequests, + timestampParam: options.timestampParam || this.timestampParam, + policyPort: options.policyPort || this.policyPort, + pfx: options.pfx || this.pfx, + key: options.key || this.key, + passphrase: options.passphrase || this.passphrase, + cert: options.cert || this.cert, + ca: options.ca || this.ca, + ciphers: options.ciphers || this.ciphers, + rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized, + perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate, + extraHeaders: options.extraHeaders || this.extraHeaders, + forceNode: options.forceNode || this.forceNode, + localAddress: options.localAddress || this.localAddress, + requestTimeout: options.requestTimeout || this.requestTimeout, + protocols: options.protocols || void (0), + isReactNative: this.isReactNative + }); + + return transport; + }; + + function clone (obj) { + var o = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + o[i] = obj[i]; + } + } + return o; + } + + /** + * Initializes transport to use and starts probe. + * + * @api private + */ + Socket.prototype.open = function () { + var transport; + if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { + transport = 'websocket'; + } else if (0 === this.transports.length) { + // Emit error on next tick so it can be listened to + var self = this; + setTimeout(function () { + self.emit('error', 'No transports available'); + }, 0); + return; + } else { + transport = this.transports[0]; + } + this.readyState = 'opening'; + + // Retry with the next transport if the transport is disabled (jsonp: false) + try { + transport = this.createTransport(transport); + } catch (e) { + this.transports.shift(); + this.open(); + return; + } + + transport.open(); + this.setTransport(transport); + }; + + /** + * Sets the current transport. Disables the existing one (if any). + * + * @api private + */ + + Socket.prototype.setTransport = function (transport) { + + var self = this; + + if (this.transport) { + + this.transport.removeAllListeners(); + } + + // set up transport + this.transport = transport; + + // set up transport listeners + transport + .on('drain', function () { + self.onDrain(); + }) + .on('packet', function (packet) { + self.onPacket(packet); + }) + .on('error', function (e) { + self.onError(e); + }) + .on('close', function () { + self.onClose('transport close'); + }); + }; + + /** + * Probes a transport. + * + * @param {String} transport name + * @api private + */ + + Socket.prototype.probe = function (name) { + + var transport = this.createTransport(name, { probe: 1 }); + var failed = false; + var self = this; + + Socket.priorWebsocketSuccess = false; + + function onTransportOpen () { + if (self.onlyBinaryUpgrades) { + var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; + failed = failed || upgradeLosesBinary; + } + if (failed) return; + + + transport.send([{ type: 'ping', data: 'probe' }]); + transport.once('packet', function (msg) { + if (failed) return; + if ('pong' === msg.type && 'probe' === msg.data) { + + self.upgrading = true; + self.emit('upgrading', transport); + if (!transport) return; + Socket.priorWebsocketSuccess = 'websocket' === transport.name; + + + self.transport.pause(function () { + if (failed) return; + if ('closed' === self.readyState) return; + + + cleanup(); + + self.setTransport(transport); + transport.send([{ type: 'upgrade' }]); + self.emit('upgrade', transport); + transport = null; + self.upgrading = false; + self.flush(); + }); + } else { + + var err = new Error('probe error'); + err.transport = transport.name; + self.emit('upgradeError', err); + } + }); + } + + function freezeTransport () { + if (failed) return; + + // Any callback called by transport should be ignored since now + failed = true; + + cleanup(); + + transport.close(); + transport = null; + } + + // Handle any error that happens while probing + function onerror (err) { + var error = new Error('probe error: ' + err); + error.transport = transport.name; + + freezeTransport(); + + + + self.emit('upgradeError', error); + } + + function onTransportClose () { + onerror('transport closed'); + } + + // When the socket is closed while we're probing + function onclose () { + onerror('socket closed'); + } + + // When the socket is upgraded while we're probing + function onupgrade (to) { + if (transport && to.name !== transport.name) { + + freezeTransport(); + } + } + + // Remove all listeners on the transport and on self + function cleanup () { + transport.removeListener('open', onTransportOpen); + transport.removeListener('error', onerror); + transport.removeListener('close', onTransportClose); + self.removeListener('close', onclose); + self.removeListener('upgrading', onupgrade); + } + + transport.once('open', onTransportOpen); + transport.once('error', onerror); + transport.once('close', onTransportClose); + + this.once('close', onclose); + this.once('upgrading', onupgrade); + + transport.open(); + }; + + /** + * Called when connection is deemed open. + * + * @api public + */ + + Socket.prototype.onOpen = function () { + + this.readyState = 'open'; + Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; + this.emit('open'); + this.flush(); + + // we check for `readyState` in case an `open` + // listener already closed the socket + if ('open' === this.readyState && this.upgrade && this.transport.pause) { + + for (var i = 0, l = this.upgrades.length; i < l; i++) { + this.probe(this.upgrades[i]); + } + } + }; + + /** + * Handles a packet. + * + * @api private + */ + + Socket.prototype.onPacket = function (packet) { + if ('opening' === this.readyState || 'open' === this.readyState || + 'closing' === this.readyState) { + + + this.emit('packet', packet); + + // Socket is live - any packet counts + this.emit('heartbeat'); + + switch (packet.type) { + case 'open': + this.onHandshake(JSON.parse(packet.data)); + break; + + case 'pong': + this.setPing(); + this.emit('pong'); + break; + + case 'error': + var err = new Error('server error'); + err.code = packet.data; + this.onError(err); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + + } + }; + + /** + * Called upon handshake completion. + * + * @param {Object} handshake obj + * @api private + */ + + Socket.prototype.onHandshake = function (data) { + this.emit('handshake', data); + this.id = data.sid; + this.transport.query.sid = data.sid; + this.upgrades = this.filterUpgrades(data.upgrades); + this.pingInterval = data.pingInterval; + this.pingTimeout = data.pingTimeout; + this.onOpen(); + // In case open handler closes socket + if ('closed' === this.readyState) return; + this.setPing(); + + // Prolong liveness of socket on heartbeat + this.removeListener('heartbeat', this.onHeartbeat); + this.on('heartbeat', this.onHeartbeat); + }; + + /** + * Resets ping timeout. + * + * @api private + */ + + Socket.prototype.onHeartbeat = function (timeout) { + clearTimeout(this.pingTimeoutTimer); + var self = this; + self.pingTimeoutTimer = setTimeout(function () { + if ('closed' === self.readyState) return; + self.onClose('ping timeout'); + }, timeout || (self.pingInterval + self.pingTimeout)); + }; + + /** + * Pings server every `this.pingInterval` and expects response + * within `this.pingTimeout` or closes connection. + * + * @api private + */ + + Socket.prototype.setPing = function () { + var self = this; + clearTimeout(self.pingIntervalTimer); + self.pingIntervalTimer = setTimeout(function () { + + self.ping(); + self.onHeartbeat(self.pingTimeout); + }, self.pingInterval); + }; + + /** + * Sends a ping packet. + * + * @api private + */ + + Socket.prototype.ping = function () { + var self = this; + this.sendPacket('ping', function () { + self.emit('ping'); + }); + }; + + /** + * Called on `drain` event + * + * @api private + */ + + Socket.prototype.onDrain = function () { + this.writeBuffer.splice(0, this.prevBufferLen); + + // setting prevBufferLen = 0 is very important + // for example, when upgrading, upgrade packet is sent over, + // and a nonzero prevBufferLen could cause problems on `drain` + this.prevBufferLen = 0; + + if (0 === this.writeBuffer.length) { + this.emit('drain'); + } else { + this.flush(); + } + }; + + /** + * Flush write buffers. + * + * @api private + */ + + Socket.prototype.flush = function () { + if ('closed' !== this.readyState && this.transport.writable && + !this.upgrading && this.writeBuffer.length) { + + this.transport.send(this.writeBuffer); + // keep track of current length of writeBuffer + // splice writeBuffer and callbackBuffer on `drain` + this.prevBufferLen = this.writeBuffer.length; + this.emit('flush'); + } + }; + + /** + * Sends a message. + * + * @param {String} message. + * @param {Function} callback function. + * @param {Object} options. + * @return {Socket} for chaining. + * @api public + */ + + Socket.prototype.write = + Socket.prototype.send = function (msg, options, fn) { + this.sendPacket('message', msg, options, fn); + return this; + }; + + /** + * Sends a packet. + * + * @param {String} packet type. + * @param {String} data. + * @param {Object} options. + * @param {Function} callback function. + * @api private + */ + + Socket.prototype.sendPacket = function (type, data, options, fn) { + if ('function' === typeof data) { + fn = data; + data = undefined; + } + + if ('function' === typeof options) { + fn = options; + options = null; + } + + if ('closing' === this.readyState || 'closed' === this.readyState) { + return; + } + + options = options || {}; + options.compress = false !== options.compress; + + var packet = { + type: type, + data: data, + options: options + }; + this.emit('packetCreate', packet); + this.writeBuffer.push(packet); + if (fn) this.once('flush', fn); + this.flush(); + }; + + /** + * Closes the connection. + * + * @api private + */ + + Socket.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.readyState = 'closing'; + + var self = this; + + if (this.writeBuffer.length) { + this.once('drain', function () { + if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + }); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + } + + function close () { + self.onClose('forced close'); + + self.transport.close(); + } + + function cleanupAndClose () { + self.removeListener('upgrade', cleanupAndClose); + self.removeListener('upgradeError', cleanupAndClose); + close(); + } + + function waitForUpgrade () { + // wait for upgrade to finish since we can't send packets while pausing a transport + self.once('upgrade', cleanupAndClose); + self.once('upgradeError', cleanupAndClose); + } + + return this; + }; + + /** + * Called upon transport error + * + * @api private + */ + + Socket.prototype.onError = function (err) { + + Socket.priorWebsocketSuccess = false; + this.emit('error', err); + this.onClose('transport error', err); + }; + + /** + * Called upon transport close. + * + * @api private + */ + + Socket.prototype.onClose = function (reason, desc) { + if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { + + var self = this; + + // clear timers + clearTimeout(this.pingIntervalTimer); + clearTimeout(this.pingTimeoutTimer); + + // stop event from firing again for transport + this.transport.removeAllListeners('close'); + + // ensure transport won't stay open + this.transport.close(); + + // ignore further transport communication + this.transport.removeAllListeners(); + + // set ready state + this.readyState = 'closed'; + + // clear session id + this.id = null; + + // emit close event + this.emit('close', reason, desc); + + // clean buffers after, so users can still + // grab the buffers on `close` event + self.writeBuffer = []; + self.prevBufferLen = 0; + } + }; + + /** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + + Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i < j; i++) { + if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); + } + return filteredUpgrades; + }; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies + */ + + var XMLHttpRequest = __webpack_require__(13); + var XHR = __webpack_require__(15); + var JSONP = __webpack_require__(29); + var websocket = __webpack_require__(30); + + /** + * Export transports. + */ + + exports.polling = polling; + exports.websocket = websocket; + + /** + * Polling transport polymorphic constructor. + * Decides on xhr vs jsonp based on feature detection. + * + * @api private + */ + + function polling (opts) { + var xhr; + var xd = false; + var xs = false; + var jsonp = false !== opts.jsonp; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + xd = opts.hostname !== location.hostname || port !== opts.port; + xs = opts.secure !== isSSL; + } + + opts.xdomain = xd; + opts.xscheme = xs; + xhr = new XMLHttpRequest(opts); + + if ('open' in xhr && !opts.forceJSONP) { + return new XHR(opts); + } else { + if (!jsonp) throw new Error('JSONP disabled'); + return new JSONP(opts); + } + } + + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + // browser shim for xmlhttprequest module + + var hasCORS = __webpack_require__(14); + + module.exports = function (opts) { + var xdomain = opts.xdomain; + + // scheme must be same when usign XDomainRequest + // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx + var xscheme = opts.xscheme; + + // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. + // https://github.com/Automattic/engine.io-client/pull/217 + var enablesXDR = opts.enablesXDR; + + // XMLHttpRequest can be disabled on IE + try { + if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e) { } + + // Use XDomainRequest for IE8 if enablesXDR is true + // because loading bar keeps flashing when using jsonp-polling + // https://github.com/yujiosaka/socke.io-ie8-loading-example + try { + if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { + return new XDomainRequest(); + } + } catch (e) { } + + if (!xdomain) { + try { + return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); + } catch (e) { } + } + }; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + + + /** + * Module exports. + * + * Logic borrowed from Modernizr: + * + * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js + */ + + try { + module.exports = typeof XMLHttpRequest !== 'undefined' && + 'withCredentials' in new XMLHttpRequest(); + } catch (err) { + // if XMLHttp support is disabled in IE then it will throw + // when trying to create + module.exports = false; + } + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + /* global attachEvent */ + + /** + * Module requirements. + */ + + var XMLHttpRequest = __webpack_require__(13); + var Polling = __webpack_require__(16); + var Emitter = __webpack_require__(5); + var inherit = __webpack_require__(27); + var debug = __webpack_require__(3)('engine.io-client:polling-xhr'); + + /** + * Module exports. + */ + + module.exports = XHR; + module.exports.Request = Request; + + /** + * Empty function + */ + + function empty () {} + + /** + * XHR Polling constructor. + * + * @param {Object} opts + * @api public + */ + + function XHR (opts) { + Polling.call(this, opts); + this.requestTimeout = opts.requestTimeout; + this.extraHeaders = opts.extraHeaders; + + if (typeof location !== 'undefined') { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) || + port !== opts.port; + this.xs = opts.secure !== isSSL; + } + } + + /** + * Inherits from Polling. + */ + + inherit(XHR, Polling); + + /** + * XHR supports binary + */ + + XHR.prototype.supportsBinary = true; + + /** + * Creates a request. + * + * @param {String} method + * @api private + */ + + XHR.prototype.request = function (opts) { + opts = opts || {}; + opts.uri = this.uri(); + opts.xd = this.xd; + opts.xs = this.xs; + opts.agent = this.agent || false; + opts.supportsBinary = this.supportsBinary; + opts.enablesXDR = this.enablesXDR; + opts.withCredentials = this.withCredentials; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + opts.requestTimeout = this.requestTimeout; + + // other options for Node.js client + opts.extraHeaders = this.extraHeaders; + + return new Request(opts); + }; + + /** + * Sends data. + * + * @param {String} data to send. + * @param {Function} called upon flush. + * @api private + */ + + XHR.prototype.doWrite = function (data, fn) { + var isBinary = typeof data !== 'string' && data !== undefined; + var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); + var self = this; + req.on('success', fn); + req.on('error', function (err) { + self.onError('xhr post error', err); + }); + this.sendXhr = req; + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + XHR.prototype.doPoll = function () { + + var req = this.request(); + var self = this; + req.on('data', function (data) { + self.onData(data); + }); + req.on('error', function (err) { + self.onError('xhr poll error', err); + }); + this.pollXhr = req; + }; + + /** + * Request constructor + * + * @param {Object} options + * @api public + */ + + function Request (opts) { + this.method = opts.method || 'GET'; + this.uri = opts.uri; + this.xd = !!opts.xd; + this.xs = !!opts.xs; + this.async = false !== opts.async; + this.data = undefined !== opts.data ? opts.data : null; + this.agent = opts.agent; + this.isBinary = opts.isBinary; + this.supportsBinary = opts.supportsBinary; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + this.requestTimeout = opts.requestTimeout; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + + this.create(); + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Request.prototype); + + /** + * Creates the XHR object and sends the request. + * + * @api private + */ + + Request.prototype.create = function () { + var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + + var xhr = this.xhr = new XMLHttpRequest(opts); + var self = this; + + try { + + xhr.open(this.method, this.uri, this.async); + try { + if (this.extraHeaders) { + xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); + for (var i in this.extraHeaders) { + if (this.extraHeaders.hasOwnProperty(i)) { + xhr.setRequestHeader(i, this.extraHeaders[i]); + } + } + } + } catch (e) {} + + if ('POST' === this.method) { + try { + if (this.isBinary) { + xhr.setRequestHeader('Content-type', 'application/octet-stream'); + } else { + xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); + } + } catch (e) {} + } + + try { + xhr.setRequestHeader('Accept', '*/*'); + } catch (e) {} + + // ie6 check + if ('withCredentials' in xhr) { + xhr.withCredentials = this.withCredentials; + } + + if (this.requestTimeout) { + xhr.timeout = this.requestTimeout; + } + + if (this.hasXDR()) { + xhr.onload = function () { + self.onLoad(); + }; + xhr.onerror = function () { + self.onError(xhr.responseText); + }; + } else { + xhr.onreadystatechange = function () { + if (xhr.readyState === 2) { + try { + var contentType = xhr.getResponseHeader('Content-Type'); + if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + xhr.responseType = 'arraybuffer'; + } + } catch (e) {} + } + if (4 !== xhr.readyState) return; + if (200 === xhr.status || 1223 === xhr.status) { + self.onLoad(); + } else { + // make sure the `error` event handler that's user-set + // does not throw in the same tick and gets caught here + setTimeout(function () { + self.onError(typeof xhr.status === 'number' ? xhr.status : 0); + }, 0); + } + }; + } + + + xhr.send(this.data); + } catch (e) { + // Need to defer since .create() is called directly fhrom the constructor + // and thus the 'error' event can only be only bound *after* this exception + // occurs. Therefore, also, we cannot throw here at all. + setTimeout(function () { + self.onError(e); + }, 0); + return; + } + + if (typeof document !== 'undefined') { + this.index = Request.requestsCount++; + Request.requests[this.index] = this; + } + }; + + /** + * Called upon successful response. + * + * @api private + */ + + Request.prototype.onSuccess = function () { + this.emit('success'); + this.cleanup(); + }; + + /** + * Called if we have data. + * + * @api private + */ + + Request.prototype.onData = function (data) { + this.emit('data', data); + this.onSuccess(); + }; + + /** + * Called upon error. + * + * @api private + */ + + Request.prototype.onError = function (err) { + this.emit('error', err); + this.cleanup(true); + }; + + /** + * Cleans up house. + * + * @api private + */ + + Request.prototype.cleanup = function (fromError) { + if ('undefined' === typeof this.xhr || null === this.xhr) { + return; + } + // xmlhttprequest + if (this.hasXDR()) { + this.xhr.onload = this.xhr.onerror = empty; + } else { + this.xhr.onreadystatechange = empty; + } + + if (fromError) { + try { + this.xhr.abort(); + } catch (e) {} + } + + if (typeof document !== 'undefined') { + delete Request.requests[this.index]; + } + + this.xhr = null; + }; + + /** + * Called upon load. + * + * @api private + */ + + Request.prototype.onLoad = function () { + var data; + try { + var contentType; + try { + contentType = this.xhr.getResponseHeader('Content-Type'); + } catch (e) {} + if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') { + data = this.xhr.response || this.xhr.responseText; + } else { + data = this.xhr.responseText; + } + } catch (e) { + this.onError(e); + } + if (null != data) { + this.onData(data); + } + }; + + /** + * Check if it has XDomainRequest. + * + * @api private + */ + + Request.prototype.hasXDR = function () { + return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR; + }; + + /** + * Aborts the request. + * + * @api public + */ + + Request.prototype.abort = function () { + this.cleanup(); + }; + + /** + * Aborts pending requests when unloading the window. This is needed to prevent + * memory leaks (e.g. when using IE) and to ensure that no spurious error is + * emitted. + */ + + Request.requestsCount = 0; + Request.requests = {}; + + if (typeof document !== 'undefined') { + if (typeof attachEvent === 'function') { + attachEvent('onunload', unloadHandler); + } else if (typeof addEventListener === 'function') { + var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload'; + addEventListener(terminationEvent, unloadHandler, false); + } + } + + function unloadHandler () { + for (var i in Request.requests) { + if (Request.requests.hasOwnProperty(i)) { + Request.requests[i].abort(); + } + } + } + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(17); + var parseqs = __webpack_require__(26); + var parser = __webpack_require__(18); + var inherit = __webpack_require__(27); + var yeast = __webpack_require__(28); + var debug = __webpack_require__(3)('engine.io-client:polling'); + + /** + * Module exports. + */ + + module.exports = Polling; + + /** + * Is XHR2 supported? + */ + + var hasXHR2 = (function () { + var XMLHttpRequest = __webpack_require__(13); + var xhr = new XMLHttpRequest({ xdomain: false }); + return null != xhr.responseType; + })(); + + /** + * Polling interface. + * + * @param {Object} opts + * @api private + */ + + function Polling (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (!hasXHR2 || forceBase64) { + this.supportsBinary = false; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(Polling, Transport); + + /** + * Transport name. + */ + + Polling.prototype.name = 'polling'; + + /** + * Opens the socket (triggers polling). We write a PING message to determine + * when the transport is open. + * + * @api private + */ + + Polling.prototype.doOpen = function () { + this.poll(); + }; + + /** + * Pauses polling. + * + * @param {Function} callback upon buffers are flushed and transport is paused + * @api private + */ + + Polling.prototype.pause = function (onPause) { + var self = this; + + this.readyState = 'pausing'; + + function pause () { + + self.readyState = 'paused'; + onPause(); + } + + if (this.polling || !this.writable) { + var total = 0; + + if (this.polling) { + + total++; + this.once('pollComplete', function () { + + --total || pause(); + }); + } + + if (!this.writable) { + + total++; + this.once('drain', function () { + + --total || pause(); + }); + } + } else { + pause(); + } + }; + + /** + * Starts polling cycle. + * + * @api public + */ + + Polling.prototype.poll = function () { + + this.polling = true; + this.doPoll(); + this.emit('poll'); + }; + + /** + * Overloads onData to detect payloads. + * + * @api private + */ + + Polling.prototype.onData = function (data) { + var self = this; + + var callback = function (packet, index, total) { + // if its the first message we consider the transport open + if ('opening' === self.readyState) { + self.onOpen(); + } + + // if its a close packet, we close the ongoing requests + if ('close' === packet.type) { + self.onClose(); + return false; + } + + // otherwise bypass onData and handle the message + self.onPacket(packet); + }; + + // decode payload + parser.decodePayload(data, this.socket.binaryType, callback); + + // if an event did not trigger closing + if ('closed' !== this.readyState) { + // if we got data we're not polling + this.polling = false; + this.emit('pollComplete'); + + if ('open' === this.readyState) { + this.poll(); + } else { + + } + } + }; + + /** + * For polling, send a close packet. + * + * @api private + */ + + Polling.prototype.doClose = function () { + var self = this; + + function close () { + + self.write([{ type: 'close' }]); + } + + if ('open' === this.readyState) { + + close(); + } else { + // in case we're trying to close while + // handshaking is in progress (GH-164) + + this.once('open', close); + } + }; + + /** + * Writes a packets payload. + * + * @param {Array} data packets + * @param {Function} drain callback + * @api private + */ + + Polling.prototype.write = function (packets) { + var self = this; + this.writable = false; + var callbackfn = function () { + self.writable = true; + self.emit('drain'); + }; + + parser.encodePayload(packets, this.supportsBinary, function (data) { + self.doWrite(data, callbackfn); + }); + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + Polling.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'https' : 'http'; + var port = ''; + + // cache busting is forced + if (false !== this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + if (!this.supportsBinary && !query.sid) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // avoid port if default for schema + if (this.port && (('https' === schema && Number(this.port) !== 443) || + ('http' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var parser = __webpack_require__(18); + var Emitter = __webpack_require__(5); + + /** + * Module exports. + */ + + module.exports = Transport; + + /** + * Transport abstract constructor. + * + * @param {Object} options. + * @api private + */ + + function Transport (opts) { + this.path = opts.path; + this.hostname = opts.hostname; + this.port = opts.port; + this.secure = opts.secure; + this.query = opts.query; + this.timestampParam = opts.timestampParam; + this.timestampRequests = opts.timestampRequests; + this.readyState = ''; + this.agent = opts.agent || false; + this.socket = opts.socket; + this.enablesXDR = opts.enablesXDR; + this.withCredentials = opts.withCredentials; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + this.forceNode = opts.forceNode; + + // results of ReactNative environment detection + this.isReactNative = opts.isReactNative; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + this.localAddress = opts.localAddress; + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Transport.prototype); + + /** + * Emits an error. + * + * @param {String} str + * @return {Transport} for chaining + * @api public + */ + + Transport.prototype.onError = function (msg, desc) { + var err = new Error(msg); + err.type = 'TransportError'; + err.description = desc; + this.emit('error', err); + return this; + }; + + /** + * Opens the transport. + * + * @api public + */ + + Transport.prototype.open = function () { + if ('closed' === this.readyState || '' === this.readyState) { + this.readyState = 'opening'; + this.doOpen(); + } + + return this; + }; + + /** + * Closes the transport. + * + * @api private + */ + + Transport.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.doClose(); + this.onClose(); + } + + return this; + }; + + /** + * Sends multiple packets. + * + * @param {Array} packets + * @api private + */ + + Transport.prototype.send = function (packets) { + if ('open' === this.readyState) { + this.write(packets); + } else { + throw new Error('Transport not open'); + } + }; + + /** + * Called upon open + * + * @api private + */ + + Transport.prototype.onOpen = function () { + this.readyState = 'open'; + this.writable = true; + this.emit('open'); + }; + + /** + * Called with data. + * + * @param {String} data + * @api private + */ + + Transport.prototype.onData = function (data) { + var packet = parser.decodePacket(data, this.socket.binaryType); + this.onPacket(packet); + }; + + /** + * Called with a decoded packet. + */ + + Transport.prototype.onPacket = function (packet) { + this.emit('packet', packet); + }; + + /** + * Called upon close. + * + * @api private + */ + + Transport.prototype.onClose = function () { + this.readyState = 'closed'; + this.emit('close'); + }; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var keys = __webpack_require__(19); + var hasBinary = __webpack_require__(20); + var sliceBuffer = __webpack_require__(21); + var after = __webpack_require__(22); + var utf8 = __webpack_require__(23); + + var base64encoder; + if (typeof ArrayBuffer !== 'undefined') { + base64encoder = __webpack_require__(24); + } + + /** + * Check if we are running an android browser. That requires us to use + * ArrayBuffer with polling transports... + * + * http://ghinda.net/jpeg-blob-ajax-android/ + */ + + var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); + + /** + * Check if we are running in PhantomJS. + * Uploading a Blob with PhantomJS does not work correctly, as reported here: + * https://github.com/ariya/phantomjs/issues/11395 + * @type boolean + */ + var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); + + /** + * When true, avoids using Blobs to encode payloads. + * @type boolean + */ + var dontSendBlobs = isAndroid || isPhantomJS; + + /** + * Current protocol version. + */ + + exports.protocol = 3; + + /** + * Packet types. + */ + + var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 + }; + + var packetslist = keys(packets); + + /** + * Premade error packet. + */ + + var err = { type: 'error', data: 'parser error' }; + + /** + * Create a blob api even for blob builder when vendor prefixes exist + */ + + var Blob = __webpack_require__(25); + + /** + * Encodes a packet. + * + * <packet type id> [ <data> ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + + exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = false; + } + + if (typeof utf8encode === 'function') { + callback = utf8encode; + utf8encode = null; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } else if (typeof Blob !== 'undefined' && data instanceof Blob) { + return encodeBlob(packet, supportsBinary, callback); + } + + // might be an object with { base64: true, data: dataAsBase64String } + if (data && data.base64) { + return encodeBase64Object(packet, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); + } + + return callback('' + encoded); + + }; + + function encodeBase64Object(packet, callback) { + // packet data is an object { base64: true, data: dataAsBase64String } + var message = 'b' + exports.packets[packet.type] + packet.data.data; + return callback(message); + } + + /** + * Encode packet helpers for binary types + */ + + function encodeArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var contentArray = new Uint8Array(data); + var resultBuffer = new Uint8Array(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++) { + resultBuffer[i+1] = contentArray[i]; + } + + return callback(resultBuffer.buffer); + } + + function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var fr = new FileReader(); + fr.onload = function() { + exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback); + }; + return fr.readAsArrayBuffer(packet.data); + } + + function encodeBlob(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + if (dontSendBlobs) { + return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); + } + + var length = new Uint8Array(1); + length[0] = packets[packet.type]; + var blob = new Blob([length.buffer, packet.data]); + + return callback(blob); + } + + /** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + + exports.encodeBase64Packet = function(packet, callback) { + var message = 'b' + exports.packets[packet.type]; + if (typeof Blob !== 'undefined' && packet.data instanceof Blob) { + var fr = new FileReader(); + fr.onload = function() { + var b64 = fr.result.split(',')[1]; + callback(message + b64); + }; + return fr.readAsDataURL(packet.data); + } + + var b64data; + try { + b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); + } catch (e) { + // iPhone Safari doesn't let you apply with typed arrays + var typed = new Uint8Array(packet.data); + var basic = new Array(typed.length); + for (var i = 0; i < typed.length; i++) { + basic[i] = typed[i]; + } + b64data = String.fromCharCode.apply(null, basic); + } + message += btoa(b64data); + return callback(message); + }; + + /** + * Decodes a packet. Changes format to Blob if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + + exports.decodePacket = function (data, binaryType, utf8decode) { + if (data === undefined) { + return err; + } + // String data + if (typeof data === 'string') { + if (data.charAt(0) === 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + if (utf8decode) { + data = tryDecode(data); + if (data === false) { + return err; + } + } + var type = data.charAt(0); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + var asArray = new Uint8Array(data); + var type = asArray[0]; + var rest = sliceBuffer(data, 1); + if (Blob && binaryType === 'blob') { + rest = new Blob([rest]); + } + return { type: packetslist[type], data: rest }; + }; + + function tryDecode(data) { + try { + data = utf8.decode(data, { strict: false }); + } catch (e) { + return false; + } + return data; + } + + /** + * Decodes a packet encoded in a base64 string + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + + exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + if (!base64encoder) { + return { type: type, data: { base64: true, data: msg.substr(1) } }; + } + + var data = base64encoder.decode(msg.substr(1)); + + if (binaryType === 'blob' && Blob) { + data = new Blob([data]); + } + + return { type: type, data: data }; + }; + + /** + * Encodes multiple messages (payload). + * + * <length>:data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + + exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + var isBinary = hasBinary(packets); + + if (supportsBinary && isBinary) { + if (Blob && !dontSendBlobs) { + return exports.encodePayloadAsBlob(packets, callback); + } + + return exports.encodePayloadAsArrayBuffer(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); + }; + + /** + * Async array map using after + */ + + function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } + } + + /* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + + exports.decodePayload = function (data, binaryType, callback) { + if (typeof data !== 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data === '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '', n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (chr !== ':') { + length += chr; + continue; + } + + if (length === '' || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType, false); + + if (err.type === packet.type && err.data === packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + + if (length !== '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + }; + + /** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number + * 255><data> + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {ArrayBuffer} encoded payload + * @api private + */ + + exports.encodePayloadAsArrayBuffer = function(packets, callback) { + if (!packets.length) { + return callback(new ArrayBuffer(0)); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(data) { + return doneCallback(null, data); + }); + } + + map(packets, encodeOne, function(err, encodedPackets) { + var totalLength = encodedPackets.reduce(function(acc, p) { + var len; + if (typeof p === 'string'){ + len = p.length; + } else { + len = p.byteLength; + } + return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 + }, 0); + + var resultArray = new Uint8Array(totalLength); + + var bufferIndex = 0; + encodedPackets.forEach(function(p) { + var isString = typeof p === 'string'; + var ab = p; + if (isString) { + var view = new Uint8Array(p.length); + for (var i = 0; i < p.length; i++) { + view[i] = p.charCodeAt(i); + } + ab = view.buffer; + } + + if (isString) { // not true binary + resultArray[bufferIndex++] = 0; + } else { // true binary + resultArray[bufferIndex++] = 1; + } + + var lenStr = ab.byteLength.toString(); + for (var i = 0; i < lenStr.length; i++) { + resultArray[bufferIndex++] = parseInt(lenStr[i]); + } + resultArray[bufferIndex++] = 255; + + var view = new Uint8Array(ab); + for (var i = 0; i < view.length; i++) { + resultArray[bufferIndex++] = view[i]; + } + }); + + return callback(resultArray.buffer); + }); + }; + + /** + * Encode as Blob + */ + + exports.encodePayloadAsBlob = function(packets, callback) { + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(encoded) { + var binaryIdentifier = new Uint8Array(1); + binaryIdentifier[0] = 1; + if (typeof encoded === 'string') { + var view = new Uint8Array(encoded.length); + for (var i = 0; i < encoded.length; i++) { + view[i] = encoded.charCodeAt(i); + } + encoded = view.buffer; + binaryIdentifier[0] = 0; + } + + var len = (encoded instanceof ArrayBuffer) + ? encoded.byteLength + : encoded.size; + + var lenStr = len.toString(); + var lengthAry = new Uint8Array(lenStr.length + 1); + for (var i = 0; i < lenStr.length; i++) { + lengthAry[i] = parseInt(lenStr[i]); + } + lengthAry[lenStr.length] = 255; + + if (Blob) { + var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); + doneCallback(null, blob); + } + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(new Blob(results)); + }); + }; + + /* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + * + * @param {ArrayBuffer} data, callback method + * @api public + */ + + exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.byteLength > 0) { + var tailArray = new Uint8Array(bufferTail); + var isString = tailArray[0] === 0; + var msgLength = ''; + + for (var i = 1; ; i++) { + if (tailArray[i] === 255) break; + + // 310 = char length of Number.MAX_VALUE + if (msgLength.length > 310) { + return callback(err, 0, 1); + } + + msgLength += tailArray[i]; + } + + bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); + msgLength = parseInt(msgLength); + + var msg = sliceBuffer(bufferTail, 0, msgLength); + if (isString) { + try { + msg = String.fromCharCode.apply(null, new Uint8Array(msg)); + } catch (e) { + // iPhone Safari doesn't let you apply to typed arrays + var typed = new Uint8Array(msg); + msg = ''; + for (var i = 0; i < typed.length; i++) { + msg += String.fromCharCode(typed[i]); + } + } + } + + buffers.push(msg); + bufferTail = sliceBuffer(bufferTail, msgLength); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType, true), i, total); + }); + }; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + + + /** + * Gets the keys for an object. + * + * @return {Array} keys + * @api private + */ + + module.exports = Object.keys || function keys (obj){ + var arr = []; + var has = Object.prototype.hasOwnProperty; + + for (var i in obj) { + if (has.call(obj, i)) { + arr.push(i); + } + } + return arr; + }; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + + /* global Blob File */ + + /* + * Module requirements. + */ + + var isArray = __webpack_require__(7); + + var toString = Object.prototype.toString; + var withNativeBlob = typeof Blob === 'function' || + typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'; + var withNativeFile = typeof File === 'function' || + typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'; + + /** + * Module exports. + */ + + module.exports = hasBinary; + + /** + * Checks for binary data. + * + * Supports Buffer, ArrayBuffer, Blob and File. + * + * @param {Object} anything + * @api public + */ + + function hasBinary (obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + if (isArray(obj)) { + for (var i = 0, l = obj.length; i < l; i++) { + if (hasBinary(obj[i])) { + return true; + } + } + return false; + } + + if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) || + (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) || + (withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File) + ) { + return true; + } + + // see: https://github.com/Automattic/has-binary/pull/4 + if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) { + return hasBinary(obj.toJSON(), true); + } + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { + return true; + } + } + + return false; + } + + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + + /** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + + module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; + }; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + + module.exports = after + + function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } + } + + function noop() {} + + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + /*! https://mths.be/utf8js v2.1.2 by @mathias */ + + var stringFromCharCode = String.fromCharCode; + + // Taken from https://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + // Taken from https://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; + } + + function checkScalarValue(codePoint, strict) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + if (strict) { + throw Error( + 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() + + ' is not a scalar value' + ); + } + return false; + } + return true; + } + /*--------------------------------------------------------------------------*/ + + function createByte(codePoint, shift) { + return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); + } + + function encodeCodePoint(codePoint, strict) { + if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence + symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); + } + else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence + if (!checkScalarValue(codePoint, strict)) { + codePoint = 0xFFFD; + } + symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); + symbol += createByte(codePoint, 6); + } + else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence + symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); + return symbol; + } + + function utf8encode(string, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint, strict); + } + return byteString; + } + + /*--------------------------------------------------------------------------*/ + + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } + + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; + + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); + } + + function decodeSymbol(strict) { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; + + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } + + if (byteIndex == byteCount) { + return false; + } + + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; + + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } + + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + byte2 = readContinuationByte(); + codePoint = ((byte1 & 0x1F) << 6) | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; + if (codePoint >= 0x0800) { + return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) | + (byte3 << 0x06) | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); + } + + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol(strict)) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); + } + + module.exports = { + version: '2.1.2', + encode: utf8encode, + decode: utf8decode + }; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + + /* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ + (function(){ + "use strict"; + + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // Use a lookup table to find the index. + var lookup = new Uint8Array(256); + for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; + } + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i+1)]; + encoded3 = lookup[base64.charCodeAt(i+2)]; + encoded4 = lookup[base64.charCodeAt(i+3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; + })(); + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + + /** + * Create a blob builder even when vendor prefixes exist + */ + + var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : + typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder : + typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : + typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : + false; + + /** + * Check if Blob constructor is supported + */ + + var blobSupported = (function() { + try { + var a = new Blob(['hi']); + return a.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if Blob constructor supports ArrayBufferViews + * Fails in Safari 6, so we need to map to ArrayBuffers there. + */ + + var blobSupportsArrayBufferView = blobSupported && (function() { + try { + var b = new Blob([new Uint8Array([1,2])]); + return b.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if BlobBuilder is supported + */ + + var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + + /** + * Helper function that maps ArrayBufferViews to ArrayBuffers + * Used by BlobBuilder constructor and old browsers that didn't + * support it in the Blob constructor. + */ + + function mapArrayBufferViews(ary) { + return ary.map(function(chunk) { + if (chunk.buffer instanceof ArrayBuffer) { + var buf = chunk.buffer; + + // if this is a subarray, make a copy so we only + // include the subarray region from the underlying buffer + if (chunk.byteLength !== buf.byteLength) { + var copy = new Uint8Array(chunk.byteLength); + copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); + buf = copy.buffer; + } + + return buf; + } + + return chunk; + }); + } + + function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + mapArrayBufferViews(ary).forEach(function(part) { + bb.append(part); + }); + + return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); + }; + + function BlobConstructor(ary, options) { + return new Blob(mapArrayBufferViews(ary), options || {}); + }; + + if (typeof Blob !== 'undefined') { + BlobBuilderConstructor.prototype = Blob.prototype; + BlobConstructor.prototype = Blob.prototype; + } + + module.exports = (function() { + if (blobSupported) { + return blobSupportsArrayBufferView ? Blob : BlobConstructor; + } else if (blobBuilderSupported) { + return BlobBuilderConstructor; + } else { + return undefined; + } + })(); + + +/***/ }), +/* 26 */ +/***/ (function(module, exports) { + + /** + * Compiles a querystring + * Returns string representation of the object + * + * @param {Object} + * @api private + */ + + exports.encode = function (obj) { + var str = ''; + + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (str.length) str += '&'; + str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); + } + } + + return str; + }; + + /** + * Parses a simple querystring into an object + * + * @param {String} qs + * @api private + */ + + exports.decode = function(qs){ + var qry = {}; + var pairs = qs.split('&'); + for (var i = 0, l = pairs.length; i < l; i++) { + var pair = pairs[i].split('='); + qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + return qry; + }; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + + + module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; + }; + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + + 'use strict'; + + var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') + , length = 64 + , map = {} + , seed = 0 + , i = 0 + , prev; + + /** + * Return a string representing the specified number. + * + * @param {Number} num The number to convert. + * @returns {String} The string representation of the number. + * @api public + */ + function encode(num) { + var encoded = ''; + + do { + encoded = alphabet[num % length] + encoded; + num = Math.floor(num / length); + } while (num > 0); + + return encoded; + } + + /** + * Return the integer value specified by the given string. + * + * @param {String} str The string to convert. + * @returns {Number} The integer value represented by the string. + * @api public + */ + function decode(str) { + var decoded = 0; + + for (i = 0; i < str.length; i++) { + decoded = decoded * length + map[str.charAt(i)]; + } + + return decoded; + } + + /** + * Yeast: A tiny growing id generator. + * + * @returns {String} A unique id. + * @api public + */ + function yeast() { + var now = encode(+new Date()); + + if (now !== prev) return seed = 0, prev = now; + return now +'.'+ encode(seed++); + } + + // + // Map each character to its index. + // + for (; i < length; i++) map[alphabet[i]] = i; + + // + // Expose the `yeast`, `encode` and `decode` functions. + // + yeast.encode = encode; + yeast.decode = decode; + module.exports = yeast; + + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {/** + * Module requirements. + */ + + var Polling = __webpack_require__(16); + var inherit = __webpack_require__(27); + + /** + * Module exports. + */ + + module.exports = JSONPPolling; + + /** + * Cached regular expressions. + */ + + var rNewline = /\n/g; + var rEscapedNewline = /\\n/g; + + /** + * Global JSONP callbacks. + */ + + var callbacks; + + /** + * Noop. + */ + + function empty () { } + + /** + * Until https://github.com/tc39/proposal-global is shipped. + */ + function glob () { + return typeof self !== 'undefined' ? self + : typeof window !== 'undefined' ? window + : typeof global !== 'undefined' ? global : {}; + } + + /** + * JSONP Polling constructor. + * + * @param {Object} opts. + * @api public + */ + + function JSONPPolling (opts) { + Polling.call(this, opts); + + this.query = this.query || {}; + + // define global callbacks array if not present + // we do this here (lazily) to avoid unneeded global pollution + if (!callbacks) { + // we need to consider multiple engines in the same page + var global = glob(); + callbacks = global.___eio = (global.___eio || []); + } + + // callback identifier + this.index = callbacks.length; + + // add callback to jsonp global + var self = this; + callbacks.push(function (msg) { + self.onData(msg); + }); + + // append to query string + this.query.j = this.index; + + // prevent spurious errors from being emitted when the window is unloaded + if (typeof addEventListener === 'function') { + addEventListener('beforeunload', function () { + if (self.script) self.script.onerror = empty; + }, false); + } + } + + /** + * Inherits from Polling. + */ + + inherit(JSONPPolling, Polling); + + /* + * JSONP only supports binary as base64 encoded strings + */ + + JSONPPolling.prototype.supportsBinary = false; + + /** + * Closes the socket. + * + * @api private + */ + + JSONPPolling.prototype.doClose = function () { + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + if (this.form) { + this.form.parentNode.removeChild(this.form); + this.form = null; + this.iframe = null; + } + + Polling.prototype.doClose.call(this); + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + JSONPPolling.prototype.doPoll = function () { + var self = this; + var script = document.createElement('script'); + + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + script.async = true; + script.src = this.uri(); + script.onerror = function (e) { + self.onError('jsonp poll error', e); + }; + + var insertAt = document.getElementsByTagName('script')[0]; + if (insertAt) { + insertAt.parentNode.insertBefore(script, insertAt); + } else { + (document.head || document.body).appendChild(script); + } + this.script = script; + + var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); + + if (isUAgecko) { + setTimeout(function () { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + document.body.removeChild(iframe); + }, 100); + } + }; + + /** + * Writes with a hidden iframe. + * + * @param {String} data to send + * @param {Function} called upon flush. + * @api private + */ + + JSONPPolling.prototype.doWrite = function (data, fn) { + var self = this; + + if (!this.form) { + var form = document.createElement('form'); + var area = document.createElement('textarea'); + var id = this.iframeId = 'eio_iframe_' + this.index; + var iframe; + + form.className = 'socketio'; + form.style.position = 'absolute'; + form.style.top = '-1000px'; + form.style.left = '-1000px'; + form.target = id; + form.method = 'POST'; + form.setAttribute('accept-charset', 'utf-8'); + area.name = 'd'; + form.appendChild(area); + document.body.appendChild(form); + + this.form = form; + this.area = area; + } + + this.form.action = this.uri(); + + function complete () { + initIframe(); + fn(); + } + + function initIframe () { + if (self.iframe) { + try { + self.form.removeChild(self.iframe); + } catch (e) { + self.onError('jsonp polling iframe removal error', e); + } + } + + try { + // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) + var html = '<iframe src="javascript:0" name="' + self.iframeId + '">'; + iframe = document.createElement(html); + } catch (e) { + iframe = document.createElement('iframe'); + iframe.name = self.iframeId; + iframe.src = 'javascript:0'; + } + + iframe.id = self.iframeId; + + self.form.appendChild(iframe); + self.iframe = iframe; + } + + initIframe(); + + // escape \n to prevent it from being converted into \r\n by some UAs + // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side + data = data.replace(rEscapedNewline, '\\\n'); + this.area.value = data.replace(rNewline, '\\n'); + + try { + this.form.submit(); + } catch (e) {} + + if (this.iframe.attachEvent) { + this.iframe.onreadystatechange = function () { + if (self.iframe.readyState === 'complete') { + complete(); + } + }; + } else { + this.iframe.onload = complete; + } + }; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(17); + var parser = __webpack_require__(18); + var parseqs = __webpack_require__(26); + var inherit = __webpack_require__(27); + var yeast = __webpack_require__(28); + var debug = __webpack_require__(3)('engine.io-client:websocket'); + + var BrowserWebSocket, NodeWebSocket; + + if (typeof WebSocket !== 'undefined') { + BrowserWebSocket = WebSocket; + } else if (typeof self !== 'undefined') { + BrowserWebSocket = self.WebSocket || self.MozWebSocket; + } + + if (typeof window === 'undefined') { + try { + NodeWebSocket = __webpack_require__(31); + } catch (e) { } + } + + /** + * Get either the `WebSocket` or `MozWebSocket` globals + * in the browser or try to resolve WebSocket-compatible + * interface exposed by `ws` for Node-like environment. + */ + + var WebSocketImpl = BrowserWebSocket || NodeWebSocket; + + /** + * Module exports. + */ + + module.exports = WS; + + /** + * WebSocket transport constructor. + * + * @api {Object} connection options + * @api public + */ + + function WS (opts) { + var forceBase64 = (opts && opts.forceBase64); + if (forceBase64) { + this.supportsBinary = false; + } + this.perMessageDeflate = opts.perMessageDeflate; + this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; + this.protocols = opts.protocols; + if (!this.usingBrowserWebSocket) { + WebSocketImpl = NodeWebSocket; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(WS, Transport); + + /** + * Transport name. + * + * @api public + */ + + WS.prototype.name = 'websocket'; + + /* + * WebSockets support binary + */ + + WS.prototype.supportsBinary = true; + + /** + * Opens socket. + * + * @api private + */ + + WS.prototype.doOpen = function () { + if (!this.check()) { + // let probe timeout + return; + } + + var uri = this.uri(); + var protocols = this.protocols; + var opts = { + agent: this.agent, + perMessageDeflate: this.perMessageDeflate + }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + if (this.extraHeaders) { + opts.headers = this.extraHeaders; + } + if (this.localAddress) { + opts.localAddress = this.localAddress; + } + + try { + this.ws = + this.usingBrowserWebSocket && !this.isReactNative + ? protocols + ? new WebSocketImpl(uri, protocols) + : new WebSocketImpl(uri) + : new WebSocketImpl(uri, protocols, opts); + } catch (err) { + return this.emit('error', err); + } + + if (this.ws.binaryType === undefined) { + this.supportsBinary = false; + } + + if (this.ws.supports && this.ws.supports.binary) { + this.supportsBinary = true; + this.ws.binaryType = 'nodebuffer'; + } else { + this.ws.binaryType = 'arraybuffer'; + } + + this.addEventListeners(); + }; + + /** + * Adds event listeners to the socket + * + * @api private + */ + + WS.prototype.addEventListeners = function () { + var self = this; + + this.ws.onopen = function () { + self.onOpen(); + }; + this.ws.onclose = function () { + self.onClose(); + }; + this.ws.onmessage = function (ev) { + self.onData(ev.data); + }; + this.ws.onerror = function (e) { + self.onError('websocket error', e); + }; + }; + + /** + * Writes data to socket. + * + * @param {Array} array of packets. + * @api private + */ + + WS.prototype.write = function (packets) { + var self = this; + this.writable = false; + + // encodePacket efficient as it uses WS framing + // no need for encodePayload + var total = packets.length; + for (var i = 0, l = total; i < l; i++) { + (function (packet) { + parser.encodePacket(packet, self.supportsBinary, function (data) { + if (!self.usingBrowserWebSocket) { + // always create a new object (GH-437) + var opts = {}; + if (packet.options) { + opts.compress = packet.options.compress; + } + + if (self.perMessageDeflate) { + var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length; + if (len < self.perMessageDeflate.threshold) { + opts.compress = false; + } + } + } + + // Sometimes the websocket has already been closed but the browser didn't + // have a chance of informing us about it yet, in that case send will + // throw an error + try { + if (self.usingBrowserWebSocket) { + // TypeError is thrown when passing the second argument on Safari + self.ws.send(data); + } else { + self.ws.send(data, opts); + } + } catch (e) { + + } + + --total || done(); + }); + })(packets[i]); + } + + function done () { + self.emit('flush'); + + // fake drain + // defer to next tick to allow Socket to clear writeBuffer + setTimeout(function () { + self.writable = true; + self.emit('drain'); + }, 0); + } + }; + + /** + * Called upon close + * + * @api private + */ + + WS.prototype.onClose = function () { + Transport.prototype.onClose.call(this); + }; + + /** + * Closes socket. + * + * @api private + */ + + WS.prototype.doClose = function () { + if (typeof this.ws !== 'undefined') { + this.ws.close(); + } + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + WS.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'wss' : 'ws'; + var port = ''; + + // avoid port if default for schema + if (this.port && (('wss' === schema && Number(this.port) !== 443) || + ('ws' === schema && Number(this.port) !== 80))) { + port = ':' + this.port; + } + + // append timestamp to URI + if (this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + // communicate binary support capabilities + if (!this.supportsBinary) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + + /** + * Feature detection for WebSocket. + * + * @return {Boolean} whether this transport is available. + * @api public + */ + + WS.prototype.check = function () { + return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name); + }; + + +/***/ }), +/* 31 */ +/***/ (function(module, exports) { + + /* (ignored) */ + +/***/ }), +/* 32 */ +/***/ (function(module, exports) { + + + var indexOf = [].indexOf; + + module.exports = function(arr, obj){ + if (indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; + }; + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Module dependencies. + */ + + var parser = __webpack_require__(4); + var Emitter = __webpack_require__(5); + var toArray = __webpack_require__(34); + var on = __webpack_require__(35); + var bind = __webpack_require__(36); + var debug = __webpack_require__(3)('socket.io-client:socket'); + var parseqs = __webpack_require__(26); + var hasBin = __webpack_require__(20); + + /** + * Module exports. + */ + + module.exports = exports = Socket; + + /** + * Internal events (blacklisted). + * These events can't be emitted by the user. + * + * @api private + */ + + var events = { + connect: 1, + connect_error: 1, + connect_timeout: 1, + connecting: 1, + disconnect: 1, + error: 1, + reconnect: 1, + reconnect_attempt: 1, + reconnect_failed: 1, + reconnect_error: 1, + reconnecting: 1, + ping: 1, + pong: 1 + }; + + /** + * Shortcut to `Emitter#emit`. + */ + + var emit = Emitter.prototype.emit; + + /** + * `Socket` constructor. + * + * @api public + */ + + function Socket(io, nsp, opts) { + this.io = io; + this.nsp = nsp; + this.json = this; // compat + this.ids = 0; + this.acks = {}; + this.receiveBuffer = []; + this.sendBuffer = []; + this.connected = false; + this.disconnected = true; + this.flags = {}; + if (opts && opts.query) { + this.query = opts.query; + } + if (this.io.autoConnect) this.open(); + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Socket.prototype); + + /** + * Subscribe to open, close and packet events + * + * @api private + */ + + Socket.prototype.subEvents = function () { + if (this.subs) return; + + var io = this.io; + this.subs = [on(io, 'open', bind(this, 'onopen')), on(io, 'packet', bind(this, 'onpacket')), on(io, 'close', bind(this, 'onclose'))]; + }; + + /** + * "Opens" the socket. + * + * @api public + */ + + Socket.prototype.open = Socket.prototype.connect = function () { + if (this.connected) return this; + + this.subEvents(); + this.io.open(); // ensure open + if ('open' === this.io.readyState) this.onopen(); + this.emit('connecting'); + return this; + }; + + /** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + + Socket.prototype.send = function () { + var args = toArray(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; + }; + + /** + * Override `emit`. + * If the event is in `events`, it's emitted normally. + * + * @param {String} event name + * @return {Socket} self + * @api public + */ + + Socket.prototype.emit = function (ev) { + if (events.hasOwnProperty(ev)) { + emit.apply(this, arguments); + return this; + } + + var args = toArray(arguments); + var packet = { + type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT, + data: args + }; + + packet.options = {}; + packet.options.compress = !this.flags || false !== this.flags.compress; + + // event ack callback + if ('function' === typeof args[args.length - 1]) { + + this.acks[this.ids] = args.pop(); + packet.id = this.ids++; + } + + if (this.connected) { + this.packet(packet); + } else { + this.sendBuffer.push(packet); + } + + this.flags = {}; + + return this; + }; + + /** + * Sends a packet. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.packet = function (packet) { + packet.nsp = this.nsp; + this.io.packet(packet); + }; + + /** + * Called upon engine `open`. + * + * @api private + */ + + Socket.prototype.onopen = function () { + + // write connect packet if necessary + if ('/' !== this.nsp) { + if (this.query) { + var query = _typeof(this.query) === 'object' ? parseqs.encode(this.query) : this.query; + + this.packet({ type: parser.CONNECT, query: query }); + } else { + this.packet({ type: parser.CONNECT }); + } + } + }; + + /** + * Called upon engine `close`. + * + * @param {String} reason + * @api private + */ + + Socket.prototype.onclose = function (reason) { + + this.connected = false; + this.disconnected = true; + delete this.id; + this.emit('disconnect', reason); + }; + + /** + * Called with socket packet. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.onpacket = function (packet) { + var sameNamespace = packet.nsp === this.nsp; + var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/'; + + if (!sameNamespace && !rootNamespaceError) return; + + switch (packet.type) { + case parser.CONNECT: + this.onconnect(); + break; + + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.emit('error', packet.data); + break; + } + }; + + /** + * Called upon a server event. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.onevent = function (packet) { + var args = packet.data || []; + + if (null != packet.id) { + + args.push(this.ack(packet.id)); + } + + if (this.connected) { + emit.apply(this, args); + } else { + this.receiveBuffer.push(args); + } + }; + + /** + * Produces an ack callback to emit with an event. + * + * @api private + */ + + Socket.prototype.ack = function (id) { + var self = this; + var sent = false; + return function () { + // prevent double callbacks + if (sent) return; + sent = true; + var args = toArray(arguments); + + self.packet({ + type: hasBin(args) ? parser.BINARY_ACK : parser.ACK, + id: id, + data: args + }); + }; + }; + + /** + * Called upon a server acknowlegement. + * + * @param {Object} packet + * @api private + */ + + Socket.prototype.onack = function (packet) { + var ack = this.acks[packet.id]; + if ('function' === typeof ack) { + + ack.apply(this, packet.data); + delete this.acks[packet.id]; + } else {} + }; + + /** + * Called upon server connect. + * + * @api private + */ + + Socket.prototype.onconnect = function () { + this.connected = true; + this.disconnected = false; + this.emit('connect'); + this.emitBuffered(); + }; + + /** + * Emit buffered events (received and emitted). + * + * @api private + */ + + Socket.prototype.emitBuffered = function () { + var i; + for (i = 0; i < this.receiveBuffer.length; i++) { + emit.apply(this, this.receiveBuffer[i]); + } + this.receiveBuffer = []; + + for (i = 0; i < this.sendBuffer.length; i++) { + this.packet(this.sendBuffer[i]); + } + this.sendBuffer = []; + }; + + /** + * Called upon server disconnect. + * + * @api private + */ + + Socket.prototype.ondisconnect = function () { + + this.destroy(); + this.onclose('io server disconnect'); + }; + + /** + * Called upon forced client/server side disconnections, + * this method ensures the manager stops tracking us and + * that reconnections don't get triggered for this. + * + * @api private. + */ + + Socket.prototype.destroy = function () { + if (this.subs) { + // clean subscriptions to avoid reconnections + for (var i = 0; i < this.subs.length; i++) { + this.subs[i].destroy(); + } + this.subs = null; + } + + this.io.destroy(this); + }; + + /** + * Disconnects the socket manually. + * + * @return {Socket} self + * @api public + */ + + Socket.prototype.close = Socket.prototype.disconnect = function () { + if (this.connected) { + + this.packet({ type: parser.DISCONNECT }); + } + + // remove socket from pool + this.destroy(); + + if (this.connected) { + // fire events + this.onclose('io client disconnect'); + } + return this; + }; + + /** + * Sets the compress flag. + * + * @param {Boolean} if `true`, compresses the sending data + * @return {Socket} self + * @api public + */ + + Socket.prototype.compress = function (compress) { + this.flags.compress = compress; + return this; + }; + + /** + * Sets the binary flag + * + * @param {Boolean} whether the emitted data contains binary + * @return {Socket} self + * @api public + */ + + Socket.prototype.binary = function (binary) { + this.flags.binary = binary; + return this; + }; + +/***/ }), +/* 34 */ +/***/ (function(module, exports) { + + module.exports = toArray + + function toArray(list, index) { + var array = [] + + index = index || 0 + + for (var i = index || 0; i < list.length; i++) { + array[i - index] = list[i] + } + + return array + } + + +/***/ }), +/* 35 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Module exports. + */ + + module.exports = on; + + /** + * Helper for subscriptions. + * + * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` + * @param {String} event name + * @param {Function} callback + * @api public + */ + + function on(obj, ev, fn) { + obj.on(ev, fn); + return { + destroy: function destroy() { + obj.removeListener(ev, fn); + } + }; + } + +/***/ }), +/* 36 */ +/***/ (function(module, exports) { + + /** + * Slice reference. + */ + + var slice = [].slice; + + /** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + + module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } + }; + + +/***/ }), +/* 37 */ +/***/ (function(module, exports) { + + + /** + * Expose `Backoff`. + */ + + module.exports = Backoff; + + /** + * Initialize backoff timer with `opts`. + * + * - `min` initial timeout in milliseconds [100] + * - `max` max timeout [10000] + * - `jitter` [0] + * - `factor` [2] + * + * @param {Object} opts + * @api public + */ + + function Backoff(opts) { + opts = opts || {}; + this.ms = opts.min || 100; + this.max = opts.max || 10000; + this.factor = opts.factor || 2; + this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; + this.attempts = 0; + } + + /** + * Return the backoff duration. + * + * @return {Number} + * @api public + */ + + Backoff.prototype.duration = function(){ + var ms = this.ms * Math.pow(this.factor, this.attempts++); + if (this.jitter) { + var rand = Math.random(); + var deviation = Math.floor(rand * this.jitter * ms); + ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; + } + return Math.min(ms, this.max) | 0; + }; + + /** + * Reset the number of attempts. + * + * @api public + */ + + Backoff.prototype.reset = function(){ + this.attempts = 0; + }; + + /** + * Set the minimum duration + * + * @api public + */ + + Backoff.prototype.setMin = function(min){ + this.ms = min; + }; + + /** + * Set the maximum duration + * + * @api public + */ + + Backoff.prototype.setMax = function(max){ + this.max = max; + }; + + /** + * Set the jitter + * + * @api public + */ + + Backoff.prototype.setJitter = function(jitter){ + this.jitter = jitter; + }; + + + +/***/ }) +/******/ ]) +}); +; +//# sourceMappingURL=socket.io.slim.dev.js.map+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.slim.dev.js.map b/node_modules/socket.io-client/dist/socket.io.slim.dev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 808b2ef720f56a2d39b6","webpack:///./lib/index.js","webpack:///./lib/url.js","webpack:///./~/parseuri/index.js","webpack:///./support/noop.js","webpack:///./~/socket.io-parser/index.js","webpack:///./~/component-emitter/index.js","webpack:///./~/socket.io-parser/binary.js","webpack:///./~/isarray/index.js","webpack:///./~/socket.io-parser/is-buffer.js","webpack:///./lib/manager.js","webpack:///./~/engine.io-client/lib/index.js","webpack:///./~/engine.io-client/lib/socket.js","webpack:///./~/engine.io-client/lib/transports/index.js","webpack:///./~/engine.io-client/lib/xmlhttprequest.js","webpack:///./~/has-cors/index.js","webpack:///./~/engine.io-client/lib/transports/polling-xhr.js","webpack:///./~/engine.io-client/lib/transports/polling.js","webpack:///./~/engine.io-client/lib/transport.js","webpack:///./~/engine.io-parser/lib/browser.js","webpack:///./~/engine.io-parser/lib/keys.js","webpack:///./~/has-binary2/index.js","webpack:///./~/arraybuffer.slice/index.js","webpack:///./~/after/index.js","webpack:///./~/engine.io-parser/lib/utf8.js","webpack:///./~/base64-arraybuffer/lib/base64-arraybuffer.js","webpack:///./~/blob/index.js","webpack:///./~/parseqs/index.js","webpack:///./~/component-inherit/index.js","webpack:///./~/yeast/index.js","webpack:///./~/engine.io-client/lib/transports/polling-jsonp.js","webpack:///./~/engine.io-client/lib/transports/websocket.js","webpack:///ws (ignored)","webpack:///./~/indexof/index.js","webpack:///./lib/socket.js","webpack:///./~/to-array/index.js","webpack:///./lib/on.js","webpack:///./~/component-bind/index.js","webpack:///./~/backo2/index.js"],"names":["url","require","parser","Manager","debug","module","exports","lookup","cache","managers","uri","opts","undefined","parsed","source","id","path","sameNamespace","nsps","newConnection","forceNew","multiplex","io","query","socket","protocol","connect","Socket","parseuri","loc","obj","location","host","charAt","test","port","ipv6","indexOf","href","eio","Emitter","on","bind","Backoff","has","Object","prototype","hasOwnProperty","subs","reconnection","reconnectionAttempts","Infinity","reconnectionDelay","reconnectionDelayMax","randomizationFactor","backoff","min","max","jitter","timeout","readyState","connecting","lastPing","encoding","packetBuffer","_parser","encoder","Encoder","decoder","Decoder","autoConnect","open","emitAll","emit","apply","arguments","nsp","call","updateSocketIds","generateId","engine","v","length","_reconnection","_reconnectionAttempts","_reconnectionDelay","setMin","_randomizationFactor","setJitter","_reconnectionDelayMax","setMax","_timeout","maybeReconnectOnOpen","reconnecting","attempts","reconnect","fn","self","skipReconnect","openSub","onopen","errorSub","data","cleanup","err","Error","timer","setTimeout","destroy","close","push","clearTimeout","onping","Date","onpong","ondata","add","ondecoded","packet","onerror","onConnecting","index","splice","type","encode","encodedPackets","i","write","options","processPacketQueue","pack","shift","subsLength","sub","disconnect","reset","onclose","reason","delay","duration","onreconnect","attempt","toArray","parseqs","hasBin","events","connect_error","connect_timeout","error","reconnect_attempt","reconnect_failed","reconnect_error","ping","pong","json","ids","acks","receiveBuffer","sendBuffer","connected","disconnected","flags","subEvents","send","args","unshift","ev","binary","BINARY_EVENT","EVENT","compress","pop","CONNECT","onpacket","rootNamespaceError","ERROR","onconnect","onevent","ACK","onack","BINARY_ACK","DISCONNECT","ondisconnect","ack","sent","emitBuffered","removeListener"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;ACrCA;;;;AAIA,KAAIA,MAAM,mBAAAC,CAAQ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ACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;AACA;;AAEA;;;AAGA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA0B;AAC1B,uBAAsB;AACtB;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA,sFAAqF;AACrF;;AAEA;AACA;AACA;AACA;AACA,MAAK,OAAO;AACZ;AACA;AACA,IAAG,qCAAqC;AACxC;AACA;AACA,MAAK;AACL;AACA,oBAAmB;AACnB;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,oBAAoB;AAChC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,qBAAqB;AAChC,aAAY,cAAc;AAC1B;AACA;AACA;;AAEA;AACA;AACA,4DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC7ZA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,aAAY;AACZ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA2C,SAAS;AACpD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;AACA;AACA;;;;;;;AClKA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qCAAoC;AACpC,WAAU;AACV;;AAEA;AACA;;AAEA;AACA,wBAAuB;AACvB;AACA;AACA,IAAG;AACH;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA,kCAAiC;AACjC;AACA;;AAEA;AACA;;AAEA;AACA,8BAA6B;AAC7B,IAAG;AACH,oBAAmB,iBAAiB;AACpC;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO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a,iBAAb,EAAgCgC,IAAIF,IAApC;AACD,UALD,MAKO;;AAELL,gBAAK2C,WAAL;AACD;AACF,QAVD;AAWD,MArBW,EAqBTF,KArBS,CAAZ;;AAuBA,UAAK1F,IAAL,CAAU8D,IAAV,CAAe;AACbF,gBAAS,mBAAY;AACnBG,sBAAaL,KAAb;AACD;AAHY,MAAf;AAKD;AACF,EA5CD;;AA8CA;;;;;;AAMAvG,SAAQ2C,SAAR,CAAkB8F,WAAlB,GAAgC,YAAY;AAC1C,OAAIC,UAAU,KAAKtF,OAAL,CAAauC,QAA3B;AACA,QAAKD,YAAL,GAAoB,KAApB;AACA,QAAKtC,OAAL,CAAagF,KAAb;AACA,QAAKzD,eAAL;AACA,QAAKN,OAAL,CAAa,WAAb,EAA0BqE,OAA1B;AACD,EAND,C;;;;;;;ACrjBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACTA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA2F;;AAE3F;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mCAAkC;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY;AACZ;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,MAAK;AACL;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;;AAEA,+CAA8C,WAAW;AACzD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA,sBAAqB,8BAA8B;AACnD;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;;AAEA;AACA,4BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;;AAEP;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;AAIA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8CAA6C,OAAO;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;AACA;;AAEA;AACA;AACA,uCAAsC,OAAO;AAC7C;AACA;AACA;AACA;;;;;;;AC3uBA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;;;;;;ACpDA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG,YAAY;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG,YAAY;;AAEf;AACA;AACA;AACA,MAAK,YAAY;AACjB;AACA;;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;;;;;;;AChBA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA,2BAA0B,iDAAiD;AAC3E;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA,UAAS;AACT,4DAA2D;AAC3D;AACA,QAAO;AACP;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,gIAA+H;AAC/H;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;;;AAGA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,iGAAgG;AAChG;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChaA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iCAAgC,iBAAiB;AACjD;AACA,EAAC;;AAED;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;;AAEA;AACA,QAAO;AACP;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAiB,gBAAgB;AACjC;;AAEA;;AAEA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;ACpPA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,UAAU;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;AChKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,YAAW;;AAEX;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+DAA8D,gBAAgB;AAC9E;;AAEA;;AAEA;;AAEA;AACA,gCAA+B;AAC/B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAiB,yBAAyB;AAC1C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA0B,qCAAqC;AAC/D;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAc;AACd,MAAK;AACL,eAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAU;AACV;;AAEA;AACA;AACA,+BAA8B,gBAAgB;AAC9C,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;;AAEA;AACA;AACA;AACA,aAAY,oBAAoB,oCAAoC;AACpE;;AAEA;;AAEA;AACA;AACA;;AAEA,WAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA,kBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mCAAkC,OAAO;AACzC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,aAAY,YAAY;AACxB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,oDAAmD;AACnD,MAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,cAAc;AACrC;AACA;AACA;AACA;;AAEA,sBAAqB;AACrB;AACA,QAAO,OAAO;AACd;AACA;;AAEA;AACA,sBAAqB,mBAAmB;AACxC;AACA;AACA;;AAEA;AACA,sBAAqB,iBAAiB;AACtC;AACA;AACA,MAAK;;AAEL;AACA,IAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAqB,mBAAmB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,YAAY;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAmB,EAAE;AACrB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,wBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;;;;;;;;AC3lBA;AACA;AACA;AACA,aAAY,MAAM;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AClBA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC/DA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA0B,sCAAsC;;AAEhE,mBAAkB,gBAAgB;AAClC,iBAAgB,cAAc;AAC9B,qBAAoB,aAAa;;AAEjC;AACA;AACA;;AAEA;AACA;AACA,8BAA6B,SAAS;AACtC;AACA;AACA;AACA;;;;;;;AC5BA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;;;;;;;AC3BA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAoC;AACpC;AACA,KAAI;AACJ,4BAA2B;AAC3B;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sCAAqC;AACrC;AACA;AACA;AACA,sCAAqC;AACrC;AACA;AACA,2CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,2CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAiB,kBAAkB;AACnC;AACA;;AAEA;AACA;AACA;;AAEA,gBAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAe,SAAS;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;;;;;;AClED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,EAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,IAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA,0DAAyD;AACzD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA,EAAC;;;;;;;ACnGD;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACNA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,cAAa,gBAAgB;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAM,YAAY;;AAElB;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,oBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;;;;;;;AC9OA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAC;AACD;AACA;;AAEA;AACA;AACA;AACA,IAAG,YAAY;AACf;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,UAAS,OAAO;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA4B,OAAO;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA,UAAS;;AAET;;AAEA;AACA,QAAO;AACP,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;;;;;;;ACtSA,gB;;;;;;;ACCA;;AAEA;AACA;AACA,kBAAiB,gBAAgB;AACjC;AACA;AACA;AACA,G;;;;;;;;;;ACRA;;;;AAIA,KAAI3I,SAAS,mBAAAD,CAAQ,CAAR,CAAb;AACA,KAAIuC,UAAU,mBAAAvC,CAAQ,CAAR,CAAd;AACA,KAAI6I,UAAU,mBAAA7I,CAAQ,EAAR,CAAd;AACA,KAAIwC,KAAK,mBAAAxC,CAAQ,EAAR,CAAT;AACA,KAAIyC,OAAO,mBAAAzC,CAAQ,EAAR,CAAX;AACA,KAAIG,QAAQ,mBAAAH,CAAQ,CAAR,EAAiB,yBAAjB,CAAZ;AACA,KAAI8I,UAAU,mBAAA9I,CAAQ,EA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A;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","file":"socket.io.slim.dev.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 808b2ef720f56a2d39b6","\n/**\n * Module dependencies.\n */\n\nvar url = require('./url');\nvar parser = require('socket.io-parser');\nvar Manager = require('./manager');\nvar debug = require('debug')('socket.io-client');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = lookup;\n\n/**\n * Managers cache.\n */\n\nvar cache = exports.managers = {};\n\n/**\n * Looks up an existing `Manager` for multiplexing.\n * If the user summons:\n *\n * `io('http://localhost/a');`\n * `io('http://localhost/b');`\n *\n * We reuse the existing instance based on same scheme/port/host,\n * and we initialize sockets for each namespace.\n *\n * @api public\n */\n\nfunction lookup (uri, opts) {\n if (typeof uri === 'object') {\n opts = uri;\n uri = undefined;\n }\n\n opts = opts || {};\n\n var parsed = url(uri);\n var source = parsed.source;\n var id = parsed.id;\n var path = parsed.path;\n var sameNamespace = cache[id] && path in cache[id].nsps;\n var newConnection = opts.forceNew || opts['force new connection'] ||\n false === opts.multiplex || sameNamespace;\n\n var io;\n\n if (newConnection) {\n\n io = Manager(source, opts);\n } else {\n if (!cache[id]) {\n\n cache[id] = Manager(source, opts);\n }\n io = cache[id];\n }\n if (parsed.query && !opts.query) {\n opts.query = parsed.query;\n }\n return io.socket(parsed.path, opts);\n}\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = parser.protocol;\n\n/**\n * `connect`.\n *\n * @param {String} uri\n * @api public\n */\n\nexports.connect = lookup;\n\n/**\n * Expose constructors for standalone build.\n *\n * @api public\n */\n\nexports.Manager = require('./manager');\nexports.Socket = require('./socket');\n\n\n\n// WEBPACK FOOTER //\n// ./lib/index.js","\n/**\n * Module dependencies.\n */\n\nvar parseuri = require('parseuri');\nvar debug = require('debug')('socket.io-client:url');\n\n/**\n * Module exports.\n */\n\nmodule.exports = url;\n\n/**\n * URL parser.\n *\n * @param {String} url\n * @param {Object} An object meant to mimic window.location.\n * Defaults to window.location.\n * @api public\n */\n\nfunction url (uri, loc) {\n var obj = uri;\n\n // default to window.location\n loc = loc || (typeof location !== 'undefined' && location);\n if (null == uri) uri = loc.protocol + '//' + loc.host;\n\n // relative path support\n if ('string' === typeof uri) {\n if ('/' === uri.charAt(0)) {\n if ('/' === uri.charAt(1)) {\n uri = loc.protocol + uri;\n } else {\n uri = loc.host + uri;\n }\n }\n\n if (!/^(https?|wss?):\\/\\//.test(uri)) {\n\n if ('undefined' !== typeof loc) {\n uri = loc.protocol + '//' + uri;\n } else {\n uri = 'https://' + uri;\n }\n }\n\n // parse\n\n obj = parseuri(uri);\n }\n\n // make sure we treat `localhost:80` and `localhost` equally\n if (!obj.port) {\n if (/^(http|ws)$/.test(obj.protocol)) {\n obj.port = '80';\n } else if (/^(http|ws)s$/.test(obj.protocol)) {\n obj.port = '443';\n }\n }\n\n obj.path = obj.path || '/';\n\n var ipv6 = obj.host.indexOf(':') !== -1;\n var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\n // define unique id\n obj.id = obj.protocol + '://' + host + ':' + obj.port;\n // define href\n obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));\n\n return obj;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/url.js","/**\r\n * Parses an URI\r\n *\r\n * @author Steven Levithan <stevenlevithan.com> (MIT license)\r\n * @api private\r\n */\r\n\r\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\r\n\r\nvar parts = [\r\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\r\n];\r\n\r\nmodule.exports = function parseuri(str) {\r\n var src = str,\r\n b = str.indexOf('['),\r\n e = str.indexOf(']');\r\n\r\n if (b != -1 && e != -1) {\r\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\r\n }\r\n\r\n var m = re.exec(str || ''),\r\n uri = {},\r\n i = 14;\r\n\r\n while (i--) {\r\n uri[parts[i]] = m[i] || '';\r\n }\r\n\r\n if (b != -1 && e != -1) {\r\n uri.source = src;\r\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\r\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\r\n uri.ipv6uri = true;\r\n }\r\n\r\n return uri;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseuri/index.js\n// module id = 2\n// module chunks = 0","\nmodule.exports = function () { return function () {}; };\n\n\n\n// WEBPACK FOOTER //\n// ./support/noop.js","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar binary = require('./binary');\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = 4;\n\n/**\n * Packet types.\n *\n * @api public\n */\n\nexports.types = [\n 'CONNECT',\n 'DISCONNECT',\n 'EVENT',\n 'ACK',\n 'ERROR',\n 'BINARY_EVENT',\n 'BINARY_ACK'\n];\n\n/**\n * Packet type `connect`.\n *\n * @api public\n */\n\nexports.CONNECT = 0;\n\n/**\n * Packet type `disconnect`.\n *\n * @api public\n */\n\nexports.DISCONNECT = 1;\n\n/**\n * Packet type `event`.\n *\n * @api public\n */\n\nexports.EVENT = 2;\n\n/**\n * Packet type `ack`.\n *\n * @api public\n */\n\nexports.ACK = 3;\n\n/**\n * Packet type `error`.\n *\n * @api public\n */\n\nexports.ERROR = 4;\n\n/**\n * Packet type 'binary event'\n *\n * @api public\n */\n\nexports.BINARY_EVENT = 5;\n\n/**\n * Packet type `binary ack`. For acks with binary arguments.\n *\n * @api public\n */\n\nexports.BINARY_ACK = 6;\n\n/**\n * Encoder constructor.\n *\n * @api public\n */\n\nexports.Encoder = Encoder;\n\n/**\n * Decoder constructor.\n *\n * @api public\n */\n\nexports.Decoder = Decoder;\n\n/**\n * A socket.io Encoder instance\n *\n * @api public\n */\n\nfunction Encoder() {}\n\nvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\n/**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n * @param {Function} callback - function to handle encodings (likely engine.write)\n * @return Calls callback with Array of encodings\n * @api public\n */\n\nEncoder.prototype.encode = function(obj, callback){\n\n\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n encodeAsBinary(obj, callback);\n } else {\n var encoding = encodeAsString(obj);\n callback([encoding]);\n }\n};\n\n/**\n * Encode packet as string.\n *\n * @param {Object} packet\n * @return {String} encoded\n * @api private\n */\n\nfunction encodeAsString(obj) {\n\n // first is type\n var str = '' + obj.type;\n\n // attachments if we have them\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n str += obj.attachments + '-';\n }\n\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && '/' !== obj.nsp) {\n str += obj.nsp + ',';\n }\n\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n\n // json data\n if (null != obj.data) {\n var payload = tryStringify(obj.data);\n if (payload !== false) {\n str += payload;\n } else {\n return ERROR_PACKET;\n }\n }\n\n\n return str;\n}\n\nfunction tryStringify(str) {\n try {\n return JSON.stringify(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n *\n * @param {Object} packet\n * @return {Buffer} encoded\n * @api private\n */\n\nfunction encodeAsBinary(obj, callback) {\n\n function writeEncoding(bloblessData) {\n var deconstruction = binary.deconstructPacket(bloblessData);\n var pack = encodeAsString(deconstruction.packet);\n var buffers = deconstruction.buffers;\n\n buffers.unshift(pack); // add packet info to beginning of data list\n callback(buffers); // write all the buffers\n }\n\n binary.removeBlobs(obj, writeEncoding);\n}\n\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n * @api public\n */\n\nfunction Decoder() {\n this.reconstructor = null;\n}\n\n/**\n * Mix in `Emitter` with Decoder.\n */\n\nEmitter(Decoder.prototype);\n\n/**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n * @return {Object} packet\n * @api public\n */\n\nDecoder.prototype.add = function(obj) {\n var packet;\n if (typeof obj === 'string') {\n packet = decodeString(obj);\n if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n\n // no attachments, labeled binary but no binary data to follow\n if (this.reconstructor.reconPack.attachments === 0) {\n this.emit('decoded', packet);\n }\n } else { // non-binary full packet\n this.emit('decoded', packet);\n }\n } else if (isBuf(obj) || obj.base64) { // raw binary data\n if (!this.reconstructor) {\n throw new Error('got binary data when not reconstructing a packet');\n } else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) { // received final buffer\n this.reconstructor = null;\n this.emit('decoded', packet);\n }\n }\n } else {\n throw new Error('Unknown type: ' + obj);\n }\n};\n\n/**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n * @api private\n */\n\nfunction decodeString(str) {\n var i = 0;\n // look up type\n var p = {\n type: Number(str.charAt(0))\n };\n\n if (null == exports.types[p.type]) {\n return error('unknown packet type ' + p.type);\n }\n\n // look up attachments if type binary\n if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n var buf = '';\n while (str.charAt(++i) !== '-') {\n buf += str.charAt(i);\n if (i == str.length) break;\n }\n if (buf != Number(buf) || str.charAt(i) !== '-') {\n throw new Error('Illegal attachments');\n }\n p.attachments = Number(buf);\n }\n\n // look up namespace (if any)\n if ('/' === str.charAt(i + 1)) {\n p.nsp = '';\n while (++i) {\n var c = str.charAt(i);\n if (',' === c) break;\n p.nsp += c;\n if (i === str.length) break;\n }\n } else {\n p.nsp = '/';\n }\n\n // look up id\n var next = str.charAt(i + 1);\n if ('' !== next && Number(next) == next) {\n p.id = '';\n while (++i) {\n var c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n p.id += str.charAt(i);\n if (i === str.length) break;\n }\n p.id = Number(p.id);\n }\n\n // look up json data\n if (str.charAt(++i)) {\n var payload = tryParse(str.substr(i));\n var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n if (isPayloadValid) {\n p.data = payload;\n } else {\n return error('invalid payload');\n }\n }\n\n\n return p;\n}\n\nfunction tryParse(str) {\n try {\n return JSON.parse(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Deallocates a parser's resources\n *\n * @api public\n */\n\nDecoder.prototype.destroy = function() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n }\n};\n\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n * @api private\n */\n\nfunction BinaryReconstructor(packet) {\n this.reconPack = packet;\n this.buffers = [];\n}\n\n/**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n * @api private\n */\n\nBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n};\n\n/**\n * Cleans up binary packet reconstruction variables.\n *\n * @api private\n */\n\nBinaryReconstructor.prototype.finishedReconstruction = function() {\n this.reconPack = null;\n this.buffers = [];\n};\n\nfunction error(msg) {\n return {\n type: exports.ERROR,\n data: 'parser error: ' + msg\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/index.js\n// module id = 4\n// module chunks = 0","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-emitter/index.js\n// module id = 5\n// module chunks = 0","/*global Blob,File*/\n\n/**\n * Module requirements\n */\n\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\nvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\n/**\n * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n * Anything with blobs or files should be fed through removeBlobs before coming\n * here.\n *\n * @param {Object} packet - socket.io event packet\n * @return {Object} with deconstructed packet and list of buffers\n * @api public\n */\n\nexports.deconstructPacket = function(packet) {\n var buffers = [];\n var packetData = packet.data;\n var pack = packet;\n pack.data = _deconstructPacket(packetData, buffers);\n pack.attachments = buffers.length; // number of binary 'attachments'\n return {packet: pack, buffers: buffers};\n};\n\nfunction _deconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (isBuf(data)) {\n var placeholder = { _placeholder: true, num: buffers.length };\n buffers.push(data);\n return placeholder;\n } else if (isArray(data)) {\n var newData = new Array(data.length);\n for (var i = 0; i < data.length; i++) {\n newData[i] = _deconstructPacket(data[i], buffers);\n }\n return newData;\n } else if (typeof data === 'object' && !(data instanceof Date)) {\n var newData = {};\n for (var key in data) {\n newData[key] = _deconstructPacket(data[key], buffers);\n }\n return newData;\n }\n return data;\n}\n\n/**\n * Reconstructs a binary packet from its placeholder packet and buffers\n *\n * @param {Object} packet - event packet with placeholders\n * @param {Array} buffers - binary buffers to put in placeholder positions\n * @return {Object} reconstructed packet\n * @api public\n */\n\nexports.reconstructPacket = function(packet, buffers) {\n packet.data = _reconstructPacket(packet.data, buffers);\n packet.attachments = undefined; // no longer useful\n return packet;\n};\n\nfunction _reconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (data && data._placeholder) {\n return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n } else if (isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n data[i] = _reconstructPacket(data[i], buffers);\n }\n } else if (typeof data === 'object') {\n for (var key in data) {\n data[key] = _reconstructPacket(data[key], buffers);\n }\n }\n\n return data;\n}\n\n/**\n * Asynchronously removes Blobs or Files from data via\n * FileReader's readAsArrayBuffer method. Used before encoding\n * data as msgpack. Calls callback with the blobless data.\n *\n * @param {Object} data\n * @param {Function} callback\n * @api private\n */\n\nexports.removeBlobs = function(data, callback) {\n function _removeBlobs(obj, curKey, containingObject) {\n if (!obj) return obj;\n\n // convert any blob\n if ((withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)) {\n pendingBlobs++;\n\n // async filereader\n var fileReader = new FileReader();\n fileReader.onload = function() { // this.result == arraybuffer\n if (containingObject) {\n containingObject[curKey] = this.result;\n }\n else {\n bloblessData = this.result;\n }\n\n // if nothing pending its callback time\n if(! --pendingBlobs) {\n callback(bloblessData);\n }\n };\n\n fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n } else if (isArray(obj)) { // handle array\n for (var i = 0; i < obj.length; i++) {\n _removeBlobs(obj[i], i, obj);\n }\n } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n for (var key in obj) {\n _removeBlobs(obj[key], key, obj);\n }\n }\n }\n\n var pendingBlobs = 0;\n var bloblessData = data;\n _removeBlobs(bloblessData);\n if (!pendingBlobs) {\n callback(bloblessData);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/binary.js\n// module id = 6\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 7\n// module chunks = 0","\nmodule.exports = isBuf;\n\nvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\nvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\nvar isView = function (obj) {\n return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n};\n\n/**\n * Returns true if obj is a buffer or an arraybuffer.\n *\n * @api private\n */\n\nfunction isBuf(obj) {\n return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/is-buffer.js\n// module id = 8\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar eio = require('engine.io-client');\nvar Socket = require('./socket');\nvar Emitter = require('component-emitter');\nvar parser = require('socket.io-parser');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:manager');\nvar indexOf = require('indexof');\nvar Backoff = require('backo2');\n\n/**\n * IE6+ hasOwnProperty\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Module exports\n */\n\nmodule.exports = Manager;\n\n/**\n * `Manager` constructor.\n *\n * @param {String} engine instance or engine uri/opts\n * @param {Object} options\n * @api public\n */\n\nfunction Manager (uri, opts) {\n if (!(this instanceof Manager)) return new Manager(uri, opts);\n if (uri && ('object' === typeof uri)) {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n\n opts.path = opts.path || '/socket.io';\n this.nsps = {};\n this.subs = [];\n this.opts = opts;\n this.reconnection(opts.reconnection !== false);\n this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n this.reconnectionDelay(opts.reconnectionDelay || 1000);\n this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n this.randomizationFactor(opts.randomizationFactor || 0.5);\n this.backoff = new Backoff({\n min: this.reconnectionDelay(),\n max: this.reconnectionDelayMax(),\n jitter: this.randomizationFactor()\n });\n this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n this.readyState = 'closed';\n this.uri = uri;\n this.connecting = [];\n this.lastPing = null;\n this.encoding = false;\n this.packetBuffer = [];\n var _parser = opts.parser || parser;\n this.encoder = new _parser.Encoder();\n this.decoder = new _parser.Decoder();\n this.autoConnect = opts.autoConnect !== false;\n if (this.autoConnect) this.open();\n}\n\n/**\n * Propagate given event to sockets and emit on `this`\n *\n * @api private\n */\n\nManager.prototype.emitAll = function () {\n this.emit.apply(this, arguments);\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n }\n }\n};\n\n/**\n * Update `socket.id` of all sockets\n *\n * @api private\n */\n\nManager.prototype.updateSocketIds = function () {\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].id = this.generateId(nsp);\n }\n }\n};\n\n/**\n * generate `socket.id` for the given `nsp`\n *\n * @param {String} nsp\n * @return {String}\n * @api private\n */\n\nManager.prototype.generateId = function (nsp) {\n return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;\n};\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Manager.prototype);\n\n/**\n * Sets the `reconnection` config.\n *\n * @param {Boolean} true/false if it should automatically reconnect\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnection = function (v) {\n if (!arguments.length) return this._reconnection;\n this._reconnection = !!v;\n return this;\n};\n\n/**\n * Sets the reconnection attempts config.\n *\n * @param {Number} max reconnection attempts before giving up\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionAttempts = function (v) {\n if (!arguments.length) return this._reconnectionAttempts;\n this._reconnectionAttempts = v;\n return this;\n};\n\n/**\n * Sets the delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelay = function (v) {\n if (!arguments.length) return this._reconnectionDelay;\n this._reconnectionDelay = v;\n this.backoff && this.backoff.setMin(v);\n return this;\n};\n\nManager.prototype.randomizationFactor = function (v) {\n if (!arguments.length) return this._randomizationFactor;\n this._randomizationFactor = v;\n this.backoff && this.backoff.setJitter(v);\n return this;\n};\n\n/**\n * Sets the maximum delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelayMax = function (v) {\n if (!arguments.length) return this._reconnectionDelayMax;\n this._reconnectionDelayMax = v;\n this.backoff && this.backoff.setMax(v);\n return this;\n};\n\n/**\n * Sets the connection timeout. `false` to disable\n *\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.timeout = function (v) {\n if (!arguments.length) return this._timeout;\n this._timeout = v;\n return this;\n};\n\n/**\n * Starts trying to reconnect if reconnection is enabled and we have not\n * started reconnecting yet\n *\n * @api private\n */\n\nManager.prototype.maybeReconnectOnOpen = function () {\n // Only try to reconnect if it's the first time we're connecting\n if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n // keeps reconnection from firing twice for the same reconnection loop\n this.reconnect();\n }\n};\n\n/**\n * Sets the current transport `socket`.\n *\n * @param {Function} optional, callback\n * @return {Manager} self\n * @api public\n */\n\nManager.prototype.open =\nManager.prototype.connect = function (fn, opts) {\n\n if (~this.readyState.indexOf('open')) return this;\n\n\n this.engine = eio(this.uri, this.opts);\n var socket = this.engine;\n var self = this;\n this.readyState = 'opening';\n this.skipReconnect = false;\n\n // emit `open`\n var openSub = on(socket, 'open', function () {\n self.onopen();\n fn && fn();\n });\n\n // emit `connect_error`\n var errorSub = on(socket, 'error', function (data) {\n\n self.cleanup();\n self.readyState = 'closed';\n self.emitAll('connect_error', data);\n if (fn) {\n var err = new Error('Connection error');\n err.data = data;\n fn(err);\n } else {\n // Only do this if there is no fn to handle the error\n self.maybeReconnectOnOpen();\n }\n });\n\n // emit `connect_timeout`\n if (false !== this._timeout) {\n var timeout = this._timeout;\n\n\n // set timer\n var timer = setTimeout(function () {\n\n openSub.destroy();\n socket.close();\n socket.emit('error', 'timeout');\n self.emitAll('connect_timeout', timeout);\n }, timeout);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n\n this.subs.push(openSub);\n this.subs.push(errorSub);\n\n return this;\n};\n\n/**\n * Called upon transport open.\n *\n * @api private\n */\n\nManager.prototype.onopen = function () {\n\n\n // clear old subs\n this.cleanup();\n\n // mark as open\n this.readyState = 'open';\n this.emit('open');\n\n // add new subs\n var socket = this.engine;\n this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n};\n\n/**\n * Called upon a ping.\n *\n * @api private\n */\n\nManager.prototype.onping = function () {\n this.lastPing = new Date();\n this.emitAll('ping');\n};\n\n/**\n * Called upon a packet.\n *\n * @api private\n */\n\nManager.prototype.onpong = function () {\n this.emitAll('pong', new Date() - this.lastPing);\n};\n\n/**\n * Called with data.\n *\n * @api private\n */\n\nManager.prototype.ondata = function (data) {\n this.decoder.add(data);\n};\n\n/**\n * Called when parser fully decodes a packet.\n *\n * @api private\n */\n\nManager.prototype.ondecoded = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon socket error.\n *\n * @api private\n */\n\nManager.prototype.onerror = function (err) {\n\n this.emitAll('error', err);\n};\n\n/**\n * Creates a new socket for the given `nsp`.\n *\n * @return {Socket}\n * @api public\n */\n\nManager.prototype.socket = function (nsp, opts) {\n var socket = this.nsps[nsp];\n if (!socket) {\n socket = new Socket(this, nsp, opts);\n this.nsps[nsp] = socket;\n var self = this;\n socket.on('connecting', onConnecting);\n socket.on('connect', function () {\n socket.id = self.generateId(nsp);\n });\n\n if (this.autoConnect) {\n // manually call here since connecting event is fired before listening\n onConnecting();\n }\n }\n\n function onConnecting () {\n if (!~indexOf(self.connecting, socket)) {\n self.connecting.push(socket);\n }\n }\n\n return socket;\n};\n\n/**\n * Called upon a socket close.\n *\n * @param {Socket} socket\n */\n\nManager.prototype.destroy = function (socket) {\n var index = indexOf(this.connecting, socket);\n if (~index) this.connecting.splice(index, 1);\n if (this.connecting.length) return;\n\n this.close();\n};\n\n/**\n * Writes a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nManager.prototype.packet = function (packet) {\n\n var self = this;\n if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\n if (!self.encoding) {\n // encode, then write to engine with result\n self.encoding = true;\n this.encoder.encode(packet, function (encodedPackets) {\n for (var i = 0; i < encodedPackets.length; i++) {\n self.engine.write(encodedPackets[i], packet.options);\n }\n self.encoding = false;\n self.processPacketQueue();\n });\n } else { // add packet to the queue\n self.packetBuffer.push(packet);\n }\n};\n\n/**\n * If packet buffer is non-empty, begins encoding the\n * next packet in line.\n *\n * @api private\n */\n\nManager.prototype.processPacketQueue = function () {\n if (this.packetBuffer.length > 0 && !this.encoding) {\n var pack = this.packetBuffer.shift();\n this.packet(pack);\n }\n};\n\n/**\n * Clean up transport subscriptions and packet buffer.\n *\n * @api private\n */\n\nManager.prototype.cleanup = function () {\n\n\n var subsLength = this.subs.length;\n for (var i = 0; i < subsLength; i++) {\n var sub = this.subs.shift();\n sub.destroy();\n }\n\n this.packetBuffer = [];\n this.encoding = false;\n this.lastPing = null;\n\n this.decoder.destroy();\n};\n\n/**\n * Close the current socket.\n *\n * @api private\n */\n\nManager.prototype.close =\nManager.prototype.disconnect = function () {\n\n this.skipReconnect = true;\n this.reconnecting = false;\n if ('opening' === this.readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this.readyState = 'closed';\n if (this.engine) this.engine.close();\n};\n\n/**\n * Called upon engine close.\n *\n * @api private\n */\n\nManager.prototype.onclose = function (reason) {\n\n\n this.cleanup();\n this.backoff.reset();\n this.readyState = 'closed';\n this.emit('close', reason);\n\n if (this._reconnection && !this.skipReconnect) {\n this.reconnect();\n }\n};\n\n/**\n * Attempt a reconnection.\n *\n * @api private\n */\n\nManager.prototype.reconnect = function () {\n if (this.reconnecting || this.skipReconnect) return this;\n\n var self = this;\n\n if (this.backoff.attempts >= this._reconnectionAttempts) {\n\n this.backoff.reset();\n this.emitAll('reconnect_failed');\n this.reconnecting = false;\n } else {\n var delay = this.backoff.duration();\n\n\n this.reconnecting = true;\n var timer = setTimeout(function () {\n if (self.skipReconnect) return;\n\n\n self.emitAll('reconnect_attempt', self.backoff.attempts);\n self.emitAll('reconnecting', self.backoff.attempts);\n\n // check again for the case socket closed in above events\n if (self.skipReconnect) return;\n\n self.open(function (err) {\n if (err) {\n\n self.reconnecting = false;\n self.reconnect();\n self.emitAll('reconnect_error', err.data);\n } else {\n\n self.onreconnect();\n }\n });\n }, delay);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n};\n\n/**\n * Called upon successful reconnect.\n *\n * @api private\n */\n\nManager.prototype.onreconnect = function () {\n var attempt = this.backoff.attempts;\n this.reconnecting = false;\n this.backoff.reset();\n this.updateSocketIds();\n this.emitAll('reconnect', attempt);\n};\n\n\n\n// WEBPACK FOOTER //\n// ./lib/manager.js","\nmodule.exports = require('./socket');\n\n/**\n * Exports parser\n *\n * @api public\n *\n */\nmodule.exports.parser = require('engine.io-parser');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/index.js\n// module id = 10\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar transports = require('./transports/index');\nvar Emitter = require('component-emitter');\nvar debug = require('debug')('engine.io-client:socket');\nvar index = require('indexof');\nvar parser = require('engine.io-parser');\nvar parseuri = require('parseuri');\nvar parseqs = require('parseqs');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Socket;\n\n/**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n\nfunction Socket (uri, opts) {\n if (!(this instanceof Socket)) return new Socket(uri, opts);\n\n opts = opts || {};\n\n if (uri && 'object' === typeof uri) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n this.secure = null != opts.secure ? opts.secure\n : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = this.secure ? '443' : '80';\n }\n\n this.agent = opts.agent || false;\n this.hostname = opts.hostname ||\n (typeof location !== 'undefined' ? location.hostname : 'localhost');\n this.port = opts.port || (typeof location !== 'undefined' && location.port\n ? location.port\n : (this.secure ? 443 : 80));\n this.query = opts.query || {};\n if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n this.upgrade = false !== opts.upgrade;\n this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n this.forceJSONP = !!opts.forceJSONP;\n this.jsonp = false !== opts.jsonp;\n this.forceBase64 = !!opts.forceBase64;\n this.enablesXDR = !!opts.enablesXDR;\n this.withCredentials = false !== opts.withCredentials;\n this.timestampParam = opts.timestampParam || 't';\n this.timestampRequests = opts.timestampRequests;\n this.transports = opts.transports || ['polling', 'websocket'];\n this.transportOptions = opts.transportOptions || {};\n this.readyState = '';\n this.writeBuffer = [];\n this.prevBufferLen = 0;\n this.policyPort = opts.policyPort || 843;\n this.rememberUpgrade = opts.rememberUpgrade || false;\n this.binaryType = null;\n this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\n if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n this.perMessageDeflate.threshold = 1024;\n }\n\n // SSL options for Node.js client\n this.pfx = opts.pfx || null;\n this.key = opts.key || null;\n this.passphrase = opts.passphrase || null;\n this.cert = opts.cert || null;\n this.ca = opts.ca || null;\n this.ciphers = opts.ciphers || null;\n this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n this.forceNode = !!opts.forceNode;\n\n // detect ReactNative environment\n this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\n // other options for Node.js or ReactNative client\n if (typeof self === 'undefined' || this.isReactNative) {\n if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n this.extraHeaders = opts.extraHeaders;\n }\n\n if (opts.localAddress) {\n this.localAddress = opts.localAddress;\n }\n }\n\n // set on handshake\n this.id = null;\n this.upgrades = null;\n this.pingInterval = null;\n this.pingTimeout = null;\n\n // set on heartbeat\n this.pingIntervalTimer = null;\n this.pingTimeoutTimer = null;\n\n this.open();\n}\n\nSocket.priorWebsocketSuccess = false;\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\nSocket.Socket = Socket;\nSocket.Transport = require('./transport');\nSocket.transports = require('./transports/index');\nSocket.parser = require('engine.io-parser');\n\n/**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n\nSocket.prototype.createTransport = function (name) {\n\n var query = clone(this.query);\n\n // append engine.io protocol identifier\n query.EIO = parser.protocol;\n\n // transport name\n query.transport = name;\n\n // per-transport options\n var options = this.transportOptions[name] || {};\n\n // session id if we already have one\n if (this.id) query.sid = this.id;\n\n var transport = new transports[name]({\n query: query,\n socket: this,\n agent: options.agent || this.agent,\n hostname: options.hostname || this.hostname,\n port: options.port || this.port,\n secure: options.secure || this.secure,\n path: options.path || this.path,\n forceJSONP: options.forceJSONP || this.forceJSONP,\n jsonp: options.jsonp || this.jsonp,\n forceBase64: options.forceBase64 || this.forceBase64,\n enablesXDR: options.enablesXDR || this.enablesXDR,\n withCredentials: options.withCredentials || this.withCredentials,\n timestampRequests: options.timestampRequests || this.timestampRequests,\n timestampParam: options.timestampParam || this.timestampParam,\n policyPort: options.policyPort || this.policyPort,\n pfx: options.pfx || this.pfx,\n key: options.key || this.key,\n passphrase: options.passphrase || this.passphrase,\n cert: options.cert || this.cert,\n ca: options.ca || this.ca,\n ciphers: options.ciphers || this.ciphers,\n rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n extraHeaders: options.extraHeaders || this.extraHeaders,\n forceNode: options.forceNode || this.forceNode,\n localAddress: options.localAddress || this.localAddress,\n requestTimeout: options.requestTimeout || this.requestTimeout,\n protocols: options.protocols || void (0),\n isReactNative: this.isReactNative\n });\n\n return transport;\n};\n\nfunction clone (obj) {\n var o = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n return o;\n}\n\n/**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\nSocket.prototype.open = function () {\n var transport;\n if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n transport = 'websocket';\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n var self = this;\n setTimeout(function () {\n self.emit('error', 'No transports available');\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n this.readyState = 'opening';\n\n // Retry with the next transport if the transport is disabled (jsonp: false)\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n};\n\n/**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n\nSocket.prototype.setTransport = function (transport) {\n\n var self = this;\n\n if (this.transport) {\n\n this.transport.removeAllListeners();\n }\n\n // set up transport\n this.transport = transport;\n\n // set up transport listeners\n transport\n .on('drain', function () {\n self.onDrain();\n })\n .on('packet', function (packet) {\n self.onPacket(packet);\n })\n .on('error', function (e) {\n self.onError(e);\n })\n .on('close', function () {\n self.onClose('transport close');\n });\n};\n\n/**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n\nSocket.prototype.probe = function (name) {\n\n var transport = this.createTransport(name, { probe: 1 });\n var failed = false;\n var self = this;\n\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen () {\n if (self.onlyBinaryUpgrades) {\n var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n if (failed) return;\n\n\n transport.send([{ type: 'ping', data: 'probe' }]);\n transport.once('packet', function (msg) {\n if (failed) return;\n if ('pong' === msg.type && 'probe' === msg.data) {\n\n self.upgrading = true;\n self.emit('upgrading', transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\n\n self.transport.pause(function () {\n if (failed) return;\n if ('closed' === self.readyState) return;\n\n\n cleanup();\n\n self.setTransport(transport);\n transport.send([{ type: 'upgrade' }]);\n self.emit('upgrade', transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n\n var err = new Error('probe error');\n err.transport = transport.name;\n self.emit('upgradeError', err);\n }\n });\n }\n\n function freezeTransport () {\n if (failed) return;\n\n // Any callback called by transport should be ignored since now\n failed = true;\n\n cleanup();\n\n transport.close();\n transport = null;\n }\n\n // Handle any error that happens while probing\n function onerror (err) {\n var error = new Error('probe error: ' + err);\n error.transport = transport.name;\n\n freezeTransport();\n\n\n\n self.emit('upgradeError', error);\n }\n\n function onTransportClose () {\n onerror('transport closed');\n }\n\n // When the socket is closed while we're probing\n function onclose () {\n onerror('socket closed');\n }\n\n // When the socket is upgraded while we're probing\n function onupgrade (to) {\n if (transport && to.name !== transport.name) {\n\n freezeTransport();\n }\n }\n\n // Remove all listeners on the transport and on self\n function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }\n\n transport.once('open', onTransportOpen);\n transport.once('error', onerror);\n transport.once('close', onTransportClose);\n\n this.once('close', onclose);\n this.once('upgrading', onupgrade);\n\n transport.open();\n};\n\n/**\n * Called when connection is deemed open.\n *\n * @api public\n */\n\nSocket.prototype.onOpen = function () {\n\n this.readyState = 'open';\n Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n this.emit('open');\n this.flush();\n\n // we check for `readyState` in case an `open`\n // listener already closed the socket\n if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n\n for (var i = 0, l = this.upgrades.length; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n};\n\n/**\n * Handles a packet.\n *\n * @api private\n */\n\nSocket.prototype.onPacket = function (packet) {\n if ('opening' === this.readyState || 'open' === this.readyState ||\n 'closing' === this.readyState) {\n\n\n this.emit('packet', packet);\n\n // Socket is live - any packet counts\n this.emit('heartbeat');\n\n switch (packet.type) {\n case 'open':\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case 'pong':\n this.setPing();\n this.emit('pong');\n break;\n\n case 'error':\n var err = new Error('server error');\n err.code = packet.data;\n this.onError(err);\n break;\n\n case 'message':\n this.emit('data', packet.data);\n this.emit('message', packet.data);\n break;\n }\n } else {\n\n }\n};\n\n/**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n\nSocket.prototype.onHandshake = function (data) {\n this.emit('handshake', data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen();\n // In case open handler closes socket\n if ('closed' === this.readyState) return;\n this.setPing();\n\n // Prolong liveness of socket on heartbeat\n this.removeListener('heartbeat', this.onHeartbeat);\n this.on('heartbeat', this.onHeartbeat);\n};\n\n/**\n * Resets ping timeout.\n *\n * @api private\n */\n\nSocket.prototype.onHeartbeat = function (timeout) {\n clearTimeout(this.pingTimeoutTimer);\n var self = this;\n self.pingTimeoutTimer = setTimeout(function () {\n if ('closed' === self.readyState) return;\n self.onClose('ping timeout');\n }, timeout || (self.pingInterval + self.pingTimeout));\n};\n\n/**\n * Pings server every `this.pingInterval` and expects response\n * within `this.pingTimeout` or closes connection.\n *\n * @api private\n */\n\nSocket.prototype.setPing = function () {\n var self = this;\n clearTimeout(self.pingIntervalTimer);\n self.pingIntervalTimer = setTimeout(function () {\n\n self.ping();\n self.onHeartbeat(self.pingTimeout);\n }, self.pingInterval);\n};\n\n/**\n* Sends a ping packet.\n*\n* @api private\n*/\n\nSocket.prototype.ping = function () {\n var self = this;\n this.sendPacket('ping', function () {\n self.emit('ping');\n });\n};\n\n/**\n * Called on `drain` event\n *\n * @api private\n */\n\nSocket.prototype.onDrain = function () {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit('drain');\n } else {\n this.flush();\n }\n};\n\n/**\n * Flush write buffers.\n *\n * @api private\n */\n\nSocket.prototype.flush = function () {\n if ('closed' !== this.readyState && this.transport.writable &&\n !this.upgrading && this.writeBuffer.length) {\n\n this.transport.send(this.writeBuffer);\n // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n this.prevBufferLen = this.writeBuffer.length;\n this.emit('flush');\n }\n};\n\n/**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n\nSocket.prototype.write =\nSocket.prototype.send = function (msg, options, fn) {\n this.sendPacket('message', msg, options, fn);\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n\nSocket.prototype.sendPacket = function (type, data, options, fn) {\n if ('function' === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if ('function' === typeof options) {\n fn = options;\n options = null;\n }\n\n if ('closing' === this.readyState || 'closed' === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n\n var packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit('packetCreate', packet);\n this.writeBuffer.push(packet);\n if (fn) this.once('flush', fn);\n this.flush();\n};\n\n/**\n * Closes the connection.\n *\n * @api private\n */\n\nSocket.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.readyState = 'closing';\n\n var self = this;\n\n if (this.writeBuffer.length) {\n this.once('drain', function () {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close () {\n self.onClose('forced close');\n\n self.transport.close();\n }\n\n function cleanupAndClose () {\n self.removeListener('upgrade', cleanupAndClose);\n self.removeListener('upgradeError', cleanupAndClose);\n close();\n }\n\n function waitForUpgrade () {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once('upgrade', cleanupAndClose);\n self.once('upgradeError', cleanupAndClose);\n }\n\n return this;\n};\n\n/**\n * Called upon transport error\n *\n * @api private\n */\n\nSocket.prototype.onError = function (err) {\n\n Socket.priorWebsocketSuccess = false;\n this.emit('error', err);\n this.onClose('transport error', err);\n};\n\n/**\n * Called upon transport close.\n *\n * @api private\n */\n\nSocket.prototype.onClose = function (reason, desc) {\n if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n\n var self = this;\n\n // clear timers\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer);\n\n // stop event from firing again for transport\n this.transport.removeAllListeners('close');\n\n // ensure transport won't stay open\n this.transport.close();\n\n // ignore further transport communication\n this.transport.removeAllListeners();\n\n // set ready state\n this.readyState = 'closed';\n\n // clear session id\n this.id = null;\n\n // emit close event\n this.emit('close', reason, desc);\n\n // clean buffers after, so users can still\n // grab the buffers on `close` event\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n};\n\n/**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n\nSocket.prototype.filterUpgrades = function (upgrades) {\n var filteredUpgrades = [];\n for (var i = 0, j = upgrades.length; i < j; i++) {\n if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n }\n return filteredUpgrades;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/socket.js\n// module id = 11\n// module chunks = 0","/**\n * Module dependencies\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar XHR = require('./polling-xhr');\nvar JSONP = require('./polling-jsonp');\nvar websocket = require('./websocket');\n\n/**\n * Export transports.\n */\n\nexports.polling = polling;\nexports.websocket = websocket;\n\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling (opts) {\n var xhr;\n var xd = false;\n var xs = false;\n var jsonp = false !== opts.jsonp;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if ('open' in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error('JSONP disabled');\n return new JSONP(opts);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/index.js\n// module id = 12\n// module chunks = 0","// browser shim for xmlhttprequest module\n\nvar hasCORS = require('has-cors');\n\nmodule.exports = function (opts) {\n var xdomain = opts.xdomain;\n\n // scheme must be same when usign XDomainRequest\n // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n var xscheme = opts.xscheme;\n\n // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n // https://github.com/Automattic/engine.io-client/pull/217\n var enablesXDR = opts.enablesXDR;\n\n // XMLHttpRequest can be disabled on IE\n try {\n if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n return new XMLHttpRequest();\n }\n } catch (e) { }\n\n // Use XDomainRequest for IE8 if enablesXDR is true\n // because loading bar keeps flashing when using jsonp-polling\n // https://github.com/yujiosaka/socke.io-ie8-loading-example\n try {\n if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n return new XDomainRequest();\n }\n } catch (e) { }\n\n if (!xdomain) {\n try {\n return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n } catch (e) { }\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/xmlhttprequest.js\n// module id = 13\n// module chunks = 0","\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-cors/index.js\n// module id = 14\n// module chunks = 0","/* global attachEvent */\n\n/**\n * Module requirements.\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar Polling = require('./polling');\nvar Emitter = require('component-emitter');\nvar inherit = require('component-inherit');\nvar debug = require('debug')('engine.io-client:polling-xhr');\n\n/**\n * Module exports.\n */\n\nmodule.exports = XHR;\nmodule.exports.Request = Request;\n\n/**\n * Empty function\n */\n\nfunction empty () {}\n\n/**\n * XHR Polling constructor.\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction XHR (opts) {\n Polling.call(this, opts);\n this.requestTimeout = opts.requestTimeout;\n this.extraHeaders = opts.extraHeaders;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n port !== opts.port;\n this.xs = opts.secure !== isSSL;\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(XHR, Polling);\n\n/**\n * XHR supports binary\n */\n\nXHR.prototype.supportsBinary = true;\n\n/**\n * Creates a request.\n *\n * @param {String} method\n * @api private\n */\n\nXHR.prototype.request = function (opts) {\n opts = opts || {};\n opts.uri = this.uri();\n opts.xd = this.xd;\n opts.xs = this.xs;\n opts.agent = this.agent || false;\n opts.supportsBinary = this.supportsBinary;\n opts.enablesXDR = this.enablesXDR;\n opts.withCredentials = this.withCredentials;\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n opts.requestTimeout = this.requestTimeout;\n\n // other options for Node.js client\n opts.extraHeaders = this.extraHeaders;\n\n return new Request(opts);\n};\n\n/**\n * Sends data.\n *\n * @param {String} data to send.\n * @param {Function} called upon flush.\n * @api private\n */\n\nXHR.prototype.doWrite = function (data, fn) {\n var isBinary = typeof data !== 'string' && data !== undefined;\n var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n var self = this;\n req.on('success', fn);\n req.on('error', function (err) {\n self.onError('xhr post error', err);\n });\n this.sendXhr = req;\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nXHR.prototype.doPoll = function () {\n\n var req = this.request();\n var self = this;\n req.on('data', function (data) {\n self.onData(data);\n });\n req.on('error', function (err) {\n self.onError('xhr poll error', err);\n });\n this.pollXhr = req;\n};\n\n/**\n * Request constructor\n *\n * @param {Object} options\n * @api public\n */\n\nfunction Request (opts) {\n this.method = opts.method || 'GET';\n this.uri = opts.uri;\n this.xd = !!opts.xd;\n this.xs = !!opts.xs;\n this.async = false !== opts.async;\n this.data = undefined !== opts.data ? opts.data : null;\n this.agent = opts.agent;\n this.isBinary = opts.isBinary;\n this.supportsBinary = opts.supportsBinary;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n this.requestTimeout = opts.requestTimeout;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n\n this.create();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Request.prototype);\n\n/**\n * Creates the XHR object and sends the request.\n *\n * @api private\n */\n\nRequest.prototype.create = function () {\n var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n\n var xhr = this.xhr = new XMLHttpRequest(opts);\n var self = this;\n\n try {\n\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (var i in this.extraHeaders) {\n if (this.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if ('POST' === this.method) {\n try {\n if (this.isBinary) {\n xhr.setRequestHeader('Content-type', 'application/octet-stream');\n } else {\n xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n }\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader('Accept', '*/*');\n } catch (e) {}\n\n // ie6 check\n if ('withCredentials' in xhr) {\n xhr.withCredentials = this.withCredentials;\n }\n\n if (this.requestTimeout) {\n xhr.timeout = this.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function () {\n self.onLoad();\n };\n xhr.onerror = function () {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 2) {\n try {\n var contentType = xhr.getResponseHeader('Content-Type');\n if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n xhr.responseType = 'arraybuffer';\n }\n } catch (e) {}\n }\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function () {\n self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly fhrom the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function () {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== 'undefined') {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n};\n\n/**\n * Called upon successful response.\n *\n * @api private\n */\n\nRequest.prototype.onSuccess = function () {\n this.emit('success');\n this.cleanup();\n};\n\n/**\n * Called if we have data.\n *\n * @api private\n */\n\nRequest.prototype.onData = function (data) {\n this.emit('data', data);\n this.onSuccess();\n};\n\n/**\n * Called upon error.\n *\n * @api private\n */\n\nRequest.prototype.onError = function (err) {\n this.emit('error', err);\n this.cleanup(true);\n};\n\n/**\n * Cleans up house.\n *\n * @api private\n */\n\nRequest.prototype.cleanup = function (fromError) {\n if ('undefined' === typeof this.xhr || null === this.xhr) {\n return;\n }\n // xmlhttprequest\n if (this.hasXDR()) {\n this.xhr.onload = this.xhr.onerror = empty;\n } else {\n this.xhr.onreadystatechange = empty;\n }\n\n if (fromError) {\n try {\n this.xhr.abort();\n } catch (e) {}\n }\n\n if (typeof document !== 'undefined') {\n delete Request.requests[this.index];\n }\n\n this.xhr = null;\n};\n\n/**\n * Called upon load.\n *\n * @api private\n */\n\nRequest.prototype.onLoad = function () {\n var data;\n try {\n var contentType;\n try {\n contentType = this.xhr.getResponseHeader('Content-Type');\n } catch (e) {}\n if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n data = this.xhr.response || this.xhr.responseText;\n } else {\n data = this.xhr.responseText;\n }\n } catch (e) {\n this.onError(e);\n }\n if (null != data) {\n this.onData(data);\n }\n};\n\n/**\n * Check if it has XDomainRequest.\n *\n * @api private\n */\n\nRequest.prototype.hasXDR = function () {\n return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n};\n\n/**\n * Aborts the request.\n *\n * @api public\n */\n\nRequest.prototype.abort = function () {\n this.cleanup();\n};\n\n/**\n * Aborts pending requests when unloading the window. This is needed to prevent\n * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n * emitted.\n */\n\nRequest.requestsCount = 0;\nRequest.requests = {};\n\nif (typeof document !== 'undefined') {\n if (typeof attachEvent === 'function') {\n attachEvent('onunload', unloadHandler);\n } else if (typeof addEventListener === 'function') {\n var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';\n addEventListener(terminationEvent, unloadHandler, false);\n }\n}\n\nfunction unloadHandler () {\n for (var i in Request.requests) {\n if (Request.requests.hasOwnProperty(i)) {\n Request.requests[i].abort();\n }\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-xhr.js\n// module id = 15\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parseqs = require('parseqs');\nvar parser = require('engine.io-parser');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:polling');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Polling;\n\n/**\n * Is XHR2 supported?\n */\n\nvar hasXHR2 = (function () {\n var XMLHttpRequest = require('xmlhttprequest-ssl');\n var xhr = new XMLHttpRequest({ xdomain: false });\n return null != xhr.responseType;\n})();\n\n/**\n * Polling interface.\n *\n * @param {Object} opts\n * @api private\n */\n\nfunction Polling (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (!hasXHR2 || forceBase64) {\n this.supportsBinary = false;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(Polling, Transport);\n\n/**\n * Transport name.\n */\n\nPolling.prototype.name = 'polling';\n\n/**\n * Opens the socket (triggers polling). We write a PING message to determine\n * when the transport is open.\n *\n * @api private\n */\n\nPolling.prototype.doOpen = function () {\n this.poll();\n};\n\n/**\n * Pauses polling.\n *\n * @param {Function} callback upon buffers are flushed and transport is paused\n * @api private\n */\n\nPolling.prototype.pause = function (onPause) {\n var self = this;\n\n this.readyState = 'pausing';\n\n function pause () {\n\n self.readyState = 'paused';\n onPause();\n }\n\n if (this.polling || !this.writable) {\n var total = 0;\n\n if (this.polling) {\n\n total++;\n this.once('pollComplete', function () {\n\n --total || pause();\n });\n }\n\n if (!this.writable) {\n\n total++;\n this.once('drain', function () {\n\n --total || pause();\n });\n }\n } else {\n pause();\n }\n};\n\n/**\n * Starts polling cycle.\n *\n * @api public\n */\n\nPolling.prototype.poll = function () {\n\n this.polling = true;\n this.doPoll();\n this.emit('poll');\n};\n\n/**\n * Overloads onData to detect payloads.\n *\n * @api private\n */\n\nPolling.prototype.onData = function (data) {\n var self = this;\n\n var callback = function (packet, index, total) {\n // if its the first message we consider the transport open\n if ('opening' === self.readyState) {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if ('close' === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType, callback);\n\n // if an event did not trigger closing\n if ('closed' !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit('pollComplete');\n\n if ('open' === this.readyState) {\n this.poll();\n } else {\n\n }\n }\n};\n\n/**\n * For polling, send a close packet.\n *\n * @api private\n */\n\nPolling.prototype.doClose = function () {\n var self = this;\n\n function close () {\n\n self.write([{ type: 'close' }]);\n }\n\n if ('open' === this.readyState) {\n\n close();\n } else {\n // in case we're trying to close while\n // handshaking is in progress (GH-164)\n\n this.once('open', close);\n }\n};\n\n/**\n * Writes a packets payload.\n *\n * @param {Array} data packets\n * @param {Function} drain callback\n * @api private\n */\n\nPolling.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n var callbackfn = function () {\n self.writable = true;\n self.emit('drain');\n };\n\n parser.encodePayload(packets, this.supportsBinary, function (data) {\n self.doWrite(data, callbackfn);\n });\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nPolling.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'https' : 'http';\n var port = '';\n\n // cache busting is forced\n if (false !== this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n if (!this.supportsBinary && !query.sid) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // avoid port if default for schema\n if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n ('http' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling.js\n// module id = 16\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar parser = require('engine.io-parser');\nvar Emitter = require('component-emitter');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Transport;\n\n/**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n\nfunction Transport (opts) {\n this.path = opts.path;\n this.hostname = opts.hostname;\n this.port = opts.port;\n this.secure = opts.secure;\n this.query = opts.query;\n this.timestampParam = opts.timestampParam;\n this.timestampRequests = opts.timestampRequests;\n this.readyState = '';\n this.agent = opts.agent || false;\n this.socket = opts.socket;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n this.forceNode = opts.forceNode;\n\n // results of ReactNative environment detection\n this.isReactNative = opts.isReactNative;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n this.localAddress = opts.localAddress;\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Transport.prototype);\n\n/**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n\nTransport.prototype.onError = function (msg, desc) {\n var err = new Error(msg);\n err.type = 'TransportError';\n err.description = desc;\n this.emit('error', err);\n return this;\n};\n\n/**\n * Opens the transport.\n *\n * @api public\n */\n\nTransport.prototype.open = function () {\n if ('closed' === this.readyState || '' === this.readyState) {\n this.readyState = 'opening';\n this.doOpen();\n }\n\n return this;\n};\n\n/**\n * Closes the transport.\n *\n * @api private\n */\n\nTransport.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n};\n\n/**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n\nTransport.prototype.send = function (packets) {\n if ('open' === this.readyState) {\n this.write(packets);\n } else {\n throw new Error('Transport not open');\n }\n};\n\n/**\n * Called upon open\n *\n * @api private\n */\n\nTransport.prototype.onOpen = function () {\n this.readyState = 'open';\n this.writable = true;\n this.emit('open');\n};\n\n/**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n\nTransport.prototype.onData = function (data) {\n var packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n};\n\n/**\n * Called with a decoded packet.\n */\n\nTransport.prototype.onPacket = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon close.\n *\n * @api private\n */\n\nTransport.prototype.onClose = function () {\n this.readyState = 'closed';\n this.emit('close');\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transport.js\n// module id = 17\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar keys = require('./keys');\nvar hasBinary = require('has-binary2');\nvar sliceBuffer = require('arraybuffer.slice');\nvar after = require('after');\nvar utf8 = require('./utf8');\n\nvar base64encoder;\nif (typeof ArrayBuffer !== 'undefined') {\n base64encoder = require('base64-arraybuffer');\n}\n\n/**\n * Check if we are running an android browser. That requires us to use\n * ArrayBuffer with polling transports...\n *\n * http://ghinda.net/jpeg-blob-ajax-android/\n */\n\nvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\n/**\n * Check if we are running in PhantomJS.\n * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n * https://github.com/ariya/phantomjs/issues/11395\n * @type boolean\n */\nvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\n/**\n * When true, avoids using Blobs to encode payloads.\n * @type boolean\n */\nvar dontSendBlobs = isAndroid || isPhantomJS;\n\n/**\n * Current protocol version.\n */\n\nexports.protocol = 3;\n\n/**\n * Packet types.\n */\n\nvar packets = exports.packets = {\n open: 0 // non-ws\n , close: 1 // non-ws\n , ping: 2\n , pong: 3\n , message: 4\n , upgrade: 5\n , noop: 6\n};\n\nvar packetslist = keys(packets);\n\n/**\n * Premade error packet.\n */\n\nvar err = { type: 'error', data: 'parser error' };\n\n/**\n * Create a blob api even for blob builder when vendor prefixes exist\n */\n\nvar Blob = require('blob');\n\n/**\n * Encodes a packet.\n *\n * <packet type id> [ <data> ]\n *\n * Example:\n *\n * 5hello world\n * 3\n * 4\n *\n * Binary is encoded in an identical principle\n *\n * @api private\n */\n\nexports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = false;\n }\n\n if (typeof utf8encode === 'function') {\n callback = utf8encode;\n utf8encode = null;\n }\n\n var data = (packet.data === undefined)\n ? undefined\n : packet.data.buffer || packet.data;\n\n if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n return encodeArrayBuffer(packet, supportsBinary, callback);\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return encodeBlob(packet, supportsBinary, callback);\n }\n\n // might be an object with { base64: true, data: dataAsBase64String }\n if (data && data.base64) {\n return encodeBase64Object(packet, callback);\n }\n\n // Sending data as a utf-8 string\n var encoded = packets[packet.type];\n\n // data fragment is optional\n if (undefined !== packet.data) {\n encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n }\n\n return callback('' + encoded);\n\n};\n\nfunction encodeBase64Object(packet, callback) {\n // packet data is an object { base64: true, data: dataAsBase64String }\n var message = 'b' + exports.packets[packet.type] + packet.data.data;\n return callback(message);\n}\n\n/**\n * Encode packet helpers for binary types\n */\n\nfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var data = packet.data;\n var contentArray = new Uint8Array(data);\n var resultBuffer = new Uint8Array(1 + data.byteLength);\n\n resultBuffer[0] = packets[packet.type];\n for (var i = 0; i < contentArray.length; i++) {\n resultBuffer[i+1] = contentArray[i];\n }\n\n return callback(resultBuffer.buffer);\n}\n\nfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var fr = new FileReader();\n fr.onload = function() {\n exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n };\n return fr.readAsArrayBuffer(packet.data);\n}\n\nfunction encodeBlob(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n if (dontSendBlobs) {\n return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n }\n\n var length = new Uint8Array(1);\n length[0] = packets[packet.type];\n var blob = new Blob([length.buffer, packet.data]);\n\n return callback(blob);\n}\n\n/**\n * Encodes a packet with binary data in a base64 string\n *\n * @param {Object} packet, has `type` and `data`\n * @return {String} base64 encoded message\n */\n\nexports.encodeBase64Packet = function(packet, callback) {\n var message = 'b' + exports.packets[packet.type];\n if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n var fr = new FileReader();\n fr.onload = function() {\n var b64 = fr.result.split(',')[1];\n callback(message + b64);\n };\n return fr.readAsDataURL(packet.data);\n }\n\n var b64data;\n try {\n b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n } catch (e) {\n // iPhone Safari doesn't let you apply with typed arrays\n var typed = new Uint8Array(packet.data);\n var basic = new Array(typed.length);\n for (var i = 0; i < typed.length; i++) {\n basic[i] = typed[i];\n }\n b64data = String.fromCharCode.apply(null, basic);\n }\n message += btoa(b64data);\n return callback(message);\n};\n\n/**\n * Decodes a packet. Changes format to Blob if requested.\n *\n * @return {Object} with `type` and `data` (if any)\n * @api private\n */\n\nexports.decodePacket = function (data, binaryType, utf8decode) {\n if (data === undefined) {\n return err;\n }\n // String data\n if (typeof data === 'string') {\n if (data.charAt(0) === 'b') {\n return exports.decodeBase64Packet(data.substr(1), binaryType);\n }\n\n if (utf8decode) {\n data = tryDecode(data);\n if (data === false) {\n return err;\n }\n }\n var type = data.charAt(0);\n\n if (Number(type) != type || !packetslist[type]) {\n return err;\n }\n\n if (data.length > 1) {\n return { type: packetslist[type], data: data.substring(1) };\n } else {\n return { type: packetslist[type] };\n }\n }\n\n var asArray = new Uint8Array(data);\n var type = asArray[0];\n var rest = sliceBuffer(data, 1);\n if (Blob && binaryType === 'blob') {\n rest = new Blob([rest]);\n }\n return { type: packetslist[type], data: rest };\n};\n\nfunction tryDecode(data) {\n try {\n data = utf8.decode(data, { strict: false });\n } catch (e) {\n return false;\n }\n return data;\n}\n\n/**\n * Decodes a packet encoded in a base64 string\n *\n * @param {String} base64 encoded message\n * @return {Object} with `type` and `data` (if any)\n */\n\nexports.decodeBase64Packet = function(msg, binaryType) {\n var type = packetslist[msg.charAt(0)];\n if (!base64encoder) {\n return { type: type, data: { base64: true, data: msg.substr(1) } };\n }\n\n var data = base64encoder.decode(msg.substr(1));\n\n if (binaryType === 'blob' && Blob) {\n data = new Blob([data]);\n }\n\n return { type: type, data: data };\n};\n\n/**\n * Encodes multiple messages (payload).\n *\n * <length>:data\n *\n * Example:\n *\n * 11:hello world2:hi\n *\n * If any contents are binary, they will be encoded as base64 strings. Base64\n * encoded strings are marked with a b before the length specifier\n *\n * @param {Array} packets\n * @api private\n */\n\nexports.encodePayload = function (packets, supportsBinary, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = null;\n }\n\n var isBinary = hasBinary(packets);\n\n if (supportsBinary && isBinary) {\n if (Blob && !dontSendBlobs) {\n return exports.encodePayloadAsBlob(packets, callback);\n }\n\n return exports.encodePayloadAsArrayBuffer(packets, callback);\n }\n\n if (!packets.length) {\n return callback('0:');\n }\n\n function setLengthHeader(message) {\n return message.length + ':' + message;\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n doneCallback(null, setLengthHeader(message));\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(results.join(''));\n });\n};\n\n/**\n * Async array map using after\n */\n\nfunction map(ary, each, done) {\n var result = new Array(ary.length);\n var next = after(ary.length, done);\n\n var eachWithIndex = function(i, el, cb) {\n each(el, function(error, msg) {\n result[i] = msg;\n cb(error, result);\n });\n };\n\n for (var i = 0; i < ary.length; i++) {\n eachWithIndex(i, ary[i], next);\n }\n}\n\n/*\n * Decodes data when a payload is maybe expected. Possible binary contents are\n * decoded from their base64 representation\n *\n * @param {String} data, callback method\n * @api public\n */\n\nexports.decodePayload = function (data, binaryType, callback) {\n if (typeof data !== 'string') {\n return exports.decodePayloadAsBinary(data, binaryType, callback);\n }\n\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var packet;\n if (data === '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n var length = '', n, msg;\n\n for (var i = 0, l = data.length; i < l; i++) {\n var chr = data.charAt(i);\n\n if (chr !== ':') {\n length += chr;\n continue;\n }\n\n if (length === '' || (length != (n = Number(length)))) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n msg = data.substr(i + 1, n);\n\n if (length != msg.length) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n if (msg.length) {\n packet = exports.decodePacket(msg, binaryType, false);\n\n if (err.type === packet.type && err.data === packet.data) {\n // parser error in individual packet - ignoring payload\n return callback(err, 0, 1);\n }\n\n var ret = callback(packet, i + n, l);\n if (false === ret) return;\n }\n\n // advance cursor\n i += n;\n length = '';\n }\n\n if (length !== '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n};\n\n/**\n * Encodes multiple messages (payload) as binary.\n *\n * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n * 255><data>\n *\n * Example:\n * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n *\n * @param {Array} packets\n * @return {ArrayBuffer} encoded payload\n * @api private\n */\n\nexports.encodePayloadAsArrayBuffer = function(packets, callback) {\n if (!packets.length) {\n return callback(new ArrayBuffer(0));\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(data) {\n return doneCallback(null, data);\n });\n }\n\n map(packets, encodeOne, function(err, encodedPackets) {\n var totalLength = encodedPackets.reduce(function(acc, p) {\n var len;\n if (typeof p === 'string'){\n len = p.length;\n } else {\n len = p.byteLength;\n }\n return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n }, 0);\n\n var resultArray = new Uint8Array(totalLength);\n\n var bufferIndex = 0;\n encodedPackets.forEach(function(p) {\n var isString = typeof p === 'string';\n var ab = p;\n if (isString) {\n var view = new Uint8Array(p.length);\n for (var i = 0; i < p.length; i++) {\n view[i] = p.charCodeAt(i);\n }\n ab = view.buffer;\n }\n\n if (isString) { // not true binary\n resultArray[bufferIndex++] = 0;\n } else { // true binary\n resultArray[bufferIndex++] = 1;\n }\n\n var lenStr = ab.byteLength.toString();\n for (var i = 0; i < lenStr.length; i++) {\n resultArray[bufferIndex++] = parseInt(lenStr[i]);\n }\n resultArray[bufferIndex++] = 255;\n\n var view = new Uint8Array(ab);\n for (var i = 0; i < view.length; i++) {\n resultArray[bufferIndex++] = view[i];\n }\n });\n\n return callback(resultArray.buffer);\n });\n};\n\n/**\n * Encode as Blob\n */\n\nexports.encodePayloadAsBlob = function(packets, callback) {\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(encoded) {\n var binaryIdentifier = new Uint8Array(1);\n binaryIdentifier[0] = 1;\n if (typeof encoded === 'string') {\n var view = new Uint8Array(encoded.length);\n for (var i = 0; i < encoded.length; i++) {\n view[i] = encoded.charCodeAt(i);\n }\n encoded = view.buffer;\n binaryIdentifier[0] = 0;\n }\n\n var len = (encoded instanceof ArrayBuffer)\n ? encoded.byteLength\n : encoded.size;\n\n var lenStr = len.toString();\n var lengthAry = new Uint8Array(lenStr.length + 1);\n for (var i = 0; i < lenStr.length; i++) {\n lengthAry[i] = parseInt(lenStr[i]);\n }\n lengthAry[lenStr.length] = 255;\n\n if (Blob) {\n var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n doneCallback(null, blob);\n }\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(new Blob(results));\n });\n};\n\n/*\n * Decodes data when a payload is maybe expected. Strings are decoded by\n * interpreting each byte as a key code for entries marked to start with 0. See\n * description of encodePayloadAsBinary\n *\n * @param {ArrayBuffer} data, callback method\n * @api public\n */\n\nexports.decodePayloadAsBinary = function (data, binaryType, callback) {\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var bufferTail = data;\n var buffers = [];\n\n while (bufferTail.byteLength > 0) {\n var tailArray = new Uint8Array(bufferTail);\n var isString = tailArray[0] === 0;\n var msgLength = '';\n\n for (var i = 1; ; i++) {\n if (tailArray[i] === 255) break;\n\n // 310 = char length of Number.MAX_VALUE\n if (msgLength.length > 310) {\n return callback(err, 0, 1);\n }\n\n msgLength += tailArray[i];\n }\n\n bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n msgLength = parseInt(msgLength);\n\n var msg = sliceBuffer(bufferTail, 0, msgLength);\n if (isString) {\n try {\n msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n } catch (e) {\n // iPhone Safari doesn't let you apply to typed arrays\n var typed = new Uint8Array(msg);\n msg = '';\n for (var i = 0; i < typed.length; i++) {\n msg += String.fromCharCode(typed[i]);\n }\n }\n }\n\n buffers.push(msg);\n bufferTail = sliceBuffer(bufferTail, msgLength);\n }\n\n var total = buffers.length;\n buffers.forEach(function(buffer, i) {\n callback(exports.decodePacket(buffer, binaryType, true), i, total);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/browser.js\n// module id = 18\n// module chunks = 0","\n/**\n * Gets the keys for an object.\n *\n * @return {Array} keys\n * @api private\n */\n\nmodule.exports = Object.keys || function keys (obj){\n var arr = [];\n var has = Object.prototype.hasOwnProperty;\n\n for (var i in obj) {\n if (has.call(obj, i)) {\n arr.push(i);\n }\n }\n return arr;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/keys.js\n// module id = 19\n// module chunks = 0","/* global Blob File */\n\n/*\n * Module requirements.\n */\n\nvar isArray = require('isarray');\n\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' ||\n typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\nvar withNativeFile = typeof File === 'function' ||\n typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\n/**\n * Module exports.\n */\n\nmodule.exports = hasBinary;\n\n/**\n * Checks for binary data.\n *\n * Supports Buffer, ArrayBuffer, Blob and File.\n *\n * @param {Object} anything\n * @api public\n */\n\nfunction hasBinary (obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n if (isArray(obj)) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (hasBinary(obj[i])) {\n return true;\n }\n }\n return false;\n }\n\n if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n (withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)\n ) {\n return true;\n }\n\n // see: https://github.com/Automattic/has-binary/pull/4\n if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n return hasBinary(obj.toJSON(), true);\n }\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n return true;\n }\n }\n\n return false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-binary2/index.js\n// module id = 20\n// module chunks = 0","/**\n * An abstraction for slicing an arraybuffer even when\n * ArrayBuffer.prototype.slice is not supported\n *\n * @api public\n */\n\nmodule.exports = function(arraybuffer, start, end) {\n var bytes = arraybuffer.byteLength;\n start = start || 0;\n end = end || bytes;\n\n if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\n if (start < 0) { start += bytes; }\n if (end < 0) { end += bytes; }\n if (end > bytes) { end = bytes; }\n\n if (start >= bytes || start >= end || bytes === 0) {\n return new ArrayBuffer(0);\n }\n\n var abv = new Uint8Array(arraybuffer);\n var result = new Uint8Array(end - start);\n for (var i = start, ii = 0; i < end; i++, ii++) {\n result[ii] = abv[i];\n }\n return result.buffer;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/arraybuffer.slice/index.js\n// module id = 21\n// module chunks = 0","module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/after/index.js\n// module id = 22\n// module chunks = 0","/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\nvar stringFromCharCode = String.fromCharCode;\n\n// Taken from https://mths.be/punycode\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\tvar value;\n\tvar extra;\n\twhile (counter < length) {\n\t\tvalue = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// high surrogate, and there is a next character\n\t\t\textra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n// Taken from https://mths.be/punycode\nfunction ucs2encode(array) {\n\tvar length = array.length;\n\tvar index = -1;\n\tvar value;\n\tvar output = '';\n\twhile (++index < length) {\n\t\tvalue = array[index];\n\t\tif (value > 0xFFFF) {\n\t\t\tvalue -= 0x10000;\n\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t}\n\t\toutput += stringFromCharCode(value);\n\t}\n\treturn output;\n}\n\nfunction checkScalarValue(codePoint, strict) {\n\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\tif (strict) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n/*--------------------------------------------------------------------------*/\n\nfunction createByte(codePoint, shift) {\n\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n}\n\nfunction encodeCodePoint(codePoint, strict) {\n\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\treturn stringFromCharCode(codePoint);\n\t}\n\tvar symbol = '';\n\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t}\n\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\tcodePoint = 0xFFFD;\n\t\t}\n\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\tsymbol += createByte(codePoint, 12);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\treturn symbol;\n}\n\nfunction utf8encode(string, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tvar codePoints = ucs2decode(string);\n\tvar length = codePoints.length;\n\tvar index = -1;\n\tvar codePoint;\n\tvar byteString = '';\n\twhile (++index < length) {\n\t\tcodePoint = codePoints[index];\n\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t}\n\treturn byteString;\n}\n\n/*--------------------------------------------------------------------------*/\n\nfunction readContinuationByte() {\n\tif (byteIndex >= byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\tif ((continuationByte & 0xC0) == 0x80) {\n\t\treturn continuationByte & 0x3F;\n\t}\n\n\t// If we end up here, it’s not a continuation byte\n\tthrow Error('Invalid continuation byte');\n}\n\nfunction decodeSymbol(strict) {\n\tvar byte1;\n\tvar byte2;\n\tvar byte3;\n\tvar byte4;\n\tvar codePoint;\n\n\tif (byteIndex > byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tif (byteIndex == byteCount) {\n\t\treturn false;\n\t}\n\n\t// Read first byte\n\tbyte1 = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\t// 1-byte sequence (no continuation bytes)\n\tif ((byte1 & 0x80) == 0) {\n\t\treturn byte1;\n\t}\n\n\t// 2-byte sequence\n\tif ((byte1 & 0xE0) == 0xC0) {\n\t\tbyte2 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\tif (codePoint >= 0x80) {\n\t\t\treturn codePoint;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 3-byte sequence (may include unpaired surrogates)\n\tif ((byte1 & 0xF0) == 0xE0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\tif (codePoint >= 0x0800) {\n\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 4-byte sequence\n\tif ((byte1 & 0xF8) == 0xF0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tbyte4 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t(byte3 << 0x06) | byte4;\n\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\treturn codePoint;\n\t\t}\n\t}\n\n\tthrow Error('Invalid UTF-8 detected');\n}\n\nvar byteArray;\nvar byteCount;\nvar byteIndex;\nfunction utf8decode(byteString, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tbyteArray = ucs2decode(byteString);\n\tbyteCount = byteArray.length;\n\tbyteIndex = 0;\n\tvar codePoints = [];\n\tvar tmp;\n\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\tcodePoints.push(tmp);\n\t}\n\treturn ucs2encode(codePoints);\n}\n\nmodule.exports = {\n\tversion: '2.1.2',\n\tencode: utf8encode,\n\tdecode: utf8decode\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/utf8.js\n// module id = 23\n// module chunks = 0","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(){\n \"use strict\";\n\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n // Use a lookup table to find the index.\n var lookup = new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i+1)];\n encoded3 = lookup[base64.charCodeAt(i+2)];\n encoded4 = lookup[base64.charCodeAt(i+3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-arraybuffer/lib/base64-arraybuffer.js\n// module id = 24\n// module chunks = 0","/**\r\n * Create a blob builder even when vendor prefixes exist\r\n */\r\n\r\nvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n false;\r\n\r\n/**\r\n * Check if Blob constructor is supported\r\n */\r\n\r\nvar blobSupported = (function() {\r\n try {\r\n var a = new Blob(['hi']);\r\n return a.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if Blob constructor supports ArrayBufferViews\r\n * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n */\r\n\r\nvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n try {\r\n var b = new Blob([new Uint8Array([1,2])]);\r\n return b.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if BlobBuilder is supported\r\n */\r\n\r\nvar blobBuilderSupported = BlobBuilder\r\n && BlobBuilder.prototype.append\r\n && BlobBuilder.prototype.getBlob;\r\n\r\n/**\r\n * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n * Used by BlobBuilder constructor and old browsers that didn't\r\n * support it in the Blob constructor.\r\n */\r\n\r\nfunction mapArrayBufferViews(ary) {\r\n return ary.map(function(chunk) {\r\n if (chunk.buffer instanceof ArrayBuffer) {\r\n var buf = chunk.buffer;\r\n\r\n // if this is a subarray, make a copy so we only\r\n // include the subarray region from the underlying buffer\r\n if (chunk.byteLength !== buf.byteLength) {\r\n var copy = new Uint8Array(chunk.byteLength);\r\n copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n buf = copy.buffer;\r\n }\r\n\r\n return buf;\r\n }\r\n\r\n return chunk;\r\n });\r\n}\r\n\r\nfunction BlobBuilderConstructor(ary, options) {\r\n options = options || {};\r\n\r\n var bb = new BlobBuilder();\r\n mapArrayBufferViews(ary).forEach(function(part) {\r\n bb.append(part);\r\n });\r\n\r\n return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n};\r\n\r\nfunction BlobConstructor(ary, options) {\r\n return new Blob(mapArrayBufferViews(ary), options || {});\r\n};\r\n\r\nif (typeof Blob !== 'undefined') {\r\n BlobBuilderConstructor.prototype = Blob.prototype;\r\n BlobConstructor.prototype = Blob.prototype;\r\n}\r\n\r\nmodule.exports = (function() {\r\n if (blobSupported) {\r\n return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n } else if (blobBuilderSupported) {\r\n return BlobBuilderConstructor;\r\n } else {\r\n return undefined;\r\n }\r\n})();\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/blob/index.js\n// module id = 25\n// module chunks = 0","/**\r\n * Compiles a querystring\r\n * Returns string representation of the object\r\n *\r\n * @param {Object}\r\n * @api private\r\n */\r\n\r\nexports.encode = function (obj) {\r\n var str = '';\r\n\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n if (str.length) str += '&';\r\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\r\n }\r\n }\r\n\r\n return str;\r\n};\r\n\r\n/**\r\n * Parses a simple querystring into an object\r\n *\r\n * @param {String} qs\r\n * @api private\r\n */\r\n\r\nexports.decode = function(qs){\r\n var qry = {};\r\n var pairs = qs.split('&');\r\n for (var i = 0, l = pairs.length; i < l; i++) {\r\n var pair = pairs[i].split('=');\r\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\r\n }\r\n return qry;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseqs/index.js\n// module id = 26\n// module chunks = 0","\nmodule.exports = function(a, b){\n var fn = function(){};\n fn.prototype = b.prototype;\n a.prototype = new fn;\n a.prototype.constructor = a;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-inherit/index.js\n// module id = 27\n// module chunks = 0","'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/yeast/index.js\n// module id = 28\n// module chunks = 0","/**\n * Module requirements.\n */\n\nvar Polling = require('./polling');\nvar inherit = require('component-inherit');\n\n/**\n * Module exports.\n */\n\nmodule.exports = JSONPPolling;\n\n/**\n * Cached regular expressions.\n */\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n\n/**\n * Noop.\n */\n\nfunction empty () { }\n\n/**\n * Until https://github.com/tc39/proposal-global is shipped.\n */\nfunction glob () {\n return typeof self !== 'undefined' ? self\n : typeof window !== 'undefined' ? window\n : typeof global !== 'undefined' ? global : {};\n}\n\n/**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n\nfunction JSONPPolling (opts) {\n Polling.call(this, opts);\n\n this.query = this.query || {};\n\n // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n var global = glob();\n callbacks = global.___eio = (global.___eio || []);\n }\n\n // callback identifier\n this.index = callbacks.length;\n\n // add callback to jsonp global\n var self = this;\n callbacks.push(function (msg) {\n self.onData(msg);\n });\n\n // append to query string\n this.query.j = this.index;\n\n // prevent spurious errors from being emitted when the window is unloaded\n if (typeof addEventListener === 'function') {\n addEventListener('beforeunload', function () {\n if (self.script) self.script.onerror = empty;\n }, false);\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(JSONPPolling, Polling);\n\n/*\n * JSONP only supports binary as base64 encoded strings\n */\n\nJSONPPolling.prototype.supportsBinary = false;\n\n/**\n * Closes the socket.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doClose = function () {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n Polling.prototype.doClose.call(this);\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doPoll = function () {\n var self = this;\n var script = document.createElement('script');\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n script.onerror = function (e) {\n self.onError('jsonp poll error', e);\n };\n\n var insertAt = document.getElementsByTagName('script')[0];\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n this.script = script;\n\n var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function () {\n var iframe = document.createElement('iframe');\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n};\n\n/**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n\nJSONPPolling.prototype.doWrite = function (data, fn) {\n var self = this;\n\n if (!this.form) {\n var form = document.createElement('form');\n var area = document.createElement('textarea');\n var id = this.iframeId = 'eio_iframe_' + this.index;\n var iframe;\n\n form.className = 'socketio';\n form.style.position = 'absolute';\n form.style.top = '-1000px';\n form.style.left = '-1000px';\n form.target = id;\n form.method = 'POST';\n form.setAttribute('accept-charset', 'utf-8');\n area.name = 'd';\n form.appendChild(area);\n document.body.appendChild(form);\n\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete () {\n initIframe();\n fn();\n }\n\n function initIframe () {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError('jsonp polling iframe removal error', e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n iframe = document.createElement(html);\n } catch (e) {\n iframe = document.createElement('iframe');\n iframe.name = self.iframeId;\n iframe.src = 'javascript:0';\n }\n\n iframe.id = self.iframeId;\n\n self.form.appendChild(iframe);\n self.iframe = iframe;\n }\n\n initIframe();\n\n // escape \\n to prevent it from being converted into \\r\\n by some UAs\n // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n data = data.replace(rEscapedNewline, '\\\\\\n');\n this.area.value = data.replace(rNewline, '\\\\n');\n\n try {\n this.form.submit();\n } catch (e) {}\n\n if (this.iframe.attachEvent) {\n this.iframe.onreadystatechange = function () {\n if (self.iframe.readyState === 'complete') {\n complete();\n }\n };\n } else {\n this.iframe.onload = complete;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-jsonp.js\n// module id = 29\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parser = require('engine.io-parser');\nvar parseqs = require('parseqs');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:websocket');\n\nvar BrowserWebSocket, NodeWebSocket;\n\nif (typeof WebSocket !== 'undefined') {\n BrowserWebSocket = WebSocket;\n} else if (typeof self !== 'undefined') {\n BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n}\n\nif (typeof window === 'undefined') {\n try {\n NodeWebSocket = require('ws');\n } catch (e) { }\n}\n\n/**\n * Get either the `WebSocket` or `MozWebSocket` globals\n * in the browser or try to resolve WebSocket-compatible\n * interface exposed by `ws` for Node-like environment.\n */\n\nvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\n/**\n * Module exports.\n */\n\nmodule.exports = WS;\n\n/**\n * WebSocket transport constructor.\n *\n * @api {Object} connection options\n * @api public\n */\n\nfunction WS (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (forceBase64) {\n this.supportsBinary = false;\n }\n this.perMessageDeflate = opts.perMessageDeflate;\n this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n this.protocols = opts.protocols;\n if (!this.usingBrowserWebSocket) {\n WebSocketImpl = NodeWebSocket;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(WS, Transport);\n\n/**\n * Transport name.\n *\n * @api public\n */\n\nWS.prototype.name = 'websocket';\n\n/*\n * WebSockets support binary\n */\n\nWS.prototype.supportsBinary = true;\n\n/**\n * Opens socket.\n *\n * @api private\n */\n\nWS.prototype.doOpen = function () {\n if (!this.check()) {\n // let probe timeout\n return;\n }\n\n var uri = this.uri();\n var protocols = this.protocols;\n var opts = {\n agent: this.agent,\n perMessageDeflate: this.perMessageDeflate\n };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n if (this.extraHeaders) {\n opts.headers = this.extraHeaders;\n }\n if (this.localAddress) {\n opts.localAddress = this.localAddress;\n }\n\n try {\n this.ws =\n this.usingBrowserWebSocket && !this.isReactNative\n ? protocols\n ? new WebSocketImpl(uri, protocols)\n : new WebSocketImpl(uri)\n : new WebSocketImpl(uri, protocols, opts);\n } catch (err) {\n return this.emit('error', err);\n }\n\n if (this.ws.binaryType === undefined) {\n this.supportsBinary = false;\n }\n\n if (this.ws.supports && this.ws.supports.binary) {\n this.supportsBinary = true;\n this.ws.binaryType = 'nodebuffer';\n } else {\n this.ws.binaryType = 'arraybuffer';\n }\n\n this.addEventListeners();\n};\n\n/**\n * Adds event listeners to the socket\n *\n * @api private\n */\n\nWS.prototype.addEventListeners = function () {\n var self = this;\n\n this.ws.onopen = function () {\n self.onOpen();\n };\n this.ws.onclose = function () {\n self.onClose();\n };\n this.ws.onmessage = function (ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function (e) {\n self.onError('websocket error', e);\n };\n};\n\n/**\n * Writes data to socket.\n *\n * @param {Array} array of packets.\n * @api private\n */\n\nWS.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n\n // encodePacket efficient as it uses WS framing\n // no need for encodePayload\n var total = packets.length;\n for (var i = 0, l = total; i < l; i++) {\n (function (packet) {\n parser.encodePacket(packet, self.supportsBinary, function (data) {\n if (!self.usingBrowserWebSocket) {\n // always create a new object (GH-437)\n var opts = {};\n if (packet.options) {\n opts.compress = packet.options.compress;\n }\n\n if (self.perMessageDeflate) {\n var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n if (len < self.perMessageDeflate.threshold) {\n opts.compress = false;\n }\n }\n }\n\n // Sometimes the websocket has already been closed but the browser didn't\n // have a chance of informing us about it yet, in that case send will\n // throw an error\n try {\n if (self.usingBrowserWebSocket) {\n // TypeError is thrown when passing the second argument on Safari\n self.ws.send(data);\n } else {\n self.ws.send(data, opts);\n }\n } catch (e) {\n\n }\n\n --total || done();\n });\n })(packets[i]);\n }\n\n function done () {\n self.emit('flush');\n\n // fake drain\n // defer to next tick to allow Socket to clear writeBuffer\n setTimeout(function () {\n self.writable = true;\n self.emit('drain');\n }, 0);\n }\n};\n\n/**\n * Called upon close\n *\n * @api private\n */\n\nWS.prototype.onClose = function () {\n Transport.prototype.onClose.call(this);\n};\n\n/**\n * Closes socket.\n *\n * @api private\n */\n\nWS.prototype.doClose = function () {\n if (typeof this.ws !== 'undefined') {\n this.ws.close();\n }\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nWS.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'wss' : 'ws';\n var port = '';\n\n // avoid port if default for schema\n if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n ('ws' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // append timestamp to URI\n if (this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n/**\n * Feature detection for WebSocket.\n *\n * @return {Boolean} whether this transport is available.\n * @api public\n */\n\nWS.prototype.check = function () {\n return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/websocket.js\n// module id = 30\n// module chunks = 0","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// ws (ignored)\n// module id = 31\n// module chunks = 0","\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/indexof/index.js\n// module id = 32\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar parser = require('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar toArray = require('to-array');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:socket');\nvar parseqs = require('parseqs');\nvar hasBin = require('has-binary2');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = Socket;\n\n/**\n * Internal events (blacklisted).\n * These events can't be emitted by the user.\n *\n * @api private\n */\n\nvar events = {\n connect: 1,\n connect_error: 1,\n connect_timeout: 1,\n connecting: 1,\n disconnect: 1,\n error: 1,\n reconnect: 1,\n reconnect_attempt: 1,\n reconnect_failed: 1,\n reconnect_error: 1,\n reconnecting: 1,\n ping: 1,\n pong: 1\n};\n\n/**\n * Shortcut to `Emitter#emit`.\n */\n\nvar emit = Emitter.prototype.emit;\n\n/**\n * `Socket` constructor.\n *\n * @api public\n */\n\nfunction Socket (io, nsp, opts) {\n this.io = io;\n this.nsp = nsp;\n this.json = this; // compat\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.connected = false;\n this.disconnected = true;\n this.flags = {};\n if (opts && opts.query) {\n this.query = opts.query;\n }\n if (this.io.autoConnect) this.open();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Subscribe to open, close and packet events\n *\n * @api private\n */\n\nSocket.prototype.subEvents = function () {\n if (this.subs) return;\n\n var io = this.io;\n this.subs = [\n on(io, 'open', bind(this, 'onopen')),\n on(io, 'packet', bind(this, 'onpacket')),\n on(io, 'close', bind(this, 'onclose'))\n ];\n};\n\n/**\n * \"Opens\" the socket.\n *\n * @api public\n */\n\nSocket.prototype.open =\nSocket.prototype.connect = function () {\n if (this.connected) return this;\n\n this.subEvents();\n this.io.open(); // ensure open\n if ('open' === this.io.readyState) this.onopen();\n this.emit('connecting');\n return this;\n};\n\n/**\n * Sends a `message` event.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.send = function () {\n var args = toArray(arguments);\n args.unshift('message');\n this.emit.apply(this, args);\n return this;\n};\n\n/**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @param {String} event name\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.emit = function (ev) {\n if (events.hasOwnProperty(ev)) {\n emit.apply(this, arguments);\n return this;\n }\n\n var args = toArray(arguments);\n var packet = {\n type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n data: args\n };\n\n packet.options = {};\n packet.options.compress = !this.flags || false !== this.flags.compress;\n\n // event ack callback\n if ('function' === typeof args[args.length - 1]) {\n\n this.acks[this.ids] = args.pop();\n packet.id = this.ids++;\n }\n\n if (this.connected) {\n this.packet(packet);\n } else {\n this.sendBuffer.push(packet);\n }\n\n this.flags = {};\n\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.packet = function (packet) {\n packet.nsp = this.nsp;\n this.io.packet(packet);\n};\n\n/**\n * Called upon engine `open`.\n *\n * @api private\n */\n\nSocket.prototype.onopen = function () {\n\n\n // write connect packet if necessary\n if ('/' !== this.nsp) {\n if (this.query) {\n var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;\n\n this.packet({type: parser.CONNECT, query: query});\n } else {\n this.packet({type: parser.CONNECT});\n }\n }\n};\n\n/**\n * Called upon engine `close`.\n *\n * @param {String} reason\n * @api private\n */\n\nSocket.prototype.onclose = function (reason) {\n\n this.connected = false;\n this.disconnected = true;\n delete this.id;\n this.emit('disconnect', reason);\n};\n\n/**\n * Called with socket packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onpacket = function (packet) {\n var sameNamespace = packet.nsp === this.nsp;\n var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\n if (!sameNamespace && !rootNamespaceError) return;\n\n switch (packet.type) {\n case parser.CONNECT:\n this.onconnect();\n break;\n\n case parser.EVENT:\n this.onevent(packet);\n break;\n\n case parser.BINARY_EVENT:\n this.onevent(packet);\n break;\n\n case parser.ACK:\n this.onack(packet);\n break;\n\n case parser.BINARY_ACK:\n this.onack(packet);\n break;\n\n case parser.DISCONNECT:\n this.ondisconnect();\n break;\n\n case parser.ERROR:\n this.emit('error', packet.data);\n break;\n }\n};\n\n/**\n * Called upon a server event.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onevent = function (packet) {\n var args = packet.data || [];\n\n\n if (null != packet.id) {\n\n args.push(this.ack(packet.id));\n }\n\n if (this.connected) {\n emit.apply(this, args);\n } else {\n this.receiveBuffer.push(args);\n }\n};\n\n/**\n * Produces an ack callback to emit with an event.\n *\n * @api private\n */\n\nSocket.prototype.ack = function (id) {\n var self = this;\n var sent = false;\n return function () {\n // prevent double callbacks\n if (sent) return;\n sent = true;\n var args = toArray(arguments);\n\n\n self.packet({\n type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n id: id,\n data: args\n });\n };\n};\n\n/**\n * Called upon a server acknowlegement.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onack = function (packet) {\n var ack = this.acks[packet.id];\n if ('function' === typeof ack) {\n\n ack.apply(this, packet.data);\n delete this.acks[packet.id];\n } else {\n\n }\n};\n\n/**\n * Called upon server connect.\n *\n * @api private\n */\n\nSocket.prototype.onconnect = function () {\n this.connected = true;\n this.disconnected = false;\n this.emit('connect');\n this.emitBuffered();\n};\n\n/**\n * Emit buffered events (received and emitted).\n *\n * @api private\n */\n\nSocket.prototype.emitBuffered = function () {\n var i;\n for (i = 0; i < this.receiveBuffer.length; i++) {\n emit.apply(this, this.receiveBuffer[i]);\n }\n this.receiveBuffer = [];\n\n for (i = 0; i < this.sendBuffer.length; i++) {\n this.packet(this.sendBuffer[i]);\n }\n this.sendBuffer = [];\n};\n\n/**\n * Called upon server disconnect.\n *\n * @api private\n */\n\nSocket.prototype.ondisconnect = function () {\n\n this.destroy();\n this.onclose('io server disconnect');\n};\n\n/**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @api private.\n */\n\nSocket.prototype.destroy = function () {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n for (var i = 0; i < this.subs.length; i++) {\n this.subs[i].destroy();\n }\n this.subs = null;\n }\n\n this.io.destroy(this);\n};\n\n/**\n * Disconnects the socket manually.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.close =\nSocket.prototype.disconnect = function () {\n if (this.connected) {\n\n this.packet({ type: parser.DISCONNECT });\n }\n\n // remove socket from pool\n this.destroy();\n\n if (this.connected) {\n // fire events\n this.onclose('io client disconnect');\n }\n return this;\n};\n\n/**\n * Sets the compress flag.\n *\n * @param {Boolean} if `true`, compresses the sending data\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.compress = function (compress) {\n this.flags.compress = compress;\n return this;\n};\n\n/**\n * Sets the binary flag\n *\n * @param {Boolean} whether the emitted data contains binary\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.binary = function (binary) {\n this.flags.binary = binary;\n return this;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./lib/socket.js","module.exports = toArray\n\nfunction toArray(list, index) {\n var array = []\n\n index = index || 0\n\n for (var i = index || 0; i < list.length; i++) {\n array[i - index] = list[i]\n }\n\n return array\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/to-array/index.js\n// module id = 34\n// module chunks = 0","\n/**\n * Module exports.\n */\n\nmodule.exports = on;\n\n/**\n * Helper for subscriptions.\n *\n * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n * @param {String} event name\n * @param {Function} callback\n * @api public\n */\n\nfunction on (obj, ev, fn) {\n obj.on(ev, fn);\n return {\n destroy: function () {\n obj.removeListener(ev, fn);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/on.js","/**\n * Slice reference.\n */\n\nvar slice = [].slice;\n\n/**\n * Bind `obj` to `fn`.\n *\n * @param {Object} obj\n * @param {Function|String} fn or string\n * @return {Function}\n * @api public\n */\n\nmodule.exports = function(obj, fn){\n if ('string' == typeof fn) fn = obj[fn];\n if ('function' != typeof fn) throw new Error('bind() requires a function');\n var args = slice.call(arguments, 2);\n return function(){\n return fn.apply(obj, args.concat(slice.call(arguments)));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-bind/index.js\n// module id = 36\n// module chunks = 0","\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/backo2/index.js\n// module id = 37\n// module chunks = 0"],"sourceRoot":""}+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.slim.js b/node_modules/socket.io-client/dist/socket.io.slim.js @@ -0,0 +1,9 @@ +/*! + * Socket.IO v2.3.0 + * (c) 2014-2019 Guillermo Rauch + * Released under the MIT License. + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t,e){"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{};var r,n=i(t),s=n.source,p=n.id,h=n.path,u=c[p]&&h in c[p].nsps,f=e.forceNew||e["force new connection"]||!1===e.multiplex||u;return f?r=a(s,e):(c[p]||(c[p]=a(s,e)),r=c[p]),n.query&&!e.query&&(e.query=n.query),r.socket(n.path,e)}var o="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},i=r(1),s=r(4),a=r(9);r(3)("socket.io-client");t.exports=e=n;var c=e.managers={};e.protocol=s.protocol,e.connect=n,e.Manager=r(9),e.Socket=r(33)},function(t,e,r){"use strict";function n(t,e){var r=t;e=e||"undefined"!=typeof location&&location,null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(t="undefined"!=typeof e?e.protocol+"//"+t:"https://"+t),r=o(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 n=r.host.indexOf(":")!==-1,i=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port,r.href=r.protocol+"://"+i+(e&&e.port===r.port?"":":"+r.port),r}var o=r(2);r(3)("socket.io-client:url");t.exports=n},function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");o!=-1&&i!=-1&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=r.exec(t||""),a={},c=14;c--;)a[n[c]]=s[c]||"";return o!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e){"use strict";t.exports=function(){return function(){}}},function(t,e,r){function n(){}function o(t){var r=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(r+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(r+=t.nsp+","),null!=t.id&&(r+=t.id),null!=t.data){var n=i(t.data);if(n===!1)return m;r+=n}return r}function i(t){try{return JSON.stringify(t)}catch(t){return!1}}function s(t,e){function r(t){var r=l.deconstructPacket(t),n=o(r.packet),i=r.buffers;i.unshift(n),e(i)}l.removeBlobs(t,r)}function a(){this.reconstructor=null}function c(t){var r=0,n={type:Number(t.charAt(0))};if(null==e.types[n.type])return u("unknown packet type "+n.type);if(e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type){for(var o="";"-"!==t.charAt(++r)&&(o+=t.charAt(r),r!=t.length););if(o!=Number(o)||"-"!==t.charAt(r))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===t.charAt(r+1))for(n.nsp="";++r;){var i=t.charAt(r);if(","===i)break;if(n.nsp+=i,r===t.length)break}else n.nsp="/";var s=t.charAt(r+1);if(""!==s&&Number(s)==s){for(n.id="";++r;){var i=t.charAt(r);if(null==i||Number(i)!=i){--r;break}if(n.id+=t.charAt(r),r===t.length)break}n.id=Number(n.id)}if(t.charAt(++r)){var a=p(t.substr(r)),c=a!==!1&&(n.type===e.ERROR||d(a));if(!c)return u("invalid payload");n.data=a}return n}function p(t){try{return JSON.parse(t)}catch(t){return!1}}function h(t){this.reconPack=t,this.buffers=[]}function u(t){return{type:e.ERROR,data:"parser error: "+t}}var f=(r(3)("socket.io-parser"),r(5)),l=r(6),d=r(7),y=r(8);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=n,e.Decoder=a;var m=e.ERROR+'"encode error"';n.prototype.encode=function(t,r){if(e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)s(t,r);else{var n=o(t);r([n])}},f(a.prototype),a.prototype.add=function(t){var r;if("string"==typeof t)r=c(t),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new h(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!y(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,this.emit("decoded",r))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},h.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=l.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},h.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,r){function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){function n(t,e){if(!t)return t;if(s(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}if(i(t)){for(var o=new Array(t.length),a=0;a<t.length;a++)o[a]=n(t[a],e);return o}if("object"==typeof t&&!(t instanceof Date)){var o={};for(var c in t)o[c]=n(t[c],e);return o}return t}function o(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(i(t))for(var r=0;r<t.length;r++)t[r]=o(t[r],e);else if("object"==typeof t)for(var n in t)t[n]=o(t[n],e);return t}var i=r(7),s=r(8),a=Object.prototype.toString,c="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===a.call(Blob),p="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===a.call(File);e.deconstructPacket=function(t){var e=[],r=t.data,o=t;return o.data=n(r,e),o.attachments=e.length,{packet:o,buffers:e}},e.reconstructPacket=function(t,e){return t.data=o(t.data,e),t.attachments=void 0,t},e.removeBlobs=function(t,e){function r(t,a,h){if(!t)return t;if(c&&t instanceof Blob||p&&t instanceof File){n++;var u=new FileReader;u.onload=function(){h?h[a]=this.result:o=this.result,--n||e(o)},u.readAsArrayBuffer(t)}else if(i(t))for(var f=0;f<t.length;f++)r(t[f],f,t);else if("object"==typeof t&&!s(t))for(var l in t)r(t[l],l,t)}var n=0,o=t;r(o),n||e(o)}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){function r(t){return n&&Buffer.isBuffer(t)||o&&(t instanceof ArrayBuffer||i(t))}t.exports=r;var n="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,o="function"==typeof ArrayBuffer,i=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer}},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);t&&"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||c;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}var o="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},i=r(10),s=r(33),a=r(5),c=r(4),p=r(35),h=r(36),u=(r(3)("socket.io-client:manager"),r(32)),f=r(37),l=Object.prototype.hasOwnProperty;t.exports=n,n.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)l.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},n.prototype.updateSocketIds=function(){for(var t in this.nsps)l.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},n.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},a(n.prototype),n.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},n.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},n.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},n.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},n.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},n.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},n.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},n.prototype.open=n.prototype.connect=function(t,e){if(~this.readyState.indexOf("open"))return this;this.engine=i(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=p(r,"open",function(){n.onopen(),t&&t()}),s=p(r,"error",function(e){if(n.cleanup(),n.readyState="closed",n.emitAll("connect_error",e),t){var r=new Error("Connection error");r.data=e,t(r)}else n.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout,c=setTimeout(function(){o.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},n.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(p(t,"data",h(this,"ondata"))),this.subs.push(p(t,"ping",h(this,"onping"))),this.subs.push(p(t,"pong",h(this,"onpong"))),this.subs.push(p(t,"error",h(this,"onerror"))),this.subs.push(p(t,"close",h(this,"onclose"))),this.subs.push(p(this.decoder,"decoded",h(this,"ondecoded")))},n.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},n.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},n.prototype.ondata=function(t){this.decoder.add(t)},n.prototype.ondecoded=function(t){this.emit("packet",t)},n.prototype.onerror=function(t){this.emitAll("error",t)},n.prototype.socket=function(t,e){function r(){~u(o.connecting,n)||o.connecting.push(n)}var n=this.nsps[t];if(!n){n=new s(this,t,e),this.nsps[t]=n;var o=this;n.on("connecting",r),n.on("connect",function(){n.id=o.generateId(t)}),this.autoConnect&&r()}return n},n.prototype.destroy=function(t){var e=u(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},n.prototype.packet=function(t){var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))},n.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},n.prototype.cleanup=function(){for(var t=this.subs.length,e=0;e<t;e++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},n.prototype.close=n.prototype.disconnect=function(){this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},n.prototype.onclose=function(t){this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},n.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):t.onreconnect()}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},n.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,r){t.exports=r(11),t.exports.parser=r(18)},function(t,e,r){function n(t,e){return this instanceof n?(e=e||{},t&&"object"==typeof t&&(e=t,t=null),t?(t=p(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=p(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=!1!==e.withCredentials,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,void this.open()):new n(t,e)}function o(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var i=r(12),s=r(5),a=(r(3)("engine.io-client:socket"),r(32)),c=r(18),p=r(2),h=r(26);t.exports=n,n.priorWebsocketSuccess=!1,s(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=r(17),n.transports=r(12),n.parser=r(18),n.prototype.createTransport=function(t){var e=o(this.query);e.EIO=c.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new i[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return n},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("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)},n.prototype.setTransport=function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},n.prototype.probe=function(t){function e(){if(u.onlyBinaryUpgrades){var t=!this.supportsBinary&&u.transport.supportsBinary;h=h||t}h||(p.send([{type:"ping",data:"probe"}]),p.once("packet",function(t){if(!h)if("pong"===t.type&&"probe"===t.data){if(u.upgrading=!0,u.emit("upgrading",p),!p)return;n.priorWebsocketSuccess="websocket"===p.name,u.transport.pause(function(){h||"closed"!==u.readyState&&(c(),u.setTransport(p),p.send([{type:"upgrade"}]),u.emit("upgrade",p),p=null,u.upgrading=!1,u.flush())})}else{var e=new Error("probe error");e.transport=p.name,u.emit("upgradeError",e)}}))}function r(){h||(h=!0,c(),p.close(),p=null)}function o(t){var e=new Error("probe error: "+t);e.transport=p.name,r(),u.emit("upgradeError",e)}function i(){o("transport closed")}function s(){o("socket closed")}function a(t){p&&t.name!==p.name&&r()}function c(){p.removeListener("open",e),p.removeListener("error",o),p.removeListener("close",i),u.removeListener("close",s),u.removeListener("upgrading",a)}var p=this.createTransport(t,{probe:1}),h=!1,u=this;n.priorWebsocketSuccess=!1,p.once("open",e),p.once("error",o),p.once("close",i),this.once("close",s),this.once("upgrading",a),p.open()},n.prototype.onOpen=function(){if(this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])},n.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},n.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},n.prototype.sendPacket=function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){r=r||{},r.compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}},n.prototype.close=function(){function t(){n.onClose("forced close"),n.transport.close()}function e(){n.removeListener("upgrade",e),n.removeListener("upgradeError",e),t()}function r(){n.once("upgrade",e),n.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var n=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():t()}):this.upgrading?r():t()}return this},n.prototype.onError=function(t){n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}},n.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~a(this.transports,t[r])&&e.push(t[r]);return e}},function(t,e,r){function n(t){var e,r=!1,n=!1,a=!1!==t.jsonp;if("undefined"!=typeof location){var c="https:"===location.protocol,p=location.port;p||(p=c?443:80),r=t.hostname!==location.hostname||p!==t.port,n=t.secure!==c}if(t.xdomain=r,t.xscheme=n,e=new o(t),"open"in e&&!t.forceJSONP)return new i(t);if(!a)throw new Error("JSONP disabled");return new s(t)}var o=r(13),i=r(15),s=r(29),a=r(30);e.polling=n,e.websocket=a},function(t,e,r){var n=r(14);t.exports=function(t){var e=t.xdomain,r=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||n))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!r&&o)return new XDomainRequest}catch(t){}if(!e)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(t,e,r){function n(){}function o(t){if(c.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,"undefined"!=typeof location){var e="https:"===location.protocol,r=location.port;r||(r=e?443:80),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||r!==t.port,this.xs=t.secure!==e}}function i(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function s(){for(var t in i.requests)i.requests.hasOwnProperty(t)&&i.requests[t].abort()}var a=r(13),c=r(16),p=r(5),h=r(27);r(3)("engine.io-client:polling-xhr");if(t.exports=o,t.exports.Request=i,h(o,c),o.prototype.supportsBinary=!0,o.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new i(t)},o.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=n},o.prototype.doPoll=function(){var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},p(i.prototype),i.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new a(t),r=this;try{e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&e.setRequestHeader(n,this.extraHeaders[n])}}catch(t){}if("POST"===this.method)try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){if(2===e.readyState)try{var t=e.getResponseHeader("Content-Type");(r.supportsBinary&&"application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&(e.responseType="arraybuffer")}catch(t){}4===e.readyState&&(200===e.status||1223===e.status?r.onLoad():setTimeout(function(){r.onError("number"==typeof e.status?e.status:0)},0))},e.send(this.data)}catch(t){return void setTimeout(function(){r.onError(t)},0)}"undefined"!=typeof document&&(this.index=i.requestsCount++,i.requests[this.index]=this)},i.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},i.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},i.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},i.prototype.cleanup=function(t){if("undefined"!=typeof this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete i.requests[this.index],this.xhr=null}},i.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},i.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},i.prototype.abort=function(){this.cleanup()},i.requestsCount=0,i.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",s);else if("function"==typeof addEventListener){var u="onpagehide"in self?"pagehide":"unload";addEventListener(u,s,!1)}},function(t,e,r){function n(t){var e=t&&t.forceBase64;p&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=r(17),i=r(26),s=r(18),a=r(27),c=r(28);r(3)("engine.io-client:polling");t.exports=n;var p=function(){var t=r(13),e=new t({xdomain:!1});return null!=e.responseType}();a(n,o),n.prototype.name="polling",n.prototype.doOpen=function(){this.poll()},n.prototype.pause=function(t){function e(){r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||e()})),this.writable||(n++,this.once("drain",function(){--n||e()}))}else e()},n.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},n.prototype.onData=function(t){var e=this,r=function(t,r,n){return"opening"===e.readyState&&e.onOpen(),"close"===t.type?(e.onClose(),!1):void e.onPacket(t)};s.decodePayload(t,this.socket.binaryType,r),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())},n.prototype.doClose=function(){function t(){e.write([{type:"close"}])}var e=this;"open"===this.readyState?t():this.once("open",t)},n.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};s.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,r)})},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";!1!==this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(r=":"+this.port),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t}},function(t,e,r){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var o=r(18),i=r(5);t.exports=n,i(n.prototype),n.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},n.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open"); +this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,r){function n(t,r){var n="b"+e.packets[t.type]+t.data.data;return r(n)}function o(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=v[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return n(s.buffer)}function i(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=new FileReader;return o.onload=function(){e.encodePacket({type:t.type,data:o.result},r,!0,n)},o.readAsArrayBuffer(t.data)}function s(t,r,n){if(!r)return e.encodeBase64Packet(t,n);if(g)return i(t,r,n);var o=new Uint8Array(1);o[0]=v[t.type];var s=new w([o.buffer,t.data]);return n(s)}function a(t){try{t=d.decode(t,{strict:!1})}catch(t){return!1}return t}function c(t,e,r){for(var n=new Array(t.length),o=l(t.length,r),i=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},s=0;s<t.length;s++)i(s,t[s],o)}var p,h=r(19),u=r(20),f=r(21),l=r(22),d=r(23);"undefined"!=typeof ArrayBuffer&&(p=r(24));var y="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),m="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),g=y||m;e.protocol=3;var v=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},b=h(v),k={type:"error",data:"parser error"},w=r(25);e.encodePacket=function(t,e,r,i){"function"==typeof e&&(i=e,e=!1),"function"==typeof r&&(i=r,r=null);var a=void 0===t.data?void 0:t.data.buffer||t.data;if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer)return o(t,e,i);if("undefined"!=typeof w&&a instanceof w)return s(t,e,i);if(a&&a.base64)return n(t,i);var c=v[t.type];return void 0!==t.data&&(c+=r?d.encode(String(t.data),{strict:!1}):String(t.data)),i(""+c)},e.encodeBase64Packet=function(t,r){var n="b"+e.packets[t.type];if("undefined"!=typeof w&&t.data instanceof w){var o=new FileReader;return o.onload=function(){var t=o.result.split(",")[1];r(n+t)},o.readAsDataURL(t.data)}var i;try{i=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var s=new Uint8Array(t.data),a=new Array(s.length),c=0;c<s.length;c++)a[c]=s[c];i=String.fromCharCode.apply(null,a)}return n+=btoa(i),r(n)},e.decodePacket=function(t,r,n){if(void 0===t)return k;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(n&&(t=a(t),t===!1))return k;var o=t.charAt(0);return Number(o)==o&&b[o]?t.length>1?{type:b[o],data:t.substring(1)}:{type:b[o]}:k}var i=new Uint8Array(t),o=i[0],s=f(t,1);return w&&"blob"===r&&(s=new w([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var r=b[t.charAt(0)];if(!p)return{type:r,data:{base64:!0,data:t.substr(1)}};var n=p.decode(t.substr(1));return"blob"===e&&w&&(n=new w([n])),{type:r,data:n}},e.encodePayload=function(t,r,n){function o(t){return t.length+":"+t}function i(t,n){e.encodePacket(t,!!s&&r,!1,function(t){n(null,o(t))})}"function"==typeof r&&(n=r,r=null);var s=u(t);return r&&s?w&&!g?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n):t.length?void c(t,i,function(t,e){return n(e.join(""))}):n("0:")},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);"function"==typeof r&&(n=r,r=null);var o;if(""===t)return n(k,0,1);for(var i,s,a="",c=0,p=t.length;c<p;c++){var h=t.charAt(c);if(":"===h){if(""===a||a!=(i=Number(a)))return n(k,0,1);if(s=t.substr(c+1,i),a!=s.length)return n(k,0,1);if(s.length){if(o=e.decodePacket(s,r,!1),k.type===o.type&&k.data===o.data)return n(k,0,1);var u=n(o,c+i,p);if(!1===u)return}c+=i,a=""}else a+=h}return""!==a?n(k,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){return r(null,t)})}return t.length?void c(t,n,function(t,e){var n=e.reduce(function(t,e){var r;return r="string"==typeof e?e.length:e.byteLength,t+r.toString().length+r+2},0),o=new Uint8Array(n),i=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),s=0;s<t.length;s++)n[s]=t.charCodeAt(s);r=n.buffer}e?o[i++]=0:o[i++]=1;for(var a=r.byteLength.toString(),s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(var n=new Uint8Array(r),s=0;s<n.length;s++)o[i++]=n[s]}),r(o.buffer)}):r(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,e[0]=0}for(var i=t instanceof ArrayBuffer?t.byteLength:t.size,s=i.toString(),a=new Uint8Array(s.length+1),o=0;o<s.length;o++)a[o]=parseInt(s[o]);if(a[s.length]=255,w){var c=new w([e.buffer,a.buffer,t]);r(null,c)}})}c(t,n,function(t,e){return r(new w(e))})},e.decodePayloadAsBinary=function(t,r,n){"function"==typeof r&&(n=r,r=null);for(var o=t,i=[];o.byteLength>0;){for(var s=new Uint8Array(o),a=0===s[0],c="",p=1;255!==s[p];p++){if(c.length>310)return n(k,0,1);c+=s[p]}o=f(o,2+c.length),c=parseInt(c);var h=f(o,0,c);if(a)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(t){var u=new Uint8Array(h);h="";for(var p=0;p<u.length;p++)h+=String.fromCharCode(u[p])}i.push(h),o=f(o,c)}var l=i.length;i.forEach(function(t,o){n(e.decodePacket(t,r,!0),o,l)})}},function(t,e){t.exports=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}},function(t,e,r){function n(t){if(!t||"object"!=typeof t)return!1;if(o(t)){for(var e=0,r=t.length;e<r;e++)if(n(t[e]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||s&&t instanceof Blob||a&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return n(t.toJSON(),!0);for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&n(t[i]))return!0;return!1}var o=r(7),i=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);t.exports=n},function(t,e){t.exports=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),s=e,a=0;s<r;s++,a++)i[a]=o[s];return i.buffer}},function(t,e){function r(t,e,r){function o(t,n){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(i=!0,e(t),e=r):0!==o.count||i||e(null,n)}var i=!1;return r=r||n,o.count=t,0===t?e():o}function n(){}t.exports=r},function(t,e){function r(t){for(var e,r,n=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function n(t){for(var e,r=t.length,n=-1,o="";++n<r;)e=t[n],e>65535&&(e-=65536,o+=d(e>>>10&1023|55296),e=56320|1023&e),o+=d(e);return o}function o(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function i(t,e){return d(t>>e&63|128)}function s(t,e){if(0==(4294967168&t))return d(t);var r="";return 0==(4294965248&t)?r=d(t>>6&31|192):0==(4294901760&t)?(o(t,e)||(t=65533),r=d(t>>12&15|224),r+=i(t,6)):0==(4292870144&t)&&(r=d(t>>18&7|240),r+=i(t,12),r+=i(t,6)),r+=d(63&t|128)}function a(t,e){e=e||{};for(var n,o=!1!==e.strict,i=r(t),a=i.length,c=-1,p="";++c<a;)n=i[c],p+=s(n,o);return p}function c(){if(l>=f)throw Error("Invalid byte index");var t=255&u[l];if(l++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function p(t){var e,r,n,i,s;if(l>f)throw Error("Invalid byte index");if(l==f)return!1;if(e=255&u[l],l++,0==(128&e))return e;if(192==(224&e)){if(r=c(),s=(31&e)<<6|r,s>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&e)){if(r=c(),n=c(),s=(15&e)<<12|r<<6|n,s>=2048)return o(s,t)?s:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(r=c(),n=c(),i=c(),s=(7&e)<<18|r<<12|n<<6|i,s>=65536&&s<=1114111))return s;throw Error("Invalid UTF-8 detected")}function h(t,e){e=e||{};var o=!1!==e.strict;u=r(t),f=u.length,l=0;for(var i,s=[];(i=p(o))!==!1;)s.push(i);return n(s)}/*! https://mths.be/utf8js v2.1.2 by @mathias */ +var u,f,l,d=String.fromCharCode;t.exports={version:"2.1.2",encode:a,decode:h}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;e.encode=function(e){var r,n=new Uint8Array(e),o=n.length,i="";for(r=0;r<o;r+=3)i+=t[n[r]>>2],i+=t[(3&n[r])<<4|n[r+1]>>4],i+=t[(15&n[r+1])<<2|n[r+2]>>6],i+=t[63&n[r+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,n,o,i,s,a=.75*t.length,c=t.length,p=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var h=new ArrayBuffer(a),u=new Uint8Array(h);for(e=0;e<c;e+=4)n=r[t.charCodeAt(e)],o=r[t.charCodeAt(e+1)],i=r[t.charCodeAt(e+2)],s=r[t.charCodeAt(e+3)],u[p++]=n<<2|o>>4,u[p++]=(15&o)<<4|i>>2,u[p++]=(3&i)<<6|63&s;return h}}()},function(t,e){function r(t){return t.map(function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var r=new Uint8Array(t.byteLength);r.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=r.buffer}return e}return t})}function n(t,e){e=e||{};var n=new i;return r(t).forEach(function(t){n.append(t)}),e.type?n.getBlob(e.type):n.getBlob()}function o(t,e){return new Blob(r(t),e||{})}var i="undefined"!=typeof i?i:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,s=function(){try{var t=new Blob(["hi"]);return 2===t.size}catch(t){return!1}}(),a=s&&function(){try{var t=new Blob([new Uint8Array([1,2])]);return 2===t.size}catch(t){return!1}}(),c=i&&i.prototype.append&&i.prototype.getBlob;"undefined"!=typeof Blob&&(n.prototype=Blob.prototype,o.prototype=Blob.prototype),t.exports=function(){return s?a?Blob:o:c?n:void 0}()},function(t,e){e.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},e.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e){t.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){"use strict";function r(t){var e="";do e=s[t%a]+e,t=Math.floor(t/a);while(t>0);return e}function n(t){var e=0;for(h=0;h<t.length;h++)e=e*a+c[t.charAt(h)];return e}function o(){var t=r(+new Date);return t!==i?(p=0,i=t):t+"."+r(p++)}for(var i,s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},p=0,h=0;h<a;h++)c[s[h]]=h;o.encode=r,o.decode=n,t.exports=o},function(t,e,r){(function(e){function n(){}function o(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof e?e:{}}function i(t){if(s.call(this,t),this.query=this.query||{},!c){var e=o();c=e.___eio=e.___eio||[]}this.index=c.length;var r=this;c.push(function(t){r.onData(t)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){r.script&&(r.script.onerror=n)},!1)}var s=r(16),a=r(27);t.exports=i;var c,p=/\n/g,h=/\\n/g;a(i,s),i.prototype.supportsBinary=!1,i.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),s.prototype.doClose.call(this)},i.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e;var n="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},i.prototype.doWrite=function(t,e){function r(){n(),e()}function n(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(t)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=c,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),n(),t=t.replace(h,"\\\n"),this.area.value=t.replace(p,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&r()}:this.iframe.onload=r}}).call(e,function(){return this}())},function(t,e,r){function n(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=o&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(u=i),s.call(this,t)}var o,i,s=r(17),a=r(18),c=r(26),p=r(27),h=r(28);r(3)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?o=WebSocket:"undefined"!=typeof self&&(o=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{i=r(31)}catch(t){}var u=o||i;t.exports=n,p(n,s),n.prototype.name="websocket",n.prototype.supportsBinary=!0,n.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new u(t,e):new u(t):new u(t,e,r)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},n.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},n.prototype.write=function(t){function e(){r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0)}var r=this;this.writable=!1;for(var n=t.length,o=0,i=n;o<i;o++)!function(t){a.encodePacket(t,r.supportsBinary,function(o){if(!r.usingBrowserWebSocket){var i={};if(t.options&&(i.compress=t.options.compress),r.perMessageDeflate){var s="string"==typeof o?Buffer.byteLength(o):o.length;s<r.perMessageDeflate.threshold&&(i.compress=!1)}}try{r.usingBrowserWebSocket?r.ws.send(o):r.ws.send(o,i)}catch(t){}--n||e()})}(t[o])},n.prototype.onClose=function(){s.prototype.onClose.call(this)},n.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=h()),this.supportsBinary||(t.b64=1),t=c.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t},n.prototype.check=function(){return!(!u||"__initialize"in u&&this.name===n.prototype.name)}},function(t,e){},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e,r){"use strict";function n(t,e,r){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}var o="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},i=r(4),s=r(5),a=r(34),c=r(35),p=r(36),h=(r(3)("socket.io-client:socket"),r(26)),u=r(20);t.exports=e=n;var f={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},l=s.prototype.emit;s(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[c(t,"open",p(this,"onopen")),c(t,"packet",p(this,"onpacket")),c(t,"close",p(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},n.prototype.send=function(){var t=a(arguments);return t.unshift("message"),this.emit.apply(this,t),this},n.prototype.emit=function(t){if(f.hasOwnProperty(t))return l.apply(this,arguments),this;var e=a(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:u(e))?i.BINARY_EVENT:i.EVENT,data:e};return r.options={},r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(this.acks[this.ids]=e.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},n.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},n.prototype.onopen=function(){if("/"!==this.nsp)if(this.query){var t="object"===o(this.query)?h.encode(this.query):this.query;this.packet({type:i.CONNECT,query:t})}else this.packet({type:i.CONNECT})},n.prototype.onclose=function(t){this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},n.prototype.onpacket=function(t){var e=t.nsp===this.nsp,r=t.type===i.ERROR&&"/"===t.nsp;if(e||r)switch(t.type){case i.CONNECT:this.onconnect();break;case i.EVENT:this.onevent(t);break;case i.BINARY_EVENT:this.onevent(t);break;case i.ACK:this.onack(t);break;case i.BINARY_ACK:this.onack(t);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",t.data)}},n.prototype.onevent=function(t){var e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?l.apply(this,e):this.receiveBuffer.push(e)},n.prototype.ack=function(t){var e=this,r=!1;return function(){if(!r){r=!0;var n=a(arguments);e.packet({type:u(n)?i.BINARY_ACK:i.ACK,id:t,data:n})}}},n.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)l.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&this.packet({type:i.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},n.prototype.compress=function(t){return this.flags.compress=t,this},n.prototype.binary=function(t){return this.flags.binary=t,this}},function(t,e){function r(t,e){var r=[];e=e||0;for(var n=e||0;n<t.length;n++)r[n-e]=t[n];return r}t.exports=r},function(t,e){"use strict";function r(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}t.exports=r},function(t,e){var r=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}}},function(t,e){function r(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=r,r.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-r:t+r}return 0|Math.min(t,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(t){this.ms=t},r.prototype.setMax=function(t){this.max=t},r.prototype.setJitter=function(t){this.jitter=t}}])}); +//# sourceMappingURL=socket.io.slim.js.map+ \ No newline at end of file diff --git a/node_modules/socket.io-client/dist/socket.io.slim.js.map b/node_modules/socket.io-client/dist/socket.io.slim.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///socket.io.slim.js","webpack:///webpack/bootstrap 31c6c79423e11e145ab4","webpack:///./lib/index.js","webpack:///./lib/url.js","webpack:///./~/parseuri/index.js","webpack:///./support/noop.js","webpack:///./~/socket.io-parser/index.js","webpack:///./~/component-emitter/index.js","webpack:///./~/socket.io-parser/binary.js","webpack:///./~/isarray/index.js","webpack:///./~/socket.io-parser/is-buffer.js","webpack:///./lib/manager.js","webpack:///./~/engine.io-client/lib/index.js","webpack:///./~/engine.io-client/lib/socket.js","webpack:///./~/engine.io-client/lib/transports/index.js","webpack:///./~/engine.io-client/lib/xmlhttprequest.js","webpack:///./~/has-cors/index.js","webpack:///./~/engine.io-client/lib/transports/polling-xhr.js","webpack:///./~/engine.io-client/lib/transports/polling.js","webpack:///./~/engine.io-client/lib/transport.js","webpack:///./~/engine.io-parser/lib/browser.js","webpack:///./~/engine.io-parser/lib/keys.js","webpack:///./~/has-binary2/index.js","webpack:///./~/arraybuffer.slice/index.js","webpack:///./~/after/index.js","webpack:///./~/engine.io-parser/lib/utf8.js","webpack:///./~/base64-arraybuffer/lib/base64-arraybuffer.js","webpack:///./~/blob/index.js","webpack:///./~/parseqs/index.js","webpack:///./~/component-inherit/index.js","webpack:///./~/yeast/index.js","webpack:///./~/engine.io-client/lib/transports/polling-jsonp.js","webpack:///./~/engine.io-client/lib/transports/websocket.js","webpack:///./~/indexof/index.js","webpack:///./lib/socket.js","webpack:///./~/to-array/index.js","webpack:///./lib/on.js","webpack:///./~/component-bind/index.js","webpack:///./~/backo2/index.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","lookup","uri","opts","_typeof","undefined","io","parsed","url","source","path","sameNamespace","cache","nsps","newConnection","forceNew","multiplex","Manager","query","socket","Symbol","iterator","obj","constructor","prototype","parser","managers","protocol","connect","Socket","loc","location","host","charAt","test","parseuri","port","ipv6","indexOf","href","re","parts","str","src","b","e","substring","replace","length","exec","i","authority","ipv6uri","Encoder","encodeAsString","type","BINARY_EVENT","BINARY_ACK","attachments","nsp","data","payload","tryStringify","ERROR_PACKET","JSON","stringify","encodeAsBinary","callback","writeEncoding","bloblessData","deconstruction","binary","deconstructPacket","pack","packet","buffers","unshift","removeBlobs","Decoder","reconstructor","decodeString","Number","types","error","buf","Error","next","tryParse","substr","isPayloadValid","ERROR","isArray","parse","BinaryReconstructor","reconPack","msg","Emitter","isBuf","CONNECT","DISCONNECT","EVENT","ACK","encode","encoding","add","emit","base64","takeBinaryData","destroy","finishedReconstruction","binData","push","reconstructPacket","mixin","key","on","addEventListener","event","fn","_callbacks","once","off","apply","arguments","removeListener","removeAllListeners","removeEventListener","callbacks","cb","splice","args","slice","len","listeners","hasListeners","_deconstructPacket","placeholder","_placeholder","num","newData","Array","Date","_reconstructPacket","toString","Object","withNativeBlob","Blob","withNativeFile","File","packetData","_removeBlobs","curKey","containingObject","pendingBlobs","fileReader","FileReader","onload","result","readAsArrayBuffer","arr","withNativeBuffer","Buffer","isBuffer","withNativeArrayBuffer","ArrayBuffer","isView","buffer","subs","reconnection","reconnectionAttempts","Infinity","reconnectionDelay","reconnectionDelayMax","randomizationFactor","backoff","Backoff","min","max","jitter","timeout","readyState","connecting","lastPing","packetBuffer","_parser","encoder","decoder","autoConnect","open","eio","bind","has","hasOwnProperty","emitAll","updateSocketIds","generateId","engine","v","_reconnection","_reconnectionAttempts","_reconnectionDelay","setMin","_randomizationFactor","setJitter","_reconnectionDelayMax","setMax","_timeout","maybeReconnectOnOpen","reconnecting","attempts","reconnect","self","skipReconnect","openSub","onopen","errorSub","cleanup","err","timer","setTimeout","close","clearTimeout","onping","onpong","ondata","ondecoded","onerror","onConnecting","index","encodedPackets","write","options","processPacketQueue","shift","subsLength","sub","disconnect","reset","onclose","reason","delay","duration","onreconnect","attempt","hostname","secure","agent","parseqs","decode","upgrade","forceJSONP","jsonp","forceBase64","enablesXDR","withCredentials","timestampParam","timestampRequests","transports","transportOptions","writeBuffer","prevBufferLen","policyPort","rememberUpgrade","binaryType","onlyBinaryUpgrades","perMessageDeflate","threshold","pfx","passphrase","cert","ca","ciphers","rejectUnauthorized","forceNode","isReactNative","navigator","product","toLowerCase","extraHeaders","keys","localAddress","upgrades","pingInterval","pingTimeout","pingIntervalTimer","pingTimeoutTimer","clone","o","priorWebsocketSuccess","Transport","createTransport","name","EIO","transport","sid","requestTimeout","protocols","setTransport","onDrain","onPacket","onError","onClose","probe","onTransportOpen","upgradeLosesBinary","supportsBinary","failed","send","upgrading","pause","flush","freezeTransport","onTransportClose","onupgrade","to","onOpen","l","onHandshake","setPing","code","filterUpgrades","onHeartbeat","ping","sendPacket","writable","compress","cleanupAndClose","waitForUpgrade","desc","filteredUpgrades","j","polling","xhr","xd","xs","isSSL","xdomain","xscheme","XMLHttpRequest","XHR","JSONP","websocket","hasCORS","XDomainRequest","concat","join","empty","Polling","Request","method","async","isBinary","create","unloadHandler","requests","abort","inherit","request","doWrite","req","sendXhr","doPoll","onData","pollXhr","setDisableHeaderCheck","setRequestHeader","hasXDR","onLoad","responseText","onreadystatechange","contentType","getResponseHeader","responseType","status","document","requestsCount","onSuccess","fromError","response","attachEvent","terminationEvent","hasXHR2","yeast","doOpen","poll","onPause","total","decodePayload","doClose","packets","callbackfn","encodePayload","schema","b64","description","decodePacket","encodeBase64Object","message","encodeArrayBuffer","encodeBase64Packet","contentArray","Uint8Array","resultBuffer","byteLength","encodeBlobAsArrayBuffer","fr","encodePacket","encodeBlob","dontSendBlobs","blob","tryDecode","utf8","strict","map","ary","each","done","after","eachWithIndex","el","base64encoder","hasBinary","sliceBuffer","isAndroid","userAgent","isPhantomJS","pong","noop","packetslist","utf8encode","encoded","String","split","readAsDataURL","b64data","fromCharCode","typed","basic","btoa","utf8decode","decodeBase64Packet","asArray","rest","setLengthHeader","encodeOne","doneCallback","encodePayloadAsBlob","encodePayloadAsArrayBuffer","results","decodePayloadAsBinary","n","chr","ret","totalLength","reduce","acc","resultArray","bufferIndex","forEach","isString","ab","view","charCodeAt","lenStr","parseInt","binaryIdentifier","size","lengthAry","bufferTail","tailArray","msgLength","toJSON","arraybuffer","start","end","bytes","abv","ii","count","err_cb","proxy","bail","ucs2decode","string","value","extra","output","counter","ucs2encode","array","stringFromCharCode","checkScalarValue","codePoint","toUpperCase","createByte","encodeCodePoint","symbol","codePoints","byteString","readContinuationByte","byteIndex","byteCount","continuationByte","byteArray","decodeSymbol","byte1","byte2","byte3","byte4","tmp","version","chars","encoded1","encoded2","encoded3","encoded4","bufferLength","mapArrayBufferViews","chunk","copy","set","byteOffset","BlobBuilderConstructor","bb","BlobBuilder","part","append","getBlob","BlobConstructor","WebKitBlobBuilder","MSBlobBuilder","MozBlobBuilder","blobSupported","a","blobSupportsArrayBufferView","blobBuilderSupported","encodeURIComponent","qs","qry","pairs","pair","decodeURIComponent","alphabet","Math","floor","decoded","now","prev","seed","global","glob","window","JSONPPolling","___eio","script","rNewline","rEscapedNewline","parentNode","removeChild","form","iframe","createElement","insertAt","getElementsByTagName","insertBefore","head","body","appendChild","isUAgecko","complete","initIframe","html","iframeId","area","className","style","position","top","left","target","setAttribute","action","submit","WS","usingBrowserWebSocket","BrowserWebSocket","WebSocketImpl","NodeWebSocket","WebSocket","MozWebSocket","check","headers","ws","supports","addEventListeners","onmessage","ev","json","ids","acks","receiveBuffer","sendBuffer","connected","disconnected","flags","toArray","hasBin","events","connect_error","connect_timeout","reconnect_attempt","reconnect_failed","reconnect_error","subEvents","pop","onpacket","rootNamespaceError","onconnect","onevent","onack","ondisconnect","ack","s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,SAAA,EApBA9N,EAAAD,QAAA6L,EA8BAA,EAAAvJ,UAAAyN,SAAA,WACA,GAAAgY,GAAA3nB,KAAA2nB,GAAAlF,KAAAoF,IAAA7nB,KAAA4nB,OAAA5nB,KAAA2N,WACA,IAAA3N,KAAA4L,OAAA,CACA,GAAAkc,GAAArF,KAAAsF,SACAC,EAAAvF,KAAAC,MAAAoF,EAAA9nB,KAAA4L,OAAA+b,EACAA,GAAA,MAAAlF,KAAAC,MAAA,GAAAoF,IAAAH,EAAAK,EAAAL,EAAAK,EAEA,SAAAvF,KAAA/W,IAAAic,EAAA3nB,KAAA2L,MASAF,EAAAvJ,UAAAqN,MAAA,WACAvP,KAAA2N,SAAA,GASAlC,EAAAvJ,UAAAiL,OAAA,SAAAzB,GACA1L,KAAA2nB,GAAAjc,GASAD,EAAAvJ,UAAAqL,OAAA,SAAA5B,GACA3L,KAAA2L,OASAF,EAAAvJ,UAAAmL,UAAA,SAAAzB,GACA5L,KAAA4L","file":"socket.io.slim.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar url = __webpack_require__(1);\n\tvar parser = __webpack_require__(4);\n\tvar Manager = __webpack_require__(9);\n\tvar debug = __webpack_require__(3)('socket.io-client');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = exports = lookup;\n\t\n\t/**\n\t * Managers cache.\n\t */\n\t\n\tvar cache = exports.managers = {};\n\t\n\t/**\n\t * Looks up an existing `Manager` for multiplexing.\n\t * If the user summons:\n\t *\n\t * `io('http://localhost/a');`\n\t * `io('http://localhost/b');`\n\t *\n\t * We reuse the existing instance based on same scheme/port/host,\n\t * and we initialize sockets for each namespace.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction lookup(uri, opts) {\n\t if ((typeof uri === 'undefined' ? 'undefined' : _typeof(uri)) === 'object') {\n\t opts = uri;\n\t uri = undefined;\n\t }\n\t\n\t opts = opts || {};\n\t\n\t var parsed = url(uri);\n\t var source = parsed.source;\n\t var id = parsed.id;\n\t var path = parsed.path;\n\t var sameNamespace = cache[id] && path in cache[id].nsps;\n\t var newConnection = opts.forceNew || opts['force new connection'] || false === opts.multiplex || sameNamespace;\n\t\n\t var io;\n\t\n\t if (newConnection) {\n\t\n\t io = Manager(source, opts);\n\t } else {\n\t if (!cache[id]) {\n\t\n\t cache[id] = Manager(source, opts);\n\t }\n\t io = cache[id];\n\t }\n\t if (parsed.query && !opts.query) {\n\t opts.query = parsed.query;\n\t }\n\t return io.socket(parsed.path, opts);\n\t}\n\t\n\t/**\n\t * Protocol version.\n\t *\n\t * @api public\n\t */\n\t\n\texports.protocol = parser.protocol;\n\t\n\t/**\n\t * `connect`.\n\t *\n\t * @param {String} uri\n\t * @api public\n\t */\n\t\n\texports.connect = lookup;\n\t\n\t/**\n\t * Expose constructors for standalone build.\n\t *\n\t * @api public\n\t */\n\t\n\texports.Manager = __webpack_require__(9);\n\texports.Socket = __webpack_require__(33);\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar parseuri = __webpack_require__(2);\n\tvar debug = __webpack_require__(3)('socket.io-client:url');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = url;\n\t\n\t/**\n\t * URL parser.\n\t *\n\t * @param {String} url\n\t * @param {Object} An object meant to mimic window.location.\n\t * Defaults to window.location.\n\t * @api public\n\t */\n\t\n\tfunction url(uri, loc) {\n\t var obj = uri;\n\t\n\t // default to window.location\n\t loc = loc || typeof location !== 'undefined' && location;\n\t if (null == uri) uri = loc.protocol + '//' + loc.host;\n\t\n\t // relative path support\n\t if ('string' === typeof uri) {\n\t if ('/' === uri.charAt(0)) {\n\t if ('/' === uri.charAt(1)) {\n\t uri = loc.protocol + uri;\n\t } else {\n\t uri = loc.host + uri;\n\t }\n\t }\n\t\n\t if (!/^(https?|wss?):\\/\\//.test(uri)) {\n\t\n\t if ('undefined' !== typeof loc) {\n\t uri = loc.protocol + '//' + uri;\n\t } else {\n\t uri = 'https://' + uri;\n\t }\n\t }\n\t\n\t // parse\n\t\n\t obj = parseuri(uri);\n\t }\n\t\n\t // make sure we treat `localhost:80` and `localhost` equally\n\t if (!obj.port) {\n\t if (/^(http|ws)$/.test(obj.protocol)) {\n\t obj.port = '80';\n\t } else if (/^(http|ws)s$/.test(obj.protocol)) {\n\t obj.port = '443';\n\t }\n\t }\n\t\n\t obj.path = obj.path || '/';\n\t\n\t var ipv6 = obj.host.indexOf(':') !== -1;\n\t var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\t\n\t // define unique id\n\t obj.id = obj.protocol + '://' + host + ':' + obj.port;\n\t // define href\n\t obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : ':' + obj.port);\n\t\n\t return obj;\n\t}\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n\t/**\r\n\t * Parses an URI\r\n\t *\r\n\t * @author Steven Levithan <stevenlevithan.com> (MIT license)\r\n\t * @api private\r\n\t */\r\n\t\r\n\tvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\r\n\t\r\n\tvar parts = [\r\n\t 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\r\n\t];\r\n\t\r\n\tmodule.exports = function parseuri(str) {\r\n\t var src = str,\r\n\t b = str.indexOf('['),\r\n\t e = str.indexOf(']');\r\n\t\r\n\t if (b != -1 && e != -1) {\r\n\t str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\r\n\t }\r\n\t\r\n\t var m = re.exec(str || ''),\r\n\t uri = {},\r\n\t i = 14;\r\n\t\r\n\t while (i--) {\r\n\t uri[parts[i]] = m[i] || '';\r\n\t }\r\n\t\r\n\t if (b != -1 && e != -1) {\r\n\t uri.source = src;\r\n\t uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\r\n\t uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\r\n\t uri.ipv6uri = true;\r\n\t }\r\n\t\r\n\t return uri;\r\n\t};\r\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t\"use strict\";\n\t\n\tmodule.exports = function () {\n\t return function () {};\n\t};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(3)('socket.io-parser');\n\tvar Emitter = __webpack_require__(5);\n\tvar binary = __webpack_require__(6);\n\tvar isArray = __webpack_require__(7);\n\tvar isBuf = __webpack_require__(8);\n\t\n\t/**\n\t * Protocol version.\n\t *\n\t * @api public\n\t */\n\t\n\texports.protocol = 4;\n\t\n\t/**\n\t * Packet types.\n\t *\n\t * @api public\n\t */\n\t\n\texports.types = [\n\t 'CONNECT',\n\t 'DISCONNECT',\n\t 'EVENT',\n\t 'ACK',\n\t 'ERROR',\n\t 'BINARY_EVENT',\n\t 'BINARY_ACK'\n\t];\n\t\n\t/**\n\t * Packet type `connect`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.CONNECT = 0;\n\t\n\t/**\n\t * Packet type `disconnect`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.DISCONNECT = 1;\n\t\n\t/**\n\t * Packet type `event`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.EVENT = 2;\n\t\n\t/**\n\t * Packet type `ack`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.ACK = 3;\n\t\n\t/**\n\t * Packet type `error`.\n\t *\n\t * @api public\n\t */\n\t\n\texports.ERROR = 4;\n\t\n\t/**\n\t * Packet type 'binary event'\n\t *\n\t * @api public\n\t */\n\t\n\texports.BINARY_EVENT = 5;\n\t\n\t/**\n\t * Packet type `binary ack`. For acks with binary arguments.\n\t *\n\t * @api public\n\t */\n\t\n\texports.BINARY_ACK = 6;\n\t\n\t/**\n\t * Encoder constructor.\n\t *\n\t * @api public\n\t */\n\t\n\texports.Encoder = Encoder;\n\t\n\t/**\n\t * Decoder constructor.\n\t *\n\t * @api public\n\t */\n\t\n\texports.Decoder = Decoder;\n\t\n\t/**\n\t * A socket.io Encoder instance\n\t *\n\t * @api public\n\t */\n\t\n\tfunction Encoder() {}\n\t\n\tvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\t\n\t/**\n\t * Encode a packet as a single string if non-binary, or as a\n\t * buffer sequence, depending on packet type.\n\t *\n\t * @param {Object} obj - packet object\n\t * @param {Function} callback - function to handle encodings (likely engine.write)\n\t * @return Calls callback with Array of encodings\n\t * @api public\n\t */\n\t\n\tEncoder.prototype.encode = function(obj, callback){\n\t\n\t\n\t if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n\t encodeAsBinary(obj, callback);\n\t } else {\n\t var encoding = encodeAsString(obj);\n\t callback([encoding]);\n\t }\n\t};\n\t\n\t/**\n\t * Encode packet as string.\n\t *\n\t * @param {Object} packet\n\t * @return {String} encoded\n\t * @api private\n\t */\n\t\n\tfunction encodeAsString(obj) {\n\t\n\t // first is type\n\t var str = '' + obj.type;\n\t\n\t // attachments if we have them\n\t if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n\t str += obj.attachments + '-';\n\t }\n\t\n\t // if we have a namespace other than `/`\n\t // we append it followed by a comma `,`\n\t if (obj.nsp && '/' !== obj.nsp) {\n\t str += obj.nsp + ',';\n\t }\n\t\n\t // immediately followed by the id\n\t if (null != obj.id) {\n\t str += obj.id;\n\t }\n\t\n\t // json data\n\t if (null != obj.data) {\n\t var payload = tryStringify(obj.data);\n\t if (payload !== false) {\n\t str += payload;\n\t } else {\n\t return ERROR_PACKET;\n\t }\n\t }\n\t\n\t\n\t return str;\n\t}\n\t\n\tfunction tryStringify(str) {\n\t try {\n\t return JSON.stringify(str);\n\t } catch(e){\n\t return false;\n\t }\n\t}\n\t\n\t/**\n\t * Encode packet as 'buffer sequence' by removing blobs, and\n\t * deconstructing packet into object with placeholders and\n\t * a list of buffers.\n\t *\n\t * @param {Object} packet\n\t * @return {Buffer} encoded\n\t * @api private\n\t */\n\t\n\tfunction encodeAsBinary(obj, callback) {\n\t\n\t function writeEncoding(bloblessData) {\n\t var deconstruction = binary.deconstructPacket(bloblessData);\n\t var pack = encodeAsString(deconstruction.packet);\n\t var buffers = deconstruction.buffers;\n\t\n\t buffers.unshift(pack); // add packet info to beginning of data list\n\t callback(buffers); // write all the buffers\n\t }\n\t\n\t binary.removeBlobs(obj, writeEncoding);\n\t}\n\t\n\t/**\n\t * A socket.io Decoder instance\n\t *\n\t * @return {Object} decoder\n\t * @api public\n\t */\n\t\n\tfunction Decoder() {\n\t this.reconstructor = null;\n\t}\n\t\n\t/**\n\t * Mix in `Emitter` with Decoder.\n\t */\n\t\n\tEmitter(Decoder.prototype);\n\t\n\t/**\n\t * Decodes an encoded packet string into packet JSON.\n\t *\n\t * @param {String} obj - encoded packet\n\t * @return {Object} packet\n\t * @api public\n\t */\n\t\n\tDecoder.prototype.add = function(obj) {\n\t var packet;\n\t if (typeof obj === 'string') {\n\t packet = decodeString(obj);\n\t if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n\t this.reconstructor = new BinaryReconstructor(packet);\n\t\n\t // no attachments, labeled binary but no binary data to follow\n\t if (this.reconstructor.reconPack.attachments === 0) {\n\t this.emit('decoded', packet);\n\t }\n\t } else { // non-binary full packet\n\t this.emit('decoded', packet);\n\t }\n\t } else if (isBuf(obj) || obj.base64) { // raw binary data\n\t if (!this.reconstructor) {\n\t throw new Error('got binary data when not reconstructing a packet');\n\t } else {\n\t packet = this.reconstructor.takeBinaryData(obj);\n\t if (packet) { // received final buffer\n\t this.reconstructor = null;\n\t this.emit('decoded', packet);\n\t }\n\t }\n\t } else {\n\t throw new Error('Unknown type: ' + obj);\n\t }\n\t};\n\t\n\t/**\n\t * Decode a packet String (JSON data)\n\t *\n\t * @param {String} str\n\t * @return {Object} packet\n\t * @api private\n\t */\n\t\n\tfunction decodeString(str) {\n\t var i = 0;\n\t // look up type\n\t var p = {\n\t type: Number(str.charAt(0))\n\t };\n\t\n\t if (null == exports.types[p.type]) {\n\t return error('unknown packet type ' + p.type);\n\t }\n\t\n\t // look up attachments if type binary\n\t if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n\t var buf = '';\n\t while (str.charAt(++i) !== '-') {\n\t buf += str.charAt(i);\n\t if (i == str.length) break;\n\t }\n\t if (buf != Number(buf) || str.charAt(i) !== '-') {\n\t throw new Error('Illegal attachments');\n\t }\n\t p.attachments = Number(buf);\n\t }\n\t\n\t // look up namespace (if any)\n\t if ('/' === str.charAt(i + 1)) {\n\t p.nsp = '';\n\t while (++i) {\n\t var c = str.charAt(i);\n\t if (',' === c) break;\n\t p.nsp += c;\n\t if (i === str.length) break;\n\t }\n\t } else {\n\t p.nsp = '/';\n\t }\n\t\n\t // look up id\n\t var next = str.charAt(i + 1);\n\t if ('' !== next && Number(next) == next) {\n\t p.id = '';\n\t while (++i) {\n\t var c = str.charAt(i);\n\t if (null == c || Number(c) != c) {\n\t --i;\n\t break;\n\t }\n\t p.id += str.charAt(i);\n\t if (i === str.length) break;\n\t }\n\t p.id = Number(p.id);\n\t }\n\t\n\t // look up json data\n\t if (str.charAt(++i)) {\n\t var payload = tryParse(str.substr(i));\n\t var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n\t if (isPayloadValid) {\n\t p.data = payload;\n\t } else {\n\t return error('invalid payload');\n\t }\n\t }\n\t\n\t\n\t return p;\n\t}\n\t\n\tfunction tryParse(str) {\n\t try {\n\t return JSON.parse(str);\n\t } catch(e){\n\t return false;\n\t }\n\t}\n\t\n\t/**\n\t * Deallocates a parser's resources\n\t *\n\t * @api public\n\t */\n\t\n\tDecoder.prototype.destroy = function() {\n\t if (this.reconstructor) {\n\t this.reconstructor.finishedReconstruction();\n\t }\n\t};\n\t\n\t/**\n\t * A manager of a binary event's 'buffer sequence'. Should\n\t * be constructed whenever a packet of type BINARY_EVENT is\n\t * decoded.\n\t *\n\t * @param {Object} packet\n\t * @return {BinaryReconstructor} initialized reconstructor\n\t * @api private\n\t */\n\t\n\tfunction BinaryReconstructor(packet) {\n\t this.reconPack = packet;\n\t this.buffers = [];\n\t}\n\t\n\t/**\n\t * Method to be called when binary data received from connection\n\t * after a BINARY_EVENT packet.\n\t *\n\t * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n\t * @return {null | Object} returns null if more binary data is expected or\n\t * a reconstructed packet object if all buffers have been received.\n\t * @api private\n\t */\n\t\n\tBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n\t this.buffers.push(binData);\n\t if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n\t var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n\t this.finishedReconstruction();\n\t return packet;\n\t }\n\t return null;\n\t};\n\t\n\t/**\n\t * Cleans up binary packet reconstruction variables.\n\t *\n\t * @api private\n\t */\n\t\n\tBinaryReconstructor.prototype.finishedReconstruction = function() {\n\t this.reconPack = null;\n\t this.buffers = [];\n\t};\n\t\n\tfunction error(msg) {\n\t return {\n\t type: exports.ERROR,\n\t data: 'parser error: ' + msg\n\t };\n\t}\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\r\n\t/**\r\n\t * Expose `Emitter`.\r\n\t */\r\n\t\r\n\tif (true) {\r\n\t module.exports = Emitter;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Initialize a new `Emitter`.\r\n\t *\r\n\t * @api public\r\n\t */\r\n\t\r\n\tfunction Emitter(obj) {\r\n\t if (obj) return mixin(obj);\r\n\t};\r\n\t\r\n\t/**\r\n\t * Mixin the emitter properties.\r\n\t *\r\n\t * @param {Object} obj\r\n\t * @return {Object}\r\n\t * @api private\r\n\t */\r\n\t\r\n\tfunction mixin(obj) {\r\n\t for (var key in Emitter.prototype) {\r\n\t obj[key] = Emitter.prototype[key];\r\n\t }\r\n\t return obj;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Listen on the given `event` with `fn`.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.on =\r\n\tEmitter.prototype.addEventListener = function(event, fn){\r\n\t this._callbacks = this._callbacks || {};\r\n\t (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n\t .push(fn);\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Adds an `event` listener that will be invoked a single\r\n\t * time then automatically removed.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.once = function(event, fn){\r\n\t function on() {\r\n\t this.off(event, on);\r\n\t fn.apply(this, arguments);\r\n\t }\r\n\t\r\n\t on.fn = fn;\r\n\t this.on(event, on);\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Remove the given callback for `event` or all\r\n\t * registered callbacks.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Function} fn\r\n\t * @return {Emitter}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.off =\r\n\tEmitter.prototype.removeListener =\r\n\tEmitter.prototype.removeAllListeners =\r\n\tEmitter.prototype.removeEventListener = function(event, fn){\r\n\t this._callbacks = this._callbacks || {};\r\n\t\r\n\t // all\r\n\t if (0 == arguments.length) {\r\n\t this._callbacks = {};\r\n\t return this;\r\n\t }\r\n\t\r\n\t // specific event\r\n\t var callbacks = this._callbacks['$' + event];\r\n\t if (!callbacks) return this;\r\n\t\r\n\t // remove all handlers\r\n\t if (1 == arguments.length) {\r\n\t delete this._callbacks['$' + event];\r\n\t return this;\r\n\t }\r\n\t\r\n\t // remove specific handler\r\n\t var cb;\r\n\t for (var i = 0; i < callbacks.length; i++) {\r\n\t cb = callbacks[i];\r\n\t if (cb === fn || cb.fn === fn) {\r\n\t callbacks.splice(i, 1);\r\n\t break;\r\n\t }\r\n\t }\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Emit `event` with the given args.\r\n\t *\r\n\t * @param {String} event\r\n\t * @param {Mixed} ...\r\n\t * @return {Emitter}\r\n\t */\r\n\t\r\n\tEmitter.prototype.emit = function(event){\r\n\t this._callbacks = this._callbacks || {};\r\n\t var args = [].slice.call(arguments, 1)\r\n\t , callbacks = this._callbacks['$' + event];\r\n\t\r\n\t if (callbacks) {\r\n\t callbacks = callbacks.slice(0);\r\n\t for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n\t callbacks[i].apply(this, args);\r\n\t }\r\n\t }\r\n\t\r\n\t return this;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Return array of callbacks for `event`.\r\n\t *\r\n\t * @param {String} event\r\n\t * @return {Array}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.listeners = function(event){\r\n\t this._callbacks = this._callbacks || {};\r\n\t return this._callbacks['$' + event] || [];\r\n\t};\r\n\t\r\n\t/**\r\n\t * Check if this emitter has `event` handlers.\r\n\t *\r\n\t * @param {String} event\r\n\t * @return {Boolean}\r\n\t * @api public\r\n\t */\r\n\t\r\n\tEmitter.prototype.hasListeners = function(event){\r\n\t return !! this.listeners(event).length;\r\n\t};\r\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/*global Blob,File*/\n\t\n\t/**\n\t * Module requirements\n\t */\n\t\n\tvar isArray = __webpack_require__(7);\n\tvar isBuf = __webpack_require__(8);\n\tvar toString = Object.prototype.toString;\n\tvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\n\tvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\t\n\t/**\n\t * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n\t * Anything with blobs or files should be fed through removeBlobs before coming\n\t * here.\n\t *\n\t * @param {Object} packet - socket.io event packet\n\t * @return {Object} with deconstructed packet and list of buffers\n\t * @api public\n\t */\n\t\n\texports.deconstructPacket = function(packet) {\n\t var buffers = [];\n\t var packetData = packet.data;\n\t var pack = packet;\n\t pack.data = _deconstructPacket(packetData, buffers);\n\t pack.attachments = buffers.length; // number of binary 'attachments'\n\t return {packet: pack, buffers: buffers};\n\t};\n\t\n\tfunction _deconstructPacket(data, buffers) {\n\t if (!data) return data;\n\t\n\t if (isBuf(data)) {\n\t var placeholder = { _placeholder: true, num: buffers.length };\n\t buffers.push(data);\n\t return placeholder;\n\t } else if (isArray(data)) {\n\t var newData = new Array(data.length);\n\t for (var i = 0; i < data.length; i++) {\n\t newData[i] = _deconstructPacket(data[i], buffers);\n\t }\n\t return newData;\n\t } else if (typeof data === 'object' && !(data instanceof Date)) {\n\t var newData = {};\n\t for (var key in data) {\n\t newData[key] = _deconstructPacket(data[key], buffers);\n\t }\n\t return newData;\n\t }\n\t return data;\n\t}\n\t\n\t/**\n\t * Reconstructs a binary packet from its placeholder packet and buffers\n\t *\n\t * @param {Object} packet - event packet with placeholders\n\t * @param {Array} buffers - binary buffers to put in placeholder positions\n\t * @return {Object} reconstructed packet\n\t * @api public\n\t */\n\t\n\texports.reconstructPacket = function(packet, buffers) {\n\t packet.data = _reconstructPacket(packet.data, buffers);\n\t packet.attachments = undefined; // no longer useful\n\t return packet;\n\t};\n\t\n\tfunction _reconstructPacket(data, buffers) {\n\t if (!data) return data;\n\t\n\t if (data && data._placeholder) {\n\t return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n\t } else if (isArray(data)) {\n\t for (var i = 0; i < data.length; i++) {\n\t data[i] = _reconstructPacket(data[i], buffers);\n\t }\n\t } else if (typeof data === 'object') {\n\t for (var key in data) {\n\t data[key] = _reconstructPacket(data[key], buffers);\n\t }\n\t }\n\t\n\t return data;\n\t}\n\t\n\t/**\n\t * Asynchronously removes Blobs or Files from data via\n\t * FileReader's readAsArrayBuffer method. Used before encoding\n\t * data as msgpack. Calls callback with the blobless data.\n\t *\n\t * @param {Object} data\n\t * @param {Function} callback\n\t * @api private\n\t */\n\t\n\texports.removeBlobs = function(data, callback) {\n\t function _removeBlobs(obj, curKey, containingObject) {\n\t if (!obj) return obj;\n\t\n\t // convert any blob\n\t if ((withNativeBlob && obj instanceof Blob) ||\n\t (withNativeFile && obj instanceof File)) {\n\t pendingBlobs++;\n\t\n\t // async filereader\n\t var fileReader = new FileReader();\n\t fileReader.onload = function() { // this.result == arraybuffer\n\t if (containingObject) {\n\t containingObject[curKey] = this.result;\n\t }\n\t else {\n\t bloblessData = this.result;\n\t }\n\t\n\t // if nothing pending its callback time\n\t if(! --pendingBlobs) {\n\t callback(bloblessData);\n\t }\n\t };\n\t\n\t fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n\t } else if (isArray(obj)) { // handle array\n\t for (var i = 0; i < obj.length; i++) {\n\t _removeBlobs(obj[i], i, obj);\n\t }\n\t } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n\t for (var key in obj) {\n\t _removeBlobs(obj[key], key, obj);\n\t }\n\t }\n\t }\n\t\n\t var pendingBlobs = 0;\n\t var bloblessData = data;\n\t _removeBlobs(bloblessData);\n\t if (!pendingBlobs) {\n\t callback(bloblessData);\n\t }\n\t};\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\n\tvar toString = {}.toString;\n\t\n\tmodule.exports = Array.isArray || function (arr) {\n\t return toString.call(arr) == '[object Array]';\n\t};\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\n\t\n\tmodule.exports = isBuf;\n\t\n\tvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\n\tvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\t\n\tvar isView = function (obj) {\n\t return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n\t};\n\t\n\t/**\n\t * Returns true if obj is a buffer or an arraybuffer.\n\t *\n\t * @api private\n\t */\n\t\n\tfunction isBuf(obj) {\n\t return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n\t (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n\t}\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar eio = __webpack_require__(10);\n\tvar Socket = __webpack_require__(33);\n\tvar Emitter = __webpack_require__(5);\n\tvar parser = __webpack_require__(4);\n\tvar on = __webpack_require__(35);\n\tvar bind = __webpack_require__(36);\n\tvar debug = __webpack_require__(3)('socket.io-client:manager');\n\tvar indexOf = __webpack_require__(32);\n\tvar Backoff = __webpack_require__(37);\n\t\n\t/**\n\t * IE6+ hasOwnProperty\n\t */\n\t\n\tvar has = Object.prototype.hasOwnProperty;\n\t\n\t/**\n\t * Module exports\n\t */\n\t\n\tmodule.exports = Manager;\n\t\n\t/**\n\t * `Manager` constructor.\n\t *\n\t * @param {String} engine instance or engine uri/opts\n\t * @param {Object} options\n\t * @api public\n\t */\n\t\n\tfunction Manager(uri, opts) {\n\t if (!(this instanceof Manager)) return new Manager(uri, opts);\n\t if (uri && 'object' === (typeof uri === 'undefined' ? 'undefined' : _typeof(uri))) {\n\t opts = uri;\n\t uri = undefined;\n\t }\n\t opts = opts || {};\n\t\n\t opts.path = opts.path || '/socket.io';\n\t this.nsps = {};\n\t this.subs = [];\n\t this.opts = opts;\n\t this.reconnection(opts.reconnection !== false);\n\t this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n\t this.reconnectionDelay(opts.reconnectionDelay || 1000);\n\t this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n\t this.randomizationFactor(opts.randomizationFactor || 0.5);\n\t this.backoff = new Backoff({\n\t min: this.reconnectionDelay(),\n\t max: this.reconnectionDelayMax(),\n\t jitter: this.randomizationFactor()\n\t });\n\t this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n\t this.readyState = 'closed';\n\t this.uri = uri;\n\t this.connecting = [];\n\t this.lastPing = null;\n\t this.encoding = false;\n\t this.packetBuffer = [];\n\t var _parser = opts.parser || parser;\n\t this.encoder = new _parser.Encoder();\n\t this.decoder = new _parser.Decoder();\n\t this.autoConnect = opts.autoConnect !== false;\n\t if (this.autoConnect) this.open();\n\t}\n\t\n\t/**\n\t * Propagate given event to sockets and emit on `this`\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.emitAll = function () {\n\t this.emit.apply(this, arguments);\n\t for (var nsp in this.nsps) {\n\t if (has.call(this.nsps, nsp)) {\n\t this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Update `socket.id` of all sockets\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.updateSocketIds = function () {\n\t for (var nsp in this.nsps) {\n\t if (has.call(this.nsps, nsp)) {\n\t this.nsps[nsp].id = this.generateId(nsp);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * generate `socket.id` for the given `nsp`\n\t *\n\t * @param {String} nsp\n\t * @return {String}\n\t * @api private\n\t */\n\t\n\tManager.prototype.generateId = function (nsp) {\n\t return (nsp === '/' ? '' : nsp + '#') + this.engine.id;\n\t};\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Manager.prototype);\n\t\n\t/**\n\t * Sets the `reconnection` config.\n\t *\n\t * @param {Boolean} true/false if it should automatically reconnect\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnection = function (v) {\n\t if (!arguments.length) return this._reconnection;\n\t this._reconnection = !!v;\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the reconnection attempts config.\n\t *\n\t * @param {Number} max reconnection attempts before giving up\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnectionAttempts = function (v) {\n\t if (!arguments.length) return this._reconnectionAttempts;\n\t this._reconnectionAttempts = v;\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the delay between reconnections.\n\t *\n\t * @param {Number} delay\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnectionDelay = function (v) {\n\t if (!arguments.length) return this._reconnectionDelay;\n\t this._reconnectionDelay = v;\n\t this.backoff && this.backoff.setMin(v);\n\t return this;\n\t};\n\t\n\tManager.prototype.randomizationFactor = function (v) {\n\t if (!arguments.length) return this._randomizationFactor;\n\t this._randomizationFactor = v;\n\t this.backoff && this.backoff.setJitter(v);\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the maximum delay between reconnections.\n\t *\n\t * @param {Number} delay\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.reconnectionDelayMax = function (v) {\n\t if (!arguments.length) return this._reconnectionDelayMax;\n\t this._reconnectionDelayMax = v;\n\t this.backoff && this.backoff.setMax(v);\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the connection timeout. `false` to disable\n\t *\n\t * @return {Manager} self or value\n\t * @api public\n\t */\n\t\n\tManager.prototype.timeout = function (v) {\n\t if (!arguments.length) return this._timeout;\n\t this._timeout = v;\n\t return this;\n\t};\n\t\n\t/**\n\t * Starts trying to reconnect if reconnection is enabled and we have not\n\t * started reconnecting yet\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.maybeReconnectOnOpen = function () {\n\t // Only try to reconnect if it's the first time we're connecting\n\t if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n\t // keeps reconnection from firing twice for the same reconnection loop\n\t this.reconnect();\n\t }\n\t};\n\t\n\t/**\n\t * Sets the current transport `socket`.\n\t *\n\t * @param {Function} optional, callback\n\t * @return {Manager} self\n\t * @api public\n\t */\n\t\n\tManager.prototype.open = Manager.prototype.connect = function (fn, opts) {\n\t\n\t if (~this.readyState.indexOf('open')) return this;\n\t\n\t this.engine = eio(this.uri, this.opts);\n\t var socket = this.engine;\n\t var self = this;\n\t this.readyState = 'opening';\n\t this.skipReconnect = false;\n\t\n\t // emit `open`\n\t var openSub = on(socket, 'open', function () {\n\t self.onopen();\n\t fn && fn();\n\t });\n\t\n\t // emit `connect_error`\n\t var errorSub = on(socket, 'error', function (data) {\n\t\n\t self.cleanup();\n\t self.readyState = 'closed';\n\t self.emitAll('connect_error', data);\n\t if (fn) {\n\t var err = new Error('Connection error');\n\t err.data = data;\n\t fn(err);\n\t } else {\n\t // Only do this if there is no fn to handle the error\n\t self.maybeReconnectOnOpen();\n\t }\n\t });\n\t\n\t // emit `connect_timeout`\n\t if (false !== this._timeout) {\n\t var timeout = this._timeout;\n\t\n\t // set timer\n\t var timer = setTimeout(function () {\n\t\n\t openSub.destroy();\n\t socket.close();\n\t socket.emit('error', 'timeout');\n\t self.emitAll('connect_timeout', timeout);\n\t }, timeout);\n\t\n\t this.subs.push({\n\t destroy: function destroy() {\n\t clearTimeout(timer);\n\t }\n\t });\n\t }\n\t\n\t this.subs.push(openSub);\n\t this.subs.push(errorSub);\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Called upon transport open.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onopen = function () {\n\t\n\t // clear old subs\n\t this.cleanup();\n\t\n\t // mark as open\n\t this.readyState = 'open';\n\t this.emit('open');\n\t\n\t // add new subs\n\t var socket = this.engine;\n\t this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n\t this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n\t this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n\t this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n\t this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n\t this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n\t};\n\t\n\t/**\n\t * Called upon a ping.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onping = function () {\n\t this.lastPing = new Date();\n\t this.emitAll('ping');\n\t};\n\t\n\t/**\n\t * Called upon a packet.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onpong = function () {\n\t this.emitAll('pong', new Date() - this.lastPing);\n\t};\n\t\n\t/**\n\t * Called with data.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.ondata = function (data) {\n\t this.decoder.add(data);\n\t};\n\t\n\t/**\n\t * Called when parser fully decodes a packet.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.ondecoded = function (packet) {\n\t this.emit('packet', packet);\n\t};\n\t\n\t/**\n\t * Called upon socket error.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onerror = function (err) {\n\t\n\t this.emitAll('error', err);\n\t};\n\t\n\t/**\n\t * Creates a new socket for the given `nsp`.\n\t *\n\t * @return {Socket}\n\t * @api public\n\t */\n\t\n\tManager.prototype.socket = function (nsp, opts) {\n\t var socket = this.nsps[nsp];\n\t if (!socket) {\n\t socket = new Socket(this, nsp, opts);\n\t this.nsps[nsp] = socket;\n\t var self = this;\n\t socket.on('connecting', onConnecting);\n\t socket.on('connect', function () {\n\t socket.id = self.generateId(nsp);\n\t });\n\t\n\t if (this.autoConnect) {\n\t // manually call here since connecting event is fired before listening\n\t onConnecting();\n\t }\n\t }\n\t\n\t function onConnecting() {\n\t if (!~indexOf(self.connecting, socket)) {\n\t self.connecting.push(socket);\n\t }\n\t }\n\t\n\t return socket;\n\t};\n\t\n\t/**\n\t * Called upon a socket close.\n\t *\n\t * @param {Socket} socket\n\t */\n\t\n\tManager.prototype.destroy = function (socket) {\n\t var index = indexOf(this.connecting, socket);\n\t if (~index) this.connecting.splice(index, 1);\n\t if (this.connecting.length) return;\n\t\n\t this.close();\n\t};\n\t\n\t/**\n\t * Writes a packet.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tManager.prototype.packet = function (packet) {\n\t\n\t var self = this;\n\t if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\t\n\t if (!self.encoding) {\n\t // encode, then write to engine with result\n\t self.encoding = true;\n\t this.encoder.encode(packet, function (encodedPackets) {\n\t for (var i = 0; i < encodedPackets.length; i++) {\n\t self.engine.write(encodedPackets[i], packet.options);\n\t }\n\t self.encoding = false;\n\t self.processPacketQueue();\n\t });\n\t } else {\n\t // add packet to the queue\n\t self.packetBuffer.push(packet);\n\t }\n\t};\n\t\n\t/**\n\t * If packet buffer is non-empty, begins encoding the\n\t * next packet in line.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.processPacketQueue = function () {\n\t if (this.packetBuffer.length > 0 && !this.encoding) {\n\t var pack = this.packetBuffer.shift();\n\t this.packet(pack);\n\t }\n\t};\n\t\n\t/**\n\t * Clean up transport subscriptions and packet buffer.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.cleanup = function () {\n\t\n\t var subsLength = this.subs.length;\n\t for (var i = 0; i < subsLength; i++) {\n\t var sub = this.subs.shift();\n\t sub.destroy();\n\t }\n\t\n\t this.packetBuffer = [];\n\t this.encoding = false;\n\t this.lastPing = null;\n\t\n\t this.decoder.destroy();\n\t};\n\t\n\t/**\n\t * Close the current socket.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.close = Manager.prototype.disconnect = function () {\n\t\n\t this.skipReconnect = true;\n\t this.reconnecting = false;\n\t if ('opening' === this.readyState) {\n\t // `onclose` will not fire because\n\t // an open event never happened\n\t this.cleanup();\n\t }\n\t this.backoff.reset();\n\t this.readyState = 'closed';\n\t if (this.engine) this.engine.close();\n\t};\n\t\n\t/**\n\t * Called upon engine close.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onclose = function (reason) {\n\t\n\t this.cleanup();\n\t this.backoff.reset();\n\t this.readyState = 'closed';\n\t this.emit('close', reason);\n\t\n\t if (this._reconnection && !this.skipReconnect) {\n\t this.reconnect();\n\t }\n\t};\n\t\n\t/**\n\t * Attempt a reconnection.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.reconnect = function () {\n\t if (this.reconnecting || this.skipReconnect) return this;\n\t\n\t var self = this;\n\t\n\t if (this.backoff.attempts >= this._reconnectionAttempts) {\n\t\n\t this.backoff.reset();\n\t this.emitAll('reconnect_failed');\n\t this.reconnecting = false;\n\t } else {\n\t var delay = this.backoff.duration();\n\t\n\t this.reconnecting = true;\n\t var timer = setTimeout(function () {\n\t if (self.skipReconnect) return;\n\t\n\t self.emitAll('reconnect_attempt', self.backoff.attempts);\n\t self.emitAll('reconnecting', self.backoff.attempts);\n\t\n\t // check again for the case socket closed in above events\n\t if (self.skipReconnect) return;\n\t\n\t self.open(function (err) {\n\t if (err) {\n\t\n\t self.reconnecting = false;\n\t self.reconnect();\n\t self.emitAll('reconnect_error', err.data);\n\t } else {\n\t\n\t self.onreconnect();\n\t }\n\t });\n\t }, delay);\n\t\n\t this.subs.push({\n\t destroy: function destroy() {\n\t clearTimeout(timer);\n\t }\n\t });\n\t }\n\t};\n\t\n\t/**\n\t * Called upon successful reconnect.\n\t *\n\t * @api private\n\t */\n\t\n\tManager.prototype.onreconnect = function () {\n\t var attempt = this.backoff.attempts;\n\t this.reconnecting = false;\n\t this.backoff.reset();\n\t this.updateSocketIds();\n\t this.emitAll('reconnect', attempt);\n\t};\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t\n\tmodule.exports = __webpack_require__(11);\n\t\n\t/**\n\t * Exports parser\n\t *\n\t * @api public\n\t *\n\t */\n\tmodule.exports.parser = __webpack_require__(18);\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar transports = __webpack_require__(12);\n\tvar Emitter = __webpack_require__(5);\n\tvar debug = __webpack_require__(3)('engine.io-client:socket');\n\tvar index = __webpack_require__(32);\n\tvar parser = __webpack_require__(18);\n\tvar parseuri = __webpack_require__(2);\n\tvar parseqs = __webpack_require__(26);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = Socket;\n\t\n\t/**\n\t * Socket constructor.\n\t *\n\t * @param {String|Object} uri or options\n\t * @param {Object} options\n\t * @api public\n\t */\n\t\n\tfunction Socket (uri, opts) {\n\t if (!(this instanceof Socket)) return new Socket(uri, opts);\n\t\n\t opts = opts || {};\n\t\n\t if (uri && 'object' === typeof uri) {\n\t opts = uri;\n\t uri = null;\n\t }\n\t\n\t if (uri) {\n\t uri = parseuri(uri);\n\t opts.hostname = uri.host;\n\t opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n\t opts.port = uri.port;\n\t if (uri.query) opts.query = uri.query;\n\t } else if (opts.host) {\n\t opts.hostname = parseuri(opts.host).host;\n\t }\n\t\n\t this.secure = null != opts.secure ? opts.secure\n\t : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\t\n\t if (opts.hostname && !opts.port) {\n\t // if no port is specified manually, use the protocol default\n\t opts.port = this.secure ? '443' : '80';\n\t }\n\t\n\t this.agent = opts.agent || false;\n\t this.hostname = opts.hostname ||\n\t (typeof location !== 'undefined' ? location.hostname : 'localhost');\n\t this.port = opts.port || (typeof location !== 'undefined' && location.port\n\t ? location.port\n\t : (this.secure ? 443 : 80));\n\t this.query = opts.query || {};\n\t if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n\t this.upgrade = false !== opts.upgrade;\n\t this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n\t this.forceJSONP = !!opts.forceJSONP;\n\t this.jsonp = false !== opts.jsonp;\n\t this.forceBase64 = !!opts.forceBase64;\n\t this.enablesXDR = !!opts.enablesXDR;\n\t this.withCredentials = false !== opts.withCredentials;\n\t this.timestampParam = opts.timestampParam || 't';\n\t this.timestampRequests = opts.timestampRequests;\n\t this.transports = opts.transports || ['polling', 'websocket'];\n\t this.transportOptions = opts.transportOptions || {};\n\t this.readyState = '';\n\t this.writeBuffer = [];\n\t this.prevBufferLen = 0;\n\t this.policyPort = opts.policyPort || 843;\n\t this.rememberUpgrade = opts.rememberUpgrade || false;\n\t this.binaryType = null;\n\t this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n\t this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\t\n\t if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n\t if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n\t this.perMessageDeflate.threshold = 1024;\n\t }\n\t\n\t // SSL options for Node.js client\n\t this.pfx = opts.pfx || null;\n\t this.key = opts.key || null;\n\t this.passphrase = opts.passphrase || null;\n\t this.cert = opts.cert || null;\n\t this.ca = opts.ca || null;\n\t this.ciphers = opts.ciphers || null;\n\t this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n\t this.forceNode = !!opts.forceNode;\n\t\n\t // detect ReactNative environment\n\t this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\t\n\t // other options for Node.js or ReactNative client\n\t if (typeof self === 'undefined' || this.isReactNative) {\n\t if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n\t this.extraHeaders = opts.extraHeaders;\n\t }\n\t\n\t if (opts.localAddress) {\n\t this.localAddress = opts.localAddress;\n\t }\n\t }\n\t\n\t // set on handshake\n\t this.id = null;\n\t this.upgrades = null;\n\t this.pingInterval = null;\n\t this.pingTimeout = null;\n\t\n\t // set on heartbeat\n\t this.pingIntervalTimer = null;\n\t this.pingTimeoutTimer = null;\n\t\n\t this.open();\n\t}\n\t\n\tSocket.priorWebsocketSuccess = false;\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Socket.prototype);\n\t\n\t/**\n\t * Protocol version.\n\t *\n\t * @api public\n\t */\n\t\n\tSocket.protocol = parser.protocol; // this is an int\n\t\n\t/**\n\t * Expose deps for legacy compatibility\n\t * and standalone browser access.\n\t */\n\t\n\tSocket.Socket = Socket;\n\tSocket.Transport = __webpack_require__(17);\n\tSocket.transports = __webpack_require__(12);\n\tSocket.parser = __webpack_require__(18);\n\t\n\t/**\n\t * Creates transport of the given type.\n\t *\n\t * @param {String} transport name\n\t * @return {Transport}\n\t * @api private\n\t */\n\t\n\tSocket.prototype.createTransport = function (name) {\n\t\n\t var query = clone(this.query);\n\t\n\t // append engine.io protocol identifier\n\t query.EIO = parser.protocol;\n\t\n\t // transport name\n\t query.transport = name;\n\t\n\t // per-transport options\n\t var options = this.transportOptions[name] || {};\n\t\n\t // session id if we already have one\n\t if (this.id) query.sid = this.id;\n\t\n\t var transport = new transports[name]({\n\t query: query,\n\t socket: this,\n\t agent: options.agent || this.agent,\n\t hostname: options.hostname || this.hostname,\n\t port: options.port || this.port,\n\t secure: options.secure || this.secure,\n\t path: options.path || this.path,\n\t forceJSONP: options.forceJSONP || this.forceJSONP,\n\t jsonp: options.jsonp || this.jsonp,\n\t forceBase64: options.forceBase64 || this.forceBase64,\n\t enablesXDR: options.enablesXDR || this.enablesXDR,\n\t withCredentials: options.withCredentials || this.withCredentials,\n\t timestampRequests: options.timestampRequests || this.timestampRequests,\n\t timestampParam: options.timestampParam || this.timestampParam,\n\t policyPort: options.policyPort || this.policyPort,\n\t pfx: options.pfx || this.pfx,\n\t key: options.key || this.key,\n\t passphrase: options.passphrase || this.passphrase,\n\t cert: options.cert || this.cert,\n\t ca: options.ca || this.ca,\n\t ciphers: options.ciphers || this.ciphers,\n\t rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n\t perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n\t extraHeaders: options.extraHeaders || this.extraHeaders,\n\t forceNode: options.forceNode || this.forceNode,\n\t localAddress: options.localAddress || this.localAddress,\n\t requestTimeout: options.requestTimeout || this.requestTimeout,\n\t protocols: options.protocols || void (0),\n\t isReactNative: this.isReactNative\n\t });\n\t\n\t return transport;\n\t};\n\t\n\tfunction clone (obj) {\n\t var o = {};\n\t for (var i in obj) {\n\t if (obj.hasOwnProperty(i)) {\n\t o[i] = obj[i];\n\t }\n\t }\n\t return o;\n\t}\n\t\n\t/**\n\t * Initializes transport to use and starts probe.\n\t *\n\t * @api private\n\t */\n\tSocket.prototype.open = function () {\n\t var transport;\n\t if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n\t transport = 'websocket';\n\t } else if (0 === this.transports.length) {\n\t // Emit error on next tick so it can be listened to\n\t var self = this;\n\t setTimeout(function () {\n\t self.emit('error', 'No transports available');\n\t }, 0);\n\t return;\n\t } else {\n\t transport = this.transports[0];\n\t }\n\t this.readyState = 'opening';\n\t\n\t // Retry with the next transport if the transport is disabled (jsonp: false)\n\t try {\n\t transport = this.createTransport(transport);\n\t } catch (e) {\n\t this.transports.shift();\n\t this.open();\n\t return;\n\t }\n\t\n\t transport.open();\n\t this.setTransport(transport);\n\t};\n\t\n\t/**\n\t * Sets the current transport. Disables the existing one (if any).\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.setTransport = function (transport) {\n\t\n\t var self = this;\n\t\n\t if (this.transport) {\n\t\n\t this.transport.removeAllListeners();\n\t }\n\t\n\t // set up transport\n\t this.transport = transport;\n\t\n\t // set up transport listeners\n\t transport\n\t .on('drain', function () {\n\t self.onDrain();\n\t })\n\t .on('packet', function (packet) {\n\t self.onPacket(packet);\n\t })\n\t .on('error', function (e) {\n\t self.onError(e);\n\t })\n\t .on('close', function () {\n\t self.onClose('transport close');\n\t });\n\t};\n\t\n\t/**\n\t * Probes a transport.\n\t *\n\t * @param {String} transport name\n\t * @api private\n\t */\n\t\n\tSocket.prototype.probe = function (name) {\n\t\n\t var transport = this.createTransport(name, { probe: 1 });\n\t var failed = false;\n\t var self = this;\n\t\n\t Socket.priorWebsocketSuccess = false;\n\t\n\t function onTransportOpen () {\n\t if (self.onlyBinaryUpgrades) {\n\t var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n\t failed = failed || upgradeLosesBinary;\n\t }\n\t if (failed) return;\n\t\n\t\n\t transport.send([{ type: 'ping', data: 'probe' }]);\n\t transport.once('packet', function (msg) {\n\t if (failed) return;\n\t if ('pong' === msg.type && 'probe' === msg.data) {\n\t\n\t self.upgrading = true;\n\t self.emit('upgrading', transport);\n\t if (!transport) return;\n\t Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\t\n\t\n\t self.transport.pause(function () {\n\t if (failed) return;\n\t if ('closed' === self.readyState) return;\n\t\n\t\n\t cleanup();\n\t\n\t self.setTransport(transport);\n\t transport.send([{ type: 'upgrade' }]);\n\t self.emit('upgrade', transport);\n\t transport = null;\n\t self.upgrading = false;\n\t self.flush();\n\t });\n\t } else {\n\t\n\t var err = new Error('probe error');\n\t err.transport = transport.name;\n\t self.emit('upgradeError', err);\n\t }\n\t });\n\t }\n\t\n\t function freezeTransport () {\n\t if (failed) return;\n\t\n\t // Any callback called by transport should be ignored since now\n\t failed = true;\n\t\n\t cleanup();\n\t\n\t transport.close();\n\t transport = null;\n\t }\n\t\n\t // Handle any error that happens while probing\n\t function onerror (err) {\n\t var error = new Error('probe error: ' + err);\n\t error.transport = transport.name;\n\t\n\t freezeTransport();\n\t\n\t\n\t\n\t self.emit('upgradeError', error);\n\t }\n\t\n\t function onTransportClose () {\n\t onerror('transport closed');\n\t }\n\t\n\t // When the socket is closed while we're probing\n\t function onclose () {\n\t onerror('socket closed');\n\t }\n\t\n\t // When the socket is upgraded while we're probing\n\t function onupgrade (to) {\n\t if (transport && to.name !== transport.name) {\n\t\n\t freezeTransport();\n\t }\n\t }\n\t\n\t // Remove all listeners on the transport and on self\n\t function cleanup () {\n\t transport.removeListener('open', onTransportOpen);\n\t transport.removeListener('error', onerror);\n\t transport.removeListener('close', onTransportClose);\n\t self.removeListener('close', onclose);\n\t self.removeListener('upgrading', onupgrade);\n\t }\n\t\n\t transport.once('open', onTransportOpen);\n\t transport.once('error', onerror);\n\t transport.once('close', onTransportClose);\n\t\n\t this.once('close', onclose);\n\t this.once('upgrading', onupgrade);\n\t\n\t transport.open();\n\t};\n\t\n\t/**\n\t * Called when connection is deemed open.\n\t *\n\t * @api public\n\t */\n\t\n\tSocket.prototype.onOpen = function () {\n\t\n\t this.readyState = 'open';\n\t Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n\t this.emit('open');\n\t this.flush();\n\t\n\t // we check for `readyState` in case an `open`\n\t // listener already closed the socket\n\t if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n\t\n\t for (var i = 0, l = this.upgrades.length; i < l; i++) {\n\t this.probe(this.upgrades[i]);\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Handles a packet.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onPacket = function (packet) {\n\t if ('opening' === this.readyState || 'open' === this.readyState ||\n\t 'closing' === this.readyState) {\n\t\n\t\n\t this.emit('packet', packet);\n\t\n\t // Socket is live - any packet counts\n\t this.emit('heartbeat');\n\t\n\t switch (packet.type) {\n\t case 'open':\n\t this.onHandshake(JSON.parse(packet.data));\n\t break;\n\t\n\t case 'pong':\n\t this.setPing();\n\t this.emit('pong');\n\t break;\n\t\n\t case 'error':\n\t var err = new Error('server error');\n\t err.code = packet.data;\n\t this.onError(err);\n\t break;\n\t\n\t case 'message':\n\t this.emit('data', packet.data);\n\t this.emit('message', packet.data);\n\t break;\n\t }\n\t } else {\n\t\n\t }\n\t};\n\t\n\t/**\n\t * Called upon handshake completion.\n\t *\n\t * @param {Object} handshake obj\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onHandshake = function (data) {\n\t this.emit('handshake', data);\n\t this.id = data.sid;\n\t this.transport.query.sid = data.sid;\n\t this.upgrades = this.filterUpgrades(data.upgrades);\n\t this.pingInterval = data.pingInterval;\n\t this.pingTimeout = data.pingTimeout;\n\t this.onOpen();\n\t // In case open handler closes socket\n\t if ('closed' === this.readyState) return;\n\t this.setPing();\n\t\n\t // Prolong liveness of socket on heartbeat\n\t this.removeListener('heartbeat', this.onHeartbeat);\n\t this.on('heartbeat', this.onHeartbeat);\n\t};\n\t\n\t/**\n\t * Resets ping timeout.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onHeartbeat = function (timeout) {\n\t clearTimeout(this.pingTimeoutTimer);\n\t var self = this;\n\t self.pingTimeoutTimer = setTimeout(function () {\n\t if ('closed' === self.readyState) return;\n\t self.onClose('ping timeout');\n\t }, timeout || (self.pingInterval + self.pingTimeout));\n\t};\n\t\n\t/**\n\t * Pings server every `this.pingInterval` and expects response\n\t * within `this.pingTimeout` or closes connection.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.setPing = function () {\n\t var self = this;\n\t clearTimeout(self.pingIntervalTimer);\n\t self.pingIntervalTimer = setTimeout(function () {\n\t\n\t self.ping();\n\t self.onHeartbeat(self.pingTimeout);\n\t }, self.pingInterval);\n\t};\n\t\n\t/**\n\t* Sends a ping packet.\n\t*\n\t* @api private\n\t*/\n\t\n\tSocket.prototype.ping = function () {\n\t var self = this;\n\t this.sendPacket('ping', function () {\n\t self.emit('ping');\n\t });\n\t};\n\t\n\t/**\n\t * Called on `drain` event\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onDrain = function () {\n\t this.writeBuffer.splice(0, this.prevBufferLen);\n\t\n\t // setting prevBufferLen = 0 is very important\n\t // for example, when upgrading, upgrade packet is sent over,\n\t // and a nonzero prevBufferLen could cause problems on `drain`\n\t this.prevBufferLen = 0;\n\t\n\t if (0 === this.writeBuffer.length) {\n\t this.emit('drain');\n\t } else {\n\t this.flush();\n\t }\n\t};\n\t\n\t/**\n\t * Flush write buffers.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.flush = function () {\n\t if ('closed' !== this.readyState && this.transport.writable &&\n\t !this.upgrading && this.writeBuffer.length) {\n\t\n\t this.transport.send(this.writeBuffer);\n\t // keep track of current length of writeBuffer\n\t // splice writeBuffer and callbackBuffer on `drain`\n\t this.prevBufferLen = this.writeBuffer.length;\n\t this.emit('flush');\n\t }\n\t};\n\t\n\t/**\n\t * Sends a message.\n\t *\n\t * @param {String} message.\n\t * @param {Function} callback function.\n\t * @param {Object} options.\n\t * @return {Socket} for chaining.\n\t * @api public\n\t */\n\t\n\tSocket.prototype.write =\n\tSocket.prototype.send = function (msg, options, fn) {\n\t this.sendPacket('message', msg, options, fn);\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends a packet.\n\t *\n\t * @param {String} packet type.\n\t * @param {String} data.\n\t * @param {Object} options.\n\t * @param {Function} callback function.\n\t * @api private\n\t */\n\t\n\tSocket.prototype.sendPacket = function (type, data, options, fn) {\n\t if ('function' === typeof data) {\n\t fn = data;\n\t data = undefined;\n\t }\n\t\n\t if ('function' === typeof options) {\n\t fn = options;\n\t options = null;\n\t }\n\t\n\t if ('closing' === this.readyState || 'closed' === this.readyState) {\n\t return;\n\t }\n\t\n\t options = options || {};\n\t options.compress = false !== options.compress;\n\t\n\t var packet = {\n\t type: type,\n\t data: data,\n\t options: options\n\t };\n\t this.emit('packetCreate', packet);\n\t this.writeBuffer.push(packet);\n\t if (fn) this.once('flush', fn);\n\t this.flush();\n\t};\n\t\n\t/**\n\t * Closes the connection.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.close = function () {\n\t if ('opening' === this.readyState || 'open' === this.readyState) {\n\t this.readyState = 'closing';\n\t\n\t var self = this;\n\t\n\t if (this.writeBuffer.length) {\n\t this.once('drain', function () {\n\t if (this.upgrading) {\n\t waitForUpgrade();\n\t } else {\n\t close();\n\t }\n\t });\n\t } else if (this.upgrading) {\n\t waitForUpgrade();\n\t } else {\n\t close();\n\t }\n\t }\n\t\n\t function close () {\n\t self.onClose('forced close');\n\t\n\t self.transport.close();\n\t }\n\t\n\t function cleanupAndClose () {\n\t self.removeListener('upgrade', cleanupAndClose);\n\t self.removeListener('upgradeError', cleanupAndClose);\n\t close();\n\t }\n\t\n\t function waitForUpgrade () {\n\t // wait for upgrade to finish since we can't send packets while pausing a transport\n\t self.once('upgrade', cleanupAndClose);\n\t self.once('upgradeError', cleanupAndClose);\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Called upon transport error\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onError = function (err) {\n\t\n\t Socket.priorWebsocketSuccess = false;\n\t this.emit('error', err);\n\t this.onClose('transport error', err);\n\t};\n\t\n\t/**\n\t * Called upon transport close.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onClose = function (reason, desc) {\n\t if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n\t\n\t var self = this;\n\t\n\t // clear timers\n\t clearTimeout(this.pingIntervalTimer);\n\t clearTimeout(this.pingTimeoutTimer);\n\t\n\t // stop event from firing again for transport\n\t this.transport.removeAllListeners('close');\n\t\n\t // ensure transport won't stay open\n\t this.transport.close();\n\t\n\t // ignore further transport communication\n\t this.transport.removeAllListeners();\n\t\n\t // set ready state\n\t this.readyState = 'closed';\n\t\n\t // clear session id\n\t this.id = null;\n\t\n\t // emit close event\n\t this.emit('close', reason, desc);\n\t\n\t // clean buffers after, so users can still\n\t // grab the buffers on `close` event\n\t self.writeBuffer = [];\n\t self.prevBufferLen = 0;\n\t }\n\t};\n\t\n\t/**\n\t * Filters upgrades, returning only those matching client transports.\n\t *\n\t * @param {Array} server upgrades\n\t * @api private\n\t *\n\t */\n\t\n\tSocket.prototype.filterUpgrades = function (upgrades) {\n\t var filteredUpgrades = [];\n\t for (var i = 0, j = upgrades.length; i < j; i++) {\n\t if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n\t }\n\t return filteredUpgrades;\n\t};\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies\n\t */\n\t\n\tvar XMLHttpRequest = __webpack_require__(13);\n\tvar XHR = __webpack_require__(15);\n\tvar JSONP = __webpack_require__(29);\n\tvar websocket = __webpack_require__(30);\n\t\n\t/**\n\t * Export transports.\n\t */\n\t\n\texports.polling = polling;\n\texports.websocket = websocket;\n\t\n\t/**\n\t * Polling transport polymorphic constructor.\n\t * Decides on xhr vs jsonp based on feature detection.\n\t *\n\t * @api private\n\t */\n\t\n\tfunction polling (opts) {\n\t var xhr;\n\t var xd = false;\n\t var xs = false;\n\t var jsonp = false !== opts.jsonp;\n\t\n\t if (typeof location !== 'undefined') {\n\t var isSSL = 'https:' === location.protocol;\n\t var port = location.port;\n\t\n\t // some user agents have empty `location.port`\n\t if (!port) {\n\t port = isSSL ? 443 : 80;\n\t }\n\t\n\t xd = opts.hostname !== location.hostname || port !== opts.port;\n\t xs = opts.secure !== isSSL;\n\t }\n\t\n\t opts.xdomain = xd;\n\t opts.xscheme = xs;\n\t xhr = new XMLHttpRequest(opts);\n\t\n\t if ('open' in xhr && !opts.forceJSONP) {\n\t return new XHR(opts);\n\t } else {\n\t if (!jsonp) throw new Error('JSONP disabled');\n\t return new JSONP(opts);\n\t }\n\t}\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t// browser shim for xmlhttprequest module\n\t\n\tvar hasCORS = __webpack_require__(14);\n\t\n\tmodule.exports = function (opts) {\n\t var xdomain = opts.xdomain;\n\t\n\t // scheme must be same when usign XDomainRequest\n\t // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n\t var xscheme = opts.xscheme;\n\t\n\t // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n\t // https://github.com/Automattic/engine.io-client/pull/217\n\t var enablesXDR = opts.enablesXDR;\n\t\n\t // XMLHttpRequest can be disabled on IE\n\t try {\n\t if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n\t return new XMLHttpRequest();\n\t }\n\t } catch (e) { }\n\t\n\t // Use XDomainRequest for IE8 if enablesXDR is true\n\t // because loading bar keeps flashing when using jsonp-polling\n\t // https://github.com/yujiosaka/socke.io-ie8-loading-example\n\t try {\n\t if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n\t return new XDomainRequest();\n\t }\n\t } catch (e) { }\n\t\n\t if (!xdomain) {\n\t try {\n\t return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n\t } catch (e) { }\n\t }\n\t};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Module exports.\n\t *\n\t * Logic borrowed from Modernizr:\n\t *\n\t * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n\t */\n\t\n\ttry {\n\t module.exports = typeof XMLHttpRequest !== 'undefined' &&\n\t 'withCredentials' in new XMLHttpRequest();\n\t} catch (err) {\n\t // if XMLHttp support is disabled in IE then it will throw\n\t // when trying to create\n\t module.exports = false;\n\t}\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* global attachEvent */\n\t\n\t/**\n\t * Module requirements.\n\t */\n\t\n\tvar XMLHttpRequest = __webpack_require__(13);\n\tvar Polling = __webpack_require__(16);\n\tvar Emitter = __webpack_require__(5);\n\tvar inherit = __webpack_require__(27);\n\tvar debug = __webpack_require__(3)('engine.io-client:polling-xhr');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = XHR;\n\tmodule.exports.Request = Request;\n\t\n\t/**\n\t * Empty function\n\t */\n\t\n\tfunction empty () {}\n\t\n\t/**\n\t * XHR Polling constructor.\n\t *\n\t * @param {Object} opts\n\t * @api public\n\t */\n\t\n\tfunction XHR (opts) {\n\t Polling.call(this, opts);\n\t this.requestTimeout = opts.requestTimeout;\n\t this.extraHeaders = opts.extraHeaders;\n\t\n\t if (typeof location !== 'undefined') {\n\t var isSSL = 'https:' === location.protocol;\n\t var port = location.port;\n\t\n\t // some user agents have empty `location.port`\n\t if (!port) {\n\t port = isSSL ? 443 : 80;\n\t }\n\t\n\t this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n\t port !== opts.port;\n\t this.xs = opts.secure !== isSSL;\n\t }\n\t}\n\t\n\t/**\n\t * Inherits from Polling.\n\t */\n\t\n\tinherit(XHR, Polling);\n\t\n\t/**\n\t * XHR supports binary\n\t */\n\t\n\tXHR.prototype.supportsBinary = true;\n\t\n\t/**\n\t * Creates a request.\n\t *\n\t * @param {String} method\n\t * @api private\n\t */\n\t\n\tXHR.prototype.request = function (opts) {\n\t opts = opts || {};\n\t opts.uri = this.uri();\n\t opts.xd = this.xd;\n\t opts.xs = this.xs;\n\t opts.agent = this.agent || false;\n\t opts.supportsBinary = this.supportsBinary;\n\t opts.enablesXDR = this.enablesXDR;\n\t opts.withCredentials = this.withCredentials;\n\t\n\t // SSL options for Node.js client\n\t opts.pfx = this.pfx;\n\t opts.key = this.key;\n\t opts.passphrase = this.passphrase;\n\t opts.cert = this.cert;\n\t opts.ca = this.ca;\n\t opts.ciphers = this.ciphers;\n\t opts.rejectUnauthorized = this.rejectUnauthorized;\n\t opts.requestTimeout = this.requestTimeout;\n\t\n\t // other options for Node.js client\n\t opts.extraHeaders = this.extraHeaders;\n\t\n\t return new Request(opts);\n\t};\n\t\n\t/**\n\t * Sends data.\n\t *\n\t * @param {String} data to send.\n\t * @param {Function} called upon flush.\n\t * @api private\n\t */\n\t\n\tXHR.prototype.doWrite = function (data, fn) {\n\t var isBinary = typeof data !== 'string' && data !== undefined;\n\t var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n\t var self = this;\n\t req.on('success', fn);\n\t req.on('error', function (err) {\n\t self.onError('xhr post error', err);\n\t });\n\t this.sendXhr = req;\n\t};\n\t\n\t/**\n\t * Starts a poll cycle.\n\t *\n\t * @api private\n\t */\n\t\n\tXHR.prototype.doPoll = function () {\n\t\n\t var req = this.request();\n\t var self = this;\n\t req.on('data', function (data) {\n\t self.onData(data);\n\t });\n\t req.on('error', function (err) {\n\t self.onError('xhr poll error', err);\n\t });\n\t this.pollXhr = req;\n\t};\n\t\n\t/**\n\t * Request constructor\n\t *\n\t * @param {Object} options\n\t * @api public\n\t */\n\t\n\tfunction Request (opts) {\n\t this.method = opts.method || 'GET';\n\t this.uri = opts.uri;\n\t this.xd = !!opts.xd;\n\t this.xs = !!opts.xs;\n\t this.async = false !== opts.async;\n\t this.data = undefined !== opts.data ? opts.data : null;\n\t this.agent = opts.agent;\n\t this.isBinary = opts.isBinary;\n\t this.supportsBinary = opts.supportsBinary;\n\t this.enablesXDR = opts.enablesXDR;\n\t this.withCredentials = opts.withCredentials;\n\t this.requestTimeout = opts.requestTimeout;\n\t\n\t // SSL options for Node.js client\n\t this.pfx = opts.pfx;\n\t this.key = opts.key;\n\t this.passphrase = opts.passphrase;\n\t this.cert = opts.cert;\n\t this.ca = opts.ca;\n\t this.ciphers = opts.ciphers;\n\t this.rejectUnauthorized = opts.rejectUnauthorized;\n\t\n\t // other options for Node.js client\n\t this.extraHeaders = opts.extraHeaders;\n\t\n\t this.create();\n\t}\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Request.prototype);\n\t\n\t/**\n\t * Creates the XHR object and sends the request.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.create = function () {\n\t var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\t\n\t // SSL options for Node.js client\n\t opts.pfx = this.pfx;\n\t opts.key = this.key;\n\t opts.passphrase = this.passphrase;\n\t opts.cert = this.cert;\n\t opts.ca = this.ca;\n\t opts.ciphers = this.ciphers;\n\t opts.rejectUnauthorized = this.rejectUnauthorized;\n\t\n\t var xhr = this.xhr = new XMLHttpRequest(opts);\n\t var self = this;\n\t\n\t try {\n\t\n\t xhr.open(this.method, this.uri, this.async);\n\t try {\n\t if (this.extraHeaders) {\n\t xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n\t for (var i in this.extraHeaders) {\n\t if (this.extraHeaders.hasOwnProperty(i)) {\n\t xhr.setRequestHeader(i, this.extraHeaders[i]);\n\t }\n\t }\n\t }\n\t } catch (e) {}\n\t\n\t if ('POST' === this.method) {\n\t try {\n\t if (this.isBinary) {\n\t xhr.setRequestHeader('Content-type', 'application/octet-stream');\n\t } else {\n\t xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n\t }\n\t } catch (e) {}\n\t }\n\t\n\t try {\n\t xhr.setRequestHeader('Accept', '*/*');\n\t } catch (e) {}\n\t\n\t // ie6 check\n\t if ('withCredentials' in xhr) {\n\t xhr.withCredentials = this.withCredentials;\n\t }\n\t\n\t if (this.requestTimeout) {\n\t xhr.timeout = this.requestTimeout;\n\t }\n\t\n\t if (this.hasXDR()) {\n\t xhr.onload = function () {\n\t self.onLoad();\n\t };\n\t xhr.onerror = function () {\n\t self.onError(xhr.responseText);\n\t };\n\t } else {\n\t xhr.onreadystatechange = function () {\n\t if (xhr.readyState === 2) {\n\t try {\n\t var contentType = xhr.getResponseHeader('Content-Type');\n\t if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n\t xhr.responseType = 'arraybuffer';\n\t }\n\t } catch (e) {}\n\t }\n\t if (4 !== xhr.readyState) return;\n\t if (200 === xhr.status || 1223 === xhr.status) {\n\t self.onLoad();\n\t } else {\n\t // make sure the `error` event handler that's user-set\n\t // does not throw in the same tick and gets caught here\n\t setTimeout(function () {\n\t self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n\t }, 0);\n\t }\n\t };\n\t }\n\t\n\t\n\t xhr.send(this.data);\n\t } catch (e) {\n\t // Need to defer since .create() is called directly fhrom the constructor\n\t // and thus the 'error' event can only be only bound *after* this exception\n\t // occurs. Therefore, also, we cannot throw here at all.\n\t setTimeout(function () {\n\t self.onError(e);\n\t }, 0);\n\t return;\n\t }\n\t\n\t if (typeof document !== 'undefined') {\n\t this.index = Request.requestsCount++;\n\t Request.requests[this.index] = this;\n\t }\n\t};\n\t\n\t/**\n\t * Called upon successful response.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onSuccess = function () {\n\t this.emit('success');\n\t this.cleanup();\n\t};\n\t\n\t/**\n\t * Called if we have data.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onData = function (data) {\n\t this.emit('data', data);\n\t this.onSuccess();\n\t};\n\t\n\t/**\n\t * Called upon error.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onError = function (err) {\n\t this.emit('error', err);\n\t this.cleanup(true);\n\t};\n\t\n\t/**\n\t * Cleans up house.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.cleanup = function (fromError) {\n\t if ('undefined' === typeof this.xhr || null === this.xhr) {\n\t return;\n\t }\n\t // xmlhttprequest\n\t if (this.hasXDR()) {\n\t this.xhr.onload = this.xhr.onerror = empty;\n\t } else {\n\t this.xhr.onreadystatechange = empty;\n\t }\n\t\n\t if (fromError) {\n\t try {\n\t this.xhr.abort();\n\t } catch (e) {}\n\t }\n\t\n\t if (typeof document !== 'undefined') {\n\t delete Request.requests[this.index];\n\t }\n\t\n\t this.xhr = null;\n\t};\n\t\n\t/**\n\t * Called upon load.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.onLoad = function () {\n\t var data;\n\t try {\n\t var contentType;\n\t try {\n\t contentType = this.xhr.getResponseHeader('Content-Type');\n\t } catch (e) {}\n\t if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n\t data = this.xhr.response || this.xhr.responseText;\n\t } else {\n\t data = this.xhr.responseText;\n\t }\n\t } catch (e) {\n\t this.onError(e);\n\t }\n\t if (null != data) {\n\t this.onData(data);\n\t }\n\t};\n\t\n\t/**\n\t * Check if it has XDomainRequest.\n\t *\n\t * @api private\n\t */\n\t\n\tRequest.prototype.hasXDR = function () {\n\t return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n\t};\n\t\n\t/**\n\t * Aborts the request.\n\t *\n\t * @api public\n\t */\n\t\n\tRequest.prototype.abort = function () {\n\t this.cleanup();\n\t};\n\t\n\t/**\n\t * Aborts pending requests when unloading the window. This is needed to prevent\n\t * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n\t * emitted.\n\t */\n\t\n\tRequest.requestsCount = 0;\n\tRequest.requests = {};\n\t\n\tif (typeof document !== 'undefined') {\n\t if (typeof attachEvent === 'function') {\n\t attachEvent('onunload', unloadHandler);\n\t } else if (typeof addEventListener === 'function') {\n\t var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';\n\t addEventListener(terminationEvent, unloadHandler, false);\n\t }\n\t}\n\t\n\tfunction unloadHandler () {\n\t for (var i in Request.requests) {\n\t if (Request.requests.hasOwnProperty(i)) {\n\t Request.requests[i].abort();\n\t }\n\t }\n\t}\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Transport = __webpack_require__(17);\n\tvar parseqs = __webpack_require__(26);\n\tvar parser = __webpack_require__(18);\n\tvar inherit = __webpack_require__(27);\n\tvar yeast = __webpack_require__(28);\n\tvar debug = __webpack_require__(3)('engine.io-client:polling');\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = Polling;\n\t\n\t/**\n\t * Is XHR2 supported?\n\t */\n\t\n\tvar hasXHR2 = (function () {\n\t var XMLHttpRequest = __webpack_require__(13);\n\t var xhr = new XMLHttpRequest({ xdomain: false });\n\t return null != xhr.responseType;\n\t})();\n\t\n\t/**\n\t * Polling interface.\n\t *\n\t * @param {Object} opts\n\t * @api private\n\t */\n\t\n\tfunction Polling (opts) {\n\t var forceBase64 = (opts && opts.forceBase64);\n\t if (!hasXHR2 || forceBase64) {\n\t this.supportsBinary = false;\n\t }\n\t Transport.call(this, opts);\n\t}\n\t\n\t/**\n\t * Inherits from Transport.\n\t */\n\t\n\tinherit(Polling, Transport);\n\t\n\t/**\n\t * Transport name.\n\t */\n\t\n\tPolling.prototype.name = 'polling';\n\t\n\t/**\n\t * Opens the socket (triggers polling). We write a PING message to determine\n\t * when the transport is open.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.doOpen = function () {\n\t this.poll();\n\t};\n\t\n\t/**\n\t * Pauses polling.\n\t *\n\t * @param {Function} callback upon buffers are flushed and transport is paused\n\t * @api private\n\t */\n\t\n\tPolling.prototype.pause = function (onPause) {\n\t var self = this;\n\t\n\t this.readyState = 'pausing';\n\t\n\t function pause () {\n\t\n\t self.readyState = 'paused';\n\t onPause();\n\t }\n\t\n\t if (this.polling || !this.writable) {\n\t var total = 0;\n\t\n\t if (this.polling) {\n\t\n\t total++;\n\t this.once('pollComplete', function () {\n\t\n\t --total || pause();\n\t });\n\t }\n\t\n\t if (!this.writable) {\n\t\n\t total++;\n\t this.once('drain', function () {\n\t\n\t --total || pause();\n\t });\n\t }\n\t } else {\n\t pause();\n\t }\n\t};\n\t\n\t/**\n\t * Starts polling cycle.\n\t *\n\t * @api public\n\t */\n\t\n\tPolling.prototype.poll = function () {\n\t\n\t this.polling = true;\n\t this.doPoll();\n\t this.emit('poll');\n\t};\n\t\n\t/**\n\t * Overloads onData to detect payloads.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.onData = function (data) {\n\t var self = this;\n\t\n\t var callback = function (packet, index, total) {\n\t // if its the first message we consider the transport open\n\t if ('opening' === self.readyState) {\n\t self.onOpen();\n\t }\n\t\n\t // if its a close packet, we close the ongoing requests\n\t if ('close' === packet.type) {\n\t self.onClose();\n\t return false;\n\t }\n\t\n\t // otherwise bypass onData and handle the message\n\t self.onPacket(packet);\n\t };\n\t\n\t // decode payload\n\t parser.decodePayload(data, this.socket.binaryType, callback);\n\t\n\t // if an event did not trigger closing\n\t if ('closed' !== this.readyState) {\n\t // if we got data we're not polling\n\t this.polling = false;\n\t this.emit('pollComplete');\n\t\n\t if ('open' === this.readyState) {\n\t this.poll();\n\t } else {\n\t\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * For polling, send a close packet.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.doClose = function () {\n\t var self = this;\n\t\n\t function close () {\n\t\n\t self.write([{ type: 'close' }]);\n\t }\n\t\n\t if ('open' === this.readyState) {\n\t\n\t close();\n\t } else {\n\t // in case we're trying to close while\n\t // handshaking is in progress (GH-164)\n\t\n\t this.once('open', close);\n\t }\n\t};\n\t\n\t/**\n\t * Writes a packets payload.\n\t *\n\t * @param {Array} data packets\n\t * @param {Function} drain callback\n\t * @api private\n\t */\n\t\n\tPolling.prototype.write = function (packets) {\n\t var self = this;\n\t this.writable = false;\n\t var callbackfn = function () {\n\t self.writable = true;\n\t self.emit('drain');\n\t };\n\t\n\t parser.encodePayload(packets, this.supportsBinary, function (data) {\n\t self.doWrite(data, callbackfn);\n\t });\n\t};\n\t\n\t/**\n\t * Generates uri for connection.\n\t *\n\t * @api private\n\t */\n\t\n\tPolling.prototype.uri = function () {\n\t var query = this.query || {};\n\t var schema = this.secure ? 'https' : 'http';\n\t var port = '';\n\t\n\t // cache busting is forced\n\t if (false !== this.timestampRequests) {\n\t query[this.timestampParam] = yeast();\n\t }\n\t\n\t if (!this.supportsBinary && !query.sid) {\n\t query.b64 = 1;\n\t }\n\t\n\t query = parseqs.encode(query);\n\t\n\t // avoid port if default for schema\n\t if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n\t ('http' === schema && Number(this.port) !== 80))) {\n\t port = ':' + this.port;\n\t }\n\t\n\t // prepend ? to query\n\t if (query.length) {\n\t query = '?' + query;\n\t }\n\t\n\t var ipv6 = this.hostname.indexOf(':') !== -1;\n\t return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n\t};\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar parser = __webpack_require__(18);\n\tvar Emitter = __webpack_require__(5);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = Transport;\n\t\n\t/**\n\t * Transport abstract constructor.\n\t *\n\t * @param {Object} options.\n\t * @api private\n\t */\n\t\n\tfunction Transport (opts) {\n\t this.path = opts.path;\n\t this.hostname = opts.hostname;\n\t this.port = opts.port;\n\t this.secure = opts.secure;\n\t this.query = opts.query;\n\t this.timestampParam = opts.timestampParam;\n\t this.timestampRequests = opts.timestampRequests;\n\t this.readyState = '';\n\t this.agent = opts.agent || false;\n\t this.socket = opts.socket;\n\t this.enablesXDR = opts.enablesXDR;\n\t this.withCredentials = opts.withCredentials;\n\t\n\t // SSL options for Node.js client\n\t this.pfx = opts.pfx;\n\t this.key = opts.key;\n\t this.passphrase = opts.passphrase;\n\t this.cert = opts.cert;\n\t this.ca = opts.ca;\n\t this.ciphers = opts.ciphers;\n\t this.rejectUnauthorized = opts.rejectUnauthorized;\n\t this.forceNode = opts.forceNode;\n\t\n\t // results of ReactNative environment detection\n\t this.isReactNative = opts.isReactNative;\n\t\n\t // other options for Node.js client\n\t this.extraHeaders = opts.extraHeaders;\n\t this.localAddress = opts.localAddress;\n\t}\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Transport.prototype);\n\t\n\t/**\n\t * Emits an error.\n\t *\n\t * @param {String} str\n\t * @return {Transport} for chaining\n\t * @api public\n\t */\n\t\n\tTransport.prototype.onError = function (msg, desc) {\n\t var err = new Error(msg);\n\t err.type = 'TransportError';\n\t err.description = desc;\n\t this.emit('error', err);\n\t return this;\n\t};\n\t\n\t/**\n\t * Opens the transport.\n\t *\n\t * @api public\n\t */\n\t\n\tTransport.prototype.open = function () {\n\t if ('closed' === this.readyState || '' === this.readyState) {\n\t this.readyState = 'opening';\n\t this.doOpen();\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Closes the transport.\n\t *\n\t * @api private\n\t */\n\t\n\tTransport.prototype.close = function () {\n\t if ('opening' === this.readyState || 'open' === this.readyState) {\n\t this.doClose();\n\t this.onClose();\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends multiple packets.\n\t *\n\t * @param {Array} packets\n\t * @api private\n\t */\n\t\n\tTransport.prototype.send = function (packets) {\n\t if ('open' === this.readyState) {\n\t this.write(packets);\n\t } else {\n\t throw new Error('Transport not open');\n\t }\n\t};\n\t\n\t/**\n\t * Called upon open\n\t *\n\t * @api private\n\t */\n\t\n\tTransport.prototype.onOpen = function () {\n\t this.readyState = 'open';\n\t this.writable = true;\n\t this.emit('open');\n\t};\n\t\n\t/**\n\t * Called with data.\n\t *\n\t * @param {String} data\n\t * @api private\n\t */\n\t\n\tTransport.prototype.onData = function (data) {\n\t var packet = parser.decodePacket(data, this.socket.binaryType);\n\t this.onPacket(packet);\n\t};\n\t\n\t/**\n\t * Called with a decoded packet.\n\t */\n\t\n\tTransport.prototype.onPacket = function (packet) {\n\t this.emit('packet', packet);\n\t};\n\t\n\t/**\n\t * Called upon close.\n\t *\n\t * @api private\n\t */\n\t\n\tTransport.prototype.onClose = function () {\n\t this.readyState = 'closed';\n\t this.emit('close');\n\t};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar keys = __webpack_require__(19);\n\tvar hasBinary = __webpack_require__(20);\n\tvar sliceBuffer = __webpack_require__(21);\n\tvar after = __webpack_require__(22);\n\tvar utf8 = __webpack_require__(23);\n\t\n\tvar base64encoder;\n\tif (typeof ArrayBuffer !== 'undefined') {\n\t base64encoder = __webpack_require__(24);\n\t}\n\t\n\t/**\n\t * Check if we are running an android browser. That requires us to use\n\t * ArrayBuffer with polling transports...\n\t *\n\t * http://ghinda.net/jpeg-blob-ajax-android/\n\t */\n\t\n\tvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\t\n\t/**\n\t * Check if we are running in PhantomJS.\n\t * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n\t * https://github.com/ariya/phantomjs/issues/11395\n\t * @type boolean\n\t */\n\tvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\t\n\t/**\n\t * When true, avoids using Blobs to encode payloads.\n\t * @type boolean\n\t */\n\tvar dontSendBlobs = isAndroid || isPhantomJS;\n\t\n\t/**\n\t * Current protocol version.\n\t */\n\t\n\texports.protocol = 3;\n\t\n\t/**\n\t * Packet types.\n\t */\n\t\n\tvar packets = exports.packets = {\n\t open: 0 // non-ws\n\t , close: 1 // non-ws\n\t , ping: 2\n\t , pong: 3\n\t , message: 4\n\t , upgrade: 5\n\t , noop: 6\n\t};\n\t\n\tvar packetslist = keys(packets);\n\t\n\t/**\n\t * Premade error packet.\n\t */\n\t\n\tvar err = { type: 'error', data: 'parser error' };\n\t\n\t/**\n\t * Create a blob api even for blob builder when vendor prefixes exist\n\t */\n\t\n\tvar Blob = __webpack_require__(25);\n\t\n\t/**\n\t * Encodes a packet.\n\t *\n\t * <packet type id> [ <data> ]\n\t *\n\t * Example:\n\t *\n\t * 5hello world\n\t * 3\n\t * 4\n\t *\n\t * Binary is encoded in an identical principle\n\t *\n\t * @api private\n\t */\n\t\n\texports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n\t if (typeof supportsBinary === 'function') {\n\t callback = supportsBinary;\n\t supportsBinary = false;\n\t }\n\t\n\t if (typeof utf8encode === 'function') {\n\t callback = utf8encode;\n\t utf8encode = null;\n\t }\n\t\n\t var data = (packet.data === undefined)\n\t ? undefined\n\t : packet.data.buffer || packet.data;\n\t\n\t if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n\t return encodeArrayBuffer(packet, supportsBinary, callback);\n\t } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n\t return encodeBlob(packet, supportsBinary, callback);\n\t }\n\t\n\t // might be an object with { base64: true, data: dataAsBase64String }\n\t if (data && data.base64) {\n\t return encodeBase64Object(packet, callback);\n\t }\n\t\n\t // Sending data as a utf-8 string\n\t var encoded = packets[packet.type];\n\t\n\t // data fragment is optional\n\t if (undefined !== packet.data) {\n\t encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n\t }\n\t\n\t return callback('' + encoded);\n\t\n\t};\n\t\n\tfunction encodeBase64Object(packet, callback) {\n\t // packet data is an object { base64: true, data: dataAsBase64String }\n\t var message = 'b' + exports.packets[packet.type] + packet.data.data;\n\t return callback(message);\n\t}\n\t\n\t/**\n\t * Encode packet helpers for binary types\n\t */\n\t\n\tfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n\t if (!supportsBinary) {\n\t return exports.encodeBase64Packet(packet, callback);\n\t }\n\t\n\t var data = packet.data;\n\t var contentArray = new Uint8Array(data);\n\t var resultBuffer = new Uint8Array(1 + data.byteLength);\n\t\n\t resultBuffer[0] = packets[packet.type];\n\t for (var i = 0; i < contentArray.length; i++) {\n\t resultBuffer[i+1] = contentArray[i];\n\t }\n\t\n\t return callback(resultBuffer.buffer);\n\t}\n\t\n\tfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n\t if (!supportsBinary) {\n\t return exports.encodeBase64Packet(packet, callback);\n\t }\n\t\n\t var fr = new FileReader();\n\t fr.onload = function() {\n\t exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n\t };\n\t return fr.readAsArrayBuffer(packet.data);\n\t}\n\t\n\tfunction encodeBlob(packet, supportsBinary, callback) {\n\t if (!supportsBinary) {\n\t return exports.encodeBase64Packet(packet, callback);\n\t }\n\t\n\t if (dontSendBlobs) {\n\t return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n\t }\n\t\n\t var length = new Uint8Array(1);\n\t length[0] = packets[packet.type];\n\t var blob = new Blob([length.buffer, packet.data]);\n\t\n\t return callback(blob);\n\t}\n\t\n\t/**\n\t * Encodes a packet with binary data in a base64 string\n\t *\n\t * @param {Object} packet, has `type` and `data`\n\t * @return {String} base64 encoded message\n\t */\n\t\n\texports.encodeBase64Packet = function(packet, callback) {\n\t var message = 'b' + exports.packets[packet.type];\n\t if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n\t var fr = new FileReader();\n\t fr.onload = function() {\n\t var b64 = fr.result.split(',')[1];\n\t callback(message + b64);\n\t };\n\t return fr.readAsDataURL(packet.data);\n\t }\n\t\n\t var b64data;\n\t try {\n\t b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n\t } catch (e) {\n\t // iPhone Safari doesn't let you apply with typed arrays\n\t var typed = new Uint8Array(packet.data);\n\t var basic = new Array(typed.length);\n\t for (var i = 0; i < typed.length; i++) {\n\t basic[i] = typed[i];\n\t }\n\t b64data = String.fromCharCode.apply(null, basic);\n\t }\n\t message += btoa(b64data);\n\t return callback(message);\n\t};\n\t\n\t/**\n\t * Decodes a packet. Changes format to Blob if requested.\n\t *\n\t * @return {Object} with `type` and `data` (if any)\n\t * @api private\n\t */\n\t\n\texports.decodePacket = function (data, binaryType, utf8decode) {\n\t if (data === undefined) {\n\t return err;\n\t }\n\t // String data\n\t if (typeof data === 'string') {\n\t if (data.charAt(0) === 'b') {\n\t return exports.decodeBase64Packet(data.substr(1), binaryType);\n\t }\n\t\n\t if (utf8decode) {\n\t data = tryDecode(data);\n\t if (data === false) {\n\t return err;\n\t }\n\t }\n\t var type = data.charAt(0);\n\t\n\t if (Number(type) != type || !packetslist[type]) {\n\t return err;\n\t }\n\t\n\t if (data.length > 1) {\n\t return { type: packetslist[type], data: data.substring(1) };\n\t } else {\n\t return { type: packetslist[type] };\n\t }\n\t }\n\t\n\t var asArray = new Uint8Array(data);\n\t var type = asArray[0];\n\t var rest = sliceBuffer(data, 1);\n\t if (Blob && binaryType === 'blob') {\n\t rest = new Blob([rest]);\n\t }\n\t return { type: packetslist[type], data: rest };\n\t};\n\t\n\tfunction tryDecode(data) {\n\t try {\n\t data = utf8.decode(data, { strict: false });\n\t } catch (e) {\n\t return false;\n\t }\n\t return data;\n\t}\n\t\n\t/**\n\t * Decodes a packet encoded in a base64 string\n\t *\n\t * @param {String} base64 encoded message\n\t * @return {Object} with `type` and `data` (if any)\n\t */\n\t\n\texports.decodeBase64Packet = function(msg, binaryType) {\n\t var type = packetslist[msg.charAt(0)];\n\t if (!base64encoder) {\n\t return { type: type, data: { base64: true, data: msg.substr(1) } };\n\t }\n\t\n\t var data = base64encoder.decode(msg.substr(1));\n\t\n\t if (binaryType === 'blob' && Blob) {\n\t data = new Blob([data]);\n\t }\n\t\n\t return { type: type, data: data };\n\t};\n\t\n\t/**\n\t * Encodes multiple messages (payload).\n\t *\n\t * <length>:data\n\t *\n\t * Example:\n\t *\n\t * 11:hello world2:hi\n\t *\n\t * If any contents are binary, they will be encoded as base64 strings. Base64\n\t * encoded strings are marked with a b before the length specifier\n\t *\n\t * @param {Array} packets\n\t * @api private\n\t */\n\t\n\texports.encodePayload = function (packets, supportsBinary, callback) {\n\t if (typeof supportsBinary === 'function') {\n\t callback = supportsBinary;\n\t supportsBinary = null;\n\t }\n\t\n\t var isBinary = hasBinary(packets);\n\t\n\t if (supportsBinary && isBinary) {\n\t if (Blob && !dontSendBlobs) {\n\t return exports.encodePayloadAsBlob(packets, callback);\n\t }\n\t\n\t return exports.encodePayloadAsArrayBuffer(packets, callback);\n\t }\n\t\n\t if (!packets.length) {\n\t return callback('0:');\n\t }\n\t\n\t function setLengthHeader(message) {\n\t return message.length + ':' + message;\n\t }\n\t\n\t function encodeOne(packet, doneCallback) {\n\t exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n\t doneCallback(null, setLengthHeader(message));\n\t });\n\t }\n\t\n\t map(packets, encodeOne, function(err, results) {\n\t return callback(results.join(''));\n\t });\n\t};\n\t\n\t/**\n\t * Async array map using after\n\t */\n\t\n\tfunction map(ary, each, done) {\n\t var result = new Array(ary.length);\n\t var next = after(ary.length, done);\n\t\n\t var eachWithIndex = function(i, el, cb) {\n\t each(el, function(error, msg) {\n\t result[i] = msg;\n\t cb(error, result);\n\t });\n\t };\n\t\n\t for (var i = 0; i < ary.length; i++) {\n\t eachWithIndex(i, ary[i], next);\n\t }\n\t}\n\t\n\t/*\n\t * Decodes data when a payload is maybe expected. Possible binary contents are\n\t * decoded from their base64 representation\n\t *\n\t * @param {String} data, callback method\n\t * @api public\n\t */\n\t\n\texports.decodePayload = function (data, binaryType, callback) {\n\t if (typeof data !== 'string') {\n\t return exports.decodePayloadAsBinary(data, binaryType, callback);\n\t }\n\t\n\t if (typeof binaryType === 'function') {\n\t callback = binaryType;\n\t binaryType = null;\n\t }\n\t\n\t var packet;\n\t if (data === '') {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t var length = '', n, msg;\n\t\n\t for (var i = 0, l = data.length; i < l; i++) {\n\t var chr = data.charAt(i);\n\t\n\t if (chr !== ':') {\n\t length += chr;\n\t continue;\n\t }\n\t\n\t if (length === '' || (length != (n = Number(length)))) {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t msg = data.substr(i + 1, n);\n\t\n\t if (length != msg.length) {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t if (msg.length) {\n\t packet = exports.decodePacket(msg, binaryType, false);\n\t\n\t if (err.type === packet.type && err.data === packet.data) {\n\t // parser error in individual packet - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t var ret = callback(packet, i + n, l);\n\t if (false === ret) return;\n\t }\n\t\n\t // advance cursor\n\t i += n;\n\t length = '';\n\t }\n\t\n\t if (length !== '') {\n\t // parser error - ignoring payload\n\t return callback(err, 0, 1);\n\t }\n\t\n\t};\n\t\n\t/**\n\t * Encodes multiple messages (payload) as binary.\n\t *\n\t * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n\t * 255><data>\n\t *\n\t * Example:\n\t * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n\t *\n\t * @param {Array} packets\n\t * @return {ArrayBuffer} encoded payload\n\t * @api private\n\t */\n\t\n\texports.encodePayloadAsArrayBuffer = function(packets, callback) {\n\t if (!packets.length) {\n\t return callback(new ArrayBuffer(0));\n\t }\n\t\n\t function encodeOne(packet, doneCallback) {\n\t exports.encodePacket(packet, true, true, function(data) {\n\t return doneCallback(null, data);\n\t });\n\t }\n\t\n\t map(packets, encodeOne, function(err, encodedPackets) {\n\t var totalLength = encodedPackets.reduce(function(acc, p) {\n\t var len;\n\t if (typeof p === 'string'){\n\t len = p.length;\n\t } else {\n\t len = p.byteLength;\n\t }\n\t return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n\t }, 0);\n\t\n\t var resultArray = new Uint8Array(totalLength);\n\t\n\t var bufferIndex = 0;\n\t encodedPackets.forEach(function(p) {\n\t var isString = typeof p === 'string';\n\t var ab = p;\n\t if (isString) {\n\t var view = new Uint8Array(p.length);\n\t for (var i = 0; i < p.length; i++) {\n\t view[i] = p.charCodeAt(i);\n\t }\n\t ab = view.buffer;\n\t }\n\t\n\t if (isString) { // not true binary\n\t resultArray[bufferIndex++] = 0;\n\t } else { // true binary\n\t resultArray[bufferIndex++] = 1;\n\t }\n\t\n\t var lenStr = ab.byteLength.toString();\n\t for (var i = 0; i < lenStr.length; i++) {\n\t resultArray[bufferIndex++] = parseInt(lenStr[i]);\n\t }\n\t resultArray[bufferIndex++] = 255;\n\t\n\t var view = new Uint8Array(ab);\n\t for (var i = 0; i < view.length; i++) {\n\t resultArray[bufferIndex++] = view[i];\n\t }\n\t });\n\t\n\t return callback(resultArray.buffer);\n\t });\n\t};\n\t\n\t/**\n\t * Encode as Blob\n\t */\n\t\n\texports.encodePayloadAsBlob = function(packets, callback) {\n\t function encodeOne(packet, doneCallback) {\n\t exports.encodePacket(packet, true, true, function(encoded) {\n\t var binaryIdentifier = new Uint8Array(1);\n\t binaryIdentifier[0] = 1;\n\t if (typeof encoded === 'string') {\n\t var view = new Uint8Array(encoded.length);\n\t for (var i = 0; i < encoded.length; i++) {\n\t view[i] = encoded.charCodeAt(i);\n\t }\n\t encoded = view.buffer;\n\t binaryIdentifier[0] = 0;\n\t }\n\t\n\t var len = (encoded instanceof ArrayBuffer)\n\t ? encoded.byteLength\n\t : encoded.size;\n\t\n\t var lenStr = len.toString();\n\t var lengthAry = new Uint8Array(lenStr.length + 1);\n\t for (var i = 0; i < lenStr.length; i++) {\n\t lengthAry[i] = parseInt(lenStr[i]);\n\t }\n\t lengthAry[lenStr.length] = 255;\n\t\n\t if (Blob) {\n\t var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n\t doneCallback(null, blob);\n\t }\n\t });\n\t }\n\t\n\t map(packets, encodeOne, function(err, results) {\n\t return callback(new Blob(results));\n\t });\n\t};\n\t\n\t/*\n\t * Decodes data when a payload is maybe expected. Strings are decoded by\n\t * interpreting each byte as a key code for entries marked to start with 0. See\n\t * description of encodePayloadAsBinary\n\t *\n\t * @param {ArrayBuffer} data, callback method\n\t * @api public\n\t */\n\t\n\texports.decodePayloadAsBinary = function (data, binaryType, callback) {\n\t if (typeof binaryType === 'function') {\n\t callback = binaryType;\n\t binaryType = null;\n\t }\n\t\n\t var bufferTail = data;\n\t var buffers = [];\n\t\n\t while (bufferTail.byteLength > 0) {\n\t var tailArray = new Uint8Array(bufferTail);\n\t var isString = tailArray[0] === 0;\n\t var msgLength = '';\n\t\n\t for (var i = 1; ; i++) {\n\t if (tailArray[i] === 255) break;\n\t\n\t // 310 = char length of Number.MAX_VALUE\n\t if (msgLength.length > 310) {\n\t return callback(err, 0, 1);\n\t }\n\t\n\t msgLength += tailArray[i];\n\t }\n\t\n\t bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n\t msgLength = parseInt(msgLength);\n\t\n\t var msg = sliceBuffer(bufferTail, 0, msgLength);\n\t if (isString) {\n\t try {\n\t msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n\t } catch (e) {\n\t // iPhone Safari doesn't let you apply to typed arrays\n\t var typed = new Uint8Array(msg);\n\t msg = '';\n\t for (var i = 0; i < typed.length; i++) {\n\t msg += String.fromCharCode(typed[i]);\n\t }\n\t }\n\t }\n\t\n\t buffers.push(msg);\n\t bufferTail = sliceBuffer(bufferTail, msgLength);\n\t }\n\t\n\t var total = buffers.length;\n\t buffers.forEach(function(buffer, i) {\n\t callback(exports.decodePacket(buffer, binaryType, true), i, total);\n\t });\n\t};\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Gets the keys for an object.\n\t *\n\t * @return {Array} keys\n\t * @api private\n\t */\n\t\n\tmodule.exports = Object.keys || function keys (obj){\n\t var arr = [];\n\t var has = Object.prototype.hasOwnProperty;\n\t\n\t for (var i in obj) {\n\t if (has.call(obj, i)) {\n\t arr.push(i);\n\t }\n\t }\n\t return arr;\n\t};\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* global Blob File */\n\t\n\t/*\n\t * Module requirements.\n\t */\n\t\n\tvar isArray = __webpack_require__(7);\n\t\n\tvar toString = Object.prototype.toString;\n\tvar withNativeBlob = typeof Blob === 'function' ||\n\t typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\n\tvar withNativeFile = typeof File === 'function' ||\n\t typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = hasBinary;\n\t\n\t/**\n\t * Checks for binary data.\n\t *\n\t * Supports Buffer, ArrayBuffer, Blob and File.\n\t *\n\t * @param {Object} anything\n\t * @api public\n\t */\n\t\n\tfunction hasBinary (obj) {\n\t if (!obj || typeof obj !== 'object') {\n\t return false;\n\t }\n\t\n\t if (isArray(obj)) {\n\t for (var i = 0, l = obj.length; i < l; i++) {\n\t if (hasBinary(obj[i])) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t }\n\t\n\t if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n\t (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n\t (withNativeBlob && obj instanceof Blob) ||\n\t (withNativeFile && obj instanceof File)\n\t ) {\n\t return true;\n\t }\n\t\n\t // see: https://github.com/Automattic/has-binary/pull/4\n\t if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n\t return hasBinary(obj.toJSON(), true);\n\t }\n\t\n\t for (var key in obj) {\n\t if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n\t return true;\n\t }\n\t }\n\t\n\t return false;\n\t}\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports) {\n\n\t/**\n\t * An abstraction for slicing an arraybuffer even when\n\t * ArrayBuffer.prototype.slice is not supported\n\t *\n\t * @api public\n\t */\n\t\n\tmodule.exports = function(arraybuffer, start, end) {\n\t var bytes = arraybuffer.byteLength;\n\t start = start || 0;\n\t end = end || bytes;\n\t\n\t if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\t\n\t if (start < 0) { start += bytes; }\n\t if (end < 0) { end += bytes; }\n\t if (end > bytes) { end = bytes; }\n\t\n\t if (start >= bytes || start >= end || bytes === 0) {\n\t return new ArrayBuffer(0);\n\t }\n\t\n\t var abv = new Uint8Array(arraybuffer);\n\t var result = new Uint8Array(end - start);\n\t for (var i = start, ii = 0; i < end; i++, ii++) {\n\t result[ii] = abv[i];\n\t }\n\t return result.buffer;\n\t};\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = after\n\t\n\tfunction after(count, callback, err_cb) {\n\t var bail = false\n\t err_cb = err_cb || noop\n\t proxy.count = count\n\t\n\t return (count === 0) ? callback() : proxy\n\t\n\t function proxy(err, result) {\n\t if (proxy.count <= 0) {\n\t throw new Error('after called too many times')\n\t }\n\t --proxy.count\n\t\n\t // after first error, rest are passed to err_cb\n\t if (err) {\n\t bail = true\n\t callback(err)\n\t // future error callbacks will go to error handler\n\t callback = err_cb\n\t } else if (proxy.count === 0 && !bail) {\n\t callback(null, result)\n\t }\n\t }\n\t}\n\t\n\tfunction noop() {}\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\n\t/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\t\n\tvar stringFromCharCode = String.fromCharCode;\n\t\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2decode(string) {\n\t\tvar output = [];\n\t\tvar counter = 0;\n\t\tvar length = string.length;\n\t\tvar value;\n\t\tvar extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\t\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2encode(array) {\n\t\tvar length = array.length;\n\t\tvar index = -1;\n\t\tvar value;\n\t\tvar output = '';\n\t\twhile (++index < length) {\n\t\t\tvalue = array[index];\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t}\n\t\treturn output;\n\t}\n\t\n\tfunction checkScalarValue(codePoint, strict) {\n\t\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\t\tif (strict) {\n\t\t\t\tthrow Error(\n\t\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t\t' is not a scalar value'\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\t/*--------------------------------------------------------------------------*/\n\t\n\tfunction createByte(codePoint, shift) {\n\t\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n\t}\n\t\n\tfunction encodeCodePoint(codePoint, strict) {\n\t\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\t\treturn stringFromCharCode(codePoint);\n\t\t}\n\t\tvar symbol = '';\n\t\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t\t}\n\t\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\t\tcodePoint = 0xFFFD;\n\t\t\t}\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\t\tsymbol += createByte(codePoint, 12);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\t\treturn symbol;\n\t}\n\t\n\tfunction utf8encode(string, opts) {\n\t\topts = opts || {};\n\t\tvar strict = false !== opts.strict;\n\t\n\t\tvar codePoints = ucs2decode(string);\n\t\tvar length = codePoints.length;\n\t\tvar index = -1;\n\t\tvar codePoint;\n\t\tvar byteString = '';\n\t\twhile (++index < length) {\n\t\t\tcodePoint = codePoints[index];\n\t\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t\t}\n\t\treturn byteString;\n\t}\n\t\n\t/*--------------------------------------------------------------------------*/\n\t\n\tfunction readContinuationByte() {\n\t\tif (byteIndex >= byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\t\n\t\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\t\n\t\tif ((continuationByte & 0xC0) == 0x80) {\n\t\t\treturn continuationByte & 0x3F;\n\t\t}\n\t\n\t\t// If we end up here, it’s not a continuation byte\n\t\tthrow Error('Invalid continuation byte');\n\t}\n\t\n\tfunction decodeSymbol(strict) {\n\t\tvar byte1;\n\t\tvar byte2;\n\t\tvar byte3;\n\t\tvar byte4;\n\t\tvar codePoint;\n\t\n\t\tif (byteIndex > byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\t\n\t\tif (byteIndex == byteCount) {\n\t\t\treturn false;\n\t\t}\n\t\n\t\t// Read first byte\n\t\tbyte1 = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\t\n\t\t// 1-byte sequence (no continuation bytes)\n\t\tif ((byte1 & 0x80) == 0) {\n\t\t\treturn byte1;\n\t\t}\n\t\n\t\t// 2-byte sequence\n\t\tif ((byte1 & 0xE0) == 0xC0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\t\tif (codePoint >= 0x80) {\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\t\n\t\t// 3-byte sequence (may include unpaired surrogates)\n\t\tif ((byte1 & 0xF0) == 0xE0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\t\tif (codePoint >= 0x0800) {\n\t\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\t\n\t\t// 4-byte sequence\n\t\tif ((byte1 & 0xF8) == 0xF0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tbyte4 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t\t(byte3 << 0x06) | byte4;\n\t\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\t\treturn codePoint;\n\t\t\t}\n\t\t}\n\t\n\t\tthrow Error('Invalid UTF-8 detected');\n\t}\n\t\n\tvar byteArray;\n\tvar byteCount;\n\tvar byteIndex;\n\tfunction utf8decode(byteString, opts) {\n\t\topts = opts || {};\n\t\tvar strict = false !== opts.strict;\n\t\n\t\tbyteArray = ucs2decode(byteString);\n\t\tbyteCount = byteArray.length;\n\t\tbyteIndex = 0;\n\t\tvar codePoints = [];\n\t\tvar tmp;\n\t\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\t\tcodePoints.push(tmp);\n\t\t}\n\t\treturn ucs2encode(codePoints);\n\t}\n\t\n\tmodule.exports = {\n\t\tversion: '2.1.2',\n\t\tencode: utf8encode,\n\t\tdecode: utf8decode\n\t};\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports) {\n\n\t/*\n\t * base64-arraybuffer\n\t * https://github.com/niklasvh/base64-arraybuffer\n\t *\n\t * Copyright (c) 2012 Niklas von Hertzen\n\t * Licensed under the MIT license.\n\t */\n\t(function(){\n\t \"use strict\";\n\t\n\t var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\t\n\t // Use a lookup table to find the index.\n\t var lookup = new Uint8Array(256);\n\t for (var i = 0; i < chars.length; i++) {\n\t lookup[chars.charCodeAt(i)] = i;\n\t }\n\t\n\t exports.encode = function(arraybuffer) {\n\t var bytes = new Uint8Array(arraybuffer),\n\t i, len = bytes.length, base64 = \"\";\n\t\n\t for (i = 0; i < len; i+=3) {\n\t base64 += chars[bytes[i] >> 2];\n\t base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n\t base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n\t base64 += chars[bytes[i + 2] & 63];\n\t }\n\t\n\t if ((len % 3) === 2) {\n\t base64 = base64.substring(0, base64.length - 1) + \"=\";\n\t } else if (len % 3 === 1) {\n\t base64 = base64.substring(0, base64.length - 2) + \"==\";\n\t }\n\t\n\t return base64;\n\t };\n\t\n\t exports.decode = function(base64) {\n\t var bufferLength = base64.length * 0.75,\n\t len = base64.length, i, p = 0,\n\t encoded1, encoded2, encoded3, encoded4;\n\t\n\t if (base64[base64.length - 1] === \"=\") {\n\t bufferLength--;\n\t if (base64[base64.length - 2] === \"=\") {\n\t bufferLength--;\n\t }\n\t }\n\t\n\t var arraybuffer = new ArrayBuffer(bufferLength),\n\t bytes = new Uint8Array(arraybuffer);\n\t\n\t for (i = 0; i < len; i+=4) {\n\t encoded1 = lookup[base64.charCodeAt(i)];\n\t encoded2 = lookup[base64.charCodeAt(i+1)];\n\t encoded3 = lookup[base64.charCodeAt(i+2)];\n\t encoded4 = lookup[base64.charCodeAt(i+3)];\n\t\n\t bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n\t bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n\t bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n\t }\n\t\n\t return arraybuffer;\n\t };\n\t})();\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\n\t/**\r\n\t * Create a blob builder even when vendor prefixes exist\r\n\t */\r\n\t\r\n\tvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n\t typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n\t typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n\t typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n\t false;\r\n\t\r\n\t/**\r\n\t * Check if Blob constructor is supported\r\n\t */\r\n\t\r\n\tvar blobSupported = (function() {\r\n\t try {\r\n\t var a = new Blob(['hi']);\r\n\t return a.size === 2;\r\n\t } catch(e) {\r\n\t return false;\r\n\t }\r\n\t})();\r\n\t\r\n\t/**\r\n\t * Check if Blob constructor supports ArrayBufferViews\r\n\t * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n\t */\r\n\t\r\n\tvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n\t try {\r\n\t var b = new Blob([new Uint8Array([1,2])]);\r\n\t return b.size === 2;\r\n\t } catch(e) {\r\n\t return false;\r\n\t }\r\n\t})();\r\n\t\r\n\t/**\r\n\t * Check if BlobBuilder is supported\r\n\t */\r\n\t\r\n\tvar blobBuilderSupported = BlobBuilder\r\n\t && BlobBuilder.prototype.append\r\n\t && BlobBuilder.prototype.getBlob;\r\n\t\r\n\t/**\r\n\t * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n\t * Used by BlobBuilder constructor and old browsers that didn't\r\n\t * support it in the Blob constructor.\r\n\t */\r\n\t\r\n\tfunction mapArrayBufferViews(ary) {\r\n\t return ary.map(function(chunk) {\r\n\t if (chunk.buffer instanceof ArrayBuffer) {\r\n\t var buf = chunk.buffer;\r\n\t\r\n\t // if this is a subarray, make a copy so we only\r\n\t // include the subarray region from the underlying buffer\r\n\t if (chunk.byteLength !== buf.byteLength) {\r\n\t var copy = new Uint8Array(chunk.byteLength);\r\n\t copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n\t buf = copy.buffer;\r\n\t }\r\n\t\r\n\t return buf;\r\n\t }\r\n\t\r\n\t return chunk;\r\n\t });\r\n\t}\r\n\t\r\n\tfunction BlobBuilderConstructor(ary, options) {\r\n\t options = options || {};\r\n\t\r\n\t var bb = new BlobBuilder();\r\n\t mapArrayBufferViews(ary).forEach(function(part) {\r\n\t bb.append(part);\r\n\t });\r\n\t\r\n\t return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n\t};\r\n\t\r\n\tfunction BlobConstructor(ary, options) {\r\n\t return new Blob(mapArrayBufferViews(ary), options || {});\r\n\t};\r\n\t\r\n\tif (typeof Blob !== 'undefined') {\r\n\t BlobBuilderConstructor.prototype = Blob.prototype;\r\n\t BlobConstructor.prototype = Blob.prototype;\r\n\t}\r\n\t\r\n\tmodule.exports = (function() {\r\n\t if (blobSupported) {\r\n\t return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n\t } else if (blobBuilderSupported) {\r\n\t return BlobBuilderConstructor;\r\n\t } else {\r\n\t return undefined;\r\n\t }\r\n\t})();\r\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports) {\n\n\t/**\r\n\t * Compiles a querystring\r\n\t * Returns string representation of the object\r\n\t *\r\n\t * @param {Object}\r\n\t * @api private\r\n\t */\r\n\t\r\n\texports.encode = function (obj) {\r\n\t var str = '';\r\n\t\r\n\t for (var i in obj) {\r\n\t if (obj.hasOwnProperty(i)) {\r\n\t if (str.length) str += '&';\r\n\t str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\r\n\t }\r\n\t }\r\n\t\r\n\t return str;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Parses a simple querystring into an object\r\n\t *\r\n\t * @param {String} qs\r\n\t * @api private\r\n\t */\r\n\t\r\n\texports.decode = function(qs){\r\n\t var qry = {};\r\n\t var pairs = qs.split('&');\r\n\t for (var i = 0, l = pairs.length; i < l; i++) {\r\n\t var pair = pairs[i].split('=');\r\n\t qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\r\n\t }\r\n\t return qry;\r\n\t};\r\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports) {\n\n\t\n\tmodule.exports = function(a, b){\n\t var fn = function(){};\n\t fn.prototype = b.prototype;\n\t a.prototype = new fn;\n\t a.prototype.constructor = a;\n\t};\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n\t , length = 64\n\t , map = {}\n\t , seed = 0\n\t , i = 0\n\t , prev;\n\t\n\t/**\n\t * Return a string representing the specified number.\n\t *\n\t * @param {Number} num The number to convert.\n\t * @returns {String} The string representation of the number.\n\t * @api public\n\t */\n\tfunction encode(num) {\n\t var encoded = '';\n\t\n\t do {\n\t encoded = alphabet[num % length] + encoded;\n\t num = Math.floor(num / length);\n\t } while (num > 0);\n\t\n\t return encoded;\n\t}\n\t\n\t/**\n\t * Return the integer value specified by the given string.\n\t *\n\t * @param {String} str The string to convert.\n\t * @returns {Number} The integer value represented by the string.\n\t * @api public\n\t */\n\tfunction decode(str) {\n\t var decoded = 0;\n\t\n\t for (i = 0; i < str.length; i++) {\n\t decoded = decoded * length + map[str.charAt(i)];\n\t }\n\t\n\t return decoded;\n\t}\n\t\n\t/**\n\t * Yeast: A tiny growing id generator.\n\t *\n\t * @returns {String} A unique id.\n\t * @api public\n\t */\n\tfunction yeast() {\n\t var now = encode(+new Date());\n\t\n\t if (now !== prev) return seed = 0, prev = now;\n\t return now +'.'+ encode(seed++);\n\t}\n\t\n\t//\n\t// Map each character to its index.\n\t//\n\tfor (; i < length; i++) map[alphabet[i]] = i;\n\t\n\t//\n\t// Expose the `yeast`, `encode` and `decode` functions.\n\t//\n\tyeast.encode = encode;\n\tyeast.decode = decode;\n\tmodule.exports = yeast;\n\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {/**\n\t * Module requirements.\n\t */\n\t\n\tvar Polling = __webpack_require__(16);\n\tvar inherit = __webpack_require__(27);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = JSONPPolling;\n\t\n\t/**\n\t * Cached regular expressions.\n\t */\n\t\n\tvar rNewline = /\\n/g;\n\tvar rEscapedNewline = /\\\\n/g;\n\t\n\t/**\n\t * Global JSONP callbacks.\n\t */\n\t\n\tvar callbacks;\n\t\n\t/**\n\t * Noop.\n\t */\n\t\n\tfunction empty () { }\n\t\n\t/**\n\t * Until https://github.com/tc39/proposal-global is shipped.\n\t */\n\tfunction glob () {\n\t return typeof self !== 'undefined' ? self\n\t : typeof window !== 'undefined' ? window\n\t : typeof global !== 'undefined' ? global : {};\n\t}\n\t\n\t/**\n\t * JSONP Polling constructor.\n\t *\n\t * @param {Object} opts.\n\t * @api public\n\t */\n\t\n\tfunction JSONPPolling (opts) {\n\t Polling.call(this, opts);\n\t\n\t this.query = this.query || {};\n\t\n\t // define global callbacks array if not present\n\t // we do this here (lazily) to avoid unneeded global pollution\n\t if (!callbacks) {\n\t // we need to consider multiple engines in the same page\n\t var global = glob();\n\t callbacks = global.___eio = (global.___eio || []);\n\t }\n\t\n\t // callback identifier\n\t this.index = callbacks.length;\n\t\n\t // add callback to jsonp global\n\t var self = this;\n\t callbacks.push(function (msg) {\n\t self.onData(msg);\n\t });\n\t\n\t // append to query string\n\t this.query.j = this.index;\n\t\n\t // prevent spurious errors from being emitted when the window is unloaded\n\t if (typeof addEventListener === 'function') {\n\t addEventListener('beforeunload', function () {\n\t if (self.script) self.script.onerror = empty;\n\t }, false);\n\t }\n\t}\n\t\n\t/**\n\t * Inherits from Polling.\n\t */\n\t\n\tinherit(JSONPPolling, Polling);\n\t\n\t/*\n\t * JSONP only supports binary as base64 encoded strings\n\t */\n\t\n\tJSONPPolling.prototype.supportsBinary = false;\n\t\n\t/**\n\t * Closes the socket.\n\t *\n\t * @api private\n\t */\n\t\n\tJSONPPolling.prototype.doClose = function () {\n\t if (this.script) {\n\t this.script.parentNode.removeChild(this.script);\n\t this.script = null;\n\t }\n\t\n\t if (this.form) {\n\t this.form.parentNode.removeChild(this.form);\n\t this.form = null;\n\t this.iframe = null;\n\t }\n\t\n\t Polling.prototype.doClose.call(this);\n\t};\n\t\n\t/**\n\t * Starts a poll cycle.\n\t *\n\t * @api private\n\t */\n\t\n\tJSONPPolling.prototype.doPoll = function () {\n\t var self = this;\n\t var script = document.createElement('script');\n\t\n\t if (this.script) {\n\t this.script.parentNode.removeChild(this.script);\n\t this.script = null;\n\t }\n\t\n\t script.async = true;\n\t script.src = this.uri();\n\t script.onerror = function (e) {\n\t self.onError('jsonp poll error', e);\n\t };\n\t\n\t var insertAt = document.getElementsByTagName('script')[0];\n\t if (insertAt) {\n\t insertAt.parentNode.insertBefore(script, insertAt);\n\t } else {\n\t (document.head || document.body).appendChild(script);\n\t }\n\t this.script = script;\n\t\n\t var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\t\n\t if (isUAgecko) {\n\t setTimeout(function () {\n\t var iframe = document.createElement('iframe');\n\t document.body.appendChild(iframe);\n\t document.body.removeChild(iframe);\n\t }, 100);\n\t }\n\t};\n\t\n\t/**\n\t * Writes with a hidden iframe.\n\t *\n\t * @param {String} data to send\n\t * @param {Function} called upon flush.\n\t * @api private\n\t */\n\t\n\tJSONPPolling.prototype.doWrite = function (data, fn) {\n\t var self = this;\n\t\n\t if (!this.form) {\n\t var form = document.createElement('form');\n\t var area = document.createElement('textarea');\n\t var id = this.iframeId = 'eio_iframe_' + this.index;\n\t var iframe;\n\t\n\t form.className = 'socketio';\n\t form.style.position = 'absolute';\n\t form.style.top = '-1000px';\n\t form.style.left = '-1000px';\n\t form.target = id;\n\t form.method = 'POST';\n\t form.setAttribute('accept-charset', 'utf-8');\n\t area.name = 'd';\n\t form.appendChild(area);\n\t document.body.appendChild(form);\n\t\n\t this.form = form;\n\t this.area = area;\n\t }\n\t\n\t this.form.action = this.uri();\n\t\n\t function complete () {\n\t initIframe();\n\t fn();\n\t }\n\t\n\t function initIframe () {\n\t if (self.iframe) {\n\t try {\n\t self.form.removeChild(self.iframe);\n\t } catch (e) {\n\t self.onError('jsonp polling iframe removal error', e);\n\t }\n\t }\n\t\n\t try {\n\t // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n\t var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n\t iframe = document.createElement(html);\n\t } catch (e) {\n\t iframe = document.createElement('iframe');\n\t iframe.name = self.iframeId;\n\t iframe.src = 'javascript:0';\n\t }\n\t\n\t iframe.id = self.iframeId;\n\t\n\t self.form.appendChild(iframe);\n\t self.iframe = iframe;\n\t }\n\t\n\t initIframe();\n\t\n\t // escape \\n to prevent it from being converted into \\r\\n by some UAs\n\t // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n\t data = data.replace(rEscapedNewline, '\\\\\\n');\n\t this.area.value = data.replace(rNewline, '\\\\n');\n\t\n\t try {\n\t this.form.submit();\n\t } catch (e) {}\n\t\n\t if (this.iframe.attachEvent) {\n\t this.iframe.onreadystatechange = function () {\n\t if (self.iframe.readyState === 'complete') {\n\t complete();\n\t }\n\t };\n\t } else {\n\t this.iframe.onload = complete;\n\t }\n\t};\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Transport = __webpack_require__(17);\n\tvar parser = __webpack_require__(18);\n\tvar parseqs = __webpack_require__(26);\n\tvar inherit = __webpack_require__(27);\n\tvar yeast = __webpack_require__(28);\n\tvar debug = __webpack_require__(3)('engine.io-client:websocket');\n\t\n\tvar BrowserWebSocket, NodeWebSocket;\n\t\n\tif (typeof WebSocket !== 'undefined') {\n\t BrowserWebSocket = WebSocket;\n\t} else if (typeof self !== 'undefined') {\n\t BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n\t}\n\t\n\tif (typeof window === 'undefined') {\n\t try {\n\t NodeWebSocket = __webpack_require__(31);\n\t } catch (e) { }\n\t}\n\t\n\t/**\n\t * Get either the `WebSocket` or `MozWebSocket` globals\n\t * in the browser or try to resolve WebSocket-compatible\n\t * interface exposed by `ws` for Node-like environment.\n\t */\n\t\n\tvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = WS;\n\t\n\t/**\n\t * WebSocket transport constructor.\n\t *\n\t * @api {Object} connection options\n\t * @api public\n\t */\n\t\n\tfunction WS (opts) {\n\t var forceBase64 = (opts && opts.forceBase64);\n\t if (forceBase64) {\n\t this.supportsBinary = false;\n\t }\n\t this.perMessageDeflate = opts.perMessageDeflate;\n\t this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n\t this.protocols = opts.protocols;\n\t if (!this.usingBrowserWebSocket) {\n\t WebSocketImpl = NodeWebSocket;\n\t }\n\t Transport.call(this, opts);\n\t}\n\t\n\t/**\n\t * Inherits from Transport.\n\t */\n\t\n\tinherit(WS, Transport);\n\t\n\t/**\n\t * Transport name.\n\t *\n\t * @api public\n\t */\n\t\n\tWS.prototype.name = 'websocket';\n\t\n\t/*\n\t * WebSockets support binary\n\t */\n\t\n\tWS.prototype.supportsBinary = true;\n\t\n\t/**\n\t * Opens socket.\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.doOpen = function () {\n\t if (!this.check()) {\n\t // let probe timeout\n\t return;\n\t }\n\t\n\t var uri = this.uri();\n\t var protocols = this.protocols;\n\t var opts = {\n\t agent: this.agent,\n\t perMessageDeflate: this.perMessageDeflate\n\t };\n\t\n\t // SSL options for Node.js client\n\t opts.pfx = this.pfx;\n\t opts.key = this.key;\n\t opts.passphrase = this.passphrase;\n\t opts.cert = this.cert;\n\t opts.ca = this.ca;\n\t opts.ciphers = this.ciphers;\n\t opts.rejectUnauthorized = this.rejectUnauthorized;\n\t if (this.extraHeaders) {\n\t opts.headers = this.extraHeaders;\n\t }\n\t if (this.localAddress) {\n\t opts.localAddress = this.localAddress;\n\t }\n\t\n\t try {\n\t this.ws =\n\t this.usingBrowserWebSocket && !this.isReactNative\n\t ? protocols\n\t ? new WebSocketImpl(uri, protocols)\n\t : new WebSocketImpl(uri)\n\t : new WebSocketImpl(uri, protocols, opts);\n\t } catch (err) {\n\t return this.emit('error', err);\n\t }\n\t\n\t if (this.ws.binaryType === undefined) {\n\t this.supportsBinary = false;\n\t }\n\t\n\t if (this.ws.supports && this.ws.supports.binary) {\n\t this.supportsBinary = true;\n\t this.ws.binaryType = 'nodebuffer';\n\t } else {\n\t this.ws.binaryType = 'arraybuffer';\n\t }\n\t\n\t this.addEventListeners();\n\t};\n\t\n\t/**\n\t * Adds event listeners to the socket\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.addEventListeners = function () {\n\t var self = this;\n\t\n\t this.ws.onopen = function () {\n\t self.onOpen();\n\t };\n\t this.ws.onclose = function () {\n\t self.onClose();\n\t };\n\t this.ws.onmessage = function (ev) {\n\t self.onData(ev.data);\n\t };\n\t this.ws.onerror = function (e) {\n\t self.onError('websocket error', e);\n\t };\n\t};\n\t\n\t/**\n\t * Writes data to socket.\n\t *\n\t * @param {Array} array of packets.\n\t * @api private\n\t */\n\t\n\tWS.prototype.write = function (packets) {\n\t var self = this;\n\t this.writable = false;\n\t\n\t // encodePacket efficient as it uses WS framing\n\t // no need for encodePayload\n\t var total = packets.length;\n\t for (var i = 0, l = total; i < l; i++) {\n\t (function (packet) {\n\t parser.encodePacket(packet, self.supportsBinary, function (data) {\n\t if (!self.usingBrowserWebSocket) {\n\t // always create a new object (GH-437)\n\t var opts = {};\n\t if (packet.options) {\n\t opts.compress = packet.options.compress;\n\t }\n\t\n\t if (self.perMessageDeflate) {\n\t var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n\t if (len < self.perMessageDeflate.threshold) {\n\t opts.compress = false;\n\t }\n\t }\n\t }\n\t\n\t // Sometimes the websocket has already been closed but the browser didn't\n\t // have a chance of informing us about it yet, in that case send will\n\t // throw an error\n\t try {\n\t if (self.usingBrowserWebSocket) {\n\t // TypeError is thrown when passing the second argument on Safari\n\t self.ws.send(data);\n\t } else {\n\t self.ws.send(data, opts);\n\t }\n\t } catch (e) {\n\t\n\t }\n\t\n\t --total || done();\n\t });\n\t })(packets[i]);\n\t }\n\t\n\t function done () {\n\t self.emit('flush');\n\t\n\t // fake drain\n\t // defer to next tick to allow Socket to clear writeBuffer\n\t setTimeout(function () {\n\t self.writable = true;\n\t self.emit('drain');\n\t }, 0);\n\t }\n\t};\n\t\n\t/**\n\t * Called upon close\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.onClose = function () {\n\t Transport.prototype.onClose.call(this);\n\t};\n\t\n\t/**\n\t * Closes socket.\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.doClose = function () {\n\t if (typeof this.ws !== 'undefined') {\n\t this.ws.close();\n\t }\n\t};\n\t\n\t/**\n\t * Generates uri for connection.\n\t *\n\t * @api private\n\t */\n\t\n\tWS.prototype.uri = function () {\n\t var query = this.query || {};\n\t var schema = this.secure ? 'wss' : 'ws';\n\t var port = '';\n\t\n\t // avoid port if default for schema\n\t if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n\t ('ws' === schema && Number(this.port) !== 80))) {\n\t port = ':' + this.port;\n\t }\n\t\n\t // append timestamp to URI\n\t if (this.timestampRequests) {\n\t query[this.timestampParam] = yeast();\n\t }\n\t\n\t // communicate binary support capabilities\n\t if (!this.supportsBinary) {\n\t query.b64 = 1;\n\t }\n\t\n\t query = parseqs.encode(query);\n\t\n\t // prepend ? to query\n\t if (query.length) {\n\t query = '?' + query;\n\t }\n\t\n\t var ipv6 = this.hostname.indexOf(':') !== -1;\n\t return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n\t};\n\t\n\t/**\n\t * Feature detection for WebSocket.\n\t *\n\t * @return {Boolean} whether this transport is available.\n\t * @api public\n\t */\n\t\n\tWS.prototype.check = function () {\n\t return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n\t};\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports) {\n\n\t/* (ignored) */\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports) {\n\n\t\n\tvar indexOf = [].indexOf;\n\t\n\tmodule.exports = function(arr, obj){\n\t if (indexOf) return arr.indexOf(obj);\n\t for (var i = 0; i < arr.length; ++i) {\n\t if (arr[i] === obj) return i;\n\t }\n\t return -1;\n\t};\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar parser = __webpack_require__(4);\n\tvar Emitter = __webpack_require__(5);\n\tvar toArray = __webpack_require__(34);\n\tvar on = __webpack_require__(35);\n\tvar bind = __webpack_require__(36);\n\tvar debug = __webpack_require__(3)('socket.io-client:socket');\n\tvar parseqs = __webpack_require__(26);\n\tvar hasBin = __webpack_require__(20);\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = exports = Socket;\n\t\n\t/**\n\t * Internal events (blacklisted).\n\t * These events can't be emitted by the user.\n\t *\n\t * @api private\n\t */\n\t\n\tvar events = {\n\t connect: 1,\n\t connect_error: 1,\n\t connect_timeout: 1,\n\t connecting: 1,\n\t disconnect: 1,\n\t error: 1,\n\t reconnect: 1,\n\t reconnect_attempt: 1,\n\t reconnect_failed: 1,\n\t reconnect_error: 1,\n\t reconnecting: 1,\n\t ping: 1,\n\t pong: 1\n\t};\n\t\n\t/**\n\t * Shortcut to `Emitter#emit`.\n\t */\n\t\n\tvar emit = Emitter.prototype.emit;\n\t\n\t/**\n\t * `Socket` constructor.\n\t *\n\t * @api public\n\t */\n\t\n\tfunction Socket(io, nsp, opts) {\n\t this.io = io;\n\t this.nsp = nsp;\n\t this.json = this; // compat\n\t this.ids = 0;\n\t this.acks = {};\n\t this.receiveBuffer = [];\n\t this.sendBuffer = [];\n\t this.connected = false;\n\t this.disconnected = true;\n\t this.flags = {};\n\t if (opts && opts.query) {\n\t this.query = opts.query;\n\t }\n\t if (this.io.autoConnect) this.open();\n\t}\n\t\n\t/**\n\t * Mix in `Emitter`.\n\t */\n\t\n\tEmitter(Socket.prototype);\n\t\n\t/**\n\t * Subscribe to open, close and packet events\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.subEvents = function () {\n\t if (this.subs) return;\n\t\n\t var io = this.io;\n\t this.subs = [on(io, 'open', bind(this, 'onopen')), on(io, 'packet', bind(this, 'onpacket')), on(io, 'close', bind(this, 'onclose'))];\n\t};\n\t\n\t/**\n\t * \"Opens\" the socket.\n\t *\n\t * @api public\n\t */\n\t\n\tSocket.prototype.open = Socket.prototype.connect = function () {\n\t if (this.connected) return this;\n\t\n\t this.subEvents();\n\t this.io.open(); // ensure open\n\t if ('open' === this.io.readyState) this.onopen();\n\t this.emit('connecting');\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends a `message` event.\n\t *\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.send = function () {\n\t var args = toArray(arguments);\n\t args.unshift('message');\n\t this.emit.apply(this, args);\n\t return this;\n\t};\n\t\n\t/**\n\t * Override `emit`.\n\t * If the event is in `events`, it's emitted normally.\n\t *\n\t * @param {String} event name\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.emit = function (ev) {\n\t if (events.hasOwnProperty(ev)) {\n\t emit.apply(this, arguments);\n\t return this;\n\t }\n\t\n\t var args = toArray(arguments);\n\t var packet = {\n\t type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n\t data: args\n\t };\n\t\n\t packet.options = {};\n\t packet.options.compress = !this.flags || false !== this.flags.compress;\n\t\n\t // event ack callback\n\t if ('function' === typeof args[args.length - 1]) {\n\t\n\t this.acks[this.ids] = args.pop();\n\t packet.id = this.ids++;\n\t }\n\t\n\t if (this.connected) {\n\t this.packet(packet);\n\t } else {\n\t this.sendBuffer.push(packet);\n\t }\n\t\n\t this.flags = {};\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Sends a packet.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.packet = function (packet) {\n\t packet.nsp = this.nsp;\n\t this.io.packet(packet);\n\t};\n\t\n\t/**\n\t * Called upon engine `open`.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onopen = function () {\n\t\n\t // write connect packet if necessary\n\t if ('/' !== this.nsp) {\n\t if (this.query) {\n\t var query = _typeof(this.query) === 'object' ? parseqs.encode(this.query) : this.query;\n\t\n\t this.packet({ type: parser.CONNECT, query: query });\n\t } else {\n\t this.packet({ type: parser.CONNECT });\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Called upon engine `close`.\n\t *\n\t * @param {String} reason\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onclose = function (reason) {\n\t\n\t this.connected = false;\n\t this.disconnected = true;\n\t delete this.id;\n\t this.emit('disconnect', reason);\n\t};\n\t\n\t/**\n\t * Called with socket packet.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onpacket = function (packet) {\n\t var sameNamespace = packet.nsp === this.nsp;\n\t var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\t\n\t if (!sameNamespace && !rootNamespaceError) return;\n\t\n\t switch (packet.type) {\n\t case parser.CONNECT:\n\t this.onconnect();\n\t break;\n\t\n\t case parser.EVENT:\n\t this.onevent(packet);\n\t break;\n\t\n\t case parser.BINARY_EVENT:\n\t this.onevent(packet);\n\t break;\n\t\n\t case parser.ACK:\n\t this.onack(packet);\n\t break;\n\t\n\t case parser.BINARY_ACK:\n\t this.onack(packet);\n\t break;\n\t\n\t case parser.DISCONNECT:\n\t this.ondisconnect();\n\t break;\n\t\n\t case parser.ERROR:\n\t this.emit('error', packet.data);\n\t break;\n\t }\n\t};\n\t\n\t/**\n\t * Called upon a server event.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onevent = function (packet) {\n\t var args = packet.data || [];\n\t\n\t if (null != packet.id) {\n\t\n\t args.push(this.ack(packet.id));\n\t }\n\t\n\t if (this.connected) {\n\t emit.apply(this, args);\n\t } else {\n\t this.receiveBuffer.push(args);\n\t }\n\t};\n\t\n\t/**\n\t * Produces an ack callback to emit with an event.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.ack = function (id) {\n\t var self = this;\n\t var sent = false;\n\t return function () {\n\t // prevent double callbacks\n\t if (sent) return;\n\t sent = true;\n\t var args = toArray(arguments);\n\t\n\t self.packet({\n\t type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n\t id: id,\n\t data: args\n\t });\n\t };\n\t};\n\t\n\t/**\n\t * Called upon a server acknowlegement.\n\t *\n\t * @param {Object} packet\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onack = function (packet) {\n\t var ack = this.acks[packet.id];\n\t if ('function' === typeof ack) {\n\t\n\t ack.apply(this, packet.data);\n\t delete this.acks[packet.id];\n\t } else {}\n\t};\n\t\n\t/**\n\t * Called upon server connect.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.onconnect = function () {\n\t this.connected = true;\n\t this.disconnected = false;\n\t this.emit('connect');\n\t this.emitBuffered();\n\t};\n\t\n\t/**\n\t * Emit buffered events (received and emitted).\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.emitBuffered = function () {\n\t var i;\n\t for (i = 0; i < this.receiveBuffer.length; i++) {\n\t emit.apply(this, this.receiveBuffer[i]);\n\t }\n\t this.receiveBuffer = [];\n\t\n\t for (i = 0; i < this.sendBuffer.length; i++) {\n\t this.packet(this.sendBuffer[i]);\n\t }\n\t this.sendBuffer = [];\n\t};\n\t\n\t/**\n\t * Called upon server disconnect.\n\t *\n\t * @api private\n\t */\n\t\n\tSocket.prototype.ondisconnect = function () {\n\t\n\t this.destroy();\n\t this.onclose('io server disconnect');\n\t};\n\t\n\t/**\n\t * Called upon forced client/server side disconnections,\n\t * this method ensures the manager stops tracking us and\n\t * that reconnections don't get triggered for this.\n\t *\n\t * @api private.\n\t */\n\t\n\tSocket.prototype.destroy = function () {\n\t if (this.subs) {\n\t // clean subscriptions to avoid reconnections\n\t for (var i = 0; i < this.subs.length; i++) {\n\t this.subs[i].destroy();\n\t }\n\t this.subs = null;\n\t }\n\t\n\t this.io.destroy(this);\n\t};\n\t\n\t/**\n\t * Disconnects the socket manually.\n\t *\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.close = Socket.prototype.disconnect = function () {\n\t if (this.connected) {\n\t\n\t this.packet({ type: parser.DISCONNECT });\n\t }\n\t\n\t // remove socket from pool\n\t this.destroy();\n\t\n\t if (this.connected) {\n\t // fire events\n\t this.onclose('io client disconnect');\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the compress flag.\n\t *\n\t * @param {Boolean} if `true`, compresses the sending data\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.compress = function (compress) {\n\t this.flags.compress = compress;\n\t return this;\n\t};\n\t\n\t/**\n\t * Sets the binary flag\n\t *\n\t * @param {Boolean} whether the emitted data contains binary\n\t * @return {Socket} self\n\t * @api public\n\t */\n\t\n\tSocket.prototype.binary = function (binary) {\n\t this.flags.binary = binary;\n\t return this;\n\t};\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = toArray\n\t\n\tfunction toArray(list, index) {\n\t var array = []\n\t\n\t index = index || 0\n\t\n\t for (var i = index || 0; i < list.length; i++) {\n\t array[i - index] = list[i]\n\t }\n\t\n\t return array\n\t}\n\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports) {\n\n\t\"use strict\";\n\t\n\t/**\n\t * Module exports.\n\t */\n\t\n\tmodule.exports = on;\n\t\n\t/**\n\t * Helper for subscriptions.\n\t *\n\t * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n\t * @param {String} event name\n\t * @param {Function} callback\n\t * @api public\n\t */\n\t\n\tfunction on(obj, ev, fn) {\n\t obj.on(ev, fn);\n\t return {\n\t destroy: function destroy() {\n\t obj.removeListener(ev, fn);\n\t }\n\t };\n\t}\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports) {\n\n\t/**\n\t * Slice reference.\n\t */\n\t\n\tvar slice = [].slice;\n\t\n\t/**\n\t * Bind `obj` to `fn`.\n\t *\n\t * @param {Object} obj\n\t * @param {Function|String} fn or string\n\t * @return {Function}\n\t * @api public\n\t */\n\t\n\tmodule.exports = function(obj, fn){\n\t if ('string' == typeof fn) fn = obj[fn];\n\t if ('function' != typeof fn) throw new Error('bind() requires a function');\n\t var args = slice.call(arguments, 2);\n\t return function(){\n\t return fn.apply(obj, args.concat(slice.call(arguments)));\n\t }\n\t};\n\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports) {\n\n\t\n\t/**\n\t * Expose `Backoff`.\n\t */\n\t\n\tmodule.exports = Backoff;\n\t\n\t/**\n\t * Initialize backoff timer with `opts`.\n\t *\n\t * - `min` initial timeout in milliseconds [100]\n\t * - `max` max timeout [10000]\n\t * - `jitter` [0]\n\t * - `factor` [2]\n\t *\n\t * @param {Object} opts\n\t * @api public\n\t */\n\t\n\tfunction Backoff(opts) {\n\t opts = opts || {};\n\t this.ms = opts.min || 100;\n\t this.max = opts.max || 10000;\n\t this.factor = opts.factor || 2;\n\t this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n\t this.attempts = 0;\n\t}\n\t\n\t/**\n\t * Return the backoff duration.\n\t *\n\t * @return {Number}\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.duration = function(){\n\t var ms = this.ms * Math.pow(this.factor, this.attempts++);\n\t if (this.jitter) {\n\t var rand = Math.random();\n\t var deviation = Math.floor(rand * this.jitter * ms);\n\t ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n\t }\n\t return Math.min(ms, this.max) | 0;\n\t};\n\t\n\t/**\n\t * Reset the number of attempts.\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.reset = function(){\n\t this.attempts = 0;\n\t};\n\t\n\t/**\n\t * Set the minimum duration\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.setMin = function(min){\n\t this.ms = min;\n\t};\n\t\n\t/**\n\t * Set the maximum duration\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.setMax = function(max){\n\t this.max = max;\n\t};\n\t\n\t/**\n\t * Set the jitter\n\t *\n\t * @api public\n\t */\n\t\n\tBackoff.prototype.setJitter = function(jitter){\n\t this.jitter = jitter;\n\t};\n\t\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// socket.io.slim.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 31c6c79423e11e145ab4","\n/**\n * Module dependencies.\n */\n\nvar url = require('./url');\nvar parser = require('socket.io-parser');\nvar Manager = require('./manager');\nvar debug = require('debug')('socket.io-client');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = lookup;\n\n/**\n * Managers cache.\n */\n\nvar cache = exports.managers = {};\n\n/**\n * Looks up an existing `Manager` for multiplexing.\n * If the user summons:\n *\n * `io('http://localhost/a');`\n * `io('http://localhost/b');`\n *\n * We reuse the existing instance based on same scheme/port/host,\n * and we initialize sockets for each namespace.\n *\n * @api public\n */\n\nfunction lookup (uri, opts) {\n if (typeof uri === 'object') {\n opts = uri;\n uri = undefined;\n }\n\n opts = opts || {};\n\n var parsed = url(uri);\n var source = parsed.source;\n var id = parsed.id;\n var path = parsed.path;\n var sameNamespace = cache[id] && path in cache[id].nsps;\n var newConnection = opts.forceNew || opts['force new connection'] ||\n false === opts.multiplex || sameNamespace;\n\n var io;\n\n if (newConnection) {\n\n io = Manager(source, opts);\n } else {\n if (!cache[id]) {\n\n cache[id] = Manager(source, opts);\n }\n io = cache[id];\n }\n if (parsed.query && !opts.query) {\n opts.query = parsed.query;\n }\n return io.socket(parsed.path, opts);\n}\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = parser.protocol;\n\n/**\n * `connect`.\n *\n * @param {String} uri\n * @api public\n */\n\nexports.connect = lookup;\n\n/**\n * Expose constructors for standalone build.\n *\n * @api public\n */\n\nexports.Manager = require('./manager');\nexports.Socket = require('./socket');\n\n\n\n// WEBPACK FOOTER //\n// ./lib/index.js","\n/**\n * Module dependencies.\n */\n\nvar parseuri = require('parseuri');\nvar debug = require('debug')('socket.io-client:url');\n\n/**\n * Module exports.\n */\n\nmodule.exports = url;\n\n/**\n * URL parser.\n *\n * @param {String} url\n * @param {Object} An object meant to mimic window.location.\n * Defaults to window.location.\n * @api public\n */\n\nfunction url (uri, loc) {\n var obj = uri;\n\n // default to window.location\n loc = loc || (typeof location !== 'undefined' && location);\n if (null == uri) uri = loc.protocol + '//' + loc.host;\n\n // relative path support\n if ('string' === typeof uri) {\n if ('/' === uri.charAt(0)) {\n if ('/' === uri.charAt(1)) {\n uri = loc.protocol + uri;\n } else {\n uri = loc.host + uri;\n }\n }\n\n if (!/^(https?|wss?):\\/\\//.test(uri)) {\n\n if ('undefined' !== typeof loc) {\n uri = loc.protocol + '//' + uri;\n } else {\n uri = 'https://' + uri;\n }\n }\n\n // parse\n\n obj = parseuri(uri);\n }\n\n // make sure we treat `localhost:80` and `localhost` equally\n if (!obj.port) {\n if (/^(http|ws)$/.test(obj.protocol)) {\n obj.port = '80';\n } else if (/^(http|ws)s$/.test(obj.protocol)) {\n obj.port = '443';\n }\n }\n\n obj.path = obj.path || '/';\n\n var ipv6 = obj.host.indexOf(':') !== -1;\n var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\n // define unique id\n obj.id = obj.protocol + '://' + host + ':' + obj.port;\n // define href\n obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));\n\n return obj;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/url.js","/**\r\n * Parses an URI\r\n *\r\n * @author Steven Levithan <stevenlevithan.com> (MIT license)\r\n * @api private\r\n */\r\n\r\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\r\n\r\nvar parts = [\r\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\r\n];\r\n\r\nmodule.exports = function parseuri(str) {\r\n var src = str,\r\n b = str.indexOf('['),\r\n e = str.indexOf(']');\r\n\r\n if (b != -1 && e != -1) {\r\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\r\n }\r\n\r\n var m = re.exec(str || ''),\r\n uri = {},\r\n i = 14;\r\n\r\n while (i--) {\r\n uri[parts[i]] = m[i] || '';\r\n }\r\n\r\n if (b != -1 && e != -1) {\r\n uri.source = src;\r\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\r\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\r\n uri.ipv6uri = true;\r\n }\r\n\r\n return uri;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseuri/index.js\n// module id = 2\n// module chunks = 0","\nmodule.exports = function () { return function () {}; };\n\n\n\n// WEBPACK FOOTER //\n// ./support/noop.js","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar binary = require('./binary');\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = 4;\n\n/**\n * Packet types.\n *\n * @api public\n */\n\nexports.types = [\n 'CONNECT',\n 'DISCONNECT',\n 'EVENT',\n 'ACK',\n 'ERROR',\n 'BINARY_EVENT',\n 'BINARY_ACK'\n];\n\n/**\n * Packet type `connect`.\n *\n * @api public\n */\n\nexports.CONNECT = 0;\n\n/**\n * Packet type `disconnect`.\n *\n * @api public\n */\n\nexports.DISCONNECT = 1;\n\n/**\n * Packet type `event`.\n *\n * @api public\n */\n\nexports.EVENT = 2;\n\n/**\n * Packet type `ack`.\n *\n * @api public\n */\n\nexports.ACK = 3;\n\n/**\n * Packet type `error`.\n *\n * @api public\n */\n\nexports.ERROR = 4;\n\n/**\n * Packet type 'binary event'\n *\n * @api public\n */\n\nexports.BINARY_EVENT = 5;\n\n/**\n * Packet type `binary ack`. For acks with binary arguments.\n *\n * @api public\n */\n\nexports.BINARY_ACK = 6;\n\n/**\n * Encoder constructor.\n *\n * @api public\n */\n\nexports.Encoder = Encoder;\n\n/**\n * Decoder constructor.\n *\n * @api public\n */\n\nexports.Decoder = Decoder;\n\n/**\n * A socket.io Encoder instance\n *\n * @api public\n */\n\nfunction Encoder() {}\n\nvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\n/**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n * @param {Function} callback - function to handle encodings (likely engine.write)\n * @return Calls callback with Array of encodings\n * @api public\n */\n\nEncoder.prototype.encode = function(obj, callback){\n\n\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n encodeAsBinary(obj, callback);\n } else {\n var encoding = encodeAsString(obj);\n callback([encoding]);\n }\n};\n\n/**\n * Encode packet as string.\n *\n * @param {Object} packet\n * @return {String} encoded\n * @api private\n */\n\nfunction encodeAsString(obj) {\n\n // first is type\n var str = '' + obj.type;\n\n // attachments if we have them\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n str += obj.attachments + '-';\n }\n\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && '/' !== obj.nsp) {\n str += obj.nsp + ',';\n }\n\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n\n // json data\n if (null != obj.data) {\n var payload = tryStringify(obj.data);\n if (payload !== false) {\n str += payload;\n } else {\n return ERROR_PACKET;\n }\n }\n\n\n return str;\n}\n\nfunction tryStringify(str) {\n try {\n return JSON.stringify(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n *\n * @param {Object} packet\n * @return {Buffer} encoded\n * @api private\n */\n\nfunction encodeAsBinary(obj, callback) {\n\n function writeEncoding(bloblessData) {\n var deconstruction = binary.deconstructPacket(bloblessData);\n var pack = encodeAsString(deconstruction.packet);\n var buffers = deconstruction.buffers;\n\n buffers.unshift(pack); // add packet info to beginning of data list\n callback(buffers); // write all the buffers\n }\n\n binary.removeBlobs(obj, writeEncoding);\n}\n\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n * @api public\n */\n\nfunction Decoder() {\n this.reconstructor = null;\n}\n\n/**\n * Mix in `Emitter` with Decoder.\n */\n\nEmitter(Decoder.prototype);\n\n/**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n * @return {Object} packet\n * @api public\n */\n\nDecoder.prototype.add = function(obj) {\n var packet;\n if (typeof obj === 'string') {\n packet = decodeString(obj);\n if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n\n // no attachments, labeled binary but no binary data to follow\n if (this.reconstructor.reconPack.attachments === 0) {\n this.emit('decoded', packet);\n }\n } else { // non-binary full packet\n this.emit('decoded', packet);\n }\n } else if (isBuf(obj) || obj.base64) { // raw binary data\n if (!this.reconstructor) {\n throw new Error('got binary data when not reconstructing a packet');\n } else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) { // received final buffer\n this.reconstructor = null;\n this.emit('decoded', packet);\n }\n }\n } else {\n throw new Error('Unknown type: ' + obj);\n }\n};\n\n/**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n * @api private\n */\n\nfunction decodeString(str) {\n var i = 0;\n // look up type\n var p = {\n type: Number(str.charAt(0))\n };\n\n if (null == exports.types[p.type]) {\n return error('unknown packet type ' + p.type);\n }\n\n // look up attachments if type binary\n if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n var buf = '';\n while (str.charAt(++i) !== '-') {\n buf += str.charAt(i);\n if (i == str.length) break;\n }\n if (buf != Number(buf) || str.charAt(i) !== '-') {\n throw new Error('Illegal attachments');\n }\n p.attachments = Number(buf);\n }\n\n // look up namespace (if any)\n if ('/' === str.charAt(i + 1)) {\n p.nsp = '';\n while (++i) {\n var c = str.charAt(i);\n if (',' === c) break;\n p.nsp += c;\n if (i === str.length) break;\n }\n } else {\n p.nsp = '/';\n }\n\n // look up id\n var next = str.charAt(i + 1);\n if ('' !== next && Number(next) == next) {\n p.id = '';\n while (++i) {\n var c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n p.id += str.charAt(i);\n if (i === str.length) break;\n }\n p.id = Number(p.id);\n }\n\n // look up json data\n if (str.charAt(++i)) {\n var payload = tryParse(str.substr(i));\n var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n if (isPayloadValid) {\n p.data = payload;\n } else {\n return error('invalid payload');\n }\n }\n\n\n return p;\n}\n\nfunction tryParse(str) {\n try {\n return JSON.parse(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Deallocates a parser's resources\n *\n * @api public\n */\n\nDecoder.prototype.destroy = function() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n }\n};\n\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n * @api private\n */\n\nfunction BinaryReconstructor(packet) {\n this.reconPack = packet;\n this.buffers = [];\n}\n\n/**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n * @api private\n */\n\nBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n};\n\n/**\n * Cleans up binary packet reconstruction variables.\n *\n * @api private\n */\n\nBinaryReconstructor.prototype.finishedReconstruction = function() {\n this.reconPack = null;\n this.buffers = [];\n};\n\nfunction error(msg) {\n return {\n type: exports.ERROR,\n data: 'parser error: ' + msg\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/index.js\n// module id = 4\n// module chunks = 0","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-emitter/index.js\n// module id = 5\n// module chunks = 0","/*global Blob,File*/\n\n/**\n * Module requirements\n */\n\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\nvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\n/**\n * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n * Anything with blobs or files should be fed through removeBlobs before coming\n * here.\n *\n * @param {Object} packet - socket.io event packet\n * @return {Object} with deconstructed packet and list of buffers\n * @api public\n */\n\nexports.deconstructPacket = function(packet) {\n var buffers = [];\n var packetData = packet.data;\n var pack = packet;\n pack.data = _deconstructPacket(packetData, buffers);\n pack.attachments = buffers.length; // number of binary 'attachments'\n return {packet: pack, buffers: buffers};\n};\n\nfunction _deconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (isBuf(data)) {\n var placeholder = { _placeholder: true, num: buffers.length };\n buffers.push(data);\n return placeholder;\n } else if (isArray(data)) {\n var newData = new Array(data.length);\n for (var i = 0; i < data.length; i++) {\n newData[i] = _deconstructPacket(data[i], buffers);\n }\n return newData;\n } else if (typeof data === 'object' && !(data instanceof Date)) {\n var newData = {};\n for (var key in data) {\n newData[key] = _deconstructPacket(data[key], buffers);\n }\n return newData;\n }\n return data;\n}\n\n/**\n * Reconstructs a binary packet from its placeholder packet and buffers\n *\n * @param {Object} packet - event packet with placeholders\n * @param {Array} buffers - binary buffers to put in placeholder positions\n * @return {Object} reconstructed packet\n * @api public\n */\n\nexports.reconstructPacket = function(packet, buffers) {\n packet.data = _reconstructPacket(packet.data, buffers);\n packet.attachments = undefined; // no longer useful\n return packet;\n};\n\nfunction _reconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (data && data._placeholder) {\n return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n } else if (isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n data[i] = _reconstructPacket(data[i], buffers);\n }\n } else if (typeof data === 'object') {\n for (var key in data) {\n data[key] = _reconstructPacket(data[key], buffers);\n }\n }\n\n return data;\n}\n\n/**\n * Asynchronously removes Blobs or Files from data via\n * FileReader's readAsArrayBuffer method. Used before encoding\n * data as msgpack. Calls callback with the blobless data.\n *\n * @param {Object} data\n * @param {Function} callback\n * @api private\n */\n\nexports.removeBlobs = function(data, callback) {\n function _removeBlobs(obj, curKey, containingObject) {\n if (!obj) return obj;\n\n // convert any blob\n if ((withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)) {\n pendingBlobs++;\n\n // async filereader\n var fileReader = new FileReader();\n fileReader.onload = function() { // this.result == arraybuffer\n if (containingObject) {\n containingObject[curKey] = this.result;\n }\n else {\n bloblessData = this.result;\n }\n\n // if nothing pending its callback time\n if(! --pendingBlobs) {\n callback(bloblessData);\n }\n };\n\n fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n } else if (isArray(obj)) { // handle array\n for (var i = 0; i < obj.length; i++) {\n _removeBlobs(obj[i], i, obj);\n }\n } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n for (var key in obj) {\n _removeBlobs(obj[key], key, obj);\n }\n }\n }\n\n var pendingBlobs = 0;\n var bloblessData = data;\n _removeBlobs(bloblessData);\n if (!pendingBlobs) {\n callback(bloblessData);\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/binary.js\n// module id = 6\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/isarray/index.js\n// module id = 7\n// module chunks = 0","\nmodule.exports = isBuf;\n\nvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\nvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\nvar isView = function (obj) {\n return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n};\n\n/**\n * Returns true if obj is a buffer or an arraybuffer.\n *\n * @api private\n */\n\nfunction isBuf(obj) {\n return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/socket.io-parser/is-buffer.js\n// module id = 8\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar eio = require('engine.io-client');\nvar Socket = require('./socket');\nvar Emitter = require('component-emitter');\nvar parser = require('socket.io-parser');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:manager');\nvar indexOf = require('indexof');\nvar Backoff = require('backo2');\n\n/**\n * IE6+ hasOwnProperty\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Module exports\n */\n\nmodule.exports = Manager;\n\n/**\n * `Manager` constructor.\n *\n * @param {String} engine instance or engine uri/opts\n * @param {Object} options\n * @api public\n */\n\nfunction Manager (uri, opts) {\n if (!(this instanceof Manager)) return new Manager(uri, opts);\n if (uri && ('object' === typeof uri)) {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n\n opts.path = opts.path || '/socket.io';\n this.nsps = {};\n this.subs = [];\n this.opts = opts;\n this.reconnection(opts.reconnection !== false);\n this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n this.reconnectionDelay(opts.reconnectionDelay || 1000);\n this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n this.randomizationFactor(opts.randomizationFactor || 0.5);\n this.backoff = new Backoff({\n min: this.reconnectionDelay(),\n max: this.reconnectionDelayMax(),\n jitter: this.randomizationFactor()\n });\n this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n this.readyState = 'closed';\n this.uri = uri;\n this.connecting = [];\n this.lastPing = null;\n this.encoding = false;\n this.packetBuffer = [];\n var _parser = opts.parser || parser;\n this.encoder = new _parser.Encoder();\n this.decoder = new _parser.Decoder();\n this.autoConnect = opts.autoConnect !== false;\n if (this.autoConnect) this.open();\n}\n\n/**\n * Propagate given event to sockets and emit on `this`\n *\n * @api private\n */\n\nManager.prototype.emitAll = function () {\n this.emit.apply(this, arguments);\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n }\n }\n};\n\n/**\n * Update `socket.id` of all sockets\n *\n * @api private\n */\n\nManager.prototype.updateSocketIds = function () {\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].id = this.generateId(nsp);\n }\n }\n};\n\n/**\n * generate `socket.id` for the given `nsp`\n *\n * @param {String} nsp\n * @return {String}\n * @api private\n */\n\nManager.prototype.generateId = function (nsp) {\n return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;\n};\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Manager.prototype);\n\n/**\n * Sets the `reconnection` config.\n *\n * @param {Boolean} true/false if it should automatically reconnect\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnection = function (v) {\n if (!arguments.length) return this._reconnection;\n this._reconnection = !!v;\n return this;\n};\n\n/**\n * Sets the reconnection attempts config.\n *\n * @param {Number} max reconnection attempts before giving up\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionAttempts = function (v) {\n if (!arguments.length) return this._reconnectionAttempts;\n this._reconnectionAttempts = v;\n return this;\n};\n\n/**\n * Sets the delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelay = function (v) {\n if (!arguments.length) return this._reconnectionDelay;\n this._reconnectionDelay = v;\n this.backoff && this.backoff.setMin(v);\n return this;\n};\n\nManager.prototype.randomizationFactor = function (v) {\n if (!arguments.length) return this._randomizationFactor;\n this._randomizationFactor = v;\n this.backoff && this.backoff.setJitter(v);\n return this;\n};\n\n/**\n * Sets the maximum delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelayMax = function (v) {\n if (!arguments.length) return this._reconnectionDelayMax;\n this._reconnectionDelayMax = v;\n this.backoff && this.backoff.setMax(v);\n return this;\n};\n\n/**\n * Sets the connection timeout. `false` to disable\n *\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.timeout = function (v) {\n if (!arguments.length) return this._timeout;\n this._timeout = v;\n return this;\n};\n\n/**\n * Starts trying to reconnect if reconnection is enabled and we have not\n * started reconnecting yet\n *\n * @api private\n */\n\nManager.prototype.maybeReconnectOnOpen = function () {\n // Only try to reconnect if it's the first time we're connecting\n if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n // keeps reconnection from firing twice for the same reconnection loop\n this.reconnect();\n }\n};\n\n/**\n * Sets the current transport `socket`.\n *\n * @param {Function} optional, callback\n * @return {Manager} self\n * @api public\n */\n\nManager.prototype.open =\nManager.prototype.connect = function (fn, opts) {\n\n if (~this.readyState.indexOf('open')) return this;\n\n\n this.engine = eio(this.uri, this.opts);\n var socket = this.engine;\n var self = this;\n this.readyState = 'opening';\n this.skipReconnect = false;\n\n // emit `open`\n var openSub = on(socket, 'open', function () {\n self.onopen();\n fn && fn();\n });\n\n // emit `connect_error`\n var errorSub = on(socket, 'error', function (data) {\n\n self.cleanup();\n self.readyState = 'closed';\n self.emitAll('connect_error', data);\n if (fn) {\n var err = new Error('Connection error');\n err.data = data;\n fn(err);\n } else {\n // Only do this if there is no fn to handle the error\n self.maybeReconnectOnOpen();\n }\n });\n\n // emit `connect_timeout`\n if (false !== this._timeout) {\n var timeout = this._timeout;\n\n\n // set timer\n var timer = setTimeout(function () {\n\n openSub.destroy();\n socket.close();\n socket.emit('error', 'timeout');\n self.emitAll('connect_timeout', timeout);\n }, timeout);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n\n this.subs.push(openSub);\n this.subs.push(errorSub);\n\n return this;\n};\n\n/**\n * Called upon transport open.\n *\n * @api private\n */\n\nManager.prototype.onopen = function () {\n\n\n // clear old subs\n this.cleanup();\n\n // mark as open\n this.readyState = 'open';\n this.emit('open');\n\n // add new subs\n var socket = this.engine;\n this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n};\n\n/**\n * Called upon a ping.\n *\n * @api private\n */\n\nManager.prototype.onping = function () {\n this.lastPing = new Date();\n this.emitAll('ping');\n};\n\n/**\n * Called upon a packet.\n *\n * @api private\n */\n\nManager.prototype.onpong = function () {\n this.emitAll('pong', new Date() - this.lastPing);\n};\n\n/**\n * Called with data.\n *\n * @api private\n */\n\nManager.prototype.ondata = function (data) {\n this.decoder.add(data);\n};\n\n/**\n * Called when parser fully decodes a packet.\n *\n * @api private\n */\n\nManager.prototype.ondecoded = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon socket error.\n *\n * @api private\n */\n\nManager.prototype.onerror = function (err) {\n\n this.emitAll('error', err);\n};\n\n/**\n * Creates a new socket for the given `nsp`.\n *\n * @return {Socket}\n * @api public\n */\n\nManager.prototype.socket = function (nsp, opts) {\n var socket = this.nsps[nsp];\n if (!socket) {\n socket = new Socket(this, nsp, opts);\n this.nsps[nsp] = socket;\n var self = this;\n socket.on('connecting', onConnecting);\n socket.on('connect', function () {\n socket.id = self.generateId(nsp);\n });\n\n if (this.autoConnect) {\n // manually call here since connecting event is fired before listening\n onConnecting();\n }\n }\n\n function onConnecting () {\n if (!~indexOf(self.connecting, socket)) {\n self.connecting.push(socket);\n }\n }\n\n return socket;\n};\n\n/**\n * Called upon a socket close.\n *\n * @param {Socket} socket\n */\n\nManager.prototype.destroy = function (socket) {\n var index = indexOf(this.connecting, socket);\n if (~index) this.connecting.splice(index, 1);\n if (this.connecting.length) return;\n\n this.close();\n};\n\n/**\n * Writes a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nManager.prototype.packet = function (packet) {\n\n var self = this;\n if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\n if (!self.encoding) {\n // encode, then write to engine with result\n self.encoding = true;\n this.encoder.encode(packet, function (encodedPackets) {\n for (var i = 0; i < encodedPackets.length; i++) {\n self.engine.write(encodedPackets[i], packet.options);\n }\n self.encoding = false;\n self.processPacketQueue();\n });\n } else { // add packet to the queue\n self.packetBuffer.push(packet);\n }\n};\n\n/**\n * If packet buffer is non-empty, begins encoding the\n * next packet in line.\n *\n * @api private\n */\n\nManager.prototype.processPacketQueue = function () {\n if (this.packetBuffer.length > 0 && !this.encoding) {\n var pack = this.packetBuffer.shift();\n this.packet(pack);\n }\n};\n\n/**\n * Clean up transport subscriptions and packet buffer.\n *\n * @api private\n */\n\nManager.prototype.cleanup = function () {\n\n\n var subsLength = this.subs.length;\n for (var i = 0; i < subsLength; i++) {\n var sub = this.subs.shift();\n sub.destroy();\n }\n\n this.packetBuffer = [];\n this.encoding = false;\n this.lastPing = null;\n\n this.decoder.destroy();\n};\n\n/**\n * Close the current socket.\n *\n * @api private\n */\n\nManager.prototype.close =\nManager.prototype.disconnect = function () {\n\n this.skipReconnect = true;\n this.reconnecting = false;\n if ('opening' === this.readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this.readyState = 'closed';\n if (this.engine) this.engine.close();\n};\n\n/**\n * Called upon engine close.\n *\n * @api private\n */\n\nManager.prototype.onclose = function (reason) {\n\n\n this.cleanup();\n this.backoff.reset();\n this.readyState = 'closed';\n this.emit('close', reason);\n\n if (this._reconnection && !this.skipReconnect) {\n this.reconnect();\n }\n};\n\n/**\n * Attempt a reconnection.\n *\n * @api private\n */\n\nManager.prototype.reconnect = function () {\n if (this.reconnecting || this.skipReconnect) return this;\n\n var self = this;\n\n if (this.backoff.attempts >= this._reconnectionAttempts) {\n\n this.backoff.reset();\n this.emitAll('reconnect_failed');\n this.reconnecting = false;\n } else {\n var delay = this.backoff.duration();\n\n\n this.reconnecting = true;\n var timer = setTimeout(function () {\n if (self.skipReconnect) return;\n\n\n self.emitAll('reconnect_attempt', self.backoff.attempts);\n self.emitAll('reconnecting', self.backoff.attempts);\n\n // check again for the case socket closed in above events\n if (self.skipReconnect) return;\n\n self.open(function (err) {\n if (err) {\n\n self.reconnecting = false;\n self.reconnect();\n self.emitAll('reconnect_error', err.data);\n } else {\n\n self.onreconnect();\n }\n });\n }, delay);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n};\n\n/**\n * Called upon successful reconnect.\n *\n * @api private\n */\n\nManager.prototype.onreconnect = function () {\n var attempt = this.backoff.attempts;\n this.reconnecting = false;\n this.backoff.reset();\n this.updateSocketIds();\n this.emitAll('reconnect', attempt);\n};\n\n\n\n// WEBPACK FOOTER //\n// ./lib/manager.js","\nmodule.exports = require('./socket');\n\n/**\n * Exports parser\n *\n * @api public\n *\n */\nmodule.exports.parser = require('engine.io-parser');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/index.js\n// module id = 10\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar transports = require('./transports/index');\nvar Emitter = require('component-emitter');\nvar debug = require('debug')('engine.io-client:socket');\nvar index = require('indexof');\nvar parser = require('engine.io-parser');\nvar parseuri = require('parseuri');\nvar parseqs = require('parseqs');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Socket;\n\n/**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n\nfunction Socket (uri, opts) {\n if (!(this instanceof Socket)) return new Socket(uri, opts);\n\n opts = opts || {};\n\n if (uri && 'object' === typeof uri) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n this.secure = null != opts.secure ? opts.secure\n : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = this.secure ? '443' : '80';\n }\n\n this.agent = opts.agent || false;\n this.hostname = opts.hostname ||\n (typeof location !== 'undefined' ? location.hostname : 'localhost');\n this.port = opts.port || (typeof location !== 'undefined' && location.port\n ? location.port\n : (this.secure ? 443 : 80));\n this.query = opts.query || {};\n if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n this.upgrade = false !== opts.upgrade;\n this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n this.forceJSONP = !!opts.forceJSONP;\n this.jsonp = false !== opts.jsonp;\n this.forceBase64 = !!opts.forceBase64;\n this.enablesXDR = !!opts.enablesXDR;\n this.withCredentials = false !== opts.withCredentials;\n this.timestampParam = opts.timestampParam || 't';\n this.timestampRequests = opts.timestampRequests;\n this.transports = opts.transports || ['polling', 'websocket'];\n this.transportOptions = opts.transportOptions || {};\n this.readyState = '';\n this.writeBuffer = [];\n this.prevBufferLen = 0;\n this.policyPort = opts.policyPort || 843;\n this.rememberUpgrade = opts.rememberUpgrade || false;\n this.binaryType = null;\n this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\n if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n this.perMessageDeflate.threshold = 1024;\n }\n\n // SSL options for Node.js client\n this.pfx = opts.pfx || null;\n this.key = opts.key || null;\n this.passphrase = opts.passphrase || null;\n this.cert = opts.cert || null;\n this.ca = opts.ca || null;\n this.ciphers = opts.ciphers || null;\n this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n this.forceNode = !!opts.forceNode;\n\n // detect ReactNative environment\n this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\n // other options for Node.js or ReactNative client\n if (typeof self === 'undefined' || this.isReactNative) {\n if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n this.extraHeaders = opts.extraHeaders;\n }\n\n if (opts.localAddress) {\n this.localAddress = opts.localAddress;\n }\n }\n\n // set on handshake\n this.id = null;\n this.upgrades = null;\n this.pingInterval = null;\n this.pingTimeout = null;\n\n // set on heartbeat\n this.pingIntervalTimer = null;\n this.pingTimeoutTimer = null;\n\n this.open();\n}\n\nSocket.priorWebsocketSuccess = false;\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\nSocket.Socket = Socket;\nSocket.Transport = require('./transport');\nSocket.transports = require('./transports/index');\nSocket.parser = require('engine.io-parser');\n\n/**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n\nSocket.prototype.createTransport = function (name) {\n\n var query = clone(this.query);\n\n // append engine.io protocol identifier\n query.EIO = parser.protocol;\n\n // transport name\n query.transport = name;\n\n // per-transport options\n var options = this.transportOptions[name] || {};\n\n // session id if we already have one\n if (this.id) query.sid = this.id;\n\n var transport = new transports[name]({\n query: query,\n socket: this,\n agent: options.agent || this.agent,\n hostname: options.hostname || this.hostname,\n port: options.port || this.port,\n secure: options.secure || this.secure,\n path: options.path || this.path,\n forceJSONP: options.forceJSONP || this.forceJSONP,\n jsonp: options.jsonp || this.jsonp,\n forceBase64: options.forceBase64 || this.forceBase64,\n enablesXDR: options.enablesXDR || this.enablesXDR,\n withCredentials: options.withCredentials || this.withCredentials,\n timestampRequests: options.timestampRequests || this.timestampRequests,\n timestampParam: options.timestampParam || this.timestampParam,\n policyPort: options.policyPort || this.policyPort,\n pfx: options.pfx || this.pfx,\n key: options.key || this.key,\n passphrase: options.passphrase || this.passphrase,\n cert: options.cert || this.cert,\n ca: options.ca || this.ca,\n ciphers: options.ciphers || this.ciphers,\n rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n extraHeaders: options.extraHeaders || this.extraHeaders,\n forceNode: options.forceNode || this.forceNode,\n localAddress: options.localAddress || this.localAddress,\n requestTimeout: options.requestTimeout || this.requestTimeout,\n protocols: options.protocols || void (0),\n isReactNative: this.isReactNative\n });\n\n return transport;\n};\n\nfunction clone (obj) {\n var o = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n return o;\n}\n\n/**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\nSocket.prototype.open = function () {\n var transport;\n if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n transport = 'websocket';\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n var self = this;\n setTimeout(function () {\n self.emit('error', 'No transports available');\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n this.readyState = 'opening';\n\n // Retry with the next transport if the transport is disabled (jsonp: false)\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n};\n\n/**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n\nSocket.prototype.setTransport = function (transport) {\n\n var self = this;\n\n if (this.transport) {\n\n this.transport.removeAllListeners();\n }\n\n // set up transport\n this.transport = transport;\n\n // set up transport listeners\n transport\n .on('drain', function () {\n self.onDrain();\n })\n .on('packet', function (packet) {\n self.onPacket(packet);\n })\n .on('error', function (e) {\n self.onError(e);\n })\n .on('close', function () {\n self.onClose('transport close');\n });\n};\n\n/**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n\nSocket.prototype.probe = function (name) {\n\n var transport = this.createTransport(name, { probe: 1 });\n var failed = false;\n var self = this;\n\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen () {\n if (self.onlyBinaryUpgrades) {\n var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n if (failed) return;\n\n\n transport.send([{ type: 'ping', data: 'probe' }]);\n transport.once('packet', function (msg) {\n if (failed) return;\n if ('pong' === msg.type && 'probe' === msg.data) {\n\n self.upgrading = true;\n self.emit('upgrading', transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\n\n self.transport.pause(function () {\n if (failed) return;\n if ('closed' === self.readyState) return;\n\n\n cleanup();\n\n self.setTransport(transport);\n transport.send([{ type: 'upgrade' }]);\n self.emit('upgrade', transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n\n var err = new Error('probe error');\n err.transport = transport.name;\n self.emit('upgradeError', err);\n }\n });\n }\n\n function freezeTransport () {\n if (failed) return;\n\n // Any callback called by transport should be ignored since now\n failed = true;\n\n cleanup();\n\n transport.close();\n transport = null;\n }\n\n // Handle any error that happens while probing\n function onerror (err) {\n var error = new Error('probe error: ' + err);\n error.transport = transport.name;\n\n freezeTransport();\n\n\n\n self.emit('upgradeError', error);\n }\n\n function onTransportClose () {\n onerror('transport closed');\n }\n\n // When the socket is closed while we're probing\n function onclose () {\n onerror('socket closed');\n }\n\n // When the socket is upgraded while we're probing\n function onupgrade (to) {\n if (transport && to.name !== transport.name) {\n\n freezeTransport();\n }\n }\n\n // Remove all listeners on the transport and on self\n function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }\n\n transport.once('open', onTransportOpen);\n transport.once('error', onerror);\n transport.once('close', onTransportClose);\n\n this.once('close', onclose);\n this.once('upgrading', onupgrade);\n\n transport.open();\n};\n\n/**\n * Called when connection is deemed open.\n *\n * @api public\n */\n\nSocket.prototype.onOpen = function () {\n\n this.readyState = 'open';\n Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n this.emit('open');\n this.flush();\n\n // we check for `readyState` in case an `open`\n // listener already closed the socket\n if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n\n for (var i = 0, l = this.upgrades.length; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n};\n\n/**\n * Handles a packet.\n *\n * @api private\n */\n\nSocket.prototype.onPacket = function (packet) {\n if ('opening' === this.readyState || 'open' === this.readyState ||\n 'closing' === this.readyState) {\n\n\n this.emit('packet', packet);\n\n // Socket is live - any packet counts\n this.emit('heartbeat');\n\n switch (packet.type) {\n case 'open':\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case 'pong':\n this.setPing();\n this.emit('pong');\n break;\n\n case 'error':\n var err = new Error('server error');\n err.code = packet.data;\n this.onError(err);\n break;\n\n case 'message':\n this.emit('data', packet.data);\n this.emit('message', packet.data);\n break;\n }\n } else {\n\n }\n};\n\n/**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n\nSocket.prototype.onHandshake = function (data) {\n this.emit('handshake', data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen();\n // In case open handler closes socket\n if ('closed' === this.readyState) return;\n this.setPing();\n\n // Prolong liveness of socket on heartbeat\n this.removeListener('heartbeat', this.onHeartbeat);\n this.on('heartbeat', this.onHeartbeat);\n};\n\n/**\n * Resets ping timeout.\n *\n * @api private\n */\n\nSocket.prototype.onHeartbeat = function (timeout) {\n clearTimeout(this.pingTimeoutTimer);\n var self = this;\n self.pingTimeoutTimer = setTimeout(function () {\n if ('closed' === self.readyState) return;\n self.onClose('ping timeout');\n }, timeout || (self.pingInterval + self.pingTimeout));\n};\n\n/**\n * Pings server every `this.pingInterval` and expects response\n * within `this.pingTimeout` or closes connection.\n *\n * @api private\n */\n\nSocket.prototype.setPing = function () {\n var self = this;\n clearTimeout(self.pingIntervalTimer);\n self.pingIntervalTimer = setTimeout(function () {\n\n self.ping();\n self.onHeartbeat(self.pingTimeout);\n }, self.pingInterval);\n};\n\n/**\n* Sends a ping packet.\n*\n* @api private\n*/\n\nSocket.prototype.ping = function () {\n var self = this;\n this.sendPacket('ping', function () {\n self.emit('ping');\n });\n};\n\n/**\n * Called on `drain` event\n *\n * @api private\n */\n\nSocket.prototype.onDrain = function () {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit('drain');\n } else {\n this.flush();\n }\n};\n\n/**\n * Flush write buffers.\n *\n * @api private\n */\n\nSocket.prototype.flush = function () {\n if ('closed' !== this.readyState && this.transport.writable &&\n !this.upgrading && this.writeBuffer.length) {\n\n this.transport.send(this.writeBuffer);\n // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n this.prevBufferLen = this.writeBuffer.length;\n this.emit('flush');\n }\n};\n\n/**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n\nSocket.prototype.write =\nSocket.prototype.send = function (msg, options, fn) {\n this.sendPacket('message', msg, options, fn);\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n\nSocket.prototype.sendPacket = function (type, data, options, fn) {\n if ('function' === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if ('function' === typeof options) {\n fn = options;\n options = null;\n }\n\n if ('closing' === this.readyState || 'closed' === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n\n var packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit('packetCreate', packet);\n this.writeBuffer.push(packet);\n if (fn) this.once('flush', fn);\n this.flush();\n};\n\n/**\n * Closes the connection.\n *\n * @api private\n */\n\nSocket.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.readyState = 'closing';\n\n var self = this;\n\n if (this.writeBuffer.length) {\n this.once('drain', function () {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close () {\n self.onClose('forced close');\n\n self.transport.close();\n }\n\n function cleanupAndClose () {\n self.removeListener('upgrade', cleanupAndClose);\n self.removeListener('upgradeError', cleanupAndClose);\n close();\n }\n\n function waitForUpgrade () {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once('upgrade', cleanupAndClose);\n self.once('upgradeError', cleanupAndClose);\n }\n\n return this;\n};\n\n/**\n * Called upon transport error\n *\n * @api private\n */\n\nSocket.prototype.onError = function (err) {\n\n Socket.priorWebsocketSuccess = false;\n this.emit('error', err);\n this.onClose('transport error', err);\n};\n\n/**\n * Called upon transport close.\n *\n * @api private\n */\n\nSocket.prototype.onClose = function (reason, desc) {\n if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n\n var self = this;\n\n // clear timers\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer);\n\n // stop event from firing again for transport\n this.transport.removeAllListeners('close');\n\n // ensure transport won't stay open\n this.transport.close();\n\n // ignore further transport communication\n this.transport.removeAllListeners();\n\n // set ready state\n this.readyState = 'closed';\n\n // clear session id\n this.id = null;\n\n // emit close event\n this.emit('close', reason, desc);\n\n // clean buffers after, so users can still\n // grab the buffers on `close` event\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n};\n\n/**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n\nSocket.prototype.filterUpgrades = function (upgrades) {\n var filteredUpgrades = [];\n for (var i = 0, j = upgrades.length; i < j; i++) {\n if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n }\n return filteredUpgrades;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/socket.js\n// module id = 11\n// module chunks = 0","/**\n * Module dependencies\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar XHR = require('./polling-xhr');\nvar JSONP = require('./polling-jsonp');\nvar websocket = require('./websocket');\n\n/**\n * Export transports.\n */\n\nexports.polling = polling;\nexports.websocket = websocket;\n\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling (opts) {\n var xhr;\n var xd = false;\n var xs = false;\n var jsonp = false !== opts.jsonp;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if ('open' in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error('JSONP disabled');\n return new JSONP(opts);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/index.js\n// module id = 12\n// module chunks = 0","// browser shim for xmlhttprequest module\n\nvar hasCORS = require('has-cors');\n\nmodule.exports = function (opts) {\n var xdomain = opts.xdomain;\n\n // scheme must be same when usign XDomainRequest\n // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n var xscheme = opts.xscheme;\n\n // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n // https://github.com/Automattic/engine.io-client/pull/217\n var enablesXDR = opts.enablesXDR;\n\n // XMLHttpRequest can be disabled on IE\n try {\n if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n return new XMLHttpRequest();\n }\n } catch (e) { }\n\n // Use XDomainRequest for IE8 if enablesXDR is true\n // because loading bar keeps flashing when using jsonp-polling\n // https://github.com/yujiosaka/socke.io-ie8-loading-example\n try {\n if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n return new XDomainRequest();\n }\n } catch (e) { }\n\n if (!xdomain) {\n try {\n return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n } catch (e) { }\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/xmlhttprequest.js\n// module id = 13\n// module chunks = 0","\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-cors/index.js\n// module id = 14\n// module chunks = 0","/* global attachEvent */\n\n/**\n * Module requirements.\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar Polling = require('./polling');\nvar Emitter = require('component-emitter');\nvar inherit = require('component-inherit');\nvar debug = require('debug')('engine.io-client:polling-xhr');\n\n/**\n * Module exports.\n */\n\nmodule.exports = XHR;\nmodule.exports.Request = Request;\n\n/**\n * Empty function\n */\n\nfunction empty () {}\n\n/**\n * XHR Polling constructor.\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction XHR (opts) {\n Polling.call(this, opts);\n this.requestTimeout = opts.requestTimeout;\n this.extraHeaders = opts.extraHeaders;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n port !== opts.port;\n this.xs = opts.secure !== isSSL;\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(XHR, Polling);\n\n/**\n * XHR supports binary\n */\n\nXHR.prototype.supportsBinary = true;\n\n/**\n * Creates a request.\n *\n * @param {String} method\n * @api private\n */\n\nXHR.prototype.request = function (opts) {\n opts = opts || {};\n opts.uri = this.uri();\n opts.xd = this.xd;\n opts.xs = this.xs;\n opts.agent = this.agent || false;\n opts.supportsBinary = this.supportsBinary;\n opts.enablesXDR = this.enablesXDR;\n opts.withCredentials = this.withCredentials;\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n opts.requestTimeout = this.requestTimeout;\n\n // other options for Node.js client\n opts.extraHeaders = this.extraHeaders;\n\n return new Request(opts);\n};\n\n/**\n * Sends data.\n *\n * @param {String} data to send.\n * @param {Function} called upon flush.\n * @api private\n */\n\nXHR.prototype.doWrite = function (data, fn) {\n var isBinary = typeof data !== 'string' && data !== undefined;\n var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n var self = this;\n req.on('success', fn);\n req.on('error', function (err) {\n self.onError('xhr post error', err);\n });\n this.sendXhr = req;\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nXHR.prototype.doPoll = function () {\n\n var req = this.request();\n var self = this;\n req.on('data', function (data) {\n self.onData(data);\n });\n req.on('error', function (err) {\n self.onError('xhr poll error', err);\n });\n this.pollXhr = req;\n};\n\n/**\n * Request constructor\n *\n * @param {Object} options\n * @api public\n */\n\nfunction Request (opts) {\n this.method = opts.method || 'GET';\n this.uri = opts.uri;\n this.xd = !!opts.xd;\n this.xs = !!opts.xs;\n this.async = false !== opts.async;\n this.data = undefined !== opts.data ? opts.data : null;\n this.agent = opts.agent;\n this.isBinary = opts.isBinary;\n this.supportsBinary = opts.supportsBinary;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n this.requestTimeout = opts.requestTimeout;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n\n this.create();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Request.prototype);\n\n/**\n * Creates the XHR object and sends the request.\n *\n * @api private\n */\n\nRequest.prototype.create = function () {\n var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n\n var xhr = this.xhr = new XMLHttpRequest(opts);\n var self = this;\n\n try {\n\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (var i in this.extraHeaders) {\n if (this.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if ('POST' === this.method) {\n try {\n if (this.isBinary) {\n xhr.setRequestHeader('Content-type', 'application/octet-stream');\n } else {\n xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n }\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader('Accept', '*/*');\n } catch (e) {}\n\n // ie6 check\n if ('withCredentials' in xhr) {\n xhr.withCredentials = this.withCredentials;\n }\n\n if (this.requestTimeout) {\n xhr.timeout = this.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function () {\n self.onLoad();\n };\n xhr.onerror = function () {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 2) {\n try {\n var contentType = xhr.getResponseHeader('Content-Type');\n if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n xhr.responseType = 'arraybuffer';\n }\n } catch (e) {}\n }\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function () {\n self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly fhrom the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function () {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== 'undefined') {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n};\n\n/**\n * Called upon successful response.\n *\n * @api private\n */\n\nRequest.prototype.onSuccess = function () {\n this.emit('success');\n this.cleanup();\n};\n\n/**\n * Called if we have data.\n *\n * @api private\n */\n\nRequest.prototype.onData = function (data) {\n this.emit('data', data);\n this.onSuccess();\n};\n\n/**\n * Called upon error.\n *\n * @api private\n */\n\nRequest.prototype.onError = function (err) {\n this.emit('error', err);\n this.cleanup(true);\n};\n\n/**\n * Cleans up house.\n *\n * @api private\n */\n\nRequest.prototype.cleanup = function (fromError) {\n if ('undefined' === typeof this.xhr || null === this.xhr) {\n return;\n }\n // xmlhttprequest\n if (this.hasXDR()) {\n this.xhr.onload = this.xhr.onerror = empty;\n } else {\n this.xhr.onreadystatechange = empty;\n }\n\n if (fromError) {\n try {\n this.xhr.abort();\n } catch (e) {}\n }\n\n if (typeof document !== 'undefined') {\n delete Request.requests[this.index];\n }\n\n this.xhr = null;\n};\n\n/**\n * Called upon load.\n *\n * @api private\n */\n\nRequest.prototype.onLoad = function () {\n var data;\n try {\n var contentType;\n try {\n contentType = this.xhr.getResponseHeader('Content-Type');\n } catch (e) {}\n if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n data = this.xhr.response || this.xhr.responseText;\n } else {\n data = this.xhr.responseText;\n }\n } catch (e) {\n this.onError(e);\n }\n if (null != data) {\n this.onData(data);\n }\n};\n\n/**\n * Check if it has XDomainRequest.\n *\n * @api private\n */\n\nRequest.prototype.hasXDR = function () {\n return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n};\n\n/**\n * Aborts the request.\n *\n * @api public\n */\n\nRequest.prototype.abort = function () {\n this.cleanup();\n};\n\n/**\n * Aborts pending requests when unloading the window. This is needed to prevent\n * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n * emitted.\n */\n\nRequest.requestsCount = 0;\nRequest.requests = {};\n\nif (typeof document !== 'undefined') {\n if (typeof attachEvent === 'function') {\n attachEvent('onunload', unloadHandler);\n } else if (typeof addEventListener === 'function') {\n var terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';\n addEventListener(terminationEvent, unloadHandler, false);\n }\n}\n\nfunction unloadHandler () {\n for (var i in Request.requests) {\n if (Request.requests.hasOwnProperty(i)) {\n Request.requests[i].abort();\n }\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-xhr.js\n// module id = 15\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parseqs = require('parseqs');\nvar parser = require('engine.io-parser');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:polling');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Polling;\n\n/**\n * Is XHR2 supported?\n */\n\nvar hasXHR2 = (function () {\n var XMLHttpRequest = require('xmlhttprequest-ssl');\n var xhr = new XMLHttpRequest({ xdomain: false });\n return null != xhr.responseType;\n})();\n\n/**\n * Polling interface.\n *\n * @param {Object} opts\n * @api private\n */\n\nfunction Polling (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (!hasXHR2 || forceBase64) {\n this.supportsBinary = false;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(Polling, Transport);\n\n/**\n * Transport name.\n */\n\nPolling.prototype.name = 'polling';\n\n/**\n * Opens the socket (triggers polling). We write a PING message to determine\n * when the transport is open.\n *\n * @api private\n */\n\nPolling.prototype.doOpen = function () {\n this.poll();\n};\n\n/**\n * Pauses polling.\n *\n * @param {Function} callback upon buffers are flushed and transport is paused\n * @api private\n */\n\nPolling.prototype.pause = function (onPause) {\n var self = this;\n\n this.readyState = 'pausing';\n\n function pause () {\n\n self.readyState = 'paused';\n onPause();\n }\n\n if (this.polling || !this.writable) {\n var total = 0;\n\n if (this.polling) {\n\n total++;\n this.once('pollComplete', function () {\n\n --total || pause();\n });\n }\n\n if (!this.writable) {\n\n total++;\n this.once('drain', function () {\n\n --total || pause();\n });\n }\n } else {\n pause();\n }\n};\n\n/**\n * Starts polling cycle.\n *\n * @api public\n */\n\nPolling.prototype.poll = function () {\n\n this.polling = true;\n this.doPoll();\n this.emit('poll');\n};\n\n/**\n * Overloads onData to detect payloads.\n *\n * @api private\n */\n\nPolling.prototype.onData = function (data) {\n var self = this;\n\n var callback = function (packet, index, total) {\n // if its the first message we consider the transport open\n if ('opening' === self.readyState) {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if ('close' === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType, callback);\n\n // if an event did not trigger closing\n if ('closed' !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit('pollComplete');\n\n if ('open' === this.readyState) {\n this.poll();\n } else {\n\n }\n }\n};\n\n/**\n * For polling, send a close packet.\n *\n * @api private\n */\n\nPolling.prototype.doClose = function () {\n var self = this;\n\n function close () {\n\n self.write([{ type: 'close' }]);\n }\n\n if ('open' === this.readyState) {\n\n close();\n } else {\n // in case we're trying to close while\n // handshaking is in progress (GH-164)\n\n this.once('open', close);\n }\n};\n\n/**\n * Writes a packets payload.\n *\n * @param {Array} data packets\n * @param {Function} drain callback\n * @api private\n */\n\nPolling.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n var callbackfn = function () {\n self.writable = true;\n self.emit('drain');\n };\n\n parser.encodePayload(packets, this.supportsBinary, function (data) {\n self.doWrite(data, callbackfn);\n });\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nPolling.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'https' : 'http';\n var port = '';\n\n // cache busting is forced\n if (false !== this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n if (!this.supportsBinary && !query.sid) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // avoid port if default for schema\n if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n ('http' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling.js\n// module id = 16\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar parser = require('engine.io-parser');\nvar Emitter = require('component-emitter');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Transport;\n\n/**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n\nfunction Transport (opts) {\n this.path = opts.path;\n this.hostname = opts.hostname;\n this.port = opts.port;\n this.secure = opts.secure;\n this.query = opts.query;\n this.timestampParam = opts.timestampParam;\n this.timestampRequests = opts.timestampRequests;\n this.readyState = '';\n this.agent = opts.agent || false;\n this.socket = opts.socket;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n this.forceNode = opts.forceNode;\n\n // results of ReactNative environment detection\n this.isReactNative = opts.isReactNative;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n this.localAddress = opts.localAddress;\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Transport.prototype);\n\n/**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n\nTransport.prototype.onError = function (msg, desc) {\n var err = new Error(msg);\n err.type = 'TransportError';\n err.description = desc;\n this.emit('error', err);\n return this;\n};\n\n/**\n * Opens the transport.\n *\n * @api public\n */\n\nTransport.prototype.open = function () {\n if ('closed' === this.readyState || '' === this.readyState) {\n this.readyState = 'opening';\n this.doOpen();\n }\n\n return this;\n};\n\n/**\n * Closes the transport.\n *\n * @api private\n */\n\nTransport.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n};\n\n/**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n\nTransport.prototype.send = function (packets) {\n if ('open' === this.readyState) {\n this.write(packets);\n } else {\n throw new Error('Transport not open');\n }\n};\n\n/**\n * Called upon open\n *\n * @api private\n */\n\nTransport.prototype.onOpen = function () {\n this.readyState = 'open';\n this.writable = true;\n this.emit('open');\n};\n\n/**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n\nTransport.prototype.onData = function (data) {\n var packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n};\n\n/**\n * Called with a decoded packet.\n */\n\nTransport.prototype.onPacket = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon close.\n *\n * @api private\n */\n\nTransport.prototype.onClose = function () {\n this.readyState = 'closed';\n this.emit('close');\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transport.js\n// module id = 17\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar keys = require('./keys');\nvar hasBinary = require('has-binary2');\nvar sliceBuffer = require('arraybuffer.slice');\nvar after = require('after');\nvar utf8 = require('./utf8');\n\nvar base64encoder;\nif (typeof ArrayBuffer !== 'undefined') {\n base64encoder = require('base64-arraybuffer');\n}\n\n/**\n * Check if we are running an android browser. That requires us to use\n * ArrayBuffer with polling transports...\n *\n * http://ghinda.net/jpeg-blob-ajax-android/\n */\n\nvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\n/**\n * Check if we are running in PhantomJS.\n * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n * https://github.com/ariya/phantomjs/issues/11395\n * @type boolean\n */\nvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\n/**\n * When true, avoids using Blobs to encode payloads.\n * @type boolean\n */\nvar dontSendBlobs = isAndroid || isPhantomJS;\n\n/**\n * Current protocol version.\n */\n\nexports.protocol = 3;\n\n/**\n * Packet types.\n */\n\nvar packets = exports.packets = {\n open: 0 // non-ws\n , close: 1 // non-ws\n , ping: 2\n , pong: 3\n , message: 4\n , upgrade: 5\n , noop: 6\n};\n\nvar packetslist = keys(packets);\n\n/**\n * Premade error packet.\n */\n\nvar err = { type: 'error', data: 'parser error' };\n\n/**\n * Create a blob api even for blob builder when vendor prefixes exist\n */\n\nvar Blob = require('blob');\n\n/**\n * Encodes a packet.\n *\n * <packet type id> [ <data> ]\n *\n * Example:\n *\n * 5hello world\n * 3\n * 4\n *\n * Binary is encoded in an identical principle\n *\n * @api private\n */\n\nexports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = false;\n }\n\n if (typeof utf8encode === 'function') {\n callback = utf8encode;\n utf8encode = null;\n }\n\n var data = (packet.data === undefined)\n ? undefined\n : packet.data.buffer || packet.data;\n\n if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n return encodeArrayBuffer(packet, supportsBinary, callback);\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return encodeBlob(packet, supportsBinary, callback);\n }\n\n // might be an object with { base64: true, data: dataAsBase64String }\n if (data && data.base64) {\n return encodeBase64Object(packet, callback);\n }\n\n // Sending data as a utf-8 string\n var encoded = packets[packet.type];\n\n // data fragment is optional\n if (undefined !== packet.data) {\n encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n }\n\n return callback('' + encoded);\n\n};\n\nfunction encodeBase64Object(packet, callback) {\n // packet data is an object { base64: true, data: dataAsBase64String }\n var message = 'b' + exports.packets[packet.type] + packet.data.data;\n return callback(message);\n}\n\n/**\n * Encode packet helpers for binary types\n */\n\nfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var data = packet.data;\n var contentArray = new Uint8Array(data);\n var resultBuffer = new Uint8Array(1 + data.byteLength);\n\n resultBuffer[0] = packets[packet.type];\n for (var i = 0; i < contentArray.length; i++) {\n resultBuffer[i+1] = contentArray[i];\n }\n\n return callback(resultBuffer.buffer);\n}\n\nfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var fr = new FileReader();\n fr.onload = function() {\n exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n };\n return fr.readAsArrayBuffer(packet.data);\n}\n\nfunction encodeBlob(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n if (dontSendBlobs) {\n return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n }\n\n var length = new Uint8Array(1);\n length[0] = packets[packet.type];\n var blob = new Blob([length.buffer, packet.data]);\n\n return callback(blob);\n}\n\n/**\n * Encodes a packet with binary data in a base64 string\n *\n * @param {Object} packet, has `type` and `data`\n * @return {String} base64 encoded message\n */\n\nexports.encodeBase64Packet = function(packet, callback) {\n var message = 'b' + exports.packets[packet.type];\n if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n var fr = new FileReader();\n fr.onload = function() {\n var b64 = fr.result.split(',')[1];\n callback(message + b64);\n };\n return fr.readAsDataURL(packet.data);\n }\n\n var b64data;\n try {\n b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n } catch (e) {\n // iPhone Safari doesn't let you apply with typed arrays\n var typed = new Uint8Array(packet.data);\n var basic = new Array(typed.length);\n for (var i = 0; i < typed.length; i++) {\n basic[i] = typed[i];\n }\n b64data = String.fromCharCode.apply(null, basic);\n }\n message += btoa(b64data);\n return callback(message);\n};\n\n/**\n * Decodes a packet. Changes format to Blob if requested.\n *\n * @return {Object} with `type` and `data` (if any)\n * @api private\n */\n\nexports.decodePacket = function (data, binaryType, utf8decode) {\n if (data === undefined) {\n return err;\n }\n // String data\n if (typeof data === 'string') {\n if (data.charAt(0) === 'b') {\n return exports.decodeBase64Packet(data.substr(1), binaryType);\n }\n\n if (utf8decode) {\n data = tryDecode(data);\n if (data === false) {\n return err;\n }\n }\n var type = data.charAt(0);\n\n if (Number(type) != type || !packetslist[type]) {\n return err;\n }\n\n if (data.length > 1) {\n return { type: packetslist[type], data: data.substring(1) };\n } else {\n return { type: packetslist[type] };\n }\n }\n\n var asArray = new Uint8Array(data);\n var type = asArray[0];\n var rest = sliceBuffer(data, 1);\n if (Blob && binaryType === 'blob') {\n rest = new Blob([rest]);\n }\n return { type: packetslist[type], data: rest };\n};\n\nfunction tryDecode(data) {\n try {\n data = utf8.decode(data, { strict: false });\n } catch (e) {\n return false;\n }\n return data;\n}\n\n/**\n * Decodes a packet encoded in a base64 string\n *\n * @param {String} base64 encoded message\n * @return {Object} with `type` and `data` (if any)\n */\n\nexports.decodeBase64Packet = function(msg, binaryType) {\n var type = packetslist[msg.charAt(0)];\n if (!base64encoder) {\n return { type: type, data: { base64: true, data: msg.substr(1) } };\n }\n\n var data = base64encoder.decode(msg.substr(1));\n\n if (binaryType === 'blob' && Blob) {\n data = new Blob([data]);\n }\n\n return { type: type, data: data };\n};\n\n/**\n * Encodes multiple messages (payload).\n *\n * <length>:data\n *\n * Example:\n *\n * 11:hello world2:hi\n *\n * If any contents are binary, they will be encoded as base64 strings. Base64\n * encoded strings are marked with a b before the length specifier\n *\n * @param {Array} packets\n * @api private\n */\n\nexports.encodePayload = function (packets, supportsBinary, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = null;\n }\n\n var isBinary = hasBinary(packets);\n\n if (supportsBinary && isBinary) {\n if (Blob && !dontSendBlobs) {\n return exports.encodePayloadAsBlob(packets, callback);\n }\n\n return exports.encodePayloadAsArrayBuffer(packets, callback);\n }\n\n if (!packets.length) {\n return callback('0:');\n }\n\n function setLengthHeader(message) {\n return message.length + ':' + message;\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n doneCallback(null, setLengthHeader(message));\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(results.join(''));\n });\n};\n\n/**\n * Async array map using after\n */\n\nfunction map(ary, each, done) {\n var result = new Array(ary.length);\n var next = after(ary.length, done);\n\n var eachWithIndex = function(i, el, cb) {\n each(el, function(error, msg) {\n result[i] = msg;\n cb(error, result);\n });\n };\n\n for (var i = 0; i < ary.length; i++) {\n eachWithIndex(i, ary[i], next);\n }\n}\n\n/*\n * Decodes data when a payload is maybe expected. Possible binary contents are\n * decoded from their base64 representation\n *\n * @param {String} data, callback method\n * @api public\n */\n\nexports.decodePayload = function (data, binaryType, callback) {\n if (typeof data !== 'string') {\n return exports.decodePayloadAsBinary(data, binaryType, callback);\n }\n\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var packet;\n if (data === '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n var length = '', n, msg;\n\n for (var i = 0, l = data.length; i < l; i++) {\n var chr = data.charAt(i);\n\n if (chr !== ':') {\n length += chr;\n continue;\n }\n\n if (length === '' || (length != (n = Number(length)))) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n msg = data.substr(i + 1, n);\n\n if (length != msg.length) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n if (msg.length) {\n packet = exports.decodePacket(msg, binaryType, false);\n\n if (err.type === packet.type && err.data === packet.data) {\n // parser error in individual packet - ignoring payload\n return callback(err, 0, 1);\n }\n\n var ret = callback(packet, i + n, l);\n if (false === ret) return;\n }\n\n // advance cursor\n i += n;\n length = '';\n }\n\n if (length !== '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n};\n\n/**\n * Encodes multiple messages (payload) as binary.\n *\n * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n * 255><data>\n *\n * Example:\n * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n *\n * @param {Array} packets\n * @return {ArrayBuffer} encoded payload\n * @api private\n */\n\nexports.encodePayloadAsArrayBuffer = function(packets, callback) {\n if (!packets.length) {\n return callback(new ArrayBuffer(0));\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(data) {\n return doneCallback(null, data);\n });\n }\n\n map(packets, encodeOne, function(err, encodedPackets) {\n var totalLength = encodedPackets.reduce(function(acc, p) {\n var len;\n if (typeof p === 'string'){\n len = p.length;\n } else {\n len = p.byteLength;\n }\n return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n }, 0);\n\n var resultArray = new Uint8Array(totalLength);\n\n var bufferIndex = 0;\n encodedPackets.forEach(function(p) {\n var isString = typeof p === 'string';\n var ab = p;\n if (isString) {\n var view = new Uint8Array(p.length);\n for (var i = 0; i < p.length; i++) {\n view[i] = p.charCodeAt(i);\n }\n ab = view.buffer;\n }\n\n if (isString) { // not true binary\n resultArray[bufferIndex++] = 0;\n } else { // true binary\n resultArray[bufferIndex++] = 1;\n }\n\n var lenStr = ab.byteLength.toString();\n for (var i = 0; i < lenStr.length; i++) {\n resultArray[bufferIndex++] = parseInt(lenStr[i]);\n }\n resultArray[bufferIndex++] = 255;\n\n var view = new Uint8Array(ab);\n for (var i = 0; i < view.length; i++) {\n resultArray[bufferIndex++] = view[i];\n }\n });\n\n return callback(resultArray.buffer);\n });\n};\n\n/**\n * Encode as Blob\n */\n\nexports.encodePayloadAsBlob = function(packets, callback) {\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(encoded) {\n var binaryIdentifier = new Uint8Array(1);\n binaryIdentifier[0] = 1;\n if (typeof encoded === 'string') {\n var view = new Uint8Array(encoded.length);\n for (var i = 0; i < encoded.length; i++) {\n view[i] = encoded.charCodeAt(i);\n }\n encoded = view.buffer;\n binaryIdentifier[0] = 0;\n }\n\n var len = (encoded instanceof ArrayBuffer)\n ? encoded.byteLength\n : encoded.size;\n\n var lenStr = len.toString();\n var lengthAry = new Uint8Array(lenStr.length + 1);\n for (var i = 0; i < lenStr.length; i++) {\n lengthAry[i] = parseInt(lenStr[i]);\n }\n lengthAry[lenStr.length] = 255;\n\n if (Blob) {\n var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n doneCallback(null, blob);\n }\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(new Blob(results));\n });\n};\n\n/*\n * Decodes data when a payload is maybe expected. Strings are decoded by\n * interpreting each byte as a key code for entries marked to start with 0. See\n * description of encodePayloadAsBinary\n *\n * @param {ArrayBuffer} data, callback method\n * @api public\n */\n\nexports.decodePayloadAsBinary = function (data, binaryType, callback) {\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var bufferTail = data;\n var buffers = [];\n\n while (bufferTail.byteLength > 0) {\n var tailArray = new Uint8Array(bufferTail);\n var isString = tailArray[0] === 0;\n var msgLength = '';\n\n for (var i = 1; ; i++) {\n if (tailArray[i] === 255) break;\n\n // 310 = char length of Number.MAX_VALUE\n if (msgLength.length > 310) {\n return callback(err, 0, 1);\n }\n\n msgLength += tailArray[i];\n }\n\n bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n msgLength = parseInt(msgLength);\n\n var msg = sliceBuffer(bufferTail, 0, msgLength);\n if (isString) {\n try {\n msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n } catch (e) {\n // iPhone Safari doesn't let you apply to typed arrays\n var typed = new Uint8Array(msg);\n msg = '';\n for (var i = 0; i < typed.length; i++) {\n msg += String.fromCharCode(typed[i]);\n }\n }\n }\n\n buffers.push(msg);\n bufferTail = sliceBuffer(bufferTail, msgLength);\n }\n\n var total = buffers.length;\n buffers.forEach(function(buffer, i) {\n callback(exports.decodePacket(buffer, binaryType, true), i, total);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/browser.js\n// module id = 18\n// module chunks = 0","\n/**\n * Gets the keys for an object.\n *\n * @return {Array} keys\n * @api private\n */\n\nmodule.exports = Object.keys || function keys (obj){\n var arr = [];\n var has = Object.prototype.hasOwnProperty;\n\n for (var i in obj) {\n if (has.call(obj, i)) {\n arr.push(i);\n }\n }\n return arr;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/keys.js\n// module id = 19\n// module chunks = 0","/* global Blob File */\n\n/*\n * Module requirements.\n */\n\nvar isArray = require('isarray');\n\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' ||\n typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\nvar withNativeFile = typeof File === 'function' ||\n typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\n/**\n * Module exports.\n */\n\nmodule.exports = hasBinary;\n\n/**\n * Checks for binary data.\n *\n * Supports Buffer, ArrayBuffer, Blob and File.\n *\n * @param {Object} anything\n * @api public\n */\n\nfunction hasBinary (obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n if (isArray(obj)) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (hasBinary(obj[i])) {\n return true;\n }\n }\n return false;\n }\n\n if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n (withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)\n ) {\n return true;\n }\n\n // see: https://github.com/Automattic/has-binary/pull/4\n if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n return hasBinary(obj.toJSON(), true);\n }\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n return true;\n }\n }\n\n return false;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/has-binary2/index.js\n// module id = 20\n// module chunks = 0","/**\n * An abstraction for slicing an arraybuffer even when\n * ArrayBuffer.prototype.slice is not supported\n *\n * @api public\n */\n\nmodule.exports = function(arraybuffer, start, end) {\n var bytes = arraybuffer.byteLength;\n start = start || 0;\n end = end || bytes;\n\n if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\n if (start < 0) { start += bytes; }\n if (end < 0) { end += bytes; }\n if (end > bytes) { end = bytes; }\n\n if (start >= bytes || start >= end || bytes === 0) {\n return new ArrayBuffer(0);\n }\n\n var abv = new Uint8Array(arraybuffer);\n var result = new Uint8Array(end - start);\n for (var i = start, ii = 0; i < end; i++, ii++) {\n result[ii] = abv[i];\n }\n return result.buffer;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/arraybuffer.slice/index.js\n// module id = 21\n// module chunks = 0","module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/after/index.js\n// module id = 22\n// module chunks = 0","/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\nvar stringFromCharCode = String.fromCharCode;\n\n// Taken from https://mths.be/punycode\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\tvar value;\n\tvar extra;\n\twhile (counter < length) {\n\t\tvalue = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// high surrogate, and there is a next character\n\t\t\textra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n// Taken from https://mths.be/punycode\nfunction ucs2encode(array) {\n\tvar length = array.length;\n\tvar index = -1;\n\tvar value;\n\tvar output = '';\n\twhile (++index < length) {\n\t\tvalue = array[index];\n\t\tif (value > 0xFFFF) {\n\t\t\tvalue -= 0x10000;\n\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t}\n\t\toutput += stringFromCharCode(value);\n\t}\n\treturn output;\n}\n\nfunction checkScalarValue(codePoint, strict) {\n\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\tif (strict) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n/*--------------------------------------------------------------------------*/\n\nfunction createByte(codePoint, shift) {\n\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n}\n\nfunction encodeCodePoint(codePoint, strict) {\n\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\treturn stringFromCharCode(codePoint);\n\t}\n\tvar symbol = '';\n\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t}\n\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\tcodePoint = 0xFFFD;\n\t\t}\n\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\tsymbol += createByte(codePoint, 12);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\treturn symbol;\n}\n\nfunction utf8encode(string, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tvar codePoints = ucs2decode(string);\n\tvar length = codePoints.length;\n\tvar index = -1;\n\tvar codePoint;\n\tvar byteString = '';\n\twhile (++index < length) {\n\t\tcodePoint = codePoints[index];\n\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t}\n\treturn byteString;\n}\n\n/*--------------------------------------------------------------------------*/\n\nfunction readContinuationByte() {\n\tif (byteIndex >= byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\tif ((continuationByte & 0xC0) == 0x80) {\n\t\treturn continuationByte & 0x3F;\n\t}\n\n\t// If we end up here, it’s not a continuation byte\n\tthrow Error('Invalid continuation byte');\n}\n\nfunction decodeSymbol(strict) {\n\tvar byte1;\n\tvar byte2;\n\tvar byte3;\n\tvar byte4;\n\tvar codePoint;\n\n\tif (byteIndex > byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tif (byteIndex == byteCount) {\n\t\treturn false;\n\t}\n\n\t// Read first byte\n\tbyte1 = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\t// 1-byte sequence (no continuation bytes)\n\tif ((byte1 & 0x80) == 0) {\n\t\treturn byte1;\n\t}\n\n\t// 2-byte sequence\n\tif ((byte1 & 0xE0) == 0xC0) {\n\t\tbyte2 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\tif (codePoint >= 0x80) {\n\t\t\treturn codePoint;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 3-byte sequence (may include unpaired surrogates)\n\tif ((byte1 & 0xF0) == 0xE0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\tif (codePoint >= 0x0800) {\n\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 4-byte sequence\n\tif ((byte1 & 0xF8) == 0xF0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tbyte4 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t(byte3 << 0x06) | byte4;\n\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\treturn codePoint;\n\t\t}\n\t}\n\n\tthrow Error('Invalid UTF-8 detected');\n}\n\nvar byteArray;\nvar byteCount;\nvar byteIndex;\nfunction utf8decode(byteString, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tbyteArray = ucs2decode(byteString);\n\tbyteCount = byteArray.length;\n\tbyteIndex = 0;\n\tvar codePoints = [];\n\tvar tmp;\n\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\tcodePoints.push(tmp);\n\t}\n\treturn ucs2encode(codePoints);\n}\n\nmodule.exports = {\n\tversion: '2.1.2',\n\tencode: utf8encode,\n\tdecode: utf8decode\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-parser/lib/utf8.js\n// module id = 23\n// module chunks = 0","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(){\n \"use strict\";\n\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n // Use a lookup table to find the index.\n var lookup = new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i+1)];\n encoded3 = lookup[base64.charCodeAt(i+2)];\n encoded4 = lookup[base64.charCodeAt(i+3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-arraybuffer/lib/base64-arraybuffer.js\n// module id = 24\n// module chunks = 0","/**\r\n * Create a blob builder even when vendor prefixes exist\r\n */\r\n\r\nvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n false;\r\n\r\n/**\r\n * Check if Blob constructor is supported\r\n */\r\n\r\nvar blobSupported = (function() {\r\n try {\r\n var a = new Blob(['hi']);\r\n return a.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if Blob constructor supports ArrayBufferViews\r\n * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n */\r\n\r\nvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n try {\r\n var b = new Blob([new Uint8Array([1,2])]);\r\n return b.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if BlobBuilder is supported\r\n */\r\n\r\nvar blobBuilderSupported = BlobBuilder\r\n && BlobBuilder.prototype.append\r\n && BlobBuilder.prototype.getBlob;\r\n\r\n/**\r\n * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n * Used by BlobBuilder constructor and old browsers that didn't\r\n * support it in the Blob constructor.\r\n */\r\n\r\nfunction mapArrayBufferViews(ary) {\r\n return ary.map(function(chunk) {\r\n if (chunk.buffer instanceof ArrayBuffer) {\r\n var buf = chunk.buffer;\r\n\r\n // if this is a subarray, make a copy so we only\r\n // include the subarray region from the underlying buffer\r\n if (chunk.byteLength !== buf.byteLength) {\r\n var copy = new Uint8Array(chunk.byteLength);\r\n copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n buf = copy.buffer;\r\n }\r\n\r\n return buf;\r\n }\r\n\r\n return chunk;\r\n });\r\n}\r\n\r\nfunction BlobBuilderConstructor(ary, options) {\r\n options = options || {};\r\n\r\n var bb = new BlobBuilder();\r\n mapArrayBufferViews(ary).forEach(function(part) {\r\n bb.append(part);\r\n });\r\n\r\n return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n};\r\n\r\nfunction BlobConstructor(ary, options) {\r\n return new Blob(mapArrayBufferViews(ary), options || {});\r\n};\r\n\r\nif (typeof Blob !== 'undefined') {\r\n BlobBuilderConstructor.prototype = Blob.prototype;\r\n BlobConstructor.prototype = Blob.prototype;\r\n}\r\n\r\nmodule.exports = (function() {\r\n if (blobSupported) {\r\n return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n } else if (blobBuilderSupported) {\r\n return BlobBuilderConstructor;\r\n } else {\r\n return undefined;\r\n }\r\n})();\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/blob/index.js\n// module id = 25\n// module chunks = 0","/**\r\n * Compiles a querystring\r\n * Returns string representation of the object\r\n *\r\n * @param {Object}\r\n * @api private\r\n */\r\n\r\nexports.encode = function (obj) {\r\n var str = '';\r\n\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n if (str.length) str += '&';\r\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\r\n }\r\n }\r\n\r\n return str;\r\n};\r\n\r\n/**\r\n * Parses a simple querystring into an object\r\n *\r\n * @param {String} qs\r\n * @api private\r\n */\r\n\r\nexports.decode = function(qs){\r\n var qry = {};\r\n var pairs = qs.split('&');\r\n for (var i = 0, l = pairs.length; i < l; i++) {\r\n var pair = pairs[i].split('=');\r\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\r\n }\r\n return qry;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/parseqs/index.js\n// module id = 26\n// module chunks = 0","\nmodule.exports = function(a, b){\n var fn = function(){};\n fn.prototype = b.prototype;\n a.prototype = new fn;\n a.prototype.constructor = a;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-inherit/index.js\n// module id = 27\n// module chunks = 0","'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/yeast/index.js\n// module id = 28\n// module chunks = 0","/**\n * Module requirements.\n */\n\nvar Polling = require('./polling');\nvar inherit = require('component-inherit');\n\n/**\n * Module exports.\n */\n\nmodule.exports = JSONPPolling;\n\n/**\n * Cached regular expressions.\n */\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n\n/**\n * Noop.\n */\n\nfunction empty () { }\n\n/**\n * Until https://github.com/tc39/proposal-global is shipped.\n */\nfunction glob () {\n return typeof self !== 'undefined' ? self\n : typeof window !== 'undefined' ? window\n : typeof global !== 'undefined' ? global : {};\n}\n\n/**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n\nfunction JSONPPolling (opts) {\n Polling.call(this, opts);\n\n this.query = this.query || {};\n\n // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n var global = glob();\n callbacks = global.___eio = (global.___eio || []);\n }\n\n // callback identifier\n this.index = callbacks.length;\n\n // add callback to jsonp global\n var self = this;\n callbacks.push(function (msg) {\n self.onData(msg);\n });\n\n // append to query string\n this.query.j = this.index;\n\n // prevent spurious errors from being emitted when the window is unloaded\n if (typeof addEventListener === 'function') {\n addEventListener('beforeunload', function () {\n if (self.script) self.script.onerror = empty;\n }, false);\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(JSONPPolling, Polling);\n\n/*\n * JSONP only supports binary as base64 encoded strings\n */\n\nJSONPPolling.prototype.supportsBinary = false;\n\n/**\n * Closes the socket.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doClose = function () {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n Polling.prototype.doClose.call(this);\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doPoll = function () {\n var self = this;\n var script = document.createElement('script');\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n script.onerror = function (e) {\n self.onError('jsonp poll error', e);\n };\n\n var insertAt = document.getElementsByTagName('script')[0];\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n this.script = script;\n\n var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function () {\n var iframe = document.createElement('iframe');\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n};\n\n/**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n\nJSONPPolling.prototype.doWrite = function (data, fn) {\n var self = this;\n\n if (!this.form) {\n var form = document.createElement('form');\n var area = document.createElement('textarea');\n var id = this.iframeId = 'eio_iframe_' + this.index;\n var iframe;\n\n form.className = 'socketio';\n form.style.position = 'absolute';\n form.style.top = '-1000px';\n form.style.left = '-1000px';\n form.target = id;\n form.method = 'POST';\n form.setAttribute('accept-charset', 'utf-8');\n area.name = 'd';\n form.appendChild(area);\n document.body.appendChild(form);\n\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete () {\n initIframe();\n fn();\n }\n\n function initIframe () {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError('jsonp polling iframe removal error', e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n iframe = document.createElement(html);\n } catch (e) {\n iframe = document.createElement('iframe');\n iframe.name = self.iframeId;\n iframe.src = 'javascript:0';\n }\n\n iframe.id = self.iframeId;\n\n self.form.appendChild(iframe);\n self.iframe = iframe;\n }\n\n initIframe();\n\n // escape \\n to prevent it from being converted into \\r\\n by some UAs\n // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n data = data.replace(rEscapedNewline, '\\\\\\n');\n this.area.value = data.replace(rNewline, '\\\\n');\n\n try {\n this.form.submit();\n } catch (e) {}\n\n if (this.iframe.attachEvent) {\n this.iframe.onreadystatechange = function () {\n if (self.iframe.readyState === 'complete') {\n complete();\n }\n };\n } else {\n this.iframe.onload = complete;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/polling-jsonp.js\n// module id = 29\n// module chunks = 0","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parser = require('engine.io-parser');\nvar parseqs = require('parseqs');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:websocket');\n\nvar BrowserWebSocket, NodeWebSocket;\n\nif (typeof WebSocket !== 'undefined') {\n BrowserWebSocket = WebSocket;\n} else if (typeof self !== 'undefined') {\n BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n}\n\nif (typeof window === 'undefined') {\n try {\n NodeWebSocket = require('ws');\n } catch (e) { }\n}\n\n/**\n * Get either the `WebSocket` or `MozWebSocket` globals\n * in the browser or try to resolve WebSocket-compatible\n * interface exposed by `ws` for Node-like environment.\n */\n\nvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\n/**\n * Module exports.\n */\n\nmodule.exports = WS;\n\n/**\n * WebSocket transport constructor.\n *\n * @api {Object} connection options\n * @api public\n */\n\nfunction WS (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (forceBase64) {\n this.supportsBinary = false;\n }\n this.perMessageDeflate = opts.perMessageDeflate;\n this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n this.protocols = opts.protocols;\n if (!this.usingBrowserWebSocket) {\n WebSocketImpl = NodeWebSocket;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(WS, Transport);\n\n/**\n * Transport name.\n *\n * @api public\n */\n\nWS.prototype.name = 'websocket';\n\n/*\n * WebSockets support binary\n */\n\nWS.prototype.supportsBinary = true;\n\n/**\n * Opens socket.\n *\n * @api private\n */\n\nWS.prototype.doOpen = function () {\n if (!this.check()) {\n // let probe timeout\n return;\n }\n\n var uri = this.uri();\n var protocols = this.protocols;\n var opts = {\n agent: this.agent,\n perMessageDeflate: this.perMessageDeflate\n };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n if (this.extraHeaders) {\n opts.headers = this.extraHeaders;\n }\n if (this.localAddress) {\n opts.localAddress = this.localAddress;\n }\n\n try {\n this.ws =\n this.usingBrowserWebSocket && !this.isReactNative\n ? protocols\n ? new WebSocketImpl(uri, protocols)\n : new WebSocketImpl(uri)\n : new WebSocketImpl(uri, protocols, opts);\n } catch (err) {\n return this.emit('error', err);\n }\n\n if (this.ws.binaryType === undefined) {\n this.supportsBinary = false;\n }\n\n if (this.ws.supports && this.ws.supports.binary) {\n this.supportsBinary = true;\n this.ws.binaryType = 'nodebuffer';\n } else {\n this.ws.binaryType = 'arraybuffer';\n }\n\n this.addEventListeners();\n};\n\n/**\n * Adds event listeners to the socket\n *\n * @api private\n */\n\nWS.prototype.addEventListeners = function () {\n var self = this;\n\n this.ws.onopen = function () {\n self.onOpen();\n };\n this.ws.onclose = function () {\n self.onClose();\n };\n this.ws.onmessage = function (ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function (e) {\n self.onError('websocket error', e);\n };\n};\n\n/**\n * Writes data to socket.\n *\n * @param {Array} array of packets.\n * @api private\n */\n\nWS.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n\n // encodePacket efficient as it uses WS framing\n // no need for encodePayload\n var total = packets.length;\n for (var i = 0, l = total; i < l; i++) {\n (function (packet) {\n parser.encodePacket(packet, self.supportsBinary, function (data) {\n if (!self.usingBrowserWebSocket) {\n // always create a new object (GH-437)\n var opts = {};\n if (packet.options) {\n opts.compress = packet.options.compress;\n }\n\n if (self.perMessageDeflate) {\n var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n if (len < self.perMessageDeflate.threshold) {\n opts.compress = false;\n }\n }\n }\n\n // Sometimes the websocket has already been closed but the browser didn't\n // have a chance of informing us about it yet, in that case send will\n // throw an error\n try {\n if (self.usingBrowserWebSocket) {\n // TypeError is thrown when passing the second argument on Safari\n self.ws.send(data);\n } else {\n self.ws.send(data, opts);\n }\n } catch (e) {\n\n }\n\n --total || done();\n });\n })(packets[i]);\n }\n\n function done () {\n self.emit('flush');\n\n // fake drain\n // defer to next tick to allow Socket to clear writeBuffer\n setTimeout(function () {\n self.writable = true;\n self.emit('drain');\n }, 0);\n }\n};\n\n/**\n * Called upon close\n *\n * @api private\n */\n\nWS.prototype.onClose = function () {\n Transport.prototype.onClose.call(this);\n};\n\n/**\n * Closes socket.\n *\n * @api private\n */\n\nWS.prototype.doClose = function () {\n if (typeof this.ws !== 'undefined') {\n this.ws.close();\n }\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nWS.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'wss' : 'ws';\n var port = '';\n\n // avoid port if default for schema\n if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n ('ws' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // append timestamp to URI\n if (this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n/**\n * Feature detection for WebSocket.\n *\n * @return {Boolean} whether this transport is available.\n * @api public\n */\n\nWS.prototype.check = function () {\n return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/engine.io-client/lib/transports/websocket.js\n// module id = 30\n// module chunks = 0","\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/indexof/index.js\n// module id = 32\n// module chunks = 0","\n/**\n * Module dependencies.\n */\n\nvar parser = require('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar toArray = require('to-array');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:socket');\nvar parseqs = require('parseqs');\nvar hasBin = require('has-binary2');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = Socket;\n\n/**\n * Internal events (blacklisted).\n * These events can't be emitted by the user.\n *\n * @api private\n */\n\nvar events = {\n connect: 1,\n connect_error: 1,\n connect_timeout: 1,\n connecting: 1,\n disconnect: 1,\n error: 1,\n reconnect: 1,\n reconnect_attempt: 1,\n reconnect_failed: 1,\n reconnect_error: 1,\n reconnecting: 1,\n ping: 1,\n pong: 1\n};\n\n/**\n * Shortcut to `Emitter#emit`.\n */\n\nvar emit = Emitter.prototype.emit;\n\n/**\n * `Socket` constructor.\n *\n * @api public\n */\n\nfunction Socket (io, nsp, opts) {\n this.io = io;\n this.nsp = nsp;\n this.json = this; // compat\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.connected = false;\n this.disconnected = true;\n this.flags = {};\n if (opts && opts.query) {\n this.query = opts.query;\n }\n if (this.io.autoConnect) this.open();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Subscribe to open, close and packet events\n *\n * @api private\n */\n\nSocket.prototype.subEvents = function () {\n if (this.subs) return;\n\n var io = this.io;\n this.subs = [\n on(io, 'open', bind(this, 'onopen')),\n on(io, 'packet', bind(this, 'onpacket')),\n on(io, 'close', bind(this, 'onclose'))\n ];\n};\n\n/**\n * \"Opens\" the socket.\n *\n * @api public\n */\n\nSocket.prototype.open =\nSocket.prototype.connect = function () {\n if (this.connected) return this;\n\n this.subEvents();\n this.io.open(); // ensure open\n if ('open' === this.io.readyState) this.onopen();\n this.emit('connecting');\n return this;\n};\n\n/**\n * Sends a `message` event.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.send = function () {\n var args = toArray(arguments);\n args.unshift('message');\n this.emit.apply(this, args);\n return this;\n};\n\n/**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @param {String} event name\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.emit = function (ev) {\n if (events.hasOwnProperty(ev)) {\n emit.apply(this, arguments);\n return this;\n }\n\n var args = toArray(arguments);\n var packet = {\n type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n data: args\n };\n\n packet.options = {};\n packet.options.compress = !this.flags || false !== this.flags.compress;\n\n // event ack callback\n if ('function' === typeof args[args.length - 1]) {\n\n this.acks[this.ids] = args.pop();\n packet.id = this.ids++;\n }\n\n if (this.connected) {\n this.packet(packet);\n } else {\n this.sendBuffer.push(packet);\n }\n\n this.flags = {};\n\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.packet = function (packet) {\n packet.nsp = this.nsp;\n this.io.packet(packet);\n};\n\n/**\n * Called upon engine `open`.\n *\n * @api private\n */\n\nSocket.prototype.onopen = function () {\n\n\n // write connect packet if necessary\n if ('/' !== this.nsp) {\n if (this.query) {\n var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;\n\n this.packet({type: parser.CONNECT, query: query});\n } else {\n this.packet({type: parser.CONNECT});\n }\n }\n};\n\n/**\n * Called upon engine `close`.\n *\n * @param {String} reason\n * @api private\n */\n\nSocket.prototype.onclose = function (reason) {\n\n this.connected = false;\n this.disconnected = true;\n delete this.id;\n this.emit('disconnect', reason);\n};\n\n/**\n * Called with socket packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onpacket = function (packet) {\n var sameNamespace = packet.nsp === this.nsp;\n var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\n if (!sameNamespace && !rootNamespaceError) return;\n\n switch (packet.type) {\n case parser.CONNECT:\n this.onconnect();\n break;\n\n case parser.EVENT:\n this.onevent(packet);\n break;\n\n case parser.BINARY_EVENT:\n this.onevent(packet);\n break;\n\n case parser.ACK:\n this.onack(packet);\n break;\n\n case parser.BINARY_ACK:\n this.onack(packet);\n break;\n\n case parser.DISCONNECT:\n this.ondisconnect();\n break;\n\n case parser.ERROR:\n this.emit('error', packet.data);\n break;\n }\n};\n\n/**\n * Called upon a server event.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onevent = function (packet) {\n var args = packet.data || [];\n\n\n if (null != packet.id) {\n\n args.push(this.ack(packet.id));\n }\n\n if (this.connected) {\n emit.apply(this, args);\n } else {\n this.receiveBuffer.push(args);\n }\n};\n\n/**\n * Produces an ack callback to emit with an event.\n *\n * @api private\n */\n\nSocket.prototype.ack = function (id) {\n var self = this;\n var sent = false;\n return function () {\n // prevent double callbacks\n if (sent) return;\n sent = true;\n var args = toArray(arguments);\n\n\n self.packet({\n type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n id: id,\n data: args\n });\n };\n};\n\n/**\n * Called upon a server acknowlegement.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onack = function (packet) {\n var ack = this.acks[packet.id];\n if ('function' === typeof ack) {\n\n ack.apply(this, packet.data);\n delete this.acks[packet.id];\n } else {\n\n }\n};\n\n/**\n * Called upon server connect.\n *\n * @api private\n */\n\nSocket.prototype.onconnect = function () {\n this.connected = true;\n this.disconnected = false;\n this.emit('connect');\n this.emitBuffered();\n};\n\n/**\n * Emit buffered events (received and emitted).\n *\n * @api private\n */\n\nSocket.prototype.emitBuffered = function () {\n var i;\n for (i = 0; i < this.receiveBuffer.length; i++) {\n emit.apply(this, this.receiveBuffer[i]);\n }\n this.receiveBuffer = [];\n\n for (i = 0; i < this.sendBuffer.length; i++) {\n this.packet(this.sendBuffer[i]);\n }\n this.sendBuffer = [];\n};\n\n/**\n * Called upon server disconnect.\n *\n * @api private\n */\n\nSocket.prototype.ondisconnect = function () {\n\n this.destroy();\n this.onclose('io server disconnect');\n};\n\n/**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @api private.\n */\n\nSocket.prototype.destroy = function () {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n for (var i = 0; i < this.subs.length; i++) {\n this.subs[i].destroy();\n }\n this.subs = null;\n }\n\n this.io.destroy(this);\n};\n\n/**\n * Disconnects the socket manually.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.close =\nSocket.prototype.disconnect = function () {\n if (this.connected) {\n\n this.packet({ type: parser.DISCONNECT });\n }\n\n // remove socket from pool\n this.destroy();\n\n if (this.connected) {\n // fire events\n this.onclose('io client disconnect');\n }\n return this;\n};\n\n/**\n * Sets the compress flag.\n *\n * @param {Boolean} if `true`, compresses the sending data\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.compress = function (compress) {\n this.flags.compress = compress;\n return this;\n};\n\n/**\n * Sets the binary flag\n *\n * @param {Boolean} whether the emitted data contains binary\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.binary = function (binary) {\n this.flags.binary = binary;\n return this;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./lib/socket.js","module.exports = toArray\n\nfunction toArray(list, index) {\n var array = []\n\n index = index || 0\n\n for (var i = index || 0; i < list.length; i++) {\n array[i - index] = list[i]\n }\n\n return array\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/to-array/index.js\n// module id = 34\n// module chunks = 0","\n/**\n * Module exports.\n */\n\nmodule.exports = on;\n\n/**\n * Helper for subscriptions.\n *\n * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n * @param {String} event name\n * @param {Function} callback\n * @api public\n */\n\nfunction on (obj, ev, fn) {\n obj.on(ev, fn);\n return {\n destroy: function () {\n obj.removeListener(ev, fn);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/on.js","/**\n * Slice reference.\n */\n\nvar slice = [].slice;\n\n/**\n * Bind `obj` to `fn`.\n *\n * @param {Object} obj\n * @param {Function|String} fn or string\n * @return {Function}\n * @api public\n */\n\nmodule.exports = function(obj, fn){\n if ('string' == typeof fn) fn = obj[fn];\n if ('function' != typeof fn) throw new Error('bind() requires a function');\n var args = slice.call(arguments, 2);\n return function(){\n return fn.apply(obj, args.concat(slice.call(arguments)));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/component-bind/index.js\n// module id = 36\n// module chunks = 0","\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/backo2/index.js\n// module id = 37\n// module chunks = 0"],"sourceRoot":""}+ \ No newline at end of file diff --git a/node_modules/socket.io-client/lib/index.js b/node_modules/socket.io-client/lib/index.js @@ -0,0 +1,94 @@ + +/** + * Module dependencies. + */ + +var url = require('./url'); +var parser = require('socket.io-parser'); +var Manager = require('./manager'); +var debug = require('debug')('socket.io-client'); + +/** + * Module exports. + */ + +module.exports = exports = lookup; + +/** + * Managers cache. + */ + +var cache = exports.managers = {}; + +/** + * Looks up an existing `Manager` for multiplexing. + * If the user summons: + * + * `io('http://localhost/a');` + * `io('http://localhost/b');` + * + * We reuse the existing instance based on same scheme/port/host, + * and we initialize sockets for each namespace. + * + * @api public + */ + +function lookup (uri, opts) { + if (typeof uri === 'object') { + opts = uri; + uri = undefined; + } + + opts = opts || {}; + + var parsed = url(uri); + var source = parsed.source; + var id = parsed.id; + var path = parsed.path; + var sameNamespace = cache[id] && path in cache[id].nsps; + var newConnection = opts.forceNew || opts['force new connection'] || + false === opts.multiplex || sameNamespace; + + var io; + + if (newConnection) { + debug('ignoring socket cache for %s', source); + io = Manager(source, opts); + } else { + if (!cache[id]) { + debug('new io instance for %s', source); + cache[id] = Manager(source, opts); + } + io = cache[id]; + } + if (parsed.query && !opts.query) { + opts.query = parsed.query; + } + return io.socket(parsed.path, opts); +} + +/** + * Protocol version. + * + * @api public + */ + +exports.protocol = parser.protocol; + +/** + * `connect`. + * + * @param {String} uri + * @api public + */ + +exports.connect = lookup; + +/** + * Expose constructors for standalone build. + * + * @api public + */ + +exports.Manager = require('./manager'); +exports.Socket = require('./socket'); diff --git a/node_modules/socket.io-client/lib/manager.js b/node_modules/socket.io-client/lib/manager.js @@ -0,0 +1,573 @@ + +/** + * Module dependencies. + */ + +var eio = require('engine.io-client'); +var Socket = require('./socket'); +var Emitter = require('component-emitter'); +var parser = require('socket.io-parser'); +var on = require('./on'); +var bind = require('component-bind'); +var debug = require('debug')('socket.io-client:manager'); +var indexOf = require('indexof'); +var Backoff = require('backo2'); + +/** + * IE6+ hasOwnProperty + */ + +var has = Object.prototype.hasOwnProperty; + +/** + * Module exports + */ + +module.exports = Manager; + +/** + * `Manager` constructor. + * + * @param {String} engine instance or engine uri/opts + * @param {Object} options + * @api public + */ + +function Manager (uri, opts) { + if (!(this instanceof Manager)) return new Manager(uri, opts); + if (uri && ('object' === typeof uri)) { + opts = uri; + uri = undefined; + } + opts = opts || {}; + + opts.path = opts.path || '/socket.io'; + this.nsps = {}; + this.subs = []; + this.opts = opts; + this.reconnection(opts.reconnection !== false); + this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); + this.reconnectionDelay(opts.reconnectionDelay || 1000); + this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); + this.randomizationFactor(opts.randomizationFactor || 0.5); + this.backoff = new Backoff({ + min: this.reconnectionDelay(), + max: this.reconnectionDelayMax(), + jitter: this.randomizationFactor() + }); + this.timeout(null == opts.timeout ? 20000 : opts.timeout); + this.readyState = 'closed'; + this.uri = uri; + this.connecting = []; + this.lastPing = null; + this.encoding = false; + this.packetBuffer = []; + var _parser = opts.parser || parser; + this.encoder = new _parser.Encoder(); + this.decoder = new _parser.Decoder(); + this.autoConnect = opts.autoConnect !== false; + if (this.autoConnect) this.open(); +} + +/** + * Propagate given event to sockets and emit on `this` + * + * @api private + */ + +Manager.prototype.emitAll = function () { + this.emit.apply(this, arguments); + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); + } + } +}; + +/** + * Update `socket.id` of all sockets + * + * @api private + */ + +Manager.prototype.updateSocketIds = function () { + for (var nsp in this.nsps) { + if (has.call(this.nsps, nsp)) { + this.nsps[nsp].id = this.generateId(nsp); + } + } +}; + +/** + * generate `socket.id` for the given `nsp` + * + * @param {String} nsp + * @return {String} + * @api private + */ + +Manager.prototype.generateId = function (nsp) { + return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id; +}; + +/** + * Mix in `Emitter`. + */ + +Emitter(Manager.prototype); + +/** + * Sets the `reconnection` config. + * + * @param {Boolean} true/false if it should automatically reconnect + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnection = function (v) { + if (!arguments.length) return this._reconnection; + this._reconnection = !!v; + return this; +}; + +/** + * Sets the reconnection attempts config. + * + * @param {Number} max reconnection attempts before giving up + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionAttempts = function (v) { + if (!arguments.length) return this._reconnectionAttempts; + this._reconnectionAttempts = v; + return this; +}; + +/** + * Sets the delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionDelay = function (v) { + if (!arguments.length) return this._reconnectionDelay; + this._reconnectionDelay = v; + this.backoff && this.backoff.setMin(v); + return this; +}; + +Manager.prototype.randomizationFactor = function (v) { + if (!arguments.length) return this._randomizationFactor; + this._randomizationFactor = v; + this.backoff && this.backoff.setJitter(v); + return this; +}; + +/** + * Sets the maximum delay between reconnections. + * + * @param {Number} delay + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.reconnectionDelayMax = function (v) { + if (!arguments.length) return this._reconnectionDelayMax; + this._reconnectionDelayMax = v; + this.backoff && this.backoff.setMax(v); + return this; +}; + +/** + * Sets the connection timeout. `false` to disable + * + * @return {Manager} self or value + * @api public + */ + +Manager.prototype.timeout = function (v) { + if (!arguments.length) return this._timeout; + this._timeout = v; + return this; +}; + +/** + * Starts trying to reconnect if reconnection is enabled and we have not + * started reconnecting yet + * + * @api private + */ + +Manager.prototype.maybeReconnectOnOpen = function () { + // Only try to reconnect if it's the first time we're connecting + if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) { + // keeps reconnection from firing twice for the same reconnection loop + this.reconnect(); + } +}; + +/** + * Sets the current transport `socket`. + * + * @param {Function} optional, callback + * @return {Manager} self + * @api public + */ + +Manager.prototype.open = +Manager.prototype.connect = function (fn, opts) { + debug('readyState %s', this.readyState); + if (~this.readyState.indexOf('open')) return this; + + debug('opening %s', this.uri); + this.engine = eio(this.uri, this.opts); + var socket = this.engine; + var self = this; + this.readyState = 'opening'; + this.skipReconnect = false; + + // emit `open` + var openSub = on(socket, 'open', function () { + self.onopen(); + fn && fn(); + }); + + // emit `connect_error` + var errorSub = on(socket, 'error', function (data) { + debug('connect_error'); + self.cleanup(); + self.readyState = 'closed'; + self.emitAll('connect_error', data); + if (fn) { + var err = new Error('Connection error'); + err.data = data; + fn(err); + } else { + // Only do this if there is no fn to handle the error + self.maybeReconnectOnOpen(); + } + }); + + // emit `connect_timeout` + if (false !== this._timeout) { + var timeout = this._timeout; + debug('connect attempt will timeout after %d', timeout); + + // set timer + var timer = setTimeout(function () { + debug('connect attempt timed out after %d', timeout); + openSub.destroy(); + socket.close(); + socket.emit('error', 'timeout'); + self.emitAll('connect_timeout', timeout); + }, timeout); + + this.subs.push({ + destroy: function () { + clearTimeout(timer); + } + }); + } + + this.subs.push(openSub); + this.subs.push(errorSub); + + return this; +}; + +/** + * Called upon transport open. + * + * @api private + */ + +Manager.prototype.onopen = function () { + debug('open'); + + // clear old subs + this.cleanup(); + + // mark as open + this.readyState = 'open'; + this.emit('open'); + + // add new subs + var socket = this.engine; + this.subs.push(on(socket, 'data', bind(this, 'ondata'))); + this.subs.push(on(socket, 'ping', bind(this, 'onping'))); + this.subs.push(on(socket, 'pong', bind(this, 'onpong'))); + this.subs.push(on(socket, 'error', bind(this, 'onerror'))); + this.subs.push(on(socket, 'close', bind(this, 'onclose'))); + this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); +}; + +/** + * Called upon a ping. + * + * @api private + */ + +Manager.prototype.onping = function () { + this.lastPing = new Date(); + this.emitAll('ping'); +}; + +/** + * Called upon a packet. + * + * @api private + */ + +Manager.prototype.onpong = function () { + this.emitAll('pong', new Date() - this.lastPing); +}; + +/** + * Called with data. + * + * @api private + */ + +Manager.prototype.ondata = function (data) { + this.decoder.add(data); +}; + +/** + * Called when parser fully decodes a packet. + * + * @api private + */ + +Manager.prototype.ondecoded = function (packet) { + this.emit('packet', packet); +}; + +/** + * Called upon socket error. + * + * @api private + */ + +Manager.prototype.onerror = function (err) { + debug('error', err); + this.emitAll('error', err); +}; + +/** + * Creates a new socket for the given `nsp`. + * + * @return {Socket} + * @api public + */ + +Manager.prototype.socket = function (nsp, opts) { + var socket = this.nsps[nsp]; + if (!socket) { + socket = new Socket(this, nsp, opts); + this.nsps[nsp] = socket; + var self = this; + socket.on('connecting', onConnecting); + socket.on('connect', function () { + socket.id = self.generateId(nsp); + }); + + if (this.autoConnect) { + // manually call here since connecting event is fired before listening + onConnecting(); + } + } + + function onConnecting () { + if (!~indexOf(self.connecting, socket)) { + self.connecting.push(socket); + } + } + + return socket; +}; + +/** + * Called upon a socket close. + * + * @param {Socket} socket + */ + +Manager.prototype.destroy = function (socket) { + var index = indexOf(this.connecting, socket); + if (~index) this.connecting.splice(index, 1); + if (this.connecting.length) return; + + this.close(); +}; + +/** + * Writes a packet. + * + * @param {Object} packet + * @api private + */ + +Manager.prototype.packet = function (packet) { + debug('writing packet %j', packet); + var self = this; + if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query; + + if (!self.encoding) { + // encode, then write to engine with result + self.encoding = true; + this.encoder.encode(packet, function (encodedPackets) { + for (var i = 0; i < encodedPackets.length; i++) { + self.engine.write(encodedPackets[i], packet.options); + } + self.encoding = false; + self.processPacketQueue(); + }); + } else { // add packet to the queue + self.packetBuffer.push(packet); + } +}; + +/** + * If packet buffer is non-empty, begins encoding the + * next packet in line. + * + * @api private + */ + +Manager.prototype.processPacketQueue = function () { + if (this.packetBuffer.length > 0 && !this.encoding) { + var pack = this.packetBuffer.shift(); + this.packet(pack); + } +}; + +/** + * Clean up transport subscriptions and packet buffer. + * + * @api private + */ + +Manager.prototype.cleanup = function () { + debug('cleanup'); + + var subsLength = this.subs.length; + for (var i = 0; i < subsLength; i++) { + var sub = this.subs.shift(); + sub.destroy(); + } + + this.packetBuffer = []; + this.encoding = false; + this.lastPing = null; + + this.decoder.destroy(); +}; + +/** + * Close the current socket. + * + * @api private + */ + +Manager.prototype.close = +Manager.prototype.disconnect = function () { + debug('disconnect'); + this.skipReconnect = true; + this.reconnecting = false; + if ('opening' === this.readyState) { + // `onclose` will not fire because + // an open event never happened + this.cleanup(); + } + this.backoff.reset(); + this.readyState = 'closed'; + if (this.engine) this.engine.close(); +}; + +/** + * Called upon engine close. + * + * @api private + */ + +Manager.prototype.onclose = function (reason) { + debug('onclose'); + + this.cleanup(); + this.backoff.reset(); + this.readyState = 'closed'; + this.emit('close', reason); + + if (this._reconnection && !this.skipReconnect) { + this.reconnect(); + } +}; + +/** + * Attempt a reconnection. + * + * @api private + */ + +Manager.prototype.reconnect = function () { + if (this.reconnecting || this.skipReconnect) return this; + + var self = this; + + if (this.backoff.attempts >= this._reconnectionAttempts) { + debug('reconnect failed'); + this.backoff.reset(); + this.emitAll('reconnect_failed'); + this.reconnecting = false; + } else { + var delay = this.backoff.duration(); + debug('will wait %dms before reconnect attempt', delay); + + this.reconnecting = true; + var timer = setTimeout(function () { + if (self.skipReconnect) return; + + debug('attempting reconnect'); + self.emitAll('reconnect_attempt', self.backoff.attempts); + self.emitAll('reconnecting', self.backoff.attempts); + + // check again for the case socket closed in above events + if (self.skipReconnect) return; + + self.open(function (err) { + if (err) { + debug('reconnect attempt error'); + self.reconnecting = false; + self.reconnect(); + self.emitAll('reconnect_error', err.data); + } else { + debug('reconnect success'); + self.onreconnect(); + } + }); + }, delay); + + this.subs.push({ + destroy: function () { + clearTimeout(timer); + } + }); + } +}; + +/** + * Called upon successful reconnect. + * + * @api private + */ + +Manager.prototype.onreconnect = function () { + var attempt = this.backoff.attempts; + this.reconnecting = false; + this.backoff.reset(); + this.updateSocketIds(); + this.emitAll('reconnect', attempt); +}; diff --git a/node_modules/socket.io-client/lib/on.js b/node_modules/socket.io-client/lib/on.js @@ -0,0 +1,24 @@ + +/** + * Module exports. + */ + +module.exports = on; + +/** + * Helper for subscriptions. + * + * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` + * @param {String} event name + * @param {Function} callback + * @api public + */ + +function on (obj, ev, fn) { + obj.on(ev, fn); + return { + destroy: function () { + obj.removeListener(ev, fn); + } + }; +} diff --git a/node_modules/socket.io-client/lib/socket.js b/node_modules/socket.io-client/lib/socket.js @@ -0,0 +1,438 @@ + +/** + * Module dependencies. + */ + +var parser = require('socket.io-parser'); +var Emitter = require('component-emitter'); +var toArray = require('to-array'); +var on = require('./on'); +var bind = require('component-bind'); +var debug = require('debug')('socket.io-client:socket'); +var parseqs = require('parseqs'); +var hasBin = require('has-binary2'); + +/** + * Module exports. + */ + +module.exports = exports = Socket; + +/** + * Internal events (blacklisted). + * These events can't be emitted by the user. + * + * @api private + */ + +var events = { + connect: 1, + connect_error: 1, + connect_timeout: 1, + connecting: 1, + disconnect: 1, + error: 1, + reconnect: 1, + reconnect_attempt: 1, + reconnect_failed: 1, + reconnect_error: 1, + reconnecting: 1, + ping: 1, + pong: 1 +}; + +/** + * Shortcut to `Emitter#emit`. + */ + +var emit = Emitter.prototype.emit; + +/** + * `Socket` constructor. + * + * @api public + */ + +function Socket (io, nsp, opts) { + this.io = io; + this.nsp = nsp; + this.json = this; // compat + this.ids = 0; + this.acks = {}; + this.receiveBuffer = []; + this.sendBuffer = []; + this.connected = false; + this.disconnected = true; + this.flags = {}; + if (opts && opts.query) { + this.query = opts.query; + } + if (this.io.autoConnect) this.open(); +} + +/** + * Mix in `Emitter`. + */ + +Emitter(Socket.prototype); + +/** + * Subscribe to open, close and packet events + * + * @api private + */ + +Socket.prototype.subEvents = function () { + if (this.subs) return; + + var io = this.io; + this.subs = [ + on(io, 'open', bind(this, 'onopen')), + on(io, 'packet', bind(this, 'onpacket')), + on(io, 'close', bind(this, 'onclose')) + ]; +}; + +/** + * "Opens" the socket. + * + * @api public + */ + +Socket.prototype.open = +Socket.prototype.connect = function () { + if (this.connected) return this; + + this.subEvents(); + this.io.open(); // ensure open + if ('open' === this.io.readyState) this.onopen(); + this.emit('connecting'); + return this; +}; + +/** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.send = function () { + var args = toArray(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; + +/** + * Override `emit`. + * If the event is in `events`, it's emitted normally. + * + * @param {String} event name + * @return {Socket} self + * @api public + */ + +Socket.prototype.emit = function (ev) { + if (events.hasOwnProperty(ev)) { + emit.apply(this, arguments); + return this; + } + + var args = toArray(arguments); + var packet = { + type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT, + data: args + }; + + packet.options = {}; + packet.options.compress = !this.flags || false !== this.flags.compress; + + // event ack callback + if ('function' === typeof args[args.length - 1]) { + debug('emitting packet with ack id %d', this.ids); + this.acks[this.ids] = args.pop(); + packet.id = this.ids++; + } + + if (this.connected) { + this.packet(packet); + } else { + this.sendBuffer.push(packet); + } + + this.flags = {}; + + return this; +}; + +/** + * Sends a packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.packet = function (packet) { + packet.nsp = this.nsp; + this.io.packet(packet); +}; + +/** + * Called upon engine `open`. + * + * @api private + */ + +Socket.prototype.onopen = function () { + debug('transport is open - connecting'); + + // write connect packet if necessary + if ('/' !== this.nsp) { + if (this.query) { + var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query; + debug('sending connect packet with query %s', query); + this.packet({type: parser.CONNECT, query: query}); + } else { + this.packet({type: parser.CONNECT}); + } + } +}; + +/** + * Called upon engine `close`. + * + * @param {String} reason + * @api private + */ + +Socket.prototype.onclose = function (reason) { + debug('close (%s)', reason); + this.connected = false; + this.disconnected = true; + delete this.id; + this.emit('disconnect', reason); +}; + +/** + * Called with socket packet. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onpacket = function (packet) { + var sameNamespace = packet.nsp === this.nsp; + var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/'; + + if (!sameNamespace && !rootNamespaceError) return; + + switch (packet.type) { + case parser.CONNECT: + this.onconnect(); + break; + + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.emit('error', packet.data); + break; + } +}; + +/** + * Called upon a server event. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onevent = function (packet) { + var args = packet.data || []; + debug('emitting event %j', args); + + if (null != packet.id) { + debug('attaching ack callback to event'); + args.push(this.ack(packet.id)); + } + + if (this.connected) { + emit.apply(this, args); + } else { + this.receiveBuffer.push(args); + } +}; + +/** + * Produces an ack callback to emit with an event. + * + * @api private + */ + +Socket.prototype.ack = function (id) { + var self = this; + var sent = false; + return function () { + // prevent double callbacks + if (sent) return; + sent = true; + var args = toArray(arguments); + debug('sending ack %j', args); + + self.packet({ + type: hasBin(args) ? parser.BINARY_ACK : parser.ACK, + id: id, + data: args + }); + }; +}; + +/** + * Called upon a server acknowlegement. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onack = function (packet) { + var ack = this.acks[packet.id]; + if ('function' === typeof ack) { + debug('calling ack %s with %j', packet.id, packet.data); + ack.apply(this, packet.data); + delete this.acks[packet.id]; + } else { + debug('bad ack %s', packet.id); + } +}; + +/** + * Called upon server connect. + * + * @api private + */ + +Socket.prototype.onconnect = function () { + this.connected = true; + this.disconnected = false; + this.emit('connect'); + this.emitBuffered(); +}; + +/** + * Emit buffered events (received and emitted). + * + * @api private + */ + +Socket.prototype.emitBuffered = function () { + var i; + for (i = 0; i < this.receiveBuffer.length; i++) { + emit.apply(this, this.receiveBuffer[i]); + } + this.receiveBuffer = []; + + for (i = 0; i < this.sendBuffer.length; i++) { + this.packet(this.sendBuffer[i]); + } + this.sendBuffer = []; +}; + +/** + * Called upon server disconnect. + * + * @api private + */ + +Socket.prototype.ondisconnect = function () { + debug('server disconnect (%s)', this.nsp); + this.destroy(); + this.onclose('io server disconnect'); +}; + +/** + * Called upon forced client/server side disconnections, + * this method ensures the manager stops tracking us and + * that reconnections don't get triggered for this. + * + * @api private. + */ + +Socket.prototype.destroy = function () { + if (this.subs) { + // clean subscriptions to avoid reconnections + for (var i = 0; i < this.subs.length; i++) { + this.subs[i].destroy(); + } + this.subs = null; + } + + this.io.destroy(this); +}; + +/** + * Disconnects the socket manually. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.close = +Socket.prototype.disconnect = function () { + if (this.connected) { + debug('performing disconnect (%s)', this.nsp); + this.packet({ type: parser.DISCONNECT }); + } + + // remove socket from pool + this.destroy(); + + if (this.connected) { + // fire events + this.onclose('io client disconnect'); + } + return this; +}; + +/** + * Sets the compress flag. + * + * @param {Boolean} if `true`, compresses the sending data + * @return {Socket} self + * @api public + */ + +Socket.prototype.compress = function (compress) { + this.flags.compress = compress; + return this; +}; + +/** + * Sets the binary flag + * + * @param {Boolean} whether the emitted data contains binary + * @return {Socket} self + * @api public + */ + +Socket.prototype.binary = function (binary) { + this.flags.binary = binary; + return this; +}; diff --git a/node_modules/socket.io-client/lib/url.js b/node_modules/socket.io-client/lib/url.js @@ -0,0 +1,75 @@ + +/** + * Module dependencies. + */ + +var parseuri = require('parseuri'); +var debug = require('debug')('socket.io-client:url'); + +/** + * Module exports. + */ + +module.exports = url; + +/** + * URL parser. + * + * @param {String} url + * @param {Object} An object meant to mimic window.location. + * Defaults to window.location. + * @api public + */ + +function url (uri, loc) { + var obj = uri; + + // default to window.location + loc = loc || (typeof location !== 'undefined' && location); + if (null == uri) uri = loc.protocol + '//' + loc.host; + + // relative path support + if ('string' === typeof uri) { + if ('/' === uri.charAt(0)) { + if ('/' === uri.charAt(1)) { + uri = loc.protocol + uri; + } else { + uri = loc.host + uri; + } + } + + if (!/^(https?|wss?):\/\//.test(uri)) { + debug('protocol-less url %s', uri); + if ('undefined' !== typeof loc) { + uri = loc.protocol + '//' + uri; + } else { + uri = 'https://' + uri; + } + } + + // parse + debug('parse %s', uri); + obj = parseuri(uri); + } + + // make sure we treat `localhost:80` and `localhost` equally + if (!obj.port) { + if (/^(http|ws)$/.test(obj.protocol)) { + obj.port = '80'; + } else if (/^(http|ws)s$/.test(obj.protocol)) { + obj.port = '443'; + } + } + + obj.path = obj.path || '/'; + + var ipv6 = obj.host.indexOf(':') !== -1; + var host = ipv6 ? '[' + obj.host + ']' : obj.host; + + // define unique id + obj.id = obj.protocol + '://' + host + ':' + obj.port; + // define href + obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port)); + + return obj; +} diff --git a/node_modules/socket.io-client/node_modules/debug/CHANGELOG.md b/node_modules/socket.io-client/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/socket.io-client/node_modules/debug/LICENSE b/node_modules/socket.io-client/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/socket.io-client/node_modules/debug/README.md b/node_modules/socket.io-client/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + +<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png"> + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + +<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png"> + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png"> + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + +<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + +<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a> + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io-client/node_modules/debug/dist/debug.js b/node_modules/socket.io-client/node_modules/debug/dist/debug.js @@ -0,0 +1,912 @@ +"use strict"; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + + g.debug = f(); + } +})(function () { + var define, module, exports; + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require; + if (!f && c) return c(i, !0); + if (u) return u(i, !0); + var a = new Error("Cannot find module '" + i + "'"); + throw a.code = "MODULE_NOT_FOUND", a; + } + + var p = n[i] = { + exports: {} + }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + + return n[i].exports; + } + + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + } + + return o; + } + + return r; + }()({ + 1: [function (require, module, exports) { + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + + var type = _typeof(val); + + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(str) { + str = String(str); + + if (str.length > 100) { + return; + } + + var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + + if (!match) { + return; + } + + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + + case 'weeks': + case 'week': + case 'w': + return n * w; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + + default: + return undefined; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + + return ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + }, {}], + 2: [function (require, module, exports) { + // shim for using process in browser + var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; // v8 likes predictible objects + + + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { + return '/'; + }; + + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + + process.umask = function () { + return 0; + }; + }, {}], + 3: [function (require, module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + + + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + + + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; + } + + module.exports = setup; + }, { + "ms": 1 + }], + 4: [function (require, module, exports) { + (function (process) { + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + // eslint-disable-next-line complexity + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + + function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = require('./common')(exports); + var formatters = module.exports.formatters; + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + }).call(this, require('_process')); + }, { + "./common": 3, + "_process": 2 + }] + }, {}, [4])(4); +}); diff --git a/node_modules/socket.io-client/node_modules/debug/package.json b/node_modules/socket.io-client/node_modules/debug/package.json @@ -0,0 +1,102 @@ +{ + "_from": "debug@~4.1.0", + "_id": "debug@4.1.1", + "_inBundle": false, + "_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "_location": "/socket.io-client/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@~4.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "~4.1.0", + "saveSpec": null, + "fetchSpec": "~4.1.0" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "_shasum": "3b72260255109c6b589cee050f1d516139664791", + "_spec": "debug@~4.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "scripts": { + "build": "npm run build:debug && npm run build:test", + "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", + "build:test": "babel -d dist test.js", + "clean": "rimraf dist coverage", + "lint": "xo", + "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", + "pretest:browser": "npm run build", + "test": "npm run test:node && npm run test:browser", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "unpkg": "./dist/debug.js", + "version": "4.1.1" +} diff --git a/node_modules/socket.io-client/node_modules/debug/src/browser.js b/node_modules/socket.io-client/node_modules/debug/src/browser.js @@ -0,0 +1,264 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/socket.io-client/node_modules/debug/src/common.js b/node_modules/socket.io-client/node_modules/debug/src/common.js @@ -0,0 +1,266 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/socket.io-client/node_modules/debug/src/index.js b/node_modules/socket.io-client/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/socket.io-client/node_modules/debug/src/node.js b/node_modules/socket.io-client/node_modules/debug/src/node.js @@ -0,0 +1,257 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/socket.io-client/node_modules/ms/index.js b/node_modules/socket.io-client/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/socket.io-client/node_modules/ms/license.md b/node_modules/socket.io-client/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/socket.io-client/node_modules/ms/package.json b/node_modules/socket.io-client/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/socket.io-client/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/socket.io-client/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@^2.1.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/node_modules/socket.io-client/node_modules/ms/readme.md b/node_modules/socket.io-client/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/LICENSE b/node_modules/socket.io-client/node_modules/socket.io-parser/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch <guillermo@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the 'Software'), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/Readme.md b/node_modules/socket.io-client/node_modules/socket.io-parser/Readme.md @@ -0,0 +1,73 @@ + +# socket.io-parser + +[![Build Status](https://secure.travis-ci.org/socketio/socket.io-parser.svg?branch=master)](http://travis-ci.org/socketio/socket.io-parser) +[![NPM version](https://badge.fury.io/js/socket.io-parser.svg)](http://badge.fury.io/js/socket.io-parser) + +A socket.io encoder and decoder written in JavaScript complying with version `3` +of [socket.io-protocol](https://github.com/socketio/socket.io-protocol). +Used by [socket.io](https://github.com/automattic/socket.io) and +[socket.io-client](https://github.com/automattic/socket.io-client). + +## Parser API + + socket.io-parser is the reference implementation of socket.io-protocol. Read + the full API here: + [socket.io-protocol](https://github.com/learnboost/socket.io-protocol). + +## Example Usage + +### Encoding and decoding a packet + +```js +var parser = require('socket.io-parser'); +var encoder = new parser.Encoder(); +var packet = { + type: parser.EVENT, + data: 'test-packet', + id: 13 +}; +encoder.encode(packet, function(encodedPackets) { + var decoder = new parser.Decoder(); + decoder.on('decoded', function(decodedPacket) { + // decodedPacket.type == parser.EVENT + // decodedPacket.data == 'test-packet' + // decodedPacket.id == 13 + }); + + for (var i = 0; i < encodedPackets.length; i++) { + decoder.add(encodedPackets[i]); + } +}); +``` + +### Encoding and decoding a packet with binary data + +```js +var parser = require('socket.io-parser'); +var encoder = new parser.Encoder(); +var packet = { + type: parser.BINARY_EVENT, + data: {i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)])} + id: 15 +}; +encoder.encode(packet, function(encodedPackets) { + var decoder = new parser.Decoder(); + decoder.on('decoded', function(decodedPacket) { + // decodedPacket.type == parser.BINARY_EVENT + // Buffer.isBuffer(decodedPacket.data.i) == true + // Buffer.isBuffer(decodedPacket.data.j) == true + // decodedPacket.id == 15 + }); + + for (var i = 0; i < encodedPackets.length; i++) { + decoder.add(encodedPackets[i]); + } +}); +``` +See the test suite for more examples of how socket.io-parser is used. + + +## License + +MIT diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/binary.js b/node_modules/socket.io-client/node_modules/socket.io-parser/binary.js @@ -0,0 +1,141 @@ +/*global Blob,File*/ + +/** + * Module requirements + */ + +var isArray = require('isarray'); +var isBuf = require('./is-buffer'); +var toString = Object.prototype.toString; +var withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'); +var withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'); + +/** + * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder. + * Anything with blobs or files should be fed through removeBlobs before coming + * here. + * + * @param {Object} packet - socket.io event packet + * @return {Object} with deconstructed packet and list of buffers + * @api public + */ + +exports.deconstructPacket = function(packet) { + var buffers = []; + var packetData = packet.data; + var pack = packet; + pack.data = _deconstructPacket(packetData, buffers); + pack.attachments = buffers.length; // number of binary 'attachments' + return {packet: pack, buffers: buffers}; +}; + +function _deconstructPacket(data, buffers) { + if (!data) return data; + + if (isBuf(data)) { + var placeholder = { _placeholder: true, num: buffers.length }; + buffers.push(data); + return placeholder; + } else if (isArray(data)) { + var newData = new Array(data.length); + for (var i = 0; i < data.length; i++) { + newData[i] = _deconstructPacket(data[i], buffers); + } + return newData; + } else if (typeof data === 'object' && !(data instanceof Date)) { + var newData = {}; + for (var key in data) { + newData[key] = _deconstructPacket(data[key], buffers); + } + return newData; + } + return data; +} + +/** + * Reconstructs a binary packet from its placeholder packet and buffers + * + * @param {Object} packet - event packet with placeholders + * @param {Array} buffers - binary buffers to put in placeholder positions + * @return {Object} reconstructed packet + * @api public + */ + +exports.reconstructPacket = function(packet, buffers) { + packet.data = _reconstructPacket(packet.data, buffers); + packet.attachments = undefined; // no longer useful + return packet; +}; + +function _reconstructPacket(data, buffers) { + if (!data) return data; + + if (data && data._placeholder) { + return buffers[data.num]; // appropriate buffer (should be natural order anyway) + } else if (isArray(data)) { + for (var i = 0; i < data.length; i++) { + data[i] = _reconstructPacket(data[i], buffers); + } + } else if (typeof data === 'object') { + for (var key in data) { + data[key] = _reconstructPacket(data[key], buffers); + } + } + + return data; +} + +/** + * Asynchronously removes Blobs or Files from data via + * FileReader's readAsArrayBuffer method. Used before encoding + * data as msgpack. Calls callback with the blobless data. + * + * @param {Object} data + * @param {Function} callback + * @api private + */ + +exports.removeBlobs = function(data, callback) { + function _removeBlobs(obj, curKey, containingObject) { + if (!obj) return obj; + + // convert any blob + if ((withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File)) { + pendingBlobs++; + + // async filereader + var fileReader = new FileReader(); + fileReader.onload = function() { // this.result == arraybuffer + if (containingObject) { + containingObject[curKey] = this.result; + } + else { + bloblessData = this.result; + } + + // if nothing pending its callback time + if(! --pendingBlobs) { + callback(bloblessData); + } + }; + + fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer + } else if (isArray(obj)) { // handle array + for (var i = 0; i < obj.length; i++) { + _removeBlobs(obj[i], i, obj); + } + } else if (typeof obj === 'object' && !isBuf(obj)) { // and object + for (var key in obj) { + _removeBlobs(obj[key], key, obj); + } + } + } + + var pendingBlobs = 0; + var bloblessData = data; + _removeBlobs(bloblessData); + if (!pendingBlobs) { + callback(bloblessData); + } +}; diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/index.js b/node_modules/socket.io-client/node_modules/socket.io-parser/index.js @@ -0,0 +1,415 @@ + +/** + * Module dependencies. + */ + +var debug = require('debug')('socket.io-parser'); +var Emitter = require('component-emitter'); +var binary = require('./binary'); +var isArray = require('isarray'); +var isBuf = require('./is-buffer'); + +/** + * Protocol version. + * + * @api public + */ + +exports.protocol = 4; + +/** + * Packet types. + * + * @api public + */ + +exports.types = [ + 'CONNECT', + 'DISCONNECT', + 'EVENT', + 'ACK', + 'ERROR', + 'BINARY_EVENT', + 'BINARY_ACK' +]; + +/** + * Packet type `connect`. + * + * @api public + */ + +exports.CONNECT = 0; + +/** + * Packet type `disconnect`. + * + * @api public + */ + +exports.DISCONNECT = 1; + +/** + * Packet type `event`. + * + * @api public + */ + +exports.EVENT = 2; + +/** + * Packet type `ack`. + * + * @api public + */ + +exports.ACK = 3; + +/** + * Packet type `error`. + * + * @api public + */ + +exports.ERROR = 4; + +/** + * Packet type 'binary event' + * + * @api public + */ + +exports.BINARY_EVENT = 5; + +/** + * Packet type `binary ack`. For acks with binary arguments. + * + * @api public + */ + +exports.BINARY_ACK = 6; + +/** + * Encoder constructor. + * + * @api public + */ + +exports.Encoder = Encoder; + +/** + * Decoder constructor. + * + * @api public + */ + +exports.Decoder = Decoder; + +/** + * A socket.io Encoder instance + * + * @api public + */ + +function Encoder() {} + +var ERROR_PACKET = exports.ERROR + '"encode error"'; + +/** + * Encode a packet as a single string if non-binary, or as a + * buffer sequence, depending on packet type. + * + * @param {Object} obj - packet object + * @param {Function} callback - function to handle encodings (likely engine.write) + * @return Calls callback with Array of encodings + * @api public + */ + +Encoder.prototype.encode = function(obj, callback){ + debug('encoding packet %j', obj); + + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + encodeAsBinary(obj, callback); + } else { + var encoding = encodeAsString(obj); + callback([encoding]); + } +}; + +/** + * Encode packet as string. + * + * @param {Object} packet + * @return {String} encoded + * @api private + */ + +function encodeAsString(obj) { + + // first is type + var str = '' + obj.type; + + // attachments if we have them + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + str += obj.attachments + '-'; + } + + // if we have a namespace other than `/` + // we append it followed by a comma `,` + if (obj.nsp && '/' !== obj.nsp) { + str += obj.nsp + ','; + } + + // immediately followed by the id + if (null != obj.id) { + str += obj.id; + } + + // json data + if (null != obj.data) { + var payload = tryStringify(obj.data); + if (payload !== false) { + str += payload; + } else { + return ERROR_PACKET; + } + } + + debug('encoded %j as %s', obj, str); + return str; +} + +function tryStringify(str) { + try { + return JSON.stringify(str); + } catch(e){ + return false; + } +} + +/** + * Encode packet as 'buffer sequence' by removing blobs, and + * deconstructing packet into object with placeholders and + * a list of buffers. + * + * @param {Object} packet + * @return {Buffer} encoded + * @api private + */ + +function encodeAsBinary(obj, callback) { + + function writeEncoding(bloblessData) { + var deconstruction = binary.deconstructPacket(bloblessData); + var pack = encodeAsString(deconstruction.packet); + var buffers = deconstruction.buffers; + + buffers.unshift(pack); // add packet info to beginning of data list + callback(buffers); // write all the buffers + } + + binary.removeBlobs(obj, writeEncoding); +} + +/** + * A socket.io Decoder instance + * + * @return {Object} decoder + * @api public + */ + +function Decoder() { + this.reconstructor = null; +} + +/** + * Mix in `Emitter` with Decoder. + */ + +Emitter(Decoder.prototype); + +/** + * Decodes an encoded packet string into packet JSON. + * + * @param {String} obj - encoded packet + * @return {Object} packet + * @api public + */ + +Decoder.prototype.add = function(obj) { + var packet; + if (typeof obj === 'string') { + packet = decodeString(obj); + if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json + this.reconstructor = new BinaryReconstructor(packet); + + // no attachments, labeled binary but no binary data to follow + if (this.reconstructor.reconPack.attachments === 0) { + this.emit('decoded', packet); + } + } else { // non-binary full packet + this.emit('decoded', packet); + } + } else if (isBuf(obj) || obj.base64) { // raw binary data + if (!this.reconstructor) { + throw new Error('got binary data when not reconstructing a packet'); + } else { + packet = this.reconstructor.takeBinaryData(obj); + if (packet) { // received final buffer + this.reconstructor = null; + this.emit('decoded', packet); + } + } + } else { + throw new Error('Unknown type: ' + obj); + } +}; + +/** + * Decode a packet String (JSON data) + * + * @param {String} str + * @return {Object} packet + * @api private + */ + +function decodeString(str) { + var i = 0; + // look up type + var p = { + type: Number(str.charAt(0)) + }; + + if (null == exports.types[p.type]) { + return error('unknown packet type ' + p.type); + } + + // look up attachments if type binary + if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) { + var buf = ''; + while (str.charAt(++i) !== '-') { + buf += str.charAt(i); + if (i == str.length) break; + } + if (buf != Number(buf) || str.charAt(i) !== '-') { + throw new Error('Illegal attachments'); + } + p.attachments = Number(buf); + } + + // look up namespace (if any) + if ('/' === str.charAt(i + 1)) { + p.nsp = ''; + while (++i) { + var c = str.charAt(i); + if (',' === c) break; + p.nsp += c; + if (i === str.length) break; + } + } else { + p.nsp = '/'; + } + + // look up id + var next = str.charAt(i + 1); + if ('' !== next && Number(next) == next) { + p.id = ''; + while (++i) { + var c = str.charAt(i); + if (null == c || Number(c) != c) { + --i; + break; + } + p.id += str.charAt(i); + if (i === str.length) break; + } + p.id = Number(p.id); + } + + // look up json data + if (str.charAt(++i)) { + var payload = tryParse(str.substr(i)); + var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload)); + if (isPayloadValid) { + p.data = payload; + } else { + return error('invalid payload'); + } + } + + debug('decoded %s as %j', str, p); + return p; +} + +function tryParse(str) { + try { + return JSON.parse(str); + } catch(e){ + return false; + } +} + +/** + * Deallocates a parser's resources + * + * @api public + */ + +Decoder.prototype.destroy = function() { + if (this.reconstructor) { + this.reconstructor.finishedReconstruction(); + } +}; + +/** + * A manager of a binary event's 'buffer sequence'. Should + * be constructed whenever a packet of type BINARY_EVENT is + * decoded. + * + * @param {Object} packet + * @return {BinaryReconstructor} initialized reconstructor + * @api private + */ + +function BinaryReconstructor(packet) { + this.reconPack = packet; + this.buffers = []; +} + +/** + * Method to be called when binary data received from connection + * after a BINARY_EVENT packet. + * + * @param {Buffer | ArrayBuffer} binData - the raw binary data received + * @return {null | Object} returns null if more binary data is expected or + * a reconstructed packet object if all buffers have been received. + * @api private + */ + +BinaryReconstructor.prototype.takeBinaryData = function(binData) { + this.buffers.push(binData); + if (this.buffers.length === this.reconPack.attachments) { // done with buffer list + var packet = binary.reconstructPacket(this.reconPack, this.buffers); + this.finishedReconstruction(); + return packet; + } + return null; +}; + +/** + * Cleans up binary packet reconstruction variables. + * + * @api private + */ + +BinaryReconstructor.prototype.finishedReconstruction = function() { + this.reconPack = null; + this.buffers = []; +}; + +function error(msg) { + return { + type: exports.ERROR, + data: 'parser error: ' + msg + }; +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/is-buffer.js b/node_modules/socket.io-client/node_modules/socket.io-parser/is-buffer.js @@ -0,0 +1,20 @@ + +module.exports = isBuf; + +var withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function'; +var withNativeArrayBuffer = typeof ArrayBuffer === 'function'; + +var isView = function (obj) { + return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer); +}; + +/** + * Returns true if obj is a buffer or an arraybuffer. + * + * @api private + */ + +function isBuf(obj) { + return (withNativeBuffer && Buffer.isBuffer(obj)) || + (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))); +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.coveralls.yml b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.coveralls.yml @@ -0,0 +1 @@ +repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.eslintrc b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.eslintrc @@ -0,0 +1,14 @@ +{ + "env": { + "browser": true, + "node": true + }, + "globals": { + "chrome": true + }, + "rules": { + "no-console": 0, + "no-empty": [1, { "allowEmptyCatch": true }] + }, + "extends": "eslint:recommended" +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.npmignore b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.npmignore @@ -0,0 +1,9 @@ +support +test +examples +example +*.sock +dist +yarn.lock +coverage +bower.json diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.travis.yml b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/.travis.yml @@ -0,0 +1,20 @@ +sudo: false + +language: node_js + +node_js: + - "4" + - "6" + - "8" + +install: + - make install + +script: + - make lint + - make test + +matrix: + include: + - node_js: '8' + env: BROWSER=1 diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/CHANGELOG.md b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/LICENSE b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/Makefile b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/Makefile @@ -0,0 +1,58 @@ +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# Path +PATH := node_modules/.bin:$(PATH) +SHELL := /bin/bash + +# applications +NODE ?= $(shell which node) +YARN ?= $(shell which yarn) +PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +install: node_modules + +browser: dist/debug.js + +node_modules: package.json + @NODE_ENV= $(PKG) install + @touch node_modules + +dist/debug.js: src/*.js node_modules + @mkdir -p dist + @$(BROWSERIFY) \ + --standalone debug \ + . > dist/debug.js + +lint: + @eslint *.js src/*.js + +test-node: + @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js + @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + +test-browser: + @$(MAKE) browser + @karma start --single-run + +test-all: + @concurrently \ + "make test-node" \ + "make test-browser" + +test: + @if [ "x$(BROWSER)" = "x" ]; then \ + $(MAKE) test-node; \ + else \ + $(MAKE) test-browser; \ + fi + +clean: + rimraf dist coverage + +.PHONY: browser install clean lint test test-all test-node test-browser diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/README.md b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/README.md @@ -0,0 +1,368 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> + +#### Windows note + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Note that PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Then, run the program to be debugged as usual. + + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + +<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png"> + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + +<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png"> + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png"> + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + +<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + +<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a> + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/karma.conf.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/karma.conf.js @@ -0,0 +1,70 @@ +// Karma configuration +// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['mocha', 'chai', 'sinon'], + + + // list of files / patterns to load in the browser + files: [ + 'dist/debug.js', + 'test/*spec.js' + ], + + + // list of files to exclude + exclude: [ + 'src/node.js' + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/node.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/package.json b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/package.json @@ -0,0 +1,82 @@ +{ + "_from": "debug@~3.1.0", + "_id": "debug@3.1.0", + "_inBundle": false, + "_integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "_location": "/socket.io-client/socket.io-parser/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@~3.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "~3.1.0", + "saveSpec": null, + "fetchSpec": "~3.1.0" + }, + "_requiredBy": [ + "/socket.io-client/socket.io-parser" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "_shasum": "5bb5a0672628b64149566ba16819e61518c67261", + "_spec": "debug@~3.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client/node_modules/socket.io-parser", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "2.0.0" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^2.11.15", + "eslint": "^3.12.1", + "istanbul": "^0.4.5", + "karma": "^1.3.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-sinon": "^1.0.5", + "mocha": "^3.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "sinon": "^1.17.6", + "sinon-chai": "^2.8.0" + }, + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "version": "3.1.0" +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/browser.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/browser.js @@ -0,0 +1,195 @@ +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', + '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', + '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', + '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', + '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', + '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', + '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', + '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', + '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', + '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', + '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/debug.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/debug.js @@ -0,0 +1,225 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * Active `debug` instances. + */ +exports.instances = []; + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; +} + +function destroy () { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/index.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer') { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/node.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug/src/node.js @@ -0,0 +1,186 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [ 6, 2, 3, 4, 5, 1 ]; + +try { + var supportsColor = require('supports-color'); + if (supportsColor && supportsColor.level >= 2) { + exports.colors = [ + 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, + 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, + 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 214, 215, 220, 221 + ]; + } +} catch (err) { + // swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(process.stderr.fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); + var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } else { + return new Date().toISOString() + ' '; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/index.js b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/index.js @@ -0,0 +1,152 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/license.md b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/package.json b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.0.0", + "_id": "ms@2.0.0", + "_inBundle": false, + "_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "_location": "/socket.io-client/socket.io-parser/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.0.0", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.0.0", + "saveSpec": null, + "fetchSpec": "2.0.0" + }, + "_requiredBy": [ + "/socket.io-client/socket.io-parser/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", + "_spec": "ms@2.0.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny milisecond conversion utility", + "devDependencies": { + "eslint": "3.19.0", + "expect.js": "0.3.1", + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.0.0" +} diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/readme.md b/node_modules/socket.io-client/node_modules/socket.io-parser/node_modules/ms/readme.md @@ -0,0 +1,51 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +``` + +### Convert from milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +### Time format written-out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. + +## Caught a bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/socket.io-client/node_modules/socket.io-parser/package.json b/node_modules/socket.io-client/node_modules/socket.io-parser/package.json @@ -0,0 +1,60 @@ +{ + "_from": "socket.io-parser@~3.3.0", + "_id": "socket.io-parser@3.3.0", + "_inBundle": false, + "_integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "_location": "/socket.io-client/socket.io-parser", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "socket.io-parser@~3.3.0", + "name": "socket.io-parser", + "escapedName": "socket.io-parser", + "rawSpec": "~3.3.0", + "saveSpec": null, + "fetchSpec": "~3.3.0" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", + "_shasum": "2b52a96a509fdf31440ba40fed6094c7d4f1262f", + "_spec": "socket.io-parser@~3.3.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "bugs": { + "url": "https://github.com/Automattic/socket.io-parser/issues" + }, + "bundleDependencies": false, + "dependencies": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "deprecated": false, + "description": "socket.io protocol parser", + "devDependencies": { + "benchmark": "2.1.2", + "expect.js": "0.3.1", + "mocha": "3.2.0", + "socket.io-browsers": "^1.0.0", + "zuul": "3.11.1", + "zuul-ngrok": "4.0.0" + }, + "files": [ + "binary.js", + "index.js", + "is-buffer.js" + ], + "homepage": "https://github.com/Automattic/socket.io-parser#readme", + "license": "MIT", + "name": "socket.io-parser", + "repository": { + "type": "git", + "url": "git+https://github.com/Automattic/socket.io-parser.git" + }, + "scripts": { + "test": "make test" + }, + "version": "3.3.0" +} diff --git a/node_modules/socket.io-client/package.json b/node_modules/socket.io-client/package.json @@ -0,0 +1,121 @@ +{ + "_from": "socket.io-client@2.3.0", + "_id": "socket.io-client@2.3.0", + "_inBundle": false, + "_integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "_location": "/socket.io-client", + "_phantomChildren": { + "component-emitter": "1.2.1", + "isarray": "2.0.1" + }, + "_requested": { + "type": "version", + "registry": true, + "raw": "socket.io-client@2.3.0", + "name": "socket.io-client", + "escapedName": "socket.io-client", + "rawSpec": "2.3.0", + "saveSpec": null, + "fetchSpec": "2.3.0" + }, + "_requiredBy": [ + "/socket.io" + ], + "_resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", + "_shasum": "14d5ba2e00b9bcd145ae443ab96b3f86cbcc1bb4", + "_spec": "socket.io-client@2.3.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io", + "bugs": { + "url": "https://github.com/Automattic/socket.io-client/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Guillermo Rauch", + "email": "rauchg@gmail.com" + }, + { + "name": "Arnout Kazemier", + "email": "info@3rd-eden.com" + }, + { + "name": "Vladimir Dronnikov", + "email": "dronnikov@gmail.com" + }, + { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com" + } + ], + "dependencies": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "engine.io-client": "~3.4.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "deprecated": false, + "description": "[![Build Status](https://secure.travis-ci.org/socketio/socket.io-client.svg?branch=master)](http://travis-ci.org/socketio/socket.io-client) [![Dependency Status](https://david-dm.org/socketio/socket.io-client.svg)](https://david-dm.org/socketio/socket.io-client) [![devDependency Status](https://david-dm.org/socketio/socket.io-client/dev-status.svg)](https://david-dm.org/socketio/socket.io-client#info=devDependencies) [![NPM version](https://badge.fury.io/js/socket.io-client.svg)](https://www.npmjs.com/package/socket.io-client) ![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg?style=flat) [![](http://slack.socket.io/badge.svg?)](http://slack.socket.io)", + "devDependencies": { + "babel-core": "^6.24.1", + "babel-eslint": "4.1.7", + "babel-loader": "7.0.0", + "babel-preset-es2015": "6.24.1", + "concat-stream": "^1.6.0", + "derequire": "^2.0.6", + "eslint-config-standard": "4.4.0", + "eslint-plugin-standard": "1.3.1", + "expect.js": "0.3.1", + "gulp": "^3.9.1", + "gulp-eslint": "1.1.1", + "gulp-file": "^0.3.0", + "gulp-istanbul": "^1.1.1", + "gulp-mocha": "^4.3.1", + "gulp-task-listing": "1.0.1", + "imports-loader": "^0.7.1", + "istanbul": "^0.4.5", + "mocha": "^3.3.0", + "socket.io": "2.3.0", + "socket.io-browsers": "^1.0.0", + "strip-loader": "0.1.2", + "text-blob-builder": "0.0.1", + "webpack-merge": "4.1.2", + "webpack-stream": "3.2.0", + "zuul": "~3.11.1", + "zuul-builder-webpack": "^1.2.0", + "zuul-ngrok": "4.0.0" + }, + "files": [ + "lib/", + "dist/" + ], + "homepage": "https://github.com/Automattic/socket.io-client#readme", + "keywords": [ + "realtime", + "framework", + "websocket", + "tcp", + "events", + "client" + ], + "license": "MIT", + "main": "./lib/index", + "name": "socket.io-client", + "repository": { + "type": "git", + "url": "git+https://github.com/Automattic/socket.io-client.git" + }, + "scripts": { + "test": "gulp test" + }, + "version": "2.3.0" +} diff --git a/node_modules/socket.io-parser/LICENSE b/node_modules/socket.io-parser/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014 Guillermo Rauch <guillermo@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the 'Software'), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io-parser/Readme.md b/node_modules/socket.io-parser/Readme.md @@ -0,0 +1,73 @@ + +# socket.io-parser + +[![Build Status](https://secure.travis-ci.org/socketio/socket.io-parser.svg?branch=master)](http://travis-ci.org/socketio/socket.io-parser) +[![NPM version](https://badge.fury.io/js/socket.io-parser.svg)](http://badge.fury.io/js/socket.io-parser) + +A socket.io encoder and decoder written in JavaScript complying with version `4` +of [socket.io-protocol](https://github.com/socketio/socket.io-protocol). +Used by [socket.io](https://github.com/automattic/socket.io) and +[socket.io-client](https://github.com/automattic/socket.io-client). + +## Parser API + + socket.io-parser is the reference implementation of socket.io-protocol. Read + the full API here: + [socket.io-protocol](https://github.com/learnboost/socket.io-protocol). + +## Example Usage + +### Encoding and decoding a packet + +```js +var parser = require('socket.io-parser'); +var encoder = new parser.Encoder(); +var packet = { + type: parser.EVENT, + data: 'test-packet', + id: 13 +}; +encoder.encode(packet, function(encodedPackets) { + var decoder = new parser.Decoder(); + decoder.on('decoded', function(decodedPacket) { + // decodedPacket.type == parser.EVENT + // decodedPacket.data == 'test-packet' + // decodedPacket.id == 13 + }); + + for (var i = 0; i < encodedPackets.length; i++) { + decoder.add(encodedPackets[i]); + } +}); +``` + +### Encoding and decoding a packet with binary data + +```js +var parser = require('socket.io-parser'); +var encoder = new parser.Encoder(); +var packet = { + type: parser.BINARY_EVENT, + data: {i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)])} + id: 15 +}; +encoder.encode(packet, function(encodedPackets) { + var decoder = new parser.Decoder(); + decoder.on('decoded', function(decodedPacket) { + // decodedPacket.type == parser.BINARY_EVENT + // Buffer.isBuffer(decodedPacket.data.i) == true + // Buffer.isBuffer(decodedPacket.data.j) == true + // decodedPacket.id == 15 + }); + + for (var i = 0; i < encodedPackets.length; i++) { + decoder.add(encodedPackets[i]); + } +}); +``` +See the test suite for more examples of how socket.io-parser is used. + + +## License + +MIT diff --git a/node_modules/socket.io-parser/binary.js b/node_modules/socket.io-parser/binary.js @@ -0,0 +1,141 @@ +/*global Blob,File*/ + +/** + * Module requirements + */ + +var isArray = require('isarray'); +var isBuf = require('./is-buffer'); +var toString = Object.prototype.toString; +var withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]'); +var withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]'); + +/** + * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder. + * Anything with blobs or files should be fed through removeBlobs before coming + * here. + * + * @param {Object} packet - socket.io event packet + * @return {Object} with deconstructed packet and list of buffers + * @api public + */ + +exports.deconstructPacket = function(packet) { + var buffers = []; + var packetData = packet.data; + var pack = packet; + pack.data = _deconstructPacket(packetData, buffers); + pack.attachments = buffers.length; // number of binary 'attachments' + return {packet: pack, buffers: buffers}; +}; + +function _deconstructPacket(data, buffers) { + if (!data) return data; + + if (isBuf(data)) { + var placeholder = { _placeholder: true, num: buffers.length }; + buffers.push(data); + return placeholder; + } else if (isArray(data)) { + var newData = new Array(data.length); + for (var i = 0; i < data.length; i++) { + newData[i] = _deconstructPacket(data[i], buffers); + } + return newData; + } else if (typeof data === 'object' && !(data instanceof Date)) { + var newData = {}; + for (var key in data) { + newData[key] = _deconstructPacket(data[key], buffers); + } + return newData; + } + return data; +} + +/** + * Reconstructs a binary packet from its placeholder packet and buffers + * + * @param {Object} packet - event packet with placeholders + * @param {Array} buffers - binary buffers to put in placeholder positions + * @return {Object} reconstructed packet + * @api public + */ + +exports.reconstructPacket = function(packet, buffers) { + packet.data = _reconstructPacket(packet.data, buffers); + packet.attachments = undefined; // no longer useful + return packet; +}; + +function _reconstructPacket(data, buffers) { + if (!data) return data; + + if (data && data._placeholder) { + return buffers[data.num]; // appropriate buffer (should be natural order anyway) + } else if (isArray(data)) { + for (var i = 0; i < data.length; i++) { + data[i] = _reconstructPacket(data[i], buffers); + } + } else if (typeof data === 'object') { + for (var key in data) { + data[key] = _reconstructPacket(data[key], buffers); + } + } + + return data; +} + +/** + * Asynchronously removes Blobs or Files from data via + * FileReader's readAsArrayBuffer method. Used before encoding + * data as msgpack. Calls callback with the blobless data. + * + * @param {Object} data + * @param {Function} callback + * @api private + */ + +exports.removeBlobs = function(data, callback) { + function _removeBlobs(obj, curKey, containingObject) { + if (!obj) return obj; + + // convert any blob + if ((withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File)) { + pendingBlobs++; + + // async filereader + var fileReader = new FileReader(); + fileReader.onload = function() { // this.result == arraybuffer + if (containingObject) { + containingObject[curKey] = this.result; + } + else { + bloblessData = this.result; + } + + // if nothing pending its callback time + if(! --pendingBlobs) { + callback(bloblessData); + } + }; + + fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer + } else if (isArray(obj)) { // handle array + for (var i = 0; i < obj.length; i++) { + _removeBlobs(obj[i], i, obj); + } + } else if (typeof obj === 'object' && !isBuf(obj)) { // and object + for (var key in obj) { + _removeBlobs(obj[key], key, obj); + } + } + } + + var pendingBlobs = 0; + var bloblessData = data; + _removeBlobs(bloblessData); + if (!pendingBlobs) { + callback(bloblessData); + } +}; diff --git a/node_modules/socket.io-parser/index.js b/node_modules/socket.io-parser/index.js @@ -0,0 +1,415 @@ + +/** + * Module dependencies. + */ + +var debug = require('debug')('socket.io-parser'); +var Emitter = require('component-emitter'); +var binary = require('./binary'); +var isArray = require('isarray'); +var isBuf = require('./is-buffer'); + +/** + * Protocol version. + * + * @api public + */ + +exports.protocol = 4; + +/** + * Packet types. + * + * @api public + */ + +exports.types = [ + 'CONNECT', + 'DISCONNECT', + 'EVENT', + 'ACK', + 'ERROR', + 'BINARY_EVENT', + 'BINARY_ACK' +]; + +/** + * Packet type `connect`. + * + * @api public + */ + +exports.CONNECT = 0; + +/** + * Packet type `disconnect`. + * + * @api public + */ + +exports.DISCONNECT = 1; + +/** + * Packet type `event`. + * + * @api public + */ + +exports.EVENT = 2; + +/** + * Packet type `ack`. + * + * @api public + */ + +exports.ACK = 3; + +/** + * Packet type `error`. + * + * @api public + */ + +exports.ERROR = 4; + +/** + * Packet type 'binary event' + * + * @api public + */ + +exports.BINARY_EVENT = 5; + +/** + * Packet type `binary ack`. For acks with binary arguments. + * + * @api public + */ + +exports.BINARY_ACK = 6; + +/** + * Encoder constructor. + * + * @api public + */ + +exports.Encoder = Encoder; + +/** + * Decoder constructor. + * + * @api public + */ + +exports.Decoder = Decoder; + +/** + * A socket.io Encoder instance + * + * @api public + */ + +function Encoder() {} + +var ERROR_PACKET = exports.ERROR + '"encode error"'; + +/** + * Encode a packet as a single string if non-binary, or as a + * buffer sequence, depending on packet type. + * + * @param {Object} obj - packet object + * @param {Function} callback - function to handle encodings (likely engine.write) + * @return Calls callback with Array of encodings + * @api public + */ + +Encoder.prototype.encode = function(obj, callback){ + debug('encoding packet %j', obj); + + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + encodeAsBinary(obj, callback); + } else { + var encoding = encodeAsString(obj); + callback([encoding]); + } +}; + +/** + * Encode packet as string. + * + * @param {Object} packet + * @return {String} encoded + * @api private + */ + +function encodeAsString(obj) { + + // first is type + var str = '' + obj.type; + + // attachments if we have them + if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) { + str += obj.attachments + '-'; + } + + // if we have a namespace other than `/` + // we append it followed by a comma `,` + if (obj.nsp && '/' !== obj.nsp) { + str += obj.nsp + ','; + } + + // immediately followed by the id + if (null != obj.id) { + str += obj.id; + } + + // json data + if (null != obj.data) { + var payload = tryStringify(obj.data); + if (payload !== false) { + str += payload; + } else { + return ERROR_PACKET; + } + } + + debug('encoded %j as %s', obj, str); + return str; +} + +function tryStringify(str) { + try { + return JSON.stringify(str); + } catch(e){ + return false; + } +} + +/** + * Encode packet as 'buffer sequence' by removing blobs, and + * deconstructing packet into object with placeholders and + * a list of buffers. + * + * @param {Object} packet + * @return {Buffer} encoded + * @api private + */ + +function encodeAsBinary(obj, callback) { + + function writeEncoding(bloblessData) { + var deconstruction = binary.deconstructPacket(bloblessData); + var pack = encodeAsString(deconstruction.packet); + var buffers = deconstruction.buffers; + + buffers.unshift(pack); // add packet info to beginning of data list + callback(buffers); // write all the buffers + } + + binary.removeBlobs(obj, writeEncoding); +} + +/** + * A socket.io Decoder instance + * + * @return {Object} decoder + * @api public + */ + +function Decoder() { + this.reconstructor = null; +} + +/** + * Mix in `Emitter` with Decoder. + */ + +Emitter(Decoder.prototype); + +/** + * Decodes an encoded packet string into packet JSON. + * + * @param {String} obj - encoded packet + * @return {Object} packet + * @api public + */ + +Decoder.prototype.add = function(obj) { + var packet; + if (typeof obj === 'string') { + packet = decodeString(obj); + if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json + this.reconstructor = new BinaryReconstructor(packet); + + // no attachments, labeled binary but no binary data to follow + if (this.reconstructor.reconPack.attachments === 0) { + this.emit('decoded', packet); + } + } else { // non-binary full packet + this.emit('decoded', packet); + } + } else if (isBuf(obj) || obj.base64) { // raw binary data + if (!this.reconstructor) { + throw new Error('got binary data when not reconstructing a packet'); + } else { + packet = this.reconstructor.takeBinaryData(obj); + if (packet) { // received final buffer + this.reconstructor = null; + this.emit('decoded', packet); + } + } + } else { + throw new Error('Unknown type: ' + obj); + } +}; + +/** + * Decode a packet String (JSON data) + * + * @param {String} str + * @return {Object} packet + * @api private + */ + +function decodeString(str) { + var i = 0; + // look up type + var p = { + type: Number(str.charAt(0)) + }; + + if (null == exports.types[p.type]) { + return error('unknown packet type ' + p.type); + } + + // look up attachments if type binary + if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) { + var buf = ''; + while (str.charAt(++i) !== '-') { + buf += str.charAt(i); + if (i == str.length) break; + } + if (buf != Number(buf) || str.charAt(i) !== '-') { + throw new Error('Illegal attachments'); + } + p.attachments = Number(buf); + } + + // look up namespace (if any) + if ('/' === str.charAt(i + 1)) { + p.nsp = ''; + while (++i) { + var c = str.charAt(i); + if (',' === c) break; + p.nsp += c; + if (i === str.length) break; + } + } else { + p.nsp = '/'; + } + + // look up id + var next = str.charAt(i + 1); + if ('' !== next && Number(next) == next) { + p.id = ''; + while (++i) { + var c = str.charAt(i); + if (null == c || Number(c) != c) { + --i; + break; + } + p.id += str.charAt(i); + if (i === str.length) break; + } + p.id = Number(p.id); + } + + // look up json data + if (str.charAt(++i)) { + var payload = tryParse(str.substr(i)); + var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload)); + if (isPayloadValid) { + p.data = payload; + } else { + return error('invalid payload'); + } + } + + debug('decoded %s as %j', str, p); + return p; +} + +function tryParse(str) { + try { + return JSON.parse(str); + } catch(e){ + return false; + } +} + +/** + * Deallocates a parser's resources + * + * @api public + */ + +Decoder.prototype.destroy = function() { + if (this.reconstructor) { + this.reconstructor.finishedReconstruction(); + } +}; + +/** + * A manager of a binary event's 'buffer sequence'. Should + * be constructed whenever a packet of type BINARY_EVENT is + * decoded. + * + * @param {Object} packet + * @return {BinaryReconstructor} initialized reconstructor + * @api private + */ + +function BinaryReconstructor(packet) { + this.reconPack = packet; + this.buffers = []; +} + +/** + * Method to be called when binary data received from connection + * after a BINARY_EVENT packet. + * + * @param {Buffer | ArrayBuffer} binData - the raw binary data received + * @return {null | Object} returns null if more binary data is expected or + * a reconstructed packet object if all buffers have been received. + * @api private + */ + +BinaryReconstructor.prototype.takeBinaryData = function(binData) { + this.buffers.push(binData); + if (this.buffers.length === this.reconPack.attachments) { // done with buffer list + var packet = binary.reconstructPacket(this.reconPack, this.buffers); + this.finishedReconstruction(); + return packet; + } + return null; +}; + +/** + * Cleans up binary packet reconstruction variables. + * + * @api private + */ + +BinaryReconstructor.prototype.finishedReconstruction = function() { + this.reconPack = null; + this.buffers = []; +}; + +function error(msg) { + return { + type: exports.ERROR, + data: 'parser error: ' + msg + }; +} diff --git a/node_modules/socket.io-parser/is-buffer.js b/node_modules/socket.io-parser/is-buffer.js @@ -0,0 +1,20 @@ + +module.exports = isBuf; + +var withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function'; +var withNativeArrayBuffer = typeof ArrayBuffer === 'function'; + +var isView = function (obj) { + return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer); +}; + +/** + * Returns true if obj is a buffer or an arraybuffer. + * + * @api private + */ + +function isBuf(obj) { + return (withNativeBuffer && Buffer.isBuffer(obj)) || + (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))); +} diff --git a/node_modules/socket.io-parser/node_modules/debug/CHANGELOG.md b/node_modules/socket.io-parser/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/socket.io-parser/node_modules/debug/LICENSE b/node_modules/socket.io-parser/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/socket.io-parser/node_modules/debug/README.md b/node_modules/socket.io-parser/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + +<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png"> + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + +<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png"> + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png"> + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + +<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + +<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a> + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io-parser/node_modules/debug/dist/debug.js b/node_modules/socket.io-parser/node_modules/debug/dist/debug.js @@ -0,0 +1,912 @@ +"use strict"; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + + g.debug = f(); + } +})(function () { + var define, module, exports; + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require; + if (!f && c) return c(i, !0); + if (u) return u(i, !0); + var a = new Error("Cannot find module '" + i + "'"); + throw a.code = "MODULE_NOT_FOUND", a; + } + + var p = n[i] = { + exports: {} + }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + + return n[i].exports; + } + + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + } + + return o; + } + + return r; + }()({ + 1: [function (require, module, exports) { + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + + var type = _typeof(val); + + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(str) { + str = String(str); + + if (str.length > 100) { + return; + } + + var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + + if (!match) { + return; + } + + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + + case 'weeks': + case 'week': + case 'w': + return n * w; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + + default: + return undefined; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + + return ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + }, {}], + 2: [function (require, module, exports) { + // shim for using process in browser + var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; // v8 likes predictible objects + + + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { + return '/'; + }; + + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + + process.umask = function () { + return 0; + }; + }, {}], + 3: [function (require, module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + + + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + + + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; + } + + module.exports = setup; + }, { + "ms": 1 + }], + 4: [function (require, module, exports) { + (function (process) { + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + // eslint-disable-next-line complexity + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + + function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = require('./common')(exports); + var formatters = module.exports.formatters; + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + }).call(this, require('_process')); + }, { + "./common": 3, + "_process": 2 + }] + }, {}, [4])(4); +}); diff --git a/node_modules/socket.io-parser/node_modules/debug/package.json b/node_modules/socket.io-parser/node_modules/debug/package.json @@ -0,0 +1,102 @@ +{ + "_from": "debug@~4.1.0", + "_id": "debug@4.1.1", + "_inBundle": false, + "_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "_location": "/socket.io-parser/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@~4.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "~4.1.0", + "saveSpec": null, + "fetchSpec": "~4.1.0" + }, + "_requiredBy": [ + "/socket.io-parser" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "_shasum": "3b72260255109c6b589cee050f1d516139664791", + "_spec": "debug@~4.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-parser", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "scripts": { + "build": "npm run build:debug && npm run build:test", + "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", + "build:test": "babel -d dist test.js", + "clean": "rimraf dist coverage", + "lint": "xo", + "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", + "pretest:browser": "npm run build", + "test": "npm run test:node && npm run test:browser", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "unpkg": "./dist/debug.js", + "version": "4.1.1" +} diff --git a/node_modules/socket.io-parser/node_modules/debug/src/browser.js b/node_modules/socket.io-parser/node_modules/debug/src/browser.js @@ -0,0 +1,264 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/socket.io-parser/node_modules/debug/src/common.js b/node_modules/socket.io-parser/node_modules/debug/src/common.js @@ -0,0 +1,266 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/socket.io-parser/node_modules/debug/src/index.js b/node_modules/socket.io-parser/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/socket.io-parser/node_modules/debug/src/node.js b/node_modules/socket.io-parser/node_modules/debug/src/node.js @@ -0,0 +1,257 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/socket.io-parser/node_modules/ms/index.js b/node_modules/socket.io-parser/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/socket.io-parser/node_modules/ms/license.md b/node_modules/socket.io-parser/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/socket.io-parser/node_modules/ms/package.json b/node_modules/socket.io-parser/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/socket.io-parser/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/socket.io-parser/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@^2.1.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-parser/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/node_modules/socket.io-parser/node_modules/ms/readme.md b/node_modules/socket.io-parser/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/socket.io-parser/package.json b/node_modules/socket.io-parser/package.json @@ -0,0 +1,60 @@ +{ + "_from": "socket.io-parser@~3.4.0", + "_id": "socket.io-parser@3.4.0", + "_inBundle": false, + "_integrity": "sha512-/G/VOI+3DBp0+DJKW4KesGnQkQPFmUCbA/oO2QGT6CWxU7hLGWqU3tyuzeSK/dqcyeHsQg1vTe9jiZI8GU9SCQ==", + "_location": "/socket.io-parser", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "socket.io-parser@~3.4.0", + "name": "socket.io-parser", + "escapedName": "socket.io-parser", + "rawSpec": "~3.4.0", + "saveSpec": null, + "fetchSpec": "~3.4.0" + }, + "_requiredBy": [ + "/socket.io" + ], + "_resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.0.tgz", + "_shasum": "370bb4a151df2f77ce3345ff55a7072cc6e9565a", + "_spec": "socket.io-parser@~3.4.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io", + "bugs": { + "url": "https://github.com/Automattic/socket.io-parser/issues" + }, + "bundleDependencies": false, + "dependencies": { + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "isarray": "2.0.1" + }, + "deprecated": false, + "description": "socket.io protocol parser", + "devDependencies": { + "benchmark": "2.1.2", + "expect.js": "0.3.1", + "mocha": "3.2.0", + "socket.io-browsers": "^1.0.0", + "zuul": "3.11.1", + "zuul-ngrok": "4.0.0" + }, + "files": [ + "binary.js", + "index.js", + "is-buffer.js" + ], + "homepage": "https://github.com/Automattic/socket.io-parser#readme", + "license": "MIT", + "name": "socket.io-parser", + "repository": { + "type": "git", + "url": "git+https://github.com/Automattic/socket.io-parser.git" + }, + "scripts": { + "test": "make test" + }, + "version": "3.4.0" +} diff --git a/node_modules/socket.io/LICENSE b/node_modules/socket.io/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2018 Automattic <dev@cloudup.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/Readme.md b/node_modules/socket.io/Readme.md @@ -0,0 +1,243 @@ + +# socket.io + +[![Backers on Open Collective](https://opencollective.com/socketio/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/socketio/sponsors/badge.svg)](#sponsors) +[![Build Status](https://secure.travis-ci.org/socketio/socket.io.svg?branch=master)](https://travis-ci.org/socketio/socket.io) +[![Dependency Status](https://david-dm.org/socketio/socket.io.svg)](https://david-dm.org/socketio/socket.io) +[![devDependency Status](https://david-dm.org/socketio/socket.io/dev-status.svg)](https://david-dm.org/socketio/socket.io#info=devDependencies) +[![NPM version](https://badge.fury.io/js/socket.io.svg)](https://www.npmjs.com/package/socket.io) +![Downloads](https://img.shields.io/npm/dm/socket.io.svg?style=flat) +[![](https://slackin-socketio.now.sh/badge.svg)](https://slackin-socketio.now.sh) + +## Features + +Socket.IO enables real-time bidirectional event-based communication. It consists of: + +- a Node.js server (this repository) +- a [Javascript client library](https://github.com/socketio/socket.io-client) for the browser (or a Node.js client) + +Some implementations in other languages are also available: + +- [Java](https://github.com/socketio/socket.io-client-java) +- [C++](https://github.com/socketio/socket.io-client-cpp) +- [Swift](https://github.com/socketio/socket.io-client-swift) +- [Dart](https://github.com/rikulo/socket.io-client-dart) + +Its main features are: + +#### Reliability + +Connections are established even in the presence of: + - proxies and load balancers. + - personal firewall and antivirus software. + +For this purpose, it relies on [Engine.IO](https://github.com/socketio/engine.io), which first establishes a long-polling connection, then tries to upgrade to better transports that are "tested" on the side, like WebSocket. Please see the [Goals](https://github.com/socketio/engine.io#goals) section for more information. + +#### Auto-reconnection support + +Unless instructed otherwise a disconnected client will try to reconnect forever, until the server is available again. Please see the available reconnection options [here](https://github.com/socketio/socket.io-client/blob/master/docs/API.md#new-managerurl-options). + +#### Disconnection detection + +A heartbeat mechanism is implemented at the Engine.IO level, allowing both the server and the client to know when the other one is not responding anymore. + +That functionality is achieved with timers set on both the server and the client, with timeout values (the `pingInterval` and `pingTimeout` parameters) shared during the connection handshake. Those timers require any subsequent client calls to be directed to the same server, hence the `sticky-session` requirement when using multiples nodes. + +#### Binary support + +Any serializable data structures can be emitted, including: + +- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) in the browser +- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and [Buffer](https://nodejs.org/api/buffer.html) in Node.js + +#### Simple and convenient API + +Sample code: + +```js +io.on('connection', socket => { + socket.emit('request', /* … */); // emit an event to the socket + io.emit('broadcast', /* … */); // emit an event to all connected sockets + socket.on('reply', () => { /* … */ }); // listen to the event +}); +``` + +#### Cross-browser + +Browser support is tested in Saucelabs: + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/socket.svg)](https://saucelabs.com/u/socket) + +#### Multiplexing support + +In order to create separation of concerns within your application (for example per module, or based on permissions), Socket.IO allows you to create several `Namespaces`, which will act as separate communication channels but will share the same underlying connection. + +#### Room support + +Within each `Namespace`, you can define arbitrary channels, called `Rooms`, that sockets can join and leave. You can then broadcast to any given room, reaching every socket that has joined it. + +This is a useful feature to send notifications to a group of users, or to a given user connected on several devices for example. + + +**Note:** Socket.IO is not a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a WebSocket server (like `ws://echo.websocket.org`) either. Please see the protocol specification [here](https://github.com/socketio/socket.io-protocol). + +## Installation + +```bash +npm install socket.io +``` + +## How to use + +The following example attaches socket.io to a plain Node.JS +HTTP server listening on port `3000`. + +```js +const server = require('http').createServer(); +const io = require('socket.io')(server); +io.on('connection', client => { + client.on('event', data => { /* … */ }); + client.on('disconnect', () => { /* … */ }); +}); +server.listen(3000); +``` + +### Standalone + +```js +const io = require('socket.io')(); +io.on('connection', client => { ... }); +io.listen(3000); +``` + +### In conjunction with Express + +Starting with **3.0**, express applications have become request handler +functions that you pass to `http` or `http` `Server` instances. You need +to pass the `Server` to `socket.io`, and not the express application +function. Also make sure to call `.listen` on the `server`, not the `app`. + +```js +const app = require('express')(); +const server = require('http').createServer(app); +const io = require('socket.io')(server); +io.on('connection', () => { /* … */ }); +server.listen(3000); +``` + +### In conjunction with Koa + +Like Express.JS, Koa works by exposing an application as a request +handler function, but only by calling the `callback` method. + +```js +const app = require('koa')(); +const server = require('http').createServer(app.callback()); +const io = require('socket.io')(server); +io.on('connection', () => { /* … */ }); +server.listen(3000); +``` + +## Documentation + +Please see the documentation [here](/docs/README.md). Contributions are welcome! + +## Debug / logging + +Socket.IO is powered by [debug](https://github.com/visionmedia/debug). +In order to see all the debug output, run your app with the environment variable +`DEBUG` including the desired scope. + +To see the output from all of Socket.IO's debugging scopes you can use: + +``` +DEBUG=socket.io* node myapp +``` + +## Testing + +``` +npm test +``` +This runs the `gulp` task `test`. By default the test will be run with the source code in `lib` directory. + +Set the environmental variable `TEST_VERSION` to `compat` to test the transpiled es5-compat version of the code. + +The `gulp` task `test` will always transpile the source code into es5 and export to `dist` first before running the test. + + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/socketio#backer)] + +<a href="https://opencollective.com/socketio/backer/0/website" target="_blank"><img src="https://opencollective.com/socketio/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/1/website" target="_blank"><img src="https://opencollective.com/socketio/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/2/website" target="_blank"><img src="https://opencollective.com/socketio/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/3/website" target="_blank"><img src="https://opencollective.com/socketio/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/4/website" target="_blank"><img src="https://opencollective.com/socketio/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/5/website" target="_blank"><img src="https://opencollective.com/socketio/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/6/website" target="_blank"><img src="https://opencollective.com/socketio/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/7/website" target="_blank"><img src="https://opencollective.com/socketio/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/8/website" target="_blank"><img src="https://opencollective.com/socketio/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/9/website" target="_blank"><img src="https://opencollective.com/socketio/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/10/website" target="_blank"><img src="https://opencollective.com/socketio/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/11/website" target="_blank"><img src="https://opencollective.com/socketio/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/12/website" target="_blank"><img src="https://opencollective.com/socketio/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/13/website" target="_blank"><img src="https://opencollective.com/socketio/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/14/website" target="_blank"><img src="https://opencollective.com/socketio/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/15/website" target="_blank"><img src="https://opencollective.com/socketio/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/16/website" target="_blank"><img src="https://opencollective.com/socketio/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/17/website" target="_blank"><img src="https://opencollective.com/socketio/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/18/website" target="_blank"><img src="https://opencollective.com/socketio/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/19/website" target="_blank"><img src="https://opencollective.com/socketio/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/20/website" target="_blank"><img src="https://opencollective.com/socketio/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/21/website" target="_blank"><img src="https://opencollective.com/socketio/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/22/website" target="_blank"><img src="https://opencollective.com/socketio/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/23/website" target="_blank"><img src="https://opencollective.com/socketio/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/24/website" target="_blank"><img src="https://opencollective.com/socketio/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/25/website" target="_blank"><img src="https://opencollective.com/socketio/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/26/website" target="_blank"><img src="https://opencollective.com/socketio/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/27/website" target="_blank"><img src="https://opencollective.com/socketio/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/28/website" target="_blank"><img src="https://opencollective.com/socketio/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/socketio/backer/29/website" target="_blank"><img src="https://opencollective.com/socketio/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/socketio#sponsor)] + +<a href="https://opencollective.com/socketio/sponsor/0/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/1/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/2/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/3/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/4/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/5/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/6/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/7/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/8/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/9/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/10/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/11/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/12/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/13/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/14/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/15/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/16/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/17/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/18/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/19/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/20/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/21/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/22/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/23/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/24/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/25/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/26/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/27/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/28/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/socketio/sponsor/29/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/29/avatar.svg"></a> + + +## License + +[MIT](LICENSE) diff --git a/node_modules/socket.io/lib/client.js b/node_modules/socket.io/lib/client.js @@ -0,0 +1,273 @@ + +/** + * Module dependencies. + */ + +var parser = require('socket.io-parser'); +var debug = require('debug')('socket.io:client'); +var url = require('url'); + +/** + * Module exports. + */ + +module.exports = Client; + +/** + * Client constructor. + * + * @param {Server} server instance + * @param {Socket} conn + * @api private + */ + +function Client(server, conn){ + this.server = server; + this.conn = conn; + this.encoder = server.encoder; + this.decoder = new server.parser.Decoder(); + this.id = conn.id; + this.request = conn.request; + this.setup(); + this.sockets = {}; + this.nsps = {}; + this.connectBuffer = []; +} + +/** + * Sets up event listeners. + * + * @api private + */ + +Client.prototype.setup = function(){ + this.onclose = this.onclose.bind(this); + this.ondata = this.ondata.bind(this); + this.onerror = this.onerror.bind(this); + this.ondecoded = this.ondecoded.bind(this); + + this.decoder.on('decoded', this.ondecoded); + this.conn.on('data', this.ondata); + this.conn.on('error', this.onerror); + this.conn.on('close', this.onclose); +}; + +/** + * Connects a client to a namespace. + * + * @param {String} name namespace + * @param {Object} query the query parameters + * @api private + */ + +Client.prototype.connect = function(name, query){ + if (this.server.nsps[name]) { + debug('connecting to namespace %s', name); + return this.doConnect(name, query); + } + + this.server.checkNamespace(name, query, (dynamicNsp) => { + if (dynamicNsp) { + debug('dynamic namespace %s was created', dynamicNsp.name); + this.doConnect(name, query); + } else { + debug('creation of namespace %s was denied', name); + this.packet({ type: parser.ERROR, nsp: name, data: 'Invalid namespace' }); + } + }); +}; + +/** + * Connects a client to a namespace. + * + * @param {String} name namespace + * @param {String} query the query parameters + * @api private + */ + +Client.prototype.doConnect = function(name, query){ + var nsp = this.server.of(name); + + if ('/' != name && !this.nsps['/']) { + this.connectBuffer.push(name); + return; + } + + var self = this; + var socket = nsp.add(this, query, function(){ + self.sockets[socket.id] = socket; + self.nsps[nsp.name] = socket; + + if ('/' == nsp.name && self.connectBuffer.length > 0) { + self.connectBuffer.forEach(self.connect, self); + self.connectBuffer = []; + } + }); +}; + +/** + * Disconnects from all namespaces and closes transport. + * + * @api private + */ + +Client.prototype.disconnect = function(){ + for (var id in this.sockets) { + if (this.sockets.hasOwnProperty(id)) { + this.sockets[id].disconnect(); + } + } + this.sockets = {}; + this.close(); +}; + +/** + * Removes a socket. Called by each `Socket`. + * + * @api private + */ + +Client.prototype.remove = function(socket){ + if (this.sockets.hasOwnProperty(socket.id)) { + var nsp = this.sockets[socket.id].nsp.name; + delete this.sockets[socket.id]; + delete this.nsps[nsp]; + } else { + debug('ignoring remove for %s', socket.id); + } +}; + +/** + * Closes the underlying connection. + * + * @api private + */ + +Client.prototype.close = function(){ + if ('open' == this.conn.readyState) { + debug('forcing transport close'); + this.conn.close(); + this.onclose('forced server close'); + } +}; + +/** + * Writes a packet to the transport. + * + * @param {Object} packet object + * @param {Object} opts + * @api private + */ + +Client.prototype.packet = function(packet, opts){ + opts = opts || {}; + var self = this; + + // this writes to the actual connection + function writeToEngine(encodedPackets) { + if (opts.volatile && !self.conn.transport.writable) return; + for (var i = 0; i < encodedPackets.length; i++) { + self.conn.write(encodedPackets[i], { compress: opts.compress }); + } + } + + if ('open' == this.conn.readyState) { + debug('writing packet %j', packet); + if (!opts.preEncoded) { // not broadcasting, need to encode + this.encoder.encode(packet, writeToEngine); // encode, then write results to engine + } else { // a broadcast pre-encodes a packet + writeToEngine(packet); + } + } else { + debug('ignoring packet write %j', packet); + } +}; + +/** + * Called with incoming transport data. + * + * @api private + */ + +Client.prototype.ondata = function(data){ + // try/catch is needed for protocol violations (GH-1880) + try { + this.decoder.add(data); + } catch(e) { + this.onerror(e); + } +}; + +/** + * Called when parser fully decodes a packet. + * + * @api private + */ + +Client.prototype.ondecoded = function(packet) { + if (parser.CONNECT == packet.type) { + this.connect(url.parse(packet.nsp).pathname, url.parse(packet.nsp, true).query); + } else { + var socket = this.nsps[packet.nsp]; + if (socket) { + process.nextTick(function() { + socket.onpacket(packet); + }); + } else { + debug('no socket for namespace %s', packet.nsp); + } + } +}; + +/** + * Handles an error. + * + * @param {Object} err object + * @api private + */ + +Client.prototype.onerror = function(err){ + for (var id in this.sockets) { + if (this.sockets.hasOwnProperty(id)) { + this.sockets[id].onerror(err); + } + } + this.conn.close(); +}; + +/** + * Called upon transport close. + * + * @param {String} reason + * @api private + */ + +Client.prototype.onclose = function(reason){ + debug('client close with reason %s', reason); + + // ignore a potential subsequent `close` event + this.destroy(); + + // `nsps` and `sockets` are cleaned up seamlessly + for (var id in this.sockets) { + if (this.sockets.hasOwnProperty(id)) { + this.sockets[id].onclose(reason); + } + } + this.sockets = {}; + + this.decoder.destroy(); // clean up decoder +}; + +/** + * Cleans up event listeners. + * + * @api private + */ + +Client.prototype.destroy = function(){ + this.conn.removeListener('data', this.ondata); + this.conn.removeListener('error', this.onerror); + this.conn.removeListener('close', this.onclose); + this.decoder.removeListener('decoded', this.ondecoded); +}; diff --git a/node_modules/socket.io/lib/index.js b/node_modules/socket.io/lib/index.js @@ -0,0 +1,523 @@ +'use strict'; + +/** + * Module dependencies. + */ + +var http = require('http'); +var read = require('fs').readFileSync; +var path = require('path'); +var exists = require('fs').existsSync; +var engine = require('engine.io'); +var clientVersion = require('socket.io-client/package.json').version; +var Client = require('./client'); +var Emitter = require('events').EventEmitter; +var Namespace = require('./namespace'); +var ParentNamespace = require('./parent-namespace'); +var Adapter = require('socket.io-adapter'); +var parser = require('socket.io-parser'); +var debug = require('debug')('socket.io:server'); +var url = require('url'); + +/** + * Module exports. + */ + +module.exports = Server; + +/** + * Socket.IO client source. + */ + +var clientSource = undefined; +var clientSourceMap = undefined; + +/** + * Server constructor. + * + * @param {http.Server|Number|Object} srv http server, port or options + * @param {Object} [opts] + * @api public + */ + +function Server(srv, opts){ + if (!(this instanceof Server)) return new Server(srv, opts); + if ('object' == typeof srv && srv instanceof Object && !srv.listen) { + opts = srv; + srv = null; + } + opts = opts || {}; + this.nsps = {}; + this.parentNsps = new Map(); + this.path(opts.path || '/socket.io'); + this.serveClient(false !== opts.serveClient); + this.parser = opts.parser || parser; + this.encoder = new this.parser.Encoder(); + this.adapter(opts.adapter || Adapter); + this.origins(opts.origins || '*:*'); + this.sockets = this.of('/'); + if (srv) this.attach(srv, opts); +} + +/** + * Server request verification function, that checks for allowed origins + * + * @param {http.IncomingMessage} req request + * @param {Function} fn callback to be called with the result: `fn(err, success)` + */ + +Server.prototype.checkRequest = function(req, fn) { + var origin = req.headers.origin || req.headers.referer; + + // file:// URLs produce a null Origin which can't be authorized via echo-back + if ('null' == origin || null == origin) origin = '*'; + + if (!!origin && typeof(this._origins) == 'function') return this._origins(origin, fn); + if (this._origins.indexOf('*:*') !== -1) return fn(null, true); + if (origin) { + try { + var parts = url.parse(origin); + var defaultPort = 'https:' == parts.protocol ? 443 : 80; + parts.port = parts.port != null + ? parts.port + : defaultPort; + var ok = + ~this._origins.indexOf(parts.protocol + '//' + parts.hostname + ':' + parts.port) || + ~this._origins.indexOf(parts.hostname + ':' + parts.port) || + ~this._origins.indexOf(parts.hostname + ':*') || + ~this._origins.indexOf('*:' + parts.port); + debug('origin %s is %svalid', origin, !!ok ? '' : 'not '); + return fn(null, !!ok); + } catch (ex) { + } + } + fn(null, false); +}; + +/** + * Sets/gets whether client code is being served. + * + * @param {Boolean} v whether to serve client code + * @return {Server|Boolean} self when setting or value when getting + * @api public + */ + +Server.prototype.serveClient = function(v){ + if (!arguments.length) return this._serveClient; + this._serveClient = v; + var resolvePath = function(file){ + var filepath = path.resolve(__dirname, './../../', file); + if (exists(filepath)) { + return filepath; + } + return require.resolve(file); + }; + if (v && !clientSource) { + clientSource = read(resolvePath( 'socket.io-client/dist/socket.io.js'), 'utf-8'); + try { + clientSourceMap = read(resolvePath( 'socket.io-client/dist/socket.io.js.map'), 'utf-8'); + } catch(err) { + debug('could not load sourcemap file'); + } + } + return this; +}; + +/** + * Old settings for backwards compatibility + */ + +var oldSettings = { + "transports": "transports", + "heartbeat timeout": "pingTimeout", + "heartbeat interval": "pingInterval", + "destroy buffer size": "maxHttpBufferSize" +}; + +/** + * Backwards compatibility. + * + * @api public + */ + +Server.prototype.set = function(key, val){ + if ('authorization' == key && val) { + this.use(function(socket, next) { + val(socket.request, function(err, authorized) { + if (err) return next(new Error(err)); + if (!authorized) return next(new Error('Not authorized')); + next(); + }); + }); + } else if ('origins' == key && val) { + this.origins(val); + } else if ('resource' == key) { + this.path(val); + } else if (oldSettings[key] && this.eio[oldSettings[key]]) { + this.eio[oldSettings[key]] = val; + } else { + console.error('Option %s is not valid. Please refer to the README.', key); + } + + return this; +}; + +/** + * Executes the middleware for an incoming namespace not already created on the server. + * + * @param {String} name name of incoming namespace + * @param {Object} query the query parameters + * @param {Function} fn callback + * @api private + */ + +Server.prototype.checkNamespace = function(name, query, fn){ + if (this.parentNsps.size === 0) return fn(false); + + const keysIterator = this.parentNsps.keys(); + + const run = () => { + let nextFn = keysIterator.next(); + if (nextFn.done) { + return fn(false); + } + nextFn.value(name, query, (err, allow) => { + if (err || !allow) { + run(); + } else { + fn(this.parentNsps.get(nextFn.value).createChild(name)); + } + }); + }; + + run(); +}; + +/** + * Sets the client serving path. + * + * @param {String} v pathname + * @return {Server|String} self when setting or value when getting + * @api public + */ + +Server.prototype.path = function(v){ + if (!arguments.length) return this._path; + this._path = v.replace(/\/$/, ''); + return this; +}; + +/** + * Sets the adapter for rooms. + * + * @param {Adapter} v pathname + * @return {Server|Adapter} self when setting or value when getting + * @api public + */ + +Server.prototype.adapter = function(v){ + if (!arguments.length) return this._adapter; + this._adapter = v; + for (var i in this.nsps) { + if (this.nsps.hasOwnProperty(i)) { + this.nsps[i].initAdapter(); + } + } + return this; +}; + +/** + * Sets the allowed origins for requests. + * + * @param {String|String[]} v origins + * @return {Server|Adapter} self when setting or value when getting + * @api public + */ + +Server.prototype.origins = function(v){ + if (!arguments.length) return this._origins; + + this._origins = v; + return this; +}; + +/** + * Attaches socket.io to a server or port. + * + * @param {http.Server|Number} server or port + * @param {Object} options passed to engine.io + * @return {Server} self + * @api public + */ + +Server.prototype.listen = +Server.prototype.attach = function(srv, opts){ + if ('function' == typeof srv) { + var msg = 'You are trying to attach socket.io to an express ' + + 'request handler function. Please pass a http.Server instance.'; + throw new Error(msg); + } + + // handle a port as a string + if (Number(srv) == srv) { + srv = Number(srv); + } + + if ('number' == typeof srv) { + debug('creating http server and binding to %d', srv); + var port = srv; + srv = http.Server(function(req, res){ + res.writeHead(404); + res.end(); + }); + srv.listen(port); + + } + + // set engine.io path to `/socket.io` + opts = opts || {}; + opts.path = opts.path || this.path(); + // set origins verification + opts.allowRequest = opts.allowRequest || this.checkRequest.bind(this); + + if (this.sockets.fns.length > 0) { + this.initEngine(srv, opts); + return this; + } + + var self = this; + var connectPacket = { type: parser.CONNECT, nsp: '/' }; + this.encoder.encode(connectPacket, function (encodedPacket){ + // the CONNECT packet will be merged with Engine.IO handshake, + // to reduce the number of round trips + opts.initialPacket = encodedPacket; + + self.initEngine(srv, opts); + }); + return this; +}; + +/** + * Initialize engine + * + * @param {Object} options passed to engine.io + * @api private + */ + +Server.prototype.initEngine = function(srv, opts){ + // initialize engine + debug('creating engine.io instance with opts %j', opts); + this.eio = engine.attach(srv, opts); + + // attach static file serving + if (this._serveClient) this.attachServe(srv); + + // Export http server + this.httpServer = srv; + + // bind to engine events + this.bind(this.eio); +}; + +/** + * Attaches the static file serving. + * + * @param {Function|http.Server} srv http server + * @api private + */ + +Server.prototype.attachServe = function(srv){ + debug('attaching client serving req handler'); + var url = this._path + '/socket.io.js'; + var urlMap = this._path + '/socket.io.js.map'; + var evs = srv.listeners('request').slice(0); + var self = this; + srv.removeAllListeners('request'); + srv.on('request', function(req, res) { + if (0 === req.url.indexOf(urlMap)) { + self.serveMap(req, res); + } else if (0 === req.url.indexOf(url)) { + self.serve(req, res); + } else { + for (var i = 0; i < evs.length; i++) { + evs[i].call(srv, req, res); + } + } + }); +}; + +/** + * Handles a request serving `/socket.io.js` + * + * @param {http.Request} req + * @param {http.Response} res + * @api private + */ + +Server.prototype.serve = function(req, res){ + // Per the standard, ETags must be quoted: + // https://tools.ietf.org/html/rfc7232#section-2.3 + var expectedEtag = '"' + clientVersion + '"'; + + var etag = req.headers['if-none-match']; + if (etag) { + if (expectedEtag == etag) { + debug('serve client 304'); + res.writeHead(304); + res.end(); + return; + } + } + + debug('serve client source'); + res.setHeader("Cache-Control", "public, max-age=0"); + res.setHeader('Content-Type', 'application/javascript'); + res.setHeader('ETag', expectedEtag); + res.writeHead(200); + res.end(clientSource); +}; + +/** + * Handles a request serving `/socket.io.js.map` + * + * @param {http.Request} req + * @param {http.Response} res + * @api private + */ + +Server.prototype.serveMap = function(req, res){ + // Per the standard, ETags must be quoted: + // https://tools.ietf.org/html/rfc7232#section-2.3 + var expectedEtag = '"' + clientVersion + '"'; + + var etag = req.headers['if-none-match']; + if (etag) { + if (expectedEtag == etag) { + debug('serve client 304'); + res.writeHead(304); + res.end(); + return; + } + } + + debug('serve client sourcemap'); + res.setHeader('Content-Type', 'application/json'); + res.setHeader('ETag', expectedEtag); + res.writeHead(200); + res.end(clientSourceMap); +}; + +/** + * Binds socket.io to an engine.io instance. + * + * @param {engine.Server} engine engine.io (or compatible) server + * @return {Server} self + * @api public + */ + +Server.prototype.bind = function(engine){ + this.engine = engine; + this.engine.on('connection', this.onconnection.bind(this)); + return this; +}; + +/** + * Called with each incoming transport connection. + * + * @param {engine.Socket} conn + * @return {Server} self + * @api public + */ + +Server.prototype.onconnection = function(conn){ + debug('incoming connection with id %s', conn.id); + var client = new Client(this, conn); + client.connect('/'); + return this; +}; + +/** + * Looks up a namespace. + * + * @param {String|RegExp|Function} name nsp name + * @param {Function} [fn] optional, nsp `connection` ev handler + * @api public + */ + +Server.prototype.of = function(name, fn){ + if (typeof name === 'function' || name instanceof RegExp) { + const parentNsp = new ParentNamespace(this); + debug('initializing parent namespace %s', parentNsp.name); + if (typeof name === 'function') { + this.parentNsps.set(name, parentNsp); + } else { + this.parentNsps.set((nsp, conn, next) => next(null, name.test(nsp)), parentNsp); + } + if (fn) parentNsp.on('connect', fn); + return parentNsp; + } + + if (String(name)[0] !== '/') name = '/' + name; + + var nsp = this.nsps[name]; + if (!nsp) { + debug('initializing namespace %s', name); + nsp = new Namespace(this, name); + this.nsps[name] = nsp; + } + if (fn) nsp.on('connect', fn); + return nsp; +}; + +/** + * Closes server connection + * + * @param {Function} [fn] optional, called as `fn([err])` on error OR all conns closed + * @api public + */ + +Server.prototype.close = function(fn){ + for (var id in this.nsps['/'].sockets) { + if (this.nsps['/'].sockets.hasOwnProperty(id)) { + this.nsps['/'].sockets[id].onclose(); + } + } + + this.engine.close(); + + if (this.httpServer) { + this.httpServer.close(fn); + } else { + fn && fn(); + } +}; + +/** + * Expose main namespace (/). + */ + +var emitterMethods = Object.keys(Emitter.prototype).filter(function(key){ + return typeof Emitter.prototype[key] === 'function'; +}); + +emitterMethods.concat(['to', 'in', 'use', 'send', 'write', 'clients', 'compress', 'binary']).forEach(function(fn){ + Server.prototype[fn] = function(){ + return this.sockets[fn].apply(this.sockets, arguments); + }; +}); + +Namespace.flags.forEach(function(flag){ + Object.defineProperty(Server.prototype, flag, { + get: function() { + this.sockets.flags = this.sockets.flags || {}; + this.sockets.flags[flag] = true; + return this; + } + }); +}); + +/** + * BC with `io.listen` + */ + +Server.listen = Server; diff --git a/node_modules/socket.io/lib/namespace.js b/node_modules/socket.io/lib/namespace.js @@ -0,0 +1,299 @@ + +/** + * Module dependencies. + */ + +var Socket = require('./socket'); +var Emitter = require('events').EventEmitter; +var parser = require('socket.io-parser'); +var hasBin = require('has-binary2'); +var debug = require('debug')('socket.io:namespace'); + +/** + * Module exports. + */ + +module.exports = exports = Namespace; + +/** + * Blacklisted events. + */ + +exports.events = [ + 'connect', // for symmetry with client + 'connection', + 'newListener' +]; + +/** + * Flags. + */ + +exports.flags = [ + 'json', + 'volatile', + 'local' +]; + +/** + * `EventEmitter#emit` reference. + */ + +var emit = Emitter.prototype.emit; + +/** + * Namespace constructor. + * + * @param {Server} server instance + * @param {Socket} name + * @api private + */ + +function Namespace(server, name){ + this.name = name; + this.server = server; + this.sockets = {}; + this.connected = {}; + this.fns = []; + this.ids = 0; + this.rooms = []; + this.flags = {}; + this.initAdapter(); +} + +/** + * Inherits from `EventEmitter`. + */ + +Namespace.prototype.__proto__ = Emitter.prototype; + +/** + * Apply flags from `Socket`. + */ + +exports.flags.forEach(function(flag){ + Object.defineProperty(Namespace.prototype, flag, { + get: function() { + this.flags[flag] = true; + return this; + } + }); +}); + +/** + * Initializes the `Adapter` for this nsp. + * Run upon changing adapter by `Server#adapter` + * in addition to the constructor. + * + * @api private + */ + +Namespace.prototype.initAdapter = function(){ + this.adapter = new (this.server.adapter())(this); +}; + +/** + * Sets up namespace middleware. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.use = function(fn){ + if (this.server.eio && this.name === '/') { + debug('removing initial packet'); + delete this.server.eio.initialPacket; + } + this.fns.push(fn); + return this; +}; + +/** + * Executes the middleware for an incoming client. + * + * @param {Socket} socket that will get added + * @param {Function} fn last fn call in the middleware + * @api private + */ + +Namespace.prototype.run = function(socket, fn){ + var fns = this.fns.slice(0); + if (!fns.length) return fn(null); + + function run(i){ + fns[i](socket, function(err){ + // upon error, short-circuit + if (err) return fn(err); + + // if no middleware left, summon callback + if (!fns[i + 1]) return fn(null); + + // go on to next + run(i + 1); + }); + } + + run(0); +}; + +/** + * Targets a room when emitting. + * + * @param {String} name + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.to = +Namespace.prototype.in = function(name){ + if (!~this.rooms.indexOf(name)) this.rooms.push(name); + return this; +}; + +/** + * Adds a new client. + * + * @return {Socket} + * @api private + */ + +Namespace.prototype.add = function(client, query, fn){ + debug('adding socket to nsp %s', this.name); + var socket = new Socket(this, client, query); + var self = this; + this.run(socket, function(err){ + process.nextTick(function(){ + if ('open' == client.conn.readyState) { + if (err) return socket.error(err.data || err.message); + + // track socket + self.sockets[socket.id] = socket; + + // it's paramount that the internal `onconnect` logic + // fires before user-set events to prevent state order + // violations (such as a disconnection before the connection + // logic is complete) + socket.onconnect(); + if (fn) fn(); + + // fire user-set events + self.emit('connect', socket); + self.emit('connection', socket); + } else { + debug('next called after client was closed - ignoring socket'); + } + }); + }); + return socket; +}; + +/** + * Removes a client. Called by each `Socket`. + * + * @api private + */ + +Namespace.prototype.remove = function(socket){ + if (this.sockets.hasOwnProperty(socket.id)) { + delete this.sockets[socket.id]; + } else { + debug('ignoring remove for %s', socket.id); + } +}; + +/** + * Emits to all clients. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.emit = function(ev){ + if (~exports.events.indexOf(ev)) { + emit.apply(this, arguments); + return this; + } + // set up packet object + var args = Array.prototype.slice.call(arguments); + var packet = { + type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT, + data: args + }; + + if ('function' == typeof args[args.length - 1]) { + throw new Error('Callbacks are not supported when broadcasting'); + } + + var rooms = this.rooms.slice(0); + var flags = Object.assign({}, this.flags); + + // reset flags + this.rooms = []; + this.flags = {}; + + this.adapter.broadcast(packet, { + rooms: rooms, + flags: flags + }); + + return this; +}; + +/** + * Sends a `message` event to all clients. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.send = +Namespace.prototype.write = function(){ + var args = Array.prototype.slice.call(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; + +/** + * Gets a list of clients. + * + * @return {Namespace} self + * @api public + */ + +Namespace.prototype.clients = function(fn){ + if(!this.adapter){ + throw new Error('No adapter for this namespace, are you trying to get the list of clients of a dynamic namespace?') + } + this.adapter.clients(this.rooms, fn); + // reset rooms for scenario: + // .in('room').clients() (GH-1978) + this.rooms = []; + return this; +}; + +/** + * Sets the compress flag. + * + * @param {Boolean} compress if `true`, compresses the sending data + * @return {Socket} self + * @api public + */ + +Namespace.prototype.compress = function(compress){ + this.flags.compress = compress; + return this; +}; + +/** + * Sets the binary flag + * + * @param {Boolean} Encode as if it has binary data if `true`, Encode as if it doesnt have binary data if `false` + * @return {Socket} self + * @api public + */ + + Namespace.prototype.binary = function (binary) { + this.flags.binary = binary; + return this; + }; diff --git a/node_modules/socket.io/lib/parent-namespace.js b/node_modules/socket.io/lib/parent-namespace.js @@ -0,0 +1,39 @@ +'use strict'; + +const Namespace = require('./namespace'); + +let count = 0; + +class ParentNamespace extends Namespace { + + constructor(server) { + super(server, '/_' + (count++)); + this.children = new Set(); + } + + initAdapter() {} + + emit() { + const args = Array.prototype.slice.call(arguments); + + this.children.forEach(nsp => { + nsp.rooms = this.rooms; + nsp.flags = this.flags; + nsp.emit.apply(nsp, args); + }); + this.rooms = []; + this.flags = {}; + } + + createChild(name) { + const namespace = new Namespace(this.server, name); + namespace.fns = this.fns.slice(0); + this.listeners('connect').forEach(listener => namespace.on('connect', listener)); + this.listeners('connection').forEach(listener => namespace.on('connection', listener)); + this.children.add(namespace); + this.server.nsps[name] = namespace; + return namespace; + } +} + +module.exports = ParentNamespace; diff --git a/node_modules/socket.io/lib/socket.js b/node_modules/socket.io/lib/socket.js @@ -0,0 +1,572 @@ + +/** + * Module dependencies. + */ + +var Emitter = require('events').EventEmitter; +var parser = require('socket.io-parser'); +var hasBin = require('has-binary2'); +var url = require('url'); +var debug = require('debug')('socket.io:socket'); + +/** + * Module exports. + */ + +module.exports = exports = Socket; + +/** + * Blacklisted events. + * + * @api public + */ + +exports.events = [ + 'error', + 'connect', + 'disconnect', + 'disconnecting', + 'newListener', + 'removeListener' +]; + +/** + * Flags. + * + * @api private + */ + +var flags = [ + 'json', + 'volatile', + 'broadcast', + 'local' +]; + +/** + * `EventEmitter#emit` reference. + */ + +var emit = Emitter.prototype.emit; + +/** + * Interface to a `Client` for a given `Namespace`. + * + * @param {Namespace} nsp + * @param {Client} client + * @api public + */ + +function Socket(nsp, client, query){ + this.nsp = nsp; + this.server = nsp.server; + this.adapter = this.nsp.adapter; + this.id = nsp.name !== '/' ? nsp.name + '#' + client.id : client.id; + this.client = client; + this.conn = client.conn; + this.rooms = {}; + this.acks = {}; + this.connected = true; + this.disconnected = false; + this.handshake = this.buildHandshake(query); + this.fns = []; + this.flags = {}; + this._rooms = []; +} + +/** + * Inherits from `EventEmitter`. + */ + +Socket.prototype.__proto__ = Emitter.prototype; + +/** + * Apply flags from `Socket`. + */ + +flags.forEach(function(flag){ + Object.defineProperty(Socket.prototype, flag, { + get: function() { + this.flags[flag] = true; + return this; + } + }); +}); + +/** + * `request` engine.io shortcut. + * + * @api public + */ + +Object.defineProperty(Socket.prototype, 'request', { + get: function() { + return this.conn.request; + } +}); + +/** + * Builds the `handshake` BC object + * + * @api private + */ + +Socket.prototype.buildHandshake = function(query){ + var self = this; + function buildQuery(){ + var requestQuery = url.parse(self.request.url, true).query; + //if socket-specific query exist, replace query strings in requestQuery + return Object.assign({}, query, requestQuery); + } + return { + headers: this.request.headers, + time: (new Date) + '', + address: this.conn.remoteAddress, + xdomain: !!this.request.headers.origin, + secure: !!this.request.connection.encrypted, + issued: +(new Date), + url: this.request.url, + query: buildQuery() + }; +}; + +/** + * Emits to this client. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.emit = function(ev){ + if (~exports.events.indexOf(ev)) { + emit.apply(this, arguments); + return this; + } + + var args = Array.prototype.slice.call(arguments); + var packet = { + type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT, + data: args + }; + + // access last argument to see if it's an ACK callback + if (typeof args[args.length - 1] === 'function') { + if (this._rooms.length || this.flags.broadcast) { + throw new Error('Callbacks are not supported when broadcasting'); + } + + debug('emitting packet with ack id %d', this.nsp.ids); + this.acks[this.nsp.ids] = args.pop(); + packet.id = this.nsp.ids++; + } + + var rooms = this._rooms.slice(0); + var flags = Object.assign({}, this.flags); + + // reset flags + this._rooms = []; + this.flags = {}; + + if (rooms.length || flags.broadcast) { + this.adapter.broadcast(packet, { + except: [this.id], + rooms: rooms, + flags: flags + }); + } else { + // dispatch packet + this.packet(packet, flags); + } + return this; +}; + +/** + * Targets a room when broadcasting. + * + * @param {String} name + * @return {Socket} self + * @api public + */ + +Socket.prototype.to = +Socket.prototype.in = function(name){ + if (!~this._rooms.indexOf(name)) this._rooms.push(name); + return this; +}; + +/** + * Sends a `message` event. + * + * @return {Socket} self + * @api public + */ + +Socket.prototype.send = +Socket.prototype.write = function(){ + var args = Array.prototype.slice.call(arguments); + args.unshift('message'); + this.emit.apply(this, args); + return this; +}; + +/** + * Writes a packet. + * + * @param {Object} packet object + * @param {Object} opts options + * @api private + */ + +Socket.prototype.packet = function(packet, opts){ + packet.nsp = this.nsp.name; + opts = opts || {}; + opts.compress = false !== opts.compress; + this.client.packet(packet, opts); +}; + +/** + * Joins a room. + * + * @param {String|Array} room or array of rooms + * @param {Function} fn optional, callback + * @return {Socket} self + * @api private + */ + +Socket.prototype.join = function(rooms, fn){ + debug('joining room %s', rooms); + var self = this; + if (!Array.isArray(rooms)) { + rooms = [rooms]; + } + rooms = rooms.filter(function (room) { + return !self.rooms.hasOwnProperty(room); + }); + if (!rooms.length) { + fn && fn(null); + return this; + } + this.adapter.addAll(this.id, rooms, function(err){ + if (err) return fn && fn(err); + debug('joined room %s', rooms); + rooms.forEach(function (room) { + self.rooms[room] = room; + }); + fn && fn(null); + }); + return this; +}; + +/** + * Leaves a room. + * + * @param {String} room + * @param {Function} fn optional, callback + * @return {Socket} self + * @api private + */ + +Socket.prototype.leave = function(room, fn){ + debug('leave room %s', room); + var self = this; + this.adapter.del(this.id, room, function(err){ + if (err) return fn && fn(err); + debug('left room %s', room); + delete self.rooms[room]; + fn && fn(null); + }); + return this; +}; + +/** + * Leave all rooms. + * + * @api private + */ + +Socket.prototype.leaveAll = function(){ + this.adapter.delAll(this.id); + this.rooms = {}; +}; + +/** + * Called by `Namespace` upon successful + * middleware execution (ie: authorization). + * Socket is added to namespace array before + * call to join, so adapters can access it. + * + * @api private + */ + +Socket.prototype.onconnect = function(){ + debug('socket connected - writing packet'); + this.nsp.connected[this.id] = this; + this.join(this.id); + var skip = this.nsp.name === '/' && this.nsp.fns.length === 0; + if (skip) { + debug('packet already sent in initial handshake'); + } else { + this.packet({ type: parser.CONNECT }); + } +}; + +/** + * Called with each packet. Called by `Client`. + * + * @param {Object} packet + * @api private + */ + +Socket.prototype.onpacket = function(packet){ + debug('got packet %j', packet); + switch (packet.type) { + case parser.EVENT: + this.onevent(packet); + break; + + case parser.BINARY_EVENT: + this.onevent(packet); + break; + + case parser.ACK: + this.onack(packet); + break; + + case parser.BINARY_ACK: + this.onack(packet); + break; + + case parser.DISCONNECT: + this.ondisconnect(); + break; + + case parser.ERROR: + this.onerror(new Error(packet.data)); + } +}; + +/** + * Called upon event packet. + * + * @param {Object} packet object + * @api private + */ + +Socket.prototype.onevent = function(packet){ + var args = packet.data || []; + debug('emitting event %j', args); + + if (null != packet.id) { + debug('attaching ack callback to event'); + args.push(this.ack(packet.id)); + } + + this.dispatch(args); +}; + +/** + * Produces an ack callback to emit with an event. + * + * @param {Number} id packet id + * @api private + */ + +Socket.prototype.ack = function(id){ + var self = this; + var sent = false; + return function(){ + // prevent double callbacks + if (sent) return; + var args = Array.prototype.slice.call(arguments); + debug('sending ack %j', args); + + self.packet({ + id: id, + type: hasBin(args) ? parser.BINARY_ACK : parser.ACK, + data: args + }); + + sent = true; + }; +}; + +/** + * Called upon ack packet. + * + * @api private + */ + +Socket.prototype.onack = function(packet){ + var ack = this.acks[packet.id]; + if ('function' == typeof ack) { + debug('calling ack %s with %j', packet.id, packet.data); + ack.apply(this, packet.data); + delete this.acks[packet.id]; + } else { + debug('bad ack %s', packet.id); + } +}; + +/** + * Called upon client disconnect packet. + * + * @api private + */ + +Socket.prototype.ondisconnect = function(){ + debug('got disconnect packet'); + this.onclose('client namespace disconnect'); +}; + +/** + * Handles a client error. + * + * @api private + */ + +Socket.prototype.onerror = function(err){ + if (this.listeners('error').length) { + this.emit('error', err); + } else { + console.error('Missing error handler on `socket`.'); + console.error(err.stack); + } +}; + +/** + * Called upon closing. Called by `Client`. + * + * @param {String} reason + * @throw {Error} optional error object + * @api private + */ + +Socket.prototype.onclose = function(reason){ + if (!this.connected) return this; + debug('closing socket - reason %s', reason); + this.emit('disconnecting', reason); + this.leaveAll(); + this.nsp.remove(this); + this.client.remove(this); + this.connected = false; + this.disconnected = true; + delete this.nsp.connected[this.id]; + this.emit('disconnect', reason); +}; + +/** + * Produces an `error` packet. + * + * @param {Object} err error object + * @api private + */ + +Socket.prototype.error = function(err){ + this.packet({ type: parser.ERROR, data: err }); +}; + +/** + * Disconnects this client. + * + * @param {Boolean} close if `true`, closes the underlying connection + * @return {Socket} self + * @api public + */ + +Socket.prototype.disconnect = function(close){ + if (!this.connected) return this; + if (close) { + this.client.disconnect(); + } else { + this.packet({ type: parser.DISCONNECT }); + this.onclose('server namespace disconnect'); + } + return this; +}; + +/** + * Sets the compress flag. + * + * @param {Boolean} compress if `true`, compresses the sending data + * @return {Socket} self + * @api public + */ + +Socket.prototype.compress = function(compress){ + this.flags.compress = compress; + return this; +}; + +/** + * Sets the binary flag + * + * @param {Boolean} Encode as if it has binary data if `true`, Encode as if it doesnt have binary data if `false` + * @return {Socket} self + * @api public + */ + + Socket.prototype.binary = function (binary) { + this.flags.binary = binary; + return this; + }; + +/** + * Dispatch incoming event to socket listeners. + * + * @param {Array} event that will get emitted + * @api private + */ + +Socket.prototype.dispatch = function(event){ + debug('dispatching an event %j', event); + var self = this; + function dispatchSocket(err) { + process.nextTick(function(){ + if (err) { + return self.error(err.data || err.message); + } + emit.apply(self, event); + }); + } + this.run(event, dispatchSocket); +}; + +/** + * Sets up socket middleware. + * + * @param {Function} middleware function (event, next) + * @return {Socket} self + * @api public + */ + +Socket.prototype.use = function(fn){ + this.fns.push(fn); + return this; +}; + +/** + * Executes the middleware for an incoming event. + * + * @param {Array} event that will get emitted + * @param {Function} last fn call in the middleware + * @api private + */ +Socket.prototype.run = function(event, fn){ + var fns = this.fns.slice(0); + if (!fns.length) return fn(null); + + function run(i){ + fns[i](event, function(err){ + // upon error, short-circuit + if (err) return fn(err); + + // if no middleware left, summon callback + if (!fns[i + 1]) return fn(null); + + // go on to next + run(i + 1); + }); + } + + run(0); +}; diff --git a/node_modules/socket.io/node_modules/debug/CHANGELOG.md b/node_modules/socket.io/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/socket.io/node_modules/debug/LICENSE b/node_modules/socket.io/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/socket.io/node_modules/debug/README.md b/node_modules/socket.io/node_modules/debug/README.md @@ -0,0 +1,455 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> +<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + +<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png"> + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + +<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png"> + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png"> + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + +<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png"> + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + +<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a> + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + +<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a> +<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a> + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/socket.io/node_modules/debug/dist/debug.js b/node_modules/socket.io/node_modules/debug/dist/debug.js @@ -0,0 +1,912 @@ +"use strict"; + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + + g.debug = f(); + } +})(function () { + var define, module, exports; + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require; + if (!f && c) return c(i, !0); + if (u) return u(i, !0); + var a = new Error("Cannot find module '" + i + "'"); + throw a.code = "MODULE_NOT_FOUND", a; + } + + var p = n[i] = { + exports: {} + }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + + return n[i].exports; + } + + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + } + + return o; + } + + return r; + }()({ + 1: [function (require, module, exports) { + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + + var type = _typeof(val); + + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(str) { + str = String(str); + + if (str.length > 100) { + return; + } + + var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + + if (!match) { + return; + } + + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + + case 'weeks': + case 'week': + case 'w': + return n * w; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + + default: + return undefined; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + + return ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + }, {}], + 2: [function (require, module, exports) { + // shim for using process in browser + var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; // v8 likes predictible objects + + + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { + return '/'; + }; + + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + + process.umask = function () { + return 0; + }; + }, {}], + 3: [function (require, module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + + + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + + + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; + } + + module.exports = setup; + }, { + "ms": 1 + }], + 4: [function (require, module, exports) { + (function (process) { + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + // eslint-disable-next-line complexity + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + + function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = require('./common')(exports); + var formatters = module.exports.formatters; + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + }).call(this, require('_process')); + }, { + "./common": 3, + "_process": 2 + }] + }, {}, [4])(4); +}); diff --git a/node_modules/socket.io/node_modules/debug/package.json b/node_modules/socket.io/node_modules/debug/package.json @@ -0,0 +1,102 @@ +{ + "_from": "debug@~4.1.0", + "_id": "debug@4.1.1", + "_inBundle": false, + "_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "_location": "/socket.io/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@~4.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "~4.1.0", + "saveSpec": null, + "fetchSpec": "~4.1.0" + }, + "_requiredBy": [ + "/socket.io" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "_shasum": "3b72260255109c6b589cee050f1d516139664791", + "_spec": "debug@~4.1.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "scripts": { + "build": "npm run build:debug && npm run build:test", + "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", + "build:test": "babel -d dist test.js", + "clean": "rimraf dist coverage", + "lint": "xo", + "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", + "pretest:browser": "npm run build", + "test": "npm run test:node && npm run test:browser", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls", + "test:node": "istanbul cover _mocha -- test.js" + }, + "unpkg": "./dist/debug.js", + "version": "4.1.1" +} diff --git a/node_modules/socket.io/node_modules/debug/src/browser.js b/node_modules/socket.io/node_modules/debug/src/browser.js @@ -0,0 +1,264 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/socket.io/node_modules/debug/src/common.js b/node_modules/socket.io/node_modules/debug/src/common.js @@ -0,0 +1,266 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/socket.io/node_modules/debug/src/index.js b/node_modules/socket.io/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/socket.io/node_modules/debug/src/node.js b/node_modules/socket.io/node_modules/debug/src/node.js @@ -0,0 +1,257 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/socket.io/node_modules/ms/index.js b/node_modules/socket.io/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/socket.io/node_modules/ms/license.md b/node_modules/socket.io/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/socket.io/node_modules/ms/package.json b/node_modules/socket.io/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/socket.io/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/socket.io/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@^2.1.1", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/node_modules/socket.io/node_modules/ms/readme.md b/node_modules/socket.io/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/socket.io/package.json b/node_modules/socket.io/package.json @@ -0,0 +1,89 @@ +{ + "_from": "socket.io@^2.3.0", + "_id": "socket.io@2.3.0", + "_inBundle": false, + "_integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "_location": "/socket.io", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "socket.io@^2.3.0", + "name": "socket.io", + "escapedName": "socket.io", + "rawSpec": "^2.3.0", + "saveSpec": null, + "fetchSpec": "^2.3.0" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", + "_shasum": "cd762ed6a4faeca59bc1f3e243c0969311eb73fb", + "_spec": "socket.io@^2.3.0", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph", + "bugs": { + "url": "https://github.com/socketio/socket.io/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Guillermo Rauch", + "email": "rauchg@gmail.com" + }, + { + "name": "Arnout Kazemier", + "email": "info@3rd-eden.com" + }, + { + "name": "Vladimir Dronnikov", + "email": "dronnikov@gmail.com" + }, + { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com" + } + ], + "dependencies": { + "debug": "~4.1.0", + "engine.io": "~3.4.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.3.0", + "socket.io-parser": "~3.4.0" + }, + "deprecated": false, + "description": "node.js realtime framework server", + "devDependencies": { + "expect.js": "0.3.1", + "mocha": "^3.5.3", + "nyc": "^11.2.1", + "superagent": "^3.8.2", + "supertest": "^3.0.0" + }, + "files": [ + "lib/" + ], + "homepage": "https://github.com/socketio/socket.io#readme", + "keywords": [ + "realtime", + "framework", + "websocket", + "tcp", + "events", + "socket", + "io" + ], + "license": "MIT", + "main": "./lib/index", + "name": "socket.io", + "repository": { + "type": "git", + "url": "git://github.com/socketio/socket.io.git" + }, + "scripts": { + "test": "nyc mocha --reporter spec --slow 200 --bail --timeout 10000 test/socket.io.js" + }, + "version": "2.3.0" +} diff --git a/node_modules/to-array/.npmignore b/node_modules/to-array/.npmignore @@ -0,0 +1,3 @@ +node_modules +*.log +*.err+ \ No newline at end of file diff --git a/node_modules/to-array/LICENCE b/node_modules/to-array/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.+ \ No newline at end of file diff --git a/node_modules/to-array/README.md b/node_modules/to-array/README.md @@ -0,0 +1,22 @@ +# to-array + +Turn an array like into an array + +## Example + +``` js +var toArray = require("to-array") + , elems = document.links + +var array = toArray(elems) +``` + +## Installation + +`npm install to-array` + +## Contributors + + - Raynos + +## MIT Licenced diff --git a/node_modules/to-array/index.js b/node_modules/to-array/index.js @@ -0,0 +1,13 @@ +module.exports = toArray + +function toArray(list, index) { + var array = [] + + index = index || 0 + + for (var i = index || 0; i < list.length; i++) { + array[i - index] = list[i] + } + + return array +} diff --git a/node_modules/to-array/package.json b/node_modules/to-array/package.json @@ -0,0 +1,68 @@ +{ + "_from": "to-array@0.1.4", + "_id": "to-array@0.1.4", + "_inBundle": false, + "_integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "_location": "/to-array", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "to-array@0.1.4", + "name": "to-array", + "escapedName": "to-array", + "rawSpec": "0.1.4", + "saveSpec": null, + "fetchSpec": "0.1.4" + }, + "_requiredBy": [ + "/socket.io-client" + ], + "_resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "_shasum": "17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890", + "_spec": "to-array@0.1.4", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/socket.io-client", + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "bugs": { + "url": "https://github.com/Raynos/to-array/issues", + "email": "raynos2@gmail.com" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "to-array/index.js": "index.js" + } + }, + "contributors": [ + { + "name": "Jake Verbaten" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Turn an array like into an array", + "devDependencies": { + "tap": "~0.3.1" + }, + "homepage": "https://github.com/Raynos/to-array", + "keywords": [], + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/Raynos/to-array/raw/master/LICENSE" + } + ], + "main": "index", + "name": "to-array", + "repository": { + "type": "git", + "url": "git://github.com/Raynos/to-array.git" + }, + "scripts": { + "test": "tap --stderr --tap ./test" + }, + "version": "0.1.4" +} diff --git a/node_modules/ws/LICENSE b/node_modules/ws/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ws/README.md b/node_modules/ws/README.md @@ -0,0 +1,494 @@ +# ws: a Node.js WebSocket library + +[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws) +[![Linux Build](https://img.shields.io/travis/websockets/ws/master.svg?logo=travis)](https://travis-ci.com/websockets/ws) +[![Windows Build](https://img.shields.io/appveyor/ci/lpinca/ws/master.svg?logo=appveyor)](https://ci.appveyor.com/project/lpinca/ws) +[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg)](https://coveralls.io/github/websockets/ws) + +ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and +server implementation. + +Passes the quite extensive Autobahn test suite: [server][server-report], +[client][client-report]. + +**Note**: This module does not work in the browser. The client in the docs is a +reference to a back end with the role of a client in the WebSocket +communication. Browser clients must use the native +[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) +object. To make the same code work seamlessly on Node.js and the browser, you +can use one of the many wrappers available on npm, like +[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). + +## Table of Contents + +- [Protocol support](#protocol-support) +- [Installing](#installing) + - [Opt-in for performance and spec compliance](#opt-in-for-performance-and-spec-compliance) +- [API docs](#api-docs) +- [WebSocket compression](#websocket-compression) +- [Usage examples](#usage-examples) + - [Sending and receiving text data](#sending-and-receiving-text-data) + - [Sending binary data](#sending-binary-data) + - [Simple server](#simple-server) + - [External HTTP/S server](#external-https-server) + - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) + - [Client authentication](#client-authentication) + - [Server broadcast](#server-broadcast) + - [echo.websocket.org demo](#echowebsocketorg-demo) + - [Use the Node.js streams API](#use-the-nodejs-streams-api) + - [Other examples](#other-examples) +- [FAQ](#faq) + - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) + - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) + - [How to connect via a proxy?](#how-to-connect-via-a-proxy) +- [Changelog](#changelog) +- [License](#license) + +## Protocol support + +- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +- **HyBi drafts 13-17** (Current default, alternatively option + `protocolVersion: 13`) + +## Installing + +``` +npm install ws +``` + +### Opt-in for performance and spec compliance + +There are 2 optional modules that can be installed along side with the ws +module. These modules are binary addons which improve certain operations. +Prebuilt binaries are available for the most popular platforms so you don't +necessarily need to have a C++ compiler installed on your machine. + +- `npm install --save-optional bufferutil`: Allows to efficiently perform + operations such as masking and unmasking the data payload of the WebSocket + frames. +- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a + message contains valid UTF-8 as required by the spec. + +## API docs + +See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and +utility functions. + +## WebSocket compression + +ws supports the [permessage-deflate extension][permessage-deflate] which enables +the client and server to negotiate a compression algorithm and its parameters, +and then selectively apply it to the data payloads of each WebSocket message. + +The extension is disabled by default on the server and enabled by default on the +client. It adds a significant overhead in terms of performance and memory +consumption so we suggest to enable it only if it is really needed. + +Note that Node.js has a variety of issues with high-performance compression, +where increased concurrency, especially on Linux, can lead to [catastrophic +memory fragmentation][node-zlib-bug] and slow performance. If you intend to use +permessage-deflate in production, it is worthwhile to set up a test +representative of your workload and ensure Node.js/zlib will handle it with +acceptable performance and memory usage. + +Tuning of permessage-deflate can be done via the options defined below. You can +also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly +into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. + +See [the docs][ws-server-options] for more options. + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ + port: 8080, + perMessageDeflate: { + zlibDeflateOptions: { + // See zlib defaults. + chunkSize: 1024, + memLevel: 7, + level: 3 + }, + zlibInflateOptions: { + chunkSize: 10 * 1024 + }, + // Other options settable: + clientNoContextTakeover: true, // Defaults to negotiated value. + serverNoContextTakeover: true, // Defaults to negotiated value. + serverMaxWindowBits: 10, // Defaults to negotiated value. + // Below options specified as default values. + concurrencyLimit: 10, // Limits zlib concurrency for perf. + threshold: 1024 // Size (in bytes) below which messages + // should not be compressed. + } +}); +``` + +The client will only use the extension if it is supported and enabled on the +server. To always disable the extension on the client set the +`perMessageDeflate` option to `false`. + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('ws://www.host.com/path', { + perMessageDeflate: false +}); +``` + +## Usage examples + +### Sending and receiving text data + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function incoming(data) { + console.log(data); +}); +``` + +### Sending binary data + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('open', function open() { + const array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array); +}); +``` + +### Simple server + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(message) { + console.log('received: %s', message); + }); + + ws.send('something'); +}); +``` + +### External HTTP/S server + +```js +const fs = require('fs'); +const https = require('https'); +const WebSocket = require('ws'); + +const server = https.createServer({ + cert: fs.readFileSync('/path/to/cert.pem'), + key: fs.readFileSync('/path/to/key.pem') +}); +const wss = new WebSocket.Server({ server }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(message) { + console.log('received: %s', message); + }); + + ws.send('something'); +}); + +server.listen(8080); +``` + +### Multiple servers sharing a single HTTP/S server + +```js +const http = require('http'); +const WebSocket = require('ws'); +const url = require('url'); + +const server = http.createServer(); +const wss1 = new WebSocket.Server({ noServer: true }); +const wss2 = new WebSocket.Server({ noServer: true }); + +wss1.on('connection', function connection(ws) { + // ... +}); + +wss2.on('connection', function connection(ws) { + // ... +}); + +server.on('upgrade', function upgrade(request, socket, head) { + const pathname = url.parse(request.url).pathname; + + if (pathname === '/foo') { + wss1.handleUpgrade(request, socket, head, function done(ws) { + wss1.emit('connection', ws, request); + }); + } else if (pathname === '/bar') { + wss2.handleUpgrade(request, socket, head, function done(ws) { + wss2.emit('connection', ws, request); + }); + } else { + socket.destroy(); + } +}); + +server.listen(8080); +``` + +### Client authentication + +```js +const http = require('http'); +const WebSocket = require('ws'); + +const server = http.createServer(); +const wss = new WebSocket.Server({ noServer: true }); + +wss.on('connection', function connection(ws, request, client) { + ws.on('message', function message(msg) { + console.log(`Received message ${msg} from user ${client}`); + }); +}); + +server.on('upgrade', function upgrade(request, socket, head) { + authenticate(request, (err, client) => { + if (err || !client) { + socket.destroy(); + return; + } + + wss.handleUpgrade(request, socket, head, function done(ws) { + wss.emit('connection', ws, request, client); + }); + }); +}); + +server.listen(8080); +``` + +Also see the provided [example][session-parse-example] using `express-session`. + +### Server broadcast + +A client WebSocket broadcasting to all connected WebSocket clients, including +itself. + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(data) { + wss.clients.forEach(function each(client) { + if (client.readyState === WebSocket.OPEN) { + client.send(data); + } + }); + }); +}); +``` + +A client WebSocket broadcasting to every other connected WebSocket clients, +excluding itself. + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('message', function incoming(data) { + wss.clients.forEach(function each(client) { + if (client !== ws && client.readyState === WebSocket.OPEN) { + client.send(data); + } + }); + }); +}); +``` + +### echo.websocket.org demo + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('wss://echo.websocket.org/', { + origin: 'https://websocket.org' +}); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now()); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function incoming(data) { + console.log(`Roundtrip time: ${Date.now() - data} ms`); + + setTimeout(function timeout() { + ws.send(Date.now()); + }, 500); +}); +``` + +### Use the Node.js streams API + +```js +const WebSocket = require('ws'); + +const ws = new WebSocket('wss://echo.websocket.org/', { + origin: 'https://websocket.org' +}); + +const duplex = WebSocket.createWebSocketStream(ws, { encoding: 'utf8' }); + +duplex.pipe(process.stdout); +process.stdin.pipe(duplex); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Otherwise, see the test cases. + +## FAQ + +### How to get the IP address of the client? + +The remote IP address can be obtained from the raw socket. + +```js +const WebSocket = require('ws'); + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws, req) { + const ip = req.connection.remoteAddress; +}); +``` + +When the server runs behind a proxy like NGINX, the de-facto standard is to use +the `X-Forwarded-For` header. + +```js +wss.on('connection', function connection(ws, req) { + const ip = req.headers['x-forwarded-for'].split(/\s*,\s*/)[0]; +}); +``` + +### How to detect and close broken connections? + +Sometimes the link between the server and the client can be interrupted in a way +that keeps both the server and the client unaware of the broken state of the +connection (e.g. when pulling the cord). + +In these cases ping messages can be used as a means to verify that the remote +endpoint is still responsive. + +```js +const WebSocket = require('ws'); + +function noop() {} + +function heartbeat() { + this.isAlive = true; +} + +const wss = new WebSocket.Server({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.isAlive = true; + ws.on('pong', heartbeat); +}); + +const interval = setInterval(function ping() { + wss.clients.forEach(function each(ws) { + if (ws.isAlive === false) return ws.terminate(); + + ws.isAlive = false; + ws.ping(noop); + }); +}, 30000); + +wss.on('close', function close() { + clearInterval(interval); +}); +``` + +Pong messages are automatically sent in response to ping messages as required by +the spec. + +Just like the server example above your clients might as well lose connection +without knowing it. You might want to add a ping listener on your clients to +prevent that. A simple implementation would be: + +```js +const WebSocket = require('ws'); + +function heartbeat() { + clearTimeout(this.pingTimeout); + + // Use `WebSocket#terminate()`, which immediately destroys the connection, + // instead of `WebSocket#close()`, which waits for the close timer. + // Delay should be equal to the interval at which your server + // sends out pings plus a conservative assumption of the latency. + this.pingTimeout = setTimeout(() => { + this.terminate(); + }, 30000 + 1000); +} + +const client = new WebSocket('wss://echo.websocket.org/'); + +client.on('open', heartbeat); +client.on('ping', heartbeat); +client.on('close', function clear() { + clearTimeout(this.pingTimeout); +}); +``` + +### How to connect via a proxy? + +Use a custom `http.Agent` implementation like [https-proxy-agent][] or +[socks-proxy-agent][]. + +## Changelog + +We're using the GitHub [releases][changelog] for changelog entries. + +## License + +[MIT](LICENSE) + +[changelog]: https://github.com/websockets/ws/releases +[client-report]: http://websockets.github.io/ws/autobahn/clients/ +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent +[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 +[node-zlib-deflaterawdocs]: + https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options +[permessage-deflate]: https://tools.ietf.org/html/rfc7692 +[server-report]: http://websockets.github.io/ws/autobahn/servers/ +[session-parse-example]: ./examples/express-session-parse +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent +[ws-server-options]: + https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback diff --git a/node_modules/ws/browser.js b/node_modules/ws/browser.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function() { + throw new Error( + 'ws does not work in the browser. Browser clients must use the native ' + + 'WebSocket object' + ); +}; diff --git a/node_modules/ws/index.js b/node_modules/ws/index.js @@ -0,0 +1,10 @@ +'use strict'; + +const WebSocket = require('./lib/websocket'); + +WebSocket.createWebSocketStream = require('./lib/stream'); +WebSocket.Server = require('./lib/websocket-server'); +WebSocket.Receiver = require('./lib/receiver'); +WebSocket.Sender = require('./lib/sender'); + +module.exports = WebSocket; diff --git a/node_modules/ws/lib/buffer-util.js b/node_modules/ws/lib/buffer-util.js @@ -0,0 +1,146 @@ +'use strict'; + +const { EMPTY_BUFFER } = require('./constants'); + +/** + * Merges an array of buffers into a new buffer. + * + * @param {Buffer[]} list The array of buffers to concat + * @param {Number} totalLength The total length of buffers in the list + * @return {Buffer} The resulting buffer + * @public + */ +function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + + if (offset < totalLength) return target.slice(0, offset); + + return target; +} + +/** + * Masks a buffer using the given mask. + * + * @param {Buffer} source The buffer to mask + * @param {Buffer} mask The mask to use + * @param {Buffer} output The buffer where to store the result + * @param {Number} offset The offset at which to start writing + * @param {Number} length The number of bytes to mask. + * @public + */ +function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } +} + +/** + * Unmasks a buffer using the given mask. + * + * @param {Buffer} buffer The buffer to unmask + * @param {Buffer} mask The mask to use + * @public + */ +function _unmask(buffer, mask) { + // Required until https://github.com/nodejs/node/issues/9006 is resolved. + const length = buffer.length; + for (let i = 0; i < length; i++) { + buffer[i] ^= mask[i & 3]; + } +} + +/** + * Converts a buffer to an `ArrayBuffer`. + * + * @param {Buffer} buf The buffer to convert + * @return {ArrayBuffer} Converted buffer + * @public + */ +function toArrayBuffer(buf) { + if (buf.byteLength === buf.buffer.byteLength) { + return buf.buffer; + } + + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); +} + +/** + * Converts `data` to a `Buffer`. + * + * @param {*} data The data to convert + * @return {Buffer} The buffer + * @throws {TypeError} + * @public + */ +function toBuffer(data) { + toBuffer.readOnly = true; + + if (Buffer.isBuffer(data)) return data; + + let buf; + + if (data instanceof ArrayBuffer) { + buf = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + buf = viewToBuffer(data); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + + return buf; +} + +/** + * Converts an `ArrayBuffer` view into a buffer. + * + * @param {(DataView|TypedArray)} view The view to convert + * @return {Buffer} Converted view + * @private + */ +function viewToBuffer(view) { + const buf = Buffer.from(view.buffer); + + if (view.byteLength !== view.buffer.byteLength) { + return buf.slice(view.byteOffset, view.byteOffset + view.byteLength); + } + + return buf; +} + +try { + const bufferUtil = require('bufferutil'); + const bu = bufferUtil.BufferUtil || bufferUtil; + + module.exports = { + concat, + mask(source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bu.mask(source, mask, output, offset, length); + }, + toArrayBuffer, + toBuffer, + unmask(buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bu.unmask(buffer, mask); + } + }; +} catch (e) /* istanbul ignore next */ { + module.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask + }; +} diff --git a/node_modules/ws/lib/constants.js b/node_modules/ws/lib/constants.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], + GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', + kStatusCode: Symbol('status-code'), + kWebSocket: Symbol('websocket'), + EMPTY_BUFFER: Buffer.alloc(0), + NOOP: () => {} +}; diff --git a/node_modules/ws/lib/event-target.js b/node_modules/ws/lib/event-target.js @@ -0,0 +1,170 @@ +'use strict'; + +/** + * Class representing an event. + * + * @private + */ +class Event { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @param {Object} target A reference to the target to which the event was dispatched + */ + constructor(type, target) { + this.target = target; + this.type = type; + } +} + +/** + * Class representing a message event. + * + * @extends Event + * @private + */ +class MessageEvent extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(data, target) { + super('message', target); + + this.data = data; + } +} + +/** + * Class representing a close event. + * + * @extends Event + * @private + */ +class CloseEvent extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {Number} code The status code explaining why the connection is being closed + * @param {String} reason A human-readable string explaining why the connection is closing + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(code, reason, target) { + super('close', target); + + this.wasClean = target._closeFrameReceived && target._closeFrameSent; + this.reason = reason; + this.code = code; + } +} + +/** + * Class representing an open event. + * + * @extends Event + * @private + */ +class OpenEvent extends Event { + /** + * Create a new `OpenEvent`. + * + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(target) { + super('open', target); + } +} + +/** + * Class representing an error event. + * + * @extends Event + * @private + */ +class ErrorEvent extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {Object} error The error that generated this event + * @param {WebSocket} target A reference to the target to which the event was dispatched + */ + constructor(error, target) { + super('error', target); + + this.message = error.message; + this.error = error; + } +} + +/** + * This provides methods for emulating the `EventTarget` interface. It's not + * meant to be used directly. + * + * @mixin + */ +const EventTarget = { + /** + * Register an event listener. + * + * @param {String} method A string representing the event type to listen for + * @param {Function} listener The listener to add + * @public + */ + addEventListener(method, listener) { + if (typeof listener !== 'function') return; + + function onMessage(data) { + listener.call(this, new MessageEvent(data, this)); + } + + function onClose(code, message) { + listener.call(this, new CloseEvent(code, message, this)); + } + + function onError(error) { + listener.call(this, new ErrorEvent(error, this)); + } + + function onOpen() { + listener.call(this, new OpenEvent(this)); + } + + if (method === 'message') { + onMessage._listener = listener; + this.on(method, onMessage); + } else if (method === 'close') { + onClose._listener = listener; + this.on(method, onClose); + } else if (method === 'error') { + onError._listener = listener; + this.on(method, onError); + } else if (method === 'open') { + onOpen._listener = listener; + this.on(method, onOpen); + } else { + this.on(method, listener); + } + }, + + /** + * Remove an event listener. + * + * @param {String} method A string representing the event type to remove + * @param {Function} listener The listener to remove + * @public + */ + removeEventListener(method, listener) { + const listeners = this.listeners(method); + + for (let i = 0; i < listeners.length; i++) { + if (listeners[i] === listener || listeners[i]._listener === listener) { + this.removeListener(method, listeners[i]); + } + } + } +}; + +module.exports = EventTarget; diff --git a/node_modules/ws/lib/extension.js b/node_modules/ws/lib/extension.js @@ -0,0 +1,223 @@ +'use strict'; + +// +// Allowed token characters: +// +// '!', '#', '$', '%', '&', ''', '*', '+', '-', +// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' +// +// tokenChars[32] === 0 // ' ' +// tokenChars[33] === 1 // '!' +// tokenChars[34] === 0 // '"' +// ... +// +// prettier-ignore +const tokenChars = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 + 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 +]; + +/** + * Adds an offer to the map of extension offers or a parameter to the map of + * parameters. + * + * @param {Object} dest The map of extension offers or parameters + * @param {String} name The extension or parameter name + * @param {(Object|Boolean|String)} elem The extension parameters or the + * parameter value + * @private + */ +function push(dest, name, elem) { + if (dest[name] === undefined) dest[name] = [elem]; + else dest[name].push(elem); +} + +/** + * Parses the `Sec-WebSocket-Extensions` header into an object. + * + * @param {String} header The field value of the header + * @return {Object} The parsed object + * @public + */ +function parse(header) { + const offers = Object.create(null); + + if (header === undefined || header === '') return offers; + + let params = Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let end = -1; + let i = 0; + + for (; i < header.length; i++) { + const code = header.charCodeAt(i); + + if (extensionName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 /* ' ' */ || code === 0x09 /* '\t' */) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + const name = header.slice(start, end); + if (code === 0x2c) { + push(offers, name, params); + params = Object.create(null); + } else { + extensionName = name; + } + + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 || code === 0x09) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + start = end = -1; + } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + // + // The value of a quoted-string after unescaping must conform to the + // token ABNF, so only token characters are valid. + // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 + // + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x22 /* '"' */ && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 0x5c /* '\' */) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 0x20 || code === 0x09)) { + if (end === -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ''); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + paramName = undefined; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + + if (start === -1 || inQuotes) { + throw new SyntaxError('Unexpected end of input'); + } + + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === undefined) { + push(offers, token, params); + } else { + if (paramName === undefined) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, '')); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + + return offers; +} + +/** + * Builds the `Sec-WebSocket-Extensions` header field value. + * + * @param {Object} extensions The map of extensions and parameters to format + * @return {String} A string representing the given object + * @public + */ +function format(extensions) { + return Object.keys(extensions) + .map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations + .map((params) => { + return [extension] + .concat( + Object.keys(params).map((k) => { + let values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values + .map((v) => (v === true ? k : `${k}=${v}`)) + .join('; '); + }) + ) + .join('; '); + }) + .join(', '); + }) + .join(', '); +} + +module.exports = { format, parse }; diff --git a/node_modules/ws/lib/limiter.js b/node_modules/ws/lib/limiter.js @@ -0,0 +1,54 @@ +'use strict'; + +const kDone = Symbol('kDone'); +const kRun = Symbol('kRun'); + +/** + * A very simple job queue with adjustable concurrency. Adapted from + * https://github.com/STRML/async-limiter + */ +class Limiter { + /** + * Creates a new `Limiter`. + * + * @param {Number} concurrency The maximum number of jobs allowed to run + * concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + + /** + * Adds a job to the queue. + * + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + + if (this.jobs.length) { + const job = this.jobs.shift(); + + this.pending++; + job(this[kDone]); + } + } +} + +module.exports = Limiter; diff --git a/node_modules/ws/lib/permessage-deflate.js b/node_modules/ws/lib/permessage-deflate.js @@ -0,0 +1,512 @@ +'use strict'; + +const zlib = require('zlib'); + +const bufferUtil = require('./buffer-util'); +const Limiter = require('./limiter'); +const { kStatusCode, NOOP } = require('./constants'); + +const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); +const kPerMessageDeflate = Symbol('permessage-deflate'); +const kTotalLength = Symbol('total-length'); +const kCallback = Symbol('callback'); +const kBuffers = Symbol('buffers'); +const kError = Symbol('error'); + +// +// We limit zlib concurrency, which prevents severe memory fragmentation +// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 +// and https://github.com/websockets/ws/issues/1202 +// +// Intentionally global; it's the global thread pool that's an issue. +// +let zlibLimiter; + +/** + * permessage-deflate implementation. + */ +class PerMessageDeflate { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} options Configuration options + * @param {Boolean} options.serverNoContextTakeover Request/accept disabling + * of server context takeover + * @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge + * disabling of client context takeover + * @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the + * use of a custom server window size + * @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support + * for, or request, a custom client window size + * @param {Object} options.zlibDeflateOptions Options to pass to zlib on deflate + * @param {Object} options.zlibInflateOptions Options to pass to zlib on inflate + * @param {Number} options.threshold Size (in bytes) below which messages + * should not be compressed + * @param {Number} options.concurrencyLimit The number of concurrent calls to + * zlib + * @param {Boolean} isServer Create the instance in either server or client + * mode + * @param {Number} maxPayload The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = + this._options.threshold !== undefined ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + + this.params = null; + + if (!zlibLimiter) { + const concurrency = + this._options.concurrencyLimit !== undefined + ? this._options.concurrencyLimit + : 10; + zlibLimiter = new Limiter(concurrency); + } + } + + /** + * @type {String} + */ + static get extensionName() { + return 'permessage-deflate'; + } + + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + + return params; + } + + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + + this.params = this._isServer + ? this.acceptAsServer(configurations) + : this.acceptAsClient(configurations); + + return this.params; + } + + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + + if (this._deflate) { + const callback = this._deflate[kCallback]; + + this._deflate.close(); + this._deflate = null; + + if (callback) { + callback( + new Error( + 'The deflate stream was closed while data was being processed' + ) + ); + } + } + } + + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if ( + (opts.serverNoContextTakeover === false && + params.server_no_context_takeover) || + (params.server_max_window_bits && + (opts.serverMaxWindowBits === false || + (typeof opts.serverMaxWindowBits === 'number' && + opts.serverMaxWindowBits > params.server_max_window_bits))) || + (typeof opts.clientMaxWindowBits === 'number' && + !params.client_max_window_bits) + ) { + return false; + } + + return true; + }); + + if (!accepted) { + throw new Error('None of the extension offers can be accepted'); + } + + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if ( + accepted.client_max_window_bits === true || + opts.clientMaxWindowBits === false + ) { + delete accepted.client_max_window_bits; + } + + return accepted; + } + + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + + if ( + this._options.clientNoContextTakeover === false && + params.client_no_context_takeover + ) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === 'number') { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if ( + this._options.clientMaxWindowBits === false || + (typeof this._options.clientMaxWindowBits === 'number' && + params.client_max_window_bits > this._options.clientMaxWindowBits) + ) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + + return params; + } + + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + let value = params[key]; + + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + + value = value[0]; + + if (key === 'client_max_window_bits') { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === 'server_max_window_bits') { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if ( + key === 'client_no_context_takeover' || + key === 'server_no_context_takeover' + ) { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + + params[key] = value; + }); + }); + + return configurations; + } + + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Compress data. Concurrency limited. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on('error', inflateOnError); + this._inflate.on('data', inflateOnData); + } + + this._inflate[kCallback] = callback; + + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + + this._inflate.flush(() => { + const err = this._inflate[kError]; + + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + + const data = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + } + + callback(null, data); + }); + } + + /** + * Compress data. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + // + // An `'error'` event is emitted, only on Node.js < 10.0.0, if the + // `zlib.DeflateRaw` instance is closed while data is being processed. + // This can happen if `PerMessageDeflate#cleanup()` is called at the wrong + // time due to an abnormal WebSocket closure. + // + this._deflate.on('error', NOOP); + this._deflate.on('data', deflateOnData); + } + + this._deflate[kCallback] = callback; + + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + // + // The deflate stream was closed while data was being processed. + // + return; + } + + let data = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + + if (fin) data = data.slice(0, data.length - 4); + + // + // Ensure that the callback will not be called again in + // `PerMessageDeflate#cleanup()`. + // + this._deflate[kCallback] = null; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.close(); + this._deflate = null; + } else { + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + } + + callback(null, data); + }); + } +} + +module.exports = PerMessageDeflate; + +/** + * The listener of the `zlib.DeflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; +} + +/** + * The listener of the `zlib.InflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + + if ( + this[kPerMessageDeflate]._maxPayload < 1 || + this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload + ) { + this[kBuffers].push(chunk); + return; + } + + this[kError] = new RangeError('Max payload size exceeded'); + this[kError][kStatusCode] = 1009; + this.removeListener('data', inflateOnData); + this.reset(); +} + +/** + * The listener of the `zlib.InflateRaw` stream `'error'` event. + * + * @param {Error} err The emitted error + * @private + */ +function inflateOnError(err) { + // + // There is no need to call `Zlib#close()` as the handle is automatically + // closed when an error is emitted. + // + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); +} diff --git a/node_modules/ws/lib/receiver.js b/node_modules/ws/lib/receiver.js @@ -0,0 +1,506 @@ +'use strict'; + +const { Writable } = require('stream'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket +} = require('./constants'); +const { concat, toArrayBuffer, unmask } = require('./buffer-util'); +const { isValidStatusCode, isValidUTF8 } = require('./validation'); + +const GET_INFO = 0; +const GET_PAYLOAD_LENGTH_16 = 1; +const GET_PAYLOAD_LENGTH_64 = 2; +const GET_MASK = 3; +const GET_DATA = 4; +const INFLATING = 5; + +/** + * HyBi Receiver implementation. + * + * @extends stream.Writable + */ +class Receiver extends Writable { + /** + * Creates a Receiver instance. + * + * @param {String} binaryType The type for binary data + * @param {Object} extensions An object containing the negotiated extensions + * @param {Boolean} isServer Specifies whether to operate in client or server + * mode + * @param {Number} maxPayload The maximum allowed message length + */ + constructor(binaryType, extensions, isServer, maxPayload) { + super(); + + this._binaryType = binaryType || BINARY_TYPES[0]; + this[kWebSocket] = undefined; + this._extensions = extensions || {}; + this._isServer = !!isServer; + this._maxPayload = maxPayload | 0; + + this._bufferedBytes = 0; + this._buffers = []; + + this._compressed = false; + this._payloadLength = 0; + this._mask = undefined; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + + this._state = GET_INFO; + this._loop = false; + } + + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + */ + _write(chunk, encoding, cb) { + if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); + + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + + if (n === this._buffers[0].length) return this._buffers.shift(); + + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = buf.slice(n); + return buf.slice(0, n); + } + + const dst = Buffer.allocUnsafe(n); + + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = buf.slice(n); + } + + n -= buf.length; + } while (n > 0); + + return dst; + } + + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + let err; + this._loop = true; + + do { + switch (this._state) { + case GET_INFO: + err = this.getInfo(); + break; + case GET_PAYLOAD_LENGTH_16: + err = this.getPayloadLength16(); + break; + case GET_PAYLOAD_LENGTH_64: + err = this.getPayloadLength64(); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + err = this.getData(cb); + break; + default: + // `INFLATING` + this._loop = false; + return; + } + } while (this._loop); + + cb(err); + } + + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + const buf = this.consume(2); + + if ((buf[0] & 0x30) !== 0x00) { + this._loop = false; + return error(RangeError, 'RSV2 and RSV3 must be clear', true, 1002); + } + + const compressed = (buf[0] & 0x40) === 0x40; + + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + this._loop = false; + return error(RangeError, 'RSV1 must be clear', true, 1002); + } + + this._fin = (buf[0] & 0x80) === 0x80; + this._opcode = buf[0] & 0x0f; + this._payloadLength = buf[1] & 0x7f; + + if (this._opcode === 0x00) { + if (compressed) { + this._loop = false; + return error(RangeError, 'RSV1 must be clear', true, 1002); + } + + if (!this._fragmented) { + this._loop = false; + return error(RangeError, 'invalid opcode 0', true, 1002); + } + + this._opcode = this._fragmented; + } else if (this._opcode === 0x01 || this._opcode === 0x02) { + if (this._fragmented) { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + + this._compressed = compressed; + } else if (this._opcode > 0x07 && this._opcode < 0x0b) { + if (!this._fin) { + this._loop = false; + return error(RangeError, 'FIN must be set', true, 1002); + } + + if (compressed) { + this._loop = false; + return error(RangeError, 'RSV1 must be clear', true, 1002); + } + + if (this._payloadLength > 0x7d) { + this._loop = false; + return error( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002 + ); + } + } else { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 0x80) === 0x80; + + if (this._isServer) { + if (!this._masked) { + this._loop = false; + return error(RangeError, 'MASK must be set', true, 1002); + } + } else if (this._masked) { + this._loop = false; + return error(RangeError, 'MASK must be clear', true, 1002); + } + + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else return this.haveLength(); + } + + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + this._payloadLength = this.consume(2).readUInt16BE(0); + return this.haveLength(); + } + + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + + // + // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned + // if payload length is greater than this number. + // + if (num > Math.pow(2, 53 - 32) - 1) { + this._loop = false; + return error( + RangeError, + 'Unsupported WebSocket frame: payload length > 2^53 - 1', + false, + 1009 + ); + } + + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + return this.haveLength(); + } + + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 0x08) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + this._loop = false; + return error(RangeError, 'Max payload size exceeded', false, 1009); + } + } + + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + + this._mask = this.consume(4); + this._state = GET_DATA; + } + + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + + data = this.consume(this._payloadLength); + if (this._masked) unmask(data, this._mask); + } + + if (this._opcode > 0x07) return this.controlMessage(data); + + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + + if (data.length) { + // + // This message is not compressed so its lenght is the sum of the payload + // length of all fragments. + // + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + + return this.dataMessage(); + } + + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + return cb( + error(RangeError, 'Max payload size exceeded', false, 1009) + ); + } + + this._fragments.push(buf); + } + + const er = this.dataMessage(); + if (er) return cb(er); + + this.startLoop(cb); + }); + } + + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const messageLength = this._messageLength; + const fragments = this._fragments; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + + if (this._opcode === 2) { + let data; + + if (this._binaryType === 'nodebuffer') { + data = concat(fragments, messageLength); + } else if (this._binaryType === 'arraybuffer') { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + + this.emit('message', data); + } else { + const buf = concat(fragments, messageLength); + + if (!isValidUTF8(buf)) { + this._loop = false; + return error(Error, 'invalid UTF-8 sequence', true, 1007); + } + + this.emit('message', buf.toString()); + } + } + + this._state = GET_INFO; + } + + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data) { + if (this._opcode === 0x08) { + this._loop = false; + + if (data.length === 0) { + this.emit('conclude', 1005, ''); + this.end(); + } else if (data.length === 1) { + return error(RangeError, 'invalid payload length 1', true, 1002); + } else { + const code = data.readUInt16BE(0); + + if (!isValidStatusCode(code)) { + return error(RangeError, `invalid status code ${code}`, true, 1002); + } + + const buf = data.slice(2); + + if (!isValidUTF8(buf)) { + return error(Error, 'invalid UTF-8 sequence', true, 1007); + } + + this.emit('conclude', code, buf.toString()); + this.end(); + } + } else if (this._opcode === 0x09) { + this.emit('ping', data); + } else { + this.emit('pong', data); + } + + this._state = GET_INFO; + } +} + +module.exports = Receiver; + +/** + * Builds an error object. + * + * @param {(Error|RangeError)} ErrorCtor The error constructor + * @param {String} message The error message + * @param {Boolean} prefix Specifies whether or not to add a default prefix to + * `message` + * @param {Number} statusCode The status code + * @return {(Error|RangeError)} The error + * @private + */ +function error(ErrorCtor, message, prefix, statusCode) { + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + + Error.captureStackTrace(err, error); + err[kStatusCode] = statusCode; + return err; +} diff --git a/node_modules/ws/lib/sender.js b/node_modules/ws/lib/sender.js @@ -0,0 +1,390 @@ +'use strict'; + +const { randomFillSync } = require('crypto'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { EMPTY_BUFFER } = require('./constants'); +const { isValidStatusCode } = require('./validation'); +const { mask: applyMask, toBuffer } = require('./buffer-util'); + +const mask = Buffer.alloc(4); + +/** + * HyBi Sender implementation. + */ +class Sender { + /** + * Creates a Sender instance. + * + * @param {net.Socket} socket The connection socket + * @param {Object} extensions An object containing the negotiated extensions + */ + constructor(socket, extensions) { + this._extensions = extensions || {}; + this._socket = socket; + + this._firstFragment = true; + this._compress = false; + + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {Buffer} data The data to frame + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} options.readOnly Specifies whether `data` can be modified + * @param {Boolean} options.fin Specifies whether or not to set the FIN bit + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit + * @return {Buffer[]} The framed data as a list of `Buffer` instances + * @public + */ + static frame(data, options) { + const merge = options.mask && options.readOnly; + let offset = options.mask ? 6 : 2; + let payloadLength = data.length; + + if (data.length >= 65536) { + offset += 8; + payloadLength = 127; + } else if (data.length > 125) { + offset += 2; + payloadLength = 126; + } + + const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); + + target[0] = options.fin ? options.opcode | 0x80 : options.opcode; + if (options.rsv1) target[0] |= 0x40; + + target[1] = payloadLength; + + if (payloadLength === 126) { + target.writeUInt16BE(data.length, 2); + } else if (payloadLength === 127) { + target.writeUInt32BE(0, 2); + target.writeUInt32BE(data.length, 6); + } + + if (!options.mask) return [target, data]; + + randomFillSync(mask, 0, 4); + + target[1] |= 0x80; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + + if (merge) { + applyMask(data, mask, target, offset, data.length); + return [target]; + } + + applyMask(data, mask, data, 0, data.length); + return [target, data]; + } + + /** + * Sends a close message to the other peer. + * + * @param {(Number|undefined)} code The status code component of the body + * @param {String} data The message component of the body + * @param {Boolean} mask Specifies whether or not to mask the message + * @param {Function} cb Callback + * @public + */ + close(code, data, mask, cb) { + let buf; + + if (code === undefined) { + buf = EMPTY_BUFFER; + } else if (typeof code !== 'number' || !isValidStatusCode(code)) { + throw new TypeError('First argument must be a valid error code number'); + } else if (data === undefined || data === '') { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + + if (length > 123) { + throw new RangeError('The message must not be greater than 123 bytes'); + } + + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + buf.write(data, 2); + } + + if (this._deflating) { + this.enqueue([this.doClose, buf, mask, cb]); + } else { + this.doClose(buf, mask, cb); + } + } + + /** + * Frames and sends a close message. + * + * @param {Buffer} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @private + */ + doClose(data, mask, cb) { + this.sendFrame( + Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 0x08, + mask, + readOnly: false + }), + cb + ); + } + + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @public + */ + ping(data, mask, cb) { + const buf = toBuffer(data); + + if (buf.length > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + if (this._deflating) { + this.enqueue([this.doPing, buf, mask, toBuffer.readOnly, cb]); + } else { + this.doPing(buf, mask, toBuffer.readOnly, cb); + } + } + + /** + * Frames and sends a ping message. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Boolean} readOnly Specifies whether `data` can be modified + * @param {Function} cb Callback + * @private + */ + doPing(data, mask, readOnly, cb) { + this.sendFrame( + Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 0x09, + mask, + readOnly + }), + cb + ); + } + + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @public + */ + pong(data, mask, cb) { + const buf = toBuffer(data); + + if (buf.length > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + if (this._deflating) { + this.enqueue([this.doPong, buf, mask, toBuffer.readOnly, cb]); + } else { + this.doPong(buf, mask, toBuffer.readOnly, cb); + } + } + + /** + * Frames and sends a pong message. + * + * @param {*} data The message to send + * @param {Boolean} mask Specifies whether or not to mask `data` + * @param {Boolean} readOnly Specifies whether `data` can be modified + * @param {Function} cb Callback + * @private + */ + doPong(data, mask, readOnly, cb) { + this.sendFrame( + Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 0x0a, + mask, + readOnly + }), + cb + ); + } + + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} options.compress Specifies whether or not to compress `data` + * @param {Boolean} options.binary Specifies whether `data` is binary or text + * @param {Boolean} options.fin Specifies whether the fragment is the last one + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Function} cb Callback + * @public + */ + send(data, options, cb) { + const buf = toBuffer(data); + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + + if (this._firstFragment) { + this._firstFragment = false; + if (rsv1 && perMessageDeflate) { + rsv1 = buf.length >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + + if (options.fin) this._firstFragment = true; + + if (perMessageDeflate) { + const opts = { + fin: options.fin, + rsv1, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }; + + if (this._deflating) { + this.enqueue([this.dispatch, buf, this._compress, opts, cb]); + } else { + this.dispatch(buf, this._compress, opts, cb); + } + } else { + this.sendFrame( + Sender.frame(buf, { + fin: options.fin, + rsv1: false, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }), + cb + ); + } + } + + /** + * Dispatches a data message. + * + * @param {Buffer} data The message to send + * @param {Boolean} compress Specifies whether or not to compress `data` + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} options.readOnly Specifies whether `data` can be modified + * @param {Boolean} options.fin Specifies whether or not to set the FIN bit + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit + * @param {Function} cb Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(Sender.frame(data, options), cb); + return; + } + + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + 'The socket was closed while data was being compressed' + ); + + if (typeof cb === 'function') cb(err); + + for (let i = 0; i < this._queue.length; i++) { + const callback = this._queue[i][4]; + + if (typeof callback === 'function') callback(err); + } + + return; + } + + this._deflating = false; + options.readOnly = false; + this.sendFrame(Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + + this._bufferedBytes -= params[1].length; + Reflect.apply(params[0], this, params.slice(1)); + } + } + + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[1].length; + this._queue.push(params); + } + + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} cb Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } +} + +module.exports = Sender; diff --git a/node_modules/ws/lib/stream.js b/node_modules/ws/lib/stream.js @@ -0,0 +1,164 @@ +'use strict'; + +const { Duplex } = require('stream'); + +/** + * Emits the `'close'` event on a stream. + * + * @param {stream.Duplex} The stream. + * @private + */ +function emitClose(stream) { + stream.emit('close'); +} + +/** + * The listener of the `'end'` event. + * + * @private + */ +function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } +} + +/** + * The listener of the `'error'` event. + * + * @private + */ +function duplexOnError(err) { + this.removeListener('error', duplexOnError); + this.destroy(); + if (this.listenerCount('error') === 0) { + // Do not suppress the throwing behavior. + this.emit('error', err); + } +} + +/** + * Wraps a `WebSocket` in a duplex stream. + * + * @param {WebSocket} ws The `WebSocket` to wrap + * @param {Object} options The options for the `Duplex` constructor + * @return {stream.Duplex} The duplex stream + * @public + */ +function createWebSocketStream(ws, options) { + let resumeOnReceiverDrain = true; + + function receiverOnDrain() { + if (resumeOnReceiverDrain) ws._socket.resume(); + } + + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + ws._receiver.removeAllListeners('drain'); + ws._receiver.on('drain', receiverOnDrain); + }); + } else { + ws._receiver.removeAllListeners('drain'); + ws._receiver.on('drain', receiverOnDrain); + } + + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + + ws.on('message', function message(msg) { + if (!duplex.push(msg)) { + resumeOnReceiverDrain = false; + ws._socket.pause(); + } + }); + + ws.once('error', function error(err) { + if (duplex.destroyed) return; + + duplex.destroy(err); + }); + + ws.once('close', function close() { + if (duplex.destroyed) return; + + duplex.push(null); + }); + + duplex._destroy = function(err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + + let called = false; + + ws.once('error', function error(err) { + called = true; + callback(err); + }); + + ws.once('close', function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + ws.terminate(); + }; + + duplex._final = function(callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._final(callback); + }); + return; + } + + // If the value of the `_socket` property is `null` it means that `ws` is a + // client websocket and the handshake failed. In fact, when this happens, a + // socket is never assigned to the websocket. Wait for the `'error'` event + // that will be emitted by the websocket. + if (ws._socket === null) return; + + if (ws._socket._writableState.finished) { + if (duplex._readableState.endEmitted) duplex.destroy(); + callback(); + } else { + ws._socket.once('finish', function finish() { + // `duplex` is not destroyed here because the `'end'` event will be + // emitted on `duplex` after this `'finish'` event. The EOF signaling + // `null` chunk is, in fact, pushed when the websocket emits `'close'`. + callback(); + }); + ws.close(); + } + }; + + duplex._read = function() { + if (ws.readyState === ws.OPEN && !resumeOnReceiverDrain) { + resumeOnReceiverDrain = true; + if (!ws._receiver._writableState.needDrain) ws._socket.resume(); + } + }; + + duplex._write = function(chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + + ws.send(chunk, callback); + }; + + duplex.on('end', duplexOnEnd); + duplex.on('error', duplexOnError); + return duplex; +} + +module.exports = createWebSocketStream; diff --git a/node_modules/ws/lib/validation.js b/node_modules/ws/lib/validation.js @@ -0,0 +1,30 @@ +'use strict'; + +try { + const isValidUTF8 = require('utf-8-validate'); + + exports.isValidUTF8 = + typeof isValidUTF8 === 'object' + ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0 + : isValidUTF8; +} catch (e) /* istanbul ignore next */ { + exports.isValidUTF8 = () => true; +} + +/** + * Checks if a status code is allowed in a close frame. + * + * @param {Number} code The status code + * @return {Boolean} `true` if the status code is valid, else `false` + * @public + */ +exports.isValidStatusCode = (code) => { + return ( + (code >= 1000 && + code <= 1014 && + code !== 1004 && + code !== 1005 && + code !== 1006) || + (code >= 3000 && code <= 4999) + ); +}; diff --git a/node_modules/ws/lib/websocket-server.js b/node_modules/ws/lib/websocket-server.js @@ -0,0 +1,406 @@ +'use strict'; + +const EventEmitter = require('events'); +const { createHash } = require('crypto'); +const { createServer, STATUS_CODES } = require('http'); + +const PerMessageDeflate = require('./permessage-deflate'); +const WebSocket = require('./websocket'); +const { format, parse } = require('./extension'); +const { GUID } = require('./constants'); + +const keyRegex = /^[+/0-9A-Za-z]{22}==$/; +const kUsedByWebSocketServer = Symbol('kUsedByWebSocketServer'); + +/** + * Class representing a WebSocket server. + * + * @extends EventEmitter + */ +class WebSocketServer extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} options.backlog The maximum length of the queue of pending + * connections + * @param {Boolean} options.clientTracking Specifies whether or not to track + * clients + * @param {Function} options.handleProtocols A hook to handle protocols + * @param {String} options.host The hostname where to bind the server + * @param {Number} options.maxPayload The maximum allowed message size + * @param {Boolean} options.noServer Enable no server mode + * @param {String} options.path Accept only connections matching this path + * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable + * permessage-deflate + * @param {Number} options.port The port where to bind the server + * @param {http.Server} options.server A pre-created HTTP/S server to use + * @param {Function} options.verifyClient A hook to reject connections + * @param {Function} callback A listener for the `listening` event + */ + constructor(options, callback) { + super(); + + options = { + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + ...options + }; + + if (options.port == null && !options.server && !options.noServer) { + throw new TypeError( + 'One of the "port", "server", or "noServer" options must be specified' + ); + } + + if (options.port != null) { + this._server = createServer((req, res) => { + const body = STATUS_CODES[426]; + + res.writeHead(426, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + if (options.server[kUsedByWebSocketServer]) { + throw new Error( + 'The HTTP/S server is already being used by another WebSocket server' + ); + } + + options.server[kUsedByWebSocketServer] = true; + this._server = options.server; + } + + if (this._server) { + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, 'listening'), + error: this.emit.bind(this, 'error'), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, (ws) => { + this.emit('connection', ws, req); + }); + } + }); + } + + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) this.clients = new Set(); + this.options = options; + } + + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + + if (!this._server) return null; + return this._server.address(); + } + + /** + * Close the server. + * + * @param {Function} cb Callback + * @public + */ + close(cb) { + if (cb) this.once('close', cb); + + // + // Terminate all associated clients. + // + if (this.clients) { + for (const client of this.clients) client.terminate(); + } + + const server = this._server; + + if (server) { + this._removeListeners(); + this._removeListeners = this._server = null; + + // + // Close the http server if it was internally created. + // + if (this.options.port != null) { + server.close(() => this.emit('close')); + return; + } + + delete server[kUsedByWebSocketServer]; + } + + process.nextTick(emitClose, this); + } + + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf('?'); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + + if (pathname !== this.options.path) return false; + } + + return true; + } + + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on('error', socketOnError); + + const key = + req.headers['sec-websocket-key'] !== undefined + ? req.headers['sec-websocket-key'].trim() + : false; + const version = +req.headers['sec-websocket-version']; + const extensions = {}; + + if ( + req.method !== 'GET' || + req.headers.upgrade.toLowerCase() !== 'websocket' || + !key || + !keyRegex.test(key) || + (version !== 8 && version !== 13) || + !this.shouldHandle(req) + ) { + return abortHandshake(socket, 400); + } + + if (this.options.perMessageDeflate) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + + try { + const offers = parse(req.headers['sec-websocket-extensions']); + + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + return abortHandshake(socket, 400); + } + } + + // + // Optionally call external client verification handler. + // + if (this.options.verifyClient) { + const info = { + origin: + req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], + secure: !!(req.connection.authorized || req.connection.encrypted), + req + }; + + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + + this.completeUpgrade(key, extensions, req, socket, head, cb); + }); + return; + } + + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + + this.completeUpgrade(key, extensions, req, socket, head, cb); + } + + /** + * Upgrade the connection to WebSocket. + * + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Object} extensions The accepted extensions + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @private + */ + completeUpgrade(key, extensions, req, socket, head, cb) { + // + // Destroy the socket if the client has already sent a FIN packet. + // + if (!socket.readable || !socket.writable) return socket.destroy(); + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + const headers = [ + 'HTTP/1.1 101 Switching Protocols', + 'Upgrade: websocket', + 'Connection: Upgrade', + `Sec-WebSocket-Accept: ${digest}` + ]; + + const ws = new WebSocket(null); + let protocol = req.headers['sec-websocket-protocol']; + + if (protocol) { + protocol = protocol.trim().split(/ *, */); + + // + // Optionally call external protocol selection handler. + // + if (this.options.handleProtocols) { + protocol = this.options.handleProtocols(protocol, req); + } else { + protocol = protocol[0]; + } + + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws.protocol = protocol; + } + } + + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + + // + // Allow external modification/inspection of handshake headers. + // + this.emit('headers', headers, req); + + socket.write(headers.concat('\r\n').join('\r\n')); + socket.removeListener('error', socketOnError); + + ws.setSocket(socket, head, this.options.maxPayload); + + if (this.clients) { + this.clients.add(ws); + ws.on('close', () => this.clients.delete(ws)); + } + + cb(ws); + } +} + +module.exports = WebSocketServer; + +/** + * Add event listeners on an `EventEmitter` using a map of <event, listener> + * pairs. + * + * @param {EventEmitter} server The event emitter + * @param {Object.<String, Function>} map The listeners to add + * @return {Function} A function that will remove the added listeners when called + * @private + */ +function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; +} + +/** + * Emit a `'close'` event on an `EventEmitter`. + * + * @param {EventEmitter} server The event emitter + * @private + */ +function emitClose(server) { + server.emit('close'); +} + +/** + * Handle premature socket errors. + * + * @private + */ +function socketOnError() { + this.destroy(); +} + +/** + * Close the connection when preconditions are not fulfilled. + * + * @param {net.Socket} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} [message] The HTTP response body + * @param {Object} [headers] Additional HTTP response headers + * @private + */ +function abortHandshake(socket, code, message, headers) { + if (socket.writable) { + message = message || STATUS_CODES[code]; + headers = { + Connection: 'close', + 'Content-type': 'text/html', + 'Content-Length': Buffer.byteLength(message), + ...headers + }; + + socket.write( + `HTTP/1.1 ${code} ${STATUS_CODES[code]}\r\n` + + Object.keys(headers) + .map((h) => `${h}: ${headers[h]}`) + .join('\r\n') + + '\r\n\r\n' + + message + ); + } + + socket.removeListener('error', socketOnError); + socket.destroy(); +} diff --git a/node_modules/ws/lib/websocket.js b/node_modules/ws/lib/websocket.js @@ -0,0 +1,909 @@ +'use strict'; + +const EventEmitter = require('events'); +const https = require('https'); +const http = require('http'); +const net = require('net'); +const tls = require('tls'); +const { randomBytes, createHash } = require('crypto'); +const { URL } = require('url'); + +const PerMessageDeflate = require('./permessage-deflate'); +const Receiver = require('./receiver'); +const Sender = require('./sender'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kStatusCode, + kWebSocket, + NOOP +} = require('./constants'); +const { addEventListener, removeEventListener } = require('./event-target'); +const { format, parse } = require('./extension'); +const { toBuffer } = require('./buffer-util'); + +const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; +const protocolVersions = [8, 13]; +const closeTimeout = 30 * 1000; + +/** + * Class representing a WebSocket. + * + * @extends EventEmitter + */ +class WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|url.URL)} address The URL to which to connect + * @param {(String|String[])} protocols The subprotocols + * @param {Object} options Connection options + */ + constructor(address, protocols, options) { + super(); + + this.readyState = WebSocket.CONNECTING; + this.protocol = ''; + + this._binaryType = BINARY_TYPES[0]; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = ''; + this._closeTimer = null; + this._closeCode = 1006; + this._extensions = {}; + this._receiver = null; + this._sender = null; + this._socket = null; + + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + + if (Array.isArray(protocols)) { + protocols = protocols.join(', '); + } else if (typeof protocols === 'object' && protocols !== null) { + options = protocols; + protocols = undefined; + } + + initAsClient(this, address, protocols, options); + } else { + this._isServer = true; + } + } + + get CONNECTING() { + return WebSocket.CONNECTING; + } + get CLOSING() { + return WebSocket.CLOSING; + } + get CLOSED() { + return WebSocket.CLOSED; + } + get OPEN() { + return WebSocket.OPEN; + } + + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + + this._binaryType = type; + + // + // Allow to change `binaryType` on the fly. + // + if (this._receiver) this._receiver._binaryType = type; + } + + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + + // + // `socket.bufferSize` is `undefined` if the socket is closed. + // + return (this._socket.bufferSize || 0) + this._sender._bufferedBytes; + } + + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + + /** + * Set up the socket and the internal resources. + * + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Number} maxPayload The maximum allowed message size + * @private + */ + setSocket(socket, head, maxPayload) { + const receiver = new Receiver( + this._binaryType, + this._extensions, + this._isServer, + maxPayload + ); + + this._sender = new Sender(socket, this._extensions); + this._receiver = receiver; + this._socket = socket; + + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + + receiver.on('conclude', receiverOnConclude); + receiver.on('drain', receiverOnDrain); + receiver.on('error', receiverOnError); + receiver.on('message', receiverOnMessage); + receiver.on('ping', receiverOnPing); + receiver.on('pong', receiverOnPong); + + socket.setTimeout(0); + socket.setNoDelay(); + + if (head.length > 0) socket.unshift(head); + + socket.on('close', socketOnClose); + socket.on('data', socketOnData); + socket.on('end', socketOnEnd); + socket.on('error', socketOnError); + + this.readyState = WebSocket.OPEN; + this.emit('open'); + } + + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this.readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + return; + } + + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + + this._receiver.removeAllListeners(); + this.readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + } + + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} code Status code explaining why the connection is closing + * @param {String} data A string explaining why the connection is closing + * @public + */ + close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + return abortHandshake(this, this._req, msg); + } + + if (this.readyState === WebSocket.CLOSING) { + if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); + return; + } + + this.readyState = WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + // + // This error is handled by the `'error'` listener on the socket. We only + // want to know if the close frame has been sent here. + // + if (err) return; + + this._closeFrameSent = true; + if (this._closeFrameReceived) this._socket.end(); + }); + + // + // Specify a timeout for the closing handshake to complete. + // + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + + /** + * Send a ping. + * + * @param {*} data The data to send + * @param {Boolean} mask Indicates whether or not to mask `data` + * @param {Function} cb Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Send a pong. + * + * @param {*} data The data to send + * @param {Boolean} mask Indicates whether or not to mask `data` + * @param {Function} cb Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} options.compress Specifies whether or not to compress + * `data` + * @param {Boolean} options.binary Specifies whether `data` is binary or text + * @param {Boolean} options.fin Specifies whether the fragment is the last one + * @param {Boolean} options.mask Specifies whether or not to mask `data` + * @param {Function} cb Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + const opts = { + binary: typeof data !== 'string', + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + return abortHandshake(this, this._req, msg); + } + + if (this._socket) { + this.readyState = WebSocket.CLOSING; + this._socket.destroy(); + } + } +} + +readyStates.forEach((readyState, i) => { + WebSocket[readyState] = i; +}); + +// +// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. +// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface +// +['open', 'error', 'close', 'message'].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + /** + * Return the listener of the event. + * + * @return {(Function|undefined)} The event listener or `undefined` + * @public + */ + get() { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) return listeners[i]._listener; + } + + return undefined; + }, + /** + * Add a listener for the event. + * + * @param {Function} listener The listener to add + * @public + */ + set(listener) { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + // + // Remove only the listeners added via `addEventListener`. + // + if (listeners[i]._listener) this.removeListener(method, listeners[i]); + } + this.addEventListener(method, listener); + } + }); +}); + +WebSocket.prototype.addEventListener = addEventListener; +WebSocket.prototype.removeEventListener = removeEventListener; + +module.exports = WebSocket; + +/** + * Initialize a WebSocket client. + * + * @param {WebSocket} websocket The client to initialize + * @param {(String|url.URL)} address The URL to which to connect + * @param {String} protocols The subprotocols + * @param {Object} options Connection options + * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable + * permessage-deflate + * @param {Number} options.handshakeTimeout Timeout in milliseconds for the + * handshake request + * @param {Number} options.protocolVersion Value of the `Sec-WebSocket-Version` + * header + * @param {String} options.origin Value of the `Origin` or + * `Sec-WebSocket-Origin` header + * @param {Number} options.maxPayload The maximum allowed message size + * @param {Boolean} options.followRedirects Whether or not to follow redirects + * @param {Number} options.maxRedirects The maximum number of redirects allowed + * @private + */ +function initAsClient(websocket, address, protocols, options) { + const opts = { + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + createConnection: undefined, + socketPath: undefined, + hostname: undefined, + protocol: undefined, + timeout: undefined, + method: undefined, + auth: undefined, + host: undefined, + path: undefined, + port: undefined + }; + + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} ` + + `(supported versions: ${protocolVersions.join(', ')})` + ); + } + + let parsedUrl; + + if (address instanceof URL) { + parsedUrl = address; + websocket.url = address.href; + } else { + parsedUrl = new URL(address); + websocket.url = address; + } + + const isUnixSocket = parsedUrl.protocol === 'ws+unix:'; + + if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { + throw new Error(`Invalid URL: ${websocket.url}`); + } + + const isSecure = + parsedUrl.protocol === 'wss:' || parsedUrl.protocol === 'https:'; + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString('base64'); + const get = isSecure ? https.get : http.get; + let perMessageDeflate; + + opts.createConnection = isSecure ? tlsConnect : netConnect; + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith('[') + ? parsedUrl.hostname.slice(1, -1) + : parsedUrl.hostname; + opts.headers = { + 'Sec-WebSocket-Version': opts.protocolVersion, + 'Sec-WebSocket-Key': key, + Connection: 'Upgrade', + Upgrade: 'websocket', + ...opts.headers + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers['Sec-WebSocket-Extensions'] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols) { + opts.headers['Sec-WebSocket-Protocol'] = protocols; + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers['Sec-WebSocket-Origin'] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + + if (isUnixSocket) { + const parts = opts.path.split(':'); + + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + + let req = (websocket._req = get(opts)); + + if (opts.timeout) { + req.on('timeout', () => { + abortHandshake(websocket, req, 'Opening handshake has timed out'); + }); + } + + req.on('error', (err) => { + if (websocket._req.aborted) return; + + req = websocket._req = null; + websocket.readyState = WebSocket.CLOSING; + websocket.emit('error', err); + websocket.emitClose(); + }); + + req.on('response', (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + + if ( + location && + opts.followRedirects && + statusCode >= 300 && + statusCode < 400 + ) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, 'Maximum redirects exceeded'); + return; + } + + req.abort(); + + const addr = new URL(location, address); + + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit('unexpected-response', req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + + req.on('upgrade', (res, socket, head) => { + websocket.emit('upgrade', res); + + // + // The user may have closed the connection from a listener of the `upgrade` + // event. + // + if (websocket.readyState !== WebSocket.CONNECTING) return; + + req = websocket._req = null; + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + if (res.headers['sec-websocket-accept'] !== digest) { + abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header'); + return; + } + + const serverProt = res.headers['sec-websocket-protocol']; + const protList = (protocols || '').split(/, */); + let protError; + + if (!protocols && serverProt) { + protError = 'Server sent a subprotocol but none was requested'; + } else if (protocols && !serverProt) { + protError = 'Server sent no subprotocol'; + } else if (serverProt && !protList.includes(serverProt)) { + protError = 'Server sent an invalid subprotocol'; + } + + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + + if (serverProt) websocket.protocol = serverProt; + + if (perMessageDeflate) { + try { + const extensions = parse(res.headers['sec-websocket-extensions']); + + if (extensions[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + websocket._extensions[ + PerMessageDeflate.extensionName + ] = perMessageDeflate; + } + } catch (err) { + abortHandshake( + websocket, + socket, + 'Invalid Sec-WebSocket-Extensions header' + ); + return; + } + } + + websocket.setSocket(socket, head, opts.maxPayload); + }); +} + +/** + * Create a `net.Socket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {net.Socket} The newly created socket used to start the connection + * @private + */ +function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); +} + +/** + * Create a `tls.TLSSocket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {tls.TLSSocket} The newly created socket used to start the connection + * @private + */ +function tlsConnect(options) { + options.path = undefined; + + if (!options.servername && options.servername !== '') { + options.servername = options.host; + } + + return tls.connect(options); +} + +/** + * Abort the handshake and emit an error. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {(http.ClientRequest|net.Socket)} stream The request to abort or the + * socket to destroy + * @param {String} message The error message + * @private + */ +function abortHandshake(websocket, stream, message) { + websocket.readyState = WebSocket.CLOSING; + + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + + if (stream.setHeader) { + stream.abort(); + stream.once('abort', websocket.emitClose.bind(websocket)); + websocket.emit('error', err); + } else { + stream.destroy(err); + stream.once('error', websocket.emit.bind(websocket, 'error')); + stream.once('close', websocket.emitClose.bind(websocket)); + } +} + +/** + * Handle cases where the `ping()`, `pong()`, or `send()` methods are called + * when the `readyState` attribute is `CLOSING` or `CLOSED`. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {*} data The data to send + * @param {Function} cb Callback + * @private + */ +function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + + // + // The `_bufferedAmount` property is used only when the peer is a client and + // the opening handshake fails. Under these circumstances, in fact, the + // `setSocket()` method is not called, so the `_socket` and `_sender` + // properties are set to `null`. + // + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} ` + + `(${readyStates[websocket.readyState]})` + ); + cb(err); + } +} + +/** + * The listener of the `Receiver` `'conclude'` event. + * + * @param {Number} code The status code + * @param {String} reason The reason for closing + * @private + */ +function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + + websocket._socket.removeListener('data', socketOnData); + websocket._socket.resume(); + + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + + if (code === 1005) websocket.close(); + else websocket.close(code, reason); +} + +/** + * The listener of the `Receiver` `'drain'` event. + * + * @private + */ +function receiverOnDrain() { + this[kWebSocket]._socket.resume(); +} + +/** + * The listener of the `Receiver` `'error'` event. + * + * @param {(RangeError|Error)} err The emitted error + * @private + */ +function receiverOnError(err) { + const websocket = this[kWebSocket]; + + websocket._socket.removeListener('data', socketOnData); + + websocket.readyState = WebSocket.CLOSING; + websocket._closeCode = err[kStatusCode]; + websocket.emit('error', err); + websocket._socket.destroy(); +} + +/** + * The listener of the `Receiver` `'finish'` event. + * + * @private + */ +function receiverOnFinish() { + this[kWebSocket].emitClose(); +} + +/** + * The listener of the `Receiver` `'message'` event. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The message + * @private + */ +function receiverOnMessage(data) { + this[kWebSocket].emit('message', data); +} + +/** + * The listener of the `Receiver` `'ping'` event. + * + * @param {Buffer} data The data included in the ping frame + * @private + */ +function receiverOnPing(data) { + const websocket = this[kWebSocket]; + + websocket.pong(data, !websocket._isServer, NOOP); + websocket.emit('ping', data); +} + +/** + * The listener of the `Receiver` `'pong'` event. + * + * @param {Buffer} data The data included in the pong frame + * @private + */ +function receiverOnPong(data) { + this[kWebSocket].emit('pong', data); +} + +/** + * The listener of the `net.Socket` `'close'` event. + * + * @private + */ +function socketOnClose() { + const websocket = this[kWebSocket]; + + this.removeListener('close', socketOnClose); + this.removeListener('end', socketOnEnd); + + websocket.readyState = WebSocket.CLOSING; + + // + // The close frame might not have been received or the `'end'` event emitted, + // for example, if the socket was destroyed due to an error. Ensure that the + // `receiver` stream is closed after writing any remaining buffered data to + // it. If the readable side of the socket is in flowing mode then there is no + // buffered data as everything has been already written and `readable.read()` + // will return `null`. If instead, the socket is paused, any possible buffered + // data will be read as a single chunk and emitted synchronously in a single + // `'data'` event. + // + websocket._socket.read(); + websocket._receiver.end(); + + this.removeListener('data', socketOnData); + this[kWebSocket] = undefined; + + clearTimeout(websocket._closeTimer); + + if ( + websocket._receiver._writableState.finished || + websocket._receiver._writableState.errorEmitted + ) { + websocket.emitClose(); + } else { + websocket._receiver.on('error', receiverOnFinish); + websocket._receiver.on('finish', receiverOnFinish); + } +} + +/** + * The listener of the `net.Socket` `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } +} + +/** + * The listener of the `net.Socket` `'end'` event. + * + * @private + */ +function socketOnEnd() { + const websocket = this[kWebSocket]; + + websocket.readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); +} + +/** + * The listener of the `net.Socket` `'error'` event. + * + * @private + */ +function socketOnError() { + const websocket = this[kWebSocket]; + + this.removeListener('error', socketOnError); + this.on('error', NOOP); + + if (websocket) { + websocket.readyState = WebSocket.CLOSING; + this.destroy(); + } +} diff --git a/node_modules/ws/package.json b/node_modules/ws/package.json @@ -0,0 +1,97 @@ +{ + "_from": "ws@^7.1.2", + "_id": "ws@7.2.3", + "_inBundle": false, + "_integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", + "_location": "/ws", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ws@^7.1.2", + "name": "ws", + "escapedName": "ws", + "rawSpec": "^7.1.2", + "saveSpec": null, + "fetchSpec": "^7.1.2" + }, + "_requiredBy": [ + "/engine.io" + ], + "_resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "_shasum": "a5411e1fb04d5ed0efee76d26d5c46d830c39b46", + "_spec": "ws@^7.1.2", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io", + "author": { + "name": "Einar Otto Stangvik", + "email": "einaros@gmail.com", + "url": "http://2x.io" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/websockets/ws/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", + "devDependencies": { + "benchmark": "^2.1.4", + "bufferutil": "^4.0.1", + "coveralls": "^3.0.3", + "eslint": "^6.0.0", + "eslint-config-prettier": "^6.0.0", + "eslint-plugin-prettier": "^3.0.1", + "mocha": "^7.0.0", + "nyc": "^15.0.0", + "prettier": "^1.17.0", + "utf-8-validate": "^5.0.2" + }, + "engines": { + "node": ">=8.3.0" + }, + "files": [ + "browser.js", + "index.js", + "lib/*.js" + ], + "greenkeeper": { + "commitMessages": { + "dependencyUpdate": "[pkg] Update ${dependency} to version ${version}", + "devDependencyUpdate": "[pkg] Update ${dependency} to version ${version}" + } + }, + "homepage": "https://github.com/websockets/ws", + "keywords": [ + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "license": "MIT", + "main": "index.js", + "name": "ws", + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/websockets/ws.git" + }, + "scripts": { + "integration": "npm run lint && mocha --throw-deprecation test/*.integration.js", + "lint": "eslint --ignore-path .gitignore . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"", + "test": "npm run lint && nyc --reporter=html --reporter=text mocha --throw-deprecation test/*.test.js" + }, + "version": "7.2.3" +} diff --git a/node_modules/xmlhttprequest-ssl/LICENSE b/node_modules/xmlhttprequest-ssl/LICENSE @@ -0,0 +1,22 @@ + Copyright (c) 2010 passive.ly LLC + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/xmlhttprequest-ssl/README.md b/node_modules/xmlhttprequest-ssl/README.md @@ -0,0 +1,63 @@ +# node-XMLHttpRequest # + +Fork of [node-XMLHttpRequest](https://github.com/driverdan/node-XMLHttpRequest) by [driverdan](http://driverdan.com). Forked and published to npm because a [pull request](https://github.com/rase-/node-XMLHttpRequest/commit/a6b6f296e0a8278165c2d0270d9840b54d5eeadd) is not being created and merged. Changes made by [rase-](https://github.com/rase-/node-XMLHttpRequest/tree/add/ssl-support) are needed for [engine.io-client](https://github.com/Automattic/engine.io-client). + +## Usage ## + +Here's how to include the module in your project and use as the browser-based +XHR object. + + var XMLHttpRequest = require("xmlhttprequest-ssl").XMLHttpRequest; + var xhr = new XMLHttpRequest(); + +Note: use the lowercase string "xmlhttprequest-ssl" in your require(). On +case-sensitive systems (eg Linux) using uppercase letters won't work. +# Original README # + +## Usage ## + +Here's how to include the module in your project and use as the browser-based +XHR object. + + var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; + var xhr = new XMLHttpRequest(); + +Note: use the lowercase string "xmlhttprequest" in your require(). On +case-sensitive systems (eg Linux) using uppercase letters won't work. + +## Versions ## + +Prior to 1.4.0 version numbers were arbitrary. From 1.4.0 on they conform to +the standard major.minor.bugfix. 1.x shouldn't necessarily be considered +stable just because it's above 0.x. + +Since the XMLHttpRequest API is stable this library's API is stable as +well. Major version numbers indicate significant core code changes. +Minor versions indicate minor core code changes or better conformity to +the W3C spec. + +## License ## + +MIT license. See LICENSE for full details. + +## Supports ## + +* Async and synchronous requests +* GET, POST, PUT, and DELETE requests +* All spec methods (open, send, abort, getRequestHeader, + getAllRequestHeaders, event methods) +* Requests to all domains + +## Known Issues / Missing Features ## + +For a list of open issues or to report your own visit the [github issues +page](https://github.com/driverdan/node-XMLHttpRequest/issues). + +* Local file access may have unexpected results for non-UTF8 files +* Synchronous requests don't set headers properly +* Synchronous requests freeze node while waiting for response (But that's what you want, right? Stick with async!). +* Some events are missing, such as abort +* getRequestHeader is case-sensitive +* Cookies aren't persisted between requests +* Missing XML support +* Missing basic auth diff --git a/node_modules/xmlhttprequest-ssl/autotest.watchr b/node_modules/xmlhttprequest-ssl/autotest.watchr @@ -0,0 +1,8 @@ +def run_all_tests + puts `clear` + puts `node tests/test-constants.js` + puts `node tests/test-headers.js` + puts `node tests/test-request.js` +end +watch('.*.js') { run_all_tests } +run_all_tests diff --git a/node_modules/xmlhttprequest-ssl/example/demo.js b/node_modules/xmlhttprequest-ssl/example/demo.js @@ -0,0 +1,16 @@ +var sys = require('util'); +var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; + +var xhr = new XMLHttpRequest(); + +xhr.onreadystatechange = function() { + sys.puts("State: " + this.readyState); + + if (this.readyState == 4) { + sys.puts("Complete.\nBody length: " + this.responseText.length); + sys.puts("Body:\n" + this.responseText); + } +}; + +xhr.open("GET", "http://driverdan.com"); +xhr.send(); diff --git a/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js b/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js @@ -0,0 +1,651 @@ +/** + * Wrapper for built-in http.js to emulate the browser XMLHttpRequest object. + * + * This can be used with JS designed for browsers to improve reuse of code and + * allow the use of existing libraries. + * + * Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs. + * + * @author Dan DeFelippi <dan@driverdan.com> + * @contributor David Ellis <d.f.ellis@ieee.org> + * @license MIT + */ + +var fs = require('fs'); +var Url = require('url'); +var spawn = require('child_process').spawn; + +/** + * Module exports. + */ + +module.exports = XMLHttpRequest; + +// backwards-compat +XMLHttpRequest.XMLHttpRequest = XMLHttpRequest; + +/** + * `XMLHttpRequest` constructor. + * + * Supported options for the `opts` object are: + * + * - `agent`: An http.Agent instance; http.globalAgent may be used; if 'undefined', agent usage is disabled + * + * @param {Object} opts optional "options" object + */ + +function XMLHttpRequest(opts) { + "use strict"; + + opts = opts || {}; + + /** + * Private variables + */ + var self = this; + var http = require('http'); + var https = require('https'); + + // Holds http.js objects + var request; + var response; + + // Request settings + var settings = {}; + + // Disable header blacklist. + // Not part of XHR specs. + var disableHeaderCheck = false; + + // Set some default headers + var defaultHeaders = { + "User-Agent": "node-XMLHttpRequest", + "Accept": "*/*" + }; + + var headers = Object.assign({}, defaultHeaders); + + // These headers are not user setable. + // The following are allowed but banned in the spec: + // * user-agent + var forbiddenRequestHeaders = [ + "accept-charset", + "accept-encoding", + "access-control-request-headers", + "access-control-request-method", + "connection", + "content-length", + "content-transfer-encoding", + "cookie", + "cookie2", + "date", + "expect", + "host", + "keep-alive", + "origin", + "referer", + "te", + "trailer", + "transfer-encoding", + "upgrade", + "via" + ]; + + // These request methods are not allowed + var forbiddenRequestMethods = [ + "TRACE", + "TRACK", + "CONNECT" + ]; + + // Send flag + var sendFlag = false; + // Error flag, used when errors occur or abort is called + var errorFlag = false; + + // Event listeners + var listeners = {}; + + /** + * Constants + */ + + this.UNSENT = 0; + this.OPENED = 1; + this.HEADERS_RECEIVED = 2; + this.LOADING = 3; + this.DONE = 4; + + /** + * Public vars + */ + + // Current state + this.readyState = this.UNSENT; + + // default ready state change handler in case one is not set or is set late + this.onreadystatechange = null; + + // Result & response + this.responseText = ""; + this.responseXML = ""; + this.status = null; + this.statusText = null; + + /** + * Private methods + */ + + /** + * Check if the specified header is allowed. + * + * @param string header Header to validate + * @return boolean False if not allowed, otherwise true + */ + var isAllowedHttpHeader = function(header) { + return disableHeaderCheck || (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1); + }; + + /** + * Check if the specified method is allowed. + * + * @param string method Request method to validate + * @return boolean False if not allowed, otherwise true + */ + var isAllowedHttpMethod = function(method) { + return (method && forbiddenRequestMethods.indexOf(method) === -1); + }; + + /** + * Public methods + */ + + /** + * Open the connection. Currently supports local server requests. + * + * @param string method Connection method (eg GET, POST) + * @param string url URL for the connection. + * @param boolean async Asynchronous connection. Default is true. + * @param string user Username for basic authentication (optional) + * @param string password Password for basic authentication (optional) + */ + this.open = function(method, url, async, user, password) { + this.abort(); + errorFlag = false; + + // Check for valid request method + if (!isAllowedHttpMethod(method)) { + throw "SecurityError: Request method not allowed"; + } + + settings = { + "method": method, + "url": url.toString(), + "async": (typeof async !== "boolean" ? true : async), + "user": user || null, + "password": password || null + }; + + setState(this.OPENED); + }; + + /** + * Disables or enables isAllowedHttpHeader() check the request. Enabled by default. + * This does not conform to the W3C spec. + * + * @param boolean state Enable or disable header checking. + */ + this.setDisableHeaderCheck = function(state) { + disableHeaderCheck = state; + }; + + /** + * Sets a header for the request. + * + * @param string header Header name + * @param string value Header value + * @return boolean Header added + */ + this.setRequestHeader = function(header, value) { + if (this.readyState != this.OPENED) { + throw "INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN"; + return false; + } + if (!isAllowedHttpHeader(header)) { + console.warn('Refused to set unsafe header "' + header + '"'); + return false; + } + if (sendFlag) { + throw "INVALID_STATE_ERR: send flag is true"; + return false; + } + headers[header] = value; + return true; + }; + + /** + * Gets a header from the server response. + * + * @param string header Name of header to get. + * @return string Text of the header or null if it doesn't exist. + */ + this.getResponseHeader = function(header) { + if (typeof header === "string" + && this.readyState > this.OPENED + && response.headers[header.toLowerCase()] + && !errorFlag + ) { + return response.headers[header.toLowerCase()]; + } + + return null; + }; + + /** + * Gets all the response headers. + * + * @return string A string with all response headers separated by CR+LF + */ + this.getAllResponseHeaders = function() { + if (this.readyState < this.HEADERS_RECEIVED || errorFlag) { + return ""; + } + var result = ""; + + for (var i in response.headers) { + // Cookie headers are excluded + if (i !== "set-cookie" && i !== "set-cookie2") { + result += i + ": " + response.headers[i] + "\r\n"; + } + } + return result.substr(0, result.length - 2); + }; + + /** + * Gets a request header + * + * @param string name Name of header to get + * @return string Returns the request header or empty string if not set + */ + this.getRequestHeader = function(name) { + // @TODO Make this case insensitive + if (typeof name === "string" && headers[name]) { + return headers[name]; + } + + return ""; + }; + + /** + * Sends the request to the server. + * + * @param string data Optional data to send as request body. + */ + this.send = function(data) { + if (this.readyState != this.OPENED) { + throw "INVALID_STATE_ERR: connection must be opened before send() is called"; + } + + if (sendFlag) { + throw "INVALID_STATE_ERR: send has already been called"; + } + + var ssl = false, local = false; + var url = Url.parse(settings.url); + var host; + // Determine the server + switch (url.protocol) { + case 'https:': + ssl = true; + // SSL & non-SSL both need host, no break here. + case 'http:': + host = url.hostname; + break; + + case 'file:': + local = true; + break; + + case undefined: + case '': + host = "localhost"; + break; + + default: + throw "Protocol not supported."; + } + + // Load files off the local filesystem (file://) + if (local) { + if (settings.method !== "GET") { + throw "XMLHttpRequest: Only GET method is supported"; + } + + if (settings.async) { + fs.readFile(url.pathname, 'utf8', function(error, data) { + if (error) { + self.handleError(error); + } else { + self.status = 200; + self.responseText = data; + setState(self.DONE); + } + }); + } else { + try { + this.responseText = fs.readFileSync(url.pathname, 'utf8'); + this.status = 200; + setState(self.DONE); + } catch(e) { + this.handleError(e); + } + } + + return; + } + + // Default to port 80. If accessing localhost on another port be sure + // to use http://localhost:port/path + var port = url.port || (ssl ? 443 : 80); + // Add query string if one is used + var uri = url.pathname + (url.search ? url.search : ''); + + // Set the Host header or the server may reject the request + headers["Host"] = host; + if (!((ssl && port === 443) || port === 80)) { + headers["Host"] += ':' + url.port; + } + + // Set Basic Auth if necessary + if (settings.user) { + if (typeof settings.password == "undefined") { + settings.password = ""; + } + var authBuf = new Buffer(settings.user + ":" + settings.password); + headers["Authorization"] = "Basic " + authBuf.toString("base64"); + } + + // Set content length header + if (settings.method === "GET" || settings.method === "HEAD") { + data = null; + } else if (data) { + headers["Content-Length"] = Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data); + + if (!headers["Content-Type"]) { + headers["Content-Type"] = "text/plain;charset=UTF-8"; + } + } else if (settings.method === "POST") { + // For a post with no data set Content-Length: 0. + // This is required by buggy servers that don't meet the specs. + headers["Content-Length"] = 0; + } + + var agent = opts.agent || false; + var options = { + host: host, + port: port, + path: uri, + method: settings.method, + headers: headers, + agent: agent + }; + + if (ssl) { + options.pfx = opts.pfx; + options.key = opts.key; + options.passphrase = opts.passphrase; + options.cert = opts.cert; + options.ca = opts.ca; + options.ciphers = opts.ciphers; + options.rejectUnauthorized = opts.rejectUnauthorized; + } + + // Reset error flag + errorFlag = false; + + // Handle async requests + if (settings.async) { + // Use the proper protocol + var doRequest = ssl ? https.request : http.request; + + // Request is being sent, set send flag + sendFlag = true; + + // As per spec, this is called here for historical reasons. + self.dispatchEvent("readystatechange"); + + // Handler for the response + var responseHandler = function(resp) { + // Set response var to the response we got back + // This is so it remains accessable outside this scope + response = resp; + // Check for redirect + // @TODO Prevent looped redirects + if (response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) { + // Change URL to the redirect location + settings.url = response.headers.location; + var url = Url.parse(settings.url); + // Set host var in case it's used later + host = url.hostname; + // Options for the new request + var newOptions = { + hostname: url.hostname, + port: url.port, + path: url.path, + method: response.statusCode === 303 ? 'GET' : settings.method, + headers: headers + }; + + if (ssl) { + newOptions.pfx = opts.pfx; + newOptions.key = opts.key; + newOptions.passphrase = opts.passphrase; + newOptions.cert = opts.cert; + newOptions.ca = opts.ca; + newOptions.ciphers = opts.ciphers; + newOptions.rejectUnauthorized = opts.rejectUnauthorized; + } + + // Issue the new request + request = doRequest(newOptions, responseHandler).on('error', errorHandler); + request.end(); + // @TODO Check if an XHR event needs to be fired here + return; + } + + if (response && response.setEncoding) { + response.setEncoding("utf8"); + } + + setState(self.HEADERS_RECEIVED); + self.status = response.statusCode; + + response.on('data', function(chunk) { + // Make sure there's some data + if (chunk) { + self.responseText += chunk; + } + // Don't emit state changes if the connection has been aborted. + if (sendFlag) { + setState(self.LOADING); + } + }); + + response.on('end', function() { + if (sendFlag) { + // The sendFlag needs to be set before setState is called. Otherwise if we are chaining callbacks + // there can be a timing issue (the callback is called and a new call is made before the flag is reset). + sendFlag = false; + // Discard the 'end' event if the connection has been aborted + setState(self.DONE); + } + }); + + response.on('error', function(error) { + self.handleError(error); + }); + } + + // Error handler for the request + var errorHandler = function(error) { + self.handleError(error); + } + + // Create the request + request = doRequest(options, responseHandler).on('error', errorHandler); + + // Node 0.4 and later won't accept empty data. Make sure it's needed. + if (data) { + request.write(data); + } + + request.end(); + + self.dispatchEvent("loadstart"); + } else { // Synchronous + // Create a temporary file for communication with the other Node process + var contentFile = ".node-xmlhttprequest-content-" + process.pid; + var syncFile = ".node-xmlhttprequest-sync-" + process.pid; + fs.writeFileSync(syncFile, "", "utf8"); + // The async request the other Node process executes + var execString = "var http = require('http'), https = require('https'), fs = require('fs');" + + "var doRequest = http" + (ssl ? "s" : "") + ".request;" + + "var options = " + JSON.stringify(options) + ";" + + "var responseText = '';" + + "var req = doRequest(options, function(response) {" + + "response.setEncoding('utf8');" + + "response.on('data', function(chunk) {" + + " responseText += chunk;" + + "});" + + "response.on('end', function() {" + + "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');" + + "fs.unlinkSync('" + syncFile + "');" + + "});" + + "response.on('error', function(error) {" + + "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');" + + "fs.unlinkSync('" + syncFile + "');" + + "});" + + "}).on('error', function(error) {" + + "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');" + + "fs.unlinkSync('" + syncFile + "');" + + "});" + + (data ? "req.write('" + data.replace(/'/g, "\\'") + "');":"") + + "req.end();"; + // Start the other Node Process, executing this string + var syncProc = spawn(process.argv[0], ["-e", execString]); + var statusText; + while(fs.existsSync(syncFile)) { + // Wait while the sync file is empty + } + self.responseText = fs.readFileSync(contentFile, 'utf8'); + // Kill the child process once the file has data + syncProc.stdin.end(); + // Remove the temporary file + fs.unlinkSync(contentFile); + if (self.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)) { + // If the file returned an error, handle it + var errorObj = self.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/, ""); + self.handleError(errorObj); + } else { + // If the file returned okay, parse its data and move to the DONE state + self.status = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/, "$1"); + self.responseText = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/, "$1"); + setState(self.DONE); + } + } + }; + + /** + * Called when an error is encountered to deal with it. + */ + this.handleError = function(error) { + this.status = 503; + this.statusText = error; + this.responseText = error.stack; + errorFlag = true; + setState(this.DONE); + }; + + /** + * Aborts a request. + */ + this.abort = function() { + if (request) { + request.abort(); + request = null; + } + + headers = Object.assign({}, defaultHeaders); + this.responseText = ""; + this.responseXML = ""; + + errorFlag = true; + + if (this.readyState !== this.UNSENT + && (this.readyState !== this.OPENED || sendFlag) + && this.readyState !== this.DONE) { + sendFlag = false; + setState(this.DONE); + } + this.readyState = this.UNSENT; + }; + + /** + * Adds an event listener. Preferred method of binding to events. + */ + this.addEventListener = function(event, callback) { + if (!(event in listeners)) { + listeners[event] = []; + } + // Currently allows duplicate callbacks. Should it? + listeners[event].push(callback); + }; + + /** + * Remove an event callback that has already been bound. + * Only works on the matching funciton, cannot be a copy. + */ + this.removeEventListener = function(event, callback) { + if (event in listeners) { + // Filter will return a new array with the callback removed + listeners[event] = listeners[event].filter(function(ev) { + return ev !== callback; + }); + } + }; + + /** + * Dispatch any events, including both "on" methods and events attached using addEventListener. + */ + this.dispatchEvent = function(event) { + if (typeof self["on" + event] === "function") { + self["on" + event](); + } + if (event in listeners) { + for (var i = 0, len = listeners[event].length; i < len; i++) { + listeners[event][i].call(self); + } + } + }; + + /** + * Changes readyState and calls onreadystatechange. + * + * @param int state New state + */ + var setState = function(state) { + if (self.readyState !== state) { + self.readyState = state; + + if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) { + self.dispatchEvent("readystatechange"); + } + + if (self.readyState === self.DONE && !errorFlag) { + self.dispatchEvent("load"); + // @TODO figure out InspectorInstrumentation::didLoadXHR(cookie) + self.dispatchEvent("loadend"); + } + } + }; +}; diff --git a/node_modules/xmlhttprequest-ssl/package.json b/node_modules/xmlhttprequest-ssl/package.json @@ -0,0 +1,63 @@ +{ + "_from": "xmlhttprequest-ssl@~1.5.4", + "_id": "xmlhttprequest-ssl@1.5.5", + "_inBundle": false, + "_integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", + "_location": "/xmlhttprequest-ssl", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "xmlhttprequest-ssl@~1.5.4", + "name": "xmlhttprequest-ssl", + "escapedName": "xmlhttprequest-ssl", + "rawSpec": "~1.5.4", + "saveSpec": null, + "fetchSpec": "~1.5.4" + }, + "_requiredBy": [ + "/engine.io-client" + ], + "_resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "_shasum": "c2876b06168aadc40e57d97e81191ac8f4398b3e", + "_spec": "xmlhttprequest-ssl@~1.5.4", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client", + "author": { + "name": "Michael de Wit" + }, + "bugs": { + "url": "http://github.com/mjwwit/node-XMLHttpRequest/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "XMLHttpRequest for Node", + "directories": { + "lib": "./lib", + "example": "./example" + }, + "engines": { + "node": ">=0.4.0" + }, + "homepage": "https://github.com/mjwwit/node-XMLHttpRequest#readme", + "keywords": [ + "xhr", + "ajax" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://creativecommons.org/licenses/MIT/" + } + ], + "main": "./lib/XMLHttpRequest.js", + "name": "xmlhttprequest-ssl", + "repository": { + "type": "git", + "url": "git://github.com/mjwwit/node-XMLHttpRequest.git" + }, + "scripts": { + "test": "cd ./tests && node test-constants.js && node test-events.js && node test-exceptions.js && node test-headers.js && node test-redirect-302.js && node test-redirect-303.js && node test-redirect-307.js && node test-request-methods.js && node test-request-protocols.js" + }, + "version": "1.5.5" +} diff --git a/node_modules/xmlhttprequest-ssl/tests/test-constants.js b/node_modules/xmlhttprequest-ssl/tests/test-constants.js @@ -0,0 +1,13 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr = new XMLHttpRequest(); + +// Test constant values +assert.equal(0, xhr.UNSENT); +assert.equal(1, xhr.OPENED); +assert.equal(2, xhr.HEADERS_RECEIVED); +assert.equal(3, xhr.LOADING); +assert.equal(4, xhr.DONE); + +sys.puts("done"); diff --git a/node_modules/xmlhttprequest-ssl/tests/test-events.js b/node_modules/xmlhttprequest-ssl/tests/test-events.js @@ -0,0 +1,50 @@ +var sys = require("util") + , assert = require("assert") + , http = require("http") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr; + +// Test server +var server = http.createServer(function (req, res) { + var body = (req.method != "HEAD" ? "Hello World" : ""); + + res.writeHead(200, { + "Content-Type": "text/plain", + "Content-Length": Buffer.byteLength(body) + }); + // HEAD has no body + if (req.method != "HEAD") { + res.write(body); + } + res.end(); + assert.equal(onreadystatechange, true); + assert.equal(readystatechange, true); + assert.equal(removed, true); + sys.puts("done"); + this.close(); +}).listen(8000); + +xhr = new XMLHttpRequest(); + +// Track event calls +var onreadystatechange = false; +var readystatechange = false; +var removed = true; +var removedEvent = function() { + removed = false; +}; + +xhr.onreadystatechange = function() { + onreadystatechange = true; +}; + +xhr.addEventListener("readystatechange", function() { + readystatechange = true; +}); + +// This isn't perfect, won't guarantee it was added in the first place +xhr.addEventListener("readystatechange", removedEvent); +xhr.removeEventListener("readystatechange", removedEvent); + +xhr.open("GET", "http://localhost:8000"); +xhr.send(); diff --git a/node_modules/xmlhttprequest-ssl/tests/test-exceptions.js b/node_modules/xmlhttprequest-ssl/tests/test-exceptions.js @@ -0,0 +1,59 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr = new XMLHttpRequest(); + +// Test request methods that aren't allowed +try { + xhr.open("TRACK", "http://localhost:8000/"); + console.log("ERROR: TRACK should have thrown exception"); +} catch(e) {} +try { + xhr.open("TRACE", "http://localhost:8000/"); + console.log("ERROR: TRACE should have thrown exception"); +} catch(e) {} +try { + xhr.open("CONNECT", "http://localhost:8000/"); + console.log("ERROR: CONNECT should have thrown exception"); +} catch(e) {} +// Test valid request method +try { + xhr.open("GET", "http://localhost:8000/"); +} catch(e) { + console.log("ERROR: Invalid exception for GET", e); +} + +// Test forbidden headers +var forbiddenRequestHeaders = [ + "accept-charset", + "accept-encoding", + "access-control-request-headers", + "access-control-request-method", + "connection", + "content-length", + "content-transfer-encoding", + "cookie", + "cookie2", + "date", + "expect", + "host", + "keep-alive", + "origin", + "referer", + "te", + "trailer", + "transfer-encoding", + "upgrade", + "via" +]; + +for (var i in forbiddenRequestHeaders) { + if(xhr.setRequestHeader(forbiddenRequestHeaders[i], "Test") !== false) { + console.log("ERROR: " + forbiddenRequestHeaders[i] + " should have thrown exception"); + } +} + +// Try valid header +xhr.setRequestHeader("X-Foobar", "Test"); + +console.log("Done"); diff --git a/node_modules/xmlhttprequest-ssl/tests/test-headers.js b/node_modules/xmlhttprequest-ssl/tests/test-headers.js @@ -0,0 +1,76 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr = new XMLHttpRequest() + , http = require("http"); + +// Test server +var server = http.createServer(function (req, res) { + // Test setRequestHeader + assert.equal("Foobar", req.headers["x-test"]); + // Test non-conforming allowed header + assert.equal("node-XMLHttpRequest-test", req.headers["user-agent"]); + // Test header set with blacklist disabled + assert.equal("http://github.com", req.headers["referer"]); + + var body = "Hello World"; + res.writeHead(200, { + "Content-Type": "text/plain", + "Content-Length": Buffer.byteLength(body), + // Set cookie headers to see if they're correctly suppressed + // Actual values don't matter + "Set-Cookie": "foo=bar", + "Set-Cookie2": "bar=baz", + "Date": "Thu, 30 Aug 2012 18:17:53 GMT", + "Connection": "close" + }); + res.write("Hello World"); + res.end(); + + this.close(); +}).listen(8000); + +xhr.onreadystatechange = function() { + if (this.readyState == 4) { + // Test getAllResponseHeaders() + var headers = "content-type: text/plain\r\ncontent-length: 11\r\ndate: Thu, 30 Aug 2012 18:17:53 GMT\r\nconnection: close"; + assert.equal(headers, this.getAllResponseHeaders()); + + // Test case insensitivity + assert.equal('text/plain', this.getResponseHeader('Content-Type')); + assert.equal('text/plain', this.getResponseHeader('Content-type')); + assert.equal('text/plain', this.getResponseHeader('content-Type')); + assert.equal('text/plain', this.getResponseHeader('content-type')); + + // Test aborted getAllResponseHeaders + this.abort(); + assert.equal("", this.getAllResponseHeaders()); + assert.equal(null, this.getResponseHeader("Connection")); + + sys.puts("done"); + } +}; + +assert.equal(null, xhr.getResponseHeader("Content-Type")); +try { + xhr.open("GET", "http://localhost:8000/"); + // Valid header + xhr.setRequestHeader("X-Test", "Foobar"); + // Invalid header + xhr.setRequestHeader("Content-Length", 0); + // Allowed header outside of specs + xhr.setRequestHeader("user-agent", "node-XMLHttpRequest-test"); + // Test getRequestHeader + assert.equal("Foobar", xhr.getRequestHeader("X-Test")); + // Test invalid header + assert.equal("", xhr.getRequestHeader("Content-Length")); + + // Test allowing all headers + xhr.setDisableHeaderCheck(true); + xhr.setRequestHeader("Referer", "http://github.com"); + assert.equal("http://github.com", xhr.getRequestHeader("Referer")); + + xhr.send(); +} catch(e) { + console.log("ERROR: Exception raised", e); +} diff --git a/node_modules/xmlhttprequest-ssl/tests/test-redirect-302.js b/node_modules/xmlhttprequest-ssl/tests/test-redirect-302.js @@ -0,0 +1,41 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr = new XMLHttpRequest() + , http = require("http"); + +// Test server +var server = http.createServer(function (req, res) { + if (req.url === '/redirectingResource') { + res.writeHead(302, {'Location': 'http://localhost:8000/'}); + res.end(); + return; + } + + var body = "Hello World"; + res.writeHead(200, { + "Content-Type": "text/plain", + "Content-Length": Buffer.byteLength(body), + "Date": "Thu, 30 Aug 2012 18:17:53 GMT", + "Connection": "close" + }); + res.write("Hello World"); + res.end(); + + this.close(); +}).listen(8000); + +xhr.onreadystatechange = function() { + if (this.readyState == 4) { + assert.equal(xhr.getRequestHeader('Location'), ''); + assert.equal(xhr.responseText, "Hello World"); + sys.puts("done"); + } +}; + +try { + xhr.open("GET", "http://localhost:8000/redirectingResource"); + xhr.send(); +} catch(e) { + console.log("ERROR: Exception raised", e); +} diff --git a/node_modules/xmlhttprequest-ssl/tests/test-redirect-303.js b/node_modules/xmlhttprequest-ssl/tests/test-redirect-303.js @@ -0,0 +1,41 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr = new XMLHttpRequest() + , http = require("http"); + +// Test server +var server = http.createServer(function (req, res) { + if (req.url === '/redirectingResource') { + res.writeHead(303, {'Location': 'http://localhost:8000/'}); + res.end(); + return; + } + + var body = "Hello World"; + res.writeHead(200, { + "Content-Type": "text/plain", + "Content-Length": Buffer.byteLength(body), + "Date": "Thu, 30 Aug 2012 18:17:53 GMT", + "Connection": "close" + }); + res.write("Hello World"); + res.end(); + + this.close(); +}).listen(8000); + +xhr.onreadystatechange = function() { + if (this.readyState == 4) { + assert.equal(xhr.getRequestHeader('Location'), ''); + assert.equal(xhr.responseText, "Hello World"); + sys.puts("done"); + } +}; + +try { + xhr.open("POST", "http://localhost:8000/redirectingResource"); + xhr.send(); +} catch(e) { + console.log("ERROR: Exception raised", e); +} diff --git a/node_modules/xmlhttprequest-ssl/tests/test-redirect-307.js b/node_modules/xmlhttprequest-ssl/tests/test-redirect-307.js @@ -0,0 +1,43 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr = new XMLHttpRequest() + , http = require("http"); + +// Test server +var server = http.createServer(function (req, res) { + if (req.url === '/redirectingResource') { + res.writeHead(307, {'Location': 'http://localhost:8000/'}); + res.end(); + return; + } + + assert.equal(req.method, 'POST'); + + var body = "Hello World"; + res.writeHead(200, { + "Content-Type": "text/plain", + "Content-Length": Buffer.byteLength(body), + "Date": "Thu, 30 Aug 2012 18:17:53 GMT", + "Connection": "close" + }); + res.write("Hello World"); + res.end(); + + this.close(); +}).listen(8000); + +xhr.onreadystatechange = function() { + if (this.readyState == 4) { + assert.equal(xhr.getRequestHeader('Location'), ''); + assert.equal(xhr.responseText, "Hello World"); + sys.puts("done"); + } +}; + +try { + xhr.open("POST", "http://localhost:8000/redirectingResource"); + xhr.send(); +} catch(e) { + console.log("ERROR: Exception raised", e); +} diff --git a/node_modules/xmlhttprequest-ssl/tests/test-request-methods.js b/node_modules/xmlhttprequest-ssl/tests/test-request-methods.js @@ -0,0 +1,62 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , http = require("http") + , xhr; + +// Test server +var server = http.createServer(function (req, res) { + // Check request method and URL + assert.equal(methods[curMethod], req.method); + assert.equal("/" + methods[curMethod], req.url); + + var body = (req.method != "HEAD" ? "Hello World" : ""); + + res.writeHead(200, { + "Content-Type": "text/plain", + "Content-Length": Buffer.byteLength(body) + }); + // HEAD has no body + if (req.method != "HEAD") { + res.write(body); + } + res.end(); + + if (curMethod == methods.length - 1) { + this.close(); + sys.puts("done"); + } +}).listen(8000); + +// Test standard methods +var methods = ["GET", "POST", "HEAD", "PUT", "DELETE"]; +var curMethod = 0; + +function start(method) { + // Reset each time + xhr = new XMLHttpRequest(); + + xhr.onreadystatechange = function() { + if (this.readyState == 4) { + if (method == "HEAD") { + assert.equal("", this.responseText); + } else { + assert.equal("Hello World", this.responseText); + } + + curMethod++; + + if (curMethod < methods.length) { + sys.puts("Testing " + methods[curMethod]); + start(methods[curMethod]); + } + } + }; + + var url = "http://localhost:8000/" + method; + xhr.open(method, url); + xhr.send(); +} + +sys.puts("Testing " + methods[curMethod]); +start(methods[curMethod]); diff --git a/node_modules/xmlhttprequest-ssl/tests/test-request-protocols.js b/node_modules/xmlhttprequest-ssl/tests/test-request-protocols.js @@ -0,0 +1,32 @@ +var sys = require("util") + , assert = require("assert") + , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest + , xhr; + +xhr = new XMLHttpRequest(); + +xhr.onreadystatechange = function() { + if (this.readyState == 4) { + assert.equal("Hello World", this.responseText); + runSync(); + } +}; + +// Async +var url = "file://" + __dirname + "/testdata.txt"; +xhr.open("GET", url); +xhr.send(); + +// Sync +var runSync = function() { + xhr = new XMLHttpRequest(); + + xhr.onreadystatechange = function() { + if (this.readyState == 4) { + assert.equal("Hello World", this.responseText); + sys.puts("done"); + } + }; + xhr.open("GET", url, false); + xhr.send(); +} diff --git a/node_modules/xmlhttprequest-ssl/tests/testdata.txt b/node_modules/xmlhttprequest-ssl/tests/testdata.txt @@ -0,0 +1 @@ +Hello World+ \ No newline at end of file diff --git a/node_modules/yeast/LICENSE b/node_modules/yeast/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/yeast/README.md b/node_modules/yeast/README.md @@ -0,0 +1,82 @@ +# yeast + +[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](https://img.shields.io/npm/v/yeast.svg?style=flat-square)](http://browsenpm.org/package/yeast)[![Build Status](https://img.shields.io/travis/unshiftio/yeast/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/yeast)[![Dependencies](https://img.shields.io/david/unshiftio/yeast.svg?style=flat-square)](https://david-dm.org/unshiftio/yeast)[![Coverage Status](https://img.shields.io/coveralls/unshiftio/yeast/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/yeast?branch=master)[![IRC channel](https://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square)](https://webchat.freenode.net/?channels=unshift) + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/yeast.svg)](https://saucelabs.com/u/yeast) + +Yeast is a unique id generator. It has been primarily designed to generate a +unique id which can be used for cache busting. A common practice for this is +to use a timestamp, but there are couple of downsides when using timestamps. + +1. The timestamp is already 13 chars long. This might not matter for 1 request + but if you make hundreds of them this quickly adds up in bandwidth and + processing time. +2. It's not unique enough. If you generate two stamps right after each other, + they would be identical because the timing accuracy is limited to + milliseconds. + +Yeast solves both of these issues by: + +1. Compressing the generated timestamp using a custom `encode()` function that + returns a string representation of the number. +2. Seeding the id in case of collision (when the id is identical to the previous + one). + +To keep the strings unique it will use the `.` char to separate the generated +stamp from the seed. + +## Installation + +The module is intended to be used in browsers as well as in Node.js and is +therefore released in the npm registry and can be installed using: + +``` +npm install --save yeast +``` + +## Usage + +All the examples assume that this library is initialized as follow: + +```js +'use strict'; + +var yeast = require('yeast'); +``` + +To generate an id just call the `yeast` function. + +```js +console.log(yeast(), yeast(), yeast()); // outputs: KyxidwN KyxidwN.0 KyxidwN.1 + +setTimeout(function () { + console.log(yeast()); // outputs: KyxidwO +}); +``` + +### yeast.encode(num) + +An helper function that returns a string representing the specified number. The +returned string contains only URL safe characters. + +```js +yeast.encode(+new Date()); // outputs: Kyxjuo1 +``` + +### yeast.decode(str) + +An helper function that returns the integer value specified by the given string. +This function can be used to retrieve the timestamp from a `yeast` id. + +```js +var id = yeast(); // holds the value: Kyxl1OU + +yeast.decode(id); // outputs: 1439816226334 +``` + +That's all folks. If you have ideas on how we can further compress the ids +please open an issue! + +## License + +[MIT](LICENSE) diff --git a/node_modules/yeast/index.js b/node_modules/yeast/index.js @@ -0,0 +1,68 @@ +'use strict'; + +var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') + , length = 64 + , map = {} + , seed = 0 + , i = 0 + , prev; + +/** + * Return a string representing the specified number. + * + * @param {Number} num The number to convert. + * @returns {String} The string representation of the number. + * @api public + */ +function encode(num) { + var encoded = ''; + + do { + encoded = alphabet[num % length] + encoded; + num = Math.floor(num / length); + } while (num > 0); + + return encoded; +} + +/** + * Return the integer value specified by the given string. + * + * @param {String} str The string to convert. + * @returns {Number} The integer value represented by the string. + * @api public + */ +function decode(str) { + var decoded = 0; + + for (i = 0; i < str.length; i++) { + decoded = decoded * length + map[str.charAt(i)]; + } + + return decoded; +} + +/** + * Yeast: A tiny growing id generator. + * + * @returns {String} A unique id. + * @api public + */ +function yeast() { + var now = encode(+new Date()); + + if (now !== prev) return seed = 0, prev = now; + return now +'.'+ encode(seed++); +} + +// +// Map each character to its index. +// +for (; i < length; i++) map[alphabet[i]] = i; + +// +// Expose the `yeast`, `encode` and `decode` functions. +// +yeast.encode = encode; +yeast.decode = decode; +module.exports = yeast; diff --git a/node_modules/yeast/package.json b/node_modules/yeast/package.json @@ -0,0 +1,64 @@ +{ + "_from": "yeast@0.1.2", + "_id": "yeast@0.1.2", + "_inBundle": false, + "_integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "_location": "/yeast", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "yeast@0.1.2", + "name": "yeast", + "escapedName": "yeast", + "rawSpec": "0.1.2", + "saveSpec": null, + "fetchSpec": "0.1.2" + }, + "_requiredBy": [ + "/engine.io-client" + ], + "_resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "_shasum": "008e06d8094320c372dbc2f8ed76a0ca6c8ac419", + "_spec": "yeast@0.1.2", + "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph/node_modules/engine.io-client", + "author": { + "name": "Arnout Kazemier" + }, + "bugs": { + "url": "https://github.com/unshiftio/yeast/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny but linear growing unique id generator", + "devDependencies": { + "assume": "1.3.x", + "istanbul": "0.3.x", + "mocha": "2.3.x", + "pre-commit": "1.1.x", + "zuul": "3.4.x" + }, + "homepage": "https://github.com/unshiftio/yeast", + "keywords": [ + "yeast", + "id", + "generator", + "unique" + ], + "license": "MIT", + "main": "index.js", + "name": "yeast", + "repository": { + "type": "git", + "url": "git+https://github.com/unshiftio/yeast.git" + }, + "scripts": { + "100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100", + "coverage": "istanbul cover _mocha -- test.js", + "test": "mocha test.js", + "test-browser": "zuul -- test.js", + "test-node": "istanbul cover _mocha --report lcovonly -- test.js", + "watch": "mocha --watch test.js" + }, + "version": "0.1.2" +} diff --git a/package-lock.json b/package-lock.json @@ -13,6 +13,11 @@ "negotiator": "0.6.2" } }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, "ajv": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", @@ -29,6 +34,11 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -42,6 +52,11 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -57,6 +72,21 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, + "base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -65,6 +95,19 @@ "tweetnacl": "^0.14.3" } }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, + "blob": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -99,6 +142,11 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "integrity": "sha1-9s95M6Ng4FiPqf3oVlHNx/gF0fY=" }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -112,6 +160,21 @@ "delayed-stream": "~1.0.0" } }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + }, "content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -185,11 +248,102 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "ejs": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.0.1.tgz", + "integrity": "sha512-cuIMtJwxvzumSAkqaaoGY/L6Fc/t6YvoP9/VIaK0V/CyqKLEQ8sqODmYfy/cjXEdZ9+OOL8TecbJu+1RsofGDw==" + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, + "engine.io": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.1.tgz", + "integrity": "sha512-8MfIfF1/IIfxuc2gv5K+XlFZczw/BpTvqBdl0E2fBLkYQp4miv4LuDTVtYt4yMyaIFLEr4vtaSgV4mjvll8Crw==", + "requires": { + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "0.3.1", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "ws": "^7.1.2" + }, + "dependencies": { + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "engine.io-client": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.1.tgz", + "integrity": "sha512-RJNmA+A9Js+8Aoq815xpGAsgWH1VoSYM//2VgIiu9lNOaHFfLpTjH4tOzktBpjIs5lvOfiNY1dwf+NuU6D38Mw==", + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "ws": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz", + "integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==", + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -318,6 +472,19 @@ "har-schema": "^2.0.0" } }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "requires": { + "isarray": "2.0.1" + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -348,6 +515,11 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -363,6 +535,11 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -452,6 +629,11 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -460,6 +642,22 @@ "ee-first": "1.1.1" } }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "requires": { + "better-assert": "~1.0.0" + } + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -602,6 +800,125 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "integrity": "sha1-fpWsskqpL1iF4KvvW6ExMw1K5oM=" }, + "socket.io": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", + "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "requires": { + "debug": "~4.1.0", + "engine.io": "~3.4.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.3.0", + "socket.io-parser": "~3.4.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "socket.io-adapter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", + "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==" + }, + "socket.io-client": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", + "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "engine.io-client": "~3.4.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "socket.io-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", + "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + } + } + }, + "socket.io-parser": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.0.tgz", + "integrity": "sha512-/G/VOI+3DBp0+DJKW4KesGnQkQPFmUCbA/oO2QGT6CWxU7hLGWqU3tyuzeSK/dqcyeHsQg1vTe9jiZI8GU9SCQ==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", @@ -623,6 +940,11 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", @@ -706,6 +1028,21 @@ "core-util-is": "1.0.2", "extsprintf": "^1.2.0" } + }, + "ws": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" + }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" } } } diff --git a/package.json b/package.json @@ -26,8 +26,10 @@ "homepage": "https://github.com/underd0g1/TwitWebGraph#readme", "dependencies": { "body-parser": "^1.19.0", + "ejs": "^3.0.1", "express": "^4.17.1", "node-fetch": "^2.6.0", + "socket.io": "^2.3.0", "twit": "^2.2.11" } } diff --git a/views/index.ejs b/views/index.ejs @@ -49,11 +49,9 @@ <div class="container-fluid bg-2 text-center"> <h3 class="margin">./Run</h3> - <p>Enter in the username you would like to get a list of followers for. (example: twitterdevteam)</p> - - -<input type="text" id="usernametxt" required> -<button>fetch</button> + <p>Displaying tweets around <%=location%> </p> + <br /> + <p> <%= data %></p> </div> <!-- Third Container (Grid) --> diff --git a/views/index.html b/views/index.html @@ -0,0 +1,11 @@ +<script src="/socket.io/socket.io.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script> + <script> + + var socket = io.connect('http://localhost:8080'); + socket.on('stream', function(tweet){ + $('#tweetd').append(tweet+'<br>'); + }); + </script> + <div id="tweetd"></div> +</div>