tiny-essentials 1.18.0 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2107 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
- /******/ var __webpack_modules__ = ({
3
-
4
- /***/ 251:
5
- /***/ ((__unused_webpack_module, exports) => {
6
-
7
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
8
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
9
- var e, m
10
- var eLen = (nBytes * 8) - mLen - 1
11
- var eMax = (1 << eLen) - 1
12
- var eBias = eMax >> 1
13
- var nBits = -7
14
- var i = isLE ? (nBytes - 1) : 0
15
- var d = isLE ? -1 : 1
16
- var s = buffer[offset + i]
17
-
18
- i += d
19
-
20
- e = s & ((1 << (-nBits)) - 1)
21
- s >>= (-nBits)
22
- nBits += eLen
23
- for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
24
-
25
- m = e & ((1 << (-nBits)) - 1)
26
- e >>= (-nBits)
27
- nBits += mLen
28
- for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
29
-
30
- if (e === 0) {
31
- e = 1 - eBias
32
- } else if (e === eMax) {
33
- return m ? NaN : ((s ? -1 : 1) * Infinity)
34
- } else {
35
- m = m + Math.pow(2, mLen)
36
- e = e - eBias
37
- }
38
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
39
- }
40
-
41
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
42
- var e, m, c
43
- var eLen = (nBytes * 8) - mLen - 1
44
- var eMax = (1 << eLen) - 1
45
- var eBias = eMax >> 1
46
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
47
- var i = isLE ? 0 : (nBytes - 1)
48
- var d = isLE ? 1 : -1
49
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
50
-
51
- value = Math.abs(value)
52
-
53
- if (isNaN(value) || value === Infinity) {
54
- m = isNaN(value) ? 1 : 0
55
- e = eMax
56
- } else {
57
- e = Math.floor(Math.log(value) / Math.LN2)
58
- if (value * (c = Math.pow(2, -e)) < 1) {
59
- e--
60
- c *= 2
61
- }
62
- if (e + eBias >= 1) {
63
- value += rt / c
64
- } else {
65
- value += rt * Math.pow(2, 1 - eBias)
66
- }
67
- if (value * c >= 2) {
68
- e++
69
- c /= 2
70
- }
71
-
72
- if (e + eBias >= eMax) {
73
- m = 0
74
- e = eMax
75
- } else if (e + eBias >= 1) {
76
- m = ((value * c) - 1) * Math.pow(2, mLen)
77
- e = e + eBias
78
- } else {
79
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
80
- e = 0
81
- }
82
- }
83
-
84
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
85
-
86
- e = (e << mLen) | m
87
- eLen += mLen
88
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
89
-
90
- buffer[offset + i - d] |= s * 128
91
- }
92
-
93
-
94
- /***/ }),
95
-
96
- /***/ 287:
97
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
98
-
99
- "use strict";
100
- var __webpack_unused_export__;
101
- /*!
102
- * The buffer module from node.js, for the browser.
103
- *
104
- * @author Feross Aboukhadijeh <https://feross.org>
105
- * @license MIT
106
- */
107
- /* eslint-disable no-proto */
108
-
109
-
110
-
111
- var base64 = __webpack_require__(526)
112
- var ieee754 = __webpack_require__(251)
113
- var customInspectSymbol =
114
- (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
115
- ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
116
- : null
117
-
118
- exports.hp = Buffer
119
- __webpack_unused_export__ = SlowBuffer
120
- exports.IS = 50
121
-
122
- var K_MAX_LENGTH = 0x7fffffff
123
- __webpack_unused_export__ = K_MAX_LENGTH
124
-
125
- /**
126
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
127
- * === true Use Uint8Array implementation (fastest)
128
- * === false Print warning and recommend using `buffer` v4.x which has an Object
129
- * implementation (most compatible, even IE6)
130
- *
131
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
132
- * Opera 11.6+, iOS 4.2+.
133
- *
134
- * We report that the browser does not support typed arrays if the are not subclassable
135
- * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
136
- * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
137
- * for __proto__ and has a buggy typed array implementation.
138
- */
139
- Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
140
-
141
- if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
142
- typeof console.error === 'function') {
143
- console.error(
144
- 'This browser lacks typed array (Uint8Array) support which is required by ' +
145
- '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
146
- )
147
- }
148
-
149
- function typedArraySupport () {
150
- // Can typed array instances can be augmented?
151
- try {
152
- var arr = new Uint8Array(1)
153
- var proto = { foo: function () { return 42 } }
154
- Object.setPrototypeOf(proto, Uint8Array.prototype)
155
- Object.setPrototypeOf(arr, proto)
156
- return arr.foo() === 42
157
- } catch (e) {
158
- return false
159
- }
160
- }
161
-
162
- Object.defineProperty(Buffer.prototype, 'parent', {
163
- enumerable: true,
164
- get: function () {
165
- if (!Buffer.isBuffer(this)) return undefined
166
- return this.buffer
167
- }
168
- })
169
-
170
- Object.defineProperty(Buffer.prototype, 'offset', {
171
- enumerable: true,
172
- get: function () {
173
- if (!Buffer.isBuffer(this)) return undefined
174
- return this.byteOffset
175
- }
176
- })
177
-
178
- function createBuffer (length) {
179
- if (length > K_MAX_LENGTH) {
180
- throw new RangeError('The value "' + length + '" is invalid for option "size"')
181
- }
182
- // Return an augmented `Uint8Array` instance
183
- var buf = new Uint8Array(length)
184
- Object.setPrototypeOf(buf, Buffer.prototype)
185
- return buf
186
- }
187
-
188
- /**
189
- * The Buffer constructor returns instances of `Uint8Array` that have their
190
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
191
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
192
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
193
- * returns a single octet.
194
- *
195
- * The `Uint8Array` prototype remains unmodified.
196
- */
197
-
198
- function Buffer (arg, encodingOrOffset, length) {
199
- // Common case.
200
- if (typeof arg === 'number') {
201
- if (typeof encodingOrOffset === 'string') {
202
- throw new TypeError(
203
- 'The "string" argument must be of type string. Received type number'
204
- )
205
- }
206
- return allocUnsafe(arg)
207
- }
208
- return from(arg, encodingOrOffset, length)
209
- }
210
-
211
- Buffer.poolSize = 8192 // not used by this implementation
212
-
213
- function from (value, encodingOrOffset, length) {
214
- if (typeof value === 'string') {
215
- return fromString(value, encodingOrOffset)
216
- }
217
-
218
- if (ArrayBuffer.isView(value)) {
219
- return fromArrayView(value)
220
- }
221
-
222
- if (value == null) {
223
- throw new TypeError(
224
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
225
- 'or Array-like Object. Received type ' + (typeof value)
226
- )
227
- }
228
-
229
- if (isInstance(value, ArrayBuffer) ||
230
- (value && isInstance(value.buffer, ArrayBuffer))) {
231
- return fromArrayBuffer(value, encodingOrOffset, length)
232
- }
233
-
234
- if (typeof SharedArrayBuffer !== 'undefined' &&
235
- (isInstance(value, SharedArrayBuffer) ||
236
- (value && isInstance(value.buffer, SharedArrayBuffer)))) {
237
- return fromArrayBuffer(value, encodingOrOffset, length)
238
- }
239
-
240
- if (typeof value === 'number') {
241
- throw new TypeError(
242
- 'The "value" argument must not be of type number. Received type number'
243
- )
244
- }
245
-
246
- var valueOf = value.valueOf && value.valueOf()
247
- if (valueOf != null && valueOf !== value) {
248
- return Buffer.from(valueOf, encodingOrOffset, length)
249
- }
250
-
251
- var b = fromObject(value)
252
- if (b) return b
253
-
254
- if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
255
- typeof value[Symbol.toPrimitive] === 'function') {
256
- return Buffer.from(
257
- value[Symbol.toPrimitive]('string'), encodingOrOffset, length
258
- )
259
- }
260
-
261
- throw new TypeError(
262
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
263
- 'or Array-like Object. Received type ' + (typeof value)
264
- )
265
- }
266
-
267
- /**
268
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
269
- * if value is a number.
270
- * Buffer.from(str[, encoding])
271
- * Buffer.from(array)
272
- * Buffer.from(buffer)
273
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
274
- **/
275
- Buffer.from = function (value, encodingOrOffset, length) {
276
- return from(value, encodingOrOffset, length)
277
- }
278
-
279
- // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
280
- // https://github.com/feross/buffer/pull/148
281
- Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
282
- Object.setPrototypeOf(Buffer, Uint8Array)
283
-
284
- function assertSize (size) {
285
- if (typeof size !== 'number') {
286
- throw new TypeError('"size" argument must be of type number')
287
- } else if (size < 0) {
288
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
289
- }
290
- }
291
-
292
- function alloc (size, fill, encoding) {
293
- assertSize(size)
294
- if (size <= 0) {
295
- return createBuffer(size)
296
- }
297
- if (fill !== undefined) {
298
- // Only pay attention to encoding if it's a string. This
299
- // prevents accidentally sending in a number that would
300
- // be interpreted as a start offset.
301
- return typeof encoding === 'string'
302
- ? createBuffer(size).fill(fill, encoding)
303
- : createBuffer(size).fill(fill)
304
- }
305
- return createBuffer(size)
306
- }
307
-
308
- /**
309
- * Creates a new filled Buffer instance.
310
- * alloc(size[, fill[, encoding]])
311
- **/
312
- Buffer.alloc = function (size, fill, encoding) {
313
- return alloc(size, fill, encoding)
314
- }
315
-
316
- function allocUnsafe (size) {
317
- assertSize(size)
318
- return createBuffer(size < 0 ? 0 : checked(size) | 0)
319
- }
320
-
321
- /**
322
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
323
- * */
324
- Buffer.allocUnsafe = function (size) {
325
- return allocUnsafe(size)
326
- }
327
- /**
328
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
329
- */
330
- Buffer.allocUnsafeSlow = function (size) {
331
- return allocUnsafe(size)
332
- }
333
-
334
- function fromString (string, encoding) {
335
- if (typeof encoding !== 'string' || encoding === '') {
336
- encoding = 'utf8'
337
- }
338
-
339
- if (!Buffer.isEncoding(encoding)) {
340
- throw new TypeError('Unknown encoding: ' + encoding)
341
- }
342
-
343
- var length = byteLength(string, encoding) | 0
344
- var buf = createBuffer(length)
345
-
346
- var actual = buf.write(string, encoding)
347
-
348
- if (actual !== length) {
349
- // Writing a hex string, for example, that contains invalid characters will
350
- // cause everything after the first invalid character to be ignored. (e.g.
351
- // 'abxxcd' will be treated as 'ab')
352
- buf = buf.slice(0, actual)
353
- }
354
-
355
- return buf
356
- }
357
-
358
- function fromArrayLike (array) {
359
- var length = array.length < 0 ? 0 : checked(array.length) | 0
360
- var buf = createBuffer(length)
361
- for (var i = 0; i < length; i += 1) {
362
- buf[i] = array[i] & 255
363
- }
364
- return buf
365
- }
366
-
367
- function fromArrayView (arrayView) {
368
- if (isInstance(arrayView, Uint8Array)) {
369
- var copy = new Uint8Array(arrayView)
370
- return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
371
- }
372
- return fromArrayLike(arrayView)
373
- }
374
-
375
- function fromArrayBuffer (array, byteOffset, length) {
376
- if (byteOffset < 0 || array.byteLength < byteOffset) {
377
- throw new RangeError('"offset" is outside of buffer bounds')
378
- }
379
-
380
- if (array.byteLength < byteOffset + (length || 0)) {
381
- throw new RangeError('"length" is outside of buffer bounds')
382
- }
383
-
384
- var buf
385
- if (byteOffset === undefined && length === undefined) {
386
- buf = new Uint8Array(array)
387
- } else if (length === undefined) {
388
- buf = new Uint8Array(array, byteOffset)
389
- } else {
390
- buf = new Uint8Array(array, byteOffset, length)
391
- }
392
-
393
- // Return an augmented `Uint8Array` instance
394
- Object.setPrototypeOf(buf, Buffer.prototype)
395
-
396
- return buf
397
- }
398
-
399
- function fromObject (obj) {
400
- if (Buffer.isBuffer(obj)) {
401
- var len = checked(obj.length) | 0
402
- var buf = createBuffer(len)
403
-
404
- if (buf.length === 0) {
405
- return buf
406
- }
407
-
408
- obj.copy(buf, 0, 0, len)
409
- return buf
410
- }
411
-
412
- if (obj.length !== undefined) {
413
- if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
414
- return createBuffer(0)
415
- }
416
- return fromArrayLike(obj)
417
- }
418
-
419
- if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
420
- return fromArrayLike(obj.data)
421
- }
422
- }
423
-
424
- function checked (length) {
425
- // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
426
- // length is NaN (which is otherwise coerced to zero.)
427
- if (length >= K_MAX_LENGTH) {
428
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
429
- 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
430
- }
431
- return length | 0
432
- }
433
-
434
- function SlowBuffer (length) {
435
- if (+length != length) { // eslint-disable-line eqeqeq
436
- length = 0
437
- }
438
- return Buffer.alloc(+length)
439
- }
440
-
441
- Buffer.isBuffer = function isBuffer (b) {
442
- return b != null && b._isBuffer === true &&
443
- b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
444
- }
445
-
446
- Buffer.compare = function compare (a, b) {
447
- if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
448
- if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
449
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
450
- throw new TypeError(
451
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
452
- )
453
- }
454
-
455
- if (a === b) return 0
456
-
457
- var x = a.length
458
- var y = b.length
459
-
460
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
461
- if (a[i] !== b[i]) {
462
- x = a[i]
463
- y = b[i]
464
- break
465
- }
466
- }
467
-
468
- if (x < y) return -1
469
- if (y < x) return 1
470
- return 0
471
- }
472
-
473
- Buffer.isEncoding = function isEncoding (encoding) {
474
- switch (String(encoding).toLowerCase()) {
475
- case 'hex':
476
- case 'utf8':
477
- case 'utf-8':
478
- case 'ascii':
479
- case 'latin1':
480
- case 'binary':
481
- case 'base64':
482
- case 'ucs2':
483
- case 'ucs-2':
484
- case 'utf16le':
485
- case 'utf-16le':
486
- return true
487
- default:
488
- return false
489
- }
490
- }
491
-
492
- Buffer.concat = function concat (list, length) {
493
- if (!Array.isArray(list)) {
494
- throw new TypeError('"list" argument must be an Array of Buffers')
495
- }
496
-
497
- if (list.length === 0) {
498
- return Buffer.alloc(0)
499
- }
500
-
501
- var i
502
- if (length === undefined) {
503
- length = 0
504
- for (i = 0; i < list.length; ++i) {
505
- length += list[i].length
506
- }
507
- }
508
-
509
- var buffer = Buffer.allocUnsafe(length)
510
- var pos = 0
511
- for (i = 0; i < list.length; ++i) {
512
- var buf = list[i]
513
- if (isInstance(buf, Uint8Array)) {
514
- if (pos + buf.length > buffer.length) {
515
- Buffer.from(buf).copy(buffer, pos)
516
- } else {
517
- Uint8Array.prototype.set.call(
518
- buffer,
519
- buf,
520
- pos
521
- )
522
- }
523
- } else if (!Buffer.isBuffer(buf)) {
524
- throw new TypeError('"list" argument must be an Array of Buffers')
525
- } else {
526
- buf.copy(buffer, pos)
527
- }
528
- pos += buf.length
529
- }
530
- return buffer
531
- }
532
-
533
- function byteLength (string, encoding) {
534
- if (Buffer.isBuffer(string)) {
535
- return string.length
536
- }
537
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
538
- return string.byteLength
539
- }
540
- if (typeof string !== 'string') {
541
- throw new TypeError(
542
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
543
- 'Received type ' + typeof string
544
- )
545
- }
546
-
547
- var len = string.length
548
- var mustMatch = (arguments.length > 2 && arguments[2] === true)
549
- if (!mustMatch && len === 0) return 0
550
-
551
- // Use a for loop to avoid recursion
552
- var loweredCase = false
553
- for (;;) {
554
- switch (encoding) {
555
- case 'ascii':
556
- case 'latin1':
557
- case 'binary':
558
- return len
559
- case 'utf8':
560
- case 'utf-8':
561
- return utf8ToBytes(string).length
562
- case 'ucs2':
563
- case 'ucs-2':
564
- case 'utf16le':
565
- case 'utf-16le':
566
- return len * 2
567
- case 'hex':
568
- return len >>> 1
569
- case 'base64':
570
- return base64ToBytes(string).length
571
- default:
572
- if (loweredCase) {
573
- return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
574
- }
575
- encoding = ('' + encoding).toLowerCase()
576
- loweredCase = true
577
- }
578
- }
579
- }
580
- Buffer.byteLength = byteLength
581
-
582
- function slowToString (encoding, start, end) {
583
- var loweredCase = false
584
-
585
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
586
- // property of a typed array.
587
-
588
- // This behaves neither like String nor Uint8Array in that we set start/end
589
- // to their upper/lower bounds if the value passed is out of range.
590
- // undefined is handled specially as per ECMA-262 6th Edition,
591
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
592
- if (start === undefined || start < 0) {
593
- start = 0
594
- }
595
- // Return early if start > this.length. Done here to prevent potential uint32
596
- // coercion fail below.
597
- if (start > this.length) {
598
- return ''
599
- }
600
-
601
- if (end === undefined || end > this.length) {
602
- end = this.length
603
- }
604
-
605
- if (end <= 0) {
606
- return ''
607
- }
608
-
609
- // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
610
- end >>>= 0
611
- start >>>= 0
612
-
613
- if (end <= start) {
614
- return ''
615
- }
616
-
617
- if (!encoding) encoding = 'utf8'
618
-
619
- while (true) {
620
- switch (encoding) {
621
- case 'hex':
622
- return hexSlice(this, start, end)
623
-
624
- case 'utf8':
625
- case 'utf-8':
626
- return utf8Slice(this, start, end)
627
-
628
- case 'ascii':
629
- return asciiSlice(this, start, end)
630
-
631
- case 'latin1':
632
- case 'binary':
633
- return latin1Slice(this, start, end)
634
-
635
- case 'base64':
636
- return base64Slice(this, start, end)
637
-
638
- case 'ucs2':
639
- case 'ucs-2':
640
- case 'utf16le':
641
- case 'utf-16le':
642
- return utf16leSlice(this, start, end)
643
-
644
- default:
645
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
646
- encoding = (encoding + '').toLowerCase()
647
- loweredCase = true
648
- }
649
- }
650
- }
651
-
652
- // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
653
- // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
654
- // reliably in a browserify context because there could be multiple different
655
- // copies of the 'buffer' package in use. This method works even for Buffer
656
- // instances that were created from another copy of the `buffer` package.
657
- // See: https://github.com/feross/buffer/issues/154
658
- Buffer.prototype._isBuffer = true
659
-
660
- function swap (b, n, m) {
661
- var i = b[n]
662
- b[n] = b[m]
663
- b[m] = i
664
- }
665
-
666
- Buffer.prototype.swap16 = function swap16 () {
667
- var len = this.length
668
- if (len % 2 !== 0) {
669
- throw new RangeError('Buffer size must be a multiple of 16-bits')
670
- }
671
- for (var i = 0; i < len; i += 2) {
672
- swap(this, i, i + 1)
673
- }
674
- return this
675
- }
676
-
677
- Buffer.prototype.swap32 = function swap32 () {
678
- var len = this.length
679
- if (len % 4 !== 0) {
680
- throw new RangeError('Buffer size must be a multiple of 32-bits')
681
- }
682
- for (var i = 0; i < len; i += 4) {
683
- swap(this, i, i + 3)
684
- swap(this, i + 1, i + 2)
685
- }
686
- return this
687
- }
688
-
689
- Buffer.prototype.swap64 = function swap64 () {
690
- var len = this.length
691
- if (len % 8 !== 0) {
692
- throw new RangeError('Buffer size must be a multiple of 64-bits')
693
- }
694
- for (var i = 0; i < len; i += 8) {
695
- swap(this, i, i + 7)
696
- swap(this, i + 1, i + 6)
697
- swap(this, i + 2, i + 5)
698
- swap(this, i + 3, i + 4)
699
- }
700
- return this
701
- }
702
-
703
- Buffer.prototype.toString = function toString () {
704
- var length = this.length
705
- if (length === 0) return ''
706
- if (arguments.length === 0) return utf8Slice(this, 0, length)
707
- return slowToString.apply(this, arguments)
708
- }
709
-
710
- Buffer.prototype.toLocaleString = Buffer.prototype.toString
711
-
712
- Buffer.prototype.equals = function equals (b) {
713
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
714
- if (this === b) return true
715
- return Buffer.compare(this, b) === 0
716
- }
717
-
718
- Buffer.prototype.inspect = function inspect () {
719
- var str = ''
720
- var max = exports.IS
721
- str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
722
- if (this.length > max) str += ' ... '
723
- return '<Buffer ' + str + '>'
724
- }
725
- if (customInspectSymbol) {
726
- Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
727
- }
728
-
729
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
730
- if (isInstance(target, Uint8Array)) {
731
- target = Buffer.from(target, target.offset, target.byteLength)
732
- }
733
- if (!Buffer.isBuffer(target)) {
734
- throw new TypeError(
735
- 'The "target" argument must be one of type Buffer or Uint8Array. ' +
736
- 'Received type ' + (typeof target)
737
- )
738
- }
739
-
740
- if (start === undefined) {
741
- start = 0
742
- }
743
- if (end === undefined) {
744
- end = target ? target.length : 0
745
- }
746
- if (thisStart === undefined) {
747
- thisStart = 0
748
- }
749
- if (thisEnd === undefined) {
750
- thisEnd = this.length
751
- }
752
-
753
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
754
- throw new RangeError('out of range index')
755
- }
756
-
757
- if (thisStart >= thisEnd && start >= end) {
758
- return 0
759
- }
760
- if (thisStart >= thisEnd) {
761
- return -1
762
- }
763
- if (start >= end) {
764
- return 1
765
- }
766
-
767
- start >>>= 0
768
- end >>>= 0
769
- thisStart >>>= 0
770
- thisEnd >>>= 0
771
-
772
- if (this === target) return 0
773
-
774
- var x = thisEnd - thisStart
775
- var y = end - start
776
- var len = Math.min(x, y)
777
-
778
- var thisCopy = this.slice(thisStart, thisEnd)
779
- var targetCopy = target.slice(start, end)
780
-
781
- for (var i = 0; i < len; ++i) {
782
- if (thisCopy[i] !== targetCopy[i]) {
783
- x = thisCopy[i]
784
- y = targetCopy[i]
785
- break
786
- }
787
- }
788
-
789
- if (x < y) return -1
790
- if (y < x) return 1
791
- return 0
792
- }
793
-
794
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
795
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
796
- //
797
- // Arguments:
798
- // - buffer - a Buffer to search
799
- // - val - a string, Buffer, or number
800
- // - byteOffset - an index into `buffer`; will be clamped to an int32
801
- // - encoding - an optional encoding, relevant is val is a string
802
- // - dir - true for indexOf, false for lastIndexOf
803
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
804
- // Empty buffer means no match
805
- if (buffer.length === 0) return -1
806
-
807
- // Normalize byteOffset
808
- if (typeof byteOffset === 'string') {
809
- encoding = byteOffset
810
- byteOffset = 0
811
- } else if (byteOffset > 0x7fffffff) {
812
- byteOffset = 0x7fffffff
813
- } else if (byteOffset < -0x80000000) {
814
- byteOffset = -0x80000000
815
- }
816
- byteOffset = +byteOffset // Coerce to Number.
817
- if (numberIsNaN(byteOffset)) {
818
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
819
- byteOffset = dir ? 0 : (buffer.length - 1)
820
- }
821
-
822
- // Normalize byteOffset: negative offsets start from the end of the buffer
823
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset
824
- if (byteOffset >= buffer.length) {
825
- if (dir) return -1
826
- else byteOffset = buffer.length - 1
827
- } else if (byteOffset < 0) {
828
- if (dir) byteOffset = 0
829
- else return -1
830
- }
831
-
832
- // Normalize val
833
- if (typeof val === 'string') {
834
- val = Buffer.from(val, encoding)
835
- }
836
-
837
- // Finally, search either indexOf (if dir is true) or lastIndexOf
838
- if (Buffer.isBuffer(val)) {
839
- // Special case: looking for empty string/buffer always fails
840
- if (val.length === 0) {
841
- return -1
842
- }
843
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
844
- } else if (typeof val === 'number') {
845
- val = val & 0xFF // Search for a byte value [0-255]
846
- if (typeof Uint8Array.prototype.indexOf === 'function') {
847
- if (dir) {
848
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
849
- } else {
850
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
851
- }
852
- }
853
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
854
- }
855
-
856
- throw new TypeError('val must be string, number or Buffer')
857
- }
858
-
859
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
860
- var indexSize = 1
861
- var arrLength = arr.length
862
- var valLength = val.length
863
-
864
- if (encoding !== undefined) {
865
- encoding = String(encoding).toLowerCase()
866
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
867
- encoding === 'utf16le' || encoding === 'utf-16le') {
868
- if (arr.length < 2 || val.length < 2) {
869
- return -1
870
- }
871
- indexSize = 2
872
- arrLength /= 2
873
- valLength /= 2
874
- byteOffset /= 2
875
- }
876
- }
877
-
878
- function read (buf, i) {
879
- if (indexSize === 1) {
880
- return buf[i]
881
- } else {
882
- return buf.readUInt16BE(i * indexSize)
883
- }
884
- }
885
-
886
- var i
887
- if (dir) {
888
- var foundIndex = -1
889
- for (i = byteOffset; i < arrLength; i++) {
890
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
891
- if (foundIndex === -1) foundIndex = i
892
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
893
- } else {
894
- if (foundIndex !== -1) i -= i - foundIndex
895
- foundIndex = -1
896
- }
897
- }
898
- } else {
899
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
900
- for (i = byteOffset; i >= 0; i--) {
901
- var found = true
902
- for (var j = 0; j < valLength; j++) {
903
- if (read(arr, i + j) !== read(val, j)) {
904
- found = false
905
- break
906
- }
907
- }
908
- if (found) return i
909
- }
910
- }
911
-
912
- return -1
913
- }
914
-
915
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
916
- return this.indexOf(val, byteOffset, encoding) !== -1
917
- }
918
-
919
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
920
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
921
- }
922
-
923
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
924
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
925
- }
926
-
927
- function hexWrite (buf, string, offset, length) {
928
- offset = Number(offset) || 0
929
- var remaining = buf.length - offset
930
- if (!length) {
931
- length = remaining
932
- } else {
933
- length = Number(length)
934
- if (length > remaining) {
935
- length = remaining
936
- }
937
- }
938
-
939
- var strLen = string.length
940
-
941
- if (length > strLen / 2) {
942
- length = strLen / 2
943
- }
944
- for (var i = 0; i < length; ++i) {
945
- var parsed = parseInt(string.substr(i * 2, 2), 16)
946
- if (numberIsNaN(parsed)) return i
947
- buf[offset + i] = parsed
948
- }
949
- return i
950
- }
951
-
952
- function utf8Write (buf, string, offset, length) {
953
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
954
- }
955
-
956
- function asciiWrite (buf, string, offset, length) {
957
- return blitBuffer(asciiToBytes(string), buf, offset, length)
958
- }
959
-
960
- function base64Write (buf, string, offset, length) {
961
- return blitBuffer(base64ToBytes(string), buf, offset, length)
962
- }
963
-
964
- function ucs2Write (buf, string, offset, length) {
965
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
966
- }
967
-
968
- Buffer.prototype.write = function write (string, offset, length, encoding) {
969
- // Buffer#write(string)
970
- if (offset === undefined) {
971
- encoding = 'utf8'
972
- length = this.length
973
- offset = 0
974
- // Buffer#write(string, encoding)
975
- } else if (length === undefined && typeof offset === 'string') {
976
- encoding = offset
977
- length = this.length
978
- offset = 0
979
- // Buffer#write(string, offset[, length][, encoding])
980
- } else if (isFinite(offset)) {
981
- offset = offset >>> 0
982
- if (isFinite(length)) {
983
- length = length >>> 0
984
- if (encoding === undefined) encoding = 'utf8'
985
- } else {
986
- encoding = length
987
- length = undefined
988
- }
989
- } else {
990
- throw new Error(
991
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
992
- )
993
- }
994
-
995
- var remaining = this.length - offset
996
- if (length === undefined || length > remaining) length = remaining
997
-
998
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
999
- throw new RangeError('Attempt to write outside buffer bounds')
1000
- }
1001
-
1002
- if (!encoding) encoding = 'utf8'
1003
-
1004
- var loweredCase = false
1005
- for (;;) {
1006
- switch (encoding) {
1007
- case 'hex':
1008
- return hexWrite(this, string, offset, length)
1009
-
1010
- case 'utf8':
1011
- case 'utf-8':
1012
- return utf8Write(this, string, offset, length)
1013
-
1014
- case 'ascii':
1015
- case 'latin1':
1016
- case 'binary':
1017
- return asciiWrite(this, string, offset, length)
1018
-
1019
- case 'base64':
1020
- // Warning: maxLength not taken into account in base64Write
1021
- return base64Write(this, string, offset, length)
1022
-
1023
- case 'ucs2':
1024
- case 'ucs-2':
1025
- case 'utf16le':
1026
- case 'utf-16le':
1027
- return ucs2Write(this, string, offset, length)
1028
-
1029
- default:
1030
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1031
- encoding = ('' + encoding).toLowerCase()
1032
- loweredCase = true
1033
- }
1034
- }
1035
- }
1036
-
1037
- Buffer.prototype.toJSON = function toJSON () {
1038
- return {
1039
- type: 'Buffer',
1040
- data: Array.prototype.slice.call(this._arr || this, 0)
1041
- }
1042
- }
1043
-
1044
- function base64Slice (buf, start, end) {
1045
- if (start === 0 && end === buf.length) {
1046
- return base64.fromByteArray(buf)
1047
- } else {
1048
- return base64.fromByteArray(buf.slice(start, end))
1049
- }
1050
- }
1051
-
1052
- function utf8Slice (buf, start, end) {
1053
- end = Math.min(buf.length, end)
1054
- var res = []
1055
-
1056
- var i = start
1057
- while (i < end) {
1058
- var firstByte = buf[i]
1059
- var codePoint = null
1060
- var bytesPerSequence = (firstByte > 0xEF)
1061
- ? 4
1062
- : (firstByte > 0xDF)
1063
- ? 3
1064
- : (firstByte > 0xBF)
1065
- ? 2
1066
- : 1
1067
-
1068
- if (i + bytesPerSequence <= end) {
1069
- var secondByte, thirdByte, fourthByte, tempCodePoint
1070
-
1071
- switch (bytesPerSequence) {
1072
- case 1:
1073
- if (firstByte < 0x80) {
1074
- codePoint = firstByte
1075
- }
1076
- break
1077
- case 2:
1078
- secondByte = buf[i + 1]
1079
- if ((secondByte & 0xC0) === 0x80) {
1080
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
1081
- if (tempCodePoint > 0x7F) {
1082
- codePoint = tempCodePoint
1083
- }
1084
- }
1085
- break
1086
- case 3:
1087
- secondByte = buf[i + 1]
1088
- thirdByte = buf[i + 2]
1089
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1090
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
1091
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1092
- codePoint = tempCodePoint
1093
- }
1094
- }
1095
- break
1096
- case 4:
1097
- secondByte = buf[i + 1]
1098
- thirdByte = buf[i + 2]
1099
- fourthByte = buf[i + 3]
1100
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1101
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
1102
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1103
- codePoint = tempCodePoint
1104
- }
1105
- }
1106
- }
1107
- }
1108
-
1109
- if (codePoint === null) {
1110
- // we did not generate a valid codePoint so insert a
1111
- // replacement char (U+FFFD) and advance only 1 byte
1112
- codePoint = 0xFFFD
1113
- bytesPerSequence = 1
1114
- } else if (codePoint > 0xFFFF) {
1115
- // encode to utf16 (surrogate pair dance)
1116
- codePoint -= 0x10000
1117
- res.push(codePoint >>> 10 & 0x3FF | 0xD800)
1118
- codePoint = 0xDC00 | codePoint & 0x3FF
1119
- }
1120
-
1121
- res.push(codePoint)
1122
- i += bytesPerSequence
1123
- }
1124
-
1125
- return decodeCodePointsArray(res)
1126
- }
1127
-
1128
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1129
- // the lowest limit is Chrome, with 0x10000 args.
1130
- // We go 1 magnitude less, for safety
1131
- var MAX_ARGUMENTS_LENGTH = 0x1000
1132
-
1133
- function decodeCodePointsArray (codePoints) {
1134
- var len = codePoints.length
1135
- if (len <= MAX_ARGUMENTS_LENGTH) {
1136
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1137
- }
1138
-
1139
- // Decode in chunks to avoid "call stack size exceeded".
1140
- var res = ''
1141
- var i = 0
1142
- while (i < len) {
1143
- res += String.fromCharCode.apply(
1144
- String,
1145
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1146
- )
1147
- }
1148
- return res
1149
- }
1150
-
1151
- function asciiSlice (buf, start, end) {
1152
- var ret = ''
1153
- end = Math.min(buf.length, end)
1154
-
1155
- for (var i = start; i < end; ++i) {
1156
- ret += String.fromCharCode(buf[i] & 0x7F)
1157
- }
1158
- return ret
1159
- }
1160
-
1161
- function latin1Slice (buf, start, end) {
1162
- var ret = ''
1163
- end = Math.min(buf.length, end)
1164
-
1165
- for (var i = start; i < end; ++i) {
1166
- ret += String.fromCharCode(buf[i])
1167
- }
1168
- return ret
1169
- }
1170
-
1171
- function hexSlice (buf, start, end) {
1172
- var len = buf.length
1173
-
1174
- if (!start || start < 0) start = 0
1175
- if (!end || end < 0 || end > len) end = len
1176
-
1177
- var out = ''
1178
- for (var i = start; i < end; ++i) {
1179
- out += hexSliceLookupTable[buf[i]]
1180
- }
1181
- return out
1182
- }
1183
-
1184
- function utf16leSlice (buf, start, end) {
1185
- var bytes = buf.slice(start, end)
1186
- var res = ''
1187
- // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1188
- for (var i = 0; i < bytes.length - 1; i += 2) {
1189
- res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
1190
- }
1191
- return res
1192
- }
1193
-
1194
- Buffer.prototype.slice = function slice (start, end) {
1195
- var len = this.length
1196
- start = ~~start
1197
- end = end === undefined ? len : ~~end
1198
-
1199
- if (start < 0) {
1200
- start += len
1201
- if (start < 0) start = 0
1202
- } else if (start > len) {
1203
- start = len
1204
- }
1205
-
1206
- if (end < 0) {
1207
- end += len
1208
- if (end < 0) end = 0
1209
- } else if (end > len) {
1210
- end = len
1211
- }
1212
-
1213
- if (end < start) end = start
1214
-
1215
- var newBuf = this.subarray(start, end)
1216
- // Return an augmented `Uint8Array` instance
1217
- Object.setPrototypeOf(newBuf, Buffer.prototype)
1218
-
1219
- return newBuf
1220
- }
1221
-
1222
- /*
1223
- * Need to make sure that buffer isn't trying to write out of bounds.
1224
- */
1225
- function checkOffset (offset, ext, length) {
1226
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1227
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1228
- }
1229
-
1230
- Buffer.prototype.readUintLE =
1231
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1232
- offset = offset >>> 0
1233
- byteLength = byteLength >>> 0
1234
- if (!noAssert) checkOffset(offset, byteLength, this.length)
1235
-
1236
- var val = this[offset]
1237
- var mul = 1
1238
- var i = 0
1239
- while (++i < byteLength && (mul *= 0x100)) {
1240
- val += this[offset + i] * mul
1241
- }
1242
-
1243
- return val
1244
- }
1245
-
1246
- Buffer.prototype.readUintBE =
1247
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1248
- offset = offset >>> 0
1249
- byteLength = byteLength >>> 0
1250
- if (!noAssert) {
1251
- checkOffset(offset, byteLength, this.length)
1252
- }
1253
-
1254
- var val = this[offset + --byteLength]
1255
- var mul = 1
1256
- while (byteLength > 0 && (mul *= 0x100)) {
1257
- val += this[offset + --byteLength] * mul
1258
- }
1259
-
1260
- return val
1261
- }
1262
-
1263
- Buffer.prototype.readUint8 =
1264
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1265
- offset = offset >>> 0
1266
- if (!noAssert) checkOffset(offset, 1, this.length)
1267
- return this[offset]
1268
- }
1269
-
1270
- Buffer.prototype.readUint16LE =
1271
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1272
- offset = offset >>> 0
1273
- if (!noAssert) checkOffset(offset, 2, this.length)
1274
- return this[offset] | (this[offset + 1] << 8)
1275
- }
1276
-
1277
- Buffer.prototype.readUint16BE =
1278
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1279
- offset = offset >>> 0
1280
- if (!noAssert) checkOffset(offset, 2, this.length)
1281
- return (this[offset] << 8) | this[offset + 1]
1282
- }
1283
-
1284
- Buffer.prototype.readUint32LE =
1285
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1286
- offset = offset >>> 0
1287
- if (!noAssert) checkOffset(offset, 4, this.length)
1288
-
1289
- return ((this[offset]) |
1290
- (this[offset + 1] << 8) |
1291
- (this[offset + 2] << 16)) +
1292
- (this[offset + 3] * 0x1000000)
1293
- }
1294
-
1295
- Buffer.prototype.readUint32BE =
1296
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1297
- offset = offset >>> 0
1298
- if (!noAssert) checkOffset(offset, 4, this.length)
1299
-
1300
- return (this[offset] * 0x1000000) +
1301
- ((this[offset + 1] << 16) |
1302
- (this[offset + 2] << 8) |
1303
- this[offset + 3])
1304
- }
1305
-
1306
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1307
- offset = offset >>> 0
1308
- byteLength = byteLength >>> 0
1309
- if (!noAssert) checkOffset(offset, byteLength, this.length)
1310
-
1311
- var val = this[offset]
1312
- var mul = 1
1313
- var i = 0
1314
- while (++i < byteLength && (mul *= 0x100)) {
1315
- val += this[offset + i] * mul
1316
- }
1317
- mul *= 0x80
1318
-
1319
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1320
-
1321
- return val
1322
- }
1323
-
1324
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1325
- offset = offset >>> 0
1326
- byteLength = byteLength >>> 0
1327
- if (!noAssert) checkOffset(offset, byteLength, this.length)
1328
-
1329
- var i = byteLength
1330
- var mul = 1
1331
- var val = this[offset + --i]
1332
- while (i > 0 && (mul *= 0x100)) {
1333
- val += this[offset + --i] * mul
1334
- }
1335
- mul *= 0x80
1336
-
1337
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1338
-
1339
- return val
1340
- }
1341
-
1342
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1343
- offset = offset >>> 0
1344
- if (!noAssert) checkOffset(offset, 1, this.length)
1345
- if (!(this[offset] & 0x80)) return (this[offset])
1346
- return ((0xff - this[offset] + 1) * -1)
1347
- }
1348
-
1349
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1350
- offset = offset >>> 0
1351
- if (!noAssert) checkOffset(offset, 2, this.length)
1352
- var val = this[offset] | (this[offset + 1] << 8)
1353
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1354
- }
1355
-
1356
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1357
- offset = offset >>> 0
1358
- if (!noAssert) checkOffset(offset, 2, this.length)
1359
- var val = this[offset + 1] | (this[offset] << 8)
1360
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1361
- }
1362
-
1363
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1364
- offset = offset >>> 0
1365
- if (!noAssert) checkOffset(offset, 4, this.length)
1366
-
1367
- return (this[offset]) |
1368
- (this[offset + 1] << 8) |
1369
- (this[offset + 2] << 16) |
1370
- (this[offset + 3] << 24)
1371
- }
1372
-
1373
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1374
- offset = offset >>> 0
1375
- if (!noAssert) checkOffset(offset, 4, this.length)
1376
-
1377
- return (this[offset] << 24) |
1378
- (this[offset + 1] << 16) |
1379
- (this[offset + 2] << 8) |
1380
- (this[offset + 3])
1381
- }
1382
-
1383
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1384
- offset = offset >>> 0
1385
- if (!noAssert) checkOffset(offset, 4, this.length)
1386
- return ieee754.read(this, offset, true, 23, 4)
1387
- }
1388
-
1389
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1390
- offset = offset >>> 0
1391
- if (!noAssert) checkOffset(offset, 4, this.length)
1392
- return ieee754.read(this, offset, false, 23, 4)
1393
- }
1394
-
1395
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1396
- offset = offset >>> 0
1397
- if (!noAssert) checkOffset(offset, 8, this.length)
1398
- return ieee754.read(this, offset, true, 52, 8)
1399
- }
1400
-
1401
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1402
- offset = offset >>> 0
1403
- if (!noAssert) checkOffset(offset, 8, this.length)
1404
- return ieee754.read(this, offset, false, 52, 8)
1405
- }
1406
-
1407
- function checkInt (buf, value, offset, ext, max, min) {
1408
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1409
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1410
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1411
- }
1412
-
1413
- Buffer.prototype.writeUintLE =
1414
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1415
- value = +value
1416
- offset = offset >>> 0
1417
- byteLength = byteLength >>> 0
1418
- if (!noAssert) {
1419
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
1420
- checkInt(this, value, offset, byteLength, maxBytes, 0)
1421
- }
1422
-
1423
- var mul = 1
1424
- var i = 0
1425
- this[offset] = value & 0xFF
1426
- while (++i < byteLength && (mul *= 0x100)) {
1427
- this[offset + i] = (value / mul) & 0xFF
1428
- }
1429
-
1430
- return offset + byteLength
1431
- }
1432
-
1433
- Buffer.prototype.writeUintBE =
1434
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1435
- value = +value
1436
- offset = offset >>> 0
1437
- byteLength = byteLength >>> 0
1438
- if (!noAssert) {
1439
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
1440
- checkInt(this, value, offset, byteLength, maxBytes, 0)
1441
- }
1442
-
1443
- var i = byteLength - 1
1444
- var mul = 1
1445
- this[offset + i] = value & 0xFF
1446
- while (--i >= 0 && (mul *= 0x100)) {
1447
- this[offset + i] = (value / mul) & 0xFF
1448
- }
1449
-
1450
- return offset + byteLength
1451
- }
1452
-
1453
- Buffer.prototype.writeUint8 =
1454
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1455
- value = +value
1456
- offset = offset >>> 0
1457
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1458
- this[offset] = (value & 0xff)
1459
- return offset + 1
1460
- }
1461
-
1462
- Buffer.prototype.writeUint16LE =
1463
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1464
- value = +value
1465
- offset = offset >>> 0
1466
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1467
- this[offset] = (value & 0xff)
1468
- this[offset + 1] = (value >>> 8)
1469
- return offset + 2
1470
- }
1471
-
1472
- Buffer.prototype.writeUint16BE =
1473
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1474
- value = +value
1475
- offset = offset >>> 0
1476
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1477
- this[offset] = (value >>> 8)
1478
- this[offset + 1] = (value & 0xff)
1479
- return offset + 2
1480
- }
1481
-
1482
- Buffer.prototype.writeUint32LE =
1483
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1484
- value = +value
1485
- offset = offset >>> 0
1486
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1487
- this[offset + 3] = (value >>> 24)
1488
- this[offset + 2] = (value >>> 16)
1489
- this[offset + 1] = (value >>> 8)
1490
- this[offset] = (value & 0xff)
1491
- return offset + 4
1492
- }
1493
-
1494
- Buffer.prototype.writeUint32BE =
1495
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1496
- value = +value
1497
- offset = offset >>> 0
1498
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1499
- this[offset] = (value >>> 24)
1500
- this[offset + 1] = (value >>> 16)
1501
- this[offset + 2] = (value >>> 8)
1502
- this[offset + 3] = (value & 0xff)
1503
- return offset + 4
1504
- }
1505
-
1506
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1507
- value = +value
1508
- offset = offset >>> 0
1509
- if (!noAssert) {
1510
- var limit = Math.pow(2, (8 * byteLength) - 1)
1511
-
1512
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
1513
- }
1514
-
1515
- var i = 0
1516
- var mul = 1
1517
- var sub = 0
1518
- this[offset] = value & 0xFF
1519
- while (++i < byteLength && (mul *= 0x100)) {
1520
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1521
- sub = 1
1522
- }
1523
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1524
- }
1525
-
1526
- return offset + byteLength
1527
- }
1528
-
1529
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1530
- value = +value
1531
- offset = offset >>> 0
1532
- if (!noAssert) {
1533
- var limit = Math.pow(2, (8 * byteLength) - 1)
1534
-
1535
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
1536
- }
1537
-
1538
- var i = byteLength - 1
1539
- var mul = 1
1540
- var sub = 0
1541
- this[offset + i] = value & 0xFF
1542
- while (--i >= 0 && (mul *= 0x100)) {
1543
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1544
- sub = 1
1545
- }
1546
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1547
- }
1548
-
1549
- return offset + byteLength
1550
- }
1551
-
1552
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1553
- value = +value
1554
- offset = offset >>> 0
1555
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1556
- if (value < 0) value = 0xff + value + 1
1557
- this[offset] = (value & 0xff)
1558
- return offset + 1
1559
- }
1560
-
1561
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1562
- value = +value
1563
- offset = offset >>> 0
1564
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1565
- this[offset] = (value & 0xff)
1566
- this[offset + 1] = (value >>> 8)
1567
- return offset + 2
1568
- }
1569
-
1570
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1571
- value = +value
1572
- offset = offset >>> 0
1573
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1574
- this[offset] = (value >>> 8)
1575
- this[offset + 1] = (value & 0xff)
1576
- return offset + 2
1577
- }
1578
-
1579
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1580
- value = +value
1581
- offset = offset >>> 0
1582
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1583
- this[offset] = (value & 0xff)
1584
- this[offset + 1] = (value >>> 8)
1585
- this[offset + 2] = (value >>> 16)
1586
- this[offset + 3] = (value >>> 24)
1587
- return offset + 4
1588
- }
1589
-
1590
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1591
- value = +value
1592
- offset = offset >>> 0
1593
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1594
- if (value < 0) value = 0xffffffff + value + 1
1595
- this[offset] = (value >>> 24)
1596
- this[offset + 1] = (value >>> 16)
1597
- this[offset + 2] = (value >>> 8)
1598
- this[offset + 3] = (value & 0xff)
1599
- return offset + 4
1600
- }
1601
-
1602
- function checkIEEE754 (buf, value, offset, ext, max, min) {
1603
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1604
- if (offset < 0) throw new RangeError('Index out of range')
1605
- }
1606
-
1607
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
1608
- value = +value
1609
- offset = offset >>> 0
1610
- if (!noAssert) {
1611
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1612
- }
1613
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
1614
- return offset + 4
1615
- }
1616
-
1617
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1618
- return writeFloat(this, value, offset, true, noAssert)
1619
- }
1620
-
1621
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1622
- return writeFloat(this, value, offset, false, noAssert)
1623
- }
1624
-
1625
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
1626
- value = +value
1627
- offset = offset >>> 0
1628
- if (!noAssert) {
1629
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1630
- }
1631
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
1632
- return offset + 8
1633
- }
1634
-
1635
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1636
- return writeDouble(this, value, offset, true, noAssert)
1637
- }
1638
-
1639
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1640
- return writeDouble(this, value, offset, false, noAssert)
1641
- }
1642
-
1643
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1644
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1645
- if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
1646
- if (!start) start = 0
1647
- if (!end && end !== 0) end = this.length
1648
- if (targetStart >= target.length) targetStart = target.length
1649
- if (!targetStart) targetStart = 0
1650
- if (end > 0 && end < start) end = start
1651
-
1652
- // Copy 0 bytes; we're done
1653
- if (end === start) return 0
1654
- if (target.length === 0 || this.length === 0) return 0
1655
-
1656
- // Fatal error conditions
1657
- if (targetStart < 0) {
1658
- throw new RangeError('targetStart out of bounds')
1659
- }
1660
- if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
1661
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
1662
-
1663
- // Are we oob?
1664
- if (end > this.length) end = this.length
1665
- if (target.length - targetStart < end - start) {
1666
- end = target.length - targetStart + start
1667
- }
1668
-
1669
- var len = end - start
1670
-
1671
- if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
1672
- // Use built-in when available, missing from IE11
1673
- this.copyWithin(targetStart, start, end)
1674
- } else {
1675
- Uint8Array.prototype.set.call(
1676
- target,
1677
- this.subarray(start, end),
1678
- targetStart
1679
- )
1680
- }
1681
-
1682
- return len
1683
- }
1684
-
1685
- // Usage:
1686
- // buffer.fill(number[, offset[, end]])
1687
- // buffer.fill(buffer[, offset[, end]])
1688
- // buffer.fill(string[, offset[, end]][, encoding])
1689
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
1690
- // Handle string cases:
1691
- if (typeof val === 'string') {
1692
- if (typeof start === 'string') {
1693
- encoding = start
1694
- start = 0
1695
- end = this.length
1696
- } else if (typeof end === 'string') {
1697
- encoding = end
1698
- end = this.length
1699
- }
1700
- if (encoding !== undefined && typeof encoding !== 'string') {
1701
- throw new TypeError('encoding must be a string')
1702
- }
1703
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1704
- throw new TypeError('Unknown encoding: ' + encoding)
1705
- }
1706
- if (val.length === 1) {
1707
- var code = val.charCodeAt(0)
1708
- if ((encoding === 'utf8' && code < 128) ||
1709
- encoding === 'latin1') {
1710
- // Fast path: If `val` fits into a single byte, use that numeric value.
1711
- val = code
1712
- }
1713
- }
1714
- } else if (typeof val === 'number') {
1715
- val = val & 255
1716
- } else if (typeof val === 'boolean') {
1717
- val = Number(val)
1718
- }
1719
-
1720
- // Invalid ranges are not set to a default, so can range check early.
1721
- if (start < 0 || this.length < start || this.length < end) {
1722
- throw new RangeError('Out of range index')
1723
- }
1724
-
1725
- if (end <= start) {
1726
- return this
1727
- }
1728
-
1729
- start = start >>> 0
1730
- end = end === undefined ? this.length : end >>> 0
1731
-
1732
- if (!val) val = 0
1733
-
1734
- var i
1735
- if (typeof val === 'number') {
1736
- for (i = start; i < end; ++i) {
1737
- this[i] = val
1738
- }
1739
- } else {
1740
- var bytes = Buffer.isBuffer(val)
1741
- ? val
1742
- : Buffer.from(val, encoding)
1743
- var len = bytes.length
1744
- if (len === 0) {
1745
- throw new TypeError('The value "' + val +
1746
- '" is invalid for argument "value"')
1747
- }
1748
- for (i = 0; i < end - start; ++i) {
1749
- this[i + start] = bytes[i % len]
1750
- }
1751
- }
1752
-
1753
- return this
1754
- }
1755
-
1756
- // HELPER FUNCTIONS
1757
- // ================
1758
-
1759
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
1760
-
1761
- function base64clean (str) {
1762
- // Node takes equal signs as end of the Base64 encoding
1763
- str = str.split('=')[0]
1764
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
1765
- str = str.trim().replace(INVALID_BASE64_RE, '')
1766
- // Node converts strings with length < 2 to ''
1767
- if (str.length < 2) return ''
1768
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1769
- while (str.length % 4 !== 0) {
1770
- str = str + '='
1771
- }
1772
- return str
1773
- }
1774
-
1775
- function utf8ToBytes (string, units) {
1776
- units = units || Infinity
1777
- var codePoint
1778
- var length = string.length
1779
- var leadSurrogate = null
1780
- var bytes = []
1781
-
1782
- for (var i = 0; i < length; ++i) {
1783
- codePoint = string.charCodeAt(i)
1784
-
1785
- // is surrogate component
1786
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
1787
- // last char was a lead
1788
- if (!leadSurrogate) {
1789
- // no lead yet
1790
- if (codePoint > 0xDBFF) {
1791
- // unexpected trail
1792
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1793
- continue
1794
- } else if (i + 1 === length) {
1795
- // unpaired lead
1796
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1797
- continue
1798
- }
1799
-
1800
- // valid lead
1801
- leadSurrogate = codePoint
1802
-
1803
- continue
1804
- }
1805
-
1806
- // 2 leads in a row
1807
- if (codePoint < 0xDC00) {
1808
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1809
- leadSurrogate = codePoint
1810
- continue
1811
- }
1812
-
1813
- // valid surrogate pair
1814
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
1815
- } else if (leadSurrogate) {
1816
- // valid bmp char, but last char was a lead
1817
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1818
- }
1819
-
1820
- leadSurrogate = null
1821
-
1822
- // encode utf8
1823
- if (codePoint < 0x80) {
1824
- if ((units -= 1) < 0) break
1825
- bytes.push(codePoint)
1826
- } else if (codePoint < 0x800) {
1827
- if ((units -= 2) < 0) break
1828
- bytes.push(
1829
- codePoint >> 0x6 | 0xC0,
1830
- codePoint & 0x3F | 0x80
1831
- )
1832
- } else if (codePoint < 0x10000) {
1833
- if ((units -= 3) < 0) break
1834
- bytes.push(
1835
- codePoint >> 0xC | 0xE0,
1836
- codePoint >> 0x6 & 0x3F | 0x80,
1837
- codePoint & 0x3F | 0x80
1838
- )
1839
- } else if (codePoint < 0x110000) {
1840
- if ((units -= 4) < 0) break
1841
- bytes.push(
1842
- codePoint >> 0x12 | 0xF0,
1843
- codePoint >> 0xC & 0x3F | 0x80,
1844
- codePoint >> 0x6 & 0x3F | 0x80,
1845
- codePoint & 0x3F | 0x80
1846
- )
1847
- } else {
1848
- throw new Error('Invalid code point')
1849
- }
1850
- }
1851
-
1852
- return bytes
1853
- }
1854
-
1855
- function asciiToBytes (str) {
1856
- var byteArray = []
1857
- for (var i = 0; i < str.length; ++i) {
1858
- // Node's code seems to be doing this and not & 0x7F..
1859
- byteArray.push(str.charCodeAt(i) & 0xFF)
1860
- }
1861
- return byteArray
1862
- }
1863
-
1864
- function utf16leToBytes (str, units) {
1865
- var c, hi, lo
1866
- var byteArray = []
1867
- for (var i = 0; i < str.length; ++i) {
1868
- if ((units -= 2) < 0) break
1869
-
1870
- c = str.charCodeAt(i)
1871
- hi = c >> 8
1872
- lo = c % 256
1873
- byteArray.push(lo)
1874
- byteArray.push(hi)
1875
- }
1876
-
1877
- return byteArray
1878
- }
1879
-
1880
- function base64ToBytes (str) {
1881
- return base64.toByteArray(base64clean(str))
1882
- }
1883
-
1884
- function blitBuffer (src, dst, offset, length) {
1885
- for (var i = 0; i < length; ++i) {
1886
- if ((i + offset >= dst.length) || (i >= src.length)) break
1887
- dst[i + offset] = src[i]
1888
- }
1889
- return i
1890
- }
1891
-
1892
- // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
1893
- // the `instanceof` check but they should be treated as of that type.
1894
- // See: https://github.com/feross/buffer/issues/166
1895
- function isInstance (obj, type) {
1896
- return obj instanceof type ||
1897
- (obj != null && obj.constructor != null && obj.constructor.name != null &&
1898
- obj.constructor.name === type.name)
1899
- }
1900
- function numberIsNaN (obj) {
1901
- // For IE11 support
1902
- return obj !== obj // eslint-disable-line no-self-compare
1903
- }
1904
-
1905
- // Create lookup table for `toString('hex')`
1906
- // See: https://github.com/feross/buffer/issues/219
1907
- var hexSliceLookupTable = (function () {
1908
- var alphabet = '0123456789abcdef'
1909
- var table = new Array(256)
1910
- for (var i = 0; i < 16; ++i) {
1911
- var i16 = i * 16
1912
- for (var j = 0; j < 16; ++j) {
1913
- table[i16 + j] = alphabet[i] + alphabet[j]
1914
- }
1915
- }
1916
- return table
1917
- })()
1918
-
1919
-
1920
- /***/ }),
1921
-
1922
- /***/ 526:
1923
- /***/ ((__unused_webpack_module, exports) => {
1924
-
1925
- "use strict";
1926
-
1927
-
1928
- exports.byteLength = byteLength
1929
- exports.toByteArray = toByteArray
1930
- exports.fromByteArray = fromByteArray
1931
-
1932
- var lookup = []
1933
- var revLookup = []
1934
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
1935
-
1936
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
1937
- for (var i = 0, len = code.length; i < len; ++i) {
1938
- lookup[i] = code[i]
1939
- revLookup[code.charCodeAt(i)] = i
1940
- }
1941
-
1942
- // Support decoding URL-safe base64 strings, as Node.js does.
1943
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
1944
- revLookup['-'.charCodeAt(0)] = 62
1945
- revLookup['_'.charCodeAt(0)] = 63
1946
-
1947
- function getLens (b64) {
1948
- var len = b64.length
1949
-
1950
- if (len % 4 > 0) {
1951
- throw new Error('Invalid string. Length must be a multiple of 4')
1952
- }
1953
-
1954
- // Trim off extra bytes after placeholder bytes are found
1955
- // See: https://github.com/beatgammit/base64-js/issues/42
1956
- var validLen = b64.indexOf('=')
1957
- if (validLen === -1) validLen = len
1958
-
1959
- var placeHoldersLen = validLen === len
1960
- ? 0
1961
- : 4 - (validLen % 4)
1962
-
1963
- return [validLen, placeHoldersLen]
1964
- }
1965
-
1966
- // base64 is 4/3 + up to two characters of the original data
1967
- function byteLength (b64) {
1968
- var lens = getLens(b64)
1969
- var validLen = lens[0]
1970
- var placeHoldersLen = lens[1]
1971
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
1972
- }
1973
-
1974
- function _byteLength (b64, validLen, placeHoldersLen) {
1975
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
1976
- }
1977
-
1978
- function toByteArray (b64) {
1979
- var tmp
1980
- var lens = getLens(b64)
1981
- var validLen = lens[0]
1982
- var placeHoldersLen = lens[1]
1983
-
1984
- var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
1985
-
1986
- var curByte = 0
1987
-
1988
- // if there are placeholders, only get up to the last complete 4 chars
1989
- var len = placeHoldersLen > 0
1990
- ? validLen - 4
1991
- : validLen
1992
-
1993
- var i
1994
- for (i = 0; i < len; i += 4) {
1995
- tmp =
1996
- (revLookup[b64.charCodeAt(i)] << 18) |
1997
- (revLookup[b64.charCodeAt(i + 1)] << 12) |
1998
- (revLookup[b64.charCodeAt(i + 2)] << 6) |
1999
- revLookup[b64.charCodeAt(i + 3)]
2000
- arr[curByte++] = (tmp >> 16) & 0xFF
2001
- arr[curByte++] = (tmp >> 8) & 0xFF
2002
- arr[curByte++] = tmp & 0xFF
2003
- }
2004
-
2005
- if (placeHoldersLen === 2) {
2006
- tmp =
2007
- (revLookup[b64.charCodeAt(i)] << 2) |
2008
- (revLookup[b64.charCodeAt(i + 1)] >> 4)
2009
- arr[curByte++] = tmp & 0xFF
2010
- }
2011
-
2012
- if (placeHoldersLen === 1) {
2013
- tmp =
2014
- (revLookup[b64.charCodeAt(i)] << 10) |
2015
- (revLookup[b64.charCodeAt(i + 1)] << 4) |
2016
- (revLookup[b64.charCodeAt(i + 2)] >> 2)
2017
- arr[curByte++] = (tmp >> 8) & 0xFF
2018
- arr[curByte++] = tmp & 0xFF
2019
- }
2020
-
2021
- return arr
2022
- }
2023
-
2024
- function tripletToBase64 (num) {
2025
- return lookup[num >> 18 & 0x3F] +
2026
- lookup[num >> 12 & 0x3F] +
2027
- lookup[num >> 6 & 0x3F] +
2028
- lookup[num & 0x3F]
2029
- }
2030
-
2031
- function encodeChunk (uint8, start, end) {
2032
- var tmp
2033
- var output = []
2034
- for (var i = start; i < end; i += 3) {
2035
- tmp =
2036
- ((uint8[i] << 16) & 0xFF0000) +
2037
- ((uint8[i + 1] << 8) & 0xFF00) +
2038
- (uint8[i + 2] & 0xFF)
2039
- output.push(tripletToBase64(tmp))
2040
- }
2041
- return output.join('')
2042
- }
2043
-
2044
- function fromByteArray (uint8) {
2045
- var tmp
2046
- var len = uint8.length
2047
- var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
2048
- var parts = []
2049
- var maxChunkLength = 16383 // must be multiple of 3
2050
-
2051
- // go through the array every three bytes, we'll deal with trailing stuff later
2052
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
2053
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
2054
- }
2055
-
2056
- // pad the end with zeros, but make sure to not forget the extra bytes
2057
- if (extraBytes === 1) {
2058
- tmp = uint8[len - 1]
2059
- parts.push(
2060
- lookup[tmp >> 2] +
2061
- lookup[(tmp << 4) & 0x3F] +
2062
- '=='
2063
- )
2064
- } else if (extraBytes === 2) {
2065
- tmp = (uint8[len - 2] << 8) + uint8[len - 1]
2066
- parts.push(
2067
- lookup[tmp >> 10] +
2068
- lookup[(tmp >> 4) & 0x3F] +
2069
- lookup[(tmp << 2) & 0x3F] +
2070
- '='
2071
- )
2072
- }
2073
-
2074
- return parts.join('')
2075
- }
2076
-
2077
-
2078
- /***/ })
2079
-
2080
- /******/ });
2081
- /************************************************************************/
2082
- /******/ // The module cache
2083
- /******/ var __webpack_module_cache__ = {};
2084
- /******/
2085
- /******/ // The require function
2086
- /******/ function __webpack_require__(moduleId) {
2087
- /******/ // Check if module is in cache
2088
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
2089
- /******/ if (cachedModule !== undefined) {
2090
- /******/ return cachedModule.exports;
2091
- /******/ }
2092
- /******/ // Create a new module (and put it into the cache)
2093
- /******/ var module = __webpack_module_cache__[moduleId] = {
2094
- /******/ // no module.id needed
2095
- /******/ // no module.loaded needed
2096
- /******/ exports: {}
2097
- /******/ };
2098
- /******/
2099
- /******/ // Execute the module function
2100
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
2101
- /******/
2102
- /******/ // Return the exports of the module
2103
- /******/ return module.exports;
2104
- /******/ }
2
+ /******/ "use strict";
3
+ /******/ // The require scope
4
+ /******/ var __webpack_require__ = {};
2105
5
  /******/
