UNPKG

94.3 kBJavaScriptView Raw
1// Axios v1.2.5 Copyright (c) 2023 Matt Zabriskie and contributors
2(function (global, factory) {
3 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4 typeof define === 'function' && define.amd ? define(factory) :
5 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
6})(this, (function () { 'use strict';
7
8 function _typeof(obj) {
9 "@babel/helpers - typeof";
10
11 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
12 return typeof obj;
13 } : function (obj) {
14 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15 }, _typeof(obj);
16 }
17 function _classCallCheck(instance, Constructor) {
18 if (!(instance instanceof Constructor)) {
19 throw new TypeError("Cannot call a class as a function");
20 }
21 }
22 function _defineProperties(target, props) {
23 for (var i = 0; i < props.length; i++) {
24 var descriptor = props[i];
25 descriptor.enumerable = descriptor.enumerable || false;
26 descriptor.configurable = true;
27 if ("value" in descriptor) descriptor.writable = true;
28 Object.defineProperty(target, descriptor.key, descriptor);
29 }
30 }
31 function _createClass(Constructor, protoProps, staticProps) {
32 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
33 if (staticProps) _defineProperties(Constructor, staticProps);
34 Object.defineProperty(Constructor, "prototype", {
35 writable: false
36 });
37 return Constructor;
38 }
39 function _slicedToArray(arr, i) {
40 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
41 }
42 function _arrayWithHoles(arr) {
43 if (Array.isArray(arr)) return arr;
44 }
45 function _iterableToArrayLimit(arr, i) {
46 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
47 if (_i == null) return;
48 var _arr = [];
49 var _n = true;
50 var _d = false;
51 var _s, _e;
52 try {
53 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
54 _arr.push(_s.value);
55 if (i && _arr.length === i) break;
56 }
57 } catch (err) {
58 _d = true;
59 _e = err;
60 } finally {
61 try {
62 if (!_n && _i["return"] != null) _i["return"]();
63 } finally {
64 if (_d) throw _e;
65 }
66 }
67 return _arr;
68 }
69 function _unsupportedIterableToArray(o, minLen) {
70 if (!o) return;
71 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
72 var n = Object.prototype.toString.call(o).slice(8, -1);
73 if (n === "Object" && o.constructor) n = o.constructor.name;
74 if (n === "Map" || n === "Set") return Array.from(o);
75 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
76 }
77 function _arrayLikeToArray(arr, len) {
78 if (len == null || len > arr.length) len = arr.length;
79 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
80 return arr2;
81 }
82 function _nonIterableRest() {
83 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
84 }
85
86 function bind(fn, thisArg) {
87 return function wrap() {
88 return fn.apply(thisArg, arguments);
89 };
90 }
91
92 // utils is a library of generic helper functions non-specific to axios
93
94 var toString = Object.prototype.toString;
95 var getPrototypeOf = Object.getPrototypeOf;
96 var kindOf = function (cache) {
97 return function (thing) {
98 var str = toString.call(thing);
99 return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
100 };
101 }(Object.create(null));
102 var kindOfTest = function kindOfTest(type) {
103 type = type.toLowerCase();
104 return function (thing) {
105 return kindOf(thing) === type;
106 };
107 };
108 var typeOfTest = function typeOfTest(type) {
109 return function (thing) {
110 return _typeof(thing) === type;
111 };
112 };
113
114 /**
115 * Determine if a value is an Array
116 *
117 * @param {Object} val The value to test
118 *
119 * @returns {boolean} True if value is an Array, otherwise false
120 */
121 var isArray = Array.isArray;
122
123 /**
124 * Determine if a value is undefined
125 *
126 * @param {*} val The value to test
127 *
128 * @returns {boolean} True if the value is undefined, otherwise false
129 */
130 var isUndefined = typeOfTest('undefined');
131
132 /**
133 * Determine if a value is a Buffer
134 *
135 * @param {*} val The value to test
136 *
137 * @returns {boolean} True if value is a Buffer, otherwise false
138 */
139 function isBuffer(val) {
140 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
141 }
142
143 /**
144 * Determine if a value is an ArrayBuffer
145 *
146 * @param {*} val The value to test
147 *
148 * @returns {boolean} True if value is an ArrayBuffer, otherwise false
149 */
150 var isArrayBuffer = kindOfTest('ArrayBuffer');
151
152 /**
153 * Determine if a value is a view on an ArrayBuffer
154 *
155 * @param {*} val The value to test
156 *
157 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
158 */
159 function isArrayBufferView(val) {
160 var result;
161 if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
162 result = ArrayBuffer.isView(val);
163 } else {
164 result = val && val.buffer && isArrayBuffer(val.buffer);
165 }
166 return result;
167 }
168
169 /**
170 * Determine if a value is a String
171 *
172 * @param {*} val The value to test
173 *
174 * @returns {boolean} True if value is a String, otherwise false
175 */
176 var isString = typeOfTest('string');
177
178 /**
179 * Determine if a value is a Function
180 *
181 * @param {*} val The value to test
182 * @returns {boolean} True if value is a Function, otherwise false
183 */
184 var isFunction = typeOfTest('function');
185
186 /**
187 * Determine if a value is a Number
188 *
189 * @param {*} val The value to test
190 *
191 * @returns {boolean} True if value is a Number, otherwise false
192 */
193 var isNumber = typeOfTest('number');
194
195 /**
196 * Determine if a value is an Object
197 *
198 * @param {*} thing The value to test
199 *
200 * @returns {boolean} True if value is an Object, otherwise false
201 */
202 var isObject = function isObject(thing) {
203 return thing !== null && _typeof(thing) === 'object';
204 };
205
206 /**
207 * Determine if a value is a Boolean
208 *
209 * @param {*} thing The value to test
210 * @returns {boolean} True if value is a Boolean, otherwise false
211 */
212 var isBoolean = function isBoolean(thing) {
213 return thing === true || thing === false;
214 };
215
216 /**
217 * Determine if a value is a plain Object
218 *
219 * @param {*} val The value to test
220 *
221 * @returns {boolean} True if value is a plain Object, otherwise false
222 */
223 var isPlainObject = function isPlainObject(val) {
224 if (kindOf(val) !== 'object') {
225 return false;
226 }
227 var prototype = getPrototypeOf(val);
228 return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
229 };
230
231 /**
232 * Determine if a value is a Date
233 *
234 * @param {*} val The value to test
235 *
236 * @returns {boolean} True if value is a Date, otherwise false
237 */
238 var isDate = kindOfTest('Date');
239
240 /**
241 * Determine if a value is a File
242 *
243 * @param {*} val The value to test
244 *
245 * @returns {boolean} True if value is a File, otherwise false
246 */
247 var isFile = kindOfTest('File');
248
249 /**
250 * Determine if a value is a Blob
251 *
252 * @param {*} val The value to test
253 *
254 * @returns {boolean} True if value is a Blob, otherwise false
255 */
256 var isBlob = kindOfTest('Blob');
257
258 /**
259 * Determine if a value is a FileList
260 *
261 * @param {*} val The value to test
262 *
263 * @returns {boolean} True if value is a File, otherwise false
264 */
265 var isFileList = kindOfTest('FileList');
266
267 /**
268 * Determine if a value is a Stream
269 *
270 * @param {*} val The value to test
271 *
272 * @returns {boolean} True if value is a Stream, otherwise false
273 */
274 var isStream = function isStream(val) {
275 return isObject(val) && isFunction(val.pipe);
276 };
277
278 /**
279 * Determine if a value is a FormData
280 *
281 * @param {*} thing The value to test
282 *
283 * @returns {boolean} True if value is an FormData, otherwise false
284 */
285 var isFormData = function isFormData(thing) {
286 var pattern = '[object FormData]';
287 return thing && (typeof FormData === 'function' && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
288 };
289
290 /**
291 * Determine if a value is a URLSearchParams object
292 *
293 * @param {*} val The value to test
294 *
295 * @returns {boolean} True if value is a URLSearchParams object, otherwise false
296 */
297 var isURLSearchParams = kindOfTest('URLSearchParams');
298
299 /**
300 * Trim excess whitespace off the beginning and end of a string
301 *
302 * @param {String} str The String to trim
303 *
304 * @returns {String} The String freed of excess whitespace
305 */
306 var trim = function trim(str) {
307 return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
308 };
309
310 /**
311 * Iterate over an Array or an Object invoking a function for each item.
312 *
313 * If `obj` is an Array callback will be called passing
314 * the value, index, and complete array for each item.
315 *
316 * If 'obj' is an Object callback will be called passing
317 * the value, key, and complete object for each property.
318 *
319 * @param {Object|Array} obj The object to iterate
320 * @param {Function} fn The callback to invoke for each item
321 *
322 * @param {Boolean} [allOwnKeys = false]
323 * @returns {any}
324 */
325 function forEach(obj, fn) {
326 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
327 _ref$allOwnKeys = _ref.allOwnKeys,
328 allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
329 // Don't bother if no value provided
330 if (obj === null || typeof obj === 'undefined') {
331 return;
332 }
333 var i;
334 var l;
335
336 // Force an array if not already something iterable
337 if (_typeof(obj) !== 'object') {
338 /*eslint no-param-reassign:0*/
339 obj = [obj];
340 }
341 if (isArray(obj)) {
342 // Iterate over array values
343 for (i = 0, l = obj.length; i < l; i++) {
344 fn.call(null, obj[i], i, obj);
345 }
346 } else {
347 // Iterate over object keys
348 var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
349 var len = keys.length;
350 var key;
351 for (i = 0; i < len; i++) {
352 key = keys[i];
353 fn.call(null, obj[key], key, obj);
354 }
355 }
356 }
357 function findKey(obj, key) {
358 key = key.toLowerCase();
359 var keys = Object.keys(obj);
360 var i = keys.length;
361 var _key;
362 while (i-- > 0) {
363 _key = keys[i];
364 if (key === _key.toLowerCase()) {
365 return _key;
366 }
367 }
368 return null;
369 }
370 var _global = function () {
371 /*eslint no-undef:0*/
372 if (typeof globalThis !== "undefined") return globalThis;
373 return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;
374 }();
375 var isContextDefined = function isContextDefined(context) {
376 return !isUndefined(context) && context !== _global;
377 };
378
379 /**
380 * Accepts varargs expecting each argument to be an object, then
381 * immutably merges the properties of each object and returns result.
382 *
383 * When multiple objects contain the same key the later object in
384 * the arguments list will take precedence.
385 *
386 * Example:
387 *
388 * ```js
389 * var result = merge({foo: 123}, {foo: 456});
390 * console.log(result.foo); // outputs 456
391 * ```
392 *
393 * @param {Object} obj1 Object to merge
394 *
395 * @returns {Object} Result of all merge properties
396 */
397 function /* obj1, obj2, obj3, ... */
398 merge() {
399 var _ref2 = isContextDefined(this) && this || {},
400 caseless = _ref2.caseless;
401 var result = {};
402 var assignValue = function assignValue(val, key) {
403 var targetKey = caseless && findKey(result, key) || key;
404 if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
405 result[targetKey] = merge(result[targetKey], val);
406 } else if (isPlainObject(val)) {
407 result[targetKey] = merge({}, val);
408 } else if (isArray(val)) {
409 result[targetKey] = val.slice();
410 } else {
411 result[targetKey] = val;
412 }
413 };
414 for (var i = 0, l = arguments.length; i < l; i++) {
415 arguments[i] && forEach(arguments[i], assignValue);
416 }
417 return result;
418 }
419
420 /**
421 * Extends object a by mutably adding to it the properties of object b.
422 *
423 * @param {Object} a The object to be extended
424 * @param {Object} b The object to copy properties from
425 * @param {Object} thisArg The object to bind function to
426 *
427 * @param {Boolean} [allOwnKeys]
428 * @returns {Object} The resulting value of object a
429 */
430 var extend = function extend(a, b, thisArg) {
431 var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
432 allOwnKeys = _ref3.allOwnKeys;
433 forEach(b, function (val, key) {
434 if (thisArg && isFunction(val)) {
435 a[key] = bind(val, thisArg);
436 } else {
437 a[key] = val;
438 }
439 }, {
440 allOwnKeys: allOwnKeys
441 });
442 return a;
443 };
444
445 /**
446 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
447 *
448 * @param {string} content with BOM
449 *
450 * @returns {string} content value without BOM
451 */
452 var stripBOM = function stripBOM(content) {
453 if (content.charCodeAt(0) === 0xFEFF) {
454 content = content.slice(1);
455 }
456 return content;
457 };
458
459 /**
460 * Inherit the prototype methods from one constructor into another
461 * @param {function} constructor
462 * @param {function} superConstructor
463 * @param {object} [props]
464 * @param {object} [descriptors]
465 *
466 * @returns {void}
467 */
468 var inherits = function inherits(constructor, superConstructor, props, descriptors) {
469 constructor.prototype = Object.create(superConstructor.prototype, descriptors);
470 constructor.prototype.constructor = constructor;
471 Object.defineProperty(constructor, 'super', {
472 value: superConstructor.prototype
473 });
474 props && Object.assign(constructor.prototype, props);
475 };
476
477 /**
478 * Resolve object with deep prototype chain to a flat object
479 * @param {Object} sourceObj source object
480 * @param {Object} [destObj]
481 * @param {Function|Boolean} [filter]
482 * @param {Function} [propFilter]
483 *
484 * @returns {Object}
485 */
486 var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) {
487 var props;
488 var i;
489 var prop;
490 var merged = {};
491 destObj = destObj || {};
492 // eslint-disable-next-line no-eq-null,eqeqeq
493 if (sourceObj == null) return destObj;
494 do {
495 props = Object.getOwnPropertyNames(sourceObj);
496 i = props.length;
497 while (i-- > 0) {
498 prop = props[i];
499 if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
500 destObj[prop] = sourceObj[prop];
501 merged[prop] = true;
502 }
503 }
504 sourceObj = filter !== false && getPrototypeOf(sourceObj);
505 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
506 return destObj;
507 };
508
509 /**
510 * Determines whether a string ends with the characters of a specified string
511 *
512 * @param {String} str
513 * @param {String} searchString
514 * @param {Number} [position= 0]
515 *
516 * @returns {boolean}
517 */
518 var endsWith = function endsWith(str, searchString, position) {
519 str = String(str);
520 if (position === undefined || position > str.length) {
521 position = str.length;
522 }
523 position -= searchString.length;
524 var lastIndex = str.indexOf(searchString, position);
525 return lastIndex !== -1 && lastIndex === position;
526 };
527
528 /**
529 * Returns new array from array like object or null if failed
530 *
531 * @param {*} [thing]
532 *
533 * @returns {?Array}
534 */
535 var toArray = function toArray(thing) {
536 if (!thing) return null;
537 if (isArray(thing)) return thing;
538 var i = thing.length;
539 if (!isNumber(i)) return null;
540 var arr = new Array(i);
541 while (i-- > 0) {
542 arr[i] = thing[i];
543 }
544 return arr;
545 };
546
547 /**
548 * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
549 * thing passed in is an instance of Uint8Array
550 *
551 * @param {TypedArray}
552 *
553 * @returns {Array}
554 */
555 // eslint-disable-next-line func-names
556 var isTypedArray = function (TypedArray) {
557 // eslint-disable-next-line func-names
558 return function (thing) {
559 return TypedArray && thing instanceof TypedArray;
560 };
561 }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
562
563 /**
564 * For each entry in the object, call the function with the key and value.
565 *
566 * @param {Object<any, any>} obj - The object to iterate over.
567 * @param {Function} fn - The function to call for each entry.
568 *
569 * @returns {void}
570 */
571 var forEachEntry = function forEachEntry(obj, fn) {
572 var generator = obj && obj[Symbol.iterator];
573 var iterator = generator.call(obj);
574 var result;
575 while ((result = iterator.next()) && !result.done) {
576 var pair = result.value;
577 fn.call(obj, pair[0], pair[1]);
578 }
579 };
580
581 /**
582 * It takes a regular expression and a string, and returns an array of all the matches
583 *
584 * @param {string} regExp - The regular expression to match against.
585 * @param {string} str - The string to search.
586 *
587 * @returns {Array<boolean>}
588 */
589 var matchAll = function matchAll(regExp, str) {
590 var matches;
591 var arr = [];
592 while ((matches = regExp.exec(str)) !== null) {
593 arr.push(matches);
594 }
595 return arr;
596 };
597
598 /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
599 var isHTMLForm = kindOfTest('HTMLFormElement');
600 var toCamelCase = function toCamelCase(str) {
601 return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
602 return p1.toUpperCase() + p2;
603 });
604 };
605
606 /* Creating a function that will check if an object has a property. */
607 var hasOwnProperty = function (_ref4) {
608 var hasOwnProperty = _ref4.hasOwnProperty;
609 return function (obj, prop) {
610 return hasOwnProperty.call(obj, prop);
611 };
612 }(Object.prototype);
613
614 /**
615 * Determine if a value is a RegExp object
616 *
617 * @param {*} val The value to test
618 *
619 * @returns {boolean} True if value is a RegExp object, otherwise false
620 */
621 var isRegExp = kindOfTest('RegExp');
622 var reduceDescriptors = function reduceDescriptors(obj, reducer) {
623 var descriptors = Object.getOwnPropertyDescriptors(obj);
624 var reducedDescriptors = {};
625 forEach(descriptors, function (descriptor, name) {
626 if (reducer(descriptor, name, obj) !== false) {
627 reducedDescriptors[name] = descriptor;
628 }
629 });
630 Object.defineProperties(obj, reducedDescriptors);
631 };
632
633 /**
634 * Makes all methods read-only
635 * @param {Object} obj
636 */
637
638 var freezeMethods = function freezeMethods(obj) {
639 reduceDescriptors(obj, function (descriptor, name) {
640 // skip restricted props in strict mode
641 if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
642 return false;
643 }
644 var value = obj[name];
645 if (!isFunction(value)) return;
646 descriptor.enumerable = false;
647 if ('writable' in descriptor) {
648 descriptor.writable = false;
649 return;
650 }
651 if (!descriptor.set) {
652 descriptor.set = function () {
653 throw Error('Can not rewrite read-only method \'' + name + '\'');
654 };
655 }
656 });
657 };
658 var toObjectSet = function toObjectSet(arrayOrString, delimiter) {
659 var obj = {};
660 var define = function define(arr) {
661 arr.forEach(function (value) {
662 obj[value] = true;
663 });
664 };
665 isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
666 return obj;
667 };
668 var noop = function noop() {};
669 var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
670 value = +value;
671 return Number.isFinite(value) ? value : defaultValue;
672 };
673 var toJSONObject = function toJSONObject(obj) {
674 var stack = new Array(10);
675 var visit = function visit(source, i) {
676 if (isObject(source)) {
677 if (stack.indexOf(source) >= 0) {
678 return;
679 }
680 if (!('toJSON' in source)) {
681 stack[i] = source;
682 var target = isArray(source) ? [] : {};
683 forEach(source, function (value, key) {
684 var reducedValue = visit(value, i + 1);
685 !isUndefined(reducedValue) && (target[key] = reducedValue);
686 });
687 stack[i] = undefined;
688 return target;
689 }
690 }
691 return source;
692 };
693 return visit(obj, 0);
694 };
695 var utils = {
696 isArray: isArray,
697 isArrayBuffer: isArrayBuffer,
698 isBuffer: isBuffer,
699 isFormData: isFormData,
700 isArrayBufferView: isArrayBufferView,
701 isString: isString,
702 isNumber: isNumber,
703 isBoolean: isBoolean,
704 isObject: isObject,
705 isPlainObject: isPlainObject,
706 isUndefined: isUndefined,
707 isDate: isDate,
708 isFile: isFile,
709 isBlob: isBlob,
710 isRegExp: isRegExp,
711 isFunction: isFunction,
712 isStream: isStream,
713 isURLSearchParams: isURLSearchParams,
714 isTypedArray: isTypedArray,
715 isFileList: isFileList,
716 forEach: forEach,
717 merge: merge,
718 extend: extend,
719 trim: trim,
720 stripBOM: stripBOM,
721 inherits: inherits,
722 toFlatObject: toFlatObject,
723 kindOf: kindOf,
724 kindOfTest: kindOfTest,
725 endsWith: endsWith,
726 toArray: toArray,
727 forEachEntry: forEachEntry,
728 matchAll: matchAll,
729 isHTMLForm: isHTMLForm,
730 hasOwnProperty: hasOwnProperty,
731 hasOwnProp: hasOwnProperty,
732 // an alias to avoid ESLint no-prototype-builtins detection
733 reduceDescriptors: reduceDescriptors,
734 freezeMethods: freezeMethods,
735 toObjectSet: toObjectSet,
736 toCamelCase: toCamelCase,
737 noop: noop,
738 toFiniteNumber: toFiniteNumber,
739 findKey: findKey,
740 global: _global,
741 isContextDefined: isContextDefined,
742 toJSONObject: toJSONObject
743 };
744
745 /**
746 * Create an Error with the specified message, config, error code, request and response.
747 *
748 * @param {string} message The error message.
749 * @param {string} [code] The error code (for example, 'ECONNABORTED').
750 * @param {Object} [config] The config.
751 * @param {Object} [request] The request.
752 * @param {Object} [response] The response.
753 *
754 * @returns {Error} The created error.
755 */
756 function AxiosError(message, code, config, request, response) {
757 Error.call(this);
758 if (Error.captureStackTrace) {
759 Error.captureStackTrace(this, this.constructor);
760 } else {
761 this.stack = new Error().stack;
762 }
763 this.message = message;
764 this.name = 'AxiosError';
765 code && (this.code = code);
766 config && (this.config = config);
767 request && (this.request = request);
768 response && (this.response = response);
769 }
770 utils.inherits(AxiosError, Error, {
771 toJSON: function toJSON() {
772 return {
773 // Standard
774 message: this.message,
775 name: this.name,
776 // Microsoft
777 description: this.description,
778 number: this.number,
779 // Mozilla
780 fileName: this.fileName,
781 lineNumber: this.lineNumber,
782 columnNumber: this.columnNumber,
783 stack: this.stack,
784 // Axios
785 config: utils.toJSONObject(this.config),
786 code: this.code,
787 status: this.response && this.response.status ? this.response.status : null
788 };
789 }
790 });
791 var prototype$1 = AxiosError.prototype;
792 var descriptors = {};
793 ['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL'
794 // eslint-disable-next-line func-names
795 ].forEach(function (code) {
796 descriptors[code] = {
797 value: code
798 };
799 });
800 Object.defineProperties(AxiosError, descriptors);
801 Object.defineProperty(prototype$1, 'isAxiosError', {
802 value: true
803 });
804
805 // eslint-disable-next-line func-names
806 AxiosError.from = function (error, code, config, request, response, customProps) {
807 var axiosError = Object.create(prototype$1);
808 utils.toFlatObject(error, axiosError, function filter(obj) {
809 return obj !== Error.prototype;
810 }, function (prop) {
811 return prop !== 'isAxiosError';
812 });
813 AxiosError.call(axiosError, error.message, code, config, request, response);
814 axiosError.cause = error;
815 axiosError.name = error.name;
816 customProps && Object.assign(axiosError, customProps);
817 return axiosError;
818 };
819
820 /* eslint-env browser */
821 var browser = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' ? self.FormData : window.FormData;
822 var FormData$2 = browser;
823
824 /**
825 * Determines if the given thing is a array or js object.
826 *
827 * @param {string} thing - The object or array to be visited.
828 *
829 * @returns {boolean}
830 */
831 function isVisitable(thing) {
832 return utils.isPlainObject(thing) || utils.isArray(thing);
833 }
834
835 /**
836 * It removes the brackets from the end of a string
837 *
838 * @param {string} key - The key of the parameter.
839 *
840 * @returns {string} the key without the brackets.
841 */
842 function removeBrackets(key) {
843 return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
844 }
845
846 /**
847 * It takes a path, a key, and a boolean, and returns a string
848 *
849 * @param {string} path - The path to the current key.
850 * @param {string} key - The key of the current object being iterated over.
851 * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
852 *
853 * @returns {string} The path to the current key.
854 */
855 function renderKey(path, key, dots) {
856 if (!path) return key;
857 return path.concat(key).map(function each(token, i) {
858 // eslint-disable-next-line no-param-reassign
859 token = removeBrackets(token);
860 return !dots && i ? '[' + token + ']' : token;
861 }).join(dots ? '.' : '');
862 }
863
864 /**
865 * If the array is an array and none of its elements are visitable, then it's a flat array.
866 *
867 * @param {Array<any>} arr - The array to check
868 *
869 * @returns {boolean}
870 */
871 function isFlatArray(arr) {
872 return utils.isArray(arr) && !arr.some(isVisitable);
873 }
874 var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
875 return /^is[A-Z]/.test(prop);
876 });
877
878 /**
879 * If the thing is a FormData object, return true, otherwise return false.
880 *
881 * @param {unknown} thing - The thing to check.
882 *
883 * @returns {boolean}
884 */
885 function isSpecCompliant(thing) {
886 return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
887 }
888
889 /**
890 * Convert a data object to FormData
891 *
892 * @param {Object} obj
893 * @param {?Object} [formData]
894 * @param {?Object} [options]
895 * @param {Function} [options.visitor]
896 * @param {Boolean} [options.metaTokens = true]
897 * @param {Boolean} [options.dots = false]
898 * @param {?Boolean} [options.indexes = false]
899 *
900 * @returns {Object}
901 **/
902
903 /**
904 * It converts an object into a FormData object
905 *
906 * @param {Object<any, any>} obj - The object to convert to form data.
907 * @param {string} formData - The FormData object to append to.
908 * @param {Object<string, any>} options
909 *
910 * @returns
911 */
912 function toFormData(obj, formData, options) {
913 if (!utils.isObject(obj)) {
914 throw new TypeError('target must be an object');
915 }
916
917 // eslint-disable-next-line no-param-reassign
918 formData = formData || new (FormData$2 || FormData)();
919
920 // eslint-disable-next-line no-param-reassign
921 options = utils.toFlatObject(options, {
922 metaTokens: true,
923 dots: false,
924 indexes: false
925 }, false, function defined(option, source) {
926 // eslint-disable-next-line no-eq-null,eqeqeq
927 return !utils.isUndefined(source[option]);
928 });
929 var metaTokens = options.metaTokens;
930 // eslint-disable-next-line no-use-before-define
931 var visitor = options.visitor || defaultVisitor;
932 var dots = options.dots;
933 var indexes = options.indexes;
934 var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
935 var useBlob = _Blob && isSpecCompliant(formData);
936 if (!utils.isFunction(visitor)) {
937 throw new TypeError('visitor must be a function');
938 }
939 function convertValue(value) {
940 if (value === null) return '';
941 if (utils.isDate(value)) {
942 return value.toISOString();
943 }
944 if (!useBlob && utils.isBlob(value)) {
945 throw new AxiosError('Blob is not supported. Use a Buffer instead.');
946 }
947 if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
948 return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
949 }
950 return value;
951 }
952
953 /**
954 * Default visitor.
955 *
956 * @param {*} value
957 * @param {String|Number} key
958 * @param {Array<String|Number>} path
959 * @this {FormData}
960 *
961 * @returns {boolean} return true to visit the each prop of the value recursively
962 */
963 function defaultVisitor(value, key, path) {
964 var arr = value;
965 if (value && !path && _typeof(value) === 'object') {
966 if (utils.endsWith(key, '{}')) {
967 // eslint-disable-next-line no-param-reassign
968 key = metaTokens ? key : key.slice(0, -2);
969 // eslint-disable-next-line no-param-reassign
970 value = JSON.stringify(value);
971 } else if (utils.isArray(value) && isFlatArray(value) || utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
972 // eslint-disable-next-line no-param-reassign
973 key = removeBrackets(key);
974 arr.forEach(function each(el, index) {
975 !(utils.isUndefined(el) || el === null) && formData.append(
976 // eslint-disable-next-line no-nested-ternary
977 indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
978 });
979 return false;
980 }
981 }
982 if (isVisitable(value)) {
983 return true;
984 }
985 formData.append(renderKey(path, key, dots), convertValue(value));
986 return false;
987 }
988 var stack = [];
989 var exposedHelpers = Object.assign(predicates, {
990 defaultVisitor: defaultVisitor,
991 convertValue: convertValue,
992 isVisitable: isVisitable
993 });
994 function build(value, path) {
995 if (utils.isUndefined(value)) return;
996 if (stack.indexOf(value) !== -1) {
997 throw Error('Circular reference detected in ' + path.join('.'));
998 }
999 stack.push(value);
1000 utils.forEach(value, function each(el, key) {
1001 var result = !(utils.isUndefined(el) || el === null) && visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
1002 if (result === true) {
1003 build(el, path ? path.concat(key) : [key]);
1004 }
1005 });
1006 stack.pop();
1007 }
1008 if (!utils.isObject(obj)) {
1009 throw new TypeError('data must be an object');
1010 }
1011 build(obj);
1012 return formData;
1013 }
1014
1015 /**
1016 * It encodes a string by replacing all characters that are not in the unreserved set with
1017 * their percent-encoded equivalents
1018 *
1019 * @param {string} str - The string to encode.
1020 *
1021 * @returns {string} The encoded string.
1022 */
1023 function encode$1(str) {
1024 var charMap = {
1025 '!': '%21',
1026 "'": '%27',
1027 '(': '%28',
1028 ')': '%29',
1029 '~': '%7E',
1030 '%20': '+',
1031 '%00': '\x00'
1032 };
1033 return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1034 return charMap[match];
1035 });
1036 }
1037
1038 /**
1039 * It takes a params object and converts it to a FormData object
1040 *
1041 * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1042 * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1043 *
1044 * @returns {void}
1045 */
1046 function AxiosURLSearchParams(params, options) {
1047 this._pairs = [];
1048 params && toFormData(params, this, options);
1049 }
1050 var prototype = AxiosURLSearchParams.prototype;
1051 prototype.append = function append(name, value) {
1052 this._pairs.push([name, value]);
1053 };
1054 prototype.toString = function toString(encoder) {
1055 var _encode = encoder ? function (value) {
1056 return encoder.call(this, value, encode$1);
1057 } : encode$1;
1058 return this._pairs.map(function each(pair) {
1059 return _encode(pair[0]) + '=' + _encode(pair[1]);
1060 }, '').join('&');
1061 };
1062
1063 /**
1064 * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1065 * URI encoded counterparts
1066 *
1067 * @param {string} val The value to be encoded.
1068 *
1069 * @returns {string} The encoded value.
1070 */
1071 function encode(val) {
1072 return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
1073 }
1074
1075 /**
1076 * Build a URL by appending params to the end
1077 *
1078 * @param {string} url The base of the url (e.g., http://www.google.com)
1079 * @param {object} [params] The params to be appended
1080 * @param {?object} options
1081 *
1082 * @returns {string} The formatted url
1083 */
1084 function buildURL(url, params, options) {
1085 /*eslint no-param-reassign:0*/
1086 if (!params) {
1087 return url;
1088 }
1089 var _encode = options && options.encode || encode;
1090 var serializeFn = options && options.serialize;
1091 var serializedParams;
1092 if (serializeFn) {
1093 serializedParams = serializeFn(params, options);
1094 } else {
1095 serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
1096 }
1097 if (serializedParams) {
1098 var hashmarkIndex = url.indexOf("#");
1099 if (hashmarkIndex !== -1) {
1100 url = url.slice(0, hashmarkIndex);
1101 }
1102 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1103 }
1104 return url;
1105 }
1106
1107 var InterceptorManager = /*#__PURE__*/function () {
1108 function InterceptorManager() {
1109 _classCallCheck(this, InterceptorManager);
1110 this.handlers = [];
1111 }
1112
1113 /**
1114 * Add a new interceptor to the stack
1115 *
1116 * @param {Function} fulfilled The function to handle `then` for a `Promise`
1117 * @param {Function} rejected The function to handle `reject` for a `Promise`
1118 *
1119 * @return {Number} An ID used to remove interceptor later
1120 */
1121 _createClass(InterceptorManager, [{
1122 key: "use",
1123 value: function use(fulfilled, rejected, options) {
1124 this.handlers.push({
1125 fulfilled: fulfilled,
1126 rejected: rejected,
1127 synchronous: options ? options.synchronous : false,
1128 runWhen: options ? options.runWhen : null
1129 });
1130 return this.handlers.length - 1;
1131 }
1132
1133 /**
1134 * Remove an interceptor from the stack
1135 *
1136 * @param {Number} id The ID that was returned by `use`
1137 *
1138 * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1139 */
1140 }, {
1141 key: "eject",
1142 value: function eject(id) {
1143 if (this.handlers[id]) {
1144 this.handlers[id] = null;
1145 }
1146 }
1147
1148 /**
1149 * Clear all interceptors from the stack
1150 *
1151 * @returns {void}
1152 */
1153 }, {
1154 key: "clear",
1155 value: function clear() {
1156 if (this.handlers) {
1157 this.handlers = [];
1158 }
1159 }
1160
1161 /**
1162 * Iterate over all the registered interceptors
1163 *
1164 * This method is particularly useful for skipping over any
1165 * interceptors that may have become `null` calling `eject`.
1166 *
1167 * @param {Function} fn The function to call for each interceptor
1168 *
1169 * @returns {void}
1170 */
1171 }, {
1172 key: "forEach",
1173 value: function forEach(fn) {
1174 utils.forEach(this.handlers, function forEachHandler(h) {
1175 if (h !== null) {
1176 fn(h);
1177 }
1178 });
1179 }
1180 }]);
1181 return InterceptorManager;
1182 }();
1183 var InterceptorManager$1 = InterceptorManager;
1184
1185 var transitionalDefaults = {
1186 silentJSONParsing: true,
1187 forcedJSONParsing: true,
1188 clarifyTimeoutError: false
1189 };
1190
1191 var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1192
1193 var FormData$1 = FormData;
1194
1195 /**
1196 * Determine if we're running in a standard browser environment
1197 *
1198 * This allows axios to run in a web worker, and react-native.
1199 * Both environments support XMLHttpRequest, but not fully standard globals.
1200 *
1201 * web workers:
1202 * typeof window -> undefined
1203 * typeof document -> undefined
1204 *
1205 * react-native:
1206 * navigator.product -> 'ReactNative'
1207 * nativescript
1208 * navigator.product -> 'NativeScript' or 'NS'
1209 *
1210 * @returns {boolean}
1211 */
1212 var isStandardBrowserEnv = function () {
1213 var product;
1214 if (typeof navigator !== 'undefined' && ((product = navigator.product) === 'ReactNative' || product === 'NativeScript' || product === 'NS')) {
1215 return false;
1216 }
1217 return typeof window !== 'undefined' && typeof document !== 'undefined';
1218 }();
1219
1220 /**
1221 * Determine if we're running in a standard browser webWorker environment
1222 *
1223 * Although the `isStandardBrowserEnv` method indicates that
1224 * `allows axios to run in a web worker`, the WebWorker will still be
1225 * filtered out due to its judgment standard
1226 * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1227 * This leads to a problem when axios post `FormData` in webWorker
1228 */
1229 var isStandardBrowserWebWorkerEnv = function () {
1230 return typeof WorkerGlobalScope !== 'undefined' &&
1231 // eslint-disable-next-line no-undef
1232 self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1233 }();
1234 var platform = {
1235 isBrowser: true,
1236 classes: {
1237 URLSearchParams: URLSearchParams$1,
1238 FormData: FormData$1,
1239 Blob: Blob
1240 },
1241 isStandardBrowserEnv: isStandardBrowserEnv,
1242 isStandardBrowserWebWorkerEnv: isStandardBrowserWebWorkerEnv,
1243 protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1244 };
1245
1246 function toURLEncodedForm(data, options) {
1247 return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1248 visitor: function visitor(value, key, path, helpers) {
1249 if (platform.isNode && utils.isBuffer(value)) {
1250 this.append(key, value.toString('base64'));
1251 return false;
1252 }
1253 return helpers.defaultVisitor.apply(this, arguments);
1254 }
1255 }, options));
1256 }
1257
1258 /**
1259 * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1260 *
1261 * @param {string} name - The name of the property to get.
1262 *
1263 * @returns An array of strings.
1264 */
1265 function parsePropPath(name) {
1266 // foo[x][y][z]
1267 // foo.x.y.z
1268 // foo-x-y-z
1269 // foo x y z
1270 return utils.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
1271 return match[0] === '[]' ? '' : match[1] || match[0];
1272 });
1273 }
1274
1275 /**
1276 * Convert an array to an object.
1277 *
1278 * @param {Array<any>} arr - The array to convert to an object.
1279 *
1280 * @returns An object with the same keys and values as the array.
1281 */
1282 function arrayToObject(arr) {
1283 var obj = {};
1284 var keys = Object.keys(arr);
1285 var i;
1286 var len = keys.length;
1287 var key;
1288 for (i = 0; i < len; i++) {
1289 key = keys[i];
1290 obj[key] = arr[key];
1291 }
1292 return obj;
1293 }
1294
1295 /**
1296 * It takes a FormData object and returns a JavaScript object
1297 *
1298 * @param {string} formData The FormData object to convert to JSON.
1299 *
1300 * @returns {Object<string, any> | null} The converted object.
1301 */
1302 function formDataToJSON(formData) {
1303 function buildPath(path, value, target, index) {
1304 var name = path[index++];
1305 var isNumericKey = Number.isFinite(+name);
1306 var isLast = index >= path.length;
1307 name = !name && utils.isArray(target) ? target.length : name;
1308 if (isLast) {
1309 if (utils.hasOwnProp(target, name)) {
1310 target[name] = [target[name], value];
1311 } else {
1312 target[name] = value;
1313 }
1314 return !isNumericKey;
1315 }
1316 if (!target[name] || !utils.isObject(target[name])) {
1317 target[name] = [];
1318 }
1319 var result = buildPath(path, value, target[name], index);
1320 if (result && utils.isArray(target[name])) {
1321 target[name] = arrayToObject(target[name]);
1322 }
1323 return !isNumericKey;
1324 }
1325 if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1326 var obj = {};
1327 utils.forEachEntry(formData, function (name, value) {
1328 buildPath(parsePropPath(name), value, obj, 0);
1329 });
1330 return obj;
1331 }
1332 return null;
1333 }
1334
1335 var DEFAULT_CONTENT_TYPE = {
1336 'Content-Type': undefined
1337 };
1338
1339 /**
1340 * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1341 * of the input
1342 *
1343 * @param {any} rawValue - The value to be stringified.
1344 * @param {Function} parser - A function that parses a string into a JavaScript object.
1345 * @param {Function} encoder - A function that takes a value and returns a string.
1346 *
1347 * @returns {string} A stringified version of the rawValue.
1348 */
1349 function stringifySafely(rawValue, parser, encoder) {
1350 if (utils.isString(rawValue)) {
1351 try {
1352 (parser || JSON.parse)(rawValue);
1353 return utils.trim(rawValue);
1354 } catch (e) {
1355 if (e.name !== 'SyntaxError') {
1356 throw e;
1357 }
1358 }
1359 }
1360 return (encoder || JSON.stringify)(rawValue);
1361 }
1362 var defaults = {
1363 transitional: transitionalDefaults,
1364 adapter: ['xhr', 'http'],
1365 transformRequest: [function transformRequest(data, headers) {
1366 var contentType = headers.getContentType() || '';
1367 var hasJSONContentType = contentType.indexOf('application/json') > -1;
1368 var isObjectPayload = utils.isObject(data);
1369 if (isObjectPayload && utils.isHTMLForm(data)) {
1370 data = new FormData(data);
1371 }
1372 var isFormData = utils.isFormData(data);
1373 if (isFormData) {
1374 if (!hasJSONContentType) {
1375 return data;
1376 }
1377 return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1378 }
1379 if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
1380 return data;
1381 }
1382 if (utils.isArrayBufferView(data)) {
1383 return data.buffer;
1384 }
1385 if (utils.isURLSearchParams(data)) {
1386 headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1387 return data.toString();
1388 }
1389 var isFileList;
1390 if (isObjectPayload) {
1391 if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1392 return toURLEncodedForm(data, this.formSerializer).toString();
1393 }
1394 if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1395 var _FormData = this.env && this.env.FormData;
1396 return toFormData(isFileList ? {
1397 'files[]': data
1398 } : data, _FormData && new _FormData(), this.formSerializer);
1399 }
1400 }
1401 if (isObjectPayload || hasJSONContentType) {
1402 headers.setContentType('application/json', false);
1403 return stringifySafely(data);
1404 }
1405 return data;
1406 }],
1407 transformResponse: [function transformResponse(data) {
1408 var transitional = this.transitional || defaults.transitional;
1409 var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1410 var JSONRequested = this.responseType === 'json';
1411 if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1412 var silentJSONParsing = transitional && transitional.silentJSONParsing;
1413 var strictJSONParsing = !silentJSONParsing && JSONRequested;
1414 try {
1415 return JSON.parse(data);
1416 } catch (e) {
1417 if (strictJSONParsing) {
1418 if (e.name === 'SyntaxError') {
1419 throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1420 }
1421 throw e;
1422 }
1423 }
1424 }
1425 return data;
1426 }],
1427 /**
1428 * A timeout in milliseconds to abort a request. If set to 0 (default) a
1429 * timeout is not created.
1430 */
1431 timeout: 0,
1432 xsrfCookieName: 'XSRF-TOKEN',
1433 xsrfHeaderName: 'X-XSRF-TOKEN',
1434 maxContentLength: -1,
1435 maxBodyLength: -1,
1436 env: {
1437 FormData: platform.classes.FormData,
1438 Blob: platform.classes.Blob
1439 },
1440 validateStatus: function validateStatus(status) {
1441 return status >= 200 && status < 300;
1442 },
1443 headers: {
1444 common: {
1445 'Accept': 'application/json, text/plain, */*'
1446 }
1447 }
1448 };
1449 utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1450 defaults.headers[method] = {};
1451 });
1452 utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1453 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1454 });
1455 var defaults$1 = defaults;
1456
1457 // RawAxiosHeaders whose duplicates are ignored by node
1458 // c.f. https://nodejs.org/api/http.html#http_message_headers
1459 var ignoreDuplicateOf = utils.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
1460
1461 /**
1462 * Parse headers into an object
1463 *
1464 * ```
1465 * Date: Wed, 27 Aug 2014 08:58:49 GMT
1466 * Content-Type: application/json
1467 * Connection: keep-alive
1468 * Transfer-Encoding: chunked
1469 * ```
1470 *
1471 * @param {String} rawHeaders Headers needing to be parsed
1472 *
1473 * @returns {Object} Headers parsed into an object
1474 */
1475 var parseHeaders = (function (rawHeaders) {
1476 var parsed = {};
1477 var key;
1478 var val;
1479 var i;
1480 rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1481 i = line.indexOf(':');
1482 key = line.substring(0, i).trim().toLowerCase();
1483 val = line.substring(i + 1).trim();
1484 if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1485 return;
1486 }
1487 if (key === 'set-cookie') {
1488 if (parsed[key]) {
1489 parsed[key].push(val);
1490 } else {
1491 parsed[key] = [val];
1492 }
1493 } else {
1494 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1495 }
1496 });
1497 return parsed;
1498 });
1499
1500 var $internals = Symbol('internals');
1501 function normalizeHeader(header) {
1502 return header && String(header).trim().toLowerCase();
1503 }
1504 function normalizeValue(value) {
1505 if (value === false || value == null) {
1506 return value;
1507 }
1508 return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1509 }
1510 function parseTokens(str) {
1511 var tokens = Object.create(null);
1512 var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1513 var match;
1514 while (match = tokensRE.exec(str)) {
1515 tokens[match[1]] = match[2];
1516 }
1517 return tokens;
1518 }
1519 function isValidHeaderName(str) {
1520 return /^[-_a-zA-Z]+$/.test(str.trim());
1521 }
1522 function matchHeaderValue(context, value, header, filter) {
1523 if (utils.isFunction(filter)) {
1524 return filter.call(this, value, header);
1525 }
1526 if (!utils.isString(value)) return;
1527 if (utils.isString(filter)) {
1528 return value.indexOf(filter) !== -1;
1529 }
1530 if (utils.isRegExp(filter)) {
1531 return filter.test(value);
1532 }
1533 }
1534 function formatHeader(header) {
1535 return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
1536 return _char.toUpperCase() + str;
1537 });
1538 }
1539 function buildAccessors(obj, header) {
1540 var accessorName = utils.toCamelCase(' ' + header);
1541 ['get', 'set', 'has'].forEach(function (methodName) {
1542 Object.defineProperty(obj, methodName + accessorName, {
1543 value: function value(arg1, arg2, arg3) {
1544 return this[methodName].call(this, header, arg1, arg2, arg3);
1545 },
1546 configurable: true
1547 });
1548 });
1549 }
1550 var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
1551 function AxiosHeaders(headers) {
1552 _classCallCheck(this, AxiosHeaders);
1553 headers && this.set(headers);
1554 }
1555 _createClass(AxiosHeaders, [{
1556 key: "set",
1557 value: function set(header, valueOrRewrite, rewrite) {
1558 var self = this;
1559 function setHeader(_value, _header, _rewrite) {
1560 var lHeader = normalizeHeader(_header);
1561 if (!lHeader) {
1562 throw new Error('header name must be a non-empty string');
1563 }
1564 var key = utils.findKey(self, lHeader);
1565 if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1566 self[key || _header] = normalizeValue(_value);
1567 }
1568 }
1569 var setHeaders = function setHeaders(headers, _rewrite) {
1570 return utils.forEach(headers, function (_value, _header) {
1571 return setHeader(_value, _header, _rewrite);
1572 });
1573 };
1574 if (utils.isPlainObject(header) || header instanceof this.constructor) {
1575 setHeaders(header, valueOrRewrite);
1576 } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1577 setHeaders(parseHeaders(header), valueOrRewrite);
1578 } else {
1579 header != null && setHeader(valueOrRewrite, header, rewrite);
1580 }
1581 return this;
1582 }
1583 }, {
1584 key: "get",
1585 value: function get(header, parser) {
1586 header = normalizeHeader(header);
1587 if (header) {
1588 var key = utils.findKey(this, header);
1589 if (key) {
1590 var value = this[key];
1591 if (!parser) {
1592 return value;
1593 }
1594 if (parser === true) {
1595 return parseTokens(value);
1596 }
1597 if (utils.isFunction(parser)) {
1598 return parser.call(this, value, key);
1599 }
1600 if (utils.isRegExp(parser)) {
1601 return parser.exec(value);
1602 }
1603 throw new TypeError('parser must be boolean|regexp|function');
1604 }
1605 }
1606 }
1607 }, {
1608 key: "has",
1609 value: function has(header, matcher) {
1610 header = normalizeHeader(header);
1611 if (header) {
1612 var key = utils.findKey(this, header);
1613 return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1614 }
1615 return false;
1616 }
1617 }, {
1618 key: "delete",
1619 value: function _delete(header, matcher) {
1620 var self = this;
1621 var deleted = false;
1622 function deleteHeader(_header) {
1623 _header = normalizeHeader(_header);
1624 if (_header) {
1625 var key = utils.findKey(self, _header);
1626 if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1627 delete self[key];
1628 deleted = true;
1629 }
1630 }
1631 }
1632 if (utils.isArray(header)) {
1633 header.forEach(deleteHeader);
1634 } else {
1635 deleteHeader(header);
1636 }
1637 return deleted;
1638 }
1639 }, {
1640 key: "clear",
1641 value: function clear() {
1642 return Object.keys(this).forEach(this["delete"].bind(this));
1643 }
1644 }, {
1645 key: "normalize",
1646 value: function normalize(format) {
1647 var self = this;
1648 var headers = {};
1649 utils.forEach(this, function (value, header) {
1650 var key = utils.findKey(headers, header);
1651 if (key) {
1652 self[key] = normalizeValue(value);
1653 delete self[header];
1654 return;
1655 }
1656 var normalized = format ? formatHeader(header) : String(header).trim();
1657 if (normalized !== header) {
1658 delete self[header];
1659 }
1660 self[normalized] = normalizeValue(value);
1661 headers[normalized] = true;
1662 });
1663 return this;
1664 }
1665 }, {
1666 key: "concat",
1667 value: function concat() {
1668 var _this$constructor;
1669 for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
1670 targets[_key] = arguments[_key];
1671 }
1672 return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
1673 }
1674 }, {
1675 key: "toJSON",
1676 value: function toJSON(asStrings) {
1677 var obj = Object.create(null);
1678 utils.forEach(this, function (value, header) {
1679 value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1680 });
1681 return obj;
1682 }
1683 }, {
1684 key: _Symbol$iterator,
1685 value: function value() {
1686 return Object.entries(this.toJSON())[Symbol.iterator]();
1687 }
1688 }, {
1689 key: "toString",
1690 value: function toString() {
1691 return Object.entries(this.toJSON()).map(function (_ref) {
1692 var _ref2 = _slicedToArray(_ref, 2),
1693 header = _ref2[0],
1694 value = _ref2[1];
1695 return header + ': ' + value;
1696 }).join('\n');
1697 }
1698 }, {
1699 key: _Symbol$toStringTag,
1700 get: function get() {
1701 return 'AxiosHeaders';
1702 }
1703 }], [{
1704 key: "from",
1705 value: function from(thing) {
1706 return thing instanceof this ? thing : new this(thing);
1707 }
1708 }, {
1709 key: "concat",
1710 value: function concat(first) {
1711 var computed = new this(first);
1712 for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1713 targets[_key2 - 1] = arguments[_key2];
1714 }
1715 targets.forEach(function (target) {
1716 return computed.set(target);
1717 });
1718 return computed;
1719 }
1720 }, {
1721 key: "accessor",
1722 value: function accessor(header) {
1723 var internals = this[$internals] = this[$internals] = {
1724 accessors: {}
1725 };
1726 var accessors = internals.accessors;
1727 var prototype = this.prototype;
1728 function defineAccessor(_header) {
1729 var lHeader = normalizeHeader(_header);
1730 if (!accessors[lHeader]) {
1731 buildAccessors(prototype, _header);
1732 accessors[lHeader] = true;
1733 }
1734 }
1735 utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1736 return this;
1737 }
1738 }]);
1739 return AxiosHeaders;
1740 }(Symbol.iterator, Symbol.toStringTag);
1741 AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
1742 utils.freezeMethods(AxiosHeaders.prototype);
1743 utils.freezeMethods(AxiosHeaders);
1744 var AxiosHeaders$1 = AxiosHeaders;
1745
1746 /**
1747 * Transform the data for a request or a response
1748 *
1749 * @param {Array|Function} fns A single function or Array of functions
1750 * @param {?Object} response The response object
1751 *
1752 * @returns {*} The resulting transformed data
1753 */
1754 function transformData(fns, response) {
1755 var config = this || defaults$1;
1756 var context = response || config;
1757 var headers = AxiosHeaders$1.from(context.headers);
1758 var data = context.data;
1759 utils.forEach(fns, function transform(fn) {
1760 data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1761 });
1762 headers.normalize();
1763 return data;
1764 }
1765
1766 function isCancel(value) {
1767 return !!(value && value.__CANCEL__);
1768 }
1769
1770 /**
1771 * A `CanceledError` is an object that is thrown when an operation is canceled.
1772 *
1773 * @param {string=} message The message.
1774 * @param {Object=} config The config.
1775 * @param {Object=} request The request.
1776 *
1777 * @returns {CanceledError} The created error.
1778 */
1779 function CanceledError(message, config, request) {
1780 // eslint-disable-next-line no-eq-null,eqeqeq
1781 AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1782 this.name = 'CanceledError';
1783 }
1784 utils.inherits(CanceledError, AxiosError, {
1785 __CANCEL__: true
1786 });
1787
1788 // eslint-disable-next-line strict
1789 var httpAdapter = null;
1790
1791 /**
1792 * Resolve or reject a Promise based on response status.
1793 *
1794 * @param {Function} resolve A function that resolves the promise.
1795 * @param {Function} reject A function that rejects the promise.
1796 * @param {object} response The response.
1797 *
1798 * @returns {object} The response.
1799 */
1800 function settle(resolve, reject, response) {
1801 var validateStatus = response.config.validateStatus;
1802 if (!response.status || !validateStatus || validateStatus(response.status)) {
1803 resolve(response);
1804 } else {
1805 reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
1806 }
1807 }
1808
1809 var cookies = platform.isStandardBrowserEnv ?
1810 // Standard browser envs support document.cookie
1811 function standardBrowserEnv() {
1812 return {
1813 write: function write(name, value, expires, path, domain, secure) {
1814 var cookie = [];
1815 cookie.push(name + '=' + encodeURIComponent(value));
1816 if (utils.isNumber(expires)) {
1817 cookie.push('expires=' + new Date(expires).toGMTString());
1818 }
1819 if (utils.isString(path)) {
1820 cookie.push('path=' + path);
1821 }
1822 if (utils.isString(domain)) {
1823 cookie.push('domain=' + domain);
1824 }
1825 if (secure === true) {
1826 cookie.push('secure');
1827 }
1828 document.cookie = cookie.join('; ');
1829 },
1830 read: function read(name) {
1831 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1832 return match ? decodeURIComponent(match[3]) : null;
1833 },
1834 remove: function remove(name) {
1835 this.write(name, '', Date.now() - 86400000);
1836 }
1837 };
1838 }() :
1839 // Non standard browser env (web workers, react-native) lack needed support.
1840 function nonStandardBrowserEnv() {
1841 return {
1842 write: function write() {},
1843 read: function read() {
1844 return null;
1845 },
1846 remove: function remove() {}
1847 };
1848 }();
1849
1850 /**
1851 * Determines whether the specified URL is absolute
1852 *
1853 * @param {string} url The URL to test
1854 *
1855 * @returns {boolean} True if the specified URL is absolute, otherwise false
1856 */
1857 function isAbsoluteURL(url) {
1858 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1859 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1860 // by any combination of letters, digits, plus, period, or hyphen.
1861 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1862 }
1863
1864 /**
1865 * Creates a new URL by combining the specified URLs
1866 *
1867 * @param {string} baseURL The base URL
1868 * @param {string} relativeURL The relative URL
1869 *
1870 * @returns {string} The combined URL
1871 */
1872 function combineURLs(baseURL, relativeURL) {
1873 return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
1874 }
1875
1876 /**
1877 * Creates a new URL by combining the baseURL with the requestedURL,
1878 * only when the requestedURL is not already an absolute URL.
1879 * If the requestURL is absolute, this function returns the requestedURL untouched.
1880 *
1881 * @param {string} baseURL The base URL
1882 * @param {string} requestedURL Absolute or relative URL to combine
1883 *
1884 * @returns {string} The combined full path
1885 */
1886 function buildFullPath(baseURL, requestedURL) {
1887 if (baseURL && !isAbsoluteURL(requestedURL)) {
1888 return combineURLs(baseURL, requestedURL);
1889 }
1890 return requestedURL;
1891 }
1892
1893 var isURLSameOrigin = platform.isStandardBrowserEnv ?
1894 // Standard browser envs have full support of the APIs needed to test
1895 // whether the request URL is of the same origin as current location.
1896 function standardBrowserEnv() {
1897 var msie = /(msie|trident)/i.test(navigator.userAgent);
1898 var urlParsingNode = document.createElement('a');
1899 var originURL;
1900
1901 /**
1902 * Parse a URL to discover it's components
1903 *
1904 * @param {String} url The URL to be parsed
1905 * @returns {Object}
1906 */
1907 function resolveURL(url) {
1908 var href = url;
1909 if (msie) {
1910 // IE needs attribute set twice to normalize properties
1911 urlParsingNode.setAttribute('href', href);
1912 href = urlParsingNode.href;
1913 }
1914 urlParsingNode.setAttribute('href', href);
1915
1916 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1917 return {
1918 href: urlParsingNode.href,
1919 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1920 host: urlParsingNode.host,
1921 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1922 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1923 hostname: urlParsingNode.hostname,
1924 port: urlParsingNode.port,
1925 pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
1926 };
1927 }
1928 originURL = resolveURL(window.location.href);
1929
1930 /**
1931 * Determine if a URL shares the same origin as the current location
1932 *
1933 * @param {String} requestURL The URL to test
1934 * @returns {boolean} True if URL shares the same origin, otherwise false
1935 */
1936 return function isURLSameOrigin(requestURL) {
1937 var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
1938 return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
1939 };
1940 }() :
1941 // Non standard browser envs (web workers, react-native) lack needed support.
1942 function nonStandardBrowserEnv() {
1943 return function isURLSameOrigin() {
1944 return true;
1945 };
1946 }();
1947
1948 function parseProtocol(url) {
1949 var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1950 return match && match[1] || '';
1951 }
1952
1953 /**
1954 * Calculate data maxRate
1955 * @param {Number} [samplesCount= 10]
1956 * @param {Number} [min= 1000]
1957 * @returns {Function}
1958 */
1959 function speedometer(samplesCount, min) {
1960 samplesCount = samplesCount || 10;
1961 var bytes = new Array(samplesCount);
1962 var timestamps = new Array(samplesCount);
1963 var head = 0;
1964 var tail = 0;
1965 var firstSampleTS;
1966 min = min !== undefined ? min : 1000;
1967 return function push(chunkLength) {
1968 var now = Date.now();
1969 var startedAt = timestamps[tail];
1970 if (!firstSampleTS) {
1971 firstSampleTS = now;
1972 }
1973 bytes[head] = chunkLength;
1974 timestamps[head] = now;
1975 var i = tail;
1976 var bytesCount = 0;
1977 while (i !== head) {
1978 bytesCount += bytes[i++];
1979 i = i % samplesCount;
1980 }
1981 head = (head + 1) % samplesCount;
1982 if (head === tail) {
1983 tail = (tail + 1) % samplesCount;
1984 }
1985 if (now - firstSampleTS < min) {
1986 return;
1987 }
1988 var passed = startedAt && now - startedAt;
1989 return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
1990 };
1991 }
1992
1993 function progressEventReducer(listener, isDownloadStream) {
1994 var bytesNotified = 0;
1995 var _speedometer = speedometer(50, 250);
1996 return function (e) {
1997 var loaded = e.loaded;
1998 var total = e.lengthComputable ? e.total : undefined;
1999 var progressBytes = loaded - bytesNotified;
2000 var rate = _speedometer(progressBytes);
2001 var inRange = loaded <= total;
2002 bytesNotified = loaded;
2003 var data = {
2004 loaded: loaded,
2005 total: total,
2006 progress: total ? loaded / total : undefined,
2007 bytes: progressBytes,
2008 rate: rate ? rate : undefined,
2009 estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2010 event: e
2011 };
2012 data[isDownloadStream ? 'download' : 'upload'] = true;
2013 listener(data);
2014 };
2015 }
2016 var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2017 var xhrAdapter = isXHRAdapterSupported && function (config) {
2018 return new Promise(function dispatchXhrRequest(resolve, reject) {
2019 var requestData = config.data;
2020 var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
2021 var responseType = config.responseType;
2022 var onCanceled;
2023 function done() {
2024 if (config.cancelToken) {
2025 config.cancelToken.unsubscribe(onCanceled);
2026 }
2027 if (config.signal) {
2028 config.signal.removeEventListener('abort', onCanceled);
2029 }
2030 }
2031 if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
2032 requestHeaders.setContentType(false); // Let the browser set it
2033 }
2034
2035 var request = new XMLHttpRequest();
2036
2037 // HTTP basic authentication
2038 if (config.auth) {
2039 var username = config.auth.username || '';
2040 var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2041 requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2042 }
2043 var fullPath = buildFullPath(config.baseURL, config.url);
2044 request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2045
2046 // Set the request timeout in MS
2047 request.timeout = config.timeout;
2048 function onloadend() {
2049 if (!request) {
2050 return;
2051 }
2052 // Prepare the response
2053 var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
2054 var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
2055 var response = {
2056 data: responseData,
2057 status: request.status,
2058 statusText: request.statusText,
2059 headers: responseHeaders,
2060 config: config,
2061 request: request
2062 };
2063 settle(function _resolve(value) {
2064 resolve(value);
2065 done();
2066 }, function _reject(err) {
2067 reject(err);
2068 done();
2069 }, response);
2070
2071 // Clean up request
2072 request = null;
2073 }
2074 if ('onloadend' in request) {
2075 // Use onloadend if available
2076 request.onloadend = onloadend;
2077 } else {
2078 // Listen for ready state to emulate onloadend
2079 request.onreadystatechange = function handleLoad() {
2080 if (!request || request.readyState !== 4) {
2081 return;
2082 }
2083
2084 // The request errored out and we didn't get a response, this will be
2085 // handled by onerror instead
2086 // With one exception: request that using file: protocol, most browsers
2087 // will return status as 0 even though it's a successful request
2088 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2089 return;
2090 }
2091 // readystate handler is calling before onerror or ontimeout handlers,
2092 // so we should call onloadend on the next 'tick'
2093 setTimeout(onloadend);
2094 };
2095 }
2096
2097 // Handle browser request cancellation (as opposed to a manual cancellation)
2098 request.onabort = function handleAbort() {
2099 if (!request) {
2100 return;
2101 }
2102 reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2103
2104 // Clean up request
2105 request = null;
2106 };
2107
2108 // Handle low level network errors
2109 request.onerror = function handleError() {
2110 // Real errors are hidden from us by the browser
2111 // onerror should only fire if it's a network error
2112 reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2113
2114 // Clean up request
2115 request = null;
2116 };
2117
2118 // Handle timeout
2119 request.ontimeout = function handleTimeout() {
2120 var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2121 var transitional = config.transitional || transitionalDefaults;
2122 if (config.timeoutErrorMessage) {
2123 timeoutErrorMessage = config.timeoutErrorMessage;
2124 }
2125 reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
2126
2127 // Clean up request
2128 request = null;
2129 };
2130
2131 // Add xsrf header
2132 // This is only done if running in a standard browser environment.
2133 // Specifically not if we're in a web worker, or react-native.
2134 if (platform.isStandardBrowserEnv) {
2135 // Add xsrf header
2136 var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2137 if (xsrfValue) {
2138 requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2139 }
2140 }
2141
2142 // Remove Content-Type if data is undefined
2143 requestData === undefined && requestHeaders.setContentType(null);
2144
2145 // Add headers to the request
2146 if ('setRequestHeader' in request) {
2147 utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2148 request.setRequestHeader(key, val);
2149 });
2150 }
2151
2152 // Add withCredentials to request if needed
2153 if (!utils.isUndefined(config.withCredentials)) {
2154 request.withCredentials = !!config.withCredentials;
2155 }
2156
2157 // Add responseType to request if needed
2158 if (responseType && responseType !== 'json') {
2159 request.responseType = config.responseType;
2160 }
2161
2162 // Handle progress if needed
2163 if (typeof config.onDownloadProgress === 'function') {
2164 request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2165 }
2166
2167 // Not all browsers support upload events
2168 if (typeof config.onUploadProgress === 'function' && request.upload) {
2169 request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2170 }
2171 if (config.cancelToken || config.signal) {
2172 // Handle cancellation
2173 // eslint-disable-next-line func-names
2174 onCanceled = function onCanceled(cancel) {
2175 if (!request) {
2176 return;
2177 }
2178 reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2179 request.abort();
2180 request = null;
2181 };
2182 config.cancelToken && config.cancelToken.subscribe(onCanceled);
2183 if (config.signal) {
2184 config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2185 }
2186 }
2187 var protocol = parseProtocol(fullPath);
2188 if (protocol && platform.protocols.indexOf(protocol) === -1) {
2189 reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2190 return;
2191 }
2192
2193 // Send the request
2194 request.send(requestData || null);
2195 });
2196 };
2197
2198 var knownAdapters = {
2199 http: httpAdapter,
2200 xhr: xhrAdapter
2201 };
2202 utils.forEach(knownAdapters, function (fn, value) {
2203 if (fn) {
2204 try {
2205 Object.defineProperty(fn, 'name', {
2206 value: value
2207 });
2208 } catch (e) {
2209 // eslint-disable-next-line no-empty
2210 }
2211 Object.defineProperty(fn, 'adapterName', {
2212 value: value
2213 });
2214 }
2215 });
2216 var adapters = {
2217 getAdapter: function getAdapter(adapters) {
2218 adapters = utils.isArray(adapters) ? adapters : [adapters];
2219 var _adapters = adapters,
2220 length = _adapters.length;
2221 var nameOrAdapter;
2222 var adapter;
2223 for (var i = 0; i < length; i++) {
2224 nameOrAdapter = adapters[i];
2225 if (adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter) {
2226 break;
2227 }
2228 }
2229 if (!adapter) {
2230 if (adapter === false) {
2231 throw new AxiosError("Adapter ".concat(nameOrAdapter, " is not supported by the environment"), 'ERR_NOT_SUPPORT');
2232 }
2233 throw new Error(utils.hasOwnProp(knownAdapters, nameOrAdapter) ? "Adapter '".concat(nameOrAdapter, "' is not available in the build") : "Unknown adapter '".concat(nameOrAdapter, "'"));
2234 }
2235 if (!utils.isFunction(adapter)) {
2236 throw new TypeError('adapter is not a function');
2237 }
2238 return adapter;
2239 },
2240 adapters: knownAdapters
2241 };
2242
2243 /**
2244 * Throws a `CanceledError` if cancellation has been requested.
2245 *
2246 * @param {Object} config The config that is to be used for the request
2247 *
2248 * @returns {void}
2249 */
2250 function throwIfCancellationRequested(config) {
2251 if (config.cancelToken) {
2252 config.cancelToken.throwIfRequested();
2253 }
2254 if (config.signal && config.signal.aborted) {
2255 throw new CanceledError(null, config);
2256 }
2257 }
2258
2259 /**
2260 * Dispatch a request to the server using the configured adapter.
2261 *
2262 * @param {object} config The config that is to be used for the request
2263 *
2264 * @returns {Promise} The Promise to be fulfilled
2265 */
2266 function dispatchRequest(config) {
2267 throwIfCancellationRequested(config);
2268 config.headers = AxiosHeaders$1.from(config.headers);
2269
2270 // Transform request data
2271 config.data = transformData.call(config, config.transformRequest);
2272 if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2273 config.headers.setContentType('application/x-www-form-urlencoded', false);
2274 }
2275 var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
2276 return adapter(config).then(function onAdapterResolution(response) {
2277 throwIfCancellationRequested(config);
2278
2279 // Transform response data
2280 response.data = transformData.call(config, config.transformResponse, response);
2281 response.headers = AxiosHeaders$1.from(response.headers);
2282 return response;
2283 }, function onAdapterRejection(reason) {
2284 if (!isCancel(reason)) {
2285 throwIfCancellationRequested(config);
2286
2287 // Transform response data
2288 if (reason && reason.response) {
2289 reason.response.data = transformData.call(config, config.transformResponse, reason.response);
2290 reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2291 }
2292 }
2293 return Promise.reject(reason);
2294 });
2295 }
2296
2297 var headersToObject = function headersToObject(thing) {
2298 return thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
2299 };
2300
2301 /**
2302 * Config-specific merge-function which creates a new config-object
2303 * by merging two configuration objects together.
2304 *
2305 * @param {Object} config1
2306 * @param {Object} config2
2307 *
2308 * @returns {Object} New object resulting from merging config2 to config1
2309 */
2310 function mergeConfig(config1, config2) {
2311 // eslint-disable-next-line no-param-reassign
2312 config2 = config2 || {};
2313 var config = {};
2314 function getMergedValue(target, source, caseless) {
2315 if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2316 return utils.merge.call({
2317 caseless: caseless
2318 }, target, source);
2319 } else if (utils.isPlainObject(source)) {
2320 return utils.merge({}, source);
2321 } else if (utils.isArray(source)) {
2322 return source.slice();
2323 }
2324 return source;
2325 }
2326
2327 // eslint-disable-next-line consistent-return
2328 function mergeDeepProperties(a, b, caseless) {
2329 if (!utils.isUndefined(b)) {
2330 return getMergedValue(a, b, caseless);
2331 } else if (!utils.isUndefined(a)) {
2332 return getMergedValue(undefined, a, caseless);
2333 }
2334 }
2335
2336 // eslint-disable-next-line consistent-return
2337 function valueFromConfig2(a, b) {
2338 if (!utils.isUndefined(b)) {
2339 return getMergedValue(undefined, b);
2340 }
2341 }
2342
2343 // eslint-disable-next-line consistent-return
2344 function defaultToConfig2(a, b) {
2345 if (!utils.isUndefined(b)) {
2346 return getMergedValue(undefined, b);
2347 } else if (!utils.isUndefined(a)) {
2348 return getMergedValue(undefined, a);
2349 }
2350 }
2351
2352 // eslint-disable-next-line consistent-return
2353 function mergeDirectKeys(a, b, prop) {
2354 if (prop in config2) {
2355 return getMergedValue(a, b);
2356 } else if (prop in config1) {
2357 return getMergedValue(undefined, a);
2358 }
2359 }
2360 var mergeMap = {
2361 url: valueFromConfig2,
2362 method: valueFromConfig2,
2363 data: valueFromConfig2,
2364 baseURL: defaultToConfig2,
2365 transformRequest: defaultToConfig2,
2366 transformResponse: defaultToConfig2,
2367 paramsSerializer: defaultToConfig2,
2368 timeout: defaultToConfig2,
2369 timeoutMessage: defaultToConfig2,
2370 withCredentials: defaultToConfig2,
2371 adapter: defaultToConfig2,
2372 responseType: defaultToConfig2,
2373 xsrfCookieName: defaultToConfig2,
2374 xsrfHeaderName: defaultToConfig2,
2375 onUploadProgress: defaultToConfig2,
2376 onDownloadProgress: defaultToConfig2,
2377 decompress: defaultToConfig2,
2378 maxContentLength: defaultToConfig2,
2379 maxBodyLength: defaultToConfig2,
2380 beforeRedirect: defaultToConfig2,
2381 transport: defaultToConfig2,
2382 httpAgent: defaultToConfig2,
2383 httpsAgent: defaultToConfig2,
2384 cancelToken: defaultToConfig2,
2385 socketPath: defaultToConfig2,
2386 responseEncoding: defaultToConfig2,
2387 validateStatus: mergeDirectKeys,
2388 headers: function headers(a, b) {
2389 return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2390 }
2391 };
2392 utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
2393 var merge = mergeMap[prop] || mergeDeepProperties;
2394 var configValue = merge(config1[prop], config2[prop], prop);
2395 utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2396 });
2397 return config;
2398 }
2399
2400 var VERSION = "1.2.5";
2401
2402 var validators$1 = {};
2403
2404 // eslint-disable-next-line func-names
2405 ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
2406 validators$1[type] = function validator(thing) {
2407 return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2408 };
2409 });
2410 var deprecatedWarnings = {};
2411
2412 /**
2413 * Transitional option validator
2414 *
2415 * @param {function|boolean?} validator - set to false if the transitional option has been removed
2416 * @param {string?} version - deprecated version / removed since version
2417 * @param {string?} message - some message with additional info
2418 *
2419 * @returns {function}
2420 */
2421 validators$1.transitional = function transitional(validator, version, message) {
2422 function formatMessage(opt, desc) {
2423 return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2424 }
2425
2426 // eslint-disable-next-line func-names
2427 return function (value, opt, opts) {
2428 if (validator === false) {
2429 throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
2430 }
2431 if (version && !deprecatedWarnings[opt]) {
2432 deprecatedWarnings[opt] = true;
2433 // eslint-disable-next-line no-console
2434 console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
2435 }
2436 return validator ? validator(value, opt, opts) : true;
2437 };
2438 };
2439
2440 /**
2441 * Assert object's properties type
2442 *
2443 * @param {object} options
2444 * @param {object} schema
2445 * @param {boolean?} allowUnknown
2446 *
2447 * @returns {object}
2448 */
2449
2450 function assertOptions(options, schema, allowUnknown) {
2451 if (_typeof(options) !== 'object') {
2452 throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2453 }
2454 var keys = Object.keys(options);
2455 var i = keys.length;
2456 while (i-- > 0) {
2457 var opt = keys[i];
2458 var validator = schema[opt];
2459 if (validator) {
2460 var value = options[opt];
2461 var result = value === undefined || validator(value, opt, options);
2462 if (result !== true) {
2463 throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2464 }
2465 continue;
2466 }
2467 if (allowUnknown !== true) {
2468 throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2469 }
2470 }
2471 }
2472 var validator = {
2473 assertOptions: assertOptions,
2474 validators: validators$1
2475 };
2476
2477 var validators = validator.validators;
2478
2479 /**
2480 * Create a new instance of Axios
2481 *
2482 * @param {Object} instanceConfig The default config for the instance
2483 *
2484 * @return {Axios} A new instance of Axios
2485 */
2486 var Axios = /*#__PURE__*/function () {
2487 function Axios(instanceConfig) {
2488 _classCallCheck(this, Axios);
2489 this.defaults = instanceConfig;
2490 this.interceptors = {
2491 request: new InterceptorManager$1(),
2492 response: new InterceptorManager$1()
2493 };
2494 }
2495
2496 /**
2497 * Dispatch a request
2498 *
2499 * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2500 * @param {?Object} config
2501 *
2502 * @returns {Promise} The Promise to be fulfilled
2503 */
2504 _createClass(Axios, [{
2505 key: "request",
2506 value: function request(configOrUrl, config) {
2507 /*eslint no-param-reassign:0*/
2508 // Allow for axios('example/url'[, config]) a la fetch API
2509 if (typeof configOrUrl === 'string') {
2510 config = config || {};
2511 config.url = configOrUrl;
2512 } else {
2513 config = configOrUrl || {};
2514 }
2515 config = mergeConfig(this.defaults, config);
2516 var _config = config,
2517 transitional = _config.transitional,
2518 paramsSerializer = _config.paramsSerializer,
2519 headers = _config.headers;
2520 if (transitional !== undefined) {
2521 validator.assertOptions(transitional, {
2522 silentJSONParsing: validators.transitional(validators["boolean"]),
2523 forcedJSONParsing: validators.transitional(validators["boolean"]),
2524 clarifyTimeoutError: validators.transitional(validators["boolean"])
2525 }, false);
2526 }
2527 if (paramsSerializer !== undefined) {
2528 validator.assertOptions(paramsSerializer, {
2529 encode: validators["function"],
2530 serialize: validators["function"]
2531 }, true);
2532 }
2533
2534 // Set config.method
2535 config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2536 var contextHeaders;
2537
2538 // Flatten headers
2539 contextHeaders = headers && utils.merge(headers.common, headers[config.method]);
2540 contextHeaders && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
2541 delete headers[method];
2542 });
2543 config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
2544
2545 // filter out skipped interceptors
2546 var requestInterceptorChain = [];
2547 var synchronousRequestInterceptors = true;
2548 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2549 if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2550 return;
2551 }
2552 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2553 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2554 });
2555 var responseInterceptorChain = [];
2556 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2557 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2558 });
2559 var promise;
2560 var i = 0;
2561 var len;
2562 if (!synchronousRequestInterceptors) {
2563 var chain = [dispatchRequest.bind(this), undefined];
2564 chain.unshift.apply(chain, requestInterceptorChain);
2565 chain.push.apply(chain, responseInterceptorChain);
2566 len = chain.length;
2567 promise = Promise.resolve(config);
2568 while (i < len) {
2569 promise = promise.then(chain[i++], chain[i++]);
2570 }
2571 return promise;
2572 }
2573 len = requestInterceptorChain.length;
2574 var newConfig = config;
2575 i = 0;
2576 while (i < len) {
2577 var onFulfilled = requestInterceptorChain[i++];
2578 var onRejected = requestInterceptorChain[i++];
2579 try {
2580 newConfig = onFulfilled(newConfig);
2581 } catch (error) {
2582 onRejected.call(this, error);
2583 break;
2584 }
2585 }
2586 try {
2587 promise = dispatchRequest.call(this, newConfig);
2588 } catch (error) {
2589 return Promise.reject(error);
2590 }
2591 i = 0;
2592 len = responseInterceptorChain.length;
2593 while (i < len) {
2594 promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2595 }
2596 return promise;
2597 }
2598 }, {
2599 key: "getUri",
2600 value: function getUri(config) {
2601 config = mergeConfig(this.defaults, config);
2602 var fullPath = buildFullPath(config.baseURL, config.url);
2603 return buildURL(fullPath, config.params, config.paramsSerializer);
2604 }
2605 }]);
2606 return Axios;
2607 }(); // Provide aliases for supported request methods
2608 utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2609 /*eslint func-names:0*/
2610 Axios.prototype[method] = function (url, config) {
2611 return this.request(mergeConfig(config || {}, {
2612 method: method,
2613 url: url,
2614 data: (config || {}).data
2615 }));
2616 };
2617 });
2618 utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2619 /*eslint func-names:0*/
2620
2621 function generateHTTPMethod(isForm) {
2622 return function httpMethod(url, data, config) {
2623 return this.request(mergeConfig(config || {}, {
2624 method: method,
2625 headers: isForm ? {
2626 'Content-Type': 'multipart/form-data'
2627 } : {},
2628 url: url,
2629 data: data
2630 }));
2631 };
2632 }
2633 Axios.prototype[method] = generateHTTPMethod();
2634 Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2635 });
2636 var Axios$1 = Axios;
2637
2638 /**
2639 * A `CancelToken` is an object that can be used to request cancellation of an operation.
2640 *
2641 * @param {Function} executor The executor function.
2642 *
2643 * @returns {CancelToken}
2644 */
2645 var CancelToken = /*#__PURE__*/function () {
2646 function CancelToken(executor) {
2647 _classCallCheck(this, CancelToken);
2648 if (typeof executor !== 'function') {
2649 throw new TypeError('executor must be a function.');
2650 }
2651 var resolvePromise;
2652 this.promise = new Promise(function promiseExecutor(resolve) {
2653 resolvePromise = resolve;
2654 });
2655 var token = this;
2656
2657 // eslint-disable-next-line func-names
2658 this.promise.then(function (cancel) {
2659 if (!token._listeners) return;
2660 var i = token._listeners.length;
2661 while (i-- > 0) {
2662 token._listeners[i](cancel);
2663 }
2664 token._listeners = null;
2665 });
2666
2667 // eslint-disable-next-line func-names
2668 this.promise.then = function (onfulfilled) {
2669 var _resolve;
2670 // eslint-disable-next-line func-names
2671 var promise = new Promise(function (resolve) {
2672 token.subscribe(resolve);
2673 _resolve = resolve;
2674 }).then(onfulfilled);
2675 promise.cancel = function reject() {
2676 token.unsubscribe(_resolve);
2677 };
2678 return promise;
2679 };
2680 executor(function cancel(message, config, request) {
2681 if (token.reason) {
2682 // Cancellation has already been requested
2683 return;
2684 }
2685 token.reason = new CanceledError(message, config, request);
2686 resolvePromise(token.reason);
2687 });
2688 }
2689
2690 /**
2691 * Throws a `CanceledError` if cancellation has been requested.
2692 */
2693 _createClass(CancelToken, [{
2694 key: "throwIfRequested",
2695 value: function throwIfRequested() {
2696 if (this.reason) {
2697 throw this.reason;
2698 }
2699 }
2700
2701 /**
2702 * Subscribe to the cancel signal
2703 */
2704 }, {
2705 key: "subscribe",
2706 value: function subscribe(listener) {
2707 if (this.reason) {
2708 listener(this.reason);
2709 return;
2710 }
2711 if (this._listeners) {
2712 this._listeners.push(listener);
2713 } else {
2714 this._listeners = [listener];
2715 }
2716 }
2717
2718 /**
2719 * Unsubscribe from the cancel signal
2720 */
2721 }, {
2722 key: "unsubscribe",
2723 value: function unsubscribe(listener) {
2724 if (!this._listeners) {
2725 return;
2726 }
2727 var index = this._listeners.indexOf(listener);
2728 if (index !== -1) {
2729 this._listeners.splice(index, 1);
2730 }
2731 }
2732
2733 /**
2734 * Returns an object that contains a new `CancelToken` and a function that, when called,
2735 * cancels the `CancelToken`.
2736 */
2737 }], [{
2738 key: "source",
2739 value: function source() {
2740 var cancel;
2741 var token = new CancelToken(function executor(c) {
2742 cancel = c;
2743 });
2744 return {
2745 token: token,
2746 cancel: cancel
2747 };
2748 }
2749 }]);
2750 return CancelToken;
2751 }();
2752 var CancelToken$1 = CancelToken;
2753
2754 /**
2755 * Syntactic sugar for invoking a function and expanding an array for arguments.
2756 *
2757 * Common use case would be to use `Function.prototype.apply`.
2758 *
2759 * ```js
2760 * function f(x, y, z) {}
2761 * var args = [1, 2, 3];
2762 * f.apply(null, args);
2763 * ```
2764 *
2765 * With `spread` this example can be re-written.
2766 *
2767 * ```js
2768 * spread(function(x, y, z) {})([1, 2, 3]);
2769 * ```
2770 *
2771 * @param {Function} callback
2772 *
2773 * @returns {Function}
2774 */
2775 function spread(callback) {
2776 return function wrap(arr) {
2777 return callback.apply(null, arr);
2778 };
2779 }
2780
2781 /**
2782 * Determines whether the payload is an error thrown by Axios
2783 *
2784 * @param {*} payload The value to test
2785 *
2786 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
2787 */
2788 function isAxiosError(payload) {
2789 return utils.isObject(payload) && payload.isAxiosError === true;
2790 }
2791
2792 var HttpStatusCode = {
2793 Continue: 100,
2794 SwitchingProtocols: 101,
2795 Processing: 102,
2796 EarlyHints: 103,
2797 Ok: 200,
2798 Created: 201,
2799 Accepted: 202,
2800 NonAuthoritativeInformation: 203,
2801 NoContent: 204,
2802 ResetContent: 205,
2803 PartialContent: 206,
2804 MultiStatus: 207,
2805 AlreadyReported: 208,
2806 ImUsed: 226,
2807 MultipleChoices: 300,
2808 MovedPermanently: 301,
2809 Found: 302,
2810 SeeOther: 303,
2811 NotModified: 304,
2812 UseProxy: 305,
2813 Unused: 306,
2814 TemporaryRedirect: 307,
2815 PermanentRedirect: 308,
2816 BadRequest: 400,
2817 Unauthorized: 401,
2818 PaymentRequired: 402,
2819 Forbidden: 403,
2820 NotFound: 404,
2821 MethodNotAllowed: 405,
2822 NotAcceptable: 406,
2823 ProxyAuthenticationRequired: 407,
2824 RequestTimeout: 408,
2825 Conflict: 409,
2826 Gone: 410,
2827 LengthRequired: 411,
2828 PreconditionFailed: 412,
2829 PayloadTooLarge: 413,
2830 UriTooLong: 414,
2831 UnsupportedMediaType: 415,
2832 RangeNotSatisfiable: 416,
2833 ExpectationFailed: 417,
2834 ImATeapot: 418,
2835 MisdirectedRequest: 421,
2836 UnprocessableEntity: 422,
2837 Locked: 423,
2838 FailedDependency: 424,
2839 TooEarly: 425,
2840 UpgradeRequired: 426,
2841 PreconditionRequired: 428,
2842 TooManyRequests: 429,
2843 RequestHeaderFieldsTooLarge: 431,
2844 UnavailableForLegalReasons: 451,
2845 InternalServerError: 500,
2846 NotImplemented: 501,
2847 BadGateway: 502,
2848 ServiceUnavailable: 503,
2849 GatewayTimeout: 504,
2850 HttpVersionNotSupported: 505,
2851 VariantAlsoNegotiates: 506,
2852 InsufficientStorage: 507,
2853 LoopDetected: 508,
2854 NotExtended: 510,
2855 NetworkAuthenticationRequired: 511
2856 };
2857 Object.entries(HttpStatusCode).forEach(function (_ref) {
2858 var _ref2 = _slicedToArray(_ref, 2),
2859 key = _ref2[0],
2860 value = _ref2[1];
2861 HttpStatusCode[value] = key;
2862 });
2863 var HttpStatusCode$1 = HttpStatusCode;
2864
2865 /**
2866 * Create an instance of Axios
2867 *
2868 * @param {Object} defaultConfig The default config for the instance
2869 *
2870 * @returns {Axios} A new instance of Axios
2871 */
2872 function createInstance(defaultConfig) {
2873 var context = new Axios$1(defaultConfig);
2874 var instance = bind(Axios$1.prototype.request, context);
2875
2876 // Copy axios.prototype to instance
2877 utils.extend(instance, Axios$1.prototype, context, {
2878 allOwnKeys: true
2879 });
2880
2881 // Copy context to instance
2882 utils.extend(instance, context, null, {
2883 allOwnKeys: true
2884 });
2885
2886 // Factory for creating new instances
2887 instance.create = function create(instanceConfig) {
2888 return createInstance(mergeConfig(defaultConfig, instanceConfig));
2889 };
2890 return instance;
2891 }
2892
2893 // Create the default instance to be exported
2894 var axios = createInstance(defaults$1);
2895
2896 // Expose Axios class to allow class inheritance
2897 axios.Axios = Axios$1;
2898
2899 // Expose Cancel & CancelToken
2900 axios.CanceledError = CanceledError;
2901 axios.CancelToken = CancelToken$1;
2902 axios.isCancel = isCancel;
2903 axios.VERSION = VERSION;
2904 axios.toFormData = toFormData;
2905
2906 // Expose AxiosError class
2907 axios.AxiosError = AxiosError;
2908
2909 // alias for CanceledError for backward compatibility
2910 axios.Cancel = axios.CanceledError;
2911
2912 // Expose all/spread
2913 axios.all = function all(promises) {
2914 return Promise.all(promises);
2915 };
2916 axios.spread = spread;
2917
2918 // Expose isAxiosError
2919 axios.isAxiosError = isAxiosError;
2920
2921 // Expose mergeConfig
2922 axios.mergeConfig = mergeConfig;
2923 axios.AxiosHeaders = AxiosHeaders$1;
2924 axios.formToJSON = function (thing) {
2925 return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
2926 };
2927 axios.HttpStatusCode = HttpStatusCode$1;
2928 axios["default"] = axios;
2929
2930 return axios;
2931
2932}));
2933//# sourceMappingURL=axios.js.map