@scratch/scratch-render 12.1.0-login-from-editor → 12.1.0-membership-program

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.
@@ -252,89 +252,88 @@ module.exports = "AAEAAAARAQAABAAQRFNJRwAAAAEAAHTYAAAACEZGVE1flIgzAACYwAAAABxHRE
252
252
  /*!
253
253
  * The buffer module from node.js, for the browser.
254
254
  *
255
- * @author Feross Aboukhadijeh <http://feross.org>
255
+ * @author Feross Aboukhadijeh <https://feross.org>
256
256
  * @license MIT
257
257
  */
258
258
  /* eslint-disable no-proto */
259
259
 
260
260
 
261
261
 
262
- var base64 = __webpack_require__(/*! base64-js */ "../../node_modules/base64-js/index.js")
263
- var ieee754 = __webpack_require__(/*! ieee754 */ "../../node_modules/ieee754/index.js")
264
- var isArray = __webpack_require__(/*! isarray */ "../../node_modules/buffer/node_modules/isarray/index.js")
262
+ const base64 = __webpack_require__(/*! base64-js */ "../../node_modules/base64-js/index.js")
263
+ const ieee754 = __webpack_require__(/*! ieee754 */ "../../node_modules/ieee754/index.js")
264
+ const customInspectSymbol =
265
+ (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
266
+ ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
267
+ : null
265
268
 
266
269
  exports.Buffer = Buffer
267
270
  exports.SlowBuffer = SlowBuffer
268
271
  exports.INSPECT_MAX_BYTES = 50
269
272
 
273
+ const K_MAX_LENGTH = 0x7fffffff
274
+ exports.kMaxLength = K_MAX_LENGTH
275
+
270
276
  /**
271
277
  * If `Buffer.TYPED_ARRAY_SUPPORT`:
272
278
  * === true Use Uint8Array implementation (fastest)
273
- * === false Use Object implementation (most compatible, even IE6)
279
+ * === false Print warning and recommend using `buffer` v4.x which has an Object
280
+ * implementation (most compatible, even IE6)
274
281
  *
275
282
  * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
276
283
  * Opera 11.6+, iOS 4.2+.
277
284
  *
278
- * Due to various browser bugs, sometimes the Object implementation will be used even
279
- * when the browser supports typed arrays.
280
- *
281
- * Note:
282
- *
283
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
284
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
285
- *
286
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
287
- *
288
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
289
- * incorrect length in some situations.
290
-
291
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
292
- * get the Object implementation, which is slower but behaves correctly.
285
+ * We report that the browser does not support typed arrays if the are not subclassable
286
+ * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
287
+ * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
288
+ * for __proto__ and has a buggy typed array implementation.
293
289
  */
294
- Buffer.TYPED_ARRAY_SUPPORT = __webpack_require__.g.TYPED_ARRAY_SUPPORT !== undefined
295
- ? __webpack_require__.g.TYPED_ARRAY_SUPPORT
296
- : typedArraySupport()
290
+ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
297
291
 
298
- /*
299
- * Export kMaxLength after typed array support is determined.
300
- */
301
- exports.kMaxLength = kMaxLength()
292
+ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
293
+ typeof console.error === 'function') {
294
+ console.error(
295
+ 'This browser lacks typed array (Uint8Array) support which is required by ' +
296
+ '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
297
+ )
298
+ }
302
299
 
303
300
  function typedArraySupport () {
301
+ // Can typed array instances can be augmented?
304
302
  try {
305
- var arr = new Uint8Array(1)
306
- arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
307
- return arr.foo() === 42 && // typed array instances can be augmented
308
- typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
309
- arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
303
+ const arr = new Uint8Array(1)
304
+ const proto = { foo: function () { return 42 } }
305
+ Object.setPrototypeOf(proto, Uint8Array.prototype)
306
+ Object.setPrototypeOf(arr, proto)
307
+ return arr.foo() === 42
310
308
  } catch (e) {
311
309
  return false
312
310
  }
313
311
  }
314
312
 
