@gbozee/ultimate 0.0.2-156 → 0.0.2-157

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.
@@ -27064,7 +27064,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
27064
27064
  module.exports.wrap = wrap3;
27065
27065
  });
27066
27066
 
27067
- // node_modules/axios/dist/node/axios.cjs
27067
+ // node_modules/binance/node_modules/axios/dist/node/axios.cjs
27068
27068
  var require_axios = __commonJS((exports, module) => {
27069
27069
  /*! Axios v1.8.4 Copyright (c) 2025 Matt Zabriskie and contributors */
27070
27070
  var FormData$1 = require_form_data();
@@ -38466,6 +38466,3000 @@ var require_p_limit = __commonJS((exports, module) => {
38466
38466
  module.exports.default = pLimit;
38467
38467
  });
38468
38468
 
38469
+ // node_modules/bybit-api/node_modules/axios/dist/node/axios.cjs
38470
+ var require_axios2 = __commonJS((exports, module) => {
38471
+ /*! Axios v1.8.4 Copyright (c) 2025 Matt Zabriskie and contributors */
38472
+ var FormData$1 = require_form_data();
38473
+ var crypto4 = __require("crypto");
38474
+ var url = __require("url");
38475
+ var proxyFromEnv = require_proxy_from_env();
38476
+ var http2 = __require("http");
38477
+ var https2 = __require("https");
38478
+ var util5 = __require("util");
38479
+ var followRedirects = require_follow_redirects();
38480
+ var zlib = __require("zlib");
38481
+ var stream2 = __require("stream");
38482
+ var events = __require("events");
38483
+ function _interopDefaultLegacy(e2) {
38484
+ return e2 && typeof e2 === "object" && "default" in e2 ? e2 : { default: e2 };
38485
+ }
38486
+ var FormData__default = /* @__PURE__ */ _interopDefaultLegacy(FormData$1);
38487
+ var crypto__default = /* @__PURE__ */ _interopDefaultLegacy(crypto4);
38488
+ var url__default = /* @__PURE__ */ _interopDefaultLegacy(url);
38489
+ var proxyFromEnv__default = /* @__PURE__ */ _interopDefaultLegacy(proxyFromEnv);
38490
+ var http__default = /* @__PURE__ */ _interopDefaultLegacy(http2);
38491
+ var https__default = /* @__PURE__ */ _interopDefaultLegacy(https2);
38492
+ var util__default = /* @__PURE__ */ _interopDefaultLegacy(util5);
38493
+ var followRedirects__default = /* @__PURE__ */ _interopDefaultLegacy(followRedirects);
38494
+ var zlib__default = /* @__PURE__ */ _interopDefaultLegacy(zlib);
38495
+ var stream__default = /* @__PURE__ */ _interopDefaultLegacy(stream2);
38496
+ function bind(fn, thisArg) {
38497
+ return function wrap() {
38498
+ return fn.apply(thisArg, arguments);
38499
+ };
38500
+ }
38501
+ var { toString } = Object.prototype;
38502
+ var { getPrototypeOf } = Object;
38503
+ var kindOf = ((cache2) => (thing) => {
38504
+ const str = toString.call(thing);
38505
+ return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase());
38506
+ })(Object.create(null));
38507
+ var kindOfTest = (type) => {
38508
+ type = type.toLowerCase();
38509
+ return (thing) => kindOf(thing) === type;
38510
+ };
38511
+ var typeOfTest = (type) => (thing) => typeof thing === type;
38512
+ var { isArray: isArray3 } = Array;
38513
+ var isUndefined3 = typeOfTest("undefined");
38514
+ function isBuffer(val) {
38515
+ return val !== null && !isUndefined3(val) && val.constructor !== null && !isUndefined3(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
38516
+ }
38517
+ var isArrayBuffer = kindOfTest("ArrayBuffer");
38518
+ function isArrayBufferView(val) {
38519
+ let result;
38520
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
38521
+ result = ArrayBuffer.isView(val);
38522
+ } else {
38523
+ result = val && val.buffer && isArrayBuffer(val.buffer);
38524
+ }
38525
+ return result;
38526
+ }
38527
+ var isString2 = typeOfTest("string");
38528
+ var isFunction = typeOfTest("function");
38529
+ var isNumber2 = typeOfTest("number");
38530
+ var isObject2 = (thing) => thing !== null && typeof thing === "object";
38531
+ var isBoolean2 = (thing) => thing === true || thing === false;
38532
+ var isPlainObject3 = (val) => {
38533
+ if (kindOf(val) !== "object") {
38534
+ return false;
38535
+ }
38536
+ const prototype2 = getPrototypeOf(val);
38537
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
38538
+ };
38539
+ var isDate2 = kindOfTest("Date");
38540
+ var isFile2 = kindOfTest("File");
38541
+ var isBlob = kindOfTest("Blob");
38542
+ var isFileList = kindOfTest("FileList");
38543
+ var isStream = (val) => isObject2(val) && isFunction(val.pipe);
38544
+ var isFormData2 = (thing) => {
38545
+ let kind;
38546
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
38547
+ };
38548
+ var isURLSearchParams = kindOfTest("URLSearchParams");
38549
+ var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
38550
+ var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
38551
+ function forEach2(obj, fn, { allOwnKeys = false } = {}) {
38552
+ if (obj === null || typeof obj === "undefined") {
38553
+ return;
38554
+ }
38555
+ let i2;
38556
+ let l;
38557
+ if (typeof obj !== "object") {
38558
+ obj = [obj];
38559
+ }
38560
+ if (isArray3(obj)) {
38561
+ for (i2 = 0, l = obj.length;i2 < l; i2++) {
38562
+ fn.call(null, obj[i2], i2, obj);
38563
+ }
38564
+ } else {
38565
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
38566
+ const len = keys.length;
38567
+ let key;
38568
+ for (i2 = 0;i2 < len; i2++) {
38569
+ key = keys[i2];
38570
+ fn.call(null, obj[key], key, obj);
38571
+ }
38572
+ }
38573
+ }
38574
+ function findKey(obj, key) {
38575
+ key = key.toLowerCase();
38576
+ const keys = Object.keys(obj);
38577
+ let i2 = keys.length;
38578
+ let _key;
38579
+ while (i2-- > 0) {
38580
+ _key = keys[i2];
38581
+ if (key === _key.toLowerCase()) {
38582
+ return _key;
38583
+ }
38584
+ }
38585
+ return null;
38586
+ }
38587
+ var _global2 = (() => {
38588
+ if (typeof globalThis !== "undefined")
38589
+ return globalThis;
38590
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
38591
+ })();
38592
+ var isContextDefined = (context3) => !isUndefined3(context3) && context3 !== _global2;
38593
+ function merge() {
38594
+ const { caseless } = isContextDefined(this) && this || {};
38595
+ const result = {};
38596
+ const assignValue = (val, key) => {
38597
+ const targetKey = caseless && findKey(result, key) || key;
38598
+ if (isPlainObject3(result[targetKey]) && isPlainObject3(val)) {
38599
+ result[targetKey] = merge(result[targetKey], val);
38600
+ } else if (isPlainObject3(val)) {
38601
+ result[targetKey] = merge({}, val);
38602
+ } else if (isArray3(val)) {
38603
+ result[targetKey] = val.slice();
38604
+ } else {
38605
+ result[targetKey] = val;
38606
+ }
38607
+ };
38608
+ for (let i2 = 0, l = arguments.length;i2 < l; i2++) {
38609
+ arguments[i2] && forEach2(arguments[i2], assignValue);
38610
+ }
38611
+ return result;
38612
+ }
38613
+ var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
38614
+ forEach2(b, (val, key) => {
38615
+ if (thisArg && isFunction(val)) {
38616
+ a[key] = bind(val, thisArg);
38617
+ } else {
38618
+ a[key] = val;
38619
+ }
38620
+ }, { allOwnKeys });
38621
+ return a;
38622
+ };
38623
+ var stripBOM = (content) => {
38624
+ if (content.charCodeAt(0) === 65279) {
38625
+ content = content.slice(1);
38626
+ }
38627
+ return content;
38628
+ };
38629
+ var inherits = (constructor, superConstructor, props, descriptors2) => {
38630
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
38631
+ constructor.prototype.constructor = constructor;
38632
+ Object.defineProperty(constructor, "super", {
38633
+ value: superConstructor.prototype
38634
+ });
38635
+ props && Object.assign(constructor.prototype, props);
38636
+ };
38637
+ var toFlatObject = (sourceObj, destObj, filter, propFilter) => {
38638
+ let props;
38639
+ let i2;
38640
+ let prop;
38641
+ const merged = {};
38642
+ destObj = destObj || {};
38643
+ if (sourceObj == null)
38644
+ return destObj;
38645
+ do {
38646
+ props = Object.getOwnPropertyNames(sourceObj);
38647
+ i2 = props.length;
38648
+ while (i2-- > 0) {
38649
+ prop = props[i2];
38650
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
38651
+ destObj[prop] = sourceObj[prop];
38652
+ merged[prop] = true;
38653
+ }
38654
+ }
38655
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
38656
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
38657
+ return destObj;
38658
+ };
38659
+ var endsWith = (str, searchString, position2) => {
38660
+ str = String(str);
38661
+ if (position2 === undefined || position2 > str.length) {
38662
+ position2 = str.length;
38663
+ }
38664
+ position2 -= searchString.length;
38665
+ const lastIndex = str.indexOf(searchString, position2);
38666
+ return lastIndex !== -1 && lastIndex === position2;
38667
+ };
38668
+ var toArray = (thing) => {
38669
+ if (!thing)
38670
+ return null;
38671
+ if (isArray3(thing))
38672
+ return thing;
38673
+ let i2 = thing.length;
38674
+ if (!isNumber2(i2))
38675
+ return null;
38676
+ const arr = new Array(i2);
38677
+ while (i2-- > 0) {
38678
+ arr[i2] = thing[i2];
38679
+ }
38680
+ return arr;
38681
+ };
38682
+ var isTypedArray2 = ((TypedArray) => {
38683
+ return (thing) => {
38684
+ return TypedArray && thing instanceof TypedArray;
38685
+ };
38686
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
38687
+ var forEachEntry = (obj, fn) => {
38688
+ const generator = obj && obj[Symbol.iterator];
38689
+ const iterator = generator.call(obj);
38690
+ let result;
38691
+ while ((result = iterator.next()) && !result.done) {
38692
+ const pair = result.value;
38693
+ fn.call(obj, pair[0], pair[1]);
38694
+ }
38695
+ };
38696
+ var matchAll = (regExp, str) => {
38697
+ let matches;
38698
+ const arr = [];
38699
+ while ((matches = regExp.exec(str)) !== null) {
38700
+ arr.push(matches);
38701
+ }
38702
+ return arr;
38703
+ };
38704
+ var isHTMLForm = kindOfTest("HTMLFormElement");
38705
+ var toCamelCase = (str) => {
38706
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
38707
+ return p1.toUpperCase() + p2;
38708
+ });
38709
+ };
38710
+ var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
38711
+ var isRegExp2 = kindOfTest("RegExp");
38712
+ var reduceDescriptors = (obj, reducer) => {
38713
+ const descriptors2 = Object.getOwnPropertyDescriptors(obj);
38714
+ const reducedDescriptors = {};
38715
+ forEach2(descriptors2, (descriptor, name2) => {
38716
+ let ret;
38717
+ if ((ret = reducer(descriptor, name2, obj)) !== false) {
38718
+ reducedDescriptors[name2] = ret || descriptor;
38719
+ }
38720
+ });
38721
+ Object.defineProperties(obj, reducedDescriptors);
38722
+ };
38723
+ var freezeMethods = (obj) => {
38724
+ reduceDescriptors(obj, (descriptor, name2) => {
38725
+ if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name2) !== -1) {
38726
+ return false;
38727
+ }
38728
+ const value2 = obj[name2];
38729
+ if (!isFunction(value2))
38730
+ return;
38731
+ descriptor.enumerable = false;
38732
+ if ("writable" in descriptor) {
38733
+ descriptor.writable = false;
38734
+ return;
38735
+ }
38736
+ if (!descriptor.set) {
38737
+ descriptor.set = () => {
38738
+ throw Error("Can not rewrite read-only method '" + name2 + "'");
38739
+ };
38740
+ }
38741
+ });
38742
+ };
38743
+ var toObjectSet = (arrayOrString, delimiter) => {
38744
+ const obj = {};
38745
+ const define2 = (arr) => {
38746
+ arr.forEach((value2) => {
38747
+ obj[value2] = true;
38748
+ });
38749
+ };
38750
+ isArray3(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
38751
+ return obj;
38752
+ };
38753
+ var noop2 = () => {
38754
+ };
38755
+ var toFiniteNumber = (value2, defaultValue) => {
38756
+ return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue;
38757
+ };
38758
+ function isSpecCompliantForm(thing) {
38759
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
38760
+ }
38761
+ var toJSONObject = (obj) => {
38762
+ const stack = new Array(10);
38763
+ const visit = (source, i2) => {
38764
+ if (isObject2(source)) {
38765
+ if (stack.indexOf(source) >= 0) {
38766
+ return;
38767
+ }
38768
+ if (!("toJSON" in source)) {
38769
+ stack[i2] = source;
38770
+ const target = isArray3(source) ? [] : {};
38771
+ forEach2(source, (value2, key) => {
38772
+ const reducedValue = visit(value2, i2 + 1);
38773
+ !isUndefined3(reducedValue) && (target[key] = reducedValue);
38774
+ });
38775
+ stack[i2] = undefined;
38776
+ return target;
38777
+ }
38778
+ }
38779
+ return source;
38780
+ };
38781
+ return visit(obj, 0);
38782
+ };
38783
+ var isAsyncFn = kindOfTest("AsyncFunction");
38784
+ var isThenable = (thing) => thing && (isObject2(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
38785
+ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
38786
+ if (setImmediateSupported) {
38787
+ return setImmediate;
38788
+ }
38789
+ return postMessageSupported ? ((token, callbacks) => {
38790
+ _global2.addEventListener("message", ({ source, data }) => {
38791
+ if (source === _global2 && data === token) {
38792
+ callbacks.length && callbacks.shift()();
38793
+ }
38794
+ }, false);
38795
+ return (cb) => {
38796
+ callbacks.push(cb);
38797
+ _global2.postMessage(token, "*");
38798
+ };
38799
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
38800
+ })(typeof setImmediate === "function", isFunction(_global2.postMessage));
38801
+ var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global2) : typeof process !== "undefined" && process.nextTick || _setImmediate;
38802
+ var utils$1 = {
38803
+ isArray: isArray3,
38804
+ isArrayBuffer,
38805
+ isBuffer,
38806
+ isFormData: isFormData2,
38807
+ isArrayBufferView,
38808
+ isString: isString2,
38809
+ isNumber: isNumber2,
38810
+ isBoolean: isBoolean2,
38811
+ isObject: isObject2,
38812
+ isPlainObject: isPlainObject3,
38813
+ isReadableStream,
38814
+ isRequest,
38815
+ isResponse,
38816
+ isHeaders,
38817
+ isUndefined: isUndefined3,
38818
+ isDate: isDate2,
38819
+ isFile: isFile2,
38820
+ isBlob,
38821
+ isRegExp: isRegExp2,
38822
+ isFunction,
38823
+ isStream,
38824
+ isURLSearchParams,
38825
+ isTypedArray: isTypedArray2,
38826
+ isFileList,
38827
+ forEach: forEach2,
38828
+ merge,
38829
+ extend,
38830
+ trim,
38831
+ stripBOM,
38832
+ inherits,
38833
+ toFlatObject,
38834
+ kindOf,
38835
+ kindOfTest,
38836
+ endsWith,
38837
+ toArray,
38838
+ forEachEntry,
38839
+ matchAll,
38840
+ isHTMLForm,
38841
+ hasOwnProperty,
38842
+ hasOwnProp: hasOwnProperty,
38843
+ reduceDescriptors,
38844
+ freezeMethods,
38845
+ toObjectSet,
38846
+ toCamelCase,
38847
+ noop: noop2,
38848
+ toFiniteNumber,
38849
+ findKey,
38850
+ global: _global2,
38851
+ isContextDefined,
38852
+ isSpecCompliantForm,
38853
+ toJSONObject,
38854
+ isAsyncFn,
38855
+ isThenable,
38856
+ setImmediate: _setImmediate,
38857
+ asap
38858
+ };
38859
+ function AxiosError(message2, code, config2, request, response) {
38860
+ Error.call(this);
38861
+ if (Error.captureStackTrace) {
38862
+ Error.captureStackTrace(this, this.constructor);
38863
+ } else {
38864
+ this.stack = new Error().stack;
38865
+ }
38866
+ this.message = message2;
38867
+ this.name = "AxiosError";
38868
+ code && (this.code = code);
38869
+ config2 && (this.config = config2);
38870
+ request && (this.request = request);
38871
+ if (response) {
38872
+ this.response = response;
38873
+ this.status = response.status ? response.status : null;
38874
+ }
38875
+ }
38876
+ utils$1.inherits(AxiosError, Error, {
38877
+ toJSON: function toJSON() {
38878
+ return {
38879
+ message: this.message,
38880
+ name: this.name,
38881
+ description: this.description,
38882
+ number: this.number,
38883
+ fileName: this.fileName,
38884
+ lineNumber: this.lineNumber,
38885
+ columnNumber: this.columnNumber,
38886
+ stack: this.stack,
38887
+ config: utils$1.toJSONObject(this.config),
38888
+ code: this.code,
38889
+ status: this.status
38890
+ };
38891
+ }
38892
+ });
38893
+ var prototype$1 = AxiosError.prototype;
38894
+ var descriptors = {};
38895
+ [
38896
+ "ERR_BAD_OPTION_VALUE",
38897
+ "ERR_BAD_OPTION",
38898
+ "ECONNABORTED",
38899
+ "ETIMEDOUT",
38900
+ "ERR_NETWORK",
38901
+ "ERR_FR_TOO_MANY_REDIRECTS",
38902
+ "ERR_DEPRECATED",
38903
+ "ERR_BAD_RESPONSE",
38904
+ "ERR_BAD_REQUEST",
38905
+ "ERR_CANCELED",
38906
+ "ERR_NOT_SUPPORT",
38907
+ "ERR_INVALID_URL"
38908
+ ].forEach((code) => {
38909
+ descriptors[code] = { value: code };
38910
+ });
38911
+ Object.defineProperties(AxiosError, descriptors);
38912
+ Object.defineProperty(prototype$1, "isAxiosError", { value: true });
38913
+ AxiosError.from = (error, code, config2, request, response, customProps) => {
38914
+ const axiosError = Object.create(prototype$1);
38915
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
38916
+ return obj !== Error.prototype;
38917
+ }, (prop) => {
38918
+ return prop !== "isAxiosError";
38919
+ });
38920
+ AxiosError.call(axiosError, error.message, code, config2, request, response);
38921
+ axiosError.cause = error;
38922
+ axiosError.name = error.name;
38923
+ customProps && Object.assign(axiosError, customProps);
38924
+ return axiosError;
38925
+ };
38926
+ function isVisitable(thing) {
38927
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
38928
+ }
38929
+ function removeBrackets(key) {
38930
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
38931
+ }
38932
+ function renderKey(path, key, dots) {
38933
+ if (!path)
38934
+ return key;
38935
+ return path.concat(key).map(function each(token, i2) {
38936
+ token = removeBrackets(token);
38937
+ return !dots && i2 ? "[" + token + "]" : token;
38938
+ }).join(dots ? "." : "");
38939
+ }
38940
+ function isFlatArray(arr) {
38941
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
38942
+ }
38943
+ var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
38944
+ return /^is[A-Z]/.test(prop);
38945
+ });
38946
+ function toFormData(obj, formData, options) {
38947
+ if (!utils$1.isObject(obj)) {
38948
+ throw new TypeError("target must be an object");
38949
+ }
38950
+ formData = formData || new (FormData__default["default"] || FormData);
38951
+ options = utils$1.toFlatObject(options, {
38952
+ metaTokens: true,
38953
+ dots: false,
38954
+ indexes: false
38955
+ }, false, function defined(option, source) {
38956
+ return !utils$1.isUndefined(source[option]);
38957
+ });
38958
+ const metaTokens = options.metaTokens;
38959
+ const visitor = options.visitor || defaultVisitor;
38960
+ const dots = options.dots;
38961
+ const indexes = options.indexes;
38962
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
38963
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
38964
+ if (!utils$1.isFunction(visitor)) {
38965
+ throw new TypeError("visitor must be a function");
38966
+ }
38967
+ function convertValue(value2) {
38968
+ if (value2 === null)
38969
+ return "";
38970
+ if (utils$1.isDate(value2)) {
38971
+ return value2.toISOString();
38972
+ }
38973
+ if (!useBlob && utils$1.isBlob(value2)) {
38974
+ throw new AxiosError("Blob is not supported. Use a Buffer instead.");
38975
+ }
38976
+ if (utils$1.isArrayBuffer(value2) || utils$1.isTypedArray(value2)) {
38977
+ return useBlob && typeof Blob === "function" ? new Blob([value2]) : Buffer.from(value2);
38978
+ }
38979
+ return value2;
38980
+ }
38981
+ function defaultVisitor(value2, key, path) {
38982
+ let arr = value2;
38983
+ if (value2 && !path && typeof value2 === "object") {
38984
+ if (utils$1.endsWith(key, "{}")) {
38985
+ key = metaTokens ? key : key.slice(0, -2);
38986
+ value2 = JSON.stringify(value2);
38987
+ } else if (utils$1.isArray(value2) && isFlatArray(value2) || (utils$1.isFileList(value2) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value2))) {
38988
+ key = removeBrackets(key);
38989
+ arr.forEach(function each(el, index) {
38990
+ !(utils$1.isUndefined(el) || el === null) && formData.append(indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]", convertValue(el));
38991
+ });
38992
+ return false;
38993
+ }
38994
+ }
38995
+ if (isVisitable(value2)) {
38996
+ return true;
38997
+ }
38998
+ formData.append(renderKey(path, key, dots), convertValue(value2));
38999
+ return false;
39000
+ }
39001
+ const stack = [];
39002
+ const exposedHelpers = Object.assign(predicates, {
39003
+ defaultVisitor,
39004
+ convertValue,
39005
+ isVisitable
39006
+ });
39007
+ function build(value2, path) {
39008
+ if (utils$1.isUndefined(value2))
39009
+ return;
39010
+ if (stack.indexOf(value2) !== -1) {
39011
+ throw Error("Circular reference detected in " + path.join("."));
39012
+ }
39013
+ stack.push(value2);
39014
+ utils$1.forEach(value2, function each(el, key) {
39015
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
39016
+ if (result === true) {
39017
+ build(el, path ? path.concat(key) : [key]);
39018
+ }
39019
+ });
39020
+ stack.pop();
39021
+ }
39022
+ if (!utils$1.isObject(obj)) {
39023
+ throw new TypeError("data must be an object");
39024
+ }
39025
+ build(obj);
39026
+ return formData;
39027
+ }
39028
+ function encode$1(str) {
39029
+ const charMap = {
39030
+ "!": "%21",
39031
+ "'": "%27",
39032
+ "(": "%28",
39033
+ ")": "%29",
39034
+ "~": "%7E",
39035
+ "%20": "+",
39036
+ "%00": "\x00"
39037
+ };
39038
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
39039
+ return charMap[match];
39040
+ });
39041
+ }
39042
+ function AxiosURLSearchParams(params, options) {
39043
+ this._pairs = [];
39044
+ params && toFormData(params, this, options);
39045
+ }
39046
+ var prototype = AxiosURLSearchParams.prototype;
39047
+ prototype.append = function append(name2, value2) {
39048
+ this._pairs.push([name2, value2]);
39049
+ };
39050
+ prototype.toString = function toString(encoder2) {
39051
+ const _encode = encoder2 ? function(value2) {
39052
+ return encoder2.call(this, value2, encode$1);
39053
+ } : encode$1;
39054
+ return this._pairs.map(function each(pair) {
39055
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
39056
+ }, "").join("&");
39057
+ };
39058
+ function encode3(val) {
39059
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
39060
+ }
39061
+ function buildURL(url2, params, options) {
39062
+ if (!params) {
39063
+ return url2;
39064
+ }
39065
+ const _encode = options && options.encode || encode3;
39066
+ if (utils$1.isFunction(options)) {
39067
+ options = {
39068
+ serialize: options
39069
+ };
39070
+ }
39071
+ const serializeFn = options && options.serialize;
39072
+ let serializedParams;
39073
+ if (serializeFn) {
39074
+ serializedParams = serializeFn(params, options);
39075
+ } else {
39076
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
39077
+ }
39078
+ if (serializedParams) {
39079
+ const hashmarkIndex = url2.indexOf("#");
39080
+ if (hashmarkIndex !== -1) {
39081
+ url2 = url2.slice(0, hashmarkIndex);
39082
+ }
39083
+ url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams;
39084
+ }
39085
+ return url2;
39086
+ }
39087
+
39088
+ class InterceptorManager {
39089
+ constructor() {
39090
+ this.handlers = [];
39091
+ }
39092
+ use(fulfilled, rejected, options) {
39093
+ this.handlers.push({
39094
+ fulfilled,
39095
+ rejected,
39096
+ synchronous: options ? options.synchronous : false,
39097
+ runWhen: options ? options.runWhen : null
39098
+ });
39099
+ return this.handlers.length - 1;
39100
+ }
39101
+ eject(id) {
39102
+ if (this.handlers[id]) {
39103
+ this.handlers[id] = null;
39104
+ }
39105
+ }
39106
+ clear() {
39107
+ if (this.handlers) {
39108
+ this.handlers = [];
39109
+ }
39110
+ }
39111
+ forEach(fn) {
39112
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
39113
+ if (h !== null) {
39114
+ fn(h);
39115
+ }
39116
+ });
39117
+ }
39118
+ }
39119
+ var InterceptorManager$1 = InterceptorManager;
39120
+ var transitionalDefaults = {
39121
+ silentJSONParsing: true,
39122
+ forcedJSONParsing: true,
39123
+ clarifyTimeoutError: false
39124
+ };
39125
+ var URLSearchParams2 = url__default["default"].URLSearchParams;
39126
+ var ALPHA = "abcdefghijklmnopqrstuvwxyz";
39127
+ var DIGIT = "0123456789";
39128
+ var ALPHABET = {
39129
+ DIGIT,
39130
+ ALPHA,
39131
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
39132
+ };
39133
+ var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
39134
+ let str = "";
39135
+ const { length } = alphabet;
39136
+ const randomValues = new Uint32Array(size);
39137
+ crypto__default["default"].randomFillSync(randomValues);
39138
+ for (let i2 = 0;i2 < size; i2++) {
39139
+ str += alphabet[randomValues[i2] % length];
39140
+ }
39141
+ return str;
39142
+ };
39143
+ var platform$1 = {
39144
+ isNode: true,
39145
+ classes: {
39146
+ URLSearchParams: URLSearchParams2,
39147
+ FormData: FormData__default["default"],
39148
+ Blob: typeof Blob !== "undefined" && Blob || null
39149
+ },
39150
+ ALPHABET,
39151
+ generateString,
39152
+ protocols: ["http", "https", "file", "data"]
39153
+ };
39154
+ var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
39155
+ var _navigator = typeof navigator === "object" && navigator || undefined;
39156
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
39157
+ var hasStandardBrowserWebWorkerEnv = (() => {
39158
+ return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
39159
+ })();
39160
+ var origin = hasBrowserEnv && window.location.href || "http://localhost";
39161
+ var utils = /* @__PURE__ */ Object.freeze({
39162
+ __proto__: null,
39163
+ hasBrowserEnv,
39164
+ hasStandardBrowserWebWorkerEnv,
39165
+ hasStandardBrowserEnv,
39166
+ navigator: _navigator,
39167
+ origin
39168
+ });
39169
+ var platform = {
39170
+ ...utils,
39171
+ ...platform$1
39172
+ };
39173
+ function toURLEncodedForm(data, options) {
39174
+ return toFormData(data, new platform.classes.URLSearchParams, Object.assign({
39175
+ visitor: function(value2, key, path, helpers) {
39176
+ if (platform.isNode && utils$1.isBuffer(value2)) {
39177
+ this.append(key, value2.toString("base64"));
39178
+ return false;
39179
+ }
39180
+ return helpers.defaultVisitor.apply(this, arguments);
39181
+ }
39182
+ }, options));
39183
+ }
39184
+ function parsePropPath(name2) {
39185
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name2).map((match) => {
39186
+ return match[0] === "[]" ? "" : match[1] || match[0];
39187
+ });
39188
+ }
39189
+ function arrayToObject(arr) {
39190
+ const obj = {};
39191
+ const keys = Object.keys(arr);
39192
+ let i2;
39193
+ const len = keys.length;
39194
+ let key;
39195
+ for (i2 = 0;i2 < len; i2++) {
39196
+ key = keys[i2];
39197
+ obj[key] = arr[key];
39198
+ }
39199
+ return obj;
39200
+ }
39201
+ function formDataToJSON(formData) {
39202
+ function buildPath(path, value2, target, index) {
39203
+ let name2 = path[index++];
39204
+ if (name2 === "__proto__")
39205
+ return true;
39206
+ const isNumericKey = Number.isFinite(+name2);
39207
+ const isLast = index >= path.length;
39208
+ name2 = !name2 && utils$1.isArray(target) ? target.length : name2;
39209
+ if (isLast) {
39210
+ if (utils$1.hasOwnProp(target, name2)) {
39211
+ target[name2] = [target[name2], value2];
39212
+ } else {
39213
+ target[name2] = value2;
39214
+ }
39215
+ return !isNumericKey;
39216
+ }
39217
+ if (!target[name2] || !utils$1.isObject(target[name2])) {
39218
+ target[name2] = [];
39219
+ }
39220
+ const result = buildPath(path, value2, target[name2], index);
39221
+ if (result && utils$1.isArray(target[name2])) {
39222
+ target[name2] = arrayToObject(target[name2]);
39223
+ }
39224
+ return !isNumericKey;
39225
+ }
39226
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
39227
+ const obj = {};
39228
+ utils$1.forEachEntry(formData, (name2, value2) => {
39229
+ buildPath(parsePropPath(name2), value2, obj, 0);
39230
+ });
39231
+ return obj;
39232
+ }
39233
+ return null;
39234
+ }
39235
+ function stringifySafely(rawValue, parser, encoder2) {
39236
+ if (utils$1.isString(rawValue)) {
39237
+ try {
39238
+ (parser || JSON.parse)(rawValue);
39239
+ return utils$1.trim(rawValue);
39240
+ } catch (e2) {
39241
+ if (e2.name !== "SyntaxError") {
39242
+ throw e2;
39243
+ }
39244
+ }
39245
+ }
39246
+ return (encoder2 || JSON.stringify)(rawValue);
39247
+ }
39248
+ var defaults = {
39249
+ transitional: transitionalDefaults,
39250
+ adapter: ["xhr", "http", "fetch"],
39251
+ transformRequest: [function transformRequest(data, headers) {
39252
+ const contentType = headers.getContentType() || "";
39253
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
39254
+ const isObjectPayload = utils$1.isObject(data);
39255
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
39256
+ data = new FormData(data);
39257
+ }
39258
+ const isFormData3 = utils$1.isFormData(data);
39259
+ if (isFormData3) {
39260
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
39261
+ }
39262
+ 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)) {
39263
+ return data;
39264
+ }
39265
+ if (utils$1.isArrayBufferView(data)) {
39266
+ return data.buffer;
39267
+ }
39268
+ if (utils$1.isURLSearchParams(data)) {
39269
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
39270
+ return data.toString();
39271
+ }
39272
+ let isFileList2;
39273
+ if (isObjectPayload) {
39274
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
39275
+ return toURLEncodedForm(data, this.formSerializer).toString();
39276
+ }
39277
+ if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
39278
+ const _FormData = this.env && this.env.FormData;
39279
+ return toFormData(isFileList2 ? { "files[]": data } : data, _FormData && new _FormData, this.formSerializer);
39280
+ }
39281
+ }
39282
+ if (isObjectPayload || hasJSONContentType) {
39283
+ headers.setContentType("application/json", false);
39284
+ return stringifySafely(data);
39285
+ }
39286
+ return data;
39287
+ }],
39288
+ transformResponse: [function transformResponse(data) {
39289
+ const transitional = this.transitional || defaults.transitional;
39290
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
39291
+ const JSONRequested = this.responseType === "json";
39292
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
39293
+ return data;
39294
+ }
39295
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
39296
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
39297
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
39298
+ try {
39299
+ return JSON.parse(data);
39300
+ } catch (e2) {
39301
+ if (strictJSONParsing) {
39302
+ if (e2.name === "SyntaxError") {
39303
+ throw AxiosError.from(e2, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
39304
+ }
39305
+ throw e2;
39306
+ }
39307
+ }
39308
+ }
39309
+ return data;
39310
+ }],
39311
+ timeout: 0,
39312
+ xsrfCookieName: "XSRF-TOKEN",
39313
+ xsrfHeaderName: "X-XSRF-TOKEN",
39314
+ maxContentLength: -1,
39315
+ maxBodyLength: -1,
39316
+ env: {
39317
+ FormData: platform.classes.FormData,
39318
+ Blob: platform.classes.Blob
39319
+ },
39320
+ validateStatus: function validateStatus(status) {
39321
+ return status >= 200 && status < 300;
39322
+ },
39323
+ headers: {
39324
+ common: {
39325
+ Accept: "application/json, text/plain, */*",
39326
+ "Content-Type": undefined
39327
+ }
39328
+ }
39329
+ };
39330
+ utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
39331
+ defaults.headers[method] = {};
39332
+ });
39333
+ var defaults$1 = defaults;
39334
+ var ignoreDuplicateOf = utils$1.toObjectSet([
39335
+ "age",
39336
+ "authorization",
39337
+ "content-length",
39338
+ "content-type",
39339
+ "etag",
39340
+ "expires",
39341
+ "from",
39342
+ "host",
39343
+ "if-modified-since",
39344
+ "if-unmodified-since",
39345
+ "last-modified",
39346
+ "location",
39347
+ "max-forwards",
39348
+ "proxy-authorization",
39349
+ "referer",
39350
+ "retry-after",
39351
+ "user-agent"
39352
+ ]);
39353
+ var parseHeaders = (rawHeaders) => {
39354
+ const parsed = {};
39355
+ let key;
39356
+ let val;
39357
+ let i2;
39358
+ rawHeaders && rawHeaders.split(`
39359
+ `).forEach(function parser(line) {
39360
+ i2 = line.indexOf(":");
39361
+ key = line.substring(0, i2).trim().toLowerCase();
39362
+ val = line.substring(i2 + 1).trim();
39363
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
39364
+ return;
39365
+ }
39366
+ if (key === "set-cookie") {
39367
+ if (parsed[key]) {
39368
+ parsed[key].push(val);
39369
+ } else {
39370
+ parsed[key] = [val];
39371
+ }
39372
+ } else {
39373
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
39374
+ }
39375
+ });
39376
+ return parsed;
39377
+ };
39378
+ var $internals = Symbol("internals");
39379
+ function normalizeHeader(header) {
39380
+ return header && String(header).trim().toLowerCase();
39381
+ }
39382
+ function normalizeValue(value2) {
39383
+ if (value2 === false || value2 == null) {
39384
+ return value2;
39385
+ }
39386
+ return utils$1.isArray(value2) ? value2.map(normalizeValue) : String(value2);
39387
+ }
39388
+ function parseTokens(str) {
39389
+ const tokens = Object.create(null);
39390
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
39391
+ let match;
39392
+ while (match = tokensRE.exec(str)) {
39393
+ tokens[match[1]] = match[2];
39394
+ }
39395
+ return tokens;
39396
+ }
39397
+ var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
39398
+ function matchHeaderValue(context3, value2, header, filter, isHeaderNameFilter) {
39399
+ if (utils$1.isFunction(filter)) {
39400
+ return filter.call(this, value2, header);
39401
+ }
39402
+ if (isHeaderNameFilter) {
39403
+ value2 = header;
39404
+ }
39405
+ if (!utils$1.isString(value2))
39406
+ return;
39407
+ if (utils$1.isString(filter)) {
39408
+ return value2.indexOf(filter) !== -1;
39409
+ }
39410
+ if (utils$1.isRegExp(filter)) {
39411
+ return filter.test(value2);
39412
+ }
39413
+ }
39414
+ function formatHeader(header) {
39415
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
39416
+ return char.toUpperCase() + str;
39417
+ });
39418
+ }
39419
+ function buildAccessors(obj, header) {
39420
+ const accessorName = utils$1.toCamelCase(" " + header);
39421
+ ["get", "set", "has"].forEach((methodName) => {
39422
+ Object.defineProperty(obj, methodName + accessorName, {
39423
+ value: function(arg1, arg2, arg3) {
39424
+ return this[methodName].call(this, header, arg1, arg2, arg3);
39425
+ },
39426
+ configurable: true
39427
+ });
39428
+ });
39429
+ }
39430
+
39431
+ class AxiosHeaders {
39432
+ constructor(headers) {
39433
+ headers && this.set(headers);
39434
+ }
39435
+ set(header, valueOrRewrite, rewrite) {
39436
+ const self2 = this;
39437
+ function setHeader(_value, _header, _rewrite) {
39438
+ const lHeader = normalizeHeader(_header);
39439
+ if (!lHeader) {
39440
+ throw new Error("header name must be a non-empty string");
39441
+ }
39442
+ const key = utils$1.findKey(self2, lHeader);
39443
+ if (!key || self2[key] === undefined || _rewrite === true || _rewrite === undefined && self2[key] !== false) {
39444
+ self2[key || _header] = normalizeValue(_value);
39445
+ }
39446
+ }
39447
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
39448
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
39449
+ setHeaders(header, valueOrRewrite);
39450
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
39451
+ setHeaders(parseHeaders(header), valueOrRewrite);
39452
+ } else if (utils$1.isHeaders(header)) {
39453
+ for (const [key, value2] of header.entries()) {
39454
+ setHeader(value2, key, rewrite);
39455
+ }
39456
+ } else {
39457
+ header != null && setHeader(valueOrRewrite, header, rewrite);
39458
+ }
39459
+ return this;
39460
+ }
39461
+ get(header, parser) {
39462
+ header = normalizeHeader(header);
39463
+ if (header) {
39464
+ const key = utils$1.findKey(this, header);
39465
+ if (key) {
39466
+ const value2 = this[key];
39467
+ if (!parser) {
39468
+ return value2;
39469
+ }
39470
+ if (parser === true) {
39471
+ return parseTokens(value2);
39472
+ }
39473
+ if (utils$1.isFunction(parser)) {
39474
+ return parser.call(this, value2, key);
39475
+ }
39476
+ if (utils$1.isRegExp(parser)) {
39477
+ return parser.exec(value2);
39478
+ }
39479
+ throw new TypeError("parser must be boolean|regexp|function");
39480
+ }
39481
+ }
39482
+ }
39483
+ has(header, matcher) {
39484
+ header = normalizeHeader(header);
39485
+ if (header) {
39486
+ const key = utils$1.findKey(this, header);
39487
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
39488
+ }
39489
+ return false;
39490
+ }
39491
+ delete(header, matcher) {
39492
+ const self2 = this;
39493
+ let deleted = false;
39494
+ function deleteHeader(_header) {
39495
+ _header = normalizeHeader(_header);
39496
+ if (_header) {
39497
+ const key = utils$1.findKey(self2, _header);
39498
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
39499
+ delete self2[key];
39500
+ deleted = true;
39501
+ }
39502
+ }
39503
+ }
39504
+ if (utils$1.isArray(header)) {
39505
+ header.forEach(deleteHeader);
39506
+ } else {
39507
+ deleteHeader(header);
39508
+ }
39509
+ return deleted;
39510
+ }
39511
+ clear(matcher) {
39512
+ const keys = Object.keys(this);
39513
+ let i2 = keys.length;
39514
+ let deleted = false;
39515
+ while (i2--) {
39516
+ const key = keys[i2];
39517
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
39518
+ delete this[key];
39519
+ deleted = true;
39520
+ }
39521
+ }
39522
+ return deleted;
39523
+ }
39524
+ normalize(format) {
39525
+ const self2 = this;
39526
+ const headers = {};
39527
+ utils$1.forEach(this, (value2, header) => {
39528
+ const key = utils$1.findKey(headers, header);
39529
+ if (key) {
39530
+ self2[key] = normalizeValue(value2);
39531
+ delete self2[header];
39532
+ return;
39533
+ }
39534
+ const normalized = format ? formatHeader(header) : String(header).trim();
39535
+ if (normalized !== header) {
39536
+ delete self2[header];
39537
+ }
39538
+ self2[normalized] = normalizeValue(value2);
39539
+ headers[normalized] = true;
39540
+ });
39541
+ return this;
39542
+ }
39543
+ concat(...targets) {
39544
+ return this.constructor.concat(this, ...targets);
39545
+ }
39546
+ toJSON(asStrings) {
39547
+ const obj = Object.create(null);
39548
+ utils$1.forEach(this, (value2, header) => {
39549
+ value2 != null && value2 !== false && (obj[header] = asStrings && utils$1.isArray(value2) ? value2.join(", ") : value2);
39550
+ });
39551
+ return obj;
39552
+ }
39553
+ [Symbol.iterator]() {
39554
+ return Object.entries(this.toJSON())[Symbol.iterator]();
39555
+ }
39556
+ toString() {
39557
+ return Object.entries(this.toJSON()).map(([header, value2]) => header + ": " + value2).join(`
39558
+ `);
39559
+ }
39560
+ get [Symbol.toStringTag]() {
39561
+ return "AxiosHeaders";
39562
+ }
39563
+ static from(thing) {
39564
+ return thing instanceof this ? thing : new this(thing);
39565
+ }
39566
+ static concat(first, ...targets) {
39567
+ const computed = new this(first);
39568
+ targets.forEach((target) => computed.set(target));
39569
+ return computed;
39570
+ }
39571
+ static accessor(header) {
39572
+ const internals = this[$internals] = this[$internals] = {
39573
+ accessors: {}
39574
+ };
39575
+ const accessors = internals.accessors;
39576
+ const prototype2 = this.prototype;
39577
+ function defineAccessor(_header) {
39578
+ const lHeader = normalizeHeader(_header);
39579
+ if (!accessors[lHeader]) {
39580
+ buildAccessors(prototype2, _header);
39581
+ accessors[lHeader] = true;
39582
+ }
39583
+ }
39584
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
39585
+ return this;
39586
+ }
39587
+ }
39588
+ AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
39589
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value: value2 }, key) => {
39590
+ let mapped = key[0].toUpperCase() + key.slice(1);
39591
+ return {
39592
+ get: () => value2,
39593
+ set(headerValue) {
39594
+ this[mapped] = headerValue;
39595
+ }
39596
+ };
39597
+ });
39598
+ utils$1.freezeMethods(AxiosHeaders);
39599
+ var AxiosHeaders$1 = AxiosHeaders;
39600
+ function transformData(fns, response) {
39601
+ const config2 = this || defaults$1;
39602
+ const context3 = response || config2;
39603
+ const headers = AxiosHeaders$1.from(context3.headers);
39604
+ let data = context3.data;
39605
+ utils$1.forEach(fns, function transform(fn) {
39606
+ data = fn.call(config2, data, headers.normalize(), response ? response.status : undefined);
39607
+ });
39608
+ headers.normalize();
39609
+ return data;
39610
+ }
39611
+ function isCancel(value2) {
39612
+ return !!(value2 && value2.__CANCEL__);
39613
+ }
39614
+ function CanceledError(message2, config2, request) {
39615
+ AxiosError.call(this, message2 == null ? "canceled" : message2, AxiosError.ERR_CANCELED, config2, request);
39616
+ this.name = "CanceledError";
39617
+ }
39618
+ utils$1.inherits(CanceledError, AxiosError, {
39619
+ __CANCEL__: true
39620
+ });
39621
+ function settle(resolve, reject, response) {
39622
+ const validateStatus = response.config.validateStatus;
39623
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
39624
+ resolve(response);
39625
+ } else {
39626
+ 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));
39627
+ }
39628
+ }
39629
+ function isAbsoluteURL(url2) {
39630
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
39631
+ }
39632
+ function combineURLs(baseURL, relativeURL) {
39633
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
39634
+ }
39635
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
39636
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
39637
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
39638
+ return combineURLs(baseURL, requestedURL);
39639
+ }
39640
+ return requestedURL;
39641
+ }
39642
+ var VERSION3 = "1.8.4";
39643
+ function parseProtocol(url2) {
39644
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
39645
+ return match && match[1] || "";
39646
+ }
39647
+ var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
39648
+ function fromDataURI(uri, asBlob, options) {
39649
+ const _Blob = options && options.Blob || platform.classes.Blob;
39650
+ const protocol = parseProtocol(uri);
39651
+ if (asBlob === undefined && _Blob) {
39652
+ asBlob = true;
39653
+ }
39654
+ if (protocol === "data") {
39655
+ uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
39656
+ const match = DATA_URL_PATTERN.exec(uri);
39657
+ if (!match) {
39658
+ throw new AxiosError("Invalid URL", AxiosError.ERR_INVALID_URL);
39659
+ }
39660
+ const mime = match[1];
39661
+ const isBase64 = match[2];
39662
+ const body = match[3];
39663
+ const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
39664
+ if (asBlob) {
39665
+ if (!_Blob) {
39666
+ throw new AxiosError("Blob is not supported", AxiosError.ERR_NOT_SUPPORT);
39667
+ }
39668
+ return new _Blob([buffer], { type: mime });
39669
+ }
39670
+ return buffer;
39671
+ }
39672
+ throw new AxiosError("Unsupported protocol " + protocol, AxiosError.ERR_NOT_SUPPORT);
39673
+ }
39674
+ var kInternals = Symbol("internals");
39675
+
39676
+ class AxiosTransformStream extends stream__default["default"].Transform {
39677
+ constructor(options) {
39678
+ options = utils$1.toFlatObject(options, {
39679
+ maxRate: 0,
39680
+ chunkSize: 64 * 1024,
39681
+ minChunkSize: 100,
39682
+ timeWindow: 500,
39683
+ ticksRate: 2,
39684
+ samplesCount: 15
39685
+ }, null, (prop, source) => {
39686
+ return !utils$1.isUndefined(source[prop]);
39687
+ });
39688
+ super({
39689
+ readableHighWaterMark: options.chunkSize
39690
+ });
39691
+ const internals = this[kInternals] = {
39692
+ timeWindow: options.timeWindow,
39693
+ chunkSize: options.chunkSize,
39694
+ maxRate: options.maxRate,
39695
+ minChunkSize: options.minChunkSize,
39696
+ bytesSeen: 0,
39697
+ isCaptured: false,
39698
+ notifiedBytesLoaded: 0,
39699
+ ts: Date.now(),
39700
+ bytes: 0,
39701
+ onReadCallback: null
39702
+ };
39703
+ this.on("newListener", (event) => {
39704
+ if (event === "progress") {
39705
+ if (!internals.isCaptured) {
39706
+ internals.isCaptured = true;
39707
+ }
39708
+ }
39709
+ });
39710
+ }
39711
+ _read(size) {
39712
+ const internals = this[kInternals];
39713
+ if (internals.onReadCallback) {
39714
+ internals.onReadCallback();
39715
+ }
39716
+ return super._read(size);
39717
+ }
39718
+ _transform(chunk, encoding, callback) {
39719
+ const internals = this[kInternals];
39720
+ const maxRate = internals.maxRate;
39721
+ const readableHighWaterMark = this.readableHighWaterMark;
39722
+ const timeWindow = internals.timeWindow;
39723
+ const divider = 1000 / timeWindow;
39724
+ const bytesThreshold = maxRate / divider;
39725
+ const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
39726
+ const pushChunk = (_chunk, _callback) => {
39727
+ const bytes = Buffer.byteLength(_chunk);
39728
+ internals.bytesSeen += bytes;
39729
+ internals.bytes += bytes;
39730
+ internals.isCaptured && this.emit("progress", internals.bytesSeen);
39731
+ if (this.push(_chunk)) {
39732
+ process.nextTick(_callback);
39733
+ } else {
39734
+ internals.onReadCallback = () => {
39735
+ internals.onReadCallback = null;
39736
+ process.nextTick(_callback);
39737
+ };
39738
+ }
39739
+ };
39740
+ const transformChunk = (_chunk, _callback) => {
39741
+ const chunkSize = Buffer.byteLength(_chunk);
39742
+ let chunkRemainder = null;
39743
+ let maxChunkSize = readableHighWaterMark;
39744
+ let bytesLeft;
39745
+ let passed = 0;
39746
+ if (maxRate) {
39747
+ const now = Date.now();
39748
+ if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
39749
+ internals.ts = now;
39750
+ bytesLeft = bytesThreshold - internals.bytes;
39751
+ internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
39752
+ passed = 0;
39753
+ }
39754
+ bytesLeft = bytesThreshold - internals.bytes;
39755
+ }
39756
+ if (maxRate) {
39757
+ if (bytesLeft <= 0) {
39758
+ return setTimeout(() => {
39759
+ _callback(null, _chunk);
39760
+ }, timeWindow - passed);
39761
+ }
39762
+ if (bytesLeft < maxChunkSize) {
39763
+ maxChunkSize = bytesLeft;
39764
+ }
39765
+ }
39766
+ if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
39767
+ chunkRemainder = _chunk.subarray(maxChunkSize);
39768
+ _chunk = _chunk.subarray(0, maxChunkSize);
39769
+ }
39770
+ pushChunk(_chunk, chunkRemainder ? () => {
39771
+ process.nextTick(_callback, null, chunkRemainder);
39772
+ } : _callback);
39773
+ };
39774
+ transformChunk(chunk, function transformNextChunk(err, _chunk) {
39775
+ if (err) {
39776
+ return callback(err);
39777
+ }
39778
+ if (_chunk) {
39779
+ transformChunk(_chunk, transformNextChunk);
39780
+ } else {
39781
+ callback(null);
39782
+ }
39783
+ });
39784
+ }
39785
+ }
39786
+ var AxiosTransformStream$1 = AxiosTransformStream;
39787
+ var { asyncIterator } = Symbol;
39788
+ var readBlob = async function* (blob) {
39789
+ if (blob.stream) {
39790
+ yield* blob.stream();
39791
+ } else if (blob.arrayBuffer) {
39792
+ yield await blob.arrayBuffer();
39793
+ } else if (blob[asyncIterator]) {
39794
+ yield* blob[asyncIterator]();
39795
+ } else {
39796
+ yield blob;
39797
+ }
39798
+ };
39799
+ var readBlob$1 = readBlob;
39800
+ var BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + "-_";
39801
+ var textEncoder = typeof TextEncoder === "function" ? new TextEncoder : new util__default["default"].TextEncoder;
39802
+ var CRLF = `\r
39803
+ `;
39804
+ var CRLF_BYTES = textEncoder.encode(CRLF);
39805
+ var CRLF_BYTES_COUNT = 2;
39806
+
39807
+ class FormDataPart {
39808
+ constructor(name2, value2) {
39809
+ const { escapeName } = this.constructor;
39810
+ const isStringValue = utils$1.isString(value2);
39811
+ let headers = `Content-Disposition: form-data; name="${escapeName(name2)}"${!isStringValue && value2.name ? `; filename="${escapeName(value2.name)}"` : ""}${CRLF}`;
39812
+ if (isStringValue) {
39813
+ value2 = textEncoder.encode(String(value2).replace(/\r?\n|\r\n?/g, CRLF));
39814
+ } else {
39815
+ headers += `Content-Type: ${value2.type || "application/octet-stream"}${CRLF}`;
39816
+ }
39817
+ this.headers = textEncoder.encode(headers + CRLF);
39818
+ this.contentLength = isStringValue ? value2.byteLength : value2.size;
39819
+ this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
39820
+ this.name = name2;
39821
+ this.value = value2;
39822
+ }
39823
+ async* encode() {
39824
+ yield this.headers;
39825
+ const { value: value2 } = this;
39826
+ if (utils$1.isTypedArray(value2)) {
39827
+ yield value2;
39828
+ } else {
39829
+ yield* readBlob$1(value2);
39830
+ }
39831
+ yield CRLF_BYTES;
39832
+ }
39833
+ static escapeName(name2) {
39834
+ return String(name2).replace(/[\r\n"]/g, (match) => ({
39835
+ "\r": "%0D",
39836
+ "\n": "%0A",
39837
+ '"': "%22"
39838
+ })[match]);
39839
+ }
39840
+ }
39841
+ var formDataToStream = (form, headersHandler, options) => {
39842
+ const {
39843
+ tag: tag2 = "form-data-boundary",
39844
+ size = 25,
39845
+ boundary = tag2 + "-" + platform.generateString(size, BOUNDARY_ALPHABET)
39846
+ } = options || {};
39847
+ if (!utils$1.isFormData(form)) {
39848
+ throw TypeError("FormData instance required");
39849
+ }
39850
+ if (boundary.length < 1 || boundary.length > 70) {
39851
+ throw Error("boundary must be 10-70 characters long");
39852
+ }
39853
+ const boundaryBytes = textEncoder.encode("--" + boundary + CRLF);
39854
+ const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF + CRLF);
39855
+ let contentLength = footerBytes.byteLength;
39856
+ const parts = Array.from(form.entries()).map(([name2, value2]) => {
39857
+ const part = new FormDataPart(name2, value2);
39858
+ contentLength += part.size;
39859
+ return part;
39860
+ });
39861
+ contentLength += boundaryBytes.byteLength * parts.length;
39862
+ contentLength = utils$1.toFiniteNumber(contentLength);
39863
+ const computedHeaders = {
39864
+ "Content-Type": `multipart/form-data; boundary=${boundary}`
39865
+ };
39866
+ if (Number.isFinite(contentLength)) {
39867
+ computedHeaders["Content-Length"] = contentLength;
39868
+ }
39869
+ headersHandler && headersHandler(computedHeaders);
39870
+ return stream2.Readable.from(async function* () {
39871
+ for (const part of parts) {
39872
+ yield boundaryBytes;
39873
+ yield* part.encode();
39874
+ }
39875
+ yield footerBytes;
39876
+ }());
39877
+ };
39878
+ var formDataToStream$1 = formDataToStream;
39879
+
39880
+ class ZlibHeaderTransformStream extends stream__default["default"].Transform {
39881
+ __transform(chunk, encoding, callback) {
39882
+ this.push(chunk);
39883
+ callback();
39884
+ }
39885
+ _transform(chunk, encoding, callback) {
39886
+ if (chunk.length !== 0) {
39887
+ this._transform = this.__transform;
39888
+ if (chunk[0] !== 120) {
39889
+ const header = Buffer.alloc(2);
39890
+ header[0] = 120;
39891
+ header[1] = 156;
39892
+ this.push(header, encoding);
39893
+ }
39894
+ }
39895
+ this.__transform(chunk, encoding, callback);
39896
+ }
39897
+ }
39898
+ var ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;
39899
+ var callbackify = (fn, reducer) => {
39900
+ return utils$1.isAsyncFn(fn) ? function(...args) {
39901
+ const cb = args.pop();
39902
+ fn.apply(this, args).then((value2) => {
39903
+ try {
39904
+ reducer ? cb(null, ...reducer(value2)) : cb(null, value2);
39905
+ } catch (err) {
39906
+ cb(err);
39907
+ }
39908
+ }, cb);
39909
+ } : fn;
39910
+ };
39911
+ var callbackify$1 = callbackify;
39912
+ function speedometer(samplesCount, min) {
39913
+ samplesCount = samplesCount || 10;
39914
+ const bytes = new Array(samplesCount);
39915
+ const timestamps = new Array(samplesCount);
39916
+ let head = 0;
39917
+ let tail = 0;
39918
+ let firstSampleTS;
39919
+ min = min !== undefined ? min : 1000;
39920
+ return function push(chunkLength) {
39921
+ const now = Date.now();
39922
+ const startedAt = timestamps[tail];
39923
+ if (!firstSampleTS) {
39924
+ firstSampleTS = now;
39925
+ }
39926
+ bytes[head] = chunkLength;
39927
+ timestamps[head] = now;
39928
+ let i2 = tail;
39929
+ let bytesCount = 0;
39930
+ while (i2 !== head) {
39931
+ bytesCount += bytes[i2++];
39932
+ i2 = i2 % samplesCount;
39933
+ }
39934
+ head = (head + 1) % samplesCount;
39935
+ if (head === tail) {
39936
+ tail = (tail + 1) % samplesCount;
39937
+ }
39938
+ if (now - firstSampleTS < min) {
39939
+ return;
39940
+ }
39941
+ const passed = startedAt && now - startedAt;
39942
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
39943
+ };
39944
+ }
39945
+ function throttle(fn, freq) {
39946
+ let timestamp = 0;
39947
+ let threshold = 1000 / freq;
39948
+ let lastArgs;
39949
+ let timer;
39950
+ const invoke = (args, now = Date.now()) => {
39951
+ timestamp = now;
39952
+ lastArgs = null;
39953
+ if (timer) {
39954
+ clearTimeout(timer);
39955
+ timer = null;
39956
+ }
39957
+ fn.apply(null, args);
39958
+ };
39959
+ const throttled = (...args) => {
39960
+ const now = Date.now();
39961
+ const passed = now - timestamp;
39962
+ if (passed >= threshold) {
39963
+ invoke(args, now);
39964
+ } else {
39965
+ lastArgs = args;
39966
+ if (!timer) {
39967
+ timer = setTimeout(() => {
39968
+ timer = null;
39969
+ invoke(lastArgs);
39970
+ }, threshold - passed);
39971
+ }
39972
+ }
39973
+ };
39974
+ const flush = () => lastArgs && invoke(lastArgs);
39975
+ return [throttled, flush];
39976
+ }
39977
+ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
39978
+ let bytesNotified = 0;
39979
+ const _speedometer = speedometer(50, 250);
39980
+ return throttle((e2) => {
39981
+ const loaded = e2.loaded;
39982
+ const total = e2.lengthComputable ? e2.total : undefined;
39983
+ const progressBytes = loaded - bytesNotified;
39984
+ const rate = _speedometer(progressBytes);
39985
+ const inRange = loaded <= total;
39986
+ bytesNotified = loaded;
39987
+ const data = {
39988
+ loaded,
39989
+ total,
39990
+ progress: total ? loaded / total : undefined,
39991
+ bytes: progressBytes,
39992
+ rate: rate ? rate : undefined,
39993
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
39994
+ event: e2,
39995
+ lengthComputable: total != null,
39996
+ [isDownloadStream ? "download" : "upload"]: true
39997
+ };
39998
+ listener(data);
39999
+ }, freq);
40000
+ };
40001
+ var progressEventDecorator = (total, throttled) => {
40002
+ const lengthComputable = total != null;
40003
+ return [(loaded) => throttled[0]({
40004
+ lengthComputable,
40005
+ total,
40006
+ loaded
40007
+ }), throttled[1]];
40008
+ };
40009
+ var asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
40010
+ var zlibOptions = {
40011
+ flush: zlib__default["default"].constants.Z_SYNC_FLUSH,
40012
+ finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH
40013
+ };
40014
+ var brotliOptions = {
40015
+ flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH,
40016
+ finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
40017
+ };
40018
+ var isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
40019
+ var { http: httpFollow, https: httpsFollow } = followRedirects__default["default"];
40020
+ var isHttps = /https:?/;
40021
+ var supportedProtocols = platform.protocols.map((protocol) => {
40022
+ return protocol + ":";
40023
+ });
40024
+ var flushOnFinish = (stream3, [throttled, flush]) => {
40025
+ stream3.on("end", flush).on("error", flush);
40026
+ return throttled;
40027
+ };
40028
+ function dispatchBeforeRedirect(options, responseDetails) {
40029
+ if (options.beforeRedirects.proxy) {
40030
+ options.beforeRedirects.proxy(options);
40031
+ }
40032
+ if (options.beforeRedirects.config) {
40033
+ options.beforeRedirects.config(options, responseDetails);
40034
+ }
40035
+ }
40036
+ function setProxy(options, configProxy, location) {
40037
+ let proxy = configProxy;
40038
+ if (!proxy && proxy !== false) {
40039
+ const proxyUrl = proxyFromEnv__default["default"].getProxyForUrl(location);
40040
+ if (proxyUrl) {
40041
+ proxy = new URL(proxyUrl);
40042
+ }
40043
+ }
40044
+ if (proxy) {
40045
+ if (proxy.username) {
40046
+ proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
40047
+ }
40048
+ if (proxy.auth) {
40049
+ if (proxy.auth.username || proxy.auth.password) {
40050
+ proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
40051
+ }
40052
+ const base64 = Buffer.from(proxy.auth, "utf8").toString("base64");
40053
+ options.headers["Proxy-Authorization"] = "Basic " + base64;
40054
+ }
40055
+ options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
40056
+ const proxyHost = proxy.hostname || proxy.host;
40057
+ options.hostname = proxyHost;
40058
+ options.host = proxyHost;
40059
+ options.port = proxy.port;
40060
+ options.path = location;
40061
+ if (proxy.protocol) {
40062
+ options.protocol = proxy.protocol.includes(":") ? proxy.protocol : `${proxy.protocol}:`;
40063
+ }
40064
+ }
40065
+ options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
40066
+ setProxy(redirectOptions, configProxy, redirectOptions.href);
40067
+ };
40068
+ }
40069
+ var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
40070
+ var wrapAsync = (asyncExecutor) => {
40071
+ return new Promise((resolve, reject) => {
40072
+ let onDone;
40073
+ let isDone;
40074
+ const done = (value2, isRejected) => {
40075
+ if (isDone)
40076
+ return;
40077
+ isDone = true;
40078
+ onDone && onDone(value2, isRejected);
40079
+ };
40080
+ const _resolve = (value2) => {
40081
+ done(value2);
40082
+ resolve(value2);
40083
+ };
40084
+ const _reject = (reason) => {
40085
+ done(reason, true);
40086
+ reject(reason);
40087
+ };
40088
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject);
40089
+ });
40090
+ };
40091
+ var resolveFamily = ({ address, family }) => {
40092
+ if (!utils$1.isString(address)) {
40093
+ throw TypeError("address must be a string");
40094
+ }
40095
+ return {
40096
+ address,
40097
+ family: family || (address.indexOf(".") < 0 ? 6 : 4)
40098
+ };
40099
+ };
40100
+ var buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : { address, family });
40101
+ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config2) {
40102
+ return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
40103
+ let { data, lookup, family } = config2;
40104
+ const { responseType, responseEncoding } = config2;
40105
+ const method = config2.method.toUpperCase();
40106
+ let isDone;
40107
+ let rejected = false;
40108
+ let req;
40109
+ if (lookup) {
40110
+ const _lookup = callbackify$1(lookup, (value2) => utils$1.isArray(value2) ? value2 : [value2]);
40111
+ lookup = (hostname, opt, cb) => {
40112
+ _lookup(hostname, opt, (err, arg0, arg1) => {
40113
+ if (err) {
40114
+ return cb(err);
40115
+ }
40116
+ const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
40117
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
40118
+ });
40119
+ };
40120
+ }
40121
+ const emitter = new events.EventEmitter;
40122
+ const onFinished = () => {
40123
+ if (config2.cancelToken) {
40124
+ config2.cancelToken.unsubscribe(abort);
40125
+ }
40126
+ if (config2.signal) {
40127
+ config2.signal.removeEventListener("abort", abort);
40128
+ }
40129
+ emitter.removeAllListeners();
40130
+ };
40131
+ onDone((value2, isRejected) => {
40132
+ isDone = true;
40133
+ if (isRejected) {
40134
+ rejected = true;
40135
+ onFinished();
40136
+ }
40137
+ });
40138
+ function abort(reason) {
40139
+ emitter.emit("abort", !reason || reason.type ? new CanceledError(null, config2, req) : reason);
40140
+ }
40141
+ emitter.once("abort", reject);
40142
+ if (config2.cancelToken || config2.signal) {
40143
+ config2.cancelToken && config2.cancelToken.subscribe(abort);
40144
+ if (config2.signal) {
40145
+ config2.signal.aborted ? abort() : config2.signal.addEventListener("abort", abort);
40146
+ }
40147
+ }
40148
+ const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
40149
+ const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
40150
+ const protocol = parsed.protocol || supportedProtocols[0];
40151
+ if (protocol === "data:") {
40152
+ let convertedData;
40153
+ if (method !== "GET") {
40154
+ return settle(resolve, reject, {
40155
+ status: 405,
40156
+ statusText: "method not allowed",
40157
+ headers: {},
40158
+ config: config2
40159
+ });
40160
+ }
40161
+ try {
40162
+ convertedData = fromDataURI(config2.url, responseType === "blob", {
40163
+ Blob: config2.env && config2.env.Blob
40164
+ });
40165
+ } catch (err) {
40166
+ throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config2);
40167
+ }
40168
+ if (responseType === "text") {
40169
+ convertedData = convertedData.toString(responseEncoding);
40170
+ if (!responseEncoding || responseEncoding === "utf8") {
40171
+ convertedData = utils$1.stripBOM(convertedData);
40172
+ }
40173
+ } else if (responseType === "stream") {
40174
+ convertedData = stream__default["default"].Readable.from(convertedData);
40175
+ }
40176
+ return settle(resolve, reject, {
40177
+ data: convertedData,
40178
+ status: 200,
40179
+ statusText: "OK",
40180
+ headers: new AxiosHeaders$1,
40181
+ config: config2
40182
+ });
40183
+ }
40184
+ if (supportedProtocols.indexOf(protocol) === -1) {
40185
+ return reject(new AxiosError("Unsupported protocol " + protocol, AxiosError.ERR_BAD_REQUEST, config2));
40186
+ }
40187
+ const headers = AxiosHeaders$1.from(config2.headers).normalize();
40188
+ headers.set("User-Agent", "axios/" + VERSION3, false);
40189
+ const { onUploadProgress, onDownloadProgress } = config2;
40190
+ const maxRate = config2.maxRate;
40191
+ let maxUploadRate = undefined;
40192
+ let maxDownloadRate = undefined;
40193
+ if (utils$1.isSpecCompliantForm(data)) {
40194
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
40195
+ data = formDataToStream$1(data, (formHeaders) => {
40196
+ headers.set(formHeaders);
40197
+ }, {
40198
+ tag: `axios-${VERSION3}-boundary`,
40199
+ boundary: userBoundary && userBoundary[1] || undefined
40200
+ });
40201
+ } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
40202
+ headers.set(data.getHeaders());
40203
+ if (!headers.hasContentLength()) {
40204
+ try {
40205
+ const knownLength = await util__default["default"].promisify(data.getLength).call(data);
40206
+ Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
40207
+ } catch (e2) {
40208
+ }
40209
+ }
40210
+ } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
40211
+ data.size && headers.setContentType(data.type || "application/octet-stream");
40212
+ headers.setContentLength(data.size || 0);
40213
+ data = stream__default["default"].Readable.from(readBlob$1(data));
40214
+ } else if (data && !utils$1.isStream(data)) {
40215
+ if (Buffer.isBuffer(data))
40216
+ ;
40217
+ else if (utils$1.isArrayBuffer(data)) {
40218
+ data = Buffer.from(new Uint8Array(data));
40219
+ } else if (utils$1.isString(data)) {
40220
+ data = Buffer.from(data, "utf-8");
40221
+ } else {
40222
+ return reject(new AxiosError("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream", AxiosError.ERR_BAD_REQUEST, config2));
40223
+ }
40224
+ headers.setContentLength(data.length, false);
40225
+ if (config2.maxBodyLength > -1 && data.length > config2.maxBodyLength) {
40226
+ return reject(new AxiosError("Request body larger than maxBodyLength limit", AxiosError.ERR_BAD_REQUEST, config2));
40227
+ }
40228
+ }
40229
+ const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
40230
+ if (utils$1.isArray(maxRate)) {
40231
+ maxUploadRate = maxRate[0];
40232
+ maxDownloadRate = maxRate[1];
40233
+ } else {
40234
+ maxUploadRate = maxDownloadRate = maxRate;
40235
+ }
40236
+ if (data && (onUploadProgress || maxUploadRate)) {
40237
+ if (!utils$1.isStream(data)) {
40238
+ data = stream__default["default"].Readable.from(data, { objectMode: false });
40239
+ }
40240
+ data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
40241
+ maxRate: utils$1.toFiniteNumber(maxUploadRate)
40242
+ })], utils$1.noop);
40243
+ onUploadProgress && data.on("progress", flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
40244
+ }
40245
+ let auth2 = undefined;
40246
+ if (config2.auth) {
40247
+ const username = config2.auth.username || "";
40248
+ const password = config2.auth.password || "";
40249
+ auth2 = username + ":" + password;
40250
+ }
40251
+ if (!auth2 && parsed.username) {
40252
+ const urlUsername = parsed.username;
40253
+ const urlPassword = parsed.password;
40254
+ auth2 = urlUsername + ":" + urlPassword;
40255
+ }
40256
+ auth2 && headers.delete("authorization");
40257
+ let path;
40258
+ try {
40259
+ path = buildURL(parsed.pathname + parsed.search, config2.params, config2.paramsSerializer).replace(/^\?/, "");
40260
+ } catch (err) {
40261
+ const customErr = new Error(err.message);
40262
+ customErr.config = config2;
40263
+ customErr.url = config2.url;
40264
+ customErr.exists = true;
40265
+ return reject(customErr);
40266
+ }
40267
+ headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
40268
+ const options = {
40269
+ path,
40270
+ method,
40271
+ headers: headers.toJSON(),
40272
+ agents: { http: config2.httpAgent, https: config2.httpsAgent },
40273
+ auth: auth2,
40274
+ protocol,
40275
+ family,
40276
+ beforeRedirect: dispatchBeforeRedirect,
40277
+ beforeRedirects: {}
40278
+ };
40279
+ !utils$1.isUndefined(lookup) && (options.lookup = lookup);
40280
+ if (config2.socketPath) {
40281
+ options.socketPath = config2.socketPath;
40282
+ } else {
40283
+ options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
40284
+ options.port = parsed.port;
40285
+ setProxy(options, config2.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
40286
+ }
40287
+ let transport;
40288
+ const isHttpsRequest = isHttps.test(options.protocol);
40289
+ options.agent = isHttpsRequest ? config2.httpsAgent : config2.httpAgent;
40290
+ if (config2.transport) {
40291
+ transport = config2.transport;
40292
+ } else if (config2.maxRedirects === 0) {
40293
+ transport = isHttpsRequest ? https__default["default"] : http__default["default"];
40294
+ } else {
40295
+ if (config2.maxRedirects) {
40296
+ options.maxRedirects = config2.maxRedirects;
40297
+ }
40298
+ if (config2.beforeRedirect) {
40299
+ options.beforeRedirects.config = config2.beforeRedirect;
40300
+ }
40301
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
40302
+ }
40303
+ if (config2.maxBodyLength > -1) {
40304
+ options.maxBodyLength = config2.maxBodyLength;
40305
+ } else {
40306
+ options.maxBodyLength = Infinity;
40307
+ }
40308
+ if (config2.insecureHTTPParser) {
40309
+ options.insecureHTTPParser = config2.insecureHTTPParser;
40310
+ }
40311
+ req = transport.request(options, function handleResponse(res) {
40312
+ if (req.destroyed)
40313
+ return;
40314
+ const streams = [res];
40315
+ const responseLength = +res.headers["content-length"];
40316
+ if (onDownloadProgress || maxDownloadRate) {
40317
+ const transformStream = new AxiosTransformStream$1({
40318
+ maxRate: utils$1.toFiniteNumber(maxDownloadRate)
40319
+ });
40320
+ onDownloadProgress && transformStream.on("progress", flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress), true, 3))));
40321
+ streams.push(transformStream);
40322
+ }
40323
+ let responseStream = res;
40324
+ const lastRequest = res.req || req;
40325
+ if (config2.decompress !== false && res.headers["content-encoding"]) {
40326
+ if (method === "HEAD" || res.statusCode === 204) {
40327
+ delete res.headers["content-encoding"];
40328
+ }
40329
+ switch ((res.headers["content-encoding"] || "").toLowerCase()) {
40330
+ case "gzip":
40331
+ case "x-gzip":
40332
+ case "compress":
40333
+ case "x-compress":
40334
+ streams.push(zlib__default["default"].createUnzip(zlibOptions));
40335
+ delete res.headers["content-encoding"];
40336
+ break;
40337
+ case "deflate":
40338
+ streams.push(new ZlibHeaderTransformStream$1);
40339
+ streams.push(zlib__default["default"].createUnzip(zlibOptions));
40340
+ delete res.headers["content-encoding"];
40341
+ break;
40342
+ case "br":
40343
+ if (isBrotliSupported) {
40344
+ streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions));
40345
+ delete res.headers["content-encoding"];
40346
+ }
40347
+ }
40348
+ }
40349
+ responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0];
40350
+ const offListeners = stream__default["default"].finished(responseStream, () => {
40351
+ offListeners();
40352
+ onFinished();
40353
+ });
40354
+ const response = {
40355
+ status: res.statusCode,
40356
+ statusText: res.statusMessage,
40357
+ headers: new AxiosHeaders$1(res.headers),
40358
+ config: config2,
40359
+ request: lastRequest
40360
+ };
40361
+ if (responseType === "stream") {
40362
+ response.data = responseStream;
40363
+ settle(resolve, reject, response);
40364
+ } else {
40365
+ const responseBuffer = [];
40366
+ let totalResponseBytes = 0;
40367
+ responseStream.on("data", function handleStreamData(chunk) {
40368
+ responseBuffer.push(chunk);
40369
+ totalResponseBytes += chunk.length;
40370
+ if (config2.maxContentLength > -1 && totalResponseBytes > config2.maxContentLength) {
40371
+ rejected = true;
40372
+ responseStream.destroy();
40373
+ reject(new AxiosError("maxContentLength size of " + config2.maxContentLength + " exceeded", AxiosError.ERR_BAD_RESPONSE, config2, lastRequest));
40374
+ }
40375
+ });
40376
+ responseStream.on("aborted", function handlerStreamAborted() {
40377
+ if (rejected) {
40378
+ return;
40379
+ }
40380
+ const err = new AxiosError("stream has been aborted", AxiosError.ERR_BAD_RESPONSE, config2, lastRequest);
40381
+ responseStream.destroy(err);
40382
+ reject(err);
40383
+ });
40384
+ responseStream.on("error", function handleStreamError(err) {
40385
+ if (req.destroyed)
40386
+ return;
40387
+ reject(AxiosError.from(err, null, config2, lastRequest));
40388
+ });
40389
+ responseStream.on("end", function handleStreamEnd() {
40390
+ try {
40391
+ let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
40392
+ if (responseType !== "arraybuffer") {
40393
+ responseData = responseData.toString(responseEncoding);
40394
+ if (!responseEncoding || responseEncoding === "utf8") {
40395
+ responseData = utils$1.stripBOM(responseData);
40396
+ }
40397
+ }
40398
+ response.data = responseData;
40399
+ } catch (err) {
40400
+ return reject(AxiosError.from(err, null, config2, response.request, response));
40401
+ }
40402
+ settle(resolve, reject, response);
40403
+ });
40404
+ }
40405
+ emitter.once("abort", (err) => {
40406
+ if (!responseStream.destroyed) {
40407
+ responseStream.emit("error", err);
40408
+ responseStream.destroy();
40409
+ }
40410
+ });
40411
+ });
40412
+ emitter.once("abort", (err) => {
40413
+ reject(err);
40414
+ req.destroy(err);
40415
+ });
40416
+ req.on("error", function handleRequestError(err) {
40417
+ reject(AxiosError.from(err, null, config2, req));
40418
+ });
40419
+ req.on("socket", function handleRequestSocket(socket) {
40420
+ socket.setKeepAlive(true, 1000 * 60);
40421
+ });
40422
+ if (config2.timeout) {
40423
+ const timeout4 = parseInt(config2.timeout, 10);
40424
+ if (Number.isNaN(timeout4)) {
40425
+ reject(new AxiosError("error trying to parse `config.timeout` to int", AxiosError.ERR_BAD_OPTION_VALUE, config2, req));
40426
+ return;
40427
+ }
40428
+ req.setTimeout(timeout4, function handleRequestTimeout() {
40429
+ if (isDone)
40430
+ return;
40431
+ let timeoutErrorMessage = config2.timeout ? "timeout of " + config2.timeout + "ms exceeded" : "timeout exceeded";
40432
+ const transitional = config2.transitional || transitionalDefaults;
40433
+ if (config2.timeoutErrorMessage) {
40434
+ timeoutErrorMessage = config2.timeoutErrorMessage;
40435
+ }
40436
+ reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config2, req));
40437
+ abort();
40438
+ });
40439
+ }
40440
+ if (utils$1.isStream(data)) {
40441
+ let ended = false;
40442
+ let errored = false;
40443
+ data.on("end", () => {
40444
+ ended = true;
40445
+ });
40446
+ data.once("error", (err) => {
40447
+ errored = true;
40448
+ req.destroy(err);
40449
+ });
40450
+ data.on("close", () => {
40451
+ if (!ended && !errored) {
40452
+ abort(new CanceledError("Request stream has been aborted", config2, req));
40453
+ }
40454
+ });
40455
+ data.pipe(req);
40456
+ } else {
40457
+ req.end(data);
40458
+ }
40459
+ });
40460
+ };
40461
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin2, isMSIE) => (url2) => {
40462
+ url2 = new URL(url2, platform.origin);
40463
+ return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
40464
+ })(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : () => true;
40465
+ var cookies = platform.hasStandardBrowserEnv ? {
40466
+ write(name2, value2, expires, path, domain, secure) {
40467
+ const cookie = [name2 + "=" + encodeURIComponent(value2)];
40468
+ utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
40469
+ utils$1.isString(path) && cookie.push("path=" + path);
40470
+ utils$1.isString(domain) && cookie.push("domain=" + domain);
40471
+ secure === true && cookie.push("secure");
40472
+ document.cookie = cookie.join("; ");
40473
+ },
40474
+ read(name2) {
40475
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name2 + ")=([^;]*)"));
40476
+ return match ? decodeURIComponent(match[3]) : null;
40477
+ },
40478
+ remove(name2) {
40479
+ this.write(name2, "", Date.now() - 86400000);
40480
+ }
40481
+ } : {
40482
+ write() {
40483
+ },
40484
+ read() {
40485
+ return null;
40486
+ },
40487
+ remove() {
40488
+ }
40489
+ };
40490
+ var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
40491
+ function mergeConfig(config1, config2) {
40492
+ config2 = config2 || {};
40493
+ const config3 = {};
40494
+ function getMergedValue(target, source, prop, caseless) {
40495
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
40496
+ return utils$1.merge.call({ caseless }, target, source);
40497
+ } else if (utils$1.isPlainObject(source)) {
40498
+ return utils$1.merge({}, source);
40499
+ } else if (utils$1.isArray(source)) {
40500
+ return source.slice();
40501
+ }
40502
+ return source;
40503
+ }
40504
+ function mergeDeepProperties(a, b, prop, caseless) {
40505
+ if (!utils$1.isUndefined(b)) {
40506
+ return getMergedValue(a, b, prop, caseless);
40507
+ } else if (!utils$1.isUndefined(a)) {
40508
+ return getMergedValue(undefined, a, prop, caseless);
40509
+ }
40510
+ }
40511
+ function valueFromConfig2(a, b) {
40512
+ if (!utils$1.isUndefined(b)) {
40513
+ return getMergedValue(undefined, b);
40514
+ }
40515
+ }
40516
+ function defaultToConfig2(a, b) {
40517
+ if (!utils$1.isUndefined(b)) {
40518
+ return getMergedValue(undefined, b);
40519
+ } else if (!utils$1.isUndefined(a)) {
40520
+ return getMergedValue(undefined, a);
40521
+ }
40522
+ }
40523
+ function mergeDirectKeys(a, b, prop) {
40524
+ if (prop in config2) {
40525
+ return getMergedValue(a, b);
40526
+ } else if (prop in config1) {
40527
+ return getMergedValue(undefined, a);
40528
+ }
40529
+ }
40530
+ const mergeMap = {
40531
+ url: valueFromConfig2,
40532
+ method: valueFromConfig2,
40533
+ data: valueFromConfig2,
40534
+ baseURL: defaultToConfig2,
40535
+ transformRequest: defaultToConfig2,
40536
+ transformResponse: defaultToConfig2,
40537
+ paramsSerializer: defaultToConfig2,
40538
+ timeout: defaultToConfig2,
40539
+ timeoutMessage: defaultToConfig2,
40540
+ withCredentials: defaultToConfig2,
40541
+ withXSRFToken: defaultToConfig2,
40542
+ adapter: defaultToConfig2,
40543
+ responseType: defaultToConfig2,
40544
+ xsrfCookieName: defaultToConfig2,
40545
+ xsrfHeaderName: defaultToConfig2,
40546
+ onUploadProgress: defaultToConfig2,
40547
+ onDownloadProgress: defaultToConfig2,
40548
+ decompress: defaultToConfig2,
40549
+ maxContentLength: defaultToConfig2,
40550
+ maxBodyLength: defaultToConfig2,
40551
+ beforeRedirect: defaultToConfig2,
40552
+ transport: defaultToConfig2,
40553
+ httpAgent: defaultToConfig2,
40554
+ httpsAgent: defaultToConfig2,
40555
+ cancelToken: defaultToConfig2,
40556
+ socketPath: defaultToConfig2,
40557
+ responseEncoding: defaultToConfig2,
40558
+ validateStatus: mergeDirectKeys,
40559
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
40560
+ };
40561
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
40562
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
40563
+ const configValue = merge2(config1[prop], config2[prop], prop);
40564
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
40565
+ });
40566
+ return config3;
40567
+ }
40568
+ var resolveConfig = (config2) => {
40569
+ const newConfig = mergeConfig({}, config2);
40570
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth: auth2 } = newConfig;
40571
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
40572
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config2.params, config2.paramsSerializer);
40573
+ if (auth2) {
40574
+ headers.set("Authorization", "Basic " + btoa((auth2.username || "") + ":" + (auth2.password ? unescape(encodeURIComponent(auth2.password)) : "")));
40575
+ }
40576
+ let contentType;
40577
+ if (utils$1.isFormData(data)) {
40578
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
40579
+ headers.setContentType(undefined);
40580
+ } else if ((contentType = headers.getContentType()) !== false) {
40581
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
40582
+ headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
40583
+ }
40584
+ }
40585
+ if (platform.hasStandardBrowserEnv) {
40586
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
40587
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
40588
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
40589
+ if (xsrfValue) {
40590
+ headers.set(xsrfHeaderName, xsrfValue);
40591
+ }
40592
+ }
40593
+ }
40594
+ return newConfig;
40595
+ };
40596
+ var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
40597
+ var xhrAdapter = isXHRAdapterSupported && function(config2) {
40598
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
40599
+ const _config = resolveConfig(config2);
40600
+ let requestData = _config.data;
40601
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
40602
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
40603
+ let onCanceled;
40604
+ let uploadThrottled, downloadThrottled;
40605
+ let flushUpload, flushDownload;
40606
+ function done() {
40607
+ flushUpload && flushUpload();
40608
+ flushDownload && flushDownload();
40609
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
40610
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
40611
+ }
40612
+ let request = new XMLHttpRequest;
40613
+ request.open(_config.method.toUpperCase(), _config.url, true);
40614
+ request.timeout = _config.timeout;
40615
+ function onloadend() {
40616
+ if (!request) {
40617
+ return;
40618
+ }
40619
+ const responseHeaders = AxiosHeaders$1.from("getAllResponseHeaders" in request && request.getAllResponseHeaders());
40620
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
40621
+ const response = {
40622
+ data: responseData,
40623
+ status: request.status,
40624
+ statusText: request.statusText,
40625
+ headers: responseHeaders,
40626
+ config: config2,
40627
+ request
40628
+ };
40629
+ settle(function _resolve(value2) {
40630
+ resolve(value2);
40631
+ done();
40632
+ }, function _reject(err) {
40633
+ reject(err);
40634
+ done();
40635
+ }, response);
40636
+ request = null;
40637
+ }
40638
+ if ("onloadend" in request) {
40639
+ request.onloadend = onloadend;
40640
+ } else {
40641
+ request.onreadystatechange = function handleLoad() {
40642
+ if (!request || request.readyState !== 4) {
40643
+ return;
40644
+ }
40645
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
40646
+ return;
40647
+ }
40648
+ setTimeout(onloadend);
40649
+ };
40650
+ }
40651
+ request.onabort = function handleAbort() {
40652
+ if (!request) {
40653
+ return;
40654
+ }
40655
+ reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config2, request));
40656
+ request = null;
40657
+ };
40658
+ request.onerror = function handleError() {
40659
+ reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config2, request));
40660
+ request = null;
40661
+ };
40662
+ request.ontimeout = function handleTimeout() {
40663
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
40664
+ const transitional = _config.transitional || transitionalDefaults;
40665
+ if (_config.timeoutErrorMessage) {
40666
+ timeoutErrorMessage = _config.timeoutErrorMessage;
40667
+ }
40668
+ reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config2, request));
40669
+ request = null;
40670
+ };
40671
+ requestData === undefined && requestHeaders.setContentType(null);
40672
+ if ("setRequestHeader" in request) {
40673
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
40674
+ request.setRequestHeader(key, val);
40675
+ });
40676
+ }
40677
+ if (!utils$1.isUndefined(_config.withCredentials)) {
40678
+ request.withCredentials = !!_config.withCredentials;
40679
+ }
40680
+ if (responseType && responseType !== "json") {
40681
+ request.responseType = _config.responseType;
40682
+ }
40683
+ if (onDownloadProgress) {
40684
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
40685
+ request.addEventListener("progress", downloadThrottled);
40686
+ }
40687
+ if (onUploadProgress && request.upload) {
40688
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
40689
+ request.upload.addEventListener("progress", uploadThrottled);
40690
+ request.upload.addEventListener("loadend", flushUpload);
40691
+ }
40692
+ if (_config.cancelToken || _config.signal) {
40693
+ onCanceled = (cancel) => {
40694
+ if (!request) {
40695
+ return;
40696
+ }
40697
+ reject(!cancel || cancel.type ? new CanceledError(null, config2, request) : cancel);
40698
+ request.abort();
40699
+ request = null;
40700
+ };
40701
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
40702
+ if (_config.signal) {
40703
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
40704
+ }
40705
+ }
40706
+ const protocol = parseProtocol(_config.url);
40707
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
40708
+ reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config2));
40709
+ return;
40710
+ }
40711
+ request.send(requestData || null);
40712
+ });
40713
+ };
40714
+ var composeSignals = (signals, timeout4) => {
40715
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
40716
+ if (timeout4 || length) {
40717
+ let controller = new AbortController;
40718
+ let aborted;
40719
+ const onabort = function(reason) {
40720
+ if (!aborted) {
40721
+ aborted = true;
40722
+ unsubscribe();
40723
+ const err = reason instanceof Error ? reason : this.reason;
40724
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
40725
+ }
40726
+ };
40727
+ let timer = timeout4 && setTimeout(() => {
40728
+ timer = null;
40729
+ onabort(new AxiosError(`timeout ${timeout4} of ms exceeded`, AxiosError.ETIMEDOUT));
40730
+ }, timeout4);
40731
+ const unsubscribe = () => {
40732
+ if (signals) {
40733
+ timer && clearTimeout(timer);
40734
+ timer = null;
40735
+ signals.forEach((signal2) => {
40736
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
40737
+ });
40738
+ signals = null;
40739
+ }
40740
+ };
40741
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
40742
+ const { signal } = controller;
40743
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
40744
+ return signal;
40745
+ }
40746
+ };
40747
+ var composeSignals$1 = composeSignals;
40748
+ var streamChunk = function* (chunk, chunkSize) {
40749
+ let len = chunk.byteLength;
40750
+ if (!chunkSize || len < chunkSize) {
40751
+ yield chunk;
40752
+ return;
40753
+ }
40754
+ let pos = 0;
40755
+ let end;
40756
+ while (pos < len) {
40757
+ end = pos + chunkSize;
40758
+ yield chunk.slice(pos, end);
40759
+ pos = end;
40760
+ }
40761
+ };
40762
+ var readBytes = async function* (iterable, chunkSize) {
40763
+ for await (const chunk of readStream(iterable)) {
40764
+ yield* streamChunk(chunk, chunkSize);
40765
+ }
40766
+ };
40767
+ var readStream = async function* (stream3) {
40768
+ if (stream3[Symbol.asyncIterator]) {
40769
+ yield* stream3;
40770
+ return;
40771
+ }
40772
+ const reader = stream3.getReader();
40773
+ try {
40774
+ for (;; ) {
40775
+ const { done, value: value2 } = await reader.read();
40776
+ if (done) {
40777
+ break;
40778
+ }
40779
+ yield value2;
40780
+ }
40781
+ } finally {
40782
+ await reader.cancel();
40783
+ }
40784
+ };
40785
+ var trackStream = (stream3, chunkSize, onProgress, onFinish) => {
40786
+ const iterator = readBytes(stream3, chunkSize);
40787
+ let bytes = 0;
40788
+ let done;
40789
+ let _onFinish = (e2) => {
40790
+ if (!done) {
40791
+ done = true;
40792
+ onFinish && onFinish(e2);
40793
+ }
40794
+ };
40795
+ return new ReadableStream({
40796
+ async pull(controller) {
40797
+ try {
40798
+ const { done: done2, value: value2 } = await iterator.next();
40799
+ if (done2) {
40800
+ _onFinish();
40801
+ controller.close();
40802
+ return;
40803
+ }
40804
+ let len = value2.byteLength;
40805
+ if (onProgress) {
40806
+ let loadedBytes = bytes += len;
40807
+ onProgress(loadedBytes);
40808
+ }
40809
+ controller.enqueue(new Uint8Array(value2));
40810
+ } catch (err) {
40811
+ _onFinish(err);
40812
+ throw err;
40813
+ }
40814
+ },
40815
+ cancel(reason) {
40816
+ _onFinish(reason);
40817
+ return iterator.return();
40818
+ }
40819
+ }, {
40820
+ highWaterMark: 2
40821
+ });
40822
+ };
40823
+ var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
40824
+ var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
40825
+ var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder2) => (str) => encoder2.encode(str))(new TextEncoder) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
40826
+ var test = (fn, ...args) => {
40827
+ try {
40828
+ return !!fn(...args);
40829
+ } catch (e2) {
40830
+ return false;
40831
+ }
40832
+ };
40833
+ var supportsRequestStream = isReadableStreamSupported && test(() => {
40834
+ let duplexAccessed = false;
40835
+ const hasContentType = new Request(platform.origin, {
40836
+ body: new ReadableStream,
40837
+ method: "POST",
40838
+ get duplex() {
40839
+ duplexAccessed = true;
40840
+ return "half";
40841
+ }
40842
+ }).headers.has("Content-Type");
40843
+ return duplexAccessed && !hasContentType;
40844
+ });
40845
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
40846
+ var supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
40847
+ var resolvers = {
40848
+ stream: supportsResponseStream && ((res) => res.body)
40849
+ };
40850
+ isFetchSupported && ((res) => {
40851
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
40852
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config2) => {
40853
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config2);
40854
+ });
40855
+ });
40856
+ })(new Response);
40857
+ var getBodyLength = async (body) => {
40858
+ if (body == null) {
40859
+ return 0;
40860
+ }
40861
+ if (utils$1.isBlob(body)) {
40862
+ return body.size;
40863
+ }
40864
+ if (utils$1.isSpecCompliantForm(body)) {
40865
+ const _request = new Request(platform.origin, {
40866
+ method: "POST",
40867
+ body
40868
+ });
40869
+ return (await _request.arrayBuffer()).byteLength;
40870
+ }
40871
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
40872
+ return body.byteLength;
40873
+ }
40874
+ if (utils$1.isURLSearchParams(body)) {
40875
+ body = body + "";
40876
+ }
40877
+ if (utils$1.isString(body)) {
40878
+ return (await encodeText(body)).byteLength;
40879
+ }
40880
+ };
40881
+ var resolveBodyLength = async (headers, body) => {
40882
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
40883
+ return length == null ? getBodyLength(body) : length;
40884
+ };
40885
+ var fetchAdapter = isFetchSupported && (async (config2) => {
40886
+ let {
40887
+ url: url2,
40888
+ method,
40889
+ data,
40890
+ signal,
40891
+ cancelToken,
40892
+ timeout: timeout4,
40893
+ onDownloadProgress,
40894
+ onUploadProgress,
40895
+ responseType,
40896
+ headers,
40897
+ withCredentials = "same-origin",
40898
+ fetchOptions
40899
+ } = resolveConfig(config2);
40900
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
40901
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout4);
40902
+ let request;
40903
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
40904
+ composedSignal.unsubscribe();
40905
+ });
40906
+ let requestContentLength;
40907
+ try {
40908
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
40909
+ let _request = new Request(url2, {
40910
+ method: "POST",
40911
+ body: data,
40912
+ duplex: "half"
40913
+ });
40914
+ let contentTypeHeader;
40915
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
40916
+ headers.setContentType(contentTypeHeader);
40917
+ }
40918
+ if (_request.body) {
40919
+ const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
40920
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
40921
+ }
40922
+ }
40923
+ if (!utils$1.isString(withCredentials)) {
40924
+ withCredentials = withCredentials ? "include" : "omit";
40925
+ }
40926
+ const isCredentialsSupported = "credentials" in Request.prototype;
40927
+ request = new Request(url2, {
40928
+ ...fetchOptions,
40929
+ signal: composedSignal,
40930
+ method: method.toUpperCase(),
40931
+ headers: headers.normalize().toJSON(),
40932
+ body: data,
40933
+ duplex: "half",
40934
+ credentials: isCredentialsSupported ? withCredentials : undefined
40935
+ });
40936
+ let response = await fetch(request);
40937
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
40938
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
40939
+ const options = {};
40940
+ ["status", "statusText", "headers"].forEach((prop) => {
40941
+ options[prop] = response[prop];
40942
+ });
40943
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
40944
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
40945
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
40946
+ flush && flush();
40947
+ unsubscribe && unsubscribe();
40948
+ }), options);
40949
+ }
40950
+ responseType = responseType || "text";
40951
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config2);
40952
+ !isStreamResponse && unsubscribe && unsubscribe();
40953
+ return await new Promise((resolve, reject) => {
40954
+ settle(resolve, reject, {
40955
+ data: responseData,
40956
+ headers: AxiosHeaders$1.from(response.headers),
40957
+ status: response.status,
40958
+ statusText: response.statusText,
40959
+ config: config2,
40960
+ request
40961
+ });
40962
+ });
40963
+ } catch (err) {
40964
+ unsubscribe && unsubscribe();
40965
+ if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
40966
+ throw Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config2, request), {
40967
+ cause: err.cause || err
40968
+ });
40969
+ }
40970
+ throw AxiosError.from(err, err && err.code, config2, request);
40971
+ }
40972
+ });
40973
+ var knownAdapters = {
40974
+ http: httpAdapter,
40975
+ xhr: xhrAdapter,
40976
+ fetch: fetchAdapter
40977
+ };
40978
+ utils$1.forEach(knownAdapters, (fn, value2) => {
40979
+ if (fn) {
40980
+ try {
40981
+ Object.defineProperty(fn, "name", { value: value2 });
40982
+ } catch (e2) {
40983
+ }
40984
+ Object.defineProperty(fn, "adapterName", { value: value2 });
40985
+ }
40986
+ });
40987
+ var renderReason = (reason) => `- ${reason}`;
40988
+ var isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
40989
+ var adapters = {
40990
+ getAdapter: (adapters2) => {
40991
+ adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
40992
+ const { length } = adapters2;
40993
+ let nameOrAdapter;
40994
+ let adapter;
40995
+ const rejectedReasons = {};
40996
+ for (let i2 = 0;i2 < length; i2++) {
40997
+ nameOrAdapter = adapters2[i2];
40998
+ let id;
40999
+ adapter = nameOrAdapter;
41000
+ if (!isResolvedHandle(nameOrAdapter)) {
41001
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
41002
+ if (adapter === undefined) {
41003
+ throw new AxiosError(`Unknown adapter '${id}'`);
41004
+ }
41005
+ }
41006
+ if (adapter) {
41007
+ break;
41008
+ }
41009
+ rejectedReasons[id || "#" + i2] = adapter;
41010
+ }
41011
+ if (!adapter) {
41012
+ const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build"));
41013
+ let s2 = length ? reasons.length > 1 ? `since :
41014
+ ` + reasons.map(renderReason).join(`
41015
+ `) : " " + renderReason(reasons[0]) : "as no adapter specified";
41016
+ throw new AxiosError(`There is no suitable adapter to dispatch the request ` + s2, "ERR_NOT_SUPPORT");
41017
+ }
41018
+ return adapter;
41019
+ },
41020
+ adapters: knownAdapters
41021
+ };
41022
+ function throwIfCancellationRequested(config2) {
41023
+ if (config2.cancelToken) {
41024
+ config2.cancelToken.throwIfRequested();
41025
+ }
41026
+ if (config2.signal && config2.signal.aborted) {
41027
+ throw new CanceledError(null, config2);
41028
+ }
41029
+ }
41030
+ function dispatchRequest(config2) {
41031
+ throwIfCancellationRequested(config2);
41032
+ config2.headers = AxiosHeaders$1.from(config2.headers);
41033
+ config2.data = transformData.call(config2, config2.transformRequest);
41034
+ if (["post", "put", "patch"].indexOf(config2.method) !== -1) {
41035
+ config2.headers.setContentType("application/x-www-form-urlencoded", false);
41036
+ }
41037
+ const adapter = adapters.getAdapter(config2.adapter || defaults$1.adapter);
41038
+ return adapter(config2).then(function onAdapterResolution(response) {
41039
+ throwIfCancellationRequested(config2);
41040
+ response.data = transformData.call(config2, config2.transformResponse, response);
41041
+ response.headers = AxiosHeaders$1.from(response.headers);
41042
+ return response;
41043
+ }, function onAdapterRejection(reason) {
41044
+ if (!isCancel(reason)) {
41045
+ throwIfCancellationRequested(config2);
41046
+ if (reason && reason.response) {
41047
+ reason.response.data = transformData.call(config2, config2.transformResponse, reason.response);
41048
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
41049
+ }
41050
+ }
41051
+ return Promise.reject(reason);
41052
+ });
41053
+ }
41054
+ var validators$1 = {};
41055
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
41056
+ validators$1[type] = function validator(thing) {
41057
+ return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
41058
+ };
41059
+ });
41060
+ var deprecatedWarnings = {};
41061
+ validators$1.transitional = function transitional(validator2, version, message2) {
41062
+ function formatMessage(opt, desc) {
41063
+ return "[Axios v" + VERSION3 + "] Transitional option '" + opt + "'" + desc + (message2 ? ". " + message2 : "");
41064
+ }
41065
+ return (value2, opt, opts) => {
41066
+ if (validator2 === false) {
41067
+ throw new AxiosError(formatMessage(opt, " has been removed" + (version ? " in " + version : "")), AxiosError.ERR_DEPRECATED);
41068
+ }
41069
+ if (version && !deprecatedWarnings[opt]) {
41070
+ deprecatedWarnings[opt] = true;
41071
+ console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"));
41072
+ }
41073
+ return validator2 ? validator2(value2, opt, opts) : true;
41074
+ };
41075
+ };
41076
+ validators$1.spelling = function spelling(correctSpelling) {
41077
+ return (value2, opt) => {
41078
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
41079
+ return true;
41080
+ };
41081
+ };
41082
+ function assertOptions(options, schema, allowUnknown) {
41083
+ if (typeof options !== "object") {
41084
+ throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
41085
+ }
41086
+ const keys = Object.keys(options);
41087
+ let i2 = keys.length;
41088
+ while (i2-- > 0) {
41089
+ const opt = keys[i2];
41090
+ const validator2 = schema[opt];
41091
+ if (validator2) {
41092
+ const value2 = options[opt];
41093
+ const result = value2 === undefined || validator2(value2, opt, options);
41094
+ if (result !== true) {
41095
+ throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
41096
+ }
41097
+ continue;
41098
+ }
41099
+ if (allowUnknown !== true) {
41100
+ throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
41101
+ }
41102
+ }
41103
+ }
41104
+ var validator = {
41105
+ assertOptions,
41106
+ validators: validators$1
41107
+ };
41108
+ var validators = validator.validators;
41109
+
41110
+ class Axios {
41111
+ constructor(instanceConfig) {
41112
+ this.defaults = instanceConfig;
41113
+ this.interceptors = {
41114
+ request: new InterceptorManager$1,
41115
+ response: new InterceptorManager$1
41116
+ };
41117
+ }
41118
+ async request(configOrUrl, config2) {
41119
+ try {
41120
+ return await this._request(configOrUrl, config2);
41121
+ } catch (err) {
41122
+ if (err instanceof Error) {
41123
+ let dummy = {};
41124
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error;
41125
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
41126
+ try {
41127
+ if (!err.stack) {
41128
+ err.stack = stack;
41129
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
41130
+ err.stack += `
41131
+ ` + stack;
41132
+ }
41133
+ } catch (e2) {
41134
+ }
41135
+ }
41136
+ throw err;
41137
+ }
41138
+ }
41139
+ _request(configOrUrl, config2) {
41140
+ if (typeof configOrUrl === "string") {
41141
+ config2 = config2 || {};
41142
+ config2.url = configOrUrl;
41143
+ } else {
41144
+ config2 = configOrUrl || {};
41145
+ }
41146
+ config2 = mergeConfig(this.defaults, config2);
41147
+ const { transitional, paramsSerializer, headers } = config2;
41148
+ if (transitional !== undefined) {
41149
+ validator.assertOptions(transitional, {
41150
+ silentJSONParsing: validators.transitional(validators.boolean),
41151
+ forcedJSONParsing: validators.transitional(validators.boolean),
41152
+ clarifyTimeoutError: validators.transitional(validators.boolean)
41153
+ }, false);
41154
+ }
41155
+ if (paramsSerializer != null) {
41156
+ if (utils$1.isFunction(paramsSerializer)) {
41157
+ config2.paramsSerializer = {
41158
+ serialize: paramsSerializer
41159
+ };
41160
+ } else {
41161
+ validator.assertOptions(paramsSerializer, {
41162
+ encode: validators.function,
41163
+ serialize: validators.function
41164
+ }, true);
41165
+ }
41166
+ }
41167
+ if (config2.allowAbsoluteUrls !== undefined)
41168
+ ;
41169
+ else if (this.defaults.allowAbsoluteUrls !== undefined) {
41170
+ config2.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
41171
+ } else {
41172
+ config2.allowAbsoluteUrls = true;
41173
+ }
41174
+ validator.assertOptions(config2, {
41175
+ baseUrl: validators.spelling("baseURL"),
41176
+ withXsrfToken: validators.spelling("withXSRFToken")
41177
+ }, true);
41178
+ config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
41179
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config2.method]);
41180
+ headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
41181
+ delete headers[method];
41182
+ });
41183
+ config2.headers = AxiosHeaders$1.concat(contextHeaders, headers);
41184
+ const requestInterceptorChain = [];
41185
+ let synchronousRequestInterceptors = true;
41186
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
41187
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config2) === false) {
41188
+ return;
41189
+ }
41190
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
41191
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
41192
+ });
41193
+ const responseInterceptorChain = [];
41194
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
41195
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
41196
+ });
41197
+ let promise2;
41198
+ let i2 = 0;
41199
+ let len;
41200
+ if (!synchronousRequestInterceptors) {
41201
+ const chain = [dispatchRequest.bind(this), undefined];
41202
+ chain.unshift.apply(chain, requestInterceptorChain);
41203
+ chain.push.apply(chain, responseInterceptorChain);
41204
+ len = chain.length;
41205
+ promise2 = Promise.resolve(config2);
41206
+ while (i2 < len) {
41207
+ promise2 = promise2.then(chain[i2++], chain[i2++]);
41208
+ }
41209
+ return promise2;
41210
+ }
41211
+ len = requestInterceptorChain.length;
41212
+ let newConfig = config2;
41213
+ i2 = 0;
41214
+ while (i2 < len) {
41215
+ const onFulfilled = requestInterceptorChain[i2++];
41216
+ const onRejected = requestInterceptorChain[i2++];
41217
+ try {
41218
+ newConfig = onFulfilled(newConfig);
41219
+ } catch (error) {
41220
+ onRejected.call(this, error);
41221
+ break;
41222
+ }
41223
+ }
41224
+ try {
41225
+ promise2 = dispatchRequest.call(this, newConfig);
41226
+ } catch (error) {
41227
+ return Promise.reject(error);
41228
+ }
41229
+ i2 = 0;
41230
+ len = responseInterceptorChain.length;
41231
+ while (i2 < len) {
41232
+ promise2 = promise2.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
41233
+ }
41234
+ return promise2;
41235
+ }
41236
+ getUri(config2) {
41237
+ config2 = mergeConfig(this.defaults, config2);
41238
+ const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
41239
+ return buildURL(fullPath, config2.params, config2.paramsSerializer);
41240
+ }
41241
+ }
41242
+ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
41243
+ Axios.prototype[method] = function(url2, config2) {
41244
+ return this.request(mergeConfig(config2 || {}, {
41245
+ method,
41246
+ url: url2,
41247
+ data: (config2 || {}).data
41248
+ }));
41249
+ };
41250
+ });
41251
+ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
41252
+ function generateHTTPMethod(isForm) {
41253
+ return function httpMethod(url2, data, config2) {
41254
+ return this.request(mergeConfig(config2 || {}, {
41255
+ method,
41256
+ headers: isForm ? {
41257
+ "Content-Type": "multipart/form-data"
41258
+ } : {},
41259
+ url: url2,
41260
+ data
41261
+ }));
41262
+ };
41263
+ }
41264
+ Axios.prototype[method] = generateHTTPMethod();
41265
+ Axios.prototype[method + "Form"] = generateHTTPMethod(true);
41266
+ });
41267
+ var Axios$1 = Axios;
41268
+
41269
+ class CancelToken {
41270
+ constructor(executor) {
41271
+ if (typeof executor !== "function") {
41272
+ throw new TypeError("executor must be a function.");
41273
+ }
41274
+ let resolvePromise;
41275
+ this.promise = new Promise(function promiseExecutor(resolve) {
41276
+ resolvePromise = resolve;
41277
+ });
41278
+ const token = this;
41279
+ this.promise.then((cancel) => {
41280
+ if (!token._listeners)
41281
+ return;
41282
+ let i2 = token._listeners.length;
41283
+ while (i2-- > 0) {
41284
+ token._listeners[i2](cancel);
41285
+ }
41286
+ token._listeners = null;
41287
+ });
41288
+ this.promise.then = (onfulfilled) => {
41289
+ let _resolve;
41290
+ const promise2 = new Promise((resolve) => {
41291
+ token.subscribe(resolve);
41292
+ _resolve = resolve;
41293
+ }).then(onfulfilled);
41294
+ promise2.cancel = function reject() {
41295
+ token.unsubscribe(_resolve);
41296
+ };
41297
+ return promise2;
41298
+ };
41299
+ executor(function cancel(message2, config2, request) {
41300
+ if (token.reason) {
41301
+ return;
41302
+ }
41303
+ token.reason = new CanceledError(message2, config2, request);
41304
+ resolvePromise(token.reason);
41305
+ });
41306
+ }
41307
+ throwIfRequested() {
41308
+ if (this.reason) {
41309
+ throw this.reason;
41310
+ }
41311
+ }
41312
+ subscribe(listener) {
41313
+ if (this.reason) {
41314
+ listener(this.reason);
41315
+ return;
41316
+ }
41317
+ if (this._listeners) {
41318
+ this._listeners.push(listener);
41319
+ } else {
41320
+ this._listeners = [listener];
41321
+ }
41322
+ }
41323
+ unsubscribe(listener) {
41324
+ if (!this._listeners) {
41325
+ return;
41326
+ }
41327
+ const index = this._listeners.indexOf(listener);
41328
+ if (index !== -1) {
41329
+ this._listeners.splice(index, 1);
41330
+ }
41331
+ }
41332
+ toAbortSignal() {
41333
+ const controller = new AbortController;
41334
+ const abort = (err) => {
41335
+ controller.abort(err);
41336
+ };
41337
+ this.subscribe(abort);
41338
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
41339
+ return controller.signal;
41340
+ }
41341
+ static source() {
41342
+ let cancel;
41343
+ const token = new CancelToken(function executor(c) {
41344
+ cancel = c;
41345
+ });
41346
+ return {
41347
+ token,
41348
+ cancel
41349
+ };
41350
+ }
41351
+ }
41352
+ var CancelToken$1 = CancelToken;
41353
+ function spread(callback) {
41354
+ return function wrap(arr) {
41355
+ return callback.apply(null, arr);
41356
+ };
41357
+ }
41358
+ function isAxiosError(payload) {
41359
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
41360
+ }
41361
+ var HttpStatusCode = {
41362
+ Continue: 100,
41363
+ SwitchingProtocols: 101,
41364
+ Processing: 102,
41365
+ EarlyHints: 103,
41366
+ Ok: 200,
41367
+ Created: 201,
41368
+ Accepted: 202,
41369
+ NonAuthoritativeInformation: 203,
41370
+ NoContent: 204,
41371
+ ResetContent: 205,
41372
+ PartialContent: 206,
41373
+ MultiStatus: 207,
41374
+ AlreadyReported: 208,
41375
+ ImUsed: 226,
41376
+ MultipleChoices: 300,
41377
+ MovedPermanently: 301,
41378
+ Found: 302,
41379
+ SeeOther: 303,
41380
+ NotModified: 304,
41381
+ UseProxy: 305,
41382
+ Unused: 306,
41383
+ TemporaryRedirect: 307,
41384
+ PermanentRedirect: 308,
41385
+ BadRequest: 400,
41386
+ Unauthorized: 401,
41387
+ PaymentRequired: 402,
41388
+ Forbidden: 403,
41389
+ NotFound: 404,
41390
+ MethodNotAllowed: 405,
41391
+ NotAcceptable: 406,
41392
+ ProxyAuthenticationRequired: 407,
41393
+ RequestTimeout: 408,
41394
+ Conflict: 409,
41395
+ Gone: 410,
41396
+ LengthRequired: 411,
41397
+ PreconditionFailed: 412,
41398
+ PayloadTooLarge: 413,
41399
+ UriTooLong: 414,
41400
+ UnsupportedMediaType: 415,
41401
+ RangeNotSatisfiable: 416,
41402
+ ExpectationFailed: 417,
41403
+ ImATeapot: 418,
41404
+ MisdirectedRequest: 421,
41405
+ UnprocessableEntity: 422,
41406
+ Locked: 423,
41407
+ FailedDependency: 424,
41408
+ TooEarly: 425,
41409
+ UpgradeRequired: 426,
41410
+ PreconditionRequired: 428,
41411
+ TooManyRequests: 429,
41412
+ RequestHeaderFieldsTooLarge: 431,
41413
+ UnavailableForLegalReasons: 451,
41414
+ InternalServerError: 500,
41415
+ NotImplemented: 501,
41416
+ BadGateway: 502,
41417
+ ServiceUnavailable: 503,
41418
+ GatewayTimeout: 504,
41419
+ HttpVersionNotSupported: 505,
41420
+ VariantAlsoNegotiates: 506,
41421
+ InsufficientStorage: 507,
41422
+ LoopDetected: 508,
41423
+ NotExtended: 510,
41424
+ NetworkAuthenticationRequired: 511
41425
+ };
41426
+ Object.entries(HttpStatusCode).forEach(([key, value2]) => {
41427
+ HttpStatusCode[value2] = key;
41428
+ });
41429
+ var HttpStatusCode$1 = HttpStatusCode;
41430
+ function createInstance(defaultConfig) {
41431
+ const context3 = new Axios$1(defaultConfig);
41432
+ const instance = bind(Axios$1.prototype.request, context3);
41433
+ utils$1.extend(instance, Axios$1.prototype, context3, { allOwnKeys: true });
41434
+ utils$1.extend(instance, context3, null, { allOwnKeys: true });
41435
+ instance.create = function create(instanceConfig) {
41436
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
41437
+ };
41438
+ return instance;
41439
+ }
41440
+ var axios = createInstance(defaults$1);
41441
+ axios.Axios = Axios$1;
41442
+ axios.CanceledError = CanceledError;
41443
+ axios.CancelToken = CancelToken$1;
41444
+ axios.isCancel = isCancel;
41445
+ axios.VERSION = VERSION3;
41446
+ axios.toFormData = toFormData;
41447
+ axios.AxiosError = AxiosError;
41448
+ axios.Cancel = axios.CanceledError;
41449
+ axios.all = function all(promises) {
41450
+ return Promise.all(promises);
41451
+ };
41452
+ axios.spread = spread;
41453
+ axios.isAxiosError = isAxiosError;
41454
+ axios.mergeConfig = mergeConfig;
41455
+ axios.AxiosHeaders = AxiosHeaders$1;
41456
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
41457
+ axios.getAdapter = adapters.getAdapter;
41458
+ axios.HttpStatusCode = HttpStatusCode$1;
41459
+ axios.default = axios;
41460
+ module.exports = axios;
41461
+ });
41462
+
38469
41463
  // node_modules/bybit-api/lib/util/requestUtils.js
