jrs-react 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/build/index.es.js +455 -893
  2. package/build/index.js +456 -894
  3. package/package.json +2 -2
package/build/index.js CHANGED
@@ -9,12 +9,11 @@ var require$$3 = require('http');
9
9
  var require$$4 = require('https');
10
10
  var require$$0$1 = require('url');
11
11
  var require$$6 = require('fs');
12
- var crypto = require('crypto');
13
12
  var require$$4$1 = require('assert');
14
13
  var require$$1$2 = require('tty');
15
14
  var require$$0$2 = require('os');
16
15
  var zlib = require('zlib');
17
- var events = require('events');
16
+ var EventEmitter = require('events');
18
17
 
19
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
19
 
@@ -25,11 +24,11 @@ var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
25
24
  var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4);
26
25
  var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
27
26
  var require$$6__default = /*#__PURE__*/_interopDefaultLegacy(require$$6);
28
- var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
29
27
  var require$$4__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$4$1);
30
28
  var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
31
29
  var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
32
30
  var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
31
+ var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
33
32
 
34
33
  function getDefaultExportFromCjs (x) {
35
34
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -3053,8 +3052,6 @@ const isFormData = (thing) => {
3053
3052
  */
3054
3053
  const isURLSearchParams = kindOfTest('URLSearchParams');
3055
3054
 
3056
- const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
3057
-
3058
3055
  /**
3059
3056
  * Trim excess whitespace off the beginning and end of a string
3060
3057
  *
@@ -3443,7 +3440,28 @@ const toObjectSet = (arrayOrString, delimiter) => {
3443
3440
  const noop = () => {};
3444
3441
 
3445
3442
  const toFiniteNumber = (value, defaultValue) => {
3446
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
3443
+ value = +value;
3444
+ return Number.isFinite(value) ? value : defaultValue;
3445
+ };
3446
+
3447
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
3448
+
3449
+ const DIGIT = '0123456789';
3450
+
3451
+ const ALPHABET = {
3452
+ DIGIT,
3453
+ ALPHA,
3454
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
3455
+ };
3456
+
3457
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
3458
+ let str = '';
3459
+ const {length} = alphabet;
3460
+ while (size--) {
3461
+ str += alphabet[Math.random() * length|0];
3462
+ }
3463
+
3464
+ return str;
3447
3465
  };
3448
3466
 
3449
3467
  /**
@@ -3493,36 +3511,6 @@ const isAsyncFn = kindOfTest('AsyncFunction');
3493
3511
  const isThenable = (thing) =>
3494
3512
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
3495
3513
 
3496
- // original code
3497
- // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
3498
-
3499
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
3500
- if (setImmediateSupported) {
3501
- return setImmediate;
3502
- }
3503
-
3504
- return postMessageSupported ? ((token, callbacks) => {
3505
- _global.addEventListener("message", ({source, data}) => {
3506
- if (source === _global && data === token) {
3507
- callbacks.length && callbacks.shift()();
3508
- }
3509
- }, false);
3510
-
3511
- return (cb) => {
3512
- callbacks.push(cb);
3513
- _global.postMessage(token, "*");
3514
- }
3515
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
3516
- })(
3517
- typeof setImmediate === 'function',
3518
- isFunction(_global.postMessage)
3519
- );
3520
-
3521
- const asap = typeof queueMicrotask !== 'undefined' ?
3522
- queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
3523
-
3524
- // *********************
3525
-
3526
3514
  var utils$1 = {
3527
3515
  isArray,
3528
3516
  isArrayBuffer,
@@ -3534,10 +3522,6 @@ var utils$1 = {
3534
3522
  isBoolean,
3535
3523
  isObject,
3536
3524
  isPlainObject,
3537
- isReadableStream,
3538
- isRequest,
3539
- isResponse,
3540
- isHeaders,
3541
3525
  isUndefined,
3542
3526
  isDate,
3543
3527
  isFile,
@@ -3573,12 +3557,12 @@ var utils$1 = {
3573
3557
  findKey,
3574
3558
  global: _global,
3575
3559
  isContextDefined,
3560
+ ALPHABET,
3561
+ generateString,
3576
3562
  isSpecCompliantForm,
3577
3563
  toJSONObject,
3578
3564
  isAsyncFn,
3579
- isThenable,
3580
- setImmediate: _setImmediate,
3581
- asap
3565
+ isThenable
3582
3566
  };
3583
3567
 
3584
3568
  /**
@@ -3606,10 +3590,7 @@ function AxiosError(message, code, config, request, response) {
3606
3590
  code && (this.code = code);
3607
3591
  config && (this.config = config);
3608
3592
  request && (this.request = request);
3609
- if (response) {
3610
- this.response = response;
3611
- this.status = response.status ? response.status : null;
3612
- }
3593
+ response && (this.response = response);
3613
3594
  }
3614
3595
 
3615
3596
  utils$1.inherits(AxiosError, Error, {
@@ -3629,7 +3610,7 @@ utils$1.inherits(AxiosError, Error, {
3629
3610
  // Axios
3630
3611
  config: utils$1.toJSONObject(this.config),
3631
3612
  code: this.code,
3632
- status: this.status
3613
+ status: this.response && this.response.status ? this.response.status : null
3633
3614
  };
3634
3615
  }
3635
3616
  });
@@ -17293,7 +17274,7 @@ function encode(val) {
17293
17274
  *
17294
17275
  * @param {string} url The base of the url (e.g., http://www.google.com)
17295
17276
  * @param {object} [params] The params to be appended
17296
- * @param {?(object|Function)} options
17277
+ * @param {?object} options
17297
17278
  *
17298
17279
  * @returns {string} The formatted url
17299
17280
  */
@@ -17305,12 +17286,6 @@ function buildURL(url, params, options) {
17305
17286
 
17306
17287
  const _encode = options && options.encode || encode;
17307
17288
 
17308
- if (utils$1.isFunction(options)) {
17309
- options = {
17310
- serialize: options
17311
- };
17312
- }
17313
-
17314
17289
  const serializeFn = options && options.serialize;
17315
17290
 
17316
17291
  let serializedParams;
@@ -17411,29 +17386,6 @@ var transitionalDefaults = {
17411
17386
 
17412
17387
  var URLSearchParams = require$$0__default["default"].URLSearchParams;
17413
17388
 
17414
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
17415
-
17416
- const DIGIT = '0123456789';
17417
-
17418
- const ALPHABET = {
17419
- DIGIT,
17420
- ALPHA,
17421
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
17422
- };
17423
-
17424
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
17425
- let str = '';
17426
- const {length} = alphabet;
17427
- const randomValues = new Uint32Array(size);
17428
- crypto__default["default"].randomFillSync(randomValues);
17429
- for (let i = 0; i < size; i++) {
17430
- str += alphabet[randomValues[i] % length];
17431
- }
17432
-
17433
- return str;
17434
- };
17435
-
17436
-
17437
17389
  var platform$1 = {
17438
17390
  isNode: true,
17439
17391
  classes: {
@@ -17441,15 +17393,11 @@ var platform$1 = {
17441
17393
  FormData: FormData$1,
17442
17394
  Blob: typeof Blob !== 'undefined' && Blob || null
17443
17395
  },
17444
- ALPHABET,
17445
- generateString,
17446
17396
  protocols: [ 'http', 'https', 'file', 'data' ]
17447
17397
  };
17448
17398
 
17449
17399
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
17450
17400
 
17451
- const _navigator = typeof navigator === 'object' && navigator || undefined;
17452
-
17453
17401
  /**
17454
17402
  * Determine if we're running in a standard browser environment
17455
17403
  *
@@ -17467,8 +17415,10 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
17467
17415
  *
17468
17416
  * @returns {boolean}
17469
17417
  */
17470
- const hasStandardBrowserEnv = hasBrowserEnv &&
17471
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
17418
+ const hasStandardBrowserEnv = (
17419
+ (product) => {
17420
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
17421
+ })(typeof navigator !== 'undefined' && navigator.product);
17472
17422
 
17473
17423
  /**
17474
17424
  * Determine if we're running in a standard browser webWorker environment
@@ -17488,15 +17438,11 @@ const hasStandardBrowserWebWorkerEnv = (() => {
17488
17438
  );
17489
17439
  })();
17490
17440
 
17491
- const origin = hasBrowserEnv && window.location.href || 'http://localhost';
17492
-
17493
17441
  var utils = /*#__PURE__*/Object.freeze({
17494
17442
  __proto__: null,
17495
17443
  hasBrowserEnv: hasBrowserEnv,
17496
17444
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
17497
- hasStandardBrowserEnv: hasStandardBrowserEnv,
17498
- navigator: _navigator,
17499
- origin: origin
17445
+ hasStandardBrowserEnv: hasStandardBrowserEnv
17500
17446
  });
17501
17447
 
17502
17448
  var platform = {
@@ -17564,9 +17510,6 @@ function arrayToObject(arr) {
17564
17510
  function formDataToJSON(formData) {
17565
17511
  function buildPath(path, value, target, index) {
17566
17512
  let name = path[index++];
17567
-
17568
- if (name === '__proto__') return true;
17569
-
17570
17513
  const isNumericKey = Number.isFinite(+name);
17571
17514
  const isLast = index >= path.length;
17572
17515
  name = !name && utils$1.isArray(target) ? target.length : name;
@@ -17636,7 +17579,7 @@ const defaults = {
17636
17579
 
17637
17580
  transitional: transitionalDefaults,
17638
17581
 
17639
- adapter: ['xhr', 'http', 'fetch'],
17582
+ adapter: ['xhr', 'http'],
17640
17583
 
17641
17584
  transformRequest: [function transformRequest(data, headers) {
17642
17585
  const contentType = headers.getContentType() || '';
@@ -17650,6 +17593,9 @@ const defaults = {
17650
17593
  const isFormData = utils$1.isFormData(data);
17651
17594
 
17652
17595
  if (isFormData) {
17596
+ if (!hasJSONContentType) {
17597
+ return data;
17598
+ }
17653
17599
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
17654
17600
  }
17655
17601
 
@@ -17657,8 +17603,7 @@ const defaults = {
17657
17603
  utils$1.isBuffer(data) ||
17658
17604
  utils$1.isStream(data) ||
17659
17605
  utils$1.isFile(data) ||
17660
- utils$1.isBlob(data) ||
17661
- utils$1.isReadableStream(data)
17606
+ utils$1.isBlob(data)
17662
17607
  ) {
17663
17608
  return data;
17664
17609
  }
@@ -17701,10 +17646,6 @@ const defaults = {
17701
17646
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
17702
17647
  const JSONRequested = this.responseType === 'json';
17703
17648
 
17704
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
17705
- return data;
17706
- }
17707
-
17708
17649
  if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
17709
17650
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
17710
17651
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -17908,10 +17849,6 @@ class AxiosHeaders {
17908
17849
  setHeaders(header, valueOrRewrite);
17909
17850
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
17910
17851
  setHeaders(parseHeaders(header), valueOrRewrite);
17911
- } else if (utils$1.isHeaders(header)) {
17912
- for (const [key, value] of header.entries()) {
17913
- setHeader(value, key, rewrite);
17914
- }
17915
17852
  } else {
17916
17853
  header != null && setHeader(valueOrRewrite, header, rewrite);
17917
17854
  }
@@ -18203,7 +18140,7 @@ function isAbsoluteURL(url) {
18203
18140
  */
18204
18141
  function combineURLs(baseURL, relativeURL) {
18205
18142
  return relativeURL
18206
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
18143
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
18207
18144
  : baseURL;
18208
18145
  }
18209
18146
 
@@ -18217,20 +18154,19 @@ function combineURLs(baseURL, relativeURL) {
18217
18154
  *
18218
18155
  * @returns {string} The combined full path
18219
18156
  */
18220
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
18221
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
18222
- if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
18157
+ function buildFullPath(baseURL, requestedURL) {
18158
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
18223
18159
  return combineURLs(baseURL, requestedURL);
18224
18160
  }
18225
18161
  return requestedURL;
18226
18162
  }
18227
18163
 
18228
- var proxyFromEnv$1 = {};
18164
+ var proxyFromEnv = {};
18229
18165
 
18230
18166
  var hasRequiredProxyFromEnv;
18231
18167
 
18232
18168
  function requireProxyFromEnv () {
18233
- if (hasRequiredProxyFromEnv) return proxyFromEnv$1;
18169
+ if (hasRequiredProxyFromEnv) return proxyFromEnv;
18234
18170
  hasRequiredProxyFromEnv = 1;
18235
18171
 
18236
18172
  var parseUrl = require$$0__default["default"].parse;
@@ -18338,12 +18274,11 @@ function requireProxyFromEnv () {
18338
18274
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
18339
18275
  }
18340
18276
 
18341
- proxyFromEnv$1.getProxyForUrl = getProxyForUrl;
18342
- return proxyFromEnv$1;
18277
+ proxyFromEnv.getProxyForUrl = getProxyForUrl;
18278
+ return proxyFromEnv;
18343
18279
  }
18344
18280
 
18345
18281
  var proxyFromEnvExports = requireProxyFromEnv();
18346
- var proxyFromEnv = /*@__PURE__*/getDefaultExportFromCjs(proxyFromEnvExports);
18347
18282
 
18348
18283
  var followRedirects$1 = {exports: {}};
18349
18284
 
@@ -20279,7 +20214,7 @@ function requireFollowRedirects () {
20279
20214
  var followRedirectsExports = requireFollowRedirects();
20280
20215
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
20281
20216
 
20282
- const VERSION = "1.8.3";
20217
+ const VERSION = "1.6.2";
20283
20218
 
20284
20219
  function parseProtocol(url) {
20285
20220
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -20334,6 +20269,88 @@ function fromDataURI(uri, asBlob, options) {
20334
20269
  throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
20335
20270
  }
20336
20271
 
20272
+ /**
20273
+ * Throttle decorator
20274
+ * @param {Function} fn
20275
+ * @param {Number} freq
20276
+ * @return {Function}
20277
+ */
20278
+ function throttle(fn, freq) {
20279
+ let timestamp = 0;
20280
+ const threshold = 1000 / freq;
20281
+ let timer = null;
20282
+ return function throttled(force, args) {
20283
+ const now = Date.now();
20284
+ if (force || now - timestamp > threshold) {
20285
+ if (timer) {
20286
+ clearTimeout(timer);
20287
+ timer = null;
20288
+ }
20289
+ timestamp = now;
20290
+ return fn.apply(null, args);
20291
+ }
20292
+ if (!timer) {
20293
+ timer = setTimeout(() => {
20294
+ timer = null;
20295
+ timestamp = Date.now();
20296
+ return fn.apply(null, args);
20297
+ }, threshold - (now - timestamp));
20298
+ }
20299
+ };
20300
+ }
20301
+
20302
+ /**
20303
+ * Calculate data maxRate
20304
+ * @param {Number} [samplesCount= 10]
20305
+ * @param {Number} [min= 1000]
20306
+ * @returns {Function}
20307
+ */
20308
+ function speedometer(samplesCount, min) {
20309
+ samplesCount = samplesCount || 10;
20310
+ const bytes = new Array(samplesCount);
20311
+ const timestamps = new Array(samplesCount);
20312
+ let head = 0;
20313
+ let tail = 0;
20314
+ let firstSampleTS;
20315
+
20316
+ min = min !== undefined ? min : 1000;
20317
+
20318
+ return function push(chunkLength) {
20319
+ const now = Date.now();
20320
+
20321
+ const startedAt = timestamps[tail];
20322
+
20323
+ if (!firstSampleTS) {
20324
+ firstSampleTS = now;
20325
+ }
20326
+
20327
+ bytes[head] = chunkLength;
20328
+ timestamps[head] = now;
20329
+
20330
+ let i = tail;
20331
+ let bytesCount = 0;
20332
+
20333
+ while (i !== head) {
20334
+ bytesCount += bytes[i++];
20335
+ i = i % samplesCount;
20336
+ }
20337
+
20338
+ head = (head + 1) % samplesCount;
20339
+
20340
+ if (head === tail) {
20341
+ tail = (tail + 1) % samplesCount;
20342
+ }
20343
+
20344
+ if (now - firstSampleTS < min) {
20345
+ return;
20346
+ }
20347
+
20348
+ const passed = startedAt && now - startedAt;
20349
+
20350
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
20351
+ };
20352
+ }
20353
+
20337
20354
  const kInternals = Symbol('internals');
20338
20355
 
20339
20356
  class AxiosTransformStream extends stream__default["default"].Transform{
@@ -20353,8 +20370,12 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20353
20370
  readableHighWaterMark: options.chunkSize
20354
20371
  });
20355
20372
 
20373
+ const self = this;
20374
+
20356
20375
  const internals = this[kInternals] = {
20376
+ length: options.length,
20357
20377
  timeWindow: options.timeWindow,
20378
+ ticksRate: options.ticksRate,
20358
20379
  chunkSize: options.chunkSize,
20359
20380
  maxRate: options.maxRate,
20360
20381
  minChunkSize: options.minChunkSize,
@@ -20366,6 +20387,8 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20366
20387
  onReadCallback: null
20367
20388
  };
20368
20389
 
20390
+ const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
20391
+
20369
20392
  this.on('newListener', event => {
20370
20393
  if (event === 'progress') {
20371
20394
  if (!internals.isCaptured) {
@@ -20373,6 +20396,38 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20373
20396
  }
20374
20397
  }
20375
20398
  });
20399
+
20400
+ let bytesNotified = 0;
20401
+
20402
+ internals.updateProgress = throttle(function throttledHandler() {
20403
+ const totalBytes = internals.length;
20404
+ const bytesTransferred = internals.bytesSeen;
20405
+ const progressBytes = bytesTransferred - bytesNotified;
20406
+ if (!progressBytes || self.destroyed) return;
20407
+
20408
+ const rate = _speedometer(progressBytes);
20409
+
20410
+ bytesNotified = bytesTransferred;
20411
+
20412
+ process.nextTick(() => {
20413
+ self.emit('progress', {
20414
+ 'loaded': bytesTransferred,
20415
+ 'total': totalBytes,
20416
+ 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
20417
+ 'bytes': progressBytes,
20418
+ 'rate': rate ? rate : undefined,
20419
+ 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
20420
+ (totalBytes - bytesTransferred) / rate : undefined
20421
+ });
20422
+ });
20423
+ }, internals.ticksRate);
20424
+
20425
+ const onFinish = () => {
20426
+ internals.updateProgress(true);
20427
+ };
20428
+
20429
+ this.once('end', onFinish);
20430
+ this.once('error', onFinish);
20376
20431
  }
20377
20432
 
20378
20433
  _read(size) {
@@ -20386,6 +20441,7 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20386
20441
  }
20387
20442
 
20388
20443
  _transform(chunk, encoding, callback) {
20444
+ const self = this;
20389
20445
  const internals = this[kInternals];
20390
20446
  const maxRate = internals.maxRate;
20391
20447
 
@@ -20397,14 +20453,16 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20397
20453
  const bytesThreshold = (maxRate / divider);
20398
20454
  const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
20399
20455
 
20400
- const pushChunk = (_chunk, _callback) => {
20456
+ function pushChunk(_chunk, _callback) {
20401
20457
  const bytes = Buffer.byteLength(_chunk);
20402
20458
  internals.bytesSeen += bytes;
20403
20459
  internals.bytes += bytes;
20404
20460
 
20405
- internals.isCaptured && this.emit('progress', internals.bytesSeen);
20461
+ if (internals.isCaptured) {
20462
+ internals.updateProgress();
20463
+ }
20406
20464
 
20407
- if (this.push(_chunk)) {
20465
+ if (self.push(_chunk)) {
20408
20466
  process.nextTick(_callback);
20409
20467
  } else {
20410
20468
  internals.onReadCallback = () => {
@@ -20412,7 +20470,7 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20412
20470
  process.nextTick(_callback);
20413
20471
  };
20414
20472
  }
20415
- };
20473
+ }
20416
20474
 
20417
20475
  const transformChunk = (_chunk, _callback) => {
20418
20476
  const chunkSize = Buffer.byteLength(_chunk);
@@ -20469,6 +20527,11 @@ class AxiosTransformStream extends stream__default["default"].Transform{
20469
20527
  }
20470
20528
  });
20471
20529
  }
20530
+
20531
+ setLength(length) {
20532
+ this[kInternals].length = +length;
20533
+ return this;
20534
+ }
20472
20535
  }
20473
20536
 
20474
20537
  var AxiosTransformStream$1 = AxiosTransformStream;
@@ -20489,9 +20552,9 @@ const readBlob = async function* (blob) {
20489
20552
 
20490
20553
  var readBlob$1 = readBlob;
20491
20554
 
20492
- const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
20555
+ const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
20493
20556
 
20494
- const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new require$$1__default["default"].TextEncoder();
20557
+ const textEncoder = new require$$1.TextEncoder();
20495
20558
 
20496
20559
  const CRLF = '\r\n';
20497
20560
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -20549,7 +20612,7 @@ const formDataToStream = (form, headersHandler, options) => {
20549
20612
  const {
20550
20613
  tag = 'form-data-boundary',
20551
20614
  size = 25,
20552
- boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
20615
+ boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
20553
20616
  } = options || {};
20554
20617
 
20555
20618
  if(!utils$1.isFormData(form)) {
@@ -20636,142 +20699,6 @@ const callbackify = (fn, reducer) => {
20636
20699
 
20637
20700
  var callbackify$1 = callbackify;
20638
20701
 
20639
- /**
20640
- * Calculate data maxRate
20641
- * @param {Number} [samplesCount= 10]
20642
- * @param {Number} [min= 1000]
20643
- * @returns {Function}
20644
- */
20645
- function speedometer(samplesCount, min) {
20646
- samplesCount = samplesCount || 10;
20647
- const bytes = new Array(samplesCount);
20648
- const timestamps = new Array(samplesCount);
20649
- let head = 0;
20650
- let tail = 0;
20651
- let firstSampleTS;
20652
-
20653
- min = min !== undefined ? min : 1000;
20654
-
20655
- return function push(chunkLength) {
20656
- const now = Date.now();
20657
-
20658
- const startedAt = timestamps[tail];
20659
-
20660
- if (!firstSampleTS) {
20661
- firstSampleTS = now;
20662
- }
20663
-
20664
- bytes[head] = chunkLength;
20665
- timestamps[head] = now;
20666
-
20667
- let i = tail;
20668
- let bytesCount = 0;
20669
-
20670
- while (i !== head) {
20671
- bytesCount += bytes[i++];
20672
- i = i % samplesCount;
20673
- }
20674
-
20675
- head = (head + 1) % samplesCount;
20676
-
20677
- if (head === tail) {
20678
- tail = (tail + 1) % samplesCount;
20679
- }
20680
-
20681
- if (now - firstSampleTS < min) {
20682
- return;
20683
- }
20684
-
20685
- const passed = startedAt && now - startedAt;
20686
-
20687
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
20688
- };
20689
- }
20690
-
20691
- /**
20692
- * Throttle decorator
20693
- * @param {Function} fn
20694
- * @param {Number} freq
20695
- * @return {Function}
20696
- */
20697
- function throttle(fn, freq) {
20698
- let timestamp = 0;
20699
- let threshold = 1000 / freq;
20700
- let lastArgs;
20701
- let timer;
20702
-
20703
- const invoke = (args, now = Date.now()) => {
20704
- timestamp = now;
20705
- lastArgs = null;
20706
- if (timer) {
20707
- clearTimeout(timer);
20708
- timer = null;
20709
- }
20710
- fn.apply(null, args);
20711
- };
20712
-
20713
- const throttled = (...args) => {
20714
- const now = Date.now();
20715
- const passed = now - timestamp;
20716
- if ( passed >= threshold) {
20717
- invoke(args, now);
20718
- } else {
20719
- lastArgs = args;
20720
- if (!timer) {
20721
- timer = setTimeout(() => {
20722
- timer = null;
20723
- invoke(lastArgs);
20724
- }, threshold - passed);
20725
- }
20726
- }
20727
- };
20728
-
20729
- const flush = () => lastArgs && invoke(lastArgs);
20730
-
20731
- return [throttled, flush];
20732
- }
20733
-
20734
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
20735
- let bytesNotified = 0;
20736
- const _speedometer = speedometer(50, 250);
20737
-
20738
- return throttle(e => {
20739
- const loaded = e.loaded;
20740
- const total = e.lengthComputable ? e.total : undefined;
20741
- const progressBytes = loaded - bytesNotified;
20742
- const rate = _speedometer(progressBytes);
20743
- const inRange = loaded <= total;
20744
-
20745
- bytesNotified = loaded;
20746
-
20747
- const data = {
20748
- loaded,
20749
- total,
20750
- progress: total ? (loaded / total) : undefined,
20751
- bytes: progressBytes,
20752
- rate: rate ? rate : undefined,
20753
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
20754
- event: e,
20755
- lengthComputable: total != null,
20756
- [isDownloadStream ? 'download' : 'upload']: true
20757
- };
20758
-
20759
- listener(data);
20760
- }, freq);
20761
- };
20762
-
20763
- const progressEventDecorator = (total, throttled) => {
20764
- const lengthComputable = total != null;
20765
-
20766
- return [(loaded) => throttled[0]({
20767
- lengthComputable,
20768
- total,
20769
- loaded
20770
- }), throttled[1]];
20771
- };
20772
-
20773
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
20774
-
20775
20702
  const zlibOptions = {
20776
20703
  flush: zlib__default["default"].constants.Z_SYNC_FLUSH,
20777
20704
  finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH
@@ -20792,14 +20719,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
20792
20719
  return protocol + ':';
20793
20720
  });
20794
20721
 
20795
- const flushOnFinish = (stream, [throttled, flush]) => {
20796
- stream
20797
- .on('end', flush)
20798
- .on('error', flush);
20799
-
20800
- return throttled;
20801
- };
20802
-
20803
20722
  /**
20804
20723
  * If the proxy or config beforeRedirects functions are defined, call them with the options
20805
20724
  * object.
@@ -20808,12 +20727,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
20808
20727
  *
20809
20728
  * @returns {Object<string, any>}
20810
20729
  */
20811
- function dispatchBeforeRedirect(options, responseDetails) {
20730
+ function dispatchBeforeRedirect(options) {
20812
20731
  if (options.beforeRedirects.proxy) {
20813
20732
  options.beforeRedirects.proxy(options);
20814
20733
  }
20815
20734
  if (options.beforeRedirects.config) {
20816
- options.beforeRedirects.config(options, responseDetails);
20735
+ options.beforeRedirects.config(options);
20817
20736
  }
20818
20737
  }
20819
20738
 
@@ -20829,7 +20748,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
20829
20748
  function setProxy(options, configProxy, location) {
20830
20749
  let proxy = configProxy;
20831
20750
  if (!proxy && proxy !== false) {
20832
- const proxyUrl = proxyFromEnv.getProxyForUrl(location);
20751
+ const proxyUrl = proxyFromEnvExports.getProxyForUrl(location);
20833
20752
  if (proxyUrl) {
20834
20753
  proxy = new URL(proxyUrl);
20835
20754
  }
@@ -20926,10 +20845,6 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
20926
20845
  // hotfix to support opt.all option which is required for node 20.x
20927
20846
  lookup = (hostname, opt, cb) => {
20928
20847
  _lookup(hostname, opt, (err, arg0, arg1) => {
20929
- if (err) {
20930
- return cb(err);
20931
- }
20932
-
20933
20848
  const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
20934
20849
 
20935
20850
  opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
@@ -20938,7 +20853,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
20938
20853
  }
20939
20854
 
20940
20855
  // temporary internal emitter until the AxiosRequest class will be implemented
20941
- const emitter = new events.EventEmitter();
20856
+ const emitter = new EventEmitter__default["default"]();
20942
20857
 
20943
20858
  const onFinished = () => {
20944
20859
  if (config.cancelToken) {
@@ -20974,8 +20889,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
20974
20889
  }
20975
20890
 
20976
20891
  // Parse url
20977
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
20978
- const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
20892
+ const fullPath = buildFullPath(config.baseURL, config.url);
20893
+ const parsed = new URL(fullPath, 'http://localhost');
20979
20894
  const protocol = parsed.protocol || supportedProtocols[0];
20980
20895
 
20981
20896
  if (protocol === 'data:') {
@@ -21033,7 +20948,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21033
20948
  // Only set header if it hasn't been set in config
21034
20949
  headers.set('User-Agent', 'axios/' + VERSION, false);
21035
20950
 
21036
- const {onUploadProgress, onDownloadProgress} = config;
20951
+ const onDownloadProgress = config.onDownloadProgress;
20952
+ const onUploadProgress = config.onUploadProgress;
21037
20953
  const maxRate = config.maxRate;
21038
20954
  let maxUploadRate = undefined;
21039
20955
  let maxDownloadRate = undefined;
@@ -21060,7 +20976,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21060
20976
  } catch (e) {
21061
20977
  }
21062
20978
  }
21063
- } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
20979
+ } else if (utils$1.isBlob(data)) {
21064
20980
  data.size && headers.setContentType(data.type || 'application/octet-stream');
21065
20981
  headers.setContentLength(data.size || 0);
21066
20982
  data = stream__default["default"].Readable.from(readBlob$1(data));
@@ -21104,16 +21020,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21104
21020
  }
21105
21021
 
21106
21022
  data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
21023
+ length: contentLength,
21107
21024
  maxRate: utils$1.toFiniteNumber(maxUploadRate)
21108
21025
  })], utils$1.noop);
21109
21026
 
21110
- onUploadProgress && data.on('progress', flushOnFinish(
21111
- data,
21112
- progressEventDecorator(
21113
- contentLength,
21114
- progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
21115
- )
21116
- ));
21027
+ onUploadProgress && data.on('progress', progress => {
21028
+ onUploadProgress(Object.assign(progress, {
21029
+ upload: true
21030
+ }));
21031
+ });
21117
21032
  }
21118
21033
 
21119
21034
  // HTTP basic authentication
@@ -21171,7 +21086,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21171
21086
  if (config.socketPath) {
21172
21087
  options.socketPath = config.socketPath;
21173
21088
  } else {
21174
- options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
21089
+ options.hostname = parsed.hostname;
21175
21090
  options.port = parsed.port;
21176
21091
  setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
21177
21092
  }
@@ -21212,18 +21127,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21212
21127
 
21213
21128
  const responseLength = +res.headers['content-length'];
21214
21129
 
21215
- if (onDownloadProgress || maxDownloadRate) {
21130
+ if (onDownloadProgress) {
21216
21131
  const transformStream = new AxiosTransformStream$1({
21132
+ length: utils$1.toFiniteNumber(responseLength),
21217
21133
  maxRate: utils$1.toFiniteNumber(maxDownloadRate)
21218
21134
  });
21219
21135
 
21220
- onDownloadProgress && transformStream.on('progress', flushOnFinish(
21221
- transformStream,
21222
- progressEventDecorator(
21223
- responseLength,
21224
- progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
21225
- )
21226
- ));
21136
+ onDownloadProgress && transformStream.on('progress', progress => {
21137
+ onDownloadProgress(Object.assign(progress, {
21138
+ download: true
21139
+ }));
21140
+ });
21227
21141
 
21228
21142
  streams.push(transformStream);
21229
21143
  }
@@ -21313,7 +21227,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21313
21227
  }
21314
21228
 
21315
21229
  const err = new AxiosError(
21316
- 'stream has been aborted',
21230
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
21317
21231
  AxiosError.ERR_BAD_RESPONSE,
21318
21232
  config,
21319
21233
  lastRequest
@@ -21436,19 +21350,6 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
21436
21350
  });
21437
21351
  };
21438
21352
 
21439
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
21440
- url = new URL(url, platform.origin);
21441
-
21442
- return (
21443
- origin.protocol === url.protocol &&
21444
- origin.host === url.host &&
21445
- (isMSIE || origin.port === url.port)
21446
- );
21447
- })(
21448
- new URL(platform.origin),
21449
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
21450
- ) : () => true;
21451
-
21452
21353
  var cookies = platform.hasStandardBrowserEnv ?
21453
21354
 
21454
21355
  // Standard browser envs support document.cookie
@@ -21488,183 +21389,143 @@ var cookies = platform.hasStandardBrowserEnv ?
21488
21389
  remove() {}
21489
21390
  };
21490
21391
 
21491
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
21492
-
21493
- /**
21494
- * Config-specific merge-function which creates a new config-object
21495
- * by merging two configuration objects together.
21496
- *
21497
- * @param {Object} config1
21498
- * @param {Object} config2
21499
- *
21500
- * @returns {Object} New object resulting from merging config2 to config1
21501
- */
21502
- function mergeConfig(config1, config2) {
21503
- // eslint-disable-next-line no-param-reassign
21504
- config2 = config2 || {};
21505
- const config = {};
21506
-
21507
- function getMergedValue(target, source, prop, caseless) {
21508
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
21509
- return utils$1.merge.call({caseless}, target, source);
21510
- } else if (utils$1.isPlainObject(source)) {
21511
- return utils$1.merge({}, source);
21512
- } else if (utils$1.isArray(source)) {
21513
- return source.slice();
21514
- }
21515
- return source;
21516
- }
21517
-
21518
- // eslint-disable-next-line consistent-return
21519
- function mergeDeepProperties(a, b, prop , caseless) {
21520
- if (!utils$1.isUndefined(b)) {
21521
- return getMergedValue(a, b, prop , caseless);
21522
- } else if (!utils$1.isUndefined(a)) {
21523
- return getMergedValue(undefined, a, prop , caseless);
21524
- }
21525
- }
21526
-
21527
- // eslint-disable-next-line consistent-return
21528
- function valueFromConfig2(a, b) {
21529
- if (!utils$1.isUndefined(b)) {
21530
- return getMergedValue(undefined, b);
21531
- }
21532
- }
21533
-
21534
- // eslint-disable-next-line consistent-return
21535
- function defaultToConfig2(a, b) {
21536
- if (!utils$1.isUndefined(b)) {
21537
- return getMergedValue(undefined, b);
21538
- } else if (!utils$1.isUndefined(a)) {
21539
- return getMergedValue(undefined, a);
21540
- }
21541
- }
21392
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
21393
+
21394
+ // Standard browser envs have full support of the APIs needed to test
21395
+ // whether the request URL is of the same origin as current location.
21396
+ (function standardBrowserEnv() {
21397
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
21398
+ const urlParsingNode = document.createElement('a');
21399
+ let originURL;
21400
+
21401
+ /**
21402
+ * Parse a URL to discover its components
21403
+ *
21404
+ * @param {String} url The URL to be parsed
21405
+ * @returns {Object}
21406
+ */
21407
+ function resolveURL(url) {
21408
+ let href = url;
21409
+
21410
+ if (msie) {
21411
+ // IE needs attribute set twice to normalize properties
21412
+ urlParsingNode.setAttribute('href', href);
21413
+ href = urlParsingNode.href;
21414
+ }
21542
21415
 
21543
- // eslint-disable-next-line consistent-return
21544
- function mergeDirectKeys(a, b, prop) {
21545
- if (prop in config2) {
21546
- return getMergedValue(a, b);
21547
- } else if (prop in config1) {
21548
- return getMergedValue(undefined, a);
21416
+ urlParsingNode.setAttribute('href', href);
21417
+
21418
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
21419
+ return {
21420
+ href: urlParsingNode.href,
21421
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
21422
+ host: urlParsingNode.host,
21423
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
21424
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
21425
+ hostname: urlParsingNode.hostname,
21426
+ port: urlParsingNode.port,
21427
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
21428
+ urlParsingNode.pathname :
21429
+ '/' + urlParsingNode.pathname
21430
+ };
21549
21431
  }
21550
- }
21551
-
21552
- const mergeMap = {
21553
- url: valueFromConfig2,
21554
- method: valueFromConfig2,
21555
- data: valueFromConfig2,
21556
- baseURL: defaultToConfig2,
21557
- transformRequest: defaultToConfig2,
21558
- transformResponse: defaultToConfig2,
21559
- paramsSerializer: defaultToConfig2,
21560
- timeout: defaultToConfig2,
21561
- timeoutMessage: defaultToConfig2,
21562
- withCredentials: defaultToConfig2,
21563
- withXSRFToken: defaultToConfig2,
21564
- adapter: defaultToConfig2,
21565
- responseType: defaultToConfig2,
21566
- xsrfCookieName: defaultToConfig2,
21567
- xsrfHeaderName: defaultToConfig2,
21568
- onUploadProgress: defaultToConfig2,
21569
- onDownloadProgress: defaultToConfig2,
21570
- decompress: defaultToConfig2,
21571
- maxContentLength: defaultToConfig2,
21572
- maxBodyLength: defaultToConfig2,
21573
- beforeRedirect: defaultToConfig2,
21574
- transport: defaultToConfig2,
21575
- httpAgent: defaultToConfig2,
21576
- httpsAgent: defaultToConfig2,
21577
- cancelToken: defaultToConfig2,
21578
- socketPath: defaultToConfig2,
21579
- responseEncoding: defaultToConfig2,
21580
- validateStatus: mergeDirectKeys,
21581
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
21582
- };
21583
-
21584
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
21585
- const merge = mergeMap[prop] || mergeDeepProperties;
21586
- const configValue = merge(config1[prop], config2[prop], prop);
21587
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
21588
- });
21589
-
21590
- return config;
21591
- }
21592
-
21593
- var resolveConfig = (config) => {
21594
- const newConfig = mergeConfig({}, config);
21595
21432
 
21596
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
21597
-
21598
- newConfig.headers = headers = AxiosHeaders$1.from(headers);
21599
-
21600
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
21433
+ originURL = resolveURL(window.location.href);
21434
+
21435
+ /**
21436
+ * Determine if a URL shares the same origin as the current location
21437
+ *
21438
+ * @param {String} requestURL The URL to test
21439
+ * @returns {boolean} True if URL shares the same origin, otherwise false
21440
+ */
21441
+ return function isURLSameOrigin(requestURL) {
21442
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
21443
+ return (parsed.protocol === originURL.protocol &&
21444
+ parsed.host === originURL.host);
21445
+ };
21446
+ })() :
21601
21447
 
21602
- // HTTP basic authentication
21603
- if (auth) {
21604
- headers.set('Authorization', 'Basic ' +
21605
- btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
21606
- );
21607
- }
21448
+ // Non standard browser envs (web workers, react-native) lack needed support.
21449
+ (function nonStandardBrowserEnv() {
21450
+ return function isURLSameOrigin() {
21451
+ return true;
21452
+ };
21453
+ })();
21608
21454
 
21609
- let contentType;
21455
+ function progressEventReducer(listener, isDownloadStream) {
21456
+ let bytesNotified = 0;
21457
+ const _speedometer = speedometer(50, 250);
21610
21458
 
21611
- if (utils$1.isFormData(data)) {
21612
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
21613
- headers.setContentType(undefined); // Let the browser set it
21614
- } else if ((contentType = headers.getContentType()) !== false) {
21615
- // fix semicolon duplication issue for ReactNative FormData implementation
21616
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
21617
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
21618
- }
21619
- }
21459
+ return e => {
21460
+ const loaded = e.loaded;
21461
+ const total = e.lengthComputable ? e.total : undefined;
21462
+ const progressBytes = loaded - bytesNotified;
21463
+ const rate = _speedometer(progressBytes);
21464
+ const inRange = loaded <= total;
21620
21465
 
21621
- // Add xsrf header
21622
- // This is only done if running in a standard browser environment.
21623
- // Specifically not if we're in a web worker, or react-native.
21466
+ bytesNotified = loaded;
21624
21467
 
21625
- if (platform.hasStandardBrowserEnv) {
21626
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
21468
+ const data = {
21469
+ loaded,
21470
+ total,
21471
+ progress: total ? (loaded / total) : undefined,
21472
+ bytes: progressBytes,
21473
+ rate: rate ? rate : undefined,
21474
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
21475
+ event: e
21476
+ };
21627
21477
 
21628
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
21629
- // Add xsrf header
21630
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
21478
+ data[isDownloadStream ? 'download' : 'upload'] = true;
21631
21479
 
21632
- if (xsrfValue) {
21633
- headers.set(xsrfHeaderName, xsrfValue);
21634
- }
21635
- }
21636
- }
21637
-
21638
- return newConfig;
21639
- };
21480
+ listener(data);
21481
+ };
21482
+ }
21640
21483
 
21641
21484
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
21642
21485
 
21643
21486
  var xhrAdapter = isXHRAdapterSupported && function (config) {
21644
21487
  return new Promise(function dispatchXhrRequest(resolve, reject) {
21645
- const _config = resolveConfig(config);
21646
- let requestData = _config.data;
21647
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
21648
- let {responseType, onUploadProgress, onDownloadProgress} = _config;
21488
+ let requestData = config.data;
21489
+ const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
21490
+ let {responseType, withXSRFToken} = config;
21649
21491
  let onCanceled;
21650
- let uploadThrottled, downloadThrottled;
21651
- let flushUpload, flushDownload;
21652
-
21653
21492
  function done() {
21654
- flushUpload && flushUpload(); // flush events
21655
- flushDownload && flushDownload(); // flush events
21493
+ if (config.cancelToken) {
21494
+ config.cancelToken.unsubscribe(onCanceled);
21495
+ }
21496
+
21497
+ if (config.signal) {
21498
+ config.signal.removeEventListener('abort', onCanceled);
21499
+ }
21500
+ }
21656
21501
 
21657
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
21502
+ let contentType;
21658
21503
 
21659
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
21504
+ if (utils$1.isFormData(requestData)) {
21505
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
21506
+ requestHeaders.setContentType(false); // Let the browser set it
21507
+ } else if ((contentType = requestHeaders.getContentType()) !== false) {
21508
+ // fix semicolon duplication issue for ReactNative FormData implementation
21509
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
21510
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
21511
+ }
21660
21512
  }
21661
21513
 
21662
21514
  let request = new XMLHttpRequest();
21663
21515
 
21664
- request.open(_config.method.toUpperCase(), _config.url, true);
21516
+ // HTTP basic authentication
21517
+ if (config.auth) {
21518
+ const username = config.auth.username || '';
21519
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
21520
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
21521
+ }
21522
+
21523
+ const fullPath = buildFullPath(config.baseURL, config.url);
21524
+
21525
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
21665
21526
 
21666
21527
  // Set the request timeout in MS
21667
- request.timeout = _config.timeout;
21528
+ request.timeout = config.timeout;
21668
21529
 
21669
21530
  function onloadend() {
21670
21531
  if (!request) {
@@ -21744,10 +21605,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21744
21605
 
21745
21606
  // Handle timeout
21746
21607
  request.ontimeout = function handleTimeout() {
21747
- let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
21748
- const transitional = _config.transitional || transitionalDefaults;
21749
- if (_config.timeoutErrorMessage) {
21750
- timeoutErrorMessage = _config.timeoutErrorMessage;
21608
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
21609
+ const transitional = config.transitional || transitionalDefaults;
21610
+ if (config.timeoutErrorMessage) {
21611
+ timeoutErrorMessage = config.timeoutErrorMessage;
21751
21612
  }
21752
21613
  reject(new AxiosError(
21753
21614
  timeoutErrorMessage,
@@ -21759,6 +21620,22 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21759
21620
  request = null;
21760
21621
  };
21761
21622
 
21623
+ // Add xsrf header
21624
+ // This is only done if running in a standard browser environment.
21625
+ // Specifically not if we're in a web worker, or react-native.
21626
+ if(platform.hasStandardBrowserEnv) {
21627
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
21628
+
21629
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
21630
+ // Add xsrf header
21631
+ const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
21632
+
21633
+ if (xsrfValue) {
21634
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
21635
+ }
21636
+ }
21637
+ }
21638
+
21762
21639
  // Remove Content-Type if data is undefined
21763
21640
  requestData === undefined && requestHeaders.setContentType(null);
21764
21641
 
@@ -21770,31 +21647,26 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21770
21647
  }
21771
21648
 
21772
21649
  // Add withCredentials to request if needed
21773
- if (!utils$1.isUndefined(_config.withCredentials)) {
21774
- request.withCredentials = !!_config.withCredentials;
21650
+ if (!utils$1.isUndefined(config.withCredentials)) {
21651
+ request.withCredentials = !!config.withCredentials;
21775
21652
  }
21776
21653
 
21777
21654
  // Add responseType to request if needed
21778
21655
  if (responseType && responseType !== 'json') {
21779
- request.responseType = _config.responseType;
21656
+ request.responseType = config.responseType;
21780
21657
  }
21781
21658
 
21782
21659
  // Handle progress if needed
21783
- if (onDownloadProgress) {
21784
- ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
21785
- request.addEventListener('progress', downloadThrottled);
21660
+ if (typeof config.onDownloadProgress === 'function') {
21661
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
21786
21662
  }
21787
21663
 
21788
21664
  // Not all browsers support upload events
21789
- if (onUploadProgress && request.upload) {
21790
- ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
21791
-
21792
- request.upload.addEventListener('progress', uploadThrottled);
21793
-
21794
- request.upload.addEventListener('loadend', flushUpload);
21665
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
21666
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
21795
21667
  }
21796
21668
 
21797
- if (_config.cancelToken || _config.signal) {
21669
+ if (config.cancelToken || config.signal) {
21798
21670
  // Handle cancellation
21799
21671
  // eslint-disable-next-line func-names
21800
21672
  onCanceled = cancel => {
@@ -21806,13 +21678,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21806
21678
  request = null;
21807
21679
  };
21808
21680
 
21809
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
21810
- if (_config.signal) {
21811
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
21681
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
21682
+ if (config.signal) {
21683
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
21812
21684
  }
21813
21685
  }
21814
21686
 
21815
- const protocol = parseProtocol(_config.url);
21687
+ const protocol = parseProtocol(fullPath);
21816
21688
 
21817
21689
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
21818
21690
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -21825,360 +21697,9 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
21825
21697
  });
21826
21698
  };
21827
21699
 
21828
- const composeSignals = (signals, timeout) => {
21829
- const {length} = (signals = signals ? signals.filter(Boolean) : []);
21830
-
21831
- if (timeout || length) {
21832
- let controller = new AbortController();
21833
-
21834
- let aborted;
21835
-
21836
- const onabort = function (reason) {
21837
- if (!aborted) {
21838
- aborted = true;
21839
- unsubscribe();
21840
- const err = reason instanceof Error ? reason : this.reason;
21841
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
21842
- }
21843
- };
21844
-
21845
- let timer = timeout && setTimeout(() => {
21846
- timer = null;
21847
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
21848
- }, timeout);
21849
-
21850
- const unsubscribe = () => {
21851
- if (signals) {
21852
- timer && clearTimeout(timer);
21853
- timer = null;
21854
- signals.forEach(signal => {
21855
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
21856
- });
21857
- signals = null;
21858
- }
21859
- };
21860
-
21861
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
21862
-
21863
- const {signal} = controller;
21864
-
21865
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
21866
-
21867
- return signal;
21868
- }
21869
- };
21870
-
21871
- var composeSignals$1 = composeSignals;
21872
-
21873
- const streamChunk = function* (chunk, chunkSize) {
21874
- let len = chunk.byteLength;
21875
-
21876
- if (!chunkSize || len < chunkSize) {
21877
- yield chunk;
21878
- return;
21879
- }
21880
-
21881
- let pos = 0;
21882
- let end;
21883
-
21884
- while (pos < len) {
21885
- end = pos + chunkSize;
21886
- yield chunk.slice(pos, end);
21887
- pos = end;
21888
- }
21889
- };
21890
-
21891
- const readBytes = async function* (iterable, chunkSize) {
21892
- for await (const chunk of readStream(iterable)) {
21893
- yield* streamChunk(chunk, chunkSize);
21894
- }
21895
- };
21896
-
21897
- const readStream = async function* (stream) {
21898
- if (stream[Symbol.asyncIterator]) {
21899
- yield* stream;
21900
- return;
21901
- }
21902
-
21903
- const reader = stream.getReader();
21904
- try {
21905
- for (;;) {
21906
- const {done, value} = await reader.read();
21907
- if (done) {
21908
- break;
21909
- }
21910
- yield value;
21911
- }
21912
- } finally {
21913
- await reader.cancel();
21914
- }
21915
- };
21916
-
21917
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
21918
- const iterator = readBytes(stream, chunkSize);
21919
-
21920
- let bytes = 0;
21921
- let done;
21922
- let _onFinish = (e) => {
21923
- if (!done) {
21924
- done = true;
21925
- onFinish && onFinish(e);
21926
- }
21927
- };
21928
-
21929
- return new ReadableStream({
21930
- async pull(controller) {
21931
- try {
21932
- const {done, value} = await iterator.next();
21933
-
21934
- if (done) {
21935
- _onFinish();
21936
- controller.close();
21937
- return;
21938
- }
21939
-
21940
- let len = value.byteLength;
21941
- if (onProgress) {
21942
- let loadedBytes = bytes += len;
21943
- onProgress(loadedBytes);
21944
- }
21945
- controller.enqueue(new Uint8Array(value));
21946
- } catch (err) {
21947
- _onFinish(err);
21948
- throw err;
21949
- }
21950
- },
21951
- cancel(reason) {
21952
- _onFinish(reason);
21953
- return iterator.return();
21954
- }
21955
- }, {
21956
- highWaterMark: 2
21957
- })
21958
- };
21959
-
21960
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
21961
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
21962
-
21963
- // used only inside the fetch adapter
21964
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
21965
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
21966
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
21967
- );
21968
-
21969
- const test = (fn, ...args) => {
21970
- try {
21971
- return !!fn(...args);
21972
- } catch (e) {
21973
- return false
21974
- }
21975
- };
21976
-
21977
- const supportsRequestStream = isReadableStreamSupported && test(() => {
21978
- let duplexAccessed = false;
21979
-
21980
- const hasContentType = new Request(platform.origin, {
21981
- body: new ReadableStream(),
21982
- method: 'POST',
21983
- get duplex() {
21984
- duplexAccessed = true;
21985
- return 'half';
21986
- },
21987
- }).headers.has('Content-Type');
21988
-
21989
- return duplexAccessed && !hasContentType;
21990
- });
21991
-
21992
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
21993
-
21994
- const supportsResponseStream = isReadableStreamSupported &&
21995
- test(() => utils$1.isReadableStream(new Response('').body));
21996
-
21997
-
21998
- const resolvers = {
21999
- stream: supportsResponseStream && ((res) => res.body)
22000
- };
22001
-
22002
- isFetchSupported && (((res) => {
22003
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
22004
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
22005
- (_, config) => {
22006
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
22007
- });
22008
- });
22009
- })(new Response));
22010
-
22011
- const getBodyLength = async (body) => {
22012
- if (body == null) {
22013
- return 0;
22014
- }
22015
-
22016
- if(utils$1.isBlob(body)) {
22017
- return body.size;
22018
- }
22019
-
22020
- if(utils$1.isSpecCompliantForm(body)) {
22021
- const _request = new Request(platform.origin, {
22022
- method: 'POST',
22023
- body,
22024
- });
22025
- return (await _request.arrayBuffer()).byteLength;
22026
- }
22027
-
22028
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
22029
- return body.byteLength;
22030
- }
22031
-
22032
- if(utils$1.isURLSearchParams(body)) {
22033
- body = body + '';
22034
- }
22035
-
22036
- if(utils$1.isString(body)) {
22037
- return (await encodeText(body)).byteLength;
22038
- }
22039
- };
22040
-
22041
- const resolveBodyLength = async (headers, body) => {
22042
- const length = utils$1.toFiniteNumber(headers.getContentLength());
22043
-
22044
- return length == null ? getBodyLength(body) : length;
22045
- };
22046
-
22047
- var fetchAdapter = isFetchSupported && (async (config) => {
22048
- let {
22049
- url,
22050
- method,
22051
- data,
22052
- signal,
22053
- cancelToken,
22054
- timeout,
22055
- onDownloadProgress,
22056
- onUploadProgress,
22057
- responseType,
22058
- headers,
22059
- withCredentials = 'same-origin',
22060
- fetchOptions
22061
- } = resolveConfig(config);
22062
-
22063
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
22064
-
22065
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
22066
-
22067
- let request;
22068
-
22069
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
22070
- composedSignal.unsubscribe();
22071
- });
22072
-
22073
- let requestContentLength;
22074
-
22075
- try {
22076
- if (
22077
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
22078
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
22079
- ) {
22080
- let _request = new Request(url, {
22081
- method: 'POST',
22082
- body: data,
22083
- duplex: "half"
22084
- });
22085
-
22086
- let contentTypeHeader;
22087
-
22088
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
22089
- headers.setContentType(contentTypeHeader);
22090
- }
22091
-
22092
- if (_request.body) {
22093
- const [onProgress, flush] = progressEventDecorator(
22094
- requestContentLength,
22095
- progressEventReducer(asyncDecorator(onUploadProgress))
22096
- );
22097
-
22098
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
22099
- }
22100
- }
22101
-
22102
- if (!utils$1.isString(withCredentials)) {
22103
- withCredentials = withCredentials ? 'include' : 'omit';
22104
- }
22105
-
22106
- // Cloudflare Workers throws when credentials are defined
22107
- // see https://github.com/cloudflare/workerd/issues/902
22108
- const isCredentialsSupported = "credentials" in Request.prototype;
22109
- request = new Request(url, {
22110
- ...fetchOptions,
22111
- signal: composedSignal,
22112
- method: method.toUpperCase(),
22113
- headers: headers.normalize().toJSON(),
22114
- body: data,
22115
- duplex: "half",
22116
- credentials: isCredentialsSupported ? withCredentials : undefined
22117
- });
22118
-
22119
- let response = await fetch(request);
22120
-
22121
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
22122
-
22123
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
22124
- const options = {};
22125
-
22126
- ['status', 'statusText', 'headers'].forEach(prop => {
22127
- options[prop] = response[prop];
22128
- });
22129
-
22130
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
22131
-
22132
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
22133
- responseContentLength,
22134
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
22135
- ) || [];
22136
-
22137
- response = new Response(
22138
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
22139
- flush && flush();
22140
- unsubscribe && unsubscribe();
22141
- }),
22142
- options
22143
- );
22144
- }
22145
-
22146
- responseType = responseType || 'text';
22147
-
22148
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
22149
-
22150
- !isStreamResponse && unsubscribe && unsubscribe();
22151
-
22152
- return await new Promise((resolve, reject) => {
22153
- settle(resolve, reject, {
22154
- data: responseData,
22155
- headers: AxiosHeaders$1.from(response.headers),
22156
- status: response.status,
22157
- statusText: response.statusText,
22158
- config,
22159
- request
22160
- });
22161
- })
22162
- } catch (err) {
22163
- unsubscribe && unsubscribe();
22164
-
22165
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
22166
- throw Object.assign(
22167
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
22168
- {
22169
- cause: err.cause || err
22170
- }
22171
- )
22172
- }
22173
-
22174
- throw AxiosError.from(err, err && err.code, config, request);
22175
- }
22176
- });
22177
-
22178
21700
  const knownAdapters = {
22179
21701
  http: httpAdapter,
22180
- xhr: xhrAdapter,
22181
- fetch: fetchAdapter
21702
+ xhr: xhrAdapter
22182
21703
  };
