@datadog/datadog-ci-plugin-ecs-fargate 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
@@ -5909,7 +5909,7 @@ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5909
5909
  var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5910
5910
  module.exports = {
5911
5911
  "name": "@datadog/datadog-ci-base",
5912
- "version": "5.26.1",
5912
+ "version": "5.27.0",
5913
5913
  "description": "Base package for Datadog CI",
5914
5914
  "license": "Apache-2.0",
5915
5915
  "keywords": ["datadog", "datadog-ci"],
@@ -6011,7 +6011,7 @@ var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6011
6011
  "deep-extend": "^0.6.0",
6012
6012
  "fast-xml-parser": "^5.7.2",
6013
6013
  "form-data": "^4.0.6",
6014
- "glob": "^13.0.6",
6014
+ "glob": "^14.0.3",
6015
6015
  "inquirer": "^8.2.7",
6016
6016
  "is-docker": "^4.0.0",
6017
6017
  "jest-diff": "^30.2.0",
@@ -6023,7 +6023,7 @@ var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6023
6023
  "terminal-link": "^2.1.1",
6024
6024
  "tiny-async-pool": "^2.1.0",
6025
6025
  "typanion": "^3.14.0",
6026
- "undici": "^7.29.1",
6026
+ "undici": "^7.30.1",
6027
6027
  "upath": "^2.0.1",
6028
6028
  "webpack-sources": "^3.5.1"
6029
6029
  },
@@ -12576,6 +12576,8 @@ var require_ipv4 = /* @__PURE__ */ __commonJSMin(((exports) => {
12576
12576
  * address.correctForm(); // '192.0.2.42'
12577
12577
  */
12578
12578
  static fromArpa(arpaFormAddress) {
12579
+ const longest = constants.GROUPS * 4 - 1 + 3 + 14;
12580
+ if (arpaFormAddress.length > longest) throw new address_error_1.AddressError(`in-addr.arpa names are at most ${longest} characters.`);
12579
12581
  return new Address4(arpaFormAddress.replace(/(\.in-addr\.arpa)?\.?$/i, "").split(".").reverse().join("."));
12580
12582
  }
12581
12583
  /**
@@ -12996,6 +12998,9 @@ var require_constants$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
12996
12998
  * A regular expression that matches an IPv6 zone
12997
12999
  * @memberof Address6
12998
13000
  * @static
13001
+ * @deprecated Takes quadratic time on input holding many `%` characters
13002
+ * followed by a line terminator. The library finds the zone by index, as
13003
+ * `Address6`'s constructor shows, and 11.0.0 removes this export.
12999
13004
  */
13000
13005
  exports.RE_ZONE_STRING = /%.*$/;
13001
13006
  exports.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;
@@ -13385,10 +13390,10 @@ var require_ipv6 = /* @__PURE__ */ __commonJSMin(((exports) => {
13385
13390
  address = address.replace(constants6.RE_SUBNET_STRING, "");
13386
13391
  }
13387
13392
  if (/\//.test(address)) throw new address_error_1.AddressError("Invalid subnet mask.");
13388
- const zone = constants6.RE_ZONE_STRING.exec(address);
13389
- if (zone) {
13390
- this.zone = zone[0];
13391
- address = address.replace(constants6.RE_ZONE_STRING, "");
13393
+ const zoneStart = address.indexOf("%");
13394
+ if (zoneStart !== -1 && /^.*$/.test(address.slice(zoneStart))) {
13395
+ this.zone = address.slice(zoneStart);
13396
+ address = address.slice(0, zoneStart);
13392
13397
  }
13393
13398
  const longest = this.groups * 5 + 5;
13394
13399
  if (address.length > longest) throw new address_error_1.AddressError(`IPv6 addresses are at most ${longest} characters.`);
@@ -17578,6 +17583,7 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17578
17583
  Object.defineProperty(exports, "__esModule", { value: true });
17579
17584
  exports.FTPContext = exports.FTPError = void 0;
17580
17585
  const net_1$1 = require("net");
17586
+ const tls_1$3 = require("tls");
17581
17587
  const parseControlResponse_1 = require_parseControlResponse();
17582
17588
  /**
17583
17589
  * Describes an FTP server error response including the FTP response code.
@@ -17616,6 +17622,8 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17616
17622
  this.ipFamily = void 0;
17617
17623
  /** Options for TLS connections. */
17618
17624
  this.tlsOptions = {};
17625
+ /** Most recent TLS session from the control connection, used to resume the session on data connections. */
17626
+ this.tlsSessionStore = void 0;
17619
17627
  /** A multiline response might be received as multiple chunks. */
17620
17628
  this._partialResponse = "";
17621
17629
  this._encoding = encoding;
@@ -17666,6 +17674,7 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17666
17674
  set socket(socket) {
17667
17675
  this.dataSocket = void 0;
17668
17676
  this.tlsOptions = {};
17677
+ this.tlsSessionStore = void 0;
17669
17678
  this._partialResponse = "";
17670
17679
  if (this._socket) if (socket.localPort === this._socket.localPort) this._removeSocketListeners(this.socket);
17671
17680
  else this._closeControlSocket();
@@ -17680,6 +17689,9 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17680
17689
  if (!hadError) this.closeWithError(/* @__PURE__ */ new Error("Server closed connection unexpectedly."));
17681
17690
  });
17682
17691
  this._setupDefaultErrorHandlers(socket, "control socket");
17692
+ if (socket instanceof tls_1$3.TLSSocket) socket.on("session", (session) => {
17693
+ this.tlsSessionStore = session;
17694
+ });
17683
17695
  }
17684
17696
  this._socket = socket;
17685
17697
  }
@@ -17720,9 +17732,9 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17720
17732
  * Send an FTP command without waiting for or handling the result.
17721
17733
  */
17722
17734
  send(command) {
17723
- if (/[\r\n\0]/.test(command)) throw new Error(`Invalid command: Contains control characters. (${command})`);
17724
- const message = command.startsWith("PASS") ? "> PASS ###" : `> ${command}`;
17725
- this.log(message);
17735
+ const description = command.startsWith("PASS") ? "PASS ###" : command;
17736
+ if (/[\r\n\0]/.test(command)) throw new Error(`Invalid command: Contains control characters. (${description})`);
17737
+ this.log(`> ${description}`);
17726
17738
  this._socket.write(command + "\r\n", this.encoding);
17727
17739
  }
17728
17740
  /**
@@ -17746,16 +17758,22 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17746
17758
  this.closeWithError(err);
17747
17759
  }
17748
17760
  return new Promise((resolveTask, rejectTask) => {
17761
+ let settled = false;
17762
+ const stopTrackingOnce = () => {
17763
+ if (settled) return;
17764
+ settled = true;
17765
+ this._stopTrackingTask();
17766
+ };
17749
17767
  this._task = {
17750
17768
  stack: (/* @__PURE__ */ new Error()).stack || "Unknown call stack",
17751
17769
  responseHandler,
17752
17770
  resolver: {
17753
17771
  resolve: (arg) => {
17754
- this._stopTrackingTask();
17772
+ stopTrackingOnce();
17755
17773
  resolveTask(arg);
17756
17774
  },
17757
17775
  reject: (err) => {
17758
- this._stopTrackingTask();
17776
+ stopTrackingOnce();
17759
17777
  rejectTask(err);
17760
17778
  }
17761
17779
  }
@@ -17768,7 +17786,11 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17768
17786
  return;
17769
17787
  }
17770
17788
  this.socket.setTimeout(this.timeout);
17771
- if (command) this.send(command);
17789
+ if (command) try {
17790
+ this.send(command);
17791
+ } catch (err) {
17792
+ this._task.resolver.reject(err);
17793
+ }
17772
17794
  });
17773
17795
  }
17774
17796
  /**
@@ -17822,7 +17844,13 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
17822
17844
  * @protected
17823
17845
  */
17824
17846
  _passToHandler(response) {
17825
- if (this._task) this._task.responseHandler(response, this._task.resolver);
17847
+ const task = this._task;
17848
+ if (task) try {
17849
+ task.responseHandler(response, task.resolver);
17850
+ } catch (err) {
17851
+ task.resolver.reject(err);
17852
+ this.closeWithError(err);
17853
+ }
17826
17854
  }
