@ohif/app 3.7.0-beta.58 → 3.7.0-beta.59

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.
Files changed (22) hide show
  1. package/dist/{202.bundle.ac1e5e25d4daf54581b1.js → 202.bundle.8007de18c96daaceca7f.js} +0 -2076
  2. package/dist/{362.bundle.52c5185d34f5f0dac3ab.js → 362.bundle.ddcebd2c18c9eb1d708a.js} +2 -2
  3. package/dist/{app.bundle.0004f951b9afebc609b8.js → app.bundle.02d14926e5f1ea2694c8.js} +2082 -4
  4. package/dist/{dicom-microscopy-viewer.bundle.44f7fedc03a58d5911d1.js → dicom-microscopy-viewer.bundle.2c146384eb9466d02ff8.js} +2 -1
  5. package/dist/index.html +1 -1
  6. package/dist/sw.js +1 -1
  7. package/package.json +18 -18
  8. /package/dist/{12.bundle.a98f63827a148e9fdaaf.js → 12.bundle.4b30bcafacd5860e9c4d.js} +0 -0
  9. /package/dist/{128.bundle.beabde44babc7e667e74.js → 128.bundle.4f5d37ab4c747f99ac09.js} +0 -0
  10. /package/dist/{150.bundle.c4ea65552293aff70c7a.js → 150.bundle.1d052555e22dcc143aec.js} +0 -0
  11. /package/dist/{236.bundle.d588fd25d68c6c017ee3.js → 236.bundle.4e74f99ce93dd3a8919d.js} +0 -0
  12. /package/dist/{281.bundle.5b0a5e6eb03470e23d2b.js → 281.bundle.51e78a1ad0db1439129c.js} +0 -0
  13. /package/dist/{30.bundle.9427944862190fc79970.js → 30.bundle.c968143cb6d7e612c361.js} +0 -0
  14. /package/dist/{348.bundle.a2e21a04f2df1e420b22.js → 348.bundle.9e859b5950b776ce4d8c.js} +0 -0
  15. /package/dist/{359.bundle.535a337486c4789e15f7.js → 359.bundle.0885b37087034bd84baf.js} +0 -0
  16. /package/dist/{378.bundle.c3502c268c2d82c78de2.js → 378.bundle.36ca9c43c8c33480452c.js} +0 -0
  17. /package/dist/{410.bundle.73658423c3c2c6f7263f.js → 410.bundle.483d2128bd82bc80d53e.js} +0 -0
  18. /package/dist/{506.bundle.25789c2270ca2f0d97d1.js → 506.bundle.b2c08bec61ae3372ac39.js} +0 -0
  19. /package/dist/{663.bundle.55721e776396d06003ca.js → 663.bundle.404ccd6fb3e5c1f69ad0.js} +0 -0
  20. /package/dist/{678.bundle.eb17b616827ad2710f8f.js → 678.bundle.77852067972ef850afe9.js} +0 -0
  21. /package/dist/{782.bundle.20ddd47317996fe30e16.js → 782.bundle.8ae06c41a12c289dae06.js} +0 -0
  22. /package/dist/{814.bundle.9dab1ac2fed309c164d9.js → 814.bundle.c45f25c6521c037bb1b5.js} +0 -0