22183
21704
 
22184
21705
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -22322,6 +21843,108 @@ function dispatchRequest(config) {
22322
21843
  });
22323
21844
  }
22324
21845
 
21846
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
21847
+
21848
+ /**
21849
+ * Config-specific merge-function which creates a new config-object
21850
+ * by merging two configuration objects together.
21851
+ *
21852
+ * @param {Object} config1
21853
+ * @param {Object} config2
21854
+ *
21855
+ * @returns {Object} New object resulting from merging config2 to config1
21856
+ */
21857
+ function mergeConfig(config1, config2) {
21858
+ // eslint-disable-next-line no-param-reassign
21859
+ config2 = config2 || {};
21860
+ const config = {};
21861
+
21862
+ function getMergedValue(target, source, caseless) {
21863
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
21864
+ return utils$1.merge.call({caseless}, target, source);
21865
+ } else if (utils$1.isPlainObject(source)) {
21866
+ return utils$1.merge({}, source);
21867
+ } else if (utils$1.isArray(source)) {
21868
+ return source.slice();
21869
+ }
21870
+ return source;
21871
+ }
21872
+
21873
+ // eslint-disable-next-line consistent-return
21874
+ function mergeDeepProperties(a, b, caseless) {
21875
+ if (!utils$1.isUndefined(b)) {
21876
+ return getMergedValue(a, b, caseless);
21877
+ } else if (!utils$1.isUndefined(a)) {
21878
+ return getMergedValue(undefined, a, caseless);
21879
+ }
21880
+ }
21881
+
21882
+ // eslint-disable-next-line consistent-return
21883
+ function valueFromConfig2(a, b) {
21884
+ if (!utils$1.isUndefined(b)) {
21885
+ return getMergedValue(undefined, b);
21886
+ }
21887
+ }
21888
+
21889
+ // eslint-disable-next-line consistent-return
21890
+ function defaultToConfig2(a, b) {
21891
+ if (!utils$1.isUndefined(b)) {
21892
+ return getMergedValue(undefined, b);
21893
+ } else if (!utils$1.isUndefined(a)) {
21894
+ return getMergedValue(undefined, a);
21895
+ }
21896
+ }
21897
+
21898
+ // eslint-disable-next-line consistent-return
21899
+ function mergeDirectKeys(a, b, prop) {
21900
+ if (prop in config2) {
21901
+ return getMergedValue(a, b);
21902
+ } else if (prop in config1) {
21903
+ return getMergedValue(undefined, a);
21904
+ }
21905
+ }
21906
+
21907
+ const mergeMap = {
21908
+ url: valueFromConfig2,
21909
+ method: valueFromConfig2,
21910
+ data: valueFromConfig2,
21911
+ baseURL: defaultToConfig2,
21912
+ transformRequest: defaultToConfig2,
21913
+ transformResponse: defaultToConfig2,
21914
+ paramsSerializer: defaultToConfig2,
21915
+ timeout: defaultToConfig2,
21916
+ timeoutMessage: defaultToConfig2,
21917
+ withCredentials: defaultToConfig2,
21918
+ withXSRFToken: defaultToConfig2,
21919
+ adapter: defaultToConfig2,
21920
+ responseType: defaultToConfig2,
21921
+ xsrfCookieName: defaultToConfig2,
21922
+ xsrfHeaderName: defaultToConfig2,
21923
+ onUploadProgress: defaultToConfig2,
21924
+ onDownloadProgress: defaultToConfig2,
21925
+ decompress: defaultToConfig2,
21926
+ maxContentLength: defaultToConfig2,
21927
+ maxBodyLength: defaultToConfig2,
21928
+ beforeRedirect: defaultToConfig2,
21929
+ transport: defaultToConfig2,
21930
+ httpAgent: defaultToConfig2,
21931
+ httpsAgent: defaultToConfig2,
21932
+ cancelToken: defaultToConfig2,
21933
+ socketPath: defaultToConfig2,
21934
+ responseEncoding: defaultToConfig2,
21935
+ validateStatus: mergeDirectKeys,
21936
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
21937
+ };
21938
+
21939
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
21940
+ const merge = mergeMap[prop] || mergeDeepProperties;
21941
+ const configValue = merge(config1[prop], config2[prop], prop);
21942
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
21943
+ });
21944
+
21945
+ return config;
21946
+ }
21947
+
22325
21948
  const validators$1 = {};
