miolo 0.7.1 → 0.7.3
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.
- package/dist/cli/miolo.cli.iife.bundle.js +4741 -10
- package/dist/cli/miolo.cli.iife.bundle.js.map +1 -1
- package/dist/cli/miolo.cli.iife.bundle.min.js +2 -2
- package/dist/cli/miolo.cli.iife.js +7 -12
- package/dist/cli/miolo.cli.iife.js.map +1 -1
- package/dist/cli/miolo.cli.iife.min.js +2 -2
- package/dist/cli/miolo.cli.min.mjs +2 -2
- package/dist/cli/miolo.cli.mjs +7 -8
- package/dist/cli/miolo.cli.mjs.map +1 -1
- package/dist/cli/miolo.cli.umd.bundle.js +4741 -10
- package/dist/cli/miolo.cli.umd.bundle.js.map +1 -1
- package/dist/cli/miolo.cli.umd.bundle.min.js +2 -2
- package/dist/cli/miolo.cli.umd.js +9 -14
- package/dist/cli/miolo.cli.umd.js.map +1 -1
- package/dist/cli/miolo.cli.umd.min.js +2 -2
- package/dist/cli-react/miolo.cli-react.iife.bundle.js +4710 -11
- package/dist/cli-react/miolo.cli-react.iife.bundle.js.map +1 -1
- package/dist/cli-react/miolo.cli-react.iife.bundle.min.js +5 -5
- package/dist/cli-react/miolo.cli-react.iife.js +7 -12
- package/dist/cli-react/miolo.cli-react.iife.js.map +1 -1
- package/dist/cli-react/miolo.cli-react.iife.min.js +2 -2
- package/dist/cli-react/miolo.cli-react.min.mjs +2 -2
- package/dist/cli-react/miolo.cli-react.mjs +6 -8
- package/dist/cli-react/miolo.cli-react.mjs.map +1 -1
- package/dist/cli-react/miolo.cli-react.umd.bundle.js +4710 -11
- package/dist/cli-react/miolo.cli-react.umd.bundle.js.map +1 -1
- package/dist/cli-react/miolo.cli-react.umd.bundle.min.js +5 -5
- package/dist/cli-react/miolo.cli-react.umd.js +9 -14
- package/dist/cli-react/miolo.cli-react.umd.js.map +1 -1
- package/dist/cli-react/miolo.cli-react.umd.min.js +2 -2
- package/dist/server/miolo.server.cjs +35 -62
- package/dist/server/miolo.server.min.mjs +2 -2
- package/dist/server/miolo.server.mjs +34 -60
- package/dist/server/miolo.server.mjs.map +1 -1
- package/dist/server/miolo.server.node.mjs +35 -62
- package/package.json +8 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* miolo v0.7.
|
|
2
|
+
* miolo v0.7.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Donato Lorenzo <donato@afialapis.com>
|
|
5
5
|
*
|
|
@@ -436,19 +436,4750 @@ var miolo = (function (exports) {
|
|
|
436
436
|
return _setPrototypeOf(o, p);
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
function getDefaultExportFromCjs (x) {
|
|
440
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function getAugmentedNamespace(n) {
|
|
444
|
+
if (n.__esModule) return n;
|
|
445
|
+
var f = n.default;
|
|
446
|
+
if (typeof f == "function") {
|
|
447
|
+
var a = function a () {
|
|
448
|
+
if (this instanceof a) {
|
|
449
|
+
var args = [null];
|
|
450
|
+
args.push.apply(args, arguments);
|
|
451
|
+
var Ctor = Function.bind.apply(f, args);
|
|
452
|
+
return new Ctor();
|
|
453
|
+
}
|
|
454
|
+
return f.apply(this, arguments);
|
|
455
|
+
};
|
|
456
|
+
a.prototype = f.prototype;
|
|
457
|
+
} else a = {};
|
|
458
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
459
|
+
Object.keys(n).forEach(function (k) {
|
|
460
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
461
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
462
|
+
enumerable: true,
|
|
463
|
+
get: function () {
|
|
464
|
+
return n[k];
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
return a;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
472
|
+
var shams = function hasSymbols() {
|
|
473
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
474
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
475
|
+
|
|
476
|
+
var obj = {};
|
|
477
|
+
var sym = Symbol('test');
|
|
478
|
+
var symObj = Object(sym);
|
|
479
|
+
if (typeof sym === 'string') { return false; }
|
|
480
|
+
|
|
481
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
482
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
483
|
+
|
|
484
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
485
|
+
// if (sym instanceof Symbol) { return false; }
|
|
486
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
487
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
488
|
+
|
|
489
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
490
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
491
|
+
|
|
492
|
+
var symVal = 42;
|
|
493
|
+
obj[sym] = symVal;
|
|
494
|
+
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
495
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
496
|
+
|
|
497
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
498
|
+
|
|
499
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
500
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
501
|
+
|
|
502
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
503
|
+
|
|
504
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
505
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
506
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
return true;
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
513
|
+
var hasSymbolSham = shams;
|
|
514
|
+
|
|
515
|
+
var hasSymbols$1 = function hasNativeSymbols() {
|
|
516
|
+
if (typeof origSymbol !== 'function') { return false; }
|
|
517
|
+
if (typeof Symbol !== 'function') { return false; }
|
|
518
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
519
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
520
|
+
|
|
521
|
+
return hasSymbolSham();
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
var test = {
|
|
525
|
+
foo: {}
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
var $Object = Object;
|
|
529
|
+
|
|
530
|
+
var hasProto$1 = function hasProto() {
|
|
531
|
+
return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/* eslint no-invalid-this: 1 */
|
|
535
|
+
|
|
536
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
537
|
+
var slice = Array.prototype.slice;
|
|
538
|
+
var toStr$1 = Object.prototype.toString;
|
|
539
|
+
var funcType = '[object Function]';
|
|
540
|
+
|
|
541
|
+
var implementation$1 = function bind(that) {
|
|
542
|
+
var target = this;
|
|
543
|
+
if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
|
|
544
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
545
|
+
}
|
|
546
|
+
var args = slice.call(arguments, 1);
|
|
547
|
+
|
|
548
|
+
var bound;
|
|
549
|
+
var binder = function () {
|
|
550
|
+
if (this instanceof bound) {
|
|
551
|
+
var result = target.apply(
|
|
552
|
+
this,
|
|
553
|
+
args.concat(slice.call(arguments))
|
|
554
|
+
);
|
|
555
|
+
if (Object(result) === result) {
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
return this;
|
|
559
|
+
} else {
|
|
560
|
+
return target.apply(
|
|
561
|
+
that,
|
|
562
|
+
args.concat(slice.call(arguments))
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
var boundLength = Math.max(0, target.length - args.length);
|
|
568
|
+
var boundArgs = [];
|
|
569
|
+
for (var i = 0; i < boundLength; i++) {
|
|
570
|
+
boundArgs.push('$' + i);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
574
|
+
|
|
575
|
+
if (target.prototype) {
|
|
576
|
+
var Empty = function Empty() {};
|
|
577
|
+
Empty.prototype = target.prototype;
|
|
578
|
+
bound.prototype = new Empty();
|
|
579
|
+
Empty.prototype = null;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return bound;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
var implementation = implementation$1;
|
|
586
|
+
|
|
587
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
588
|
+
|
|
589
|
+
var bind$1 = functionBind;
|
|
590
|
+
|
|
591
|
+
var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
|
|
592
|
+
|
|
593
|
+
var undefined$1;
|
|
594
|
+
|
|
595
|
+
var $SyntaxError = SyntaxError;
|
|
596
|
+
var $Function = Function;
|
|
597
|
+
var $TypeError$1 = TypeError;
|
|
598
|
+
|
|
599
|
+
// eslint-disable-next-line consistent-return
|
|
600
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
|
601
|
+
try {
|
|
602
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
603
|
+
} catch (e) {}
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
var $gOPD = Object.getOwnPropertyDescriptor;
|
|
607
|
+
if ($gOPD) {
|
|
608
|
+
try {
|
|
609
|
+
$gOPD({}, '');
|
|
610
|
+
} catch (e) {
|
|
611
|
+
$gOPD = null; // this is IE 8, which has a broken gOPD
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
var throwTypeError = function () {
|
|
616
|
+
throw new $TypeError$1();
|
|
617
|
+
};
|
|
618
|
+
var ThrowTypeError = $gOPD
|
|
619
|
+
? (function () {
|
|
620
|
+
try {
|
|
621
|
+
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
622
|
+
arguments.callee; // IE 8 does not throw here
|
|
623
|
+
return throwTypeError;
|
|
624
|
+
} catch (calleeThrows) {
|
|
625
|
+
try {
|
|
626
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
627
|
+
return $gOPD(arguments, 'callee').get;
|
|
628
|
+
} catch (gOPDthrows) {
|
|
629
|
+
return throwTypeError;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}())
|
|
633
|
+
: throwTypeError;
|
|
634
|
+
|
|
635
|
+
var hasSymbols = hasSymbols$1();
|
|
636
|
+
var hasProto = hasProto$1();
|
|
637
|
+
|
|
638
|
+
var getProto = Object.getPrototypeOf || (
|
|
639
|
+
hasProto
|
|
640
|
+
? function (x) { return x.__proto__; } // eslint-disable-line no-proto
|
|
641
|
+
: null
|
|
642
|
+
);
|
|
643
|
+
|
|
644
|
+
var needsEval = {};
|
|
645
|
+
|
|
646
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
647
|
+
|
|
648
|
+
var INTRINSICS = {
|
|
649
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
650
|
+
'%Array%': Array,
|
|
651
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
652
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
653
|
+
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
654
|
+
'%AsyncFunction%': needsEval,
|
|
655
|
+
'%AsyncGenerator%': needsEval,
|
|
656
|
+
'%AsyncGeneratorFunction%': needsEval,
|
|
657
|
+
'%AsyncIteratorPrototype%': needsEval,
|
|
658
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
|
659
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
|
660
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
|
|
661
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
|
|
662
|
+
'%Boolean%': Boolean,
|
|
663
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
|
664
|
+
'%Date%': Date,
|
|
665
|
+
'%decodeURI%': decodeURI,
|
|
666
|
+
'%decodeURIComponent%': decodeURIComponent,
|
|
667
|
+
'%encodeURI%': encodeURI,
|
|
668
|
+
'%encodeURIComponent%': encodeURIComponent,
|
|
669
|
+
'%Error%': Error,
|
|
670
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
|
671
|
+
'%EvalError%': EvalError,
|
|
672
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
673
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
674
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
675
|
+
'%Function%': $Function,
|
|
676
|
+
'%GeneratorFunction%': needsEval,
|
|
677
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
|
678
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
|
679
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
680
|
+
'%isFinite%': isFinite,
|
|
681
|
+
'%isNaN%': isNaN,
|
|
682
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
683
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
684
|
+
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
685
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
686
|
+
'%Math%': Math,
|
|
687
|
+
'%Number%': Number,
|
|
688
|
+
'%Object%': Object,
|
|
689
|
+
'%parseFloat%': parseFloat,
|
|
690
|
+
'%parseInt%': parseInt,
|
|
691
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
692
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
693
|
+
'%RangeError%': RangeError,
|
|
694
|
+
'%ReferenceError%': ReferenceError,
|
|
695
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
696
|
+
'%RegExp%': RegExp,
|
|
697
|
+
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
698
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
699
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
700
|
+
'%String%': String,
|
|
701
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
702
|
+
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
703
|
+
'%SyntaxError%': $SyntaxError,
|
|
704
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
705
|
+
'%TypedArray%': TypedArray,
|
|
706
|
+
'%TypeError%': $TypeError$1,
|
|
707
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
708
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
709
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
710
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
711
|
+
'%URIError%': URIError,
|
|
712
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
713
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
|
714
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
if (getProto) {
|
|
718
|
+
try {
|
|
719
|
+
null.error; // eslint-disable-line no-unused-expressions
|
|
720
|
+
} catch (e) {
|
|
721
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
722
|
+
var errorProto = getProto(getProto(e));
|
|
723
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
var doEval = function doEval(name) {
|
|
728
|
+
var value;
|
|
729
|
+
if (name === '%AsyncFunction%') {
|
|
730
|
+
value = getEvalledConstructor('async function () {}');
|
|
731
|
+
} else if (name === '%GeneratorFunction%') {
|
|
732
|
+
value = getEvalledConstructor('function* () {}');
|
|
733
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
|
734
|
+
value = getEvalledConstructor('async function* () {}');
|
|
735
|
+
} else if (name === '%AsyncGenerator%') {
|
|
736
|
+
var fn = doEval('%AsyncGeneratorFunction%');
|
|
737
|
+
if (fn) {
|
|
738
|
+
value = fn.prototype;
|
|
739
|
+
}
|
|
740
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
|
741
|
+
var gen = doEval('%AsyncGenerator%');
|
|
742
|
+
if (gen && getProto) {
|
|
743
|
+
value = getProto(gen.prototype);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
INTRINSICS[name] = value;
|
|
748
|
+
|
|
749
|
+
return value;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
var LEGACY_ALIASES = {
|
|
753
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
754
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
755
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
756
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
757
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
758
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
759
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
760
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
761
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
762
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
763
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
764
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
|
765
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
766
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
767
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
768
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
769
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
770
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
771
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
772
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
773
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
774
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
775
|
+
'%JSONParse%': ['JSON', 'parse'],
|
|
776
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
|
777
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
|
778
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
|
779
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
780
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
781
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
782
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
783
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
784
|
+
'%Promise_all%': ['Promise', 'all'],
|
|
785
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
|
786
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
787
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
788
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
789
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
790
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
|
791
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
792
|
+
'%StringPrototype%': ['String', 'prototype'],
|
|
793
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
794
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
795
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
796
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
797
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
798
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
799
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
800
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
801
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
802
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
803
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
var bind = functionBind;
|
|
807
|
+
var hasOwn$1 = src;
|
|
808
|
+
var $concat$1 = bind.call(Function.call, Array.prototype.concat);
|
|
809
|
+
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
|
810
|
+
var $replace$1 = bind.call(Function.call, String.prototype.replace);
|
|
811
|
+
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
|
812
|
+
var $exec = bind.call(Function.call, RegExp.prototype.exec);
|
|
813
|
+
|
|
814
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
815
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
816
|
+
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
817
|
+
var stringToPath = function stringToPath(string) {
|
|
818
|
+
var first = $strSlice(string, 0, 1);
|
|
819
|
+
var last = $strSlice(string, -1);
|
|
820
|
+
if (first === '%' && last !== '%') {
|
|
821
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
|
822
|
+
} else if (last === '%' && first !== '%') {
|
|
823
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
|
824
|
+
}
|
|
825
|
+
var result = [];
|
|
826
|
+
$replace$1(string, rePropName, function (match, number, quote, subString) {
|
|
827
|
+
result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
|
|
828
|
+
});
|
|
829
|
+
return result;
|
|
830
|
+
};
|
|
831
|
+
/* end adaptation */
|
|
832
|
+
|
|
833
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
834
|
+
var intrinsicName = name;
|
|
835
|
+
var alias;
|
|
836
|
+
if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
|
|
837
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
838
|
+
intrinsicName = '%' + alias[0] + '%';
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
if (hasOwn$1(INTRINSICS, intrinsicName)) {
|
|
842
|
+
var value = INTRINSICS[intrinsicName];
|
|
843
|
+
if (value === needsEval) {
|
|
844
|
+
value = doEval(intrinsicName);
|
|
845
|
+
}
|
|
846
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
|
847
|
+
throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
return {
|
|
851
|
+
alias: alias,
|
|
852
|
+
name: intrinsicName,
|
|
853
|
+
value: value
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
861
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
862
|
+
throw new $TypeError$1('intrinsic name must be a non-empty string');
|
|
863
|
+
}
|
|
864
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
865
|
+
throw new $TypeError$1('"allowMissing" argument must be a boolean');
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
869
|
+
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
870
|
+
}
|
|
871
|
+
var parts = stringToPath(name);
|
|
872
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
873
|
+
|
|
874
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
875
|
+
var intrinsicRealName = intrinsic.name;
|
|
876
|
+
var value = intrinsic.value;
|
|
877
|
+
var skipFurtherCaching = false;
|
|
878
|
+
|
|
879
|
+
var alias = intrinsic.alias;
|
|
880
|
+
if (alias) {
|
|
881
|
+
intrinsicBaseName = alias[0];
|
|
882
|
+
$spliceApply(parts, $concat$1([0, 1], alias));
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
886
|
+
var part = parts[i];
|
|
887
|
+
var first = $strSlice(part, 0, 1);
|
|
888
|
+
var last = $strSlice(part, -1);
|
|
889
|
+
if (
|
|
890
|
+
(
|
|
891
|
+
(first === '"' || first === "'" || first === '`')
|
|
892
|
+
|| (last === '"' || last === "'" || last === '`')
|
|
893
|
+
)
|
|
894
|
+
&& first !== last
|
|
895
|
+
) {
|
|
896
|
+
throw new $SyntaxError('property names with quotes must have matching quotes');
|
|
897
|
+
}
|
|
898
|
+
if (part === 'constructor' || !isOwn) {
|
|
899
|
+
skipFurtherCaching = true;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
intrinsicBaseName += '.' + part;
|
|
903
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
904
|
+
|
|
905
|
+
if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
|
|
906
|
+
value = INTRINSICS[intrinsicRealName];
|
|
907
|
+
} else if (value != null) {
|
|
908
|
+
if (!(part in value)) {
|
|
909
|
+
if (!allowMissing) {
|
|
910
|
+
throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
911
|
+
}
|
|
912
|
+
return void undefined$1;
|
|
913
|
+
}
|
|
914
|
+
if ($gOPD && (i + 1) >= parts.length) {
|
|
915
|
+
var desc = $gOPD(value, part);
|
|
916
|
+
isOwn = !!desc;
|
|
917
|
+
|
|
918
|
+
// By convention, when a data property is converted to an accessor
|
|
919
|
+
// property to emulate a data property that does not suffer from
|
|
920
|
+
// the override mistake, that accessor's getter is marked with
|
|
921
|
+
// an `originalValue` property. Here, when we detect this, we
|
|
922
|
+
// uphold the illusion by pretending to see that original data
|
|
923
|
+
// property, i.e., returning the value rather than the getter
|
|
924
|
+
// itself.
|
|
925
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
926
|
+
value = desc.get;
|
|
927
|
+
} else {
|
|
928
|
+
value = value[part];
|
|
929
|
+
}
|
|
930
|
+
} else {
|
|
931
|
+
isOwn = hasOwn$1(value, part);
|
|
932
|
+
value = value[part];
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
if (isOwn && !skipFurtherCaching) {
|
|
936
|
+
INTRINSICS[intrinsicRealName] = value;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return value;
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
var callBind$1 = {exports: {}};
|
|
944
|
+
|
|
945
|
+
(function (module) {
|
|
946
|
+
|
|
947
|
+
var bind = functionBind;
|
|
948
|
+
var GetIntrinsic = getIntrinsic;
|
|
949
|
+
|
|
950
|
+
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
951
|
+
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
952
|
+
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
953
|
+
|
|
954
|
+
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
955
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
956
|
+
var $max = GetIntrinsic('%Math.max%');
|
|
957
|
+
|
|
958
|
+
if ($defineProperty) {
|
|
959
|
+
try {
|
|
960
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
961
|
+
} catch (e) {
|
|
962
|
+
// IE 8 has a broken defineProperty
|
|
963
|
+
$defineProperty = null;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
module.exports = function callBind(originalFunction) {
|
|
968
|
+
var func = $reflectApply(bind, $call, arguments);
|
|
969
|
+
if ($gOPD && $defineProperty) {
|
|
970
|
+
var desc = $gOPD(func, 'length');
|
|
971
|
+
if (desc.configurable) {
|
|
972
|
+
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
973
|
+
$defineProperty(
|
|
974
|
+
func,
|
|
975
|
+
'length',
|
|
976
|
+
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return func;
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
var applyBind = function applyBind() {
|
|
984
|
+
return $reflectApply(bind, $apply, arguments);
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
if ($defineProperty) {
|
|
988
|
+
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
989
|
+
} else {
|
|
990
|
+
module.exports.apply = applyBind;
|
|
991
|
+
}
|
|
992
|
+
} (callBind$1));
|
|
993
|
+
|
|
994
|
+
var callBindExports = callBind$1.exports;
|
|
995
|
+
|
|
996
|
+
var GetIntrinsic$1 = getIntrinsic;
|
|
997
|
+
|
|
998
|
+
var callBind = callBindExports;
|
|
999
|
+
|
|
1000
|
+
var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
|
|
1001
|
+
|
|
1002
|
+
var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
|
|
1003
|
+
var intrinsic = GetIntrinsic$1(name, !!allowMissing);
|
|
1004
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
1005
|
+
return callBind(intrinsic);
|
|
1006
|
+
}
|
|
1007
|
+
return intrinsic;
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
var global$1 = (typeof global !== "undefined" ? global :
|
|
1011
|
+
typeof self !== "undefined" ? self :
|
|
1012
|
+
typeof window !== "undefined" ? window : {});
|
|
1013
|
+
|
|
1014
|
+
var lookup = [];
|
|
1015
|
+
var revLookup = [];
|
|
1016
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
1017
|
+
var inited = false;
|
|
1018
|
+
function init () {
|
|
1019
|
+
inited = true;
|
|
1020
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
1021
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
|
1022
|
+
lookup[i] = code[i];
|
|
1023
|
+
revLookup[code.charCodeAt(i)] = i;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
revLookup['-'.charCodeAt(0)] = 62;
|
|
1027
|
+
revLookup['_'.charCodeAt(0)] = 63;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function toByteArray (b64) {
|
|
1031
|
+
if (!inited) {
|
|
1032
|
+
init();
|
|
1033
|
+
}
|
|
1034
|
+
var i, j, l, tmp, placeHolders, arr;
|
|
1035
|
+
var len = b64.length;
|
|
1036
|
+
|
|
1037
|
+
if (len % 4 > 0) {
|
|
1038
|
+
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// the number of equal signs (place holders)
|
|
1042
|
+
// if there are two placeholders, than the two characters before it
|
|
1043
|
+
// represent one byte
|
|
1044
|
+
// if there is only one, then the three characters before it represent 2 bytes
|
|
1045
|
+
// this is just a cheap hack to not do indexOf twice
|
|
1046
|
+
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
|
|
1047
|
+
|
|
1048
|
+
// base64 is 4/3 + up to two characters of the original data
|
|
1049
|
+
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
1050
|
+
|
|
1051
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
|
1052
|
+
l = placeHolders > 0 ? len - 4 : len;
|
|
1053
|
+
|
|
1054
|
+
var L = 0;
|
|
1055
|
+
|
|
1056
|
+
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
1057
|
+
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
|
|
1058
|
+
arr[L++] = (tmp >> 16) & 0xFF;
|
|
1059
|
+
arr[L++] = (tmp >> 8) & 0xFF;
|
|
1060
|
+
arr[L++] = tmp & 0xFF;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
if (placeHolders === 2) {
|
|
1064
|
+
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
|
|
1065
|
+
arr[L++] = tmp & 0xFF;
|
|
1066
|
+
} else if (placeHolders === 1) {
|
|
1067
|
+
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
|
|
1068
|
+
arr[L++] = (tmp >> 8) & 0xFF;
|
|
1069
|
+
arr[L++] = tmp & 0xFF;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
return arr
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
function tripletToBase64 (num) {
|
|
1076
|
+
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
function encodeChunk (uint8, start, end) {
|
|
1080
|
+
var tmp;
|
|
1081
|
+
var output = [];
|
|
1082
|
+
for (var i = start; i < end; i += 3) {
|
|
1083
|
+
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
|
|
1084
|
+
output.push(tripletToBase64(tmp));
|
|
1085
|
+
}
|
|
1086
|
+
return output.join('')
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
function fromByteArray (uint8) {
|
|
1090
|
+
if (!inited) {
|
|
1091
|
+
init();
|
|
1092
|
+
}
|
|
1093
|
+
var tmp;
|
|
1094
|
+
var len = uint8.length;
|
|
1095
|
+
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
1096
|
+
var output = '';
|
|
1097
|
+
var parts = [];
|
|
1098
|
+
var maxChunkLength = 16383; // must be multiple of 3
|
|
1099
|
+
|
|
1100
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
1101
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
1102
|
+
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
1106
|
+
if (extraBytes === 1) {
|
|
1107
|
+
tmp = uint8[len - 1];
|
|
1108
|
+
output += lookup[tmp >> 2];
|
|
1109
|
+
output += lookup[(tmp << 4) & 0x3F];
|
|
1110
|
+
output += '==';
|
|
1111
|
+
} else if (extraBytes === 2) {
|
|
1112
|
+
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
|
|
1113
|
+
output += lookup[tmp >> 10];
|
|
1114
|
+
output += lookup[(tmp >> 4) & 0x3F];
|
|
1115
|
+
output += lookup[(tmp << 2) & 0x3F];
|
|
1116
|
+
output += '=';
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
parts.push(output);
|
|
1120
|
+
|
|
1121
|
+
return parts.join('')
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
function read (buffer, offset, isLE, mLen, nBytes) {
|
|
1125
|
+
var e, m;
|
|
1126
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
1127
|
+
var eMax = (1 << eLen) - 1;
|
|
1128
|
+
var eBias = eMax >> 1;
|
|
1129
|
+
var nBits = -7;
|
|
1130
|
+
var i = isLE ? (nBytes - 1) : 0;
|
|
1131
|
+
var d = isLE ? -1 : 1;
|
|
1132
|
+
var s = buffer[offset + i];
|
|
1133
|
+
|
|
1134
|
+
i += d;
|
|
1135
|
+
|
|
1136
|
+
e = s & ((1 << (-nBits)) - 1);
|
|
1137
|
+
s >>= (-nBits);
|
|
1138
|
+
nBits += eLen;
|
|
1139
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
1140
|
+
|
|
1141
|
+
m = e & ((1 << (-nBits)) - 1);
|
|
1142
|
+
e >>= (-nBits);
|
|
1143
|
+
nBits += mLen;
|
|
1144
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
1145
|
+
|
|
1146
|
+
if (e === 0) {
|
|
1147
|
+
e = 1 - eBias;
|
|
1148
|
+
} else if (e === eMax) {
|
|
1149
|
+
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
1150
|
+
} else {
|
|
1151
|
+
m = m + Math.pow(2, mLen);
|
|
1152
|
+
e = e - eBias;
|
|
1153
|
+
}
|
|
1154
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
function write (buffer, value, offset, isLE, mLen, nBytes) {
|
|
1158
|
+
var e, m, c;
|
|
1159
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
1160
|
+
var eMax = (1 << eLen) - 1;
|
|
1161
|
+
var eBias = eMax >> 1;
|
|
1162
|
+
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
|
|
1163
|
+
var i = isLE ? 0 : (nBytes - 1);
|
|
1164
|
+
var d = isLE ? 1 : -1;
|
|
1165
|
+
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
|
|
1166
|
+
|
|
1167
|
+
value = Math.abs(value);
|
|
1168
|
+
|
|
1169
|
+
if (isNaN(value) || value === Infinity) {
|
|
1170
|
+
m = isNaN(value) ? 1 : 0;
|
|
1171
|
+
e = eMax;
|
|
1172
|
+
} else {
|
|
1173
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
1174
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
1175
|
+
e--;
|
|
1176
|
+
c *= 2;
|
|
1177
|
+
}
|
|
1178
|
+
if (e + eBias >= 1) {
|
|
1179
|
+
value += rt / c;
|
|
1180
|
+
} else {
|
|
1181
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
1182
|
+
}
|
|
1183
|
+
if (value * c >= 2) {
|
|
1184
|
+
e++;
|
|
1185
|
+
c /= 2;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
if (e + eBias >= eMax) {
|
|
1189
|
+
m = 0;
|
|
1190
|
+
e = eMax;
|
|
1191
|
+
} else if (e + eBias >= 1) {
|
|
1192
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
1193
|
+
e = e + eBias;
|
|
1194
|
+
} else {
|
|
1195
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
1196
|
+
e = 0;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
1201
|
+
|
|
1202
|
+
e = (e << mLen) | m;
|
|
1203
|
+
eLen += mLen;
|
|
1204
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
1205
|
+
|
|
1206
|
+
buffer[offset + i - d] |= s * 128;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
var toString = {}.toString;
|
|
1210
|
+
|
|
1211
|
+
var isArray$4 = Array.isArray || function (arr) {
|
|
1212
|
+
return toString.call(arr) == '[object Array]';
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1215
|
+
/*!
|
|
1216
|
+
* The buffer module from node.js, for the browser.
|
|
1217
|
+
*
|
|
1218
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
1219
|
+
* @license MIT
|
|
1220
|
+
*/
|
|
1221
|
+
|
|
1222
|
+
var INSPECT_MAX_BYTES = 50;
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
1226
|
+
* === true Use Uint8Array implementation (fastest)
|
|
1227
|
+
* === false Use Object implementation (most compatible, even IE6)
|
|
1228
|
+
*
|
|
1229
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
1230
|
+
* Opera 11.6+, iOS 4.2+.
|
|
1231
|
+
*
|
|
1232
|
+
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
1233
|
+
* when the browser supports typed arrays.
|
|
1234
|
+
*
|
|
1235
|
+
* Note:
|
|
1236
|
+
*
|
|
1237
|
+
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
1238
|
+
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
1239
|
+
*
|
|
1240
|
+
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
1241
|
+
*
|
|
1242
|
+
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
1243
|
+
* incorrect length in some situations.
|
|
1244
|
+
|
|
1245
|
+
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
1246
|
+
* get the Object implementation, which is slower but behaves correctly.
|
|
1247
|
+
*/
|
|
1248
|
+
Buffer$1.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
|
|
1249
|
+
? global$1.TYPED_ARRAY_SUPPORT
|
|
1250
|
+
: true;
|
|
1251
|
+
|
|
1252
|
+
/*
|
|
1253
|
+
* Export kMaxLength after typed array support is determined.
|
|
1254
|
+
*/
|
|
1255
|
+
kMaxLength();
|
|
1256
|
+
|
|
1257
|
+
function kMaxLength () {
|
|
1258
|
+
return Buffer$1.TYPED_ARRAY_SUPPORT
|
|
1259
|
+
? 0x7fffffff
|
|
1260
|
+
: 0x3fffffff
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
function createBuffer (that, length) {
|
|
1264
|
+
if (kMaxLength() < length) {
|
|
1265
|
+
throw new RangeError('Invalid typed array length')
|
|
1266
|
+
}
|
|
1267
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
1268
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
|
1269
|
+
that = new Uint8Array(length);
|
|
1270
|
+
that.__proto__ = Buffer$1.prototype;
|
|
1271
|
+
} else {
|
|
1272
|
+
// Fallback: Return an object instance of the Buffer class
|
|
1273
|
+
if (that === null) {
|
|
1274
|
+
that = new Buffer$1(length);
|
|
1275
|
+
}
|
|
1276
|
+
that.length = length;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
return that
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
1284
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
1285
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
1286
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
1287
|
+
* returns a single octet.
|
|
1288
|
+
*
|
|
1289
|
+
* The `Uint8Array` prototype remains unmodified.
|
|
1290
|
+
*/
|
|
1291
|
+
|
|
1292
|
+
function Buffer$1 (arg, encodingOrOffset, length) {
|
|
1293
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$1)) {
|
|
1294
|
+
return new Buffer$1(arg, encodingOrOffset, length)
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
// Common case.
|
|
1298
|
+
if (typeof arg === 'number') {
|
|
1299
|
+
if (typeof encodingOrOffset === 'string') {
|
|
1300
|
+
throw new Error(
|
|
1301
|
+
'If encoding is specified then the first argument must be a string'
|
|
1302
|
+
)
|
|
1303
|
+
}
|
|
1304
|
+
return allocUnsafe(this, arg)
|
|
1305
|
+
}
|
|
1306
|
+
return from(this, arg, encodingOrOffset, length)
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
Buffer$1.poolSize = 8192; // not used by this implementation
|
|
1310
|
+
|
|
1311
|
+
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
1312
|
+
Buffer$1._augment = function (arr) {
|
|
1313
|
+
arr.__proto__ = Buffer$1.prototype;
|
|
1314
|
+
return arr
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
function from (that, value, encodingOrOffset, length) {
|
|
1318
|
+
if (typeof value === 'number') {
|
|
1319
|
+
throw new TypeError('"value" argument must not be a number')
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
1323
|
+
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
if (typeof value === 'string') {
|
|
1327
|
+
return fromString(that, value, encodingOrOffset)
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
return fromObject(that, value)
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
1335
|
+
* if value is a number.
|
|
1336
|
+
* Buffer.from(str[, encoding])
|
|
1337
|
+
* Buffer.from(array)
|
|
1338
|
+
* Buffer.from(buffer)
|
|
1339
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
1340
|
+
**/
|
|
1341
|
+
Buffer$1.from = function (value, encodingOrOffset, length) {
|
|
1342
|
+
return from(null, value, encodingOrOffset, length)
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
1346
|
+
Buffer$1.prototype.__proto__ = Uint8Array.prototype;
|
|
1347
|
+
Buffer$1.__proto__ = Uint8Array;
|
|
1348
|
+
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
1349
|
+
Buffer$1[Symbol.species] === Buffer$1) ;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
function assertSize (size) {
|
|
1353
|
+
if (typeof size !== 'number') {
|
|
1354
|
+
throw new TypeError('"size" argument must be a number')
|
|
1355
|
+
} else if (size < 0) {
|
|
1356
|
+
throw new RangeError('"size" argument must not be negative')
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
function alloc (that, size, fill, encoding) {
|
|
1361
|
+
assertSize(size);
|
|
1362
|
+
if (size <= 0) {
|
|
1363
|
+
return createBuffer(that, size)
|
|
1364
|
+
}
|
|
1365
|
+
if (fill !== undefined) {
|
|
1366
|
+
// Only pay attention to encoding if it's a string. This
|
|
1367
|
+
// prevents accidentally sending in a number that would
|
|
1368
|
+
// be interpretted as a start offset.
|
|
1369
|
+
return typeof encoding === 'string'
|
|
1370
|
+
? createBuffer(that, size).fill(fill, encoding)
|
|
1371
|
+
: createBuffer(that, size).fill(fill)
|
|
1372
|
+
}
|
|
1373
|
+
return createBuffer(that, size)
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Creates a new filled Buffer instance.
|
|
1378
|
+
* alloc(size[, fill[, encoding]])
|
|
1379
|
+
**/
|
|
1380
|
+
Buffer$1.alloc = function (size, fill, encoding) {
|
|
1381
|
+
return alloc(null, size, fill, encoding)
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
function allocUnsafe (that, size) {
|
|
1385
|
+
assertSize(size);
|
|
1386
|
+
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
|
|
1387
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
1388
|
+
for (var i = 0; i < size; ++i) {
|
|
1389
|
+
that[i] = 0;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return that
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
1397
|
+
* */
|
|
1398
|
+
Buffer$1.allocUnsafe = function (size) {
|
|
1399
|
+
return allocUnsafe(null, size)
|
|
1400
|
+
};
|
|
1401
|
+
/**
|
|
1402
|
+
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
1403
|
+
*/
|
|
1404
|
+
Buffer$1.allocUnsafeSlow = function (size) {
|
|
1405
|
+
return allocUnsafe(null, size)
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
function fromString (that, string, encoding) {
|
|
1409
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
|
1410
|
+
encoding = 'utf8';
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
if (!Buffer$1.isEncoding(encoding)) {
|
|
1414
|
+
throw new TypeError('"encoding" must be a valid string encoding')
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
var length = byteLength(string, encoding) | 0;
|
|
1418
|
+
that = createBuffer(that, length);
|
|
1419
|
+
|
|
1420
|
+
var actual = that.write(string, encoding);
|
|
1421
|
+
|
|
1422
|
+
if (actual !== length) {
|
|
1423
|
+
// Writing a hex string, for example, that contains invalid characters will
|
|
1424
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
|
1425
|
+
// 'abxxcd' will be treated as 'ab')
|
|
1426
|
+
that = that.slice(0, actual);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
return that
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
function fromArrayLike (that, array) {
|
|
1433
|
+
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
1434
|
+
that = createBuffer(that, length);
|
|
1435
|
+
for (var i = 0; i < length; i += 1) {
|
|
1436
|
+
that[i] = array[i] & 255;
|
|
1437
|
+
}
|
|
1438
|
+
return that
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
1442
|
+
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
|
|
1443
|
+
|
|
1444
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
1445
|
+
throw new RangeError('\'offset\' is out of bounds')
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
1449
|
+
throw new RangeError('\'length\' is out of bounds')
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
if (byteOffset === undefined && length === undefined) {
|
|
1453
|
+
array = new Uint8Array(array);
|
|
1454
|
+
} else if (length === undefined) {
|
|
1455
|
+
array = new Uint8Array(array, byteOffset);
|
|
1456
|
+
} else {
|
|
1457
|
+
array = new Uint8Array(array, byteOffset, length);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
1461
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
|
1462
|
+
that = array;
|
|
1463
|
+
that.__proto__ = Buffer$1.prototype;
|
|
1464
|
+
} else {
|
|
1465
|
+
// Fallback: Return an object instance of the Buffer class
|
|
1466
|
+
that = fromArrayLike(that, array);
|
|
1467
|
+
}
|
|
1468
|
+
return that
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
function fromObject (that, obj) {
|
|
1472
|
+
if (internalIsBuffer(obj)) {
|
|
1473
|
+
var len = checked(obj.length) | 0;
|
|
1474
|
+
that = createBuffer(that, len);
|
|
1475
|
+
|
|
1476
|
+
if (that.length === 0) {
|
|
1477
|
+
return that
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
obj.copy(that, 0, 0, len);
|
|
1481
|
+
return that
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
if (obj) {
|
|
1485
|
+
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
1486
|
+
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
1487
|
+
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
1488
|
+
return createBuffer(that, 0)
|
|
1489
|
+
}
|
|
1490
|
+
return fromArrayLike(that, obj)
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
if (obj.type === 'Buffer' && isArray$4(obj.data)) {
|
|
1494
|
+
return fromArrayLike(that, obj.data)
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
function checked (length) {
|
|
1502
|
+
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
1503
|
+
// length is NaN (which is otherwise coerced to zero.)
|
|
1504
|
+
if (length >= kMaxLength()) {
|
|
1505
|
+
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
1506
|
+
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
|
1507
|
+
}
|
|
1508
|
+
return length | 0
|
|
1509
|
+
}
|
|
1510
|
+
Buffer$1.isBuffer = isBuffer$2;
|
|
1511
|
+
function internalIsBuffer (b) {
|
|
1512
|
+
return !!(b != null && b._isBuffer)
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
Buffer$1.compare = function compare (a, b) {
|
|
1516
|
+
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
1517
|
+
throw new TypeError('Arguments must be Buffers')
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
if (a === b) return 0
|
|
1521
|
+
|
|
1522
|
+
var x = a.length;
|
|
1523
|
+
var y = b.length;
|
|
1524
|
+
|
|
1525
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
1526
|
+
if (a[i] !== b[i]) {
|
|
1527
|
+
x = a[i];
|
|
1528
|
+
y = b[i];
|
|
1529
|
+
break
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
if (x < y) return -1
|
|
1534
|
+
if (y < x) return 1
|
|
1535
|
+
return 0
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
Buffer$1.isEncoding = function isEncoding (encoding) {
|
|
1539
|
+
switch (String(encoding).toLowerCase()) {
|
|
1540
|
+
case 'hex':
|
|
1541
|
+
case 'utf8':
|
|
1542
|
+
case 'utf-8':
|
|
1543
|
+
case 'ascii':
|
|
1544
|
+
case 'latin1':
|
|
1545
|
+
case 'binary':
|
|
1546
|
+
case 'base64':
|
|
1547
|
+
case 'ucs2':
|
|
1548
|
+
case 'ucs-2':
|
|
1549
|
+
case 'utf16le':
|
|
1550
|
+
case 'utf-16le':
|
|
1551
|
+
return true
|
|
1552
|
+
default:
|
|
1553
|
+
return false
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
Buffer$1.concat = function concat (list, length) {
|
|
1558
|
+
if (!isArray$4(list)) {
|
|
1559
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
if (list.length === 0) {
|
|
1563
|
+
return Buffer$1.alloc(0)
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
var i;
|
|
1567
|
+
if (length === undefined) {
|
|
1568
|
+
length = 0;
|
|
1569
|
+
for (i = 0; i < list.length; ++i) {
|
|
1570
|
+
length += list[i].length;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
var buffer = Buffer$1.allocUnsafe(length);
|
|
1575
|
+
var pos = 0;
|
|
1576
|
+
for (i = 0; i < list.length; ++i) {
|
|
1577
|
+
var buf = list[i];
|
|
1578
|
+
if (!internalIsBuffer(buf)) {
|
|
1579
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
1580
|
+
}
|
|
1581
|
+
buf.copy(buffer, pos);
|
|
1582
|
+
pos += buf.length;
|
|
1583
|
+
}
|
|
1584
|
+
return buffer
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
function byteLength (string, encoding) {
|
|
1588
|
+
if (internalIsBuffer(string)) {
|
|
1589
|
+
return string.length
|
|
1590
|
+
}
|
|
1591
|
+
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
1592
|
+
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
1593
|
+
return string.byteLength
|
|
1594
|
+
}
|
|
1595
|
+
if (typeof string !== 'string') {
|
|
1596
|
+
string = '' + string;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
var len = string.length;
|
|
1600
|
+
if (len === 0) return 0
|
|
1601
|
+
|
|
1602
|
+
// Use a for loop to avoid recursion
|
|
1603
|
+
var loweredCase = false;
|
|
1604
|
+
for (;;) {
|
|
1605
|
+
switch (encoding) {
|
|
1606
|
+
case 'ascii':
|
|
1607
|
+
case 'latin1':
|
|
1608
|
+
case 'binary':
|
|
1609
|
+
return len
|
|
1610
|
+
case 'utf8':
|
|
1611
|
+
case 'utf-8':
|
|
1612
|
+
case undefined:
|
|
1613
|
+
return utf8ToBytes(string).length
|
|
1614
|
+
case 'ucs2':
|
|
1615
|
+
case 'ucs-2':
|
|
1616
|
+
case 'utf16le':
|
|
1617
|
+
case 'utf-16le':
|
|
1618
|
+
return len * 2
|
|
1619
|
+
case 'hex':
|
|
1620
|
+
return len >>> 1
|
|
1621
|
+
case 'base64':
|
|
1622
|
+
return base64ToBytes(string).length
|
|
1623
|
+
default:
|
|
1624
|
+
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
|
1625
|
+
encoding = ('' + encoding).toLowerCase();
|
|
1626
|
+
loweredCase = true;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
Buffer$1.byteLength = byteLength;
|
|
1631
|
+
|
|
1632
|
+
function slowToString (encoding, start, end) {
|
|
1633
|
+
var loweredCase = false;
|
|
1634
|
+
|
|
1635
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
1636
|
+
// property of a typed array.
|
|
1637
|
+
|
|
1638
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
1639
|
+
// to their upper/lower bounds if the value passed is out of range.
|
|
1640
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
1641
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
1642
|
+
if (start === undefined || start < 0) {
|
|
1643
|
+
start = 0;
|
|
1644
|
+
}
|
|
1645
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
|
1646
|
+
// coercion fail below.
|
|
1647
|
+
if (start > this.length) {
|
|
1648
|
+
return ''
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
if (end === undefined || end > this.length) {
|
|
1652
|
+
end = this.length;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
if (end <= 0) {
|
|
1656
|
+
return ''
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
1660
|
+
end >>>= 0;
|
|
1661
|
+
start >>>= 0;
|
|
1662
|
+
|
|
1663
|
+
if (end <= start) {
|
|
1664
|
+
return ''
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
if (!encoding) encoding = 'utf8';
|
|
1668
|
+
|
|
1669
|
+
while (true) {
|
|
1670
|
+
switch (encoding) {
|
|
1671
|
+
case 'hex':
|
|
1672
|
+
return hexSlice(this, start, end)
|
|
1673
|
+
|
|
1674
|
+
case 'utf8':
|
|
1675
|
+
case 'utf-8':
|
|
1676
|
+
return utf8Slice(this, start, end)
|
|
1677
|
+
|
|
1678
|
+
case 'ascii':
|
|
1679
|
+
return asciiSlice(this, start, end)
|
|
1680
|
+
|
|
1681
|
+
case 'latin1':
|
|
1682
|
+
case 'binary':
|
|
1683
|
+
return latin1Slice(this, start, end)
|
|
1684
|
+
|
|
1685
|
+
case 'base64':
|
|
1686
|
+
return base64Slice(this, start, end)
|
|
1687
|
+
|
|
1688
|
+
case 'ucs2':
|
|
1689
|
+
case 'ucs-2':
|
|
1690
|
+
case 'utf16le':
|
|
1691
|
+
case 'utf-16le':
|
|
1692
|
+
return utf16leSlice(this, start, end)
|
|
1693
|
+
|
|
1694
|
+
default:
|
|
1695
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
1696
|
+
encoding = (encoding + '').toLowerCase();
|
|
1697
|
+
loweredCase = true;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
1703
|
+
// Buffer instances.
|
|
1704
|
+
Buffer$1.prototype._isBuffer = true;
|
|
1705
|
+
|
|
1706
|
+
function swap (b, n, m) {
|
|
1707
|
+
var i = b[n];
|
|
1708
|
+
b[n] = b[m];
|
|
1709
|
+
b[m] = i;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
Buffer$1.prototype.swap16 = function swap16 () {
|
|
1713
|
+
var len = this.length;
|
|
1714
|
+
if (len % 2 !== 0) {
|
|
1715
|
+
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
1716
|
+
}
|
|
1717
|
+
for (var i = 0; i < len; i += 2) {
|
|
1718
|
+
swap(this, i, i + 1);
|
|
1719
|
+
}
|
|
1720
|
+
return this
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
Buffer$1.prototype.swap32 = function swap32 () {
|
|
1724
|
+
var len = this.length;
|
|
1725
|
+
if (len % 4 !== 0) {
|
|
1726
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
1727
|
+
}
|
|
1728
|
+
for (var i = 0; i < len; i += 4) {
|
|
1729
|
+
swap(this, i, i + 3);
|
|
1730
|
+
swap(this, i + 1, i + 2);
|
|
1731
|
+
}
|
|
1732
|
+
return this
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
Buffer$1.prototype.swap64 = function swap64 () {
|
|
1736
|
+
var len = this.length;
|
|
1737
|
+
if (len % 8 !== 0) {
|
|
1738
|
+
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
1739
|
+
}
|
|
1740
|
+
for (var i = 0; i < len; i += 8) {
|
|
1741
|
+
swap(this, i, i + 7);
|
|
1742
|
+
swap(this, i + 1, i + 6);
|
|
1743
|
+
swap(this, i + 2, i + 5);
|
|
1744
|
+
swap(this, i + 3, i + 4);
|
|
1745
|
+
}
|
|
1746
|
+
return this
|
|
1747
|
+
};
|
|
1748
|
+
|
|
1749
|
+
Buffer$1.prototype.toString = function toString () {
|
|
1750
|
+
var length = this.length | 0;
|
|
1751
|
+
if (length === 0) return ''
|
|
1752
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
1753
|
+
return slowToString.apply(this, arguments)
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
Buffer$1.prototype.equals = function equals (b) {
|
|
1757
|
+
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
1758
|
+
if (this === b) return true
|
|
1759
|
+
return Buffer$1.compare(this, b) === 0
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1762
|
+
Buffer$1.prototype.inspect = function inspect () {
|
|
1763
|
+
var str = '';
|
|
1764
|
+
var max = INSPECT_MAX_BYTES;
|
|
1765
|
+
if (this.length > 0) {
|
|
1766
|
+
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
|
|
1767
|
+
if (this.length > max) str += ' ... ';
|
|
1768
|
+
}
|
|
1769
|
+
return '<Buffer ' + str + '>'
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
Buffer$1.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
1773
|
+
if (!internalIsBuffer(target)) {
|
|
1774
|
+
throw new TypeError('Argument must be a Buffer')
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
if (start === undefined) {
|
|
1778
|
+
start = 0;
|
|
1779
|
+
}
|
|
1780
|
+
if (end === undefined) {
|
|
1781
|
+
end = target ? target.length : 0;
|
|
1782
|
+
}
|
|
1783
|
+
if (thisStart === undefined) {
|
|
1784
|
+
thisStart = 0;
|
|
1785
|
+
}
|
|
1786
|
+
if (thisEnd === undefined) {
|
|
1787
|
+
thisEnd = this.length;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
1791
|
+
throw new RangeError('out of range index')
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
1795
|
+
return 0
|
|
1796
|
+
}
|
|
1797
|
+
if (thisStart >= thisEnd) {
|
|
1798
|
+
return -1
|
|
1799
|
+
}
|
|
1800
|
+
if (start >= end) {
|
|
1801
|
+
return 1
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
start >>>= 0;
|
|
1805
|
+
end >>>= 0;
|
|
1806
|
+
thisStart >>>= 0;
|
|
1807
|
+
thisEnd >>>= 0;
|
|
1808
|
+
|
|
1809
|
+
if (this === target) return 0
|
|
1810
|
+
|
|
1811
|
+
var x = thisEnd - thisStart;
|
|
1812
|
+
var y = end - start;
|
|
1813
|
+
var len = Math.min(x, y);
|
|
1814
|
+
|
|
1815
|
+
var thisCopy = this.slice(thisStart, thisEnd);
|
|
1816
|
+
var targetCopy = target.slice(start, end);
|
|
1817
|
+
|
|
1818
|
+
for (var i = 0; i < len; ++i) {
|
|
1819
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
1820
|
+
x = thisCopy[i];
|
|
1821
|
+
y = targetCopy[i];
|
|
1822
|
+
break
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
if (x < y) return -1
|
|
1827
|
+
if (y < x) return 1
|
|
1828
|
+
return 0
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
1832
|
+
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
1833
|
+
//
|
|
1834
|
+
// Arguments:
|
|
1835
|
+
// - buffer - a Buffer to search
|
|
1836
|
+
// - val - a string, Buffer, or number
|
|
1837
|
+
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
1838
|
+
// - encoding - an optional encoding, relevant is val is a string
|
|
1839
|
+
// - dir - true for indexOf, false for lastIndexOf
|
|
1840
|
+
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
1841
|
+
// Empty buffer means no match
|
|
1842
|
+
if (buffer.length === 0) return -1
|
|
1843
|
+
|
|
1844
|
+
// Normalize byteOffset
|
|
1845
|
+
if (typeof byteOffset === 'string') {
|
|
1846
|
+
encoding = byteOffset;
|
|
1847
|
+
byteOffset = 0;
|
|
1848
|
+
} else if (byteOffset > 0x7fffffff) {
|
|
1849
|
+
byteOffset = 0x7fffffff;
|
|
1850
|
+
} else if (byteOffset < -0x80000000) {
|
|
1851
|
+
byteOffset = -0x80000000;
|
|
1852
|
+
}
|
|
1853
|
+
byteOffset = +byteOffset; // Coerce to Number.
|
|
1854
|
+
if (isNaN(byteOffset)) {
|
|
1855
|
+
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
1856
|
+
byteOffset = dir ? 0 : (buffer.length - 1);
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
1860
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1861
|
+
if (byteOffset >= buffer.length) {
|
|
1862
|
+
if (dir) return -1
|
|
1863
|
+
else byteOffset = buffer.length - 1;
|
|
1864
|
+
} else if (byteOffset < 0) {
|
|
1865
|
+
if (dir) byteOffset = 0;
|
|
1866
|
+
else return -1
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
// Normalize val
|
|
1870
|
+
if (typeof val === 'string') {
|
|
1871
|
+
val = Buffer$1.from(val, encoding);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
1875
|
+
if (internalIsBuffer(val)) {
|
|
1876
|
+
// Special case: looking for empty string/buffer always fails
|
|
1877
|
+
if (val.length === 0) {
|
|
1878
|
+
return -1
|
|
1879
|
+
}
|
|
1880
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
1881
|
+
} else if (typeof val === 'number') {
|
|
1882
|
+
val = val & 0xFF; // Search for a byte value [0-255]
|
|
1883
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT &&
|
|
1884
|
+
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
1885
|
+
if (dir) {
|
|
1886
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
1887
|
+
} else {
|
|
1888
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
throw new TypeError('val must be string, number or Buffer')
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
1898
|
+
var indexSize = 1;
|
|
1899
|
+
var arrLength = arr.length;
|
|
1900
|
+
var valLength = val.length;
|
|
1901
|
+
|
|
1902
|
+
if (encoding !== undefined) {
|
|
1903
|
+
encoding = String(encoding).toLowerCase();
|
|
1904
|
+
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
1905
|
+
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
1906
|
+
if (arr.length < 2 || val.length < 2) {
|
|
1907
|
+
return -1
|
|
1908
|
+
}
|
|
1909
|
+
indexSize = 2;
|
|
1910
|
+
arrLength /= 2;
|
|
1911
|
+
valLength /= 2;
|
|
1912
|
+
byteOffset /= 2;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
function read (buf, i) {
|
|
1917
|
+
if (indexSize === 1) {
|
|
1918
|
+
return buf[i]
|
|
1919
|
+
} else {
|
|
1920
|
+
return buf.readUInt16BE(i * indexSize)
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
var i;
|
|
1925
|
+
if (dir) {
|
|
1926
|
+
var foundIndex = -1;
|
|
1927
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
1928
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1929
|
+
if (foundIndex === -1) foundIndex = i;
|
|
1930
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
1931
|
+
} else {
|
|
1932
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
1933
|
+
foundIndex = -1;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
} else {
|
|
1937
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
1938
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
1939
|
+
var found = true;
|
|
1940
|
+
for (var j = 0; j < valLength; j++) {
|
|
1941
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
1942
|
+
found = false;
|
|
1943
|
+
break
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
if (found) return i
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
return -1
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
Buffer$1.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
1954
|
+
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
1955
|
+
};
|
|
1956
|
+
|
|
1957
|
+
Buffer$1.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
1958
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1961
|
+
Buffer$1.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
1962
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
1963
|
+
};
|
|
1964
|
+
|
|
1965
|
+
function hexWrite (buf, string, offset, length) {
|
|
1966
|
+
offset = Number(offset) || 0;
|
|
1967
|
+
var remaining = buf.length - offset;
|
|
1968
|
+
if (!length) {
|
|
1969
|
+
length = remaining;
|
|
1970
|
+
} else {
|
|
1971
|
+
length = Number(length);
|
|
1972
|
+
if (length > remaining) {
|
|
1973
|
+
length = remaining;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
// must be an even number of digits
|
|
1978
|
+
var strLen = string.length;
|
|
1979
|
+
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
|
1980
|
+
|
|
1981
|
+
if (length > strLen / 2) {
|
|
1982
|
+
length = strLen / 2;
|
|
1983
|
+
}
|
|
1984
|
+
for (var i = 0; i < length; ++i) {
|
|
1985
|
+
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1986
|
+
if (isNaN(parsed)) return i
|
|
1987
|
+
buf[offset + i] = parsed;
|
|
1988
|
+
}
|
|
1989
|
+
return i
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
function utf8Write (buf, string, offset, length) {
|
|
1993
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
function asciiWrite (buf, string, offset, length) {
|
|
1997
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
function latin1Write (buf, string, offset, length) {
|
|
2001
|
+
return asciiWrite(buf, string, offset, length)
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
function base64Write (buf, string, offset, length) {
|
|
2005
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
function ucs2Write (buf, string, offset, length) {
|
|
2009
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
Buffer$1.prototype.write = function write (string, offset, length, encoding) {
|
|
2013
|
+
// Buffer#write(string)
|
|
2014
|
+
if (offset === undefined) {
|
|
2015
|
+
encoding = 'utf8';
|
|
2016
|
+
length = this.length;
|
|
2017
|
+
offset = 0;
|
|
2018
|
+
// Buffer#write(string, encoding)
|
|
2019
|
+
} else if (length === undefined && typeof offset === 'string') {
|
|
2020
|
+
encoding = offset;
|
|
2021
|
+
length = this.length;
|
|
2022
|
+
offset = 0;
|
|
2023
|
+
// Buffer#write(string, offset[, length][, encoding])
|
|
2024
|
+
} else if (isFinite(offset)) {
|
|
2025
|
+
offset = offset | 0;
|
|
2026
|
+
if (isFinite(length)) {
|
|
2027
|
+
length = length | 0;
|
|
2028
|
+
if (encoding === undefined) encoding = 'utf8';
|
|
2029
|
+
} else {
|
|
2030
|
+
encoding = length;
|
|
2031
|
+
length = undefined;
|
|
2032
|
+
}
|
|
2033
|
+
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
2034
|
+
} else {
|
|
2035
|
+
throw new Error(
|
|
2036
|
+
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
2037
|
+
)
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
var remaining = this.length - offset;
|
|
2041
|
+
if (length === undefined || length > remaining) length = remaining;
|
|
2042
|
+
|
|
2043
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
2044
|
+
throw new RangeError('Attempt to write outside buffer bounds')
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
if (!encoding) encoding = 'utf8';
|
|
2048
|
+
|
|
2049
|
+
var loweredCase = false;
|
|
2050
|
+
for (;;) {
|
|
2051
|
+
switch (encoding) {
|
|
2052
|
+
case 'hex':
|
|
2053
|
+
return hexWrite(this, string, offset, length)
|
|
2054
|
+
|
|
2055
|
+
case 'utf8':
|
|
2056
|
+
case 'utf-8':
|
|
2057
|
+
return utf8Write(this, string, offset, length)
|
|
2058
|
+
|
|
2059
|
+
case 'ascii':
|
|
2060
|
+
return asciiWrite(this, string, offset, length)
|
|
2061
|
+
|
|
2062
|
+
case 'latin1':
|
|
2063
|
+
case 'binary':
|
|
2064
|
+
return latin1Write(this, string, offset, length)
|
|
2065
|
+
|
|
2066
|
+
case 'base64':
|
|
2067
|
+
// Warning: maxLength not taken into account in base64Write
|
|
2068
|
+
return base64Write(this, string, offset, length)
|
|
2069
|
+
|
|
2070
|
+
case 'ucs2':
|
|
2071
|
+
case 'ucs-2':
|
|
2072
|
+
case 'utf16le':
|
|
2073
|
+
case 'utf-16le':
|
|
2074
|
+
return ucs2Write(this, string, offset, length)
|
|
2075
|
+
|
|
2076
|
+
default:
|
|
2077
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
2078
|
+
encoding = ('' + encoding).toLowerCase();
|
|
2079
|
+
loweredCase = true;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
Buffer$1.prototype.toJSON = function toJSON () {
|
|
2085
|
+
return {
|
|
2086
|
+
type: 'Buffer',
|
|
2087
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
|
|
2091
|
+
function base64Slice (buf, start, end) {
|
|
2092
|
+
if (start === 0 && end === buf.length) {
|
|
2093
|
+
return fromByteArray(buf)
|
|
2094
|
+
} else {
|
|
2095
|
+
return fromByteArray(buf.slice(start, end))
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
function utf8Slice (buf, start, end) {
|
|
2100
|
+
end = Math.min(buf.length, end);
|
|
2101
|
+
var res = [];
|
|
2102
|
+
|
|
2103
|
+
var i = start;
|
|
2104
|
+
while (i < end) {
|
|
2105
|
+
var firstByte = buf[i];
|
|
2106
|
+
var codePoint = null;
|
|
2107
|
+
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
|
2108
|
+
: (firstByte > 0xDF) ? 3
|
|
2109
|
+
: (firstByte > 0xBF) ? 2
|
|
2110
|
+
: 1;
|
|
2111
|
+
|
|
2112
|
+
if (i + bytesPerSequence <= end) {
|
|
2113
|
+
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
2114
|
+
|
|
2115
|
+
switch (bytesPerSequence) {
|
|
2116
|
+
case 1:
|
|
2117
|
+
if (firstByte < 0x80) {
|
|
2118
|
+
codePoint = firstByte;
|
|
2119
|
+
}
|
|
2120
|
+
break
|
|
2121
|
+
case 2:
|
|
2122
|
+
secondByte = buf[i + 1];
|
|
2123
|
+
if ((secondByte & 0xC0) === 0x80) {
|
|
2124
|
+
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
|
|
2125
|
+
if (tempCodePoint > 0x7F) {
|
|
2126
|
+
codePoint = tempCodePoint;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
break
|
|
2130
|
+
case 3:
|
|
2131
|
+
secondByte = buf[i + 1];
|
|
2132
|
+
thirdByte = buf[i + 2];
|
|
2133
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
2134
|
+
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
|
|
2135
|
+
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
2136
|
+
codePoint = tempCodePoint;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
break
|
|
2140
|
+
case 4:
|
|
2141
|
+
secondByte = buf[i + 1];
|
|
2142
|
+
thirdByte = buf[i + 2];
|
|
2143
|
+
fourthByte = buf[i + 3];
|
|
2144
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
2145
|
+
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
|
|
2146
|
+
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
2147
|
+
codePoint = tempCodePoint;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
if (codePoint === null) {
|
|
2154
|
+
// we did not generate a valid codePoint so insert a
|
|
2155
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
|
2156
|
+
codePoint = 0xFFFD;
|
|
2157
|
+
bytesPerSequence = 1;
|
|
2158
|
+
} else if (codePoint > 0xFFFF) {
|
|
2159
|
+
// encode to utf16 (surrogate pair dance)
|
|
2160
|
+
codePoint -= 0x10000;
|
|
2161
|
+
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
2162
|
+
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
res.push(codePoint);
|
|
2166
|
+
i += bytesPerSequence;
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
return decodeCodePointsArray(res)
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
2173
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
|
2174
|
+
// We go 1 magnitude less, for safety
|
|
2175
|
+
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
2176
|
+
|
|
2177
|
+
function decodeCodePointsArray (codePoints) {
|
|
2178
|
+
var len = codePoints.length;
|
|
2179
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
2180
|
+
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
|
2184
|
+
var res = '';
|
|
2185
|
+
var i = 0;
|
|
2186
|
+
while (i < len) {
|
|
2187
|
+
res += String.fromCharCode.apply(
|
|
2188
|
+
String,
|
|
2189
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
2190
|
+
);
|
|
2191
|
+
}
|
|
2192
|
+
return res
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
function asciiSlice (buf, start, end) {
|
|
2196
|
+
var ret = '';
|
|
2197
|
+
end = Math.min(buf.length, end);
|
|
2198
|
+
|
|
2199
|
+
for (var i = start; i < end; ++i) {
|
|
2200
|
+
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
2201
|
+
}
|
|
2202
|
+
return ret
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
function latin1Slice (buf, start, end) {
|
|
2206
|
+
var ret = '';
|
|
2207
|
+
end = Math.min(buf.length, end);
|
|
2208
|
+
|
|
2209
|
+
for (var i = start; i < end; ++i) {
|
|
2210
|
+
ret += String.fromCharCode(buf[i]);
|
|
2211
|
+
}
|
|
2212
|
+
return ret
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
function hexSlice (buf, start, end) {
|
|
2216
|
+
var len = buf.length;
|
|
2217
|
+
|
|
2218
|
+
if (!start || start < 0) start = 0;
|
|
2219
|
+
if (!end || end < 0 || end > len) end = len;
|
|
2220
|
+
|
|
2221
|
+
var out = '';
|
|
2222
|
+
for (var i = start; i < end; ++i) {
|
|
2223
|
+
out += toHex(buf[i]);
|
|
2224
|
+
}
|
|
2225
|
+
return out
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
function utf16leSlice (buf, start, end) {
|
|
2229
|
+
var bytes = buf.slice(start, end);
|
|
2230
|
+
var res = '';
|
|
2231
|
+
for (var i = 0; i < bytes.length; i += 2) {
|
|
2232
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
2233
|
+
}
|
|
2234
|
+
return res
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
Buffer$1.prototype.slice = function slice (start, end) {
|
|
2238
|
+
var len = this.length;
|
|
2239
|
+
start = ~~start;
|
|
2240
|
+
end = end === undefined ? len : ~~end;
|
|
2241
|
+
|
|
2242
|
+
if (start < 0) {
|
|
2243
|
+
start += len;
|
|
2244
|
+
if (start < 0) start = 0;
|
|
2245
|
+
} else if (start > len) {
|
|
2246
|
+
start = len;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
if (end < 0) {
|
|
2250
|
+
end += len;
|
|
2251
|
+
if (end < 0) end = 0;
|
|
2252
|
+
} else if (end > len) {
|
|
2253
|
+
end = len;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
if (end < start) end = start;
|
|
2257
|
+
|
|
2258
|
+
var newBuf;
|
|
2259
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2260
|
+
newBuf = this.subarray(start, end);
|
|
2261
|
+
newBuf.__proto__ = Buffer$1.prototype;
|
|
2262
|
+
} else {
|
|
2263
|
+
var sliceLen = end - start;
|
|
2264
|
+
newBuf = new Buffer$1(sliceLen, undefined);
|
|
2265
|
+
for (var i = 0; i < sliceLen; ++i) {
|
|
2266
|
+
newBuf[i] = this[i + start];
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
return newBuf
|
|
2271
|
+
};
|
|
2272
|
+
|
|
2273
|
+
/*
|
|
2274
|
+
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
2275
|
+
*/
|
|
2276
|
+
function checkOffset (offset, ext, length) {
|
|
2277
|
+
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
2278
|
+
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
Buffer$1.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
2282
|
+
offset = offset | 0;
|
|
2283
|
+
byteLength = byteLength | 0;
|
|
2284
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
2285
|
+
|
|
2286
|
+
var val = this[offset];
|
|
2287
|
+
var mul = 1;
|
|
2288
|
+
var i = 0;
|
|
2289
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
2290
|
+
val += this[offset + i] * mul;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
return val
|
|
2294
|
+
};
|
|
2295
|
+
|
|
2296
|
+
Buffer$1.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
2297
|
+
offset = offset | 0;
|
|
2298
|
+
byteLength = byteLength | 0;
|
|
2299
|
+
if (!noAssert) {
|
|
2300
|
+
checkOffset(offset, byteLength, this.length);
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
var val = this[offset + --byteLength];
|
|
2304
|
+
var mul = 1;
|
|
2305
|
+
while (byteLength > 0 && (mul *= 0x100)) {
|
|
2306
|
+
val += this[offset + --byteLength] * mul;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
return val
|
|
2310
|
+
};
|
|
2311
|
+
|
|
2312
|
+
Buffer$1.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
2313
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
2314
|
+
return this[offset]
|
|
2315
|
+
};
|
|
2316
|
+
|
|
2317
|
+
Buffer$1.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
2318
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2319
|
+
return this[offset] | (this[offset + 1] << 8)
|
|
2320
|
+
};
|
|
2321
|
+
|
|
2322
|
+
Buffer$1.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
2323
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2324
|
+
return (this[offset] << 8) | this[offset + 1]
|
|
2325
|
+
};
|
|
2326
|
+
|
|
2327
|
+
Buffer$1.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
2328
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2329
|
+
|
|
2330
|
+
return ((this[offset]) |
|
|
2331
|
+
(this[offset + 1] << 8) |
|
|
2332
|
+
(this[offset + 2] << 16)) +
|
|
2333
|
+
(this[offset + 3] * 0x1000000)
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2336
|
+
Buffer$1.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
2337
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2338
|
+
|
|
2339
|
+
return (this[offset] * 0x1000000) +
|
|
2340
|
+
((this[offset + 1] << 16) |
|
|
2341
|
+
(this[offset + 2] << 8) |
|
|
2342
|
+
this[offset + 3])
|
|
2343
|
+
};
|
|
2344
|
+
|
|
2345
|
+
Buffer$1.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
2346
|
+
offset = offset | 0;
|
|
2347
|
+
byteLength = byteLength | 0;
|
|
2348
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
2349
|
+
|
|
2350
|
+
var val = this[offset];
|
|
2351
|
+
var mul = 1;
|
|
2352
|
+
var i = 0;
|
|
2353
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
2354
|
+
val += this[offset + i] * mul;
|
|
2355
|
+
}
|
|
2356
|
+
mul *= 0x80;
|
|
2357
|
+
|
|
2358
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
2359
|
+
|
|
2360
|
+
return val
|
|
2361
|
+
};
|
|
2362
|
+
|
|
2363
|
+
Buffer$1.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
2364
|
+
offset = offset | 0;
|
|
2365
|
+
byteLength = byteLength | 0;
|
|
2366
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
2367
|
+
|
|
2368
|
+
var i = byteLength;
|
|
2369
|
+
var mul = 1;
|
|
2370
|
+
var val = this[offset + --i];
|
|
2371
|
+
while (i > 0 && (mul *= 0x100)) {
|
|
2372
|
+
val += this[offset + --i] * mul;
|
|
2373
|
+
}
|
|
2374
|
+
mul *= 0x80;
|
|
2375
|
+
|
|
2376
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
2377
|
+
|
|
2378
|
+
return val
|
|
2379
|
+
};
|
|
2380
|
+
|
|
2381
|
+
Buffer$1.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
2382
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
2383
|
+
if (!(this[offset] & 0x80)) return (this[offset])
|
|
2384
|
+
return ((0xff - this[offset] + 1) * -1)
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2387
|
+
Buffer$1.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
2388
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2389
|
+
var val = this[offset] | (this[offset + 1] << 8);
|
|
2390
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
Buffer$1.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
2394
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2395
|
+
var val = this[offset + 1] | (this[offset] << 8);
|
|
2396
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
2397
|
+
};
|
|
2398
|
+
|
|
2399
|
+
Buffer$1.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
2400
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2401
|
+
|
|
2402
|
+
return (this[offset]) |
|
|
2403
|
+
(this[offset + 1] << 8) |
|
|
2404
|
+
(this[offset + 2] << 16) |
|
|
2405
|
+
(this[offset + 3] << 24)
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
Buffer$1.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
2409
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2410
|
+
|
|
2411
|
+
return (this[offset] << 24) |
|
|
2412
|
+
(this[offset + 1] << 16) |
|
|
2413
|
+
(this[offset + 2] << 8) |
|
|
2414
|
+
(this[offset + 3])
|
|
2415
|
+
};
|
|
2416
|
+
|
|
2417
|
+
Buffer$1.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
2418
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2419
|
+
return read(this, offset, true, 23, 4)
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2422
|
+
Buffer$1.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
2423
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2424
|
+
return read(this, offset, false, 23, 4)
|
|
2425
|
+
};
|
|
2426
|
+
|
|
2427
|
+
Buffer$1.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
2428
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2429
|
+
return read(this, offset, true, 52, 8)
|
|
2430
|
+
};
|
|
2431
|
+
|
|
2432
|
+
Buffer$1.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
2433
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2434
|
+
return read(this, offset, false, 52, 8)
|
|
2435
|
+
};
|
|
2436
|
+
|
|
2437
|
+
function checkInt (buf, value, offset, ext, max, min) {
|
|
2438
|
+
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
2439
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
2440
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
Buffer$1.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
2444
|
+
value = +value;
|
|
2445
|
+
offset = offset | 0;
|
|
2446
|
+
byteLength = byteLength | 0;
|
|
2447
|
+
if (!noAssert) {
|
|
2448
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
2449
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
var mul = 1;
|
|
2453
|
+
var i = 0;
|
|
2454
|
+
this[offset] = value & 0xFF;
|
|
2455
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
2456
|
+
this[offset + i] = (value / mul) & 0xFF;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
return offset + byteLength
|
|
2460
|
+
};
|
|
2461
|
+
|
|
2462
|
+
Buffer$1.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
2463
|
+
value = +value;
|
|
2464
|
+
offset = offset | 0;
|
|
2465
|
+
byteLength = byteLength | 0;
|
|
2466
|
+
if (!noAssert) {
|
|
2467
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
2468
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
var i = byteLength - 1;
|
|
2472
|
+
var mul = 1;
|
|
2473
|
+
this[offset + i] = value & 0xFF;
|
|
2474
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
2475
|
+
this[offset + i] = (value / mul) & 0xFF;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
return offset + byteLength
|
|
2479
|
+
};
|
|
2480
|
+
|
|
2481
|
+
Buffer$1.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
2482
|
+
value = +value;
|
|
2483
|
+
offset = offset | 0;
|
|
2484
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
2485
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
2486
|
+
this[offset] = (value & 0xff);
|
|
2487
|
+
return offset + 1
|
|
2488
|
+
};
|
|
2489
|
+
|
|
2490
|
+
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
|
2491
|
+
if (value < 0) value = 0xffff + value + 1;
|
|
2492
|
+
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
2493
|
+
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
|
2494
|
+
(littleEndian ? i : 1 - i) * 8;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
Buffer$1.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
2499
|
+
value = +value;
|
|
2500
|
+
offset = offset | 0;
|
|
2501
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
2502
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2503
|
+
this[offset] = (value & 0xff);
|
|
2504
|
+
this[offset + 1] = (value >>> 8);
|
|
2505
|
+
} else {
|
|
2506
|
+
objectWriteUInt16(this, value, offset, true);
|
|
2507
|
+
}
|
|
2508
|
+
return offset + 2
|
|
2509
|
+
};
|
|
2510
|
+
|
|
2511
|
+
Buffer$1.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
2512
|
+
value = +value;
|
|
2513
|
+
offset = offset | 0;
|
|
2514
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
2515
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2516
|
+
this[offset] = (value >>> 8);
|
|
2517
|
+
this[offset + 1] = (value & 0xff);
|
|
2518
|
+
} else {
|
|
2519
|
+
objectWriteUInt16(this, value, offset, false);
|
|
2520
|
+
}
|
|
2521
|
+
return offset + 2
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
|
2525
|
+
if (value < 0) value = 0xffffffff + value + 1;
|
|
2526
|
+
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
2527
|
+
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
Buffer$1.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
2532
|
+
value = +value;
|
|
2533
|
+
offset = offset | 0;
|
|
2534
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
2535
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2536
|
+
this[offset + 3] = (value >>> 24);
|
|
2537
|
+
this[offset + 2] = (value >>> 16);
|
|
2538
|
+
this[offset + 1] = (value >>> 8);
|
|
2539
|
+
this[offset] = (value & 0xff);
|
|
2540
|
+
} else {
|
|
2541
|
+
objectWriteUInt32(this, value, offset, true);
|
|
2542
|
+
}
|
|
2543
|
+
return offset + 4
|
|
2544
|
+
};
|
|
2545
|
+
|
|
2546
|
+
Buffer$1.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
2547
|
+
value = +value;
|
|
2548
|
+
offset = offset | 0;
|
|
2549
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
2550
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2551
|
+
this[offset] = (value >>> 24);
|
|
2552
|
+
this[offset + 1] = (value >>> 16);
|
|
2553
|
+
this[offset + 2] = (value >>> 8);
|
|
2554
|
+
this[offset + 3] = (value & 0xff);
|
|
2555
|
+
} else {
|
|
2556
|
+
objectWriteUInt32(this, value, offset, false);
|
|
2557
|
+
}
|
|
2558
|
+
return offset + 4
|
|
2559
|
+
};
|
|
2560
|
+
|
|
2561
|
+
Buffer$1.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
2562
|
+
value = +value;
|
|
2563
|
+
offset = offset | 0;
|
|
2564
|
+
if (!noAssert) {
|
|
2565
|
+
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
2566
|
+
|
|
2567
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
var i = 0;
|
|
2571
|
+
var mul = 1;
|
|
2572
|
+
var sub = 0;
|
|
2573
|
+
this[offset] = value & 0xFF;
|
|
2574
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
2575
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
2576
|
+
sub = 1;
|
|
2577
|
+
}
|
|
2578
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
return offset + byteLength
|
|
2582
|
+
};
|
|
2583
|
+
|
|
2584
|
+
Buffer$1.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
2585
|
+
value = +value;
|
|
2586
|
+
offset = offset | 0;
|
|
2587
|
+
if (!noAssert) {
|
|
2588
|
+
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
2589
|
+
|
|
2590
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
var i = byteLength - 1;
|
|
2594
|
+
var mul = 1;
|
|
2595
|
+
var sub = 0;
|
|
2596
|
+
this[offset + i] = value & 0xFF;
|
|
2597
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
2598
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
2599
|
+
sub = 1;
|
|
2600
|
+
}
|
|
2601
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
return offset + byteLength
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
2608
|
+
value = +value;
|
|
2609
|
+
offset = offset | 0;
|
|
2610
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
|
|
2611
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
2612
|
+
if (value < 0) value = 0xff + value + 1;
|
|
2613
|
+
this[offset] = (value & 0xff);
|
|
2614
|
+
return offset + 1
|
|
2615
|
+
};
|
|
2616
|
+
|
|
2617
|
+
Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
2618
|
+
value = +value;
|
|
2619
|
+
offset = offset | 0;
|
|
2620
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
2621
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2622
|
+
this[offset] = (value & 0xff);
|
|
2623
|
+
this[offset + 1] = (value >>> 8);
|
|
2624
|
+
} else {
|
|
2625
|
+
objectWriteUInt16(this, value, offset, true);
|
|
2626
|
+
}
|
|
2627
|
+
return offset + 2
|
|
2628
|
+
};
|
|
2629
|
+
|
|
2630
|
+
Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
2631
|
+
value = +value;
|
|
2632
|
+
offset = offset | 0;
|
|
2633
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
2634
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2635
|
+
this[offset] = (value >>> 8);
|
|
2636
|
+
this[offset + 1] = (value & 0xff);
|
|
2637
|
+
} else {
|
|
2638
|
+
objectWriteUInt16(this, value, offset, false);
|
|
2639
|
+
}
|
|
2640
|
+
return offset + 2
|
|
2641
|
+
};
|
|
2642
|
+
|
|
2643
|
+
Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
2644
|
+
value = +value;
|
|
2645
|
+
offset = offset | 0;
|
|
2646
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
2647
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2648
|
+
this[offset] = (value & 0xff);
|
|
2649
|
+
this[offset + 1] = (value >>> 8);
|
|
2650
|
+
this[offset + 2] = (value >>> 16);
|
|
2651
|
+
this[offset + 3] = (value >>> 24);
|
|
2652
|
+
} else {
|
|
2653
|
+
objectWriteUInt32(this, value, offset, true);
|
|
2654
|
+
}
|
|
2655
|
+
return offset + 4
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2658
|
+
Buffer$1.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
2659
|
+
value = +value;
|
|
2660
|
+
offset = offset | 0;
|
|
2661
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
2662
|
+
if (value < 0) value = 0xffffffff + value + 1;
|
|
2663
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2664
|
+
this[offset] = (value >>> 24);
|
|
2665
|
+
this[offset + 1] = (value >>> 16);
|
|
2666
|
+
this[offset + 2] = (value >>> 8);
|
|
2667
|
+
this[offset + 3] = (value & 0xff);
|
|
2668
|
+
} else {
|
|
2669
|
+
objectWriteUInt32(this, value, offset, false);
|
|
2670
|
+
}
|
|
2671
|
+
return offset + 4
|
|
2672
|
+
};
|
|
2673
|
+
|
|
2674
|
+
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
2675
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
2676
|
+
if (offset < 0) throw new RangeError('Index out of range')
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
2680
|
+
if (!noAssert) {
|
|
2681
|
+
checkIEEE754(buf, value, offset, 4);
|
|
2682
|
+
}
|
|
2683
|
+
write(buf, value, offset, littleEndian, 23, 4);
|
|
2684
|
+
return offset + 4
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
Buffer$1.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
2688
|
+
return writeFloat(this, value, offset, true, noAssert)
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2691
|
+
Buffer$1.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
2692
|
+
return writeFloat(this, value, offset, false, noAssert)
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2695
|
+
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
2696
|
+
if (!noAssert) {
|
|
2697
|
+
checkIEEE754(buf, value, offset, 8);
|
|
2698
|
+
}
|
|
2699
|
+
write(buf, value, offset, littleEndian, 52, 8);
|
|
2700
|
+
return offset + 8
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
Buffer$1.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
2704
|
+
return writeDouble(this, value, offset, true, noAssert)
|
|
2705
|
+
};
|
|
2706
|
+
|
|
2707
|
+
Buffer$1.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
2708
|
+
return writeDouble(this, value, offset, false, noAssert)
|
|
2709
|
+
};
|
|
2710
|
+
|
|
2711
|
+
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
2712
|
+
Buffer$1.prototype.copy = function copy (target, targetStart, start, end) {
|
|
2713
|
+
if (!start) start = 0;
|
|
2714
|
+
if (!end && end !== 0) end = this.length;
|
|
2715
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
2716
|
+
if (!targetStart) targetStart = 0;
|
|
2717
|
+
if (end > 0 && end < start) end = start;
|
|
2718
|
+
|
|
2719
|
+
// Copy 0 bytes; we're done
|
|
2720
|
+
if (end === start) return 0
|
|
2721
|
+
if (target.length === 0 || this.length === 0) return 0
|
|
2722
|
+
|
|
2723
|
+
// Fatal error conditions
|
|
2724
|
+
if (targetStart < 0) {
|
|
2725
|
+
throw new RangeError('targetStart out of bounds')
|
|
2726
|
+
}
|
|
2727
|
+
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
2728
|
+
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
2729
|
+
|
|
2730
|
+
// Are we oob?
|
|
2731
|
+
if (end > this.length) end = this.length;
|
|
2732
|
+
if (target.length - targetStart < end - start) {
|
|
2733
|
+
end = target.length - targetStart + start;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
var len = end - start;
|
|
2737
|
+
var i;
|
|
2738
|
+
|
|
2739
|
+
if (this === target && start < targetStart && targetStart < end) {
|
|
2740
|
+
// descending copy from end
|
|
2741
|
+
for (i = len - 1; i >= 0; --i) {
|
|
2742
|
+
target[i + targetStart] = this[i + start];
|
|
2743
|
+
}
|
|
2744
|
+
} else if (len < 1000 || !Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2745
|
+
// ascending copy from start
|
|
2746
|
+
for (i = 0; i < len; ++i) {
|
|
2747
|
+
target[i + targetStart] = this[i + start];
|
|
2748
|
+
}
|
|
2749
|
+
} else {
|
|
2750
|
+
Uint8Array.prototype.set.call(
|
|
2751
|
+
target,
|
|
2752
|
+
this.subarray(start, start + len),
|
|
2753
|
+
targetStart
|
|
2754
|
+
);
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
return len
|
|
2758
|
+
};
|
|
2759
|
+
|
|
2760
|
+
// Usage:
|
|
2761
|
+
// buffer.fill(number[, offset[, end]])
|
|
2762
|
+
// buffer.fill(buffer[, offset[, end]])
|
|
2763
|
+
// buffer.fill(string[, offset[, end]][, encoding])
|
|
2764
|
+
Buffer$1.prototype.fill = function fill (val, start, end, encoding) {
|
|
2765
|
+
// Handle string cases:
|
|
2766
|
+
if (typeof val === 'string') {
|
|
2767
|
+
if (typeof start === 'string') {
|
|
2768
|
+
encoding = start;
|
|
2769
|
+
start = 0;
|
|
2770
|
+
end = this.length;
|
|
2771
|
+
} else if (typeof end === 'string') {
|
|
2772
|
+
encoding = end;
|
|
2773
|
+
end = this.length;
|
|
2774
|
+
}
|
|
2775
|
+
if (val.length === 1) {
|
|
2776
|
+
var code = val.charCodeAt(0);
|
|
2777
|
+
if (code < 256) {
|
|
2778
|
+
val = code;
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
2782
|
+
throw new TypeError('encoding must be a string')
|
|
2783
|
+
}
|
|
2784
|
+
if (typeof encoding === 'string' && !Buffer$1.isEncoding(encoding)) {
|
|
2785
|
+
throw new TypeError('Unknown encoding: ' + encoding)
|
|
2786
|
+
}
|
|
2787
|
+
} else if (typeof val === 'number') {
|
|
2788
|
+
val = val & 255;
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
// Invalid ranges are not set to a default, so can range check early.
|
|
2792
|
+
if (start < 0 || this.length < start || this.length < end) {
|
|
2793
|
+
throw new RangeError('Out of range index')
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
if (end <= start) {
|
|
2797
|
+
return this
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
start = start >>> 0;
|
|
2801
|
+
end = end === undefined ? this.length : end >>> 0;
|
|
2802
|
+
|
|
2803
|
+
if (!val) val = 0;
|
|
2804
|
+
|
|
2805
|
+
var i;
|
|
2806
|
+
if (typeof val === 'number') {
|
|
2807
|
+
for (i = start; i < end; ++i) {
|
|
2808
|
+
this[i] = val;
|
|
2809
|
+
}
|
|
2810
|
+
} else {
|
|
2811
|
+
var bytes = internalIsBuffer(val)
|
|
2812
|
+
? val
|
|
2813
|
+
: utf8ToBytes(new Buffer$1(val, encoding).toString());
|
|
2814
|
+
var len = bytes.length;
|
|
2815
|
+
for (i = 0; i < end - start; ++i) {
|
|
2816
|
+
this[i + start] = bytes[i % len];
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
return this
|
|
2821
|
+
};
|
|
2822
|
+
|
|
2823
|
+
// HELPER FUNCTIONS
|
|
2824
|
+
// ================
|
|
2825
|
+
|
|
2826
|
+
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
2827
|
+
|
|
2828
|
+
function base64clean (str) {
|
|
2829
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
2830
|
+
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
|
|
2831
|
+
// Node converts strings with length < 2 to ''
|
|
2832
|
+
if (str.length < 2) return ''
|
|
2833
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
2834
|
+
while (str.length % 4 !== 0) {
|
|
2835
|
+
str = str + '=';
|
|
2836
|
+
}
|
|
2837
|
+
return str
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
function stringtrim (str) {
|
|
2841
|
+
if (str.trim) return str.trim()
|
|
2842
|
+
return str.replace(/^\s+|\s+$/g, '')
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
function toHex (n) {
|
|
2846
|
+
if (n < 16) return '0' + n.toString(16)
|
|
2847
|
+
return n.toString(16)
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
function utf8ToBytes (string, units) {
|
|
2851
|
+
units = units || Infinity;
|
|
2852
|
+
var codePoint;
|
|
2853
|
+
var length = string.length;
|
|
2854
|
+
var leadSurrogate = null;
|
|
2855
|
+
var bytes = [];
|
|
2856
|
+
|
|
2857
|
+
for (var i = 0; i < length; ++i) {
|
|
2858
|
+
codePoint = string.charCodeAt(i);
|
|
2859
|
+
|
|
2860
|
+
// is surrogate component
|
|
2861
|
+
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
2862
|
+
// last char was a lead
|
|
2863
|
+
if (!leadSurrogate) {
|
|
2864
|
+
// no lead yet
|
|
2865
|
+
if (codePoint > 0xDBFF) {
|
|
2866
|
+
// unexpected trail
|
|
2867
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
2868
|
+
continue
|
|
2869
|
+
} else if (i + 1 === length) {
|
|
2870
|
+
// unpaired lead
|
|
2871
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
2872
|
+
continue
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
// valid lead
|
|
2876
|
+
leadSurrogate = codePoint;
|
|
2877
|
+
|
|
2878
|
+
continue
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
// 2 leads in a row
|
|
2882
|
+
if (codePoint < 0xDC00) {
|
|
2883
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
2884
|
+
leadSurrogate = codePoint;
|
|
2885
|
+
continue
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
// valid surrogate pair
|
|
2889
|
+
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
2890
|
+
} else if (leadSurrogate) {
|
|
2891
|
+
// valid bmp char, but last char was a lead
|
|
2892
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
leadSurrogate = null;
|
|
2896
|
+
|
|
2897
|
+
// encode utf8
|
|
2898
|
+
if (codePoint < 0x80) {
|
|
2899
|
+
if ((units -= 1) < 0) break
|
|
2900
|
+
bytes.push(codePoint);
|
|
2901
|
+
} else if (codePoint < 0x800) {
|
|
2902
|
+
if ((units -= 2) < 0) break
|
|
2903
|
+
bytes.push(
|
|
2904
|
+
codePoint >> 0x6 | 0xC0,
|
|
2905
|
+
codePoint & 0x3F | 0x80
|
|
2906
|
+
);
|
|
2907
|
+
} else if (codePoint < 0x10000) {
|
|
2908
|
+
if ((units -= 3) < 0) break
|
|
2909
|
+
bytes.push(
|
|
2910
|
+
codePoint >> 0xC | 0xE0,
|
|
2911
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
|
2912
|
+
codePoint & 0x3F | 0x80
|
|
2913
|
+
);
|
|
2914
|
+
} else if (codePoint < 0x110000) {
|
|
2915
|
+
if ((units -= 4) < 0) break
|
|
2916
|
+
bytes.push(
|
|
2917
|
+
codePoint >> 0x12 | 0xF0,
|
|
2918
|
+
codePoint >> 0xC & 0x3F | 0x80,
|
|
2919
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
|
2920
|
+
codePoint & 0x3F | 0x80
|
|
2921
|
+
);
|
|
2922
|
+
} else {
|
|
2923
|
+
throw new Error('Invalid code point')
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
return bytes
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
function asciiToBytes (str) {
|
|
2931
|
+
var byteArray = [];
|
|
2932
|
+
for (var i = 0; i < str.length; ++i) {
|
|
2933
|
+
// Node's code seems to be doing this and not & 0x7F..
|
|
2934
|
+
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
2935
|
+
}
|
|
2936
|
+
return byteArray
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
function utf16leToBytes (str, units) {
|
|
2940
|
+
var c, hi, lo;
|
|
2941
|
+
var byteArray = [];
|
|
2942
|
+
for (var i = 0; i < str.length; ++i) {
|
|
2943
|
+
if ((units -= 2) < 0) break
|
|
2944
|
+
|
|
2945
|
+
c = str.charCodeAt(i);
|
|
2946
|
+
hi = c >> 8;
|
|
2947
|
+
lo = c % 256;
|
|
2948
|
+
byteArray.push(lo);
|
|
2949
|
+
byteArray.push(hi);
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
return byteArray
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
function base64ToBytes (str) {
|
|
2957
|
+
return toByteArray(base64clean(str))
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
function blitBuffer (src, dst, offset, length) {
|
|
2961
|
+
for (var i = 0; i < length; ++i) {
|
|
2962
|
+
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
2963
|
+
dst[i + offset] = src[i];
|
|
2964
|
+
}
|
|
2965
|
+
return i
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
function isnan (val) {
|
|
2969
|
+
return val !== val // eslint-disable-line no-self-compare
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
|
2974
|
+
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|
2975
|
+
// Object.prototype.constructor. Remove this eventually
|
|
2976
|
+
function isBuffer$2(obj) {
|
|
2977
|
+
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
function isFastBuffer (obj) {
|
|
2981
|
+
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
// For Node v0.10 support. Remove this eventually.
|
|
2985
|
+
function isSlowBuffer (obj) {
|
|
2986
|
+
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// shim for using process in browser
|
|
2990
|
+
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
|
2991
|
+
|
|
2992
|
+
function defaultSetTimout() {
|
|
2993
|
+
throw new Error('setTimeout has not been defined');
|
|
2994
|
+
}
|
|
2995
|
+
function defaultClearTimeout () {
|
|
2996
|
+
throw new Error('clearTimeout has not been defined');
|
|
2997
|
+
}
|
|
2998
|
+
var cachedSetTimeout = defaultSetTimout;
|
|
2999
|
+
var cachedClearTimeout = defaultClearTimeout;
|
|
3000
|
+
if (typeof global$1.setTimeout === 'function') {
|
|
3001
|
+
cachedSetTimeout = setTimeout;
|
|
3002
|
+
}
|
|
3003
|
+
if (typeof global$1.clearTimeout === 'function') {
|
|
3004
|
+
cachedClearTimeout = clearTimeout;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
function runTimeout(fun) {
|
|
3008
|
+
if (cachedSetTimeout === setTimeout) {
|
|
3009
|
+
//normal enviroments in sane situations
|
|
3010
|
+
return setTimeout(fun, 0);
|
|
3011
|
+
}
|
|
3012
|
+
// if setTimeout wasn't available but was latter defined
|
|
3013
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
3014
|
+
cachedSetTimeout = setTimeout;
|
|
3015
|
+
return setTimeout(fun, 0);
|
|
3016
|
+
}
|
|
3017
|
+
try {
|
|
3018
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
3019
|
+
return cachedSetTimeout(fun, 0);
|
|
3020
|
+
} catch(e){
|
|
3021
|
+
try {
|
|
3022
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
3023
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
3024
|
+
} catch(e){
|
|
3025
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
3026
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
}
|
|
3032
|
+
function runClearTimeout(marker) {
|
|
3033
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
3034
|
+
//normal enviroments in sane situations
|
|
3035
|
+
return clearTimeout(marker);
|
|
3036
|
+
}
|
|
3037
|
+
// if clearTimeout wasn't available but was latter defined
|
|
3038
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
3039
|
+
cachedClearTimeout = clearTimeout;
|
|
3040
|
+
return clearTimeout(marker);
|
|
3041
|
+
}
|
|
3042
|
+
try {
|
|
3043
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
3044
|
+
return cachedClearTimeout(marker);
|
|
3045
|
+
} catch (e){
|
|
3046
|
+
try {
|
|
3047
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
3048
|
+
return cachedClearTimeout.call(null, marker);
|
|
3049
|
+
} catch (e){
|
|
3050
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
3051
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
3052
|
+
return cachedClearTimeout.call(this, marker);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
}
|
|
3059
|
+
var queue = [];
|
|
3060
|
+
var draining = false;
|
|
3061
|
+
var currentQueue;
|
|
3062
|
+
var queueIndex = -1;
|
|
3063
|
+
|
|
3064
|
+
function cleanUpNextTick() {
|
|
3065
|
+
if (!draining || !currentQueue) {
|
|
3066
|
+
return;
|
|
3067
|
+
}
|
|
3068
|
+
draining = false;
|
|
3069
|
+
if (currentQueue.length) {
|
|
3070
|
+
queue = currentQueue.concat(queue);
|
|
3071
|
+
} else {
|
|
3072
|
+
queueIndex = -1;
|
|
3073
|
+
}
|
|
3074
|
+
if (queue.length) {
|
|
3075
|
+
drainQueue();
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
function drainQueue() {
|
|
3080
|
+
if (draining) {
|
|
3081
|
+
return;
|
|
3082
|
+
}
|
|
3083
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
3084
|
+
draining = true;
|
|
3085
|
+
|
|
3086
|
+
var len = queue.length;
|
|
3087
|
+
while(len) {
|
|
3088
|
+
currentQueue = queue;
|
|
3089
|
+
queue = [];
|
|
3090
|
+
while (++queueIndex < len) {
|
|
3091
|
+
if (currentQueue) {
|
|
3092
|
+
currentQueue[queueIndex].run();
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
queueIndex = -1;
|
|
3096
|
+
len = queue.length;
|
|
3097
|
+
}
|
|
3098
|
+
currentQueue = null;
|
|
3099
|
+
draining = false;
|
|
3100
|
+
runClearTimeout(timeout);
|
|
3101
|
+
}
|
|
3102
|
+
function nextTick(fun) {
|
|
3103
|
+
var args = new Array(arguments.length - 1);
|
|
3104
|
+
if (arguments.length > 1) {
|
|
3105
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
3106
|
+
args[i - 1] = arguments[i];
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
queue.push(new Item(fun, args));
|
|
3110
|
+
if (queue.length === 1 && !draining) {
|
|
3111
|
+
runTimeout(drainQueue);
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
// v8 likes predictible objects
|
|
3115
|
+
function Item(fun, array) {
|
|
3116
|
+
this.fun = fun;
|
|
3117
|
+
this.array = array;
|
|
3118
|
+
}
|
|
3119
|
+
Item.prototype.run = function () {
|
|
3120
|
+
this.fun.apply(null, this.array);
|
|
3121
|
+
};
|
|
3122
|
+
var title = 'browser';
|
|
3123
|
+
var platform = 'browser';
|
|
3124
|
+
var browser = true;
|
|
3125
|
+
var env = {};
|
|
3126
|
+
var argv = [];
|
|
3127
|
+
var version = ''; // empty string to avoid regexp issues
|
|
3128
|
+
var versions = {};
|
|
3129
|
+
var release = {};
|
|
3130
|
+
var config = {};
|
|
3131
|
+
|
|
3132
|
+
function noop() {}
|
|
3133
|
+
|
|
3134
|
+
var on = noop;
|
|
3135
|
+
var addListener = noop;
|
|
3136
|
+
var once = noop;
|
|
3137
|
+
var off = noop;
|
|
3138
|
+
var removeListener = noop;
|
|
3139
|
+
var removeAllListeners = noop;
|
|
3140
|
+
var emit = noop;
|
|
3141
|
+
|
|
3142
|
+
function binding(name) {
|
|
3143
|
+
throw new Error('process.binding is not supported');
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
function cwd () { return '/' }
|
|
3147
|
+
function chdir (dir) {
|
|
3148
|
+
throw new Error('process.chdir is not supported');
|
|
3149
|
+
}function umask() { return 0; }
|
|
3150
|
+
|
|
3151
|
+
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
|
3152
|
+
var performance = global$1.performance || {};
|
|
3153
|
+
var performanceNow =
|
|
3154
|
+
performance.now ||
|
|
3155
|
+
performance.mozNow ||
|
|
3156
|
+
performance.msNow ||
|
|
3157
|
+
performance.oNow ||
|
|
3158
|
+
performance.webkitNow ||
|
|
3159
|
+
function(){ return (new Date()).getTime() };
|
|
3160
|
+
|
|
3161
|
+
// generate timestamp or delta
|
|
3162
|
+
// see http://nodejs.org/api/process.html#process_process_hrtime
|
|
3163
|
+
function hrtime(previousTimestamp){
|
|
3164
|
+
var clocktime = performanceNow.call(performance)*1e-3;
|
|
3165
|
+
var seconds = Math.floor(clocktime);
|
|
3166
|
+
var nanoseconds = Math.floor((clocktime%1)*1e9);
|
|
3167
|
+
if (previousTimestamp) {
|
|
3168
|
+
seconds = seconds - previousTimestamp[0];
|
|
3169
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
3170
|
+
if (nanoseconds<0) {
|
|
3171
|
+
seconds--;
|
|
3172
|
+
nanoseconds += 1e9;
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
return [seconds,nanoseconds]
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
var startTime = new Date();
|
|
3179
|
+
function uptime() {
|
|
3180
|
+
var currentTime = new Date();
|
|
3181
|
+
var dif = currentTime - startTime;
|
|
3182
|
+
return dif / 1000;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
var browser$1 = {
|
|
3186
|
+
nextTick: nextTick,
|
|
3187
|
+
title: title,
|
|
3188
|
+
browser: browser,
|
|
3189
|
+
env: env,
|
|
3190
|
+
argv: argv,
|
|
3191
|
+
version: version,
|
|
3192
|
+
versions: versions,
|
|
3193
|
+
on: on,
|
|
3194
|
+
addListener: addListener,
|
|
3195
|
+
once: once,
|
|
3196
|
+
off: off,
|
|
3197
|
+
removeListener: removeListener,
|
|
3198
|
+
removeAllListeners: removeAllListeners,
|
|
3199
|
+
emit: emit,
|
|
3200
|
+
binding: binding,
|
|
3201
|
+
cwd: cwd,
|
|
3202
|
+
chdir: chdir,
|
|
3203
|
+
umask: umask,
|
|
3204
|
+
hrtime: hrtime,
|
|
3205
|
+
platform: platform,
|
|
3206
|
+
release: release,
|
|
3207
|
+
config: config,
|
|
3208
|
+
uptime: uptime
|
|
3209
|
+
};
|
|
3210
|
+
|
|
3211
|
+
var inherits;
|
|
3212
|
+
if (typeof Object.create === 'function'){
|
|
3213
|
+
inherits = function inherits(ctor, superCtor) {
|
|
3214
|
+
// implementation from standard node.js 'util' module
|
|
3215
|
+
ctor.super_ = superCtor;
|
|
3216
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
3217
|
+
constructor: {
|
|
3218
|
+
value: ctor,
|
|
3219
|
+
enumerable: false,
|
|
3220
|
+
writable: true,
|
|
3221
|
+
configurable: true
|
|
3222
|
+
}
|
|
3223
|
+
});
|
|
3224
|
+
};
|
|
3225
|
+
} else {
|
|
3226
|
+
inherits = function inherits(ctor, superCtor) {
|
|
3227
|
+
ctor.super_ = superCtor;
|
|
3228
|
+
var TempCtor = function () {};
|
|
3229
|
+
TempCtor.prototype = superCtor.prototype;
|
|
3230
|
+
ctor.prototype = new TempCtor();
|
|
3231
|
+
ctor.prototype.constructor = ctor;
|
|
3232
|
+
};
|
|
3233
|
+
}
|
|
3234
|
+
var inherits$1 = inherits;
|
|
3235
|
+
|
|
3236
|
+
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
|
|
3237
|
+
function getOwnPropertyDescriptors(obj) {
|
|
3238
|
+
var keys = Object.keys(obj);
|
|
3239
|
+
var descriptors = {};
|
|
3240
|
+
for (var i = 0; i < keys.length; i++) {
|
|
3241
|
+
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
|
|
3242
|
+
}
|
|
3243
|
+
return descriptors;
|
|
3244
|
+
};
|
|
3245
|
+
|
|
3246
|
+
var formatRegExp = /%[sdj%]/g;
|
|
3247
|
+
function format(f) {
|
|
3248
|
+
if (!isString$1(f)) {
|
|
3249
|
+
var objects = [];
|
|
3250
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
3251
|
+
objects.push(inspect$1(arguments[i]));
|
|
3252
|
+
}
|
|
3253
|
+
return objects.join(' ');
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
var i = 1;
|
|
3257
|
+
var args = arguments;
|
|
3258
|
+
var len = args.length;
|
|
3259
|
+
var str = String(f).replace(formatRegExp, function(x) {
|
|
3260
|
+
if (x === '%%') return '%';
|
|
3261
|
+
if (i >= len) return x;
|
|
3262
|
+
switch (x) {
|
|
3263
|
+
case '%s': return String(args[i++]);
|
|
3264
|
+
case '%d': return Number(args[i++]);
|
|
3265
|
+
case '%j':
|
|
3266
|
+
try {
|
|
3267
|
+
return JSON.stringify(args[i++]);
|
|
3268
|
+
} catch (_) {
|
|
3269
|
+
return '[Circular]';
|
|
3270
|
+
}
|
|
3271
|
+
default:
|
|
3272
|
+
return x;
|
|
3273
|
+
}
|
|
3274
|
+
});
|
|
3275
|
+
for (var x = args[i]; i < len; x = args[++i]) {
|
|
3276
|
+
if (isNull(x) || !isObject(x)) {
|
|
3277
|
+
str += ' ' + x;
|
|
3278
|
+
} else {
|
|
3279
|
+
str += ' ' + inspect$1(x);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
return str;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
// Mark that a method should not be used.
|
|
3286
|
+
// Returns a modified function which warns once by default.
|
|
3287
|
+
// If --no-deprecation is set, then it is a no-op.
|
|
3288
|
+
function deprecate(fn, msg) {
|
|
3289
|
+
// Allow for deprecating things in the process of starting up.
|
|
3290
|
+
if (isUndefined(global$1.process)) {
|
|
3291
|
+
return function() {
|
|
3292
|
+
return deprecate(fn, msg).apply(this, arguments);
|
|
3293
|
+
};
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
if (browser$1.noDeprecation === true) {
|
|
3297
|
+
return fn;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
var warned = false;
|
|
3301
|
+
function deprecated() {
|
|
3302
|
+
if (!warned) {
|
|
3303
|
+
if (browser$1.throwDeprecation) {
|
|
3304
|
+
throw new Error(msg);
|
|
3305
|
+
} else if (browser$1.traceDeprecation) {
|
|
3306
|
+
console.trace(msg);
|
|
3307
|
+
} else {
|
|
3308
|
+
console.error(msg);
|
|
3309
|
+
}
|
|
3310
|
+
warned = true;
|
|
3311
|
+
}
|
|
3312
|
+
return fn.apply(this, arguments);
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3315
|
+
return deprecated;
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3318
|
+
var debugs = {};
|
|
3319
|
+
var debugEnviron;
|
|
3320
|
+
function debuglog(set) {
|
|
3321
|
+
if (isUndefined(debugEnviron))
|
|
3322
|
+
debugEnviron = browser$1.env.NODE_DEBUG || '';
|
|
3323
|
+
set = set.toUpperCase();
|
|
3324
|
+
if (!debugs[set]) {
|
|
3325
|
+
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
|
3326
|
+
var pid = 0;
|
|
3327
|
+
debugs[set] = function() {
|
|
3328
|
+
var msg = format.apply(null, arguments);
|
|
3329
|
+
console.error('%s %d: %s', set, pid, msg);
|
|
3330
|
+
};
|
|
3331
|
+
} else {
|
|
3332
|
+
debugs[set] = function() {};
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
return debugs[set];
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* Echos the value of a value. Trys to print the value out
|
|
3340
|
+
* in the best way possible given the different types.
|
|
3341
|
+
*
|
|
3342
|
+
* @param {Object} obj The object to print out.
|
|
3343
|
+
* @param {Object} opts Optional options object that alters the output.
|
|
3344
|
+
*/
|
|
3345
|
+
/* legacy: obj, showHidden, depth, colors*/
|
|
3346
|
+
function inspect$1(obj, opts) {
|
|
3347
|
+
// default options
|
|
3348
|
+
var ctx = {
|
|
3349
|
+
seen: [],
|
|
3350
|
+
stylize: stylizeNoColor
|
|
3351
|
+
};
|
|
3352
|
+
// legacy...
|
|
3353
|
+
if (arguments.length >= 3) ctx.depth = arguments[2];
|
|
3354
|
+
if (arguments.length >= 4) ctx.colors = arguments[3];
|
|
3355
|
+
if (isBoolean$1(opts)) {
|
|
3356
|
+
// legacy...
|
|
3357
|
+
ctx.showHidden = opts;
|
|
3358
|
+
} else if (opts) {
|
|
3359
|
+
// got an "options" object
|
|
3360
|
+
_extend(ctx, opts);
|
|
3361
|
+
}
|
|
3362
|
+
// set default options
|
|
3363
|
+
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
|
3364
|
+
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
|
3365
|
+
if (isUndefined(ctx.colors)) ctx.colors = false;
|
|
3366
|
+
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
|
3367
|
+
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
|
3368
|
+
return formatValue(ctx, obj, ctx.depth);
|
|
3369
|
+
}
|
|
3370
|
+
|
|
3371
|
+
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
|
3372
|
+
inspect$1.colors = {
|
|
3373
|
+
'bold' : [1, 22],
|
|
3374
|
+
'italic' : [3, 23],
|
|
3375
|
+
'underline' : [4, 24],
|
|
3376
|
+
'inverse' : [7, 27],
|
|
3377
|
+
'white' : [37, 39],
|
|
3378
|
+
'grey' : [90, 39],
|
|
3379
|
+
'black' : [30, 39],
|
|
3380
|
+
'blue' : [34, 39],
|
|
3381
|
+
'cyan' : [36, 39],
|
|
3382
|
+
'green' : [32, 39],
|
|
3383
|
+
'magenta' : [35, 39],
|
|
3384
|
+
'red' : [31, 39],
|
|
3385
|
+
'yellow' : [33, 39]
|
|
3386
|
+
};
|
|
3387
|
+
|
|
3388
|
+
// Don't use 'blue' not visible on cmd.exe
|
|
3389
|
+
inspect$1.styles = {
|
|
3390
|
+
'special': 'cyan',
|
|
3391
|
+
'number': 'yellow',
|
|
3392
|
+
'boolean': 'yellow',
|
|
3393
|
+
'undefined': 'grey',
|
|
3394
|
+
'null': 'bold',
|
|
3395
|
+
'string': 'green',
|
|
3396
|
+
'date': 'magenta',
|
|
3397
|
+
// "name": intentionally not styling
|
|
3398
|
+
'regexp': 'red'
|
|
3399
|
+
};
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
function stylizeWithColor(str, styleType) {
|
|
3403
|
+
var style = inspect$1.styles[styleType];
|
|
3404
|
+
|
|
3405
|
+
if (style) {
|
|
3406
|
+
return '\u001b[' + inspect$1.colors[style][0] + 'm' + str +
|
|
3407
|
+
'\u001b[' + inspect$1.colors[style][1] + 'm';
|
|
3408
|
+
} else {
|
|
3409
|
+
return str;
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
function stylizeNoColor(str, styleType) {
|
|
3415
|
+
return str;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
|
|
3419
|
+
function arrayToHash(array) {
|
|
3420
|
+
var hash = {};
|
|
3421
|
+
|
|
3422
|
+
array.forEach(function(val, idx) {
|
|
3423
|
+
hash[val] = true;
|
|
3424
|
+
});
|
|
3425
|
+
|
|
3426
|
+
return hash;
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
|
|
3430
|
+
function formatValue(ctx, value, recurseTimes) {
|
|
3431
|
+
// Provide a hook for user-specified inspect functions.
|
|
3432
|
+
// Check that value is an object with an inspect function on it
|
|
3433
|
+
if (ctx.customInspect &&
|
|
3434
|
+
value &&
|
|
3435
|
+
isFunction(value.inspect) &&
|
|
3436
|
+
// Filter out the util module, it's inspect function is special
|
|
3437
|
+
value.inspect !== inspect$1 &&
|
|
3438
|
+
// Also filter out any prototype objects using the circular check.
|
|
3439
|
+
!(value.constructor && value.constructor.prototype === value)) {
|
|
3440
|
+
var ret = value.inspect(recurseTimes, ctx);
|
|
3441
|
+
if (!isString$1(ret)) {
|
|
3442
|
+
ret = formatValue(ctx, ret, recurseTimes);
|
|
3443
|
+
}
|
|
3444
|
+
return ret;
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
// Primitive types cannot have properties
|
|
3448
|
+
var primitive = formatPrimitive(ctx, value);
|
|
3449
|
+
if (primitive) {
|
|
3450
|
+
return primitive;
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3453
|
+
// Look up the keys of the object.
|
|
3454
|
+
var keys = Object.keys(value);
|
|
3455
|
+
var visibleKeys = arrayToHash(keys);
|
|
3456
|
+
|
|
3457
|
+
if (ctx.showHidden) {
|
|
3458
|
+
keys = Object.getOwnPropertyNames(value);
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
// IE doesn't make error fields non-enumerable
|
|
3462
|
+
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
|
3463
|
+
if (isError$1(value)
|
|
3464
|
+
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
|
3465
|
+
return formatError(value);
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
// Some type of object without properties can be shortcutted.
|
|
3469
|
+
if (keys.length === 0) {
|
|
3470
|
+
if (isFunction(value)) {
|
|
3471
|
+
var name = value.name ? ': ' + value.name : '';
|
|
3472
|
+
return ctx.stylize('[Function' + name + ']', 'special');
|
|
3473
|
+
}
|
|
3474
|
+
if (isRegExp$2(value)) {
|
|
3475
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
|
3476
|
+
}
|
|
3477
|
+
if (isDate$1(value)) {
|
|
3478
|
+
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
|
3479
|
+
}
|
|
3480
|
+
if (isError$1(value)) {
|
|
3481
|
+
return formatError(value);
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
var base = '', array = false, braces = ['{', '}'];
|
|
3486
|
+
|
|
3487
|
+
// Make Array say that they are Array
|
|
3488
|
+
if (isArray$3(value)) {
|
|
3489
|
+
array = true;
|
|
3490
|
+
braces = ['[', ']'];
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
// Make functions say that they are functions
|
|
3494
|
+
if (isFunction(value)) {
|
|
3495
|
+
var n = value.name ? ': ' + value.name : '';
|
|
3496
|
+
base = ' [Function' + n + ']';
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
// Make RegExps say that they are RegExps
|
|
3500
|
+
if (isRegExp$2(value)) {
|
|
3501
|
+
base = ' ' + RegExp.prototype.toString.call(value);
|
|
3502
|
+
}
|
|
3503
|
+
|
|
3504
|
+
// Make dates with properties first say the date
|
|
3505
|
+
if (isDate$1(value)) {
|
|
3506
|
+
base = ' ' + Date.prototype.toUTCString.call(value);
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
// Make error with message first say the error
|
|
3510
|
+
if (isError$1(value)) {
|
|
3511
|
+
base = ' ' + formatError(value);
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
if (keys.length === 0 && (!array || value.length == 0)) {
|
|
3515
|
+
return braces[0] + base + braces[1];
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
if (recurseTimes < 0) {
|
|
3519
|
+
if (isRegExp$2(value)) {
|
|
3520
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
|
3521
|
+
} else {
|
|
3522
|
+
return ctx.stylize('[Object]', 'special');
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
ctx.seen.push(value);
|
|
3527
|
+
|
|
3528
|
+
var output;
|
|
3529
|
+
if (array) {
|
|
3530
|
+
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
|
3531
|
+
} else {
|
|
3532
|
+
output = keys.map(function(key) {
|
|
3533
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
|
3534
|
+
});
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
ctx.seen.pop();
|
|
3538
|
+
|
|
3539
|
+
return reduceToSingleString(output, base, braces);
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
|
|
3543
|
+
function formatPrimitive(ctx, value) {
|
|
3544
|
+
if (isUndefined(value))
|
|
3545
|
+
return ctx.stylize('undefined', 'undefined');
|
|
3546
|
+
if (isString$1(value)) {
|
|
3547
|
+
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
|
3548
|
+
.replace(/'/g, "\\'")
|
|
3549
|
+
.replace(/\\"/g, '"') + '\'';
|
|
3550
|
+
return ctx.stylize(simple, 'string');
|
|
3551
|
+
}
|
|
3552
|
+
if (isNumber$1(value))
|
|
3553
|
+
return ctx.stylize('' + value, 'number');
|
|
3554
|
+
if (isBoolean$1(value))
|
|
3555
|
+
return ctx.stylize('' + value, 'boolean');
|
|
3556
|
+
// For some reason typeof null is "object", so special case here.
|
|
3557
|
+
if (isNull(value))
|
|
3558
|
+
return ctx.stylize('null', 'null');
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
|
|
3562
|
+
function formatError(value) {
|
|
3563
|
+
return '[' + Error.prototype.toString.call(value) + ']';
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
|
|
3567
|
+
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
3568
|
+
var output = [];
|
|
3569
|
+
for (var i = 0, l = value.length; i < l; ++i) {
|
|
3570
|
+
if (hasOwnProperty(value, String(i))) {
|
|
3571
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
3572
|
+
String(i), true));
|
|
3573
|
+
} else {
|
|
3574
|
+
output.push('');
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
keys.forEach(function(key) {
|
|
3578
|
+
if (!key.match(/^\d+$/)) {
|
|
3579
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
3580
|
+
key, true));
|
|
3581
|
+
}
|
|
3582
|
+
});
|
|
3583
|
+
return output;
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
|
|
3587
|
+
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
3588
|
+
var name, str, desc;
|
|
3589
|
+
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
|
3590
|
+
if (desc.get) {
|
|
3591
|
+
if (desc.set) {
|
|
3592
|
+
str = ctx.stylize('[Getter/Setter]', 'special');
|
|
3593
|
+
} else {
|
|
3594
|
+
str = ctx.stylize('[Getter]', 'special');
|
|
3595
|
+
}
|
|
3596
|
+
} else {
|
|
3597
|
+
if (desc.set) {
|
|
3598
|
+
str = ctx.stylize('[Setter]', 'special');
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
|
3602
|
+
name = '[' + key + ']';
|
|
3603
|
+
}
|
|
3604
|
+
if (!str) {
|
|
3605
|
+
if (ctx.seen.indexOf(desc.value) < 0) {
|
|
3606
|
+
if (isNull(recurseTimes)) {
|
|
3607
|
+
str = formatValue(ctx, desc.value, null);
|
|
3608
|
+
} else {
|
|
3609
|
+
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
|
3610
|
+
}
|
|
3611
|
+
if (str.indexOf('\n') > -1) {
|
|
3612
|
+
if (array) {
|
|
3613
|
+
str = str.split('\n').map(function(line) {
|
|
3614
|
+
return ' ' + line;
|
|
3615
|
+
}).join('\n').substr(2);
|
|
3616
|
+
} else {
|
|
3617
|
+
str = '\n' + str.split('\n').map(function(line) {
|
|
3618
|
+
return ' ' + line;
|
|
3619
|
+
}).join('\n');
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
} else {
|
|
3623
|
+
str = ctx.stylize('[Circular]', 'special');
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
if (isUndefined(name)) {
|
|
3627
|
+
if (array && key.match(/^\d+$/)) {
|
|
3628
|
+
return str;
|
|
3629
|
+
}
|
|
3630
|
+
name = JSON.stringify('' + key);
|
|
3631
|
+
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
|
3632
|
+
name = name.substr(1, name.length - 2);
|
|
3633
|
+
name = ctx.stylize(name, 'name');
|
|
3634
|
+
} else {
|
|
3635
|
+
name = name.replace(/'/g, "\\'")
|
|
3636
|
+
.replace(/\\"/g, '"')
|
|
3637
|
+
.replace(/(^"|"$)/g, "'");
|
|
3638
|
+
name = ctx.stylize(name, 'string');
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
return name + ': ' + str;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
|
|
3646
|
+
function reduceToSingleString(output, base, braces) {
|
|
3647
|
+
var length = output.reduce(function(prev, cur) {
|
|
3648
|
+
if (cur.indexOf('\n') >= 0) ;
|
|
3649
|
+
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
|
3650
|
+
}, 0);
|
|
3651
|
+
|
|
3652
|
+
if (length > 60) {
|
|
3653
|
+
return braces[0] +
|
|
3654
|
+
(base === '' ? '' : base + '\n ') +
|
|
3655
|
+
' ' +
|
|
3656
|
+
output.join(',\n ') +
|
|
3657
|
+
' ' +
|
|
3658
|
+
braces[1];
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3661
|
+
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
|
|
3665
|
+
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
3666
|
+
// because it is fragile and can be easily faked with `Object.create()`.
|
|
3667
|
+
function isArray$3(ar) {
|
|
3668
|
+
return Array.isArray(ar);
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
function isBoolean$1(arg) {
|
|
3672
|
+
return typeof arg === 'boolean';
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3675
|
+
function isNull(arg) {
|
|
3676
|
+
return arg === null;
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
function isNullOrUndefined(arg) {
|
|
3680
|
+
return arg == null;
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
function isNumber$1(arg) {
|
|
3684
|
+
return typeof arg === 'number';
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
function isString$1(arg) {
|
|
3688
|
+
return typeof arg === 'string';
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
function isSymbol$1(arg) {
|
|
3692
|
+
return typeof arg === 'symbol';
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
function isUndefined(arg) {
|
|
3696
|
+
return arg === void 0;
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
function isRegExp$2(re) {
|
|
3700
|
+
return isObject(re) && objectToString$1(re) === '[object RegExp]';
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
function isObject(arg) {
|
|
3704
|
+
return typeof arg === 'object' && arg !== null;
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
function isDate$1(d) {
|
|
3708
|
+
return isObject(d) && objectToString$1(d) === '[object Date]';
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3711
|
+
function isError$1(e) {
|
|
3712
|
+
return isObject(e) &&
|
|
3713
|
+
(objectToString$1(e) === '[object Error]' || e instanceof Error);
|
|
3714
|
+
}
|
|
3715
|
+
|
|
3716
|
+
function isFunction(arg) {
|
|
3717
|
+
return typeof arg === 'function';
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
function isPrimitive(arg) {
|
|
3721
|
+
return arg === null ||
|
|
3722
|
+
typeof arg === 'boolean' ||
|
|
3723
|
+
typeof arg === 'number' ||
|
|
3724
|
+
typeof arg === 'string' ||
|
|
3725
|
+
typeof arg === 'symbol' || // ES6 symbol
|
|
3726
|
+
typeof arg === 'undefined';
|
|
3727
|
+
}
|
|
3728
|
+
|
|
3729
|
+
function isBuffer$1(maybeBuf) {
|
|
3730
|
+
return Buffer$1.isBuffer(maybeBuf);
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
function objectToString$1(o) {
|
|
3734
|
+
return Object.prototype.toString.call(o);
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
|
|
3738
|
+
function pad(n) {
|
|
3739
|
+
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
|
|
3743
|
+
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
|
3744
|
+
'Oct', 'Nov', 'Dec'];
|
|
3745
|
+
|
|
3746
|
+
// 26 Feb 16:19:34
|
|
3747
|
+
function timestamp() {
|
|
3748
|
+
var d = new Date();
|
|
3749
|
+
var time = [pad(d.getHours()),
|
|
3750
|
+
pad(d.getMinutes()),
|
|
3751
|
+
pad(d.getSeconds())].join(':');
|
|
3752
|
+
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
|
|
3756
|
+
// log is just a thin wrapper to console.log that prepends a timestamp
|
|
3757
|
+
function log() {
|
|
3758
|
+
console.log('%s - %s', timestamp(), format.apply(null, arguments));
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3761
|
+
function _extend(origin, add) {
|
|
3762
|
+
// Don't do anything if add isn't an object
|
|
3763
|
+
if (!add || !isObject(add)) return origin;
|
|
3764
|
+
|
|
3765
|
+
var keys = Object.keys(add);
|
|
3766
|
+
var i = keys.length;
|
|
3767
|
+
while (i--) {
|
|
3768
|
+
origin[keys[i]] = add[keys[i]];
|
|
3769
|
+
}
|
|
3770
|
+
return origin;
|
|
3771
|
+
}
|
|
3772
|
+
function hasOwnProperty(obj, prop) {
|
|
3773
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
|
|
3777
|
+
|
|
3778
|
+
function promisify(original) {
|
|
3779
|
+
if (typeof original !== 'function')
|
|
3780
|
+
throw new TypeError('The "original" argument must be of type Function');
|
|
3781
|
+
|
|
3782
|
+
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
|
3783
|
+
var fn = original[kCustomPromisifiedSymbol];
|
|
3784
|
+
if (typeof fn !== 'function') {
|
|
3785
|
+
throw new TypeError('The "util.promisify.custom" argument must be of type Function');
|
|
3786
|
+
}
|
|
3787
|
+
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
|
3788
|
+
value: fn, enumerable: false, writable: false, configurable: true
|
|
3789
|
+
});
|
|
3790
|
+
return fn;
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
function fn() {
|
|
3794
|
+
var promiseResolve, promiseReject;
|
|
3795
|
+
var promise = new Promise(function (resolve, reject) {
|
|
3796
|
+
promiseResolve = resolve;
|
|
3797
|
+
promiseReject = reject;
|
|
3798
|
+
});
|
|
3799
|
+
|
|
3800
|
+
var args = [];
|
|
3801
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
3802
|
+
args.push(arguments[i]);
|
|
3803
|
+
}
|
|
3804
|
+
args.push(function (err, value) {
|
|
3805
|
+
if (err) {
|
|
3806
|
+
promiseReject(err);
|
|
3807
|
+
} else {
|
|
3808
|
+
promiseResolve(value);
|
|
3809
|
+
}
|
|
3810
|
+
});
|
|
3811
|
+
|
|
3812
|
+
try {
|
|
3813
|
+
original.apply(this, args);
|
|
3814
|
+
} catch (err) {
|
|
3815
|
+
promiseReject(err);
|
|
3816
|
+
}
|
|
3817
|
+
|
|
3818
|
+
return promise;
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
|
|
3822
|
+
|
|
3823
|
+
if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
|
3824
|
+
value: fn, enumerable: false, writable: false, configurable: true
|
|
3825
|
+
});
|
|
3826
|
+
return Object.defineProperties(
|
|
3827
|
+
fn,
|
|
3828
|
+
getOwnPropertyDescriptors(original)
|
|
3829
|
+
);
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
promisify.custom = kCustomPromisifiedSymbol;
|
|
3833
|
+
|
|
3834
|
+
function callbackifyOnRejected(reason, cb) {
|
|
3835
|
+
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
|
|
3836
|
+
// Because `null` is a special error value in callbacks which means "no error
|
|
3837
|
+
// occurred", we error-wrap so the callback consumer can distinguish between
|
|
3838
|
+
// "the promise rejected with null" or "the promise fulfilled with undefined".
|
|
3839
|
+
if (!reason) {
|
|
3840
|
+
var newReason = new Error('Promise was rejected with a falsy value');
|
|
3841
|
+
newReason.reason = reason;
|
|
3842
|
+
reason = newReason;
|
|
3843
|
+
}
|
|
3844
|
+
return cb(reason);
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3847
|
+
function callbackify(original) {
|
|
3848
|
+
if (typeof original !== 'function') {
|
|
3849
|
+
throw new TypeError('The "original" argument must be of type Function');
|
|
3850
|
+
}
|
|
3851
|
+
|
|
3852
|
+
// We DO NOT return the promise as it gives the user a false sense that
|
|
3853
|
+
// the promise is actually somehow related to the callback's execution
|
|
3854
|
+
// and that the callback throwing will reject the promise.
|
|
3855
|
+
function callbackified() {
|
|
3856
|
+
var args = [];
|
|
3857
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
3858
|
+
args.push(arguments[i]);
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
var maybeCb = args.pop();
|
|
3862
|
+
if (typeof maybeCb !== 'function') {
|
|
3863
|
+
throw new TypeError('The last argument must be of type Function');
|
|
3864
|
+
}
|
|
3865
|
+
var self = this;
|
|
3866
|
+
var cb = function() {
|
|
3867
|
+
return maybeCb.apply(self, arguments);
|
|
3868
|
+
};
|
|
3869
|
+
// In true node style we process the callback on `nextTick` with all the
|
|
3870
|
+
// implications (stack, `uncaughtException`, `async_hooks`)
|
|
3871
|
+
original.apply(this, args)
|
|
3872
|
+
.then(function(ret) { browser$1.nextTick(cb.bind(null, null, ret)); },
|
|
3873
|
+
function(rej) { browser$1.nextTick(callbackifyOnRejected.bind(null, rej, cb)); });
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
|
|
3877
|
+
Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
|
|
3878
|
+
return callbackified;
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3881
|
+
var _polyfillNode_util = {
|
|
3882
|
+
inherits: inherits$1,
|
|
3883
|
+
_extend: _extend,
|
|
3884
|
+
log: log,
|
|
3885
|
+
isBuffer: isBuffer$1,
|
|
3886
|
+
isPrimitive: isPrimitive,
|
|
3887
|
+
isFunction: isFunction,
|
|
3888
|
+
isError: isError$1,
|
|
3889
|
+
isDate: isDate$1,
|
|
3890
|
+
isObject: isObject,
|
|
3891
|
+
isRegExp: isRegExp$2,
|
|
3892
|
+
isUndefined: isUndefined,
|
|
3893
|
+
isSymbol: isSymbol$1,
|
|
3894
|
+
isString: isString$1,
|
|
3895
|
+
isNumber: isNumber$1,
|
|
3896
|
+
isNullOrUndefined: isNullOrUndefined,
|
|
3897
|
+
isNull: isNull,
|
|
3898
|
+
isBoolean: isBoolean$1,
|
|
3899
|
+
isArray: isArray$3,
|
|
3900
|
+
inspect: inspect$1,
|
|
3901
|
+
deprecate: deprecate,
|
|
3902
|
+
format: format,
|
|
3903
|
+
debuglog: debuglog,
|
|
3904
|
+
promisify: promisify,
|
|
3905
|
+
callbackify: callbackify,
|
|
3906
|
+
};
|
|
3907
|
+
|
|
3908
|
+
var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
3909
|
+
__proto__: null,
|
|
3910
|
+
_extend: _extend,
|
|
3911
|
+
callbackify: callbackify,
|
|
3912
|
+
debuglog: debuglog,
|
|
3913
|
+
default: _polyfillNode_util,
|
|
3914
|
+
deprecate: deprecate,
|
|
3915
|
+
format: format,
|
|
3916
|
+
inherits: inherits$1,
|
|
3917
|
+
inspect: inspect$1,
|
|
3918
|
+
isArray: isArray$3,
|
|
3919
|
+
isBoolean: isBoolean$1,
|
|
3920
|
+
isBuffer: isBuffer$1,
|
|
3921
|
+
isDate: isDate$1,
|
|
3922
|
+
isError: isError$1,
|
|
3923
|
+
isFunction: isFunction,
|
|
3924
|
+
isNull: isNull,
|
|
3925
|
+
isNullOrUndefined: isNullOrUndefined,
|
|
3926
|
+
isNumber: isNumber$1,
|
|
3927
|
+
isObject: isObject,
|
|
3928
|
+
isPrimitive: isPrimitive,
|
|
3929
|
+
isRegExp: isRegExp$2,
|
|
3930
|
+
isString: isString$1,
|
|
3931
|
+
isSymbol: isSymbol$1,
|
|
3932
|
+
isUndefined: isUndefined,
|
|
3933
|
+
log: log,
|
|
3934
|
+
promisify: promisify
|
|
3935
|
+
});
|
|
3936
|
+
|
|
3937
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_util$1);
|
|
3938
|
+
|
|
3939
|
+
var util_inspect = require$$0.inspect;
|
|
3940
|
+
|
|
3941
|
+
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
3942
|
+
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
3943
|
+
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
3944
|
+
var mapForEach = hasMap && Map.prototype.forEach;
|
|
3945
|
+
var hasSet = typeof Set === 'function' && Set.prototype;
|
|
3946
|
+
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
|
3947
|
+
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
|
3948
|
+
var setForEach = hasSet && Set.prototype.forEach;
|
|
3949
|
+
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
|
|
3950
|
+
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
|
|
3951
|
+
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
|
|
3952
|
+
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
|
|
3953
|
+
var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
|
|
3954
|
+
var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
|
|
3955
|
+
var booleanValueOf = Boolean.prototype.valueOf;
|
|
3956
|
+
var objectToString = Object.prototype.toString;
|
|
3957
|
+
var functionToString = Function.prototype.toString;
|
|
3958
|
+
var $match = String.prototype.match;
|
|
3959
|
+
var $slice = String.prototype.slice;
|
|
3960
|
+
var $replace = String.prototype.replace;
|
|
3961
|
+
var $toUpperCase = String.prototype.toUpperCase;
|
|
3962
|
+
var $toLowerCase = String.prototype.toLowerCase;
|
|
3963
|
+
var $test = RegExp.prototype.test;
|
|
3964
|
+
var $concat = Array.prototype.concat;
|
|
3965
|
+
var $join = Array.prototype.join;
|
|
3966
|
+
var $arrSlice = Array.prototype.slice;
|
|
3967
|
+
var $floor = Math.floor;
|
|
3968
|
+
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
3969
|
+
var gOPS = Object.getOwnPropertySymbols;
|
|
3970
|
+
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
|
3971
|
+
var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
|
|
3972
|
+
// ie, `has-tostringtag/shams
|
|
3973
|
+
var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
|
|
3974
|
+
? Symbol.toStringTag
|
|
3975
|
+
: null;
|
|
3976
|
+
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
3977
|
+
|
|
3978
|
+
var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
|
|
3979
|
+
[].__proto__ === Array.prototype // eslint-disable-line no-proto
|
|
3980
|
+
? function (O) {
|
|
3981
|
+
return O.__proto__; // eslint-disable-line no-proto
|
|
3982
|
+
}
|
|
3983
|
+
: null
|
|
3984
|
+
);
|
|
3985
|
+
|
|
3986
|
+
function addNumericSeparator(num, str) {
|
|
3987
|
+
if (
|
|
3988
|
+
num === Infinity
|
|
3989
|
+
|| num === -Infinity
|
|
3990
|
+
|| num !== num
|
|
3991
|
+
|| (num && num > -1000 && num < 1000)
|
|
3992
|
+
|| $test.call(/e/, str)
|
|
3993
|
+
) {
|
|
3994
|
+
return str;
|
|
3995
|
+
}
|
|
3996
|
+
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
3997
|
+
if (typeof num === 'number') {
|
|
3998
|
+
var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
|
|
3999
|
+
if (int !== num) {
|
|
4000
|
+
var intStr = String(int);
|
|
4001
|
+
var dec = $slice.call(str, intStr.length + 1);
|
|
4002
|
+
return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
return $replace.call(str, sepRegex, '$&_');
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
var utilInspect = util_inspect;
|
|
4009
|
+
var inspectCustom = utilInspect.custom;
|
|
4010
|
+
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
|
4011
|
+
|
|
4012
|
+
var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
4013
|
+
var opts = options || {};
|
|
4014
|
+
|
|
4015
|
+
if (has$2(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
|
4016
|
+
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
4017
|
+
}
|
|
4018
|
+
if (
|
|
4019
|
+
has$2(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
|
|
4020
|
+
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
|
|
4021
|
+
: opts.maxStringLength !== null
|
|
4022
|
+
)
|
|
4023
|
+
) {
|
|
4024
|
+
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
|
4025
|
+
}
|
|
4026
|
+
var customInspect = has$2(opts, 'customInspect') ? opts.customInspect : true;
|
|
4027
|
+
if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
|
|
4028
|
+
throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
if (
|
|
4032
|
+
has$2(opts, 'indent')
|
|
4033
|
+
&& opts.indent !== null
|
|
4034
|
+
&& opts.indent !== '\t'
|
|
4035
|
+
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
|
4036
|
+
) {
|
|
4037
|
+
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
|
4038
|
+
}
|
|
4039
|
+
if (has$2(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
|
|
4040
|
+
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
|
4041
|
+
}
|
|
4042
|
+
var numericSeparator = opts.numericSeparator;
|
|
4043
|
+
|
|
4044
|
+
if (typeof obj === 'undefined') {
|
|
4045
|
+
return 'undefined';
|
|
4046
|
+
}
|
|
4047
|
+
if (obj === null) {
|
|
4048
|
+
return 'null';
|
|
4049
|
+
}
|
|
4050
|
+
if (typeof obj === 'boolean') {
|
|
4051
|
+
return obj ? 'true' : 'false';
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
if (typeof obj === 'string') {
|
|
4055
|
+
return inspectString(obj, opts);
|
|
4056
|
+
}
|
|
4057
|
+
if (typeof obj === 'number') {
|
|
4058
|
+
if (obj === 0) {
|
|
4059
|
+
return Infinity / obj > 0 ? '0' : '-0';
|
|
4060
|
+
}
|
|
4061
|
+
var str = String(obj);
|
|
4062
|
+
return numericSeparator ? addNumericSeparator(obj, str) : str;
|
|
4063
|
+
}
|
|
4064
|
+
if (typeof obj === 'bigint') {
|
|
4065
|
+
var bigIntStr = String(obj) + 'n';
|
|
4066
|
+
return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4069
|
+
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
|
4070
|
+
if (typeof depth === 'undefined') { depth = 0; }
|
|
4071
|
+
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
|
4072
|
+
return isArray$2(obj) ? '[Array]' : '[Object]';
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
var indent = getIndent(opts, depth);
|
|
4076
|
+
|
|
4077
|
+
if (typeof seen === 'undefined') {
|
|
4078
|
+
seen = [];
|
|
4079
|
+
} else if (indexOf(seen, obj) >= 0) {
|
|
4080
|
+
return '[Circular]';
|
|
4081
|
+
}
|
|
4082
|
+
|
|
4083
|
+
function inspect(value, from, noIndent) {
|
|
4084
|
+
if (from) {
|
|
4085
|
+
seen = $arrSlice.call(seen);
|
|
4086
|
+
seen.push(from);
|
|
4087
|
+
}
|
|
4088
|
+
if (noIndent) {
|
|
4089
|
+
var newOpts = {
|
|
4090
|
+
depth: opts.depth
|
|
4091
|
+
};
|
|
4092
|
+
if (has$2(opts, 'quoteStyle')) {
|
|
4093
|
+
newOpts.quoteStyle = opts.quoteStyle;
|
|
4094
|
+
}
|
|
4095
|
+
return inspect_(value, newOpts, depth + 1, seen);
|
|
4096
|
+
}
|
|
4097
|
+
return inspect_(value, opts, depth + 1, seen);
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
|
|
4101
|
+
var name = nameOf(obj);
|
|
4102
|
+
var keys = arrObjKeys(obj, inspect);
|
|
4103
|
+
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
|
|
4104
|
+
}
|
|
4105
|
+
if (isSymbol(obj)) {
|
|
4106
|
+
var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
|
|
4107
|
+
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
|
|
4108
|
+
}
|
|
4109
|
+
if (isElement(obj)) {
|
|
4110
|
+
var s = '<' + $toLowerCase.call(String(obj.nodeName));
|
|
4111
|
+
var attrs = obj.attributes || [];
|
|
4112
|
+
for (var i = 0; i < attrs.length; i++) {
|
|
4113
|
+
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
|
4114
|
+
}
|
|
4115
|
+
s += '>';
|
|
4116
|
+
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
|
4117
|
+
s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
|
|
4118
|
+
return s;
|
|
4119
|
+
}
|
|
4120
|
+
if (isArray$2(obj)) {
|
|
4121
|
+
if (obj.length === 0) { return '[]'; }
|
|
4122
|
+
var xs = arrObjKeys(obj, inspect);
|
|
4123
|
+
if (indent && !singleLineValues(xs)) {
|
|
4124
|
+
return '[' + indentedJoin(xs, indent) + ']';
|
|
4125
|
+
}
|
|
4126
|
+
return '[ ' + $join.call(xs, ', ') + ' ]';
|
|
4127
|
+
}
|
|
4128
|
+
if (isError(obj)) {
|
|
4129
|
+
var parts = arrObjKeys(obj, inspect);
|
|
4130
|
+
if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
|
|
4131
|
+
return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
|
|
4132
|
+
}
|
|
4133
|
+
if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
|
4134
|
+
return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
|
|
4135
|
+
}
|
|
4136
|
+
if (typeof obj === 'object' && customInspect) {
|
|
4137
|
+
if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
|
|
4138
|
+
return utilInspect(obj, { depth: maxDepth - depth });
|
|
4139
|
+
} else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
|
|
4140
|
+
return obj.inspect();
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
if (isMap(obj)) {
|
|
4144
|
+
var mapParts = [];
|
|
4145
|
+
if (mapForEach) {
|
|
4146
|
+
mapForEach.call(obj, function (value, key) {
|
|
4147
|
+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
4148
|
+
});
|
|
4149
|
+
}
|
|
4150
|
+
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
4151
|
+
}
|
|
4152
|
+
if (isSet(obj)) {
|
|
4153
|
+
var setParts = [];
|
|
4154
|
+
if (setForEach) {
|
|
4155
|
+
setForEach.call(obj, function (value) {
|
|
4156
|
+
setParts.push(inspect(value, obj));
|
|
4157
|
+
});
|
|
4158
|
+
}
|
|
4159
|
+
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
4160
|
+
}
|
|
4161
|
+
if (isWeakMap(obj)) {
|
|
4162
|
+
return weakCollectionOf('WeakMap');
|
|
4163
|
+
}
|
|
4164
|
+
if (isWeakSet(obj)) {
|
|
4165
|
+
return weakCollectionOf('WeakSet');
|
|
4166
|
+
}
|
|
4167
|
+
if (isWeakRef(obj)) {
|
|
4168
|
+
return weakCollectionOf('WeakRef');
|
|
4169
|
+
}
|
|
4170
|
+
if (isNumber(obj)) {
|
|
4171
|
+
return markBoxed(inspect(Number(obj)));
|
|
4172
|
+
}
|
|
4173
|
+
if (isBigInt(obj)) {
|
|
4174
|
+
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
|
4175
|
+
}
|
|
4176
|
+
if (isBoolean(obj)) {
|
|
4177
|
+
return markBoxed(booleanValueOf.call(obj));
|
|
4178
|
+
}
|
|
4179
|
+
if (isString(obj)) {
|
|
4180
|
+
return markBoxed(inspect(String(obj)));
|
|
4181
|
+
}
|
|
4182
|
+
if (!isDate(obj) && !isRegExp$1(obj)) {
|
|
4183
|
+
var ys = arrObjKeys(obj, inspect);
|
|
4184
|
+
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
4185
|
+
var protoTag = obj instanceof Object ? '' : 'null prototype';
|
|
4186
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
|
|
4187
|
+
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
|
|
4188
|
+
var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
|
|
4189
|
+
if (ys.length === 0) { return tag + '{}'; }
|
|
4190
|
+
if (indent) {
|
|
4191
|
+
return tag + '{' + indentedJoin(ys, indent) + '}';
|
|
4192
|
+
}
|
|
4193
|
+
return tag + '{ ' + $join.call(ys, ', ') + ' }';
|
|
4194
|
+
}
|
|
4195
|
+
return String(obj);
|
|
4196
|
+
};
|
|
4197
|
+
|
|
4198
|
+
function wrapQuotes(s, defaultStyle, opts) {
|
|
4199
|
+
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
|
4200
|
+
return quoteChar + s + quoteChar;
|
|
4201
|
+
}
|
|
4202
|
+
|
|
4203
|
+
function quote(s) {
|
|
4204
|
+
return $replace.call(String(s), /"/g, '"');
|
|
4205
|
+
}
|
|
4206
|
+
|
|
4207
|
+
function isArray$2(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4208
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4209
|
+
function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4210
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4211
|
+
function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4212
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4213
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
4214
|
+
|
|
4215
|
+
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
4216
|
+
function isSymbol(obj) {
|
|
4217
|
+
if (hasShammedSymbols) {
|
|
4218
|
+
return obj && typeof obj === 'object' && obj instanceof Symbol;
|
|
4219
|
+
}
|
|
4220
|
+
if (typeof obj === 'symbol') {
|
|
4221
|
+
return true;
|
|
4222
|
+
}
|
|
4223
|
+
if (!obj || typeof obj !== 'object' || !symToString) {
|
|
4224
|
+
return false;
|
|
4225
|
+
}
|
|
4226
|
+
try {
|
|
4227
|
+
symToString.call(obj);
|
|
4228
|
+
return true;
|
|
4229
|
+
} catch (e) {}
|
|
4230
|
+
return false;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
function isBigInt(obj) {
|
|
4234
|
+
if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
|
|
4235
|
+
return false;
|
|
4236
|
+
}
|
|
4237
|
+
try {
|
|
4238
|
+
bigIntValueOf.call(obj);
|
|
4239
|
+
return true;
|
|
4240
|
+
} catch (e) {}
|
|
4241
|
+
return false;
|
|
4242
|
+
}
|
|
4243
|
+
|
|
4244
|
+
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
|
4245
|
+
function has$2(obj, key) {
|
|
4246
|
+
return hasOwn.call(obj, key);
|
|
4247
|
+
}
|
|
4248
|
+
|
|
4249
|
+
function toStr(obj) {
|
|
4250
|
+
return objectToString.call(obj);
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
function nameOf(f) {
|
|
4254
|
+
if (f.name) { return f.name; }
|
|
4255
|
+
var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
4256
|
+
if (m) { return m[1]; }
|
|
4257
|
+
return null;
|
|
4258
|
+
}
|
|
4259
|
+
|
|
4260
|
+
function indexOf(xs, x) {
|
|
4261
|
+
if (xs.indexOf) { return xs.indexOf(x); }
|
|
4262
|
+
for (var i = 0, l = xs.length; i < l; i++) {
|
|
4263
|
+
if (xs[i] === x) { return i; }
|
|
4264
|
+
}
|
|
4265
|
+
return -1;
|
|
4266
|
+
}
|
|
4267
|
+
|
|
4268
|
+
function isMap(x) {
|
|
4269
|
+
if (!mapSize || !x || typeof x !== 'object') {
|
|
4270
|
+
return false;
|
|
4271
|
+
}
|
|
4272
|
+
try {
|
|
4273
|
+
mapSize.call(x);
|
|
4274
|
+
try {
|
|
4275
|
+
setSize.call(x);
|
|
4276
|
+
} catch (s) {
|
|
4277
|
+
return true;
|
|
4278
|
+
}
|
|
4279
|
+
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
|
4280
|
+
} catch (e) {}
|
|
4281
|
+
return false;
|
|
4282
|
+
}
|
|
4283
|
+
|
|
4284
|
+
function isWeakMap(x) {
|
|
4285
|
+
if (!weakMapHas || !x || typeof x !== 'object') {
|
|
4286
|
+
return false;
|
|
4287
|
+
}
|
|
4288
|
+
try {
|
|
4289
|
+
weakMapHas.call(x, weakMapHas);
|
|
4290
|
+
try {
|
|
4291
|
+
weakSetHas.call(x, weakSetHas);
|
|
4292
|
+
} catch (s) {
|
|
4293
|
+
return true;
|
|
4294
|
+
}
|
|
4295
|
+
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
|
|
4296
|
+
} catch (e) {}
|
|
4297
|
+
return false;
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
function isWeakRef(x) {
|
|
4301
|
+
if (!weakRefDeref || !x || typeof x !== 'object') {
|
|
4302
|
+
return false;
|
|
4303
|
+
}
|
|
4304
|
+
try {
|
|
4305
|
+
weakRefDeref.call(x);
|
|
4306
|
+
return true;
|
|
4307
|
+
} catch (e) {}
|
|
4308
|
+
return false;
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4311
|
+
function isSet(x) {
|
|
4312
|
+
if (!setSize || !x || typeof x !== 'object') {
|
|
4313
|
+
return false;
|
|
4314
|
+
}
|
|
4315
|
+
try {
|
|
4316
|
+
setSize.call(x);
|
|
4317
|
+
try {
|
|
4318
|
+
mapSize.call(x);
|
|
4319
|
+
} catch (m) {
|
|
4320
|
+
return true;
|
|
4321
|
+
}
|
|
4322
|
+
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
|
4323
|
+
} catch (e) {}
|
|
4324
|
+
return false;
|
|
4325
|
+
}
|
|
4326
|
+
|
|
4327
|
+
function isWeakSet(x) {
|
|
4328
|
+
if (!weakSetHas || !x || typeof x !== 'object') {
|
|
4329
|
+
return false;
|
|
4330
|
+
}
|
|
4331
|
+
try {
|
|
4332
|
+
weakSetHas.call(x, weakSetHas);
|
|
4333
|
+
try {
|
|
4334
|
+
weakMapHas.call(x, weakMapHas);
|
|
4335
|
+
} catch (s) {
|
|
4336
|
+
return true;
|
|
4337
|
+
}
|
|
4338
|
+
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
|
|
4339
|
+
} catch (e) {}
|
|
4340
|
+
return false;
|
|
4341
|
+
}
|
|
4342
|
+
|
|
4343
|
+
function isElement(x) {
|
|
4344
|
+
if (!x || typeof x !== 'object') { return false; }
|
|
4345
|
+
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
|
4346
|
+
return true;
|
|
4347
|
+
}
|
|
4348
|
+
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
function inspectString(str, opts) {
|
|
4352
|
+
if (str.length > opts.maxStringLength) {
|
|
4353
|
+
var remaining = str.length - opts.maxStringLength;
|
|
4354
|
+
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
4355
|
+
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
4356
|
+
}
|
|
4357
|
+
// eslint-disable-next-line no-control-regex
|
|
4358
|
+
var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
4359
|
+
return wrapQuotes(s, 'single', opts);
|
|
4360
|
+
}
|
|
4361
|
+
|
|
4362
|
+
function lowbyte(c) {
|
|
4363
|
+
var n = c.charCodeAt(0);
|
|
4364
|
+
var x = {
|
|
4365
|
+
8: 'b',
|
|
4366
|
+
9: 't',
|
|
4367
|
+
10: 'n',
|
|
4368
|
+
12: 'f',
|
|
4369
|
+
13: 'r'
|
|
4370
|
+
}[n];
|
|
4371
|
+
if (x) { return '\\' + x; }
|
|
4372
|
+
return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
|
|
4373
|
+
}
|
|
4374
|
+
|
|
4375
|
+
function markBoxed(str) {
|
|
4376
|
+
return 'Object(' + str + ')';
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
function weakCollectionOf(type) {
|
|
4380
|
+
return type + ' { ? }';
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4383
|
+
function collectionOf(type, size, entries, indent) {
|
|
4384
|
+
var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
|
|
4385
|
+
return type + ' (' + size + ') {' + joinedEntries + '}';
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4388
|
+
function singleLineValues(xs) {
|
|
4389
|
+
for (var i = 0; i < xs.length; i++) {
|
|
4390
|
+
if (indexOf(xs[i], '\n') >= 0) {
|
|
4391
|
+
return false;
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4394
|
+
return true;
|
|
4395
|
+
}
|
|
4396
|
+
|
|
4397
|
+
function getIndent(opts, depth) {
|
|
4398
|
+
var baseIndent;
|
|
4399
|
+
if (opts.indent === '\t') {
|
|
4400
|
+
baseIndent = '\t';
|
|
4401
|
+
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
|
4402
|
+
baseIndent = $join.call(Array(opts.indent + 1), ' ');
|
|
4403
|
+
} else {
|
|
4404
|
+
return null;
|
|
4405
|
+
}
|
|
4406
|
+
return {
|
|
4407
|
+
base: baseIndent,
|
|
4408
|
+
prev: $join.call(Array(depth + 1), baseIndent)
|
|
4409
|
+
};
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
function indentedJoin(xs, indent) {
|
|
4413
|
+
if (xs.length === 0) { return ''; }
|
|
4414
|
+
var lineJoiner = '\n' + indent.prev + indent.base;
|
|
4415
|
+
return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4418
|
+
function arrObjKeys(obj, inspect) {
|
|
4419
|
+
var isArr = isArray$2(obj);
|
|
4420
|
+
var xs = [];
|
|
4421
|
+
if (isArr) {
|
|
4422
|
+
xs.length = obj.length;
|
|
4423
|
+
for (var i = 0; i < obj.length; i++) {
|
|
4424
|
+
xs[i] = has$2(obj, i) ? inspect(obj[i], obj) : '';
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
|
|
4428
|
+
var symMap;
|
|
4429
|
+
if (hasShammedSymbols) {
|
|
4430
|
+
symMap = {};
|
|
4431
|
+
for (var k = 0; k < syms.length; k++) {
|
|
4432
|
+
symMap['$' + syms[k]] = syms[k];
|
|
4433
|
+
}
|
|
4434
|
+
}
|
|
4435
|
+
|
|
4436
|
+
for (var key in obj) { // eslint-disable-line no-restricted-syntax
|
|
4437
|
+
if (!has$2(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
4438
|
+
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
4439
|
+
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
|
|
4440
|
+
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
4441
|
+
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
|
4442
|
+
} else if ($test.call(/[^\w$]/, key)) {
|
|
4443
|
+
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
|
4444
|
+
} else {
|
|
4445
|
+
xs.push(key + ': ' + inspect(obj[key], obj));
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
if (typeof gOPS === 'function') {
|
|
4449
|
+
for (var j = 0; j < syms.length; j++) {
|
|
4450
|
+
if (isEnumerable.call(obj, syms[j])) {
|
|
4451
|
+
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
|
|
4452
|
+
}
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
return xs;
|
|
4456
|
+
}
|
|
4457
|
+
|
|
4458
|
+
var GetIntrinsic = getIntrinsic;
|
|
4459
|
+
var callBound = callBound$1;
|
|
4460
|
+
var inspect = objectInspect;
|
|
4461
|
+
|
|
4462
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
4463
|
+
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
4464
|
+
var $Map = GetIntrinsic('%Map%', true);
|
|
4465
|
+
|
|
4466
|
+
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
4467
|
+
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
4468
|
+
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
4469
|
+
var $mapGet = callBound('Map.prototype.get', true);
|
|
4470
|
+
var $mapSet = callBound('Map.prototype.set', true);
|
|
4471
|
+
var $mapHas = callBound('Map.prototype.has', true);
|
|
4472
|
+
|
|
4473
|
+
/*
|
|
4474
|
+
* This function traverses the list returning the node corresponding to the
|
|
4475
|
+
* given key.
|
|
4476
|
+
*
|
|
4477
|
+
* That node is also moved to the head of the list, so that if it's accessed
|
|
4478
|
+
* again we don't need to traverse the whole list. By doing so, all the recently
|
|
4479
|
+
* used nodes can be accessed relatively quickly.
|
|
4480
|
+
*/
|
|
4481
|
+
var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
|
4482
|
+
for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
|
|
4483
|
+
if (curr.key === key) {
|
|
4484
|
+
prev.next = curr.next;
|
|
4485
|
+
curr.next = list.next;
|
|
4486
|
+
list.next = curr; // eslint-disable-line no-param-reassign
|
|
4487
|
+
return curr;
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
};
|
|
4491
|
+
|
|
4492
|
+
var listGet = function (objects, key) {
|
|
4493
|
+
var node = listGetNode(objects, key);
|
|
4494
|
+
return node && node.value;
|
|
4495
|
+
};
|
|
4496
|
+
var listSet = function (objects, key, value) {
|
|
4497
|
+
var node = listGetNode(objects, key);
|
|
4498
|
+
if (node) {
|
|
4499
|
+
node.value = value;
|
|
4500
|
+
} else {
|
|
4501
|
+
// Prepend the new node to the beginning of the list
|
|
4502
|
+
objects.next = { // eslint-disable-line no-param-reassign
|
|
4503
|
+
key: key,
|
|
4504
|
+
next: objects.next,
|
|
4505
|
+
value: value
|
|
4506
|
+
};
|
|
4507
|
+
}
|
|
4508
|
+
};
|
|
4509
|
+
var listHas = function (objects, key) {
|
|
4510
|
+
return !!listGetNode(objects, key);
|
|
4511
|
+
};
|
|
4512
|
+
|
|
4513
|
+
var sideChannel = function getSideChannel() {
|
|
4514
|
+
var $wm;
|
|
4515
|
+
var $m;
|
|
4516
|
+
var $o;
|
|
4517
|
+
var channel = {
|
|
4518
|
+
assert: function (key) {
|
|
4519
|
+
if (!channel.has(key)) {
|
|
4520
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
4521
|
+
}
|
|
4522
|
+
},
|
|
4523
|
+
get: function (key) { // eslint-disable-line consistent-return
|
|
4524
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
4525
|
+
if ($wm) {
|
|
4526
|
+
return $weakMapGet($wm, key);
|
|
4527
|
+
}
|
|
4528
|
+
} else if ($Map) {
|
|
4529
|
+
if ($m) {
|
|
4530
|
+
return $mapGet($m, key);
|
|
4531
|
+
}
|
|
4532
|
+
} else {
|
|
4533
|
+
if ($o) { // eslint-disable-line no-lonely-if
|
|
4534
|
+
return listGet($o, key);
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
},
|
|
4538
|
+
has: function (key) {
|
|
4539
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
4540
|
+
if ($wm) {
|
|
4541
|
+
return $weakMapHas($wm, key);
|
|
4542
|
+
}
|
|
4543
|
+
} else if ($Map) {
|
|
4544
|
+
if ($m) {
|
|
4545
|
+
return $mapHas($m, key);
|
|
4546
|
+
}
|
|
4547
|
+
} else {
|
|
4548
|
+
if ($o) { // eslint-disable-line no-lonely-if
|
|
4549
|
+
return listHas($o, key);
|
|
4550
|
+
}
|
|
4551
|
+
}
|
|
4552
|
+
return false;
|
|
4553
|
+
},
|
|
4554
|
+
set: function (key, value) {
|
|
4555
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
4556
|
+
if (!$wm) {
|
|
4557
|
+
$wm = new $WeakMap();
|
|
4558
|
+
}
|
|
4559
|
+
$weakMapSet($wm, key, value);
|
|
4560
|
+
} else if ($Map) {
|
|
4561
|
+
if (!$m) {
|
|
4562
|
+
$m = new $Map();
|
|
4563
|
+
}
|
|
4564
|
+
$mapSet($m, key, value);
|
|
4565
|
+
} else {
|
|
4566
|
+
if (!$o) {
|
|
4567
|
+
/*
|
|
4568
|
+
* Initialize the linked list as an empty node, so that we don't have
|
|
4569
|
+
* to special-case handling of the first node: we can always refer to
|
|
4570
|
+
* it as (previous node).next, instead of something like (list).head
|
|
4571
|
+
*/
|
|
4572
|
+
$o = { key: {}, next: null };
|
|
4573
|
+
}
|
|
4574
|
+
listSet($o, key, value);
|
|
4575
|
+
}
|
|
4576
|
+
}
|
|
4577
|
+
};
|
|
4578
|
+
return channel;
|
|
4579
|
+
};
|
|
4580
|
+
|
|
4581
|
+
var replace = String.prototype.replace;
|
|
4582
|
+
var percentTwenties = /%20/g;
|
|
4583
|
+
|
|
4584
|
+
var Format = {
|
|
4585
|
+
RFC1738: 'RFC1738',
|
|
4586
|
+
RFC3986: 'RFC3986'
|
|
4587
|
+
};
|
|
4588
|
+
|
|
4589
|
+
var formats$2 = {
|
|
4590
|
+
'default': Format.RFC3986,
|
|
4591
|
+
formatters: {
|
|
4592
|
+
RFC1738: function (value) {
|
|
4593
|
+
return replace.call(value, percentTwenties, '+');
|
|
4594
|
+
},
|
|
4595
|
+
RFC3986: function (value) {
|
|
4596
|
+
return String(value);
|
|
4597
|
+
}
|
|
4598
|
+
},
|
|
4599
|
+
RFC1738: Format.RFC1738,
|
|
4600
|
+
RFC3986: Format.RFC3986
|
|
4601
|
+
};
|
|
4602
|
+
|
|
4603
|
+
var formats$1 = formats$2;
|
|
4604
|
+
|
|
4605
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
4606
|
+
var isArray$1 = Array.isArray;
|
|
4607
|
+
|
|
4608
|
+
var hexTable = (function () {
|
|
4609
|
+
var array = [];
|
|
4610
|
+
for (var i = 0; i < 256; ++i) {
|
|
4611
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
4612
|
+
}
|
|
4613
|
+
|
|
4614
|
+
return array;
|
|
4615
|
+
}());
|
|
4616
|
+
|
|
4617
|
+
var compactQueue = function compactQueue(queue) {
|
|
4618
|
+
while (queue.length > 1) {
|
|
4619
|
+
var item = queue.pop();
|
|
4620
|
+
var obj = item.obj[item.prop];
|
|
4621
|
+
|
|
4622
|
+
if (isArray$1(obj)) {
|
|
4623
|
+
var compacted = [];
|
|
4624
|
+
|
|
4625
|
+
for (var j = 0; j < obj.length; ++j) {
|
|
4626
|
+
if (typeof obj[j] !== 'undefined') {
|
|
4627
|
+
compacted.push(obj[j]);
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
|
|
4631
|
+
item.obj[item.prop] = compacted;
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
};
|
|
4635
|
+
|
|
4636
|
+
var arrayToObject = function arrayToObject(source, options) {
|
|
4637
|
+
var obj = options && options.plainObjects ? Object.create(null) : {};
|
|
4638
|
+
for (var i = 0; i < source.length; ++i) {
|
|
4639
|
+
if (typeof source[i] !== 'undefined') {
|
|
4640
|
+
obj[i] = source[i];
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4644
|
+
return obj;
|
|
4645
|
+
};
|
|
4646
|
+
|
|
4647
|
+
var merge = function merge(target, source, options) {
|
|
4648
|
+
/* eslint no-param-reassign: 0 */
|
|
4649
|
+
if (!source) {
|
|
4650
|
+
return target;
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4653
|
+
if (typeof source !== 'object') {
|
|
4654
|
+
if (isArray$1(target)) {
|
|
4655
|
+
target.push(source);
|
|
4656
|
+
} else if (target && typeof target === 'object') {
|
|
4657
|
+
if ((options && (options.plainObjects || options.allowPrototypes)) || !has$1.call(Object.prototype, source)) {
|
|
4658
|
+
target[source] = true;
|
|
4659
|
+
}
|
|
4660
|
+
} else {
|
|
4661
|
+
return [target, source];
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
return target;
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
if (!target || typeof target !== 'object') {
|
|
4668
|
+
return [target].concat(source);
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4671
|
+
var mergeTarget = target;
|
|
4672
|
+
if (isArray$1(target) && !isArray$1(source)) {
|
|
4673
|
+
mergeTarget = arrayToObject(target, options);
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4676
|
+
if (isArray$1(target) && isArray$1(source)) {
|
|
4677
|
+
source.forEach(function (item, i) {
|
|
4678
|
+
if (has$1.call(target, i)) {
|
|
4679
|
+
var targetItem = target[i];
|
|
4680
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
4681
|
+
target[i] = merge(targetItem, item, options);
|
|
4682
|
+
} else {
|
|
4683
|
+
target.push(item);
|
|
4684
|
+
}
|
|
4685
|
+
} else {
|
|
4686
|
+
target[i] = item;
|
|
4687
|
+
}
|
|
4688
|
+
});
|
|
4689
|
+
return target;
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
4693
|
+
var value = source[key];
|
|
4694
|
+
|
|
4695
|
+
if (has$1.call(acc, key)) {
|
|
4696
|
+
acc[key] = merge(acc[key], value, options);
|
|
4697
|
+
} else {
|
|
4698
|
+
acc[key] = value;
|
|
4699
|
+
}
|
|
4700
|
+
return acc;
|
|
4701
|
+
}, mergeTarget);
|
|
4702
|
+
};
|
|
4703
|
+
|
|
4704
|
+
var assign = function assignSingleSource(target, source) {
|
|
4705
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
4706
|
+
acc[key] = source[key];
|
|
4707
|
+
return acc;
|
|
4708
|
+
}, target);
|
|
4709
|
+
};
|
|
4710
|
+
|
|
4711
|
+
var decode = function (str, decoder, charset) {
|
|
4712
|
+
var strWithoutPlus = str.replace(/\+/g, ' ');
|
|
4713
|
+
if (charset === 'iso-8859-1') {
|
|
4714
|
+
// unescape never throws, no try...catch needed:
|
|
4715
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
4716
|
+
}
|
|
4717
|
+
// utf-8
|
|
4718
|
+
try {
|
|
4719
|
+
return decodeURIComponent(strWithoutPlus);
|
|
4720
|
+
} catch (e) {
|
|
4721
|
+
return strWithoutPlus;
|
|
4722
|
+
}
|
|
4723
|
+
};
|
|
4724
|
+
|
|
4725
|
+
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
4726
|
+
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
4727
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
4728
|
+
if (str.length === 0) {
|
|
4729
|
+
return str;
|
|
4730
|
+
}
|
|
4731
|
+
|
|
4732
|
+
var string = str;
|
|
4733
|
+
if (typeof str === 'symbol') {
|
|
4734
|
+
string = Symbol.prototype.toString.call(str);
|
|
4735
|
+
} else if (typeof str !== 'string') {
|
|
4736
|
+
string = String(str);
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4739
|
+
if (charset === 'iso-8859-1') {
|
|
4740
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
4741
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
var out = '';
|
|
4746
|
+
for (var i = 0; i < string.length; ++i) {
|
|
4747
|
+
var c = string.charCodeAt(i);
|
|
4748
|
+
|
|
4749
|
+
if (
|
|
4750
|
+
c === 0x2D // -
|
|
4751
|
+
|| c === 0x2E // .
|
|
4752
|
+
|| c === 0x5F // _
|
|
4753
|
+
|| c === 0x7E // ~
|
|
4754
|
+
|| (c >= 0x30 && c <= 0x39) // 0-9
|
|
4755
|
+
|| (c >= 0x41 && c <= 0x5A) // a-z
|
|
4756
|
+
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
|
4757
|
+
|| (format === formats$1.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
4758
|
+
) {
|
|
4759
|
+
out += string.charAt(i);
|
|
4760
|
+
continue;
|
|
4761
|
+
}
|
|
4762
|
+
|
|
4763
|
+
if (c < 0x80) {
|
|
4764
|
+
out = out + hexTable[c];
|
|
4765
|
+
continue;
|
|
4766
|
+
}
|
|
4767
|
+
|
|
4768
|
+
if (c < 0x800) {
|
|
4769
|
+
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
|
|
4770
|
+
continue;
|
|
4771
|
+
}
|
|
4772
|
+
|
|
4773
|
+
if (c < 0xD800 || c >= 0xE000) {
|
|
4774
|
+
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
|
4775
|
+
continue;
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
i += 1;
|
|
4779
|
+
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
4780
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
4781
|
+
out += hexTable[0xF0 | (c >> 18)]
|
|
4782
|
+
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
4783
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
4784
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
return out;
|
|
4788
|
+
};
|
|
4789
|
+
|
|
4790
|
+
var compact = function compact(value) {
|
|
4791
|
+
var queue = [{ obj: { o: value }, prop: 'o' }];
|
|
4792
|
+
var refs = [];
|
|
4793
|
+
|
|
4794
|
+
for (var i = 0; i < queue.length; ++i) {
|
|
4795
|
+
var item = queue[i];
|
|
4796
|
+
var obj = item.obj[item.prop];
|
|
4797
|
+
|
|
4798
|
+
var keys = Object.keys(obj);
|
|
4799
|
+
for (var j = 0; j < keys.length; ++j) {
|
|
4800
|
+
var key = keys[j];
|
|
4801
|
+
var val = obj[key];
|
|
4802
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
4803
|
+
queue.push({ obj: obj, prop: key });
|
|
4804
|
+
refs.push(val);
|
|
4805
|
+
}
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
compactQueue(queue);
|
|
4810
|
+
|
|
4811
|
+
return value;
|
|
4812
|
+
};
|
|
4813
|
+
|
|
4814
|
+
var isRegExp = function isRegExp(obj) {
|
|
4815
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
4816
|
+
};
|
|
4817
|
+
|
|
4818
|
+
var isBuffer = function isBuffer(obj) {
|
|
4819
|
+
if (!obj || typeof obj !== 'object') {
|
|
4820
|
+
return false;
|
|
4821
|
+
}
|
|
4822
|
+
|
|
4823
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
4824
|
+
};
|
|
4825
|
+
|
|
4826
|
+
var combine = function combine(a, b) {
|
|
4827
|
+
return [].concat(a, b);
|
|
4828
|
+
};
|
|
4829
|
+
|
|
4830
|
+
var maybeMap = function maybeMap(val, fn) {
|
|
4831
|
+
if (isArray$1(val)) {
|
|
4832
|
+
var mapped = [];
|
|
4833
|
+
for (var i = 0; i < val.length; i += 1) {
|
|
4834
|
+
mapped.push(fn(val[i]));
|
|
4835
|
+
}
|
|
4836
|
+
return mapped;
|
|
4837
|
+
}
|
|
4838
|
+
return fn(val);
|
|
4839
|
+
};
|
|
4840
|
+
|
|
4841
|
+
var utils$1 = {
|
|
4842
|
+
arrayToObject: arrayToObject,
|
|
4843
|
+
assign: assign,
|
|
4844
|
+
combine: combine,
|
|
4845
|
+
compact: compact,
|
|
4846
|
+
decode: decode,
|
|
4847
|
+
encode: encode,
|
|
4848
|
+
isBuffer: isBuffer,
|
|
4849
|
+
isRegExp: isRegExp,
|
|
4850
|
+
maybeMap: maybeMap,
|
|
4851
|
+
merge: merge
|
|
4852
|
+
};
|
|
4853
|
+
|
|
4854
|
+
var getSideChannel = sideChannel;
|
|
4855
|
+
var utils = utils$1;
|
|
4856
|
+
var formats = formats$2;
|
|
4857
|
+
var has = Object.prototype.hasOwnProperty;
|
|
4858
|
+
|
|
4859
|
+
var arrayPrefixGenerators = {
|
|
4860
|
+
brackets: function brackets(prefix) {
|
|
4861
|
+
return prefix + '[]';
|
|
4862
|
+
},
|
|
4863
|
+
comma: 'comma',
|
|
4864
|
+
indices: function indices(prefix, key) {
|
|
4865
|
+
return prefix + '[' + key + ']';
|
|
4866
|
+
},
|
|
4867
|
+
repeat: function repeat(prefix) {
|
|
4868
|
+
return prefix;
|
|
4869
|
+
}
|
|
4870
|
+
};
|
|
4871
|
+
|
|
4872
|
+
var isArray = Array.isArray;
|
|
4873
|
+
var push = Array.prototype.push;
|
|
4874
|
+
var pushToArray = function (arr, valueOrArray) {
|
|
4875
|
+
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
4876
|
+
};
|
|
4877
|
+
|
|
4878
|
+
var toISO = Date.prototype.toISOString;
|
|
4879
|
+
|
|
4880
|
+
var defaultFormat = formats['default'];
|
|
4881
|
+
var defaults = {
|
|
4882
|
+
addQueryPrefix: false,
|
|
4883
|
+
allowDots: false,
|
|
4884
|
+
charset: 'utf-8',
|
|
4885
|
+
charsetSentinel: false,
|
|
4886
|
+
delimiter: '&',
|
|
4887
|
+
encode: true,
|
|
4888
|
+
encoder: utils.encode,
|
|
4889
|
+
encodeValuesOnly: false,
|
|
4890
|
+
format: defaultFormat,
|
|
4891
|
+
formatter: formats.formatters[defaultFormat],
|
|
4892
|
+
// deprecated
|
|
4893
|
+
indices: false,
|
|
4894
|
+
serializeDate: function serializeDate(date) {
|
|
4895
|
+
return toISO.call(date);
|
|
4896
|
+
},
|
|
4897
|
+
skipNulls: false,
|
|
4898
|
+
strictNullHandling: false
|
|
4899
|
+
};
|
|
4900
|
+
|
|
4901
|
+
var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
4902
|
+
return typeof v === 'string'
|
|
4903
|
+
|| typeof v === 'number'
|
|
4904
|
+
|| typeof v === 'boolean'
|
|
4905
|
+
|| typeof v === 'symbol'
|
|
4906
|
+
|| typeof v === 'bigint';
|
|
4907
|
+
};
|
|
4908
|
+
|
|
4909
|
+
var sentinel = {};
|
|
4910
|
+
|
|
4911
|
+
var stringify = function stringify(
|
|
4912
|
+
object,
|
|
4913
|
+
prefix,
|
|
4914
|
+
generateArrayPrefix,
|
|
4915
|
+
commaRoundTrip,
|
|
4916
|
+
strictNullHandling,
|
|
4917
|
+
skipNulls,
|
|
4918
|
+
encoder,
|
|
4919
|
+
filter,
|
|
4920
|
+
sort,
|
|
4921
|
+
allowDots,
|
|
4922
|
+
serializeDate,
|
|
4923
|
+
format,
|
|
4924
|
+
formatter,
|
|
4925
|
+
encodeValuesOnly,
|
|
4926
|
+
charset,
|
|
4927
|
+
sideChannel
|
|
4928
|
+
) {
|
|
4929
|
+
var obj = object;
|
|
4930
|
+
|
|
4931
|
+
var tmpSc = sideChannel;
|
|
4932
|
+
var step = 0;
|
|
4933
|
+
var findFlag = false;
|
|
4934
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
|
4935
|
+
// Where object last appeared in the ref tree
|
|
4936
|
+
var pos = tmpSc.get(object);
|
|
4937
|
+
step += 1;
|
|
4938
|
+
if (typeof pos !== 'undefined') {
|
|
4939
|
+
if (pos === step) {
|
|
4940
|
+
throw new RangeError('Cyclic object value');
|
|
4941
|
+
} else {
|
|
4942
|
+
findFlag = true; // Break while
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
4946
|
+
step = 0;
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
|
|
4950
|
+
if (typeof filter === 'function') {
|
|
4951
|
+
obj = filter(prefix, obj);
|
|
4952
|
+
} else if (obj instanceof Date) {
|
|
4953
|
+
obj = serializeDate(obj);
|
|
4954
|
+
} else if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
4955
|
+
obj = utils.maybeMap(obj, function (value) {
|
|
4956
|
+
if (value instanceof Date) {
|
|
4957
|
+
return serializeDate(value);
|
|
4958
|
+
}
|
|
4959
|
+
return value;
|
|
4960
|
+
});
|
|
4961
|
+
}
|
|
4962
|
+
|
|
4963
|
+
if (obj === null) {
|
|
4964
|
+
if (strictNullHandling) {
|
|
4965
|
+
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
obj = '';
|
|
4969
|
+
}
|
|
4970
|
+
|
|
4971
|
+
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
4972
|
+
if (encoder) {
|
|
4973
|
+
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
4974
|
+
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
4975
|
+
}
|
|
4976
|
+
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
4977
|
+
}
|
|
4978
|
+
|
|
4979
|
+
var values = [];
|
|
4980
|
+
|
|
4981
|
+
if (typeof obj === 'undefined') {
|
|
4982
|
+
return values;
|
|
4983
|
+
}
|
|
4984
|
+
|
|
4985
|
+
var objKeys;
|
|
4986
|
+
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
4987
|
+
// we need to join elements in
|
|
4988
|
+
if (encodeValuesOnly && encoder) {
|
|
4989
|
+
obj = utils.maybeMap(obj, encoder);
|
|
4990
|
+
}
|
|
4991
|
+
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
4992
|
+
} else if (isArray(filter)) {
|
|
4993
|
+
objKeys = filter;
|
|
4994
|
+
} else {
|
|
4995
|
+
var keys = Object.keys(obj);
|
|
4996
|
+
objKeys = sort ? keys.sort(sort) : keys;
|
|
4997
|
+
}
|
|
4998
|
+
|
|
4999
|
+
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
|
5000
|
+
|
|
5001
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
5002
|
+
var key = objKeys[j];
|
|
5003
|
+
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
5004
|
+
|
|
5005
|
+
if (skipNulls && value === null) {
|
|
5006
|
+
continue;
|
|
5007
|
+
}
|
|
5008
|
+
|
|
5009
|
+
var keyPrefix = isArray(obj)
|
|
5010
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
|
5011
|
+
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
5012
|
+
|
|
5013
|
+
sideChannel.set(object, step);
|
|
5014
|
+
var valueSideChannel = getSideChannel();
|
|
5015
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
5016
|
+
pushToArray(values, stringify(
|
|
5017
|
+
value,
|
|
5018
|
+
keyPrefix,
|
|
5019
|
+
generateArrayPrefix,
|
|
5020
|
+
commaRoundTrip,
|
|
5021
|
+
strictNullHandling,
|
|
5022
|
+
skipNulls,
|
|
5023
|
+
generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,
|
|
5024
|
+
filter,
|
|
5025
|
+
sort,
|
|
5026
|
+
allowDots,
|
|
5027
|
+
serializeDate,
|
|
5028
|
+
format,
|
|
5029
|
+
formatter,
|
|
5030
|
+
encodeValuesOnly,
|
|
5031
|
+
charset,
|
|
5032
|
+
valueSideChannel
|
|
5033
|
+
));
|
|
5034
|
+
}
|
|
5035
|
+
|
|
5036
|
+
return values;
|
|
5037
|
+
};
|
|
5038
|
+
|
|
5039
|
+
var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
5040
|
+
if (!opts) {
|
|
5041
|
+
return defaults;
|
|
5042
|
+
}
|
|
5043
|
+
|
|
5044
|
+
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
5045
|
+
throw new TypeError('Encoder has to be a function.');
|
|
5046
|
+
}
|
|
5047
|
+
|
|
5048
|
+
var charset = opts.charset || defaults.charset;
|
|
5049
|
+
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
5050
|
+
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
var format = formats['default'];
|
|
5054
|
+
if (typeof opts.format !== 'undefined') {
|
|
5055
|
+
if (!has.call(formats.formatters, opts.format)) {
|
|
5056
|
+
throw new TypeError('Unknown format option provided.');
|
|
5057
|
+
}
|
|
5058
|
+
format = opts.format;
|
|
5059
|
+
}
|
|
5060
|
+
var formatter = formats.formatters[format];
|
|
5061
|
+
|
|
5062
|
+
var filter = defaults.filter;
|
|
5063
|
+
if (typeof opts.filter === 'function' || isArray(opts.filter)) {
|
|
5064
|
+
filter = opts.filter;
|
|
5065
|
+
}
|
|
5066
|
+
|
|
5067
|
+
return {
|
|
5068
|
+
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
|
5069
|
+
allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
|
|
5070
|
+
charset: charset,
|
|
5071
|
+
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
5072
|
+
delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
|
|
5073
|
+
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
|
|
5074
|
+
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
|
|
5075
|
+
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
|
5076
|
+
filter: filter,
|
|
5077
|
+
format: format,
|
|
5078
|
+
formatter: formatter,
|
|
5079
|
+
serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
|
|
5080
|
+
skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
|
|
5081
|
+
sort: typeof opts.sort === 'function' ? opts.sort : null,
|
|
5082
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
|
|
5083
|
+
};
|
|
5084
|
+
};
|
|
5085
|
+
|
|
5086
|
+
var stringify_1 = function (object, opts) {
|
|
5087
|
+
var obj = object;
|
|
5088
|
+
var options = normalizeStringifyOptions(opts);
|
|
5089
|
+
|
|
5090
|
+
var objKeys;
|
|
5091
|
+
var filter;
|
|
5092
|
+
|
|
5093
|
+
if (typeof options.filter === 'function') {
|
|
5094
|
+
filter = options.filter;
|
|
5095
|
+
obj = filter('', obj);
|
|
5096
|
+
} else if (isArray(options.filter)) {
|
|
5097
|
+
filter = options.filter;
|
|
5098
|
+
objKeys = filter;
|
|
5099
|
+
}
|
|
5100
|
+
|
|
5101
|
+
var keys = [];
|
|
5102
|
+
|
|
5103
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
5104
|
+
return '';
|
|
5105
|
+
}
|
|
5106
|
+
|
|
5107
|
+
var arrayFormat;
|
|
5108
|
+
if (opts && opts.arrayFormat in arrayPrefixGenerators) {
|
|
5109
|
+
arrayFormat = opts.arrayFormat;
|
|
5110
|
+
} else if (opts && 'indices' in opts) {
|
|
5111
|
+
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
5112
|
+
} else {
|
|
5113
|
+
arrayFormat = 'indices';
|
|
5114
|
+
}
|
|
5115
|
+
|
|
5116
|
+
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
5117
|
+
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
5118
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
5119
|
+
}
|
|
5120
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
|
5121
|
+
|
|
5122
|
+
if (!objKeys) {
|
|
5123
|
+
objKeys = Object.keys(obj);
|
|
5124
|
+
}
|
|
5125
|
+
|
|
5126
|
+
if (options.sort) {
|
|
5127
|
+
objKeys.sort(options.sort);
|
|
5128
|
+
}
|
|
5129
|
+
|
|
5130
|
+
var sideChannel = getSideChannel();
|
|
5131
|
+
for (var i = 0; i < objKeys.length; ++i) {
|
|
5132
|
+
var key = objKeys[i];
|
|
5133
|
+
|
|
5134
|
+
if (options.skipNulls && obj[key] === null) {
|
|
5135
|
+
continue;
|
|
5136
|
+
}
|
|
5137
|
+
pushToArray(keys, stringify(
|
|
5138
|
+
obj[key],
|
|
5139
|
+
key,
|
|
5140
|
+
generateArrayPrefix,
|
|
5141
|
+
commaRoundTrip,
|
|
5142
|
+
options.strictNullHandling,
|
|
5143
|
+
options.skipNulls,
|
|
5144
|
+
options.encode ? options.encoder : null,
|
|
5145
|
+
options.filter,
|
|
5146
|
+
options.sort,
|
|
5147
|
+
options.allowDots,
|
|
5148
|
+
options.serializeDate,
|
|
5149
|
+
options.format,
|
|
5150
|
+
options.formatter,
|
|
5151
|
+
options.encodeValuesOnly,
|
|
5152
|
+
options.charset,
|
|
5153
|
+
sideChannel
|
|
5154
|
+
));
|
|
5155
|
+
}
|
|
5156
|
+
|
|
5157
|
+
var joined = keys.join(options.delimiter);
|
|
5158
|
+
var prefix = options.addQueryPrefix === true ? '?' : '';
|
|
5159
|
+
|
|
5160
|
+
if (options.charsetSentinel) {
|
|
5161
|
+
if (options.charset === 'iso-8859-1') {
|
|
5162
|
+
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
5163
|
+
prefix += 'utf8=%26%2310003%3B&';
|
|
5164
|
+
} else {
|
|
5165
|
+
// encodeURIComponent('✓')
|
|
5166
|
+
prefix += 'utf8=%E2%9C%93&';
|
|
5167
|
+
}
|
|
5168
|
+
}
|
|
5169
|
+
|
|
5170
|
+
return joined.length > 0 ? prefix + joined : '';
|
|
5171
|
+
};
|
|
5172
|
+
|
|
5173
|
+
var stringify$1 = /*@__PURE__*/getDefaultExportFromCjs(stringify_1);
|
|
5174
|
+
|
|
439
5175
|
/**
|
|
440
5176
|
* Transform an JSON object to a query string
|
|
441
5177
|
*/
|
|
442
5178
|
function json_to_query_string(params) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
return name + "[]=" + encodeURIComponent(val);
|
|
448
|
-
}).join('&');
|
|
449
|
-
}
|
|
450
|
-
return name + "=" + encodeURIComponent(params[k]);
|
|
451
|
-
}).join('&');
|
|
5179
|
+
if (params && Object.keys(params).length > 0) {
|
|
5180
|
+
return "?" + stringify$1(params);
|
|
5181
|
+
}
|
|
5182
|
+
return '';
|
|
452
5183
|
}
|
|
453
5184
|
function trim_left(str, what) {
|
|
454
5185
|
return str.replace(new RegExp("^" + (what || '\\s') + "+"), '');
|