315
- function kMaxLength () {
316
- return Buffer.TYPED_ARRAY_SUPPORT
317
- ? 0x7fffffff
318
- : 0x3fffffff
319
- }
320
-
321
- function createBuffer (that, length) {
322
- if (kMaxLength() < length) {
323
- throw new RangeError('Invalid typed array length')
313
+ Object.defineProperty(Buffer.prototype, 'parent', {
314
+ enumerable: true,
315
+ get: function () {
316
+ if (!Buffer.isBuffer(this)) return undefined
317
+ return this.buffer
324
318
  }
325
- if (Buffer.TYPED_ARRAY_SUPPORT) {
326
- // Return an augmented `Uint8Array` instance, for best performance
327
- that = new Uint8Array(length)
328
- that.__proto__ = Buffer.prototype
329
- } else {
330
- // Fallback: Return an object instance of the Buffer class
331
- if (that === null) {
332
- that = new Buffer(length)
333
- }
334
- that.length = length
319
+ })
320
+
321
+ Object.defineProperty(Buffer.prototype, 'offset', {
322
+ enumerable: true,
323
+ get: function () {
324
+ if (!Buffer.isBuffer(this)) return undefined
325
+ return this.byteOffset
335
326
  }
327
+ })
336
328
 
337
- return that
329
+ function createBuffer (length) {
330
+ if (length > K_MAX_LENGTH) {
331
+ throw new RangeError('The value "' + length + '" is invalid for option "size"')
332
+ }
333
+ // Return an augmented `Uint8Array` instance
334
+ const buf = new Uint8Array(length)
335
+ Object.setPrototypeOf(buf, Buffer.prototype)
336
+ return buf
338
337
  }
339
338
 
340
339
  /**
@@ -348,44 +347,70 @@ function createBuffer (that, length) {
348
347
  */
349
348
 
350
349
  function Buffer (arg, encodingOrOffset, length) {
351
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
352
- return new Buffer(arg, encodingOrOffset, length)
353
- }
354
-
355
350
  // Common case.
356
351
  if (typeof arg === 'number') {
357
352
  if (typeof encodingOrOffset === 'string') {
358
- throw new Error(
359
- 'If encoding is specified then the first argument must be a string'
353
+ throw new TypeError(
354
+ 'The "string" argument must be of type string. Received type number'
360
355
  )
361
356
  }
362
- return allocUnsafe(this, arg)
357
+ return allocUnsafe(arg)
363
358
  }
364
- return from(this, arg, encodingOrOffset, length)
359
+ return from(arg, encodingOrOffset, length)
365
360
  }
366
361
 
367
362
  Buffer.poolSize = 8192 // not used by this implementation
368
363
 
369
- // TODO: Legacy, not needed anymore. Remove in next major version.
370
- Buffer._augment = function (arr) {
371
- arr.__proto__ = Buffer.prototype
372
- return arr
373
- }
364
+ function from (value, encodingOrOffset, length) {
365
+ if (typeof value === 'string') {
366
+ return fromString(value, encodingOrOffset)
367
+ }
368
+
369
+ if (ArrayBuffer.isView(value)) {
370
+ return fromArrayView(value)
371
+ }
372
+
373
+ if (value == null) {
374
+ throw new TypeError(
375
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
376
+ 'or Array-like Object. Received type ' + (typeof value)
377
+ )
378
+ }
379
+
380
+ if (isInstance(value, ArrayBuffer) ||
381
+ (value && isInstance(value.buffer, ArrayBuffer))) {
382
+ return fromArrayBuffer(value, encodingOrOffset, length)
383
+ }
384
+
385
+ if (typeof SharedArrayBuffer !== 'undefined' &&
386
+ (isInstance(value, SharedArrayBuffer) ||
387
+ (value && isInstance(value.buffer, SharedArrayBuffer)))) {
388
+ return fromArrayBuffer(value, encodingOrOffset, length)
389
+ }
374
390
 
375
- function from (that, value, encodingOrOffset, length) {
376
391
  if (typeof value === 'number') {
377
- throw new TypeError('"value" argument must not be a number')
392
+ throw new TypeError(
393
+ 'The "value" argument must not be of type number. Received type number'
394
+ )
378
395
  }
379
396
 
380
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
381
- return fromArrayBuffer(that, value, encodingOrOffset, length)
397
+ const valueOf = value.valueOf && value.valueOf()
398
+ if (valueOf != null && valueOf !== value) {
399
+ return Buffer.from(valueOf, encodingOrOffset, length)
382
400
  }
383
401
 
384
- if (typeof value === 'string') {
385
- return fromString(that, value, encodingOrOffset)
402
+ const b = fromObject(value)
403
+ if (b) return b
404
+
405
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
406
+ typeof value[Symbol.toPrimitive] === 'function') {
407
+ return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
386
408
  }
387
409
 
388
- return fromObject(that, value)
410
+ throw new TypeError(
411
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
412
+ 'or Array-like Object. Received type ' + (typeof value)
413
+ )
389
414
  }
390
415
 
391
416
  /**
@@ -397,44 +422,36 @@ function from (that, value, encodingOrOffset, length) {
397
422
  * Buffer.from(arrayBuffer[, byteOffset[, length]])
398
423
  **/
399
424
  Buffer.from = function (value, encodingOrOffset, length) {
400
- return from(null, value, encodingOrOffset, length)
425
+ return from(value, encodingOrOffset, length)
401
426
  }
402
427
 
403
- if (Buffer.TYPED_ARRAY_SUPPORT) {
404
- Buffer.prototype.__proto__ = Uint8Array.prototype
405
- Buffer.__proto__ = Uint8Array
406
- if (typeof Symbol !== 'undefined' && Symbol.species &&
407
- Buffer[Symbol.species] === Buffer) {
408
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
409
- Object.defineProperty(Buffer, Symbol.species, {
410
- value: null,
411
- configurable: true
412
- })
413
- }
414
- }
428
+ // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
429
+ // https://github.com/feross/buffer/pull/148
430
+ Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
431
+ Object.setPrototypeOf(Buffer, Uint8Array)
415
432
 
416
433
  function assertSize (size) {
417
434
  if (typeof size !== 'number') {
418
- throw new TypeError('"size" argument must be a number')
435
+ throw new TypeError('"size" argument must be of type number')
419
436
  } else if (size < 0) {
420
- throw new RangeError('"size" argument must not be negative')
437
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
421
438
  }
422
439
  }
423
440
 
424
- function alloc (that, size, fill, encoding) {
441
+ function alloc (size, fill, encoding) {
425
442
  assertSize(size)
426
443
  if (size <= 0) {
427
- return createBuffer(that, size)
444
+ return createBuffer(size)
428
445
  }
429
446
  if (fill !== undefined) {
430
447
  // Only pay attention to encoding if it's a string. This
431
448
  // prevents accidentally sending in a number that would
432
- // be interpretted as a start offset.
449
+ // be interpreted as a start offset.
433
450
  return typeof encoding === 'string'
434
- ? createBuffer(that, size).fill(fill, encoding)
435
- : createBuffer(that, size).fill(fill)
451
+ ? createBuffer(size).fill(fill, encoding)
452
+ : createBuffer(size).fill(fill)
436
453
  }
437
- return createBuffer(that, size)
454
+ return createBuffer(size)
438
455
  }
439
456
 
440
457
  /**
@@ -442,132 +459,123 @@ function alloc (that, size, fill, encoding) {
442
459
  * alloc(size[, fill[, encoding]])
443
460
  **/
444
461
  Buffer.alloc = function (size, fill, encoding) {
445
- return alloc(null, size, fill, encoding)
462
+ return alloc(size, fill, encoding)
446
463
  }
447
464
 
448
- function allocUnsafe (that, size) {
465
+ function allocUnsafe (size) {
449
466
  assertSize(size)
450
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
451
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
452
- for (var i = 0; i < size; ++i) {
453
- that[i] = 0
454
- }
455
- }
456
- return that
467
+ return createBuffer(size < 0 ? 0 : checked(size) | 0)
457
468
  }
458
469
 
459
470
  /**
460
471
  * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
461
472
  * */
462
473
  Buffer.allocUnsafe = function (size) {
463
- return allocUnsafe(null, size)
474
+ return allocUnsafe(size)
464
475
  }
465
476
  /**
466
477
  * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
467
478
  */
468
479
  Buffer.allocUnsafeSlow = function (size) {
469
- return allocUnsafe(null, size)
480
+ return allocUnsafe(size)
470
481
  }
471
482
 
472
- function fromString (that, string, encoding) {
483
+ function fromString (string, encoding) {
473
484
  if (typeof encoding !== 'string' || encoding === '') {
474
485
  encoding = 'utf8'
475
486
  }
476
487
 
477
488
  if (!Buffer.isEncoding(encoding)) {
478
- throw new TypeError('"encoding" must be a valid string encoding')
489
+ throw new TypeError('Unknown encoding: ' + encoding)
479
490
  }
480
491
 
481
- var length = byteLength(string, encoding) | 0
482
- that = createBuffer(that, length)
492
+ const length = byteLength(string, encoding) | 0
493
+ let buf = createBuffer(length)
483
494
 
484
- var actual = that.write(string, encoding)
495
+ const actual = buf.write(string, encoding)
485
496
 
486
497
  if (actual !== length) {
487
498
  // Writing a hex string, for example, that contains invalid characters will
488
499
  // cause everything after the first invalid character to be ignored. (e.g.
489
500
  // 'abxxcd' will be treated as 'ab')
490
- that = that.slice(0, actual)
501
+ buf = buf.slice(0, actual)
491
502
  }
492
503
 
493
- return that
504
+ return buf
494
505
  }
495
506
 
496
- function fromArrayLike (that, array) {
497
- var length = array.length < 0 ? 0 : checked(array.length) | 0
498
- that = createBuffer(that, length)
499
- for (var i = 0; i < length; i += 1) {
500
- that[i] = array[i] & 255
507
+ function fromArrayLike (array) {
508
+ const length = array.length < 0 ? 0 : checked(array.length) | 0
509
+ const buf = createBuffer(length)
510
+ for (let i = 0; i < length; i += 1) {
511
+ buf[i] = array[i] & 255
501
512
  }
502
- return that
513
+ return buf
503
514
  }
504
515
 
505
- function fromArrayBuffer (that, array, byteOffset, length) {
506
- array.byteLength // this throws if `array` is not a valid ArrayBuffer
516
+ function fromArrayView (arrayView) {
517
+ if (isInstance(arrayView, Uint8Array)) {
518
+ const copy = new Uint8Array(arrayView)
519
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
520
+ }
521
+ return fromArrayLike(arrayView)
522
+ }
507
523
 
524
+ function fromArrayBuffer (array, byteOffset, length) {
508
525
  if (byteOffset < 0 || array.byteLength < byteOffset) {
509
- throw new RangeError('\'offset\' is out of bounds')
526
+ throw new RangeError('"offset" is outside of buffer bounds')
510
527
  }
511
528
 
512
529
  if (array.byteLength < byteOffset + (length || 0)) {
513
- throw new RangeError('\'length\' is out of bounds')
530
+ throw new RangeError('"length" is outside of buffer bounds')
514
531
  }
515
532
 
533
+ let buf
516
534
  if (byteOffset === undefined && length === undefined) {
517
- array = new Uint8Array(array)
535
+ buf = new Uint8Array(array)
518
536
  } else if (length === undefined) {
519
- array = new Uint8Array(array, byteOffset)
537
+ buf = new Uint8Array(array, byteOffset)
520
538
  } else {
521
- array = new Uint8Array(array, byteOffset, length)
539
+ buf = new Uint8Array(array, byteOffset, length)
522
540
  }
523
541
 
524
- if (Buffer.TYPED_ARRAY_SUPPORT) {
525
- // Return an augmented `Uint8Array` instance, for best performance
526
- that = array
527
- that.__proto__ = Buffer.prototype
528
- } else {
529
- // Fallback: Return an object instance of the Buffer class
530
- that = fromArrayLike(that, array)
531
- }
532
- return that
542
+ // Return an augmented `Uint8Array` instance
543
+ Object.setPrototypeOf(buf, Buffer.prototype)
544
+
545
+ return buf
533
546
  }
534
547
 
535
- function fromObject (that, obj) {
548
+ function fromObject (obj) {
536
549
  if (Buffer.isBuffer(obj)) {
537
- var len = checked(obj.length) | 0
538
- that = createBuffer(that, len)
550
+ const len = checked(obj.length) | 0
551
+ const buf = createBuffer(len)
539
552
 
540
- if (that.length === 0) {
541
- return that
553
+ if (buf.length === 0) {
554
+ return buf
542
555
  }
543
556
 
544
- obj.copy(that, 0, 0, len)
545
- return that
557
+ obj.copy(buf, 0, 0, len)
558
+ return buf
546
559
  }
547
560
 
548
- if (obj) {
549
- if ((typeof ArrayBuffer !== 'undefined' &&
550
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
551
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
552
- return createBuffer(that, 0)
553
- }
554
- return fromArrayLike(that, obj)
555
- }
556
-
557
- if (obj.type === 'Buffer' && isArray(obj.data)) {
558
- return fromArrayLike(that, obj.data)
561
+ if (obj.length !== undefined) {
562
+ if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
563
+ return createBuffer(0)
559
564
  }
565
+ return fromArrayLike(obj)
560
566
  }
561
567
 
562
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
568
+ if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
569
+ return fromArrayLike(obj.data)
570
+ }
563
571
  }
564
572
 
565
573
  function checked (length) {
566
- // Note: cannot use `length < kMaxLength()` here because that fails when
574
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
567
575
  // length is NaN (which is otherwise coerced to zero.)
568
- if (length >= kMaxLength()) {
576
+ if (length >= K_MAX_LENGTH) {
569
577
  throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
570
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
578
+ 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
571
579
  }
572
580
  return length | 0
573
581
  }
@@ -580,20 +588,25 @@ function SlowBuffer (length) {
580
588
  }
581
589
 
582
590
  Buffer.isBuffer = function isBuffer (b) {
583
- return !!(b != null && b._isBuffer)
591
+ return b != null && b._isBuffer === true &&
592
+ b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
584
593
  }
585
594
 
586
595
  Buffer.compare = function compare (a, b) {
596
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
597
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
587
598
  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
588
- throw new TypeError('Arguments must be Buffers')
599
+ throw new TypeError(
600
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
601
+ )
589
602
  }
590
603
 
591
604
  if (a === b) return 0
592
605
 
593
- var x = a.length
594
- var y = b.length
606
+ let x = a.length
607
+ let y = b.length
595
608
 
596
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
609
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
597
610
  if (a[i] !== b[i]) {
598
611
  x = a[i]
599
612
  y = b[i]
@@ -626,7 +639,7 @@ Buffer.isEncoding = function isEncoding (encoding) {
626
639
  }
627
640
 
628
641
  Buffer.concat = function concat (list, length) {
629
- if (!isArray(list)) {
642
+ if (!Array.isArray(list)) {
630
643
  throw new TypeError('"list" argument must be an Array of Buffers')
631
644
  }
632
645
 
@@ -634,7 +647,7 @@ Buffer.concat = function concat (list, length) {
634
647
  return Buffer.alloc(0)
635
648
  }
636
649
 
637
- var i
650
+ let i
638
651
  if (length === undefined) {
639
652
  length = 0
640
653
  for (i = 0; i < list.length; ++i) {
@@ -642,14 +655,26 @@ Buffer.concat = function concat (list, length) {
642
655
  }
643
656
  }
644
657
 
645
- var buffer = Buffer.allocUnsafe(length)
646
- var pos = 0
658
+ const buffer = Buffer.allocUnsafe(length)
659
+ let pos = 0
647
660
  for (i = 0; i < list.length; ++i) {
648
- var buf = list[i]
649
- if (!Buffer.isBuffer(buf)) {
661
+ let buf = list[i]
662
+ if (isInstance(buf, Uint8Array)) {
663
+ if (pos + buf.length > buffer.length) {
664
+ if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
665
+ buf.copy(buffer, pos)
666
+ } else {
667
+ Uint8Array.prototype.set.call(
668
+ buffer,
669
+ buf,
670
+ pos
671
+ )
672
+ }
673
+ } else if (!Buffer.isBuffer(buf)) {
650
674
  throw new TypeError('"list" argument must be an Array of Buffers')
675
+ } else {
676
+ buf.copy(buffer, pos)
651
677
  }
652
- buf.copy(buffer, pos)
653
678
  pos += buf.length
654
679
  }
655
680
  return buffer
@@ -659,19 +684,22 @@ function byteLength (string, encoding) {
659
684
  if (Buffer.isBuffer(string)) {
660
685
  return string.length
661
686
  }
662
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
663
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
687
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
664
688
  return string.byteLength
665
689
  }
666
690
  if (typeof string !== 'string') {
667
- string = '' + string
691
+ throw new TypeError(
692
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
693
+ 'Received type ' + typeof string
694
+ )
668
695
  }
669
696
 
670
- var len = string.length
671
- if (len === 0) return 0
697
+ const len = string.length
698
+ const mustMatch = (arguments.length > 2 && arguments[2] === true)
699
+ if (!mustMatch && len === 0) return 0
672
700
 
673
701
  // Use a for loop to avoid recursion
674
- var loweredCase = false
702
+ let loweredCase = false
675
703
  for (;;) {
676
704
  switch (encoding) {
677
705
  case 'ascii':
@@ -680,7 +708,6 @@ function byteLength (string, encoding) {
680
708
  return len
681
709
  case 'utf8':
682
710
  case 'utf-8':
683
- case undefined:
684
711
  return utf8ToBytes(string).length
685
712
  case 'ucs2':
686
713
  case 'ucs-2':
@@ -692,7 +719,9 @@ function byteLength (string, encoding) {
692
719
  case 'base64':
693
720
  return base64ToBytes(string).length
694
721
  default:
695
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
722
+ if (loweredCase) {
723
+ return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
724
+ }
696
725
  encoding = ('' + encoding).toLowerCase()
697
726
  loweredCase = true
698
727
  }
@@ -701,7 +730,7 @@ function byteLength (string, encoding) {
701
730
  Buffer.byteLength = byteLength
702
731
 
703
732
  function slowToString (encoding, start, end) {
704
- var loweredCase = false
733
+ let loweredCase = false
705
734
 
706
735
  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
707
736
  // property of a typed array.
@@ -727,7 +756,7 @@ function slowToString (encoding, start, end) {
727
756
  return ''
728
757
  }
729
758
 
730
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
759
+ // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
731
760
  end >>>= 0
732
761
  start >>>= 0
733
762
 
@@ -770,33 +799,37 @@ function slowToString (encoding, start, end) {
770
799
  }
771
800
  }
772
801
 
773
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
774
- // Buffer instances.
802
+ // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
803
+ // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
804
+ // reliably in a browserify context because there could be multiple different
805
+ // copies of the 'buffer' package in use. This method works even for Buffer
806
+ // instances that were created from another copy of the `buffer` package.
807
+ // See: https://github.com/feross/buffer/issues/154
775
808
  Buffer.prototype._isBuffer = true
776
809
 
777
810
  function swap (b, n, m) {
778
- var i = b[n]
811
+ const i = b[n]
779
812
  b[n] = b[m]
780
813
  b[m] = i
781
814
  }
782
815
 
783
816
  Buffer.prototype.swap16 = function swap16 () {
784
- var len = this.length
817
+ const len = this.length
785
818
  if (len % 2 !== 0) {
786
819
  throw new RangeError('Buffer size must be a multiple of 16-bits')
787
820
  }
788
- for (var i = 0; i < len; i += 2) {
821
+ for (let i = 0; i < len; i += 2) {
789
822
  swap(this, i, i + 1)
790
823
  }
791
824
  return this
792
825
  }
793
826
 
794
827
  Buffer.prototype.swap32 = function swap32 () {
795
- var len = this.length
828
+ const len = this.length
796
829
  if (len % 4 !== 0) {
797
830
  throw new RangeError('Buffer size must be a multiple of 32-bits')
798
831
  }
799
- for (var i = 0; i < len; i += 4) {
832
+ for (let i = 0; i < len; i += 4) {
800
833
  swap(this, i, i + 3)
801
834
  swap(this, i + 1, i + 2)
802
835
  }
@@ -804,11 +837,11 @@ Buffer.prototype.swap32 = function swap32 () {
804
837
  }
805
838
 
806
839
  Buffer.prototype.swap64 = function swap64 () {
807
- var len = this.length
840
+ const len = this.length
808
841
  if (len % 8 !== 0) {
809
842
  throw new RangeError('Buffer size must be a multiple of 64-bits')
810
843
  }
811
- for (var i = 0; i < len; i += 8) {
844
+ for (let i = 0; i < len; i += 8) {
812
845
  swap(this, i, i + 7)
813
846
  swap(this, i + 1, i + 6)
814
847
  swap(this, i + 2, i + 5)
@@ -818,12 +851,14 @@ Buffer.prototype.swap64 = function swap64 () {
818
851
  }
819
852
 
820
853
  Buffer.prototype.toString = function toString () {
821
- var length = this.length | 0
854
+ const length = this.length
822
855
  if (length === 0) return ''
823
856
  if (arguments.length === 0) return utf8Slice(this, 0, length)
824
857
  return slowToString.apply(this, arguments)
825
858
  }
826
859
 
860
+ Buffer.prototype.toLocaleString = Buffer.prototype.toString
861
+
827
862
  Buffer.prototype.equals = function equals (b) {
828
863
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
829
864
  if (this === b) return true
@@ -831,18 +866,25 @@ Buffer.prototype.equals = function equals (b) {
831
866
  }
832
867
 
833
868
  Buffer.prototype.inspect = function inspect () {
834
- var str = ''
835
- var max = exports.INSPECT_MAX_BYTES
836
- if (this.length > 0) {
837
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
838
- if (this.length > max) str += ' ... '
839
- }
869
+ let str = ''
870
+ const max = exports.INSPECT_MAX_BYTES
871
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
872
+ if (this.length > max) str += ' ... '
840
873
  return '<Buffer ' + str + '>'
841
874
  }
875
+ if (customInspectSymbol) {
876
+ Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
877
+ }
842
878
 
843
879
  Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
880
+ if (isInstance(target, Uint8Array)) {
881
+ target = Buffer.from(target, target.offset, target.byteLength)
882
+ }
844
883
  if (!Buffer.isBuffer(target)) {
845
- throw new TypeError('Argument must be a Buffer')
884
+ throw new TypeError(
885
+ 'The "target" argument must be one of type Buffer or Uint8Array. ' +
886
+ 'Received type ' + (typeof target)
887
+ )
846
888
  }
847
889
 
848
890
  if (start === undefined) {
@@ -879,14 +921,14 @@ Buffer.prototype.compare = function compare (target, start, end, thisStart, this
879
921
 
880
922
  if (this === target) return 0
881
923
 
882
- var x = thisEnd - thisStart
883
- var y = end - start
884
- var len = Math.min(x, y)
924
+ let x = thisEnd - thisStart
925
+ let y = end - start
926
+ const len = Math.min(x, y)
885
927
 
886
- var thisCopy = this.slice(thisStart, thisEnd)
887
- var targetCopy = target.slice(start, end)
928
+ const thisCopy = this.slice(thisStart, thisEnd)
929
+ const targetCopy = target.slice(start, end)
888
930
 
889
- for (var i = 0; i < len; ++i) {
931
+ for (let i = 0; i < len; ++i) {
890
932
  if (thisCopy[i] !== targetCopy[i]) {
891
933
  x = thisCopy[i]
892
934
  y = targetCopy[i]
@@ -921,8 +963,8 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
921
963
  } else if (byteOffset < -0x80000000) {
922
964
  byteOffset = -0x80000000
923
965
  }
924
- byteOffset = +byteOffset // Coerce to Number.
925
- if (isNaN(byteOffset)) {
966
+ byteOffset = +byteOffset // Coerce to Number.
967
+ if (numberIsNaN(byteOffset)) {
926
968
  // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
927
969
  byteOffset = dir ? 0 : (buffer.length - 1)
928
970
  }
@@ -951,24 +993,23 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
951
993
  return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
952
994
  } else if (typeof val === 'number') {
953
995
  val = val & 0xFF // Search for a byte value [0-255]
954
- if (Buffer.TYPED_ARRAY_SUPPORT &&
955
- typeof Uint8Array.prototype.indexOf === 'function') {
996
+ if (typeof Uint8Array.prototype.indexOf === 'function') {
956
997
  if (dir) {
957
998
  return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
958
999
  } else {
959
1000
  return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
960
1001
  }
961
1002
  }
962
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
1003
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
963
1004
  }
964
1005
 
965
1006
  throw new TypeError('val must be string, number or Buffer')
966
1007
  }
967
1008
 
968
1009
  function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
969
- var indexSize = 1
970
- var arrLength = arr.length
971
- var valLength = val.length
1010
+ let indexSize = 1
1011
+ let arrLength = arr.length
1012
+ let valLength = val.length
972
1013
 
973
1014
  if (encoding !== undefined) {
974
1015
  encoding = String(encoding).toLowerCase()
@@ -992,9 +1033,9 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
992
1033
  }
993
1034
  }
994
1035
 
995
- var i
1036
+ let i
996
1037
  if (dir) {
997
- var foundIndex = -1
1038
+ let foundIndex = -1
998
1039
  for (i = byteOffset; i < arrLength; i++) {
999
1040
  if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1000
1041
  if (foundIndex === -1) foundIndex = i
@@ -1007,8 +1048,8 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
1007
1048
  } else {
1008
1049
  if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
1009
1050
  for (i = byteOffset; i >= 0; i--) {
1010
- var found = true
1011
- for (var j = 0; j < valLength; j++) {
1051
+ let found = true
1052
+ for (let j = 0; j < valLength; j++) {
1012
1053
  if (read(arr, i + j) !== read(val, j)) {
1013
1054
  found = false
1014
1055
  break
@@ -1035,7 +1076,7 @@ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding)
1035
1076
 
1036
1077
  function hexWrite (buf, string, offset, length) {
1037
1078
  offset = Number(offset) || 0
1038
- var remaining = buf.length - offset
1079
+ const remaining = buf.length - offset
1039
1080
  if (!length) {
1040
1081
  length = remaining
1041
1082
  } else {
@@ -1045,16 +1086,15 @@ function hexWrite (buf, string, offset, length) {
1045
1086
  }
1046
1087
  }
1047
1088
 
1048
- // must be an even number of digits
1049
- var strLen = string.length
1050
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
1089
+ const strLen = string.length
1051
1090
 
1052
1091
  if (length > strLen / 2) {
1053
1092
  length = strLen / 2
1054
1093
  }
1055
- for (var i = 0; i < length; ++i) {
1056
- var parsed = parseInt(string.substr(i * 2, 2), 16)
1057
- if (isNaN(parsed)) return i
1094
+ let i
1095
+ for (i = 0; i < length; ++i) {
1096
+ const parsed = parseInt(string.substr(i * 2, 2), 16)
1097
+ if (numberIsNaN(parsed)) return i
1058
1098
  buf[offset + i] = parsed
1059
1099
  }
1060
1100
  return i
@@ -1068,10 +1108,6 @@ function asciiWrite (buf, string, offset, length) {
1068
1108
  return blitBuffer(asciiToBytes(string), buf, offset, length)
1069
1109
  }
1070
1110
 
1071
- function latin1Write (buf, string, offset, length) {
1072
- return asciiWrite(buf, string, offset, length)
1073
- }
1074
-
1075
1111
  function base64Write (buf, string, offset, length) {
1076
1112
  return blitBuffer(base64ToBytes(string), buf, offset, length)
1077
1113
  }
@@ -1093,22 +1129,21 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
1093
1129
  offset = 0
1094
1130
  // Buffer#write(string, offset[, length][, encoding])
1095
1131
  } else if (isFinite(offset)) {
1096
- offset = offset | 0
1132
+ offset = offset >>> 0
1097
1133
  if (isFinite(length)) {
1098
- length = length | 0
1134
+ length = length >>> 0
1099
1135
  if (encoding === undefined) encoding = 'utf8'
1100
1136
  } else {
1101
1137
  encoding = length
1102
1138
  length = undefined
1103
1139
  }
1104
- // legacy write(string, encoding, offset, length) - remove in v0.13
1105
1140
  } else {
1106
1141
  throw new Error(
1107
1142
  'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1108
1143
  )
1109
1144
  }
1110
1145
 
1111
- var remaining = this.length - offset
1146
+ const remaining = this.length - offset
1112
1147
  if (length === undefined || length > remaining) length = remaining
1113
1148
 
1114
1149
  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
@@ -1117,7 +1152,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
1117
1152
 
1118
1153
  if (!encoding) encoding = 'utf8'
1119
1154
 
1120
- var loweredCase = false
1155
+ let loweredCase = false
1121
1156
  for (;;) {
1122
1157
  switch (encoding) {
1123
1158
  case 'hex':
@@ -1128,11 +1163,9 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
1128
1163
  return utf8Write(this, string, offset, length)
1129
1164
 
1130
1165
  case 'ascii':
1131
- return asciiWrite(this, string, offset, length)
1132
-
1133
1166
  case 'latin1':
1134
1167
  case 'binary':
1135
- return latin1Write(this, string, offset, length)
1168
+ return asciiWrite(this, string, offset, length)
1136
1169
 
1137
1170
  case 'base64':
1138
1171
  // Warning: maxLength not taken into account in base64Write
@@ -1169,19 +1202,22 @@ function base64Slice (buf, start, end) {
1169
1202
 
1170
1203
  function utf8Slice (buf, start, end) {
1171
1204
  end = Math.min(buf.length, end)
1172
- var res = []
1205
+ const res = []
1173
1206
 
1174
- var i = start
1207
+ let i = start
1175
1208
  while (i < end) {
1176
- var firstByte = buf[i]
1177
- var codePoint = null
1178
- var bytesPerSequence = (firstByte > 0xEF) ? 4
1179
- : (firstByte > 0xDF) ? 3
1180
- : (firstByte > 0xBF) ? 2
1181
- : 1
1209
+ const firstByte = buf[i]
1210
+ let codePoint = null
1211
+ let bytesPerSequence = (firstByte > 0xEF)
1212
+ ? 4
1213
+ : (firstByte > 0xDF)
1214
+ ? 3
1215
+ : (firstByte > 0xBF)
1216
+ ? 2
1217
+ : 1
1182
1218
 
1183
1219
  if (i + bytesPerSequence <= end) {
1184
- var secondByte, thirdByte, fourthByte, tempCodePoint
1220
+ let secondByte, thirdByte, fourthByte, tempCodePoint
1185
1221
 
1186
1222
  switch (bytesPerSequence) {
1187
1223
  case 1:
@@ -1243,17 +1279,17 @@ function utf8Slice (buf, start, end) {
1243
1279
  // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1244
1280
  // the lowest limit is Chrome, with 0x10000 args.
1245
1281
  // We go 1 magnitude less, for safety
1246
- var MAX_ARGUMENTS_LENGTH = 0x1000
1282
+ const MAX_ARGUMENTS_LENGTH = 0x1000
1247
1283
 
1248
1284
  function decodeCodePointsArray (codePoints) {
1249
- var len = codePoints.length
1285
+ const len = codePoints.length
1250
1286
  if (len <= MAX_ARGUMENTS_LENGTH) {
1251
1287
  return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1252
1288
  }
1253
1289
 
1254
1290
  // Decode in chunks to avoid "call stack size exceeded".
1255
- var res = ''
1256
- var i = 0
1291
+ let res = ''
1292
+ let i = 0
1257
1293
  while (i < len) {
1258
1294
  res += String.fromCharCode.apply(
1259
1295
  String,
@@ -1264,49 +1300,50 @@ function decodeCodePointsArray (codePoints) {
1264
1300
  }
1265
1301
 
1266
1302
  function asciiSlice (buf, start, end) {
1267
- var ret = ''
1303
+ let ret = ''
1268
1304
  end = Math.min(buf.length, end)
1269
1305
 
1270
- for (var i = start; i < end; ++i) {
1306
+ for (let i = start; i < end; ++i) {
1271
1307
  ret += String.fromCharCode(buf[i] & 0x7F)
1272
1308
  }
1273
1309
  return ret
1274
1310
  }
1275
1311
 
1276
1312
  function latin1Slice (buf, start, end) {
1277
- var ret = ''
1313
+ let ret = ''
1278
1314
  end = Math.min(buf.length, end)
1279
1315
 
1280
- for (var i = start; i < end; ++i) {
1316
+ for (let i = start; i < end; ++i) {
1281
1317
  ret += String.fromCharCode(buf[i])
1282
1318
  }
1283
1319
  return ret
1284
1320
  }
1285
1321
 
1286
1322
  function hexSlice (buf, start, end) {
1287
- var len = buf.length
1323
+ const len = buf.length
1288
1324
 
1289
1325
  if (!start || start < 0) start = 0
1290
1326
  if (!end || end < 0 || end > len) end = len
1291
1327
 
1292
- var out = ''
1293
- for (var i = start; i < end; ++i) {
1294
- out += toHex(buf[i])
1328
+ let out = ''
1329
+ for (let i = start; i < end; ++i) {
1330
+ out += hexSliceLookupTable[buf[i]]
1295
1331
  }
1296
1332
  return out
1297
1333
  }
1298
1334
 
1299
1335
  function utf16leSlice (buf, start, end) {
1300
- var bytes = buf.slice(start, end)
1301
- var res = ''
1302
- for (var i = 0; i < bytes.length; i += 2) {
1303
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
1336
+ const bytes = buf.slice(start, end)
1337
+ let res = ''
1338
+ // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1339
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1340
+ res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
1304
1341
  }
1305
1342
  return res
1306
1343
  }
1307
1344
 
1308
1345
  Buffer.prototype.slice = function slice (start, end) {
1309
- var len = this.length
1346
+ const len = this.length
1310
1347
  start = ~~start
1311
1348
  end = end === undefined ? len : ~~end
1312
1349
 
@@ -1326,17 +1363,9 @@ Buffer.prototype.slice = function slice (start, end) {
1326
1363
 
1327
1364
  if (end < start) end = start
1328
1365
 
1329
- var newBuf
1330
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1331
- newBuf = this.subarray(start, end)
1332
- newBuf.__proto__ = Buffer.prototype
1333
- } else {
1334
- var sliceLen = end - start
1335
- newBuf = new Buffer(sliceLen, undefined)
1336
- for (var i = 0; i < sliceLen; ++i) {
1337
- newBuf[i] = this[i + start]
1338
- }
1339
- }
1366
+ const newBuf = this.subarray(start, end)
1367
+ // Return an augmented `Uint8Array` instance
1368
+ Object.setPrototypeOf(newBuf, Buffer.prototype)
1340
1369
 
1341
1370
  return newBuf
1342
1371
  }
@@ -1349,14 +1378,15 @@ function checkOffset (offset, ext, length) {
1349
1378
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1350
1379
  }
1351
1380
 
1381
+ Buffer.prototype.readUintLE =
1352
1382
  Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1353
- offset = offset | 0
1354
- byteLength = byteLength | 0
1383
+ offset = offset >>> 0
1384
+ byteLength = byteLength >>> 0
1355
1385
  if (!noAssert) checkOffset(offset, byteLength, this.length)
1356
1386
 
1357
- var val = this[offset]
1358
- var mul = 1
1359
- var i = 0
1387
+ let val = this[offset]
1388
+ let mul = 1
1389
+ let i = 0
1360
1390
  while (++i < byteLength && (mul *= 0x100)) {
1361
1391
  val += this[offset + i] * mul
1362
1392
  }
@@ -1364,15 +1394,16 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert)
1364
1394
  return val
1365
1395
  }
1366
1396
 
1397
+ Buffer.prototype.readUintBE =
1367
1398
  Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1368
- offset = offset | 0
1369
- byteLength = byteLength | 0
1399
+ offset = offset >>> 0
1400
+ byteLength = byteLength >>> 0
1370
1401
  if (!noAssert) {
1371
1402
  checkOffset(offset, byteLength, this.length)
1372
1403
  }
1373
1404
 
1374
- var val = this[offset + --byteLength]
1375
- var mul = 1
1405
+ let val = this[offset + --byteLength]
1406
+ let mul = 1
1376
1407
  while (byteLength > 0 && (mul *= 0x100)) {
1377
1408
  val += this[offset + --byteLength] * mul
1378
1409
  }
@@ -1380,22 +1411,30 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert)
1380
1411
  return val
1381
1412
  }
1382
1413
 
1414
+ Buffer.prototype.readUint8 =
1383
1415
  Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1416
+ offset = offset >>> 0
1384
1417
  if (!noAssert) checkOffset(offset, 1, this.length)
1385
1418
  return this[offset]
1386
1419
  }
1387
1420
 
1421
+ Buffer.prototype.readUint16LE =
1388
1422
  Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1423
+ offset = offset >>> 0
1389
1424
  if (!noAssert) checkOffset(offset, 2, this.length)
1390
1425
  return this[offset] | (this[offset + 1] << 8)
1391
1426
  }
1392
1427
 
1428
+ Buffer.prototype.readUint16BE =
1393
1429
  Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1430
+ offset = offset >>> 0
1394
1431
  if (!noAssert) checkOffset(offset, 2, this.length)
1395
1432
  return (this[offset] << 8) | this[offset + 1]
1396
1433
  }
1397
1434
 
1435
+ Buffer.prototype.readUint32LE =
1398
1436
  Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1437
+ offset = offset >>> 0
1399
1438
  if (!noAssert) checkOffset(offset, 4, this.length)
1400
1439
 
1401
1440
  return ((this[offset]) |
@@ -1404,7 +1443,9 @@ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1404
1443
  (this[offset + 3] * 0x1000000)
1405
1444
  }
1406
1445
 
1446
+ Buffer.prototype.readUint32BE =
1407
1447
  Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1448
+ offset = offset >>> 0
1408
1449
  if (!noAssert) checkOffset(offset, 4, this.length)
1409
1450
 
1410
1451
  return (this[offset] * 0x1000000) +
@@ -1413,14 +1454,58 @@ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1413
1454
  this[offset + 3])
1414
1455
  }
1415
1456
 
1457
+ Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
1458
+ offset = offset >>> 0
1459
+ validateNumber(offset, 'offset')
1460
+ const first = this[offset]
1461
+ const last = this[offset + 7]
1462
+ if (first === undefined || last === undefined) {
1463
+ boundsError(offset, this.length - 8)
1464
+ }
1465
+
1466
+ const lo = first +
1467
+ this[++offset] * 2 ** 8 +
1468
+ this[++offset] * 2 ** 16 +
1469
+ this[++offset] * 2 ** 24
1470
+
1471
+ const hi = this[++offset] +
1472
+ this[++offset] * 2 ** 8 +
1473
+ this[++offset] * 2 ** 16 +
1474
+ last * 2 ** 24
1475
+
1476
+ return BigInt(lo) + (BigInt(hi) << BigInt(32))
1477
+ })
1478
+
1479
+ Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
1480
+ offset = offset >>> 0
1481
+ validateNumber(offset, 'offset')
1482
+ const first = this[offset]
1483
+ const last = this[offset + 7]
1484
+ if (first === undefined || last === undefined) {
1485
+ boundsError(offset, this.length - 8)
1486
+ }
1487
+
1488
+ const hi = first * 2 ** 24 +
1489
+ this[++offset] * 2 ** 16 +
1490
+ this[++offset] * 2 ** 8 +
1491
+ this[++offset]
1492
+
1493
+ const lo = this[++offset] * 2 ** 24 +
1494
+ this[++offset] * 2 ** 16 +
1495
+ this[++offset] * 2 ** 8 +
1496
+ last
1497
+
1498
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo)
1499
+ })
1500
+
1416
1501
  Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1417
- offset = offset | 0
1418
- byteLength = byteLength | 0
1502
+ offset = offset >>> 0
1503
+ byteLength = byteLength >>> 0
1419
1504
  if (!noAssert) checkOffset(offset, byteLength, this.length)
1420
1505
 
1421
- var val = this[offset]
1422
- var mul = 1
1423
- var i = 0
1506
+ let val = this[offset]
1507
+ let mul = 1
1508
+ let i = 0
1424
1509
  while (++i < byteLength && (mul *= 0x100)) {
1425
1510
  val += this[offset + i] * mul
1426
1511
  }
@@ -1432,13 +1517,13 @@ Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1432
1517
  }
1433
1518
 
1434
1519
  Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1435
- offset = offset | 0
1436
- byteLength = byteLength | 0
1520
+ offset = offset >>> 0
1521
+ byteLength = byteLength >>> 0
1437
1522
  if (!noAssert) checkOffset(offset, byteLength, this.length)
1438
1523
 
1439
- var i = byteLength
1440
- var mul = 1
1441
- var val = this[offset + --i]
1524
+ let i = byteLength
1525
+ let mul = 1
1526
+ let val = this[offset + --i]
1442
1527
  while (i > 0 && (mul *= 0x100)) {
1443
1528
  val += this[offset + --i] * mul
1444
1529
  }
@@ -1450,24 +1535,28 @@ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1450
1535
  }
1451
1536
 
1452
1537
  Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1538
+ offset = offset >>> 0
1453
1539
  if (!noAssert) checkOffset(offset, 1, this.length)
1454
1540
  if (!(this[offset] & 0x80)) return (this[offset])
1455
1541
  return ((0xff - this[offset] + 1) * -1)
1456
1542
  }
1457
1543
 
1458
1544
  Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1545
+ offset = offset >>> 0
1459
1546
  if (!noAssert) checkOffset(offset, 2, this.length)
1460
- var val = this[offset] | (this[offset + 1] << 8)
1547
+ const val = this[offset] | (this[offset + 1] << 8)
1461
1548
  return (val & 0x8000) ? val | 0xFFFF0000 : val
1462
1549
  }
1463
1550
 
1464
1551
  Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1552
+ offset = offset >>> 0
1465
1553
  if (!noAssert) checkOffset(offset, 2, this.length)
1466
- var val = this[offset + 1] | (this[offset] << 8)
1554
+ const val = this[offset + 1] | (this[offset] << 8)
1467
1555
  return (val & 0x8000) ? val | 0xFFFF0000 : val
1468
1556
  }
1469
1557
 
1470
1558
  Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1559
+ offset = offset >>> 0
1471
1560
  if (!noAssert) checkOffset(offset, 4, this.length)
1472
1561
 
1473
1562
  return (this[offset]) |
@@ -1477,6 +1566,7 @@ Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1477
1566
  }
1478
1567
 
1479
1568
  Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1569
+ offset = offset >>> 0
1480
1570
  if (!noAssert) checkOffset(offset, 4, this.length)
1481
1571
 
1482
1572
  return (this[offset] << 24) |
@@ -1485,22 +1575,68 @@ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1485
1575
  (this[offset + 3])
1486
1576
  }
1487
1577
 
1578
+ Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
1579
+ offset = offset >>> 0
1580
+ validateNumber(offset, 'offset')
1581
+ const first = this[offset]
1582
+ const last = this[offset + 7]
1583
+ if (first === undefined || last === undefined) {
1584
+ boundsError(offset, this.length - 8)
1585
+ }
1586
+
1587
+ const val = this[offset + 4] +
1588
+ this[offset + 5] * 2 ** 8 +
1589
+ this[offset + 6] * 2 ** 16 +
1590
+ (last << 24) // Overflow
1591
+
1592
+ return (BigInt(val) << BigInt(32)) +
1593
+ BigInt(first +
1594
+ this[++offset] * 2 ** 8 +
1595
+ this[++offset] * 2 ** 16 +
1596
+ this[++offset] * 2 ** 24)
1597
+ })
1598
+
1599
+ Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
1600
+ offset = offset >>> 0
1601
+ validateNumber(offset, 'offset')
1602
+ const first = this[offset]
1603
+ const last = this[offset + 7]
1604
+ if (first === undefined || last === undefined) {
1605
+ boundsError(offset, this.length - 8)
1606
+ }
1607
+
1608
+ const val = (first << 24) + // Overflow
1609
+ this[++offset] * 2 ** 16 +
1610
+ this[++offset] * 2 ** 8 +
1611
+ this[++offset]
1612
+
1613
+ return (BigInt(val) << BigInt(32)) +
1614
+ BigInt(this[++offset] * 2 ** 24 +
1615
+ this[++offset] * 2 ** 16 +
1616
+ this[++offset] * 2 ** 8 +
1617
+ last)
1618
+ })
1619
+
1488
1620
  Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1621
+ offset = offset >>> 0
1489
1622
  if (!noAssert) checkOffset(offset, 4, this.length)
1490
1623
  return ieee754.read(this, offset, true, 23, 4)
1491
1624
  }
1492
1625
 
1493
1626
  Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1627
+ offset = offset >>> 0
1494
1628
  if (!noAssert) checkOffset(offset, 4, this.length)
1495
1629
  return ieee754.read(this, offset, false, 23, 4)
1496
1630
  }
1497
1631
 
1498
1632
  Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1633
+ offset = offset >>> 0
1499
1634
  if (!noAssert) checkOffset(offset, 8, this.length)
1500
1635
  return ieee754.read(this, offset, true, 52, 8)
1501
1636
  }
1502
1637
 
1503
1638
  Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1639
+ offset = offset >>> 0
1504
1640
  if (!noAssert) checkOffset(offset, 8, this.length)
1505
1641
  return ieee754.read(this, offset, false, 52, 8)
1506
1642
  }
@@ -1511,17 +1647,18 @@ function checkInt (buf, value, offset, ext, max, min) {
1511
1647
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
1512
1648
  }
1513
1649
 
1650
+ Buffer.prototype.writeUintLE =
1514
1651
  Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1515
1652
  value = +value
1516
- offset = offset | 0
1517
- byteLength = byteLength | 0
1653
+ offset = offset >>> 0
1654
+ byteLength = byteLength >>> 0
1518
1655
  if (!noAssert) {
1519
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
1656
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1
1520
1657
  checkInt(this, value, offset, byteLength, maxBytes, 0)
1521
1658
  }
1522
1659
 
1523
- var mul = 1
1524
- var i = 0
1660
+ let mul = 1
1661
+ let i = 0
1525
1662
  this[offset] = value & 0xFF
1526
1663
  while (++i < byteLength && (mul *= 0x100)) {
1527
1664
  this[offset + i] = (value / mul) & 0xFF
@@ -1530,17 +1667,18 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength,
1530
1667
  return offset + byteLength
1531
1668
  }
1532
1669
 
1670
+ Buffer.prototype.writeUintBE =
1533
1671
  Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1534
1672
  value = +value
1535
- offset = offset | 0
1536
- byteLength = byteLength | 0
1673
+ offset = offset >>> 0
1674
+ byteLength = byteLength >>> 0
1537
1675
  if (!noAssert) {
1538
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
1676
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1
1539
1677
  checkInt(this, value, offset, byteLength, maxBytes, 0)
1540
1678
  }
1541
1679
 
1542
- var i = byteLength - 1
1543
- var mul = 1
1680
+ let i = byteLength - 1
1681
+ let mul = 1
1544
1682
  this[offset + i] = value & 0xFF
1545
1683
  while (--i >= 0 && (mul *= 0x100)) {
1546
1684
  this[offset + i] = (value / mul) & 0xFF
@@ -1549,98 +1687,123 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength,
1549
1687
  return offset + byteLength
1550
1688
  }
1551
1689
 
1690
+ Buffer.prototype.writeUint8 =
1552
1691
  Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1553
1692
  value = +value
1554
- offset = offset | 0
1693
+ offset = offset >>> 0
1555
1694
  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1556
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1557
1695
  this[offset] = (value & 0xff)
1558
1696
  return offset + 1
1559
1697
  }
1560
1698
 
1561
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
1562
- if (value < 0) value = 0xffff + value + 1
1563
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1564
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1565
- (littleEndian ? i : 1 - i) * 8
1566
- }
1567
- }
1568
-
1699
+ Buffer.prototype.writeUint16LE =
1569
1700
  Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1570
1701
  value = +value
1571
- offset = offset | 0
1702
+ offset = offset >>> 0
1572
1703
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1573
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1574
- this[offset] = (value & 0xff)
1575
- this[offset + 1] = (value >>> 8)
1576
- } else {
1577
- objectWriteUInt16(this, value, offset, true)
1578
- }
1704
+ this[offset] = (value & 0xff)
1705
+ this[offset + 1] = (value >>> 8)
1579
1706
  return offset + 2
1580
1707
  }
1581
1708
 
1709
+ Buffer.prototype.writeUint16BE =
1582
1710
  Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1583
1711
  value = +value
1584
- offset = offset | 0
1712
+ offset = offset >>> 0
1585
1713
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1586
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1587
- this[offset] = (value >>> 8)
1588
- this[offset + 1] = (value & 0xff)
1589
- } else {
1590
- objectWriteUInt16(this, value, offset, false)
1591
- }
1714
+ this[offset] = (value >>> 8)
1715
+ this[offset + 1] = (value & 0xff)
1592
1716
  return offset + 2
1593
1717
  }
1594
1718
 
1595
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
1596
- if (value < 0) value = 0xffffffff + value + 1
1597
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
1598
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
1599
- }
1600
- }
1601
-
1719
+ Buffer.prototype.writeUint32LE =
1602
1720
  Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1603
1721
  value = +value
1604
- offset = offset | 0
1722
+ offset = offset >>> 0
1605
1723
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1606
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1607
- this[offset + 3] = (value >>> 24)
1608
- this[offset + 2] = (value >>> 16)
1609
- this[offset + 1] = (value >>> 8)
1610
- this[offset] = (value & 0xff)
1611
- } else {
1612
- objectWriteUInt32(this, value, offset, true)
1613
- }
1724
+ this[offset + 3] = (value >>> 24)
1725
+ this[offset + 2] = (value >>> 16)
1726
+ this[offset + 1] = (value >>> 8)
1727
+ this[offset] = (value & 0xff)
1614
1728
  return offset + 4
1615
1729
  }
1616
1730
 
1731
+ Buffer.prototype.writeUint32BE =
1617
1732
  Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1618
1733
  value = +value
1619
- offset = offset | 0
1734
+ offset = offset >>> 0
1620
1735
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1621
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1622
- this[offset] = (value >>> 24)
1623
- this[offset + 1] = (value >>> 16)
1624
- this[offset + 2] = (value >>> 8)
1625
- this[offset + 3] = (value & 0xff)
1626
- } else {
1627
- objectWriteUInt32(this, value, offset, false)
1628
- }
1736
+ this[offset] = (value >>> 24)
1737
+ this[offset + 1] = (value >>> 16)
1738
+ this[offset + 2] = (value >>> 8)
1739
+ this[offset + 3] = (value & 0xff)
1629
1740
  return offset + 4
1630
1741
  }
1631
1742
 
1743
+ function wrtBigUInt64LE (buf, value, offset, min, max) {
1744
+ checkIntBI(value, min, max, buf, offset, 7)
1745
+
1746
+ let lo = Number(value & BigInt(0xffffffff))
1747
+ buf[offset++] = lo
1748
+ lo = lo >> 8
1749
+ buf[offset++] = lo
1750
+ lo = lo >> 8
1751
+ buf[offset++] = lo
1752
+ lo = lo >> 8
1753
+ buf[offset++] = lo
1754
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
1755
+ buf[offset++] = hi
1756
+ hi = hi >> 8
1757
+ buf[offset++] = hi
1758
+ hi = hi >> 8
1759
+ buf[offset++] = hi
1760
+ hi = hi >> 8
1761
+ buf[offset++] = hi
1762
+ return offset
1763
+ }
1764
+
1765
+ function wrtBigUInt64BE (buf, value, offset, min, max) {
1766
+ checkIntBI(value, min, max, buf, offset, 7)
1767
+
1768
+ let lo = Number(value & BigInt(0xffffffff))
1769
+ buf[offset + 7] = lo
1770
+ lo = lo >> 8
1771
+ buf[offset + 6] = lo
1772
+ lo = lo >> 8
1773
+ buf[offset + 5] = lo
1774
+ lo = lo >> 8
1775
+ buf[offset + 4] = lo
1776
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
1777
+ buf[offset + 3] = hi
1778
+ hi = hi >> 8
1779
+ buf[offset + 2] = hi
1780
+ hi = hi >> 8
1781
+ buf[offset + 1] = hi
1782
+ hi = hi >> 8
1783
+ buf[offset] = hi
1784
+ return offset + 8
1785
+ }
1786
+
1787
+ Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
1788
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1789
+ })
1790
+
1791
+ Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
1792
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1793
+ })
1794
+
1632
1795
  Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1633
1796
  value = +value
1634
- offset = offset | 0
1797
+ offset = offset >>> 0
1635
1798
  if (!noAssert) {
1636
- var limit = Math.pow(2, 8 * byteLength - 1)
1799
+ const limit = Math.pow(2, (8 * byteLength) - 1)
1637
1800
 
1638
1801
  checkInt(this, value, offset, byteLength, limit - 1, -limit)
1639
1802
  }
1640
1803
 
1641
- var i = 0
1642
- var mul = 1
1643
- var sub = 0
1804
+ let i = 0
1805
+ let mul = 1
1806
+ let sub = 0
1644
1807
  this[offset] = value & 0xFF
1645
1808
  while (++i < byteLength && (mul *= 0x100)) {
1646
1809
  if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
@@ -1654,16 +1817,16 @@ Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, no
1654
1817
 
1655
1818
  Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1656
1819
  value = +value
1657
- offset = offset | 0
1820
+ offset = offset >>> 0
1658
1821
  if (!noAssert) {
1659
- var limit = Math.pow(2, 8 * byteLength - 1)
1822
+ const limit = Math.pow(2, (8 * byteLength) - 1)
1660
1823
 
1661
1824
  checkInt(this, value, offset, byteLength, limit - 1, -limit)
1662
1825
  }
1663
1826
 
1664
- var i = byteLength - 1
1665
- var mul = 1
1666
- var sub = 0
1827
+ let i = byteLength - 1
1828
+ let mul = 1
1829
+ let sub = 0
1667
1830
  this[offset + i] = value & 0xFF
1668
1831
  while (--i >= 0 && (mul *= 0x100)) {
1669
1832
  if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
@@ -1677,9 +1840,8 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no
1677
1840
 
1678
1841
  Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1679
1842
  value = +value
1680
- offset = offset | 0
1843
+ offset = offset >>> 0
1681
1844
  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1682
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1683
1845
  if (value < 0) value = 0xff + value + 1
1684
1846
  this[offset] = (value & 0xff)
1685
1847
  return offset + 1
@@ -1687,67 +1849,61 @@ Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1687
1849
 
1688
1850
  Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1689
1851
  value = +value
1690
- offset = offset | 0
1852
+ offset = offset >>> 0
1691
1853
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1692
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1693
- this[offset] = (value & 0xff)
1694
- this[offset + 1] = (value >>> 8)
1695
- } else {
1696
- objectWriteUInt16(this, value, offset, true)
1697
- }
1854
+ this[offset] = (value & 0xff)
1855
+ this[offset + 1] = (value >>> 8)
1698
1856
  return offset + 2
1699
1857
  }
1700
1858
 
1701
1859
  Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1702
1860
  value = +value
1703
- offset = offset | 0
1861
+ offset = offset >>> 0
1704
1862
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1705
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1706
- this[offset] = (value >>> 8)
1707
- this[offset + 1] = (value & 0xff)
1708
- } else {
1709
- objectWriteUInt16(this, value, offset, false)
1710
- }
1863
+ this[offset] = (value >>> 8)
1864
+ this[offset + 1] = (value & 0xff)
1711
1865
  return offset + 2
1712
1866
  }
1713
1867
 
1714
1868
  Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1715
1869
  value = +value
1716
- offset = offset | 0
1870
+ offset = offset >>> 0
1717
1871
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1718
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1719
- this[offset] = (value & 0xff)
1720
- this[offset + 1] = (value >>> 8)
1721
- this[offset + 2] = (value >>> 16)
1722
- this[offset + 3] = (value >>> 24)
1723
- } else {
1724
- objectWriteUInt32(this, value, offset, true)
1725
- }
1872
+ this[offset] = (value & 0xff)
1873
+ this[offset + 1] = (value >>> 8)
1874
+ this[offset + 2] = (value >>> 16)
1875
+ this[offset + 3] = (value >>> 24)
1726
1876
  return offset + 4
1727
1877
  }
1728
1878
 
1729
1879
  Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1730
1880
  value = +value
1731
- offset = offset | 0
1881
+ offset = offset >>> 0
1732
1882
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1733
1883
  if (value < 0) value = 0xffffffff + value + 1
1734
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1735
- this[offset] = (value >>> 24)
1736
- this[offset + 1] = (value >>> 16)
1737
- this[offset + 2] = (value >>> 8)
1738
- this[offset + 3] = (value & 0xff)
1739
- } else {
1740
- objectWriteUInt32(this, value, offset, false)
1741
- }
1884
+ this[offset] = (value >>> 24)
1885
+ this[offset + 1] = (value >>> 16)
1886
+ this[offset + 2] = (value >>> 8)
1887
+ this[offset + 3] = (value & 0xff)
1742
1888
  return offset + 4
