tp-react-elements-dev 1.6.7 → 1.6.8

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
@@ -13,7 +13,7 @@ var require$$4$2 = require('assert');
13
13
  var require$$0$4 = require('tty');
14
14
  var require$$0$3 = require('os');
15
15
  var zlib = require('zlib');
16
- var events$1 = require('events');
16
+ var EventEmitter = require('events');
17
17
 
18
18
  function _interopNamespaceDefault(e) {
19
19
  var n = Object.create(null);
@@ -25735,7 +25735,7 @@ const unstable_ClassNameGenerator = {
25735
25735
  }
25736
25736
  };
25737
25737
 
25738
- var utils$2 = /*#__PURE__*/Object.freeze({
25738
+ var utils$1 = /*#__PURE__*/Object.freeze({
25739
25739
  __proto__: null,
25740
25740
  capitalize: capitalize$1,
25741
25741
  createChainedFunction: createChainedFunction,
@@ -43084,7 +43084,7 @@ var ArrowDropDownSharp = {};
43084
43084
 
43085
43085
  var createSvgIcon = {};
43086
43086
 
43087
- var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(utils$2);
43087
+ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(utils$1);
43088
43088
 
43089
43089
  var hasRequiredCreateSvgIcon;
43090
43090
 
@@ -53025,8 +53025,6 @@ const isFormData = (thing) => {
53025
53025
  */
53026
53026
  const isURLSearchParams = kindOfTest('URLSearchParams');
53027
53027
 
53028
- const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
53029
-
53030
53028
  /**
53031
53029
  * Trim excess whitespace off the beginning and end of a string
53032
53030
  *
@@ -53415,7 +53413,8 @@ const toObjectSet = (arrayOrString, delimiter) => {
53415
53413
  const noop$1 = () => {};
53416
53414
 
53417
53415
  const toFiniteNumber = (value, defaultValue) => {
53418
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
53416
+ value = +value;
53417
+ return Number.isFinite(value) ? value : defaultValue;
53419
53418
  };
53420
53419
 
53421
53420
  const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
@@ -53485,37 +53484,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
53485
53484
  const isThenable = (thing) =>
53486
53485
  thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
53487
53486
 
53488
- // original code
53489
- // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
53490
-
53491
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
53492
- if (setImmediateSupported) {
53493
- return setImmediate;
53494
- }
53495
-
53496
- return postMessageSupported ? ((token, callbacks) => {
53497
- _global.addEventListener("message", ({source, data}) => {
53498
- if (source === _global && data === token) {
53499
- callbacks.length && callbacks.shift()();
53500
- }
53501
- }, false);
53502
-
53503
- return (cb) => {
53504
- callbacks.push(cb);
53505
- _global.postMessage(token, "*");
53506
- }
53507
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
53508
- })(
53509
- typeof setImmediate === 'function',
53510
- isFunction$1(_global.postMessage)
53511
- );
53512
-
53513
- const asap = typeof queueMicrotask !== 'undefined' ?
53514
- queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
53515
-
53516
- // *********************
53517
-
53518
- var utils$1 = {
53487
+ var utils = {
53519
53488
  isArray,
53520
53489
  isArrayBuffer,
53521
53490
  isBuffer: isBuffer$1,
@@ -53526,10 +53495,6 @@ var utils$1 = {
53526
53495
  isBoolean,
53527
53496
  isObject: isObject$1,
53528
53497
  isPlainObject,
53529
- isReadableStream,
53530
- isRequest,
53531
- isResponse,
53532
- isHeaders,
53533
53498
  isUndefined,
53534
53499
  isDate: isDate$1,
53535
53500
  isFile,
@@ -53570,9 +53535,7 @@ var utils$1 = {
53570
53535
  isSpecCompliantForm,
53571
53536
  toJSONObject,
53572
53537
  isAsyncFn,
53573
- isThenable,
53574
- setImmediate: _setImmediate,
53575
- asap
53538
+ isThenable
53576
53539
  };
53577
53540
 
53578
53541
  /**
@@ -53600,13 +53563,10 @@ function AxiosError(message, code, config, request, response) {
53600
53563
  code && (this.code = code);
53601
53564
  config && (this.config = config);
53602
53565
  request && (this.request = request);
53603
- if (response) {
53604
- this.response = response;
53605
- this.status = response.status ? response.status : null;
53606
- }
53566
+ response && (this.response = response);
53607
53567
  }
53608
53568
 
53609
- utils$1.inherits(AxiosError, Error, {
53569
+ utils.inherits(AxiosError, Error, {
53610
53570
  toJSON: function toJSON() {
53611
53571
  return {
53612
53572
  // Standard
@@ -53621,9 +53581,9 @@ utils$1.inherits(AxiosError, Error, {
53621
53581
  columnNumber: this.columnNumber,
53622
53582
  stack: this.stack,
53623
53583
  // Axios
53624
- config: utils$1.toJSONObject(this.config),
53584
+ config: utils.toJSONObject(this.config),
53625
53585
  code: this.code,
53626
- status: this.status
53586
+ status: this.response && this.response.status ? this.response.status : null
53627
53587
  };
53628
53588
  }
53629
53589
  });
@@ -53656,7 +53616,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
53656
53616
  AxiosError.from = (error, code, config, request, response, customProps) => {
53657
53617
  const axiosError = Object.create(prototype$1);
53658
53618
 
53659
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
53619
+ utils.toFlatObject(error, axiosError, function filter(obj) {
53660
53620
  return obj !== Error.prototype;
53661
53621
  }, prop => {
53662
53622
  return prop !== 'isAxiosError';
@@ -65806,7 +65766,7 @@ var FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
65806
65766
  * @returns {boolean}
65807
65767
  */
65808
65768
  function isVisitable(thing) {
65809
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
65769
+ return utils.isPlainObject(thing) || utils.isArray(thing);
65810
65770
  }
65811
65771
 
65812
65772
  /**
@@ -65817,7 +65777,7 @@ function isVisitable(thing) {
65817
65777
  * @returns {string} the key without the brackets.
65818
65778
  */
65819
65779
  function removeBrackets(key) {
65820
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
65780
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
65821
65781
  }
65822
65782
 
65823
65783
  /**
@@ -65846,10 +65806,10 @@ function renderKey(path, key, dots) {
65846
65806
  * @returns {boolean}
65847
65807
  */
65848
65808
  function isFlatArray(arr) {
65849
- return utils$1.isArray(arr) && !arr.some(isVisitable);
65809
+ return utils.isArray(arr) && !arr.some(isVisitable);
65850
65810
  }
65851
65811
 
65852
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
65812
+ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
65853
65813
  return /^is[A-Z]/.test(prop);
65854
65814
  });
65855
65815
 
@@ -65877,7 +65837,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
65877
65837
  * @returns
65878
65838
  */
65879
65839
  function toFormData(obj, formData, options) {
65880
- if (!utils$1.isObject(obj)) {
65840
+ if (!utils.isObject(obj)) {
65881
65841
  throw new TypeError('target must be an object');
65882
65842
  }
65883
65843
 
@@ -65885,13 +65845,13 @@ function toFormData(obj, formData, options) {
65885
65845
  formData = formData || new (FormData$2 || FormData)();
65886
65846
 
65887
65847
  // eslint-disable-next-line no-param-reassign
65888
- options = utils$1.toFlatObject(options, {
65848
+ options = utils.toFlatObject(options, {
65889
65849
  metaTokens: true,
65890
65850
  dots: false,
65891
65851
  indexes: false
65892
65852
  }, false, function defined(option, source) {
65893
65853
  // eslint-disable-next-line no-eq-null,eqeqeq
65894
- return !utils$1.isUndefined(source[option]);
65854
+ return !utils.isUndefined(source[option]);
65895
65855
  });
65896
65856
 
65897
65857
  const metaTokens = options.metaTokens;
@@ -65900,24 +65860,24 @@ function toFormData(obj, formData, options) {
65900
65860
  const dots = options.dots;
65901
65861
  const indexes = options.indexes;
65902
65862
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
65903
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
65863
+ const useBlob = _Blob && utils.isSpecCompliantForm(formData);
65904
65864
 
65905
- if (!utils$1.isFunction(visitor)) {
65865
+ if (!utils.isFunction(visitor)) {
65906
65866
  throw new TypeError('visitor must be a function');
65907
65867
  }
65908
65868
 
65909
65869
  function convertValue(value) {
65910
65870
  if (value === null) return '';
65911
65871
 
65912
- if (utils$1.isDate(value)) {
65872
+ if (utils.isDate(value)) {
65913
65873
  return value.toISOString();
65914
65874
  }
65915
65875
 
65916
- if (!useBlob && utils$1.isBlob(value)) {
65876
+ if (!useBlob && utils.isBlob(value)) {
65917
65877
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
65918
65878
  }
65919
65879
 
65920
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
65880
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
65921
65881
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
65922
65882
  }
65923
65883
 
@@ -65938,20 +65898,20 @@ function toFormData(obj, formData, options) {
65938
65898
  let arr = value;
65939
65899
 
65940
65900
  if (value && !path && typeof value === 'object') {
65941
- if (utils$1.endsWith(key, '{}')) {
65901
+ if (utils.endsWith(key, '{}')) {
65942
65902
  // eslint-disable-next-line no-param-reassign
65943
65903
  key = metaTokens ? key : key.slice(0, -2);
65944
65904
  // eslint-disable-next-line no-param-reassign
65945
65905
  value = JSON.stringify(value);
65946
65906
  } else if (
65947
- (utils$1.isArray(value) && isFlatArray(value)) ||
65948
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
65907
+ (utils.isArray(value) && isFlatArray(value)) ||
65908
+ ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
65949
65909
  )) {
65950
65910
  // eslint-disable-next-line no-param-reassign
65951
65911
  key = removeBrackets(key);
65952
65912
 
65953
65913
  arr.forEach(function each(el, index) {
65954
- !(utils$1.isUndefined(el) || el === null) && formData.append(
65914
+ !(utils.isUndefined(el) || el === null) && formData.append(
65955
65915
  // eslint-disable-next-line no-nested-ternary
65956
65916
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
65957
65917
  convertValue(el)
@@ -65979,7 +65939,7 @@ function toFormData(obj, formData, options) {
65979
65939
  });
65980
65940
 
65981
65941
  function build(value, path) {
65982
- if (utils$1.isUndefined(value)) return;
65942
+ if (utils.isUndefined(value)) return;
65983
65943
 
65984
65944
  if (stack.indexOf(value) !== -1) {
65985
65945
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -65987,9 +65947,9 @@ function toFormData(obj, formData, options) {
65987
65947
 
65988
65948
  stack.push(value);
65989
65949
 
65990
- utils$1.forEach(value, function each(el, key) {
65991
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
65992
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
65950
+ utils.forEach(value, function each(el, key) {
65951
+ const result = !(utils.isUndefined(el) || el === null) && visitor.call(
65952
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
65993
65953
  );
65994
65954
 
65995
65955
  if (result === true) {
@@ -66000,7 +65960,7 @@ function toFormData(obj, formData, options) {
66000
65960
  stack.pop();
66001
65961
  }
66002
65962
 
66003
- if (!utils$1.isObject(obj)) {
65963
+ if (!utils.isObject(obj)) {
66004
65964
  throw new TypeError('data must be an object');
66005
65965
  }
66006
65966
 
@@ -66104,7 +66064,7 @@ function buildURL(url, params, options) {
66104
66064
  if (serializeFn) {
66105
66065
  serializedParams = serializeFn(params, options);
66106
66066
  } else {
66107
- serializedParams = utils$1.isURLSearchParams(params) ?
66067
+ serializedParams = utils.isURLSearchParams(params) ?
66108
66068
  params.toString() :
66109
66069
  new AxiosURLSearchParams(params, options).toString(_encode);
66110
66070
  }
@@ -66179,7 +66139,7 @@ class InterceptorManager {
66179
66139
  * @returns {void}
66180
66140
  */
66181
66141
  forEach(fn) {
66182
- utils$1.forEach(this.handlers, function forEachHandler(h) {
66142
+ utils.forEach(this.handlers, function forEachHandler(h) {
66183
66143
  if (h !== null) {
66184
66144
  fn(h);
66185
66145
  }
@@ -66195,7 +66155,7 @@ var transitionalDefaults = {
66195
66155
 
66196
66156
  var URLSearchParams = require$$0$2.URLSearchParams;
66197
66157
 
66198
- var platform$1 = {
66158
+ var platform = {
66199
66159
  isNode: true,
66200
66160
  classes: {
66201
66161
  URLSearchParams,
@@ -66205,68 +66165,10 @@ var platform$1 = {
66205
66165
  protocols: [ 'http', 'https', 'file', 'data' ]
66206
66166
  };
66207
66167
 
66208
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
66209
-
66210
- const _navigator = typeof navigator === 'object' && navigator || undefined;
66211
-
66212
- /**
66213
- * Determine if we're running in a standard browser environment
66214
- *
66215
- * This allows axios to run in a web worker, and react-native.
66216
- * Both environments support XMLHttpRequest, but not fully standard globals.
66217
- *
66218
- * web workers:
66219
- * typeof window -> undefined
66220
- * typeof document -> undefined
66221
- *
66222
- * react-native:
66223
- * navigator.product -> 'ReactNative'
66224
- * nativescript
66225
- * navigator.product -> 'NativeScript' or 'NS'
66226
- *
66227
- * @returns {boolean}
66228
- */
66229
- const hasStandardBrowserEnv = hasBrowserEnv &&
66230
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
66231
-
66232
- /**
66233
- * Determine if we're running in a standard browser webWorker environment
66234
- *
66235
- * Although the `isStandardBrowserEnv` method indicates that
66236
- * `allows axios to run in a web worker`, the WebWorker will still be
66237
- * filtered out due to its judgment standard
66238
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
66239
- * This leads to a problem when axios post `FormData` in webWorker
66240
- */
66241
- const hasStandardBrowserWebWorkerEnv = (() => {
66242
- return (
66243
- typeof WorkerGlobalScope !== 'undefined' &&
66244
- // eslint-disable-next-line no-undef
66245
- self instanceof WorkerGlobalScope &&
66246
- typeof self.importScripts === 'function'
66247
- );
66248
- })();
66249
-
66250
- const origin = hasBrowserEnv && window.location.href || 'http://localhost';
66251
-
66252
- var utils = /*#__PURE__*/Object.freeze({
66253
- __proto__: null,
66254
- hasBrowserEnv: hasBrowserEnv,
66255
- hasStandardBrowserEnv: hasStandardBrowserEnv,
66256
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
66257
- navigator: _navigator,
66258
- origin: origin
66259
- });
66260
-
66261
- var platform = {
66262
- ...utils,
66263
- ...platform$1
66264
- };
66265
-
66266
66168
  function toURLEncodedForm(data, options) {
66267
66169
  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
66268
66170
  visitor: function(value, key, path, helpers) {
66269
- if (platform.isNode && utils$1.isBuffer(value)) {
66171
+ if (utils.isBuffer(value)) {
66270
66172
  this.append(key, value.toString('base64'));
66271
66173
  return false;
66272
66174
  }
@@ -66288,7 +66190,7 @@ function parsePropPath(name) {
66288
66190
  // foo.x.y.z
66289
66191
  // foo-x-y-z
66290
66192
  // foo x y z
66291
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
66193
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
66292
66194
  return match[0] === '[]' ? '' : match[1] || match[0];
66293
66195
  });
66294
66196
  }
@@ -66323,15 +66225,12 @@ function arrayToObject(arr) {
66323
66225
  function formDataToJSON(formData) {
66324
66226
  function buildPath(path, value, target, index) {
66325
66227
  let name = path[index++];
66326
-
66327
- if (name === '__proto__') return true;
66328
-
66329
66228
  const isNumericKey = Number.isFinite(+name);
66330
66229
  const isLast = index >= path.length;
66331
- name = !name && utils$1.isArray(target) ? target.length : name;
66230
+ name = !name && utils.isArray(target) ? target.length : name;
66332
66231
 
66333
66232
  if (isLast) {
66334
- if (utils$1.hasOwnProp(target, name)) {
66233
+ if (utils.hasOwnProp(target, name)) {
66335
66234
  target[name] = [target[name], value];
66336
66235
  } else {
66337
66236
  target[name] = value;
@@ -66340,23 +66239,23 @@ function formDataToJSON(formData) {
66340
66239
  return !isNumericKey;
66341
66240
  }
66342
66241
 
66343
- if (!target[name] || !utils$1.isObject(target[name])) {
66242
+ if (!target[name] || !utils.isObject(target[name])) {
66344
66243
  target[name] = [];
66345
66244
  }
66346
66245
 
66347
66246
  const result = buildPath(path, value, target[name], index);
66348
66247
 
66349
- if (result && utils$1.isArray(target[name])) {
66248
+ if (result && utils.isArray(target[name])) {
66350
66249
  target[name] = arrayToObject(target[name]);
66351
66250
  }
66352
66251
 
66353
66252
  return !isNumericKey;
66354
66253
  }
66355
66254
 
66356
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
66255
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
66357
66256
  const obj = {};
66358
66257
 
66359
- utils$1.forEachEntry(formData, (name, value) => {
66258
+ utils.forEachEntry(formData, (name, value) => {
66360
66259
  buildPath(parsePropPath(name), value, obj, 0);
66361
66260
  });
66362
66261
 
@@ -66377,10 +66276,10 @@ function formDataToJSON(formData) {
66377
66276
  * @returns {string} A stringified version of the rawValue.
66378
66277
  */
66379
66278
  function stringifySafely(rawValue, parser, encoder) {
66380
- if (utils$1.isString(rawValue)) {
66279
+ if (utils.isString(rawValue)) {
66381
66280
  try {
66382
66281
  (parser || JSON.parse)(rawValue);
66383
- return utils$1.trim(rawValue);
66282
+ return utils.trim(rawValue);
66384
66283
  } catch (e) {
66385
66284
  if (e.name !== 'SyntaxError') {
66386
66285
  throw e;
@@ -66395,36 +66294,38 @@ const defaults = {
66395
66294
 
66396
66295
  transitional: transitionalDefaults,
66397
66296
 
66398
- adapter: ['xhr', 'http', 'fetch'],
66297
+ adapter: ['xhr', 'http'],
66399
66298
 
66400
66299
  transformRequest: [function transformRequest(data, headers) {
66401
66300
  const contentType = headers.getContentType() || '';
66402
66301
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
66403
- const isObjectPayload = utils$1.isObject(data);
66302
+ const isObjectPayload = utils.isObject(data);
66404
66303
 
66405
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
66304
+ if (isObjectPayload && utils.isHTMLForm(data)) {
66406
66305
  data = new FormData(data);
66407
66306
  }
66408
66307
 
66409
- const isFormData = utils$1.isFormData(data);
66308
+ const isFormData = utils.isFormData(data);
66410
66309
 
66411
66310
  if (isFormData) {
66311
+ if (!hasJSONContentType) {
66312
+ return data;
66313
+ }
66412
66314
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
66413
66315
  }
66414
66316
 
66415
- if (utils$1.isArrayBuffer(data) ||
66416
- utils$1.isBuffer(data) ||
66417
- utils$1.isStream(data) ||
66418
- utils$1.isFile(data) ||
66419
- utils$1.isBlob(data) ||
66420
- utils$1.isReadableStream(data)
66317
+ if (utils.isArrayBuffer(data) ||
66318
+ utils.isBuffer(data) ||
66319
+ utils.isStream(data) ||
66320
+ utils.isFile(data) ||
66321
+ utils.isBlob(data)
66421
66322
  ) {
66422
66323
  return data;
66423
66324
  }
66424
- if (utils$1.isArrayBufferView(data)) {
66325
+ if (utils.isArrayBufferView(data)) {
66425
66326
  return data.buffer;
66426
66327
  }
66427
- if (utils$1.isURLSearchParams(data)) {
66328
+ if (utils.isURLSearchParams(data)) {
66428
66329
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
66429
66330
  return data.toString();
66430
66331
  }
@@ -66436,7 +66337,7 @@ const defaults = {
66436
66337
  return toURLEncodedForm(data, this.formSerializer).toString();
66437
66338
  }
66438
66339
 
66439
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
66340
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
66440
66341
  const _FormData = this.env && this.env.FormData;
66441
66342
 
66442
66343
  return toFormData(
@@ -66460,11 +66361,7 @@ const defaults = {
66460
66361
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
66461
66362
  const JSONRequested = this.responseType === 'json';
66462
66363
 
66463
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
66464
- return data;
66465
- }
66466
-
66467
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
66364
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
66468
66365
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
66469
66366
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
66470
66367
 
@@ -66512,13 +66409,13 @@ const defaults = {
66512
66409
  }
66513
66410
  };
66514
66411
 
66515
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
66412
+ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
66516
66413
  defaults.headers[method] = {};
66517
66414
  });
66518
66415
 
66519
66416
  // RawAxiosHeaders whose duplicates are ignored by node
66520
66417
  // c.f. https://nodejs.org/api/http.html#http_message_headers
66521
- const ignoreDuplicateOf = utils$1.toObjectSet([
66418
+ const ignoreDuplicateOf = utils.toObjectSet([
66522
66419
  'age', 'authorization', 'content-length', 'content-type', 'etag',
66523
66420
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
66524
66421
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -66579,7 +66476,7 @@ function normalizeValue(value) {
66579
66476
  return value;
66580
66477
  }
66581
66478
 
66582
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
66479
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
66583
66480
  }
66584
66481
 
66585
66482
  function parseTokens(str) {
@@ -66597,7 +66494,7 @@ function parseTokens(str) {
66597
66494
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
66598
66495
 
66599
66496
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
66600
- if (utils$1.isFunction(filter)) {
66497
+ if (utils.isFunction(filter)) {
66601
66498
  return filter.call(this, value, header);
66602
66499
  }
66603
66500
 
@@ -66605,13 +66502,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
66605
66502
  value = header;
66606
66503
  }
66607
66504
 
66608
- if (!utils$1.isString(value)) return;
66505
+ if (!utils.isString(value)) return;
66609
66506
 
66610
- if (utils$1.isString(filter)) {
66507
+ if (utils.isString(filter)) {
66611
66508
  return value.indexOf(filter) !== -1;
66612
66509
  }
66613
66510
 
66614
- if (utils$1.isRegExp(filter)) {
66511
+ if (utils.isRegExp(filter)) {
66615
66512
  return filter.test(value);
66616
66513
  }
66617
66514
  }
@@ -66624,7 +66521,7 @@ function formatHeader(header) {
66624
66521
  }
66625
66522
 
66626
66523
  function buildAccessors(obj, header) {
66627
- const accessorName = utils$1.toCamelCase(' ' + header);
66524
+ const accessorName = utils.toCamelCase(' ' + header);
66628
66525
 
66629
66526
  ['get', 'set', 'has'].forEach(methodName => {
66630
66527
  Object.defineProperty(obj, methodName + accessorName, {
@@ -66651,7 +66548,7 @@ class AxiosHeaders {
66651
66548
  throw new Error('header name must be a non-empty string');
66652
66549
  }
66653
66550
 
66654
- const key = utils$1.findKey(self, lHeader);
66551
+ const key = utils.findKey(self, lHeader);
66655
66552
 
66656
66553
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
66657
66554
  self[key || _header] = normalizeValue(_value);
@@ -66659,16 +66556,12 @@ class AxiosHeaders {
66659
66556
  }
66660
66557
 
66661
66558
  const setHeaders = (headers, _rewrite) =>
66662
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
66559
+ utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
66663
66560
 
66664
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
66561
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
66665
66562
  setHeaders(header, valueOrRewrite);
66666
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
66563
+ } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
66667
66564
  setHeaders(parseHeaders(header), valueOrRewrite);
66668
- } else if (utils$1.isHeaders(header)) {
66669
- for (const [key, value] of header.entries()) {
66670
- setHeader(value, key, rewrite);
66671
- }
66672
66565
  } else {
66673
66566
  header != null && setHeader(valueOrRewrite, header, rewrite);
66674
66567
  }
@@ -66680,7 +66573,7 @@ class AxiosHeaders {
66680
66573
  header = normalizeHeader(header);
66681
66574
 
66682
66575
  if (header) {
66683
- const key = utils$1.findKey(this, header);
66576
+ const key = utils.findKey(this, header);
66684
66577
 
66685
66578
  if (key) {
66686
66579
  const value = this[key];
@@ -66693,11 +66586,11 @@ class AxiosHeaders {
66693
66586
  return parseTokens(value);
66694
66587
  }
66695
66588
 
66696
- if (utils$1.isFunction(parser)) {
66589
+ if (utils.isFunction(parser)) {
66697
66590
  return parser.call(this, value, key);
66698
66591
  }
66699
66592
 
66700
- if (utils$1.isRegExp(parser)) {
66593
+ if (utils.isRegExp(parser)) {
66701
66594
  return parser.exec(value);
66702
66595
  }
66703
66596
 
@@ -66710,7 +66603,7 @@ class AxiosHeaders {
66710
66603
  header = normalizeHeader(header);
66711
66604
 
66712
66605
  if (header) {
66713
- const key = utils$1.findKey(this, header);
66606
+ const key = utils.findKey(this, header);
66714
66607
 
66715
66608
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
66716
66609
  }
@@ -66726,7 +66619,7 @@ class AxiosHeaders {
66726
66619
  _header = normalizeHeader(_header);
66727
66620
 
66728
66621
  if (_header) {
66729
- const key = utils$1.findKey(self, _header);
66622
+ const key = utils.findKey(self, _header);
66730
66623
 
66731
66624
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
66732
66625
  delete self[key];
@@ -66736,7 +66629,7 @@ class AxiosHeaders {
66736
66629
  }
66737
66630
  }
66738
66631
 
66739
- if (utils$1.isArray(header)) {
66632
+ if (utils.isArray(header)) {
66740
66633
  header.forEach(deleteHeader);
66741
66634
  } else {
66742
66635
  deleteHeader(header);
@@ -66765,8 +66658,8 @@ class AxiosHeaders {
66765
66658
  const self = this;
66766
66659
  const headers = {};
66767
66660
 
66768
- utils$1.forEach(this, (value, header) => {
66769
- const key = utils$1.findKey(headers, header);
66661
+ utils.forEach(this, (value, header) => {
66662
+ const key = utils.findKey(headers, header);
66770
66663
 
66771
66664
  if (key) {
66772
66665
  self[key] = normalizeValue(value);
@@ -66795,8 +66688,8 @@ class AxiosHeaders {
66795
66688
  toJSON(asStrings) {
66796
66689
  const obj = Object.create(null);
66797
66690
 
66798
- utils$1.forEach(this, (value, header) => {
66799
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
66691
+ utils.forEach(this, (value, header) => {
66692
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
66800
66693
  });
66801
66694
 
66802
66695
  return obj;
@@ -66843,7 +66736,7 @@ class AxiosHeaders {
66843
66736
  }
66844
66737
  }
66845
66738
 
66846
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
66739
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
66847
66740
 
66848
66741
  return this;
66849
66742
  }
@@ -66852,7 +66745,7 @@ class AxiosHeaders {
66852
66745
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
66853
66746
 
66854
66747
  // reserved names hotfix
66855
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
66748
+ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
66856
66749
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
66857
66750
  return {
66858
66751
  get: () => value,
@@ -66862,7 +66755,7 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
66862
66755
  }
66863
66756
  });
66864
66757
 
66865
- utils$1.freezeMethods(AxiosHeaders);
66758
+ utils.freezeMethods(AxiosHeaders);
66866
66759
 
66867
66760
  /**
66868
66761
  * Transform the data for a request or a response
@@ -66878,7 +66771,7 @@ function transformData(fns, response) {
66878
66771
  const headers = AxiosHeaders.from(context.headers);
66879
66772
  let data = context.data;
66880
66773
 
66881
- utils$1.forEach(fns, function transform(fn) {
66774
+ utils.forEach(fns, function transform(fn) {
66882
66775
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
66883
66776
  });
66884
66777
 
@@ -66906,7 +66799,7 @@ function CanceledError(message, config, request) {
66906
66799
  this.name = 'CanceledError';
66907
66800
  }
66908
66801
 
66909
- utils$1.inherits(CanceledError, AxiosError, {
66802
+ utils.inherits(CanceledError, AxiosError, {
66910
66803
  __CANCEL__: true
66911
66804
  });
66912
66805
 
@@ -66958,7 +66851,7 @@ function isAbsoluteURL(url) {
66958
66851
  */
66959
66852
  function combineURLs(baseURL, relativeURL) {
66960
66853
  return relativeURL
66961
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
66854
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
66962
66855
  : baseURL;
66963
66856
  }
66964
66857
 
@@ -68964,7 +68857,7 @@ followRedirects$1.exports.wrap = wrap;
68964
68857
  var followRedirectsExports = followRedirects$1.exports;
68965
68858
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
68966
68859
 
68967
- const VERSION = "1.7.7";
68860
+ const VERSION = "1.5.1";
68968
68861
 
68969
68862
  function parseProtocol(url) {
68970
68863
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -69019,11 +68912,93 @@ function fromDataURI(uri, asBlob, options) {
69019
68912
  throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
69020
68913
  }
69021
68914
 
68915
+ /**
68916
+ * Throttle decorator
68917
+ * @param {Function} fn
68918
+ * @param {Number} freq
68919
+ * @return {Function}
68920
+ */
68921
+ function throttle(fn, freq) {
68922
+ let timestamp = 0;
68923
+ const threshold = 1000 / freq;
68924
+ let timer = null;
68925
+ return function throttled(force, args) {
68926
+ const now = Date.now();
68927
+ if (force || now - timestamp > threshold) {
68928
+ if (timer) {
68929
+ clearTimeout(timer);
68930
+ timer = null;
68931
+ }
68932
+ timestamp = now;
68933
+ return fn.apply(null, args);
68934
+ }
68935
+ if (!timer) {
68936
+ timer = setTimeout(() => {
68937
+ timer = null;
68938
+ timestamp = Date.now();
68939
+ return fn.apply(null, args);
68940
+ }, threshold - (now - timestamp));
68941
+ }
68942
+ };
68943
+ }
68944
+
68945
+ /**
68946
+ * Calculate data maxRate
68947
+ * @param {Number} [samplesCount= 10]
68948
+ * @param {Number} [min= 1000]
68949
+ * @returns {Function}
68950
+ */
68951
+ function speedometer(samplesCount, min) {
68952
+ samplesCount = samplesCount || 10;
68953
+ const bytes = new Array(samplesCount);
68954
+ const timestamps = new Array(samplesCount);
68955
+ let head = 0;
68956
+ let tail = 0;
68957
+ let firstSampleTS;
68958
+
68959
+ min = min !== undefined ? min : 1000;
68960
+
68961
+ return function push(chunkLength) {
68962
+ const now = Date.now();
68963
+
68964
+ const startedAt = timestamps[tail];
68965
+
68966
+ if (!firstSampleTS) {
68967
+ firstSampleTS = now;
68968
+ }
68969
+
68970
+ bytes[head] = chunkLength;
68971
+ timestamps[head] = now;
68972
+
68973
+ let i = tail;
68974
+ let bytesCount = 0;
68975
+
68976
+ while (i !== head) {
68977
+ bytesCount += bytes[i++];
68978
+ i = i % samplesCount;
68979
+ }
68980
+
68981
+ head = (head + 1) % samplesCount;
68982
+
68983
+ if (head === tail) {
68984
+ tail = (tail + 1) % samplesCount;
68985
+ }
68986
+
68987
+ if (now - firstSampleTS < min) {
68988
+ return;
68989
+ }
68990
+
68991
+ const passed = startedAt && now - startedAt;
68992
+
68993
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
68994
+ };
68995
+ }
68996
+
69022
68997
  const kInternals = Symbol('internals');
69023
68998
 
69024
68999
  class AxiosTransformStream extends stream.Transform{
69025
69000
  constructor(options) {
69026
- options = utils$1.toFlatObject(options, {
69001
+ options = utils.toFlatObject(options, {
69027
69002
  maxRate: 0,
69028
69003
  chunkSize: 64 * 1024,
69029
69004
  minChunkSize: 100,
@@ -69031,15 +69006,19 @@ class AxiosTransformStream extends stream.Transform{
69031
69006
  ticksRate: 2,
69032
69007
  samplesCount: 15
69033
69008
  }, null, (prop, source) => {
69034
- return !utils$1.isUndefined(source[prop]);
69009
+ return !utils.isUndefined(source[prop]);
69035
69010
  });
69036
69011
 
69037
69012
  super({
69038
69013
  readableHighWaterMark: options.chunkSize
69039
69014
  });
69040
69015
 
69016
+ const self = this;
69017
+
69041
69018
  const internals = this[kInternals] = {
69019
+ length: options.length,
69042
69020
  timeWindow: options.timeWindow,
69021
+ ticksRate: options.ticksRate,
69043
69022
  chunkSize: options.chunkSize,
69044
69023
  maxRate: options.maxRate,
69045
69024
  minChunkSize: options.minChunkSize,
@@ -69051,6 +69030,8 @@ class AxiosTransformStream extends stream.Transform{
69051
69030
  onReadCallback: null
69052
69031
  };
69053
69032
 
69033
+ const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
69034
+
69054
69035
  this.on('newListener', event => {
69055
69036
  if (event === 'progress') {
69056
69037
  if (!internals.isCaptured) {
@@ -69058,6 +69039,38 @@ class AxiosTransformStream extends stream.Transform{
69058
69039
  }
69059
69040
  }
69060
69041
  });
69042
+
69043
+ let bytesNotified = 0;
69044
+
69045
+ internals.updateProgress = throttle(function throttledHandler() {
69046
+ const totalBytes = internals.length;
69047
+ const bytesTransferred = internals.bytesSeen;
69048
+ const progressBytes = bytesTransferred - bytesNotified;
69049
+ if (!progressBytes || self.destroyed) return;
69050
+
69051
+ const rate = _speedometer(progressBytes);
69052
+
69053
+ bytesNotified = bytesTransferred;
69054
+
69055
+ process.nextTick(() => {
69056
+ self.emit('progress', {
69057
+ 'loaded': bytesTransferred,
69058
+ 'total': totalBytes,
69059
+ 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
69060
+ 'bytes': progressBytes,
69061
+ 'rate': rate ? rate : undefined,
69062
+ 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
69063
+ (totalBytes - bytesTransferred) / rate : undefined
69064
+ });
69065
+ });
69066
+ }, internals.ticksRate);
69067
+
69068
+ const onFinish = () => {
69069
+ internals.updateProgress(true);
69070
+ };
69071
+
69072
+ this.once('end', onFinish);
69073
+ this.once('error', onFinish);
69061
69074
  }
69062
69075
 
69063
69076
  _read(size) {
@@ -69071,6 +69084,7 @@ class AxiosTransformStream extends stream.Transform{
69071
69084
  }
69072
69085
 
69073
69086
  _transform(chunk, encoding, callback) {
69087
+ const self = this;
69074
69088
  const internals = this[kInternals];
69075
69089
  const maxRate = internals.maxRate;
69076
69090
 
@@ -69082,14 +69096,16 @@ class AxiosTransformStream extends stream.Transform{
69082
69096
  const bytesThreshold = (maxRate / divider);
69083
69097
  const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
69084
69098
 
69085
- const pushChunk = (_chunk, _callback) => {
69099
+ function pushChunk(_chunk, _callback) {
69086
69100
  const bytes = Buffer.byteLength(_chunk);
69087
69101
  internals.bytesSeen += bytes;
69088
69102
  internals.bytes += bytes;
69089
69103
 
69090
- internals.isCaptured && this.emit('progress', internals.bytesSeen);
69104
+ if (internals.isCaptured) {
69105
+ internals.updateProgress();
69106
+ }
69091
69107
 
69092
- if (this.push(_chunk)) {
69108
+ if (self.push(_chunk)) {
69093
69109
  process.nextTick(_callback);
69094
69110
  } else {
69095
69111
  internals.onReadCallback = () => {
@@ -69097,7 +69113,7 @@ class AxiosTransformStream extends stream.Transform{
69097
69113
  process.nextTick(_callback);
69098
69114
  };
69099
69115
  }
69100
- };
69116
+ }
69101
69117
 
69102
69118
  const transformChunk = (_chunk, _callback) => {
69103
69119
  const chunkSize = Buffer.byteLength(_chunk);
@@ -69154,6 +69170,11 @@ class AxiosTransformStream extends stream.Transform{
69154
69170
  }
69155
69171
  });
69156
69172
  }
69173
+
69174
+ setLength(length) {
69175
+ this[kInternals].length = +length;
69176
+ return this;
69177
+ }
69157
69178
  }
69158
69179
 
69159
69180
  const {asyncIterator} = Symbol;
@@ -69170,7 +69191,7 @@ const readBlob = async function* (blob) {
69170
69191
  }
69171
69192
  };
69172
69193
 
69173
- const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
69194
+ const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
69174
69195
 
69175
69196
  const textEncoder = new require$$1$2.TextEncoder();
69176
69197
 
@@ -69181,7 +69202,7 @@ const CRLF_BYTES_COUNT = 2;
69181
69202
  class FormDataPart {
69182
69203
  constructor(name, value) {
69183
69204
  const {escapeName} = this.constructor;
69184
- const isStringValue = utils$1.isString(value);
69205
+ const isStringValue = utils.isString(value);
69185
69206
 
69186
69207
  let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
69187
69208
  !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
@@ -69208,7 +69229,7 @@ class FormDataPart {
69208
69229
 
69209
69230
  const {value} = this;
69210
69231
 
69211
- if(utils$1.isTypedArray(value)) {
69232
+ if(utils.isTypedArray(value)) {
69212
69233
  yield value;
69213
69234
  } else {
69214
69235
  yield* readBlob(value);
@@ -69230,10 +69251,10 @@ const formDataToStream = (form, headersHandler, options) => {
69230
69251
  const {
69231
69252
  tag = 'form-data-boundary',
69232
69253
  size = 25,
69233
- boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
69254
+ boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
69234
69255
  } = options || {};
69235
69256
 
69236
- if(!utils$1.isFormData(form)) {
69257
+ if(!utils.isFormData(form)) {
69237
69258
  throw TypeError('FormData instance required');
69238
69259
  }
69239
69260
 
@@ -69253,7 +69274,7 @@ const formDataToStream = (form, headersHandler, options) => {
69253
69274
 
69254
69275
  contentLength += boundaryBytes.byteLength * parts.length;
69255
69276
 
69256
- contentLength = utils$1.toFiniteNumber(contentLength);
69277
+ contentLength = utils.toFiniteNumber(contentLength);
69257
69278
 
69258
69279
  const computedHeaders = {
69259
69280
  'Content-Type': `multipart/form-data; boundary=${boundary}`
@@ -69299,7 +69320,7 @@ class ZlibHeaderTransformStream extends stream.Transform {
69299
69320
  }
69300
69321
 
69301
69322
  const callbackify = (fn, reducer) => {
69302
- return utils$1.isAsyncFn(fn) ? function (...args) {
69323
+ return utils.isAsyncFn(fn) ? function (...args) {
69303
69324
  const cb = args.pop();
69304
69325
  fn.apply(this, args).then((value) => {
69305
69326
  try {
@@ -69311,142 +69332,6 @@ const callbackify = (fn, reducer) => {
69311
69332
  } : fn;
69312
69333
  };
69313
69334
 
69314
- /**
69315
- * Calculate data maxRate
69316
- * @param {Number} [samplesCount= 10]
69317
- * @param {Number} [min= 1000]
69318
- * @returns {Function}
69319
- */
69320
- function speedometer(samplesCount, min) {
69321
- samplesCount = samplesCount || 10;
69322
- const bytes = new Array(samplesCount);
69323
- const timestamps = new Array(samplesCount);
69324
- let head = 0;
69325
- let tail = 0;
69326
- let firstSampleTS;
69327
-
69328
- min = min !== undefined ? min : 1000;
69329
-
69330
- return function push(chunkLength) {
69331
- const now = Date.now();
69332
-
69333
- const startedAt = timestamps[tail];
69334
-
69335
- if (!firstSampleTS) {
69336
- firstSampleTS = now;
69337
- }
69338
-
69339
- bytes[head] = chunkLength;
69340
- timestamps[head] = now;
69341
-
69342
- let i = tail;
69343
- let bytesCount = 0;
69344
-
69345
- while (i !== head) {
69346
- bytesCount += bytes[i++];
69347
- i = i % samplesCount;
69348
- }
69349
-
69350
- head = (head + 1) % samplesCount;
69351
-
69352
- if (head === tail) {
69353
- tail = (tail + 1) % samplesCount;
69354
- }
69355
-
69356
- if (now - firstSampleTS < min) {
69357
- return;
69358
- }
69359
-
69360
- const passed = startedAt && now - startedAt;
69361
-
69362
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
69363
- };
69364
- }
69365
-
69366
- /**
69367
- * Throttle decorator
69368
- * @param {Function} fn
69369
- * @param {Number} freq
69370
- * @return {Function}
69371
- */
69372
- function throttle(fn, freq) {
69373
- let timestamp = 0;
69374
- let threshold = 1000 / freq;
69375
- let lastArgs;
69376
- let timer;
69377
-
69378
- const invoke = (args, now = Date.now()) => {
69379
- timestamp = now;
69380
- lastArgs = null;
69381
- if (timer) {
69382
- clearTimeout(timer);
69383
- timer = null;
69384
- }
69385
- fn.apply(null, args);
69386
- };
69387
-
69388
- const throttled = (...args) => {
69389
- const now = Date.now();
69390
- const passed = now - timestamp;
69391
- if ( passed >= threshold) {
69392
- invoke(args, now);
69393
- } else {
69394
- lastArgs = args;
69395
- if (!timer) {
69396
- timer = setTimeout(() => {
69397
- timer = null;
69398
- invoke(lastArgs);
69399
- }, threshold - passed);
69400
- }
69401
- }
69402
- };
69403
-
69404
- const flush = () => lastArgs && invoke(lastArgs);
69405
-
69406
- return [throttled, flush];
69407
- }
69408
-
69409
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
69410
- let bytesNotified = 0;
69411
- const _speedometer = speedometer(50, 250);
69412
-
69413
- return throttle(e => {
69414
- const loaded = e.loaded;
69415
- const total = e.lengthComputable ? e.total : undefined;
69416
- const progressBytes = loaded - bytesNotified;
69417
- const rate = _speedometer(progressBytes);
69418
- const inRange = loaded <= total;
69419
-
69420
- bytesNotified = loaded;
69421
-
69422
- const data = {
69423
- loaded,
69424
- total,
69425
- progress: total ? (loaded / total) : undefined,
69426
- bytes: progressBytes,
69427
- rate: rate ? rate : undefined,
69428
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
69429
- event: e,
69430
- lengthComputable: total != null,
69431
- [isDownloadStream ? 'download' : 'upload']: true
69432
- };
69433
-
69434
- listener(data);
69435
- }, freq);
69436
- };
69437
-
69438
- const progressEventDecorator = (total, throttled) => {
69439
- const lengthComputable = total != null;
69440
-
69441
- return [(loaded) => throttled[0]({
69442
- lengthComputable,
69443
- total,
69444
- loaded
69445
- }), throttled[1]];
69446
- };
69447
-
69448
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
69449
-
69450
69335
  const zlibOptions = {
69451
69336
  flush: zlib.constants.Z_SYNC_FLUSH,
69452
69337
  finishFlush: zlib.constants.Z_SYNC_FLUSH
@@ -69457,7 +69342,7 @@ const brotliOptions = {
69457
69342
  finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
69458
69343
  };
69459
69344
 
69460
- const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
69345
+ const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
69461
69346
 
69462
69347
  const {http: httpFollow, https: httpsFollow} = followRedirects;
69463
69348
 
@@ -69467,14 +69352,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
69467
69352
  return protocol + ':';
69468
69353
  });
69469
69354
 
69470
- const flushOnFinish = (stream, [throttled, flush]) => {
69471
- stream
69472
- .on('end', flush)
69473
- .on('error', flush);
69474
-
69475
- return throttled;
69476
- };
69477
-
69478
69355
  /**
69479
69356
  * If the proxy or config beforeRedirects functions are defined, call them with the options
69480
69357
  * object.
@@ -69483,12 +69360,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
69483
69360
  *
69484
69361
  * @returns {Object<string, any>}
69485
69362
  */
69486
- function dispatchBeforeRedirect(options, responseDetails) {
69363
+ function dispatchBeforeRedirect(options) {
69487
69364
  if (options.beforeRedirects.proxy) {
69488
69365
  options.beforeRedirects.proxy(options);
69489
69366
  }
69490
69367
  if (options.beforeRedirects.config) {
69491
- options.beforeRedirects.config(options, responseDetails);
69368
+ options.beforeRedirects.config(options);
69492
69369
  }
69493
69370
  }
69494
69371
 
@@ -69545,7 +69422,7 @@ function setProxy(options, configProxy, location) {
69545
69422
  };
69546
69423
  }
69547
69424
 
69548
- const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
69425
+ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
69549
69426
 
69550
69427
  // temporary hotfix
69551
69428
 
@@ -69574,18 +69451,6 @@ const wrapAsync = (asyncExecutor) => {
69574
69451
  })
69575
69452
  };
69576
69453
 
69577
- const resolveFamily = ({address, family}) => {
69578
- if (!utils$1.isString(address)) {
69579
- throw TypeError('address must be a string');
69580
- }
69581
- return ({
69582
- address,
69583
- family: family || (address.indexOf('.') < 0 ? 6 : 4)
69584
- });
69585
- };
69586
-
69587
- const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
69588
-
69589
69454
  /*eslint consistent-return:0*/
69590
69455
  var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69591
69456
  return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
@@ -69596,24 +69461,19 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69596
69461
  let rejected = false;
69597
69462
  let req;
69598
69463
 
69599
- if (lookup) {
69600
- const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
69601
- // hotfix to support opt.all option which is required for node 20.x
69602
- lookup = (hostname, opt, cb) => {
69603
- _lookup(hostname, opt, (err, arg0, arg1) => {
69604
- if (err) {
69605
- return cb(err);
69606
- }
69607
-
69608
- const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
69609
-
69610
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
69611
- });
69612
- };
69464
+ if (lookup && utils.isAsyncFn(lookup)) {
69465
+ lookup = callbackify(lookup, (entry) => {
69466
+ if(utils.isString(entry)) {
69467
+ entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];
69468
+ } else if (!utils.isArray(entry)) {
69469
+ throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
69470
+ }
69471
+ return entry;
69472
+ });
69613
69473
  }
69614
69474
 
69615
69475
  // temporary internal emitter until the AxiosRequest class will be implemented
69616
- const emitter = new events$1.EventEmitter();
69476
+ const emitter = new EventEmitter();
69617
69477
 
69618
69478
  const onFinished = () => {
69619
69479
  if (config.cancelToken) {
@@ -69650,7 +69510,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69650
69510
 
69651
69511
  // Parse url
69652
69512
  const fullPath = buildFullPath(config.baseURL, config.url);
69653
- const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
69513
+ const parsed = new URL(fullPath, 'http://localhost');
69654
69514
  const protocol = parsed.protocol || supportedProtocols[0];
69655
69515
 
69656
69516
  if (protocol === 'data:') {
@@ -69677,7 +69537,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69677
69537
  convertedData = convertedData.toString(responseEncoding);
69678
69538
 
69679
69539
  if (!responseEncoding || responseEncoding === 'utf8') {
69680
- convertedData = utils$1.stripBOM(convertedData);
69540
+ convertedData = utils.stripBOM(convertedData);
69681
69541
  }
69682
69542
  } else if (responseType === 'stream') {
69683
69543
  convertedData = stream.Readable.from(convertedData);
@@ -69708,13 +69568,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69708
69568
  // Only set header if it hasn't been set in config
69709
69569
  headers.set('User-Agent', 'axios/' + VERSION, false);
69710
69570
 
69711
- const {onUploadProgress, onDownloadProgress} = config;
69571
+ const onDownloadProgress = config.onDownloadProgress;
69572
+ const onUploadProgress = config.onUploadProgress;
69712
69573
  const maxRate = config.maxRate;
69713
69574
  let maxUploadRate = undefined;
69714
69575
  let maxDownloadRate = undefined;
69715
69576
 
69716
69577
  // support for spec compliant FormData objects
69717
- if (utils$1.isSpecCompliantForm(data)) {
69578
+ if (utils.isSpecCompliantForm(data)) {
69718
69579
  const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
69719
69580
 
69720
69581
  data = formDataToStream(data, (formHeaders) => {
@@ -69724,7 +69585,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69724
69585
  boundary: userBoundary && userBoundary[1] || undefined
69725
69586
  });
69726
69587
  // support for https://www.npmjs.com/package/form-data api
69727
- } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
69588
+ } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
69728
69589
  headers.set(data.getHeaders());
69729
69590
 
69730
69591
  if (!headers.hasContentLength()) {
@@ -69735,14 +69596,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69735
69596
  } catch (e) {
69736
69597
  }
69737
69598
  }
69738
- } else if (utils$1.isBlob(data)) {
69599
+ } else if (utils.isBlob(data)) {
69739
69600
  data.size && headers.setContentType(data.type || 'application/octet-stream');
69740
69601
  headers.setContentLength(data.size || 0);
69741
69602
  data = stream.Readable.from(readBlob(data));
69742
- } else if (data && !utils$1.isStream(data)) {
69743
- if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
69603
+ } else if (data && !utils.isStream(data)) {
69604
+ if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
69744
69605
  data = Buffer.from(new Uint8Array(data));
69745
- } else if (utils$1.isString(data)) {
69606
+ } else if (utils.isString(data)) {
69746
69607
  data = Buffer.from(data, 'utf-8');
69747
69608
  } else {
69748
69609
  return reject(new AxiosError(
@@ -69764,9 +69625,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69764
69625
  }
69765
69626
  }
69766
69627
 
69767
- const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
69628
+ const contentLength = utils.toFiniteNumber(headers.getContentLength());
69768
69629
 
69769
- if (utils$1.isArray(maxRate)) {
69630
+ if (utils.isArray(maxRate)) {
69770
69631
  maxUploadRate = maxRate[0];
69771
69632
  maxDownloadRate = maxRate[1];
69772
69633
  } else {
@@ -69774,21 +69635,20 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69774
69635
  }
69775
69636
 
69776
69637
  if (data && (onUploadProgress || maxUploadRate)) {
69777
- if (!utils$1.isStream(data)) {
69638
+ if (!utils.isStream(data)) {
69778
69639
  data = stream.Readable.from(data, {objectMode: false});
69779
69640
  }
69780
69641
 
69781
69642
  data = stream.pipeline([data, new AxiosTransformStream({
69782
- maxRate: utils$1.toFiniteNumber(maxUploadRate)
69783
- })], utils$1.noop);
69784
-
69785
- onUploadProgress && data.on('progress', flushOnFinish(
69786
- data,
69787
- progressEventDecorator(
69788
- contentLength,
69789
- progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
69790
- )
69791
- ));
69643
+ length: contentLength,
69644
+ maxRate: utils.toFiniteNumber(maxUploadRate)
69645
+ })], utils.noop);
69646
+
69647
+ onUploadProgress && data.on('progress', progress => {
69648
+ onUploadProgress(Object.assign(progress, {
69649
+ upload: true
69650
+ }));
69651
+ });
69792
69652
  }
69793
69653
 
69794
69654
  // HTTP basic authentication
@@ -69841,12 +69701,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69841
69701
  };
69842
69702
 
69843
69703
  // cacheable-lookup integration hotfix
69844
- !utils$1.isUndefined(lookup) && (options.lookup = lookup);
69704
+ !utils.isUndefined(lookup) && (options.lookup = lookup);
69845
69705
 
69846
69706
  if (config.socketPath) {
69847
69707
  options.socketPath = config.socketPath;
69848
69708
  } else {
69849
- options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
69709
+ options.hostname = parsed.hostname;
69850
69710
  options.port = parsed.port;
69851
69711
  setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
69852
69712
  }
@@ -69887,18 +69747,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69887
69747
 
69888
69748
  const responseLength = +res.headers['content-length'];
69889
69749
 
69890
- if (onDownloadProgress || maxDownloadRate) {
69750
+ if (onDownloadProgress) {
69891
69751
  const transformStream = new AxiosTransformStream({
69892
- maxRate: utils$1.toFiniteNumber(maxDownloadRate)
69752
+ length: utils.toFiniteNumber(responseLength),
69753
+ maxRate: utils.toFiniteNumber(maxDownloadRate)
69893
69754
  });
69894
69755
 
69895
- onDownloadProgress && transformStream.on('progress', flushOnFinish(
69896
- transformStream,
69897
- progressEventDecorator(
69898
- responseLength,
69899
- progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
69900
- )
69901
- ));
69756
+ onDownloadProgress && transformStream.on('progress', progress => {
69757
+ onDownloadProgress(Object.assign(progress, {
69758
+ download: true
69759
+ }));
69760
+ });
69902
69761
 
69903
69762
  streams.push(transformStream);
69904
69763
  }
@@ -69946,7 +69805,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
69946
69805
  }
69947
69806
  }
69948
69807
 
69949
- responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
69808
+ responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
69950
69809
 
69951
69810
  const offListeners = stream.finished(responseStream, () => {
69952
69811
  offListeners();
@@ -70008,12 +69867,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
70008
69867
  if (responseType !== 'arraybuffer') {
70009
69868
  responseData = responseData.toString(responseEncoding);
70010
69869
  if (!responseEncoding || responseEncoding === 'utf8') {
70011
- responseData = utils$1.stripBOM(responseData);
69870
+ responseData = utils.stripBOM(responseData);
70012
69871
  }
70013
69872
  }
70014
69873
  response.data = responseData;
70015
69874
  } catch (err) {
70016
- return reject(AxiosError.from(err, null, config, response.request, response));
69875
+ reject(AxiosError.from(err, null, config, response.request, response));
70017
69876
  }
70018
69877
  settle(resolve, reject, response);
70019
69878
  });
@@ -70085,7 +69944,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
70085
69944
 
70086
69945
 
70087
69946
  // Send the request
70088
- if (utils$1.isStream(data)) {
69947
+ if (utils.isStream(data)) {
70089
69948
  let ended = false;
70090
69949
  let errored = false;
70091
69950
 
@@ -70111,17 +69970,65 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
70111
69970
  });
70112
69971
  };
70113
69972
 
70114
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
69973
+ var cookies = platform.isStandardBrowserEnv ?
69974
+
69975
+ // Standard browser envs support document.cookie
69976
+ (function standardBrowserEnv() {
69977
+ return {
69978
+ write: function write(name, value, expires, path, domain, secure) {
69979
+ const cookie = [];
69980
+ cookie.push(name + '=' + encodeURIComponent(value));
69981
+
69982
+ if (utils.isNumber(expires)) {
69983
+ cookie.push('expires=' + new Date(expires).toGMTString());
69984
+ }
69985
+
69986
+ if (utils.isString(path)) {
69987
+ cookie.push('path=' + path);
69988
+ }
69989
+
69990
+ if (utils.isString(domain)) {
69991
+ cookie.push('domain=' + domain);
69992
+ }
69993
+
69994
+ if (secure === true) {
69995
+ cookie.push('secure');
69996
+ }
69997
+
69998
+ document.cookie = cookie.join('; ');
69999
+ },
70000
+
70001
+ read: function read(name) {
70002
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
70003
+ return (match ? decodeURIComponent(match[3]) : null);
70004
+ },
70005
+
70006
+ remove: function remove(name) {
70007
+ this.write(name, '', Date.now() - 86400000);
70008
+ }
70009
+ };
70010
+ })() :
70011
+
70012
+ // Non standard browser env (web workers, react-native) lack needed support.
70013
+ (function nonStandardBrowserEnv() {
70014
+ return {
70015
+ write: function write() {},
70016
+ read: function read() { return null; },
70017
+ remove: function remove() {}
70018
+ };
70019
+ })();
70020
+
70021
+ var isURLSameOrigin = platform.isStandardBrowserEnv ?
70115
70022
 
70116
70023
  // Standard browser envs have full support of the APIs needed to test
70117
70024
  // whether the request URL is of the same origin as current location.
70118
70025
  (function standardBrowserEnv() {
70119
- const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
70026
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
70120
70027
  const urlParsingNode = document.createElement('a');
70121
70028
  let originURL;
70122
70029
 
70123
70030
  /**
70124
- * Parse a URL to discover its components
70031
+ * Parse a URL to discover it's components
70125
70032
  *
70126
70033
  * @param {String} url The URL to be parsed
70127
70034
  * @returns {Object}
@@ -70161,7 +70068,7 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
70161
70068
  * @returns {boolean} True if URL shares the same origin, otherwise false
70162
70069
  */
70163
70070
  return function isURLSameOrigin(requestURL) {
70164
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
70071
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
70165
70072
  return (parsed.protocol === originURL.protocol &&
70166
70073
  parsed.host === originURL.host);
70167
70074
  };
@@ -70174,222 +70081,81 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
70174
70081
  };
70175
70082
  })();
70176
70083
 
70177
- var cookies = platform.hasStandardBrowserEnv ?
70178
-
70179
- // Standard browser envs support document.cookie
70180
- {
70181
- write(name, value, expires, path, domain, secure) {
70182
- const cookie = [name + '=' + encodeURIComponent(value)];
70183
-
70184
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
70185
-
70186
- utils$1.isString(path) && cookie.push('path=' + path);
70187
-
70188
- utils$1.isString(domain) && cookie.push('domain=' + domain);
70189
-
70190
- secure === true && cookie.push('secure');
70191
-
70192
- document.cookie = cookie.join('; ');
70193
- },
70194
-
70195
- read(name) {
70196
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
70197
- return (match ? decodeURIComponent(match[3]) : null);
70198
- },
70199
-
70200
- remove(name) {
70201
- this.write(name, '', Date.now() - 86400000);
70202
- }
70203
- }
70204
-
70205
- :
70206
-
70207
- // Non-standard browser env (web workers, react-native) lack needed support.
70208
- {
70209
- write() {},
70210
- read() {
70211
- return null;
70212
- },
70213
- remove() {}
70214
- };
70215
-
70216
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
70217
-
70218
- /**
70219
- * Config-specific merge-function which creates a new config-object
70220
- * by merging two configuration objects together.
70221
- *
70222
- * @param {Object} config1
70223
- * @param {Object} config2
70224
- *
70225
- * @returns {Object} New object resulting from merging config2 to config1
70226
- */
70227
- function mergeConfig(config1, config2) {
70228
- // eslint-disable-next-line no-param-reassign
70229
- config2 = config2 || {};
70230
- const config = {};
70231
-
70232
- function getMergedValue(target, source, caseless) {
70233
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
70234
- return utils$1.merge.call({caseless}, target, source);
70235
- } else if (utils$1.isPlainObject(source)) {
70236
- return utils$1.merge({}, source);
70237
- } else if (utils$1.isArray(source)) {
70238
- return source.slice();
70239
- }
70240
- return source;
70241
- }
70084
+ function progressEventReducer(listener, isDownloadStream) {
70085
+ let bytesNotified = 0;
70086
+ const _speedometer = speedometer(50, 250);
70242
70087
 
70243
- // eslint-disable-next-line consistent-return
70244
- function mergeDeepProperties(a, b, caseless) {
70245
- if (!utils$1.isUndefined(b)) {
70246
- return getMergedValue(a, b, caseless);
70247
- } else if (!utils$1.isUndefined(a)) {
70248
- return getMergedValue(undefined, a, caseless);
70249
- }
70250
- }
70088
+ return e => {
70089
+ const loaded = e.loaded;
70090
+ const total = e.lengthComputable ? e.total : undefined;
70091
+ const progressBytes = loaded - bytesNotified;
70092
+ const rate = _speedometer(progressBytes);
70093
+ const inRange = loaded <= total;
70251
70094
 
70252
- // eslint-disable-next-line consistent-return
70253
- function valueFromConfig2(a, b) {
70254
- if (!utils$1.isUndefined(b)) {
70255
- return getMergedValue(undefined, b);
70256
- }
70257
- }
70095
+ bytesNotified = loaded;
70258
70096
 
70259
- // eslint-disable-next-line consistent-return
70260
- function defaultToConfig2(a, b) {
70261
- if (!utils$1.isUndefined(b)) {
70262
- return getMergedValue(undefined, b);
70263
- } else if (!utils$1.isUndefined(a)) {
70264
- return getMergedValue(undefined, a);
70265
- }
70266
- }
70097
+ const data = {
70098
+ loaded,
70099
+ total,
70100
+ progress: total ? (loaded / total) : undefined,
70101
+ bytes: progressBytes,
70102
+ rate: rate ? rate : undefined,
70103
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
70104
+ event: e
70105
+ };
70267
70106
 
70268
- // eslint-disable-next-line consistent-return
70269
- function mergeDirectKeys(a, b, prop) {
70270
- if (prop in config2) {
70271
- return getMergedValue(a, b);
70272
- } else if (prop in config1) {
70273
- return getMergedValue(undefined, a);
70274
- }
70275
- }
70107
+ data[isDownloadStream ? 'download' : 'upload'] = true;
70276
70108
 
70277
- const mergeMap = {
70278
- url: valueFromConfig2,
70279
- method: valueFromConfig2,
70280
- data: valueFromConfig2,
70281
- baseURL: defaultToConfig2,
70282
- transformRequest: defaultToConfig2,
70283
- transformResponse: defaultToConfig2,
70284
- paramsSerializer: defaultToConfig2,
70285
- timeout: defaultToConfig2,
70286
- timeoutMessage: defaultToConfig2,
70287
- withCredentials: defaultToConfig2,
70288
- withXSRFToken: defaultToConfig2,
70289
- adapter: defaultToConfig2,
70290
- responseType: defaultToConfig2,
70291
- xsrfCookieName: defaultToConfig2,
70292
- xsrfHeaderName: defaultToConfig2,
70293
- onUploadProgress: defaultToConfig2,
70294
- onDownloadProgress: defaultToConfig2,
70295
- decompress: defaultToConfig2,
70296
- maxContentLength: defaultToConfig2,
70297
- maxBodyLength: defaultToConfig2,
70298
- beforeRedirect: defaultToConfig2,
70299
- transport: defaultToConfig2,
70300
- httpAgent: defaultToConfig2,
70301
- httpsAgent: defaultToConfig2,
70302
- cancelToken: defaultToConfig2,
70303
- socketPath: defaultToConfig2,
70304
- responseEncoding: defaultToConfig2,
70305
- validateStatus: mergeDirectKeys,
70306
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
70109
+ listener(data);
70307
70110
  };
70308
-
70309
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
70310
- const merge = mergeMap[prop] || mergeDeepProperties;
70311
- const configValue = merge(config1[prop], config2[prop], prop);
70312
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
70313
- });
70314
-
70315
- return config;
70316
70111
  }
70317
70112
 
70318
- var resolveConfig = (config) => {
70319
- const newConfig = mergeConfig({}, config);
70320
-
70321
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
70322
-
70323
- newConfig.headers = headers = AxiosHeaders.from(headers);
70324
-
70325
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
70326
-
70327
- // HTTP basic authentication
70328
- if (auth) {
70329
- headers.set('Authorization', 'Basic ' +
70330
- btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
70331
- );
70332
- }
70333
-
70334
- let contentType;
70335
-
70336
- if (utils$1.isFormData(data)) {
70337
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
70338
- headers.setContentType(undefined); // Let the browser set it
70339
- } else if ((contentType = headers.getContentType()) !== false) {
70340
- // fix semicolon duplication issue for ReactNative FormData implementation
70341
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
70342
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
70343
- }
70344
- }
70345
-
70346
- // Add xsrf header
70347
- // This is only done if running in a standard browser environment.
70348
- // Specifically not if we're in a web worker, or react-native.
70349
-
70350
- if (platform.hasStandardBrowserEnv) {
70351
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
70352
-
70353
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
70354
- // Add xsrf header
70355
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
70356
-
70357
- if (xsrfValue) {
70358
- headers.set(xsrfHeaderName, xsrfValue);
70359
- }
70360
- }
70361
- }
70362
-
70363
- return newConfig;
70364
- };
70365
-
70366
70113
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
70367
70114
 
70368
70115
  var xhrAdapter = isXHRAdapterSupported && function (config) {
70369
70116
  return new Promise(function dispatchXhrRequest(resolve, reject) {
70370
- const _config = resolveConfig(config);
70371
- let requestData = _config.data;
70372
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
70373
- let {responseType, onUploadProgress, onDownloadProgress} = _config;
70117
+ let requestData = config.data;
70118
+ const requestHeaders = AxiosHeaders.from(config.headers).normalize();
70119
+ const responseType = config.responseType;
70374
70120
  let onCanceled;
70375
- let uploadThrottled, downloadThrottled;
70376
- let flushUpload, flushDownload;
70377
-
70378
70121
  function done() {
70379
- flushUpload && flushUpload(); // flush events
70380
- flushDownload && flushDownload(); // flush events
70122
+ if (config.cancelToken) {
70123
+ config.cancelToken.unsubscribe(onCanceled);
70124
+ }
70381
70125
 
70382
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
70126
+ if (config.signal) {
70127
+ config.signal.removeEventListener('abort', onCanceled);
70128
+ }
70129
+ }
70130
+
70131
+ let contentType;
70383
70132
 
70384
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
70133
+ if (utils.isFormData(requestData)) {
70134
+ if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
70135
+ requestHeaders.setContentType(false); // Let the browser set it
70136
+ } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
70137
+ requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
70138
+ } else if(utils.isString(contentType = requestHeaders.getContentType())){
70139
+ // fix semicolon duplication issue for ReactNative FormData implementation
70140
+ requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
70141
+ }
70385
70142
  }
70386
70143
 
70387
70144
  let request = new XMLHttpRequest();
70388
70145
 
70389
- request.open(_config.method.toUpperCase(), _config.url, true);
70146
+ // HTTP basic authentication
70147
+ if (config.auth) {
70148
+ const username = config.auth.username || '';
70149
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
70150
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
70151
+ }
70152
+
70153
+ const fullPath = buildFullPath(config.baseURL, config.url);
70154
+
70155
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
70390
70156
 
70391
70157
  // Set the request timeout in MS
70392
- request.timeout = _config.timeout;
70158
+ request.timeout = config.timeout;
70393
70159
 
70394
70160
  function onloadend() {
70395
70161
  if (!request) {
@@ -70469,10 +70235,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
70469
70235
 
70470
70236
  // Handle timeout
70471
70237
  request.ontimeout = function handleTimeout() {
70472
- let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
70473
- const transitional = _config.transitional || transitionalDefaults;
70474
- if (_config.timeoutErrorMessage) {
70475
- timeoutErrorMessage = _config.timeoutErrorMessage;
70238
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
70239
+ const transitional = config.transitional || transitionalDefaults;
70240
+ if (config.timeoutErrorMessage) {
70241
+ timeoutErrorMessage = config.timeoutErrorMessage;
70476
70242
  }
70477
70243
  reject(new AxiosError(
70478
70244
  timeoutErrorMessage,
@@ -70484,42 +70250,50 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
70484
70250
  request = null;
70485
70251
  };
70486
70252
 
70253
+ // Add xsrf header
70254
+ // This is only done if running in a standard browser environment.
70255
+ // Specifically not if we're in a web worker, or react-native.
70256
+ if (platform.isStandardBrowserEnv) {
70257
+ // Add xsrf header
70258
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
70259
+ && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
70260
+
70261
+ if (xsrfValue) {
70262
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
70263
+ }
70264
+ }
70265
+
70487
70266
  // Remove Content-Type if data is undefined
70488
70267
  requestData === undefined && requestHeaders.setContentType(null);
70489
70268
 
70490
70269
  // Add headers to the request
70491
70270
  if ('setRequestHeader' in request) {
70492
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
70271
+ utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
70493
70272
  request.setRequestHeader(key, val);
70494
70273
  });
70495
70274
  }
70496
70275
 
70497
70276
  // Add withCredentials to request if needed
70498
- if (!utils$1.isUndefined(_config.withCredentials)) {
70499
- request.withCredentials = !!_config.withCredentials;
70277
+ if (!utils.isUndefined(config.withCredentials)) {
70278
+ request.withCredentials = !!config.withCredentials;
70500
70279
  }
70501
70280
 
70502
70281
  // Add responseType to request if needed
70503
70282
  if (responseType && responseType !== 'json') {
70504
- request.responseType = _config.responseType;
70283
+ request.responseType = config.responseType;
70505
70284
  }
70506
70285
 
70507
70286
  // Handle progress if needed
70508
- if (onDownloadProgress) {
70509
- ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
70510
- request.addEventListener('progress', downloadThrottled);
70287
+ if (typeof config.onDownloadProgress === 'function') {
70288
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
70511
70289
  }
70512
70290
 
70513
70291
  // Not all browsers support upload events
70514
- if (onUploadProgress && request.upload) {
70515
- ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
70516
-
70517
- request.upload.addEventListener('progress', uploadThrottled);
70518
-
70519
- request.upload.addEventListener('loadend', flushUpload);
70292
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
70293
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
70520
70294
  }
70521
70295
 
70522
- if (_config.cancelToken || _config.signal) {
70296
+ if (config.cancelToken || config.signal) {
70523
70297
  // Handle cancellation
70524
70298
  // eslint-disable-next-line func-names
70525
70299
  onCanceled = cancel => {
@@ -70531,13 +70305,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
70531
70305
  request = null;
70532
70306
  };
70533
70307
 
70534
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
70535
- if (_config.signal) {
70536
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
70308
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
70309
+ if (config.signal) {
70310
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
70537
70311
  }
70538
70312
  }
70539
70313
 
70540
- const protocol = parseProtocol(_config.url);
70314
+ const protocol = parseProtocol(fullPath);
70541
70315
 
70542
70316
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
70543
70317
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -70550,361 +70324,12 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
70550
70324
  });
70551
70325
  };
70552
70326
 
70553
- const composeSignals = (signals, timeout) => {
70554
- const {length} = (signals = signals ? signals.filter(Boolean) : []);
70555
-
70556
- if (timeout || length) {
70557
- let controller = new AbortController();
70558
-
70559
- let aborted;
70560
-
70561
- const onabort = function (reason) {
70562
- if (!aborted) {
70563
- aborted = true;
70564
- unsubscribe();
70565
- const err = reason instanceof Error ? reason : this.reason;
70566
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
70567
- }
70568
- };
70569
-
70570
- let timer = timeout && setTimeout(() => {
70571
- timer = null;
70572
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
70573
- }, timeout);
70574
-
70575
- const unsubscribe = () => {
70576
- if (signals) {
70577
- timer && clearTimeout(timer);
70578
- timer = null;
70579
- signals.forEach(signal => {
70580
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
70581
- });
70582
- signals = null;
70583
- }
70584
- };
70585
-
70586
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
70587
-
70588
- const {signal} = controller;
70589
-
70590
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
70591
-
70592
- return signal;
70593
- }
70594
- };
70595
-
70596
- const streamChunk = function* (chunk, chunkSize) {
70597
- let len = chunk.byteLength;
70598
-
70599
- if (!chunkSize || len < chunkSize) {
70600
- yield chunk;
70601
- return;
70602
- }
70603
-
70604
- let pos = 0;
70605
- let end;
70606
-
70607
- while (pos < len) {
70608
- end = pos + chunkSize;
70609
- yield chunk.slice(pos, end);
70610
- pos = end;
70611
- }
70612
- };
70613
-
70614
- const readBytes = async function* (iterable, chunkSize) {
70615
- for await (const chunk of readStream(iterable)) {
70616
- yield* streamChunk(chunk, chunkSize);
70617
- }
70618
- };
70619
-
70620
- const readStream = async function* (stream) {
70621
- if (stream[Symbol.asyncIterator]) {
70622
- yield* stream;
70623
- return;
70624
- }
70625
-
70626
- const reader = stream.getReader();
70627
- try {
70628
- for (;;) {
70629
- const {done, value} = await reader.read();
70630
- if (done) {
70631
- break;
70632
- }
70633
- yield value;
70634
- }
70635
- } finally {
70636
- await reader.cancel();
70637
- }
70638
- };
70639
-
70640
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
70641
- const iterator = readBytes(stream, chunkSize);
70642
-
70643
- let bytes = 0;
70644
- let done;
70645
- let _onFinish = (e) => {
70646
- if (!done) {
70647
- done = true;
70648
- onFinish && onFinish(e);
70649
- }
70650
- };
70651
-
70652
- return new ReadableStream({
70653
- async pull(controller) {
70654
- try {
70655
- const {done, value} = await iterator.next();
70656
-
70657
- if (done) {
70658
- _onFinish();
70659
- controller.close();
70660
- return;
70661
- }
70662
-
70663
- let len = value.byteLength;
70664
- if (onProgress) {
70665
- let loadedBytes = bytes += len;
70666
- onProgress(loadedBytes);
70667
- }
70668
- controller.enqueue(new Uint8Array(value));
70669
- } catch (err) {
70670
- _onFinish(err);
70671
- throw err;
70672
- }
70673
- },
70674
- cancel(reason) {
70675
- _onFinish(reason);
70676
- return iterator.return();
70677
- }
70678
- }, {
70679
- highWaterMark: 2
70680
- })
70681
- };
70682
-
70683
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
70684
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
70685
-
70686
- // used only inside the fetch adapter
70687
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
70688
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
70689
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
70690
- );
70691
-
70692
- const test = (fn, ...args) => {
70693
- try {
70694
- return !!fn(...args);
70695
- } catch (e) {
70696
- return false
70697
- }
70698
- };
70699
-
70700
- const supportsRequestStream = isReadableStreamSupported && test(() => {
70701
- let duplexAccessed = false;
70702
-
70703
- const hasContentType = new Request(platform.origin, {
70704
- body: new ReadableStream(),
70705
- method: 'POST',
70706
- get duplex() {
70707
- duplexAccessed = true;
70708
- return 'half';
70709
- },
70710
- }).headers.has('Content-Type');
70711
-
70712
- return duplexAccessed && !hasContentType;
70713
- });
70714
-
70715
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
70716
-
70717
- const supportsResponseStream = isReadableStreamSupported &&
70718
- test(() => utils$1.isReadableStream(new Response('').body));
70719
-
70720
-
70721
- const resolvers = {
70722
- stream: supportsResponseStream && ((res) => res.body)
70723
- };
70724
-
70725
- isFetchSupported && (((res) => {
70726
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
70727
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
70728
- (_, config) => {
70729
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
70730
- });
70731
- });
70732
- })(new Response));
70733
-
70734
- const getBodyLength = async (body) => {
70735
- if (body == null) {
70736
- return 0;
70737
- }
70738
-
70739
- if(utils$1.isBlob(body)) {
70740
- return body.size;
70741
- }
70742
-
70743
- if(utils$1.isSpecCompliantForm(body)) {
70744
- const _request = new Request(platform.origin, {
70745
- method: 'POST',
70746
- body,
70747
- });
70748
- return (await _request.arrayBuffer()).byteLength;
70749
- }
70750
-
70751
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
70752
- return body.byteLength;
70753
- }
70754
-
70755
- if(utils$1.isURLSearchParams(body)) {
70756
- body = body + '';
70757
- }
70758
-
70759
- if(utils$1.isString(body)) {
70760
- return (await encodeText(body)).byteLength;
70761
- }
70762
- };
70763
-
70764
- const resolveBodyLength = async (headers, body) => {
70765
- const length = utils$1.toFiniteNumber(headers.getContentLength());
70766
-
70767
- return length == null ? getBodyLength(body) : length;
70768
- };
70769
-
70770
- var fetchAdapter = isFetchSupported && (async (config) => {
70771
- let {
70772
- url,
70773
- method,
70774
- data,
70775
- signal,
70776
- cancelToken,
70777
- timeout,
70778
- onDownloadProgress,
70779
- onUploadProgress,
70780
- responseType,
70781
- headers,
70782
- withCredentials = 'same-origin',
70783
- fetchOptions
70784
- } = resolveConfig(config);
70785
-
70786
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
70787
-
70788
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
70789
-
70790
- let request;
70791
-
70792
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
70793
- composedSignal.unsubscribe();
70794
- });
70795
-
70796
- let requestContentLength;
70797
-
70798
- try {
70799
- if (
70800
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
70801
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
70802
- ) {
70803
- let _request = new Request(url, {
70804
- method: 'POST',
70805
- body: data,
70806
- duplex: "half"
70807
- });
70808
-
70809
- let contentTypeHeader;
70810
-
70811
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
70812
- headers.setContentType(contentTypeHeader);
70813
- }
70814
-
70815
- if (_request.body) {
70816
- const [onProgress, flush] = progressEventDecorator(
70817
- requestContentLength,
70818
- progressEventReducer(asyncDecorator(onUploadProgress))
70819
- );
70820
-
70821
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
70822
- }
70823
- }
70824
-
70825
- if (!utils$1.isString(withCredentials)) {
70826
- withCredentials = withCredentials ? 'include' : 'omit';
70827
- }
70828
-
70829
- // Cloudflare Workers throws when credentials are defined
70830
- // see https://github.com/cloudflare/workerd/issues/902
70831
- const isCredentialsSupported = "credentials" in Request.prototype;
70832
- request = new Request(url, {
70833
- ...fetchOptions,
70834
- signal: composedSignal,
70835
- method: method.toUpperCase(),
70836
- headers: headers.normalize().toJSON(),
70837
- body: data,
70838
- duplex: "half",
70839
- credentials: isCredentialsSupported ? withCredentials : undefined
70840
- });
70841
-
70842
- let response = await fetch(request);
70843
-
70844
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
70845
-
70846
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
70847
- const options = {};
70848
-
70849
- ['status', 'statusText', 'headers'].forEach(prop => {
70850
- options[prop] = response[prop];
70851
- });
70852
-
70853
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
70854
-
70855
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
70856
- responseContentLength,
70857
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
70858
- ) || [];
70859
-
70860
- response = new Response(
70861
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
70862
- flush && flush();
70863
- unsubscribe && unsubscribe();
70864
- }),
70865
- options
70866
- );
70867
- }
70868
-
70869
- responseType = responseType || 'text';
70870
-
70871
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
70872
-
70873
- !isStreamResponse && unsubscribe && unsubscribe();
70874
-
70875
- return await new Promise((resolve, reject) => {
70876
- settle(resolve, reject, {
70877
- data: responseData,
70878
- headers: AxiosHeaders.from(response.headers),
70879
- status: response.status,
70880
- statusText: response.statusText,
70881
- config,
70882
- request
70883
- });
70884
- })
70885
- } catch (err) {
70886
- unsubscribe && unsubscribe();
70887
-
70888
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
70889
- throw Object.assign(
70890
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
70891
- {
70892
- cause: err.cause || err
70893
- }
70894
- )
70895
- }
70896
-
70897
- throw AxiosError.from(err, err && err.code, config, request);
70898
- }
70899
- });
70900
-
70901
70327
  const knownAdapters = {
70902
70328
  http: httpAdapter,
70903
- xhr: xhrAdapter,
70904
- fetch: fetchAdapter
70329
+ xhr: xhrAdapter
70905
70330
  };
70906
70331
 
70907
- utils$1.forEach(knownAdapters, (fn, value) => {
70332
+ utils.forEach(knownAdapters, (fn, value) => {
70908
70333
  if (fn) {
70909
70334
  try {
70910
70335
  Object.defineProperty(fn, 'name', {value});
@@ -70917,11 +70342,11 @@ utils$1.forEach(knownAdapters, (fn, value) => {
70917
70342
 
70918
70343
  const renderReason = (reason) => `- ${reason}`;
70919
70344
 
70920
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
70345
+ const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
70921
70346
 
70922
70347
  var adapters = {
70923
70348
  getAdapter: (adapters) => {
70924
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
70349
+ adapters = utils.isArray(adapters) ? adapters : [adapters];
70925
70350
 
70926
70351
  const {length} = adapters;
70927
70352
  let nameOrAdapter;
@@ -71045,6 +70470,107 @@ function dispatchRequest(config) {
71045
70470
  });
71046
70471
  }
71047
70472
 
70473
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
70474
+
70475
+ /**
70476
+ * Config-specific merge-function which creates a new config-object
70477
+ * by merging two configuration objects together.
70478
+ *
70479
+ * @param {Object} config1
70480
+ * @param {Object} config2
70481
+ *
70482
+ * @returns {Object} New object resulting from merging config2 to config1
70483
+ */
70484
+ function mergeConfig(config1, config2) {
70485
+ // eslint-disable-next-line no-param-reassign
70486
+ config2 = config2 || {};
70487
+ const config = {};
70488
+
70489
+ function getMergedValue(target, source, caseless) {
70490
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
70491
+ return utils.merge.call({caseless}, target, source);
70492
+ } else if (utils.isPlainObject(source)) {
70493
+ return utils.merge({}, source);
70494
+ } else if (utils.isArray(source)) {
70495
+ return source.slice();
70496
+ }
70497
+ return source;
70498
+ }
70499
+
70500
+ // eslint-disable-next-line consistent-return
70501
+ function mergeDeepProperties(a, b, caseless) {
70502
+ if (!utils.isUndefined(b)) {
70503
+ return getMergedValue(a, b, caseless);
70504
+ } else if (!utils.isUndefined(a)) {
70505
+ return getMergedValue(undefined, a, caseless);
70506
+ }
70507
+ }
70508
+
70509
+ // eslint-disable-next-line consistent-return
70510
+ function valueFromConfig2(a, b) {
70511
+ if (!utils.isUndefined(b)) {
70512
+ return getMergedValue(undefined, b);
70513
+ }
70514
+ }
70515
+
70516
+ // eslint-disable-next-line consistent-return
70517
+ function defaultToConfig2(a, b) {
70518
+ if (!utils.isUndefined(b)) {
70519
+ return getMergedValue(undefined, b);
70520
+ } else if (!utils.isUndefined(a)) {
70521
+ return getMergedValue(undefined, a);
70522
+ }
70523
+ }
70524
+
70525
+ // eslint-disable-next-line consistent-return
70526
+ function mergeDirectKeys(a, b, prop) {
70527
+ if (prop in config2) {
70528
+ return getMergedValue(a, b);
70529
+ } else if (prop in config1) {
70530
+ return getMergedValue(undefined, a);
70531
+ }
70532
+ }
70533
+
70534
+ const mergeMap = {
70535
+ url: valueFromConfig2,
70536
+ method: valueFromConfig2,
70537
+ data: valueFromConfig2,
70538
+ baseURL: defaultToConfig2,
70539
+ transformRequest: defaultToConfig2,
70540
+ transformResponse: defaultToConfig2,
70541
+ paramsSerializer: defaultToConfig2,
70542
+ timeout: defaultToConfig2,
70543
+ timeoutMessage: defaultToConfig2,
70544
+ withCredentials: defaultToConfig2,
70545
+ adapter: defaultToConfig2,
70546
+ responseType: defaultToConfig2,
70547
+ xsrfCookieName: defaultToConfig2,
70548
+ xsrfHeaderName: defaultToConfig2,
70549
+ onUploadProgress: defaultToConfig2,
70550
+ onDownloadProgress: defaultToConfig2,
70551
+ decompress: defaultToConfig2,
70552
+ maxContentLength: defaultToConfig2,
70553
+ maxBodyLength: defaultToConfig2,
70554
+ beforeRedirect: defaultToConfig2,
70555
+ transport: defaultToConfig2,
70556
+ httpAgent: defaultToConfig2,
70557
+ httpsAgent: defaultToConfig2,
70558
+ cancelToken: defaultToConfig2,
70559
+ socketPath: defaultToConfig2,
70560
+ responseEncoding: defaultToConfig2,
70561
+ validateStatus: mergeDirectKeys,
70562
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
70563
+ };
70564
+
70565
+ utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
70566
+ const merge = mergeMap[prop] || mergeDeepProperties;
70567
+ const configValue = merge(config1[prop], config2[prop], prop);
70568
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
70569
+ });
70570
+
70571
+ return config;
70572
+ }
70573
+
71048
70574
  const validators$1 = {};
71049
70575
 
71050
70576
  // eslint-disable-next-line func-names
@@ -71158,34 +70684,7 @@ class Axios {
71158
70684
  *
71159
70685
  * @returns {Promise} The Promise to be fulfilled
71160
70686
  */
71161
- async request(configOrUrl, config) {
71162
- try {
71163
- return await this._request(configOrUrl, config);
71164
- } catch (err) {
71165
- if (err instanceof Error) {
71166
- let dummy;
71167
-
71168
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
71169
-
71170
- // slice off the Error: ... line
71171
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
71172
- try {
71173
- if (!err.stack) {
71174
- err.stack = stack;
71175
- // match without the 2 top stack lines
71176
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
71177
- err.stack += '\n' + stack;
71178
- }
71179
- } catch (e) {
71180
- // ignore the case where "stack" is an un-writable property
71181
- }
71182
- }
71183
-
71184
- throw err;
71185
- }
71186
- }
71187
-
71188
- _request(configOrUrl, config) {
70687
+ request(configOrUrl, config) {
71189
70688
  /*eslint no-param-reassign:0*/
71190
70689
  // Allow for axios('example/url'[, config]) a la fetch API
71191
70690
  if (typeof configOrUrl === 'string') {
@@ -71208,7 +70707,7 @@ class Axios {
71208
70707
  }
71209
70708
 
71210
70709
  if (paramsSerializer != null) {
71211
- if (utils$1.isFunction(paramsSerializer)) {
70710
+ if (utils.isFunction(paramsSerializer)) {
71212
70711
  config.paramsSerializer = {
71213
70712
  serialize: paramsSerializer
71214
70713
  };
@@ -71224,12 +70723,12 @@ class Axios {
71224
70723
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
71225
70724
 
71226
70725
  // Flatten headers
71227
- let contextHeaders = headers && utils$1.merge(
70726
+ let contextHeaders = headers && utils.merge(
71228
70727
  headers.common,
71229
70728
  headers[config.method]
71230
70729
  );
71231
70730
 
71232
- headers && utils$1.forEach(
70731
+ headers && utils.forEach(
71233
70732
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
71234
70733
  (method) => {
71235
70734
  delete headers[method];
@@ -71316,7 +70815,7 @@ class Axios {
71316
70815
  }
71317
70816
 
71318
70817
  // Provide aliases for supported request methods
71319
- utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
70818
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
71320
70819
  /*eslint func-names:0*/
71321
70820
  Axios.prototype[method] = function(url, config) {
71322
70821
  return this.request(mergeConfig(config || {}, {
@@ -71327,7 +70826,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
71327
70826
  };
71328
70827
  });
71329
70828
 
71330
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
70829
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
71331
70830
  /*eslint func-names:0*/
71332
70831
 
71333
70832
  function generateHTTPMethod(isForm) {
@@ -71448,20 +70947,6 @@ class CancelToken {
71448
70947
  }
71449
70948
  }
71450
70949
 
71451
- toAbortSignal() {
71452
- const controller = new AbortController();
71453
-
71454
- const abort = (err) => {
71455
- controller.abort(err);
71456
- };
71457
-
71458
- this.subscribe(abort);
71459
-
71460
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
71461
-
71462
- return controller.signal;
71463
- }
71464
-
71465
70950
  /**
71466
70951
  * Returns an object that contains a new `CancelToken` and a function that, when called,
71467
70952
  * cancels the `CancelToken`.
@@ -71513,7 +70998,7 @@ function spread(callback) {
71513
70998
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
71514
70999
  */
71515
71000
  function isAxiosError(payload) {
71516
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
71001
+ return utils.isObject(payload) && (payload.isAxiosError === true);
71517
71002
  }
71518
71003
 
71519
71004
  const HttpStatusCode = {
@@ -71598,10 +71083,10 @@ function createInstance(defaultConfig) {
71598
71083
  const instance = bind(Axios.prototype.request, context);
71599
71084
 
71600
71085
  // Copy axios.prototype to instance
71601
- utils$1.extend(instance, Axios.prototype, context, {allOwnKeys: true});
71086
+ utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
71602
71087
 
71603
71088
  // Copy context to instance
71604
- utils$1.extend(instance, context, null, {allOwnKeys: true});
71089
+ utils.extend(instance, context, null, {allOwnKeys: true});
71605
71090
 
71606
71091
  // Factory for creating new instances
71607
71092
  instance.create = function create(instanceConfig) {
@@ -71645,7 +71130,7 @@ axios.mergeConfig = mergeConfig;
71645
71130
 
71646
71131
  axios.AxiosHeaders = AxiosHeaders;
71647
71132
 
71648
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
71133
+ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
71649
71134
 
71650
71135
  axios.getAdapter = adapters.getAdapter;
71651
71136