2106
6
  /************************************************************************/
2107
7
  /******/ /* webpack/runtime/define property getters */
@@ -2134,9 +34,6 @@ function fromByteArray (uint8) {
2134
34
  /******/
2135
35
  /************************************************************************/
2136
36
  var __webpack_exports__ = {};
2137
- // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
2138
- (() => {
2139
- "use strict";
2140
37
 
2141
38
  // EXPORTS
2142
39
  __webpack_require__.d(__webpack_exports__, {
@@ -7638,207 +5535,11 @@ class TinyHtml {
7638
5535
 
7639
5536
  /* harmony default export */ const libs_TinyHtml = (TinyHtml);
7640
5537
 
7641
- // EXTERNAL MODULE: ./node_modules/buffer/index.js
7642
- var buffer = __webpack_require__(287);
7643
- ;// ./src/v1/basics/objFilter.mjs
7644
-
7645
-
7646
- const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
7647
-
7648
- /**
7649
- * An object containing type validation functions and their evaluation order.
7650
- *
7651
- * Each item in `typeValidator.items` is a function that receives any value
7652
- * and returns a boolean indicating whether the value matches the corresponding type.
7653
- *
7654
- * The `order` array defines the priority in which types should be checked,
7655
- * which can be useful for functions that infer types in a consistent manner.
7656
- *
7657
- */
7658
- const typeValidator = {
7659
- items: {},
7660
- /**
7661
- * Evaluation order of the type checkers.
7662
- * @type {string[]}
7663
- * */
7664
- order: [],
7665
- };
7666
-
7667
- /** @typedef {Object.<string, (val: any) => *>} ExtendObjType */
7668
- /** @typedef {Array<[string, (val: any) => *]>} ExtendObjTypeArray */
7669
-
7670
- /**
7671
- * Adds new type checkers to the typeValidator without overwriting existing ones.
7672
- *
7673
- * Accepts either an object with named functions or an array of [key, fn] arrays.
7674
- * If no index is provided, the type is inserted just before 'object' (if it exists), or at the end.
7675
- *
7676
- * @param {ExtendObjType|ExtendObjTypeArray} newItems
7677
- * - New type validators to be added.
7678
- * @param {number} [index] - Optional. Position at which to insert each new type. Ignored if the type already exists.
7679
- * @returns {string[]} - A list of successfully added type names.
7680
- *
7681
- * @example
7682
- * extendObjType({
7683
- * htmlElement2: val => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement
7684
- * });
7685
- *
7686
- * @example
7687
- * extendObjType([
7688
- * ['alpha', val => typeof val === 'string'],
7689
- * ['beta', val => Array.isArray(val)]
7690
- * ]);
7691
- */
7692
- function extendObjType(newItems, index) {
7693
- const added = [];
7694
-
7695
- const entries = Array.isArray(newItems) ? newItems : Object.entries(newItems);
7696
- for (const [key, fn] of entries) {
7697
- if (!typeValidator.items.hasOwnProperty(key)) {
7698
- // @ts-ignore
7699
- typeValidator.items[key] = fn;
7700
-
7701
- let insertAt = typeof index === 'number' ? index : -1; // Default to -1 if index isn't provided
7702
-
7703
- // Default to before 'object', or to the end
7704
- if (insertAt === -1) {
7705
- const objectIndex = typeValidator.order.indexOf('object');
7706
- insertAt = objectIndex > -1 ? objectIndex : typeValidator.order.length;
7707
- }
7708
-
7709
- // Ensure insertAt is a valid number and not out of bounds
7710
- insertAt = Math.min(Math.max(0, insertAt), typeValidator.order.length);
7711
-
7712
- typeValidator.order.splice(insertAt, 0, key);
7713
- added.push(key);
7714
- }
7715
- }
7716
-
7717
- return added;
7718
- }
7719
-
7720
- /**
7721
- * Reorders the typeValidator.order array according to a custom new order.
7722
- * All values in the new order must already exist in the current order.
7723
- * The function does not mutate the original array structure directly.
7724
- *
7725
- * @param {string[]} newOrder - The new order of type names.
7726
- * @returns {boolean} - Returns true if the reorder was successful, false if invalid keys were found.
7727
- *
7728
- * @example
7729
- * reorderObjTypeOrder([
7730
- * 'string', 'number', 'array', 'object'
7731
- * ]);
7732
- */
7733
- function reorderObjTypeOrder(newOrder) {
7734
- const currentOrder = [...typeValidator.order]; // shallow clone
7735
-
7736
- // All keys in newOrder must exist in currentOrder
7737
- const isValid = newOrder.every((type) => currentOrder.includes(type));
7738
-
7739
- if (!isValid) return false;
7740
-
7741
- // Reassign only if valid
7742
- typeValidator.order = newOrder.slice(); // assign shallow copy
7743
- return true;
7744
- }
7745
-
7746
- /**
7747
- * Returns a cloned version of the `typeValidator.order` array.
7748
- * The cloned array will not be affected by future changes to the original `order`.
7749
- *
7750
- * @returns {string[]} - A new array with the same values as `typeValidator.order`.
7751
- */
7752
- function cloneObjTypeOrder() {
7753
- return [...typeValidator.order]; // Creates a shallow copy of the array
7754
- }
7755
-
7756
- /**
7757
- * Returns the detected type name of a given value based on predefined type validators.
7758
- *
7759
- * This function uses `getType` with a predefined `typeValidator` to determine or compare types safely.
7760
- * in the specified `typeValidator.order`. The first matching type is returned.
7761
- *
7762
- * If `val` is `null`, it immediately returns `'null'`.
7763
- * If no match is found, it returns `'unknown'`.
7764
- *
7765
- * @param {any} val - The value whose type should be determined.
7766
- * @returns {string} - The type name of the value (e.g., "array", "date", "map"), or "unknown" if no match is found.
7767
- *
7768
- * @example
7769
- * getType([]); // "array"
7770
- * getType(null); // "null"
7771
- * getType(new Set()); // "set"
7772
- * getType(() => {}); // "unknown"
7773
- */
7774
- const getType = (val) => {
7775
- if (val === null) return 'null';
7776
- // @ts-ignore
7777
- for (const name of typeValidator.order) {
7778
- // @ts-ignore
7779
- if (typeof typeValidator.items[name] !== 'function' || typeValidator.items[name](val))
7780
- return name;
7781
- }
7782
- return 'unknown';
7783
- };
7784
-
7785
- /**
7786
- * Checks the type of a given object or returns its type as a string.
7787
- *
7788
- * @param {*} obj - The object to check or identify.
7789
- * @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
7790
- * @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
7791
- * the type string if no type is provided, or `null` if the object is `undefined`.
7792
- *
7793
- * @example
7794
- * objType([], 'array'); // true
7795
- * objType({}, 'object'); // true
7796
- * objType('hello'); // "string"
7797
- * objType(undefined); // null
7798
- */
7799
- function objType(obj, type) {
7800
- if (typeof obj === 'undefined') return null;
7801
- const result = getType(obj);
7802
- if (typeof type === 'string') return result === type.toLowerCase();
7803
- return result;
7804
- }
7805
-
7806
- /**
7807
- * Checks the type of a given object and returns the validation value if a known type is detected.
7808
- *
7809
- * @param {*} obj - The object to check or identify.
7810
- * @returns {{ valid:*; type: string | null }} - Returns the type result.
7811
- */
7812
- function checkObj(obj) {
7813
- /** @type {{ valid:*; type: string | null }} */
7814
- const data = { valid: null, type: null };
7815
- for (const name of typeValidator.order) {
7816
- // @ts-ignore
7817
- if (typeof typeValidator.items[name] === 'function') {
7818
- // @ts-ignore
7819
- const result = typeValidator.items[name](obj);
7820
- if (result) {
7821
- data.valid = result;
7822
- data.type = name;
7823
- break;
7824
- }
7825
- }
7826
- }
7827
- return data;
7828
- }
7829
-
7830
- /**
7831
- * Creates a clone of the functions from the `typeValidator` object.
7832
- * It returns a new object where the keys are the same and the values are the cloned functions.
7833
- */
7834
- function getCheckObj() {
7835
- return Object.fromEntries(Object.entries(typeValidator.items).map(([key, fn]) => [key, fn]));
7836
- }
7837
-
5538
+ ;// ./src/v1/basics/objChecker.mjs
7838
5539
  /**
7839
5540
  * Counts the number of elements in an array or the number of properties in an object.
7840
5541
  *
7841
- * @param {Array<*>|Record<string|number, any>} obj - The array or object to count.
5542
+ * @param {Array<*>|Record<string | number | symbol, any>} obj - The array or object to count.
7842
5543
  * @returns {number} - The count of items (array elements or object keys), or `0` if the input is neither an array nor an object.
7843
5544
  *
7844
5545
  * @example
@@ -7850,7 +5551,7 @@ function countObj(obj) {
7850
5551
  // Is Array
7851
5552
  if (Array.isArray(obj)) return obj.length;
7852
5553
  // Object
7853
- if (objType(obj, 'object')) return Object.keys(obj).length;
5554
+ if (isJsonObject(obj)) return Object.keys(obj).length;
7854
5555
  // Nothing
7855
5556
  return 0;
7856
5557
  }
@@ -7877,132 +5578,6 @@ function isJsonObject(value) {
7877
5578
  return true;
7878
5579
  }
7879
5580
 
7880
- // Insert obj types
7881
-
7882
- extendObjType([
7883
- [
7884
- 'undefined',
7885
- /** @param {*} val @returns {val is undefined} */
7886
- (val) => typeof val === 'undefined',
7887
- ],
7888
- [
7889
- 'null',
7890
- /** @param {*} val @returns {val is null} */
7891
- (val) => val === null,
7892
- ],
7893
- [
7894
- 'boolean',
7895
- /** @param {*} val @returns {val is boolean} */
7896
- (val) => typeof val === 'boolean',
7897
- ],
7898
- [
7899
- 'number',
7900
- /** @param {*} val @returns {val is number} */
7901
- (val) => typeof val === 'number' && !Number.isNaN(val),
7902
- ],
7903
- [
7904
- 'bigint',
7905
- /** @param {*} val @returns {val is bigint} */
7906
- (val) => typeof val === 'bigint',
7907
- ],
7908
- [
7909
- 'string',
7910
- /** @param {*} val @returns {val is string} */
7911
- (val) => typeof val === 'string',
7912
- ],
7913
- [
7914
- 'symbol',
7915
- /** @param {*} val @returns {val is symbol} */
7916
- (val) => typeof val === 'symbol',
7917
- ],
7918
- [
7919
- 'function',
7920
- /** @param {*} val @returns {val is Function} */
7921
- (val) => typeof val === 'function',
7922
- ],
7923
- [
7924
- 'array',
7925
- /** @param {*} val @returns {val is any[]} */
7926
- (val) => Array.isArray(val),
7927
- ],
7928
- ]);
7929
-
7930
- if (!isBrowser) {
7931
- extendObjType([
7932
- [
7933
- 'buffer',
7934
- /** @param {*} val @returns {val is Buffer} */
7935
- (val) => typeof buffer/* Buffer */.hp !== 'undefined' && buffer/* Buffer */.hp.isBuffer(val),
7936
- ],
7937
- ]);
7938
- }
7939
-
7940
- if (isBrowser) {
7941
- extendObjType([
7942
- [
7943
- 'file',
7944
- /** @param {*} val @returns {val is File} */
7945
- (val) => typeof File !== 'undefined' && val instanceof File,
7946
- ],
7947
- ]);
7948
- }
7949
-
7950
- extendObjType([
7951
- [
7952
- 'date',
7953
- /** @param {*} val @returns {val is Date} */
7954
- (val) => val instanceof Date,
7955
- ],
7956
- [
7957
- 'regexp',
7958
- /** @param {*} val @returns {val is RegExp} */
7959
- (val) => val instanceof RegExp,
7960
- ],
7961
- [
7962
- 'map',
7963
- /** @param {*} val @returns {val is Map<unknown, unknown>} */
7964
- (val) => val instanceof Map,
7965
- ],
7966
- [
7967
- 'set',
7968
- /** @param {*} val @returns {val is Set<unknown>} */
7969
- (val) => val instanceof Set,
7970
- ],
7971
- [
7972
- 'weakmap',
7973
- /** @param {*} val @returns {val is WeakMap<unknown, unknown>} */
7974
- (val) => val instanceof WeakMap,
7975
- ],
7976
- [
7977
- 'weakset',
7978
- /** @param {*} val @returns {val is WeakSet<unknown>} */
7979
- (val) => val instanceof WeakSet,
7980
- ],
7981
- [
7982
- 'promise',
7983
- /** @param {*} val @returns {val is Promise<unknown>} */
7984
- (val) => val instanceof Promise,
7985
- ],
7986
- ]);
7987
-
7988
- if (isBrowser) {
7989
- extendObjType([
7990
- [
7991
- 'htmlelement',
7992
- /** @param {*} val @returns {val is HTMLElement} */
7993
- (val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
7994
- ],
7995
- ]);
7996
- }
7997
-
7998
- extendObjType([
7999
- [
8000
- 'object',
8001
- /** @param {*} val @returns {val is Record<string | number | symbol, unknown>} */
8002
- (val) => isJsonObject(val),
8003
- ],
8004
- ]);
8005
-
8006
5581
  ;// ./src/v1/libs/TinyDragger.mjs
8007
5582
 
8008
5583
 
@@ -8989,8 +6564,6 @@ class TinyDragger {
8989
6564
 
8990
6565
 
8991
6566
 
8992
- })();
8993
-
8994
6567
  window.TinyDragger = __webpack_exports__.TinyDragger;
8995
6568
  /******/ })()
8996
6569
  ;