1743
1889
  }
1744
1890
 
1891
+ Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
1892
+ return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1893
+ })
1894
+
1895
+ Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
1896
+ return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1897
+ })
1898
+
1745
1899
  function checkIEEE754 (buf, value, offset, ext, max, min) {
1746
1900
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
1747
1901
  if (offset < 0) throw new RangeError('Index out of range')
1748
1902
  }
1749
1903
 
1750
1904
  function writeFloat (buf, value, offset, littleEndian, noAssert) {
1905
+ value = +value
1906
+ offset = offset >>> 0
1751
1907
  if (!noAssert) {
1752
1908
  checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1753
1909
  }
@@ -1764,6 +1920,8 @@ Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert)
1764
1920
  }
1765
1921
 
1766
1922
  function writeDouble (buf, value, offset, littleEndian, noAssert) {
1923
+ value = +value
1924
+ offset = offset >>> 0
1767
1925
  if (!noAssert) {
1768
1926
  checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1769
1927
  }
@@ -1781,6 +1939,7 @@ Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert
1781
1939
 
1782
1940
  // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1783
1941
  Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1942
+ if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
1784
1943
  if (!start) start = 0
1785
1944
  if (!end && end !== 0) end = this.length
1786
1945
  if (targetStart >= target.length) targetStart = target.length
@@ -1795,7 +1954,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1795
1954
  if (targetStart < 0) {
1796
1955
  throw new RangeError('targetStart out of bounds')
1797
1956
  }
1798
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
1957
+ if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
1799
1958
  if (end < 0) throw new RangeError('sourceEnd out of bounds')
1800
1959
 
1801
1960
  // Are we oob?
@@ -1804,23 +1963,15 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1804
1963
  end = target.length - targetStart + start
1805
1964
  }
