@fre4x/arxiv 1.1.2 → 1.1.6

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.
Files changed (3) hide show
  1. package/README.md +10 -10
  2. package/dist/index.js +900 -1663
  3. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -13,7 +13,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
15
  var __commonJS = (cb, mod) => function __require2() {
16
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ try {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ } catch (e) {
19
+ throw mod = 0, e;
20
+ }
17
21
  };
18
22
  var __export = (target, all3) => {
19
23
  for (var name in all3)
@@ -3112,6 +3116,9 @@ var require_utils = __commonJS({
3112
3116
  "use strict";
3113
3117
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3114
3118
  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);
3119
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3120
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3121
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3115
3122
  function stringArrayToHexStripped(input) {
3116
3123
  let acc = "";
3117
3124
  let code = 0;
@@ -3304,27 +3311,77 @@ var require_utils = __commonJS({
3304
3311
  }
3305
3312
  return output.join("");
3306
3313
  }
3307
- function normalizeComponentEncoding(component, esc2) {
3308
- const func = esc2 !== true ? escape : unescape;
3309
- if (component.scheme !== void 0) {
3310
- component.scheme = func(component.scheme);
3311
- }
3312
- if (component.userinfo !== void 0) {
3313
- component.userinfo = func(component.userinfo);
3314
- }
3315
- if (component.host !== void 0) {
3316
- component.host = func(component.host);
3314
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3315
+ var HOST_DELIM_RE = /[@/?#:]/g;
3316
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
3317
+ function reescapeHostDelimiters(host, isIP) {
3318
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
3319
+ re.lastIndex = 0;
3320
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
3321
+ }
3322
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
3323
+ if (input.indexOf("%") === -1) {
3324
+ return input;
3317
3325
  }
3318
- if (component.path !== void 0) {
3319
- component.path = func(component.path);
3326
+ let output = "";
3327
+ for (let i = 0; i < input.length; i++) {
3328
+ if (input[i] === "%" && i + 2 < input.length) {
3329
+ const hex3 = input.slice(i + 1, i + 3);
3330
+ if (isHexPair(hex3)) {
3331
+ const normalizedHex = hex3.toUpperCase();
3332
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3333
+ if (decodeUnreserved && isUnreserved(decoded)) {
3334
+ output += decoded;
3335
+ } else {
3336
+ output += "%" + normalizedHex;
3337
+ }
3338
+ i += 2;
3339
+ continue;
3340
+ }
3341
+ }
3342
+ output += input[i];
3320
3343
  }
3321
- if (component.query !== void 0) {
3322
- component.query = func(component.query);
3344
+ return output;
3345
+ }
3346
+ function normalizePathEncoding(input) {
3347
+ let output = "";
3348
+ for (let i = 0; i < input.length; i++) {
3349
+ if (input[i] === "%" && i + 2 < input.length) {
3350
+ const hex3 = input.slice(i + 1, i + 3);
3351
+ if (isHexPair(hex3)) {
3352
+ const normalizedHex = hex3.toUpperCase();
3353
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3354
+ if (decoded !== "." && isUnreserved(decoded)) {
3355
+ output += decoded;
3356
+ } else {
3357
+ output += "%" + normalizedHex;
3358
+ }
3359
+ i += 2;
3360
+ continue;
3361
+ }
3362
+ }
3363
+ if (isPathCharacter(input[i])) {
3364
+ output += input[i];
3365
+ } else {
3366
+ output += escape(input[i]);
3367
+ }
3323
3368
  }
3324
- if (component.fragment !== void 0) {
3325
- component.fragment = func(component.fragment);
3369
+ return output;
3370
+ }
3371
+ function escapePreservingEscapes(input) {
3372
+ let output = "";
3373
+ for (let i = 0; i < input.length; i++) {
3374
+ if (input[i] === "%" && i + 2 < input.length) {
3375
+ const hex3 = input.slice(i + 1, i + 3);
3376
+ if (isHexPair(hex3)) {
3377
+ output += "%" + hex3.toUpperCase();
3378
+ i += 2;
3379
+ continue;
3380
+ }
3381
+ }
3382
+ output += escape(input[i]);
3326
3383
  }
3327
- return component;
3384
+ return output;
3328
3385
  }
3329
3386
  function recomposeAuthority(component) {
3330
3387
  const uriTokens = [];
@@ -3339,7 +3396,7 @@ var require_utils = __commonJS({
3339
3396
  if (ipV6res.isIPV6 === true) {
3340
3397
  host = `[${ipV6res.escapedHost}]`;
3341
3398
  } else {
3342
- host = component.host;
3399
+ host = reescapeHostDelimiters(host, false);
3343
3400
  }
3344
3401
  }
3345
3402
  uriTokens.push(host);
@@ -3353,7 +3410,10 @@ var require_utils = __commonJS({
3353
3410
  module.exports = {
3354
3411
  nonSimpleDomain,
3355
3412
  recomposeAuthority,
3356
- normalizeComponentEncoding,
3413
+ reescapeHostDelimiters,
3414
+ normalizePercentEncoding,
3415
+ normalizePathEncoding,
3416
+ escapePreservingEscapes,
3357
3417
  removeDotSegments,
3358
3418
  isIPv4,
3359
3419
  isUUID,
@@ -3577,12 +3637,12 @@ var require_schemes = __commonJS({
3577
3637
  var require_fast_uri = __commonJS({
3578
3638
  "../node_modules/fast-uri/index.js"(exports2, module) {
3579
3639
  "use strict";
3580
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
3640
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3581
3641
  var { SCHEMES, getSchemeHandler } = require_schemes();
3582
3642
  function normalize(uri, options) {
3583
3643
  if (typeof uri === "string") {
3584
3644
  uri = /** @type {T} */
3585
- serialize(parse3(uri, options), options);
3645
+ normalizeString(uri, options);
3586
3646
  } else if (typeof uri === "object") {
3587
3647
  uri = /** @type {T} */
3588
3648
  parse3(serialize(uri, options), options);
@@ -3649,19 +3709,9 @@ var require_fast_uri = __commonJS({
3649
3709
  return target;
3650
3710
  }
3651
3711
  function equal(uriA, uriB, options) {
3652
- if (typeof uriA === "string") {
3653
- uriA = unescape(uriA);
3654
- uriA = serialize(normalizeComponentEncoding(parse3(uriA, options), true), { ...options, skipEscape: true });
3655
- } else if (typeof uriA === "object") {
3656
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
3657
- }
3658
- if (typeof uriB === "string") {
3659
- uriB = unescape(uriB);
3660
- uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), { ...options, skipEscape: true });
3661
- } else if (typeof uriB === "object") {
3662
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
3663
- }
3664
- return uriA.toLowerCase() === uriB.toLowerCase();
3712
+ const normalizedA = normalizeComparableURI(uriA, options);
3713
+ const normalizedB = normalizeComparableURI(uriB, options);
3714
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3665
3715
  }
3666
3716
  function serialize(cmpts, opts) {
3667
3717
  const component = {
@@ -3686,12 +3736,12 @@ var require_fast_uri = __commonJS({
3686
3736
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3687
3737
  if (component.path !== void 0) {
3688
3738
  if (!options.skipEscape) {
3689
- component.path = escape(component.path);
3739
+ component.path = escapePreservingEscapes(component.path);
3690
3740
  if (component.scheme !== void 0) {
3691
3741
  component.path = component.path.split("%3A").join(":");
3692
3742
  }
3693
3743
  } else {
3694
- component.path = unescape(component.path);
3744
+ component.path = normalizePercentEncoding(component.path);
3695
3745
  }
3696
3746
  }
3697
3747
  if (options.reference !== "suffix" && component.scheme) {
@@ -3726,7 +3776,16 @@ var require_fast_uri = __commonJS({
3726
3776
  return uriTokens.join("");
3727
3777
  }
3728
3778
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3729
- function parse3(uri, opts) {
3779
+ function getParseError(parsed, matches) {
3780
+ if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3781
+ return 'URI path must start with "/" when authority is present.';
3782
+ }
3783
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
3784
+ return "URI port is malformed.";
3785
+ }
3786
+ return void 0;
3787
+ }
3788
+ function parseWithStatus(uri, opts) {
3730
3789
  const options = Object.assign({}, opts);
3731
3790
  const parsed = {
3732
3791
  scheme: void 0,
@@ -3737,6 +3796,7 @@ var require_fast_uri = __commonJS({
3737
3796
  query: void 0,
3738
3797
  fragment: void 0
3739
3798
  };
3799
+ let malformedAuthorityOrPort = false;
3740
3800
  let isIP = false;
3741
3801
  if (options.reference === "suffix") {
3742
3802
  if (options.scheme) {
@@ -3757,6 +3817,11 @@ var require_fast_uri = __commonJS({
3757
3817
  if (isNaN(parsed.port)) {
3758
3818
  parsed.port = matches[5];
3759
3819
  }
3820
+ const parseError = getParseError(parsed, matches);
3821
+ if (parseError !== void 0) {
3822
+ parsed.error = parsed.error || parseError;
3823
+ malformedAuthorityOrPort = true;
3824
+ }
3760
3825
  if (parsed.host) {
3761
3826
  const ipv4result = isIPv4(parsed.host);
3762
3827
  if (ipv4result === false) {
@@ -3795,14 +3860,18 @@ var require_fast_uri = __commonJS({
3795
3860
  parsed.scheme = unescape(parsed.scheme);
3796
3861
  }
3797
3862
  if (parsed.host !== void 0) {
3798
- parsed.host = unescape(parsed.host);
3863
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3799
3864
  }
3800
3865
  }
3801
3866
  if (parsed.path) {
3802
- parsed.path = escape(unescape(parsed.path));
3867
+ parsed.path = normalizePathEncoding(parsed.path);
3803
3868
  }
3804
3869
  if (parsed.fragment) {
3805
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3870
+ try {
3871
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3872
+ } catch {
3873
+ parsed.error = parsed.error || "URI malformed";
3874
+ }
3806
3875
  }
3807
3876
  }
3808
3877
  if (schemeHandler && schemeHandler.parse) {
@@ -3811,7 +3880,29 @@ var require_fast_uri = __commonJS({
3811
3880
  } else {
3812
3881
  parsed.error = parsed.error || "URI can not be parsed.";
3813
3882
  }
3814
- return parsed;
3883
+ return { parsed, malformedAuthorityOrPort };
3884
+ }
3885
+ function parse3(uri, opts) {
3886
+ return parseWithStatus(uri, opts).parsed;
3887
+ }
3888
+ function normalizeString(uri, opts) {
3889
+ return normalizeStringWithStatus(uri, opts).normalized;
3890
+ }
3891
+ function normalizeStringWithStatus(uri, opts) {
3892
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3893
+ return {
3894
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3895
+ malformedAuthorityOrPort
3896
+ };
3897
+ }
3898
+ function normalizeComparableURI(uri, opts) {
3899
+ if (typeof uri === "string") {
3900
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3901
+ return malformedAuthorityOrPort ? void 0 : normalized;
3902
+ }
3903
+ if (typeof uri === "object") {
3904
+ return serialize(uri, opts);
3905
+ }
3815
3906
  }
3816
3907
  var fastUri = {
3817
3908
  SCHEMES,
@@ -7065,9 +7156,9 @@ var require_combined_stream = __commonJS({
7065
7156
  }
7066
7157
  });
7067
7158
 
7068
- // ../node_modules/form-data/node_modules/mime-db/db.json
7159
+ // ../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/db.json
7069
7160
  var require_db = __commonJS({
7070
- "../node_modules/form-data/node_modules/mime-db/db.json"(exports2, module) {
7161
+ "../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/db.json"(exports2, module) {
7071
7162
  module.exports = {
7072
7163
  "application/1d-interleaved-parityfec": {
7073
7164
  source: "iana"
@@ -15590,9 +15681,9 @@ var require_db = __commonJS({
15590
15681
  }
15591
15682
  });
15592
15683
 
15593
- // ../node_modules/form-data/node_modules/mime-db/index.js
15684
+ // ../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/index.js
15594
15685
  var require_mime_db = __commonJS({
15595
- "../node_modules/form-data/node_modules/mime-db/index.js"(exports2, module) {
15686
+ "../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/index.js"(exports2, module) {
15596
15687
  module.exports = require_db();
15597
15688
  }
15598
15689
  });
@@ -16764,7 +16855,7 @@ var require_form_data = __commonJS({
16764
16855
  var path = __require("path");
16765
16856
  var http3 = __require("http");
16766
16857
  var https3 = __require("https");
16767
- var parseUrl2 = __require("url").parse;
16858
+ var parseUrl = __require("url").parse;
16768
16859
  var fs = __require("fs");
16769
16860
  var Stream = __require("stream").Stream;
16770
16861
  var crypto2 = __require("crypto");
@@ -16773,6 +16864,9 @@ var require_form_data = __commonJS({
16773
16864
  var setToStringTag = require_es_set_tostringtag();
16774
16865
  var hasOwn = require_hasown();
16775
16866
  var populate = require_populate();
16867
+ function escapeHeaderParam(str) {
16868
+ return String(str).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22");
16869
+ }
16776
16870
  function FormData3(options) {
16777
16871
  if (!(this instanceof FormData3)) {
16778
16872
  return new FormData3(options);
@@ -16862,7 +16956,7 @@ var require_form_data = __commonJS({
16862
16956
  var contents = "";
16863
16957
  var headers = {
16864
16958
  // add custom disposition as third element or keep it two elements if not
16865
- "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
16959
+ "Content-Disposition": ["form-data", 'name="' + escapeHeaderParam(field) + '"'].concat(contentDisposition || []),
16866
16960
  // if no content type. allow it to be empty array
16867
16961
  "Content-Type": [].concat(contentType || [])
16868
16962
  };
@@ -16896,7 +16990,7 @@ var require_form_data = __commonJS({
16896
16990
  filename = path.basename(value.client._httpMessage.path || "");
16897
16991
  }
16898
16992
  if (filename) {
16899
- return 'filename="' + filename + '"';
16993
+ return 'filename="' + escapeHeaderParam(filename) + '"';
16900
16994
  }
16901
16995
  };
16902
16996
  FormData3.prototype._getContentType = function(value, options) {
@@ -17017,7 +17111,7 @@ var require_form_data = __commonJS({
17017
17111
  var options;
17018
17112
  var defaults2 = { method: "post" };
17019
17113
  if (typeof params === "string") {
17020
- params = parseUrl2(params);
17114
+ params = parseUrl(params);
17021
17115
  options = populate({
17022
17116
  port: params.port,
17023
17117
  path: params.pathname,
@@ -17074,6 +17168,76 @@ var require_form_data = __commonJS({
17074
17168
  }
17075
17169
  });
17076
17170
 
17171
+ // ../node_modules/proxy-from-env/index.js
17172
+ var require_proxy_from_env = __commonJS({
17173
+ "../node_modules/proxy-from-env/index.js"(exports2) {
17174
+ "use strict";
17175
+ var parseUrl = __require("url").parse;
17176
+ var DEFAULT_PORTS = {
17177
+ ftp: 21,
17178
+ gopher: 70,
17179
+ http: 80,
17180
+ https: 443,
17181
+ ws: 80,
17182
+ wss: 443
17183
+ };
17184
+ var stringEndsWith = String.prototype.endsWith || function(s) {
17185
+ return s.length <= this.length && this.indexOf(s, this.length - s.length) !== -1;
17186
+ };
17187
+ function getProxyForUrl(url3) {
17188
+ var parsedUrl = typeof url3 === "string" ? parseUrl(url3) : url3 || {};
17189
+ var proto = parsedUrl.protocol;
17190
+ var hostname3 = parsedUrl.host;
17191
+ var port = parsedUrl.port;
17192
+ if (typeof hostname3 !== "string" || !hostname3 || typeof proto !== "string") {
17193
+ return "";
17194
+ }
17195
+ proto = proto.split(":", 1)[0];
17196
+ hostname3 = hostname3.replace(/:\d*$/, "");
17197
+ port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
17198
+ if (!shouldProxy(hostname3, port)) {
17199
+ return "";
17200
+ }
17201
+ var proxy = getEnv("npm_config_" + proto + "_proxy") || getEnv(proto + "_proxy") || getEnv("npm_config_proxy") || getEnv("all_proxy");
17202
+ if (proxy && proxy.indexOf("://") === -1) {
17203
+ proxy = proto + "://" + proxy;
17204
+ }
17205
+ return proxy;
17206
+ }
17207
+ function shouldProxy(hostname3, port) {
17208
+ var NO_PROXY = (getEnv("npm_config_no_proxy") || getEnv("no_proxy")).toLowerCase();
17209
+ if (!NO_PROXY) {
17210
+ return true;
17211
+ }
17212
+ if (NO_PROXY === "*") {
17213
+ return false;
17214
+ }
17215
+ return NO_PROXY.split(/[,\s]/).every(function(proxy) {
17216
+ if (!proxy) {
17217
+ return true;
17218
+ }
17219
+ var parsedProxy = proxy.match(/^(.+):(\d+)$/);
17220
+ var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
17221
+ var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
17222
+ if (parsedProxyPort && parsedProxyPort !== port) {
17223
+ return true;
17224
+ }
17225
+ if (!/^[.*]/.test(parsedProxyHostname)) {
17226
+ return hostname3 !== parsedProxyHostname;
17227
+ }
17228
+ if (parsedProxyHostname.charAt(0) === "*") {
17229
+ parsedProxyHostname = parsedProxyHostname.slice(1);
17230
+ }
17231
+ return !stringEndsWith.call(hostname3, parsedProxyHostname);
17232
+ });
17233
+ }
17234
+ function getEnv(key) {
17235
+ return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
17236
+ }
17237
+ exports2.getProxyForUrl = getProxyForUrl;
17238
+ }
17239
+ });
17240
+
17077
17241
  // ../node_modules/ms/index.js
17078
17242
  var require_ms = __commonJS({
17079
17243
  "../node_modules/ms/index.js"(exports2, module) {
@@ -17893,6 +18057,11 @@ var require_follow_redirects = __commonJS({
17893
18057
  } catch (error48) {
17894
18058
  useNativeURL = error48.code === "ERR_INVALID_URL";
17895
18059
  }
18060
+ var sensitiveHeaders = [
18061
+ "Authorization",
18062
+ "Proxy-Authorization",
18063
+ "Cookie"
18064
+ ];
17896
18065
  var preservedUrlFields = [
17897
18066
  "auth",
17898
18067
  "host",
@@ -17957,6 +18126,7 @@ var require_follow_redirects = __commonJS({
17957
18126
  self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
17958
18127
  }
17959
18128
  };
18129
+ this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex2).join("|") + ")$", "i");
17960
18130
  this._performRequest();
17961
18131
  }
17962
18132
  RedirectableRequest.prototype = Object.create(Writable.prototype);
@@ -18094,6 +18264,9 @@ var require_follow_redirects = __commonJS({
18094
18264
  if (!options.headers) {
18095
18265
  options.headers = {};
18096
18266
  }
18267
+ if (!isArray2(options.sensitiveHeaders)) {
18268
+ options.sensitiveHeaders = [];
18269
+ }
18097
18270
  if (options.host) {
18098
18271
  if (!options.hostname) {
18099
18272
  options.hostname = options.host;
@@ -18191,7 +18364,7 @@ var require_follow_redirects = __commonJS({
18191
18364
  removeMatchingHeaders(/^content-/i, this._options.headers);
18192
18365
  }
18193
18366
  var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
18194
- var currentUrlParts = parseUrl2(this._currentUrl);
18367
+ var currentUrlParts = parseUrl(this._currentUrl);
18195
18368
  var currentHost = currentHostHeader || currentUrlParts.host;
18196
18369
  var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url3.format(Object.assign(currentUrlParts, { host: currentHost }));
18197
18370
  var redirectUrl = resolveUrl(location, currentUrl);
@@ -18199,7 +18372,7 @@ var require_follow_redirects = __commonJS({
18199
18372
  this._isRedirect = true;
18200
18373
  spreadUrlObject(redirectUrl, this._options);
18201
18374
  if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
18202
- removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
18375
+ removeMatchingHeaders(this._headerFilter, this._options.headers);
18203
18376
  }
18204
18377
  if (isFunction3(beforeRedirect)) {
18205
18378
  var responseDetails = {
@@ -18230,7 +18403,7 @@ var require_follow_redirects = __commonJS({
18230
18403
  if (isURL(input)) {
18231
18404
  input = spreadUrlObject(input);
18232
18405
  } else if (isString2(input)) {
18233
- input = spreadUrlObject(parseUrl2(input));
18406
+ input = spreadUrlObject(parseUrl(input));
18234
18407
  } else {
18235
18408
  callback = options;
18236
18409
  options = validateUrl(input);
@@ -18266,7 +18439,7 @@ var require_follow_redirects = __commonJS({
18266
18439
  }
18267
18440
  function noop2() {
18268
18441
  }
18269
- function parseUrl2(input) {
18442
+ function parseUrl(input) {
18270
18443
  var parsed;
18271
18444
  if (useNativeURL) {
18272
18445
  parsed = new URL2(input);
@@ -18279,7 +18452,7 @@ var require_follow_redirects = __commonJS({
18279
18452
  return parsed;
18280
18453
  }
18281
18454
  function resolveUrl(relative, base) {
18282
- return useNativeURL ? new URL2(relative, base) : parseUrl2(url3.resolve(base, relative));
18455
+ return useNativeURL ? new URL2(relative, base) : parseUrl(url3.resolve(base, relative));
18283
18456
  }
18284
18457
  function validateUrl(input) {
18285
18458
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -18348,6 +18521,9 @@ var require_follow_redirects = __commonJS({
18348
18521
  var dot = subdomain.length - domain2.length - 1;
18349
18522
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain2);
18350
18523
  }
18524
+ function isArray2(value) {
18525
+ return value instanceof Array;
18526
+ }
18351
18527
  function isString2(value) {
18352
18528
  return typeof value === "string" || value instanceof String;
18353
18529
  }
@@ -18360,6 +18536,9 @@ var require_follow_redirects = __commonJS({
18360
18536
  function isURL(value) {
18361
18537
  return URL2 && value instanceof URL2;
18362
18538
  }
18539
+ function escapeRegex2(regex) {
18540
+ return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
18541
+ }
18363
18542
  module.exports = wrap({ http: http3, https: https3 });
18364
18543
  module.exports.wrap = wrap;
18365
18544
  }
@@ -32403,7 +32582,8 @@ config(en_default());
32403
32582
  var zod_default = external_exports;
32404
32583
 
32405
32584
  // ../packages/shared/dist/pagination.js
32406
- var z2 = external_exports || zod_default || zod_exports;
32585
+ var zodCompat = zod_exports;
32586
+ var z2 = zodCompat.z ?? zodCompat.default?.z ?? zodCompat.default ?? zodCompat;
32407
32587
  var paginationSchema = z2.object({
32408
32588
  limit: z2.number().int().min(1).max(100).default(20).describe("Maximum results to return (1\u2013100, default 20)"),
32409
32589
  offset: z2.number().int().min(0).default(0).describe("Number of results to skip for pagination (default 0)")
@@ -32421,6 +32601,14 @@ function applyPagination(items, params) {
32421
32601
  };
32422
32602
  }
32423
32603
 
32604
+ // ../packages/shared/dist/package.js
32605
+ import { createRequire as createJsonRequire } from "node:module";
32606
+ function getPackageVersion(moduleUrl) {
32607
+ const require2 = createJsonRequire(moduleUrl);
32608
+ const packageJson = require2("../package.json");
32609
+ return packageJson.version ?? "0.0.0";
32610
+ }
32611
+
32424
32612
  // ../node_modules/zod/v3/helpers/util.js
32425
32613
  var util;
32426
32614
  (function(util4) {
@@ -42002,25 +42190,12 @@ var isEmptyObject = (val) => {
42002
42190
  };
42003
42191
  var isDate = kindOfTest("Date");
42004
42192
  var isFile = kindOfTest("File");
42005
- var isReactNativeBlob = (value) => {
42006
- return !!(value && typeof value.uri !== "undefined");
42007
- };
42008
- var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
42009
42193
  var isBlob = kindOfTest("Blob");
42010
42194
  var isFileList = kindOfTest("FileList");
42011
42195
  var isStream = (val) => isObject2(val) && isFunction(val.pipe);
42012
- function getGlobal() {
42013
- if (typeof globalThis !== "undefined") return globalThis;
42014
- if (typeof self !== "undefined") return self;
42015
- if (typeof window !== "undefined") return window;
42016
- if (typeof global !== "undefined") return global;
42017
- return {};
42018
- }
42019
- var G = getGlobal();
42020
- var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
42021
42196
  var isFormData = (thing) => {
42022
42197
  let kind;
42023
- return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
42198
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
42024
42199
  kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
42025
42200
  };
42026
42201
  var isURLSearchParams = kindOfTest("URLSearchParams");
@@ -42030,9 +42205,7 @@ var [isReadableStream, isRequest, isResponse, isHeaders] = [
42030
42205
  "Response",
42031
42206
  "Headers"
42032
42207
  ].map(kindOfTest);
42033
- var trim = (str) => {
42034
- return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
42035
- };
42208
+ var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
42036
42209
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
42037
42210
  if (obj === null || typeof obj === "undefined") {
42038
42211
  return;
@@ -42134,7 +42307,10 @@ var stripBOM = (content) => {
42134
42307
  return content;
42135
42308
  };
42136
42309
  var inherits = (constructor, superConstructor, props, descriptors) => {
42137
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
42310
+ constructor.prototype = Object.create(
42311
+ superConstructor.prototype,
42312
+ descriptors
42313
+ );
42138
42314
  Object.defineProperty(constructor.prototype, "constructor", {
42139
42315
  value: constructor,
42140
42316
  writable: true,
@@ -42333,8 +42509,6 @@ var utils_default = {
42333
42509
  isUndefined,
42334
42510
  isDate,
42335
42511
  isFile,
42336
- isReactNativeBlob,
42337
- isReactNative,
42338
42512
  isBlob,
42339
42513
  isRegExp,
42340
42514
  isFunction,
@@ -42383,9 +42557,6 @@ var AxiosError = class _AxiosError extends Error {
42383
42557
  const axiosError = new _AxiosError(error48.message, code || error48.code, config2, request, response);
42384
42558
  axiosError.cause = error48;
42385
42559
  axiosError.name = error48.name;
42386
- if (error48.status != null && axiosError.status == null) {
42387
- axiosError.status = error48.status;
42388
- }
42389
42560
  customProps && Object.assign(axiosError, customProps);
42390
42561
  return axiosError;
42391
42562
  }
@@ -42402,12 +42573,6 @@ var AxiosError = class _AxiosError extends Error {
42402
42573
  */
42403
42574
  constructor(message, code, config2, request, response) {
42404
42575
  super(message);
42405
- Object.defineProperty(this, "message", {
42406
- value: message,
42407
- enumerable: true,
42408
- writable: true,
42409
- configurable: true
42410
- });
42411
42576
  this.name = "AxiosError";
42412
42577
  this.isAxiosError = true;
42413
42578
  code && (this.code = code);
@@ -42481,18 +42646,13 @@ function toFormData(obj, formData, options) {
42481
42646
  throw new TypeError("target must be an object");
42482
42647
  }
42483
42648
  formData = formData || new (FormData_default || FormData)();
42484
- options = utils_default.toFlatObject(
42485
- options,
42486
- {
42487
- metaTokens: true,
42488
- dots: false,
42489
- indexes: false
42490
- },
42491
- false,
42492
- function defined(option, source) {
42493
- return !utils_default.isUndefined(source[option]);
42494
- }
42495
- );
42649
+ options = utils_default.toFlatObject(options, {
42650
+ metaTokens: true,
42651
+ dots: false,
42652
+ indexes: false
42653
+ }, false, function defined(option, source) {
42654
+ return !utils_default.isUndefined(source[option]);
42655
+ });
42496
42656
  const metaTokens = options.metaTokens;
42497
42657
  const visitor = options.visitor || defaultVisitor;
42498
42658
  const dots = options.dots;
@@ -42520,10 +42680,6 @@ function toFormData(obj, formData, options) {
42520
42680
  }
42521
42681
  function defaultVisitor(value, key, path) {
42522
42682
  let arr = value;
42523
- if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
42524
- formData.append(renderKey(path, key, dots), convertValue(value));
42525
- return false;
42526
- }
42527
42683
  if (value && !path && typeof value === "object") {
42528
42684
  if (utils_default.endsWith(key, "{}")) {
42529
42685
  key = metaTokens ? key : key.slice(0, -2);
@@ -42559,7 +42715,13 @@ function toFormData(obj, formData, options) {
42559
42715
  }
42560
42716
  stack.push(value);
42561
42717
  utils_default.forEach(value, function each(el, key) {
42562
- const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path, exposedHelpers);
42718
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(
42719
+ formData,
42720
+ el,
42721
+ utils_default.isString(key) ? key.trim() : key,
42722
+ path,
42723
+ exposedHelpers
42724
+ );
42563
42725
  if (result === true) {
42564
42726
  build(el, path ? path.concat(key) : [key]);
42565
42727
  }
@@ -42854,74 +43016,70 @@ function stringifySafely(rawValue, parser2, encoder) {
42854
43016
  var defaults = {
42855
43017
  transitional: transitional_default,
42856
43018
  adapter: ["xhr", "http", "fetch"],
42857
- transformRequest: [
42858
- function transformRequest(data, headers) {
42859
- const contentType = headers.getContentType() || "";
42860
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
42861
- const isObjectPayload = utils_default.isObject(data);
42862
- if (isObjectPayload && utils_default.isHTMLForm(data)) {
42863
- data = new FormData(data);
42864
- }
42865
- const isFormData2 = utils_default.isFormData(data);
42866
- if (isFormData2) {
42867
- return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
42868
- }
42869
- if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
42870
- return data;
42871
- }
42872
- if (utils_default.isArrayBufferView(data)) {
42873
- return data.buffer;
42874
- }
42875
- if (utils_default.isURLSearchParams(data)) {
42876
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
42877
- return data.toString();
42878
- }
42879
- let isFileList2;
42880
- if (isObjectPayload) {
42881
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
42882
- return toURLEncodedForm(data, this.formSerializer).toString();
42883
- }
42884
- if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
42885
- const _FormData = this.env && this.env.FormData;
42886
- return toFormData_default(
42887
- isFileList2 ? { "files[]": data } : data,
42888
- _FormData && new _FormData(),
42889
- this.formSerializer
42890
- );
42891
- }
43019
+ transformRequest: [function transformRequest(data, headers) {
43020
+ const contentType = headers.getContentType() || "";
43021
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
43022
+ const isObjectPayload = utils_default.isObject(data);
43023
+ if (isObjectPayload && utils_default.isHTMLForm(data)) {
43024
+ data = new FormData(data);
43025
+ }
43026
+ const isFormData2 = utils_default.isFormData(data);
43027
+ if (isFormData2) {
43028
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
43029
+ }
43030
+ if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
43031
+ return data;
43032
+ }
43033
+ if (utils_default.isArrayBufferView(data)) {
43034
+ return data.buffer;
43035
+ }
43036
+ if (utils_default.isURLSearchParams(data)) {
43037
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
43038
+ return data.toString();
43039
+ }
43040
+ let isFileList2;
43041
+ if (isObjectPayload) {
43042
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
43043
+ return toURLEncodedForm(data, this.formSerializer).toString();
42892
43044
  }
42893
- if (isObjectPayload || hasJSONContentType) {
42894
- headers.setContentType("application/json", false);
42895
- return stringifySafely(data);
43045
+ if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
43046
+ const _FormData = this.env && this.env.FormData;
43047
+ return toFormData_default(
43048
+ isFileList2 ? { "files[]": data } : data,
43049
+ _FormData && new _FormData(),
43050
+ this.formSerializer
43051
+ );
42896
43052
  }
43053
+ }
43054
+ if (isObjectPayload || hasJSONContentType) {
43055
+ headers.setContentType("application/json", false);
43056
+ return stringifySafely(data);
43057
+ }
43058
+ return data;
43059
+ }],
43060
+ transformResponse: [function transformResponse(data) {
43061
+ const transitional2 = this.transitional || defaults.transitional;
43062
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
43063
+ const JSONRequested = this.responseType === "json";
43064
+ if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
42897
43065
  return data;
42898
43066
  }
42899
- ],
42900
- transformResponse: [
42901
- function transformResponse(data) {
42902
- const transitional2 = this.transitional || defaults.transitional;
42903
- const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
42904
- const JSONRequested = this.responseType === "json";
42905
- if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
42906
- return data;
42907
- }
42908
- if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
42909
- const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
42910
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
42911
- try {
42912
- return JSON.parse(data, this.parseReviver);
42913
- } catch (e) {
42914
- if (strictJSONParsing) {
42915
- if (e.name === "SyntaxError") {
42916
- throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
42917
- }
42918
- throw e;
43067
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
43068
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
43069
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
43070
+ try {
43071
+ return JSON.parse(data, this.parseReviver);
43072
+ } catch (e) {
43073
+ if (strictJSONParsing) {
43074
+ if (e.name === "SyntaxError") {
43075
+ throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
42919
43076
  }
43077
+ throw e;
42920
43078
  }
42921
43079
  }
42922
- return data;
42923
43080
  }
42924
- ],
43081
+ return data;
43082
+ }],
42925
43083
  /**
42926
43084
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
42927
43085
  * timeout is not created.
@@ -42940,7 +43098,7 @@ var defaults = {
42940
43098
  },
42941
43099
  headers: {
42942
43100
  common: {
42943
- Accept: "application/json, text/plain, */*",
43101
+ "Accept": "application/json, text/plain, */*",
42944
43102
  "Content-Type": void 0
42945
43103
  }
42946
43104
  }
@@ -43004,7 +43162,7 @@ function normalizeValue(value) {
43004
43162
  if (value === false || value == null) {
43005
43163
  return value;
43006
43164
  }
43007
- return utils_default.isArray(value) ? value.map(normalizeValue) : String(value).replace(/[\r\n]+$/, "");
43165
+ return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
43008
43166
  }
43009
43167
  function parseTokens(str) {
43010
43168
  const tokens = /* @__PURE__ */ Object.create(null);
@@ -43211,14 +43369,7 @@ var AxiosHeaders = class {
43211
43369
  return this;
43212
43370
  }
43213
43371
  };
43214
- AxiosHeaders.accessor([
43215
- "Content-Type",
43216
- "Content-Length",
43217
- "Accept",
43218
- "Accept-Encoding",
43219
- "User-Agent",
43220
- "Authorization"
43221
- ]);
43372
+ AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
43222
43373
  utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
43223
43374
  let mapped = key[0].toUpperCase() + key.slice(1);
43224
43375
  return {
@@ -43274,15 +43425,13 @@ function settle(resolve, reject, response) {
43274
43425
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
43275
43426
  resolve(response);
43276
43427
  } else {
43277
- reject(
43278
- new AxiosError_default(
43279
- "Request failed with status code " + response.status,
43280
- [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
43281
- response.config,
43282
- response.request,
43283
- response
43284
- )
43285
- );
43428
+ reject(new AxiosError_default(
43429
+ "Request failed with status code " + response.status,
43430
+ [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
43431
+ response.config,
43432
+ response.request,
43433
+ response
43434
+ ));
43286
43435
  }
43287
43436
  }
43288
43437
 
@@ -43308,74 +43457,8 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
43308
43457
  return requestedURL;
43309
43458
  }
43310
43459
 
43311
- // ../node_modules/proxy-from-env/index.js
43312
- var DEFAULT_PORTS = {
43313
- ftp: 21,
43314
- gopher: 70,
43315
- http: 80,
43316
- https: 443,
43317
- ws: 80,
43318
- wss: 443
43319
- };
43320
- function parseUrl(urlString) {
43321
- try {
43322
- return new URL(urlString);
43323
- } catch {
43324
- return null;
43325
- }
43326
- }
43327
- function getProxyForUrl(url3) {
43328
- var parsedUrl = (typeof url3 === "string" ? parseUrl(url3) : url3) || {};
43329
- var proto = parsedUrl.protocol;
43330
- var hostname3 = parsedUrl.host;
43331
- var port = parsedUrl.port;
43332
- if (typeof hostname3 !== "string" || !hostname3 || typeof proto !== "string") {
43333
- return "";
43334
- }
43335
- proto = proto.split(":", 1)[0];
43336
- hostname3 = hostname3.replace(/:\d*$/, "");
43337
- port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
43338
- if (!shouldProxy(hostname3, port)) {
43339
- return "";
43340
- }
43341
- var proxy = getEnv(proto + "_proxy") || getEnv("all_proxy");
43342
- if (proxy && proxy.indexOf("://") === -1) {
43343
- proxy = proto + "://" + proxy;
43344
- }
43345
- return proxy;
43346
- }
43347
- function shouldProxy(hostname3, port) {
43348
- var NO_PROXY = getEnv("no_proxy").toLowerCase();
43349
- if (!NO_PROXY) {
43350
- return true;
43351
- }
43352
- if (NO_PROXY === "*") {
43353
- return false;
43354
- }
43355
- return NO_PROXY.split(/[,\s]/).every(function(proxy) {
43356
- if (!proxy) {
43357
- return true;
43358
- }
43359
- var parsedProxy = proxy.match(/^(.+):(\d+)$/);
43360
- var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
43361
- var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
43362
- if (parsedProxyPort && parsedProxyPort !== port) {
43363
- return true;
43364
- }
43365
- if (!/^[.*]/.test(parsedProxyHostname)) {
43366
- return hostname3 !== parsedProxyHostname;
43367
- }
43368
- if (parsedProxyHostname.charAt(0) === "*") {
43369
- parsedProxyHostname = parsedProxyHostname.slice(1);
43370
- }
43371
- return !hostname3.endsWith(parsedProxyHostname);
43372
- });
43373
- }
43374
- function getEnv(key) {
43375
- return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
43376
- }
43377
-
43378
43460
  // ../node_modules/axios/lib/adapters/http.js
43461
+ var import_proxy_from_env = __toESM(require_proxy_from_env(), 1);
43379
43462
  var import_follow_redirects = __toESM(require_follow_redirects(), 1);
43380
43463
  import http from "http";
43381
43464
  import https from "https";
@@ -43384,7 +43467,7 @@ import util3 from "util";
43384
43467
  import zlib from "zlib";
43385
43468
 
43386
43469
  // ../node_modules/axios/lib/env/data.js
43387
- var VERSION = "1.14.0";
43470
+ var VERSION = "1.13.5";
43388
43471
 
43389
43472
  // ../node_modules/axios/lib/helpers/parseProtocol.js
43390
43473
  function parseProtocol(url3) {
@@ -43429,21 +43512,16 @@ import stream from "stream";
43429
43512
  var kInternals = /* @__PURE__ */ Symbol("internals");
43430
43513
  var AxiosTransformStream = class extends stream.Transform {
43431
43514
  constructor(options) {
43432
- options = utils_default.toFlatObject(
43433
- options,
43434
- {
43435
- maxRate: 0,
43436
- chunkSize: 64 * 1024,
43437
- minChunkSize: 100,
43438
- timeWindow: 500,
43439
- ticksRate: 2,
43440
- samplesCount: 15
43441
- },
43442
- null,
43443
- (prop, source) => {
43444
- return !utils_default.isUndefined(source[prop]);
43445
- }
43446
- );
43515
+ options = utils_default.toFlatObject(options, {
43516
+ maxRate: 0,
43517
+ chunkSize: 64 * 1024,
43518
+ minChunkSize: 100,
43519
+ timeWindow: 500,
43520
+ ticksRate: 2,
43521
+ samplesCount: 15
43522
+ }, null, (prop, source) => {
43523
+ return !utils_default.isUndefined(source[prop]);
43524
+ });
43447
43525
  super({
43448
43526
  readableHighWaterMark: options.chunkSize
43449
43527
  });
@@ -43526,12 +43604,9 @@ var AxiosTransformStream = class extends stream.Transform {
43526
43604
  chunkRemainder = _chunk.subarray(maxChunkSize);
43527
43605
  _chunk = _chunk.subarray(0, maxChunkSize);
43528
43606
  }
43529
- pushChunk(
43530
- _chunk,
43531
- chunkRemainder ? () => {
43532
- process.nextTick(_callback, null, chunkRemainder);
43533
- } : _callback
43534
- );
43607
+ pushChunk(_chunk, chunkRemainder ? () => {
43608
+ process.nextTick(_callback, null, chunkRemainder);
43609
+ } : _callback);
43535
43610
  };
43536
43611
  transformChunk(chunk, function transformNextChunk(err, _chunk) {
43537
43612
  if (err) {
@@ -43602,14 +43677,11 @@ var FormDataPart = class {
43602
43677
  yield CRLF_BYTES;
43603
43678
  }
43604
43679
  static escapeName(name) {
43605
- return String(name).replace(
43606
- /[\r\n"]/g,
43607
- (match) => ({
43608
- "\r": "%0D",
43609
- "\n": "%0A",
43610
- '"': "%22"
43611
- })[match]
43612
- );
43680
+ return String(name).replace(/[\r\n"]/g, (match) => ({
43681
+ "\r": "%0D",
43682
+ "\n": "%0A",
43683
+ '"': "%22"
43684
+ })[match]);
43613
43685
  }
43614
43686
  };
43615
43687
  var formDataToStream = (form, headersHandler, options) => {
@@ -43641,15 +43713,13 @@ var formDataToStream = (form, headersHandler, options) => {
43641
43713
  computedHeaders["Content-Length"] = contentLength;
43642
43714
  }
43643
43715
  headersHandler && headersHandler(computedHeaders);
43644
- return Readable.from(
43645
- (async function* () {
43646
- for (const part of parts) {
43647
- yield boundaryBytes;
43648
- yield* part.encode();
43649
- }
43650
- yield footerBytes;
43651
- })()
43652
- );
43716
+ return Readable.from((async function* () {
43717
+ for (const part of parts) {
43718
+ yield boundaryBytes;
43719
+ yield* part.encode();
43720
+ }
43721
+ yield footerBytes;
43722
+ })());
43653
43723
  };
43654
43724
  var formDataToStream_default = formDataToStream;
43655
43725
 
@@ -43788,14 +43858,11 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
43788
43858
  };
43789
43859
  var progressEventDecorator = (total, throttled) => {
43790
43860
  const lengthComputable = total != null;
43791
- return [
43792
- (loaded) => throttled[0]({
43793
- lengthComputable,
43794
- total,
43795
- loaded
43796
- }),
43797
- throttled[1]
43798
- ];
43861
+ return [(loaded) => throttled[0]({
43862
+ lengthComputable,
43863
+ total,
43864
+ loaded
43865
+ }), throttled[1]];
43799
43866
  };
43800
43867
  var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
43801
43868
 
@@ -43874,12 +43941,9 @@ var Http2Sessions = class {
43874
43941
  this.sessions = /* @__PURE__ */ Object.create(null);
43875
43942
  }
43876
43943
  getSession(authority, options) {
43877
- options = Object.assign(
43878
- {
43879
- sessionTimeout: 1e3
43880
- },
43881
- options
43882
- );
43944
+ options = Object.assign({
43945
+ sessionTimeout: 1e3
43946
+ }, options);
43883
43947
  let authoritySessions = this.sessions[authority];
43884
43948
  if (authoritySessions) {
43885
43949
  let len = authoritySessions.length;
@@ -43905,9 +43969,6 @@ var Http2Sessions = class {
43905
43969
  } else {
43906
43970
  entries.splice(i, 1);
43907
43971
  }
43908
- if (!session.closed) {
43909
- session.close();
43910
- }
43911
43972
  return;
43912
43973
  }
43913
43974
  }
@@ -43936,7 +43997,10 @@ var Http2Sessions = class {
43936
43997
  };
43937
43998
  }
43938
43999
  session.once("close", removeSession);
43939
- let entry = [session, options];
44000
+ let entry = [
44001
+ session,
44002
+ options
44003
+ ];
43940
44004
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
43941
44005
  return session;
43942
44006
  }
@@ -43953,7 +44017,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
43953
44017
  function setProxy(options, configProxy, location) {
43954
44018
  let proxy = configProxy;
43955
44019
  if (!proxy && proxy !== false) {
43956
- const proxyUrl = getProxyForUrl(location);
44020
+ const proxyUrl = import_proxy_from_env.default.getProxyForUrl(location);
43957
44021
  if (proxyUrl) {
43958
44022
  proxy = new URL(proxyUrl);
43959
44023
  }
@@ -44022,7 +44086,12 @@ var http2Transport = {
44022
44086
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
44023
44087
  const { http2Options, headers } = options;
44024
44088
  const session = http2Sessions.getSession(authority, http2Options);
44025
- const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = http2.constants;
44089
+ const {
44090
+ HTTP2_HEADER_SCHEME,
44091
+ HTTP2_HEADER_METHOD,
44092
+ HTTP2_HEADER_PATH,
44093
+ HTTP2_HEADER_STATUS
44094
+ } = http2.constants;
44026
44095
  const http2Headers = {
44027
44096
  [HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
44028
44097
  [HTTP2_HEADER_METHOD]: options.method,
@@ -44075,10 +44144,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44075
44144
  const abortEmitter = new EventEmitter();
44076
44145
  function abort(reason) {
44077
44146
  try {
44078
- abortEmitter.emit(
44079
- "abort",
44080
- !reason || reason.type ? new CanceledError_default(null, config2, req) : reason
44081
- );
44147
+ abortEmitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config2, req) : reason);
44082
44148
  } catch (err) {
44083
44149
  console.warn("emit error", err);
44084
44150
  }
@@ -44124,13 +44190,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44124
44190
  const dataUrl = String(config2.url || fullPath || "");
44125
44191
  const estimated = estimateDataURLDecodedBytes(dataUrl);
44126
44192
  if (estimated > config2.maxContentLength) {
44127
- return reject(
44128
- new AxiosError_default(
44129
- "maxContentLength size of " + config2.maxContentLength + " exceeded",
44130
- AxiosError_default.ERR_BAD_RESPONSE,
44131
- config2
44132
- )
44133
- );
44193
+ return reject(new AxiosError_default(
44194
+ "maxContentLength size of " + config2.maxContentLength + " exceeded",
44195
+ AxiosError_default.ERR_BAD_RESPONSE,
44196
+ config2
44197
+ ));
44134
44198
  }
44135
44199
  }
44136
44200
  let convertedData;
@@ -44166,9 +44230,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44166
44230
  });
44167
44231
  }
44168
44232
  if (supportedProtocols.indexOf(protocol) === -1) {
44169
- return reject(
44170
- new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_BAD_REQUEST, config2)
44171
- );
44233
+ return reject(new AxiosError_default(
44234
+ "Unsupported protocol " + protocol,
44235
+ AxiosError_default.ERR_BAD_REQUEST,
44236
+ config2
44237
+ ));
44172
44238
  }
44173
44239
  const headers = AxiosHeaders_default.from(config2.headers).normalize();
44174
44240
  headers.set("User-Agent", "axios/" + VERSION, false);
@@ -44178,16 +44244,12 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44178
44244
  let maxDownloadRate = void 0;
44179
44245
  if (utils_default.isSpecCompliantForm(data)) {
44180
44246
  const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
44181
- data = formDataToStream_default(
44182
- data,
44183
- (formHeaders) => {
44184
- headers.set(formHeaders);
44185
- },
44186
- {
44187
- tag: `axios-${VERSION}-boundary`,
44188
- boundary: userBoundary && userBoundary[1] || void 0
44189
- }
44190
- );
44247
+ data = formDataToStream_default(data, (formHeaders) => {
44248
+ headers.set(formHeaders);
44249
+ }, {
44250
+ tag: `axios-${VERSION}-boundary`,
44251
+ boundary: userBoundary && userBoundary[1] || void 0
44252
+ });
44191
44253
  } else if (utils_default.isFormData(data) && utils_default.isFunction(data.getHeaders)) {
44192
44254
  headers.set(data.getHeaders());
44193
44255
  if (!headers.hasContentLength()) {
@@ -44208,23 +44270,19 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44208
44270
  } else if (utils_default.isString(data)) {
44209
44271
  data = Buffer.from(data, "utf-8");
44210
44272
  } else {
44211
- return reject(
44212
- new AxiosError_default(
44213
- "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
44214
- AxiosError_default.ERR_BAD_REQUEST,
44215
- config2
44216
- )
44217
- );
44273
+ return reject(new AxiosError_default(
44274
+ "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
44275
+ AxiosError_default.ERR_BAD_REQUEST,
44276
+ config2
44277
+ ));
44218
44278
  }
44219
44279
  headers.setContentLength(data.length, false);
44220
44280
  if (config2.maxBodyLength > -1 && data.length > config2.maxBodyLength) {
44221
- return reject(
44222
- new AxiosError_default(
44223
- "Request body larger than maxBodyLength limit",
44224
- AxiosError_default.ERR_BAD_REQUEST,
44225
- config2
44226
- )
44227
- );
44281
+ return reject(new AxiosError_default(
44282
+ "Request body larger than maxBodyLength limit",
44283
+ AxiosError_default.ERR_BAD_REQUEST,
44284
+ config2
44285
+ ));
44228
44286
  }
44229
44287
  }
44230
44288
  const contentLength = utils_default.toFiniteNumber(headers.getContentLength());
@@ -44238,25 +44296,16 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44238
44296
  if (!utils_default.isStream(data)) {
44239
44297
  data = stream3.Readable.from(data, { objectMode: false });
44240
44298
  }
44241
- data = stream3.pipeline(
44242
- [
44243
- data,
44244
- new AxiosTransformStream_default({
44245
- maxRate: utils_default.toFiniteNumber(maxUploadRate)
44246
- })
44247
- ],
44248
- utils_default.noop
44249
- );
44250
- onUploadProgress && data.on(
44251
- "progress",
44252
- flushOnFinish(
44253
- data,
44254
- progressEventDecorator(
44255
- contentLength,
44256
- progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
44257
- )
44299
+ data = stream3.pipeline([data, new AxiosTransformStream_default({
44300
+ maxRate: utils_default.toFiniteNumber(maxUploadRate)
44301
+ })], utils_default.noop);
44302
+ onUploadProgress && data.on("progress", flushOnFinish(
44303
+ data,
44304
+ progressEventDecorator(
44305
+ contentLength,
44306
+ progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
44258
44307
  )
44259
- );
44308
+ ));
44260
44309
  }
44261
44310
  let auth = void 0;
44262
44311
  if (config2.auth) {
@@ -44307,11 +44356,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44307
44356
  } else {
44308
44357
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
44309
44358
  options.port = parsed.port;
44310
- setProxy(
44311
- options,
44312
- config2.proxy,
44313
- protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path
44314
- );
44359
+ setProxy(options, config2.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
44315
44360
  }
44316
44361
  let transport;
44317
44362
  const isHttpsRequest = isHttps.test(options.protocol);
@@ -44349,16 +44394,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44349
44394
  const transformStream = new AxiosTransformStream_default({
44350
44395
  maxRate: utils_default.toFiniteNumber(maxDownloadRate)
44351
44396
  });
44352
- onDownloadProgress && transformStream.on(
44353
- "progress",
44354
- flushOnFinish(
44355
- transformStream,
44356
- progressEventDecorator(
44357
- responseLength,
44358
- progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
44359
- )
44397
+ onDownloadProgress && transformStream.on("progress", flushOnFinish(
44398
+ transformStream,
44399
+ progressEventDecorator(
44400
+ responseLength,
44401
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
44360
44402
  )
44361
- );
44403
+ ));
44362
44404
  streams.push(transformStream);
44363
44405
  }
44364
44406
  let responseStream = res;
@@ -44408,14 +44450,12 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44408
44450
  if (config2.maxContentLength > -1 && totalResponseBytes > config2.maxContentLength) {
44409
44451
  rejected = true;
44410
44452
  responseStream.destroy();
44411
- abort(
44412
- new AxiosError_default(
44413
- "maxContentLength size of " + config2.maxContentLength + " exceeded",
44414
- AxiosError_default.ERR_BAD_RESPONSE,
44415
- config2,
44416
- lastRequest
44417
- )
44418
- );
44453
+ abort(new AxiosError_default(
44454
+ "maxContentLength size of " + config2.maxContentLength + " exceeded",
44455
+ AxiosError_default.ERR_BAD_RESPONSE,
44456
+ config2,
44457
+ lastRequest
44458
+ ));
44419
44459
  }
44420
44460
  });
44421
44461
  responseStream.on("aborted", function handlerStreamAborted() {
@@ -44474,14 +44514,12 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44474
44514
  if (config2.timeout) {
44475
44515
  const timeout = parseInt(config2.timeout, 10);
44476
44516
  if (Number.isNaN(timeout)) {
44477
- abort(
44478
- new AxiosError_default(
44479
- "error trying to parse `config.timeout` to int",
44480
- AxiosError_default.ERR_BAD_OPTION_VALUE,
44481
- config2,
44482
- req
44483
- )
44484
- );
44517
+ abort(new AxiosError_default(
44518
+ "error trying to parse `config.timeout` to int",
44519
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
44520
+ config2,
44521
+ req
44522
+ ));
44485
44523
  return;
44486
44524
  }
44487
44525
  req.setTimeout(timeout, function handleRequestTimeout() {
@@ -44491,14 +44529,12 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config2) {
44491
44529
  if (config2.timeoutErrorMessage) {
44492
44530
  timeoutErrorMessage = config2.timeoutErrorMessage;
44493
44531
  }
44494
- abort(
44495
- new AxiosError_default(
44496
- timeoutErrorMessage,
44497
- transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
44498
- config2,
44499
- req
44500
- )
44501
- );
44532
+ abort(new AxiosError_default(
44533
+ timeoutErrorMessage,
44534
+ transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
44535
+ config2,
44536
+ req
44537
+ ));
44502
44538
  });
44503
44539
  } else {
44504
44540
  req.setTimeout(0);
@@ -44653,12 +44689,16 @@ function mergeConfig(config1, config2) {
44653
44689
  validateStatus: mergeDirectKeys,
44654
44690
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
44655
44691
  };
44656
- utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
44657
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
44658
- const merge3 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
44659
- const configValue = merge3(config1[prop], config2[prop], prop);
44660
- utils_default.isUndefined(configValue) && merge3 !== mergeDirectKeys || (config3[prop] = configValue);
44661
- });
44692
+ utils_default.forEach(
44693
+ Object.keys({ ...config1, ...config2 }),
44694
+ function computeConfigValue(prop) {
44695
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype")
44696
+ return;
44697
+ const merge3 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
44698
+ const configValue = merge3(config1[prop], config2[prop], prop);
44699
+ utils_default.isUndefined(configValue) && merge3 !== mergeDirectKeys || (config3[prop] = configValue);
44700
+ }
44701
+ );
44662
44702
  return config3;
44663
44703
  }
44664
44704
 
@@ -44667,17 +44707,11 @@ var resolveConfig_default = (config2) => {
44667
44707
  const newConfig = mergeConfig({}, config2);
44668
44708
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
44669
44709
  newConfig.headers = headers = AxiosHeaders_default.from(headers);
44670
- newConfig.url = buildURL(
44671
- buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
44672
- config2.params,
44673
- config2.paramsSerializer
44674
- );
44710
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config2.params, config2.paramsSerializer);
44675
44711
  if (auth) {
44676
44712
  headers.set(
44677
44713
  "Authorization",
44678
- "Basic " + btoa(
44679
- (auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
44680
- )
44714
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
44681
44715
  );
44682
44716
  }
44683
44717
  if (utils_default.isFormData(data)) {
@@ -44741,17 +44775,13 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
44741
44775
  config: config2,
44742
44776
  request
44743
44777
  };
44744
- settle(
44745
- function _resolve(value) {
44746
- resolve(value);
44747
- done();
44748
- },
44749
- function _reject(err) {
44750
- reject(err);
44751
- done();
44752
- },
44753
- response
44754
- );
44778
+ settle(function _resolve(value) {
44779
+ resolve(value);
44780
+ done();
44781
+ }, function _reject(err) {
44782
+ reject(err);
44783
+ done();
44784
+ }, response);
44755
44785
  request = null;
44756
44786
  }
44757
44787
  if ("onloadend" in request) {
@@ -44787,14 +44817,12 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
44787
44817
  if (_config.timeoutErrorMessage) {
44788
44818
  timeoutErrorMessage = _config.timeoutErrorMessage;
44789
44819
  }
44790
- reject(
44791
- new AxiosError_default(
44792
- timeoutErrorMessage,
44793
- transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
44794
- config2,
44795
- request
44796
- )
44797
- );
44820
+ reject(new AxiosError_default(
44821
+ timeoutErrorMessage,
44822
+ transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
44823
+ config2,
44824
+ request
44825
+ ));
44798
44826
  request = null;
44799
44827
  };
44800
44828
  requestData === void 0 && requestHeaders.setContentType(null);
@@ -44834,13 +44862,7 @@ var xhr_default = isXHRAdapterSupported && function(config2) {
44834
44862
  }
44835
44863
  const protocol = parseProtocol(_config.url);
44836
44864
  if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
44837
- reject(
44838
- new AxiosError_default(
44839
- "Unsupported protocol " + protocol + ":",
44840
- AxiosError_default.ERR_BAD_REQUEST,
44841
- config2
44842
- )
44843
- );
44865
+ reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config2));
44844
44866
  return;
44845
44867
  }
44846
44868
  request.send(requestData || null);
@@ -44858,9 +44880,7 @@ var composeSignals = (signals, timeout) => {
44858
44880
  aborted2 = true;
44859
44881
  unsubscribe();
44860
44882
  const err = reason instanceof Error ? reason : this.reason;
44861
- controller.abort(
44862
- err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
44863
- );
44883
+ controller.abort(err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err));
44864
44884
  }
44865
44885
  };
44866
44886
  let timer = timeout && setTimeout(() => {
@@ -44933,36 +44953,33 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
44933
44953
  onFinish && onFinish(e);
44934
44954
  }
44935
44955
  };
44936
- return new ReadableStream(
44937
- {
44938
- async pull(controller) {
44939
- try {
44940
- const { done: done2, value } = await iterator2.next();
44941
- if (done2) {
44942
- _onFinish();
44943
- controller.close();
44944
- return;
44945
- }
44946
- let len = value.byteLength;
44947
- if (onProgress) {
44948
- let loadedBytes = bytes += len;
44949
- onProgress(loadedBytes);
44950
- }
44951
- controller.enqueue(new Uint8Array(value));
44952
- } catch (err) {
44953
- _onFinish(err);
44954
- throw err;
44956
+ return new ReadableStream({
44957
+ async pull(controller) {
44958
+ try {
44959
+ const { done: done2, value } = await iterator2.next();
44960
+ if (done2) {
44961
+ _onFinish();
44962
+ controller.close();
44963
+ return;
44955
44964
  }
44956
- },
44957
- cancel(reason) {
44958
- _onFinish(reason);
44959
- return iterator2.return();
44965
+ let len = value.byteLength;
44966
+ if (onProgress) {
44967
+ let loadedBytes = bytes += len;
44968
+ onProgress(loadedBytes);
44969
+ }
44970
+ controller.enqueue(new Uint8Array(value));
44971
+ } catch (err) {
44972
+ _onFinish(err);
44973
+ throw err;
44960
44974
  }
44961
44975
  },
44962
- {
44963
- highWaterMark: 2
44976
+ cancel(reason) {
44977
+ _onFinish(reason);
44978
+ return iterator2.return();
44964
44979
  }
44965
- );
44980
+ }, {
44981
+ highWaterMark: 2
44982
+ });
44966
44983
  };
44967
44984
 
44968
44985
  // ../node_modules/axios/lib/adapters/fetch.js
@@ -44972,7 +44989,10 @@ var globalFetchAPI = (({ Request, Response }) => ({
44972
44989
  Request,
44973
44990
  Response
44974
44991
  }))(utils_default.global);
44975
- var { ReadableStream: ReadableStream2, TextEncoder: TextEncoder2 } = utils_default.global;
44992
+ var {
44993
+ ReadableStream: ReadableStream2,
44994
+ TextEncoder: TextEncoder2
44995
+ } = utils_default.global;
44976
44996
  var test = (fn, ...args) => {
44977
44997
  try {
44978
44998
  return !!fn(...args);
@@ -44981,13 +45001,9 @@ var test = (fn, ...args) => {
44981
45001
  }
44982
45002
  };
44983
45003
  var factory = (env) => {
44984
- env = utils_default.merge.call(
44985
- {
44986
- skipUndefined: true
44987
- },
44988
- globalFetchAPI,
44989
- env
44990
- );
45004
+ env = utils_default.merge.call({
45005
+ skipUndefined: true
45006
+ }, globalFetchAPI, env);
44991
45007
  const { fetch: envFetch, Request, Response } = env;
44992
45008
  const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
44993
45009
  const isRequestSupported = isFunction2(Request);
@@ -44999,16 +45015,14 @@ var factory = (env) => {
44999
45015
  const encodeText = isFetchSupported && (typeof TextEncoder2 === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder2()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
45000
45016
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
45001
45017
  let duplexAccessed = false;
45002
- const body = new ReadableStream2();
45003
45018
  const hasContentType = new Request(platform_default.origin, {
45004
- body,
45019
+ body: new ReadableStream2(),
45005
45020
  method: "POST",
45006
45021
  get duplex() {
45007
45022
  duplexAccessed = true;
45008
45023
  return "half";
45009
45024
  }
45010
45025
  }).headers.has("Content-Type");
45011
- body.cancel();
45012
45026
  return duplexAccessed && !hasContentType;
45013
45027
  });
45014
45028
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
@@ -45022,11 +45036,7 @@ var factory = (env) => {
45022
45036
  if (method) {
45023
45037
  return method.call(res);
45024
45038
  }
45025
- throw new AxiosError_default(
45026
- `Response type '${type}' is not supported`,
45027
- AxiosError_default.ERR_NOT_SUPPORT,
45028
- config2
45029
- );
45039
+ throw new AxiosError_default(`Response type '${type}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config2);
45030
45040
  });
45031
45041
  });
45032
45042
  })();
@@ -45075,10 +45085,7 @@ var factory = (env) => {
45075
45085
  } = resolveConfig_default(config2);
45076
45086
  let _fetch = envFetch || fetch;
45077
45087
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
45078
- let composedSignal = composeSignals_default(
45079
- [signal, cancelToken && cancelToken.toAbortSignal()],
45080
- timeout
45081
- );
45088
+ let composedSignal = composeSignals_default([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
45082
45089
  let request = null;
45083
45090
  const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
45084
45091
  composedSignal.unsubscribe();
@@ -45138,10 +45145,7 @@ var factory = (env) => {
45138
45145
  );
45139
45146
  }
45140
45147
  responseType = responseType || "text";
45141
- let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](
45142
- response,
45143
- config2
45144
- );
45148
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config2);
45145
45149
  !isStreamResponse && unsubscribe && unsubscribe();
45146
45150
  return await new Promise((resolve, reject) => {
45147
45151
  settle(resolve, reject, {
@@ -45157,13 +45161,7 @@ var factory = (env) => {
45157
45161
  unsubscribe && unsubscribe();
45158
45162
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
45159
45163
  throw Object.assign(
45160
- new AxiosError_default(
45161
- "Network Error",
45162
- AxiosError_default.ERR_NETWORK,
45163
- config2,
45164
- request,
45165
- err && err.response
45166
- ),
45164
+ new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config2, request, err && err.response),
45167
45165
  {
45168
45166
  cause: err.cause || err
45169
45167
  }
@@ -45177,7 +45175,11 @@ var seedCache = /* @__PURE__ */ new Map();
45177
45175
  var getFetch = (config2) => {
45178
45176
  let env = config2 && config2.env || {};
45179
45177
  const { fetch: fetch2, Request, Response } = env;
45180
- const seeds = [Request, Response, fetch2];
45178
+ const seeds = [
45179
+ Request,
45180
+ Response,
45181
+ fetch2
45182
+ ];
45181
45183
  let len = seeds.length, i = len, seed, target, map2 = seedCache;
45182
45184
  while (i--) {
45183
45185
  seed = seeds[i];
@@ -45266,33 +45268,37 @@ function throwIfCancellationRequested(config2) {
45266
45268
  function dispatchRequest(config2) {
45267
45269
  throwIfCancellationRequested(config2);
45268
45270
  config2.headers = AxiosHeaders_default.from(config2.headers);
45269
- config2.data = transformData.call(config2, config2.transformRequest);
45271
+ config2.data = transformData.call(
45272
+ config2,
45273
+ config2.transformRequest
45274
+ );
45270
45275
  if (["post", "put", "patch"].indexOf(config2.method) !== -1) {
45271
45276
  config2.headers.setContentType("application/x-www-form-urlencoded", false);
45272
45277
  }
45273
45278
  const adapter2 = adapters_default.getAdapter(config2.adapter || defaults_default.adapter, config2);
45274
- return adapter2(config2).then(
45275
- function onAdapterResolution(response) {
45279
+ return adapter2(config2).then(function onAdapterResolution(response) {
45280
+ throwIfCancellationRequested(config2);
45281
+ response.data = transformData.call(
45282
+ config2,
45283
+ config2.transformResponse,
45284
+ response
45285
+ );
45286
+ response.headers = AxiosHeaders_default.from(response.headers);
45287
+ return response;
45288
+ }, function onAdapterRejection(reason) {
45289
+ if (!isCancel(reason)) {
45276
45290
  throwIfCancellationRequested(config2);
45277
- response.data = transformData.call(config2, config2.transformResponse, response);
45278
- response.headers = AxiosHeaders_default.from(response.headers);
45279
- return response;
45280
- },
45281
- function onAdapterRejection(reason) {
45282
- if (!isCancel(reason)) {
45283
- throwIfCancellationRequested(config2);
45284
- if (reason && reason.response) {
45285
- reason.response.data = transformData.call(
45286
- config2,
45287
- config2.transformResponse,
45288
- reason.response
45289
- );
45290
- reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
45291
- }
45291
+ if (reason && reason.response) {
45292
+ reason.response.data = transformData.call(
45293
+ config2,
45294
+ config2.transformResponse,
45295
+ reason.response
45296
+ );
45297
+ reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
45292
45298
  }
45293
- return Promise.reject(reason);
45294
45299
  }
45295
- );
45300
+ return Promise.reject(reason);
45301
+ });
45296
45302
  }
45297
45303
 
45298
45304
  // ../node_modules/axios/lib/helpers/validator.js
@@ -45345,10 +45351,7 @@ function assertOptions(options, schema, allowUnknown) {
45345
45351
  const value = options[opt];
45346
45352
  const result = value === void 0 || validator(value, opt, options);
45347
45353
  if (result !== true) {
45348
- throw new AxiosError_default(
45349
- "option " + opt + " must be " + result,
45350
- AxiosError_default.ERR_BAD_OPTION_VALUE
45351
- );
45354
+ throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE);
45352
45355
  }
45353
45356
  continue;
45354
45357
  }
@@ -45410,16 +45413,12 @@ var Axios = class {
45410
45413
  config2 = mergeConfig(this.defaults, config2);
45411
45414
  const { transitional: transitional2, paramsSerializer, headers } = config2;
45412
45415
  if (transitional2 !== void 0) {
45413
- validator_default.assertOptions(
45414
- transitional2,
45415
- {
45416
- silentJSONParsing: validators2.transitional(validators2.boolean),
45417
- forcedJSONParsing: validators2.transitional(validators2.boolean),
45418
- clarifyTimeoutError: validators2.transitional(validators2.boolean),
45419
- legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
45420
- },
45421
- false
45422
- );
45416
+ validator_default.assertOptions(transitional2, {
45417
+ silentJSONParsing: validators2.transitional(validators2.boolean),
45418
+ forcedJSONParsing: validators2.transitional(validators2.boolean),
45419
+ clarifyTimeoutError: validators2.transitional(validators2.boolean),
45420
+ legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
45421
+ }, false);
45423
45422
  }
45424
45423
  if (paramsSerializer != null) {
45425
45424
  if (utils_default.isFunction(paramsSerializer)) {
@@ -45427,14 +45426,10 @@ var Axios = class {
45427
45426
  serialize: paramsSerializer
45428
45427
  };
45429
45428
  } else {
45430
- validator_default.assertOptions(
45431
- paramsSerializer,
45432
- {
45433
- encode: validators2.function,
45434
- serialize: validators2.function
45435
- },
45436
- true
45437
- );
45429
+ validator_default.assertOptions(paramsSerializer, {
45430
+ encode: validators2.function,
45431
+ serialize: validators2.function
45432
+ }, true);
45438
45433
  }
45439
45434
  }
45440
45435
  if (config2.allowAbsoluteUrls !== void 0) {
@@ -45443,19 +45438,21 @@ var Axios = class {
45443
45438
  } else {
45444
45439
  config2.allowAbsoluteUrls = true;
45445
45440
  }
45446
- validator_default.assertOptions(
45447
- config2,
45448
- {
45449
- baseUrl: validators2.spelling("baseURL"),
45450
- withXsrfToken: validators2.spelling("withXSRFToken")
45451
- },
45452
- true
45453
- );
45441
+ validator_default.assertOptions(config2, {
45442
+ baseUrl: validators2.spelling("baseURL"),
45443
+ withXsrfToken: validators2.spelling("withXSRFToken")
45444
+ }, true);
45454
45445
  config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
45455
- let contextHeaders = headers && utils_default.merge(headers.common, headers[config2.method]);
45456
- headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
45457
- delete headers[method];
45458
- });
45446
+ let contextHeaders = headers && utils_default.merge(
45447
+ headers.common,
45448
+ headers[config2.method]
45449
+ );
45450
+ headers && utils_default.forEach(
45451
+ ["delete", "get", "head", "post", "put", "patch", "common"],
45452
+ (method) => {
45453
+ delete headers[method];
45454
+ }
45455
+ );
45459
45456
  config2.headers = AxiosHeaders_default.concat(contextHeaders, headers);
45460
45457
  const requestInterceptorChain = [];
45461
45458
  let synchronousRequestInterceptors = true;
@@ -45522,28 +45519,24 @@ var Axios = class {
45522
45519
  };
45523
45520
  utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
45524
45521
  Axios.prototype[method] = function(url3, config2) {
45525
- return this.request(
45526
- mergeConfig(config2 || {}, {
45527
- method,
45528
- url: url3,
45529
- data: (config2 || {}).data
45530
- })
45531
- );
45522
+ return this.request(mergeConfig(config2 || {}, {
45523
+ method,
45524
+ url: url3,
45525
+ data: (config2 || {}).data
45526
+ }));
45532
45527
  };
45533
45528
  });
45534
45529
  utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
45535
45530
  function generateHTTPMethod(isForm) {
45536
45531
  return function httpMethod(url3, data, config2) {
45537
- return this.request(
45538
- mergeConfig(config2 || {}, {
45539
- method,
45540
- headers: isForm ? {
45541
- "Content-Type": "multipart/form-data"
45542
- } : {},
45543
- url: url3,
45544
- data
45545
- })
45546
- );
45532
+ return this.request(mergeConfig(config2 || {}, {
45533
+ method,
45534
+ headers: isForm ? {
45535
+ "Content-Type": "multipart/form-data"
45536
+ } : {},
45537
+ url: url3,
45538
+ data
45539
+ }));
45547
45540
  };
45548
45541
  }
45549
45542
  Axios.prototype[method] = generateHTTPMethod();
@@ -45821,19 +45814,6 @@ var isName = function(string4) {
45821
45814
  function isExist(v) {
45822
45815
  return typeof v !== "undefined";
45823
45816
  }
45824
- var DANGEROUS_PROPERTY_NAMES = [
45825
- // '__proto__',
45826
- // 'constructor',
45827
- // 'prototype',
45828
- "hasOwnProperty",
45829
- "toString",
45830
- "valueOf",
45831
- "__defineGetter__",
45832
- "__defineSetter__",
45833
- "__lookupGetter__",
45834
- "__lookupSetter__"
45835
- ];
45836
- var criticalProperties = ["__proto__", "constructor", "prototype"];
45837
45817
 
45838
45818
  // ../node_modules/fast-xml-parser/src/validator.js
45839
45819
  var defaultOptions2 = {
@@ -46142,12 +46122,6 @@ function getPositionFromMatch(match) {
46142
46122
  }
46143
46123
 
46144
46124
  // ../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
46145
- var defaultOnDangerousProperty = (name) => {
46146
- if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
46147
- return "__" + name;
46148
- }
46149
- return name;
46150
- };
46151
46125
  var defaultOptions3 = {
46152
46126
  preserveOrder: false,
46153
46127
  attributeNamePrefix: "@_",
@@ -46193,27 +46167,8 @@ var defaultOptions3 = {
46193
46167
  // skipEmptyListItem: false
46194
46168
  captureMetaData: false,
46195
46169
  maxNestedTags: 100,
46196
- strictReservedNames: true,
46197
- jPath: true,
46198
- // if true, pass jPath string to callbacks; if false, pass matcher instance
46199
- onDangerousProperty: defaultOnDangerousProperty
46170
+ strictReservedNames: true
46200
46171
  };
46201
- function validatePropertyName(propertyName, optionName) {
46202
- if (typeof propertyName !== "string") {
46203
- return;
46204
- }
46205
- const normalized = propertyName.toLowerCase();
46206
- if (DANGEROUS_PROPERTY_NAMES.some((dangerous) => normalized === dangerous.toLowerCase())) {
46207
- throw new Error(
46208
- `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
46209
- );
46210
- }
46211
- if (criticalProperties.some((dangerous) => normalized === dangerous.toLowerCase())) {
46212
- throw new Error(
46213
- `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
46214
- );
46215
- }
46216
- }
46217
46172
  function normalizeProcessEntities(value) {
46218
46173
  if (typeof value === "boolean") {
46219
46174
  return {
@@ -46223,7 +46178,6 @@ function normalizeProcessEntities(value) {
46223
46178
  maxExpansionDepth: 10,
46224
46179
  maxTotalExpansions: 1e3,
46225
46180
  maxExpandedLength: 1e5,
46226
- maxEntityCount: 100,
46227
46181
  allowedTags: null,
46228
46182
  tagFilter: null
46229
46183
  };
@@ -46231,11 +46185,11 @@ function normalizeProcessEntities(value) {
46231
46185
  if (typeof value === "object" && value !== null) {
46232
46186
  return {
46233
46187
  enabled: value.enabled !== false,
46234
- maxEntitySize: Math.max(1, value.maxEntitySize ?? 1e4),
46235
- maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10),
46236
- maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? 1e3),
46237
- maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
46238
- maxEntityCount: Math.max(1, value.maxEntityCount ?? 100),
46188
+ // default true if not specified
46189
+ maxEntitySize: value.maxEntitySize ?? 1e4,
46190
+ maxExpansionDepth: value.maxExpansionDepth ?? 10,
46191
+ maxTotalExpansions: value.maxTotalExpansions ?? 1e3,
46192
+ maxExpandedLength: value.maxExpandedLength ?? 1e5,
46239
46193
  allowedTags: value.allowedTags ?? null,
46240
46194
  tagFilter: value.tagFilter ?? null
46241
46195
  };
@@ -46244,30 +46198,7 @@ function normalizeProcessEntities(value) {
46244
46198
  }
46245
46199
  var buildOptions = function(options) {
46246
46200
  const built = Object.assign({}, defaultOptions3, options);
46247
- const propertyNameOptions = [
46248
- { value: built.attributeNamePrefix, name: "attributeNamePrefix" },
46249
- { value: built.attributesGroupName, name: "attributesGroupName" },
46250
- { value: built.textNodeName, name: "textNodeName" },
46251
- { value: built.cdataPropName, name: "cdataPropName" },
46252
- { value: built.commentPropName, name: "commentPropName" }
46253
- ];
46254
- for (const { value, name } of propertyNameOptions) {
46255
- if (value) {
46256
- validatePropertyName(value, name);
46257
- }
46258
- }
46259
- if (built.onDangerousProperty === null) {
46260
- built.onDangerousProperty = defaultOnDangerousProperty;
46261
- }
46262
46201
  built.processEntities = normalizeProcessEntities(built.processEntities);
46263
- if (built.stopNodes && Array.isArray(built.stopNodes)) {
46264
- built.stopNodes = built.stopNodes.map((node) => {
46265
- if (typeof node === "string" && node.startsWith("*.")) {
46266
- return ".." + node.substring(2);
46267
- }
46268
- return node;
46269
- });
46270
- }
46271
46202
  return built;
46272
46203
  };
46273
46204
 
@@ -46313,7 +46244,6 @@ var DocTypeReader = class {
46313
46244
  }
46314
46245
  readDocType(xmlData, i) {
46315
46246
  const entities = /* @__PURE__ */ Object.create(null);
46316
- let entityCount = 0;
46317
46247
  if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
46318
46248
  i = i + 9;
46319
46249
  let angleBracketsCount = 1;
@@ -46326,17 +46256,11 @@ var DocTypeReader = class {
46326
46256
  let entityName, val;
46327
46257
  [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
46328
46258
  if (val.indexOf("&") === -1) {
46329
- if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
46330
- throw new Error(
46331
- `Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
46332
- );
46333
- }
46334
- const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
46259
+ const escaped = entityName.replace(/[.\-+*:]/g, "\\.");
46335
46260
  entities[entityName] = {
46336
46261
  regx: RegExp(`&${escaped};`, "g"),
46337
46262
  val
46338
46263
  };
46339
- entityCount++;
46340
46264
  }
46341
46265
  } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
46342
46266
  i += 8;
@@ -46380,11 +46304,11 @@ var DocTypeReader = class {
46380
46304
  }
46381
46305
  readEntityExp(xmlData, i) {
46382
46306
  i = skipWhitespace(xmlData, i);
46383
- const startIndex = i;
46307
+ let entityName = "";
46384
46308
  while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
46309
+ entityName += xmlData[i];
46385
46310
  i++;
46386
46311
  }
46387
- let entityName = xmlData.substring(startIndex, i);
46388
46312
  validateEntityName(entityName);
46389
46313
  i = skipWhitespace(xmlData, i);
46390
46314
  if (!this.suppressValidationErr) {
@@ -46396,7 +46320,7 @@ var DocTypeReader = class {
46396
46320
  }
46397
46321
  let entityValue = "";
46398
46322
  [i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
46399
- if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
46323
+ if (this.options.enabled !== false && this.options.maxEntitySize && entityValue.length > this.options.maxEntitySize) {
46400
46324
  throw new Error(
46401
46325
  `Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
46402
46326
  );
@@ -46406,11 +46330,11 @@ var DocTypeReader = class {
46406
46330
  }
46407
46331
  readNotationExp(xmlData, i) {
46408
46332
  i = skipWhitespace(xmlData, i);
46409
- const startIndex = i;
46333
+ let notationName = "";
46410
46334
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
46335
+ notationName += xmlData[i];
46411
46336
  i++;
46412
46337
  }
46413
- let notationName = xmlData.substring(startIndex, i);
46414
46338
  !this.suppressValidationErr && validateEntityName(notationName);
46415
46339
  i = skipWhitespace(xmlData, i);
46416
46340
  const identifierType = xmlData.substring(i, i + 6).toUpperCase();
@@ -46442,11 +46366,10 @@ var DocTypeReader = class {
46442
46366
  throw new Error(`Expected quoted string, found "${startChar}"`);
46443
46367
  }
46444
46368
  i++;
46445
- const startIndex = i;
46446
46369
  while (i < xmlData.length && xmlData[i] !== startChar) {
46370
+ identifierVal += xmlData[i];
46447
46371
  i++;
46448
46372
  }
46449
- identifierVal = xmlData.substring(startIndex, i);
46450
46373
  if (xmlData[i] !== startChar) {
46451
46374
  throw new Error(`Unterminated ${type} value`);
46452
46375
  }
@@ -46455,11 +46378,11 @@ var DocTypeReader = class {
46455
46378
  }
46456
46379
  readElementExp(xmlData, i) {
46457
46380
  i = skipWhitespace(xmlData, i);
46458
- const startIndex = i;
46381
+ let elementName = "";
46459
46382
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
46383
+ elementName += xmlData[i];
46460
46384
  i++;
46461
46385
  }
46462
- let elementName = xmlData.substring(startIndex, i);
46463
46386
  if (!this.suppressValidationErr && !isName(elementName)) {
46464
46387
  throw new Error(`Invalid element name: "${elementName}"`);
46465
46388
  }
@@ -46469,11 +46392,10 @@ var DocTypeReader = class {
46469
46392
  else if (xmlData[i] === "A" && hasSeq(xmlData, "NY", i)) i += 2;
46470
46393
  else if (xmlData[i] === "(") {
46471
46394
  i++;
46472
- const startIndex2 = i;
46473
46395
  while (i < xmlData.length && xmlData[i] !== ")") {
46396
+ contentModel += xmlData[i];
46474
46397
  i++;
46475
46398
  }
46476
- contentModel = xmlData.substring(startIndex2, i);
46477
46399
  if (xmlData[i] !== ")") {
46478
46400
  throw new Error("Unterminated content model");
46479
46401
  }
@@ -46488,18 +46410,18 @@ var DocTypeReader = class {
46488
46410
  }
46489
46411
  readAttlistExp(xmlData, i) {
46490
46412
  i = skipWhitespace(xmlData, i);
46491
- let startIndex = i;
46413
+ let elementName = "";
46492
46414
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
46415
+ elementName += xmlData[i];
46493
46416
  i++;
46494
46417
  }
46495
- let elementName = xmlData.substring(startIndex, i);
46496
46418
  validateEntityName(elementName);
46497
46419
  i = skipWhitespace(xmlData, i);
46498
- startIndex = i;
46420
+ let attributeName = "";
46499
46421
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
46422
+ attributeName += xmlData[i];
46500
46423
  i++;
46501
46424
  }
46502
- let attributeName = xmlData.substring(startIndex, i);
46503
46425
  if (!validateEntityName(attributeName)) {
46504
46426
  throw new Error(`Invalid attribute name: "${attributeName}"`);
46505
46427
  }
@@ -46515,11 +46437,11 @@ var DocTypeReader = class {
46515
46437
  i++;
46516
46438
  let allowedNotations = [];
46517
46439
  while (i < xmlData.length && xmlData[i] !== ")") {
46518
- const startIndex2 = i;
46440
+ let notation = "";
46519
46441
  while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
46442
+ notation += xmlData[i];
46520
46443
  i++;
46521
46444
  }
46522
- let notation = xmlData.substring(startIndex2, i);
46523
46445
  notation = notation.trim();
46524
46446
  if (!validateEntityName(notation)) {
46525
46447
  throw new Error(`Invalid notation name: "${notation}"`);
@@ -46536,11 +46458,10 @@ var DocTypeReader = class {
46536
46458
  i++;
46537
46459
  attributeType += " (" + allowedNotations.join("|") + ")";
46538
46460
  } else {
46539
- const startIndex2 = i;
46540
46461
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
46462
+ attributeType += xmlData[i];
46541
46463
  i++;
46542
46464
  }
46543
- attributeType += xmlData.substring(startIndex2, i);
46544
46465
  const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
46545
46466
  if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
46546
46467
  throw new Error(`Invalid attribute type: "${attributeType}"`);
@@ -46593,22 +46514,17 @@ var consider = {
46593
46514
  // oct: false,
46594
46515
  leadingZeros: true,
46595
46516
  decimalPoint: ".",
46596
- eNotation: true,
46597
- //skipLike: /regex/,
46598
- infinity: "original"
46599
- // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
46517
+ eNotation: true
46518
+ //skipLike: /regex/
46600
46519
  };
46601
46520
  function toNumber(str, options = {}) {
46602
46521
  options = Object.assign({}, consider, options);
46603
46522
  if (!str || typeof str !== "string") return str;
46604
46523
  let trimmedStr = str.trim();
46605
- if (trimmedStr.length === 0) return str;
46606
- else if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
46607
- else if (trimmedStr === "0") return 0;
46524
+ if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
46525
+ else if (str === "0") return 0;
46608
46526
  else if (options.hex && hexRegex.test(trimmedStr)) {
46609
46527
  return parse_int(trimmedStr, 16);
46610
- } else if (!isFinite(trimmedStr)) {
46611
- return handleInfinity(str, Number(trimmedStr), options);
46612
46528
  } else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
46613
46529
  return resolveEnotation(str, trimmedStr, options);
46614
46530
  } else {
@@ -46663,14 +46579,10 @@ function resolveEnotation(str, trimmedStr, options) {
46663
46579
  if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str;
46664
46580
  else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) {
46665
46581
  return Number(trimmedStr);
46666
- } else if (leadingZeros.length > 0) {
46667
- if (options.leadingZeros && !eAdjacentToLeadingZeros) {
46668
- trimmedStr = (notation[1] || "") + notation[3];
46669
- return Number(trimmedStr);
46670
- } else return str;
46671
- } else {
46582
+ } else if (options.leadingZeros && !eAdjacentToLeadingZeros) {
46583
+ trimmedStr = (notation[1] || "") + notation[3];
46672
46584
  return Number(trimmedStr);
46673
- }
46585
+ } else return str;
46674
46586
  } else {
46675
46587
  return str;
46676
46588
  }
@@ -46691,21 +46603,6 @@ function parse_int(numStr, base) {
46691
46603
  else if (window && window.parseInt) return window.parseInt(numStr, base);
46692
46604
  else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
46693
46605
  }
46694
- function handleInfinity(str, num, options) {
46695
- const isPositive = num === Infinity;
46696
- switch (options.infinity.toLowerCase()) {
46697
- case "null":
46698
- return null;
46699
- case "infinity":
46700
- return num;
46701
- // Return Infinity or -Infinity
46702
- case "string":
46703
- return isPositive ? "Infinity" : "-Infinity";
46704
- case "original":
46705
- default:
46706
- return str;
46707
- }
46708
- }
46709
46606
 
46710
46607
  // ../node_modules/fast-xml-parser/src/ignoreAttributes.js
46711
46608
  function getIgnoreAttributesFn(ignoreAttributes) {
@@ -46727,567 +46624,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
46727
46624
  return () => false;
46728
46625
  }
46729
46626
 
46730
- // ../node_modules/path-expression-matcher/src/Expression.js
46731
- var Expression = class {
46732
- /**
46733
- * Create a new Expression
46734
- * @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
46735
- * @param {Object} options - Configuration options
46736
- * @param {string} options.separator - Path separator (default: '.')
46737
- */
46738
- constructor(pattern, options = {}) {
46739
- this.pattern = pattern;
46740
- this.separator = options.separator || ".";
46741
- this.segments = this._parse(pattern);
46742
- this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
46743
- this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
46744
- this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
46745
- }
46746
- /**
46747
- * Parse pattern string into segments
46748
- * @private
46749
- * @param {string} pattern - Pattern to parse
46750
- * @returns {Array} Array of segment objects
46751
- */
46752
- _parse(pattern) {
46753
- const segments = [];
46754
- let i = 0;
46755
- let currentPart = "";
46756
- while (i < pattern.length) {
46757
- if (pattern[i] === this.separator) {
46758
- if (i + 1 < pattern.length && pattern[i + 1] === this.separator) {
46759
- if (currentPart.trim()) {
46760
- segments.push(this._parseSegment(currentPart.trim()));
46761
- currentPart = "";
46762
- }
46763
- segments.push({ type: "deep-wildcard" });
46764
- i += 2;
46765
- } else {
46766
- if (currentPart.trim()) {
46767
- segments.push(this._parseSegment(currentPart.trim()));
46768
- }
46769
- currentPart = "";
46770
- i++;
46771
- }
46772
- } else {
46773
- currentPart += pattern[i];
46774
- i++;
46775
- }
46776
- }
46777
- if (currentPart.trim()) {
46778
- segments.push(this._parseSegment(currentPart.trim()));
46779
- }
46780
- return segments;
46781
- }
46782
- /**
46783
- * Parse a single segment
46784
- * @private
46785
- * @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
46786
- * @returns {Object} Segment object
46787
- */
46788
- _parseSegment(part) {
46789
- const segment = { type: "tag" };
46790
- let bracketContent = null;
46791
- let withoutBrackets = part;
46792
- const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
46793
- if (bracketMatch) {
46794
- withoutBrackets = bracketMatch[1] + bracketMatch[3];
46795
- if (bracketMatch[2]) {
46796
- const content = bracketMatch[2].slice(1, -1);
46797
- if (content) {
46798
- bracketContent = content;
46799
- }
46800
- }
46801
- }
46802
- let namespace = void 0;
46803
- let tagAndPosition = withoutBrackets;
46804
- if (withoutBrackets.includes("::")) {
46805
- const nsIndex = withoutBrackets.indexOf("::");
46806
- namespace = withoutBrackets.substring(0, nsIndex).trim();
46807
- tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
46808
- if (!namespace) {
46809
- throw new Error(`Invalid namespace in pattern: ${part}`);
46810
- }
46811
- }
46812
- let tag = void 0;
46813
- let positionMatch = null;
46814
- if (tagAndPosition.includes(":")) {
46815
- const colonIndex = tagAndPosition.lastIndexOf(":");
46816
- const tagPart = tagAndPosition.substring(0, colonIndex).trim();
46817
- const posPart = tagAndPosition.substring(colonIndex + 1).trim();
46818
- const isPositionKeyword = ["first", "last", "odd", "even"].includes(posPart) || /^nth\(\d+\)$/.test(posPart);
46819
- if (isPositionKeyword) {
46820
- tag = tagPart;
46821
- positionMatch = posPart;
46822
- } else {
46823
- tag = tagAndPosition;
46824
- }
46825
- } else {
46826
- tag = tagAndPosition;
46827
- }
46828
- if (!tag) {
46829
- throw new Error(`Invalid segment pattern: ${part}`);
46830
- }
46831
- segment.tag = tag;
46832
- if (namespace) {
46833
- segment.namespace = namespace;
46834
- }
46835
- if (bracketContent) {
46836
- if (bracketContent.includes("=")) {
46837
- const eqIndex = bracketContent.indexOf("=");
46838
- segment.attrName = bracketContent.substring(0, eqIndex).trim();
46839
- segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
46840
- } else {
46841
- segment.attrName = bracketContent.trim();
46842
- }
46843
- }
46844
- if (positionMatch) {
46845
- const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
46846
- if (nthMatch) {
46847
- segment.position = "nth";
46848
- segment.positionValue = parseInt(nthMatch[1], 10);
46849
- } else {
46850
- segment.position = positionMatch;
46851
- }
46852
- }
46853
- return segment;
46854
- }
46855
- /**
46856
- * Get the number of segments
46857
- * @returns {number}
46858
- */
46859
- get length() {
46860
- return this.segments.length;
46861
- }
46862
- /**
46863
- * Check if expression contains deep wildcard
46864
- * @returns {boolean}
46865
- */
46866
- hasDeepWildcard() {
46867
- return this._hasDeepWildcard;
46868
- }
46869
- /**
46870
- * Check if expression has attribute conditions
46871
- * @returns {boolean}
46872
- */
46873
- hasAttributeCondition() {
46874
- return this._hasAttributeCondition;
46875
- }
46876
- /**
46877
- * Check if expression has position selectors
46878
- * @returns {boolean}
46879
- */
46880
- hasPositionSelector() {
46881
- return this._hasPositionSelector;
46882
- }
46883
- /**
46884
- * Get string representation
46885
- * @returns {string}
46886
- */
46887
- toString() {
46888
- return this.pattern;
46889
- }
46890
- };
46891
-
46892
- // ../node_modules/path-expression-matcher/src/Matcher.js
46893
- var MUTATING_METHODS = /* @__PURE__ */ new Set(["push", "pop", "reset", "updateCurrent", "restore"]);
46894
- var Matcher = class {
46895
- /**
46896
- * Create a new Matcher
46897
- * @param {Object} options - Configuration options
46898
- * @param {string} options.separator - Default path separator (default: '.')
46899
- */
46900
- constructor(options = {}) {
46901
- this.separator = options.separator || ".";
46902
- this.path = [];
46903
- this.siblingStacks = [];
46904
- }
46905
- /**
46906
- * Push a new tag onto the path
46907
- * @param {string} tagName - Name of the tag
46908
- * @param {Object} attrValues - Attribute key-value pairs for current node (optional)
46909
- * @param {string} namespace - Namespace for the tag (optional)
46910
- */
46911
- push(tagName, attrValues = null, namespace = null) {
46912
- if (this.path.length > 0) {
46913
- const prev = this.path[this.path.length - 1];
46914
- prev.values = void 0;
46915
- }
46916
- const currentLevel = this.path.length;
46917
- if (!this.siblingStacks[currentLevel]) {
46918
- this.siblingStacks[currentLevel] = /* @__PURE__ */ new Map();
46919
- }
46920
- const siblings = this.siblingStacks[currentLevel];
46921
- const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
46922
- const counter = siblings.get(siblingKey) || 0;
46923
- let position = 0;
46924
- for (const count of siblings.values()) {
46925
- position += count;
46926
- }
46927
- siblings.set(siblingKey, counter + 1);
46928
- const node = {
46929
- tag: tagName,
46930
- position,
46931
- counter
46932
- };
46933
- if (namespace !== null && namespace !== void 0) {
46934
- node.namespace = namespace;
46935
- }
46936
- if (attrValues !== null && attrValues !== void 0) {
46937
- node.values = attrValues;
46938
- }
46939
- this.path.push(node);
46940
- }
46941
- /**
46942
- * Pop the last tag from the path
46943
- * @returns {Object|undefined} The popped node
46944
- */
46945
- pop() {
46946
- if (this.path.length === 0) {
46947
- return void 0;
46948
- }
46949
- const node = this.path.pop();
46950
- if (this.siblingStacks.length > this.path.length + 1) {
46951
- this.siblingStacks.length = this.path.length + 1;
46952
- }
46953
- return node;
46954
- }
46955
- /**
46956
- * Update current node's attribute values
46957
- * Useful when attributes are parsed after push
46958
- * @param {Object} attrValues - Attribute values
46959
- */
46960
- updateCurrent(attrValues) {
46961
- if (this.path.length > 0) {
46962
- const current = this.path[this.path.length - 1];
46963
- if (attrValues !== null && attrValues !== void 0) {
46964
- current.values = attrValues;
46965
- }
46966
- }
46967
- }
46968
- /**
46969
- * Get current tag name
46970
- * @returns {string|undefined}
46971
- */
46972
- getCurrentTag() {
46973
- return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
46974
- }
46975
- /**
46976
- * Get current namespace
46977
- * @returns {string|undefined}
46978
- */
46979
- getCurrentNamespace() {
46980
- return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
46981
- }
46982
- /**
46983
- * Get current node's attribute value
46984
- * @param {string} attrName - Attribute name
46985
- * @returns {*} Attribute value or undefined
46986
- */
46987
- getAttrValue(attrName) {
46988
- if (this.path.length === 0) return void 0;
46989
- const current = this.path[this.path.length - 1];
46990
- return current.values?.[attrName];
46991
- }
46992
- /**
46993
- * Check if current node has an attribute
46994
- * @param {string} attrName - Attribute name
46995
- * @returns {boolean}
46996
- */
46997
- hasAttr(attrName) {
46998
- if (this.path.length === 0) return false;
46999
- const current = this.path[this.path.length - 1];
47000
- return current.values !== void 0 && attrName in current.values;
47001
- }
47002
- /**
47003
- * Get current node's sibling position (child index in parent)
47004
- * @returns {number}
47005
- */
47006
- getPosition() {
47007
- if (this.path.length === 0) return -1;
47008
- return this.path[this.path.length - 1].position ?? 0;
47009
- }
47010
- /**
47011
- * Get current node's repeat counter (occurrence count of this tag name)
47012
- * @returns {number}
47013
- */
47014
- getCounter() {
47015
- if (this.path.length === 0) return -1;
47016
- return this.path[this.path.length - 1].counter ?? 0;
47017
- }
47018
- /**
47019
- * Get current node's sibling index (alias for getPosition for backward compatibility)
47020
- * @returns {number}
47021
- * @deprecated Use getPosition() or getCounter() instead
47022
- */
47023
- getIndex() {
47024
- return this.getPosition();
47025
- }
47026
- /**
47027
- * Get current path depth
47028
- * @returns {number}
47029
- */
47030
- getDepth() {
47031
- return this.path.length;
47032
- }
47033
- /**
47034
- * Get path as string
47035
- * @param {string} separator - Optional separator (uses default if not provided)
47036
- * @param {boolean} includeNamespace - Whether to include namespace in output (default: true)
47037
- * @returns {string}
47038
- */
47039
- toString(separator, includeNamespace = true) {
47040
- const sep = separator || this.separator;
47041
- return this.path.map((n) => {
47042
- if (includeNamespace && n.namespace) {
47043
- return `${n.namespace}:${n.tag}`;
47044
- }
47045
- return n.tag;
47046
- }).join(sep);
47047
- }
47048
- /**
47049
- * Get path as array of tag names
47050
- * @returns {string[]}
47051
- */
47052
- toArray() {
47053
- return this.path.map((n) => n.tag);
47054
- }
47055
- /**
47056
- * Reset the path to empty
47057
- */
47058
- reset() {
47059
- this.path = [];
47060
- this.siblingStacks = [];
47061
- }
47062
- /**
47063
- * Match current path against an Expression
47064
- * @param {Expression} expression - The expression to match against
47065
- * @returns {boolean} True if current path matches the expression
47066
- */
47067
- matches(expression) {
47068
- const segments = expression.segments;
47069
- if (segments.length === 0) {
47070
- return false;
47071
- }
47072
- if (expression.hasDeepWildcard()) {
47073
- return this._matchWithDeepWildcard(segments);
47074
- }
47075
- return this._matchSimple(segments);
47076
- }
47077
- /**
47078
- * Match simple path (no deep wildcards)
47079
- * @private
47080
- */
47081
- _matchSimple(segments) {
47082
- if (this.path.length !== segments.length) {
47083
- return false;
47084
- }
47085
- for (let i = 0; i < segments.length; i++) {
47086
- const segment = segments[i];
47087
- const node = this.path[i];
47088
- const isCurrentNode = i === this.path.length - 1;
47089
- if (!this._matchSegment(segment, node, isCurrentNode)) {
47090
- return false;
47091
- }
47092
- }
47093
- return true;
47094
- }
47095
- /**
47096
- * Match path with deep wildcards
47097
- * @private
47098
- */
47099
- _matchWithDeepWildcard(segments) {
47100
- let pathIdx = this.path.length - 1;
47101
- let segIdx = segments.length - 1;
47102
- while (segIdx >= 0 && pathIdx >= 0) {
47103
- const segment = segments[segIdx];
47104
- if (segment.type === "deep-wildcard") {
47105
- segIdx--;
47106
- if (segIdx < 0) {
47107
- return true;
47108
- }
47109
- const nextSeg = segments[segIdx];
47110
- let found = false;
47111
- for (let i = pathIdx; i >= 0; i--) {
47112
- const isCurrentNode = i === this.path.length - 1;
47113
- if (this._matchSegment(nextSeg, this.path[i], isCurrentNode)) {
47114
- pathIdx = i - 1;
47115
- segIdx--;
47116
- found = true;
47117
- break;
47118
- }
47119
- }
47120
- if (!found) {
47121
- return false;
47122
- }
47123
- } else {
47124
- const isCurrentNode = pathIdx === this.path.length - 1;
47125
- if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
47126
- return false;
47127
- }
47128
- pathIdx--;
47129
- segIdx--;
47130
- }
47131
- }
47132
- return segIdx < 0;
47133
- }
47134
- /**
47135
- * Match a single segment against a node
47136
- * @private
47137
- * @param {Object} segment - Segment from Expression
47138
- * @param {Object} node - Node from path
47139
- * @param {boolean} isCurrentNode - Whether this is the current (last) node
47140
- * @returns {boolean}
47141
- */
47142
- _matchSegment(segment, node, isCurrentNode) {
47143
- if (segment.tag !== "*" && segment.tag !== node.tag) {
47144
- return false;
47145
- }
47146
- if (segment.namespace !== void 0) {
47147
- if (segment.namespace !== "*" && segment.namespace !== node.namespace) {
47148
- return false;
47149
- }
47150
- }
47151
- if (segment.attrName !== void 0) {
47152
- if (!isCurrentNode) {
47153
- return false;
47154
- }
47155
- if (!node.values || !(segment.attrName in node.values)) {
47156
- return false;
47157
- }
47158
- if (segment.attrValue !== void 0) {
47159
- const actualValue = node.values[segment.attrName];
47160
- if (String(actualValue) !== String(segment.attrValue)) {
47161
- return false;
47162
- }
47163
- }
47164
- }
47165
- if (segment.position !== void 0) {
47166
- if (!isCurrentNode) {
47167
- return false;
47168
- }
47169
- const counter = node.counter ?? 0;
47170
- if (segment.position === "first" && counter !== 0) {
47171
- return false;
47172
- } else if (segment.position === "odd" && counter % 2 !== 1) {
47173
- return false;
47174
- } else if (segment.position === "even" && counter % 2 !== 0) {
47175
- return false;
47176
- } else if (segment.position === "nth") {
47177
- if (counter !== segment.positionValue) {
47178
- return false;
47179
- }
47180
- }
47181
- }
47182
- return true;
47183
- }
47184
- /**
47185
- * Create a snapshot of current state
47186
- * @returns {Object} State snapshot
47187
- */
47188
- snapshot() {
47189
- return {
47190
- path: this.path.map((node) => ({ ...node })),
47191
- siblingStacks: this.siblingStacks.map((map2) => new Map(map2))
47192
- };
47193
- }
47194
- /**
47195
- * Restore state from snapshot
47196
- * @param {Object} snapshot - State snapshot
47197
- */
47198
- restore(snapshot) {
47199
- this.path = snapshot.path.map((node) => ({ ...node }));
47200
- this.siblingStacks = snapshot.siblingStacks.map((map2) => new Map(map2));
47201
- }
47202
- /**
47203
- * Return a read-only view of this matcher.
47204
- *
47205
- * The returned object exposes all query/inspection methods but throws a
47206
- * TypeError if any state-mutating method is called (`push`, `pop`, `reset`,
47207
- * `updateCurrent`, `restore`). Property reads (e.g. `.path`, `.separator`)
47208
- * are allowed but the returned arrays/objects are frozen so callers cannot
47209
- * mutate internal state through them either.
47210
- *
47211
- * @returns {ReadOnlyMatcher} A proxy that forwards read operations and blocks writes.
47212
- *
47213
- * @example
47214
- * const matcher = new Matcher();
47215
- * matcher.push("root", {});
47216
- *
47217
- * const ro = matcher.readOnly();
47218
- * ro.matches(expr); // ✓ works
47219
- * ro.getCurrentTag(); // ✓ works
47220
- * ro.push("child", {}); // ✗ throws TypeError
47221
- * ro.reset(); // ✗ throws TypeError
47222
- */
47223
- readOnly() {
47224
- const self2 = this;
47225
- return new Proxy(self2, {
47226
- get(target, prop, receiver) {
47227
- if (MUTATING_METHODS.has(prop)) {
47228
- return () => {
47229
- throw new TypeError(
47230
- `Cannot call '${prop}' on a read-only Matcher. Obtain a writable instance to mutate state.`
47231
- );
47232
- };
47233
- }
47234
- const value = Reflect.get(target, prop, receiver);
47235
- if (prop === "path" || prop === "siblingStacks") {
47236
- return Object.freeze(
47237
- Array.isArray(value) ? value.map(
47238
- (item) => item instanceof Map ? Object.freeze(new Map(item)) : Object.freeze({ ...item })
47239
- // freeze a copy of each node
47240
- ) : value
47241
- );
47242
- }
47243
- if (typeof value === "function") {
47244
- return value.bind(target);
47245
- }
47246
- return value;
47247
- },
47248
- // Prevent any property assignment on the read-only view
47249
- set(_target, prop) {
47250
- throw new TypeError(
47251
- `Cannot set property '${String(prop)}' on a read-only Matcher.`
47252
- );
47253
- },
47254
- // Prevent property deletion
47255
- deleteProperty(_target, prop) {
47256
- throw new TypeError(
47257
- `Cannot delete property '${String(prop)}' from a read-only Matcher.`
47258
- );
47259
- }
47260
- });
47261
- }
47262
- };
47263
-
47264
46627
  // ../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
47265
- function extractRawAttributes(prefixedAttrs, options) {
47266
- if (!prefixedAttrs) return {};
47267
- const attrs = options.attributesGroupName ? prefixedAttrs[options.attributesGroupName] : prefixedAttrs;
47268
- if (!attrs) return {};
47269
- const rawAttrs = {};
47270
- for (const key in attrs) {
47271
- if (key.startsWith(options.attributeNamePrefix)) {
47272
- const rawName = key.substring(options.attributeNamePrefix.length);
47273
- rawAttrs[rawName] = attrs[key];
47274
- } else {
47275
- rawAttrs[key] = attrs[key];
47276
- }
47277
- }
47278
- return rawAttrs;
47279
- }
47280
- function extractNamespace(rawTagName) {
47281
- if (!rawTagName || typeof rawTagName !== "string") return void 0;
47282
- const colonIndex = rawTagName.indexOf(":");
47283
- if (colonIndex !== -1 && colonIndex > 0) {
47284
- const ns = rawTagName.substring(0, colonIndex);
47285
- if (ns !== "xmlns") {
47286
- return ns;
47287
- }
47288
- }
47289
- return void 0;
47290
- }
47291
46628
  var OrderedObjParser = class {
47292
46629
  constructor(options) {
47293
46630
  this.options = options;
@@ -47331,17 +46668,16 @@ var OrderedObjParser = class {
47331
46668
  this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
47332
46669
  this.entityExpansionCount = 0;
47333
46670
  this.currentExpandedLength = 0;
47334
- this.matcher = new Matcher();
47335
- this.readonlyMatcher = this.matcher.readOnly();
47336
- this.isCurrentNodeStopNode = false;
47337
46671
  if (this.options.stopNodes && this.options.stopNodes.length > 0) {
47338
- this.stopNodeExpressions = [];
46672
+ this.stopNodesExact = /* @__PURE__ */ new Set();
46673
+ this.stopNodesWildcard = /* @__PURE__ */ new Set();
47339
46674
  for (let i = 0; i < this.options.stopNodes.length; i++) {
47340
46675
  const stopNodeExp = this.options.stopNodes[i];
47341
- if (typeof stopNodeExp === "string") {
47342
- this.stopNodeExpressions.push(new Expression(stopNodeExp));
47343
- } else if (stopNodeExp instanceof Expression) {
47344
- this.stopNodeExpressions.push(stopNodeExp);
46676
+ if (typeof stopNodeExp !== "string") continue;
46677
+ if (stopNodeExp.startsWith("*.")) {
46678
+ this.stopNodesWildcard.add(stopNodeExp.substring(2));
46679
+ } else {
46680
+ this.stopNodesExact.add(stopNodeExp);
47345
46681
  }
47346
46682
  }
47347
46683
  }
@@ -47365,8 +46701,7 @@ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode,
47365
46701
  }
47366
46702
  if (val.length > 0) {
47367
46703
  if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
47368
- const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
47369
- const newval = this.options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
46704
+ const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
47370
46705
  if (newval === null || newval === void 0) {
47371
46706
  return val;
47372
46707
  } else if (typeof newval !== typeof val || newval !== val) {
@@ -47403,26 +46738,9 @@ function buildAttributesMap(attrStr, jPath, tagName) {
47403
46738
  const matches = getAllMatches(attrStr, attrsRegx);
47404
46739
  const len = matches.length;
47405
46740
  const attrs = {};
47406
- const rawAttrsForMatcher = {};
47407
46741
  for (let i = 0; i < len; i++) {
47408
46742
  const attrName = this.resolveNameSpace(matches[i][1]);
47409
- const oldVal = matches[i][4];
47410
- if (attrName.length && oldVal !== void 0) {
47411
- let parsedVal = oldVal;
47412
- if (this.options.trimValues) {
47413
- parsedVal = parsedVal.trim();
47414
- }
47415
- parsedVal = this.replaceEntitiesValue(parsedVal, tagName, this.readonlyMatcher);
47416
- rawAttrsForMatcher[attrName] = parsedVal;
47417
- }
47418
- }
47419
- if (Object.keys(rawAttrsForMatcher).length > 0 && typeof jPath === "object" && jPath.updateCurrent) {
47420
- jPath.updateCurrent(rawAttrsForMatcher);
47421
- }
47422
- for (let i = 0; i < len; i++) {
47423
- const attrName = this.resolveNameSpace(matches[i][1]);
47424
- const jPathStr = this.options.jPath ? jPath.toString() : this.readonlyMatcher;
47425
- if (this.ignoreAttributesFn(attrName, jPathStr)) {
46743
+ if (this.ignoreAttributesFn(attrName, jPath)) {
47426
46744
  continue;
47427
46745
  }
47428
46746
  let oldVal = matches[i][4];
@@ -47431,14 +46749,13 @@ function buildAttributesMap(attrStr, jPath, tagName) {
47431
46749
  if (this.options.transformAttributeName) {
47432
46750
  aName = this.options.transformAttributeName(aName);
47433
46751
  }
47434
- aName = sanitizeName(aName, this.options);
46752
+ if (aName === "__proto__") aName = "#__proto__";
47435
46753
  if (oldVal !== void 0) {
47436
46754
  if (this.options.trimValues) {
47437
46755
  oldVal = oldVal.trim();
47438
46756
  }
47439
- oldVal = this.replaceEntitiesValue(oldVal, tagName, this.readonlyMatcher);
47440
- const jPathOrMatcher = this.options.jPath ? jPath.toString() : this.readonlyMatcher;
47441
- const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPathOrMatcher);
46757
+ oldVal = this.replaceEntitiesValue(oldVal, tagName, jPath);
46758
+ const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
47442
46759
  if (newVal === null || newVal === void 0) {
47443
46760
  attrs[aName] = oldVal;
47444
46761
  } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
@@ -47471,7 +46788,7 @@ var parseXml = function(xmlData) {
47471
46788
  const xmlObj = new XmlNode("!xml");
47472
46789
  let currentNode = xmlObj;
47473
46790
  let textData = "";
47474
- this.matcher.reset();
46791
+ let jPath = "";
47475
46792
  this.entityExpansionCount = 0;
47476
46793
  this.currentExpandedLength = 0;
47477
46794
  const docTypeReader = new DocTypeReader(this.options.processEntities);
@@ -47487,42 +46804,46 @@ var parseXml = function(xmlData) {
47487
46804
  tagName = tagName.substr(colonIndex + 1);
47488
46805
  }
47489
46806
  }
47490
- tagName = transformTagName(this.options.transformTagName, tagName, "", this.options).tagName;
46807
+ if (this.options.transformTagName) {
46808
+ tagName = this.options.transformTagName(tagName);
46809
+ }
47491
46810
  if (currentNode) {
47492
- textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
46811
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
47493
46812
  }
47494
- const lastTagName = this.matcher.getCurrentTag();
46813
+ const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
47495
46814
  if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
47496
46815
  throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
47497
46816
  }
46817
+ let propIndex = 0;
47498
46818
  if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
47499
- this.matcher.pop();
46819
+ propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
47500
46820
  this.tagsNodeStack.pop();
46821
+ } else {
46822
+ propIndex = jPath.lastIndexOf(".");
47501
46823
  }
47502
- this.matcher.pop();
47503
- this.isCurrentNodeStopNode = false;
46824
+ jPath = jPath.substring(0, propIndex);
47504
46825
  currentNode = this.tagsNodeStack.pop();
47505
46826
  textData = "";
47506
46827
  i = closeIndex;
47507
46828
  } else if (xmlData[i + 1] === "?") {
47508
46829
  let tagData = readTagExp(xmlData, i, false, "?>");
47509
46830
  if (!tagData) throw new Error("Pi Tag is not closed.");
47510
- textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
46831
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
47511
46832
  if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {
47512
46833
  } else {
47513
46834
  const childNode = new XmlNode(tagData.tagName);
47514
46835
  childNode.add(this.options.textNodeName, "");
47515
46836
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
47516
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
46837
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
47517
46838
  }
47518
- this.addChild(currentNode, childNode, this.readonlyMatcher, i);
46839
+ this.addChild(currentNode, childNode, jPath, i);
47519
46840
  }
47520
46841
  i = tagData.closeIndex + 1;
47521
46842
  } else if (xmlData.substr(i + 1, 3) === "!--") {
47522
46843
  const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
47523
46844
  if (this.options.commentPropName) {
47524
46845
  const comment = xmlData.substring(i + 4, endIndex - 2);
47525
- textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
46846
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
47526
46847
  currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
47527
46848
  }
47528
46849
  i = endIndex;
@@ -47533,8 +46854,8 @@ var parseXml = function(xmlData) {
47533
46854
  } else if (xmlData.substr(i + 1, 2) === "![") {
47534
46855
  const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
47535
46856
  const tagExp = xmlData.substring(i + 9, closeIndex);
47536
- textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
47537
- let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
46857
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
46858
+ let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
47538
46859
  if (val == void 0) val = "";
47539
46860
  if (this.options.cdataPropName) {
47540
46861
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
@@ -47544,60 +46865,45 @@ var parseXml = function(xmlData) {
47544
46865
  i = closeIndex + 2;
47545
46866
  } else {
47546
46867
  let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
47547
- if (!result) {
47548
- const context = xmlData.substring(Math.max(0, i - 50), Math.min(xmlData.length, i + 50));
47549
- throw new Error(`readTagExp returned undefined at position ${i}. Context: "${context}"`);
47550
- }
47551
46868
  let tagName = result.tagName;
47552
46869
  const rawTagName = result.rawTagName;
47553
46870
  let tagExp = result.tagExp;
47554
46871
  let attrExpPresent = result.attrExpPresent;
47555
46872
  let closeIndex = result.closeIndex;
47556
- ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
47557
- if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName || tagName === this.options.textNodeName || tagName === this.options.attributesGroupName)) {
46873
+ if (this.options.transformTagName) {
46874
+ const newTagName = this.options.transformTagName(tagName);
46875
+ if (tagExp === tagName) {
46876
+ tagExp = newTagName;
46877
+ }
46878
+ tagName = newTagName;
46879
+ }
46880
+ if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName)) {
47558
46881
  throw new Error(`Invalid tag name: ${tagName}`);
47559
46882
  }
47560
46883
  if (currentNode && textData) {
47561
46884
  if (currentNode.tagname !== "!xml") {
47562
- textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher, false);
46885
+ textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
47563
46886
  }
47564
46887
  }
47565
46888
  const lastTag = currentNode;
47566
46889
  if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
47567
46890
  currentNode = this.tagsNodeStack.pop();
47568
- this.matcher.pop();
47569
- }
47570
- let isSelfClosing = false;
47571
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
47572
- isSelfClosing = true;
47573
- if (tagName[tagName.length - 1] === "/") {
47574
- tagName = tagName.substr(0, tagName.length - 1);
47575
- tagExp = tagName;
47576
- } else {
47577
- tagExp = tagExp.substr(0, tagExp.length - 1);
47578
- }
47579
- attrExpPresent = tagName !== tagExp;
46891
+ jPath = jPath.substring(0, jPath.lastIndexOf("."));
47580
46892
  }
47581
- let prefixedAttrs = null;
47582
- let rawAttrs = {};
47583
- let namespace = void 0;
47584
- namespace = extractNamespace(rawTagName);
47585
46893
  if (tagName !== xmlObj.tagname) {
47586
- this.matcher.push(tagName, {}, namespace);
47587
- }
47588
- if (tagName !== tagExp && attrExpPresent) {
47589
- prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
47590
- if (prefixedAttrs) {
47591
- rawAttrs = extractRawAttributes(prefixedAttrs, this.options);
47592
- }
47593
- }
47594
- if (tagName !== xmlObj.tagname) {
47595
- this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher);
46894
+ jPath += jPath ? "." + tagName : tagName;
47596
46895
  }
47597
46896
  const startIndex = i;
47598
- if (this.isCurrentNodeStopNode) {
46897
+ if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
47599
46898
  let tagContent = "";
47600
- if (isSelfClosing) {
46899
+ if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
46900
+ if (tagName[tagName.length - 1] === "/") {
46901
+ tagName = tagName.substr(0, tagName.length - 1);
46902
+ jPath = jPath.substr(0, jPath.length - 1);
46903
+ tagExp = tagName;
46904
+ } else {
46905
+ tagExp = tagExp.substr(0, tagExp.length - 1);
46906
+ }
47601
46907
  i = result.closeIndex;
47602
46908
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
47603
46909
  i = result.closeIndex;
@@ -47608,31 +46914,44 @@ var parseXml = function(xmlData) {
47608
46914
  tagContent = result2.tagContent;
47609
46915
  }
47610
46916
  const childNode = new XmlNode(tagName);
47611
- if (prefixedAttrs) {
47612
- childNode[":@"] = prefixedAttrs;
46917
+ if (tagName !== tagExp && attrExpPresent) {
46918
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
47613
46919
  }
46920
+ if (tagContent) {
46921
+ tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
46922
+ }
46923
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
47614
46924
  childNode.add(this.options.textNodeName, tagContent);
47615
- this.matcher.pop();
47616
- this.isCurrentNodeStopNode = false;
47617
- this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
46925
+ this.addChild(currentNode, childNode, jPath, startIndex);
47618
46926
  } else {
47619
- if (isSelfClosing) {
47620
- ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
46927
+ if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
46928
+ if (tagName[tagName.length - 1] === "/") {
46929
+ tagName = tagName.substr(0, tagName.length - 1);
46930
+ jPath = jPath.substr(0, jPath.length - 1);
46931
+ tagExp = tagName;
46932
+ } else {
46933
+ tagExp = tagExp.substr(0, tagExp.length - 1);
46934
+ }
46935
+ if (this.options.transformTagName) {
46936
+ const newTagName = this.options.transformTagName(tagName);
46937
+ if (tagExp === tagName) {
46938
+ tagExp = newTagName;
46939
+ }
46940
+ tagName = newTagName;
46941
+ }
47621
46942
  const childNode = new XmlNode(tagName);
47622
- if (prefixedAttrs) {
47623
- childNode[":@"] = prefixedAttrs;
46943
+ if (tagName !== tagExp && attrExpPresent) {
46944
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
47624
46945
  }
47625
- this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
47626
- this.matcher.pop();
47627
- this.isCurrentNodeStopNode = false;
46946
+ this.addChild(currentNode, childNode, jPath, startIndex);
46947
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
47628
46948
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
47629
46949
  const childNode = new XmlNode(tagName);
47630
- if (prefixedAttrs) {
47631
- childNode[":@"] = prefixedAttrs;
46950
+ if (tagName !== tagExp && attrExpPresent) {
46951
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
47632
46952
  }
47633
- this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
47634
- this.matcher.pop();
47635
- this.isCurrentNodeStopNode = false;
46953
+ this.addChild(currentNode, childNode, jPath, startIndex);
46954
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
47636
46955
  i = result.closeIndex;
47637
46956
  continue;
47638
46957
  } else {
@@ -47641,10 +46960,10 @@ var parseXml = function(xmlData) {
47641
46960
  throw new Error("Maximum nested tags exceeded");
47642
46961
  }
47643
46962
  this.tagsNodeStack.push(currentNode);
47644
- if (prefixedAttrs) {
47645
- childNode[":@"] = prefixedAttrs;
46963
+ if (tagName !== tagExp && attrExpPresent) {
46964
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
47646
46965
  }
47647
- this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
46966
+ this.addChild(currentNode, childNode, jPath, startIndex);
47648
46967
  currentNode = childNode;
47649
46968
  }
47650
46969
  textData = "";
@@ -47657,10 +46976,9 @@ var parseXml = function(xmlData) {
47657
46976
  }
47658
46977
  return xmlObj.child;
47659
46978
  };
47660
- function addChild(currentNode, childNode, matcher, startIndex) {
46979
+ function addChild(currentNode, childNode, jPath, startIndex) {
47661
46980
  if (!this.options.captureMetaData) startIndex = void 0;
47662
- const jPathOrMatcher = this.options.jPath ? matcher.toString() : matcher;
47663
- const result = this.options.updateTag(childNode.tagname, jPathOrMatcher, childNode[":@"]);
46981
+ const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
47664
46982
  if (result === false) {
47665
46983
  } else if (typeof result === "string") {
47666
46984
  childNode.tagname = result;
@@ -47669,25 +46987,25 @@ function addChild(currentNode, childNode, matcher, startIndex) {
47669
46987
  currentNode.addChild(childNode, startIndex);
47670
46988
  }
47671
46989
  }
47672
- function replaceEntitiesValue(val, tagName, jPath) {
46990
+ var replaceEntitiesValue = function(val, tagName, jPath) {
46991
+ if (val.indexOf("&") === -1) {
46992
+ return val;
46993
+ }
47673
46994
  const entityConfig = this.options.processEntities;
47674
- if (!entityConfig || !entityConfig.enabled) {
46995
+ if (!entityConfig.enabled) {
47675
46996
  return val;
47676
46997
  }
47677
46998
  if (entityConfig.allowedTags) {
47678
- const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
47679
- const allowed = Array.isArray(entityConfig.allowedTags) ? entityConfig.allowedTags.includes(tagName) : entityConfig.allowedTags(tagName, jPathOrMatcher);
47680
- if (!allowed) {
46999
+ if (!entityConfig.allowedTags.includes(tagName)) {
47681
47000
  return val;
47682
47001
  }
47683
47002
  }
47684
47003
  if (entityConfig.tagFilter) {
47685
- const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
47686
- if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) {
47004
+ if (!entityConfig.tagFilter(tagName, jPath)) {
47687
47005
  return val;
47688
47006
  }
47689
47007
  }
47690
- for (const entityName of Object.keys(this.docTypeEntities)) {
47008
+ for (let entityName in this.docTypeEntities) {
47691
47009
  const entity = this.docTypeEntities[entityName];
47692
47010
  const matches = val.match(entity.regx);
47693
47011
  if (matches) {
@@ -47709,45 +47027,28 @@ function replaceEntitiesValue(val, tagName, jPath) {
47709
47027
  }
47710
47028
  }
47711
47029
  }
47712
- for (const entityName of Object.keys(this.lastEntities)) {
47030
+ if (val.indexOf("&") === -1) return val;
47031
+ for (let entityName in this.lastEntities) {
47713
47032
  const entity = this.lastEntities[entityName];
47714
- const matches = val.match(entity.regex);
47715
- if (matches) {
47716
- this.entityExpansionCount += matches.length;
47717
- if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
47718
- throw new Error(
47719
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
47720
- );
47721
- }
47722
- }
47723
47033
  val = val.replace(entity.regex, entity.val);
47724
47034
  }
47725
47035
  if (val.indexOf("&") === -1) return val;
47726
47036
  if (this.options.htmlEntities) {
47727
- for (const entityName of Object.keys(this.htmlEntities)) {
47037
+ for (let entityName in this.htmlEntities) {
47728
47038
  const entity = this.htmlEntities[entityName];
47729
- const matches = val.match(entity.regex);
47730
- if (matches) {
47731
- this.entityExpansionCount += matches.length;
47732
- if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
47733
- throw new Error(
47734
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
47735
- );
47736
- }
47737
- }
47738
47039
  val = val.replace(entity.regex, entity.val);
47739
47040
  }
47740
47041
  }
47741
47042
  val = val.replace(this.ampEntity.regex, this.ampEntity.val);
47742
47043
  return val;
47743
- }
47744
- function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
47044
+ };
47045
+ function saveTextToParentTag(textData, parentNode, jPath, isLeafNode) {
47745
47046
  if (textData) {
47746
47047
  if (isLeafNode === void 0) isLeafNode = parentNode.child.length === 0;
47747
47048
  textData = this.parseTextData(
47748
47049
  textData,
47749
47050
  parentNode.tagname,
47750
- matcher,
47051
+ jPath,
47751
47052
  false,
47752
47053
  parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
47753
47054
  isLeafNode
@@ -47758,13 +47059,9 @@ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
47758
47059
  }
47759
47060
  return textData;
47760
47061
  }
47761
- function isItStopNode(stopNodeExpressions, matcher) {
47762
- if (!stopNodeExpressions || stopNodeExpressions.length === 0) return false;
47763
- for (let i = 0; i < stopNodeExpressions.length; i++) {
47764
- if (matcher.matches(stopNodeExpressions[i])) {
47765
- return true;
47766
- }
47767
- }
47062
+ function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
47063
+ if (stopNodesWildcard && stopNodesWildcard.has(currentTagName)) return true;
47064
+ if (stopNodesExact && stopNodesExact.has(jPath)) return true;
47768
47065
  return false;
47769
47066
  }
47770
47067
  function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
@@ -47894,68 +47191,31 @@ function fromCodePoint(str, base, prefix) {
47894
47191
  return prefix + str + ";";
47895
47192
  }
47896
47193
  }
47897
- function transformTagName(fn, tagName, tagExp, options) {
47898
- if (fn) {
47899
- const newTagName = fn(tagName);
47900
- if (tagExp === tagName) {
47901
- tagExp = newTagName;
47902
- }
47903
- tagName = newTagName;
47904
- }
47905
- tagName = sanitizeName(tagName, options);
47906
- return { tagName, tagExp };
47907
- }
47908
- function sanitizeName(name, options) {
47909
- if (criticalProperties.includes(name)) {
47910
- throw new Error(`[SECURITY] Invalid name: "${name}" is a reserved JavaScript keyword that could cause prototype pollution`);
47911
- } else if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
47912
- return options.onDangerousProperty(name);
47913
- }
47914
- return name;
47915
- }
47916
47194
 
47917
47195
  // ../node_modules/fast-xml-parser/src/xmlparser/node2json.js
47918
47196
  var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
47919
- function stripAttributePrefix(attrs, prefix) {
47920
- if (!attrs || typeof attrs !== "object") return {};
47921
- if (!prefix) return attrs;
47922
- const rawAttrs = {};
47923
- for (const key in attrs) {
47924
- if (key.startsWith(prefix)) {
47925
- const rawName = key.substring(prefix.length);
47926
- rawAttrs[rawName] = attrs[key];
47927
- } else {
47928
- rawAttrs[key] = attrs[key];
47929
- }
47930
- }
47931
- return rawAttrs;
47197
+ function prettify(node, options) {
47198
+ return compress(node, options);
47932
47199
  }
47933
- function prettify(node, options, matcher, readonlyMatcher) {
47934
- return compress(node, options, matcher, readonlyMatcher);
47935
- }
47936
- function compress(arr, options, matcher, readonlyMatcher) {
47200
+ function compress(arr, options, jPath) {
47937
47201
  let text;
47938
47202
  const compressedObj = {};
47939
47203
  for (let i = 0; i < arr.length; i++) {
47940
47204
  const tagObj = arr[i];
47941
47205
  const property = propName(tagObj);
47942
- if (property !== void 0 && property !== options.textNodeName) {
47943
- const rawAttrs = stripAttributePrefix(
47944
- tagObj[":@"] || {},
47945
- options.attributeNamePrefix
47946
- );
47947
- matcher.push(property, rawAttrs);
47948
- }
47206
+ let newJpath = "";
47207
+ if (jPath === void 0) newJpath = property;
47208
+ else newJpath = jPath + "." + property;
47949
47209
  if (property === options.textNodeName) {
47950
47210
  if (text === void 0) text = tagObj[property];
47951
47211
  else text += "" + tagObj[property];
47952
47212
  } else if (property === void 0) {
47953
47213
  continue;
47954
47214
  } else if (tagObj[property]) {
47955
- let val = compress(tagObj[property], options, matcher, readonlyMatcher);
47215
+ let val = compress(tagObj[property], options, newJpath);
47956
47216
  const isLeaf = isLeafTag(val, options);
47957
47217
  if (tagObj[":@"]) {
47958
- assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
47218
+ assignAttributes(val, tagObj[":@"], newJpath, options);
47959
47219
  } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
47960
47220
  val = val[options.textNodeName];
47961
47221
  } else if (Object.keys(val).length === 0) {
@@ -47971,16 +47231,12 @@ function compress(arr, options, matcher, readonlyMatcher) {
47971
47231
  }
47972
47232
  compressedObj[property].push(val);
47973
47233
  } else {
47974
- const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() : readonlyMatcher;
47975
- if (options.isArray(property, jPathOrMatcher, isLeaf)) {
47234
+ if (options.isArray(property, newJpath, isLeaf)) {
47976
47235
  compressedObj[property] = [val];
47977
47236
  } else {
47978
47237
  compressedObj[property] = val;
47979
47238
  }
47980
47239
  }
47981
- if (property !== void 0 && property !== options.textNodeName) {
47982
- matcher.pop();
47983
- }
47984
47240
  }
47985
47241
  }
47986
47242
  if (typeof text === "string") {
@@ -47995,15 +47251,13 @@ function propName(obj) {
47995
47251
  if (key !== ":@") return key;
47996
47252
  }
47997
47253
  }
47998
- function assignAttributes(obj, attrMap, readonlyMatcher, options) {
47254
+ function assignAttributes(obj, attrMap, jpath, options) {
47999
47255
  if (attrMap) {
48000
47256
  const keys = Object.keys(attrMap);
48001
47257
  const len = keys.length;
48002
47258
  for (let i = 0; i < len; i++) {
48003
47259
  const atrrName = keys[i];
48004
- const rawAttrName = atrrName.startsWith(options.attributeNamePrefix) ? atrrName.substring(options.attributeNamePrefix.length) : atrrName;
48005
- const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() + "." + rawAttrName : readonlyMatcher;
48006
- if (options.isArray(atrrName, jPathOrMatcher, true, true)) {
47260
+ if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
48007
47261
  obj[atrrName] = [attrMap[atrrName]];
48008
47262
  } else {
48009
47263
  obj[atrrName] = attrMap[atrrName];
@@ -48051,7 +47305,7 @@ var XMLParser = class {
48051
47305
  orderedObjParser.addExternalEntities(this.externalEntities);
48052
47306
  const orderedResult = orderedObjParser.parseXml(xmlData);
48053
47307
  if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
48054
- else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
47308
+ else return prettify(orderedResult, this.options);
48055
47309
  }
48056
47310
  /**
48057
47311
  * Add Entity which is not by default supported by this library
@@ -48149,53 +47403,90 @@ var parser = new XMLParser({
48149
47403
  attributeNamePrefix: "@_",
48150
47404
  isArray: (tagName) => ["entry", "author", "category", "link"].includes(tagName)
48151
47405
  });
47406
+ function isXmlNode(value) {
47407
+ return typeof value === "object" && value !== null && !Array.isArray(value);
47408
+ }
47409
+ function getXmlNode(value) {
47410
+ return isXmlNode(value) ? value : void 0;
47411
+ }
47412
+ function getXmlNodeArray(value) {
47413
+ if (Array.isArray(value)) {
47414
+ return value.filter(isXmlNode);
47415
+ }
47416
+ const node = getXmlNode(value);
47417
+ return node ? [node] : [];
47418
+ }
47419
+ function getXmlString(value) {
47420
+ return typeof value === "string" ? value : void 0;
47421
+ }
47422
+ function getXmlScalarText(value) {
47423
+ if (typeof value === "string") {
47424
+ return value;
47425
+ }
47426
+ if (typeof value === "number" || typeof value === "boolean") {
47427
+ return String(value);
47428
+ }
47429
+ return void 0;
47430
+ }
47431
+ function getXmlText(value) {
47432
+ const direct = getXmlScalarText(value);
47433
+ if (direct !== void 0) {
47434
+ return direct;
47435
+ }
47436
+ const node = getXmlNode(value);
47437
+ if (!node) {
47438
+ return "";
47439
+ }
47440
+ return getXmlScalarText(node["#text"]) ?? "";
47441
+ }
48152
47442
  function extractArxivId(fullId) {
48153
47443
  const match = fullId.match(/abs\/([^v]+)/);
48154
47444
  return match ? match[1] : fullId;
48155
47445
  }
48156
47446
  function parsePaper(entry) {
48157
- const rawAuthors = entry.author ?? [];
48158
- const authors = rawAuthors.map((a) => ({
48159
- name: String(a.name ?? "")
48160
- }));
48161
- const rawCategories = entry.category ?? [];
48162
- const categories = rawCategories.map((c) => ({
48163
- term: String(c["@_term"] ?? ""),
48164
- scheme: c["@_scheme"],
48165
- label: c["@_label"]
48166
- }));
48167
- const rawLinks = entry.link ?? [];
48168
- const links = rawLinks.map((l) => ({
48169
- href: String(l["@_href"] ?? ""),
48170
- rel: l["@_rel"],
48171
- type: l["@_type"],
48172
- title: l["@_title"]
47447
+ const authors = getXmlNodeArray(entry.author).map(
47448
+ (author) => ({
47449
+ name: getXmlText(author.name)
47450
+ })
47451
+ );
47452
+ const categories = getXmlNodeArray(entry.category).map(
47453
+ (category) => ({
47454
+ term: getXmlText(category["@_term"]),
47455
+ scheme: getXmlString(category["@_scheme"]),
47456
+ label: getXmlString(category["@_label"])
47457
+ })
47458
+ );
47459
+ const links = getXmlNodeArray(entry.link).map((link) => ({
47460
+ href: getXmlText(link["@_href"]),
47461
+ rel: getXmlString(link["@_rel"]),
47462
+ type: getXmlString(link["@_type"]),
47463
+ title: getXmlString(link["@_title"])
48173
47464
  }));
48174
47465
  const pdfLink = links.find(
48175
47466
  (l) => l.title === "pdf" || l.type === "application/pdf"
48176
47467
  );
48177
47468
  const pdfUrl = pdfLink?.href;
48178
- const primaryCategoryRaw = entry["arxiv:primary_category"];
47469
+ const primaryCategoryRaw = getXmlNode(entry["arxiv:primary_category"]);
48179
47470
  const primaryCategory = primaryCategoryRaw ? {
48180
- term: String(primaryCategoryRaw["@_term"] ?? ""),
48181
- scheme: primaryCategoryRaw["@_scheme"]
47471
+ term: getXmlText(primaryCategoryRaw["@_term"]),
47472
+ scheme: getXmlString(primaryCategoryRaw["@_scheme"])
48182
47473
  } : void 0;
48183
- const fullId = String(entry.id ?? "");
47474
+ const fullId = getXmlText(entry.id);
48184
47475
  return {
48185
47476
  id: fullId,
48186
47477
  arxivId: extractArxivId(fullId),
48187
- title: String(entry.title ?? "").replace(/\s+/g, " ").trim(),
48188
- summary: String(entry.summary ?? "").replace(/\s+/g, " ").trim(),
47478
+ title: getXmlText(entry.title).replace(/\s+/g, " ").trim(),
47479
+ summary: getXmlText(entry.summary).replace(/\s+/g, " ").trim(),
48189
47480
  authors,
48190
47481
  categories,
48191
47482
  primaryCategory,
48192
- published: String(entry.published ?? ""),
48193
- updated: String(entry.updated ?? ""),
47483
+ published: getXmlText(entry.published),
47484
+ updated: getXmlText(entry.updated),
48194
47485
  links,
48195
47486
  pdfUrl,
48196
- doi: entry["arxiv:doi"],
48197
- journalRef: entry["arxiv:journal_ref"],
48198
- comment: entry["arxiv:comment"]
47487
+ doi: getXmlString(entry["arxiv:doi"]),
47488
+ journalRef: getXmlString(entry["arxiv:journal_ref"]),
47489
+ comment: getXmlString(entry["arxiv:comment"])
48199
47490
  };
48200
47491
  }
48201
47492
  var ArxivApiClient = class {
@@ -48231,26 +47522,20 @@ var ArxivApiClient = class {
48231
47522
  }
48232
47523
  parseResponse(xml) {
48233
47524
  const parsed = parser.parse(xml);
48234
- const feed = parsed.feed;
47525
+ const feed = parsed.feed ?? {};
48235
47526
  const totalResults = parseInt(
48236
- String(
48237
- feed["opensearch:totalResults"]?.["#text"] ?? feed["opensearch:totalResults"] ?? "0"
48238
- ),
47527
+ getXmlText(feed["opensearch:totalResults"]) || "0",
48239
47528
  10
48240
47529
  );
48241
47530
  const startIndex = parseInt(
48242
- String(
48243
- feed["opensearch:startIndex"]?.["#text"] ?? feed["opensearch:startIndex"] ?? "0"
48244
- ),
47531
+ getXmlText(feed["opensearch:startIndex"]) || "0",
48245
47532
  10
48246
47533
  );
48247
47534
  const itemsPerPage = parseInt(
48248
- String(
48249
- feed["opensearch:itemsPerPage"]?.["#text"] ?? feed["opensearch:itemsPerPage"] ?? "0"
48250
- ),
47535
+ getXmlText(feed["opensearch:itemsPerPage"]) || "0",
48251
47536
  10
48252
47537
  );
48253
- const rawEntries = feed.entry ?? [];
47538
+ const rawEntries = getXmlNodeArray(feed.entry);
48254
47539
  const papers = rawEntries.map(parsePaper);
48255
47540
  return { totalResults, startIndex, itemsPerPage, papers };
48256
47541
  }
@@ -48291,9 +47576,10 @@ var MOCK_FIXTURES = {
48291
47576
 
48292
47577
  // src/index.ts
48293
47578
  var api = new ArxivApiClient();
47579
+ var PACKAGE_VERSION = getPackageVersion(import.meta.url);
48294
47580
  var server = new McpServer({
48295
47581
  name: "arxiv-mcp-server",
48296
- version: "1.0.0"
47582
+ version: PACKAGE_VERSION
48297
47583
  });
48298
47584
  function formatPaperMarkdown(paper) {
48299
47585
  const lines = [];
@@ -48323,13 +47609,12 @@ ${paper.summary}`);
48323
47609
  }
48324
47610
  function formatPaperListMarkdown(papers, total, start) {
48325
47611
  const lines = [];
48326
- lines.push(`# arXiv Search Results
48327
- `);
47612
+ lines.push("# arXiv Search Results\n");
48328
47613
  lines.push(
48329
47614
  `Showing ${papers.length} of ${total} results (offset: ${start})
48330
47615
  `
48331
47616
  );
48332
- papers.forEach((paper, i) => {
47617
+ for (const [i, paper] of papers.entries()) {
48333
47618
  lines.push(`### ${i + 1 + start}. ${paper.title}`);
48334
47619
  lines.push(
48335
47620
  `**arXiv**: [${paper.arxivId}](https://arxiv.org/abs/${paper.arxivId}) | **Authors**: ${paper.authors.slice(0, 3).map((a) => a.name).join(", ")}${paper.authors.length > 3 ? " et al." : ""}`
@@ -48341,7 +47626,7 @@ function formatPaperListMarkdown(papers, total, start) {
48341
47626
  `> ${paper.summary.substring(0, 300)}${paper.summary.length > 300 ? "..." : ""}`
48342
47627
  );
48343
47628
  lines.push("");
48344
- });
47629
+ }
48345
47630
  if (total > start + papers.length) {
48346
47631
  lines.push(
48347
47632
  `*${total - start - papers.length} more results available. Use \`offset=${start + papers.length}\` to continue.*`
@@ -48356,8 +47641,89 @@ var sortSchema = {
48356
47641
  var responseFormatSchema = {
48357
47642
  response_format: external_exports.enum(Object.values(ResponseFormat)).default("markdown" /* MARKDOWN */).describe("Output format: markdown or json")
48358
47643
  };
47644
+ async function handleArxivSearch(params) {
47645
+ try {
47646
+ const result = IS_MOCK || process.env.MOCK === "true" ? MOCK_FIXTURES.search : await api.search({
47647
+ query: params.query,
47648
+ start: params.offset,
47649
+ maxResults: params.limit,
47650
+ sortBy: params.sort_by,
47651
+ sortOrder: params.sort_order
47652
+ });
47653
+ if (params.response_format === "json" /* JSON */) {
47654
+ return {
47655
+ content: [
47656
+ {
47657
+ type: "text",
47658
+ text: truncateToLimit(JSON.stringify(result, null, 2))
47659
+ }
47660
+ ],
47661
+ structuredContent: {
47662
+ totalResults: result.totalResults,
47663
+ startIndex: result.startIndex,
47664
+ itemsPerPage: result.itemsPerPage,
47665
+ papers: result.papers
47666
+ }
47667
+ };
47668
+ }
47669
+ return {
47670
+ content: [
47671
+ {
47672
+ type: "text",
47673
+ text: truncateToLimit(
47674
+ formatPaperListMarkdown(
47675
+ result.papers,
47676
+ result.totalResults,
47677
+ result.startIndex
47678
+ )
47679
+ )
47680
+ }
47681
+ ]
47682
+ };
47683
+ } catch (err) {
47684
+ return createInternalError(err);
47685
+ }
47686
+ }
47687
+ async function handleArxivGetPaper(params) {
47688
+ try {
47689
+ const result = IS_MOCK || process.env.MOCK === "true" ? MOCK_FIXTURES.getById : await api.getById(params.ids);
47690
+ if (result.papers.length === 0) {
47691
+ return {
47692
+ content: [
47693
+ {
47694
+ type: "text",
47695
+ text: "No papers found for the given IDs."
47696
+ }
47697
+ ]
47698
+ };
47699
+ }
47700
+ if (params.response_format === "json" /* JSON */) {
47701
+ return {
47702
+ content: [
47703
+ {
47704
+ type: "text",
47705
+ text: truncateToLimit(
47706
+ JSON.stringify(result.papers, null, 2)
47707
+ )
47708
+ }
47709
+ ],
47710
+ structuredContent: {
47711
+ papers: result.papers
47712
+ }
47713
+ };
47714
+ }
47715
+ const markdown = result.papers.map((p) => formatPaperMarkdown(p)).join("\n\n---\n\n");
47716
+ return {
47717
+ content: [
47718
+ { type: "text", text: truncateToLimit(markdown) }
47719
+ ]
47720
+ };
47721
+ } catch (err) {
47722
+ return createInternalError(err);
47723
+ }
47724
+ }
48359
47725
  server.registerTool(
48360
- "arxiv_search_papers",
47726
+ "search_papers",
48361
47727
  {
48362
47728
  title: "Search arXiv Papers",
48363
47729
  description: "Search arXiv for academic papers using a query.",
@@ -48373,49 +47739,11 @@ server.registerTool(
48373
47739
  openWorldHint: true
48374
47740
  }
48375
47741
  },
48376
- async (params) => {
48377
- try {
48378
- const result = IS_MOCK ? MOCK_FIXTURES.search : await api.search({
48379
- query: params.query,
48380
- start: params.offset,
48381
- maxResults: params.limit,
48382
- sortBy: params.sort_by,
48383
- sortOrder: params.sort_order
48384
- });
48385
- if (params.response_format === "json" /* JSON */) {
48386
- return {
48387
- content: [
48388
- {
48389
- type: "text",
48390
- text: truncateToLimit(
48391
- JSON.stringify(result, null, 2)
48392
- )
48393
- }
48394
- ],
48395
- structuredContent: result
48396
- };
48397
- }
48398
- return {
48399
- content: [
48400
- {
48401
- type: "text",
48402
- text: truncateToLimit(
48403
- formatPaperListMarkdown(
48404
- result.papers,
48405
- result.totalResults,
48406
- result.startIndex
48407
- )
48408
- )
48409
- }
48410
- ]
48411
- };
48412
- } catch (err) {
48413
- return createInternalError(err);
48414
- }
48415
- }
47742
+ // @ts-expect-error - Schema inference can be tricky with split handlers
47743
+ handleArxivSearch
48416
47744
  );
48417
47745
  server.registerTool(
48418
- "arxiv_get_paper",
47746
+ "get_paper",
48419
47747
  {
48420
47748
  title: "Get arXiv Paper Details",
48421
47749
  description: "Retrieve full details for one or more arXiv papers by ID.",
@@ -48429,47 +47757,11 @@ server.registerTool(
48429
47757
  openWorldHint: true
48430
47758
  }
48431
47759
  },
48432
- async (params) => {
48433
- try {
48434
- const result = IS_MOCK ? MOCK_FIXTURES.getById : await api.getById(params.ids);
48435
- if (result.papers.length === 0) {
48436
- return {
48437
- content: [
48438
- {
48439
- type: "text",
48440
- text: "No papers found for the given IDs."
48441
- }
48442
- ]
48443
- };
48444
- }
48445
- if (params.response_format === "json" /* JSON */) {
48446
- return {
48447
- content: [
48448
- {
48449
- type: "text",
48450
- text: truncateToLimit(
48451
- JSON.stringify(result.papers, null, 2)
48452
- )
48453
- }
48454
- ],
48455
- structuredContent: {
48456
- papers: result.papers
48457
- }
48458
- };
48459
- }
48460
- const markdown = result.papers.map((p) => formatPaperMarkdown(p)).join("\n\n---\n\n");
48461
- return {
48462
- content: [
48463
- { type: "text", text: truncateToLimit(markdown) }
48464
- ]
48465
- };
48466
- } catch (err) {
48467
- return createInternalError(err);
48468
- }
48469
- }
47760
+ // @ts-expect-error
47761
+ handleArxivGetPaper
48470
47762
  );
48471
47763
  server.registerTool(
48472
- "arxiv_search_by_author",
47764
+ "search_by_author",
48473
47765
  {
48474
47766
  title: "Search arXiv Papers by Author",
48475
47767
  description: "Search arXiv for papers by a specific author name.",
@@ -48486,48 +47778,17 @@ server.registerTool(
48486
47778
  }
48487
47779
  },
48488
47780
  async (params) => {
48489
- try {
48490
- const result = IS_MOCK ? MOCK_FIXTURES.search : await api.search({
48491
- query: `au:${params.author}`,
48492
- start: params.offset,
48493
- maxResults: params.limit,
48494
- sortBy: params.sort_by,
48495
- sortOrder: params.sort_order
48496
- });
48497
- if (params.response_format === "json" /* JSON */) {
48498
- return {
48499
- content: [
48500
- {
48501
- type: "text",
48502
- text: truncateToLimit(
48503
- JSON.stringify(result, null, 2)
48504
- )
48505
- }
48506
- ],
48507
- structuredContent: result
48508
- };
48509
- }
48510
- return {
48511
- content: [
48512
- {
48513
- type: "text",
48514
- text: truncateToLimit(
48515
- formatPaperListMarkdown(
48516
- result.papers,
48517
- result.totalResults,
48518
- result.startIndex
48519
- )
48520
- )
48521
- }
48522
- ]
48523
- };
48524
- } catch (err) {
48525
- return createInternalError(err);
48526
- }
47781
+ return handleArxivSearch({
47782
+ ...params,
47783
+ query: `au:${params.author}`,
47784
+ sort_by: params.sort_by,
47785
+ sort_order: params.sort_order,
47786
+ response_format: params.response_format
47787
+ });
48527
47788
  }
48528
47789
  );
48529
47790
  server.registerTool(
48530
- "arxiv_search_by_category",
47791
+ "search_by_category",
48531
47792
  {
48532
47793
  title: "Search arXiv Papers by Category",
48533
47794
  description: "Browse or search papers within a specific arXiv subject category.",
@@ -48548,50 +47809,19 @@ server.registerTool(
48548
47809
  }
48549
47810
  },
48550
47811
  async (params) => {
48551
- try {
48552
- const queryParts = [`cat:${params.category}`];
48553
- if (params.query) queryParts.push(`AND all:${params.query}`);
48554
- const result = IS_MOCK ? MOCK_FIXTURES.search : await api.search({
48555
- query: queryParts.join(" "),
48556
- start: params.offset,
48557
- maxResults: params.limit,
48558
- sortBy: params.sort_by,
48559
- sortOrder: params.sort_order
48560
- });
48561
- if (params.response_format === "json" /* JSON */) {
48562
- return {
48563
- content: [
48564
- {
48565
- type: "text",
48566
- text: truncateToLimit(
48567
- JSON.stringify(result, null, 2)
48568
- )
48569
- }
48570
- ],
48571
- structuredContent: result
48572
- };
48573
- }
48574
- return {
48575
- content: [
48576
- {
48577
- type: "text",
48578
- text: truncateToLimit(
48579
- formatPaperListMarkdown(
48580
- result.papers,
48581
- result.totalResults,
48582
- result.startIndex
48583
- )
48584
- )
48585
- }
48586
- ]
48587
- };
48588
- } catch (err) {
48589
- return createInternalError(err);
48590
- }
47812
+ const queryParts = [`cat:${params.category}`];
47813
+ if (params.query) queryParts.push(`AND all:${params.query}`);
47814
+ return handleArxivSearch({
47815
+ ...params,
47816
+ query: queryParts.join(" "),
47817
+ sort_by: params.sort_by,
47818
+ sort_order: params.sort_order,
47819
+ response_format: params.response_format
47820
+ });
48591
47821
  }
48592
47822
  );
48593
47823
  server.registerTool(
48594
- "arxiv_list_categories",
47824
+ "list_categories",
48595
47825
  {
48596
47826
  title: "List arXiv Subject Categories",
48597
47827
  description: "List the commonly used arXiv subject categories with their descriptions.",
@@ -48638,10 +47868,17 @@ async function main() {
48638
47868
  await server.connect(transport);
48639
47869
  console.error("arXiv MCP server running on stdio");
48640
47870
  }
48641
- main().catch((err) => {
48642
- console.error("Fatal error:", err);
48643
- process.exit(1);
48644
- });
47871
+ if (process.env.NODE_ENV !== "test") {
47872
+ main().catch((err) => {
47873
+ console.error("Fatal error:", err);
47874
+ process.exit(1);
47875
+ });
47876
+ }
47877
+ export {
47878
+ handleArxivGetPaper,
47879
+ handleArxivSearch,
47880
+ server
47881
+ };
48645
47882
  /*! Bundled license information:
48646
47883
 
48647
47884
  mime-db/index.js: