@datadog/datadog-ci-plugin-container-app 5.26.1 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -39307,14 +39307,14 @@ var TokenCache = class {
39307
39307
  //#endregion
39308
39308
  //#region ../../node_modules/safe-buffer/index.js
39309
39309
  var require_safe_buffer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39310
- var buffer = require("buffer");
39311
- var Buffer = buffer.Buffer;
39310
+ var buffer$2 = require("buffer");
39311
+ var Buffer = buffer$2.Buffer;
39312
39312
  function copyProps(src, dst) {
39313
39313
  for (var key in src) dst[key] = src[key];
39314
39314
  }
39315
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) module.exports = buffer;
39315
+ if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) module.exports = buffer$2;
39316
39316
  else {
39317
- copyProps(buffer, exports);
39317
+ copyProps(buffer$2, exports);
39318
39318
  exports.Buffer = SafeBuffer;
39319
39319
  }
39320
39320
  function SafeBuffer(arg, encodingOrOffset, length) {
@@ -39340,7 +39340,7 @@ var require_safe_buffer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39340
39340
  };
39341
39341
  SafeBuffer.allocUnsafeSlow = function(size) {
39342
39342
  if (typeof size !== "number") throw new TypeError("Argument must be a number");
39343
- return buffer.SlowBuffer(size);
39343
+ return buffer$2.SlowBuffer(size);
39344
39344
  };
39345
39345
  }));
39346
39346
  //#endregion
@@ -53125,7 +53125,7 @@ var require_source$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53125
53125
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53126
53126
  module.exports = {
53127
53127
  "name": "@datadog/datadog-ci-base",
53128
- "version": "5.26.1",
53128
+ "version": "5.27.0",
53129
53129
  "description": "Base package for Datadog CI",
53130
53130
  "license": "Apache-2.0",
53131
53131
  "keywords": ["datadog", "datadog-ci"],
@@ -53227,7 +53227,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53227
53227
  "deep-extend": "^0.6.0",
53228
53228
  "fast-xml-parser": "^5.7.2",
53229
53229
  "form-data": "^4.0.6",
53230
- "glob": "^13.0.6",
53230
+ "glob": "^14.0.3",
53231
53231
  "inquirer": "^8.2.7",
53232
53232
  "is-docker": "^4.0.0",
53233
53233
  "jest-diff": "^30.2.0",
@@ -53239,7 +53239,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53239
53239
  "terminal-link": "^2.1.1",
53240
53240
  "tiny-async-pool": "^2.1.0",
53241
53241
  "typanion": "^3.14.0",
53242
- "undici": "^7.29.1",
53242
+ "undici": "^7.30.1",
53243
53243
  "upath": "^2.0.1",
53244
53244
  "webpack-sources": "^3.5.1"
53245
53245
  },
@@ -57983,6 +57983,8 @@ var require_ipv4 = /* @__PURE__ */ __commonJSMin(((exports) => {
57983
57983
  * address.correctForm(); // '192.0.2.42'
57984
57984
  */
57985
57985
  static fromArpa(arpaFormAddress) {
57986
+ const longest = constants.GROUPS * 4 - 1 + 3 + 14;
57987
+ if (arpaFormAddress.length > longest) throw new address_error_1.AddressError(`in-addr.arpa names are at most ${longest} characters.`);
57986
57988
  return new Address4(arpaFormAddress.replace(/(\.in-addr\.arpa)?\.?$/i, "").split(".").reverse().join("."));
57987
57989
  }
57988
57990
  /**
@@ -58403,6 +58405,9 @@ var require_constants$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
58403
58405
  * A regular expression that matches an IPv6 zone
58404
58406
  * @memberof Address6
58405
58407
  * @static
58408
+ * @deprecated Takes quadratic time on input holding many `%` characters
58409
+ * followed by a line terminator. The library finds the zone by index, as
58410
+ * `Address6`'s constructor shows, and 11.0.0 removes this export.
58406
58411
  */
58407
58412
  exports.RE_ZONE_STRING = /%.*$/;
58408
58413
  exports.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;
@@ -58792,10 +58797,10 @@ var require_ipv6 = /* @__PURE__ */ __commonJSMin(((exports) => {
58792
58797
  address = address.replace(constants6.RE_SUBNET_STRING, "");
58793
58798
  }
58794
58799
  if (/\//.test(address)) throw new address_error_1.AddressError("Invalid subnet mask.");
58795
- const zone = constants6.RE_ZONE_STRING.exec(address);
58796
- if (zone) {
58797
- this.zone = zone[0];
58798
- address = address.replace(constants6.RE_ZONE_STRING, "");
58800
+ const zoneStart = address.indexOf("%");
58801
+ if (zoneStart !== -1 && /^.*$/.test(address.slice(zoneStart))) {
58802
+ this.zone = address.slice(zoneStart);
58803
+ address = address.slice(0, zoneStart);
58799
58804
  }
58800
58805
  const longest = this.groups * 5 + 5;
58801
58806
  if (address.length > longest) throw new address_error_1.AddressError(`IPv6 addresses are at most ${longest} characters.`);
@@ -62985,6 +62990,7 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
62985
62990
  Object.defineProperty(exports, "__esModule", { value: true });
62986
62991
  exports.FTPContext = exports.FTPError = void 0;
62987
62992
  const net_1$1 = require("net");
62993
+ const tls_1$3 = require("tls");
62988
62994
  const parseControlResponse_1 = require_parseControlResponse();
62989
62995
  /**
62990
62996
  * Describes an FTP server error response including the FTP response code.
@@ -63023,6 +63029,8 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63023
63029
  this.ipFamily = void 0;
63024
63030
  /** Options for TLS connections. */
63025
63031
  this.tlsOptions = {};
63032
+ /** Most recent TLS session from the control connection, used to resume the session on data connections. */
63033
+ this.tlsSessionStore = void 0;
63026
63034
  /** A multiline response might be received as multiple chunks. */
63027
63035
  this._partialResponse = "";
63028
63036
  this._encoding = encoding;
@@ -63073,6 +63081,7 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63073
63081
  set socket(socket) {
63074
63082
  this.dataSocket = void 0;
63075
63083
  this.tlsOptions = {};
63084
+ this.tlsSessionStore = void 0;
63076
63085
  this._partialResponse = "";
63077
63086
  if (this._socket) if (socket.localPort === this._socket.localPort) this._removeSocketListeners(this.socket);
63078
63087
  else this._closeControlSocket();
@@ -63087,6 +63096,9 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63087
63096
  if (!hadError) this.closeWithError(/* @__PURE__ */ new Error("Server closed connection unexpectedly."));
63088
63097
  });
63089
63098
  this._setupDefaultErrorHandlers(socket, "control socket");
63099
+ if (socket instanceof tls_1$3.TLSSocket) socket.on("session", (session) => {
63100
+ this.tlsSessionStore = session;
63101
+ });
63090
63102
  }
63091
63103
  this._socket = socket;
63092
63104
  }
@@ -63127,9 +63139,9 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63127
63139
  * Send an FTP command without waiting for or handling the result.
63128
63140
  */
63129
63141
  send(command) {
63130
- if (/[\r\n\0]/.test(command)) throw new Error(`Invalid command: Contains control characters. (${command})`);
63131
- const message = command.startsWith("PASS") ? "> PASS ###" : `> ${command}`;
63132
- this.log(message);
63142
+ const description = command.startsWith("PASS") ? "PASS ###" : command;
63143
+ if (/[\r\n\0]/.test(command)) throw new Error(`Invalid command: Contains control characters. (${description})`);
63144
+ this.log(`> ${description}`);
63133
63145
  this._socket.write(command + "\r\n", this.encoding);
63134
63146
  }
63135
63147
  /**
@@ -63153,16 +63165,22 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63153
63165
  this.closeWithError(err);
63154
63166
  }
63155
63167
  return new Promise((resolveTask, rejectTask) => {
63168
+ let settled = false;
63169
+ const stopTrackingOnce = () => {
63170
+ if (settled) return;
63171
+ settled = true;
63172
+ this._stopTrackingTask();
63173
+ };
63156
63174
  this._task = {
63157
63175
  stack: (/* @__PURE__ */ new Error()).stack || "Unknown call stack",
63158
63176
  responseHandler,
63159
63177
  resolver: {
63160
63178
  resolve: (arg) => {
63161
- this._stopTrackingTask();
63179
+ stopTrackingOnce();
63162
63180
  resolveTask(arg);
63163
63181
  },
63164
63182
  reject: (err) => {
63165
- this._stopTrackingTask();
63183
+ stopTrackingOnce();
63166
63184
  rejectTask(err);
63167
63185
  }
63168
63186
  }
@@ -63175,7 +63193,11 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63175
63193
  return;
63176
63194
  }
63177
63195
  this.socket.setTimeout(this.timeout);
63178
- if (command) this.send(command);
63196
+ if (command) try {
63197
+ this.send(command);
63198
+ } catch (err) {
63199
+ this._task.resolver.reject(err);
63200
+ }
63179
63201
  });
63180
63202
  }
63181
63203
  /**
@@ -63229,7 +63251,13 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
63229
63251
  * @protected
63230
63252
  */
63231
63253
  _passToHandler(response) {
63232
- if (this._task) this._task.responseHandler(response, this._task.resolver);
63254
+ const task = this._task;
63255
+ if (task) try {
63256
+ task.responseHandler(response, task.resolver);
63257
+ } catch (err) {
63258
+ task.resolver.reject(err);
63259
+ this.closeWithError(err);
63260
+ }
63233
63261
  }