1806
1965
 
1807
- var len = end - start
1808
- var i
1966
+ const len = end - start
1809
1967
 
1810
- if (this === target && start < targetStart && targetStart < end) {
1811
- // descending copy from end
1812
- for (i = len - 1; i >= 0; --i) {
1813
- target[i + targetStart] = this[i + start]
1814
- }
1815
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
1816
- // ascending copy from start
1817
- for (i = 0; i < len; ++i) {
1818
- target[i + targetStart] = this[i + start]
1819
- }
1968
+ if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
1969
+ // Use built-in when available, missing from IE11
1970
+ this.copyWithin(targetStart, start, end)
1820
1971
  } else {
1821
1972
  Uint8Array.prototype.set.call(
1822
1973
  target,
1823
- this.subarray(start, start + len),
1974
+ this.subarray(start, end),
1824
1975
  targetStart
1825
1976
  )
1826
1977
  }
@@ -1843,20 +1994,24 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
1843
1994
  encoding = end
1844
1995
  end = this.length
1845
1996
  }
1846
- if (val.length === 1) {
1847
- var code = val.charCodeAt(0)
1848
- if (code < 256) {
1849
- val = code
1850
- }
1851
- }
1852
1997
  if (encoding !== undefined && typeof encoding !== 'string') {
1853
1998
  throw new TypeError('encoding must be a string')
1854
1999
  }
1855
2000
  if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1856
2001
  throw new TypeError('Unknown encoding: ' + encoding)
1857
2002
  }
2003
+ if (val.length === 1) {
2004
+ const code = val.charCodeAt(0)
2005
+ if ((encoding === 'utf8' && code < 128) ||
2006
+ encoding === 'latin1') {
2007
+ // Fast path: If `val` fits into a single byte, use that numeric value.
2008
+ val = code
2009
+ }
2010
+ }
1858
2011
  } else if (typeof val === 'number') {
1859
2012
  val = val & 255
2013
+ } else if (typeof val === 'boolean') {
2014
+ val = Number(val)
1860
2015
  }
1861
2016
 
1862
2017
  // Invalid ranges are not set to a default, so can range check early.
@@ -1873,16 +2028,20 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
1873
2028
 
1874
2029
  if (!val) val = 0
1875
2030
 
1876
- var i
2031
+ let i
1877
2032
  if (typeof val === 'number') {
1878
2033
  for (i = start; i < end; ++i) {
1879
2034
  this[i] = val
1880
2035
  }
1881
2036
  } else {
1882
- var bytes = Buffer.isBuffer(val)
2037
+ const bytes = Buffer.isBuffer(val)
1883
2038
  ? val
1884
- : utf8ToBytes(new Buffer(val, encoding).toString())
1885
- var len = bytes.length
2039
+ : Buffer.from(val, encoding)
2040
+ const len = bytes.length
2041
+ if (len === 0) {
2042
+ throw new TypeError('The value "' + val +
2043
+ '" is invalid for argument "value"')
2044
+ }
1886
2045
  for (i = 0; i < end - start; ++i) {
1887
2046
  this[i + start] = bytes[i % len]
1888
2047
  }
@@ -1891,14 +2050,149 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
1891
2050
  return this
1892
2051
  }
1893
2052
 