22326
21949
 
22327
21950
  // eslint-disable-next-line func-names
@@ -22371,14 +21994,6 @@ validators$1.transitional = function transitional(validator, version, message) {
22371
21994
  };
22372
21995
  };
22373
21996
 
22374
- validators$1.spelling = function spelling(correctSpelling) {
22375
- return (value, opt) => {
22376
- // eslint-disable-next-line no-console
22377
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
22378
- return true;
22379
- }
22380
- };
22381
-
22382
21997
  /**
22383
21998
  * Assert object's properties type
22384
21999
  *
@@ -22443,34 +22058,7 @@ class Axios {
22443
22058
  *
22444
22059
  * @returns {Promise} The Promise to be fulfilled
22445
22060
  */
22446
- async request(configOrUrl, config) {
22447
- try {
22448
- return await this._request(configOrUrl, config);
22449
- } catch (err) {
22450
- if (err instanceof Error) {
22451
- let dummy = {};
22452
-
22453
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
22454
-
22455
- // slice off the Error: ... line
22456
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
22457
- try {
22458
- if (!err.stack) {
22459
- err.stack = stack;
22460
- // match without the 2 top stack lines
22461
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
22462
- err.stack += '\n' + stack;
22463
- }
22464
- } catch (e) {
22465
- // ignore the case where "stack" is an un-writable property
22466
- }
22467
- }
22468
-
22469
- throw err;
22470
- }
22471
- }
22472
-
22473
- _request(configOrUrl, config) {
22061
+ request(configOrUrl, config) {
22474
22062
  /*eslint no-param-reassign:0*/
22475
22063
  // Allow for axios('example/url'[, config]) a la fetch API
22476
22064
  if (typeof configOrUrl === 'string') {
@@ -22505,18 +22093,6 @@ class Axios {
22505
22093
  }
22506
22094
  }
22507
22095
 
22508
- // Set config.allowAbsoluteUrls
22509
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
22510
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
22511
- } else {
22512
- config.allowAbsoluteUrls = true;
22513
- }
22514
-
22515
- validator.assertOptions(config, {
22516
- baseUrl: validators.spelling('baseURL'),
22517
- withXsrfToken: validators.spelling('withXSRFToken')
22518
- }, true);
22519
-
22520
22096
  // Set config.method
22521
22097
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
22522
22098
 
@@ -22607,7 +22183,7 @@ class Axios {
22607
22183
 
22608
22184
  getUri(config) {
22609
22185
  config = mergeConfig(this.defaults, config);
22610
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
22186
+ const fullPath = buildFullPath(config.baseURL, config.url);
22611
22187
  return buildURL(fullPath, config.params, config.paramsSerializer);
22612
22188
  }
22613
22189
  }
@@ -22747,20 +22323,6 @@ class CancelToken {
22747
22323
  }
22748
22324
  }
22749
22325
 
22750
- toAbortSignal() {
22751
- const controller = new AbortController();
22752
-
22753
- const abort = (err) => {
22754
- controller.abort(err);
22755
- };
22756
-
22757
- this.subscribe(abort);
22758
-
22759
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
22760
-
22761
- return controller.signal;
22762
- }
22763
-
22764
22326
  /**
22765
22327
  * Returns an object that contains a new `CancelToken` and a function that, when called,
22766
22328
  * cancels the `CancelToken`.