@bigbinary/neeto-audit-frontend 2.0.12 → 2.0.14

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/index.js CHANGED
@@ -3,14 +3,14 @@ import process$3 from 'node:process';
3
3
  import os from 'node:os';
4
4
  import tty from 'node:tty';
5
5
  import require$$1, { spawn, exec } from 'child_process';
6
- import require$$0$2 from 'events';
6
+ import require$$0$2, { EventEmitter as EventEmitter$1 } from 'events';
7
7
  import path$2 from 'path';
8
8
  import require$$3, { promises } from 'fs';
9
9
  import require$$4 from 'process';
10
10
  import { readFile, mkdir, lstat, writeFile } from 'fs/promises';
11
11
  import require$$0$3 from 'assert';
12
12
  import require$$1$1 from 'tty';
13
- import require$$1$2, { TextEncoder } from 'util';
13
+ import require$$1$2, { TextEncoder as TextEncoder$1 } from 'util';
14
14
  import require$$0$4 from 'os';
15
15
  import stream, { Readable } from 'stream';
16
16
  import require$$3$1 from 'http';
@@ -2852,6 +2852,42 @@ _curry2(function mergeDeepRight(lObj, rObj) {
2852
2852
  }, lObj, rObj);
2853
2853
  });
2854
2854
 
2855
+ /**
2856
+ * Returns a partial copy of an object containing only the keys specified. If
2857
+ * the key does not exist, the property is ignored.
2858
+ *
2859
+ * @func
2860
+ * @memberOf R
2861
+ * @since v0.1.0
2862
+ * @category Object
2863
+ * @sig [k] -> {k: v} -> {k: v}
2864
+ * @param {Array} names an array of String property names to copy onto a new object
2865
+ * @param {Object} obj The object to copy from
2866
+ * @return {Object} A new object with only properties from `names` on it.
2867
+ * @see R.omit, R.props
2868
+ * @example
2869
+ *
2870
+ * R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
2871
+ * R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}
2872
+ */
2873
+
2874
+ var pick$1 =
2875
+ /*#__PURE__*/
2876
+ _curry2(function pick(names, obj) {
2877
+ var result = {};
2878
+ var idx = 0;
2879
+
2880
+ while (idx < names.length) {
2881
+ if (names[idx] in obj) {
2882
+ result[names[idx]] = obj[names[idx]];
2883
+ }
2884
+
2885
+ idx += 1;
2886
+ }
2887
+
2888
+ return result;
2889
+ });
2890
+
2855
2891
  /**
2856
2892
  * Returns a partial copy of an object containing only the keys that satisfy
2857
2893
  * the supplied predicate.
@@ -16117,7 +16153,7 @@ const DEPENDENCIES$3 = {
16117
16153
  "@honeybadger-io/js": "6.5.3",
16118
16154
  "@honeybadger-io/react": "6.1.9",
16119
16155
  antd: "5.10.2",
16120
- axios: "1.6.0",
16156
+ axios: "1.7.4",
16121
16157
  i18next: "23.6.0",
16122
16158
  "js-logger": "1.6.1",
16123
16159
  ramda: "0.29.1",
@@ -16158,7 +16194,7 @@ const DEV_DEPENDENCIES$2 = {
16158
16194
  "@tanstack/react-query": "5.40.0",
16159
16195
  "@tanstack/react-query-devtools": "5.40.0",
16160
16196
  antd: "5.10.2",
16161
- axios: "1.6.0",
16197
+ axios: "1.7.4",
16162
16198
  classnames: "2.3.2",
16163
16199
  formik: "2.4.5",
16164
16200
  i18next: "23.6.0",
@@ -16192,7 +16228,7 @@ const PEER_DEPENDENCIES$2 = {
16192
16228
  "@honeybadger-io/react": "^6.1.9",
16193
16229
  "@tanstack/react-query": "5.40.0",
16194
16230
  "@tanstack/react-query-devtools": "5.40.0",
16195
- axios: "^1.6.0",
16231
+ axios: "1.7.4",
16196
16232
  classnames: "^2.3.2",
16197
16233
  formik: "^2.4.5",
16198
16234
  i18next: "^23.6.0",
@@ -16231,7 +16267,7 @@ const DEV_DEPENDENCIES$1 = {
16231
16267
  "@tanstack/react-query": "5.40.0",
16232
16268
  "@tanstack/react-query-devtools": "5.40.0",
16233
16269
  antd: "5.10.2",
16234
- axios: "1.6.0",
16270
+ axios: "1.7.4",
16235
16271
  classnames: "2.3.2",
16236
16272
  formik: "2.4.5",
16237
16273
  i18next: "23.6.0",
@@ -16265,7 +16301,7 @@ const PEER_DEPENDENCIES$1 = {
16265
16301
  "@honeybadger-io/react": "^6.1.9",
16266
16302
  "@tanstack/react-query": "5.40.0",
16267
16303
  "@tanstack/react-query-devtools": "5.40.0",
16268
- axios: "^1.6.0",
16304
+ axios: "1.7.4",
16269
16305
  classnames: "^2.3.2",
16270
16306
  formik: "^2.4.5",
16271
16307
  i18next: "^23.6.0",
@@ -16513,6 +16549,8 @@ const isFormData = (thing) => {
16513
16549
  */
16514
16550
  const isURLSearchParams = kindOfTest('URLSearchParams');
16515
16551
 
16552
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
16553
+
16516
16554
  /**
16517
16555
  * Trim excess whitespace off the beginning and end of a string
16518
16556
  *
@@ -16901,8 +16939,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
16901
16939
  const noop$1 = () => {};
16902
16940
 
16903
16941
  const toFiniteNumber = (value, defaultValue) => {
16904
- value = +value;
16905
- return Number.isFinite(value) ? value : defaultValue;
16942
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
16906
16943
  };
16907
16944
 
16908
16945
  const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
@@ -16972,7 +17009,37 @@ const isAsyncFn = kindOfTest('AsyncFunction');
16972
17009
  const isThenable = (thing) =>
16973
17010
  thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
16974
17011
 
16975
- var utils = {
17012
+ // original code
17013
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
17014
+
17015
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
17016
+ if (setImmediateSupported) {
17017
+ return setImmediate;
17018
+ }
17019
+
17020
+ return postMessageSupported ? ((token, callbacks) => {
17021
+ _global.addEventListener("message", ({source, data}) => {
17022
+ if (source === _global && data === token) {
17023
+ callbacks.length && callbacks.shift()();
17024
+ }
17025
+ }, false);
17026
+
17027
+ return (cb) => {
17028
+ callbacks.push(cb);
17029
+ _global.postMessage(token, "*");
17030
+ }
17031
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
17032
+ })(
17033
+ typeof setImmediate === 'function',
17034
+ isFunction$1(_global.postMessage)
17035
+ );
17036
+
17037
+ const asap = typeof queueMicrotask !== 'undefined' ?
17038
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
17039
+
17040
+ // *********************
17041
+
17042
+ var utils$1 = {
16976
17043
  isArray,
16977
17044
  isArrayBuffer,
16978
17045
  isBuffer: isBuffer$1,
@@ -16983,6 +17050,10 @@ var utils = {
16983
17050
  isBoolean,
16984
17051
  isObject,
16985
17052
  isPlainObject,
17053
+ isReadableStream,
17054
+ isRequest,
17055
+ isResponse,
17056
+ isHeaders,
16986
17057
  isUndefined,
16987
17058
  isDate,
16988
17059
  isFile,
@@ -17023,7 +17094,9 @@ var utils = {
17023
17094
  isSpecCompliantForm,
17024
17095
  toJSONObject,
17025
17096
  isAsyncFn,
17026
- isThenable
17097
+ isThenable,
17098
+ setImmediate: _setImmediate,
17099
+ asap
17027
17100
  };
17028
17101
 
17029
17102
  /**
@@ -17054,7 +17127,7 @@ function AxiosError(message, code, config, request, response) {
17054
17127
  response && (this.response = response);
17055
17128
  }
17056
17129
 
17057
- utils.inherits(AxiosError, Error, {
17130
+ utils$1.inherits(AxiosError, Error, {
17058
17131
  toJSON: function toJSON() {
17059
17132
  return {
17060
17133
  // Standard
@@ -17069,7 +17142,7 @@ utils.inherits(AxiosError, Error, {
17069
17142
  columnNumber: this.columnNumber,
17070
17143
  stack: this.stack,
17071
17144
  // Axios
17072
- config: utils.toJSONObject(this.config),
17145
+ config: utils$1.toJSONObject(this.config),
17073
17146
  code: this.code,
17074
17147
  status: this.response && this.response.status ? this.response.status : null
17075
17148
  };
@@ -17104,7 +17177,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
17104
17177
  AxiosError.from = (error, code, config, request, response, customProps) => {
17105
17178
  const axiosError = Object.create(prototype$1);
17106
17179
 
17107
- utils.toFlatObject(error, axiosError, function filter(obj) {
17180
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
17108
17181
  return obj !== Error.prototype;
17109
17182
  }, prop => {
17110
17183
  return prop !== 'isAxiosError';
@@ -29254,7 +29327,7 @@ var FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
29254
29327
  * @returns {boolean}
29255
29328
  */
29256
29329
  function isVisitable(thing) {
29257
- return utils.isPlainObject(thing) || utils.isArray(thing);
29330
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
29258
29331
  }
29259
29332
 
29260
29333
  /**
@@ -29265,7 +29338,7 @@ function isVisitable(thing) {
29265
29338
  * @returns {string} the key without the brackets.
29266
29339
  */
29267
29340
  function removeBrackets(key) {
29268
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
29341
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
29269
29342
  }
29270
29343
 
29271
29344
  /**
@@ -29294,10 +29367,10 @@ function renderKey(path, key, dots) {
29294
29367
  * @returns {boolean}
29295
29368
  */
29296
29369
  function isFlatArray(arr) {
29297
- return utils.isArray(arr) && !arr.some(isVisitable);
29370
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
29298
29371
  }
29299
29372
 
29300
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
29373
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
29301
29374
  return /^is[A-Z]/.test(prop);
29302
29375
  });
29303
29376
 
@@ -29325,7 +29398,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
29325
29398
  * @returns
29326
29399
  */
