@gbozee/ultimate 0.0.2-11 → 0.0.2-13

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.
package/dist/index.js CHANGED
@@ -16,6 +16,15 @@ var __toESM = (mod, isNodeMode, target) => {
16
16
  return to;
17
17
  };
18
18
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, {
22
+ get: all[name],
23
+ enumerable: true,
24
+ configurable: true,
25
+ set: (newValue) => all[name] = () => newValue
26
+ });
27
+ };
19
28
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
20
29
 
21
30
  // node_modules/smart-buffer/build/utils.js
@@ -27500,9 +27509,9 @@ var require_BaseRestClient2 = __commonJS((exports) => {
27500
27509
  return this.signRequest(params || {}, method, signMethod);
27501
27510
  });
27502
27511
  }
27503
- buildRequest(method, url, params, isPublicApi) {
27512
+ buildRequest(method, url2, params, isPublicApi) {
27504
27513
  return __awaiter(this, undefined, undefined, function* () {
27505
- const options = Object.assign(Object.assign({}, this.globalRequestOptions), { url, method });
27514
+ const options = Object.assign(Object.assign({}, this.globalRequestOptions), { url: url2, method });
27506
27515
  for (const key in params) {
27507
27516
  if (typeof params[key] === "undefined") {
27508
27517
  delete params[key];
@@ -29550,8 +29559,8 @@ var require_BaseWSClient = __commonJS((exports) => {
29550
29559
  if (!this.wsStore.getConnectionInProgressPromise(wsKey)) {
29551
29560
  this.wsStore.createConnectionInProgressPromise(wsKey, false);
29552
29561
  }
29553
- const url = yield this.getWsUrl(wsKey);
29554
- const ws = this.connectToWsUrl(url, wsKey);
29562
+ const url2 = yield this.getWsUrl(wsKey);
29563
+ const ws = this.connectToWsUrl(url2, wsKey);
29555
29564
  this.wsStore.setWs(wsKey, ws);
29556
29565
  return (_a = this.wsStore.getConnectionInProgressPromise(wsKey)) === null || _a === undefined ? undefined : _a.promise;
29557
29566
  } catch (err) {
@@ -29560,11 +29569,11 @@ var require_BaseWSClient = __commonJS((exports) => {
29560
29569
  }
29561
29570
  });
29562
29571
  }
29563
- connectToWsUrl(url, wsKey) {
29572
+ connectToWsUrl(url2, wsKey) {
29564
29573
  var _a;
29565
- this.logger.trace(`Opening WS connection to URL: ${url}`, Object.assign(Object.assign({}, websockets_1.WS_LOGGER_CATEGORY), { wsKey }));
29574
+ this.logger.trace(`Opening WS connection to URL: ${url2}`, Object.assign(Object.assign({}, websockets_1.WS_LOGGER_CATEGORY), { wsKey }));
29566
29575
  const agent = (_a = this.options.requestOptions) === null || _a === undefined ? undefined : _a.agent;
29567
- const ws = new isomorphic_ws_1.default(url, undefined, agent ? { agent } : undefined);
29576
+ const ws = new isomorphic_ws_1.default(url2, undefined, agent ? { agent } : undefined);
29568
29577
  ws.onopen = (event) => this.onWsOpen(event, wsKey);
29569
29578
  ws.onmessage = (event) => this.onWsMessage(event, wsKey, ws);
29570
29579
  ws.onerror = (event) => this.parseWsError("Websocket onWsError", event, wsKey);
@@ -31918,8 +31927,8 @@ class AppDatabase {
31918
31927
  }
31919
31928
  async createOrUpdatePositionConfig(db_position, payload) {
31920
31929
  let config = null;
31921
- if (db_position) {
31922
- await this.pb.collection("scheduled_trades").update(db_position, {
31930
+ if (db_position.config) {
31931
+ await this.pb.collection("scheduled_trades").update(db_position.config, {
31923
31932
  entry: payload.entry,
31924
31933
  stop: payload.stop,
31925
31934
  risk_reward: payload.risk_reward,
@@ -31935,7 +31944,8 @@ class AppDatabase {
31935
31944
  stop: payload.stop,
31936
31945
  risk_reward: payload.risk_reward,
31937
31946
  risk: payload.risk,
31938
- profit_percent: payload.profit_percent
31947
+ profit_percent: payload.profit_percent,
31948
+ place_tp: true
31939
31949
  });
31940
31950
  await this.pb.collection("positions").update(db_position.id, {
31941
31951
  config: config?.id
@@ -31977,6 +31987,10 @@ class AppDatabase {
31977
31987
  }
31978
31988
  return result;
31979
31989
  }
31990
+ async getBullishMarket(symbol) {
31991
+ const result = await this.pb.collection("bullish_markets").getFullList();
31992
+ return result.filter((m) => m.symbol === symbol)[0];
31993
+ }
31980
31994
  async getBullishMarkets(options) {
31981
31995
  if (!options) {
31982
31996
  return {
@@ -33159,6 +33173,3108 @@ function createGapPairs(arr, gap, item) {
33159
33173
  return result;
33160
33174
  }
33161
33175
 
33176
+ // node_modules/axios/lib/helpers/bind.js
33177
+ function bind(fn, thisArg) {
33178
+ return function wrap() {
33179
+ return fn.apply(thisArg, arguments);
33180
+ };
33181
+ }
33182
+
33183
+ // node_modules/axios/lib/utils.js
33184
+ var { toString } = Object.prototype;
33185
+ var { getPrototypeOf } = Object;
33186
+ var kindOf = ((cache) => (thing) => {
33187
+ const str = toString.call(thing);
33188
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
33189
+ })(Object.create(null));
33190
+ var kindOfTest = (type) => {
33191
+ type = type.toLowerCase();
33192
+ return (thing) => kindOf(thing) === type;
33193
+ };
33194
+ var typeOfTest = (type) => (thing) => typeof thing === type;
33195
+ var { isArray } = Array;
33196
+ var isUndefined = typeOfTest("undefined");
33197
+ function isBuffer(val) {
33198
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
33199
+ }
33200
+ var isArrayBuffer = kindOfTest("ArrayBuffer");
33201
+ function isArrayBufferView(val) {
33202
+ let result;
33203
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
33204
+ result = ArrayBuffer.isView(val);
33205
+ } else {
33206
+ result = val && val.buffer && isArrayBuffer(val.buffer);
33207
+ }
33208
+ return result;
33209
+ }
33210
+ var isString = typeOfTest("string");
33211
+ var isFunction = typeOfTest("function");
33212
+ var isNumber = typeOfTest("number");
33213
+ var isObject = (thing) => thing !== null && typeof thing === "object";
33214
+ var isBoolean = (thing) => thing === true || thing === false;
33215
+ var isPlainObject = (val) => {
33216
+ if (kindOf(val) !== "object") {
33217
+ return false;
33218
+ }
33219
+ const prototype = getPrototypeOf(val);
33220
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
33221
+ };
33222
+ var isDate = kindOfTest("Date");
33223
+ var isFile2 = kindOfTest("File");
33224
+ var isBlob = kindOfTest("Blob");
33225
+ var isFileList = kindOfTest("FileList");
33226
+ var isStream = (val) => isObject(val) && isFunction(val.pipe);
33227
+ var isFormData2 = (thing) => {
33228
+ let kind;
33229
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
33230
+ };
33231
+ var isURLSearchParams = kindOfTest("URLSearchParams");
33232
+ var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
33233
+ var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
33234
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
33235
+ if (obj === null || typeof obj === "undefined") {
33236
+ return;
33237
+ }
33238
+ let i2;
33239
+ let l;
33240
+ if (typeof obj !== "object") {
33241
+ obj = [obj];
33242
+ }
33243
+ if (isArray(obj)) {
33244
+ for (i2 = 0, l = obj.length;i2 < l; i2++) {
33245
+ fn.call(null, obj[i2], i2, obj);
33246
+ }
33247
+ } else {
33248
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
33249
+ const len = keys.length;
33250
+ let key;
33251
+ for (i2 = 0;i2 < len; i2++) {
33252
+ key = keys[i2];
33253
+ fn.call(null, obj[key], key, obj);
33254
+ }
33255
+ }
33256
+ }
33257
+ function findKey(obj, key) {
33258
+ key = key.toLowerCase();
33259
+ const keys = Object.keys(obj);
33260
+ let i2 = keys.length;
33261
+ let _key;
33262
+ while (i2-- > 0) {
33263
+ _key = keys[i2];
33264
+ if (key === _key.toLowerCase()) {
33265
+ return _key;
33266
+ }
33267
+ }
33268
+ return null;
33269
+ }
33270
+ var _global = (() => {
33271
+ if (typeof globalThis !== "undefined")
33272
+ return globalThis;
33273
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
33274
+ })();
33275
+ var isContextDefined = (context) => !isUndefined(context) && context !== _global;
33276
+ function merge() {
33277
+ const { caseless } = isContextDefined(this) && this || {};
33278
+ const result = {};
33279
+ const assignValue = (val, key) => {
33280
+ const targetKey = caseless && findKey(result, key) || key;
33281
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
33282
+ result[targetKey] = merge(result[targetKey], val);
33283
+ } else if (isPlainObject(val)) {
33284
+ result[targetKey] = merge({}, val);
33285
+ } else if (isArray(val)) {
33286
+ result[targetKey] = val.slice();
33287
+ } else {
33288
+ result[targetKey] = val;
33289
+ }
33290
+ };
33291
+ for (let i2 = 0, l = arguments.length;i2 < l; i2++) {
33292
+ arguments[i2] && forEach(arguments[i2], assignValue);
33293
+ }
33294
+ return result;
33295
+ }
33296
+ var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
33297
+ forEach(b, (val, key) => {
33298
+ if (thisArg && isFunction(val)) {
33299
+ a[key] = bind(val, thisArg);
33300
+ } else {
33301
+ a[key] = val;
33302
+ }
33303
+ }, { allOwnKeys });
33304
+ return a;
33305
+ };
33306
+ var stripBOM = (content) => {
33307
+ if (content.charCodeAt(0) === 65279) {
33308
+ content = content.slice(1);
33309
+ }
33310
+ return content;
33311
+ };
33312
+ var inherits = (constructor, superConstructor, props, descriptors) => {
33313
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
33314
+ constructor.prototype.constructor = constructor;
33315
+ Object.defineProperty(constructor, "super", {
33316
+ value: superConstructor.prototype
33317
+ });
33318
+ props && Object.assign(constructor.prototype, props);
33319
+ };
33320
+ var toFlatObject = (sourceObj, destObj, filter, propFilter) => {
33321
+ let props;
33322
+ let i2;
33323
+ let prop;
33324
+ const merged = {};
33325
+ destObj = destObj || {};
33326
+ if (sourceObj == null)
33327
+ return destObj;
33328
+ do {
33329
+ props = Object.getOwnPropertyNames(sourceObj);
33330
+ i2 = props.length;
33331
+ while (i2-- > 0) {
33332
+ prop = props[i2];
33333
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
33334
+ destObj[prop] = sourceObj[prop];
33335
+ merged[prop] = true;
33336
+ }
33337
+ }
33338
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
33339
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
33340
+ return destObj;
33341
+ };
33342
+ var endsWith = (str, searchString, position2) => {
33343
+ str = String(str);
33344
+ if (position2 === undefined || position2 > str.length) {
33345
+ position2 = str.length;
33346
+ }
33347
+ position2 -= searchString.length;
33348
+ const lastIndex = str.indexOf(searchString, position2);
33349
+ return lastIndex !== -1 && lastIndex === position2;
33350
+ };
33351
+ var toArray = (thing) => {
33352
+ if (!thing)
33353
+ return null;
33354
+ if (isArray(thing))
33355
+ return thing;
33356
+ let i2 = thing.length;
33357
+ if (!isNumber(i2))
33358
+ return null;
33359
+ const arr = new Array(i2);
33360
+ while (i2-- > 0) {
33361
+ arr[i2] = thing[i2];
33362
+ }
33363
+ return arr;
33364
+ };
33365
+ var isTypedArray = ((TypedArray) => {
33366
+ return (thing) => {
33367
+ return TypedArray && thing instanceof TypedArray;
33368
+ };
33369
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
33370
+ var forEachEntry = (obj, fn) => {
33371
+ const generator = obj && obj[Symbol.iterator];
33372
+ const iterator = generator.call(obj);
33373
+ let result;
33374
+ while ((result = iterator.next()) && !result.done) {
33375
+ const pair = result.value;
33376
+ fn.call(obj, pair[0], pair[1]);
33377
+ }
33378
+ };
33379
+ var matchAll = (regExp, str) => {
33380
+ let matches;
33381
+ const arr = [];
33382
+ while ((matches = regExp.exec(str)) !== null) {
33383
+ arr.push(matches);
33384
+ }
33385
+ return arr;
33386
+ };
33387
+ var isHTMLForm = kindOfTest("HTMLFormElement");
33388
+ var toCamelCase = (str) => {
33389
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
33390
+ return p1.toUpperCase() + p2;
33391
+ });
33392
+ };
33393
+ var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
33394
+ var isRegExp = kindOfTest("RegExp");
33395
+ var reduceDescriptors = (obj, reducer) => {
33396
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
33397
+ const reducedDescriptors = {};
33398
+ forEach(descriptors, (descriptor, name) => {
33399
+ let ret;
33400
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
33401
+ reducedDescriptors[name] = ret || descriptor;
33402
+ }
33403
+ });
33404
+ Object.defineProperties(obj, reducedDescriptors);
33405
+ };
33406
+ var freezeMethods = (obj) => {
33407
+ reduceDescriptors(obj, (descriptor, name) => {
33408
+ if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
33409
+ return false;
33410
+ }
33411
+ const value2 = obj[name];
33412
+ if (!isFunction(value2))
33413
+ return;
33414
+ descriptor.enumerable = false;
33415
+ if ("writable" in descriptor) {
33416
+ descriptor.writable = false;
33417
+ return;
33418
+ }
33419
+ if (!descriptor.set) {
33420
+ descriptor.set = () => {
33421
+ throw Error("Can not rewrite read-only method '" + name + "'");
33422
+ };
33423
+ }
33424
+ });
33425
+ };
33426
+ var toObjectSet = (arrayOrString, delimiter) => {
33427
+ const obj = {};
33428
+ const define2 = (arr) => {
33429
+ arr.forEach((value2) => {
33430
+ obj[value2] = true;
33431
+ });
33432
+ };
33433
+ isArray(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
33434
+ return obj;
33435
+ };
33436
+ var noop = () => {
33437
+ };
33438
+ var toFiniteNumber = (value2, defaultValue) => {
33439
+ return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue;
33440
+ };
33441
+ function isSpecCompliantForm(thing) {
33442
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
33443
+ }
33444
+ var toJSONObject = (obj) => {
33445
+ const stack = new Array(10);
33446
+ const visit = (source, i2) => {
33447
+ if (isObject(source)) {
33448
+ if (stack.indexOf(source) >= 0) {
33449
+ return;
33450
+ }
33451
+ if (!("toJSON" in source)) {
33452
+ stack[i2] = source;
33453
+ const target = isArray(source) ? [] : {};
33454
+ forEach(source, (value2, key) => {
33455
+ const reducedValue = visit(value2, i2 + 1);
33456
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
33457
+ });
33458
+ stack[i2] = undefined;
33459
+ return target;
33460
+ }
33461
+ }
33462
+ return source;
33463
+ };
33464
+ return visit(obj, 0);
33465
+ };
33466
+ var isAsyncFn = kindOfTest("AsyncFunction");
33467
+ var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
33468
+ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
33469
+ if (setImmediateSupported) {
33470
+ return setImmediate;
33471
+ }
33472
+ return postMessageSupported ? ((token, callbacks) => {
33473
+ _global.addEventListener("message", ({ source, data }) => {
33474
+ if (source === _global && data === token) {
33475
+ callbacks.length && callbacks.shift()();
33476
+ }
33477
+ }, false);
33478
+ return (cb) => {
33479
+ callbacks.push(cb);
33480
+ _global.postMessage(token, "*");
33481
+ };
33482
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
33483
+ })(typeof setImmediate === "function", isFunction(_global.postMessage));
33484
+ var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
33485
+ var utils_default = {
33486
+ isArray,
33487
+ isArrayBuffer,
33488
+ isBuffer,
33489
+ isFormData: isFormData2,
33490
+ isArrayBufferView,
33491
+ isString,
33492
+ isNumber,
33493
+ isBoolean,
33494
+ isObject,
33495
+ isPlainObject,
33496
+ isReadableStream,
33497
+ isRequest,
33498
+ isResponse,
33499
+ isHeaders,
33500
+ isUndefined,
33501
+ isDate,
33502
+ isFile: isFile2,
33503
+ isBlob,
33504
+ isRegExp,
33505
+ isFunction,
33506
+ isStream,
33507
+ isURLSearchParams,
33508
+ isTypedArray,
33509
+ isFileList,
33510
+ forEach,
33511
+ merge,
33512
+ extend,
33513
+ trim,
33514
+ stripBOM,
33515
+ inherits,
33516
+ toFlatObject,
33517
+ kindOf,
33518
+ kindOfTest,
33519
+ endsWith,
33520
+ toArray,
33521
+ forEachEntry,
33522
+ matchAll,
33523
+ isHTMLForm,
33524
+ hasOwnProperty,
33525
+ hasOwnProp: hasOwnProperty,
33526
+ reduceDescriptors,
33527
+ freezeMethods,
33528
+ toObjectSet,
33529
+ toCamelCase,
33530
+ noop,
33531
+ toFiniteNumber,
33532
+ findKey,
33533
+ global: _global,
33534
+ isContextDefined,
33535
+ isSpecCompliantForm,
33536
+ toJSONObject,
33537
+ isAsyncFn,
33538
+ isThenable,
33539
+ setImmediate: _setImmediate,
33540
+ asap
33541
+ };
33542
+
33543
+ // node_modules/axios/lib/core/AxiosError.js
33544
+ function AxiosError(message, code, config, request, response) {
33545
+ Error.call(this);
33546
+ if (Error.captureStackTrace) {
33547
+ Error.captureStackTrace(this, this.constructor);
33548
+ } else {
33549
+ this.stack = new Error().stack;
33550
+ }
33551
+ this.message = message;
33552
+ this.name = "AxiosError";
33553
+ code && (this.code = code);
33554
+ config && (this.config = config);
33555
+ request && (this.request = request);
33556
+ if (response) {
33557
+ this.response = response;
33558
+ this.status = response.status ? response.status : null;
33559
+ }
33560
+ }
33561
+ utils_default.inherits(AxiosError, Error, {
33562
+ toJSON: function toJSON() {
33563
+ return {
33564
+ message: this.message,
33565
+ name: this.name,
33566
+ description: this.description,
33567
+ number: this.number,
33568
+ fileName: this.fileName,
33569
+ lineNumber: this.lineNumber,
33570
+ columnNumber: this.columnNumber,
33571
+ stack: this.stack,
33572
+ config: utils_default.toJSONObject(this.config),
33573
+ code: this.code,
33574
+ status: this.status
33575
+ };
33576
+ }
33577
+ });
33578
+ var prototype = AxiosError.prototype;
33579
+ var descriptors = {};
33580
+ [
33581
+ "ERR_BAD_OPTION_VALUE",
33582
+ "ERR_BAD_OPTION",
33583
+ "ECONNABORTED",
33584
+ "ETIMEDOUT",
33585
+ "ERR_NETWORK",
33586
+ "ERR_FR_TOO_MANY_REDIRECTS",
33587
+ "ERR_DEPRECATED",
33588
+ "ERR_BAD_RESPONSE",
33589
+ "ERR_BAD_REQUEST",
33590
+ "ERR_CANCELED",
33591
+ "ERR_NOT_SUPPORT",
33592
+ "ERR_INVALID_URL"
33593
+ ].forEach((code) => {
33594
+ descriptors[code] = { value: code };
33595
+ });
33596
+ Object.defineProperties(AxiosError, descriptors);
33597
+ Object.defineProperty(prototype, "isAxiosError", { value: true });
33598
+ AxiosError.from = (error, code, config, request, response, customProps) => {
33599
+ const axiosError = Object.create(prototype);
33600
+ utils_default.toFlatObject(error, axiosError, function filter(obj) {
33601
+ return obj !== Error.prototype;
33602
+ }, (prop) => {
33603
+ return prop !== "isAxiosError";
33604
+ });
33605
+ AxiosError.call(axiosError, error.message, code, config, request, response);
33606
+ axiosError.cause = error;
33607
+ axiosError.name = error.name;
33608
+ customProps && Object.assign(axiosError, customProps);
33609
+ return axiosError;
33610
+ };
33611
+ var AxiosError_default = AxiosError;
33612
+
33613
+ // node_modules/axios/lib/platform/node/classes/FormData.js
33614
+ var import_form_data = __toESM(require_form_data(), 1);
33615
+ var FormData_default = import_form_data.default;
33616
+
33617
+ // node_modules/axios/lib/helpers/toFormData.js
33618
+ function isVisitable(thing) {
33619
+ return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
33620
+ }
33621
+ function removeBrackets(key) {
33622
+ return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
33623
+ }
33624
+ function renderKey(path, key, dots) {
33625
+ if (!path)
33626
+ return key;
33627
+ return path.concat(key).map(function each(token, i2) {
33628
+ token = removeBrackets(token);
33629
+ return !dots && i2 ? "[" + token + "]" : token;
33630
+ }).join(dots ? "." : "");
33631
+ }
33632
+ function isFlatArray(arr) {
33633
+ return utils_default.isArray(arr) && !arr.some(isVisitable);
33634
+ }
33635
+ var predicates = utils_default.toFlatObject(utils_default, {}, null, function filter(prop) {
33636
+ return /^is[A-Z]/.test(prop);
33637
+ });
33638
+ function toFormData(obj, formData, options) {
33639
+ if (!utils_default.isObject(obj)) {
33640
+ throw new TypeError("target must be an object");
33641
+ }
33642
+ formData = formData || new (FormData_default || FormData);
33643
+ options = utils_default.toFlatObject(options, {
33644
+ metaTokens: true,
33645
+ dots: false,
33646
+ indexes: false
33647
+ }, false, function defined(option, source) {
33648
+ return !utils_default.isUndefined(source[option]);
33649
+ });
33650
+ const metaTokens = options.metaTokens;
33651
+ const visitor = options.visitor || defaultVisitor;
33652
+ const dots = options.dots;
33653
+ const indexes = options.indexes;
33654
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
33655
+ const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
33656
+ if (!utils_default.isFunction(visitor)) {
33657
+ throw new TypeError("visitor must be a function");
33658
+ }
33659
+ function convertValue(value2) {
33660
+ if (value2 === null)
33661
+ return "";
33662
+ if (utils_default.isDate(value2)) {
33663
+ return value2.toISOString();
33664
+ }
33665
+ if (!useBlob && utils_default.isBlob(value2)) {
33666
+ throw new AxiosError_default("Blob is not supported. Use a Buffer instead.");
33667
+ }
33668
+ if (utils_default.isArrayBuffer(value2) || utils_default.isTypedArray(value2)) {
33669
+ return useBlob && typeof Blob === "function" ? new Blob([value2]) : Buffer.from(value2);
33670
+ }
33671
+ return value2;
33672
+ }
33673
+ function defaultVisitor(value2, key, path) {
33674
+ let arr = value2;
33675
+ if (value2 && !path && typeof value2 === "object") {
33676
+ if (utils_default.endsWith(key, "{}")) {
33677
+ key = metaTokens ? key : key.slice(0, -2);
33678
+ value2 = JSON.stringify(value2);
33679
+ } else if (utils_default.isArray(value2) && isFlatArray(value2) || (utils_default.isFileList(value2) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value2))) {
33680
+ key = removeBrackets(key);
33681
+ arr.forEach(function each(el, index) {
33682
+ !(utils_default.isUndefined(el) || el === null) && formData.append(indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]", convertValue(el));
33683
+ });
33684
+ return false;
33685
+ }
33686
+ }
33687
+ if (isVisitable(value2)) {
33688
+ return true;
33689
+ }
33690
+ formData.append(renderKey(path, key, dots), convertValue(value2));
33691
+ return false;
33692
+ }
33693
+ const stack = [];
33694
+ const exposedHelpers = Object.assign(predicates, {
33695
+ defaultVisitor,
33696
+ convertValue,
33697
+ isVisitable
33698
+ });
33699
+ function build(value2, path) {
33700
+ if (utils_default.isUndefined(value2))
33701
+ return;
33702
+ if (stack.indexOf(value2) !== -1) {
33703
+ throw Error("Circular reference detected in " + path.join("."));
33704
+ }
33705
+ stack.push(value2);
33706
+ utils_default.forEach(value2, function each(el, key) {
33707
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path, exposedHelpers);
33708
+ if (result === true) {
33709
+ build(el, path ? path.concat(key) : [key]);
33710
+ }
33711
+ });
33712
+ stack.pop();
33713
+ }
33714
+ if (!utils_default.isObject(obj)) {
33715
+ throw new TypeError("data must be an object");
33716
+ }
33717
+ build(obj);
33718
+ return formData;
33719
+ }
33720
+ var toFormData_default = toFormData;
33721
+
33722
+ // node_modules/axios/lib/helpers/AxiosURLSearchParams.js
33723
+ function encode(str) {
33724
+ const charMap = {
33725
+ "!": "%21",
33726
+ "'": "%27",
33727
+ "(": "%28",
33728
+ ")": "%29",
33729
+ "~": "%7E",
33730
+ "%20": "+",
33731
+ "%00": "\x00"
33732
+ };
33733
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
33734
+ return charMap[match];
33735
+ });
33736
+ }
33737
+ function AxiosURLSearchParams(params, options) {
33738
+ this._pairs = [];
33739
+ params && toFormData_default(params, this, options);
33740
+ }
33741
+ var prototype2 = AxiosURLSearchParams.prototype;
33742
+ prototype2.append = function append(name, value2) {
33743
+ this._pairs.push([name, value2]);
33744
+ };
33745
+ prototype2.toString = function toString2(encoder) {
33746
+ const _encode = encoder ? function(value2) {
33747
+ return encoder.call(this, value2, encode);
33748
+ } : encode;
33749
+ return this._pairs.map(function each(pair) {
33750
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
33751
+ }, "").join("&");
33752
+ };
33753
+ var AxiosURLSearchParams_default = AxiosURLSearchParams;
33754
+
33755
+ // node_modules/axios/lib/helpers/buildURL.js
33756
+ function encode2(val) {
33757
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
33758
+ }
33759
+ function buildURL(url, params, options) {
33760
+ if (!params) {
33761
+ return url;
33762
+ }
33763
+ const _encode = options && options.encode || encode2;
33764
+ if (utils_default.isFunction(options)) {
33765
+ options = {
33766
+ serialize: options
33767
+ };
33768
+ }
33769
+ const serializeFn = options && options.serialize;
33770
+ let serializedParams;
33771
+ if (serializeFn) {
33772
+ serializedParams = serializeFn(params, options);
33773
+ } else {
33774
+ serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, options).toString(_encode);
33775
+ }
33776
+ if (serializedParams) {
33777
+ const hashmarkIndex = url.indexOf("#");
33778
+ if (hashmarkIndex !== -1) {
33779
+ url = url.slice(0, hashmarkIndex);
33780
+ }
33781
+ url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
33782
+ }
33783
+ return url;
33784
+ }
33785
+
33786
+ // node_modules/axios/lib/core/InterceptorManager.js
33787
+ class InterceptorManager {
33788
+ constructor() {
33789
+ this.handlers = [];
33790
+ }
33791
+ use(fulfilled, rejected, options) {
33792
+ this.handlers.push({
33793
+ fulfilled,
33794
+ rejected,
33795
+ synchronous: options ? options.synchronous : false,
33796
+ runWhen: options ? options.runWhen : null
33797
+ });
33798
+ return this.handlers.length - 1;
33799
+ }
33800
+ eject(id) {
33801
+ if (this.handlers[id]) {
33802
+ this.handlers[id] = null;
33803
+ }
33804
+ }
33805
+ clear() {
33806
+ if (this.handlers) {
33807
+ this.handlers = [];
33808
+ }
33809
+ }
33810
+ forEach(fn) {
33811
+ utils_default.forEach(this.handlers, function forEachHandler(h) {
33812
+ if (h !== null) {
33813
+ fn(h);
33814
+ }
33815
+ });
33816
+ }
33817
+ }
33818
+ var InterceptorManager_default = InterceptorManager;
33819
+
33820
+ // node_modules/axios/lib/defaults/transitional.js
33821
+ var transitional_default = {
33822
+ silentJSONParsing: true,
33823
+ forcedJSONParsing: true,
33824
+ clarifyTimeoutError: false
33825
+ };
33826
+
33827
+ // node_modules/axios/lib/platform/node/index.js
33828
+ import crypto from "crypto";
33829
+
33830
+ // node_modules/axios/lib/platform/node/classes/URLSearchParams.js
33831
+ import url from "url";
33832
+ var URLSearchParams_default = url.URLSearchParams;
33833
+
33834
+ // node_modules/axios/lib/platform/node/index.js
33835
+ var ALPHA = "abcdefghijklmnopqrstuvwxyz";
33836
+ var DIGIT = "0123456789";
33837
+ var ALPHABET = {
33838
+ DIGIT,
33839
+ ALPHA,
33840
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
33841
+ };
33842
+ var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
33843
+ let str = "";
33844
+ const { length } = alphabet;
33845
+ const randomValues = new Uint32Array(size);
33846
+ crypto.randomFillSync(randomValues);
33847
+ for (let i2 = 0;i2 < size; i2++) {
33848
+ str += alphabet[randomValues[i2] % length];
33849
+ }
33850
+ return str;
33851
+ };
33852
+ var node_default = {
33853
+ isNode: true,
33854
+ classes: {
33855
+ URLSearchParams: URLSearchParams_default,
33856
+ FormData: FormData_default,
33857
+ Blob: typeof Blob !== "undefined" && Blob || null
33858
+ },
33859
+ ALPHABET,
33860
+ generateString,
33861
+ protocols: ["http", "https", "file", "data"]
33862
+ };
33863
+
33864
+ // node_modules/axios/lib/platform/common/utils.js
33865
+ var exports_utils = {};
33866
+ __export(exports_utils, {
33867
+ origin: () => origin,
33868
+ navigator: () => _navigator,
33869
+ hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv,
33870
+ hasStandardBrowserEnv: () => hasStandardBrowserEnv,
33871
+ hasBrowserEnv: () => hasBrowserEnv
33872
+ });
33873
+ var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
33874
+ var _navigator = typeof navigator === "object" && navigator || undefined;
33875
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
33876
+ var hasStandardBrowserWebWorkerEnv = (() => {
33877
+ return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
33878
+ })();
33879
+ var origin = hasBrowserEnv && window.location.href || "http://localhost";
33880
+
33881
+ // node_modules/axios/lib/platform/index.js
33882
+ var platform_default = {
33883
+ ...exports_utils,
33884
+ ...node_default
33885
+ };
33886
+
33887
+ // node_modules/axios/lib/helpers/toURLEncodedForm.js
33888
+ function toURLEncodedForm(data, options) {
33889
+ return toFormData_default(data, new platform_default.classes.URLSearchParams, Object.assign({
33890
+ visitor: function(value2, key, path, helpers) {
33891
+ if (platform_default.isNode && utils_default.isBuffer(value2)) {
33892
+ this.append(key, value2.toString("base64"));
33893
+ return false;
33894
+ }
33895
+ return helpers.defaultVisitor.apply(this, arguments);
33896
+ }
33897
+ }, options));
33898
+ }
33899
+
33900
+ // node_modules/axios/lib/helpers/formDataToJSON.js
33901
+ function parsePropPath(name) {
33902
+ return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
33903
+ return match[0] === "[]" ? "" : match[1] || match[0];
33904
+ });
33905
+ }
33906
+ function arrayToObject(arr) {
33907
+ const obj = {};
33908
+ const keys = Object.keys(arr);
33909
+ let i2;
33910
+ const len = keys.length;
33911
+ let key;
33912
+ for (i2 = 0;i2 < len; i2++) {
33913
+ key = keys[i2];
33914
+ obj[key] = arr[key];
33915
+ }
33916
+ return obj;
33917
+ }
33918
+ function formDataToJSON(formData) {
33919
+ function buildPath(path, value2, target, index) {
33920
+ let name = path[index++];
33921
+ if (name === "__proto__")
33922
+ return true;
33923
+ const isNumericKey = Number.isFinite(+name);
33924
+ const isLast = index >= path.length;
33925
+ name = !name && utils_default.isArray(target) ? target.length : name;
33926
+ if (isLast) {
33927
+ if (utils_default.hasOwnProp(target, name)) {
33928
+ target[name] = [target[name], value2];
33929
+ } else {
33930
+ target[name] = value2;
33931
+ }
33932
+ return !isNumericKey;
33933
+ }
33934
+ if (!target[name] || !utils_default.isObject(target[name])) {
33935
+ target[name] = [];
33936
+ }
33937
+ const result = buildPath(path, value2, target[name], index);
33938
+ if (result && utils_default.isArray(target[name])) {
33939
+ target[name] = arrayToObject(target[name]);
33940
+ }
33941
+ return !isNumericKey;
33942
+ }
33943
+ if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) {
33944
+ const obj = {};
33945
+ utils_default.forEachEntry(formData, (name, value2) => {
33946
+ buildPath(parsePropPath(name), value2, obj, 0);
33947
+ });
33948
+ return obj;
33949
+ }
33950
+ return null;
33951
+ }
33952
+ var formDataToJSON_default = formDataToJSON;
33953
+
33954
+ // node_modules/axios/lib/defaults/index.js
33955
+ function stringifySafely(rawValue, parser, encoder) {
33956
+ if (utils_default.isString(rawValue)) {
33957
+ try {
33958
+ (parser || JSON.parse)(rawValue);
33959
+ return utils_default.trim(rawValue);
33960
+ } catch (e2) {
33961
+ if (e2.name !== "SyntaxError") {
33962
+ throw e2;
33963
+ }
33964
+ }
33965
+ }
33966
+ return (encoder || JSON.stringify)(rawValue);
33967
+ }
33968
+ var defaults = {
33969
+ transitional: transitional_default,
33970
+ adapter: ["xhr", "http", "fetch"],
33971
+ transformRequest: [function transformRequest(data, headers) {
33972
+ const contentType = headers.getContentType() || "";
33973
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
33974
+ const isObjectPayload = utils_default.isObject(data);
33975
+ if (isObjectPayload && utils_default.isHTMLForm(data)) {
33976
+ data = new FormData(data);
33977
+ }
33978
+ const isFormData3 = utils_default.isFormData(data);
33979
+ if (isFormData3) {
33980
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
33981
+ }
33982
+ if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
33983
+ return data;
33984
+ }
33985
+ if (utils_default.isArrayBufferView(data)) {
33986
+ return data.buffer;
33987
+ }
33988
+ if (utils_default.isURLSearchParams(data)) {
33989
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
33990
+ return data.toString();
33991
+ }
33992
+ let isFileList2;
33993
+ if (isObjectPayload) {
33994
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
33995
+ return toURLEncodedForm(data, this.formSerializer).toString();
33996
+ }
33997
+ if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
33998
+ const _FormData = this.env && this.env.FormData;
33999
+ return toFormData_default(isFileList2 ? { "files[]": data } : data, _FormData && new _FormData, this.formSerializer);
34000
+ }
34001
+ }
34002
+ if (isObjectPayload || hasJSONContentType) {
34003
+ headers.setContentType("application/json", false);
34004
+ return stringifySafely(data);
34005
+ }
34006
+ return data;
34007
+ }],
34008
+ transformResponse: [function transformResponse(data) {
34009
+ const transitional = this.transitional || defaults.transitional;
34010
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
34011
+ const JSONRequested = this.responseType === "json";
34012
+ if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
34013
+ return data;
34014
+ }
34015
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
34016
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
34017
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
34018
+ try {
34019
+ return JSON.parse(data);
34020
+ } catch (e2) {
34021
+ if (strictJSONParsing) {
34022
+ if (e2.name === "SyntaxError") {
34023
+ throw AxiosError_default.from(e2, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
34024
+ }
34025
+ throw e2;
34026
+ }
34027
+ }
34028
+ }
34029
+ return data;
34030
+ }],
34031
+ timeout: 0,
34032
+ xsrfCookieName: "XSRF-TOKEN",
34033
+ xsrfHeaderName: "X-XSRF-TOKEN",
34034
+ maxContentLength: -1,
34035
+ maxBodyLength: -1,
34036
+ env: {
34037
+ FormData: platform_default.classes.FormData,
34038
+ Blob: platform_default.classes.Blob
34039
+ },
34040
+ validateStatus: function validateStatus(status) {
34041
+ return status >= 200 && status < 300;
34042
+ },
34043
+ headers: {
34044
+ common: {
34045
+ Accept: "application/json, text/plain, */*",
34046
+ "Content-Type": undefined
34047
+ }
34048
+ }
34049
+ };
34050
+ utils_default.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
34051
+ defaults.headers[method] = {};
34052
+ });
34053
+ var defaults_default = defaults;
34054
+
34055
+ // node_modules/axios/lib/helpers/parseHeaders.js
34056
+ var ignoreDuplicateOf = utils_default.toObjectSet([
34057
+ "age",
34058
+ "authorization",
34059
+ "content-length",
34060
+ "content-type",
34061
+ "etag",
34062
+ "expires",
34063
+ "from",
34064
+ "host",
34065
+ "if-modified-since",
34066
+ "if-unmodified-since",
34067
+ "last-modified",
34068
+ "location",
34069
+ "max-forwards",
34070
+ "proxy-authorization",
34071
+ "referer",
34072
+ "retry-after",
34073
+ "user-agent"
34074
+ ]);
34075
+ var parseHeaders_default = (rawHeaders) => {
34076
+ const parsed = {};
34077
+ let key;
34078
+ let val;
34079
+ let i2;
34080
+ rawHeaders && rawHeaders.split(`
34081
+ `).forEach(function parser(line) {
34082
+ i2 = line.indexOf(":");
34083
+ key = line.substring(0, i2).trim().toLowerCase();
34084
+ val = line.substring(i2 + 1).trim();
34085
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
34086
+ return;
34087
+ }
34088
+ if (key === "set-cookie") {
34089
+ if (parsed[key]) {
34090
+ parsed[key].push(val);
34091
+ } else {
34092
+ parsed[key] = [val];
34093
+ }
34094
+ } else {
34095
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
34096
+ }
34097
+ });
34098
+ return parsed;
34099
+ };
34100
+
34101
+ // node_modules/axios/lib/core/AxiosHeaders.js
34102
+ var $internals = Symbol("internals");
34103
+ function normalizeHeader(header) {
34104
+ return header && String(header).trim().toLowerCase();
34105
+ }
34106
+ function normalizeValue(value2) {
34107
+ if (value2 === false || value2 == null) {
34108
+ return value2;
34109
+ }
34110
+ return utils_default.isArray(value2) ? value2.map(normalizeValue) : String(value2);
34111
+ }
34112
+ function parseTokens(str) {
34113
+ const tokens = Object.create(null);
34114
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
34115
+ let match;
34116
+ while (match = tokensRE.exec(str)) {
34117
+ tokens[match[1]] = match[2];
34118
+ }
34119
+ return tokens;
34120
+ }
34121
+ var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
34122
+ function matchHeaderValue(context, value2, header, filter2, isHeaderNameFilter) {
34123
+ if (utils_default.isFunction(filter2)) {
34124
+ return filter2.call(this, value2, header);
34125
+ }
34126
+ if (isHeaderNameFilter) {
34127
+ value2 = header;
34128
+ }
34129
+ if (!utils_default.isString(value2))
34130
+ return;
34131
+ if (utils_default.isString(filter2)) {
34132
+ return value2.indexOf(filter2) !== -1;
34133
+ }
34134
+ if (utils_default.isRegExp(filter2)) {
34135
+ return filter2.test(value2);
34136
+ }
34137
+ }
34138
+ function formatHeader(header) {
34139
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
34140
+ return char.toUpperCase() + str;
34141
+ });
34142
+ }
34143
+ function buildAccessors(obj, header) {
34144
+ const accessorName = utils_default.toCamelCase(" " + header);
34145
+ ["get", "set", "has"].forEach((methodName) => {
34146
+ Object.defineProperty(obj, methodName + accessorName, {
34147
+ value: function(arg1, arg2, arg3) {
34148
+ return this[methodName].call(this, header, arg1, arg2, arg3);
34149
+ },
34150
+ configurable: true
34151
+ });
34152
+ });
34153
+ }
34154
+
34155
+ class AxiosHeaders {
34156
+ constructor(headers) {
34157
+ headers && this.set(headers);
34158
+ }
34159
+ set(header, valueOrRewrite, rewrite) {
34160
+ const self2 = this;
34161
+ function setHeader(_value, _header, _rewrite) {
34162
+ const lHeader = normalizeHeader(_header);
34163
+ if (!lHeader) {
34164
+ throw new Error("header name must be a non-empty string");
34165
+ }
34166
+ const key = utils_default.findKey(self2, lHeader);
34167
+ if (!key || self2[key] === undefined || _rewrite === true || _rewrite === undefined && self2[key] !== false) {
34168
+ self2[key || _header] = normalizeValue(_value);
34169
+ }
34170
+ }
34171
+ const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
34172
+ if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
34173
+ setHeaders(header, valueOrRewrite);
34174
+ } else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34175
+ setHeaders(parseHeaders_default(header), valueOrRewrite);
34176
+ } else if (utils_default.isHeaders(header)) {
34177
+ for (const [key, value2] of header.entries()) {
34178
+ setHeader(value2, key, rewrite);
34179
+ }
34180
+ } else {
34181
+ header != null && setHeader(valueOrRewrite, header, rewrite);
34182
+ }
34183
+ return this;
34184
+ }
34185
+ get(header, parser) {
34186
+ header = normalizeHeader(header);
34187
+ if (header) {
34188
+ const key = utils_default.findKey(this, header);
34189
+ if (key) {
34190
+ const value2 = this[key];
34191
+ if (!parser) {
34192
+ return value2;
34193
+ }
34194
+ if (parser === true) {
34195
+ return parseTokens(value2);
34196
+ }
34197
+ if (utils_default.isFunction(parser)) {
34198
+ return parser.call(this, value2, key);
34199
+ }
34200
+ if (utils_default.isRegExp(parser)) {
34201
+ return parser.exec(value2);
34202
+ }
34203
+ throw new TypeError("parser must be boolean|regexp|function");
34204
+ }
34205
+ }
34206
+ }
34207
+ has(header, matcher) {
34208
+ header = normalizeHeader(header);
34209
+ if (header) {
34210
+ const key = utils_default.findKey(this, header);
34211
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
34212
+ }
34213
+ return false;
34214
+ }
34215
+ delete(header, matcher) {
34216
+ const self2 = this;
34217
+ let deleted = false;
34218
+ function deleteHeader(_header) {
34219
+ _header = normalizeHeader(_header);
34220
+ if (_header) {
34221
+ const key = utils_default.findKey(self2, _header);
34222
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
34223
+ delete self2[key];
34224
+ deleted = true;
34225
+ }
34226
+ }
34227
+ }
34228
+ if (utils_default.isArray(header)) {
34229
+ header.forEach(deleteHeader);
34230
+ } else {
34231
+ deleteHeader(header);
34232
+ }
34233
+ return deleted;
34234
+ }
34235
+ clear(matcher) {
34236
+ const keys = Object.keys(this);
34237
+ let i2 = keys.length;
34238
+ let deleted = false;
34239
+ while (i2--) {
34240
+ const key = keys[i2];
34241
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34242
+ delete this[key];
34243
+ deleted = true;
34244
+ }
34245
+ }
34246
+ return deleted;
34247
+ }
34248
+ normalize(format) {
34249
+ const self2 = this;
34250
+ const headers = {};
34251
+ utils_default.forEach(this, (value2, header) => {
34252
+ const key = utils_default.findKey(headers, header);
34253
+ if (key) {
34254
+ self2[key] = normalizeValue(value2);
34255
+ delete self2[header];
34256
+ return;
34257
+ }
34258
+ const normalized = format ? formatHeader(header) : String(header).trim();
34259
+ if (normalized !== header) {
34260
+ delete self2[header];
34261
+ }
34262
+ self2[normalized] = normalizeValue(value2);
34263
+ headers[normalized] = true;
34264
+ });
34265
+ return this;
34266
+ }
34267
+ concat(...targets) {
34268
+ return this.constructor.concat(this, ...targets);
34269
+ }
34270
+ toJSON(asStrings) {
34271
+ const obj = Object.create(null);
34272
+ utils_default.forEach(this, (value2, header) => {
34273
+ value2 != null && value2 !== false && (obj[header] = asStrings && utils_default.isArray(value2) ? value2.join(", ") : value2);
34274
+ });
34275
+ return obj;
34276
+ }
34277
+ [Symbol.iterator]() {
34278
+ return Object.entries(this.toJSON())[Symbol.iterator]();
34279
+ }
34280
+ toString() {
34281
+ return Object.entries(this.toJSON()).map(([header, value2]) => header + ": " + value2).join(`
34282
+ `);
34283
+ }
34284
+ get [Symbol.toStringTag]() {
34285
+ return "AxiosHeaders";
34286
+ }
34287
+ static from(thing) {
34288
+ return thing instanceof this ? thing : new this(thing);
34289
+ }
34290
+ static concat(first, ...targets) {
34291
+ const computed = new this(first);
34292
+ targets.forEach((target) => computed.set(target));
34293
+ return computed;
34294
+ }
34295
+ static accessor(header) {
34296
+ const internals = this[$internals] = this[$internals] = {
34297
+ accessors: {}
34298
+ };
34299
+ const accessors = internals.accessors;
34300
+ const prototype3 = this.prototype;
34301
+ function defineAccessor(_header) {
34302
+ const lHeader = normalizeHeader(_header);
34303
+ if (!accessors[lHeader]) {
34304
+ buildAccessors(prototype3, _header);
34305
+ accessors[lHeader] = true;
34306
+ }
34307
+ }
34308
+ utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
34309
+ return this;
34310
+ }
34311
+ }
34312
+ AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
34313
+ utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value: value2 }, key) => {
34314
+ let mapped = key[0].toUpperCase() + key.slice(1);
34315
+ return {
34316
+ get: () => value2,
34317
+ set(headerValue) {
34318
+ this[mapped] = headerValue;
34319
+ }
34320
+ };
34321
+ });
34322
+ utils_default.freezeMethods(AxiosHeaders);
34323
+ var AxiosHeaders_default = AxiosHeaders;
34324
+
34325
+ // node_modules/axios/lib/core/transformData.js
34326
+ function transformData(fns, response) {
34327
+ const config = this || defaults_default;
34328
+ const context = response || config;
34329
+ const headers = AxiosHeaders_default.from(context.headers);
34330
+ let data = context.data;
34331
+ utils_default.forEach(fns, function transform(fn) {
34332
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
34333
+ });
34334
+ headers.normalize();
34335
+ return data;
34336
+ }
34337
+
34338
+ // node_modules/axios/lib/cancel/isCancel.js
34339
+ function isCancel(value2) {
34340
+ return !!(value2 && value2.__CANCEL__);
34341
+ }
34342
+
34343
+ // node_modules/axios/lib/cancel/CanceledError.js
34344
+ function CanceledError(message, config, request) {
34345
+ AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
34346
+ this.name = "CanceledError";
34347
+ }
34348
+ utils_default.inherits(CanceledError, AxiosError_default, {
34349
+ __CANCEL__: true
34350
+ });
34351
+ var CanceledError_default = CanceledError;
34352
+
34353
+ // node_modules/axios/lib/core/settle.js
34354
+ function settle(resolve, reject, response) {
34355
+ const validateStatus2 = response.config.validateStatus;
34356
+ if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
34357
+ resolve(response);
34358
+ } else {
34359
+ reject(new AxiosError_default("Request failed with status code " + response.status, [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
34360
+ }
34361
+ }
34362
+
34363
+ // node_modules/axios/lib/helpers/isAbsoluteURL.js
34364
+ function isAbsoluteURL(url2) {
34365
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
34366
+ }
34367
+
34368
+ // node_modules/axios/lib/helpers/combineURLs.js
34369
+ function combineURLs(baseURL, relativeURL) {
34370
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
34371
+ }
34372
+
34373
+ // node_modules/axios/lib/core/buildFullPath.js
34374
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
34375
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
34376
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
34377
+ return combineURLs(baseURL, requestedURL);
34378
+ }
34379
+ return requestedURL;
34380
+ }
34381
+
34382
+ // node_modules/axios/lib/adapters/http.js
34383
+ var import_proxy_from_env = __toESM(require_proxy_from_env(), 1);
34384
+ var import_follow_redirects = __toESM(require_follow_redirects(), 1);
34385
+ import http from "http";
34386
+ import https from "https";
34387
+ import util2 from "util";
34388
+ import zlib from "zlib";
34389
+
34390
+ // node_modules/axios/lib/env/data.js
34391
+ var VERSION = "1.8.4";
34392
+
34393
+ // node_modules/axios/lib/helpers/parseProtocol.js
34394
+ function parseProtocol(url2) {
34395
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
34396
+ return match && match[1] || "";
34397
+ }
34398
+
34399
+ // node_modules/axios/lib/helpers/fromDataURI.js
34400
+ var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
34401
+ function fromDataURI(uri, asBlob, options) {
34402
+ const _Blob = options && options.Blob || platform_default.classes.Blob;
34403
+ const protocol = parseProtocol(uri);
34404
+ if (asBlob === undefined && _Blob) {
34405
+ asBlob = true;
34406
+ }
34407
+ if (protocol === "data") {
34408
+ uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
34409
+ const match = DATA_URL_PATTERN.exec(uri);
34410
+ if (!match) {
34411
+ throw new AxiosError_default("Invalid URL", AxiosError_default.ERR_INVALID_URL);
34412
+ }
34413
+ const mime = match[1];
34414
+ const isBase64 = match[2];
34415
+ const body = match[3];
34416
+ const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
34417
+ if (asBlob) {
34418
+ if (!_Blob) {
34419
+ throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
34420
+ }
34421
+ return new _Blob([buffer], { type: mime });
34422
+ }
34423
+ return buffer;
34424
+ }
34425
+ throw new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_NOT_SUPPORT);
34426
+ }
34427
+
34428
+ // node_modules/axios/lib/adapters/http.js
34429
+ import stream3 from "stream";
34430
+
34431
+ // node_modules/axios/lib/helpers/AxiosTransformStream.js
34432
+ import stream from "stream";
34433
+ var kInternals = Symbol("internals");
34434
+
34435
+ class AxiosTransformStream extends stream.Transform {
34436
+ constructor(options) {
34437
+ options = utils_default.toFlatObject(options, {
34438
+ maxRate: 0,
34439
+ chunkSize: 64 * 1024,
34440
+ minChunkSize: 100,
34441
+ timeWindow: 500,
34442
+ ticksRate: 2,
34443
+ samplesCount: 15
34444
+ }, null, (prop, source) => {
34445
+ return !utils_default.isUndefined(source[prop]);
34446
+ });
34447
+ super({
34448
+ readableHighWaterMark: options.chunkSize
34449
+ });
34450
+ const internals = this[kInternals] = {
34451
+ timeWindow: options.timeWindow,
34452
+ chunkSize: options.chunkSize,
34453
+ maxRate: options.maxRate,
34454
+ minChunkSize: options.minChunkSize,
34455
+ bytesSeen: 0,
34456
+ isCaptured: false,
34457
+ notifiedBytesLoaded: 0,
34458
+ ts: Date.now(),
34459
+ bytes: 0,
34460
+ onReadCallback: null
34461
+ };
34462
+ this.on("newListener", (event) => {
34463
+ if (event === "progress") {
34464
+ if (!internals.isCaptured) {
34465
+ internals.isCaptured = true;
34466
+ }
34467
+ }
34468
+ });
34469
+ }
34470
+ _read(size) {
34471
+ const internals = this[kInternals];
34472
+ if (internals.onReadCallback) {
34473
+ internals.onReadCallback();
34474
+ }
34475
+ return super._read(size);
34476
+ }
34477
+ _transform(chunk, encoding, callback) {
34478
+ const internals = this[kInternals];
34479
+ const maxRate = internals.maxRate;
34480
+ const readableHighWaterMark = this.readableHighWaterMark;
34481
+ const timeWindow = internals.timeWindow;
34482
+ const divider = 1000 / timeWindow;
34483
+ const bytesThreshold = maxRate / divider;
34484
+ const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
34485
+ const pushChunk = (_chunk, _callback) => {
34486
+ const bytes = Buffer.byteLength(_chunk);
34487
+ internals.bytesSeen += bytes;
34488
+ internals.bytes += bytes;
34489
+ internals.isCaptured && this.emit("progress", internals.bytesSeen);
34490
+ if (this.push(_chunk)) {
34491
+ process.nextTick(_callback);
34492
+ } else {
34493
+ internals.onReadCallback = () => {
34494
+ internals.onReadCallback = null;
34495
+ process.nextTick(_callback);
34496
+ };
34497
+ }
34498
+ };
34499
+ const transformChunk = (_chunk, _callback) => {
34500
+ const chunkSize = Buffer.byteLength(_chunk);
34501
+ let chunkRemainder = null;
34502
+ let maxChunkSize = readableHighWaterMark;
34503
+ let bytesLeft;
34504
+ let passed = 0;
34505
+ if (maxRate) {
34506
+ const now = Date.now();
34507
+ if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
34508
+ internals.ts = now;
34509
+ bytesLeft = bytesThreshold - internals.bytes;
34510
+ internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
34511
+ passed = 0;
34512
+ }
34513
+ bytesLeft = bytesThreshold - internals.bytes;
34514
+ }
34515
+ if (maxRate) {
34516
+ if (bytesLeft <= 0) {
34517
+ return setTimeout(() => {
34518
+ _callback(null, _chunk);
34519
+ }, timeWindow - passed);
34520
+ }
34521
+ if (bytesLeft < maxChunkSize) {
34522
+ maxChunkSize = bytesLeft;
34523
+ }
34524
+ }
34525
+ if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
34526
+ chunkRemainder = _chunk.subarray(maxChunkSize);
34527
+ _chunk = _chunk.subarray(0, maxChunkSize);
34528
+ }
34529
+ pushChunk(_chunk, chunkRemainder ? () => {
34530
+ process.nextTick(_callback, null, chunkRemainder);
34531
+ } : _callback);
34532
+ };
34533
+ transformChunk(chunk, function transformNextChunk(err, _chunk) {
34534
+ if (err) {
34535
+ return callback(err);
34536
+ }
34537
+ if (_chunk) {
34538
+ transformChunk(_chunk, transformNextChunk);
34539
+ } else {
34540
+ callback(null);
34541
+ }
34542
+ });
34543
+ }
34544
+ }
34545
+ var AxiosTransformStream_default = AxiosTransformStream;
34546
+
34547
+ // node_modules/axios/lib/adapters/http.js
34548
+ import { EventEmitter } from "events";
34549
+
34550
+ // node_modules/axios/lib/helpers/formDataToStream.js
34551
+ import util from "util";
34552
+ import { Readable } from "stream";
34553
+
34554
+ // node_modules/axios/lib/helpers/readBlob.js
34555
+ var { asyncIterator } = Symbol;
34556
+ var readBlob = async function* (blob) {
34557
+ if (blob.stream) {
34558
+ yield* blob.stream();
34559
+ } else if (blob.arrayBuffer) {
34560
+ yield await blob.arrayBuffer();
34561
+ } else if (blob[asyncIterator]) {
34562
+ yield* blob[asyncIterator]();
34563
+ } else {
34564
+ yield blob;
34565
+ }
34566
+ };
34567
+ var readBlob_default = readBlob;
34568
+
34569
+ // node_modules/axios/lib/helpers/formDataToStream.js
34570
+ var BOUNDARY_ALPHABET = platform_default.ALPHABET.ALPHA_DIGIT + "-_";
34571
+ var textEncoder = typeof TextEncoder === "function" ? new TextEncoder : new util.TextEncoder;
34572
+ var CRLF = `\r
34573
+ `;
34574
+ var CRLF_BYTES = textEncoder.encode(CRLF);
34575
+ var CRLF_BYTES_COUNT = 2;
34576
+
34577
+ class FormDataPart {
34578
+ constructor(name, value2) {
34579
+ const { escapeName } = this.constructor;
34580
+ const isStringValue = utils_default.isString(value2);
34581
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value2.name ? `; filename="${escapeName(value2.name)}"` : ""}${CRLF}`;
34582
+ if (isStringValue) {
34583
+ value2 = textEncoder.encode(String(value2).replace(/\r?\n|\r\n?/g, CRLF));
34584
+ } else {
34585
+ headers += `Content-Type: ${value2.type || "application/octet-stream"}${CRLF}`;
34586
+ }
34587
+ this.headers = textEncoder.encode(headers + CRLF);
34588
+ this.contentLength = isStringValue ? value2.byteLength : value2.size;
34589
+ this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
34590
+ this.name = name;
34591
+ this.value = value2;
34592
+ }
34593
+ async* encode() {
34594
+ yield this.headers;
34595
+ const { value: value2 } = this;
34596
+ if (utils_default.isTypedArray(value2)) {
34597
+ yield value2;
34598
+ } else {
34599
+ yield* readBlob_default(value2);
34600
+ }
34601
+ yield CRLF_BYTES;
34602
+ }
34603
+ static escapeName(name) {
34604
+ return String(name).replace(/[\r\n"]/g, (match) => ({
34605
+ "\r": "%0D",
34606
+ "\n": "%0A",
34607
+ '"': "%22"
34608
+ })[match]);
34609
+ }
34610
+ }
34611
+ var formDataToStream = (form, headersHandler, options) => {
34612
+ const {
34613
+ tag = "form-data-boundary",
34614
+ size = 25,
34615
+ boundary = tag + "-" + platform_default.generateString(size, BOUNDARY_ALPHABET)
34616
+ } = options || {};
34617
+ if (!utils_default.isFormData(form)) {
34618
+ throw TypeError("FormData instance required");
34619
+ }
34620
+ if (boundary.length < 1 || boundary.length > 70) {
34621
+ throw Error("boundary must be 10-70 characters long");
34622
+ }
34623
+ const boundaryBytes = textEncoder.encode("--" + boundary + CRLF);
34624
+ const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF + CRLF);
34625
+ let contentLength = footerBytes.byteLength;
34626
+ const parts = Array.from(form.entries()).map(([name, value2]) => {
34627
+ const part = new FormDataPart(name, value2);
34628
+ contentLength += part.size;
34629
+ return part;
34630
+ });
34631
+ contentLength += boundaryBytes.byteLength * parts.length;
34632
+ contentLength = utils_default.toFiniteNumber(contentLength);
34633
+ const computedHeaders = {
34634
+ "Content-Type": `multipart/form-data; boundary=${boundary}`
34635
+ };
34636
+ if (Number.isFinite(contentLength)) {
34637
+ computedHeaders["Content-Length"] = contentLength;
34638
+ }
34639
+ headersHandler && headersHandler(computedHeaders);
34640
+ return Readable.from(async function* () {
34641
+ for (const part of parts) {
34642
+ yield boundaryBytes;
34643
+ yield* part.encode();
34644
+ }
34645
+ yield footerBytes;
34646
+ }());
34647
+ };
34648
+ var formDataToStream_default = formDataToStream;
34649
+
34650
+ // node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js
34651
+ import stream2 from "stream";
34652
+
34653
+ class ZlibHeaderTransformStream extends stream2.Transform {
34654
+ __transform(chunk, encoding, callback) {
34655
+ this.push(chunk);
34656
+ callback();
34657
+ }
34658
+ _transform(chunk, encoding, callback) {
34659
+ if (chunk.length !== 0) {
34660
+ this._transform = this.__transform;
34661
+ if (chunk[0] !== 120) {
34662
+ const header = Buffer.alloc(2);
34663
+ header[0] = 120;
34664
+ header[1] = 156;
34665
+ this.push(header, encoding);
34666
+ }
34667
+ }
34668
+ this.__transform(chunk, encoding, callback);
34669
+ }
34670
+ }
34671
+ var ZlibHeaderTransformStream_default = ZlibHeaderTransformStream;
34672
+
34673
+ // node_modules/axios/lib/helpers/callbackify.js
34674
+ var callbackify = (fn, reducer) => {
34675
+ return utils_default.isAsyncFn(fn) ? function(...args) {
34676
+ const cb = args.pop();
34677
+ fn.apply(this, args).then((value2) => {
34678
+ try {
34679
+ reducer ? cb(null, ...reducer(value2)) : cb(null, value2);
34680
+ } catch (err) {
34681
+ cb(err);
34682
+ }
34683
+ }, cb);
34684
+ } : fn;
34685
+ };
34686
+ var callbackify_default = callbackify;
34687
+
34688
+ // node_modules/axios/lib/helpers/speedometer.js
34689
+ function speedometer(samplesCount, min) {
34690
+ samplesCount = samplesCount || 10;
34691
+ const bytes = new Array(samplesCount);
34692
+ const timestamps = new Array(samplesCount);
34693
+ let head = 0;
34694
+ let tail = 0;
34695
+ let firstSampleTS;
34696
+ min = min !== undefined ? min : 1000;
34697
+ return function push(chunkLength) {
34698
+ const now = Date.now();
34699
+ const startedAt = timestamps[tail];
34700
+ if (!firstSampleTS) {
34701
+ firstSampleTS = now;
34702
+ }
34703
+ bytes[head] = chunkLength;
34704
+ timestamps[head] = now;
34705
+ let i2 = tail;
34706
+ let bytesCount = 0;
34707
+ while (i2 !== head) {
34708
+ bytesCount += bytes[i2++];
34709
+ i2 = i2 % samplesCount;
34710
+ }
34711
+ head = (head + 1) % samplesCount;
34712
+ if (head === tail) {
34713
+ tail = (tail + 1) % samplesCount;
34714
+ }
34715
+ if (now - firstSampleTS < min) {
34716
+ return;
34717
+ }
34718
+ const passed = startedAt && now - startedAt;
34719
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
34720
+ };
34721
+ }
34722
+ var speedometer_default = speedometer;
34723
+
34724
+ // node_modules/axios/lib/helpers/throttle.js
34725
+ function throttle(fn, freq) {
34726
+ let timestamp = 0;
34727
+ let threshold = 1000 / freq;
34728
+ let lastArgs;
34729
+ let timer;
34730
+ const invoke = (args, now = Date.now()) => {
34731
+ timestamp = now;
34732
+ lastArgs = null;
34733
+ if (timer) {
34734
+ clearTimeout(timer);
34735
+ timer = null;
34736
+ }
34737
+ fn.apply(null, args);
34738
+ };
34739
+ const throttled = (...args) => {
34740
+ const now = Date.now();
34741
+ const passed = now - timestamp;
34742
+ if (passed >= threshold) {
34743
+ invoke(args, now);
34744
+ } else {
34745
+ lastArgs = args;
34746
+ if (!timer) {
34747
+ timer = setTimeout(() => {
34748
+ timer = null;
34749
+ invoke(lastArgs);
34750
+ }, threshold - passed);
34751
+ }
34752
+ }
34753
+ };
34754
+ const flush = () => lastArgs && invoke(lastArgs);
34755
+ return [throttled, flush];
34756
+ }
34757
+ var throttle_default = throttle;
34758
+
34759
+ // node_modules/axios/lib/helpers/progressEventReducer.js
34760
+ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
34761
+ let bytesNotified = 0;
34762
+ const _speedometer = speedometer_default(50, 250);
34763
+ return throttle_default((e2) => {
34764
+ const loaded = e2.loaded;
34765
+ const total = e2.lengthComputable ? e2.total : undefined;
34766
+ const progressBytes = loaded - bytesNotified;
34767
+ const rate = _speedometer(progressBytes);
34768
+ const inRange = loaded <= total;
34769
+ bytesNotified = loaded;
34770
+ const data = {
34771
+ loaded,
34772
+ total,
34773
+ progress: total ? loaded / total : undefined,
34774
+ bytes: progressBytes,
34775
+ rate: rate ? rate : undefined,
34776
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
34777
+ event: e2,
34778
+ lengthComputable: total != null,
34779
+ [isDownloadStream ? "download" : "upload"]: true
34780
+ };
34781
+ listener(data);
34782
+ }, freq);
34783
+ };
34784
+ var progressEventDecorator = (total, throttled) => {
34785
+ const lengthComputable = total != null;
34786
+ return [(loaded) => throttled[0]({
34787
+ lengthComputable,
34788
+ total,
34789
+ loaded
34790
+ }), throttled[1]];
34791
+ };
34792
+ var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
34793
+
34794
+ // node_modules/axios/lib/adapters/http.js
34795
+ var zlibOptions = {
34796
+ flush: zlib.constants.Z_SYNC_FLUSH,
34797
+ finishFlush: zlib.constants.Z_SYNC_FLUSH
34798
+ };
34799
+ var brotliOptions = {
34800
+ flush: zlib.constants.BROTLI_OPERATION_FLUSH,
34801
+ finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
34802
+ };
34803
+ var isBrotliSupported = utils_default.isFunction(zlib.createBrotliDecompress);
34804
+ var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
34805
+ var isHttps = /https:?/;
34806
+ var supportedProtocols = platform_default.protocols.map((protocol) => {
34807
+ return protocol + ":";
34808
+ });
34809
+ var flushOnFinish = (stream4, [throttled, flush]) => {
34810
+ stream4.on("end", flush).on("error", flush);
34811
+ return throttled;
34812
+ };
34813
+ function dispatchBeforeRedirect(options, responseDetails) {
34814
+ if (options.beforeRedirects.proxy) {
34815
+ options.beforeRedirects.proxy(options);
34816
+ }
34817
+ if (options.beforeRedirects.config) {
34818
+ options.beforeRedirects.config(options, responseDetails);
34819
+ }
34820
+ }
34821
+ function setProxy(options, configProxy, location) {
34822
+ let proxy = configProxy;
34823
+ if (!proxy && proxy !== false) {
34824
+ const proxyUrl = import_proxy_from_env.default.getProxyForUrl(location);
34825
+ if (proxyUrl) {
34826
+ proxy = new URL(proxyUrl);
34827
+ }
34828
+ }
34829
+ if (proxy) {
34830
+ if (proxy.username) {
34831
+ proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
34832
+ }
34833
+ if (proxy.auth) {
34834
+ if (proxy.auth.username || proxy.auth.password) {
34835
+ proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
34836
+ }
34837
+ const base64 = Buffer.from(proxy.auth, "utf8").toString("base64");
34838
+ options.headers["Proxy-Authorization"] = "Basic " + base64;
34839
+ }
34840
+ options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
34841
+ const proxyHost = proxy.hostname || proxy.host;
34842
+ options.hostname = proxyHost;
34843
+ options.host = proxyHost;
34844
+ options.port = proxy.port;
34845
+ options.path = location;
34846
+ if (proxy.protocol) {
34847
+ options.protocol = proxy.protocol.includes(":") ? proxy.protocol : `${proxy.protocol}:`;
34848
+ }
34849
+ }
34850
+ options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
34851
+ setProxy(redirectOptions, configProxy, redirectOptions.href);
34852
+ };
34853
+ }
34854
+ var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
34855
+ var wrapAsync = (asyncExecutor) => {
34856
+ return new Promise((resolve, reject) => {
34857
+ let onDone;
34858
+ let isDone;
34859
+ const done = (value2, isRejected) => {
34860
+ if (isDone)
34861
+ return;
34862
+ isDone = true;
34863
+ onDone && onDone(value2, isRejected);
34864
+ };
34865
+ const _resolve = (value2) => {
34866
+ done(value2);
34867
+ resolve(value2);
34868
+ };
34869
+ const _reject = (reason) => {
34870
+ done(reason, true);
34871
+ reject(reason);
34872
+ };
34873
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject);
34874
+ });
34875
+ };
34876
+ var resolveFamily = ({ address, family }) => {
34877
+ if (!utils_default.isString(address)) {
34878
+ throw TypeError("address must be a string");
34879
+ }
34880
+ return {
34881
+ address,
34882
+ family: family || (address.indexOf(".") < 0 ? 6 : 4)
34883
+ };
34884
+ };
34885
+ var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
34886
+ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
34887
+ return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
34888
+ let { data, lookup, family } = config;
34889
+ const { responseType, responseEncoding } = config;
34890
+ const method = config.method.toUpperCase();
34891
+ let isDone;
34892
+ let rejected = false;
34893
+ let req;
34894
+ if (lookup) {
34895
+ const _lookup = callbackify_default(lookup, (value2) => utils_default.isArray(value2) ? value2 : [value2]);
34896
+ lookup = (hostname, opt, cb) => {
34897
+ _lookup(hostname, opt, (err, arg0, arg1) => {
34898
+ if (err) {
34899
+ return cb(err);
34900
+ }
34901
+ const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
34902
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
34903
+ });
34904
+ };
34905
+ }
34906
+ const emitter = new EventEmitter;
34907
+ const onFinished = () => {
34908
+ if (config.cancelToken) {
34909
+ config.cancelToken.unsubscribe(abort);
34910
+ }
34911
+ if (config.signal) {
34912
+ config.signal.removeEventListener("abort", abort);
34913
+ }
34914
+ emitter.removeAllListeners();
34915
+ };
34916
+ onDone((value2, isRejected) => {
34917
+ isDone = true;
34918
+ if (isRejected) {
34919
+ rejected = true;
34920
+ onFinished();
34921
+ }
34922
+ });
34923
+ function abort(reason) {
34924
+ emitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config, req) : reason);
34925
+ }
34926
+ emitter.once("abort", reject);
34927
+ if (config.cancelToken || config.signal) {
34928
+ config.cancelToken && config.cancelToken.subscribe(abort);
34929
+ if (config.signal) {
34930
+ config.signal.aborted ? abort() : config.signal.addEventListener("abort", abort);
34931
+ }
34932
+ }
34933
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
34934
+ const parsed = new URL(fullPath, platform_default.hasBrowserEnv ? platform_default.origin : undefined);
34935
+ const protocol = parsed.protocol || supportedProtocols[0];
34936
+ if (protocol === "data:") {
34937
+ let convertedData;
34938
+ if (method !== "GET") {
34939
+ return settle(resolve, reject, {
34940
+ status: 405,
34941
+ statusText: "method not allowed",
34942
+ headers: {},
34943
+ config
34944
+ });
34945
+ }
34946
+ try {
34947
+ convertedData = fromDataURI(config.url, responseType === "blob", {
34948
+ Blob: config.env && config.env.Blob
34949
+ });
34950
+ } catch (err) {
34951
+ throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST, config);
34952
+ }
34953
+ if (responseType === "text") {
34954
+ convertedData = convertedData.toString(responseEncoding);
34955
+ if (!responseEncoding || responseEncoding === "utf8") {
34956
+ convertedData = utils_default.stripBOM(convertedData);
34957
+ }
34958
+ } else if (responseType === "stream") {
34959
+ convertedData = stream3.Readable.from(convertedData);
34960
+ }
34961
+ return settle(resolve, reject, {
34962
+ data: convertedData,
34963
+ status: 200,
34964
+ statusText: "OK",
34965
+ headers: new AxiosHeaders_default,
34966
+ config
34967
+ });
34968
+ }
34969
+ if (supportedProtocols.indexOf(protocol) === -1) {
34970
+ return reject(new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_BAD_REQUEST, config));
34971
+ }
34972
+ const headers = AxiosHeaders_default.from(config.headers).normalize();
34973
+ headers.set("User-Agent", "axios/" + VERSION, false);
34974
+ const { onUploadProgress, onDownloadProgress } = config;
34975
+ const maxRate = config.maxRate;
34976
+ let maxUploadRate = undefined;
34977
+ let maxDownloadRate = undefined;
34978
+ if (utils_default.isSpecCompliantForm(data)) {
34979
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
34980
+ data = formDataToStream_default(data, (formHeaders) => {
34981
+ headers.set(formHeaders);
34982
+ }, {
34983
+ tag: `axios-${VERSION}-boundary`,
34984
+ boundary: userBoundary && userBoundary[1] || undefined
34985
+ });
34986
+ } else if (utils_default.isFormData(data) && utils_default.isFunction(data.getHeaders)) {
34987
+ headers.set(data.getHeaders());
34988
+ if (!headers.hasContentLength()) {
34989
+ try {
34990
+ const knownLength = await util2.promisify(data.getLength).call(data);
34991
+ Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
34992
+ } catch (e2) {
34993
+ }
34994
+ }
34995
+ } else if (utils_default.isBlob(data) || utils_default.isFile(data)) {
34996
+ data.size && headers.setContentType(data.type || "application/octet-stream");
34997
+ headers.setContentLength(data.size || 0);
34998
+ data = stream3.Readable.from(readBlob_default(data));
34999
+ } else if (data && !utils_default.isStream(data)) {
35000
+ if (Buffer.isBuffer(data)) {
35001
+ } else if (utils_default.isArrayBuffer(data)) {
35002
+ data = Buffer.from(new Uint8Array(data));
35003
+ } else if (utils_default.isString(data)) {
35004
+ data = Buffer.from(data, "utf-8");
35005
+ } else {
35006
+ return reject(new AxiosError_default("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream", AxiosError_default.ERR_BAD_REQUEST, config));
35007
+ }
35008
+ headers.setContentLength(data.length, false);
35009
+ if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
35010
+ return reject(new AxiosError_default("Request body larger than maxBodyLength limit", AxiosError_default.ERR_BAD_REQUEST, config));
35011
+ }
35012
+ }
35013
+ const contentLength = utils_default.toFiniteNumber(headers.getContentLength());
35014
+ if (utils_default.isArray(maxRate)) {
35015
+ maxUploadRate = maxRate[0];
35016
+ maxDownloadRate = maxRate[1];
35017
+ } else {
35018
+ maxUploadRate = maxDownloadRate = maxRate;
35019
+ }
35020
+ if (data && (onUploadProgress || maxUploadRate)) {
35021
+ if (!utils_default.isStream(data)) {
35022
+ data = stream3.Readable.from(data, { objectMode: false });
35023
+ }
35024
+ data = stream3.pipeline([data, new AxiosTransformStream_default({
35025
+ maxRate: utils_default.toFiniteNumber(maxUploadRate)
35026
+ })], utils_default.noop);
35027
+ onUploadProgress && data.on("progress", flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
35028
+ }
35029
+ let auth = undefined;
35030
+ if (config.auth) {
35031
+ const username = config.auth.username || "";
35032
+ const password = config.auth.password || "";
35033
+ auth = username + ":" + password;
35034
+ }
35035
+ if (!auth && parsed.username) {
35036
+ const urlUsername = parsed.username;
35037
+ const urlPassword = parsed.password;
35038
+ auth = urlUsername + ":" + urlPassword;
35039
+ }
35040
+ auth && headers.delete("authorization");
35041
+ let path;
35042
+ try {
35043
+ path = buildURL(parsed.pathname + parsed.search, config.params, config.paramsSerializer).replace(/^\?/, "");
35044
+ } catch (err) {
35045
+ const customErr = new Error(err.message);
35046
+ customErr.config = config;
35047
+ customErr.url = config.url;
35048
+ customErr.exists = true;
35049
+ return reject(customErr);
35050
+ }
35051
+ headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
35052
+ const options = {
35053
+ path,
35054
+ method,
35055
+ headers: headers.toJSON(),
35056
+ agents: { http: config.httpAgent, https: config.httpsAgent },
35057
+ auth,
35058
+ protocol,
35059
+ family,
35060
+ beforeRedirect: dispatchBeforeRedirect,
35061
+ beforeRedirects: {}
35062
+ };
35063
+ !utils_default.isUndefined(lookup) && (options.lookup = lookup);
35064
+ if (config.socketPath) {
35065
+ options.socketPath = config.socketPath;
35066
+ } else {
35067
+ options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
35068
+ options.port = parsed.port;
35069
+ setProxy(options, config.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
35070
+ }
35071
+ let transport;
35072
+ const isHttpsRequest = isHttps.test(options.protocol);
35073
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
35074
+ if (config.transport) {
35075
+ transport = config.transport;
35076
+ } else if (config.maxRedirects === 0) {
35077
+ transport = isHttpsRequest ? https : http;
35078
+ } else {
35079
+ if (config.maxRedirects) {
35080
+ options.maxRedirects = config.maxRedirects;
35081
+ }
35082
+ if (config.beforeRedirect) {
35083
+ options.beforeRedirects.config = config.beforeRedirect;
35084
+ }
35085
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
35086
+ }
35087
+ if (config.maxBodyLength > -1) {
35088
+ options.maxBodyLength = config.maxBodyLength;
35089
+ } else {
35090
+ options.maxBodyLength = Infinity;
35091
+ }
35092
+ if (config.insecureHTTPParser) {
35093
+ options.insecureHTTPParser = config.insecureHTTPParser;
35094
+ }
35095
+ req = transport.request(options, function handleResponse(res) {
35096
+ if (req.destroyed)
35097
+ return;
35098
+ const streams = [res];
35099
+ const responseLength = +res.headers["content-length"];
35100
+ if (onDownloadProgress || maxDownloadRate) {
35101
+ const transformStream = new AxiosTransformStream_default({
35102
+ maxRate: utils_default.toFiniteNumber(maxDownloadRate)
35103
+ });
35104
+ onDownloadProgress && transformStream.on("progress", flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress), true, 3))));
35105
+ streams.push(transformStream);
35106
+ }
35107
+ let responseStream = res;
35108
+ const lastRequest = res.req || req;
35109
+ if (config.decompress !== false && res.headers["content-encoding"]) {
35110
+ if (method === "HEAD" || res.statusCode === 204) {
35111
+ delete res.headers["content-encoding"];
35112
+ }
35113
+ switch ((res.headers["content-encoding"] || "").toLowerCase()) {
35114
+ case "gzip":
35115
+ case "x-gzip":
35116
+ case "compress":
35117
+ case "x-compress":
35118
+ streams.push(zlib.createUnzip(zlibOptions));
35119
+ delete res.headers["content-encoding"];
35120
+ break;
35121
+ case "deflate":
35122
+ streams.push(new ZlibHeaderTransformStream_default);
35123
+ streams.push(zlib.createUnzip(zlibOptions));
35124
+ delete res.headers["content-encoding"];
35125
+ break;
35126
+ case "br":
35127
+ if (isBrotliSupported) {
35128
+ streams.push(zlib.createBrotliDecompress(brotliOptions));
35129
+ delete res.headers["content-encoding"];
35130
+ }
35131
+ }
35132
+ }
35133
+ responseStream = streams.length > 1 ? stream3.pipeline(streams, utils_default.noop) : streams[0];
35134
+ const offListeners = stream3.finished(responseStream, () => {
35135
+ offListeners();
35136
+ onFinished();
35137
+ });
35138
+ const response = {
35139
+ status: res.statusCode,
35140
+ statusText: res.statusMessage,
35141
+ headers: new AxiosHeaders_default(res.headers),
35142
+ config,
35143
+ request: lastRequest
35144
+ };
35145
+ if (responseType === "stream") {
35146
+ response.data = responseStream;
35147
+ settle(resolve, reject, response);
35148
+ } else {
35149
+ const responseBuffer = [];
35150
+ let totalResponseBytes = 0;
35151
+ responseStream.on("data", function handleStreamData(chunk) {
35152
+ responseBuffer.push(chunk);
35153
+ totalResponseBytes += chunk.length;
35154
+ if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
35155
+ rejected = true;
35156
+ responseStream.destroy();
35157
+ reject(new AxiosError_default("maxContentLength size of " + config.maxContentLength + " exceeded", AxiosError_default.ERR_BAD_RESPONSE, config, lastRequest));
35158
+ }
35159
+ });
35160
+ responseStream.on("aborted", function handlerStreamAborted() {
35161
+ if (rejected) {
35162
+ return;
35163
+ }
35164
+ const err = new AxiosError_default("stream has been aborted", AxiosError_default.ERR_BAD_RESPONSE, config, lastRequest);
35165
+ responseStream.destroy(err);
35166
+ reject(err);
35167
+ });
35168
+ responseStream.on("error", function handleStreamError(err) {
35169
+ if (req.destroyed)
35170
+ return;
35171
+ reject(AxiosError_default.from(err, null, config, lastRequest));
35172
+ });
35173
+ responseStream.on("end", function handleStreamEnd() {
35174
+ try {
35175
+ let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
35176
+ if (responseType !== "arraybuffer") {
35177
+ responseData = responseData.toString(responseEncoding);
35178
+ if (!responseEncoding || responseEncoding === "utf8") {
35179
+ responseData = utils_default.stripBOM(responseData);
35180
+ }
35181
+ }
35182
+ response.data = responseData;
35183
+ } catch (err) {
35184
+ return reject(AxiosError_default.from(err, null, config, response.request, response));
35185
+ }
35186
+ settle(resolve, reject, response);
35187
+ });
35188
+ }
35189
+ emitter.once("abort", (err) => {
35190
+ if (!responseStream.destroyed) {
35191
+ responseStream.emit("error", err);
35192
+ responseStream.destroy();
35193
+ }
35194
+ });
35195
+ });
35196
+ emitter.once("abort", (err) => {
35197
+ reject(err);
35198
+ req.destroy(err);
35199
+ });
35200
+ req.on("error", function handleRequestError(err) {
35201
+ reject(AxiosError_default.from(err, null, config, req));
35202
+ });
35203
+ req.on("socket", function handleRequestSocket(socket) {
35204
+ socket.setKeepAlive(true, 1000 * 60);
35205
+ });
35206
+ if (config.timeout) {
35207
+ const timeout = parseInt(config.timeout, 10);
35208
+ if (Number.isNaN(timeout)) {
35209
+ reject(new AxiosError_default("error trying to parse `config.timeout` to int", AxiosError_default.ERR_BAD_OPTION_VALUE, config, req));
35210
+ return;
35211
+ }
35212
+ req.setTimeout(timeout, function handleRequestTimeout() {
35213
+ if (isDone)
35214
+ return;
35215
+ let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
35216
+ const transitional = config.transitional || transitional_default;
35217
+ if (config.timeoutErrorMessage) {
35218
+ timeoutErrorMessage = config.timeoutErrorMessage;
35219
+ }
35220
+ reject(new AxiosError_default(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED, config, req));
35221
+ abort();
35222
+ });
35223
+ }
35224
+ if (utils_default.isStream(data)) {
35225
+ let ended = false;
35226
+ let errored = false;
35227
+ data.on("end", () => {
35228
+ ended = true;
35229
+ });
35230
+ data.once("error", (err) => {
35231
+ errored = true;
35232
+ req.destroy(err);
35233
+ });
35234
+ data.on("close", () => {
35235
+ if (!ended && !errored) {
35236
+ abort(new CanceledError_default("Request stream has been aborted", config, req));
35237
+ }
35238
+ });
35239
+ data.pipe(req);
35240
+ } else {
35241
+ req.end(data);
35242
+ }
35243
+ });
35244
+ };
35245
+
35246
+ // node_modules/axios/lib/helpers/isURLSameOrigin.js
35247
+ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? ((origin2, isMSIE) => (url2) => {
35248
+ url2 = new URL(url2, platform_default.origin);
35249
+ return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
35250
+ })(new URL(platform_default.origin), platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)) : () => true;
35251
+
35252
+ // node_modules/axios/lib/helpers/cookies.js
35253
+ var cookies_default = platform_default.hasStandardBrowserEnv ? {
35254
+ write(name, value2, expires, path, domain, secure) {
35255
+ const cookie = [name + "=" + encodeURIComponent(value2)];
35256
+ utils_default.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
35257
+ utils_default.isString(path) && cookie.push("path=" + path);
35258
+ utils_default.isString(domain) && cookie.push("domain=" + domain);
35259
+ secure === true && cookie.push("secure");
35260
+ document.cookie = cookie.join("; ");
35261
+ },
35262
+ read(name) {
35263
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
35264
+ return match ? decodeURIComponent(match[3]) : null;
35265
+ },
35266
+ remove(name) {
35267
+ this.write(name, "", Date.now() - 86400000);
35268
+ }
35269
+ } : {
35270
+ write() {
35271
+ },
35272
+ read() {
35273
+ return null;
35274
+ },
35275
+ remove() {
35276
+ }
35277
+ };
35278
+
35279
+ // node_modules/axios/lib/core/mergeConfig.js
35280
+ var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
35281
+ function mergeConfig(config1, config2) {
35282
+ config2 = config2 || {};
35283
+ const config = {};
35284
+ function getMergedValue(target, source, prop, caseless) {
35285
+ if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
35286
+ return utils_default.merge.call({ caseless }, target, source);
35287
+ } else if (utils_default.isPlainObject(source)) {
35288
+ return utils_default.merge({}, source);
35289
+ } else if (utils_default.isArray(source)) {
35290
+ return source.slice();
35291
+ }
35292
+ return source;
35293
+ }
35294
+ function mergeDeepProperties(a, b, prop, caseless) {
35295
+ if (!utils_default.isUndefined(b)) {
35296
+ return getMergedValue(a, b, prop, caseless);
35297
+ } else if (!utils_default.isUndefined(a)) {
35298
+ return getMergedValue(undefined, a, prop, caseless);
35299
+ }
35300
+ }
35301
+ function valueFromConfig2(a, b) {
35302
+ if (!utils_default.isUndefined(b)) {
35303
+ return getMergedValue(undefined, b);
35304
+ }
35305
+ }
35306
+ function defaultToConfig2(a, b) {
35307
+ if (!utils_default.isUndefined(b)) {
35308
+ return getMergedValue(undefined, b);
35309
+ } else if (!utils_default.isUndefined(a)) {
35310
+ return getMergedValue(undefined, a);
35311
+ }
35312
+ }
35313
+ function mergeDirectKeys(a, b, prop) {
35314
+ if (prop in config2) {
35315
+ return getMergedValue(a, b);
35316
+ } else if (prop in config1) {
35317
+ return getMergedValue(undefined, a);
35318
+ }
35319
+ }
35320
+ const mergeMap = {
35321
+ url: valueFromConfig2,
35322
+ method: valueFromConfig2,
35323
+ data: valueFromConfig2,
35324
+ baseURL: defaultToConfig2,
35325
+ transformRequest: defaultToConfig2,
35326
+ transformResponse: defaultToConfig2,
35327
+ paramsSerializer: defaultToConfig2,
35328
+ timeout: defaultToConfig2,
35329
+ timeoutMessage: defaultToConfig2,
35330
+ withCredentials: defaultToConfig2,
35331
+ withXSRFToken: defaultToConfig2,
35332
+ adapter: defaultToConfig2,
35333
+ responseType: defaultToConfig2,
35334
+ xsrfCookieName: defaultToConfig2,
35335
+ xsrfHeaderName: defaultToConfig2,
35336
+ onUploadProgress: defaultToConfig2,
35337
+ onDownloadProgress: defaultToConfig2,
35338
+ decompress: defaultToConfig2,
35339
+ maxContentLength: defaultToConfig2,
35340
+ maxBodyLength: defaultToConfig2,
35341
+ beforeRedirect: defaultToConfig2,
35342
+ transport: defaultToConfig2,
35343
+ httpAgent: defaultToConfig2,
35344
+ httpsAgent: defaultToConfig2,
35345
+ cancelToken: defaultToConfig2,
35346
+ socketPath: defaultToConfig2,
35347
+ responseEncoding: defaultToConfig2,
35348
+ validateStatus: mergeDirectKeys,
35349
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
35350
+ };
35351
+ utils_default.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
35352
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
35353
+ const configValue = merge2(config1[prop], config2[prop], prop);
35354
+ utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
35355
+ });
35356
+ return config;
35357
+ }
35358
+
35359
+ // node_modules/axios/lib/helpers/resolveConfig.js
35360
+ var resolveConfig_default = (config) => {
35361
+ const newConfig = mergeConfig({}, config);
35362
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
35363
+ newConfig.headers = headers = AxiosHeaders_default.from(headers);
35364
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
35365
+ if (auth) {
35366
+ headers.set("Authorization", "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")));
35367
+ }
35368
+ let contentType;
35369
+ if (utils_default.isFormData(data)) {
35370
+ if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
35371
+ headers.setContentType(undefined);
35372
+ } else if ((contentType = headers.getContentType()) !== false) {
35373
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
35374
+ headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
35375
+ }
35376
+ }
35377
+ if (platform_default.hasStandardBrowserEnv) {
35378
+ withXSRFToken && utils_default.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
35379
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(newConfig.url)) {
35380
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
35381
+ if (xsrfValue) {
35382
+ headers.set(xsrfHeaderName, xsrfValue);
35383
+ }
35384
+ }
35385
+ }
35386
+ return newConfig;
35387
+ };
35388
+
35389
+ // node_modules/axios/lib/adapters/xhr.js
35390
+ var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
35391
+ var xhr_default = isXHRAdapterSupported && function(config) {
35392
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
35393
+ const _config = resolveConfig_default(config);
35394
+ let requestData = _config.data;
35395
+ const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
35396
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
35397
+ let onCanceled;
35398
+ let uploadThrottled, downloadThrottled;
35399
+ let flushUpload, flushDownload;
35400
+ function done() {
35401
+ flushUpload && flushUpload();
35402
+ flushDownload && flushDownload();
35403
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
35404
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
35405
+ }
35406
+ let request = new XMLHttpRequest;
35407
+ request.open(_config.method.toUpperCase(), _config.url, true);
35408
+ request.timeout = _config.timeout;
35409
+ function onloadend() {
35410
+ if (!request) {
35411
+ return;
35412
+ }
35413
+ const responseHeaders = AxiosHeaders_default.from("getAllResponseHeaders" in request && request.getAllResponseHeaders());
35414
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
35415
+ const response = {
35416
+ data: responseData,
35417
+ status: request.status,
35418
+ statusText: request.statusText,
35419
+ headers: responseHeaders,
35420
+ config,
35421
+ request
35422
+ };
35423
+ settle(function _resolve(value2) {
35424
+ resolve(value2);
35425
+ done();
35426
+ }, function _reject(err) {
35427
+ reject(err);
35428
+ done();
35429
+ }, response);
35430
+ request = null;
35431
+ }
35432
+ if ("onloadend" in request) {
35433
+ request.onloadend = onloadend;
35434
+ } else {
35435
+ request.onreadystatechange = function handleLoad() {
35436
+ if (!request || request.readyState !== 4) {
35437
+ return;
35438
+ }
35439
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
35440
+ return;
35441
+ }
35442
+ setTimeout(onloadend);
35443
+ };
35444
+ }
35445
+ request.onabort = function handleAbort() {
35446
+ if (!request) {
35447
+ return;
35448
+ }
35449
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
35450
+ request = null;
35451
+ };
35452
+ request.onerror = function handleError() {
35453
+ reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request));
35454
+ request = null;
35455
+ };
35456
+ request.ontimeout = function handleTimeout() {
35457
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
35458
+ const transitional = _config.transitional || transitional_default;
35459
+ if (_config.timeoutErrorMessage) {
35460
+ timeoutErrorMessage = _config.timeoutErrorMessage;
35461
+ }
35462
+ reject(new AxiosError_default(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED, config, request));
35463
+ request = null;
35464
+ };
35465
+ requestData === undefined && requestHeaders.setContentType(null);
35466
+ if ("setRequestHeader" in request) {
35467
+ utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
35468
+ request.setRequestHeader(key, val);
35469
+ });
35470
+ }
35471
+ if (!utils_default.isUndefined(_config.withCredentials)) {
35472
+ request.withCredentials = !!_config.withCredentials;
35473
+ }
35474
+ if (responseType && responseType !== "json") {
35475
+ request.responseType = _config.responseType;
35476
+ }
35477
+ if (onDownloadProgress) {
35478
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
35479
+ request.addEventListener("progress", downloadThrottled);
35480
+ }
35481
+ if (onUploadProgress && request.upload) {
35482
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
35483
+ request.upload.addEventListener("progress", uploadThrottled);
35484
+ request.upload.addEventListener("loadend", flushUpload);
35485
+ }
35486
+ if (_config.cancelToken || _config.signal) {
35487
+ onCanceled = (cancel) => {
35488
+ if (!request) {
35489
+ return;
35490
+ }
35491
+ reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
35492
+ request.abort();
35493
+ request = null;
35494
+ };
35495
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
35496
+ if (_config.signal) {
35497
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
35498
+ }
35499
+ }
35500
+ const protocol = parseProtocol(_config.url);
35501
+ if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
35502
+ reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config));
35503
+ return;
35504
+ }
35505
+ request.send(requestData || null);
35506
+ });
35507
+ };
35508
+
35509
+ // node_modules/axios/lib/helpers/composeSignals.js
35510
+ var composeSignals = (signals, timeout) => {
35511
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
35512
+ if (timeout || length) {
35513
+ let controller = new AbortController;
35514
+ let aborted;
35515
+ const onabort = function(reason) {
35516
+ if (!aborted) {
35517
+ aborted = true;
35518
+ unsubscribe();
35519
+ const err = reason instanceof Error ? reason : this.reason;
35520
+ controller.abort(err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err));
35521
+ }
35522
+ };
35523
+ let timer = timeout && setTimeout(() => {
35524
+ timer = null;
35525
+ onabort(new AxiosError_default(`timeout ${timeout} of ms exceeded`, AxiosError_default.ETIMEDOUT));
35526
+ }, timeout);
35527
+ const unsubscribe = () => {
35528
+ if (signals) {
35529
+ timer && clearTimeout(timer);
35530
+ timer = null;
35531
+ signals.forEach((signal2) => {
35532
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
35533
+ });
35534
+ signals = null;
35535
+ }
35536
+ };
35537
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
35538
+ const { signal } = controller;
35539
+ signal.unsubscribe = () => utils_default.asap(unsubscribe);
35540
+ return signal;
35541
+ }
35542
+ };
35543
+ var composeSignals_default = composeSignals;
35544
+
35545
+ // node_modules/axios/lib/helpers/trackStream.js
35546
+ var streamChunk = function* (chunk, chunkSize) {
35547
+ let len = chunk.byteLength;
35548
+ if (!chunkSize || len < chunkSize) {
35549
+ yield chunk;
35550
+ return;
35551
+ }
35552
+ let pos = 0;
35553
+ let end;
35554
+ while (pos < len) {
35555
+ end = pos + chunkSize;
35556
+ yield chunk.slice(pos, end);
35557
+ pos = end;
35558
+ }
35559
+ };
35560
+ var readBytes = async function* (iterable, chunkSize) {
35561
+ for await (const chunk of readStream(iterable)) {
35562
+ yield* streamChunk(chunk, chunkSize);
35563
+ }
35564
+ };
35565
+ var readStream = async function* (stream4) {
35566
+ if (stream4[Symbol.asyncIterator]) {
35567
+ yield* stream4;
35568
+ return;
35569
+ }
35570
+ const reader = stream4.getReader();
35571
+ try {
35572
+ for (;; ) {
35573
+ const { done, value: value2 } = await reader.read();
35574
+ if (done) {
35575
+ break;
35576
+ }
35577
+ yield value2;
35578
+ }
35579
+ } finally {
35580
+ await reader.cancel();
35581
+ }
35582
+ };
35583
+ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
35584
+ const iterator = readBytes(stream4, chunkSize);
35585
+ let bytes = 0;
35586
+ let done;
35587
+ let _onFinish = (e2) => {
35588
+ if (!done) {
35589
+ done = true;
35590
+ onFinish && onFinish(e2);
35591
+ }
35592
+ };
35593
+ return new ReadableStream({
35594
+ async pull(controller) {
35595
+ try {
35596
+ const { done: done2, value: value2 } = await iterator.next();
35597
+ if (done2) {
35598
+ _onFinish();
35599
+ controller.close();
35600
+ return;
35601
+ }
35602
+ let len = value2.byteLength;
35603
+ if (onProgress) {
35604
+ let loadedBytes = bytes += len;
35605
+ onProgress(loadedBytes);
35606
+ }
35607
+ controller.enqueue(new Uint8Array(value2));
35608
+ } catch (err) {
35609
+ _onFinish(err);
35610
+ throw err;
35611
+ }
35612
+ },
35613
+ cancel(reason) {
35614
+ _onFinish(reason);
35615
+ return iterator.return();
35616
+ }
35617
+ }, {
35618
+ highWaterMark: 2
35619
+ });
35620
+ };
35621
+
35622
+ // node_modules/axios/lib/adapters/fetch.js
35623
+ var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
35624
+ var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
35625
+ var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
35626
+ var test = (fn, ...args) => {
35627
+ try {
35628
+ return !!fn(...args);
35629
+ } catch (e2) {
35630
+ return false;
35631
+ }
35632
+ };
35633
+ var supportsRequestStream = isReadableStreamSupported && test(() => {
35634
+ let duplexAccessed = false;
35635
+ const hasContentType = new Request(platform_default.origin, {
35636
+ body: new ReadableStream,
35637
+ method: "POST",
35638
+ get duplex() {
35639
+ duplexAccessed = true;
35640
+ return "half";
35641
+ }
35642
+ }).headers.has("Content-Type");
35643
+ return duplexAccessed && !hasContentType;
35644
+ });
35645
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
35646
+ var supportsResponseStream = isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
35647
+ var resolvers = {
35648
+ stream: supportsResponseStream && ((res) => res.body)
35649
+ };
35650
+ isFetchSupported && ((res) => {
35651
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
35652
+ !resolvers[type] && (resolvers[type] = utils_default.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
35653
+ throw new AxiosError_default(`Response type '${type}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
35654
+ });
35655
+ });
35656
+ })(new Response);
35657
+ var getBodyLength = async (body) => {
35658
+ if (body == null) {
35659
+ return 0;
35660
+ }
35661
+ if (utils_default.isBlob(body)) {
35662
+ return body.size;
35663
+ }
35664
+ if (utils_default.isSpecCompliantForm(body)) {
35665
+ const _request = new Request(platform_default.origin, {
35666
+ method: "POST",
35667
+ body
35668
+ });
35669
+ return (await _request.arrayBuffer()).byteLength;
35670
+ }
35671
+ if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
35672
+ return body.byteLength;
35673
+ }
35674
+ if (utils_default.isURLSearchParams(body)) {
35675
+ body = body + "";
35676
+ }
35677
+ if (utils_default.isString(body)) {
35678
+ return (await encodeText(body)).byteLength;
35679
+ }
35680
+ };
35681
+ var resolveBodyLength = async (headers, body) => {
35682
+ const length = utils_default.toFiniteNumber(headers.getContentLength());
35683
+ return length == null ? getBodyLength(body) : length;
35684
+ };
35685
+ var fetch_default = isFetchSupported && (async (config) => {
35686
+ let {
35687
+ url: url2,
35688
+ method,
35689
+ data,
35690
+ signal,
35691
+ cancelToken,
35692
+ timeout,
35693
+ onDownloadProgress,
35694
+ onUploadProgress,
35695
+ responseType,
35696
+ headers,
35697
+ withCredentials = "same-origin",
35698
+ fetchOptions
35699
+ } = resolveConfig_default(config);
35700
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
35701
+ let composedSignal = composeSignals_default([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
35702
+ let request;
35703
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
35704
+ composedSignal.unsubscribe();
35705
+ });
35706
+ let requestContentLength;
35707
+ try {
35708
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
35709
+ let _request = new Request(url2, {
35710
+ method: "POST",
35711
+ body: data,
35712
+ duplex: "half"
35713
+ });
35714
+ let contentTypeHeader;
35715
+ if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
35716
+ headers.setContentType(contentTypeHeader);
35717
+ }
35718
+ if (_request.body) {
35719
+ const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
35720
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
35721
+ }
35722
+ }
35723
+ if (!utils_default.isString(withCredentials)) {
35724
+ withCredentials = withCredentials ? "include" : "omit";
35725
+ }
35726
+ const isCredentialsSupported = "credentials" in Request.prototype;
35727
+ request = new Request(url2, {
35728
+ ...fetchOptions,
35729
+ signal: composedSignal,
35730
+ method: method.toUpperCase(),
35731
+ headers: headers.normalize().toJSON(),
35732
+ body: data,
35733
+ duplex: "half",
35734
+ credentials: isCredentialsSupported ? withCredentials : undefined
35735
+ });
35736
+ let response = await fetch(request);
35737
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
35738
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
35739
+ const options = {};
35740
+ ["status", "statusText", "headers"].forEach((prop) => {
35741
+ options[prop] = response[prop];
35742
+ });
35743
+ const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
35744
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
35745
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
35746
+ flush && flush();
35747
+ unsubscribe && unsubscribe();
35748
+ }), options);
35749
+ }
35750
+ responseType = responseType || "text";
35751
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
35752
+ !isStreamResponse && unsubscribe && unsubscribe();
35753
+ return await new Promise((resolve, reject) => {
35754
+ settle(resolve, reject, {
35755
+ data: responseData,
35756
+ headers: AxiosHeaders_default.from(response.headers),
35757
+ status: response.status,
35758
+ statusText: response.statusText,
35759
+ config,
35760
+ request
35761
+ });
35762
+ });
35763
+ } catch (err) {
35764
+ unsubscribe && unsubscribe();
35765
+ if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
35766
+ throw Object.assign(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request), {
35767
+ cause: err.cause || err
35768
+ });
35769
+ }
35770
+ throw AxiosError_default.from(err, err && err.code, config, request);
35771
+ }
35772
+ });
35773
+
35774
+ // node_modules/axios/lib/adapters/adapters.js
35775
+ var knownAdapters = {
35776
+ http: http_default,
35777
+ xhr: xhr_default,
35778
+ fetch: fetch_default
35779
+ };
35780
+ utils_default.forEach(knownAdapters, (fn, value2) => {
35781
+ if (fn) {
35782
+ try {
35783
+ Object.defineProperty(fn, "name", { value: value2 });
35784
+ } catch (e2) {
35785
+ }
35786
+ Object.defineProperty(fn, "adapterName", { value: value2 });
35787
+ }
35788
+ });
35789
+ var renderReason = (reason) => `- ${reason}`;
35790
+ var isResolvedHandle = (adapter) => utils_default.isFunction(adapter) || adapter === null || adapter === false;
35791
+ var adapters_default = {
35792
+ getAdapter: (adapters) => {
35793
+ adapters = utils_default.isArray(adapters) ? adapters : [adapters];
35794
+ const { length } = adapters;
35795
+ let nameOrAdapter;
35796
+ let adapter;
35797
+ const rejectedReasons = {};
35798
+ for (let i2 = 0;i2 < length; i2++) {
35799
+ nameOrAdapter = adapters[i2];
35800
+ let id;
35801
+ adapter = nameOrAdapter;
35802
+ if (!isResolvedHandle(nameOrAdapter)) {
35803
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
35804
+ if (adapter === undefined) {
35805
+ throw new AxiosError_default(`Unknown adapter '${id}'`);
35806
+ }
35807
+ }
35808
+ if (adapter) {
35809
+ break;
35810
+ }
35811
+ rejectedReasons[id || "#" + i2] = adapter;
35812
+ }
35813
+ if (!adapter) {
35814
+ const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build"));
35815
+ let s2 = length ? reasons.length > 1 ? `since :
35816
+ ` + reasons.map(renderReason).join(`
35817
+ `) : " " + renderReason(reasons[0]) : "as no adapter specified";
35818
+ throw new AxiosError_default(`There is no suitable adapter to dispatch the request ` + s2, "ERR_NOT_SUPPORT");
35819
+ }
35820
+ return adapter;
35821
+ },
35822
+ adapters: knownAdapters
35823
+ };
35824
+
35825
+ // node_modules/axios/lib/core/dispatchRequest.js
35826
+ function throwIfCancellationRequested(config) {
35827
+ if (config.cancelToken) {
35828
+ config.cancelToken.throwIfRequested();
35829
+ }
35830
+ if (config.signal && config.signal.aborted) {
35831
+ throw new CanceledError_default(null, config);
35832
+ }
35833
+ }
35834
+ function dispatchRequest(config) {
35835
+ throwIfCancellationRequested(config);
35836
+ config.headers = AxiosHeaders_default.from(config.headers);
35837
+ config.data = transformData.call(config, config.transformRequest);
35838
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
35839
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
35840
+ }
35841
+ const adapter = adapters_default.getAdapter(config.adapter || defaults_default.adapter);
35842
+ return adapter(config).then(function onAdapterResolution(response) {
35843
+ throwIfCancellationRequested(config);
35844
+ response.data = transformData.call(config, config.transformResponse, response);
35845
+ response.headers = AxiosHeaders_default.from(response.headers);
35846
+ return response;
35847
+ }, function onAdapterRejection(reason) {
35848
+ if (!isCancel(reason)) {
35849
+ throwIfCancellationRequested(config);
35850
+ if (reason && reason.response) {
35851
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
35852
+ reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
35853
+ }
35854
+ }
35855
+ return Promise.reject(reason);
35856
+ });
35857
+ }
35858
+
35859
+ // node_modules/axios/lib/helpers/validator.js
35860
+ var validators = {};
35861
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
35862
+ validators[type] = function validator(thing) {
35863
+ return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
35864
+ };
35865
+ });
35866
+ var deprecatedWarnings = {};
35867
+ validators.transitional = function transitional(validator, version, message) {
35868
+ function formatMessage(opt, desc) {
35869
+ return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
35870
+ }
35871
+ return (value2, opt, opts) => {
35872
+ if (validator === false) {
35873
+ throw new AxiosError_default(formatMessage(opt, " has been removed" + (version ? " in " + version : "")), AxiosError_default.ERR_DEPRECATED);
35874
+ }
35875
+ if (version && !deprecatedWarnings[opt]) {
35876
+ deprecatedWarnings[opt] = true;
35877
+ console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"));
35878
+ }
35879
+ return validator ? validator(value2, opt, opts) : true;
35880
+ };
35881
+ };
35882
+ validators.spelling = function spelling(correctSpelling) {
35883
+ return (value2, opt) => {
35884
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
35885
+ return true;
35886
+ };
35887
+ };
35888
+ function assertOptions(options, schema, allowUnknown) {
35889
+ if (typeof options !== "object") {
35890
+ throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
35891
+ }
35892
+ const keys = Object.keys(options);
35893
+ let i2 = keys.length;
35894
+ while (i2-- > 0) {
35895
+ const opt = keys[i2];
35896
+ const validator = schema[opt];
35897
+ if (validator) {
35898
+ const value2 = options[opt];
35899
+ const result = value2 === undefined || validator(value2, opt, options);
35900
+ if (result !== true) {
35901
+ throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE);
35902
+ }
35903
+ continue;
35904
+ }
35905
+ if (allowUnknown !== true) {
35906
+ throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION);
35907
+ }
35908
+ }
35909
+ }
35910
+ var validator_default = {
35911
+ assertOptions,
35912
+ validators
35913
+ };
35914
+
35915
+ // node_modules/axios/lib/core/Axios.js
35916
+ var validators2 = validator_default.validators;
35917
+
35918
+ class Axios {
35919
+ constructor(instanceConfig) {
35920
+ this.defaults = instanceConfig;
35921
+ this.interceptors = {
35922
+ request: new InterceptorManager_default,
35923
+ response: new InterceptorManager_default
35924
+ };
35925
+ }
35926
+ async request(configOrUrl, config) {
35927
+ try {
35928
+ return await this._request(configOrUrl, config);
35929
+ } catch (err) {
35930
+ if (err instanceof Error) {
35931
+ let dummy = {};
35932
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error;
35933
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
35934
+ try {
35935
+ if (!err.stack) {
35936
+ err.stack = stack;
35937
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
35938
+ err.stack += `
35939
+ ` + stack;
35940
+ }
35941
+ } catch (e2) {
35942
+ }
35943
+ }
35944
+ throw err;
35945
+ }
35946
+ }
35947
+ _request(configOrUrl, config) {
35948
+ if (typeof configOrUrl === "string") {
35949
+ config = config || {};
35950
+ config.url = configOrUrl;
35951
+ } else {
35952
+ config = configOrUrl || {};
35953
+ }
35954
+ config = mergeConfig(this.defaults, config);
35955
+ const { transitional: transitional2, paramsSerializer, headers } = config;
35956
+ if (transitional2 !== undefined) {
35957
+ validator_default.assertOptions(transitional2, {
35958
+ silentJSONParsing: validators2.transitional(validators2.boolean),
35959
+ forcedJSONParsing: validators2.transitional(validators2.boolean),
35960
+ clarifyTimeoutError: validators2.transitional(validators2.boolean)
35961
+ }, false);
35962
+ }
35963
+ if (paramsSerializer != null) {
35964
+ if (utils_default.isFunction(paramsSerializer)) {
35965
+ config.paramsSerializer = {
35966
+ serialize: paramsSerializer
35967
+ };
35968
+ } else {
35969
+ validator_default.assertOptions(paramsSerializer, {
35970
+ encode: validators2.function,
35971
+ serialize: validators2.function
35972
+ }, true);
35973
+ }
35974
+ }
35975
+ if (config.allowAbsoluteUrls !== undefined) {
35976
+ } else if (this.defaults.allowAbsoluteUrls !== undefined) {
35977
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
35978
+ } else {
35979
+ config.allowAbsoluteUrls = true;
35980
+ }
35981
+ validator_default.assertOptions(config, {
35982
+ baseUrl: validators2.spelling("baseURL"),
35983
+ withXsrfToken: validators2.spelling("withXSRFToken")
35984
+ }, true);
35985
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
35986
+ let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
35987
+ headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
35988
+ delete headers[method];
35989
+ });
35990
+ config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
35991
+ const requestInterceptorChain = [];
35992
+ let synchronousRequestInterceptors = true;
35993
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
35994
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
35995
+ return;
35996
+ }
35997
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
35998
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
35999
+ });
36000
+ const responseInterceptorChain = [];
36001
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
36002
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
36003
+ });
36004
+ let promise;
36005
+ let i2 = 0;
36006
+ let len;
36007
+ if (!synchronousRequestInterceptors) {
36008
+ const chain = [dispatchRequest.bind(this), undefined];
36009
+ chain.unshift.apply(chain, requestInterceptorChain);
36010
+ chain.push.apply(chain, responseInterceptorChain);
36011
+ len = chain.length;
36012
+ promise = Promise.resolve(config);
36013
+ while (i2 < len) {
36014
+ promise = promise.then(chain[i2++], chain[i2++]);
36015
+ }
36016
+ return promise;
36017
+ }
36018
+ len = requestInterceptorChain.length;
36019
+ let newConfig = config;
36020
+ i2 = 0;
36021
+ while (i2 < len) {
36022
+ const onFulfilled = requestInterceptorChain[i2++];
36023
+ const onRejected = requestInterceptorChain[i2++];
36024
+ try {
36025
+ newConfig = onFulfilled(newConfig);
36026
+ } catch (error) {
36027
+ onRejected.call(this, error);
36028
+ break;
36029
+ }
36030
+ }
36031
+ try {
36032
+ promise = dispatchRequest.call(this, newConfig);
36033
+ } catch (error) {
36034
+ return Promise.reject(error);
36035
+ }
36036
+ i2 = 0;
36037
+ len = responseInterceptorChain.length;
36038
+ while (i2 < len) {
36039
+ promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
36040
+ }
36041
+ return promise;
36042
+ }
36043
+ getUri(config) {
36044
+ config = mergeConfig(this.defaults, config);
36045
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
36046
+ return buildURL(fullPath, config.params, config.paramsSerializer);
36047
+ }
36048
+ }
36049
+ utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
36050
+ Axios.prototype[method] = function(url2, config) {
36051
+ return this.request(mergeConfig(config || {}, {
36052
+ method,
36053
+ url: url2,
36054
+ data: (config || {}).data
36055
+ }));
36056
+ };
36057
+ });
36058
+ utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
36059
+ function generateHTTPMethod(isForm) {
36060
+ return function httpMethod(url2, data, config) {
36061
+ return this.request(mergeConfig(config || {}, {
36062
+ method,
36063
+ headers: isForm ? {
36064
+ "Content-Type": "multipart/form-data"
36065
+ } : {},
36066
+ url: url2,
36067
+ data
36068
+ }));
36069
+ };
36070
+ }
36071
+ Axios.prototype[method] = generateHTTPMethod();
36072
+ Axios.prototype[method + "Form"] = generateHTTPMethod(true);
36073
+ });
36074
+ var Axios_default = Axios;
36075
+
36076
+ // node_modules/axios/lib/cancel/CancelToken.js
36077
+ class CancelToken {
36078
+ constructor(executor) {
36079
+ if (typeof executor !== "function") {
36080
+ throw new TypeError("executor must be a function.");
36081
+ }
36082
+ let resolvePromise;
36083
+ this.promise = new Promise(function promiseExecutor(resolve) {
36084
+ resolvePromise = resolve;
36085
+ });
36086
+ const token = this;
36087
+ this.promise.then((cancel) => {
36088
+ if (!token._listeners)
36089
+ return;
36090
+ let i2 = token._listeners.length;
36091
+ while (i2-- > 0) {
36092
+ token._listeners[i2](cancel);
36093
+ }
36094
+ token._listeners = null;
36095
+ });
36096
+ this.promise.then = (onfulfilled) => {
36097
+ let _resolve;
36098
+ const promise = new Promise((resolve) => {
36099
+ token.subscribe(resolve);
36100
+ _resolve = resolve;
36101
+ }).then(onfulfilled);
36102
+ promise.cancel = function reject() {
36103
+ token.unsubscribe(_resolve);
36104
+ };
36105
+ return promise;
36106
+ };
36107
+ executor(function cancel(message, config, request) {
36108
+ if (token.reason) {
36109
+ return;
36110
+ }
36111
+ token.reason = new CanceledError_default(message, config, request);
36112
+ resolvePromise(token.reason);
36113
+ });
36114
+ }
36115
+ throwIfRequested() {
36116
+ if (this.reason) {
36117
+ throw this.reason;
36118
+ }
36119
+ }
36120
+ subscribe(listener) {
36121
+ if (this.reason) {
36122
+ listener(this.reason);
36123
+ return;
36124
+ }
36125
+ if (this._listeners) {
36126
+ this._listeners.push(listener);
36127
+ } else {
36128
+ this._listeners = [listener];
36129
+ }
36130
+ }
36131
+ unsubscribe(listener) {
36132
+ if (!this._listeners) {
36133
+ return;
36134
+ }
36135
+ const index = this._listeners.indexOf(listener);
36136
+ if (index !== -1) {
36137
+ this._listeners.splice(index, 1);
36138
+ }
36139
+ }
36140
+ toAbortSignal() {
36141
+ const controller = new AbortController;
36142
+ const abort = (err) => {
36143
+ controller.abort(err);
36144
+ };
36145
+ this.subscribe(abort);
36146
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
36147
+ return controller.signal;
36148
+ }
36149
+ static source() {
36150
+ let cancel;
36151
+ const token = new CancelToken(function executor(c) {
36152
+ cancel = c;
36153
+ });
36154
+ return {
36155
+ token,
36156
+ cancel
36157
+ };
36158
+ }
36159
+ }
36160
+ var CancelToken_default = CancelToken;
36161
+
36162
+ // node_modules/axios/lib/helpers/spread.js
36163
+ function spread(callback) {
36164
+ return function wrap(arr) {
36165
+ return callback.apply(null, arr);
36166
+ };
36167
+ }
36168
+
36169
+ // node_modules/axios/lib/helpers/isAxiosError.js
36170
+ function isAxiosError(payload) {
36171
+ return utils_default.isObject(payload) && payload.isAxiosError === true;
36172
+ }
36173
+
36174
+ // node_modules/axios/lib/helpers/HttpStatusCode.js
36175
+ var HttpStatusCode = {
36176
+ Continue: 100,
36177
+ SwitchingProtocols: 101,
36178
+ Processing: 102,
36179
+ EarlyHints: 103,
36180
+ Ok: 200,
36181
+ Created: 201,
36182
+ Accepted: 202,
36183
+ NonAuthoritativeInformation: 203,
36184
+ NoContent: 204,
36185
+ ResetContent: 205,
36186
+ PartialContent: 206,
36187
+ MultiStatus: 207,
36188
+ AlreadyReported: 208,
36189
+ ImUsed: 226,
36190
+ MultipleChoices: 300,
36191
+ MovedPermanently: 301,
36192
+ Found: 302,
36193
+ SeeOther: 303,
36194
+ NotModified: 304,
36195
+ UseProxy: 305,
36196
+ Unused: 306,
36197
+ TemporaryRedirect: 307,
36198
+ PermanentRedirect: 308,
36199
+ BadRequest: 400,
36200
+ Unauthorized: 401,
36201
+ PaymentRequired: 402,
36202
+ Forbidden: 403,
36203
+ NotFound: 404,
36204
+ MethodNotAllowed: 405,
36205
+ NotAcceptable: 406,
36206
+ ProxyAuthenticationRequired: 407,
36207
+ RequestTimeout: 408,
36208
+ Conflict: 409,
36209
+ Gone: 410,
36210
+ LengthRequired: 411,
36211
+ PreconditionFailed: 412,
36212
+ PayloadTooLarge: 413,
36213
+ UriTooLong: 414,
36214
+ UnsupportedMediaType: 415,
36215
+ RangeNotSatisfiable: 416,
36216
+ ExpectationFailed: 417,
36217
+ ImATeapot: 418,
36218
+ MisdirectedRequest: 421,
36219
+ UnprocessableEntity: 422,
36220
+ Locked: 423,
36221
+ FailedDependency: 424,
36222
+ TooEarly: 425,
36223
+ UpgradeRequired: 426,
36224
+ PreconditionRequired: 428,
36225
+ TooManyRequests: 429,
36226
+ RequestHeaderFieldsTooLarge: 431,
36227
+ UnavailableForLegalReasons: 451,
36228
+ InternalServerError: 500,
36229
+ NotImplemented: 501,
36230
+ BadGateway: 502,
36231
+ ServiceUnavailable: 503,
36232
+ GatewayTimeout: 504,
36233
+ HttpVersionNotSupported: 505,
36234
+ VariantAlsoNegotiates: 506,
36235
+ InsufficientStorage: 507,
36236
+ LoopDetected: 508,
36237
+ NotExtended: 510,
36238
+ NetworkAuthenticationRequired: 511
36239
+ };
36240
+ Object.entries(HttpStatusCode).forEach(([key, value2]) => {
36241
+ HttpStatusCode[value2] = key;
36242
+ });
36243
+ var HttpStatusCode_default = HttpStatusCode;
36244
+
36245
+ // node_modules/axios/lib/axios.js
36246
+ function createInstance(defaultConfig) {
36247
+ const context = new Axios_default(defaultConfig);
36248
+ const instance = bind(Axios_default.prototype.request, context);
36249
+ utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true });
36250
+ utils_default.extend(instance, context, null, { allOwnKeys: true });
36251
+ instance.create = function create(instanceConfig) {
36252
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
36253
+ };
36254
+ return instance;
36255
+ }
36256
+ var axios = createInstance(defaults_default);
36257
+ axios.Axios = Axios_default;
36258
+ axios.CanceledError = CanceledError_default;
36259
+ axios.CancelToken = CancelToken_default;
36260
+ axios.isCancel = isCancel;
36261
+ axios.VERSION = VERSION;
36262
+ axios.toFormData = toFormData_default;
36263
+ axios.AxiosError = AxiosError_default;
36264
+ axios.Cancel = axios.CanceledError;
36265
+ axios.all = function all(promises) {
36266
+ return Promise.all(promises);
36267
+ };
36268
+ axios.spread = spread;
36269
+ axios.isAxiosError = isAxiosError;
36270
+ axios.mergeConfig = mergeConfig;
36271
+ axios.AxiosHeaders = AxiosHeaders_default;
36272
+ axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
36273
+ axios.getAdapter = adapters_default.getAdapter;
36274
+ axios.HttpStatusCode = HttpStatusCode_default;
36275
+ axios.default = axios;
36276
+ var axios_default = axios;
36277
+
33162
36278
  // src/exchanges/binance.ts
