@solana/web3.js 1.87.6 → 1.88.0

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/lib/index.cjs.js CHANGED
@@ -8,11 +8,9 @@ var sha256 = require('@noble/hashes/sha256');
8
8
  var borsh = require('borsh');
9
9
  var BufferLayout = require('@solana/buffer-layout');
10
10
  var bigintBuffer = require('bigint-buffer');
11
- var require$$0$1 = require('tty');
12
11
  var require$$0 = require('util');
13
- var require$$0$2 = require('path');
14
- var require$$0$3 = require('http');
15
- var require$$0$4 = require('https');
12
+ var require$$0$1 = require('http');
13
+ var require$$0$2 = require('https');
16
14
  var superstruct = require('superstruct');
17
15
  var RpcClient = require('jayson/lib/client/browser');
18
16
  var nodeFetch = require('node-fetch');
@@ -44,11 +42,9 @@ function _interopNamespaceCompat(e) {
44
42
  var BN__default = /*#__PURE__*/_interopDefaultCompat(BN);
45
43
  var bs58__default = /*#__PURE__*/_interopDefaultCompat(bs58);
46
44
  var BufferLayout__namespace = /*#__PURE__*/_interopNamespaceCompat(BufferLayout);
47
- var require$$0__default$1 = /*#__PURE__*/_interopDefaultCompat(require$$0$1);
48
45
  var require$$0__default = /*#__PURE__*/_interopDefaultCompat(require$$0);
46
+ var require$$0__default$1 = /*#__PURE__*/_interopDefaultCompat(require$$0$1);
49
47
  var require$$0__default$2 = /*#__PURE__*/_interopDefaultCompat(require$$0$2);
50
- var require$$0__default$3 = /*#__PURE__*/_interopDefaultCompat(require$$0$3);
51
- var require$$0__default$4 = /*#__PURE__*/_interopDefaultCompat(require$$0$4);
52
48
  var RpcClient__default = /*#__PURE__*/_interopDefaultCompat(RpcClient);
53
49
  var nodeFetch__namespace = /*#__PURE__*/_interopNamespaceCompat(nodeFetch);
54
50
  var RpcWebSocketCommonClient__default = /*#__PURE__*/_interopDefaultCompat(RpcWebSocketCommonClient);
@@ -1164,6 +1160,8 @@ const VersionedMessage = {
1164
1160
  }
1165
1161
  };
1166
1162
 
1163
+ /** @internal */
1164
+
1167
1165
  /**
1168
1166
  * Transaction signature as base-58 encoded string
1169
1167
  */
