@lcap/axios-fixed 1.13.2

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