proxy-rotator-js 1.0.8 → 1.0.9

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