2053
+ // CUSTOM ERRORS
2054
+ // =============
2055
+
2056
+ // Simplified versions from Node, changed for Buffer-only usage
2057
+ const errors = {}
2058
+ function E (sym, getMessage, Base) {
2059
+ errors[sym] = class NodeError extends Base {
2060
+ constructor () {
2061
+ super()
2062
+
2063
+ Object.defineProperty(this, 'message', {
2064
+ value: getMessage.apply(this, arguments),
2065
+ writable: true,
2066
+ configurable: true
2067
+ })
2068
+
2069
+ // Add the error code to the name to include it in the stack trace.
2070
+ this.name = `${this.name} [${sym}]`
2071
+ // Access the stack to generate the error message including the error code
2072
+ // from the name.
2073
+ this.stack // eslint-disable-line no-unused-expressions
2074
+ // Reset the name to the actual name.
2075
+ delete this.name
2076
+ }
2077
+
2078
+ get code () {
2079
+ return sym
2080
+ }
2081
+
2082
+ set code (value) {
2083
+ Object.defineProperty(this, 'code', {
2084
+ configurable: true,
2085
+ enumerable: true,
2086
+ value,
2087
+ writable: true
2088
+ })
2089
+ }
2090
+
2091
+ toString () {
2092
+ return `${this.name} [${sym}]: ${this.message}`
2093
+ }
2094
+ }
2095
+ }
2096
+
2097
+ E('ERR_BUFFER_OUT_OF_BOUNDS',
2098
+ function (name) {
2099
+ if (name) {
2100
+ return `${name} is outside of buffer bounds`
2101
+ }
2102
+
2103
+ return 'Attempt to access memory outside buffer bounds'
2104
+ }, RangeError)
2105
+ E('ERR_INVALID_ARG_TYPE',
2106
+ function (name, actual) {
2107
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`
2108
+ }, TypeError)
2109
+ E('ERR_OUT_OF_RANGE',
2110
+ function (str, range, input) {
2111
+ let msg = `The value of "${str}" is out of range.`
2112
+ let received = input
2113
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
2114
+ received = addNumericalSeparator(String(input))
2115
+ } else if (typeof input === 'bigint') {
2116
+ received = String(input)
2117
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
2118
+ received = addNumericalSeparator(received)
2119
+ }
2120
+ received += 'n'
2121
+ }
2122
+ msg += ` It must be ${range}. Received ${received}`
2123
+ return msg
2124
+ }, RangeError)
2125
+
2126
+ function addNumericalSeparator (val) {
2127
+ let res = ''
2128
+ let i = val.length
2129
+ const start = val[0] === '-' ? 1 : 0
2130
+ for (; i >= start + 4; i -= 3) {
2131
+ res = `_${val.slice(i - 3, i)}${res}`
2132
+ }
2133
+ return `${val.slice(0, i)}${res}`
2134
+ }
2135
+
2136
+ // CHECK FUNCTIONS
2137
+ // ===============
2138
+
2139
+ function checkBounds (buf, offset, byteLength) {
2140
+ validateNumber(offset, 'offset')
2141
+ if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
2142
+ boundsError(offset, buf.length - (byteLength + 1))
2143
+ }
2144
+ }
2145
+
2146
+ function checkIntBI (value, min, max, buf, offset, byteLength) {
2147
+ if (value > max || value < min) {
2148
+ const n = typeof min === 'bigint' ? 'n' : ''
2149
+ let range
2150
+ if (byteLength > 3) {
2151
+ if (min === 0 || min === BigInt(0)) {
2152
+ range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
2153
+ } else {
2154
+ range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
2155
+ `${(byteLength + 1) * 8 - 1}${n}`
2156
+ }
2157
+ } else {
2158
+ range = `>= ${min}${n} and <= ${max}${n}`
2159
+ }
2160
+ throw new errors.ERR_OUT_OF_RANGE('value', range, value)
2161
+ }
2162
+ checkBounds(buf, offset, byteLength)
2163
+ }
2164
+
2165
+ function validateNumber (value, name) {
2166
+ if (typeof value !== 'number') {
2167
+ throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
2168
+ }
2169
+ }
2170
+
2171
+ function boundsError (value, length, type) {
2172
+ if (Math.floor(value) !== value) {
2173
+ validateNumber(value, type)
2174
+ throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
2175
+ }
2176
+
2177
+ if (length < 0) {
2178
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
2179
+ }
2180
+
2181
+ throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
2182
+ `>= ${type ? 1 : 0} and <= ${length}`,
2183
+ value)
2184
+ }
2185
+
1894
2186
  // HELPER FUNCTIONS
1895
2187
  // ================
1896
2188
 
1897
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
2189
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
1898
2190
 
1899
2191
  function base64clean (str) {
2192
+ // Node takes equal signs as end of the Base64 encoding
2193
+ str = str.split('=')[0]
1900
2194
  // Node strips out invalid characters like \n and \t from the string, base64-js does not
1901
- str = stringtrim(str).replace(INVALID_BASE64_RE, '')
2195
+ str = str.trim().replace(INVALID_BASE64_RE, '')
1902
2196
  // Node converts strings with length < 2 to ''
1903
2197
  if (str.length < 2) return ''
1904
2198
  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
@@ -1908,24 +2202,14 @@ function base64clean (str) {
1908
2202
  return str
1909
2203
  }
1910
2204
 
1911
- function stringtrim (str) {
1912
- if (str.trim) return str.trim()
1913
- return str.replace(/^\s+|\s+$/g, '')
1914
- }
1915
-
1916
- function toHex (n) {
1917
- if (n < 16) return '0' + n.toString(16)
1918
- return n.toString(16)
1919
- }
1920
-
1921
2205
  function utf8ToBytes (string, units) {
1922
2206
  units = units || Infinity
1923
- var codePoint
1924
- var length = string.length
1925
- var leadSurrogate = null
1926
- var bytes = []
2207
+ let codePoint
2208
+ const length = string.length
2209
+ let leadSurrogate = null
2210
+ const bytes = []
1927
2211
 
1928
- for (var i = 0; i < length; ++i) {
2212
+ for (let i = 0; i < length; ++i) {
1929
2213
  codePoint = string.charCodeAt(i)
1930
2214
 
1931
2215
  // is surrogate component
@@ -1999,8 +2283,8 @@ function utf8ToBytes (string, units) {
1999
2283
  }
2000
2284
 
2001
2285
  function asciiToBytes (str) {
2002
- var byteArray = []
2003
- for (var i = 0; i < str.length; ++i) {
2286
+ const byteArray = []
2287
+ for (let i = 0; i < str.length; ++i) {
2004
2288
  // Node's code seems to be doing this and not & 0x7F..
2005
2289
  byteArray.push(str.charCodeAt(i) & 0xFF)
2006
2290
  }
@@ -2008,9 +2292,9 @@ function asciiToBytes (str) {
2008
2292
  }
2009
2293
 
2010
2294
  function utf16leToBytes (str, units) {
2011
- var c, hi, lo
2012
- var byteArray = []
2013
- for (var i = 0; i < str.length; ++i) {
2295
+ let c, hi, lo
2296
+ const byteArray = []
2297
+ for (let i = 0; i < str.length; ++i) {
2014
2298
  if ((units -= 2) < 0) break
2015
2299
 
2016
2300
  c = str.charCodeAt(i)
@@ -2028,31 +2312,49 @@ function base64ToBytes (str) {
2028
2312
  }
2029
2313
 
2030
2314
  function blitBuffer (src, dst, offset, length) {
2031
- for (var i = 0; i < length; ++i) {
2315
+ let i
2316
+ for (i = 0; i < length; ++i) {
2032
2317
  if ((i + offset >= dst.length) || (i >= src.length)) break
2033
2318
  dst[i + offset] = src[i]
2034
2319
  }
2035
2320
  return i
2036
2321
  }
2037
2322
 
2038
- function isnan (val) {
2039
- return val !== val // eslint-disable-line no-self-compare
2323
+ // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
2324
+ // the `instanceof` check but they should be treated as of that type.
2325
+ // See: https://github.com/feross/buffer/issues/166
2326
+ function isInstance (obj, type) {
2327
+ return obj instanceof type ||
2328
+ (obj != null && obj.constructor != null && obj.constructor.name != null &&
2329
+ obj.constructor.name === type.name)
2330
+ }
2331
+ function numberIsNaN (obj) {
2332
+ // For IE11 support
2333
+ return obj !== obj // eslint-disable-line no-self-compare
2040
2334
  }
2041
2335
 
2336
+ // Create lookup table for `toString('hex')`
2337
+ // See: https://github.com/feross/buffer/issues/219
2338
+ const hexSliceLookupTable = (function () {
2339
+ const alphabet = '0123456789abcdef'
2340
+ const table = new Array(256)
2341
+ for (let i = 0; i < 16; ++i) {
2342
+ const i16 = i * 16
2343
+ for (let j = 0; j < 16; ++j) {
2344
+ table[i16 + j] = alphabet[i] + alphabet[j]
2345
+ }
2346
+ }
2347
+ return table
2348
+ })()
2042
2349
 
2043
- /***/ }),
2044
-
2045
- /***/ "../../node_modules/buffer/node_modules/isarray/index.js":
2046
- /*!***************************************************************!*\
2047
- !*** ../../node_modules/buffer/node_modules/isarray/index.js ***!
2048
- \***************************************************************/
2049
- /***/ (function(module) {
2050
-
2051
- var toString = {}.toString;
2350
+ // Return not function with Error if BigInt not supported
2351
+ function defineBigIntMethod (fn) {
2352
+ return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
2353
+ }
2052
2354
 
2053
- module.exports = Array.isArray || function (arr) {
2054
- return toString.call(arr) == '[object Array]';
2055
- };
2355
+ function BufferBigIntNotDefined () {
2356
+ throw new Error('BigInt not supported')
2357
+ }
2056
2358
 
2057
2359
 
2058
2360
  /***/ }),
@@ -13465,7 +13767,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"css-tree","version":"1.1.3","
13465
13767
  /***/ (function(module) {
13466
13768
 
13467
13769
  "use strict";
13468
- /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
13770
+ /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
13469
13771
 
13470
13772
 
13471
13773
 
@@ -13653,7 +13955,7 @@ function lookupGetter(object, prop) {
13653
13955
  }
13654
13956
 
13655
13957
  const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
13656
- const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'slot', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
13958
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
13657
13959
  const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
13658
13960
  // List of SVG elements that are disallowed by default.
13659
13961
  // We still need to know them so that we can do namespace
@@ -13667,7 +13969,7 @@ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongd
13667
13969
  const text = freeze(['#text']);
13668
13970
 
13669
13971
  const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
13670
- const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
13972
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
13671
13973
  const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
13672
13974
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
13673
13975
 
@@ -13774,7 +14076,7 @@ const _createHooksMap = function _createHooksMap() {
13774
14076
  function createDOMPurify() {
13775
14077
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
13776
14078
  const DOMPurify = root => createDOMPurify(root);
13777
- DOMPurify.version = '3.2.7';
14079
+ DOMPurify.version = '3.3.0';
13778
14080
  DOMPurify.removed = [];
13779
14081
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
13780
14082
  // Not running in a browser, provide a factory function
@@ -13885,6 +14187,21 @@ function createDOMPurify() {
13885
14187
  let FORBID_TAGS = null;
13886
14188
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
13887
14189
  let FORBID_ATTR = null;
14190
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
14191
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
14192
+ tagCheck: {
14193
+ writable: true,
14194
+ configurable: false,
14195
+ enumerable: true,
14196
+ value: null
14197
+ },
14198
+ attributeCheck: {
14199
+ writable: true,
14200
+ configurable: false,
14201
+ enumerable: true,
14202
+ value: null
14203
+ }
14204
+ }));
13888
14205
  /* Decide if ARIA attributes are okay */
13889
14206
  let ALLOW_ARIA_ATTR = true;
13890
14207
  /* Decide if custom data attributes are okay */
@@ -14077,16 +14394,24 @@ function createDOMPurify() {
14077
14394
  }
14078
14395
  /* Merge configuration parameters */
14079
14396
  if (cfg.ADD_TAGS) {
14080
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
14081
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
14397
+ if (typeof cfg.ADD_TAGS === 'function') {
14398
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
14399
+ } else {
14400
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
14401
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
14402
+ }
14403
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
14082
14404
  }
14083
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
14084
14405
  }
14085
14406
  if (cfg.ADD_ATTR) {
14086
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
14087
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
14407
+ if (typeof cfg.ADD_ATTR === 'function') {
14408
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
14409
+ } else {
14410
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
14411
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
14412
+ }
14413
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
14088
14414
  }
14089
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
14090
14415
  }
14091
14416
  if (cfg.ADD_URI_SAFE_ATTR) {
14092
14417
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -14394,7 +14719,7 @@ function createDOMPurify() {
14394
14719
  return true;
14395
14720
  }
14396
14721
  /* Remove element if anything forbids its presence */
14397
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
14722
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
14398
14723
  /* Check if we have a custom element to handle */
14399
14724
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
14400
14725
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -14466,7 +14791,7 @@ function createDOMPurify() {
14466
14791
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
14467
14792
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
14468
14793
  We don't need to check the value; it's always URI safe. */
14469
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
14794
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
14470
14795
  if (
14471
14796
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
14472
14797
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
@@ -29696,8 +30021,8 @@ var base64js = __webpack_require__(/*! base64-js */ "../../node_modules/base64-j
29696
30021
  */
29697
30022
  var BitmapAdapter = /*#__PURE__*/function () {
29698
30023
  /**
29699
- * @param {?function} makeImage HTML image constructor. Tests can provide this.
29700
- * @param {?function} makeCanvas HTML canvas constructor. Tests can provide this.
30024
+ * @param {?Function} makeImage HTML image constructor. Tests can provide this.
30025
+ * @param {?Function} makeCanvas HTML canvas constructor. Tests can provide this.
29701
30026
  */
29702
30027
  function BitmapAdapter(makeImage, makeCanvas) {
29703
30028
  _classCallCheck(this, BitmapAdapter);
@@ -29744,7 +30069,7 @@ var BitmapAdapter = /*#__PURE__*/function () {
29744
30069
  * to resolution 2 bitmaps. Therefore, converting a resolution 1 bitmap means doubling
29745
30070
  * it in width and height.
29746
30071
  * @param {!string} dataURI Base 64 encoded image data of the bitmap
29747
- * @param {!function} callback Node-style callback that returns updated dataURI if conversion succeeded
30072
+ * @param {!Function} callback Node-style callback that returns updated dataURI if conversion succeeded
29748
30073
  */
29749
30074
  }, {
29750
30075
  key: "convertResolution1Bitmap",
@@ -29765,7 +30090,7 @@ var BitmapAdapter = /*#__PURE__*/function () {
29765
30090
  * to in Scratch 3.0
29766
30091
  * @param {!number} oldWidth original width
29767
30092
  * @param {!number} oldHeight original height
29768
- * @return {object} Array of new width, new height
30093
+ * @returns {object} Array of new width, new height
29769
30094
  */
29770
30095
  }, {
29771
30096
  key: "getResizedWidthHeight",
@@ -29959,7 +30284,7 @@ module.exports = function (svgString) {
29959
30284
  /**
29960
30285
  * Given an SVG, replace Scratch 2.0 fonts with new 3.0 fonts. Add defaults where there are none.
29961
30286
  * @param {SVGElement} svgTag The SVG dom object
29962
- * @return {void}
30287
+ * @returns {void}
29963
30288
  */
29964
30289
  var convertFonts = function convertFonts(svgTag) {
29965
30290
  // Collect all text elements into a list.
@@ -30018,7 +30343,7 @@ var getFonts = __webpack_require__(/*! scratch-render-fonts */ "../../node_modul
30018
30343
  * // Using a <link> or <style>@import</style> to link to font-family
30019
30344
  * // injected into the document: no effect.
30020
30345
  * @param {string} svgString The string representation of the svg to modify
30021
- * @return {string} The svg with any needed fonts inlined
30346
+ * @returns {string} The svg with any needed fonts inlined
30022
30347
  */
30023
30348
  var inlineSvgFonts = function inlineSvgFonts(svgString) {
30024
30349
  var FONTS = getFonts();
@@ -30111,7 +30436,7 @@ var _require = __webpack_require__(/*! ./sanitize-svg */ "../scratch-svg-rendere
30111
30436
  /**
30112
30437
  * @param {SVGElement} svgTag the tag to search within
30113
30438
  * @param {string} [tagName] svg tag to search for (or collect all elements if not given)
30114
- * @return {Array} a list of elements with the given tagname
30439
+ * @returns {Array} a list of elements with the given tagname
30115
30440
  */
30116
30441
  var collectElements = function collectElements(svgTag, tagName) {
30117
30442
  var elts = [];
@@ -30292,7 +30617,7 @@ var transformText = function transformText(svgTag) {
30292
30617
  * This is used to enlarge the computed bounding box, which doesn't take
30293
30618
  * stroke width into account.
30294
30619
  * @param {SVGSVGElement} rootNode The root SVG node to traverse.
30295
- * @return {number} The largest stroke width in the SVG.
30620
+ * @returns {number} The largest stroke width in the SVG.
30296
30621
  */
30297
30622
  var findLargestStrokeWidth = function findLargestStrokeWidth(rootNode) {
30298
30623
  var largestStrokeWidth = 0;
@@ -30434,7 +30759,7 @@ var normalizeSvg = function normalizeSvg(svgTag, fromVersion2) {
30434
30759
  * mimic Scratch 2.0's SVG rendering.
30435
30760
  * @param {!string} svgString String of SVG data to draw in quirks-mode.
30436
30761
  * @param {boolean} [fromVersion2] True if we should perform conversion from version 2 to version 3 svg.
30437
- * @return {SVGSVGElement} The normalized SVG element.
30762
+ * @returns {SVGSVGElement} The normalized SVG element.
30438
30763
  */
30439
30764
  var loadSvgString = function loadSvgString(svgString, fromVersion2) {
30440
30765
  // Parse string into SVG XML.
@@ -30549,7 +30874,7 @@ var _TextDecoder;
30549
30874
  var _TextEncoder;
30550
30875
  if (typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined') {
30551
30876
  // Wait to require the text encoding polyfill until we know it's needed.
30552
- // eslint-disable-next-line global-require
30877
+
30553
30878
  var encoding = __webpack_require__(/*! fastestsmallesttextencoderdecoder */ "../../node_modules/fastestsmallesttextencoderdecoder/EncoderDecoderTogether.min.js");
30554
30879
  _TextDecoder = encoding.TextDecoder;
30555
30880
  _TextEncoder = encoding.TextEncoder;
@@ -30561,7 +30886,7 @@ if (typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined') {
30561
30886
  /**
30562
30887
  * Load an SVG Uint8Array of bytes and "sanitize" it
30563
30888
  * @param {!Uint8Array} rawData unsanitized SVG daata
30564
- * @return {Uint8Array} sanitized SVG data
30889
+ * @returns {Uint8Array} sanitized SVG data
30565
30890
  */
30566
30891
  sanitizeSvg.sanitizeByteStream = function (rawData) {
30567
30892
  var decoder = new _TextDecoder();
@@ -30575,7 +30900,7 @@ sanitizeSvg.sanitizeByteStream = function (rawData) {
30575
30900
  * fixup-svg-string.js, and thus more risky; there are known examples of SVGs that
30576
30901
  * it will clobber. We use DOMPurify's svg profile, which restricts many types of tag.
30577
30902
  * @param {!string} rawSvgText unsanitized SVG string
30578
- * @return {string} sanitized SVG text
30903
+ * @returns {string} sanitized SVG text
30579
30904
  */
30580
30905
  sanitizeSvg.sanitizeSvgText = function (rawSvgText) {
30581
30906
  var sanitizedText = DOMPurify.sanitize(rawSvgText, {
@@ -30750,7 +31075,7 @@ var SvgRenderer = /*#__PURE__*/function () {
30750
31075
  * Create a quirks-mode SVG renderer for a particular canvas.
30751
31076
  * @param {HTMLCanvasElement} [canvas] An optional canvas element to draw to. If this is not provided, the renderer
30752
31077
  * will create a new canvas.
30753
- * @constructor
31078
+ * @class
30754
31079
  */
30755
31080
  function SvgRenderer(canvas) {
30756
31081
  _classCallCheck(this, SvgRenderer);
@@ -30807,7 +31132,7 @@ var SvgRenderer = /*#__PURE__*/function () {
30807
31132
  }
30808
31133
 
30809
31134
  /**
30810
- * @return {Array<number>} the natural size, in Scratch units, of this SVG.
31135
+ * @returns {Array<number>} the natural size, in Scratch units, of this SVG.
30811
31136
  */
30812
31137
  }, {
30813
31138
  key: "size",
@@ -30816,7 +31141,7 @@ var SvgRenderer = /*#__PURE__*/function () {
30816
31141
  }
30817
31142
 
30818
31143
  /**
30819
- * @return {Array<number>} the offset (upper left corner) of the SVG's view box.
31144
+ * @returns {Array<number>} the offset (upper left corner) of the SVG's view box.
30820
31145
  */
30821
31146
  }, {
30822
31147
  key: "viewOffset",
@@ -30904,7 +31229,7 @@ var SvgRenderer = /*#__PURE__*/function () {
30904
31229
  /**
30905
31230
  * Draw to the canvas from a loaded image element.
30906
31231
  * @param {number} [scale] - Optionally, also scale the image by this factor.
30907
- **/
31232
+ */
30908
31233
  }, {
30909
31234
  key: "_drawFromImage",
30910
31235
  value: function _drawFromImage(scale) {
@@ -31478,14 +31803,13 @@ var _parseUrl = function _parseUrl(value, windowRef) {
31478
31803
  * on groups down to the leaf level and averaging out the stroke width
31479
31804
  * around the shapes. Note that this doens't just change stroke widths, it
31480
31805
  * changes path data and attributes throughout the SVG.
31481
- *
31482
31806
  * @param {SVGElement} svgTag The SVG dom object
31483
31807
  * @param {Window} windowRef The window to use. Need to pass in for
31484
31808
  * tests to work, as they get angry at even the mention of window.
31485
31809
  * @param {object} bboxForTesting The bounds to use. Need to pass in for
31486
31810
  * tests only, because getBBox doesn't work in Node. This should
31487
31811
  * be the bounds of the svgTag without including stroke width or transforms.
31488
- * @return {void}
31812
+ * @returns {void}
31489
31813
  */
31490
31814
  var transformStrokeWidths = function transformStrokeWidths(svgTag, windowRef, bboxForTesting) {
31491
31815
  var inherited = Matrix.identity();
@@ -31654,7 +31978,7 @@ var Skin = __webpack_require__(/*! ./Skin */ "./src/Skin.js");
31654
31978
  var BitmapSkin = /*#__PURE__*/function (_Skin) {
31655
31979
  /**
31656
31980
  * Create a new Bitmap Skin.
31657
- * @extends Skin
31981
+ * @augments Skin
31658
31982
  * @param {!int} id - The ID for this Skin.
31659
31983
  * @param {!RenderWebGL} renderer - The renderer which will use this skin.
31660
31984
  */
@@ -31689,7 +32013,7 @@ var BitmapSkin = /*#__PURE__*/function (_Skin) {
31689
32013
  }
31690
32014
 
31691
32015
  /**
31692
- * @return {Array<number>} the "native" size, in texels, of this skin.
32016
+ * @returns {Array<number>} the "native" size, in texels, of this skin.
31693
32017
  */
31694
32018
  }, {
31695
32019
  key: "size",
@@ -31699,7 +32023,7 @@ var BitmapSkin = /*#__PURE__*/function (_Skin) {
31699
32023
 
31700
32024
  /**
31701
32025
  * @param {Array<number>} scale - The scaling factors to be used.
31702
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
32026
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
31703
32027
  */
31704
32028
  // eslint-disable-next-line no-unused-vars
31705
32029
  }, {
@@ -31711,7 +32035,7 @@ var BitmapSkin = /*#__PURE__*/function (_Skin) {
31711
32035
  /**
31712
32036
  * Set the contents of this skin to a snapshot of the provided bitmap data.
31713
32037
  * @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} bitmapData - new contents for this skin.
31714
- * @param {int} [costumeResolution=1] - The resolution to use for this bitmap.
32038
+ * @param {int} [costumeResolution] - The resolution to use for this bitmap.
31715
32039
  * @param {Array<number>} [rotationCenter] - Optional rotation center for the bitmap. If not supplied, it will be
31716
32040
  * calculated from the bounding box
31717
32041
  * @fires Skin.event:WasAltered
@@ -31810,10 +32134,9 @@ var FLOATING_POINT_ERROR_ALLOWANCE = 1e-6;
31810
32134
  * internal __isTouchingPosition as a return value, so this should be copied
31811
32135
  * if you ever need to get two local positions and store both. Requires that
31812
32136
  * the drawable inverseMatrix is up to date.
31813
- *
31814
32137
  * @param {Drawable} drawable The drawable to get the inverse matrix and uniforms from
31815
32138
  * @param {twgl.v3} vec [x,y] scratch space vector
31816
- * @return {twgl.v3} [x,y] texture space float vector - transformed by effects and matrix
32139
+ * @returns {twgl.v3} [x,y] texture space float vector - transformed by effects and matrix
31817
32140
  */
31818
32141
  var getLocalPosition = function getLocalPosition(drawable, vec) {
31819
32142
  // Transfrom from world coordinates to Drawable coordinates.
@@ -31845,7 +32168,7 @@ var Drawable = /*#__PURE__*/function () {
31845
32168
  * An object which can be drawn by the renderer.
31846
32169
  * @todo double-buffer all rendering state (position, skin, effects, etc.)
31847
32170
  * @param {!int} id - This Drawable's unique ID.
31848
- * @constructor
32171
+ * @class
31849
32172
  */
31850
32173
  function Drawable(id) {
31851
32174
  _classCallCheck(this, Drawable);
@@ -31893,9 +32216,10 @@ var Drawable = /*#__PURE__*/function () {
31893
32216
  this._inverseTransformDirty = true;
31894
32217
  this._visible = true;
31895
32218
 
31896
- /** A bitmask identifying which effects are currently in use.
32219
+ /**
32220
+ * A bitmask identifying which effects are currently in use.
31897
32221
  * @readonly
31898
- * @type {int} */
32222
+ @type {int} */
31899
32223
  this.enabledEffects = 0;
31900
32224
 
31901
32225
  /** @todo move convex hull functionality, maybe bounds functionality overall, to Skin classes */
@@ -32249,7 +32573,7 @@ var Drawable = /*#__PURE__*/function () {
32249
32573
 
32250
32574
  /**
32251
32575
  * Whether the Drawable needs convex hull points provided by the renderer.
32252
- * @return {boolean} True when no convex hull known, or it's dirty.
32576
+ * @returns {boolean} True when no convex hull known, or it's dirty.
32253
32577
  */
32254
32578
  }, {
32255
32579
  key: "needsConvexHullPoints",
@@ -32293,7 +32617,7 @@ var Drawable = /*#__PURE__*/function () {
32293
32617
  * The caller is responsible for ensuring this drawable's inverse matrix & its skin's silhouette are up-to-date.
32294
32618
  * @see updateCPURenderAttributes
32295
32619
  * @param {twgl.v3} vec World coordinate vector.
32296
- * @return {boolean} True if the world position touches the skin.
32620
+ * @returns {boolean} True if the world position touches the skin.
32297
32621
  */
32298
32622
 
32299
32623
  // `updateCPURenderAttributes` sets this Drawable instance's `isTouching` method
@@ -32326,7 +32650,7 @@ var Drawable = /*#__PURE__*/function () {
32326
32650
  * and then finds the minimum box along the axes.
32327
32651
  * Before calling this, ensure the renderer has updated convex hull points.
32328
32652
  * @param {?Rectangle} result optional destination for bounds calculation
32329
- * @return {!Rectangle} Bounds for a tight box around the Drawable.
32653
+ * @returns {!Rectangle} Bounds for a tight box around the Drawable.
32330
32654
  */
32331
32655
  }, {
32332
32656
  key: "getBounds",
@@ -32349,7 +32673,7 @@ var Drawable = /*#__PURE__*/function () {
32349
32673
  * Used for calculating where to position a text bubble.
32350
32674
  * Before calling this, ensure the renderer has updated convex hull points.
32351
32675
  * @param {?Rectangle} result optional destination for bounds calculation
32352
- * @return {!Rectangle} Bounds for a tight box around a slice of the Drawable.
32676
+ * @returns {!Rectangle} Bounds for a tight box around a slice of the Drawable.
32353
32677
  */
32354
32678
  }, {
32355
32679
  key: "getBoundsForBubble",
@@ -32382,7 +32706,7 @@ var Drawable = /*#__PURE__*/function () {
32382
32706
  * `getAABB` returns a much less accurate bounding box, but will be much
32383
32707
  * faster to calculate so may be desired for quick checks/optimizations.
32384
32708
  * @param {?Rectangle} result optional destination for bounds calculation
32385
- * @return {!Rectangle} Rough axis-aligned bounding box for Drawable.
32709
+ * @returns {!Rectangle} Rough axis-aligned bounding box for Drawable.
32386
32710
  */
32387
32711
  }, {
32388
32712
  key: "getAABB",
@@ -32401,7 +32725,7 @@ var Drawable = /*#__PURE__*/function () {
32401
32725
  * I.e., returns the tight bounding box when the convex hull points are already
32402
32726
  * known, but otherwise return the rough AABB of the Drawable.
32403
32727
  * @param {?Rectangle} result optional destination for bounds calculation
32404
- * @return {!Rectangle} Bounds for the Drawable.
32728
+ * @returns {!Rectangle} Bounds for the Drawable.
32405
32729
  */
32406
32730
  }, {
32407
32731
  key: "getFastBounds",
@@ -32416,7 +32740,7 @@ var Drawable = /*#__PURE__*/function () {
32416
32740
  * Transform all the convex hull points by the current Drawable's
32417
32741
  * transform. This allows us to skip recalculating the convex hull
32418
32742
  * for many Drawable updates, including translation, rotation, scaling.
32419
- * @return {!Array.<!Array.number>} Array of glPoints which are Array<x, y>
32743
+ * @returns {!Array.<!Array.number>} Array of glPoints which are Array<x, y>
32420
32744
  * @private
32421
32745
  */
32422
32746
  }, {
@@ -32582,7 +32906,7 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
32582
32906
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
32583
32907
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32584
32908
  /**
32585
- * @fileoverview
32909
+ * @file
32586
32910
  * A utility to transform a texture coordinate to another texture coordinate
32587
32911
  * representing how the shaders apply effects.
32588
32912
  */
@@ -32595,13 +32919,13 @@ var ShaderManager = __webpack_require__(/*! ./ShaderManager */ "./src/ShaderMana
32595
32919
 
32596
32920
  /**
32597
32921
  * A texture coordinate is between 0 and 1. 0.5 is the center position.
32598
- * @const {number}
32922
+ * @constant {number}
32599
32923
  */
32600
32924
  var CENTER_X = 0.5;
32601
32925
 
32602
32926
  /**
32603
32927
  * A texture coordinate is between 0 and 1. 0.5 is the center position.
32604
- * @const {number}
32928
+ * @constant {number}
32605
32929
  */
32606
32930
  var CENTER_Y = 0.5;
32607
32931
 
@@ -32704,7 +33028,7 @@ var EffectTransform = /*#__PURE__*/function () {
32704
33028
  * @param {Drawable} drawable The drawable whose effects to emulate.
32705
33029
  * @param {twgl.v3} vec The texture coordinate to transform.
32706
33030
  * @param {twgl.v3} dst A place to store the output coordinate.
32707
- * @return {twgl.v3} dst - The coordinate after being transform by effects.
33031
+ * @returns {twgl.v3} dst - The coordinate after being transform by effects.
32708
33032
  */
32709
33033
  }, {
32710
33034
  key: "transformPoint",
@@ -32824,7 +33148,7 @@ var ShaderManager = __webpack_require__(/*! ./ShaderManager */ "./src/ShaderMana
32824
33148
  * @type {PenSkin#PenAttributes}
32825
33149
  * @memberof PenSkin
32826
33150
  * @private
32827
- * @const
33151
+ * @constant
32828
33152
  */
32829
33153
  var DefaultPenAttributes = {
32830
33154
  color4f: [0, 0, 1, 1],
@@ -32841,7 +33165,7 @@ var PenSkin = /*#__PURE__*/function (_Skin) {
32841
33165
  * Create a Skin which implements a Scratch pen layer.
32842
33166
  * @param {int} id - The unique ID for this Skin.
32843
33167
  * @param {RenderWebGL} renderer - The renderer which will use this Skin.
32844
- * @extends Skin
33168
+ * @augments Skin
32845
33169
  * @listens RenderWebGL#event:NativeSizeChanged
32846
33170
  */
32847
33171
  function PenSkin(id, renderer) {
@@ -32920,7 +33244,7 @@ var PenSkin = /*#__PURE__*/function (_Skin) {
32920
33244
  }
32921
33245
 
32922
33246
  /**
32923
- * @return {Array<number>} the "native" size, in texels, of this skin. [width, height]
33247
+ * @returns {Array<number>} the "native" size, in texels, of this skin. [width, height]
32924
33248
  */
32925
33249
  }, {
32926
33250
  key: "size",
@@ -32937,7 +33261,7 @@ var PenSkin = /*#__PURE__*/function (_Skin) {
32937
33261
 
32938
33262
  /**
32939
33263
  * @param {Array<number>} scale The X and Y scaling factors to be used, as percentages of this skin's "native" size.
32940
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
33264
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
32941
33265
  */
32942
33266
  // eslint-disable-next-line no-unused-vars
32943
33267
  }, {
@@ -33170,7 +33494,7 @@ var Rectangle = /*#__PURE__*/function () {
33170
33494
  * A utility for creating and comparing axis-aligned rectangles.
33171
33495
  * Rectangles are always initialized to the "largest possible rectangle";
33172
33496
  * use one of the init* methods below to set up a particular rectangle.
33173
- * @constructor
33497
+ * @class
33174
33498
  */
33175
33499
  function Rectangle() {
33176
33500
  _classCallCheck(this, Rectangle);
@@ -33257,7 +33581,7 @@ var Rectangle = /*#__PURE__*/function () {
33257
33581
  * Note that this is a comparison assuming the Rectangle was
33258
33582
  * initialized with Scratch-space bounds or points.
33259
33583
  * @param {!Rectangle} other Rectangle to check if intersecting.
33260
- * @return {boolean} True if this Rectangle intersects other.
33584
+ * @returns {boolean} True if this Rectangle intersects other.
33261
33585
  */
33262
33586
  }, {
33263
33587
  key: "intersects",
@@ -33270,7 +33594,7 @@ var Rectangle = /*#__PURE__*/function () {
33270
33594
  * Note that this is a comparison assuming the Rectangle was
33271
33595
  * initialized with Scratch-space bounds or points.
33272
33596
  * @param {!Rectangle} other Rectangle to check if fully contained.
33273
- * @return {boolean} True if this Rectangle fully contains other.
33597
+ * @returns {boolean} True if this Rectangle fully contains other.
33274
33598
  */
33275
33599
  }, {
33276
33600
  key: "contains",
@@ -33324,7 +33648,7 @@ var Rectangle = /*#__PURE__*/function () {
33324
33648
  get:
33325
33649
  /**
33326
33650
  * Width of the Rectangle.
33327
- * @return {number} Width of rectangle.
33651
+ * @returns {number} Width of rectangle.
33328
33652
  */
33329
33653
  function get() {
33330
33654
  return Math.abs(this.left - this.right);
@@ -33332,7 +33656,7 @@ var Rectangle = /*#__PURE__*/function () {
33332
33656
 
33333
33657
  /**
33334
33658
  * Height of the Rectangle.
33335
- * @return {number} Height of rectangle.
33659
+ * @returns {number} Height of rectangle.
33336
33660
  */
33337
33661
  }, {
33338
33662
  key: "height",
@@ -33390,13 +33714,13 @@ module.exports = Rectangle;
33390
33714
  module.exports = {
33391
33715
  /**
33392
33716
  * The ID value to use for "no item" or when an object has been disposed.
33393
- * @const {int}
33717
+ * @constant {int}
33394
33718
  */
33395
33719
  ID_NONE: -1,
33396
33720
  /**
33397
33721
  * Optimize for fewer than this number of Drawables sharing the same Skin.
33398
33722
  * Going above this may cause middleware warnings or a performance penalty but should otherwise behave correctly.
33399
- * @const {int}
33723
+ * @constant {int}
33400
33724
  */
33401
33725
  SKIN_SHARE_SOFT_LIMIT: 301,
33402
33726
  /**
@@ -33405,7 +33729,6 @@ module.exports = {
33405
33729
  Events: {
33406
33730
  /**
33407
33731
  * NativeSizeChanged event
33408
- *
33409
33732
  * @event RenderWebGL#event:NativeSizeChanged
33410
33733
  * @type {object}
33411
33734
  * @property {Array<int>} newSize - the new size of the renderer
@@ -33472,7 +33795,7 @@ var __cpuTouchingColorPixelCount = 4e4;
33472
33795
  /**
33473
33796
  * @callback RenderWebGL#idFilterFunc
33474
33797
  * @param {int} drawableID The ID to filter.
33475
- * @return {bool} True if the ID passes the filter, otherwise false.
33798
+ * @returns {bool} True if the ID passes the filter, otherwise false.
33476
33799
  */
33477
33800
 
33478
33801
  /**
@@ -33538,11 +33861,11 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
33538
33861
  * @see RenderWebGL#setStageSize
33539
33862
  * @see RenderWebGL#resize
33540
33863
  * @param {canvas} canvas The canvas to draw onto.
33541
- * @param {int} [xLeft=-240] The x-coordinate of the left edge.
33542
- * @param {int} [xRight=240] The x-coordinate of the right edge.
33543
- * @param {int} [yBottom=-180] The y-coordinate of the bottom edge.
33544
- * @param {int} [yTop=180] The y-coordinate of the top edge.
33545
- * @constructor
33864
+ * @param {int} [xLeft] The x-coordinate of the left edge.
33865
+ * @param {int} [xRight] The x-coordinate of the right edge.
33866
+ * @param {int} [yBottom] The y-coordinate of the bottom edge.
33867
+ * @param {int} [yTop] The y-coordinate of the top edge.
33868
+ * @class
33546
33869
  * @listens RenderWebGL#event:NativeSizeChanged
33547
33870
  */
33548
33871
  function RenderWebGL(canvas, xLeft, xRight, yBottom, yTop) {
@@ -33570,7 +33893,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
33570
33893
 
33571
33894
  // A list of layer group names in the order they should appear
33572
33895
  // from furthest back to furthest in front.
33573
- /** @type {Array<String>} */
33896
+ /** @type {Array<string>} */
33574
33897
  _this._groupOrdering = [];
33575
33898
 
33576
33899
  /**
@@ -33740,7 +34063,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
33740
34063
  }
33741
34064
 
33742
34065
  /**
33743
- * @return {Array<int>} the "native" size of the stage, which is used for pen, query renders, etc.
34066
+ * @returns {Array<int>} the "native" size of the stage, which is used for pen, query renders, etc.
33744
34067
  */
33745
34068
  }, {
33746
34069
  key: "getNativeSize",
@@ -33767,7 +34090,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
33767
34090
  /**
33768
34091
  * Create a new bitmap skin from a snapshot of the provided bitmap data.
33769
34092
  * @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} bitmapData - new contents for this skin.
33770
- * @param {!int} [costumeResolution=1] - The resolution to use for this bitmap.
34093
+ * @param {!int} [costumeResolution] - The resolution to use for this bitmap.
33771
34094
  * @param {?Array<number>} [rotationCenter] Optional: rotation center of the skin. If not supplied, the center of
33772
34095
  * the skin will be used.
33773
34096
  * @returns {!int} the ID for the new skin.
@@ -34038,7 +34361,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34038
34361
  * Returns the position of the given drawableID in the draw list. This is
34039
34362
  * the absolute position irrespective of layer group.
34040
34363
  * @param {number} drawableID The drawable ID to find.
34041
- * @return {number} The postion of the given drawable ID.
34364
+ * @returns {number} The postion of the given drawable ID.
34042
34365
  */
34043
34366
  }, {
34044
34367
  key: "getDrawableOrder",
@@ -34060,7 +34383,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34060
34383
  * of the layer group.
34061
34384
  * @param {boolean=} optIsRelative If set, `order` refers to a relative change.
34062
34385
  * @param {number=} optMin If set, order constrained to be at least `optMin`.
34063
- * @return {?number} New order if changed, or null.
34386
+ * @returns {?number} New order if changed, or null.
34064
34387
  */
34065
34388
  }, {
34066
34389
  key: "setDrawableOrder",
@@ -34130,7 +34453,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34130
34453
  /**
34131
34454
  * Get the precise bounds for a Drawable.
34132
34455
  * @param {int} drawableID ID of Drawable to get bounds for.
34133
- * @return {object} Bounds for a tight box around the Drawable.
34456
+ * @returns {object} Bounds for a tight box around the Drawable.
34134
34457
  */
34135
34458
  }, {
34136
34459
  key: "getBounds",
@@ -34160,7 +34483,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34160
34483
  * Get the precise bounds for a Drawable around the top slice.
34161
34484
  * Used for positioning speech bubbles more closely to the sprite.
34162
34485
  * @param {int} drawableID ID of Drawable to get bubble bounds for.
34163
- * @return {object} Bounds for a tight box around the Drawable top slice.
34486
+ * @returns {object} Bounds for a tight box around the Drawable top slice.
34164
34487
  */
34165
34488
  }, {
34166
34489
  key: "getBoundsForBubble",
@@ -34189,7 +34512,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34189
34512
  /**
34190
34513
  * Get the current skin (costume) size of a Drawable.
34191
34514
  * @param {int} drawableID The ID of the Drawable to measure.
34192
- * @return {Array<number>} Skin size, width and height.
34515
+ * @returns {Array<number>} Skin size, width and height.
34193
34516
  */
34194
34517
  }, {
34195
34518
  key: "getCurrentSkinSize",
@@ -34201,7 +34524,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34201
34524
  /**
34202
34525
  * Get the size of a skin by ID.
34203
34526
  * @param {int} skinID The ID of the Skin to measure.
34204
- * @return {Array<number>} Skin size, width and height.
34527
+ * @returns {Array<number>} Skin size, width and height.
34205
34528
  */
34206
34529
  }, {
34207
34530
  key: "getSkinSize",
@@ -34213,7 +34536,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34213
34536
  /**
34214
34537
  * Get the rotation center of a skin by ID.
34215
34538
  * @param {int} skinID The ID of the Skin
34216
- * @return {Array<number>} The rotationCenterX and rotationCenterY
34539
+ * @returns {Array<number>} The rotationCenterX and rotationCenterY
34217
34540
  */
34218
34541
  }, {
34219
34542
  key: "getSkinRotationCenter",
@@ -34457,7 +34780,6 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34457
34780
  * Convert a client based x/y position on the canvas to a Scratch 3 world space
34458
34781
  * Rectangle. This creates recangles with a radius to cover selecting multiple
34459
34782
  * scratch pixels with touch / small render areas.
34460
- *
34461
34783
  * @param {int} centerX The client x coordinate of the picking location.
34462
34784
  * @param {int} centerY The client y coordinate of the picking location.
34463
34785
  * @param {int} [width] The client width of the touch event (optional).
@@ -34491,7 +34813,6 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34491
34813
  /**
34492
34814
  * Determine if the drawable is touching a client based x/y. Helper method for sensing
34493
34815
  * touching mouse-pointer. Ignores visibility.
34494
- *
34495
34816
  * @param {int} drawableID The ID of the drawable to check.
34496
34817
  * @param {int} centerX The client x coordinate of the picking location.
34497
34818
  * @param {int} centerY The client y coordinate of the picking location.
@@ -34521,7 +34842,6 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34521
34842
 
34522
34843
  /**
34523
34844
  * Determine if the drawable is touching a rectangle.
34524
- *
34525
34845
  * @param {int} drawableID The ID of the drawable to check.
34526
34846
  * @param {int} left - The left X coordinate of the rectangle.
34527
34847
  * @param {int} top - The top Y coordinate of the rectangle.
@@ -34552,7 +34872,6 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34552
34872
 
34553
34873
  /**
34554
34874
  * Determine if the drawable is touching a point in the Scratch coordinate system
34555
- *
34556
34875
  * @param {int} drawableID The ID of the drawable to check.
34557
34876
  * @param {int} x The x coordinate of the point.
34558
34877
  * @param {int} y The y coordinate of the point.
@@ -34574,7 +34893,6 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34574
34893
  * This function will pick all drawables that are visible, unless specific
34575
34894
  * candidate drawable IDs are provided. Used for determining what is clicked
34576
34895
  * or dragged. Will not select hidden / ghosted sprites.
34577
- *
34578
34896
  * @param {int} centerX The client x coordinate of the picking location.
34579
34897
  * @param {int} centerY The client y coordinate of the picking location.
34580
34898
  * @param {int} [touchWidth] The client width of the touch event (optional).
@@ -34649,7 +34967,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34649
34967
  /**
34650
34968
  * Return a drawable's pixel data and bounds in screen space.
34651
34969
  * @param {int} drawableID The ID of the drawable to get pixel data for
34652
- * @return {DrawableExtraction} Data about the picked drawable
34970
+ * @returns {DrawableExtraction} Data about the picked drawable
34653
34971
  */
34654
34972
  }, {
34655
34973
  key: "extractDrawableScreenSpace",
@@ -34741,7 +35059,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34741
35059
  * @param {int} x The client x coordinate of the picking location.
34742
35060
  * @param {int} y The client y coordinate of the picking location.
34743
35061
  * @param {int} radius The client radius to extract pixels with.
34744
- * @return {?ColorExtraction} Data about the picked color
35062
+ * @returns {?ColorExtraction} Data about the picked color
34745
35063
  */
34746
35064
  }, {
34747
35065
  key: "extractColor",
@@ -34793,7 +35111,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34793
35111
  /**
34794
35112
  * Get the candidate bounding box for a touching query.
34795
35113
  * @param {int} drawableID ID for drawable of query.
34796
- * @return {?Rectangle} Rectangle bounds for touching query, or null.
35114
+ * @returns {?Rectangle} Rectangle bounds for touching query, or null.
34797
35115
  */
34798
35116
  }, {
34799
35117
  key: "_touchingBounds",
@@ -34822,7 +35140,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34822
35140
  * could possibly intersect the given bounds.
34823
35141
  * @param {int} drawableID - ID for drawable of query.
34824
35142
  * @param {Array<int>} candidateIDs - Candidates for touching query.
34825
- * @return {?Array< {id, drawable, intersection} >} Filtered candidates with useful data.
35143
+ * @returns {?Array< {id, drawable, intersection} >} Filtered candidates with useful data.
34826
35144
  */
34827
35145
  }, {
34828
35146
  key: "_candidatesTouching",
@@ -34866,7 +35184,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34866
35184
  * Helper to get the union bounds from a set of candidates returned from the above method
34867
35185
  * @private
34868
35186
  * @param {Array<object>} candidates info from _candidatesTouching
34869
- * @return {Rectangle} the outer bounding box union
35187
+ * @returns {Rectangle} the outer bounding box union
34870
35188
  */
34871
35189
  }, {
34872
35190
  key: "_candidatesBounds",
@@ -35009,7 +35327,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
35009
35327
  * Update the position object's x & y members to keep the drawable fenced in view.
35010
35328
  * @param {int} drawableID - The ID of the Drawable to update.
35011
35329
  * @param {Array.<number, number>} position to be fenced - An array of type [x, y]
35012
- * @return {Array.<number, number>} The fenced position as an array [x, y]
35330
+ * @returns {Array.<number, number>} The fenced position as an array [x, y]
35013
35331
  */
35014
35332
  }, {
35015
35333
  key: "getFencedPositionOfDrawable",
@@ -35180,7 +35498,6 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
35180
35498
  * region. Since one region may be entered from within another a exit
35181
35499
  * handle can also be registered that is called when a new region is about
35182
35500
  * to be entered to restore a common inbetween state.
35183
- *
35184
35501
  * @param {any} regionId - id of the region to enter
35185
35502
  * @param {function} enter - handle to call when first entering a region
35186
35503
  * @param {function} exit - handle to call when leaving a region
@@ -35291,7 +35608,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
35291
35608
  * Get the convex hull points for a particular Drawable.
35292
35609
  * To do this, calculate it based on the drawable's Silhouette.
35293
35610
  * @param {int} drawableID The Drawable IDs calculate convex hull for.
35294
- * @return {Array<Array<number>>} points Convex hull points, as [[x, y], ...]
35611
+ * @returns {Array<Array<number>>} points Convex hull points, as [[x, y], ...]
35295
35612
  */
35296
35613
  }, {
35297
35614
  key: "_getConvexHullPointsForDrawable",
@@ -35311,11 +35628,10 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
35311
35628
  *
35312
35629
  * The determinant is useful in this case to know if AC is counter-clockwise from AB.
35313
35630
  * A positive value means that AC is counter-clockwise from AB. A negative value means AC is clockwise from AB.
35314
- *
35315
35631
  * @param {Float32Array} A A 2d vector in space.
35316
35632
  * @param {Float32Array} B A 2d vector in space.
35317
35633
  * @param {Float32Array} C A 2d vector in space.
35318
- * @return {number} Greater than 0 if counter clockwise, less than if clockwise, 0 if all points are on a line.
35634
+ * @returns {number} Greater than 0 if counter clockwise, less than if clockwise, 0 if all points are on a line.
35319
35635
  */
35320
35636
  var determinant = function determinant(A, B, C) {
35321
35637
  // AB = B - A
@@ -35427,7 +35743,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
35427
35743
  * @param {Array<Drawables>} drawables A list of drawables with the "top most"
35428
35744
  * drawable at index 0
35429
35745
  * @param {Uint8ClampedArray} dst The color3b space to store the answer in.
35430
- * @return {Uint8ClampedArray} The dst vector with everything blended down.
35746
+ * @returns {Uint8ClampedArray} The dst vector with everything blended down.
35431
35747
  */
35432
35748
  }, {
35433
35749
  key: "requestSnapshot",
@@ -35457,6 +35773,7 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
35457
35773
  // Create the context the same way that the constructor will: attributes may make the difference.
35458
35774
  return !!RenderWebGL._getContext(optCanvas || document.createElement('canvas'));
35459
35775
  } catch (e) {
35776
+ // eslint-disable-line no-unused-vars
35460
35777
  return false;
35461
35778
  }
35462
35779
  }
@@ -35573,7 +35890,7 @@ var MAX_TEXTURE_DIMENSION = 2048;
35573
35890
  * All scaled renderings of the SVG are stored in an array. The 1.0 scale of
35574
35891
  * the SVG is stored at the 8th index. The smallest possible 1 / 256 scale
35575
35892
  * rendering is stored at the 0th index.
35576
- * @const {number}
35893
+ * @constant {number}
35577
35894
  */
35578
35895
  var INDEX_OFFSET = 8;
35579
35896
  var SVGSkin = /*#__PURE__*/function (_Skin) {
@@ -35581,8 +35898,8 @@ var SVGSkin = /*#__PURE__*/function (_Skin) {
35581
35898
  * Create a new SVG skin.
35582
35899
  * @param {!int} id - The ID for this Skin.
35583
35900
  * @param {!RenderWebGL} renderer - The renderer which will use this skin.
35584
- * @constructor
35585
- * @extends Skin
35901
+ * @class
35902
+ * @augments Skin
35586
35903
  */
35587
35904
  function SVGSkin(id, renderer) {
35588
35905
  var _this;
@@ -35614,9 +35931,9 @@ var SVGSkin = /*#__PURE__*/function (_Skin) {
35614
35931
  _this._largestMIPScale = 0;
35615
35932
 
35616
35933
  /**
35617
- * Ratio of the size of the SVG and the max size of the WebGL texture
35618
- * @type {Number}
35619
- */
35934
+ * Ratio of the size of the SVG and the max size of the WebGL texture
35935
+ * @type {number}
35936
+ */
35620
35937
  _this._maxTextureScale = 1;
35621
35938
  return _this;
35622
35939
  }
@@ -35633,7 +35950,7 @@ var SVGSkin = /*#__PURE__*/function (_Skin) {
35633
35950
  }
35634
35951
 
35635
35952
  /**
35636
- * @return {Array<number>} the natural size, in Scratch units, of this skin.
35953
+ * @returns {Array<number>} the natural size, in Scratch units, of this skin.
35637
35954
  */
35638
35955
  }, {
35639
35956
  key: "size",
@@ -35668,7 +35985,7 @@ var SVGSkin = /*#__PURE__*/function (_Skin) {
35668
35985
  /**
35669
35986
  * Create a MIP for a given scale.
35670
35987
  * @param {number} scale - The relative size of the MIP
35671
- * @return {SVGMIP} An object that handles creating and updating SVG textures.
35988
+ * @returns {SVGMIP} An object that handles creating and updating SVG textures.
35672
35989
  */
35673
35990
  }, {
35674
35991
  key: "createMIP",
@@ -35717,7 +36034,7 @@ var SVGSkin = /*#__PURE__*/function (_Skin) {
35717
36034
 
35718
36035
  /**
35719
36036
  * @param {Array<number>} scale - The scaling factors to be used, each in the [0,100] range.
35720
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
36037
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
35721
36038
  */
35722
36039
  }, {
35723
36040
  key: "getTexture",
@@ -35824,7 +36141,7 @@ var twgl = __webpack_require__(/*! twgl.js */ "../../node_modules/twgl.js/dist/4
35824
36141
  var ShaderManager = /*#__PURE__*/function () {
35825
36142
  /**
35826
36143
  * @param {WebGLRenderingContext} gl WebGL rendering context to create shaders for
35827
- * @constructor
36144
+ * @class
35828
36145
  */
35829
36146
  function ShaderManager(gl) {
35830
36147
  _classCallCheck(this, ShaderManager);
@@ -35883,23 +36200,19 @@ var ShaderManager = /*#__PURE__*/function () {
35883
36200
  }
35884
36201
  }
35885
36202
  var definesText = "".concat(defines.join('\n'), "\n");
35886
-
35887
- /* eslint-disable global-require */
35888
36203
  var vsFullText = definesText + __webpack_require__(/*! raw-loader!./shaders/sprite.vert */ "./node_modules/raw-loader/index.js!./src/shaders/sprite.vert");
35889
36204
  var fsFullText = definesText + __webpack_require__(/*! raw-loader!./shaders/sprite.frag */ "./node_modules/raw-loader/index.js!./src/shaders/sprite.frag");
35890
- /* eslint-enable global-require */
35891
-
35892
36205
  return twgl.createProgramInfo(this._gl, [vsFullText, fsFullText]);
35893
36206
  }
35894
36207
  }]);
35895
36208
  }();
35896
36209
  /**
35897
36210
  * @typedef {object} ShaderManager.Effect
35898
- * @prop {int} mask - The bit in 'effectBits' representing the effect.
35899
- * @prop {function} converter - A conversion function which takes a Scratch value (generally in the range
36211
+ * @property {int} mask - The bit in 'effectBits' representing the effect.
36212
+ * @property {function} converter - A conversion function which takes a Scratch value (generally in the range
35900
36213
  * 0..100 or -100..100) and maps it to a value useful to the shader. This
35901
36214
  * mapping may not be reversible.
35902
- * @prop {boolean} shapeChanges - Whether the effect could change the drawn shape.
36215
+ * @property {boolean} shapeChanges - Whether the effect could change the drawn shape.
35903
36216
  */
35904
36217
  /**
35905
36218
  * Mapping of each effect name to info about that effect.
@@ -36027,7 +36340,7 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
36027
36340
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
36028
36341
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36029
36342
  /**
36030
- * @fileoverview
36343
+ * @file
36031
36344
  * A representation of a Skin's silhouette that can test if a point on the skin
36032
36345
  * renders a pixel where it is drawn.
36033
36346
  */
@@ -36054,7 +36367,7 @@ var intMax = function intMax(i, j) {
36054
36367
  * @param {Silhouette} silhouette - has data width and height
36055
36368
  * @param {number} x - x
36056
36369
  * @param {number} y - y
36057
- * @return {number} Alpha value for x/y position
36370
+ * @returns {number} Alpha value for x/y position
36058
36371
  */
36059
36372
  var getPoint = function getPoint(_ref, x, y) {
36060
36373
  var width = _ref._width,
@@ -36079,7 +36392,7 @@ var __cornerWork = [new Uint8ClampedArray(4), new Uint8ClampedArray(4), new Uint
36079
36392
  * @param {number} x X position of texture [0, width).
36080
36393
  * @param {number} y Y position of texture [0, height).
36081
36394
  * @param {Uint8ClampedArray} dst A color 4b space.
36082
- * @return {Uint8ClampedArray} The dst vector.
36395
+ * @returns {Uint8ClampedArray} The dst vector.
36083
36396
  */
36084
36397
  var getColor4b = function getColor4b(_ref2, x, y, dst) {
36085
36398
  var width = _ref2._width,
@@ -36111,7 +36424,7 @@ var getColor4b = function getColor4b(_ref2, x, y, dst) {
36111
36424
  * @param {number} x X position of texture [0, width).
36112
36425
  * @param {number} y Y position of texture [0, height).
36113
36426
  * @param {Uint8ClampedArray} dst A color 4b space.
36114
- * @return {Uint8ClampedArray} The dst vector.
36427
+ * @returns {Uint8ClampedArray} The dst vector.
36115
36428
  */
36116
36429
  var getPremultipliedColor4b = function getPremultipliedColor4b(_ref3, x, y, dst) {
36117
36430
  var width = _ref3._width,
@@ -36244,7 +36557,7 @@ var Silhouette = /*#__PURE__*/function () {
36244
36557
  /**
36245
36558
  * Test if texture coordinate touches the silhouette using nearest neighbor.
36246
36559
  * @param {twgl.v3} vec A texture coordinate.
36247
- * @return {boolean} If the nearest pixel has an alpha value.
36560
+ * @returns {boolean} If the nearest pixel has an alpha value.
36248
36561
  */
36249
36562
  }, {
36250
36563
  key: "isTouchingNearest",
@@ -36257,7 +36570,7 @@ var Silhouette = /*#__PURE__*/function () {
36257
36570
  * Test to see if any of the 4 pixels used in the linear interpolate touch
36258
36571
  * the silhouette.
36259
36572
  * @param {twgl.v3} vec A texture coordinate.
36260
- * @return {boolean} Any of the pixels have some alpha.
36573
+ * @returns {boolean} Any of the pixels have some alpha.
36261
36574
  */
36262
36575
  }, {
36263
36576
  key: "isTouchingLinear",
@@ -36271,7 +36584,7 @@ var Silhouette = /*#__PURE__*/function () {
36271
36584
  /**
36272
36585
  * Get the canvas element reused by Silhouettes to update their data with.
36273
36586
  * @private
36274
- * @return {CanvasElement} A canvas to draw bitmap data to.
36587
+ * @returns {CanvasElement} A canvas to draw bitmap data to.
36275
36588
  */
36276
36589
  }], [{
36277
36590
  key: "_updateCanvas",
@@ -36314,7 +36627,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36314
36627
  /**
36315
36628
  * Create a Skin, which stores and/or generates textures for use in rendering.
36316
36629
  * @param {int} id - The unique ID for this Skin.
36317
- * @constructor
36630
+ * @class
36318
36631
  */
36319
36632
  function Skin(id) {
36320
36633
  var _this;
@@ -36369,7 +36682,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36369
36682
  }
36370
36683
 
36371
36684
  /**
36372
- * @return {int} the unique ID for this Skin.
36685
+ * @returns {int} the unique ID for this Skin.
36373
36686
  */
36374
36687
  }, {
36375
36688
  key: "id",
@@ -36388,7 +36701,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36388
36701
 
36389
36702
  /**
36390
36703
  * @abstract
36391
- * @return {Array<number>} the "native" size, in texels, of this skin.
36704
+ * @returns {Array<number>} the "native" size, in texels, of this skin.
36392
36705
  */
36393
36706
  }, {
36394
36707
  key: "size",
@@ -36398,10 +36711,10 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36398
36711
 
36399
36712
  /**
36400
36713
  * Should this skin's texture be filtered with nearest-neighbor or linear interpolation at the given scale?
36401
- * @param {?Array<Number>} scale The screen-space X and Y scaling factors at which this skin's texture will be
36714
+ * @param {?Array<number>} scale The screen-space X and Y scaling factors at which this skin's texture will be
36402
36715
  * displayed, as percentages (100 means 1 "native size" unit is 1 screen pixel; 200 means 2 screen pixels, etc).
36403
36716
  * @param {Drawable} drawable The drawable that this skin's texture will be applied to.
36404
- * @return {boolean} True if this skin's texture, as returned by {@link getTexture}, should be filtered with
36717
+ * @returns {boolean} True if this skin's texture, as returned by {@link getTexture}, should be filtered with
36405
36718
  * nearest-neighbor interpolation.
36406
36719
  */
36407
36720
  // eslint-disable-next-line no-unused-vars
@@ -36413,7 +36726,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36413
36726
 
36414
36727
  /**
36415
36728
  * Get the center of the current bounding box
36416
- * @return {Array<number>} the center of the current bounding box
36729
+ * @returns {Array<number>} the center of the current bounding box
36417
36730
  */
36418
36731
  }, {
36419
36732
  key: "calculateRotationCenter",
@@ -36424,7 +36737,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36424
36737
  /**
36425
36738
  * @abstract
36426
36739
  * @param {Array<number>} scale - The scaling factors to be used.
36427
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
36740
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
36428
36741
  */
36429
36742
  // eslint-disable-next-line no-unused-vars
36430
36743
  }, {
@@ -36437,7 +36750,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36437
36750
  * Get the bounds of the drawable for determining its fenced position.
36438
36751
  * @param {Array<number>} drawable - The Drawable instance this skin is using.
36439
36752
  * @param {?Rectangle} result - Optional destination for bounds calculation.
36440
- * @return {!Rectangle} The drawable's bounds. For compatibility with Scratch 2, we always use getAABB.
36753
+ * @returns {!Rectangle} The drawable's bounds. For compatibility with Scratch 2, we always use getAABB.
36441
36754
  */
36442
36755
  }, {
36443
36756
  key: "getFenceBounds",
@@ -36524,7 +36837,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36524
36837
  * @see updateSilhouette
36525
36838
  * @see Drawable.updateCPURenderAttributes
36526
36839
  * @param {twgl.v3} vec A texture coordinate.
36527
- * @return {boolean} Did it touch?
36840
+ * @returns {boolean} Did it touch?
36528
36841
  */
36529
36842
  }, {
36530
36843
  key: "isTouchingNearest",
@@ -36539,7 +36852,7 @@ var Skin = /*#__PURE__*/function (_EventEmitter) {
36539
36852
  * @see updateSilhouette
36540
36853
  * @see Drawable.updateCPURenderAttributes
36541
36854
  * @param {twgl.v3} vec A texture coordinate.
36542
- * @return {boolean} Did it touch?
36855
+ * @returns {boolean} Did it touch?
36543
36856
  */
36544
36857
  }, {
36545
36858
  key: "isTouchingLinear",
@@ -36627,8 +36940,8 @@ var TextBubbleSkin = /*#__PURE__*/function (_Skin) {
36627
36940
  * Create a new text bubble skin.
36628
36941
  * @param {!int} id - The ID for this Skin.
36629
36942
  * @param {!RenderWebGL} renderer - The renderer which will use this skin.
36630
- * @constructor
36631
- * @extends Skin
36943
+ * @class
36944
+ * @augments Skin
36632
36945
  */
36633
36946
  function TextBubbleSkin(id, renderer) {
36634
36947
  var _this;
@@ -36689,7 +37002,7 @@ var TextBubbleSkin = /*#__PURE__*/function (_Skin) {
36689
37002
  }
36690
37003
 
36691
37004
  /**
36692
- * @return {Array<number>} the dimensions, in Scratch units, of this skin.
37005
+ * @returns {Array<number>} the dimensions, in Scratch units, of this skin.
36693
37006
  */
36694
37007
  }, {
36695
37008
  key: "size",
@@ -36855,7 +37168,7 @@ var TextBubbleSkin = /*#__PURE__*/function (_Skin) {
36855
37168
 
36856
37169
  /**
36857
37170
  * @param {Array<number>} scale - The scaling factors to be used, each in the [0,100] range.
36858
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
37171
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
36859
37172
  */
36860
37173
  }, {
36861
37174
  key: "getTexture",
@@ -36979,13 +37292,12 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
36979
37292
  * adapted from http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv.
36980
37293
  * Assumes r, g, and b are in the range [0, 255] and
36981
37294
  * returns h, s, and v in the range [0, 1].
36982
- *
36983
37295
  * @param {Array<number>} rgb The RGB color value
36984
37296
  * @param {number} rgb.r The red color value
36985
37297
  * @param {number} rgb.g The green color value
36986
37298
  * @param {number} rgb.b The blue color value
36987
37299
  * @param {Array<number>} dst The array to store the HSV values in
36988
- * @return {Array<number>} The `dst` array passed in
37300
+ * @returns {Array<number>} The `dst` array passed in
36989
37301
  */
36990
37302
  var rgbToHsv = function rgbToHsv(_ref, dst) {
36991
37303
  var _ref2 = _slicedToArray(_ref, 3),
@@ -37024,13 +37336,12 @@ var rgbToHsv = function rgbToHsv(_ref, dst) {
37024
37336
  * adapted from https://gist.github.com/mjackson/5311256.
37025
37337
  * Assumes h, s, and v are contained in the set [0, 1] and
37026
37338
  * returns r, g, and b in the set [0, 255].
37027
- *
37028
37339
  * @param {Array<number>} hsv The HSV color value
37029
37340
  * @param {number} hsv.h The hue
37030
37341
  * @param {number} hsv.s The saturation
37031
37342
  * @param {number} hsv.v The value
37032
37343
  * @param {Uint8Array|Uint8ClampedArray} dst The array to store the RGB values in
37033
- * @return {Uint8Array|Uint8ClampedArray} The `dst` array passed in
37344
+ * @returns {Uint8Array|Uint8ClampedArray} The `dst` array passed in
37034
37345
  */
37035
37346
  var hsvToRgb = function hsvToRgb(_ref3, dst) {
37036
37347
  var _ref4 = _slicedToArray(_ref3, 3),