@termix-ssh/cli 1.3.1 → 1.4.0

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
@@ -10014,7 +10014,7 @@ var require_form_data = __commonJS({
10014
10014
  var http4 = __require("http");
10015
10015
  var https3 = __require("https");
10016
10016
  var parseUrl2 = __require("url").parse;
10017
- var fs9 = __require("fs");
10017
+ var fs10 = __require("fs");
10018
10018
  var Stream = __require("stream").Stream;
10019
10019
  var crypto2 = __require("crypto");
10020
10020
  var mime = require_mime_types();
@@ -10084,7 +10084,7 @@ var require_form_data = __commonJS({
10084
10084
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
10085
10085
  callback(null, value.end + 1 - (value.start ? value.start : 0));
10086
10086
  } else {
10087
- fs9.stat(value.path, function(err, stat) {
10087
+ fs10.stat(value.path, function(err, stat) {
10088
10088
  if (err) {
10089
10089
  callback(err);
10090
10090
  return;
@@ -11992,6 +11992,7 @@ var require_constants = __commonJS({
11992
11992
  var require_buffer_util = __commonJS({
11993
11993
  "node_modules/ws/lib/buffer-util.js"(exports, module) {
11994
11994
  "use strict";
11995
+ var { websocketMask, websocketUnmask } = __require("http");
11995
11996
  var { EMPTY_BUFFER } = require_constants();
11996
11997
  var FastBuffer = Buffer[Symbol.species];
11997
11998
  function concat(list, totalLength) {
@@ -12046,7 +12047,16 @@ var require_buffer_util = __commonJS({
12046
12047
  toBuffer,
12047
12048
  unmask: _unmask
12048
12049
  };
12049
- if (!process.env.WS_NO_BUFFER_UTIL) {
12050
+ if (websocketMask) {
12051
+ module.exports.mask = function(source, mask, output2, offset, length) {
12052
+ if (length < 24) _mask(source, mask, output2, offset, length);
12053
+ else websocketMask(source, mask, output2, offset, length);
12054
+ };
12055
+ module.exports.unmask = function(buffer, mask) {
12056
+ if (buffer.length < 24) _unmask(buffer, mask);
12057
+ else websocketUnmask(buffer, mask);
12058
+ };
12059
+ } else if (!process.env.WS_NO_BUFFER_UTIL) {
12050
12060
  try {
12051
12061
  const bufferUtil = __require("bufferutil");
12052
12062
  module.exports.mask = function(source, mask, output2, offset, length) {
@@ -13109,6 +13119,7 @@ var require_receiver = __commonJS({
13109
13119
  unmask(data, this._mask);
13110
13120
  }
13111
13121
  }
13122
+ this._mask = void 0;
13112
13123
  if (this._opcode > 7) {
13113
13124
  this.controlMessage(data, cb);
13114
13125
  return;
@@ -13441,12 +13452,15 @@ var require_sender = __commonJS({
13441
13452
  target[2] = target[3] = 0;
13442
13453
  target.writeUIntBE(dataLength, 4, 6);
13443
13454
  }
13444
- if (!options2.mask) return [target, data];
13455
+ if (!options2.mask) {
13456
+ return dataLength ? [target, data] : [target];
13457
+ }
13445
13458
  target[1] |= 128;
13446
13459
  target[offset - 4] = mask[0];
13447
13460
  target[offset - 3] = mask[1];
13448
13461
  target[offset - 2] = mask[2];
13449
13462
  target[offset - 1] = mask[3];
13463
+ if (!dataLength) return [target];
13450
13464
  if (skipMasking) return [target, data];
13451
13465
  if (merge3) {
13452
13466
  applyMask(data, mask, target, offset, dataLength);
@@ -14203,7 +14217,8 @@ var require_websocket = __commonJS({
14203
14217
  var https3 = __require("https");
14204
14218
  var http4 = __require("http");
14205
14219
  var net = __require("net");
14206
- var tls = __require("tls");
14220
+ var querystring = __require("querystring");
14221
+ var tls2 = __require("tls");
14207
14222
  var { randomBytes, createHash } = __require("crypto");
14208
14223
  var { Duplex, Readable: Readable2 } = __require("stream");
14209
14224
  var { URL: URL2 } = __require("url");
@@ -14260,21 +14275,38 @@ var require_websocket = __commonJS({
14260
14275
  this._isServer = false;
14261
14276
  this._redirects = 0;
14262
14277
  if (protocols === void 0) {
14263
- protocols = [];
14278
+ if (!options2 || options2.protocols === void 0) {
14279
+ protocols = [];
14280
+ } else if (Array.isArray(options2.protocols)) {
14281
+ protocols = options2.protocols;
14282
+ } else {
14283
+ protocols = [options2.protocols];
14284
+ }
14264
14285
  } else if (!Array.isArray(protocols)) {
14265
14286
  if (typeof protocols === "object" && protocols !== null) {
14266
14287
  options2 = protocols;
14267
- protocols = [];
14288
+ if (options2.protocols === void 0) {
14289
+ protocols = [];
14290
+ } else if (Array.isArray(options2.protocols)) {
14291
+ protocols = options2.protocols;
14292
+ } else {
14293
+ protocols = [options2.protocols];
14294
+ }
14268
14295
  } else {
14269
14296
  protocols = [protocols];
14270
14297
  }
14271
14298
  }
14272
- initAsClient(this, address, protocols, options2);
14299
+ options2 = initAsClient(this, address, protocols, options2);
14273
14300
  } else {
14274
- this._autoPong = options2.autoPong;
14275
- this._closeTimeout = options2.closeTimeout;
14276
14301
  this._isServer = true;
14277
14302
  }
14303
+ if (options2.autoPong) {
14304
+ this._autoPong = true;
14305
+ this._autoPongComplete = () => autoPongComplete(this);
14306
+ this._pendingAutoPongs = 0;
14307
+ this._maxPendingAutoPongs = options2.maxPendingAutoPongs | 0;
14308
+ }
14309
+ this._closeTimeout = options2.closeTimeout;
14278
14310
  }
14279
14311
  /**
14280
14312
  * For historical reasons, the custom "nodebuffer" type is used by the default
@@ -14461,7 +14493,6 @@ var require_websocket = __commonJS({
14461
14493
  }
14462
14494
  return;
14463
14495
  }
14464
- this._readyState = _WebSocket.CLOSING;
14465
14496
  this._sender.close(code, data, !this._isServer, (err) => {
14466
14497
  if (err) return;
14467
14498
  this._closeFrameSent = true;
@@ -14469,6 +14500,7 @@ var require_websocket = __commonJS({
14469
14500
  this._socket.end();
14470
14501
  }
14471
14502
  });
14503
+ this._readyState = _WebSocket.CLOSING;
14472
14504
  setCloseTimer(this);
14473
14505
  }
14474
14506
  /**
@@ -14685,6 +14717,7 @@ var require_websocket = __commonJS({
14685
14717
  maxBufferedChunks: 256 * 1024,
14686
14718
  maxFragments: 16 * 1024,
14687
14719
  maxPayload: 100 * 1024 * 1024,
14720
+ maxPendingAutoPongs: 60,
14688
14721
  skipUTF8Validation: false,
14689
14722
  perMessageDeflate: true,
14690
14723
  followRedirects: false,
@@ -14693,14 +14726,13 @@ var require_websocket = __commonJS({
14693
14726
  socketPath: void 0,
14694
14727
  hostname: void 0,
14695
14728
  protocol: void 0,
14729
+ protocols: void 0,
14696
14730
  timeout: void 0,
14697
14731
  method: "GET",
14698
14732
  host: void 0,
14699
14733
  path: void 0,
14700
14734
  port: void 0
14701
14735
  };
14702
- websocket._autoPong = opts.autoPong;
14703
- websocket._closeTimeout = opts.closeTimeout;
14704
14736
  if (!protocolVersions.includes(opts.protocolVersion)) {
14705
14737
  throw new RangeError(
14706
14738
  `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
@@ -14716,10 +14748,9 @@ var require_websocket = __commonJS({
14716
14748
  throw new SyntaxError(`Invalid URL: ${address}`);
14717
14749
  }
14718
14750
  }
14719
- if (parsedUrl.protocol === "http:") {
14720
- parsedUrl.protocol = "ws:";
14721
- } else if (parsedUrl.protocol === "https:") {
14722
- parsedUrl.protocol = "wss:";
14751
+ if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
14752
+ parsedUrl = new URL2(parsedUrl);
14753
+ parsedUrl.protocol = parsedUrl.protocol === "http:" ? "ws:" : "wss:";
14723
14754
  }
14724
14755
  websocket._url = parsedUrl.href;
14725
14756
  const isSecure = parsedUrl.protocol === "wss:";
@@ -14788,12 +14819,19 @@ var require_websocket = __commonJS({
14788
14819
  }
14789
14820
  }
14790
14821
  if (parsedUrl.username || parsedUrl.password) {
14791
- opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
14822
+ const username = querystring.unescape(parsedUrl.username);
14823
+ const password = querystring.unescape(parsedUrl.password);
14824
+ opts.auth = `${username}:${password}`;
14792
14825
  }
14793
14826
  if (isIpcUrl) {
14794
- const parts = opts.path.split(":");
14795
- opts.socketPath = parts[0];
14796
- opts.path = parts[1];
14827
+ const i = opts.path.indexOf(":");
14828
+ if (i === -1) {
14829
+ opts.socketPath = opts.path;
14830
+ opts.path = "";
14831
+ } else {
14832
+ opts.socketPath = opts.path.slice(0, i);
14833
+ opts.path = opts.path.slice(i + 1);
14834
+ }
14797
14835
  }
14798
14836
  let req;
14799
14837
  if (opts.followRedirects) {
@@ -14937,6 +14975,7 @@ var require_websocket = __commonJS({
14937
14975
  } else {
14938
14976
  req.end();
14939
14977
  }
14978
+ return opts;
14940
14979
  }
14941
14980
  function emitErrorAndClose(websocket, err) {
14942
14981
  websocket._readyState = WebSocket2.CLOSING;
@@ -14953,7 +14992,7 @@ var require_websocket = __commonJS({
14953
14992
  if (!options2.servername && options2.servername !== "") {
14954
14993
  options2.servername = net.isIP(options2.host) ? "" : options2.host;
14955
14994
  }
14956
- return tls.connect(options2);
14995
+ return tls2.connect(options2);
14957
14996
  }
14958
14997
  function abortHandshake(websocket, stream4, message) {
14959
14998
  websocket._readyState = WebSocket2.CLOSING;
@@ -14988,8 +15027,13 @@ var require_websocket = __commonJS({
14988
15027
  function receiverOnConclude(code, reason) {
14989
15028
  const websocket = this[kWebSocket];
14990
15029
  websocket._closeFrameReceived = true;
14991
- websocket._closeMessage = reason;
14992
15030
  websocket._closeCode = code;
15031
+ if (reason.length === 0) {
15032
+ websocket._closeMessage = EMPTY_BUFFER;
15033
+ } else {
15034
+ websocket._closeMessage = Buffer.allocUnsafeSlow(reason.length);
15035
+ websocket._closeMessage.set(reason);
15036
+ }
14993
15037
  if (websocket._socket[kWebSocket] === void 0) return;
14994
15038
  websocket._socket.removeListener("data", socketOnData);
14995
15039
  process.nextTick(resume, websocket._socket);
@@ -15020,9 +15064,19 @@ var require_websocket = __commonJS({
15020
15064
  }
15021
15065
  function receiverOnPing(data) {
15022
15066
  const websocket = this[kWebSocket];
15023
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
15067
+ if (websocket._autoPong && websocket.readyState === WebSocket2.OPEN) {
15068
+ if (websocket._maxPendingAutoPongs > 0 && websocket._pendingAutoPongs >= websocket._maxPendingAutoPongs) {
15069
+ websocket.terminate();
15070
+ } else {
15071
+ websocket._pendingAutoPongs++;
15072
+ websocket.pong(data, !this._isServer, websocket._autoPongComplete);
15073
+ }
15074
+ }
15024
15075
  websocket.emit("ping", data);
15025
15076
  }
15077
+ function autoPongComplete(websocket) {
15078
+ websocket._pendingAutoPongs--;
15079
+ }
15026
15080
  function receiverOnPong(data) {
15027
15081
  this[kWebSocket].emit("pong", data);
15028
15082
  }
@@ -15276,6 +15330,8 @@ var require_websocket_server = __commonJS({
15276
15330
  * fragments
15277
15331
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
15278
15332
  * size
15333
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
15334
+ * pending automatic pongs
15279
15335
  * @param {Boolean} [options.noServer=false] Enable no server mode
15280
15336
  * @param {String} [options.path] Accept only connections matching this path
15281
15337
  * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
@@ -15298,6 +15354,7 @@ var require_websocket_server = __commonJS({
15298
15354
  maxBufferedChunks: 256 * 1024,
15299
15355
  maxFragments: 16 * 1024,
15300
15356
  maxPayload: 100 * 1024 * 1024,
15357
+ maxPendingAutoPongs: 60,
15301
15358
  skipUTF8Validation: false,
15302
15359
  perMessageDeflate: false,
15303
15360
  handleProtocols: null,
@@ -38854,6 +38911,7 @@ function resolveConfig(env = process.env, opts = {}) {
38854
38911
  apiKey,
38855
38912
  username: stored?.username,
38856
38913
  insecureTls: env.TERMIX_INSECURE_TLS === "true",
38914
+ caFile: env.TERMIX_CA_FILE || void 0,
38857
38915
  requestTimeoutMs: timeoutMs
38858
38916
  };
38859
38917
  }
@@ -39044,10 +39102,16 @@ var isPlainObject2 = (val) => {
39044
39102
  return false;
39045
39103
  }
39046
39104
  const prototype2 = getPrototypeOf(val);
39047
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
39048
- // evidence the value is tagged/iterable, while ignoring members reachable
39049
- // only through shared or terminal prototype boundaries.
39050
- !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
39105
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
39106
+ // value is tagged/iterable, ignoring members reachable only through shared
39107
+ // or terminal prototype boundaries. This is exactly what
39108
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
39109
+ // above (null, Object.prototype, or a terminal null-prototype template) is
39110
+ // a boundary, so the walk never inspects anything but `val`'s own members,
39111
+ // and stops before even those when `val` is itself the boundary
39112
+ // Object.prototype. Checking that inline avoids allocating the walker's
39113
+ // `seen` list twice per call on the mergeConfig / merge hot path.
39114
+ (isPrototypeBoundary(val, prototype2, true) || !hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator));
39051
39115
  };
39052
39116
  var isEmptyObject = (val) => {
39053
39117
  if (!isObject2(val) || isBuffer(val)) {
@@ -39148,11 +39212,21 @@ var isContextDefined = (context) => !isUndefined(context) && context !== _global
39148
39212
  function merge2(...objs) {
39149
39213
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
39150
39214
  const result = {};
39215
+ const lowerCaseKeys = caseless ? /* @__PURE__ */ Object.create(null) : null;
39151
39216
  const assignValue = (val, key) => {
39152
39217
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
39153
39218
  return;
39154
39219
  }
39155
- const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
39220
+ let targetKey = key;
39221
+ if (lowerCaseKeys && typeof key === "string") {
39222
+ const lowerKey = key.toLowerCase();
39223
+ const knownKey = lowerCaseKeys[lowerKey];
39224
+ if (knownKey !== void 0 && hasOwnProperty(result, knownKey)) {
39225
+ targetKey = knownKey;
39226
+ } else {
39227
+ lowerCaseKeys[lowerKey] = key;
39228
+ }
39229
+ }
39156
39230
  const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
39157
39231
  if (isPlainObject2(existing) && isPlainObject2(val)) {
39158
39232
  result[targetKey] = merge2(existing, val);
@@ -39170,7 +39244,7 @@ function merge2(...objs) {
39170
39244
  continue;
39171
39245
  }
39172
39246
  forEach(source, assignValue);
39173
- if (typeof source !== "object" || isArray(source)) {
39247
+ if (typeof source !== "object" || isArray(source) || !Object.getOwnPropertySymbols) {
39174
39248
  continue;
39175
39249
  }
39176
39250
  const symbols = Object.getOwnPropertySymbols(source);
@@ -39266,7 +39340,24 @@ var toArray = (thing) => {
39266
39340
  if (!thing) return null;
39267
39341
  if (isArray(thing)) return thing;
39268
39342
  let i = thing.length;
39269
- if (!isNumber(i)) return null;
39343
+ if (!Number.isSafeInteger(i) || i < 0 || i > 4294967295) return null;
39344
+ const indexes = /* @__PURE__ */ new Set();
39345
+ const seen = /* @__PURE__ */ new Set();
39346
+ let source = thing;
39347
+ while (source != null && indexes.size < i) {
39348
+ if (seen.has(source)) return null;
39349
+ seen.add(source);
39350
+ const prototype2 = getPrototypeOf(source);
39351
+ if (isPrototypeBoundary(source, prototype2, source === thing)) break;
39352
+ Object.getOwnPropertyNames(source).forEach((key) => {
39353
+ const index = +key;
39354
+ if (Number.isInteger(index) && index >= 0 && index < i && String(index) === key && hasOwnProperty(source, key)) {
39355
+ indexes.add(index);
39356
+ }
39357
+ });
39358
+ source = prototype2;
39359
+ }
39360
+ if (indexes.size !== i) return null;
39270
39361
  const arr = new Array(i);
39271
39362
  while (i-- > 0) {
39272
39363
  arr[i] = thing[i];
@@ -39498,7 +39589,7 @@ var ignoreDuplicateOf = utils_default.toObjectSet([
39498
39589
  "user-agent"
39499
39590
  ]);
39500
39591
  var parseHeaders_default = (rawHeaders) => {
39501
- const parsed = {};
39592
+ const parsed = /* @__PURE__ */ Object.create(null);
39502
39593
  let key;
39503
39594
  let val;
39504
39595
  let i;
@@ -39666,9 +39757,11 @@ function parseParameters(value) {
39666
39757
  return parameters;
39667
39758
  }
39668
39759
  var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
39760
+ var PROTO_HEADER_SLOT = "__Proto__";
39761
+ var headerSlot = (name) => name === "__proto__" ? PROTO_HEADER_SLOT : name;
39669
39762
  function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
39670
39763
  if (utils_default.isFunction(filter2)) {
39671
- return filter2.call(this, value, header);
39764
+ return filter2.call(context, value, header);
39672
39765
  }
39673
39766
  if (isHeaderNameFilter) {
39674
39767
  value = header;
@@ -39713,7 +39806,7 @@ var AxiosHeaders = class {
39713
39806
  }
39714
39807
  const key = utils_default.findKey(self2, lHeader);
39715
39808
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
39716
- self2[key || _header] = normalizeValue(_value);
39809
+ self2[headerSlot(key || _header)] = normalizeValue(_value);
39717
39810
  }
39718
39811
  }
39719
39812
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -39806,7 +39899,7 @@ var AxiosHeaders = class {
39806
39899
  }
39807
39900
  normalize(format) {
39808
39901
  const self2 = this;
39809
- const headers = {};
39902
+ const headers = /* @__PURE__ */ Object.create(null);
39810
39903
  utils_default.forEach(this, (value, header) => {
39811
39904
  const key = utils_default.findKey(headers, header);
39812
39905
  if (key) {
@@ -39814,7 +39907,7 @@ var AxiosHeaders = class {
39814
39907
  delete self2[header];
39815
39908
  return;
39816
39909
  }
39817
- const normalized = format ? formatHeader(header) : String(header).trim();
39910
+ const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
39818
39911
  if (normalized !== header) {
39819
39912
  delete self2[header];
39820
39913
  }
@@ -39964,6 +40057,28 @@ function aggregateErrorMessage(error62) {
39964
40057
  }).filter(Boolean).join("; ");
39965
40058
  return message || error62.name || "AggregateError";
39966
40059
  }
40060
+ var CAUSED_BY_SEPARATOR = "\nCaused by: ";
40061
+ var $causeStack = /* @__PURE__ */ Symbol("causeStack");
40062
+ function getCauseStackIndex(error62, stack) {
40063
+ const causeStack = utils_default.hasOwnProp(error62, $causeStack) && error62[$causeStack];
40064
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
40065
+ }
40066
+ function appendCauseStack(target, source) {
40067
+ try {
40068
+ const sourceStack = source && source.stack;
40069
+ if (typeof sourceStack !== "string" || !sourceStack) {
40070
+ return;
40071
+ }
40072
+ const targetStack = target.stack;
40073
+ if (typeof targetStack !== "string" || !targetStack) {
40074
+ return;
40075
+ }
40076
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
40077
+ target.stack = targetStack + causeStack;
40078
+ Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
40079
+ } catch (e) {
40080
+ }
40081
+ }
39967
40082
  var AxiosError = class _AxiosError extends Error {
39968
40083
  static from(error62, code, config2, request, response, customProps) {
39969
40084
  let message = error62.message;
@@ -39979,6 +40094,7 @@ var AxiosError = class _AxiosError extends Error {
39979
40094
  configurable: true
39980
40095
  });
39981
40096
  axiosError.name = error62.name;
40097
+ appendCauseStack(axiosError, error62);
39982
40098
  if (error62.status != null && axiosError.status == null) {
39983
40099
  axiosError.status = error62.status;
39984
40100
  }
@@ -40290,6 +40406,12 @@ function trimHandlers(handlers) {
40290
40406
  handlers.pop();
40291
40407
  }
40292
40408
  }
40409
+ function normalizeHandlerId(id) {
40410
+ if (typeof id === "string" && id !== "" && String(Number(id)) === id) {
40411
+ return Number(id);
40412
+ }
40413
+ return id;
40414
+ }
40293
40415
  function syncHandlerEntries(manager, internals) {
40294
40416
  const handlers = manager.handlers;
40295
40417
  const length = countHandlers(handlers);
@@ -40360,9 +40482,10 @@ var InterceptorManager = class {
40360
40482
  eject(id) {
40361
40483
  const internals = this[$internals2];
40362
40484
  syncHandlerEntries(this, internals);
40363
- const entry = internals.handlerEntries.get(id);
40485
+ const handlerId = normalizeHandlerId(id);
40486
+ const entry = internals.handlerEntries.get(handlerId);
40364
40487
  if (entry) {
40365
- internals.handlerEntries.delete(id);
40488
+ internals.handlerEntries.delete(handlerId);
40366
40489
  if (this.handlers[entry.index] !== entry.handler) {
40367
40490
  return;
40368
40491
  }
@@ -40422,7 +40545,8 @@ var transitional_default = {
40422
40545
  clarifyTimeoutError: false,
40423
40546
  legacyInterceptorReqResOrdering: true,
40424
40547
  advertiseZstdAcceptEncoding: false,
40425
- validateStatusUndefinedResolves: true
40548
+ validateStatusUndefinedResolves: true,
40549
+ encodeBasicAuthUsername: false
40426
40550
  };
40427
40551
 
40428
40552
  // node_modules/axios/lib/platform/node/index.js
@@ -40532,6 +40656,24 @@ function arrayToObject(arr) {
40532
40656
  }
40533
40657
  return obj;
40534
40658
  }
40659
+ function normalizeArray(value) {
40660
+ if (!utils_default.isArray(value)) return value;
40661
+ const keys = Object.keys(value);
40662
+ return keys.length !== value.length || keys.some((key, index) => key !== String(index)) ? arrayToObject(value) : value;
40663
+ }
40664
+ function normalizeArrays(obj) {
40665
+ const pending = [obj];
40666
+ while (pending.length) {
40667
+ const target = pending.pop();
40668
+ Object.keys(target).forEach((key) => {
40669
+ const value = target[key] = normalizeArray(target[key]);
40670
+ if (utils_default.isArray(value) || utils_default.isPlainObject(value)) {
40671
+ pending.push(value);
40672
+ }
40673
+ });
40674
+ }
40675
+ return obj;
40676
+ }
40535
40677
  function formDataToJSON(formData) {
40536
40678
  function buildPath(path4, value, target, index) {
40537
40679
  throwIfDepthExceeded(index);
@@ -40542,6 +40684,7 @@ function formDataToJSON(formData) {
40542
40684
  name = !name && utils_default.isArray(target) ? target.length : name;
40543
40685
  if (isLast) {
40544
40686
  if (utils_default.hasOwnProp(target, name)) {
40687
+ target[name] = normalizeArray(target[name]);
40545
40688
  target[name] = utils_default.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
40546
40689
  } else {
40547
40690
  target[name] = value;
@@ -40562,7 +40705,7 @@ function formDataToJSON(formData) {
40562
40705
  utils_default.forEachEntry(formData, (name, value) => {
40563
40706
  buildPath(parsePropPath(name), value, obj, 0);
40564
40707
  });
40565
- return obj;
40708
+ return normalizeArrays(obj);
40566
40709
  }
40567
40710
  return null;
40568
40711
  }
@@ -40910,16 +41053,16 @@ import { resolve as resolvePath } from "path";
40910
41053
  import zlib from "zlib";
40911
41054
 
40912
41055
  // node_modules/axios/lib/env/data.js
40913
- var VERSION = "1.20.0";
41056
+ var VERSION = "1.21.1";
40914
41057
 
40915
41058
  // node_modules/axios/lib/helpers/parseProtocol.js
40916
41059
  function parseProtocol(url3) {
40917
41060
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url3);
40918
- return match && match[1] || "";
41061
+ return match && match[1].toLowerCase() || "";
40919
41062
  }
40920
41063
 
40921
41064
  // node_modules/axios/lib/helpers/fromDataURI.js
40922
- var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
41065
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/i;
40923
41066
  function fromDataURI(uri, asBlob, options2) {
40924
41067
  const _Blob = options2 && options2.Blob || platform_default.classes.Blob;
40925
41068
  const protocol = parseProtocol(uri);
@@ -40942,7 +41085,10 @@ function fromDataURI(uri, asBlob, options2) {
40942
41085
  } else if (params) {
40943
41086
  mime = "text/plain" + params;
40944
41087
  }
40945
- const buffer = encoding === "base64" ? Buffer.from(body, "base64") : Buffer.from(decodeURIComponent(body), encoding);
41088
+ const buffer = encoding === "base64" ? Buffer.from(
41089
+ body.replace(/%([\da-f]{2})/gi, (_, hex3) => String.fromCharCode(parseInt(hex3, 16))),
41090
+ "base64"
41091
+ ) : Buffer.from(decodeURIComponent(body), encoding);
40946
41092
  if (asBlob) {
40947
41093
  if (!_Blob) {
40948
41094
  throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
@@ -41028,7 +41174,10 @@ var AxiosTransformStream = class extends stream.Transform {
41028
41174
  const timeWindow = internals.timeWindow;
41029
41175
  const divider = 1e3 / timeWindow;
41030
41176
  const bytesThreshold = maxRate / divider;
41031
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
41177
+ let minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
41178
+ if (maxRate) {
41179
+ minChunkSize = Math.min(bytesThreshold, minChunkSize);
41180
+ }
41032
41181
  const pushChunk = (_chunk, _callback) => {
41033
41182
  const bytes = Buffer.byteLength(_chunk);
41034
41183
  internals.bytesSeen += bytes;
@@ -41044,6 +41193,9 @@ var AxiosTransformStream = class extends stream.Transform {
41044
41193
  }
41045
41194
  };
41046
41195
  const transformChunk = (_chunk, _callback) => {
41196
+ if (this.destroyed) {
41197
+ return _callback();
41198
+ }
41047
41199
  const chunkSize = Buffer.byteLength(_chunk);
41048
41200
  let chunkRemainder = null;
41049
41201
  let maxChunkSize = readableHighWaterMark;
@@ -41066,7 +41218,7 @@ var AxiosTransformStream = class extends stream.Transform {
41066
41218
  }, timeWindow - passed);
41067
41219
  }
41068
41220
  if (bytesLeft < maxChunkSize) {
41069
- maxChunkSize = bytesLeft;
41221
+ maxChunkSize = Math.max(1, Math.floor(bytesLeft));
41070
41222
  }
41071
41223
  }
41072
41224
  if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
@@ -41124,9 +41276,9 @@ var CRLF_BYTES = textEncoder.encode(CRLF);
41124
41276
  var CRLF_BYTES_COUNT = 2;
41125
41277
  var FormDataPart = class {
41126
41278
  constructor(name, value) {
41127
- const { escapeName } = this.constructor;
41279
+ const { escapeName: escapeName2 } = this.constructor;
41128
41280
  const isStringValue = utils_default.isString(value);
41129
- let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`;
41281
+ let headers = `Content-Disposition: form-data; name="${escapeName2(name)}"${!isStringValue && value.name ? `; filename="${escapeName2(value.name)}"` : ""}${CRLF}`;
41130
41282
  if (isStringValue) {
41131
41283
  value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
41132
41284
  } else {
@@ -41287,7 +41439,7 @@ var Http2Sessions = class {
41287
41439
  timer = null;
41288
41440
  }
41289
41441
  stream4.once("close", () => {
41290
- if (!--streamsCount) {
41442
+ if (!--streamsCount && !removed) {
41291
41443
  timer = setTimeout(() => {
41292
41444
  timer = null;
41293
41445
  removeSession();
@@ -41299,6 +41451,7 @@ var Http2Sessions = class {
41299
41451
  }
41300
41452
  session.once("close", removeSession);
41301
41453
  session.once("error", removeSession);
41454
+ session.once("goaway", removeSession);
41302
41455
  let entry = [session, options2];
41303
41456
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
41304
41457
  return session;
@@ -41322,6 +41475,7 @@ var callbackify = (fn, reducer) => {
41322
41475
  var callbackify_default = callbackify;
41323
41476
 
41324
41477
  // node_modules/axios/lib/helpers/shouldBypassProxy.js
41478
+ import { domainToASCII } from "url";
41325
41479
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
41326
41480
  var trimTrailingDots = (value) => {
41327
41481
  let end = value.length;
@@ -41515,7 +41669,20 @@ var normalizeNoProxyHost = (hostname3) => {
41515
41669
  if (hostname3.charAt(0) === "[" && hostname3.charAt(hostname3.length - 1) === "]") {
41516
41670
  hostname3 = hostname3.slice(1, -1);
41517
41671
  }
41518
- const trimmed = trimTrailingDots(hostname3);
41672
+ let trimmed = trimTrailingDots(hostname3);
41673
+ if (trimmed.indexOf(":") !== -1) {
41674
+ try {
41675
+ trimmed = new URL("http://[" + trimmed + "]/").hostname.slice(1, -1);
41676
+ } catch (_err) {
41677
+ return trimmed;
41678
+ }
41679
+ } else if (/[\u0080-\uffff]/.test(trimmed)) {
41680
+ const prefix = /^[*.]+/.exec(trimmed);
41681
+ const start = prefix ? prefix[0] : "";
41682
+ const ascii = domainToASCII(trimmed.slice(start.length));
41683
+ if (!ascii) return "";
41684
+ trimmed = start + trimTrailingDots(ascii);
41685
+ }
41519
41686
  const ipv43 = normalizeIPAddress(trimmed);
41520
41687
  if (ipv43 !== trimmed) {
41521
41688
  return ipv43;
@@ -41786,6 +41953,26 @@ var estimateBase64BufferAllocation = (body) => {
41786
41953
  }
41787
41954
  return Math.floor((len - padding) * 3 / 4);
41788
41955
  };
41956
+ var estimatePercentDecodedBase64BufferAllocation = (body) => {
41957
+ if (body.indexOf("%") === -1) {
41958
+ return estimateBase64BufferAllocation(body);
41959
+ }
41960
+ let length = 0;
41961
+ let previous = 0;
41962
+ let last = 0;
41963
+ for (let i = 0, len = body.length; i < len; i++) {
41964
+ let code = body.charCodeAt(i);
41965
+ if (code === 37 && isPercentEncodedByte(body, i, len)) {
41966
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
41967
+ i += 2;
41968
+ }
41969
+ length++;
41970
+ previous = last;
41971
+ last = code;
41972
+ }
41973
+ const padding = last === 61 ? previous === 61 ? 2 : 1 : 0;
41974
+ return Math.floor((length - padding) * 3 / 4);
41975
+ };
41789
41976
  var estimatePercentDecodedBase64Bytes = (body) => {
41790
41977
  const len = body.length;
41791
41978
  let significant = 0;
@@ -41815,14 +42002,14 @@ var estimatePercentDecodedBase64Bytes = (body) => {
41815
42002
  }
41816
42003
  return base64Bytes(significant);
41817
42004
  };
41818
- var estimateDataURLBytes = (url3, estimateBase64) => {
42005
+ var estimateDataURLBytes = (url3, estimateBase64, base64Pattern) => {
41819
42006
  if (!url3 || typeof url3 !== "string") return 0;
41820
- if (!url3.startsWith("data:")) return 0;
42007
+ if (!/^data:/i.test(url3)) return 0;
41821
42008
  const comma = url3.indexOf(",");
41822
42009
  if (comma < 0) return 0;
41823
42010
  const meta3 = url3.slice(5, comma);
41824
42011
  const body = url3.slice(comma + 1);
41825
- const isBase64 = /;base64/i.test(meta3);
42012
+ const isBase64 = base64Pattern.test(meta3);
41826
42013
  if (isBase64) {
41827
42014
  return estimateBase64(body);
41828
42015
  }
@@ -41854,11 +42041,12 @@ function estimateDataURLDecodedBytes(url3) {
41854
42041
  const fragmentIndex = typeof url3 === "string" ? url3.indexOf("#") : -1;
41855
42042
  return estimateDataURLBytes(
41856
42043
  fragmentIndex === -1 ? url3 : url3.slice(0, fragmentIndex),
41857
- estimatePercentDecodedBase64Bytes
42044
+ estimatePercentDecodedBase64Bytes,
42045
+ /; *base64[\t\n\f\r ]*$/i
41858
42046
  );
41859
42047
  }
41860
42048
  function estimateDataURLBufferAllocation(url3) {
41861
- return estimateDataURLBytes(url3, estimateBase64BufferAllocation);
42049
+ return estimateDataURLBytes(url3, estimatePercentDecodedBase64BufferAllocation, /;base64$/i);
41862
42050
  }
41863
42051
 
41864
42052
  // node_modules/axios/lib/adapters/http.js
@@ -41892,6 +42080,18 @@ function handleSocketError(err) {
41892
42080
  var kAxiosInstalledTunnel = /* @__PURE__ */ Symbol("axios.http.installedTunnel");
41893
42081
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
41894
42082
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
42083
+ var directAgents = /* @__PURE__ */ new WeakMap();
42084
+ var directAgentHooks = ["createConnection", "getName"];
42085
+ var nativeAgentPoolHooks = [
42086
+ "addRequest",
42087
+ "createSocket",
42088
+ "removeSocket",
42089
+ "keepSocketAlive",
42090
+ "reuseSocket",
42091
+ "_getSession",
42092
+ "_cacheSession",
42093
+ "_evictSession"
42094
+ ];
41895
42095
  var NODE_NATIVE_ENV_PROXY_SUPPORT = {
41896
42096
  22: 21,
41897
42097
  24: 5
@@ -41921,6 +42121,49 @@ function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.
41921
42121
  function getProxyEnvAgent(options2, configHttpAgent, configHttpsAgent) {
41922
42122
  return isHttps.test(options2.protocol) ? configHttpsAgent || https.globalAgent : configHttpAgent || http.globalAgent;
41923
42123
  }
42124
+ function getDirectAgent(configuredAgent, transport) {
42125
+ if (!process.allowedNodeEnvironmentFlags || !process.allowedNodeEnvironmentFlags.has("--use-env-proxy")) {
42126
+ return configuredAgent;
42127
+ }
42128
+ const agent = configuredAgent || transport.globalAgent;
42129
+ const options2 = agent && agent.options;
42130
+ if (!(agent instanceof transport.Agent) || agent.protocol !== transport.globalAgent.protocol || !options2 || !utils_default.hasOwnProp(options2, "proxyEnv") || typeof options2.proxyEnv !== "object" || options2.proxyEnv === null) {
42131
+ return configuredAgent;
42132
+ }
42133
+ for (const hook of nativeAgentPoolHooks) {
42134
+ if (utils_default.isFunction(transport.Agent.prototype[hook]) && agent[hook] !== transport.Agent.prototype[hook]) {
42135
+ throw new AxiosError_default(
42136
+ "proxy: false cannot adapt an agent overriding " + hook + "; use an agent constructed without proxyEnv",
42137
+ AxiosError_default.ERR_BAD_OPTION_VALUE
42138
+ );
42139
+ }
42140
+ }
42141
+ let direct = directAgents.get(agent);
42142
+ if (!direct) {
42143
+ direct = new transport.Agent({ ...options2, proxyEnv: void 0 });
42144
+ const destroy = agent.destroy;
42145
+ agent.destroy = function destroyWithDirectAgent() {
42146
+ try {
42147
+ return destroy.apply(this, arguments);
42148
+ } finally {
42149
+ direct.destroy();
42150
+ }
42151
+ };
42152
+ directAgents.set(agent, direct);
42153
+ }
42154
+ for (const hook of directAgentHooks) {
42155
+ direct[hook] = agent[hook] === transport.Agent.prototype[hook] ? transport.Agent.prototype[hook] : bind(agent[hook], agent);
42156
+ }
42157
+ return direct;
42158
+ }
42159
+ function setDirectAgent(options2, configHttpAgent, configHttpsAgent) {
42160
+ const secure = isHttps.test(options2.protocol);
42161
+ const agent = getDirectAgent(secure ? configHttpsAgent : configHttpAgent, secure ? https : http);
42162
+ options2.agent = agent;
42163
+ if (options2.agents) {
42164
+ options2.agents[secure ? "https" : "http"] = agent;
42165
+ }
42166
+ }
41924
42167
  function getTunnelingAgent(agentOptions, userHttpsAgent) {
41925
42168
  const key = agentOptions.protocol + "//" + agentOptions.hostname + ":" + (agentOptions.port || "") + "#" + (agentOptions.auth || "");
41926
42169
  const cache2 = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, /* @__PURE__ */ new Map()).get(userHttpsAgent) : tunnelingAgentCache;
@@ -41928,13 +42171,12 @@ function getTunnelingAgent(agentOptions, userHttpsAgent) {
41928
42171
  if (agent) return agent;
41929
42172
  const merged = userHttpsAgent && userHttpsAgent.options ? { ...userHttpsAgent.options, ...agentOptions } : agentOptions;
41930
42173
  agent = new import_https_proxy_agent.default(merged);
41931
- if (userHttpsAgent && userHttpsAgent.options) {
41932
- const originTLSOptions = { ...userHttpsAgent.options };
41933
- const callback = agent.callback;
41934
- agent.callback = function axiosTunnelingAgentCallback(req, opts) {
41935
- return callback.call(this, req, { ...originTLSOptions, ...opts });
41936
- };
41937
- }
42174
+ const callback = agent.callback;
42175
+ agent.callback = function axiosTunnelingAgentCallback(req, opts) {
42176
+ const originTLSAgent = userHttpsAgent || https.globalAgent;
42177
+ const originTLSOptions = originTLSAgent && originTLSAgent.options;
42178
+ return callback.call(this, req, { ...originTLSOptions, ...opts });
42179
+ };
41938
42180
  agent[kAxiosInstalledTunnel] = true;
41939
42181
  cache2.set(key, agent);
41940
42182
  return agent;
@@ -41958,6 +42200,10 @@ var flushOnFinish = (stream4, [throttled, flush]) => {
41958
42200
  };
41959
42201
  var http2Sessions = new Http2Sessions_default();
41960
42202
  function dispatchBeforeRedirect(options2, responseDetails, requestDetails) {
42203
+ if (!isSameOriginRedirect(options2, requestDetails)) {
42204
+ stripMatchingHeaders(options2.headers, /* @__PURE__ */ new Set(["authorization", "cookie"]));
42205
+ delete options2.auth;
42206
+ }
41961
42207
  if (options2.beforeRedirects.proxy) {
41962
42208
  options2.beforeRedirects.proxy(options2);
41963
42209
  }
@@ -41967,6 +42213,9 @@ function dispatchBeforeRedirect(options2, responseDetails, requestDetails) {
41967
42213
  if (options2.beforeRedirects.sensitiveHeaders) {
41968
42214
  options2.beforeRedirects.sensitiveHeaders(options2, requestDetails);
41969
42215
  }
42216
+ if (options2.beforeRedirects.direct) {
42217
+ options2.beforeRedirects.direct(options2);
42218
+ }
41970
42219
  if (options2.beforeRedirects.config) {
41971
42220
  options2.beforeRedirects.config(options2, responseDetails, requestDetails);
41972
42221
  }
@@ -42012,6 +42261,9 @@ function setProxy(options2, configProxy, location, isRedirect, configHttpsAgent,
42012
42261
  if (isRedirect && options2.agent && options2.agent[kAxiosInstalledTunnel]) {
42013
42262
  options2.agent = void 0;
42014
42263
  }
42264
+ if (isRedirect && options2.agents && options2.agents.https && options2.agents.https[kAxiosInstalledTunnel]) {
42265
+ options2.agents.https = configHttpsAgent;
42266
+ }
42015
42267
  if (proxy) {
42016
42268
  const isProxyURL = proxy instanceof URL;
42017
42269
  const readProxyField = (key) => isProxyURL || utils_default.hasOwnProp(proxy, key) ? proxy[key] : void 0;
@@ -42192,9 +42444,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
42192
42444
  if (httpVersion === void 0) httpVersion = 1;
42193
42445
  const rawHttpVersion = httpVersion;
42194
42446
  let http2Options = own3("http2Options");
42447
+ const configProxy = own3("proxy");
42195
42448
  const httpAgent = own3("httpAgent");
42196
42449
  const httpsAgent = own3("httpsAgent");
42197
- const configProxy = own3("proxy");
42198
42450
  const responseType = own3("responseType");
42199
42451
  const responseEncoding = own3("responseEncoding");
42200
42452
  const socketPath = own3("socketPath");
@@ -42333,6 +42585,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
42333
42585
  } catch (err) {
42334
42586
  throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST, config2);
42335
42587
  }
42588
+ if (maxContentLength > -1 && (responseType === "blob" ? convertedData.size : convertedData.length) > maxContentLength) {
42589
+ return reject(
42590
+ new AxiosError_default(
42591
+ "maxContentLength size of " + maxContentLength + " exceeded",
42592
+ AxiosError_default.ERR_BAD_RESPONSE,
42593
+ config2
42594
+ )
42595
+ );
42596
+ }
42336
42597
  if (responseType === "text") {
42337
42598
  convertedData = convertedData.toString(responseEncoding);
42338
42599
  if (!responseEncoding || responseEncoding === "utf8") {
@@ -42535,9 +42796,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
42535
42796
  }
42536
42797
  let transport;
42537
42798
  let isNativeTransport = false;
42538
- let transportEnforcesMaxBodyLength = false;
42539
42799
  const isHttpsRequest = isHttps.test(options2.protocol);
42540
- if (options2.agent == null) {
42800
+ if (!isHttp2 && configProxy === false) {
42801
+ setDirectAgent(options2, httpAgent, httpsAgent);
42802
+ options2.beforeRedirects.direct = (redirectOptions) => {
42803
+ setDirectAgent(redirectOptions, httpAgent, httpsAgent);
42804
+ };
42805
+ } else if (options2.agent == null) {
42541
42806
  options2.agent = isHttpsRequest ? httpsAgent : httpAgent;
42542
42807
  }
42543
42808
  if (isHttp2) {
@@ -42559,7 +42824,6 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
42559
42824
  transport = isHttpsRequest ? https : http;
42560
42825
  isNativeTransport = true;
42561
42826
  } else {
42562
- transportEnforcesMaxBodyLength = true;
42563
42827
  options2.sensitiveHeaders = [];
42564
42828
  if (maxRedirects) {
42565
42829
  options2.maxRedirects = maxRedirects;
@@ -42845,7 +43109,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
42845
43109
  }
42846
43110
  });
42847
43111
  let uploadStream = data;
42848
- if (maxBodyLength > -1 && !transportEnforcesMaxBodyLength) {
43112
+ if (maxBodyLength > -1) {
42849
43113
  const limit = maxBodyLength;
42850
43114
  let bytesSent = 0;
42851
43115
  uploadStream = stream3.pipeline(
@@ -42882,16 +43146,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
42882
43146
  });
42883
43147
  };
42884
43148
 
42885
- // node_modules/axios/lib/helpers/isURLSameOrigin.js
42886
- var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url3) => {
42887
- url3 = new URL(url3, platform_default.origin);
42888
- return origin2.protocol === url3.protocol && origin2.host === url3.host && (isMSIE || origin2.port === url3.port);
42889
- })(
42890
- new URL(platform_default.origin),
42891
- platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)
42892
- ) : () => true;
42893
-
42894
43149
  // node_modules/axios/lib/helpers/cookies.js
43150
+ var decodeCookieValue = (value) => {
43151
+ try {
43152
+ return decodeURIComponent(value);
43153
+ } catch (e) {
43154
+ return value;
43155
+ }
43156
+ };
42895
43157
  var cookies_default = platform_default.hasStandardBrowserEnv ? (
42896
43158
  // Standard browser envs support document.cookie
42897
43159
  {
@@ -42917,20 +43179,29 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
42917
43179
  },
42918
43180
  read(name) {
42919
43181
  if (typeof document === "undefined") return null;
42920
- const cookies = document.cookie.split(";");
43182
+ const cookieString = document.cookie;
43183
+ if (!cookieString) return null;
43184
+ const cookies = cookieString.split(";");
42921
43185
  for (let i = 0; i < cookies.length; i++) {
42922
43186
  const cookie = cookies[i].replace(/^\s+/, "");
42923
43187
  const eq = cookie.indexOf("=");
42924
43188
  if (eq !== -1 && cookie.slice(0, eq) === name) {
42925
- try {
42926
- return decodeURIComponent(cookie.slice(eq + 1));
42927
- } catch (e) {
42928
- return cookie.slice(eq + 1);
42929
- }
43189
+ return decodeCookieValue(cookie.slice(eq + 1));
42930
43190
  }
42931
43191
  }
42932
43192
  return null;
42933
43193
  },
43194
+ async readAsync(name) {
43195
+ try {
43196
+ const store = typeof window !== "undefined" && window.cookieStore;
43197
+ if (store && utils_default.isFunction(store.get)) {
43198
+ const cookie = await store.get(name);
43199
+ return cookie ? decodeCookieValue(cookie.value) : null;
43200
+ }
43201
+ } catch (e) {
43202
+ }
43203
+ return this.read(name);
43204
+ },
42934
43205
  remove(name) {
42935
43206
  this.write(name, "", Date.now() - 864e5, "/");
42936
43207
  }
@@ -42943,130 +43214,224 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
42943
43214
  read() {
42944
43215
  return null;
42945
43216
  },
43217
+ async readAsync() {
43218
+ return null;
43219
+ },
42946
43220
  remove() {
42947
43221
  }
42948
43222
  }
42949
43223
  );
42950
43224
 
43225
+ // node_modules/axios/lib/helpers/isURLSameOrigin.js
43226
+ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2) => (url3) => {
43227
+ url3 = new URL(url3, document.baseURI || platform_default.origin);
43228
+ return origin2.protocol === url3.protocol && origin2.host === url3.host && origin2.port === url3.port;
43229
+ })(new URL(platform_default.origin)) : () => true;
43230
+
43231
+ // node_modules/axios/lib/core/assertParamsAcyclic.js
43232
+ function assertParamsAcyclic(params) {
43233
+ const pending = [{ value: params }];
43234
+ const active = /* @__PURE__ */ new WeakSet();
43235
+ const visited = /* @__PURE__ */ new WeakSet();
43236
+ while (pending.length) {
43237
+ const { value, done } = pending.pop();
43238
+ if (!utils_default.isPlainObject(value) && !utils_default.isArray(value)) continue;
43239
+ if (done) {
43240
+ active.delete(value);
43241
+ continue;
43242
+ }
43243
+ if (active.has(value)) {
43244
+ throw new AxiosError_default(
43245
+ "Circular reference detected in params",
43246
+ AxiosError_default.ERR_BAD_OPTION_VALUE
43247
+ );
43248
+ }
43249
+ if (visited.has(value)) continue;
43250
+ visited.add(value);
43251
+ active.add(value);
43252
+ pending.push({ value, done: true });
43253
+ const keys = Object.keys(value);
43254
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
43255
+ Object.getOwnPropertySymbols(value).forEach((key) => {
43256
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
43257
+ if (descriptor && descriptor.enumerable) keys.push(key);
43258
+ });
43259
+ }
43260
+ keys.forEach((key) => {
43261
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
43262
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
43263
+ if (descriptor && utils_default.hasOwnProp(descriptor, "value")) {
43264
+ pending.push({ value: descriptor.value });
43265
+ }
43266
+ } else {
43267
+ pending.push({ value: value[key] });
43268
+ }
43269
+ });
43270
+ }
43271
+ }
43272
+
42951
43273
  // node_modules/axios/lib/core/mergeConfig.js
42952
43274
  var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
42953
43275
  var ownEnumerableKeys = (thing) => {
42954
43276
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
42955
43277
  return Object.keys(thing).concat(
42956
- Object.getOwnPropertySymbols(thing).filter(
42957
- (symbol2) => Object.getOwnPropertyDescriptor(thing, symbol2).enumerable
42958
- )
43278
+ Object.getOwnPropertySymbols(thing).filter((symbol2) => {
43279
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol2);
43280
+ return descriptor && descriptor.enumerable;
43281
+ })
42959
43282
  );
42960
43283
  }
42961
43284
  return Object.keys(thing);
42962
43285
  };
42963
- function mergeConfig(config1, config2) {
42964
- config1 = config1 || {};
42965
- config2 = config2 || {};
42966
- const config3 = /* @__PURE__ */ Object.create(null);
42967
- Object.defineProperty(config3, "hasOwnProperty", {
42968
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
42969
- // this data descriptor into an accessor descriptor on the way in.
42970
- __proto__: null,
42971
- value: Object.prototype.hasOwnProperty,
42972
- enumerable: false,
42973
- writable: true,
42974
- configurable: true
42975
- });
42976
- function getMergedValue(target, source, prop, caseless) {
42977
- if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
42978
- return utils_default.merge.call({ caseless }, target, source);
42979
- } else if (utils_default.isPlainObject(source)) {
42980
- return utils_default.merge({}, source);
42981
- } else if (utils_default.isArray(source)) {
42982
- return source.slice();
42983
- }
42984
- return source;
43286
+ function mergeParams(a, b) {
43287
+ const pending = [];
43288
+ const copies = /* @__PURE__ */ new WeakMap();
43289
+ const empty = {};
43290
+ function copy(target, source) {
43291
+ if (!utils_default.isPlainObject(source)) {
43292
+ return utils_default.isArray(source) ? source.slice() : source;
43293
+ }
43294
+ const base = utils_default.isPlainObject(target) ? target : empty;
43295
+ let bases = copies.get(source);
43296
+ if (!bases) {
43297
+ bases = /* @__PURE__ */ new WeakMap();
43298
+ copies.set(source, bases);
43299
+ }
43300
+ if (bases.has(base)) return bases.get(base);
43301
+ const result2 = {};
43302
+ bases.set(base, result2);
43303
+ pending.push({ base, source, result: result2 });
43304
+ return result2;
43305
+ }
43306
+ const result = utils_default.isUndefined(b) ? copy(void 0, a) : copy(a, b);
43307
+ while (pending.length) {
43308
+ const { base, source, result: target } = pending.pop();
43309
+ const baseKeys = new Set(ownEnumerableKeys(base));
43310
+ const sourceKeys = new Set(ownEnumerableKeys(source));
43311
+ const keys = /* @__PURE__ */ new Set([...baseKeys, ...sourceKeys]);
43312
+ keys.forEach((key) => {
43313
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return;
43314
+ const hasSource = sourceKeys.has(key);
43315
+ const value = hasSource ? source[key] : void 0;
43316
+ const previous = (!hasSource || utils_default.isPlainObject(value)) && baseKeys.has(key) ? base[key] : void 0;
43317
+ target[key] = hasSource ? copy(previous, value) : copy(void 0, previous);
43318
+ });
42985
43319
  }
42986
- function mergeDeepProperties(a, b, prop, caseless) {
42987
- if (!utils_default.isUndefined(b)) {
42988
- return getMergedValue(a, b, prop, caseless);
42989
- } else if (!utils_default.isUndefined(a)) {
42990
- return getMergedValue(void 0, a, prop, caseless);
42991
- }
43320
+ assertParamsAcyclic(result);
43321
+ return result;
43322
+ }
43323
+ function getMergedValue(target, source, prop, caseless) {
43324
+ if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
43325
+ return utils_default.merge.call({ caseless }, target, source);
43326
+ } else if (utils_default.isPlainObject(source)) {
43327
+ return utils_default.merge({}, source);
43328
+ } else if (utils_default.isArray(source)) {
43329
+ return source.slice();
42992
43330
  }
42993
- function valueFromConfig2(a, b) {
42994
- if (!utils_default.isUndefined(b)) {
42995
- return getMergedValue(void 0, b);
42996
- }
43331
+ return source;
43332
+ }
43333
+ function mergeDeepProperties(a, b, prop, caseless) {
43334
+ if (!utils_default.isUndefined(b)) {
43335
+ return getMergedValue(a, b, prop, caseless);
43336
+ } else if (!utils_default.isUndefined(a)) {
43337
+ return getMergedValue(void 0, a, prop, caseless);
42997
43338
  }
42998
- function defaultToConfig2(a, b) {
42999
- if (!utils_default.isUndefined(b)) {
43000
- return getMergedValue(void 0, b);
43001
- } else if (!utils_default.isUndefined(a)) {
43002
- return getMergedValue(void 0, a);
43003
- }
43339
+ }
43340
+ function valueFromConfig2(a, b) {
43341
+ if (!utils_default.isUndefined(b)) {
43342
+ return getMergedValue(void 0, b);
43004
43343
  }
43005
- function getMergedTransitionalOption(prop) {
43006
- const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
43007
- if (!utils_default.isUndefined(transitional2)) {
43008
- if (utils_default.isPlainObject(transitional2)) {
43009
- if (utils_default.hasOwnProp(transitional2, prop)) {
43010
- return transitional2[prop];
43011
- }
43012
- } else {
43013
- return void 0;
43344
+ }
43345
+ function defaultToConfig2(a, b) {
43346
+ if (!utils_default.isUndefined(b)) {
43347
+ return getMergedValue(void 0, b);
43348
+ } else if (!utils_default.isUndefined(a)) {
43349
+ return getMergedValue(void 0, a);
43350
+ }
43351
+ }
43352
+ function getMergedTransitionalOption(config1, config2, prop) {
43353
+ const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
43354
+ if (!utils_default.isUndefined(transitional2)) {
43355
+ if (utils_default.isPlainObject(transitional2)) {
43356
+ if (utils_default.hasOwnProp(transitional2, prop)) {
43357
+ return transitional2[prop];
43014
43358
  }
43359
+ } else {
43360
+ return void 0;
43015
43361
  }
43016
- const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
43017
- if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) {
43018
- return transitional1[prop];
43019
- }
43020
- return void 0;
43021
43362
  }
43022
- function mergeDirectKeys(a, b, prop) {
43023
- if (utils_default.hasOwnProp(config2, prop)) {
43024
- return getMergedValue(a, b);
43025
- } else if (utils_default.hasOwnProp(config1, prop)) {
43026
- return getMergedValue(void 0, a);
43027
- }
43028
- }
43029
- const mergeMap = {
43030
- url: valueFromConfig2,
43031
- method: valueFromConfig2,
43032
- data: valueFromConfig2,
43033
- baseURL: defaultToConfig2,
43034
- transformRequest: defaultToConfig2,
43035
- transformResponse: defaultToConfig2,
43036
- paramsSerializer: defaultToConfig2,
43037
- timeout: defaultToConfig2,
43038
- timeoutErrorMessage: defaultToConfig2,
43039
- withCredentials: defaultToConfig2,
43040
- withXSRFToken: defaultToConfig2,
43041
- adapter: defaultToConfig2,
43042
- responseType: defaultToConfig2,
43043
- xsrfCookieName: defaultToConfig2,
43044
- xsrfHeaderName: defaultToConfig2,
43045
- onUploadProgress: defaultToConfig2,
43046
- onDownloadProgress: defaultToConfig2,
43047
- decompress: defaultToConfig2,
43048
- maxContentLength: defaultToConfig2,
43049
- maxBodyLength: defaultToConfig2,
43050
- beforeRedirect: defaultToConfig2,
43051
- transport: defaultToConfig2,
43052
- httpAgent: defaultToConfig2,
43053
- httpsAgent: defaultToConfig2,
43054
- cancelToken: defaultToConfig2,
43055
- socketPath: defaultToConfig2,
43056
- allowedSocketPaths: defaultToConfig2,
43057
- responseEncoding: defaultToConfig2,
43058
- validateStatus: mergeDirectKeys,
43059
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
43060
- };
43061
- utils_default.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
43062
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
43363
+ const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
43364
+ if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) {
43365
+ return transitional1[prop];
43366
+ }
43367
+ return void 0;
43368
+ }
43369
+ function mergeDirectKeys(a, b, prop, config1, config2) {
43370
+ if (utils_default.hasOwnProp(config2, prop)) {
43371
+ return getMergedValue(a, b);
43372
+ } else if (utils_default.hasOwnProp(config1, prop)) {
43373
+ return getMergedValue(void 0, a);
43374
+ }
43375
+ }
43376
+ function mergeHeaders(a, b, prop) {
43377
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
43378
+ }
43379
+ var hasOwnPropertyDescriptor = Object.freeze({
43380
+ __proto__: null,
43381
+ value: Object.prototype.hasOwnProperty,
43382
+ enumerable: false,
43383
+ writable: true,
43384
+ configurable: true
43385
+ });
43386
+ var mergeMap = {
43387
+ url: valueFromConfig2,
43388
+ method: valueFromConfig2,
43389
+ data: valueFromConfig2,
43390
+ baseURL: defaultToConfig2,
43391
+ transformRequest: defaultToConfig2,
43392
+ transformResponse: defaultToConfig2,
43393
+ params: mergeParams,
43394
+ paramsSerializer: defaultToConfig2,
43395
+ timeout: defaultToConfig2,
43396
+ timeoutErrorMessage: defaultToConfig2,
43397
+ withCredentials: defaultToConfig2,
43398
+ withXSRFToken: defaultToConfig2,
43399
+ adapter: defaultToConfig2,
43400
+ responseType: defaultToConfig2,
43401
+ xsrfCookieName: defaultToConfig2,
43402
+ xsrfHeaderName: defaultToConfig2,
43403
+ onUploadProgress: defaultToConfig2,
43404
+ onDownloadProgress: defaultToConfig2,
43405
+ decompress: defaultToConfig2,
43406
+ maxContentLength: defaultToConfig2,
43407
+ maxBodyLength: defaultToConfig2,
43408
+ beforeRedirect: defaultToConfig2,
43409
+ transport: defaultToConfig2,
43410
+ httpAgent: defaultToConfig2,
43411
+ httpsAgent: defaultToConfig2,
43412
+ cancelToken: defaultToConfig2,
43413
+ socketPath: defaultToConfig2,
43414
+ allowedSocketPaths: defaultToConfig2,
43415
+ responseEncoding: defaultToConfig2,
43416
+ validateStatus: mergeDirectKeys,
43417
+ headers: mergeHeaders
43418
+ };
43419
+ function mergeConfig(config1, config2) {
43420
+ config1 = config1 || {};
43421
+ config2 = config2 || {};
43422
+ const config3 = /* @__PURE__ */ Object.create(null);
43423
+ Object.defineProperty(config3, "hasOwnProperty", hasOwnPropertyDescriptor);
43424
+ const keys = ownEnumerableKeys({ ...config1, ...config2 });
43425
+ for (let i = 0, len = keys.length; i < len; i++) {
43426
+ const prop = keys[i];
43427
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") continue;
43063
43428
  const merge3 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
43064
43429
  const a = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
43065
43430
  const b = utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0;
43066
- const configValue = merge3(a, b, prop);
43431
+ const configValue = merge3 === mergeDirectKeys ? merge3(a, b, prop, config1, config2) : merge3(a, b, prop);
43067
43432
  utils_default.isUndefined(configValue) && merge3 !== mergeDirectKeys || (config3[prop] = configValue);
43068
- });
43069
- if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
43433
+ }
43434
+ if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption(config1, config2, "validateStatusUndefinedResolves") === false) {
43070
43435
  if (utils_default.hasOwnProp(config1, "validateStatus")) {
43071
43436
  config3.validateStatus = getMergedValue(void 0, config1.validateStatus);
43072
43437
  } else {
@@ -43081,7 +43446,8 @@ var encodeUTF8 = (str) => encodeURIComponent(str).replace(
43081
43446
  /%([0-9A-F]{2})/gi,
43082
43447
  (_, hex3) => String.fromCharCode(parseInt(hex3, 16))
43083
43448
  );
43084
- function resolveConfig2(config2) {
43449
+ var readCookie = (name) => cookies_default.read(name);
43450
+ function resolveConfig2(config2, readXsrfCookie = readCookie) {
43085
43451
  const newConfig = mergeConfig({}, config2);
43086
43452
  const own3 = (key) => utils_default.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
43087
43453
  const data = own3("data");
@@ -43102,10 +43468,15 @@ function resolveConfig2(config2) {
43102
43468
  if (auth) {
43103
43469
  const username = utils_default.getSafeProp(auth, "username") || "";
43104
43470
  const password = utils_default.getSafeProp(auth, "password") || "";
43471
+ const transitional2 = own3("transitional");
43472
+ const encodeUsername = transitional2 && utils_default.hasOwnProp(transitional2, "encodeBasicAuthUsername") && transitional2.encodeBasicAuthUsername === true;
43105
43473
  try {
43106
43474
  headers.set(
43107
43475
  "Authorization",
43108
- "Basic " + btoa(username + ":" + (password ? encodeUTF8(password) : ""))
43476
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
43477
+ "Basic " + btoa(
43478
+ (encodeUsername ? encodeUTF8(username) : username) + ":" + (password ? encodeUTF8(password) : "")
43479
+ )
43109
43480
  );
43110
43481
  } catch (e) {
43111
43482
  throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_OPTION_VALUE, config2);
@@ -43125,7 +43496,7 @@ function resolveConfig2(config2) {
43125
43496
  }
43126
43497
  const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin_default(newConfig.url);
43127
43498
  if (shouldSendXSRF) {
43128
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
43499
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
43129
43500
  if (xsrfValue) {
43130
43501
  headers.set(xsrfHeaderName, xsrfValue);
43131
43502
  }
@@ -43139,16 +43510,50 @@ var resolveConfig_default = resolveConfig2;
43139
43510
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
43140
43511
  var xhr_default = isXHRAdapterSupported && function(config2) {
43141
43512
  return new Promise(function dispatchXhrRequest(resolve, reject) {
43142
- const _config = resolveConfig_default(config2);
43513
+ let useAsyncXsrf;
43514
+ try {
43515
+ const store = platform_default.hasStandardBrowserEnv && typeof window !== "undefined" && window.cookieStore;
43516
+ useAsyncXsrf = store && utils_default.isFunction(store.get);
43517
+ } catch (e) {
43518
+ }
43519
+ let xsrfCookieName;
43520
+ const _config = resolveConfig_default(
43521
+ config2,
43522
+ useAsyncXsrf ? (name) => {
43523
+ xsrfCookieName = name;
43524
+ return null;
43525
+ } : void 0
43526
+ );
43143
43527
  let requestData = _config.data;
43144
43528
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
43145
43529
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
43146
43530
  let onCanceled;
43531
+ let timeoutId;
43147
43532
  let uploadThrottled, downloadThrottled;
43148
43533
  let flushUpload, flushDownload, flushDownloadWithEvent;
43149
43534
  function done() {
43150
- flushUpload && flushUpload();
43151
- flushDownload && flushDownload();
43535
+ clearTimeout(timeoutId);
43536
+ try {
43537
+ flushUpload && flushUpload();
43538
+ } catch (err) {
43539
+ setTimeout(() => {
43540
+ throw err;
43541
+ });
43542
+ }
43543
+ try {
43544
+ flushDownload && flushDownload();
43545
+ } catch (err) {
43546
+ setTimeout(() => {
43547
+ throw err;
43548
+ });
43549
+ }
43550
+ if (request) {
43551
+ downloadThrottled && request.removeEventListener("progress", downloadThrottled);
43552
+ if (request.upload) {
43553
+ uploadThrottled && request.upload.removeEventListener("progress", uploadThrottled);
43554
+ flushUpload && request.upload.removeEventListener("loadend", flushUpload);
43555
+ }
43556
+ }
43152
43557
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
43153
43558
  _config.signal && _config.signal.removeEventListener("abort", onCanceled);
43154
43559
  }
@@ -43234,6 +43639,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
43234
43639
  request = null;
43235
43640
  };
43236
43641
  request.ontimeout = function handleTimeout() {
43642
+ if (!request) return;
43237
43643
  let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
43238
43644
  const transitional2 = _config.transitional || transitional_default;
43239
43645
  if (_config.timeoutErrorMessage) {
@@ -43251,11 +43657,6 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
43251
43657
  request = null;
43252
43658
  };
43253
43659
  requestData === void 0 && requestHeaders.setContentType(null);
43254
- if ("setRequestHeader" in request) {
43255
- utils_default.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
43256
- request.setRequestHeader(key, val);
43257
- });
43258
- }
43259
43660
  if (!utils_default.isUndefined(_config.withCredentials)) {
43260
43661
  request.withCredentials = !!_config.withCredentials;
43261
43662
  }
@@ -43280,15 +43681,18 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
43280
43681
  return;
43281
43682
  }
43282
43683
  reject(!cancel || cancel.type ? new CanceledError_default(null, config2, request) : cancel);
43283
- request.abort();
43684
+ const xhr = request;
43284
43685
  done();
43285
43686
  request = null;
43687
+ xhr.abort();
43286
43688
  };
43287
43689
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
43690
+ if (!request) return;
43288
43691
  if (_config.signal) {
43289
43692
  _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
43290
43693
  }
43291
43694
  }
43695
+ if (!request) return;
43292
43696
  const protocol = parseProtocol(_config.url);
43293
43697
  if (protocol && !platform_default.protocols.includes(protocol)) {
43294
43698
  reject(
@@ -43301,7 +43705,58 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
43301
43705
  done();
43302
43706
  return;
43303
43707
  }
43304
- request.send(requestData || null);
43708
+ const sendRequest = () => {
43709
+ if (!request) return;
43710
+ if ("setRequestHeader" in request) {
43711
+ utils_default.forEach(
43712
+ toByteStringHeaderObject(requestHeaders),
43713
+ function setRequestHeader(val, key) {
43714
+ request.setRequestHeader(key, val);
43715
+ }
43716
+ );
43717
+ }
43718
+ request.send(requestData || null);
43719
+ };
43720
+ if (xsrfCookieName) {
43721
+ const now = typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
43722
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : void 0;
43723
+ const abortOnTimeout = () => {
43724
+ if (!request) return;
43725
+ const xhr = request;
43726
+ xhr.ontimeout();
43727
+ xhr.abort();
43728
+ };
43729
+ if (deadline !== void 0) {
43730
+ const scheduleTimeout = () => {
43731
+ const remaining = deadline - now();
43732
+ if (remaining > 0) {
43733
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 2147483647));
43734
+ } else {
43735
+ abortOnTimeout();
43736
+ }
43737
+ };
43738
+ scheduleTimeout();
43739
+ }
43740
+ cookies_default.readAsync(xsrfCookieName).then((value) => {
43741
+ if (!request) return;
43742
+ if (deadline !== void 0 && now() >= deadline) {
43743
+ abortOnTimeout();
43744
+ return;
43745
+ }
43746
+ if (value) {
43747
+ const headerName = utils_default.hasOwnProp(_config, "xsrfHeaderName") && _config.xsrfHeaderName;
43748
+ requestHeaders.set(headerName, value);
43749
+ }
43750
+ sendRequest();
43751
+ }).catch((error62) => {
43752
+ if (!request) return;
43753
+ reject(AxiosError_default.from(error62, null, config2, request));
43754
+ done();
43755
+ request = null;
43756
+ });
43757
+ } else {
43758
+ sendRequest();
43759
+ }
43305
43760
  });
43306
43761
  };
43307
43762
 
@@ -43334,7 +43789,8 @@ var composeSignals = (signals, timeout) => {
43334
43789
  timer && clearTimeout(timer);
43335
43790
  timer = null;
43336
43791
  signals.forEach((signal2) => {
43337
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
43792
+ const unsubscribeSignal = utils_default.getSafeProp(signal2, "unsubscribe");
43793
+ utils_default.isFunction(unsubscribeSignal) ? unsubscribeSignal.call(signal2, onabort) : signal2.removeEventListener("abort", onabort);
43338
43794
  });
43339
43795
  signals = null;
43340
43796
  };
@@ -43434,6 +43890,110 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
43434
43890
  );
43435
43891
  };
43436
43892
 
43893
+ // node_modules/axios/lib/helpers/formDataToBlob.js
43894
+ var CRLF2 = "\r\n";
43895
+ var normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF2);
43896
+ var escapeName = (value) => String(value).replace(
43897
+ /[\r\n"]/g,
43898
+ (char) => char === "\r" ? "%0D" : char === "\n" ? "%0A" : "%22"
43899
+ );
43900
+ var stringBytes = (value, normalize) => {
43901
+ let length = 0;
43902
+ for (let i = 0; i < value.length; i++) {
43903
+ const code = value.charCodeAt(i);
43904
+ if (normalize && (code === 13 || code === 10)) {
43905
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
43906
+ length += 2;
43907
+ } else if (code < 128) {
43908
+ length++;
43909
+ } else if (code < 2048) {
43910
+ length += 2;
43911
+ } else if (code >= 55296 && code <= 56319 && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
43912
+ length += 4;
43913
+ i++;
43914
+ } else {
43915
+ length += 3;
43916
+ }
43917
+ }
43918
+ return length;
43919
+ };
43920
+ var FormDataError = class extends TypeError {
43921
+ constructor(message, reason) {
43922
+ super(message);
43923
+ this.name = "FormDataError";
43924
+ this.reason = reason;
43925
+ }
43926
+ };
43927
+ function formDataToBlob(form, Blob2, limit, limitError, boundary) {
43928
+ if (!utils_default.isFunction(Blob2)) {
43929
+ throw new FormDataError("Blob is not supported", "blob");
43930
+ }
43931
+ if (!utils_default.isString(boundary) || !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) || / $/.test(boundary)) {
43932
+ throw new FormDataError("Invalid multipart boundary", "boundary");
43933
+ }
43934
+ const footer = "--" + boundary + "--" + CRLF2;
43935
+ let length = footer.length;
43936
+ const parts = [];
43937
+ const checkLength = (extra) => {
43938
+ if (length + extra > limit) throw limitError();
43939
+ };
43940
+ checkLength(0);
43941
+ for (const [name, value] of form) {
43942
+ const isString2 = utils_default.isString(value);
43943
+ const valueLength = isString2 ? stringBytes(value, true) : value.size;
43944
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
43945
+ throw new FormDataError("Unsupported FormData part size", "part");
43946
+ }
43947
+ checkLength(
43948
+ valueLength + stringBytes(name, true) + (!isString2 && value.name ? stringBytes(value.name, false) : 0) + (!isString2 && value.type ? stringBytes(value.type, false) : 0)
43949
+ );
43950
+ let header = "--" + boundary + CRLF2 + 'Content-Disposition: form-data; name="' + escapeName(normalizeLines(name)) + '"';
43951
+ if (!isString2) {
43952
+ header += '; filename="' + escapeName(utils_default.isString(value.name) ? value.name : "blob") + '"' + CRLF2 + "Content-Type: " + String(value.type || "application/octet-stream").replace(/[\r\n]/g, "");
43953
+ }
43954
+ header += CRLF2 + CRLF2;
43955
+ const partLength = stringBytes(header, false) + valueLength + CRLF2.length;
43956
+ checkLength(partLength);
43957
+ length += partLength;
43958
+ parts.push({ header, value, isString: isString2 });
43959
+ }
43960
+ const blobParts = [];
43961
+ for (const part of parts) {
43962
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF2);
43963
+ }
43964
+ blobParts.push(footer);
43965
+ return new Blob2(blobParts, { type: "multipart/form-data; boundary=" + boundary });
43966
+ }
43967
+
43968
+ // node_modules/axios/lib/core/createMultipartBody.js
43969
+ function createMultipartBody(form, Blob2, limit, limitError, boundary) {
43970
+ if (!utils_default.isFunction(Blob2)) {
43971
+ throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
43972
+ }
43973
+ if (boundary === void 0) {
43974
+ if (utils_default.isFunction(platform_default.generateString)) {
43975
+ boundary = "axios-" + platform_default.generateString(36, "0123456789abcdef");
43976
+ } else {
43977
+ const crypto2 = utils_default.global.crypto;
43978
+ if (!crypto2 || !utils_default.isFunction(crypto2.getRandomValues)) {
43979
+ throw new AxiosError_default("Random byte generation is not supported", AxiosError_default.ERR_NOT_SUPPORT);
43980
+ }
43981
+ const random = new Uint8Array(18);
43982
+ crypto2.getRandomValues(random);
43983
+ boundary = "axios-" + Array.from(random, (value) => ("0" + value.toString(16)).slice(-2)).join("");
43984
+ }
43985
+ }
43986
+ try {
43987
+ return formDataToBlob(form, Blob2, limit, limitError, boundary);
43988
+ } catch (error62) {
43989
+ if (error62 instanceof FormDataError) {
43990
+ const code = error62.reason === "boundary" ? AxiosError_default.ERR_BAD_OPTION_VALUE : AxiosError_default.ERR_BAD_REQUEST;
43991
+ throw new AxiosError_default(error62.message, code);
43992
+ }
43993
+ throw error62;
43994
+ }
43995
+ }
43996
+
43437
43997
  // node_modules/axios/lib/adapters/fetch.js
43438
43998
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
43439
43999
  var DEFAULT_REQUEST_OPTIONS = {
@@ -43486,11 +44046,13 @@ var factory = (env) => {
43486
44046
  },
43487
44047
  {
43488
44048
  Request: globalObject.Request,
43489
- Response: globalObject.Response
44049
+ Response: globalObject.Response,
44050
+ Blob: globalObject.Blob
43490
44051
  },
43491
44052
  env
43492
44053
  );
43493
- const { fetch: envFetch, Request, Response } = env;
44054
+ const envFetch = utils_default.hasOwnProp(env, "fetch") ? env.fetch : void 0;
44055
+ const { Request, Response, Blob: Blob2 } = env;
43494
44056
  const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
43495
44057
  const isRequestSupported = isFunction2(Request);
43496
44058
  const isResponseSupported = isFunction2(Response);
@@ -43516,6 +44078,13 @@ var factory = (env) => {
43516
44078
  return duplexAccessed && !hasContentType;
43517
44079
  });
43518
44080
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
44081
+ const requestDefaults = Object.assign(/* @__PURE__ */ Object.create(null), DEFAULT_REQUEST_OPTIONS);
44082
+ if (isRequestSupported && !test(() => new Request(platform_default.origin, requestDefaults))) {
44083
+ delete requestDefaults.cache;
44084
+ if (!test(() => new Request(platform_default.origin, requestDefaults))) {
44085
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
44086
+ }
44087
+ }
43519
44088
  const resolvers = {
43520
44089
  stream: supportsResponseStream && ((res) => res.body)
43521
44090
  };
@@ -43541,13 +44110,6 @@ var factory = (env) => {
43541
44110
  if (utils_default.isBlob(body)) {
43542
44111
  return body.size;
43543
44112
  }
43544
- if (utils_default.isSpecCompliantForm(body)) {
43545
- const _request = new Request(platform_default.origin, {
43546
- method: "POST",
43547
- body
43548
- });
43549
- return (await _request.arrayBuffer()).byteLength;
43550
- }
43551
44113
  if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
43552
44114
  return body.byteLength;
43553
44115
  }
@@ -43595,6 +44157,7 @@ var factory = (env) => {
43595
44157
  });
43596
44158
  let requestContentLength;
43597
44159
  let pendingBodyError = null;
44160
+ let pendingResponseError = null;
43598
44161
  const maxBodyLengthError = () => new AxiosError_default(
43599
44162
  "Request body larger than maxBodyLength limit",
43600
44163
  AxiosError_default.ERR_BAD_REQUEST,
@@ -43612,8 +44175,9 @@ var factory = (env) => {
43612
44175
  password
43613
44176
  };
43614
44177
  }
44178
+ let parsedURL;
43615
44179
  if (maybeWithAuthCredentials(url3)) {
43616
- const parsedURL = new URL(url3, platform_default.origin);
44180
+ parsedURL = new URL(url3, platform_default.origin);
43617
44181
  if (!auth && (parsedURL.username || parsedURL.password)) {
43618
44182
  const urlUsername = decodeURIComponentSafe2(parsedURL.username);
43619
44183
  const urlPassword = decodeURIComponentSafe2(parsedURL.password);
@@ -43635,8 +44199,8 @@ var factory = (env) => {
43635
44199
  "Basic " + btoa(encodeUTF82((auth.username || "") + ":" + (auth.password || "")))
43636
44200
  );
43637
44201
  }
43638
- if (hasMaxContentLength && typeof url3 === "string" && url3.startsWith("data:")) {
43639
- const estimated = estimateDataURLDecodedBytes(url3);
44202
+ if (hasMaxContentLength && parsedURL && parsedURL.protocol === "data:") {
44203
+ const estimated = estimateDataURLDecodedBytes(parsedURL.href);
43640
44204
  if (estimated > maxContentLength) {
43641
44205
  throw new AxiosError_default(
43642
44206
  "maxContentLength size of " + maxContentLength + " exceeded",
@@ -43646,6 +44210,23 @@ var factory = (env) => {
43646
44210
  );
43647
44211
  }
43648
44212
  }
44213
+ const formContentType = utils_default.isSpecCompliantForm(data) && AxiosHeaders_default.from(own3("headers")).getContentType();
44214
+ let formBoundary;
44215
+ if (utils_default.isString(formContentType) && /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())) {
44216
+ const parameters = AxiosHeaders_default.parseParameters(formContentType);
44217
+ if (utils_default.hasOwnProp(parameters, "boundary")) formBoundary = parameters.boundary;
44218
+ }
44219
+ if (utils_default.isSpecCompliantForm(data) && method !== "get" && method !== "head" && (hasMaxBodyLength || onUploadProgress && supportsRequestStream || formBoundary !== void 0)) {
44220
+ data = createMultipartBody(
44221
+ data,
44222
+ Blob2,
44223
+ hasMaxBodyLength ? maxBodyLength : Infinity,
44224
+ maxBodyLengthError,
44225
+ formBoundary
44226
+ );
44227
+ headers.setContentType(formBoundary === void 0 ? data.type : formContentType);
44228
+ requestContentLength = data.size;
44229
+ }
43649
44230
  if (hasMaxBodyLength && method !== "get" && method !== "head") {
43650
44231
  const outboundLength = await getBodyLength(data);
43651
44232
  if (typeof outboundLength === "number" && isFinite(outboundLength)) {
@@ -43726,7 +44307,7 @@ var factory = (env) => {
43726
44307
  credentials: isCredentialsSupported ? withCredentials : void 0
43727
44308
  });
43728
44309
  if (isRequestSupported) {
43729
- utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
44310
+ utils_default.forEach(requestDefaults, (value, key) => {
43730
44311
  if (resolvedOptions[key] === void 0) {
43731
44312
  resolvedOptions[key] = value;
43732
44313
  }
@@ -43774,7 +44355,7 @@ var factory = (env) => {
43774
44355
  if (hasMaxContentLength) {
43775
44356
  bytesRead = loadedBytes;
43776
44357
  if (bytesRead > maxContentLength) {
43777
- throw new AxiosError_default(
44358
+ throw pendingResponseError = new AxiosError_default(
43778
44359
  "maxContentLength size of " + maxContentLength + " exceeded",
43779
44360
  AxiosError_default.ERR_BAD_RESPONSE,
43780
44361
  config2,
@@ -43849,6 +44430,9 @@ var factory = (env) => {
43849
44430
  request && !pendingBodyError.request && (pendingBodyError.request = request);
43850
44431
  throw pendingBodyError;
43851
44432
  }
44433
+ if (pendingResponseError) {
44434
+ throw pendingResponseError;
44435
+ }
43852
44436
  if (err instanceof AxiosError_default) {
43853
44437
  request && !err.request && (err.request = request);
43854
44438
  throw err;
@@ -43876,9 +44460,15 @@ var factory = (env) => {
43876
44460
  };
43877
44461
  var seedCache = /* @__PURE__ */ new Map();
43878
44462
  var getFetch = (config2) => {
43879
- let env = config2 && config2.env || {};
43880
- const { fetch: fetch2, Request, Response } = env;
43881
- const seeds = [Request, Response, fetch2];
44463
+ const env = /* @__PURE__ */ Object.create(null);
44464
+ const configuredEnv = config2 && utils_default.hasOwnProp(config2, "env") && config2.env;
44465
+ ["fetch", "Request", "Response", "Blob"].forEach((key) => {
44466
+ if (configuredEnv && utils_default.hasOwnProp(configuredEnv, key)) {
44467
+ env[key] = configuredEnv[key];
44468
+ }
44469
+ });
44470
+ const { fetch: fetch2, Request, Response, Blob: Blob2 } = env;
44471
+ const seeds = [Request, Response, fetch2, Blob2];
43882
44472
  let len = seeds.length, i = len, seed, target, map2 = seedCache;
43883
44473
  while (i--) {
43884
44474
  seed = seeds[i];
@@ -43964,6 +44554,12 @@ function throwIfCancellationRequested(config2) {
43964
44554
  throw new CanceledError_default(null, config2);
43965
44555
  }
43966
44556
  }
44557
+ function resolveClock() {
44558
+ return typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
44559
+ }
44560
+ function elapsedSince(now, start) {
44561
+ return Math.max(0, Math.round(now() - start));
44562
+ }
43967
44563
  function dispatchRequest(_config) {
43968
44564
  const config2 = utils_default.toSafeFlatObject(_config);
43969
44565
  throwIfCancellationRequested(config2);
@@ -43973,9 +44569,12 @@ function dispatchRequest(_config) {
43973
44569
  config2.headers.setContentType("application/x-www-form-urlencoded", false);
43974
44570
  }
43975
44571
  const adapter2 = adapters_default.getAdapter(config2.adapter || defaults_default.adapter, config2);
44572
+ const now = resolveClock();
44573
+ const start = now();
43976
44574
  return adapter2(config2).then(
43977
44575
  function onAdapterResolution(response) {
43978
44576
  throwIfCancellationRequested(config2);
44577
+ response.duration = elapsedSince(now, start);
43979
44578
  config2.response = response;
43980
44579
  try {
43981
44580
  response.data = transformData.call(config2, config2.transformResponse, response);
@@ -43989,6 +44588,7 @@ function dispatchRequest(_config) {
43989
44588
  if (!isCancel(reason)) {
43990
44589
  throwIfCancellationRequested(config2);
43991
44590
  if (reason && reason.response) {
44591
+ reason.response.duration = elapsedSince(now, start);
43992
44592
  config2.response = reason.response;
43993
44593
  try {
43994
44594
  reason.response.data = transformData.call(
@@ -44076,6 +44676,27 @@ var validator_default = {
44076
44676
 
44077
44677
  // node_modules/axios/lib/core/Axios.js
44078
44678
  var validators2 = validator_default.validators;
44679
+ var isHeadersBucket = (value) => {
44680
+ if (value == null || utils_default.isPlainObject(value) || value instanceof AxiosHeaders_default) {
44681
+ return true;
44682
+ }
44683
+ try {
44684
+ return utils_default.isObject(value) && utils_default.getSafeProp(value, Symbol.toStringTag) === "AxiosHeaders" && [
44685
+ "toJSON",
44686
+ "set",
44687
+ "get",
44688
+ "has",
44689
+ "delete",
44690
+ "clear",
44691
+ "normalize",
44692
+ "concat",
44693
+ "toString",
44694
+ Symbol.iterator
44695
+ ].every((method) => utils_default.isFunction(utils_default.getSafeProp(value, method)));
44696
+ } catch (e) {
44697
+ return false;
44698
+ }
44699
+ };
44079
44700
  var Axios = class {
44080
44701
  constructor(instanceConfig) {
44081
44702
  this.defaults = instanceConfig || {};
@@ -44111,9 +44732,13 @@ var Axios = class {
44111
44732
  } else if (stack) {
44112
44733
  const firstNewlineIndex = stack.indexOf("\n");
44113
44734
  const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
44114
- const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
44115
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
44116
- err.stack += "\n" + stack;
44735
+ const duplicateCheckSuffix = secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
44736
+ const currentStack = String(err.stack);
44737
+ const causeIndex = getCauseStackIndex(err, currentStack);
44738
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
44739
+ const causeSection = causeIndex === -1 ? "" : currentStack.slice(causeIndex);
44740
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
44741
+ err.stack = stackHead + "\n" + stack + causeSection;
44117
44742
  }
44118
44743
  }
44119
44744
  } catch (e) {
@@ -44140,7 +44765,8 @@ var Axios = class {
44140
44765
  clarifyTimeoutError: validators2.transitional(validators2.boolean),
44141
44766
  legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean),
44142
44767
  advertiseZstdAcceptEncoding: validators2.transitional(validators2.boolean),
44143
- validateStatusUndefinedResolves: validators2.transitional(validators2.boolean)
44768
+ validateStatusUndefinedResolves: validators2.transitional(validators2.boolean),
44769
+ encodeBasicAuthUsername: validators2.transitional(validators2.boolean)
44144
44770
  },
44145
44771
  false
44146
44772
  );
@@ -44162,7 +44788,7 @@ var Axios = class {
44162
44788
  }
44163
44789
  }
44164
44790
  if (config2.allowAbsoluteUrls !== void 0) {
44165
- } else if (this.defaults.allowAbsoluteUrls !== void 0) {
44791
+ } else if (utils_default.hasOwnProp(this.defaults, "allowAbsoluteUrls") && this.defaults.allowAbsoluteUrls !== void 0) {
44166
44792
  config2.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
44167
44793
  } else {
44168
44794
  config2.allowAbsoluteUrls = true;
@@ -44176,9 +44802,16 @@ var Axios = class {
44176
44802
  true
44177
44803
  );
44178
44804
  config2.method = (utils_default.getSafeProp(config2, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
44179
- let contextHeaders = headers && utils_default.merge(headers.common, headers[config2.method]);
44805
+ const commonHeaders = utils_default.getSafeProp(headers, "common");
44806
+ const methodHeaders = utils_default.getSafeProp(headers, config2.method);
44807
+ const contextHeaders = headers && utils_default.merge(
44808
+ isHeadersBucket(commonHeaders) ? commonHeaders : void 0,
44809
+ isHeadersBucket(methodHeaders) ? methodHeaders : void 0
44810
+ );
44180
44811
  headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
44181
- delete headers[method];
44812
+ if (isHeadersBucket(utils_default.getSafeProp(headers, method))) {
44813
+ delete headers[method];
44814
+ }
44182
44815
  });
44183
44816
  config2.headers = AxiosHeaders_default.concat(contextHeaders, headers);
44184
44817
  const requestInterceptorChain = [];
@@ -44260,7 +44893,7 @@ var Axios = class {
44260
44893
  }
44261
44894
  };
44262
44895
  utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
44263
- Axios.prototype[method] = function(url3, config2) {
44896
+ Axios.prototype[method] = async function(url3, config2) {
44264
44897
  return this.request(
44265
44898
  mergeConfig(config2 || {}, {
44266
44899
  method,
@@ -44272,7 +44905,7 @@ utils_default.forEach(["delete", "get", "head", "options"], function forEachMeth
44272
44905
  });
44273
44906
  utils_default.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
44274
44907
  function generateHTTPMethod(isForm) {
44275
- return function httpMethod(url3, data, config2) {
44908
+ return async function httpMethod(url3, data, config2) {
44276
44909
  return this.request(
44277
44910
  mergeConfig(config2 || {}, {
44278
44911
  method,
@@ -44546,6 +45179,31 @@ var {
44546
45179
 
44547
45180
  // src/core/http.ts
44548
45181
  import https2 from "https";
45182
+
45183
+ // src/core/tls.ts
45184
+ import fs3 from "fs";
45185
+ import tls from "tls";
45186
+ function tlsOptions(config2) {
45187
+ if (config2.insecureTls) return { rejectUnauthorized: false };
45188
+ if (!config2.caFile) return {};
45189
+ let pem;
45190
+ try {
45191
+ pem = fs3.readFileSync(config2.caFile, "utf8");
45192
+ } catch (error62) {
45193
+ throw new Error(
45194
+ `Could not read TERMIX_CA_FILE ${config2.caFile}: ${error62.message}`,
45195
+ { cause: error62 }
45196
+ );
45197
+ }
45198
+ if (!pem.includes("-----BEGIN CERTIFICATE-----")) {
45199
+ throw new Error(
45200
+ `TERMIX_CA_FILE ${config2.caFile} has no PEM certificate in it.`
45201
+ );
45202
+ }
45203
+ return { ca: [...tls.rootCertificates, pem] };
45204
+ }
45205
+
45206
+ // src/core/http.ts
44549
45207
  import { setTimeout as sleep } from "timers/promises";
44550
45208
 
44551
45209
  // src/core/auth.ts
@@ -44797,7 +45455,7 @@ function unavailableFor(pluginId, reason) {
44797
45455
  }
44798
45456
 
44799
45457
  // src/version.ts
44800
- var CLI_VERSION = true ? "1.3.1" : "0.0.0-dev";
45458
+ var CLI_VERSION = true ? "1.4.0" : "0.0.0-dev";
44801
45459
 
44802
45460
  // src/core/http.ts
44803
45461
  var MAX_ATTEMPTS = 3;
@@ -44824,7 +45482,7 @@ var TermixClient = class {
44824
45482
  this.instance = axios_default.create({
44825
45483
  baseURL: this.config.url,
44826
45484
  timeout: this.config.requestTimeoutMs,
44827
- httpsAgent: this.config.insecureTls ? new https2.Agent({ rejectUnauthorized: false }) : void 0,
45485
+ httpsAgent: this.config.insecureTls || this.config.caFile ? new https2.Agent(tlsOptions(this.config)) : void 0,
44828
45486
  maxRedirects: 0,
44829
45487
  // We handle non-2xx ourselves for uniform error mapping.
44830
45488
  validateStatus: () => true
@@ -44949,7 +45607,8 @@ function connectionMessage(error62) {
44949
45607
  case "DEPTH_ZERO_SELF_SIGNED_CERT":
44950
45608
  case "SELF_SIGNED_CERT_IN_CHAIN":
44951
45609
  case "UNABLE_TO_VERIFY_LEAF_SIGNATURE":
44952
- return "TLS certificate could not be verified. Set TERMIX_INSECURE_TLS=true to trust it anyway.";
45610
+ case "UNABLE_TO_GET_ISSUER_CERT_LOCALLY":
45611
+ return "TLS certificate could not be verified. If the server uses your own CA, set TERMIX_CA_FILE to its certificate. TERMIX_INSECURE_TLS=true skips the check.";
44953
45612
  default:
44954
45613
  return error62 instanceof Error ? error62.message : String(error62);
44955
45614
  }
@@ -45151,6 +45810,9 @@ function applyGlobalFlags(flags) {
45151
45810
  if (flags.insecure) {
45152
45811
  process.env.TERMIX_INSECURE_TLS = "true";
45153
45812
  }
45813
+ if (flags.caFile) {
45814
+ process.env.TERMIX_CA_FILE = flags.caFile;
45815
+ }
45154
45816
  }
45155
45817
  async function createContext(command) {
45156
45818
  const flags = globalFlags(command);
@@ -45342,6 +46004,7 @@ function bareClient(url3, insecure, token) {
45342
46004
  const config2 = {
45343
46005
  url: url3.replace(/\/+$/, ""),
45344
46006
  insecureTls: insecure || process.env.TERMIX_INSECURE_TLS === "true",
46007
+ caFile: process.env.TERMIX_CA_FILE || void 0,
45345
46008
  requestTimeoutMs: 6e4,
45346
46009
  ...token ? { token } : {}
45347
46010
  };
@@ -45526,10 +46189,10 @@ function registerAuthCommands(program3) {
45526
46189
  }
45527
46190
 
45528
46191
  // src/commands/hosts.ts
45529
- import fs4 from "fs";
46192
+ import fs5 from "fs";
45530
46193
 
45531
46194
  // src/commands/host-fields.ts
45532
- import fs3 from "fs";
46195
+ import fs4 from "fs";
45533
46196
  var AUTH_TYPES = ["password", "key", "credential", "agent", "none"];
45534
46197
  function addHostFieldOptions(cmd) {
45535
46198
  return cmd.option("--name <name>", "Display name (defaults to user@ip)").option("--ip <ip>", "Hostname or IP address").option("--port <port>", "SSH port (default 22)").option("--username <username>", "SSH username").option(
@@ -45684,7 +46347,7 @@ function validateAuthType(value) {
45684
46347
  }
45685
46348
  function readKeyFile(path4) {
45686
46349
  try {
45687
- return fs3.readFileSync(path4, "utf8");
46350
+ return fs4.readFileSync(path4, "utf8");
45688
46351
  } catch {
45689
46352
  throw new UsageError(`Could not read key file: ${path4}`);
45690
46353
  }
@@ -45858,7 +46521,7 @@ function registerHostCommands(program3) {
45858
46521
  const json2 = `${JSON.stringify(data, null, 2)}
45859
46522
  `;
45860
46523
  if (opts.output) {
45861
- fs4.writeFileSync(opts.output, json2, { mode: 384 });
46524
+ fs5.writeFileSync(opts.output, json2, { mode: 384 });
45862
46525
  printResult(`Exported hosts to ${opts.output}.`, {
45863
46526
  path: opts.output
45864
46527
  });
@@ -45871,7 +46534,7 @@ function registerHostCommands(program3) {
45871
46534
  await run(async () => {
45872
46535
  let parsed;
45873
46536
  try {
45874
- parsed = JSON.parse(fs4.readFileSync(file2, "utf8"));
46537
+ parsed = JSON.parse(fs5.readFileSync(file2, "utf8"));
45875
46538
  } catch {
45876
46539
  throw new UsageError(`Could not read a JSON export from: ${file2}`);
45877
46540
  }
@@ -45972,6 +46635,10 @@ ${command}
45972
46635
  )
45973
46636
  printf '\\n${EXIT_MARKER}%d\\n' "$?"`;
45974
46637
  }
46638
+ function reportsExitCode(version2) {
46639
+ const [major = 0, minor = 0, patch = 0] = (version2 ?? "").split(/[.-]/).map((part) => Number(part) || 0);
46640
+ return major > 1 || major === 1 && (minor > 4 || minor === 4 && patch >= 1);
46641
+ }
45975
46642
  var EXIT_MARKER_RE = new RegExp(`\\n?${EXIT_MARKER}(\\d+)\\s*$`);
45976
46643
  function parseExecOutput(raw) {
45977
46644
  const match = raw.match(EXIT_MARKER_RE);
@@ -46032,13 +46699,20 @@ function registerExecCommands(program3) {
46032
46699
  const command = commandParts.join(" ");
46033
46700
  const { client, requireFeature: requireFeature2 } = await createContext(this);
46034
46701
  await requireFeature2("snippets");
46702
+ const snippets = (await getServerPlugins(client)).find(
46703
+ (plugin) => plugin.id === FEATURES.snippets.pluginId
46704
+ );
46705
+ const direct = reportsExitCode(snippets?.version);
46035
46706
  const result = await executeOnHost(
46036
46707
  client,
46037
46708
  hostId,
46038
- wrapCommand(command),
46709
+ direct ? command : wrapCommand(command),
46039
46710
  `cli-exec-${randomUUID()}`
46040
46711
  );
46041
- const { output: output2, exitCode } = parseExecOutput(result.output ?? "");
46712
+ const { output: output2, exitCode } = direct ? {
46713
+ output: result.output ?? "",
46714
+ exitCode: typeof result.exitCode === "number" ? result.exitCode : null
46715
+ } : parseExecOutput(result.output ?? "");
46042
46716
  if (output2) process.stdout.write(output2);
46043
46717
  if (result.error) process.stderr.write(result.error);
46044
46718
  process.exitCode = exitCode ?? (result.success ? 0 : 1);
@@ -46107,7 +46781,7 @@ var TerminalSocket = class {
46107
46781
  return new Promise((resolve, reject) => {
46108
46782
  const ws = new wrapper_default(url3, {
46109
46783
  headers: { Authorization: `Bearer ${this.token}` },
46110
- rejectUnauthorized: !this.config.insecureTls,
46784
+ ...tlsOptions(this.config),
46111
46785
  handshakeTimeout: this.config.requestTimeoutMs
46112
46786
  });
46113
46787
  const onOpen = () => {
@@ -46302,6 +46976,7 @@ function toHostConfig(id, host) {
46302
46976
  credentialId: host.credentialId
46303
46977
  };
46304
46978
  }
46979
+ var EXIT_LINE = "exit\r";
46305
46980
  function registerSshCommands(program3) {
46306
46981
  program3.command("ssh <hostId>").description(
46307
46982
  "Open an interactive terminal on a host. Requires a session token: API keys cannot open a WebSocket."
@@ -46462,7 +47137,7 @@ async function runSession(socket, opts) {
46462
47137
  const scheduleExit = () => {
46463
47138
  if (opts.interactive || !opts.command) return;
46464
47139
  if (idleTimer) clearTimeout(idleTimer);
46465
- idleTimer = setTimeout(() => socket.input("exit\n"), 1500);
47140
+ idleTimer = setTimeout(() => socket.input(EXIT_LINE), 1500);
46466
47141
  idleTimer.unref?.();
46467
47142
  };
46468
47143
  socket.onMessage((message) => {
@@ -46502,7 +47177,7 @@ async function runSession(socket, opts) {
46502
47177
  }
46503
47178
 
46504
47179
  // src/commands/files.ts
46505
- import fs5 from "fs";
47180
+ import fs6 from "fs";
46506
47181
  import path3 from "path";
46507
47182
  import { randomUUID as randomUUID2 } from "crypto";
46508
47183
  import { isUtf8 } from "buffer";
@@ -46750,7 +47425,7 @@ function registerFileCommands(program3) {
46750
47425
  (session) => session.read(remotePath)
46751
47426
  );
46752
47427
  const target = resolveLocalTarget(localPath, remotePath);
46753
- fs5.writeFileSync(target, content);
47428
+ fs6.writeFileSync(target, content);
46754
47429
  printResult(`Downloaded ${remotePath} to ${target}.`, { path: target });
46755
47430
  });
46756
47431
  });
@@ -46759,7 +47434,7 @@ function registerFileCommands(program3) {
46759
47434
  const { hostId, path: remotePath } = parseRemote(remote);
46760
47435
  let content;
46761
47436
  try {
46762
- content = fs5.readFileSync(localPath);
47437
+ content = fs6.readFileSync(localPath);
46763
47438
  } catch {
46764
47439
  throw new UsageError(`Could not read local file: ${localPath}`);
46765
47440
  }
@@ -46813,7 +47488,7 @@ function resolveLocalTarget(localPath, remotePath) {
46813
47488
  const basename = path3.posix.basename(remotePath);
46814
47489
  if (!localPath) return basename;
46815
47490
  try {
46816
- if (fs5.statSync(localPath).isDirectory()) {
47491
+ if (fs6.statSync(localPath).isDirectory()) {
46817
47492
  return path3.join(localPath, basename);
46818
47493
  }
46819
47494
  } catch {
@@ -47736,7 +48411,7 @@ function registerSessionCommands(program3) {
47736
48411
  }
47737
48412
 
47738
48413
  // src/commands/snippets.ts
47739
- import fs6 from "fs";
48414
+ import fs7 from "fs";
47740
48415
  var SNIPPET_COLUMNS = [
47741
48416
  { header: "id", value: (s) => s.id, align: "right" },
47742
48417
  { header: "name", value: (s) => s.name },
@@ -47749,7 +48424,7 @@ function resolveContent(opts) {
47749
48424
  }
47750
48425
  if (opts.contentFile !== void 0) {
47751
48426
  try {
47752
- return fs6.readFileSync(opts.contentFile, "utf8");
48427
+ return fs7.readFileSync(opts.contentFile, "utf8");
47753
48428
  } catch {
47754
48429
  throw new UsageError(`Could not read content file: ${opts.contentFile}`);
47755
48430
  }
@@ -47876,7 +48551,7 @@ function registerSnippetCommands(program3) {
47876
48551
  }
47877
48552
 
47878
48553
  // src/commands/credentials.ts
47879
- import fs7 from "fs";
48554
+ import fs8 from "fs";
47880
48555
  var SAFE_CREDENTIAL_FIELDS = [
47881
48556
  "id",
47882
48557
  "name",
@@ -47962,7 +48637,7 @@ function buildCredentialPayload(opts) {
47962
48637
  if (keyPassword !== void 0) body.keyPassword = keyPassword;
47963
48638
  if (opts.keyFile !== void 0) {
47964
48639
  try {
47965
- body.key = fs7.readFileSync(opts.keyFile, "utf8");
48640
+ body.key = fs8.readFileSync(opts.keyFile, "utf8");
47966
48641
  } catch {
47967
48642
  throw new UsageError(`Could not read key file: ${opts.keyFile}`);
47968
48643
  }
@@ -48518,7 +49193,7 @@ function registerPluginCommands(program3) {
48518
49193
  }
48519
49194
 
48520
49195
  // src/commands/api.ts
48521
- import fs8 from "fs";
49196
+ import fs9 from "fs";
48522
49197
  var METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
48523
49198
  function parseApiMethod(value) {
48524
49199
  const method = value.toUpperCase();
@@ -48556,7 +49231,7 @@ function parseApiBody(opts) {
48556
49231
  let raw = opts.data;
48557
49232
  if (opts.dataFile !== void 0) {
48558
49233
  try {
48559
- raw = fs8.readFileSync(opts.dataFile === "-" ? 0 : opts.dataFile, "utf8");
49234
+ raw = fs9.readFileSync(opts.dataFile === "-" ? 0 : opts.dataFile, "utf8");
48560
49235
  } catch {
48561
49236
  throw new UsageError(`Could not read --data-file: ${opts.dataFile}`);
48562
49237
  }
@@ -49108,7 +49783,10 @@ function registerInjectCommands(program3) {
49108
49783
  var program2 = new Command();
49109
49784
  program2.name("termix").description(
49110
49785
  "Command-line interface for Termix.\n\nAuthenticate with `termix login`, or set TERMIX_URL and TERMIX_API_KEY for\nscripts and agents. Output is a table on a terminal and JSON when piped."
49111
- ).version(CLI_VERSION).option("--url <url>", "Termix base URL (overrides the stored config)").option("--api-key <key>", "API key (tmx_...) to authenticate with").option("--json", "Force JSON output (default when stdout is not a terminal)").option("--no-json", "Force human-readable output even when piped").option("-q, --quiet", "Print only ids, one per line").option("--no-color", "Disable coloured output").option("--insecure", "Skip TLS certificate verification").showSuggestionAfterError();
49786
+ ).version(CLI_VERSION).option("--url <url>", "Termix base URL (overrides the stored config)").option("--api-key <key>", "API key (tmx_...) to authenticate with").option("--json", "Force JSON output (default when stdout is not a terminal)").option("--no-json", "Force human-readable output even when piped").option("-q, --quiet", "Print only ids, one per line").option("--no-color", "Disable coloured output").option("--insecure", "Skip TLS certificate verification").option(
49787
+ "--ca-file <path>",
49788
+ "Trust the root certificates in this PEM file too (TERMIX_CA_FILE)"
49789
+ ).showSuggestionAfterError();
49112
49790
  program2.hook("preAction", (thisCommand) => {
49113
49791
  applyGlobalFlags(thisCommand.opts());
49114
49792
  });