@gravitykit/block-mcp 2.0.0-beta → 2.0.1

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.cjs CHANGED
@@ -3106,6 +3106,9 @@ var require_utils = __commonJS({
3106
3106
  "use strict";
3107
3107
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3108
3108
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3109
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3110
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3111
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3109
3112
  function stringArrayToHexStripped(input) {
3110
3113
  let acc = "";
3111
3114
  let code = 0;
@@ -3298,27 +3301,77 @@ var require_utils = __commonJS({
3298
3301
  }
3299
3302
  return output.join("");
3300
3303
  }
3301
- function normalizeComponentEncoding(component, esc2) {
3302
- const func = esc2 !== true ? escape : unescape;
3303
- if (component.scheme !== void 0) {
3304
- component.scheme = func(component.scheme);
3305
- }
3306
- if (component.userinfo !== void 0) {
3307
- component.userinfo = func(component.userinfo);
3308
- }
3309
- if (component.host !== void 0) {
3310
- component.host = func(component.host);
3304
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3305
+ var HOST_DELIM_RE = /[@/?#:]/g;
3306
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
3307
+ function reescapeHostDelimiters(host, isIP) {
3308
+ const re3 = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
3309
+ re3.lastIndex = 0;
3310
+ return host.replace(re3, (ch) => HOST_DELIMS[ch]);
3311
+ }
3312
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
3313
+ if (input.indexOf("%") === -1) {
3314
+ return input;
3311
3315
  }
3312
- if (component.path !== void 0) {
3313
- component.path = func(component.path);
3316
+ let output = "";
3317
+ for (let i2 = 0; i2 < input.length; i2++) {
3318
+ if (input[i2] === "%" && i2 + 2 < input.length) {
3319
+ const hex3 = input.slice(i2 + 1, i2 + 3);
3320
+ if (isHexPair(hex3)) {
3321
+ const normalizedHex = hex3.toUpperCase();
3322
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3323
+ if (decodeUnreserved && isUnreserved(decoded)) {
3324
+ output += decoded;
3325
+ } else {
3326
+ output += "%" + normalizedHex;
3327
+ }
3328
+ i2 += 2;
3329
+ continue;
3330
+ }
3331
+ }
3332
+ output += input[i2];
3314
3333
  }
3315
- if (component.query !== void 0) {
3316
- component.query = func(component.query);
3334
+ return output;
3335
+ }
3336
+ function normalizePathEncoding(input) {
3337
+ let output = "";
3338
+ for (let i2 = 0; i2 < input.length; i2++) {
3339
+ if (input[i2] === "%" && i2 + 2 < input.length) {
3340
+ const hex3 = input.slice(i2 + 1, i2 + 3);
3341
+ if (isHexPair(hex3)) {
3342
+ const normalizedHex = hex3.toUpperCase();
3343
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3344
+ if (decoded !== "." && isUnreserved(decoded)) {
3345
+ output += decoded;
3346
+ } else {
3347
+ output += "%" + normalizedHex;
3348
+ }
3349
+ i2 += 2;
3350
+ continue;
3351
+ }
3352
+ }
3353
+ if (isPathCharacter(input[i2])) {
3354
+ output += input[i2];
3355
+ } else {
3356
+ output += escape(input[i2]);
3357
+ }
3317
3358
  }
3318
- if (component.fragment !== void 0) {
3319
- component.fragment = func(component.fragment);
3359
+ return output;
3360
+ }
3361
+ function escapePreservingEscapes(input) {
3362
+ let output = "";
3363
+ for (let i2 = 0; i2 < input.length; i2++) {
3364
+ if (input[i2] === "%" && i2 + 2 < input.length) {
3365
+ const hex3 = input.slice(i2 + 1, i2 + 3);
3366
+ if (isHexPair(hex3)) {
3367
+ output += "%" + hex3.toUpperCase();
3368
+ i2 += 2;
3369
+ continue;
3370
+ }
3371
+ }
3372
+ output += escape(input[i2]);
3320
3373
  }
3321
- return component;
3374
+ return output;
3322
3375
  }
3323
3376
  function recomposeAuthority(component) {
3324
3377
  const uriTokens = [];
@@ -3333,7 +3386,7 @@ var require_utils = __commonJS({
3333
3386
  if (ipV6res.isIPV6 === true) {
3334
3387
  host = `[${ipV6res.escapedHost}]`;
3335
3388
  } else {
3336
- host = component.host;
3389
+ host = reescapeHostDelimiters(host, false);
3337
3390
  }
3338
3391
  }
3339
3392
  uriTokens.push(host);
@@ -3347,7 +3400,10 @@ var require_utils = __commonJS({
3347
3400
  module2.exports = {
3348
3401
  nonSimpleDomain,
3349
3402
  recomposeAuthority,
3350
- normalizeComponentEncoding,
3403
+ reescapeHostDelimiters,
3404
+ normalizePercentEncoding,
3405
+ normalizePathEncoding,
3406
+ escapePreservingEscapes,
3351
3407
  removeDotSegments,
3352
3408
  isIPv4,
3353
3409
  isUUID,
@@ -3571,12 +3627,12 @@ var require_schemes = __commonJS({
3571
3627
  var require_fast_uri = __commonJS({
3572
3628
  "node_modules/fast-uri/index.js"(exports2, module2) {
3573
3629
  "use strict";
3574
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
3630
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3575
3631
  var { SCHEMES, getSchemeHandler } = require_schemes();
3576
3632
  function normalize2(uri, options) {
3577
3633
  if (typeof uri === "string") {
3578
3634
  uri = /** @type {T} */
3579
- serialize(parse3(uri, options), options);
3635
+ normalizeString(uri, options);
3580
3636
  } else if (typeof uri === "object") {
3581
3637
  uri = /** @type {T} */
3582
3638
  parse3(serialize(uri, options), options);
@@ -3643,19 +3699,9 @@ var require_fast_uri = __commonJS({
3643
3699
  return target;
3644
3700
  }
3645
3701
  function equal(uriA, uriB, options) {
3646
- if (typeof uriA === "string") {
3647
- uriA = unescape(uriA);
3648
- uriA = serialize(normalizeComponentEncoding(parse3(uriA, options), true), { ...options, skipEscape: true });
3649
- } else if (typeof uriA === "object") {
3650
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
3651
- }
3652
- if (typeof uriB === "string") {
3653
- uriB = unescape(uriB);
3654
- uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), { ...options, skipEscape: true });
3655
- } else if (typeof uriB === "object") {
3656
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
3657
- }
3658
- return uriA.toLowerCase() === uriB.toLowerCase();
3702
+ const normalizedA = normalizeComparableURI(uriA, options);
3703
+ const normalizedB = normalizeComparableURI(uriB, options);
3704
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3659
3705
  }
3660
3706
  function serialize(cmpts, opts) {
3661
3707
  const component = {
@@ -3680,12 +3726,12 @@ var require_fast_uri = __commonJS({
3680
3726
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3681
3727
  if (component.path !== void 0) {
3682
3728
  if (!options.skipEscape) {
3683
- component.path = escape(component.path);
3729
+ component.path = escapePreservingEscapes(component.path);
3684
3730
  if (component.scheme !== void 0) {
3685
3731
  component.path = component.path.split("%3A").join(":");
3686
3732
  }
3687
3733
  } else {
3688
- component.path = unescape(component.path);
3734
+ component.path = normalizePercentEncoding(component.path);
3689
3735
  }
3690
3736
  }
3691
3737
  if (options.reference !== "suffix" && component.scheme) {
@@ -3720,7 +3766,16 @@ var require_fast_uri = __commonJS({
3720
3766
  return uriTokens.join("");
3721
3767
  }
3722
3768
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3723
- function parse3(uri, opts) {
3769
+ function getParseError(parsed, matches2) {
3770
+ if (matches2[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3771
+ return 'URI path must start with "/" when authority is present.';
3772
+ }
3773
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
3774
+ return "URI port is malformed.";
3775
+ }
3776
+ return void 0;
3777
+ }
3778
+ function parseWithStatus(uri, opts) {
3724
3779
  const options = Object.assign({}, opts);
3725
3780
  const parsed = {
3726
3781
  scheme: void 0,
@@ -3731,6 +3786,7 @@ var require_fast_uri = __commonJS({
3731
3786
  query: void 0,
3732
3787
  fragment: void 0
3733
3788
  };
3789
+ let malformedAuthorityOrPort = false;
3734
3790
  let isIP = false;
3735
3791
  if (options.reference === "suffix") {
3736
3792
  if (options.scheme) {
@@ -3751,6 +3807,11 @@ var require_fast_uri = __commonJS({
3751
3807
  if (isNaN(parsed.port)) {
3752
3808
  parsed.port = matches2[5];
3753
3809
  }
3810
+ const parseError = getParseError(parsed, matches2);
3811
+ if (parseError !== void 0) {
3812
+ parsed.error = parsed.error || parseError;
3813
+ malformedAuthorityOrPort = true;
3814
+ }
3754
3815
  if (parsed.host) {
3755
3816
  const ipv4result = isIPv4(parsed.host);
3756
3817
  if (ipv4result === false) {
@@ -3789,14 +3850,18 @@ var require_fast_uri = __commonJS({
3789
3850
  parsed.scheme = unescape(parsed.scheme);
3790
3851
  }
3791
3852
  if (parsed.host !== void 0) {
3792
- parsed.host = unescape(parsed.host);
3853
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3793
3854
  }
3794
3855
  }
3795
3856
  if (parsed.path) {
3796
- parsed.path = escape(unescape(parsed.path));
3857
+ parsed.path = normalizePathEncoding(parsed.path);
3797
3858
  }
3798
3859
  if (parsed.fragment) {
3799
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3860
+ try {
3861
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3862
+ } catch {
3863
+ parsed.error = parsed.error || "URI malformed";
3864
+ }
3800
3865
  }
3801
3866
  }
3802
3867
  if (schemeHandler && schemeHandler.parse) {
@@ -3805,7 +3870,29 @@ var require_fast_uri = __commonJS({
3805
3870
  } else {
3806
3871
  parsed.error = parsed.error || "URI can not be parsed.";
3807
3872
  }
3808
- return parsed;
3873
+ return { parsed, malformedAuthorityOrPort };
3874
+ }
3875
+ function parse3(uri, opts) {
3876
+ return parseWithStatus(uri, opts).parsed;
3877
+ }
3878
+ function normalizeString(uri, opts) {
3879
+ return normalizeStringWithStatus(uri, opts).normalized;
3880
+ }
3881
+ function normalizeStringWithStatus(uri, opts) {
3882
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3883
+ return {
3884
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3885
+ malformedAuthorityOrPort
3886
+ };
3887
+ }
3888
+ function normalizeComparableURI(uri, opts) {
3889
+ if (typeof uri === "string") {
3890
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3891
+ return malformedAuthorityOrPort ? void 0 : normalized;
3892
+ }
3893
+ if (typeof uri === "object") {
3894
+ return serialize(uri, opts);
3895
+ }
3809
3896
  }
3810
3897
  var fastUri = {
3811
3898
  SCHEMES,
@@ -6803,7 +6890,7 @@ var require_dist = __commonJS({
6803
6890
  var require_delayed_stream = __commonJS({
6804
6891
  "node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
6805
6892
  var Stream = require("stream").Stream;
6806
- var util4 = require("util");
6893
+ var util5 = require("util");
6807
6894
  module2.exports = DelayedStream;
6808
6895
  function DelayedStream() {
6809
6896
  this.source = null;
@@ -6814,7 +6901,7 @@ var require_delayed_stream = __commonJS({
6814
6901
  this._released = false;
6815
6902
  this._bufferedEvents = [];
6816
6903
  }
6817
- util4.inherits(DelayedStream, Stream);
6904
+ util5.inherits(DelayedStream, Stream);
6818
6905
  DelayedStream.create = function(source, options) {
6819
6906
  var delayedStream = new this();
6820
6907
  options = options || {};
@@ -6893,7 +6980,7 @@ var require_delayed_stream = __commonJS({
6893
6980
  // node_modules/combined-stream/lib/combined_stream.js
6894
6981
  var require_combined_stream = __commonJS({
6895
6982
  "node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
6896
- var util4 = require("util");
6983
+ var util5 = require("util");
6897
6984
  var Stream = require("stream").Stream;
6898
6985
  var DelayedStream = require_delayed_stream();
6899
6986
  module2.exports = CombinedStream;
@@ -6909,7 +6996,7 @@ var require_combined_stream = __commonJS({
6909
6996
  this._insideLoop = false;
6910
6997
  this._pendingNext = false;
6911
6998
  }
6912
- util4.inherits(CombinedStream, Stream);
6999
+ util5.inherits(CombinedStream, Stream);
6913
7000
  CombinedStream.create = function(options) {
6914
7001
  var combinedStream = new this();
6915
7002
  options = options || {};
@@ -16754,7 +16841,7 @@ var require_form_data = __commonJS({
16754
16841
  "node_modules/form-data/lib/form_data.js"(exports2, module2) {
16755
16842
  "use strict";
16756
16843
  var CombinedStream = require_combined_stream();
16757
- var util4 = require("util");
16844
+ var util5 = require("util");
16758
16845
  var path2 = require("path");
16759
16846
  var http4 = require("http");
16760
16847
  var https2 = require("https");
@@ -16780,7 +16867,7 @@ var require_form_data = __commonJS({
16780
16867
  this[option2] = options[option2];
16781
16868
  }
16782
16869
  }
16783
- util4.inherits(FormData3, CombinedStream);
16870
+ util5.inherits(FormData3, CombinedStream);
16784
16871
  FormData3.LINE_BREAK = "\r\n";
16785
16872
  FormData3.DEFAULT_CONTENT_TYPE = "application/octet-stream";
16786
16873
  FormData3.prototype.append = function(field, value, options) {
@@ -17535,14 +17622,14 @@ var require_browser = __commonJS({
17535
17622
  var require_node = __commonJS({
17536
17623
  "node_modules/debug/src/node.js"(exports2, module2) {
17537
17624
  var tty = require("tty");
17538
- var util4 = require("util");
17625
+ var util5 = require("util");
17539
17626
  exports2.init = init;
17540
17627
  exports2.log = log;
17541
17628
  exports2.formatArgs = formatArgs;
17542
17629
  exports2.save = save;
17543
17630
  exports2.load = load;
17544
17631
  exports2.useColors = useColors;
17545
- exports2.destroy = util4.deprecate(
17632
+ exports2.destroy = util5.deprecate(
17546
17633
  () => {
17547
17634
  },
17548
17635
  "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
@@ -17673,7 +17760,7 @@ var require_node = __commonJS({
17673
17760
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
17674
17761
  }
17675
17762
  function log(...args) {
17676
- return process.stderr.write(util4.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
17763
+ return process.stderr.write(util5.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
17677
17764
  }
17678
17765
  function save(namespaces) {
17679
17766
  if (namespaces) {
@@ -17696,11 +17783,11 @@ var require_node = __commonJS({
17696
17783
  var { formatters } = module2.exports;
17697
17784
  formatters.o = function(v2) {
17698
17785
  this.inspectOpts.colors = this.useColors;
17699
- return util4.inspect(v2, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
17786
+ return util5.inspect(v2, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
17700
17787
  };
17701
17788
  formatters.O = function(v2) {
17702
17789
  this.inspectOpts.colors = this.useColors;
17703
- return util4.inspect(v2, this.inspectOpts);
17790
+ return util5.inspect(v2, this.inspectOpts);
17704
17791
  };
17705
17792
  }
17706
17793
  });
@@ -17716,6 +17803,456 @@ var require_src = __commonJS({
17716
17803
  }
17717
17804
  });
17718
17805
 
17806
+ // node_modules/agent-base/dist/src/promisify.js
17807
+ var require_promisify = __commonJS({
17808
+ "node_modules/agent-base/dist/src/promisify.js"(exports2) {
17809
+ "use strict";
17810
+ Object.defineProperty(exports2, "__esModule", { value: true });
17811
+ function promisify(fn) {
17812
+ return function(req, opts) {
17813
+ return new Promise((resolve, reject) => {
17814
+ fn.call(this, req, opts, (err, rtn) => {
17815
+ if (err) {
17816
+ reject(err);
17817
+ } else {
17818
+ resolve(rtn);
17819
+ }
17820
+ });
17821
+ });
17822
+ };
17823
+ }
17824
+ exports2.default = promisify;
17825
+ }
17826
+ });
17827
+
17828
+ // node_modules/agent-base/dist/src/index.js
17829
+ var require_src2 = __commonJS({
17830
+ "node_modules/agent-base/dist/src/index.js"(exports2, module2) {
17831
+ "use strict";
17832
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
17833
+ return mod && mod.__esModule ? mod : { "default": mod };
17834
+ };
17835
+ var events_1 = require("events");
17836
+ var debug_1 = __importDefault(require_src());
17837
+ var promisify_1 = __importDefault(require_promisify());
17838
+ var debug = debug_1.default("agent-base");
17839
+ function isAgent(v2) {
17840
+ return Boolean(v2) && typeof v2.addRequest === "function";
17841
+ }
17842
+ function isSecureEndpoint() {
17843
+ const { stack } = new Error();
17844
+ if (typeof stack !== "string")
17845
+ return false;
17846
+ return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1);
17847
+ }
17848
+ function createAgent(callback, opts) {
17849
+ return new createAgent.Agent(callback, opts);
17850
+ }
17851
+ (function(createAgent2) {
17852
+ class Agent extends events_1.EventEmitter {
17853
+ constructor(callback, _opts) {
17854
+ super();
17855
+ let opts = _opts;
17856
+ if (typeof callback === "function") {
17857
+ this.callback = callback;
17858
+ } else if (callback) {
17859
+ opts = callback;
17860
+ }
17861
+ this.timeout = null;
17862
+ if (opts && typeof opts.timeout === "number") {
17863
+ this.timeout = opts.timeout;
17864
+ }
17865
+ this.maxFreeSockets = 1;
17866
+ this.maxSockets = 1;
17867
+ this.maxTotalSockets = Infinity;
17868
+ this.sockets = {};
17869
+ this.freeSockets = {};
17870
+ this.requests = {};
17871
+ this.options = {};
17872
+ }
17873
+ get defaultPort() {
17874
+ if (typeof this.explicitDefaultPort === "number") {
17875
+ return this.explicitDefaultPort;
17876
+ }
17877
+ return isSecureEndpoint() ? 443 : 80;
17878
+ }
17879
+ set defaultPort(v2) {
17880
+ this.explicitDefaultPort = v2;
17881
+ }
17882
+ get protocol() {
17883
+ if (typeof this.explicitProtocol === "string") {
17884
+ return this.explicitProtocol;
17885
+ }
17886
+ return isSecureEndpoint() ? "https:" : "http:";
17887
+ }
17888
+ set protocol(v2) {
17889
+ this.explicitProtocol = v2;
17890
+ }
17891
+ callback(req, opts, fn) {
17892
+ throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`');
17893
+ }
17894
+ /**
17895
+ * Called by node-core's "_http_client.js" module when creating
17896
+ * a new HTTP request with this Agent instance.
17897
+ *
17898
+ * @api public
17899
+ */
17900
+ addRequest(req, _opts) {
17901
+ const opts = Object.assign({}, _opts);
17902
+ if (typeof opts.secureEndpoint !== "boolean") {
17903
+ opts.secureEndpoint = isSecureEndpoint();
17904
+ }
17905
+ if (opts.host == null) {
17906
+ opts.host = "localhost";
17907
+ }
17908
+ if (opts.port == null) {
17909
+ opts.port = opts.secureEndpoint ? 443 : 80;
17910
+ }
17911
+ if (opts.protocol == null) {
17912
+ opts.protocol = opts.secureEndpoint ? "https:" : "http:";
17913
+ }
17914
+ if (opts.host && opts.path) {
17915
+ delete opts.path;
17916
+ }
17917
+ delete opts.agent;
17918
+ delete opts.hostname;
17919
+ delete opts._defaultAgent;
17920
+ delete opts.defaultPort;
17921
+ delete opts.createConnection;
17922
+ req._last = true;
17923
+ req.shouldKeepAlive = false;
17924
+ let timedOut = false;
17925
+ let timeoutId = null;
17926
+ const timeoutMs = opts.timeout || this.timeout;
17927
+ const onerror = (err) => {
17928
+ if (req._hadError)
17929
+ return;
17930
+ req.emit("error", err);
17931
+ req._hadError = true;
17932
+ };
17933
+ const ontimeout = () => {
17934
+ timeoutId = null;
17935
+ timedOut = true;
17936
+ const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`);
17937
+ err.code = "ETIMEOUT";
17938
+ onerror(err);
17939
+ };
17940
+ const callbackError = (err) => {
17941
+ if (timedOut)
17942
+ return;
17943
+ if (timeoutId !== null) {
17944
+ clearTimeout(timeoutId);
17945
+ timeoutId = null;
17946
+ }
17947
+ onerror(err);
17948
+ };
17949
+ const onsocket = (socket) => {
17950
+ if (timedOut)
17951
+ return;
17952
+ if (timeoutId != null) {
17953
+ clearTimeout(timeoutId);
17954
+ timeoutId = null;
17955
+ }
17956
+ if (isAgent(socket)) {
17957
+ debug("Callback returned another Agent instance %o", socket.constructor.name);
17958
+ socket.addRequest(req, opts);
17959
+ return;
17960
+ }
17961
+ if (socket) {
17962
+ socket.once("free", () => {
17963
+ this.freeSocket(socket, opts);
17964
+ });
17965
+ req.onSocket(socket);
17966
+ return;
17967
+ }
17968
+ const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
17969
+ onerror(err);
17970
+ };
17971
+ if (typeof this.callback !== "function") {
17972
+ onerror(new Error("`callback` is not defined"));
17973
+ return;
17974
+ }
17975
+ if (!this.promisifiedCallback) {
17976
+ if (this.callback.length >= 3) {
17977
+ debug("Converting legacy callback function to promise");
17978
+ this.promisifiedCallback = promisify_1.default(this.callback);
17979
+ } else {
17980
+ this.promisifiedCallback = this.callback;
17981
+ }
17982
+ }
17983
+ if (typeof timeoutMs === "number" && timeoutMs > 0) {
17984
+ timeoutId = setTimeout(ontimeout, timeoutMs);
17985
+ }
17986
+ if ("port" in opts && typeof opts.port !== "number") {
17987
+ opts.port = Number(opts.port);
17988
+ }
17989
+ try {
17990
+ debug("Resolving socket for %o request: %o", opts.protocol, `${req.method} ${req.path}`);
17991
+ Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError);
17992
+ } catch (err) {
17993
+ Promise.reject(err).catch(callbackError);
17994
+ }
17995
+ }
17996
+ freeSocket(socket, opts) {
17997
+ debug("Freeing socket %o %o", socket.constructor.name, opts);
17998
+ socket.destroy();
17999
+ }
18000
+ destroy() {
18001
+ debug("Destroying agent %o", this.constructor.name);
18002
+ }
18003
+ }
18004
+ createAgent2.Agent = Agent;
18005
+ createAgent2.prototype = createAgent2.Agent.prototype;
18006
+ })(createAgent || (createAgent = {}));
18007
+ module2.exports = createAgent;
18008
+ }
18009
+ });
18010
+
18011
+ // node_modules/https-proxy-agent/dist/parse-proxy-response.js
18012
+ var require_parse_proxy_response = __commonJS({
18013
+ "node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
18014
+ "use strict";
18015
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
18016
+ return mod && mod.__esModule ? mod : { "default": mod };
18017
+ };
18018
+ Object.defineProperty(exports2, "__esModule", { value: true });
18019
+ var debug_1 = __importDefault(require_src());
18020
+ var debug = debug_1.default("https-proxy-agent:parse-proxy-response");
18021
+ function parseProxyResponse(socket) {
18022
+ return new Promise((resolve, reject) => {
18023
+ let buffersLength = 0;
18024
+ const buffers = [];
18025
+ function read() {
18026
+ const b3 = socket.read();
18027
+ if (b3)
18028
+ ondata(b3);
18029
+ else
18030
+ socket.once("readable", read);
18031
+ }
18032
+ function cleanup() {
18033
+ socket.removeListener("end", onend);
18034
+ socket.removeListener("error", onerror);
18035
+ socket.removeListener("close", onclose);
18036
+ socket.removeListener("readable", read);
18037
+ }
18038
+ function onclose(err) {
18039
+ debug("onclose had error %o", err);
18040
+ }
18041
+ function onend() {
18042
+ debug("onend");
18043
+ }
18044
+ function onerror(err) {
18045
+ cleanup();
18046
+ debug("onerror %o", err);
18047
+ reject(err);
18048
+ }
18049
+ function ondata(b3) {
18050
+ buffers.push(b3);
18051
+ buffersLength += b3.length;
18052
+ const buffered = Buffer.concat(buffers, buffersLength);
18053
+ const endOfHeaders = buffered.indexOf("\r\n\r\n");
18054
+ if (endOfHeaders === -1) {
18055
+ debug("have not received end of HTTP headers yet...");
18056
+ read();
18057
+ return;
18058
+ }
18059
+ const firstLine = buffered.toString("ascii", 0, buffered.indexOf("\r\n"));
18060
+ const statusCode = +firstLine.split(" ")[1];
18061
+ debug("got proxy server response: %o", firstLine);
18062
+ resolve({
18063
+ statusCode,
18064
+ buffered
18065
+ });
18066
+ }
18067
+ socket.on("error", onerror);
18068
+ socket.on("close", onclose);
18069
+ socket.on("end", onend);
18070
+ read();
18071
+ });
18072
+ }
18073
+ exports2.default = parseProxyResponse;
18074
+ }
18075
+ });
18076
+
18077
+ // node_modules/https-proxy-agent/dist/agent.js
18078
+ var require_agent = __commonJS({
18079
+ "node_modules/https-proxy-agent/dist/agent.js"(exports2) {
18080
+ "use strict";
18081
+ var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P3, generator2) {
18082
+ function adopt(value) {
18083
+ return value instanceof P3 ? value : new P3(function(resolve) {
18084
+ resolve(value);
18085
+ });
18086
+ }
18087
+ return new (P3 || (P3 = Promise))(function(resolve, reject) {
18088
+ function fulfilled(value) {
18089
+ try {
18090
+ step(generator2.next(value));
18091
+ } catch (e) {
18092
+ reject(e);
18093
+ }
18094
+ }
18095
+ function rejected(value) {
18096
+ try {
18097
+ step(generator2["throw"](value));
18098
+ } catch (e) {
18099
+ reject(e);
18100
+ }
18101
+ }
18102
+ function step(result) {
18103
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18104
+ }
18105
+ step((generator2 = generator2.apply(thisArg, _arguments || [])).next());
18106
+ });
18107
+ };
18108
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
18109
+ return mod && mod.__esModule ? mod : { "default": mod };
18110
+ };
18111
+ Object.defineProperty(exports2, "__esModule", { value: true });
18112
+ var net_1 = __importDefault(require("net"));
18113
+ var tls_1 = __importDefault(require("tls"));
18114
+ var url_1 = __importDefault(require("url"));
18115
+ var assert_1 = __importDefault(require("assert"));
18116
+ var debug_1 = __importDefault(require_src());
18117
+ var agent_base_1 = require_src2();
18118
+ var parse_proxy_response_1 = __importDefault(require_parse_proxy_response());
18119
+ var debug = debug_1.default("https-proxy-agent:agent");
18120
+ var HttpsProxyAgent2 = class extends agent_base_1.Agent {
18121
+ constructor(_opts) {
18122
+ let opts;
18123
+ if (typeof _opts === "string") {
18124
+ opts = url_1.default.parse(_opts);
18125
+ } else {
18126
+ opts = _opts;
18127
+ }
18128
+ if (!opts) {
18129
+ throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");
18130
+ }
18131
+ debug("creating new HttpsProxyAgent instance: %o", opts);
18132
+ super(opts);
18133
+ const proxy = Object.assign({}, opts);
18134
+ this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
18135
+ proxy.host = proxy.hostname || proxy.host;
18136
+ if (typeof proxy.port === "string") {
18137
+ proxy.port = parseInt(proxy.port, 10);
18138
+ }
18139
+ if (!proxy.port && proxy.host) {
18140
+ proxy.port = this.secureProxy ? 443 : 80;
18141
+ }
18142
+ if (this.secureProxy && !("ALPNProtocols" in proxy)) {
18143
+ proxy.ALPNProtocols = ["http 1.1"];
18144
+ }
18145
+ if (proxy.host && proxy.path) {
18146
+ delete proxy.path;
18147
+ delete proxy.pathname;
18148
+ }
18149
+ this.proxy = proxy;
18150
+ }
18151
+ /**
18152
+ * Called when the node-core HTTP client library is creating a
18153
+ * new HTTP request.
18154
+ *
18155
+ * @api protected
18156
+ */
18157
+ callback(req, opts) {
18158
+ return __awaiter(this, void 0, void 0, function* () {
18159
+ const { proxy, secureProxy } = this;
18160
+ let socket;
18161
+ if (secureProxy) {
18162
+ debug("Creating `tls.Socket`: %o", proxy);
18163
+ socket = tls_1.default.connect(proxy);
18164
+ } else {
18165
+ debug("Creating `net.Socket`: %o", proxy);
18166
+ socket = net_1.default.connect(proxy);
18167
+ }
18168
+ const headers = Object.assign({}, proxy.headers);
18169
+ const hostname3 = `${opts.host}:${opts.port}`;
18170
+ let payload = `CONNECT ${hostname3} HTTP/1.1\r
18171
+ `;
18172
+ if (proxy.auth) {
18173
+ headers["Proxy-Authorization"] = `Basic ${Buffer.from(proxy.auth).toString("base64")}`;
18174
+ }
18175
+ let { host, port, secureEndpoint } = opts;
18176
+ if (!isDefaultPort(port, secureEndpoint)) {
18177
+ host += `:${port}`;
18178
+ }
18179
+ headers.Host = host;
18180
+ headers.Connection = "close";
18181
+ for (const name of Object.keys(headers)) {
18182
+ payload += `${name}: ${headers[name]}\r
18183
+ `;
18184
+ }
18185
+ const proxyResponsePromise = parse_proxy_response_1.default(socket);
18186
+ socket.write(`${payload}\r
18187
+ `);
18188
+ const { statusCode, buffered } = yield proxyResponsePromise;
18189
+ if (statusCode === 200) {
18190
+ req.once("socket", resume);
18191
+ if (opts.secureEndpoint) {
18192
+ debug("Upgrading socket connection to TLS");
18193
+ const servername = opts.servername || opts.host;
18194
+ return tls_1.default.connect(Object.assign(Object.assign({}, omit2(opts, "host", "hostname", "path", "port")), {
18195
+ socket,
18196
+ servername
18197
+ }));
18198
+ }
18199
+ return socket;
18200
+ }
18201
+ socket.destroy();
18202
+ const fakeSocket = new net_1.default.Socket({ writable: false });
18203
+ fakeSocket.readable = true;
18204
+ req.once("socket", (s2) => {
18205
+ debug("replaying proxy buffer for failed request");
18206
+ assert_1.default(s2.listenerCount("data") > 0);
18207
+ s2.push(buffered);
18208
+ s2.push(null);
18209
+ });
18210
+ return fakeSocket;
18211
+ });
18212
+ }
18213
+ };
18214
+ exports2.default = HttpsProxyAgent2;
18215
+ function resume(socket) {
18216
+ socket.resume();
18217
+ }
18218
+ function isDefaultPort(port, secure) {
18219
+ return Boolean(!secure && port === 80 || secure && port === 443);
18220
+ }
18221
+ function isHTTPS(protocol) {
18222
+ return typeof protocol === "string" ? /^https:?$/i.test(protocol) : false;
18223
+ }
18224
+ function omit2(obj, ...keys) {
18225
+ const ret = {};
18226
+ let key2;
18227
+ for (key2 in obj) {
18228
+ if (!keys.includes(key2)) {
18229
+ ret[key2] = obj[key2];
18230
+ }
18231
+ }
18232
+ return ret;
18233
+ }
18234
+ }
18235
+ });
18236
+
18237
+ // node_modules/https-proxy-agent/dist/index.js
18238
+ var require_dist2 = __commonJS({
18239
+ "node_modules/https-proxy-agent/dist/index.js"(exports2, module2) {
18240
+ "use strict";
18241
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
18242
+ return mod && mod.__esModule ? mod : { "default": mod };
18243
+ };
18244
+ var agent_1 = __importDefault(require_agent());
18245
+ function createHttpsProxyAgent(opts) {
18246
+ return new agent_1.default(opts);
18247
+ }
18248
+ (function(createHttpsProxyAgent2) {
18249
+ createHttpsProxyAgent2.HttpsProxyAgent = agent_1.default;
18250
+ createHttpsProxyAgent2.prototype = agent_1.default.prototype;
18251
+ })(createHttpsProxyAgent || (createHttpsProxyAgent = {}));
18252
+ module2.exports = createHttpsProxyAgent;
18253
+ }
18254
+ });
18255
+
17719
18256
  // node_modules/follow-redirects/debug.js
17720
18257
  var require_debug = __commonJS({
17721
18258
  "node_modules/follow-redirects/debug.js"(exports2, module2) {
@@ -17760,6 +18297,11 @@ var require_follow_redirects = __commonJS({
17760
18297
  } catch (error2) {
17761
18298
  useNativeURL = error2.code === "ERR_INVALID_URL";
17762
18299
  }
18300
+ var sensitiveHeaders = [
18301
+ "Authorization",
18302
+ "Proxy-Authorization",
18303
+ "Cookie"
18304
+ ];
17763
18305
  var preservedUrlFields = [
17764
18306
  "auth",
17765
18307
  "host",
@@ -17824,6 +18366,7 @@ var require_follow_redirects = __commonJS({
17824
18366
  self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
17825
18367
  }
17826
18368
  };
18369
+ this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex2).join("|") + ")$", "i");
17827
18370
  this._performRequest();
17828
18371
  }
17829
18372
  RedirectableRequest.prototype = Object.create(Writable.prototype);
@@ -17961,6 +18504,9 @@ var require_follow_redirects = __commonJS({
17961
18504
  if (!options.headers) {
17962
18505
  options.headers = {};
17963
18506
  }
18507
+ if (!isArray2(options.sensitiveHeaders)) {
18508
+ options.sensitiveHeaders = [];
18509
+ }
17964
18510
  if (options.host) {
17965
18511
  if (!options.hostname) {
17966
18512
  options.hostname = options.host;
@@ -18066,7 +18612,7 @@ var require_follow_redirects = __commonJS({
18066
18612
  this._isRedirect = true;
18067
18613
  spreadUrlObject(redirectUrl, this._options);
18068
18614
  if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
18069
- removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
18615
+ removeMatchingHeaders(this._headerFilter, this._options.headers);
18070
18616
  }
18071
18617
  if (isFunction3(beforeRedirect)) {
18072
18618
  var responseDetails = {
@@ -18215,6 +18761,9 @@ var require_follow_redirects = __commonJS({
18215
18761
  var dot = subdomain.length - domain2.length - 1;
18216
18762
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain2);
18217
18763
  }
18764
+ function isArray2(value) {
18765
+ return value instanceof Array;
18766
+ }
18218
18767
  function isString2(value) {
18219
18768
  return typeof value === "string" || value instanceof String;
18220
18769
  }
@@ -18227,6 +18776,9 @@ var require_follow_redirects = __commonJS({
18227
18776
  function isURL(value) {
18228
18777
  return URL2 && value instanceof URL2;
18229
18778
  }
18779
+ function escapeRegex2(regex) {
18780
+ return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
18781
+ }
18230
18782
  module2.exports = wrap({ http: http4, https: https2 });
18231
18783
  module2.exports.wrap = wrap;
18232
18784
  }
@@ -18234,37 +18786,37 @@ var require_follow_redirects = __commonJS({
18234
18786
 
18235
18787
  // node_modules/zod/v3/helpers/util.js
18236
18788
  var util;
18237
- (function(util4) {
18238
- util4.assertEqual = (_3) => {
18789
+ (function(util5) {
18790
+ util5.assertEqual = (_3) => {
18239
18791
  };
18240
18792
  function assertIs2(_arg) {
18241
18793
  }
18242
- util4.assertIs = assertIs2;
18794
+ util5.assertIs = assertIs2;
18243
18795
  function assertNever2(_x) {
18244
18796
  throw new Error();
18245
18797
  }
18246
- util4.assertNever = assertNever2;
18247
- util4.arrayToEnum = (items) => {
18798
+ util5.assertNever = assertNever2;
18799
+ util5.arrayToEnum = (items) => {
18248
18800
  const obj = {};
18249
18801
  for (const item of items) {
18250
18802
  obj[item] = item;
18251
18803
  }
18252
18804
  return obj;
18253
18805
  };
18254
- util4.getValidEnumValues = (obj) => {
18255
- const validKeys = util4.objectKeys(obj).filter((k3) => typeof obj[obj[k3]] !== "number");
18806
+ util5.getValidEnumValues = (obj) => {
18807
+ const validKeys = util5.objectKeys(obj).filter((k3) => typeof obj[obj[k3]] !== "number");
18256
18808
  const filtered = {};
18257
18809
  for (const k3 of validKeys) {
18258
18810
  filtered[k3] = obj[k3];
18259
18811
  }
18260
- return util4.objectValues(filtered);
18812
+ return util5.objectValues(filtered);
18261
18813
  };
18262
- util4.objectValues = (obj) => {
18263
- return util4.objectKeys(obj).map(function(e) {
18814
+ util5.objectValues = (obj) => {
18815
+ return util5.objectKeys(obj).map(function(e) {
18264
18816
  return obj[e];
18265
18817
  });
18266
18818
  };
18267
- util4.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
18819
+ util5.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
18268
18820
  const keys = [];
18269
18821
  for (const key2 in object3) {
18270
18822
  if (Object.prototype.hasOwnProperty.call(object3, key2)) {
@@ -18273,19 +18825,19 @@ var util;
18273
18825
  }
18274
18826
  return keys;
18275
18827
  };
18276
- util4.find = (arr, checker) => {
18828
+ util5.find = (arr, checker) => {
18277
18829
  for (const item of arr) {
18278
18830
  if (checker(item))
18279
18831
  return item;
18280
18832
  }
18281
18833
  return void 0;
18282
18834
  };
18283
- util4.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
18835
+ util5.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
18284
18836
  function joinValues2(array2, separator = " | ") {
18285
18837
  return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
18286
18838
  }
18287
- util4.joinValues = joinValues2;
18288
- util4.jsonStringifyReplacer = (_3, value) => {
18839
+ util5.joinValues = joinValues2;
18840
+ util5.jsonStringifyReplacer = (_3, value) => {
18289
18841
  if (typeof value === "bigint") {
18290
18842
  return value.toString();
18291
18843
  }
@@ -34656,7 +35208,7 @@ var StdioServerTransport = class {
34656
35208
  // package.json
34657
35209
  var package_default = {
34658
35210
  name: "@gravitykit/block-mcp",
34659
- version: "2.0.0-beta",
35211
+ version: "2.0.1",
34660
35212
  description: "MCP server for WordPress block-level content management with preference-aware editing",
34661
35213
  main: "dist/index.cjs",
34662
35214
  bin: {
@@ -34672,6 +35224,7 @@ var package_default = {
34672
35224
  test: "vitest run",
34673
35225
  "test:watch": "vitest",
34674
35226
  "test:integration": "vitest run --config vitest.integration.config.ts",
35227
+ "test:docs": "playwright test --config tests/docs/playwright.config.ts",
34675
35228
  eval: "tsx tests/evals/lib/runner.ts",
34676
35229
  "eval:fixture-refresh": "tsx tests/evals/scripts/fetch-fixture.ts",
34677
35230
  prepare: "npm run build",
@@ -34697,14 +35250,17 @@ var package_default = {
34697
35250
  },
34698
35251
  dependencies: {
34699
35252
  "@modelcontextprotocol/sdk": "^1.0.0",
34700
- axios: "^1.7.9"
35253
+ axios: "^1.7.9",
35254
+ "form-data": "^4.0.1"
34701
35255
  },
34702
35256
  devDependencies: {
34703
35257
  "@anthropic-ai/sdk": "^0.91.1",
35258
+ "@playwright/test": "^1.49.0",
34704
35259
  "@shikijs/engine-javascript": "^4.0.2",
34705
35260
  "@shikijs/langs": "^4.0.2",
34706
35261
  "@types/node": "^22.0.0",
34707
35262
  esbuild: "^0.27.3",
35263
+ sharp: "^0.33.5",
34708
35264
  shiki: "^4.0.2",
34709
35265
  tsx: "^4.21.0",
34710
35266
  typescript: "^5.7.0",
@@ -34801,9 +35357,14 @@ function getGlobal() {
34801
35357
  var G = getGlobal();
34802
35358
  var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
34803
35359
  var isFormData = (thing) => {
34804
- let kind;
34805
- return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
34806
- kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
35360
+ if (!thing) return false;
35361
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
35362
+ const proto = getPrototypeOf(thing);
35363
+ if (!proto || proto === Object.prototype) return false;
35364
+ if (!isFunction(thing.append)) return false;
35365
+ const kind = kindOf(thing);
35366
+ return kind === "formdata" || // detect form-data instance
35367
+ kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]";
34807
35368
  };
34808
35369
  var isURLSearchParams = kindOfTest("URLSearchParams");
34809
35370
  var [isReadableStream, isRequest, isResponse, isHeaders] = [
@@ -34862,16 +35423,17 @@ var _global = (() => {
34862
35423
  return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
34863
35424
  })();
34864
35425
  var isContextDefined = (context) => !isUndefined(context) && context !== _global;
34865
- function merge2() {
35426
+ function merge2(...objs) {
34866
35427
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
34867
35428
  const result = {};
34868
35429
  const assignValue = (val, key2) => {
34869
35430
  if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") {
34870
35431
  return;
34871
35432
  }
34872
- const targetKey = caseless && findKey(result, key2) || key2;
34873
- if (isPlainObject3(result[targetKey]) && isPlainObject3(val)) {
34874
- result[targetKey] = merge2(result[targetKey], val);
35433
+ const targetKey = caseless && typeof key2 === "string" && findKey(result, key2) || key2;
35434
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
35435
+ if (isPlainObject3(existing) && isPlainObject3(val)) {
35436
+ result[targetKey] = merge2(existing, val);
34875
35437
  } else if (isPlainObject3(val)) {
34876
35438
  result[targetKey] = merge2({}, val);
34877
35439
  } else if (isArray(val)) {
@@ -34880,8 +35442,22 @@ function merge2() {
34880
35442
  result[targetKey] = val;
34881
35443
  }
34882
35444
  };
34883
- for (let i2 = 0, l3 = arguments.length; i2 < l3; i2++) {
34884
- arguments[i2] && forEach(arguments[i2], assignValue);
35445
+ for (let i2 = 0, l3 = objs.length; i2 < l3; i2++) {
35446
+ const source = objs[i2];
35447
+ if (!source || isBuffer(source)) {
35448
+ continue;
35449
+ }
35450
+ forEach(source, assignValue);
35451
+ if (typeof source !== "object" || isArray(source)) {
35452
+ continue;
35453
+ }
35454
+ const symbols = Object.getOwnPropertySymbols(source);
35455
+ for (let j2 = 0; j2 < symbols.length; j2++) {
35456
+ const symbol2 = symbols[j2];
35457
+ if (propertyIsEnumerable.call(source, symbol2)) {
35458
+ assignValue(source[symbol2], symbol2);
35459
+ }
35460
+ }
34885
35461
  }
34886
35462
  return result;
34887
35463
  }
@@ -34891,6 +35467,9 @@ var extend2 = (a2, b3, thisArg, { allOwnKeys } = {}) => {
34891
35467
  (val, key2) => {
34892
35468
  if (thisArg && isFunction(val)) {
34893
35469
  Object.defineProperty(a2, key2, {
35470
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
35471
+ // hijack defineProperty's accessor-vs-data resolution.
35472
+ __proto__: null,
34894
35473
  value: bind(val, thisArg),
34895
35474
  writable: true,
34896
35475
  enumerable: true,
@@ -34898,6 +35477,7 @@ var extend2 = (a2, b3, thisArg, { allOwnKeys } = {}) => {
34898
35477
  });
34899
35478
  } else {
34900
35479
  Object.defineProperty(a2, key2, {
35480
+ __proto__: null,
34901
35481
  value: val,
34902
35482
  writable: true,
34903
35483
  enumerable: true,
@@ -34918,12 +35498,14 @@ var stripBOM = (content) => {
34918
35498
  var inherits = (constructor, superConstructor, props, descriptors) => {
34919
35499
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
34920
35500
  Object.defineProperty(constructor.prototype, "constructor", {
35501
+ __proto__: null,
34921
35502
  value: constructor,
34922
35503
  writable: true,
34923
35504
  enumerable: false,
34924
35505
  configurable: true
34925
35506
  });
34926
35507
  Object.defineProperty(constructor, "super", {
35508
+ __proto__: null,
34927
35509
  value: superConstructor.prototype
34928
35510
  });
34929
35511
  props && Object.assign(constructor.prototype, props);
@@ -34998,6 +35580,7 @@ var toCamelCase = (str) => {
34998
35580
  });
34999
35581
  };
35000
35582
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
35583
+ var { propertyIsEnumerable } = Object.prototype;
35001
35584
  var isRegExp = kindOfTest("RegExp");
35002
35585
  var reduceDescriptors = (obj, reducer) => {
35003
35586
  const descriptors = Object.getOwnPropertyDescriptors(obj);
@@ -35012,7 +35595,7 @@ var reduceDescriptors = (obj, reducer) => {
35012
35595
  };
35013
35596
  var freezeMethods = (obj) => {
35014
35597
  reduceDescriptors(obj, (descriptor, name) => {
35015
- if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
35598
+ if (isFunction(obj) && ["arguments", "caller", "callee"].includes(name)) {
35016
35599
  return false;
35017
35600
  }
35018
35601
  const value = obj[name];
@@ -35048,29 +35631,29 @@ function isSpecCompliantForm(thing) {
35048
35631
  return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
35049
35632
  }
35050
35633
  var toJSONObject = (obj) => {
35051
- const stack = new Array(10);
35052
- const visit = (source, i2) => {
35634
+ const visited = /* @__PURE__ */ new WeakSet();
35635
+ const visit = (source) => {
35053
35636
  if (isObject2(source)) {
35054
- if (stack.indexOf(source) >= 0) {
35637
+ if (visited.has(source)) {
35055
35638
  return;
35056
35639
  }
35057
35640
  if (isBuffer(source)) {
35058
35641
  return source;
35059
35642
  }
35060
35643
  if (!("toJSON" in source)) {
35061
- stack[i2] = source;
35644
+ visited.add(source);
35062
35645
  const target = isArray(source) ? [] : {};
35063
35646
  forEach(source, (value, key2) => {
35064
- const reducedValue = visit(value, i2 + 1);
35647
+ const reducedValue = visit(value);
35065
35648
  !isUndefined(reducedValue) && (target[key2] = reducedValue);
35066
35649
  });
35067
- stack[i2] = void 0;
35650
+ visited.delete(source);
35068
35651
  return target;
35069
35652
  }
35070
35653
  }
35071
35654
  return source;
35072
35655
  };
35073
- return visit(obj, 0);
35656
+ return visit(obj);
35074
35657
  };
35075
35658
  var isAsyncFn = kindOfTest("AsyncFunction");
35076
35659
  var isThenable = (thing) => thing && (isObject2(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
@@ -35159,7 +35742,381 @@ var utils_default = {
35159
35742
  isIterable
35160
35743
  };
35161
35744
 
35745
+ // node_modules/axios/lib/helpers/parseHeaders.js
35746
+ var ignoreDuplicateOf = utils_default.toObjectSet([
35747
+ "age",
35748
+ "authorization",
35749
+ "content-length",
35750
+ "content-type",
35751
+ "etag",
35752
+ "expires",
35753
+ "from",
35754
+ "host",
35755
+ "if-modified-since",
35756
+ "if-unmodified-since",
35757
+ "last-modified",
35758
+ "location",
35759
+ "max-forwards",
35760
+ "proxy-authorization",
35761
+ "referer",
35762
+ "retry-after",
35763
+ "user-agent"
35764
+ ]);
35765
+ var parseHeaders_default = (rawHeaders) => {
35766
+ const parsed = {};
35767
+ let key2;
35768
+ let val;
35769
+ let i2;
35770
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
35771
+ i2 = line.indexOf(":");
35772
+ key2 = line.substring(0, i2).trim().toLowerCase();
35773
+ val = line.substring(i2 + 1).trim();
35774
+ if (!key2 || parsed[key2] && ignoreDuplicateOf[key2]) {
35775
+ return;
35776
+ }
35777
+ if (key2 === "set-cookie") {
35778
+ if (parsed[key2]) {
35779
+ parsed[key2].push(val);
35780
+ } else {
35781
+ parsed[key2] = [val];
35782
+ }
35783
+ } else {
35784
+ parsed[key2] = parsed[key2] ? parsed[key2] + ", " + val : val;
35785
+ }
35786
+ });
35787
+ return parsed;
35788
+ };
35789
+
35790
+ // node_modules/axios/lib/helpers/sanitizeHeaderValue.js
35791
+ function trimSPorHTAB(str) {
35792
+ let start = 0;
35793
+ let end = str.length;
35794
+ while (start < end) {
35795
+ const code = str.charCodeAt(start);
35796
+ if (code !== 9 && code !== 32) {
35797
+ break;
35798
+ }
35799
+ start += 1;
35800
+ }
35801
+ while (end > start) {
35802
+ const code = str.charCodeAt(end - 1);
35803
+ if (code !== 9 && code !== 32) {
35804
+ break;
35805
+ }
35806
+ end -= 1;
35807
+ }
35808
+ return start === 0 && end === str.length ? str : str.slice(start, end);
35809
+ }
35810
+ var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g");
35811
+ var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
35812
+ function sanitizeValue(value, invalidChars) {
35813
+ if (utils_default.isArray(value)) {
35814
+ return value.map((item) => sanitizeValue(item, invalidChars));
35815
+ }
35816
+ return trimSPorHTAB(String(value).replace(invalidChars, ""));
35817
+ }
35818
+ var sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
35819
+ var sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
35820
+ function toByteStringHeaderObject(headers) {
35821
+ const byteStringHeaders = /* @__PURE__ */ Object.create(null);
35822
+ utils_default.forEach(headers.toJSON(), (value, header) => {
35823
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
35824
+ });
35825
+ return byteStringHeaders;
35826
+ }
35827
+
35828
+ // node_modules/axios/lib/core/AxiosHeaders.js
35829
+ var $internals = /* @__PURE__ */ Symbol("internals");
35830
+ function normalizeHeader(header) {
35831
+ return header && String(header).trim().toLowerCase();
35832
+ }
35833
+ function normalizeValue(value) {
35834
+ if (value === false || value == null) {
35835
+ return value;
35836
+ }
35837
+ return utils_default.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
35838
+ }
35839
+ function parseTokens(str) {
35840
+ const tokens = /* @__PURE__ */ Object.create(null);
35841
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
35842
+ let match;
35843
+ while (match = tokensRE.exec(str)) {
35844
+ tokens[match[1]] = match[2];
35845
+ }
35846
+ return tokens;
35847
+ }
35848
+ var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
35849
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
35850
+ if (utils_default.isFunction(filter2)) {
35851
+ return filter2.call(this, value, header);
35852
+ }
35853
+ if (isHeaderNameFilter) {
35854
+ value = header;
35855
+ }
35856
+ if (!utils_default.isString(value)) return;
35857
+ if (utils_default.isString(filter2)) {
35858
+ return value.indexOf(filter2) !== -1;
35859
+ }
35860
+ if (utils_default.isRegExp(filter2)) {
35861
+ return filter2.test(value);
35862
+ }
35863
+ }
35864
+ function formatHeader(header) {
35865
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w3, char, str) => {
35866
+ return char.toUpperCase() + str;
35867
+ });
35868
+ }
35869
+ function buildAccessors(obj, header) {
35870
+ const accessorName = utils_default.toCamelCase(" " + header);
35871
+ ["get", "set", "has"].forEach((methodName) => {
35872
+ Object.defineProperty(obj, methodName + accessorName, {
35873
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
35874
+ // this data descriptor into an accessor descriptor on the way in.
35875
+ __proto__: null,
35876
+ value: function(arg1, arg2, arg3) {
35877
+ return this[methodName].call(this, header, arg1, arg2, arg3);
35878
+ },
35879
+ configurable: true
35880
+ });
35881
+ });
35882
+ }
35883
+ var AxiosHeaders = class {
35884
+ constructor(headers) {
35885
+ headers && this.set(headers);
35886
+ }
35887
+ set(header, valueOrRewrite, rewrite) {
35888
+ const self2 = this;
35889
+ function setHeader(_value, _header, _rewrite) {
35890
+ const lHeader = normalizeHeader(_header);
35891
+ if (!lHeader) {
35892
+ return;
35893
+ }
35894
+ const key2 = utils_default.findKey(self2, lHeader);
35895
+ if (!key2 || self2[key2] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key2] !== false) {
35896
+ self2[key2 || _header] = normalizeValue(_value);
35897
+ }
35898
+ }
35899
+ const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
35900
+ if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
35901
+ setHeaders(header, valueOrRewrite);
35902
+ } else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
35903
+ setHeaders(parseHeaders_default(header), valueOrRewrite);
35904
+ } else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
35905
+ let obj = {}, dest, key2;
35906
+ for (const entry of header) {
35907
+ if (!utils_default.isArray(entry)) {
35908
+ throw new TypeError("Object iterator must return a key-value pair");
35909
+ }
35910
+ obj[key2 = entry[0]] = (dest = obj[key2]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
35911
+ }
35912
+ setHeaders(obj, valueOrRewrite);
35913
+ } else {
35914
+ header != null && setHeader(valueOrRewrite, header, rewrite);
35915
+ }
35916
+ return this;
35917
+ }
35918
+ get(header, parser) {
35919
+ header = normalizeHeader(header);
35920
+ if (header) {
35921
+ const key2 = utils_default.findKey(this, header);
35922
+ if (key2) {
35923
+ const value = this[key2];
35924
+ if (!parser) {
35925
+ return value;
35926
+ }
35927
+ if (parser === true) {
35928
+ return parseTokens(value);
35929
+ }
35930
+ if (utils_default.isFunction(parser)) {
35931
+ return parser.call(this, value, key2);
35932
+ }
35933
+ if (utils_default.isRegExp(parser)) {
35934
+ return parser.exec(value);
35935
+ }
35936
+ throw new TypeError("parser must be boolean|regexp|function");
35937
+ }
35938
+ }
35939
+ }
35940
+ has(header, matcher) {
35941
+ header = normalizeHeader(header);
35942
+ if (header) {
35943
+ const key2 = utils_default.findKey(this, header);
35944
+ return !!(key2 && this[key2] !== void 0 && (!matcher || matchHeaderValue(this, this[key2], key2, matcher)));
35945
+ }
35946
+ return false;
35947
+ }
35948
+ delete(header, matcher) {
35949
+ const self2 = this;
35950
+ let deleted = false;
35951
+ function deleteHeader(_header) {
35952
+ _header = normalizeHeader(_header);
35953
+ if (_header) {
35954
+ const key2 = utils_default.findKey(self2, _header);
35955
+ if (key2 && (!matcher || matchHeaderValue(self2, self2[key2], key2, matcher))) {
35956
+ delete self2[key2];
35957
+ deleted = true;
35958
+ }
35959
+ }
35960
+ }
35961
+ if (utils_default.isArray(header)) {
35962
+ header.forEach(deleteHeader);
35963
+ } else {
35964
+ deleteHeader(header);
35965
+ }
35966
+ return deleted;
35967
+ }
35968
+ clear(matcher) {
35969
+ const keys = Object.keys(this);
35970
+ let i2 = keys.length;
35971
+ let deleted = false;
35972
+ while (i2--) {
35973
+ const key2 = keys[i2];
35974
+ if (!matcher || matchHeaderValue(this, this[key2], key2, matcher, true)) {
35975
+ delete this[key2];
35976
+ deleted = true;
35977
+ }
35978
+ }
35979
+ return deleted;
35980
+ }
35981
+ normalize(format) {
35982
+ const self2 = this;
35983
+ const headers = {};
35984
+ utils_default.forEach(this, (value, header) => {
35985
+ const key2 = utils_default.findKey(headers, header);
35986
+ if (key2) {
35987
+ self2[key2] = normalizeValue(value);
35988
+ delete self2[header];
35989
+ return;
35990
+ }
35991
+ const normalized = format ? formatHeader(header) : String(header).trim();
35992
+ if (normalized !== header) {
35993
+ delete self2[header];
35994
+ }
35995
+ self2[normalized] = normalizeValue(value);
35996
+ headers[normalized] = true;
35997
+ });
35998
+ return this;
35999
+ }
36000
+ concat(...targets) {
36001
+ return this.constructor.concat(this, ...targets);
36002
+ }
36003
+ toJSON(asStrings) {
36004
+ const obj = /* @__PURE__ */ Object.create(null);
36005
+ utils_default.forEach(this, (value, header) => {
36006
+ value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
36007
+ });
36008
+ return obj;
36009
+ }
36010
+ [Symbol.iterator]() {
36011
+ return Object.entries(this.toJSON())[Symbol.iterator]();
36012
+ }
36013
+ toString() {
36014
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
36015
+ }
36016
+ getSetCookie() {
36017
+ return this.get("set-cookie") || [];
36018
+ }
36019
+ get [Symbol.toStringTag]() {
36020
+ return "AxiosHeaders";
36021
+ }
36022
+ static from(thing) {
36023
+ return thing instanceof this ? thing : new this(thing);
36024
+ }
36025
+ static concat(first, ...targets) {
36026
+ const computed = new this(first);
36027
+ targets.forEach((target) => computed.set(target));
36028
+ return computed;
36029
+ }
36030
+ static accessor(header) {
36031
+ const internals = this[$internals] = this[$internals] = {
36032
+ accessors: {}
36033
+ };
36034
+ const accessors = internals.accessors;
36035
+ const prototype2 = this.prototype;
36036
+ function defineAccessor(_header) {
36037
+ const lHeader = normalizeHeader(_header);
36038
+ if (!accessors[lHeader]) {
36039
+ buildAccessors(prototype2, _header);
36040
+ accessors[lHeader] = true;
36041
+ }
36042
+ }
36043
+ utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
36044
+ return this;
36045
+ }
36046
+ };
36047
+ AxiosHeaders.accessor([
36048
+ "Content-Type",
36049
+ "Content-Length",
36050
+ "Accept",
36051
+ "Accept-Encoding",
36052
+ "User-Agent",
36053
+ "Authorization"
36054
+ ]);
36055
+ utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key2) => {
36056
+ let mapped = key2[0].toUpperCase() + key2.slice(1);
36057
+ return {
36058
+ get: () => value,
36059
+ set(headerValue) {
36060
+ this[mapped] = headerValue;
36061
+ }
36062
+ };
36063
+ });
36064
+ utils_default.freezeMethods(AxiosHeaders);
36065
+ var AxiosHeaders_default = AxiosHeaders;
36066
+
35162
36067
  // node_modules/axios/lib/core/AxiosError.js
36068
+ var REDACTED = "[REDACTED ****]";
36069
+ function hasOwnOrPrototypeToJSON(source) {
36070
+ if (utils_default.hasOwnProp(source, "toJSON")) {
36071
+ return true;
36072
+ }
36073
+ let prototype2 = Object.getPrototypeOf(source);
36074
+ while (prototype2 && prototype2 !== Object.prototype) {
36075
+ if (utils_default.hasOwnProp(prototype2, "toJSON")) {
36076
+ return true;
36077
+ }
36078
+ prototype2 = Object.getPrototypeOf(prototype2);
36079
+ }
36080
+ return false;
36081
+ }
36082
+ function redactConfig(config2, redactKeys) {
36083
+ const lowerKeys = new Set(redactKeys.map((k3) => String(k3).toLowerCase()));
36084
+ const seen = [];
36085
+ const visit = (source) => {
36086
+ if (source === null || typeof source !== "object") return source;
36087
+ if (utils_default.isBuffer(source)) return source;
36088
+ if (seen.indexOf(source) !== -1) return void 0;
36089
+ if (source instanceof AxiosHeaders_default) {
36090
+ source = source.toJSON();
36091
+ }
36092
+ seen.push(source);
36093
+ let result;
36094
+ if (utils_default.isArray(source)) {
36095
+ result = [];
36096
+ source.forEach((v2, i2) => {
36097
+ const reducedValue = visit(v2);
36098
+ if (!utils_default.isUndefined(reducedValue)) {
36099
+ result[i2] = reducedValue;
36100
+ }
36101
+ });
36102
+ } else {
36103
+ if (!utils_default.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
36104
+ seen.pop();
36105
+ return source;
36106
+ }
36107
+ result = /* @__PURE__ */ Object.create(null);
36108
+ for (const [key2, value] of Object.entries(source)) {
36109
+ const reducedValue = lowerKeys.has(key2.toLowerCase()) ? REDACTED : visit(value);
36110
+ if (!utils_default.isUndefined(reducedValue)) {
36111
+ result[key2] = reducedValue;
36112
+ }
36113
+ }
36114
+ }
36115
+ seen.pop();
36116
+ return result;
36117
+ };
36118
+ return visit(config2);
36119
+ }
35163
36120
  var AxiosError = class _AxiosError extends Error {
35164
36121
  static from(error2, code, config2, request, response, customProps) {
35165
36122
  const axiosError = new _AxiosError(error2.message, code || error2.code, config2, request, response);
@@ -35185,6 +36142,9 @@ var AxiosError = class _AxiosError extends Error {
35185
36142
  constructor(message, code, config2, request, response) {
35186
36143
  super(message);
35187
36144
  Object.defineProperty(this, "message", {
36145
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
36146
+ // this data descriptor into an accessor descriptor on the way in.
36147
+ __proto__: null,
35188
36148
  value: message,
35189
36149
  enumerable: true,
35190
36150
  writable: true,
@@ -35201,6 +36161,9 @@ var AxiosError = class _AxiosError extends Error {
35201
36161
  }
35202
36162
  }
35203
36163
  toJSON() {
36164
+ const config2 = this.config;
36165
+ const redactKeys = config2 && utils_default.hasOwnProp(config2, "redact") ? config2.redact : void 0;
36166
+ const serializedConfig = utils_default.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config2, redactKeys) : utils_default.toJSONObject(config2);
35204
36167
  return {
35205
36168
  // Standard
35206
36169
  message: this.message,
@@ -35214,7 +36177,7 @@ var AxiosError = class _AxiosError extends Error {
35214
36177
  columnNumber: this.columnNumber,
35215
36178
  stack: this.stack,
35216
36179
  // Axios
35217
- config: utils_default.toJSONObject(this.config),
36180
+ config: serializedConfig,
35218
36181
  code: this.code,
35219
36182
  status: this.status
35220
36183
  };
@@ -35224,6 +36187,7 @@ AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
35224
36187
  AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
35225
36188
  AxiosError.ECONNABORTED = "ECONNABORTED";
35226
36189
  AxiosError.ETIMEDOUT = "ETIMEDOUT";
36190
+ AxiosError.ECONNREFUSED = "ECONNREFUSED";
35227
36191
  AxiosError.ERR_NETWORK = "ERR_NETWORK";
35228
36192
  AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
35229
36193
  AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
@@ -35232,6 +36196,7 @@ AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
35232
36196
  AxiosError.ERR_CANCELED = "ERR_CANCELED";
35233
36197
  AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
35234
36198
  AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
36199
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
35235
36200
  var AxiosError_default = AxiosError;
35236
36201
 
35237
36202
  // node_modules/axios/lib/platform/node/classes/FormData.js
@@ -35280,6 +36245,7 @@ function toFormData(obj, formData, options) {
35280
36245
  const dots = options.dots;
35281
36246
  const indexes = options.indexes;
35282
36247
  const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
36248
+ const maxDepth = options.maxDepth === void 0 ? 100 : options.maxDepth;
35283
36249
  const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
35284
36250
  if (!utils_default.isFunction(visitor)) {
35285
36251
  throw new TypeError("visitor must be a function");
@@ -35334,16 +36300,22 @@ function toFormData(obj, formData, options) {
35334
36300
  convertValue,
35335
36301
  isVisitable
35336
36302
  });
35337
- function build(value, path2) {
36303
+ function build(value, path2, depth = 0) {
35338
36304
  if (utils_default.isUndefined(value)) return;
36305
+ if (depth > maxDepth) {
36306
+ throw new AxiosError_default(
36307
+ "Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth,
36308
+ AxiosError_default.ERR_FORM_DATA_DEPTH_EXCEEDED
36309
+ );
36310
+ }
35339
36311
  if (stack.indexOf(value) !== -1) {
35340
- throw Error("Circular reference detected in " + path2.join("."));
36312
+ throw new Error("Circular reference detected in " + path2.join("."));
35341
36313
  }
35342
36314
  stack.push(value);
35343
36315
  utils_default.forEach(value, function each(el, key2) {
35344
36316
  const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key2) ? key2.trim() : key2, path2, exposedHelpers);
35345
36317
  if (result === true) {
35346
- build(el, path2 ? path2.concat(key2) : [key2]);
36318
+ build(el, path2 ? path2.concat(key2) : [key2], depth + 1);
35347
36319
  }
35348
36320
  });
35349
36321
  stack.pop();
@@ -35364,10 +36336,9 @@ function encode3(str) {
35364
36336
  "(": "%28",
35365
36337
  ")": "%29",
35366
36338
  "~": "%7E",
35367
- "%20": "+",
35368
- "%00": "\0"
36339
+ "%20": "+"
35369
36340
  };
35370
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
36341
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
35371
36342
  return charMap[match];
35372
36343
  });
35373
36344
  }
@@ -35488,7 +36459,8 @@ var transitional_default = {
35488
36459
  silentJSONParsing: true,
35489
36460
  forcedJSONParsing: true,
35490
36461
  clarifyTimeoutError: false,
35491
- legacyInterceptorReqResOrdering: true
36462
+ legacyInterceptorReqResOrdering: true,
36463
+ advertiseZstdAcceptEncoding: false
35492
36464
  };
35493
36465
 
35494
36466
  // node_modules/axios/lib/platform/node/index.js
@@ -35593,13 +36565,13 @@ function formDataToJSON(formData) {
35593
36565
  name = !name && utils_default.isArray(target) ? target.length : name;
35594
36566
  if (isLast) {
35595
36567
  if (utils_default.hasOwnProp(target, name)) {
35596
- target[name] = [target[name], value];
36568
+ target[name] = utils_default.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
35597
36569
  } else {
35598
36570
  target[name] = value;
35599
36571
  }
35600
36572
  return !isNumericKey;
35601
36573
  }
35602
- if (!target[name] || !utils_default.isObject(target[name])) {
36574
+ if (!utils_default.hasOwnProp(target, name) || !utils_default.isObject(target[name])) {
35603
36575
  target[name] = [];
35604
36576
  }
35605
36577
  const result = buildPath(path2, value, target[name], index);
@@ -35620,6 +36592,7 @@ function formDataToJSON(formData) {
35620
36592
  var formDataToJSON_default = formDataToJSON;
35621
36593
 
35622
36594
  // node_modules/axios/lib/defaults/index.js
36595
+ var own = (obj, key2) => obj != null && utils_default.hasOwnProp(obj, key2) ? obj[key2] : void 0;
35623
36596
  function stringifySafely(rawValue, parser, encoder) {
35624
36597
  if (utils_default.isString(rawValue)) {
35625
36598
  try {
@@ -35660,15 +36633,17 @@ var defaults = {
35660
36633
  }
35661
36634
  let isFileList2;
35662
36635
  if (isObjectPayload) {
36636
+ const formSerializer = own(this, "formSerializer");
35663
36637
  if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
35664
- return toURLEncodedForm(data, this.formSerializer).toString();
36638
+ return toURLEncodedForm(data, formSerializer).toString();
35665
36639
  }
35666
36640
  if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
35667
- const _FormData = this.env && this.env.FormData;
36641
+ const env = own(this, "env");
36642
+ const _FormData = env && env.FormData;
35668
36643
  return toFormData_default(
35669
36644
  isFileList2 ? { "files[]": data } : data,
35670
36645
  _FormData && new _FormData(),
35671
- this.formSerializer
36646
+ formSerializer
35672
36647
  );
35673
36648
  }
35674
36649
  }
@@ -35681,21 +36656,22 @@ var defaults = {
35681
36656
  ],
35682
36657
  transformResponse: [
35683
36658
  function transformResponse(data) {
35684
- const transitional2 = this.transitional || defaults.transitional;
36659
+ const transitional2 = own(this, "transitional") || defaults.transitional;
35685
36660
  const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
35686
- const JSONRequested = this.responseType === "json";
36661
+ const responseType = own(this, "responseType");
36662
+ const JSONRequested = responseType === "json";
35687
36663
  if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
35688
36664
  return data;
35689
36665
  }
35690
- if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
36666
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
35691
36667
  const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
35692
36668
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
35693
36669
  try {
35694
- return JSON.parse(data, this.parseReviver);
36670
+ return JSON.parse(data, own(this, "parseReviver"));
35695
36671
  } catch (e) {
35696
36672
  if (strictJSONParsing) {
35697
36673
  if (e.name === "SyntaxError") {
35698
- throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
36674
+ throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, own(this, "response"));
35699
36675
  }
35700
36676
  throw e;
35701
36677
  }
@@ -35727,292 +36703,11 @@ var defaults = {
35727
36703
  }
35728
36704
  }
35729
36705
  };
35730
- utils_default.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
36706
+ utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
35731
36707
  defaults.headers[method] = {};
35732
36708
  });
35733
36709
  var defaults_default = defaults;
35734
36710
 
35735
- // node_modules/axios/lib/helpers/parseHeaders.js
35736
- var ignoreDuplicateOf = utils_default.toObjectSet([
35737
- "age",
35738
- "authorization",
35739
- "content-length",
35740
- "content-type",
35741
- "etag",
35742
- "expires",
35743
- "from",
35744
- "host",
35745
- "if-modified-since",
35746
- "if-unmodified-since",
35747
- "last-modified",
35748
- "location",
35749
- "max-forwards",
35750
- "proxy-authorization",
35751
- "referer",
35752
- "retry-after",
35753
- "user-agent"
35754
- ]);
35755
- var parseHeaders_default = (rawHeaders) => {
35756
- const parsed = {};
35757
- let key2;
35758
- let val;
35759
- let i2;
35760
- rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
35761
- i2 = line.indexOf(":");
35762
- key2 = line.substring(0, i2).trim().toLowerCase();
35763
- val = line.substring(i2 + 1).trim();
35764
- if (!key2 || parsed[key2] && ignoreDuplicateOf[key2]) {
35765
- return;
35766
- }
35767
- if (key2 === "set-cookie") {
35768
- if (parsed[key2]) {
35769
- parsed[key2].push(val);
35770
- } else {
35771
- parsed[key2] = [val];
35772
- }
35773
- } else {
35774
- parsed[key2] = parsed[key2] ? parsed[key2] + ", " + val : val;
35775
- }
35776
- });
35777
- return parsed;
35778
- };
35779
-
35780
- // node_modules/axios/lib/core/AxiosHeaders.js
35781
- var $internals = /* @__PURE__ */ Symbol("internals");
35782
- function normalizeHeader(header) {
35783
- return header && String(header).trim().toLowerCase();
35784
- }
35785
- function normalizeValue(value) {
35786
- if (value === false || value == null) {
35787
- return value;
35788
- }
35789
- return utils_default.isArray(value) ? value.map(normalizeValue) : String(value).replace(/[\r\n]+$/, "");
35790
- }
35791
- function parseTokens(str) {
35792
- const tokens = /* @__PURE__ */ Object.create(null);
35793
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
35794
- let match;
35795
- while (match = tokensRE.exec(str)) {
35796
- tokens[match[1]] = match[2];
35797
- }
35798
- return tokens;
35799
- }
35800
- var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
35801
- function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
35802
- if (utils_default.isFunction(filter2)) {
35803
- return filter2.call(this, value, header);
35804
- }
35805
- if (isHeaderNameFilter) {
35806
- value = header;
35807
- }
35808
- if (!utils_default.isString(value)) return;
35809
- if (utils_default.isString(filter2)) {
35810
- return value.indexOf(filter2) !== -1;
35811
- }
35812
- if (utils_default.isRegExp(filter2)) {
35813
- return filter2.test(value);
35814
- }
35815
- }
35816
- function formatHeader(header) {
35817
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w3, char, str) => {
35818
- return char.toUpperCase() + str;
35819
- });
35820
- }
35821
- function buildAccessors(obj, header) {
35822
- const accessorName = utils_default.toCamelCase(" " + header);
35823
- ["get", "set", "has"].forEach((methodName) => {
35824
- Object.defineProperty(obj, methodName + accessorName, {
35825
- value: function(arg1, arg2, arg3) {
35826
- return this[methodName].call(this, header, arg1, arg2, arg3);
35827
- },
35828
- configurable: true
35829
- });
35830
- });
35831
- }
35832
- var AxiosHeaders = class {
35833
- constructor(headers) {
35834
- headers && this.set(headers);
35835
- }
35836
- set(header, valueOrRewrite, rewrite) {
35837
- const self2 = this;
35838
- function setHeader(_value, _header, _rewrite) {
35839
- const lHeader = normalizeHeader(_header);
35840
- if (!lHeader) {
35841
- throw new Error("header name must be a non-empty string");
35842
- }
35843
- const key2 = utils_default.findKey(self2, lHeader);
35844
- if (!key2 || self2[key2] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key2] !== false) {
35845
- self2[key2 || _header] = normalizeValue(_value);
35846
- }
35847
- }
35848
- const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
35849
- if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
35850
- setHeaders(header, valueOrRewrite);
35851
- } else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
35852
- setHeaders(parseHeaders_default(header), valueOrRewrite);
35853
- } else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
35854
- let obj = {}, dest, key2;
35855
- for (const entry of header) {
35856
- if (!utils_default.isArray(entry)) {
35857
- throw TypeError("Object iterator must return a key-value pair");
35858
- }
35859
- obj[key2 = entry[0]] = (dest = obj[key2]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
35860
- }
35861
- setHeaders(obj, valueOrRewrite);
35862
- } else {
35863
- header != null && setHeader(valueOrRewrite, header, rewrite);
35864
- }
35865
- return this;
35866
- }
35867
- get(header, parser) {
35868
- header = normalizeHeader(header);
35869
- if (header) {
35870
- const key2 = utils_default.findKey(this, header);
35871
- if (key2) {
35872
- const value = this[key2];
35873
- if (!parser) {
35874
- return value;
35875
- }
35876
- if (parser === true) {
35877
- return parseTokens(value);
35878
- }
35879
- if (utils_default.isFunction(parser)) {
35880
- return parser.call(this, value, key2);
35881
- }
35882
- if (utils_default.isRegExp(parser)) {
35883
- return parser.exec(value);
35884
- }
35885
- throw new TypeError("parser must be boolean|regexp|function");
35886
- }
35887
- }
35888
- }
35889
- has(header, matcher) {
35890
- header = normalizeHeader(header);
35891
- if (header) {
35892
- const key2 = utils_default.findKey(this, header);
35893
- return !!(key2 && this[key2] !== void 0 && (!matcher || matchHeaderValue(this, this[key2], key2, matcher)));
35894
- }
35895
- return false;
35896
- }
35897
- delete(header, matcher) {
35898
- const self2 = this;
35899
- let deleted = false;
35900
- function deleteHeader(_header) {
35901
- _header = normalizeHeader(_header);
35902
- if (_header) {
35903
- const key2 = utils_default.findKey(self2, _header);
35904
- if (key2 && (!matcher || matchHeaderValue(self2, self2[key2], key2, matcher))) {
35905
- delete self2[key2];
35906
- deleted = true;
35907
- }
35908
- }
35909
- }
35910
- if (utils_default.isArray(header)) {
35911
- header.forEach(deleteHeader);
35912
- } else {
35913
- deleteHeader(header);
35914
- }
35915
- return deleted;
35916
- }
35917
- clear(matcher) {
35918
- const keys = Object.keys(this);
35919
- let i2 = keys.length;
35920
- let deleted = false;
35921
- while (i2--) {
35922
- const key2 = keys[i2];
35923
- if (!matcher || matchHeaderValue(this, this[key2], key2, matcher, true)) {
35924
- delete this[key2];
35925
- deleted = true;
35926
- }
35927
- }
35928
- return deleted;
35929
- }
35930
- normalize(format) {
35931
- const self2 = this;
35932
- const headers = {};
35933
- utils_default.forEach(this, (value, header) => {
35934
- const key2 = utils_default.findKey(headers, header);
35935
- if (key2) {
35936
- self2[key2] = normalizeValue(value);
35937
- delete self2[header];
35938
- return;
35939
- }
35940
- const normalized = format ? formatHeader(header) : String(header).trim();
35941
- if (normalized !== header) {
35942
- delete self2[header];
35943
- }
35944
- self2[normalized] = normalizeValue(value);
35945
- headers[normalized] = true;
35946
- });
35947
- return this;
35948
- }
35949
- concat(...targets) {
35950
- return this.constructor.concat(this, ...targets);
35951
- }
35952
- toJSON(asStrings) {
35953
- const obj = /* @__PURE__ */ Object.create(null);
35954
- utils_default.forEach(this, (value, header) => {
35955
- value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
35956
- });
35957
- return obj;
35958
- }
35959
- [Symbol.iterator]() {
35960
- return Object.entries(this.toJSON())[Symbol.iterator]();
35961
- }
35962
- toString() {
35963
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
35964
- }
35965
- getSetCookie() {
35966
- return this.get("set-cookie") || [];
35967
- }
35968
- get [Symbol.toStringTag]() {
35969
- return "AxiosHeaders";
35970
- }
35971
- static from(thing) {
35972
- return thing instanceof this ? thing : new this(thing);
35973
- }
35974
- static concat(first, ...targets) {
35975
- const computed = new this(first);
35976
- targets.forEach((target) => computed.set(target));
35977
- return computed;
35978
- }
35979
- static accessor(header) {
35980
- const internals = this[$internals] = this[$internals] = {
35981
- accessors: {}
35982
- };
35983
- const accessors = internals.accessors;
35984
- const prototype2 = this.prototype;
35985
- function defineAccessor(_header) {
35986
- const lHeader = normalizeHeader(_header);
35987
- if (!accessors[lHeader]) {
35988
- buildAccessors(prototype2, _header);
35989
- accessors[lHeader] = true;
35990
- }
35991
- }
35992
- utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
35993
- return this;
35994
- }
35995
- };
35996
- AxiosHeaders.accessor([
35997
- "Content-Type",
35998
- "Content-Length",
35999
- "Accept",
36000
- "Accept-Encoding",
36001
- "User-Agent",
36002
- "Authorization"
36003
- ]);
36004
- utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key2) => {
36005
- let mapped = key2[0].toUpperCase() + key2.slice(1);
36006
- return {
36007
- get: () => value,
36008
- set(headerValue) {
36009
- this[mapped] = headerValue;
36010
- }
36011
- };
36012
- });
36013
- utils_default.freezeMethods(AxiosHeaders);
36014
- var AxiosHeaders_default = AxiosHeaders;
36015
-
36016
36711
  // node_modules/axios/lib/core/transformData.js
36017
36712
  function transformData(fns, response) {
36018
36713
  const config2 = this || defaults_default;
@@ -36056,15 +36751,13 @@ function settle(resolve, reject, response) {
36056
36751
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
36057
36752
  resolve(response);
36058
36753
  } else {
36059
- reject(
36060
- new AxiosError_default(
36061
- "Request failed with status code " + response.status,
36062
- [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
36063
- response.config,
36064
- response.request,
36065
- response
36066
- )
36067
- );
36754
+ reject(new AxiosError_default(
36755
+ "Request failed with status code " + response.status,
36756
+ response.status >= 400 && response.status < 500 ? AxiosError_default.ERR_BAD_REQUEST : AxiosError_default.ERR_BAD_RESPONSE,
36757
+ response.config,
36758
+ response.request,
36759
+ response
36760
+ ));
36068
36761
  }
36069
36762
  }
36070
36763
 
@@ -36084,7 +36777,7 @@ function combineURLs(baseURL, relativeURL) {
36084
36777
  // node_modules/axios/lib/core/buildFullPath.js
36085
36778
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
36086
36779
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
36087
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
36780
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
36088
36781
  return combineURLs(baseURL, requestedURL);
36089
36782
  }
36090
36783
  return requestedURL;
@@ -36158,24 +36851,26 @@ function getEnv(key2) {
36158
36851
  }
36159
36852
 
36160
36853
  // node_modules/axios/lib/adapters/http.js
36854
+ var import_https_proxy_agent = __toESM(require_dist2(), 1);
36161
36855
  var import_http = __toESM(require("http"), 1);
36162
36856
  var import_https = __toESM(require("https"), 1);
36163
- var import_http2 = __toESM(require("http2"), 1);
36164
- var import_util7 = __toESM(require("util"), 1);
36857
+ var import_http22 = __toESM(require("http2"), 1);
36858
+ var import_util8 = __toESM(require("util"), 1);
36859
+ var import_path = require("path");
36165
36860
  var import_follow_redirects = __toESM(require_follow_redirects(), 1);
36166
36861
  var import_zlib = __toESM(require("zlib"), 1);
36167
36862
 
36168
36863
  // node_modules/axios/lib/env/data.js
36169
- var VERSION = "1.14.0";
36864
+ var VERSION = "1.17.0";
36170
36865
 
36171
36866
  // node_modules/axios/lib/helpers/parseProtocol.js
36172
36867
  function parseProtocol(url3) {
36173
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url3);
36868
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url3);
36174
36869
  return match && match[1] || "";
36175
36870
  }
36176
36871
 
36177
36872
  // node_modules/axios/lib/helpers/fromDataURI.js
36178
- var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
36873
+ var DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
36179
36874
  function fromDataURI(uri, asBlob, options) {
36180
36875
  const _Blob = options && options.Blob || platform_default.classes.Blob;
36181
36876
  const protocol = parseProtocol(uri);
@@ -36188,10 +36883,17 @@ function fromDataURI(uri, asBlob, options) {
36188
36883
  if (!match) {
36189
36884
  throw new AxiosError_default("Invalid URL", AxiosError_default.ERR_INVALID_URL);
36190
36885
  }
36191
- const mime = match[1];
36192
- const isBase64 = match[2];
36193
- const body3 = match[3];
36194
- const buffer = Buffer.from(decodeURIComponent(body3), isBase64 ? "base64" : "utf8");
36886
+ const type = match[1];
36887
+ const params = match[2];
36888
+ const encoding = match[3] ? "base64" : "utf8";
36889
+ const body3 = match[4];
36890
+ let mime;
36891
+ if (type) {
36892
+ mime = params ? type + params : type;
36893
+ } else if (params) {
36894
+ mime = "text/plain" + params;
36895
+ }
36896
+ const buffer = Buffer.from(decodeURIComponent(body3), encoding);
36195
36897
  if (asBlob) {
36196
36898
  if (!_Blob) {
36197
36899
  throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
@@ -36365,7 +37067,8 @@ var FormDataPart = class {
36365
37067
  if (isStringValue) {
36366
37068
  value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
36367
37069
  } else {
36368
- headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
37070
+ const safeType = String(value.type || "application/octet-stream").replace(/[\r\n]/g, "");
37071
+ headers += `Content-Type: ${safeType}${CRLF}`;
36369
37072
  }
36370
37073
  this.headers = textEncoder.encode(headers + CRLF);
36371
37074
  this.contentLength = isStringValue ? value.byteLength : value.size;
@@ -36401,10 +37104,10 @@ var formDataToStream = (form, headersHandler, options) => {
36401
37104
  boundary = tag + "-" + platform_default.generateString(size, BOUNDARY_ALPHABET)
36402
37105
  } = options || {};
36403
37106
  if (!utils_default.isFormData(form)) {
36404
- throw TypeError("FormData instance required");
37107
+ throw new TypeError("FormData instance required");
36405
37108
  }
36406
37109
  if (boundary.length < 1 || boundary.length > 70) {
36407
- throw Error("boundary must be 10-70 characters long");
37110
+ throw new Error("boundary must be 1-70 characters long");
36408
37111
  }
36409
37112
  const boundaryBytes = textEncoder.encode("--" + boundary + CRLF);
36410
37113
  const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF);
@@ -36457,6 +37160,87 @@ var ZlibHeaderTransformStream = class extends import_stream3.default.Transform {
36457
37160
  };
36458
37161
  var ZlibHeaderTransformStream_default = ZlibHeaderTransformStream;
36459
37162
 
37163
+ // node_modules/axios/lib/helpers/Http2Sessions.js
37164
+ var import_http2 = __toESM(require("http2"), 1);
37165
+ var import_util7 = __toESM(require("util"), 1);
37166
+ var Http2Sessions = class {
37167
+ constructor() {
37168
+ this.sessions = /* @__PURE__ */ Object.create(null);
37169
+ }
37170
+ getSession(authority, options) {
37171
+ options = Object.assign(
37172
+ {
37173
+ sessionTimeout: 1e3
37174
+ },
37175
+ options
37176
+ );
37177
+ let authoritySessions = this.sessions[authority];
37178
+ if (authoritySessions) {
37179
+ let len = authoritySessions.length;
37180
+ for (let i2 = 0; i2 < len; i2++) {
37181
+ const [sessionHandle, sessionOptions] = authoritySessions[i2];
37182
+ if (!sessionHandle.destroyed && !sessionHandle.closed && import_util7.default.isDeepStrictEqual(sessionOptions, options)) {
37183
+ return sessionHandle;
37184
+ }
37185
+ }
37186
+ }
37187
+ const session = import_http2.default.connect(authority, options);
37188
+ let removed;
37189
+ let timer;
37190
+ const removeSession = () => {
37191
+ if (removed) {
37192
+ return;
37193
+ }
37194
+ removed = true;
37195
+ if (timer) {
37196
+ clearTimeout(timer);
37197
+ timer = null;
37198
+ }
37199
+ let entries = authoritySessions, len = entries.length, i2 = len;
37200
+ while (i2--) {
37201
+ if (entries[i2][0] === session) {
37202
+ if (len === 1) {
37203
+ delete this.sessions[authority];
37204
+ } else {
37205
+ entries.splice(i2, 1);
37206
+ }
37207
+ if (!session.closed) {
37208
+ session.close();
37209
+ }
37210
+ return;
37211
+ }
37212
+ }
37213
+ };
37214
+ const originalRequestFn = session.request;
37215
+ const { sessionTimeout } = options;
37216
+ if (sessionTimeout != null) {
37217
+ let streamsCount = 0;
37218
+ session.request = function() {
37219
+ const stream4 = originalRequestFn.apply(this, arguments);
37220
+ streamsCount++;
37221
+ if (timer) {
37222
+ clearTimeout(timer);
37223
+ timer = null;
37224
+ }
37225
+ stream4.once("close", () => {
37226
+ if (!--streamsCount) {
37227
+ timer = setTimeout(() => {
37228
+ timer = null;
37229
+ removeSession();
37230
+ }, sessionTimeout);
37231
+ }
37232
+ });
37233
+ return stream4;
37234
+ };
37235
+ }
37236
+ session.once("close", removeSession);
37237
+ let entry = [session, options];
37238
+ authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
37239
+ return session;
37240
+ }
37241
+ };
37242
+ var Http2Sessions_default = Http2Sessions;
37243
+
36460
37244
  // node_modules/axios/lib/helpers/callbackify.js
36461
37245
  var callbackify = (fn, reducer) => {
36462
37246
  return utils_default.isAsyncFn(fn) ? function(...args) {
@@ -36472,6 +37256,128 @@ var callbackify = (fn, reducer) => {
36472
37256
  };
36473
37257
  var callbackify_default = callbackify;
36474
37258
 
37259
+ // node_modules/axios/lib/helpers/shouldBypassProxy.js
37260
+ var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost"]);
37261
+ var isIPv4Loopback = (host) => {
37262
+ const parts = host.split(".");
37263
+ if (parts.length !== 4) return false;
37264
+ if (parts[0] !== "127") return false;
37265
+ return parts.every((p2) => /^\d+$/.test(p2) && Number(p2) >= 0 && Number(p2) <= 255);
37266
+ };
37267
+ var isIPv6Loopback = (host) => {
37268
+ if (host === "::1") return true;
37269
+ const v4MappedDotted = host.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);
37270
+ if (v4MappedDotted) return isIPv4Loopback(v4MappedDotted[1]);
37271
+ const v4MappedHex = host.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);
37272
+ if (v4MappedHex) {
37273
+ const high = parseInt(v4MappedHex[1], 16);
37274
+ return high >= 32512 && high <= 32767;
37275
+ }
37276
+ const groups = host.split(":");
37277
+ if (groups.length === 8) {
37278
+ for (let i2 = 0; i2 < 7; i2++) {
37279
+ if (!/^0+$/.test(groups[i2])) return false;
37280
+ }
37281
+ return /^0*1$/.test(groups[7]);
37282
+ }
37283
+ return false;
37284
+ };
37285
+ var isLoopback = (host) => {
37286
+ if (!host) return false;
37287
+ if (LOOPBACK_HOSTNAMES.has(host)) return true;
37288
+ if (isIPv4Loopback(host)) return true;
37289
+ return isIPv6Loopback(host);
37290
+ };
37291
+ var DEFAULT_PORTS2 = {
37292
+ http: 80,
37293
+ https: 443,
37294
+ ws: 80,
37295
+ wss: 443,
37296
+ ftp: 21
37297
+ };
37298
+ var parseNoProxyEntry = (entry) => {
37299
+ let entryHost = entry;
37300
+ let entryPort = 0;
37301
+ if (entryHost.charAt(0) === "[") {
37302
+ const bracketIndex = entryHost.indexOf("]");
37303
+ if (bracketIndex !== -1) {
37304
+ const host = entryHost.slice(1, bracketIndex);
37305
+ const rest = entryHost.slice(bracketIndex + 1);
37306
+ if (rest.charAt(0) === ":" && /^\d+$/.test(rest.slice(1))) {
37307
+ entryPort = Number.parseInt(rest.slice(1), 10);
37308
+ }
37309
+ return [host, entryPort];
37310
+ }
37311
+ }
37312
+ const firstColon = entryHost.indexOf(":");
37313
+ const lastColon = entryHost.lastIndexOf(":");
37314
+ if (firstColon !== -1 && firstColon === lastColon && /^\d+$/.test(entryHost.slice(lastColon + 1))) {
37315
+ entryPort = Number.parseInt(entryHost.slice(lastColon + 1), 10);
37316
+ entryHost = entryHost.slice(0, lastColon);
37317
+ }
37318
+ return [entryHost, entryPort];
37319
+ };
37320
+ var IPV4_MAPPED_DOTTED_RE = /^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:(\d+\.\d+\.\d+\.\d+)$/i;
37321
+ var IPV4_MAPPED_HEX_RE = /^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i;
37322
+ var unmapIPv4MappedIPv6 = (host) => {
37323
+ if (typeof host !== "string" || host.indexOf(":") === -1) return host;
37324
+ const dotted = host.match(IPV4_MAPPED_DOTTED_RE);
37325
+ if (dotted) return dotted[1];
37326
+ const hex3 = host.match(IPV4_MAPPED_HEX_RE);
37327
+ if (hex3) {
37328
+ const high = parseInt(hex3[1], 16);
37329
+ const low = parseInt(hex3[2], 16);
37330
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
37331
+ }
37332
+ return host;
37333
+ };
37334
+ var normalizeNoProxyHost = (hostname3) => {
37335
+ if (!hostname3) {
37336
+ return hostname3;
37337
+ }
37338
+ if (hostname3.charAt(0) === "[" && hostname3.charAt(hostname3.length - 1) === "]") {
37339
+ hostname3 = hostname3.slice(1, -1);
37340
+ }
37341
+ return unmapIPv4MappedIPv6(hostname3.replace(/\.+$/, ""));
37342
+ };
37343
+ function shouldBypassProxy(location) {
37344
+ let parsed;
37345
+ try {
37346
+ parsed = new URL(location);
37347
+ } catch (_err) {
37348
+ return false;
37349
+ }
37350
+ const noProxy = (process.env.no_proxy || process.env.NO_PROXY || "").toLowerCase();
37351
+ if (!noProxy) {
37352
+ return false;
37353
+ }
37354
+ if (noProxy === "*") {
37355
+ return true;
37356
+ }
37357
+ const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
37358
+ const hostname3 = normalizeNoProxyHost(parsed.hostname.toLowerCase());
37359
+ return noProxy.split(/[\s,]+/).some((entry) => {
37360
+ if (!entry) {
37361
+ return false;
37362
+ }
37363
+ let [entryHost, entryPort] = parseNoProxyEntry(entry);
37364
+ entryHost = normalizeNoProxyHost(entryHost);
37365
+ if (!entryHost) {
37366
+ return false;
37367
+ }
37368
+ if (entryPort && entryPort !== port) {
37369
+ return false;
37370
+ }
37371
+ if (entryHost.charAt(0) === "*") {
37372
+ entryHost = entryHost.slice(1);
37373
+ }
37374
+ if (entryHost.charAt(0) === ".") {
37375
+ return hostname3.endsWith(entryHost);
37376
+ }
37377
+ return hostname3 === entryHost || isLoopback(hostname3) && isLoopback(entryHost);
37378
+ });
37379
+ }
37380
+
36475
37381
  // node_modules/axios/lib/helpers/speedometer.js
36476
37382
  function speedometer(samplesCount, min) {
36477
37383
  samplesCount = samplesCount || 10;
@@ -36548,19 +37454,22 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
36548
37454
  let bytesNotified = 0;
36549
37455
  const _speedometer = speedometer_default(50, 250);
36550
37456
  return throttle_default((e) => {
36551
- const loaded = e.loaded;
37457
+ if (!e || typeof e.loaded !== "number") {
37458
+ return;
37459
+ }
37460
+ const rawLoaded = e.loaded;
36552
37461
  const total = e.lengthComputable ? e.total : void 0;
36553
- const progressBytes = loaded - bytesNotified;
37462
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
37463
+ const progressBytes = Math.max(0, loaded - bytesNotified);
36554
37464
  const rate = _speedometer(progressBytes);
36555
- const inRange = loaded <= total;
36556
- bytesNotified = loaded;
37465
+ bytesNotified = Math.max(bytesNotified, loaded);
36557
37466
  const data = {
36558
37467
  loaded,
36559
37468
  total,
36560
37469
  progress: total ? loaded / total : void 0,
36561
37470
  bytes: progressBytes,
36562
37471
  rate: rate ? rate : void 0,
36563
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
37472
+ estimated: rate && total ? (total - loaded) / rate : void 0,
36564
37473
  event: e,
36565
37474
  lengthComputable: total != null,
36566
37475
  [isDownloadStream ? "download" : "upload"]: true
@@ -36626,10 +37535,32 @@ function estimateDataURLDecodedBytes(url3) {
36626
37535
  }
36627
37536
  }
36628
37537
  const groups = Math.floor(effectiveLen / 4);
36629
- const bytes = groups * 3 - (pad || 0);
36630
- return bytes > 0 ? bytes : 0;
37538
+ const bytes2 = groups * 3 - (pad || 0);
37539
+ return bytes2 > 0 ? bytes2 : 0;
36631
37540
  }
36632
- return Buffer.byteLength(body3, "utf8");
37541
+ if (typeof Buffer !== "undefined" && typeof Buffer.byteLength === "function") {
37542
+ return Buffer.byteLength(body3, "utf8");
37543
+ }
37544
+ let bytes = 0;
37545
+ for (let i2 = 0, len = body3.length; i2 < len; i2++) {
37546
+ const c = body3.charCodeAt(i2);
37547
+ if (c < 128) {
37548
+ bytes += 1;
37549
+ } else if (c < 2048) {
37550
+ bytes += 2;
37551
+ } else if (c >= 55296 && c <= 56319 && i2 + 1 < len) {
37552
+ const next = body3.charCodeAt(i2 + 1);
37553
+ if (next >= 56320 && next <= 57343) {
37554
+ bytes += 4;
37555
+ i2++;
37556
+ } else {
37557
+ bytes += 3;
37558
+ }
37559
+ } else {
37560
+ bytes += 3;
37561
+ }
37562
+ }
37563
+ return bytes;
36633
37564
  }
36634
37565
 
36635
37566
  // node_modules/axios/lib/adapters/http.js
@@ -36641,131 +37572,174 @@ var brotliOptions = {
36641
37572
  flush: import_zlib.default.constants.BROTLI_OPERATION_FLUSH,
36642
37573
  finishFlush: import_zlib.default.constants.BROTLI_OPERATION_FLUSH
36643
37574
  };
37575
+ var zstdOptions = {
37576
+ flush: import_zlib.default.constants.ZSTD_e_flush,
37577
+ finishFlush: import_zlib.default.constants.ZSTD_e_flush
37578
+ };
36644
37579
  var isBrotliSupported = utils_default.isFunction(import_zlib.default.createBrotliDecompress);
37580
+ var isZstdSupported = utils_default.isFunction(import_zlib.default.createZstdDecompress);
37581
+ var ACCEPT_ENCODING = "gzip, compress, deflate" + (isBrotliSupported ? ", br" : "");
37582
+ var ACCEPT_ENCODING_WITH_ZSTD = ACCEPT_ENCODING + (isZstdSupported ? ", zstd" : "");
36645
37583
  var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
36646
37584
  var isHttps = /https:?/;
37585
+ var FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
37586
+ function setFormDataHeaders(headers, formHeaders, policy) {
37587
+ if (policy !== "content-only") {
37588
+ headers.set(formHeaders);
37589
+ return;
37590
+ }
37591
+ Object.entries(formHeaders).forEach(([key2, val]) => {
37592
+ if (FORM_DATA_CONTENT_HEADERS.includes(key2.toLowerCase())) {
37593
+ headers.set(key2, val);
37594
+ }
37595
+ });
37596
+ }
37597
+ var kAxiosSocketListener = /* @__PURE__ */ Symbol("axios.http.socketListener");
37598
+ var kAxiosCurrentReq = /* @__PURE__ */ Symbol("axios.http.currentReq");
37599
+ var kAxiosInstalledTunnel = /* @__PURE__ */ Symbol("axios.http.installedTunnel");
37600
+ var tunnelingAgentCache = /* @__PURE__ */ new Map();
37601
+ var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
37602
+ function getTunnelingAgent(agentOptions, userHttpsAgent) {
37603
+ const key2 = agentOptions.protocol + "//" + agentOptions.hostname + ":" + (agentOptions.port || "") + "#" + (agentOptions.auth || "");
37604
+ const cache = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, /* @__PURE__ */ new Map()).get(userHttpsAgent) : tunnelingAgentCache;
37605
+ let agent = cache.get(key2);
37606
+ if (agent) return agent;
37607
+ const merged = userHttpsAgent && userHttpsAgent.options ? { ...userHttpsAgent.options, ...agentOptions } : agentOptions;
37608
+ agent = new import_https_proxy_agent.default(merged);
37609
+ if (userHttpsAgent && userHttpsAgent.options) {
37610
+ const originTLSOptions = { ...userHttpsAgent.options };
37611
+ const callback = agent.callback;
37612
+ agent.callback = function axiosTunnelingAgentCallback(req, opts) {
37613
+ return callback.call(this, req, { ...originTLSOptions, ...opts });
37614
+ };
37615
+ }
37616
+ agent[kAxiosInstalledTunnel] = true;
37617
+ cache.set(key2, agent);
37618
+ return agent;
37619
+ }
36647
37620
  var supportedProtocols = platform_default.protocols.map((protocol) => {
36648
37621
  return protocol + ":";
36649
37622
  });
37623
+ var decodeURIComponentSafe = (value) => {
37624
+ if (!utils_default.isString(value)) {
37625
+ return value;
37626
+ }
37627
+ try {
37628
+ return decodeURIComponent(value);
37629
+ } catch (error2) {
37630
+ return value;
37631
+ }
37632
+ };
36650
37633
  var flushOnFinish = (stream4, [throttled, flush]) => {
36651
37634
  stream4.on("end", flush).on("error", flush);
36652
37635
  return throttled;
36653
37636
  };
36654
- var Http2Sessions = class {
36655
- constructor() {
36656
- this.sessions = /* @__PURE__ */ Object.create(null);
36657
- }
36658
- getSession(authority, options) {
36659
- options = Object.assign(
36660
- {
36661
- sessionTimeout: 1e3
36662
- },
36663
- options
36664
- );
36665
- let authoritySessions = this.sessions[authority];
36666
- if (authoritySessions) {
36667
- let len = authoritySessions.length;
36668
- for (let i2 = 0; i2 < len; i2++) {
36669
- const [sessionHandle, sessionOptions] = authoritySessions[i2];
36670
- if (!sessionHandle.destroyed && !sessionHandle.closed && import_util7.default.isDeepStrictEqual(sessionOptions, options)) {
36671
- return sessionHandle;
36672
- }
36673
- }
36674
- }
36675
- const session = import_http2.default.connect(authority, options);
36676
- let removed;
36677
- const removeSession = () => {
36678
- if (removed) {
36679
- return;
36680
- }
36681
- removed = true;
36682
- let entries = authoritySessions, len = entries.length, i2 = len;
36683
- while (i2--) {
36684
- if (entries[i2][0] === session) {
36685
- if (len === 1) {
36686
- delete this.sessions[authority];
36687
- } else {
36688
- entries.splice(i2, 1);
36689
- }
36690
- if (!session.closed) {
36691
- session.close();
36692
- }
36693
- return;
36694
- }
36695
- }
36696
- };
36697
- const originalRequestFn = session.request;
36698
- const { sessionTimeout } = options;
36699
- if (sessionTimeout != null) {
36700
- let timer;
36701
- let streamsCount = 0;
36702
- session.request = function() {
36703
- const stream4 = originalRequestFn.apply(this, arguments);
36704
- streamsCount++;
36705
- if (timer) {
36706
- clearTimeout(timer);
36707
- timer = null;
36708
- }
36709
- stream4.once("close", () => {
36710
- if (!--streamsCount) {
36711
- timer = setTimeout(() => {
36712
- timer = null;
36713
- removeSession();
36714
- }, sessionTimeout);
36715
- }
36716
- });
36717
- return stream4;
36718
- };
36719
- }
36720
- session.once("close", removeSession);
36721
- let entry = [session, options];
36722
- authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
36723
- return session;
36724
- }
36725
- };
36726
- var http2Sessions = new Http2Sessions();
36727
- function dispatchBeforeRedirect(options, responseDetails) {
37637
+ var http2Sessions = new Http2Sessions_default();
37638
+ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
36728
37639
  if (options.beforeRedirects.proxy) {
36729
37640
  options.beforeRedirects.proxy(options);
36730
37641
  }
37642
+ if (options.beforeRedirects.auth) {
37643
+ options.beforeRedirects.auth(options);
37644
+ }
36731
37645
  if (options.beforeRedirects.config) {
36732
- options.beforeRedirects.config(options, responseDetails);
37646
+ options.beforeRedirects.config(options, responseDetails, requestDetails);
36733
37647
  }
36734
37648
  }
36735
- function setProxy(options, configProxy, location) {
37649
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent) {
36736
37650
  let proxy = configProxy;
36737
37651
  if (!proxy && proxy !== false) {
36738
37652
  const proxyUrl = getProxyForUrl(location);
36739
37653
  if (proxyUrl) {
36740
- proxy = new URL(proxyUrl);
37654
+ if (!shouldBypassProxy(location)) {
37655
+ proxy = new URL(proxyUrl);
37656
+ }
36741
37657
  }
36742
37658
  }
36743
- if (proxy) {
36744
- if (proxy.username) {
36745
- proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
37659
+ if (isRedirect && options.headers) {
37660
+ for (const name of Object.keys(options.headers)) {
37661
+ if (name.toLowerCase() === "proxy-authorization") {
37662
+ delete options.headers[name];
37663
+ }
36746
37664
  }
36747
- if (proxy.auth) {
36748
- const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
37665
+ }
37666
+ if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
37667
+ options.agent = void 0;
37668
+ }
37669
+ if (proxy) {
37670
+ const isProxyURL = proxy instanceof URL;
37671
+ const readProxyField = (key2) => isProxyURL || utils_default.hasOwnProp(proxy, key2) ? proxy[key2] : void 0;
37672
+ const proxyUsername = readProxyField("username");
37673
+ const proxyPassword = readProxyField("password");
37674
+ let proxyAuth = utils_default.hasOwnProp(proxy, "auth") ? proxy.auth : void 0;
37675
+ if (proxyUsername) {
37676
+ proxyAuth = (proxyUsername || "") + ":" + (proxyPassword || "");
37677
+ }
37678
+ if (proxyAuth) {
37679
+ const authIsObject = typeof proxyAuth === "object";
37680
+ const authUsername = authIsObject && utils_default.hasOwnProp(proxyAuth, "username") ? proxyAuth.username : void 0;
37681
+ const authPassword = authIsObject && utils_default.hasOwnProp(proxyAuth, "password") ? proxyAuth.password : void 0;
37682
+ const validProxyAuth = Boolean(authUsername || authPassword);
36749
37683
  if (validProxyAuth) {
36750
- proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
36751
- } else if (typeof proxy.auth === "object") {
37684
+ proxyAuth = (authUsername || "") + ":" + (authPassword || "");
37685
+ } else if (authIsObject) {
36752
37686
  throw new AxiosError_default("Invalid proxy authorization", AxiosError_default.ERR_BAD_OPTION, { proxy });
36753
37687
  }
36754
- const base643 = Buffer.from(proxy.auth, "utf8").toString("base64");
36755
- options.headers["Proxy-Authorization"] = "Basic " + base643;
36756
37688
  }
36757
- options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
36758
- const proxyHost = proxy.hostname || proxy.host;
36759
- options.hostname = proxyHost;
36760
- options.host = proxyHost;
36761
- options.port = proxy.port;
36762
- options.path = location;
36763
- if (proxy.protocol) {
36764
- options.protocol = proxy.protocol.includes(":") ? proxy.protocol : `${proxy.protocol}:`;
37689
+ const targetIsHttps = isHttps.test(options.protocol);
37690
+ if (targetIsHttps) {
37691
+ if (!(configHttpsAgent instanceof import_https_proxy_agent.default)) {
37692
+ const proxyHost = readProxyField("hostname") || readProxyField("host");
37693
+ const proxyPort = readProxyField("port");
37694
+ const rawProxyProtocol = readProxyField("protocol");
37695
+ const normalizedProtocol = rawProxyProtocol ? rawProxyProtocol.includes(":") ? rawProxyProtocol : `${rawProxyProtocol}:` : "http:";
37696
+ const proxyHostForURL = proxyHost && proxyHost.includes(":") && !proxyHost.startsWith("[") ? `[${proxyHost}]` : proxyHost;
37697
+ const proxyURL = new URL(
37698
+ `${normalizedProtocol}//${proxyHostForURL}${proxyPort ? ":" + proxyPort : ""}`
37699
+ );
37700
+ const agentOptions = {
37701
+ protocol: proxyURL.protocol,
37702
+ hostname: proxyURL.hostname.replace(/^\[|\]$/g, ""),
37703
+ port: proxyURL.port,
37704
+ auth: proxyAuth && typeof proxyAuth === "string" ? proxyAuth : void 0
37705
+ };
37706
+ if (proxyURL.protocol === "https:") {
37707
+ agentOptions.ALPNProtocols = ["http/1.1"];
37708
+ }
37709
+ const tunnelingAgent = getTunnelingAgent(agentOptions, configHttpsAgent);
37710
+ options.agent = tunnelingAgent;
37711
+ if (options.agents) {
37712
+ options.agents.https = tunnelingAgent;
37713
+ }
37714
+ }
37715
+ } else {
37716
+ if (proxyAuth) {
37717
+ const base643 = Buffer.from(proxyAuth, "utf8").toString("base64");
37718
+ options.headers["Proxy-Authorization"] = "Basic " + base643;
37719
+ }
37720
+ let hasUserHostHeader = false;
37721
+ for (const name of Object.keys(options.headers)) {
37722
+ if (name.toLowerCase() === "host") {
37723
+ hasUserHostHeader = true;
37724
+ break;
37725
+ }
37726
+ }
37727
+ if (!hasUserHostHeader) {
37728
+ options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
37729
+ }
37730
+ const proxyHost = readProxyField("hostname") || readProxyField("host");
37731
+ options.hostname = proxyHost;
37732
+ options.host = proxyHost;
37733
+ options.port = readProxyField("port");
37734
+ options.path = location;
37735
+ const proxyProtocol = readProxyField("protocol");
37736
+ if (proxyProtocol) {
37737
+ options.protocol = proxyProtocol.includes(":") ? proxyProtocol : `${proxyProtocol}:`;
37738
+ }
36765
37739
  }
36766
37740
  }
36767
37741
  options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
36768
- setProxy(redirectOptions, configProxy, redirectOptions.href);
37742
+ setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent);
36769
37743
  };
36770
37744
  }
36771
37745
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
@@ -36804,7 +37778,7 @@ var http2Transport = {
36804
37778
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
36805
37779
  const { http2Options, headers } = options;
36806
37780
  const session = http2Sessions.getSession(authority, http2Options);
36807
- const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = import_http2.default.constants;
37781
+ const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = import_http22.default.constants;
36808
37782
  const http2Headers = {
36809
37783
  [HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
36810
37784
  [HTTP2_HEADER_METHOD]: options.method,
@@ -36828,12 +37802,21 @@ var http2Transport = {
36828
37802
  };
36829
37803
  var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
36830
37804
  return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
36831
- let { data, lookup, family, httpVersion = 1, http2Options } = config2;
36832
- const { responseType, responseEncoding } = config2;
37805
+ const own5 = (key2) => utils_default.hasOwnProp(config2, key2) ? config2[key2] : void 0;
37806
+ const transitional2 = own5("transitional") || transitional_default;
37807
+ let data = own5("data");
37808
+ let lookup = own5("lookup");
37809
+ let family = own5("family");
37810
+ let httpVersion = own5("httpVersion");
37811
+ if (httpVersion === void 0) httpVersion = 1;
37812
+ let http2Options = own5("http2Options");
37813
+ const responseType = own5("responseType");
37814
+ const responseEncoding = own5("responseEncoding");
36833
37815
  const method = config2.method.toUpperCase();
36834
37816
  let isDone;
36835
37817
  let rejected = false;
36836
37818
  let req;
37819
+ let connectPhaseTimer;
36837
37820
  httpVersion = +httpVersion;
36838
37821
  if (Number.isNaN(httpVersion)) {
36839
37822
  throw TypeError(`Invalid protocol version: '${config2.httpVersion}' is not a number`);
@@ -36862,11 +37845,29 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
36862
37845
  !reason || reason.type ? new CanceledError_default(null, config2, req) : reason
36863
37846
  );
36864
37847
  } catch (err) {
36865
- console.warn("emit error", err);
36866
37848
  }
36867
37849
  }
37850
+ function clearConnectPhaseTimer() {
37851
+ if (connectPhaseTimer) {
37852
+ clearTimeout(connectPhaseTimer);
37853
+ connectPhaseTimer = null;
37854
+ }
37855
+ }
37856
+ function createTimeoutError() {
37857
+ let timeoutErrorMessage = config2.timeout ? "timeout of " + config2.timeout + "ms exceeded" : "timeout exceeded";
37858
+ if (config2.timeoutErrorMessage) {
37859
+ timeoutErrorMessage = config2.timeoutErrorMessage;
37860
+ }
37861
+ return new AxiosError_default(
37862
+ timeoutErrorMessage,
37863
+ transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
37864
+ config2,
37865
+ req
37866
+ );
37867
+ }
36868
37868
  abortEmitter.once("abort", reject);
36869
37869
  const onFinished = () => {
37870
+ clearConnectPhaseTimer();
36870
37871
  if (config2.cancelToken) {
36871
37872
  config2.cancelToken.unsubscribe(abort);
36872
37873
  }
@@ -36883,6 +37884,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
36883
37884
  }
36884
37885
  onDone((response, isRejected) => {
36885
37886
  isDone = true;
37887
+ clearConnectPhaseTimer();
36886
37888
  if (isRejected) {
36887
37889
  rejected = true;
36888
37890
  onFinished();
@@ -36970,11 +37972,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
36970
37972
  boundary: userBoundary && userBoundary[1] || void 0
36971
37973
  }
36972
37974
  );
36973
- } else if (utils_default.isFormData(data) && utils_default.isFunction(data.getHeaders)) {
36974
- headers.set(data.getHeaders());
37975
+ } else if (utils_default.isFormData(data) && utils_default.isFunction(data.getHeaders) && data.getHeaders !== Object.prototype.getHeaders) {
37976
+ setFormDataHeaders(headers, data.getHeaders(), own5("formDataHeaderPolicy"));
36975
37977
  if (!headers.hasContentLength()) {
36976
37978
  try {
36977
- const knownLength = await import_util7.default.promisify(data.getLength).call(data);
37979
+ const knownLength = await import_util8.default.promisify(data.getLength).call(data);
36978
37980
  Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
36979
37981
  } catch (e) {
36980
37982
  }
@@ -37041,14 +38043,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37041
38043
  );
37042
38044
  }
37043
38045
  let auth = void 0;
37044
- if (config2.auth) {
37045
- const username = config2.auth.username || "";
37046
- const password = config2.auth.password || "";
38046
+ const configAuth = own5("auth");
38047
+ if (configAuth) {
38048
+ const username = configAuth.username || "";
38049
+ const password = configAuth.password || "";
37047
38050
  auth = username + ":" + password;
37048
38051
  }
37049
- if (!auth && parsed.username) {
37050
- const urlUsername = parsed.username;
37051
- const urlPassword = parsed.password;
38052
+ if (!auth && (parsed.username || parsed.password)) {
38053
+ const urlUsername = decodeURIComponentSafe(parsed.username);
38054
+ const urlPassword = decodeURIComponentSafe(parsed.password);
37052
38055
  auth = urlUsername + ":" + urlPassword;
37053
38056
  }
37054
38057
  auth && headers.delete("authorization");
@@ -37068,49 +38071,92 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37068
38071
  }
37069
38072
  headers.set(
37070
38073
  "Accept-Encoding",
37071
- "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""),
38074
+ utils_default.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
37072
38075
  false
37073
38076
  );
37074
- const options = {
38077
+ const options = Object.assign(/* @__PURE__ */ Object.create(null), {
37075
38078
  path: path2,
37076
38079
  method,
37077
- headers: headers.toJSON(),
38080
+ headers: toByteStringHeaderObject(headers),
37078
38081
  agents: { http: config2.httpAgent, https: config2.httpsAgent },
37079
38082
  auth,
37080
38083
  protocol,
37081
38084
  family,
37082
38085
  beforeRedirect: dispatchBeforeRedirect,
37083
- beforeRedirects: {},
38086
+ beforeRedirects: /* @__PURE__ */ Object.create(null),
37084
38087
  http2Options
37085
- };
38088
+ });
37086
38089
  !utils_default.isUndefined(lookup) && (options.lookup = lookup);
37087
- if (config2.socketPath) {
37088
- options.socketPath = config2.socketPath;
38090
+ const socketPath = own5("socketPath");
38091
+ if (socketPath) {
38092
+ if (typeof socketPath !== "string") {
38093
+ return reject(
38094
+ new AxiosError_default("socketPath must be a string", AxiosError_default.ERR_BAD_OPTION_VALUE, config2)
38095
+ );
38096
+ }
38097
+ const allowedSocketPaths = own5("allowedSocketPaths");
38098
+ if (allowedSocketPaths != null) {
38099
+ const allowed = Array.isArray(allowedSocketPaths) ? allowedSocketPaths : [allowedSocketPaths];
38100
+ const resolvedSocket = (0, import_path.resolve)(socketPath);
38101
+ const isAllowed = allowed.some(
38102
+ (entry) => typeof entry === "string" && (0, import_path.resolve)(entry) === resolvedSocket
38103
+ );
38104
+ if (!isAllowed) {
38105
+ return reject(
38106
+ new AxiosError_default(
38107
+ `socketPath "${socketPath}" is not permitted by allowedSocketPaths`,
38108
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
38109
+ config2
38110
+ )
38111
+ );
38112
+ }
38113
+ }
38114
+ options.socketPath = socketPath;
37089
38115
  } else {
37090
38116
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
37091
38117
  options.port = parsed.port;
37092
38118
  setProxy(
37093
38119
  options,
37094
38120
  config2.proxy,
37095
- protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path
38121
+ protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
38122
+ false,
38123
+ config2.httpsAgent
37096
38124
  );
37097
38125
  }
37098
38126
  let transport;
38127
+ let isNativeTransport = false;
37099
38128
  const isHttpsRequest = isHttps.test(options.protocol);
37100
- options.agent = isHttpsRequest ? config2.httpsAgent : config2.httpAgent;
38129
+ if (options.agent == null) {
38130
+ options.agent = isHttpsRequest ? config2.httpsAgent : config2.httpAgent;
38131
+ }
37101
38132
  if (isHttp2) {
37102
38133
  transport = http2Transport;
37103
38134
  } else {
37104
- if (config2.transport) {
37105
- transport = config2.transport;
38135
+ const configTransport = own5("transport");
38136
+ if (configTransport) {
38137
+ transport = configTransport;
37106
38138
  } else if (config2.maxRedirects === 0) {
37107
38139
  transport = isHttpsRequest ? import_https.default : import_http.default;
38140
+ isNativeTransport = true;
37108
38141
  } else {
37109
38142
  if (config2.maxRedirects) {
37110
38143
  options.maxRedirects = config2.maxRedirects;
37111
38144
  }
37112
- if (config2.beforeRedirect) {
37113
- options.beforeRedirects.config = config2.beforeRedirect;
38145
+ const configBeforeRedirect = own5("beforeRedirect");
38146
+ if (configBeforeRedirect) {
38147
+ options.beforeRedirects.config = configBeforeRedirect;
38148
+ }
38149
+ if (auth) {
38150
+ const requestOrigin = parsed.origin;
38151
+ const authToRestore = auth;
38152
+ options.beforeRedirects.auth = function beforeRedirectAuth(redirectOptions) {
38153
+ try {
38154
+ if (new URL(redirectOptions.href).origin === requestOrigin) {
38155
+ redirectOptions.auth = authToRestore;
38156
+ }
38157
+ } catch (e) {
38158
+ }
38159
+ };
37114
38160
  }
37115
38161
  transport = isHttpsRequest ? httpsFollow : httpFollow;
37116
38162
  }
@@ -37120,10 +38166,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37120
38166
  } else {
37121
38167
  options.maxBodyLength = Infinity;
37122
38168
  }
37123
- if (config2.insecureHTTPParser) {
37124
- options.insecureHTTPParser = config2.insecureHTTPParser;
37125
- }
38169
+ options.insecureHTTPParser = Boolean(own5("insecureHTTPParser"));
37126
38170
  req = transport.request(options, function handleResponse(res) {
38171
+ clearConnectPhaseTimer();
37127
38172
  if (req.destroyed) return;
37128
38173
  const streams = [res];
37129
38174
  const responseLength = utils_default.toFiniteNumber(res.headers["content-length"]);
@@ -37168,6 +38213,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37168
38213
  streams.push(import_zlib.default.createBrotliDecompress(brotliOptions));
37169
38214
  delete res.headers["content-encoding"];
37170
38215
  }
38216
+ break;
38217
+ case "zstd":
38218
+ if (isZstdSupported) {
38219
+ streams.push(import_zlib.default.createZstdDecompress(zstdOptions));
38220
+ delete res.headers["content-encoding"];
38221
+ }
38222
+ break;
37171
38223
  }
37172
38224
  }
37173
38225
  responseStream = streams.length > 1 ? import_stream4.default.pipeline(streams, utils_default.noop) : streams[0];
@@ -37179,6 +38231,28 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37179
38231
  request: lastRequest
37180
38232
  };
37181
38233
  if (responseType === "stream") {
38234
+ if (config2.maxContentLength > -1) {
38235
+ const limit = config2.maxContentLength;
38236
+ const source = responseStream;
38237
+ async function* enforceMaxContentLength() {
38238
+ let totalResponseBytes = 0;
38239
+ for await (const chunk of source) {
38240
+ totalResponseBytes += chunk.length;
38241
+ if (totalResponseBytes > limit) {
38242
+ throw new AxiosError_default(
38243
+ "maxContentLength size of " + limit + " exceeded",
38244
+ AxiosError_default.ERR_BAD_RESPONSE,
38245
+ config2,
38246
+ lastRequest
38247
+ );
38248
+ }
38249
+ yield chunk;
38250
+ }
38251
+ }
38252
+ responseStream = import_stream4.default.Readable.from(enforceMaxContentLength(), {
38253
+ objectMode: false
38254
+ });
38255
+ }
37182
38256
  response.data = responseStream;
37183
38257
  settle(resolve, reject, response);
37184
38258
  } else {
@@ -37208,14 +38282,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37208
38282
  "stream has been aborted",
37209
38283
  AxiosError_default.ERR_BAD_RESPONSE,
37210
38284
  config2,
37211
- lastRequest
38285
+ lastRequest,
38286
+ response
37212
38287
  );
37213
38288
  responseStream.destroy(err);
37214
38289
  reject(err);
37215
38290
  });
37216
38291
  responseStream.on("error", function handleStreamError(err) {
37217
- if (req.destroyed) return;
37218
- reject(AxiosError_default.from(err, null, config2, lastRequest));
38292
+ if (rejected) return;
38293
+ reject(AxiosError_default.from(err, null, config2, lastRequest, response));
37219
38294
  });
37220
38295
  responseStream.on("end", function handleStreamEnd() {
37221
38296
  try {
@@ -37250,8 +38325,29 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37250
38325
  req.on("error", function handleRequestError(err) {
37251
38326
  reject(AxiosError_default.from(err, null, config2, req));
37252
38327
  });
38328
+ const boundSockets = /* @__PURE__ */ new Set();
37253
38329
  req.on("socket", function handleRequestSocket(socket) {
37254
38330
  socket.setKeepAlive(true, 1e3 * 60);
38331
+ if (!socket[kAxiosSocketListener]) {
38332
+ socket.on("error", function handleSocketError(err) {
38333
+ const current = socket[kAxiosCurrentReq];
38334
+ if (current && !current.destroyed) {
38335
+ current.destroy(err);
38336
+ }
38337
+ });
38338
+ socket[kAxiosSocketListener] = true;
38339
+ }
38340
+ socket[kAxiosCurrentReq] = req;
38341
+ boundSockets.add(socket);
38342
+ });
38343
+ req.once("close", function clearCurrentReq() {
38344
+ clearConnectPhaseTimer();
38345
+ for (const socket of boundSockets) {
38346
+ if (socket[kAxiosCurrentReq] === req) {
38347
+ socket[kAxiosCurrentReq] = null;
38348
+ }
38349
+ }
38350
+ boundSockets.clear();
37255
38351
  });
37256
38352
  if (config2.timeout) {
37257
38353
  const timeout = parseInt(config2.timeout, 10);
@@ -37266,22 +38362,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37266
38362
  );
37267
38363
  return;
37268
38364
  }
37269
- req.setTimeout(timeout, function handleRequestTimeout() {
38365
+ const handleTimeout = function handleTimeout2() {
37270
38366
  if (isDone) return;
37271
- let timeoutErrorMessage = config2.timeout ? "timeout of " + config2.timeout + "ms exceeded" : "timeout exceeded";
37272
- const transitional2 = config2.transitional || transitional_default;
37273
- if (config2.timeoutErrorMessage) {
37274
- timeoutErrorMessage = config2.timeoutErrorMessage;
37275
- }
37276
- abort(
37277
- new AxiosError_default(
37278
- timeoutErrorMessage,
37279
- transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
37280
- config2,
37281
- req
37282
- )
37283
- );
37284
- });
38367
+ abort(createTimeoutError());
38368
+ };
38369
+ if (isNativeTransport && timeout > 0) {
38370
+ connectPhaseTimer = setTimeout(handleTimeout, timeout);
38371
+ }
38372
+ req.setTimeout(timeout, handleTimeout);
37285
38373
  } else {
37286
38374
  req.setTimeout(0);
37287
38375
  }
@@ -37300,7 +38388,37 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
37300
38388
  abort(new CanceledError_default("Request stream has been aborted", config2, req));
37301
38389
  }
37302
38390
  });
37303
- data.pipe(req);
38391
+ let uploadStream = data;
38392
+ if (config2.maxBodyLength > -1 && config2.maxRedirects === 0) {
38393
+ const limit = config2.maxBodyLength;
38394
+ let bytesSent = 0;
38395
+ uploadStream = import_stream4.default.pipeline(
38396
+ [
38397
+ data,
38398
+ new import_stream4.default.Transform({
38399
+ transform(chunk, _enc, cb) {
38400
+ bytesSent += chunk.length;
38401
+ if (bytesSent > limit) {
38402
+ return cb(
38403
+ new AxiosError_default(
38404
+ "Request body larger than maxBodyLength limit",
38405
+ AxiosError_default.ERR_BAD_REQUEST,
38406
+ config2,
38407
+ req
38408
+ )
38409
+ );
38410
+ }
38411
+ cb(null, chunk);
38412
+ }
38413
+ })
38414
+ ],
38415
+ utils_default.noop
38416
+ );
38417
+ uploadStream.on("error", (err) => {
38418
+ if (!req.destroyed) req.destroy(err);
38419
+ });
38420
+ }
38421
+ uploadStream.pipe(req);
37304
38422
  } else {
37305
38423
  data && req.write(data);
37306
38424
  req.end();
@@ -37343,8 +38461,15 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
37343
38461
  },
37344
38462
  read(name) {
37345
38463
  if (typeof document === "undefined") return null;
37346
- const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
37347
- return match ? decodeURIComponent(match[1]) : null;
38464
+ const cookies = document.cookie.split(";");
38465
+ for (let i2 = 0; i2 < cookies.length; i2++) {
38466
+ const cookie = cookies[i2].replace(/^\s+/, "");
38467
+ const eq = cookie.indexOf("=");
38468
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
38469
+ return decodeURIComponent(cookie.slice(eq + 1));
38470
+ }
38471
+ }
38472
+ return null;
37348
38473
  },
37349
38474
  remove(name) {
37350
38475
  this.write(name, "", Date.now() - 864e5, "/");
@@ -37367,7 +38492,16 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
37367
38492
  var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
37368
38493
  function mergeConfig(config1, config2) {
37369
38494
  config2 = config2 || {};
37370
- const config3 = {};
38495
+ const config3 = /* @__PURE__ */ Object.create(null);
38496
+ Object.defineProperty(config3, "hasOwnProperty", {
38497
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
38498
+ // this data descriptor into an accessor descriptor on the way in.
38499
+ __proto__: null,
38500
+ value: Object.prototype.hasOwnProperty,
38501
+ enumerable: false,
38502
+ writable: true,
38503
+ configurable: true
38504
+ });
37371
38505
  function getMergedValue(target, source, prop, caseless) {
37372
38506
  if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
37373
38507
  return utils_default.merge.call({ caseless }, target, source);
@@ -37398,9 +38532,9 @@ function mergeConfig(config1, config2) {
37398
38532
  }
37399
38533
  }
37400
38534
  function mergeDirectKeys(a2, b3, prop) {
37401
- if (prop in config2) {
38535
+ if (utils_default.hasOwnProp(config2, prop)) {
37402
38536
  return getMergedValue(a2, b3);
37403
- } else if (prop in config1) {
38537
+ } else if (utils_default.hasOwnProp(config1, prop)) {
37404
38538
  return getMergedValue(void 0, a2);
37405
38539
  }
37406
38540
  }
@@ -37431,6 +38565,7 @@ function mergeConfig(config1, config2) {
37431
38565
  httpsAgent: defaultToConfig2,
37432
38566
  cancelToken: defaultToConfig2,
37433
38567
  socketPath: defaultToConfig2,
38568
+ allowedSocketPaths: defaultToConfig2,
37434
38569
  responseEncoding: defaultToConfig2,
37435
38570
  validateStatus: mergeDirectKeys,
37436
38571
  headers: (a2, b3, prop) => mergeDeepProperties(headersToObject(a2), headersToObject(b3), prop, true)
@@ -37438,46 +38573,68 @@ function mergeConfig(config1, config2) {
37438
38573
  utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
37439
38574
  if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
37440
38575
  const merge4 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
37441
- const configValue = merge4(config1[prop], config2[prop], prop);
38576
+ const a2 = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
38577
+ const b3 = utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0;
38578
+ const configValue = merge4(a2, b3, prop);
37442
38579
  utils_default.isUndefined(configValue) && merge4 !== mergeDirectKeys || (config3[prop] = configValue);
37443
38580
  });
37444
38581
  return config3;
37445
38582
  }
37446
38583
 
37447
38584
  // node_modules/axios/lib/helpers/resolveConfig.js
37448
- var resolveConfig_default = (config2) => {
38585
+ var FORM_DATA_CONTENT_HEADERS2 = ["content-type", "content-length"];
38586
+ function setFormDataHeaders2(headers, formHeaders, policy) {
38587
+ if (policy !== "content-only") {
38588
+ headers.set(formHeaders);
38589
+ return;
38590
+ }
38591
+ Object.entries(formHeaders).forEach(([key2, val]) => {
38592
+ if (FORM_DATA_CONTENT_HEADERS2.includes(key2.toLowerCase())) {
38593
+ headers.set(key2, val);
38594
+ }
38595
+ });
38596
+ }
38597
+ var encodeUTF8 = (str) => encodeURIComponent(str).replace(
38598
+ /%([0-9A-F]{2})/gi,
38599
+ (_3, hex3) => String.fromCharCode(parseInt(hex3, 16))
38600
+ );
38601
+ function resolveConfig(config2) {
37449
38602
  const newConfig = mergeConfig({}, config2);
37450
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
38603
+ const own5 = (key2) => utils_default.hasOwnProp(newConfig, key2) ? newConfig[key2] : void 0;
38604
+ const data = own5("data");
38605
+ let withXSRFToken = own5("withXSRFToken");
38606
+ const xsrfHeaderName = own5("xsrfHeaderName");
38607
+ const xsrfCookieName = own5("xsrfCookieName");
38608
+ let headers = own5("headers");
38609
+ const auth = own5("auth");
38610
+ const baseURL = own5("baseURL");
38611
+ const allowAbsoluteUrls = own5("allowAbsoluteUrls");
38612
+ const url3 = own5("url");
37451
38613
  newConfig.headers = headers = AxiosHeaders_default.from(headers);
37452
38614
  newConfig.url = buildURL(
37453
- buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
37454
- config2.params,
37455
- config2.paramsSerializer
38615
+ buildFullPath(baseURL, url3, allowAbsoluteUrls),
38616
+ own5("params"),
38617
+ own5("paramsSerializer")
37456
38618
  );
37457
38619
  if (auth) {
37458
38620
  headers.set(
37459
38621
  "Authorization",
37460
- "Basic " + btoa(
37461
- (auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
37462
- )
38622
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? encodeUTF8(auth.password) : ""))
37463
38623
  );
37464
38624
  }
37465
38625
  if (utils_default.isFormData(data)) {
37466
- if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
38626
+ if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) {
37467
38627
  headers.setContentType(void 0);
37468
38628
  } else if (utils_default.isFunction(data.getHeaders)) {
37469
- const formHeaders = data.getHeaders();
37470
- const allowedHeaders = ["content-type", "content-length"];
37471
- Object.entries(formHeaders).forEach(([key2, val]) => {
37472
- if (allowedHeaders.includes(key2.toLowerCase())) {
37473
- headers.set(key2, val);
37474
- }
37475
- });
38629
+ setFormDataHeaders2(headers, data.getHeaders(), own5("formDataHeaderPolicy"));
37476
38630
  }
37477
38631
  }
37478
38632
  if (platform_default.hasStandardBrowserEnv) {
37479
- withXSRFToken && utils_default.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
37480
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(newConfig.url)) {
38633
+ if (utils_default.isFunction(withXSRFToken)) {
38634
+ withXSRFToken = withXSRFToken(newConfig);
38635
+ }
38636
+ const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin_default(newConfig.url);
38637
+ if (shouldSendXSRF) {
37481
38638
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
37482
38639
  if (xsrfValue) {
37483
38640
  headers.set(xsrfHeaderName, xsrfValue);
@@ -37485,7 +38642,8 @@ var resolveConfig_default = (config2) => {
37485
38642
  }
37486
38643
  }
37487
38644
  return newConfig;
37488
- };
38645
+ }
38646
+ var resolveConfig_default = resolveConfig;
37489
38647
 
37490
38648
  // node_modules/axios/lib/adapters/xhr.js
37491
38649
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
@@ -37543,7 +38701,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37543
38701
  if (!request || request.readyState !== 4) {
37544
38702
  return;
37545
38703
  }
37546
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
38704
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith("file:"))) {
37547
38705
  return;
37548
38706
  }
37549
38707
  setTimeout(onloadend);
@@ -37554,6 +38712,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37554
38712
  return;
37555
38713
  }
37556
38714
  reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config2, request));
38715
+ done();
37557
38716
  request = null;
37558
38717
  };
37559
38718
  request.onerror = function handleError(event) {
@@ -37561,6 +38720,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37561
38720
  const err = new AxiosError_default(msg, AxiosError_default.ERR_NETWORK, config2, request);
37562
38721
  err.event = event || null;
37563
38722
  reject(err);
38723
+ done();
37564
38724
  request = null;
37565
38725
  };
37566
38726
  request.ontimeout = function handleTimeout() {
@@ -37577,11 +38737,12 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37577
38737
  request
37578
38738
  )
37579
38739
  );
38740
+ done();
37580
38741
  request = null;
37581
38742
  };
37582
38743
  requestData === void 0 && requestHeaders.setContentType(null);
37583
38744
  if ("setRequestHeader" in request) {
37584
- utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key2) {
38745
+ utils_default.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key2) {
37585
38746
  request.setRequestHeader(key2, val);
37586
38747
  });
37587
38748
  }
@@ -37607,6 +38768,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37607
38768
  }
37608
38769
  reject(!cancel || cancel.type ? new CanceledError_default(null, config2, request) : cancel);
37609
38770
  request.abort();
38771
+ done();
37610
38772
  request = null;
37611
38773
  };
37612
38774
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -37615,7 +38777,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37615
38777
  }
37616
38778
  }
37617
38779
  const protocol = parseProtocol(_config.url);
37618
- if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
38780
+ if (protocol && !platform_default.protocols.includes(protocol)) {
37619
38781
  reject(
37620
38782
  new AxiosError_default(
37621
38783
  "Unsupported protocol " + protocol + ":",
@@ -37631,39 +38793,41 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
37631
38793
 
37632
38794
  // node_modules/axios/lib/helpers/composeSignals.js
37633
38795
  var composeSignals = (signals, timeout) => {
37634
- const { length } = signals = signals ? signals.filter(Boolean) : [];
37635
- if (timeout || length) {
37636
- let controller = new AbortController();
37637
- let aborted2;
37638
- const onabort = function(reason) {
37639
- if (!aborted2) {
37640
- aborted2 = true;
37641
- unsubscribe();
37642
- const err = reason instanceof Error ? reason : this.reason;
37643
- controller.abort(
37644
- err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
37645
- );
37646
- }
37647
- };
37648
- let timer = timeout && setTimeout(() => {
37649
- timer = null;
37650
- onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
37651
- }, timeout);
37652
- const unsubscribe = () => {
37653
- if (signals) {
37654
- timer && clearTimeout(timer);
37655
- timer = null;
37656
- signals.forEach((signal2) => {
37657
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
37658
- });
37659
- signals = null;
37660
- }
37661
- };
37662
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
37663
- const { signal } = controller;
37664
- signal.unsubscribe = () => utils_default.asap(unsubscribe);
37665
- return signal;
38796
+ signals = signals ? signals.filter(Boolean) : [];
38797
+ if (!timeout && !signals.length) {
38798
+ return;
37666
38799
  }
38800
+ const controller = new AbortController();
38801
+ let aborted2 = false;
38802
+ const onabort = function(reason) {
38803
+ if (!aborted2) {
38804
+ aborted2 = true;
38805
+ unsubscribe();
38806
+ const err = reason instanceof Error ? reason : this.reason;
38807
+ controller.abort(
38808
+ err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
38809
+ );
38810
+ }
38811
+ };
38812
+ let timer = timeout && setTimeout(() => {
38813
+ timer = null;
38814
+ onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
38815
+ }, timeout);
38816
+ const unsubscribe = () => {
38817
+ if (!signals) {
38818
+ return;
38819
+ }
38820
+ timer && clearTimeout(timer);
38821
+ timer = null;
38822
+ signals.forEach((signal2) => {
38823
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
38824
+ });
38825
+ signals = null;
38826
+ };
38827
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
38828
+ const { signal } = controller;
38829
+ signal.unsubscribe = () => utils_default.asap(unsubscribe);
38830
+ return signal;
37667
38831
  };
37668
38832
  var composeSignals_default = composeSignals;
37669
38833
 
@@ -37750,11 +38914,20 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
37750
38914
  // node_modules/axios/lib/adapters/fetch.js
37751
38915
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
37752
38916
  var { isFunction: isFunction2 } = utils_default;
37753
- var globalFetchAPI = (({ Request, Response }) => ({
37754
- Request,
37755
- Response
37756
- }))(utils_default.global);
37757
- var { ReadableStream: ReadableStream2, TextEncoder: TextEncoder2 } = utils_default.global;
38917
+ var encodeUTF82 = (str) => encodeURIComponent(str).replace(
38918
+ /%([0-9A-F]{2})/gi,
38919
+ (_3, hex3) => String.fromCharCode(parseInt(hex3, 16))
38920
+ );
38921
+ var decodeURIComponentSafe2 = (value) => {
38922
+ if (!utils_default.isString(value)) {
38923
+ return value;
38924
+ }
38925
+ try {
38926
+ return decodeURIComponent(value);
38927
+ } catch (error2) {
38928
+ return value;
38929
+ }
38930
+ };
37758
38931
  var test = (fn, ...args) => {
37759
38932
  try {
37760
38933
  return !!fn(...args);
@@ -37762,12 +38935,25 @@ var test = (fn, ...args) => {
37762
38935
  return false;
37763
38936
  }
37764
38937
  };
38938
+ var maybeWithAuthCredentials = (url3) => {
38939
+ const protocolIndex = url3.indexOf("://");
38940
+ let urlToCheck = url3;
38941
+ if (protocolIndex !== -1) {
38942
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
38943
+ }
38944
+ return urlToCheck.includes("@") || urlToCheck.includes(":");
38945
+ };
37765
38946
  var factory = (env) => {
38947
+ const globalObject = utils_default.global !== void 0 && utils_default.global !== null ? utils_default.global : globalThis;
38948
+ const { ReadableStream: ReadableStream2, TextEncoder: TextEncoder2 } = globalObject;
37766
38949
  env = utils_default.merge.call(
37767
38950
  {
37768
38951
  skipUndefined: true
37769
38952
  },
37770
- globalFetchAPI,
38953
+ {
38954
+ Request: globalObject.Request,
38955
+ Response: globalObject.Response
38956
+ },
37771
38957
  env
37772
38958
  );
37773
38959
  const { fetch: envFetch, Request, Response } = env;
@@ -37781,16 +38967,18 @@ var factory = (env) => {
37781
38967
  const encodeText = isFetchSupported && (typeof TextEncoder2 === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder2()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
37782
38968
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
37783
38969
  let duplexAccessed = false;
37784
- const body3 = new ReadableStream2();
37785
- const hasContentType = new Request(platform_default.origin, {
37786
- body: body3,
38970
+ const request = new Request(platform_default.origin, {
38971
+ body: new ReadableStream2(),
37787
38972
  method: "POST",
37788
38973
  get duplex() {
37789
38974
  duplexAccessed = true;
37790
38975
  return "half";
37791
38976
  }
37792
- }).headers.has("Content-Type");
37793
- body3.cancel();
38977
+ });
38978
+ const hasContentType = request.headers.has("Content-Type");
38979
+ if (request.body != null) {
38980
+ request.body.cancel();
38981
+ }
37794
38982
  return duplexAccessed && !hasContentType;
37795
38983
  });
37796
38984
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
@@ -37853,8 +39041,13 @@ var factory = (env) => {
37853
39041
  responseType,
37854
39042
  headers,
37855
39043
  withCredentials = "same-origin",
37856
- fetchOptions
39044
+ fetchOptions,
39045
+ maxContentLength,
39046
+ maxBodyLength
37857
39047
  } = resolveConfig_default(config2);
39048
+ const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
39049
+ const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
39050
+ const own5 = (key2) => utils_default.hasOwnProp(config2, key2) ? config2[key2] : void 0;
37858
39051
  let _fetch = envFetch || fetch;
37859
39052
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
37860
39053
  let composedSignal = composeSignals_default(
@@ -37867,6 +39060,61 @@ var factory = (env) => {
37867
39060
  });
37868
39061
  let requestContentLength;
37869
39062
  try {
39063
+ let auth = void 0;
39064
+ const configAuth = own5("auth");
39065
+ if (configAuth) {
39066
+ const username = configAuth.username || "";
39067
+ const password = configAuth.password || "";
39068
+ auth = {
39069
+ username,
39070
+ password
39071
+ };
39072
+ }
39073
+ if (maybeWithAuthCredentials(url3)) {
39074
+ const parsedURL = new URL(url3, platform_default.origin);
39075
+ if (!auth && (parsedURL.username || parsedURL.password)) {
39076
+ const urlUsername = decodeURIComponentSafe2(parsedURL.username);
39077
+ const urlPassword = decodeURIComponentSafe2(parsedURL.password);
39078
+ auth = {
39079
+ username: urlUsername,
39080
+ password: urlPassword
39081
+ };
39082
+ }
39083
+ if (parsedURL.username || parsedURL.password) {
39084
+ parsedURL.username = "";
39085
+ parsedURL.password = "";
39086
+ url3 = parsedURL.href;
39087
+ }
39088
+ }
39089
+ if (auth) {
39090
+ headers.delete("authorization");
39091
+ headers.set(
39092
+ "Authorization",
39093
+ "Basic " + btoa(encodeUTF82((auth.username || "") + ":" + (auth.password || "")))
39094
+ );
39095
+ }
39096
+ if (hasMaxContentLength && typeof url3 === "string" && url3.startsWith("data:")) {
39097
+ const estimated = estimateDataURLDecodedBytes(url3);
39098
+ if (estimated > maxContentLength) {
39099
+ throw new AxiosError_default(
39100
+ "maxContentLength size of " + maxContentLength + " exceeded",
39101
+ AxiosError_default.ERR_BAD_RESPONSE,
39102
+ config2,
39103
+ request
39104
+ );
39105
+ }
39106
+ }
39107
+ if (hasMaxBodyLength && method !== "get" && method !== "head") {
39108
+ const outboundLength = await resolveBodyLength(headers, data);
39109
+ if (typeof outboundLength === "number" && isFinite(outboundLength) && outboundLength > maxBodyLength) {
39110
+ throw new AxiosError_default(
39111
+ "Request body larger than maxBodyLength limit",
39112
+ AxiosError_default.ERR_BAD_REQUEST,
39113
+ config2,
39114
+ request
39115
+ );
39116
+ }
39117
+ }
37870
39118
  if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
37871
39119
  let _request = new Request(url3, {
37872
39120
  method: "POST",
@@ -37889,19 +39137,37 @@ var factory = (env) => {
37889
39137
  withCredentials = withCredentials ? "include" : "omit";
37890
39138
  }
37891
39139
  const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
39140
+ if (utils_default.isFormData(data)) {
39141
+ const contentType = headers.getContentType();
39142
+ if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
39143
+ headers.delete("content-type");
39144
+ }
39145
+ }
39146
+ headers.set("User-Agent", "axios/" + VERSION, false);
37892
39147
  const resolvedOptions = {
37893
39148
  ...fetchOptions,
37894
39149
  signal: composedSignal,
37895
39150
  method: method.toUpperCase(),
37896
- headers: headers.normalize().toJSON(),
39151
+ headers: toByteStringHeaderObject(headers.normalize()),
37897
39152
  body: data,
37898
39153
  duplex: "half",
37899
39154
  credentials: isCredentialsSupported ? withCredentials : void 0
37900
39155
  };
37901
39156
  request = isRequestSupported && new Request(url3, resolvedOptions);
37902
39157
  let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url3, resolvedOptions));
39158
+ if (hasMaxContentLength) {
39159
+ const declaredLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
39160
+ if (declaredLength != null && declaredLength > maxContentLength) {
39161
+ throw new AxiosError_default(
39162
+ "maxContentLength size of " + maxContentLength + " exceeded",
39163
+ AxiosError_default.ERR_BAD_RESPONSE,
39164
+ config2,
39165
+ request
39166
+ );
39167
+ }
39168
+ }
37903
39169
  const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
37904
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
39170
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
37905
39171
  const options = {};
37906
39172
  ["status", "statusText", "headers"].forEach((prop) => {
37907
39173
  options[prop] = response[prop];
@@ -37911,8 +39177,23 @@ var factory = (env) => {
37911
39177
  responseContentLength,
37912
39178
  progressEventReducer(asyncDecorator(onDownloadProgress), true)
37913
39179
  ) || [];
39180
+ let bytesRead = 0;
39181
+ const onChunkProgress = (loadedBytes) => {
39182
+ if (hasMaxContentLength) {
39183
+ bytesRead = loadedBytes;
39184
+ if (bytesRead > maxContentLength) {
39185
+ throw new AxiosError_default(
39186
+ "maxContentLength size of " + maxContentLength + " exceeded",
39187
+ AxiosError_default.ERR_BAD_RESPONSE,
39188
+ config2,
39189
+ request
39190
+ );
39191
+ }
39192
+ }
39193
+ onProgress && onProgress(loadedBytes);
39194
+ };
37914
39195
  response = new Response(
37915
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
39196
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
37916
39197
  flush && flush();
37917
39198
  unsubscribe && unsubscribe();
37918
39199
  }),
@@ -37924,6 +39205,26 @@ var factory = (env) => {
37924
39205
  response,
37925
39206
  config2
37926
39207
  );
39208
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
39209
+ let materializedSize;
39210
+ if (responseData != null) {
39211
+ if (typeof responseData.byteLength === "number") {
39212
+ materializedSize = responseData.byteLength;
39213
+ } else if (typeof responseData.size === "number") {
39214
+ materializedSize = responseData.size;
39215
+ } else if (typeof responseData === "string") {
39216
+ materializedSize = typeof TextEncoder2 === "function" ? new TextEncoder2().encode(responseData).byteLength : responseData.length;
39217
+ }
39218
+ }
39219
+ if (typeof materializedSize === "number" && materializedSize > maxContentLength) {
39220
+ throw new AxiosError_default(
39221
+ "maxContentLength size of " + maxContentLength + " exceeded",
39222
+ AxiosError_default.ERR_BAD_RESPONSE,
39223
+ config2,
39224
+ request
39225
+ );
39226
+ }
39227
+ }
37927
39228
  !isStreamResponse && unsubscribe && unsubscribe();
37928
39229
  return await new Promise((resolve, reject) => {
37929
39230
  settle(resolve, reject, {
@@ -37937,6 +39238,13 @@ var factory = (env) => {
37937
39238
  });
37938
39239
  } catch (err) {
37939
39240
  unsubscribe && unsubscribe();
39241
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError_default) {
39242
+ const canceledError = composedSignal.reason;
39243
+ canceledError.config = config2;
39244
+ request && (canceledError.request = request);
39245
+ err !== canceledError && (canceledError.cause = err);
39246
+ throw canceledError;
39247
+ }
37940
39248
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
37941
39249
  throw Object.assign(
37942
39250
  new AxiosError_default(
@@ -37982,10 +39290,10 @@ var knownAdapters = {
37982
39290
  utils_default.forEach(knownAdapters, (fn, value) => {
37983
39291
  if (fn) {
37984
39292
  try {
37985
- Object.defineProperty(fn, "name", { value });
39293
+ Object.defineProperty(fn, "name", { __proto__: null, value });
37986
39294
  } catch (e) {
37987
39295
  }
37988
- Object.defineProperty(fn, "adapterName", { value });
39296
+ Object.defineProperty(fn, "adapterName", { __proto__: null, value });
37989
39297
  }
37990
39298
  });
37991
39299
  var renderReason = (reason) => `- ${reason}`;
@@ -38056,7 +39364,12 @@ function dispatchRequest(config2) {
38056
39364
  return adapter2(config2).then(
38057
39365
  function onAdapterResolution(response) {
38058
39366
  throwIfCancellationRequested(config2);
38059
- response.data = transformData.call(config2, config2.transformResponse, response);
39367
+ config2.response = response;
39368
+ try {
39369
+ response.data = transformData.call(config2, config2.transformResponse, response);
39370
+ } finally {
39371
+ delete config2.response;
39372
+ }
38060
39373
  response.headers = AxiosHeaders_default.from(response.headers);
38061
39374
  return response;
38062
39375
  },
@@ -38064,11 +39377,16 @@ function dispatchRequest(config2) {
38064
39377
  if (!isCancel(reason)) {
38065
39378
  throwIfCancellationRequested(config2);
38066
39379
  if (reason && reason.response) {
38067
- reason.response.data = transformData.call(
38068
- config2,
38069
- config2.transformResponse,
38070
- reason.response
38071
- );
39380
+ config2.response = reason.response;
39381
+ try {
39382
+ reason.response.data = transformData.call(
39383
+ config2,
39384
+ config2.transformResponse,
39385
+ reason.response
39386
+ );
39387
+ } finally {
39388
+ delete config2.response;
39389
+ }
38072
39390
  reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
38073
39391
  }
38074
39392
  }
@@ -38122,7 +39440,7 @@ function assertOptions(options, schema, allowUnknown) {
38122
39440
  let i2 = keys.length;
38123
39441
  while (i2-- > 0) {
38124
39442
  const opt = keys[i2];
38125
- const validator = schema[opt];
39443
+ const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : void 0;
38126
39444
  if (validator) {
38127
39445
  const value = options[opt];
38128
39446
  const result = value === void 0 || validator(value, opt, options);
@@ -38169,12 +39487,23 @@ var Axios = class {
38169
39487
  if (err instanceof Error) {
38170
39488
  let dummy = {};
38171
39489
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
38172
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
39490
+ const stack = (() => {
39491
+ if (!dummy.stack) {
39492
+ return "";
39493
+ }
39494
+ const firstNewlineIndex = dummy.stack.indexOf("\n");
39495
+ return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
39496
+ })();
38173
39497
  try {
38174
39498
  if (!err.stack) {
38175
39499
  err.stack = stack;
38176
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
38177
- err.stack += "\n" + stack;
39500
+ } else if (stack) {
39501
+ const firstNewlineIndex = stack.indexOf("\n");
39502
+ const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
39503
+ const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
39504
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
39505
+ err.stack += "\n" + stack;
39506
+ }
38178
39507
  }
38179
39508
  } catch (e) {
38180
39509
  }
@@ -38198,7 +39527,8 @@ var Axios = class {
38198
39527
  silentJSONParsing: validators2.transitional(validators2.boolean),
38199
39528
  forcedJSONParsing: validators2.transitional(validators2.boolean),
38200
39529
  clarifyTimeoutError: validators2.transitional(validators2.boolean),
38201
- legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
39530
+ legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean),
39531
+ advertiseZstdAcceptEncoding: validators2.transitional(validators2.boolean)
38202
39532
  },
38203
39533
  false
38204
39534
  );
@@ -38235,7 +39565,7 @@ var Axios = class {
38235
39565
  );
38236
39566
  config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
38237
39567
  let contextHeaders = headers && utils_default.merge(headers.common, headers[config2.method]);
38238
- headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
39568
+ headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
38239
39569
  delete headers[method];
38240
39570
  });
38241
39571
  config2.headers = AxiosHeaders_default.concat(contextHeaders, headers);
@@ -38313,7 +39643,7 @@ utils_default.forEach(["delete", "get", "head", "options"], function forEachMeth
38313
39643
  );
38314
39644
  };
38315
39645
  });
38316
- utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
39646
+ utils_default.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
38317
39647
  function generateHTTPMethod(isForm) {
38318
39648
  return function httpMethod(url3, data, config2) {
38319
39649
  return this.request(
@@ -38329,7 +39659,9 @@ utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(m
38329
39659
  };
38330
39660
  }
38331
39661
  Axios.prototype[method] = generateHTTPMethod();
38332
- Axios.prototype[method + "Form"] = generateHTTPMethod(true);
39662
+ if (method !== "query") {
39663
+ Axios.prototype[method + "Form"] = generateHTTPMethod(true);
39664
+ }
38333
39665
  });
38334
39666
  var Axios_default = Axios;
38335
39667
 
@@ -38526,7 +39858,7 @@ function createInstance(defaultConfig) {
38526
39858
  const instance = bind(Axios_default.prototype.request, context);
38527
39859
  utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true });
38528
39860
  utils_default.extend(instance, context, null, { allOwnKeys: true });
38529
- instance.create = function create2(instanceConfig) {
39861
+ instance.create = function create3(instanceConfig) {
38530
39862
  return createInstance(mergeConfig(defaultConfig, instanceConfig));
38531
39863
  };
38532
39864
  return instance;
@@ -38570,7 +39902,8 @@ var {
38570
39902
  HttpStatusCode: HttpStatusCode2,
38571
39903
  formToJSON,
38572
39904
  getAdapter: getAdapter2,
38573
- mergeConfig: mergeConfig2
39905
+ mergeConfig: mergeConfig2,
39906
+ create
38574
39907
  } = axios_default;
38575
39908
 
38576
39909
  // src/error-translator.ts
@@ -38596,7 +39929,7 @@ function translateWpError(code, data) {
38596
39929
  switch (code) {
38597
39930
  // ── Routing / auth ─────────────────────────────────────────────
38598
39931
  case "rest_no_route":
38599
- return "REST route not found at this site. Confirm the gk-block-api plugin is active and the WORDPRESS_URL is correct.";
39932
+ return "REST route not found at this site. Confirm the Block MCP plugin is active and the WORDPRESS_URL is correct.";
38600
39933
  case "rest_forbidden":
38601
39934
  case "rest_cannot_edit":
38602
39935
  case "rest_cannot_create":
@@ -38657,6 +39990,19 @@ function formatPath(path2) {
38657
39990
  }
38658
39991
 
38659
39992
  // src/client.ts
39993
+ function mimeForFilename(filename) {
39994
+ const ext = filename.toLowerCase().split(".").pop() ?? "";
39995
+ const map2 = {
39996
+ png: "image/png",
39997
+ jpg: "image/jpeg",
39998
+ jpeg: "image/jpeg",
39999
+ gif: "image/gif",
40000
+ webp: "image/webp",
40001
+ svg: "image/svg+xml",
40002
+ pdf: "application/pdf"
40003
+ };
40004
+ return map2[ext] ?? "application/octet-stream";
40005
+ }
38660
40006
  var MAX_RETRIES = 2;
38661
40007
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["get", "head", "options"]);
38662
40008
  function sleep(ms) {
@@ -38919,6 +40265,8 @@ var WordPressBlockClient = class {
38919
40265
  if (params?.include_legacy_paths) queryParams.include_legacy_paths = "true";
38920
40266
  if (params?.persist_refs === false) queryParams.persist_refs = "false";
38921
40267
  else if (params?.persist_refs === true) queryParams.persist_refs = "true";
40268
+ if (typeof params?.limit === "number") queryParams.limit = String(params.limit);
40269
+ if (params?.cursor) queryParams.cursor = params.cursor;
38922
40270
  const response = await this.client.get(
38923
40271
  `/posts/${postId}/blocks`,
38924
40272
  { params: queryParams }
@@ -39280,17 +40628,20 @@ var WordPressBlockClient = class {
39280
40628
  }
39281
40629
  if (args.path) {
39282
40630
  const fs2 = await import("node:fs/promises");
39283
- const path2 = await import("node:path");
40631
+ const nodePath = await import("node:path");
40632
+ const { default: FormData3 } = await Promise.resolve().then(() => __toESM(require_form_data(), 1));
39284
40633
  const data = await fs2.readFile(args.path);
39285
- const filename = args.filename ?? path2.basename(args.path);
39286
- const form = new FormData();
39287
- form.append("file", new Blob([new Uint8Array(data)]), filename);
40634
+ const filename = args.filename ?? nodePath.basename(args.path);
40635
+ const form = new FormData3();
40636
+ form.append("file", data, { filename, contentType: mimeForFilename(filename) });
39288
40637
  if (args.title) form.append("title", args.title);
39289
40638
  if (args.alt_text) form.append("alt_text", args.alt_text);
39290
40639
  if (args.caption) form.append("caption", args.caption);
39291
40640
  if (args.description) form.append("description", args.description);
39292
40641
  if (typeof args.post_id === "number") form.append("post_id", String(args.post_id));
39293
- const response2 = await this.client.post("/media", form);
40642
+ const response2 = await this.client.post("/media", form, {
40643
+ headers: form.getHeaders()
40644
+ });
39294
40645
  return response2.data;
39295
40646
  }
39296
40647
  const response = await this.client.post("/media", args);
@@ -39847,6 +41198,14 @@ var READ_TOOLS = [
39847
41198
  persist_refs: {
39848
41199
  type: "boolean",
39849
41200
  description: "Default true. When true, missing block refs (attrs.metadata.gk_ref) are assigned and persisted silently (no revision created). Set false for read-only callers that don't want write side effects \u2014 refs in the response will not resolve in subsequent mutation calls."
41201
+ },
41202
+ limit: {
41203
+ type: "number",
41204
+ description: "Page size: top-level blocks per response. When more remain, the response carries `pagination.next_cursor` \u2014 pass it back via `cursor` to fetch the next page."
41205
+ },
41206
+ cursor: {
41207
+ type: "string",
41208
+ description: "Opaque cursor from a previous response's `pagination.next_cursor`. Omit on the first request."
39850
41209
  }
39851
41210
  }
39852
41211
  }
@@ -39902,6 +41261,8 @@ async function handleReadTool(toolName, args, client) {
39902
41261
  const summaryOnly = args.summary_only;
39903
41262
  const includeLegacyPaths = args.include_legacy_paths;
39904
41263
  const persistRefs = args.persist_refs;
41264
+ const limit = args.limit;
41265
+ const cursor = args.cursor;
39905
41266
  if ((postId === void 0 || postId === null) && !url3) {
39906
41267
  throw new Error("Either post_id or url is required");
39907
41268
  }
@@ -39917,7 +41278,9 @@ async function handleReadTool(toolName, args, client) {
39917
41278
  outline,
39918
41279
  summary_only: summaryOnly,
39919
41280
  include_legacy_paths: includeLegacyPaths,
39920
- ...persistRefs !== void 0 ? { persist_refs: persistRefs } : {}
41281
+ ...persistRefs !== void 0 ? { persist_refs: persistRefs } : {},
41282
+ ...limit !== void 0 ? { limit } : {},
41283
+ ...cursor !== void 0 ? { cursor } : {}
39921
41284
  });
39922
41285
  if (summaryOnly) {
39923
41286
  return {
@@ -39926,12 +41289,14 @@ async function handleReadTool(toolName, args, client) {
39926
41289
  };
39927
41290
  }
39928
41291
  const enriched = enrichBlockList(response.blocks || []);
41292
+ const pagination = response.pagination;
39929
41293
  return {
39930
41294
  post_id: postId,
39931
41295
  summary: response.summary,
39932
41296
  blocks: enriched.blocks,
39933
41297
  block_count: enriched.blocks.length,
39934
- warnings: enriched.warnings
41298
+ warnings: enriched.warnings,
41299
+ ...pagination !== void 0 ? { pagination } : {}
39935
41300
  };
39936
41301
  }
39937
41302
  case "get_block": {
@@ -43999,7 +45364,7 @@ function mark(values, key2, value) {
43999
45364
  }
44000
45365
 
44001
45366
  // node_modules/property-information/lib/util/create.js
44002
- function create(definition) {
45367
+ function create2(definition) {
44003
45368
  const properties = {};
44004
45369
  const normals = {};
44005
45370
  for (const [property, value] of Object.entries(definition.properties)) {
@@ -44020,7 +45385,7 @@ function create(definition) {
44020
45385
  }
44021
45386
 
44022
45387
  // node_modules/property-information/lib/aria.js
44023
- var aria = create({
45388
+ var aria = create2({
44024
45389
  properties: {
44025
45390
  ariaActiveDescendant: null,
44026
45391
  ariaAtomic: booleanish,
@@ -44088,7 +45453,7 @@ function caseInsensitiveTransform(attributes, property) {
44088
45453
  }
44089
45454
 
44090
45455
  // node_modules/property-information/lib/html.js
44091
- var html = create({
45456
+ var html = create2({
44092
45457
  attributes: {
44093
45458
  acceptcharset: "accept-charset",
44094
45459
  classname: "class",
@@ -44452,7 +45817,7 @@ var html = create({
44452
45817
  });
44453
45818
 
44454
45819
  // node_modules/property-information/lib/svg.js
44455
- var svg = create({
45820
+ var svg = create2({
44456
45821
  attributes: {
44457
45822
  accentHeight: "accent-height",
44458
45823
  alignmentBaseline: "alignment-baseline",
@@ -45014,7 +46379,7 @@ var svg = create({
45014
46379
  });
45015
46380
 
45016
46381
  // node_modules/property-information/lib/xlink.js
45017
- var xlink = create({
46382
+ var xlink = create2({
45018
46383
  properties: {
45019
46384
  xLinkActuate: null,
45020
46385
  xLinkArcRole: null,
@@ -45031,7 +46396,7 @@ var xlink = create({
45031
46396
  });
45032
46397
 
45033
46398
  // node_modules/property-information/lib/xmlns.js
45034
- var xmlns = create({
46399
+ var xmlns = create2({
45035
46400
  attributes: { xmlnsxlink: "xmlns:xlink" },
45036
46401
  properties: { xmlnsXLink: null, xmlns: null },
45037
46402
  space: "xmlns",
@@ -45039,7 +46404,7 @@ var xmlns = create({
45039
46404
  });
45040
46405
 
45041
46406
  // node_modules/property-information/lib/xml.js
45042
- var xml = create({
46407
+ var xml = create2({
45043
46408
  properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
45044
46409
  space: "xml",
45045
46410
  transform(_3, property) {
@@ -45088,15 +46453,15 @@ var html2 = merge3([aria, html, xlink, xmlns, xml], "html");
45088
46453
  var svg2 = merge3([aria, svg, xlink, xmlns, xml], "svg");
45089
46454
 
45090
46455
  // node_modules/zwitch/index.js
45091
- var own = {}.hasOwnProperty;
46456
+ var own2 = {}.hasOwnProperty;
45092
46457
  function zwitch(key2, options) {
45093
46458
  const settings = options || {};
45094
46459
  function one2(value, ...parameters) {
45095
46460
  let fn = one2.invalid;
45096
46461
  const handlers = one2.handlers;
45097
- if (value && own.call(value, key2)) {
46462
+ if (value && own2.call(value, key2)) {
45098
46463
  const id = String(value[key2]);
45099
- fn = own.call(handlers, id) ? handlers[id] : one2.unknown;
46464
+ fn = own2.call(handlers, id) ? handlers[id] : one2.unknown;
45100
46465
  }
45101
46466
  if (fn) {
45102
46467
  return fn.call(this, value, ...parameters);
@@ -45551,18 +46916,18 @@ var dangerous = [
45551
46916
  ];
45552
46917
 
45553
46918
  // node_modules/stringify-entities/lib/util/to-named.js
45554
- var own2 = {}.hasOwnProperty;
46919
+ var own3 = {}.hasOwnProperty;
45555
46920
  var characters = {};
45556
46921
  var key;
45557
46922
  for (key in characterEntitiesHtml4) {
45558
- if (own2.call(characterEntitiesHtml4, key)) {
46923
+ if (own3.call(characterEntitiesHtml4, key)) {
45559
46924
  characters[characterEntitiesHtml4[key]] = key;
45560
46925
  }
45561
46926
  }
45562
46927
  var notAlphanumericRegex = /[^\dA-Za-z]/;
45563
46928
  function toNamed(code, next, omit2, attribute) {
45564
46929
  const character = String.fromCharCode(code);
45565
- if (own2.call(characters, character)) {
46930
+ if (own3.call(characters, character)) {
45566
46931
  const name = characters[character];
45567
46932
  const value = "&" + name;
45568
46933
  if (omit2 && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
@@ -45684,11 +47049,11 @@ function siblings(increment2) {
45684
47049
  }
45685
47050
 
45686
47051
  // node_modules/hast-util-to-html/lib/omission/omission.js
45687
- var own3 = {}.hasOwnProperty;
47052
+ var own4 = {}.hasOwnProperty;
45688
47053
  function omission(handlers) {
45689
47054
  return omit2;
45690
47055
  function omit2(node, index, parent) {
45691
- return own3.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
47056
+ return own4.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
45692
47057
  }
45693
47058
  }
45694
47059
 
@@ -50914,7 +52279,7 @@ var WRITE_TOOLS = [
50914
52279
  },
50915
52280
  {
50916
52281
  name: "insert_blocks",
50917
- description: 'Insert blocks at a top-level position. Anchoring options (use one): `after_ref`/`before_ref` (stable gk_ref \u2014 recommended), or `after_top_level`/`before_top_level` (top_level_counter). Omit anchors or set after_top_level:-1 to append; "start" prepends. Legacy-tier blocks rejected per the site policy. Blocks whose attribute schema is HTML-sourced (e.g. core/paragraph `content`, core/image `url`) must include `innerHTML` matching the attribute(s) \u2014 attribute-only inserts are rejected with `inner_html_required` to prevent the self-closing-block / "invalid content" failure mode. Response.inserted[] carries `ref`, `path`, and `top_level_counter` so you can chain edit_block_tree without re-reading.',
52282
+ description: "Insert top-level blocks into a post.\n\nPOSITIONING \u2014 use exactly ONE anchor (any other key, e.g. `after`, `before`, `position`, is rejected):\n- `before_ref` / `after_ref` \u2014 gk_ref from get_page_blocks. Recommended: refs survive sibling shifts.\n- `before_top_level` / `after_top_level` \u2014 top_level_counter position.\n- Prepend at the very top: `before_top_level: 0`. Append at the end: omit all anchors.\n\nCONTENT \u2014 legacy-tier blocks are rejected per the site policy. Blocks with HTML-sourced attributes (e.g. core/paragraph `content`, core/image `url`) must include matching `innerHTML`; attribute-only inserts fail with `inner_html_required`.\n\nVERIFY \u2014 the response's inserted[] returns `ref`, `path`, and `top_level_counter`: confirm the block landed where you intended before moving on. The refs let you chain edit_block_tree without re-reading.",
50918
52283
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true, title: "Insert blocks" },
50919
52284
  outputSchema: INSERTED_REFS_SCHEMA,
50920
52285
  inputSchema: {
@@ -50923,7 +52288,7 @@ var WRITE_TOOLS = [
50923
52288
  post_id: { type: "number", description: "Post ID." },
50924
52289
  after_top_level: {
50925
52290
  type: ["number", "string"],
50926
- description: 'top_level_counter to insert AFTER. -1/omit = append, "start" = prepend.'
52291
+ description: "top_level_counter to insert AFTER (omit or -1 = append). To prepend at the very top, prefer `before_top_level: 0`."
50927
52292
  },
50928
52293
  before_top_level: {
50929
52294
  type: "number",
@@ -50939,7 +52304,7 @@ var WRITE_TOOLS = [
50939
52304
  },
50940
52305
  blocks: {
50941
52306
  type: "array",
50942
- description: "Blocks to insert.",
52307
+ description: "Blocks to insert. Each def nests recursively via `innerBlocks` \u2014 build a whole container (group/columns/callout) with its children in this one call; give the container its empty wrapper `innerHTML` (e.g. '<div class=\"wp-block-group\"></div>').",
50943
52308
  items: BLOCK_INPUT_SCHEMA
50944
52309
  }
50945
52310
  },
@@ -50981,7 +52346,7 @@ var WRITE_TOOLS = [
50981
52346
  post_id: { type: "number", description: "Post ID." },
50982
52347
  start: { type: "number", description: "top_level_counter of first block to replace." },
50983
52348
  count: { type: "number", description: "How many top-level blocks to remove. Pass 0 to insert without removing." },
50984
- blocks: { type: "array", description: "Replacement blocks. May be empty (pure delete) or any length.", items: BLOCK_INPUT_SCHEMA }
52349
+ blocks: { type: "array", description: "Replacement blocks. May be empty (pure delete) or any length. Each def nests recursively via `innerBlocks` for containers (group/columns/callout) \u2014 give the container its empty wrapper `innerHTML`.", items: BLOCK_INPUT_SCHEMA }
50985
52350
  },
50986
52351
  required: ["post_id", "start", "count", "blocks"]
50987
52352
  }
@@ -51018,7 +52383,7 @@ var WRITE_TOOLS = [
51018
52383
  type: "object",
51019
52384
  properties: {
51020
52385
  post_id: { type: "number", description: "Post ID." },
51021
- blocks: { type: "array", description: "Complete blocks array (replaces all).", items: BLOCK_INPUT_SCHEMA }
52386
+ blocks: { type: "array", description: "Complete blocks array (replaces all). Each def nests recursively via `innerBlocks` for containers (group/columns/callout) \u2014 give the container its empty wrapper `innerHTML`.", items: BLOCK_INPUT_SCHEMA }
51022
52387
  },
51023
52388
  required: ["post_id", "blocks"]
51024
52389
  }
@@ -51306,14 +52671,8 @@ var MUTATE_TOOLS = [{
51306
52671
  attributes: { type: "object", description: "update-attrs: attributes to merge." },
51307
52672
  innerHTML: { type: "string", description: "update-html: replacement innerHTML." },
51308
52673
  block: {
51309
- type: "object",
51310
- description: "replace-block / insert-child: { name, attributes?, innerHTML?, innerBlocks? }.",
51311
- properties: {
51312
- name: { type: "string", description: "Fully-qualified block name." },
51313
- attributes: { type: "object" },
51314
- innerHTML: { type: "string" },
51315
- innerBlocks: { type: "array" }
51316
- }
52674
+ ...BLOCK_INPUT_SCHEMA,
52675
+ description: "replace-block / insert-child: a block def. Nests recursively via `innerBlocks`; containers need their empty wrapper `innerHTML`."
51317
52676
  },
51318
52677
  wrapper: {
51319
52678
  type: "object",
@@ -51558,8 +52917,8 @@ async function handlePostTool(toolName, args, client) {
51558
52917
  if (args.content !== void 0 && Array.isArray(args.blocks)) {
51559
52918
  throw new Error('create_post: "content" and "blocks" are mutually exclusive');
51560
52919
  }
51561
- const create2 = narrowCreatePost(args);
51562
- return client.createPost(create2);
52920
+ const create3 = narrowCreatePost(args);
52921
+ return client.createPost(create3);
51563
52922
  }
51564
52923
  case "update_post": {
51565
52924
  if (typeof args.post_id !== "number") {
@@ -51927,6 +53286,148 @@ function narrowYoastFields(input) {
51927
53286
  return out;
51928
53287
  }
51929
53288
 
53289
+ // src/validate-args.ts
53290
+ function validateToolArgs(toolName, inputSchema, args) {
53291
+ const properties = inputSchema?.properties;
53292
+ if (!properties) {
53293
+ return;
53294
+ }
53295
+ const known = Object.keys(properties);
53296
+ const provided = Object.keys(args ?? {});
53297
+ const allowsExtra = inputSchema?.additionalProperties !== void 0 && inputSchema.additionalProperties !== false;
53298
+ if (!allowsExtra) {
53299
+ const unknown3 = provided.filter((k3) => !known.includes(k3));
53300
+ if (unknown3.length > 0) {
53301
+ const parts = unknown3.map((k3) => {
53302
+ const near = closestKey(k3, known);
53303
+ return near ? `'${k3}' (did you mean '${near}'?)` : `'${k3}'`;
53304
+ });
53305
+ throw new Error(
53306
+ `Unknown parameter(s) for ${toolName}: ${parts.join(", ")}. Valid parameters: ${known.join(", ")}.`
53307
+ );
53308
+ }
53309
+ }
53310
+ const required2 = inputSchema?.required ?? [];
53311
+ const missing = required2.filter((r4) => !(r4 in (args ?? {})));
53312
+ if (missing.length > 0) {
53313
+ throw new Error(`Missing required parameter(s) for ${toolName}: ${missing.join(", ")}.`);
53314
+ }
53315
+ }
53316
+ function closestKey(input, candidates) {
53317
+ const lc = input.toLowerCase();
53318
+ const affixed = candidates.filter((c) => {
53319
+ const cl = c.toLowerCase();
53320
+ return cl.startsWith(lc) || lc.startsWith(cl) || cl.includes(lc) || lc.includes(cl);
53321
+ }).sort((a2, b3) => a2.length - b3.length);
53322
+ if (affixed.length > 0) {
53323
+ return affixed[0];
53324
+ }
53325
+ let best = null;
53326
+ let bestDist = Infinity;
53327
+ for (const c of candidates) {
53328
+ const d2 = levenshtein(lc, c.toLowerCase());
53329
+ if (d2 < bestDist) {
53330
+ bestDist = d2;
53331
+ best = c;
53332
+ }
53333
+ }
53334
+ return best !== null && bestDist <= Math.max(2, Math.ceil(input.length / 2)) ? best : null;
53335
+ }
53336
+ function levenshtein(a2, b3) {
53337
+ const m3 = a2.length;
53338
+ const n = b3.length;
53339
+ if (m3 === 0) return n;
53340
+ if (n === 0) return m3;
53341
+ let prev = Array.from({ length: n + 1 }, (_3, i2) => i2);
53342
+ let curr = new Array(n + 1);
53343
+ for (let i2 = 1; i2 <= m3; i2++) {
53344
+ curr[0] = i2;
53345
+ for (let j2 = 1; j2 <= n; j2++) {
53346
+ const cost = a2[i2 - 1] === b3[j2 - 1] ? 0 : 1;
53347
+ curr[j2] = Math.min(prev[j2] + 1, curr[j2 - 1] + 1, prev[j2 - 1] + cost);
53348
+ }
53349
+ [prev, curr] = [curr, prev];
53350
+ }
53351
+ return prev[n];
53352
+ }
53353
+
53354
+ // src/agent-guide.ts
53355
+ var AGENT_GUIDE_CONTENT = `# Block MCP \u2014 Agent Guide
53356
+
53357
+ ## URL \u2192 post ID resolution
53358
+
53359
+ NEVER run curl, wget, or any bash/shell command to hit wp-json or resolve a URL to a post ID.
53360
+ The MCP does this for you:
53361
+
53362
+ - \`get_page_blocks\` accepts \`url\` as an alternative to \`post_id\`. Pass the full URL or path; the server resolves it via \`url_to_postid\`.
53363
+ - For explicit resolution (title, post_type, edit_url before editing), call \`resolve_url\`.
53364
+
53365
+ If the user says "change X on https://example.com/some-page/", your first tool call should be \`get_page_blocks({ url: "...", search: "keyword" })\` or \`resolve_url({ url: "..." })\` \u2014 not a shell command.
53366
+
53367
+ ## Moving / reordering blocks
53368
+
53369
+ NEVER do a move as separate \`insert_blocks\` + \`delete_block\` calls \u2014 if the delete is skipped or fails, the page ends up with an orphaned clone of the original. The atomic primitive is the \`move\` op on \`edit_block_tree\`:
53370
+
53371
+ - Target the source with \`ref\` (the \`gk_ref\` from \`get_page_blocks\`) or \`path\`. Prefer \`ref\` \u2014 it survives sibling shifts; paths go stale the moment any earlier block is inserted or removed.
53372
+ - Express the destination with \`destination_ref\` or \`destination\` (path). For path destinations, use **pre-move** indexing \u2014 write the path as if the source were still in place; the server adjusts indices after the removal.
53373
+ - Use \`count\` to move N consecutive siblings in a single op.
53374
+ - The server rejects moves into the source itself or any of its descendants.
53375
+ - The whole \`edit_block_tree\` call is one revision, reversible via \`revert_to_revision\`.
53376
+
53377
+ If you must fall back to the flat-index tools, do \`insert_blocks\` + \`delete_block\` in the same turn and re-fetch \`get_page_blocks\` afterward to confirm exactly one copy remains.
53378
+
53379
+ ## Building container blocks (groups, columns, callouts)
53380
+
53381
+ Every block def accepted by \`insert_blocks\`, \`replace_block_range\`, and \`rewrite_post_blocks\` nests recursively via \`innerBlocks\` \u2014 build a whole container (and its children) in ONE call instead of inserting pieces and moving them around.
53382
+
53383
+ - The container's \`innerHTML\` is its wrapper element only \u2014 an empty wrapper; children render inside it. E.g. \`core/group\` \u2192 \`<div class="wp-block-group"></div>\`, \`core/list\` \u2192 \`<ul class="wp-block-list"></ul>\`.
53384
+ - Each entry in \`innerBlocks\` is a full block def and may nest further (columns \u2192 column \u2192 content).
53385
+ - Include any style class in BOTH the \`className\` attribute and the wrapper \`innerHTML\`.
53386
+
53387
+ Example \u2014 a styled callout (a \`core/group\` wrapping a paragraph):
53388
+
53389
+ \`\`\`json
53390
+ {
53391
+ "name": "core/group",
53392
+ "attributes": { "className": "is-style-callout-info", "layout": { "type": "constrained" } },
53393
+ "innerHTML": "<div class=\\"wp-block-group is-style-callout-info\\"></div>",
53394
+ "innerBlocks": [
53395
+ { "name": "core/paragraph", "innerHTML": "<p>Tip text here.</p>" }
53396
+ ]
53397
+ }
53398
+ \`\`\`
53399
+
53400
+ Site-specific style conventions (e.g. callout class names) come from this site's instructions addendum \u2014 prefer those over inventing classes.
53401
+
53402
+ ## Verifying writes
53403
+
53404
+ Every write echoes the canonical post-save snapshot. Use it. Do not fetch the public page to verify what saved.
53405
+
53406
+ - \`update_block\` always returns \`saved.inner_html\` + \`saved.attributes\` \u2014 the exact content that just landed in post_content. The write call IS the verification round-trip.
53407
+ - \`update_blocks\` returns per-result \`saved\` only when called with \`verbose: true\` (default false to keep batch responses compact). Pass \`verbose: true\` if you need to confirm each item without a re-read.
53408
+ - For after-the-fact re-reads of a single known block, use \`get_block({ post_id, ref })\` \u2014 returns the same \`saved\` shape, lighter than \`get_page_blocks\`.
53409
+
53410
+ For dynamic blocks (\`saved.is_dynamic: true\`, e.g. shortcodes, query loops, latest-posts), \`saved.inner_html\` is the stored template that runs at render time \u2014 not the rendered HTML the visitor sees. That's expected; the canonical state is the template.
53411
+
53412
+ ## Block preferences (site-defined)
53413
+
53414
+ Block preference policy is configured per-site in the WordPress admin (the
53415
+ gk-block-api Preferences option) and exposed dynamically. There is no
53416
+ client-side hardcoded list of "good" vs "bad" namespaces.
53417
+
53418
+ How to discover the policy at runtime:
53419
+
53420
+ 1. \`list_block_types\` returns blocks grouped by tier (PREFERRED / ACCEPTABLE / AVOID / LEGACY) for the current site. Use this when you need the full picture.
53421
+ 2. \`get_page_blocks\` annotates non-preferred blocks inline with \`preference.tier\` and (when configured) \`preference.suggested_replacement\`. Trust those fields \u2014 they reflect the live config.
53422
+ 3. \`insert_blocks\` rejects legacy-tier blocks with a \`legacy_block\` error that includes the rejected namespace, the suggested replacement, and a pointer back to this resource.
53423
+
53424
+ How to behave:
53425
+
53426
+ - Prefer the highest-tier blocks for new content. Defer to the server's classification rather than guessing from a namespace prefix.
53427
+ - Reuse existing patterns before building from scratch \u2014 call \`list_patterns\` first.
53428
+ - For patterns that need per-page customization, use \`synced: false\` to inline them.
53429
+ - When you encounter legacy blocks on a page during a read, note them but do not replace unless asked.`;
53430
+
51930
53431
  // src/connect.ts
51931
53432
  var http3 = __toESM(require("node:http"), 1);
51932
53433
  var crypto2 = __toESM(require("node:crypto"), 1);
@@ -51937,7 +53438,6 @@ var cp2 = __toESM(require("node:child_process"), 1);
51937
53438
  var VALID_CLIENTS = [
51938
53439
  "claude-code",
51939
53440
  "cursor",
51940
- "chatgpt-desktop",
51941
53441
  "claude-desktop",
51942
53442
  "print"
51943
53443
  ];
@@ -52050,7 +53550,7 @@ function buildAuthorizeUrl(params) {
52050
53550
  const { site, callback, state, client } = params;
52051
53551
  const base = `${site}/wp-admin/options-general.php`;
52052
53552
  const query = new URLSearchParams({
52053
- page: "gk-block-api-settings",
53553
+ page: "gk-block-mcp-settings",
52054
53554
  tab: "connect",
52055
53555
  gk_authorize: "1",
52056
53556
  callback,
@@ -52089,6 +53589,25 @@ function parseExchangeResponse(json2) {
52089
53589
  return { site, user, password };
52090
53590
  }
52091
53591
  var EXCHANGE_FETCH_TIMEOUT_MS = 15e3;
53592
+ var TLS_TRUST_ERROR_CODES = /* @__PURE__ */ new Set([
53593
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
53594
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
53595
+ "SELF_SIGNED_CERT_IN_CHAIN",
53596
+ "UNABLE_TO_GET_ISSUER_CERT",
53597
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
53598
+ "CERT_UNTRUSTED"
53599
+ ]);
53600
+ var CA_TRUST_HINT = "The site's TLS certificate is not trusted by Node.js, which uses its own CA bundle rather than the operating system's trust store. If this is a local development site, re-run with NODE_EXTRA_CA_CERTS=<path to the root CA certificate (.pem) of the tool serving the site> \u2014 Laravel Herd/Valet, Local, OrbStack, and mkcert each keep one in their config directory. The variable is also copied into the generated MCP config so the server can reach the site too.";
53601
+ function describeExchangeFetchError(url3, err) {
53602
+ const error2 = err;
53603
+ const causeCode = typeof error2.cause?.code === "string" ? error2.cause.code : "";
53604
+ const causeMessage = typeof error2.cause?.message === "string" ? error2.cause.message : "";
53605
+ const detail = causeCode || causeMessage;
53606
+ const reason = detail ? `${error2.message}: ${detail}` : error2.message;
53607
+ const isTrustFailure = TLS_TRUST_ERROR_CODES.has(causeCode);
53608
+ const hint = isTrustFailure ? ` ${CA_TRUST_HINT}` : "";
53609
+ return `Exchange failed: could not reach ${url3} (${reason}).${hint}`;
53610
+ }
52092
53611
  async function exchangeCode(site, code, fetchFn = fetch, timeoutMs = EXCHANGE_FETCH_TIMEOUT_MS) {
52093
53612
  const origin2 = new URL(site).origin;
52094
53613
  let url3 = `${site}/?rest_route=/gk-block-api/v1/connect/exchange`;
@@ -52106,7 +53625,7 @@ async function exchangeCode(site, code, fetchFn = fetch, timeoutMs = EXCHANGE_FE
52106
53625
  signal: controller.signal
52107
53626
  });
52108
53627
  } catch (err) {
52109
- throw new Error(`Exchange failed: could not reach ${url3} (${err.message}).`);
53628
+ throw new Error(describeExchangeFetchError(url3, err));
52110
53629
  }
52111
53630
  if (res.status < 300 || res.status >= 400) {
52112
53631
  break;
@@ -52136,15 +53655,20 @@ async function exchangeCode(site, code, fetchFn = fetch, timeoutMs = EXCHANGE_FE
52136
53655
  }
52137
53656
  return parseExchangeResponse(json2);
52138
53657
  }
52139
- function buildMcpEntry(creds) {
53658
+ function buildMcpEntry(creds, extraCaCerts = process.env.NODE_EXTRA_CA_CERTS) {
53659
+ const env = {
53660
+ WORDPRESS_URL: creds.site,
53661
+ WORDPRESS_USER: creds.user,
53662
+ WORDPRESS_APP_PASSWORD: creds.password
53663
+ };
53664
+ const hasCaCerts = typeof extraCaCerts === "string" && extraCaCerts.trim() !== "";
53665
+ if (hasCaCerts) {
53666
+ env.NODE_EXTRA_CA_CERTS = extraCaCerts;
53667
+ }
52140
53668
  return {
52141
53669
  command: "npx",
52142
53670
  args: ["-y", "@gravitykit/block-mcp"],
52143
- env: {
52144
- WORDPRESS_URL: creds.site,
52145
- WORDPRESS_USER: creds.user,
52146
- WORDPRESS_APP_PASSWORD: creds.password
52147
- }
53671
+ env
52148
53672
  };
52149
53673
  }
52150
53674
  function mergeMcpServers(existing, creds, name = "block-mcp") {
@@ -52177,31 +53701,37 @@ function claudeDesktopConfigPath(platform) {
52177
53701
  function cursorConfigPath() {
52178
53702
  return path.join(os.homedir(), ".cursor", "mcp.json");
52179
53703
  }
52180
- function claudeCodeAddArgs(creds, name = "block-mcp") {
52181
- return [
52182
- "mcp",
52183
- "add",
52184
- name,
52185
- "--scope",
52186
- "user",
53704
+ function claudeCodeAddArgs(creds, name = "block-mcp", extraCaCerts = process.env.NODE_EXTRA_CA_CERTS) {
53705
+ const envArgs = [
52187
53706
  "--env",
52188
53707
  `WORDPRESS_URL=${creds.site}`,
52189
53708
  "--env",
52190
53709
  `WORDPRESS_USER=${creds.user}`,
52191
53710
  "--env",
52192
- `WORDPRESS_APP_PASSWORD=${creds.password}`,
52193
- "--",
52194
- "npx",
52195
- "-y",
52196
- "@gravitykit/block-mcp"
53711
+ `WORDPRESS_APP_PASSWORD=${creds.password}`
52197
53712
  ];
53713
+ const hasCaCerts = typeof extraCaCerts === "string" && extraCaCerts.trim() !== "";
53714
+ if (hasCaCerts) {
53715
+ envArgs.push("--env", `NODE_EXTRA_CA_CERTS=${extraCaCerts}`);
53716
+ }
53717
+ return ["mcp", "add", name, "--scope", "user", ...envArgs, "--", "npx", "-y", "@gravitykit/block-mcp"];
52198
53718
  }
52199
53719
  function readJsonFile(filePath, defaultValue) {
53720
+ let raw2;
53721
+ try {
53722
+ raw2 = fs.readFileSync(filePath, "utf8");
53723
+ } catch (err) {
53724
+ if (err.code === "ENOENT") {
53725
+ return defaultValue;
53726
+ }
53727
+ throw err;
53728
+ }
52200
53729
  try {
52201
- const raw2 = fs.readFileSync(filePath, "utf8");
52202
53730
  return JSON.parse(raw2);
52203
- } catch {
52204
- return defaultValue;
53731
+ } catch (err) {
53732
+ throw new Error(
53733
+ `Could not parse the existing MCP config at ${filePath}: ${err.message}. Fix or remove the file, then re-run connect \u2014 refusing to overwrite it.`
53734
+ );
52205
53735
  }
52206
53736
  }
52207
53737
  function writeJsonFile(filePath, data) {
@@ -52420,13 +53950,6 @@ Fall back \u2014 add this to your Claude Code MCP config manually:`);
52420
53950
  }
52421
53951
  break;
52422
53952
  }
52423
- case "chatgpt-desktop": {
52424
- console.log(`
52425
- \u2713 Authorized! Paste the following into ChatGPT Desktop's MCP config:
52426
- `);
52427
- printConfig(creds, true, args.name);
52428
- break;
52429
- }
52430
53953
  case "print":
52431
53954
  default:
52432
53955
  printConfig(creds, args.reveal, args.name);
@@ -52479,58 +54002,6 @@ for (const { tools, handle: handle2 } of TOOL_GROUPS) {
52479
54002
  }
52480
54003
  var AGENT_GUIDE_RESOURCE_URI = "block-mcp://agent-guide";
52481
54004
  var LEGACY_PREFERENCES_RESOURCE_URI = "block-mcp://block-preferences";
52482
- var AGENT_GUIDE_CONTENT = `# Block MCP \u2014 Agent Guide
52483
-
52484
- ## URL \u2192 post ID resolution
52485
-
52486
- NEVER run curl, wget, or any bash/shell command to hit wp-json or resolve a URL to a post ID.
52487
- The MCP does this for you:
52488
-
52489
- - \`get_page_blocks\` accepts \`url\` as an alternative to \`post_id\`. Pass the full URL or path; the server resolves it via \`url_to_postid\`.
52490
- - For explicit resolution (title, post_type, edit_url before editing), call \`resolve_url\`.
52491
-
52492
- If the user says "change X on https://example.com/some-page/", your first tool call should be \`get_page_blocks({ url: "...", search: "keyword" })\` or \`resolve_url({ url: "..." })\` \u2014 not a shell command.
52493
-
52494
- ## Moving / reordering blocks
52495
-
52496
- NEVER do a move as separate \`insert_blocks\` + \`delete_block\` calls \u2014 if the delete is skipped or fails, the page ends up with an orphaned clone of the original. The atomic primitive is the \`move\` op on \`edit_block_tree\`:
52497
-
52498
- - Target the source with \`ref\` (the \`gk_ref\` from \`get_page_blocks\`) or \`path\`. Prefer \`ref\` \u2014 it survives sibling shifts; paths go stale the moment any earlier block is inserted or removed.
52499
- - Express the destination with \`destination_ref\` or \`destination\` (path). For path destinations, use **pre-move** indexing \u2014 write the path as if the source were still in place; the server adjusts indices after the removal.
52500
- - Use \`count\` to move N consecutive siblings in a single op.
52501
- - The server rejects moves into the source itself or any of its descendants.
52502
- - The whole \`edit_block_tree\` call is one revision, reversible via \`revert_to_revision\`.
52503
-
52504
- If you must fall back to the flat-index tools, do \`insert_blocks\` + \`delete_block\` in the same turn and re-fetch \`get_page_blocks\` afterward to confirm exactly one copy remains.
52505
-
52506
- ## Verifying writes
52507
-
52508
- Every write echoes the canonical post-save snapshot. Use it. Do not fetch the public page to verify what saved.
52509
-
52510
- - \`update_block\` always returns \`saved.inner_html\` + \`saved.attributes\` \u2014 the exact content that just landed in post_content. The write call IS the verification round-trip.
52511
- - \`update_blocks\` returns per-result \`saved\` only when called with \`verbose: true\` (default false to keep batch responses compact). Pass \`verbose: true\` if you need to confirm each item without a re-read.
52512
- - For after-the-fact re-reads of a single known block, use \`get_block({ post_id, ref })\` \u2014 returns the same \`saved\` shape, lighter than \`get_page_blocks\`.
52513
-
52514
- For dynamic blocks (\`saved.is_dynamic: true\`, e.g. shortcodes, query loops, latest-posts), \`saved.inner_html\` is the stored template that runs at render time \u2014 not the rendered HTML the visitor sees. That's expected; the canonical state is the template.
52515
-
52516
- ## Block preferences (site-defined)
52517
-
52518
- Block preference policy is configured per-site in the WordPress admin (the
52519
- gk-block-api Preferences option) and exposed dynamically. There is no
52520
- client-side hardcoded list of "good" vs "bad" namespaces.
52521
-
52522
- How to discover the policy at runtime:
52523
-
52524
- 1. \`list_block_types\` returns blocks grouped by tier (PREFERRED / ACCEPTABLE / AVOID / LEGACY) for the current site. Use this when you need the full picture.
52525
- 2. \`get_page_blocks\` annotates non-preferred blocks inline with \`preference.tier\` and (when configured) \`preference.suggested_replacement\`. Trust those fields \u2014 they reflect the live config.
52526
- 3. \`insert_blocks\` rejects legacy-tier blocks with a \`legacy_block\` error that includes the rejected namespace, the suggested replacement, and a pointer back to this resource.
52527
-
52528
- How to behave:
52529
-
52530
- - Prefer the highest-tier blocks for new content. Defer to the server's classification rather than guessing from a namespace prefix.
52531
- - Reuse existing patterns before building from scratch \u2014 call \`list_patterns\` first.
52532
- - For patterns that need per-page customization, use \`synced: false\` to inline them.
52533
- - When you encounter legacy blocks on a page during a read, note them but do not replace unless asked.`;
52534
54005
  function registerHandlers(server, client) {
52535
54006
  server.server.setRequestHandler(ListToolsRequestSchema, async () => {
52536
54007
  return { tools: ALL_TOOLS };
@@ -52543,6 +54014,8 @@ function registerHandlers(server, client) {
52543
54014
  if (!handle2) {
52544
54015
  throw new Error(`Unknown tool: ${name}`);
52545
54016
  }
54017
+ const def = ALL_TOOLS.find((t) => t.name === name);
54018
+ validateToolArgs(name, def?.inputSchema, toolArgs);
52546
54019
  const result = await handle2(name, toolArgs, client);
52547
54020
  const toolDef = ALL_TOOLS.find((t) => t.name === name);
52548
54021
  const response = {