msgpack-lite 0.1.27 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -78
- package/dist/msgpack.min.js +1 -2
- package/lib/read-format.js +10 -0
- package/lib/write-type.js +5 -0
- package/package.json +28 -16
- package/.github/workflows/nodejs.yml +0 -23
- package/.github/workflows/publish.yml +0 -64
- package/Makefile +0 -43
- package/lib/benchmark-stream.js +0 -247
- package/lib/benchmark.js +0 -157
- package/test/10.encode.js +0 -218
- package/test/11.decode.js +0 -382
- package/test/12.encoder.js +0 -36
- package/test/13.decoder.js +0 -32
- package/test/14.codec.js +0 -95
- package/test/15.useraw.js +0 -92
- package/test/16.binarraybuffer.js +0 -91
- package/test/17.uint8array.js +0 -43
- package/test/18.utf8.js +0 -59
- package/test/20.roundtrip.js +0 -220
- package/test/21.ext.js +0 -85
- package/test/22.typedarray.js +0 -79
- package/test/23.extbuffer.js +0 -79
- package/test/24.int64.js +0 -76
- package/test/26.es6.js +0 -20
- package/test/27.usemap.js +0 -66
- package/test/30.stream.js +0 -167
- package/test/50.compat.js +0 -58
- package/test/61.encode-only.js +0 -26
- package/test/62.decode-only.js +0 -23
- package/test/63.module-deps.js +0 -77
- package/test/example.json +0 -52
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
# msgpack-lite
|
|
1
|
+
# msgpack-lite
|
|
2
|
+
|
|
3
|
+
[](https://github.com/kawanet/msgpack-lite/actions/)
|
|
4
|
+
[](https://www.npmjs.com/package/msgpack-lite)
|
|
5
|
+
[](https://cdn.jsdelivr.net/npm/msgpack-lite/dist/msgpack.min.js)
|
|
2
6
|
|
|
3
7
|
Fast Pure JavaScript MessagePack Encoder and Decoder
|
|
4
8
|
|
|
@@ -7,13 +11,13 @@ Online demo: [http://kawanet.github.io/msgpack-lite/](http://kawanet.github.io/m
|
|
|
7
11
|
### Encoding and Decoding MessagePack
|
|
8
12
|
|
|
9
13
|
```js
|
|
10
|
-
|
|
14
|
+
const msgpack = require("msgpack-lite");
|
|
11
15
|
|
|
12
16
|
// encode from JS Object to MessagePack (Buffer)
|
|
13
|
-
|
|
17
|
+
const buffer = msgpack.encode({"foo": "bar"});
|
|
14
18
|
|
|
15
19
|
// decode from MessagePack (Buffer) to JS Object
|
|
16
|
-
|
|
20
|
+
const data = msgpack.decode(buffer); // => {"foo": "bar"}
|
|
17
21
|
|
|
18
22
|
// if encode/decode receives an invalid argument an error is thrown
|
|
19
23
|
```
|
|
@@ -21,11 +25,11 @@ var data = msgpack.decode(buffer); // => {"foo": "bar"}
|
|
|
21
25
|
### Writing to MessagePack Stream
|
|
22
26
|
|
|
23
27
|
```js
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
const fs = require("fs");
|
|
29
|
+
const msgpack = require("msgpack-lite");
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
const writeStream = fs.createWriteStream("test.msp");
|
|
32
|
+
const encodeStream = msgpack.createEncodeStream();
|
|
29
33
|
encodeStream.pipe(writeStream);
|
|
30
34
|
|
|
31
35
|
// send multiple objects to stream
|
|
@@ -39,11 +43,11 @@ encodeStream.end();
|
|
|
39
43
|
### Reading from MessagePack Stream
|
|
40
44
|
|
|
41
45
|
```js
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
const fs = require("fs");
|
|
47
|
+
const msgpack = require("msgpack-lite");
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
const readStream = fs.createReadStream("test.msp");
|
|
50
|
+
const decodeStream = msgpack.createDecodeStream();
|
|
47
51
|
|
|
48
52
|
// show multiple objects decoded from stream
|
|
49
53
|
readStream.pipe(decodeStream).on("data", console.warn);
|
|
@@ -52,10 +56,10 @@ readStream.pipe(decodeStream).on("data", console.warn);
|
|
|
52
56
|
### Decoding MessagePack Bytes Array
|
|
53
57
|
|
|
54
58
|
```js
|
|
55
|
-
|
|
59
|
+
const msgpack = require("msgpack-lite");
|
|
56
60
|
|
|
57
61
|
// decode() accepts Buffer instance per default
|
|
58
|
-
msgpack.decode(Buffer([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72]));
|
|
62
|
+
msgpack.decode(Buffer.from([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72]));
|
|
59
63
|
|
|
60
64
|
// decode() also accepts Array instance
|
|
61
65
|
msgpack.decode([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72]);
|
|
@@ -110,47 +114,6 @@ var data = msgpack.decode(array);
|
|
|
110
114
|
</script>
|
|
111
115
|
```
|
|
112
116
|
|
|
113
|
-
### MessagePack With Browserify
|
|
114
|
-
|
|
115
|
-
Step #1: write some code at first.
|
|
116
|
-
|
|
117
|
-
```js
|
|
118
|
-
var msgpack = require("msgpack-lite");
|
|
119
|
-
var buffer = msgpack.encode({"foo": "bar"});
|
|
120
|
-
var data = msgpack.decode(buffer);
|
|
121
|
-
console.warn(data); // => {"foo": "bar"}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Proceed to the next steps if you prefer faster browserify compilation time.
|
|
125
|
-
|
|
126
|
-
Step #2: add `browser` property on `package.json` in your project. This refers the global `msgpack` object instead of including whole of `msgpack-lite` source code.
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
{
|
|
130
|
-
"dependencies": {
|
|
131
|
-
"msgpack-lite": "*"
|
|
132
|
-
},
|
|
133
|
-
"browser": {
|
|
134
|
-
"msgpack-lite": "msgpack-lite/global"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Step #3: compile it with [browserify](https://www.npmjs.com/package/browserify) and [uglifyjs](https://www.npmjs.com/package/uglify-js).
|
|
140
|
-
|
|
141
|
-
```sh
|
|
142
|
-
browserify src/main.js -o tmp/main.browserify.js -s main
|
|
143
|
-
uglifyjs tmp/main.browserify.js -m -c -o js/main.min.js
|
|
144
|
-
cp node_modules/msgpack-lite/dist/msgpack.min.js js/msgpack.min.js
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Step #4: load [msgpack.min.js](https://cdn.jsdelivr.net/npm/msgpack-lite/dist/msgpack.min.js) before your code.
|
|
148
|
-
|
|
149
|
-
```html
|
|
150
|
-
<script src="js/msgpack.min.js"></script>
|
|
151
|
-
<script src="js/main.min.js"></script>
|
|
152
|
-
```
|
|
153
|
-
|
|
154
117
|
### MessagePack Mapping Table
|
|
155
118
|
|
|
156
119
|
The following table shows how JavaScript objects (value) will be mapped to
|
|
@@ -205,15 +168,15 @@ Other extension types are mapped to built-in ExtBuffer object.
|
|
|
205
168
|
Register a custom extension type number to serialize/deserialize your own class instances.
|
|
206
169
|
|
|
207
170
|
```js
|
|
208
|
-
|
|
171
|
+
const msgpack = require("msgpack-lite");
|
|
209
172
|
|
|
210
|
-
|
|
173
|
+
const codec = msgpack.createCodec();
|
|
211
174
|
codec.addExtPacker(0x3F, MyVector, myVectorPacker);
|
|
212
175
|
codec.addExtUnpacker(0x3F, myVectorUnpacker);
|
|
213
176
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
177
|
+
const data = new MyVector(1, 2);
|
|
178
|
+
const encoded = msgpack.encode(data, {codec: codec});
|
|
179
|
+
const decoded = msgpack.decode(encoded, {codec: codec});
|
|
217
180
|
|
|
218
181
|
function MyVector(x, y) {
|
|
219
182
|
this.x = x;
|
|
@@ -221,17 +184,17 @@ function MyVector(x, y) {
|
|
|
221
184
|
}
|
|
222
185
|
|
|
223
186
|
function myVectorPacker(vector) {
|
|
224
|
-
|
|
187
|
+
const array = [vector.x, vector.y];
|
|
225
188
|
return msgpack.encode(array); // return Buffer serialized
|
|
226
189
|
}
|
|
227
190
|
|
|
228
191
|
function myVectorUnpacker(buffer) {
|
|
229
|
-
|
|
192
|
+
const array = msgpack.decode(buffer);
|
|
230
193
|
return new MyVector(array[0], array[1]); // return Object deserialized
|
|
231
194
|
}
|
|
232
195
|
```
|
|
233
196
|
|
|
234
|
-
The first argument of `addExtPacker` and `addExtUnpacker` should be an integer within the range of 0 and 127 (0x0 and 0x7F). `
|
|
197
|
+
The first argument of `addExtPacker` and `addExtUnpacker` should be an integer within the range of 0 and 127 (0x0 and 0x7F). `myVectorPacker` is a function that accepts an instance of `MyVector`, and should return a buffer representing that instance. `myVectorUnpacker` is the opposite: it accepts a buffer and should return an instance of `MyVector`.
|
|
235
198
|
|
|
236
199
|
If you pass an array of functions to `addExtPacker` or `addExtUnpacker`, the value to be encoded/decoded will pass through each one in order. This allows you to do things like this:
|
|
237
200
|
|
|
@@ -250,50 +213,50 @@ If you wish to modify the default built-in codec, you can access it at `msgpack.
|
|
|
250
213
|
It does NOT have the preset extension types defined when no options given.
|
|
251
214
|
|
|
252
215
|
```js
|
|
253
|
-
|
|
216
|
+
const codec = msgpack.createCodec();
|
|
254
217
|
```
|
|
255
218
|
|
|
256
219
|
`preset`: It has the preset extension types described above.
|
|
257
220
|
|
|
258
221
|
```js
|
|
259
|
-
|
|
222
|
+
const codec = msgpack.createCodec({preset: true});
|
|
260
223
|
```
|
|
261
224
|
|
|
262
225
|
`safe`: It runs a validation of the value before writing it into buffer. This is the default behavior for some old browsers which do not support `ArrayBuffer` object.
|
|
263
226
|
|
|
264
227
|
```js
|
|
265
|
-
|
|
228
|
+
const codec = msgpack.createCodec({safe: true});
|
|
266
229
|
```
|
|
267
230
|
|
|
268
231
|
`useraw`: It uses `raw` formats instead of `bin` and `str`.
|
|
269
232
|
|
|
270
233
|
```js
|
|
271
|
-
|
|
234
|
+
const codec = msgpack.createCodec({useraw: true});
|
|
272
235
|
```
|
|
273
236
|
|
|
274
237
|
`int64`: It decodes msgpack's `int64`/`uint64` formats with [int64-buffer](https://github.com/kawanet/int64-buffer) object.
|
|
275
238
|
|
|
276
239
|
```js
|
|
277
|
-
|
|
240
|
+
const codec = msgpack.createCodec({int64: true});
|
|
278
241
|
```
|
|
279
242
|
|
|
280
243
|
`binarraybuffer`: It ties msgpack's `bin` format with `ArrayBuffer` object, instead of `Buffer` object.
|
|
281
244
|
|
|
282
245
|
```js
|
|
283
|
-
|
|
246
|
+
const codec = msgpack.createCodec({binarraybuffer: true, preset: true});
|
|
284
247
|
```
|
|
285
248
|
|
|
286
249
|
`uint8array`: It returns Uint8Array object when encoding, instead of `Buffer` object.
|
|
287
250
|
|
|
288
251
|
```js
|
|
289
|
-
|
|
252
|
+
const codec = msgpack.createCodec({uint8array: true});
|
|
290
253
|
```
|
|
291
254
|
|
|
292
255
|
`usemap`: Uses the global JavaScript Map type, if available, to unpack
|
|
293
256
|
MessagePack map elements.
|
|
294
257
|
|
|
295
258
|
```js
|
|
296
|
-
|
|
259
|
+
const codec = msgpack.createCodec({usemap: true});
|
|
297
260
|
```
|
|
298
261
|
|
|
299
262
|
### Compatibility Mode
|
|
@@ -303,18 +266,18 @@ The [compatibility mode](https://github.com/kawanet/msgpack-lite/issues/22) resp
|
|
|
303
266
|
```js
|
|
304
267
|
// default mode handles both str and bin formats individually
|
|
305
268
|
msgpack.encode("Aa"); // => <Buffer a2 41 61> (str format)
|
|
306
|
-
msgpack.encode(
|
|
269
|
+
msgpack.encode(Buffer.from([0x41, 0x61])); // => <Buffer c4 02 41 61> (bin format)
|
|
307
270
|
|
|
308
|
-
msgpack.decode(
|
|
309
|
-
msgpack.decode(
|
|
271
|
+
msgpack.decode(Buffer.from([0xa2, 0x41, 0x61])); // => 'Aa' (String)
|
|
272
|
+
msgpack.decode(Buffer.from([0xc4, 0x02, 0x41, 0x61])); // => <Buffer 41 61> (Buffer)
|
|
310
273
|
|
|
311
274
|
// compatibility mode handles only raw format both for String and Buffer
|
|
312
|
-
|
|
275
|
+
const options = {codec: msgpack.createCodec({useraw: true})};
|
|
313
276
|
msgpack.encode("Aa", options); // => <Buffer a2 41 61> (raw format)
|
|
314
|
-
msgpack.encode(
|
|
277
|
+
msgpack.encode(Buffer.from([0x41, 0x61]), options); // => <Buffer a2 41 61> (raw format)
|
|
315
278
|
|
|
316
|
-
msgpack.decode(
|
|
317
|
-
msgpack.decode(
|
|
279
|
+
msgpack.decode(Buffer.from([0xa2, 0x41, 0x61]), options); // => <Buffer 41 61> (Buffer)
|
|
280
|
+
msgpack.decode(Buffer.from([0xa2, 0x41, 0x61]), options).toString(); // => 'Aa' (String)
|
|
318
281
|
```
|
|
319
282
|
|
|
320
283
|
### Repository
|
package/dist/msgpack.min.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.msgpack=t()}}(function(){return function t(r,e,n){function i(f,u){if(!e[f]){if(!r[f]){var a="function"==typeof require&&require;if(!u&&a)return a(f,!0);if(o)return o(f,!0);var s=new Error("Cannot find module '"+f+"'");throw s.code="MODULE_NOT_FOUND",s}var c=e[f]={exports:{}};r[f][0].call(c.exports,function(t){var e=r[f][1][t];return i(e?e:t)},c,c.exports,t,r,e,n)}return e[f].exports}for(var o="function"==typeof require&&require,f=0;f<n.length;f++)i(n[f]);return i}({1:[function(t,r,e){e.encode=t("./encode").encode,e.decode=t("./decode").decode,e.Encoder=t("./encoder").Encoder,e.Decoder=t("./decoder").Decoder,e.createCodec=t("./ext").createCodec,e.codec=t("./codec").codec},{"./codec":10,"./decode":12,"./decoder":13,"./encode":15,"./encoder":16,"./ext":20}],2:[function(t,r,e){(function(Buffer){function t(t){return t&&t.isBuffer&&t}r.exports=t("undefined"!=typeof Buffer&&Buffer)||t(this.Buffer)||t("undefined"!=typeof window&&window.Buffer)||this.Buffer}).call(this,t("buffer").Buffer)},{buffer:29}],3:[function(t,r,e){function n(t,r){for(var e=this,n=r||(r|=0),i=t.length,o=0,f=0;f<i;)o=t.charCodeAt(f++),o<128?e[n++]=o:o<2048?(e[n++]=192|o>>>6,e[n++]=128|63&o):o<55296||o>57343?(e[n++]=224|o>>>12,e[n++]=128|o>>>6&63,e[n++]=128|63&o):(o=(o-55296<<10|t.charCodeAt(f++)-56320)+65536,e[n++]=240|o>>>18,e[n++]=128|o>>>12&63,e[n++]=128|o>>>6&63,e[n++]=128|63&o);return n-r}function i(t,r,e){var n=this,i=0|r;e||(e=n.length);for(var o="",f=0;i<e;)f=n[i++],f<128?o+=String.fromCharCode(f):(192===(224&f)?f=(31&f)<<6|63&n[i++]:224===(240&f)?f=(15&f)<<12|(63&n[i++])<<6|63&n[i++]:240===(248&f)&&(f=(7&f)<<18|(63&n[i++])<<12|(63&n[i++])<<6|63&n[i++]),f>=65536?(f-=65536,o+=String.fromCharCode((f>>>10)+55296,(1023&f)+56320)):o+=String.fromCharCode(f));return o}function o(t,r,e,n){var i;e||(e=0),n||0===n||(n=this.length),r||(r=0);var o=n-e;if(t===this&&e<r&&r<n)for(i=o-1;i>=0;i--)t[i+r]=this[i+e];else for(i=0;i<o;i++)t[i+r]=this[i+e];return o}e.copy=o,e.toString=i,e.write=n},{}],4:[function(t,r,e){function n(t){return new Array(t)}function i(t){if(!o.isBuffer(t)&&o.isView(t))t=o.Uint8Array.from(t);else if(o.isArrayBuffer(t))t=new Uint8Array(t);else{if("string"==typeof t)return o.from.call(e,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return Array.prototype.slice.call(t)}var o=t("./bufferish"),e=r.exports=n(0);e.alloc=n,e.concat=o.concat,e.from=i},{"./bufferish":8}],5:[function(t,r,e){function n(t){return new Buffer(t)}function i(t){if(!o.isBuffer(t)&&o.isView(t))t=o.Uint8Array.from(t);else if(o.isArrayBuffer(t))t=new Uint8Array(t);else{if("string"==typeof t)return o.from.call(e,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return Buffer.from&&1!==Buffer.from.length?Buffer.from(t):new Buffer(t)}var o=t("./bufferish"),Buffer=o.global,e=r.exports=o.hasBuffer?n(0):[];e.alloc=o.hasBuffer&&Buffer.alloc||n,e.concat=o.concat,e.from=i},{"./bufferish":8}],6:[function(t,r,e){function n(t,r,e,n){var o=a.isBuffer(this),f=a.isBuffer(t);if(o&&f)return this.copy(t,r,e,n);if(c||o||f||!a.isView(this)||!a.isView(t))return u.copy.call(this,t,r,e,n);var s=e||null!=n?i.call(this,e,n):this;return t.set(s,r),s.length}function i(t,r){var e=this.slice||!c&&this.subarray;if(e)return e.call(this,t,r);var i=a.alloc.call(this,r-t);return n.call(this,i,0,t,r),i}function o(t,r,e){var n=!s&&a.isBuffer(this)?this.toString:u.toString;return n.apply(this,arguments)}function f(t){function r(){var r=this[t]||u[t];return r.apply(this,arguments)}return r}var u=t("./buffer-lite");e.copy=n,e.slice=i,e.toString=o,e.write=f("write");var a=t("./bufferish"),Buffer=a.global,s=a.hasBuffer&&"TYPED_ARRAY_SUPPORT"in Buffer,c=s&&!Buffer.TYPED_ARRAY_SUPPORT},{"./buffer-lite":3,"./bufferish":8}],7:[function(t,r,e){function n(t){return new Uint8Array(t)}function i(t){if(o.isView(t)){var r=t.byteOffset,n=t.byteLength;t=t.buffer,t.byteLength!==n&&(t.slice?t=t.slice(r,r+n):(t=new Uint8Array(t),t.byteLength!==n&&(t=Array.prototype.slice.call(t,r,r+n))))}else{if("string"==typeof t)return o.from.call(e,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return new Uint8Array(t)}var o=t("./bufferish"),e=r.exports=o.hasArrayBuffer?n(0):[];e.alloc=n,e.concat=o.concat,e.from=i},{"./bufferish":8}],8:[function(t,r,e){function n(t){return"string"==typeof t?u.call(this,t):a(this).from(t)}function i(t){return a(this).alloc(t)}function o(t,r){function n(t){r+=t.length}function o(t){a+=w.copy.call(t,u,a)}r||(r=0,Array.prototype.forEach.call(t,n));var f=this!==e&&this||t[0],u=i.call(f,r),a=0;return Array.prototype.forEach.call(t,o),u}function f(t){return t instanceof ArrayBuffer||E(t)}function u(t){var r=3*t.length,e=i.call(this,r),n=w.write.call(e,t);return r!==n&&(e=w.slice.call(e,0,n)),e}function a(t){return d(t)?g:y(t)?b:p(t)?v:h?g:l?b:v}function s(){return!1}function c(t,r){return t="[object "+t+"]",function(e){return null!=e&&{}.toString.call(r?e[r]:e)===t}}var Buffer=e.global=t("./buffer-global"),h=e.hasBuffer=Buffer&&!!Buffer.isBuffer,l=e.hasArrayBuffer="undefined"!=typeof ArrayBuffer,p=e.isArray=t("isarray");e.isArrayBuffer=l?f:s;var d=e.isBuffer=h?Buffer.isBuffer:s,y=e.isView=l?ArrayBuffer.isView||c("ArrayBuffer","buffer"):s;e.alloc=i,e.concat=o,e.from=n;var v=e.Array=t("./bufferish-array"),g=e.Buffer=t("./bufferish-buffer"),b=e.Uint8Array=t("./bufferish-uint8array"),w=e.prototype=t("./bufferish-proto"),E=c("ArrayBuffer")},{"./buffer-global":2,"./bufferish-array":4,"./bufferish-buffer":5,"./bufferish-proto":6,"./bufferish-uint8array":7,isarray:34}],9:[function(t,r,e){function n(t){return this instanceof n?(this.options=t,void this.init()):new n(t)}function i(t){for(var r in t)n.prototype[r]=o(n.prototype[r],t[r])}function o(t,r){function e(){return t.apply(this,arguments),r.apply(this,arguments)}return t&&r?e:t||r}function f(t){function r(t,r){return r(t)}return t=t.slice(),function(e){return t.reduce(r,e)}}function u(t){return s(t)?f(t):t}function a(t){return new n(t)}var s=t("isarray");e.createCodec=a,e.install=i,e.filter=u;var c=t("./bufferish");n.prototype.init=function(){var t=this.options;return t&&t.uint8array&&(this.bufferish=c.Uint8Array),this},e.preset=a({preset:!0})},{"./bufferish":8,isarray:34}],10:[function(t,r,e){t("./read-core"),t("./write-core"),e.codec={preset:t("./codec-base").preset}},{"./codec-base":9,"./read-core":22,"./write-core":25}],11:[function(t,r,e){function n(t){if(!(this instanceof n))return new n(t);if(t&&(this.options=t,t.codec)){var r=this.codec=t.codec;r.bufferish&&(this.bufferish=r.bufferish)}}e.DecodeBuffer=n;var i=t("./read-core").preset,o=t("./flex-buffer").FlexDecoder;o.mixin(n.prototype),n.prototype.codec=i,n.prototype.fetch=function(){return this.codec.decode(this)}},{"./flex-buffer":21,"./read-core":22}],12:[function(t,r,e){function n(t,r){var e=new i(r);return e.write(t),e.read()}e.decode=n;var i=t("./decode-buffer").DecodeBuffer},{"./decode-buffer":11}],13:[function(t,r,e){function n(t){return this instanceof n?void o.call(this,t):new n(t)}e.Decoder=n;var i=t("event-lite"),o=t("./decode-buffer").DecodeBuffer;n.prototype=new o,i.mixin(n.prototype),n.prototype.decode=function(t){arguments.length&&this.write(t),this.flush()},n.prototype.push=function(t){this.emit("data",t)},n.prototype.end=function(t){this.decode(t),this.emit("end")}},{"./decode-buffer":11,"event-lite":31}],14:[function(t,r,e){function n(t){if(!(this instanceof n))return new n(t);if(t&&(this.options=t,t.codec)){var r=this.codec=t.codec;r.bufferish&&(this.bufferish=r.bufferish)}}e.EncodeBuffer=n;var i=t("./write-core").preset,o=t("./flex-buffer").FlexEncoder;o.mixin(n.prototype),n.prototype.codec=i,n.prototype.write=function(t){this.codec.encode(this,t)}},{"./flex-buffer":21,"./write-core":25}],15:[function(t,r,e){function n(t,r){var e=new i(r);return e.write(t),e.read()}e.encode=n;var i=t("./encode-buffer").EncodeBuffer},{"./encode-buffer":14}],16:[function(t,r,e){function n(t){return this instanceof n?void o.call(this,t):new n(t)}e.Encoder=n;var i=t("event-lite"),o=t("./encode-buffer").EncodeBuffer;n.prototype=new o,i.mixin(n.prototype),n.prototype.encode=function(t){this.write(t),this.emit("data",this.read())},n.prototype.end=function(t){arguments.length&&this.encode(t),this.flush(),this.emit("end")}},{"./encode-buffer":14,"event-lite":31}],17:[function(t,r,e){function n(t,r){return this instanceof n?(this.buffer=i.from(t),void(this.type=r)):new n(t,r)}e.ExtBuffer=n;var i=t("./bufferish")},{"./bufferish":8}],18:[function(t,r,e){function n(t){t.addExtPacker(14,Error,[u,i]),t.addExtPacker(1,EvalError,[u,i]),t.addExtPacker(2,RangeError,[u,i]),t.addExtPacker(3,ReferenceError,[u,i]),t.addExtPacker(4,SyntaxError,[u,i]),t.addExtPacker(5,TypeError,[u,i]),t.addExtPacker(6,URIError,[u,i]),t.addExtPacker(10,RegExp,[f,i]),t.addExtPacker(11,Boolean,[o,i]),t.addExtPacker(12,String,[o,i]),t.addExtPacker(13,Date,[Number,i]),t.addExtPacker(15,Number,[o,i]),"undefined"!=typeof Uint8Array&&(t.addExtPacker(17,Int8Array,c),t.addExtPacker(18,Uint8Array,c),t.addExtPacker(19,Int16Array,c),t.addExtPacker(20,Uint16Array,c),t.addExtPacker(21,Int32Array,c),t.addExtPacker(22,Uint32Array,c),t.addExtPacker(23,Float32Array,c),"undefined"!=typeof Float64Array&&t.addExtPacker(24,Float64Array,c),"undefined"!=typeof Uint8ClampedArray&&t.addExtPacker(25,Uint8ClampedArray,c),t.addExtPacker(26,ArrayBuffer,c),t.addExtPacker(29,DataView,c)),s.hasBuffer&&t.addExtPacker(27,Buffer,s.from)}function i(r){return a||(a=t("./encode").encode),a(r)}function o(t){return t.valueOf()}function f(t){t=RegExp.prototype.toString.call(t).split("/"),t.shift();var r=[t.pop()];return r.unshift(t.join("/")),r}function u(t){var r={};for(var e in h)r[e]=t[e];return r}e.setExtPackers=n;var a,s=t("./bufferish"),Buffer=s.global,c=s.Uint8Array.from,h={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}},{"./bufferish":8,"./encode":15}],19:[function(t,r,e){function n(t){t.addExtUnpacker(14,[i,f(Error)]),t.addExtUnpacker(1,[i,f(EvalError)]),t.addExtUnpacker(2,[i,f(RangeError)]),t.addExtUnpacker(3,[i,f(ReferenceError)]),t.addExtUnpacker(4,[i,f(SyntaxError)]),t.addExtUnpacker(5,[i,f(TypeError)]),t.addExtUnpacker(6,[i,f(URIError)]),t.addExtUnpacker(10,[i,o]),t.addExtUnpacker(11,[i,u(Boolean)]),t.addExtUnpacker(12,[i,u(String)]),t.addExtUnpacker(13,[i,u(Date)]),t.addExtUnpacker(15,[i,u(Number)]),"undefined"!=typeof Uint8Array&&(t.addExtUnpacker(17,u(Int8Array)),t.addExtUnpacker(18,u(Uint8Array)),t.addExtUnpacker(19,[a,u(Int16Array)]),t.addExtUnpacker(20,[a,u(Uint16Array)]),t.addExtUnpacker(21,[a,u(Int32Array)]),t.addExtUnpacker(22,[a,u(Uint32Array)]),t.addExtUnpacker(23,[a,u(Float32Array)]),"undefined"!=typeof Float64Array&&t.addExtUnpacker(24,[a,u(Float64Array)]),"undefined"!=typeof Uint8ClampedArray&&t.addExtUnpacker(25,u(Uint8ClampedArray)),t.addExtUnpacker(26,a),t.addExtUnpacker(29,[a,u(DataView)])),c.hasBuffer&&t.addExtUnpacker(27,u(Buffer))}function i(r){return s||(s=t("./decode").decode),s(r)}function o(t){return RegExp.apply(null,t)}function f(t){return function(r){var e=new t;for(var n in h)e[n]=r[n];return e}}function u(t){return function(r){return new t(r)}}function a(t){return new Uint8Array(t).buffer}e.setExtUnpackers=n;var s,c=t("./bufferish"),Buffer=c.global,h={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}},{"./bufferish":8,"./decode":12}],20:[function(t,r,e){t("./read-core"),t("./write-core"),e.createCodec=t("./codec-base").createCodec},{"./codec-base":9,"./read-core":22,"./write-core":25}],21:[function(t,r,e){function n(){if(!(this instanceof n))return new n}function i(){if(!(this instanceof i))return new i}function o(){function t(t){var r=this.offset?p.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=r?t?this.bufferish.concat([r,t]):r:t,this.offset=0}function r(){for(;this.offset<this.buffer.length;){var t,r=this.offset;try{t=this.fetch()}catch(t){if(t&&t.message!=v)throw t;this.offset=r;break}this.push(t)}}function e(t){var r=this.offset,e=r+t;if(e>this.buffer.length)throw new Error(v);return this.offset=e,r}return{bufferish:p,write:t,fetch:a,flush:r,push:c,pull:h,read:s,reserve:e,offset:0}}function f(){function t(){var t=this.start;if(t<this.offset){var r=this.start=this.offset;return p.prototype.slice.call(this.buffer,t,r)}}function r(){for(;this.start<this.offset;){var t=this.fetch();t&&this.push(t)}}function e(){var t=this.buffers||(this.buffers=[]),r=t.length>1?this.bufferish.concat(t):t[0];return t.length=0,r}function n(t){var r=0|t;if(this.buffer){var e=this.buffer.length,n=0|this.offset,i=n+r;if(i<e)return this.offset=i,n;this.flush(),t=Math.max(t,Math.min(2*e,this.maxBufferSize))}return t=Math.max(t,this.minBufferSize),this.buffer=this.bufferish.alloc(t),this.start=0,this.offset=r,0}function i(t){var r=t.length;if(r>this.minBufferSize)this.flush(),this.push(t);else{var e=this.reserve(r);p.prototype.copy.call(t,this.buffer,e)}}return{bufferish:p,write:u,fetch:t,flush:r,push:c,pull:e,read:s,reserve:n,send:i,maxBufferSize:y,minBufferSize:d,offset:0,start:0}}function u(){throw new Error("method not implemented: write()")}function a(){throw new Error("method not implemented: fetch()")}function s(){var t=this.buffers&&this.buffers.length;return t?(this.flush(),this.pull()):this.fetch()}function c(t){var r=this.buffers||(this.buffers=[]);r.push(t)}function h(){var t=this.buffers||(this.buffers=[]);return t.shift()}function l(t){function r(r){for(var e in t)r[e]=t[e];return r}return r}e.FlexDecoder=n,e.FlexEncoder=i;var p=t("./bufferish"),d=2048,y=65536,v="BUFFER_SHORTAGE";n.mixin=l(o()),n.mixin(n.prototype),i.mixin=l(f()),i.mixin(i.prototype)},{"./bufferish":8}],22:[function(t,r,e){function n(t){function r(t){var r=s(t),n=e[r];if(!n)throw new Error("Invalid type: "+(r?"0x"+r.toString(16):r));return n(t)}var e=c.getReadToken(t);return r}function i(){var t=this.options;return this.decode=n(t),t&&t.preset&&a.setExtUnpackers(this),this}function o(t,r){var e=this.extUnpackers||(this.extUnpackers=[]);e[t]=h.filter(r)}function f(t){function r(r){return new u(r,t)}var e=this.extUnpackers||(this.extUnpackers=[]);return e[t]||r}var u=t("./ext-buffer").ExtBuffer,a=t("./ext-unpacker"),s=t("./read-format").readUint8,c=t("./read-token"),h=t("./codec-base");h.install({addExtUnpacker:o,getExtUnpacker:f,init:i}),e.preset=i.call(h.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-unpacker":19,"./read-format":23,"./read-token":24}],23:[function(t,r,e){function n(t){var r=k.hasArrayBuffer&&t&&t.binarraybuffer,e=t&&t.int64,n=T&&t&&t.usemap,B={map:n?o:i,array:f,str:u,bin:r?s:a,ext:c,uint8:h,uint16:p,uint32:y,uint64:g(8,e?E:b),int8:l,int16:d,int32:v,int64:g(8,e?A:w),float32:g(4,m),float64:g(8,x)};return B}function i(t,r){var e,n={},i=new Array(r),o=new Array(r),f=t.codec.decode;for(e=0;e<r;e++)i[e]=f(t),o[e]=f(t);for(e=0;e<r;e++)n[i[e]]=o[e];return n}function o(t,r){var e,n=new Map,i=new Array(r),o=new Array(r),f=t.codec.decode;for(e=0;e<r;e++)i[e]=f(t),o[e]=f(t);for(e=0;e<r;e++)n.set(i[e],o[e]);return n}function f(t,r){for(var e=new Array(r),n=t.codec.decode,i=0;i<r;i++)e[i]=n(t);return e}function u(t,r){var e=t.reserve(r),n=e+r;return _.toString.call(t.buffer,"utf-8",e,n)}function a(t,r){var e=t.reserve(r),n=e+r,i=_.slice.call(t.buffer,e,n);return k.from(i)}function s(t,r){var e=t.reserve(r),n=e+r,i=_.slice.call(t.buffer,e,n);return k.Uint8Array.from(i).buffer}function c(t,r){var e=t.reserve(r+1),n=t.buffer[e++],i=e+r,o=t.codec.getExtUnpacker(n);if(!o)throw new Error("Invalid ext type: "+(n?"0x"+n.toString(16):n));var f=_.slice.call(t.buffer,e,i);return o(f)}function h(t){var r=t.reserve(1);return t.buffer[r]}function l(t){var r=t.reserve(1),e=t.buffer[r];return 128&e?e-256:e}function p(t){var r=t.reserve(2),e=t.buffer;return e[r++]<<8|e[r]}function d(t){var r=t.reserve(2),e=t.buffer,n=e[r++]<<8|e[r];return 32768&n?n-65536:n}function y(t){var r=t.reserve(4),e=t.buffer;return 16777216*e[r++]+(e[r++]<<16)+(e[r++]<<8)+e[r]}function v(t){var r=t.reserve(4),e=t.buffer;return e[r++]<<24|e[r++]<<16|e[r++]<<8|e[r]}function g(t,r){return function(e){var n=e.reserve(t);return r.call(e.buffer,n,S)}}function b(t){return new P(this,t).toNumber()}function w(t){return new R(this,t).toNumber()}function E(t){return new P(this,t)}function A(t){return new R(this,t)}function m(t){return B.read(this,t,!1,23,4)}function x(t){return B.read(this,t,!1,52,8)}var B=t("ieee754"),U=t("int64-buffer"),P=U.Uint64BE,R=U.Int64BE;e.getReadFormat=n,e.readUint8=h;var k=t("./bufferish"),_=t("./bufferish-proto"),T="undefined"!=typeof Map,S=!0},{"./bufferish":8,"./bufferish-proto":6,ieee754:32,"int64-buffer":33}],24:[function(t,r,e){function n(t){var r=s.getReadFormat(t);return t&&t.useraw?o(r):i(r)}function i(t){var r,e=new Array(256);for(r=0;r<=127;r++)e[r]=f(r);for(r=128;r<=143;r++)e[r]=a(r-128,t.map);for(r=144;r<=159;r++)e[r]=a(r-144,t.array);for(r=160;r<=191;r++)e[r]=a(r-160,t.str);for(e[192]=f(null),e[193]=null,e[194]=f(!1),e[195]=f(!0),e[196]=u(t.uint8,t.bin),e[197]=u(t.uint16,t.bin),e[198]=u(t.uint32,t.bin),e[199]=u(t.uint8,t.ext),e[200]=u(t.uint16,t.ext),e[201]=u(t.uint32,t.ext),e[202]=t.float32,e[203]=t.float64,e[204]=t.uint8,e[205]=t.uint16,e[206]=t.uint32,e[207]=t.uint64,e[208]=t.int8,e[209]=t.int16,e[210]=t.int32,e[211]=t.int64,e[212]=a(1,t.ext),e[213]=a(2,t.ext),e[214]=a(4,t.ext),e[215]=a(8,t.ext),e[216]=a(16,t.ext),e[217]=u(t.uint8,t.str),e[218]=u(t.uint16,t.str),e[219]=u(t.uint32,t.str),e[220]=u(t.uint16,t.array),e[221]=u(t.uint32,t.array),e[222]=u(t.uint16,t.map),e[223]=u(t.uint32,t.map),r=224;r<=255;r++)e[r]=f(r-256);return e}function o(t){var r,e=i(t).slice();for(e[217]=e[196],e[218]=e[197],e[219]=e[198],r=160;r<=191;r++)e[r]=a(r-160,t.bin);return e}function f(t){return function(){return t}}function u(t,r){return function(e){var n=t(e);return r(e,n)}}function a(t,r){return function(e){return r(e,t)}}var s=t("./read-format");e.getReadToken=n},{"./read-format":23}],25:[function(t,r,e){function n(t){function r(t,r){var n=e[typeof r];if(!n)throw new Error('Unsupported type "'+typeof r+'": '+r);n(t,r)}var e=s.getWriteType(t);return r}function i(){var t=this.options;return this.encode=n(t),t&&t.preset&&a.setExtPackers(this),this}function o(t,r,e){function n(r){return e&&(r=e(r)),new u(r,t)}e=c.filter(e);var i=r.name;if(i&&"Object"!==i){var o=this.extPackers||(this.extPackers={});o[i]=n}else{var f=this.extEncoderList||(this.extEncoderList=[]);f.unshift([r,n])}}function f(t){var r=this.extPackers||(this.extPackers={}),e=t.constructor,n=e&&e.name&&r[e.name];if(n)return n;for(var i=this.extEncoderList||(this.extEncoderList=[]),o=i.length,f=0;f<o;f++){var u=i[f];if(e===u[0])return u[1]}}var u=t("./ext-buffer").ExtBuffer,a=t("./ext-packer"),s=t("./write-type"),c=t("./codec-base");c.install({addExtPacker:o,getExtPacker:f,init:i}),e.preset=i.call(c.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-packer":18,"./write-type":27}],26:[function(t,r,e){function n(t){return t&&t.uint8array?i():m||E.hasBuffer&&t&&t.safe?f():o()}function i(){var t=o();return t[202]=c(202,4,p),t[203]=c(203,8,d),t}function o(){var t=w.slice();return t[196]=u(196),t[197]=a(197),t[198]=s(198),t[199]=u(199),t[200]=a(200),t[201]=s(201),t[202]=c(202,4,x.writeFloatBE||p,!0),t[203]=c(203,8,x.writeDoubleBE||d,!0),t[204]=u(204),t[205]=a(205),t[206]=s(206),t[207]=c(207,8,h),t[208]=u(208),t[209]=a(209),t[210]=s(210),t[211]=c(211,8,l),t[217]=u(217),t[218]=a(218),t[219]=s(219),t[220]=a(220),t[221]=s(221),t[222]=a(222),t[223]=s(223),t}function f(){var t=w.slice();return t[196]=c(196,1,Buffer.prototype.writeUInt8),t[197]=c(197,2,Buffer.prototype.writeUInt16BE),t[198]=c(198,4,Buffer.prototype.writeUInt32BE),t[199]=c(199,1,Buffer.prototype.writeUInt8),t[200]=c(200,2,Buffer.prototype.writeUInt16BE),t[201]=c(201,4,Buffer.prototype.writeUInt32BE),t[202]=c(202,4,Buffer.prototype.writeFloatBE),t[203]=c(203,8,Buffer.prototype.writeDoubleBE),t[204]=c(204,1,Buffer.prototype.writeUInt8),t[205]=c(205,2,Buffer.prototype.writeUInt16BE),t[206]=c(206,4,Buffer.prototype.writeUInt32BE),t[207]=c(207,8,h),t[208]=c(208,1,Buffer.prototype.writeInt8),t[209]=c(209,2,Buffer.prototype.writeInt16BE),t[210]=c(210,4,Buffer.prototype.writeInt32BE),t[211]=c(211,8,l),t[217]=c(217,1,Buffer.prototype.writeUInt8),t[218]=c(218,2,Buffer.prototype.writeUInt16BE),t[219]=c(219,4,Buffer.prototype.writeUInt32BE),t[220]=c(220,2,Buffer.prototype.writeUInt16BE),t[221]=c(221,4,Buffer.prototype.writeUInt32BE),t[222]=c(222,2,Buffer.prototype.writeUInt16BE),t[223]=c(223,4,Buffer.prototype.writeUInt32BE),t}function u(t){return function(r,e){var n=r.reserve(2),i=r.buffer;i[n++]=t,i[n]=e}}function a(t){return function(r,e){var n=r.reserve(3),i=r.buffer;i[n++]=t,i[n++]=e>>>8,i[n]=e}}function s(t){return function(r,e){var n=r.reserve(5),i=r.buffer;i[n++]=t,i[n++]=e>>>24,i[n++]=e>>>16,i[n++]=e>>>8,i[n]=e}}function c(t,r,e,n){return function(i,o){var f=i.reserve(r+1);i.buffer[f++]=t,e.call(i.buffer,o,f,n)}}function h(t,r){new g(this,r,t)}function l(t,r){new b(this,r,t)}function p(t,r){y.write(this,t,r,!1,23,4)}function d(t,r){y.write(this,t,r,!1,52,8)}var y=t("ieee754"),v=t("int64-buffer"),g=v.Uint64BE,b=v.Int64BE,w=t("./write-uint8").uint8,E=t("./bufferish"),Buffer=E.global,A=E.hasBuffer&&"TYPED_ARRAY_SUPPORT"in Buffer,m=A&&!Buffer.TYPED_ARRAY_SUPPORT,x=E.hasBuffer&&Buffer.prototype||{};e.getWriteToken=n},{"./bufferish":8,"./write-uint8":28,ieee754:32,"int64-buffer":33}],27:[function(t,r,e){function n(t){function r(t,r){var e=r?195:194;_[e](t,r)}function e(t,r){var e,n=0|r;return r!==n?(e=203,void _[e](t,r)):(e=-32<=n&&n<=127?255&n:0<=n?n<=255?204:n<=65535?205:206:-128<=n?208:-32768<=n?209:210,void _[e](t,n))}function n(t,r){var e=207;_[e](t,r.toArray())}function o(t,r){var e=211;_[e](t,r.toArray())}function v(t){return t<32?1:t<=255?2:t<=65535?3:5}function g(t){return t<32?1:t<=65535?3:5}function b(t){function r(r,e){var n=e.length,i=5+3*n;r.offset=r.reserve(i);var o=r.buffer,f=t(n),u=r.offset+f;n=s.write.call(o,e,u);var a=t(n);if(f!==a){var c=u+a-f,h=u+n;s.copy.call(o,o,c,u,h)}var l=1===a?160+n:a<=3?215+a:219;_[l](r,n),r.offset+=n}return r}function w(t,r){if(null===r)return A(t,r);if(I(r))return Y(t,r);if(i(r))return m(t,r);if(f.isUint64BE(r))return n(t,r);if(u.isInt64BE(r))return o(t,r);var e=t.codec.getExtPacker(r);return e&&(r=e(r)),r instanceof l?U(t,r):void D(t,r)}function E(t,r){return I(r)?k(t,r):void w(t,r)}function A(t,r){var e=192;_[e](t,r)}function m(t,r){var e=r.length,n=e<16?144+e:e<=65535?220:221;_[n](t,e);for(var i=t.codec.encode,o=0;o<e;o++)i(t,r[o])}function x(t,r){var e=r.length,n=e<255?196:e<=65535?197:198;_[n](t,e),t.send(r)}function B(t,r){x(t,new Uint8Array(r))}function U(t,r){var e=r.buffer,n=e.length,i=y[n]||(n<255?199:n<=65535?200:201);_[i](t,n),h[r.type](t),t.send(e)}function P(t,r){var e=Object.keys(r),n=e.length,i=n<16?128+n:n<=65535?222:223;_[i](t,n);var o=t.codec.encode;e.forEach(function(e){o(t,e),o(t,r[e])})}function R(t,r){if(!(r instanceof Map))return P(t,r);var e=r.size,n=e<16?128+e:e<=65535?222:223;_[n](t,e);var i=t.codec.encode;r.forEach(function(r,e,n){i(t,e),i(t,r)})}function k(t,r){var e=r.length,n=e<32?160+e:e<=65535?218:219;_[n](t,e),t.send(r)}var _=c.getWriteToken(t),T=t&&t.useraw,S=p&&t&&t.binarraybuffer,I=S?a.isArrayBuffer:a.isBuffer,Y=S?B:x,C=d&&t&&t.usemap,D=C?R:P,O={boolean:r,function:A,number:e,object:T?E:w,string:b(T?g:v),symbol:A,undefined:A};return O}var i=t("isarray"),o=t("int64-buffer"),f=o.Uint64BE,u=o.Int64BE,a=t("./bufferish"),s=t("./bufferish-proto"),c=t("./write-token"),h=t("./write-uint8").uint8,l=t("./ext-buffer").ExtBuffer,p="undefined"!=typeof Uint8Array,d="undefined"!=typeof Map,y=[];y[1]=212,y[2]=213,y[4]=214,y[8]=215,y[16]=216,e.getWriteType=n},{"./bufferish":8,"./bufferish-proto":6,"./ext-buffer":17,"./write-token":26,"./write-uint8":28,"int64-buffer":33,isarray:34}],28:[function(t,r,e){function n(t){return function(r){var e=r.reserve(1);r.buffer[e]=t}}for(var i=e.uint8=new Array(256),o=0;o<=255;o++)i[o]=n(o)},{}],29:[function(t,r,e){(function(r){"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function i(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,r){if(i()<r)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=Buffer.prototype):(null===t&&(t=new Buffer(r)),t.length=r),t}function Buffer(t,r,e){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return s(this,t)}return f(this,t,r,e)}function f(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?l(t,r,e,n):"string"==typeof r?c(t,r,e):p(t,r)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,r,e,n){return u(r),r<=0?o(t,r):void 0!==e?"string"==typeof n?o(t,r).fill(e,n):o(t,r).fill(e):o(t,r)}function s(t,r){if(u(r),t=o(t,r<0?0:0|d(r)),!Buffer.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function c(t,r,e){if("string"==typeof e&&""!==e||(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|v(r,e);t=o(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function h(t,r){var e=r.length<0?0:0|d(r.length);t=o(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function l(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n),Buffer.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=Buffer.prototype):t=h(t,r),t}function p(t,r){if(Buffer.isBuffer(r)){var e=0|d(r.length);return t=o(t,e),0===t.length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||H(r.length)?o(t,0):h(t,r);if("Buffer"===r.type&&Q(r.data))return h(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),Buffer.alloc(+t)}function v(t,r){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return X(t).length;default:if(n)return q(t).length;r=(""+r).toLowerCase(),n=!0}}function g(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if(e>>>=0,r>>>=0,e<=r)return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,r,e);case"utf8":case"utf-8":return k(this,r,e);case"ascii":return T(this,r,e);case"latin1":case"binary":return S(this,r,e);case"base64":return R(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function w(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=Buffer.from(r,n)),Buffer.isBuffer(r))return 0===r.length?-1:E(t,r,e,n,i);if("number"==typeof r)return r=255&r,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):E(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function E(t,r,e,n,i){function o(t,r){return 1===f?t[r]:t.readUInt16BE(r*f)}var f=1,u=t.length,a=r.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;f=2,u/=2,a/=2,e/=2}var s;if(i){var c=-1;for(s=e;s<u;s++)if(o(t,s)===o(r,c===-1?0:s-c)){if(c===-1&&(c=s),s-c+1===a)return c*f}else c!==-1&&(s-=s-c),c=-1}else for(e+a>u&&(e=u-a),s=e;s>=0;s--){for(var h=!0,l=0;l<a;l++)if(o(t,s+l)!==o(r,l)){h=!1;break}if(h)return s}return-1}function A(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var f=0;f<n;++f){var u=parseInt(r.substr(2*f,2),16);if(isNaN(u))return f;t[e+f]=u}return f}function m(t,r,e,n){return G(q(r,t.length-e),t,e,n)}function x(t,r,e,n){return G(W(r),t,e,n)}function B(t,r,e,n){return x(t,r,e,n)}function U(t,r,e,n){return G(X(r),t,e,n)}function P(t,r,e,n){return G(J(r,t.length-e),t,e,n)}function R(t,r,e){return 0===r&&e===t.length?Z.fromByteArray(t):Z.fromByteArray(t.slice(r,e))}function k(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],f=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u<=e){var a,s,c,h;switch(u){case 1:o<128&&(f=o);break;case 2:a=t[i+1],128===(192&a)&&(h=(31&o)<<6|63&a,h>127&&(f=h));break;case 3:a=t[i+1],s=t[i+2],128===(192&a)&&128===(192&s)&&(h=(15&o)<<12|(63&a)<<6|63&s,h>2047&&(h<55296||h>57343)&&(f=h));break;case 4:a=t[i+1],s=t[i+2],c=t[i+3],128===(192&a)&&128===(192&s)&&128===(192&c)&&(h=(15&o)<<18|(63&a)<<12|(63&s)<<6|63&c,h>65535&&h<1114112&&(f=h))}}null===f?(f=65533,u=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=u}return _(n)}function _(t){var r=t.length;if(r<=$)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=$));return e}function T(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function S(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function I(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=V(t[o]);return i}function Y(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function C(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function D(t,r,e,n,i,o){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function O(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function L(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function M(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function N(t,r,e,n,i){return i||M(t,r,e,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,r,e,n,23,4),e+4}function F(t,r,e,n,i){return i||M(t,r,e,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,r,e,n,52,8),e+8}function j(t){
|
|
2
|
-
if(t=z(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function z(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],f=0;f<n;++f){if(e=t.charCodeAt(f),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function W(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}function J(t,r){for(var e,n,i,o=[],f=0;f<t.length&&!((r-=2)<0);++f)e=t.charCodeAt(f),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function X(t){return Z.toByteArray(j(t))}function G(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function H(t){return t!==t}var Z=t("base64-js"),K=t("ieee754"),Q=t("isarray");e.Buffer=Buffer,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==r.TYPED_ARRAY_SUPPORT?r.TYPED_ARRAY_SUPPORT:n(),e.kMaxLength=i(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,r,e){return f(null,t,r,e)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,r,e){return a(null,t,r,e)},Buffer.allocUnsafe=function(t){return s(null,t)},Buffer.allocUnsafeSlow=function(t){return s(null,t)},Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,r){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},Buffer.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(t,r){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=Buffer.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Buffer.byteLength=v,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)b(this,r,r+1);return this},Buffer.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)b(this,r,r+3),b(this,r+1,r+2);return this},Buffer.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)b(this,r,r+7),b(this,r+1,r+6),b(this,r+2,r+5),b(this,r+3,r+4);return this},Buffer.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(this,0,t):g.apply(this,arguments)},Buffer.prototype.equals=function(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Buffer.compare(this,t)},Buffer.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function(t,r,e,n,i){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(r>>>=0,e>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,f=e-r,u=Math.min(o,f),a=this.slice(n,i),s=t.slice(r,e),c=0;c<u;++c)if(a[c]!==s[c]){o=a[c],f=s[c];break}return o<f?-1:f<o?1:0},Buffer.prototype.includes=function(t,r,e){return this.indexOf(t,r,e)!==-1},Buffer.prototype.indexOf=function(t,r,e){return w(this,t,r,e,!0)},Buffer.prototype.lastIndexOf=function(t,r,e){return w(this,t,r,e,!1)},Buffer.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r=0|r,isFinite(e)?(e=0|e,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,r,e);case"utf8":case"utf-8":return m(this,t,r,e);case"ascii":return x(this,t,r,e);case"latin1":case"binary":return B(this,t,r,e);case"base64":return U(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;Buffer.prototype.slice=function(t,r){var e=this.length;t=~~t,r=void 0===r?e:~~r,t<0?(t+=e,t<0&&(t=0)):t>e&&(t=e),r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),r<t&&(r=t);var n;if(Buffer.TYPED_ARRAY_SUPPORT)n=this.subarray(t,r),n.__proto__=Buffer.prototype;else{var i=r-t;n=new Buffer(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},Buffer.prototype.readUIntLE=function(t,r,e){t=0|t,r=0|r,e||C(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},Buffer.prototype.readUIntBE=function(t,r,e){t=0|t,r=0|r,e||C(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},Buffer.prototype.readUInt8=function(t,r){return r||C(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,r){return r||C(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,r){return r||C(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,r){return r||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,r){return r||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,r,e){t=0|t,r=0|r,e||C(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*r)),n},Buffer.prototype.readIntBE=function(t,r,e){t=0|t,r=0|r,e||C(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o},Buffer.prototype.readInt8=function(t,r){return r||C(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},Buffer.prototype.readInt16LE=function(t,r){r||C(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},Buffer.prototype.readInt16BE=function(t,r){r||C(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},Buffer.prototype.readInt32LE=function(t,r){return r||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,r){return r||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,r){return r||C(t,4,this.length),K.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,r){return r||C(t,4,this.length),K.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,r){return r||C(t,8,this.length),K.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,r){return r||C(t,8,this.length),K.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r=0|r,e=0|e,!n){var i=Math.pow(2,8*e)-1;D(this,t,r,e,i,0)}var o=1,f=0;for(this[r]=255&t;++f<e&&(o*=256);)this[r+f]=t/o&255;return r+e},Buffer.prototype.writeUIntBE=function(t,r,e,n){if(t=+t,r=0|r,e=0|e,!n){var i=Math.pow(2,8*e)-1;D(this,t,r,e,i,0)}var o=e-1,f=1;for(this[r+o]=255&t;--o>=0&&(f*=256);)this[r+o]=t/f&255;return r+e},Buffer.prototype.writeUInt8=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},Buffer.prototype.writeUInt16LE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):O(this,t,r,!0),r+2},Buffer.prototype.writeUInt16BE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):O(this,t,r,!1),r+2},Buffer.prototype.writeUInt32LE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):L(this,t,r,!0),r+4},Buffer.prototype.writeUInt32BE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):L(this,t,r,!1),r+4},Buffer.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r=0|r,!n){var i=Math.pow(2,8*e-1);D(this,t,r,e,i-1,-i)}var o=0,f=1,u=0;for(this[r]=255&t;++o<e&&(f*=256);)t<0&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},Buffer.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r=0|r,!n){var i=Math.pow(2,8*e-1);D(this,t,r,e,i-1,-i)}var o=e-1,f=1,u=0;for(this[r+o]=255&t;--o>=0&&(f*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},Buffer.prototype.writeInt8=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},Buffer.prototype.writeInt16LE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):O(this,t,r,!0),r+2},Buffer.prototype.writeInt16BE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):O(this,t,r,!1),r+2},Buffer.prototype.writeInt32LE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):L(this,t,r,!0),r+4},Buffer.prototype.writeInt32BE=function(t,r,e){return t=+t,r=0|r,e||D(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):L(this,t,r,!1),r+4},Buffer.prototype.writeFloatLE=function(t,r,e){return N(this,t,r,!0,e)},Buffer.prototype.writeFloatBE=function(t,r,e){return N(this,t,r,!1,e)},Buffer.prototype.writeDoubleLE=function(t,r,e){return F(this,t,r,!0,e)},Buffer.prototype.writeDoubleBE=function(t,r,e){return F(this,t,r,!1,e)},Buffer.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},Buffer.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Buffer.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t=255&t);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0);var o;if("number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var f=Buffer.isBuffer(t)?t:q(new Buffer(t,n).toString()),u=f.length;for(o=0;o<e-r;++o)this[o+r]=f[o%u]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":30,ieee754:32,isarray:34}],30:[function(t,r,e){"use strict";function n(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[r-2]?2:"="===t[r-1]?1:0}function i(t){return 3*t.length/4-n(t)}function o(t){var r,e,i,o,f,u,a=t.length;f=n(t),u=new h(3*a/4-f),i=f>0?a-4:a;var s=0;for(r=0,e=0;r<i;r+=4,e+=3)o=c[t.charCodeAt(r)]<<18|c[t.charCodeAt(r+1)]<<12|c[t.charCodeAt(r+2)]<<6|c[t.charCodeAt(r+3)],u[s++]=o>>16&255,u[s++]=o>>8&255,u[s++]=255&o;return 2===f?(o=c[t.charCodeAt(r)]<<2|c[t.charCodeAt(r+1)]>>4,u[s++]=255&o):1===f&&(o=c[t.charCodeAt(r)]<<10|c[t.charCodeAt(r+1)]<<4|c[t.charCodeAt(r+2)]>>2,u[s++]=o>>8&255,u[s++]=255&o),u}function f(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function u(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(f(n));return i.join("")}function a(t){for(var r,e=t.length,n=e%3,i="",o=[],f=16383,a=0,c=e-n;a<c;a+=f)o.push(u(t,a,a+f>c?c:a+f));return 1===n?(r=t[e-1],i+=s[r>>2],i+=s[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=s[r>>10],i+=s[r>>4&63],i+=s[r<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=i,e.toByteArray=o,e.fromByteArray=a;for(var s=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=l.length;p<d;++p)s[p]=l[p],c[l.charCodeAt(p)]=p;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},{}],31:[function(t,r,e){function n(){if(!(this instanceof n))return new n}!function(t){function e(t){for(var r in s)t[r]=s[r];return t}function n(t,r){return u(this,t).push(r),this}function i(t,r){function e(){o.call(n,t,e),r.apply(this,arguments)}var n=this;return e.originalListener=r,u(n,t).push(e),n}function o(t,r){function e(t){return t!==r&&t.originalListener!==r}var n,i=this;if(arguments.length){if(r){if(n=u(i,t,!0)){if(n=n.filter(e),!n.length)return o.call(i,t);i[a][t]=n}}else if(n=i[a],n&&(delete n[t],!Object.keys(n).length))return o.call(i)}else delete i[a];return i}function f(t,r){function e(t){t.call(o)}function n(t){t.call(o,r)}function i(t){t.apply(o,s)}var o=this,f=u(o,t,!0);if(!f)return!1;var a=arguments.length;if(1===a)f.forEach(e);else if(2===a)f.forEach(n);else{var s=Array.prototype.slice.call(arguments,1);f.forEach(i)}return!!f.length}function u(t,r,e){if(!e||t[a]){var n=t[a]||(t[a]={});return n[r]||(n[r]=[])}}"undefined"!=typeof r&&(r.exports=t);var a="listeners",s={on:n,once:i,off:o,emit:f};e(t.prototype),t.mixin=e}(n)},{}],32:[function(t,r,e){e.read=function(t,r,e,n,i){var o,f,u=8*i-n-1,a=(1<<u)-1,s=a>>1,c=-7,h=e?i-1:0,l=e?-1:1,p=t[r+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=u;c>0;o=256*o+t[r+h],h+=l,c-=8);for(f=o&(1<<-c)-1,o>>=-c,c+=n;c>0;f=256*f+t[r+h],h+=l,c-=8);if(0===o)o=1-s;else{if(o===a)return f?NaN:(p?-1:1)*(1/0);f+=Math.pow(2,n),o-=s}return(p?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,r,e,n,i,o){var f,u,a,s=8*o-i-1,c=(1<<s)-1,h=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,f=c):(f=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-f))<1&&(f--,a*=2),r+=f+h>=1?l/a:l*Math.pow(2,1-h),r*a>=2&&(f++,a/=2),f+h>=c?(u=0,f=c):f+h>=1?(u=(r*a-1)*Math.pow(2,i),f+=h):(u=r*Math.pow(2,h-1)*Math.pow(2,i),f=0));i>=8;t[e+p]=255&u,p+=d,u/=256,i-=8);for(f=f<<i|u,s+=i;s>0;t[e+p]=255&f,p+=d,f/=256,s-=8);t[e+p-d]|=128*y}},{}],33:[function(t,r,e){(function(Buffer){var t,r,n,i;!function(e){function o(t,r,n){function i(t,r,e,n){return this instanceof i?v(this,t,r,e,n):new i(t,r,e,n)}function o(t){return!(!t||!t[F])}function v(t,r,e,n,i){if(E&&A&&(r instanceof A&&(r=new E(r)),n instanceof A&&(n=new E(n))),!(r||e||n||g))return void(t.buffer=h(m,0));if(!s(r,e)){var o=g||Array;i=e,n=r,e=0,r=new o(8)}t.buffer=r,t.offset=e|=0,b!==typeof n&&("string"==typeof n?x(r,e,n,i||10):s(n,i)?c(r,e,n,i):"number"==typeof i?(k(r,e+T,n),k(r,e+S,i)):n>0?O(r,e,n):n<0?L(r,e,n):c(r,e,m,0))}function x(t,r,e,n){var i=0,o=e.length,f=0,u=0;"-"===e[0]&&i++;for(var a=i;i<o;){var s=parseInt(e[i++],n);if(!(s>=0))break;u=u*n+s,f=f*n+Math.floor(u/B),u%=B}a&&(f=~f,u?u=B-u:f++),k(t,r+T,f),k(t,r+S,u)}function P(){var t=this.buffer,r=this.offset,e=_(t,r+T),i=_(t,r+S);return n||(e|=0),e?e*B+i:i}function R(t){var r=this.buffer,e=this.offset,i=_(r,e+T),o=_(r,e+S),f="",u=!n&&2147483648&i;for(u&&(i=~i,o=B-o),t=t||10;;){var a=i%t*B+o;if(i=Math.floor(i/t),o=Math.floor(a/t),f=(a%t).toString(t)+f,!i&&!o)break}return u&&(f="-"+f),f}function k(t,r,e){t[r+D]=255&e,e>>=8,t[r+C]=255&e,e>>=8,t[r+Y]=255&e,e>>=8,t[r+I]=255&e}function _(t,r){return t[r+I]*U+(t[r+Y]<<16)+(t[r+C]<<8)+t[r+D]}var T=r?0:4,S=r?4:0,I=r?0:3,Y=r?1:2,C=r?2:1,D=r?3:0,O=r?l:d,L=r?p:y,M=i.prototype,N="is"+t,F="_"+N;return M.buffer=void 0,M.offset=0,M[F]=!0,M.toNumber=P,M.toString=R,M.toJSON=P,M.toArray=f,w&&(M.toBuffer=u),E&&(M.toArrayBuffer=a),i[N]=o,e[t]=i,i}function f(t){var r=this.buffer,e=this.offset;return g=null,t!==!1&&0===e&&8===r.length&&x(r)?r:h(r,e)}function u(t){var r=this.buffer,e=this.offset;if(g=w,t!==!1&&0===e&&8===r.length&&Buffer.isBuffer(r))return r;var n=new w(8);return c(n,0,r,e),n}function a(t){var r=this.buffer,e=this.offset,n=r.buffer;if(g=E,t!==!1&&0===e&&n instanceof A&&8===n.byteLength)return n;var i=new E(8);return c(i,0,r,e),i.buffer}function s(t,r){var e=t&&t.length;return r|=0,e&&r+8<=e&&"string"!=typeof t[r]}function c(t,r,e,n){r|=0,n|=0;for(var i=0;i<8;i++)t[r++]=255&e[n++]}function h(t,r){return Array.prototype.slice.call(t,r,r+8)}function l(t,r,e){for(var n=r+8;n>r;)t[--n]=255&e,e/=256}function p(t,r,e){var n=r+8;for(e++;n>r;)t[--n]=255&-e^255,e/=256}function d(t,r,e){for(var n=r+8;r<n;)t[r++]=255&e,e/=256}function y(t,r,e){var n=r+8;for(e++;r<n;)t[r++]=255&-e^255,e/=256}function v(t){return!!t&&"[object Array]"==Object.prototype.toString.call(t)}var g,b="undefined",w=b!==typeof Buffer&&Buffer,E=b!==typeof Uint8Array&&Uint8Array,A=b!==typeof ArrayBuffer&&ArrayBuffer,m=[0,0,0,0,0,0,0,0],x=Array.isArray||v,B=4294967296,U=16777216;t=o("Uint64BE",!0,!0),r=o("Int64BE",!0,!1),n=o("Uint64LE",!1,!0),i=o("Int64LE",!1,!1)}("object"==typeof e&&"string"!=typeof e.nodeName?e:this||{})}).call(this,t("buffer").Buffer)},{buffer:29}],34:[function(t,r,e){var n={}.toString;r.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}]},{},[1])(1)});
|
|
1
|
+
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).msgpack=t()}(function(){return function n(i,o,f){function u(r,t){if(!o[r]){if(!i[r]){var e="function"==typeof require&&require;if(!t&&e)return e(r,!0);if(a)return a(r,!0);throw(t=new Error("Cannot find module '"+r+"'")).code="MODULE_NOT_FOUND",t}e=o[r]={exports:{}},i[r][0].call(e.exports,function(t){return u(i[r][1][t]||t)},e,e.exports,n,i,o,f)}return o[r].exports}for(var a="function"==typeof require&&require,t=0;t<f.length;t++)u(f[t]);return u}({1:[function(t,r,e){e.encode=t("./encode").encode,e.decode=t("./decode").decode,e.Encoder=t("./encoder").Encoder,e.Decoder=t("./decoder").Decoder,e.createCodec=t("./ext").createCodec,e.codec=t("./codec").codec},{"./codec":10,"./decode":12,"./decoder":13,"./encode":15,"./encoder":16,"./ext":20}],2:[function(t,r,e){!function(Buffer){!function(){function t(t){return t&&t.isBuffer&&t}r.exports=t(void 0!==Buffer&&Buffer)||t(this.Buffer)||t("undefined"!=typeof window&&window.Buffer)||this.Buffer}.call(this)}.call(this,t("buffer").Buffer)},{buffer:30}],3:[function(t,r,e){e.copy=function(t,r,e,n){var i;e=e||0;n||0===n||(n=this.length);r=r||0;var o=n-e;if(t===this&&e<r&&r<n)for(i=o-1;0<=i;i--)t[i+r]=this[i+e];else for(i=0;i<o;i++)t[i+r]=this[i+e];return o},e.toString=function(t,r,e){var n=this,i=0|r;e=e||n.length;var o="",f=0;for(;i<e;)!((f=n[i++])<128)&&(192==(224&f)?f=(31&f)<<6|63&n[i++]:224==(240&f)?f=(15&f)<<12|(63&n[i++])<<6|63&n[i++]:240==(248&f)&&(f=(7&f)<<18|(63&n[i++])<<12|(63&n[i++])<<6|63&n[i++]),65536<=f)?(f-=65536,o+=String.fromCharCode(55296+(f>>>10),56320+(1023&f))):o+=String.fromCharCode(f);return o},e.write=function(t,r){var e=this,n=r||(r|=0),i=t.length,o=0,f=0;for(;f<i;)(o=t.charCodeAt(f++))<128?e[n++]=o:(o<2048?e[n++]=192|o>>>6:(o<55296||57343<o?e[n++]=224|o>>>12:(o=65536+(o-55296<<10|t.charCodeAt(f++)-56320),e[n++]=240|o>>>18,e[n++]=128|o>>>12&63),e[n++]=128|o>>>6&63),e[n++]=128|63&o);return n-r}},{}],4:[function(t,r,e){var n=t("./bufferish");function i(t){return new Array(t)}(e=r.exports=i(0)).alloc=i,e.concat=n.concat,e.from=function(t){if(!n.isBuffer(t)&&n.isView(t))t=n.Uint8Array.from(t);else if(n.isArrayBuffer(t))t=new Uint8Array(t);else{if("string"==typeof t)return n.from.call(e,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return Array.prototype.slice.call(t)}},{"./bufferish":8}],5:[function(t,r,e){var n=t("./bufferish"),Buffer=n.global;function i(t){return new Buffer(t)}(e=r.exports=n.hasBuffer?Buffer.alloc?Buffer.alloc(0):i(0):[]).alloc=n.hasBuffer&&Buffer.alloc||i,e.concat=n.concat,e.from=function(t){if(!n.isBuffer(t)&&n.isView(t))t=n.Uint8Array.from(t);else if(n.isArrayBuffer(t))t=new Uint8Array(t);else{if("string"==typeof t)return n.from.call(e,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return Buffer.from&&1!==Buffer.from.length?Buffer.from(t):new Buffer(t)}},{"./bufferish":8}],6:[function(t,r,e){var n,f=t("./buffer-lite"),u=(e.copy=o,e.slice=s,e.toString=function(t,r,e){return(!i&&u.isBuffer(this)?this:f).toString.apply(this,arguments)},e.write=(n="write",function(){return(this[n]||f[n]).apply(this,arguments)}),t("./bufferish")),e=u.global,i=u.hasBuffer&&"TYPED_ARRAY_SUPPORT"in e,a=i&&!e.TYPED_ARRAY_SUPPORT;function o(t,r,e,n){var i=u.isBuffer(this),o=u.isBuffer(t);return i&&o?this.copy(t,r,e,n):a||i||o||!u.isView(this)||!u.isView(t)?f.copy.call(this,t,r,e,n):(i=e||null!=n?s.call(this,e,n):this,t.set(i,r),i.length)}function s(t,r){var e=this.slice||!a&&this.subarray;return e?e.call(this,t,r):(e=u.alloc.call(this,r-t),o.call(this,e,0,t,r),e)}},{"./buffer-lite":3,"./bufferish":8}],7:[function(t,r,n){var i=t("./bufferish");function e(t){return new Uint8Array(t)}(n=r.exports=i.hasArrayBuffer?e(0):[]).alloc=e,n.concat=i.concat,n.from=function(t){if(i.isView(t)){var r=t.byteOffset,e=t.byteLength;(t=t.buffer).byteLength!==e&&(t.slice?t=t.slice(r,r+e):(t=new Uint8Array(t)).byteLength!==e&&(t=Array.prototype.slice.call(t,r,r+e)))}else{if("string"==typeof t)return i.from.call(n,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return new Uint8Array(t)}},{"./bufferish":8}],8:[function(t,r,o){var Buffer=o.global=t("./buffer-global"),e=o.hasBuffer=Buffer&&!!Buffer.isBuffer,n=o.hasArrayBuffer="undefined"!=typeof ArrayBuffer,i=o.isArray=t("isarray"),f=(o.isArrayBuffer=n?function(t){return t instanceof ArrayBuffer||p(t)}:y,o.isBuffer=e?Buffer.isBuffer:y),u=o.isView=n?ArrayBuffer.isView||g("ArrayBuffer","buffer"):y,a=(o.alloc=l,o.concat=function(t,r){r||(r=0,Array.prototype.forEach.call(t,function(t){r+=t.length}));var e=this!==o&&this||t[0],n=l.call(e,r),i=0;return Array.prototype.forEach.call(t,function(t){i+=h.copy.call(t,n,i)}),n},o.from=function(t){return"string"==typeof t?function(t){var r=3*t.length,e=l.call(this,r),t=h.write.call(e,t);r!==t&&(e=h.slice.call(e,0,t));return e}.call(this,t):d(this).from(t)},o.Array=t("./bufferish-array")),s=o.Buffer=t("./bufferish-buffer"),c=o.Uint8Array=t("./bufferish-uint8array"),h=o.prototype=t("./bufferish-proto");function l(t){return d(this).alloc(t)}var p=g("ArrayBuffer");function d(t){return f(t)?s:u(t)?c:i(t)?a:e?s:n?c:a}function y(){return!1}function g(r,e){return r="[object "+r+"]",function(t){return null!=t&&{}.toString.call(e?t[e]:t)===r}}},{"./buffer-global":2,"./bufferish-array":4,"./bufferish-buffer":5,"./bufferish-proto":6,"./bufferish-uint8array":7,isarray:35}],9:[function(t,r,e){var n=t("isarray"),i=(e.createCodec=f,e.install=function(t){for(var r in t)o.prototype[r]=function(t,r){return t&&r?function(){return t.apply(this,arguments),r.apply(this,arguments)}:t||r}(o.prototype[r],t[r])},e.filter=function(t){return n(t)?function(r){return r=r.slice(),function(t){return r.reduce(e,t)};function e(t,r){return r(t)}}(t):t},t("./bufferish"));function o(t){if(!(this instanceof o))return new o(t);this.options=t,this.init()}function f(t){return new o(t)}o.prototype.init=function(){var t=this.options;return t&&t.uint8array&&(this.bufferish=i.Uint8Array),this},e.preset=f({preset:!0})},{"./bufferish":8,isarray:35}],10:[function(t,r,e){t("./read-core"),t("./write-core"),e.codec={preset:t("./codec-base").preset}},{"./codec-base":9,"./read-core":22,"./write-core":25}],11:[function(t,r,e){e.DecodeBuffer=n;e=t("./read-core").preset;function n(t){if(!(this instanceof n))return new n(t);t&&(this.options=t).codec&&(t=this.codec=t.codec).bufferish&&(this.bufferish=t.bufferish)}t("./flex-buffer").FlexDecoder.mixin(n.prototype),n.prototype.codec=e,n.prototype.fetch=function(){return this.codec.decode(this)}},{"./flex-buffer":21,"./read-core":22}],12:[function(t,r,e){e.decode=function(t,r){r=new n(r);return r.write(t),r.read()};var n=t("./decode-buffer").DecodeBuffer},{"./decode-buffer":11}],13:[function(t,r,e){e.Decoder=i;var e=t("event-lite"),n=t("./decode-buffer").DecodeBuffer;function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}i.prototype=new n,e.mixin(i.prototype),i.prototype.decode=function(t){arguments.length&&this.write(t),this.flush()},i.prototype.push=function(t){this.emit("data",t)},i.prototype.end=function(t){this.decode(t),this.emit("end")}},{"./decode-buffer":11,"event-lite":32}],14:[function(t,r,e){e.EncodeBuffer=n;e=t("./write-core").preset;function n(t){if(!(this instanceof n))return new n(t);t&&(this.options=t).codec&&(t=this.codec=t.codec).bufferish&&(this.bufferish=t.bufferish)}t("./flex-buffer").FlexEncoder.mixin(n.prototype),n.prototype.codec=e,n.prototype.write=function(t){this.codec.encode(this,t)}},{"./flex-buffer":21,"./write-core":25}],15:[function(t,r,e){e.encode=function(t,r){r=new n(r);return r.write(t),r.read()};var n=t("./encode-buffer").EncodeBuffer},{"./encode-buffer":14}],16:[function(t,r,e){e.Encoder=i;var e=t("event-lite"),n=t("./encode-buffer").EncodeBuffer;function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}i.prototype=new n,e.mixin(i.prototype),i.prototype.encode=function(t){this.write(t),this.emit("data",this.read())},i.prototype.end=function(t){arguments.length&&this.encode(t),this.flush(),this.emit("end")}},{"./encode-buffer":14,"event-lite":32}],17:[function(t,r,e){e.ExtBuffer=function t(r,e){if(!(this instanceof t))return new t(r,e);this.buffer=n.from(r);this.type=e};var n=t("./bufferish")},{"./bufferish":8}],18:[function(r,t,e){e.setExtPackers=function(t){t.addExtPacker(14,Error,[c,u]),t.addExtPacker(1,EvalError,[c,u]),t.addExtPacker(2,RangeError,[c,u]),t.addExtPacker(3,ReferenceError,[c,u]),t.addExtPacker(4,SyntaxError,[c,u]),t.addExtPacker(5,TypeError,[c,u]),t.addExtPacker(6,URIError,[c,u]),t.addExtPacker(10,RegExp,[s,u]),t.addExtPacker(11,Boolean,[a,u]),t.addExtPacker(12,String,[a,u]),t.addExtPacker(13,Date,[Number,u]),t.addExtPacker(15,Number,[a,u]),"undefined"!=typeof Uint8Array&&(t.addExtPacker(17,Int8Array,o),t.addExtPacker(18,Uint8Array,o),t.addExtPacker(19,Int16Array,o),t.addExtPacker(20,Uint16Array,o),t.addExtPacker(21,Int32Array,o),t.addExtPacker(22,Uint32Array,o),t.addExtPacker(23,Float32Array,o),"undefined"!=typeof Float64Array&&t.addExtPacker(24,Float64Array,o),"undefined"!=typeof Uint8ClampedArray&&t.addExtPacker(25,Uint8ClampedArray,o),t.addExtPacker(26,ArrayBuffer,o),t.addExtPacker(29,DataView,o));i.hasBuffer&&t.addExtPacker(27,Buffer,i.from)};var n,i=r("./bufferish"),Buffer=i.global,o=i.Uint8Array.from,f={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1};function u(t){return(n=n||r("./encode").encode)(t)}function a(t){return t.valueOf()}function s(t){(t=RegExp.prototype.toString.call(t).split("/")).shift();var r=[t.pop()];return r.unshift(t.join("/")),r}function c(t){var r,e={};for(r in f)e[r]=t[r];return e}},{"./bufferish":8,"./encode":15}],19:[function(r,t,e){e.setExtUnpackers=function(t){t.addExtUnpacker(14,[f,a(Error)]),t.addExtUnpacker(1,[f,a(EvalError)]),t.addExtUnpacker(2,[f,a(RangeError)]),t.addExtUnpacker(3,[f,a(ReferenceError)]),t.addExtUnpacker(4,[f,a(SyntaxError)]),t.addExtUnpacker(5,[f,a(TypeError)]),t.addExtUnpacker(6,[f,a(URIError)]),t.addExtUnpacker(10,[f,u]),t.addExtUnpacker(11,[f,s(Boolean)]),t.addExtUnpacker(12,[f,s(String)]),t.addExtUnpacker(13,[f,s(Date)]),t.addExtUnpacker(15,[f,s(Number)]),"undefined"!=typeof Uint8Array&&(t.addExtUnpacker(17,s(Int8Array)),t.addExtUnpacker(18,s(Uint8Array)),t.addExtUnpacker(19,[c,s(Int16Array)]),t.addExtUnpacker(20,[c,s(Uint16Array)]),t.addExtUnpacker(21,[c,s(Int32Array)]),t.addExtUnpacker(22,[c,s(Uint32Array)]),t.addExtUnpacker(23,[c,s(Float32Array)]),"undefined"!=typeof Float64Array&&t.addExtUnpacker(24,[c,s(Float64Array)]),"undefined"!=typeof Uint8ClampedArray&&t.addExtUnpacker(25,s(Uint8ClampedArray)),t.addExtUnpacker(26,c),t.addExtUnpacker(29,[c,s(DataView)]));i.hasBuffer&&t.addExtUnpacker(27,i.from)};var n,i=r("./bufferish"),o=(i.global,{name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1});function f(t){return(n=n||r("./decode").decode)(t)}function u(t){return RegExp.apply(null,t)}function a(n){return function(t){var r,e=new n;for(r in o)e[r]=t[r];return e}}function s(r){return function(t){return new r(t)}}function c(t){return new Uint8Array(t).buffer}},{"./bufferish":8,"./decode":12}],20:[function(t,r,e){t("./read-core"),t("./write-core"),e.createCodec=t("./codec-base").createCodec},{"./codec-base":9,"./read-core":22,"./write-core":25}],21:[function(t,r,e){e.FlexDecoder=o,e.FlexEncoder=f;var n=t("./bufferish"),i="BUFFER_SHORTAGE";function o(){if(!(this instanceof o))return new o}function f(){if(!(this instanceof f))return new f}function u(){throw new Error("method not implemented: write()")}function a(){throw new Error("method not implemented: fetch()")}function s(){return this.buffers&&this.buffers.length?(this.flush(),this.pull()):this.fetch()}function c(t){(this.buffers||(this.buffers=[])).push(t)}function h(){return(this.buffers||(this.buffers=[])).shift()}function l(e){return function(t){for(var r in e)t[r]=e[r];return t}}o.mixin=l({bufferish:n,write:function(t){var r=this.offset?n.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=r?t?this.bufferish.concat([r,t]):r:t,this.offset=0},fetch:a,flush:function(){for(;this.offset<this.buffer.length;){var t,r=this.offset;try{t=this.fetch()}catch(t){if(t&&t.message!=i)throw t;this.offset=r;break}this.push(t)}},push:c,pull:h,read:s,reserve:function(t){var r=this.offset,t=r+t;if(t>this.buffer.length)throw new Error(i);return this.offset=t,r},offset:0}),o.mixin(o.prototype),f.mixin=l({bufferish:n,write:u,fetch:function(){var t=this.start;{var r;if(t<this.offset)return r=this.start=this.offset,n.prototype.slice.call(this.buffer,t,r)}},flush:function(){for(;this.start<this.offset;){var t=this.fetch();t&&this.push(t)}},push:c,pull:function(){var t=this.buffers||(this.buffers=[]),r=1<t.length?this.bufferish.concat(t):t[0];return t.length=0,r},read:s,reserve:function(t){var r=0|t;if(this.buffer){var e=this.buffer.length,n=0|this.offset,i=n+r;if(i<e)return this.offset=i,n;this.flush(),t=Math.max(t,Math.min(2*e,this.maxBufferSize))}return t=Math.max(t,this.minBufferSize),this.buffer=this.bufferish.alloc(t),this.start=0,this.offset=r,0},send:function(t){var r=t.length;r>this.minBufferSize?(this.flush(),this.push(t)):(r=this.reserve(r),n.prototype.copy.call(t,this.buffer,r))},maxBufferSize:65536,minBufferSize:2048,offset:0,start:0}),f.mixin(f.prototype)},{"./bufferish":8}],22:[function(t,r,e){var n=t("./ext-buffer").ExtBuffer,i=t("./ext-unpacker"),o=t("./read-format").readUint8,f=t("./read-token"),u=t("./codec-base");function a(t){var n=f.getReadToken(t);return function(t){var r=o(t),e=n[r];if(e)return e(t);throw new Error("Invalid type: "+(r&&"0x"+r.toString(16)))}}function s(){var t=this.options;return this.decode=a(t),t&&t.preset&&i.setExtUnpackers(this),this}u.install({addExtUnpacker:function(t,r){(this.extUnpackers||(this.extUnpackers=[]))[t]=u.filter(r)},getExtUnpacker:function(r){return(this.extUnpackers||(this.extUnpackers=[]))[r]||function(t){return new n(t,r)}},init:s}),e.preset=s.call(u.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-unpacker":19,"./read-format":23,"./read-token":24}],23:[function(t,r,e){var n=t("ieee754"),i=t("int64-buffer"),o=i.Uint64BE,f=i.Int64BE,u=(e.getReadFormat=function(t){var r=u.hasArrayBuffer&&t&&t.binarraybuffer,e=t&&t.int64;return{map:s&&t&&t.usemap?d:p,array:y,str:g,bin:r?w:b,ext:v,uint8:E,uint16:m,uint32:B,uint64:R(8,e?_:P),int8:A,int16:x,int32:U,int64:R(8,e?T:k),float32:R(4,S),float64:R(8,I)}},e.readUint8=E,t("./bufferish")),a=t("./bufferish-proto"),s="undefined"!=typeof Map,c=!0,h="BUFFER_SHORTAGE";function l(t,r){if(r>t.buffer.length-t.offset)throw new Error(h)}function p(t,r){l(t,2*r);for(var e={},n=new Array(r),i=new Array(r),o=t.codec.decode,f=0;f<r;f++)n[f]=o(t),i[f]=o(t);for(f=0;f<r;f++)e[n[f]]=i[f];return e}function d(t,r){l(t,2*r);for(var e=new Map,n=new Array(r),i=new Array(r),o=t.codec.decode,f=0;f<r;f++)n[f]=o(t),i[f]=o(t);for(f=0;f<r;f++)e.set(n[f],i[f]);return e}function y(t,r){l(t,r);for(var e=new Array(r),n=t.codec.decode,i=0;i<r;i++)e[i]=n(t);return e}function g(t,r){var e=t.reserve(r);return a.toString.call(t.buffer,"utf-8",e,e+r)}function b(t,r){var e=t.reserve(r),t=a.slice.call(t.buffer,e,e+r);return u.from(t)}function w(t,r){var e=t.reserve(r),t=a.slice.call(t.buffer,e,e+r);return u.Uint8Array.from(t).buffer}function v(t,r){var e=t.reserve(r+1),n=t.buffer[e++],r=e+r,i=t.codec.getExtUnpacker(n);if(i)return i(a.slice.call(t.buffer,e,r));throw new Error("Invalid ext type: "+(n&&"0x"+n.toString(16)))}function E(t){var r=t.reserve(1);return t.buffer[r]}function A(t){var r=t.reserve(1),t=t.buffer[r];return 128&t?t-256:t}function m(t){var r=t.reserve(2),t=t.buffer;return t[r++]<<8|t[r]}function x(t){var r=t.reserve(2),t=t.buffer,t=t[r++]<<8|t[r];return 32768&t?t-65536:t}function B(t){var r=t.reserve(4),t=t.buffer;return 16777216*t[r++]+(t[r++]<<16)+(t[r++]<<8)+t[r]}function U(t){var r=t.reserve(4),t=t.buffer;return t[r++]<<24|t[r++]<<16|t[r++]<<8|t[r]}function R(e,n){return function(t){var r=t.reserve(e);return n.call(t.buffer,r,c)}}function P(t){return new o(this,t).toNumber()}function k(t){return new f(this,t).toNumber()}function _(t){return new o(this,t)}function T(t){return new f(this,t)}function S(t){return n.read(this,t,!1,23,4)}function I(t){return n.read(this,t,!1,52,8)}},{"./bufferish":8,"./bufferish-proto":6,ieee754:33,"int64-buffer":34}],24:[function(t,r,e){var n=t("./read-format");function i(t){for(var r=new Array(256),e=0;e<=127;e++)r[e]=o(e);for(e=128;e<=143;e++)r[e]=u(e-128,t.map);for(e=144;e<=159;e++)r[e]=u(e-144,t.array);for(e=160;e<=191;e++)r[e]=u(e-160,t.str);for(r[192]=o(null),r[193]=null,r[194]=o(!1),r[195]=o(!0),r[196]=f(t.uint8,t.bin),r[197]=f(t.uint16,t.bin),r[198]=f(t.uint32,t.bin),r[199]=f(t.uint8,t.ext),r[200]=f(t.uint16,t.ext),r[201]=f(t.uint32,t.ext),r[202]=t.float32,r[203]=t.float64,r[204]=t.uint8,r[205]=t.uint16,r[206]=t.uint32,r[207]=t.uint64,r[208]=t.int8,r[209]=t.int16,r[210]=t.int32,r[211]=t.int64,r[212]=u(1,t.ext),r[213]=u(2,t.ext),r[214]=u(4,t.ext),r[215]=u(8,t.ext),r[216]=u(16,t.ext),r[217]=f(t.uint8,t.str),r[218]=f(t.uint16,t.str),r[219]=f(t.uint32,t.str),r[220]=f(t.uint16,t.array),r[221]=f(t.uint32,t.array),r[222]=f(t.uint16,t.map),r[223]=f(t.uint32,t.map),e=224;e<=255;e++)r[e]=o(e-256);return r}function o(t){return function(){return t}}function f(e,n){return function(t){var r=e(t);return n(t,r)}}function u(r,e){return function(t){return e(t,r)}}e.getReadToken=function(t){var r=n.getReadFormat(t);return(t&&t.useraw?function(t){var r,e=i(t).slice();for(e[217]=e[196],e[218]=e[197],e[219]=e[198],r=160;r<=191;r++)e[r]=u(r-160,t.bin);return e}:i)(r)}},{"./read-format":23}],25:[function(t,r,e){var o=t("./ext-buffer").ExtBuffer,n=t("./ext-packer"),i=t("./write-type"),f=t("./codec-base");function u(t){var n=i.getWriteType(t);return function(t,r){var e=n[typeof r];if(!e)throw new Error('Unsupported type "'+typeof r+'": '+r);e(t,r)}}function a(){var t=this.options;return this.encode=u(t),t&&t.preset&&n.setExtPackers(this),this}f.install({addExtPacker:function(r,t,e){e=f.filter(e);var n=t.name;n&&"Object"!==n?(this.extPackers||(this.extPackers={}))[n]=i:(this.extEncoderList||(this.extEncoderList=[])).unshift([t,i]);function i(t){return e&&(t=e(t)),new o(t,r)}},getExtPacker:function(t){var r=this.extPackers||(this.extPackers={}),e=t.constructor,t=e&&e.name&&r[e.name];if(t)return t;for(var n=this.extEncoderList||(this.extEncoderList=[]),i=n.length,o=0;o<i;o++){var f=n[o];if(e===f[0])return f[1]}},init:a}),e.preset=a.call(f.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-packer":18,"./write-type":27}],26:[function(t,r,e){var n=t("ieee754"),i=t("int64-buffer"),o=i.Uint64BE,f=i.Int64BE,u=t("./write-uint8").uint8,a=t("./bufferish"),Buffer=a.global,s=a.hasBuffer&&"TYPED_ARRAY_SUPPORT"in Buffer&&!Buffer.TYPED_ARRAY_SUPPORT,c=a.hasBuffer&&Buffer.prototype||{};function h(){var t=u.slice();return t[196]=l(196),t[197]=p(197),t[198]=d(198),t[199]=l(199),t[200]=p(200),t[201]=d(201),t[202]=y(202,4,c.writeFloatBE||w,!0),t[203]=y(203,8,c.writeDoubleBE||v,!0),t[204]=l(204),t[205]=p(205),t[206]=d(206),t[207]=y(207,8,g),t[208]=l(208),t[209]=p(209),t[210]=d(210),t[211]=y(211,8,b),t[217]=l(217),t[218]=p(218),t[219]=d(219),t[220]=p(220),t[221]=d(221),t[222]=p(222),t[223]=d(223),t}function l(n){return function(t,r){var e=t.reserve(2),t=t.buffer;t[e++]=n,t[e]=r}}function p(n){return function(t,r){var e=t.reserve(3),t=t.buffer;t[e++]=n,t[e++]=r>>>8,t[e]=r}}function d(n){return function(t,r){var e=t.reserve(5),t=t.buffer;t[e++]=n,t[e++]=r>>>24,t[e++]=r>>>16,t[e++]=r>>>8,t[e]=r}}function y(n,i,o,f){return function(t,r){var e=t.reserve(i+1);t.buffer[e++]=n,o.call(t.buffer,r,e,f)}}function g(t,r){new o(this,r,t)}function b(t,r){new f(this,r,t)}function w(t,r){n.write(this,t,r,!1,23,4)}function v(t,r){n.write(this,t,r,!1,52,8)}e.getWriteToken=function(t){return(t&&t.uint8array?function(){var t=h();return t[202]=y(202,4,w),t[203]=y(203,8,v),t}:s||a.hasBuffer&&t&&t.safe?function(){var t=u.slice();return t[196]=y(196,1,Buffer.prototype.writeUInt8),t[197]=y(197,2,Buffer.prototype.writeUInt16BE),t[198]=y(198,4,Buffer.prototype.writeUInt32BE),t[199]=y(199,1,Buffer.prototype.writeUInt8),t[200]=y(200,2,Buffer.prototype.writeUInt16BE),t[201]=y(201,4,Buffer.prototype.writeUInt32BE),t[202]=y(202,4,Buffer.prototype.writeFloatBE),t[203]=y(203,8,Buffer.prototype.writeDoubleBE),t[204]=y(204,1,Buffer.prototype.writeUInt8),t[205]=y(205,2,Buffer.prototype.writeUInt16BE),t[206]=y(206,4,Buffer.prototype.writeUInt32BE),t[207]=y(207,8,g),t[208]=y(208,1,Buffer.prototype.writeInt8),t[209]=y(209,2,Buffer.prototype.writeInt16BE),t[210]=y(210,4,Buffer.prototype.writeInt32BE),t[211]=y(211,8,b),t[217]=y(217,1,Buffer.prototype.writeUInt8),t[218]=y(218,2,Buffer.prototype.writeUInt16BE),t[219]=y(219,4,Buffer.prototype.writeUInt32BE),t[220]=y(220,2,Buffer.prototype.writeUInt16BE),t[221]=y(221,4,Buffer.prototype.writeUInt32BE),t[222]=y(222,2,Buffer.prototype.writeUInt16BE),t[223]=y(223,4,Buffer.prototype.writeUInt32BE),t}:h)()}},{"./bufferish":8,"./write-uint8":28,ieee754:33,"int64-buffer":34}],27:[function(t,r,e){var b=t("isarray"),n=t("int64-buffer"),w=n.Uint64BE,v=n.Int64BE,f=t("./bufferish"),a=t("./bufferish-proto"),u=t("./write-token"),E=t("./write-uint8").uint8,A=t("./ext-buffer").ExtBuffer,s="undefined"!=typeof Uint8Array,c="undefined"!=typeof Map,m=[];m[1]=212,m[2]=213,m[4]=214,m[8]=215,m[16]=216,e.getWriteType=function(t){var l=u.getWriteToken(t),r=t&&t.useraw,e=s&&t&&t.binarraybuffer,p=e?f.isArrayBuffer:f.isBuffer,d=e?function(t,r){i(t,new Uint8Array(r))}:i,y=c&&t&&t.usemap?function(n,t){if(!(t instanceof Map))return o(n,t);var r=t.size,i=(l[r<16?128+r:r<=65535?222:223](n,r),n.codec.encode);t.forEach(function(t,r,e){i(n,r),i(n,t)})}:o;return{boolean:function(t,r){l[r?195:194](t,r)},function:g,number:function(t,r){var e=0|r;r!==e?0<=r&&r<=4294967295&&Math.floor(r)===r?l[206](t,r):l[203](t,r):l[-32<=e&&e<=127?255&e:0<=e?e<=255?204:e<=65535?205:206:-128<=e?208:-32768<=e?209:210](t,e)},object:r?function(t,r){if(p(r))return function(t,r){var e=r.length;l[e<32?160+e:e<=65535?218:219](t,e),t.send(r)}(t,r);n(t,r)}:n,string:function(u){return function(t,r){var e=r.length,n=5+3*e,n=(t.offset=t.reserve(n),t.buffer),i=u(e),o=t.offset+i,r=(e=a.write.call(n,r,o),u(e));{var f;i!==r&&(i=o+r-i,f=o+e,a.copy.call(n,n,i,o,f))}l[1===r?160+e:r<=3?215+r:219](t,e),t.offset+=e}}(r?function(t){return t<32?1:t<=65535?3:5}:function(t){return t<32?1:t<=255?2:t<=65535?3:5}),symbol:g,undefined:g};function n(t,r){if(null===r)return g(t,r);if(p(r))return d(t,r);if(b(r))for(var e=t,n=r,i=n.length,o=(l[i<16?144+i:i<=65535?220:221](e,i),e.codec.encode),f=0;f<i;f++)o(e,n[f]);else if(w.isUint64BE(r))u=r,l[207](t,u.toArray());else if(v.isInt64BE(r))u=r,l[211](t,u.toArray());else{var u,a,s,c,h=t.codec.getExtPacker(r);if((r=h?h(r):r)instanceof A)return h=t,s=(a=r).buffer,c=s.length,l[m[c]||(c<255?199:c<=65535?200:201)](h,c),E[a.type](h),void h.send(s);y(t,r)}}function g(t,r){l[192](t,r)}function i(t,r){var e=r.length;l[e<255?196:e<=65535?197:198](t,e),t.send(r)}function o(r,e){var t=Object.keys(e),n=t.length,i=(l[n<16?128+n:n<=65535?222:223](r,n),r.codec.encode);t.forEach(function(t){i(r,t),i(r,e[t])})}}},{"./bufferish":8,"./bufferish-proto":6,"./ext-buffer":17,"./write-token":26,"./write-uint8":28,"int64-buffer":34,isarray:35}],28:[function(t,r,e){for(var n=e.uint8=new Array(256),i=0;i<=255;i++)n[i]=function(e){return function(t){var r=t.reserve(1);t.buffer[r]=e}}(i)},{}],29:[function(t,r,e){e.byteLength=function(t){var t=c(t),r=t[0],t=t[1];return 3*(r+t)/4-t},e.toByteArray=function(t){var r,e,n=c(t),i=n[0],n=n[1],o=new s(function(t,r){return 3*(t+r)/4-r}(i,n)),f=0,u=0<n?i-4:i;for(e=0;e<u;e+=4)r=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],o[f++]=r>>16&255,o[f++]=r>>8&255,o[f++]=255&r;2===n&&(r=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,o[f++]=255&r);1===n&&(r=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,o[f++]=r>>8&255,o[f++]=255&r);return o},e.fromByteArray=function(t){for(var r,e=t.length,n=e%3,i=[],o=0,f=e-n;o<f;o+=16383)i.push(function(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(function(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}(n));return i.join("")}(t,o,f<o+16383?f:o+16383));1==n?(r=t[e-1],i.push(u[r>>2]+u[r<<4&63]+"==")):2==n&&(r=(t[e-2]<<8)+t[e-1],i.push(u[r>>10]+u[r>>4&63]+u[r<<2&63]+"="));return i.join("")};for(var u=[],a=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i<o;++i)u[i]=n[i],a[n.charCodeAt(i)]=i;function c(t){var r=t.length;if(0<r%4)throw new Error("Invalid string. Length must be a multiple of 4");t=t.indexOf("="),r=(t=-1===t?r:t)===r?0:4-t%4;return[t,r]}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],30:[function(S,t,I){!function(t,Buffer){!function(){var B=S("base64-js"),o=S("ieee754"),u=S("isarray");function e(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,r){if(e()<r)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=Buffer.prototype:(t=null===t?new Buffer(r):t).length=r,t}function Buffer(t,r,e){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(t,r,e);if("number"!=typeof t)return n(this,t,r,e);if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}function n(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer){var i=t,o=r,f=e;if(o.byteLength,f<0||o.byteLength<f)throw new RangeError("'offset' is out of bounds");if(o.byteLength<f+(n||0))throw new RangeError("'length' is out of bounds");return o=void 0===f&&void 0===n?new Uint8Array(o):void 0===n?new Uint8Array(o,f):new Uint8Array(o,f,n),Buffer.TYPED_ARRAY_SUPPORT?(i=o).__proto__=Buffer.prototype:i=s(i,o),i}if("string"!=typeof r){f=t,n=r;if(Buffer.isBuffer(n))return o=0|c(n.length),0!==(f=a(f,o)).length&&n.copy(f,0,0,o),f;if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||function(t){return t!=t}(n.length)?a(f,0):s(f,n);if("Buffer"===n.type&&u(n.data))return s(f,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}i=t,n=r,t=e;if(Buffer.isEncoding(t="string"==typeof t&&""!==t?t:"utf8"))return r=0|h(n,t),i=(n=(i=a(i,r)).write(n,t))!==r?i.slice(0,n):i;throw new TypeError('"encoding" must be a valid string encoding')}function i(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,r){if(i(r),t=a(t,r<0?0:0|c(r)),!Buffer.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function s(t,r){var e=r.length<0?0:0|c(r.length);t=a(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function c(t){if(e()<=t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|t}function h(t,r){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;var e=(t="string"!=typeof t?""+t:t).length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return _(t).length;default:if(n)return k(t).length;r=(""+r).toLowerCase(),n=!0}}function r(t,r,e){var n,i=!1;if((r=void 0===r||r<0?0:r)>this.length)return"";if((e=void 0===e||e>this.length?this.length:e)<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":var o=this,f=r,u=e,a=o.length;(!u||u<0||a<u)&&(u=a);for(var s="",c=f=!f||f<0?0:f;c<u;++c)s+=function(t){return t<16?"0"+t.toString(16):t.toString(16)}(o[c]);return s;case"utf8":case"utf-8":return U(this,r,e);case"ascii":var h=this,a=r,l=e,p="";l=Math.min(h.length,l);for(var d=a;d<l;++d)p+=String.fromCharCode(127&h[d]);return p;case"latin1":case"binary":var y=this,f=r,g=e,b="";g=Math.min(y.length,g);for(var w=f;w<g;++w)b+=String.fromCharCode(y[w]);return b;case"base64":return v=this,n=e,0===(E=r)&&n===v.length?B.fromByteArray(v):B.fromByteArray(v.slice(E,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var v=r,E=e,A=this.slice(v,E),m="",x=0;x<A.length;x+=2)m+=String.fromCharCode(A[x]+256*A[x+1]);return m;default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function l(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function p(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):2147483647<e?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,(e=(e=isNaN(e)?i?0:t.length-1:e)<0?t.length+e:e)>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=Buffer.from(r,n)),Buffer.isBuffer(r))return 0===r.length?-1:d(t,r,e,n,i);if("number"==typeof r)return r&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(t,r,e):d(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function d(t,r,e,n,i){var o=1,f=t.length,u=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;f/=o=2,u/=2,e/=2}function a(t,r){return 1===o?t[r]:t.readUInt16BE(r*o)}if(i)for(var s=-1,c=e;c<f;c++)if(a(t,c)===a(r,-1===s?0:c-s)){if(c-(s=-1===s?c:s)+1===u)return s*o}else-1!==s&&(c-=c-s),s=-1;else for(c=e=f<e+u?f-u:e;0<=c;c--){for(var h=!0,l=0;l<u;l++)if(a(t,c+l)!==a(r,l)){h=!1;break}if(h)return c}return-1}function g(t,r,e,n){return T(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function b(t,r,e,n){return T(function(t,r){for(var e,n,i=[],o=0;o<t.length&&!((r-=2)<0);++o)e=t.charCodeAt(o),n=e>>8,i.push(e%256),i.push(n);return i}(r,t.length-e),t,e,n)}function U(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,f,u,a,s=t[i],c=null,h=239<s?4:223<s?3:191<s?2:1;if(i+h<=e)switch(h){case 1:s<128&&(c=s);break;case 2:128==(192&(o=t[i+1]))&&127<(a=(31&s)<<6|63&o)&&(c=a);break;case 3:o=t[i+1],f=t[i+2],128==(192&o)&&128==(192&f)&&2047<(a=(15&s)<<12|(63&o)<<6|63&f)&&(a<55296||57343<a)&&(c=a);break;case 4:o=t[i+1],f=t[i+2],u=t[i+3],128==(192&o)&&128==(192&f)&&128==(192&u)&&65535<(a=(15&s)<<18|(63&o)<<12|(63&f)<<6|63&u)&&a<1114112&&(c=a)}null===c?(c=65533,h=1):65535<c&&(n.push((c-=65536)>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}var l=n,p=l.length;if(p<=w)return String.fromCharCode.apply(String,l);for(var d="",y=0;y<p;)d+=String.fromCharCode.apply(String,l.slice(y,y+=w));return d}I.Buffer=Buffer,I.SlowBuffer=function(t){+t!=t&&(t=0);return Buffer.alloc(+t)},I.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),I.kMaxLength=e(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,r,e){return n(null,t,r,e)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol)&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0}),Buffer.alloc=function(t,r,e){return n=null,r=r,e=e,i(t=t),!(t<=0)&&void 0!==r?"string"==typeof e?a(n,t).fill(r,e):a(n,t).fill(r):a(n,t);var n},Buffer.allocUnsafe=function(t){return f(null,t)},Buffer.allocUnsafeSlow=function(t){return f(null,t)},Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,r){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},Buffer.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(t,r){if(!u(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);if(void 0===r)for(i=r=0;i<t.length;++i)r+=t[i].length;for(var e=Buffer.allocUnsafe(r),n=0,i=0;i<t.length;++i){var o=t[i];if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(e,n),n+=o.length}return e},Buffer.byteLength=h,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)l(this,r,r+1);return this},Buffer.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)l(this,r,r+3),l(this,r+1,r+2);return this},Buffer.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)l(this,r,r+7),l(this,r+1,r+6),l(this,r+2,r+5),l(this,r+3,r+4);return this},Buffer.prototype.toString=function(){var t=0|this.length;return 0==t?"":0===arguments.length?U(this,0,t):r.apply(this,arguments)},Buffer.prototype.equals=function(t){if(Buffer.isBuffer(t))return this===t||0===Buffer.compare(this,t);throw new TypeError("Argument must be a Buffer")},Buffer.prototype.inspect=function(){var t="",r=I.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r)&&(t+=" ... "),"<Buffer "+t+">"},Buffer.prototype.compare=function(t,r,e,n,i){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),(r=void 0===r?0:r)<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&e<=r)return 0;if(i<=n)return-1;if(e<=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),f=(e>>>=0)-(r>>>=0),u=Math.min(o,f),a=this.slice(n,i),s=t.slice(r,e),c=0;c<u;++c)if(a[c]!==s[c]){o=a[c],f=s[c];break}return o<f?-1:f<o?1:0},Buffer.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},Buffer.prototype.indexOf=function(t,r,e){return p(this,t,r,e,!0)},Buffer.prototype.lastIndexOf=function(t,r,e){return p(this,t,r,e,!1)},Buffer.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||i<e)&&(e=i),0<t.length&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var o,f,u,a=!1;;)switch(n){case"hex":var s=this,c=t,h=r,l=e,p=(h=Number(h)||0,s.length-h);if((!l||p<(l=Number(l)))&&(l=p),(p=c.length)%2!=0)throw new TypeError("Invalid hex string");p/2<l&&(l=p/2);for(var d=0;d<l;++d){var y=parseInt(c.substr(2*d,2),16);if(isNaN(y))return d;s[h+d]=y}return d;case"utf8":case"utf-8":return p=r,u=e,T(k(t,(f=this).length-p),f,p,u);case"ascii":return g(this,t,r,e);case"latin1":case"binary":return g(this,t,r,e);case"base64":return f=this,u=r,o=e,T(_(t),f,u,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,r,e);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function y(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(e<t+r)throw new RangeError("Trying to access beyond buffer length")}function v(t,r,e,n,i,o){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<r||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function E(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function A(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function m(t,r,e,n){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function x(t,r,e,n,i){return i||m(t,0,e,4),o.write(t,r,e,n,23,4),e+4}function R(t,r,e,n,i){return i||m(t,0,e,8),o.write(t,r,e,n,52,8),e+8}Buffer.prototype.slice=function(t,r){var e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):e<t&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):e<r&&(r=e),r<t&&(r=t),Buffer.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,r)).__proto__=Buffer.prototype;else for(var n=r-t,i=new Buffer(n,void 0),o=0;o<n;++o)i[o]=this[o+t];return i},Buffer.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||y(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},Buffer.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||y(t,r,this.length);for(var n=this[t+--r],i=1;0<r&&(i*=256);)n+=this[t+--r]*i;return n},Buffer.prototype.readUInt8=function(t,r){return r||y(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,r){return r||y(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,r){return r||y(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,r){return r||y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,r){return r||y(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||y(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return(i*=128)<=n&&(n-=Math.pow(2,8*r)),n},Buffer.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||y(t,r,this.length);for(var n=r,i=1,o=this[t+--n];0<n&&(i*=256);)o+=this[t+--n]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*r)),o},Buffer.prototype.readInt8=function(t,r){return r||y(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function(t,r){r||y(t,2,this.length);r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(t,r){r||y(t,2,this.length);r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(t,r){return r||y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,r){return r||y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,r){return r||y(t,4,this.length),o.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,r){return r||y(t,4,this.length),o.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,r){return r||y(t,8,this.length),o.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,r){return r||y(t,8,this.length),o.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function(t,r,e,n){t=+t,r|=0,e|=0,n||v(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},Buffer.prototype.writeUIntBE=function(t,r,e,n){t=+t,r|=0,e|=0,n||v(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;0<=--i&&(o*=256);)this[r+i]=t/o&255;return r+e},Buffer.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},Buffer.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):E(this,t,r,!0),r+2},Buffer.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):E(this,t,r,!1),r+2},Buffer.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):A(this,t,r,!0),r+4},Buffer.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):A(this,t,r,!1),r+4},Buffer.prototype.writeIntLE=function(t,r,e,n){t=+t,r|=0,n||v(this,t,r,e,(n=Math.pow(2,8*e-1))-1,-n);var i=0,o=1,f=0;for(this[r]=255&t;++i<e&&(o*=256);)t<0&&0===f&&0!==this[r+i-1]&&(f=1),this[r+i]=(t/o>>0)-f&255;return r+e},Buffer.prototype.writeIntBE=function(t,r,e,n){t=+t,r|=0,n||v(this,t,r,e,(n=Math.pow(2,8*e-1))-1,-n);var i=e-1,o=1,f=0;for(this[r+i]=255&t;0<=--i&&(o*=256);)t<0&&0===f&&0!==this[r+i+1]&&(f=1),this[r+i]=(t/o>>0)-f&255;return r+e},Buffer.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&(t=t<0?255+t+1:t),r+1},Buffer.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):E(this,t,r,!0),r+2},Buffer.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):E(this,t,r,!1),r+2},Buffer.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):A(this,t,r,!0),r+4},Buffer.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||v(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):A(this,t,r,!1),r+4},Buffer.prototype.writeFloatLE=function(t,r,e){return x(this,t,r,!0,e)},Buffer.prototype.writeFloatBE=function(t,r,e){return x(this,t,r,!1,e)},Buffer.prototype.writeDoubleLE=function(t,r,e){return R(this,t,r,!0,e)},Buffer.prototype.writeDoubleBE=function(t,r,e){return R(this,t,r,!1,e)},Buffer.prototype.copy=function(t,r,e,n){if(e=e||0,n||0===n||(n=this.length),r>=t.length&&(r=t.length),(n=0<n&&n<e?e:n)===e)return 0;if(0===t.length||0===this.length)return 0;if((r=r||0)<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var i,o=(n=t.length-r<n-e?t.length-r+e:n)-e;if(this===t&&e<r&&r<n)for(i=o-1;0<=i;--i)t[i+r]=this[i+e];else if(o<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},Buffer.prototype.fill=function(t,r,e,n){if("string"==typeof t){var i;if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length&&(i=t.charCodeAt(0))<256&&(t=i),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Buffer.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(!(e<=r))if(r>>>=0,e=void 0===e?this.length:e>>>0,"number"==typeof(t=t||0))for(u=r;u<e;++u)this[u]=t;else for(var o=Buffer.isBuffer(t)?t:k(new Buffer(t,n).toString()),f=o.length,u=0;u<e-r;++u)this[u+r]=o[u%f];return this};var P=/[^+\/0-9A-Za-z-_]/g;function k(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],f=0;f<n;++f){if(55295<(e=t.charCodeAt(f))&&e<57344){if(!i){if(56319<e){-1<(r-=3)&&o.push(239,191,189);continue}if(f+1===n){-1<(r-=3)&&o.push(239,191,189);continue}i=e;continue}if(e<56320){-1<(r-=3)&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&-1<(r-=3)&&o.push(239,191,189);if(i=null,e<128){if(--r<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function _(t){return B.toByteArray(function(t){var r;if((t=((r=t).trim?r.trim():r.replace(/^\s+|\s+$/g,"")).replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function T(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},S("buffer").Buffer)},{"base64-js":29,buffer:30,ieee754:33,isarray:31}],31:[function(t,r,e){var n={}.toString;r.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],32:[function(t,r,e){function n(t){for(var r in a)t[r]=a[r];return t}function i(t,r){var e,n=this;if(arguments.length){if(r){if(e=o(n,t,!0)){if(!(e=e.filter(function(t){return t!==r&&t.originalListener!==r})).length)return i.call(n,t);n[u][t]=e}}else if((e=n[u])&&(delete e[t],!Object.keys(e).length))return i.call(n)}else delete n[u];return n}function o(t,r,e){if(!e||t[u])return(e=t[u]||(t[u]={}))[r]||(e[r]=[])}var f,u,a;f=function t(){if(!(this instanceof t))return new t},void 0!==r&&(r.exports=f),u="listeners",a={on:function(t,r){return o(this,t).push(r),this},once:function(t,r){var e=this;return n.originalListener=r,o(e,t).push(n),e;function n(){i.call(e,t,n),r.apply(this,arguments)}},off:i,emit:function(t,r){var e=this,t=o(e,t,!0);if(!t)return!1;var n=arguments.length;{var i;1===n?t.forEach(function(t){t.call(e)}):2===n?t.forEach(function(t){t.call(e,r)}):(i=Array.prototype.slice.call(arguments,1),t.forEach(function(t){t.apply(e,i)}))}return!!t.length}},n(f.prototype),f.mixin=n},{}],33:[function(t,r,e){e.read=function(t,r,e,n,i){var o,f,u=8*i-n-1,a=(1<<u)-1,s=a>>1,c=-7,h=e?i-1:0,l=e?-1:1,i=t[r+h];for(h+=l,o=i&(1<<-c)-1,i>>=-c,c+=u;0<c;o=256*o+t[r+h],h+=l,c-=8);for(f=o&(1<<-c)-1,o>>=-c,c+=n;0<c;f=256*f+t[r+h],h+=l,c-=8);if(0===o)o=1-s;else{if(o===a)return f?NaN:1/0*(i?-1:1);f+=Math.pow(2,n),o-=s}return(i?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,r,e,n,i,o){var f,u,a=8*o-i-1,s=(1<<a)-1,c=s>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,o=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,f=s):(f=Math.floor(Math.log(r)/Math.LN2),r*(n=Math.pow(2,-f))<1&&(f--,n*=2),2<=(r+=1<=f+c?h/n:h*Math.pow(2,1-c))*n&&(f++,n/=2),s<=f+c?(u=0,f=s):1<=f+c?(u=(r*n-1)*Math.pow(2,i),f+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,i),f=0));8<=i;t[e+l]=255&u,l+=p,u/=256,i-=8);for(f=f<<i|u,a+=i;0<a;t[e+l]=255&f,l+=p,f/=256,a-=8);t[e+l-p]|=128*o}},{}],34:[function(t,r,e){!function(Buffer){!function(){var h,v,E,A,m,x,B,n,U;function t(t,r,u){var p=r?0:4,d=r?4:0,n=r?0:3,i=r?1:2,o=r?2:1,f=r?3:0,y=r?S:Y,g=r?I:C,r=b.prototype,e="is"+t,a="_"+e;return r.buffer=void 0,r.offset=0,r[a]=!0,r.toNumber=s,r.toString=function(t){var r=this.buffer,e=this.offset,n=c(r,e+p),i=c(r,e+d),o="",r=!u&&2147483648&n;r&&(n=~n,i=U-i);t=t||10;for(;;){var f=n%t*U+i;if(n=Math.floor(n/t),i=Math.floor(f/t),o=(f%t).toString(t)+o,!n&&!i)break}r&&(o="-"+o);return o},r.toJSON=s,r.toArray=l,A&&(r.toBuffer=R),m&&(r.toArrayBuffer=P),b[e]=function(t){return!(!t||!t[a])},h[t]=b;function b(t,r,e,n){if(!(this instanceof b))return new b(t,r,e,n);var i=this;if(m&&x&&(t instanceof x&&(t=new m(t)),e instanceof x)&&(e=new m(e)),t||r||e||v){if(k(t,r)||(o=v||Array,n=r,e=t,r=0,t=v===A?A.alloc(8):new o(8)),i.buffer=t,i.offset=r|=0,E!=typeof e)if("string"!=typeof e)k(e,n)?_(t,r,e,n):"number"==typeof n?(w(t,r+p,e),w(t,r+d,n)):0<e?y(t,r,e):e<0?g(t,r,e):_(t,r,B,0);else{for(var o=t,t=r,f=e,u=n||10,a=0,s=f.length,c=0,h=0,r=("-"===f[0]&&a++,a);a<s;){var l=parseInt(f[a++],u);if(!(0<=l))break;h=h*u+l,c=c*u+Math.floor(h/U),h%=U}r&&(c=~c,h?h=U-h:c++),w(o,t+p,c),w(o,t+d,h)}}else i.buffer=T(B,0)}function s(){var t=this.buffer,r=this.offset,e=c(t,r+p),t=c(t,r+d);return u||(e|=0),e?e*U+t:t}function w(t,r,e){t[r+f]=255&e,t[r+o]=255&(e>>=8),t[r+i]=255&(e>>=8),t[r+n]=255&(e>>=8)}function c(t,r){return 16777216*t[r+n]+(t[r+i]<<16)+(t[r+o]<<8)+t[r+f]}}function l(t){var r=this.buffer,e=this.offset;return v=null,!1!==t&&n(r)?8===r.length?r:r.slice(e,e+8):T(r,e)}function R(t){var r=this.buffer,e=this.offset;return v=A,!1!==t&&A.isBuffer(r)?8===r.length?r:r.slice(e,e+8):A.from(P.call(this,t))}function P(t){var r=this.buffer,e=this.offset,n=r.buffer;return v=m,!1!==t&&!r.offset&&n instanceof x?8===n.byteLength?n:n.slice(e,e+8):(_(t=new m(8),0,r,e),t.buffer)}function k(t,r){var e=t&&t.length;return r|=0,e&&r+8<=e&&"string"!=typeof t[r]}function _(t,r,e,n){r|=0,n|=0;for(var i=0;i<8;i++)t[r++]=255&e[n++]}function T(t,r){return Array.prototype.slice.call(t,r,r+8)}function S(t,r,e){for(var n=r+8;r<n;)t[--n]=255&e,e/=256}function I(t,r,e){var n=r+8;for(e++;r<n;)t[--n]=255&-e^255,e/=256}function Y(t,r,e){for(var n=r+8;r<n;)t[r++]=255&e,e/=256}function C(t,r,e){var n=r+8;for(e++;r<n;)t[r++]=255&-e^255,e/=256}h="object"==typeof e&&"string"!=typeof e.nodeName?e:this||{},A=(E="undefined")!=typeof Buffer&&Buffer,m=E!=typeof Uint8Array&&Uint8Array,x=E!=typeof ArrayBuffer&&ArrayBuffer,B=[0,0,0,0,0,0,0,0],n=Array.isArray||function(t){return!!t&&"[object Array]"==Object.prototype.toString.call(t)},U=4294967296,t("Uint64BE",!0,!0),t("Int64BE",!0,!1),t("Uint64LE",!1,!0),t("Int64LE",!1,!1)}.call(this)}.call(this,t("buffer").Buffer)},{buffer:30}],35:[function(t,r,e){arguments[4][31][0].apply(e,arguments)},{dup:31}]},{},[1])(1)});
|
package/lib/read-format.js
CHANGED
|
@@ -13,6 +13,7 @@ var BufferProto = require("./bufferish-proto");
|
|
|
13
13
|
|
|
14
14
|
var HAS_MAP = ("undefined" !== typeof Map);
|
|
15
15
|
var NO_ASSERT = true;
|
|
16
|
+
var BUFFER_SHORTAGE = "BUFFER_SHORTAGE";
|
|
16
17
|
|
|
17
18
|
function getReadFormat(options) {
|
|
18
19
|
var binarraybuffer = Bufferish.hasArrayBuffer && options && options.binarraybuffer;
|
|
@@ -40,7 +41,14 @@ function getReadFormat(options) {
|
|
|
40
41
|
return readFormat;
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
// every element takes at least one byte, so a count beyond the remaining buffer
|
|
45
|
+
// can never be satisfied -- bail before pre-allocating an attacker-sized array
|
|
46
|
+
function checkLength(decoder, len) {
|
|
47
|
+
if (len > decoder.buffer.length - decoder.offset) throw new Error(BUFFER_SHORTAGE);
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
function map_to_obj(decoder, len) {
|
|
51
|
+
checkLength(decoder, 2 * len);
|
|
44
52
|
var value = {};
|
|
45
53
|
var i;
|
|
46
54
|
var k = new Array(len);
|
|
@@ -58,6 +66,7 @@ function map_to_obj(decoder, len) {
|
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
function map_to_map(decoder, len) {
|
|
69
|
+
checkLength(decoder, 2 * len);
|
|
61
70
|
var value = new Map();
|
|
62
71
|
var i;
|
|
63
72
|
var k = new Array(len);
|
|
@@ -75,6 +84,7 @@ function map_to_map(decoder, len) {
|
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
function array(decoder, len) {
|
|
87
|
+
checkLength(decoder, len);
|
|
78
88
|
var value = new Array(len);
|
|
79
89
|
var decode = decoder.codec.decode;
|
|
80
90
|
for (var i = 0; i < len; i++) {
|
package/lib/write-type.js
CHANGED
|
@@ -55,6 +55,11 @@ function getWriteType(options) {
|
|
|
55
55
|
var ivalue = value | 0;
|
|
56
56
|
var type;
|
|
57
57
|
if (value !== ivalue) {
|
|
58
|
+
// uint 32 -- 0xce (above the int32 range that "| 0" can represent)
|
|
59
|
+
if (0 <= value && value <= 0xFFFFFFFF && Math.floor(value) === value) {
|
|
60
|
+
token[0xce](encoder, value);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
58
63
|
// float 64 -- 0xcb
|
|
59
64
|
type = 0xcb;
|
|
60
65
|
token[type](encoder, value);
|