@@ -5190,2082 +5190,6 @@ var adaptersSEG = {
5190
5190
 
5191
5191
 
5192
5192
 
5193
- /***/ }),
5194
-
5195
- /***/ 3506:
5196
- /***/ ((__unused_webpack_module, exports) => {
5197
-
5198
- "use strict";
5199
-
5200
-
5201
- exports.byteLength = byteLength
5202
- exports.toByteArray = toByteArray
5203
- exports.fromByteArray = fromByteArray
5204
-
5205
- var lookup = []
5206
- var revLookup = []
5207
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
5208
-
5209
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
5210
- for (var i = 0, len = code.length; i < len; ++i) {
5211
- lookup[i] = code[i]
5212
- revLookup[code.charCodeAt(i)] = i
5213
- }
5214
-
5215
- // Support decoding URL-safe base64 strings, as Node.js does.
5216
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
5217
- revLookup['-'.charCodeAt(0)] = 62
5218
- revLookup['_'.charCodeAt(0)] = 63
5219
-
5220
- function getLens (b64) {
5221
- var len = b64.length
5222
-
5223
- if (len % 4 > 0) {
5224
- throw new Error('Invalid string. Length must be a multiple of 4')
5225
- }
5226
-
5227
- // Trim off extra bytes after placeholder bytes are found
5228
- // See: https://github.com/beatgammit/base64-js/issues/42
5229
- var validLen = b64.indexOf('=')
5230
- if (validLen === -1) validLen = len
5231
-
5232
- var placeHoldersLen = validLen === len
5233
- ? 0
5234
- : 4 - (validLen % 4)
5235
-
5236
- return [validLen, placeHoldersLen]
5237
- }
5238
-
5239
- // base64 is 4/3 + up to two characters of the original data
5240
- function byteLength (b64) {
5241
- var lens = getLens(b64)
5242
- var validLen = lens[0]
5243
- var placeHoldersLen = lens[1]
5244
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
5245
- }
5246
-
5247
- function _byteLength (b64, validLen, placeHoldersLen) {
5248
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
5249
- }
5250
-
5251
- function toByteArray (b64) {
5252
- var tmp
5253
- var lens = getLens(b64)
5254
- var validLen = lens[0]
5255
- var placeHoldersLen = lens[1]
5256
-
5257
- var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
5258
-
5259
- var curByte = 0
5260
-
5261
- // if there are placeholders, only get up to the last complete 4 chars
5262
- var len = placeHoldersLen > 0
5263
- ? validLen - 4
5264
- : validLen
5265
-
5266
- var i
5267
- for (i = 0; i < len; i += 4) {
5268
- tmp =
5269
- (revLookup[b64.charCodeAt(i)] << 18) |
5270
- (revLookup[b64.charCodeAt(i + 1)] << 12) |
5271
- (revLookup[b64.charCodeAt(i + 2)] << 6) |
5272
- revLookup[b64.charCodeAt(i + 3)]
5273
- arr[curByte++] = (tmp >> 16) & 0xFF
5274
- arr[curByte++] = (tmp >> 8) & 0xFF
5275
- arr[curByte++] = tmp & 0xFF
5276
- }
5277
-
5278
- if (placeHoldersLen === 2) {
5279
- tmp =
5280
- (revLookup[b64.charCodeAt(i)] << 2) |
5281
- (revLookup[b64.charCodeAt(i + 1)] >> 4)
5282
- arr[curByte++] = tmp & 0xFF
5283
- }
5284
-
5285
- if (placeHoldersLen === 1) {
5286
- tmp =
5287
- (revLookup[b64.charCodeAt(i)] << 10) |
5288
- (revLookup[b64.charCodeAt(i + 1)] << 4) |
5289
- (revLookup[b64.charCodeAt(i + 2)] >> 2)
5290
- arr[curByte++] = (tmp >> 8) & 0xFF
5291
- arr[curByte++] = tmp & 0xFF
5292
- }
5293
-
5294
- return arr
5295
- }
5296
-
5297
- function tripletToBase64 (num) {
5298
- return lookup[num >> 18 & 0x3F] +
5299
- lookup[num >> 12 & 0x3F] +
5300
- lookup[num >> 6 & 0x3F] +
5301
- lookup[num & 0x3F]
5302
- }
5303
-
5304
- function encodeChunk (uint8, start, end) {
5305
- var tmp
5306
- var output = []
5307
- for (var i = start; i < end; i += 3) {
5308
- tmp =
5309
- ((uint8[i] << 16) & 0xFF0000) +
5310
- ((uint8[i + 1] << 8) & 0xFF00) +
5311
- (uint8[i + 2] & 0xFF)
5312
- output.push(tripletToBase64(tmp))
5313
- }
5314
- return output.join('')
5315
- }
5316
-
5317
- function fromByteArray (uint8) {
5318
- var tmp
5319
- var len = uint8.length
5320
- var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
5321
- var parts = []
5322
- var maxChunkLength = 16383 // must be multiple of 3
5323
-
5324
- // go through the array every three bytes, we'll deal with trailing stuff later
5325
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
5326
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
5327
- }
5328
-
5329
- // pad the end with zeros, but make sure to not forget the extra bytes
5330
- if (extraBytes === 1) {
5331
- tmp = uint8[len - 1]
5332
- parts.push(
5333
- lookup[tmp >> 2] +
5334
- lookup[(tmp << 4) & 0x3F] +
5335
- '=='
5336
- )
5337
- } else if (extraBytes === 2) {
5338
- tmp = (uint8[len - 2] << 8) + uint8[len - 1]
5339
- parts.push(
5340
- lookup[tmp >> 10] +
5341
- lookup[(tmp >> 4) & 0x3F] +
5342
- lookup[(tmp << 2) & 0x3F] +
5343
- '='
5344
- )
5345
- }
5346
-
5347
- return parts.join('')
5348
- }
5349
-
5350
-
5351
- /***/ }),
5352
-
5353
- /***/ 58955:
5354
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5355
-
5356
- "use strict";
5357
- var __webpack_unused_export__;
5358
- /*!
5359
- * The buffer module from node.js, for the browser.
5360
- *
5361
- * @author Feross Aboukhadijeh <https://feross.org>
5362
- * @license MIT
5363
- */
5364
- /* eslint-disable no-proto */
5365
-
5366
-
5367
-
5368
- var base64 = __webpack_require__(3506)
5369
- var ieee754 = __webpack_require__(75597)
5370
- var customInspectSymbol =
5371
- (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
5372
- ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
5373
- : null
5374
-
5375
- exports.lW = Buffer
5376
- __webpack_unused_export__ = SlowBuffer
5377
- exports.h2 = 50
5378
-
5379
- var K_MAX_LENGTH = 0x7fffffff
5380
- __webpack_unused_export__ = K_MAX_LENGTH
5381
-
5382
- /**
5383
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
5384
- * === true Use Uint8Array implementation (fastest)
5385
- * === false Print warning and recommend using `buffer` v4.x which has an Object
5386
- * implementation (most compatible, even IE6)
5387
- *
5388
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
5389
- * Opera 11.6+, iOS 4.2+.
5390
- *
5391
- * We report that the browser does not support typed arrays if the are not subclassable
5392
- * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
5393
- * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
5394
- * for __proto__ and has a buggy typed array implementation.
5395
- */
5396
- Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
5397
-
5398
- if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
5399
- typeof console.error === 'function') {
5400
- console.error(
5401
- 'This browser lacks typed array (Uint8Array) support which is required by ' +
5402
- '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
5403
- )
5404
- }
5405
-
5406
- function typedArraySupport () {
5407
- // Can typed array instances can be augmented?
5408
- try {
5409
- var arr = new Uint8Array(1)
5410
- var proto = { foo: function () { return 42 } }
5411
- Object.setPrototypeOf(proto, Uint8Array.prototype)
5412
- Object.setPrototypeOf(arr, proto)
5413
- return arr.foo() === 42
5414
- } catch (e) {
5415
- return false
5416
- }
5417
- }
5418
-
5419
- Object.defineProperty(Buffer.prototype, 'parent', {
5420
- enumerable: true,
5421
- get: function () {
5422
- if (!Buffer.isBuffer(this)) return undefined
5423
- return this.buffer
5424
- }
5425
- })
5426
-
5427
- Object.defineProperty(Buffer.prototype, 'offset', {
5428
- enumerable: true,
5429
- get: function () {
5430
- if (!Buffer.isBuffer(this)) return undefined
5431
- return this.byteOffset
5432
- }
5433
- })
5434
-
5435
- function createBuffer (length) {
5436
- if (length > K_MAX_LENGTH) {
5437
- throw new RangeError('The value "' + length + '" is invalid for option "size"')
5438
- }
5439
- // Return an augmented `Uint8Array` instance
5440
- var buf = new Uint8Array(length)
5441
- Object.setPrototypeOf(buf, Buffer.prototype)
5442
- return buf
5443
- }
5444
-
5445
- /**
5446
- * The Buffer constructor returns instances of `Uint8Array` that have their
5447
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
5448
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
5449
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
5450
- * returns a single octet.
5451
- *
5452
- * The `Uint8Array` prototype remains unmodified.
5453
- */
5454
-
5455
- function Buffer (arg, encodingOrOffset, length) {
5456
- // Common case.
5457
- if (typeof arg === 'number') {
5458
- if (typeof encodingOrOffset === 'string') {
5459
- throw new TypeError(
5460
- 'The "string" argument must be of type string. Received type number'
5461
- )
5462
- }
5463
- return allocUnsafe(arg)
5464
- }
5465
- return from(arg, encodingOrOffset, length)
5466
- }
5467
-
5468
- Buffer.poolSize = 8192 // not used by this implementation
5469
-
5470
- function from (value, encodingOrOffset, length) {
5471
- if (typeof value === 'string') {
5472
- return fromString(value, encodingOrOffset)
5473
- }
5474
-
5475
- if (ArrayBuffer.isView(value)) {
5476
- return fromArrayView(value)
5477
- }
5478
-
5479
- if (value == null) {
5480
- throw new TypeError(
5481
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
5482
- 'or Array-like Object. Received type ' + (typeof value)
5483
- )
5484
- }
5485
-
5486
- if (isInstance(value, ArrayBuffer) ||
5487
- (value && isInstance(value.buffer, ArrayBuffer))) {
5488
- return fromArrayBuffer(value, encodingOrOffset, length)
5489
- }
5490
-
5491
- if (typeof SharedArrayBuffer !== 'undefined' &&
5492
- (isInstance(value, SharedArrayBuffer) ||
5493
- (value && isInstance(value.buffer, SharedArrayBuffer)))) {
5494
- return fromArrayBuffer(value, encodingOrOffset, length)
5495
- }
5496
-
5497
- if (typeof value === 'number') {
5498
- throw new TypeError(
5499
- 'The "value" argument must not be of type number. Received type number'
5500
- )
5501
- }
5502
-
5503
- var valueOf = value.valueOf && value.valueOf()
5504
- if (valueOf != null && valueOf !== value) {
5505
- return Buffer.from(valueOf, encodingOrOffset, length)
5506
- }
5507
-
5508
- var b = fromObject(value)
5509
- if (b) return b
5510
-
5511
- if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
5512
- typeof value[Symbol.toPrimitive] === 'function') {
5513
- return Buffer.from(
5514
- value[Symbol.toPrimitive]('string'), encodingOrOffset, length
5515
- )
5516
- }
5517
-
5518
- throw new TypeError(
5519
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
5520
- 'or Array-like Object. Received type ' + (typeof value)
5521
- )
5522
- }
5523
-
5524
- /**
5525
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
5526
- * if value is a number.
5527
- * Buffer.from(str[, encoding])
5528
- * Buffer.from(array)
5529
- * Buffer.from(buffer)
5530
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
5531
- **/
5532
- Buffer.from = function (value, encodingOrOffset, length) {
5533
- return from(value, encodingOrOffset, length)
5534
- }
5535
-
5536
- // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
5537
- // https://github.com/feross/buffer/pull/148
5538
- Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
5539
- Object.setPrototypeOf(Buffer, Uint8Array)
5540
-
5541
- function assertSize (size) {
5542
- if (typeof size !== 'number') {
5543
- throw new TypeError('"size" argument must be of type number')
5544
- } else if (size < 0) {
5545
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
5546
- }
5547
- }
5548
-
5549
- function alloc (size, fill, encoding) {
5550
- assertSize(size)
5551
- if (size <= 0) {
5552
- return createBuffer(size)
5553
- }
5554
- if (fill !== undefined) {
5555
- // Only pay attention to encoding if it's a string. This
5556
- // prevents accidentally sending in a number that would
5557
- // be interpreted as a start offset.
5558
- return typeof encoding === 'string'
5559
- ? createBuffer(size).fill(fill, encoding)
5560
- : createBuffer(size).fill(fill)
5561
- }
5562
- return createBuffer(size)
5563
- }
5564
-
5565
- /**
5566
- * Creates a new filled Buffer instance.
5567
- * alloc(size[, fill[, encoding]])
5568
- **/
5569
- Buffer.alloc = function (size, fill, encoding) {
5570
- return alloc(size, fill, encoding)
5571
- }
5572
-
5573
- function allocUnsafe (size) {
5574
- assertSize(size)
5575
- return createBuffer(size < 0 ? 0 : checked(size) | 0)
5576
- }
5577
-
5578
- /**
5579
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
5580
- * */
5581
- Buffer.allocUnsafe = function (size) {
5582
- return allocUnsafe(size)
5583
- }
5584
- /**
5585
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
5586
- */
5587
- Buffer.allocUnsafeSlow = function (size) {
5588
- return allocUnsafe(size)
5589
- }
5590
-
5591
- function fromString (string, encoding) {
5592
- if (typeof encoding !== 'string' || encoding === '') {
5593
- encoding = 'utf8'
5594
- }
5595
-
5596
- if (!Buffer.isEncoding(encoding)) {
5597
- throw new TypeError('Unknown encoding: ' + encoding)
5598
- }
5599
-
5600
- var length = byteLength(string, encoding) | 0
5601
- var buf = createBuffer(length)
5602
-
5603
- var actual = buf.write(string, encoding)
5604
-
5605
- if (actual !== length) {
5606
- // Writing a hex string, for example, that contains invalid characters will
5607
- // cause everything after the first invalid character to be ignored. (e.g.
5608
- // 'abxxcd' will be treated as 'ab')
5609
- buf = buf.slice(0, actual)
5610
- }
5611
-
5612
- return buf
5613
- }
5614
-
5615
- function fromArrayLike (array) {
5616
- var length = array.length < 0 ? 0 : checked(array.length) | 0
5617
- var buf = createBuffer(length)
5618
- for (var i = 0; i < length; i += 1) {
5619
- buf[i] = array[i] & 255
5620
- }
5621
- return buf
5622
- }
5623
-
5624
- function fromArrayView (arrayView) {
5625
- if (isInstance(arrayView, Uint8Array)) {
5626
- var copy = new Uint8Array(arrayView)
5627
- return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
5628
- }
5629
- return fromArrayLike(arrayView)
5630
- }
5631
-
5632
- function fromArrayBuffer (array, byteOffset, length) {
5633
- if (byteOffset < 0 || array.byteLength < byteOffset) {
5634
- throw new RangeError('"offset" is outside of buffer bounds')
5635
- }
5636
-
5637
- if (array.byteLength < byteOffset + (length || 0)) {
5638
- throw new RangeError('"length" is outside of buffer bounds')
5639
- }
5640
-
5641
- var buf
5642
- if (byteOffset === undefined && length === undefined) {
5643
- buf = new Uint8Array(array)
5644
- } else if (length === undefined) {
5645
- buf = new Uint8Array(array, byteOffset)
5646
- } else {
5647
- buf = new Uint8Array(array, byteOffset, length)
5648
- }
5649
-
5650
- // Return an augmented `Uint8Array` instance
5651
- Object.setPrototypeOf(buf, Buffer.prototype)
5652
-
5653
- return buf
5654
- }
5655
-
5656
- function fromObject (obj) {
5657
- if (Buffer.isBuffer(obj)) {
5658
- var len = checked(obj.length) | 0
5659
- var buf = createBuffer(len)
5660
-
5661
- if (buf.length === 0) {
5662
- return buf
5663
- }
5664
-
5665
- obj.copy(buf, 0, 0, len)
5666
- return buf
5667
- }
5668
-
5669
- if (obj.length !== undefined) {
5670
- if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
5671
- return createBuffer(0)
5672
- }
5673
- return fromArrayLike(obj)
5674
- }
5675
-
5676
- if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
5677
- return fromArrayLike(obj.data)
5678
- }
5679
- }
5680
-
5681
- function checked (length) {
5682
- // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
5683
- // length is NaN (which is otherwise coerced to zero.)
5684
- if (length >= K_MAX_LENGTH) {
5685
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
5686
- 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
5687
- }
5688
- return length | 0
5689
- }
5690
-
5691
- function SlowBuffer (length) {
5692
- if (+length != length) { // eslint-disable-line eqeqeq
5693
- length = 0
5694
- }
5695
- return Buffer.alloc(+length)
5696
- }
5697
-
5698
- Buffer.isBuffer = function isBuffer (b) {
5699
- return b != null && b._isBuffer === true &&
5700
- b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
5701
- }
5702
-
5703
- Buffer.compare = function compare (a, b) {
5704
- if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
5705
- if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
5706
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
5707
- throw new TypeError(
5708
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
5709
- )
5710
- }
5711
-
5712
- if (a === b) return 0
5713
-
5714
- var x = a.length
5715
- var y = b.length
5716
-
5717
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
5718
- if (a[i] !== b[i]) {
5719
- x = a[i]
5720
- y = b[i]
5721
- break
5722
- }
5723
- }
5724
-
5725
- if (x < y) return -1
5726
- if (y < x) return 1
5727
- return 0
5728
- }
5729
-
5730
- Buffer.isEncoding = function isEncoding (encoding) {
5731
- switch (String(encoding).toLowerCase()) {
5732
- case 'hex':
5733
- case 'utf8':
5734
- case 'utf-8':
5735
- case 'ascii':
5736
- case 'latin1':
5737
- case 'binary':
5738
- case 'base64':
5739
- case 'ucs2':
5740
- case 'ucs-2':
5741
- case 'utf16le':
5742
- case 'utf-16le':
5743
- return true
5744
- default:
5745
- return false
5746
- }
5747
- }
5748
-
5749
- Buffer.concat = function concat (list, length) {
5750
- if (!Array.isArray(list)) {
5751
- throw new TypeError('"list" argument must be an Array of Buffers')
5752
- }
5753
-
5754
- if (list.length === 0) {
5755
- return Buffer.alloc(0)
5756
- }
5757
-
5758
- var i
5759
- if (length === undefined) {
5760
- length = 0
5761
- for (i = 0; i < list.length; ++i) {
5762
- length += list[i].length
5763
- }
5764
- }
5765
-
5766
- var buffer = Buffer.allocUnsafe(length)
5767
- var pos = 0
5768
- for (i = 0; i < list.length; ++i) {
5769
- var buf = list[i]
5770
- if (isInstance(buf, Uint8Array)) {
5771
- if (pos + buf.length > buffer.length) {
5772
- Buffer.from(buf).copy(buffer, pos)
5773
- } else {
5774
- Uint8Array.prototype.set.call(
5775
- buffer,
5776
- buf,
5777
- pos
5778
- )
5779
- }
5780
- } else if (!Buffer.isBuffer(buf)) {
5781
- throw new TypeError('"list" argument must be an Array of Buffers')
5782
- } else {
5783
- buf.copy(buffer, pos)
5784
- }
5785
- pos += buf.length
5786
- }
5787
- return buffer
5788
- }
5789
-
5790
- function byteLength (string, encoding) {
5791
- if (Buffer.isBuffer(string)) {
5792
- return string.length
5793
- }
5794
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
5795
- return string.byteLength
5796
- }
5797
- if (typeof string !== 'string') {
5798
- throw new TypeError(
5799
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
5800
- 'Received type ' + typeof string
5801
- )
5802
- }
5803
-
5804
- var len = string.length
5805
- var mustMatch = (arguments.length > 2 && arguments[2] === true)
5806
- if (!mustMatch && len === 0) return 0
5807
-
5808
- // Use a for loop to avoid recursion
5809
- var loweredCase = false
5810
- for (;;) {
5811
- switch (encoding) {
5812
- case 'ascii':
5813
- case 'latin1':
5814
- case 'binary':
5815
- return len
5816
- case 'utf8':
5817
- case 'utf-8':
5818
- return utf8ToBytes(string).length
5819
- case 'ucs2':
5820
- case 'ucs-2':
5821
- case 'utf16le':
5822
- case 'utf-16le':
5823
- return len * 2
5824
- case 'hex':
5825
- return len >>> 1
5826
- case 'base64':
5827
- return base64ToBytes(string).length
5828
- default:
5829
- if (loweredCase) {
5830
- return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
5831
- }
5832
- encoding = ('' + encoding).toLowerCase()
5833
- loweredCase = true
5834
- }
5835
- }
5836
- }
5837
- Buffer.byteLength = byteLength
5838
-
5839
- function slowToString (encoding, start, end) {
5840
- var loweredCase = false
5841
-
5842
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
5843
- // property of a typed array.
5844
-
5845
- // This behaves neither like String nor Uint8Array in that we set start/end
5846
- // to their upper/lower bounds if the value passed is out of range.
5847
- // undefined is handled specially as per ECMA-262 6th Edition,
5848
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
5849
- if (start === undefined || start < 0) {
5850
- start = 0
5851
- }
5852
- // Return early if start > this.length. Done here to prevent potential uint32
5853
- // coercion fail below.
5854
- if (start > this.length) {
5855
- return ''
5856
- }
5857
-
5858
- if (end === undefined || end > this.length) {
5859
- end = this.length
5860
- }
5861
-
5862
- if (end <= 0) {
5863
- return ''
5864
- }
5865
-
5866
- // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
5867
- end >>>= 0
5868
- start >>>= 0
5869
-
5870
- if (end <= start) {
5871
- return ''
5872
- }
5873
-
5874
- if (!encoding) encoding = 'utf8'
5875
-
5876
- while (true) {
5877
- switch (encoding) {
5878
- case 'hex':
5879
- return hexSlice(this, start, end)
5880
-
5881
- case 'utf8':
5882
- case 'utf-8':
5883
- return utf8Slice(this, start, end)
5884
-
5885
- case 'ascii':
5886
- return asciiSlice(this, start, end)
5887
-
5888
- case 'latin1':
5889
- case 'binary':
5890
- return latin1Slice(this, start, end)
5891
-
5892
- case 'base64':
5893
- return base64Slice(this, start, end)
5894
-
5895
- case 'ucs2':
5896
- case 'ucs-2':
5897
- case 'utf16le':
5898
- case 'utf-16le':
5899
- return utf16leSlice(this, start, end)
5900
-
5901
- default:
5902
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5903
- encoding = (encoding + '').toLowerCase()
5904
- loweredCase = true
5905
- }
5906
- }
5907
- }
5908
-
5909
- // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
5910
- // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
5911
- // reliably in a browserify context because there could be multiple different
5912
- // copies of the 'buffer' package in use. This method works even for Buffer
5913
- // instances that were created from another copy of the `buffer` package.
5914
- // See: https://github.com/feross/buffer/issues/154
5915
- Buffer.prototype._isBuffer = true
5916
-
5917
- function swap (b, n, m) {
5918
- var i = b[n]
5919
- b[n] = b[m]
5920
- b[m] = i
5921
- }
5922
-
5923
- Buffer.prototype.swap16 = function swap16 () {
5924
- var len = this.length
5925
- if (len % 2 !== 0) {
5926
- throw new RangeError('Buffer size must be a multiple of 16-bits')
5927
- }
5928
- for (var i = 0; i < len; i += 2) {
5929
- swap(this, i, i + 1)
5930
- }
5931
- return this
5932
- }
5933
-
5934
- Buffer.prototype.swap32 = function swap32 () {
5935
- var len = this.length
5936
- if (len % 4 !== 0) {
5937
- throw new RangeError('Buffer size must be a multiple of 32-bits')
5938
- }
5939
- for (var i = 0; i < len; i += 4) {
5940
- swap(this, i, i + 3)
5941
- swap(this, i + 1, i + 2)
5942
- }
5943
- return this
5944
- }
5945
-
5946
- Buffer.prototype.swap64 = function swap64 () {
5947
- var len = this.length
5948
- if (len % 8 !== 0) {
5949
- throw new RangeError('Buffer size must be a multiple of 64-bits')
5950
- }
5951
- for (var i = 0; i < len; i += 8) {
5952
- swap(this, i, i + 7)
5953
- swap(this, i + 1, i + 6)
5954
- swap(this, i + 2, i + 5)
5955
- swap(this, i + 3, i + 4)
5956
- }
5957
- return this
5958
- }
5959
-
5960
- Buffer.prototype.toString = function toString () {
5961
- var length = this.length
5962
- if (length === 0) return ''
5963
- if (arguments.length === 0) return utf8Slice(this, 0, length)
5964
- return slowToString.apply(this, arguments)
5965
- }
5966
-
5967
- Buffer.prototype.toLocaleString = Buffer.prototype.toString
5968
-
5969
- Buffer.prototype.equals = function equals (b) {
5970
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
5971
- if (this === b) return true
5972
- return Buffer.compare(this, b) === 0
5973
- }
5974
-
5975
- Buffer.prototype.inspect = function inspect () {
5976
- var str = ''
5977
- var max = exports.h2
5978
- str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
5979
- if (this.length > max) str += ' ... '
5980
- return '<Buffer ' + str + '>'
5981
- }
5982
- if (customInspectSymbol) {
5983
- Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
5984
- }
5985
-
5986
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
5987
- if (isInstance(target, Uint8Array)) {
5988
- target = Buffer.from(target, target.offset, target.byteLength)
5989
- }
5990
- if (!Buffer.isBuffer(target)) {
5991
- throw new TypeError(
5992
- 'The "target" argument must be one of type Buffer or Uint8Array. ' +
5993
- 'Received type ' + (typeof target)
5994
- )
5995
- }
5996
-
5997
- if (start === undefined) {
5998
- start = 0
5999
- }
6000
- if (end === undefined) {
6001
- end = target ? target.length : 0
6002
- }
6003
- if (thisStart === undefined) {
6004
- thisStart = 0
6005
- }
6006
- if (thisEnd === undefined) {
6007
- thisEnd = this.length
6008
- }
6009
-
6010
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
6011
- throw new RangeError('out of range index')
6012
- }
6013
-
6014
- if (thisStart >= thisEnd && start >= end) {
6015
- return 0
6016
- }
6017
- if (thisStart >= thisEnd) {
6018
- return -1
6019
- }
6020
- if (start >= end) {
6021
- return 1
6022
- }
6023
-
6024
- start >>>= 0
6025
- end >>>= 0
6026
- thisStart >>>= 0
6027
- thisEnd >>>= 0
6028
-
6029
- if (this === target) return 0
6030
-
6031
- var x = thisEnd - thisStart
6032
- var y = end - start
6033
- var len = Math.min(x, y)
6034
-
6035
- var thisCopy = this.slice(thisStart, thisEnd)
6036
- var targetCopy = target.slice(start, end)
6037
-
6038
- for (var i = 0; i < len; ++i) {
6039
- if (thisCopy[i] !== targetCopy[i]) {
6040
- x = thisCopy[i]
6041
- y = targetCopy[i]
6042
- break
6043
- }
6044
- }
6045
-
6046
- if (x < y) return -1
6047
- if (y < x) return 1
6048
- return 0
6049
- }
6050
-
6051
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
6052
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
6053
- //
6054
- // Arguments:
6055
- // - buffer - a Buffer to search
6056
- // - val - a string, Buffer, or number
6057
- // - byteOffset - an index into `buffer`; will be clamped to an int32
6058
- // - encoding - an optional encoding, relevant is val is a string
6059
- // - dir - true for indexOf, false for lastIndexOf
6060
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
6061
- // Empty buffer means no match
6062
- if (buffer.length === 0) return -1
6063
-
6064
- // Normalize byteOffset
6065
- if (typeof byteOffset === 'string') {
6066
- encoding = byteOffset
6067
- byteOffset = 0
6068
- } else if (byteOffset > 0x7fffffff) {
6069
- byteOffset = 0x7fffffff
6070
- } else if (byteOffset < -0x80000000) {
6071
- byteOffset = -0x80000000
6072
- }
6073
- byteOffset = +byteOffset // Coerce to Number.
6074
- if (numberIsNaN(byteOffset)) {
6075
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
6076
- byteOffset = dir ? 0 : (buffer.length - 1)
6077
- }
6078
-
6079
- // Normalize byteOffset: negative offsets start from the end of the buffer
6080
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset
6081
- if (byteOffset >= buffer.length) {
6082
- if (dir) return -1
6083
- else byteOffset = buffer.length - 1
6084
- } else if (byteOffset < 0) {
6085
- if (dir) byteOffset = 0
6086
- else return -1
6087
- }
6088
-
6089
- // Normalize val
6090
- if (typeof val === 'string') {
6091
- val = Buffer.from(val, encoding)
6092
- }
6093
-
6094
- // Finally, search either indexOf (if dir is true) or lastIndexOf
6095
- if (Buffer.isBuffer(val)) {
6096
- // Special case: looking for empty string/buffer always fails
6097
- if (val.length === 0) {
6098
- return -1
6099
- }
6100
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
6101
- } else if (typeof val === 'number') {
6102
- val = val & 0xFF // Search for a byte value [0-255]
6103
- if (typeof Uint8Array.prototype.indexOf === 'function') {
6104
- if (dir) {
6105
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
6106
- } else {
6107
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
6108
- }
6109
- }
6110
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
6111
- }
6112
-
6113
- throw new TypeError('val must be string, number or Buffer')
6114
- }
6115
-
6116
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
6117
- var indexSize = 1
6118
- var arrLength = arr.length
6119
- var valLength = val.length
6120
-
6121
- if (encoding !== undefined) {
6122
- encoding = String(encoding).toLowerCase()
6123
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
6124
- encoding === 'utf16le' || encoding === 'utf-16le') {
6125
- if (arr.length < 2 || val.length < 2) {
6126
- return -1
6127
- }
6128
- indexSize = 2
6129
- arrLength /= 2
6130
- valLength /= 2
6131
- byteOffset /= 2
6132
- }
6133
- }
6134
-
6135
- function read (buf, i) {
6136
- if (indexSize === 1) {
6137
- return buf[i]
6138
- } else {
6139
- return buf.readUInt16BE(i * indexSize)
6140
- }
6141
- }
6142
-
6143
- var i
6144
- if (dir) {
6145
- var foundIndex = -1
6146
- for (i = byteOffset; i < arrLength; i++) {
6147
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
6148
- if (foundIndex === -1) foundIndex = i
6149
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
6150
- } else {
6151
- if (foundIndex !== -1) i -= i - foundIndex
6152
- foundIndex = -1
6153
- }
6154
- }
6155
- } else {
6156
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
6157
- for (i = byteOffset; i >= 0; i--) {
6158
- var found = true
6159
- for (var j = 0; j < valLength; j++) {
6160
- if (read(arr, i + j) !== read(val, j)) {
6161
- found = false
6162
- break
6163
- }
6164
- }
6165
- if (found) return i
6166
- }
6167
- }
6168
-
6169
- return -1
6170
- }
6171
-
6172
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
6173
- return this.indexOf(val, byteOffset, encoding) !== -1
6174
- }
6175
-
6176
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
6177
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
6178
- }
6179
-
6180
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
6181
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
6182
- }
6183
-
6184
- function hexWrite (buf, string, offset, length) {
6185
- offset = Number(offset) || 0
6186
- var remaining = buf.length - offset
6187
- if (!length) {
6188
- length = remaining
6189
- } else {
6190
- length = Number(length)
6191
- if (length > remaining) {
6192
- length = remaining
6193
- }
6194
- }
6195
-
6196
- var strLen = string.length
6197
-
6198
- if (length > strLen / 2) {
6199
- length = strLen / 2
6200
- }
6201
- for (var i = 0; i < length; ++i) {
6202
- var parsed = parseInt(string.substr(i * 2, 2), 16)
6203
- if (numberIsNaN(parsed)) return i
6204
- buf[offset + i] = parsed
6205
- }
6206
- return i
6207
- }
6208
-
6209
- function utf8Write (buf, string, offset, length) {
6210
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
6211
- }
6212
-
6213
- function asciiWrite (buf, string, offset, length) {
6214
- return blitBuffer(asciiToBytes(string), buf, offset, length)
6215
- }
6216
-
6217
- function base64Write (buf, string, offset, length) {
6218
- return blitBuffer(base64ToBytes(string), buf, offset, length)
6219
- }
6220
-
6221
- function ucs2Write (buf, string, offset, length) {
6222
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
6223
- }
6224
-
6225
- Buffer.prototype.write = function write (string, offset, length, encoding) {
6226
- // Buffer#write(string)
6227
- if (offset === undefined) {
6228
- encoding = 'utf8'
6229
- length = this.length
6230
- offset = 0
6231
- // Buffer#write(string, encoding)
6232
- } else if (length === undefined && typeof offset === 'string') {
6233
- encoding = offset
6234
- length = this.length
6235
- offset = 0
6236
- // Buffer#write(string, offset[, length][, encoding])
6237
- } else if (isFinite(offset)) {
6238
- offset = offset >>> 0
6239
- if (isFinite(length)) {
6240
- length = length >>> 0
6241
- if (encoding === undefined) encoding = 'utf8'
6242
- } else {
6243
- encoding = length
6244
- length = undefined
6245
- }
6246
- } else {
6247
- throw new Error(
6248
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
6249
- )
6250
- }
6251
-
6252
- var remaining = this.length - offset
6253
- if (length === undefined || length > remaining) length = remaining
6254
-
6255
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
6256
- throw new RangeError('Attempt to write outside buffer bounds')
6257
- }
6258
-
6259
- if (!encoding) encoding = 'utf8'
6260
-
6261
- var loweredCase = false
6262
- for (;;) {
6263
- switch (encoding) {
6264
- case 'hex':
6265
- return hexWrite(this, string, offset, length)
6266
-
6267
- case 'utf8':
6268
- case 'utf-8':
6269
- return utf8Write(this, string, offset, length)
6270
-
6271
- case 'ascii':
6272
- case 'latin1':
6273
- case 'binary':
6274
- return asciiWrite(this, string, offset, length)
6275
-
6276
- case 'base64':
6277
- // Warning: maxLength not taken into account in base64Write
6278
- return base64Write(this, string, offset, length)
6279
-
6280
- case 'ucs2':
6281
- case 'ucs-2':
6282
- case 'utf16le':
6283
- case 'utf-16le':
6284
- return ucs2Write(this, string, offset, length)
6285
-
6286
- default:
6287
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
6288
- encoding = ('' + encoding).toLowerCase()
6289
- loweredCase = true
6290
- }
6291
- }
6292
- }
6293
-
6294
- Buffer.prototype.toJSON = function toJSON () {
6295
- return {
6296
- type: 'Buffer',
6297
- data: Array.prototype.slice.call(this._arr || this, 0)
6298
- }
6299
- }
6300
-
6301
- function base64Slice (buf, start, end) {
6302
- if (start === 0 && end === buf.length) {
6303
- return base64.fromByteArray(buf)
6304
- } else {
6305
- return base64.fromByteArray(buf.slice(start, end))
6306
- }
6307
- }
6308
-
6309
- function utf8Slice (buf, start, end) {
6310
- end = Math.min(buf.length, end)
6311
- var res = []
6312
-
6313
- var i = start
6314
- while (i < end) {
6315
- var firstByte = buf[i]
6316
- var codePoint = null
6317
- var bytesPerSequence = (firstByte > 0xEF)
6318
- ? 4
6319
- : (firstByte > 0xDF)
6320
- ? 3
6321
- : (firstByte > 0xBF)
6322
- ? 2
6323
- : 1
6324
-
6325
- if (i + bytesPerSequence <= end) {
6326
- var secondByte, thirdByte, fourthByte, tempCodePoint
6327
-
6328
- switch (bytesPerSequence) {
6329
- case 1:
6330
- if (firstByte < 0x80) {
6331
- codePoint = firstByte
6332
- }
6333
- break
6334
- case 2:
6335
- secondByte = buf[i + 1]
6336
- if ((secondByte & 0xC0) === 0x80) {
6337
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
6338
- if (tempCodePoint > 0x7F) {
6339
- codePoint = tempCodePoint
6340
- }
6341
- }
6342
- break
6343
- case 3:
6344
- secondByte = buf[i + 1]
6345
- thirdByte = buf[i + 2]
6346
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
6347
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
6348
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
6349
- codePoint = tempCodePoint
6350
- }
6351
- }
6352
- break
6353
- case 4:
6354
- secondByte = buf[i + 1]
6355
- thirdByte = buf[i + 2]
6356
- fourthByte = buf[i + 3]
6357
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
6358
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
6359
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
6360
- codePoint = tempCodePoint
6361
- }
6362
- }
6363
- }
6364
- }
6365
-
6366
- if (codePoint === null) {
6367
- // we did not generate a valid codePoint so insert a
6368
- // replacement char (U+FFFD) and advance only 1 byte
6369
- codePoint = 0xFFFD
6370
- bytesPerSequence = 1
6371
- } else if (codePoint > 0xFFFF) {
6372
- // encode to utf16 (surrogate pair dance)
6373
- codePoint -= 0x10000
6374
- res.push(codePoint >>> 10 & 0x3FF | 0xD800)
6375
- codePoint = 0xDC00 | codePoint & 0x3FF
6376
- }
6377
-
6378
- res.push(codePoint)
6379
- i += bytesPerSequence
6380
- }
6381
-
6382
- return decodeCodePointsArray(res)
6383
- }
6384
-
6385
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
6386
- // the lowest limit is Chrome, with 0x10000 args.
6387
- // We go 1 magnitude less, for safety
6388
- var MAX_ARGUMENTS_LENGTH = 0x1000
6389
-
6390
- function decodeCodePointsArray (codePoints) {
6391
- var len = codePoints.length
6392
- if (len <= MAX_ARGUMENTS_LENGTH) {
6393
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
6394
- }
6395
-
6396
- // Decode in chunks to avoid "call stack size exceeded".
6397
- var res = ''
6398
- var i = 0
6399
- while (i < len) {
6400
- res += String.fromCharCode.apply(
6401
- String,
6402
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
6403
- )
6404
- }
6405
- return res
6406
- }
6407
-
6408
- function asciiSlice (buf, start, end) {
6409
- var ret = ''
6410
- end = Math.min(buf.length, end)
6411
-
6412
- for (var i = start; i < end; ++i) {
6413
- ret += String.fromCharCode(buf[i] & 0x7F)
6414
- }
6415
- return ret
6416
- }
6417
-
6418
- function latin1Slice (buf, start, end) {
6419
- var ret = ''
6420
- end = Math.min(buf.length, end)
6421
-
6422
- for (var i = start; i < end; ++i) {
6423
- ret += String.fromCharCode(buf[i])
6424
- }
6425
- return ret
6426
- }
6427
-
6428
- function hexSlice (buf, start, end) {
6429
- var len = buf.length
6430
-
6431
- if (!start || start < 0) start = 0
6432
- if (!end || end < 0 || end > len) end = len
6433
-
6434
- var out = ''
6435
- for (var i = start; i < end; ++i) {
6436
- out += hexSliceLookupTable[buf[i]]
6437
- }
6438
- return out
6439
- }
6440
-
6441
- function utf16leSlice (buf, start, end) {
6442
- var bytes = buf.slice(start, end)
6443
- var res = ''
6444
- // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
6445
- for (var i = 0; i < bytes.length - 1; i += 2) {
6446
- res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
6447
- }
6448
- return res
6449
- }
6450
-
6451
- Buffer.prototype.slice = function slice (start, end) {
6452
- var len = this.length
6453
- start = ~~start
6454
- end = end === undefined ? len : ~~end
6455
-
6456
- if (start < 0) {
6457
- start += len
6458
- if (start < 0) start = 0
6459
- } else if (start > len) {
6460
- start = len
6461
- }
6462
-
6463
- if (end < 0) {
6464
- end += len
6465
- if (end < 0) end = 0
6466
- } else if (end > len) {
6467
- end = len
6468
- }
6469
-
6470
- if (end < start) end = start
6471
-
6472
- var newBuf = this.subarray(start, end)
6473
- // Return an augmented `Uint8Array` instance
6474
- Object.setPrototypeOf(newBuf, Buffer.prototype)
6475
-
6476
- return newBuf
6477
- }
6478
-
6479
- /*
6480
- * Need to make sure that buffer isn't trying to write out of bounds.
6481
- */
6482
- function checkOffset (offset, ext, length) {
6483
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
6484
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
6485
- }
6486
-
6487
- Buffer.prototype.readUintLE =
6488
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
6489
- offset = offset >>> 0
6490
- byteLength = byteLength >>> 0
6491
- if (!noAssert) checkOffset(offset, byteLength, this.length)
6492
-
6493
- var val = this[offset]
6494
- var mul = 1
6495
- var i = 0
6496
- while (++i < byteLength && (mul *= 0x100)) {
6497
- val += this[offset + i] * mul
6498
- }
6499
-
6500
- return val
6501
- }
6502
-
6503
- Buffer.prototype.readUintBE =
6504
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
6505
- offset = offset >>> 0
6506
- byteLength = byteLength >>> 0
6507
- if (!noAssert) {
6508
- checkOffset(offset, byteLength, this.length)
6509
- }
6510
-
6511
- var val = this[offset + --byteLength]
6512
- var mul = 1
6513
- while (byteLength > 0 && (mul *= 0x100)) {
6514
- val += this[offset + --byteLength] * mul
6515
- }
6516
-
6517
- return val
6518
- }
6519
-
6520
- Buffer.prototype.readUint8 =
6521
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
6522
- offset = offset >>> 0
6523
- if (!noAssert) checkOffset(offset, 1, this.length)
6524
- return this[offset]
6525
- }
6526
-
6527
- Buffer.prototype.readUint16LE =
6528
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
6529
- offset = offset >>> 0
6530
- if (!noAssert) checkOffset(offset, 2, this.length)
6531
- return this[offset] | (this[offset + 1] << 8)
6532
- }
6533
-
6534
- Buffer.prototype.readUint16BE =
6535
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
6536
- offset = offset >>> 0
6537
- if (!noAssert) checkOffset(offset, 2, this.length)
6538
- return (this[offset] << 8) | this[offset + 1]
6539
- }
6540
-
6541
- Buffer.prototype.readUint32LE =
6542
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
6543
- offset = offset >>> 0
6544
- if (!noAssert) checkOffset(offset, 4, this.length)
6545
-
6546
- return ((this[offset]) |
6547
- (this[offset + 1] << 8) |
6548
- (this[offset + 2] << 16)) +
6549
- (this[offset + 3] * 0x1000000)
6550
- }
6551
-
6552
- Buffer.prototype.readUint32BE =
6553
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
6554
- offset = offset >>> 0
6555
- if (!noAssert) checkOffset(offset, 4, this.length)
6556
-
6557
- return (this[offset] * 0x1000000) +
6558
- ((this[offset + 1] << 16) |
6559
- (this[offset + 2] << 8) |
6560
- this[offset + 3])
6561
- }
6562
-
6563
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
6564
- offset = offset >>> 0
6565
- byteLength = byteLength >>> 0
6566
- if (!noAssert) checkOffset(offset, byteLength, this.length)
6567
-
6568
- var val = this[offset]
6569
- var mul = 1
6570
- var i = 0
6571
- while (++i < byteLength && (mul *= 0x100)) {
6572
- val += this[offset + i] * mul
6573
- }
6574
- mul *= 0x80
6575
-
6576
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
6577
-
6578
- return val
6579
- }
6580
-
6581
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
6582
- offset = offset >>> 0
6583
- byteLength = byteLength >>> 0
6584
- if (!noAssert) checkOffset(offset, byteLength, this.length)
6585
-
6586
- var i = byteLength
6587
- var mul = 1
6588
- var val = this[offset + --i]
6589
- while (i > 0 && (mul *= 0x100)) {
6590
- val += this[offset + --i] * mul
6591
- }
6592
- mul *= 0x80
6593
-
6594
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
6595
-
6596
- return val
6597
- }
6598
-
6599
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
6600
- offset = offset >>> 0
6601
- if (!noAssert) checkOffset(offset, 1, this.length)
6602
- if (!(this[offset] & 0x80)) return (this[offset])
6603
- return ((0xff - this[offset] + 1) * -1)
6604
- }
6605
-
6606
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
6607
- offset = offset >>> 0
6608
- if (!noAssert) checkOffset(offset, 2, this.length)
6609
- var val = this[offset] | (this[offset + 1] << 8)
6610
- return (val & 0x8000) ? val | 0xFFFF0000 : val
6611
- }
6612
-
6613
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
6614
- offset = offset >>> 0
6615
- if (!noAssert) checkOffset(offset, 2, this.length)
6616
- var val = this[offset + 1] | (this[offset] << 8)
6617
- return (val & 0x8000) ? val | 0xFFFF0000 : val
6618
- }
6619
-
6620
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
6621
- offset = offset >>> 0
6622
- if (!noAssert) checkOffset(offset, 4, this.length)
6623
-
6624
- return (this[offset]) |
6625
- (this[offset + 1] << 8) |
6626
- (this[offset + 2] << 16) |
6627
- (this[offset + 3] << 24)
6628
- }
6629
-
6630
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
6631
- offset = offset >>> 0
6632
- if (!noAssert) checkOffset(offset, 4, this.length)
6633
-
6634
- return (this[offset] << 24) |
6635
- (this[offset + 1] << 16) |
6636
- (this[offset + 2] << 8) |
6637
- (this[offset + 3])
6638
- }
6639
-
6640
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
6641
- offset = offset >>> 0
6642
- if (!noAssert) checkOffset(offset, 4, this.length)
6643
- return ieee754.read(this, offset, true, 23, 4)
6644
- }
6645
-
6646
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
6647
- offset = offset >>> 0
6648
- if (!noAssert) checkOffset(offset, 4, this.length)
6649
- return ieee754.read(this, offset, false, 23, 4)
6650
- }
6651
-
6652
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
6653
- offset = offset >>> 0
6654
- if (!noAssert) checkOffset(offset, 8, this.length)
6655
- return ieee754.read(this, offset, true, 52, 8)
6656
- }
6657
-
6658
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
6659
- offset = offset >>> 0
6660
- if (!noAssert) checkOffset(offset, 8, this.length)
6661
- return ieee754.read(this, offset, false, 52, 8)
6662
- }
6663
-
6664
- function checkInt (buf, value, offset, ext, max, min) {
6665
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
6666
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
6667
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
6668
- }
6669
-
6670
- Buffer.prototype.writeUintLE =
6671
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
6672
- value = +value
6673
- offset = offset >>> 0
6674
- byteLength = byteLength >>> 0
6675
- if (!noAssert) {
6676
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
6677
- checkInt(this, value, offset, byteLength, maxBytes, 0)
6678
- }
6679
-
6680
- var mul = 1
6681
- var i = 0
6682
- this[offset] = value & 0xFF
6683
- while (++i < byteLength && (mul *= 0x100)) {
6684
- this[offset + i] = (value / mul) & 0xFF
6685
- }
6686
-
6687
- return offset + byteLength
6688
- }
6689
-
6690
- Buffer.prototype.writeUintBE =
6691
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
6692
- value = +value
6693
- offset = offset >>> 0
6694
- byteLength = byteLength >>> 0
6695
- if (!noAssert) {
6696
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
6697
- checkInt(this, value, offset, byteLength, maxBytes, 0)
6698
- }
6699
-
6700
- var i = byteLength - 1
6701
- var mul = 1
6702
- this[offset + i] = value & 0xFF
6703
- while (--i >= 0 && (mul *= 0x100)) {
6704
- this[offset + i] = (value / mul) & 0xFF
6705
- }
6706
-
6707
- return offset + byteLength
6708
- }
6709
-
6710
- Buffer.prototype.writeUint8 =
6711
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
6712
- value = +value
6713
- offset = offset >>> 0
6714
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
6715
- this[offset] = (value & 0xff)
6716
- return offset + 1
6717
- }
6718
-
6719
- Buffer.prototype.writeUint16LE =
6720
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
6721
- value = +value
6722
- offset = offset >>> 0
6723
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
6724
- this[offset] = (value & 0xff)
6725
- this[offset + 1] = (value >>> 8)
6726
- return offset + 2
6727
- }
6728
-
6729
- Buffer.prototype.writeUint16BE =
6730
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
6731
- value = +value
6732
- offset = offset >>> 0
6733
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
6734
- this[offset] = (value >>> 8)
6735
- this[offset + 1] = (value & 0xff)
6736
- return offset + 2
6737
- }
6738
-
6739
- Buffer.prototype.writeUint32LE =
6740
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
6741
- value = +value
6742
- offset = offset >>> 0
6743
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
6744
- this[offset + 3] = (value >>> 24)
6745
- this[offset + 2] = (value >>> 16)
6746
- this[offset + 1] = (value >>> 8)
6747
- this[offset] = (value & 0xff)
6748
- return offset + 4
6749
- }
6750
-
6751
- Buffer.prototype.writeUint32BE =
6752
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
6753
- value = +value
6754
- offset = offset >>> 0
6755
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
6756
- this[offset] = (value >>> 24)
6757
- this[offset + 1] = (value >>> 16)
6758
- this[offset + 2] = (value >>> 8)
6759
- this[offset + 3] = (value & 0xff)
6760
- return offset + 4
6761
- }
6762
-
6763
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
6764
- value = +value
6765
- offset = offset >>> 0
6766
- if (!noAssert) {
6767
- var limit = Math.pow(2, (8 * byteLength) - 1)
6768
-
6769
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
6770
- }
6771
-
6772
- var i = 0
6773
- var mul = 1
6774
- var sub = 0
6775
- this[offset] = value & 0xFF
6776
- while (++i < byteLength && (mul *= 0x100)) {
6777
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
6778
- sub = 1
6779
- }
6780
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
6781
- }
6782
-
6783
- return offset + byteLength
6784
- }
6785
-
6786
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
6787
- value = +value
6788
- offset = offset >>> 0
6789
- if (!noAssert) {
6790
- var limit = Math.pow(2, (8 * byteLength) - 1)
6791
-
6792
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
6793
- }
6794
-
6795
- var i = byteLength - 1
6796
- var mul = 1
6797
- var sub = 0
6798
- this[offset + i] = value & 0xFF
6799
- while (--i >= 0 && (mul *= 0x100)) {
6800
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
6801
- sub = 1
6802
- }
6803
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
6804
- }
6805
-
6806
- return offset + byteLength
6807
- }
6808
-
6809
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
6810
- value = +value
6811
- offset = offset >>> 0
6812
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
6813
- if (value < 0) value = 0xff + value + 1
6814
- this[offset] = (value & 0xff)
6815
- return offset + 1
6816
- }
6817
-
6818
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
6819
- value = +value
6820
- offset = offset >>> 0
6821
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
6822
- this[offset] = (value & 0xff)
6823
- this[offset + 1] = (value >>> 8)
6824
- return offset + 2
6825
- }
6826
-
6827
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
6828
- value = +value
6829
- offset = offset >>> 0
6830
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
6831
- this[offset] = (value >>> 8)
6832
- this[offset + 1] = (value & 0xff)
6833
- return offset + 2
6834
- }
6835
-
6836
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
6837
- value = +value
6838
- offset = offset >>> 0
6839
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
6840
- this[offset] = (value & 0xff)
6841
- this[offset + 1] = (value >>> 8)
6842
- this[offset + 2] = (value >>> 16)
6843
- this[offset + 3] = (value >>> 24)
6844
- return offset + 4
6845
- }
6846
-
6847
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
6848
- value = +value
6849
- offset = offset >>> 0
6850
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
6851
- if (value < 0) value = 0xffffffff + value + 1
6852
- this[offset] = (value >>> 24)
6853
- this[offset + 1] = (value >>> 16)
6854
- this[offset + 2] = (value >>> 8)
6855
- this[offset + 3] = (value & 0xff)
6856
- return offset + 4
6857
- }
6858
-
6859
- function checkIEEE754 (buf, value, offset, ext, max, min) {
6860
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
6861
- if (offset < 0) throw new RangeError('Index out of range')
6862
- }
6863
-
6864
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
6865
- value = +value
6866
- offset = offset >>> 0
6867
- if (!noAssert) {
6868
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
6869
- }
6870
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
6871
- return offset + 4
6872
- }
6873
-
6874
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
6875
- return writeFloat(this, value, offset, true, noAssert)
6876
- }
6877
-
6878
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
6879
- return writeFloat(this, value, offset, false, noAssert)
6880
- }
6881
-
6882
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
6883
- value = +value
6884
- offset = offset >>> 0
6885
- if (!noAssert) {
6886
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
6887
- }
6888
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
6889
- return offset + 8
6890
- }
6891
-
6892
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
6893
- return writeDouble(this, value, offset, true, noAssert)
6894
- }
6895
-
6896
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
6897
- return writeDouble(this, value, offset, false, noAssert)
6898
- }
6899
-
6900
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
6901
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
6902
- if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
6903
- if (!start) start = 0
6904
- if (!end && end !== 0) end = this.length
6905
- if (targetStart >= target.length) targetStart = target.length
6906
- if (!targetStart) targetStart = 0
6907
- if (end > 0 && end < start) end = start
6908
-
6909
- // Copy 0 bytes; we're done
6910
- if (end === start) return 0
6911
- if (target.length === 0 || this.length === 0) return 0
6912
-
6913
- // Fatal error conditions
6914
- if (targetStart < 0) {
6915
- throw new RangeError('targetStart out of bounds')
6916
- }
6917
- if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
6918
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
6919
-
6920
- // Are we oob?
6921
- if (end > this.length) end = this.length
6922
- if (target.length - targetStart < end - start) {
6923
- end = target.length - targetStart + start
6924
- }
6925
-
6926
- var len = end - start
6927
-
6928
- if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
6929
- // Use built-in when available, missing from IE11
6930
- this.copyWithin(targetStart, start, end)
6931
- } else {
6932
- Uint8Array.prototype.set.call(
6933
- target,
6934
- this.subarray(start, end),
6935
- targetStart
6936
- )
6937
- }
6938
-
6939
- return len
6940
- }
6941
-
6942
- // Usage:
6943
- // buffer.fill(number[, offset[, end]])
6944
- // buffer.fill(buffer[, offset[, end]])
6945
- // buffer.fill(string[, offset[, end]][, encoding])
6946
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
6947
- // Handle string cases:
6948
- if (typeof val === 'string') {
6949
- if (typeof start === 'string') {
6950
- encoding = start
6951
- start = 0
6952
- end = this.length
6953
- } else if (typeof end === 'string') {
6954
- encoding = end
6955
- end = this.length
6956
- }
6957
- if (encoding !== undefined && typeof encoding !== 'string') {
6958
- throw new TypeError('encoding must be a string')
6959
- }
6960
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
6961
- throw new TypeError('Unknown encoding: ' + encoding)
6962
- }
6963
- if (val.length === 1) {
6964
- var code = val.charCodeAt(0)
6965
- if ((encoding === 'utf8' && code < 128) ||
6966
- encoding === 'latin1') {
6967
- // Fast path: If `val` fits into a single byte, use that numeric value.
6968
- val = code
6969
- }
6970
- }
6971
- } else if (typeof val === 'number') {
6972
- val = val & 255
6973
- } else if (typeof val === 'boolean') {
6974
- val = Number(val)
6975
- }
6976
-
6977
- // Invalid ranges are not set to a default, so can range check early.
6978
- if (start < 0 || this.length < start || this.length < end) {
6979
- throw new RangeError('Out of range index')
6980
- }
6981
-
6982
- if (end <= start) {
6983
- return this
6984
- }
6985
-
6986
- start = start >>> 0
6987
- end = end === undefined ? this.length : end >>> 0
6988
-
6989
- if (!val) val = 0
6990
-
6991
- var i
6992
- if (typeof val === 'number') {
6993
- for (i = start; i < end; ++i) {
6994
- this[i] = val
6995
- }
6996
- } else {
6997
- var bytes = Buffer.isBuffer(val)
6998
- ? val
6999
- : Buffer.from(val, encoding)
7000
- var len = bytes.length
7001
- if (len === 0) {
7002
- throw new TypeError('The value "' + val +
7003
- '" is invalid for argument "value"')
7004
- }
7005
- for (i = 0; i < end - start; ++i) {
7006
- this[i + start] = bytes[i % len]
7007
- }
7008
- }
7009
-
7010
- return this
7011
- }
7012
-
7013
- // HELPER FUNCTIONS
7014
- // ================
7015
-
7016
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
7017
-
7018
- function base64clean (str) {
7019
- // Node takes equal signs as end of the Base64 encoding
7020
- str = str.split('=')[0]
7021
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
7022
- str = str.trim().replace(INVALID_BASE64_RE, '')
7023
- // Node converts strings with length < 2 to ''
7024
- if (str.length < 2) return ''
7025
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
7026
- while (str.length % 4 !== 0) {
7027
- str = str + '='
7028
- }
7029
- return str
7030
- }
7031
-
7032
- function utf8ToBytes (string, units) {
7033
- units = units || Infinity
7034
- var codePoint
7035
- var length = string.length
7036
- var leadSurrogate = null
7037
- var bytes = []
7038
-
7039
- for (var i = 0; i < length; ++i) {
7040
- codePoint = string.charCodeAt(i)
7041
-
7042
- // is surrogate component
7043
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
7044
- // last char was a lead
7045
- if (!leadSurrogate) {
7046
- // no lead yet
7047
- if (codePoint > 0xDBFF) {
7048
- // unexpected trail
7049
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
7050
- continue
7051
- } else if (i + 1 === length) {
7052
- // unpaired lead
7053
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
7054
- continue
7055
- }
7056
-
7057
- // valid lead
7058
- leadSurrogate = codePoint
7059
-
7060
- continue
7061
- }
7062
-
7063
- // 2 leads in a row
7064
- if (codePoint < 0xDC00) {
7065
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
7066
- leadSurrogate = codePoint
7067
- continue
7068
- }
7069
-
7070
- // valid surrogate pair
7071
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
7072
- } else if (leadSurrogate) {
7073
- // valid bmp char, but last char was a lead
7074
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
7075
- }
7076
-
7077
- leadSurrogate = null
7078
-
7079
- // encode utf8
7080
- if (codePoint < 0x80) {
7081
- if ((units -= 1) < 0) break
7082
- bytes.push(codePoint)
7083
- } else if (codePoint < 0x800) {
7084
- if ((units -= 2) < 0) break
7085
- bytes.push(
7086
- codePoint >> 0x6 | 0xC0,
7087
- codePoint & 0x3F | 0x80
7088
- )
7089
- } else if (codePoint < 0x10000) {
7090
- if ((units -= 3) < 0) break
7091
- bytes.push(
7092
- codePoint >> 0xC | 0xE0,
7093
- codePoint >> 0x6 & 0x3F | 0x80,
7094
- codePoint & 0x3F | 0x80
7095
- )
7096
- } else if (codePoint < 0x110000) {
7097
- if ((units -= 4) < 0) break
7098
- bytes.push(
7099
- codePoint >> 0x12 | 0xF0,
7100
- codePoint >> 0xC & 0x3F | 0x80,
7101
- codePoint >> 0x6 & 0x3F | 0x80,
7102
- codePoint & 0x3F | 0x80
7103
- )
7104
- } else {
7105
- throw new Error('Invalid code point')
7106
- }
7107
- }
7108
-
7109
- return bytes
7110
- }
7111
-
7112
- function asciiToBytes (str) {
7113
- var byteArray = []
7114
- for (var i = 0; i < str.length; ++i) {
7115
- // Node's code seems to be doing this and not & 0x7F..
7116
- byteArray.push(str.charCodeAt(i) & 0xFF)
7117
- }
7118
- return byteArray
7119
- }
7120
-
7121
- function utf16leToBytes (str, units) {
7122
- var c, hi, lo
7123
- var byteArray = []
7124
- for (var i = 0; i < str.length; ++i) {
7125
- if ((units -= 2) < 0) break
7126
-
7127
- c = str.charCodeAt(i)
7128
- hi = c >> 8
7129
- lo = c % 256
7130
- byteArray.push(lo)
7131
- byteArray.push(hi)
7132
- }
7133
-
7134
- return byteArray
7135
- }
7136
-
7137
- function base64ToBytes (str) {
7138
- return base64.toByteArray(base64clean(str))
7139
- }
7140
-
7141
- function blitBuffer (src, dst, offset, length) {
7142
- for (var i = 0; i < length; ++i) {
7143
- if ((i + offset >= dst.length) || (i >= src.length)) break
7144
- dst[i + offset] = src[i]
7145
- }
7146
- return i
7147
- }
7148
-
7149
- // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
7150
- // the `instanceof` check but they should be treated as of that type.
7151
- // See: https://github.com/feross/buffer/issues/166
7152
- function isInstance (obj, type) {
7153
- return obj instanceof type ||
7154
- (obj != null && obj.constructor != null && obj.constructor.name != null &&
7155
- obj.constructor.name === type.name)
7156
- }
7157
- function numberIsNaN (obj) {
7158
- // For IE11 support
7159
- return obj !== obj // eslint-disable-line no-self-compare
7160
- }
7161
-
7162
- // Create lookup table for `toString('hex')`
7163
- // See: https://github.com/feross/buffer/issues/219
7164
- var hexSliceLookupTable = (function () {
7165
- var alphabet = '0123456789abcdef'
7166
- var table = new Array(256)
7167
- for (var i = 0; i < 16; ++i) {
7168
- var i16 = i * 16
7169
- for (var j = 0; j < 16; ++j) {
7170
- table[i16 + j] = alphabet[i] + alphabet[j]
7171
- }
7172
- }
7173
- return table
7174
- })()
7175
-
7176
-
7177
- /***/ }),
7178
-
7179
- /***/ 75597:
7180
- /***/ ((__unused_webpack_module, exports) => {
7181
-
7182
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
7183
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
7184
- var e, m
7185
- var eLen = (nBytes * 8) - mLen - 1
7186
- var eMax = (1 << eLen) - 1
7187
- var eBias = eMax >> 1
7188
- var nBits = -7
7189
- var i = isLE ? (nBytes - 1) : 0
7190
- var d = isLE ? -1 : 1
7191
- var s = buffer[offset + i]
7192
-
7193
- i += d
7194
-
7195
- e = s & ((1 << (-nBits)) - 1)
7196
- s >>= (-nBits)
7197
- nBits += eLen
7198
- for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
7199
-
7200
- m = e & ((1 << (-nBits)) - 1)
7201
- e >>= (-nBits)
7202
- nBits += mLen
7203
- for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
7204
-
7205
- if (e === 0) {
7206
- e = 1 - eBias
7207
- } else if (e === eMax) {
7208
- return m ? NaN : ((s ? -1 : 1) * Infinity)
7209
- } else {
7210
- m = m + Math.pow(2, mLen)
7211
- e = e - eBias
7212
- }
7213
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
7214
- }
7215
-
7216
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
7217
- var e, m, c
7218
- var eLen = (nBytes * 8) - mLen - 1
7219
- var eMax = (1 << eLen) - 1
7220
- var eBias = eMax >> 1
7221
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
7222
- var i = isLE ? 0 : (nBytes - 1)
7223
- var d = isLE ? 1 : -1
7224
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
7225
-
7226
- value = Math.abs(value)
7227
-
7228
- if (isNaN(value) || value === Infinity) {
7229
- m = isNaN(value) ? 1 : 0
7230
- e = eMax
7231
- } else {
7232
- e = Math.floor(Math.log(value) / Math.LN2)
7233
- if (value * (c = Math.pow(2, -e)) < 1) {
7234
- e--
7235
- c *= 2
7236
- }
7237
- if (e + eBias >= 1) {
7238
- value += rt / c
7239
- } else {
7240
- value += rt * Math.pow(2, 1 - eBias)
7241
- }
7242
- if (value * c >= 2) {
7243
- e++
7244
- c /= 2
7245
- }
7246
-
7247
- if (e + eBias >= eMax) {
7248
- m = 0
7249
- e = eMax
7250
- } else if (e + eBias >= 1) {
7251
- m = ((value * c) - 1) * Math.pow(2, mLen)
7252
- e = e + eBias
7253
- } else {
7254
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
7255
- e = 0
7256
- }
7257
- }
7258
-
7259
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
7260
-
7261
- e = (e << mLen) | m
7262
- eLen += mLen
7263
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
7264
-
7265
- buffer[offset + i - d] |= s * 128
7266
- }
7267
-
7268
-
7269
5193
  /***/ }),
7270
5194
 
7271
5195
  /***/ 27318: