@leofcoin/chain 1.6.1 → 1.6.2

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.
@@ -10,10 +10,7 @@ function getAugmentedNamespace(n) {
10
10
  if (typeof f == "function") {
11
11
  var a = function a () {
12
12
  if (this instanceof a) {
13
- var args = [null];
14
- args.push.apply(args, arguments);
15
- var Ctor = Function.bind.apply(f, args);
16
- return new Ctor();
13
+ return Reflect.construct(f, arguments, this.constructor);
17
14
  }
18
15
  return f.apply(this, arguments);
19
16
  };
@@ -34,2004 +31,14 @@ function getAugmentedNamespace(n) {
34
31
 
35
32
  var bn = {exports: {}};
36
33
 
37
- var global$1 = (typeof global !== "undefined" ? global :
38
- typeof self !== "undefined" ? self :
39
- typeof window !== "undefined" ? window : {});
34
+ var _nodeResolve_empty = {};
40
35
 
41
- var lookup = [];
42
- var revLookup = [];
43
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
44
- var inited = false;
45
- function init () {
46
- inited = true;
47
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
48
- for (var i = 0, len = code.length; i < len; ++i) {
49
- lookup[i] = code[i];
50
- revLookup[code.charCodeAt(i)] = i;
51
- }
52
-
53
- revLookup['-'.charCodeAt(0)] = 62;
54
- revLookup['_'.charCodeAt(0)] = 63;
55
- }
56
-
57
- function toByteArray (b64) {
58
- if (!inited) {
59
- init();
60
- }
61
- var i, j, l, tmp, placeHolders, arr;
62
- var len = b64.length;
63
-
64
- if (len % 4 > 0) {
65
- throw new Error('Invalid string. Length must be a multiple of 4')
66
- }
67
-
68
- // the number of equal signs (place holders)
69
- // if there are two placeholders, than the two characters before it
70
- // represent one byte
71
- // if there is only one, then the three characters before it represent 2 bytes
72
- // this is just a cheap hack to not do indexOf twice
73
- placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
74
-
75
- // base64 is 4/3 + up to two characters of the original data
76
- arr = new Arr(len * 3 / 4 - placeHolders);
77
-
78
- // if there are placeholders, only get up to the last complete 4 chars
79
- l = placeHolders > 0 ? len - 4 : len;
80
-
81
- var L = 0;
82
-
83
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
84
- tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
85
- arr[L++] = (tmp >> 16) & 0xFF;
86
- arr[L++] = (tmp >> 8) & 0xFF;
87
- arr[L++] = tmp & 0xFF;
88
- }
89
-
90
- if (placeHolders === 2) {
91
- tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
92
- arr[L++] = tmp & 0xFF;
93
- } else if (placeHolders === 1) {
94
- tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
95
- arr[L++] = (tmp >> 8) & 0xFF;
96
- arr[L++] = tmp & 0xFF;
97
- }
98
-
99
- return arr
100
- }
101
-
102
- function tripletToBase64 (num) {
103
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
104
- }
105
-
106
- function encodeChunk (uint8, start, end) {
107
- var tmp;
108
- var output = [];
109
- for (var i = start; i < end; i += 3) {
110
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
111
- output.push(tripletToBase64(tmp));
112
- }
113
- return output.join('')
114
- }
115
-
116
- function fromByteArray (uint8) {
117
- if (!inited) {
118
- init();
119
- }
120
- var tmp;
121
- var len = uint8.length;
122
- var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
123
- var output = '';
124
- var parts = [];
125
- var maxChunkLength = 16383; // must be multiple of 3
126
-
127
- // go through the array every three bytes, we'll deal with trailing stuff later
128
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
129
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
130
- }
131
-
132
- // pad the end with zeros, but make sure to not forget the extra bytes
133
- if (extraBytes === 1) {
134
- tmp = uint8[len - 1];
135
- output += lookup[tmp >> 2];
136
- output += lookup[(tmp << 4) & 0x3F];
137
- output += '==';
138
- } else if (extraBytes === 2) {
139
- tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
140
- output += lookup[tmp >> 10];
141
- output += lookup[(tmp >> 4) & 0x3F];
142
- output += lookup[(tmp << 2) & 0x3F];
143
- output += '=';
144
- }
145
-
146
- parts.push(output);
147
-
148
- return parts.join('')
149
- }
150
-
151
- function read (buffer, offset, isLE, mLen, nBytes) {
152
- var e, m;
153
- var eLen = nBytes * 8 - mLen - 1;
154
- var eMax = (1 << eLen) - 1;
155
- var eBias = eMax >> 1;
156
- var nBits = -7;
157
- var i = isLE ? (nBytes - 1) : 0;
158
- var d = isLE ? -1 : 1;
159
- var s = buffer[offset + i];
160
-
161
- i += d;
162
-
163
- e = s & ((1 << (-nBits)) - 1);
164
- s >>= (-nBits);
165
- nBits += eLen;
166
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
167
-
168
- m = e & ((1 << (-nBits)) - 1);
169
- e >>= (-nBits);
170
- nBits += mLen;
171
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
172
-
173
- if (e === 0) {
174
- e = 1 - eBias;
175
- } else if (e === eMax) {
176
- return m ? NaN : ((s ? -1 : 1) * Infinity)
177
- } else {
178
- m = m + Math.pow(2, mLen);
179
- e = e - eBias;
180
- }
181
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
182
- }
183
-
184
- function write (buffer, value, offset, isLE, mLen, nBytes) {
185
- var e, m, c;
186
- var eLen = nBytes * 8 - mLen - 1;
187
- var eMax = (1 << eLen) - 1;
188
- var eBias = eMax >> 1;
189
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
190
- var i = isLE ? 0 : (nBytes - 1);
191
- var d = isLE ? 1 : -1;
192
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
193
-
194
- value = Math.abs(value);
195
-
196
- if (isNaN(value) || value === Infinity) {
197
- m = isNaN(value) ? 1 : 0;
198
- e = eMax;
199
- } else {
200
- e = Math.floor(Math.log(value) / Math.LN2);
201
- if (value * (c = Math.pow(2, -e)) < 1) {
202
- e--;
203
- c *= 2;
204
- }
205
- if (e + eBias >= 1) {
206
- value += rt / c;
207
- } else {
208
- value += rt * Math.pow(2, 1 - eBias);
209
- }
210
- if (value * c >= 2) {
211
- e++;
212
- c /= 2;
213
- }
214
-
215
- if (e + eBias >= eMax) {
216
- m = 0;
217
- e = eMax;
218
- } else if (e + eBias >= 1) {
219
- m = (value * c - 1) * Math.pow(2, mLen);
220
- e = e + eBias;
221
- } else {
222
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
223
- e = 0;
224
- }
225
- }
226
-
227
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
228
-
229
- e = (e << mLen) | m;
230
- eLen += mLen;
231
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
232
-
233
- buffer[offset + i - d] |= s * 128;
234
- }
235
-
236
- var toString$4 = {}.toString;
237
-
238
- var isArray = Array.isArray || function (arr) {
239
- return toString$4.call(arr) == '[object Array]';
240
- };
241
-
242
- /*!
243
- * The buffer module from node.js, for the browser.
244
- *
245
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
246
- * @license MIT
247
- */
248
- /* eslint-disable no-proto */
249
-
250
-
251
- var INSPECT_MAX_BYTES = 50;
252
-
253
- /**
254
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
255
- * === true Use Uint8Array implementation (fastest)
256
- * === false Use Object implementation (most compatible, even IE6)
257
- *
258
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
259
- * Opera 11.6+, iOS 4.2+.
260
- *
261
- * Due to various browser bugs, sometimes the Object implementation will be used even
262
- * when the browser supports typed arrays.
263
- *
264
- * Note:
265
- *
266
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
267
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
268
- *
269
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
270
- *
271
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
272
- * incorrect length in some situations.
273
-
274
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
275
- * get the Object implementation, which is slower but behaves correctly.
276
- */
277
- Buffer$1.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
278
- ? global$1.TYPED_ARRAY_SUPPORT
279
- : true;
280
-
281
- /*
282
- * Export kMaxLength after typed array support is determined.
283
- */
284
- var _kMaxLength = kMaxLength();
285
-
286
- function kMaxLength () {
287
- return Buffer$1.TYPED_ARRAY_SUPPORT
288
- ? 0x7fffffff
289
- : 0x3fffffff
290
- }
291
-
292
- function createBuffer (that, length) {
293
- if (kMaxLength() < length) {
294
- throw new RangeError('Invalid typed array length')
295
- }
296
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
297
- // Return an augmented `Uint8Array` instance, for best performance
298
- that = new Uint8Array(length);
299
- that.__proto__ = Buffer$1.prototype;
300
- } else {
301
- // Fallback: Return an object instance of the Buffer class
302
- if (that === null) {
303
- that = new Buffer$1(length);
304
- }
305
- that.length = length;
306
- }
307
-
308
- return that
309
- }
310
-
311
- /**
312
- * The Buffer constructor returns instances of `Uint8Array` that have their
313
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
314
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
315
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
316
- * returns a single octet.
317
- *
318
- * The `Uint8Array` prototype remains unmodified.
319
- */
320
-
321
- function Buffer$1 (arg, encodingOrOffset, length) {
322
- if (!Buffer$1.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$1)) {
323
- return new Buffer$1(arg, encodingOrOffset, length)
324
- }
325
-
326
- // Common case.
327
- if (typeof arg === 'number') {
328
- if (typeof encodingOrOffset === 'string') {
329
- throw new Error(
330
- 'If encoding is specified then the first argument must be a string'
331
- )
332
- }
333
- return allocUnsafe(this, arg)
334
- }
335
- return from(this, arg, encodingOrOffset, length)
336
- }
337
-
338
- Buffer$1.poolSize = 8192; // not used by this implementation
339
-
340
- // TODO: Legacy, not needed anymore. Remove in next major version.
341
- Buffer$1._augment = function (arr) {
342
- arr.__proto__ = Buffer$1.prototype;
343
- return arr
344
- };
345
-
346
- function from (that, value, encodingOrOffset, length) {
347
- if (typeof value === 'number') {
348
- throw new TypeError('"value" argument must not be a number')
349
- }
350
-
351
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
352
- return fromArrayBuffer(that, value, encodingOrOffset, length)
353
- }
354
-
355
- if (typeof value === 'string') {
356
- return fromString$2(that, value, encodingOrOffset)
357
- }
358
-
359
- return fromObject$1(that, value)
360
- }
361
-
362
- /**
363
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
364
- * if value is a number.
365
- * Buffer.from(str[, encoding])
366
- * Buffer.from(array)
367
- * Buffer.from(buffer)
368
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
369
- **/
370
- Buffer$1.from = function (value, encodingOrOffset, length) {
371
- return from(null, value, encodingOrOffset, length)
372
- };
373
-
374
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
375
- Buffer$1.prototype.__proto__ = Uint8Array.prototype;
376
- Buffer$1.__proto__ = Uint8Array;
377
- if (typeof Symbol !== 'undefined' && Symbol.species &&
378
- Buffer$1[Symbol.species] === Buffer$1) ;
379
- }
380
-
381
- function assertSize (size) {
382
- if (typeof size !== 'number') {
383
- throw new TypeError('"size" argument must be a number')
384
- } else if (size < 0) {
385
- throw new RangeError('"size" argument must not be negative')
386
- }
387
- }
388
-
389
- function alloc (that, size, fill, encoding) {
390
- assertSize(size);
391
- if (size <= 0) {
392
- return createBuffer(that, size)
393
- }
394
- if (fill !== undefined) {
395
- // Only pay attention to encoding if it's a string. This
396
- // prevents accidentally sending in a number that would
397
- // be interpretted as a start offset.
398
- return typeof encoding === 'string'
399
- ? createBuffer(that, size).fill(fill, encoding)
400
- : createBuffer(that, size).fill(fill)
401
- }
402
- return createBuffer(that, size)
403
- }
404
-
405
- /**
406
- * Creates a new filled Buffer instance.
407
- * alloc(size[, fill[, encoding]])
408
- **/
409
- Buffer$1.alloc = function (size, fill, encoding) {
410
- return alloc(null, size, fill, encoding)
411
- };
412
-
413
- function allocUnsafe (that, size) {
414
- assertSize(size);
415
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
416
- if (!Buffer$1.TYPED_ARRAY_SUPPORT) {
417
- for (var i = 0; i < size; ++i) {
418
- that[i] = 0;
419
- }
420
- }
421
- return that
422
- }
423
-
424
- /**
425
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
426
- * */
427
- Buffer$1.allocUnsafe = function (size) {
428
- return allocUnsafe(null, size)
429
- };
430
- /**
431
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
432
- */
433
- Buffer$1.allocUnsafeSlow = function (size) {
434
- return allocUnsafe(null, size)
435
- };
436
-
437
- function fromString$2 (that, string, encoding) {
438
- if (typeof encoding !== 'string' || encoding === '') {
439
- encoding = 'utf8';
440
- }
441
-
442
- if (!Buffer$1.isEncoding(encoding)) {
443
- throw new TypeError('"encoding" must be a valid string encoding')
444
- }
445
-
446
- var length = byteLength(string, encoding) | 0;
447
- that = createBuffer(that, length);
448
-
449
- var actual = that.write(string, encoding);
450
-
451
- if (actual !== length) {
452
- // Writing a hex string, for example, that contains invalid characters will
453
- // cause everything after the first invalid character to be ignored. (e.g.
454
- // 'abxxcd' will be treated as 'ab')
455
- that = that.slice(0, actual);
456
- }
457
-
458
- return that
459
- }
460
-
461
- function fromArrayLike$1 (that, array) {
462
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
463
- that = createBuffer(that, length);
464
- for (var i = 0; i < length; i += 1) {
465
- that[i] = array[i] & 255;
466
- }
467
- return that
468
- }
469
-
470
- function fromArrayBuffer (that, array, byteOffset, length) {
471
- array.byteLength; // this throws if `array` is not a valid ArrayBuffer
472
-
473
- if (byteOffset < 0 || array.byteLength < byteOffset) {
474
- throw new RangeError('\'offset\' is out of bounds')
475
- }
476
-
477
- if (array.byteLength < byteOffset + (length || 0)) {
478
- throw new RangeError('\'length\' is out of bounds')
479
- }
480
-
481
- if (byteOffset === undefined && length === undefined) {
482
- array = new Uint8Array(array);
483
- } else if (length === undefined) {
484
- array = new Uint8Array(array, byteOffset);
485
- } else {
486
- array = new Uint8Array(array, byteOffset, length);
487
- }
488
-
489
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
490
- // Return an augmented `Uint8Array` instance, for best performance
491
- that = array;
492
- that.__proto__ = Buffer$1.prototype;
493
- } else {
494
- // Fallback: Return an object instance of the Buffer class
495
- that = fromArrayLike$1(that, array);
496
- }
497
- return that
498
- }
499
-
500
- function fromObject$1 (that, obj) {
501
- if (internalIsBuffer(obj)) {
502
- var len = checked(obj.length) | 0;
503
- that = createBuffer(that, len);
504
-
505
- if (that.length === 0) {
506
- return that
507
- }
508
-
509
- obj.copy(that, 0, 0, len);
510
- return that
511
- }
512
-
513
- if (obj) {
514
- if ((typeof ArrayBuffer !== 'undefined' &&
515
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
516
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
517
- return createBuffer(that, 0)
518
- }
519
- return fromArrayLike$1(that, obj)
520
- }
521
-
522
- if (obj.type === 'Buffer' && isArray(obj.data)) {
523
- return fromArrayLike$1(that, obj.data)
524
- }
525
- }
526
-
527
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
528
- }
529
-
530
- function checked (length) {
531
- // Note: cannot use `length < kMaxLength()` here because that fails when
532
- // length is NaN (which is otherwise coerced to zero.)
533
- if (length >= kMaxLength()) {
534
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
535
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
536
- }
537
- return length | 0
538
- }
539
-
540
- function SlowBuffer (length) {
541
- if (+length != length) { // eslint-disable-line eqeqeq
542
- length = 0;
543
- }
544
- return Buffer$1.alloc(+length)
545
- }
546
- Buffer$1.isBuffer = isBuffer;
547
- function internalIsBuffer (b) {
548
- return !!(b != null && b._isBuffer)
549
- }
550
-
551
- Buffer$1.compare = function compare (a, b) {
552
- if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
553
- throw new TypeError('Arguments must be Buffers')
554
- }
555
-
556
- if (a === b) return 0
557
-
558
- var x = a.length;
559
- var y = b.length;
560
-
561
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
562
- if (a[i] !== b[i]) {
563
- x = a[i];
564
- y = b[i];
565
- break
566
- }
567
- }
568
-
569
- if (x < y) return -1
570
- if (y < x) return 1
571
- return 0
572
- };
573
-
574
- Buffer$1.isEncoding = function isEncoding (encoding) {
575
- switch (String(encoding).toLowerCase()) {
576
- case 'hex':
577
- case 'utf8':
578
- case 'utf-8':
579
- case 'ascii':
580
- case 'latin1':
581
- case 'binary':
582
- case 'base64':
583
- case 'ucs2':
584
- case 'ucs-2':
585
- case 'utf16le':
586
- case 'utf-16le':
587
- return true
588
- default:
589
- return false
590
- }
591
- };
592
-
593
- Buffer$1.concat = function concat (list, length) {
594
- if (!isArray(list)) {
595
- throw new TypeError('"list" argument must be an Array of Buffers')
596
- }
597
-
598
- if (list.length === 0) {
599
- return Buffer$1.alloc(0)
600
- }
601
-
602
- var i;
603
- if (length === undefined) {
604
- length = 0;
605
- for (i = 0; i < list.length; ++i) {
606
- length += list[i].length;
607
- }
608
- }
609
-
610
- var buffer = Buffer$1.allocUnsafe(length);
611
- var pos = 0;
612
- for (i = 0; i < list.length; ++i) {
613
- var buf = list[i];
614
- if (!internalIsBuffer(buf)) {
615
- throw new TypeError('"list" argument must be an Array of Buffers')
616
- }
617
- buf.copy(buffer, pos);
618
- pos += buf.length;
619
- }
620
- return buffer
621
- };
622
-
623
- function byteLength (string, encoding) {
624
- if (internalIsBuffer(string)) {
625
- return string.length
626
- }
627
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
628
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
629
- return string.byteLength
630
- }
631
- if (typeof string !== 'string') {
632
- string = '' + string;
633
- }
634
-
635
- var len = string.length;
636
- if (len === 0) return 0
637
-
638
- // Use a for loop to avoid recursion
639
- var loweredCase = false;
640
- for (;;) {
641
- switch (encoding) {
642
- case 'ascii':
643
- case 'latin1':
644
- case 'binary':
645
- return len
646
- case 'utf8':
647
- case 'utf-8':
648
- case undefined:
649
- return utf8ToBytes(string).length
650
- case 'ucs2':
651
- case 'ucs-2':
652
- case 'utf16le':
653
- case 'utf-16le':
654
- return len * 2
655
- case 'hex':
656
- return len >>> 1
657
- case 'base64':
658
- return base64ToBytes(string).length
659
- default:
660
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
661
- encoding = ('' + encoding).toLowerCase();
662
- loweredCase = true;
663
- }
664
- }
665
- }
666
- Buffer$1.byteLength = byteLength;
667
-
668
- function slowToString (encoding, start, end) {
669
- var loweredCase = false;
670
-
671
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
672
- // property of a typed array.
673
-
674
- // This behaves neither like String nor Uint8Array in that we set start/end
675
- // to their upper/lower bounds if the value passed is out of range.
676
- // undefined is handled specially as per ECMA-262 6th Edition,
677
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
678
- if (start === undefined || start < 0) {
679
- start = 0;
680
- }
681
- // Return early if start > this.length. Done here to prevent potential uint32
682
- // coercion fail below.
683
- if (start > this.length) {
684
- return ''
685
- }
686
-
687
- if (end === undefined || end > this.length) {
688
- end = this.length;
689
- }
690
-
691
- if (end <= 0) {
692
- return ''
693
- }
694
-
695
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
696
- end >>>= 0;
697
- start >>>= 0;
698
-
699
- if (end <= start) {
700
- return ''
701
- }
702
-
703
- if (!encoding) encoding = 'utf8';
704
-
705
- while (true) {
706
- switch (encoding) {
707
- case 'hex':
708
- return hexSlice(this, start, end)
709
-
710
- case 'utf8':
711
- case 'utf-8':
712
- return utf8Slice(this, start, end)
713
-
714
- case 'ascii':
715
- return asciiSlice(this, start, end)
716
-
717
- case 'latin1':
718
- case 'binary':
719
- return latin1Slice(this, start, end)
720
-
721
- case 'base64':
722
- return base64Slice(this, start, end)
723
-
724
- case 'ucs2':
725
- case 'ucs-2':
726
- case 'utf16le':
727
- case 'utf-16le':
728
- return utf16leSlice(this, start, end)
729
-
730
- default:
731
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
732
- encoding = (encoding + '').toLowerCase();
733
- loweredCase = true;
734
- }
735
- }
736
- }
737
-
738
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
739
- // Buffer instances.
740
- Buffer$1.prototype._isBuffer = true;
741
-
742
- function swap (b, n, m) {
743
- var i = b[n];
744
- b[n] = b[m];
745
- b[m] = i;
746
- }
747
-
748
- Buffer$1.prototype.swap16 = function swap16 () {
749
- var len = this.length;
750
- if (len % 2 !== 0) {
751
- throw new RangeError('Buffer size must be a multiple of 16-bits')
752
- }
753
- for (var i = 0; i < len; i += 2) {
754
- swap(this, i, i + 1);
755
- }
756
- return this
757
- };
758
-
759
- Buffer$1.prototype.swap32 = function swap32 () {
760
- var len = this.length;
761
- if (len % 4 !== 0) {
762
- throw new RangeError('Buffer size must be a multiple of 32-bits')
763
- }
764
- for (var i = 0; i < len; i += 4) {
765
- swap(this, i, i + 3);
766
- swap(this, i + 1, i + 2);
767
- }
768
- return this
769
- };
770
-
771
- Buffer$1.prototype.swap64 = function swap64 () {
772
- var len = this.length;
773
- if (len % 8 !== 0) {
774
- throw new RangeError('Buffer size must be a multiple of 64-bits')
775
- }
776
- for (var i = 0; i < len; i += 8) {
777
- swap(this, i, i + 7);
778
- swap(this, i + 1, i + 6);
779
- swap(this, i + 2, i + 5);
780
- swap(this, i + 3, i + 4);
781
- }
782
- return this
783
- };
784
-
785
- Buffer$1.prototype.toString = function toString () {
786
- var length = this.length | 0;
787
- if (length === 0) return ''
788
- if (arguments.length === 0) return utf8Slice(this, 0, length)
789
- return slowToString.apply(this, arguments)
790
- };
791
-
792
- Buffer$1.prototype.equals = function equals (b) {
793
- if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
794
- if (this === b) return true
795
- return Buffer$1.compare(this, b) === 0
796
- };
797
-
798
- Buffer$1.prototype.inspect = function inspect () {
799
- var str = '';
800
- var max = INSPECT_MAX_BYTES;
801
- if (this.length > 0) {
802
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
803
- if (this.length > max) str += ' ... ';
804
- }
805
- return '<Buffer ' + str + '>'
806
- };
807
-
808
- Buffer$1.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
809
- if (!internalIsBuffer(target)) {
810
- throw new TypeError('Argument must be a Buffer')
811
- }
812
-
813
- if (start === undefined) {
814
- start = 0;
815
- }
816
- if (end === undefined) {
817
- end = target ? target.length : 0;
818
- }
819
- if (thisStart === undefined) {
820
- thisStart = 0;
821
- }
822
- if (thisEnd === undefined) {
823
- thisEnd = this.length;
824
- }
825
-
826
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
827
- throw new RangeError('out of range index')
828
- }
829
-
830
- if (thisStart >= thisEnd && start >= end) {
831
- return 0
832
- }
833
- if (thisStart >= thisEnd) {
834
- return -1
835
- }
836
- if (start >= end) {
837
- return 1
838
- }
839
-
840
- start >>>= 0;
841
- end >>>= 0;
842
- thisStart >>>= 0;
843
- thisEnd >>>= 0;
844
-
845
- if (this === target) return 0
846
-
847
- var x = thisEnd - thisStart;
848
- var y = end - start;
849
- var len = Math.min(x, y);
850
-
851
- var thisCopy = this.slice(thisStart, thisEnd);
852
- var targetCopy = target.slice(start, end);
853
-
854
- for (var i = 0; i < len; ++i) {
855
- if (thisCopy[i] !== targetCopy[i]) {
856
- x = thisCopy[i];
857
- y = targetCopy[i];
858
- break
859
- }
860
- }
861
-
862
- if (x < y) return -1
863
- if (y < x) return 1
864
- return 0
865
- };
866
-
867
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
868
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
869
- //
870
- // Arguments:
871
- // - buffer - a Buffer to search
872
- // - val - a string, Buffer, or number
873
- // - byteOffset - an index into `buffer`; will be clamped to an int32
874
- // - encoding - an optional encoding, relevant is val is a string
875
- // - dir - true for indexOf, false for lastIndexOf
876
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
877
- // Empty buffer means no match
878
- if (buffer.length === 0) return -1
879
-
880
- // Normalize byteOffset
881
- if (typeof byteOffset === 'string') {
882
- encoding = byteOffset;
883
- byteOffset = 0;
884
- } else if (byteOffset > 0x7fffffff) {
885
- byteOffset = 0x7fffffff;
886
- } else if (byteOffset < -0x80000000) {
887
- byteOffset = -0x80000000;
888
- }
889
- byteOffset = +byteOffset; // Coerce to Number.
890
- if (isNaN(byteOffset)) {
891
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
892
- byteOffset = dir ? 0 : (buffer.length - 1);
893
- }
894
-
895
- // Normalize byteOffset: negative offsets start from the end of the buffer
896
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
897
- if (byteOffset >= buffer.length) {
898
- if (dir) return -1
899
- else byteOffset = buffer.length - 1;
900
- } else if (byteOffset < 0) {
901
- if (dir) byteOffset = 0;
902
- else return -1
903
- }
904
-
905
- // Normalize val
906
- if (typeof val === 'string') {
907
- val = Buffer$1.from(val, encoding);
908
- }
909
-
910
- // Finally, search either indexOf (if dir is true) or lastIndexOf
911
- if (internalIsBuffer(val)) {
912
- // Special case: looking for empty string/buffer always fails
913
- if (val.length === 0) {
914
- return -1
915
- }
916
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
917
- } else if (typeof val === 'number') {
918
- val = val & 0xFF; // Search for a byte value [0-255]
919
- if (Buffer$1.TYPED_ARRAY_SUPPORT &&
920
- typeof Uint8Array.prototype.indexOf === 'function') {
921
- if (dir) {
922
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
923
- } else {
924
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
925
- }
926
- }
927
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
928
- }
929
-
930
- throw new TypeError('val must be string, number or Buffer')
931
- }
932
-
933
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
934
- var indexSize = 1;
935
- var arrLength = arr.length;
936
- var valLength = val.length;
937
-
938
- if (encoding !== undefined) {
939
- encoding = String(encoding).toLowerCase();
940
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
941
- encoding === 'utf16le' || encoding === 'utf-16le') {
942
- if (arr.length < 2 || val.length < 2) {
943
- return -1
944
- }
945
- indexSize = 2;
946
- arrLength /= 2;
947
- valLength /= 2;
948
- byteOffset /= 2;
949
- }
950
- }
951
-
952
- function read (buf, i) {
953
- if (indexSize === 1) {
954
- return buf[i]
955
- } else {
956
- return buf.readUInt16BE(i * indexSize)
957
- }
958
- }
959
-
960
- var i;
961
- if (dir) {
962
- var foundIndex = -1;
963
- for (i = byteOffset; i < arrLength; i++) {
964
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
965
- if (foundIndex === -1) foundIndex = i;
966
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
967
- } else {
968
- if (foundIndex !== -1) i -= i - foundIndex;
969
- foundIndex = -1;
970
- }
971
- }
972
- } else {
973
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
974
- for (i = byteOffset; i >= 0; i--) {
975
- var found = true;
976
- for (var j = 0; j < valLength; j++) {
977
- if (read(arr, i + j) !== read(val, j)) {
978
- found = false;
979
- break
980
- }
981
- }
982
- if (found) return i
983
- }
984
- }
985
-
986
- return -1
987
- }
988
-
989
- Buffer$1.prototype.includes = function includes (val, byteOffset, encoding) {
990
- return this.indexOf(val, byteOffset, encoding) !== -1
991
- };
992
-
993
- Buffer$1.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
994
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
995
- };
996
-
997
- Buffer$1.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
998
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
999
- };
1000
-
1001
- function hexWrite (buf, string, offset, length) {
1002
- offset = Number(offset) || 0;
1003
- var remaining = buf.length - offset;
1004
- if (!length) {
1005
- length = remaining;
1006
- } else {
1007
- length = Number(length);
1008
- if (length > remaining) {
1009
- length = remaining;
1010
- }
1011
- }
1012
-
1013
- // must be an even number of digits
1014
- var strLen = string.length;
1015
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
1016
-
1017
- if (length > strLen / 2) {
1018
- length = strLen / 2;
1019
- }
1020
- for (var i = 0; i < length; ++i) {
1021
- var parsed = parseInt(string.substr(i * 2, 2), 16);
1022
- if (isNaN(parsed)) return i
1023
- buf[offset + i] = parsed;
1024
- }
1025
- return i
1026
- }
1027
-
1028
- function utf8Write (buf, string, offset, length) {
1029
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
1030
- }
1031
-
1032
- function asciiWrite (buf, string, offset, length) {
1033
- return blitBuffer(asciiToBytes(string), buf, offset, length)
1034
- }
1035
-
1036
- function latin1Write (buf, string, offset, length) {
1037
- return asciiWrite(buf, string, offset, length)
1038
- }
1039
-
1040
- function base64Write (buf, string, offset, length) {
1041
- return blitBuffer(base64ToBytes(string), buf, offset, length)
1042
- }
1043
-
1044
- function ucs2Write (buf, string, offset, length) {
1045
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1046
- }
1047
-
1048
- Buffer$1.prototype.write = function write (string, offset, length, encoding) {
1049
- // Buffer#write(string)
1050
- if (offset === undefined) {
1051
- encoding = 'utf8';
1052
- length = this.length;
1053
- offset = 0;
1054
- // Buffer#write(string, encoding)
1055
- } else if (length === undefined && typeof offset === 'string') {
1056
- encoding = offset;
1057
- length = this.length;
1058
- offset = 0;
1059
- // Buffer#write(string, offset[, length][, encoding])
1060
- } else if (isFinite(offset)) {
1061
- offset = offset | 0;
1062
- if (isFinite(length)) {
1063
- length = length | 0;
1064
- if (encoding === undefined) encoding = 'utf8';
1065
- } else {
1066
- encoding = length;
1067
- length = undefined;
1068
- }
1069
- // legacy write(string, encoding, offset, length) - remove in v0.13
1070
- } else {
1071
- throw new Error(
1072
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1073
- )
1074
- }
1075
-
1076
- var remaining = this.length - offset;
1077
- if (length === undefined || length > remaining) length = remaining;
1078
-
1079
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1080
- throw new RangeError('Attempt to write outside buffer bounds')
1081
- }
1082
-
1083
- if (!encoding) encoding = 'utf8';
1084
-
1085
- var loweredCase = false;
1086
- for (;;) {
1087
- switch (encoding) {
1088
- case 'hex':
1089
- return hexWrite(this, string, offset, length)
1090
-
1091
- case 'utf8':
1092
- case 'utf-8':
1093
- return utf8Write(this, string, offset, length)
1094
-
1095
- case 'ascii':
1096
- return asciiWrite(this, string, offset, length)
1097
-
1098
- case 'latin1':
1099
- case 'binary':
1100
- return latin1Write(this, string, offset, length)
1101
-
1102
- case 'base64':
1103
- // Warning: maxLength not taken into account in base64Write
1104
- return base64Write(this, string, offset, length)
1105
-
1106
- case 'ucs2':
1107
- case 'ucs-2':
1108
- case 'utf16le':
1109
- case 'utf-16le':
1110
- return ucs2Write(this, string, offset, length)
1111
-
1112
- default:
1113
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1114
- encoding = ('' + encoding).toLowerCase();
1115
- loweredCase = true;
1116
- }
1117
- }
1118
- };
1119
-
1120
- Buffer$1.prototype.toJSON = function toJSON () {
1121
- return {
1122
- type: 'Buffer',
1123
- data: Array.prototype.slice.call(this._arr || this, 0)
1124
- }
1125
- };
1126
-
1127
- function base64Slice (buf, start, end) {
1128
- if (start === 0 && end === buf.length) {
1129
- return fromByteArray(buf)
1130
- } else {
1131
- return fromByteArray(buf.slice(start, end))
1132
- }
1133
- }
1134
-
1135
- function utf8Slice (buf, start, end) {
1136
- end = Math.min(buf.length, end);
1137
- var res = [];
1138
-
1139
- var i = start;
1140
- while (i < end) {
1141
- var firstByte = buf[i];
1142
- var codePoint = null;
1143
- var bytesPerSequence = (firstByte > 0xEF) ? 4
1144
- : (firstByte > 0xDF) ? 3
1145
- : (firstByte > 0xBF) ? 2
1146
- : 1;
1147
-
1148
- if (i + bytesPerSequence <= end) {
1149
- var secondByte, thirdByte, fourthByte, tempCodePoint;
1150
-
1151
- switch (bytesPerSequence) {
1152
- case 1:
1153
- if (firstByte < 0x80) {
1154
- codePoint = firstByte;
1155
- }
1156
- break
1157
- case 2:
1158
- secondByte = buf[i + 1];
1159
- if ((secondByte & 0xC0) === 0x80) {
1160
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
1161
- if (tempCodePoint > 0x7F) {
1162
- codePoint = tempCodePoint;
1163
- }
1164
- }
1165
- break
1166
- case 3:
1167
- secondByte = buf[i + 1];
1168
- thirdByte = buf[i + 2];
1169
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1170
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
1171
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1172
- codePoint = tempCodePoint;
1173
- }
1174
- }
1175
- break
1176
- case 4:
1177
- secondByte = buf[i + 1];
1178
- thirdByte = buf[i + 2];
1179
- fourthByte = buf[i + 3];
1180
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1181
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
1182
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1183
- codePoint = tempCodePoint;
1184
- }
1185
- }
1186
- }
1187
- }
1188
-
1189
- if (codePoint === null) {
1190
- // we did not generate a valid codePoint so insert a
1191
- // replacement char (U+FFFD) and advance only 1 byte
1192
- codePoint = 0xFFFD;
1193
- bytesPerSequence = 1;
1194
- } else if (codePoint > 0xFFFF) {
1195
- // encode to utf16 (surrogate pair dance)
1196
- codePoint -= 0x10000;
1197
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
1198
- codePoint = 0xDC00 | codePoint & 0x3FF;
1199
- }
1200
-
1201
- res.push(codePoint);
1202
- i += bytesPerSequence;
1203
- }
1204
-
1205
- return decodeCodePointsArray(res)
1206
- }
1207
-
1208
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1209
- // the lowest limit is Chrome, with 0x10000 args.
1210
- // We go 1 magnitude less, for safety
1211
- var MAX_ARGUMENTS_LENGTH = 0x1000;
1212
-
1213
- function decodeCodePointsArray (codePoints) {
1214
- var len = codePoints.length;
1215
- if (len <= MAX_ARGUMENTS_LENGTH) {
1216
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1217
- }
1218
-
1219
- // Decode in chunks to avoid "call stack size exceeded".
1220
- var res = '';
1221
- var i = 0;
1222
- while (i < len) {
1223
- res += String.fromCharCode.apply(
1224
- String,
1225
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1226
- );
1227
- }
1228
- return res
1229
- }
1230
-
1231
- function asciiSlice (buf, start, end) {
1232
- var ret = '';
1233
- end = Math.min(buf.length, end);
1234
-
1235
- for (var i = start; i < end; ++i) {
1236
- ret += String.fromCharCode(buf[i] & 0x7F);
1237
- }
1238
- return ret
1239
- }
1240
-
1241
- function latin1Slice (buf, start, end) {
1242
- var ret = '';
1243
- end = Math.min(buf.length, end);
1244
-
1245
- for (var i = start; i < end; ++i) {
1246
- ret += String.fromCharCode(buf[i]);
1247
- }
1248
- return ret
1249
- }
1250
-
1251
- function hexSlice (buf, start, end) {
1252
- var len = buf.length;
1253
-
1254
- if (!start || start < 0) start = 0;
1255
- if (!end || end < 0 || end > len) end = len;
1256
-
1257
- var out = '';
1258
- for (var i = start; i < end; ++i) {
1259
- out += toHex$2(buf[i]);
1260
- }
1261
- return out
1262
- }
1263
-
1264
- function utf16leSlice (buf, start, end) {
1265
- var bytes = buf.slice(start, end);
1266
- var res = '';
1267
- for (var i = 0; i < bytes.length; i += 2) {
1268
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1269
- }
1270
- return res
1271
- }
1272
-
1273
- Buffer$1.prototype.slice = function slice (start, end) {
1274
- var len = this.length;
1275
- start = ~~start;
1276
- end = end === undefined ? len : ~~end;
1277
-
1278
- if (start < 0) {
1279
- start += len;
1280
- if (start < 0) start = 0;
1281
- } else if (start > len) {
1282
- start = len;
1283
- }
1284
-
1285
- if (end < 0) {
1286
- end += len;
1287
- if (end < 0) end = 0;
1288
- } else if (end > len) {
1289
- end = len;
1290
- }
1291
-
1292
- if (end < start) end = start;
1293
-
1294
- var newBuf;
1295
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1296
- newBuf = this.subarray(start, end);
1297
- newBuf.__proto__ = Buffer$1.prototype;
1298
- } else {
1299
- var sliceLen = end - start;
1300
- newBuf = new Buffer$1(sliceLen, undefined);
1301
- for (var i = 0; i < sliceLen; ++i) {
1302
- newBuf[i] = this[i + start];
1303
- }
1304
- }
1305
-
1306
- return newBuf
1307
- };
1308
-
1309
- /*
1310
- * Need to make sure that buffer isn't trying to write out of bounds.
1311
- */
1312
- function checkOffset (offset, ext, length) {
1313
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1314
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1315
- }
1316
-
1317
- Buffer$1.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1318
- offset = offset | 0;
1319
- byteLength = byteLength | 0;
1320
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1321
-
1322
- var val = this[offset];
1323
- var mul = 1;
1324
- var i = 0;
1325
- while (++i < byteLength && (mul *= 0x100)) {
1326
- val += this[offset + i] * mul;
1327
- }
1328
-
1329
- return val
1330
- };
1331
-
1332
- Buffer$1.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1333
- offset = offset | 0;
1334
- byteLength = byteLength | 0;
1335
- if (!noAssert) {
1336
- checkOffset(offset, byteLength, this.length);
1337
- }
1338
-
1339
- var val = this[offset + --byteLength];
1340
- var mul = 1;
1341
- while (byteLength > 0 && (mul *= 0x100)) {
1342
- val += this[offset + --byteLength] * mul;
1343
- }
1344
-
1345
- return val
1346
- };
1347
-
1348
- Buffer$1.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1349
- if (!noAssert) checkOffset(offset, 1, this.length);
1350
- return this[offset]
1351
- };
1352
-
1353
- Buffer$1.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1354
- if (!noAssert) checkOffset(offset, 2, this.length);
1355
- return this[offset] | (this[offset + 1] << 8)
1356
- };
1357
-
1358
- Buffer$1.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1359
- if (!noAssert) checkOffset(offset, 2, this.length);
1360
- return (this[offset] << 8) | this[offset + 1]
1361
- };
1362
-
1363
- Buffer$1.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1364
- if (!noAssert) checkOffset(offset, 4, this.length);
1365
-
1366
- return ((this[offset]) |
1367
- (this[offset + 1] << 8) |
1368
- (this[offset + 2] << 16)) +
1369
- (this[offset + 3] * 0x1000000)
1370
- };
1371
-
1372
- Buffer$1.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1373
- if (!noAssert) checkOffset(offset, 4, this.length);
1374
-
1375
- return (this[offset] * 0x1000000) +
1376
- ((this[offset + 1] << 16) |
1377
- (this[offset + 2] << 8) |
1378
- this[offset + 3])
1379
- };
1380
-
1381
- Buffer$1.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1382
- offset = offset | 0;
1383
- byteLength = byteLength | 0;
1384
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1385
-
1386
- var val = this[offset];
1387
- var mul = 1;
1388
- var i = 0;
1389
- while (++i < byteLength && (mul *= 0x100)) {
1390
- val += this[offset + i] * mul;
1391
- }
1392
- mul *= 0x80;
1393
-
1394
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1395
-
1396
- return val
1397
- };
1398
-
1399
- Buffer$1.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1400
- offset = offset | 0;
1401
- byteLength = byteLength | 0;
1402
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1403
-
1404
- var i = byteLength;
1405
- var mul = 1;
1406
- var val = this[offset + --i];
1407
- while (i > 0 && (mul *= 0x100)) {
1408
- val += this[offset + --i] * mul;
1409
- }
1410
- mul *= 0x80;
1411
-
1412
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1413
-
1414
- return val
1415
- };
1416
-
1417
- Buffer$1.prototype.readInt8 = function readInt8 (offset, noAssert) {
1418
- if (!noAssert) checkOffset(offset, 1, this.length);
1419
- if (!(this[offset] & 0x80)) return (this[offset])
1420
- return ((0xff - this[offset] + 1) * -1)
1421
- };
1422
-
1423
- Buffer$1.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1424
- if (!noAssert) checkOffset(offset, 2, this.length);
1425
- var val = this[offset] | (this[offset + 1] << 8);
1426
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1427
- };
1428
-
1429
- Buffer$1.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1430
- if (!noAssert) checkOffset(offset, 2, this.length);
1431
- var val = this[offset + 1] | (this[offset] << 8);
1432
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1433
- };
1434
-
1435
- Buffer$1.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1436
- if (!noAssert) checkOffset(offset, 4, this.length);
1437
-
1438
- return (this[offset]) |
1439
- (this[offset + 1] << 8) |
1440
- (this[offset + 2] << 16) |
1441
- (this[offset + 3] << 24)
1442
- };
1443
-
1444
- Buffer$1.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1445
- if (!noAssert) checkOffset(offset, 4, this.length);
1446
-
1447
- return (this[offset] << 24) |
1448
- (this[offset + 1] << 16) |
1449
- (this[offset + 2] << 8) |
1450
- (this[offset + 3])
1451
- };
1452
-
1453
- Buffer$1.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1454
- if (!noAssert) checkOffset(offset, 4, this.length);
1455
- return read(this, offset, true, 23, 4)
1456
- };
1457
-
1458
- Buffer$1.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1459
- if (!noAssert) checkOffset(offset, 4, this.length);
1460
- return read(this, offset, false, 23, 4)
1461
- };
1462
-
1463
- Buffer$1.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1464
- if (!noAssert) checkOffset(offset, 8, this.length);
1465
- return read(this, offset, true, 52, 8)
1466
- };
1467
-
1468
- Buffer$1.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1469
- if (!noAssert) checkOffset(offset, 8, this.length);
1470
- return read(this, offset, false, 52, 8)
1471
- };
1472
-
1473
- function checkInt (buf, value, offset, ext, max, min) {
1474
- if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1475
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1476
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1477
- }
1478
-
1479
- Buffer$1.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1480
- value = +value;
1481
- offset = offset | 0;
1482
- byteLength = byteLength | 0;
1483
- if (!noAssert) {
1484
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
1485
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1486
- }
1487
-
1488
- var mul = 1;
1489
- var i = 0;
1490
- this[offset] = value & 0xFF;
1491
- while (++i < byteLength && (mul *= 0x100)) {
1492
- this[offset + i] = (value / mul) & 0xFF;
1493
- }
1494
-
1495
- return offset + byteLength
1496
- };
1497
-
1498
- Buffer$1.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1499
- value = +value;
1500
- offset = offset | 0;
1501
- byteLength = byteLength | 0;
1502
- if (!noAssert) {
1503
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
1504
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1505
- }
1506
-
1507
- var i = byteLength - 1;
1508
- var mul = 1;
1509
- this[offset + i] = value & 0xFF;
1510
- while (--i >= 0 && (mul *= 0x100)) {
1511
- this[offset + i] = (value / mul) & 0xFF;
1512
- }
1513
-
1514
- return offset + byteLength
1515
- };
1516
-
1517
- Buffer$1.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1518
- value = +value;
1519
- offset = offset | 0;
1520
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
1521
- if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
1522
- this[offset] = (value & 0xff);
1523
- return offset + 1
1524
- };
1525
-
1526
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
1527
- if (value < 0) value = 0xffff + value + 1;
1528
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1529
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1530
- (littleEndian ? i : 1 - i) * 8;
1531
- }
1532
- }
1533
-
1534
- Buffer$1.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1535
- value = +value;
1536
- offset = offset | 0;
1537
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1538
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1539
- this[offset] = (value & 0xff);
1540
- this[offset + 1] = (value >>> 8);
1541
- } else {
1542
- objectWriteUInt16(this, value, offset, true);
1543
- }
1544
- return offset + 2
1545
- };
1546
-
1547
- Buffer$1.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1548
- value = +value;
1549
- offset = offset | 0;
1550
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1551
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1552
- this[offset] = (value >>> 8);
1553
- this[offset + 1] = (value & 0xff);
1554
- } else {
1555
- objectWriteUInt16(this, value, offset, false);
1556
- }
1557
- return offset + 2
1558
- };
1559
-
1560
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
1561
- if (value < 0) value = 0xffffffff + value + 1;
1562
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
1563
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
1564
- }
1565
- }
1566
-
1567
- Buffer$1.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1568
- value = +value;
1569
- offset = offset | 0;
1570
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1571
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1572
- this[offset + 3] = (value >>> 24);
1573
- this[offset + 2] = (value >>> 16);
1574
- this[offset + 1] = (value >>> 8);
1575
- this[offset] = (value & 0xff);
1576
- } else {
1577
- objectWriteUInt32(this, value, offset, true);
1578
- }
1579
- return offset + 4
1580
- };
1581
-
1582
- Buffer$1.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1583
- value = +value;
1584
- offset = offset | 0;
1585
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1586
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1587
- this[offset] = (value >>> 24);
1588
- this[offset + 1] = (value >>> 16);
1589
- this[offset + 2] = (value >>> 8);
1590
- this[offset + 3] = (value & 0xff);
1591
- } else {
1592
- objectWriteUInt32(this, value, offset, false);
1593
- }
1594
- return offset + 4
1595
- };
1596
-
1597
- Buffer$1.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1598
- value = +value;
1599
- offset = offset | 0;
1600
- if (!noAssert) {
1601
- var limit = Math.pow(2, 8 * byteLength - 1);
1602
-
1603
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1604
- }
1605
-
1606
- var i = 0;
1607
- var mul = 1;
1608
- var sub = 0;
1609
- this[offset] = value & 0xFF;
1610
- while (++i < byteLength && (mul *= 0x100)) {
1611
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1612
- sub = 1;
1613
- }
1614
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1615
- }
1616
-
1617
- return offset + byteLength
1618
- };
1619
-
1620
- Buffer$1.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1621
- value = +value;
1622
- offset = offset | 0;
1623
- if (!noAssert) {
1624
- var limit = Math.pow(2, 8 * byteLength - 1);
1625
-
1626
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1627
- }
1628
-
1629
- var i = byteLength - 1;
1630
- var mul = 1;
1631
- var sub = 0;
1632
- this[offset + i] = value & 0xFF;
1633
- while (--i >= 0 && (mul *= 0x100)) {
1634
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1635
- sub = 1;
1636
- }
1637
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1638
- }
1639
-
1640
- return offset + byteLength
1641
- };
1642
-
1643
- Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1644
- value = +value;
1645
- offset = offset | 0;
1646
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
1647
- if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
1648
- if (value < 0) value = 0xff + value + 1;
1649
- this[offset] = (value & 0xff);
1650
- return offset + 1
1651
- };
1652
-
1653
- Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1654
- value = +value;
1655
- offset = offset | 0;
1656
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1657
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1658
- this[offset] = (value & 0xff);
1659
- this[offset + 1] = (value >>> 8);
1660
- } else {
1661
- objectWriteUInt16(this, value, offset, true);
1662
- }
1663
- return offset + 2
1664
- };
1665
-
1666
- Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1667
- value = +value;
1668
- offset = offset | 0;
1669
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1670
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1671
- this[offset] = (value >>> 8);
1672
- this[offset + 1] = (value & 0xff);
1673
- } else {
1674
- objectWriteUInt16(this, value, offset, false);
1675
- }
1676
- return offset + 2
1677
- };
1678
-
1679
- Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1680
- value = +value;
1681
- offset = offset | 0;
1682
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1683
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1684
- this[offset] = (value & 0xff);
1685
- this[offset + 1] = (value >>> 8);
1686
- this[offset + 2] = (value >>> 16);
1687
- this[offset + 3] = (value >>> 24);
1688
- } else {
1689
- objectWriteUInt32(this, value, offset, true);
1690
- }
1691
- return offset + 4
1692
- };
1693
-
1694
- Buffer$1.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1695
- value = +value;
1696
- offset = offset | 0;
1697
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1698
- if (value < 0) value = 0xffffffff + value + 1;
1699
- if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1700
- this[offset] = (value >>> 24);
1701
- this[offset + 1] = (value >>> 16);
1702
- this[offset + 2] = (value >>> 8);
1703
- this[offset + 3] = (value & 0xff);
1704
- } else {
1705
- objectWriteUInt32(this, value, offset, false);
1706
- }
1707
- return offset + 4
1708
- };
1709
-
1710
- function checkIEEE754 (buf, value, offset, ext, max, min) {
1711
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1712
- if (offset < 0) throw new RangeError('Index out of range')
1713
- }
1714
-
1715
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
1716
- if (!noAssert) {
1717
- checkIEEE754(buf, value, offset, 4);
1718
- }
1719
- write(buf, value, offset, littleEndian, 23, 4);
1720
- return offset + 4
1721
- }
1722
-
1723
- Buffer$1.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1724
- return writeFloat(this, value, offset, true, noAssert)
1725
- };
1726
-
1727
- Buffer$1.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1728
- return writeFloat(this, value, offset, false, noAssert)
1729
- };
1730
-
1731
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
1732
- if (!noAssert) {
1733
- checkIEEE754(buf, value, offset, 8);
1734
- }
1735
- write(buf, value, offset, littleEndian, 52, 8);
1736
- return offset + 8
1737
- }
1738
-
1739
- Buffer$1.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1740
- return writeDouble(this, value, offset, true, noAssert)
1741
- };
1742
-
1743
- Buffer$1.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1744
- return writeDouble(this, value, offset, false, noAssert)
1745
- };
1746
-
1747
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1748
- Buffer$1.prototype.copy = function copy (target, targetStart, start, end) {
1749
- if (!start) start = 0;
1750
- if (!end && end !== 0) end = this.length;
1751
- if (targetStart >= target.length) targetStart = target.length;
1752
- if (!targetStart) targetStart = 0;
1753
- if (end > 0 && end < start) end = start;
1754
-
1755
- // Copy 0 bytes; we're done
1756
- if (end === start) return 0
1757
- if (target.length === 0 || this.length === 0) return 0
1758
-
1759
- // Fatal error conditions
1760
- if (targetStart < 0) {
1761
- throw new RangeError('targetStart out of bounds')
1762
- }
1763
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
1764
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
1765
-
1766
- // Are we oob?
1767
- if (end > this.length) end = this.length;
1768
- if (target.length - targetStart < end - start) {
1769
- end = target.length - targetStart + start;
1770
- }
1771
-
1772
- var len = end - start;
1773
- var i;
1774
-
1775
- if (this === target && start < targetStart && targetStart < end) {
1776
- // descending copy from end
1777
- for (i = len - 1; i >= 0; --i) {
1778
- target[i + targetStart] = this[i + start];
1779
- }
1780
- } else if (len < 1000 || !Buffer$1.TYPED_ARRAY_SUPPORT) {
1781
- // ascending copy from start
1782
- for (i = 0; i < len; ++i) {
1783
- target[i + targetStart] = this[i + start];
1784
- }
1785
- } else {
1786
- Uint8Array.prototype.set.call(
1787
- target,
1788
- this.subarray(start, start + len),
1789
- targetStart
1790
- );
1791
- }
1792
-
1793
- return len
1794
- };
1795
-
1796
- // Usage:
1797
- // buffer.fill(number[, offset[, end]])
1798
- // buffer.fill(buffer[, offset[, end]])
1799
- // buffer.fill(string[, offset[, end]][, encoding])
1800
- Buffer$1.prototype.fill = function fill (val, start, end, encoding) {
1801
- // Handle string cases:
1802
- if (typeof val === 'string') {
1803
- if (typeof start === 'string') {
1804
- encoding = start;
1805
- start = 0;
1806
- end = this.length;
1807
- } else if (typeof end === 'string') {
1808
- encoding = end;
1809
- end = this.length;
1810
- }
1811
- if (val.length === 1) {
1812
- var code = val.charCodeAt(0);
1813
- if (code < 256) {
1814
- val = code;
1815
- }
1816
- }
1817
- if (encoding !== undefined && typeof encoding !== 'string') {
1818
- throw new TypeError('encoding must be a string')
1819
- }
1820
- if (typeof encoding === 'string' && !Buffer$1.isEncoding(encoding)) {
1821
- throw new TypeError('Unknown encoding: ' + encoding)
1822
- }
1823
- } else if (typeof val === 'number') {
1824
- val = val & 255;
1825
- }
1826
-
1827
- // Invalid ranges are not set to a default, so can range check early.
1828
- if (start < 0 || this.length < start || this.length < end) {
1829
- throw new RangeError('Out of range index')
1830
- }
1831
-
1832
- if (end <= start) {
1833
- return this
1834
- }
1835
-
1836
- start = start >>> 0;
1837
- end = end === undefined ? this.length : end >>> 0;
1838
-
1839
- if (!val) val = 0;
1840
-
1841
- var i;
1842
- if (typeof val === 'number') {
1843
- for (i = start; i < end; ++i) {
1844
- this[i] = val;
1845
- }
1846
- } else {
1847
- var bytes = internalIsBuffer(val)
1848
- ? val
1849
- : utf8ToBytes(new Buffer$1(val, encoding).toString());
1850
- var len = bytes.length;
1851
- for (i = 0; i < end - start; ++i) {
1852
- this[i + start] = bytes[i % len];
1853
- }
1854
- }
1855
-
1856
- return this
1857
- };
1858
-
1859
- // HELPER FUNCTIONS
1860
- // ================
1861
-
1862
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
1863
-
1864
- function base64clean (str) {
1865
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
1866
- str = stringtrim(str).replace(INVALID_BASE64_RE, '');
1867
- // Node converts strings with length < 2 to ''
1868
- if (str.length < 2) return ''
1869
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1870
- while (str.length % 4 !== 0) {
1871
- str = str + '=';
1872
- }
1873
- return str
1874
- }
1875
-
1876
- function stringtrim (str) {
1877
- if (str.trim) return str.trim()
1878
- return str.replace(/^\s+|\s+$/g, '')
1879
- }
1880
-
1881
- function toHex$2 (n) {
1882
- if (n < 16) return '0' + n.toString(16)
1883
- return n.toString(16)
1884
- }
1885
-
1886
- function utf8ToBytes (string, units) {
1887
- units = units || Infinity;
1888
- var codePoint;
1889
- var length = string.length;
1890
- var leadSurrogate = null;
1891
- var bytes = [];
1892
-
1893
- for (var i = 0; i < length; ++i) {
1894
- codePoint = string.charCodeAt(i);
1895
-
1896
- // is surrogate component
1897
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
1898
- // last char was a lead
1899
- if (!leadSurrogate) {
1900
- // no lead yet
1901
- if (codePoint > 0xDBFF) {
1902
- // unexpected trail
1903
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1904
- continue
1905
- } else if (i + 1 === length) {
1906
- // unpaired lead
1907
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1908
- continue
1909
- }
1910
-
1911
- // valid lead
1912
- leadSurrogate = codePoint;
1913
-
1914
- continue
1915
- }
1916
-
1917
- // 2 leads in a row
1918
- if (codePoint < 0xDC00) {
1919
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1920
- leadSurrogate = codePoint;
1921
- continue
1922
- }
1923
-
1924
- // valid surrogate pair
1925
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
1926
- } else if (leadSurrogate) {
1927
- // valid bmp char, but last char was a lead
1928
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1929
- }
1930
-
1931
- leadSurrogate = null;
1932
-
1933
- // encode utf8
1934
- if (codePoint < 0x80) {
1935
- if ((units -= 1) < 0) break
1936
- bytes.push(codePoint);
1937
- } else if (codePoint < 0x800) {
1938
- if ((units -= 2) < 0) break
1939
- bytes.push(
1940
- codePoint >> 0x6 | 0xC0,
1941
- codePoint & 0x3F | 0x80
1942
- );
1943
- } else if (codePoint < 0x10000) {
1944
- if ((units -= 3) < 0) break
1945
- bytes.push(
1946
- codePoint >> 0xC | 0xE0,
1947
- codePoint >> 0x6 & 0x3F | 0x80,
1948
- codePoint & 0x3F | 0x80
1949
- );
1950
- } else if (codePoint < 0x110000) {
1951
- if ((units -= 4) < 0) break
1952
- bytes.push(
1953
- codePoint >> 0x12 | 0xF0,
1954
- codePoint >> 0xC & 0x3F | 0x80,
1955
- codePoint >> 0x6 & 0x3F | 0x80,
1956
- codePoint & 0x3F | 0x80
1957
- );
1958
- } else {
1959
- throw new Error('Invalid code point')
1960
- }
1961
- }
1962
-
1963
- return bytes
1964
- }
1965
-
1966
- function asciiToBytes (str) {
1967
- var byteArray = [];
1968
- for (var i = 0; i < str.length; ++i) {
1969
- // Node's code seems to be doing this and not & 0x7F..
1970
- byteArray.push(str.charCodeAt(i) & 0xFF);
1971
- }
1972
- return byteArray
1973
- }
1974
-
1975
- function utf16leToBytes (str, units) {
1976
- var c, hi, lo;
1977
- var byteArray = [];
1978
- for (var i = 0; i < str.length; ++i) {
1979
- if ((units -= 2) < 0) break
1980
-
1981
- c = str.charCodeAt(i);
1982
- hi = c >> 8;
1983
- lo = c % 256;
1984
- byteArray.push(lo);
1985
- byteArray.push(hi);
1986
- }
1987
-
1988
- return byteArray
1989
- }
1990
-
1991
-
1992
- function base64ToBytes (str) {
1993
- return toByteArray(base64clean(str))
1994
- }
1995
-
1996
- function blitBuffer (src, dst, offset, length) {
1997
- for (var i = 0; i < length; ++i) {
1998
- if ((i + offset >= dst.length) || (i >= src.length)) break
1999
- dst[i + offset] = src[i];
2000
- }
2001
- return i
2002
- }
2003
-
2004
- function isnan (val) {
2005
- return val !== val // eslint-disable-line no-self-compare
2006
- }
2007
-
2008
-
2009
- // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
2010
- // The _isBuffer check is for Safari 5-7 support, because it's missing
2011
- // Object.prototype.constructor. Remove this eventually
2012
- function isBuffer(obj) {
2013
- return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
2014
- }
2015
-
2016
- function isFastBuffer (obj) {
2017
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
2018
- }
2019
-
2020
- // For Node v0.10 support. Remove this eventually.
2021
- function isSlowBuffer (obj) {
2022
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
2023
- }
2024
-
2025
- var _polyfillNode_buffer = /*#__PURE__*/Object.freeze({
36
+ var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
2026
37
  __proto__: null,
2027
- Buffer: Buffer$1,
2028
- INSPECT_MAX_BYTES: INSPECT_MAX_BYTES,
2029
- SlowBuffer: SlowBuffer,
2030
- isBuffer: isBuffer,
2031
- kMaxLength: _kMaxLength
38
+ default: _nodeResolve_empty
2032
39
  });