17827
17855
  /**
17828
17856
  * Setup all error handlers for a socket.
@@ -17892,6 +17920,7 @@ var require_netUtils = /* @__PURE__ */ __commonJSMin(((exports) => {
17892
17920
  exports.describeTLS = describeTLS;
17893
17921
  exports.describeAddress = describeAddress;
17894
17922
  exports.upgradeSocket = upgradeSocket;
17923
+ exports.isLoopback = isLoopback;
17895
17924
  exports.ipIsPrivateV4Address = ipIsPrivateV4Address;
17896
17925
  const tls_1$2 = require("tls");
17897
17926
  /**
@@ -17929,6 +17958,12 @@ var require_netUtils = /* @__PURE__ */ __commonJSMin(((exports) => {
17929
17958
  });
17930
17959
  }
17931
17960
  /**
17961
+ * Returns true if an IP address is a loopback address.
17962
+ */
17963
+ function isLoopback(ip) {
17964
+ return ip === "::1" || ip.startsWith("127.");
17965
+ }
17966
+ /**
17932
17967
  * Returns true if an IP is a private address according to https://tools.ietf.org/html/rfc1918#section-3.
17933
17968
  * This will handle IPv4-mapped IPv6 addresses correctly but return false for all other IPv6 addresses.
17934
17969
  *
@@ -18048,8 +18083,12 @@ var require_parseListDOS = /* @__PURE__ */ __commonJSMin(((exports) => {
18048
18083
  * under the Apache 2.0 license. It has been simplified and rewritten to better fit the Javascript language.
18049
18084
  *
18050
18085
  * https://github.com/apache/commons-net/blob/master/src/main/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java
18086
+ *
18087
+ * Keep this expression anchored: without it a line that can't be parsed is retried at every position,
18088
+ * and as the expression starts with `\S+` each attempt is itself linear in the length of the line. A
18089
+ * single long line without whitespace would cost O(n²), which a server could use to block the event loop.
18051
18090
  */
18052
- const RE_LINE = /* @__PURE__ */ new RegExp("(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
18091
+ const RE_LINE = /* @__PURE__ */ new RegExp("^\\s*(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
18053
18092
  /**
18054
18093
  * Returns true if a given line might be a DOS-style listing.
18055
18094
  *
@@ -18118,8 +18157,12 @@ var require_parseListUnix = /* @__PURE__ */ __commonJSMin(((exports) => {
18118
18157
  * Note: local listings on MacOSX also use '@'
18119
18158
  * this is not allowed for here as does not appear to be shown by FTP servers
18120
18159
  * {@code @} file has extended attributes
18160
+ *
18161
+ * Keep this expression anchored and both name quantifiers bounded: spaces are allowed in the owner and
18162
+ * group name, so an unbounded pair of them makes a line that can't be parsed cost O(n²) in its length,
18163
+ * which a server could use to block the event loop.
18121
18164
  */
18122
- 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(.*)");
18165
+ 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(.*)");
18123
18166
  /**
18124
18167
  * Returns true if a given line might be a Unix-style listing.
18125
18168
  *
@@ -18275,9 +18318,12 @@ var require_parseListMLSD = /* @__PURE__ */ __commonJSMin(((exports) => {
18275
18318
  *
18276
18319
  * - Example 1: `size=15227;type=dir;perm=el;modify=20190419065730; test one`
18277
18320
  * - Example 2: ` file name` (leading space)
18321
+ *
18322
+ * Keep `=` out of the fact name: if both sides of the first `=` could contain it, a long line of `=`
18323
+ * without `;` would be retried at every split point, costing O(n²) and blocking the event loop.
18278
18324
  */
18279
18325
  function testLine(line) {
18280
- return /^\S+=\S+;/.test(line) || line.startsWith(" ");
18326
+ return /^[^\s=]+=\S+;/.test(line) || line.startsWith(" ");
18281
18327
  }
18282
18328
  /**
18283
18329
  * Parse single line as MLSD listing, see specification at https://tools.ietf.org/html/rfc3659#section-7.
@@ -18502,6 +18548,104 @@ var require_StringWriter = /* @__PURE__ */ __commonJSMin(((exports) => {
18502
18548
  exports.StringWriter = StringWriter;
18503
18549
  }));
18504
18550
  //#endregion
18551
+ //#region ../../node_modules/basic-ftp/dist/TransferWatchdog.js
18552
+ var require_TransferWatchdog = /* @__PURE__ */ __commonJSMin(((exports) => {
18553
+ Object.defineProperty(exports, "__esModule", { value: true });
18554
+ exports.TransferWatchdog = void 0;
18555
+ /** How long to wait between two checks of a transfer at most, in milliseconds. */
18556
+ const maxCheckIntervalMs = 500;
18557
+ /**
18558
+ * How many checks a timeout is split into, at least. A transfer is only reported as stalled if
18559
+ * every single one of them found the connection idle. Deciding on a single check would make brief
18560
+ * moments where a transfer looks idle without being stalled matter, for example just after a
18561
+ * destination signalled that it can accept data again but before the first bytes arrived.
18562
+ *
18563
+ * Splitting into n checks means such a moment has to last about (n-1)/n of the timeout to be
18564
+ * mistaken for a stall, so the value matters much less than it being greater than one. It only
18565
+ * has an effect on timeouts below `minChecksPerTimeout * maxCheckIntervalMs` anyway, longer ones
18566
+ * are split into more checks by the interval limit alone.
18567
+ */
18568
+ const minChecksPerTimeout = 4;
18569
+ /**
18570
+ * Watches a data connection during a transfer and reports it as stalled if the server stopped
18571
+ * making progress.
18572
+ *
18573
+ * This replaces a plain inactivity timeout on the data socket. Such a timeout can't tell apart
18574
+ * "the server stopped sending" from "our own source or destination isn't ready yet". A slow local
18575
+ * stream is not an error: A download piped into a decompressor, or an upload fed by a stream that
18576
+ * computes its data, can legitimately leave the connection idle for minutes. Timing out on that
18577
+ * kills a healthy transfer and truncates the data the destination already received.
18578
+ *
18579
+ * Only time spent waiting for the server counts towards the timeout, see `isWaitingForServer`.
18580
+ */
18581
+ var TransferWatchdog = class {
18582
+ constructor() {
18583
+ this.timer = void 0;
18584
+ }
18585
+ /**
18586
+ * Start watching a transfer. Calls `onStall` if the server hasn't made progress for
18587
+ * `timeout` milliseconds, or for twice that if we made it wait ourselves before that.
18588
+ * A timeout of 0 disables the watchdog.
18589
+ */
18590
+ start(socket, direction, timeout, onStall) {
18591
+ this.stop();
18592
+ if (timeout <= 0) return;
18593
+ const intervalMs = Math.max(1, Math.min(Math.floor(timeout / minChecksPerTimeout), maxCheckIntervalMs));
18594
+ let lastBytes = countBytes(socket);
18595
+ let idleMs = 0;
18596
+ let graceMs = 0;
18597
+ this.timer = setInterval(() => {
18598
+ const bytes = countBytes(socket);
18599
+ const madeProgress = bytes !== lastBytes;
18600
+ lastBytes = bytes;
18601
+ if (!isWaitingForServer(socket, direction)) {
18602
+ idleMs = 0;
18603
+ graceMs = timeout;
18604
+ return;
18605
+ }
18606
+ if (madeProgress) {
18607
+ idleMs = 0;
18608
+ graceMs = 0;
18609
+ return;
18610
+ }
18611
+ idleMs += intervalMs;
18612
+ if (idleMs >= timeout + graceMs) {
18613
+ this.stop();
18614
+ onStall();
18615
+ }
18616
+ }, intervalMs);
18617
+ this.timer.unref();
18618
+ }
18619
+ /**
18620
+ * Stop watching. Safe to call at any time, also if no transfer is being watched.
18621
+ */
18622
+ stop() {
18623
+ if (this.timer) {
18624
+ clearInterval(this.timer);
18625
+ this.timer = void 0;
18626
+ }
18627
+ }
18628
+ };
18629
+ exports.TransferWatchdog = TransferWatchdog;
18630
+ function countBytes(socket) {
18631
+ return socket.bytesRead + socket.bytesWritten;
18632
+ }
18633
+ /**
18634
+ * Returns true if the transfer can only continue once the server acts. When downloading, that's
18635
+ * the case as long as we're ready to receive: if the socket is paused, our destination applied
18636
+ * backpressure and the server may well be waiting for us. When uploading, it's the case if we
18637
+ * still have data queued that the server isn't accepting: an empty queue means we're waiting for
18638
+ * our own source instead.
18639
+ *
18640
+ * `isPaused()` only reports backpressure for a socket that is being piped, which is what
18641
+ * `downloadTo` in transfer.ts does. Should that ever change to reading the socket directly, e.g.
18642
+ * by iterating over it, this would report a transfer as stalled while it's waiting for us.
18643
+ */
18644
+ function isWaitingForServer(socket, direction) {
18645
+ return direction === "download" ? !socket.isPaused() : socket.writableLength > 0;
18646
+ }
18647
+ }));
18648
+ //#endregion
18505
18649
  //#region ../../node_modules/basic-ftp/dist/transfer.js
18506
18650
  var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18507
18651
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -18513,9 +18657,10 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18513
18657
  exports.connectForPassiveTransfer = connectForPassiveTransfer;
18514
18658
  exports.uploadFrom = uploadFrom;
18515
18659
  exports.downloadTo = downloadTo;
18516
- const netUtils_1 = require_netUtils();
18517
18660
  const stream_1$2 = require("stream");
18518
18661
  const tls_1$1 = require("tls");
18662
+ const TransferWatchdog_1 = require_TransferWatchdog();
18663
+ const netUtils_1 = require_netUtils();
18519
18664
  const parseControlResponse_1 = require_parseControlResponse();
18520
18665
  /**
18521
18666
  * Prepare a data socket using passive mode over IPv6.
@@ -18552,9 +18697,11 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18552
18697
  return res;
18553
18698
  }
18554
18699
  /**
18555
- * Prepare a data socket using passive mode over IPv4. Ignore the IP provided by the PASV response,
18556
- * and use the control host IP. This is the same behaviour as with the more modern variant EPSV. Use
18557
- * this to fix issues around NAT or provide more security by preventing FTP bounce attacks.
18700
+ * Prepare a data socket using passive mode over IPv4.
18701
+ *
18702
+ * Will throw an error if the IP provided by the PASV response doesn't match the one of the control connection.
18703
+ * The error will contain detailed information. This is done to provide more security by preventing FTP bounce
18704
+ * attacks.
18558
18705
  */
18559
18706
  async function enterPassiveModeIPv4_forceControlHostIP(ftp) {
18560
18707
  const res = await ftp.request("PASV");
@@ -18562,14 +18709,16 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18562
18709
  if (!target) throw new Error("Can't parse PASV response: " + res.message);
18563
18710
  const controlHost = ftp.socket.remoteAddress;
18564
18711
  if (controlHost === void 0) throw new Error("Control socket is disconnected, can't get remote address.");
18565
- await connectForPassiveTransfer(controlHost, target.port, ftp);
18712
+ const normalizedControlHost = controlHost.replace(/^::ffff:/i, "");
18713
+ 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.`);
18714
+ await connectForPassiveTransfer(normalizedControlHost, target.port, ftp);
18566
18715
  return res;
18567
18716
  }
18568
18717
  /**
18569
18718
  * Parse a PASV response.
18570
18719
  */
18571
18720
  function parsePasvResponse(message) {
18572
- const groups = message.match(/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
18721
+ const groups = message.match(/(?<![-\d])([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
18573
18722
  if (groups === null || groups.length !== 4) throw new Error(`Can't parse response to 'PASV': ${message}`);
18574
18723
  return {
18575
18724
  host: groups[1].replace(/,/g, "."),
@@ -18578,7 +18727,8 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18578
18727
  }
18579
18728
  function connectForPassiveTransfer(host, port, ftp) {
18580
18729
  return new Promise((resolve, reject) => {
18581
- let socket = ftp._newSocket();
18730
+ const rawSocket = ftp._newSocket();
18731
+ let socket = rawSocket;
18582
18732
  const handleConnErr = function(err) {
18583
18733
  err.message = "Can't open data connection in passive mode: " + err.message;
18584
18734
  reject(err);
@@ -18595,10 +18745,18 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18595
18745
  host,
18596
18746
  family: ftp.ipFamily
18597
18747
  }, () => {
18598
- if (ftp.socket instanceof tls_1$1.TLSSocket) socket = (0, tls_1$1.connect)(Object.assign({}, ftp.tlsOptions, {
18599
- socket,
18600
- session: ftp.socket.getSession()
18601
- }));
18748
+ var _a;
18749
+ if (ftp.socket instanceof tls_1$1.TLSSocket) {
18750
+ const tlsSocket = (0, tls_1$1.connect)(Object.assign({}, ftp.tlsOptions, {
18751
+ socket: rawSocket,
18752
+ session: (_a = ftp.tlsSessionStore) !== null && _a !== void 0 ? _a : ftp.socket.getSession()
18753
+ }));
18754
+ tlsSocket.on("session", (session) => {
18755
+ ftp.tlsSessionStore = session;
18756
+ });
18757
+ socket = tlsSocket;
18758
+ }
18759
+ rawSocket.setTimeout(0);
18602
18760
  socket.removeListener("error", handleConnErr);
18603
18761
  socket.removeListener("timeout", handleTimeout);
18604
18762
  ftp.dataSocket = socket;
@@ -18623,6 +18781,8 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18623
18781
  this.progress = progress;
18624
18782
  this.response = void 0;
18625
18783
  this.dataTransferDone = false;
18784
+ this.taskSettled = false;
18785
+ this.watchdog = new TransferWatchdog_1.TransferWatchdog();
18626
18786
  }
18627
18787
  /**
18628
18788
  * Mark the beginning of a transfer.
@@ -18633,16 +18793,20 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18633
18793
  onDataStart(name, type) {
18634
18794
  if (this.ftp.dataSocket === void 0) throw new Error("Data transfer should start but there is no data connection.");
18635
18795
  this.ftp.socket.setTimeout(0);
18636
- this.ftp.dataSocket.setTimeout(this.ftp.timeout);
18796
+ this.ftp.dataSocket.setTimeout(0);
18797
+ this.watchdog.start(this.ftp.dataSocket, type === "upload" ? "upload" : "download", this.ftp.timeout, () => {
18798
+ this.ftp.closeWithError(/* @__PURE__ */ new Error("Timeout (data socket)"));
18799
+ });
18637
18800
  this.progress.start(this.ftp.dataSocket, name, type);
18638
18801
  }
18639
18802
  /**
18640
18803
  * The data connection has finished the transfer.
18641
18804
  */
18642
18805
  onDataDone(task) {
18806
+ if (this.taskSettled) return;
18807
+ this.watchdog.stop();
18643
18808
  this.progress.updateAndStop();
18644
18809
  this.ftp.socket.setTimeout(this.ftp.timeout);
18645
- if (this.ftp.dataSocket) this.ftp.dataSocket.setTimeout(0);
18646
18810
  this.dataTransferDone = true;
18647
18811
  this.tryResolve(task);
18648
18812
  }
@@ -18657,6 +18821,9 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18657
18821
  * An error has been reported and the task should be rejected.
18658
18822
  */
18659
18823
  onError(task, err) {
18824
+ if (this.taskSettled) return;
18825
+ this.taskSettled = true;
18826
+ this.watchdog.stop();
18660
18827
  this.progress.updateAndStop();
18661
18828
  this.ftp.socket.setTimeout(this.ftp.timeout);
18662
18829
  this.ftp.dataSocket = void 0;
@@ -18673,6 +18840,7 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18673
18840
  }
18674
18841
  tryResolve(task) {
18675
18842
  if (this.dataTransferDone && this.response !== void 0) {
18843
+ this.taskSettled = true;
18676
18844
  this.ftp.dataSocket = void 0;
18677
18845
  task.resolve(this.response);
18678
18846
  }
@@ -18681,9 +18849,12 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18681
18849
  function uploadFrom(source, config) {
18682
18850
  const resolver = new TransferResolver(config.ftp, config.tracker);
18683
18851
  const fullCommand = `${config.command} ${config.remotePath}`;
18852
+ let transferStarted = false;
18684
18853
  return config.ftp.handle(fullCommand, (res, task) => {
18685
18854
  if (res instanceof Error) resolver.onError(task, res);
18686
18855
  else if (res.code === 150 || res.code === 125) {
18856
+ if (transferStarted) return;
18857
+ transferStarted = true;
18687
18858
  const dataSocket = config.ftp.dataSocket;
18688
18859
  if (!dataSocket) {
18689
18860
  resolver.onError(task, /* @__PURE__ */ new Error("Upload should begin but no data connection is available."));
@@ -18704,9 +18875,12 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
18704
18875
  function downloadTo(destination, config) {
18705
18876
  if (!config.ftp.dataSocket) throw new Error("Download will be initiated but no data connection is available.");
18706
18877
  const resolver = new TransferResolver(config.ftp, config.tracker);
18878
+ let transferStarted = false;
18707
18879
  return config.ftp.handle(config.command, (res, task) => {
18708
18880
  if (res instanceof Error) resolver.onError(task, res);
18709
18881
  else if (res.code === 150 || res.code === 125) {
18882
+ if (transferStarted) return;
18883
+ transferStarted = true;
18710
18884
  const dataSocket = config.ftp.dataSocket;
18711
18885
  if (!dataSocket) {
18712
18886
  resolver.onError(task, /* @__PURE__ */ new Error("Download should begin but no data connection is available."));
@@ -18757,11 +18931,12 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
18757
18931
  const fsReadDir = (0, util_1$3.promisify)(fs_1$7.readdir);
18758
18932
  const fsMkDir = (0, util_1$3.promisify)(fs_1$7.mkdir);
18759
18933
  const fsStat = (0, util_1$3.promisify)(fs_1$7.stat);
18934
+ const fsFStat = (0, util_1$3.promisify)(fs_1$7.fstat);
18760
18935
  const fsOpen = (0, util_1$3.promisify)(fs_1$7.open);
18761
18936
  const fsClose = (0, util_1$3.promisify)(fs_1$7.close);
18762
18937
  const fsUnlink = (0, util_1$3.promisify)(fs_1$7.unlink);
18763
18938
  const defaultClientOptions = {
18764
- allowSeparateTransferHost: true,
18939
+ allowSeparateTransferHost: false,
18765
18940
  maxListingBytes: 40 * 1024 * 1024
18766
18941
  };
18767
18942
  const LIST_COMMANDS_DEFAULT = () => ["LIST -a", "LIST"];
@@ -18833,7 +19008,9 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
18833
19008
  * explicit TLS. There are still FTP servers that support only implicit TLS, though.
18834
19009
  */
18835
19010
  connectImplicitTLS(host = "localhost", port = 21, tlsOptions = {}) {
19011
+ var _a;
18836
19012
  this.ftp.reset();
19013
+ tlsOptions.host = (_a = tlsOptions.host) !== null && _a !== void 0 ? _a : host;
18837
19014
  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)})`));
18838
19015
  this.ftp.tlsOptions = tlsOptions;
18839
19016
  return this._handleConnectResponse();
@@ -19076,7 +19253,10 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
19076
19253
  autoClose: false
19077
19254
  });
19078
19255
  try {
19079
- return await this._uploadFromStream(source, remotePath, command);
19256
+ const expectedBytes = await expectedBytesFromLocalFile(fd, options);
19257
+ const response = await this._uploadFromStream(source, remotePath, command);
19258
+ 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.`);
19259
+ return response;
19080
19260
  } finally {
19081
19261
  await ignoreError(() => fsClose(fd));
19082
19262
  }
@@ -19408,6 +19588,19 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
19408
19588
  await fsMkDir(path, { recursive: true });
19409
19589
  }
19410
19590
  }
19591
+ /**
19592
+ * Return how many bytes an upload should read from an open local file, taking the optional
19593
+ * range described by `options` into account. Returns `undefined` if the size can't be known
19594
+ * upfront, for example because the source is a pipe or another non-regular file.
19595
+ */
19596
+ async function expectedBytesFromLocalFile(fd, options) {
19597
+ var _a;
19598
+ const stats = await fsFStat(fd);
19599
+ if (!stats.isFile()) return;
19600
+ const start = (_a = options.localStart) !== null && _a !== void 0 ? _a : 0;
19601
+ const endExclusive = options.localEndInclusive !== void 0 ? Math.min(options.localEndInclusive + 1, stats.size) : stats.size;
19602
+ return Math.max(0, endExclusive - start);
19603
+ }
19411
19604
  async function ignoreError(func) {
19412
19605
  try {
19413
19606
  return await func();
@@ -20306,7 +20499,7 @@ var require_estraverse = /* @__PURE__ */ __commonJSMin(((exports) => {
20306
20499
  }));
20307
20500
  //#endregion
20308
20501
  //#region ../../node_modules/esutils/lib/ast.js
20309
- var require_ast$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20502
+ var require_ast = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20310
20503
  (function() {
20311
20504
  "use strict";
20312
20505
  function isExpression(node) {
@@ -20585,7 +20778,7 @@ var require_keyword = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20585
20778
  var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
20586
20779
  (function() {
20587
20780
  "use strict";
20588
- exports.ast = require_ast$1();
20781
+ exports.ast = require_ast();
20589
20782
  exports.code = require_code();
20590
20783
  exports.keyword = require_keyword();
20591
20784
  })();
@@ -36801,6 +36994,7 @@ var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36801
36994
  kDestroy: Symbol("destroy"),
36802
36995
  kDispatch: Symbol("dispatch"),
36803
36996
  kUrl: Symbol("url"),
36997
+ kRedirectCacheControl: Symbol("redirect cache control"),
36804
36998
  kWriting: Symbol("writing"),
36805
36999
  kResuming: Symbol("resuming"),
36806
37000
  kQueue: Symbol("queue"),
@@ -39333,6 +39527,7 @@ var require_unwrap_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
39333
39527
  //#endregion
39334
39528
  //#region ../../node_modules/undici/lib/dispatcher/dispatcher-base.js
39335
39529
  var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39530
+ const buffer$1 = require("node:buffer");
39336
39531
  const Dispatcher = require_dispatcher();
39337
39532
  const UnwrapHandler = require_unwrap_handler();
39338
39533
  const { ClientDestroyedError, ClientClosedError, InvalidArgumentError } = require_errors$2();
@@ -39340,6 +39535,7 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
39340
39535
  const kOnDestroyed = Symbol("onDestroyed");
39341
39536
  const kOnClosed = Symbol("onClosed");
39342
39537
  const kWebSocketOptions = Symbol("webSocketOptions");
39538
+ const kEventSourceOptions = Symbol("eventSourceOptions");
39343
39539
  var DispatcherBase = class extends Dispatcher {
39344
39540
  /** @type {boolean} */
39345
39541
  [kDestroyed] = false;
@@ -39355,6 +39551,7 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
39355
39551
  constructor(opts) {
39356
39552
  super();
39357
39553
  this[kWebSocketOptions] = opts?.webSocket ?? {};
39554
+ this[kEventSourceOptions] = opts?.eventSource ?? {};
39358
39555
  }
39359
39556
  /**
39360
39557
  * @returns {import('../../types/dispatcher').WebSocketOptions}
@@ -39365,6 +39562,12 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
39365
39562
  maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
39366
39563
  };
39367
39564
  }
39565
+ /**
39566
+ * @returns {import('../../types/client').Client.EventSourceOptions}
39567
+ */
39568
+ get eventSourceOptions() {
39569
+ return { maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer$1.kStringMaxLength };
39570
+ }
39368
39571
  /** @returns {boolean} */
39369
39572
  get destroyed() {
39370
39573
  return this[kDestroyed];
@@ -39470,12 +39673,16 @@ var require_connect = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39470
39673
  if (this._maxCachedSessions === 0) return;
39471
39674
  if (this._sessionCache.has(sessionKey)) this._sessionCache.delete(sessionKey);
39472
39675
  else if (this._sessionCache.size >= this._maxCachedSessions) {
39676
+ let evicted = false;
39473
39677
  for (const [key, ref] of this._sessionCache) if (ref.deref() === void 0) {
39474
39678
  this._sessionCache.delete(key);
39475
- return;
39679
+ evicted = true;
39680
+ break;
39681
+ }
39682
+ if (!evicted) {
39683
+ const oldest = this._sessionCache.keys().next();
39684
+ if (!oldest.done) this._sessionCache.delete(oldest.value);
39476
39685
  }
39477
- const oldest = this._sessionCache.keys().next();
39478
- if (!oldest.done) this._sessionCache.delete(oldest.value);
39479
39686
  }
39480
39687
  this._sessionCache.set(sessionKey, new WeakRef(session));
39481
39688
  this._sessionRegistry.register(session, sessionKey);
@@ -40481,6 +40688,16 @@ var require_infra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40481
40688
  return input.slice(start, position.position);
40482
40689
  }
40483
40690
  const ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g;
40691
+ const nonASCIIRegex = /[^\x00-\x7F]/;
40692
+ /**
40693
+ * @param {string} str
40694
+ * @returns {string}
40695
+ *
40696
+ * @see https://infra.spec.whatwg.org/#ascii-lowercase
40697
+ */
40698
+ function asciiLowercase(str) {
40699
+ return nonASCIIRegex.test(str) ? str.replace(/[A-Z]+/g, (upper) => upper.toLowerCase()) : str.toLowerCase();
40700
+ }
40484
40701
  /**
40485
40702
  * @param {string} data
40486
40703
  * @returns {Uint8Array | 'failure'}
@@ -40578,6 +40795,7 @@ var require_infra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40578
40795
  return result;
40579
40796
  }
40580
40797
  module.exports = {
40798
+ asciiLowercase,
40581
40799
  collectASequenceOfCodePoints,
40582
40800
  collectASequenceOfCodePointsFast,
40583
40801
  forgivingBase64,
@@ -43425,7 +43643,6 @@ var require_client_h1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
43425
43643
  };
43426
43644
  }
43427
43645
  function onHttpSocketError(err) {
43428
- assert$23(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
43429
43646
  const parser = this[kParser];
43430
43647
  if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
43431
43648
  const parserErr = parser.finish();
@@ -44050,7 +44267,6 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
44050
44267
  }
44051
44268
  }
44052
44269
  function onHttp2SessionError(err) {
44053
- assert$22(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
44054
44270
  this[kSocket][kError] = err;
44055
44271
  this[kClient][kOnError](err);
44056
44272
  }
@@ -44138,7 +44354,6 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
44138
44354
  client[kResume]();
44139
44355
  }
44140
44356
  function onHttp2SocketError(err) {
44141
- assert$22(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
44142
44357
  this[kError] = err;
44143
44358
  this[kClient][kOnError](err);
44144
44359
  }
@@ -44504,7 +44719,7 @@ var require_client$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
44504
44719
  * @param {string|URL} url
44505
44720
  * @param {import('../../types/client.js').Client.Options} options
44506
44721
  */
44507
- 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 } = {}) {
44722
+ 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 } = {}) {
44508
44723
  if (keepAlive !== void 0) throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
44509
44724
  if (socketTimeout !== void 0) throw new InvalidArgumentError("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");
44510
44725
  if (requestTimeout !== void 0) throw new InvalidArgumentError("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");
@@ -44531,7 +44746,10 @@ var require_client$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
44531
44746
  if (initialWindowSize != null && (!Number.isInteger(initialWindowSize) || initialWindowSize < 1)) throw new InvalidArgumentError("initialWindowSize must be a positive integer, greater than 0");
44532
44747
  if (connectionWindowSize != null && (!Number.isInteger(connectionWindowSize) || connectionWindowSize < 1)) throw new InvalidArgumentError("connectionWindowSize must be a positive integer, greater than 0");
44533
44748
  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");
44534
- super({ webSocket });
44749
+ super({
44750
+ webSocket,
44751
+ eventSource
44752
+ });
44535
44753
  if (typeof connect !== "function") connect = buildConnector({
44536
44754
  ...tls,
44537
44755
  maxCachedSessions,
@@ -45356,16 +45574,18 @@ var require_agent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45356
45574
  return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
45357
45575
  }
45358
45576
  var Agent = class extends DispatcherBase {
45359
- constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
45577
+ constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
45360
45578
  if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
45361
45579
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
45362
45580
  if (typeof maxOrigins !== "number" || Number.isNaN(maxOrigins) || maxOrigins <= 0) throw new InvalidArgumentError("maxOrigins must be a number greater than 0");
45363
45581
  super(options);
45364
45582
  if (connect && typeof connect !== "function") connect = { ...connect };
45583
+ if (tls && typeof tls !== "function") tls = { ...tls };
45365
45584
  this[kOptions] = {
45366
45585
  ...util.deepClone(options),
45367
45586
  maxOrigins,
45368
- connect
45587
+ connect,
45588
+ tls
45369
45589
  };
45370
45590
  this[kFactory] = factory;
45371
45591
  this[kClients] = /* @__PURE__ */ new Map();
@@ -49657,7 +49877,7 @@ var require_decorator_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
49657
49877
  //#region ../../node_modules/undici/lib/handler/redirect-handler.js
49658
49878
  var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
49659
49879
  const util = require_util$6();
49660
- const { kBodyUsed } = require_symbols();
49880
+ const { kBodyUsed, kRedirectCacheControl } = require_symbols();
49661
49881
  const assert$12 = require("node:assert");
49662
49882
  const { InvalidArgumentError } = require_errors$2();
49663
49883
  const EE$1 = require("node:events");
@@ -49697,6 +49917,10 @@ var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
49697
49917
  this.maxRedirections = maxRedirections;
49698
49918
  this.handler = handler;
49699
49919
  this.history = [];
49920
+ Object.defineProperty(this.history, kRedirectCacheControl, {
49921
+ value: [],
49922
+ enumerable: false
49923
+ });
49700
49924
  if (util.isStream(this.opts.body)) {
49701
49925
  if (util.bodyLength(this.opts.body) === 0) this.opts.body.on("data", function() {
49702
49926
  assert$12(false);
@@ -49737,6 +49961,7 @@ var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
49737
49961
  this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
49738
49962
  return;
49739
49963
  }
49964
+ this.history[kRedirectCacheControl].push(headers["cache-control"]);
49740
49965
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
49741
49966
  const path = search ? `${pathname}${search}` : pathname;
49742
49967
  const redirectUrlString = `${origin}${path}`;
@@ -51018,9 +51243,22 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51018
51243
  //#region ../../node_modules/undici/lib/handler/cache-handler.js
51019
51244
  var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51020
51245
  const util = require_util$6();
51246
+ const { kRedirectCacheControl } = require_symbols();
51021
51247
  const { parseCacheControlHeader, hasInvalidCacheControlDirective, parseVaryHeader, hasVaryStar, isInvalidOrWildcardVaryHeader, isEtagUsable } = require_cache$2();
51022
51248
  const { parseHttpDate } = require_date();
51023
51249
  function noop() {}
51250
+ /**
51251
+ * @param {string | URL} a
51252
+ * @param {string | URL} b
51253
+ * @returns {boolean}
51254
+ */
51255
+ function sameOrigin(a, b) {
51256
+ try {
51257
+ return new URL(String(a)).origin === new URL(String(b)).origin;
51258
+ } catch {
51259
+ return String(a) === String(b);
51260
+ }
51261
+ }
51024
51262
  const HEURISTICALLY_CACHEABLE_STATUS_CODES = [
51025
51263
  200,
51026
51264
  203,
@@ -51124,6 +51362,13 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
51124
51362
  */
51125
51363
  #writeStream;
51126
51364
  /**
51365
+ * The URLs visited while following redirects, shared by reference from the
51366
+ * redirect handler through the request context. Carries the suppressed hops'
51367
+ * cache-control under {@link kRedirectCacheControl}.
51368
+ * @type {URL[] | undefined}
51369
+ */
51370
+ #history;
51371
+ /**
51127
51372
  * @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
51128
51373
  * @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
51129
51374
  * @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
@@ -51138,6 +51383,7 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
51138
51383
  onRequestStart(controller, context) {
51139
51384
  this.#writeStream?.destroy();
51140
51385
  this.#writeStream = void 0;
51386
+ this.#history = context?.history;
51141
51387
  this.#handler.onRequestStart?.(controller, context);
51142
51388
  }
51143
51389
  onRequestUpgrade(controller, statusCode, headers, socket) {
@@ -51156,6 +51402,15 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
51156
51402
  invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
51157
51403
  return downstreamOnHeaders();
51158
51404
  }
51405
+ if (this.#history && this.#history.length > 0) {
51406
+ const finalUrl = this.#history[this.#history.length - 1];
51407
+ if (!sameOrigin(finalUrl.origin, this.#cacheKey.origin)) return downstreamOnHeaders();
51408
+ }
51409
+ const redirectCacheControl = this.#history?.[kRedirectCacheControl];
51410
+ if (redirectCacheControl) for (const hopCacheControl of redirectCacheControl) {
51411
+ const hopDirectives = hopCacheControl ? parseCacheControlHeader(hopCacheControl) : {};
51412
+ if (hopDirectives["no-store"] === true || this.#cacheType === "shared" && hopDirectives.private === true) return downstreamOnHeaders();
51413
+ }
51159
51414
  const cacheControlHeader = resHeaders["cache-control"];
51160
51415
  const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
51161
51416
  if (revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives)) {
@@ -52246,7 +52501,12 @@ var require_decompress = /* @__PURE__ */ __commonJSMin(((exports, module) => {
52246
52501
  }
52247
52502
  this.#decompressedSize = decompressedSize;
52248
52503
  }
52249
- if (super.onResponseData(this.#controller, chunk) === false && !this.#controller.paused) this.#controller.pause();
52504
+ try {
52505
+ if (super.onResponseData(this.#controller, chunk) === false && !this.#controller.paused) this.#controller.pause();
52506
+ } catch (err) {
52507
+ this.#fail(err);
52508
+ return;
52509
+ }
52250
52510
  }
52251
52511
  } while (this.#drainRequested && !this.#terminated && !this.#controller.paused);
52252
52512
  } finally {
@@ -52257,9 +52517,14 @@ var require_decompress = /* @__PURE__ */ __commonJSMin(((exports, module) => {
52257
52517
  }
52258
52518
  #finishIfReady() {
52259
52519
  if (this.#terminated || !this.#completionPending || this.#controller.paused || this.#draining) return;
52260
- this.#terminated = true;
52261
52520
  this.#cleanupDecompressors();
52262
- super.onResponseEnd(this.#controller, this.#trailers);
52521
+ try {
52522
+ super.onResponseEnd(this.#controller, this.#trailers);
52523
+ } catch (err) {
52524
+ this.#fail(err);
52525
+ return;
52526
+ }
52527
+ this.#terminated = true;
52263
52528
  }
52264
52529
  #onDecompressionEnd() {
52265
52530
  if (this.#terminated) return;
@@ -52494,6 +52759,7 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
52494
52759
  * @property {number} bufferedBytes
52495
52760
  * @property {object | null} pendingTrailers
52496
52761
  * @property {boolean} done
52762
+ * @property {boolean} [pendingStart] onRequestStart deferred until the primary request's context is known
52497
52763
  */
52498
52764
  /**
52499
52765
  * Handler that forwards response events to multiple waiting handlers.
@@ -52507,6 +52773,18 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
52507
52773
  */
52508
52774
  #primaryHandler;
52509
52775
  /**
52776
+ * Whether the primary request has started (onRequestStart received). Until
52777
+ * then the request context is unknown and cannot be given to waiting handlers.
52778
+ * @type {boolean}
52779
+ */
52780
+ #requestStarted = false;
52781
+ /**
52782
+ * The primary request context, replayed to waiting handlers so they observe
52783
+ * the same redirect history as the primary.
52784
+ * @type {any}
52785
+ */
52786
+ #context = null;
52787
+ /**
52510
52788
  * @type {WaitingHandler[]}
52511
52789
  */
52512
52790
  #waitingHandlers = [];
@@ -52572,12 +52850,14 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
52572
52850
  const waitingHandler = this.#createWaitingHandler(handler);
52573
52851
  const waitingController = waitingHandler.controller;
52574
52852
  try {
52575
- handler.onRequestStart?.(waitingController, null);
52576
- if (waitingController.aborted) {
52577
- waitingHandler.done = true;
52578
- return true;
52579
- }
52580
- if (this.#responseStarted) handler.onResponseStart?.(waitingController, this.#statusCode, this.#headers, this.#statusMessage);
52853
+ if (this.#requestStarted) {
52854
+ handler.onRequestStart?.(waitingController, this.#context);
52855
+ if (waitingController.aborted) {
52856
+ waitingHandler.done = true;
52857
+ return true;
52858
+ }
52859
+ if (this.#responseStarted) handler.onResponseStart?.(waitingController, this.#statusCode, this.#headers, this.#statusMessage);
52860
+ } else waitingHandler.pendingStart = true;
52581
52861
  } catch {
52582
52862
  waitingHandler.done = true;
52583
52863
  return true;
@@ -52591,6 +52871,19 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
52591
52871
  */
52592
52872
  onRequestStart(controller, context) {
52593
52873
  this.#controller = controller;
52874
+ if (!this.#requestStarted) {
52875
+ this.#requestStarted = true;
52876
+ this.#context = context;
52877
+ for (const waitingHandler of this.#waitingHandlers) if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
52878
+ waitingHandler.pendingStart = false;
52879
+ try {
52880
+ waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context);
52881
+ } catch {
52882
+ waitingHandler.done = true;
52883
+ }
52884
+ }
52885
+ this.#pruneDoneWaitingHandlers();
52886
+ }
52594
52887
  this.#primaryHandler.onRequestStart?.(controller, context);
52595
52888
  }
52596
52889
  /**
@@ -52711,7 +53004,8 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
52711
53004
  bufferedChunks: [],
52712
53005
  bufferedBytes: 0,
52713
53006
  pendingTrailers: null,
52714
- done: false
53007
+ done: false,
53008
+ pendingStart: false
52715
53009
  };
52716
53010
  const state = {
52717
53011
  aborted: false,
@@ -54529,6 +54823,7 @@ var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54529
54823
  var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54530
54824
  const assert$6 = require("node:assert");
54531
54825
  const { runtimeFeatures } = require_runtime_features();
54826
+ const { asciiLowercase } = require_infra();
54532
54827
  /**
54533
54828
  * @typedef {object} Metadata
54534
54829
  * @property {SRIHashAlgorithm} alg - The algorithm used for the hash.
@@ -54573,11 +54868,12 @@ var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, mod
54573
54868
  const getSRIHashAlgorithmIndex = Map.prototype.get.bind(validSRIHashAlgorithmTokenSet);
54574
54869
  /**
54575
54870
  * @typedef IsValidSRIHashAlgorithm
54871
+ * @see https://w3c.github.io/webappsec-subresource-integrity/#valid-sri-hash-algorithm-token
54576
54872
  * @type {(algorithm: string) => algorithm is SRIHashAlgorithm}
54577
54873
  * @param {*} algorithm
54578
54874
  * @returns {algorithm is SRIHashAlgorithm}
54579
54875
  */
54580
- const isValidSRIHashAlgorithm = Map.prototype.has.bind(validSRIHashAlgorithmTokenSet);
54876
+ const isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
54581
54877
  /**
54582
54878
  * @param {Uint8Array} bytes
54583
54879
  * @param {string} metadataList
@@ -54641,7 +54937,7 @@ var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, mod
54641
54937
  if (!isValidSRIHashAlgorithm(algorithm)) continue;
54642
54938
  if (algorithmAndValue[1]) base64Value = algorithmAndValue[1];
54643
54939
  const metadata = {
54644
- alg: algorithm,
54940
+ alg: asciiLowercase(algorithm),
54645
54941
  val: base64Value
54646
54942
  };
54647
54943
  result.push(metadata);
@@ -55333,9 +55629,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
55333
55629
  if (Array.isArray(value) && !Buffer.isBuffer(rawHeaders[i + 1])) for (const val of value) headersList.append(nameStr, val.toString("latin1"), true);
55334
55630
  else headersList.append(nameStr, value.toString("latin1"), true);
55335
55631
  }
55336
- const location = headersList.get("location", true);
55337
- this.body = new Readable$7({ read: resume });
55338
- const willFollow = location && request.redirect === "follow" && redirectStatusSet.has(status);
55632
+ const willFollow = headersList.get("location", true) && request.redirect === "follow" && redirectStatusSet.has(status);
55339
55633
  const decoders = [];
55340
55634
  if (request.method !== "HEAD" && request.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
55341
55635
  const contentEncoding = headersList.get("content-encoding", true);
@@ -55343,7 +55637,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
55343
55637
  const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : [];
55344
55638
  const maxContentEncodings = 5;
55345
55639
  if (codings.length > maxContentEncodings) {
55346
- reject(/* @__PURE__ */ new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
55640
+ this.abort(/* @__PURE__ */ new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
55347
55641
  return true;
55348
55642
  }
55349
55643
  for (let i = codings.length - 1; i >= 0; --i) {
@@ -55370,6 +55664,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
55370
55664
  }
55371
55665
  }
55372
55666
  }
55667
+ this.body = new Readable$7({ read: resume });
55373
55668
  const onError = this.onError.bind(this);
55374
55669
  resolve({
55375
55670
  status,
@@ -56236,7 +56531,10 @@ var require_util$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
56236
56531
  validateCookiePath(cookie.path);
56237
56532
  out.push(`Path=${cookie.path}`);
56238
56533
  }
56239
- if (cookie.expires && cookie.expires.toString() !== "Invalid Date") out.push(`Expires=${toIMFDate(cookie.expires)}`);
56534
+ if (cookie.expires != null) {
56535
+ const expiresMs = cookie.expires instanceof Date ? cookie.expires.getTime() : cookie.expires;
56536
+ if (typeof expiresMs === "number" && Number.isFinite(expiresMs) && Math.abs(expiresMs) <= 864e13) out.push(`Expires=${toIMFDate(cookie.expires)}`);
56537
+ }
56240
56538
  if (cookie.sameSite) out.push(`SameSite=${cookie.sameSite}`);
56241
56539
  for (const part of cookie.unparsed) {
56242
56540
  if (!part.includes("=")) throw new Error("Invalid unparsed");
@@ -56304,56 +56602,57 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
56304
56602
  * @param {Object.<string, unknown>} [cookieAttributeList={}]
56305
56603
  */
56306
56604
  function parseUnparsedAttributes(unparsedAttributes, cookieAttributeList = {}) {
56307
- if (unparsedAttributes.length === 0) return cookieAttributeList;
56308
- assert$2(unparsedAttributes[0] === ";");
56309
- unparsedAttributes = unparsedAttributes.slice(1);
56310
- let cookieAv = "";
56311
- if (unparsedAttributes.includes(";")) {
56312
- cookieAv = collectASequenceOfCodePointsFast(";", unparsedAttributes, { position: 0 });
56313
- unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
56314
- } else {
56315
- cookieAv = unparsedAttributes;
56316
- unparsedAttributes = "";
56317
- }
56318
- let attributeName = "";
56319
- let attributeValue = "";
56320
- if (cookieAv.includes("=")) {
56321
- const position = { position: 0 };
56322
- attributeName = collectASequenceOfCodePointsFast("=", cookieAv, position);
56323
- attributeValue = cookieAv.slice(position.position + 1);
56324
- } else attributeName = cookieAv;
56325
- attributeName = attributeName.trim();
56326
- attributeValue = attributeValue.trim();
56327
- if (attributeValue.length > maxAttributeValueSize) return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
56328
- const attributeNameLowercase = attributeName.toLowerCase();
56329
- if (attributeNameLowercase === "expires") cookieAttributeList.expires = new Date(attributeValue);
56330
- else if (attributeNameLowercase === "max-age") {
56331
- const charCode = attributeValue.charCodeAt(0);
56332
- if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
56333
- if (!/^\d+$/.test(attributeValue)) return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
56334
- cookieAttributeList.maxAge = Number(attributeValue);
56335
- } else if (attributeNameLowercase === "domain") {
56336
- let cookieDomain = attributeValue;
56337
- if (cookieDomain[0] === ".") cookieDomain = cookieDomain.slice(1);
56338
- cookieDomain = cookieDomain.toLowerCase();
56339
- cookieAttributeList.domain = cookieDomain;
56340
- } else if (attributeNameLowercase === "path") {
56341
- let cookiePath = "";
56342
- if (attributeValue.length === 0 || attributeValue[0] !== "/") cookiePath = "/";
56343
- else cookiePath = attributeValue;
56344
- cookieAttributeList.path = cookiePath;
56345
- } else if (attributeNameLowercase === "secure") cookieAttributeList.secure = true;
56346
- else if (attributeNameLowercase === "httponly") cookieAttributeList.httpOnly = true;
56347
- else if (attributeNameLowercase === "samesite") {
56348
- const attributeValueLowercase = attributeValue.toLowerCase();
56349
- if (attributeValueLowercase === "none") cookieAttributeList.sameSite = "None";
56350
- else if (attributeValueLowercase === "strict") cookieAttributeList.sameSite = "Strict";
56351
- else if (attributeValueLowercase === "lax") cookieAttributeList.sameSite = "Lax";
56352
- } else {
56353
- cookieAttributeList.unparsed ??= [];
56354
- cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
56605
+ while (true) {
56606
+ if (unparsedAttributes.length === 0) return cookieAttributeList;
56607
+ assert$2(unparsedAttributes[0] === ";");
56608
+ unparsedAttributes = unparsedAttributes.slice(1);
56609
+ let cookieAv = "";
56610
+ if (unparsedAttributes.includes(";")) {
56611
+ cookieAv = collectASequenceOfCodePointsFast(";", unparsedAttributes, { position: 0 });
56612
+ unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
56613
+ } else {
56614
+ cookieAv = unparsedAttributes;
56615
+ unparsedAttributes = "";
56616
+ }
56617
+ let attributeName = "";
56618
+ let attributeValue = "";
56619
+ if (cookieAv.includes("=")) {
56620
+ const position = { position: 0 };
56621
+ attributeName = collectASequenceOfCodePointsFast("=", cookieAv, position);
56622
+ attributeValue = cookieAv.slice(position.position + 1);
56623
+ } else attributeName = cookieAv;
56624
+ attributeName = attributeName.trim();
56625
+ attributeValue = attributeValue.trim();
56626
+ if (attributeValue.length > maxAttributeValueSize) continue;
56627
+ const attributeNameLowercase = attributeName.toLowerCase();
56628
+ if (attributeNameLowercase === "expires") cookieAttributeList.expires = new Date(attributeValue);
56629
+ else if (attributeNameLowercase === "max-age") {
56630
+ const charCode = attributeValue.charCodeAt(0);
56631
+ if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") continue;
56632
+ if (!/^\d+$/.test(attributeValue)) continue;
56633
+ cookieAttributeList.maxAge = Number(attributeValue);
56634
+ } else if (attributeNameLowercase === "domain") {
56635
+ let cookieDomain = attributeValue;
56636
+ if (cookieDomain[0] === ".") cookieDomain = cookieDomain.slice(1);
56637
+ cookieDomain = cookieDomain.toLowerCase();
56638
+ cookieAttributeList.domain = cookieDomain;
56639
+ } else if (attributeNameLowercase === "path") {
56640
+ let cookiePath = "";
56641
+ if (attributeValue.length === 0 || attributeValue[0] !== "/") cookiePath = "/";
56642
+ else cookiePath = attributeValue;
56643
+ cookieAttributeList.path = cookiePath;
56644
+ } else if (attributeNameLowercase === "secure") cookieAttributeList.secure = true;
56645
+ else if (attributeNameLowercase === "httponly") cookieAttributeList.httpOnly = true;
56646
+ else if (attributeNameLowercase === "samesite") {
56647
+ const attributeValueLowercase = attributeValue.toLowerCase();
56648
+ if (attributeValueLowercase === "none") cookieAttributeList.sameSite = "None";
56649
+ else if (attributeValueLowercase === "strict") cookieAttributeList.sameSite = "Strict";
56650
+ else if (attributeValueLowercase === "lax") cookieAttributeList.sameSite = "Lax";
56651
+ } else {
56652
+ cookieAttributeList.unparsed ??= [];
56653
+ cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
56654
+ }
56355
56655
  }
56356
- return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
56357
56656
  }
56358
56657
  module.exports = {
56359
56658
  parseSetCookie,
@@ -56390,7 +56689,7 @@ var require_cookies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
56390
56689
  brandChecks(headers);
56391
56690
  const cookie = headers.get("cookie");
56392
56691
  /** @type {Record<string, string>} */
56393
- const out = {};
56692
+ const out = { __proto__: null };
56394
56693
  if (!cookie) return out;
56395
56694
  for (const piece of cookie.split(";")) {
56396
56695
  const [name, ...value] = piece.split("=");
@@ -57516,6 +57815,15 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
57516
57815
  if (isControlFrame(this.#info.opcode)) {
57517
57816
  this.#loop = this.parseControlFrame(body);
57518
57817
  this.#state = parserStates.INFO;
57818
+ if (this.#loop && this.#handler.socket.writableNeedDrain) {
57819
+ this.#loop = false;
57820
+ this.#handler.socket.once("drain", () => {
57821
+ if (this.destroyed) return;
57822
+ this.#loop = true;
57823
+ this.run(callback);
57824
+ });
57825
+ return;
57826
+ }
57519
57827
  } else if (!this.#info.compressed) {
57520
57828
  if (!this.writeFragments(body)) return;
57521
57829
  if (!this.#info.fragmented && this.#info.fin) websocketMessageReceived(this.#handler, this.#info.binaryType, this.consumeFragments());
@@ -58534,6 +58842,7 @@ var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
58534
58842
  //#endregion
58535
58843
  //#region ../../node_modules/undici/lib/web/eventsource/eventsource-stream.js
58536
58844
  var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
58845
+ const buffer = require("node:buffer");
58537
58846
  const { Transform } = require("node:stream");
58538
58847
  const { isASCIINumber, isValidLastEventId } = require_util$1();
58539
58848
  /**
@@ -58560,10 +58869,14 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58560
58869
  * @type {32} SPACE
58561
58870
  */
58562
58871
  const SPACE = 32;
58872
+ const defaultMaxEventSize = buffer.kStringMaxLength;
58563
58873
  const DATA = Buffer.from("data");
58564
58874
  const EVENT = Buffer.from("event");
58565
58875
  const ID = Buffer.from("id");
58566
58876
  const RETRY = Buffer.from("retry");
58877
+ const minParserItems = 1024;
58878
+ const maxParserItems = 131072;
58879
+ const bytesPerParserItem = 128;
58567
58880
  function isASCIINumberBytes(buffer, start) {
58568
58881
  if (start >= buffer.length) return false;
58569
58882
  for (let i = start; i < buffer.length; i++) if (buffer[i] < 48 || buffer[i] > 57) return false;
@@ -58578,6 +58891,11 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58578
58891
  for (let i = 0; i < length; i++) if (line[i] !== field[i]) return false;
58579
58892
  return true;
58580
58893
  }
58894
+ function createMaxEventSizeExceededError() {
58895
+ const error = /* @__PURE__ */ new Error("EventSource message size exceeded");
58896
+ error.aborted = false;
58897
+ return error;
58898
+ }
58581
58899
  /**
58582
58900
  * @typedef {object} EventSourceStreamEvent
58583
58901
  * @type {object}
@@ -58619,6 +58937,18 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58619
58937
  pos = 0;
58620
58938
  lineChunkIndex = 0;
58621
58939
  linePos = 0;
58940
+ lineLength = 0;
58941
+ eventSize = 0;
58942
+ eventFieldSizes = {
58943
+ data: 0,
58944
+ event: 0,
58945
+ id: 0,
58946
+ retry: 0
58947
+ };
58948
+ dataLineCount = 0;
58949
+ maxEventSize;
58950
+ maxDataLines;
58951
+ maxBufferedChunks;
58622
58952
  event = {
58623
58953
  data: void 0,
58624
58954
  event: void 0,
@@ -58628,6 +58958,7 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58628
58958
  /**
58629
58959
  * @param {object} options
58630
58960
  * @param {boolean} [options.readableObjectMode]
58961
+ * @param {number} [options.maxEventSize]
58631
58962
  * @param {eventSourceSettings} [options.eventSourceSettings]
58632
58963
  * @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
58633
58964
  */
@@ -58635,6 +58966,10 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58635
58966
  options.readableObjectMode = true;
58636
58967
  super(options);
58637
58968
  this.state = options.eventSourceSettings || {};
58969
+ this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize;
58970
+ const parserItemLimit = this.maxEventSize > 0 ? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem))) : 0;
58971
+ this.maxDataLines = parserItemLimit;
58972
+ this.maxBufferedChunks = parserItemLimit;
58638
58973
  if (options.push) this.push = options.push;
58639
58974
  }
58640
58975
  /**
@@ -58648,6 +58983,10 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58648
58983
  callback();
58649
58984
  return;
58650
58985
  }
58986
+ if (this.maxEventSize > 0 && this.chunks.length >= this.maxBufferedChunks && chunk[0] !== LF && chunk[0] !== CR) {
58987
+ callback(createMaxEventSizeExceededError());
58988
+ return;
58989
+ }
58651
58990
  this.chunks.push(chunk);
58652
58991
  if (this.checkBOM) {
58653
58992
  if (this.handleBOM()) {
@@ -58678,15 +59017,29 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58678
59017
  }
58679
59018
  if (byte === LF || byte === CR) {
58680
59019
  if (byte === CR) this.crlfCheck = true;
58681
- this.parseLine(this.readLine(), this.event);
59020
+ try {
59021
+ this.parseLine(this.readLine(), this.event);
59022
+ } catch (error) {
59023
+ callback(error);
59024
+ return;
59025
+ }
58682
59026
  this.consumeCurrentByte();
58683
59027
  this.eventEndCheck = true;
58684
59028
  continue;
58685
59029
  }
59030
+ if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
59031
+ callback(createMaxEventSizeExceededError());
59032
+ return;
59033
+ }
58686
59034
  this.advanceCursor();
58687
59035
  }
58688
59036
  callback();
58689
59037
  }
59038
+ _destroy(error, callback) {
59039
+ this.chunks.length = 0;
59040
+ this.clearEvent();
59041
+ super._destroy(error, callback);
59042
+ }
58690
59043
  /**
58691
59044
  * @param {Buffer} line
58692
59045
  * @param {EventSourceStreamEvent} event
@@ -58703,24 +59056,43 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58703
59056
  if (line[valueStart] === SPACE) ++valueStart;
58704
59057
  }
58705
59058
  if (isFieldName(line, fieldLength, DATA)) {
59059
+ if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) throw createMaxEventSizeExceededError();
59060
+ const valueBytes = line.length - valueStart;
59061
+ const dataSize = this.eventFieldSizes.data + (event.data === void 0 ? 0 : 1) + valueBytes;
59062
+ this.setEventFieldSize("data", dataSize);
58706
59063
  const value = line.toString("utf8", valueStart);
58707
59064
  if (event.data === void 0) event.data = value;
58708
59065
  else event.data += `\n${value}`;
59066
+ this.dataLineCount++;
58709
59067
  return;
58710
59068
  }
58711
59069
  if (isFieldName(line, fieldLength, RETRY)) {
58712
- if (isASCIINumberBytes(line, valueStart)) event.retry = line.toString("utf8", valueStart);
59070
+ if (isASCIINumberBytes(line, valueStart)) {
59071
+ this.setEventFieldSize("retry", line.length - valueStart);
59072
+ event.retry = line.toString("utf8", valueStart);
59073
+ }
58713
59074
  return;
58714
59075
  }
58715
59076
  if (isFieldName(line, fieldLength, ID)) {
58716
- if (isValidLastEventIdBytes(line, valueStart)) event.id = line.toString("utf8", valueStart);
59077
+ if (isValidLastEventIdBytes(line, valueStart)) {
59078
+ this.setEventFieldSize("id", line.length - valueStart);
59079
+ event.id = line.toString("utf8", valueStart);
59080
+ }
58717
59081
  return;
58718
59082
  }
58719
59083
  if (isFieldName(line, fieldLength, EVENT)) {
58720
- const value = line.toString("utf8", valueStart);
58721
- if (value.length > 0) event.event = value;
59084
+ if (valueStart < line.length) {
59085
+ this.setEventFieldSize("event", line.length - valueStart);
59086
+ event.event = line.toString("utf8", valueStart);
59087
+ }
58722
59088
  }
58723
59089
  }
59090
+ setEventFieldSize(field, size) {
59091
+ const eventSize = this.eventSize - this.eventFieldSizes[field] + size;
59092
+ if (this.maxEventSize > 0 && eventSize > this.maxEventSize) throw createMaxEventSizeExceededError();
59093
+ this.eventSize = eventSize;
59094
+ this.eventFieldSizes[field] = size;
59095
+ }
58724
59096
  /**
58725
59097
  * @param {EventSourceStreamEvent} event
58726
59098
  */
@@ -58741,6 +59113,12 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58741
59113
  this.event.event = void 0;
58742
59114
  this.event.id = void 0;
58743
59115
  this.event.retry = void 0;
59116
+ this.eventSize = 0;
59117
+ this.dataLineCount = 0;
59118
+ this.eventFieldSizes.data = 0;
59119
+ this.eventFieldSizes.event = 0;
59120
+ this.eventFieldSizes.id = 0;
59121
+ this.eventFieldSizes.retry = 0;
58744
59122
  }
58745
59123
  hasPendingEvent() {
58746
59124
  return this.event.data !== void 0 || this.event.event !== void 0 || this.event.id !== void 0 || this.event.retry !== void 0;
@@ -58765,13 +59143,15 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
58765
59143
  syncLineStartToCursor() {
58766
59144
  this.lineChunkIndex = this.chunkIndex;
58767
59145
  this.linePos = this.pos;
59146
+ this.lineLength = 0;
58768
59147
  this.dropConsumedChunks();
58769
59148
  }
58770
59149
  dropConsumedChunks() {
58771
- while (this.lineChunkIndex > 0) {
58772
- this.chunks.shift();
58773
- this.lineChunkIndex--;
58774
- this.chunkIndex--;
59150
+ if (this.lineChunkIndex > 0) {
59151
+ const consumed = this.lineChunkIndex;
59152
+ this.chunks.splice(0, consumed);
59153
+ this.lineChunkIndex = 0;
59154
+ this.chunkIndex -= consumed;
58775
59155
  }
58776
59156
  if (this.chunkIndex === this.chunks.length) {
58777
59157
  this.chunks.length = 0;
@@ -58857,6 +59237,7 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
58857
59237
  const { isNetworkError } = require_response();
58858
59238
  const { kEnumerableProperty } = require_util$6();
58859
59239
  const { environmentSettingsObject } = require_util$5();
59240
+ const { getGlobalDispatcher } = require_global();
58860
59241
  let experimentalWarned = false;
58861
59242
  /**
58862
59243
  * A reconnection time, in milliseconds. This must initially be an implementation-defined value,
@@ -59041,6 +59422,7 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59041
59422
  this.#state.origin = response.urlList[response.urlList.length - 1].origin;
59042
59423
  const eventSourceStream = new EventSourceStream({
59043
59424
  eventSourceSettings: this.#state,
59425
+ maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
59044
59426
  push: (event) => {
59045
59427
  this.dispatchEvent(createFastMessageEvent(event.type, event.options));
59046
59428
  }
@@ -59155,7 +59537,8 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59155
59537
  },
59156
59538
  {
59157
59539
  key: "dispatcher",
59158
- converter: webidl.converters.any
59540
+ converter: webidl.converters.any,
59541
+ defaultValue: () => getGlobalDispatcher()
59159
59542
  },
59160
59543
  {
59161
59544
  key: "node",
@@ -66619,7 +67002,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
66619
67002
  }));
66620
67003
  //#endregion
66621
67004
  //#region ../../node_modules/brace-expansion/node_modules/balanced-match/dist/commonjs/index.js
66622
- var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
67005
+ var require_commonjs$7 = /* @__PURE__ */ __commonJSMin(((exports) => {
66623
67006
  Object.defineProperty(exports, "__esModule", { value: true });
66624
67007
  exports.range = exports.balanced = void 0;
66625
67008
  const balanced = (a, b, str) => {
@@ -66673,11 +67056,11 @@ var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
66673
67056
  }));
66674
67057
  //#endregion
66675
67058
  //#region ../../node_modules/brace-expansion/dist/commonjs/index.js
66676
- var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
67059
+ var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
66677
67060
  Object.defineProperty(exports, "__esModule", { value: true });
66678
67061
  exports.EXPANSION_MAX_REWRITES = exports.EXPANSION_MAX_DEPTH = exports.EXPANSION_MAX_LENGTH = exports.EXPANSION_MAX = void 0;
66679
67062
  exports.expand = expand;
66680
- const balanced_match_1 = require_commonjs$6();
67063
+ const balanced_match_1 = require_commonjs$7();
66681
67064
  const escSlash = "\0SLASH" + Math.random() + "\0";
66682
67065
  const escOpen = "\0OPEN" + Math.random() + "\0";
66683
67066
  const escClose = "\0CLOSE" + Math.random() + "\0";
@@ -66879,46 +67262,33 @@ var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
66879
67262
  }
66880
67263
  }));
66881
67264
  //#endregion
66882
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
66883
- var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
66884
- Object.defineProperty(exports, "__esModule", { value: true });
66885
- exports.assertValidPattern = void 0;
66886
- const MAX_PATTERN_LENGTH = 1024 * 64;
66887
- const assertValidPattern = (pattern) => {
66888
- if (typeof pattern !== "string") throw new TypeError("invalid pattern");
66889
- if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
66890
- };
66891
- exports.assertValidPattern = assertValidPattern;
66892
- }));
66893
- //#endregion
66894
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js
66895
- var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
67265
+ //#region ../../node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js
67266
+ var require_parse_class = /* @__PURE__ */ __commonJSMin(((exports) => {
66896
67267
  Object.defineProperty(exports, "__esModule", { value: true });
66897
67268
  exports.parseClass = void 0;
66898
67269
  const posixClasses = {
66899
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
66900
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
66901
- "[:ascii:]": ["\\x00-\\x7f", false],
66902
- "[:blank:]": ["\\p{Zs}\\t", true],
66903
- "[:cntrl:]": ["\\p{Cc}", true],
66904
- "[:digit:]": ["\\p{Nd}", true],
66905
- "[:graph:]": [
66906
- "\\p{Z}\\p{C}",
66907
- true,
66908
- true
66909
- ],
66910
- "[:lower:]": ["\\p{Ll}", true],
67270
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
67271
+ "[:alpha:]": ["\\p{L}\\p{Nl}"],
67272
+ "[:ascii:]": ["\\x00-\\x7f"],
67273
+ "[:blank:]": ["\\p{Zs}\\t"],
67274
+ "[:cntrl:]": ["\\p{Cc}"],
67275
+ "[:digit:]": ["\\p{Nd}"],
67276
+ "[:graph:]": ["\\p{Z}\\p{C}", true],
67277
+ "[:lower:]": ["\\p{Ll}"],
66911
67278
  "[:print:]": ["\\p{C}", true],
66912
- "[:punct:]": ["\\p{P}", true],
66913
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
66914
- "[:upper:]": ["\\p{Lu}", true],
66915
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
66916
- "[:xdigit:]": ["A-Fa-f0-9", false]
67279
+ "[:punct:]": ["\\p{P}\\p{S}"],
67280
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"],
67281
+ "[:upper:]": ["\\p{Lu}"],
67282
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
67283
+ "[:xdigit:]": ["A-Fa-f0-9"]
66917
67284
  };
66918
67285
  const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
66919
- const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
66920
- const rangesToString = (ranges) => ranges.join("");
66921
- const parseClass = (glob, position) => {
67286
+ const noMatch = /$./;
67287
+ const parseClass = (glob, position, nocase = false, form) => {
67288
+ const norm = (c) => {
67289
+ const n = form ? c.normalize(form) : c;
67290
+ return [...n].length === 1 ? n : c;
67291
+ };
66922
67292
  const pos = position;
66923
67293
  /* c8 ignore start */
66924
67294
  if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
@@ -66927,13 +67297,12 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
66927
67297
  const negs = [];
66928
67298
  let i = pos + 1;
66929
67299
  let sawStart = false;
66930
- let uflag = false;
66931
67300
  let escaping = false;
66932
67301
  let negate = false;
66933
67302
  let endPos = pos;
66934
67303
  let rangeStart = "";
66935
67304
  WHILE: while (i < glob.length) {
66936
- const c = glob.charAt(i);
67305
+ const c = String.fromCodePoint(glob.codePointAt(i));
66937
67306
  if ((c === "!" || c === "^") && i === pos + 1) {
66938
67307
  negate = true;
66939
67308
  i++;
@@ -66952,71 +67321,677 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
66952
67321
  }
66953
67322
  }
66954
67323
  if (c === "[" && !escaping) {
66955
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
66956
- if (rangeStart) return [
66957
- "$.",
66958
- false,
66959
- glob.length - pos,
66960
- true
66961
- ];
67324
+ for (const [cls, [unip, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
67325
+ if (rangeStart) return [noMatch, glob.length - pos];
66962
67326
  i += cls.length;
66963
67327
  if (neg) negs.push(unip);
66964
67328
  else ranges.push(unip);
66965
- uflag = uflag || u;
66966
67329
  continue WHILE;
66967
67330
  }
66968
67331
  }
66969
67332
  escaping = false;
67333
+ const n = norm(c);
66970
67334
  if (rangeStart) {
66971
- if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
66972
- else if (c === rangeStart) ranges.push(braceEscape(c));
67335
+ if (n.codePointAt(0) > rangeStart.codePointAt(0)) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(n));
67336
+ else if (n === rangeStart) ranges.push(braceEscape(n));
66973
67337
  rangeStart = "";
66974
- i++;
67338
+ i += c.length;
66975
67339
  continue;
66976
67340
  }
66977
- if (glob.startsWith("-]", i + 1)) {
66978
- ranges.push(braceEscape(c + "-"));
66979
- i += 2;
67341
+ if (glob.startsWith("-]", i + c.length)) {
67342
+ ranges.push(braceEscape(n + "-"));
67343
+ i += c.length + 1;
66980
67344
  continue;
66981
67345
  }
66982
- if (glob.startsWith("-", i + 1)) {
66983
- rangeStart = c;
66984
- i += 2;
67346
+ if (glob.startsWith("-", i + c.length)) {
67347
+ rangeStart = n;
67348
+ i += c.length + 1;
66985
67349
  continue;
66986
67350
  }
66987
- ranges.push(braceEscape(c));
66988
- i++;
67351
+ ranges.push(braceEscape(n));
67352
+ i += c.length;
66989
67353
  }
66990
- if (endPos < i) return [
66991
- "",
66992
- false,
66993
- 0,
66994
- false
66995
- ];
66996
- if (!ranges.length && !negs.length) return [
66997
- "$.",
66998
- false,
66999
- glob.length - pos,
67000
- true
67001
- ];
67002
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) return [
67003
- regexpEscape(ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]),
67004
- false,
67005
- endPos - pos,
67006
- false
67007
- ];
67008
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
67009
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
67010
- return [
67011
- ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
67012
- uflag,
67013
- endPos - pos,
67014
- true
67015
- ];
67354
+ if (endPos < i) return [noMatch, 0];
67355
+ if (!ranges.length && !negs.length) return [noMatch, glob.length - pos];
67356
+ const sranges = "[" + (negate ? "^" : "") + ranges.join("") + "]";
67357
+ const snegs = "[" + (negate ? "" : "^") + negs.join("") + "]";
67358
+ const comb = "^" + (ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs);
67359
+ return [new RegExp(comb, nocase ? "iu" : "u"), endPos - pos];
67016
67360
  };
67017
67361
  exports.parseClass = parseClass;
67018
67362
  }));
67019
67363
  //#endregion
67364
+ //#region ../../node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js
67365
+ var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
67366
+ Object.defineProperty(exports, "__esModule", { value: true });
67367
+ exports.Matcher = void 0;
67368
+ const parse_class_js_1 = require_parse_class();
67369
+ const MATCH = {
67370
+ t: "match",
67371
+ id: 0
67372
+ };
67373
+ const extTypes = "!?+*@";
67374
+ const lit = (ch) => ({
67375
+ t: "lit",
67376
+ ch
67377
+ });
67378
+ const reEscape = (s) => s.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
67379
+ const newFoldRe = (s) => new RegExp(`^${reEscape(s)}$`, "iu");
67380
+ const foldCache = /* @__PURE__ */ new Map();
67381
+ const foldRe = (ch) => {
67382
+ let re = foldCache.get(ch);
67383
+ if (!re) {
67384
+ re = newFoldRe(ch);
67385
+ if (foldCache.size >= 1e3) foldCache.clear();
67386
+ foldCache.set(ch, re);
67387
+ }
67388
+ return re;
67389
+ };
67390
+ const litMatch = (l, c) => {
67391
+ if (c === l.ch) return true;
67392
+ if (!l.re) return false;
67393
+ const code = c.charCodeAt(0);
67394
+ if (code >= 128) return l.re.test(c);
67395
+ const ascii = l.ascii ??= new Uint8Array(128);
67396
+ ascii[code] ||= l.re.test(c) ? 1 : 2;
67397
+ return ascii[code] === 1;
67398
+ };
67399
+ const tokenize = (p, nocase, noext, form) => {
67400
+ const toks = [];
67401
+ for (let i = 0; i < p.length;) {
67402
+ const c = String.fromCodePoint(p.codePointAt(i));
67403
+ if (c === "\\") {
67404
+ const e = p.codePointAt(i + 1);
67405
+ const ch = e === void 0 ? c : String.fromCodePoint(e);
67406
+ toks.push(lit(ch));
67407
+ i += 1 + ch.length;
67408
+ continue;
67409
+ }
67410
+ if (c === "[") {
67411
+ const [re, consumed] = (0, parse_class_js_1.parseClass)(p, i, nocase, form);
67412
+ if (consumed) {
67413
+ toks.push({
67414
+ t: "class",
67415
+ re
67416
+ });
67417
+ i += consumed;
67418
+ continue;
67419
+ }
67420
+ }
67421
+ if (!noext && extTypes.includes(c) && p[i + 1] === "(") {
67422
+ toks.push({
67423
+ t: "open",
67424
+ type: c
67425
+ });
67426
+ i += 2;
67427
+ continue;
67428
+ }
67429
+ toks.push(!noext && c === "|" ? { t: "bar" } : !noext && c === ")" ? { t: "close" } : c === "*" ? { t: "star" } : c === "?" ? { t: "any" } : lit(c));
67430
+ i += c.length;
67431
+ }
67432
+ return toks;
67433
+ };
67434
+ const pair = (toks) => {
67435
+ const pairs = /* @__PURE__ */ new Map();
67436
+ const stack = [];
67437
+ toks.forEach((tok, i) => {
67438
+ if (tok.t === "open") stack.push(i);
67439
+ else if (tok.t === "close" && stack.length) pairs.set(stack.pop(), i);
67440
+ });
67441
+ return pairs;
67442
+ };
67443
+ const build = (toks, pairs, start, end, top) => {
67444
+ let seq = [];
67445
+ const alts = [seq];
67446
+ for (let i = start; i < end; i++) {
67447
+ const tok = toks[i];
67448
+ const close = pairs.get(i);
67449
+ if (tok.t === "open" && close !== void 0) {
67450
+ const sub = build(toks, pairs, i + 1, close, false);
67451
+ seq.push({
67452
+ t: "ext",
67453
+ type: tok.type,
67454
+ alts: sub
67455
+ });
67456
+ i = close;
67457
+ } else if (tok.t === "bar" && !top) alts.push(seq = []);
67458
+ else if (tok.t === "open") seq.push(lit(tok.type), lit("("));
67459
+ else if (tok.t === "bar") seq.push(lit("|"));
67460
+ else if (tok.t === "close") seq.push(lit(")"));
67461
+ else seq.push(tok);
67462
+ }
67463
+ return alts;
67464
+ };
67465
+ const normalize = (items, form) => {
67466
+ const out = [];
67467
+ let run = "";
67468
+ const flush = () => {
67469
+ for (const ch of run.normalize(form)) out.push(lit(ch));
67470
+ run = "";
67471
+ };
67472
+ for (const it of items) {
67473
+ if (it.t === "lit") {
67474
+ run += it.ch;
67475
+ continue;
67476
+ }
67477
+ flush();
67478
+ out.push(it.t === "ext" ? {
67479
+ ...it,
67480
+ alts: it.alts.map((a) => normalize(a, form))
67481
+ } : it);
67482
+ }
67483
+ flush();
67484
+ return out;
67485
+ };
67486
+ const compile = (items, nocase) => {
67487
+ let id = 1;
67488
+ const split = (out) => ({
67489
+ t: "split",
67490
+ id: id++,
67491
+ out
67492
+ });
67493
+ const seq = (items, next) => items.reduceRight((next, it) => item(it, next), next);
67494
+ const item = (it, next) => {
67495
+ switch (it.t) {
67496
+ case "lit":
67497
+ const re = nocase ? foldRe(it.ch) : void 0;
67498
+ return {
67499
+ t: "lit",
67500
+ id: id++,
67501
+ ch: it.ch,
67502
+ re,
67503
+ next
67504
+ };
67505
+ case "any":
67506
+ case "star": return {
67507
+ t: it.t,
67508
+ id: id++,
67509
+ next
67510
+ };
67511
+ case "class": return {
67512
+ t: "class",
67513
+ id: id++,
67514
+ re: it.re,
67515
+ next
67516
+ };
67517
+ }
67518
+ const alts = (next) => it.alts.map((a) => seq(a, next));
67519
+ switch (it.type) {
67520
+ case "@": return split(alts(next));
67521
+ case "?": return split([next, ...alts(next)]);
67522
+ case "!": return {
67523
+ t: "neg",
67524
+ id: id++,
67525
+ sub: split(alts(MATCH)),
67526
+ next
67527
+ };
67528
+ }
67529
+ const after = split([]);
67530
+ const entry = split(alts(after));
67531
+ after.out.push(next, entry);
67532
+ return it.type === "*" ? after : entry;
67533
+ };
67534
+ return [seq(items, MATCH), id];
67535
+ };
67536
+ const show = (start) => {
67537
+ const lines = [];
67538
+ const seen = /* @__PURE__ */ new Set();
67539
+ const ref = (n) => n.t === "match" ? "match" : String(n.id);
67540
+ const walk = (n, indent) => {
67541
+ if (n.t === "match" || seen.has(n)) return;
67542
+ seen.add(n);
67543
+ const line = (desc) => lines.push(`${indent}${n.id}: ${desc}`);
67544
+ switch (n.t) {
67545
+ case "split":
67546
+ line(`split -> ${n.out.map(ref).join(", ")}`);
67547
+ for (const o of n.out) walk(o, indent);
67548
+ return;
67549
+ case "neg":
67550
+ line(`!(${ref(n.sub)}) -> ${ref(n.next)}`);
67551
+ walk(n.sub, indent + " ");
67552
+ return walk(n.next, indent);
67553
+ case "lit":
67554
+ line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`);
67555
+ break;
67556
+ case "class":
67557
+ line(`${n.re} -> ${ref(n.next)}`);
67558
+ break;
67559
+ default: line(`${n.t === "any" ? "?" : "*"} -> ${ref(n.next)}`);
67560
+ }
67561
+ walk(n.next, indent);
67562
+ };
67563
+ walk(start, "");
67564
+ return [`start -> ${ref(start)}`, ...lines].join("\n");
67565
+ };
67566
+ var State = class {
67567
+ gen;
67568
+ threads = [];
67569
+ match = false;
67570
+ runs = [];
67571
+ ids = [];
67572
+ constructor(gen) {
67573
+ this.gen = gen;
67574
+ }
67575
+ get dead() {
67576
+ return !this.threads.length && !this.match && !this.runs.length;
67577
+ }
67578
+ };
67579
+ const sameState = (a, b) => {
67580
+ if (a.ids.length !== b.ids.length) return false;
67581
+ if (a.runs.length !== b.runs.length) return false;
67582
+ if (a.ids.some((id, i) => id !== b.ids[i])) return false;
67583
+ return a.runs.every((r) => b.runs.some((o) => o.neg === r.neg && sameState(o.state, r.state)));
67584
+ };
67585
+ const marks = (size) => ({
67586
+ has: new Float64Array(size),
67587
+ seen: new Float64Array(size),
67588
+ gen: 0
67589
+ });
67590
+ var Sim = class {
67591
+ dots;
67592
+ dotStart;
67593
+ #marks;
67594
+ constructor(dots, dotStart, marks) {
67595
+ this.dots = dots;
67596
+ this.dotStart = dotStart;
67597
+ this.#marks = marks;
67598
+ }
67599
+ state() {
67600
+ return new State(++this.#marks.gen);
67601
+ }
67602
+ done(state) {
67603
+ state.ids = state.threads.map((n) => n.id).sort((a, b) => a - b);
67604
+ if (state.match) state.ids.unshift(MATCH.id);
67605
+ return state;
67606
+ }
67607
+ #visit(state, node) {
67608
+ const { seen } = this.#marks;
67609
+ if (seen[node.id] === state.gen) return false;
67610
+ seen[node.id] = state.gen;
67611
+ return true;
67612
+ }
67613
+ #addThread(state, node) {
67614
+ const { has } = this.#marks;
67615
+ if (has[node.id] === state.gen) return false;
67616
+ has[node.id] = state.gen;
67617
+ state.threads.push(node);
67618
+ return true;
67619
+ }
67620
+ restricted(i, top) {
67621
+ return top && (this.dots || this.dotStart && i === 0);
67622
+ }
67623
+ add(state, node, i, top) {
67624
+ switch (node.t) {
67625
+ case "split":
67626
+ if (!this.#visit(state, node)) return;
67627
+ for (const o of node.out) this.add(state, o, i, top);
67628
+ return;
67629
+ case "neg":
67630
+ if (!this.#visit(state, node)) return;
67631
+ const sub = this.state();
67632
+ this.add(sub, node.sub, i, false);
67633
+ this.done(sub);
67634
+ return this.addRun(state, {
67635
+ t: "run",
67636
+ neg: node,
67637
+ state: sub
67638
+ }, i, top);
67639
+ case "star":
67640
+ if (this.restricted(i, top)) return;
67641
+ if (this.#addThread(state, node)) this.add(state, node.next, i, top);
67642
+ return;
67643
+ case "match":
67644
+ state.match = true;
67645
+ return;
67646
+ default: this.#addThread(state, node);
67647
+ }
67648
+ }
67649
+ addRun(state, run, i, top) {
67650
+ for (const r of state.runs) if (r.neg === run.neg && sameState(r.state, run.state)) return;
67651
+ state.runs.push(run);
67652
+ if (!run.state.match) this.add(state, run.neg.next, i, top);
67653
+ }
67654
+ step(state, c, i, top) {
67655
+ const next = this.state();
67656
+ for (const th of state.threads) switch (th.t) {
67657
+ case "lit":
67658
+ if (litMatch(th, c)) this.add(next, th.next, i + 1, top);
67659
+ break;
67660
+ case "any":
67661
+ if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top);
67662
+ break;
67663
+ case "class":
67664
+ if (!this.restricted(i, top) && th.re.test(c)) this.add(next, th.next, i + 1, top);
67665
+ break;
67666
+ case "star": if (!this.restricted(i, top)) this.add(next, th, i + 1, top);
67667
+ }
67668
+ if (!this.restricted(i, top)) for (const run of state.runs) {
67669
+ if (run.state.dead) {
67670
+ this.addRun(next, run, i + 1, top);
67671
+ continue;
67672
+ }
67673
+ const sub = this.step(run.state, c, i, false);
67674
+ this.addRun(next, {
67675
+ t: "run",
67676
+ neg: run.neg,
67677
+ state: sub
67678
+ }, i + 1, top);
67679
+ }
67680
+ return this.done(next);
67681
+ }
67682
+ };
67683
+ const stateKey = (state) => {
67684
+ const ids = state.ids.join();
67685
+ if (!state.runs.length) return ids;
67686
+ return `${ids}|${state.runs.map((r) => `${r.neg.id}(${stateKey(r.state)})`).sort().join("|")}`;
67687
+ };
67688
+ const DFA_BUDGET = 1 << 18;
67689
+ var Dfa = class {
67690
+ #start;
67691
+ #states = /* @__PURE__ */ new Map();
67692
+ #size = 0;
67693
+ #plain;
67694
+ #dotStart;
67695
+ #sim;
67696
+ #dotSim;
67697
+ constructor(start, marks) {
67698
+ this.#start = start;
67699
+ this.#sim = new Sim(false, false, marks);
67700
+ this.#dotSim = new Sim(false, true, marks);
67701
+ }
67702
+ #make(state) {
67703
+ return {
67704
+ state,
67705
+ match: state.match,
67706
+ dead: state.dead,
67707
+ next: /* @__PURE__ */ new Map()
67708
+ };
67709
+ }
67710
+ #intern(state) {
67711
+ const key = stateKey(state);
67712
+ const found = this.#states.get(key);
67713
+ if (found) return found;
67714
+ if (this.#size > DFA_BUDGET) this.#clear();
67715
+ const d = this.#make(state);
67716
+ this.#states.set(key, d);
67717
+ this.#size += key.length + 1;
67718
+ return d;
67719
+ }
67720
+ #clear() {
67721
+ this.#states.clear();
67722
+ this.#size = 0;
67723
+ this.#plain = void 0;
67724
+ this.#dotStart = void 0;
67725
+ }
67726
+ start(dotStart) {
67727
+ if (dotStart) {
67728
+ if (this.#dotStart) return this.#dotStart;
67729
+ const state = this.#dotSim.state();
67730
+ this.#dotSim.add(state, this.#start, 0, true);
67731
+ return this.#dotStart = this.#make(this.#dotSim.done(state));
67732
+ }
67733
+ if (this.#plain) return this.#plain;
67734
+ const state = this.#sim.state();
67735
+ this.#sim.add(state, this.#start, 0, true);
67736
+ return this.#plain = this.#intern(this.#sim.done(state));
67737
+ }
67738
+ next(d, c) {
67739
+ const code = c.charCodeAt(0);
67740
+ const found = code < 128 ? void 0 : d.next.get(c);
67741
+ if (found) return found;
67742
+ 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));
67743
+ if (code < 128) {
67744
+ if (!d.ascii) {
67745
+ d.ascii = new Array(128);
67746
+ this.#size += 128;
67747
+ }
67748
+ d.ascii[code] = n;
67749
+ } else d.next.set(c, n);
67750
+ this.#size++;
67751
+ return n;
67752
+ }
67753
+ };
67754
+ const linear = (start) => {
67755
+ const nodes = [];
67756
+ for (let n = start; n.t !== "match"; n = n.next) {
67757
+ if (n.t === "split" || n.t === "neg") return void 0;
67758
+ nodes.push(n);
67759
+ }
67760
+ return nodes;
67761
+ };
67762
+ const testLinear = (nodes, chars, start, end) => {
67763
+ let ni = 0;
67764
+ let ci = start;
67765
+ let starNi = -1;
67766
+ let starCi = 0;
67767
+ while (ci < end) {
67768
+ const n = nodes[ni];
67769
+ if (n?.t === "star") {
67770
+ starNi = ni++;
67771
+ starCi = ci;
67772
+ continue;
67773
+ }
67774
+ const c = chars[ci];
67775
+ if (n && (n.t === "any" || n.t === "lit" && litMatch(n, c) || n.t === "class" && n.re.test(c))) {
67776
+ ni++;
67777
+ ci++;
67778
+ continue;
67779
+ }
67780
+ if (starNi === -1) return false;
67781
+ ni = starNi + 1;
67782
+ ci = ++starCi;
67783
+ }
67784
+ while (nodes[ni]?.t === "star") ni++;
67785
+ return ni === nodes.length;
67786
+ };
67787
+ const lengths = (items) => {
67788
+ let min = 0;
67789
+ let max = 0;
67790
+ for (const it of items) {
67791
+ const [lo, hi] = itemLengths(it);
67792
+ min += lo;
67793
+ max += hi;
67794
+ }
67795
+ return [min, max];
67796
+ };
67797
+ const itemLengths = (it) => {
67798
+ if (it.t === "star") return [0, Infinity];
67799
+ if (it.t !== "ext") return [1, 1];
67800
+ if (it.type === "!") return [0, Infinity];
67801
+ const alts = it.alts.map(lengths);
67802
+ const min = Math.min(...alts.map((a) => a[0]));
67803
+ const max = Math.max(...alts.map((a) => a[1]));
67804
+ const loop = max === 0 ? 0 : Infinity;
67805
+ return it.type === "@" ? [min, max] : it.type === "?" ? [0, max] : it.type === "*" ? [0, loop] : [min, loop];
67806
+ };
67807
+ const hasAffix = (lits, chars, start) => {
67808
+ for (let j = 0; j < lits.length; j++) if (!litMatch(lits[j], chars[start + j])) return false;
67809
+ return true;
67810
+ };
67811
+ const slashOrSurrogate = /[/\ud800-\udfff]/;
67812
+ const surrogate = /[\ud800-\udfff]/;
67813
+ const codePoints = (s) => surrogate.test(s) ? [...s] : s;
67814
+ const noSlash = (s) => {
67815
+ if (s.includes("/")) throw new Error("can only match a single path portion, got: " + s);
67816
+ };
67817
+ var Matcher = class {
67818
+ pattern;
67819
+ options;
67820
+ #start;
67821
+ #size;
67822
+ #marks;
67823
+ #dotsSim;
67824
+ #literal;
67825
+ #literalFold = false;
67826
+ #literalRe;
67827
+ #linear;
67828
+ #wild = false;
67829
+ #min = 0;
67830
+ #max = Infinity;
67831
+ #prefix = [];
67832
+ #suffix = [];
67833
+ #prefixStr;
67834
+ #suffixStr;
67835
+ #affix = false;
67836
+ #dfa;
67837
+ #form;
67838
+ constructor(pattern, options = {}) {
67839
+ if (pattern.includes("/")) throw new Error("can only match a single path portion, got pattern: " + pattern);
67840
+ this.pattern = pattern;
67841
+ this.options = options;
67842
+ const { nocase = false, noext = false, normalize: n } = options;
67843
+ this.#form = n === true ? "NFC" : n || void 0;
67844
+ const literal = /^[?*+@]\(\)$/.test(pattern);
67845
+ const toks = tokenize(pattern, nocase, noext || literal, this.#form);
67846
+ let [items] = build(toks, pair(toks), 0, toks.length, true);
67847
+ if (this.#form) items = normalize(items, this.#form);
67848
+ const [start, size] = compile(items, nocase);
67849
+ this.#start = start;
67850
+ this.#size = size;
67851
+ if (items.every((it) => it.t === "lit")) {
67852
+ this.#literal = items.map((it) => it.ch).join("");
67853
+ this.#literalFold = nocase;
67854
+ } else {
67855
+ const lit = (it) => it.t !== "lit" ? void 0 : nocase ? {
67856
+ ch: it.ch,
67857
+ re: foldRe(it.ch)
67858
+ } : { ch: it.ch };
67859
+ for (const it of items) {
67860
+ const l = lit(it);
67861
+ if (!l) break;
67862
+ this.#prefix.push(l);
67863
+ }
67864
+ for (let j = items.length - 1; j >= 0; j--) {
67865
+ const l = lit(items[j]);
67866
+ if (!l) break;
67867
+ this.#suffix.unshift(l);
67868
+ }
67869
+ this.#affix = !!(this.#prefix.length || this.#suffix.length);
67870
+ if (!nocase) {
67871
+ this.#prefixStr = this.#prefix.map((l) => l.ch).join("");
67872
+ this.#suffixStr = this.#suffix.map((l) => l.ch).join("");
67873
+ }
67874
+ this.#linear = linear(this.#start)?.slice(this.#prefix.length, -this.#suffix.length || void 0);
67875
+ this.#wild = !!this.#linear?.every((n) => n.t === "star" || n.t === "any");
67876
+ const [min, max] = lengths(items);
67877
+ this.#min = min;
67878
+ this.#max = max;
67879
+ }
67880
+ }
67881
+ test(s) {
67882
+ if (this.#form) {
67883
+ noSlash(s);
67884
+ return this.#test(s.normalize(this.#form));
67885
+ }
67886
+ if (slashOrSurrogate.test(s)) {
67887
+ noSlash(s);
67888
+ return this.#test(s, [...s]);
67889
+ }
67890
+ return this.#test(s, s);
67891
+ }
67892
+ /**
67893
+ * The same as {@link Matcher#test}, but the string is not checked
67894
+ * for `/` chars, so the result for a string that has one is not
67895
+ * defined. Only use it for a string that is known to be one path
67896
+ * portion, such as a part of a path that was split on `/`. It can
67897
+ * be faster, because some patterns do not need to look at each char
67898
+ * of the string.
67899
+ */
67900
+ testUnchecked(s) {
67901
+ return this.#test(this.#form ? s.normalize(this.#form) : s);
67902
+ }
67903
+ #test(s, chars) {
67904
+ if (this.#literal !== void 0) return this.#literalFold ? (this.#literalRe ??= newFoldRe(this.#literal)).test(s) : s === this.#literal;
67905
+ const min = this.#min;
67906
+ const max = this.#max;
67907
+ if (chars === void 0) {
67908
+ const most = s.length;
67909
+ const least = most + 1 >> 1;
67910
+ if (most < min || least > max) return false;
67911
+ if (least < min || most > max) chars = codePoints(s);
67912
+ }
67913
+ if (chars !== void 0 && (chars.length < min || chars.length > max)) return false;
67914
+ const prefix = this.#prefix.length;
67915
+ if (this.#affix) if (this.#prefixStr !== void 0 && this.#suffixStr !== void 0) {
67916
+ if (!s.startsWith(this.#prefixStr) || !s.endsWith(this.#suffixStr)) return false;
67917
+ } else {
67918
+ chars ??= codePoints(s);
67919
+ const end = chars.length - this.#suffix.length;
67920
+ if (!hasAffix(this.#prefix, chars, 0) || !hasAffix(this.#suffix, chars, end)) return false;
67921
+ }
67922
+ const dotStart = !this.options.dot && s.startsWith(".");
67923
+ if (this.#linear) {
67924
+ if (s === "." || s === "..") return false;
67925
+ if (dotStart && !prefix) return false;
67926
+ if (this.#wild) return true;
67927
+ chars ??= codePoints(s);
67928
+ const end = chars.length - this.#suffix.length;
67929
+ return testLinear(this.#linear, chars, prefix, end);
67930
+ }
67931
+ chars ??= codePoints(s);
67932
+ if (s === "." || s === "..") {
67933
+ this.#marks ??= marks(this.#size);
67934
+ const sim = this.#dotsSim ??= new Sim(true, false, this.#marks);
67935
+ const start = sim.state();
67936
+ sim.add(start, this.#start, 0, true);
67937
+ let state = sim.done(start);
67938
+ for (let i = 0; i < chars.length; i++) state = sim.step(state, chars[i], i, true);
67939
+ return state.match;
67940
+ }
67941
+ this.#marks ??= marks(this.#size);
67942
+ const dfa = this.#dfa ??= new Dfa(this.#start, this.#marks);
67943
+ let d = dfa.start(dotStart);
67944
+ const str = chars === s;
67945
+ for (let i = 0; i < chars.length; i++) {
67946
+ if (d.dead) return false;
67947
+ const code = str ? s.charCodeAt(i) : chars[i].charCodeAt(0);
67948
+ d = d.ascii?.[code] ?? dfa.next(d, chars[i]);
67949
+ }
67950
+ return d.match;
67951
+ }
67952
+ /** a readable listing of the state machine */
67953
+ toString() {
67954
+ return show(this.#start);
67955
+ }
67956
+ };
67957
+ exports.Matcher = Matcher;
67958
+ }));
67959
+ //#endregion
67960
+ //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
67961
+ var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
67962
+ Object.defineProperty(exports, "__esModule", { value: true });
67963
+ exports.assertValidPattern = void 0;
67964
+ const MAX_PATTERN_LENGTH = 1024 * 64;
67965
+ const assertValidPattern = (pattern) => {
67966
+ if (typeof pattern !== "string") throw new TypeError("invalid pattern");
67967
+ if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
67968
+ };
67969
+ exports.assertValidPattern = assertValidPattern;
67970
+ }));
67971
+ //#endregion
67972
+ //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js
67973
+ var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
67974
+ Object.defineProperty(exports, "__esModule", { value: true });
67975
+ exports.escape = void 0;
67976
+ /**
67977
+ * Escape all magic characters in a glob pattern.
67978
+ *
67979
+ * If the {@link MinimatchOptions.windowsPathsNoEscape}
67980
+ * option is used, then characters are escaped by wrapping in `[]`, because
67981
+ * a magic character wrapped in a character class can only be satisfied by
67982
+ * that exact character. In this mode, `\` is _not_ escaped, because it is
67983
+ * not interpreted as a magic character, but instead as a path separator.
67984
+ *
67985
+ * If the {@link MinimatchOptions.magicalBraces} option is used,
67986
+ * then braces (`{` and `}`) will be escaped.
67987
+ */
67988
+ const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
67989
+ if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
67990
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
67991
+ };
67992
+ exports.escape = escape;
67993
+ }));
67994
+ //#endregion
67020
67995
  //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js
67021
67996
  var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
67022
67997
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -67047,610 +68022,36 @@ var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
67047
68022
  exports.unescape = unescape;
67048
68023
  }));
67049
68024
  //#endregion
67050
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js
67051
- var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
67052
- var _a;
67053
- Object.defineProperty(exports, "__esModule", { value: true });
67054
- exports.AST = void 0;
67055
- const brace_expressions_js_1 = require_brace_expressions();
67056
- const unescape_js_1 = require_unescape();
67057
- const types = new Set([
67058
- "!",
67059
- "?",
67060
- "+",
67061
- "*",
67062
- "@"
67063
- ]);
67064
- const isExtglobType = (c) => types.has(c);
67065
- const isExtglobAST = (c) => isExtglobType(c.type);
67066
- const adoptionMap = new Map([
67067
- ["!", ["@"]],
67068
- ["?", ["?", "@"]],
67069
- ["@", ["@"]],
67070
- ["*", [
67071
- "*",
67072
- "+",
67073
- "?",
67074
- "@"
67075
- ]],
67076
- ["+", ["+", "@"]]
67077
- ]);
67078
- const adoptionWithSpaceMap = new Map([
67079
- ["!", ["?"]],
67080
- ["@", ["?"]],
67081
- ["+", ["?", "*"]]
67082
- ]);
67083
- const adoptionAnyMap = new Map([
67084
- ["!", ["?", "@"]],
67085
- ["?", ["?", "@"]],
67086
- ["@", ["?", "@"]],
67087
- ["*", [
67088
- "*",
67089
- "+",
67090
- "?",
67091
- "@"
67092
- ]],
67093
- ["+", [
67094
- "+",
67095
- "@",
67096
- "?",
67097
- "*"
67098
- ]]
67099
- ]);
67100
- const usurpMap = new Map([
67101
- ["!", new Map([["!", "@"]])],
67102
- ["?", new Map([["*", "*"], ["+", "*"]])],
67103
- ["@", new Map([
67104
- ["!", "!"],
67105
- ["?", "?"],
67106
- ["@", "@"],
67107
- ["*", "*"],
67108
- ["+", "+"]
67109
- ])],
67110
- ["+", new Map([["?", "*"], ["*", "*"]])]
67111
- ]);
67112
- const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
67113
- const startNoDot = "(?!\\.)";
67114
- const addPatternStart = new Set(["[", "."]);
67115
- const justDots = new Set(["..", "."]);
67116
- const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
67117
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
67118
- const qmark = "[^/]";
67119
- const star = qmark + "*?";
67120
- const starNoEmpty = qmark + "+?";
67121
- let ID = 0;
67122
- var AST = class {
67123
- type;
67124
- #root;
67125
- #hasMagic;
67126
- #uflag = false;
67127
- #parts = [];
67128
- #parent;
67129
- #parentIndex;
67130
- #negs;
67131
- #filledNegs = false;
67132
- #options;
67133
- #toString;
67134
- #emptyExt = false;
67135
- id = ++ID;
67136
- get depth() {
67137
- return (this.#parent?.depth ?? -1) + 1;
67138
- }
67139
- [Symbol.for("nodejs.util.inspect.custom")]() {
67140
- return {
67141
- "@@type": "AST",
67142
- id: this.id,
67143
- type: this.type,
67144
- root: this.#root.id,
67145
- parent: this.#parent?.id,
67146
- depth: this.depth,
67147
- partsLength: this.#parts.length,
67148
- parts: this.#parts
67149
- };
67150
- }
67151
- constructor(type, parent, options = {}) {
67152
- this.type = type;
67153
- if (type) this.#hasMagic = true;
67154
- this.#parent = parent;
67155
- this.#root = this.#parent ? this.#parent.#root : this;
67156
- this.#options = this.#root === this ? options : this.#root.#options;
67157
- this.#negs = this.#root === this ? [] : this.#root.#negs;
67158
- if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
67159
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
67160
- }
67161
- get hasMagic() {
67162
- /* c8 ignore start */
67163
- if (this.#hasMagic !== void 0) return this.#hasMagic;
67164
- /* c8 ignore stop */
67165
- for (const p of this.#parts) {
67166
- if (typeof p === "string") continue;
67167
- if (p.type || p.hasMagic) return this.#hasMagic = true;
67168
- }
67169
- return this.#hasMagic;
67170
- }
67171
- toString() {
67172
- 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("|") + ")";
67173
- }
67174
- #fillNegs() {
67175
- /* c8 ignore start */
67176
- if (this !== this.#root) throw new Error("should only call on root");
67177
- if (this.#filledNegs) return this;
67178
- /* c8 ignore stop */
67179
- this.toString();
67180
- this.#filledNegs = true;
67181
- let n;
67182
- while (n = this.#negs.pop()) {
67183
- if (n.type !== "!") continue;
67184
- let p = n;
67185
- let pp = p.#parent;
67186
- while (pp) {
67187
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
67188
- /* c8 ignore start */
67189
- if (typeof part === "string") throw new Error("string part in extglob AST??");
67190
- /* c8 ignore stop */
67191
- part.copyIn(pp.#parts[i]);
67192
- }
67193
- p = pp;
67194
- pp = p.#parent;
67195
- }
67196
- }
67197
- return this;
67198
- }
67199
- push(...parts) {
67200
- for (const p of parts) {
67201
- if (p === "") continue;
67202
- /* c8 ignore start */
67203
- if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
67204
- /* c8 ignore stop */
67205
- this.#parts.push(p);
67206
- }
67207
- }
67208
- toJSON() {
67209
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
67210
- if (this.isStart() && !this.type) ret.unshift([]);
67211
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({});
67212
- return ret;
67213
- }
67214
- isStart() {
67215
- if (this.#root === this) return true;
67216
- if (!this.#parent?.isStart()) return false;
67217
- if (this.#parentIndex === 0) return true;
67218
- const p = this.#parent;
67219
- for (let i = 0; i < this.#parentIndex; i++) {
67220
- const pp = p.#parts[i];
67221
- if (!(pp instanceof _a && pp.type === "!")) return false;
67222
- }
67223
- return true;
67224
- }
67225
- isEnd() {
67226
- if (this.#root === this) return true;
67227
- if (this.#parent?.type === "!") return true;
67228
- if (!this.#parent?.isEnd()) return false;
67229
- if (!this.type) return this.#parent?.isEnd();
67230
- /* c8 ignore start */
67231
- const pl = this.#parent ? this.#parent.#parts.length : 0;
67232
- /* c8 ignore stop */
67233
- return this.#parentIndex === pl - 1;
67234
- }
67235
- copyIn(part) {
67236
- if (typeof part === "string") this.push(part);
67237
- else this.push(part.clone(this));
67238
- }
67239
- clone(parent) {
67240
- const c = new _a(this.type, parent);
67241
- for (const p of this.#parts) c.copyIn(p);
67242
- return c;
67243
- }
67244
- static #parseAST(str, ast, pos, opt, extDepth) {
67245
- const maxDepth = opt.maxExtglobRecursion ?? 2;
67246
- let escaping = false;
67247
- let inBrace = false;
67248
- let braceStart = -1;
67249
- let braceNeg = false;
67250
- if (ast.type === null) {
67251
- let i = pos;
67252
- let acc = "";
67253
- while (i < str.length) {
67254
- const c = str.charAt(i++);
67255
- if (escaping || c === "\\") {
67256
- escaping = !escaping;
67257
- acc += c;
67258
- continue;
67259
- }
67260
- if (inBrace) {
67261
- if (i === braceStart + 1) {
67262
- if (c === "^" || c === "!") braceNeg = true;
67263
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
67264
- acc += c;
67265
- continue;
67266
- } else if (c === "[") {
67267
- inBrace = true;
67268
- braceStart = i;
67269
- braceNeg = false;
67270
- acc += c;
67271
- continue;
67272
- }
67273
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
67274
- ast.push(acc);
67275
- acc = "";
67276
- const ext = new _a(c, ast);
67277
- i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
67278
- ast.push(ext);
67279
- continue;
67280
- }
67281
- acc += c;
67282
- }
67283
- ast.push(acc);
67284
- return i;
67285
- }
67286
- let i = pos + 1;
67287
- let part = new _a(null, ast);
67288
- const parts = [];
67289
- let acc = "";
67290
- while (i < str.length) {
67291
- const c = str.charAt(i++);
67292
- if (escaping || c === "\\") {
67293
- escaping = !escaping;
67294
- acc += c;
67295
- continue;
67296
- }
67297
- if (inBrace) {
67298
- if (i === braceStart + 1) {
67299
- if (c === "^" || c === "!") braceNeg = true;
67300
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
67301
- acc += c;
67302
- continue;
67303
- } else if (c === "[") {
67304
- inBrace = true;
67305
- braceStart = i;
67306
- braceNeg = false;
67307
- acc += c;
67308
- continue;
67309
- }
67310
- /* c8 ignore stop */
67311
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
67312
- const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
67313
- part.push(acc);
67314
- acc = "";
67315
- const ext = new _a(c, part);
67316
- part.push(ext);
67317
- i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
67318
- continue;
67319
- }
67320
- if (c === "|") {
67321
- part.push(acc);
67322
- acc = "";
67323
- parts.push(part);
67324
- part = new _a(null, ast);
67325
- continue;
67326
- }
67327
- if (c === ")") {
67328
- if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
67329
- part.push(acc);
67330
- acc = "";
67331
- ast.push(...parts, part);
67332
- return i;
67333
- }
67334
- acc += c;
67335
- }
67336
- ast.type = null;
67337
- ast.#hasMagic = void 0;
67338
- ast.#parts = [str.substring(pos - 1)];
67339
- return i;
67340
- }
67341
- #canAdoptWithSpace(child) {
67342
- return this.#canAdopt(child, adoptionWithSpaceMap);
67343
- }
67344
- #canAdopt(child, map = adoptionMap) {
67345
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
67346
- const gc = child.#parts[0];
67347
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
67348
- return this.#canAdoptType(gc.type, map);
67349
- }
67350
- #canAdoptType(c, map = adoptionAnyMap) {
67351
- return !!map.get(this.type)?.includes(c);
67352
- }
67353
- #adoptWithSpace(child, index) {
67354
- const gc = child.#parts[0];
67355
- const blank = new _a(null, gc, this.options);
67356
- blank.#parts.push("");
67357
- gc.push(blank);
67358
- this.#adopt(child, index);
67359
- }
67360
- #adopt(child, index) {
67361
- const gc = child.#parts[0];
67362
- this.#parts.splice(index, 1, ...gc.#parts);
67363
- for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
67364
- this.#toString = void 0;
67365
- }
67366
- #canUsurpType(c) {
67367
- return !!usurpMap.get(this.type)?.has(c);
67368
- }
67369
- #canUsurp(child) {
67370
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
67371
- const gc = child.#parts[0];
67372
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
67373
- return this.#canUsurpType(gc.type);
67374
- }
67375
- #usurp(child) {
67376
- const m = usurpMap.get(this.type);
67377
- const gc = child.#parts[0];
67378
- const nt = m?.get(gc.type);
67379
- /* c8 ignore start - impossible */
67380
- if (!nt) return false;
67381
- /* c8 ignore stop */
67382
- this.#parts = gc.#parts;
67383
- for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
67384
- this.type = nt;
67385
- this.#toString = void 0;
67386
- this.#emptyExt = false;
67387
- }
67388
- static fromGlob(pattern, options = {}) {
67389
- const ast = new _a(null, void 0, options);
67390
- _a.#parseAST(pattern, ast, 0, options, 0);
67391
- return ast;
67392
- }
67393
- toMMPattern() {
67394
- /* c8 ignore start */
67395
- if (this !== this.#root) return this.#root.toMMPattern();
67396
- /* c8 ignore stop */
67397
- const glob = this.toString();
67398
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
67399
- if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
67400
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
67401
- return Object.assign(new RegExp(`^${re}$`, flags), {
67402
- _src: re,
67403
- _glob: glob
67404
- });
67405
- }
67406
- get options() {
67407
- return this.#options;
67408
- }
67409
- toRegExpSource(allowDot) {
67410
- const dot = allowDot ?? !!this.#options.dot;
67411
- if (this.#root === this) {
67412
- this.#flatten();
67413
- this.#fillNegs();
67414
- }
67415
- if (!isExtglobAST(this)) {
67416
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
67417
- const src = this.#parts.map((p) => {
67418
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
67419
- this.#hasMagic = this.#hasMagic || hasMagic;
67420
- this.#uflag = this.#uflag || uflag;
67421
- return re;
67422
- }).join("");
67423
- let start = "";
67424
- if (this.isStart()) {
67425
- if (typeof this.#parts[0] === "string") {
67426
- if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
67427
- const aps = addPatternStart;
67428
- const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
67429
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
67430
- start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
67431
- }
67432
- }
67433
- }
67434
- let end = "";
67435
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
67436
- return [
67437
- start + src + end,
67438
- (0, unescape_js_1.unescape)(src),
67439
- this.#hasMagic = !!this.#hasMagic,
67440
- this.#uflag
67441
- ];
67442
- }
67443
- const repeated = this.type === "*" || this.type === "+";
67444
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
67445
- let body = this.#partsToRegExp(dot);
67446
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
67447
- const s = this.toString();
67448
- const me = this;
67449
- me.#parts = [s];
67450
- me.type = null;
67451
- me.#hasMagic = void 0;
67452
- return [
67453
- s,
67454
- (0, unescape_js_1.unescape)(this.toString()),
67455
- false,
67456
- false
67457
- ];
67458
- }
67459
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
67460
- if (bodyDotAllowed === body) bodyDotAllowed = "";
67461
- if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
67462
- let final = "";
67463
- if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
67464
- else {
67465
- const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
67466
- final = start + body + close;
67467
- }
67468
- return [
67469
- final,
67470
- (0, unescape_js_1.unescape)(body),
67471
- this.#hasMagic = !!this.#hasMagic,
67472
- this.#uflag
67473
- ];
67474
- }
67475
- #flatten() {
67476
- if (!isExtglobAST(this)) {
67477
- for (const p of this.#parts) if (typeof p === "object") p.#flatten();
67478
- } else {
67479
- let iterations = 0;
67480
- let done = false;
67481
- do {
67482
- done = true;
67483
- for (let i = 0; i < this.#parts.length; i++) {
67484
- const c = this.#parts[i];
67485
- if (typeof c === "object") {
67486
- c.#flatten();
67487
- if (this.#canAdopt(c)) {
67488
- done = false;
67489
- this.#adopt(c, i);
67490
- } else if (this.#canAdoptWithSpace(c)) {
67491
- done = false;
67492
- this.#adoptWithSpace(c, i);
67493
- } else if (this.#canUsurp(c)) {
67494
- done = false;
67495
- this.#usurp(c);
67496
- }
67497
- }
67498
- }
67499
- } while (!done && ++iterations < 10);
67500
- }
67501
- this.#toString = void 0;
67502
- }
67503
- #partsToRegExp(dot) {
67504
- return this.#parts.map((p) => {
67505
- /* c8 ignore start */
67506
- if (typeof p === "string") throw new Error("string type in extglob ast??");
67507
- /* c8 ignore stop */
67508
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
67509
- this.#uflag = this.#uflag || uflag;
67510
- return re;
67511
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
67512
- }
67513
- static #parseGlob(glob, hasMagic, noEmpty = false) {
67514
- let escaping = false;
67515
- let re = "";
67516
- let uflag = false;
67517
- let inStar = false;
67518
- for (let i = 0; i < glob.length; i++) {
67519
- const c = glob.charAt(i);
67520
- if (escaping) {
67521
- escaping = false;
67522
- re += (reSpecials.has(c) ? "\\" : "") + c;
67523
- continue;
67524
- }
67525
- if (c === "*") {
67526
- if (inStar) continue;
67527
- inStar = true;
67528
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
67529
- hasMagic = true;
67530
- continue;
67531
- } else inStar = false;
67532
- if (c === "\\") {
67533
- if (i === glob.length - 1) re += "\\\\";
67534
- else escaping = true;
67535
- continue;
67536
- }
67537
- if (c === "[") {
67538
- const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
67539
- if (consumed) {
67540
- re += src;
67541
- uflag = uflag || needUflag;
67542
- i += consumed - 1;
67543
- hasMagic = hasMagic || magic;
67544
- continue;
67545
- }
67546
- }
67547
- if (c === "?") {
67548
- re += qmark;
67549
- hasMagic = true;
67550
- continue;
67551
- }
67552
- re += regExpEscape(c);
67553
- }
67554
- return [
67555
- re,
67556
- (0, unescape_js_1.unescape)(glob),
67557
- !!hasMagic,
67558
- uflag
67559
- ];
67560
- }
67561
- };
67562
- exports.AST = AST;
67563
- _a = AST;
67564
- }));
67565
- //#endregion
67566
- //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js
67567
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
67568
- Object.defineProperty(exports, "__esModule", { value: true });
67569
- exports.escape = void 0;
67570
- /**
67571
- * Escape all magic characters in a glob pattern.
67572
- *
67573
- * If the {@link MinimatchOptions.windowsPathsNoEscape}
67574
- * option is used, then characters are escaped by wrapping in `[]`, because
67575
- * a magic character wrapped in a character class can only be satisfied by
67576
- * that exact character. In this mode, `\` is _not_ escaped, because it is
67577
- * not interpreted as a magic character, but instead as a path separator.
67578
- *
67579
- * If the {@link MinimatchOptions.magicalBraces} option is used,
67580
- * then braces (`{` and `}`) will be escaped.
67581
- */
67582
- const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
67583
- if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
67584
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
67585
- };
67586
- exports.escape = escape;
67587
- }));
67588
- //#endregion
67589
68025
  //#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/index.js
67590
68026
  var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67591
68027
  Object.defineProperty(exports, "__esModule", { value: true });
67592
- 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;
67593
- const brace_expansion_1 = require_commonjs$5();
68028
+ exports.unescape = exports.escape = exports.Minimatch = exports.match = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
68029
+ const brace_expansion_1 = require_commonjs$6();
68030
+ const nonrecursive_glob_match_1 = require_commonjs$5();
67594
68031
  const assert_valid_pattern_js_1 = require_assert_valid_pattern();
67595
- const ast_js_1 = require_ast();
67596
68032
  const escape_js_1 = require_escape();
67597
68033
  const unescape_js_1 = require_unescape();
67598
68034
  const minimatch = (p, pattern, options = {}) => {
67599
68035
  (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
67600
68036
  if (!options.nocomment && pattern.charAt(0) === "#") return false;
67601
- return new Minimatch(pattern, options).match(p);
68037
+ return cachedMinimatch(pattern, options).match(p);
67602
68038
  };
67603
68039
  exports.minimatch = minimatch;
67604
- const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
67605
- const starDotExtTest = (ext) => (f) => !f.startsWith(".") && f.endsWith(ext);
67606
- const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
67607
- const starDotExtTestNocase = (ext) => {
67608
- ext = ext.toLowerCase();
67609
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext);
67610
- };
67611
- const starDotExtTestNocaseDot = (ext) => {
67612
- ext = ext.toLowerCase();
67613
- return (f) => f.toLowerCase().endsWith(ext);
67614
- };
67615
- const starDotStarRE = /^\*+\.\*+$/;
67616
- const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
67617
- const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
67618
- const dotStarRE = /^\.\*+$/;
67619
- const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
67620
- const starRE = /^\*+$/;
67621
- const starTest = (f) => f.length !== 0 && !f.startsWith(".");
67622
- const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
67623
- const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
67624
- const qmarksTestNocase = ([$0, ext = ""]) => {
67625
- const noext = qmarksTestNoExt([$0]);
67626
- if (!ext) return noext;
67627
- ext = ext.toLowerCase();
67628
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
67629
- };
67630
- const qmarksTestNocaseDot = ([$0, ext = ""]) => {
67631
- const noext = qmarksTestNoExtDot([$0]);
67632
- if (!ext) return noext;
67633
- ext = ext.toLowerCase();
67634
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
67635
- };
67636
- const qmarksTestDot = ([$0, ext = ""]) => {
67637
- const noext = qmarksTestNoExtDot([$0]);
67638
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
67639
- };
67640
- const qmarksTest = ([$0, ext = ""]) => {
67641
- const noext = qmarksTestNoExt([$0]);
67642
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
67643
- };
67644
- const qmarksTestNoExt = ([$0]) => {
67645
- const len = $0.length;
67646
- return (f) => f.length === len && !f.startsWith(".");
67647
- };
67648
- const qmarksTestNoExtDot = ([$0]) => {
67649
- const len = $0.length;
67650
- return (f) => f.length === len && f !== "." && f !== "..";
68040
+ const cache = /* @__PURE__ */ new Map();
68041
+ const cacheMax = 256;
68042
+ const cachedMinimatch = (pattern, options) => {
68043
+ const key = pattern + "\0" + JSON.stringify(options);
68044
+ let mm = cache.get(key);
68045
+ if (mm) cache.delete(key);
68046
+ else {
68047
+ mm = new Minimatch(pattern, { ...options });
68048
+ if (cache.size >= cacheMax) cache.delete(cache.keys().next().value);
68049
+ }
68050
+ cache.set(key, mm);
68051
+ return mm;
67651
68052
  };
67652
68053
  /* c8 ignore start */
67653
- const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
68054
+ const defaultPlatform = typeof process === "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
67654
68055
  const path = {
67655
68056
  win32: { sep: "\\" },
67656
68057
  posix: { sep: "/" }
@@ -67660,9 +68061,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67660
68061
  exports.minimatch.sep = exports.sep;
67661
68062
  exports.GLOBSTAR = Symbol("globstar **");
67662
68063
  exports.minimatch.GLOBSTAR = exports.GLOBSTAR;
67663
- const star = "[^/]*?";
67664
- const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
67665
- const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
67666
68064
  const filter = (pattern, options = {}) => (p) => (0, exports.minimatch)(p, pattern, options);
67667
68065
  exports.filter = filter;
67668
68066
  exports.minimatch.filter = exports.filter;
@@ -67680,21 +68078,10 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67680
68078
  return orig.defaults(ext(def, options)).Minimatch;
67681
68079
  }
67682
68080
  },
67683
- AST: class AST extends orig.AST {
67684
- /* c8 ignore start */
67685
- constructor(type, parent, options = {}) {
67686
- super(type, parent, ext(def, options));
67687
- }
67688
- /* c8 ignore stop */
67689
- static fromGlob(pattern, options = {}) {
67690
- return orig.AST.fromGlob(pattern, ext(def, options));
67691
- }
67692
- },
67693
68081
  unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
67694
68082
  escape: (s, options = {}) => orig.escape(s, ext(def, options)),
67695
68083
  filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
67696
68084
  defaults: (options) => orig.defaults(ext(def, options)),
67697
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
67698
68085
  braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
67699
68086
  match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
67700
68087
  sep: orig.sep,
@@ -67710,9 +68097,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67710
68097
  };
67711
68098
  exports.braceExpand = braceExpand;
67712
68099
  exports.minimatch.braceExpand = exports.braceExpand;
67713
- const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
67714
- exports.makeRe = makeRe;
67715
- exports.minimatch.makeRe = exports.makeRe;
67716
68100
  const match = (list, pattern, options = {}) => {
67717
68101
  const mm = new Minimatch(pattern, options);
67718
68102
  list = list.filter((f) => mm.match(f));
@@ -67722,7 +68106,98 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67722
68106
  exports.match = match;
67723
68107
  exports.minimatch.match = exports.match;
67724
68108
  const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
67725
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
68109
+ const classEnd = (pattern, start) => {
68110
+ let i = start + 1;
68111
+ if (pattern.charAt(i) === "!" || pattern.charAt(i) === "^") i++;
68112
+ let sawStart = false;
68113
+ for (; i < pattern.length; i++) {
68114
+ const c = pattern.charAt(i);
68115
+ if (c === "]" && sawStart) return i;
68116
+ sawStart = true;
68117
+ if (c === "\\") i++;
68118
+ }
68119
+ return -1;
68120
+ };
68121
+ const literal = (pattern, noext) => {
68122
+ if (!noext && (pattern === "+()" || pattern === "@()")) return pattern;
68123
+ let lit = "";
68124
+ for (let i = 0; i < pattern.length; i++) {
68125
+ const c = pattern.charAt(i);
68126
+ if (c === "\\") lit += pattern.charAt(++i) || c;
68127
+ else if (c === "*" || c === "?") return;
68128
+ else if (c === "[") {
68129
+ const close = classEnd(pattern, i);
68130
+ if (close === -1) {
68131
+ lit += c;
68132
+ continue;
68133
+ }
68134
+ let body = pattern.slice(i + 1, close);
68135
+ if (body.startsWith("\\")) body = body.slice(1);
68136
+ if ([...body].length !== 1 || "!^".includes(pattern.charAt(i + 1))) return;
68137
+ lit += body;
68138
+ i = close;
68139
+ } else if (!noext && "+@!".includes(c) && pattern.charAt(i + 1) === "(" && pattern.includes(")", i + 2)) return;
68140
+ else lit += c;
68141
+ }
68142
+ return lit;
68143
+ };
68144
+ const extSafe = (pattern) => {
68145
+ if (/^[?*+@]\(\)$/.test(pattern) || pattern.includes("[:")) return false;
68146
+ let depth = 0;
68147
+ for (let i = 0; i < pattern.length; i++) {
68148
+ const c = pattern.charAt(i);
68149
+ if (c === "\\") {
68150
+ if (++i === pattern.length) return false;
68151
+ } else if (c === "[") {
68152
+ const close = classEnd(pattern, i);
68153
+ if (close !== -1) i = close;
68154
+ } else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
68155
+ depth++;
68156
+ i++;
68157
+ } else if (c === ")") {
68158
+ if (!depth--) return false;
68159
+ } else if (c === "|" && !depth) return false;
68160
+ }
68161
+ return !depth;
68162
+ };
68163
+ let lastSplit;
68164
+ let lastChecked;
68165
+ const portionMatch = (p, f) => typeof p === "string" ? f === p : f !== "" && p.testUnchecked(f);
68166
+ const endIndex = (p, last, lastStart, prev, prevStart) => portionMatch(p, last) ? lastStart : prev !== void 0 && portionMatch(p, prev) ? prevStart : -1;
68167
+ const isDots = (p) => p === "." || p === "..";
68168
+ const isDrive = (p) => typeof p === "string" && /^[a-z]:$/i.test(p);
68169
+ const isLongUNC = (p) => typeof p === "string" && /^unc$/i.test(p);
68170
+ const uncHost = (p) => {
68171
+ if (p[0] !== "" || p[1] !== "") return -1;
68172
+ const h = p[2] !== "?" ? 2 : isLongUNC(p[3]) ? 4 : -1;
68173
+ const host = p[h];
68174
+ const share = p[h + 1];
68175
+ return h !== -1 && host !== void 0 && host !== "" && host !== exports.GLOBSTAR && share !== void 0 && share !== "" && share !== exports.GLOBSTAR ? h : -1;
68176
+ };
68177
+ const walkable = (p, dot) => !isDots(p) && (dot || !p.startsWith("."));
68178
+ const dotPortion = (f, start, end, dot, sep) => {
68179
+ for (let k = start; k < end;) {
68180
+ if (f.charCodeAt(k) === 46) {
68181
+ if (!dot) return true;
68182
+ const n = f.charCodeAt(k + 1) === 46 ? k + 2 : k + 1;
68183
+ if (n >= end || isSep(f.charCodeAt(n), sep)) return true;
68184
+ }
68185
+ const s = nextSep(f, k, sep);
68186
+ if (s === -1) return false;
68187
+ k = s + 1;
68188
+ while (k < end && isSep(f.charCodeAt(k), sep)) k++;
68189
+ }
68190
+ return false;
68191
+ };
68192
+ const isSep = (c, sep) => sep === "/" ? c === 47 : sep === "\\" ? c === 92 : c === 47 || c === 92;
68193
+ const nextSep = (f, from, sep) => {
68194
+ if (sep !== "both") return f.indexOf(sep, from);
68195
+ const s = f.indexOf("/", from);
68196
+ const b = f.indexOf("\\", from);
68197
+ return s === -1 ? b : b === -1 ? s : Math.min(s, b);
68198
+ };
68199
+ const lastSep = (f, from, sep) => sep !== "both" ? f.lastIndexOf(sep, from) : Math.max(f.lastIndexOf("/", from), f.lastIndexOf("\\", from));
68200
+ const PENDING = {};
67726
68201
  var Minimatch = class {
67727
68202
  options;
67728
68203
  set;
@@ -67741,7 +68216,16 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67741
68216
  platform;
67742
68217
  windowsNoMagicRoot;
67743
68218
  maxGlobstarRecursion;
67744
- regexp;
68219
+ #endCheck;
68220
+ #literalCheck;
68221
+ #level2;
68222
+ #form;
68223
+ #literals = [];
68224
+ #shapes = [];
68225
+ #endRows = [];
68226
+ #matchers = /* @__PURE__ */ new Map();
68227
+ #pending = false;
68228
+ #globstarParts = /* @__PURE__ */ new WeakMap();
67745
68229
  constructor(pattern, options = {}) {
67746
68230
  (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
67747
68231
  options = options || {};
@@ -67753,7 +68237,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67753
68237
  this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options["allowWindowsEscape"] === false;
67754
68238
  if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
67755
68239
  this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
67756
- this.regexp = null;
67757
68240
  this.negate = false;
67758
68241
  this.nonegate = !!options.nonegate;
67759
68242
  this.comment = false;
@@ -67764,14 +68247,45 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67764
68247
  this.globSet = [];
67765
68248
  this.globParts = [];
67766
68249
  this.set = [];
68250
+ this.#endCheck = !this.preserveMultipleSlashes;
68251
+ this.#level2 = (options.optimizationLevel ?? 1) >= 2;
68252
+ const n = options.normalize;
68253
+ this.#form = n === true ? "NFC" : n || void 0;
67767
68254
  this.make();
68255
+ const drives = this.set.map((row) => this.#rootIndex(row));
68256
+ this.#endRows = this.set.map((row, r) => this.#endCheck && row.length - 1 > drives[r]);
68257
+ this.#literals = this.set.map((row, r) => {
68258
+ const end = this.#endRows[r] ? row.length - 1 : row.length;
68259
+ const lits = row.slice(drives[r] + 1, end).filter((p) => typeof p === "string" && !!p);
68260
+ return [...new Set(lits)];
68261
+ });
68262
+ this.#literalCheck = this.#literals.some((l) => l.length);
68263
+ this.#shapes = this.set.map((row, r) => {
68264
+ const [p0, p1, p2] = row;
68265
+ if (this.#endRows[r] && row.length === 2) {
68266
+ if (p0 === exports.GLOBSTAR && p1 !== exports.GLOBSTAR) return "tail";
68267
+ }
68268
+ if (this.#endRows[r] && options.matchBase && row.length === 1 && p0 !== exports.GLOBSTAR && p0 !== "") return "base";
68269
+ if (!this.#endCheck || drives[r] !== -1) return void 0;
68270
+ if (row.length === 3 && p0 === exports.GLOBSTAR && p2 === exports.GLOBSTAR && p1 !== exports.GLOBSTAR && p1 !== "" && this.maxGlobstarRecursion > 0) return "mid";
68271
+ if (row.length === 2 && p1 === exports.GLOBSTAR && p0 !== exports.GLOBSTAR && p0 !== "") return "head";
68272
+ });
68273
+ }
68274
+ #norm(p) {
68275
+ return this.#form ? p.normalize(this.#form) : p;
68276
+ }
68277
+ #rootIndex(row) {
68278
+ if (!this.isWindows) return -1;
68279
+ if (isDrive(row[0])) return 0;
68280
+ if (row[0] === "" && row[1] === "" && row[2] === "?" && isDrive(row[3])) return 3;
68281
+ const h = uncHost(row);
68282
+ return h === -1 ? -1 : h + 1;
67768
68283
  }
67769
68284
  hasMagic() {
67770
68285
  if (this.options.magicalBraces && this.set.length > 1) return true;
67771
68286
  for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
67772
68287
  return false;
67773
68288
  }
67774
- debug(..._) {}
67775
68289
  make() {
67776
68290
  const pattern = this.pattern;
67777
68291
  const options = this.options;
@@ -67785,27 +68299,64 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67785
68299
  }
67786
68300
  this.parseNegate();
67787
68301
  this.globSet = [...new Set(this.braceExpand())];
67788
- if (options.debug) this.debug = (...args) => console.error(...args);
67789
- this.debug(this.pattern, this.globSet);
67790
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
68302
+ const rawGlobParts = this.globSet.map((s) => this.#slashSplit(s));
67791
68303
  this.globParts = this.preprocess(rawGlobParts);
67792
- this.debug(this.pattern, this.globParts);
67793
- let set = this.globParts.map((s, _, __) => {
68304
+ this.#pending = true;
68305
+ this.set = this.globParts.map((s, _, __) => {
67794
68306
  if (this.isWindows && this.windowsNoMagicRoot) {
67795
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
68307
+ const n = s[2] === "?" && isLongUNC(s[3]) ? 6 : 4;
68308
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && s.slice(3, n).every((p) => !globMagic.test(p));
67796
68309
  const isDrive = /^[a-z]:/i.test(s[0]);
67797
- if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
67798
- else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
68310
+ if (isUNC) return [...s.slice(0, n).map((p) => this.#norm(p)), ...s.slice(n).map((ss) => this.parse(ss))];
68311
+ else if (isDrive) return [this.#norm(s[0]), ...s.slice(1).map((ss) => this.parse(ss))];
67799
68312
  }
67800
68313
  return s.map((ss) => this.parse(ss));
67801
- });
67802
- this.debug(this.pattern, set);
67803
- this.set = set.filter((s) => s.indexOf(false) === -1);
68314
+ }).filter((s) => s.indexOf(false) === -1);
67804
68315
  if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
67805
68316
  const p = this.set[i];
67806
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
68317
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && (isDrive(p[3]) || isLongUNC(this.globParts[i][3]))) {
68318
+ if (isLongUNC(this.globParts[i][3])) p[3] = "UNC";
68319
+ p[2] = "?";
68320
+ }
68321
+ }
68322
+ if (!options.noext) this.mergeRows();
68323
+ this.#pending = false;
68324
+ this.set.forEach((row, i) => {
68325
+ for (let k = 0; k < row.length; k++) if (row[k] === PENDING) row[k] = this.parse(this.globParts[i][k]);
68326
+ });
68327
+ }
68328
+ mergeRows() {
68329
+ let merged = true;
68330
+ while (merged) {
68331
+ merged = false;
68332
+ const len = Math.max(0, ...this.set.map((r) => r.length));
68333
+ for (let k = 0; k < len; k++) {
68334
+ const groups = /* @__PURE__ */ new Map();
68335
+ this.set.forEach((row, i) => {
68336
+ if (!(row[k] instanceof nonrecursive_glob_match_1.Matcher || row[k] === PENDING) || !extSafe(this.globParts[i][k])) return;
68337
+ const parts = [...this.globParts[i]];
68338
+ parts[k] = "";
68339
+ const key = `${row.length}/${parts.join("/")}`;
68340
+ const g = groups.get(key);
68341
+ if (g) g.push(i);
68342
+ else groups.set(key, [i]);
68343
+ });
68344
+ const drop = /* @__PURE__ */ new Set();
68345
+ for (const g of groups.values()) {
68346
+ if (g.length < 2) continue;
68347
+ const [first, ...rest] = g;
68348
+ const glob = `@(${g.map((i) => this.globParts[i][k]).join("|")})`;
68349
+ this.globParts[first][k] = glob;
68350
+ this.set[first][k] = this.parse(glob);
68351
+ for (const i of rest) drop.add(i);
68352
+ }
68353
+ if (drop.size) {
68354
+ merged = true;
68355
+ this.set = this.set.filter((_, i) => !drop.has(i));
68356
+ this.globParts = this.globParts.filter((_, i) => !drop.has(i));
68357
+ }
68358
+ }
67807
68359
  }
67808
- this.debug(this.pattern, this.set);
67809
68360
  }
67810
68361
  preprocess(globParts) {
67811
68362
  if (this.options.noglobstar) {
@@ -67832,11 +68383,12 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67832
68383
  }
67833
68384
  levelOneOptimize(globParts) {
67834
68385
  return globParts.map((parts) => {
68386
+ const root = this.#rootIndex(parts) + 1;
67835
68387
  parts = parts.reduce((set, part) => {
67836
68388
  const prev = set[set.length - 1];
67837
68389
  if (part === "**" && prev === "**") return set;
67838
68390
  if (part === "..") {
67839
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
68391
+ if (set.length > root && prev && prev !== ".." && prev !== "." && prev !== "**") {
67840
68392
  set.pop();
67841
68393
  return set;
67842
68394
  }
@@ -67847,8 +68399,120 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67847
68399
  return parts.length === 0 ? [""] : parts;
67848
68400
  });
67849
68401
  }
67850
- levelTwoFileOptimize(parts) {
67851
- if (!Array.isArray(parts)) parts = this.slashSplit(parts);
68402
+ #canMatch(f) {
68403
+ const sep = !this.isWindows || !f.includes("\\") ? "/" : f.includes("/") ? "both" : "\\";
68404
+ let ends = this.#endCheck ? 0 : -1;
68405
+ let last = "";
68406
+ let lastStart = 0;
68407
+ let prev;
68408
+ let prevStart = 0;
68409
+ const dot = !!this.options.dot;
68410
+ ROWS: for (let r = 0; r < this.set.length; r++) {
68411
+ const row = this.set[r];
68412
+ const p = row[row.length - 1];
68413
+ let end = ends !== -1 && this.#endRows[r] && p !== exports.GLOBSTAR;
68414
+ if (end && ends === 0) {
68415
+ const i = lastSep(f, f.length, sep);
68416
+ lastStart = i + 1;
68417
+ last = f.slice(lastStart);
68418
+ if (last === "" && i >= 0) {
68419
+ let j = i;
68420
+ while (j > 0 && isSep(f.charCodeAt(j - 1), sep)) j--;
68421
+ prevStart = j === 0 ? 0 : lastSep(f, j - 1, sep) + 1;
68422
+ prev = f.slice(prevStart, j);
68423
+ }
68424
+ const resolves = this.#level2 && (isDots(last) || last === "" && prev !== void 0 && isDots(prev));
68425
+ ends = resolves ? -1 : 1;
68426
+ end = !resolves;
68427
+ }
68428
+ let tailStart = -1;
68429
+ if (end && typeof p === "string") {
68430
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
68431
+ if (tailStart === -1) continue;
68432
+ }
68433
+ if (this.#literalCheck) {
68434
+ for (const l of this.#literals[r]) if (!f.includes(l)) continue ROWS;
68435
+ }
68436
+ if (end && typeof p === "object") {
68437
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
68438
+ if (tailStart === -1) continue;
68439
+ }
68440
+ const shape = this.#shapes[r];
68441
+ if (shape === "base" && end) return "yes";
68442
+ if (shape === "tail" && end) {
68443
+ if (this.#level2 && dotPortion(f, 0, tailStart, true, sep)) return "maybe";
68444
+ if (!dotPortion(f, 0, tailStart, dot, sep)) return "yes";
68445
+ continue;
68446
+ }
68447
+ if (shape === "mid" || shape === "head") {
68448
+ const m = this.#walk(f, row, shape === "head", dot, sep);
68449
+ if (m !== "no") return m;
68450
+ continue;
68451
+ }
68452
+ return "maybe";
68453
+ }
68454
+ return "no";
68455
+ }
68456
+ #matchShape(file, row, shape) {
68457
+ const dot = !!this.options.dot;
68458
+ const n = file.length;
68459
+ if (shape === "head") {
68460
+ if (n < 2 || !portionMatch(row[0], file[0])) return false;
68461
+ for (let i = 1; i < n; i++) if (!walkable(file[i], dot)) return false;
68462
+ return true;
68463
+ }
68464
+ const x = row[1];
68465
+ if (shape === "tail") {
68466
+ let t = n - 1;
68467
+ if (!portionMatch(x, file[t])) {
68468
+ if (file[t] !== "" || n === 1 || !portionMatch(x, file[--t])) return false;
68469
+ }
68470
+ for (let i = 0; i < t; i++) if (!walkable(file[i], dot)) return false;
68471
+ return true;
68472
+ }
68473
+ for (let k = 0; k < n; k++) {
68474
+ if (portionMatch(x, file[k]) && k + 1 < n) {
68475
+ let i = k + 1;
68476
+ while (i < n && walkable(file[i], dot)) i++;
68477
+ if (i === n) return true;
68478
+ }
68479
+ if (!walkable(file[k], dot)) return false;
68480
+ }
68481
+ return false;
68482
+ }
68483
+ #walk(f, row, head, dot, sep) {
68484
+ if (this.#level2 && dotPortion(f, 0, f.length, true, sep)) return "maybe";
68485
+ const x = row[head ? 0 : 1];
68486
+ let s = 0;
68487
+ for (let e = nextSep(f, s, sep); e !== -1; e = nextSep(f, s, sep)) {
68488
+ let next = e + 1;
68489
+ while (next < f.length && isSep(f.charCodeAt(next), sep)) next++;
68490
+ 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";
68491
+ if (head || dotPortion(f, s, next, dot, sep)) return "no";
68492
+ s = next;
68493
+ }
68494
+ return "no";
68495
+ }
68496
+ #cachedSplit(f) {
68497
+ const last = lastSplit;
68498
+ return last?.f === f && last.isWindows === this.isWindows && last.preserveMultipleSlashes === this.preserveMultipleSlashes && last.normalize === this.#form ? last : void 0;
68499
+ }
68500
+ #split(f) {
68501
+ const { isWindows, preserveMultipleSlashes } = this;
68502
+ let parts = this.#slashSplit(isWindows ? f.split("\\").join("/") : f);
68503
+ const normalize = this.#form;
68504
+ if (normalize) parts = parts.map((p) => p.normalize(normalize));
68505
+ lastSplit = {
68506
+ f,
68507
+ isWindows,
68508
+ preserveMultipleSlashes,
68509
+ normalize,
68510
+ parts
68511
+ };
68512
+ return lastSplit;
68513
+ }
68514
+ #levelTwoFileOptimize(file) {
68515
+ const parts = [...file];
67852
68516
  let didSomething = false;
67853
68517
  do {
67854
68518
  didSomething = false;
@@ -67867,19 +68531,21 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67867
68531
  parts.pop();
67868
68532
  }
67869
68533
  }
67870
- let dd = 0;
68534
+ const root = this.#rootIndex(parts) + 1;
68535
+ let dd = root;
67871
68536
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
67872
68537
  const p = parts[dd - 1];
67873
- if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
68538
+ if (p && p !== "." && p !== ".." && p !== "**") {
67874
68539
  didSomething = true;
67875
68540
  parts.splice(dd - 1, 2);
67876
- dd -= 2;
68541
+ dd = Math.max(dd - 2, root);
67877
68542
  }
67878
68543
  }
67879
68544
  } while (didSomething);
67880
68545
  return parts.length === 0 ? [""] : parts;
67881
68546
  }
67882
68547
  firstPhasePreProcess(globParts) {
68548
+ const { braceExpandMax = 1e5 } = this.options;
67883
68549
  let didSomething = false;
67884
68550
  do {
67885
68551
  didSomething = false;
@@ -67893,7 +68559,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67893
68559
  const p = parts[gs + 2];
67894
68560
  const p2 = parts[gs + 3];
67895
68561
  if (next !== "..") continue;
67896
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
68562
+ if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === ".." || globParts.length >= braceExpandMax) continue;
67897
68563
  didSomething = true;
67898
68564
  parts.splice(gs, 1);
67899
68565
  const other = parts.slice(0);
@@ -67916,7 +68582,8 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67916
68582
  parts.pop();
67917
68583
  }
67918
68584
  }
67919
- let dd = 0;
68585
+ const root = this.#rootIndex(parts) + 1;
68586
+ let dd = root;
67920
68587
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
67921
68588
  const p = parts[dd - 1];
67922
68589
  if (p && p !== "." && p !== ".." && p !== "**") {
@@ -67924,7 +68591,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67924
68591
  const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
67925
68592
  parts.splice(dd - 1, 2, ...splin);
67926
68593
  if (parts.length === 0) parts.push("");
67927
- dd -= 2;
68594
+ dd = Math.max(dd - 2, root);
67928
68595
  }
67929
68596
  }
67930
68597
  }
@@ -67932,6 +68599,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67932
68599
  return globParts;
67933
68600
  }
67934
68601
  secondPhasePreProcess(globParts) {
68602
+ if (globParts.length > 1e3) return globParts;
67935
68603
  for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
67936
68604
  const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
67937
68605
  if (matched) {
@@ -67984,10 +68652,22 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67984
68652
  if (negateOffset) this.pattern = pattern.slice(negateOffset);
67985
68653
  this.negate = negate;
67986
68654
  }
67987
- matchOne(file, pattern, partial = false) {
68655
+ #matchRow(file, resolved, pattern, partial) {
67988
68656
  let fileStartIndex = 0;
67989
68657
  let patternStartIndex = 0;
67990
- if (this.isWindows) {
68658
+ const fh = this.isWindows ? uncHost(resolved) : -1;
68659
+ const ph = fh === -1 ? -1 : uncHost(pattern);
68660
+ if (ph !== -1) {
68661
+ const host = pattern[ph];
68662
+ const share = pattern[ph + 1];
68663
+ if (typeof host !== "string" || typeof share !== "string") {
68664
+ fileStartIndex = fh;
68665
+ patternStartIndex = ph;
68666
+ } else if (resolved[fh].toLowerCase() === host.toLowerCase() && resolved[fh + 1].toLowerCase() === share.toLowerCase()) {
68667
+ fileStartIndex = fh + 2;
68668
+ patternStartIndex = ph + 2;
68669
+ }
68670
+ } else if (this.isWindows) {
67991
68671
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
67992
68672
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
67993
68673
  const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
@@ -67997,32 +68677,20 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
67997
68677
  if (typeof fdi === "number" && typeof pdi === "number") {
67998
68678
  const [fd, pd] = [file[fdi], pattern[pdi]];
67999
68679
  if (fd.toLowerCase() === pd.toLowerCase()) {
68000
- pattern[pdi] = fd;
68001
- patternStartIndex = pdi;
68002
- fileStartIndex = fdi;
68680
+ patternStartIndex = pdi + 1;
68681
+ fileStartIndex = fdi + 1;
68003
68682
  }
68004
68683
  }
68005
68684
  }
68006
- const { optimizationLevel = 1 } = this.options;
68007
- if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
68685
+ file = resolved;
68008
68686
  if (pattern.includes(exports.GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
68009
68687
  return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
68010
68688
  }
68011
68689
  #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
68012
- const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
68013
- const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
68014
- const [head, body, tail] = partial ? [
68015
- pattern.slice(patternIndex, firstgs),
68016
- pattern.slice(firstgs + 1),
68017
- []
68018
- ] : [
68019
- pattern.slice(patternIndex, firstgs),
68020
- pattern.slice(firstgs + 1, lastgs),
68021
- pattern.slice(lastgs + 1)
68022
- ];
68690
+ const { head, body, tail, segments } = this.#getGlobstarParts(pattern, partial, patternIndex);
68023
68691
  if (head.length) {
68024
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
68025
- if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
68692
+ const headEnd = fileIndex + head.length;
68693
+ if (!this.#matchOne(file, head, partial, fileIndex, 0, headEnd)) return false;
68026
68694
  fileIndex += head.length;
68027
68695
  patternIndex += head.length;
68028
68696
  }
@@ -68047,67 +68715,86 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
68047
68715
  }
68048
68716
  return partial || sawSome;
68049
68717
  }
68050
- const bodySegments = [[[], 0]];
68051
- let currentBody = bodySegments[0];
68718
+ return !!this.#matchGlobStarBodySections(file, segments, file.length - fileTailMatch, fileIndex, 0, partial, 0, !!fileTailMatch, /* @__PURE__ */ new Set());
68719
+ }
68720
+ #getGlobstarParts(pattern, partial, patternIndex) {
68721
+ let byStart = this.#globstarParts.get(pattern);
68722
+ if (!byStart) {
68723
+ byStart = [];
68724
+ this.#globstarParts.set(pattern, byStart);
68725
+ }
68726
+ const key = patternIndex * 2 + (partial ? 1 : 0);
68727
+ const found = byStart[key];
68728
+ if (found) return found;
68729
+ const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
68730
+ const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
68731
+ const head = pattern.slice(patternIndex, firstgs);
68732
+ const body = pattern.slice(firstgs + 1, partial ? void 0 : lastgs);
68733
+ const tail = partial ? [] : pattern.slice(lastgs + 1);
68734
+ const segments = [[[], 0]];
68735
+ let current = segments[0];
68052
68736
  let nonGsParts = 0;
68053
68737
  const nonGsPartsSums = [0];
68054
68738
  for (const b of body) if (b === exports.GLOBSTAR) {
68055
68739
  nonGsPartsSums.push(nonGsParts);
68056
- currentBody = [[], 0];
68057
- bodySegments.push(currentBody);
68740
+ current = [[], 0];
68741
+ segments.push(current);
68058
68742
  } else {
68059
- currentBody[0].push(b);
68743
+ current[0].push(b);
68060
68744
  nonGsParts++;
68061
68745
  }
68062
- let i = bodySegments.length - 1;
68063
- const fileLength = file.length - fileTailMatch;
68064
- for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
68065
- return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
68746
+ segments.forEach((b, i) => {
68747
+ b[1] = nonGsParts - nonGsPartsSums[i];
68748
+ });
68749
+ const parts = {
68750
+ head,
68751
+ body,
68752
+ tail,
68753
+ segments
68754
+ };
68755
+ byStart[key] = parts;
68756
+ return parts;
68066
68757
  }
68067
- #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
68758
+ #matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex, bodyIndex, partial, globStarDepth, sawTail, tried) {
68068
68759
  const bs = bodySegments[bodyIndex];
68069
68760
  if (!bs) {
68070
- for (let i = fileIndex; i < file.length; i++) {
68761
+ if (partial) return fileIndex >= fileLength || fileIndex === fileLength - 1 && file[fileIndex] === "";
68762
+ for (let i = fileIndex; i < fileLength; i++) {
68071
68763
  sawTail = true;
68072
68764
  const f = file[i];
68073
68765
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
68074
68766
  }
68075
68767
  return sawTail;
68076
68768
  }
68077
- const [body, after] = bs;
68769
+ const [body, need] = bs;
68770
+ const after = partial ? fileLength : fileLength - need;
68078
68771
  while (fileIndex <= after) {
68079
- if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
68080
- const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
68772
+ const key = bodyIndex * (file.length + 1) + fileIndex;
68773
+ if (tried.has(key)) return false;
68774
+ tried.add(key);
68775
+ if (this.#matchOne(file, body, partial, fileIndex, 0, fileIndex + body.length) && globStarDepth < this.maxGlobstarRecursion) {
68776
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail, tried);
68081
68777
  if (sub !== false) return sub;
68082
68778
  }
68779
+ if (fileIndex === after) break;
68083
68780
  const f = file[fileIndex];
68084
68781
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
68085
68782
  fileIndex++;
68086
68783
  }
68087
68784
  return partial || null;
68088
68785
  }
68089
- #matchOne(file, pattern, partial, fileIndex, patternIndex) {
68786
+ #matchOne(file, pattern, partial, fileIndex, patternIndex, fileEnd = file.length) {
68090
68787
  let fi;
68091
68788
  let pi;
68092
68789
  let pl;
68093
68790
  let fl;
68094
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
68095
- this.debug("matchOne loop");
68791
+ for (fi = fileIndex, pi = patternIndex, fl = Math.min(fileEnd, file.length), pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
68096
68792
  let p = pattern[pi];
68097
68793
  let f = file[fi];
68098
- this.debug(pattern, p, f);
68099
68794
  /* c8 ignore start */
68100
68795
  if (p === false || p === exports.GLOBSTAR) return false;
68101
68796
  /* c8 ignore stop */
68102
- let hit;
68103
- if (typeof p === "string") {
68104
- hit = f === p;
68105
- this.debug("string match", p, f, hit);
68106
- } else {
68107
- hit = p.test(f);
68108
- this.debug("pattern match", p, f, hit);
68109
- }
68110
- if (!hit) return false;
68797
+ if (!portionMatch(p, f)) return false;
68111
68798
  }
68112
68799
  if (fi === fl && pi === pl) return true;
68113
68800
  else if (fi === fl) return partial;
@@ -68123,86 +68810,51 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
68123
68810
  const options = this.options;
68124
68811
  if (pattern === "**") return exports.GLOBSTAR;
68125
68812
  if (pattern === "") return "";
68126
- let m;
68127
- let fastTest = null;
68128
- if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
68129
- else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
68130
- else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
68131
- else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
68132
- else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
68133
- const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
68134
- if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
68135
- return re;
68136
- }
68137
- makeRe() {
68138
- if (this.regexp || this.regexp === false) return this.regexp;
68139
- const set = this.set;
68140
- if (!set.length) {
68141
- this.regexp = false;
68142
- return this.regexp;
68143
- }
68144
- const options = this.options;
68145
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
68146
- const flags = new Set(options.nocase ? ["i"] : []);
68147
- let re = set.map((pattern) => {
68148
- const pp = pattern.map((p) => {
68149
- if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
68150
- return typeof p === "string" ? regExpEscape(p) : p === exports.GLOBSTAR ? exports.GLOBSTAR : p._src;
68151
- });
68152
- pp.forEach((p, i) => {
68153
- const next = pp[i + 1];
68154
- const prev = pp[i - 1];
68155
- if (p !== exports.GLOBSTAR || prev === exports.GLOBSTAR) return;
68156
- if (prev === void 0) if (next !== void 0 && next !== exports.GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
68157
- else pp[i] = twoStar;
68158
- else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
68159
- else if (next !== exports.GLOBSTAR) {
68160
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
68161
- pp[i + 1] = exports.GLOBSTAR;
68162
- }
68813
+ const { nocase, nocaseMagicOnly, noext = false, dot, normalize } = options;
68814
+ const lit = literal(pattern, noext);
68815
+ if (lit !== void 0 && !(nocase && !nocaseMagicOnly && pattern.toUpperCase() !== pattern.toLowerCase())) return this.#norm(lit);
68816
+ if (this.#pending) return PENDING;
68817
+ let m = this.#matchers.get(pattern);
68818
+ if (!m) {
68819
+ m = new nonrecursive_glob_match_1.Matcher(pattern, {
68820
+ nocase,
68821
+ noext,
68822
+ dot,
68823
+ normalize
68163
68824
  });
68164
- const filtered = pp.filter((p) => p !== exports.GLOBSTAR);
68165
- if (this.partial && filtered.length >= 1) {
68166
- const prefixes = [];
68167
- for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
68168
- return "(?:" + prefixes.join("|") + ")";
68169
- }
68170
- return filtered.join("/");
68171
- }).join("|");
68172
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
68173
- re = "^" + open + re + close + "$";
68174
- if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
68175
- if (this.negate) re = "^(?!" + re + ").+$";
68176
- try {
68177
- this.regexp = new RegExp(re, [...flags].join(""));
68178
- } catch {
68179
- this.regexp = false;
68825
+ this.#matchers.set(pattern, m);
68180
68826
  }
68181
- /* c8 ignore stop */
68182
- return this.regexp;
68827
+ return m;
68183
68828
  }
68184
- slashSplit(p) {
68829
+ #slashSplit(p) {
68185
68830
  if (this.preserveMultipleSlashes) return p.split("/");
68186
68831
  else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
68187
68832
  else return p.split(/\/+/);
68188
68833
  }
68189
68834
  match(f, partial = this.partial) {
68190
- this.debug("match", f, this.pattern);
68191
68835
  if (this.comment) return false;
68192
68836
  if (this.empty) return f === "";
68193
68837
  if (f === "/" && partial) return true;
68194
68838
  const options = this.options;
68195
- if (this.isWindows) f = f.split("\\").join("/");
68196
- const ff = this.slashSplit(f);
68197
- this.debug(this.pattern, "split", ff);
68839
+ let split = this.#cachedSplit(f);
68840
+ if (!split) {
68841
+ if (!partial && !this.#form && (this.#endCheck || this.#literalCheck) && lastChecked !== f) {
68842
+ lastChecked = f;
68843
+ const can = this.#canMatch(f);
68844
+ if (can === "no") return options.flipNegate ? false : this.negate;
68845
+ if (can === "yes") return options.flipNegate ? true : !this.negate;
68846
+ }
68847
+ split = this.#split(f);
68848
+ }
68849
+ const ff = split.parts;
68850
+ const resolved = this.#level2 ? split.resolved ??= this.#levelTwoFileOptimize(ff) : ff;
68198
68851
  const set = this.set;
68199
- this.debug(this.pattern, "set", set);
68200
68852
  let filename = ff[ff.length - 1];
68201
68853
  if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
68202
- for (const pattern of set) {
68203
- let file = ff;
68204
- if (options.matchBase && pattern.length === 1) file = [filename];
68205
- if (this.matchOne(file, pattern, partial)) {
68854
+ for (let r = 0; r < set.length; r++) {
68855
+ const pattern = set[r];
68856
+ const shape = partial ? void 0 : this.#shapes[r];
68857
+ 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)) {
68206
68858
  if (options.flipNegate) return true;
68207
68859
  return !this.negate;
68208
68860
  }
@@ -68216,13 +68868,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
68216
68868
  };
68217
68869
  exports.Minimatch = Minimatch;
68218
68870
  /* c8 ignore start */
68219
- var ast_js_2 = require_ast();
68220
- Object.defineProperty(exports, "AST", {
68221
- enumerable: true,
68222
- get: function() {
68223
- return ast_js_2.AST;
68224
- }
68225
- });
68226
68871
  var escape_js_2 = require_escape();
68227
68872
  Object.defineProperty(exports, "escape", {
68228
68873
  enumerable: true,
@@ -68238,7 +68883,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
68238
68883
  }
68239
68884
  });
68240
68885
  /* c8 ignore stop */
68241
- exports.minimatch.AST = ast_js_1.AST;
68242
68886
  exports.minimatch.Minimatch = Minimatch;
68243
68887
  exports.minimatch.escape = escape_js_1.escape;
68244
68888
  exports.minimatch.unescape = unescape_js_1.unescape;
@@ -70267,7 +70911,7 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
70267
70911
  exports.Minipass = Minipass;
70268
70912
  }));
70269
70913
  //#endregion
70270
- //#region ../../node_modules/path-scurry/dist/commonjs/index.js
70914
+ //#region ../../node_modules/glob/node_modules/path-scurry/dist/commonjs/index.js
70271
70915
  var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
70272
70916
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
70273
70917
  if (k2 === void 0) k2 = k;
@@ -70291,15 +70935,25 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
70291
70935
  }) : function(o, v) {
70292
70936
  o["default"] = v;
70293
70937
  });
70294
- var __importStar = exports && exports.__importStar || function(mod) {
70295
- if (mod && mod.__esModule) return mod;
70296
- var result = {};
70297
- if (mod != null) {
70298
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
70299
- }
70300
- __setModuleDefault(result, mod);
70301
- return result;
70302
- };
70938
+ var __importStar = exports && exports.__importStar || (function() {
70939
+ var ownKeys = function(o) {
70940
+ ownKeys = Object.getOwnPropertyNames || function(o) {
70941
+ var ar = [];
70942
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
70943
+ return ar;
70944
+ };
70945
+ return ownKeys(o);
70946
+ };
70947
+ return function(mod) {
70948
+ if (mod && mod.__esModule) return mod;
70949
+ var result = {};
70950
+ if (mod != null) {
70951
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
70952
+ }
70953
+ __setModuleDefault(result, mod);
70954
+ return result;
70955
+ };
70956
+ })();
70303
70957
  Object.defineProperty(exports, "__esModule", { value: true });
70304
70958
  exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0;
70305
70959
  const lru_cache_1 = require_commonjs$3();
@@ -70328,12 +70982,17 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
70328
70982
  ...fsOption,
70329
70983
  promises: {
70330
70984
  ...defaultFS.promises,
70331
- ...fsOption.promises || {}
70985
+ ...fsOption.promises
70332
70986
  }
70333
70987
  };
70334
70988
  const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
70335
- const uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\");
70336
- const eitherSep = /[\\\/]/;
70989
+ const uncLongRegexp = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i;
70990
+ const uncShareRegexp = /^\\\\[^\\?]+\\[^\\]+$/;
70991
+ const uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\").replace(uncLongRegexp, "\\\\$1\\").replace(uncShareRegexp, "$&\\");
70992
+ const longUncRoot = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i;
70993
+ const longDrivePrefix = /^[\\/]{2}\?[\\/](?=[a-z]:)/i;
70994
+ const longUncPrefix = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i;
70995
+ const eitherSep = /[\\/]/;
70337
70996
  const UNKNOWN = 0;
70338
70997
  const IFIFO = 1;
70339
70998
  const IFCHR = 2;
@@ -70570,6 +71229,15 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
70570
71229
  else this.#fs = fsFromOption(opts.fs);
70571
71230
  }
70572
71231
  /**
71232
+ * The file system methods that this Path uses, for a new root on
71233
+ * another drive or UNC share.
71234
+ *
71235
+ * @internal
71236
+ */
71237
+ get fs() {
71238
+ return this.#fs;
71239
+ }
71240
+ /**
70573
71241
  * Returns the depth of the Path object from its root.
70574
71242
  *
70575
71243
  * For example, a path at `/foo/bar` would have a depth of 2.
@@ -71159,7 +71827,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
71159
71827
  try {
71160
71828
  const rp = await this.#fs.promises.realpath(this.fullpath());
71161
71829
  return this.#realpath = this.resolve(rp);
71162
- } catch (_) {
71830
+ } catch {
71163
71831
  this.#markENOREALPATH();
71164
71832
  }
71165
71833
  }
@@ -71172,7 +71840,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
71172
71840
  try {
71173
71841
  const rp = this.#fs.realpathSync(this.fullpath());
71174
71842
  return this.#realpath = this.resolve(rp);
71175
- } catch (_) {
71843
+ } catch {
71176
71844
  this.#markENOREALPATH();
71177
71845
  }
71178
71846
  }
@@ -71239,23 +71907,25 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
71239
71907
  * @internal
71240
71908
  */
71241
71909
  getRootString(path) {
71242
- return node_path_1.win32.parse(path).root;
71910
+ return longUncRoot.exec(path)?.[0] ?? node_path_1.win32.parse(path).root;
71243
71911
  }
71244
71912
  /**
71245
71913
  * @internal
71246
71914
  */
71247
71915
  getRoot(rootPath) {
71248
71916
  rootPath = uncToDrive(rootPath.toUpperCase());
71249
- if (rootPath === this.root.name) return this.root;
71917
+ if (rootPath === this.root.name || /^[\\/]$/.test(rootPath)) return this.root;
71250
71918
  for (const [compare, root] of Object.entries(this.roots)) if (this.sameRoot(rootPath, compare)) return this.roots[rootPath] = root;
71251
- return this.roots[rootPath] = new PathScurryWin32(rootPath, this).root;
71919
+ return this.roots[rootPath] = new PathScurryWin32(rootPath, {
71920
+ nocase: this.nocase,
71921
+ fs: this.fs
71922
+ }).root;
71252
71923
  }
71253
71924
  /**
71254
71925
  * @internal
71255
71926
  */
71256
71927
  sameRoot(rootPath, compare = this.root.name) {
71257
- rootPath = rootPath.toUpperCase().replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\");
71258
- return rootPath === compare;
71928
+ return uncToDrive(rootPath.toUpperCase()) === compare;
71259
71929
  }
71260
71930
  };
71261
71931
  exports.PathWin32 = PathWin32;
@@ -71783,6 +72453,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
71783
72453
  sep = "\\";
71784
72454
  constructor(cwd = process.cwd(), opts = {}) {
71785
72455
  const { nocase = true } = opts;
72456
+ if (typeof cwd === "string" && !cwd.startsWith("file://")) cwd = cwd.replace(longDrivePrefix, "").replace(longUncPrefix, "\\");
71786
72457
  super(cwd, node_path_1.win32, "\\", {
71787
72458
  ...opts,
71788
72459
  nocase
@@ -71915,26 +72586,17 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
71915
72586
  this.#platform = platform;
71916
72587
  if (this.#index === 0) {
71917
72588
  if (this.isUNC()) {
71918
- const [p0, p1, p2, p3, ...prest] = this.#patternList;
71919
- const [g0, g1, g2, g3, ...grest] = this.#globList;
72589
+ const n = this.#isLongUNC() ? 6 : 4;
72590
+ const proot = this.#patternList.slice(0, n);
72591
+ const groot = this.#globList.slice(0, n);
72592
+ const prest = this.#patternList.slice(n);
72593
+ const grest = this.#globList.slice(n);
71920
72594
  if (prest[0] === "") {
71921
72595
  prest.shift();
71922
72596
  grest.shift();
71923
72597
  }
71924
- const p = [
71925
- p0,
71926
- p1,
71927
- p2,
71928
- p3,
71929
- ""
71930
- ].join("/");
71931
- const g = [
71932
- g0,
71933
- g1,
71934
- g2,
71935
- g3,
71936
- ""
71937
- ].join("/");
72598
+ const p = [...proot, ""].join("/");
72599
+ const g = [...groot, ""].join("/");
71938
72600
  this.#patternList = [p, ...prest];
71939
72601
  this.#globList = [g, ...grest];
71940
72602
  this.length = this.#patternList.length;
@@ -71945,8 +72607,8 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
71945
72607
  prest.shift();
71946
72608
  grest.shift();
71947
72609
  }
71948
- const p = p1 + "/";
71949
- const g = g1 + "/";
72610
+ const p = `${p1}/`;
72611
+ const g = `${g1}/`;
71950
72612
  this.#patternList = [p, ...prest];
71951
72613
  this.#globList = [g, ...grest];
71952
72614
  this.length = this.#patternList.length;
@@ -71954,7 +72616,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
71954
72616
  }
71955
72617
  }
71956
72618
  [customInspect]() {
71957
- return "Pattern <" + this.#globList.slice(this.#index).join("/") + ">";
72619
+ return `Pattern <${this.#globList.slice(this.#index).join("/")}>`;
71958
72620
  }
71959
72621
  /**
71960
72622
  * The first entry in the parsed list of patterns
@@ -71975,10 +72637,10 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
71975
72637
  return this.#patternList[this.#index] === minimatch_1.GLOBSTAR;
71976
72638
  }
71977
72639
  /**
71978
- * true if pattern() returns a regexp
72640
+ * true if pattern() returns a Matcher, for a portion with magic
71979
72641
  */
71980
- isRegExp() {
71981
- return this.#patternList[this.#index] instanceof RegExp;
72642
+ isMatcher() {
72643
+ return typeof this.#patternList[this.#index] === "object";
71982
72644
  }
71983
72645
  /**
71984
72646
  * The /-joined set of glob parts that make up this pattern
@@ -72004,12 +72666,17 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
72004
72666
  this.#rest.#isDrive = this.#isDrive;
72005
72667
  return this.#rest;
72006
72668
  }
72669
+ #isLongUNC() {
72670
+ const pl = this.#patternList;
72671
+ return pl[2] === "?" && typeof pl[3] === "string" && /^unc$/i.test(pl[3]);
72672
+ }
72007
72673
  /**
72008
72674
  * true if the pattern represents a //unc/path/ on windows
72009
72675
  */
72010
72676
  isUNC() {
72011
72677
  const pl = this.#patternList;
72012
- 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];
72678
+ const h = this.#isLongUNC() ? 4 : 2;
72679
+ 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];
72013
72680
  }
72014
72681
  /**
72015
72682
  * True if the pattern starts with a drive letter on Windows
@@ -72067,23 +72734,39 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
72067
72734
  absoluteChildren;
72068
72735
  platform;
72069
72736
  mmopts;
72070
- constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform }) {
72737
+ /**
72738
+ * The escaped glob for the directory that a pattern starting with
72739
+ * `/` is rooted at, with no trailing `/`.
72740
+ */
72741
+ slashRoot;
72742
+ /**
72743
+ * Patterns that start with `/` (but not drive letters or UNC paths
72744
+ * on Windows) start at the `root` option if it is set, or else at
72745
+ * the root of `cwd`, the same as non-ignored patterns. If `cwd` is
72746
+ * not provided, they start at `/`.
72747
+ */
72748
+ constructor(ignored, { nobrace, nocase, noext, noglobstar, normalize, platform = defaultPlatform, root, windowsPathsNoEscape, allowWindowsEscape }, cwd) {
72071
72749
  this.relative = [];
72072
72750
  this.absolute = [];
72073
72751
  this.relativeChildren = [];
72074
72752
  this.absoluteChildren = [];
72075
72753
  this.platform = platform;
72754
+ windowsPathsNoEscape = !!windowsPathsNoEscape || allowWindowsEscape === false;
72076
72755
  this.mmopts = {
72077
72756
  dot: true,
72078
72757
  nobrace,
72079
72758
  nocase,
72080
72759
  noext,
72081
72760
  noglobstar,
72761
+ normalize,
72082
72762
  optimizationLevel: 2,
72083
72763
  platform,
72084
72764
  nocomment: true,
72085
- nonegate: true
72765
+ nonegate: true,
72766
+ windowsPathsNoEscape
72086
72767
  };
72768
+ const slashRoot = cwd?.resolve(root ?? "/").fullpath() ?? "/";
72769
+ this.slashRoot = (0, minimatch_1.escape)(slashRoot.replace(/\\/g, "/").replace(/\/$/, ""), { windowsPathsNoEscape });
72087
72770
  for (const ign of ignored) this.add(ign);
72088
72771
  }
72089
72772
  add(ign) {
@@ -72099,7 +72782,8 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
72099
72782
  }
72100
72783
  /* c8 ignore stop */
72101
72784
  const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
72102
- const m = new minimatch_1.Minimatch(p.globString(), this.mmopts);
72785
+ const glob = p.root() === "/" ? `${this.slashRoot}/${p.rest()?.globString() ?? ""}` : p.globString();
72786
+ const m = new minimatch_1.Minimatch(glob, this.mmopts);
72103
72787
  const children = globParts[globParts.length - 1] === "**";
72104
72788
  const absolute = p.isAbsolute();
72105
72789
  if (absolute) this.absolute.push(m);
@@ -72118,8 +72802,8 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
72118
72802
  return false;
72119
72803
  }
72120
72804
  childrenIgnored(p) {
72121
- const fullpath = p.fullpath() + "/";
72122
- const relative = (p.relative() || ".") + "/";
72805
+ const fullpath = `${p.fullpath()}/`;
72806
+ const relative = `${p.relative() || "."}/`;
72123
72807
  for (const m of this.relativeChildren) if (m.match(relative)) return true;
72124
72808
  for (const m of this.absoluteChildren) if (m.match(fullpath)) return true;
72125
72809
  return false;
@@ -72134,24 +72818,38 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
72134
72818
  exports.Processor = exports.SubWalks = exports.MatchRecord = exports.HasWalkedCache = void 0;
72135
72819
  const minimatch_1 = require_commonjs$4();
72136
72820
  /**
72137
- * A cache of which patterns have been processed for a given Path
72821
+ * A cache of which patterns have been processed for a given Path, in
72822
+ * this walk step and the steps that led to it.
72823
+ *
72824
+ * A step only adds to it before it makes the caches for the next
72825
+ * steps, so a copy can look up the chain of caches before it, in
72826
+ * place of copying their entries. A pattern for a path that a cache
72827
+ * up the chain has already seen is added to that cache's set, so that
72828
+ * the other steps that share it see it too. Paths are keyed by their
72829
+ * full path, because path-scurry can make a new Path object for the
72830
+ * same path once its cache of children is full.
72138
72831
  */
72139
72832
  var HasWalkedCache = class HasWalkedCache {
72833
+ parent;
72140
72834
  store;
72141
- constructor(store = /* @__PURE__ */ new Map()) {
72142
- this.store = store;
72835
+ constructor(parent) {
72836
+ this.parent = parent;
72143
72837
  }
72144
72838
  copy() {
72145
- return new HasWalkedCache(new Map(this.store));
72839
+ return new HasWalkedCache(this);
72840
+ }
72841
+ #find(fullpath) {
72842
+ const set = this.store?.get(fullpath);
72843
+ return set || !this.parent ? set : this.parent.#find(fullpath);
72146
72844
  }
72147
72845
  hasWalked(target, pattern) {
72148
- return this.store.get(target.fullpath())?.has(pattern.globString());
72846
+ return !!this.#find(target.fullpath())?.has(pattern.globString());
72149
72847
  }
72150
72848
  storeWalked(target, pattern) {
72151
72849
  const fullpath = target.fullpath();
72152
- const cached = this.store.get(fullpath);
72850
+ const cached = this.#find(fullpath);
72153
72851
  if (cached) cached.add(pattern.globString());
72154
- else this.store.set(fullpath, new Set([pattern.globString()]));
72852
+ else (this.store ??= /* @__PURE__ */ new Map()).set(fullpath, new Set([pattern.globString()]));
72155
72853
  }
72156
72854
  };
72157
72855
  exports.HasWalkedCache = HasWalkedCache;
@@ -72159,21 +72857,18 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
72159
72857
  * A record of which paths have been matched in a given walk step,
72160
72858
  * and whether they only are considered a match if they are a directory,
72161
72859
  * and whether their absolute or relative path should be returned.
72860
+ * The store maps each path to {@link MatchRecord.ABSOLUTE} and
72861
+ * {@link MatchRecord.IF_DIR} flags.
72162
72862
  */
72163
- var MatchRecord = class {
72863
+ var MatchRecord = class MatchRecord {
72864
+ static ABSOLUTE = 2;
72865
+ static IF_DIR = 1;
72164
72866
  store = /* @__PURE__ */ new Map();
72165
72867
  add(target, absolute, ifDir) {
72166
- const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
72868
+ const n = (absolute ? MatchRecord.ABSOLUTE : 0) | (ifDir ? MatchRecord.IF_DIR : 0);
72167
72869
  const current = this.store.get(target);
72168
72870
  this.store.set(target, current === void 0 ? n : n & current);
72169
72871
  }
72170
- entries() {
72171
- return [...this.store.entries()].map(([path, n]) => [
72172
- path,
72173
- !!(n & 2),
72174
- !!(n & 1)
72175
- ]);
72176
- }
72177
72872
  };
72178
72873
  exports.MatchRecord = MatchRecord;
72179
72874
  /**
@@ -72264,7 +72959,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
72264
72959
  if (!rrest) this.matches.add(tp, absolute, true);
72265
72960
  else if (!this.hasWalkedCache.hasWalked(tp, rrest)) this.subwalks.add(tp, rrest);
72266
72961
  }
72267
- } else if (p instanceof RegExp) this.subwalks.add(t, pattern);
72962
+ } else if (typeof p === "object") this.subwalks.add(t, pattern);
72268
72963
  }
72269
72964
  return this;
72270
72965
  }
@@ -72282,7 +72977,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
72282
72977
  const p = pattern.pattern();
72283
72978
  const rest = pattern.rest();
72284
72979
  if (p === minimatch_1.GLOBSTAR) results.testGlobstar(e, pattern, rest, absolute);
72285
- else if (p instanceof RegExp) results.testRegExp(e, p, rest, absolute);
72980
+ else if (typeof p === "object") results.testMatcher(e, p, rest, absolute);
72286
72981
  else results.testString(e, p, rest, absolute);
72287
72982
  }
72288
72983
  return results;
@@ -72306,11 +73001,11 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
72306
73001
  const ep = e.parent || e;
72307
73002
  /* c8 ignore stop */
72308
73003
  this.subwalks.add(ep, rest);
72309
- } else if (rp instanceof RegExp) this.testRegExp(e, rp, rest.rest(), absolute);
73004
+ } else if (typeof rp === "object") this.testMatcher(e, rp, rest.rest(), absolute);
72310
73005
  }
72311
73006
  }
72312
- testRegExp(e, p, rest, absolute) {
72313
- if (!p.test(e.name)) return;
73007
+ testMatcher(e, p, rest, absolute) {
73008
+ if (!p.testUnchecked(e.name)) return;
72314
73009
  if (!rest) this.matches.add(e, absolute, false);
72315
73010
  else this.subwalks.add(e, rest);
72316
73011
  }
@@ -72335,7 +73030,8 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72335
73030
  const minipass_1 = require_commonjs$2();
72336
73031
  const ignore_js_1 = require_ignore();
72337
73032
  const processor_js_1 = require_processor();
72338
- 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;
73033
+ const { ABSOLUTE, IF_DIR } = processor_js_1.MatchRecord;
73034
+ 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;
72339
73035
  /**
72340
73036
  * basic walking utilities that all the glob walker types use
72341
73037
  */
@@ -72359,7 +73055,7 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72359
73055
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
72360
73056
  this.includeChildMatches = opts.includeChildMatches !== false;
72361
73057
  if (opts.ignore || !this.includeChildMatches) {
72362
- this.#ignore = makeIgnore(opts.ignore ?? [], opts);
73058
+ this.#ignore = makeIgnore(opts.ignore ?? [], opts, path);
72363
73059
  if (!this.includeChildMatches && typeof this.#ignore.add !== "function") throw new Error("cannot ignore child matches, ignore lacks add() method.");
72364
73060
  }
72365
73061
  /* c8 ignore start */
@@ -72390,21 +73086,21 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72390
73086
  while (!this.paused && (fn = this.#onResume.shift())) fn();
72391
73087
  }
72392
73088
  onResume(fn) {
72393
- if (this.signal?.aborted) return;
72394
73089
  /* c8 ignore start */
72395
73090
  if (!this.paused) fn();
72396
73091
  else
72397
73092
  /* c8 ignore stop */
72398
73093
  this.#onResume.push(fn);
72399
73094
  }
72400
- async matchCheck(e, ifDir) {
73095
+ async matchCheck(inPath, ifDir) {
72401
73096
  if (ifDir && this.opts.nodir) return void 0;
72402
73097
  let rpc;
73098
+ let e;
72403
73099
  if (this.opts.realpath) {
72404
- rpc = e.realpathCached() || await e.realpath();
73100
+ rpc = inPath.realpathCached() || await inPath.realpath();
72405
73101
  if (!rpc) return void 0;
72406
73102
  e = rpc;
72407
- }
73103
+ } else e = inPath;
72408
73104
  const s = e.isUnknown() || this.opts.stat ? await e.lstat() : e;
72409
73105
  if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
72410
73106
  const target = await s.realpath();
@@ -72416,14 +73112,15 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72416
73112
  matchCheckTest(e, ifDir) {
72417
73113
  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;
72418
73114
  }
72419
- matchCheckSync(e, ifDir) {
73115
+ matchCheckSync(inPath, ifDir) {
72420
73116
  if (ifDir && this.opts.nodir) return void 0;
72421
73117
  let rpc;
73118
+ let e;
72422
73119
  if (this.opts.realpath) {
72423
- rpc = e.realpathCached() || e.realpathSync();
73120
+ rpc = inPath.realpathCached() || inPath.realpathSync();
72424
73121
  if (!rpc) return void 0;
72425
73122
  e = rpc;
72426
- }
73123
+ } else e = inPath;
72427
73124
  const s = e.isUnknown() || this.opts.stat ? e.lstatSync() : e;
72428
73125
  if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
72429
73126
  const target = s.realpathSync();
@@ -72433,6 +73130,9 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72433
73130
  }
72434
73131
  matchFinish(e, absolute) {
72435
73132
  if (this.#ignored(e)) return;
73133
+ this.#matchEmitChecked(e, absolute);
73134
+ }
73135
+ #matchEmitChecked(e, absolute) {
72436
73136
  if (!this.includeChildMatches && this.#ignore?.add) {
72437
73137
  const ign = `${e.relativePosix()}/**`;
72438
73138
  this.#ignore.add(ign);
@@ -72446,8 +73146,8 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72446
73146
  this.matchEmit(abs + mark);
72447
73147
  } else {
72448
73148
  const rel = this.opts.posix ? e.relativePosix() : e.relative();
72449
- const pre = this.opts.dotRelative && !rel.startsWith(".." + this.#sep) ? "." + this.#sep : "";
72450
- this.matchEmit(!rel ? "." + mark : pre + rel + mark);
73149
+ const pre = this.opts.dotRelative && !rel.startsWith(`..${this.#sep}`) ? `.${this.#sep}` : "";
73150
+ this.matchEmit(!rel ? `.${mark}` : pre + rel + mark);
72451
73151
  }
72452
73152
  }
72453
73153
  async match(e, absolute, ifDir) {
@@ -72456,17 +73156,17 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72456
73156
  }
72457
73157
  matchSync(e, absolute, ifDir) {
72458
73158
  const p = this.matchCheckSync(e, ifDir);
72459
- if (p) this.matchFinish(p, absolute);
73159
+ if (p) this.#matchEmitChecked(p, absolute);
72460
73160
  }
72461
73161
  walkCB(target, patterns, cb) {
72462
73162
  /* c8 ignore start */
72463
- if (this.signal?.aborted) cb();
73163
+ if (this.signal?.aborted) return cb();
72464
73164
  /* c8 ignore stop */
72465
73165
  this.walkCB2(target, patterns, new processor_js_1.Processor(this.opts), cb);
72466
73166
  }
72467
73167
  walkCB2(target, patterns, processor, cb) {
72468
73168
  if (this.#childrenIgnored(target)) return cb();
72469
- if (this.signal?.aborted) cb();
73169
+ if (this.signal?.aborted) return cb();
72470
73170
  if (this.paused) {
72471
73171
  this.onResume(() => this.walkCB2(target, patterns, processor, cb));
72472
73172
  return;
@@ -72476,10 +73176,10 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72476
73176
  const next = () => {
72477
73177
  if (--tasks === 0) cb();
72478
73178
  };
72479
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
73179
+ for (const [m, n] of processor.matches.store) {
72480
73180
  if (this.#ignored(m)) continue;
72481
73181
  tasks++;
72482
- this.match(m, absolute, ifDir).then(() => next());
73182
+ this.match(m, !!(n & ABSOLUTE), !!(n & IF_DIR)).then(() => next());
72483
73183
  }
72484
73184
  for (const t of processor.subwalkTargets()) {
72485
73185
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) continue;
@@ -72490,32 +73190,32 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72490
73190
  }
72491
73191
  next();
72492
73192
  }
72493
- walkCB3(target, entries, processor, cb) {
72494
- processor = processor.filterEntries(target, entries);
73193
+ walkCB3(target, entries, processorx, cb) {
73194
+ const proc = processorx.filterEntries(target, entries);
72495
73195
  let tasks = 1;
72496
73196
  const next = () => {
72497
73197
  if (--tasks === 0) cb();
72498
73198
  };
72499
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
73199
+ for (const [m, n] of proc.matches.store) {
72500
73200
  if (this.#ignored(m)) continue;
72501
73201
  tasks++;
72502
- this.match(m, absolute, ifDir).then(() => next());
73202
+ this.match(m, !!(n & ABSOLUTE), !!(n & IF_DIR)).then(() => next());
72503
73203
  }
72504
- for (const [target, patterns] of processor.subwalks.entries()) {
73204
+ for (const [target, patterns] of proc.subwalks.entries()) {
72505
73205
  tasks++;
72506
- this.walkCB2(target, patterns, processor.child(), next);
73206
+ this.walkCB2(target, patterns, proc.child(), next);
72507
73207
  }
72508
73208
  next();
72509
73209
  }
72510
73210
  walkCBSync(target, patterns, cb) {
72511
73211
  /* c8 ignore start */
72512
- if (this.signal?.aborted) cb();
73212
+ if (this.signal?.aborted) return cb();
72513
73213
  /* c8 ignore stop */
72514
73214
  this.walkCB2Sync(target, patterns, new processor_js_1.Processor(this.opts), cb);
72515
73215
  }
72516
73216
  walkCB2Sync(target, patterns, processor, cb) {
72517
73217
  if (this.#childrenIgnored(target)) return cb();
72518
- if (this.signal?.aborted) cb();
73218
+ if (this.signal?.aborted) return cb();
72519
73219
  if (this.paused) {
72520
73220
  this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb));
72521
73221
  return;
@@ -72525,9 +73225,9 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72525
73225
  const next = () => {
72526
73226
  if (--tasks === 0) cb();
72527
73227
  };
72528
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
73228
+ for (const [m, n] of processor.matches.store) {
72529
73229
  if (this.#ignored(m)) continue;
72530
- this.matchSync(m, absolute, ifDir);
73230
+ this.matchSync(m, !!(n & ABSOLUTE), !!(n & IF_DIR));
72531
73231
  }
72532
73232
  for (const t of processor.subwalkTargets()) {
72533
73233
  if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) continue;
@@ -72538,30 +73238,30 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
72538
73238
  next();
72539
73239
  }
72540
73240
  walkCB3Sync(target, entries, processor, cb) {
72541
- processor = processor.filterEntries(target, entries);
73241
+ const proc = processor.filterEntries(target, entries);
72542
73242
  let tasks = 1;
72543
73243
  const next = () => {
72544
73244
  if (--tasks === 0) cb();
72545
73245
  };
72546
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
73246
+ for (const [m, n] of proc.matches.store) {
72547
73247
  if (this.#ignored(m)) continue;
72548
- this.matchSync(m, absolute, ifDir);
73248
+ this.matchSync(m, !!(n & ABSOLUTE), !!(n & IF_DIR));
72549
73249
  }
72550
- for (const [target, patterns] of processor.subwalks.entries()) {
73250
+ for (const [target, patterns] of proc.subwalks.entries()) {
72551
73251
  tasks++;
72552
- this.walkCB2Sync(target, patterns, processor.child(), next);
73252
+ this.walkCB2Sync(target, patterns, proc.child(), next);
72553
73253
  }
72554
73254
  next();
72555
73255
  }
72556
73256
  };
72557
73257
  exports.GlobUtil = GlobUtil;
72558
73258
  var GlobWalker = class extends GlobUtil {
72559
- matches = /* @__PURE__ */ new Set();
73259
+ matches = [];
72560
73260
  constructor(patterns, path, opts) {
72561
73261
  super(patterns, path, opts);
72562
73262
  }
72563
73263
  matchEmit(e) {
72564
- this.matches.add(e);
73264
+ this.matches.push(e);
72565
73265
  }
72566
73266
  async walk() {
72567
73267
  if (this.signal?.aborted) throw this.signal.reason;
@@ -72702,14 +73402,14 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
72702
73402
  this.stat = !!opts.stat;
72703
73403
  this.ignore = opts.ignore;
72704
73404
  if (this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
72705
- if (typeof pattern === "string") pattern = [pattern];
73405
+ let p = typeof pattern === "string" ? [pattern] : pattern;
72706
73406
  this.windowsPathsNoEscape = !!opts.windowsPathsNoEscape || opts.allowWindowsEscape === false;
72707
- if (this.windowsPathsNoEscape) pattern = pattern.map((p) => p.replace(/\\/g, "/"));
73407
+ if (this.windowsPathsNoEscape) p = p.map((p) => p.replace(/\\/g, "/"));
72708
73408
  if (this.matchBase) {
72709
73409
  if (opts.noglobstar) throw new TypeError("base matching requires globstar");
72710
- pattern = pattern.map((p) => p.includes("/") ? p : `./**/${p}`);
73410
+ p = p.map((p) => p.includes("/") ? p : `./**/${p}`);
72711
73411
  }
72712
- this.pattern = pattern;
73412
+ this.pattern = p;
72713
73413
  this.platform = opts.platform || defaultPlatform;
72714
73414
  this.opts = {
72715
73415
  ...opts,
@@ -72737,8 +73437,7 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
72737
73437
  nonegate: true,
72738
73438
  optimizationLevel: 2,
72739
73439
  platform: this.platform,
72740
- windowsPathsNoEscape: this.windowsPathsNoEscape,
72741
- debug: !!this.opts.debug
73440
+ windowsPathsNoEscape: this.windowsPathsNoEscape
72742
73441
  };
72743
73442
  const [matchSet, globParts] = this.pattern.map((p) => new minimatch_1.Minimatch(p, mmo)).reduce((set, m) => {
72744
73443
  set[0].push(...m.set);
@@ -72754,22 +73453,22 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
72754
73453
  });
72755
73454
  }
72756
73455
  async walk() {
72757
- return [...await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
73456
+ return await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
72758
73457
  ...this.opts,
72759
73458
  maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
72760
73459
  platform: this.platform,
72761
73460
  nocase: this.nocase,
72762
73461
  includeChildMatches: this.includeChildMatches
72763
- }).walk()];
73462
+ }).walk();
72764
73463
  }
72765
73464
  walkSync() {
72766
- return [...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
73465
+ return new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
72767
73466
  ...this.opts,
72768
73467
  maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
72769
73468
  platform: this.platform,
72770
73469
  nocase: this.nocase,
72771
73470
  includeChildMatches: this.includeChildMatches
72772
- }).walkSync()];
73471
+ }).walkSync();
72773
73472
  }
72774
73473
  stream() {
72775
73474
  return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
@@ -72830,8 +73529,7 @@ var require_has_magic = /* @__PURE__ */ __commonJSMin(((exports) => {
72830
73529
  * is in the options, brace expansion _is_ treated as a pattern having magic.
72831
73530
  */
72832
73531
  const hasMagic = (pattern, options = {}) => {
72833
- if (!Array.isArray(pattern)) pattern = [pattern];
72834
- for (const p of pattern) if (new minimatch_1.Minimatch(p, options).hasMagic()) return true;
73532
+ for (const p of Array.isArray(pattern) ? pattern : [pattern]) if (new minimatch_1.Minimatch(p, options).hasMagic()) return true;
72835
73533
  return false;
72836
73534
  };
72837
73535
  exports.hasMagic = hasMagic;