axios 1.6.7 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/dist/axios.js CHANGED
@@ -1,330 +1,520 @@
1
- // Axios v1.6.7 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.7.3 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
6
6
  })(this, (function () { 'use strict';
7
7
 
8
- function ownKeys(object, enumerableOnly) {
9
- var keys = Object.keys(object);
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);
10
171
  if (Object.getOwnPropertySymbols) {
11
- var symbols = Object.getOwnPropertySymbols(object);
12
- enumerableOnly && (symbols = symbols.filter(function (sym) {
13
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
- })), keys.push.apply(keys, symbols);
15
- }
16
- return keys;
17
- }
18
- function _objectSpread2(target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = null != arguments[i] ? arguments[i] : {};
21
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
22
- _defineProperty(target, key, source[key]);
23
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
24
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
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));
25
186
  });
26
187
  }
27
- return target;
188
+ return e;
28
189
  }
29
190
  function _regeneratorRuntime() {
30
191
  _regeneratorRuntime = function () {
31
- return exports;
192
+ return e;
32
193
  };
33
- var exports = {},
34
- Op = Object.prototype,
35
- hasOwn = Op.hasOwnProperty,
36
- $Symbol = "function" == typeof Symbol ? Symbol : {},
37
- iteratorSymbol = $Symbol.iterator || "@@iterator",
38
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
39
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
40
- function define(obj, key, value) {
41
- return Object.defineProperty(obj, key, {
42
- value: value,
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,
43
208
  enumerable: !0,
44
209
  configurable: !0,
45
210
  writable: !0
46
- }), obj[key];
211
+ }), t[e];
47
212
  }
48
213
  try {
49
214
  define({}, "");
50
- } catch (err) {
51
- define = function (obj, key, value) {
52
- return obj[key] = value;
215
+ } catch (t) {
216
+ define = function (t, e, r) {
217
+ return t[e] = r;
53
218
  };
54
219
  }
55
- function wrap(innerFn, outerFn, self, tryLocsList) {
56
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
57
- generator = Object.create(protoGenerator.prototype),
58
- context = new Context(tryLocsList || []);
59
- return generator._invoke = function (innerFn, self, context) {
60
- var state = "suspendedStart";
61
- return function (method, arg) {
62
- if ("executing" === state) throw new Error("Generator is already running");
63
- if ("completed" === state) {
64
- if ("throw" === method) throw arg;
65
- return doneResult();
66
- }
67
- for (context.method = method, context.arg = arg;;) {
68
- var delegate = context.delegate;
69
- if (delegate) {
70
- var delegateResult = maybeInvokeDelegate(delegate, context);
71
- if (delegateResult) {
72
- if (delegateResult === ContinueSentinel) continue;
73
- return delegateResult;
74
- }
75
- }
76
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
77
- if ("suspendedStart" === state) throw state = "completed", context.arg;
78
- context.dispatchException(context.arg);
79
- } else "return" === context.method && context.abrupt("return", context.arg);
80
- state = "executing";
81
- var record = tryCatch(innerFn, self, context);
82
- if ("normal" === record.type) {
83
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
84
- return {
85
- value: record.arg,
86
- done: context.done
87
- };
88
- }
89
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
90
- }
91
- };
92
- }(innerFn, self, context), generator;
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;
93
227
  }
94
- function tryCatch(fn, obj, arg) {
228
+ function tryCatch(t, e, r) {
95
229
  try {
96
230
  return {
97
231
  type: "normal",
98
- arg: fn.call(obj, arg)
232
+ arg: t.call(e, r)
99
233
  };
100
- } catch (err) {
234
+ } catch (t) {
101
235
  return {
102
236
  type: "throw",
103
- arg: err
237
+ arg: t
104
238
  };
105
239
  }
106
240
  }
107
- exports.wrap = wrap;
108
- var ContinueSentinel = {};
241
+ e.wrap = wrap;
242
+ var h = "suspendedStart",
243
+ l = "suspendedYield",
244
+ f = "executing",
245
+ s = "completed",
246
+ y = {};
109
247
  function Generator() {}
110
248
  function GeneratorFunction() {}
111
249
  function GeneratorFunctionPrototype() {}
112
- var IteratorPrototype = {};
113
- define(IteratorPrototype, iteratorSymbol, function () {
250
+ var p = {};
251
+ define(p, a, function () {
114
252
  return this;
115
253
  });
116
- var getProto = Object.getPrototypeOf,
117
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
118
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
119
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
120
- function defineIteratorMethods(prototype) {
121
- ["next", "throw", "return"].forEach(function (method) {
122
- define(prototype, method, function (arg) {
123
- return this._invoke(method, arg);
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);
124
262
  });
125
263
  });
126
264
  }
127
- function AsyncIterator(generator, PromiseImpl) {
128
- function invoke(method, arg, resolve, reject) {
129
- var record = tryCatch(generator[method], generator, arg);
130
- if ("throw" !== record.type) {
131
- var result = record.arg,
132
- value = result.value;
133
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
134
- invoke("next", value, resolve, reject);
135
- }, function (err) {
136
- invoke("throw", err, resolve, reject);
137
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
138
- result.value = unwrapped, resolve(result);
139
- }, function (error) {
140
- return invoke("throw", error, resolve, reject);
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);
141
279
  });
142
280
  }
143
- reject(record.arg);
281
+ a(c.arg);
144
282
  }
145
- var previousPromise;
146
- this._invoke = function (method, arg) {
147
- function callInvokeWithMethodAndArg() {
148
- return new PromiseImpl(function (resolve, reject) {
149
- invoke(method, arg, resolve, reject);
150
- });
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();
151
292
  }
152
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
153
- };
293
+ });
154
294
  }
155
- function maybeInvokeDelegate(delegate, context) {
156
- var method = delegate.iterator[context.method];
157
- if (undefined === method) {
158
- if (context.delegate = null, "throw" === context.method) {
159
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
160
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
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
+ };
161
305
  }
162
- return ContinueSentinel;
163
- }
164
- var record = tryCatch(method, delegate.iterator, context.arg);
165
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
166
- var info = record.arg;
167
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
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);
168
340
  }
169
- function pushTryEntry(locs) {
170
- var entry = {
171
- tryLoc: locs[0]
341
+ function pushTryEntry(t) {
342
+ var e = {
343
+ tryLoc: t[0]
172
344
  };
173
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
345
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
174
346
  }
175
- function resetTryEntry(entry) {
176
- var record = entry.completion || {};
177
- record.type = "normal", delete record.arg, entry.completion = record;
347
+ function resetTryEntry(t) {
348
+ var e = t.completion || {};
349
+ e.type = "normal", delete e.arg, t.completion = e;
178
350
  }
179
- function Context(tryLocsList) {
351
+ function Context(t) {
180
352
  this.tryEntries = [{
181
353
  tryLoc: "root"
182
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
183
- }
184
- function values(iterable) {
185
- if (iterable) {
186
- var iteratorMethod = iterable[iteratorSymbol];
187
- if (iteratorMethod) return iteratorMethod.call(iterable);
188
- if ("function" == typeof iterable.next) return iterable;
189
- if (!isNaN(iterable.length)) {
190
- var i = -1,
191
- next = function next() {
192
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
193
- return next.value = undefined, next.done = !0, next;
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;
194
366
  };
195
- return next.next = next;
367
+ return i.next = i;
196
368
  }
197
369
  }
198
- return {
199
- next: doneResult
200
- };
201
- }
202
- function doneResult() {
203
- return {
204
- value: undefined,
205
- done: !0
206
- };
370
+ throw new TypeError(typeof e + " is not iterable");
207
371
  }
208
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
209
- var ctor = "function" == typeof genFun && genFun.constructor;
210
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
211
- }, exports.mark = function (genFun) {
212
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
213
- }, exports.awrap = function (arg) {
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) {
214
384
  return {
215
- __await: arg
385
+ __await: t
216
386
  };
217
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
387
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
218
388
  return this;
219
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
220
- void 0 === PromiseImpl && (PromiseImpl = Promise);
221
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
222
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
223
- return result.done ? result.value : iter.next();
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();
224
394
  });
225
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
395
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
226
396
  return this;
227
- }), define(Gp, "toString", function () {
397
+ }), define(g, "toString", function () {
228
398
  return "[object Generator]";
229
- }), exports.keys = function (object) {
230
- var keys = [];
231
- for (var key in object) keys.push(key);
232
- return keys.reverse(), function next() {
233
- for (; keys.length;) {
234
- var key = keys.pop();
235
- if (key in object) return next.value = key, next.done = !1, next;
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;
236
407
  }
237
408
  return next.done = !0, next;
238
409
  };
239
- }, exports.values = values, Context.prototype = {
410
+ }, e.values = values, Context.prototype = {
240
411
  constructor: Context,
241
- reset: function (skipTempReset) {
242
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
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);
243
414
  },
244
415
  stop: function () {
245
416
  this.done = !0;
246
- var rootRecord = this.tryEntries[0].completion;
247
- if ("throw" === rootRecord.type) throw rootRecord.arg;
417
+ var t = this.tryEntries[0].completion;
418
+ if ("throw" === t.type) throw t.arg;
248
419
  return this.rval;
249
420
  },
250
- dispatchException: function (exception) {
251
- if (this.done) throw exception;
252
- var context = this;
253
- function handle(loc, caught) {
254
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
255
- }
256
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
257
- var entry = this.tryEntries[i],
258
- record = entry.completion;
259
- if ("root" === entry.tryLoc) return handle("end");
260
- if (entry.tryLoc <= this.prev) {
261
- var hasCatch = hasOwn.call(entry, "catchLoc"),
262
- hasFinally = hasOwn.call(entry, "finallyLoc");
263
- if (hasCatch && hasFinally) {
264
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
265
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
266
- } else if (hasCatch) {
267
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
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);
268
439
  } else {
269
- if (!hasFinally) throw new Error("try statement without catch or finally");
270
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
440
+ if (!u) throw new Error("try statement without catch or finally");
441
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
271
442
  }
272
443
  }
273
444
  }
274
445
  },