29327
29400
  function toFormData(obj, formData, options) {
29328
- if (!utils.isObject(obj)) {
29401
+ if (!utils$1.isObject(obj)) {
29329
29402
  throw new TypeError('target must be an object');
29330
29403
  }
29331
29404
 
@@ -29333,13 +29406,13 @@ function toFormData(obj, formData, options) {
29333
29406
  formData = formData || new (FormData$2 || FormData)();
29334
29407
 
29335
29408
  // eslint-disable-next-line no-param-reassign
29336
- options = utils.toFlatObject(options, {
29409
+ options = utils$1.toFlatObject(options, {
29337
29410
  metaTokens: true,
29338
29411
  dots: false,
29339
29412
  indexes: false
29340
29413
  }, false, function defined(option, source) {
29341
29414
  // eslint-disable-next-line no-eq-null,eqeqeq
29342
- return !utils.isUndefined(source[option]);
29415
+ return !utils$1.isUndefined(source[option]);
29343
29416
  });
29344
29417
 
29345
29418
  const metaTokens = options.metaTokens;
@@ -29348,24 +29421,24 @@ function toFormData(obj, formData, options) {
29348
29421
  const dots = options.dots;
29349
29422
  const indexes = options.indexes;
29350
29423
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
29351
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
29424
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
29352
29425
 
29353
- if (!utils.isFunction(visitor)) {
29426
+ if (!utils$1.isFunction(visitor)) {
29354
29427
  throw new TypeError('visitor must be a function');
29355
29428
  }
29356
29429
 
29357
29430
  function convertValue(value) {
29358
29431
  if (value === null) return '';
29359
29432
 
29360
- if (utils.isDate(value)) {
29433
+ if (utils$1.isDate(value)) {
29361
29434
  return value.toISOString();
29362
29435
  }
29363
29436
 
29364
- if (!useBlob && utils.isBlob(value)) {
29437
+ if (!useBlob && utils$1.isBlob(value)) {
29365
29438
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
29366
29439
  }
29367
29440
 
29368
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
29441
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
29369
29442
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
29370
29443
  }
29371
29444
 
@@ -29386,20 +29459,20 @@ function toFormData(obj, formData, options) {
29386
29459
  let arr = value;
29387
29460
 
29388
29461
  if (value && !path && typeof value === 'object') {
29389
- if (utils.endsWith(key, '{}')) {
29462
+ if (utils$1.endsWith(key, '{}')) {
29390
29463
  // eslint-disable-next-line no-param-reassign
29391
29464
  key = metaTokens ? key : key.slice(0, -2);
29392
29465
  // eslint-disable-next-line no-param-reassign
29393
29466
  value = JSON.stringify(value);
29394
29467
  } else if (
29395
- (utils.isArray(value) && isFlatArray(value)) ||
29396
- ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
29468
+ (utils$1.isArray(value) && isFlatArray(value)) ||
29469
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
29397
29470
  )) {
29398
29471
  // eslint-disable-next-line no-param-reassign
29399
29472
  key = removeBrackets(key);
29400
29473
 
29401
29474
  arr.forEach(function each(el, index) {
29402
- !(utils.isUndefined(el) || el === null) && formData.append(
29475
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
29403
29476
  // eslint-disable-next-line no-nested-ternary
29404
29477
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
29405
29478
  convertValue(el)
@@ -29427,7 +29500,7 @@ function toFormData(obj, formData, options) {
29427
29500
  });
29428
29501
 
29429
29502
  function build(value, path) {
29430
- if (utils.isUndefined(value)) return;
29503
+ if (utils$1.isUndefined(value)) return;
29431
29504
 
29432
29505
  if (stack.indexOf(value) !== -1) {
29433
29506
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -29435,9 +29508,9 @@ function toFormData(obj, formData, options) {
29435
29508
 
29436
29509
  stack.push(value);
29437
29510
 
29438
- utils.forEach(value, function each(el, key) {
29439
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
29440
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
29511
+ utils$1.forEach(value, function each(el, key) {
29512
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
29513
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
29441
29514
  );
29442
29515
 
29443
29516
  if (result === true) {
@@ -29448,7 +29521,7 @@ function toFormData(obj, formData, options) {
29448
29521
  stack.pop();
29449
29522
  }
29450
29523
 
29451
- if (!utils.isObject(obj)) {
29524
+ if (!utils$1.isObject(obj)) {
29452
29525
  throw new TypeError('data must be an object');
29453
29526
  }
29454
29527
 
@@ -29552,7 +29625,7 @@ function buildURL(url, params, options) {
29552
29625
  if (serializeFn) {
29553
29626
  serializedParams = serializeFn(params, options);
29554
29627
  } else {
29555
- serializedParams = utils.isURLSearchParams(params) ?
29628
+ serializedParams = utils$1.isURLSearchParams(params) ?
29556
29629
  params.toString() :
29557
29630
  new AxiosURLSearchParams(params, options).toString(_encode);
29558
29631
  }
@@ -29627,7 +29700,7 @@ class InterceptorManager {
29627
29700
  * @returns {void}
29628
29701
  */
29629
29702
  forEach(fn) {
29630
- utils.forEach(this.handlers, function forEachHandler(h) {
29703
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
29631
29704
  if (h !== null) {
29632
29705
  fn(h);
29633
29706
  }
@@ -29643,7 +29716,7 @@ var transitionalDefaults = {
29643
29716
 
29644
29717
  var URLSearchParams = require$$0$5.URLSearchParams;
29645
29718
 
29646
- var platform = {
29719
+ var platform$1 = {
29647
29720
  isNode: true,
29648
29721
  classes: {
29649
29722
  URLSearchParams,
@@ -29653,10 +29726,67 @@ var platform = {
29653
29726
  protocols: [ 'http', 'https', 'file', 'data' ]
29654
29727
  };
29655
29728
 
29729
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
29730
+
29731
+ /**
29732
+ * Determine if we're running in a standard browser environment
29733
+ *
29734
+ * This allows axios to run in a web worker, and react-native.
29735
+ * Both environments support XMLHttpRequest, but not fully standard globals.
29736
+ *
29737
+ * web workers:
29738
+ * typeof window -> undefined
29739
+ * typeof document -> undefined
29740
+ *
29741
+ * react-native:
29742
+ * navigator.product -> 'ReactNative'
29743
+ * nativescript
29744
+ * navigator.product -> 'NativeScript' or 'NS'
29745
+ *
29746
+ * @returns {boolean}
29747
+ */
29748
+ const hasStandardBrowserEnv = (
29749
+ (product) => {
29750
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
29751
+ })(typeof navigator !== 'undefined' && navigator.product);
29752
+
29753
+ /**
29754
+ * Determine if we're running in a standard browser webWorker environment
29755
+ *
29756
+ * Although the `isStandardBrowserEnv` method indicates that
29757
+ * `allows axios to run in a web worker`, the WebWorker will still be
29758
+ * filtered out due to its judgment standard
29759
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
29760
+ * This leads to a problem when axios post `FormData` in webWorker
29761
+ */
29762
+ const hasStandardBrowserWebWorkerEnv = (() => {
29763
+ return (
29764
+ typeof WorkerGlobalScope !== 'undefined' &&
29765
+ // eslint-disable-next-line no-undef
29766
+ self instanceof WorkerGlobalScope &&
29767
+ typeof self.importScripts === 'function'
29768
+ );
29769
+ })();
29770
+
29771
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
29772
+
29773
+ var utils = /*#__PURE__*/Object.freeze({
29774
+ __proto__: null,
29775
+ hasBrowserEnv: hasBrowserEnv,
29776
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
29777
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
29778
+ origin: origin
29779
+ });
29780
+
29781
+ var platform = {
29782
+ ...utils,
29783
+ ...platform$1
29784
+ };
29785
+
29656
29786
  function toURLEncodedForm(data, options) {
29657
29787
  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
29658
29788
  visitor: function(value, key, path, helpers) {
29659
- if (utils.isBuffer(value)) {
29789
+ if (platform.isNode && utils$1.isBuffer(value)) {
29660
29790
  this.append(key, value.toString('base64'));
29661
29791
  return false;
29662
29792
  }
@@ -29678,7 +29808,7 @@ function parsePropPath(name) {
29678
29808
  // foo.x.y.z
29679
29809
  // foo-x-y-z
29680
29810
  // foo x y z
29681
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
29811
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
29682
29812
  return match[0] === '[]' ? '' : match[1] || match[0];
29683
29813
  });
29684
29814
  }
@@ -29713,12 +29843,15 @@ function arrayToObject(arr) {
29713
29843
  function formDataToJSON(formData) {
29714
29844
  function buildPath(path, value, target, index) {
29715
29845
  let name = path[index++];
29846
+
29847
+ if (name === '__proto__') return true;
29848
+
29716
29849
  const isNumericKey = Number.isFinite(+name);
29717
29850
  const isLast = index >= path.length;
29718
- name = !name && utils.isArray(target) ? target.length : name;
29851
+ name = !name && utils$1.isArray(target) ? target.length : name;
29719
29852
 
29720
29853
  if (isLast) {
29721
- if (utils.hasOwnProp(target, name)) {
29854
+ if (utils$1.hasOwnProp(target, name)) {
29722
29855
  target[name] = [target[name], value];
29723
29856
  } else {
29724
29857
  target[name] = value;
@@ -29727,23 +29860,23 @@ function formDataToJSON(formData) {
29727
29860
  return !isNumericKey;
29728
29861
  }
29729
29862
 
29730
- if (!target[name] || !utils.isObject(target[name])) {
29863
+ if (!target[name] || !utils$1.isObject(target[name])) {
29731
29864
  target[name] = [];
29732
29865
  }
29733
29866
 
29734
29867
  const result = buildPath(path, value, target[name], index);
29735
29868
 
29736
- if (result && utils.isArray(target[name])) {
29869
+ if (result && utils$1.isArray(target[name])) {
29737
29870
  target[name] = arrayToObject(target[name]);
29738
29871
  }
29739
29872
 
29740
29873
  return !isNumericKey;
29741
29874
  }
29742
29875
 
29743
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
29876
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
29744
29877
  const obj = {};
29745
29878
 
29746
- utils.forEachEntry(formData, (name, value) => {
29879
+ utils$1.forEachEntry(formData, (name, value) => {
29747
29880
  buildPath(parsePropPath(name), value, obj, 0);
29748
29881
  });
29749
29882
 
@@ -29764,10 +29897,10 @@ function formDataToJSON(formData) {
29764
29897
  * @returns {string} A stringified version of the rawValue.
29765
29898
  */
29766
29899
  function stringifySafely(rawValue, parser, encoder) {
29767
- if (utils.isString(rawValue)) {
29900
+ if (utils$1.isString(rawValue)) {
29768
29901
  try {
29769
29902
  (parser || JSON.parse)(rawValue);
29770
- return utils.trim(rawValue);
29903
+ return utils$1.trim(rawValue);
29771
29904
  } catch (e) {
29772
29905
  if (e.name !== 'SyntaxError') {
29773
29906
  throw e;
@@ -29782,38 +29915,36 @@ const defaults = {
29782
29915
 
29783
29916
  transitional: transitionalDefaults,
29784
29917
 
29785
- adapter: ['xhr', 'http'],
29918
+ adapter: ['xhr', 'http', 'fetch'],
29786
29919
 
29787
29920
  transformRequest: [function transformRequest(data, headers) {
29788
29921
  const contentType = headers.getContentType() || '';
29789
29922
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
29790
- const isObjectPayload = utils.isObject(data);
29923
+ const isObjectPayload = utils$1.isObject(data);
29791
29924
 
29792
- if (isObjectPayload && utils.isHTMLForm(data)) {
29925
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
29793
29926
  data = new FormData(data);
29794
29927
  }
29795
29928
 
29796
- const isFormData = utils.isFormData(data);
29929
+ const isFormData = utils$1.isFormData(data);
29797
29930
 
29798
29931
  if (isFormData) {
29799
- if (!hasJSONContentType) {
29800
- return data;
29801
- }
29802
29932
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
29803
29933
  }
29804
29934
 
29805
- if (utils.isArrayBuffer(data) ||
29806
- utils.isBuffer(data) ||
29807
- utils.isStream(data) ||
29808
- utils.isFile(data) ||
29809
- utils.isBlob(data)
29935
+ if (utils$1.isArrayBuffer(data) ||
29936
+ utils$1.isBuffer(data) ||
29937
+ utils$1.isStream(data) ||
29938
+ utils$1.isFile(data) ||
29939
+ utils$1.isBlob(data) ||
29940
+ utils$1.isReadableStream(data)
29810
29941
  ) {
29811
29942
  return data;
29812
29943
  }
29813
- if (utils.isArrayBufferView(data)) {
29944
+ if (utils$1.isArrayBufferView(data)) {
29814
29945
  return data.buffer;
29815
29946
  }
29816
- if (utils.isURLSearchParams(data)) {
29947
+ if (utils$1.isURLSearchParams(data)) {
29817
29948
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
29818
29949
  return data.toString();
29819
29950
  }
@@ -29825,7 +29956,7 @@ const defaults = {
29825
29956
  return toURLEncodedForm(data, this.formSerializer).toString();
29826
29957
  }
29827
29958
 
29828
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
29959
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
29829
29960
  const _FormData = this.env && this.env.FormData;
29830
29961
 
29831
29962
  return toFormData(
@@ -29849,7 +29980,11 @@ const defaults = {
29849
29980
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
29850
29981
  const JSONRequested = this.responseType === 'json';
29851
29982
 
29852
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
29983
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
29984
+ return data;
29985
+ }
29986
+
29987
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
29853
29988
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
29854
29989
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
29855
29990
 
@@ -29897,7 +30032,7 @@ const defaults = {
29897
30032
  }
29898
30033
  };
29899
30034
 
29900
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
30035
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
29901
30036
  defaults.headers[method] = {};
29902
30037
  });
29903
30038
 
@@ -29905,7 +30040,7 @@ var defaults$1 = defaults;
29905
30040
 
29906
30041
  // RawAxiosHeaders whose duplicates are ignored by node
29907
30042
  // c.f. https://nodejs.org/api/http.html#http_message_headers
29908
- const ignoreDuplicateOf = utils.toObjectSet([
30043
+ const ignoreDuplicateOf = utils$1.toObjectSet([
29909
30044
  'age', 'authorization', 'content-length', 'content-type', 'etag',
29910
30045
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
29911
30046
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -29966,7 +30101,7 @@ function normalizeValue(value) {
29966
30101
  return value;
29967
30102
  }
29968
30103
 
29969
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
30104
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
29970
30105
  }
29971
30106
 
29972
30107
  function parseTokens(str) {
@@ -29984,7 +30119,7 @@ function parseTokens(str) {
29984
30119
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
29985
30120
 
29986
30121
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
29987
- if (utils.isFunction(filter)) {
30122
+ if (utils$1.isFunction(filter)) {
29988
30123
  return filter.call(this, value, header);
29989
30124
  }
29990
30125
 
@@ -29992,13 +30127,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
29992
30127
  value = header;
29993
30128
  }
29994
30129
 
29995
- if (!utils.isString(value)) return;
30130
+ if (!utils$1.isString(value)) return;
29996
30131
 
29997
- if (utils.isString(filter)) {
30132
+ if (utils$1.isString(filter)) {
29998
30133
  return value.indexOf(filter) !== -1;
29999
30134
  }
30000
30135
 
30001
- if (utils.isRegExp(filter)) {
30136
+ if (utils$1.isRegExp(filter)) {
30002
30137
  return filter.test(value);
30003
30138
  }
30004
30139
  }
@@ -30011,7 +30146,7 @@ function formatHeader(header) {
30011
30146
  }
30012
30147
 
30013
30148
  function buildAccessors(obj, header) {
30014
- const accessorName = utils.toCamelCase(' ' + header);
30149
+ const accessorName = utils$1.toCamelCase(' ' + header);
30015
30150
 
30016
30151
  ['get', 'set', 'has'].forEach(methodName => {
30017
30152
  Object.defineProperty(obj, methodName + accessorName, {
@@ -30038,7 +30173,7 @@ class AxiosHeaders {
30038
30173
  throw new Error('header name must be a non-empty string');
30039
30174
  }
30040
30175
 
30041
- const key = utils.findKey(self, lHeader);
30176
+ const key = utils$1.findKey(self, lHeader);
30042
30177
 
30043
30178
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
30044
30179
  self[key || _header] = normalizeValue(_value);
@@ -30046,12 +30181,16 @@ class AxiosHeaders {
30046
30181
  }
30047
30182
 
30048
30183
  const setHeaders = (headers, _rewrite) =>
30049
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
30184
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
30050
30185
 
30051
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
30186
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
30052
30187
  setHeaders(header, valueOrRewrite);
30053
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
30188
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
30054
30189
  setHeaders(parseHeaders(header), valueOrRewrite);
30190
+ } else if (utils$1.isHeaders(header)) {
30191
+ for (const [key, value] of header.entries()) {
30192
+ setHeader(value, key, rewrite);
30193
+ }
30055
30194
  } else {
30056
30195
  header != null && setHeader(valueOrRewrite, header, rewrite);
30057
30196
  }
@@ -30063,7 +30202,7 @@ class AxiosHeaders {
30063
30202
  header = normalizeHeader(header);
30064
30203
 
30065
30204
  if (header) {
30066
- const key = utils.findKey(this, header);
30205
+ const key = utils$1.findKey(this, header);
30067
30206
 
30068
30207
  if (key) {
30069
30208
  const value = this[key];
@@ -30076,11 +30215,11 @@ class AxiosHeaders {
30076
30215
  return parseTokens(value);
30077
30216
  }
30078
30217
 
30079
- if (utils.isFunction(parser)) {
30218
+ if (utils$1.isFunction(parser)) {
30080
30219
  return parser.call(this, value, key);
30081
30220
  }
30082
30221
 
30083
- if (utils.isRegExp(parser)) {
30222
+ if (utils$1.isRegExp(parser)) {
30084
30223
  return parser.exec(value);
30085
30224
  }
30086
30225
 
@@ -30093,7 +30232,7 @@ class AxiosHeaders {
30093
30232
  header = normalizeHeader(header);
30094
30233
 
30095
30234
  if (header) {
30096
- const key = utils.findKey(this, header);
30235
+ const key = utils$1.findKey(this, header);
30097
30236
 
30098
30237
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
30099
30238
  }
@@ -30109,7 +30248,7 @@ class AxiosHeaders {
30109
30248
  _header = normalizeHeader(_header);
30110
30249
 
30111
30250
  if (_header) {
30112
- const key = utils.findKey(self, _header);
30251
+ const key = utils$1.findKey(self, _header);
30113
30252
 
30114
30253
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
30115
30254
  delete self[key];
@@ -30119,7 +30258,7 @@ class AxiosHeaders {
30119
30258
  }
30120
30259
  }
30121
30260
 
30122
- if (utils.isArray(header)) {
30261
+ if (utils$1.isArray(header)) {
30123
30262
  header.forEach(deleteHeader);
30124
30263
  } else {
30125
30264
  deleteHeader(header);
@@ -30148,8 +30287,8 @@ class AxiosHeaders {
30148
30287
  const self = this;
30149
30288
  const headers = {};
30150
30289
 
30151
- utils.forEach(this, (value, header) => {
30152
- const key = utils.findKey(headers, header);
30290
+ utils$1.forEach(this, (value, header) => {
30291
+ const key = utils$1.findKey(headers, header);
30153
30292
 
30154
30293
  if (key) {
30155
30294
  self[key] = normalizeValue(value);
@@ -30178,8 +30317,8 @@ class AxiosHeaders {
30178
30317
  toJSON(asStrings) {
30179
30318
  const obj = Object.create(null);
30180
30319
 
30181
- utils.forEach(this, (value, header) => {
30182
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
30320
+ utils$1.forEach(this, (value, header) => {
30321
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
30183
30322
  });
30184
30323
 
30185
30324
  return obj;
@@ -30226,7 +30365,7 @@ class AxiosHeaders {
30226
30365
  }
30227
30366
  }
30228
30367
 
30229
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
30368
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
30230
30369
 
30231
30370
  return this;
30232
30371
  }
@@ -30235,7 +30374,7 @@ class AxiosHeaders {
30235
30374
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
30236
30375
 
30237
30376
  // reserved names hotfix
30238
- utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
30377
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
30239
30378
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
30240
30379
  return {
30241
30380
  get: () => value,
@@ -30245,7 +30384,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
30245
30384
  }
30246
30385
  });
30247
30386
 
30248
- utils.freezeMethods(AxiosHeaders);
30387
+ utils$1.freezeMethods(AxiosHeaders);
30249
30388
 
30250
30389
  var AxiosHeaders$1 = AxiosHeaders;
30251
30390
 
@@ -30263,7 +30402,7 @@ function transformData(fns, response) {
30263
30402
  const headers = AxiosHeaders$1.from(context.headers);
30264
30403
  let data = context.data;
30265
30404
 
30266
- utils.forEach(fns, function transform(fn) {
30405
+ utils$1.forEach(fns, function transform(fn) {
30267
30406
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
30268
30407
  });
30269
30408
 
@@ -30291,7 +30430,7 @@ function CanceledError(message, config, request) {
30291
30430
  this.name = 'CanceledError';
30292
30431
  }
30293
30432
 
30294
- utils.inherits(CanceledError, AxiosError, {
30433
+ utils$1.inherits(CanceledError, AxiosError, {
30295
30434
  __CANCEL__: true
30296
30435
  });
30297
30436
 
@@ -30343,7 +30482,7 @@ function isAbsoluteURL(url) {
30343
30482
  */
30344
30483
  function combineURLs(baseURL, relativeURL) {
30345
30484
  return relativeURL
30346
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
30485
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
30347
30486
  : baseURL;
30348
30487
  }
30349
30488
 
@@ -31165,7 +31304,7 @@ followRedirects$1.exports.wrap = wrap;
31165
31304
  var followRedirectsExports = followRedirects$1.exports;
31166
31305
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
31167
31306
 
31168
- const VERSION = "1.6.0";
31307
+ const VERSION = "1.7.4";
31169
31308
 
31170
31309
  function parseProtocol(url) {
31171
31310
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -31220,93 +31359,11 @@ function fromDataURI(uri, asBlob, options) {
31220
31359
  throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
31221
31360
  }
31222
31361
 
31223
- /**
31224
- * Throttle decorator
31225
- * @param {Function} fn
31226
- * @param {Number} freq
31227
- * @return {Function}
31228
- */
31229
- function throttle(fn, freq) {
31230
- let timestamp = 0;
31231
- const threshold = 1000 / freq;
31232
- let timer = null;
31233
- return function throttled(force, args) {
31234
- const now = Date.now();
31235
- if (force || now - timestamp > threshold) {
31236
- if (timer) {
31237
- clearTimeout(timer);
31238
- timer = null;
31239
- }
31240
- timestamp = now;
31241
- return fn.apply(null, args);
31242
- }
31243
- if (!timer) {
31244
- timer = setTimeout(() => {
31245
- timer = null;
31246
- timestamp = Date.now();
31247
- return fn.apply(null, args);
31248
- }, threshold - (now - timestamp));
31249
- }
31250
- };
31251
- }
31252
-
31253
- /**
31254
- * Calculate data maxRate
31255
- * @param {Number} [samplesCount= 10]
31256
- * @param {Number} [min= 1000]
31257
- * @returns {Function}
31258
- */
31259
- function speedometer(samplesCount, min) {
31260
- samplesCount = samplesCount || 10;
31261
- const bytes = new Array(samplesCount);
31262
- const timestamps = new Array(samplesCount);
31263
- let head = 0;
31264
- let tail = 0;
31265
- let firstSampleTS;
31266
-
31267
- min = min !== undefined ? min : 1000;
31268
-
31269
- return function push(chunkLength) {
31270
- const now = Date.now();
31271
-
31272
- const startedAt = timestamps[tail];
31273
-
31274
- if (!firstSampleTS) {
31275
- firstSampleTS = now;
31276
- }
31277
-
31278
- bytes[head] = chunkLength;
31279
- timestamps[head] = now;
31280
-
31281
- let i = tail;
31282
- let bytesCount = 0;
31283
-
31284
- while (i !== head) {
31285
- bytesCount += bytes[i++];
31286
- i = i % samplesCount;
31287
- }
31288
-
31289
- head = (head + 1) % samplesCount;
31290
-
31291
- if (head === tail) {
31292
- tail = (tail + 1) % samplesCount;
31293
- }
31294
-
31295
- if (now - firstSampleTS < min) {
31296
- return;
31297
- }
31298
-
31299
- const passed = startedAt && now - startedAt;
31300
-
31301
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
31302
- };
31303
- }
31304
-
31305
31362
  const kInternals = Symbol('internals');
31306
31363
 
31307
31364
  class AxiosTransformStream extends stream.Transform{
31308
31365
  constructor(options) {
31309
- options = utils.toFlatObject(options, {
31366
+ options = utils$1.toFlatObject(options, {
31310
31367
  maxRate: 0,
31311
31368
  chunkSize: 64 * 1024,
31312
31369
  minChunkSize: 100,
@@ -31314,19 +31371,15 @@ class AxiosTransformStream extends stream.Transform{
31314
31371
  ticksRate: 2,
31315
31372
  samplesCount: 15
31316
31373
  }, null, (prop, source) => {
31317
- return !utils.isUndefined(source[prop]);
31374
+ return !utils$1.isUndefined(source[prop]);
31318
31375
  });
31319
31376
 
31320
31377
  super({
31321
31378
  readableHighWaterMark: options.chunkSize
31322
31379
  });
31323
31380
 
31324
- const self = this;
31325
-
31326
31381
  const internals = this[kInternals] = {
31327
- length: options.length,
31328
31382
  timeWindow: options.timeWindow,
31329
- ticksRate: options.ticksRate,
31330
31383
  chunkSize: options.chunkSize,
31331
31384
  maxRate: options.maxRate,
31332
31385
  minChunkSize: options.minChunkSize,
@@ -31338,8 +31391,6 @@ class AxiosTransformStream extends stream.Transform{
31338
31391
  onReadCallback: null
31339
31392
  };
31340
31393
 
31341
- const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
31342
-
31343
31394
  this.on('newListener', event => {
31344
31395
  if (event === 'progress') {
31345
31396
  if (!internals.isCaptured) {
@@ -31347,38 +31398,6 @@ class AxiosTransformStream extends stream.Transform{
31347
31398
  }
31348
31399
  }
31349
31400
  });
31350
-
31351
- let bytesNotified = 0;
31352
-
31353
- internals.updateProgress = throttle(function throttledHandler() {
31354
- const totalBytes = internals.length;
31355
- const bytesTransferred = internals.bytesSeen;
31356
- const progressBytes = bytesTransferred - bytesNotified;
31357
- if (!progressBytes || self.destroyed) return;
31358
-
31359
- const rate = _speedometer(progressBytes);
31360
-
31361
- bytesNotified = bytesTransferred;
31362
-
31363
- process.nextTick(() => {
31364
- self.emit('progress', {
31365
- 'loaded': bytesTransferred,
31366
- 'total': totalBytes,
31367
- 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
31368
- 'bytes': progressBytes,
31369
- 'rate': rate ? rate : undefined,
31370
- 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
31371
- (totalBytes - bytesTransferred) / rate : undefined
31372
- });
31373
- });
31374
- }, internals.ticksRate);
31375
-
31376
- const onFinish = () => {
31377
- internals.updateProgress(true);
31378
- };
31379
-
31380
- this.once('end', onFinish);
31381
- this.once('error', onFinish);
31382
31401
  }
31383
31402
 
31384
31403
  _read(size) {
@@ -31392,7 +31411,6 @@ class AxiosTransformStream extends stream.Transform{
31392
31411
  }
31393
31412
 
31394
31413
  _transform(chunk, encoding, callback) {
31395
- const self = this;
31396
31414
  const internals = this[kInternals];
31397
31415
  const maxRate = internals.maxRate;
31398
31416
 
@@ -31404,16 +31422,14 @@ class AxiosTransformStream extends stream.Transform{
31404
31422
  const bytesThreshold = (maxRate / divider);
31405
31423
  const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
31406
31424
 
31407
- function pushChunk(_chunk, _callback) {
31425
+ const pushChunk = (_chunk, _callback) => {
31408
31426
  const bytes = Buffer.byteLength(_chunk);
31409
31427
  internals.bytesSeen += bytes;
31410
31428
  internals.bytes += bytes;
31411
31429
 
31412
- if (internals.isCaptured) {
31413
- internals.updateProgress();
31414
- }
31430
+ internals.isCaptured && this.emit('progress', internals.bytesSeen);
31415
31431
 
31416
- if (self.push(_chunk)) {
31432
+ if (this.push(_chunk)) {
31417
31433
  process.nextTick(_callback);
31418
31434
  } else {
31419
31435
  internals.onReadCallback = () => {
@@ -31421,7 +31437,7 @@ class AxiosTransformStream extends stream.Transform{
31421
31437
  process.nextTick(_callback);
31422
31438
  };
31423
31439
  }
31424
- }
31440
+ };
31425
31441
 
31426
31442
  const transformChunk = (_chunk, _callback) => {
31427
31443
  const chunkSize = Buffer.byteLength(_chunk);
@@ -31478,11 +31494,6 @@ class AxiosTransformStream extends stream.Transform{
31478
31494
  }
31479
31495
  });
31480
31496
  }
31481
-
31482
- setLength(length) {
31483
- this[kInternals].length = +length;
31484
- return this;
31485
- }
31486
31497
  }
31487
31498
 
31488
31499
  var AxiosTransformStream$1 = AxiosTransformStream;
@@ -31501,9 +31512,9 @@ const readBlob = async function* (blob) {
31501
31512
  }
31502
31513
  };
31503
31514
 
31504
- const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
31515
+ const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
31505
31516
 
31506
- const textEncoder = new TextEncoder();
31517
+ const textEncoder = new TextEncoder$1();
31507
31518
 
31508
31519
  const CRLF = '\r\n';
31509
31520
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -31512,7 +31523,7 @@ const CRLF_BYTES_COUNT = 2;
31512
31523
  class FormDataPart {
31513
31524
  constructor(name, value) {
31514
31525
  const {escapeName} = this.constructor;
31515
- const isStringValue = utils.isString(value);
31526
+ const isStringValue = utils$1.isString(value);
31516
31527
 
31517
31528
  let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
31518
31529
  !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
@@ -31539,7 +31550,7 @@ class FormDataPart {
31539
31550
 
31540
31551
  const {value} = this;
31541
31552
 
31542
- if(utils.isTypedArray(value)) {
31553
+ if(utils$1.isTypedArray(value)) {
31543
31554
  yield value;
31544
31555
  } else {
31545
31556
  yield* readBlob(value);
@@ -31561,10 +31572,10 @@ const formDataToStream = (form, headersHandler, options) => {
31561
31572
  const {
31562
31573
  tag = 'form-data-boundary',
31563
31574
  size = 25,
31564
- boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
31575
+ boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
31565
31576
  } = options || {};
31566
31577
 
31567
- if(!utils.isFormData(form)) {
31578
+ if(!utils$1.isFormData(form)) {
31568
31579
  throw TypeError('FormData instance required');
31569
31580
  }
31570
31581
 
@@ -31584,7 +31595,7 @@ const formDataToStream = (form, headersHandler, options) => {
31584
31595
 
31585
31596
  contentLength += boundaryBytes.byteLength * parts.length;
31586
31597
 
31587
- contentLength = utils.toFiniteNumber(contentLength);
31598
+ contentLength = utils$1.toFiniteNumber(contentLength);
31588
31599
 
31589
31600
  const computedHeaders = {
31590
31601
  'Content-Type': `multipart/form-data; boundary=${boundary}`
@@ -31630,7 +31641,7 @@ class ZlibHeaderTransformStream extends stream.Transform {
31630
31641
  }
31631
31642
 
31632
31643
  const callbackify = (fn, reducer) => {
31633
- return utils.isAsyncFn(fn) ? function (...args) {
31644
+ return utils$1.isAsyncFn(fn) ? function (...args) {
31634
31645
  const cb = args.pop();
31635
31646
  fn.apply(this, args).then((value) => {
31636
31647
  try {
@@ -31642,6 +31653,142 @@ const callbackify = (fn, reducer) => {
31642
31653
  } : fn;
31643
31654
  };
31644
31655
 
31656
+ /**
31657
+ * Calculate data maxRate
31658
+ * @param {Number} [samplesCount= 10]
31659
+ * @param {Number} [min= 1000]
31660
+ * @returns {Function}
31661
+ */
31662
+ function speedometer(samplesCount, min) {
31663
+ samplesCount = samplesCount || 10;
31664
+ const bytes = new Array(samplesCount);
31665
+ const timestamps = new Array(samplesCount);
31666
+ let head = 0;
31667
+ let tail = 0;
31668
+ let firstSampleTS;
31669
+
31670
+ min = min !== undefined ? min : 1000;
31671
+
31672
+ return function push(chunkLength) {
31673
+ const now = Date.now();
31674
+
31675
+ const startedAt = timestamps[tail];
31676
+
31677
+ if (!firstSampleTS) {
31678
+ firstSampleTS = now;
31679
+ }
31680
+
31681
+ bytes[head] = chunkLength;
31682
+ timestamps[head] = now;
31683
+
31684
+ let i = tail;
31685
+ let bytesCount = 0;
31686
+
31687
+ while (i !== head) {
31688
+ bytesCount += bytes[i++];
31689
+ i = i % samplesCount;
31690
+ }
31691
+
31692
+ head = (head + 1) % samplesCount;
31693
+
31694
+ if (head === tail) {
31695
+ tail = (tail + 1) % samplesCount;
31696
+ }
31697
+
31698
+ if (now - firstSampleTS < min) {
31699
+ return;
31700
+ }
31701
+
31702
+ const passed = startedAt && now - startedAt;
31703
+
31704
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
31705
+ };
31706
+ }
31707
+
31708
+ /**
31709
+ * Throttle decorator
31710
+ * @param {Function} fn
31711
+ * @param {Number} freq
31712
+ * @return {Function}
31713
+ */
31714
+ function throttle(fn, freq) {
31715
+ let timestamp = 0;
31716
+ let threshold = 1000 / freq;
31717
+ let lastArgs;
31718
+ let timer;
31719
+
31720
+ const invoke = (args, now = Date.now()) => {
31721
+ timestamp = now;
31722
+ lastArgs = null;
31723
+ if (timer) {
31724
+ clearTimeout(timer);
31725
+ timer = null;
31726
+ }
31727
+ fn.apply(null, args);
31728
+ };
31729
+
31730
+ const throttled = (...args) => {
31731
+ const now = Date.now();
31732
+ const passed = now - timestamp;
31733
+ if ( passed >= threshold) {
31734
+ invoke(args, now);
31735
+ } else {
31736
+ lastArgs = args;
31737
+ if (!timer) {
31738
+ timer = setTimeout(() => {
31739
+ timer = null;
31740
+ invoke(lastArgs);
31741
+ }, threshold - passed);
31742
+ }
31743
+ }
31744
+ };
31745
+
31746
+ const flush = () => lastArgs && invoke(lastArgs);
31747
+
31748
+ return [throttled, flush];
31749
+ }
31750
+
31751
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
31752
+ let bytesNotified = 0;
31753
+ const _speedometer = speedometer(50, 250);
31754
+
31755
+ return throttle(e => {
31756
+ const loaded = e.loaded;
31757
+ const total = e.lengthComputable ? e.total : undefined;
31758
+ const progressBytes = loaded - bytesNotified;
31759
+ const rate = _speedometer(progressBytes);
31760
+ const inRange = loaded <= total;
31761
+
31762
+ bytesNotified = loaded;
31763
+
31764
+ const data = {
31765
+ loaded,
31766
+ total,
31767
+ progress: total ? (loaded / total) : undefined,
31768
+ bytes: progressBytes,
31769
+ rate: rate ? rate : undefined,
31770
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
31771
+ event: e,
31772
+ lengthComputable: total != null,
31773
+ [isDownloadStream ? 'download' : 'upload']: true
31774
+ };
31775
+
31776
+ listener(data);
31777
+ }, freq);
31778
+ };
31779
+
31780
+ const progressEventDecorator = (total, throttled) => {
31781
+ const lengthComputable = total != null;
31782
+
31783
+ return [(loaded) => throttled[0]({
31784
+ lengthComputable,
31785
+ total,
31786
+ loaded
31787
+ }), throttled[1]];
31788
+ };
31789
+
31790
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
31791
+
31645
31792
  const zlibOptions = {
31646
31793
  flush: zlib.constants.Z_SYNC_FLUSH,
31647
31794
  finishFlush: zlib.constants.Z_SYNC_FLUSH
@@ -31652,7 +31799,7 @@ const brotliOptions = {
31652
31799
  finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
31653
31800
  };
31654
31801
 
31655
- const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
31802
+ const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
31656
31803
 
31657
31804
  const {http: httpFollow, https: httpsFollow} = followRedirects;
31658
31805
 
@@ -31662,6 +31809,14 @@ const supportedProtocols = platform.protocols.map(protocol => {
31662
31809
  return protocol + ':';
31663
31810
  });
31664
31811
 
31812
+ const flushOnFinish = (stream, [throttled, flush]) => {
31813
+ stream
31814
+ .on('end', flush)
31815
+ .on('error', flush);
31816
+
31817
+ return throttled;
31818
+ };
31819
+
31665
31820
  /**
31666
31821
  * If the proxy or config beforeRedirects functions are defined, call them with the options
31667
31822
  * object.
@@ -31670,12 +31825,12 @@ const supportedProtocols = platform.protocols.map(protocol => {
31670
31825
  *
31671
31826
  * @returns {Object<string, any>}
31672
31827
  */
31673
- function dispatchBeforeRedirect(options) {
31828
+ function dispatchBeforeRedirect(options, responseDetails) {
31674
31829
  if (options.beforeRedirects.proxy) {
31675
31830
  options.beforeRedirects.proxy(options);
31676
31831
  }
31677
31832
  if (options.beforeRedirects.config) {
31678
- options.beforeRedirects.config(options);
31833
+ options.beforeRedirects.config(options, responseDetails);
31679
31834
  }
31680
31835
  }
31681
31836
 
@@ -31732,7 +31887,7 @@ function setProxy(options, configProxy, location) {
31732
31887
  };
31733
31888
  }
31734
31889
 
31735
- const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
31890
+ const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
31736
31891
 
31737
31892
  // temporary hotfix
31738
31893
 
@@ -31762,7 +31917,7 @@ const wrapAsync = (asyncExecutor) => {
31762
31917
  };
31763
31918
 
31764
31919
  const resolveFamily = ({address, family}) => {
31765
- if (!utils.isString(address)) {
31920
+ if (!utils$1.isString(address)) {
31766
31921
  throw TypeError('address must be a string');
31767
31922
  }
31768
31923
  return ({
@@ -31771,7 +31926,7 @@ const resolveFamily = ({address, family}) => {
31771
31926
  });
31772
31927
  };
31773
31928
 
31774
- const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
31929
+ const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
31775
31930
 
31776
31931
  /*eslint consistent-return:0*/
31777
31932
  var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
@@ -31784,11 +31939,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31784
31939
  let req;
31785
31940
 
31786
31941
  if (lookup) {
31787
- const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);
31942
+ const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
31788
31943
  // hotfix to support opt.all option which is required for node 20.x
31789
31944
  lookup = (hostname, opt, cb) => {
31790
31945
  _lookup(hostname, opt, (err, arg0, arg1) => {
31791
- const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
31946
+ if (err) {
31947
+ return cb(err);
31948
+ }
31949
+
31950
+ const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
31792
31951
 
31793
31952
  opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
31794
31953
  });
@@ -31796,7 +31955,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31796
31955
  }
31797
31956
 
31798
31957
  // temporary internal emitter until the AxiosRequest class will be implemented
31799
- const emitter = new require$$0$2();
31958
+ const emitter = new EventEmitter$1();
31800
31959
 
31801
31960
  const onFinished = () => {
31802
31961
  if (config.cancelToken) {
@@ -31833,7 +31992,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31833
31992
 
31834
31993
  // Parse url
31835
31994
  const fullPath = buildFullPath(config.baseURL, config.url);
31836
- const parsed = new URL(fullPath, 'http://localhost');
31995
+ const parsed = new URL(fullPath, utils$1.hasBrowserEnv ? platform.origin : undefined);
31837
31996
  const protocol = parsed.protocol || supportedProtocols[0];
31838
31997
 
31839
31998
  if (protocol === 'data:') {
@@ -31860,7 +32019,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31860
32019
  convertedData = convertedData.toString(responseEncoding);
31861
32020
 
31862
32021
  if (!responseEncoding || responseEncoding === 'utf8') {
31863
- convertedData = utils.stripBOM(convertedData);
32022
+ convertedData = utils$1.stripBOM(convertedData);
31864
32023
  }
31865
32024
  } else if (responseType === 'stream') {
31866
32025
  convertedData = stream.Readable.from(convertedData);
@@ -31891,14 +32050,13 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31891
32050
  // Only set header if it hasn't been set in config
31892
32051
  headers.set('User-Agent', 'axios/' + VERSION, false);
31893
32052
 
31894
- const onDownloadProgress = config.onDownloadProgress;
31895
- const onUploadProgress = config.onUploadProgress;
32053
+ const {onUploadProgress, onDownloadProgress} = config;
31896
32054
  const maxRate = config.maxRate;
31897
32055
  let maxUploadRate = undefined;
31898
32056
  let maxDownloadRate = undefined;
31899
32057
 
31900
32058
  // support for spec compliant FormData objects
31901
- if (utils.isSpecCompliantForm(data)) {
32059
+ if (utils$1.isSpecCompliantForm(data)) {
31902
32060
  const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
31903
32061
 
31904
32062
  data = formDataToStream(data, (formHeaders) => {
@@ -31908,7 +32066,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31908
32066
  boundary: userBoundary && userBoundary[1] || undefined
31909
32067
  });
31910
32068
  // support for https://www.npmjs.com/package/form-data api
31911
- } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
32069
+ } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
31912
32070
  headers.set(data.getHeaders());
31913
32071
 
31914
32072
  if (!headers.hasContentLength()) {
@@ -31919,14 +32077,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31919
32077
  } catch (e) {
31920
32078
  }
31921
32079
  }
31922
- } else if (utils.isBlob(data)) {
32080
+ } else if (utils$1.isBlob(data)) {
31923
32081
  data.size && headers.setContentType(data.type || 'application/octet-stream');
31924
32082
  headers.setContentLength(data.size || 0);
31925
32083
  data = stream.Readable.from(readBlob(data));
31926
- } else if (data && !utils.isStream(data)) {
31927
- if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
32084
+ } else if (data && !utils$1.isStream(data)) {
32085
+ if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
31928
32086
  data = Buffer.from(new Uint8Array(data));
31929
- } else if (utils.isString(data)) {
32087
+ } else if (utils$1.isString(data)) {
31930
32088
  data = Buffer.from(data, 'utf-8');
31931
32089
  } else {
31932
32090
  return reject(new AxiosError(
@@ -31948,9 +32106,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31948
32106
  }
31949
32107
  }
31950
32108
 
31951
- const contentLength = utils.toFiniteNumber(headers.getContentLength());
32109
+ const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
31952
32110
 
31953
- if (utils.isArray(maxRate)) {
32111
+ if (utils$1.isArray(maxRate)) {
31954
32112
  maxUploadRate = maxRate[0];
31955
32113
  maxDownloadRate = maxRate[1];
31956
32114
  } else {
@@ -31958,20 +32116,21 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31958
32116
  }
31959
32117
 
31960
32118
  if (data && (onUploadProgress || maxUploadRate)) {
31961
- if (!utils.isStream(data)) {
32119
+ if (!utils$1.isStream(data)) {
31962
32120
  data = stream.Readable.from(data, {objectMode: false});
31963
32121
  }
31964
32122
 
31965
32123
  data = stream.pipeline([data, new AxiosTransformStream$1({
31966
- length: contentLength,
31967
- maxRate: utils.toFiniteNumber(maxUploadRate)
31968
- })], utils.noop);
31969
-
31970
- onUploadProgress && data.on('progress', progress => {
31971
- onUploadProgress(Object.assign(progress, {
31972
- upload: true
31973
- }));
31974
- });
32124
+ maxRate: utils$1.toFiniteNumber(maxUploadRate)
32125
+ })], utils$1.noop);
32126
+
32127
+ onUploadProgress && data.on('progress', flushOnFinish(
32128
+ data,
32129
+ progressEventDecorator(
32130
+ contentLength,
32131
+ progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
32132
+ )
32133
+ ));
31975
32134
  }
31976
32135
 
31977
32136
  // HTTP basic authentication
@@ -32024,7 +32183,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32024
32183
  };
32025
32184
 
32026
32185
  // cacheable-lookup integration hotfix
32027
- !utils.isUndefined(lookup) && (options.lookup = lookup);
32186
+ !utils$1.isUndefined(lookup) && (options.lookup = lookup);
32028
32187
 
32029
32188
  if (config.socketPath) {
32030
32189
  options.socketPath = config.socketPath;
@@ -32070,17 +32229,18 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32070
32229
 
32071
32230
  const responseLength = +res.headers['content-length'];
32072
32231
 
32073
- if (onDownloadProgress) {
32232
+ if (onDownloadProgress || maxDownloadRate) {
32074
32233
  const transformStream = new AxiosTransformStream$1({
32075
- length: utils.toFiniteNumber(responseLength),
32076
- maxRate: utils.toFiniteNumber(maxDownloadRate)
32234
+ maxRate: utils$1.toFiniteNumber(maxDownloadRate)
32077
32235
  });
32078
32236
 
32079
- onDownloadProgress && transformStream.on('progress', progress => {
32080
- onDownloadProgress(Object.assign(progress, {
32081
- download: true
32082
- }));
32083
- });
32237
+ onDownloadProgress && transformStream.on('progress', flushOnFinish(
32238
+ transformStream,
32239
+ progressEventDecorator(
32240
+ responseLength,
32241
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
32242
+ )
32243
+ ));
32084
32244
 
32085
32245
  streams.push(transformStream);
32086
32246
  }
@@ -32128,7 +32288,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32128
32288
  }
32129
32289
  }
32130
32290
 
32131
- responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
32291
+ responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
32132
32292
 
32133
32293
  const offListeners = stream.finished(responseStream, () => {
32134
32294
  offListeners();
@@ -32190,7 +32350,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32190
32350
  if (responseType !== 'arraybuffer') {
32191
32351
  responseData = responseData.toString(responseEncoding);
32192
32352
  if (!responseEncoding || responseEncoding === 'utf8') {
32193
- responseData = utils.stripBOM(responseData);
32353
+ responseData = utils$1.stripBOM(responseData);
32194
32354
  }
32195
32355
  }
32196
32356
  response.data = responseData;
@@ -32267,7 +32427,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32267
32427
 
32268
32428
 
32269
32429
  // Send the request
32270
- if (utils.isStream(data)) {
32430
+ if (utils$1.isStream(data)) {
32271
32431
  let ended = false;
32272
32432
  let errored = false;
32273
32433
 
@@ -32293,55 +32453,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32293
32453
  });
32294
32454
  };
32295
32455
 
32296
- var cookies = platform.isStandardBrowserEnv ?
32297
-
32298
- // Standard browser envs support document.cookie
32299
- (function standardBrowserEnv() {
32300
- return {
32301
- write: function write(name, value, expires, path, domain, secure) {
32302
- const cookie = [];
32303
- cookie.push(name + '=' + encodeURIComponent(value));
32304
-
32305
- if (utils.isNumber(expires)) {
32306
- cookie.push('expires=' + new Date(expires).toGMTString());
32307
- }
32308
-
32309
- if (utils.isString(path)) {
32310
- cookie.push('path=' + path);
32311
- }
32312
-
32313
- if (utils.isString(domain)) {
32314
- cookie.push('domain=' + domain);
32315
- }
32316
-
32317
- if (secure === true) {
32318
- cookie.push('secure');
32319
- }
32320
-
32321
- document.cookie = cookie.join('; ');
32322
- },
32323
-
32324
- read: function read(name) {
32325
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
32326
- return (match ? decodeURIComponent(match[3]) : null);
32327
- },
32328
-
32329
- remove: function remove(name) {
32330
- this.write(name, '', Date.now() - 86400000);
32331
- }
32332
- };
32333
- })() :
32334
-
32335
- // Non standard browser env (web workers, react-native) lack needed support.
32336
- (function nonStandardBrowserEnv() {
32337
- return {
32338
- write: function write() {},
32339
- read: function read() { return null; },
32340
- remove: function remove() {}
32341
- };
32342
- })();
32343
-
32344
- var isURLSameOrigin = platform.isStandardBrowserEnv ?
32456
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
32345
32457
 
32346
32458
  // Standard browser envs have full support of the APIs needed to test
32347
32459
  // whether the request URL is of the same origin as current location.
@@ -32351,7 +32463,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
32351
32463
  let originURL;
32352
32464
 
32353
32465
  /**
32354
- * Parse a URL to discover it's components
32466
+ * Parse a URL to discover its components
32355
32467
  *
32356
32468
  * @param {String} url The URL to be parsed
32357
32469
  * @returns {Object}
@@ -32391,7 +32503,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
32391
32503
  * @returns {boolean} True if URL shares the same origin, otherwise false
32392
32504
  */
32393
32505
  return function isURLSameOrigin(requestURL) {
32394
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
32506
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
32395
32507
  return (parsed.protocol === originURL.protocol &&
32396
32508
  parsed.host === originURL.host);
32397
32509
  };
@@ -32404,81 +32516,222 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
32404
32516
  };
32405
32517
  })();
32406
32518
 
32407
- function progressEventReducer(listener, isDownloadStream) {
32408
- let bytesNotified = 0;
32409
- const _speedometer = speedometer(50, 250);
32519
+ var cookies = platform.hasStandardBrowserEnv ?
32410
32520
 
32411
- return e => {
32412
- const loaded = e.loaded;
32413
- const total = e.lengthComputable ? e.total : undefined;
32414
- const progressBytes = loaded - bytesNotified;
32415
- const rate = _speedometer(progressBytes);
32416
- const inRange = loaded <= total;
32521
+ // Standard browser envs support document.cookie
32522
+ {
32523
+ write(name, value, expires, path, domain, secure) {
32524
+ const cookie = [name + '=' + encodeURIComponent(value)];
32417
32525
 
32418
- bytesNotified = loaded;
32526
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
32419
32527
 
32420
- const data = {
32421
- loaded,
32422
- total,
32423
- progress: total ? (loaded / total) : undefined,
32424
- bytes: progressBytes,
32425
- rate: rate ? rate : undefined,
32426
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
32427
- event: e
32428
- };
32528
+ utils$1.isString(path) && cookie.push('path=' + path);
32429
32529
 
32430
- data[isDownloadStream ? 'download' : 'upload'] = true;
32530
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
32431
32531
 
32432
- listener(data);
32532
+ secure === true && cookie.push('secure');
32533
+
32534
+ document.cookie = cookie.join('; ');
32535
+ },
32536
+
32537
+ read(name) {
32538
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
32539
+ return (match ? decodeURIComponent(match[3]) : null);
32540
+ },
32541
+
32542
+ remove(name) {
32543
+ this.write(name, '', Date.now() - 86400000);
32544
+ }
32545
+ }
32546
+
32547
+ :
32548
+
32549
+ // Non-standard browser env (web workers, react-native) lack needed support.
32550
+ {
32551
+ write() {},
32552
+ read() {
32553
+ return null;
32554
+ },
32555
+ remove() {}
32556
+ };
32557
+
32558
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
32559
+
32560
+ /**
32561
+ * Config-specific merge-function which creates a new config-object
32562
+ * by merging two configuration objects together.
32563
+ *
32564
+ * @param {Object} config1
32565
+ * @param {Object} config2
32566
+ *
32567
+ * @returns {Object} New object resulting from merging config2 to config1
32568
+ */
32569
+ function mergeConfig(config1, config2) {
32570
+ // eslint-disable-next-line no-param-reassign
32571
+ config2 = config2 || {};
32572
+ const config = {};
32573
+
32574
+ function getMergedValue(target, source, caseless) {
32575
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
32576
+ return utils$1.merge.call({caseless}, target, source);
32577
+ } else if (utils$1.isPlainObject(source)) {
32578
+ return utils$1.merge({}, source);
32579
+ } else if (utils$1.isArray(source)) {
32580
+ return source.slice();
32581
+ }
32582
+ return source;
32583
+ }
32584
+
32585
+ // eslint-disable-next-line consistent-return
32586
+ function mergeDeepProperties(a, b, caseless) {
32587
+ if (!utils$1.isUndefined(b)) {
32588
+ return getMergedValue(a, b, caseless);
32589
+ } else if (!utils$1.isUndefined(a)) {
32590
+ return getMergedValue(undefined, a, caseless);
32591
+ }
32592
+ }
32593
+
32594
+ // eslint-disable-next-line consistent-return
32595
+ function valueFromConfig2(a, b) {
32596
+ if (!utils$1.isUndefined(b)) {
32597
+ return getMergedValue(undefined, b);
32598
+ }
32599
+ }
32600
+
32601
+ // eslint-disable-next-line consistent-return
32602
+ function defaultToConfig2(a, b) {
32603
+ if (!utils$1.isUndefined(b)) {
32604
+ return getMergedValue(undefined, b);
32605
+ } else if (!utils$1.isUndefined(a)) {
32606
+ return getMergedValue(undefined, a);
32607
+ }
32608
+ }
32609
+
32610
+ // eslint-disable-next-line consistent-return
32611
+ function mergeDirectKeys(a, b, prop) {
32612
+ if (prop in config2) {
32613
+ return getMergedValue(a, b);
32614
+ } else if (prop in config1) {
32615
+ return getMergedValue(undefined, a);
32616
+ }
32617
+ }
32618
+
32619
+ const mergeMap = {
32620
+ url: valueFromConfig2,
32621
+ method: valueFromConfig2,
32622
+ data: valueFromConfig2,
32623
+ baseURL: defaultToConfig2,
32624
+ transformRequest: defaultToConfig2,
32625
+ transformResponse: defaultToConfig2,
32626
+ paramsSerializer: defaultToConfig2,
32627
+ timeout: defaultToConfig2,
32628
+ timeoutMessage: defaultToConfig2,
32629
+ withCredentials: defaultToConfig2,
32630
+ withXSRFToken: defaultToConfig2,
32631
+ adapter: defaultToConfig2,
32632
+ responseType: defaultToConfig2,
32633
+ xsrfCookieName: defaultToConfig2,
32634
+ xsrfHeaderName: defaultToConfig2,
32635
+ onUploadProgress: defaultToConfig2,
32636
+ onDownloadProgress: defaultToConfig2,
32637
+ decompress: defaultToConfig2,
32638
+ maxContentLength: defaultToConfig2,
32639
+ maxBodyLength: defaultToConfig2,
32640
+ beforeRedirect: defaultToConfig2,
32641
+ transport: defaultToConfig2,
32642
+ httpAgent: defaultToConfig2,
32643
+ httpsAgent: defaultToConfig2,
32644
+ cancelToken: defaultToConfig2,
32645
+ socketPath: defaultToConfig2,
32646
+ responseEncoding: defaultToConfig2,
32647
+ validateStatus: mergeDirectKeys,
32648
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
32433
32649
  };
32650
+
32651
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
32652
+ const merge = mergeMap[prop] || mergeDeepProperties;
32653
+ const configValue = merge(config1[prop], config2[prop], prop);
32654
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
32655
+ });
32656
+
32657
+ return config;
32434
32658
  }
32435
32659
 
32436
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
32660
+ var resolveConfig = (config) => {
32661
+ const newConfig = mergeConfig({}, config);
32437
32662
 
32438
- var xhrAdapter = isXHRAdapterSupported && function (config) {
32439
- return new Promise(function dispatchXhrRequest(resolve, reject) {
32440
- let requestData = config.data;
32441
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
32442
- const responseType = config.responseType;
32443
- let onCanceled;
32444
- function done() {
32445
- if (config.cancelToken) {
32446
- config.cancelToken.unsubscribe(onCanceled);
32447
- }
32663
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
32448
32664
 
32449
- if (config.signal) {
32450
- config.signal.removeEventListener('abort', onCanceled);
32451
- }
32665
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
32666
+
32667
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
32668
+
32669
+ // HTTP basic authentication
32670
+ if (auth) {
32671
+ headers.set('Authorization', 'Basic ' +
32672
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
32673
+ );
32674
+ }
32675
+
32676
+ let contentType;
32677
+
32678
+ if (utils$1.isFormData(data)) {
32679
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
32680
+ headers.setContentType(undefined); // Let the browser set it
32681
+ } else if ((contentType = headers.getContentType()) !== false) {
32682
+ // fix semicolon duplication issue for ReactNative FormData implementation
32683
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
32684
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
32452
32685
  }
32686
+ }
32687
+
32688
+ // Add xsrf header
32689
+ // This is only done if running in a standard browser environment.
32690
+ // Specifically not if we're in a web worker, or react-native.
32453
32691
 
32454
- let contentType;
32692
+ if (platform.hasStandardBrowserEnv) {
32693
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
32455
32694
 
32456
- if (utils.isFormData(requestData)) {
32457
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
32458
- requestHeaders.setContentType(false); // Let the browser set it
32459
- } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
32460
- requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
32461
- } else if(utils.isString(contentType = requestHeaders.getContentType())){
32462
- // fix semicolon duplication issue for ReactNative FormData implementation
32463
- requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
32695
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
32696
+ // Add xsrf header
32697
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
32698
+
32699
+ if (xsrfValue) {
32700
+ headers.set(xsrfHeaderName, xsrfValue);
32464
32701
  }
32465
32702
  }
32703
+ }
32466
32704
 
32467
- let request = new XMLHttpRequest();
32705
+ return newConfig;
32706
+ };
32468
32707
 
32469
- // HTTP basic authentication
32470
- if (config.auth) {
32471
- const username = config.auth.username || '';
32472
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
32473
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
32708
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
32709
+
32710
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
32711
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
32712
+ const _config = resolveConfig(config);
32713
+ let requestData = _config.data;
32714
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
32715
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
32716
+ let onCanceled;
32717
+ let uploadThrottled, downloadThrottled;
32718
+ let flushUpload, flushDownload;
32719
+
32720
+ function done() {
32721
+ flushUpload && flushUpload(); // flush events
32722
+ flushDownload && flushDownload(); // flush events
32723
+
32724
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
32725
+
32726
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
32474
32727
  }
32475
32728
 
32476
- const fullPath = buildFullPath(config.baseURL, config.url);
32729
+ let request = new XMLHttpRequest();
32477
32730
 
32478
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
32731
+ request.open(_config.method.toUpperCase(), _config.url, true);
32479
32732
 
32480
32733
  // Set the request timeout in MS
32481
- request.timeout = config.timeout;
32734
+ request.timeout = _config.timeout;
32482
32735
 
32483
32736
  function onloadend() {
32484
32737
  if (!request) {
@@ -32558,10 +32811,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32558
32811
 
32559
32812
  // Handle timeout
32560
32813
  request.ontimeout = function handleTimeout() {
32561
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
32562
- const transitional = config.transitional || transitionalDefaults;
32563
- if (config.timeoutErrorMessage) {
32564
- timeoutErrorMessage = config.timeoutErrorMessage;
32814
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
32815
+ const transitional = _config.transitional || transitionalDefaults;
32816
+ if (_config.timeoutErrorMessage) {
32817
+ timeoutErrorMessage = _config.timeoutErrorMessage;
32565
32818
  }
32566
32819
  reject(new AxiosError(
32567
32820
  timeoutErrorMessage,
@@ -32573,50 +32826,42 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32573
32826
  request = null;
32574
32827
  };
32575
32828
 
32576
- // Add xsrf header
32577
- // This is only done if running in a standard browser environment.
32578
- // Specifically not if we're in a web worker, or react-native.
32579
- if (platform.isStandardBrowserEnv) {
32580
- // Add xsrf header
32581
- // regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
32582
- const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
32583
-
32584
- if (xsrfValue) {
32585
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
32586
- }
32587
- }
32588
-
32589
32829
  // Remove Content-Type if data is undefined
32590
32830
  requestData === undefined && requestHeaders.setContentType(null);
32591
32831
 
32592
32832
  // Add headers to the request
32593
32833
  if ('setRequestHeader' in request) {
32594
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
32834
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
32595
32835
  request.setRequestHeader(key, val);
32596
32836
  });
32597
32837
  }
32598
32838
 
32599
32839
  // Add withCredentials to request if needed
32600
- if (!utils.isUndefined(config.withCredentials)) {
32601
- request.withCredentials = !!config.withCredentials;
32840
+ if (!utils$1.isUndefined(_config.withCredentials)) {
32841
+ request.withCredentials = !!_config.withCredentials;
32602
32842
  }
32603
32843
 
32604
32844
  // Add responseType to request if needed
32605
32845
  if (responseType && responseType !== 'json') {
32606
- request.responseType = config.responseType;
32846
+ request.responseType = _config.responseType;
32607
32847
  }
32608
32848
 
32609
32849
  // Handle progress if needed
32610
- if (typeof config.onDownloadProgress === 'function') {
32611
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
32850
+ if (onDownloadProgress) {
32851
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
32852
+ request.addEventListener('progress', downloadThrottled);
32612
32853
  }
32613
32854
 
32614
32855
  // Not all browsers support upload events
32615
- if (typeof config.onUploadProgress === 'function' && request.upload) {
32616
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
32856
+ if (onUploadProgress && request.upload) {
32857
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
32858
+
32859
+ request.upload.addEventListener('progress', uploadThrottled);
32860
+
32861
+ request.upload.addEventListener('loadend', flushUpload);
32617
32862
  }
32618
32863
 
32619
- if (config.cancelToken || config.signal) {
32864
+ if (_config.cancelToken || _config.signal) {
32620
32865
  // Handle cancellation
32621
32866
  // eslint-disable-next-line func-names
32622
32867
  onCanceled = cancel => {
@@ -32628,13 +32873,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32628
32873
  request = null;
32629
32874
  };
32630
32875
 
32631
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
32632
- if (config.signal) {
32633
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
32876
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
32877
+ if (_config.signal) {
32878
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
32634
32879
  }
32635
32880
  }
32636
32881
 
32637
- const protocol = parseProtocol(fullPath);
32882
+ const protocol = parseProtocol(_config.url);
32638
32883
 
32639
32884
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
32640
32885
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -32647,12 +32892,340 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32647
32892
  });
32648
32893
  };
32649
32894
 
32895
+ const composeSignals = (signals, timeout) => {
32896
+ let controller = new AbortController();
32897
+
32898
+ let aborted;
32899
+
32900
+ const onabort = function (cancel) {
32901
+ if (!aborted) {
32902
+ aborted = true;
32903
+ unsubscribe();
32904
+ const err = cancel instanceof Error ? cancel : this.reason;
32905
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
32906
+ }
32907
+ };
32908
+
32909
+ let timer = timeout && setTimeout(() => {
32910
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
32911
+ }, timeout);
32912
+
32913
+ const unsubscribe = () => {
32914
+ if (signals) {
32915
+ timer && clearTimeout(timer);
32916
+ timer = null;
32917
+ signals.forEach(signal => {
32918
+ signal &&
32919
+ (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
32920
+ });
32921
+ signals = null;
32922
+ }
32923
+ };
32924
+
32925
+ signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
32926
+
32927
+ const {signal} = controller;
32928
+
32929
+ signal.unsubscribe = unsubscribe;
32930
+
32931
+ return [signal, () => {
32932
+ timer && clearTimeout(timer);
32933
+ timer = null;
32934
+ }];
32935
+ };
32936
+
32937
+ const streamChunk = function* (chunk, chunkSize) {
32938
+ let len = chunk.byteLength;
32939
+
32940
+ if (!chunkSize || len < chunkSize) {
32941
+ yield chunk;
32942
+ return;
32943
+ }
32944
+
32945
+ let pos = 0;
32946
+ let end;
32947
+
32948
+ while (pos < len) {
32949
+ end = pos + chunkSize;
32950
+ yield chunk.slice(pos, end);
32951
+ pos = end;
32952
+ }
32953
+ };
32954
+
32955
+ const readBytes = async function* (iterable, chunkSize, encode) {
32956
+ for await (const chunk of iterable) {
32957
+ yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
32958
+ }
32959
+ };
32960
+
32961
+ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
32962
+ const iterator = readBytes(stream, chunkSize, encode);
32963
+
32964
+ let bytes = 0;
32965
+ let done;
32966
+ let _onFinish = (e) => {
32967
+ if (!done) {
32968
+ done = true;
32969
+ onFinish && onFinish(e);
32970
+ }
32971
+ };
32972
+
32973
+ return new ReadableStream({
32974
+ async pull(controller) {
32975
+ try {
32976
+ const {done, value} = await iterator.next();
32977
+
32978
+ if (done) {
32979
+ _onFinish();
32980
+ controller.close();
32981
+ return;
32982
+ }
32983
+
32984
+ let len = value.byteLength;
32985
+ if (onProgress) {
32986
+ let loadedBytes = bytes += len;
32987
+ onProgress(loadedBytes);
32988
+ }
32989
+ controller.enqueue(new Uint8Array(value));
32990
+ } catch (err) {
32991
+ _onFinish(err);
32992
+ throw err;
32993
+ }
32994
+ },
32995
+ cancel(reason) {
32996
+ _onFinish(reason);
32997
+ return iterator.return();
32998
+ }
32999
+ }, {
33000
+ highWaterMark: 2
33001
+ })
33002
+ };
33003
+
33004
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
33005
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
33006
+
33007
+ // used only inside the fetch adapter
33008
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
33009
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
33010
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
33011
+ );
33012
+
33013
+ const test = (fn, ...args) => {
33014
+ try {
33015
+ return !!fn(...args);
33016
+ } catch (e) {
33017
+ return false
33018
+ }
33019
+ };
33020
+
33021
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
33022
+ let duplexAccessed = false;
33023
+
33024
+ const hasContentType = new Request(platform.origin, {
33025
+ body: new ReadableStream(),
33026
+ method: 'POST',
33027
+ get duplex() {
33028
+ duplexAccessed = true;
33029
+ return 'half';
33030
+ },
33031
+ }).headers.has('Content-Type');
33032
+
33033
+ return duplexAccessed && !hasContentType;
33034
+ });
33035
+
33036
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
33037
+
33038
+ const supportsResponseStream = isReadableStreamSupported &&
33039
+ test(() => utils$1.isReadableStream(new Response('').body));
33040
+
33041
+
33042
+ const resolvers = {
33043
+ stream: supportsResponseStream && ((res) => res.body)
33044
+ };
33045
+
33046
+ isFetchSupported && (((res) => {
33047
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
33048
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
33049
+ (_, config) => {
33050
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
33051
+ });
33052
+ });
33053
+ })(new Response));
33054
+
33055
+ const getBodyLength = async (body) => {
33056
+ if (body == null) {
33057
+ return 0;
33058
+ }
33059
+
33060
+ if(utils$1.isBlob(body)) {
33061
+ return body.size;
33062
+ }
33063
+
33064
+ if(utils$1.isSpecCompliantForm(body)) {
33065
+ return (await new Request(body).arrayBuffer()).byteLength;
33066
+ }
33067
+
33068
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
33069
+ return body.byteLength;
33070
+ }
33071
+
33072
+ if(utils$1.isURLSearchParams(body)) {
33073
+ body = body + '';
33074
+ }
33075
+
33076
+ if(utils$1.isString(body)) {
33077
+ return (await encodeText(body)).byteLength;
33078
+ }
33079
+ };
33080
+
33081
+ const resolveBodyLength = async (headers, body) => {
33082
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
33083
+
33084
+ return length == null ? getBodyLength(body) : length;
33085
+ };
33086
+
33087
+ var fetchAdapter = isFetchSupported && (async (config) => {
33088
+ let {
33089
+ url,
33090
+ method,
33091
+ data,
33092
+ signal,
33093
+ cancelToken,
33094
+ timeout,
33095
+ onDownloadProgress,
33096
+ onUploadProgress,
33097
+ responseType,
33098
+ headers,
33099
+ withCredentials = 'same-origin',
33100
+ fetchOptions
33101
+ } = resolveConfig(config);
33102
+
33103
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
33104
+
33105
+ let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
33106
+ composeSignals([signal, cancelToken], timeout) : [];
33107
+
33108
+ let finished, request;
33109
+
33110
+ const onFinish = () => {
33111
+ !finished && setTimeout(() => {
33112
+ composedSignal && composedSignal.unsubscribe();
33113
+ });
33114
+
33115
+ finished = true;
33116
+ };
33117
+
33118
+ let requestContentLength;
33119
+
33120
+ try {
33121
+ if (
33122
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
33123
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
33124
+ ) {
33125
+ let _request = new Request(url, {
33126
+ method: 'POST',
33127
+ body: data,
33128
+ duplex: "half"
33129
+ });
33130
+
33131
+ let contentTypeHeader;
33132
+
33133
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
33134
+ headers.setContentType(contentTypeHeader);
33135
+ }
33136
+
33137
+ if (_request.body) {
33138
+ const [onProgress, flush] = progressEventDecorator(
33139
+ requestContentLength,
33140
+ progressEventReducer(asyncDecorator(onUploadProgress))
33141
+ );
33142
+
33143
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
33144
+ }
33145
+ }
33146
+
33147
+ if (!utils$1.isString(withCredentials)) {
33148
+ withCredentials = withCredentials ? 'include' : 'omit';
33149
+ }
33150
+
33151
+ request = new Request(url, {
33152
+ ...fetchOptions,
33153
+ signal: composedSignal,
33154
+ method: method.toUpperCase(),
33155
+ headers: headers.normalize().toJSON(),
33156
+ body: data,
33157
+ duplex: "half",
33158
+ credentials: withCredentials
33159
+ });
33160
+
33161
+ let response = await fetch(request);
33162
+
33163
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
33164
+
33165
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
33166
+ const options = {};
33167
+
33168
+ ['status', 'statusText', 'headers'].forEach(prop => {
33169
+ options[prop] = response[prop];
33170
+ });
33171
+
33172
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
33173
+
33174
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
33175
+ responseContentLength,
33176
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
33177
+ ) || [];
33178
+
33179
+ response = new Response(
33180
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
33181
+ flush && flush();
33182
+ isStreamResponse && onFinish();
33183
+ }, encodeText),
33184
+ options
33185
+ );
33186
+ }
33187
+
33188
+ responseType = responseType || 'text';
33189
+
33190
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
33191
+
33192
+ !isStreamResponse && onFinish();
33193
+
33194
+ stopTimeout && stopTimeout();
33195
+
33196
+ return await new Promise((resolve, reject) => {
33197
+ settle(resolve, reject, {
33198
+ data: responseData,
33199
+ headers: AxiosHeaders$1.from(response.headers),
33200
+ status: response.status,
33201
+ statusText: response.statusText,
33202
+ config,
33203
+ request
33204
+ });
33205
+ })
33206
+ } catch (err) {
33207
+ onFinish();
33208
+
33209
+ if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
33210
+ throw Object.assign(
33211
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
33212
+ {
33213
+ cause: err.cause || err
33214
+ }
33215
+ )
33216
+ }
33217
+
33218
+ throw AxiosError.from(err, err && err.code, config, request);
33219
+ }
33220
+ });
33221
+
32650
33222
  const knownAdapters = {
32651
33223
  http: httpAdapter,
32652
- xhr: xhrAdapter
33224
+ xhr: xhrAdapter,
33225
+ fetch: fetchAdapter
32653
33226
  };
32654
33227
 
32655
- utils.forEach(knownAdapters, (fn, value) => {
33228
+ utils$1.forEach(knownAdapters, (fn, value) => {
32656
33229
  if (fn) {
32657
33230
  try {
32658
33231
  Object.defineProperty(fn, 'name', {value});
@@ -32665,11 +33238,11 @@ utils.forEach(knownAdapters, (fn, value) => {
32665
33238
 
32666
33239
  const renderReason = (reason) => `- ${reason}`;
32667
33240
 
32668
- const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
33241
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
32669
33242
 
32670
33243
  var adapters = {
32671
33244
  getAdapter: (adapters) => {
32672
- adapters = utils.isArray(adapters) ? adapters : [adapters];
33245
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
32673
33246
 
32674
33247
  const {length} = adapters;
32675
33248
  let nameOrAdapter;
@@ -32793,107 +33366,6 @@ function dispatchRequest(config) {
32793
33366
  });
32794
33367
  }
32795
33368
 
32796
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
32797
-
32798
- /**
32799
- * Config-specific merge-function which creates a new config-object
32800
- * by merging two configuration objects together.
32801
- *
32802
- * @param {Object} config1
32803
- * @param {Object} config2
32804
- *
32805
- * @returns {Object} New object resulting from merging config2 to config1
32806
- */
32807
- function mergeConfig(config1, config2) {
32808
- // eslint-disable-next-line no-param-reassign
32809
- config2 = config2 || {};
32810
- const config = {};
32811
-
32812
- function getMergedValue(target, source, caseless) {
32813
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
32814
- return utils.merge.call({caseless}, target, source);
32815
- } else if (utils.isPlainObject(source)) {
32816
- return utils.merge({}, source);
32817
- } else if (utils.isArray(source)) {
32818
- return source.slice();
32819
- }
32820
- return source;
32821
- }
32822
-
32823
- // eslint-disable-next-line consistent-return
32824
- function mergeDeepProperties(a, b, caseless) {
32825
- if (!utils.isUndefined(b)) {
32826
- return getMergedValue(a, b, caseless);
32827
- } else if (!utils.isUndefined(a)) {
32828
- return getMergedValue(undefined, a, caseless);
32829
- }
32830
- }
32831
-
32832
- // eslint-disable-next-line consistent-return
32833
- function valueFromConfig2(a, b) {
32834
- if (!utils.isUndefined(b)) {
32835
- return getMergedValue(undefined, b);
32836
- }
32837
- }
32838
-
32839
- // eslint-disable-next-line consistent-return
32840
- function defaultToConfig2(a, b) {
32841
- if (!utils.isUndefined(b)) {
32842
- return getMergedValue(undefined, b);
32843
- } else if (!utils.isUndefined(a)) {
32844
- return getMergedValue(undefined, a);
32845
- }
32846
- }
32847
-
32848
- // eslint-disable-next-line consistent-return
32849
- function mergeDirectKeys(a, b, prop) {
32850
- if (prop in config2) {
32851
- return getMergedValue(a, b);
32852
- } else if (prop in config1) {
32853
- return getMergedValue(undefined, a);
32854
- }
32855
- }
32856
-
32857
- const mergeMap = {
32858
- url: valueFromConfig2,
32859
- method: valueFromConfig2,
32860
- data: valueFromConfig2,
32861
- baseURL: defaultToConfig2,
32862
- transformRequest: defaultToConfig2,
32863
- transformResponse: defaultToConfig2,
32864
- paramsSerializer: defaultToConfig2,
32865
- timeout: defaultToConfig2,
32866
- timeoutMessage: defaultToConfig2,
32867
- withCredentials: defaultToConfig2,
32868
- adapter: defaultToConfig2,
32869
- responseType: defaultToConfig2,
32870
- xsrfCookieName: defaultToConfig2,
32871
- xsrfHeaderName: defaultToConfig2,
32872
- onUploadProgress: defaultToConfig2,
32873
- onDownloadProgress: defaultToConfig2,
32874
- decompress: defaultToConfig2,
32875
- maxContentLength: defaultToConfig2,
32876
- maxBodyLength: defaultToConfig2,
32877
- beforeRedirect: defaultToConfig2,
32878
- transport: defaultToConfig2,
32879
- httpAgent: defaultToConfig2,
32880
- httpsAgent: defaultToConfig2,
32881
- cancelToken: defaultToConfig2,
32882
- socketPath: defaultToConfig2,
32883
- responseEncoding: defaultToConfig2,
32884
- validateStatus: mergeDirectKeys,
32885
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
32886
- };
32887
-
32888
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
32889
- const merge = mergeMap[prop] || mergeDeepProperties;
32890
- const configValue = merge(config1[prop], config2[prop], prop);
32891
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
32892
- });
32893
-
32894
- return config;
32895
- }
32896
-
32897
33369
  const validators$1 = {};
32898
33370
 
32899
33371
  // eslint-disable-next-line func-names
@@ -33007,7 +33479,34 @@ class Axios {
33007
33479
  *
33008
33480
  * @returns {Promise} The Promise to be fulfilled
33009
33481
  */
33010
- request(configOrUrl, config) {
33482
+ async request(configOrUrl, config) {
33483
+ try {
33484
+ return await this._request(configOrUrl, config);
33485
+ } catch (err) {
33486
+ if (err instanceof Error) {
33487
+ let dummy;
33488
+
33489
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
33490
+
33491
+ // slice off the Error: ... line
33492
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
33493
+ try {
33494
+ if (!err.stack) {
33495
+ err.stack = stack;
33496
+ // match without the 2 top stack lines
33497
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
33498
+ err.stack += '\n' + stack;
33499
+ }
33500
+ } catch (e) {
33501
+ // ignore the case where "stack" is an un-writable property
33502
+ }
33503
+ }
33504
+
33505
+ throw err;
33506
+ }
33507
+ }
33508
+
33509
+ _request(configOrUrl, config) {
33011
33510
  /*eslint no-param-reassign:0*/
33012
33511
  // Allow for axios('example/url'[, config]) a la fetch API
33013
33512
  if (typeof configOrUrl === 'string') {
@@ -33030,7 +33529,7 @@ class Axios {
33030
33529
  }
33031
33530
 
33032
33531
  if (paramsSerializer != null) {
33033
- if (utils.isFunction(paramsSerializer)) {
33532
+ if (utils$1.isFunction(paramsSerializer)) {
33034
33533
  config.paramsSerializer = {
33035
33534
  serialize: paramsSerializer
33036
33535
  };
@@ -33046,12 +33545,12 @@ class Axios {
33046
33545
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
33047
33546
 
33048
33547
  // Flatten headers
33049
- let contextHeaders = headers && utils.merge(
33548
+ let contextHeaders = headers && utils$1.merge(
33050
33549
  headers.common,
33051
33550
  headers[config.method]
33052
33551
  );
33053
33552
 
33054
- headers && utils.forEach(
33553
+ headers && utils$1.forEach(
33055
33554
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
33056
33555
  (method) => {
33057
33556
  delete headers[method];
@@ -33138,7 +33637,7 @@ class Axios {
33138
33637
  }
33139
33638
 
33140
33639
  // Provide aliases for supported request methods
33141
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
33640
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
33142
33641
  /*eslint func-names:0*/
33143
33642
  Axios.prototype[method] = function(url, config) {
33144
33643
  return this.request(mergeConfig(config || {}, {
@@ -33149,7 +33648,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
33149
33648
  };
33150
33649
  });
33151
33650
 
33152
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
33651
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
33153
33652
  /*eslint func-names:0*/
33154
33653
 
33155
33654
  function generateHTTPMethod(isForm) {
@@ -33325,7 +33824,7 @@ function spread(callback) {
33325
33824
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
33326
33825
  */
33327
33826
  function isAxiosError(payload) {
33328
- return utils.isObject(payload) && (payload.isAxiosError === true);
33827
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
33329
33828
  }
33330
33829
 
33331
33830
  const HttpStatusCode = {
@@ -33412,10 +33911,10 @@ function createInstance(defaultConfig) {
33412
33911
  const instance = bind(Axios$1.prototype.request, context);
33413
33912
 
33414
33913
  // Copy axios.prototype to instance
33415
- utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
33914
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
33416
33915
 
33417
33916
  // Copy context to instance
33418
- utils.extend(instance, context, null, {allOwnKeys: true});
33917
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
33419
33918
 
33420
33919
  // Factory for creating new instances
33421
33920
  instance.create = function create(instanceConfig) {
@@ -33459,7 +33958,7 @@ axios.mergeConfig = mergeConfig;
33459
33958
 
33460
33959
  axios.AxiosHeaders = AxiosHeaders$1;
33461
33960
 
33462
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
33961
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
33463
33962
 
33464
33963
  axios.getAdapter = adapters.getAdapter;
33465
33964
 
@@ -33484,38 +33983,35 @@ const updateBigbinaryPackages = async (recommendedList) => {
33484
33983
  startsWith("@bigbinary")
33485
33984
  );
33486
33985
 
33487
- if (isNotEmpty(auditPackages)) {
33488
- let retries = 0;
33986
+ if (isEmpty$1(auditPackages)) return recommendedList;
33987
+ let retries = 0;
33489
33988
 
33490
- while (retries < MAX_RETRIES) {
33491
- try {
33492
- const {
33493
- data: { nanos }
33494
- } = await axios.get(
33495
- "https://ops.neetotower.com/api/v1/public/nanos"
33496
- );
33989
+ while (retries < MAX_RETRIES) {
33990
+ try {
33991
+ const {
33992
+ data: { nanos },
33993
+ } = await axios.get("https://ops.neetotower.com/api/v1/public/nanos");
33497
33994
 
33498
- const trackedPackages = filterBy(
33499
- { name: includes(__, auditPackages) },
33500
- nanos
33501
- );
33995
+ const trackedPackages = filterBy(
33996
+ { name: includes(__, auditPackages) },
33997
+ nanos
33998
+ );
33502
33999
 
33503
- trackedPackages.forEach(({ name, current_version }) => {
33504
- recommendedList[name] = current_version;
33505
- });
34000
+ trackedPackages.forEach(({ name, current_version }) => {
34001
+ recommendedList[name] = current_version;
34002
+ });
33506
34003
 
33507
- return recommendedList;
33508
- } catch (error) {
33509
- retries++;
33510
- await new Promise((resolve) => setTimeout(resolve, REQUEST_DELAY));
33511
- if (retries === MAX_RETRIES) {
33512
- console.log(
33513
- chalk$1.yellowBright(
33514
- "\nCouldn't connect to nanos release tool. Please retry or verify the link is working correctly."
33515
- )
33516
- );
33517
- process.exitCode = 1;
33518
- }
34004
+ return recommendedList;
34005
+ } catch (error) {
34006
+ retries++;
34007
+ await new Promise((resolve) => setTimeout(resolve, REQUEST_DELAY));
34008
+ if (retries === MAX_RETRIES) {
34009
+ console.log(
34010
+ chalk$1.yellowBright(
34011
+ "\nCouldn't connect to nanos release tool. Please retry or verify the link is working correctly."
34012
+ )
34013
+ );
34014
+ process.exitCode = 1;
33519
34015
  }
33520
34016
  }
33521
34017
  }
@@ -33529,9 +34025,26 @@ const getOutdatedPackages = (recommendedVersions, packageJson) => {
33529
34025
 
33530
34026
  const dependencyTypePackages = packageJson[type] ?? {};
33531
34027
 
33532
- const packages = mapObjIndexed(
34028
+ let packages = {};
34029
+ let dependenciesToCheck = {};
34030
+
34031
+ if (type === "peerDependencies") {
34032
+ const installedDependencies = [
34033
+ ...Object.keys(packageJson.dependencies || {}),
34034
+ ...Object.keys(packageJson.devDependencies || {}),
34035
+ ];
34036
+
34037
+ dependenciesToCheck = pick$1(installedDependencies, recommendedList);
34038
+ } else {
34039
+ dependenciesToCheck = pick$1(
34040
+ Object.keys(dependencyTypePackages),
34041
+ recommendedList
34042
+ );
34043
+ }
34044
+
34045
+ packages = mapObjIndexed(
33533
34046
  (_, key) => eqProps(key, recommendedList, dependencyTypePackages),
33534
- recommendedList
34047
+ dependenciesToCheck
33535
34048
  );
33536
34049
 
33537
34050
  const outdatedPackages = pickBy(not$1, packages);
@@ -33586,17 +34099,28 @@ const recommendedPackageVersions = async (debug) => {
33586
34099
  );
33587
34100
 
33588
34101
  const fix = async (debug) => {
34102
+ const outdatedPeerDependenciesKeys = findBy(
34103
+ { type: "peerDependencies" },
34104
+ packagesToUpdate
34105
+ )?.outdatedPackages;
34106
+
34107
+ const peerDependenciesToBeUpdated = pick$1(
34108
+ outdatedPeerDependenciesKeys,
34109
+ recommendedVersions.peerDependencies
34110
+ );
34111
+
33589
34112
  let newPackageJson = mergeDeepRight(
33590
34113
  packageJson,
33591
- objOf("peerDependencies", recommendedVersions.peerDependencies)
34114
+ objOf("peerDependencies", peerDependenciesToBeUpdated)
33592
34115
  );
34116
+
33593
34117
  newPackageJson = sortByKey(newPackageJson);
33594
34118
 
33595
- isNotEmpty(recommendedVersions.peerDependencies) &&
34119
+ isNotEmpty(peerDependenciesToBeUpdated) &&
33596
34120
  (await createOrReplaceFile({
33597
34121
  relativeFilePath: PACKAGE_JSON_PATH,
33598
34122
  content: JSON.stringify(newPackageJson, null, 2),
33599
- debug
34123
+ debug,
33600
34124
  }));
33601
34125
 
33602
34126
  const commands = getInstallationCommands(
@@ -33618,7 +34142,7 @@ const recommendedPackageVersions = async (debug) => {
33618
34142
  return {
33619
34143
  error: "The dependency packages are not using the recommended versions.",
33620
34144
  status: STATUSES.FAIL,
33621
- fix
34145
+ fix,
33622
34146
  };
33623
34147
  }
33624
34148