@lcap/axios-fixed 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.husky/commit-msg +4 -0
  2. package/CHANGELOG.md +1359 -0
  3. package/LICENSE +7 -0
  4. package/MIGRATION_GUIDE.md +3 -0
  5. package/README.md +1784 -0
  6. package/dist/axios.js +4471 -0
  7. package/dist/axios.js.map +1 -0
  8. package/dist/axios.min.js +3 -0
  9. package/dist/axios.min.js.map +1 -0
  10. package/dist/browser/axios.cjs +3909 -0
  11. package/dist/browser/axios.cjs.map +1 -0
  12. package/dist/esm/axios.js +3932 -0
  13. package/dist/esm/axios.js.map +1 -0
  14. package/dist/esm/axios.min.js +3 -0
  15. package/dist/esm/axios.min.js.map +1 -0
  16. package/dist/node/axios.cjs +5242 -0
  17. package/dist/node/axios.cjs.map +1 -0
  18. package/index.d.cts +572 -0
  19. package/index.d.ts +585 -0
  20. package/index.js +43 -0
  21. package/lib/adapters/README.md +37 -0
  22. package/lib/adapters/adapters.js +126 -0
  23. package/lib/adapters/fetch.js +288 -0
  24. package/lib/adapters/http.js +895 -0
  25. package/lib/adapters/xhr.js +200 -0
  26. package/lib/axios.js +89 -0
  27. package/lib/cancel/CancelToken.js +135 -0
  28. package/lib/cancel/CanceledError.js +25 -0
  29. package/lib/cancel/isCancel.js +5 -0
  30. package/lib/core/Axios.js +240 -0
  31. package/lib/core/AxiosError.js +110 -0
  32. package/lib/core/AxiosHeaders.js +314 -0
  33. package/lib/core/InterceptorManager.js +71 -0
  34. package/lib/core/README.md +8 -0
  35. package/lib/core/buildFullPath.js +22 -0
  36. package/lib/core/dispatchRequest.js +81 -0
  37. package/lib/core/mergeConfig.js +106 -0
  38. package/lib/core/settle.js +27 -0
  39. package/lib/core/transformData.js +28 -0
  40. package/lib/defaults/index.js +161 -0
  41. package/lib/defaults/transitional.js +7 -0
  42. package/lib/env/README.md +3 -0
  43. package/lib/env/classes/FormData.js +2 -0
  44. package/lib/env/data.js +1 -0
  45. package/lib/helpers/AxiosTransformStream.js +143 -0
  46. package/lib/helpers/AxiosURLSearchParams.js +58 -0
  47. package/lib/helpers/HttpStatusCode.js +77 -0
  48. package/lib/helpers/README.md +7 -0
  49. package/lib/helpers/ZlibHeaderTransformStream.js +28 -0
  50. package/lib/helpers/bind.js +14 -0
  51. package/lib/helpers/buildURL.js +67 -0
  52. package/lib/helpers/callbackify.js +16 -0
  53. package/lib/helpers/combineURLs.js +15 -0
  54. package/lib/helpers/composeSignals.js +48 -0
  55. package/lib/helpers/cookies.js +53 -0
  56. package/lib/helpers/deprecatedMethod.js +26 -0
  57. package/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
  58. package/lib/helpers/formDataToJSON.js +95 -0
  59. package/lib/helpers/formDataToStream.js +112 -0
  60. package/lib/helpers/fromDataURI.js +53 -0
  61. package/lib/helpers/isAbsoluteURL.js +15 -0
  62. package/lib/helpers/isAxiosError.js +14 -0
  63. package/lib/helpers/isURLSameOrigin.js +14 -0
  64. package/lib/helpers/null.js +2 -0
  65. package/lib/helpers/parseHeaders.js +55 -0
  66. package/lib/helpers/parseProtocol.js +6 -0
  67. package/lib/helpers/progressEventReducer.js +44 -0
  68. package/lib/helpers/readBlob.js +15 -0
  69. package/lib/helpers/resolveConfig.js +61 -0
  70. package/lib/helpers/speedometer.js +55 -0
  71. package/lib/helpers/spread.js +28 -0
  72. package/lib/helpers/throttle.js +44 -0
  73. package/lib/helpers/toFormData.js +223 -0
  74. package/lib/helpers/toURLEncodedForm.js +19 -0
  75. package/lib/helpers/trackStream.js +87 -0
  76. package/lib/helpers/validator.js +99 -0
  77. package/lib/platform/browser/classes/Blob.js +3 -0
  78. package/lib/platform/browser/classes/FormData.js +3 -0
  79. package/lib/platform/browser/classes/URLSearchParams.js +4 -0
  80. package/lib/platform/browser/index.js +13 -0
  81. package/lib/platform/common/utils.js +51 -0
  82. package/lib/platform/index.js +7 -0
  83. package/lib/platform/node/classes/FormData.js +3 -0
  84. package/lib/platform/node/classes/URLSearchParams.js +4 -0
  85. package/lib/platform/node/index.js +38 -0
  86. package/lib/utils.js +782 -0
  87. package/package.json +237 -0
