codekingpro/portable-devtools
114k
1// Axios v1.6.8 Copyright (c) 2024 Matt Zabriskie and contributors2(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 _iterableToArrayLimit(r, l) {9 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];10 if (null != t) {11 var e,12 n,13 i,14 u,15 a = [],16 f = !0,17 o = !1;18 try {19 if (i = (t = t.call(r)).next, 0 === l) {20 if (Object(t) !== t) return;21 f = !1;22 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);23 } catch (r) {24 o = !0, n = r;25 } finally {26 try {27 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;28 } finally {29 if (o) throw n;30 }31 }32 return a;33 }34 }35 function ownKeys(e, r) {36 var t = Object.keys(e);37 if (Object.getOwnPropertySymbols) {38 var o = Object.getOwnPropertySymbols(e);39 r && (o = o.filter(function (r) {40 return Object.getOwnPropertyDescriptor(e, r).enumerable;41 })), t.push.apply(t, o);42 }43 return t;44 }45 function _objectSpread2(e) {46 for (var r = 1; r < arguments.length; r++) {47 var t = null != arguments[r] ? arguments[r] : {};48 r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {49 _defineProperty(e, r, t[r]);50 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {51 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));52 });53 }54 return e;55 }56 function _regeneratorRuntime() {57 _regeneratorRuntime = function () {58 return e;59 };60 var t,61 e = {},62 r = Object.prototype,63 n = r.hasOwnProperty,64 o = Object.defineProperty || function (t, e, r) {65 t[e] = r.value;66 },67 i = "function" == typeof Symbol ? Symbol : {},68 a = i.iterator || "@@iterator",69 c = i.asyncIterator || "@@asyncIterator",70 u = i.toStringTag || "@@toStringTag";71 function define(t, e, r) {72 return Object.defineProperty(t, e, {73 value: r,74 enumerable: !0,75 configurable: !0,76 writable: !077 }), t[e];78 }79 try {80 define({}, "");81 } catch (t) {82 define = function (t, e, r) {83 return t[e] = r;84 };85 }86 function wrap(t, e, r, n) {87 var i = e && e.prototype instanceof Generator ? e : Generator,88 a = Object.create(i.prototype),89 c = new Context(n || []);90 return o(a, "_invoke", {91 value: makeInvokeMethod(t, r, c)92 }), a;93 }94 function tryCatch(t, e, r) {95 try {96 return {97 type: "normal",98 arg: t.call(e, r)99 };100 } catch (t) {101 return {102 type: "throw",103 arg: t104 };105 }106 }107 e.wrap = wrap;108 var h = "suspendedStart",109 l = "suspendedYield",110 f = "executing",111 s = "completed",112 y = {};113 function Generator() {}114 function GeneratorFunction() {}115 function GeneratorFunctionPrototype() {}116 var p = {};117 define(p, a, function () {118 return this;119 });120 var d = Object.getPrototypeOf,121 v = d && d(d(values([])));122 v && v !== r && n.call(v, a) && (p = v);123 var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);124 function defineIteratorMethods(t) {125 ["next", "throw", "return"].forEach(function (e) {126 define(t, e, function (t) {127 return this._invoke(e, t);128 });129 });130 }131 function AsyncIterator(t, e) {132 function invoke(r, o, i, a) {133 var c = tryCatch(t[r], t, o);134 if ("throw" !== c.type) {135 var u = c.arg,136 h = u.value;137 return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {138 invoke("next", t, i, a);139 }, function (t) {140 invoke("throw", t, i, a);141 }) : e.resolve(h).then(function (t) {142 u.value = t, i(u);143 }, function (t) {144 return invoke("throw", t, i, a);145 });146 }147 a(c.arg);148 }149 var r;150 o(this, "_invoke", {151 value: function (t, n) {152 function callInvokeWithMethodAndArg() {153 return new e(function (e, r) {154 invoke(t, n, e, r);155 });156 }157 return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();158 }159 });160 }161 function makeInvokeMethod(e, r, n) {162 var o = h;163 return function (i, a) {164 if (o === f) throw new Error("Generator is already running");165 if (o === s) {166 if ("throw" === i) throw a;167 return {168 value: t,169 done: !0170 };171 }172 for (n.method = i, n.arg = a;;) {173 var c = n.delegate;174 if (c) {175 var u = maybeInvokeDelegate(c, n);176 if (u) {177 if (u === y) continue;178 return u;179 }180 }181 if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {182 if (o === h) throw o = s, n.arg;183 n.dispatchException(n.arg);184 } else "return" === n.method && n.abrupt("return", n.arg);185 o = f;186 var p = tryCatch(e, r, n);187 if ("normal" === p.type) {188 if (o = n.done ? s : l, p.arg === y) continue;189 return {190 value: p.arg,191 done: n.done192 };193 }194 "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);195 }196 };197 }198 function maybeInvokeDelegate(e, r) {199 var n = r.method,200 o = e.iterator[n];201 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;202 var i = tryCatch(o, e.iterator, r.arg);203 if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;204 var a = i.arg;205 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);206 }207 function pushTryEntry(t) {208 var e = {209 tryLoc: t[0]210 };211 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);212 }213 function resetTryEntry(t) {214 var e = t.completion || {};215 e.type = "normal", delete e.arg, t.completion = e;216 }217 function Context(t) {218 this.tryEntries = [{219 tryLoc: "root"220 }], t.forEach(pushTryEntry, this), this.reset(!0);221 }222 function values(e) {223 if (e || "" === e) {224 var r = e[a];225 if (r) return r.call(e);226 if ("function" == typeof e.next) return e;227 if (!isNaN(e.length)) {228 var o = -1,229 i = function next() {230 for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;231 return next.value = t, next.done = !0, next;232 };233 return i.next = i;234 }235 }236 throw new TypeError(typeof e + " is not iterable");237 }238 return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {239 value: GeneratorFunctionPrototype,240 configurable: !0241 }), o(GeneratorFunctionPrototype, "constructor", {242 value: GeneratorFunction,243 configurable: !0244 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {245 var e = "function" == typeof t && t.constructor;246 return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));247 }, e.mark = function (t) {248 return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;249 }, e.awrap = function (t) {250 return {251 __await: t252 };253 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {254 return this;255 }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {256 void 0 === i && (i = Promise);257 var a = new AsyncIterator(wrap(t, r, n, o), i);258 return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {259 return t.done ? t.value : a.next();260 });261 }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {262 return this;263 }), define(g, "toString", function () {264 return "[object Generator]";265 }), e.keys = function (t) {266 var e = Object(t),267 r = [];268 for (var n in e) r.push(n);269 return r.reverse(), function next() {270 for (; r.length;) {271 var t = r.pop();272 if (t in e) return next.value = t, next.done = !1, next;273 }274 return next.done = !0, next;275 };276 }, e.values = values, Context.prototype = {277 constructor: Context,278 reset: function (e) {279 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);280 },281 stop: function () {282 this.done = !0;283 var t = this.tryEntries[0].completion;284 if ("throw" === t.type) throw t.arg;285 return this.rval;286 },287 dispatchException: function (e) {288 if (this.done) throw e;289 var r = this;290 function handle(n, o) {291 return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;292 }293 for (var o = this.tryEntries.length - 1; o >= 0; --o) {294 var i = this.tryEntries[o],295 a = i.completion;296 if ("root" === i.tryLoc) return handle("end");297 if (i.tryLoc <= this.prev) {298 var c = n.call(i, "catchLoc"),299 u = n.call(i, "finallyLoc");300 if (c && u) {301 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);302 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);303 } else if (c) {304 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);305 } else {306 if (!u) throw new Error("try statement without catch or finally");307 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);308 }309 }310 }311 },312 abrupt: function (t, e) {313 for (var r = this.tryEntries.length - 1; r >= 0; --r) {314 var o = this.tryEntries[r];315 if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {316 var i = o;317 break;318 }319 }320 i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);321 var a = i ? i.completion : {};322 return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);323 },324 complete: function (t, e) {325 if ("throw" === t.type) throw t.arg;326 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;327 },328 finish: function (t) {329 for (var e = this.tryEntries.length - 1; e >= 0; --e) {330 var r = this.tryEntries[e];331 if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;332 }333 },334 catch: function (t) {335 for (var e = this.tryEntries.length - 1; e >= 0; --e) {336 var r = this.tryEntries[e];337 if (r.tryLoc === t) {338 var n = r.completion;339 if ("throw" === n.type) {340 var o = n.arg;341 resetTryEntry(r);342 }343 return o;344 }345 }346 throw new Error("illegal catch attempt");347 },348 delegateYield: function (e, r, n) {349 return this.delegate = {350 iterator: values(e),351 resultName: r,352 nextLoc: n353 }, "next" === this.method && (this.arg = t), y;354 }355 }, e;356 }357 function _toPrimitive(t, r) {358 if ("object" != typeof t || !t) return t;359 var e = t[Symbol.toPrimitive];360 if (void 0 !== e) {361 var i = e.call(t, r || "default");362 if ("object" != typeof i) return i;363 throw new TypeError("@@toPrimitive must return a primitive value.");364 }365 return ("string" === r ? String : Number)(t);366 }367 function _toPropertyKey(t) {368 var i = _toPrimitive(t, "string");369 return "symbol" == typeof i ? i : String(i);370 }371 function _typeof(o) {372 "@babel/helpers - typeof";373 374 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {375 return typeof o;376 } : function (o) {377 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;378 }, _typeof(o);379 }380 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {381 try {382 var info = gen[key](arg);383 var value = info.value;384 } catch (error) {385 reject(error);386 return;387 }388 if (info.done) {389 resolve(value);390 } else {391 Promise.resolve(value).then(_next, _throw);392 }393 }394 function _asyncToGenerator(fn) {395 return function () {396 var self = this,397 args = arguments;398 return new Promise(function (resolve, reject) {399 var gen = fn.apply(self, args);400 function _next(value) {401 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);402 }403 function _throw(err) {404 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);405 }406 _next(undefined);407 });408 };409 }410 function _classCallCheck(instance, Constructor) {411 if (!(instance instanceof Constructor)) {412 throw new TypeError("Cannot call a class as a function");413 }414 }415 function _defineProperties(target, props) {416 for (var i = 0; i < props.length; i++) {417 var descriptor = props[i];418 descriptor.enumerable = descriptor.enumerable || false;419 descriptor.configurable = true;420 if ("value" in descriptor) descriptor.writable = true;421 Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);422 }423 }424 function _createClass(Constructor, protoProps, staticProps) {425 if (protoProps) _defineProperties(Constructor.prototype, protoProps);426 if (staticProps) _defineProperties(Constructor, staticProps);427 Object.defineProperty(Constructor, "prototype", {428 writable: false429 });430 return Constructor;431 }432 function _defineProperty(obj, key, value) {433 key = _toPropertyKey(key);434 if (key in obj) {435 Object.defineProperty(obj, key, {436 value: value,437 enumerable: true,438 configurable: true,439 writable: true440 });441 } else {442 obj[key] = value;443 }444 return obj;445 }446 function _slicedToArray(arr, i) {447 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();448 }449 function _toArray(arr) {450 return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();451 }452 function _toConsumableArray(arr) {453 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();454 }455 function _arrayWithoutHoles(arr) {456 if (Array.isArray(arr)) return _arrayLikeToArray(arr);457 }458 function _arrayWithHoles(arr) {459 if (Array.isArray(arr)) return arr;460 }461 function _iterableToArray(iter) {462 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);463 }464 function _unsupportedIterableToArray(o, minLen) {465 if (!o) return;466 if (typeof o === "string") return _arrayLikeToArray(o, minLen);467 var n = Object.prototype.toString.call(o).slice(8, -1);468 if (n === "Object" && o.constructor) n = o.constructor.name;469 if (n === "Map" || n === "Set") return Array.from(o);470 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);471 }472 function _arrayLikeToArray(arr, len) {473 if (len == null || len > arr.length) len = arr.length;474 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];475 return arr2;476 }477 function _nonIterableSpread() {478 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");479 }480 function _nonIterableRest() {481 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");482 }483 484 function bind(fn, thisArg) {485 return function wrap() {486 return fn.apply(thisArg, arguments);487 };488 }489 490 // utils is a library of generic helper functions non-specific to axios491 492 var toString = Object.prototype.toString;493 var getPrototypeOf = Object.getPrototypeOf;494 var kindOf = function (cache) {495 return function (thing) {496 var str = toString.call(thing);497 return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());498 };499 }(Object.create(null));500 var kindOfTest = function kindOfTest(type) {501 type = type.toLowerCase();502 return function (thing) {503 return kindOf(thing) === type;504 };505 };506 var typeOfTest = function typeOfTest(type) {507 return function (thing) {508 return _typeof(thing) === type;509 };510 };511 512 /**513 * Determine if a value is an Array514 *515 * @param {Object} val The value to test516 *517 * @returns {boolean} True if value is an Array, otherwise false518 */519 var isArray = Array.isArray;520 521 /**522 * Determine if a value is undefined523 *524 * @param {*} val The value to test525 *526 * @returns {boolean} True if the value is undefined, otherwise false527 */528 var isUndefined = typeOfTest('undefined');529 530 /**531 * Determine if a value is a Buffer532 *533 * @param {*} val The value to test534 *535 * @returns {boolean} True if value is a Buffer, otherwise false536 */537 function isBuffer(val) {538 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);539 }540 541 /**542 * Determine if a value is an ArrayBuffer543 *544 * @param {*} val The value to test545 *546 * @returns {boolean} True if value is an ArrayBuffer, otherwise false547 */548 var isArrayBuffer = kindOfTest('ArrayBuffer');549 550 /**551 * Determine if a value is a view on an ArrayBuffer552 *553 * @param {*} val The value to test554 *555 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false556 */557 function isArrayBufferView(val) {558 var result;559 if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {560 result = ArrayBuffer.isView(val);561 } else {562 result = val && val.buffer && isArrayBuffer(val.buffer);563 }564 return result;565 }566 567 /**568 * Determine if a value is a String569 *570 * @param {*} val The value to test571 *572 * @returns {boolean} True if value is a String, otherwise false573 */574 var isString = typeOfTest('string');575 576 /**577 * Determine if a value is a Function578 *579 * @param {*} val The value to test580 * @returns {boolean} True if value is a Function, otherwise false581 */582 var isFunction = typeOfTest('function');583 584 /**585 * Determine if a value is a Number586 *587 * @param {*} val The value to test588 *589 * @returns {boolean} True if value is a Number, otherwise false590 */591 var isNumber = typeOfTest('number');592 593 /**594 * Determine if a value is an Object595 *596 * @param {*} thing The value to test597 *598 * @returns {boolean} True if value is an Object, otherwise false599 */600 var isObject = function isObject(thing) {601 return thing !== null && _typeof(thing) === 'object';602 };603 604 /**605 * Determine if a value is a Boolean606 *607 * @param {*} thing The value to test608 * @returns {boolean} True if value is a Boolean, otherwise false609 */610 var isBoolean = function isBoolean(thing) {611 return thing === true || thing === false;612 };613 614 /**615 * Determine if a value is a plain Object616 *617 * @param {*} val The value to test618 *619 * @returns {boolean} True if value is a plain Object, otherwise false620 */621 var isPlainObject = function isPlainObject(val) {622 if (kindOf(val) !== 'object') {623 return false;624 }625 var prototype = getPrototypeOf(val);626 return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);627 };628 629 /**630 * Determine if a value is a Date631 *632 * @param {*} val The value to test633 *634 * @returns {boolean} True if value is a Date, otherwise false635 */636 var isDate = kindOfTest('Date');637 638 /**639 * Determine if a value is a File640 *641 * @param {*} val The value to test642 *643 * @returns {boolean} True if value is a File, otherwise false644 */645 var isFile = kindOfTest('File');646 647 /**648 * Determine if a value is a Blob649 *650 * @param {*} val The value to test651 *652 * @returns {boolean} True if value is a Blob, otherwise false653 */654 var isBlob = kindOfTest('Blob');655 656 /**657 * Determine if a value is a FileList658 *659 * @param {*} val The value to test660 *661 * @returns {boolean} True if value is a File, otherwise false662 */663 var isFileList = kindOfTest('FileList');664 665 /**666 * Determine if a value is a Stream667 *668 * @param {*} val The value to test669 *670 * @returns {boolean} True if value is a Stream, otherwise false671 */672 var isStream = function isStream(val) {673 return isObject(val) && isFunction(val.pipe);674 };675 676 /**677 * Determine if a value is a FormData678 *679 * @param {*} thing The value to test680 *681 * @returns {boolean} True if value is an FormData, otherwise false682 */683 var isFormData = function isFormData(thing) {684 var kind;685 return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||686 // detect form-data instance687 kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));688 };689 690 /**691 * Determine if a value is a URLSearchParams object692 *693 * @param {*} val The value to test694 *695 * @returns {boolean} True if value is a URLSearchParams object, otherwise false696 */697 var isURLSearchParams = kindOfTest('URLSearchParams');698 699 /**700 * Trim excess whitespace off the beginning and end of a string701 *702 * @param {String} str The String to trim703 *704 * @returns {String} The String freed of excess whitespace705 */706 var trim = function trim(str) {707 return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');708 };709 710 /**711 * Iterate over an Array or an Object invoking a function for each item.712 *713 * If `obj` is an Array callback will be called passing714 * the value, index, and complete array for each item.715 *716 * If 'obj' is an Object callback will be called passing717 * the value, key, and complete object for each property.718 *719 * @param {Object|Array} obj The object to iterate720 * @param {Function} fn The callback to invoke for each item721 *722 * @param {Boolean} [allOwnKeys = false]723 * @returns {any}724 */725 function forEach(obj, fn) {726 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},727 _ref$allOwnKeys = _ref.allOwnKeys,728 allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;729 // Don't bother if no value provided730 if (obj === null || typeof obj === 'undefined') {731 return;732 }733 var i;734 var l;735 736 // Force an array if not already something iterable737 if (_typeof(obj) !== 'object') {738 /*eslint no-param-reassign:0*/739 obj = [obj];740 }741 if (isArray(obj)) {742 // Iterate over array values743 for (i = 0, l = obj.length; i < l; i++) {744 fn.call(null, obj[i], i, obj);745 }746 } else {747 // Iterate over object keys748 var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);749 var len = keys.length;750 var key;751 for (i = 0; i < len; i++) {752 key = keys[i];753 fn.call(null, obj[key], key, obj);754 }755 }756 }757 function findKey(obj, key) {758 key = key.toLowerCase();759 var keys = Object.keys(obj);760 var i = keys.length;761 var _key;762 while (i-- > 0) {763 _key = keys[i];764 if (key === _key.toLowerCase()) {765 return _key;766 }767 }768 return null;769 }770 var _global = function () {771 /*eslint no-undef:0*/772 if (typeof globalThis !== "undefined") return globalThis;773 return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;774 }();775 var isContextDefined = function isContextDefined(context) {776 return !isUndefined(context) && context !== _global;777 };778 779 /**780 * Accepts varargs expecting each argument to be an object, then781 * immutably merges the properties of each object and returns result.782 *783 * When multiple objects contain the same key the later object in784 * the arguments list will take precedence.785 *786 * Example:787 *788 * ```js789 * var result = merge({foo: 123}, {foo: 456});790 * console.log(result.foo); // outputs 456791 * ```792 *793 * @param {Object} obj1 Object to merge794 *795 * @returns {Object} Result of all merge properties796 */797 function merge( /* obj1, obj2, obj3, ... */798 ) {799 var _ref2 = isContextDefined(this) && this || {},800 caseless = _ref2.caseless;801 var result = {};802 var assignValue = function assignValue(val, key) {803 var targetKey = caseless && findKey(result, key) || key;804 if (isPlainObject(result[targetKey]) && isPlainObject(val)) {805 result[targetKey] = merge(result[targetKey], val);806 } else if (isPlainObject(val)) {807 result[targetKey] = merge({}, val);808 } else if (isArray(val)) {809 result[targetKey] = val.slice();810 } else {811 result[targetKey] = val;812 }813 };814 for (var i = 0, l = arguments.length; i < l; i++) {815 arguments[i] && forEach(arguments[i], assignValue);816 }817 return result;818 }819 820 /**821 * Extends object a by mutably adding to it the properties of object b.822 *823 * @param {Object} a The object to be extended824 * @param {Object} b The object to copy properties from825 * @param {Object} thisArg The object to bind function to826 *827 * @param {Boolean} [allOwnKeys]828 * @returns {Object} The resulting value of object a829 */830 var extend = function extend(a, b, thisArg) {831 var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},832 allOwnKeys = _ref3.allOwnKeys;833 forEach(b, function (val, key) {834 if (thisArg && isFunction(val)) {835 a[key] = bind(val, thisArg);836 } else {837 a[key] = val;838 }839 }, {840 allOwnKeys: allOwnKeys841 });842 return a;843 };844 845 /**846 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)847 *848 * @param {string} content with BOM849 *850 * @returns {string} content value without BOM851 */852 var stripBOM = function stripBOM(content) {853 if (content.charCodeAt(0) === 0xFEFF) {854 content = content.slice(1);855 }856 return content;857 };858 859 /**860 * Inherit the prototype methods from one constructor into another861 * @param {function} constructor862 * @param {function} superConstructor863 * @param {object} [props]864 * @param {object} [descriptors]865 *866 * @returns {void}867 */868 var inherits = function inherits(constructor, superConstructor, props, descriptors) {869 constructor.prototype = Object.create(superConstructor.prototype, descriptors);870 constructor.prototype.constructor = constructor;871 Object.defineProperty(constructor, 'super', {872 value: superConstructor.prototype873 });874 props && Object.assign(constructor.prototype, props);875 };876 877 /**878 * Resolve object with deep prototype chain to a flat object879 * @param {Object} sourceObj source object880 * @param {Object} [destObj]881 * @param {Function|Boolean} [filter]882 * @param {Function} [propFilter]883 *884 * @returns {Object}885 */886 var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) {887 var props;888 var i;889 var prop;890 var merged = {};891 destObj = destObj || {};892 // eslint-disable-next-line no-eq-null,eqeqeq893 if (sourceObj == null) return destObj;894 do {895 props = Object.getOwnPropertyNames(sourceObj);896 i = props.length;897 while (i-- > 0) {898 prop = props[i];899 if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {900 destObj[prop] = sourceObj[prop];901 merged[prop] = true;902 }903 }904 sourceObj = filter !== false && getPrototypeOf(sourceObj);905 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);906 return destObj;907 };908 909 /**910 * Determines whether a string ends with the characters of a specified string911 *912 * @param {String} str913 * @param {String} searchString914 * @param {Number} [position= 0]915 *916 * @returns {boolean}917 */918 var endsWith = function endsWith(str, searchString, position) {919 str = String(str);920 if (position === undefined || position > str.length) {921 position = str.length;922 }923 position -= searchString.length;924 var lastIndex = str.indexOf(searchString, position);925 return lastIndex !== -1 && lastIndex === position;926 };927 928 /**929 * Returns new array from array like object or null if failed930 *931 * @param {*} [thing]932 *933 * @returns {?Array}934 */935 var toArray = function toArray(thing) {936 if (!thing) return null;937 if (isArray(thing)) return thing;938 var i = thing.length;939 if (!isNumber(i)) return null;940 var arr = new Array(i);941 while (i-- > 0) {942 arr[i] = thing[i];943 }944 return arr;945 };946 947 /**948 * Checking if the Uint8Array exists and if it does, it returns a function that checks if the949 * thing passed in is an instance of Uint8Array950 *951 * @param {TypedArray}952 *953 * @returns {Array}954 */955 // eslint-disable-next-line func-names956 var isTypedArray = function (TypedArray) {957 // eslint-disable-next-line func-names958 return function (thing) {959 return TypedArray && thing instanceof TypedArray;960 };961 }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));962 963 /**964 * For each entry in the object, call the function with the key and value.965 *966 * @param {Object<any, any>} obj - The object to iterate over.967 * @param {Function} fn - The function to call for each entry.968 *969 * @returns {void}970 */971 var forEachEntry = function forEachEntry(obj, fn) {972 var generator = obj && obj[Symbol.iterator];973 var iterator = generator.call(obj);974 var result;975 while ((result = iterator.next()) && !result.done) {976 var pair = result.value;977 fn.call(obj, pair[0], pair[1]);978 }979 };980 981 /**982 * It takes a regular expression and a string, and returns an array of all the matches983 *984 * @param {string} regExp - The regular expression to match against.985 * @param {string} str - The string to search.986 *987 * @returns {Array<boolean>}988 */989 var matchAll = function matchAll(regExp, str) {990 var matches;991 var arr = [];992 while ((matches = regExp.exec(str)) !== null) {993 arr.push(matches);994 }995 return arr;996 };997 998 /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */999 var isHTMLForm = kindOfTest('HTMLFormElement');1000 var toCamelCase = function toCamelCase(str) {1001 return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {1002 return p1.toUpperCase() + p2;1003 });1004 };1005 1006 /* Creating a function that will check if an object has a property. */1007 var hasOwnProperty = function (_ref4) {1008 var hasOwnProperty = _ref4.hasOwnProperty;1009 return function (obj, prop) {1010 return hasOwnProperty.call(obj, prop);1011 };1012 }(Object.prototype);1013 1014 /**1015 * Determine if a value is a RegExp object1016 *1017 * @param {*} val The value to test1018 *1019 * @returns {boolean} True if value is a RegExp object, otherwise false1020 */1021 var isRegExp = kindOfTest('RegExp');1022 var reduceDescriptors = function reduceDescriptors(obj, reducer) {1023 var descriptors = Object.getOwnPropertyDescriptors(obj);1024 var reducedDescriptors = {};1025 forEach(descriptors, function (descriptor, name) {1026 var ret;1027 if ((ret = reducer(descriptor, name, obj)) !== false) {1028 reducedDescriptors[name] = ret || descriptor;1029 }1030 });1031 Object.defineProperties(obj, reducedDescriptors);1032 };1033 1034 /**1035 * Makes all methods read-only1036 * @param {Object} obj1037 */1038 1039 var freezeMethods = function freezeMethods(obj) {1040 reduceDescriptors(obj, function (descriptor, name) {1041 // skip restricted props in strict mode1042 if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {1043 return false;1044 }1045 var value = obj[name];1046 if (!isFunction(value)) return;1047 descriptor.enumerable = false;1048 if ('writable' in descriptor) {1049 descriptor.writable = false;1050 return;1051 }1052 if (!descriptor.set) {1053 descriptor.set = function () {1054 throw Error('Can not rewrite read-only method \'' + name + '\'');1055 };1056 }1057 });1058 };1059 var toObjectSet = function toObjectSet(arrayOrString, delimiter) {1060 var obj = {};1061 var define = function define(arr) {1062 arr.forEach(function (value) {1063 obj[value] = true;1064 });1065 };1066 isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));1067 return obj;1068 };1069 var noop = function noop() {};1070 var toFiniteNumber = function toFiniteNumber(value, defaultValue) {1071 value = +value;1072 return Number.isFinite(value) ? value : defaultValue;1073 };1074 var ALPHA = 'abcdefghijklmnopqrstuvwxyz';1075 var DIGIT = '0123456789';1076 var ALPHABET = {1077 DIGIT: DIGIT,1078 ALPHA: ALPHA,1079 ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT1080 };1081 var generateString = function generateString() {1082 var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16;1083 var alphabet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALPHABET.ALPHA_DIGIT;1084 var str = '';1085 var length = alphabet.length;1086 while (size--) {1087 str += alphabet[Math.random() * length | 0];1088 }1089 return str;1090 };1091 1092 /**1093 * If the thing is a FormData object, return true, otherwise return false.1094 *1095 * @param {unknown} thing - The thing to check.1096 *1097 * @returns {boolean}1098 */1099 function isSpecCompliantForm(thing) {1100 return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);1101 }1102 var toJSONObject = function toJSONObject(obj) {1103 var stack = new Array(10);1104 var visit = function visit(source, i) {1105 if (isObject(source)) {1106 if (stack.indexOf(source) >= 0) {1107 return;1108 }1109 if (!('toJSON' in source)) {1110 stack[i] = source;1111 var target = isArray(source) ? [] : {};1112 forEach(source, function (value, key) {1113 var reducedValue = visit(value, i + 1);1114 !isUndefined(reducedValue) && (target[key] = reducedValue);1115 });1116 stack[i] = undefined;1117 return target;1118 }1119 }1120 return source;1121 };1122 return visit(obj, 0);1123 };1124 var isAsyncFn = kindOfTest('AsyncFunction');1125 var isThenable = function isThenable(thing) {1126 return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);1127 };1128 var utils$1 = {1129 isArray: isArray,1130 isArrayBuffer: isArrayBuffer,1131 isBuffer: isBuffer,1132 isFormData: isFormData,1133 isArrayBufferView: isArrayBufferView,1134 isString: isString,1135 isNumber: isNumber,1136 isBoolean: isBoolean,1137 isObject: isObject,1138 isPlainObject: isPlainObject,1139 isUndefined: isUndefined,1140 isDate: isDate,1141 isFile: isFile,1142 isBlob: isBlob,1143 isRegExp: isRegExp,1144 isFunction: isFunction,1145 isStream: isStream,1146 isURLSearchParams: isURLSearchParams,1147 isTypedArray: isTypedArray,1148 isFileList: isFileList,1149 forEach: forEach,1150 merge: merge,1151 extend: extend,1152 trim: trim,1153 stripBOM: stripBOM,1154 inherits: inherits,1155 toFlatObject: toFlatObject,1156 kindOf: kindOf,1157 kindOfTest: kindOfTest,1158 endsWith: endsWith,1159 toArray: toArray,1160 forEachEntry: forEachEntry,1161 matchAll: matchAll,1162 isHTMLForm: isHTMLForm,1163 hasOwnProperty: hasOwnProperty,1164 hasOwnProp: hasOwnProperty,1165 // an alias to avoid ESLint no-prototype-builtins detection1166 reduceDescriptors: reduceDescriptors,1167 freezeMethods: freezeMethods,1168 toObjectSet: toObjectSet,1169 toCamelCase: toCamelCase,1170 noop: noop,1171 toFiniteNumber: toFiniteNumber,1172 findKey: findKey,1173 global: _global,1174 isContextDefined: isContextDefined,1175 ALPHABET: ALPHABET,1176 generateString: generateString,1177 isSpecCompliantForm: isSpecCompliantForm,1178 toJSONObject: toJSONObject,1179 isAsyncFn: isAsyncFn,1180 isThenable: isThenable1181 };1182 1183 /**1184 * Create an Error with the specified message, config, error code, request and response.1185 *1186 * @param {string} message The error message.1187 * @param {string} [code] The error code (for example, 'ECONNABORTED').1188 * @param {Object} [config] The config.1189 * @param {Object} [request] The request.1190 * @param {Object} [response] The response.1191 *1192 * @returns {Error} The created error.1193 */1194 function AxiosError(message, code, config, request, response) {1195 Error.call(this);1196 if (Error.captureStackTrace) {1197 Error.captureStackTrace(this, this.constructor);1198 } else {1199 this.stack = new Error().stack;1200 }