@cloudinary/environment-config-mcp 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/mcp-server.js CHANGED
@@ -5402,9 +5402,9 @@ var init_config = __esm(() => {
5402
5402
  SDK_METADATA = {
5403
5403
  language: "typescript",
5404
5404
  openapiDocVersion: "0.5.5",
5405
- sdkVersion: "0.6.1",
5406
- genVersion: "2.918.4",
5407
- userAgent: "speakeasy-sdk/mcp-typescript 0.6.1 2.918.4 0.5.5 @cloudinary/environment-config-mcp"
5405
+ sdkVersion: "0.6.2",
5406
+ genVersion: "2.943.0",
5407
+ userAgent: "speakeasy-sdk/mcp-typescript 0.6.2 2.943.0 0.5.5 @cloudinary/environment-config-mcp"
5408
5408
  };
5409
5409
  });
5410
5410
 
@@ -9252,7 +9252,7 @@ var require_utf32 = __commonJS((exports) => {
9252
9252
  }
9253
9253
  Utf32Encoder.prototype.write = function(str) {
9254
9254
  var src = Buffer2.from(str, "ucs2");
9255
- var dst = Buffer2.alloc(src.length * 2);
9255
+ var dst = Buffer2.alloc(src.length * 2 + 4);
9256
9256
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
9257
9257
  var offset = 0;
9258
9258
  for (var i = 0;i < src.length; i += 2) {
@@ -9319,9 +9319,9 @@ var require_utf32 = __commonJS((exports) => {
9319
9319
  }
9320
9320
  if (overflow.length === 4) {
9321
9321
  if (isLE) {
9322
- codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24;
9322
+ codepoint = overflow[0] | overflow[1] << 8 | overflow[2] << 16 | overflow[3] << 24;
9323
9323
  } else {
9324
- codepoint = overflow[i + 3] | overflow[i + 2] << 8 | overflow[i + 1] << 16 | overflow[i] << 24;
9324
+ codepoint = overflow[3] | overflow[2] << 8 | overflow[1] << 16 | overflow[0] << 24;
9325
9325
  }
9326
9326
  overflow.length = 0;
9327
9327
  offset = _writeCodepoint(dst, offset, codepoint, badChar);
@@ -9356,7 +9356,11 @@ var require_utf32 = __commonJS((exports) => {
9356
9356
  return offset;
9357
9357
  }
9358
9358
  Utf32Decoder.prototype.end = function() {
9359
+ if (this.overflow.length === 0) {
9360
+ return;
9361
+ }
9359
9362
  this.overflow.length = 0;
9363
+ return String.fromCharCode(this.badChar);
9360
9364
  };
9361
9365
  exports.utf32 = Utf32AutoCodec;
9362
9366
  exports.ucs4 = "utf32";
@@ -9973,6 +9977,8 @@ var require_sbcs_data = __commonJS((exports, module) => {
9973
9977
  elot928: "iso88597",
9974
9978
  hebrew: "iso88598",
9975
9979
  hebrew8: "iso88598",
9980
+ iso88598i: "iso88598",
9981
+ iso88598e: "iso88598",
9976
9982
  turkish: "iso88599",
9977
9983
  turkish8: "iso88599",
9978
9984
  thai: "iso885911",
@@ -12470,55 +12476,54 @@ var require_lib = __commonJS((exports, module) => {
12470
12476
  var Buffer2 = require_safer().Buffer;
12471
12477
  var bomHandling = require_bom_handling();
12472
12478
  var mergeModules = require_merge_exports();
12473
- var iconv = exports;
12474
- iconv.encodings = null;
12475
- iconv.defaultCharUnicode = "�";
12476
- iconv.defaultCharSingleByte = "?";
12477
- iconv.encode = function encode(str, encoding, options) {
12479
+ exports.encodings = null;
12480
+ exports.defaultCharUnicode = "�";
12481
+ exports.defaultCharSingleByte = "?";
12482
+ exports.encode = function encode(str, encoding, options) {
12478
12483
  str = "" + (str || "");
12479
- var encoder = iconv.getEncoder(encoding, options);
12484
+ var encoder = exports.getEncoder(encoding, options);
12480
12485
  var res = encoder.write(str);
12481
12486
  var trail = encoder.end();
12482
12487
  return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
12483
12488
  };
12484
- iconv.decode = function decode(buf, encoding, options) {
12489
+ exports.decode = function decode(buf, encoding, options) {
12485
12490
  if (typeof buf === "string") {
12486
- if (!iconv.skipDecodeWarning) {
12491
+ if (!exports.skipDecodeWarning) {
12487
12492
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
12488
- iconv.skipDecodeWarning = true;
12493
+ exports.skipDecodeWarning = true;
12489
12494
  }
12490
12495
  buf = Buffer2.from("" + (buf || ""), "binary");
12491
12496
  }
12492
- var decoder = iconv.getDecoder(encoding, options);
12497
+ var decoder = exports.getDecoder(encoding, options);
12493
12498
  var res = decoder.write(buf);
12494
12499
  var trail = decoder.end();
12495
12500
  return trail ? res + trail : res;
12496
12501
  };
12497
- iconv.encodingExists = function encodingExists(enc) {
12502
+ exports.encodingExists = function encodingExists(enc) {
12498
12503
  try {
12499
- iconv.getCodec(enc);
12504
+ exports.getCodec(enc);
12500
12505
  return true;
12501
12506
  } catch (e) {
12502
12507
  return false;
12503
12508
  }
12504
12509
  };
12505
- iconv.toEncoding = iconv.encode;
12506
- iconv.fromEncoding = iconv.decode;
12507
- iconv._codecDataCache = { __proto__: null };
12508
- iconv.getCodec = function getCodec(encoding) {
12509
- if (!iconv.encodings) {
12510
+ exports.toEncoding = exports.encode;
12511
+ exports.fromEncoding = exports.decode;
12512
+ exports._codecDataCache = { __proto__: null };
12513
+ exports.getCodec = function getCodec(encoding) {
12514
+ if (!exports.encodings) {
12510
12515
  var raw = require_encodings();
12511
- iconv.encodings = { __proto__: null };
12512
- mergeModules(iconv.encodings, raw);
12516
+ exports.encodings = { __proto__: null };
12517
+ mergeModules(exports.encodings, raw);
12513
12518
  }
12514
- var enc = iconv._canonicalizeEncoding(encoding);
12519
+ var enc = exports._canonicalizeEncoding(encoding);
12515
12520
  var codecOptions = {};
12516
12521
  while (true) {
12517
- var codec = iconv._codecDataCache[enc];
12522
+ var codec = exports._codecDataCache[enc];
12518
12523
  if (codec) {
12519
12524
  return codec;
12520
12525
  }
12521
- var codecDef = iconv.encodings[enc];
12526
+ var codecDef = exports.encodings[enc];
12522
12527
  switch (typeof codecDef) {
12523
12528
  case "string":
12524
12529
  enc = codecDef;
@@ -12536,56 +12541,56 @@ var require_lib = __commonJS((exports, module) => {
12536
12541
  if (!codecOptions.encodingName) {
12537
12542
  codecOptions.encodingName = enc;
12538
12543
  }
12539
- codec = new codecDef(codecOptions, iconv);
12540
- iconv._codecDataCache[codecOptions.encodingName] = codec;
12544
+ codec = new codecDef(codecOptions, exports);
12545
+ exports._codecDataCache[codecOptions.encodingName] = codec;
12541
12546
  return codec;
12542
12547
  default:
12543
12548
  throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '" + enc + "')");
12544
12549
  }
12545
12550
  }
12546
12551
  };
12547
- iconv._canonicalizeEncoding = function(encoding) {
12552
+ exports._canonicalizeEncoding = function(encoding) {
12548
12553
  return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
12549
12554
  };
12550
- iconv.getEncoder = function getEncoder(encoding, options) {
12551
- var codec = iconv.getCodec(encoding);
12555
+ exports.getEncoder = function getEncoder(encoding, options) {
12556
+ var codec = exports.getCodec(encoding);
12552
12557
  var encoder = new codec.encoder(options, codec);
12553
12558
  if (codec.bomAware && options && options.addBOM) {
12554
12559
  encoder = new bomHandling.PrependBOM(encoder, options);
12555
12560
  }
12556
12561
  return encoder;
12557
12562
  };
12558
- iconv.getDecoder = function getDecoder(encoding, options) {
12559
- var codec = iconv.getCodec(encoding);
12563
+ exports.getDecoder = function getDecoder(encoding, options) {
12564
+ var codec = exports.getCodec(encoding);
12560
12565
  var decoder = new codec.decoder(options, codec);
12561
12566
  if (codec.bomAware && !(options && options.stripBOM === false)) {
12562
12567
  decoder = new bomHandling.StripBOM(decoder, options);
12563
12568
  }
12564
12569
  return decoder;
12565
12570
  };
12566
- iconv.enableStreamingAPI = function enableStreamingAPI(streamModule2) {
12567
- if (iconv.supportsStreams) {
12571
+ exports.enableStreamingAPI = function enableStreamingAPI(streamModule2) {
12572
+ if (exports.supportsStreams) {
12568
12573
  return;
12569
12574
  }
12570
12575
  var streams = require_streams()(streamModule2);
12571
- iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
12572
- iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
12573
- iconv.encodeStream = function encodeStream(encoding, options) {
12574
- return new iconv.IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);
12576
+ exports.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
12577
+ exports.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
12578
+ exports.encodeStream = function encodeStream(encoding, options) {
12579
+ return new exports.IconvLiteEncoderStream(exports.getEncoder(encoding, options), options);
12575
12580
  };
12576
- iconv.decodeStream = function decodeStream(encoding, options) {
12577
- return new iconv.IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);
12581
+ exports.decodeStream = function decodeStream(encoding, options) {
12582
+ return new exports.IconvLiteDecoderStream(exports.getDecoder(encoding, options), options);
12578
12583
  };
12579
- iconv.supportsStreams = true;
12584
+ exports.supportsStreams = true;
12580
12585
  };
12581
12586
  var streamModule;
12582
12587
  try {
12583
12588
  streamModule = __require("stream");
12584
12589
  } catch (e) {}
12585
12590
  if (streamModule && streamModule.Transform) {
12586
- iconv.enableStreamingAPI(streamModule);
12591
+ exports.enableStreamingAPI(streamModule);
12587
12592
  } else {
12588
- iconv.encodeStream = iconv.decodeStream = function() {
12593
+ exports.encodeStream = exports.decodeStream = function() {
12589
12594
  throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
12590
12595
  };
12591
12596
  }
@@ -13001,109 +13006,144 @@ var require_on_finished = __commonJS((exports, module) => {
13001
13006
  }
13002
13007
  });
13003
13008
 
13004
- // node_modules/content-type/index.js
13005
- var require_content_type = __commonJS((exports) => {
13009
+ // node_modules/type-is/node_modules/content-type/dist/index.js
13010
+ var require_dist = __commonJS((exports) => {
13006
13011
  /*!
13007
13012
  * content-type
13008
13013
  * Copyright(c) 2015 Douglas Christopher Wilson
13009
13014
  * MIT Licensed
13010
13015
  */
13011
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
13012
- var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
13013
- var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
13014
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
13015
- var QUOTE_REGEXP = /([\\"])/g;
13016
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
13016
+ Object.defineProperty(exports, "__esModule", { value: true });
13017
13017
  exports.format = format;
13018
13018
  exports.parse = parse5;
13019
+ var TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
13020
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
13021
+ var QUOTE_REGEXP = /[\\"]/g;
13022
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
13023
+ var NullObject = /* @__PURE__ */ (() => {
13024
+ const C2 = function() {};
13025
+ C2.prototype = Object.create(null);
13026
+ return C2;
13027
+ })();
13019
13028
  function format(obj) {
13020
- if (!obj || typeof obj !== "object") {
13021
- throw new TypeError("argument obj is required");
13022
- }
13023
- var parameters = obj.parameters;
13024
- var type = obj.type;
13029
+ const { type, parameters } = obj;
13025
13030
  if (!type || !TYPE_REGEXP.test(type)) {
13026
- throw new TypeError("invalid type");
13031
+ throw new TypeError(`Invalid type: ${type}`);
13027
13032
  }
13028
- var string4 = type;
13029
- if (parameters && typeof parameters === "object") {
13030
- var param;
13031
- var params = Object.keys(parameters).sort();
13032
- for (var i = 0;i < params.length; i++) {
13033
- param = params[i];
13033
+ let result = type;
13034
+ if (parameters) {
13035
+ for (const param of Object.keys(parameters)) {
13034
13036
  if (!TOKEN_REGEXP.test(param)) {
13035
- throw new TypeError("invalid parameter name");
13037
+ throw new TypeError(`Invalid parameter name: ${param}`);
13036
13038
  }
13037
- string4 += "; " + param + "=" + qstring(parameters[param]);
13039
+ result += `; ${param}=${qstring(parameters[param])}`;
13038
13040
  }
13039
13041
  }
13040
- return string4;
13042
+ return result;
13041
13043
  }
13042
- function parse5(string4) {
13043
- if (!string4) {
13044
- throw new TypeError("argument string is required");
13045
- }
13046
- var header = typeof string4 === "object" ? getcontenttype(string4) : string4;
13047
- if (typeof header !== "string") {
13048
- throw new TypeError("argument string is required to be a string");
13049
- }
13050
- var index = header.indexOf(";");
13051
- var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
13052
- if (!TYPE_REGEXP.test(type)) {
13053
- throw new TypeError("invalid media type");
13054
- }
13055
- var obj = new ContentType(type.toLowerCase());
13056
- if (index !== -1) {
13057
- var key;
13058
- var match;
13059
- var value;
13060
- PARAM_REGEXP.lastIndex = index;
13061
- while (match = PARAM_REGEXP.exec(header)) {
13062
- if (match.index !== index) {
13063
- throw new TypeError("invalid parameter format");
13064
- }
13065
- index += match[0].length;
13066
- key = match[1].toLowerCase();
13067
- value = match[2];
13068
- if (value.charCodeAt(0) === 34) {
13069
- value = value.slice(1, -1);
13070
- if (value.indexOf("\\") !== -1) {
13071
- value = value.replace(QESC_REGEXP, "$1");
13044
+ function parse5(header, options) {
13045
+ const stopChar = options?.comma === true ? COMMA : 65536;
13046
+ const len = header.length;
13047
+ let index = skipOWS(header, options?.start ?? 0, len);
13048
+ const valueStart = index;
13049
+ index = skipValue(header, index, len, stopChar);
13050
+ const valueEnd = trailingOWS(header, valueStart, index);
13051
+ const type = header.slice(valueStart, valueEnd).toLowerCase();
13052
+ if (options?.parameters === false) {
13053
+ return { type, index, parameters: new NullObject };
13054
+ }
13055
+ return parseParameters(header, type, index, len, stopChar);
13056
+ }
13057
+ var SP = 32;
13058
+ var HTAB = 9;
13059
+ var SEMI = 59;
13060
+ var EQ = 61;
13061
+ var DQUOTE = 34;
13062
+ var BSLASH = 92;
13063
+ var COMMA = 44;
13064
+ function parseParameters(header, type, index, len, stopChar) {
13065
+ const parameters = new NullObject;
13066
+ parameter:
13067
+ while (index < len) {
13068
+ if (header.charCodeAt(index) === stopChar)
13069
+ break;
13070
+ index = skipOWS(header, index + 1, len);
13071
+ const keyStart = index;
13072
+ while (index < len) {
13073
+ const code = header.charCodeAt(index);
13074
+ if (code === stopChar)
13075
+ break parameter;
13076
+ if (code === SEMI)
13077
+ continue parameter;
13078
+ if (code === EQ) {
13079
+ const keyEnd = trailingOWS(header, keyStart, index);
13080
+ const key = header.slice(keyStart, keyEnd).toLowerCase();
13081
+ index = skipOWS(header, index + 1, len);
13082
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
13083
+ index++;
13084
+ let value = "";
13085
+ while (index < len) {
13086
+ const code2 = header.charCodeAt(index++);
13087
+ if (code2 === DQUOTE) {
13088
+ index = skipValue(header, index, len, stopChar);
13089
+ if (parameters[key] === undefined)
13090
+ parameters[key] = value;
13091
+ break;
13092
+ }
13093
+ if (code2 === BSLASH && index < len) {
13094
+ value += header[index++];
13095
+ continue;
13096
+ }
13097
+ value += String.fromCharCode(code2);
13098
+ }
13099
+ continue parameter;
13100
+ }
13101
+ const valueStart = index;
13102
+ index = skipValue(header, index, len, stopChar);
13103
+ if (parameters[key] === undefined) {
13104
+ const valueEnd = trailingOWS(header, valueStart, index);
13105
+ parameters[key] = header.slice(valueStart, valueEnd);
13106
+ }
13107
+ continue parameter;
13072
13108
  }
13109
+ index++;
13073
13110
  }
13074
- obj.parameters[key] = value;
13075
13111
  }
13076
- if (index !== header.length) {
13077
- throw new TypeError("invalid parameter format");
13078
- }
13079
- }
13080
- return obj;
13112
+ return { type, index, parameters };
13081
13113
  }
13082
- function getcontenttype(obj) {
13083
- var header;
13084
- if (typeof obj.getHeader === "function") {
13085
- header = obj.getHeader("content-type");
13086
- } else if (typeof obj.headers === "object") {
13087
- header = obj.headers && obj.headers["content-type"];
13088
- }
13089
- if (typeof header !== "string") {
13090
- throw new TypeError("content-type header is missing from object");
13114
+ function skipValue(str, index, len, stopChar) {
13115
+ while (index < len) {
13116
+ const code = str.charCodeAt(index);
13117
+ if (code === SEMI || code === stopChar)
13118
+ break;
13119
+ index++;
13091
13120
  }
13092
- return header;
13121
+ return index;
13093
13122
  }
13094
- function qstring(val) {
13095
- var str = String(val);
13096
- if (TOKEN_REGEXP.test(str)) {
13097
- return str;
13123
+ function skipOWS(header, index, len) {
13124
+ while (index < len) {
13125
+ const char = header.charCodeAt(index);
13126
+ if (char !== SP && char !== HTAB)
13127
+ break;
13128
+ index++;
13098
13129
  }
13099
- if (str.length > 0 && !TEXT_REGEXP.test(str)) {
13100
- throw new TypeError("invalid parameter value");
13130
+ return index;
13131
+ }
13132
+ function trailingOWS(header, start, end) {
13133
+ while (end > start) {
13134
+ const char = header.charCodeAt(end - 1);
13135
+ if (char !== SP && char !== HTAB)
13136
+ break;
13137
+ end--;
13101
13138
  }
13102
- return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
13139
+ return end;
13103
13140
  }
13104
- function ContentType(type) {
13105
- this.parameters = Object.create(null);
13106
- this.type = type;
13141
+ function qstring(str) {
13142
+ if (TOKEN_REGEXP.test(str))
13143
+ return str;
13144
+ if (TEXT_REGEXP.test(str))
13145
+ return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
13146
+ throw new TypeError(`Invalid parameter value: ${str}`);
13107
13147
  }
13108
13148
  });
13109
13149
 
@@ -22686,7 +22726,7 @@ var require_type_is = __commonJS((exports, module) => {
22686
22726
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
22687
22727
  * MIT Licensed
22688
22728
  */
22689
- var contentType = require_content_type();
22729
+ var contentType = require_dist();
22690
22730
  var mime = require_mime_types();
22691
22731
  var typer = require_media_typer();
22692
22732
  module.exports = typeofrequest;
@@ -22695,9 +22735,12 @@ var require_type_is = __commonJS((exports, module) => {
22695
22735
  module.exports.normalize = normalize;
22696
22736
  module.exports.match = mimeMatch;
22697
22737
  function typeis(value, types_) {
22738
+ if (value && typeof value === "object") {
22739
+ value = value.headers["content-type"];
22740
+ }
22698
22741
  var i;
22699
22742
  var types = types_;
22700
- var val = tryNormalizeType(value);
22743
+ var val = normalizeType(value);
22701
22744
  if (!val) {
22702
22745
  return false;
22703
22746
  }
@@ -22764,22 +22807,158 @@ var require_type_is = __commonJS((exports, module) => {
22764
22807
  return true;
22765
22808
  }
22766
22809
  function normalizeType(value) {
22767
- var type = contentType.parse(value).type;
22810
+ if (!value)
22811
+ return null;
22812
+ var type = contentType.parse(value, { parameters: false }).type;
22768
22813
  return typer.test(type) ? type : null;
22769
22814
  }
22770
- function tryNormalizeType(value) {
22771
- try {
22772
- return value ? normalizeType(value) : null;
22773
- } catch (err) {
22774
- return null;
22815
+ });
22816
+
22817
+ // node_modules/body-parser/node_modules/content-type/dist/index.js
22818
+ var require_dist2 = __commonJS((exports) => {
22819
+ /*!
22820
+ * content-type
22821
+ * Copyright(c) 2015 Douglas Christopher Wilson
22822
+ * MIT Licensed
22823
+ */
22824
+ Object.defineProperty(exports, "__esModule", { value: true });
22825
+ exports.format = format;
22826
+ exports.parse = parse5;
22827
+ var TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
22828
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
22829
+ var QUOTE_REGEXP = /[\\"]/g;
22830
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
22831
+ var NullObject = /* @__PURE__ */ (() => {
22832
+ const C2 = function() {};
22833
+ C2.prototype = Object.create(null);
22834
+ return C2;
22835
+ })();
22836
+ function format(obj) {
22837
+ const { type, parameters } = obj;
22838
+ if (!type || !TYPE_REGEXP.test(type)) {
22839
+ throw new TypeError(`Invalid type: ${type}`);
22840
+ }
22841
+ let result = type;
22842
+ if (parameters) {
22843
+ for (const param of Object.keys(parameters)) {
22844
+ if (!TOKEN_REGEXP.test(param)) {
22845
+ throw new TypeError(`Invalid parameter name: ${param}`);
22846
+ }
22847
+ result += `; ${param}=${qstring(parameters[param])}`;
22848
+ }
22775
22849
  }
22850
+ return result;
22851
+ }
22852
+ function parse5(header, options) {
22853
+ const stopChar = options?.comma === true ? COMMA : 65536;
22854
+ const len = header.length;
22855
+ let index = skipOWS(header, options?.start ?? 0, len);
22856
+ const valueStart = index;
22857
+ index = skipValue(header, index, len, stopChar);
22858
+ const valueEnd = trailingOWS(header, valueStart, index);
22859
+ const type = header.slice(valueStart, valueEnd).toLowerCase();
22860
+ if (options?.parameters === false) {
22861
+ return { type, index, parameters: new NullObject };
22862
+ }
22863
+ return parseParameters(header, type, index, len, stopChar);
22864
+ }
22865
+ var SP = 32;
22866
+ var HTAB = 9;
22867
+ var SEMI = 59;
22868
+ var EQ = 61;
22869
+ var DQUOTE = 34;
22870
+ var BSLASH = 92;
22871
+ var COMMA = 44;
22872
+ function parseParameters(header, type, index, len, stopChar) {
22873
+ const parameters = new NullObject;
22874
+ parameter:
22875
+ while (index < len) {
22876
+ if (header.charCodeAt(index) === stopChar)
22877
+ break;
22878
+ index = skipOWS(header, index + 1, len);
22879
+ const keyStart = index;
22880
+ while (index < len) {
22881
+ const code = header.charCodeAt(index);
22882
+ if (code === stopChar)
22883
+ break parameter;
22884
+ if (code === SEMI)
22885
+ continue parameter;
22886
+ if (code === EQ) {
22887
+ const keyEnd = trailingOWS(header, keyStart, index);
22888
+ const key = header.slice(keyStart, keyEnd).toLowerCase();
22889
+ index = skipOWS(header, index + 1, len);
22890
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
22891
+ index++;
22892
+ let value = "";
22893
+ while (index < len) {
22894
+ const code2 = header.charCodeAt(index++);
22895
+ if (code2 === DQUOTE) {
22896
+ index = skipValue(header, index, len, stopChar);
22897
+ if (parameters[key] === undefined)
22898
+ parameters[key] = value;
22899
+ break;
22900
+ }
22901
+ if (code2 === BSLASH && index < len) {
22902
+ value += header[index++];
22903
+ continue;
22904
+ }
22905
+ value += String.fromCharCode(code2);
22906
+ }
22907
+ continue parameter;
22908
+ }
22909
+ const valueStart = index;
22910
+ index = skipValue(header, index, len, stopChar);
22911
+ if (parameters[key] === undefined) {
22912
+ const valueEnd = trailingOWS(header, valueStart, index);
22913
+ parameters[key] = header.slice(valueStart, valueEnd);
22914
+ }
22915
+ continue parameter;
22916
+ }
22917
+ index++;
22918
+ }
22919
+ }
22920
+ return { type, index, parameters };
22921
+ }
22922
+ function skipValue(str, index, len, stopChar) {
22923
+ while (index < len) {
22924
+ const code = str.charCodeAt(index);
22925
+ if (code === SEMI || code === stopChar)
22926
+ break;
22927
+ index++;
22928
+ }
22929
+ return index;
22930
+ }
22931
+ function skipOWS(header, index, len) {
22932
+ while (index < len) {
22933
+ const char = header.charCodeAt(index);
22934
+ if (char !== SP && char !== HTAB)
22935
+ break;
22936
+ index++;
22937
+ }
22938
+ return index;
22939
+ }
22940
+ function trailingOWS(header, start, end) {
22941
+ while (end > start) {
22942
+ const char = header.charCodeAt(end - 1);
22943
+ if (char !== SP && char !== HTAB)
22944
+ break;
22945
+ end--;
22946
+ }
22947
+ return end;
22948
+ }
22949
+ function qstring(str) {
22950
+ if (TOKEN_REGEXP.test(str))
22951
+ return str;
22952
+ if (TEXT_REGEXP.test(str))
22953
+ return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
22954
+ throw new TypeError(`Invalid parameter value: ${str}`);
22776
22955
  }
22777
22956
  });
22778
22957
 
22779
22958
  // node_modules/body-parser/lib/utils.js
22780
22959
  var require_utils = __commonJS((exports, module) => {
22781
22960
  var bytes = require_bytes();
22782
- var contentType = require_content_type();
22961
+ var contentType = require_dist2();
22783
22962
  var typeis = require_type_is();
22784
22963
  module.exports = {
22785
22964
  getCharset,
@@ -22787,11 +22966,10 @@ var require_utils = __commonJS((exports, module) => {
22787
22966
  passthrough
22788
22967
  };
22789
22968
  function getCharset(req) {
22790
- try {
22791
- return (contentType.parse(req).parameters.charset || "").toLowerCase();
22792
- } catch {
22969
+ const header = req.headers["content-type"];
22970
+ if (!header)
22793
22971
  return;
22794
- }
22972
+ return contentType.parse(header).parameters.charset?.toLowerCase();
22795
22973
  }
22796
22974
  function typeChecker(type) {
22797
22975
  return function checkType(req) {
@@ -22802,15 +22980,18 @@ var require_utils = __commonJS((exports, module) => {
22802
22980
  if (!defaultType) {
22803
22981
  throw new TypeError("defaultType must be provided");
22804
22982
  }
22805
- var inflate = options?.inflate !== false;
22806
- var limit = typeof options?.limit !== "number" ? bytes.parse(options?.limit || "100kb") : options?.limit;
22807
- var type = options?.type || defaultType;
22808
- var verify = options?.verify || false;
22809
- var defaultCharset = options?.defaultCharset || "utf-8";
22983
+ const inflate = options?.inflate !== false;
22984
+ const limit = typeof options?.limit === "undefined" || options?.limit === null ? 102400 : bytes.parse(options.limit);
22985
+ const type = options?.type || defaultType;
22986
+ const verify = options?.verify || false;
22987
+ const defaultCharset = options?.defaultCharset || "utf-8";
22988
+ if (limit === null) {
22989
+ throw new TypeError(`option limit "${String(options.limit)}" is invalid`);
22990
+ }
22810
22991
  if (verify !== false && typeof verify !== "function") {
22811
22992
  throw new TypeError("option verify must be function");
22812
22993
  }
22813
- var shouldParse = typeof type !== "function" ? typeChecker(type) : type;
22994
+ const shouldParse = typeof type !== "function" ? typeChecker(type) : type;
22814
22995
  return {
22815
22996
  inflate,
22816
22997
  limit,
@@ -22859,7 +23040,7 @@ var require_read = __commonJS((exports, module) => {
22859
23040
  next();
22860
23041
  return;
22861
23042
  }
22862
- var encoding = null;
23043
+ let encoding = null;
22863
23044
  if (options?.skipCharset !== true) {
22864
23045
  encoding = getCharset(req) || options.defaultCharset;
22865
23046
  if (!!options?.isValidCharset && !options.isValidCharset(encoding)) {
@@ -22871,10 +23052,10 @@ var require_read = __commonJS((exports, module) => {
22871
23052
  return;
22872
23053
  }
22873
23054
  }
22874
- var length;
22875
- var opts = options;
22876
- var stream;
22877
- var verify = opts.verify;
23055
+ let length;
23056
+ const opts = options;
23057
+ let stream;
23058
+ const verify = opts.verify;
22878
23059
  try {
22879
23060
  stream = contentstream(req, debug, opts.inflate);
22880
23061
  length = stream.length;
@@ -22893,7 +23074,7 @@ var require_read = __commonJS((exports, module) => {
22893
23074
  debug("read body");
22894
23075
  getBody(stream, opts, function(error2, body) {
22895
23076
  if (error2) {
22896
- var _error;
23077
+ let _error;
22897
23078
  if (error2.type === "encoding.unsupported") {
22898
23079
  _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
22899
23080
  charset: encoding.toLowerCase(),
@@ -22923,7 +23104,7 @@ var require_read = __commonJS((exports, module) => {
22923
23104
  return;
22924
23105
  }
22925
23106
  }
22926
- var str = body;
23107
+ let str = body;
22927
23108
  try {
22928
23109
  debug("parse body");
22929
23110
  str = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body;
@@ -22939,8 +23120,8 @@ var require_read = __commonJS((exports, module) => {
22939
23120
  });
22940
23121
  }
22941
23122
  function contentstream(req, debug, inflate) {
22942
- var encoding = (req.headers["content-encoding"] || "identity").toLowerCase();
22943
- var length = req.headers["content-length"];
23123
+ const encoding = (req.headers["content-encoding"] || "identity").toLowerCase();
23124
+ const length = req.headers["content-length"];
22944
23125
  debug('content-encoding "%s"', encoding);
22945
23126
  if (inflate === false && encoding !== "identity") {
22946
23127
  throw createError(415, "content encoding unsupported", {
@@ -22952,7 +23133,7 @@ var require_read = __commonJS((exports, module) => {
22952
23133
  req.length = length;
22953
23134
  return req;
22954
23135
  }
22955
- var stream = createDecompressionStream(encoding, debug);
23136
+ const stream = createDecompressionStream(encoding, debug);
22956
23137
  req.pipe(stream);
22957
23138
  return stream;
22958
23139
  }
@@ -23001,18 +23182,42 @@ var require_json = __commonJS((exports, module) => {
23001
23182
  var JSON_SYNTAX_REGEXP = /#+/g;
23002
23183
  function json(options) {
23003
23184
  const normalizedOptions = normalizeOptions(options, "application/json");
23004
- var reviver = options?.reviver;
23005
- var strict = options?.strict !== false;
23006
- function parse5(body) {
23007
- if (body.length === 0) {
23008
- return {};
23009
- }
23010
- if (strict) {
23011
- var first = firstchar(body);
23185
+ const parse5 = createJsonParser(options);
23186
+ const readOptions = {
23187
+ ...normalizedOptions,
23188
+ isValidCharset: (charset) => charset.slice(0, 4) === "utf-"
23189
+ };
23190
+ return function jsonParser(req, res, next) {
23191
+ read(req, res, next, parse5, debug, readOptions);
23192
+ };
23193
+ }
23194
+ function createJsonParser(options) {
23195
+ const reviver = options?.reviver;
23196
+ const strict = options?.strict !== false;
23197
+ if (strict) {
23198
+ return function parse(body) {
23199
+ if (body.length === 0) {
23200
+ return {};
23201
+ }
23202
+ const first = firstchar(body);
23012
23203
  if (first !== "{" && first !== "[") {
23013
23204
  debug("strict violation");
23014
23205
  throw createStrictSyntaxError(body, first);
23015
23206
  }
23207
+ try {
23208
+ debug("parse json");
23209
+ return JSON.parse(body, reviver);
23210
+ } catch (e) {
23211
+ throw normalizeJsonSyntaxError(e, {
23212
+ message: e.message,
23213
+ stack: e.stack
23214
+ });
23215
+ }
23216
+ };
23217
+ }
23218
+ return function parse(body) {
23219
+ if (body.length === 0) {
23220
+ return {};
23016
23221
  }
23017
23222
  try {
23018
23223
  debug("parse json");
@@ -23023,23 +23228,13 @@ var require_json = __commonJS((exports, module) => {
23023
23228
  stack: e.stack
23024
23229
  });
23025
23230
  }
23026
- }
23027
- const readOptions = {
23028
- ...normalizedOptions,
23029
- isValidCharset: (charset) => charset.slice(0, 4) === "utf-"
23030
- };
23031
- return function jsonParser(req, res, next) {
23032
- read(req, res, next, parse5, debug, readOptions);
23033
23231
  };
23034
23232
  }
23035
23233
  function createStrictSyntaxError(str, char) {
23036
- var index = str.indexOf(char);
23037
- var partial2 = "";
23234
+ const index = str.indexOf(char);
23235
+ let partial2 = "";
23038
23236
  if (index !== -1) {
23039
- partial2 = str.substring(0, index) + JSON_SYNTAX_CHAR;
23040
- for (var i = index + 1;i < str.length; i++) {
23041
- partial2 += JSON_SYNTAX_CHAR;
23042
- }
23237
+ partial2 = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index);
23043
23238
  }
23044
23239
  try {
23045
23240
  JSON.parse(partial2);
@@ -23054,13 +23249,13 @@ var require_json = __commonJS((exports, module) => {
23054
23249
  }
23055
23250
  }
23056
23251
  function firstchar(str) {
23057
- var match = FIRST_CHAR_REGEXP.exec(str);
23252
+ const match = FIRST_CHAR_REGEXP.exec(str);
23058
23253
  return match ? match[1] : undefined;
23059
23254
  }
23060
23255
  function normalizeJsonSyntaxError(error2, obj) {
23061
- var keys = Object.getOwnPropertyNames(error2);
23062
- for (var i = 0;i < keys.length; i++) {
23063
- var key = keys[i];
23256
+ const keys = Object.getOwnPropertyNames(error2);
23257
+ for (let i = 0;i < keys.length; i++) {
23258
+ const key = keys[i];
23064
23259
  if (key !== "stack" && key !== "message") {
23065
23260
  delete error2[key];
23066
23261
  }
@@ -23705,9 +23900,8 @@ var require_side_channel_list = __commonJS((exports, module) => {
23705
23900
  }
23706
23901
  },
23707
23902
  delete: function(key) {
23708
- var root = $o && $o.next;
23709
23903
  var deletedNode = listDelete($o, key);
23710
- if (deletedNode && root && root === deletedNode) {
23904
+ if (deletedNode && $o && !$o.next) {
23711
23905
  $o = undefined;
23712
23906
  }
23713
23907
  return !!deletedNode;
@@ -24553,7 +24747,8 @@ var require_side_channel = __commonJS((exports, module) => {
24553
24747
  var channel = {
24554
24748
  assert: function(key) {
24555
24749
  if (!channel.has(key)) {
24556
- throw new $TypeError("Side channel does not contain " + inspect(key));
24750
+ var keyDesc = key && Object(key) === key ? "the given object key" : inspect(key);
24751
+ throw new $TypeError("Side channel does not contain " + keyDesc);
24557
24752
  }
24558
24753
  },
24559
24754
  delete: function(key) {
@@ -24602,12 +24797,28 @@ var require_formats = __commonJS((exports, module) => {
24602
24797
  // node_modules/qs/lib/utils.js
24603
24798
  var require_utils2 = __commonJS((exports, module) => {
24604
24799
  var formats = require_formats();
24800
+ var getSideChannel = require_side_channel();
24801
+ var defineProperty = require_es_define_property();
24605
24802
  var has = Object.prototype.hasOwnProperty;
24606
24803
  var isArray = Array.isArray;
24804
+ var overflowChannel = getSideChannel();
24805
+ var markOverflow = function markOverflow(obj, maxIndex) {
24806
+ overflowChannel.set(obj, maxIndex);
24807
+ return obj;
24808
+ };
24809
+ var isOverflow = function isOverflow(obj) {
24810
+ return overflowChannel.has(obj);
24811
+ };
24812
+ var getMaxIndex = function getMaxIndex(obj) {
24813
+ return overflowChannel.get(obj);
24814
+ };
24815
+ var setMaxIndex = function setMaxIndex(obj, maxIndex) {
24816
+ overflowChannel.set(obj, maxIndex);
24817
+ };
24607
24818
  var hexTable = function() {
24608
24819
  var array2 = [];
24609
24820
  for (var i = 0;i < 256; ++i) {
24610
- array2.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase());
24821
+ array2[array2.length] = "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
24611
24822
  }
24612
24823
  return array2;
24613
24824
  }();
@@ -24619,7 +24830,7 @@ var require_utils2 = __commonJS((exports, module) => {
24619
24830
  var compacted = [];
24620
24831
  for (var j2 = 0;j2 < obj.length; ++j2) {
24621
24832
  if (typeof obj[j2] !== "undefined") {
24622
- compacted.push(obj[j2]);
24833
+ compacted[compacted.length] = obj[j2];
24623
24834
  }
24624
24835
  }
24625
24836
  item.obj[item.prop] = compacted;
@@ -24635,15 +24846,40 @@ var require_utils2 = __commonJS((exports, module) => {
24635
24846
  }
24636
24847
  return obj;
24637
24848
  };
24849
+ var setProperty = function setProperty(obj, key, value) {
24850
+ if (key === "__proto__" && defineProperty) {
24851
+ defineProperty(obj, key, {
24852
+ configurable: true,
24853
+ enumerable: true,
24854
+ value,
24855
+ writable: true
24856
+ });
24857
+ } else {
24858
+ obj[key] = value;
24859
+ }
24860
+ };
24638
24861
  var merge2 = function merge(target, source, options) {
24639
24862
  if (!source) {
24640
24863
  return target;
24641
24864
  }
24642
24865
  if (typeof source !== "object" && typeof source !== "function") {
24643
24866
  if (isArray(target)) {
24644
- target.push(source);
24867
+ var nextIndex = target.length;
24868
+ if (options && typeof options.arrayLimit === "number" && nextIndex >= options.arrayLimit) {
24869
+ if (options.throwOnLimitExceeded) {
24870
+ throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
24871
+ }
24872
+ return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
24873
+ }
24874
+ target[nextIndex] = source;
24645
24875
  } else if (target && typeof target === "object") {
24646
- if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
24876
+ if (isOverflow(target)) {
24877
+ var newIndex = getMaxIndex(target) + 1;
24878
+ target[newIndex] = source;
24879
+ setMaxIndex(target, newIndex);
24880
+ } else if (options && options.strictMerge) {
24881
+ return [target, source];
24882
+ } else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
24647
24883
  target[source] = true;
24648
24884
  }
24649
24885
  } else {
@@ -24652,7 +24888,23 @@ var require_utils2 = __commonJS((exports, module) => {
24652
24888
  return target;
24653
24889
  }
24654
24890
  if (!target || typeof target !== "object") {
24655
- return [target].concat(source);
24891
+ if (isOverflow(source)) {
24892
+ var sourceKeys = Object.keys(source);
24893
+ var result = options && options.plainObjects ? { __proto__: null, 0: target } : { 0: target };
24894
+ for (var m = 0;m < sourceKeys.length; m++) {
24895
+ var oldKey = parseInt(sourceKeys[m], 10);
24896
+ result[oldKey + 1] = source[sourceKeys[m]];
24897
+ }
24898
+ return markOverflow(result, getMaxIndex(source) + 1);
24899
+ }
24900
+ var combined = [target].concat(source);
24901
+ if (options && typeof options.arrayLimit === "number" && combined.length > options.arrayLimit) {
24902
+ if (options.throwOnLimitExceeded) {
24903
+ throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
24904
+ }
24905
+ return markOverflow(arrayToObject(combined, options), combined.length - 1);
24906
+ }
24907
+ return combined;
24656
24908
  }
24657
24909
  var mergeTarget = target;
24658
24910
  if (isArray(target) && !isArray(source)) {
@@ -24665,27 +24917,42 @@ var require_utils2 = __commonJS((exports, module) => {
24665
24917
  if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
24666
24918
  target[i] = merge(targetItem, item, options);
24667
24919
  } else {
24668
- target.push(item);
24920
+ target[target.length] = item;
24669
24921
  }
24670
24922
  } else {
24671
24923
  target[i] = item;
24672
24924
  }
24673
24925
  });
24926
+ if (options && typeof options.arrayLimit === "number" && target.length > options.arrayLimit) {
24927
+ if (options.throwOnLimitExceeded) {
24928
+ throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
24929
+ }
24930
+ return markOverflow(arrayToObject(target, options), target.length - 1);
24931
+ }
24674
24932
  return target;
24675
24933
  }
24676
24934
  return Object.keys(source).reduce(function(acc, key) {
24677
24935
  var value = source[key];
24678
24936
  if (has.call(acc, key)) {
24679
- acc[key] = merge(acc[key], value, options);
24937
+ setProperty(acc, key, merge(acc[key], value, options));
24680
24938
  } else {
24681
- acc[key] = value;
24939
+ setProperty(acc, key, value);
24940
+ }
24941
+ if (isOverflow(source) && !isOverflow(acc)) {
24942
+ markOverflow(acc, getMaxIndex(source));
24943
+ }
24944
+ if (isOverflow(acc)) {
24945
+ var keyNum = parseInt(key, 10);
24946
+ if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
24947
+ setMaxIndex(acc, keyNum);
24948
+ }
24682
24949
  }
24683
24950
  return acc;
24684
24951
  }, mergeTarget);
24685
24952
  };
24686
24953
  var assign = function assignSingleSource(target, source) {
24687
24954
  return Object.keys(source).reduce(function(acc, key) {
24688
- acc[key] = source[key];
24955
+ setProperty(acc, key, source[key]);
24689
24956
  return acc;
24690
24957
  }, target);
24691
24958
  };
@@ -24719,6 +24986,13 @@ var require_utils2 = __commonJS((exports, module) => {
24719
24986
  var out = "";
24720
24987
  for (var j2 = 0;j2 < string4.length; j2 += limit) {
24721
24988
  var segment = string4.length >= limit ? string4.slice(j2, j2 + limit) : string4;
24989
+ if (j2 + limit < string4.length) {
24990
+ var last = segment.charCodeAt(segment.length - 1);
24991
+ if (last >= 55296 && last <= 56319) {
24992
+ segment = segment.slice(0, -1);
24993
+ j2 -= 1;
24994
+ }
24995
+ }
24722
24996
  var arr = [];
24723
24997
  for (var i = 0;i < segment.length; ++i) {
24724
24998
  var c = segment.charCodeAt(i);
@@ -24748,7 +25022,7 @@ var require_utils2 = __commonJS((exports, module) => {
24748
25022
  };
24749
25023
  var compact = function compact(value) {
24750
25024
  var queue = [{ obj: { o: value }, prop: "o" }];
24751
- var refs = [];
25025
+ var refs = getSideChannel();
24752
25026
  for (var i = 0;i < queue.length; ++i) {
24753
25027
  var item = queue[i];
24754
25028
  var obj = item.obj[item.prop];
@@ -24756,9 +25030,9 @@ var require_utils2 = __commonJS((exports, module) => {
24756
25030
  for (var j2 = 0;j2 < keys.length; ++j2) {
24757
25031
  var key = keys[j2];
24758
25032
  var val = obj[key];
24759
- if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
24760
- queue.push({ obj, prop: key });
24761
- refs.push(val);
25033
+ if (typeof val === "object" && val !== null && !refs.has(val)) {
25034
+ queue[queue.length] = { obj, prop: key };
25035
+ refs.set(val, true);
24762
25036
  }
24763
25037
  }
24764
25038
  }
@@ -24772,16 +25046,36 @@ var require_utils2 = __commonJS((exports, module) => {
24772
25046
  if (!obj || typeof obj !== "object") {
24773
25047
  return false;
24774
25048
  }
24775
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
25049
+ return !!(obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj));
24776
25050
  };
24777
- var combine = function combine(a, b) {
24778
- return [].concat(a, b);
25051
+ var combine = function combine(a, b, arrayLimit, plainObjects, throwOnLimitExceeded) {
25052
+ if (isOverflow(a)) {
25053
+ if (throwOnLimitExceeded) {
25054
+ throw new RangeError("Array limit exceeded. Only " + arrayLimit + " element" + (arrayLimit === 1 ? "" : "s") + " allowed in an array.");
25055
+ }
25056
+ var bValues = isArray(b) ? b : [b];
25057
+ var newIndex = getMaxIndex(a);
25058
+ for (var i = 0;i < bValues.length; ++i) {
25059
+ newIndex += 1;
25060
+ a[newIndex] = bValues[i];
25061
+ }
25062
+ setMaxIndex(a, newIndex);
25063
+ return a;
25064
+ }
25065
+ var result = [].concat(a, b);
25066
+ if (result.length > arrayLimit) {
25067
+ if (throwOnLimitExceeded) {
25068
+ throw new RangeError("Array limit exceeded. Only " + arrayLimit + " element" + (arrayLimit === 1 ? "" : "s") + " allowed in an array.");
25069
+ }
25070
+ return markOverflow(arrayToObject(result, { plainObjects }), result.length - 1);
25071
+ }
25072
+ return result;
24779
25073
  };
24780
25074
  var maybeMap = function maybeMap(val, fn) {
24781
25075
  if (isArray(val)) {
24782
25076
  var mapped = [];
24783
25077
  for (var i = 0;i < val.length; i += 1) {
24784
- mapped.push(fn(val[i]));
25078
+ mapped[mapped.length] = fn(val[i]);
24785
25079
  }
24786
25080
  return mapped;
24787
25081
  }
@@ -24795,7 +25089,9 @@ var require_utils2 = __commonJS((exports, module) => {
24795
25089
  decode: decode2,
24796
25090
  encode: encode2,
24797
25091
  isBuffer,
25092
+ isOverflow,
24798
25093
  isRegExp,
25094
+ markOverflow,
24799
25095
  maybeMap,
24800
25096
  merge: merge2
24801
25097
  };
@@ -24835,6 +25131,7 @@ var require_stringify = __commonJS((exports, module) => {
24835
25131
  charsetSentinel: false,
24836
25132
  commaRoundTrip: false,
24837
25133
  delimiter: "&",
25134
+ depth: Infinity,
24838
25135
  encode: true,
24839
25136
  encodeDotInKeys: false,
24840
25137
  encoder: utils.encode,
@@ -24853,8 +25150,11 @@ var require_stringify = __commonJS((exports, module) => {
24853
25150
  return typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean" || typeof v2 === "symbol" || typeof v2 === "bigint";
24854
25151
  };
24855
25152
  var sentinel = {};
24856
- var stringify = function stringify(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
25153
+ var stringify = function stringify(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel, depth, currentDepth) {
24857
25154
  var obj = object2;
25155
+ if (currentDepth > depth) {
25156
+ throw new RangeError("Input depth exceeded depth option of " + depth);
25157
+ }
24858
25158
  var tmpSc = sideChannel;
24859
25159
  var step = 0;
24860
25160
  var findFlag = false;
@@ -24872,9 +25172,8 @@ var require_stringify = __commonJS((exports, module) => {
24872
25172
  step = 0;
24873
25173
  }
24874
25174
  }
24875
- if (typeof filter === "function") {
24876
- obj = filter(prefix, obj);
24877
- } else if (obj instanceof Date) {
25175
+ obj = typeof filter === "function" ? filter(prefix, obj) : obj;
25176
+ if (obj instanceof Date) {
24878
25177
  obj = serializeDate(obj);
24879
25178
  } else if (generateArrayPrefix === "comma" && isArray(obj)) {
24880
25179
  obj = utils.maybeMap(obj, function(value2) {
@@ -24886,7 +25185,7 @@ var require_stringify = __commonJS((exports, module) => {
24886
25185
  }
24887
25186
  if (obj === null) {
24888
25187
  if (strictNullHandling) {
24889
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
25188
+ return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix);
24890
25189
  }
24891
25190
  obj = "";
24892
25191
  }
@@ -24904,7 +25203,9 @@ var require_stringify = __commonJS((exports, module) => {
24904
25203
  var objKeys;
24905
25204
  if (generateArrayPrefix === "comma" && isArray(obj)) {
24906
25205
  if (encodeValuesOnly && encoder) {
24907
- obj = utils.maybeMap(obj, encoder);
25206
+ obj = utils.maybeMap(obj, function(v2) {
25207
+ return v2 == null ? v2 : encoder(v2);
25208
+ });
24908
25209
  }
24909
25210
  objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : undefined }];
24910
25211
  } else if (isArray(filter)) {
@@ -24915,7 +25216,7 @@ var require_stringify = __commonJS((exports, module) => {
24915
25216
  }
24916
25217
  var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix);
24917
25218
  var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
24918
- if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
25219
+ if (allowEmptyArrays && isArray(obj) && obj.length === 0 && Object.keys(obj).length === 0) {
24919
25220
  return adjustedPrefix + "[]";
24920
25221
  }
24921
25222
  for (var j2 = 0;j2 < objKeys.length; ++j2) {
@@ -24929,7 +25230,7 @@ var require_stringify = __commonJS((exports, module) => {
24929
25230
  sideChannel.set(object2, step);
24930
25231
  var valueSideChannel = getSideChannel();
24931
25232
  valueSideChannel.set(sentinel, sideChannel);
24932
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
25233
+ pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel, depth, currentDepth + 1));
24933
25234
  }
24934
25235
  return values;
24935
25236
  };
@@ -24983,6 +25284,7 @@ var require_stringify = __commonJS((exports, module) => {
24983
25284
  charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
24984
25285
  commaRoundTrip: !!opts.commaRoundTrip,
24985
25286
  delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
25287
+ depth: typeof opts.depth === "number" ? opts.depth : defaults.depth,
24986
25288
  encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
24987
25289
  encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
24988
25290
  encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder,
@@ -25023,19 +25325,23 @@ var require_stringify = __commonJS((exports, module) => {
25023
25325
  var sideChannel = getSideChannel();
25024
25326
  for (var i = 0;i < objKeys.length; ++i) {
25025
25327
  var key = objKeys[i];
25328
+ if (typeof key === "undefined" || key === null) {
25329
+ continue;
25330
+ }
25026
25331
  var value = obj[key];
25027
25332
  if (options.skipNulls && value === null) {
25028
25333
  continue;
25029
25334
  }
25030
- pushToArray(keys, stringify(value, key, generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel));
25335
+ var encodedKey = options.encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key);
25336
+ pushToArray(keys, stringify(value, encodedKey, generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel, options.depth, 0));
25031
25337
  }
25032
25338
  var joined = keys.join(options.delimiter);
25033
25339
  var prefix = options.addQueryPrefix === true ? "?" : "";
25034
25340
  if (options.charsetSentinel) {
25035
25341
  if (options.charset === "iso-8859-1") {
25036
- prefix += "utf8=%26%2310003%3B&";
25342
+ prefix += "utf8=%26%2310003%3B" + options.delimiter;
25037
25343
  } else {
25038
- prefix += "utf8=%E2%9C%93&";
25344
+ prefix += "utf8=%E2%9C%93" + options.delimiter;
25039
25345
  }
25040
25346
  }
25041
25347
  return joined.length > 0 ? prefix + joined : "";
@@ -25067,6 +25373,7 @@ var require_parse = __commonJS((exports, module) => {
25067
25373
  parseArrays: true,
25068
25374
  plainObjects: false,
25069
25375
  strictDepth: false,
25376
+ strictMerge: true,
25070
25377
  strictNullHandling: false,
25071
25378
  throwOnLimitExceeded: false
25072
25379
  };
@@ -25077,6 +25384,17 @@ var require_parse = __commonJS((exports, module) => {
25077
25384
  };
25078
25385
  var parseArrayValue = function(val, options, currentArrayLength) {
25079
25386
  if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) {
25387
+ if (options.throwOnLimitExceeded) {
25388
+ var commaCount = 0;
25389
+ var commaIndex = val.indexOf(",");
25390
+ while (commaIndex > -1) {
25391
+ commaCount += 1;
25392
+ if (commaCount >= options.arrayLimit) {
25393
+ throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
25394
+ }
25395
+ commaIndex = val.indexOf(",", commaIndex + 1);
25396
+ }
25397
+ }
25080
25398
  return val.split(",");
25081
25399
  }
25082
25400
  if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
@@ -25091,8 +25409,8 @@ var require_parse = __commonJS((exports, module) => {
25091
25409
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
25092
25410
  cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
25093
25411
  var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
25094
- var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded ? limit + 1 : limit);
25095
- if (options.throwOnLimitExceeded && parts.length > limit) {
25412
+ var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded && typeof limit !== "undefined" ? limit + 1 : limit);
25413
+ if (options.throwOnLimitExceeded && typeof limit !== "undefined" && parts.length > limit) {
25096
25414
  throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed.");
25097
25415
  }
25098
25416
  var skipIndex = -1;
@@ -25125,9 +25443,11 @@ var require_parse = __commonJS((exports, module) => {
25125
25443
  val = options.strictNullHandling ? null : "";
25126
25444
  } else {
25127
25445
  key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key");
25128
- val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0), function(encodedVal) {
25129
- return options.decoder(encodedVal, defaults.decoder, charset, "value");
25130
- });
25446
+ if (key !== null) {
25447
+ val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0), function(encodedVal) {
25448
+ return options.decoder(encodedVal, defaults.decoder, charset, "value");
25449
+ });
25450
+ }
25131
25451
  }
25132
25452
  if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
25133
25453
  val = interpretNumericEntities(String(val));
@@ -25135,11 +25455,16 @@ var require_parse = __commonJS((exports, module) => {
25135
25455
  if (part.indexOf("[]=") > -1) {
25136
25456
  val = isArray(val) ? [val] : val;
25137
25457
  }
25138
- var existing = has.call(obj, key);
25139
- if (existing && options.duplicates === "combine") {
25140
- obj[key] = utils.combine(obj[key], val);
25141
- } else if (!existing || options.duplicates === "last") {
25142
- obj[key] = val;
25458
+ if (options.comma && isArray(val) && val.length > options.arrayLimit) {
25459
+ val = utils.combine([], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
25460
+ }
25461
+ if (key !== null) {
25462
+ var existing = has.call(obj, key);
25463
+ if (existing && (options.duplicates === "combine" || part.indexOf("[]=") > -1)) {
25464
+ obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
25465
+ } else if (!existing || options.duplicates === "last") {
25466
+ obj[key] = val;
25467
+ }
25143
25468
  }
25144
25469
  }
25145
25470
  return obj;
@@ -25155,17 +25480,27 @@ var require_parse = __commonJS((exports, module) => {
25155
25480
  var obj;
25156
25481
  var root = chain[i];
25157
25482
  if (root === "[]" && options.parseArrays) {
25158
- obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils.combine([], leaf);
25483
+ if (utils.isOverflow(leaf)) {
25484
+ obj = leaf;
25485
+ } else {
25486
+ obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils.combine([], leaf, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
25487
+ }
25159
25488
  } else {
25160
25489
  obj = options.plainObjects ? { __proto__: null } : {};
25161
25490
  var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
25162
25491
  var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
25163
25492
  var index = parseInt(decodedRoot, 10);
25493
+ var isValidArrayIndex = !isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && options.parseArrays;
25164
25494
  if (!options.parseArrays && decodedRoot === "") {
25165
25495
  obj = { 0: leaf };
25166
- } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
25496
+ } else if (isValidArrayIndex && index < options.arrayLimit) {
25167
25497
  obj = [];
25168
25498
  obj[index] = leaf;
25499
+ } else if (isValidArrayIndex && options.throwOnLimitExceeded) {
25500
+ throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
25501
+ } else if (isValidArrayIndex) {
25502
+ obj[index] = leaf;
25503
+ utils.markOverflow(obj, index);
25169
25504
  } else if (decodedRoot !== "__proto__") {
25170
25505
  obj[decodedRoot] = leaf;
25171
25506
  }
@@ -25174,39 +25509,74 @@ var require_parse = __commonJS((exports, module) => {
25174
25509
  }
25175
25510
  return leaf;
25176
25511
  };
25177
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
25178
- if (!givenKey) {
25179
- return;
25512
+ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
25513
+ var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, "[$1]") : originalKey;
25514
+ if (options.depth <= 0) {
25515
+ if (!options.plainObjects && has.call(Object.prototype, key)) {
25516
+ if (!options.allowPrototypes) {
25517
+ return;
25518
+ }
25519
+ }
25520
+ return [key];
25180
25521
  }
25181
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
25182
- var brackets = /(\[[^[\]]*])/;
25183
- var child = /(\[[^[\]]*])/g;
25184
- var segment = options.depth > 0 && brackets.exec(key);
25185
- var parent = segment ? key.slice(0, segment.index) : key;
25186
- var keys = [];
25522
+ var segments = [];
25523
+ var first = key.indexOf("[");
25524
+ var parent = first >= 0 ? key.slice(0, first) : key;
25187
25525
  if (parent) {
25188
25526
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
25189
25527
  if (!options.allowPrototypes) {
25190
25528
  return;
25191
25529
  }
25192
25530
  }
25193
- keys.push(parent);
25531
+ segments[segments.length] = parent;
25194
25532
  }
25195
- var i = 0;
25196
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
25197
- i += 1;
25198
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
25199
- if (!options.allowPrototypes) {
25200
- return;
25533
+ var n = key.length;
25534
+ var open = first;
25535
+ var collected = 0;
25536
+ while (open >= 0 && collected < options.depth) {
25537
+ var level = 1;
25538
+ var i = open + 1;
25539
+ var close = -1;
25540
+ while (i < n && close < 0) {
25541
+ var cu = key.charCodeAt(i);
25542
+ if (cu === 91) {
25543
+ level += 1;
25544
+ } else if (cu === 93) {
25545
+ level -= 1;
25546
+ if (level === 0) {
25547
+ close = i;
25548
+ }
25201
25549
  }
25550
+ i += 1;
25551
+ }
25552
+ if (close < 0) {
25553
+ segments[segments.length] = "[" + key.slice(open) + "]";
25554
+ return segments;
25555
+ }
25556
+ var seg = key.slice(open, close + 1);
25557
+ var content = seg.slice(1, -1);
25558
+ if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
25559
+ return;
25202
25560
  }
25203
- keys.push(segment[1]);
25561
+ segments[segments.length] = seg;
25562
+ collected += 1;
25563
+ open = key.indexOf("[", close + 1);
25204
25564
  }
25205
- if (segment) {
25565
+ if (open >= 0) {
25206
25566
  if (options.strictDepth === true) {
25207
25567
  throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
25208
25568
  }
25209
- keys.push("[" + key.slice(segment.index) + "]");
25569
+ segments[segments.length] = "[" + key.slice(open) + "]";
25570
+ }
25571
+ return segments;
25572
+ };
25573
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
25574
+ if (!givenKey) {
25575
+ return;
25576
+ }
25577
+ var keys = splitKeyIntoSegments(givenKey, options);
25578
+ if (!keys) {
25579
+ return;
25210
25580
  }
25211
25581
  return parseObject(keys, val, options, valuesParsed);
25212
25582
  };
@@ -25255,6 +25625,7 @@ var require_parse = __commonJS((exports, module) => {
25255
25625
  parseArrays: opts.parseArrays !== false,
25256
25626
  plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
25257
25627
  strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
25628
+ strictMerge: typeof opts.strictMerge === "boolean" ? !!opts.strictMerge : defaults.strictMerge,
25258
25629
  strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling,
25259
25630
  throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
25260
25631
  };
@@ -25310,10 +25681,7 @@ var require_urlencoded = __commonJS((exports, module) => {
25310
25681
  if (normalizedOptions.defaultCharset !== "utf-8" && normalizedOptions.defaultCharset !== "iso-8859-1") {
25311
25682
  throw new TypeError("option defaultCharset must be either utf-8 or iso-8859-1");
25312
25683
  }
25313
- var queryparse = createQueryParser(options);
25314
- function parse5(body, encoding) {
25315
- return body.length ? queryparse(body, encoding) : {};
25316
- }
25684
+ const parse5 = createQueryParser(options);
25317
25685
  const readOptions = {
25318
25686
  ...normalizedOptions,
25319
25687
  isValidCharset: (charset) => charset === "utf-8" || charset === "iso-8859-1"
@@ -25323,11 +25691,11 @@ var require_urlencoded = __commonJS((exports, module) => {
25323
25691
  };
25324
25692
  }
25325
25693
  function createQueryParser(options) {
25326
- var extended = Boolean(options?.extended);
25327
- var parameterLimit = options?.parameterLimit !== undefined ? options?.parameterLimit : 1000;
25328
- var charsetSentinel = options?.charsetSentinel;
25329
- var interpretNumericEntities = options?.interpretNumericEntities;
25330
- var depth = extended ? options?.depth !== undefined ? options?.depth : 32 : 0;
25694
+ const extended = Boolean(options?.extended);
25695
+ let parameterLimit = options?.parameterLimit !== undefined ? options?.parameterLimit : 1000;
25696
+ const charsetSentinel = options?.charsetSentinel;
25697
+ const interpretNumericEntities = options?.interpretNumericEntities;
25698
+ const depth = extended ? options?.depth !== undefined ? options?.depth : 32 : 0;
25331
25699
  if (isNaN(parameterLimit) || parameterLimit < 1) {
25332
25700
  throw new TypeError("option parameterLimit must be a positive number");
25333
25701
  }
@@ -25337,15 +25705,17 @@ var require_urlencoded = __commonJS((exports, module) => {
25337
25705
  if (isFinite(parameterLimit)) {
25338
25706
  parameterLimit = parameterLimit | 0;
25339
25707
  }
25340
- return function queryparse(body, encoding) {
25341
- var paramCount = parameterCount(body, parameterLimit);
25708
+ return function parse(body, encoding) {
25709
+ if (!body.length)
25710
+ return {};
25711
+ const paramCount = parameterCount(body, parameterLimit);
25342
25712
  if (paramCount === undefined) {
25343
25713
  debug("too many parameters");
25344
25714
  throw createError(413, "too many parameters", {
25345
25715
  type: "parameters.too.many"
25346
25716
  });
25347
25717
  }
25348
- var arrayLimit = extended ? Math.max(100, paramCount) : 0;
25718
+ const arrayLimit = extended ? Math.max(100, paramCount) : paramCount;
25349
25719
  debug("parse " + (extended ? "extended " : "") + "urlencoding");
25350
25720
  try {
25351
25721
  return qs.parse(body, {
@@ -25390,26 +25760,10 @@ var require_body_parser = __commonJS((exports, module) => {
25390
25760
  * MIT Licensed
25391
25761
  */
25392
25762
  exports = module.exports = bodyParser;
25393
- Object.defineProperty(exports, "json", {
25394
- configurable: true,
25395
- enumerable: true,
25396
- get: () => require_json()
25397
- });
25398
- Object.defineProperty(exports, "raw", {
25399
- configurable: true,
25400
- enumerable: true,
25401
- get: () => require_raw()
25402
- });
25403
- Object.defineProperty(exports, "text", {
25404
- configurable: true,
25405
- enumerable: true,
25406
- get: () => require_text()
25407
- });
25408
- Object.defineProperty(exports, "urlencoded", {
25409
- configurable: true,
25410
- enumerable: true,
25411
- get: () => require_urlencoded()
25412
- });
25763
+ exports.json = require_json();
25764
+ exports.raw = require_raw();
25765
+ exports.text = require_text();
25766
+ exports.urlencoded = require_urlencoded();
25413
25767
  function bodyParser() {
25414
25768
  throw new Error("The bodyParser() generic has been split into individual middleware to use instead.");
25415
25769
  }
@@ -25822,6 +26176,112 @@ var require_view = __commonJS((exports, module) => {
25822
26176
  }
25823
26177
  });
25824
26178
 
26179
+ // node_modules/content-type/index.js
26180
+ var require_content_type = __commonJS((exports) => {
26181
+ /*!
26182
+ * content-type
26183
+ * Copyright(c) 2015 Douglas Christopher Wilson
26184
+ * MIT Licensed
26185
+ */
26186
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
26187
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
26188
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
26189
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
26190
+ var QUOTE_REGEXP = /([\\"])/g;
26191
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
26192
+ exports.format = format;
26193
+ exports.parse = parse5;
26194
+ function format(obj) {
26195
+ if (!obj || typeof obj !== "object") {
26196
+ throw new TypeError("argument obj is required");
26197
+ }
26198
+ var parameters = obj.parameters;
26199
+ var type = obj.type;
26200
+ if (!type || !TYPE_REGEXP.test(type)) {
26201
+ throw new TypeError("invalid type");
26202
+ }
26203
+ var string4 = type;
26204
+ if (parameters && typeof parameters === "object") {
26205
+ var param;
26206
+ var params = Object.keys(parameters).sort();
26207
+ for (var i = 0;i < params.length; i++) {
26208
+ param = params[i];
26209
+ if (!TOKEN_REGEXP.test(param)) {
26210
+ throw new TypeError("invalid parameter name");
26211
+ }
26212
+ string4 += "; " + param + "=" + qstring(parameters[param]);
26213
+ }
26214
+ }
26215
+ return string4;
26216
+ }
26217
+ function parse5(string4) {
26218
+ if (!string4) {
26219
+ throw new TypeError("argument string is required");
26220
+ }
26221
+ var header = typeof string4 === "object" ? getcontenttype(string4) : string4;
26222
+ if (typeof header !== "string") {
26223
+ throw new TypeError("argument string is required to be a string");
26224
+ }
26225
+ var index = header.indexOf(";");
26226
+ var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
26227
+ if (!TYPE_REGEXP.test(type)) {
26228
+ throw new TypeError("invalid media type");
26229
+ }
26230
+ var obj = new ContentType(type.toLowerCase());
26231
+ if (index !== -1) {
26232
+ var key;
26233
+ var match;
26234
+ var value;
26235
+ PARAM_REGEXP.lastIndex = index;
26236
+ while (match = PARAM_REGEXP.exec(header)) {
26237
+ if (match.index !== index) {
26238
+ throw new TypeError("invalid parameter format");
26239
+ }
26240
+ index += match[0].length;
26241
+ key = match[1].toLowerCase();
26242
+ value = match[2];
26243
+ if (value.charCodeAt(0) === 34) {
26244
+ value = value.slice(1, -1);
26245
+ if (value.indexOf("\\") !== -1) {
26246
+ value = value.replace(QESC_REGEXP, "$1");
26247
+ }
26248
+ }
26249
+ obj.parameters[key] = value;
26250
+ }
26251
+ if (index !== header.length) {
26252
+ throw new TypeError("invalid parameter format");
26253
+ }
26254
+ }
26255
+ return obj;
26256
+ }
26257
+ function getcontenttype(obj) {
26258
+ var header;
26259
+ if (typeof obj.getHeader === "function") {
26260
+ header = obj.getHeader("content-type");
26261
+ } else if (typeof obj.headers === "object") {
26262
+ header = obj.headers && obj.headers["content-type"];
26263
+ }
26264
+ if (typeof header !== "string") {
26265
+ throw new TypeError("content-type header is missing from object");
26266
+ }
26267
+ return header;
26268
+ }
26269
+ function qstring(val) {
26270
+ var str = String(val);
26271
+ if (TOKEN_REGEXP.test(str)) {
26272
+ return str;
26273
+ }
26274
+ if (str.length > 0 && !TEXT_REGEXP.test(str)) {
26275
+ throw new TypeError("invalid parameter value");
26276
+ }
26277
+ return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
26278
+ }
26279
+ function ContentType(type) {
26280
+ this.parameters = Object.create(null);
26281
+ this.type = type;
26282
+ }
26283
+ });
26284
+
25825
26285
  // node_modules/etag/index.js
25826
26286
  var require_etag = __commonJS((exports, module) => {
25827
26287
  /*!
@@ -26913,7 +27373,7 @@ var require_is_promise = __commonJS((exports, module) => {
26913
27373
  });
26914
27374
 
26915
27375
  // node_modules/path-to-regexp/dist/index.js
26916
- var require_dist = __commonJS((exports) => {
27376
+ var require_dist3 = __commonJS((exports) => {
26917
27377
  Object.defineProperty(exports, "__esModule", { value: true });
26918
27378
  exports.PathError = exports.TokenData = undefined;
26919
27379
  exports.parse = parse5;
@@ -27273,7 +27733,7 @@ var require_layer = __commonJS((exports, module) => {
27273
27733
  * MIT Licensed
27274
27734
  */
27275
27735
  var isPromise2 = require_is_promise();
27276
- var pathRegexp = require_dist();
27736
+ var pathRegexp = require_dist3();
27277
27737
  var debug = require_src()("router:layer");
27278
27738
  var deprecate = require_depd()("router");
27279
27739
  var TRAILING_SLASH_REGEXP = /\/+$/;
@@ -40048,10 +40508,12 @@ var require_data = __commonJS((exports, module) => {
40048
40508
  var require_utils4 = __commonJS((exports, module) => {
40049
40509
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
40050
40510
  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);
40511
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
40051
40512
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
40052
40513
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
40053
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
40054
- var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/?]$/iu);
40514
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
40515
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
40516
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
40055
40517
  function stringArrayToHexStripped(input) {
40056
40518
  let acc = "";
40057
40519
  let code = 0;
@@ -40076,91 +40538,127 @@ var require_utils4 = __commonJS((exports, module) => {
40076
40538
  }
40077
40539
  return acc;
40078
40540
  }
40541
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
40542
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
40543
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
40079
40544
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
40080
- function consumeIsZone(buffer) {
40081
- buffer.length = 0;
40082
- return true;
40545
+ var nonSimpleDomainChars = RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u);
40546
+ var numericLastLabel = RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);
40547
+ function nonSimpleMailtoDomain(domain) {
40548
+ return nonSimpleDomainChars(domain) || numericLastLabel(domain);
40083
40549
  }
40084
- function consumeHextets(buffer, address, output) {
40085
- if (buffer.length) {
40086
- const hex = stringArrayToHexStripped(buffer);
40087
- if (hex !== "") {
40088
- address.push(hex);
40089
- } else {
40090
- output.error = true;
40091
- return false;
40550
+ function isZoneIdentifier(zone) {
40551
+ if (zone.length === 0)
40552
+ return false;
40553
+ for (let i = 0;i < zone.length; i++) {
40554
+ if (isZoneCharacter(zone[i]))
40555
+ continue;
40556
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
40557
+ i += 2;
40558
+ continue;
40092
40559
  }
40093
- buffer.length = 0;
40560
+ return false;
40094
40561
  }
40095
40562
  return true;
40096
40563
  }
40097
- function getIPV6(input) {
40098
- let tokenCount = 0;
40099
- const output = { error: false, address: "", zone: "" };
40100
- const address = [];
40101
- const buffer = [];
40102
- let endipv6Encountered = false;
40103
- let endIpv6 = false;
40104
- let consume = consumeHextets;
40105
- for (let i = 0;i < input.length; i++) {
40106
- const cursor = input[i];
40107
- if (cursor === "[" || cursor === "]") {
40108
- continue;
40109
- }
40110
- if (cursor === ":") {
40111
- if (endipv6Encountered === true) {
40112
- endIpv6 = true;
40113
- }
40114
- if (!consume(buffer, address, output)) {
40115
- break;
40564
+ function compressIPv6ZeroRun(hextets) {
40565
+ let bestStart = -1;
40566
+ let bestLength = 0;
40567
+ let runStart = -1;
40568
+ let runLength = 0;
40569
+ for (let i = 0;i < hextets.length; i++) {
40570
+ if (hextets[i] === "0") {
40571
+ if (runStart === -1)
40572
+ runStart = i;
40573
+ runLength++;
40574
+ if (runLength > bestLength) {
40575
+ bestLength = runLength;
40576
+ bestStart = runStart;
40116
40577
  }
40117
- if (++tokenCount > 7) {
40118
- output.error = true;
40119
- break;
40120
- }
40121
- if (i > 0 && input[i - 1] === ":") {
40122
- endipv6Encountered = true;
40123
- }
40124
- address.push(":");
40125
- continue;
40126
- } else if (cursor === "%") {
40127
- if (!consume(buffer, address, output)) {
40128
- break;
40129
- }
40130
- consume = consumeIsZone;
40131
40578
  } else {
40132
- buffer.push(cursor);
40133
- continue;
40579
+ runStart = -1;
40580
+ runLength = 0;
40134
40581
  }
40135
40582
  }
40136
- if (buffer.length) {
40137
- if (consume === consumeIsZone) {
40138
- output.zone = buffer.join("");
40139
- } else if (endIpv6) {
40140
- address.push(buffer.join(""));
40141
- } else {
40142
- address.push(stringArrayToHexStripped(buffer));
40583
+ if (bestLength < 2)
40584
+ return hextets.join(":");
40585
+ const head = hextets.slice(0, bestStart).join(":");
40586
+ const tail = hextets.slice(bestStart + bestLength).join(":");
40587
+ return head + "::" + tail;
40588
+ }
40589
+ function normalizeIPv6Address(input) {
40590
+ const compression = input.indexOf("::");
40591
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1)
40592
+ return;
40593
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
40594
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
40595
+ if (compression !== -1) {
40596
+ if (left.length === 1 && left[0] === "")
40597
+ left.length = 0;
40598
+ if (right.length === 1 && right[0] === "")
40599
+ right.length = 0;
40600
+ }
40601
+ const parts = left.concat(right);
40602
+ let hextetCount = 0;
40603
+ for (let i = 0;i < parts.length; i++) {
40604
+ const part = parts[i];
40605
+ if (part === "")
40606
+ return;
40607
+ if (part.indexOf(".") !== -1) {
40608
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part))
40609
+ return;
40610
+ hextetCount += 2;
40611
+ continue;
40143
40612
  }
40613
+ if (!isHextet(part))
40614
+ return;
40615
+ parts[i] = parseInt(part, 16).toString(16);
40616
+ hextetCount++;
40144
40617
  }
40145
- output.address = address.join("");
40146
- return output;
40618
+ if (compression === -1) {
40619
+ if (hextetCount !== 8)
40620
+ return;
40621
+ return compressIPv6ZeroRun(parts);
40622
+ }
40623
+ if (hextetCount >= 8)
40624
+ return;
40625
+ const expanded = parts.slice(0, left.length);
40626
+ for (let i = hextetCount;i < 8; i++)
40627
+ expanded.push("0");
40628
+ for (let i = left.length;i < parts.length; i++)
40629
+ expanded.push(parts[i]);
40630
+ return compressIPv6ZeroRun(expanded);
40147
40631
  }
40148
40632
  function normalizeIPv6(host) {
40149
- if (findToken(host, ":") < 2) {
40150
- return { host, isIPV6: false };
40151
- }
40152
- const ipv62 = getIPV6(host);
40153
- if (!ipv62.error) {
40154
- let newHost = ipv62.address;
40155
- let escapedHost = ipv62.address;
40156
- if (ipv62.zone) {
40157
- newHost += "%" + ipv62.zone;
40158
- escapedHost += "%25" + ipv62.zone;
40159
- }
40160
- return { host: newHost, isIPV6: true, escapedHost };
40161
- } else {
40162
- return { host, isIPV6: false };
40163
- }
40633
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
40634
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
40635
+ if (hasBracket && !bracketed)
40636
+ return { host, isIPV6: false, error: true };
40637
+ let input = bracketed ? host.slice(1, -1) : host;
40638
+ if (bracketed && isIPvFuture(input)) {
40639
+ input = input.toLowerCase();
40640
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
40641
+ }
40642
+ if (findToken(input, ":") < 2) {
40643
+ return { host, isIPV6: false, error: bracketed };
40644
+ }
40645
+ let zoneIdentifier = "";
40646
+ const zoneSeparator = input.indexOf("%");
40647
+ if (zoneSeparator !== -1) {
40648
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
40649
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
40650
+ if (!isZoneIdentifier(zoneIdentifier))
40651
+ return { host, isIPV6: false, error: true };
40652
+ input = input.slice(0, zoneSeparator);
40653
+ }
40654
+ const address = normalizeIPv6Address(input);
40655
+ if (address === undefined)
40656
+ return { host, isIPV6: false, error: true };
40657
+ return {
40658
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
40659
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
40660
+ isIPV6: true
40661
+ };
40164
40662
  }
40165
40663
  function findToken(str, token) {
40166
40664
  let ind = 0;
@@ -40337,6 +40835,45 @@ var require_utils4 = __commonJS((exports, module) => {
40337
40835
  }
40338
40836
  return output;
40339
40837
  }
40838
+ function serializePathEncoding(input, pathNoScheme = false) {
40839
+ let output = "";
40840
+ let firstSegment = pathNoScheme && input[0] !== "/";
40841
+ for (let i = 0;i < input.length; i++) {
40842
+ const ch = input[i];
40843
+ if (ch === "%" && i + 2 < input.length) {
40844
+ const hex = input.slice(i + 1, i + 3);
40845
+ if (isHexPair(hex)) {
40846
+ output += "%" + hex.toUpperCase();
40847
+ i += 2;
40848
+ continue;
40849
+ }
40850
+ }
40851
+ if (ch === "/") {
40852
+ firstSegment = false;
40853
+ }
40854
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
40855
+ output += ch;
40856
+ } else {
40857
+ const code = input.charCodeAt(i);
40858
+ if (code < 128) {
40859
+ output += BYTE_HEX[code];
40860
+ } else if (code < 55296 || code > 57343) {
40861
+ output += percentEncodeNonAscii(code);
40862
+ } else if (code <= 56319 && i + 1 < input.length) {
40863
+ const low = input.charCodeAt(i + 1);
40864
+ if (low >= 56320 && low <= 57343) {
40865
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
40866
+ i++;
40867
+ } else {
40868
+ output += percentEncodeNonAscii(65533);
40869
+ }
40870
+ } else {
40871
+ output += percentEncodeNonAscii(65533);
40872
+ }
40873
+ }
40874
+ }
40875
+ return output;
40876
+ }
40340
40877
  function normalizeQueryFragmentEncoding(input) {
40341
40878
  let output = "";
40342
40879
  for (let i = 0;i < input.length; i++) {
@@ -40378,6 +40915,50 @@ var require_utils4 = __commonJS((exports, module) => {
40378
40915
  }
40379
40916
  return output;
40380
40917
  }
40918
+ function encodeComponent(input, isAllowed) {
40919
+ let output = "";
40920
+ for (let i = 0;i < input.length; i++) {
40921
+ const ch = input[i];
40922
+ if (ch === "%" && i + 2 < input.length) {
40923
+ const hex = input.slice(i + 1, i + 3);
40924
+ if (isHexPair(hex)) {
40925
+ output += "%" + hex.toUpperCase();
40926
+ i += 2;
40927
+ continue;
40928
+ }
40929
+ }
40930
+ if (isAllowed(ch)) {
40931
+ output += ch;
40932
+ } else {
40933
+ const code = input.charCodeAt(i);
40934
+ if (code < 128) {
40935
+ output += BYTE_HEX[code];
40936
+ } else if (code < 55296 || code > 57343) {
40937
+ output += percentEncodeNonAscii(code);
40938
+ } else if (code <= 56319 && i + 1 < input.length) {
40939
+ const low = input.charCodeAt(i + 1);
40940
+ if (low >= 56320 && low <= 57343) {
40941
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
40942
+ i++;
40943
+ } else {
40944
+ output += percentEncodeNonAscii(65533);
40945
+ }
40946
+ } else {
40947
+ output += percentEncodeNonAscii(65533);
40948
+ }
40949
+ }
40950
+ }
40951
+ return output;
40952
+ }
40953
+ function encodeUserinfo(input) {
40954
+ return encodeComponent(input, isUserinfoCharacter);
40955
+ }
40956
+ function encodeQuery(input) {
40957
+ return encodeComponent(input, isQueryFragmentCharacter);
40958
+ }
40959
+ function encodeFragment(input) {
40960
+ return encodeComponent(input, isQueryFragmentCharacter);
40961
+ }
40381
40962
  function escapePreservingEscapes(input) {
40382
40963
  let output = "";
40383
40964
  for (let i = 0;i < input.length; i++) {
@@ -40409,37 +40990,73 @@ var require_utils4 = __commonJS((exports, module) => {
40409
40990
  }
40410
40991
  return output;
40411
40992
  }
40993
+ function recomposeZonedIPv6Host(component) {
40994
+ const zone = component.ipv6Zone;
40995
+ if (zone === undefined)
40996
+ return;
40997
+ const host = component.host;
40998
+ const separator = host.indexOf("%");
40999
+ if (separator === -1)
41000
+ return;
41001
+ const address = host.slice(0, separator);
41002
+ const escaped = address + "%25" + zone;
41003
+ const derived = normalizeIPv6("[" + escaped + "]");
41004
+ if (derived.isIPV6 === true && derived.host === host) {
41005
+ return "[" + escaped + "]";
41006
+ }
41007
+ return;
41008
+ }
40412
41009
  function recomposeAuthority(component) {
40413
41010
  const uriTokens = [];
40414
41011
  if (component.userinfo !== undefined) {
40415
- uriTokens.push(component.userinfo);
41012
+ uriTokens.push(encodeUserinfo(component.userinfo));
40416
41013
  uriTokens.push("@");
40417
41014
  }
40418
41015
  if (component.host !== undefined) {
40419
- let host = unescape(component.host);
41016
+ let host = component.host;
40420
41017
  if (!isIPv4(host)) {
40421
- const ipV6res = normalizeIPv6(host);
40422
- if (ipV6res.isIPV6 === true) {
40423
- host = `[${ipV6res.escapedHost}]`;
41018
+ const zonedHost = recomposeZonedIPv6Host(component);
41019
+ if (zonedHost !== undefined) {
41020
+ host = zonedHost;
40424
41021
  } else {
40425
- host = reescapeHostDelimiters(host, false);
41022
+ let ipV6res = normalizeIPv6(host);
41023
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
41024
+ host = normalizePercentEncoding(host, true);
41025
+ ipV6res = normalizeIPv6(host);
41026
+ }
41027
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
41028
+ host = `[${ipV6res.escapedHost}]`;
41029
+ } else {
41030
+ host = reescapeHostDelimiters(host, false);
41031
+ }
40426
41032
  }
40427
41033
  }
40428
41034
  uriTokens.push(host);
40429
41035
  }
40430
41036
  if (typeof component.port === "number" || typeof component.port === "string") {
41037
+ const port = String(component.port);
41038
+ if (!isPort(port)) {
41039
+ throw new TypeError("URI port is malformed.");
41040
+ }
40431
41041
  uriTokens.push(":");
40432
- uriTokens.push(String(component.port));
41042
+ uriTokens.push(port);
40433
41043
  }
40434
41044
  return uriTokens.length ? uriTokens.join("") : undefined;
40435
41045
  }
40436
41046
  module.exports = {
41047
+ BYTE_HEX,
41048
+ percentEncodeNonAscii,
40437
41049
  nonSimpleDomain,
41050
+ nonSimpleMailtoDomain,
40438
41051
  recomposeAuthority,
40439
41052
  reescapeHostDelimiters,
40440
41053
  normalizePercentEncoding,
40441
41054
  normalizePathEncoding,
41055
+ serializePathEncoding,
40442
41056
  normalizeQueryFragmentEncoding,
41057
+ encodeUserinfo,
41058
+ encodeQuery,
41059
+ encodeFragment,
40443
41060
  escapePreservingEscapes,
40444
41061
  removeDotSegments,
40445
41062
  isIPv4,
@@ -40451,15 +41068,16 @@ var require_utils4 = __commonJS((exports, module) => {
40451
41068
 
40452
41069
  // node_modules/fast-uri/lib/schemes.js
40453
41070
  var require_schemes = __commonJS((exports, module) => {
40454
- var { isUUID } = require_utils4();
40455
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
41071
+ var { isUUID, BYTE_HEX, percentEncodeNonAscii, nonSimpleMailtoDomain } = require_utils4();
41072
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
40456
41073
  var supportedSchemeNames = [
40457
41074
  "http",
40458
41075
  "https",
40459
41076
  "ws",
40460
41077
  "wss",
40461
41078
  "urn",
40462
- "urn:uuid"
41079
+ "urn:uuid",
41080
+ "mailto"
40463
41081
  ];
40464
41082
  function isValidSchemeName(name) {
40465
41083
  return supportedSchemeNames.indexOf(name) !== -1;
@@ -40507,9 +41125,10 @@ var require_schemes = __commonJS((exports, module) => {
40507
41125
  wsComponent.secure = undefined;
40508
41126
  }
40509
41127
  if (wsComponent.resourceName) {
40510
- const [path, query] = wsComponent.resourceName.split("?");
41128
+ const queryIndex = wsComponent.resourceName.indexOf("?");
41129
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
40511
41130
  wsComponent.path = path && path !== "/" ? path : undefined;
40512
- wsComponent.query = query;
41131
+ wsComponent.query = queryIndex === -1 ? undefined : wsComponent.resourceName.slice(queryIndex + 1);
40513
41132
  wsComponent.resourceName = undefined;
40514
41133
  }
40515
41134
  wsComponent.fragment = undefined;
@@ -40521,7 +41140,7 @@ var require_schemes = __commonJS((exports, module) => {
40521
41140
  return urnComponent;
40522
41141
  }
40523
41142
  const matches = urnComponent.path.match(URN_REG);
40524
- if (matches) {
41143
+ if (matches && matches[0] === urnComponent.path) {
40525
41144
  const scheme = options.scheme || urnComponent.scheme || "urn";
40526
41145
  urnComponent.nid = matches[1].toLowerCase();
40527
41146
  urnComponent.nss = matches[2];
@@ -40603,13 +41222,262 @@ var require_schemes = __commonJS((exports, module) => {
40603
41222
  serialize: urnuuidSerialize,
40604
41223
  skipNormalize: true
40605
41224
  };
41225
+ var LOCAL_PART_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=";
41226
+ var HFNAME_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@";
41227
+ var DTEXT_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";
41228
+ function allowSet(chars, allowNonAscii = false) {
41229
+ const table = new Uint8Array(128);
41230
+ for (let i = 0;i < chars.length; i++) {
41231
+ table[chars.charCodeAt(i)] = 1;
41232
+ }
41233
+ const escaped = chars.replace(/[\\\]^-]/gu, "\\$&");
41234
+ const cls = allowNonAscii ? `[${escaped}]|[^\\0-\\x7F\\uD800-\\uDFFF]` : `[${escaped}]`;
41235
+ return { all: new RegExp(`^(?:${cls})*$`, "u"), table, allowNonAscii };
41236
+ }
41237
+ var LOCAL_PART = allowSet(LOCAL_PART_ALLOWED);
41238
+ var HFNAME = allowSet(HFNAME_ALLOWED);
41239
+ var DTEXT = allowSet(DTEXT_ALLOWED);
41240
+ var DTEXT_IRI = allowSet(DTEXT_ALLOWED, true);
41241
+ var HEX_PAIR = /^[\da-f]{2}$/iu;
41242
+ var MAILTO_DOMAIN_LITERAL = /^\[[\x21-\x5A\x5E-\x7E]*\]$/u;
41243
+ var MAILTO_DOMAIN_ERROR = "URI mailto has an invalid recipient domain.";
41244
+ var MAILTO_AUTHORITY_ERROR = "URI mailto must not have an authority component.";
41245
+ var HAS_SURROGATE = /[\uD800-\uDFFF]/u;
41246
+ function decodeHex(str) {
41247
+ if (typeof str !== "string" || str.indexOf("%") === -1) {
41248
+ return str;
41249
+ }
41250
+ try {
41251
+ return decodeURIComponent(str);
41252
+ } catch {
41253
+ return str;
41254
+ }
41255
+ }
41256
+ function replaceLoneSurrogates(input) {
41257
+ let result = "";
41258
+ for (let i = 0;i < input.length; i++) {
41259
+ const code = input.charCodeAt(i);
41260
+ if (code >= 55296 && code <= 56319 && i + 1 < input.length) {
41261
+ const low = input.charCodeAt(i + 1);
41262
+ if (low >= 56320 && low <= 57343) {
41263
+ result += input[i] + input[i + 1];
41264
+ i++;
41265
+ continue;
41266
+ }
41267
+ }
41268
+ result += code >= 55296 && code <= 57343 ? "�" : input[i];
41269
+ }
41270
+ return result;
41271
+ }
41272
+ function encodeWithAllow(input, set2) {
41273
+ if (set2.all.test(input)) {
41274
+ return input;
41275
+ }
41276
+ const table = set2.table;
41277
+ let result = "";
41278
+ for (let i = 0;i < input.length; i++) {
41279
+ const code = input.charCodeAt(i);
41280
+ if (code < 128) {
41281
+ if (table[code] === 1) {
41282
+ result += input[i];
41283
+ } else if (code === 37 && i + 2 < input.length && HEX_PAIR.test(input.slice(i + 1, i + 3))) {
41284
+ result += "%" + input.slice(i + 1, i + 3).toUpperCase();
41285
+ i += 2;
41286
+ } else {
41287
+ result += BYTE_HEX[code];
41288
+ }
41289
+ continue;
41290
+ }
41291
+ if (code < 55296 || code > 57343) {
41292
+ result += set2.allowNonAscii ? input[i] : percentEncodeNonAscii(code);
41293
+ continue;
41294
+ }
41295
+ if (code <= 56319 && i + 1 < input.length) {
41296
+ const low = input.charCodeAt(i + 1);
41297
+ if (low >= 56320 && low <= 57343) {
41298
+ result += set2.allowNonAscii ? input[i] + input[i + 1] : percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
41299
+ i++;
41300
+ continue;
41301
+ }
41302
+ }
41303
+ result += set2.allowNonAscii ? "�" : percentEncodeNonAscii(65533);
41304
+ }
41305
+ return result;
41306
+ }
41307
+ function mailtoNormalizeDomain(domain, options, component) {
41308
+ const normalizedDomain = String(domain).toLowerCase();
41309
+ if (MAILTO_DOMAIN_LITERAL.test(normalizedDomain)) {
41310
+ return normalizedDomain;
41311
+ }
41312
+ if (normalizedDomain !== "" && !nonSimpleMailtoDomain(normalizedDomain)) {
41313
+ return normalizedDomain;
41314
+ }
41315
+ try {
41316
+ const parsedDomain = new URL("http://" + normalizedDomain);
41317
+ if (parsedDomain.username || parsedDomain.password || parsedDomain.port || parsedDomain.pathname !== "/" || parsedDomain.search || parsedDomain.hash || !parsedDomain.hostname) {
41318
+ throw new Error(MAILTO_DOMAIN_ERROR);
41319
+ }
41320
+ return options && options.unicodeSupport ? normalizedDomain : parsedDomain.hostname;
41321
+ } catch {
41322
+ if (component) {
41323
+ component.error = component.error || MAILTO_DOMAIN_ERROR;
41324
+ }
41325
+ return normalizedDomain;
41326
+ }
41327
+ }
41328
+ function mailtoEncodeDomain(domain, options) {
41329
+ const set2 = options && options.unicodeSupport ? DTEXT_IRI : DTEXT;
41330
+ if (domain.length > 1 && domain[0] === "[" && domain[domain.length - 1] === "]") {
41331
+ return "[" + encodeWithAllow(domain.slice(1, -1), set2) + "]";
41332
+ }
41333
+ return encodeWithAllow(domain, set2);
41334
+ }
41335
+ function mailtoParse(component, options) {
41336
+ const mailtoComponent = component;
41337
+ let rawPath = mailtoComponent.path;
41338
+ let rawQuery = mailtoComponent.query;
41339
+ if (rawPath && HAS_SURROGATE.test(rawPath))
41340
+ rawPath = replaceLoneSurrogates(rawPath);
41341
+ if (rawQuery && HAS_SURROGATE.test(rawQuery))
41342
+ rawQuery = replaceLoneSurrogates(rawQuery);
41343
+ const to = rawPath ? rawPath.indexOf(",") === -1 ? [rawPath] : rawPath.split(",") : [];
41344
+ mailtoComponent.path = undefined;
41345
+ if (rawQuery) {
41346
+ let headers = null;
41347
+ let start = 0;
41348
+ while (start <= rawQuery.length) {
41349
+ let end = rawQuery.indexOf("&", start);
41350
+ if (end === -1)
41351
+ end = rawQuery.length;
41352
+ const token = rawQuery.slice(start, end);
41353
+ start = end + 1;
41354
+ const eqIdx = token.indexOf("=");
41355
+ if (eqIdx !== token.lastIndexOf("=")) {
41356
+ mailtoComponent.error = mailtoComponent.error || "URI mailto has malformed header fields.";
41357
+ continue;
41358
+ }
41359
+ const name = decodeHex(eqIdx === -1 ? token : token.slice(0, eqIdx));
41360
+ const normalizedName = name.toLowerCase();
41361
+ const value = eqIdx === -1 ? "" : token.slice(eqIdx + 1);
41362
+ if (normalizedName === "to") {
41363
+ const addrs = value.split(",");
41364
+ for (let j2 = 0;j2 < addrs.length; j2++)
41365
+ to.push(addrs[j2]);
41366
+ continue;
41367
+ }
41368
+ if (normalizedName === "subject") {
41369
+ mailtoComponent.subject = decodeHex(value);
41370
+ continue;
41371
+ }
41372
+ if (normalizedName === "body") {
41373
+ mailtoComponent.body = decodeHex(value);
41374
+ continue;
41375
+ }
41376
+ if (headers === null)
41377
+ headers = Object.create(null);
41378
+ headers[name] = decodeHex(value);
41379
+ }
41380
+ if (headers !== null)
41381
+ mailtoComponent.headers = headers;
41382
+ }
41383
+ mailtoComponent.query = undefined;
41384
+ if (to.length > 0 && (mailtoComponent.userinfo !== undefined || mailtoComponent.host !== undefined || mailtoComponent.port !== undefined)) {
41385
+ mailtoComponent.userinfo = undefined;
41386
+ mailtoComponent.host = undefined;
41387
+ mailtoComponent.port = undefined;
41388
+ mailtoComponent.error = mailtoComponent.error || MAILTO_AUTHORITY_ERROR;
41389
+ }
41390
+ for (let i = 0;i < to.length; i++) {
41391
+ const rawAddr = to[i];
41392
+ const atIdx = rawAddr.lastIndexOf("@");
41393
+ if (atIdx < 0) {
41394
+ mailtoComponent.error = mailtoComponent.error || MAILTO_DOMAIN_ERROR;
41395
+ to[i] = decodeHex(rawAddr);
41396
+ continue;
41397
+ }
41398
+ const local = decodeHex(rawAddr.slice(0, atIdx));
41399
+ const domain = mailtoNormalizeDomain(decodeHex(rawAddr.slice(atIdx + 1)), options, mailtoComponent);
41400
+ to[i] = local + "@" + domain;
41401
+ }
41402
+ if (to.length)
41403
+ mailtoComponent.to = to;
41404
+ return mailtoComponent;
41405
+ }
41406
+ function mailtoEncodeHeaderName(name) {
41407
+ return encodeWithAllow(name.replace(/%/gu, "%25"), HFNAME);
41408
+ }
41409
+ function mailtoSerialize(component, options) {
41410
+ const mailtoComponent = component;
41411
+ const to = Array.isArray(mailtoComponent.to) ? mailtoComponent.to.slice() : [];
41412
+ const sourceHeaders = mailtoComponent.headers && typeof mailtoComponent.headers === "object" ? Object.assign(Object.create(null), mailtoComponent.headers) : Object.create(null);
41413
+ const headers = Object.create(null);
41414
+ for (const name in sourceHeaders) {
41415
+ const normalizedName = name.toLowerCase();
41416
+ if (normalizedName === "to") {
41417
+ const addrs = String(sourceHeaders[name]).split(",");
41418
+ for (let i = 0;i < addrs.length; i++)
41419
+ to.push(addrs[i]);
41420
+ } else if (normalizedName === "subject" || normalizedName === "body") {
41421
+ headers[normalizedName] = sourceHeaders[name];
41422
+ } else {
41423
+ headers[name] = sourceHeaders[name];
41424
+ }
41425
+ }
41426
+ if (mailtoComponent.subject !== undefined)
41427
+ headers.subject = mailtoComponent.subject;
41428
+ if (mailtoComponent.body !== undefined)
41429
+ headers.body = mailtoComponent.body;
41430
+ mailtoComponent.headers = headers;
41431
+ if (to.length) {
41432
+ mailtoComponent.userinfo = undefined;
41433
+ mailtoComponent.host = undefined;
41434
+ mailtoComponent.port = undefined;
41435
+ for (let i = 0;i < to.length; i++) {
41436
+ const addr = String(to[i]);
41437
+ const atIdx = addr.lastIndexOf("@");
41438
+ const rawLocal = atIdx >= 0 ? addr.slice(0, atIdx) : addr;
41439
+ const rawDomain = atIdx >= 0 ? addr.slice(atIdx + 1) : "";
41440
+ const local = encodeWithAllow(rawLocal, LOCAL_PART);
41441
+ const decodedDomain = decodeHex(rawDomain);
41442
+ const normalizedDomain = mailtoNormalizeDomain(decodedDomain, options);
41443
+ to[i] = local + "@" + mailtoEncodeDomain(normalizedDomain, options);
41444
+ }
41445
+ mailtoComponent.path = to.join(",");
41446
+ options.skipEscape = true;
41447
+ } else {
41448
+ mailtoComponent.path = undefined;
41449
+ }
41450
+ let query = "";
41451
+ let count = 0;
41452
+ for (const name in headers) {
41453
+ if (count++ !== 0)
41454
+ query += "&";
41455
+ query += mailtoEncodeHeaderName(name) + "=" + encodeWithAllow(String(headers[name]), HFNAME);
41456
+ }
41457
+ if (count !== 0) {
41458
+ mailtoComponent.query = query;
41459
+ } else {
41460
+ mailtoComponent.headers = undefined;
41461
+ }
41462
+ return mailtoComponent;
41463
+ }
41464
+ var mailto = {
41465
+ scheme: "mailto",
41466
+ parse: mailtoParse,
41467
+ serialize: mailtoSerialize,
41468
+ domainHost: false,
41469
+ unicodeSupport: true,
41470
+ skipNormalize: true,
41471
+ absolutePath: true
41472
+ };
40606
41473
  var SCHEMES = {
40607
41474
  http,
40608
41475
  https,
40609
41476
  ws,
40610
41477
  wss,
40611
41478
  urn,
40612
- "urn:uuid": urnuuid
41479
+ "urn:uuid": urnuuid,
41480
+ mailto
40613
41481
  };
40614
41482
  Object.setPrototypeOf(SCHEMES, null);
40615
41483
  function getSchemeHandler(scheme) {
@@ -40625,8 +41493,17 @@ var require_schemes = __commonJS((exports, module) => {
40625
41493
 
40626
41494
  // node_modules/fast-uri/index.js
40627
41495
  var require_fast_uri = __commonJS((exports, module) => {
40628
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, normalizeQueryFragmentEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils4();
41496
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils4();
40629
41497
  var { SCHEMES, getSchemeHandler } = require_schemes();
41498
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
41499
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
41500
+ function decodeValidScheme(scheme) {
41501
+ const decodedScheme = unescape(String(scheme));
41502
+ if (!VALID_SCHEME.test(decodedScheme)) {
41503
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
41504
+ }
41505
+ return decodedScheme;
41506
+ }
40630
41507
  function normalize(uri, options) {
40631
41508
  if (typeof uri === "string") {
40632
41509
  uri = normalizeString(uri, options);
@@ -40637,10 +41514,43 @@ var require_fast_uri = __commonJS((exports, module) => {
40637
41514
  }
40638
41515
  function resolve(baseURI, relativeURI, options) {
40639
41516
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
40640
- const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
41517
+ const {
41518
+ parsed: baseParsed,
41519
+ malformedAuthorityOrPort: baseMalformed,
41520
+ malformedPercentEncoding: baseMalformedPercentEncoding,
41521
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
41522
+ malformedHost: baseMalformedHost,
41523
+ malformedScheme: baseMalformedScheme
41524
+ } = parseWithStatus(baseURI, schemelessOptions);
41525
+ const {
41526
+ parsed: relativeParsed,
41527
+ malformedAuthorityOrPort: relativeMalformed,
41528
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
41529
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
41530
+ malformedHost: relativeMalformedHost,
41531
+ malformedScheme: relativeMalformedScheme
41532
+ } = parseWithStatus(relativeURI, schemelessOptions);
41533
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
41534
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
41535
+ }
41536
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
41537
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
41538
+ const resolvedHost = resolved.host;
41539
+ const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
41540
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
41541
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
41542
+ if (resolved.error && !encodedASCIIHost) {
41543
+ throw new Error(resolved.error);
41544
+ }
40641
41545
  schemelessOptions.skipEscape = true;
40642
41546
  return serialize(resolved, schemelessOptions);
40643
41547
  }
41548
+ function copyHost(target, source) {
41549
+ target.host = source.host;
41550
+ if (source.ipv6Zone !== undefined) {
41551
+ target.ipv6Zone = source.ipv6Zone;
41552
+ }
41553
+ }
40644
41554
  function resolveComponent(base, relative, options, skipNormalization) {
40645
41555
  const target = {};
40646
41556
  if (!skipNormalization) {
@@ -40651,14 +41561,14 @@ var require_fast_uri = __commonJS((exports, module) => {
40651
41561
  if (!options.tolerant && relative.scheme) {
40652
41562
  target.scheme = relative.scheme;
40653
41563
  target.userinfo = relative.userinfo;
40654
- target.host = relative.host;
41564
+ copyHost(target, relative);
40655
41565
  target.port = relative.port;
40656
41566
  target.path = removeDotSegments(relative.path || "");
40657
41567
  target.query = relative.query;
40658
41568
  } else {
40659
41569
  if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
40660
41570
  target.userinfo = relative.userinfo;
40661
- target.host = relative.host;
41571
+ copyHost(target, relative);
40662
41572
  target.port = relative.port;
40663
41573
  target.path = removeDotSegments(relative.path || "");
40664
41574
  target.query = relative.query;
@@ -40686,7 +41596,7 @@ var require_fast_uri = __commonJS((exports, module) => {
40686
41596
  target.query = relative.query;
40687
41597
  }
40688
41598
  target.userinfo = base.userinfo;
40689
- target.host = base.host;
41599
+ copyHost(target, base);
40690
41600
  target.port = base.port;
40691
41601
  }
40692
41602
  target.scheme = base.scheme;
@@ -40697,11 +41607,12 @@ var require_fast_uri = __commonJS((exports, module) => {
40697
41607
  function equal(uriA, uriB, options) {
40698
41608
  const normalizedA = normalizeComparableURI(uriA, options);
40699
41609
  const normalizedB = normalizeComparableURI(uriB, options);
40700
- return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
41610
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA === normalizedB;
40701
41611
  }
40702
41612
  function serialize(cmpts, opts) {
40703
41613
  const component = {
40704
41614
  host: cmpts.host,
41615
+ ipv6Zone: cmpts.ipv6Zone,
40705
41616
  scheme: cmpts.scheme,
40706
41617
  userinfo: cmpts.userinfo,
40707
41618
  port: cmpts.port,
@@ -40714,24 +41625,31 @@ var require_fast_uri = __commonJS((exports, module) => {
40714
41625
  reference: cmpts.reference,
40715
41626
  resourceName: cmpts.resourceName,
40716
41627
  secure: cmpts.secure,
41628
+ to: cmpts.to,
41629
+ subject: cmpts.subject,
41630
+ body: cmpts.body,
41631
+ headers: cmpts.headers,
40717
41632
  error: ""
40718
41633
  };
40719
41634
  const options = Object.assign({}, opts);
40720
41635
  const uriTokens = [];
41636
+ if (component.scheme) {
41637
+ component.scheme = decodeValidScheme(component.scheme);
41638
+ }
40721
41639
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
40722
41640
  if (schemeHandler && schemeHandler.serialize)
40723
41641
  schemeHandler.serialize(component, options);
41642
+ const hasAuthority = component.userinfo !== undefined || component.host !== undefined || component.port !== undefined;
41643
+ const pathNoScheme = !options.skipEscape && component.scheme === undefined && !hasAuthority;
40724
41644
  if (component.path !== undefined) {
40725
41645
  if (!options.skipEscape) {
40726
- component.path = escapePreservingEscapes(component.path);
40727
- if (component.scheme !== undefined) {
40728
- component.path = component.path.split("%3A").join(":");
40729
- }
41646
+ component.path = serializePathEncoding(component.path, pathNoScheme);
40730
41647
  } else {
40731
41648
  component.path = normalizePercentEncoding(component.path);
40732
41649
  }
40733
41650
  }
40734
41651
  if (options.reference !== "suffix" && component.scheme) {
41652
+ component.scheme = decodeValidScheme(component.scheme);
40735
41653
  uriTokens.push(component.scheme, ":");
40736
41654
  }
40737
41655
  const authority = recomposeAuthority(component);
@@ -40749,21 +41667,25 @@ var require_fast_uri = __commonJS((exports, module) => {
40749
41667
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
40750
41668
  s = removeDotSegments(s);
40751
41669
  }
41670
+ if (pathNoScheme) {
41671
+ s = serializePathEncoding(s, true);
41672
+ }
40752
41673
  if (authority === undefined && s[0] === "/" && s[1] === "/") {
40753
41674
  s = "/%2F" + s.slice(2);
40754
41675
  }
40755
41676
  uriTokens.push(s);
40756
41677
  }
40757
41678
  if (component.query !== undefined) {
40758
- uriTokens.push("?", component.query);
41679
+ uriTokens.push("?", encodeQuery(component.query));
40759
41680
  }
40760
41681
  if (component.fragment !== undefined) {
40761
- uriTokens.push("#", component.fragment);
41682
+ uriTokens.push("#", encodeFragment(component.fragment));
40762
41683
  }
40763
41684
  return uriTokens.join("");
40764
41685
  }
40765
41686
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
40766
41687
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
41688
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
40767
41689
  function getParseError(parsed, matches) {
40768
41690
  if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
40769
41691
  return 'URI path must start with "/" when authority is present.';
@@ -40773,6 +41695,37 @@ var require_fast_uri = __commonJS((exports, module) => {
40773
41695
  }
40774
41696
  return;
40775
41697
  }
41698
+ function hasMalformedPercentEncoding(component) {
41699
+ if (component === undefined)
41700
+ return false;
41701
+ let percent = component.indexOf("%");
41702
+ while (percent !== -1) {
41703
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
41704
+ return true;
41705
+ }
41706
+ percent = component.indexOf("%", percent + 3);
41707
+ }
41708
+ return false;
41709
+ }
41710
+ function isIPLiteral(host) {
41711
+ return host[0] === "[" && host[host.length - 1] === "]";
41712
+ }
41713
+ function hasMalformedComponentPercentEncoding(matches) {
41714
+ const host = matches[4];
41715
+ return hasMalformedPercentEncoding(matches[3]) || host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
41716
+ }
41717
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
41718
+ const bracketedIPLiteral = parsed.host && parsed.host[0] === "[" && parsed.host[parsed.host.length - 1] === "]";
41719
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && !bracketedIPLiteral && nonSimpleDomain(parsed.host)) {
41720
+ try {
41721
+ parsed.host = new URL("http://" + parsed.host).hostname;
41722
+ } catch (e) {
41723
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
41724
+ return true;
41725
+ }
41726
+ }
41727
+ return false;
41728
+ }
40776
41729
  function parseWithStatus(uri, opts) {
40777
41730
  const options = Object.assign({}, opts);
40778
41731
  const parsed = {
@@ -40785,6 +41738,11 @@ var require_fast_uri = __commonJS((exports, module) => {
40785
41738
  fragment: undefined
40786
41739
  };
40787
41740
  let malformedAuthorityOrPort = false;
41741
+ let malformedPercentEncoding = false;
41742
+ let malformedSchemeSpecific = false;
41743
+ let malformedHost = false;
41744
+ let malformedIPLiteral = false;
41745
+ let malformedScheme = false;
40788
41746
  let isIP = false;
40789
41747
  if (options.reference === "suffix") {
40790
41748
  if (options.scheme) {
@@ -40798,15 +41756,42 @@ var require_fast_uri = __commonJS((exports, module) => {
40798
41756
  parsed.error = "URI authority must not contain a literal backslash.";
40799
41757
  malformedAuthorityOrPort = true;
40800
41758
  }
41759
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
41760
+ if (introducerMatch !== null) {
41761
+ const region = introducerMatch[1];
41762
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
41763
+ if (normalizedRegion.length >= 2) {
41764
+ if (normalizedRegion.slice(0, 2) !== "//") {
41765
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
41766
+ malformedAuthorityOrPort = true;
41767
+ } else if (region.length !== normalizedRegion.length) {
41768
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
41769
+ malformedAuthorityOrPort = true;
41770
+ }
41771
+ }
41772
+ }
40801
41773
  const matches = uri.match(URI_PARSE);
40802
41774
  if (matches) {
40803
- parsed.scheme = matches[1] === undefined ? undefined : matches[1].toLowerCase();
41775
+ parsed.scheme = matches[1];
40804
41776
  parsed.userinfo = matches[3];
40805
41777
  parsed.host = matches[4];
40806
41778
  parsed.port = parseInt(matches[5], 10);
40807
41779
  parsed.path = matches[6] || "";
40808
41780
  parsed.query = matches[7];
40809
41781
  parsed.fragment = matches[8];
41782
+ if (parsed.scheme !== undefined) {
41783
+ const decodedScheme = unescape(parsed.scheme);
41784
+ if (VALID_SCHEME.test(decodedScheme)) {
41785
+ parsed.scheme = decodedScheme.toLowerCase();
41786
+ } else {
41787
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
41788
+ malformedScheme = true;
41789
+ }
41790
+ }
41791
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
41792
+ if (malformedPercentEncoding) {
41793
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
41794
+ }
40810
41795
  if (isNaN(parsed.port)) {
40811
41796
  parsed.port = matches[5];
40812
41797
  }
@@ -40818,9 +41803,19 @@ var require_fast_uri = __commonJS((exports, module) => {
40818
41803
  if (parsed.host) {
40819
41804
  const ipv4result = isIPv4(parsed.host);
40820
41805
  if (ipv4result === false) {
41806
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
41807
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
40821
41808
  const ipv6result = normalizeIPv6(parsed.host);
40822
- parsed.host = ipv6result.host.toLowerCase();
40823
- isIP = ipv6result.isIPV6;
41809
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
41810
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
41811
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
41812
+ if (isIP && ipv6result.isIPV6 === true && parsed.host.indexOf("%") !== -1) {
41813
+ parsed.ipv6Zone = parsed.host.slice(parsed.host.indexOf("%") + 1);
41814
+ }
41815
+ if (malformedIPLiteral) {
41816
+ parsed.error = parsed.error || "URI host is malformed.";
41817
+ malformedAuthorityOrPort = true;
41818
+ }
40824
41819
  } else {
40825
41820
  isIP = true;
40826
41821
  }
@@ -40838,24 +41833,17 @@ var require_fast_uri = __commonJS((exports, module) => {
40838
41833
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
40839
41834
  }
40840
41835
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
40841
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
40842
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
40843
- try {
40844
- parsed.host = new URL("http://" + parsed.host).hostname;
40845
- } catch (e) {
40846
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
40847
- }
41836
+ if (!malformedIPLiteral) {
41837
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
41838
+ }
41839
+ if (uri.indexOf("%") !== -1 && parsed.host !== undefined && !malformedIPLiteral) {
41840
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
41841
+ if (!isIP) {
41842
+ host = normalizePercentEncoding(host.toLowerCase());
40848
41843
  }
41844
+ parsed.host = reescapeHostDelimiters(host, isIP);
40849
41845
  }
40850
41846
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
40851
- if (uri.indexOf("%") !== -1) {
40852
- if (parsed.scheme !== undefined) {
40853
- parsed.scheme = unescape(parsed.scheme);
40854
- }
40855
- if (parsed.host !== undefined) {
40856
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
40857
- }
40858
- }
40859
41847
  if (parsed.path) {
40860
41848
  parsed.path = normalizePathEncoding(parsed.path);
40861
41849
  }
@@ -40868,11 +41856,14 @@ var require_fast_uri = __commonJS((exports, module) => {
40868
41856
  }
40869
41857
  if (schemeHandler && schemeHandler.parse) {
40870
41858
  schemeHandler.parse(parsed, options);
41859
+ if (schemeHandler === SCHEMES.urn && parsed.nid === undefined) {
41860
+ malformedSchemeSpecific = true;
41861
+ }
40871
41862
  }
40872
41863
  } else {
40873
41864
  parsed.error = parsed.error || "URI can not be parsed.";
40874
41865
  }
40875
- return { parsed, malformedAuthorityOrPort };
41866
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
40876
41867
  }
40877
41868
  function parse6(uri, opts) {
40878
41869
  return parseWithStatus(uri, opts).parsed;
@@ -40881,20 +41872,28 @@ var require_fast_uri = __commonJS((exports, module) => {
40881
41872
  return normalizeStringWithStatus(uri, opts).normalized;
40882
41873
  }
40883
41874
  function normalizeStringWithStatus(uri, opts) {
40884
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
41875
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
40885
41876
  return {
40886
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
40887
- malformedAuthorityOrPort
41877
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
41878
+ malformedAuthorityOrPort,
41879
+ malformedPercentEncoding,
41880
+ malformedSchemeSpecific,
41881
+ malformedHost,
41882
+ malformedScheme
40888
41883
  };
40889
41884
  }
40890
41885
  function normalizeComparableURI(uri, opts) {
40891
- if (typeof uri === "string") {
40892
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
40893
- return malformedAuthorityOrPort ? undefined : normalized;
41886
+ if (typeof uri !== "string" && typeof uri !== "object") {
41887
+ return;
40894
41888
  }
40895
- if (typeof uri === "object") {
40896
- return serialize(uri, opts);
41889
+ let value;
41890
+ try {
41891
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
41892
+ } catch {
41893
+ return;
40897
41894
  }
41895
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
41896
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
40898
41897
  }
40899
41898
  var fastUri = {
40900
41899
  SCHEMES,
@@ -49109,7 +50108,7 @@ var require_limit = __commonJS((exports) => {
49109
50108
  });
49110
50109
 
49111
50110
  // node_modules/ajv-formats/dist/index.js
49112
- var require_dist2 = __commonJS((exports, module) => {
50111
+ var require_dist4 = __commonJS((exports, module) => {
49113
50112
  Object.defineProperty(exports, "__esModule", { value: true });
49114
50113
  var formats_1 = require_formats2();
49115
50114
  var limit_1 = require_limit();
@@ -49187,7 +50186,7 @@ class AjvJsonSchemaValidator {
49187
50186
  var import_ajv, import_ajv_formats;
49188
50187
  var init_ajv_provider = __esm(() => {
49189
50188
  import_ajv = __toESM(require_ajv(), 1);
49190
- import_ajv_formats = __toESM(require_dist2(), 1);
50189
+ import_ajv_formats = __toESM(require_dist4(), 1);
49191
50190
  });
49192
50191
 
49193
50192
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
@@ -51732,6 +52731,29 @@ function createRegisterResourceTemplate(logger, server, getSDK, allowedScopes) {
51732
52731
  }
51733
52732
  var init_resources = () => {};
51734
52733
 
52734
+ // src/mcp-server/server-info.ts
52735
+ var ICON_BASE = "https://cloudinary-res.cloudinary.com/image/upload/docsite/brand-assets", serverInfo, instructions = `Cloudinary Environment Config: manage the settings that shape how assets are uploaded, transformed and delivered in a Cloudinary product environment.
52736
+
52737
+ - Upload presets bundle upload options (folder, tags, eager and incoming transformations, notification_url) under a name that uploads and the Upload Widget refer to. Check list-upload-presets first: creating a preset with an existing name overwrites it.
52738
+ - Named transformations are reusable transformation strings applied in delivery URLs as t_<name>. Changing one requires unsafe_update and affects only newly generated derived assets. Chain f_auto outside it, e.g. t_square/f_auto.
52739
+ - Upload mappings link a folder to a remote URL prefix for auto-upload. To apply a preset to a mapping, give the preset the same name as the mapped folder.
52740
+ - Triggers send webhook notifications for one event type to one URL. update-trigger, delete-trigger and test-trigger need the id from list-triggers or create-trigger. A preset's notification_url overrides global triggers for uploads that use it.
52741
+ - Streaming profiles define adaptive bitrate renditions. Updating one replaces its whole representations list; deleting a modified built-in profile reverts it.
52742
+ - Works with the Asset Management server: its upload-asset takes upload_preset.
52743
+ - Docs: https://cloudinary.com/documentation/llms.txt indexes all Cloudinary docs; append .md to a documentation URL for Markdown.`;
52744
+ var init_server_info = __esm(() => {
52745
+ serverInfo = {
52746
+ title: "Cloudinary Environment Config",
52747
+ description: "Manage Cloudinary upload presets, named transformations, upload mappings, triggers, and streaming profiles.",
52748
+ websiteUrl: "https://cloudinary.com/documentation/cloudinary_llm_mcp",
52749
+ icons: [32, 96, 192].map((size) => ({
52750
+ src: `${ICON_BASE}/cloudinary_favicon_${size}x${size}.png`,
52751
+ mimeType: "image/png",
52752
+ sizes: [`${size}x${size}`]
52753
+ }))
52754
+ };
52755
+ });
52756
+
51735
52757
  // src/mcp-server/tools.ts
51736
52758
  function buildAnnotationFilter(annotations) {
51737
52759
  const filter = {};
@@ -56461,8 +57483,9 @@ var init_uploadPresetsUpdateUploadPreset2 = __esm(() => {
56461
57483
  function createMCPServer(deps) {
56462
57484
  const server = new McpServer({
56463
57485
  name: "CloudinaryEnvConfig",
56464
- version: "0.6.1"
56465
- });
57486
+ version: "0.6.2",
57487
+ ...serverInfo
57488
+ }, { instructions });
56466
57489
  const getClient = deps.getSDK || (() => new CloudinaryEnvConfigCore({
56467
57490
  security: deps.security,
56468
57491
  cloud_name: deps.cloud_name,
@@ -56516,6 +57539,7 @@ var init_server2 = __esm(() => {
56516
57539
  init_mcp();
56517
57540
  init_core3();
56518
57541
  init_resources();
57542
+ init_server_info();
56519
57543
  init_tools();
56520
57544
  init_streamingProfilesCreateStreamingProfile2();
56521
57545
  init_streamingProfilesDeleteStreamingProfile2();
@@ -57597,7 +58621,7 @@ http_headers = { "api-key" = "YOUR_API_KEY", "api-secret" = "YOUR_API_SECRET", "
57597
58621
  <h1>Instructions</h1>
57598
58622
  <p>One-click installation for Claude Desktop users</p>
57599
58623
  <div class="instruction-item">
57600
- <a href="https://github.com/cloudinary/environment-config-mcp/releases/download/v0.6.1/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
58624
+ <a href="https://github.com/cloudinary/environment-config-mcp/releases/download/v0.6.2/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
57601
58625
  \uD83D\uDCE5 Download MCP Bundle
57602
58626
  </a>
57603
58627
  </div>
@@ -59522,7 +60546,7 @@ var routes = ln({
59522
60546
  var app = _e(routes, {
59523
60547
  name: "mcp",
59524
60548
  versionInfo: {
59525
- currentVersion: "0.6.1"
60549
+ currentVersion: "0.6.2"
59526
60550
  }
59527
60551
  });
59528
60552
  Yt(app, process4.argv.slice(2), buildContext(process4));
@@ -59530,5 +60554,5 @@ export {
59530
60554
  app
59531
60555
  };
59532
60556
 
59533
- //# debugId=DC7D6D5E210736C564756E2164756E21
60557
+ //# debugId=0E4893BC713B871164756E2164756E21
59534
60558
  //# sourceMappingURL=mcp-server.js.map