275
- abrupt: function (type, arg) {
276
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
277
- var entry = this.tryEntries[i];
278
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
279
- var finallyEntry = entry;
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;
280
451
  break;
281
452
  }
282
453
  }
283
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
284
- var record = finallyEntry ? finallyEntry.completion : {};
285
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
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);
286
457
  },
287
- complete: function (record, afterLoc) {
288
- if ("throw" === record.type) throw record.arg;
289
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
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;
290
461
  },
291
- finish: function (finallyLoc) {
292
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
293
- var entry = this.tryEntries[i];
294
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
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;
295
466
  }
296
467
  },
297
- catch: function (tryLoc) {
298
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
299
- var entry = this.tryEntries[i];
300
- if (entry.tryLoc === tryLoc) {
301
- var record = entry.completion;
302
- if ("throw" === record.type) {
303
- var thrown = record.arg;
304
- resetTryEntry(entry);
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);
305
476
  }
306
- return thrown;
477
+ return o;
307
478
  }
308
479
  }
309
480
  throw new Error("illegal catch attempt");
310
481
  },
311
- delegateYield: function (iterable, resultName, nextLoc) {
482
+ delegateYield: function (e, r, n) {
312
483
  return this.delegate = {
313
- iterator: values(iterable),
314
- resultName: resultName,
315
- nextLoc: nextLoc
316
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
484
+ iterator: values(e),
485
+ resultName: r,
486
+ nextLoc: n
487
+ }, "next" === this.method && (this.arg = t), y;
317
488
  }
318
- }, exports;
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);
319
504
  }
320
- function _typeof(obj) {
505
+ function _typeof(o) {
321
506
  "@babel/helpers - typeof";
322
507
 
323
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
324
- return typeof obj;
325
- } : function (obj) {
326
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
327
- }, _typeof(obj);
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
+ };
328
518
  }
329
519
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
330
520
  try {
@@ -367,7 +557,7 @@
367
557
  descriptor.enumerable = descriptor.enumerable || false;
368
558
  descriptor.configurable = true;
369
559
  if ("value" in descriptor) descriptor.writable = true;
370
- Object.defineProperty(target, descriptor.key, descriptor);
560
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
371
561
  }
372
562
  }
373
563
  function _createClass(Constructor, protoProps, staticProps) {
@@ -379,6 +569,7 @@
379
569
  return Constructor;
380
570
  }
381
571
  function _defineProperty(obj, key, value) {
572
+ key = _toPropertyKey(key);
382
573
  if (key in obj) {
383
574
  Object.defineProperty(obj, key, {
384
575
  value: value,
@@ -409,30 +600,6 @@
409
600
  function _iterableToArray(iter) {
410
601
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
411
602
  }
412
- function _iterableToArrayLimit(arr, i) {
413
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
414
- if (_i == null) return;
415
- var _arr = [];
416
- var _n = true;
417
- var _d = false;
418
- var _s, _e;
419
- try {
420
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
421
- _arr.push(_s.value);
422
- if (i && _arr.length === i) break;
423
- }
424
- } catch (err) {
425
- _d = true;
426
- _e = err;
427
- } finally {
428
- try {
429
- if (!_n && _i["return"] != null) _i["return"]();
430
- } finally {
431
- if (_d) throw _e;
432
- }
433
- }
434
- return _arr;
435
- }
436
603
  function _unsupportedIterableToArray(o, minLen) {
437
604
  if (!o) return;
438
605
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -452,6 +619,57 @@
452
619
  function _nonIterableRest() {
453
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.");
454
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
+ }
455
673
 
456
674
  function bind(fn, thisArg) {
457
675
  return function wrap() {
@@ -667,6 +885,12 @@
667
885
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
668
886
  */
669
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];
670
894
 
671
895
  /**
672
896
  * Trim excess whitespace off the beginning and end of a string
@@ -766,8 +990,8 @@
766
990
  *
767
991
  * @returns {Object} Result of all merge properties
768
992
  */
769
- function /* obj1, obj2, obj3, ... */
770
- merge() {
993
+ function merge( /* obj1, obj2, obj3, ... */
994
+ ) {
771
995
  var _ref2 = isContextDefined(this) && this || {},
772
996
  caseless = _ref2.caseless;
773
997
  var result = {};
@@ -1040,8 +1264,7 @@
1040
1264
  };
1041
1265
  var noop = function noop() {};
1042
1266
  var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
1043
- value = +value;
1044
- return Number.isFinite(value) ? value : defaultValue;
1267
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
1045
1268
  };
1046
1269
  var ALPHA = 'abcdefghijklmnopqrstuvwxyz';
1047
1270
  var DIGIT = '0123456789';
@@ -1097,6 +1320,34 @@
1097
1320
  var isThenable = function isThenable(thing) {
1098
1321
  return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);
1099
1322
  };
1323
+
1324
+ // original code
1325
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
1326
+
1327
+ var _setImmediate = function (setImmediateSupported, postMessageSupported) {
1328
+ if (setImmediateSupported) {
1329
+ return setImmediate;
1330
+ }
1331
+ return postMessageSupported ? function (token, callbacks) {
1332
+ _global.addEventListener("message", function (_ref5) {
1333
+ var source = _ref5.source,
1334
+ data = _ref5.data;
1335
+ if (source === _global && data === token) {
1336
+ callbacks.length && callbacks.shift()();
1337
+ }
1338
+ }, false);
1339
+ return function (cb) {
1340
+ callbacks.push(cb);
1341
+ _global.postMessage(token, "*");
1342
+ };
1343
+ }("axios@".concat(Math.random()), []) : function (cb) {
1344
+ return setTimeout(cb);
1345
+ };
1346
+ }(typeof setImmediate === 'function', isFunction(_global.postMessage));
1347
+ var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
1348
+
1349
+ // *********************
1350
+
1100
1351
  var utils$1 = {
1101
1352
  isArray: isArray,
1102
1353
  isArrayBuffer: isArrayBuffer,
@@ -1108,6 +1359,10 @@
1108
1359
  isBoolean: isBoolean,
1109
1360
  isObject: isObject,
1110
1361
  isPlainObject: isPlainObject,
1362
+ isReadableStream: isReadableStream,
1363
+ isRequest: isRequest,
1364
+ isResponse: isResponse,
1365
+ isHeaders: isHeaders,
1111
1366
  isUndefined: isUndefined,
1112
1367
  isDate: isDate,
1113
1368
  isFile: isFile,
@@ -1149,7 +1404,9 @@
1149
1404
  isSpecCompliantForm: isSpecCompliantForm,
1150
1405
  toJSONObject: toJSONObject,
1151
1406
  isAsyncFn: isAsyncFn,
1152
- isThenable: isThenable
1407
+ isThenable: isThenable,
1408
+ setImmediate: _setImmediate,
1409
+ asap: asap
1153
1410
  };
1154
1411
 
1155
1412
  /**
@@ -1639,12 +1896,14 @@
1639
1896
  // eslint-disable-next-line no-undef
1640
1897
  self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1641
1898
  }();
1899
+ var origin = hasBrowserEnv && window.location.href || 'http://localhost';
1642
1900
 
1643
1901
  var utils = /*#__PURE__*/Object.freeze({
1644
1902
  __proto__: null,
1645
1903
  hasBrowserEnv: hasBrowserEnv,
1646
1904
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1647
- hasStandardBrowserEnv: hasStandardBrowserEnv
1905
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1906
+ origin: origin
1648
1907
  });
1649
1908
 
1650
1909
  var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
@@ -1764,7 +2023,7 @@
1764
2023
  }
1765
2024
  var defaults = {
1766
2025
  transitional: transitionalDefaults,
1767
- adapter: ['xhr', 'http'],
2026
+ adapter: ['xhr', 'http', 'fetch'],
1768
2027
  transformRequest: [function transformRequest(data, headers) {
1769
2028
  var contentType = headers.getContentType() || '';
1770
2029
  var hasJSONContentType = contentType.indexOf('application/json') > -1;
@@ -1776,7 +2035,7 @@
1776
2035
  if (isFormData) {
1777
2036
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1778
2037
  }
1779
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
2038
+ 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)) {
1780
2039
  return data;
1781
2040
  }
1782
2041
  if (utils$1.isArrayBufferView(data)) {
@@ -1808,6 +2067,9 @@
1808
2067
  var transitional = this.transitional || defaults.transitional;
1809
2068
  var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1810
2069
  var JSONRequested = this.responseType === 'json';
2070
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2071
+ return data;
2072
+ }
1811
2073
  if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1812
2074
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
1813
2075
  var strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -1976,6 +2238,21 @@
1976
2238
  setHeaders(header, valueOrRewrite);
1977
2239
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1978
2240
  setHeaders(parseHeaders(header), valueOrRewrite);
2241
+ } else if (utils$1.isHeaders(header)) {
2242
+ var _iterator = _createForOfIteratorHelper(header.entries()),
2243
+ _step;
2244
+ try {
2245
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2246
+ var _step$value = _slicedToArray(_step.value, 2),
2247
+ key = _step$value[0],
2248
+ value = _step$value[1];
2249
+ setHeader(value, key, rewrite);
2250
+ }
2251
+ } catch (err) {
2252
+ _iterator.e(err);
2253
+ } finally {
2254
+ _iterator.f();
2255
+ }
1979
2256
  } else {
1980
2257
  header != null && setHeader(valueOrRewrite, header, rewrite);
1981
2258
  }
@@ -2227,6 +2504,196 @@
2227
2504
  }
2228
2505
  }
