source: node_modules/axios/dist/axios.js@ ff72ad2

Last change on this file since ff72ad2 was ff72ad2, checked in by ste08 <sjovanoska@…>, 2 months ago

Adding review works\!

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