PageSourceSearch

https://app.screenclip.com/npm.buffer.87138570652d9889cbee.js

js screenclip.com collected 2026-09-24 09:06:29 UTC 49,084 bytes, 1,813 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.