2229
2506
 
2507
+ function parseProtocol(url) {
2508
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2509
+ return match && match[1] || '';
2510
+ }
2511
+
2512
+ /**
2513
+ * Calculate data maxRate
2514
+ * @param {Number} [samplesCount= 10]
2515
+ * @param {Number} [min= 1000]
2516
+ * @returns {Function}
2517
+ */
2518
+ function speedometer(samplesCount, min) {
2519
+ samplesCount = samplesCount || 10;
2520
+ var bytes = new Array(samplesCount);
2521
+ var timestamps = new Array(samplesCount);
2522
+ var head = 0;
2523
+ var tail = 0;
2524
+ var firstSampleTS;
2525
+ min = min !== undefined ? min : 1000;
2526
+ return function push(chunkLength) {
2527
+ var now = Date.now();
2528
+ var startedAt = timestamps[tail];
2529
+ if (!firstSampleTS) {
2530
+ firstSampleTS = now;
2531
+ }
2532
+ bytes[head] = chunkLength;
2533
+ timestamps[head] = now;
2534
+ var i = tail;
2535
+ var bytesCount = 0;
2536
+ while (i !== head) {
2537
+ bytesCount += bytes[i++];
2538
+ i = i % samplesCount;
2539
+ }
2540
+ head = (head + 1) % samplesCount;
2541
+ if (head === tail) {
2542
+ tail = (tail + 1) % samplesCount;
2543
+ }
2544
+ if (now - firstSampleTS < min) {
2545
+ return;
2546
+ }
2547
+ var passed = startedAt && now - startedAt;
2548
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2549
+ };
2550
+ }
2551
+
2552
+ /**
2553
+ * Throttle decorator
2554
+ * @param {Function} fn
2555
+ * @param {Number} freq
2556
+ * @return {Function}
2557
+ */
2558
+ function throttle(fn, freq) {
2559
+ var timestamp = 0;
2560
+ var threshold = 1000 / freq;
2561
+ var lastArgs;
2562
+ var timer;
2563
+ var invoke = function invoke(args) {
2564
+ var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
2565
+ timestamp = now;
2566
+ lastArgs = null;
2567
+ if (timer) {
2568
+ clearTimeout(timer);
2569
+ timer = null;
2570
+ }
2571
+ fn.apply(null, args);
2572
+ };
2573
+ var throttled = function throttled() {
2574
+ var now = Date.now();
2575
+ var passed = now - timestamp;
2576
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2577
+ args[_key] = arguments[_key];
2578
+ }
2579
+ if (passed >= threshold) {
2580
+ invoke(args, now);
2581
+ } else {
2582
+ lastArgs = args;
2583
+ if (!timer) {
2584
+ timer = setTimeout(function () {
2585
+ timer = null;
2586
+ invoke(lastArgs);
2587
+ }, threshold - passed);
2588
+ }
2589
+ }
2590
+ };
2591
+ var flush = function flush() {
2592
+ return lastArgs && invoke(lastArgs);
2593
+ };
2594
+ return [throttled, flush];
2595
+ }
2596
+
2597
+ var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
2598
+ var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
2599
+ var bytesNotified = 0;
2600
+ var _speedometer = speedometer(50, 250);
2601
+ return throttle(function (e) {
2602
+ var loaded = e.loaded;
2603
+ var total = e.lengthComputable ? e.total : undefined;
2604
+ var progressBytes = loaded - bytesNotified;
2605
+ var rate = _speedometer(progressBytes);
2606
+ var inRange = loaded <= total;
2607
+ bytesNotified = loaded;
2608
+ var data = _defineProperty({
2609
+ loaded: loaded,
2610
+ total: total,
2611
+ progress: total ? loaded / total : undefined,
2612
+ bytes: progressBytes,
2613
+ rate: rate ? rate : undefined,
2614
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2615
+ event: e,
2616
+ lengthComputable: total != null
2617
+ }, isDownloadStream ? 'download' : 'upload', true);
2618
+ listener(data);
2619
+ }, freq);
2620
+ };
2621
+ var progressEventDecorator = function progressEventDecorator(total, throttled) {
2622
+ var lengthComputable = total != null;
2623
+ return [function (loaded) {
2624
+ return throttled[0]({
2625
+ lengthComputable: lengthComputable,
2626
+ total: total,
2627
+ loaded: loaded
2628
+ });
2629
+ }, throttled[1]];
2630
+ };
2631
+ var asyncDecorator = function asyncDecorator(fn) {
2632
+ return function () {
2633
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2634
+ args[_key] = arguments[_key];
2635
+ }
2636
+ return utils$1.asap(function () {
2637
+ return fn.apply(void 0, args);
2638
+ });
2639
+ };
2640
+ };
2641
+
2642
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
2643
+ // Standard browser envs have full support of the APIs needed to test
2644
+ // whether the request URL is of the same origin as current location.
2645
+ function standardBrowserEnv() {
2646
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
2647
+ var urlParsingNode = document.createElement('a');
2648
+ var originURL;
2649
+
2650
+ /**
2651
+ * Parse a URL to discover its components
2652
+ *
2653
+ * @param {String} url The URL to be parsed
2654
+ * @returns {Object}
2655
+ */
2656
+ function resolveURL(url) {
2657
+ var href = url;
2658
+ if (msie) {
2659
+ // IE needs attribute set twice to normalize properties
2660
+ urlParsingNode.setAttribute('href', href);
2661
+ href = urlParsingNode.href;
2662
+ }
2663
+ urlParsingNode.setAttribute('href', href);
2664
+
2665
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2666
+ return {
2667
+ href: urlParsingNode.href,
2668
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2669
+ host: urlParsingNode.host,
2670
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2671
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2672
+ hostname: urlParsingNode.hostname,
2673
+ port: urlParsingNode.port,
2674
+ pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
2675
+ };
2676
+ }
2677
+ originURL = resolveURL(window.location.href);
2678
+
2679
+ /**
2680
+ * Determine if a URL shares the same origin as the current location
2681
+ *
2682
+ * @param {String} requestURL The URL to test
2683
+ * @returns {boolean} True if URL shares the same origin, otherwise false
2684
+ */
2685
+ return function isURLSameOrigin(requestURL) {
2686
+ var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
2687
+ return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
2688
+ };
2689
+ }() :
2690
+ // Non standard browser envs (web workers, react-native) lack needed support.
2691
+ function nonStandardBrowserEnv() {
2692
+ return function isURLSameOrigin() {
2693
+ return true;
2694
+ };
2695
+ }();
2696
+
2230
2697
  var cookies = platform.hasStandardBrowserEnv ?