@@ -0,0 +1,3909 @@
1
+ /*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors */
2
+ 'use strict';
3
+
4
+ /**
5
+ * Create a bound version of a function with a specified `this` context
6
+ *
7
+ * @param {Function} fn - The function to bind
8
+ * @param {*} thisArg - The value to be passed as the `this` parameter
9
+ * @returns {Function} A new function that will call the original function with the specified `this` context
10
+ */
11
+ function bind(fn, thisArg) {
12
+ return function wrap() {
13
+ return fn.apply(thisArg, arguments);
14
+ };
15
+ }
16
+
17
+ // utils is a library of generic helper functions non-specific to axios
18
+
19
+ const {toString} = Object.prototype;
20
+ const {getPrototypeOf} = Object;
21
+ const {iterator, toStringTag} = Symbol;
22
+
23
+ const kindOf = (cache => thing => {
24
+ const str = toString.call(thing);
25
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
26
+ })(Object.create(null));
27
+
28
+ const kindOfTest = (type) => {
29
+ type = type.toLowerCase();
30
+ return (thing) => kindOf(thing) === type
31
+ };
32
+
33
+ const typeOfTest = type => thing => typeof thing === type;
34
+
35
+ /**
36
+ * Determine if a value is an Array
37
+ *
38
+ * @param {Object} val The value to test
39
+ *
40
+ * @returns {boolean} True if value is an Array, otherwise false
41
+ */
42
+ const {isArray} = Array;
43
+
44
+ /**
45
+ * Determine if a value is undefined
46
+ *
47
+ * @param {*} val The value to test
48
+ *
49
+ * @returns {boolean} True if the value is undefined, otherwise false
50
+ */
51
+ const isUndefined = typeOfTest('undefined');
52
+
53
+ /**
54
+ * Determine if a value is a Buffer
55
+ *
56
+ * @param {*} val The value to test
57
+ *
58
+ * @returns {boolean} True if value is a Buffer, otherwise false
59
+ */
60
+ function isBuffer(val) {
61
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
62
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
63
+ }
64
+
65
+ /**
66
+ * Determine if a value is an ArrayBuffer
67
+ *
68
+ * @param {*} val The value to test
69
+ *
70
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
71
+ */
72
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
73
+
74
+
75
+ /**
76
+ * Determine if a value is a view on an ArrayBuffer
77
+ *
78
+ * @param {*} val The value to test
79
+ *
80
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
81
+ */
82
+ function isArrayBufferView(val) {
83
+ let result;
84
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
85
+ result = ArrayBuffer.isView(val);
86
+ } else {
87
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
88
+ }
89
+ return result;
90
+ }
91
+
92
+ /**
93
+ * Determine if a value is a String
94
+ *
95
+ * @param {*} val The value to test
96
+ *
97
+ * @returns {boolean} True if value is a String, otherwise false
98
+ */
99
+ const isString = typeOfTest('string');
100
+
101
+ /**
102
+ * Determine if a value is a Function
103
+ *
104
+ * @param {*} val The value to test
105
+ * @returns {boolean} True if value is a Function, otherwise false
106
+ */
107
+ const isFunction$1 = typeOfTest('function');
108
+
109
+ /**
110
+ * Determine if a value is a Number
111
+ *
112
+ * @param {*} val The value to test
113
+ *
114
+ * @returns {boolean} True if value is a Number, otherwise false
115
+ */
116
+ const isNumber = typeOfTest('number');
117
+
118
+ /**
119
+ * Determine if a value is an Object
120
+ *
121
+ * @param {*} thing The value to test
122
+ *
123
+ * @returns {boolean} True if value is an Object, otherwise false
124
+ */
125
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
126
+
127
+ /**
128
+ * Determine if a value is a Boolean
129
+ *
130
+ * @param {*} thing The value to test
131
+ * @returns {boolean} True if value is a Boolean, otherwise false
132
+ */
133
+ const isBoolean = thing => thing === true || thing === false;
134
+
135
+ /**
136
+ * Determine if a value is a plain Object
137
+ *
138
+ * @param {*} val The value to test
139
+ *
140
+ * @returns {boolean} True if value is a plain Object, otherwise false
141
+ */
142
+ const isPlainObject = (val) => {
143
+ if (kindOf(val) !== 'object') {
144
+ return false;
145
+ }
146
+
147
+ const prototype = getPrototypeOf(val);
148
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
149
+ };
150
+
151
+ /**
152
+ * Determine if a value is an empty object (safely handles Buffers)
153
+ *
154
+ * @param {*} val The value to test
155
+ *
156
+ * @returns {boolean} True if value is an empty object, otherwise false
157
+ */
158
+ const isEmptyObject = (val) => {
159
+ // Early return for non-objects or Buffers to prevent RangeError
160
+ if (!isObject(val) || isBuffer(val)) {
161
+ return false;
162
+ }
163
+
164
+ try {
165
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
166
+ } catch (e) {
167
+ // Fallback for any other objects that might cause RangeError with Object.keys()
168
+ return false;
169
+ }
170
+ };
171
+
172
+ /**
173
+ * Determine if a value is a Date
174
+ *
175
+ * @param {*} val The value to test
176
+ *
177
+ * @returns {boolean} True if value is a Date, otherwise false
178
+ */
179
+ const isDate = kindOfTest('Date');
180
+
181
+ /**
182
+ * Determine if a value is a File
183
+ *
184
+ * @param {*} val The value to test
185
+ *
186
+ * @returns {boolean} True if value is a File, otherwise false
187
+ */
188
+ const isFile = kindOfTest('File');
189
+
190
+ /**
191
+ * Determine if a value is a Blob
192
+ *
193
+ * @param {*} val The value to test
194
+ *
195
+ * @returns {boolean} True if value is a Blob, otherwise false
196
+ */
197
+ const isBlob = kindOfTest('Blob');
198
+
199
+ /**
200
+ * Determine if a value is a FileList
201
+ *
202
+ * @param {*} val The value to test
203
+ *
204
+ * @returns {boolean} True if value is a File, otherwise false
205
+ */
206
+ const isFileList = kindOfTest('FileList');
207
+
208
+ /**
209
+ * Determine if a value is a Stream
210
+ *
211
+ * @param {*} val The value to test
212
+ *
213
+ * @returns {boolean} True if value is a Stream, otherwise false
214
+ */
215
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
216
+
217
+ /**
218
+ * Determine if a value is a FormData
219
+ *
220
+ * @param {*} thing The value to test
221
+ *
222
+ * @returns {boolean} True if value is an FormData, otherwise false
223
+ */
224
+ const isFormData = (thing) => {
225
+ let kind;
226
+ return thing && (
227
+ (typeof FormData === 'function' && thing instanceof FormData) || (
228
+ isFunction$1(thing.append) && (
229
+ (kind = kindOf(thing)) === 'formdata' ||
230
+ // detect form-data instance
231
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
232
+ )
233
+ )
234
+ )
235
+ };
236
+
237
+ /**
238
+ * Determine if a value is a URLSearchParams object
239
+ *
240
+ * @param {*} val The value to test
241
+ *
242
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
243
+ */
244
+ const isURLSearchParams = kindOfTest('URLSearchParams');
245
+
246
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
247
+
248
+ /**
249
+ * Trim excess whitespace off the beginning and end of a string
250
+ *
251
+ * @param {String} str The String to trim
252
+ *
253
+ * @returns {String} The String freed of excess whitespace
254
+ */
255
+ const trim = (str) => str.trim ?
256
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
257
+
258
+ /**
259
+ * Iterate over an Array or an Object invoking a function for each item.
260
+ *
261
+ * If `obj` is an Array callback will be called passing
262
+ * the value, index, and complete array for each item.
263
+ *
264
+ * If 'obj' is an Object callback will be called passing
265
+ * the value, key, and complete object for each property.
266
+ *
267
+ * @param {Object|Array} obj The object to iterate
268
+ * @param {Function} fn The callback to invoke for each item
269
+ *
270
+ * @param {Boolean} [allOwnKeys = false]
271
+ * @returns {any}
272
+ */
273
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
274
+ // Don't bother if no value provided
275
+ if (obj === null || typeof obj === 'undefined') {
276
+ return;
277
+ }
278
+
279
+ let i;
280
+ let l;
281
+
282
+ // Force an array if not already something iterable
283
+ if (typeof obj !== 'object') {
284
+ /*eslint no-param-reassign:0*/
285
+ obj = [obj];
286
+ }
287
+
288
+ if (isArray(obj)) {
289
+ // Iterate over array values
290
+ for (i = 0, l = obj.length; i < l; i++) {
291
+ fn.call(null, obj[i], i, obj);
292
+ }
293
+ } else {
294
+ // Buffer check
295
+ if (isBuffer(obj)) {
296
+ return;
297
+ }
298
+
299
+ // Iterate over object keys
300
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
301
+ const len = keys.length;
302
+ let key;
303
+
304
+ for (i = 0; i < len; i++) {
305
+ key = keys[i];
306
+ fn.call(null, obj[key], key, obj);
307
+ }
308
+ }
309
+ }
310
+
311
+ function findKey(obj, key) {
312
+ if (isBuffer(obj)){
313
+ return null;
314
+ }
315
+
316
+ key = key.toLowerCase();
317
+ const keys = Object.keys(obj);
318
+ let i = keys.length;
319
+ let _key;
320
+ while (i-- > 0) {
321
+ _key = keys[i];
322
+ if (key === _key.toLowerCase()) {
323
+ return _key;
324
+ }
325
+ }
326
+ return null;
327
+ }
328
+
329
+ const _global = (() => {
330
+ /*eslint no-undef:0*/
331
+ if (typeof globalThis !== "undefined") return globalThis;
332
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
333
+ })();
334
+
335
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
336
+
337
+ /**
338
+ * Accepts varargs expecting each argument to be an object, then
339
+ * immutably merges the properties of each object and returns result.
340
+ *
341
+ * When multiple objects contain the same key the later object in
342
+ * the arguments list will take precedence.
343
+ *
344
+ * Example:
345
+ *
346
+ * ```js
347
+ * var result = merge({foo: 123}, {foo: 456});
348
+ * console.log(result.foo); // outputs 456
349
+ * ```
350
+ *
351
+ * @param {Object} obj1 Object to merge
352
+ *
353
+ * @returns {Object} Result of all merge properties
354
+ */
355
+ function merge(/* obj1, obj2, obj3, ... */) {
356
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
357
+ const result = {};
358
+ const assignValue = (val, key) => {
359
+ const targetKey = caseless && findKey(result, key) || key;
360
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
361
+ result[targetKey] = merge(result[targetKey], val);
362
+ } else if (isPlainObject(val)) {
363
+ result[targetKey] = merge({}, val);
364
+ } else if (isArray(val)) {
365
+ result[targetKey] = val.slice();
366
+ } else if (!skipUndefined || !isUndefined(val)) {
367
+ result[targetKey] = val;
368
+ }
369
+ };
370
+
371
+ for (let i = 0, l = arguments.length; i < l; i++) {
372
+ arguments[i] && forEach(arguments[i], assignValue);
373
+ }
374
+ return result;
375
+ }
376
+
377
+ /**
378
+ * Extends object a by mutably adding to it the properties of object b.
379
+ *
380
+ * @param {Object} a The object to be extended
381
+ * @param {Object} b The object to copy properties from
382
+ * @param {Object} thisArg The object to bind function to
383
+ *
384
+ * @param {Boolean} [allOwnKeys]
385
+ * @returns {Object} The resulting value of object a
386
+ */
387
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
388
+ forEach(b, (val, key) => {
389
+ if (thisArg && isFunction$1(val)) {
390
+ a[key] = bind(val, thisArg);
391
+ } else {
392
+ a[key] = val;
393
+ }
394
+ }, {allOwnKeys});
395
+ return a;
396
+ };
397
+
398
+ /**
399
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
400
+ *
401
+ * @param {string} content with BOM
402
+ *
403
+ * @returns {string} content value without BOM
404
+ */
405
+ const stripBOM = (content) => {
406
+ if (content.charCodeAt(0) === 0xFEFF) {
407
+ content = content.slice(1);
408
+ }
409
+ return content;
410
+ };
411
+
412
+ /**
413
+ * Inherit the prototype methods from one constructor into another
414
+ * @param {function} constructor
415
+ * @param {function} superConstructor
416
+ * @param {object} [props]
417
+ * @param {object} [descriptors]
418
+ *
419
+ * @returns {void}
420
+ */
421
+ const inherits = (constructor, superConstructor, props, descriptors) => {
422
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
423
+ constructor.prototype.constructor = constructor;
424
+ Object.defineProperty(constructor, 'super', {
425
+ value: superConstructor.prototype
426
+ });
427
+ props && Object.assign(constructor.prototype, props);
428
+ };
429
+
430
+ /**
431
+ * Resolve object with deep prototype chain to a flat object
432
+ * @param {Object} sourceObj source object
433
+ * @param {Object} [destObj]
434
+ * @param {Function|Boolean} [filter]
435
+ * @param {Function} [propFilter]
436
+ *
437
+ * @returns {Object}
438
+ */
439
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
440
+ let props;
441
+ let i;
442
+ let prop;
443
+ const merged = {};
444
+
445
+ destObj = destObj || {};
446
+ // eslint-disable-next-line no-eq-null,eqeqeq
447
+ if (sourceObj == null) return destObj;
448
+
449
+ do {
450
+ props = Object.getOwnPropertyNames(sourceObj);
451
+ i = props.length;
452
+ while (i-- > 0) {
453
+ prop = props[i];
454
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
455
+ destObj[prop] = sourceObj[prop];
456
+ merged[prop] = true;
457
+ }
458
+ }
459
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
460
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
461
+
462
+ return destObj;
463
+ };
464
+
465
+ /**
466
+ * Determines whether a string ends with the characters of a specified string
467
+ *
468
+ * @param {String} str
469
+ * @param {String} searchString
470
+ * @param {Number} [position= 0]
471
+ *
472
+ * @returns {boolean}
473
+ */
474
+ const endsWith = (str, searchString, position) => {
475
+ str = String(str);
476
+ if (position === undefined || position > str.length) {
477
+ position = str.length;
478
+ }
479
+ position -= searchString.length;
480
+ const lastIndex = str.indexOf(searchString, position);
481
+ return lastIndex !== -1 && lastIndex === position;
482
+ };
483
+
484
+
485
+ /**
486
+ * Returns new array from array like object or null if failed
487
+ *
488
+ * @param {*} [thing]
489
+ *
490
+ * @returns {?Array}
491
+ */
492
+ const toArray = (thing) => {
493
+ if (!thing) return null;
494
+ if (isArray(thing)) return thing;
495
+ let i = thing.length;
496
+ if (!isNumber(i)) return null;
497
+ const arr = new Array(i);
498
+ while (i-- > 0) {
499
+ arr[i] = thing[i];
500
+ }
501
+ return arr;
502
+ };
503
+
504
+ /**
505
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
506
+ * thing passed in is an instance of Uint8Array
507
+ *
508
+ * @param {TypedArray}
509
+ *
510
+ * @returns {Array}
511
+ */
512
+ // eslint-disable-next-line func-names
513
+ const isTypedArray = (TypedArray => {
514
+ // eslint-disable-next-line func-names
515
+ return thing => {
516
+ return TypedArray && thing instanceof TypedArray;
517
+ };
518
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
519
+
520
+ /**
521
+ * For each entry in the object, call the function with the key and value.
522
+ *
523
+ * @param {Object<any, any>} obj - The object to iterate over.
524
+ * @param {Function} fn - The function to call for each entry.
525
+ *
526
+ * @returns {void}
527
+ */
528
+ const forEachEntry = (obj, fn) => {
529
+ const generator = obj && obj[iterator];
530
+
531
+ const _iterator = generator.call(obj);
532
+
533
+ let result;
534
+
535
+ while ((result = _iterator.next()) && !result.done) {
536
+ const pair = result.value;
537
+ fn.call(obj, pair[0], pair[1]);
538
+ }
539
+ };
540
+
541
+ /**
542
+ * It takes a regular expression and a string, and returns an array of all the matches
543
+ *
544
+ * @param {string} regExp - The regular expression to match against.
545
+ * @param {string} str - The string to search.
546
+ *
547
+ * @returns {Array<boolean>}
548
+ */
549
+ const matchAll = (regExp, str) => {
550
+ let matches;
551
+ const arr = [];
552
+
553
+ while ((matches = regExp.exec(str)) !== null) {
554
+ arr.push(matches);
555
+ }
556
+
557
+ return arr;
558
+ };
559
+
560
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
561
+ const isHTMLForm = kindOfTest('HTMLFormElement');
562
+
563
+ const toCamelCase = str => {
564
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
565
+ function replacer(m, p1, p2) {
566
+ return p1.toUpperCase() + p2;
567
+ }
568
+ );
569
+ };
570
+
571
+ /* Creating a function that will check if an object has a property. */
572
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
573
+
574
+ /**
575
+ * Determine if a value is a RegExp object
576
+ *
577
+ * @param {*} val The value to test
578
+ *
579
+ * @returns {boolean} True if value is a RegExp object, otherwise false
580
+ */
581
+ const isRegExp = kindOfTest('RegExp');
582
+
583
+ const reduceDescriptors = (obj, reducer) => {
584
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
585
+ const reducedDescriptors = {};
586
+
587
+ forEach(descriptors, (descriptor, name) => {
588
+ let ret;
589
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
590
+ reducedDescriptors[name] = ret || descriptor;
591
+ }
592
+ });
593
+
594
+ Object.defineProperties(obj, reducedDescriptors);
595
+ };
596
+
597
+ /**
598
+ * Makes all methods read-only
599
+ * @param {Object} obj
600
+ */
601
+
602
+ const freezeMethods = (obj) => {
603
+ reduceDescriptors(obj, (descriptor, name) => {
604
+ // skip restricted props in strict mode
605
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
606
+ return false;
607
+ }
608
+
609
+ const value = obj[name];
610
+
611
+ if (!isFunction$1(value)) return;
612
+
613
+ descriptor.enumerable = false;
614
+
615
+ if ('writable' in descriptor) {
616
+ descriptor.writable = false;
617
+ return;
618
+ }
619
+
620
+ if (!descriptor.set) {
621
+ descriptor.set = () => {
622
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
623
+ };
624
+ }
625
+ });
626
+ };
627
+
628
+ const toObjectSet = (arrayOrString, delimiter) => {
629
+ const obj = {};
630
+
631
+ const define = (arr) => {
632
+ arr.forEach(value => {
633
+ obj[value] = true;
634
+ });
635
+ };
636
+
637
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
638
+
639
+ return obj;
640
+ };
641
+
642
+ const noop = () => {};
643
+
644
+ const toFiniteNumber = (value, defaultValue) => {
645
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
646
+ };
647
+
648
+
649
+
650
+ /**
651
+ * If the thing is a FormData object, return true, otherwise return false.
652
+ *
653
+ * @param {unknown} thing - The thing to check.
654
+ *
655
+ * @returns {boolean}
656
+ */
657
+ function isSpecCompliantForm(thing) {
658
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
659
+ }
660
+
661
+ const toJSONObject = (obj) => {
662
+ const stack = new Array(10);
663
+
664
+ const visit = (source, i) => {
665
+
666
+ if (isObject(source)) {
667
+ if (stack.indexOf(source) >= 0) {
668
+ return;
669
+ }
670
+
671
+ //Buffer check
672
+ if (isBuffer(source)) {
673
+ return source;
674
+ }
675
+
676
+ if(!('toJSON' in source)) {
677
+ stack[i] = source;
678
+ const target = isArray(source) ? [] : {};
679
+
680
+ forEach(source, (value, key) => {
681
+ const reducedValue = visit(value, i + 1);
682
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
683
+ });
684
+
685
+ stack[i] = undefined;
686
+
687
+ return target;
688
+ }
689
+ }
690
+
691
+ return source;
692
+ };
693
+
694
+ return visit(obj, 0);
695
+ };
696
+
697
+ const isAsyncFn = kindOfTest('AsyncFunction');
698
+
699
+ const isThenable = (thing) =>
700
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
701
+
702
+ // original code
703
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
704
+
705
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
706
+ if (setImmediateSupported) {
707
+ return setImmediate;
708
+ }
709
+
710
+ return postMessageSupported ? ((token, callbacks) => {
711
+ _global.addEventListener("message", ({source, data}) => {
712
+ if (source === _global && data === token) {
713
+ callbacks.length && callbacks.shift()();
714
+ }
715
+ }, false);
716
+
717
+ return (cb) => {
718
+ callbacks.push(cb);
719
+ _global.postMessage(token, "*");
720
+ }
721
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
722
+ })(
723
+ typeof setImmediate === 'function',
724
+ isFunction$1(_global.postMessage)
725
+ );
726
+
727
+ const asap = typeof queueMicrotask !== 'undefined' ?
728
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
729
+
730
+ // *********************
731
+
732
+
733
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
734
+
735
+
736
+ var utils$1 = {
737
+ isArray,
738
+ isArrayBuffer,
739
+ isBuffer,
740
+ isFormData,
741
+ isArrayBufferView,
742
+ isString,
743
+ isNumber,
744
+ isBoolean,
745
+ isObject,
746
+ isPlainObject,
747
+ isEmptyObject,
748
+ isReadableStream,
749
+ isRequest,
750
+ isResponse,
751
+ isHeaders,
752
+ isUndefined,
753
+ isDate,
754
+ isFile,
755
+ isBlob,
756
+ isRegExp,
757
+ isFunction: isFunction$1,
758
+ isStream,
759
+ isURLSearchParams,
760
+ isTypedArray,
761
+ isFileList,
762
+ forEach,
763
+ merge,
764
+ extend,
765
+ trim,
766
+ stripBOM,
767
+ inherits,
768
+ toFlatObject,
769
+ kindOf,
770
+ kindOfTest,
771
+ endsWith,
772
+ toArray,
773
+ forEachEntry,
774
+ matchAll,
775
+ isHTMLForm,
776
+ hasOwnProperty,
777
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
778
+ reduceDescriptors,
779
+ freezeMethods,
780
+ toObjectSet,
781
+ toCamelCase,
782
+ noop,
783
+ toFiniteNumber,
784
+ findKey,
785
+ global: _global,
786
+ isContextDefined,
787
+ isSpecCompliantForm,
788
+ toJSONObject,
789
+ isAsyncFn,
790
+ isThenable,
791
+ setImmediate: _setImmediate,
792
+ asap,
793
+ isIterable
794
+ };
795
+
796
+ /**
797
+ * Create an Error with the specified message, config, error code, request and response.
798
+ *
799
+ * @param {string} message The error message.
800
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
801
+ * @param {Object} [config] The config.
802
+ * @param {Object} [request] The request.
803
+ * @param {Object} [response] The response.
804
+ *
805
+ * @returns {Error} The created error.
806
+ */
807
+ function AxiosError(message, code, config, request, response) {
808
+ Error.call(this);
809
+
810
+ if (Error.captureStackTrace) {
811
+ Error.captureStackTrace(this, this.constructor);
812
+ } else {
813
+ this.stack = (new Error()).stack;
814
+ }
815
+
816
+ this.message = message;
817
+ this.name = 'AxiosError';
818
+ code && (this.code = code);
819
+ config && (this.config = config);
820
+ request && (this.request = request);
821
+ if (response) {
822
+ this.response = response;
823
+ this.status = response.status ? response.status : null;
824
+ }
825
+ }
826
+
827
+ utils$1.inherits(AxiosError, Error, {
828
+ toJSON: function toJSON() {
829
+ return {
830
+ // Standard
831
+ message: this.message,
832
+ name: this.name,
833
+ // Microsoft
834
+ description: this.description,
835
+ number: this.number,
836
+ // Mozilla
837
+ fileName: this.fileName,
838
+ lineNumber: this.lineNumber,
839
+ columnNumber: this.columnNumber,
840
+ stack: this.stack,
841
+ // Axios
842
+ config: utils$1.toJSONObject(this.config),
843
+ code: this.code,
844
+ status: this.status
845
+ };
846
+ }
847
+ });
848
+
849
+ const prototype$1 = AxiosError.prototype;
850
+ const descriptors = {};
851
+
852
+ [
853
+ 'ERR_BAD_OPTION_VALUE',
854
+ 'ERR_BAD_OPTION',
855
+ 'ECONNABORTED',
856
+ 'ETIMEDOUT',
857
+ 'ERR_NETWORK',
858
+ 'ERR_FR_TOO_MANY_REDIRECTS',
859
+ 'ERR_DEPRECATED',
860
+ 'ERR_BAD_RESPONSE',
861
+ 'ERR_BAD_REQUEST',
862
+ 'ERR_CANCELED',
863
+ 'ERR_NOT_SUPPORT',
864
+ 'ERR_INVALID_URL'
865
+ // eslint-disable-next-line func-names
866
+ ].forEach(code => {
867
+ descriptors[code] = {value: code};
868
+ });
869
+
870
+ Object.defineProperties(AxiosError, descriptors);
871
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
872
+
873
+ // eslint-disable-next-line func-names
874
+ AxiosError.from = (error, code, config, request, response, customProps) => {
875
+ const axiosError = Object.create(prototype$1);
876
+
877
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
878
+ return obj !== Error.prototype;
879
+ }, prop => {
880
+ return prop !== 'isAxiosError';
881
+ });
882
+
883
+ const msg = error && error.message ? error.message : 'Error';
884
+
885
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
886
+ const errCode = code == null && error ? error.code : code;
887
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
888
+
889
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
890
+ if (error && axiosError.cause == null) {
891
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
892
+ }
893
+
894
+ axiosError.name = (error && error.name) || 'Error';
895
+
896
+ customProps && Object.assign(axiosError, customProps);
897
+
898
+ return axiosError;
899
+ };
900
+
901
+ // eslint-disable-next-line strict
902
+ var httpAdapter = null;
903
+
904
+ /**
905
+ * Determines if the given thing is a array or js object.
906
+ *
907
+ * @param {string} thing - The object or array to be visited.
908
+ *
909
+ * @returns {boolean}
910
+ */
911
+ function isVisitable(thing) {
912
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
913
+ }
914
+
915
+ /**
916
+ * It removes the brackets from the end of a string
917
+ *
918
+ * @param {string} key - The key of the parameter.
919
+ *
920
+ * @returns {string} the key without the brackets.
921
+ */
922
+ function removeBrackets(key) {
923
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
924
+ }
925
+
926
+ /**
927
+ * It takes a path, a key, and a boolean, and returns a string
928
+ *
929
+ * @param {string} path - The path to the current key.
930
+ * @param {string} key - The key of the current object being iterated over.
931
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
932
+ *
933
+ * @returns {string} The path to the current key.
934
+ */
935
+ function renderKey(path, key, dots) {
936
+ if (!path) return key;
937
+ return path.concat(key).map(function each(token, i) {
938
+ // eslint-disable-next-line no-param-reassign
939
+ token = removeBrackets(token);
940
+ return !dots && i ? '[' + token + ']' : token;
941
+ }).join(dots ? '.' : '');
942
+ }
943
+
944
+ /**
945
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
946
+ *
947
+ * @param {Array<any>} arr - The array to check
948
+ *
949
+ * @returns {boolean}
950
+ */
951
+ function isFlatArray(arr) {
952
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
953
+ }
954
+
955
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
956
+ return /^is[A-Z]/.test(prop);
957
+ });
958
+
959
+ /**
960
+ * Convert a data object to FormData
961
+ *
962
+ * @param {Object} obj
963
+ * @param {?Object} [formData]
964
+ * @param {?Object} [options]
965
+ * @param {Function} [options.visitor]
966
+ * @param {Boolean} [options.metaTokens = true]
967
+ * @param {Boolean} [options.dots = false]
968
+ * @param {?Boolean} [options.indexes = false]
969
+ *
970
+ * @returns {Object}
971
+ **/
972
+
973
+ /**
974
+ * It converts an object into a FormData object
975
+ *
976
+ * @param {Object<any, any>} obj - The object to convert to form data.
977
+ * @param {string} formData - The FormData object to append to.
978
+ * @param {Object<string, any>} options
979
+ *
980
+ * @returns
981
+ */
982
+ function toFormData(obj, formData, options) {
983
+ if (!utils$1.isObject(obj)) {
984
+ throw new TypeError('target must be an object');
985
+ }
986
+
987
+ // eslint-disable-next-line no-param-reassign
988
+ formData = formData || new (FormData)();
989
+
990
+ // eslint-disable-next-line no-param-reassign
991
+ options = utils$1.toFlatObject(options, {
992
+ metaTokens: true,
993
+ dots: false,
994
+ indexes: false
995
+ }, false, function defined(option, source) {
996
+ // eslint-disable-next-line no-eq-null,eqeqeq
997
+ return !utils$1.isUndefined(source[option]);
998
+ });
999
+
1000
+ const metaTokens = options.metaTokens;
1001
+ // eslint-disable-next-line no-use-before-define
1002
+ const visitor = options.visitor || defaultVisitor;
1003
+ const dots = options.dots;
1004
+ const indexes = options.indexes;
1005
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1006
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1007
+
1008
+ if (!utils$1.isFunction(visitor)) {
1009
+ throw new TypeError('visitor must be a function');
1010
+ }
1011
+
1012
+ function convertValue(value) {
1013
+ if (value === null) return '';
1014
+
1015
+ if (utils$1.isDate(value)) {
1016
+ return value.toISOString();
1017
+ }
1018
+
1019
+ if (utils$1.isBoolean(value)) {
1020
+ return value.toString();
1021
+ }
1022
+
1023
+ if (!useBlob && utils$1.isBlob(value)) {
1024
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1025
+ }
1026
+
1027
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1028
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1029
+ }
1030
+
1031
+ return value;
1032
+ }
1033
+
1034
+ /**
1035
+ * Default visitor.
1036
+ *
1037
+ * @param {*} value
1038
+ * @param {String|Number} key
1039
+ * @param {Array<String|Number>} path
1040
+ * @this {FormData}
1041
+ *
1042
+ * @returns {boolean} return true to visit the each prop of the value recursively
1043
+ */
1044
+ function defaultVisitor(value, key, path) {
1045
+ let arr = value;
1046
+
1047
+ if (value && !path && typeof value === 'object') {
1048
+ if (utils$1.endsWith(key, '{}')) {
1049
+ // eslint-disable-next-line no-param-reassign
1050
+ key = metaTokens ? key : key.slice(0, -2);
1051
+ // eslint-disable-next-line no-param-reassign
1052
+ value = JSON.stringify(value);
1053
+ } else if (
1054
+ (utils$1.isArray(value) && isFlatArray(value)) ||
1055
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
1056
+ )) {
1057
+ // eslint-disable-next-line no-param-reassign
1058
+ key = removeBrackets(key);
1059
+
1060
+ arr.forEach(function each(el, index) {
1061
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
1062
+ // eslint-disable-next-line no-nested-ternary
1063
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1064
+ convertValue(el)
1065
+ );
1066
+ });
1067
+ return false;
1068
+ }
1069
+ }
1070
+
1071
+ if (isVisitable(value)) {
1072
+ return true;
1073
+ }
1074
+
1075
+ formData.append(renderKey(path, key, dots), convertValue(value));
1076
+
1077
+ return false;
1078
+ }
1079
+
1080
+ const stack = [];
1081
+
1082
+ const exposedHelpers = Object.assign(predicates, {
1083
+ defaultVisitor,
1084
+ convertValue,
1085
+ isVisitable
1086
+ });
1087
+
1088
+ function build(value, path) {
1089
+ if (utils$1.isUndefined(value)) return;
1090
+
1091
+ if (stack.indexOf(value) !== -1) {
1092
+ throw Error('Circular reference detected in ' + path.join('.'));
1093
+ }
1094
+
1095
+ stack.push(value);
1096
+
1097
+ utils$1.forEach(value, function each(el, key) {
1098
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1099
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1100
+ );
1101
+
1102
+ if (result === true) {
1103
+ build(el, path ? path.concat(key) : [key]);
1104
+ }
1105
+ });
1106
+
1107
+ stack.pop();
1108
+ }
1109
+
1110
+ if (!utils$1.isObject(obj)) {
1111
+ throw new TypeError('data must be an object');
1112
+ }
1113
+
1114
+ build(obj);
1115
+
1116
+ return formData;
1117
+ }
1118
+
1119
+ /**
1120
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1121
+ * their percent-encoded equivalents
1122
+ *
1123
+ * @param {string} str - The string to encode.
1124
+ *
1125
+ * @returns {string} The encoded string.
1126
+ */
1127
+ function encode$1(str) {
1128
+ const charMap = {
1129
+ '!': '%21',
1130
+ "'": '%27',
1131
+ '(': '%28',
1132
+ ')': '%29',
1133
+ '~': '%7E',
1134
+ '%20': '+',
1135
+ '%00': '\x00'
1136
+ };
1137
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1138
+ return charMap[match];
1139
+ });
1140
+ }
1141
+
1142
+ /**
1143
+ * It takes a params object and converts it to a FormData object
1144
+ *
1145
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1146
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1147
+ *
1148
+ * @returns {void}
1149
+ */
1150
+ function AxiosURLSearchParams(params, options) {
1151
+ this._pairs = [];
1152
+
1153
+ params && toFormData(params, this, options);
1154
+ }
1155
+
1156
+ const prototype = AxiosURLSearchParams.prototype;
1157
+
1158
+ prototype.append = function append(name, value) {
1159
+ this._pairs.push([name, value]);
1160
+ };
1161
+
1162
+ prototype.toString = function toString(encoder) {
1163
+ const _encode = encoder ? function(value) {
1164
+ return encoder.call(this, value, encode$1);
1165
+ } : encode$1;
1166
+
1167
+ return this._pairs.map(function each(pair) {
1168
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1169
+ }, '').join('&');
1170
+ };
1171
+
1172
+ /**
1173
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1174
+ * URI encoded counterparts
1175
+ *
1176
+ * @param {string} val The value to be encoded.
1177
+ *
1178
+ * @returns {string} The encoded value.
1179
+ */
1180
+ function encode(val) {
1181
+ return encodeURIComponent(val).
1182
+ replace(/%3A/gi, ':').
1183
+ replace(/%24/g, '$').
1184
+ replace(/%2C/gi, ',').
1185
+ replace(/%20/g, '+');
1186
+ }
1187
+
1188
+ /**
1189
+ * Build a URL by appending params to the end
1190
+ *
1191
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1192
+ * @param {object} [params] The params to be appended
1193
+ * @param {?(object|Function)} options
1194
+ *
1195
+ * @returns {string} The formatted url
1196
+ */
1197
+ function buildURL(url, params, options) {
1198
+ /*eslint no-param-reassign:0*/
1199
+ if (!params) {
1200
+ return url;
1201
+ }
1202
+
1203
+ const _encode = options && options.encode || encode;
1204
+
1205
+ if (utils$1.isFunction(options)) {
1206
+ options = {
1207
+ serialize: options
1208
+ };
1209
+ }
1210
+
1211
+ const serializeFn = options && options.serialize;
1212
+
1213
+ let serializedParams;
1214
+
1215
+ if (serializeFn) {
1216
+ serializedParams = serializeFn(params, options);
1217
+ } else {
1218
+ serializedParams = utils$1.isURLSearchParams(params) ?
1219
+ params.toString() :
1220
+ new AxiosURLSearchParams(params, options).toString(_encode);
1221
+ }
1222
+
1223
+ if (serializedParams) {
1224
+ const hashmarkIndex = url.indexOf("#");
1225
+
1226
+ if (hashmarkIndex !== -1) {
1227
+ url = url.slice(0, hashmarkIndex);
1228
+ }
1229
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1230
+ }
1231
+
1232
+ return url;
1233
+ }
1234
+
1235
+ class InterceptorManager {
1236
+ constructor() {
1237
+ this.handlers = [];
1238
+ }
1239
+
1240
+ /**
1241
+ * Add a new interceptor to the stack
1242
+ *
1243
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1244
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1245
+ *
1246
+ * @return {Number} An ID used to remove interceptor later
1247
+ */
1248
+ use(fulfilled, rejected, options) {
1249
+ this.handlers.push({
1250
+ fulfilled,
1251
+ rejected,
1252
+ synchronous: options ? options.synchronous : false,
1253
+ runWhen: options ? options.runWhen : null
1254
+ });
1255
+ return this.handlers.length - 1;
1256
+ }
1257
+
1258
+ /**
1259
+ * Remove an interceptor from the stack
1260
+ *
1261
+ * @param {Number} id The ID that was returned by `use`
1262
+ *
1263
+ * @returns {void}
1264
+ */
1265
+ eject(id) {
1266
+ if (this.handlers[id]) {
1267
+ this.handlers[id] = null;
1268
+ }
1269
+ }
1270
+
1271
+ /**
1272
+ * Clear all interceptors from the stack
1273
+ *
1274
+ * @returns {void}
1275
+ */
1276
+ clear() {
1277
+ if (this.handlers) {
1278
+ this.handlers = [];
1279
+ }
1280
+ }
1281
+
1282
+ /**
1283
+ * Iterate over all the registered interceptors
1284
+ *
1285
+ * This method is particularly useful for skipping over any
1286
+ * interceptors that may have become `null` calling `eject`.
1287
+ *
1288
+ * @param {Function} fn The function to call for each interceptor
1289
+ *
1290
+ * @returns {void}
1291
+ */
1292
+ forEach(fn) {
1293
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1294
+ if (h !== null) {
1295
+ fn(h);
1296
+ }
1297
+ });
1298
+ }
1299
+ }
1300
+
1301
+ var InterceptorManager$1 = InterceptorManager;
1302
+
1303
+ var transitionalDefaults = {
1304
+ silentJSONParsing: true,
1305
+ forcedJSONParsing: true,
1306
+ clarifyTimeoutError: false
1307
+ };
1308
+
1309
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1310
+
1311
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1312
+
1313
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1314
+
1315
+ var platform$1 = {
1316
+ isBrowser: true,
1317
+ classes: {
1318
+ URLSearchParams: URLSearchParams$1,
1319
+ FormData: FormData$1,
1320
+ Blob: Blob$1
1321
+ },
1322
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1323
+ };
1324
+
1325
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1326
+
1327
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
1328
+
1329
+ /**
1330
+ * Determine if we're running in a standard browser environment
1331
+ *
1332
+ * This allows axios to run in a web worker, and react-native.
1333
+ * Both environments support XMLHttpRequest, but not fully standard globals.
1334
+ *
1335
+ * web workers:
1336
+ * typeof window -> undefined
1337
+ * typeof document -> undefined
1338
+ *
1339
+ * react-native:
1340
+ * navigator.product -> 'ReactNative'
1341
+ * nativescript
1342
+ * navigator.product -> 'NativeScript' or 'NS'
1343
+ *
1344
+ * @returns {boolean}
1345
+ */
1346
+ const hasStandardBrowserEnv = hasBrowserEnv &&
1347
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1348
+
1349
+ /**
1350
+ * Determine if we're running in a standard browser webWorker environment
1351
+ *
1352
+ * Although the `isStandardBrowserEnv` method indicates that
1353
+ * `allows axios to run in a web worker`, the WebWorker will still be
1354
+ * filtered out due to its judgment standard
1355
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1356
+ * This leads to a problem when axios post `FormData` in webWorker
1357
+ */
1358
+ const hasStandardBrowserWebWorkerEnv = (() => {
1359
+ return (
1360
+ typeof WorkerGlobalScope !== 'undefined' &&
1361
+ // eslint-disable-next-line no-undef
1362
+ self instanceof WorkerGlobalScope &&
1363
+ typeof self.importScripts === 'function'
1364
+ );
1365
+ })();
1366
+
1367
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1368
+
1369
+ var utils = /*#__PURE__*/Object.freeze({
1370
+ __proto__: null,
1371
+ hasBrowserEnv: hasBrowserEnv,
1372
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1373
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1374
+ navigator: _navigator,
1375
+ origin: origin
1376
+ });
1377
+
1378
+ var platform = {
1379
+ ...utils,
1380
+ ...platform$1
1381
+ };
1382
+
1383
+ function toURLEncodedForm(data, options) {
1384
+ return toFormData(data, new platform.classes.URLSearchParams(), {
1385
+ visitor: function(value, key, path, helpers) {
1386
+ if (platform.isNode && utils$1.isBuffer(value)) {
1387
+ this.append(key, value.toString('base64'));
1388
+ return false;
1389
+ }
1390
+
1391
+ return helpers.defaultVisitor.apply(this, arguments);
1392
+ },
1393
+ ...options
1394
+ });
1395
+ }
1396
+
1397
+ /**
1398
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1399
+ *
1400
+ * @param {string} name - The name of the property to get.
1401
+ *
1402
+ * @returns An array of strings.
1403
+ */
1404
+ function parsePropPath(name) {
1405
+ // foo[x][y][z]
1406
+ // foo.x.y.z
1407
+ // foo-x-y-z
1408
+ // foo x y z
1409
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1410
+ return match[0] === '[]' ? '' : match[1] || match[0];
1411
+ });
1412
+ }
1413
+
1414
+ /**
1415
+ * Convert an array to an object.
1416
+ *
1417
+ * @param {Array<any>} arr - The array to convert to an object.
1418
+ *
1419
+ * @returns An object with the same keys and values as the array.
1420
+ */
1421
+ function arrayToObject(arr) {
1422
+ const obj = {};
1423
+ const keys = Object.keys(arr);
1424
+ let i;
1425
+ const len = keys.length;
1426
+ let key;
1427
+ for (i = 0; i < len; i++) {
1428
+ key = keys[i];
1429
+ obj[key] = arr[key];
1430
+ }
1431
+ return obj;
1432
+ }
1433
+
1434
+ /**
1435
+ * It takes a FormData object and returns a JavaScript object
1436
+ *
1437
+ * @param {string} formData The FormData object to convert to JSON.
1438
+ *
1439
+ * @returns {Object<string, any> | null} The converted object.
1440
+ */
1441
+ function formDataToJSON(formData) {
1442
+ function buildPath(path, value, target, index) {
1443
+ let name = path[index++];
1444
+
1445
+ if (name === '__proto__') return true;
1446
+
1447
+ const isNumericKey = Number.isFinite(+name);
1448
+ const isLast = index >= path.length;
1449
+ name = !name && utils$1.isArray(target) ? target.length : name;
1450
+
1451
+ if (isLast) {
1452
+ if (utils$1.hasOwnProp(target, name)) {
1453
+ target[name] = [target[name], value];
1454
+ } else {
1455
+ target[name] = value;
1456
+ }
1457
+
1458
+ return !isNumericKey;
1459
+ }
1460
+
1461
+ if (!target[name] || !utils$1.isObject(target[name])) {
1462
+ target[name] = [];
1463
+ }
1464
+
1465
+ const result = buildPath(path, value, target[name], index);
1466
+
1467
+ if (result && utils$1.isArray(target[name])) {
1468
+ target[name] = arrayToObject(target[name]);
1469
+ }
1470
+
1471
+ return !isNumericKey;
1472
+ }
1473
+
1474
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1475
+ const obj = {};
1476
+
1477
+ utils$1.forEachEntry(formData, (name, value) => {
1478
+ buildPath(parsePropPath(name), value, obj, 0);
1479
+ });
1480
+
1481
+ return obj;
1482
+ }
1483
+
1484
+ return null;
1485
+ }
1486
+
1487
+ /**
1488
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1489
+ * of the input
1490
+ *
1491
+ * @param {any} rawValue - The value to be stringified.
1492
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1493
+ * @param {Function} encoder - A function that takes a value and returns a string.
1494
+ *
1495
+ * @returns {string} A stringified version of the rawValue.
1496
+ */
1497
+ function stringifySafely(rawValue, parser, encoder) {
1498
+ if (utils$1.isString(rawValue)) {
1499
+ try {
1500
+ (parser || JSON.parse)(rawValue);
1501
+ return utils$1.trim(rawValue);
1502
+ } catch (e) {
1503
+ if (e.name !== 'SyntaxError') {
1504
+ throw e;
1505
+ }
1506
+ }
1507
+ }
1508
+
1509
+ return (encoder || JSON.stringify)(rawValue);
1510
+ }
1511
+
1512
+ const defaults = {
1513
+
1514
+ transitional: transitionalDefaults,
1515
+
1516
+ adapter: ['xhr', 'http', 'fetch'],
1517
+
1518
+ transformRequest: [function transformRequest(data, headers) {
1519
+ const contentType = headers.getContentType() || '';
1520
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1521
+ const isObjectPayload = utils$1.isObject(data);
1522
+
1523
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1524
+ data = new FormData(data);
1525
+ }
1526
+
1527
+ const isFormData = utils$1.isFormData(data);
1528
+
1529
+ if (isFormData) {
1530
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1531
+ }
1532
+
1533
+ if (utils$1.isArrayBuffer(data) ||
1534
+ utils$1.isBuffer(data) ||
1535
+ utils$1.isStream(data) ||
1536
+ utils$1.isFile(data) ||
1537
+ utils$1.isBlob(data) ||
1538
+ utils$1.isReadableStream(data)
1539
+ ) {
1540
+ return data;
1541
+ }
1542
+ if (utils$1.isArrayBufferView(data)) {
1543
+ return data.buffer;
1544
+ }
1545
+ if (utils$1.isURLSearchParams(data)) {
1546
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1547
+ return data.toString();
1548
+ }
1549
+
1550
+ let isFileList;
1551
+
1552
+ if (isObjectPayload) {
1553
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1554
+ return toURLEncodedForm(data, this.formSerializer).toString();
1555
+ }
1556
+
1557
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1558
+ const _FormData = this.env && this.env.FormData;
1559
+
1560
+ return toFormData(
1561
+ isFileList ? {'files[]': data} : data,
1562
+ _FormData && new _FormData(),
1563
+ this.formSerializer
1564
+ );
1565
+ }
1566
+ }
1567
+
1568
+ if (isObjectPayload || hasJSONContentType ) {
1569
+ headers.setContentType('application/json', false);
1570
+ return stringifySafely(data);
1571
+ }
1572
+
1573
+ return data;
1574
+ }],
1575
+
1576
+ transformResponse: [function transformResponse(data) {
1577
+ const transitional = this.transitional || defaults.transitional;
1578
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1579
+ const JSONRequested = this.responseType === 'json';
1580
+
1581
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1582
+ return data;
1583
+ }
1584
+
1585
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1586
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1587
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1588
+
1589
+ try {
1590
+ return JSON.parse(data, this.parseReviver);
1591
+ } catch (e) {
1592
+ if (strictJSONParsing) {
1593
+ if (e.name === 'SyntaxError') {
1594
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1595
+ }
1596
+ throw e;
1597
+ }
1598
+ }
1599
+ }
1600
+
1601
+ return data;
1602
+ }],
1603
+
1604
+ /**
1605
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1606
+ * timeout is not created.
1607
+ */
1608
+ timeout: 0,
1609
+
1610
+ xsrfCookieName: 'XSRF-TOKEN',
1611
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1612
+
1613
+ maxContentLength: -1,
1614
+ maxBodyLength: -1,
1615
+
1616
+ env: {
1617
+ FormData: platform.classes.FormData,
1618
+ Blob: platform.classes.Blob
1619
+ },
1620
+
1621
+ validateStatus: function validateStatus(status) {
1622
+ return status >= 200 && status < 300;
1623
+ },
1624
+
1625
+ headers: {
1626
+ common: {
1627
+ 'Accept': 'application/json, text/plain, */*',
1628
+ 'Content-Type': undefined
1629
+ }
1630
+ }
1631
+ };
1632
+
1633
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1634
+ defaults.headers[method] = {};
1635
+ });
1636
+
1637
+ var defaults$1 = defaults;
1638
+
1639
+ // RawAxiosHeaders whose duplicates are ignored by node
1640
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1641
+ const ignoreDuplicateOf = utils$1.toObjectSet([
1642
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1643
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1644
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1645
+ 'referer', 'retry-after', 'user-agent'
1646
+ ]);
1647
+
1648
+ /**
1649
+ * Parse headers into an object
1650
+ *
1651
+ * ```
1652
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1653
+ * Content-Type: application/json
1654
+ * Connection: keep-alive
1655
+ * Transfer-Encoding: chunked
1656
+ * ```
1657
+ *
1658
+ * @param {String} rawHeaders Headers needing to be parsed
1659
+ *
1660
+ * @returns {Object} Headers parsed into an object
1661
+ */
1662
+ var parseHeaders = rawHeaders => {
1663
+ const parsed = {};
1664
+ let key;
1665
+ let val;
1666
+ let i;
1667
+
1668
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1669
+ i = line.indexOf(':');
1670
+ key = line.substring(0, i).trim().toLowerCase();
1671
+ val = line.substring(i + 1).trim();
1672
+
1673
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1674
+ return;
1675
+ }
1676
+
1677
+ if (key === 'set-cookie') {
1678
+ if (parsed[key]) {
1679
+ parsed[key].push(val);
1680
+ } else {
1681
+ parsed[key] = [val];
1682
+ }
1683
+ } else {
1684
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1685
+ }
1686
+ });
1687
+
1688
+ return parsed;
1689
+ };
1690
+
1691
+ const $internals = Symbol('internals');
1692
+
1693
+ function normalizeHeader(header) {
1694
+ return header && String(header).trim().toLowerCase();
1695
+ }
1696
+
1697
+ function normalizeValue(value) {
1698
+ if (value === false || value == null) {
1699
+ return value;
1700
+ }
1701
+
1702
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1703
+ }
1704
+
1705
+ function parseTokens(str) {
1706
+ const tokens = Object.create(null);
1707
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1708
+ let match;
1709
+
1710
+ while ((match = tokensRE.exec(str))) {
1711
+ tokens[match[1]] = match[2];
1712
+ }
1713
+
1714
+ return tokens;
1715
+ }
1716
+
1717
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1718
+
1719
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1720
+ if (utils$1.isFunction(filter)) {
1721
+ return filter.call(this, value, header);
1722
+ }
1723
+
1724
+ if (isHeaderNameFilter) {
1725
+ value = header;
1726
+ }
1727
+
1728
+ if (!utils$1.isString(value)) return;
1729
+
1730
+ if (utils$1.isString(filter)) {
1731
+ return value.indexOf(filter) !== -1;
1732
+ }
1733
+
1734
+ if (utils$1.isRegExp(filter)) {
1735
+ return filter.test(value);
1736
+ }
1737
+ }
1738
+
1739
+ function formatHeader(header) {
1740
+ return header.trim()
1741
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1742
+ return char.toUpperCase() + str;
1743
+ });
1744
+ }
1745
+
1746
+ function buildAccessors(obj, header) {
1747
+ const accessorName = utils$1.toCamelCase(' ' + header);
1748
+
1749
+ ['get', 'set', 'has'].forEach(methodName => {
1750
+ Object.defineProperty(obj, methodName + accessorName, {
1751
+ value: function(arg1, arg2, arg3) {
1752
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1753
+ },
1754
+ configurable: true
1755
+ });
1756
+ });
1757
+ }
1758
+
1759
+ class AxiosHeaders {
1760
+ constructor(headers) {
1761
+ headers && this.set(headers);
1762
+ }
1763
+
1764
+ set(header, valueOrRewrite, rewrite) {
1765
+ const self = this;
1766
+
1767
+ function setHeader(_value, _header, _rewrite) {
1768
+ const lHeader = normalizeHeader(_header);
1769
+
1770
+ if (!lHeader) {
1771
+ throw new Error('header name must be a non-empty string');
1772
+ }
1773
+
1774
+ const key = utils$1.findKey(self, lHeader);
1775
+
1776
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1777
+ self[key || _header] = normalizeValue(_value);
1778
+ }
1779
+ }
1780
+
1781
+ const setHeaders = (headers, _rewrite) =>
1782
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1783
+
1784
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1785
+ setHeaders(header, valueOrRewrite);
1786
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1787
+ setHeaders(parseHeaders(header), valueOrRewrite);
1788
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1789
+ let obj = {}, dest, key;
1790
+ for (const entry of header) {
1791
+ if (!utils$1.isArray(entry)) {
1792
+ throw TypeError('Object iterator must return a key-value pair');
1793
+ }
1794
+
1795
+ obj[key = entry[0]] = (dest = obj[key]) ?
1796
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1797
+ }
1798
+
1799
+ setHeaders(obj, valueOrRewrite);
1800
+ } else {
1801
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1802
+ }
1803
+
1804
+ return this;
1805
+ }
1806
+
1807
+ get(header, parser) {
1808
+ header = normalizeHeader(header);
1809
+
1810
+ if (header) {
1811
+ const key = utils$1.findKey(this, header);
1812
+
1813
+ if (key) {
1814
+ const value = this[key];
1815
+
1816
+ if (!parser) {
1817
+ return value;
1818
+ }
1819
+
1820
+ if (parser === true) {
1821
+ return parseTokens(value);
1822
+ }
1823
+
1824
+ if (utils$1.isFunction(parser)) {
1825
+ return parser.call(this, value, key);
1826
+ }
1827
+
1828
+ if (utils$1.isRegExp(parser)) {
1829
+ return parser.exec(value);
1830
+ }
1831
+
1832
+ throw new TypeError('parser must be boolean|regexp|function');
1833
+ }
1834
+ }
1835
+ }
1836
+
1837
+ has(header, matcher) {
1838
+ header = normalizeHeader(header);
1839
+
1840
+ if (header) {
1841
+ const key = utils$1.findKey(this, header);
1842
+
1843
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1844
+ }
1845
+
1846
+ return false;
1847
+ }
1848
+
1849
+ delete(header, matcher) {
1850
+ const self = this;
1851
+ let deleted = false;
1852
+
1853
+ function deleteHeader(_header) {
1854
+ _header = normalizeHeader(_header);
1855
+
1856
+ if (_header) {
1857
+ const key = utils$1.findKey(self, _header);
1858
+
1859
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1860
+ delete self[key];
1861
+
1862
+ deleted = true;
1863
+ }
1864
+ }
1865
+ }
1866
+
1867
+ if (utils$1.isArray(header)) {
1868
+ header.forEach(deleteHeader);
1869
+ } else {
1870
+ deleteHeader(header);
1871
+ }
1872
+
1873
+ return deleted;
1874
+ }
1875
+
1876
+ clear(matcher) {
1877
+ const keys = Object.keys(this);
1878
+ let i = keys.length;
1879
+ let deleted = false;
1880
+
1881
+ while (i--) {
1882
+ const key = keys[i];
1883
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1884
+ delete this[key];
1885
+ deleted = true;
1886
+ }
1887
+ }
1888
+
1889
+ return deleted;
1890
+ }
1891
+
1892
+ normalize(format) {
1893
+ const self = this;
1894
+ const headers = {};
1895
+
1896
+ utils$1.forEach(this, (value, header) => {
1897
+ const key = utils$1.findKey(headers, header);
1898
+
1899
+ if (key) {
1900
+ self[key] = normalizeValue(value);
1901
+ delete self[header];
1902
+ return;
1903
+ }
1904
+
1905
+ const normalized = format ? formatHeader(header) : String(header).trim();
1906
+
1907
+ if (normalized !== header) {
1908
+ delete self[header];
1909
+ }
1910
+
1911
+ self[normalized] = normalizeValue(value);
1912
+
1913
+ headers[normalized] = true;
1914
+ });
1915
+
1916
+ return this;
1917
+ }
1918
+
1919
+ concat(...targets) {
1920
+ return this.constructor.concat(this, ...targets);
1921
+ }
1922
+
1923
+ toJSON(asStrings) {
1924
+ const obj = Object.create(null);
1925
+
1926
+ utils$1.forEach(this, (value, header) => {
1927
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1928
+ });
1929
+
1930
+ return obj;
1931
+ }
1932
+
1933
+ [Symbol.iterator]() {
1934
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1935
+ }
1936
+
1937
+ toString() {
1938
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1939
+ }
1940
+
1941
+ getSetCookie() {
1942
+ return this.get("set-cookie") || [];
1943
+ }
1944
+
1945
+ get [Symbol.toStringTag]() {
1946
+ return 'AxiosHeaders';
1947
+ }
1948
+
1949
+ static from(thing) {
1950
+ return thing instanceof this ? thing : new this(thing);
1951
+ }
1952
+
1953
+ static concat(first, ...targets) {
1954
+ const computed = new this(first);
1955
+
1956
+ targets.forEach((target) => computed.set(target));
1957
+
1958
+ return computed;
1959
+ }
1960
+
1961
+ static accessor(header) {
1962
+ const internals = this[$internals] = (this[$internals] = {
1963
+ accessors: {}
1964
+ });
1965
+
1966
+ const accessors = internals.accessors;
1967
+ const prototype = this.prototype;
1968
+
1969
+ function defineAccessor(_header) {
1970
+ const lHeader = normalizeHeader(_header);
1971
+
1972
+ if (!accessors[lHeader]) {
1973
+ buildAccessors(prototype, _header);
1974
+ accessors[lHeader] = true;
1975
+ }
1976
+ }
1977
+
1978
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1979
+
1980
+ return this;
1981
+ }
1982
+ }
1983
+
1984
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1985
+
1986
+ // reserved names hotfix
1987
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
1988
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1989
+ return {
1990
+ get: () => value,
1991
+ set(headerValue) {
1992
+ this[mapped] = headerValue;
1993
+ }
1994
+ }
1995
+ });
1996
+
1997
+ utils$1.freezeMethods(AxiosHeaders);
1998
+
1999
+ var AxiosHeaders$1 = AxiosHeaders;
2000
+
2001
+ /**
2002
+ * Transform the data for a request or a response
2003
+ *
2004
+ * @param {Array|Function} fns A single function or Array of functions
2005
+ * @param {?Object} response The response object
2006
+ *
2007
+ * @returns {*} The resulting transformed data
2008
+ */
2009
+ function transformData(fns, response) {
2010
+ const config = this || defaults$1;
2011
+ const context = response || config;
2012
+ const headers = AxiosHeaders$1.from(context.headers);
2013
+ let data = context.data;
2014
+
2015
+ utils$1.forEach(fns, function transform(fn) {
2016
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2017
+ });
2018
+
2019
+ headers.normalize();
2020
+
2021
+ return data;
2022
+ }
2023
+
2024
+ function isCancel(value) {
2025
+ return !!(value && value.__CANCEL__);
2026
+ }
2027
+
2028
+ /**
2029
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
2030
+ *
2031
+ * @param {string=} message The message.
2032
+ * @param {Object=} config The config.
2033
+ * @param {Object=} request The request.
2034
+ *
2035
+ * @returns {CanceledError} The created error.
2036
+ */
2037
+ function CanceledError(message, config, request) {
2038
+ // eslint-disable-next-line no-eq-null,eqeqeq
2039
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
2040
+ this.name = 'CanceledError';
2041
+ }
2042
+
2043
+ utils$1.inherits(CanceledError, AxiosError, {
2044
+ __CANCEL__: true
2045
+ });
2046
+
2047
+ /**
2048
+ * Resolve or reject a Promise based on response status.
2049
+ *
2050
+ * @param {Function} resolve A function that resolves the promise.
2051
+ * @param {Function} reject A function that rejects the promise.
2052
+ * @param {object} response The response.
2053
+ *
2054
+ * @returns {object} The response.
2055
+ */
2056
+ function settle(resolve, reject, response) {
2057
+ const validateStatus = response.config.validateStatus;
2058
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
2059
+ resolve(response);
2060
+ } else {
2061
+ reject(new AxiosError(
2062
+ 'Request failed with status code ' + response.status,
2063
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2064
+ response.config,
2065
+ response.request,
2066
+ response
2067
+ ));
2068
+ }
2069
+ }
2070
+
2071
+ function parseProtocol(url) {
2072
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2073
+ return match && match[1] || '';
2074
+ }
2075
+
2076
+ /**
2077
+ * Calculate data maxRate
2078
+ * @param {Number} [samplesCount= 10]
2079
+ * @param {Number} [min= 1000]
2080
+ * @returns {Function}
2081
+ */
2082
+ function speedometer(samplesCount, min) {
2083
+ samplesCount = samplesCount || 10;
2084
+ const bytes = new Array(samplesCount);
2085
+ const timestamps = new Array(samplesCount);
2086
+ let head = 0;
2087
+ let tail = 0;
2088
+ let firstSampleTS;
2089
+
2090
+ min = min !== undefined ? min : 1000;
2091
+
2092
+ return function push(chunkLength) {
2093
+ const now = Date.now();
2094
+
2095
+ const startedAt = timestamps[tail];
2096
+
2097
+ if (!firstSampleTS) {
2098
+ firstSampleTS = now;
2099
+ }
2100
+
2101
+ bytes[head] = chunkLength;
2102
+ timestamps[head] = now;
2103
+
2104
+ let i = tail;
2105
+ let bytesCount = 0;
2106
+
2107
+ while (i !== head) {
2108
+ bytesCount += bytes[i++];
2109
+ i = i % samplesCount;
2110
+ }
2111
+
2112
+ head = (head + 1) % samplesCount;
2113
+
2114
+ if (head === tail) {
2115
+ tail = (tail + 1) % samplesCount;
2116
+ }
2117
+
2118
+ if (now - firstSampleTS < min) {
2119
+ return;
2120
+ }
2121
+
2122
+ const passed = startedAt && now - startedAt;
2123
+
2124
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2125
+ };
2126
+ }
2127
+
2128
+ /**
2129
+ * Throttle decorator
2130
+ * @param {Function} fn
2131
+ * @param {Number} freq
2132
+ * @return {Function}
2133
+ */
2134
+ function throttle(fn, freq) {
2135
+ let timestamp = 0;
2136
+ let threshold = 1000 / freq;
2137
+ let lastArgs;
2138
+ let timer;
2139
+
2140
+ const invoke = (args, now = Date.now()) => {
2141
+ timestamp = now;
2142
+ lastArgs = null;
2143
+ if (timer) {
2144
+ clearTimeout(timer);
2145
+ timer = null;
2146
+ }
2147
+ fn(...args);
2148
+ };
2149
+
2150
+ const throttled = (...args) => {
2151
+ const now = Date.now();
2152
+ const passed = now - timestamp;
2153
+ if ( passed >= threshold) {
2154
+ invoke(args, now);
2155
+ } else {
2156
+ lastArgs = args;
2157
+ if (!timer) {
2158
+ timer = setTimeout(() => {
2159
+ timer = null;
2160
+ invoke(lastArgs);
2161
+ }, threshold - passed);
2162
+ }
2163
+ }
2164
+ };
2165
+
2166
+ const flush = () => lastArgs && invoke(lastArgs);
2167
+
2168
+ return [throttled, flush];
2169
+ }
2170
+
2171
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2172
+ let bytesNotified = 0;
2173
+ const _speedometer = speedometer(50, 250);
2174
+
2175
+ return throttle(e => {
2176
+ const loaded = e.loaded;
2177
+ const total = e.lengthComputable ? e.total : undefined;
2178
+ const progressBytes = loaded - bytesNotified;
2179
+ const rate = _speedometer(progressBytes);
2180
+ const inRange = loaded <= total;
2181
+
2182
+ bytesNotified = loaded;
2183
+
2184
+ const data = {
2185
+ loaded,
2186
+ total,
2187
+ progress: total ? (loaded / total) : undefined,
2188
+ bytes: progressBytes,
2189
+ rate: rate ? rate : undefined,
2190
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2191
+ event: e,
2192
+ lengthComputable: total != null,
2193
+ [isDownloadStream ? 'download' : 'upload']: true
2194
+ };
2195
+
2196
+ listener(data);
2197
+ }, freq);
2198
+ };
2199
+
2200
+ const progressEventDecorator = (total, throttled) => {
2201
+ const lengthComputable = total != null;
2202
+
2203
+ return [(loaded) => throttled[0]({
2204
+ lengthComputable,
2205
+ total,
2206
+ loaded
2207
+ }), throttled[1]];
2208
+ };
2209
+
2210
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
2211
+
2212
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
2213
+ url = new URL(url, platform.origin);
2214
+
2215
+ return (
2216
+ origin.protocol === url.protocol &&
2217
+ origin.host === url.host &&
2218
+ (isMSIE || origin.port === url.port)
2219
+ );
2220
+ })(
2221
+ new URL(platform.origin),
2222
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2223
+ ) : () => true;
2224
+
2225
+ var cookies = platform.hasStandardBrowserEnv ?
2226
+
2227
+ // Standard browser envs support document.cookie
2228
+ {
2229
+ write(name, value, expires, path, domain, secure, sameSite) {
2230
+ if (typeof document === 'undefined') return;
2231
+
2232
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
2233
+
2234
+ if (utils$1.isNumber(expires)) {
2235
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
2236
+ }
2237
+ if (utils$1.isString(path)) {
2238
+ cookie.push(`path=${path}`);
2239
+ }
2240
+ if (utils$1.isString(domain)) {
2241
+ cookie.push(`domain=${domain}`);
2242
+ }
2243
+ if (secure === true) {
2244
+ cookie.push('secure');
2245
+ }
2246
+ if (utils$1.isString(sameSite)) {
2247
+ cookie.push(`SameSite=${sameSite}`);
2248
+ }
2249
+
2250
+ document.cookie = cookie.join('; ');
2251
+ },
2252
+
2253
+ read(name) {
2254
+ if (typeof document === 'undefined') return null;
2255
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2256
+ return match ? decodeURIComponent(match[1]) : null;
2257
+ },
2258
+
2259
+ remove(name) {
2260
+ this.write(name, '', Date.now() - 86400000, '/');
2261
+ }
2262
+ }
2263
+
2264
+ :
2265
+
2266
+ // Non-standard browser env (web workers, react-native) lack needed support.
2267
+ {
2268
+ write() {},
2269
+ read() {
2270
+ return null;
2271
+ },
2272
+ remove() {}
2273
+ };
2274
+
2275
+ /**
2276
+ * Determines whether the specified URL is absolute
2277
+ *
2278
+ * @param {string} url The URL to test
2279
+ *
2280
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
2281
+ */
2282
+ function isAbsoluteURL(url) {
2283
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2284
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2285
+ // by any combination of letters, digits, plus, period, or hyphen.
2286
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2287
+ }
2288
+
2289
+ /**
2290
+ * Creates a new URL by combining the specified URLs
2291
+ *
2292
+ * @param {string} baseURL The base URL
2293
+ * @param {string} relativeURL The relative URL
2294
+ *
2295
+ * @returns {string} The combined URL
2296
+ */
2297
+ function combineURLs(baseURL, relativeURL) {
2298
+ return relativeURL
2299
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2300
+ : baseURL;
2301
+ }
2302
+
2303
+ /**
2304
+ * Creates a new URL by combining the baseURL with the requestedURL,
2305
+ * only when the requestedURL is not already an absolute URL.
2306
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
2307
+ *
2308
+ * @param {string} baseURL The base URL
2309
+ * @param {string} requestedURL Absolute or relative URL to combine
2310
+ *
2311
+ * @returns {string} The combined full path
2312
+ */
2313
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2314
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
2315
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2316
+ return combineURLs(baseURL, requestedURL);
2317
+ }
2318
+ return requestedURL;
2319
+ }
2320
+
2321
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2322
+
2323
+ /**
2324
+ * Config-specific merge-function which creates a new config-object
2325
+ * by merging two configuration objects together.
2326
+ *
2327
+ * @param {Object} config1
2328
+ * @param {Object} config2
2329
+ *
2330
+ * @returns {Object} New object resulting from merging config2 to config1
2331
+ */
2332
+ function mergeConfig(config1, config2) {
2333
+ // eslint-disable-next-line no-param-reassign
2334
+ config2 = config2 || {};
2335
+ const config = {};
2336
+
2337
+ function getMergedValue(target, source, prop, caseless) {
2338
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2339
+ return utils$1.merge.call({caseless}, target, source);
2340
+ } else if (utils$1.isPlainObject(source)) {
2341
+ return utils$1.merge({}, source);
2342
+ } else if (utils$1.isArray(source)) {
2343
+ return source.slice();
2344
+ }
2345
+ return source;
2346
+ }
2347
+
2348
+ // eslint-disable-next-line consistent-return
2349
+ function mergeDeepProperties(a, b, prop, caseless) {
2350
+ if (!utils$1.isUndefined(b)) {
2351
+ return getMergedValue(a, b, prop, caseless);
2352
+ } else if (!utils$1.isUndefined(a)) {
2353
+ return getMergedValue(undefined, a, prop, caseless);
2354
+ }
2355
+ }
2356
+
2357
+ // eslint-disable-next-line consistent-return
2358
+ function valueFromConfig2(a, b) {
2359
+ if (!utils$1.isUndefined(b)) {
2360
+ return getMergedValue(undefined, b);
2361
+ }
2362
+ }
2363
+
2364
+ // eslint-disable-next-line consistent-return
2365
+ function defaultToConfig2(a, b) {
2366
+ if (!utils$1.isUndefined(b)) {
2367
+ return getMergedValue(undefined, b);
2368
+ } else if (!utils$1.isUndefined(a)) {
2369
+ return getMergedValue(undefined, a);
2370
+ }
2371
+ }
2372
+
2373
+ // eslint-disable-next-line consistent-return
2374
+ function mergeDirectKeys(a, b, prop) {
2375
+ if (prop in config2) {
2376
+ return getMergedValue(a, b);
2377
+ } else if (prop in config1) {
2378
+ return getMergedValue(undefined, a);
2379
+ }
2380
+ }
2381
+
2382
+ const mergeMap = {
2383
+ url: valueFromConfig2,
2384
+ method: valueFromConfig2,
2385
+ data: valueFromConfig2,
2386
+ baseURL: defaultToConfig2,
2387
+ transformRequest: defaultToConfig2,
2388
+ transformResponse: defaultToConfig2,
2389
+ paramsSerializer: defaultToConfig2,
2390
+ timeout: defaultToConfig2,
2391
+ timeoutMessage: defaultToConfig2,
2392
+ withCredentials: defaultToConfig2,
2393
+ withXSRFToken: defaultToConfig2,
2394
+ adapter: defaultToConfig2,
2395
+ responseType: defaultToConfig2,
2396
+ xsrfCookieName: defaultToConfig2,
2397
+ xsrfHeaderName: defaultToConfig2,
2398
+ onUploadProgress: defaultToConfig2,
2399
+ onDownloadProgress: defaultToConfig2,
2400
+ decompress: defaultToConfig2,
2401
+ maxContentLength: defaultToConfig2,
2402
+ maxBodyLength: defaultToConfig2,
2403
+ beforeRedirect: defaultToConfig2,
2404
+ transport: defaultToConfig2,
2405
+ httpAgent: defaultToConfig2,
2406
+ httpsAgent: defaultToConfig2,
2407
+ cancelToken: defaultToConfig2,
2408
+ socketPath: defaultToConfig2,
2409
+ responseEncoding: defaultToConfig2,
2410
+ validateStatus: mergeDirectKeys,
2411
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
2412
+ };
2413
+
2414
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
2415
+ const merge = mergeMap[prop] || mergeDeepProperties;
2416
+ const configValue = merge(config1[prop], config2[prop], prop);
2417
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2418
+ });
2419
+
2420
+ return config;
2421
+ }
2422
+
2423
+ var resolveConfig = (config) => {
2424
+ const newConfig = mergeConfig({}, config);
2425
+
2426
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
2427
+
2428
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
2429
+
2430
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2431
+
2432
+ // HTTP basic authentication
2433
+ if (auth) {
2434
+ headers.set('Authorization', 'Basic ' +
2435
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
2436
+ );
2437
+ }
2438
+
2439
+ if (utils$1.isFormData(data)) {
2440
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2441
+ headers.setContentType(undefined); // browser handles it
2442
+ } else if (utils$1.isFunction(data.getHeaders)) {
2443
+ // Node.js FormData (like form-data package)
2444
+ const formHeaders = data.getHeaders();
2445
+ // Only set safe headers to avoid overwriting security headers
2446
+ const allowedHeaders = ['content-type', 'content-length'];
2447
+ Object.entries(formHeaders).forEach(([key, val]) => {
2448
+ if (allowedHeaders.includes(key.toLowerCase())) {
2449
+ headers.set(key, val);
2450
+ }
2451
+ });
2452
+ }
2453
+ }
2454
+
2455
+ // Add xsrf header
2456
+ // This is only done if running in a standard browser environment.
2457
+ // Specifically not if we're in a web worker, or react-native.
2458
+
2459
+ if (platform.hasStandardBrowserEnv) {
2460
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2461
+
2462
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
2463
+ // Add xsrf header
2464
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2465
+
2466
+ if (xsrfValue) {
2467
+ headers.set(xsrfHeaderName, xsrfValue);
2468
+ }
2469
+ }
2470
+ }
2471
+
2472
+ return newConfig;
2473
+ };
2474
+
2475
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2476
+
2477
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
2478
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
2479
+ const _config = resolveConfig(config);
2480
+ let requestData = _config.data;
2481
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2482
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
2483
+ let onCanceled;
2484
+ let uploadThrottled, downloadThrottled;
2485
+ let flushUpload, flushDownload;
2486
+
2487
+ function done() {
2488
+ flushUpload && flushUpload(); // flush events
2489
+ flushDownload && flushDownload(); // flush events
2490
+
2491
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2492
+
2493
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
2494
+ }
2495
+
2496
+ let request = new XMLHttpRequest();
2497
+
2498
+ request.open(_config.method.toUpperCase(), _config.url, true);
2499
+
2500
+ // Set the request timeout in MS
2501
+ request.timeout = _config.timeout;
2502
+
2503
+ function onloadend() {
2504
+ if (!request) {
2505
+ return;
2506
+ }
2507
+ // Prepare the response
2508
+ const responseHeaders = AxiosHeaders$1.from(
2509
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2510
+ );
2511
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2512
+ request.responseText : request.response;
2513
+ const response = {
2514
+ data: responseData,
2515
+ status: request.status,
2516
+ statusText: request.statusText,
2517
+ headers: responseHeaders,
2518
+ config,
2519
+ request
2520
+ };
2521
+
2522
+ settle(function _resolve(value) {
2523
+ resolve(value);
2524
+ done();
2525
+ }, function _reject(err) {
2526
+ reject(err);
2527
+ done();
2528
+ }, response);
2529
+
2530
+ // Clean up request
2531
+ request = null;
2532
+ }
2533
+
2534
+ if ('onloadend' in request) {
2535
+ // Use onloadend if available
2536
+ request.onloadend = onloadend;
2537
+ } else {
2538
+ // Listen for ready state to emulate onloadend
2539
+ request.onreadystatechange = function handleLoad() {
2540
+ if (!request || request.readyState !== 4) {
2541
+ return;
2542
+ }
2543
+
2544
+ // The request errored out and we didn't get a response, this will be
2545
+ // handled by onerror instead
2546
+ // With one exception: request that using file: protocol, most browsers
2547
+ // will return status as 0 even though it's a successful request
2548
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2549
+ return;
2550
+ }
2551
+ // readystate handler is calling before onerror or ontimeout handlers,
2552
+ // so we should call onloadend on the next 'tick'
2553
+ setTimeout(onloadend);
2554
+ };
2555
+ }
2556
+
2557
+ // Handle browser request cancellation (as opposed to a manual cancellation)
2558
+ request.onabort = function handleAbort() {
2559
+ if (!request) {
2560
+ return;
2561
+ }
2562
+
2563
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2564
+
2565
+ // Clean up request
2566
+ request = null;
2567
+ };
2568
+
2569
+ // Handle low level network errors
2570
+ request.onerror = function handleError(event) {
2571
+ // Browsers deliver a ProgressEvent in XHR onerror
2572
+ // (message may be empty; when present, surface it)
2573
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
2574
+ const msg = event && event.message ? event.message : 'Network Error';
2575
+ const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
2576
+ // attach the underlying event for consumers who want details
2577
+ err.event = event || null;
2578
+ reject(err);
2579
+ request = null;
2580
+ };
2581
+
2582
+ // Handle timeout
2583
+ request.ontimeout = function handleTimeout() {
2584
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
2585
+ const transitional = _config.transitional || transitionalDefaults;
2586
+ if (_config.timeoutErrorMessage) {
2587
+ timeoutErrorMessage = _config.timeoutErrorMessage;
2588
+ }
2589
+ reject(new AxiosError(
2590
+ timeoutErrorMessage,
2591
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2592
+ config,
2593
+ request));
2594
+
2595
+ // Clean up request
2596
+ request = null;
2597
+ };
2598
+
2599
+ // Remove Content-Type if data is undefined
2600
+ requestData === undefined && requestHeaders.setContentType(null);
2601
+
2602
+ // Add headers to the request
2603
+ if ('setRequestHeader' in request) {
2604
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2605
+ request.setRequestHeader(key, val);
2606
+ });
2607
+ }
2608
+
2609
+ // Add withCredentials to request if needed
2610
+ if (!utils$1.isUndefined(_config.withCredentials)) {
2611
+ request.withCredentials = !!_config.withCredentials;
2612
+ }
2613
+
2614
+ // Add responseType to request if needed
2615
+ if (responseType && responseType !== 'json') {
2616
+ request.responseType = _config.responseType;
2617
+ }
2618
+
2619
+ // Handle progress if needed
2620
+ if (onDownloadProgress) {
2621
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
2622
+ request.addEventListener('progress', downloadThrottled);
2623
+ }
2624
+
2625
+ // Not all browsers support upload events
2626
+ if (onUploadProgress && request.upload) {
2627
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
2628
+
2629
+ request.upload.addEventListener('progress', uploadThrottled);
2630
+
2631
+ request.upload.addEventListener('loadend', flushUpload);
2632
+ }
2633
+
2634
+ if (_config.cancelToken || _config.signal) {
2635
+ // Handle cancellation
2636
+ // eslint-disable-next-line func-names
2637
+ onCanceled = cancel => {
2638
+ if (!request) {
2639
+ return;
2640
+ }
2641
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2642
+ request.abort();
2643
+ request = null;
2644
+ };
2645
+
2646
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2647
+ if (_config.signal) {
2648
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
2649
+ }
2650
+ }
2651
+
2652
+ const protocol = parseProtocol(_config.url);
2653
+
2654
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
2655
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2656
+ return;
2657
+ }
2658
+
2659
+
2660
+ // Send the request
2661
+ request.send(requestData || null);
2662
+ });
2663
+ };
2664
+
2665
+ const composeSignals = (signals, timeout) => {
2666
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
2667
+
2668
+ if (timeout || length) {
2669
+ let controller = new AbortController();
2670
+
2671
+ let aborted;
2672
+
2673
+ const onabort = function (reason) {
2674
+ if (!aborted) {
2675
+ aborted = true;
2676
+ unsubscribe();
2677
+ const err = reason instanceof Error ? reason : this.reason;
2678
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2679
+ }
2680
+ };
2681
+
2682
+ let timer = timeout && setTimeout(() => {
2683
+ timer = null;
2684
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
2685
+ }, timeout);
2686
+
2687
+ const unsubscribe = () => {
2688
+ if (signals) {
2689
+ timer && clearTimeout(timer);
2690
+ timer = null;
2691
+ signals.forEach(signal => {
2692
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
2693
+ });
2694
+ signals = null;
2695
+ }
2696
+ };
2697
+
2698
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
2699
+
2700
+ const {signal} = controller;
2701
+
2702
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
2703
+
2704
+ return signal;
2705
+ }
2706
+ };
2707
+
2708
+ var composeSignals$1 = composeSignals;
2709
+
2710
+ const streamChunk = function* (chunk, chunkSize) {
2711
+ let len = chunk.byteLength;
2712
+
2713
+ if (!chunkSize || len < chunkSize) {
2714
+ yield chunk;
2715
+ return;
2716
+ }
2717
+
2718
+ let pos = 0;
2719
+ let end;
2720
+
2721
+ while (pos < len) {
2722
+ end = pos + chunkSize;
2723
+ yield chunk.slice(pos, end);
2724
+ pos = end;
2725
+ }
2726
+ };
2727
+
2728
+ const readBytes = async function* (iterable, chunkSize) {
2729
+ for await (const chunk of readStream(iterable)) {
2730
+ yield* streamChunk(chunk, chunkSize);
2731
+ }
2732
+ };
2733
+
2734
+ const readStream = async function* (stream) {
2735
+ if (stream[Symbol.asyncIterator]) {
2736
+ yield* stream;
2737
+ return;
2738
+ }
2739
+
2740
+ const reader = stream.getReader();
2741
+ try {
2742
+ for (;;) {
2743
+ const {done, value} = await reader.read();
2744
+ if (done) {
2745
+ break;
2746
+ }
2747
+ yield value;
2748
+ }
2749
+ } finally {
2750
+ await reader.cancel();
2751
+ }
2752
+ };
2753
+
2754
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2755
+ const iterator = readBytes(stream, chunkSize);
2756
+
2757
+ let bytes = 0;
2758
+ let done;
2759
+ let _onFinish = (e) => {
2760
+ if (!done) {
2761
+ done = true;
2762
+ onFinish && onFinish(e);
2763
+ }
2764
+ };
2765
+
2766
+ return new ReadableStream({
2767
+ async pull(controller) {
2768
+ try {
2769
+ const {done, value} = await iterator.next();
2770
+
2771
+ if (done) {
2772
+ _onFinish();
2773
+ controller.close();
2774
+ return;
2775
+ }
2776
+
2777
+ let len = value.byteLength;
2778
+ if (onProgress) {
2779
+ let loadedBytes = bytes += len;
2780
+ onProgress(loadedBytes);
2781
+ }
2782
+ controller.enqueue(new Uint8Array(value));
2783
+ } catch (err) {
2784
+ _onFinish(err);
2785
+ throw err;
2786
+ }
2787
+ },
2788
+ cancel(reason) {
2789
+ _onFinish(reason);
2790
+ return iterator.return();
2791
+ }
2792
+ }, {
2793
+ highWaterMark: 2
2794
+ })
2795
+ };
2796
+
2797
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
2798
+
2799
+ const {isFunction} = utils$1;
2800
+
2801
+ const globalFetchAPI = (({Request, Response}) => ({
2802
+ Request, Response
2803
+ }))(utils$1.global);
2804
+
2805
+ const {
2806
+ ReadableStream: ReadableStream$1, TextEncoder
2807
+ } = utils$1.global;
2808
+
2809
+
2810
+ const test = (fn, ...args) => {
2811
+ try {
2812
+ return !!fn(...args);
2813
+ } catch (e) {
2814
+ return false
2815
+ }
2816
+ };
2817
+
2818
+ const factory = (env) => {
2819
+ env = utils$1.merge.call({
2820
+ skipUndefined: true
2821
+ }, globalFetchAPI, env);
2822
+
2823
+ const {fetch: envFetch, Request, Response} = env;
2824
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
2825
+ const isRequestSupported = isFunction(Request);
2826
+ const isResponseSupported = isFunction(Response);
2827
+
2828
+ if (!isFetchSupported) {
2829
+ return false;
2830
+ }
2831
+
2832
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2833
+
2834
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
2835
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
2836
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
2837
+ );
2838
+
2839
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2840
+ let duplexAccessed = false;
2841
+
2842
+ const hasContentType = new Request(platform.origin, {
2843
+ body: new ReadableStream$1(),
2844
+ method: 'POST',
2845
+ get duplex() {
2846
+ duplexAccessed = true;
2847
+ return 'half';
2848
+ },
2849
+ }).headers.has('Content-Type');
2850
+
2851
+ return duplexAccessed && !hasContentType;
2852
+ });
2853
+
2854
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
2855
+ test(() => utils$1.isReadableStream(new Response('').body));
2856
+
2857
+ const resolvers = {
2858
+ stream: supportsResponseStream && ((res) => res.body)
2859
+ };
2860
+
2861
+ isFetchSupported && ((() => {
2862
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2863
+ !resolvers[type] && (resolvers[type] = (res, config) => {
2864
+ let method = res && res[type];
2865
+
2866
+ if (method) {
2867
+ return method.call(res);
2868
+ }
2869
+
2870
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2871
+ });
2872
+ });
2873
+ })());
2874
+
2875
+ const getBodyLength = async (body) => {
2876
+ if (body == null) {
2877
+ return 0;
2878
+ }
2879
+
2880
+ if (utils$1.isBlob(body)) {
2881
+ return body.size;
2882
+ }
2883
+
2884
+ if (utils$1.isSpecCompliantForm(body)) {
2885
+ const _request = new Request(platform.origin, {
2886
+ method: 'POST',
2887
+ body,
2888
+ });
2889
+ return (await _request.arrayBuffer()).byteLength;
2890
+ }
2891
+
2892
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2893
+ return body.byteLength;
2894
+ }
2895
+
2896
+ if (utils$1.isURLSearchParams(body)) {
2897
+ body = body + '';
2898
+ }
2899
+
2900
+ if (utils$1.isString(body)) {
2901
+ return (await encodeText(body)).byteLength;
2902
+ }
2903
+ };
2904
+
2905
+ const resolveBodyLength = async (headers, body) => {
2906
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
2907
+
2908
+ return length == null ? getBodyLength(body) : length;
2909
+ };
2910
+
2911
+ return async (config) => {
2912
+ let {
2913
+ url,
2914
+ method,
2915
+ data,
2916
+ signal,
2917
+ cancelToken,
2918
+ timeout,
2919
+ onDownloadProgress,
2920
+ onUploadProgress,
2921
+ responseType,
2922
+ headers,
2923
+ withCredentials = 'same-origin',
2924
+ fetchOptions
2925
+ } = resolveConfig(config);
2926
+
2927
+ let _fetch = envFetch || fetch;
2928
+
2929
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2930
+
2931
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2932
+
2933
+ let request = null;
2934
+
2935
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2936
+ composedSignal.unsubscribe();
2937
+ });
2938
+
2939
+ let requestContentLength;
2940
+
2941
+ try {
2942
+ if (
2943
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
2944
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
2945
+ ) {
2946
+ let _request = new Request(url, {
2947
+ method: 'POST',
2948
+ body: data,
2949
+ duplex: "half"
2950
+ });
2951
+
2952
+ let contentTypeHeader;
2953
+
2954
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2955
+ headers.setContentType(contentTypeHeader);
2956
+ }
2957
+
2958
+ if (_request.body) {
2959
+ const [onProgress, flush] = progressEventDecorator(
2960
+ requestContentLength,
2961
+ progressEventReducer(asyncDecorator(onUploadProgress))
2962
+ );
2963
+
2964
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2965
+ }
2966
+ }
2967
+
2968
+ if (!utils$1.isString(withCredentials)) {
2969
+ withCredentials = withCredentials ? 'include' : 'omit';
2970
+ }
2971
+
2972
+ // Cloudflare Workers throws when credentials are defined
2973
+ // see https://github.com/cloudflare/workerd/issues/902
2974
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2975
+
2976
+ const resolvedOptions = {
2977
+ ...fetchOptions,
2978
+ signal: composedSignal,
2979
+ method: method.toUpperCase(),
2980
+ headers: headers.normalize().toJSON(),
2981
+ body: data,
2982
+ duplex: "half",
2983
+ credentials: isCredentialsSupported ? withCredentials : undefined
2984
+ };
2985
+
2986
+ request = isRequestSupported && new Request(url, resolvedOptions);
2987
+
2988
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
2989
+
2990
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2991
+
2992
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
2993
+ const options = {};
2994
+
2995
+ ['status', 'statusText', 'headers'].forEach(prop => {
2996
+ options[prop] = response[prop];
2997
+ });
2998
+
2999
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3000
+
3001
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
3002
+ responseContentLength,
3003
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
3004
+ ) || [];
3005
+
3006
+ response = new Response(
3007
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3008
+ flush && flush();
3009
+ unsubscribe && unsubscribe();
3010
+ }),
3011
+ options
3012
+ );
3013
+ }
3014
+
3015
+ responseType = responseType || 'text';
3016
+
3017
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3018
+
3019
+ !isStreamResponse && unsubscribe && unsubscribe();
3020
+
3021
+ return await new Promise((resolve, reject) => {
3022
+ settle(resolve, reject, {
3023
+ data: responseData,
3024
+ headers: AxiosHeaders$1.from(response.headers),
3025
+ status: response.status,
3026
+ statusText: response.statusText,
3027
+ config,
3028
+ request
3029
+ });
3030
+ })
3031
+ } catch (err) {
3032
+ unsubscribe && unsubscribe();
3033
+
3034
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3035
+ throw Object.assign(
3036
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3037
+ {
3038
+ cause: err.cause || err
3039
+ }
3040
+ )
3041
+ }
3042
+
3043
+ throw AxiosError.from(err, err && err.code, config, request);
3044
+ }
3045
+ }
3046
+ };
3047
+
3048
+ const seedCache = new Map();
3049
+
3050
+ const getFetch = (config) => {
3051
+ let env = (config && config.env) || {};
3052
+ const {fetch, Request, Response} = env;
3053
+ const seeds = [
3054
+ Request, Response, fetch
3055
+ ];
3056
+
3057
+ let len = seeds.length, i = len,
3058
+ seed, target, map = seedCache;
3059
+
3060
+ while (i--) {
3061
+ seed = seeds[i];
3062
+ target = map.get(seed);
3063
+
3064
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
3065
+
3066
+ map = target;
3067
+ }
3068
+
3069
+ return target;
3070
+ };
3071
+
3072
+ getFetch();
3073
+
3074
+ /**
3075
+ * Known adapters mapping.
3076
+ * Provides environment-specific adapters for Axios:
3077
+ * - `http` for Node.js
3078
+ * - `xhr` for browsers
3079
+ * - `fetch` for fetch API-based requests
3080
+ *
3081
+ * @type {Object<string, Function|Object>}
3082
+ */
3083
+ const knownAdapters = {
3084
+ http: httpAdapter,
3085
+ xhr: xhrAdapter,
3086
+ fetch: {
3087
+ get: getFetch,
3088
+ }
3089
+ };
3090
+
3091
+ // Assign adapter names for easier debugging and identification
3092
+ utils$1.forEach(knownAdapters, (fn, value) => {
3093
+ if (fn) {
3094
+ try {
3095
+ Object.defineProperty(fn, 'name', { value });
3096
+ } catch (e) {
3097
+ // eslint-disable-next-line no-empty
3098
+ }
3099
+ Object.defineProperty(fn, 'adapterName', { value });
3100
+ }
3101
+ });
3102
+
3103
+ /**
3104
+ * Render a rejection reason string for unknown or unsupported adapters
3105
+ *
3106
+ * @param {string} reason
3107
+ * @returns {string}
3108
+ */
3109
+ const renderReason = (reason) => `- ${reason}`;
3110
+
3111
+ /**
3112
+ * Check if the adapter is resolved (function, null, or false)
3113
+ *
3114
+ * @param {Function|null|false} adapter
3115
+ * @returns {boolean}
3116
+ */
3117
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3118
+
3119
+ /**
3120
+ * Get the first suitable adapter from the provided list.
3121
+ * Tries each adapter in order until a supported one is found.
3122
+ * Throws an AxiosError if no adapter is suitable.
3123
+ *
3124
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
3125
+ * @param {Object} config - Axios request configuration
3126
+ * @throws {AxiosError} If no suitable adapter is available
3127
+ * @returns {Function} The resolved adapter function
3128
+ */
3129
+ function getAdapter(adapters, config) {
3130
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3131
+
3132
+ const { length } = adapters;
3133
+ let nameOrAdapter;
3134
+ let adapter;
3135
+
3136
+ const rejectedReasons = {};
3137
+
3138
+ for (let i = 0; i < length; i++) {
3139
+ nameOrAdapter = adapters[i];
3140
+ let id;
3141
+
3142
+ adapter = nameOrAdapter;
3143
+
3144
+ if (!isResolvedHandle(nameOrAdapter)) {
3145
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3146
+
3147
+ if (adapter === undefined) {
3148
+ throw new AxiosError(`Unknown adapter '${id}'`);
3149
+ }
3150
+ }
3151
+
3152
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
3153
+ break;
3154
+ }
3155
+
3156
+ rejectedReasons[id || '#' + i] = adapter;
3157
+ }
3158
+
3159
+ if (!adapter) {
3160
+ const reasons = Object.entries(rejectedReasons)
3161
+ .map(([id, state]) => `adapter ${id} ` +
3162
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
3163
+ );
3164
+
3165
+ let s = length ?
3166
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3167
+ 'as no adapter specified';
3168
+
3169
+ throw new AxiosError(
3170
+ `There is no suitable adapter to dispatch the request ` + s,
3171
+ 'ERR_NOT_SUPPORT'
3172
+ );
3173
+ }
3174
+
3175
+ return adapter;
3176
+ }
3177
+
3178
+ /**
3179
+ * Exports Axios adapters and utility to resolve an adapter
3180
+ */
3181
+ var adapters = {
3182
+ /**
3183
+ * Resolve an adapter from a list of adapter names or functions.
3184
+ * @type {Function}
3185
+ */
3186
+ getAdapter,
3187
+
3188
+ /**
3189
+ * Exposes all known adapters
3190
+ * @type {Object<string, Function|Object>}
3191
+ */
3192
+ adapters: knownAdapters
3193
+ };
3194
+
3195
+ /**
3196
+ * Throws a `CanceledError` if cancellation has been requested.
3197
+ *
3198
+ * @param {Object} config The config that is to be used for the request
3199
+ *
3200
+ * @returns {void}
3201
+ */
3202
+ function throwIfCancellationRequested(config) {
3203
+ if (config.cancelToken) {
3204
+ config.cancelToken.throwIfRequested();
3205
+ }
3206
+
3207
+ if (config.signal && config.signal.aborted) {
3208
+ throw new CanceledError(null, config);
3209
+ }
3210
+ }
3211
+
3212
+ /**
3213
+ * Dispatch a request to the server using the configured adapter.
3214
+ *
3215
+ * @param {object} config The config that is to be used for the request
3216
+ *
3217
+ * @returns {Promise} The Promise to be fulfilled
3218
+ */
3219
+ function dispatchRequest(config) {
3220
+ throwIfCancellationRequested(config);
3221
+
3222
+ config.headers = AxiosHeaders$1.from(config.headers);
3223
+
3224
+ // Transform request data
3225
+ config.data = transformData.call(
3226
+ config,
3227
+ config.transformRequest
3228
+ );
3229
+
3230
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3231
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
3232
+ }
3233
+
3234
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
3235
+
3236
+ return adapter(config).then(function onAdapterResolution(response) {
3237
+ throwIfCancellationRequested(config);
3238
+
3239
+ // Transform response data
3240
+ response.data = transformData.call(
3241
+ config,
3242
+ config.transformResponse,
3243
+ response
3244
+ );
3245
+
3246
+ response.headers = AxiosHeaders$1.from(response.headers);
3247
+
3248
+ return response;
3249
+ }, function onAdapterRejection(reason) {
3250
+ if (!isCancel(reason)) {
3251
+ throwIfCancellationRequested(config);
3252
+
3253
+ // Transform response data
3254
+ if (reason && reason.response) {
3255
+ reason.response.data = transformData.call(
3256
+ config,
3257
+ config.transformResponse,
3258
+ reason.response
3259
+ );
3260
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3261
+ }
3262
+ }
3263
+
3264
+ return Promise.reject(reason);
3265
+ });
3266
+ }
3267
+
3268
+ const VERSION = "1.13.2";
3269
+
3270
+ const validators$1 = {};
3271
+
3272
+ // eslint-disable-next-line func-names
3273
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3274
+ validators$1[type] = function validator(thing) {
3275
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3276
+ };
3277
+ });
3278
+
3279
+ const deprecatedWarnings = {};
3280
+
3281
+ /**
3282
+ * Transitional option validator
3283
+ *
3284
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
3285
+ * @param {string?} version - deprecated version / removed since version
3286
+ * @param {string?} message - some message with additional info
3287
+ *
3288
+ * @returns {function}
3289
+ */
3290
+ validators$1.transitional = function transitional(validator, version, message) {
3291
+ function formatMessage(opt, desc) {
3292
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3293
+ }
3294
+
3295
+ // eslint-disable-next-line func-names
3296
+ return (value, opt, opts) => {
3297
+ if (validator === false) {
3298
+ throw new AxiosError(
3299
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3300
+ AxiosError.ERR_DEPRECATED
3301
+ );
3302
+ }
3303
+
3304
+ if (version && !deprecatedWarnings[opt]) {
3305
+ deprecatedWarnings[opt] = true;
3306
+ // eslint-disable-next-line no-console
3307
+ console.warn(
3308
+ formatMessage(
3309
+ opt,
3310
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
3311
+ )
3312
+ );
3313
+ }
3314
+
3315
+ return validator ? validator(value, opt, opts) : true;
3316
+ };
3317
+ };
3318
+
3319
+ validators$1.spelling = function spelling(correctSpelling) {
3320
+ return (value, opt) => {
3321
+ // eslint-disable-next-line no-console
3322
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
3323
+ return true;
3324
+ }
3325
+ };
3326
+
3327
+ /**
3328
+ * Assert object's properties type
3329
+ *
3330
+ * @param {object} options
3331
+ * @param {object} schema
3332
+ * @param {boolean?} allowUnknown
3333
+ *
3334
+ * @returns {object}
3335
+ */
3336
+
3337
+ function assertOptions(options, schema, allowUnknown) {
3338
+ if (typeof options !== 'object') {
3339
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3340
+ }
3341
+ const keys = Object.keys(options);
3342
+ let i = keys.length;
3343
+ while (i-- > 0) {
3344
+ const opt = keys[i];
3345
+ const validator = schema[opt];
3346
+ if (validator) {
3347
+ const value = options[opt];
3348
+ const result = value === undefined || validator(value, opt, options);
3349
+ if (result !== true) {
3350
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3351
+ }
3352
+ continue;
3353
+ }
3354
+ if (allowUnknown !== true) {
3355
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3356
+ }
3357
+ }
3358
+ }
3359
+
3360
+ var validator = {
3361
+ assertOptions,
3362
+ validators: validators$1
3363
+ };
3364
+
3365
+ const validators = validator.validators;
3366
+
3367
+ /**
3368
+ * Create a new instance of Axios
3369
+ *
3370
+ * @param {Object} instanceConfig The default config for the instance
3371
+ *
3372
+ * @return {Axios} A new instance of Axios
3373
+ */
3374
+ class Axios {
3375
+ constructor(instanceConfig) {
3376
+ this.defaults = instanceConfig || {};
3377
+ this.interceptors = {
3378
+ request: new InterceptorManager$1(),
3379
+ response: new InterceptorManager$1()
3380
+ };
3381
+ }
3382
+
3383
+ /**
3384
+ * Dispatch a request
3385
+ *
3386
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3387
+ * @param {?Object} config
3388
+ *
3389
+ * @returns {Promise} The Promise to be fulfilled
3390
+ */
3391
+ async request(configOrUrl, config) {
3392
+ try {
3393
+ return await this._request(configOrUrl, config);
3394
+ } catch (err) {
3395
+ if (err instanceof Error) {
3396
+ let dummy = {};
3397
+
3398
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
3399
+
3400
+ // slice off the Error: ... line
3401
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3402
+ try {
3403
+ if (!err.stack) {
3404
+ err.stack = stack;
3405
+ // match without the 2 top stack lines
3406
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3407
+ err.stack += '\n' + stack;
3408
+ }
3409
+ } catch (e) {
3410
+ // ignore the case where "stack" is an un-writable property
3411
+ }
3412
+ }
3413
+
3414
+ throw err;
3415
+ }
3416
+ }
3417
+
3418
+ _request(configOrUrl, config) {
3419
+ /*eslint no-param-reassign:0*/
3420
+ // Allow for axios('example/url'[, config]) a la fetch API
3421
+ if (typeof configOrUrl === 'string') {
3422
+ config = config || {};
3423
+ config.url = configOrUrl;
3424
+ } else {
3425
+ config = configOrUrl || {};
3426
+ }
3427
+
3428
+ config = mergeConfig(this.defaults, config);
3429
+
3430
+ const {transitional, paramsSerializer, headers} = config;
3431
+
3432
+ if (transitional !== undefined) {
3433
+ validator.assertOptions(transitional, {
3434
+ silentJSONParsing: validators.transitional(validators.boolean),
3435
+ forcedJSONParsing: validators.transitional(validators.boolean),
3436
+ clarifyTimeoutError: validators.transitional(validators.boolean)
3437
+ }, false);
3438
+ }
3439
+
3440
+ if (paramsSerializer != null) {
3441
+ if (utils$1.isFunction(paramsSerializer)) {
3442
+ config.paramsSerializer = {
3443
+ serialize: paramsSerializer
3444
+ };
3445
+ } else {
3446
+ validator.assertOptions(paramsSerializer, {
3447
+ encode: validators.function,
3448
+ serialize: validators.function
3449
+ }, true);
3450
+ }
3451
+ }
3452
+
3453
+ // Set config.allowAbsoluteUrls
3454
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
3455
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
3456
+ } else {
3457
+ config.allowAbsoluteUrls = true;
3458
+ }
3459
+
3460
+ validator.assertOptions(config, {
3461
+ baseUrl: validators.spelling('baseURL'),
3462
+ withXsrfToken: validators.spelling('withXSRFToken')
3463
+ }, true);
3464
+
3465
+ // Set config.method
3466
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3467
+
3468
+ // Flatten headers
3469
+ let contextHeaders = headers && utils$1.merge(
3470
+ headers.common,
3471
+ headers[config.method]
3472
+ );
3473
+
3474
+ headers && utils$1.forEach(
3475
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3476
+ (method) => {
3477
+ delete headers[method];
3478
+ }
3479
+ );
3480
+
3481
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3482
+
3483
+ // filter out skipped interceptors
3484
+ const requestInterceptorChain = [];
3485
+ let synchronousRequestInterceptors = true;
3486
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3487
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3488
+ return;
3489
+ }
3490
+
3491
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3492
+
3493
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3494
+ });
3495
+
3496
+ const responseInterceptorChain = [];
3497
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3498
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3499
+ });
3500
+
3501
+ let promise;
3502
+ let i = 0;
3503
+ let len;
3504
+
3505
+ if (!synchronousRequestInterceptors) {
3506
+ const chain = [dispatchRequest.bind(this), undefined];
3507
+ chain.unshift(...requestInterceptorChain);
3508
+ chain.push(...responseInterceptorChain);
3509
+ len = chain.length;
3510
+
3511
+ promise = Promise.resolve(config);
3512
+
3513
+ while (i < len) {
3514
+ promise = promise.then(chain[i++], chain[i++]);
3515
+ }
3516
+
3517
+ return promise;
3518
+ }
3519
+
3520
+ len = requestInterceptorChain.length;
3521
+
3522
+ let newConfig = config;
3523
+
3524
+ while (i < len) {
3525
+ const onFulfilled = requestInterceptorChain[i++];
3526
+ const onRejected = requestInterceptorChain[i++];
3527
+ try {
3528
+ newConfig = onFulfilled(newConfig);
3529
+ } catch (error) {
3530
+ onRejected.call(this, error);
3531
+ break;
3532
+ }
3533
+ }
3534
+
3535
+ try {
3536
+ promise = dispatchRequest.call(this, newConfig);
3537
+ } catch (error) {
3538
+ return Promise.reject(error);
3539
+ }
3540
+
3541
+ i = 0;
3542
+ len = responseInterceptorChain.length;
3543
+
3544
+ while (i < len) {
3545
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3546
+ }
3547
+
3548
+ return promise;
3549
+ }
3550
+
3551
+ getUri(config) {
3552
+ config = mergeConfig(this.defaults, config);
3553
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3554
+ return buildURL(fullPath, config.params, config.paramsSerializer);
3555
+ }
3556
+ }
3557
+
3558
+ // Provide aliases for supported request methods
3559
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3560
+ /*eslint func-names:0*/
3561
+ Axios.prototype[method] = function(url, config) {
3562
+ return this.request(mergeConfig(config || {}, {
3563
+ method,
3564
+ url,
3565
+ data: (config || {}).data
3566
+ }));
3567
+ };
3568
+ });
3569
+
3570
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3571
+ /*eslint func-names:0*/
3572
+
3573
+ function generateHTTPMethod(isForm) {
3574
+ return function httpMethod(url, data, config) {
3575
+ return this.request(mergeConfig(config || {}, {
3576
+ method,
3577
+ headers: isForm ? {
3578
+ 'Content-Type': 'multipart/form-data'
3579
+ } : {},
3580
+ url,
3581
+ data
3582
+ }));
3583
+ };
3584
+ }
3585
+
3586
+ Axios.prototype[method] = generateHTTPMethod();
3587
+
3588
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3589
+ });
3590
+
3591
+ var Axios$1 = Axios;
3592
+
3593
+ /**
3594
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
3595
+ *
3596
+ * @param {Function} executor The executor function.
3597
+ *
3598
+ * @returns {CancelToken}
3599
+ */
3600
+ class CancelToken {
3601
+ constructor(executor) {
3602
+ if (typeof executor !== 'function') {
3603
+ throw new TypeError('executor must be a function.');
3604
+ }
3605
+
3606
+ let resolvePromise;
3607
+
3608
+ this.promise = new Promise(function promiseExecutor(resolve) {
3609
+ resolvePromise = resolve;
3610
+ });
3611
+
3612
+ const token = this;
3613
+
3614
+ // eslint-disable-next-line func-names
3615
+ this.promise.then(cancel => {
3616
+ if (!token._listeners) return;
3617
+
3618
+ let i = token._listeners.length;
3619
+
3620
+ while (i-- > 0) {
3621
+ token._listeners[i](cancel);
3622
+ }
3623
+ token._listeners = null;
3624
+ });
3625
+
3626
+ // eslint-disable-next-line func-names
3627
+ this.promise.then = onfulfilled => {
3628
+ let _resolve;
3629
+ // eslint-disable-next-line func-names
3630
+ const promise = new Promise(resolve => {
3631
+ token.subscribe(resolve);
3632
+ _resolve = resolve;
3633
+ }).then(onfulfilled);
3634
+
3635
+ promise.cancel = function reject() {
3636
+ token.unsubscribe(_resolve);
3637
+ };
3638
+
3639
+ return promise;
3640
+ };
3641
+
3642
+ executor(function cancel(message, config, request) {
3643
+ if (token.reason) {
3644
+ // Cancellation has already been requested
3645
+ return;
3646
+ }
3647
+
3648
+ token.reason = new CanceledError(message, config, request);
3649
+ resolvePromise(token.reason);
3650
+ });
3651
+ }
3652
+
3653
+ /**
3654
+ * Throws a `CanceledError` if cancellation has been requested.
3655
+ */
3656
+ throwIfRequested() {
3657
+ if (this.reason) {
3658
+ throw this.reason;
3659
+ }
3660
+ }
3661
+
3662
+ /**
3663
+ * Subscribe to the cancel signal
3664
+ */
3665
+
3666
+ subscribe(listener) {
3667
+ if (this.reason) {
3668
+ listener(this.reason);
3669
+ return;
3670
+ }
3671
+
3672
+ if (this._listeners) {
3673
+ this._listeners.push(listener);
3674
+ } else {
3675
+ this._listeners = [listener];
3676
+ }
3677
+ }
3678
+
3679
+ /**
3680
+ * Unsubscribe from the cancel signal
3681
+ */
3682
+
3683
+ unsubscribe(listener) {
3684
+ if (!this._listeners) {
3685
+ return;
3686
+ }
3687
+ const index = this._listeners.indexOf(listener);
3688
+ if (index !== -1) {
3689
+ this._listeners.splice(index, 1);
3690
+ }
3691
+ }
3692
+
3693
+ toAbortSignal() {
3694
+ const controller = new AbortController();
3695
+
3696
+ const abort = (err) => {
3697
+ controller.abort(err);
3698
+ };
3699
+
3700
+ this.subscribe(abort);
3701
+
3702
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
3703
+
3704
+ return controller.signal;
3705
+ }
3706
+
3707
+ /**
3708
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3709
+ * cancels the `CancelToken`.
3710
+ */
3711
+ static source() {
3712
+ let cancel;
3713
+ const token = new CancelToken(function executor(c) {
3714
+ cancel = c;
3715
+ });
3716
+ return {
3717
+ token,
3718
+ cancel
3719
+ };
3720
+ }
3721
+ }
3722
+
3723
+ var CancelToken$1 = CancelToken;
3724
+
3725
+ /**
3726
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
3727
+ *
3728
+ * Common use case would be to use `Function.prototype.apply`.
3729
+ *
3730
+ * ```js
3731
+ * function f(x, y, z) {}
3732
+ * var args = [1, 2, 3];
3733
+ * f.apply(null, args);
3734
+ * ```
3735
+ *
3736
+ * With `spread` this example can be re-written.
3737
+ *
3738
+ * ```js
3739
+ * spread(function(x, y, z) {})([1, 2, 3]);
3740
+ * ```
3741
+ *
3742
+ * @param {Function} callback
3743
+ *
3744
+ * @returns {Function}
3745
+ */
3746
+ function spread(callback) {
3747
+ return function wrap(arr) {
3748
+ return callback.apply(null, arr);
3749
+ };
3750
+ }
3751
+
3752
+ /**
3753
+ * Determines whether the payload is an error thrown by Axios
3754
+ *
3755
+ * @param {*} payload The value to test
3756
+ *
3757
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3758
+ */
3759
+ function isAxiosError(payload) {
3760
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
3761
+ }
3762
+
3763
+ const HttpStatusCode = {
3764
+ Continue: 100,
3765
+ SwitchingProtocols: 101,
3766
+ Processing: 102,
3767
+ EarlyHints: 103,
3768
+ Ok: 200,
3769
+ Created: 201,
3770
+ Accepted: 202,
3771
+ NonAuthoritativeInformation: 203,
3772
+ NoContent: 204,
3773
+ ResetContent: 205,
3774
+ PartialContent: 206,
3775
+ MultiStatus: 207,
3776
+ AlreadyReported: 208,
3777
+ ImUsed: 226,
3778
+ MultipleChoices: 300,
3779
+ MovedPermanently: 301,
3780
+ Found: 302,
3781
+ SeeOther: 303,
3782
+ NotModified: 304,
3783
+ UseProxy: 305,
3784
+ Unused: 306,
3785
+ TemporaryRedirect: 307,
3786
+ PermanentRedirect: 308,
3787
+ BadRequest: 400,
3788
+ Unauthorized: 401,
3789
+ PaymentRequired: 402,
3790
+ Forbidden: 403,
3791
+ NotFound: 404,
3792
+ MethodNotAllowed: 405,
3793
+ NotAcceptable: 406,
3794
+ ProxyAuthenticationRequired: 407,
3795
+ RequestTimeout: 408,
3796
+ Conflict: 409,
3797
+ Gone: 410,
3798
+ LengthRequired: 411,
3799
+ PreconditionFailed: 412,
3800
+ PayloadTooLarge: 413,
3801
+ UriTooLong: 414,
3802
+ UnsupportedMediaType: 415,
3803
+ RangeNotSatisfiable: 416,
3804
+ ExpectationFailed: 417,
3805
+ ImATeapot: 418,
3806
+ MisdirectedRequest: 421,
3807
+ UnprocessableEntity: 422,
3808
+ Locked: 423,
3809
+ FailedDependency: 424,
3810
+ TooEarly: 425,
3811
+ UpgradeRequired: 426,
3812
+ PreconditionRequired: 428,
3813
+ TooManyRequests: 429,
3814
+ RequestHeaderFieldsTooLarge: 431,
3815
+ UnavailableForLegalReasons: 451,
3816
+ InternalServerError: 500,
3817
+ NotImplemented: 501,
3818
+ BadGateway: 502,
3819
+ ServiceUnavailable: 503,
3820
+ GatewayTimeout: 504,
3821
+ HttpVersionNotSupported: 505,
3822
+ VariantAlsoNegotiates: 506,
3823
+ InsufficientStorage: 507,
3824
+ LoopDetected: 508,
3825
+ NotExtended: 510,
3826
+ NetworkAuthenticationRequired: 511,
3827
+ WebServerIsDown: 521,
3828
+ ConnectionTimedOut: 522,
3829
+ OriginIsUnreachable: 523,
3830
+ TimeoutOccurred: 524,
3831
+ SslHandshakeFailed: 525,
3832
+ InvalidSslCertificate: 526,
3833
+ };
3834
+
3835
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
3836
+ HttpStatusCode[value] = key;
3837
+ });
3838
+
3839
+ var HttpStatusCode$1 = HttpStatusCode;
3840
+
3841
+ /**
3842
+ * Create an instance of Axios
3843
+ *
3844
+ * @param {Object} defaultConfig The default config for the instance
3845
+ *
3846
+ * @returns {Axios} A new instance of Axios
3847
+ */
3848
+ function createInstance(defaultConfig) {
3849
+ const context = new Axios$1(defaultConfig);
3850
+ const instance = bind(Axios$1.prototype.request, context);
3851
+
3852
+ // Copy axios.prototype to instance
3853
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
3854
+
3855
+ // Copy context to instance
3856
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
3857
+
3858
+ // Factory for creating new instances
3859
+ instance.create = function create(instanceConfig) {
3860
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3861
+ };
3862
+
3863
+ return instance;
3864
+ }
3865
+
3866
+ // Create the default instance to be exported
3867
+ const axios = createInstance(defaults$1);
3868
+
3869
+ // Expose Axios class to allow class inheritance
3870
+ axios.Axios = Axios$1;
3871
+
3872
+ // Expose Cancel & CancelToken
3873
+ axios.CanceledError = CanceledError;
3874
+ axios.CancelToken = CancelToken$1;
3875
+ axios.isCancel = isCancel;
3876
+ axios.VERSION = VERSION;
3877
+ axios.toFormData = toFormData;
3878
+
3879
+ // Expose AxiosError class
3880
+ axios.AxiosError = AxiosError;
3881
+
3882
+ // alias for CanceledError for backward compatibility
3883
+ axios.Cancel = axios.CanceledError;
3884
+
3885
+ // Expose all/spread
3886
+ axios.all = function all(promises) {
3887
+ return Promise.all(promises);
3888
+ };
3889
+
3890
+ axios.spread = spread;
3891
+
3892
+ // Expose isAxiosError
3893
+ axios.isAxiosError = isAxiosError;
3894
+
3895
+ // Expose mergeConfig
3896
+ axios.mergeConfig = mergeConfig;
3897
+
3898
+ axios.AxiosHeaders = AxiosHeaders$1;
3899
+
3900
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3901
+
3902
+ axios.getAdapter = adapters.getAdapter;
3903
+
3904
+ axios.HttpStatusCode = HttpStatusCode$1;
3905
+
3906
+ axios.default = axios;
3907
+
3908
+ module.exports = axios;
3909
+ //# sourceMappingURL=axios.cjs.map