@bigbinary/neeto-audit-frontend 2.0.13 → 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';
@@ -16153,7 +16153,7 @@ const DEPENDENCIES$3 = {
16153
16153
  "@honeybadger-io/js": "6.5.3",
16154
16154
  "@honeybadger-io/react": "6.1.9",
16155
16155
  antd: "5.10.2",
16156
- axios: "1.6.0",
16156
+ axios: "1.7.4",
16157
16157
  i18next: "23.6.0",
16158
16158
  "js-logger": "1.6.1",
16159
16159
  ramda: "0.29.1",
@@ -16194,7 +16194,7 @@ const DEV_DEPENDENCIES$2 = {
16194
16194
  "@tanstack/react-query": "5.40.0",
16195
16195
  "@tanstack/react-query-devtools": "5.40.0",
16196
16196
  antd: "5.10.2",
16197
- axios: "1.6.0",
16197
+ axios: "1.7.4",
16198
16198
  classnames: "2.3.2",
16199
16199
  formik: "2.4.5",
16200
16200
  i18next: "23.6.0",
@@ -16228,7 +16228,7 @@ const PEER_DEPENDENCIES$2 = {
16228
16228
  "@honeybadger-io/react": "^6.1.9",
16229
16229
  "@tanstack/react-query": "5.40.0",
16230
16230
  "@tanstack/react-query-devtools": "5.40.0",
16231
- axios: "^1.6.0",
16231
+ axios: "1.7.4",
16232
16232
  classnames: "^2.3.2",
16233
16233
  formik: "^2.4.5",
16234
16234
  i18next: "^23.6.0",
@@ -16267,7 +16267,7 @@ const DEV_DEPENDENCIES$1 = {
16267
16267
  "@tanstack/react-query": "5.40.0",
16268
16268
  "@tanstack/react-query-devtools": "5.40.0",
16269
16269
  antd: "5.10.2",
16270
- axios: "1.6.0",
16270
+ axios: "1.7.4",
16271
16271
  classnames: "2.3.2",
16272
16272
  formik: "2.4.5",
16273
16273
  i18next: "23.6.0",
@@ -16301,7 +16301,7 @@ const PEER_DEPENDENCIES$1 = {
16301
16301
  "@honeybadger-io/react": "^6.1.9",
16302
16302
  "@tanstack/react-query": "5.40.0",
16303
16303
  "@tanstack/react-query-devtools": "5.40.0",
16304
- axios: "^1.6.0",
16304
+ axios: "1.7.4",
16305
16305
  classnames: "^2.3.2",
16306
16306
  formik: "^2.4.5",
16307
16307
  i18next: "^23.6.0",
@@ -16549,6 +16549,8 @@ const isFormData = (thing) => {
16549
16549
  */
16550
16550
  const isURLSearchParams = kindOfTest('URLSearchParams');
16551
16551
 
16552
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
16553
+
16552
16554
  /**
16553
16555
  * Trim excess whitespace off the beginning and end of a string
16554
16556
  *
@@ -16937,8 +16939,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
16937
16939
  const noop$1 = () => {};
16938
16940
 
16939
16941
  const toFiniteNumber = (value, defaultValue) => {
16940
- value = +value;
16941
- return Number.isFinite(value) ? value : defaultValue;
16942
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
16942
16943
  };
16943
16944
 
16944
16945
  const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
@@ -17008,7 +17009,37 @@ const isAsyncFn = kindOfTest('AsyncFunction');
17008
17009
  const isThenable = (thing) =>
17009
17010
  thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
17010
17011
 
17011
- 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 = {
17012
17043
  isArray,
17013
17044
  isArrayBuffer,
17014
17045
  isBuffer: isBuffer$1,
@@ -17019,6 +17050,10 @@ var utils = {
17019
17050
  isBoolean,
17020
17051
  isObject,
17021
17052
  isPlainObject,
17053
+ isReadableStream,
17054
+ isRequest,
17055
+ isResponse,
17056
+ isHeaders,
17022
17057
  isUndefined,
17023
17058
  isDate,
17024
17059
  isFile,
@@ -17059,7 +17094,9 @@ var utils = {
17059
17094
  isSpecCompliantForm,
17060
17095
  toJSONObject,
17061
17096
  isAsyncFn,
17062
- isThenable
17097
+ isThenable,
17098
+ setImmediate: _setImmediate,
17099
+ asap
17063
17100
  };
17064
17101
 
17065
17102
  /**
@@ -17090,7 +17127,7 @@ function AxiosError(message, code, config, request, response) {
17090
17127
  response && (this.response = response);
17091
17128
  }
17092
17129
 
17093
- utils.inherits(AxiosError, Error, {
17130
+ utils$1.inherits(AxiosError, Error, {
17094
17131
  toJSON: function toJSON() {
17095
17132
  return {
17096
17133
  // Standard
@@ -17105,7 +17142,7 @@ utils.inherits(AxiosError, Error, {
17105
17142
  columnNumber: this.columnNumber,
17106
17143
  stack: this.stack,
17107
17144
  // Axios
17108
- config: utils.toJSONObject(this.config),
17145
+ config: utils$1.toJSONObject(this.config),
17109
17146
  code: this.code,
17110
17147
  status: this.response && this.response.status ? this.response.status : null
17111
17148
  };
@@ -17140,7 +17177,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
17140
17177
  AxiosError.from = (error, code, config, request, response, customProps) => {
17141
17178
  const axiosError = Object.create(prototype$1);
17142
17179
 
17143
- utils.toFlatObject(error, axiosError, function filter(obj) {
17180
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
17144
17181
  return obj !== Error.prototype;
17145
17182
  }, prop => {
17146
17183
  return prop !== 'isAxiosError';
@@ -29290,7 +29327,7 @@ var FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
29290
29327
  * @returns {boolean}
29291
29328
  */
29292
29329
  function isVisitable(thing) {
29293
- return utils.isPlainObject(thing) || utils.isArray(thing);
29330
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
29294
29331
  }
29295
29332
 
29296
29333
  /**
@@ -29301,7 +29338,7 @@ function isVisitable(thing) {
29301
29338
  * @returns {string} the key without the brackets.
29302
29339
  */
29303
29340
  function removeBrackets(key) {
29304
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
29341
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
29305
29342
  }
29306
29343
 
29307
29344
  /**
@@ -29330,10 +29367,10 @@ function renderKey(path, key, dots) {
29330
29367
  * @returns {boolean}
29331
29368
  */
29332
29369
  function isFlatArray(arr) {
29333
- return utils.isArray(arr) && !arr.some(isVisitable);
29370
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
29334
29371
  }
29335
29372
 
29336
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
29373
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
29337
29374
  return /^is[A-Z]/.test(prop);
29338
29375
  });
29339
29376
 
@@ -29361,7 +29398,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
29361
29398
  * @returns
29362
29399
  */
29363
29400
  function toFormData(obj, formData, options) {
29364
- if (!utils.isObject(obj)) {
29401
+ if (!utils$1.isObject(obj)) {
29365
29402
  throw new TypeError('target must be an object');
29366
29403
  }
29367
29404
 
@@ -29369,13 +29406,13 @@ function toFormData(obj, formData, options) {
29369
29406
  formData = formData || new (FormData$2 || FormData)();
29370
29407
 
29371
29408
  // eslint-disable-next-line no-param-reassign
29372
- options = utils.toFlatObject(options, {
29409
+ options = utils$1.toFlatObject(options, {
29373
29410
  metaTokens: true,
29374
29411
  dots: false,
29375
29412
  indexes: false
29376
29413
  }, false, function defined(option, source) {
29377
29414
  // eslint-disable-next-line no-eq-null,eqeqeq
29378
- return !utils.isUndefined(source[option]);
29415
+ return !utils$1.isUndefined(source[option]);
29379
29416
  });
29380
29417
 
29381
29418
  const metaTokens = options.metaTokens;
@@ -29384,24 +29421,24 @@ function toFormData(obj, formData, options) {
29384
29421
  const dots = options.dots;
29385
29422
  const indexes = options.indexes;
29386
29423
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
29387
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
29424
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
29388
29425
 
29389
- if (!utils.isFunction(visitor)) {
29426
+ if (!utils$1.isFunction(visitor)) {
29390
29427
  throw new TypeError('visitor must be a function');
29391
29428
  }
29392
29429
 
29393
29430
  function convertValue(value) {
29394
29431
  if (value === null) return '';
29395
29432
 
29396
- if (utils.isDate(value)) {
29433
+ if (utils$1.isDate(value)) {
29397
29434
  return value.toISOString();
29398
29435
  }
29399
29436
 
29400
- if (!useBlob && utils.isBlob(value)) {
29437
+ if (!useBlob && utils$1.isBlob(value)) {
29401
29438
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
29402
29439
  }
29403
29440
 
29404
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
29441
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
29405
29442
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
29406
29443
  }
29407
29444
 
@@ -29422,20 +29459,20 @@ function toFormData(obj, formData, options) {
29422
29459
  let arr = value;
29423
29460
 
29424
29461
  if (value && !path && typeof value === 'object') {
29425
- if (utils.endsWith(key, '{}')) {
29462
+ if (utils$1.endsWith(key, '{}')) {
29426
29463
  // eslint-disable-next-line no-param-reassign
29427
29464
  key = metaTokens ? key : key.slice(0, -2);
29428
29465
  // eslint-disable-next-line no-param-reassign
29429
29466
  value = JSON.stringify(value);
29430
29467
  } else if (
29431
- (utils.isArray(value) && isFlatArray(value)) ||
29432
- ((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))
29433
29470
  )) {
29434
29471
  // eslint-disable-next-line no-param-reassign
29435
29472
  key = removeBrackets(key);
29436
29473
 
29437
29474
  arr.forEach(function each(el, index) {
29438
- !(utils.isUndefined(el) || el === null) && formData.append(
29475
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
29439
29476
  // eslint-disable-next-line no-nested-ternary
29440
29477
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
29441
29478
  convertValue(el)
@@ -29463,7 +29500,7 @@ function toFormData(obj, formData, options) {
29463
29500
  });
29464
29501
 
29465
29502
  function build(value, path) {
29466
- if (utils.isUndefined(value)) return;
29503
+ if (utils$1.isUndefined(value)) return;
29467
29504
 
29468
29505
  if (stack.indexOf(value) !== -1) {
29469
29506
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -29471,9 +29508,9 @@ function toFormData(obj, formData, options) {
29471
29508
 
29472
29509
  stack.push(value);
29473
29510
 
29474
- utils.forEach(value, function each(el, key) {
29475
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
29476
- 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
29477
29514
  );
29478
29515
 
29479
29516
  if (result === true) {
@@ -29484,7 +29521,7 @@ function toFormData(obj, formData, options) {
29484
29521
  stack.pop();
29485
29522
  }
29486
29523
 
29487
- if (!utils.isObject(obj)) {
29524
+ if (!utils$1.isObject(obj)) {
29488
29525
  throw new TypeError('data must be an object');
29489
29526
  }
29490
29527
 
@@ -29588,7 +29625,7 @@ function buildURL(url, params, options) {
29588
29625
  if (serializeFn) {
29589
29626
  serializedParams = serializeFn(params, options);
29590
29627
  } else {
29591
- serializedParams = utils.isURLSearchParams(params) ?
29628
+ serializedParams = utils$1.isURLSearchParams(params) ?
29592
29629
  params.toString() :
29593
29630
  new AxiosURLSearchParams(params, options).toString(_encode);
29594
29631
  }
@@ -29663,7 +29700,7 @@ class InterceptorManager {
29663
29700
  * @returns {void}
29664
29701
  */
29665
29702
  forEach(fn) {
29666
- utils.forEach(this.handlers, function forEachHandler(h) {
29703
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
29667
29704
  if (h !== null) {
29668
29705
  fn(h);
29669
29706
  }
@@ -29679,7 +29716,7 @@ var transitionalDefaults = {
29679
29716
 
29680
29717
  var URLSearchParams = require$$0$5.URLSearchParams;
29681
29718
 
29682
- var platform = {
29719
+ var platform$1 = {
29683
29720
  isNode: true,
29684
29721
  classes: {
29685
29722
  URLSearchParams,
@@ -29689,10 +29726,67 @@ var platform = {
29689
29726
  protocols: [ 'http', 'https', 'file', 'data' ]
29690
29727
  };
29691
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
+
29692
29786
  function toURLEncodedForm(data, options) {
29693
29787
  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
29694
29788
  visitor: function(value, key, path, helpers) {
29695
- if (utils.isBuffer(value)) {
29789
+ if (platform.isNode && utils$1.isBuffer(value)) {
29696
29790
  this.append(key, value.toString('base64'));
29697
29791
  return false;
29698
29792
  }
@@ -29714,7 +29808,7 @@ function parsePropPath(name) {
29714
29808
  // foo.x.y.z
29715
29809
  // foo-x-y-z
29716
29810
  // foo x y z
29717
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
29811
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
29718
29812
  return match[0] === '[]' ? '' : match[1] || match[0];
29719
29813
  });
29720
29814
  }
@@ -29749,12 +29843,15 @@ function arrayToObject(arr) {
29749
29843
  function formDataToJSON(formData) {
29750
29844
  function buildPath(path, value, target, index) {
29751
29845
  let name = path[index++];
29846
+
29847
+ if (name === '__proto__') return true;
29848
+
29752
29849
  const isNumericKey = Number.isFinite(+name);
29753
29850
  const isLast = index >= path.length;
29754
- name = !name && utils.isArray(target) ? target.length : name;
29851
+ name = !name && utils$1.isArray(target) ? target.length : name;
29755
29852
 
29756
29853
  if (isLast) {
29757
- if (utils.hasOwnProp(target, name)) {
29854
+ if (utils$1.hasOwnProp(target, name)) {
29758
29855
  target[name] = [target[name], value];
29759
29856
  } else {
29760
29857
  target[name] = value;
@@ -29763,23 +29860,23 @@ function formDataToJSON(formData) {
29763
29860
  return !isNumericKey;
29764
29861
  }
29765
29862
 
29766
- if (!target[name] || !utils.isObject(target[name])) {
29863
+ if (!target[name] || !utils$1.isObject(target[name])) {
29767
29864
  target[name] = [];
29768
29865
  }
29769
29866
 
29770
29867
  const result = buildPath(path, value, target[name], index);
29771
29868
 
29772
- if (result && utils.isArray(target[name])) {
29869
+ if (result && utils$1.isArray(target[name])) {
29773
29870
  target[name] = arrayToObject(target[name]);
29774
29871
  }
29775
29872
 
29776
29873
  return !isNumericKey;
29777
29874
  }
29778
29875
 
29779
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
29876
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
29780
29877
  const obj = {};
29781
29878
 
29782
- utils.forEachEntry(formData, (name, value) => {
29879
+ utils$1.forEachEntry(formData, (name, value) => {
29783
29880
  buildPath(parsePropPath(name), value, obj, 0);
29784
29881
  });
29785
29882
 
@@ -29800,10 +29897,10 @@ function formDataToJSON(formData) {
29800
29897
  * @returns {string} A stringified version of the rawValue.
29801
29898
  */
29802
29899
  function stringifySafely(rawValue, parser, encoder) {
29803
- if (utils.isString(rawValue)) {
29900
+ if (utils$1.isString(rawValue)) {
29804
29901
  try {
29805
29902
  (parser || JSON.parse)(rawValue);
29806
- return utils.trim(rawValue);
29903
+ return utils$1.trim(rawValue);
29807
29904
  } catch (e) {
29808
29905
  if (e.name !== 'SyntaxError') {
29809
29906
  throw e;
@@ -29818,38 +29915,36 @@ const defaults = {
29818
29915
 
29819
29916
  transitional: transitionalDefaults,
29820
29917
 
29821
- adapter: ['xhr', 'http'],
29918
+ adapter: ['xhr', 'http', 'fetch'],
29822
29919
 
29823
29920
  transformRequest: [function transformRequest(data, headers) {
29824
29921
  const contentType = headers.getContentType() || '';
29825
29922
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
29826
- const isObjectPayload = utils.isObject(data);
29923
+ const isObjectPayload = utils$1.isObject(data);
29827
29924
 
29828
- if (isObjectPayload && utils.isHTMLForm(data)) {
29925
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
29829
29926
  data = new FormData(data);
29830
29927
  }
29831
29928
 
29832
- const isFormData = utils.isFormData(data);
29929
+ const isFormData = utils$1.isFormData(data);
29833
29930
 
29834
29931
  if (isFormData) {
29835
- if (!hasJSONContentType) {
29836
- return data;
29837
- }
29838
29932
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
29839
29933
  }
29840
29934
 
29841
- if (utils.isArrayBuffer(data) ||
29842
- utils.isBuffer(data) ||
29843
- utils.isStream(data) ||
29844
- utils.isFile(data) ||
29845
- 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)
29846
29941
  ) {
29847
29942
  return data;
29848
29943
  }
29849
- if (utils.isArrayBufferView(data)) {
29944
+ if (utils$1.isArrayBufferView(data)) {
29850
29945
  return data.buffer;
29851
29946
  }
29852
- if (utils.isURLSearchParams(data)) {
29947
+ if (utils$1.isURLSearchParams(data)) {
29853
29948
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
29854
29949
  return data.toString();
29855
29950
  }
@@ -29861,7 +29956,7 @@ const defaults = {
29861
29956
  return toURLEncodedForm(data, this.formSerializer).toString();
29862
29957
  }
29863
29958
 
29864
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
29959
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
29865
29960
  const _FormData = this.env && this.env.FormData;
29866
29961
 
29867
29962
  return toFormData(
@@ -29885,7 +29980,11 @@ const defaults = {
29885
29980
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
29886
29981
  const JSONRequested = this.responseType === 'json';
29887
29982
 
29888
- 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)) {
29889
29988
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
29890
29989
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
29891
29990
 
@@ -29933,7 +30032,7 @@ const defaults = {
29933
30032
  }
29934
30033
  };
29935
30034
 
29936
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
30035
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
29937
30036
  defaults.headers[method] = {};
29938
30037
  });
29939
30038
 
@@ -29941,7 +30040,7 @@ var defaults$1 = defaults;
29941
30040
 
29942
30041
  // RawAxiosHeaders whose duplicates are ignored by node
29943
30042
  // c.f. https://nodejs.org/api/http.html#http_message_headers
29944
- const ignoreDuplicateOf = utils.toObjectSet([
30043
+ const ignoreDuplicateOf = utils$1.toObjectSet([
29945
30044
  'age', 'authorization', 'content-length', 'content-type', 'etag',
29946
30045
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
29947
30046
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -30002,7 +30101,7 @@ function normalizeValue(value) {
30002
30101
  return value;
30003
30102
  }
30004
30103
 
30005
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
30104
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
30006
30105
  }
30007
30106
 
30008
30107
  function parseTokens(str) {
@@ -30020,7 +30119,7 @@ function parseTokens(str) {
30020
30119
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
30021
30120
 
30022
30121
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
30023
- if (utils.isFunction(filter)) {
30122
+ if (utils$1.isFunction(filter)) {
30024
30123
  return filter.call(this, value, header);
30025
30124
  }
30026
30125
 
@@ -30028,13 +30127,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
30028
30127
  value = header;
30029
30128
  }
30030
30129
 
30031
- if (!utils.isString(value)) return;
30130
+ if (!utils$1.isString(value)) return;
30032
30131
 
30033
- if (utils.isString(filter)) {
30132
+ if (utils$1.isString(filter)) {
30034
30133
  return value.indexOf(filter) !== -1;
30035
30134
  }
30036
30135
 
30037
- if (utils.isRegExp(filter)) {
30136
+ if (utils$1.isRegExp(filter)) {
30038
30137
  return filter.test(value);
30039
30138
  }
30040
30139
  }
@@ -30047,7 +30146,7 @@ function formatHeader(header) {
30047
30146
  }
30048
30147
 
30049
30148
  function buildAccessors(obj, header) {
30050
- const accessorName = utils.toCamelCase(' ' + header);
30149
+ const accessorName = utils$1.toCamelCase(' ' + header);
30051
30150
 
30052
30151
  ['get', 'set', 'has'].forEach(methodName => {
30053
30152
  Object.defineProperty(obj, methodName + accessorName, {
@@ -30074,7 +30173,7 @@ class AxiosHeaders {
30074
30173
  throw new Error('header name must be a non-empty string');
30075
30174
  }
30076
30175
 
30077
- const key = utils.findKey(self, lHeader);
30176
+ const key = utils$1.findKey(self, lHeader);
30078
30177
 
30079
30178
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
30080
30179
  self[key || _header] = normalizeValue(_value);
@@ -30082,12 +30181,16 @@ class AxiosHeaders {
30082
30181
  }
30083
30182
 
30084
30183
  const setHeaders = (headers, _rewrite) =>
30085
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
30184
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
30086
30185
 
30087
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
30186
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
30088
30187
  setHeaders(header, valueOrRewrite);
30089
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
30188
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
30090
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
+ }
30091
30194
  } else {
30092
30195
  header != null && setHeader(valueOrRewrite, header, rewrite);
30093
30196
  }
@@ -30099,7 +30202,7 @@ class AxiosHeaders {
30099
30202
  header = normalizeHeader(header);
30100
30203
 
30101
30204
  if (header) {
30102
- const key = utils.findKey(this, header);
30205
+ const key = utils$1.findKey(this, header);
30103
30206
 
30104
30207
  if (key) {
30105
30208
  const value = this[key];
@@ -30112,11 +30215,11 @@ class AxiosHeaders {
30112
30215
  return parseTokens(value);
30113
30216
  }
30114
30217
 
30115
- if (utils.isFunction(parser)) {
30218
+ if (utils$1.isFunction(parser)) {
30116
30219
  return parser.call(this, value, key);
30117
30220
  }
30118
30221
 
30119
- if (utils.isRegExp(parser)) {
30222
+ if (utils$1.isRegExp(parser)) {
30120
30223
  return parser.exec(value);
30121
30224
  }
30122
30225
 
@@ -30129,7 +30232,7 @@ class AxiosHeaders {
30129
30232
  header = normalizeHeader(header);
30130
30233
 
30131
30234
  if (header) {
30132
- const key = utils.findKey(this, header);
30235
+ const key = utils$1.findKey(this, header);
30133
30236
 
30134
30237
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
30135
30238
  }
@@ -30145,7 +30248,7 @@ class AxiosHeaders {
30145
30248
  _header = normalizeHeader(_header);
30146
30249
 
30147
30250
  if (_header) {
30148
- const key = utils.findKey(self, _header);
30251
+ const key = utils$1.findKey(self, _header);
30149
30252
 
30150
30253
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
30151
30254
  delete self[key];
@@ -30155,7 +30258,7 @@ class AxiosHeaders {
30155
30258
  }
30156
30259
  }
30157
30260
 
30158
- if (utils.isArray(header)) {
30261
+ if (utils$1.isArray(header)) {
30159
30262
  header.forEach(deleteHeader);
30160
30263
  } else {
30161
30264
  deleteHeader(header);
@@ -30184,8 +30287,8 @@ class AxiosHeaders {
30184
30287
  const self = this;
30185
30288
  const headers = {};
30186
30289
 
30187
- utils.forEach(this, (value, header) => {
30188
- const key = utils.findKey(headers, header);
30290
+ utils$1.forEach(this, (value, header) => {
30291
+ const key = utils$1.findKey(headers, header);
30189
30292
 
30190
30293
  if (key) {
30191
30294
  self[key] = normalizeValue(value);
@@ -30214,8 +30317,8 @@ class AxiosHeaders {
30214
30317
  toJSON(asStrings) {
30215
30318
  const obj = Object.create(null);
30216
30319
 
30217
- utils.forEach(this, (value, header) => {
30218
- 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);
30219
30322
  });
30220
30323
 
30221
30324
  return obj;
@@ -30262,7 +30365,7 @@ class AxiosHeaders {
30262
30365
  }
30263
30366
  }
30264
30367
 
30265
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
30368
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
30266
30369
 
30267
30370
  return this;
30268
30371
  }
@@ -30271,7 +30374,7 @@ class AxiosHeaders {
30271
30374
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
30272
30375
 
30273
30376
  // reserved names hotfix
30274
- utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
30377
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
30275
30378
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
30276
30379
  return {
30277
30380
  get: () => value,
@@ -30281,7 +30384,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
30281
30384
  }
30282
30385
  });
30283
30386
 
30284
- utils.freezeMethods(AxiosHeaders);
30387
+ utils$1.freezeMethods(AxiosHeaders);
30285
30388
 
30286
30389
  var AxiosHeaders$1 = AxiosHeaders;
30287
30390
 
@@ -30299,7 +30402,7 @@ function transformData(fns, response) {
30299
30402
  const headers = AxiosHeaders$1.from(context.headers);
30300
30403
  let data = context.data;
30301
30404
 
30302
- utils.forEach(fns, function transform(fn) {
30405
+ utils$1.forEach(fns, function transform(fn) {
30303
30406
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
30304
30407
  });
30305
30408
 
@@ -30327,7 +30430,7 @@ function CanceledError(message, config, request) {
30327
30430
  this.name = 'CanceledError';
30328
30431
  }
30329
30432
 
30330
- utils.inherits(CanceledError, AxiosError, {
30433
+ utils$1.inherits(CanceledError, AxiosError, {
30331
30434
  __CANCEL__: true
30332
30435
  });
30333
30436
 
@@ -30379,7 +30482,7 @@ function isAbsoluteURL(url) {
30379
30482
  */
30380
30483
  function combineURLs(baseURL, relativeURL) {
30381
30484
  return relativeURL
30382
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
30485
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
30383
30486
  : baseURL;
30384
30487
  }
30385
30488
 
@@ -31201,7 +31304,7 @@ followRedirects$1.exports.wrap = wrap;
31201
31304
  var followRedirectsExports = followRedirects$1.exports;
31202
31305
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
31203
31306
 
31204
- const VERSION = "1.6.0";
31307
+ const VERSION = "1.7.4";
31205
31308
 
31206
31309
  function parseProtocol(url) {
31207
31310
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -31256,93 +31359,11 @@ function fromDataURI(uri, asBlob, options) {
31256
31359
  throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
31257
31360
  }
31258
31361
 
31259
- /**
31260
- * Throttle decorator
31261
- * @param {Function} fn
31262
- * @param {Number} freq
31263
- * @return {Function}
31264
- */
31265
- function throttle(fn, freq) {
31266
- let timestamp = 0;
31267
- const threshold = 1000 / freq;
31268
- let timer = null;
31269
- return function throttled(force, args) {
31270
- const now = Date.now();
31271
- if (force || now - timestamp > threshold) {
31272
- if (timer) {
31273
- clearTimeout(timer);
31274
- timer = null;
31275
- }
31276
- timestamp = now;
31277
- return fn.apply(null, args);
31278
- }
31279
- if (!timer) {
31280
- timer = setTimeout(() => {
31281
- timer = null;
31282
- timestamp = Date.now();
31283
- return fn.apply(null, args);
31284
- }, threshold - (now - timestamp));
31285
- }
31286
- };
31287
- }
31288
-
31289
- /**
31290
- * Calculate data maxRate
31291
- * @param {Number} [samplesCount= 10]
31292
- * @param {Number} [min= 1000]
31293
- * @returns {Function}
31294
- */
31295
- function speedometer(samplesCount, min) {
31296
- samplesCount = samplesCount || 10;
31297
- const bytes = new Array(samplesCount);
31298
- const timestamps = new Array(samplesCount);
31299
- let head = 0;
31300
- let tail = 0;
31301
- let firstSampleTS;
31302
-
31303
- min = min !== undefined ? min : 1000;
31304
-
31305
- return function push(chunkLength) {
31306
- const now = Date.now();
31307
-
31308
- const startedAt = timestamps[tail];
31309
-
31310
- if (!firstSampleTS) {
31311
- firstSampleTS = now;
31312
- }
31313
-
31314
- bytes[head] = chunkLength;
31315
- timestamps[head] = now;
31316
-
31317
- let i = tail;
31318
- let bytesCount = 0;
31319
-
31320
- while (i !== head) {
31321
- bytesCount += bytes[i++];
31322
- i = i % samplesCount;
31323
- }
31324
-
31325
- head = (head + 1) % samplesCount;
31326
-
31327
- if (head === tail) {
31328
- tail = (tail + 1) % samplesCount;
31329
- }
31330
-
31331
- if (now - firstSampleTS < min) {
31332
- return;
31333
- }
31334
-
31335
- const passed = startedAt && now - startedAt;
31336
-
31337
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
31338
- };
31339
- }
31340
-
31341
31362
  const kInternals = Symbol('internals');
31342
31363
 
31343
31364
  class AxiosTransformStream extends stream.Transform{
31344
31365
  constructor(options) {
31345
- options = utils.toFlatObject(options, {
31366
+ options = utils$1.toFlatObject(options, {
31346
31367
  maxRate: 0,
31347
31368
  chunkSize: 64 * 1024,
31348
31369
  minChunkSize: 100,
@@ -31350,19 +31371,15 @@ class AxiosTransformStream extends stream.Transform{
31350
31371
  ticksRate: 2,
31351
31372
  samplesCount: 15
31352
31373
  }, null, (prop, source) => {
31353
- return !utils.isUndefined(source[prop]);
31374
+ return !utils$1.isUndefined(source[prop]);
31354
31375
  });
31355
31376
 
31356
31377
  super({
31357
31378
  readableHighWaterMark: options.chunkSize
31358
31379
  });
31359
31380
 
31360
- const self = this;
31361
-
31362
31381
  const internals = this[kInternals] = {
31363
- length: options.length,
31364
31382
  timeWindow: options.timeWindow,
31365
- ticksRate: options.ticksRate,
31366
31383
  chunkSize: options.chunkSize,
31367
31384
  maxRate: options.maxRate,
31368
31385
  minChunkSize: options.minChunkSize,
@@ -31374,8 +31391,6 @@ class AxiosTransformStream extends stream.Transform{
31374
31391
  onReadCallback: null
31375
31392
  };
31376
31393
 
31377
- const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
31378
-
31379
31394
  this.on('newListener', event => {
31380
31395
  if (event === 'progress') {
31381
31396
  if (!internals.isCaptured) {
@@ -31383,38 +31398,6 @@ class AxiosTransformStream extends stream.Transform{
31383
31398
  }
31384
31399
  }
31385
31400
  });
31386
-
31387
- let bytesNotified = 0;
31388
-
31389
- internals.updateProgress = throttle(function throttledHandler() {
31390
- const totalBytes = internals.length;
31391
- const bytesTransferred = internals.bytesSeen;
31392
- const progressBytes = bytesTransferred - bytesNotified;
31393
- if (!progressBytes || self.destroyed) return;
31394
-
31395
- const rate = _speedometer(progressBytes);
31396
-
31397
- bytesNotified = bytesTransferred;
31398
-
31399
- process.nextTick(() => {
31400
- self.emit('progress', {
31401
- 'loaded': bytesTransferred,
31402
- 'total': totalBytes,
31403
- 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
31404
- 'bytes': progressBytes,
31405
- 'rate': rate ? rate : undefined,
31406
- 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
31407
- (totalBytes - bytesTransferred) / rate : undefined
31408
- });
31409
- });
31410
- }, internals.ticksRate);
31411
-
31412
- const onFinish = () => {
31413
- internals.updateProgress(true);
31414
- };
31415
-
31416
- this.once('end', onFinish);
31417
- this.once('error', onFinish);
31418
31401
  }
31419
31402
 
31420
31403
  _read(size) {
@@ -31428,7 +31411,6 @@ class AxiosTransformStream extends stream.Transform{
31428
31411
  }
31429
31412
 
31430
31413
  _transform(chunk, encoding, callback) {
31431
- const self = this;
31432
31414
  const internals = this[kInternals];
31433
31415
  const maxRate = internals.maxRate;
31434
31416
 
@@ -31440,16 +31422,14 @@ class AxiosTransformStream extends stream.Transform{
31440
31422
  const bytesThreshold = (maxRate / divider);
31441
31423
  const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
31442
31424
 
31443
- function pushChunk(_chunk, _callback) {
31425
+ const pushChunk = (_chunk, _callback) => {
31444
31426
  const bytes = Buffer.byteLength(_chunk);
31445
31427
  internals.bytesSeen += bytes;
31446
31428
  internals.bytes += bytes;
31447
31429
 
31448
- if (internals.isCaptured) {
31449
- internals.updateProgress();
31450
- }
31430
+ internals.isCaptured && this.emit('progress', internals.bytesSeen);
31451
31431
 
31452
- if (self.push(_chunk)) {
31432
+ if (this.push(_chunk)) {
31453
31433
  process.nextTick(_callback);
31454
31434
  } else {
31455
31435
  internals.onReadCallback = () => {
@@ -31457,7 +31437,7 @@ class AxiosTransformStream extends stream.Transform{
31457
31437
  process.nextTick(_callback);
31458
31438
  };
31459
31439
  }
31460
- }
31440
+ };
31461
31441
 
31462
31442
  const transformChunk = (_chunk, _callback) => {
31463
31443
  const chunkSize = Buffer.byteLength(_chunk);
@@ -31514,11 +31494,6 @@ class AxiosTransformStream extends stream.Transform{
31514
31494
  }
31515
31495
  });
31516
31496
  }
31517
-
31518
- setLength(length) {
31519
- this[kInternals].length = +length;
31520
- return this;
31521
- }
31522
31497
  }
31523
31498
 
31524
31499
  var AxiosTransformStream$1 = AxiosTransformStream;
@@ -31537,9 +31512,9 @@ const readBlob = async function* (blob) {
31537
31512
  }
31538
31513
  };
31539
31514
 
31540
- const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
31515
+ const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
31541
31516
 
31542
- const textEncoder = new TextEncoder();
31517
+ const textEncoder = new TextEncoder$1();
31543
31518
 
31544
31519
  const CRLF = '\r\n';
31545
31520
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -31548,7 +31523,7 @@ const CRLF_BYTES_COUNT = 2;
31548
31523
  class FormDataPart {
31549
31524
  constructor(name, value) {
31550
31525
  const {escapeName} = this.constructor;
31551
- const isStringValue = utils.isString(value);
31526
+ const isStringValue = utils$1.isString(value);
31552
31527
 
31553
31528
  let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
31554
31529
  !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
@@ -31575,7 +31550,7 @@ class FormDataPart {
31575
31550
 
31576
31551
  const {value} = this;
31577
31552
 
31578
- if(utils.isTypedArray(value)) {
31553
+ if(utils$1.isTypedArray(value)) {
31579
31554
  yield value;
31580
31555
  } else {
31581
31556
  yield* readBlob(value);
@@ -31597,10 +31572,10 @@ const formDataToStream = (form, headersHandler, options) => {
31597
31572
  const {
31598
31573
  tag = 'form-data-boundary',
31599
31574
  size = 25,
31600
- boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
31575
+ boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
31601
31576
  } = options || {};
31602
31577
 
31603
- if(!utils.isFormData(form)) {
31578
+ if(!utils$1.isFormData(form)) {
31604
31579
  throw TypeError('FormData instance required');
31605
31580
  }
31606
31581
 
@@ -31620,7 +31595,7 @@ const formDataToStream = (form, headersHandler, options) => {
31620
31595
 
31621
31596
  contentLength += boundaryBytes.byteLength * parts.length;
31622
31597
 
31623
- contentLength = utils.toFiniteNumber(contentLength);
31598
+ contentLength = utils$1.toFiniteNumber(contentLength);
31624
31599
 
31625
31600
  const computedHeaders = {
31626
31601
  'Content-Type': `multipart/form-data; boundary=${boundary}`
@@ -31666,7 +31641,7 @@ class ZlibHeaderTransformStream extends stream.Transform {
31666
31641
  }
31667
31642
 
31668
31643
  const callbackify = (fn, reducer) => {
31669
- return utils.isAsyncFn(fn) ? function (...args) {
31644
+ return utils$1.isAsyncFn(fn) ? function (...args) {
31670
31645
  const cb = args.pop();
31671
31646
  fn.apply(this, args).then((value) => {
31672
31647
  try {
@@ -31678,6 +31653,142 @@ const callbackify = (fn, reducer) => {
31678
31653
  } : fn;
31679
31654
  };
31680
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
+
31681
31792
  const zlibOptions = {
31682
31793
  flush: zlib.constants.Z_SYNC_FLUSH,
31683
31794
  finishFlush: zlib.constants.Z_SYNC_FLUSH
@@ -31688,7 +31799,7 @@ const brotliOptions = {
31688
31799
  finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
31689
31800
  };
31690
31801
 
31691
- const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
31802
+ const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
31692
31803
 
31693
31804
  const {http: httpFollow, https: httpsFollow} = followRedirects;
31694
31805
 
@@ -31698,6 +31809,14 @@ const supportedProtocols = platform.protocols.map(protocol => {
31698
31809
  return protocol + ':';
31699
31810
  });
31700
31811
 
31812
+ const flushOnFinish = (stream, [throttled, flush]) => {
31813
+ stream
31814
+ .on('end', flush)
31815
+ .on('error', flush);
31816
+
31817
+ return throttled;
31818
+ };
31819
+
31701
31820
  /**
31702
31821
  * If the proxy or config beforeRedirects functions are defined, call them with the options
31703
31822
  * object.
@@ -31706,12 +31825,12 @@ const supportedProtocols = platform.protocols.map(protocol => {
31706
31825
  *
31707
31826
  * @returns {Object<string, any>}
31708
31827
  */
31709
- function dispatchBeforeRedirect(options) {
31828
+ function dispatchBeforeRedirect(options, responseDetails) {
31710
31829
  if (options.beforeRedirects.proxy) {
31711
31830
  options.beforeRedirects.proxy(options);
31712
31831
  }
31713
31832
  if (options.beforeRedirects.config) {
31714
- options.beforeRedirects.config(options);
31833
+ options.beforeRedirects.config(options, responseDetails);
31715
31834
  }
31716
31835
  }
31717
31836
 
@@ -31768,7 +31887,7 @@ function setProxy(options, configProxy, location) {
31768
31887
  };
31769
31888
  }
31770
31889
 
31771
- const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
31890
+ const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
31772
31891
 
31773
31892
  // temporary hotfix
31774
31893
 
@@ -31798,7 +31917,7 @@ const wrapAsync = (asyncExecutor) => {
31798
31917
  };
31799
31918
 
31800
31919
  const resolveFamily = ({address, family}) => {
31801
- if (!utils.isString(address)) {
31920
+ if (!utils$1.isString(address)) {
31802
31921
  throw TypeError('address must be a string');
31803
31922
  }
31804
31923
  return ({
@@ -31807,7 +31926,7 @@ const resolveFamily = ({address, family}) => {
31807
31926
  });
31808
31927
  };
31809
31928
 
31810
- const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
31929
+ const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
31811
31930
 
31812
31931
  /*eslint consistent-return:0*/
31813
31932
  var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
@@ -31820,11 +31939,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31820
31939
  let req;
31821
31940
 
31822
31941
  if (lookup) {
31823
- const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);
31942
+ const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
31824
31943
  // hotfix to support opt.all option which is required for node 20.x
31825
31944
  lookup = (hostname, opt, cb) => {
31826
31945
  _lookup(hostname, opt, (err, arg0, arg1) => {
31827
- 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)];
31828
31951
 
31829
31952
  opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
31830
31953
  });
@@ -31832,7 +31955,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31832
31955
  }
31833
31956
 
31834
31957
  // temporary internal emitter until the AxiosRequest class will be implemented
31835
- const emitter = new require$$0$2();
31958
+ const emitter = new EventEmitter$1();
31836
31959
 
31837
31960
  const onFinished = () => {
31838
31961
  if (config.cancelToken) {
@@ -31869,7 +31992,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31869
31992
 
31870
31993
  // Parse url
31871
31994
  const fullPath = buildFullPath(config.baseURL, config.url);
31872
- const parsed = new URL(fullPath, 'http://localhost');
31995
+ const parsed = new URL(fullPath, utils$1.hasBrowserEnv ? platform.origin : undefined);
31873
31996
  const protocol = parsed.protocol || supportedProtocols[0];
31874
31997
 
31875
31998
  if (protocol === 'data:') {
@@ -31896,7 +32019,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31896
32019
  convertedData = convertedData.toString(responseEncoding);
31897
32020
 
31898
32021
  if (!responseEncoding || responseEncoding === 'utf8') {
31899
- convertedData = utils.stripBOM(convertedData);
32022
+ convertedData = utils$1.stripBOM(convertedData);
31900
32023
  }
31901
32024
  } else if (responseType === 'stream') {
31902
32025
  convertedData = stream.Readable.from(convertedData);
@@ -31927,14 +32050,13 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31927
32050
  // Only set header if it hasn't been set in config
31928
32051
  headers.set('User-Agent', 'axios/' + VERSION, false);
31929
32052
 
31930
- const onDownloadProgress = config.onDownloadProgress;
31931
- const onUploadProgress = config.onUploadProgress;
32053
+ const {onUploadProgress, onDownloadProgress} = config;
31932
32054
  const maxRate = config.maxRate;
31933
32055
  let maxUploadRate = undefined;
31934
32056
  let maxDownloadRate = undefined;
31935
32057
 
31936
32058
  // support for spec compliant FormData objects
31937
- if (utils.isSpecCompliantForm(data)) {
32059
+ if (utils$1.isSpecCompliantForm(data)) {
31938
32060
  const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
31939
32061
 
31940
32062
  data = formDataToStream(data, (formHeaders) => {
@@ -31944,7 +32066,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31944
32066
  boundary: userBoundary && userBoundary[1] || undefined
31945
32067
  });
31946
32068
  // support for https://www.npmjs.com/package/form-data api
31947
- } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
32069
+ } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
31948
32070
  headers.set(data.getHeaders());
31949
32071
 
31950
32072
  if (!headers.hasContentLength()) {
@@ -31955,14 +32077,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31955
32077
  } catch (e) {
31956
32078
  }
31957
32079
  }
31958
- } else if (utils.isBlob(data)) {
32080
+ } else if (utils$1.isBlob(data)) {
31959
32081
  data.size && headers.setContentType(data.type || 'application/octet-stream');
31960
32082
  headers.setContentLength(data.size || 0);
31961
32083
  data = stream.Readable.from(readBlob(data));
31962
- } else if (data && !utils.isStream(data)) {
31963
- 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)) {
31964
32086
  data = Buffer.from(new Uint8Array(data));
31965
- } else if (utils.isString(data)) {
32087
+ } else if (utils$1.isString(data)) {
31966
32088
  data = Buffer.from(data, 'utf-8');
31967
32089
  } else {
31968
32090
  return reject(new AxiosError(
@@ -31984,9 +32106,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31984
32106
  }
31985
32107
  }
31986
32108
 
31987
- const contentLength = utils.toFiniteNumber(headers.getContentLength());
32109
+ const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
31988
32110
 
31989
- if (utils.isArray(maxRate)) {
32111
+ if (utils$1.isArray(maxRate)) {
31990
32112
  maxUploadRate = maxRate[0];
31991
32113
  maxDownloadRate = maxRate[1];
31992
32114
  } else {
@@ -31994,20 +32116,21 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31994
32116
  }
31995
32117
 
31996
32118
  if (data && (onUploadProgress || maxUploadRate)) {
31997
- if (!utils.isStream(data)) {
32119
+ if (!utils$1.isStream(data)) {
31998
32120
  data = stream.Readable.from(data, {objectMode: false});
31999
32121
  }
32000
32122
 
32001
32123
  data = stream.pipeline([data, new AxiosTransformStream$1({
32002
- length: contentLength,
32003
- maxRate: utils.toFiniteNumber(maxUploadRate)
32004
- })], utils.noop);
32005
-
32006
- onUploadProgress && data.on('progress', progress => {
32007
- onUploadProgress(Object.assign(progress, {
32008
- upload: true
32009
- }));
32010
- });
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
+ ));
32011
32134
  }
32012
32135
 
32013
32136
  // HTTP basic authentication
@@ -32060,7 +32183,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32060
32183
  };
32061
32184
 
32062
32185
  // cacheable-lookup integration hotfix
32063
- !utils.isUndefined(lookup) && (options.lookup = lookup);
32186
+ !utils$1.isUndefined(lookup) && (options.lookup = lookup);
32064
32187
 
32065
32188
  if (config.socketPath) {
32066
32189
  options.socketPath = config.socketPath;
@@ -32106,17 +32229,18 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32106
32229
 
32107
32230
  const responseLength = +res.headers['content-length'];
32108
32231
 
32109
- if (onDownloadProgress) {
32232
+ if (onDownloadProgress || maxDownloadRate) {
32110
32233
  const transformStream = new AxiosTransformStream$1({
32111
- length: utils.toFiniteNumber(responseLength),
32112
- maxRate: utils.toFiniteNumber(maxDownloadRate)
32234
+ maxRate: utils$1.toFiniteNumber(maxDownloadRate)
32113
32235
  });
32114
32236
 
32115
- onDownloadProgress && transformStream.on('progress', progress => {
32116
- onDownloadProgress(Object.assign(progress, {
32117
- download: true
32118
- }));
32119
- });
32237
+ onDownloadProgress && transformStream.on('progress', flushOnFinish(
32238
+ transformStream,
32239
+ progressEventDecorator(
32240
+ responseLength,
32241
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
32242
+ )
32243
+ ));
32120
32244
 
32121
32245
  streams.push(transformStream);
32122
32246
  }
@@ -32164,7 +32288,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32164
32288
  }
32165
32289
  }
32166
32290
 
32167
- responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
32291
+ responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
32168
32292
 
32169
32293
  const offListeners = stream.finished(responseStream, () => {
32170
32294
  offListeners();
@@ -32226,7 +32350,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32226
32350
  if (responseType !== 'arraybuffer') {
32227
32351
  responseData = responseData.toString(responseEncoding);
32228
32352
  if (!responseEncoding || responseEncoding === 'utf8') {
32229
- responseData = utils.stripBOM(responseData);
32353
+ responseData = utils$1.stripBOM(responseData);
32230
32354
  }
32231
32355
  }
32232
32356
  response.data = responseData;
@@ -32303,7 +32427,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32303
32427
 
32304
32428
 
32305
32429
  // Send the request
32306
- if (utils.isStream(data)) {
32430
+ if (utils$1.isStream(data)) {
32307
32431
  let ended = false;
32308
32432
  let errored = false;
32309
32433
 
@@ -32329,55 +32453,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
32329
32453
  });
32330
32454
  };
32331
32455
 
32332
- var cookies = platform.isStandardBrowserEnv ?
32333
-
32334
- // Standard browser envs support document.cookie
32335
- (function standardBrowserEnv() {
32336
- return {
32337
- write: function write(name, value, expires, path, domain, secure) {
32338
- const cookie = [];
32339
- cookie.push(name + '=' + encodeURIComponent(value));
32340
-
32341
- if (utils.isNumber(expires)) {
32342
- cookie.push('expires=' + new Date(expires).toGMTString());
32343
- }
32344
-
32345
- if (utils.isString(path)) {
32346
- cookie.push('path=' + path);
32347
- }
32348
-
32349
- if (utils.isString(domain)) {
32350
- cookie.push('domain=' + domain);
32351
- }
32352
-
32353
- if (secure === true) {
32354
- cookie.push('secure');
32355
- }
32356
-
32357
- document.cookie = cookie.join('; ');
32358
- },
32359
-
32360
- read: function read(name) {
32361
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
32362
- return (match ? decodeURIComponent(match[3]) : null);
32363
- },
32364
-
32365
- remove: function remove(name) {
32366
- this.write(name, '', Date.now() - 86400000);
32367
- }
32368
- };
32369
- })() :
32370
-
32371
- // Non standard browser env (web workers, react-native) lack needed support.
32372
- (function nonStandardBrowserEnv() {
32373
- return {
32374
- write: function write() {},
32375
- read: function read() { return null; },
32376
- remove: function remove() {}
32377
- };
32378
- })();
32379
-
32380
- var isURLSameOrigin = platform.isStandardBrowserEnv ?
32456
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
32381
32457
 
32382
32458
  // Standard browser envs have full support of the APIs needed to test
32383
32459
  // whether the request URL is of the same origin as current location.
@@ -32387,7 +32463,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
32387
32463
  let originURL;
32388
32464
 
32389
32465
  /**
32390
- * Parse a URL to discover it's components
32466
+ * Parse a URL to discover its components
32391
32467
  *
32392
32468
  * @param {String} url The URL to be parsed
32393
32469
  * @returns {Object}
@@ -32427,7 +32503,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
32427
32503
  * @returns {boolean} True if URL shares the same origin, otherwise false
32428
32504
  */
32429
32505
  return function isURLSameOrigin(requestURL) {
32430
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
32506
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
32431
32507
  return (parsed.protocol === originURL.protocol &&
32432
32508
  parsed.host === originURL.host);
32433
32509
  };
@@ -32440,81 +32516,222 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
32440
32516
  };
32441
32517
  })();
32442
32518
 
32443
- function progressEventReducer(listener, isDownloadStream) {
32444
- let bytesNotified = 0;
32445
- const _speedometer = speedometer(50, 250);
32519
+ var cookies = platform.hasStandardBrowserEnv ?
32446
32520
 
32447
- return e => {
32448
- const loaded = e.loaded;
32449
- const total = e.lengthComputable ? e.total : undefined;
32450
- const progressBytes = loaded - bytesNotified;
32451
- const rate = _speedometer(progressBytes);
32452
- 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)];
32453
32525
 
32454
- bytesNotified = loaded;
32526
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
32455
32527
 
32456
- const data = {
32457
- loaded,
32458
- total,
32459
- progress: total ? (loaded / total) : undefined,
32460
- bytes: progressBytes,
32461
- rate: rate ? rate : undefined,
32462
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
32463
- event: e
32464
- };
32528
+ utils$1.isString(path) && cookie.push('path=' + path);
32465
32529
 
32466
- data[isDownloadStream ? 'download' : 'upload'] = true;
32530
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
32467
32531
 
32468
- 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)
32469
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;
32470
32658
  }
32471
32659
 
32472
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
32660
+ var resolveConfig = (config) => {
32661
+ const newConfig = mergeConfig({}, config);
32473
32662
 
32474
- var xhrAdapter = isXHRAdapterSupported && function (config) {
32475
- return new Promise(function dispatchXhrRequest(resolve, reject) {
32476
- let requestData = config.data;
32477
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
32478
- const responseType = config.responseType;
32479
- let onCanceled;
32480
- function done() {
32481
- if (config.cancelToken) {
32482
- config.cancelToken.unsubscribe(onCanceled);
32483
- }
32663
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
32484
32664
 
32485
- if (config.signal) {
32486
- config.signal.removeEventListener('abort', onCanceled);
32487
- }
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('; '));
32488
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.
32691
+
32692
+ if (platform.hasStandardBrowserEnv) {
32693
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
32489
32694
 
32490
- let contentType;
32695
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
32696
+ // Add xsrf header
32697
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
32491
32698
 
32492
- if (utils.isFormData(requestData)) {
32493
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
32494
- requestHeaders.setContentType(false); // Let the browser set it
32495
- } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
32496
- requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
32497
- } else if(utils.isString(contentType = requestHeaders.getContentType())){
32498
- // fix semicolon duplication issue for ReactNative FormData implementation
32499
- requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
32699
+ if (xsrfValue) {
32700
+ headers.set(xsrfHeaderName, xsrfValue);
32500
32701
  }
32501
32702
  }
32703
+ }
32502
32704
 
32503
- let request = new XMLHttpRequest();
32705
+ return newConfig;
32706
+ };
32504
32707
 
32505
- // HTTP basic authentication
32506
- if (config.auth) {
32507
- const username = config.auth.username || '';
32508
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
32509
- 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);
32510
32727
  }
32511
32728
 
32512
- const fullPath = buildFullPath(config.baseURL, config.url);
32729
+ let request = new XMLHttpRequest();
32513
32730
 
32514
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
32731
+ request.open(_config.method.toUpperCase(), _config.url, true);
32515
32732
 
32516
32733
  // Set the request timeout in MS
32517
- request.timeout = config.timeout;
32734
+ request.timeout = _config.timeout;
32518
32735
 
32519
32736
  function onloadend() {
32520
32737
  if (!request) {
@@ -32594,10 +32811,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32594
32811
 
32595
32812
  // Handle timeout
32596
32813
  request.ontimeout = function handleTimeout() {
32597
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
32598
- const transitional = config.transitional || transitionalDefaults;
32599
- if (config.timeoutErrorMessage) {
32600
- 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;
32601
32818
  }
32602
32819
  reject(new AxiosError(
32603
32820
  timeoutErrorMessage,
@@ -32609,50 +32826,42 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32609
32826
  request = null;
32610
32827
  };
32611
32828
 
32612
- // Add xsrf header
32613
- // This is only done if running in a standard browser environment.
32614
- // Specifically not if we're in a web worker, or react-native.
32615
- if (platform.isStandardBrowserEnv) {
32616
- // Add xsrf header
32617
- // regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
32618
- const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
32619
-
32620
- if (xsrfValue) {
32621
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
32622
- }
32623
- }
32624
-
32625
32829
  // Remove Content-Type if data is undefined
32626
32830
  requestData === undefined && requestHeaders.setContentType(null);
32627
32831
 
32628
32832
  // Add headers to the request
32629
32833
  if ('setRequestHeader' in request) {
32630
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
32834
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
32631
32835
  request.setRequestHeader(key, val);
32632
32836
  });
32633
32837
  }
32634
32838
 
32635
32839
  // Add withCredentials to request if needed
32636
- if (!utils.isUndefined(config.withCredentials)) {
32637
- request.withCredentials = !!config.withCredentials;
32840
+ if (!utils$1.isUndefined(_config.withCredentials)) {
32841
+ request.withCredentials = !!_config.withCredentials;
32638
32842
  }
32639
32843
 
32640
32844
  // Add responseType to request if needed
32641
32845
  if (responseType && responseType !== 'json') {
32642
- request.responseType = config.responseType;
32846
+ request.responseType = _config.responseType;
32643
32847
  }
32644
32848
 
32645
32849
  // Handle progress if needed
32646
- if (typeof config.onDownloadProgress === 'function') {
32647
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
32850
+ if (onDownloadProgress) {
32851
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
32852
+ request.addEventListener('progress', downloadThrottled);
32648
32853
  }
32649
32854
 
32650
32855
  // Not all browsers support upload events
32651
- if (typeof config.onUploadProgress === 'function' && request.upload) {
32652
- 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);
32653
32862
  }
32654
32863
 
32655
- if (config.cancelToken || config.signal) {
32864
+ if (_config.cancelToken || _config.signal) {
32656
32865
  // Handle cancellation
32657
32866
  // eslint-disable-next-line func-names
32658
32867
  onCanceled = cancel => {
@@ -32664,13 +32873,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32664
32873
  request = null;
32665
32874
  };
32666
32875
 
32667
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
32668
- if (config.signal) {
32669
- 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);
32670
32879
  }
32671
32880
  }
32672
32881
 
32673
- const protocol = parseProtocol(fullPath);
32882
+ const protocol = parseProtocol(_config.url);
32674
32883
 
32675
32884
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
32676
32885
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -32683,12 +32892,340 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
32683
32892
  });
32684
32893
  };
32685
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
+
32686
33222
  const knownAdapters = {
32687
33223
  http: httpAdapter,
32688
- xhr: xhrAdapter
33224
+ xhr: xhrAdapter,
33225
+ fetch: fetchAdapter
32689
33226
  };
32690
33227
 
32691
- utils.forEach(knownAdapters, (fn, value) => {
33228
+ utils$1.forEach(knownAdapters, (fn, value) => {
32692
33229
  if (fn) {
32693
33230
  try {
32694
33231
  Object.defineProperty(fn, 'name', {value});
@@ -32701,11 +33238,11 @@ utils.forEach(knownAdapters, (fn, value) => {
32701
33238
 
32702
33239
  const renderReason = (reason) => `- ${reason}`;
32703
33240
 
32704
- const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
33241
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
32705
33242
 
32706
33243
  var adapters = {
32707
33244
  getAdapter: (adapters) => {
32708
- adapters = utils.isArray(adapters) ? adapters : [adapters];
33245
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
32709
33246
 
32710
33247
  const {length} = adapters;
32711
33248
  let nameOrAdapter;
@@ -32829,107 +33366,6 @@ function dispatchRequest(config) {
32829
33366
  });
32830
33367
  }
32831
33368
 
32832
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
32833
-
32834
- /**
32835
- * Config-specific merge-function which creates a new config-object
32836
- * by merging two configuration objects together.
32837
- *
32838
- * @param {Object} config1
32839
- * @param {Object} config2
32840
- *
32841
- * @returns {Object} New object resulting from merging config2 to config1
32842
- */
32843
- function mergeConfig(config1, config2) {
32844
- // eslint-disable-next-line no-param-reassign
32845
- config2 = config2 || {};
32846
- const config = {};
32847
-
32848
- function getMergedValue(target, source, caseless) {
32849
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
32850
- return utils.merge.call({caseless}, target, source);
32851
- } else if (utils.isPlainObject(source)) {
32852
- return utils.merge({}, source);
32853
- } else if (utils.isArray(source)) {
32854
- return source.slice();
32855
- }
32856
- return source;
32857
- }
32858
-
32859
- // eslint-disable-next-line consistent-return
32860
- function mergeDeepProperties(a, b, caseless) {
32861
- if (!utils.isUndefined(b)) {
32862
- return getMergedValue(a, b, caseless);
32863
- } else if (!utils.isUndefined(a)) {
32864
- return getMergedValue(undefined, a, caseless);
32865
- }
32866
- }
32867
-
32868
- // eslint-disable-next-line consistent-return
32869
- function valueFromConfig2(a, b) {
32870
- if (!utils.isUndefined(b)) {
32871
- return getMergedValue(undefined, b);
32872
- }
32873
- }
32874
-
32875
- // eslint-disable-next-line consistent-return
32876
- function defaultToConfig2(a, b) {
32877
- if (!utils.isUndefined(b)) {
32878
- return getMergedValue(undefined, b);
32879
- } else if (!utils.isUndefined(a)) {
32880
- return getMergedValue(undefined, a);
32881
- }
32882
- }
32883
-
32884
- // eslint-disable-next-line consistent-return
32885
- function mergeDirectKeys(a, b, prop) {
32886
- if (prop in config2) {
32887
- return getMergedValue(a, b);
32888
- } else if (prop in config1) {
32889
- return getMergedValue(undefined, a);
32890
- }
32891
- }
32892
-
32893
- const mergeMap = {
32894
- url: valueFromConfig2,
32895
- method: valueFromConfig2,
32896
- data: valueFromConfig2,
32897
- baseURL: defaultToConfig2,
32898
- transformRequest: defaultToConfig2,
32899
- transformResponse: defaultToConfig2,
32900
- paramsSerializer: defaultToConfig2,
32901
- timeout: defaultToConfig2,
32902
- timeoutMessage: defaultToConfig2,
32903
- withCredentials: defaultToConfig2,
32904
- adapter: defaultToConfig2,
32905
- responseType: defaultToConfig2,
32906
- xsrfCookieName: defaultToConfig2,
32907
- xsrfHeaderName: defaultToConfig2,
32908
- onUploadProgress: defaultToConfig2,
32909
- onDownloadProgress: defaultToConfig2,
32910
- decompress: defaultToConfig2,
32911
- maxContentLength: defaultToConfig2,
32912
- maxBodyLength: defaultToConfig2,
32913
- beforeRedirect: defaultToConfig2,
32914
- transport: defaultToConfig2,
32915
- httpAgent: defaultToConfig2,
32916
- httpsAgent: defaultToConfig2,
32917
- cancelToken: defaultToConfig2,
32918
- socketPath: defaultToConfig2,
32919
- responseEncoding: defaultToConfig2,
32920
- validateStatus: mergeDirectKeys,
32921
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
32922
- };
32923
-
32924
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
32925
- const merge = mergeMap[prop] || mergeDeepProperties;
32926
- const configValue = merge(config1[prop], config2[prop], prop);
32927
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
32928
- });
32929
-
32930
- return config;
32931
- }
32932
-
32933
33369
  const validators$1 = {};
32934
33370
 
32935
33371
  // eslint-disable-next-line func-names
@@ -33043,7 +33479,34 @@ class Axios {
33043
33479
  *
33044
33480
  * @returns {Promise} The Promise to be fulfilled
33045
33481
  */
33046
- 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) {
33047
33510
  /*eslint no-param-reassign:0*/
33048
33511
  // Allow for axios('example/url'[, config]) a la fetch API
33049
33512
  if (typeof configOrUrl === 'string') {
@@ -33066,7 +33529,7 @@ class Axios {
33066
33529
  }
33067
33530
 
33068
33531
  if (paramsSerializer != null) {
33069
- if (utils.isFunction(paramsSerializer)) {
33532
+ if (utils$1.isFunction(paramsSerializer)) {
33070
33533
  config.paramsSerializer = {
33071
33534
  serialize: paramsSerializer
33072
33535
  };
@@ -33082,12 +33545,12 @@ class Axios {
33082
33545
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
33083
33546
 
33084
33547
  // Flatten headers
33085
- let contextHeaders = headers && utils.merge(
33548
+ let contextHeaders = headers && utils$1.merge(
33086
33549
  headers.common,
33087
33550
  headers[config.method]
33088
33551
  );
33089
33552
 
33090
- headers && utils.forEach(
33553
+ headers && utils$1.forEach(
33091
33554
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
33092
33555
  (method) => {
33093
33556
  delete headers[method];
@@ -33174,7 +33637,7 @@ class Axios {
33174
33637
  }
33175
33638
 
33176
33639
  // Provide aliases for supported request methods
33177
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
33640
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
33178
33641
  /*eslint func-names:0*/
33179
33642
  Axios.prototype[method] = function(url, config) {
33180
33643
  return this.request(mergeConfig(config || {}, {
@@ -33185,7 +33648,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
33185
33648
  };
33186
33649
  });
33187
33650
 
33188
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
33651
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
33189
33652
  /*eslint func-names:0*/
33190
33653
 
33191
33654
  function generateHTTPMethod(isForm) {
@@ -33361,7 +33824,7 @@ function spread(callback) {
33361
33824
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
33362
33825
  */
33363
33826
  function isAxiosError(payload) {
33364
- return utils.isObject(payload) && (payload.isAxiosError === true);
33827
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
33365
33828
  }
33366
33829
 
33367
33830
  const HttpStatusCode = {
@@ -33448,10 +33911,10 @@ function createInstance(defaultConfig) {
33448
33911
  const instance = bind(Axios$1.prototype.request, context);
33449
33912
 
33450
33913
  // Copy axios.prototype to instance
33451
- utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
33914
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
33452
33915
 
33453
33916
  // Copy context to instance
33454
- utils.extend(instance, context, null, {allOwnKeys: true});
33917
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
33455
33918
 
33456
33919
  // Factory for creating new instances
33457
33920
  instance.create = function create(instanceConfig) {
@@ -33495,7 +33958,7 @@ axios.mergeConfig = mergeConfig;
33495
33958
 
33496
33959
  axios.AxiosHeaders = AxiosHeaders$1;
33497
33960
 
33498
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
33961
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
33499
33962
 
33500
33963
  axios.getAdapter = adapters.getAdapter;
33501
33964