2231
2698
  // Standard browser envs support document.cookie
2232
2699
  {
@@ -2298,173 +2765,182 @@
2298
2765
  return requestedURL;
2299
2766
  }
2300
2767
 
2301
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
2302
- // Standard browser envs have full support of the APIs needed to test
2303
- // whether the request URL is of the same origin as current location.
2304
- function standardBrowserEnv() {
2305
- var msie = /(msie|trident)/i.test(navigator.userAgent);
2306
- var urlParsingNode = document.createElement('a');
2307
- var originURL;
2768
+ var headersToObject = function headersToObject(thing) {
2769
+ return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
2770
+ };
2308
2771
 
2309
- /**
2310
- * Parse a URL to discover its components
2311
- *
2312
- * @param {String} url The URL to be parsed
2313
- * @returns {Object}
2314
- */
2315
- function resolveURL(url) {
2316
- var href = url;
2317
- if (msie) {
2318
- // IE needs attribute set twice to normalize properties
2319
- urlParsingNode.setAttribute('href', href);
2320
- href = urlParsingNode.href;
2772
+ /**
2773
+ * Config-specific merge-function which creates a new config-object
2774
+ * by merging two configuration objects together.
2775
+ *
2776
+ * @param {Object} config1
2777
+ * @param {Object} config2
2778
+ *
2779
+ * @returns {Object} New object resulting from merging config2 to config1
2780
+ */
2781
+ function mergeConfig(config1, config2) {
2782
+ // eslint-disable-next-line no-param-reassign
2783
+ config2 = config2 || {};
2784
+ var config = {};
2785
+ function getMergedValue(target, source, caseless) {
2786
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2787
+ return utils$1.merge.call({
2788
+ caseless: caseless
2789
+ }, target, source);
2790
+ } else if (utils$1.isPlainObject(source)) {
2791
+ return utils$1.merge({}, source);
2792
+ } else if (utils$1.isArray(source)) {
2793
+ return source.slice();
2321
2794
  }
2322
- urlParsingNode.setAttribute('href', href);
2323
-
2324
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2325
- return {
2326
- href: urlParsingNode.href,
2327
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2328
- host: urlParsingNode.host,
2329
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2330
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2331
- hostname: urlParsingNode.hostname,
2332
- port: urlParsingNode.port,
2333
- pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
2334
- };
2795
+ return source;
2335
2796
  }
2336
- originURL = resolveURL(window.location.href);
2337
-
2338
- /**
2339
- * Determine if a URL shares the same origin as the current location
2340
- *
2341
- * @param {String} requestURL The URL to test
2342
- * @returns {boolean} True if URL shares the same origin, otherwise false
2343
- */
2344
- return function isURLSameOrigin(requestURL) {
2345
- var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
2346
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
2347
- };
2348
- }() :
2349
- // Non standard browser envs (web workers, react-native) lack needed support.
2350
- function nonStandardBrowserEnv() {
2351
- return function isURLSameOrigin() {
2352
- return true;
2353
- };
2354
- }();
2355
2797
 
2356
- function parseProtocol(url) {
2357
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2358
- return match && match[1] || '';
2359
- }
2798
+ // eslint-disable-next-line consistent-return
2799
+ function mergeDeepProperties(a, b, caseless) {
2800
+ if (!utils$1.isUndefined(b)) {
2801
+ return getMergedValue(a, b, caseless);
2802
+ } else if (!utils$1.isUndefined(a)) {
2803
+ return getMergedValue(undefined, a, caseless);
2804
+ }
2805
+ }
2360
2806
 
2361
- /**
2362
- * Calculate data maxRate
2363
- * @param {Number} [samplesCount= 10]
2364
- * @param {Number} [min= 1000]
2365
- * @returns {Function}
2366
- */
2367
- function speedometer(samplesCount, min) {
2368
- samplesCount = samplesCount || 10;
2369
- var bytes = new Array(samplesCount);
2370
- var timestamps = new Array(samplesCount);
2371
- var head = 0;
2372
- var tail = 0;
2373
- var firstSampleTS;
2374
- min = min !== undefined ? min : 1000;
2375
- return function push(chunkLength) {
2376
- var now = Date.now();
2377
- var startedAt = timestamps[tail];
2378
- if (!firstSampleTS) {
2379
- firstSampleTS = now;
2807
+ // eslint-disable-next-line consistent-return
2808
+ function valueFromConfig2(a, b) {
2809
+ if (!utils$1.isUndefined(b)) {
2810
+ return getMergedValue(undefined, b);
2380
2811
  }
2381
- bytes[head] = chunkLength;
2382
- timestamps[head] = now;
2383
- var i = tail;
2384
- var bytesCount = 0;
2385
- while (i !== head) {
2386
- bytesCount += bytes[i++];
2387
- i = i % samplesCount;
2812
+ }
2813
+
2814
+ // eslint-disable-next-line consistent-return
2815
+ function defaultToConfig2(a, b) {
2816
+ if (!utils$1.isUndefined(b)) {
2817
+ return getMergedValue(undefined, b);
2818
+ } else if (!utils$1.isUndefined(a)) {
2819
+ return getMergedValue(undefined, a);
2388
2820
  }
2389
- head = (head + 1) % samplesCount;
2390
- if (head === tail) {
2391
- tail = (tail + 1) % samplesCount;
2821
+ }
2822
+
2823
+ // eslint-disable-next-line consistent-return
2824
+ function mergeDirectKeys(a, b, prop) {
2825
+ if (prop in config2) {
2826
+ return getMergedValue(a, b);
2827
+ } else if (prop in config1) {
2828
+ return getMergedValue(undefined, a);
2392
2829
  }
2393
- if (now - firstSampleTS < min) {
2394
- return;
2830
+ }
2831
+ var mergeMap = {
2832
+ url: valueFromConfig2,
2833
+ method: valueFromConfig2,
2834
+ data: valueFromConfig2,
2835
+ baseURL: defaultToConfig2,
2836
+ transformRequest: defaultToConfig2,
2837
+ transformResponse: defaultToConfig2,
2838
+ paramsSerializer: defaultToConfig2,
2839
+ timeout: defaultToConfig2,
2840
+ timeoutMessage: defaultToConfig2,
2841
+ withCredentials: defaultToConfig2,
2842
+ withXSRFToken: defaultToConfig2,
2843
+ adapter: defaultToConfig2,
2844
+ responseType: defaultToConfig2,
2845
+ xsrfCookieName: defaultToConfig2,
2846
+ xsrfHeaderName: defaultToConfig2,
2847
+ onUploadProgress: defaultToConfig2,
2848
+ onDownloadProgress: defaultToConfig2,
2849
+ decompress: defaultToConfig2,
2850
+ maxContentLength: defaultToConfig2,
2851
+ maxBodyLength: defaultToConfig2,
2852
+ beforeRedirect: defaultToConfig2,
2853
+ transport: defaultToConfig2,
2854
+ httpAgent: defaultToConfig2,
2855
+ httpsAgent: defaultToConfig2,
2856
+ cancelToken: defaultToConfig2,
2857
+ socketPath: defaultToConfig2,
2858
+ responseEncoding: defaultToConfig2,
2859
+ validateStatus: mergeDirectKeys,
2860
+ headers: function headers(a, b) {
2861
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2395
2862
  }
2396
- var passed = startedAt && now - startedAt;
2397
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2398
2863
  };
2864
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2865
+ var merge = mergeMap[prop] || mergeDeepProperties;
2866
+ var configValue = merge(config1[prop], config2[prop], prop);
2867
+ utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2868
+ });
2869
+ return config;
2399
2870
  }
2400
2871
 
2401
- function progressEventReducer(listener, isDownloadStream) {
2402
- var bytesNotified = 0;
2403
- var _speedometer = speedometer(50, 250);
2404
- return function (e) {
2405
- var loaded = e.loaded;
2406
- var total = e.lengthComputable ? e.total : undefined;
2407
- var progressBytes = loaded - bytesNotified;
2408
- var rate = _speedometer(progressBytes);
2409
- var inRange = loaded <= total;
2410
- bytesNotified = loaded;
2411
- var data = {
2412
- loaded: loaded,
2413
- total: total,
2414
- progress: total ? loaded / total : undefined,
2415
- bytes: progressBytes,
2416
- rate: rate ? rate : undefined,
2417
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2418
- event: e
2419
- };
2420
- data[isDownloadStream ? 'download' : 'upload'] = true;
2421
- listener(data);
2422
- };
2423
- }
2872
+ var resolveConfig = (function (config) {
2873
+ var newConfig = mergeConfig({}, config);
2874
+ var data = newConfig.data,
2875
+ withXSRFToken = newConfig.withXSRFToken,
2876
+ xsrfHeaderName = newConfig.xsrfHeaderName,
2877
+ xsrfCookieName = newConfig.xsrfCookieName,
2878
+ headers = newConfig.headers,
2879
+ auth = newConfig.auth;
2880
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
2881
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2882
+
2883
+ // HTTP basic authentication
2884
+ if (auth) {
2885
+ headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
2886
+ }
2887
+ var contentType;
2888
+ if (utils$1.isFormData(data)) {
2889
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2890
+ headers.setContentType(undefined); // Let the browser set it
2891
+ } else if ((contentType = headers.getContentType()) !== false) {
2892
+ // fix semicolon duplication issue for ReactNative FormData implementation
2893
+ var _ref = contentType ? contentType.split(';').map(function (token) {
2894
+ return token.trim();
2895
+ }).filter(Boolean) : [],
2896
+ _ref2 = _toArray(_ref),
2897
+ type = _ref2[0],
2898
+ tokens = _ref2.slice(1);
2899
+ headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
2900
+ }
2901
+ }
2902
+
2903
+ // Add xsrf header
2904
+ // This is only done if running in a standard browser environment.
2905
+ // Specifically not if we're in a web worker, or react-native.
2906
+
2907
+ if (platform.hasStandardBrowserEnv) {
2908
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2909
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2910
+ // Add xsrf header
2911
+ var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2912
+ if (xsrfValue) {
2913
+ headers.set(xsrfHeaderName, xsrfValue);
2914
+ }
2915
+ }
2916
+ }
2917
+ return newConfig;
2918
+ });
2919
+
2424
2920
  var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2425
2921
  var xhrAdapter = isXHRAdapterSupported && function (config) {
2426
2922
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2427
- var requestData = config.data;
2428
- var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
2429
- var responseType = config.responseType,
2430
- withXSRFToken = config.withXSRFToken;
2923
+ var _config = resolveConfig(config);
2924
+ var requestData = _config.data;
2925
+ var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2926
+ var responseType = _config.responseType,
2927
+ onUploadProgress = _config.onUploadProgress,
2928
+ onDownloadProgress = _config.onDownloadProgress;
2431
2929
  var onCanceled;
2930
+ var uploadThrottled, downloadThrottled;
2931
+ var flushUpload, flushDownload;
2432
2932
  function done() {
2433
- if (config.cancelToken) {
2434
- config.cancelToken.unsubscribe(onCanceled);
2435
- }
2436
- if (config.signal) {
2437
- config.signal.removeEventListener('abort', onCanceled);
2438
- }
2439
- }
2440
- var contentType;
2441
- if (utils$1.isFormData(requestData)) {
2442
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2443
- requestHeaders.setContentType(false); // Let the browser set it
2444
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
2445
- // fix semicolon duplication issue for ReactNative FormData implementation
2446
- var _ref = contentType ? contentType.split(';').map(function (token) {
2447
- return token.trim();
2448
- }).filter(Boolean) : [],
2449
- _ref2 = _toArray(_ref),
2450
- type = _ref2[0],
2451
- tokens = _ref2.slice(1);
2452
- requestHeaders.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
2453
- }
2454
- }
2455
- var request = new XMLHttpRequest();
2933
+ flushUpload && flushUpload(); // flush events
2934
+ flushDownload && flushDownload(); // flush events
2456
2935
 
2457
- // HTTP basic authentication
2458
- if (config.auth) {
2459
- var username = config.auth.username || '';
2460
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2461
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2936
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2937
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
2462
2938
  }
2463
- var fullPath = buildFullPath(config.baseURL, config.url);
2464
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2939
+ var request = new XMLHttpRequest();
2940
+ request.open(_config.method.toUpperCase(), _config.url, true);
2465
2941
 
2466
2942
  // Set the request timeout in MS
2467
- request.timeout = config.timeout;
2943
+ request.timeout = _config.timeout;
2468
2944
  function onloadend() {
2469
2945
  if (!request) {
2470
2946
  return;
@@ -2537,10 +3013,10 @@
2537
3013
 
2538
3014
  // Handle timeout
2539
3015
  request.ontimeout = function handleTimeout() {
2540
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2541
- var transitional = config.transitional || transitionalDefaults;
2542
- if (config.timeoutErrorMessage) {
2543
- timeoutErrorMessage = config.timeoutErrorMessage;
3016
+ var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
3017
+ var transitional = _config.transitional || transitionalDefaults;
3018
+ if (_config.timeoutErrorMessage) {
3019
+ timeoutErrorMessage = _config.timeoutErrorMessage;
2544
3020
  }
2545
3021
  reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
2546
3022
 
@@ -2548,20 +3024,6 @@
2548
3024
  request = null;
2549
3025
  };
2550
3026
 
2551
- // Add xsrf header
2552
- // This is only done if running in a standard browser environment.
2553
- // Specifically not if we're in a web worker, or react-native.
2554
- if (platform.hasStandardBrowserEnv) {
2555
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
2556
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
2557
- // Add xsrf header
2558
- var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2559
- if (xsrfValue) {
2560
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2561
- }
2562
- }
2563
- }
2564
-
2565
3027
  // Remove Content-Type if data is undefined
2566
3028
  requestData === undefined && requestHeaders.setContentType(null);
2567
3029
 
@@ -2573,25 +3035,34 @@
2573
3035
  }
2574
3036
 
2575
3037
  // Add withCredentials to request if needed
2576
- if (!utils$1.isUndefined(config.withCredentials)) {
2577
- request.withCredentials = !!config.withCredentials;
3038
+ if (!utils$1.isUndefined(_config.withCredentials)) {
3039
+ request.withCredentials = !!_config.withCredentials;
2578
3040
  }
2579
3041
 
2580
3042
  // Add responseType to request if needed
2581
3043
  if (responseType && responseType !== 'json') {
2582
- request.responseType = config.responseType;
3044
+ request.responseType = _config.responseType;
2583
3045
  }
2584
3046
 
2585
3047
  // Handle progress if needed
2586
- if (typeof config.onDownloadProgress === 'function') {
2587
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
3048
+ if (onDownloadProgress) {
3049
+ var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
3050
+ var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
3051
+ downloadThrottled = _progressEventReducer2[0];
3052
+ flushDownload = _progressEventReducer2[1];
3053
+ request.addEventListener('progress', downloadThrottled);
2588
3054
  }
2589
3055
 
2590
3056
  // Not all browsers support upload events
2591
- if (typeof config.onUploadProgress === 'function' && request.upload) {
2592
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
3057
+ if (onUploadProgress && request.upload) {
3058
+ var _progressEventReducer3 = progressEventReducer(onUploadProgress);
3059
+ var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
3060
+ uploadThrottled = _progressEventReducer4[0];
3061
+ flushUpload = _progressEventReducer4[1];
3062
+ request.upload.addEventListener('progress', uploadThrottled);
3063
+ request.upload.addEventListener('loadend', flushUpload);
2593
3064
  }
2594
- if (config.cancelToken || config.signal) {
3065
+ if (_config.cancelToken || _config.signal) {
2595
3066
  // Handle cancellation
2596
3067
  // eslint-disable-next-line func-names
2597
3068
  onCanceled = function onCanceled(cancel) {
@@ -2602,12 +3073,12 @@
2602
3073
  request.abort();
2603
3074
  request = null;
2604
3075
  };
2605
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
2606
- if (config.signal) {
2607
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
3076
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3077
+ if (_config.signal) {
3078
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
2608
3079
  }
2609
3080
  }
2610
- var protocol = parseProtocol(fullPath);
3081
+ var protocol = parseProtocol(_config.url);
2611
3082
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
2612
3083
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2613
3084
  return;
@@ -2618,9 +3089,480 @@
2618
3089
  });
2619
3090
  };
2620
3091
 
3092
+ var composeSignals = function composeSignals(signals, timeout) {
3093
+ var controller = new AbortController();
3094
+ var aborted;
3095
+ var onabort = function onabort(cancel) {
3096
+ if (!aborted) {
3097
+ aborted = true;
3098
+ unsubscribe();
3099
+ var err = cancel instanceof Error ? cancel : this.reason;
3100
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3101
+ }
3102
+ };
3103
+ var timer = timeout && setTimeout(function () {
3104
+ onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
3105
+ }, timeout);
3106
+ var unsubscribe = function unsubscribe() {
3107
+ if (signals) {
3108
+ timer && clearTimeout(timer);
3109
+ timer = null;
3110
+ signals.forEach(function (signal) {
3111
+ signal && (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
3112
+ });
3113
+ signals = null;
3114
+ }
3115
+ };
3116
+ signals.forEach(function (signal) {
3117
+ return signal && signal.addEventListener && signal.addEventListener('abort', onabort);
3118
+ });
3119
+ var signal = controller.signal;
3120
+ signal.unsubscribe = unsubscribe;
3121
+ return [signal, function () {
3122
+ timer && clearTimeout(timer);
3123
+ timer = null;
3124
+ }];
3125
+ };
3126
+ var composeSignals$1 = composeSignals;
3127
+
3128
+ var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) {
3129
+ var len, pos, end;
3130
+ return _regeneratorRuntime().wrap(function streamChunk$(_context) {
3131
+ while (1) switch (_context.prev = _context.next) {
3132
+ case 0:
3133
+ len = chunk.byteLength;
3134
+ if (!(!chunkSize || len < chunkSize)) {
3135
+ _context.next = 5;
3136
+ break;
3137
+ }
3138
+ _context.next = 4;
3139
+ return chunk;
3140
+ case 4:
3141
+ return _context.abrupt("return");
3142
+ case 5:
3143
+ pos = 0;
3144
+ case 6:
3145
+ if (!(pos < len)) {
3146
+ _context.next = 13;
3147
+ break;
3148
+ }
3149
+ end = pos + chunkSize;
3150
+ _context.next = 10;
3151
+ return chunk.slice(pos, end);
3152
+ case 10:
3153
+ pos = end;
3154
+ _context.next = 6;
3155
+ break;
3156
+ case 13:
3157
+ case "end":
3158
+ return _context.stop();
3159
+ }
3160
+ }, streamChunk);
3161
+ });
3162
+ var readBytes = /*#__PURE__*/function () {
3163
+ var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize, encode) {
3164
+ var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
3165
+ return _regeneratorRuntime().wrap(function _callee$(_context2) {
3166
+ while (1) switch (_context2.prev = _context2.next) {
3167
+ case 0:
3168
+ _iteratorAbruptCompletion = false;
3169
+ _didIteratorError = false;
3170
+ _context2.prev = 2;
3171
+ _iterator = _asyncIterator(iterable);
3172
+ case 4:
3173
+ _context2.next = 6;
3174
+ return _awaitAsyncGenerator(_iterator.next());
3175
+ case 6:
3176
+ if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
3177
+ _context2.next = 27;
3178
+ break;
3179
+ }
3180
+ chunk = _step.value;
3181
+ _context2.t0 = _asyncGeneratorDelegate;
3182
+ _context2.t1 = _asyncIterator;
3183
+ _context2.t2 = streamChunk;
3184
+ if (!ArrayBuffer.isView(chunk)) {
3185
+ _context2.next = 15;
3186
+ break;
3187
+ }
3188
+ _context2.t3 = chunk;
3189
+ _context2.next = 18;
3190
+ break;
3191
+ case 15:
3192
+ _context2.next = 17;
3193
+ return _awaitAsyncGenerator(encode(String(chunk)));
3194
+ case 17:
3195
+ _context2.t3 = _context2.sent;
3196
+ case 18:
3197
+ _context2.t4 = _context2.t3;
3198
+ _context2.t5 = chunkSize;
3199
+ _context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5);
3200
+ _context2.t7 = (0, _context2.t1)(_context2.t6);
3201
+ _context2.t8 = _awaitAsyncGenerator;
3202
+ return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24);
3203
+ case 24:
3204
+ _iteratorAbruptCompletion = false;
3205
+ _context2.next = 4;
3206
+ break;
3207
+ case 27:
3208
+ _context2.next = 33;
3209
+ break;
3210
+ case 29:
3211
+ _context2.prev = 29;
3212
+ _context2.t10 = _context2["catch"](2);
3213
+ _didIteratorError = true;
3214
+ _iteratorError = _context2.t10;
3215
+ case 33:
3216
+ _context2.prev = 33;
3217
+ _context2.prev = 34;
3218
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
3219
+ _context2.next = 38;
3220
+ break;
3221
+ }
3222
+ _context2.next = 38;
3223
+ return _awaitAsyncGenerator(_iterator["return"]());
3224
+ case 38:
3225
+ _context2.prev = 38;
3226
+ if (!_didIteratorError) {
3227
+ _context2.next = 41;
3228
+ break;
3229
+ }
3230
+ throw _iteratorError;
3231
+ case 41:
3232
+ return _context2.finish(38);
3233
+ case 42:
3234
+ return _context2.finish(33);
3235
+ case 43:
3236
+ case "end":
3237
+ return _context2.stop();
3238
+ }
3239
+ }, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]);
3240
+ }));
3241
+ return function readBytes(_x, _x2, _x3) {
3242
+ return _ref.apply(this, arguments);
3243
+ };
3244
+ }();
3245
+ var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish, encode) {
3246
+ var iterator = readBytes(stream, chunkSize, encode);
3247
+ var bytes = 0;
3248
+ var done;
3249
+ var _onFinish = function _onFinish(e) {
3250
+ if (!done) {
3251
+ done = true;
3252
+ onFinish && onFinish(e);
3253
+ }
3254
+ };
3255
+ return new ReadableStream({
3256
+ pull: function pull(controller) {
3257
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3258
+ var _yield$iterator$next, _done, value, len, loadedBytes;
3259
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
3260
+ while (1) switch (_context3.prev = _context3.next) {
3261
+ case 0:
3262
+ _context3.prev = 0;
3263
+ _context3.next = 3;
3264
+ return iterator.next();
3265
+ case 3:
3266
+ _yield$iterator$next = _context3.sent;
3267
+ _done = _yield$iterator$next.done;
3268
+ value = _yield$iterator$next.value;
3269
+ if (!_done) {
3270
+ _context3.next = 10;
3271
+ break;
3272
+ }
3273
+ _onFinish();
3274
+ controller.close();
3275
+ return _context3.abrupt("return");
3276
+ case 10:
3277
+ len = value.byteLength;
3278
+ if (onProgress) {
3279
+ loadedBytes = bytes += len;
3280
+ onProgress(loadedBytes);
3281
+ }
3282
+ controller.enqueue(new Uint8Array(value));
3283
+ _context3.next = 19;
3284
+ break;
3285
+ case 15:
3286
+ _context3.prev = 15;
3287
+ _context3.t0 = _context3["catch"](0);
3288
+ _onFinish(_context3.t0);
3289
+ throw _context3.t0;
3290
+ case 19:
3291
+ case "end":
3292
+ return _context3.stop();
3293
+ }
3294
+ }, _callee2, null, [[0, 15]]);
3295
+ }))();
3296
+ },
3297
+ cancel: function cancel(reason) {
3298
+ _onFinish(reason);
3299
+ return iterator["return"]();
3300
+ }
3301
+ }, {
3302
+ highWaterMark: 2
3303
+ });
3304
+ };
3305
+
3306
+ var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
3307
+ var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
3308
+
3309
+ // used only inside the fetch adapter
3310
+ var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
3311
+ return function (str) {
3312
+ return encoder.encode(str);
3313
+ };
3314
+ }(new TextEncoder()) : ( /*#__PURE__*/function () {
3315
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) {
3316
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3317
+ while (1) switch (_context.prev = _context.next) {
3318
+ case 0:
3319
+ _context.t0 = Uint8Array;
3320
+ _context.next = 3;
3321
+ return new Response(str).arrayBuffer();
3322
+ case 3:
3323
+ _context.t1 = _context.sent;
3324
+ return _context.abrupt("return", new _context.t0(_context.t1));
3325
+ case 5:
3326
+ case "end":
3327
+ return _context.stop();
3328
+ }
3329
+ }, _callee);
3330
+ }));
3331
+ return function (_x) {
3332
+ return _ref.apply(this, arguments);
3333
+ };
3334
+ }()));
3335
+ var test = function test(fn) {
3336
+ try {
3337
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3338
+ args[_key - 1] = arguments[_key];
3339
+ }
3340
+ return !!fn.apply(void 0, args);
3341
+ } catch (e) {
3342
+ return false;
3343
+ }
3344
+ };
3345
+ var supportsRequestStream = isReadableStreamSupported && test(function () {
3346
+ var duplexAccessed = false;
3347
+ var hasContentType = new Request(platform.origin, {
3348
+ body: new ReadableStream(),
3349
+ method: 'POST',
3350
+ get duplex() {
3351
+ duplexAccessed = true;
3352
+ return 'half';
3353
+ }
3354
+ }).headers.has('Content-Type');
3355
+ return duplexAccessed && !hasContentType;
3356
+ });
3357
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
3358
+ var supportsResponseStream = isReadableStreamSupported && test(function () {
3359
+ return utils$1.isReadableStream(new Response('').body);
3360
+ });
3361
+ var resolvers = {
3362
+ stream: supportsResponseStream && function (res) {
3363
+ return res.body;
3364
+ }
3365
+ };
3366
+ isFetchSupported && function (res) {
3367
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
3368
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
3369
+ return res[type]();
3370
+ } : function (_, config) {
3371
+ throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
3372
+ });
3373
+ });
3374
+ }(new Response());
3375
+ var getBodyLength = /*#__PURE__*/function () {
3376
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
3377
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3378
+ while (1) switch (_context2.prev = _context2.next) {
3379
+ case 0:
3380
+ if (!(body == null)) {
3381
+ _context2.next = 2;
3382
+ break;
3383
+ }
3384
+ return _context2.abrupt("return", 0);
3385
+ case 2:
3386
+ if (!utils$1.isBlob(body)) {
3387
+ _context2.next = 4;
3388
+ break;
3389
+ }
3390
+ return _context2.abrupt("return", body.size);
3391
+ case 4:
3392
+ if (!utils$1.isSpecCompliantForm(body)) {
3393
+ _context2.next = 8;
3394
+ break;
3395
+ }
3396
+ _context2.next = 7;
3397
+ return new Request(body).arrayBuffer();
3398
+ case 7:
3399
+ return _context2.abrupt("return", _context2.sent.byteLength);
3400
+ case 8:
3401
+ if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
3402
+ _context2.next = 10;
3403
+ break;
3404
+ }
3405
+ return _context2.abrupt("return", body.byteLength);
3406
+ case 10:
3407
+ if (utils$1.isURLSearchParams(body)) {
3408
+ body = body + '';
3409
+ }
3410
+ if (!utils$1.isString(body)) {
3411
+ _context2.next = 15;
3412
+ break;
3413
+ }
3414
+ _context2.next = 14;
3415
+ return encodeText(body);
3416
+ case 14:
3417
+ return _context2.abrupt("return", _context2.sent.byteLength);
3418
+ case 15:
3419
+ case "end":
3420
+ return _context2.stop();
3421
+ }
3422
+ }, _callee2);
3423
+ }));
3424
+ return function getBodyLength(_x2) {
3425
+ return _ref2.apply(this, arguments);
3426
+ };
3427
+ }();
3428
+ var resolveBodyLength = /*#__PURE__*/function () {
3429
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
3430
+ var length;
3431
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3432
+ while (1) switch (_context3.prev = _context3.next) {
3433
+ case 0:
3434
+ length = utils$1.toFiniteNumber(headers.getContentLength());
3435
+ return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
3436
+ case 2:
3437
+ case "end":
3438
+ return _context3.stop();
3439
+ }
3440
+ }, _callee3);
3441
+ }));
3442
+ return function resolveBodyLength(_x3, _x4) {
3443
+ return _ref3.apply(this, arguments);
3444
+ };
3445
+ }();
3446
+ var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
3447
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
3448
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, response, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, responseData;
3449
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3450
+ while (1) switch (_context4.prev = _context4.next) {
3451
+ case 0:
3452
+ _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;
3453
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3454
+ _ref5 = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [], _ref6 = _slicedToArray(_ref5, 2), composedSignal = _ref6[0], stopTimeout = _ref6[1];
3455
+ onFinish = function onFinish() {
3456
+ !finished && setTimeout(function () {
3457
+ composedSignal && composedSignal.unsubscribe();
3458
+ });
3459
+ finished = true;
3460
+ };
3461
+ _context4.prev = 4;
3462
+ _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3463
+ if (!_context4.t0) {
3464
+ _context4.next = 11;
3465
+ break;
3466
+ }
3467
+ _context4.next = 9;
3468
+ return resolveBodyLength(headers, data);
3469
+ case 9:
3470
+ _context4.t1 = requestContentLength = _context4.sent;
3471
+ _context4.t0 = _context4.t1 !== 0;
3472
+ case 11:
3473
+ if (!_context4.t0) {
3474
+ _context4.next = 15;
3475
+ break;
3476
+ }
3477
+ _request = new Request(url, {
3478
+ method: 'POST',
3479
+ body: data,
3480
+ duplex: "half"
3481
+ });
3482
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3483
+ headers.setContentType(contentTypeHeader);
3484
+ }
3485
+ if (_request.body) {
3486
+ _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3487
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
3488
+ }
3489
+ case 15:
3490
+ if (!utils$1.isString(withCredentials)) {
3491
+ withCredentials = withCredentials ? 'include' : 'omit';
3492
+ }
3493
+ request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3494
+ signal: composedSignal,
3495
+ method: method.toUpperCase(),
3496
+ headers: headers.normalize().toJSON(),
3497
+ body: data,
3498
+ duplex: "half",
3499
+ credentials: withCredentials
3500
+ }));
3501
+ _context4.next = 19;
3502
+ return fetch(request);
3503
+ case 19:
3504
+ response = _context4.sent;
3505
+ isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3506
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
3507
+ options = {};
3508
+ ['status', 'statusText', 'headers'].forEach(function (prop) {
3509
+ options[prop] = response[prop];
3510
+ });
3511
+ responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3512
+ _ref7 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref8 = _slicedToArray(_ref7, 2), _onProgress = _ref8[0], _flush = _ref8[1];
3513
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3514
+ _flush && _flush();
3515
+ isStreamResponse && onFinish();
3516
+ }, encodeText), options);
3517
+ }
3518
+ responseType = responseType || 'text';
3519
+ _context4.next = 25;
3520
+ return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3521
+ case 25:
3522
+ responseData = _context4.sent;
3523
+ !isStreamResponse && onFinish();
3524
+ stopTimeout && stopTimeout();
3525
+ _context4.next = 30;
3526
+ return new Promise(function (resolve, reject) {
3527
+ settle(resolve, reject, {
3528
+ data: responseData,
3529
+ headers: AxiosHeaders$1.from(response.headers),
3530
+ status: response.status,
3531
+ statusText: response.statusText,
3532
+ config: config,
3533
+ request: request
3534
+ });
3535
+ });
3536
+ case 30:
3537
+ return _context4.abrupt("return", _context4.sent);
3538
+ case 33:
3539
+ _context4.prev = 33;
3540
+ _context4.t2 = _context4["catch"](4);
3541
+ onFinish();
3542
+ if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
3543
+ _context4.next = 38;
3544
+ break;
3545
+ }
3546
+ throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
3547
+ cause: _context4.t2.cause || _context4.t2
3548
+ });
3549
+ case 38:
3550
+ throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
3551
+ case 39:
3552
+ case "end":
3553
+ return _context4.stop();
3554
+ }
3555
+ }, _callee4, null, [[4, 33]]);
3556
+ }));
3557
+ return function (_x5) {
3558
+ return _ref4.apply(this, arguments);
3559
+ };
3560
+ }());
3561
+
2621
3562
  var knownAdapters = {
2622
3563
  http: httpAdapter,
2623
- xhr: xhrAdapter
3564
+ xhr: xhrAdapter,
3565
+ fetch: fetchAdapter
2624
3566
  };
