repoburg 1.3.313 → 1.3.315

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.
@@ -2680,7 +2680,7 @@ var require_server = __commonJS({
2680
2680
  var https = __require("node:https");
2681
2681
  var http22 = __require("node:http2");
2682
2682
  var dns = __require("node:dns");
2683
- var os6 = __require("node:os");
2683
+ var os7 = __require("node:os");
2684
2684
  var { kState, kOptions, kServerBindings, kHttp2ServerSessions } = require_symbols2();
2685
2685
  var { FSTWRN003 } = require_warnings();
2686
2686
  var { onListenHookRunner } = require_hooks();
@@ -2942,7 +2942,7 @@ var require_server = __commonJS({
2942
2942
  }
2943
2943
  function getAddresses(address) {
2944
2944
  if (address.address === "0.0.0.0") {
2945
- return Object.values(os6.networkInterfaces()).flatMap((iface) => {
2945
+ return Object.values(os7.networkInterfaces()).flatMap((iface) => {
2946
2946
  return iface.filter((iface2) => iface2.family === "IPv4");
2947
2947
  }).sort((iface) => {
2948
2948
  return iface.internal ? -1 : 1;
@@ -6128,8 +6128,8 @@ var require_req = __commonJS({
6128
6128
  if (req.originalUrl) {
6129
6129
  _req.url = req.originalUrl;
6130
6130
  } else {
6131
- const path19 = req.path;
6132
- _req.url = typeof path19 === "string" ? path19 : req.url ? req.url.path || req.url : void 0;
6131
+ const path20 = req.path;
6132
+ _req.url = typeof path20 === "string" ? path20 : req.url ? req.url.path || req.url : void 0;
6133
6133
  }
6134
6134
  if (req.query) {
6135
6135
  _req.query = req.query;
@@ -6294,14 +6294,14 @@ var require_redact = __commonJS({
6294
6294
  }
6295
6295
  return obj2;
6296
6296
  }
6297
- function parsePath(path19) {
6297
+ function parsePath(path20) {
6298
6298
  const parts = [];
6299
6299
  let current = "";
6300
6300
  let inBrackets = false;
6301
6301
  let inQuotes = false;
6302
6302
  let quoteChar = "";
6303
- for (let i = 0; i < path19.length; i++) {
6304
- const char = path19[i];
6303
+ for (let i = 0; i < path20.length; i++) {
6304
+ const char = path20[i];
6305
6305
  if (!inBrackets && char === ".") {
6306
6306
  if (current) {
6307
6307
  parts.push(current);
@@ -6432,10 +6432,10 @@ var require_redact = __commonJS({
6432
6432
  return current;
6433
6433
  }
6434
6434
  function redactPaths(obj2, paths, censor, remove = false) {
6435
- for (const path19 of paths) {
6436
- const parts = parsePath(path19);
6435
+ for (const path20 of paths) {
6436
+ const parts = parsePath(path20);
6437
6437
  if (parts.includes("*")) {
6438
- redactWildcardPath(obj2, parts, censor, path19, remove);
6438
+ redactWildcardPath(obj2, parts, censor, path20, remove);
6439
6439
  } else {
6440
6440
  if (remove) {
6441
6441
  removeKey(obj2, parts);
@@ -6520,8 +6520,8 @@ var require_redact = __commonJS({
6520
6520
  }
6521
6521
  } else {
6522
6522
  if (afterWildcard.includes("*")) {
6523
- const wrappedCensor = typeof censor === "function" ? (value, path19) => {
6524
- const fullPath = [...pathArray.slice(0, pathLength), ...path19];
6523
+ const wrappedCensor = typeof censor === "function" ? (value, path20) => {
6524
+ const fullPath = [...pathArray.slice(0, pathLength), ...path20];
6525
6525
  return censor(value, fullPath);
6526
6526
  } : censor;
6527
6527
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -6556,8 +6556,8 @@ var require_redact = __commonJS({
6556
6556
  return null;
6557
6557
  }
6558
6558
  const pathStructure = /* @__PURE__ */ new Map();
6559
- for (const path19 of pathsToClone) {
6560
- const parts = parsePath(path19);
6559
+ for (const path20 of pathsToClone) {
6560
+ const parts = parsePath(path20);
6561
6561
  let current = pathStructure;
6562
6562
  for (let i = 0; i < parts.length; i++) {
6563
6563
  const part = parts[i];
@@ -6609,24 +6609,24 @@ var require_redact = __commonJS({
6609
6609
  }
6610
6610
  return cloneSelectively(obj2, pathStructure);
6611
6611
  }
6612
- function validatePath(path19) {
6613
- if (typeof path19 !== "string") {
6612
+ function validatePath(path20) {
6613
+ if (typeof path20 !== "string") {
6614
6614
  throw new Error("Paths must be (non-empty) strings");
6615
6615
  }
6616
- if (path19 === "") {
6616
+ if (path20 === "") {
6617
6617
  throw new Error("Invalid redaction path ()");
6618
6618
  }
6619
- if (path19.includes("..")) {
6620
- throw new Error(`Invalid redaction path (${path19})`);
6619
+ if (path20.includes("..")) {
6620
+ throw new Error(`Invalid redaction path (${path20})`);
6621
6621
  }
6622
- if (path19.includes(",")) {
6623
- throw new Error(`Invalid redaction path (${path19})`);
6622
+ if (path20.includes(",")) {
6623
+ throw new Error(`Invalid redaction path (${path20})`);
6624
6624
  }
6625
6625
  let bracketCount = 0;
6626
6626
  let inQuotes = false;
6627
6627
  let quoteChar = "";
6628
- for (let i = 0; i < path19.length; i++) {
6629
- const char = path19[i];
6628
+ for (let i = 0; i < path20.length; i++) {
6629
+ const char = path20[i];
6630
6630
  if ((char === '"' || char === "'") && bracketCount > 0) {
6631
6631
  if (!inQuotes) {
6632
6632
  inQuotes = true;
@@ -6640,20 +6640,20 @@ var require_redact = __commonJS({
6640
6640
  } else if (char === "]" && !inQuotes) {
6641
6641
  bracketCount--;
6642
6642
  if (bracketCount < 0) {
6643
- throw new Error(`Invalid redaction path (${path19})`);
6643
+ throw new Error(`Invalid redaction path (${path20})`);
6644
6644
  }
6645
6645
  }
6646
6646
  }
6647
6647
  if (bracketCount !== 0) {
6648
- throw new Error(`Invalid redaction path (${path19})`);
6648
+ throw new Error(`Invalid redaction path (${path20})`);
6649
6649
  }
6650
6650
  }
6651
6651
  function validatePaths(paths) {
6652
6652
  if (!Array.isArray(paths)) {
6653
6653
  throw new TypeError("paths must be an array");
6654
6654
  }
6655
- for (const path19 of paths) {
6656
- validatePath(path19);
6655
+ for (const path20 of paths) {
6656
+ validatePath(path20);
6657
6657
  }
6658
6658
  }
6659
6659
  function slowRedact(options = {}) {
@@ -6821,8 +6821,8 @@ var require_redaction = __commonJS({
6821
6821
  if (shape[k] === null) {
6822
6822
  o[k] = (value) => topCensor(value, [k]);
6823
6823
  } else {
6824
- const wrappedCensor = typeof censor === "function" ? (value, path19) => {
6825
- return censor(value, [k, ...path19]);
6824
+ const wrappedCensor = typeof censor === "function" ? (value, path20) => {
6825
+ return censor(value, [k, ...path20]);
6826
6826
  } : censor;
6827
6827
  o[k] = Redact({
6828
6828
  paths: shape[k],
@@ -7040,10 +7040,10 @@ var require_atomic_sleep = __commonJS({
7040
7040
  var require_sonic_boom = __commonJS({
7041
7041
  "node_modules/sonic-boom/index.js"(exports, module) {
7042
7042
  "use strict";
7043
- var fs11 = __require("fs");
7043
+ var fs12 = __require("fs");
7044
7044
  var EventEmitter5 = __require("events");
7045
7045
  var inherits = __require("util").inherits;
7046
- var path19 = __require("path");
7046
+ var path20 = __require("path");
7047
7047
  var sleep2 = require_atomic_sleep();
7048
7048
  var assert2 = __require("assert");
7049
7049
  var BUSY_WRITE_TIMEOUT = 100;
@@ -7097,20 +7097,20 @@ var require_sonic_boom = __commonJS({
7097
7097
  const mode = sonic.mode;
7098
7098
  if (sonic.sync) {
7099
7099
  try {
7100
- if (sonic.mkdir) fs11.mkdirSync(path19.dirname(file2), { recursive: true });
7101
- const fd = fs11.openSync(file2, flags, mode);
7100
+ if (sonic.mkdir) fs12.mkdirSync(path20.dirname(file2), { recursive: true });
7101
+ const fd = fs12.openSync(file2, flags, mode);
7102
7102
  fileOpened(null, fd);
7103
7103
  } catch (err) {
7104
7104
  fileOpened(err);
7105
7105
  throw err;
7106
7106
  }
7107
7107
  } else if (sonic.mkdir) {
7108
- fs11.mkdir(path19.dirname(file2), { recursive: true }, (err) => {
7108
+ fs12.mkdir(path20.dirname(file2), { recursive: true }, (err) => {
7109
7109
  if (err) return fileOpened(err);
7110
- fs11.open(file2, flags, mode, fileOpened);
7110
+ fs12.open(file2, flags, mode, fileOpened);
7111
7111
  });
7112
7112
  } else {
7113
- fs11.open(file2, flags, mode, fileOpened);
7113
+ fs12.open(file2, flags, mode, fileOpened);
7114
7114
  }
7115
7115
  }
7116
7116
  function SonicBoom(opts) {
@@ -7151,8 +7151,8 @@ var require_sonic_boom = __commonJS({
7151
7151
  this.flush = flushBuffer;
7152
7152
  this.flushSync = flushBufferSync;
7153
7153
  this._actualWrite = actualWriteBuffer;
7154
- fsWriteSync = () => fs11.writeSync(this.fd, this._writingBuf);
7155
- fsWrite = () => fs11.write(this.fd, this._writingBuf, this.release);
7154
+ fsWriteSync = () => fs12.writeSync(this.fd, this._writingBuf);
7155
+ fsWrite = () => fs12.write(this.fd, this._writingBuf, this.release);
7156
7156
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
7157
7157
  this._writingBuf = "";
7158
7158
  this.write = write;
@@ -7161,15 +7161,15 @@ var require_sonic_boom = __commonJS({
7161
7161
  this._actualWrite = actualWrite;
7162
7162
  fsWriteSync = () => {
7163
7163
  if (Buffer.isBuffer(this._writingBuf)) {
7164
- return fs11.writeSync(this.fd, this._writingBuf);
7164
+ return fs12.writeSync(this.fd, this._writingBuf);
7165
7165
  }
7166
- return fs11.writeSync(this.fd, this._writingBuf, "utf8");
7166
+ return fs12.writeSync(this.fd, this._writingBuf, "utf8");
7167
7167
  };
7168
7168
  fsWrite = () => {
7169
7169
  if (Buffer.isBuffer(this._writingBuf)) {
7170
- return fs11.write(this.fd, this._writingBuf, this.release);
7170
+ return fs12.write(this.fd, this._writingBuf, this.release);
7171
7171
  }
7172
- return fs11.write(this.fd, this._writingBuf, "utf8", this.release);
7172
+ return fs12.write(this.fd, this._writingBuf, "utf8", this.release);
7173
7173
  };
7174
7174
  } else {
7175
7175
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
@@ -7226,7 +7226,7 @@ var require_sonic_boom = __commonJS({
7226
7226
  }
7227
7227
  }
7228
7228
  if (this._fsync) {
7229
- fs11.fsyncSync(this.fd);
7229
+ fs12.fsyncSync(this.fd);
7230
7230
  }
7231
7231
  const len = this._len;
7232
7232
  if (this._reopening) {
@@ -7340,7 +7340,7 @@ var require_sonic_boom = __commonJS({
7340
7340
  const onDrain = () => {
7341
7341
  if (!this._fsync) {
7342
7342
  try {
7343
- fs11.fsync(this.fd, (err) => {
7343
+ fs12.fsync(this.fd, (err) => {
7344
7344
  this._flushPending = false;
7345
7345
  cb(err);
7346
7346
  });
@@ -7442,7 +7442,7 @@ var require_sonic_boom = __commonJS({
7442
7442
  const fd = this.fd;
7443
7443
  this.once("ready", () => {
7444
7444
  if (fd !== this.fd) {
7445
- fs11.close(fd, (err) => {
7445
+ fs12.close(fd, (err) => {
7446
7446
  if (err) {
7447
7447
  return this.emit("error", err);
7448
7448
  }
@@ -7491,7 +7491,7 @@ var require_sonic_boom = __commonJS({
7491
7491
  buf = this._bufs[0];
7492
7492
  }
7493
7493
  try {
7494
- const n = Buffer.isBuffer(buf) ? fs11.writeSync(this.fd, buf) : fs11.writeSync(this.fd, buf, "utf8");
7494
+ const n = Buffer.isBuffer(buf) ? fs12.writeSync(this.fd, buf) : fs12.writeSync(this.fd, buf, "utf8");
7495
7495
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
7496
7496
  buf = releasedBufObj.writingBuf;
7497
7497
  this._len = releasedBufObj.len;
@@ -7507,7 +7507,7 @@ var require_sonic_boom = __commonJS({
7507
7507
  }
7508
7508
  }
7509
7509
  try {
7510
- fs11.fsyncSync(this.fd);
7510
+ fs12.fsyncSync(this.fd);
7511
7511
  } catch {
7512
7512
  }
7513
7513
  }
@@ -7528,7 +7528,7 @@ var require_sonic_boom = __commonJS({
7528
7528
  buf = mergeBuf(this._bufs[0], this._lens[0]);
7529
7529
  }
7530
7530
  try {
7531
- const n = fs11.writeSync(this.fd, buf);
7531
+ const n = fs12.writeSync(this.fd, buf);
7532
7532
  buf = buf.subarray(n);
7533
7533
  this._len = Math.max(this._len - n, 0);
7534
7534
  if (buf.length <= 0) {
@@ -7556,13 +7556,13 @@ var require_sonic_boom = __commonJS({
7556
7556
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
7557
7557
  if (this.sync) {
7558
7558
  try {
7559
- const written = Buffer.isBuffer(this._writingBuf) ? fs11.writeSync(this.fd, this._writingBuf) : fs11.writeSync(this.fd, this._writingBuf, "utf8");
7559
+ const written = Buffer.isBuffer(this._writingBuf) ? fs12.writeSync(this.fd, this._writingBuf) : fs12.writeSync(this.fd, this._writingBuf, "utf8");
7560
7560
  release(null, written);
7561
7561
  } catch (err) {
7562
7562
  release(err);
7563
7563
  }
7564
7564
  } else {
7565
- fs11.write(this.fd, this._writingBuf, release);
7565
+ fs12.write(this.fd, this._writingBuf, release);
7566
7566
  }
7567
7567
  }
7568
7568
  function actualWriteBuffer() {
@@ -7571,7 +7571,7 @@ var require_sonic_boom = __commonJS({
7571
7571
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
7572
7572
  if (this.sync) {
7573
7573
  try {
7574
- const written = fs11.writeSync(this.fd, this._writingBuf);
7574
+ const written = fs12.writeSync(this.fd, this._writingBuf);
7575
7575
  release(null, written);
7576
7576
  } catch (err) {
7577
7577
  release(err);
@@ -7580,7 +7580,7 @@ var require_sonic_boom = __commonJS({
7580
7580
  if (kCopyBuffer) {
7581
7581
  this._writingBuf = Buffer.from(this._writingBuf);
7582
7582
  }
7583
- fs11.write(this.fd, this._writingBuf, release);
7583
+ fs12.write(this.fd, this._writingBuf, release);
7584
7584
  }
7585
7585
  }
7586
7586
  function actualClose(sonic) {
@@ -7596,12 +7596,12 @@ var require_sonic_boom = __commonJS({
7596
7596
  sonic._lens = [];
7597
7597
  assert2(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
7598
7598
  try {
7599
- fs11.fsync(sonic.fd, closeWrapped);
7599
+ fs12.fsync(sonic.fd, closeWrapped);
7600
7600
  } catch {
7601
7601
  }
7602
7602
  function closeWrapped() {
7603
7603
  if (sonic.fd !== 1 && sonic.fd !== 2) {
7604
- fs11.close(sonic.fd, done);
7604
+ fs12.close(sonic.fd, done);
7605
7605
  } else {
7606
7606
  done();
7607
7607
  }
@@ -8374,7 +8374,7 @@ var require_transport = __commonJS({
8374
8374
  var { existsSync: existsSync3 } = __require("node:fs");
8375
8375
  var getCallers = require_caller();
8376
8376
  var { join: join6, isAbsolute, sep } = __require("node:path");
8377
- var { fileURLToPath: fileURLToPath5 } = __require("node:url");
8377
+ var { fileURLToPath: fileURLToPath6 } = __require("node:url");
8378
8378
  var sleep2 = require_atomic_sleep();
8379
8379
  var onExit = require_on_exit_leak_free();
8380
8380
  var ThreadStream = require_thread_stream();
@@ -8437,15 +8437,15 @@ var require_transport = __commonJS({
8437
8437
  if (!unquoted) {
8438
8438
  return false;
8439
8439
  }
8440
- let path19 = unquoted;
8441
- if (path19.startsWith("file://")) {
8440
+ let path20 = unquoted;
8441
+ if (path20.startsWith("file://")) {
8442
8442
  try {
8443
- path19 = fileURLToPath5(path19);
8443
+ path20 = fileURLToPath6(path20);
8444
8444
  } catch {
8445
8445
  return false;
8446
8446
  }
8447
8447
  }
8448
- return isAbsolute(path19) && !existsSync3(path19);
8448
+ return isAbsolute(path20) && !existsSync3(path20);
8449
8449
  }
8450
8450
  function stripQuotes(value) {
8451
8451
  const first = value[0];
@@ -10139,7 +10139,7 @@ var require_multistream = __commonJS({
10139
10139
  var require_pino = __commonJS({
10140
10140
  "node_modules/pino/pino.js"(exports, module) {
10141
10141
  "use strict";
10142
- var os6 = __require("node:os");
10142
+ var os7 = __require("node:os");
10143
10143
  var stdSerializers = require_pino_std_serializers();
10144
10144
  var caller = require_caller();
10145
10145
  var redaction = require_redaction();
@@ -10186,7 +10186,7 @@ var require_pino = __commonJS({
10186
10186
  } = symbols;
10187
10187
  var { epochTime, nullTime } = time3;
10188
10188
  var { pid } = process;
10189
- var hostname4 = os6.hostname();
10189
+ var hostname4 = os7.hostname();
10190
10190
  var defaultErrorSerializer = stdSerializers.err;
10191
10191
  var defaultOptions = {
10192
10192
  level: "info",
@@ -17121,8 +17121,8 @@ var require_utils = __commonJS({
17121
17121
  }
17122
17122
  return ind;
17123
17123
  }
17124
- function removeDotSegments(path19) {
17125
- let input = path19;
17124
+ function removeDotSegments(path20) {
17125
+ let input = path20;
17126
17126
  const output = [];
17127
17127
  let nextSlash = -1;
17128
17128
  let len = 0;
@@ -17374,8 +17374,8 @@ var require_schemes = __commonJS({
17374
17374
  wsComponent.secure = void 0;
17375
17375
  }
17376
17376
  if (wsComponent.resourceName) {
17377
- const [path19, query2] = wsComponent.resourceName.split("?");
17378
- wsComponent.path = path19 && path19 !== "/" ? path19 : void 0;
17377
+ const [path20, query2] = wsComponent.resourceName.split("?");
17378
+ wsComponent.path = path20 && path20 !== "/" ? path20 : void 0;
17379
17379
  wsComponent.query = query2;
17380
17380
  wsComponent.resourceName = void 0;
17381
17381
  }
@@ -22312,8 +22312,8 @@ var require_utils2 = __commonJS({
22312
22312
  }
22313
22313
  return ind;
22314
22314
  }
22315
- function removeDotSegments(path19) {
22316
- let input = path19;
22315
+ function removeDotSegments(path20) {
22316
+ let input = path20;
22317
22317
  const output = [];
22318
22318
  let nextSlash = -1;
22319
22319
  let len = 0;
@@ -22658,8 +22658,8 @@ var require_schemes2 = __commonJS({
22658
22658
  wsComponent.secure = void 0;
22659
22659
  }
22660
22660
  if (wsComponent.resourceName) {
22661
- const [path19, query2] = wsComponent.resourceName.split("?");
22662
- wsComponent.path = path19 && path19 !== "/" ? path19 : void 0;
22661
+ const [path20, query2] = wsComponent.resourceName.split("?");
22662
+ wsComponent.path = path20 && path20 !== "/" ? path20 : void 0;
22663
22663
  wsComponent.query = query2;
22664
22664
  wsComponent.resourceName = void 0;
22665
22665
  }
@@ -23435,12 +23435,12 @@ var require_dist = __commonJS({
23435
23435
  throw new Error(`Unknown format "${name}"`);
23436
23436
  return f;
23437
23437
  };
23438
- function addFormats(ajv, list, fs11, exportName) {
23438
+ function addFormats(ajv, list, fs12, exportName) {
23439
23439
  var _a3;
23440
23440
  var _b;
23441
23441
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
23442
23442
  for (const f of list)
23443
- ajv.addFormat(f, fs11[f]);
23443
+ ajv.addFormat(f, fs12[f]);
23444
23444
  }
23445
23445
  module.exports = exports = formatsPlugin;
23446
23446
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -24143,8 +24143,8 @@ var require_utils3 = __commonJS({
24143
24143
  }
24144
24144
  return ind;
24145
24145
  }
24146
- function removeDotSegments(path19) {
24147
- let input = path19;
24146
+ function removeDotSegments(path20) {
24147
+ let input = path20;
24148
24148
  const output = [];
24149
24149
  let nextSlash = -1;
24150
24150
  let len = 0;
@@ -24489,8 +24489,8 @@ var require_schemes3 = __commonJS({
24489
24489
  wsComponent.secure = void 0;
24490
24490
  }
24491
24491
  if (wsComponent.resourceName) {
24492
- const [path19, query2] = wsComponent.resourceName.split("?");
24493
- wsComponent.path = path19 && path19 !== "/" ? path19 : void 0;
24492
+ const [path20, query2] = wsComponent.resourceName.split("?");
24493
+ wsComponent.path = path20 && path20 !== "/" ? path20 : void 0;
24494
24494
  wsComponent.query = query2;
24495
24495
  wsComponent.resourceName = void 0;
24496
24496
  }
@@ -32007,13 +32007,13 @@ var require_node = __commonJS({
32007
32007
  this.staticChildrenNodes[index] = node;
32008
32008
  }
32009
32009
  }
32010
- findStaticMatchingChild(path19, pathIndex) {
32011
- const charCode = path19.charCodeAt(pathIndex);
32010
+ findStaticMatchingChild(path20, pathIndex) {
32011
+ const charCode = path20.charCodeAt(pathIndex);
32012
32012
  const charCodes = this.staticChildrenCharCodes;
32013
32013
  for (let i = 0; i < charCodes.length; i++) {
32014
32014
  if (charCodes[i] === charCode) {
32015
32015
  const staticChild = this.staticChildrenNodes[i];
32016
- if (staticChild.matchPrefix(path19, pathIndex)) {
32016
+ if (staticChild.matchPrefix(path20, pathIndex)) {
32017
32017
  return staticChild;
32018
32018
  }
32019
32019
  return null;
@@ -32021,34 +32021,34 @@ var require_node = __commonJS({
32021
32021
  }
32022
32022
  return null;
32023
32023
  }
32024
- getStaticChild(path19, pathIndex = 0) {
32025
- if (path19.length === pathIndex) {
32024
+ getStaticChild(path20, pathIndex = 0) {
32025
+ if (path20.length === pathIndex) {
32026
32026
  return this;
32027
32027
  }
32028
- const staticChild = this.findStaticMatchingChild(path19, pathIndex);
32028
+ const staticChild = this.findStaticMatchingChild(path20, pathIndex);
32029
32029
  if (staticChild) {
32030
- return staticChild.getStaticChild(path19, pathIndex + staticChild.prefix.length);
32030
+ return staticChild.getStaticChild(path20, pathIndex + staticChild.prefix.length);
32031
32031
  }
32032
32032
  return null;
32033
32033
  }
32034
- createStaticChild(path19) {
32035
- if (path19.length === 0) {
32034
+ createStaticChild(path20) {
32035
+ if (path20.length === 0) {
32036
32036
  return this;
32037
32037
  }
32038
- const childIndex = this.staticChildrenCharCodes.indexOf(path19.charCodeAt(0));
32038
+ const childIndex = this.staticChildrenCharCodes.indexOf(path20.charCodeAt(0));
32039
32039
  let staticChild = childIndex === -1 ? void 0 : this.staticChildrenNodes[childIndex];
32040
32040
  if (staticChild) {
32041
32041
  let i = 1;
32042
32042
  for (; i < staticChild.prefix.length; i++) {
32043
- if (path19.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
32043
+ if (path20.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
32044
32044
  staticChild = staticChild.split(this, i);
32045
32045
  break;
32046
32046
  }
32047
32047
  }
32048
- return staticChild.createStaticChild(path19.slice(i));
32048
+ return staticChild.createStaticChild(path20.slice(i));
32049
32049
  }
32050
- const node = new StaticNode(path19);
32051
- this.setStaticChild(path19.charAt(0), node);
32050
+ const node = new StaticNode(path20);
32051
+ this.setStaticChild(path20.charAt(0), node);
32052
32052
  return node;
32053
32053
  }
32054
32054
  };
@@ -32108,8 +32108,8 @@ var require_node = __commonJS({
32108
32108
  parentNode.setStaticChild(parentPrefix.charAt(0), staticNode);
32109
32109
  return staticNode;
32110
32110
  }
32111
- getNextNode(path19, pathIndex, nodeStack, paramsCount) {
32112
- let node = this.findStaticMatchingChild(path19, pathIndex);
32111
+ getNextNode(path20, pathIndex, nodeStack, paramsCount) {
32112
+ let node = this.findStaticMatchingChild(path20, pathIndex);
32113
32113
  let parametricBrotherNodeIndex = 0;
32114
32114
  if (node === null) {
32115
32115
  if (this.parametricChildren.length === 0) {
@@ -32156,8 +32156,8 @@ var require_node = __commonJS({
32156
32156
  this.kind = NODE_TYPES.PARAMETRIC;
32157
32157
  this.nodePaths = /* @__PURE__ */ new Set([nodePath2]);
32158
32158
  }
32159
- getNextNode(path19, pathIndex) {
32160
- return this.findStaticMatchingChild(path19, pathIndex);
32159
+ getNextNode(path20, pathIndex) {
32160
+ return this.findStaticMatchingChild(path20, pathIndex);
32161
32161
  }
32162
32162
  };
32163
32163
  var WildcardNode = class extends Node {
@@ -32513,81 +32513,81 @@ var require_url_sanitizer = __commonJS({
32513
32513
  return String.fromCharCode(charCode);
32514
32514
  }
32515
32515
  var MIN_NATIVE_SCAN_LENGTH = 12;
32516
- function safeDecodeURI(path19, useSemicolonDelimiter) {
32517
- if (path19.length >= MIN_NATIVE_SCAN_LENGTH) {
32518
- return safeDecodeURINativeScan(path19, useSemicolonDelimiter);
32516
+ function safeDecodeURI(path20, useSemicolonDelimiter) {
32517
+ if (path20.length >= MIN_NATIVE_SCAN_LENGTH) {
32518
+ return safeDecodeURINativeScan(path20, useSemicolonDelimiter);
32519
32519
  }
32520
- return safeDecodeURICharScan(path19, useSemicolonDelimiter, 1);
32520
+ return safeDecodeURICharScan(path20, useSemicolonDelimiter, 1);
32521
32521
  }
32522
- function safeDecodeURINativeScan(path19, useSemicolonDelimiter) {
32523
- const percentIndex = path19.indexOf("%", 1);
32524
- let delimIndex = path19.indexOf("?", 1);
32525
- const hashIndex = path19.indexOf("#", 1);
32522
+ function safeDecodeURINativeScan(path20, useSemicolonDelimiter) {
32523
+ const percentIndex = path20.indexOf("%", 1);
32524
+ let delimIndex = path20.indexOf("?", 1);
32525
+ const hashIndex = path20.indexOf("#", 1);
32526
32526
  if (hashIndex !== -1 && (delimIndex === -1 || hashIndex < delimIndex)) {
32527
32527
  delimIndex = hashIndex;
32528
32528
  }
32529
32529
  if (useSemicolonDelimiter) {
32530
- const semicolonIndex = path19.indexOf(";", 1);
32530
+ const semicolonIndex = path20.indexOf(";", 1);
32531
32531
  if (semicolonIndex !== -1 && (delimIndex === -1 || semicolonIndex < delimIndex)) {
32532
32532
  delimIndex = semicolonIndex;
32533
32533
  }
32534
32534
  }
32535
32535
  if (percentIndex === -1 || delimIndex !== -1 && percentIndex > delimIndex) {
32536
32536
  if (delimIndex === -1) {
32537
- return { path: path19, querystring: "", shouldDecodeParam: false };
32537
+ return { path: path20, querystring: "", shouldDecodeParam: false };
32538
32538
  }
32539
32539
  return {
32540
- path: path19.slice(0, delimIndex),
32541
- querystring: path19.slice(delimIndex + 1),
32540
+ path: path20.slice(0, delimIndex),
32541
+ querystring: path20.slice(delimIndex + 1),
32542
32542
  shouldDecodeParam: false
32543
32543
  };
32544
32544
  }
32545
- return safeDecodeURIPercentScan(path19, useSemicolonDelimiter, percentIndex);
32545
+ return safeDecodeURIPercentScan(path20, useSemicolonDelimiter, percentIndex);
32546
32546
  }
32547
- function safeDecodeURICharScan(path19, useSemicolonDelimiter, startIndex) {
32548
- for (let i = startIndex; i < path19.length; i++) {
32549
- const charCode = path19.charCodeAt(i);
32547
+ function safeDecodeURICharScan(path20, useSemicolonDelimiter, startIndex) {
32548
+ for (let i = startIndex; i < path20.length; i++) {
32549
+ const charCode = path20.charCodeAt(i);
32550
32550
  if (charCode === 37) {
32551
- return safeDecodeURIPercentScan(path19, useSemicolonDelimiter, i);
32551
+ return safeDecodeURIPercentScan(path20, useSemicolonDelimiter, i);
32552
32552
  } else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
32553
32553
  return {
32554
- path: path19.slice(0, i),
32555
- querystring: path19.slice(i + 1),
32554
+ path: path20.slice(0, i),
32555
+ querystring: path20.slice(i + 1),
32556
32556
  shouldDecodeParam: false
32557
32557
  };
32558
32558
  }
32559
32559
  }
32560
- return { path: path19, querystring: "", shouldDecodeParam: false };
32560
+ return { path: path20, querystring: "", shouldDecodeParam: false };
32561
32561
  }
32562
- function reencodePercentChar(path19, index) {
32563
- return path19.slice(0, index + 1) + "25" + path19.slice(index + 1);
32562
+ function reencodePercentChar(path20, index) {
32563
+ return path20.slice(0, index + 1) + "25" + path20.slice(index + 1);
32564
32564
  }
32565
- function safeDecodeURIPercentScan(path19, useSemicolonDelimiter, startIndex) {
32565
+ function safeDecodeURIPercentScan(path20, useSemicolonDelimiter, startIndex) {
32566
32566
  let shouldDecode = false;
32567
32567
  let shouldDecodeParam = false;
32568
32568
  let querystring = "";
32569
- for (let i = startIndex; i < path19.length; i++) {
32570
- const charCode = path19.charCodeAt(i);
32569
+ for (let i = startIndex; i < path20.length; i++) {
32570
+ const charCode = path20.charCodeAt(i);
32571
32571
  if (charCode === 37) {
32572
- const componentCharCode = decodeComponentCharCode(path19.charCodeAt(i + 1), path19.charCodeAt(i + 2));
32572
+ const componentCharCode = decodeComponentCharCode(path20.charCodeAt(i + 1), path20.charCodeAt(i + 2));
32573
32573
  if (componentCharCode === 0) {
32574
32574
  shouldDecode = true;
32575
32575
  } else {
32576
32576
  shouldDecodeParam = true;
32577
32577
  if (componentCharCode === 37) {
32578
32578
  shouldDecode = true;
32579
- path19 = reencodePercentChar(path19, i);
32579
+ path20 = reencodePercentChar(path20, i);
32580
32580
  i += 2;
32581
32581
  }
32582
32582
  i += 2;
32583
32583
  }
32584
32584
  } else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
32585
- querystring = path19.slice(i + 1);
32586
- path19 = path19.slice(0, i);
32585
+ querystring = path20.slice(i + 1);
32586
+ path20 = path20.slice(0, i);
32587
32587
  break;
32588
32588
  }
32589
32589
  }
32590
- const decodedPath = shouldDecode ? decodeURI(path19) : path19;
32590
+ const decodedPath = shouldDecode ? decodeURI(path20) : path20;
32591
32591
  return { path: decodedPath, querystring, shouldDecodeParam };
32592
32592
  }
32593
32593
  function safeDecodeURIComponent(uriComponent) {
@@ -32682,7 +32682,7 @@ var require_find_my_way = __commonJS({
32682
32682
  this.trees = /* @__PURE__ */ Object.create(null);
32683
32683
  this._treeGET = null;
32684
32684
  }
32685
- Router.prototype.on = function on(method, path19, opts, handler, store) {
32685
+ Router.prototype.on = function on(method, path20, opts, handler, store) {
32686
32686
  if (typeof opts === "function") {
32687
32687
  if (handler !== void 0) {
32688
32688
  store = handler;
@@ -32690,34 +32690,34 @@ var require_find_my_way = __commonJS({
32690
32690
  handler = opts;
32691
32691
  opts = {};
32692
32692
  }
32693
- assert2(typeof path19 === "string", "Path should be a string");
32694
- assert2(path19.length > 0, "The path could not be empty");
32695
- assert2(path19[0] === "/" || path19[0] === "*", "The first character of a path should be `/` or `*`");
32693
+ assert2(typeof path20 === "string", "Path should be a string");
32694
+ assert2(path20.length > 0, "The path could not be empty");
32695
+ assert2(path20[0] === "/" || path20[0] === "*", "The first character of a path should be `/` or `*`");
32696
32696
  assert2(typeof handler === "function", "Handler should be a function");
32697
- const optionalParamMatch = path19.match(OPTIONAL_PARAM_REGEXP);
32697
+ const optionalParamMatch = path20.match(OPTIONAL_PARAM_REGEXP);
32698
32698
  if (optionalParamMatch) {
32699
- assert2(path19.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32700
- const pathFull = path19.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32701
- const pathOptional = path19.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32699
+ assert2(path20.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32700
+ const pathFull = path20.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32701
+ const pathOptional = path20.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32702
32702
  this.on(method, pathFull, opts, handler, store);
32703
32703
  this.on(method, pathOptional, opts, handler, store);
32704
32704
  return;
32705
32705
  }
32706
- const route = path19;
32706
+ const route = path20;
32707
32707
  if (this.ignoreDuplicateSlashes) {
32708
- path19 = removeDuplicateSlashes(path19);
32708
+ path20 = removeDuplicateSlashes(path20);
32709
32709
  }
32710
32710
  if (this.ignoreTrailingSlash) {
32711
- path19 = trimLastSlash(path19);
32711
+ path20 = trimLastSlash(path20);
32712
32712
  }
32713
32713
  const methods = Array.isArray(method) ? method : [method];
32714
32714
  for (const method2 of methods) {
32715
32715
  assert2(typeof method2 === "string", "Method should be a string");
32716
32716
  assert2(httpMethods.includes(method2), `Method '${method2}' is not an http method.`);
32717
- this._on(method2, path19, opts, handler, store, route);
32717
+ this._on(method2, path20, opts, handler, store, route);
32718
32718
  }
32719
32719
  };
32720
- Router.prototype._on = function _on(method, path19, opts, handler, store) {
32720
+ Router.prototype._on = function _on(method, path20, opts, handler, store) {
32721
32721
  let constraints = {};
32722
32722
  if (opts.constraints !== void 0) {
32723
32723
  assert2(typeof opts.constraints === "object" && opts.constraints !== null, "Constraints should be an object");
@@ -32730,7 +32730,7 @@ var require_find_my_way = __commonJS({
32730
32730
  if (this.trees[method] === void 0) {
32731
32731
  this.trees[method] = new StaticNode("/");
32732
32732
  }
32733
- let pattern = path19;
32733
+ let pattern = path20;
32734
32734
  if (pattern === "*" && this.trees[method].prefix.length !== 0) {
32735
32735
  const currentRoot = this.trees[method];
32736
32736
  this.trees[method] = new StaticNode("");
@@ -32838,19 +32838,19 @@ var require_find_my_way = __commonJS({
32838
32838
  throw new Error(`Method '${method}' already declared for route '${pattern}' with constraints '${JSON.stringify(constraints)}'`);
32839
32839
  }
32840
32840
  }
32841
- const route = { method, path: path19, pattern, params, opts, handler, store };
32841
+ const route = { method, path: path20, pattern, params, opts, handler, store };
32842
32842
  this.routes.push(route);
32843
32843
  currentNode.addRoute(route, this.constrainer);
32844
32844
  };
32845
- Router.prototype.hasRoute = function hasRoute(method, path19, constraints) {
32846
- const route = this.findRoute(method, path19, constraints);
32845
+ Router.prototype.hasRoute = function hasRoute(method, path20, constraints) {
32846
+ const route = this.findRoute(method, path20, constraints);
32847
32847
  return route !== null;
32848
32848
  };
32849
- Router.prototype.findRoute = function findNode(method, path19, constraints = {}) {
32849
+ Router.prototype.findRoute = function findNode(method, path20, constraints = {}) {
32850
32850
  if (this.trees[method] === void 0) {
32851
32851
  return null;
32852
32852
  }
32853
- let pattern = path19;
32853
+ let pattern = path20;
32854
32854
  let currentNode = this.trees[method];
32855
32855
  let parentNodePathIndex = currentNode.prefix.length;
32856
32856
  const params = [];
@@ -32971,39 +32971,39 @@ var require_find_my_way = __commonJS({
32971
32971
  this._treeGET = null;
32972
32972
  this.routes = [];
32973
32973
  };
32974
- Router.prototype.off = function off(method, path19, constraints) {
32975
- assert2(typeof path19 === "string", "Path should be a string");
32976
- assert2(path19.length > 0, "The path could not be empty");
32977
- assert2(path19[0] === "/" || path19[0] === "*", "The first character of a path should be `/` or `*`");
32974
+ Router.prototype.off = function off(method, path20, constraints) {
32975
+ assert2(typeof path20 === "string", "Path should be a string");
32976
+ assert2(path20.length > 0, "The path could not be empty");
32977
+ assert2(path20[0] === "/" || path20[0] === "*", "The first character of a path should be `/` or `*`");
32978
32978
  assert2(
32979
32979
  typeof constraints === "undefined" || typeof constraints === "object" && !Array.isArray(constraints) && constraints !== null,
32980
32980
  "Constraints should be an object or undefined."
32981
32981
  );
32982
- const optionalParamMatch = path19.match(OPTIONAL_PARAM_REGEXP);
32982
+ const optionalParamMatch = path20.match(OPTIONAL_PARAM_REGEXP);
32983
32983
  if (optionalParamMatch) {
32984
- assert2(path19.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32985
- const pathFull = path19.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32986
- const pathOptional = path19.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32984
+ assert2(path20.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32985
+ const pathFull = path20.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32986
+ const pathOptional = path20.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32987
32987
  this.off(method, pathFull, constraints);
32988
32988
  this.off(method, pathOptional, constraints);
32989
32989
  return;
32990
32990
  }
32991
32991
  if (this.ignoreDuplicateSlashes) {
32992
- path19 = removeDuplicateSlashes(path19);
32992
+ path20 = removeDuplicateSlashes(path20);
32993
32993
  }
32994
32994
  if (this.ignoreTrailingSlash) {
32995
- path19 = trimLastSlash(path19);
32995
+ path20 = trimLastSlash(path20);
32996
32996
  }
32997
32997
  const methods = Array.isArray(method) ? method : [method];
32998
32998
  for (const method2 of methods) {
32999
- this._off(method2, path19, constraints);
32999
+ this._off(method2, path20, constraints);
33000
33000
  }
33001
33001
  };
33002
- Router.prototype._off = function _off(method, path19, constraints) {
33002
+ Router.prototype._off = function _off(method, path20, constraints) {
33003
33003
  assert2(typeof method === "string", "Method should be a string");
33004
33004
  assert2(httpMethods.includes(method), `Method '${method}' is not an http method.`);
33005
33005
  function matcherWithoutConstraints(route) {
33006
- return method !== route.method || path19 !== route.path;
33006
+ return method !== route.method || path20 !== route.path;
33007
33007
  }
33008
33008
  function matcherWithConstraints(route) {
33009
33009
  return matcherWithoutConstraints(route) || !deepEqual(constraints, route.opts.constraints || {});
@@ -33040,37 +33040,37 @@ var require_find_my_way = __commonJS({
33040
33040
  if (handle === null) return this._defaultRoute(req, res, ctx);
33041
33041
  return ctx === void 0 ? handle.handler(req, res, handle.params, handle.store, handle.searchParams) : handle.handler.call(ctx, req, res, handle.params, handle.store, handle.searchParams);
33042
33042
  };
33043
- Router.prototype.find = function find(method, path19, derivedConstraints) {
33043
+ Router.prototype.find = function find(method, path20, derivedConstraints) {
33044
33044
  let currentNode = method === "GET" ? this._treeGET : this.trees[method];
33045
33045
  if (currentNode == null) return null;
33046
- if (path19.charCodeAt(0) !== 47) {
33047
- path19 = path19.replace(FULL_PATH_REGEXP, "/");
33046
+ if (path20.charCodeAt(0) !== 47) {
33047
+ path20 = path20.replace(FULL_PATH_REGEXP, "/");
33048
33048
  }
33049
33049
  if (this.ignoreDuplicateSlashes) {
33050
- path19 = removeDuplicateSlashes(path19);
33050
+ path20 = removeDuplicateSlashes(path20);
33051
33051
  }
33052
33052
  let sanitizedUrl;
33053
33053
  let querystring2;
33054
33054
  let shouldDecodeParam;
33055
33055
  try {
33056
- sanitizedUrl = path19.length >= MIN_NATIVE_SCAN_LENGTH ? safeDecodeURINativeScan(path19, this.useSemicolonDelimiter) : safeDecodeURICharScan(path19, this.useSemicolonDelimiter, 1);
33057
- path19 = sanitizedUrl.path;
33056
+ sanitizedUrl = path20.length >= MIN_NATIVE_SCAN_LENGTH ? safeDecodeURINativeScan(path20, this.useSemicolonDelimiter) : safeDecodeURICharScan(path20, this.useSemicolonDelimiter, 1);
33057
+ path20 = sanitizedUrl.path;
33058
33058
  querystring2 = sanitizedUrl.querystring;
33059
33059
  shouldDecodeParam = sanitizedUrl.shouldDecodeParam;
33060
33060
  } catch (error51) {
33061
- return this._onBadUrl(path19);
33061
+ return this._onBadUrl(path20);
33062
33062
  }
33063
33063
  if (this.ignoreTrailingSlash) {
33064
- path19 = trimLastSlash(path19);
33064
+ path20 = trimLastSlash(path20);
33065
33065
  }
33066
- const originPath = path19;
33066
+ const originPath = path20;
33067
33067
  if (this.caseSensitive === false) {
33068
- path19 = path19.toLowerCase();
33068
+ path20 = path20.toLowerCase();
33069
33069
  }
33070
33070
  const maxParamLength = this.maxParamLength;
33071
33071
  let pathIndex = currentNode.prefix.length;
33072
33072
  const params = [];
33073
- const pathLen = path19.length;
33073
+ const pathLen = path20.length;
33074
33074
  const brothersNodesStack = [];
33075
33075
  let maxParamLengthExceeded = false;
33076
33076
  while (true) {
@@ -33085,7 +33085,7 @@ var require_find_my_way = __commonJS({
33085
33085
  };
33086
33086
  }
33087
33087
  }
33088
- let node = currentNode.getNextNode(path19, pathIndex, brothersNodesStack, params.length);
33088
+ let node = currentNode.getNextNode(path20, pathIndex, brothersNodesStack, params.length);
33089
33089
  if (node === null) {
33090
33090
  if (brothersNodesStack.length === 0) {
33091
33091
  if (maxParamLengthExceeded && this.onMaxParamLength) {
@@ -33186,8 +33186,8 @@ var require_find_my_way = __commonJS({
33186
33186
  Router.prototype._rebuild = function(routes) {
33187
33187
  this.reset();
33188
33188
  for (const route of routes) {
33189
- const { method, path: path19, opts, handler, store } = route;
33190
- this._on(method, path19, opts, handler, store);
33189
+ const { method, path: path20, opts, handler, store } = route;
33190
+ this._on(method, path20, opts, handler, store);
33191
33191
  }
33192
33192
  };
33193
33193
  Router.prototype._defaultRoute = function(req, res, ctx) {
@@ -33198,24 +33198,24 @@ var require_find_my_way = __commonJS({
33198
33198
  res.end();
33199
33199
  }
33200
33200
  };
33201
- Router.prototype._onBadUrl = function(path19) {
33201
+ Router.prototype._onBadUrl = function(path20) {
33202
33202
  if (this.onBadUrl === null) {
33203
33203
  return null;
33204
33204
  }
33205
33205
  const onBadUrl = this.onBadUrl;
33206
33206
  return {
33207
- handler: (req, res, ctx) => onBadUrl(path19, req, res),
33207
+ handler: (req, res, ctx) => onBadUrl(path20, req, res),
33208
33208
  params: {},
33209
33209
  store: null
33210
33210
  };
33211
33211
  };
33212
- Router.prototype._onMaxParamLength = function(path19) {
33212
+ Router.prototype._onMaxParamLength = function(path20) {
33213
33213
  if (this.onMaxParamLength === null) {
33214
33214
  return null;
33215
33215
  }
33216
33216
  const onMaxParamLength = this.onMaxParamLength;
33217
33217
  return {
33218
- handler: (req, res, ctx) => onMaxParamLength(path19, req, res),
33218
+ handler: (req, res, ctx) => onMaxParamLength(path20, req, res),
33219
33219
  params: {},
33220
33220
  store: null
33221
33221
  };
@@ -33247,12 +33247,12 @@ var require_find_my_way = __commonJS({
33247
33247
  if (!httpMethods.hasOwnProperty(i)) continue;
33248
33248
  const m = httpMethods[i];
33249
33249
  const methodName = m.toLowerCase();
33250
- Router.prototype[methodName] = function(path19, handler, store) {
33251
- return this.on(m, path19, handler, store);
33250
+ Router.prototype[methodName] = function(path20, handler, store) {
33251
+ return this.on(m, path20, handler, store);
33252
33252
  };
33253
33253
  }
33254
- Router.prototype.all = function(path19, handler, store) {
33255
- this.on(httpMethods, path19, handler, store);
33254
+ Router.prototype.all = function(path20, handler, store) {
33255
+ this.on(httpMethods, path20, handler, store);
33256
33256
  };
33257
33257
  Router.sanitizeUrlPath = function sanitizeUrlPath(url2, useSemicolonDelimiter) {
33258
33258
  const decoded = safeDecodeURI(url2, useSemicolonDelimiter);
@@ -33267,14 +33267,14 @@ var require_find_my_way = __commonJS({
33267
33267
  function escapeRegExp(string4) {
33268
33268
  return string4.replace(ESCAPE_REGEXP, "\\$&");
33269
33269
  }
33270
- function removeDuplicateSlashes(path19) {
33271
- return path19.indexOf("//") !== -1 ? path19.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path19;
33270
+ function removeDuplicateSlashes(path20) {
33271
+ return path20.indexOf("//") !== -1 ? path20.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path20;
33272
33272
  }
33273
- function trimLastSlash(path19) {
33274
- if (path19.length > 1 && path19.charCodeAt(path19.length - 1) === 47) {
33275
- return path19.slice(0, -1);
33273
+ function trimLastSlash(path20) {
33274
+ if (path20.length > 1 && path20.charCodeAt(path20.length - 1) === 47) {
33275
+ return path20.slice(0, -1);
33276
33276
  }
33277
- return path19;
33277
+ return path20;
33278
33278
  }
33279
33279
  function trimRegExpStartAndEnd(regexString) {
33280
33280
  if (regexString.charCodeAt(1) === 94) {
@@ -33285,22 +33285,22 @@ var require_find_my_way = __commonJS({
33285
33285
  }
33286
33286
  return regexString;
33287
33287
  }
33288
- function getClosingParenthensePosition(path19, idx) {
33288
+ function getClosingParenthensePosition(path20, idx) {
33289
33289
  let parentheses = 1;
33290
- while (idx < path19.length) {
33290
+ while (idx < path20.length) {
33291
33291
  idx++;
33292
- if (path19.charCodeAt(idx) === 92) {
33292
+ if (path20.charCodeAt(idx) === 92) {
33293
33293
  idx++;
33294
33294
  continue;
33295
33295
  }
33296
- if (path19.charCodeAt(idx) === 41) {
33296
+ if (path20.charCodeAt(idx) === 41) {
33297
33297
  parentheses--;
33298
- } else if (path19.charCodeAt(idx) === 40) {
33298
+ } else if (path20.charCodeAt(idx) === 40) {
33299
33299
  parentheses++;
33300
33300
  }
33301
33301
  if (!parentheses) return idx;
33302
33302
  }
33303
- throw new TypeError('Invalid regexp expression in "' + path19 + '"');
33303
+ throw new TypeError('Invalid regexp expression in "' + path20 + '"');
33304
33304
  }
33305
33305
  function defaultBuildPrettyMeta(route) {
33306
33306
  if (!route) return {};
@@ -33533,12 +33533,12 @@ var require_route = __commonJS({
33533
33533
  function route({ options: options2, isFastify }) {
33534
33534
  throwIfAlreadyStarted("Cannot add route!");
33535
33535
  const opts = { ...options2 };
33536
- const path19 = opts.url || opts.path || "";
33536
+ const path20 = opts.url || opts.path || "";
33537
33537
  if (!opts.handler) {
33538
- throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method, path19);
33538
+ throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method, path20);
33539
33539
  }
33540
33540
  if (opts.errorHandler !== void 0 && typeof opts.errorHandler !== "function") {
33541
- throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method, path19);
33541
+ throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method, path20);
33542
33542
  }
33543
33543
  validateBodyLimitOption(opts.bodyLimit);
33544
33544
  validateHandlerTimeoutOption(opts.handlerTimeout);
@@ -33548,22 +33548,22 @@ var require_route = __commonJS({
33548
33548
  if (Array.isArray(opts.method)) {
33549
33549
  for (let i = 0; i < opts.method.length; ++i) {
33550
33550
  opts.method[i] = normalizeAndValidateMethod.call(this, opts.method[i]);
33551
- validateSchemaBodyOption.call(this, opts.method[i], path19, opts.schema);
33551
+ validateSchemaBodyOption.call(this, opts.method[i], path20, opts.schema);
33552
33552
  isGetRoute = opts.method.includes("GET");
33553
33553
  isHeadRoute = opts.method.includes("HEAD");
33554
33554
  }
33555
33555
  } else {
33556
33556
  opts.method = normalizeAndValidateMethod.call(this, opts.method);
33557
- validateSchemaBodyOption.call(this, opts.method, path19, opts.schema);
33557
+ validateSchemaBodyOption.call(this, opts.method, path20, opts.schema);
33558
33558
  isGetRoute = opts.method === "GET";
33559
33559
  isHeadRoute = opts.method === "HEAD";
33560
33560
  }
33561
33561
  const headOpts = shouldExposeHead && isGetRoute ? { ...options2 } : null;
33562
33562
  const prefix = this[kRoutePrefix];
33563
- if (path19 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
33563
+ if (path20 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
33564
33564
  switch (opts.prefixTrailingSlash) {
33565
33565
  case "slash":
33566
- addNewRoute.call(this, { path: path19, isFastify });
33566
+ addNewRoute.call(this, { path: path20, isFastify });
33567
33567
  break;
33568
33568
  case "no-slash":
33569
33569
  addNewRoute.call(this, { path: "", isFastify });
@@ -33572,20 +33572,20 @@ var require_route = __commonJS({
33572
33572
  default:
33573
33573
  addNewRoute.call(this, { path: "", isFastify });
33574
33574
  if (ignoreTrailingSlash !== true && (ignoreDuplicateSlashes !== true || !prefix.endsWith("/"))) {
33575
- addNewRoute.call(this, { path: path19, prefixing: true, isFastify });
33575
+ addNewRoute.call(this, { path: path20, prefixing: true, isFastify });
33576
33576
  }
33577
33577
  }
33578
- } else if (path19[0] === "/" && prefix.endsWith("/")) {
33579
- addNewRoute.call(this, { path: path19.slice(1), isFastify });
33578
+ } else if (path20[0] === "/" && prefix.endsWith("/")) {
33579
+ addNewRoute.call(this, { path: path20.slice(1), isFastify });
33580
33580
  } else {
33581
- addNewRoute.call(this, { path: path19, isFastify });
33581
+ addNewRoute.call(this, { path: path20, isFastify });
33582
33582
  }
33583
33583
  return this;
33584
- function addNewRoute({ path: path20, prefixing = false, isFastify: isFastify2 = false }) {
33585
- const url2 = prefix + path20;
33584
+ function addNewRoute({ path: path21, prefixing = false, isFastify: isFastify2 = false }) {
33585
+ const url2 = prefix + path21;
33586
33586
  opts.url = url2;
33587
33587
  opts.path = url2;
33588
- opts.routePath = path20;
33588
+ opts.routePath = path21;
33589
33589
  opts.prefix = prefix;
33590
33590
  opts.logLevel = opts.logLevel || this[kLogLevel];
33591
33591
  validateLogLevelOption(opts.logLevel, opts.method, opts.url, logger);
@@ -33717,7 +33717,7 @@ var require_route = __commonJS({
33717
33717
  });
33718
33718
  if (shouldExposeHead && isGetRoute && !isHeadRoute && !hasHEADHandler) {
33719
33719
  const onSendHandlers = parseHeadOnSendHandlers(headOpts.onSend);
33720
- prepareRoute.call(this, { method: "HEAD", url: path20, options: { ...headOpts, onSend: onSendHandlers }, isFastify: true });
33720
+ prepareRoute.call(this, { method: "HEAD", url: path21, options: { ...headOpts, onSend: onSendHandlers }, isFastify: true });
33721
33721
  }
33722
33722
  }
33723
33723
  }
@@ -33841,9 +33841,9 @@ var require_route = __commonJS({
33841
33841
  }
33842
33842
  return method;
33843
33843
  }
33844
- function validateSchemaBodyOption(method, path19, schema) {
33844
+ function validateSchemaBodyOption(method, path20, schema) {
33845
33845
  if (this[kSupportedHTTPMethods].bodyless.has(method) && schema?.body) {
33846
- throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method, path19);
33846
+ throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method, path20);
33847
33847
  }
33848
33848
  }
33849
33849
  function validateBodyLimitOption(bodyLimit) {
@@ -33858,11 +33858,11 @@ var require_route = __commonJS({
33858
33858
  throw new FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT(handlerTimeout);
33859
33859
  }
33860
33860
  }
33861
- function validateLogLevelOption(logLevel, method, path19, logger) {
33861
+ function validateLogLevelOption(logLevel, method, path20, logger) {
33862
33862
  if (logLevel == null || logLevel === "") return;
33863
33863
  if (logger?.levels?.values == null) return;
33864
33864
  if (typeof logLevel !== "string" || logger.levels.values[logLevel] === void 0) {
33865
- throw new FST_ERR_ROUTE_LOG_LEVEL_INVALID(method, path19, logLevel);
33865
+ throw new FST_ERR_ROUTE_LOG_LEVEL_INVALID(method, path20, logLevel);
33866
33866
  }
33867
33867
  }
33868
33868
  function runPreParsing(err, request, reply) {
@@ -33951,7 +33951,7 @@ var require_four_oh_four = __commonJS({
33951
33951
  });
33952
33952
  }
33953
33953
  function createRouteEventHandler() {
33954
- return function onRouteEvent(path19, req, res) {
33954
+ return function onRouteEvent(path20, req, res) {
33955
33955
  const fourOhFourContext = this[kFourOhFourLevelInstance][kFourOhFourContext];
33956
33956
  const id = getGenReqId(fourOhFourContext.server, req);
33957
33957
  const childLogger = createChildLogger(fourOhFourContext, logger, req, id);
@@ -36622,19 +36622,19 @@ var require_fastify = __commonJS({
36622
36622
  }
36623
36623
  fourOhFour.router.lookup(req, res);
36624
36624
  }
36625
- function onBadUrl(path19, req, res) {
36625
+ function onBadUrl(path20, req, res) {
36626
36626
  if (options.frameworkErrors) {
36627
36627
  const id = getGenReqId(routeEventContext.server, req);
36628
36628
  const childLogger = createChildLogger(routeEventContext, options.logger, req, id);
36629
36629
  const request = new Request(id, null, req, null, childLogger, routeEventContext);
36630
36630
  const reply = new Reply(res, request, childLogger);
36631
36631
  routeEventContext.server[kLogController].incomingRequest(request, reply);
36632
- return options.frameworkErrors(new FST_ERR_BAD_URL(path19), request, reply);
36632
+ return options.frameworkErrors(new FST_ERR_BAD_URL(path20), request, reply);
36633
36633
  }
36634
36634
  const body = JSON.stringify({
36635
36635
  error: "Bad Request",
36636
36636
  code: "FST_ERR_BAD_URL",
36637
- message: `'${path19}' is not a valid url component`,
36637
+ message: `'${path20}' is not a valid url component`,
36638
36638
  statusCode: 400
36639
36639
  });
36640
36640
  res.writeHead(400, {
@@ -36643,19 +36643,19 @@ var require_fastify = __commonJS({
36643
36643
  });
36644
36644
  res.end(body);
36645
36645
  }
36646
- function onMaxParamLength(path19, req, res) {
36646
+ function onMaxParamLength(path20, req, res) {
36647
36647
  if (options.frameworkErrors) {
36648
36648
  const id = getGenReqId(routeEventContext.server, req);
36649
36649
  const childLogger = createChildLogger(routeEventContext, options.logger, req, id);
36650
36650
  const request = new Request(id, null, req, null, childLogger, routeEventContext);
36651
36651
  const reply = new Reply(res, request, childLogger);
36652
36652
  routeEventContext.server[kLogController].incomingRequest(request, reply);
36653
- return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path19), request, reply);
36653
+ return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path20), request, reply);
36654
36654
  }
36655
36655
  const body = JSON.stringify({
36656
36656
  error: "Bad Request",
36657
36657
  code: "FST_ERR_MAX_PARAM_LENGTH",
36658
- message: `'${path19}' is exceeding the max param length`,
36658
+ message: `'${path20}' is exceeding the max param length`,
36659
36659
  statusCode: 414
36660
36660
  });
36661
36661
  res.writeHead(414, {
@@ -41001,13 +41001,13 @@ var require_websocket_server = __commonJS({
41001
41001
  // src/server.ts
41002
41002
  var import_fastify = __toESM(require_fastify(), 1);
41003
41003
  var import_cors = __toESM(require_cors(), 1);
41004
- import path18 from "node:path";
41004
+ import path19 from "node:path";
41005
41005
 
41006
41006
  // src/db/index.ts
41007
41007
  import Database from "better-sqlite3";
41008
41008
  var db;
41009
- function initDb(path19 = "data.db") {
41010
- db = new Database(path19);
41009
+ function initDb(path20 = "data.db") {
41010
+ db = new Database(path20);
41011
41011
  db.pragma("journal_mode = WAL");
41012
41012
  db.pragma("foreign_keys = ON");
41013
41013
  createTables(db);
@@ -43460,9 +43460,9 @@ async function browseFolder(input, opts = {}) {
43460
43460
  const atHome = dir === nodePath.resolve(home);
43461
43461
  const folders = await Promise.all(
43462
43462
  names.slice(0, limit).map(async (name) => {
43463
- const path19 = nodePath.join(dir, name);
43463
+ const path20 = nodePath.join(dir, name);
43464
43464
  const skipProbe = atHome && HOME_STANDARD_FOLDERS.has(name) || dir === "/Volumes";
43465
- return { name, path: path19, git: !skipProbe && await exists(nodePath.join(path19, ".git")) };
43465
+ return { name, path: path20, git: !skipProbe && await exists(nodePath.join(path20, ".git")) };
43466
43466
  })
43467
43467
  );
43468
43468
  const parent = nodePath.dirname(dir);
@@ -43500,11 +43500,11 @@ async function registerWorkspaceRoutes(fastify) {
43500
43500
  }
43501
43501
  }
43502
43502
  }, async (request, reply) => {
43503
- const { path: path19, label = null } = request.body || {};
43504
- if (!path19 || !path19.trim()) {
43503
+ const { path: path20, label = null } = request.body || {};
43504
+ if (!path20 || !path20.trim()) {
43505
43505
  return reply.code(400).send({ error: "Path is required" });
43506
43506
  }
43507
- const resolved = await resolveWorkspacePath(path19);
43507
+ const resolved = await resolveWorkspacePath(path20);
43508
43508
  if ("error" in resolved) {
43509
43509
  return reply.code(400).send({ error: resolved.error });
43510
43510
  }
@@ -43546,8 +43546,8 @@ async function registerWorkspaceRoutes(fastify) {
43546
43546
  "-e",
43547
43547
  'POSIX path of (choose folder with prompt "Select a workspace directory")'
43548
43548
  ]);
43549
- const path19 = stdout.trim().replace(/\/$/, "");
43550
- return { path: path19 };
43549
+ const path20 = stdout.trim().replace(/\/$/, "");
43550
+ return { path: path20 };
43551
43551
  } catch {
43552
43552
  return reply.code(204).send({ cancelled: true });
43553
43553
  }
@@ -43563,11 +43563,11 @@ async function registerWorkspaceRoutes(fastify) {
43563
43563
  }
43564
43564
  }
43565
43565
  }, async (request, reply) => {
43566
- const { path: path19 } = request.body || {};
43567
- if (!path19 || !path19.trim()) {
43566
+ const { path: path20 } = request.body || {};
43567
+ if (!path20 || !path20.trim()) {
43568
43568
  return reply.code(400).send({ error: "Path is required" });
43569
43569
  }
43570
- const trimmedPath = path19.trim();
43570
+ const trimmedPath = path20.trim();
43571
43571
  const db2 = getDb();
43572
43572
  const existing = db2.prepare("SELECT * FROM workspaces WHERE path = ?").get(trimmedPath);
43573
43573
  if (existing) {
@@ -44301,17 +44301,17 @@ async function registerPerfLogRoutes(fastify) {
44301
44301
  if (entries.length === 0) {
44302
44302
  return reply.send({ written: 0 });
44303
44303
  }
44304
- const path19 = perfLogPath();
44304
+ const path20 = perfLogPath();
44305
44305
  try {
44306
- mkdirSync2(dirname(path19), { recursive: true });
44306
+ mkdirSync2(dirname(path20), { recursive: true });
44307
44307
  try {
44308
- if (statSync(path19).size > MAX_BYTES) {
44309
- renameSync(path19, `${path19}.1`);
44308
+ if (statSync(path20).size > MAX_BYTES) {
44309
+ renameSync(path20, `${path20}.1`);
44310
44310
  }
44311
44311
  } catch {
44312
44312
  }
44313
44313
  const lines = entries.map((e) => `${new Date(e.t).toISOString()} [${oneLine(e.cat)}] ${oneLine(e.msg)}`).join("\n");
44314
- appendFileSync(path19, `${lines}
44314
+ appendFileSync(path20, `${lines}
44315
44315
  `, "utf-8");
44316
44316
  return reply.send({ written: entries.length });
44317
44317
  } catch (err) {
@@ -102830,10 +102830,10 @@ function mergeDefs(...defs) {
102830
102830
  function cloneDef(schema) {
102831
102831
  return mergeDefs(schema._zod.def);
102832
102832
  }
102833
- function getElementAtPath(obj2, path19) {
102834
- if (!path19)
102833
+ function getElementAtPath(obj2, path20) {
102834
+ if (!path20)
102835
102835
  return obj2;
102836
- return path19.reduce((acc, key) => acc?.[key], obj2);
102836
+ return path20.reduce((acc, key) => acc?.[key], obj2);
102837
102837
  }
102838
102838
  function promiseAllObject(promisesObj) {
102839
102839
  const keys = Object.keys(promisesObj);
@@ -103242,11 +103242,11 @@ function explicitlyAborted(x, startIndex = 0) {
103242
103242
  }
103243
103243
  return false;
103244
103244
  }
103245
- function prefixIssues(path19, issues) {
103245
+ function prefixIssues(path20, issues) {
103246
103246
  return issues.map((iss) => {
103247
103247
  var _a3;
103248
103248
  (_a3 = iss).path ?? (_a3.path = []);
103249
- iss.path.unshift(path19);
103249
+ iss.path.unshift(path20);
103250
103250
  return iss;
103251
103251
  });
103252
103252
  }
@@ -103393,16 +103393,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
103393
103393
  }
103394
103394
  function formatError(error51, mapper = (issue2) => issue2.message) {
103395
103395
  const fieldErrors = { _errors: [] };
103396
- const processError = (error52, path19 = []) => {
103396
+ const processError = (error52, path20 = []) => {
103397
103397
  for (const issue2 of error52.issues) {
103398
103398
  if (issue2.code === "invalid_union" && issue2.errors.length) {
103399
- issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
103399
+ issue2.errors.map((issues) => processError({ issues }, [...path20, ...issue2.path]));
103400
103400
  } else if (issue2.code === "invalid_key") {
103401
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
103401
+ processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
103402
103402
  } else if (issue2.code === "invalid_element") {
103403
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
103403
+ processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
103404
103404
  } else {
103405
- const fullpath = [...path19, ...issue2.path];
103405
+ const fullpath = [...path20, ...issue2.path];
103406
103406
  if (fullpath.length === 0) {
103407
103407
  fieldErrors._errors.push(mapper(issue2));
103408
103408
  } else {
@@ -103429,17 +103429,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
103429
103429
  }
103430
103430
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
103431
103431
  const result = { errors: [] };
103432
- const processError = (error52, path19 = []) => {
103432
+ const processError = (error52, path20 = []) => {
103433
103433
  var _a3, _b;
103434
103434
  for (const issue2 of error52.issues) {
103435
103435
  if (issue2.code === "invalid_union" && issue2.errors.length) {
103436
- issue2.errors.map((issues) => processError({ issues }, [...path19, ...issue2.path]));
103436
+ issue2.errors.map((issues) => processError({ issues }, [...path20, ...issue2.path]));
103437
103437
  } else if (issue2.code === "invalid_key") {
103438
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
103438
+ processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
103439
103439
  } else if (issue2.code === "invalid_element") {
103440
- processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
103440
+ processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
103441
103441
  } else {
103442
- const fullpath = [...path19, ...issue2.path];
103442
+ const fullpath = [...path20, ...issue2.path];
103443
103443
  if (fullpath.length === 0) {
103444
103444
  result.errors.push(mapper(issue2));
103445
103445
  continue;
@@ -103471,8 +103471,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
103471
103471
  }
103472
103472
  function toDotPath(_path) {
103473
103473
  const segs = [];
103474
- const path19 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
103475
- for (const seg of path19) {
103474
+ const path20 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
103475
+ for (const seg of path20) {
103476
103476
  if (typeof seg === "number")
103477
103477
  segs.push(`[${seg}]`);
103478
103478
  else if (typeof seg === "symbol")
@@ -116164,13 +116164,13 @@ function resolveRef(ref, ctx) {
116164
116164
  if (!ref.startsWith("#")) {
116165
116165
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
116166
116166
  }
116167
- const path19 = ref.slice(1).split("/").filter(Boolean);
116168
- if (path19.length === 0) {
116167
+ const path20 = ref.slice(1).split("/").filter(Boolean);
116168
+ if (path20.length === 0) {
116169
116169
  return ctx.rootSchema;
116170
116170
  }
116171
116171
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
116172
- if (path19[0] === defsKey) {
116173
- const key = path19[1];
116172
+ if (path20[0] === defsKey) {
116173
+ const key = path20[1];
116174
116174
  if (!key || !ctx.defs[key]) {
116175
116175
  throw new Error(`Reference not found: ${ref}`);
116176
116176
  }
@@ -116695,9 +116695,9 @@ function mapToolUse(block) {
116695
116695
  };
116696
116696
  }
116697
116697
  function deriveFileChangeData(input, toolName) {
116698
- const path19 = input.file_path ?? input.notebook_path ?? "";
116698
+ const path20 = input.file_path ?? input.notebook_path ?? "";
116699
116699
  const kind = toolName === "Write" ? "add" : "modify";
116700
- return { changes: [{ path: path19, kind }], status: "in_progress" };
116700
+ return { changes: [{ path: path20, kind }], status: "in_progress" };
116701
116701
  }
116702
116702
  function extractToolResultText(content) {
116703
116703
  if (!content) return "";
@@ -118984,6 +118984,159 @@ function mapTokenUsage(data) {
118984
118984
  };
118985
118985
  }
118986
118986
 
118987
+ // src/tabtape/browser-mcp.ts
118988
+ import { spawn as spawn6 } from "node:child_process";
118989
+ import fs11 from "node:fs";
118990
+ import os6 from "node:os";
118991
+ import path17 from "node:path";
118992
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
118993
+ var TABTAPE_MCP_NAME = "tabtape";
118994
+ var PLAYWRIGHT_MCP_NAME = "playwright";
118995
+ var PROBE_TIMEOUT_MS = 1500;
118996
+ var PROBE_RETRY_MS = 3e4;
118997
+ var PLAYWRIGHT_STARTUP_TIMEOUT_SEC = 120;
118998
+ var NONE = { tabtape: null, playwright: null };
118999
+ function disabled() {
119000
+ return process.env.REPOBURG_BROWSER_MCP === "0" || process.env.REPOBURG_TABTAPE === "0";
119001
+ }
119002
+ function tabtapeBaseUrl() {
119003
+ return (process.env.AGENT_PANE_TABTAPE_URL || `${sessionHostDaemonUrl()}/tabtape`).replace(/\/+$/, "");
119004
+ }
119005
+ function playwrightMcpScript(from = path17.dirname(fileURLToPath5(import.meta.url))) {
119006
+ if (scriptOverride !== void 0) return scriptOverride;
119007
+ let dir = from;
119008
+ for (let i = 0; i < 6; i++) {
119009
+ const script = path17.join(dir, "tabtape", "playwright", "mcp.mjs");
119010
+ if (fs11.existsSync(script) && fs11.existsSync(path17.join(dir, "tabtape", "extension", "dist", "manifest.json"))) {
119011
+ return script;
119012
+ }
119013
+ const parent = path17.dirname(dir);
119014
+ if (parent === dir) break;
119015
+ dir = parent;
119016
+ }
119017
+ return null;
119018
+ }
119019
+ var scriptOverride;
119020
+ var probe2 = null;
119021
+ function tabtapeReachable() {
119022
+ const now = Date.now();
119023
+ if (probe2 && (probe2.passed || now - probe2.at < PROBE_RETRY_MS)) return probe2.result;
119024
+ const result = fetch(`${tabtapeBaseUrl()}/api/health`, { signal: AbortSignal.timeout(PROBE_TIMEOUT_MS) }).then(async (res) => res.ok && (await res.json()).ok === true).catch(() => false);
119025
+ const entry = { at: now, passed: false, result };
119026
+ void result.then((ok) => {
119027
+ entry.passed = ok;
119028
+ });
119029
+ probe2 = entry;
119030
+ return result;
119031
+ }
119032
+ async function browserMcp(taken) {
119033
+ if (disabled()) return NONE;
119034
+ const wantTabtape = !taken.has(TABTAPE_MCP_NAME);
119035
+ const script = taken.has(PLAYWRIGHT_MCP_NAME) ? null : playwrightMcpScript();
119036
+ if (!wantTabtape && !script) return NONE;
119037
+ if (!await tabtapeReachable()) return NONE;
119038
+ return {
119039
+ tabtape: wantTabtape ? `${tabtapeBaseUrl()}/mcp` : null,
119040
+ // The pane's own node: the Mac app's runtime has none in PATH.
119041
+ playwright: script ? { command: process.execPath, args: [script, "--headless"] } : null
119042
+ };
119043
+ }
119044
+ function jsonServerNames(file2, pick2) {
119045
+ try {
119046
+ const json2 = JSON.parse(fs11.readFileSync(file2, "utf8"));
119047
+ const servers = pick2(json2);
119048
+ return servers && typeof servers === "object" ? Object.keys(servers) : [];
119049
+ } catch {
119050
+ return [];
119051
+ }
119052
+ }
119053
+ function claudeConfigFile() {
119054
+ if (process.env.AGENT_PANE_CLAUDE_CONFIG_FILE) return process.env.AGENT_PANE_CLAUDE_CONFIG_FILE;
119055
+ return path17.join(process.env.CLAUDE_CONFIG_DIR || os6.homedir(), ".claude.json");
119056
+ }
119057
+ function claudeUserMcpNames(cwd) {
119058
+ const file2 = claudeConfigFile();
119059
+ return /* @__PURE__ */ new Set([
119060
+ ...jsonServerNames(file2, (json2) => json2.mcpServers),
119061
+ ...jsonServerNames(file2, (json2) => json2.projects?.[cwd]?.mcpServers),
119062
+ ...jsonServerNames(path17.join(cwd, ".mcp.json"), (json2) => json2.mcpServers)
119063
+ ]);
119064
+ }
119065
+ async function claudeBrowserMcpServers(cwd) {
119066
+ const mcp = await browserMcp(claudeUserMcpNames(cwd));
119067
+ return {
119068
+ ...mcp.tabtape ? { [TABTAPE_MCP_NAME]: { type: "http", url: mcp.tabtape } } : {},
119069
+ ...mcp.playwright ? { [PLAYWRIGHT_MCP_NAME]: { type: "stdio", ...mcp.playwright } } : {}
119070
+ };
119071
+ }
119072
+ function tomlServerNames(file2) {
119073
+ let text2;
119074
+ try {
119075
+ text2 = fs11.readFileSync(file2, "utf8");
119076
+ } catch {
119077
+ return [];
119078
+ }
119079
+ const names = [];
119080
+ const re = /^\s*\[?\s*mcp_servers\.(?:"([^"]+)"|([A-Za-z0-9_-]+))\s*[\].]/gm;
119081
+ for (let m = re.exec(text2); m; m = re.exec(text2)) names.push(m[1] ?? m[2]);
119082
+ return names;
119083
+ }
119084
+ function codexUserMcpNames(cwd) {
119085
+ const home = process.env.CODEX_HOME || path17.join(os6.homedir(), ".codex");
119086
+ return /* @__PURE__ */ new Set([...tomlServerNames(path17.join(home, "config.toml")), ...tomlServerNames(path17.join(cwd, ".codex", "config.toml"))]);
119087
+ }
119088
+ var CODEX_BROWSER_CHECK_INSTRUCTIONS = `Browser checks: when you check a change end-to-end in a browser, use the playwright MCP tools (a Chromium with the tabtape recorder) and record the check. Call the tabtape tool get_record_link (name: what you check, url: the first page), open its start link with browser_navigate, do the check, then open its stop link: that page shows the replay link, which you give the user. When a check fails, look into the recording with the tabtape tools before guessing. If recording does not work (the start page says "Nothing happened", or tabtape cannot be reached), carry on with the check and tell the user the recording failed.`;
119089
+ async function codexBrowserMcp(cwd) {
119090
+ const mcp = await browserMcp(codexUserMcpNames(cwd));
119091
+ const args = [];
119092
+ const approve = (key) => ["-c", `${key}.default_tools_approval_mode="approve"`];
119093
+ if (mcp.tabtape) {
119094
+ const key = `mcp_servers.${TABTAPE_MCP_NAME}`;
119095
+ args.push("-c", `${key}.url=${JSON.stringify(mcp.tabtape)}`, ...approve(key));
119096
+ }
119097
+ if (mcp.playwright) {
119098
+ const key = `mcp_servers.${PLAYWRIGHT_MCP_NAME}`;
119099
+ args.push(
119100
+ "-c",
119101
+ `${key}.command=${JSON.stringify(mcp.playwright.command)}`,
119102
+ "-c",
119103
+ `${key}.args=${JSON.stringify(mcp.playwright.args)}`,
119104
+ "-c",
119105
+ `${key}.startup_timeout_sec=${PLAYWRIGHT_STARTUP_TIMEOUT_SEC}`,
119106
+ ...approve(key)
119107
+ );
119108
+ }
119109
+ return { args, instructions: mcp.tabtape ? CODEX_BROWSER_CHECK_INSTRUCTIONS : null };
119110
+ }
119111
+ var prepared = false;
119112
+ function chromiumDownloadCommand(execPath = process.execPath) {
119113
+ const bin = path17.dirname(execPath);
119114
+ const npx = path17.join(bin, process.platform === "win32" ? "npx.cmd" : "npx");
119115
+ if (!fs11.existsSync(npx)) return null;
119116
+ return {
119117
+ command: npx,
119118
+ args: ["-y", "@playwright/mcp@latest", "install-browser", "chromium"],
119119
+ env: { ...process.env, PATH: [bin, process.env.PATH].filter(Boolean).join(path17.delimiter) }
119120
+ };
119121
+ }
119122
+ function prepareBrowserMcp() {
119123
+ if (prepared || disabled()) return;
119124
+ prepared = true;
119125
+ if (!playwrightMcpScript()) return;
119126
+ const download = chromiumDownloadCommand();
119127
+ if (!download) return;
119128
+ try {
119129
+ const child = spawn6(download.command, download.args, { stdio: "ignore", env: download.env });
119130
+ child.on("error", (err) => console.warn("[browser-mcp] Chromium download failed to start:", err.message));
119131
+ child.on("exit", (code) => {
119132
+ if (code !== 0) console.warn(`[browser-mcp] Chromium download exited with ${code}`);
119133
+ });
119134
+ child.unref();
119135
+ } catch (err) {
119136
+ console.warn("[browser-mcp] Chromium download failed to start:", err.message);
119137
+ }
119138
+ }
119139
+
118987
119140
  // src/claude/cli-orphans.ts
118988
119141
  import { execFile as execFile4 } from "node:child_process";
118989
119142
  var TERM_GRACE_MS = 2e3;
@@ -119144,7 +119297,7 @@ function sandboxPolicy(config3) {
119144
119297
  function threadConfig(config3) {
119145
119298
  return config3?.webSearchMode ? { web_search: config3.webSearchMode } : void 0;
119146
119299
  }
119147
- function threadParams(session, cwd) {
119300
+ function threadParams(session, cwd, browserInstructions) {
119148
119301
  const config3 = parseRuntimeConfig(session);
119149
119302
  return {
119150
119303
  cwd,
@@ -119152,7 +119305,7 @@ function threadParams(session, cwd) {
119152
119305
  sandbox: sandboxType(config3),
119153
119306
  model: session.model ?? void 0,
119154
119307
  config: threadConfig(config3),
119155
- ...threadInstructionParams(cwd)
119308
+ ...threadInstructionParams(cwd, browserInstructions)
119156
119309
  };
119157
119310
  }
119158
119311
  function shouldSkipItem(type) {
@@ -119164,12 +119317,13 @@ function isEmptyReasoning(item) {
119164
119317
  const text2 = item.text ?? "";
119165
119318
  return summary.length === 0 && content.length === 0 && text2.length === 0;
119166
119319
  }
119167
- function appServerClientOptions(session, cwd) {
119168
- const launchArgs = codexMiniAppLaunchArgs(cwd, session.id);
119169
- return launchArgs ? { cwd, launchArgs } : { cwd, launchArgs: [] };
119320
+ function appServerClientOptions(session, cwd, extraArgs = []) {
119321
+ const launchArgs = codexMiniAppLaunchArgs(cwd, session.id) ?? [];
119322
+ return { cwd, launchArgs: [...launchArgs, ...extraArgs] };
119170
119323
  }
119171
- function threadInstructionParams(cwd) {
119172
- return isInAppFolder(cwd) ? { developerInstructions: appsConventions() } : {};
119324
+ function threadInstructionParams(cwd, browserInstructions = null) {
119325
+ const parts = [isInAppFolder(cwd) ? appsConventions() : null, browserInstructions].filter((p) => !!p);
119326
+ return parts.length > 0 ? { developerInstructions: parts.join("\n\n") } : {};
119173
119327
  }
119174
119328
  function autoApproveToolUserInput(client) {
119175
119329
  client.onRequest("item/tool/requestUserInput", async (params) => {
@@ -119237,7 +119391,8 @@ async function startThread(session) {
119237
119391
  if (adopted && !adopted.client.isClosed()) return adopted;
119238
119392
  }
119239
119393
  const cwd = session.cwd ?? process.cwd();
119240
- const options = appServerClientOptions(session, cwd);
119394
+ const browser = await codexBrowserMcp(cwd);
119395
+ const options = appServerClientOptions(session, cwd, browser.args);
119241
119396
  let entry = null;
119242
119397
  const host = hostFor(session.id, cwd, options, (pid) => {
119243
119398
  if (!entry) return;
@@ -119251,6 +119406,7 @@ async function startThread(session) {
119251
119406
  // A hosted app-server has no cli_processes row: its host supervises it.
119252
119407
  pid: host ? void 0 : client.pid,
119253
119408
  ...emptyThreadState(),
119409
+ browserInstructions: browser.instructions,
119254
119410
  turns: [],
119255
119411
  ended: /* @__PURE__ */ new Map(),
119256
119412
  resumedTurnIds: null,
@@ -119264,7 +119420,7 @@ async function startThread(session) {
119264
119420
  try {
119265
119421
  await client.initialize();
119266
119422
  autoApproveToolUserInput(client);
119267
- const base = threadParams(session, cwd);
119423
+ const base = threadParams(session, cwd, entry.browserInstructions);
119268
119424
  entry.webSearch = base.config?.web_search;
119269
119425
  if (session.external_thread_id) {
119270
119426
  entry.threadId = session.external_thread_id;
@@ -119767,7 +119923,7 @@ function sideThreadFor(entry, session, discussionThreadId) {
119767
119923
  async function loadSideThread(entry, session, discussionThreadId) {
119768
119924
  const db2 = getDb();
119769
119925
  const row = db2.prepare("SELECT external_thread_id FROM discussion_threads WHERE id = ?").get(discussionThreadId);
119770
- const base = threadParams(session, session.cwd ?? process.cwd());
119926
+ const base = threadParams(session, session.cwd ?? process.cwd(), entry.browserInstructions);
119771
119927
  let codexThreadId;
119772
119928
  if (row?.external_thread_id) {
119773
119929
  entry.codexThreads.add(row.external_thread_id);
@@ -120535,6 +120691,7 @@ function adoptedEntry(db2, session, threadId, client, host) {
120535
120691
  codexThreads: /* @__PURE__ */ new Set([threadId, ...sideOf.values()]),
120536
120692
  contextTokens: new Map(fill === null ? [] : [[threadId, fill]]),
120537
120693
  webSearch: threadConfig(parseRuntimeConfig(session))?.web_search,
120694
+ browserInstructions: null,
120538
120695
  turns,
120539
120696
  ended,
120540
120697
  // A turn resumed on this app-server later continues with the continue
@@ -121017,7 +121174,7 @@ function classifyApiError({ error: error51, status, text: text2, limitRejected }
121017
121174
  }
121018
121175
 
121019
121176
  // src/claude/claude-host.ts
121020
- import { spawn as spawn6 } from "node:child_process";
121177
+ import { spawn as spawn7 } from "node:child_process";
121021
121178
  var REPLAY_DONE_SUBTYPE = "agentpane_replay_done";
121022
121179
  var REPLAY_MARKER2 = JSON.stringify({ type: "system", subtype: REPLAY_DONE_SUBTYPE });
121023
121180
  function isReplayMarker(message) {
@@ -121080,7 +121237,7 @@ function hostedSpawner(db2, binding, info) {
121080
121237
  } catch (err) {
121081
121238
  console.error(`[claude] no session host for ${info.entryKey} (${err.message}); running the CLI directly`);
121082
121239
  forgetHost(binding.id, binding.dir);
121083
- const child = spawn6(opts.command, opts.args, { cwd, env: opts.env, signal: opts.signal, stdio: ["pipe", "pipe", "ignore"] });
121240
+ const child = spawn7(opts.command, opts.args, { cwd, env: opts.env, signal: opts.signal, stdio: ["pipe", "pipe", "ignore"] });
121084
121241
  info.onDirect(child.pid);
121085
121242
  return child;
121086
121243
  }
@@ -121404,6 +121561,7 @@ async function ensureSessionStarted(session, mapKey, resumeSessionId, resume, ad
121404
121561
  const rescue = resume && resumeId ? resume : void 0;
121405
121562
  const env = spawnEnv(session.id, rescue);
121406
121563
  let cliPid = null;
121564
+ const browserMcpServers = adopt ? {} : await claudeBrowserMcpServers(cwd);
121407
121565
  let host = null;
121408
121566
  let spawner;
121409
121567
  if (adopt) {
@@ -121440,7 +121598,7 @@ async function ensureSessionStarted(session, mapKey, resumeSessionId, resume, ad
121440
121598
  // reaches the pane only this way, with its sender in `origin` (MUH-102).
121441
121599
  extraArgs: { "replay-user-messages": null },
121442
121600
  // Inline visuals: the model's show_widget calls render in the chat.
121443
- mcpServers: { [WIDGET_SERVER_NAME]: createWidgetMcpServer() },
121601
+ mcpServers: { ...browserMcpServers, [WIDGET_SERVER_NAME]: createWidgetMcpServer() },
121444
121602
  ...CLI_OVERRIDE,
121445
121603
  ...session.model_reasoning_effort ? { effort: session.model_reasoning_effort } : {},
121446
121604
  ...resumeId ? { resume: resumeId } : {},
@@ -122959,8 +123117,8 @@ var RepoburgHttpClient = class {
122959
123117
  this.baseUrl = baseUrl.replace(/\/+$/, "");
122960
123118
  }
122961
123119
  /** Perform a JSON request. Throws a concise error on non-OK/non-JSON responses. */
122962
- async request(method, path19, body) {
122963
- const response = await fetch(`${this.baseUrl}${path19}`, {
123120
+ async request(method, path20, body) {
123121
+ const response = await fetch(`${this.baseUrl}${path20}`, {
122964
123122
  method,
122965
123123
  headers: { "Content-Type": "application/json" },
122966
123124
  body: body === void 0 ? void 0 : JSON.stringify(body)
@@ -122969,17 +123127,17 @@ var RepoburgHttpClient = class {
122969
123127
  if (!response.ok) {
122970
123128
  if (isHtml(text2)) {
122971
123129
  throw new Error(
122972
- `${method} ${path19} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
123130
+ `${method} ${path20} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
122973
123131
  );
122974
123132
  }
122975
- throw new Error(`${method} ${path19} failed: ${response.status} ${text2}`);
123133
+ throw new Error(`${method} ${path20} failed: ${response.status} ${text2}`);
122976
123134
  }
122977
123135
  if (text2.length === 0) return void 0;
122978
123136
  try {
122979
123137
  return JSON.parse(text2);
122980
123138
  } catch {
122981
123139
  throw new Error(
122982
- `${method} ${path19} failed: non-JSON response from ${this.baseUrl} \u2014 the URL points to the wrong server`
123140
+ `${method} ${path20} failed: non-JSON response from ${this.baseUrl} \u2014 the URL points to the wrong server`
122983
123141
  );
122984
123142
  }
122985
123143
  }
@@ -123034,7 +123192,7 @@ var RepoburgHttpClient = class {
123034
123192
  };
123035
123193
 
123036
123194
  // src/repoburg/backend-resolver.ts
123037
- import path17 from "node:path";
123195
+ import path18 from "node:path";
123038
123196
  var HEALTH_POLL_INTERVAL_MS = 1e3;
123039
123197
  var HEALTH_TIMEOUT_MS = 3e4;
123040
123198
  function daemonBaseUrl() {
@@ -123089,7 +123247,7 @@ async function backendHealthy(baseUrl, expectedPath) {
123089
123247
  const health = await fetchJson(`${baseUrl}/health`, void 0, 2e3);
123090
123248
  if (health.status !== "ok") return false;
123091
123249
  if (expectedPath && health.projectPath) {
123092
- return path17.resolve(health.projectPath) === path17.resolve(expectedPath);
123250
+ return path18.resolve(health.projectPath) === path18.resolve(expectedPath);
123093
123251
  }
123094
123252
  return true;
123095
123253
  } catch {
@@ -123110,7 +123268,7 @@ function serviceBaseUrl(service) {
123110
123268
  return `http://localhost:${service.port}`;
123111
123269
  }
123112
123270
  function coveringService(services, absPath) {
123113
- return services.filter((s) => absPath === s.path || absPath.startsWith(s.path + path17.sep)).sort((a, b) => b.path.length - a.path.length)[0];
123271
+ return services.filter((s) => absPath === s.path || absPath.startsWith(s.path + path18.sep)).sort((a, b) => b.path.length - a.path.length)[0];
123114
123272
  }
123115
123273
  async function restartService(daemon, name) {
123116
123274
  try {
@@ -123146,7 +123304,7 @@ async function resolveBackendUrl(projectPath, opts = {}) {
123146
123304
  if (envUrl) {
123147
123305
  return { baseUrl: envUrl.replace(/\/+$/, ""), port: 0, name: "REPOBURG_BACKEND_URL" };
123148
123306
  }
123149
- const absPath = path17.resolve(projectPath);
123307
+ const absPath = path18.resolve(projectPath);
123150
123308
  const daemon = daemonBaseUrl();
123151
123309
  const cached3 = resolvedCache.get(absPath);
123152
123310
  if (cached3 && await backendHealthy(cached3.baseUrl, cached3.servesPath ?? absPath)) {
@@ -124827,7 +124985,7 @@ registerProvider("repoburg", repoburgProvider);
124827
124985
  async function createAgentPaneApp(dbPath, opts = {}) {
124828
124986
  const allowRequest = opts.allowRequest ?? isLocalRequest;
124829
124987
  initDb(dbPath);
124830
- setPaneDataDir(dbPath === ":memory:" ? null : path18.dirname(path18.resolve(dbPath)));
124988
+ setPaneDataDir(dbPath === ":memory:" ? null : path19.dirname(path19.resolve(dbPath)));
124831
124989
  const fastify = (0, import_fastify.default)({ logger: true, bodyLimit: 50 * 1024 * 1024 });
124832
124990
  fastify.addHook("onRequest", async (request, reply) => {
124833
124991
  if (!allowRequest(request.headers.origin, request.headers.host)) {
@@ -124879,6 +125037,7 @@ function startHostServices(opts = {}) {
124879
125037
  });
124880
125038
  setStartupGate(started);
124881
125039
  void getVscodeWebManager().reapOrphans();
125040
+ prepareBrowserMcp();
124882
125041
  return started;
124883
125042
  }
124884
125043
  async function shutdownHost() {