33163
36279
  async function initClient(credentials, options) {
33164
36280
  const { proxyAgent, type = "future" } = options || {};
@@ -33357,11 +36473,11 @@ async function placeStopOrder(client, payload) {
33357
36473
  kind: payload.kind
33358
36474
  });
33359
36475
  }
33360
- const spread = 1.00005;
36476
+ const spread2 = 1.00005;
33361
36477
  const order = {
33362
36478
  kind: payload.kind,
33363
36479
  side: payload.kind === "long" ? "sell" : "buy",
33364
- price: payload.kind === "long" ? payload.stop * spread ** -1 : payload.stop * spread,
36480
+ price: payload.kind === "long" ? payload.stop * spread2 ** -1 : payload.stop * spread2,
33365
36481
  quantity: payload.quantity,
33366
36482
  stop: payload.final_stop,
33367
36483
  is_market: !payload.is_limit
@@ -33628,6 +36744,29 @@ async function analyzeCharts(params) {
33628
36744
  }
33629
36745
  return finalPairs;
33630
36746
  }
36747
+ var BASE_URL = "https://fapi.binance.com";
36748
+ async function getWeeklyKlines(symbol, limit = 20) {
36749
+ const url2 = `${BASE_URL}/fapi/v1/klines`;
36750
+ const params = {
36751
+ symbol,
36752
+ interval: "1w",
36753
+ limit
36754
+ };
36755
+ const response = await axios_default.get(url2, { params });
36756
+ return response.data.map((k) => ({
36757
+ open: parseFloat(k[1]),
36758
+ high: parseFloat(k[2]),
36759
+ low: parseFloat(k[3]),
36760
+ close: parseFloat(k[4])
36761
+ }));
36762
+ }
36763
+ function calculateSupportResistance(klines) {
36764
+ const lows = klines.map((k) => k.low);
36765
+ const highs = klines.map((k) => k.high);
36766
+ const support = Math.min(...lows);
36767
+ const resistance = Math.max(...highs);
36768
+ return { support, resistance };
36769
+ }
33631
36770
 