38470
41464
  var require_requestUtils2 = __commonJS((exports) => {
38471
41465
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -38780,7 +41774,7 @@ var require_BaseRestClient2 = __commonJS((exports) => {
38780
41774
  return mod && mod.__esModule ? mod : { default: mod };
38781
41775
  };
38782
41776
  Object.defineProperty(exports, "__esModule", { value: true });
38783
- var axios_1 = __importDefault(require_axios());
41777
+ var axios_1 = __importDefault(require_axios2());
38784
41778
  var https_1 = __importDefault(__require("https"));
38785
41779
  var requestUtils_1 = require_requestUtils2();
38786
41780
  var webCryptoAPI_1 = require_webCryptoAPI();
@@ -58469,8 +61463,8 @@ class AppDatabase {
58469
61463
  let default_params = as_view ? {
58470
61464
  table: "positions_view",
58471
61465
  params: {
58472
- filter: `symbol:lower="${symbol.toLowerCase()}" && account:lower="${account.owner.toLowerCase()} ${account.exchange.toLowerCase()}"`,
58473
- expand: "config, account_strategy, p_account, proxy"
61466
+ filter: `symbol:lower="${symbol.toLowerCase()}" && p_account.owner:lower="${account.owner.toLowerCase()}" && p_account.exchange:lower="${account.exchange.toLowerCase()}"`,
61467
+ expand: "b_config, account_strategy, p_account, proxy"
58474
61468
  }
58475
61469
  } : {
58476
61470
  table: "positions",
@@ -65387,6 +68381,14 @@ class ExchangePosition {
65387
68381
  });
65388
68382
  return risk_reward;
65389
68383
  }
68384
+ get appConfig() {
68385
+ console.log(this.instance.expand);
68386
+ return constructAppConfig({
68387
+ account: this.instance,
68388
+ global_config: this.symbol_config,
68389
+ kelly_config: {}
68390
+ });
68391
+ }
65390
68392
  }
65391
68393
 
65392
68394
  // src/exchange-account.ts
@@ -65397,6 +68399,7 @@ class ExchangeAccount {
65397
68399
  app_db;
65398
68400
  long_position;
65399
68401
  short_position;
68402
+ raw_positions;
65400
68403
  constructor(payload, options) {
65401
68404
  this.instance = payload;
65402
68405
  this.exchange = options.exchange;
@@ -65469,6 +68472,7 @@ class ExchangeAccount {
65469
68472
  without_view: raw_positions.find((x) => x.kind === "short")
65470
68473
  });
65471
68474
  await this.short_position.initialize();
68475
+ this.raw_positions = positions;
65472
68476
  return payload.kind === "long" ? this.long_position : this.short_position;
65473
68477
  }
65474
68478
  async getActiveAccount(payload) {
@@ -66860,7 +69864,7 @@ class ExchangeAccount {
66860
69864
  symbol,
66861
69865
  kind: kind === "long" ? "short" : "long"
66862
69866
  });
66863
- if (reversePosition.getInstance().quantity > 0) {
69867
+ if (focusPosition.getInstance().quantity > 0) {
66864
69868
  const opposite_config = focusPosition.getOppositeConfig({
66865
69869
  ratio: reward_factor
66866
69870
  });
@@ -67217,7 +70221,7 @@ class App {
67217
70221
  return new Set(positions.map((p) => p.symbol));
67218
70222
  }
67219
70223
  async refreshAllPositionsWithSymbol(payload) {
67220
- const { symbol } = payload;
70224
+ const { symbol, callback } = payload;
67221
70225
  const positions = await this.app_db.getPositions({
67222
70226
  custom_filter: `symbol:lower="${symbol.toLowerCase()}"`,
67223
70227
  symbol: "",
@@ -67237,22 +70241,25 @@ class App {
67237
70241
  }
67238
70242
  const unique_exchanges = Object.values(all_exchanges);
67239
70243
  for (const exchange of unique_exchanges) {
67240
- const exchange_account = await this.getExchangeAccount({
67241
- owner: exchange.owner,
67242
- exchange: exchange.exchange
67243
- });
67244
- if (exchange.exchange === "bybit" && symbol === "BTCUSDC") {
67245
- continue;
70244
+ if (callback) {
70245
+ await callback({
70246
+ symbol,
70247
+ account: exchange
70248
+ });
70249
+ } else {
70250
+ const exchange_account = await this.getExchangeAccount({
70251
+ owner: exchange.owner,
70252
+ exchange: exchange.exchange
70253
+ });
70254
+ if (exchange.exchange === "bybit" && symbol === "BTCUSDC") {
70255
+ continue;
70256
+ }
70257
+ await exchange_account.getFocusPosition({
70258
+ symbol,
70259
+ kind: "long",
70260
+ update: true
70261
+ });
67246
70262
  }
67247
- await exchange_account.placeProfitAndStop({
67248
- symbol,
67249
- trigger: true,
67250
- refresh: true
67251
- });
67252
- await exchange_account.syncAccount({
67253
- symbol,
67254
- update: true
67255
- });
67256
70263
  }
67257
70264
  }
67258
70265
  async autoFollowPositions() {
@@ -67273,25 +70280,34 @@ class App {
67273
70280
  async getMoverExchangeInstances() {
67274
70281
  return await this.app_db.getMoverExchangeInstances();
67275
70282
  }
67276
- async updateTpOnAllMarkets() {
70283
+ async updateTpOnAllMarkets(callback) {
67277
70284
  const move_instances = await this.app_db.getAccountWithActivePositions();
67278
70285
  for (const instance of move_instances) {
67279
- const params = {
67280
- account: {
67281
- owner: instance.owner,
67282
- exchange: instance.exchange
67283
- }
67284
- };
67285
- const exchange_account = await this.getExchangeAccount(params.account);
67286
- const symbols = await exchange_account.getSymbolsForPositions();
67287
- for (const symbol of symbols) {
67288
- await exchange_account.placeTrade({
67289
- symbol,
67290
- kind: "long",
67291
- tp: true,
67292
- limit: false
70286
+ if (callback) {
70287
+ await callback({
70288
+ account: {
70289
+ owner: instance.owner,
70290
+ exchange: instance.exchange
70291
+ }
67293
70292
  });
67294
- await new Promise((resolve) => setTimeout(resolve, 500));
70293
+ } else {
70294
+ const params = {
70295
+ account: {
70296
+ owner: instance.owner,
70297
+ exchange: instance.exchange
70298
+ }
70299
+ };
70300
+ const exchange_account = await this.getExchangeAccount(params.account);
70301
+ const symbols = await exchange_account.getSymbolsForPositions();
70302
+ for (const symbol of symbols) {
70303
+ await exchange_account.placeTrade({
70304
+ symbol,
70305
+ kind: "long",
70306
+ tp: true,
70307
+ limit: false
70308
+ });
70309
+ await new Promise((resolve) => setTimeout(resolve, 500));
70310
+ }
67295
70311
  }
67296
70312
  }
67297
70313
  }