2033
40
 
2034
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_buffer);
41
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
2035
42
 
2036
43
  bn.exports;
2037
44
 
@@ -14620,8 +12627,4 @@ class RawTransactionMessage extends FormatInterface {
14620
12627
  }
14621
12628
  }
14622
12629
 
14623
- var _polyfillNode_child_process = /*#__PURE__*/Object.freeze({
14624
- __proto__: null
14625
- });
14626
-
14627
- export { BlockMessage as B, ContractMessage as C, FormatInterface as F, Logger as L, RawTransactionMessage as R, TransactionMessage as T, ValidatorMessage as V, _polyfillNode_child_process as _, BWMessage as a, BWRequestMessage as b, BigNumber as c, arrayify as d, isBytes as e, getDefaultExportFromCjs as f, global$1 as g, hexZeroPad as h, isBigNumberish as i, toBase58 as t, version as v };
12630
+ export { BigNumber as B, ContractMessage as C, FormatInterface as F, Logger as L, RawTransactionMessage as R, TransactionMessage as T, ValidatorMessage as V, arrayify as a, isBytes as b, BlockMessage as c, BWMessage as d, BWRequestMessage as e, getDefaultExportFromCjs as g, hexZeroPad as h, isBigNumberish as i, toBase58 as t, version as v };