33632
36771
  class BinanceExchange {
33633
36772
  client;
@@ -33758,7 +36897,60 @@ class BinanceExchange {
33758
36897
  });
33759
36898
  }
33760
36899
  async setLeverage(payload) {
33761
- return await this.client.setLeverage(payload);
36900
+ let maxLeverage = payload.leverage;
36901
+ if (!maxLeverage) {
36902
+ const response = await this.client.getNotionalAndLeverageBrackets({
36903
+ symbol: payload.symbol
36904
+ });
36905
+ const brackets = response.find((s2) => s2.symbol.toLowerCase() === payload.symbol.toLowerCase());
36906
+ if (!brackets) {
36907
+ throw new Error(`Leverage bracket not found for ${payload.symbol}`);
36908
+ }
36909
+ maxLeverage = Math.max(...brackets.brackets.map((b) => b.initialLeverage));
36910
+ }
36911
+ await this.client.setLeverage({
36912
+ symbol: payload.symbol,
36913
+ leverage: payload.leverage || maxLeverage
36914
+ });
36915
+ return maxLeverage;
36916
+ }
36917
+ async generateConfig(payload) {
36918
+ const url2 = `${BASE_URL}/fapi/v1/exchangeInfo`;
36919
+ const response = await axios_default.get(url2);
36920
+ const symbols = response.data.symbols;
36921
+ const { symbol, limit = 5 } = payload;
36922
+ const klines = await getWeeklyKlines(symbol, limit);
36923
+ const { support, resistance } = calculateSupportResistance(klines);
36924
+ const target = symbols.find((s2) => s2.symbol === symbol);
36925
+ if (!target)
36926
+ throw new Error(`Symbol ${symbol} not found.`);
36927
+ let minNotional = null;
36928
+ target.filters.forEach((f) => {
36929
+ if (f.filterType === "MIN_NOTIONAL")
36930
+ minNotional = parseFloat(f.notional);
36931
+ });
36932
+ const currentPrice = await getCurrentPrice(this.client, symbol);
36933
+ const price_places = `%.${getPricePlaces(currentPrice)}f`;
36934
+ const decimal_places = `%.${target.quantityPrecision}f`;
36935
+ const configObj = {
36936
+ support,
36937
+ resistance,
36938
+ minNotional,
36939
+ min_size: to_f((minNotional || 0) / support, decimal_places),
36940
+ price_places,
36941
+ decimal_places,
36942
+ leverage: await this.setLeverage({ symbol }),
36943
+ symbol
36944
+ };
36945
+ return configObj;
36946
+ }
36947
+ }
36948
+ function getPricePlaces(target) {
36949
+ const numStr = target.toString();
36950
+ if (numStr.includes(".")) {
36951
+ return numStr.split(".")[1].replace(/0+$/, "").length;
36952
+ } else {
36953
+ return 0;
33762
36954
  }
33763
36955
  }