@@ -1779,29 +1777,31 @@ class Transaction {
1779
1777
  *
1780
1778
  * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
1781
1779
  */
1782
- verifySignatures(requireAllSignatures) {
1783
- return this._verifySignatures(this.serializeMessage(), requireAllSignatures === undefined ? true : requireAllSignatures);
1780
+ verifySignatures(requireAllSignatures = true) {
1781
+ const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
1782
+ return !signatureErrors;
1784
1783
  }
1785
1784
 
1786
1785
  /**
1787
1786
  * @internal
1788
1787
  */
1789
- _verifySignatures(signData, requireAllSignatures) {
1788
+ _getMessageSignednessErrors(message, requireAllSignatures) {
1789
+ const errors = {};
1790
1790
  for (const {
1791
1791
  signature,
1792
1792
  publicKey
1793
1793
  } of this.signatures) {
1794
1794
  if (signature === null) {
1795
1795
  if (requireAllSignatures) {
1796
- return false;
1796
+ (errors.missing ||= []).push(publicKey);
1797
1797
  }
1798
1798
  } else {
1799
- if (!verify(signature, signData, publicKey.toBytes())) {
1800
- return false;
1799
+ if (!verify(signature, message, publicKey.toBytes())) {
1800
+ (errors.invalid ||= []).push(publicKey);
1801
1801
  }
1802
1802
  }
1803
1803
  }
1804
- return true;
1804
+ return errors.invalid || errors.missing ? errors : undefined;
1805
1805
  }
1806
1806
 
1807
1807
  /**
@@ -1820,8 +1820,18 @@ class Transaction {
1820
1820
  verifySignatures: true
1821
1821
  }, config);
1822
1822
  const signData = this.serializeMessage();
1823
- if (verifySignatures && !this._verifySignatures(signData, requireAllSignatures)) {
1824
- throw new Error('Signature verification failed');
1823
+ if (verifySignatures) {
1824
+ const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
1825
+ if (sigErrors) {
1826
+ let errorMessage = 'Signature verification failed.';
1827
+ if (sigErrors.invalid) {
1828
+ errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
1829
+ }
1830
+ if (sigErrors.missing) {
1831
+ errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
1832
+ }
1833
+ throw new Error(errorMessage);
1834
+ }
1825
1835
  }
1826
1836
  return this._serialize(signData);
1827
1837
  }
@@ -3289,7 +3299,7 @@ var y = d * 365.25;
3289
3299
  * @api public
3290
3300
  */
3291
3301
 
3292
- var ms$3 = function (val, options) {
3302
+ var ms$2 = function (val, options) {
3293
3303
  options = options || {};
3294
3304
  var type = typeof val;
3295
3305
  if (type === 'string' && val.length > 0) {
@@ -3438,11 +3448,11 @@ function plural(ms, msAbs, n, name) {
3438
3448
  */
3439
3449
 
3440
3450
  var util = require$$0__default.default;
3441
- var ms$2 = ms$3;
3451
+ var ms$1 = ms$2;
3442
3452
 
3443
3453
  var humanizeMs = function (t) {
3444
3454
  if (typeof t === 'number') return t;
3445
- var r = ms$2(t);
3455
+ var r = ms$1(t);
3446
3456
  if (r === undefined) {
3447
3457
  var err = new Error(util.format('humanize-ms(%j) result undefined', t));
3448
3458
  console.warn(err.stack);
@@ -3450,1602 +3460,6 @@ var humanizeMs = function (t) {
3450
3460
  return r;
3451
3461
  };
3452
3462
 
3453
- var src = {exports: {}};
3454
-
3455
- var browser$1 = {exports: {}};
3456
-
3457
- /**
3458
- * Helpers.
3459
- */
3460
-
3461
- var ms$1;
3462
- var hasRequiredMs;
3463
-
3464
- function requireMs () {
3465
- if (hasRequiredMs) return ms$1;
3466
- hasRequiredMs = 1;
3467
- var s = 1000;
3468
- var m = s * 60;
3469
- var h = m * 60;
3470
- var d = h * 24;
3471
- var w = d * 7;
3472
- var y = d * 365.25;
3473
-
3474
- /**
3475
- * Parse or format the given `val`.
3476
- *
3477
- * Options:
3478
- *
3479
- * - `long` verbose formatting [false]
3480
- *
3481
- * @param {String|Number} val
3482
- * @param {Object} [options]
3483
- * @throws {Error} throw an error if val is not a non-empty string or a number
3484
- * @return {String|Number}
3485
- * @api public
3486
- */
3487
-
3488
- ms$1 = function(val, options) {
3489
- options = options || {};
3490
- var type = typeof val;
3491
- if (type === 'string' && val.length > 0) {
3492
- return parse(val);
3493
- } else if (type === 'number' && isFinite(val)) {
3494
- return options.long ? fmtLong(val) : fmtShort(val);
3495
- }
3496
- throw new Error(
3497
- 'val is not a non-empty string or a valid number. val=' +
3498
- JSON.stringify(val)
3499
- );
3500
- };
3501
-
3502
- /**
3503
- * Parse the given `str` and return milliseconds.
3504
- *
3505
- * @param {String} str
3506
- * @return {Number}
3507
- * @api private
3508
- */
3509
-
3510
- function parse(str) {
3511
- str = String(str);
3512
- if (str.length > 100) {
3513
- return;
3514
- }
3515
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
3516
- str
3517
- );
3518
- if (!match) {
3519
- return;
3520
- }
3521
- var n = parseFloat(match[1]);
3522
- var type = (match[2] || 'ms').toLowerCase();
3523
- switch (type) {
3524
- case 'years':
3525
- case 'year':
3526
- case 'yrs':
3527
- case 'yr':
3528
- case 'y':
3529
- return n * y;
3530
- case 'weeks':
3531
- case 'week':
3532
- case 'w':
3533
- return n * w;
3534
- case 'days':
3535
- case 'day':
3536
- case 'd':
3537
- return n * d;
3538
- case 'hours':
3539
- case 'hour':
3540
- case 'hrs':
3541
- case 'hr':
3542
- case 'h':
3543
- return n * h;
3544
- case 'minutes':
3545
- case 'minute':
3546
- case 'mins':
3547
- case 'min':
3548
- case 'm':
3549
- return n * m;
3550
- case 'seconds':
3551
- case 'second':
3552
- case 'secs':
3553
- case 'sec':
3554
- case 's':
3555
- return n * s;
3556
- case 'milliseconds':
3557
- case 'millisecond':
3558
- case 'msecs':
3559
- case 'msec':
3560
- case 'ms':
3561
- return n;
3562
- default:
3563
- return undefined;
3564
- }
3565
- }
3566
-
3567
- /**
3568
- * Short format for `ms`.
3569
- *
3570
- * @param {Number} ms
3571
- * @return {String}
3572
- * @api private
3573
- */
3574
-
3575
- function fmtShort(ms) {
3576
- var msAbs = Math.abs(ms);
3577
- if (msAbs >= d) {
3578
- return Math.round(ms / d) + 'd';
3579
- }
3580
- if (msAbs >= h) {
3581
- return Math.round(ms / h) + 'h';
3582
- }
3583
- if (msAbs >= m) {
3584
- return Math.round(ms / m) + 'm';
3585
- }
3586
- if (msAbs >= s) {
3587
- return Math.round(ms / s) + 's';
3588
- }
3589
- return ms + 'ms';
3590
- }
3591
-
3592
- /**
3593
- * Long format for `ms`.
3594
- *
3595
- * @param {Number} ms
3596
- * @return {String}
3597
- * @api private
3598
- */
3599
-
3600
- function fmtLong(ms) {
3601
- var msAbs = Math.abs(ms);
3602
- if (msAbs >= d) {
3603
- return plural(ms, msAbs, d, 'day');
3604
- }
3605
- if (msAbs >= h) {
3606
- return plural(ms, msAbs, h, 'hour');
3607
- }
3608
- if (msAbs >= m) {
3609
- return plural(ms, msAbs, m, 'minute');
3610
- }
3611
- if (msAbs >= s) {
3612
- return plural(ms, msAbs, s, 'second');
3613
- }
3614
- return ms + ' ms';
3615
- }
3616
-
3617
- /**
3618
- * Pluralization helper.
3619
- */
3620
-
3621
- function plural(ms, msAbs, n, name) {
3622
- var isPlural = msAbs >= n * 1.5;
3623
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
3624
- }
3625
- return ms$1;
3626
- }
3627
-
3628
- var common;
3629
- var hasRequiredCommon;
3630
-
3631
- function requireCommon () {
3632
- if (hasRequiredCommon) return common;
3633
- hasRequiredCommon = 1;
3634
- /**
3635
- * This is the common logic for both the Node.js and web browser
3636
- * implementations of `debug()`.
3637
- */
3638
-
3639
- function setup(env) {
3640
- createDebug.debug = createDebug;
3641
- createDebug.default = createDebug;
3642
- createDebug.coerce = coerce;
3643
- createDebug.disable = disable;
3644
- createDebug.enable = enable;
3645
- createDebug.enabled = enabled;
3646
- createDebug.humanize = requireMs();
3647
- createDebug.destroy = destroy;
3648
-
3649
- Object.keys(env).forEach(key => {
3650
- createDebug[key] = env[key];
3651
- });
3652
-
3653
- /**
3654
- * The currently active debug mode names, and names to skip.
3655
- */
3656
-
3657
- createDebug.names = [];
3658
- createDebug.skips = [];
3659
-
3660
- /**
3661
- * Map of special "%n" handling functions, for the debug "format" argument.
3662
- *
3663
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
3664
- */
3665
- createDebug.formatters = {};
3666
-
3667
- /**
3668
- * Selects a color for a debug namespace
3669
- * @param {String} namespace The namespace string for the debug instance to be colored
3670
- * @return {Number|String} An ANSI color code for the given namespace
3671
- * @api private
3672
- */
3673
- function selectColor(namespace) {
3674
- let hash = 0;
3675
-
3676
- for (let i = 0; i < namespace.length; i++) {
3677
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
3678
- hash |= 0; // Convert to 32bit integer
3679
- }
3680
-
3681
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
3682
- }
3683
- createDebug.selectColor = selectColor;
3684
-
3685
- /**
3686
- * Create a debugger with the given `namespace`.
3687
- *
3688
- * @param {String} namespace
3689
- * @return {Function}
3690
- * @api public
3691
- */
3692
- function createDebug(namespace) {
3693
- let prevTime;
3694
- let enableOverride = null;
3695
- let namespacesCache;
3696
- let enabledCache;
3697
-
3698
- function debug(...args) {
3699
- // Disabled?
3700
- if (!debug.enabled) {
3701
- return;
3702
- }
3703
-
3704
- const self = debug;
3705
-
3706
- // Set `diff` timestamp
3707
- const curr = Number(new Date());
3708
- const ms = curr - (prevTime || curr);
3709
- self.diff = ms;
3710
- self.prev = prevTime;
3711
- self.curr = curr;
3712
- prevTime = curr;
3713
-
3714
- args[0] = createDebug.coerce(args[0]);
3715
-
3716
- if (typeof args[0] !== 'string') {
3717
- // Anything else let's inspect with %O
3718
- args.unshift('%O');
3719
- }
3720
-
3721
- // Apply any `formatters` transformations
3722
- let index = 0;
3723
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
3724
- // If we encounter an escaped % then don't increase the array index
3725
- if (match === '%%') {
3726
- return '%';
3727
- }
3728
- index++;
3729
- const formatter = createDebug.formatters[format];
3730
- if (typeof formatter === 'function') {
3731
- const val = args[index];
3732
- match = formatter.call(self, val);
3733
-
3734
- // Now we need to remove `args[index]` since it's inlined in the `format`
3735
- args.splice(index, 1);
3736
- index--;
3737
- }
3738
- return match;
3739
- });
3740
-
3741
- // Apply env-specific formatting (colors, etc.)
3742
- createDebug.formatArgs.call(self, args);
3743
-
3744
- const logFn = self.log || createDebug.log;
3745
- logFn.apply(self, args);
3746
- }
3747
-
3748
- debug.namespace = namespace;
3749
- debug.useColors = createDebug.useColors();
3750
- debug.color = createDebug.selectColor(namespace);
3751
- debug.extend = extend;
3752
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
3753
-
3754
- Object.defineProperty(debug, 'enabled', {
3755
- enumerable: true,
3756
- configurable: false,
3757
- get: () => {
3758
- if (enableOverride !== null) {
3759
- return enableOverride;
3760
- }
3761
- if (namespacesCache !== createDebug.namespaces) {
3762
- namespacesCache = createDebug.namespaces;
3763
- enabledCache = createDebug.enabled(namespace);
3764
- }
3765
-
3766
- return enabledCache;
3767
- },
3768
- set: v => {
3769
- enableOverride = v;
3770
- }
3771
- });
3772
-
3773
- // Env-specific initialization logic for debug instances
3774
- if (typeof createDebug.init === 'function') {
3775
- createDebug.init(debug);
3776
- }
3777
-
3778
- return debug;
3779
- }
3780
-
3781
- function extend(namespace, delimiter) {
3782
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
3783
- newDebug.log = this.log;
3784
- return newDebug;
3785
- }
3786
-
3787
- /**
3788
- * Enables a debug mode by namespaces. This can include modes
3789
- * separated by a colon and wildcards.
3790
- *
3791
- * @param {String} namespaces
3792
- * @api public
3793
- */
3794
- function enable(namespaces) {
3795
- createDebug.save(namespaces);
3796
- createDebug.namespaces = namespaces;
3797
-
3798
- createDebug.names = [];
3799
- createDebug.skips = [];
3800
-
3801
- let i;
3802
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
3803
- const len = split.length;
3804
-
3805
- for (i = 0; i < len; i++) {
3806
- if (!split[i]) {
3807
- // ignore empty strings
3808
- continue;
3809
- }
3810
-
3811
- namespaces = split[i].replace(/\*/g, '.*?');
3812
-
3813
- if (namespaces[0] === '-') {
3814
- createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
3815
- } else {
3816
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
3817
- }
3818
- }
3819
- }
3820
-
3821
- /**
3822
- * Disable debug output.
3823
- *
3824
- * @return {String} namespaces
3825
- * @api public
3826
- */
3827
- function disable() {
3828
- const namespaces = [
3829
- ...createDebug.names.map(toNamespace),
3830
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
3831
- ].join(',');
3832
- createDebug.enable('');
3833
- return namespaces;
3834
- }
3835
-
3836
- /**
3837
- * Returns true if the given mode name is enabled, false otherwise.
3838
- *
3839
- * @param {String} name
3840
- * @return {Boolean}
3841
- * @api public
3842
- */
3843
- function enabled(name) {
3844
- if (name[name.length - 1] === '*') {
3845
- return true;
3846
- }
3847
-
3848
- let i;
3849
- let len;
3850
-
3851
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
3852
- if (createDebug.skips[i].test(name)) {
3853
- return false;
3854
- }
3855
- }
3856
-
3857
- for (i = 0, len = createDebug.names.length; i < len; i++) {
3858
- if (createDebug.names[i].test(name)) {
3859
- return true;
3860
- }
3861
- }
3862
-
3863
- return false;
3864
- }
3865
-
3866
- /**
3867
- * Convert regexp to namespace
3868
- *
3869
- * @param {RegExp} regxep
3870
- * @return {String} namespace
3871
- * @api private
3872
- */
3873
- function toNamespace(regexp) {
3874
- return regexp.toString()
3875
- .substring(2, regexp.toString().length - 2)
3876
- .replace(/\.\*\?$/, '*');
3877
- }
3878
-
3879
- /**
3880
- * Coerce `val`.
3881
- *
3882
- * @param {Mixed} val
3883
- * @return {Mixed}
3884
- * @api private
3885
- */
3886
- function coerce(val) {
3887
- if (val instanceof Error) {
3888
- return val.stack || val.message;
3889
- }
3890
- return val;
3891
- }
3892
-
3893
- /**
3894
- * XXX DO NOT USE. This is a temporary stub function.
3895
- * XXX It WILL be removed in the next major release.
3896
- */
3897
- function destroy() {
3898
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
3899
- }
3900
-
3901
- createDebug.enable(createDebug.load());
3902
-
3903
- return createDebug;
3904
- }
3905
-
3906
- common = setup;
3907
- return common;
3908
- }
3909
-
3910
- /* eslint-env browser */
3911
-
3912
- var hasRequiredBrowser$1;
3913
-
3914
- function requireBrowser$1 () {
3915
- if (hasRequiredBrowser$1) return browser$1.exports;
3916
- hasRequiredBrowser$1 = 1;
3917
- (function (module, exports) {
3918
- /**
3919
- * This is the web browser implementation of `debug()`.
3920
- */
3921
-
3922
- exports.formatArgs = formatArgs;
3923
- exports.save = save;
3924
- exports.load = load;
3925
- exports.useColors = useColors;
3926
- exports.storage = localstorage();
3927
- exports.destroy = (() => {
3928
- let warned = false;
3929
-
3930
- return () => {
3931
- if (!warned) {
3932
- warned = true;
3933
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
3934
- }
3935
- };
3936
- })();
3937
-
3938
- /**
3939
- * Colors.
3940
- */
3941
-
3942
- exports.colors = [
3943
- '#0000CC',
3944
- '#0000FF',
3945
- '#0033CC',
3946
- '#0033FF',
3947
- '#0066CC',
3948
- '#0066FF',
3949
- '#0099CC',
3950
- '#0099FF',
3951
- '#00CC00',
3952
- '#00CC33',
3953
- '#00CC66',
3954
- '#00CC99',
3955
- '#00CCCC',
3956
- '#00CCFF',
3957
- '#3300CC',
3958
- '#3300FF',
3959
- '#3333CC',
3960
- '#3333FF',
3961
- '#3366CC',
3962
- '#3366FF',
3963
- '#3399CC',
3964
- '#3399FF',
3965
- '#33CC00',
3966
- '#33CC33',
3967
- '#33CC66',
3968
- '#33CC99',
3969
- '#33CCCC',
3970
- '#33CCFF',
3971
- '#6600CC',
3972
- '#6600FF',
3973
- '#6633CC',
3974
- '#6633FF',
3975
- '#66CC00',
3976
- '#66CC33',
3977
- '#9900CC',
3978
- '#9900FF',
3979
- '#9933CC',
3980
- '#9933FF',
3981
- '#99CC00',
3982
- '#99CC33',
3983
- '#CC0000',
3984
- '#CC0033',
3985
- '#CC0066',
3986
- '#CC0099',
3987
- '#CC00CC',
3988
- '#CC00FF',
3989
- '#CC3300',
3990
- '#CC3333',
3991
- '#CC3366',
3992
- '#CC3399',
3993
- '#CC33CC',
3994
- '#CC33FF',
3995
- '#CC6600',
3996
- '#CC6633',
3997
- '#CC9900',
3998
- '#CC9933',
3999
- '#CCCC00',
4000
- '#CCCC33',
4001
- '#FF0000',
4002
- '#FF0033',
4003
- '#FF0066',
4004
- '#FF0099',
4005
- '#FF00CC',
4006
- '#FF00FF',
4007
- '#FF3300',
4008
- '#FF3333',
4009
- '#FF3366',
4010
- '#FF3399',
4011
- '#FF33CC',
4012
- '#FF33FF',
4013
- '#FF6600',
4014
- '#FF6633',
4015
- '#FF9900',
4016
- '#FF9933',
4017
- '#FFCC00',
4018
- '#FFCC33'
4019
- ];
4020
-
4021
- /**
4022
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
4023
- * and the Firebug extension (any Firefox version) are known
4024
- * to support "%c" CSS customizations.
4025
- *
4026
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
4027
- */
4028
-
4029
- // eslint-disable-next-line complexity
4030
- function useColors() {
4031
- // NB: In an Electron preload script, document will be defined but not fully
4032
- // initialized. Since we know we're in Chrome, we'll just detect this case
4033
- // explicitly
4034
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
4035
- return true;
4036
- }
4037
-
4038
- // Internet Explorer and Edge do not support colors.
4039
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
4040
- return false;
4041
- }
4042
-
4043
- // Is webkit? http://stackoverflow.com/a/16459606/376773
4044
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
4045
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
4046
- // Is firebug? http://stackoverflow.com/a/398120/376773
4047
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
4048
- // Is firefox >= v31?
4049
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
4050
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
4051
- // Double check webkit in userAgent just in case we are in a worker
4052
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
4053
- }
4054
-
4055
- /**
4056
- * Colorize log arguments if enabled.
4057
- *
4058
- * @api public
4059
- */
4060
-
4061
- function formatArgs(args) {
4062
- args[0] = (this.useColors ? '%c' : '') +
4063
- this.namespace +
4064
- (this.useColors ? ' %c' : ' ') +
4065
- args[0] +
4066
- (this.useColors ? '%c ' : ' ') +
4067
- '+' + module.exports.humanize(this.diff);
4068
-
4069
- if (!this.useColors) {
4070
- return;
4071
- }
4072
-
4073
- const c = 'color: ' + this.color;
4074
- args.splice(1, 0, c, 'color: inherit');
4075
-
4076
- // The final "%c" is somewhat tricky, because there could be other
4077
- // arguments passed either before or after the %c, so we need to
4078
- // figure out the correct index to insert the CSS into
4079
- let index = 0;
4080
- let lastC = 0;
4081
- args[0].replace(/%[a-zA-Z%]/g, match => {
4082
- if (match === '%%') {
4083
- return;
4084
- }
4085
- index++;
4086
- if (match === '%c') {
4087
- // We only are interested in the *last* %c
4088
- // (the user may have provided their own)
4089
- lastC = index;
4090
- }
4091
- });
4092
-
4093
- args.splice(lastC, 0, c);
4094
- }
4095
-
4096
- /**
4097
- * Invokes `console.debug()` when available.
4098
- * No-op when `console.debug` is not a "function".
4099
- * If `console.debug` is not available, falls back
4100
- * to `console.log`.
4101
- *
4102
- * @api public
4103
- */
4104
- exports.log = console.debug || console.log || (() => {});
4105
-
4106
- /**
4107
- * Save `namespaces`.
4108
- *
4109
- * @param {String} namespaces
4110
- * @api private
4111
- */
4112
- function save(namespaces) {
4113
- try {
4114
- if (namespaces) {
4115
- exports.storage.setItem('debug', namespaces);
4116
- } else {
4117
- exports.storage.removeItem('debug');
4118
- }
4119
- } catch (error) {
4120
- // Swallow
4121
- // XXX (@Qix-) should we be logging these?
4122
- }
4123
- }
4124
-
4125
- /**
4126
- * Load `namespaces`.
4127
- *
4128
- * @return {String} returns the previously persisted debug modes
4129
- * @api private
4130
- */
4131
- function load() {
4132
- let r;
4133
- try {
4134
- r = exports.storage.getItem('debug');
4135
- } catch (error) {
4136
- // Swallow
4137
- // XXX (@Qix-) should we be logging these?
4138
- }
4139
-
4140
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
4141
- if (!r && typeof process !== 'undefined' && 'env' in process) {
4142
- r = process.env.DEBUG;
4143
- }
4144
-
4145
- return r;
4146
- }
4147
-
4148
- /**
4149
- * Localstorage attempts to return the localstorage.
4150
- *
4151
- * This is necessary because safari throws
4152
- * when a user disables cookies/localstorage
4153
- * and you attempt to access it.
4154
- *
4155
- * @return {LocalStorage}
4156
- * @api private
4157
- */
4158
-
4159
- function localstorage() {
4160
- try {
4161
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
4162
- // The Browser also has localStorage in the global context.
4163
- return localStorage;
4164
- } catch (error) {
4165
- // Swallow
4166
- // XXX (@Qix-) should we be logging these?
4167
- }
4168
- }
4169
-
4170
- module.exports = requireCommon()(exports);
4171
-
4172
- const {formatters} = module.exports;
4173
-
4174
- /**
4175
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
4176
- */
4177
-
4178
- formatters.j = function (v) {
4179
- try {
4180
- return JSON.stringify(v);
4181
- } catch (error) {
4182
- return '[UnexpectedJSONParseError]: ' + error.message;
4183
- }
4184
- };
4185
- } (browser$1, browser$1.exports));
4186
- return browser$1.exports;
4187
- }
4188
-
4189
- var node = {exports: {}};
4190
-
4191
- /* eslint-env browser */
4192
-
4193
- var browser;
4194
- var hasRequiredBrowser;
4195
-
4196
- function requireBrowser () {
4197
- if (hasRequiredBrowser) return browser;
4198
- hasRequiredBrowser = 1;
4199
-
4200
- function getChromeVersion() {
4201
- const matches = /(Chrome|Chromium)\/(?<chromeVersion>\d+)\./.exec(navigator.userAgent);
4202
-
4203
- if (!matches) {
4204
- return;
4205
- }
4206
-
4207
- return Number.parseInt(matches.groups.chromeVersion, 10);
4208
- }
4209
-
4210
- const colorSupport = getChromeVersion() >= 69 ? {
4211
- level: 1,
4212
- hasBasic: true,
4213
- has256: false,
4214
- has16m: false
4215
- } : false;
4216
-
4217
- browser = {
4218
- stdout: colorSupport,
4219
- stderr: colorSupport
4220
- };
4221
- return browser;
4222
- }
4223
-
4224
- /**
4225
- * Module dependencies.
4226
- */
4227
-
4228
- var hasRequiredNode;
4229
-
4230
- function requireNode () {
4231
- if (hasRequiredNode) return node.exports;
4232
- hasRequiredNode = 1;
4233
- (function (module, exports) {
4234
- const tty = require$$0__default$1.default;
4235
- const util = require$$0__default.default;
4236
-
4237
- /**
4238
- * This is the Node.js implementation of `debug()`.
4239
- */
4240
-
4241
- exports.init = init;
4242
- exports.log = log;
4243
- exports.formatArgs = formatArgs;
4244
- exports.save = save;
4245
- exports.load = load;
4246
- exports.useColors = useColors;
4247
- exports.destroy = util.deprecate(
4248
- () => {},
4249
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
4250
- );
4251
-
4252
- /**
4253
- * Colors.
4254
- */
4255
-
4256
- exports.colors = [6, 2, 3, 4, 5, 1];
4257
-
4258
- try {
4259
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
4260
- // eslint-disable-next-line import/no-extraneous-dependencies
4261
- const supportsColor = requireBrowser();
4262
-
4263
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
4264
- exports.colors = [
4265
- 20,
4266
- 21,
4267
- 26,
4268
- 27,
4269
- 32,
4270
- 33,
4271
- 38,
4272
- 39,
4273
- 40,
4274
- 41,
4275
- 42,
4276
- 43,
4277
- 44,
4278
- 45,
4279
- 56,
4280
- 57,
4281
- 62,
4282
- 63,
4283
- 68,
4284
- 69,
4285
- 74,
4286
- 75,
4287
- 76,
4288
- 77,
4289
- 78,
4290
- 79,
4291
- 80,
4292
- 81,
4293
- 92,
4294
- 93,
4295
- 98,
4296
- 99,
4297
- 112,
4298
- 113,
4299
- 128,
4300
- 129,
4301
- 134,
4302
- 135,
4303
- 148,
4304
- 149,
4305
- 160,
4306
- 161,
4307
- 162,
4308
- 163,
4309
- 164,
4310
- 165,
4311
- 166,
4312
- 167,
4313
- 168,
4314
- 169,
4315
- 170,
4316
- 171,
4317
- 172,
4318
- 173,
4319
- 178,
4320
- 179,
4321
- 184,
4322
- 185,
4323
- 196,
4324
- 197,
4325
- 198,
4326
- 199,
4327
- 200,
4328
- 201,
4329
- 202,
4330
- 203,
4331
- 204,
4332
- 205,
4333
- 206,
4334
- 207,
4335
- 208,
4336
- 209,
4337
- 214,
4338
- 215,
4339
- 220,
4340
- 221
4341
- ];
4342
- }
4343
- } catch (error) {
4344
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
4345
- }
4346
-
4347
- /**
4348
- * Build up the default `inspectOpts` object from the environment variables.
4349
- *
4350
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
4351
- */
4352
-
4353
- exports.inspectOpts = Object.keys(process.env).filter(key => {
4354
- return /^debug_/i.test(key);
4355
- }).reduce((obj, key) => {
4356
- // Camel-case
4357
- const prop = key
4358
- .substring(6)
4359
- .toLowerCase()
4360
- .replace(/_([a-z])/g, (_, k) => {
4361
- return k.toUpperCase();
4362
- });
4363
-
4364
- // Coerce string value into JS value
4365
- let val = process.env[key];
4366
- if (/^(yes|on|true|enabled)$/i.test(val)) {
4367
- val = true;
4368
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
4369
- val = false;
4370
- } else if (val === 'null') {
4371
- val = null;
4372
- } else {
4373
- val = Number(val);
4374
- }
4375
-
4376
- obj[prop] = val;
4377
- return obj;
4378
- }, {});
4379
-
4380
- /**
4381
- * Is stdout a TTY? Colored output is enabled when `true`.
4382
- */
4383
-
4384
- function useColors() {
4385
- return 'colors' in exports.inspectOpts ?
4386
- Boolean(exports.inspectOpts.colors) :
4387
- tty.isatty(process.stderr.fd);
4388
- }
4389
-
4390
- /**
4391
- * Adds ANSI color escape codes if enabled.
4392
- *
4393
- * @api public
4394
- */
4395
-
4396
- function formatArgs(args) {
4397
- const {namespace: name, useColors} = this;
4398
-
4399
- if (useColors) {
4400
- const c = this.color;
4401
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
4402
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
4403
-
4404
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
4405
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
4406
- } else {
4407
- args[0] = getDate() + name + ' ' + args[0];
4408
- }
4409
- }
4410
-
4411
- function getDate() {
4412
- if (exports.inspectOpts.hideDate) {
4413
- return '';
4414
- }
4415
- return new Date().toISOString() + ' ';
4416
- }
4417
-
4418
- /**
4419
- * Invokes `util.format()` with the specified arguments and writes to stderr.
4420
- */
4421
-
4422
- function log(...args) {
4423
- return process.stderr.write(util.format(...args) + '\n');
4424
- }
4425
-
4426
- /**
4427
- * Save `namespaces`.
4428
- *
4429
- * @param {String} namespaces
4430
- * @api private
4431
- */
4432
- function save(namespaces) {
4433
- if (namespaces) {
4434
- process.env.DEBUG = namespaces;
4435
- } else {
4436
- // If you set a process.env field to null or undefined, it gets cast to the
4437
- // string 'null' or 'undefined'. Just delete instead.
4438
- delete process.env.DEBUG;
4439
- }
4440
- }
4441
-
4442
- /**
4443
- * Load `namespaces`.
4444
- *
4445
- * @return {String} returns the previously persisted debug modes
4446
- * @api private
4447
- */
4448
-
4449
- function load() {
4450
- return process.env.DEBUG;
4451
- }
4452
-
4453
- /**
4454
- * Init logic for `debug` instances.
4455
- *
4456
- * Create a new `inspectOpts` object in case `useColors` is set
4457
- * differently for a particular `debug` instance.
4458
- */
4459
-
4460
- function init(debug) {
4461
- debug.inspectOpts = {};
4462
-
4463
- const keys = Object.keys(exports.inspectOpts);
4464
- for (let i = 0; i < keys.length; i++) {
4465
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
4466
- }
4467
- }
4468
-
4469
- module.exports = requireCommon()(exports);
4470
-
4471
- const {formatters} = module.exports;
4472
-
4473
- /**
4474
- * Map %o to `util.inspect()`, all on a single line.
4475
- */
4476
-
4477
- formatters.o = function (v) {
4478
- this.inspectOpts.colors = this.useColors;
4479
- return util.inspect(v, this.inspectOpts)
4480
- .split('\n')
4481
- .map(str => str.trim())
4482
- .join(' ');
4483
- };
4484
-
4485
- /**
4486
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
4487
- */
4488
-
4489
- formatters.O = function (v) {
4490
- this.inspectOpts.colors = this.useColors;
4491
- return util.inspect(v, this.inspectOpts);
4492
- };
4493
- } (node, node.exports));
4494
- return node.exports;
4495
- }
4496
-
4497
- /**
4498
- * Detect Electron renderer / nwjs process, which is node, but we should
4499
- * treat as a browser.
4500
- */
4501
-
4502
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
4503
- src.exports = requireBrowser$1();
4504
- } else {
4505
- src.exports = requireNode();
4506
- }
4507
-
4508
- var srcExports = src.exports;
4509
-
4510
- /*!
4511
- * depd
4512
- * Copyright(c) 2014-2018 Douglas Christopher Wilson
4513
- * MIT Licensed
4514
- */
4515
-
4516
- /**
4517
- * Module dependencies.
4518
- */
4519
-
4520
- var relative = require$$0__default$2.default.relative;
4521
-
4522
- /**
4523
- * Module exports.
4524
- */
4525
-
4526
- var depd_1 = depd;
4527
-
4528
- /**
4529
- * Get the path to base files on.
4530
- */
4531
-
4532
- var basePath = process.cwd();
4533
-
4534
- /**
4535
- * Determine if namespace is contained in the string.
4536
- */
4537
-
4538
- function containsNamespace (str, namespace) {
4539
- var vals = str.split(/[ ,]+/);
4540
- var ns = String(namespace).toLowerCase();
4541
-
4542
- for (var i = 0; i < vals.length; i++) {
4543
- var val = vals[i];
4544
-
4545
- // namespace contained
4546
- if (val && (val === '*' || val.toLowerCase() === ns)) {
4547
- return true
4548
- }
4549
- }
4550
-
4551
- return false
4552
- }
4553
-
4554
- /**
4555
- * Convert a data descriptor to accessor descriptor.
4556
- */
4557
-
4558
- function convertDataDescriptorToAccessor (obj, prop, message) {
4559
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
4560
- var value = descriptor.value;
4561
-
4562
- descriptor.get = function getter () { return value };
4563
-
4564
- if (descriptor.writable) {
4565
- descriptor.set = function setter (val) { return (value = val) };
4566
- }
4567
-
4568
- delete descriptor.value;
4569
- delete descriptor.writable;
4570
-
4571
- Object.defineProperty(obj, prop, descriptor);
4572
-
4573
- return descriptor
4574
- }
4575
-
4576
- /**
4577
- * Create arguments string to keep arity.
4578
- */
4579
-
4580
- function createArgumentsString (arity) {
4581
- var str = '';
4582
-
4583
- for (var i = 0; i < arity; i++) {
4584
- str += ', arg' + i;
4585
- }
4586
-
4587
- return str.substr(2)
4588
- }
4589
-
4590
- /**
4591
- * Create stack string from stack.
4592
- */
4593
-
4594
- function createStackString (stack) {
4595
- var str = this.name + ': ' + this.namespace;
4596
-
4597
- if (this.message) {
4598
- str += ' deprecated ' + this.message;
4599
- }
4600
-
4601
- for (var i = 0; i < stack.length; i++) {
4602
- str += '\n at ' + stack[i].toString();
4603
- }
4604
-
4605
- return str
4606
- }
4607
-
4608
- /**
4609
- * Create deprecate for namespace in caller.
4610
- */
4611
-
4612
- function depd (namespace) {
4613
- if (!namespace) {
4614
- throw new TypeError('argument namespace is required')
4615
- }
4616
-
4617
- var stack = getStack();
4618
- var site = callSiteLocation(stack[1]);
4619
- var file = site[0];
4620
-
4621
- function deprecate (message) {
4622
- // call to self as log
4623
- log.call(deprecate, message);
4624
- }
4625
-
4626
- deprecate._file = file;
4627
- deprecate._ignored = isignored(namespace);
4628
- deprecate._namespace = namespace;
4629
- deprecate._traced = istraced(namespace);
4630
- deprecate._warned = Object.create(null);
4631
-
4632
- deprecate.function = wrapfunction;
4633
- deprecate.property = wrapproperty;
4634
-
4635
- return deprecate
4636
- }
4637
-
4638
- /**
4639
- * Determine if event emitter has listeners of a given type.
4640
- *
4641
- * The way to do this check is done three different ways in Node.js >= 0.8
4642
- * so this consolidates them into a minimal set using instance methods.
4643
- *
4644
- * @param {EventEmitter} emitter
4645
- * @param {string} type
4646
- * @returns {boolean}
4647
- * @private
4648
- */
4649
-
4650
- function eehaslisteners (emitter, type) {
4651
- var count = typeof emitter.listenerCount !== 'function'
4652
- ? emitter.listeners(type).length
4653
- : emitter.listenerCount(type);
4654
-
4655
- return count > 0
4656
- }
4657
-
4658
- /**
4659
- * Determine if namespace is ignored.
4660
- */
4661
-
4662
- function isignored (namespace) {
4663
- if (process.noDeprecation) {
4664
- // --no-deprecation support
4665
- return true
4666
- }
4667
-
4668
- var str = process.env.NO_DEPRECATION || '';
4669
-
4670
- // namespace ignored
4671
- return containsNamespace(str, namespace)
4672
- }
4673
-
4674
- /**
4675
- * Determine if namespace is traced.
4676
- */
4677
-
4678
- function istraced (namespace) {
4679
- if (process.traceDeprecation) {
4680
- // --trace-deprecation support
4681
- return true
4682
- }
4683
-
4684
- var str = process.env.TRACE_DEPRECATION || '';
4685
-
4686
- // namespace traced
4687
- return containsNamespace(str, namespace)
4688
- }
4689
-
4690
- /**
4691
- * Display deprecation message.
4692
- */
4693
-
4694
- function log (message, site) {
4695
- var haslisteners = eehaslisteners(process, 'deprecation');
4696
-
4697
- // abort early if no destination
4698
- if (!haslisteners && this._ignored) {
4699
- return
4700
- }
4701
-
4702
- var caller;
4703
- var callFile;
4704
- var callSite;
4705
- var depSite;
4706
- var i = 0;
4707
- var seen = false;
4708
- var stack = getStack();
4709
- var file = this._file;
4710
-
4711
- if (site) {
4712
- // provided site
4713
- depSite = site;
4714
- callSite = callSiteLocation(stack[1]);
4715
- callSite.name = depSite.name;
4716
- file = callSite[0];
4717
- } else {
4718
- // get call site
4719
- i = 2;
4720
- depSite = callSiteLocation(stack[i]);
4721
- callSite = depSite;
4722
- }
4723
-
4724
- // get caller of deprecated thing in relation to file
4725
- for (; i < stack.length; i++) {
4726
- caller = callSiteLocation(stack[i]);
4727
- callFile = caller[0];
4728
-
4729
- if (callFile === file) {
4730
- seen = true;
4731
- } else if (callFile === this._file) {
4732
- file = this._file;
4733
- } else if (seen) {
4734
- break
4735
- }
4736
- }
4737
-
4738
- var key = caller
4739
- ? depSite.join(':') + '__' + caller.join(':')
4740
- : undefined;
4741
-
4742
- if (key !== undefined && key in this._warned) {
4743
- // already warned
4744
- return
4745
- }
4746
-
4747
- this._warned[key] = true;
4748
-
4749
- // generate automatic message from call site
4750
- var msg = message;
4751
- if (!msg) {
4752
- msg = callSite === depSite || !callSite.name
4753
- ? defaultMessage(depSite)
4754
- : defaultMessage(callSite);
4755
- }
4756
-
4757
- // emit deprecation if listeners exist
4758
- if (haslisteners) {
4759
- var err = DeprecationError(this._namespace, msg, stack.slice(i));
4760
- process.emit('deprecation', err);
4761
- return
4762
- }
4763
-
4764
- // format and write message
4765
- var format = process.stderr.isTTY
4766
- ? formatColor
4767
- : formatPlain;
4768
- var output = format.call(this, msg, caller, stack.slice(i));
4769
- process.stderr.write(output + '\n', 'utf8');
4770
- }
4771
-
4772
- /**
4773
- * Get call site location as array.
4774
- */
4775
-
4776
- function callSiteLocation (callSite) {
4777
- var file = callSite.getFileName() || '<anonymous>';
4778
- var line = callSite.getLineNumber();
4779
- var colm = callSite.getColumnNumber();
4780
-
4781
- if (callSite.isEval()) {
4782
- file = callSite.getEvalOrigin() + ', ' + file;
4783
- }
4784
-
4785
- var site = [file, line, colm];
4786
-
4787
- site.callSite = callSite;
4788
- site.name = callSite.getFunctionName();
4789
-
4790
- return site
4791
- }
4792
-
4793
- /**
4794
- * Generate a default message from the site.
4795
- */
4796
-
4797
- function defaultMessage (site) {
4798
- var callSite = site.callSite;
4799
- var funcName = site.name;
4800
-
4801
- // make useful anonymous name
4802
- if (!funcName) {
4803
- funcName = '<anonymous@' + formatLocation(site) + '>';
4804
- }
4805
-
4806
- var context = callSite.getThis();
4807
- var typeName = context && callSite.getTypeName();
4808
-
4809
- // ignore useless type name
4810
- if (typeName === 'Object') {
4811
- typeName = undefined;
4812
- }
4813
-
4814
- // make useful type name
4815
- if (typeName === 'Function') {
4816
- typeName = context.name || typeName;
4817
- }
4818
-
4819
- return typeName && callSite.getMethodName()
4820
- ? typeName + '.' + funcName
4821
- : funcName
4822
- }
4823
-
4824
- /**
4825
- * Format deprecation message without color.
4826
- */
4827
-
4828
- function formatPlain (msg, caller, stack) {
4829
- var timestamp = new Date().toUTCString();
4830
-
4831
- var formatted = timestamp +
4832
- ' ' + this._namespace +
4833
- ' deprecated ' + msg;
4834
-
4835
- // add stack trace
4836
- if (this._traced) {
4837
- for (var i = 0; i < stack.length; i++) {
4838
- formatted += '\n at ' + stack[i].toString();
4839
- }
4840
-
4841
- return formatted
4842
- }
4843
-
4844
- if (caller) {
4845
- formatted += ' at ' + formatLocation(caller);
4846
- }
4847
-
4848
- return formatted
4849
- }
4850
-
4851
- /**
4852
- * Format deprecation message with color.
4853
- */
4854
-
4855
- function formatColor (msg, caller, stack) {
4856
- var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
4857
- ' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
4858
- ' \x1b[0m' + msg + '\x1b[39m'; // reset
4859
-
4860
- // add stack trace
4861
- if (this._traced) {
4862
- for (var i = 0; i < stack.length; i++) {
4863
- formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m'; // cyan
4864
- }
4865
-
4866
- return formatted
4867
- }
4868
-
4869
- if (caller) {
4870
- formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m'; // cyan
4871
- }
4872
-
4873
- return formatted
4874
- }
4875
-
4876
- /**
4877
- * Format call site location.
4878
- */
4879
-
4880
- function formatLocation (callSite) {
4881
- return relative(basePath, callSite[0]) +
4882
- ':' + callSite[1] +
4883
- ':' + callSite[2]
4884
- }
4885
-
4886
- /**
4887
- * Get the stack as array of call sites.
4888
- */
4889
-
4890
- function getStack () {
4891
- var limit = Error.stackTraceLimit;
4892
- var obj = {};
4893
- var prep = Error.prepareStackTrace;
4894
-
4895
- Error.prepareStackTrace = prepareObjectStackTrace;
4896
- Error.stackTraceLimit = Math.max(10, limit);
4897
-
4898
- // capture the stack
4899
- Error.captureStackTrace(obj);
4900
-
4901
- // slice this function off the top
4902
- var stack = obj.stack.slice(1);
4903
-
4904
- Error.prepareStackTrace = prep;
4905
- Error.stackTraceLimit = limit;
4906
-
4907
- return stack
4908
- }
4909
-
4910
- /**
4911
- * Capture call site stack from v8.
4912
- */
4913
-
4914
- function prepareObjectStackTrace (obj, stack) {
4915
- return stack
4916
- }
4917
-
4918
- /**
4919
- * Return a wrapped function in a deprecation message.
4920
- */
4921
-
4922
- function wrapfunction (fn, message) {
4923
- if (typeof fn !== 'function') {
4924
- throw new TypeError('argument fn must be a function')
4925
- }
4926
-
4927
- var args = createArgumentsString(fn.length);
4928
- var stack = getStack();
4929
- var site = callSiteLocation(stack[1]);
4930
-
4931
- site.name = fn.name;
4932
-
4933
- // eslint-disable-next-line no-new-func
4934
- var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
4935
- '"use strict"\n' +
4936
- 'return function (' + args + ') {' +
4937
- 'log.call(deprecate, message, site)\n' +
4938
- 'return fn.apply(this, arguments)\n' +
4939
- '}')(fn, log, this, message, site);
4940
-
4941
- return deprecatedfn
4942
- }
4943
-
4944
- /**
4945
- * Wrap property in a deprecation message.
4946
- */
4947
-
4948
- function wrapproperty (obj, prop, message) {
4949
- if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
4950
- throw new TypeError('argument obj must be object')
4951
- }
4952
-
4953
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
4954
-
4955
- if (!descriptor) {
4956
- throw new TypeError('must call property on owner object')
4957
- }
4958
-
4959
- if (!descriptor.configurable) {
4960
- throw new TypeError('property must be configurable')
4961
- }
4962
-
4963
- var deprecate = this;
4964
- var stack = getStack();
4965
- var site = callSiteLocation(stack[1]);
4966
-
4967
- // set site name
4968
- site.name = prop;
4969
-
4970
- // convert data descriptor
4971
- if ('value' in descriptor) {
4972
- descriptor = convertDataDescriptorToAccessor(obj, prop);
4973
- }
4974
-
4975
- var get = descriptor.get;
4976
- var set = descriptor.set;
4977
-
4978
- // wrap getter
4979
- if (typeof get === 'function') {
4980
- descriptor.get = function getter () {
4981
- log.call(deprecate, message, site);
4982
- return get.apply(this, arguments)
4983
- };
4984
- }
4985
-
4986
- // wrap setter
4987
- if (typeof set === 'function') {
4988
- descriptor.set = function setter () {
4989
- log.call(deprecate, message, site);
4990
- return set.apply(this, arguments)
4991
- };
4992
- }
4993
-
4994
- Object.defineProperty(obj, prop, descriptor);
4995
- }
4996
-
4997
- /**
4998
- * Create DeprecationError for deprecation
4999
- */
5000
-
5001
- function DeprecationError (namespace, message, stack) {
5002
- var error = new Error();
5003
- var stackString;
5004
-
5005
- Object.defineProperty(error, 'constructor', {
5006
- value: DeprecationError
5007
- });
5008
-
5009
- Object.defineProperty(error, 'message', {
5010
- configurable: true,
5011
- enumerable: false,
5012
- value: message,
5013
- writable: true
5014
- });
5015
-
5016
- Object.defineProperty(error, 'name', {
5017
- enumerable: false,
5018
- configurable: true,
5019
- value: 'DeprecationError',
5020
- writable: true
5021
- });
5022
-
5023
- Object.defineProperty(error, 'namespace', {
5024
- configurable: true,
5025
- enumerable: false,
5026
- value: namespace,
5027
- writable: true
5028
- });
5029
-
5030
- Object.defineProperty(error, 'stack', {
5031
- configurable: true,
5032
- enumerable: false,
5033
- get: function () {
5034
- if (stackString !== undefined) {
5035
- return stackString
5036
- }
5037
-
5038
- // prepare stack trace
5039
- return (stackString = createStackString.call(this, stack))
5040
- },
5041
- set: function setter (val) {
5042
- stackString = val;
5043
- }
5044
- });
5045
-
5046
- return error
5047
- }
5048
-
5049
3463
  var constants = {
5050
3464
  // agent
5051
3465
  CURRENT_ID: Symbol('agentkeepalive#currentId'),
@@ -5059,10 +3473,9 @@ var constants = {
5059
3473
  SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
5060
3474
  };
5061
3475
 
5062
- const OriginalAgent = require$$0__default$3.default.Agent;
3476
+ const OriginalAgent = require$$0__default$1.default.Agent;
5063
3477
  const ms = humanizeMs;
5064
- const debug = srcExports('agentkeepalive');
5065
- const deprecate = depd_1('agentkeepalive');
3478
+ const debug = require$$0__default.default.debuglog('agentkeepalive');
5066
3479
  const {
5067
3480
  INIT_SOCKET: INIT_SOCKET$1,
5068
3481
  CURRENT_ID,
@@ -5086,6 +3499,10 @@ if (majorVersion >= 11 && majorVersion <= 12) {
5086
3499
  defaultTimeoutListenerCount = 3;
5087
3500
  }
5088
3501
 
3502
+ function deprecate(message) {
3503
+ console.log('[agentkeepalive:deprecated] %s', message);
3504
+ }
3505
+
5089
3506
  class Agent extends OriginalAgent {
5090
3507
  constructor(options) {
5091
3508
  options = options || {};
@@ -5289,6 +3706,7 @@ class Agent extends OriginalAgent {
5289
3706
 
5290
3707
  const newSocket = super.createConnection(options, onNewCreate);
5291
3708
  if (newSocket) onNewCreate(null, newSocket);
3709
+ return newSocket;
5292
3710
  }
5293
3711
 
5294
3712
  get statusChanged() {
@@ -5456,7 +3874,7 @@ function inspect(obj) {
5456
3874
  return res;
5457
3875
  }
5458
3876
 
5459
- const OriginalHttpsAgent = require$$0__default$4.default.Agent;
3877
+ const OriginalHttpsAgent = require$$0__default$2.default.Agent;
5460
3878
  const HttpAgent = agent;
5461
3879
  const {
5462
3880
  INIT_SOCKET,
@@ -5481,8 +3899,8 @@ let HttpsAgent$1 = class HttpsAgent extends HttpAgent {
5481
3899
  };
5482
3900
  }
5483
3901
 
5484
- createConnection(options) {
5485
- const socket = this[CREATE_HTTPS_CONNECTION](options);
3902
+ createConnection(options, oncreate) {
3903
+ const socket = this[CREATE_HTTPS_CONNECTION](options, oncreate);
5486
3904
  this[INIT_SOCKET](socket, options);
5487
3905
  return socket;
5488
3906
  }
@@ -6412,9 +4830,9 @@ function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disable
6412
4830
  } else {
6413
4831
  if (httpAgent !== false) {
6414
4832
  const isHttps = url.startsWith('https:');
6415
- if (isHttps && !(httpAgent instanceof require$$0$4.Agent)) {
4833
+ if (isHttps && !(httpAgent instanceof require$$0$2.Agent)) {
6416
4834
  throw new Error('The endpoint `' + url + '` can only be paired with an `https.Agent`. You have, instead, supplied an ' + '`http.Agent` through `httpAgent`.');
6417
- } else if (!isHttps && httpAgent instanceof require$$0$4.Agent) {
4835
+ } else if (!isHttps && httpAgent instanceof require$$0$2.Agent) {
6418
4836
  throw new Error('The endpoint `' + url + '` can only be paired with an `http.Agent`. You have, instead, supplied an ' + '`https.Agent` through `httpAgent`.');
6419
4837
  }
6420
4838
  agent = httpAgent;
@@ -11572,7 +9990,7 @@ class StakeProgram {
11572
9990
  if (custodianPubkey) {
11573
9991
  keys.push({
11574
9992
  pubkey: custodianPubkey,
11575
- isSigner: false,
9993
+ isSigner: true,
11576
9994
  isWritable: false
11577
9995
  });
11578
9996
  }
@@ -11620,7 +10038,7 @@ class StakeProgram {
11620
10038
  if (custodianPubkey) {
11621
10039
  keys.push({
11622
10040
  pubkey: custodianPubkey,
11623
- isSigner: false,
10041
+ isSigner: true,
11624
10042
  isWritable: false
11625
10043
  });
11626
10044
  }
@@ -11785,7 +10203,7 @@ class StakeProgram {
11785
10203
  if (custodianPubkey) {
11786
10204
  keys.push({
11787
10205
  pubkey: custodianPubkey,
11788
- isSigner: false,
10206
+ isSigner: true,
11789
10207
  isWritable: false
11790
10208
  });
11791
10209
  }