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