33764
36956
 
@@ -34372,6 +37564,8 @@ class BybitExchange {
34372
37564
  sellLeverage: payload.leverage.toString()
34373
37565
  });
34374
37566
  }
37567
+ async generateConfig(payload) {
37568
+ }
34375
37569
  }
34376
37570
 
34377
37571
  // src/helpers/accounts.ts
@@ -35088,6 +38282,9 @@ class ExchangeAccount {
35088
38282
  short_position: active_account.position.short,
35089
38283
  usd_balance: active_account.usd_balance || 0
35090
38284
  });
38285
+ if (options.kind) {
38286
+ return db_positions.find((x) => x.kind === options.kind);
38287
+ }
35091
38288
  return db_positions;
35092
38289
  }
35093
38290
  async getRunningInstanceFromDB(symbol) {
@@ -35136,7 +38333,7 @@ class ExchangeAccount {
35136
38333
  }
35137
38334
  }
35138
38335
  async cancelOrders(payload) {
35139
- const { symbol, kind, price: _price, all, stop } = payload;
38336
+ const { symbol, kind, price: _price, all: all2, stop } = payload;
35140
38337
  let price = _price || 0;
35141
38338
  await this.getLiveExchangeInstance({
35142
38339
  symbol,
@@ -35147,7 +38344,7 @@ class ExchangeAccount {
35147
38344
  kind,
35148
38345
  update: true
35149
38346
  });
35150
- if (all) {
38347
+ if (all2) {
35151
38348
  } else {
35152
38349
  if (!price) {
35153
38350
  const position2 = await this.syncAccount({
@@ -35160,7 +38357,7 @@ class ExchangeAccount {
35160
38357
  }
35161
38358
  let result = await this.app_db.cancelOrders({
35162
38359
  cancelExchangeOrders: this.cancelExchangeOrders.bind(this),
35163
- all,
38360
+ all: all2,
35164
38361
  kind,
35165
38362
  account: this.instance,
35166
38363
  symbol,
@@ -35181,7 +38378,7 @@ class ExchangeAccount {
35181
38378
  kind: app_config.kind
35182
38379
  });
35183
38380
  if (db_position) {
35184
- await this.app_db.createOrUpdatePositionConfig(db_position.config, {
38381
+ await this.app_db.createOrUpdatePositionConfig(db_position, {
35185
38382
  entry: payload.entry,
35186
38383
  stop: payload.stop,
35187
38384
  risk_reward: payload.risk_reward,
@@ -35292,6 +38489,7 @@ class ExchangeAccount {
35292
38489
  quantity: x.quantity
35293
38490
  })),
35294
38491
  kind: app_config.kind,
38492
+ price_places: app_config.price_places,
35295
38493
  decimal_places: app_config.decimal_places,
35296
38494
  symbol: payload.symbol,
35297
38495
  place: payload.place
@@ -35330,7 +38528,7 @@ class ExchangeAccount {
35330
38528
  kind: payload.kind
35331
38529
  });
35332
38530
  if (db_position) {
35333
- await this.app_db.createOrUpdatePositionConfig(db_position.config, payload.params);
38531
+ await this.app_db.createOrUpdatePositionConfig(db_position, payload.params);
35334
38532
  }
35335
38533
  }
35336
38534
  return await this.app_db.getPositionConfig({
@@ -35571,7 +38769,8 @@ class ExchangeAccount {
35571
38769
  if (new_config && short_config && (short_config.entry !== new_config.entry || short_config.stop !== new_config.stop || short_config.risk !== new_config.risk)) {
35572
38770
  console.log("updating short position");
35573
38771
  short_position = await this.app_db.update_db_position(short_position, {
35574
- reduce_ratio: 0.95
38772
+ reduce_ratio: 0.95,
38773
+ config: short_config.id
35575
38774
  });
35576
38775
  console.log("Updating the short position config");
35577
38776
  await this.getPositionConfig({
@@ -35602,6 +38801,78 @@ class ExchangeAccount {
35602
38801
  this.app_db.removePosition(short_position);
35603
38802
  }
35604
38803
  }
38804
+ async triggerBullishMarket(symbol) {
38805
+ const bullish_instance = await this.app_db.getBullishMarket(symbol);
38806
+ if (!bullish_instance) {
38807
+ return false;
38808
+ }
38809
+ const config = await this.exchange.generateConfig({
38810
+ symbol
38811
+ });
38812
+ await this.app_db.updateSymbolConfigs({
38813
+ configs: [
38814
+ {
38815
+ symbol,
38816
+ support: config.support,
38817
+ resistance: config.resistance,
38818
+ leverage: config.leverage,
38819
+ min_size: config.min_size,
38820
+ price_places: config.price_places,
38821
+ decimal_places: config.decimal_places
38822
+ }
38823
+ ]
38824
+ });
38825
+ const position2 = await this.syncAccount({
38826
+ symbol,
38827
+ update: true,
38828
+ kind: "long"
38829
+ });
38830
+ const symbol_config = await this.app_db.getSymbolConfigFromDB(symbol);
38831
+ const long_config = await this.generate_config_params({
38832
+ entry: symbol_config.resistance,
38833
+ stop: symbol_config.support,
38834
+ risk_reward: 199,
38835
+ risk: bullish_instance.risk,
38836
+ symbol
38837
+ });
38838
+ if (!position2?.config) {
38839
+ await this.buildAppConfig({
38840
+ entry: long_config.entry,
38841
+ stop: long_config.stop,
38842
+ risk_reward: long_config.risk_reward,
38843
+ risk: long_config.risk,
38844
+ symbol,
38845
+ profit_percent: 1,
38846
+ update_db: true
38847
+ });
38848
+ } else {
38849
+ await this.getPositionConfig({
38850
+ symbol,
38851
+ kind: "long",
38852
+ params: {
38853
+ entry: long_config.entry,
38854
+ stop: long_config.stop,
38855
+ risk: long_config.risk,
38856
+ risk_reward: position2?.expand?.config?.risk_reward || long_config.risk_reward
38857
+ }
38858
+ });
38859
+ }
38860
+ const short_position = await this.syncAccount({
38861
+ symbol,
38862
+ kind: "short"
38863
+ });
38864
+ if (short_position?.config) {
38865
+ await this.toggleStopBuying({
38866
+ should_stop: true,
38867
+ kind: "short",
38868
+ symbol
38869
+ });
38870
+ }
38871
+ return this.triggerTradeFromConfig({
38872
+ symbol,
38873
+ kind: "long"
38874
+ });
38875
+ }
35605
38876
  }
35606
38877
  function getExchangeKlass(exchange) {
35607
38878
  const func = exchange === "binance" ? BinanceExchange : BybitExchange;
@@ -35750,7 +39021,7 @@ class App {
35750
39021
  };
35751
39022
  let rr = {};
35752
39023
  if (strategy_instance.save_config) {
35753
- rr = await this.app_db.createOrUpdatePositionConfig(config_instance.id, {
39024
+ rr = await this.app_db.createOrUpdatePositionConfig(config_instance, {
35754
39025
  entry: config.entry,
35755
39026
  stop: config.stop,
35756
39027
  risk_reward: config.risk_reward,