2625
3567
  utils$1.forEach(knownAdapters, function (fn, value) {
2626
3568
  if (fn) {
@@ -2734,111 +3676,7 @@
2734
3676
  });
2735
3677
  }
2736
3678
 
2737
- var headersToObject = function headersToObject(thing) {
2738
- return thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
2739
- };
2740
-
2741
- /**
2742
- * Config-specific merge-function which creates a new config-object
2743
- * by merging two configuration objects together.
2744
- *
2745
- * @param {Object} config1
2746
- * @param {Object} config2
2747
- *
2748
- * @returns {Object} New object resulting from merging config2 to config1
2749
- */
2750
- function mergeConfig(config1, config2) {
2751
- // eslint-disable-next-line no-param-reassign
2752
- config2 = config2 || {};
2753
- var config = {};
2754
- function getMergedValue(target, source, caseless) {
2755
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2756
- return utils$1.merge.call({
2757
- caseless: caseless
2758
- }, target, source);
2759
- } else if (utils$1.isPlainObject(source)) {
2760
- return utils$1.merge({}, source);
2761
- } else if (utils$1.isArray(source)) {
2762
- return source.slice();
2763
- }
2764
- return source;
2765
- }
2766
-
2767
- // eslint-disable-next-line consistent-return
2768
- function mergeDeepProperties(a, b, caseless) {
2769
- if (!utils$1.isUndefined(b)) {
2770
- return getMergedValue(a, b, caseless);
2771
- } else if (!utils$1.isUndefined(a)) {
2772
- return getMergedValue(undefined, a, caseless);
2773
- }
2774
- }
2775
-
2776
- // eslint-disable-next-line consistent-return
2777
- function valueFromConfig2(a, b) {
2778
- if (!utils$1.isUndefined(b)) {
2779
- return getMergedValue(undefined, b);
2780
- }
2781
- }
2782
-
2783
- // eslint-disable-next-line consistent-return
2784
- function defaultToConfig2(a, b) {
2785
- if (!utils$1.isUndefined(b)) {
2786
- return getMergedValue(undefined, b);
2787
- } else if (!utils$1.isUndefined(a)) {
2788
- return getMergedValue(undefined, a);
2789
- }
2790
- }
2791
-
2792
- // eslint-disable-next-line consistent-return
2793
- function mergeDirectKeys(a, b, prop) {
2794
- if (prop in config2) {
2795
- return getMergedValue(a, b);
2796
- } else if (prop in config1) {
2797
- return getMergedValue(undefined, a);
2798
- }
2799
- }
2800
- var mergeMap = {
2801
- url: valueFromConfig2,
2802
- method: valueFromConfig2,
2803
- data: valueFromConfig2,
2804
- baseURL: defaultToConfig2,
2805
- transformRequest: defaultToConfig2,
2806
- transformResponse: defaultToConfig2,
2807
- paramsSerializer: defaultToConfig2,
2808
- timeout: defaultToConfig2,
2809
- timeoutMessage: defaultToConfig2,
2810
- withCredentials: defaultToConfig2,
2811
- withXSRFToken: defaultToConfig2,
2812
- adapter: defaultToConfig2,
2813
- responseType: defaultToConfig2,
2814
- xsrfCookieName: defaultToConfig2,
2815
- xsrfHeaderName: defaultToConfig2,
2816
- onUploadProgress: defaultToConfig2,
2817
- onDownloadProgress: defaultToConfig2,
2818
- decompress: defaultToConfig2,
2819
- maxContentLength: defaultToConfig2,
2820
- maxBodyLength: defaultToConfig2,
2821
- beforeRedirect: defaultToConfig2,
2822
- transport: defaultToConfig2,
2823
- httpAgent: defaultToConfig2,
2824
- httpsAgent: defaultToConfig2,
2825
- cancelToken: defaultToConfig2,
2826
- socketPath: defaultToConfig2,
2827
- responseEncoding: defaultToConfig2,
2828
- validateStatus: mergeDirectKeys,
2829
- headers: function headers(a, b) {
2830
- return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2831
- }
2832
- };
2833
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2834
- var merge = mergeMap[prop] || mergeDeepProperties;
2835
- var configValue = merge(config1[prop], config2[prop], prop);
2836
- utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2837
- });
2838
- return config;
2839
- }
2840
-
2841
- var VERSION = "1.6.7";
3679
+ var VERSION = "1.7.3";
2842
3680
 