63234
63262
  /**
63235
63263
  * Setup all error handlers for a socket.
@@ -63299,6 +63327,7 @@ var require_netUtils = /* @__PURE__ */ __commonJSMin(((exports) => {
63299
63327
  exports.describeTLS = describeTLS;
63300
63328
  exports.describeAddress = describeAddress;
63301
63329
  exports.upgradeSocket = upgradeSocket;
63330
+ exports.isLoopback = isLoopback;
63302
63331
  exports.ipIsPrivateV4Address = ipIsPrivateV4Address;
63303
63332
  const tls_1$2 = require("tls");
63304
63333
  /**
@@ -63336,6 +63365,12 @@ var require_netUtils = /* @__PURE__ */ __commonJSMin(((exports) => {
63336
63365
  });
63337
63366
  }
63338
63367
  /**
63368
+ * Returns true if an IP address is a loopback address.
63369
+ */
63370
+ function isLoopback(ip) {
63371
+ return ip === "::1" || ip.startsWith("127.");
63372
+ }
63373
+ /**
63339
63374
  * Returns true if an IP is a private address according to https://tools.ietf.org/html/rfc1918#section-3.
63340
63375
  * This will handle IPv4-mapped IPv6 addresses correctly but return false for all other IPv6 addresses.
63341
63376
  *
@@ -63455,8 +63490,12 @@ var require_parseListDOS = /* @__PURE__ */ __commonJSMin(((exports) => {
63455
63490
  * under the Apache 2.0 license. It has been simplified and rewritten to better fit the Javascript language.
63456
63491
  *
63457
63492
  * https://github.com/apache/commons-net/blob/master/src/main/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java
63493
+ *
63494
+ * Keep this expression anchored: without it a line that can't be parsed is retried at every position,
63495
+ * and as the expression starts with `\S+` each attempt is itself linear in the length of the line. A
63496
+ * single long line without whitespace would cost O(n²), which a server could use to block the event loop.
63458
63497
  */
63459
- const RE_LINE = /* @__PURE__ */ new RegExp("(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
63498
+ const RE_LINE = /* @__PURE__ */ new RegExp("^\\s*(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
63460
63499
  /**
63461
63500
  * Returns true if a given line might be a DOS-style listing.
63462
63501
  *
@@ -63525,8 +63564,12 @@ var require_parseListUnix = /* @__PURE__ */ __commonJSMin(((exports) => {
63525
63564
  * Note: local listings on MacOSX also use '@'
63526
63565
  * this is not allowed for here as does not appear to be shown by FTP servers
63527
63566
  * {@code @} file has extended attributes
63567
+ *
63568
+ * Keep this expression anchored and both name quantifiers bounded: spaces are allowed in the owner and
63569
+ * group name, so an unbounded pair of them makes a line that can't be parsed cost O(n²) in its length,
63570
+ * which a server could use to block the event loop.
63528
63571
  */
63529
- const RE_LINE = /* @__PURE__ */ new RegExp("([bcdelfmpSs-])(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]?)))\\+?\\s*(\\d+)\\s+(?:(\\S+(?:\\s\\S+)*?)\\s+)?(?:(\\S+(?:\\s\\S+)*)\\s+)?(\\d+(?:,\\s*\\d+)?)\\s+((?:\\d+[-/]\\d+[-/]\\d+)|(?:\\S{3}\\s+\\d{1,2})|(?:\\d{1,2}\\s+\\S{3})|(?:\\d{1,2}月\\s+\\d{1,2}日))\\s+((?:\\d+(?::\\d+)?)|(?:\\d{4}年))\\s(.*)");
63572
+ const RE_LINE = /* @__PURE__ */ new RegExp("^[\\s\\d]*([bcdelfmpSs-])(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]?)))\\+?\\s*(\\d+)\\s+(?:(\\S+(?:\\s\\S+){0,7}?)\\s+)?(?:(\\S+(?:\\s\\S+){0,7})\\s+)?(\\d+(?:,\\s*\\d+)?)\\s+((?:\\d+[-/]\\d+[-/]\\d+)|(?:\\S{3}\\s+\\d{1,2})|(?:\\d{1,2}\\s+\\S{3})|(?:\\d{1,2}月\\s+\\d{1,2}日))\\s+((?:\\d+(?::\\d+)?)|(?:\\d{4}年))\\s(.*)");
63530
63573
  /**
63531
63574
  * Returns true if a given line might be a Unix-style listing.
63532
63575
  *
@@ -63682,9 +63725,12 @@ var require_parseListMLSD = /* @__PURE__ */ __commonJSMin(((exports) => {
63682
63725
  *
63683
63726
  * - Example 1: `size=15227;type=dir;perm=el;modify=20190419065730; test one`
63684
63727
  * - Example 2: ` file name` (leading space)
63728
+ *
63729
+ * Keep `=` out of the fact name: if both sides of the first `=` could contain it, a long line of `=`
63730
+ * without `;` would be retried at every split point, costing O(n²) and blocking the event loop.
63685
63731
  */
63686
63732
  function testLine(line) {
63687
- return /^\S+=\S+;/.test(line) || line.startsWith(" ");
63733
+ return /^[^\s=]+=\S+;/.test(line) || line.startsWith(" ");
63688
63734
  }
63689
63735
  /**
63690
63736
  * Parse single line as MLSD listing, see specification at https://tools.ietf.org/html/rfc3659#section-7.
@@ -63909,6 +63955,104 @@ var require_StringWriter = /* @__PURE__ */ __commonJSMin(((exports) => {
63909
63955
  exports.StringWriter = StringWriter;
63910
63956
  }));
63911
63957
  //#endregion
63958
+ //#region ../../node_modules/basic-ftp/dist/TransferWatchdog.js
63959
+ var require_TransferWatchdog = /* @__PURE__ */ __commonJSMin(((exports) => {
63960
+ Object.defineProperty(exports, "__esModule", { value: true });
63961
+ exports.TransferWatchdog = void 0;
63962
+ /** How long to wait between two checks of a transfer at most, in milliseconds. */
63963
+ const maxCheckIntervalMs = 500;
63964
+ /**
63965
+ * How many checks a timeout is split into, at least. A transfer is only reported as stalled if
63966
+ * every single one of them found the connection idle. Deciding on a single check would make brief
63967
+ * moments where a transfer looks idle without being stalled matter, for example just after a
63968
+ * destination signalled that it can accept data again but before the first bytes arrived.
63969
+ *
63970
+ * Splitting into n checks means such a moment has to last about (n-1)/n of the timeout to be
63971
+ * mistaken for a stall, so the value matters much less than it being greater than one. It only
63972
+ * has an effect on timeouts below `minChecksPerTimeout * maxCheckIntervalMs` anyway, longer ones
63973
+ * are split into more checks by the interval limit alone.
63974
+ */
63975
+ const minChecksPerTimeout = 4;
63976
+ /**
63977
+ * Watches a data connection during a transfer and reports it as stalled if the server stopped
63978
+ * making progress.
63979
+ *
63980
+ * This replaces a plain inactivity timeout on the data socket. Such a timeout can't tell apart
63981
+ * "the server stopped sending" from "our own source or destination isn't ready yet". A slow local
63982
+ * stream is not an error: A download piped into a decompressor, or an upload fed by a stream that
63983
+ * computes its data, can legitimately leave the connection idle for minutes. Timing out on that
63984
+ * kills a healthy transfer and truncates the data the destination already received.
63985
+ *
63986
+ * Only time spent waiting for the server counts towards the timeout, see `isWaitingForServer`.
63987
+ */
63988
+ var TransferWatchdog = class {
63989
+ constructor() {
63990
+ this.timer = void 0;
63991
+ }
63992
+ /**
63993
+ * Start watching a transfer. Calls `onStall` if the server hasn't made progress for
63994
+ * `timeout` milliseconds, or for twice that if we made it wait ourselves before that.
63995
+ * A timeout of 0 disables the watchdog.
63996
+ */
63997
+ start(socket, direction, timeout, onStall) {
63998
+ this.stop();
63999
+ if (timeout <= 0) return;
64000
+ const intervalMs = Math.max(1, Math.min(Math.floor(timeout / minChecksPerTimeout), maxCheckIntervalMs));
64001
+ let lastBytes = countBytes(socket);
64002
+ let idleMs = 0;
64003
+ let graceMs = 0;
64004
+ this.timer = setInterval(() => {
64005
+ const bytes = countBytes(socket);
64006
+ const madeProgress = bytes !== lastBytes;
64007
+ lastBytes = bytes;
64008
+ if (!isWaitingForServer(socket, direction)) {
64009
+ idleMs = 0;
64010
+ graceMs = timeout;
64011
+ return;
64012
+ }
64013
+ if (madeProgress) {
64014
+ idleMs = 0;
64015
+ graceMs = 0;
64016
+ return;
64017
+ }
64018
+ idleMs += intervalMs;
64019
+ if (idleMs >= timeout + graceMs) {
64020
+ this.stop();
64021
+ onStall();
64022
+ }
64023
+ }, intervalMs);
64024
+ this.timer.unref();
64025
+ }
64026
+ /**
64027
+ * Stop watching. Safe to call at any time, also if no transfer is being watched.
64028
+ */
64029
+ stop() {
64030
+ if (this.timer) {
64031
+ clearInterval(this.timer);
64032
+ this.timer = void 0;
64033
+ }
64034
+ }
64035
+ };
64036
+ exports.TransferWatchdog = TransferWatchdog;
64037
+ function countBytes(socket) {
64038
+ return socket.bytesRead + socket.bytesWritten;
64039
+ }
64040
+ /**
64041
+ * Returns true if the transfer can only continue once the server acts. When downloading, that's
64042
+ * the case as long as we're ready to receive: if the socket is paused, our destination applied
64043
+ * backpressure and the server may well be waiting for us. When uploading, it's the case if we
64044
+ * still have data queued that the server isn't accepting: an empty queue means we're waiting for
64045
+ * our own source instead.
64046
+ *
64047
+ * `isPaused()` only reports backpressure for a socket that is being piped, which is what
64048
+ * `downloadTo` in transfer.ts does. Should that ever change to reading the socket directly, e.g.
64049
+ * by iterating over it, this would report a transfer as stalled while it's waiting for us.
64050
+ */
64051
+ function isWaitingForServer(socket, direction) {
64052
+ return direction === "download" ? !socket.isPaused() : socket.writableLength > 0;
64053
+ }
64054
+ }));
64055
+ //#endregion
63912
64056
  //#region ../../node_modules/basic-ftp/dist/transfer.js
63913
64057
  var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
63914
64058
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -63920,9 +64064,10 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
63920
64064
  exports.connectForPassiveTransfer = connectForPassiveTransfer;
63921
64065
  exports.uploadFrom = uploadFrom;
63922
64066
  exports.downloadTo = downloadTo;
63923
- const netUtils_1 = require_netUtils();
63924
64067
  const stream_1$2 = require("stream");
63925
64068
  const tls_1$1 = require("tls");
64069
+ const TransferWatchdog_1 = require_TransferWatchdog();
64070
+ const netUtils_1 = require_netUtils();
63926
64071
  const parseControlResponse_1 = require_parseControlResponse();
63927
64072
  /**
63928
64073
  * Prepare a data socket using passive mode over IPv6.
@@ -63959,9 +64104,11 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
63959
64104
  return res;
63960
64105
  }
63961
64106
  /**
63962
- * Prepare a data socket using passive mode over IPv4. Ignore the IP provided by the PASV response,
63963
- * and use the control host IP. This is the same behaviour as with the more modern variant EPSV. Use
63964
- * this to fix issues around NAT or provide more security by preventing FTP bounce attacks.
64107
+ * Prepare a data socket using passive mode over IPv4.
64108
+ *
64109
+ * Will throw an error if the IP provided by the PASV response doesn't match the one of the control connection.
64110
+ * The error will contain detailed information. This is done to provide more security by preventing FTP bounce
64111
+ * attacks.
63965
64112
  */
63966
64113
  async function enterPassiveModeIPv4_forceControlHostIP(ftp) {
63967
64114
  const res = await ftp.request("PASV");
@@ -63969,14 +64116,16 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
63969
64116
  if (!target) throw new Error("Can't parse PASV response: " + res.message);
63970
64117
  const controlHost = ftp.socket.remoteAddress;
63971
64118
  if (controlHost === void 0) throw new Error("Control socket is disconnected, can't get remote address.");
63972
- await connectForPassiveTransfer(controlHost, target.port, ftp);
64119
+ const normalizedControlHost = controlHost.replace(/^::ffff:/i, "");
64120
+ if (!(normalizedControlHost === target.host || (0, netUtils_1.isLoopback)(normalizedControlHost) && (0, netUtils_1.isLoopback)(target.host))) throw new Error(`PASV returned another host (${target.host}) for data transfer that you have connected to (${controlHost}). Even though the FTP protocol allows this, basic-ftp disables this feature by default for security reasons. If you do need this feature, instantiate the Client with the optional paramter "allowSeparateTransferHost: true". See the README documentation for more information.`);
64121
+ await connectForPassiveTransfer(normalizedControlHost, target.port, ftp);
63973
64122
  return res;
63974
64123
  }
63975
64124
  /**
63976
64125
  * Parse a PASV response.
63977
64126
  */
63978
64127
  function parsePasvResponse(message) {
63979
- const groups = message.match(/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
64128
+ const groups = message.match(/(?<![-\d])([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
63980
64129
  if (groups === null || groups.length !== 4) throw new Error(`Can't parse response to 'PASV': ${message}`);
63981
64130
  return {
63982
64131
  host: groups[1].replace(/,/g, "."),
@@ -63985,7 +64134,8 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
63985
64134
  }
63986
64135
  function connectForPassiveTransfer(host, port, ftp) {
63987
64136
  return new Promise((resolve, reject) => {
63988
- let socket = ftp._newSocket();
64137
+ const rawSocket = ftp._newSocket();
64138
+ let socket = rawSocket;
63989
64139
  const handleConnErr = function(err) {
63990
64140
  err.message = "Can't open data connection in passive mode: " + err.message;
63991
64141
  reject(err);
@@ -64002,10 +64152,18 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64002
64152
  host,
64003
64153
  family: ftp.ipFamily
64004
64154
  }, () => {
64005
- if (ftp.socket instanceof tls_1$1.TLSSocket) socket = (0, tls_1$1.connect)(Object.assign({}, ftp.tlsOptions, {
64006
- socket,
64007
- session: ftp.socket.getSession()
64008
- }));
64155
+ var _a;
64156
+ if (ftp.socket instanceof tls_1$1.TLSSocket) {
64157
+ const tlsSocket = (0, tls_1$1.connect)(Object.assign({}, ftp.tlsOptions, {
64158
+ socket: rawSocket,
64159
+ session: (_a = ftp.tlsSessionStore) !== null && _a !== void 0 ? _a : ftp.socket.getSession()
64160
+ }));
64161
+ tlsSocket.on("session", (session) => {
64162
+ ftp.tlsSessionStore = session;
64163
+ });
64164
+ socket = tlsSocket;
64165
+ }
64166
+ rawSocket.setTimeout(0);
64009
64167
  socket.removeListener("error", handleConnErr);
64010
64168
  socket.removeListener("timeout", handleTimeout);
64011
64169
  ftp.dataSocket = socket;
@@ -64030,6 +64188,8 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64030
64188
  this.progress = progress;
64031
64189
  this.response = void 0;
64032
64190
  this.dataTransferDone = false;
64191
+ this.taskSettled = false;
64192
+ this.watchdog = new TransferWatchdog_1.TransferWatchdog();
64033
64193
  }
64034
64194
  /**
64035
64195
  * Mark the beginning of a transfer.
@@ -64040,16 +64200,20 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64040
64200
  onDataStart(name, type) {
64041
64201
  if (this.ftp.dataSocket === void 0) throw new Error("Data transfer should start but there is no data connection.");
64042
64202
  this.ftp.socket.setTimeout(0);
64043
- this.ftp.dataSocket.setTimeout(this.ftp.timeout);
64203
+ this.ftp.dataSocket.setTimeout(0);
64204
+ this.watchdog.start(this.ftp.dataSocket, type === "upload" ? "upload" : "download", this.ftp.timeout, () => {
64205
+ this.ftp.closeWithError(/* @__PURE__ */ new Error("Timeout (data socket)"));
64206
+ });
64044
64207
  this.progress.start(this.ftp.dataSocket, name, type);
64045
64208
  }
64046
64209
  /**
64047
64210
  * The data connection has finished the transfer.
64048
64211
  */
64049
64212
  onDataDone(task) {
64213
+ if (this.taskSettled) return;
64214
+ this.watchdog.stop();
64050
64215
  this.progress.updateAndStop();
64051
64216
  this.ftp.socket.setTimeout(this.ftp.timeout);
64052
- if (this.ftp.dataSocket) this.ftp.dataSocket.setTimeout(0);
64053
64217
  this.dataTransferDone = true;
64054
64218
  this.tryResolve(task);
64055
64219
  }
@@ -64064,6 +64228,9 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64064
64228
  * An error has been reported and the task should be rejected.
64065
64229
  */
64066
64230
  onError(task, err) {
64231
+ if (this.taskSettled) return;
64232
+ this.taskSettled = true;
64233
+ this.watchdog.stop();
64067
64234
  this.progress.updateAndStop();
64068
64235
  this.ftp.socket.setTimeout(this.ftp.timeout);
64069
64236
  this.ftp.dataSocket = void 0;
@@ -64080,6 +64247,7 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64080
64247
  }
64081
64248
  tryResolve(task) {
64082
64249
  if (this.dataTransferDone && this.response !== void 0) {
64250
+ this.taskSettled = true;
64083
64251
  this.ftp.dataSocket = void 0;
64084
64252
  task.resolve(this.response);
64085
64253
  }
@@ -64088,9 +64256,12 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64088
64256
  function uploadFrom(source, config) {
64089
64257
  const resolver = new TransferResolver(config.ftp, config.tracker);
64090
64258
  const fullCommand = `${config.command} ${config.remotePath}`;
64259
+ let transferStarted = false;
64091
64260
  return config.ftp.handle(fullCommand, (res, task) => {
64092
64261
  if (res instanceof Error) resolver.onError(task, res);
64093
64262
  else if (res.code === 150 || res.code === 125) {
64263
+ if (transferStarted) return;
64264
+ transferStarted = true;
64094
64265
  const dataSocket = config.ftp.dataSocket;
64095
64266
  if (!dataSocket) {
64096
64267
  resolver.onError(task, /* @__PURE__ */ new Error("Upload should begin but no data connection is available."));
@@ -64111,9 +64282,12 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
64111
64282
  function downloadTo(destination, config) {
64112
64283
  if (!config.ftp.dataSocket) throw new Error("Download will be initiated but no data connection is available.");
64113
64284
  const resolver = new TransferResolver(config.ftp, config.tracker);
64285
+ let transferStarted = false;
64114
64286
  return config.ftp.handle(config.command, (res, task) => {
64115
64287
  if (res instanceof Error) resolver.onError(task, res);
64116
64288
  else if (res.code === 150 || res.code === 125) {
64289
+ if (transferStarted) return;
64290
+ transferStarted = true;
64117
64291
  const dataSocket = config.ftp.dataSocket;
64118
64292
  if (!dataSocket) {
64119
64293
  resolver.onError(task, /* @__PURE__ */ new Error("Download should begin but no data connection is available."));
@@ -64164,11 +64338,12 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
64164
64338
  const fsReadDir = (0, util_1$3.promisify)(fs_1$7.readdir);
64165
64339
  const fsMkDir = (0, util_1$3.promisify)(fs_1$7.mkdir);
64166
64340
  const fsStat = (0, util_1$3.promisify)(fs_1$7.stat);
64341
+ const fsFStat = (0, util_1$3.promisify)(fs_1$7.fstat);
64167
64342
  const fsOpen = (0, util_1$3.promisify)(fs_1$7.open);
64168
64343
  const fsClose = (0, util_1$3.promisify)(fs_1$7.close);
64169
64344
  const fsUnlink = (0, util_1$3.promisify)(fs_1$7.unlink);
64170
64345
  const defaultClientOptions = {
64171
- allowSeparateTransferHost: true,
64346
+ allowSeparateTransferHost: false,
64172
64347
  maxListingBytes: 40 * 1024 * 1024
64173
64348
  };
64174
64349
  const LIST_COMMANDS_DEFAULT = () => ["LIST -a", "LIST"];
@@ -64240,7 +64415,9 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
64240
64415
  * explicit TLS. There are still FTP servers that support only implicit TLS, though.
64241
64416
  */
64242
64417
  connectImplicitTLS(host = "localhost", port = 21, tlsOptions = {}) {
64418
+ var _a;
64243
64419
  this.ftp.reset();
64420
+ tlsOptions.host = (_a = tlsOptions.host) !== null && _a !== void 0 ? _a : host;
64244
64421
  this.ftp.socket = (0, tls_1.connect)(port, host, tlsOptions, () => this.ftp.log(`Connected to ${(0, netUtils_1.describeAddress)(this.ftp.socket)} (${(0, netUtils_1.describeTLS)(this.ftp.socket)})`));
64245
64422
  this.ftp.tlsOptions = tlsOptions;
64246
64423
  return this._handleConnectResponse();
@@ -64483,7 +64660,10 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
64483
64660
  autoClose: false
64484
64661
  });
64485
64662
  try {
64486
- return await this._uploadFromStream(source, remotePath, command);
64663
+ const expectedBytes = await expectedBytesFromLocalFile(fd, options);
64664
+ const response = await this._uploadFromStream(source, remotePath, command);
64665
+ if (expectedBytes !== void 0 && source.bytesRead !== expectedBytes) throw new Error(`Local file "${localPath}" changed while it was being uploaded to "${remotePath}": expected to send ${expectedBytes} bytes but sent ${source.bytesRead}. The remote file is incomplete.`);
64666
+ return response;
64487
64667
  } finally {
64488
64668
  await ignoreError(() => fsClose(fd));
64489
64669
  }
@@ -64815,6 +64995,19 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
64815
64995
  await fsMkDir(path$25, { recursive: true });
64816
64996
  }
64817
64997
  }
64998
+ /**
64999
+ * Return how many bytes an upload should read from an open local file, taking the optional
65000
+ * range described by `options` into account. Returns `undefined` if the size can't be known
65001
+ * upfront, for example because the source is a pipe or another non-regular file.
65002
+ */
65003
+ async function expectedBytesFromLocalFile(fd, options) {
65004
+ var _a;
65005
+ const stats = await fsFStat(fd);
65006
+ if (!stats.isFile()) return;
65007
+ const start = (_a = options.localStart) !== null && _a !== void 0 ? _a : 0;
65008
+ const endExclusive = options.localEndInclusive !== void 0 ? Math.min(options.localEndInclusive + 1, stats.size) : stats.size;
65009
+ return Math.max(0, endExclusive - start);
65010
+ }
64818
65011
  async function ignoreError(func) {
64819
65012
  try {
64820
65013
  return await func();
@@ -65713,7 +65906,7 @@ var require_estraverse = /* @__PURE__ */ __commonJSMin(((exports) => {
65713
65906
  }));
65714
65907
  //#endregion
65715
65908
  //#region ../../node_modules/esutils/lib/ast.js
65716
- var require_ast$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65909
+ var require_ast = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65717
65910
  (function() {
65718
65911
  "use strict";
65719
65912
  function isExpression(node) {
@@ -65992,7 +66185,7 @@ var require_keyword = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65992
66185
  var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
65993
66186
  (function() {
65994
66187
  "use strict";
65995
- exports.ast = require_ast$1();
66188
+ exports.ast = require_ast();
65996
66189
  exports.code = require_code();
65997
66190
  exports.keyword = require_keyword();
65998
66191
  })();
@@ -81667,6 +81860,7 @@ var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
81667
81860
  kDestroy: Symbol("destroy"),
81668
81861
  kDispatch: Symbol("dispatch"),
81669
81862
  kUrl: Symbol("url"),
81863
+ kRedirectCacheControl: Symbol("redirect cache control"),
81670
81864
  kWriting: Symbol("writing"),
81671
81865
  kResuming: Symbol("resuming"),
81672
81866
  kQueue: Symbol("queue"),
@@ -84199,6 +84393,7 @@ var require_unwrap_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
84199
84393
  //#endregion
84200
84394
  //#region ../../node_modules/undici/lib/dispatcher/dispatcher-base.js
84201
84395
  var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) => {
84396
+ const buffer$1 = require("node:buffer");
84202
84397
  const Dispatcher = require_dispatcher();
84203
84398
  const UnwrapHandler = require_unwrap_handler();
84204
84399
  const { ClientDestroyedError, ClientClosedError, InvalidArgumentError } = require_errors$1();
@@ -84206,6 +84401,7 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
84206
84401
  const kOnDestroyed = Symbol("onDestroyed");
84207
84402
  const kOnClosed = Symbol("onClosed");
84208
84403
  const kWebSocketOptions = Symbol("webSocketOptions");
84404
+ const kEventSourceOptions = Symbol("eventSourceOptions");
84209
84405
  var DispatcherBase = class extends Dispatcher {
84210
84406
  /** @type {boolean} */
84211
84407
  [kDestroyed] = false;
@@ -84221,6 +84417,7 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
84221
84417
  constructor(opts) {
84222
84418
  super();
84223
84419
  this[kWebSocketOptions] = opts?.webSocket ?? {};
84420
+ this[kEventSourceOptions] = opts?.eventSource ?? {};
84224
84421
  }
84225
84422
  /**
84226
84423
  * @returns {import('../../types/dispatcher').WebSocketOptions}
@@ -84231,6 +84428,12 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
84231
84428
  maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
84232
84429
  };
84233
84430
  }
84431
+ /**
84432
+ * @returns {import('../../types/client').Client.EventSourceOptions}
84433
+ */
84434
+ get eventSourceOptions() {
84435
+ return { maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer$1.kStringMaxLength };
84436
+ }
84234
84437
  /** @returns {boolean} */
84235
84438
  get destroyed() {
84236
84439
  return this[kDestroyed];
@@ -84336,12 +84539,16 @@ var require_connect = /* @__PURE__ */ __commonJSMin(((exports, module) => {
84336
84539
  if (this._maxCachedSessions === 0) return;
84337
84540
  if (this._sessionCache.has(sessionKey)) this._sessionCache.delete(sessionKey);
84338
84541
  else if (this._sessionCache.size >= this._maxCachedSessions) {
84542
+ let evicted = false;
84339
84543
  for (const [key, ref] of this._sessionCache) if (ref.deref() === void 0) {
84340
84544
  this._sessionCache.delete(key);
84341
- return;
84545
+ evicted = true;
84546
+ break;
84547
+ }
84548
+ if (!evicted) {
84549
+ const oldest = this._sessionCache.keys().next();
84550
+ if (!oldest.done) this._sessionCache.delete(oldest.value);
84342
84551
  }
84343
- const oldest = this._sessionCache.keys().next();
84344
- if (!oldest.done) this._sessionCache.delete(oldest.value);
84345
84552
  }
84346
84553
  this._sessionCache.set(sessionKey, new WeakRef(session));
84347
84554
  this._sessionRegistry.register(session, sessionKey);
@@ -85347,6 +85554,16 @@ var require_infra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
85347
85554
  return input.slice(start, position.position);
85348
85555
  }
85349
85556
  const ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g;
85557
+ const nonASCIIRegex = /[^\x00-\x7F]/;
85558
+ /**
85559
+ * @param {string} str
85560
+ * @returns {string}
85561
+ *
85562
+ * @see https://infra.spec.whatwg.org/#ascii-lowercase
85563
+ */
85564
+ function asciiLowercase(str) {
85565
+ return nonASCIIRegex.test(str) ? str.replace(/[A-Z]+/g, (upper) => upper.toLowerCase()) : str.toLowerCase();
85566
+ }
85350
85567
  /**
85351
85568
  * @param {string} data
85352
85569
  * @returns {Uint8Array | 'failure'}
@@ -85444,6 +85661,7 @@ var require_infra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
85444
85661
  return result;
85445
85662
  }
85446
85663
  module.exports = {
85664
+ asciiLowercase,
85447
85665
  collectASequenceOfCodePoints,
85448
85666
  collectASequenceOfCodePointsFast,
85449
85667
  forgivingBase64,
@@ -88291,7 +88509,6 @@ var require_client_h1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
88291
88509
  };
88292
88510
  }
88293
88511
  function onHttpSocketError(err) {
88294
- assert$23(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
88295
88512
  const parser = this[kParser];
88296
88513
  if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
88297
88514
  const parserErr = parser.finish();
@@ -88916,7 +89133,6 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
88916
89133
  }
88917
89134
  }
88918
89135
  function onHttp2SessionError(err) {
88919
- assert$22(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
88920
89136
  this[kSocket][kError] = err;
88921
89137
  this[kClient][kOnError](err);
88922
89138
  }
@@ -89004,7 +89220,6 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
89004
89220
  client[kResume]();
89005
89221
  }
89006
89222
  function onHttp2SocketError(err) {
89007
- assert$22(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
89008
89223
  this[kError] = err;
89009
89224
  this[kClient][kOnError](err);
89010
89225
  }
@@ -89370,7 +89585,7 @@ var require_client$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
89370
89585
  * @param {string|URL} url
89371
89586
  * @param {import('../../types/client.js').Client.Options} options
89372
89587
  */
89373
- constructor(url, { maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, useH2c, initialWindowSize, connectionWindowSize, pingInterval, webSocket } = {}) {
89588
+ constructor(url, { maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, useH2c, initialWindowSize, connectionWindowSize, pingInterval, webSocket, eventSource } = {}) {
89374
89589
  if (keepAlive !== void 0) throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
89375
89590
  if (socketTimeout !== void 0) throw new InvalidArgumentError("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");
89376
89591
  if (requestTimeout !== void 0) throw new InvalidArgumentError("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");
@@ -89397,7 +89612,10 @@ var require_client$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
89397
89612
  if (initialWindowSize != null && (!Number.isInteger(initialWindowSize) || initialWindowSize < 1)) throw new InvalidArgumentError("initialWindowSize must be a positive integer, greater than 0");
89398
89613
  if (connectionWindowSize != null && (!Number.isInteger(connectionWindowSize) || connectionWindowSize < 1)) throw new InvalidArgumentError("connectionWindowSize must be a positive integer, greater than 0");
89399
89614
  if (pingInterval != null && (typeof pingInterval !== "number" || !Number.isInteger(pingInterval) || pingInterval < 0)) throw new InvalidArgumentError("pingInterval must be a positive integer, greater or equal to 0");
89400
- super({ webSocket });
89615
+ super({
89616
+ webSocket,
89617
+ eventSource
89618
+ });
89401
89619
  if (typeof connect !== "function") connect = buildConnector({
89402
89620
  ...tls,
89403
89621
  maxCachedSessions,
@@ -90222,16 +90440,18 @@ var require_agent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
90222
90440
  return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
90223
90441
  }
90224
90442
  var Agent = class extends DispatcherBase {
90225
- constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
90443
+ constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
90226
90444
  if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
90227
90445
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
90228
90446
  if (typeof maxOrigins !== "number" || Number.isNaN(maxOrigins) || maxOrigins <= 0) throw new InvalidArgumentError("maxOrigins must be a number greater than 0");
90229
90447
  super(options);
90230
90448
  if (connect && typeof connect !== "function") connect = { ...connect };
90449
+ if (tls && typeof tls !== "function") tls = { ...tls };
90231
90450
  this[kOptions] = {
90232
90451
  ...util.deepClone(options),
90233
90452
  maxOrigins,
90234
- connect
90453
+ connect,
90454
+ tls
90235
90455
  };
90236
90456
  this[kFactory] = factory;
90237
90457
  this[kClients] = /* @__PURE__ */ new Map();
@@ -94523,7 +94743,7 @@ var require_decorator_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
94523
94743
  //#region ../../node_modules/undici/lib/handler/redirect-handler.js
94524
94744
  var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
94525
94745
  const util = require_util$6();
94526
- const { kBodyUsed } = require_symbols();
94746
+ const { kBodyUsed, kRedirectCacheControl } = require_symbols();
94527
94747
  const assert$12 = require("node:assert");
94528
94748
  const { InvalidArgumentError } = require_errors$1();
94529
94749
  const EE$1 = require("node:events");
@@ -94563,6 +94783,10 @@ var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
94563
94783
  this.maxRedirections = maxRedirections;
94564
94784
  this.handler = handler;
94565
94785
  this.history = [];
94786
+ Object.defineProperty(this.history, kRedirectCacheControl, {
94787
+ value: [],
94788
+ enumerable: false
94789
+ });
94566
94790
  if (util.isStream(this.opts.body)) {
94567
94791
  if (util.bodyLength(this.opts.body) === 0) this.opts.body.on("data", function() {
94568
94792
  assert$12(false);
@@ -94603,6 +94827,7 @@ var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
94603
94827
  this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
94604
94828
  return;
94605
94829
  }
94830
+ this.history[kRedirectCacheControl].push(headers["cache-control"]);
94606
94831
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
94607
94832
  const path = search ? `${pathname}${search}` : pathname;
94608
94833
  const redirectUrlString = `${origin}${path}`;
@@ -95884,9 +96109,22 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
95884
96109
  //#region ../../node_modules/undici/lib/handler/cache-handler.js
95885
96110
  var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
95886
96111
  const util = require_util$6();
96112
+ const { kRedirectCacheControl } = require_symbols();
95887
96113
  const { parseCacheControlHeader, hasInvalidCacheControlDirective, parseVaryHeader, hasVaryStar, isInvalidOrWildcardVaryHeader, isEtagUsable } = require_cache$2();
95888
96114
  const { parseHttpDate } = require_date();
95889
96115
  function noop() {}
96116
+ /**
96117
+ * @param {string | URL} a
96118
+ * @param {string | URL} b
96119
+ * @returns {boolean}
96120
+ */
96121
+ function sameOrigin(a, b) {
96122
+ try {
96123
+ return new URL(String(a)).origin === new URL(String(b)).origin;
96124
+ } catch {
96125
+ return String(a) === String(b);
96126
+ }
96127
+ }
95890
96128
  const HEURISTICALLY_CACHEABLE_STATUS_CODES = [
95891
96129
  200,
95892
96130
  203,
@@ -95990,6 +96228,13 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
95990
96228
  */
95991
96229
  #writeStream;
95992
96230
  /**
96231
+ * The URLs visited while following redirects, shared by reference from the
96232
+ * redirect handler through the request context. Carries the suppressed hops'
96233
+ * cache-control under {@link kRedirectCacheControl}.
96234
+ * @type {URL[] | undefined}
96235
+ */
96236
+ #history;
96237
+ /**
95993
96238
  * @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
95994
96239
  * @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
95995
96240
  * @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
@@ -96004,6 +96249,7 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
96004
96249
  onRequestStart(controller, context) {
96005
96250
  this.#writeStream?.destroy();
96006
96251
  this.#writeStream = void 0;
96252
+ this.#history = context?.history;
96007
96253
  this.#handler.onRequestStart?.(controller, context);
96008
96254
  }
96009
96255
  onRequestUpgrade(controller, statusCode, headers, socket) {
@@ -96022,6 +96268,15 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
96022
96268
  invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
96023
96269
  return downstreamOnHeaders();
96024
96270
  }
96271
+ if (this.#history && this.#history.length > 0) {
96272
+ const finalUrl = this.#history[this.#history.length - 1];
96273
+ if (!sameOrigin(finalUrl.origin, this.#cacheKey.origin)) return downstreamOnHeaders();
96274
+ }
96275
+ const redirectCacheControl = this.#history?.[kRedirectCacheControl];
96276
+ if (redirectCacheControl) for (const hopCacheControl of redirectCacheControl) {
96277
+ const hopDirectives = hopCacheControl ? parseCacheControlHeader(hopCacheControl) : {};
96278
+ if (hopDirectives["no-store"] === true || this.#cacheType === "shared" && hopDirectives.private === true) return downstreamOnHeaders();
96279
+ }
96025
96280
  const cacheControlHeader = resHeaders["cache-control"];
96026
96281
  const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
96027
96282
  if (revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives)) {
@@ -97112,7 +97367,12 @@ var require_decompress = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97112
97367
  }
97113
97368
  this.#decompressedSize = decompressedSize;
97114
97369
  }
97115
- if (super.onResponseData(this.#controller, chunk) === false && !this.#controller.paused) this.#controller.pause();
97370
+ try {
97371
+ if (super.onResponseData(this.#controller, chunk) === false && !this.#controller.paused) this.#controller.pause();
97372
+ } catch (err) {
97373
+ this.#fail(err);
97374
+ return;
97375
+ }
97116
97376
  }
97117
97377
  } while (this.#drainRequested && !this.#terminated && !this.#controller.paused);
97118
97378
  } finally {
@@ -97123,9 +97383,14 @@ var require_decompress = /* @__PURE__ */ __commonJSMin(((exports, module) => {
97123
97383
  }
97124
97384
  #finishIfReady() {
97125
97385
  if (this.#terminated || !this.#completionPending || this.#controller.paused || this.#draining) return;
97126
- this.#terminated = true;
97127
97386
  this.#cleanupDecompressors();
97128
- super.onResponseEnd(this.#controller, this.#trailers);
97387
+ try {
97388
+ super.onResponseEnd(this.#controller, this.#trailers);
97389
+ } catch (err) {
97390
+ this.#fail(err);
97391
+ return;
97392
+ }
97393
+ this.#terminated = true;
97129
97394
  }
97130
97395
  #onDecompressionEnd() {
97131
97396
  if (this.#terminated) return;
@@ -97360,6 +97625,7 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
97360
97625
  * @property {number} bufferedBytes
97361
97626
  * @property {object | null} pendingTrailers
97362
97627
  * @property {boolean} done
97628
+ * @property {boolean} [pendingStart] onRequestStart deferred until the primary request's context is known
97363
97629
  */
97364
97630
  /**
97365
97631
  * Handler that forwards response events to multiple waiting handlers.
@@ -97373,6 +97639,18 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
97373
97639
  */
97374
97640
  #primaryHandler;
97375
97641
  /**
97642
+ * Whether the primary request has started (onRequestStart received). Until
97643
+ * then the request context is unknown and cannot be given to waiting handlers.
97644
+ * @type {boolean}
97645
+ */
97646
+ #requestStarted = false;
97647
+ /**
97648
+ * The primary request context, replayed to waiting handlers so they observe
97649
+ * the same redirect history as the primary.
97650
+ * @type {any}
97651
+ */
97652
+ #context = null;
97653
+ /**
97376
97654
  * @type {WaitingHandler[]}
97377
97655
  */
97378
97656
  #waitingHandlers = [];
@@ -97438,12 +97716,14 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
97438
97716
  const waitingHandler = this.#createWaitingHandler(handler);
97439
97717
  const waitingController = waitingHandler.controller;
97440
97718
  try {
97441
- handler.onRequestStart?.(waitingController, null);
97442
- if (waitingController.aborted) {
97443
- waitingHandler.done = true;
97444
- return true;
97445
- }
97446
- if (this.#responseStarted) handler.onResponseStart?.(waitingController, this.#statusCode, this.#headers, this.#statusMessage);
97719
+ if (this.#requestStarted) {
97720
+ handler.onRequestStart?.(waitingController, this.#context);
97721
+ if (waitingController.aborted) {
97722
+ waitingHandler.done = true;
97723
+ return true;
97724
+ }
97725
+ if (this.#responseStarted) handler.onResponseStart?.(waitingController, this.#statusCode, this.#headers, this.#statusMessage);
97726
+ } else waitingHandler.pendingStart = true;
97447
97727
  } catch {
97448
97728
  waitingHandler.done = true;
97449
97729
  return true;
@@ -97457,6 +97737,19 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
97457
97737
  */
97458
97738
  onRequestStart(controller, context) {
97459
97739
  this.#controller = controller;
97740
+ if (!this.#requestStarted) {
97741
+ this.#requestStarted = true;
97742
+ this.#context = context;
97743
+ for (const waitingHandler of this.#waitingHandlers) if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
97744
+ waitingHandler.pendingStart = false;
97745
+ try {
97746
+ waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context);
97747
+ } catch {
97748
+ waitingHandler.done = true;
97749
+ }
97750
+ }
97751
+ this.#pruneDoneWaitingHandlers();
97752
+ }
97460
97753
  this.#primaryHandler.onRequestStart?.(controller, context);
97461
97754
  }
97462
97755
  /**
@@ -97577,7 +97870,8 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
97577
97870
  bufferedChunks: [],
97578
97871
  bufferedBytes: 0,
97579
97872
  pendingTrailers: null,
97580
- done: false
97873
+ done: false,
97874
+ pendingStart: false
97581
97875
  };
97582
97876
  const state = {
97583
97877
  aborted: false,
@@ -99395,6 +99689,7 @@ var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99395
99689
  var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99396
99690
  const assert$6 = require("node:assert");
99397
99691
  const { runtimeFeatures } = require_runtime_features();
99692
+ const { asciiLowercase } = require_infra();
99398
99693
  /**
99399
99694
  * @typedef {object} Metadata
99400
99695
  * @property {SRIHashAlgorithm} alg - The algorithm used for the hash.
@@ -99439,11 +99734,12 @@ var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, mod
99439
99734
  const getSRIHashAlgorithmIndex = Map.prototype.get.bind(validSRIHashAlgorithmTokenSet);
99440
99735
  /**
99441
99736
  * @typedef IsValidSRIHashAlgorithm
99737
+ * @see https://w3c.github.io/webappsec-subresource-integrity/#valid-sri-hash-algorithm-token
99442
99738
  * @type {(algorithm: string) => algorithm is SRIHashAlgorithm}
99443
99739
  * @param {*} algorithm
99444
99740
  * @returns {algorithm is SRIHashAlgorithm}
99445
99741
  */
99446
- const isValidSRIHashAlgorithm = Map.prototype.has.bind(validSRIHashAlgorithmTokenSet);
99742
+ const isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
99447
99743
  /**
99448
99744
  * @param {Uint8Array} bytes
99449
99745
  * @param {string} metadataList
@@ -99507,7 +99803,7 @@ var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, mod
99507
99803
  if (!isValidSRIHashAlgorithm(algorithm)) continue;
99508
99804
  if (algorithmAndValue[1]) base64Value = algorithmAndValue[1];
99509
99805
  const metadata = {
99510
- alg: algorithm,
99806
+ alg: asciiLowercase(algorithm),
99511
99807
  val: base64Value
99512
99808
  };
99513
99809
  result.push(metadata);
@@ -100199,9 +100495,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100199
100495
  if (Array.isArray(value) && !Buffer.isBuffer(rawHeaders[i + 1])) for (const val of value) headersList.append(nameStr, val.toString("latin1"), true);
100200
100496
  else headersList.append(nameStr, value.toString("latin1"), true);
100201
100497
  }
100202
- const location = headersList.get("location", true);
100203
- this.body = new Readable({ read: resume });
100204
- const willFollow = location && request.redirect === "follow" && redirectStatusSet.has(status);
100498
+ const willFollow = headersList.get("location", true) && request.redirect === "follow" && redirectStatusSet.has(status);
100205
100499
  const decoders = [];
100206
100500
  if (request.method !== "HEAD" && request.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
100207
100501
  const contentEncoding = headersList.get("content-encoding", true);
@@ -100209,7 +100503,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100209
100503
  const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : [];
100210
100504
  const maxContentEncodings = 5;
100211
100505
  if (codings.length > maxContentEncodings) {
100212
- reject(/* @__PURE__ */ new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
100506
+ this.abort(/* @__PURE__ */ new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
100213
100507
  return true;
100214
100508
  }
100215
100509
  for (let i = codings.length - 1; i >= 0; --i) {
@@ -100236,6 +100530,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100236
100530
  }
100237
100531
  }
100238
100532
  }
100533
+ this.body = new Readable({ read: resume });
100239
100534
  const onError = this.onError.bind(this);
100240
100535
  resolve({
100241
100536
  status,
@@ -101102,7 +101397,10 @@ var require_util$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101102
101397
  validateCookiePath(cookie.path);
101103
101398
  out.push(`Path=${cookie.path}`);
101104
101399
  }
101105
- if (cookie.expires && cookie.expires.toString() !== "Invalid Date") out.push(`Expires=${toIMFDate(cookie.expires)}`);
101400
+ if (cookie.expires != null) {
101401
+ const expiresMs = cookie.expires instanceof Date ? cookie.expires.getTime() : cookie.expires;
101402
+ if (typeof expiresMs === "number" && Number.isFinite(expiresMs) && Math.abs(expiresMs) <= 864e13) out.push(`Expires=${toIMFDate(cookie.expires)}`);
101403
+ }
101106
101404
  if (cookie.sameSite) out.push(`SameSite=${cookie.sameSite}`);
101107
101405
  for (const part of cookie.unparsed) {
101108
101406
  if (!part.includes("=")) throw new Error("Invalid unparsed");
@@ -101170,56 +101468,57 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101170
101468
  * @param {Object.<string, unknown>} [cookieAttributeList={}]
101171
101469
  */
101172
101470
  function parseUnparsedAttributes(unparsedAttributes, cookieAttributeList = {}) {
101173
- if (unparsedAttributes.length === 0) return cookieAttributeList;
101174
- assert$2(unparsedAttributes[0] === ";");
101175
- unparsedAttributes = unparsedAttributes.slice(1);
101176
- let cookieAv = "";
101177
- if (unparsedAttributes.includes(";")) {
101178
- cookieAv = collectASequenceOfCodePointsFast(";", unparsedAttributes, { position: 0 });
101179
- unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
101180
- } else {
101181
- cookieAv = unparsedAttributes;
101182
- unparsedAttributes = "";
101183
- }
101184
- let attributeName = "";
101185
- let attributeValue = "";
101186
- if (cookieAv.includes("=")) {
101187
- const position = { position: 0 };
101188
- attributeName = collectASequenceOfCodePointsFast("=", cookieAv, position);
101189
- attributeValue = cookieAv.slice(position.position + 1);
101190
- } else attributeName = cookieAv;
101191
- attributeName = attributeName.trim();
101192
- attributeValue = attributeValue.trim();
101193
- if (attributeValue.length > maxAttributeValueSize) return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
101194
- const attributeNameLowercase = attributeName.toLowerCase();
101195
- if (attributeNameLowercase === "expires") cookieAttributeList.expires = new Date(attributeValue);
101196
- else if (attributeNameLowercase === "max-age") {
101197
- const charCode = attributeValue.charCodeAt(0);
101198
- if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
101199
- if (!/^\d+$/.test(attributeValue)) return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
101200
- cookieAttributeList.maxAge = Number(attributeValue);
101201
- } else if (attributeNameLowercase === "domain") {
101202
- let cookieDomain = attributeValue;
101203
- if (cookieDomain[0] === ".") cookieDomain = cookieDomain.slice(1);
101204
- cookieDomain = cookieDomain.toLowerCase();
101205
- cookieAttributeList.domain = cookieDomain;
101206
- } else if (attributeNameLowercase === "path") {
101207
- let cookiePath = "";
101208
- if (attributeValue.length === 0 || attributeValue[0] !== "/") cookiePath = "/";
101209
- else cookiePath = attributeValue;
101210
- cookieAttributeList.path = cookiePath;
101211
- } else if (attributeNameLowercase === "secure") cookieAttributeList.secure = true;
101212
- else if (attributeNameLowercase === "httponly") cookieAttributeList.httpOnly = true;
101213
- else if (attributeNameLowercase === "samesite") {
101214
- const attributeValueLowercase = attributeValue.toLowerCase();
101215
- if (attributeValueLowercase === "none") cookieAttributeList.sameSite = "None";
101216
- else if (attributeValueLowercase === "strict") cookieAttributeList.sameSite = "Strict";
101217
- else if (attributeValueLowercase === "lax") cookieAttributeList.sameSite = "Lax";
101218
- } else {
101219
- cookieAttributeList.unparsed ??= [];
101220
- cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
101471
+ while (true) {
101472
+ if (unparsedAttributes.length === 0) return cookieAttributeList;
101473
+ assert$2(unparsedAttributes[0] === ";");
101474
+ unparsedAttributes = unparsedAttributes.slice(1);
101475
+ let cookieAv = "";
101476
+ if (unparsedAttributes.includes(";")) {
101477
+ cookieAv = collectASequenceOfCodePointsFast(";", unparsedAttributes, { position: 0 });
101478
+ unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
101479
+ } else {
101480
+ cookieAv = unparsedAttributes;
101481
+ unparsedAttributes = "";
101482
+ }
101483
+ let attributeName = "";
101484
+ let attributeValue = "";
101485
+ if (cookieAv.includes("=")) {
101486
+ const position = { position: 0 };
101487
+ attributeName = collectASequenceOfCodePointsFast("=", cookieAv, position);
101488
+ attributeValue = cookieAv.slice(position.position + 1);
101489
+ } else attributeName = cookieAv;
101490
+ attributeName = attributeName.trim();
101491
+ attributeValue = attributeValue.trim();
101492
+ if (attributeValue.length > maxAttributeValueSize) continue;
101493
+ const attributeNameLowercase = attributeName.toLowerCase();
101494
+ if (attributeNameLowercase === "expires") cookieAttributeList.expires = new Date(attributeValue);
101495
+ else if (attributeNameLowercase === "max-age") {
101496
+ const charCode = attributeValue.charCodeAt(0);
101497
+ if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") continue;
101498
+ if (!/^\d+$/.test(attributeValue)) continue;
101499
+ cookieAttributeList.maxAge = Number(attributeValue);
101500
+ } else if (attributeNameLowercase === "domain") {
101501
+ let cookieDomain = attributeValue;
101502
+ if (cookieDomain[0] === ".") cookieDomain = cookieDomain.slice(1);
101503
+ cookieDomain = cookieDomain.toLowerCase();
101504
+ cookieAttributeList.domain = cookieDomain;
101505
+ } else if (attributeNameLowercase === "path") {
101506
+ let cookiePath = "";
101507
+ if (attributeValue.length === 0 || attributeValue[0] !== "/") cookiePath = "/";
101508
+ else cookiePath = attributeValue;
101509
+ cookieAttributeList.path = cookiePath;
101510
+ } else if (attributeNameLowercase === "secure") cookieAttributeList.secure = true;
101511
+ else if (attributeNameLowercase === "httponly") cookieAttributeList.httpOnly = true;
101512
+ else if (attributeNameLowercase === "samesite") {
101513
+ const attributeValueLowercase = attributeValue.toLowerCase();
101514
+ if (attributeValueLowercase === "none") cookieAttributeList.sameSite = "None";
101515
+ else if (attributeValueLowercase === "strict") cookieAttributeList.sameSite = "Strict";
101516
+ else if (attributeValueLowercase === "lax") cookieAttributeList.sameSite = "Lax";
101517
+ } else {
101518
+ cookieAttributeList.unparsed ??= [];
101519
+ cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
101520
+ }
101221
101521
  }
101222
- return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
101223
101522
  }
101224
101523
  module.exports = {
101225
101524
  parseSetCookie,
@@ -101256,7 +101555,7 @@ var require_cookies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101256
101555
  brandChecks(headers);
101257
101556
  const cookie = headers.get("cookie");
101258
101557
  /** @type {Record<string, string>} */
101259
- const out = {};
101558
+ const out = { __proto__: null };
101260
101559
  if (!cookie) return out;
101261
101560
  for (const piece of cookie.split(";")) {
101262
101561
  const [name, ...value] = piece.split("=");
@@ -102382,6 +102681,15 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102382
102681
  if (isControlFrame(this.#info.opcode)) {
102383
102682
  this.#loop = this.parseControlFrame(body);
102384
102683
  this.#state = parserStates.INFO;
102684
+ if (this.#loop && this.#handler.socket.writableNeedDrain) {
102685
+ this.#loop = false;
102686
+ this.#handler.socket.once("drain", () => {
102687
+ if (this.destroyed) return;
102688
+ this.#loop = true;
102689
+ this.run(callback);
102690
+ });
102691
+ return;
102692
+ }
102385
102693
  } else if (!this.#info.compressed) {
102386
102694
  if (!this.writeFragments(body)) return;
102387
102695
  if (!this.#info.fragmented && this.#info.fin) websocketMessageReceived(this.#handler, this.#info.binaryType, this.consumeFragments());
@@ -103400,6 +103708,7 @@ var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103400
103708
  //#endregion
103401
103709
  //#region ../../node_modules/undici/lib/web/eventsource/eventsource-stream.js
103402
103710
  var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103711
+ const buffer = require("node:buffer");
103403
103712
  const { Transform } = require("node:stream");
103404
103713
  const { isASCIINumber, isValidLastEventId } = require_util$1();
103405
103714
  /**
@@ -103426,10 +103735,14 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103426
103735
  * @type {32} SPACE
103427
103736
  */
103428
103737
  const SPACE = 32;
103738
+ const defaultMaxEventSize = buffer.kStringMaxLength;
103429
103739
  const DATA = Buffer.from("data");
103430
103740
  const EVENT = Buffer.from("event");
103431
103741
  const ID = Buffer.from("id");
103432
103742
  const RETRY = Buffer.from("retry");
103743
+ const minParserItems = 1024;
103744
+ const maxParserItems = 131072;
103745
+ const bytesPerParserItem = 128;
103433
103746
  function isASCIINumberBytes(buffer, start) {
103434
103747
  if (start >= buffer.length) return false;
103435
103748
  for (let i = start; i < buffer.length; i++) if (buffer[i] < 48 || buffer[i] > 57) return false;
@@ -103444,6 +103757,11 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103444
103757
  for (let i = 0; i < length; i++) if (line[i] !== field[i]) return false;
103445
103758
  return true;
103446
103759
  }
103760
+ function createMaxEventSizeExceededError() {
103761
+ const error = /* @__PURE__ */ new Error("EventSource message size exceeded");
103762
+ error.aborted = false;
103763
+ return error;
103764
+ }
103447
103765
  /**
103448
103766
  * @typedef {object} EventSourceStreamEvent
103449
103767
  * @type {object}
@@ -103485,6 +103803,18 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103485
103803
  pos = 0;
103486
103804
  lineChunkIndex = 0;
103487
103805
  linePos = 0;
103806
+ lineLength = 0;
103807
+ eventSize = 0;
103808
+ eventFieldSizes = {
103809
+ data: 0,
103810
+ event: 0,
103811
+ id: 0,
103812
+ retry: 0
103813
+ };
103814
+ dataLineCount = 0;
103815
+ maxEventSize;
103816
+ maxDataLines;
103817
+ maxBufferedChunks;
103488
103818
  event = {
103489
103819
  data: void 0,
103490
103820
  event: void 0,
@@ -103494,6 +103824,7 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103494
103824
  /**
103495
103825
  * @param {object} options
103496
103826
  * @param {boolean} [options.readableObjectMode]
103827
+ * @param {number} [options.maxEventSize]
103497
103828
  * @param {eventSourceSettings} [options.eventSourceSettings]
103498
103829
  * @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
103499
103830
  */
@@ -103501,6 +103832,10 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103501
103832
  options.readableObjectMode = true;
103502
103833
  super(options);
103503
103834
  this.state = options.eventSourceSettings || {};
103835
+ this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize;
103836
+ const parserItemLimit = this.maxEventSize > 0 ? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem))) : 0;
103837
+ this.maxDataLines = parserItemLimit;
103838
+ this.maxBufferedChunks = parserItemLimit;
103504
103839
  if (options.push) this.push = options.push;
103505
103840
  }
103506
103841
  /**
@@ -103514,6 +103849,10 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103514
103849
  callback();
103515
103850
  return;
103516
103851
  }
103852
+ if (this.maxEventSize > 0 && this.chunks.length >= this.maxBufferedChunks && chunk[0] !== LF && chunk[0] !== CR) {
103853
+ callback(createMaxEventSizeExceededError());
103854
+ return;
103855
+ }
103517
103856
  this.chunks.push(chunk);
103518
103857
  if (this.checkBOM) {
103519
103858
  if (this.handleBOM()) {
@@ -103544,15 +103883,29 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103544
103883
  }
103545
103884
  if (byte === LF || byte === CR) {
103546
103885
  if (byte === CR) this.crlfCheck = true;
103547
- this.parseLine(this.readLine(), this.event);
103886
+ try {
103887
+ this.parseLine(this.readLine(), this.event);
103888
+ } catch (error) {
103889
+ callback(error);
103890
+ return;
103891
+ }
103548
103892
  this.consumeCurrentByte();
103549
103893
  this.eventEndCheck = true;
103550
103894
  continue;
103551
103895
  }
103896
+ if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
103897
+ callback(createMaxEventSizeExceededError());
103898
+ return;
103899
+ }
103552
103900
  this.advanceCursor();
103553
103901
  }
103554
103902
  callback();
103555
103903
  }
103904
+ _destroy(error, callback) {
103905
+ this.chunks.length = 0;
103906
+ this.clearEvent();
103907
+ super._destroy(error, callback);
103908
+ }
103556
103909
  /**
103557
103910
  * @param {Buffer} line
103558
103911
  * @param {EventSourceStreamEvent} event
@@ -103569,24 +103922,43 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103569
103922
  if (line[valueStart] === SPACE) ++valueStart;
103570
103923
  }
103571
103924
  if (isFieldName(line, fieldLength, DATA)) {
103925
+ if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) throw createMaxEventSizeExceededError();
103926
+ const valueBytes = line.length - valueStart;
103927
+ const dataSize = this.eventFieldSizes.data + (event.data === void 0 ? 0 : 1) + valueBytes;
103928
+ this.setEventFieldSize("data", dataSize);
103572
103929
  const value = line.toString("utf8", valueStart);
103573
103930
  if (event.data === void 0) event.data = value;
103574
103931
  else event.data += `\n${value}`;
103932
+ this.dataLineCount++;
103575
103933
  return;
103576
103934
  }
103577
103935
  if (isFieldName(line, fieldLength, RETRY)) {
103578
- if (isASCIINumberBytes(line, valueStart)) event.retry = line.toString("utf8", valueStart);
103936
+ if (isASCIINumberBytes(line, valueStart)) {
103937
+ this.setEventFieldSize("retry", line.length - valueStart);
103938
+ event.retry = line.toString("utf8", valueStart);
103939
+ }
103579
103940
  return;
103580
103941
  }
103581
103942
  if (isFieldName(line, fieldLength, ID)) {
103582
- if (isValidLastEventIdBytes(line, valueStart)) event.id = line.toString("utf8", valueStart);
103943
+ if (isValidLastEventIdBytes(line, valueStart)) {
103944
+ this.setEventFieldSize("id", line.length - valueStart);
103945
+ event.id = line.toString("utf8", valueStart);
103946
+ }
103583
103947
  return;
103584
103948
  }
103585
103949
  if (isFieldName(line, fieldLength, EVENT)) {
103586
- const value = line.toString("utf8", valueStart);
103587
- if (value.length > 0) event.event = value;
103950
+ if (valueStart < line.length) {
103951
+ this.setEventFieldSize("event", line.length - valueStart);
103952
+ event.event = line.toString("utf8", valueStart);
103953
+ }
103588
103954
  }
103589
103955
  }
103956
+ setEventFieldSize(field, size) {
103957
+ const eventSize = this.eventSize - this.eventFieldSizes[field] + size;
103958
+ if (this.maxEventSize > 0 && eventSize > this.maxEventSize) throw createMaxEventSizeExceededError();
103959
+ this.eventSize = eventSize;
103960
+ this.eventFieldSizes[field] = size;
103961
+ }
103590
103962
  /**
103591
103963
  * @param {EventSourceStreamEvent} event
103592
103964
  */
@@ -103607,6 +103979,12 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103607
103979
  this.event.event = void 0;
103608
103980
  this.event.id = void 0;
103609
103981
  this.event.retry = void 0;
103982
+ this.eventSize = 0;
103983
+ this.dataLineCount = 0;
103984
+ this.eventFieldSizes.data = 0;
103985
+ this.eventFieldSizes.event = 0;
103986
+ this.eventFieldSizes.id = 0;
103987
+ this.eventFieldSizes.retry = 0;
103610
103988
  }
103611
103989
  hasPendingEvent() {
103612
103990
  return this.event.data !== void 0 || this.event.event !== void 0 || this.event.id !== void 0 || this.event.retry !== void 0;
@@ -103631,13 +104009,15 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
103631
104009
  syncLineStartToCursor() {
103632
104010
  this.lineChunkIndex = this.chunkIndex;
103633
104011
  this.linePos = this.pos;
104012
+ this.lineLength = 0;
103634
104013
  this.dropConsumedChunks();
103635
104014
  }
103636
104015
  dropConsumedChunks() {
103637
- while (this.lineChunkIndex > 0) {
103638
- this.chunks.shift();
103639
- this.lineChunkIndex--;
103640
- this.chunkIndex--;
104016
+ if (this.lineChunkIndex > 0) {
104017
+ const consumed = this.lineChunkIndex;
104018
+ this.chunks.splice(0, consumed);
104019
+ this.lineChunkIndex = 0;
104020
+ this.chunkIndex -= consumed;
103641
104021
  }
103642
104022
  if (this.chunkIndex === this.chunks.length) {
103643
104023
  this.chunks.length = 0;
@@ -103723,6 +104103,7 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103723
104103
  const { isNetworkError } = require_response();
103724
104104
  const { kEnumerableProperty } = require_util$6();
103725
104105
  const { environmentSettingsObject } = require_util$5();
104106
+ const { getGlobalDispatcher } = require_global();
103726
104107
  let experimentalWarned = false;
103727
104108
  /**
103728
104109
  * A reconnection time, in milliseconds. This must initially be an implementation-defined value,
@@ -103907,6 +104288,7 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103907
104288
  this.#state.origin = response.urlList[response.urlList.length - 1].origin;
103908
104289
  const eventSourceStream = new EventSourceStream({
103909
104290
  eventSourceSettings: this.#state,
104291
+ maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
103910
104292
  push: (event) => {
103911
104293
  this.dispatchEvent(createFastMessageEvent(event.type, event.options));
103912
104294
  }
@@ -104021,7 +104403,8 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
104021
104403
  },
104022
104404
  {
104023
104405
  key: "dispatcher",
104024
- converter: webidl.converters.any
104406
+ converter: webidl.converters.any,
104407
+ defaultValue: () => getGlobalDispatcher()
104025
104408
  },
104026
104409
  {
104027
104410
  key: "node",
@@ -111439,7 +111822,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
111439
111822
  }));
111440
111823
  //#endregion
111441
111824
  //#region ../../node_modules/brace-expansion/node_modules/balanced-match/dist/commonjs/index.js
111442
- var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
111825
+ var require_commonjs$7 = /* @__PURE__ */ __commonJSMin(((exports) => {
111443
111826
  Object.defineProperty(exports, "__esModule", { value: true });
111444
111827
  exports.range = exports.balanced = void 0;
111445
111828
  const balanced = (a, b, str) => {
@@ -111493,11 +111876,11 @@ var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
111493
111876
  }));
111494
111877
  //#endregion
111495
111878
  //#region ../../node_modules/brace-expansion/dist/commonjs/index.js
111496
- var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
111879
+ var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
111497
111880
  Object.defineProperty(exports, "__esModule", { value: true });
111498
111881
  exports.EXPANSION_MAX_REWRITES = exports.EXPANSION_MAX_DEPTH = exports.EXPANSION_MAX_LENGTH = exports.EXPANSION_MAX = void 0;
111499
111882
  exports.expand = expand;
111500
- const balanced_match_1 = require_commonjs$6();
111883
+ const balanced_match_1 = require_commonjs$7();
111501
111884
  const escSlash = "\0SLASH" + Math.random() + "\0";
111502
111885
  const escOpen = "\0OPEN" + Math.random() + "\0";
111503
111886
  const escClose = "\0CLOSE" + Math.random() + "\0";
@@ -111699,46 +112082,33 @@ var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
111699
112082
  }
111700
112083
  }));
111701
112084
  //#endregion
111702
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
111703
- var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
111704
- Object.defineProperty(exports, "__esModule", { value: true });
111705
- exports.assertValidPattern = void 0;
111706
- const MAX_PATTERN_LENGTH = 1024 * 64;
111707
- const assertValidPattern = (pattern) => {
111708
- if (typeof pattern !== "string") throw new TypeError("invalid pattern");
111709
- if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
111710
- };
111711
- exports.assertValidPattern = assertValidPattern;
111712
- }));
111713
- //#endregion
111714
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js
111715
- var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
112085
+ //#region ../../node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js
112086
+ var require_parse_class = /* @__PURE__ */ __commonJSMin(((exports) => {
111716
112087
  Object.defineProperty(exports, "__esModule", { value: true });
111717
112088
  exports.parseClass = void 0;
111718
112089
  const posixClasses = {
111719
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
111720
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
111721
- "[:ascii:]": ["\\x00-\\x7f", false],
111722
- "[:blank:]": ["\\p{Zs}\\t", true],
111723
- "[:cntrl:]": ["\\p{Cc}", true],
111724
- "[:digit:]": ["\\p{Nd}", true],
111725
- "[:graph:]": [
111726
- "\\p{Z}\\p{C}",
111727
- true,
111728
- true
111729
- ],
111730
- "[:lower:]": ["\\p{Ll}", true],
112090
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
112091
+ "[:alpha:]": ["\\p{L}\\p{Nl}"],
112092
+ "[:ascii:]": ["\\x00-\\x7f"],
112093
+ "[:blank:]": ["\\p{Zs}\\t"],
112094
+ "[:cntrl:]": ["\\p{Cc}"],
112095
+ "[:digit:]": ["\\p{Nd}"],
112096
+ "[:graph:]": ["\\p{Z}\\p{C}", true],
112097
+ "[:lower:]": ["\\p{Ll}"],
111731
112098
  "[:print:]": ["\\p{C}", true],
111732
- "[:punct:]": ["\\p{P}", true],
111733
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
111734
- "[:upper:]": ["\\p{Lu}", true],
111735
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
111736
- "[:xdigit:]": ["A-Fa-f0-9", false]
112099
+ "[:punct:]": ["\\p{P}\\p{S}"],
112100
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"],
112101
+ "[:upper:]": ["\\p{Lu}"],
112102
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
112103
+ "[:xdigit:]": ["A-Fa-f0-9"]
111737
112104
  };
111738
112105
  const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
111739
- const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
111740
- const rangesToString = (ranges) => ranges.join("");
111741
- const parseClass = (glob, position) => {
112106
+ const noMatch = /$./;
112107
+ const parseClass = (glob, position, nocase = false, form) => {
112108
+ const norm = (c) => {
112109
+ const n = form ? c.normalize(form) : c;
112110
+ return [...n].length === 1 ? n : c;
112111
+ };
111742
112112
  const pos = position;
111743
112113
  /* c8 ignore start */
111744
112114
  if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
@@ -111747,13 +112117,12 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
111747
112117
  const negs = [];
111748
112118
  let i = pos + 1;
111749
112119
  let sawStart = false;
111750
- let uflag = false;
111751
112120
  let escaping = false;
111752
112121
  let negate = false;
111753
112122
  let endPos = pos;
111754
112123
  let rangeStart = "";
111755
112124
  WHILE: while (i < glob.length) {
111756
- const c = glob.charAt(i);
112125
+ const c = String.fromCodePoint(glob.codePointAt(i));
111757
112126
  if ((c === "!" || c === "^") && i === pos + 1) {
111758
112127
  negate = true;
111759
112128
  i++;
@@ -111772,71 +112141,677 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
111772
112141
  }
111773
112142
  }
111774
112143
  if (c === "[" && !escaping) {
111775
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
111776
- if (rangeStart) return [
111777
- "$.",
111778
- false,
111779
- glob.length - pos,
111780
- true
111781
- ];
112144
+ for (const [cls, [unip, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
112145
+ if (rangeStart) return [noMatch, glob.length - pos];
111782
112146
  i += cls.length;
111783
112147
  if (neg) negs.push(unip);
111784
112148
  else ranges.push(unip);
111785
- uflag = uflag || u;
111786
112149
  continue WHILE;
111787
112150
  }
111788
112151
  }
111789
112152
  escaping = false;
112153
+ const n = norm(c);
111790
112154
  if (rangeStart) {
111791
- if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
111792
- else if (c === rangeStart) ranges.push(braceEscape(c));
112155
+ if (n.codePointAt(0) > rangeStart.codePointAt(0)) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(n));
112156
+ else if (n === rangeStart) ranges.push(braceEscape(n));
111793
112157
  rangeStart = "";
111794
- i++;
112158
+ i += c.length;
111795
112159
  continue;
111796
112160
  }
111797
- if (glob.startsWith("-]", i + 1)) {
111798
- ranges.push(braceEscape(c + "-"));
111799
- i += 2;
112161
+ if (glob.startsWith("-]", i + c.length)) {
112162
+ ranges.push(braceEscape(n + "-"));
112163
+ i += c.length + 1;
111800
112164
  continue;
111801
112165
  }
111802
- if (glob.startsWith("-", i + 1)) {
111803
- rangeStart = c;
111804
- i += 2;
112166
+ if (glob.startsWith("-", i + c.length)) {
112167
+ rangeStart = n;
112168
+ i += c.length + 1;
111805
112169
  continue;
111806
112170
  }
111807
- ranges.push(braceEscape(c));
111808
- i++;
112171
+ ranges.push(braceEscape(n));
112172
+ i += c.length;
111809
112173
  }
111810
- if (endPos < i) return [
111811
- "",
111812
- false,
111813
- 0,
111814
- false
111815
- ];
111816
- if (!ranges.length && !negs.length) return [
111817
- "$.",
111818
- false,
111819
- glob.length - pos,
111820
- true
111821
- ];
111822
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) return [
111823
- regexpEscape(ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]),
111824
- false,
111825
- endPos - pos,
111826
- false
111827
- ];
111828
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
111829
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
111830
- return [
111831
- ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
111832
- uflag,
111833
- endPos - pos,
111834
- true
111835
- ];
112174
+ if (endPos < i) return [noMatch, 0];
112175
+ if (!ranges.length && !negs.length) return [noMatch, glob.length - pos];
112176
+ const sranges = "[" + (negate ? "^" : "") + ranges.join("") + "]";
112177
+ const snegs = "[" + (negate ? "" : "^") + negs.join("") + "]";
112178
+ const comb = "^" + (ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs);
112179
+ return [new RegExp(comb, nocase ? "iu" : "u"), endPos - pos];
111836
112180
  };
111837
112181
  exports.parseClass = parseClass;
111838
112182
  }));
111839
112183
  //#endregion
112184
+ //#region ../../node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js
112185
+ var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
112186
+ Object.defineProperty(exports, "__esModule", { value: true });
112187
+ exports.Matcher = void 0;
112188
+ const parse_class_js_1 = require_parse_class();
112189
+ const MATCH = {
112190
+ t: "match",
112191
+ id: 0
112192
+ };
112193
+ const extTypes = "!?+*@";
112194
+ const lit = (ch) => ({
112195
+ t: "lit",
112196
+ ch
112197
+ });
112198
+ const reEscape = (s) => s.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
112199
+ const newFoldRe = (s) => new RegExp(`^${reEscape(s)}$`, "iu");
112200
+ const foldCache = /* @__PURE__ */ new Map();
112201
+ const foldRe = (ch) => {
112202
+ let re = foldCache.get(ch);
112203
+ if (!re) {
112204
+ re = newFoldRe(ch);
112205
+ if (foldCache.size >= 1e3) foldCache.clear();
112206
+ foldCache.set(ch, re);
112207
+ }
112208
+ return re;
112209
+ };
112210
+ const litMatch = (l, c) => {
112211
+ if (c === l.ch) return true;
112212
+ if (!l.re) return false;
112213
+ const code = c.charCodeAt(0);
112214
+ if (code >= 128) return l.re.test(c);
112215
+ const ascii = l.ascii ??= new Uint8Array(128);
112216
+ ascii[code] ||= l.re.test(c) ? 1 : 2;
112217
+ return ascii[code] === 1;
112218
+ };
112219
+ const tokenize = (p, nocase, noext, form) => {
112220
+ const toks = [];
112221
+ for (let i = 0; i < p.length;) {
112222
+ const c = String.fromCodePoint(p.codePointAt(i));
112223
+ if (c === "\\") {
112224
+ const e = p.codePointAt(i + 1);
112225
+ const ch = e === void 0 ? c : String.fromCodePoint(e);
112226
+ toks.push(lit(ch));
112227
+ i += 1 + ch.length;
112228
+ continue;
112229
+ }
112230
+ if (c === "[") {
112231
+ const [re, consumed] = (0, parse_class_js_1.parseClass)(p, i, nocase, form);
112232
+ if (consumed) {
112233
+ toks.push({
112234
+ t: "class",
112235
+ re
112236
+ });
112237
+ i += consumed;
112238
+ continue;
112239
+ }
112240
+ }
112241
+ if (!noext && extTypes.includes(c) && p[i + 1] === "(") {
112242
+ toks.push({
112243
+ t: "open",
112244
+ type: c
112245
+ });
112246
+ i += 2;
112247
+ continue;
112248
+ }
112249
+ toks.push(!noext && c === "|" ? { t: "bar" } : !noext && c === ")" ? { t: "close" } : c === "*" ? { t: "star" } : c === "?" ? { t: "any" } : lit(c));
112250
+ i += c.length;
112251
+ }
112252
+ return toks;
112253
+ };
112254
+ const pair = (toks) => {
112255
+ const pairs = /* @__PURE__ */ new Map();
112256
+ const stack = [];
112257
+ toks.forEach((tok, i) => {
112258
+ if (tok.t === "open") stack.push(i);
112259
+ else if (tok.t === "close" && stack.length) pairs.set(stack.pop(), i);
112260
+ });
112261
+ return pairs;
112262
+ };
112263
+ const build = (toks, pairs, start, end, top) => {
112264
+ let seq = [];
112265
+ const alts = [seq];
112266
+ for (let i = start; i < end; i++) {
112267
+ const tok = toks[i];
112268
+ const close = pairs.get(i);
112269
+ if (tok.t === "open" && close !== void 0) {
112270
+ const sub = build(toks, pairs, i + 1, close, false);
112271
+ seq.push({
112272
+ t: "ext",
112273
+ type: tok.type,
112274
+ alts: sub
112275
+ });
112276
+ i = close;
112277
+ } else if (tok.t === "bar" && !top) alts.push(seq = []);
112278
+ else if (tok.t === "open") seq.push(lit(tok.type), lit("("));
112279
+ else if (tok.t === "bar") seq.push(lit("|"));
112280
+ else if (tok.t === "close") seq.push(lit(")"));
112281
+ else seq.push(tok);
112282
+ }
112283
+ return alts;
112284
+ };
112285
+ const normalize = (items, form) => {
112286
+ const out = [];
112287
+ let run = "";
112288
+ const flush = () => {
112289
+ for (const ch of run.normalize(form)) out.push(lit(ch));
112290
+ run = "";
112291
+ };
112292
+ for (const it of items) {
112293
+ if (it.t === "lit") {
112294
+ run += it.ch;
112295
+ continue;
112296
+ }
112297
+ flush();
112298
+ out.push(it.t === "ext" ? {
112299
+ ...it,
112300
+ alts: it.alts.map((a) => normalize(a, form))
112301
+ } : it);
112302
+ }
112303
+ flush();
112304
+ return out;
112305
+ };
112306
+ const compile = (items, nocase) => {
112307
+ let id = 1;
112308
+ const split = (out) => ({
112309
+ t: "split",
112310
+ id: id++,
112311
+ out
112312
+ });
112313
+ const seq = (items, next) => items.reduceRight((next, it) => item(it, next), next);
112314
+ const item = (it, next) => {
112315
+ switch (it.t) {
112316
+ case "lit":
112317
+ const re = nocase ? foldRe(it.ch) : void 0;
112318
+ return {
112319
+ t: "lit",
112320
+ id: id++,
112321
+ ch: it.ch,
112322
+ re,
112323
+ next
112324
+ };
112325
+ case "any":
112326
+ case "star": return {
112327
+ t: it.t,
112328
+ id: id++,
112329
+ next
112330
+ };
112331
+ case "class": return {
112332
+ t: "class",
112333
+ id: id++,
112334
+ re: it.re,
112335
+ next
112336
+ };
112337
+ }
112338
+ const alts = (next) => it.alts.map((a) => seq(a, next));
112339
+ switch (it.type) {
112340
+ case "@": return split(alts(next));
112341
+ case "?": return split([next, ...alts(next)]);
112342
+ case "!": return {
112343
+ t: "neg",
112344
+ id: id++,
112345
+ sub: split(alts(MATCH)),
112346
+ next
112347
+ };
112348
+ }
112349
+ const after = split([]);
112350
+ const entry = split(alts(after));
112351
+ after.out.push(next, entry);
112352
+ return it.type === "*" ? after : entry;
112353
+ };
112354
+ return [seq(items, MATCH), id];
112355
+ };
112356
+ const show = (start) => {
112357
+ const lines = [];
112358
+ const seen = /* @__PURE__ */ new Set();
112359
+ const ref = (n) => n.t === "match" ? "match" : String(n.id);
112360
+ const walk = (n, indent) => {
112361
+ if (n.t === "match" || seen.has(n)) return;
112362
+ seen.add(n);
112363
+ const line = (desc) => lines.push(`${indent}${n.id}: ${desc}`);
112364
+ switch (n.t) {
112365
+ case "split":
112366
+ line(`split -> ${n.out.map(ref).join(", ")}`);
112367
+ for (const o of n.out) walk(o, indent);
112368
+ return;
112369
+ case "neg":
112370
+ line(`!(${ref(n.sub)}) -> ${ref(n.next)}`);
112371
+ walk(n.sub, indent + " ");
112372
+ return walk(n.next, indent);
112373
+ case "lit":
112374
+ line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`);
112375
+ break;
112376
+ case "class":
112377
+ line(`${n.re} -> ${ref(n.next)}`);
112378
+ break;
112379
+ default: line(`${n.t === "any" ? "?" : "*"} -> ${ref(n.next)}`);
112380
+ }
112381
+ walk(n.next, indent);
112382
+ };
112383
+ walk(start, "");
112384
+ return [`start -> ${ref(start)}`, ...lines].join("\n");
112385
+ };
112386
+ var State = class {
112387
+ gen;
112388
+ threads = [];
112389
+ match = false;
112390
+ runs = [];
112391
+ ids = [];
112392
+ constructor(gen) {
112393
+ this.gen = gen;
112394
+ }
112395
+ get dead() {
112396
+ return !this.threads.length && !this.match && !this.runs.length;
112397
+ }
112398
+ };
112399
+ const sameState = (a, b) => {
112400
+ if (a.ids.length !== b.ids.length) return false;
112401
+ if (a.runs.length !== b.runs.length) return false;
112402
+ if (a.ids.some((id, i) => id !== b.ids[i])) return false;
112403
+ return a.runs.every((r) => b.runs.some((o) => o.neg === r.neg && sameState(o.state, r.state)));
112404
+ };
112405
+ const marks = (size) => ({
112406
+ has: new Float64Array(size),
112407
+ seen: new Float64Array(size),
112408
+ gen: 0
112409
+ });
112410
+ var Sim = class {
112411
+ dots;
112412
+ dotStart;
112413
+ #marks;
112414
+ constructor(dots, dotStart, marks) {
112415
+ this.dots = dots;
112416
+ this.dotStart = dotStart;
112417
+ this.#marks = marks;
112418
+ }
112419
+ state() {
112420
+ return new State(++this.#marks.gen);
112421
+ }
112422
+ done(state) {
112423
+ state.ids = state.threads.map((n) => n.id).sort((a, b) => a - b);
112424
+ if (state.match) state.ids.unshift(MATCH.id);
112425
+ return state;
112426
+ }
112427
+ #visit(state, node) {
112428
+ const { seen } = this.#marks;
112429
+ if (seen[node.id] === state.gen) return false;
112430
+ seen[node.id] = state.gen;
112431
+ return true;
112432
+ }
112433
+ #addThread(state, node) {
112434
+ const { has } = this.#marks;
112435
+ if (has[node.id] === state.gen) return false;
112436
+ has[node.id] = state.gen;
112437
+ state.threads.push(node);
112438
+ return true;
112439
+ }
112440
+ restricted(i, top) {
112441
+ return top && (this.dots || this.dotStart && i === 0);
112442
+ }
112443
+ add(state, node, i, top) {
112444
+ switch (node.t) {
112445
+ case "split":
112446
+ if (!this.#visit(state, node)) return;
112447
+ for (const o of node.out) this.add(state, o, i, top);
112448
+ return;
112449
+ case "neg":
112450
+ if (!this.#visit(state, node)) return;
112451
+ const sub = this.state();
112452
+ this.add(sub, node.sub, i, false);
112453
+ this.done(sub);
112454
+ return this.addRun(state, {
112455
+ t: "run",
112456
+ neg: node,
112457
+ state: sub
112458
+ }, i, top);
112459
+ case "star":
112460
+ if (this.restricted(i, top)) return;
112461
+ if (this.#addThread(state, node)) this.add(state, node.next, i, top);
112462
+ return;
112463
+ case "match":
112464
+ state.match = true;
112465
+ return;
112466
+ default: this.#addThread(state, node);
112467
+ }
112468
+ }
112469
+ addRun(state, run, i, top) {
112470
+ for (const r of state.runs) if (r.neg === run.neg && sameState(r.state, run.state)) return;
112471
+ state.runs.push(run);
112472
+ if (!run.state.match) this.add(state, run.neg.next, i, top);
112473
+ }
112474
+ step(state, c, i, top) {
112475
+ const next = this.state();
112476
+ for (const th of state.threads) switch (th.t) {
112477
+ case "lit":
112478
+ if (litMatch(th, c)) this.add(next, th.next, i + 1, top);
112479
+ break;
112480
+ case "any":
112481
+ if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top);
112482
+ break;
112483
+ case "class":
112484
+ if (!this.restricted(i, top) && th.re.test(c)) this.add(next, th.next, i + 1, top);
112485
+ break;
112486
+ case "star": if (!this.restricted(i, top)) this.add(next, th, i + 1, top);
112487
+ }
112488
+ if (!this.restricted(i, top)) for (const run of state.runs) {
112489
+ if (run.state.dead) {
112490
+ this.addRun(next, run, i + 1, top);
112491
+ continue;
112492
+ }
112493
+ const sub = this.step(run.state, c, i, false);
112494
+ this.addRun(next, {
112495
+ t: "run",
112496
+ neg: run.neg,
112497
+ state: sub
112498
+ }, i + 1, top);
112499
+ }
112500
+ return this.done(next);
112501
+ }
112502
+ };
112503
+ const stateKey = (state) => {
112504
+ const ids = state.ids.join();
112505
+ if (!state.runs.length) return ids;
112506
+ return `${ids}|${state.runs.map((r) => `${r.neg.id}(${stateKey(r.state)})`).sort().join("|")}`;
112507
+ };
112508
+ const DFA_BUDGET = 1 << 18;
112509
+ var Dfa = class {
112510
+ #start;
112511
+ #states = /* @__PURE__ */ new Map();
112512
+ #size = 0;
112513
+ #plain;
112514
+ #dotStart;
112515
+ #sim;
112516
+ #dotSim;
112517
+ constructor(start, marks) {
112518
+ this.#start = start;
112519
+ this.#sim = new Sim(false, false, marks);
112520
+ this.#dotSim = new Sim(false, true, marks);
112521
+ }
112522
+ #make(state) {
112523
+ return {
112524
+ state,
112525
+ match: state.match,
112526
+ dead: state.dead,
112527
+ next: /* @__PURE__ */ new Map()
112528
+ };
112529
+ }
112530
+ #intern(state) {
112531
+ const key = stateKey(state);
112532
+ const found = this.#states.get(key);
112533
+ if (found) return found;
112534
+ if (this.#size > DFA_BUDGET) this.#clear();
112535
+ const d = this.#make(state);
112536
+ this.#states.set(key, d);
112537
+ this.#size += key.length + 1;
112538
+ return d;
112539
+ }
112540
+ #clear() {
112541
+ this.#states.clear();
112542
+ this.#size = 0;
112543
+ this.#plain = void 0;
112544
+ this.#dotStart = void 0;
112545
+ }
112546
+ start(dotStart) {
112547
+ if (dotStart) {
112548
+ if (this.#dotStart) return this.#dotStart;
112549
+ const state = this.#dotSim.state();
112550
+ this.#dotSim.add(state, this.#start, 0, true);
112551
+ return this.#dotStart = this.#make(this.#dotSim.done(state));
112552
+ }
112553
+ if (this.#plain) return this.#plain;
112554
+ const state = this.#sim.state();
112555
+ this.#sim.add(state, this.#start, 0, true);
112556
+ return this.#plain = this.#intern(this.#sim.done(state));
112557
+ }
112558
+ next(d, c) {
112559
+ const code = c.charCodeAt(0);
112560
+ const found = code < 128 ? void 0 : d.next.get(c);
112561
+ if (found) return found;
112562
+ const n = d === this.#dotStart ? this.#intern(this.#dotSim.step(d.state, c, 0, true)) : this.#intern(this.#sim.step(d.state, c, 1, true));
112563
+ if (code < 128) {
112564
+ if (!d.ascii) {
112565
+ d.ascii = new Array(128);
112566
+ this.#size += 128;
112567
+ }
112568
+ d.ascii[code] = n;
112569
+ } else d.next.set(c, n);
112570
+ this.#size++;
112571
+ return n;
112572
+ }
112573
+ };
112574
+ const linear = (start) => {
112575
+ const nodes = [];
112576
+ for (let n = start; n.t !== "match"; n = n.next) {
112577
+ if (n.t === "split" || n.t === "neg") return void 0;
112578
+ nodes.push(n);
112579
+ }
112580
+ return nodes;
112581
+ };
112582
+ const testLinear = (nodes, chars, start, end) => {
112583
+ let ni = 0;
112584
+ let ci = start;
112585
+ let starNi = -1;
112586
+ let starCi = 0;
112587
+ while (ci < end) {
112588
+ const n = nodes[ni];
112589
+ if (n?.t === "star") {
112590
+ starNi = ni++;
112591
+ starCi = ci;
112592
+ continue;
112593
+ }
112594
+ const c = chars[ci];
112595
+ if (n && (n.t === "any" || n.t === "lit" && litMatch(n, c) || n.t === "class" && n.re.test(c))) {
112596
+ ni++;
112597
+ ci++;
112598
+ continue;
112599
+ }
112600
+ if (starNi === -1) return false;
112601
+ ni = starNi + 1;
112602
+ ci = ++starCi;
112603
+ }
112604
+ while (nodes[ni]?.t === "star") ni++;
112605
+ return ni === nodes.length;
112606
+ };
112607
+ const lengths = (items) => {
112608
+ let min = 0;
112609
+ let max = 0;
112610
+ for (const it of items) {
112611
+ const [lo, hi] = itemLengths(it);
112612
+ min += lo;
112613
+ max += hi;
112614
+ }
112615
+ return [min, max];
112616
+ };
112617
+ const itemLengths = (it) => {
112618
+ if (it.t === "star") return [0, Infinity];
112619
+ if (it.t !== "ext") return [1, 1];
112620
+ if (it.type === "!") return [0, Infinity];
112621
+ const alts = it.alts.map(lengths);
112622
+ const min = Math.min(...alts.map((a) => a[0]));
112623
+ const max = Math.max(...alts.map((a) => a[1]));
112624
+ const loop = max === 0 ? 0 : Infinity;
112625
+ return it.type === "@" ? [min, max] : it.type === "?" ? [0, max] : it.type === "*" ? [0, loop] : [min, loop];
112626
+ };
112627
+ const hasAffix = (lits, chars, start) => {
112628
+ for (let j = 0; j < lits.length; j++) if (!litMatch(lits[j], chars[start + j])) return false;
112629
+ return true;
112630
+ };
112631
+ const slashOrSurrogate = /[/\ud800-\udfff]/;
112632
+ const surrogate = /[\ud800-\udfff]/;
112633
+ const codePoints = (s) => surrogate.test(s) ? [...s] : s;
112634
+ const noSlash = (s) => {
112635
+ if (s.includes("/")) throw new Error("can only match a single path portion, got: " + s);
112636
+ };
112637
+ var Matcher = class {
112638
+ pattern;
112639
+ options;
112640
+ #start;
112641
+ #size;
112642
+ #marks;
112643
+ #dotsSim;
112644
+ #literal;
112645
+ #literalFold = false;
112646
+ #literalRe;
112647
+ #linear;
112648
+ #wild = false;
112649
+ #min = 0;
112650
+ #max = Infinity;
112651
+ #prefix = [];
112652
+ #suffix = [];
112653
+ #prefixStr;
112654
+ #suffixStr;
112655
+ #affix = false;
112656
+ #dfa;
112657
+ #form;
112658
+ constructor(pattern, options = {}) {
112659
+ if (pattern.includes("/")) throw new Error("can only match a single path portion, got pattern: " + pattern);
112660
+ this.pattern = pattern;
112661
+ this.options = options;
112662
+ const { nocase = false, noext = false, normalize: n } = options;
112663
+ this.#form = n === true ? "NFC" : n || void 0;
112664
+ const literal = /^[?*+@]\(\)$/.test(pattern);
112665
+ const toks = tokenize(pattern, nocase, noext || literal, this.#form);
112666
+ let [items] = build(toks, pair(toks), 0, toks.length, true);
112667
+ if (this.#form) items = normalize(items, this.#form);
112668
+ const [start, size] = compile(items, nocase);
112669
+ this.#start = start;
112670
+ this.#size = size;
112671
+ if (items.every((it) => it.t === "lit")) {
112672
+ this.#literal = items.map((it) => it.ch).join("");
112673
+ this.#literalFold = nocase;
112674
+ } else {
112675
+ const lit = (it) => it.t !== "lit" ? void 0 : nocase ? {
112676
+ ch: it.ch,
112677
+ re: foldRe(it.ch)
112678
+ } : { ch: it.ch };
112679
+ for (const it of items) {
112680
+ const l = lit(it);
112681
+ if (!l) break;
112682
+ this.#prefix.push(l);
112683
+ }
112684
+ for (let j = items.length - 1; j >= 0; j--) {
112685
+ const l = lit(items[j]);
112686
+ if (!l) break;
112687
+ this.#suffix.unshift(l);
112688
+ }
112689
+ this.#affix = !!(this.#prefix.length || this.#suffix.length);
112690
+ if (!nocase) {
112691
+ this.#prefixStr = this.#prefix.map((l) => l.ch).join("");
112692
+ this.#suffixStr = this.#suffix.map((l) => l.ch).join("");
112693
+ }
112694
+ this.#linear = linear(this.#start)?.slice(this.#prefix.length, -this.#suffix.length || void 0);
112695
+ this.#wild = !!this.#linear?.every((n) => n.t === "star" || n.t === "any");
112696
+ const [min, max] = lengths(items);
112697
+ this.#min = min;
112698
+ this.#max = max;
112699
+ }
112700
+ }
112701
+ test(s) {
112702
+ if (this.#form) {
112703
+ noSlash(s);
112704
+ return this.#test(s.normalize(this.#form));
112705
+ }
112706
+ if (slashOrSurrogate.test(s)) {
112707
+ noSlash(s);
112708
+ return this.#test(s, [...s]);
112709
+ }
112710
+ return this.#test(s, s);
112711
+ }
112712
+ /**
112713
+ * The same as {@link Matcher#test}, but the string is not checked
112714
+ * for `/` chars, so the result for a string that has one is not
112715
+ * defined. Only use it for a string that is known to be one path
112716
+ * portion, such as a part of a path that was split on `/`. It can
112717
+ * be faster, because some patterns do not need to look at each char
112718
+ * of the string.
112719
+ */
112720
+ testUnchecked(s) {
112721
+ return this.#test(this.#form ? s.normalize(this.#form) : s);
112722
+ }
112723
+ #test(s, chars) {
112724
+ if (this.#literal !== void 0) return this.#literalFold ? (this.#literalRe ??= newFoldRe(this.#literal)).test(s) : s === this.#literal;
112725
+ const min = this.#min;
112726
+ const max = this.#max;
112727
+ if (chars === void 0) {
112728
+ const most = s.length;
112729
+ const least = most + 1 >> 1;
112730
+ if (most < min || least > max) return false;
112731
+ if (least < min || most > max) chars = codePoints(s);
112732
+ }
112733
+ if (chars !== void 0 && (chars.length < min || chars.length > max)) return false;
112734
+ const prefix = this.#prefix.length;
112735
+ if (this.#affix) if (this.#prefixStr !== void 0 && this.#suffixStr !== void 0) {
112736
+ if (!s.startsWith(this.#prefixStr) || !s.endsWith(this.#suffixStr)) return false;
112737
+ } else {
112738
+ chars ??= codePoints(s);
112739
+ const end = chars.length - this.#suffix.length;
112740
+ if (!hasAffix(this.#prefix, chars, 0) || !hasAffix(this.#suffix, chars, end)) return false;
112741
+ }
112742
+ const dotStart = !this.options.dot && s.startsWith(".");
112743
+ if (this.#linear) {
112744
+ if (s === "." || s === "..") return false;
112745
+ if (dotStart && !prefix) return false;
112746
+ if (this.#wild) return true;
112747
+ chars ??= codePoints(s);
112748
+ const end = chars.length - this.#suffix.length;
112749
+ return testLinear(this.#linear, chars, prefix, end);
112750
+ }
112751
+ chars ??= codePoints(s);
112752
+ if (s === "." || s === "..") {
112753
+ this.#marks ??= marks(this.#size);
112754
+ const sim = this.#dotsSim ??= new Sim(true, false, this.#marks);
112755
+ const start = sim.state();
112756
+ sim.add(start, this.#start, 0, true);
112757
+ let state = sim.done(start);
112758
+ for (let i = 0; i < chars.length; i++) state = sim.step(state, chars[i], i, true);
112759
+ return state.match;
112760
+ }
112761
+ this.#marks ??= marks(this.#size);
112762
+ const dfa = this.#dfa ??= new Dfa(this.#start, this.#marks);
112763
+ let d = dfa.start(dotStart);
112764
+ const str = chars === s;
112765
+ for (let i = 0; i < chars.length; i++) {
112766
+ if (d.dead) return false;
112767
+ const code = str ? s.charCodeAt(i) : chars[i].charCodeAt(0);
112768
+ d = d.ascii?.[code] ?? dfa.next(d, chars[i]);
112769
+ }
112770
+ return d.match;
112771
+ }
112772
+ /** a readable listing of the state machine */
112773
+ toString() {
112774
+ return show(this.#start);
112775
+ }
112776
+ };
112777
+ exports.Matcher = Matcher;
112778
+ }));
112779
+ //#endregion
112780
+ //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
112781
+ var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
112782
+ Object.defineProperty(exports, "__esModule", { value: true });
112783
+ exports.assertValidPattern = void 0;
112784
+ const MAX_PATTERN_LENGTH = 1024 * 64;
112785
+ const assertValidPattern = (pattern) => {
112786
+ if (typeof pattern !== "string") throw new TypeError("invalid pattern");
112787
+ if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
112788
+ };
112789
+ exports.assertValidPattern = assertValidPattern;
112790
+ }));
112791
+ //#endregion
112792
+ //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js
112793
+ var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
112794
+ Object.defineProperty(exports, "__esModule", { value: true });
112795
+ exports.escape = void 0;
112796
+ /**
112797
+ * Escape all magic characters in a glob pattern.
112798
+ *
112799
+ * If the {@link MinimatchOptions.windowsPathsNoEscape}
112800
+ * option is used, then characters are escaped by wrapping in `[]`, because
112801
+ * a magic character wrapped in a character class can only be satisfied by
112802
+ * that exact character. In this mode, `\` is _not_ escaped, because it is
112803
+ * not interpreted as a magic character, but instead as a path separator.
112804
+ *
112805
+ * If the {@link MinimatchOptions.magicalBraces} option is used,
112806
+ * then braces (`{` and `}`) will be escaped.
112807
+ */
112808
+ const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
112809
+ if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
112810
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
112811
+ };
112812
+ exports.escape = escape;
112813
+ }));
112814
+ //#endregion
111840
112815
  //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js
111841
112816
  var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
111842
112817
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -111867,610 +112842,36 @@ var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
111867
112842
  exports.unescape = unescape;
111868
112843
  }));
111869
112844
  //#endregion
111870
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js
111871
- var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
111872
- var _a;
111873
- Object.defineProperty(exports, "__esModule", { value: true });
111874
- exports.AST = void 0;
111875
- const brace_expressions_js_1 = require_brace_expressions();
111876
- const unescape_js_1 = require_unescape();
111877
- const types = new Set([
111878
- "!",
111879
- "?",
111880
- "+",
111881
- "*",
111882
- "@"
111883
- ]);
111884
- const isExtglobType = (c) => types.has(c);
111885
- const isExtglobAST = (c) => isExtglobType(c.type);
111886
- const adoptionMap = new Map([
111887
- ["!", ["@"]],
111888
- ["?", ["?", "@"]],
111889
- ["@", ["@"]],
111890
- ["*", [
111891
- "*",
111892
- "+",
111893
- "?",
111894
- "@"
111895
- ]],
111896
- ["+", ["+", "@"]]
111897
- ]);
111898
- const adoptionWithSpaceMap = new Map([
111899
- ["!", ["?"]],
111900
- ["@", ["?"]],
111901
- ["+", ["?", "*"]]
111902
- ]);
111903
- const adoptionAnyMap = new Map([
111904
- ["!", ["?", "@"]],
111905
- ["?", ["?", "@"]],
111906
- ["@", ["?", "@"]],
111907
- ["*", [
111908
- "*",
111909
- "+",
111910
- "?",
111911
- "@"
111912
- ]],
111913
- ["+", [
111914
- "+",
111915
- "@",
111916
- "?",
111917
- "*"
111918
- ]]
111919
- ]);
111920
- const usurpMap = new Map([
111921
- ["!", new Map([["!", "@"]])],
111922
- ["?", new Map([["*", "*"], ["+", "*"]])],
111923
- ["@", new Map([
111924
- ["!", "!"],
111925
- ["?", "?"],
111926
- ["@", "@"],
111927
- ["*", "*"],
111928
- ["+", "+"]
111929
- ])],
111930
- ["+", new Map([["?", "*"], ["*", "*"]])]
111931
- ]);
111932
- const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
111933
- const startNoDot = "(?!\\.)";
111934
- const addPatternStart = new Set(["[", "."]);
111935
- const justDots = new Set(["..", "."]);
111936
- const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
111937
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
111938
- const qmark = "[^/]";
111939
- const star = qmark + "*?";
111940
- const starNoEmpty = qmark + "+?";
111941
- let ID = 0;
111942
- var AST = class {
111943
- type;
111944
- #root;
111945
- #hasMagic;
111946
- #uflag = false;
111947
- #parts = [];
111948
- #parent;
111949
- #parentIndex;
111950
- #negs;
111951
- #filledNegs = false;
111952
- #options;
111953
- #toString;
111954
- #emptyExt = false;
111955
- id = ++ID;
111956
- get depth() {
111957
- return (this.#parent?.depth ?? -1) + 1;
111958
- }
111959
- [Symbol.for("nodejs.util.inspect.custom")]() {
111960
- return {
111961
- "@@type": "AST",
111962
- id: this.id,
111963
- type: this.type,
111964
- root: this.#root.id,
111965
- parent: this.#parent?.id,
111966
- depth: this.depth,
111967
- partsLength: this.#parts.length,
111968
- parts: this.#parts
111969
- };
111970
- }
111971
- constructor(type, parent, options = {}) {
111972
- this.type = type;
111973
- if (type) this.#hasMagic = true;
111974
- this.#parent = parent;
111975
- this.#root = this.#parent ? this.#parent.#root : this;
111976
- this.#options = this.#root === this ? options : this.#root.#options;
111977
- this.#negs = this.#root === this ? [] : this.#root.#negs;
111978
- if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
111979
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
111980
- }
111981
- get hasMagic() {
111982
- /* c8 ignore start */
111983
- if (this.#hasMagic !== void 0) return this.#hasMagic;
111984
- /* c8 ignore stop */
111985
- for (const p of this.#parts) {
111986
- if (typeof p === "string") continue;
111987
- if (p.type || p.hasMagic) return this.#hasMagic = true;
111988
- }
111989
- return this.#hasMagic;
111990
- }
111991
- toString() {
111992
- return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
111993
- }
111994
- #fillNegs() {
111995
- /* c8 ignore start */
111996
- if (this !== this.#root) throw new Error("should only call on root");
111997
- if (this.#filledNegs) return this;
111998
- /* c8 ignore stop */
111999
- this.toString();
112000
- this.#filledNegs = true;
112001
- let n;
112002
- while (n = this.#negs.pop()) {
112003
- if (n.type !== "!") continue;
112004
- let p = n;
112005
- let pp = p.#parent;
112006
- while (pp) {
112007
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
112008
- /* c8 ignore start */
112009
- if (typeof part === "string") throw new Error("string part in extglob AST??");
112010
- /* c8 ignore stop */
112011
- part.copyIn(pp.#parts[i]);
112012
- }
112013
- p = pp;
112014
- pp = p.#parent;
112015
- }
112016
- }
112017
- return this;
112018
- }
112019
- push(...parts) {
112020
- for (const p of parts) {
112021
- if (p === "") continue;
112022
- /* c8 ignore start */
112023
- if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
112024
- /* c8 ignore stop */
112025
- this.#parts.push(p);
112026
- }
112027
- }
112028
- toJSON() {
112029
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
112030
- if (this.isStart() && !this.type) ret.unshift([]);
112031
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({});
112032
- return ret;
112033
- }
112034
- isStart() {
112035
- if (this.#root === this) return true;
112036
- if (!this.#parent?.isStart()) return false;
112037
- if (this.#parentIndex === 0) return true;
112038
- const p = this.#parent;
112039
- for (let i = 0; i < this.#parentIndex; i++) {
112040
- const pp = p.#parts[i];
112041
- if (!(pp instanceof _a && pp.type === "!")) return false;
112042
- }
112043
- return true;
112044
- }
112045
- isEnd() {
112046
- if (this.#root === this) return true;
112047
- if (this.#parent?.type === "!") return true;
112048
- if (!this.#parent?.isEnd()) return false;
112049
- if (!this.type) return this.#parent?.isEnd();
112050
- /* c8 ignore start */
112051
- const pl = this.#parent ? this.#parent.#parts.length : 0;
112052
- /* c8 ignore stop */
112053
- return this.#parentIndex === pl - 1;
112054
- }
112055
- copyIn(part) {
112056
- if (typeof part === "string") this.push(part);
112057
- else this.push(part.clone(this));
112058
- }
112059
- clone(parent) {
112060
- const c = new _a(this.type, parent);
112061
- for (const p of this.#parts) c.copyIn(p);
112062
- return c;
112063
- }
112064
- static #parseAST(str, ast, pos, opt, extDepth) {
112065
- const maxDepth = opt.maxExtglobRecursion ?? 2;
112066
- let escaping = false;
112067
- let inBrace = false;
112068
- let braceStart = -1;
112069
- let braceNeg = false;
112070
- if (ast.type === null) {
112071
- let i = pos;
112072
- let acc = "";
112073
- while (i < str.length) {
112074
- const c = str.charAt(i++);
112075
- if (escaping || c === "\\") {
112076
- escaping = !escaping;
112077
- acc += c;
112078
- continue;
112079
- }
112080
- if (inBrace) {
112081
- if (i === braceStart + 1) {
112082
- if (c === "^" || c === "!") braceNeg = true;
112083
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
112084
- acc += c;
112085
- continue;
112086
- } else if (c === "[") {
112087
- inBrace = true;
112088
- braceStart = i;
112089
- braceNeg = false;
112090
- acc += c;
112091
- continue;
112092
- }
112093
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
112094
- ast.push(acc);
112095
- acc = "";
112096
- const ext = new _a(c, ast);
112097
- i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
112098
- ast.push(ext);
112099
- continue;
112100
- }
112101
- acc += c;
112102
- }
112103
- ast.push(acc);
112104
- return i;
112105
- }
112106
- let i = pos + 1;
112107
- let part = new _a(null, ast);
112108
- const parts = [];
112109
- let acc = "";
112110
- while (i < str.length) {
112111
- const c = str.charAt(i++);
112112
- if (escaping || c === "\\") {
112113
- escaping = !escaping;
112114
- acc += c;
112115
- continue;
112116
- }
112117
- if (inBrace) {
112118
- if (i === braceStart + 1) {
112119
- if (c === "^" || c === "!") braceNeg = true;
112120
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
112121
- acc += c;
112122
- continue;
112123
- } else if (c === "[") {
112124
- inBrace = true;
112125
- braceStart = i;
112126
- braceNeg = false;
112127
- acc += c;
112128
- continue;
112129
- }
112130
- /* c8 ignore stop */
112131
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
112132
- const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
112133
- part.push(acc);
112134
- acc = "";
112135
- const ext = new _a(c, part);
112136
- part.push(ext);
112137
- i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
112138
- continue;
112139
- }
112140
- if (c === "|") {
112141
- part.push(acc);
112142
- acc = "";
112143
- parts.push(part);
112144
- part = new _a(null, ast);
112145
- continue;
112146
- }
112147
- if (c === ")") {
112148
- if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
112149
- part.push(acc);
112150
- acc = "";
112151
- ast.push(...parts, part);
112152
- return i;
112153
- }
112154
- acc += c;
112155
- }
112156
- ast.type = null;
112157
- ast.#hasMagic = void 0;
112158
- ast.#parts = [str.substring(pos - 1)];
112159
- return i;
112160
- }
112161
- #canAdoptWithSpace(child) {
112162
- return this.#canAdopt(child, adoptionWithSpaceMap);
112163
- }
112164
- #canAdopt(child, map = adoptionMap) {
112165
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
112166
- const gc = child.#parts[0];
112167
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
112168
- return this.#canAdoptType(gc.type, map);
112169
- }
112170
- #canAdoptType(c, map = adoptionAnyMap) {
112171
- return !!map.get(this.type)?.includes(c);
112172
- }
112173
- #adoptWithSpace(child, index) {
112174
- const gc = child.#parts[0];
112175
- const blank = new _a(null, gc, this.options);
112176
- blank.#parts.push("");
112177
- gc.push(blank);
112178
- this.#adopt(child, index);
112179
- }
112180
- #adopt(child, index) {
112181
- const gc = child.#parts[0];
112182
- this.#parts.splice(index, 1, ...gc.#parts);
112183
- for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
112184
- this.#toString = void 0;
112185
- }
112186
- #canUsurpType(c) {
112187
- return !!usurpMap.get(this.type)?.has(c);
112188
- }
112189
- #canUsurp(child) {
112190
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
112191
- const gc = child.#parts[0];
112192
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
112193
- return this.#canUsurpType(gc.type);
112194
- }
112195
- #usurp(child) {
112196
- const m = usurpMap.get(this.type);
112197
- const gc = child.#parts[0];
112198
- const nt = m?.get(gc.type);
112199
- /* c8 ignore start - impossible */
112200
- if (!nt) return false;
112201
- /* c8 ignore stop */
112202
- this.#parts = gc.#parts;
112203
- for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
112204
- this.type = nt;
112205
- this.#toString = void 0;
112206
- this.#emptyExt = false;
112207
- }
112208
- static fromGlob(pattern, options = {}) {
112209
- const ast = new _a(null, void 0, options);
112210
- _a.#parseAST(pattern, ast, 0, options, 0);
112211
- return ast;
112212
- }
112213
- toMMPattern() {
112214
- /* c8 ignore start */
112215
- if (this !== this.#root) return this.#root.toMMPattern();
112216
- /* c8 ignore stop */
112217
- const glob = this.toString();
112218
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
112219
- if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
112220
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
112221
- return Object.assign(new RegExp(`^${re}$`, flags), {
112222
- _src: re,
112223
- _glob: glob
112224
- });
112225
- }
112226
- get options() {
112227
- return this.#options;
112228
- }
112229
- toRegExpSource(allowDot) {
112230
- const dot = allowDot ?? !!this.#options.dot;
112231
- if (this.#root === this) {
112232
- this.#flatten();
112233
- this.#fillNegs();
112234
- }
112235
- if (!isExtglobAST(this)) {
112236
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
112237
- const src = this.#parts.map((p) => {
112238
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
112239
- this.#hasMagic = this.#hasMagic || hasMagic;
112240
- this.#uflag = this.#uflag || uflag;
112241
- return re;
112242
- }).join("");
112243
- let start = "";
112244
- if (this.isStart()) {
112245
- if (typeof this.#parts[0] === "string") {
112246
- if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
112247
- const aps = addPatternStart;
112248
- const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
112249
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
112250
- start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
112251
- }
112252
- }
112253
- }
112254
- let end = "";
112255
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
112256
- return [
112257
- start + src + end,
112258
- (0, unescape_js_1.unescape)(src),
112259
- this.#hasMagic = !!this.#hasMagic,
112260
- this.#uflag
112261
- ];
112262
- }
112263
- const repeated = this.type === "*" || this.type === "+";
112264
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
112265
- let body = this.#partsToRegExp(dot);
112266
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
112267
- const s = this.toString();
112268
- const me = this;
112269
- me.#parts = [s];
112270
- me.type = null;
112271
- me.#hasMagic = void 0;
112272
- return [
112273
- s,
112274
- (0, unescape_js_1.unescape)(this.toString()),
112275
- false,
112276
- false
112277
- ];
112278
- }
112279
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
112280
- if (bodyDotAllowed === body) bodyDotAllowed = "";
112281
- if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
112282
- let final = "";
112283
- if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
112284
- else {
112285
- const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
112286
- final = start + body + close;
112287
- }
112288
- return [
112289
- final,
112290
- (0, unescape_js_1.unescape)(body),
112291
- this.#hasMagic = !!this.#hasMagic,
112292
- this.#uflag
112293
- ];
112294
- }
112295
- #flatten() {
112296
- if (!isExtglobAST(this)) {
112297
- for (const p of this.#parts) if (typeof p === "object") p.#flatten();
112298
- } else {
112299
- let iterations = 0;
112300
- let done = false;
112301
- do {
112302
- done = true;
112303
- for (let i = 0; i < this.#parts.length; i++) {
112304
- const c = this.#parts[i];
112305
- if (typeof c === "object") {
112306
- c.#flatten();
112307
- if (this.#canAdopt(c)) {
112308
- done = false;
112309
- this.#adopt(c, i);
112310
- } else if (this.#canAdoptWithSpace(c)) {
112311
- done = false;
112312
- this.#adoptWithSpace(c, i);
112313
- } else if (this.#canUsurp(c)) {
112314
- done = false;
112315
- this.#usurp(c);
112316
- }
112317
- }
112318
- }
112319
- } while (!done && ++iterations < 10);
112320
- }
112321
- this.#toString = void 0;
112322
- }
112323
- #partsToRegExp(dot) {
112324
- return this.#parts.map((p) => {
112325
- /* c8 ignore start */
112326
- if (typeof p === "string") throw new Error("string type in extglob ast??");
112327
- /* c8 ignore stop */
112328
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
112329
- this.#uflag = this.#uflag || uflag;
112330
- return re;
112331
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
112332
- }
112333
- static #parseGlob(glob, hasMagic, noEmpty = false) {
112334
- let escaping = false;
112335
- let re = "";
112336
- let uflag = false;
112337
- let inStar = false;
112338
- for (let i = 0; i < glob.length; i++) {
112339
- const c = glob.charAt(i);
112340
- if (escaping) {
112341
- escaping = false;
112342
- re += (reSpecials.has(c) ? "\\" : "") + c;
112343
- continue;
112344
- }
112345
- if (c === "*") {
112346
- if (inStar) continue;
112347
- inStar = true;
112348
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
112349
- hasMagic = true;
112350
- continue;
112351
- } else inStar = false;
112352
- if (c === "\\") {
112353
- if (i === glob.length - 1) re += "\\\\";
112354
- else escaping = true;
112355
- continue;
112356
- }
112357
- if (c === "[") {
112358
- const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
112359
- if (consumed) {
112360
- re += src;
112361
- uflag = uflag || needUflag;
112362
- i += consumed - 1;
112363
- hasMagic = hasMagic || magic;
112364
- continue;
112365
- }
112366
- }
112367
- if (c === "?") {
112368
- re += qmark;
112369
- hasMagic = true;
112370
- continue;
112371
- }
112372
- re += regExpEscape(c);
112373
- }
112374
- return [
112375
- re,
112376
- (0, unescape_js_1.unescape)(glob),
112377
- !!hasMagic,
112378
- uflag
112379
- ];
112380
- }
112381
- };
112382
- exports.AST = AST;
112383
- _a = AST;
112384
- }));
112385
- //#endregion
112386
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js
112387
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
112388
- Object.defineProperty(exports, "__esModule", { value: true });
112389
- exports.escape = void 0;
112390
- /**
112391
- * Escape all magic characters in a glob pattern.
112392
- *
112393
- * If the {@link MinimatchOptions.windowsPathsNoEscape}
112394
- * option is used, then characters are escaped by wrapping in `[]`, because
112395
- * a magic character wrapped in a character class can only be satisfied by
112396
- * that exact character. In this mode, `\` is _not_ escaped, because it is
112397
- * not interpreted as a magic character, but instead as a path separator.
112398
- *
112399
- * If the {@link MinimatchOptions.magicalBraces} option is used,
112400
- * then braces (`{` and `}`) will be escaped.
112401
- */
112402
- const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
112403
- if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
112404
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
112405
- };
112406
- exports.escape = escape;
112407
- }));
112408
- //#endregion
112409
112845
  //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/index.js
112410
112846
  var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112411
112847
  Object.defineProperty(exports, "__esModule", { value: true });
112412
- exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
112413
- const brace_expansion_1 = require_commonjs$5();
112848
+ exports.unescape = exports.escape = exports.Minimatch = exports.match = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
112849
+ const brace_expansion_1 = require_commonjs$6();
112850
+ const nonrecursive_glob_match_1 = require_commonjs$5();
112414
112851
  const assert_valid_pattern_js_1 = require_assert_valid_pattern();
112415
- const ast_js_1 = require_ast();
112416
112852
  const escape_js_1 = require_escape();
112417
112853
  const unescape_js_1 = require_unescape();
112418
112854
  const minimatch = (p, pattern, options = {}) => {
112419
112855
  (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
112420
112856
  if (!options.nocomment && pattern.charAt(0) === "#") return false;
112421
- return new Minimatch(pattern, options).match(p);
112857
+ return cachedMinimatch(pattern, options).match(p);
112422
112858
  };
112423
112859
  exports.minimatch = minimatch;
112424
- const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
112425
- const starDotExtTest = (ext) => (f) => !f.startsWith(".") && f.endsWith(ext);
112426
- const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
112427
- const starDotExtTestNocase = (ext) => {
112428
- ext = ext.toLowerCase();
112429
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext);
112430
- };
112431
- const starDotExtTestNocaseDot = (ext) => {
112432
- ext = ext.toLowerCase();
112433
- return (f) => f.toLowerCase().endsWith(ext);
112434
- };
112435
- const starDotStarRE = /^\*+\.\*+$/;
112436
- const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
112437
- const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
112438
- const dotStarRE = /^\.\*+$/;
112439
- const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
112440
- const starRE = /^\*+$/;
112441
- const starTest = (f) => f.length !== 0 && !f.startsWith(".");
112442
- const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
112443
- const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
112444
- const qmarksTestNocase = ([$0, ext = ""]) => {
112445
- const noext = qmarksTestNoExt([$0]);
112446
- if (!ext) return noext;
112447
- ext = ext.toLowerCase();
112448
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
112449
- };
112450
- const qmarksTestNocaseDot = ([$0, ext = ""]) => {
112451
- const noext = qmarksTestNoExtDot([$0]);
112452
- if (!ext) return noext;
112453
- ext = ext.toLowerCase();
112454
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
112455
- };
112456
- const qmarksTestDot = ([$0, ext = ""]) => {
112457
- const noext = qmarksTestNoExtDot([$0]);
112458
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
112459
- };
112460
- const qmarksTest = ([$0, ext = ""]) => {
112461
- const noext = qmarksTestNoExt([$0]);
112462
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
112463
- };
112464
- const qmarksTestNoExt = ([$0]) => {
112465
- const len = $0.length;
112466
- return (f) => f.length === len && !f.startsWith(".");
112467
- };
112468
- const qmarksTestNoExtDot = ([$0]) => {
112469
- const len = $0.length;
112470
- return (f) => f.length === len && f !== "." && f !== "..";
112860
+ const cache = /* @__PURE__ */ new Map();
112861
+ const cacheMax = 256;
112862
+ const cachedMinimatch = (pattern, options) => {
112863
+ const key = pattern + "\0" + JSON.stringify(options);
112864
+ let mm = cache.get(key);
112865
+ if (mm) cache.delete(key);
112866
+ else {
112867
+ mm = new Minimatch(pattern, { ...options });
112868
+ if (cache.size >= cacheMax) cache.delete(cache.keys().next().value);
112869
+ }
112870
+ cache.set(key, mm);
112871
+ return mm;
112471
112872
  };
112472
112873
  /* c8 ignore start */
112473
- const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
112874
+ const defaultPlatform = typeof process === "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
112474
112875
  const path = {
112475
112876
  win32: { sep: "\\" },
112476
112877
  posix: { sep: "/" }
@@ -112480,9 +112881,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112480
112881
  exports.minimatch.sep = exports.sep;
112481
112882
  exports.GLOBSTAR = Symbol("globstar **");
112482
112883
  exports.minimatch.GLOBSTAR = exports.GLOBSTAR;
112483
- const star = "[^/]*?";
112484
- const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
112485
- const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
112486
112884
  const filter = (pattern, options = {}) => (p) => (0, exports.minimatch)(p, pattern, options);
112487
112885
  exports.filter = filter;
112488
112886
  exports.minimatch.filter = exports.filter;
@@ -112500,21 +112898,10 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112500
112898
  return orig.defaults(ext(def, options)).Minimatch;
112501
112899
  }
112502
112900
  },
112503
- AST: class AST extends orig.AST {
112504
- /* c8 ignore start */
112505
- constructor(type, parent, options = {}) {
112506
- super(type, parent, ext(def, options));
112507
- }
112508
- /* c8 ignore stop */
112509
- static fromGlob(pattern, options = {}) {
112510
- return orig.AST.fromGlob(pattern, ext(def, options));
112511
- }
112512
- },
112513
112901
  unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
112514
112902
  escape: (s, options = {}) => orig.escape(s, ext(def, options)),
112515
112903
  filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
112516
112904
  defaults: (options) => orig.defaults(ext(def, options)),
112517
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
112518
112905
  braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
112519
112906
  match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
112520
112907
  sep: orig.sep,
@@ -112530,9 +112917,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112530
112917
  };
112531
112918
  exports.braceExpand = braceExpand;
112532
112919
  exports.minimatch.braceExpand = exports.braceExpand;
112533
- const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
112534
- exports.makeRe = makeRe;
112535
- exports.minimatch.makeRe = exports.makeRe;
112536
112920
  const match = (list, pattern, options = {}) => {
112537
112921
  const mm = new Minimatch(pattern, options);
112538
112922
  list = list.filter((f) => mm.match(f));
@@ -112542,7 +112926,98 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112542
112926
  exports.match = match;
112543
112927
  exports.minimatch.match = exports.match;
112544
112928
  const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
112545
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
112929
+ const classEnd = (pattern, start) => {
112930
+ let i = start + 1;
112931
+ if (pattern.charAt(i) === "!" || pattern.charAt(i) === "^") i++;
112932
+ let sawStart = false;
112933
+ for (; i < pattern.length; i++) {
112934
+ const c = pattern.charAt(i);
112935
+ if (c === "]" && sawStart) return i;
112936
+ sawStart = true;
112937
+ if (c === "\\") i++;
112938
+ }
112939
+ return -1;
112940
+ };
112941
+ const literal = (pattern, noext) => {
112942
+ if (!noext && (pattern === "+()" || pattern === "@()")) return pattern;
112943
+ let lit = "";
112944
+ for (let i = 0; i < pattern.length; i++) {
112945
+ const c = pattern.charAt(i);
112946
+ if (c === "\\") lit += pattern.charAt(++i) || c;
112947
+ else if (c === "*" || c === "?") return;
112948
+ else if (c === "[") {
112949
+ const close = classEnd(pattern, i);
112950
+ if (close === -1) {
112951
+ lit += c;
112952
+ continue;
112953
+ }
112954
+ let body = pattern.slice(i + 1, close);
112955
+ if (body.startsWith("\\")) body = body.slice(1);
112956
+ if ([...body].length !== 1 || "!^".includes(pattern.charAt(i + 1))) return;
112957
+ lit += body;
112958
+ i = close;
112959
+ } else if (!noext && "+@!".includes(c) && pattern.charAt(i + 1) === "(" && pattern.includes(")", i + 2)) return;
112960
+ else lit += c;
112961
+ }
112962
+ return lit;
112963
+ };
112964
+ const extSafe = (pattern) => {
112965
+ if (/^[?*+@]\(\)$/.test(pattern) || pattern.includes("[:")) return false;
112966
+ let depth = 0;
112967
+ for (let i = 0; i < pattern.length; i++) {
112968
+ const c = pattern.charAt(i);
112969
+ if (c === "\\") {
112970
+ if (++i === pattern.length) return false;
112971
+ } else if (c === "[") {
112972
+ const close = classEnd(pattern, i);
112973
+ if (close !== -1) i = close;
112974
+ } else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
112975
+ depth++;
112976
+ i++;
112977
+ } else if (c === ")") {
112978
+ if (!depth--) return false;
112979
+ } else if (c === "|" && !depth) return false;
112980
+ }
112981
+ return !depth;
112982
+ };
112983
+ let lastSplit;
112984
+ let lastChecked;
112985
+ const portionMatch = (p, f) => typeof p === "string" ? f === p : f !== "" && p.testUnchecked(f);
112986
+ const endIndex = (p, last, lastStart, prev, prevStart) => portionMatch(p, last) ? lastStart : prev !== void 0 && portionMatch(p, prev) ? prevStart : -1;
112987
+ const isDots = (p) => p === "." || p === "..";
112988
+ const isDrive = (p) => typeof p === "string" && /^[a-z]:$/i.test(p);
112989
+ const isLongUNC = (p) => typeof p === "string" && /^unc$/i.test(p);
112990
+ const uncHost = (p) => {
112991
+ if (p[0] !== "" || p[1] !== "") return -1;
112992
+ const h = p[2] !== "?" ? 2 : isLongUNC(p[3]) ? 4 : -1;
112993
+ const host = p[h];
112994
+ const share = p[h + 1];
112995
+ return h !== -1 && host !== void 0 && host !== "" && host !== exports.GLOBSTAR && share !== void 0 && share !== "" && share !== exports.GLOBSTAR ? h : -1;
112996
+ };
112997
+ const walkable = (p, dot) => !isDots(p) && (dot || !p.startsWith("."));
112998
+ const dotPortion = (f, start, end, dot, sep) => {
112999
+ for (let k = start; k < end;) {
113000
+ if (f.charCodeAt(k) === 46) {
113001
+ if (!dot) return true;
113002
+ const n = f.charCodeAt(k + 1) === 46 ? k + 2 : k + 1;
113003
+ if (n >= end || isSep(f.charCodeAt(n), sep)) return true;
113004
+ }
113005
+ const s = nextSep(f, k, sep);
113006
+ if (s === -1) return false;
113007
+ k = s + 1;
113008
+ while (k < end && isSep(f.charCodeAt(k), sep)) k++;
113009
+ }
113010
+ return false;
113011
+ };
113012
+ const isSep = (c, sep) => sep === "/" ? c === 47 : sep === "\\" ? c === 92 : c === 47 || c === 92;
113013
+ const nextSep = (f, from, sep) => {
113014
+ if (sep !== "both") return f.indexOf(sep, from);
113015
+ const s = f.indexOf("/", from);
113016
+ const b = f.indexOf("\\", from);
113017
+ return s === -1 ? b : b === -1 ? s : Math.min(s, b);
113018
+ };
113019
+ const lastSep = (f, from, sep) => sep !== "both" ? f.lastIndexOf(sep, from) : Math.max(f.lastIndexOf("/", from), f.lastIndexOf("\\", from));
113020
+ const PENDING = {};
112546
113021
  var Minimatch = class {
112547
113022
  options;
112548
113023
  set;
@@ -112561,7 +113036,16 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112561
113036
  platform;
112562
113037
  windowsNoMagicRoot;
112563
113038
  maxGlobstarRecursion;
112564
- regexp;
113039
+ #endCheck;
113040
+ #literalCheck;
113041
+ #level2;
113042
+ #form;
113043
+ #literals = [];
113044
+ #shapes = [];
113045
+ #endRows = [];
113046
+ #matchers = /* @__PURE__ */ new Map();
113047
+ #pending = false;
113048
+ #globstarParts = /* @__PURE__ */ new WeakMap();
112565
113049
  constructor(pattern, options = {}) {
112566
113050
  (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
112567
113051
  options = options || {};
@@ -112573,7 +113057,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112573
113057
  this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options["allowWindowsEscape"] === false;
112574
113058
  if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
112575
113059
  this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
112576
- this.regexp = null;
112577
113060
  this.negate = false;
112578
113061
  this.nonegate = !!options.nonegate;
112579
113062
  this.comment = false;
@@ -112584,14 +113067,45 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112584
113067
  this.globSet = [];
112585
113068
  this.globParts = [];
112586
113069
  this.set = [];
113070
+ this.#endCheck = !this.preserveMultipleSlashes;
113071
+ this.#level2 = (options.optimizationLevel ?? 1) >= 2;
113072
+ const n = options.normalize;
113073
+ this.#form = n === true ? "NFC" : n || void 0;
112587
113074
  this.make();
113075
+ const drives = this.set.map((row) => this.#rootIndex(row));
113076
+ this.#endRows = this.set.map((row, r) => this.#endCheck && row.length - 1 > drives[r]);
113077
+ this.#literals = this.set.map((row, r) => {
113078
+ const end = this.#endRows[r] ? row.length - 1 : row.length;
113079
+ const lits = row.slice(drives[r] + 1, end).filter((p) => typeof p === "string" && !!p);
113080
+ return [...new Set(lits)];
113081
+ });
113082
+ this.#literalCheck = this.#literals.some((l) => l.length);
113083
+ this.#shapes = this.set.map((row, r) => {
113084
+ const [p0, p1, p2] = row;
113085
+ if (this.#endRows[r] && row.length === 2) {
113086
+ if (p0 === exports.GLOBSTAR && p1 !== exports.GLOBSTAR) return "tail";
113087
+ }
113088
+ if (this.#endRows[r] && options.matchBase && row.length === 1 && p0 !== exports.GLOBSTAR && p0 !== "") return "base";
113089
+ if (!this.#endCheck || drives[r] !== -1) return void 0;
113090
+ if (row.length === 3 && p0 === exports.GLOBSTAR && p2 === exports.GLOBSTAR && p1 !== exports.GLOBSTAR && p1 !== "" && this.maxGlobstarRecursion > 0) return "mid";
113091
+ if (row.length === 2 && p1 === exports.GLOBSTAR && p0 !== exports.GLOBSTAR && p0 !== "") return "head";
113092
+ });
113093
+ }
113094
+ #norm(p) {
113095
+ return this.#form ? p.normalize(this.#form) : p;
113096
+ }
113097
+ #rootIndex(row) {
113098
+ if (!this.isWindows) return -1;
113099
+ if (isDrive(row[0])) return 0;
113100
+ if (row[0] === "" && row[1] === "" && row[2] === "?" && isDrive(row[3])) return 3;
113101
+ const h = uncHost(row);
113102
+ return h === -1 ? -1 : h + 1;
112588
113103
  }
112589
113104
  hasMagic() {
112590
113105
  if (this.options.magicalBraces && this.set.length > 1) return true;
112591
113106
  for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
112592
113107
  return false;
112593
113108
  }
112594
- debug(..._) {}
112595
113109
  make() {
112596
113110
  const pattern = this.pattern;
112597
113111
  const options = this.options;
@@ -112605,27 +113119,64 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112605
113119
  }
112606
113120
  this.parseNegate();
112607
113121
  this.globSet = [...new Set(this.braceExpand())];
112608
- if (options.debug) this.debug = (...args) => console.error(...args);
112609
- this.debug(this.pattern, this.globSet);
112610
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
113122
+ const rawGlobParts = this.globSet.map((s) => this.#slashSplit(s));
112611
113123
  this.globParts = this.preprocess(rawGlobParts);
112612
- this.debug(this.pattern, this.globParts);
112613
- let set = this.globParts.map((s, _, __) => {
113124
+ this.#pending = true;
113125
+ this.set = this.globParts.map((s, _, __) => {
112614
113126
  if (this.isWindows && this.windowsNoMagicRoot) {
112615
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
113127
+ const n = s[2] === "?" && isLongUNC(s[3]) ? 6 : 4;
113128
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && s.slice(3, n).every((p) => !globMagic.test(p));
112616
113129
  const isDrive = /^[a-z]:/i.test(s[0]);
112617
- if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
112618
- else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
113130
+ if (isUNC) return [...s.slice(0, n).map((p) => this.#norm(p)), ...s.slice(n).map((ss) => this.parse(ss))];
113131
+ else if (isDrive) return [this.#norm(s[0]), ...s.slice(1).map((ss) => this.parse(ss))];
112619
113132
  }
112620
113133
  return s.map((ss) => this.parse(ss));
112621
- });
112622
- this.debug(this.pattern, set);
112623
- this.set = set.filter((s) => s.indexOf(false) === -1);
113134
+ }).filter((s) => s.indexOf(false) === -1);
112624
113135
  if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
112625
113136
  const p = this.set[i];
112626
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
113137
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && (isDrive(p[3]) || isLongUNC(this.globParts[i][3]))) {
113138
+ if (isLongUNC(this.globParts[i][3])) p[3] = "UNC";
113139
+ p[2] = "?";
113140
+ }
113141
+ }
113142
+ if (!options.noext) this.mergeRows();
113143
+ this.#pending = false;
113144
+ this.set.forEach((row, i) => {
113145
+ for (let k = 0; k < row.length; k++) if (row[k] === PENDING) row[k] = this.parse(this.globParts[i][k]);
113146
+ });
113147
+ }
113148
+ mergeRows() {
113149
+ let merged = true;
113150
+ while (merged) {
113151
+ merged = false;
113152
+ const len = Math.max(0, ...this.set.map((r) => r.length));
113153
+ for (let k = 0; k < len; k++) {
113154
+ const groups = /* @__PURE__ */ new Map();
113155
+ this.set.forEach((row, i) => {
113156
+ if (!(row[k] instanceof nonrecursive_glob_match_1.Matcher || row[k] === PENDING) || !extSafe(this.globParts[i][k])) return;
113157
+ const parts = [...this.globParts[i]];
113158
+ parts[k] = "";
113159
+ const key = `${row.length}/${parts.join("/")}`;
113160
+ const g = groups.get(key);
113161
+ if (g) g.push(i);
113162
+ else groups.set(key, [i]);
113163
+ });
113164
+ const drop = /* @__PURE__ */ new Set();
113165
+ for (const g of groups.values()) {
113166
+ if (g.length < 2) continue;
113167
+ const [first, ...rest] = g;
113168
+ const glob = `@(${g.map((i) => this.globParts[i][k]).join("|")})`;
113169
+ this.globParts[first][k] = glob;
113170
+ this.set[first][k] = this.parse(glob);
113171
+ for (const i of rest) drop.add(i);
113172
+ }
113173
+ if (drop.size) {
113174
+ merged = true;
113175
+ this.set = this.set.filter((_, i) => !drop.has(i));
113176
+ this.globParts = this.globParts.filter((_, i) => !drop.has(i));
113177
+ }
113178
+ }
112627
113179
  }
112628
- this.debug(this.pattern, this.set);
112629
113180
  }
112630
113181
  preprocess(globParts) {
112631
113182
  if (this.options.noglobstar) {
@@ -112652,11 +113203,12 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112652
113203
  }
112653
113204
  levelOneOptimize(globParts) {
112654
113205
  return globParts.map((parts) => {
113206
+ const root = this.#rootIndex(parts) + 1;
112655
113207
  parts = parts.reduce((set, part) => {
112656
113208
  const prev = set[set.length - 1];
112657
113209
  if (part === "**" && prev === "**") return set;
112658
113210
  if (part === "..") {
112659
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
113211
+ if (set.length > root && prev && prev !== ".." && prev !== "." && prev !== "**") {
112660
113212
  set.pop();
112661
113213
  return set;
112662
113214
  }
@@ -112667,8 +113219,120 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112667
113219
  return parts.length === 0 ? [""] : parts;
112668
113220
  });
112669
113221
  }
112670
- levelTwoFileOptimize(parts) {
112671
- if (!Array.isArray(parts)) parts = this.slashSplit(parts);
113222
+ #canMatch(f) {
113223
+ const sep = !this.isWindows || !f.includes("\\") ? "/" : f.includes("/") ? "both" : "\\";
113224
+ let ends = this.#endCheck ? 0 : -1;
113225
+ let last = "";
113226
+ let lastStart = 0;
113227
+ let prev;
113228
+ let prevStart = 0;
113229
+ const dot = !!this.options.dot;
113230
+ ROWS: for (let r = 0; r < this.set.length; r++) {
113231
+ const row = this.set[r];
113232
+ const p = row[row.length - 1];
113233
+ let end = ends !== -1 && this.#endRows[r] && p !== exports.GLOBSTAR;
113234
+ if (end && ends === 0) {
113235
+ const i = lastSep(f, f.length, sep);
113236
+ lastStart = i + 1;
113237
+ last = f.slice(lastStart);
113238
+ if (last === "" && i >= 0) {
113239
+ let j = i;
113240
+ while (j > 0 && isSep(f.charCodeAt(j - 1), sep)) j--;
113241
+ prevStart = j === 0 ? 0 : lastSep(f, j - 1, sep) + 1;
113242
+ prev = f.slice(prevStart, j);
113243
+ }
113244
+ const resolves = this.#level2 && (isDots(last) || last === "" && prev !== void 0 && isDots(prev));
113245
+ ends = resolves ? -1 : 1;
113246
+ end = !resolves;
113247
+ }
113248
+ let tailStart = -1;
113249
+ if (end && typeof p === "string") {
113250
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
113251
+ if (tailStart === -1) continue;
113252
+ }
113253
+ if (this.#literalCheck) {
113254
+ for (const l of this.#literals[r]) if (!f.includes(l)) continue ROWS;
113255
+ }
113256
+ if (end && typeof p === "object") {
113257
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
113258
+ if (tailStart === -1) continue;
113259
+ }
113260
+ const shape = this.#shapes[r];
113261
+ if (shape === "base" && end) return "yes";
113262
+ if (shape === "tail" && end) {
113263
+ if (this.#level2 && dotPortion(f, 0, tailStart, true, sep)) return "maybe";
113264
+ if (!dotPortion(f, 0, tailStart, dot, sep)) return "yes";
113265
+ continue;
113266
+ }
113267
+ if (shape === "mid" || shape === "head") {
113268
+ const m = this.#walk(f, row, shape === "head", dot, sep);
113269
+ if (m !== "no") return m;
113270
+ continue;
113271
+ }
113272
+ return "maybe";
113273
+ }
113274
+ return "no";
113275
+ }
113276
+ #matchShape(file, row, shape) {
113277
+ const dot = !!this.options.dot;
113278
+ const n = file.length;
113279
+ if (shape === "head") {
113280
+ if (n < 2 || !portionMatch(row[0], file[0])) return false;
113281
+ for (let i = 1; i < n; i++) if (!walkable(file[i], dot)) return false;
113282
+ return true;
113283
+ }
113284
+ const x = row[1];
113285
+ if (shape === "tail") {
113286
+ let t = n - 1;
113287
+ if (!portionMatch(x, file[t])) {
113288
+ if (file[t] !== "" || n === 1 || !portionMatch(x, file[--t])) return false;
113289
+ }
113290
+ for (let i = 0; i < t; i++) if (!walkable(file[i], dot)) return false;
113291
+ return true;
113292
+ }
113293
+ for (let k = 0; k < n; k++) {
113294
+ if (portionMatch(x, file[k]) && k + 1 < n) {
113295
+ let i = k + 1;
113296
+ while (i < n && walkable(file[i], dot)) i++;
113297
+ if (i === n) return true;
113298
+ }
113299
+ if (!walkable(file[k], dot)) return false;
113300
+ }
113301
+ return false;
113302
+ }
113303
+ #walk(f, row, head, dot, sep) {
113304
+ if (this.#level2 && dotPortion(f, 0, f.length, true, sep)) return "maybe";
113305
+ const x = row[head ? 0 : 1];
113306
+ let s = 0;
113307
+ for (let e = nextSep(f, s, sep); e !== -1; e = nextSep(f, s, sep)) {
113308
+ let next = e + 1;
113309
+ while (next < f.length && isSep(f.charCodeAt(next), sep)) next++;
113310
+ if ((typeof x === "string" ? e - s === x.length && f.startsWith(x, s) : e > s && x.testUnchecked(f.slice(s, e))) && !dotPortion(f, next, f.length, dot, sep)) return "yes";
113311
+ if (head || dotPortion(f, s, next, dot, sep)) return "no";
113312
+ s = next;
113313
+ }
113314
+ return "no";
113315
+ }
113316
+ #cachedSplit(f) {
113317
+ const last = lastSplit;
113318
+ return last?.f === f && last.isWindows === this.isWindows && last.preserveMultipleSlashes === this.preserveMultipleSlashes && last.normalize === this.#form ? last : void 0;
113319
+ }
113320
+ #split(f) {
113321
+ const { isWindows, preserveMultipleSlashes } = this;
113322
+ let parts = this.#slashSplit(isWindows ? f.split("\\").join("/") : f);
113323
+ const normalize = this.#form;
113324
+ if (normalize) parts = parts.map((p) => p.normalize(normalize));
113325
+ lastSplit = {
113326
+ f,
113327
+ isWindows,
113328
+ preserveMultipleSlashes,
113329
+ normalize,
113330
+ parts
113331
+ };
113332
+ return lastSplit;
113333
+ }
113334
+ #levelTwoFileOptimize(file) {
113335
+ const parts = [...file];
112672
113336
  let didSomething = false;
112673
113337
  do {
112674
113338
  didSomething = false;
@@ -112687,19 +113351,21 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112687
113351
  parts.pop();
112688
113352
  }
112689
113353
  }
112690
- let dd = 0;
113354
+ const root = this.#rootIndex(parts) + 1;
113355
+ let dd = root;
112691
113356
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
112692
113357
  const p = parts[dd - 1];
112693
- if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
113358
+ if (p && p !== "." && p !== ".." && p !== "**") {
112694
113359
  didSomething = true;
112695
113360
  parts.splice(dd - 1, 2);
112696
- dd -= 2;
113361
+ dd = Math.max(dd - 2, root);
112697
113362
  }
112698
113363
  }
112699
113364
  } while (didSomething);
112700
113365
  return parts.length === 0 ? [""] : parts;
112701
113366
  }
112702
113367
  firstPhasePreProcess(globParts) {
113368
+ const { braceExpandMax = 1e5 } = this.options;
112703
113369
  let didSomething = false;
112704
113370
  do {
112705
113371
  didSomething = false;
@@ -112713,7 +113379,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112713
113379
  const p = parts[gs + 2];
112714
113380
  const p2 = parts[gs + 3];
112715
113381
  if (next !== "..") continue;
112716
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
113382
+ if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === ".." || globParts.length >= braceExpandMax) continue;
112717
113383
  didSomething = true;
112718
113384
  parts.splice(gs, 1);
112719
113385
  const other = parts.slice(0);
@@ -112736,7 +113402,8 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112736
113402
  parts.pop();
112737
113403
  }
112738
113404
  }
112739
- let dd = 0;
113405
+ const root = this.#rootIndex(parts) + 1;
113406
+ let dd = root;
112740
113407
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
112741
113408
  const p = parts[dd - 1];
112742
113409
  if (p && p !== "." && p !== ".." && p !== "**") {
@@ -112744,7 +113411,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112744
113411
  const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
112745
113412
  parts.splice(dd - 1, 2, ...splin);
112746
113413
  if (parts.length === 0) parts.push("");
112747
- dd -= 2;
113414
+ dd = Math.max(dd - 2, root);
112748
113415
  }
112749
113416
  }
112750
113417
  }
@@ -112752,6 +113419,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112752
113419
  return globParts;
112753
113420
  }
112754
113421
  secondPhasePreProcess(globParts) {
113422
+ if (globParts.length > 1e3) return globParts;
112755
113423
  for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
112756
113424
  const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
112757
113425
  if (matched) {
@@ -112804,10 +113472,22 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112804
113472
  if (negateOffset) this.pattern = pattern.slice(negateOffset);
112805
113473
  this.negate = negate;
112806
113474
  }
112807
- matchOne(file, pattern, partial = false) {
113475
+ #matchRow(file, resolved, pattern, partial) {
112808
113476
  let fileStartIndex = 0;
112809
113477
  let patternStartIndex = 0;
112810
- if (this.isWindows) {
113478
+ const fh = this.isWindows ? uncHost(resolved) : -1;
113479
+ const ph = fh === -1 ? -1 : uncHost(pattern);
113480
+ if (ph !== -1) {
113481
+ const host = pattern[ph];
113482
+ const share = pattern[ph + 1];
113483
+ if (typeof host !== "string" || typeof share !== "string") {
113484
+ fileStartIndex = fh;
113485
+ patternStartIndex = ph;
113486
+ } else if (resolved[fh].toLowerCase() === host.toLowerCase() && resolved[fh + 1].toLowerCase() === share.toLowerCase()) {
113487
+ fileStartIndex = fh + 2;
113488
+ patternStartIndex = ph + 2;
113489
+ }
113490
+ } else if (this.isWindows) {
112811
113491
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
112812
113492
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
112813
113493
  const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
@@ -112817,32 +113497,20 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112817
113497
  if (typeof fdi === "number" && typeof pdi === "number") {
112818
113498
  const [fd, pd] = [file[fdi], pattern[pdi]];
112819
113499
  if (fd.toLowerCase() === pd.toLowerCase()) {
112820
- pattern[pdi] = fd;
112821
- patternStartIndex = pdi;
112822
- fileStartIndex = fdi;
113500
+ patternStartIndex = pdi + 1;
113501
+ fileStartIndex = fdi + 1;
112823
113502
  }
112824
113503
  }
112825
113504
  }
112826
- const { optimizationLevel = 1 } = this.options;
112827
- if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
113505
+ file = resolved;
112828
113506
  if (pattern.includes(exports.GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
112829
113507
  return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
112830
113508
  }
112831
113509
  #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
112832
- const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
112833
- const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
112834
- const [head, body, tail] = partial ? [
112835
- pattern.slice(patternIndex, firstgs),
112836
- pattern.slice(firstgs + 1),
112837
- []
112838
- ] : [
112839
- pattern.slice(patternIndex, firstgs),
112840
- pattern.slice(firstgs + 1, lastgs),
112841
- pattern.slice(lastgs + 1)
112842
- ];
113510
+ const { head, body, tail, segments } = this.#getGlobstarParts(pattern, partial, patternIndex);
112843
113511
  if (head.length) {
112844
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
112845
- if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
113512
+ const headEnd = fileIndex + head.length;
113513
+ if (!this.#matchOne(file, head, partial, fileIndex, 0, headEnd)) return false;
112846
113514
  fileIndex += head.length;
112847
113515
  patternIndex += head.length;
112848
113516
  }
@@ -112867,67 +113535,86 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112867
113535
  }
112868
113536
  return partial || sawSome;
112869
113537
  }
112870
- const bodySegments = [[[], 0]];
112871
- let currentBody = bodySegments[0];
113538
+ return !!this.#matchGlobStarBodySections(file, segments, file.length - fileTailMatch, fileIndex, 0, partial, 0, !!fileTailMatch, /* @__PURE__ */ new Set());
113539
+ }
113540
+ #getGlobstarParts(pattern, partial, patternIndex) {
113541
+ let byStart = this.#globstarParts.get(pattern);
113542
+ if (!byStart) {
113543
+ byStart = [];
113544
+ this.#globstarParts.set(pattern, byStart);
113545
+ }
113546
+ const key = patternIndex * 2 + (partial ? 1 : 0);
113547
+ const found = byStart[key];
113548
+ if (found) return found;
113549
+ const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
113550
+ const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
113551
+ const head = pattern.slice(patternIndex, firstgs);
113552
+ const body = pattern.slice(firstgs + 1, partial ? void 0 : lastgs);
113553
+ const tail = partial ? [] : pattern.slice(lastgs + 1);
113554
+ const segments = [[[], 0]];
113555
+ let current = segments[0];
112872
113556
  let nonGsParts = 0;
112873
113557
  const nonGsPartsSums = [0];
112874
113558
  for (const b of body) if (b === exports.GLOBSTAR) {
112875
113559
  nonGsPartsSums.push(nonGsParts);
112876
- currentBody = [[], 0];
112877
- bodySegments.push(currentBody);
113560
+ current = [[], 0];
113561
+ segments.push(current);
112878
113562
  } else {
112879
- currentBody[0].push(b);
113563
+ current[0].push(b);
112880
113564
  nonGsParts++;
112881
113565
  }
112882
- let i = bodySegments.length - 1;
112883
- const fileLength = file.length - fileTailMatch;
112884
- for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
112885
- return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
113566
+ segments.forEach((b, i) => {
113567
+ b[1] = nonGsParts - nonGsPartsSums[i];
113568
+ });
113569
+ const parts = {
113570
+ head,
113571
+ body,
113572
+ tail,
113573
+ segments
113574
+ };
113575
+ byStart[key] = parts;
113576
+ return parts;
112886
113577
  }
112887
- #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
113578
+ #matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex, bodyIndex, partial, globStarDepth, sawTail, tried) {
112888
113579
  const bs = bodySegments[bodyIndex];
112889
113580
  if (!bs) {
112890
- for (let i = fileIndex; i < file.length; i++) {
113581
+ if (partial) return fileIndex >= fileLength || fileIndex === fileLength - 1 && file[fileIndex] === "";
113582
+ for (let i = fileIndex; i < fileLength; i++) {
112891
113583
  sawTail = true;
112892
113584
  const f = file[i];
112893
113585
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
112894
113586
  }
112895
113587
  return sawTail;
112896
113588
  }
112897
- const [body, after] = bs;
113589
+ const [body, need] = bs;
113590
+ const after = partial ? fileLength : fileLength - need;
112898
113591
  while (fileIndex <= after) {
112899
- if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
112900
- const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
113592
+ const key = bodyIndex * (file.length + 1) + fileIndex;
113593
+ if (tried.has(key)) return false;
113594
+ tried.add(key);
113595
+ if (this.#matchOne(file, body, partial, fileIndex, 0, fileIndex + body.length) && globStarDepth < this.maxGlobstarRecursion) {
113596
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail, tried);
112901
113597
  if (sub !== false) return sub;
112902
113598
  }
113599
+ if (fileIndex === after) break;
112903
113600
  const f = file[fileIndex];
112904
113601
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
112905
113602
  fileIndex++;
112906
113603
  }
112907
113604
  return partial || null;
112908
113605
  }
112909
- #matchOne(file, pattern, partial, fileIndex, patternIndex) {
113606
+ #matchOne(file, pattern, partial, fileIndex, patternIndex, fileEnd = file.length) {
112910
113607
  let fi;
112911
113608
  let pi;
112912
113609
  let pl;
112913
113610
  let fl;
112914
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
112915
- this.debug("matchOne loop");
113611
+ for (fi = fileIndex, pi = patternIndex, fl = Math.min(fileEnd, file.length), pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
112916
113612
  let p = pattern[pi];
112917
113613
  let f = file[fi];
112918
- this.debug(pattern, p, f);
112919
113614
  /* c8 ignore start */
112920
113615
  if (p === false || p === exports.GLOBSTAR) return false;
112921
113616
  /* c8 ignore stop */
112922
- let hit;
112923
- if (typeof p === "string") {
112924
- hit = f === p;
112925
- this.debug("string match", p, f, hit);
112926
- } else {
112927
- hit = p.test(f);
112928
- this.debug("pattern match", p, f, hit);
112929
- }
112930
- if (!hit) return false;
113617
+ if (!portionMatch(p, f)) return false;
112931
113618
  }
112932
113619
  if (fi === fl && pi === pl) return true;
112933
113620
  else if (fi === fl) return partial;
@@ -112943,86 +113630,51 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
112943
113630
  const options = this.options;
112944
113631
  if (pattern === "**") return exports.GLOBSTAR;
112945
113632
  if (pattern === "") return "";
112946
- let m;
112947
- let fastTest = null;
112948
- if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
112949
- else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
112950
- else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
112951
- else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
112952
- else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
112953
- const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
112954
- if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
112955
- return re;
112956
- }
112957
- makeRe() {
112958
- if (this.regexp || this.regexp === false) return this.regexp;
112959
- const set = this.set;
112960
- if (!set.length) {
112961
- this.regexp = false;
112962
- return this.regexp;
112963
- }
112964
- const options = this.options;
112965
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
112966
- const flags = new Set(options.nocase ? ["i"] : []);
112967
- let re = set.map((pattern) => {
112968
- const pp = pattern.map((p) => {
112969
- if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
112970
- return typeof p === "string" ? regExpEscape(p) : p === exports.GLOBSTAR ? exports.GLOBSTAR : p._src;
112971
- });
112972
- pp.forEach((p, i) => {
112973
- const next = pp[i + 1];
112974
- const prev = pp[i - 1];
112975
- if (p !== exports.GLOBSTAR || prev === exports.GLOBSTAR) return;
112976
- if (prev === void 0) if (next !== void 0 && next !== exports.GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
112977
- else pp[i] = twoStar;
112978
- else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
112979
- else if (next !== exports.GLOBSTAR) {
112980
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
112981
- pp[i + 1] = exports.GLOBSTAR;
112982
- }
113633
+ const { nocase, nocaseMagicOnly, noext = false, dot, normalize } = options;
113634
+ const lit = literal(pattern, noext);
113635
+ if (lit !== void 0 && !(nocase && !nocaseMagicOnly && pattern.toUpperCase() !== pattern.toLowerCase())) return this.#norm(lit);
113636
+ if (this.#pending) return PENDING;
113637
+ let m = this.#matchers.get(pattern);
113638
+ if (!m) {
113639
+ m = new nonrecursive_glob_match_1.Matcher(pattern, {
113640
+ nocase,
113641
+ noext,
113642
+ dot,
113643
+ normalize
112983
113644
  });
112984
- const filtered = pp.filter((p) => p !== exports.GLOBSTAR);
112985
- if (this.partial && filtered.length >= 1) {
112986
- const prefixes = [];
112987
- for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
112988
- return "(?:" + prefixes.join("|") + ")";
112989
- }
112990
- return filtered.join("/");
112991
- }).join("|");
112992
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
112993
- re = "^" + open + re + close + "$";
112994
- if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
112995
- if (this.negate) re = "^(?!" + re + ").+$";
112996
- try {
112997
- this.regexp = new RegExp(re, [...flags].join(""));
112998
- } catch {
112999
- this.regexp = false;
113645
+ this.#matchers.set(pattern, m);
113000
113646
  }
113001
- /* c8 ignore stop */
113002
- return this.regexp;
113647
+ return m;
113003
113648
  }
113004
- slashSplit(p) {
113649
+ #slashSplit(p) {
113005
113650
  if (this.preserveMultipleSlashes) return p.split("/");
113006
113651
  else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
113007
113652
  else return p.split(/\/+/);
113008
113653
  }
113009
113654
  match(f, partial = this.partial) {
113010
- this.debug("match", f, this.pattern);
113011
113655
  if (this.comment) return false;
113012
113656
  if (this.empty) return f === "";
113013
113657
  if (f === "/" && partial) return true;
113014
113658
  const options = this.options;
113015
- if (this.isWindows) f = f.split("\\").join("/");
113016
- const ff = this.slashSplit(f);
113017
- this.debug(this.pattern, "split", ff);
113659
+ let split = this.#cachedSplit(f);
113660
+ if (!split) {
113661
+ if (!partial && !this.#form && (this.#endCheck || this.#literalCheck) && lastChecked !== f) {
113662
+ lastChecked = f;
113663
+ const can = this.#canMatch(f);
113664
+ if (can === "no") return options.flipNegate ? false : this.negate;
113665
+ if (can === "yes") return options.flipNegate ? true : !this.negate;
113666
+ }
113667
+ split = this.#split(f);
113668
+ }
113669
+ const ff = split.parts;
113670
+ const resolved = this.#level2 ? split.resolved ??= this.#levelTwoFileOptimize(ff) : ff;
113018
113671
  const set = this.set;
113019
- this.debug(this.pattern, "set", set);
113020
113672
  let filename = ff[ff.length - 1];
113021
113673
  if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
113022
- for (const pattern of set) {
113023
- let file = ff;
113024
- if (options.matchBase && pattern.length === 1) file = [filename];
113025
- if (this.matchOne(file, pattern, partial)) {
113674
+ for (let r = 0; r < set.length; r++) {
113675
+ const pattern = set[r];
113676
+ const shape = partial ? void 0 : this.#shapes[r];
113677
+ if (shape === "base" ? portionMatch(pattern[0], filename) : shape ? this.#matchShape(resolved, pattern, shape) : options.matchBase && pattern.length === 1 ? this.#matchRow([filename], [filename], pattern, partial) : this.#matchRow(ff, resolved, pattern, partial)) {
113026
113678
  if (options.flipNegate) return true;
113027
113679
  return !this.negate;
113028
113680
  }
@@ -113036,13 +113688,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
113036
113688
  };
113037
113689
  exports.Minimatch = Minimatch;
113038
113690
  /* c8 ignore start */
113039
- var ast_js_2 = require_ast();
113040
- Object.defineProperty(exports, "AST", {
113041
- enumerable: true,
113042
- get: function() {
113043
- return ast_js_2.AST;
113044
- }
113045
- });
113046
113691
  var escape_js_2 = require_escape();
113047
113692
  Object.defineProperty(exports, "escape", {
113048
113693
  enumerable: true,
@@ -113058,7 +113703,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
113058
113703
  }
113059
113704
  });
113060
113705
  /* c8 ignore stop */
113061
- exports.minimatch.AST = ast_js_1.AST;
113062
113706
  exports.minimatch.Minimatch = Minimatch;
113063
113707
  exports.minimatch.escape = escape_js_1.escape;
113064
113708
  exports.minimatch.unescape = unescape_js_1.unescape;
@@ -115087,7 +115731,7 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
115087
115731
  exports.Minipass = Minipass;
115088
115732
  }));
115089
115733
  //#endregion
115090
- //#region ../../node_modules/path-scurry/dist/commonjs/index.js
115734
+ //#region ../../node_modules/glob/node_modules/path-scurry/dist/commonjs/index.js
115091
115735
  var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
115092
115736
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
115093
115737
  if (k2 === void 0) k2 = k;
@@ -115111,15 +115755,25 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
115111
115755
  }) : function(o, v) {
115112
115756
  o["default"] = v;
115113
115757
  });
115114
- var __importStar = exports && exports.__importStar || function(mod) {
115115
- if (mod && mod.__esModule) return mod;
115116
- var result = {};
115117
- if (mod != null) {
115118
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
115119
- }
115120
- __setModuleDefault(result, mod);
115121
- return result;
115122
- };
115758
+ var __importStar = exports && exports.__importStar || (function() {
115759
+ var ownKeys = function(o) {
115760
+ ownKeys = Object.getOwnPropertyNames || function(o) {
115761
+ var ar = [];
115762
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
115763
+ return ar;
115764
+ };
115765
+ return ownKeys(o);
115766
+ };
115767
+ return function(mod) {
115768
+ if (mod && mod.__esModule) return mod;
115769
+ var result = {};
115770
+ if (mod != null) {
115771
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
115772
+ }
115773
+ __setModuleDefault(result, mod);
115774
+ return result;
115775
+ };
115776
+ })();
115123
115777
  Object.defineProperty(exports, "__esModule", { value: true });
115124
115778
  exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0;
115125
115779
  const lru_cache_1 = require_commonjs$3();
@@ -115148,12 +115802,17 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
115148
115802
  ...fsOption,
115149
115803
  promises: {
115150
115804
  ...defaultFS.promises,
115151
- ...fsOption.promises || {}
115805
+ ...fsOption.promises
115152
115806
  }
115153
115807
  };
115154
115808
  const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
115155
- const uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\");
115156
- const eitherSep = /[\\\/]/;
115809
+ const uncLongRegexp = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i;
115810
+ const uncShareRegexp = /^\\\\[^\\?]+\\[^\\]+$/;
115811
+ const uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\").replace(uncLongRegexp, "\\\\$1\\").replace(uncShareRegexp, "$&\\");
115812
+ const longUncRoot = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i;
115813
+ const longDrivePrefix = /^[\\/]{2}\?[\\/](?=[a-z]:)/i;
115814
+ const longUncPrefix = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i;
115815
+ const eitherSep = /[\\/]/;
115157
115816
  const UNKNOWN = 0;
115158
115817
  const IFIFO = 1;
115159
115818
  const IFCHR = 2;
@@ -115390,6 +116049,15 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
115390
116049
  else this.#fs = fsFromOption(opts.fs);
115391
116050
  }
115392
116051
  /**
116052
+ * The file system methods that this Path uses, for a new root on
116053
+ * another drive or UNC share.
116054
+ *
116055
+ * @internal
116056
+ */
116057
+ get fs() {
116058
+ return this.#fs;
116059
+ }
116060
+ /**
115393
116061
  * Returns the depth of the Path object from its root.
115394
116062
  *
115395
116063
  * For example, a path at `/foo/bar` would have a depth of 2.
@@ -115979,7 +116647,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
115979
116647
  try {
115980
116648
  const rp = await this.#fs.promises.realpath(this.fullpath());
115981
116649
  return this.#realpath = this.resolve(rp);
115982
- } catch (_) {
116650
+ } catch {
115983
116651
  this.#markENOREALPATH();
115984
116652
  }
115985
116653
  }
@@ -115992,7 +116660,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
115992
116660
  try {
115993
116661
  const rp = this.#fs.realpathSync(this.fullpath());
115994
116662
  return this.#realpath = this.resolve(rp);
115995
- } catch (_) {
116663
+ } catch {
115996
116664
  this.#markENOREALPATH();
115997
116665
  }
115998
116666
  }
@@ -116059,23 +116727,25 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
116059
116727
  * @internal
116060
116728
  */
116061
116729
  getRootString(path) {
116062
- return node_path_1.win32.parse(path).root;
116730
+ return longUncRoot.exec(path)?.[0] ?? node_path_1.win32.parse(path).root;
116063
116731
  }
116064
116732
  /**
116065
116733
  * @internal
116066
116734
  */
116067
116735
  getRoot(rootPath) {
116068
116736
  rootPath = uncToDrive(rootPath.toUpperCase());
116069
- if (rootPath === this.root.name) return this.root;
116737
+ if (rootPath === this.root.name || /^[\\/]$/.test(rootPath)) return this.root;
116070
116738
  for (const [compare, root] of Object.entries(this.roots)) if (this.sameRoot(rootPath, compare)) return this.roots[rootPath] = root;
116071
- return this.roots[rootPath] = new PathScurryWin32(rootPath, this).root;
116739
+ return this.roots[rootPath] = new PathScurryWin32(rootPath, {
116740
+ nocase: this.nocase,
116741
+ fs: this.fs
116742
+ }).root;
116072
116743
  }
116073
116744
  /**
116074
116745
  * @internal
116075
116746
  */
116076
116747
  sameRoot(rootPath, compare = this.root.name) {
116077
- rootPath = rootPath.toUpperCase().replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\");
116078
- return rootPath === compare;
116748
+ return uncToDrive(rootPath.toUpperCase()) === compare;
116079
116749
  }
116080
116750
  };
116081
116751
  exports.PathWin32 = PathWin32;
@@ -116603,6 +117273,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
116603
117273
  sep = "\\";
116604
117274
  constructor(cwd = process.cwd(), opts = {}) {
116605
117275
  const { nocase = true } = opts;
117276
+ if (typeof cwd === "string" && !cwd.startsWith("file://")) cwd = cwd.replace(longDrivePrefix, "").replace(longUncPrefix, "\\");
116606
117277
  super(cwd, node_path_1.win32, "\\", {
116607
117278
  ...opts,
116608
117279
  nocase
@@ -116735,26 +117406,17 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
116735
117406
  this.#platform = platform;
116736
117407
  if (this.#index === 0) {
116737
117408
  if (this.isUNC()) {
116738
- const [p0, p1, p2, p3, ...prest] = this.#patternList;
116739
- const [g0, g1, g2, g3, ...grest] = this.#globList;
117409
+ const n = this.#isLongUNC() ? 6 : 4;
117410
+ const proot = this.#patternList.slice(0, n);
117411
+ const groot = this.#globList.slice(0, n);
117412
+ const prest = this.#patternList.slice(n);
117413
+ const grest = this.#globList.slice(n);
116740
117414
  if (prest[0] === "") {
116741
117415
  prest.shift();
116742
117416
  grest.shift();
116743
117417
  }
116744
- const p = [
116745
- p0,
116746
- p1,
116747
- p2,
116748
- p3,
116749
- ""
116750
- ].join("/");
116751
- const g = [
116752
- g0,
116753
- g1,
116754
- g2,
116755
- g3,
116756
- ""
116757
- ].join("/");
117418
+ const p = [...proot, ""].join("/");
117419
+ const g = [...groot, ""].join("/");
116758
117420
  this.#patternList = [p, ...prest];
116759
117421
  this.#globList = [g, ...grest];
116760
117422
  this.length = this.#patternList.length;
@@ -116765,8 +117427,8 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
116765
117427
  prest.shift();
116766
117428
  grest.shift();
116767
117429
  }
116768
- const p = p1 + "/";
116769
- const g = g1 + "/";
117430
+ const p = `${p1}/`;
117431
+ const g = `${g1}/`;
116770
117432
  this.#patternList = [p, ...prest];
116771
117433
  this.#globList = [g, ...grest];
116772
117434
  this.length = this.#patternList.length;
@@ -116774,7 +117436,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
116774
117436
  }
116775
117437
  }
116776
117438
  [customInspect]() {
116777
- return "Pattern <" + this.#globList.slice(this.#index).join("/") + ">";
117439
+ return `Pattern <${this.#globList.slice(this.#index).join("/")}>`;
116778
117440
  }
116779
117441
  /**
116780
117442
  * The first entry in the parsed list of patterns
@@ -116795,10 +117457,10 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
116795
117457
  return this.#patternList[this.#index] === minimatch_1.GLOBSTAR;
116796
117458
  }
116797
117459
  /**
116798
- * true if pattern() returns a regexp
117460
+ * true if pattern() returns a Matcher, for a portion with magic
116799
117461
  */
116800
- isRegExp() {
116801
- return this.#patternList[this.#index] instanceof RegExp;
117462
+ isMatcher() {
117463
+ return typeof this.#patternList[this.#index] === "object";
116802
117464
  }
116803
117465
  /**
116804
117466
  * The /-joined set of glob parts that make up this pattern
@@ -116824,12 +117486,17 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
116824
117486
  this.#rest.#isDrive = this.#isDrive;
116825
117487
  return this.#rest;
116826
117488
  }
117489
+ #isLongUNC() {
117490
+ const pl = this.#patternList;
117491
+ return pl[2] === "?" && typeof pl[3] === "string" && /^unc$/i.test(pl[3]);
117492
+ }
116827
117493
  /**
116828
117494
  * true if the pattern represents a //unc/path/ on windows
116829
117495
  */
116830
117496
  isUNC() {
116831
117497
  const pl = this.#patternList;
116832
- return this.#isUNC !== void 0 ? this.#isUNC : this.#isUNC = this.#platform === "win32" && this.#index === 0 && pl[0] === "" && pl[1] === "" && typeof pl[2] === "string" && !!pl[2] && typeof pl[3] === "string" && !!pl[3];
117498
+ const h = this.#isLongUNC() ? 4 : 2;
117499
+ return this.#isUNC !== void 0 ? this.#isUNC : this.#isUNC = this.#platform === "win32" && this.#index === 0 && pl[0] === "" && pl[1] === "" && typeof pl[h] === "string" && !!pl[h] && typeof pl[h + 1] === "string" && !!pl[h + 1];
116833
117500
  }
116834
117501
  /**
116835
117502
  * True if the pattern starts with a drive letter on Windows
@@ -116887,23 +117554,39 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
116887
117554
  absoluteChildren;
116888
117555
  platform;
116889
117556
  mmopts;
116890
- constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform }) {
117557
+ /**
117558
+ * The escaped glob for the directory that a pattern starting with
117559
+ * `/` is rooted at, with no trailing `/`.
117560
+ */
117561
+ slashRoot;
117562
+ /**
117563
+ * Patterns that start with `/` (but not drive letters or UNC paths
117564
+ * on Windows) start at the `root` option if it is set, or else at
117565
+ * the root of `cwd`, the same as non-ignored patterns. If `cwd` is
117566
+ * not provided, they start at `/`.
117567
+ */
117568
+ constructor(ignored, { nobrace, nocase, noext, noglobstar, normalize, platform = defaultPlatform, root, windowsPathsNoEscape, allowWindowsEscape }, cwd) {
116891
117569
  this.relative = [];
116892
117570
  this.absolute = [];
116893
117571
  this.relativeChildren = [];
116894
117572
  this.absoluteChildren = [];
116895
117573
  this.platform = platform;
117574
+ windowsPathsNoEscape = !!windowsPathsNoEscape || allowWindowsEscape === false;
116896
117575
  this.mmopts = {
116897
117576
  dot: true,
116898
117577
  nobrace,
116899
117578
  nocase,
116900
117579
  noext,
116901
117580
  noglobstar,
117581
+ normalize,
116902
117582
  optimizationLevel: 2,
116903
117583
  platform,
116904
117584
  nocomment: true,
116905
- nonegate: true
117585
+ nonegate: true,
117586
+ windowsPathsNoEscape
116906
117587
  };
117588
+ const slashRoot = cwd?.resolve(root ?? "/").fullpath() ?? "/";
117589
+ this.slashRoot = (0, minimatch_1.escape)(slashRoot.replace(/\\/g, "/").replace(/\/$/, ""), { windowsPathsNoEscape });
116907
117590
  for (const ign of ignored) this.add(ign);
116908
117591
  }
116909
117592
  add(ign) {
@@ -116919,7 +117602,8 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
116919
117602
  }
116920
117603
  /* c8 ignore stop */
116921
117604
  const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
116922
- const m = new minimatch_1.Minimatch(p.globString(), this.mmopts);
117605
+ const glob = p.root() === "/" ? `${this.slashRoot}/${p.rest()?.globString() ?? ""}` : p.globString();
117606
+ const m = new minimatch_1.Minimatch(glob, this.mmopts);
116923
117607
  const children = globParts[globParts.length - 1] === "**";
116924
117608
  const absolute = p.isAbsolute();
116925
117609
  if (absolute) this.absolute.push(m);
@@ -116938,8 +117622,8 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
116938
117622
  return false;
116939
117623
  }
116940
117624
  childrenIgnored(p) {
116941
- const fullpath = p.fullpath() + "/";
116942
- const relative = (p.relative() || ".") + "/";
117625
+ const fullpath = `${p.fullpath()}/`;
117626
+ const relative = `${p.relative() || "."}/`;
116943
117627
  for (const m of this.relativeChildren) if (m.match(relative)) return true;
116944
117628
  for (const m of this.absoluteChildren) if (m.match(fullpath)) return true;
116945
117629
  return false;
@@ -116954,24 +117638,38 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
116954
117638
  exports.Processor = exports.SubWalks = exports.MatchRecord = exports.HasWalkedCache = void 0;
116955
117639
  const minimatch_1 = require_commonjs$4();
116956
117640
  /**
116957
- * A cache of which patterns have been processed for a given Path
117641
+ * A cache of which patterns have been processed for a given Path, in
117642
+ * this walk step and the steps that led to it.
117643
+ *
117644
+ * A step only adds to it before it makes the caches for the next
117645
+ * steps, so a copy can look up the chain of caches before it, in
117646
+ * place of copying their entries. A pattern for a path that a cache
117647
+ * up the chain has already seen is added to that cache's set, so that
117648
+ * the other steps that share it see it too. Paths are keyed by their
117649
+ * full path, because path-scurry can make a new Path object for the
117650
+ * same path once its cache of children is full.
116958
117651
  */
116959
117652
  var HasWalkedCache = class HasWalkedCache {
117653
+ parent;
116960
117654
  store;
116961
- constructor(store = /* @__PURE__ */ new Map()) {
116962
- this.store = store;
117655
+ constructor(parent) {
117656
+ this.parent = parent;
116963
117657
  }
116964
117658
  copy() {
116965
- return new HasWalkedCache(new Map(this.store));
117659
+ return new HasWalkedCache(this);
117660
+ }
117661
+ #find(fullpath) {
117662
+ const set = this.store?.get(fullpath);
117663
+ return set || !this.parent ? set : this.parent.#find(fullpath);
116966
117664
  }
116967
117665
  hasWalked(target, pattern) {
116968
- return this.store.get(target.fullpath())?.has(pattern.globString());
117666
+ return !!this.#find(target.fullpath())?.has(pattern.globString());
116969
117667
  }
116970
117668
  storeWalked(target, pattern) {
116971
117669
  const fullpath = target.fullpath();
116972
- const cached = this.store.get(fullpath);
117670
+ const cached = this.#find(fullpath);
116973
117671
  if (cached) cached.add(pattern.globString());
116974
- else this.store.set(fullpath, new Set([pattern.globString()]));
117672
+ else (this.store ??= /* @__PURE__ */ new Map()).set(fullpath, new Set([pattern.globString()]));
116975
117673
  }
116976
117674
  };
116977
117675
  exports.HasWalkedCache = HasWalkedCache;
@@ -116979,21 +117677,18 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
116979
117677
  * A record of which paths have been matched in a given walk step,
116980
117678
  * and whether they only are considered a match if they are a directory,
116981
117679
  * and whether their absolute or relative path should be returned.
117680
+ * The store maps each path to {@link MatchRecord.ABSOLUTE} and
117681
+ * {@link MatchRecord.IF_DIR} flags.
116982
117682
  */
116983
- var MatchRecord = class {
117683
+ var MatchRecord = class MatchRecord {
117684
+ static ABSOLUTE = 2;
117685
+ static IF_DIR = 1;
116984
117686
  store = /* @__PURE__ */ new Map();
116985
117687
  add(target, absolute, ifDir) {
116986
- const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
117688
+ const n = (absolute ? MatchRecord.ABSOLUTE : 0) | (ifDir ? MatchRecord.IF_DIR : 0);
116987
117689
  const current = this.store.get(target);
116988
117690
  this.store.set(target, current === void 0 ? n : n & current);
116989
117691
  }
116990
- entries() {
116991
- return [...this.store.entries()].map(([path, n]) => [
116992
- path,
116993
- !!(n & 2),
116994
- !!(n & 1)
116995
- ]);
116996
- }
116997
117692
  };
116998
117693
  exports.MatchRecord = MatchRecord;
116999
117694
  /**
@@ -117084,7 +117779,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
117084
117779
  if (!rrest) this.matches.add(tp, absolute, true);
117085
117780
  else if (!this.hasWalkedCache.hasWalked(tp, rrest)) this.subwalks.add(tp, rrest);
117086
117781
  }
117087
- } else if (p instanceof RegExp) this.subwalks.add(t, pattern);
117782
+ } else if (typeof p === "object") this.subwalks.add(t, pattern);
117088
117783
  }
117089
117784
  return this;
117090
117785
  }
@@ -117102,7 +117797,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
117102
117797
  const p = pattern.pattern();
117103
117798
  const rest = pattern.rest();
117104
117799
  if (p === minimatch_1.GLOBSTAR) results.testGlobstar(e, pattern, rest, absolute);
117105
- else if (p instanceof RegExp) results.testRegExp(e, p, rest, absolute);
117800
+ else if (typeof p === "object") results.testMatcher(e, p, rest, absolute);
117106
117801
  else results.testString(e, p, rest, absolute);
117107
117802
  }
117108
117803
  return results;
@@ -117126,11 +117821,11 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
117126
117821
  const ep = e.parent || e;
117127
117822
  /* c8 ignore stop */
117128
117823
  this.subwalks.add(ep, rest);
117129
- } else if (rp instanceof RegExp) this.testRegExp(e, rp, rest.rest(), absolute);
117824
+ } else if (typeof rp === "object") this.testMatcher(e, rp, rest.rest(), absolute);
117130
117825
  }
117131
117826
  }
117132
- testRegExp(e, p, rest, absolute) {
117133
- if (!p.test(e.name)) return;
117827
+ testMatcher(e, p, rest, absolute) {
117828
+ if (!p.testUnchecked(e.name)) return;
117134
117829
  if (!rest) this.matches.add(e, absolute, false);
117135
117830
  else this.subwalks.add(e, rest);
117136
117831
  }
@@ -117155,7 +117850,8 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117155
117850
  const minipass_1 = require_commonjs$2();
117156
117851
  const ignore_js_1 = require_ignore();
117157
117852
  const processor_js_1 = require_processor();
117158
- const makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore;
117853
+ const { ABSOLUTE, IF_DIR } = processor_js_1.MatchRecord;
117854
+ const makeIgnore = (ignore, opts, cwd) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts, cwd) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts, cwd) : ignore;
117159
117855
  /**
117160
117856
  * basic walking utilities that all the glob walker types use
117161
117857
  */
@@ -117179,7 +117875,7 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117179
117875
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
117180
117876
  this.includeChildMatches = opts.includeChildMatches !== false;
117181
117877
  if (opts.ignore || !this.includeChildMatches) {
117182
- this.#ignore = makeIgnore(opts.ignore ?? [], opts);
117878
+ this.#ignore = makeIgnore(opts.ignore ?? [], opts, path);
117183
117879
  if (!this.includeChildMatches && typeof this.#ignore.add !== "function") throw new Error("cannot ignore child matches, ignore lacks add() method.");
117184
117880
  }
117185
117881
  /* c8 ignore start */
@@ -117210,21 +117906,21 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117210
117906
  while (!this.paused && (fn = this.#onResume.shift())) fn();
117211
117907
  }
117212
117908
  onResume(fn) {
117213
- if (this.signal?.aborted) return;
117214
117909
  /* c8 ignore start */
117215
117910
  if (!this.paused) fn();
117216
117911
  else
117217
117912
  /* c8 ignore stop */
117218
117913
  this.#onResume.push(fn);
117219
117914
  }
117220
- async matchCheck(e, ifDir) {
117915
+ async matchCheck(inPath, ifDir) {
117221
117916
  if (ifDir && this.opts.nodir) return void 0;
117222
117917
  let rpc;
117918
+ let e;
117223
117919
  if (this.opts.realpath) {
117224
- rpc = e.realpathCached() || await e.realpath();
117920
+ rpc = inPath.realpathCached() || await inPath.realpath();
117225
117921
  if (!rpc) return void 0;
117226
117922
  e = rpc;
117227
- }
117923
+ } else e = inPath;
117228
117924
  const s = e.isUnknown() || this.opts.stat ? await e.lstat() : e;
117229
117925
  if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
117230
117926
  const target = await s.realpath();
@@ -117236,14 +117932,15 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117236
117932
  matchCheckTest(e, ifDir) {
117237
117933
  return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0;
117238
117934
  }
117239
- matchCheckSync(e, ifDir) {
117935
+ matchCheckSync(inPath, ifDir) {
117240
117936
  if (ifDir && this.opts.nodir) return void 0;
117241
117937
  let rpc;
117938
+ let e;
117242
117939
  if (this.opts.realpath) {
117243
- rpc = e.realpathCached() || e.realpathSync();
117940
+ rpc = inPath.realpathCached() || inPath.realpathSync();
117244
117941
  if (!rpc) return void 0;
117245
117942
  e = rpc;
117246
- }
117943
+ } else e = inPath;
117247
117944
  const s = e.isUnknown() || this.opts.stat ? e.lstatSync() : e;
117248
117945
  if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
117249
117946
  const target = s.realpathSync();
@@ -117253,6 +117950,9 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117253
117950
  }
117254
117951
  matchFinish(e, absolute) {
117255
117952
  if (this.#ignored(e)) return;
117953
+ this.#matchEmitChecked(e, absolute);
117954
+ }
117955
+ #matchEmitChecked(e, absolute) {
117256
117956
  if (!this.includeChildMatches && this.#ignore?.add) {
117257
117957
  const ign = `${e.relativePosix()}/**`;
117258
117958
  this.#ignore.add(ign);
@@ -117266,8 +117966,8 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117266
117966
  this.matchEmit(abs + mark);
117267
117967
  } else {
117268
117968
  const rel = this.opts.posix ? e.relativePosix() : e.relative();
117269
- const pre = this.opts.dotRelative && !rel.startsWith(".." + this.#sep) ? "." + this.#sep : "";
117270
- this.matchEmit(!rel ? "." + mark : pre + rel + mark);
117969
+ const pre = this.opts.dotRelative && !rel.startsWith(`..${this.#sep}`) ? `.${this.#sep}` : "";
117970
+ this.matchEmit(!rel ? `.${mark}` : pre + rel + mark);
117271
117971
  }
117272
117972
  }
117273
117973
  async match(e, absolute, ifDir) {
@@ -117276,17 +117976,17 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117276
117976
  }
117277
117977
  matchSync(e, absolute, ifDir) {
117278
117978
  const p = this.matchCheckSync(e, ifDir);
117279
- if (p) this.matchFinish(p, absolute);
117979
+ if (p) this.#matchEmitChecked(p, absolute);
117280
117980
  }
117281
117981
  walkCB(target, patterns, cb) {
117282
117982
  /* c8 ignore start */
117283
- if (this.signal?.aborted) cb();
117983
+ if (this.signal?.aborted) return cb();
117284
117984
  /* c8 ignore stop */
117285
117985
  this.walkCB2(target, patterns, new processor_js_1.Processor(this.opts), cb);
117286
117986
  }
117287
117987
  walkCB2(target, patterns, processor, cb) {
117288
117988
  if (this.#childrenIgnored(target)) return cb();
117289
- if (this.signal?.aborted) cb();
117989
+ if (this.signal?.aborted) return cb();
117290
117990
  if (this.paused) {
117291
117991
  this.onResume(() => this.walkCB2(target, patterns, processor, cb));
117292
117992
  return;
@@ -117296,10 +117996,10 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117296
117996
  const next = () => {
117297
117997
  if (--tasks === 0) cb();
117298
117998
  };
117299
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
117999
+ for (const [m, n] of processor.matches.store) {
117300
118000
  if (this.#ignored(m)) continue;
117301
118001
  tasks++;
117302
- this.match(m, absolute, ifDir).then(() => next());
118002
+ this.match(m, !!(n & ABSOLUTE), !!(n & IF_DIR)).then(() => next());
117303
118003
  }
117304
118004
  for (const t of processor.subwalkTargets()) {
117305
118005
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) continue;
@@ -117310,32 +118010,32 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117310
118010
  }
117311
118011
  next();
117312
118012
  }
117313
- walkCB3(target, entries, processor, cb) {
117314
- processor = processor.filterEntries(target, entries);
118013
+ walkCB3(target, entries, processorx, cb) {
118014
+ const proc = processorx.filterEntries(target, entries);
117315
118015
  let tasks = 1;
117316
118016
  const next = () => {
117317
118017
  if (--tasks === 0) cb();
117318
118018
  };
117319
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
118019
+ for (const [m, n] of proc.matches.store) {
117320
118020
  if (this.#ignored(m)) continue;
117321
118021
  tasks++;
117322
- this.match(m, absolute, ifDir).then(() => next());
118022
+ this.match(m, !!(n & ABSOLUTE), !!(n & IF_DIR)).then(() => next());
117323
118023
  }
117324
- for (const [target, patterns] of processor.subwalks.entries()) {
118024
+ for (const [target, patterns] of proc.subwalks.entries()) {
117325
118025
  tasks++;
117326
- this.walkCB2(target, patterns, processor.child(), next);
118026
+ this.walkCB2(target, patterns, proc.child(), next);
117327
118027
  }
117328
118028
  next();
117329
118029
  }
117330
118030
  walkCBSync(target, patterns, cb) {
117331
118031
  /* c8 ignore start */
117332
- if (this.signal?.aborted) cb();
118032
+ if (this.signal?.aborted) return cb();
117333
118033
  /* c8 ignore stop */
117334
118034
  this.walkCB2Sync(target, patterns, new processor_js_1.Processor(this.opts), cb);
117335
118035
  }
117336
118036
  walkCB2Sync(target, patterns, processor, cb) {
117337
118037
  if (this.#childrenIgnored(target)) return cb();
117338
- if (this.signal?.aborted) cb();
118038
+ if (this.signal?.aborted) return cb();
117339
118039
  if (this.paused) {
117340
118040
  this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb));
117341
118041
  return;
@@ -117345,9 +118045,9 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117345
118045
  const next = () => {
117346
118046
  if (--tasks === 0) cb();
117347
118047
  };
117348
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
118048
+ for (const [m, n] of processor.matches.store) {
117349
118049
  if (this.#ignored(m)) continue;
117350
- this.matchSync(m, absolute, ifDir);
118050
+ this.matchSync(m, !!(n & ABSOLUTE), !!(n & IF_DIR));
117351
118051
  }
117352
118052
  for (const t of processor.subwalkTargets()) {
117353
118053
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) continue;
@@ -117358,30 +118058,30 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
117358
118058
  next();
117359
118059
  }
117360
118060
  walkCB3Sync(target, entries, processor, cb) {
117361
- processor = processor.filterEntries(target, entries);
118061
+ const proc = processor.filterEntries(target, entries);
117362
118062
  let tasks = 1;
117363
118063
  const next = () => {
117364
118064
  if (--tasks === 0) cb();
117365
118065
  };
117366
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
118066
+ for (const [m, n] of proc.matches.store) {
117367
118067
  if (this.#ignored(m)) continue;
117368
- this.matchSync(m, absolute, ifDir);
118068
+ this.matchSync(m, !!(n & ABSOLUTE), !!(n & IF_DIR));
117369
118069
  }
117370
- for (const [target, patterns] of processor.subwalks.entries()) {
118070
+ for (const [target, patterns] of proc.subwalks.entries()) {
117371
118071
  tasks++;
117372
- this.walkCB2Sync(target, patterns, processor.child(), next);
118072
+ this.walkCB2Sync(target, patterns, proc.child(), next);
117373
118073
  }
117374
118074
  next();
117375
118075
  }
117376
118076
  };
117377
118077
  exports.GlobUtil = GlobUtil;
117378
118078
  var GlobWalker = class extends GlobUtil {
117379
- matches = /* @__PURE__ */ new Set();
118079
+ matches = [];
117380
118080
  constructor(patterns, path, opts) {
117381
118081
  super(patterns, path, opts);
117382
118082
  }
117383
118083
  matchEmit(e) {
117384
- this.matches.add(e);
118084
+ this.matches.push(e);
117385
118085
  }
117386
118086
  async walk() {
117387
118087
  if (this.signal?.aborted) throw this.signal.reason;
@@ -117522,14 +118222,14 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
117522
118222
  this.stat = !!opts.stat;
117523
118223
  this.ignore = opts.ignore;
117524
118224
  if (this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
117525
- if (typeof pattern === "string") pattern = [pattern];
118225
+ let p = typeof pattern === "string" ? [pattern] : pattern;
117526
118226
  this.windowsPathsNoEscape = !!opts.windowsPathsNoEscape || opts.allowWindowsEscape === false;
117527
- if (this.windowsPathsNoEscape) pattern = pattern.map((p) => p.replace(/\\/g, "/"));
118227
+ if (this.windowsPathsNoEscape) p = p.map((p) => p.replace(/\\/g, "/"));
117528
118228
  if (this.matchBase) {
117529
118229
  if (opts.noglobstar) throw new TypeError("base matching requires globstar");
117530
- pattern = pattern.map((p) => p.includes("/") ? p : `./**/${p}`);
118230
+ p = p.map((p) => p.includes("/") ? p : `./**/${p}`);
117531
118231
  }
117532
- this.pattern = pattern;
118232
+ this.pattern = p;
117533
118233
  this.platform = opts.platform || defaultPlatform;
117534
118234
  this.opts = {
117535
118235
  ...opts,
@@ -117557,8 +118257,7 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
117557
118257
  nonegate: true,
117558
118258
  optimizationLevel: 2,
117559
118259
  platform: this.platform,
117560
- windowsPathsNoEscape: this.windowsPathsNoEscape,
117561
- debug: !!this.opts.debug
118260
+ windowsPathsNoEscape: this.windowsPathsNoEscape
117562
118261
  };
117563
118262
  const [matchSet, globParts] = this.pattern.map((p) => new minimatch_1.Minimatch(p, mmo)).reduce((set, m) => {
117564
118263
  set[0].push(...m.set);
@@ -117574,22 +118273,22 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
117574
118273
  });
117575
118274
  }
117576
118275
  async walk() {
117577
- return [...await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
118276
+ return await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
117578
118277
  ...this.opts,
117579
118278
  maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
117580
118279
  platform: this.platform,
117581
118280
  nocase: this.nocase,
117582
118281
  includeChildMatches: this.includeChildMatches
117583
- }).walk()];
118282
+ }).walk();
117584
118283
  }
117585
118284
  walkSync() {
117586
- return [...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
118285
+ return new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
117587
118286
  ...this.opts,
117588
118287
  maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
117589
118288
  platform: this.platform,
117590
118289
  nocase: this.nocase,
117591
118290
  includeChildMatches: this.includeChildMatches
117592
- }).walkSync()];
118291
+ }).walkSync();
117593
118292
  }
117594
118293
  stream() {
117595
118294
  return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
@@ -117650,8 +118349,7 @@ var require_has_magic = /* @__PURE__ */ __commonJSMin(((exports) => {
117650
118349
  * is in the options, brace expansion _is_ treated as a pattern having magic.
117651
118350
  */
117652
118351
  const hasMagic = (pattern, options = {}) => {
117653
- if (!Array.isArray(pattern)) pattern = [pattern];
117654
- for (const p of pattern) if (new minimatch_1.Minimatch(p, options).hasMagic()) return true;
118352
+ for (const p of Array.isArray(pattern) ? pattern : [pattern]) if (new minimatch_1.Minimatch(p, options).hasMagic()) return true;
117655
118353
  return false;
117656
118354
  };
117657
118355
  exports.hasMagic = hasMagic;