2843
3681
  var validators$1 = {};
2844
3682
 
@@ -2944,38 +3782,40 @@
2944
3782
  */
2945
3783
  _createClass(Axios, [{
2946
3784
  key: "request",
2947
- value: function () {
3785
+ value: (function () {
2948
3786
  var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) {
2949
3787
  var dummy, stack;
2950
3788
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2951
- while (1) {
2952
- switch (_context.prev = _context.next) {
2953
- case 0:
2954
- _context.prev = 0;
2955
- _context.next = 3;
2956
- return this._request(configOrUrl, config);
2957
- case 3:
2958
- return _context.abrupt("return", _context.sent);
2959
- case 6:
2960
- _context.prev = 6;
2961
- _context.t0 = _context["catch"](0);
2962
- if (_context.t0 instanceof Error) {
2963
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
2964
-
2965
- // slice off the Error: ... line
2966
- stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3789
+ while (1) switch (_context.prev = _context.next) {
3790
+ case 0:
3791
+ _context.prev = 0;
3792
+ _context.next = 3;
3793
+ return this._request(configOrUrl, config);
3794
+ case 3:
3795
+ return _context.abrupt("return", _context.sent);
3796
+ case 6:
3797
+ _context.prev = 6;
3798
+ _context.t0 = _context["catch"](0);
3799
+ if (_context.t0 instanceof Error) {
3800
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
3801
+
3802
+ // slice off the Error: ... line
3803
+ stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3804
+ try {
2967
3805
  if (!_context.t0.stack) {
2968
3806
  _context.t0.stack = stack;
2969
3807
  // match without the 2 top stack lines
2970
3808
  } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2971
3809
  _context.t0.stack += '\n' + stack;
2972
3810
  }
3811
+ } catch (e) {
3812
+ // ignore the case where "stack" is an un-writable property
2973
3813
  }
2974
- throw _context.t0;
2975
- case 10:
2976
- case "end":
2977
- return _context.stop();
2978
- }
3814
+ }
3815
+ throw _context.t0;
3816
+ case 10:
3817
+ case "end":
3818
+ return _context.stop();
2979
3819
  }
2980
3820
  }, _callee, this, [[0, 6]]);
2981
3821
  }));
@@ -2983,7 +3823,7 @@
2983
3823
  return _request2.apply(this, arguments);
2984
3824
  }
2985
3825
  return request;
2986
- }()
3826
+ }())
2987
3827
  }, {
2988
3828
  key: "_request",
2989
3829
  value: function _request(configOrUrl, config) {