@kevisual/cli 0.1.2 → 0.1.3

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.
@@ -43,11 +43,11 @@ var __export = (target, all) => {
43
43
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
44
44
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
45
45
 
46
- // ../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
46
+ // ../node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.json
47
47
  var require_package = __commonJS((exports, module) => {
48
48
  module.exports = {
49
49
  name: "dotenv",
50
- version: "17.2.3",
50
+ version: "17.3.1",
51
51
  description: "Loads environment variables from .env file",
52
52
  main: "lib/main.js",
53
53
  types: "lib/main.d.ts",
@@ -109,7 +109,7 @@ var require_package = __commonJS((exports, module) => {
109
109
  };
110
110
  });
111
111
 
112
- // ../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
112
+ // ../node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.js
113
113
  var require_main = __commonJS((exports, module) => {
114
114
  var fs2 = __require("fs");
115
115
  var path = __require("path");
@@ -121,12 +121,9 @@ var require_main = __commonJS((exports, module) => {
121
121
  "\uD83D\uDD10 encrypt with Dotenvx: https://dotenvx.com",
122
122
  "\uD83D\uDD10 prevent committing .env to code: https://dotenvx.com/precommit",
123
123
  "\uD83D\uDD10 prevent building .env in docker: https://dotenvx.com/prebuild",
124
- "\uD83D\uDCE1 add observability to secrets: https://dotenvx.com/ops",
125
- "\uD83D\uDC65 sync secrets across teammates & machines: https://dotenvx.com/ops",
126
- "\uD83D\uDDC2backup and recover secrets: https://dotenvx.com/ops",
127
- "✅ audit secrets and track compliance: https://dotenvx.com/ops",
128
- "\uD83D\uDD04 add secrets lifecycle management: https://dotenvx.com/ops",
129
- "\uD83D\uDD11 add access controls to secrets: https://dotenvx.com/ops",
124
+ "\uD83E\uDD16 agentic secret storage: https://dotenvx.com/as2",
125
+ "⚡️ secrets for agents: https://dotenvx.com/as2",
126
+ "\uD83D\uDEE1auth for agents: https://vestauth.com",
130
127
  "\uD83D\uDEE0️ run anywhere with `dotenvx run -- yourcommand`",
131
128
  "⚙️ specify custom .env file path with { path: '/custom/path/.env' }",
132
129
  "⚙️ enable debug logging with { debug: true }",
@@ -11435,17 +11432,6 @@ var require_db = __commonJS((exports, module) => {
11435
11432
  };
11436
11433
  });
11437
11434
 
11438
- // ../node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js
11439
- var require_mime_db = __commonJS((exports, module) => {
11440
- /*!
11441
- * mime-db
11442
- * Copyright(c) 2014 Jonathan Ong
11443
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
11444
- * MIT Licensed
11445
- */
11446
- module.exports = require_db();
11447
- });
11448
-
11449
11435
  // ../node_modules/.pnpm/mime-types@3.0.2/node_modules/mime-types/mimeScore.js
11450
11436
  var require_mimeScore = __commonJS((exports, module) => {
11451
11437
  var FACET_SCORES = {
@@ -11490,7 +11476,7 @@ var require_mime_types = __commonJS((exports) => {
11490
11476
  * Copyright(c) 2015 Douglas Christopher Wilson
11491
11477
  * MIT Licensed
11492
11478
  */
11493
- var db = require_mime_db();
11479
+ var db = require_db();
11494
11480
  var extname = __require("path").extname;
11495
11481
  var mimeScore = require_mimeScore();
11496
11482
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
@@ -11900,7 +11886,7 @@ var require_send = __commonJS((exports, module) => {
11900
11886
  this._root = opts.root ? resolve(opts.root) : null;
11901
11887
  }
11902
11888
  util.inherits(SendStream, Stream);
11903
- SendStream.prototype.error = function error(status, err) {
11889
+ SendStream.prototype.error = function error2(status, err) {
11904
11890
  if (hasListeners(this, "error")) {
11905
11891
  return this.emit("error", createHttpError(status, err));
11906
11892
  }
@@ -12015,7 +12001,7 @@ var require_send = __commonJS((exports, module) => {
12015
12001
  res.setHeader("Location", loc);
12016
12002
  res.end(doc);
12017
12003
  };
12018
- SendStream.prototype.pipe = function pipe(res) {
12004
+ SendStream.prototype.pipe = function pipe2(res) {
12019
12005
  var root = this._root;
12020
12006
  this.res = res;
12021
12007
  var path5 = decode2(this.path);
@@ -12069,7 +12055,7 @@ var require_send = __commonJS((exports, module) => {
12069
12055
  this.sendFile(path5);
12070
12056
  return res;
12071
12057
  };
12072
- SendStream.prototype.send = function send(path5, stat) {
12058
+ SendStream.prototype.send = function send2(path5, stat) {
12073
12059
  var len = stat.size;
12074
12060
  var options = this.options;
12075
12061
  var opts = {};
@@ -12191,21 +12177,21 @@ var require_send = __commonJS((exports, module) => {
12191
12177
  }
12192
12178
  next();
12193
12179
  };
12194
- SendStream.prototype.stream = function stream(path5, options) {
12180
+ SendStream.prototype.stream = function stream2(path5, options) {
12195
12181
  var self2 = this;
12196
12182
  var res = this.res;
12197
- var stream2 = fs5.createReadStream(path5, options);
12198
- this.emit("stream", stream2);
12199
- stream2.pipe(res);
12183
+ var stream3 = fs5.createReadStream(path5, options);
12184
+ this.emit("stream", stream3);
12185
+ stream3.pipe(res);
12200
12186
  function cleanup() {
12201
- stream2.destroy();
12187
+ stream3.destroy();
12202
12188
  }
12203
12189
  onFinished(res, cleanup);
12204
- stream2.on("error", function onerror(err) {
12190
+ stream3.on("error", function onerror(err) {
12205
12191
  cleanup();
12206
12192
  self2.onStatError(err);
12207
12193
  });
12208
- stream2.on("end", function onend() {
12194
+ stream3.on("end", function onend() {
12209
12195
  self2.emit("end");
12210
12196
  });
12211
12197
  };
@@ -12214,9 +12200,9 @@ var require_send = __commonJS((exports, module) => {
12214
12200
  if (res.getHeader("Content-Type"))
12215
12201
  return;
12216
12202
  var ext = extname(path5);
12217
- var type = mime.contentType(ext) || "application/octet-stream";
12218
- debug("content-type %s", type);
12219
- res.setHeader("Content-Type", type);
12203
+ var type2 = mime.contentType(ext) || "application/octet-stream";
12204
+ debug("content-type %s", type2);
12205
+ res.setHeader("Content-Type", type2);
12220
12206
  };
12221
12207
  SendStream.prototype.setHeader = function setHeader(path5, stat) {
12222
12208
  var res = this.res;
@@ -12463,7 +12449,7 @@ var require_is_extglob = __commonJS((exports, module) => {
12463
12449
  * Copyright (c) 2014-2016, Jon Schlinkert.
12464
12450
  * Licensed under the MIT License.
12465
12451
  */
12466
- module.exports = function isExtglob(str) {
12452
+ module.exports = function isExtglob2(str) {
12467
12453
  if (typeof str !== "string" || str === "") {
12468
12454
  return false;
12469
12455
  }
@@ -12597,7 +12583,7 @@ var require_is_glob = __commonJS((exports, module) => {
12597
12583
  }
12598
12584
  return false;
12599
12585
  };
12600
- module.exports = function isGlob(str, options) {
12586
+ module.exports = function isGlob2(str, options) {
12601
12587
  if (typeof str !== "string" || str === "") {
12602
12588
  return false;
12603
12589
  }
@@ -12622,7 +12608,7 @@ var require_glob_parent = __commonJS((exports, module) => {
12622
12608
  var enclosure = /[\{\[].*[\}\]]$/;
12623
12609
  var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
12624
12610
  var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
12625
- module.exports = function globParent(str, opts) {
12611
+ module.exports = function globParent2(str, opts) {
12626
12612
  var options = Object.assign({ flipBackslashes: true }, opts);
12627
12613
  if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
12628
12614
  str = str.replace(backslash, slash);
@@ -17807,13 +17793,6 @@ var require_cli_width = __commonJS((exports, module) => {
17807
17793
  }
17808
17794
  });
17809
17795
 
17810
- // ../node_modules/.pnpm/emoji-regex@10.6.0/node_modules/emoji-regex/index.js
17811
- var require_emoji_regex = __commonJS((exports, module) => {
17812
- module.exports = () => {
17813
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
17814
- };
17815
- });
17816
-
17817
17796
  // ../node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
17818
17797
  var require_lib = __commonJS((exports, module) => {
17819
17798
  var Stream = __require("stream");
@@ -38888,7 +38867,7 @@ function requireStream() {
38888
38867
  if (!duplex.push(data))
38889
38868
  ws.pause();
38890
38869
  });
38891
- ws.once("error", function error(err) {
38870
+ ws.once("error", function error2(err) {
38892
38871
  if (duplex.destroyed)
38893
38872
  return;
38894
38873
  terminateOnDestroy = false;
@@ -38906,7 +38885,7 @@ function requireStream() {
38906
38885
  return;
38907
38886
  }
38908
38887
  let called = false;
38909
- ws.once("error", function error(err2) {
38888
+ ws.once("error", function error2(err2) {
38910
38889
  called = true;
38911
38890
  callback(err2);
38912
38891
  });
@@ -39915,12 +39894,12 @@ function requireDist() {
39915
39894
  const { encode: encode2 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
39916
39895
  const data = typeof path === "object" ? path : parse2(path, options);
39917
39896
  const fn = tokensToFunction(data.tokens, delimiter, encode2);
39918
- return function path(params = {}) {
39919
- const [path2, ...missing] = fn(params);
39897
+ return function path2(params = {}) {
39898
+ const [path3, ...missing] = fn(params);
39920
39899
  if (missing.length) {
39921
39900
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
39922
39901
  }
39923
- return path2;
39902
+ return path3;
39924
39903
  };
39925
39904
  }
39926
39905
  function tokensToFunction(tokens, delimiter, encode2) {
@@ -39986,7 +39965,7 @@ function requireDist() {
39986
39965
  return decode2;
39987
39966
  return (value) => value.split(delimiter).map(decode2);
39988
39967
  });
39989
- return function match(input) {
39968
+ return function match2(input) {
39990
39969
  const m = regexp.exec(input);
39991
39970
  if (!m)
39992
39971
  return false;
@@ -40607,14 +40586,15 @@ var parseHomeArg = (homedir2) => {
40607
40586
  const isOpencode = checkUrl.some((item) => execPath.includes(item));
40608
40587
  let isServer = false;
40609
40588
  const checkArgs = process.argv.slice(1);
40610
- const isArgsServer = checkArgs.some((item) => item === "server" || item.includes("asst-server") || item.includes("run-server.ts"));
40611
40589
  const isDev = checkArgs.some((item) => item.includes("run-server.ts"));
40590
+ const isPm2 = checkArgs.some((item) => item.includes("pm2"));
40591
+ const isArgsServer = checkArgs.some((item) => item === "server" || item.includes("asst-server") || item.includes("assistant-server") || item.includes("run-server.ts"));
40612
40592
  let isDaemon = false;
40613
- if (isArgsServer) {
40593
+ if (isArgsServer || isPm2) {
40614
40594
  if (checkArgs.includes("--daemon") || checkArgs.includes("-d")) {
40615
40595
  isDaemon = true;
40616
40596
  }
40617
- if (checkArgs.includes("-s") || checkArgs.includes("--start")) {
40597
+ if (checkArgs.includes("-s") || checkArgs.includes("--start") || isPm2) {
40618
40598
  isServer = true;
40619
40599
  }
40620
40600
  }
@@ -40634,7 +40614,7 @@ var getFileConfig = (filePath) => {
40634
40614
  return JSON.parse(fs2.readFileSync(filePath, "utf8"));
40635
40615
  };
40636
40616
 
40637
- // ../node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.2.3/node_modules/@kevisual/use-config/dist/app.js
40617
+ // ../node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.3.1/node_modules/@kevisual/use-config/dist/app.js
40638
40618
  import { createRequire as createRequire2 } from "node:module";
40639
40619
  import fs3 from "node:fs";
40640
40620
  import path2 from "node:path";
@@ -42936,7 +42916,7 @@ function requireIsExtglob() {
42936
42916
  if (hasRequiredIsExtglob)
42937
42917
  return isExtglob;
42938
42918
  hasRequiredIsExtglob = 1;
42939
- isExtglob = function isExtglob(str) {
42919
+ isExtglob = function isExtglob2(str) {
42940
42920
  if (typeof str !== "string" || str === "") {
42941
42921
  return false;
42942
42922
  }
@@ -43074,7 +43054,7 @@ function requireIsGlob() {
43074
43054
  }
43075
43055
  return false;
43076
43056
  };
43077
- isGlob = function isGlob(str, options) {
43057
+ isGlob = function isGlob2(str, options) {
43078
43058
  if (typeof str !== "string" || str === "") {
43079
43059
  return false;
43080
43060
  }
@@ -43103,7 +43083,7 @@ function requireGlobParent() {
43103
43083
  var enclosure = /[\{\[].*[\}\]]$/;
43104
43084
  var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
43105
43085
  var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
43106
- globParent = function globParent(str, opts) {
43086
+ globParent = function globParent2(str, opts) {
43107
43087
  var options = Object.assign({ flipBackslashes: true }, opts);
43108
43088
  if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
43109
43089
  str = str.replace(backslash, slash);
@@ -49680,6 +49660,14 @@ class RemoteApp {
49680
49660
  ws;
49681
49661
  remoteIsConnected;
49682
49662
  isError = false;
49663
+ autoReconnect;
49664
+ maxReconnectAttempts;
49665
+ reconnectDelay;
49666
+ maxReconnectDelay;
49667
+ enableBackoff;
49668
+ reconnectAttempts = 0;
49669
+ reconnectTimer = null;
49670
+ isManuallyClosed = false;
49683
49671
  constructor(opts) {
49684
49672
  this.mainApp = opts?.app;
49685
49673
  const token = opts.token;
@@ -49693,6 +49681,11 @@ class RemoteApp {
49693
49681
  _url2.searchParams.set("id", id2);
49694
49682
  this.url = _url2.toString();
49695
49683
  this.id = id2;
49684
+ this.autoReconnect = opts?.autoReconnect ?? true;
49685
+ this.maxReconnectAttempts = opts?.maxReconnectAttempts ?? Infinity;
49686
+ this.reconnectDelay = opts?.reconnectDelay ?? 1000;
49687
+ this.maxReconnectDelay = opts?.maxReconnectDelay ?? 30000;
49688
+ this.enableBackoff = opts?.enableBackoff ?? true;
49696
49689
  this.init();
49697
49690
  }
49698
49691
  async isConnect() {
@@ -49700,6 +49693,9 @@ class RemoteApp {
49700
49693
  if (this.isConnected) {
49701
49694
  return true;
49702
49695
  }
49696
+ if (this.reconnectTimer !== null) {
49697
+ console.log(`远程应用 ${this.id} 正在重连中...`);
49698
+ }
49703
49699
  return new Promise((resolve) => {
49704
49700
  const timeout = setTimeout(() => {
49705
49701
  resolve(false);
@@ -49716,6 +49712,9 @@ class RemoteApp {
49716
49712
  }
49717
49713
  getWsURL(url3) {
49718
49714
  const { protocol } = new URL(url3);
49715
+ if (protocol.startsWith("ws")) {
49716
+ return url3.toString();
49717
+ }
49719
49718
  const wsProtocol = protocol === "https:" ? "wss:" : "ws:";
49720
49719
  const wsURL = url3.toString().replace(protocol, wsProtocol);
49721
49720
  return wsURL;
@@ -49736,6 +49735,7 @@ class RemoteApp {
49736
49735
  ws.onopen = function() {
49737
49736
  that.isConnected = true;
49738
49737
  that.onOpen();
49738
+ console.log("[remote-app] WebSocket connection opened");
49739
49739
  };
49740
49740
  ws.onclose = function() {
49741
49741
  that.isConnected = false;
@@ -49750,12 +49750,71 @@ class RemoteApp {
49750
49750
  this.ws = ws;
49751
49751
  }
49752
49752
  onOpen() {
49753
+ this.isError = false;
49754
+ this.reconnectAttempts = 0;
49755
+ if (this.reconnectTimer) {
49756
+ clearTimeout(this.reconnectTimer);
49757
+ this.reconnectTimer = null;
49758
+ }
49753
49759
  this.emitter.emit("open", this.id);
49754
49760
  }
49755
49761
  onClose() {
49756
49762
  console.log("远程应用关闭:", this.id);
49757
- this.emitter.emit("close", this.id);
49758
49763
  this.isConnected = false;
49764
+ this.emitter.emit("close", this.id);
49765
+ if (this.autoReconnect && !this.isManuallyClosed) {
49766
+ this.scheduleReconnect();
49767
+ }
49768
+ }
49769
+ calculateReconnectDelay() {
49770
+ if (!this.enableBackoff) {
49771
+ return this.reconnectDelay;
49772
+ }
49773
+ const delay = this.reconnectDelay * Math.pow(2, this.reconnectAttempts);
49774
+ return Math.min(delay, this.maxReconnectDelay);
49775
+ }
49776
+ scheduleReconnect() {
49777
+ if (this.reconnectAttempts >= this.maxReconnectAttempts) {
49778
+ console.error(`远程应用 ${this.id} 已达到最大重连次数 ${this.maxReconnectAttempts},停止重连`);
49779
+ this.emitter.emit("maxReconnectAttemptsReached", this.id);
49780
+ return;
49781
+ }
49782
+ if (this.reconnectTimer) {
49783
+ clearTimeout(this.reconnectTimer);
49784
+ }
49785
+ const delay = this.calculateReconnectDelay();
49786
+ this.reconnectAttempts++;
49787
+ console.log(`远程应用 ${this.id} 将在 ${delay}ms 后尝试第 ${this.reconnectAttempts} 次重连`);
49788
+ this.reconnectTimer = setTimeout(() => {
49789
+ this.reconnectTimer = null;
49790
+ try {
49791
+ this.init();
49792
+ } catch (error3) {
49793
+ console.error(`远程应用 ${this.id} 重连失败:`, error3);
49794
+ this.emitter.emit("reconnectFailed", { id: this.id, attempt: this.reconnectAttempts, error: error3 });
49795
+ this.scheduleReconnect();
49796
+ }
49797
+ }, delay);
49798
+ }
49799
+ disconnect() {
49800
+ this.isManuallyClosed = true;
49801
+ this.autoReconnect = false;
49802
+ if (this.reconnectTimer) {
49803
+ clearTimeout(this.reconnectTimer);
49804
+ this.reconnectTimer = null;
49805
+ }
49806
+ if (this.ws) {
49807
+ this.ws.close();
49808
+ }
49809
+ }
49810
+ reconnect() {
49811
+ this.isManuallyClosed = false;
49812
+ this.reconnectAttempts = 0;
49813
+ if (this.reconnectTimer) {
49814
+ clearTimeout(this.reconnectTimer);
49815
+ this.reconnectTimer = null;
49816
+ }
49817
+ this.init();
49759
49818
  }
49760
49819
  onMessage(data) {
49761
49820
  this.emitter.emit("message", data);
@@ -49837,7 +49896,7 @@ var getEnvToken = () => {
49837
49896
  return envTokne;
49838
49897
  };
49839
49898
 
49840
- // ../node_modules/.pnpm/@kevisual+query@0.0.39/node_modules/@kevisual/query/dist/query-browser.js
49899
+ // ../node_modules/.pnpm/@kevisual+query@0.0.40/node_modules/@kevisual/query/dist/query-browser.js
49841
49900
  var isTextForContentType = (contentType) => {
49842
49901
  if (!contentType)
49843
49902
  return false;
@@ -49866,12 +49925,12 @@ var adapter = async (opts = {}, overloadOpts) => {
49866
49925
  url3 = new URL(opts.url);
49867
49926
  } else {
49868
49927
  origin = window?.location?.origin || "http://localhost:51515";
49869
- url3 = new URL(opts.url, origin);
49928
+ url3 = new URL(opts?.url || "", origin);
49870
49929
  }
49871
49930
  const isGet = method === "GET";
49872
49931
  const oldSearchParams = url3.searchParams;
49873
49932
  if (isGet) {
49874
- let searchParams = new URLSearchParams({ ...Object.fromEntries(oldSearchParams), ...opts.body });
49933
+ let searchParams = new URLSearchParams({ ...Object.fromEntries(oldSearchParams), ...opts?.params, ...opts?.body });
49875
49934
  url3.search = searchParams.toString();
49876
49935
  } else {
49877
49936
  const params = {
@@ -49896,11 +49955,13 @@ var adapter = async (opts = {}, overloadOpts) => {
49896
49955
  } else if (isPostFile) {
49897
49956
  body = opts.body;
49898
49957
  } else {
49899
- headers = {
49900
- "Content-Type": "application/json",
49901
- ...headers
49902
- };
49903
- body = JSON.stringify(opts.body);
49958
+ if (opts.body && typeof opts.body === "object" && !(opts.body instanceof FormData)) {
49959
+ headers = {
49960
+ "Content-Type": "application/json",
49961
+ ...headers
49962
+ };
49963
+ body = JSON.stringify(opts.body);
49964
+ }
49904
49965
  }
49905
49966
  return fetch(url3, {
49906
49967
  method: method.toUpperCase(),
@@ -49970,7 +50031,7 @@ class Query {
49970
50031
  "Content-Type": "application/json"
49971
50032
  };
49972
50033
  this.timeout = opts?.timeout || 60000 * 3;
49973
- if (opts.beforeRequest) {
50034
+ if (opts?.beforeRequest) {
49974
50035
  this.beforeRequest = opts.beforeRequest;
49975
50036
  } else {
49976
50037
  this.beforeRequest = async (opts2) => {
@@ -57085,7 +57146,7 @@ function filter(data, query) {
57085
57146
  return executor.execute(ast, data);
57086
57147
  }
57087
57148
 
57088
- // ../node_modules/.pnpm/@kevisual+api@0.0.44/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
57149
+ // ../node_modules/.pnpm/@kevisual+api@0.0.50_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
57089
57150
  var initApi = async (opts) => {
57090
57151
  const router = opts?.router;
57091
57152
  const item = opts?.item;
@@ -57113,6 +57174,7 @@ var initApi = async (opts) => {
57113
57174
  let metadata = r.metadata || {};
57114
57175
  metadata.viewItem = item;
57115
57176
  metadata.url = query.url;
57177
+ metadata.source = "query-proxy-api";
57116
57178
  router.route({
57117
57179
  path: r.path,
57118
57180
  key: r.key || "",
@@ -71027,7 +71089,6 @@ class AssistantApp extends Manager2 {
71027
71089
  config;
71028
71090
  pagesPath;
71029
71091
  remoteIsConnected = false;
71030
- attemptedConnectTimes = 0;
71031
71092
  remoteApp = null;
71032
71093
  remoteUrl = null;
71033
71094
  resolver;
@@ -71095,7 +71156,7 @@ class AssistantApp extends Manager2 {
71095
71156
  const enabled = opts?.enabled ?? share?.enabled ?? false;
71096
71157
  if (share && enabled !== false) {
71097
71158
  if (this.remoteApp) {
71098
- this.remoteApp.ws?.close();
71159
+ this.remoteApp.disconnect();
71099
71160
  this.remoteApp = null;
71100
71161
  this.remoteIsConnected = false;
71101
71162
  }
@@ -71107,31 +71168,31 @@ class AssistantApp extends Manager2 {
71107
71168
  url: url5.toString(),
71108
71169
  token,
71109
71170
  id: id2,
71110
- app: this.mainApp
71171
+ app: this.mainApp,
71172
+ autoReconnect: true,
71173
+ reconnectDelay: 5000,
71174
+ maxReconnectAttempts: Infinity,
71175
+ enableBackoff: true
71111
71176
  });
71112
- const isConnect = await remoteApp.isConnect();
71113
- if (isConnect) {
71114
- remoteApp.listenProxy();
71177
+ remoteApp.isConnect();
71178
+ this.remoteIsConnected = true;
71179
+ remoteApp.on("open", () => {
71115
71180
  this.remoteIsConnected = true;
71116
- remoteApp.emitter.removeAllListeners("close");
71117
- remoteApp.emitter.on("close", () => {
71118
- setTimeout(() => {
71119
- if (remoteApp.isError) {
71120
- console.error("远程应用发生错误,不重连");
71121
- } else {
71122
- this.reconnectRemoteApp();
71123
- }
71124
- }, 5 * 1000);
71125
- });
71126
- logger.debug("链接到了远程应用服务器");
71127
71181
  const appId = id2;
71128
71182
  const username = config4?.auth.username || "unknown";
71129
71183
  const url6 = new URL(`/${username}/v1/${appId}`, config4?.registry || "https://kevisual.cn/");
71130
71184
  this.remoteUrl = url6.toString();
71131
- console.log("远程地址", this.remoteUrl);
71132
- } else {
71133
- console.log("Not connected to remote app server");
71134
- }
71185
+ logger.info("[remote-app] 远程地址", this.remoteUrl);
71186
+ logger.debug("链接到了远程应用服务器");
71187
+ remoteApp.listenProxy();
71188
+ });
71189
+ remoteApp.on("close", () => {
71190
+ this.remoteIsConnected = false;
71191
+ logger.info("[remote-app] 远程连接已关闭,自动重连机制正在处理...");
71192
+ });
71193
+ remoteApp.on("maxReconnectAttemptsReached", () => {
71194
+ logger.error("远程应用重连达到最大次数,停止重连");
71195
+ });
71135
71196
  this.remoteApp = remoteApp;
71136
71197
  } else {
71137
71198
  if (!token) {
@@ -71214,28 +71275,6 @@ class AssistantApp extends Manager2 {
71214
71275
  }
71215
71276
  }
71216
71277
  }
71217
- async reconnectRemoteApp() {
71218
- console.log("重新连接到远程应用服务器...", this.attemptedConnectTimes);
71219
- const remoteApp = this.remoteApp;
71220
- if (remoteApp) {
71221
- if (remoteApp.ws) {
71222
- remoteApp.ws.close();
71223
- }
71224
- remoteApp.init();
71225
- this.attemptedConnectTimes += 1;
71226
- const isConnect = await remoteApp.isConnect();
71227
- if (isConnect) {
71228
- remoteApp.listenProxy();
71229
- this.attemptedConnectTimes = 0;
71230
- console.log("重新连接到了远程应用服务器");
71231
- } else {
71232
- this.reconnectRemoteApp();
71233
- setTimeout(() => {
71234
- this.initRouterApp();
71235
- }, 30 * 1000 + this.attemptedConnectTimes * 10 * 1000);
71236
- }
71237
- }
71238
- }
71239
71278
  async initRoutes() {
71240
71279
  const routes = this.config.getConfig().routes || [];
71241
71280
  for (const route of routes) {
@@ -71250,7 +71289,7 @@ class AssistantApp extends Manager2 {
71250
71289
  }
71251
71290
  }
71252
71291
  }
71253
- // ../node_modules/.pnpm/@kevisual+query@0.0.39/node_modules/@kevisual/query/dist/query.js
71292
+ // ../node_modules/.pnpm/@kevisual+query@0.0.40/node_modules/@kevisual/query/dist/query.js
71254
71293
  var isTextForContentType2 = (contentType) => {
71255
71294
  if (!contentType)
71256
71295
  return false;
@@ -71279,12 +71318,12 @@ var adapter2 = async (opts = {}, overloadOpts) => {
71279
71318
  url5 = new URL(opts.url);
71280
71319
  } else {
71281
71320
  origin = window?.location?.origin || "http://localhost:51515";
71282
- url5 = new URL(opts.url, origin);
71321
+ url5 = new URL(opts?.url || "", origin);
71283
71322
  }
71284
71323
  const isGet = method === "GET";
71285
71324
  const oldSearchParams = url5.searchParams;
71286
71325
  if (isGet) {
71287
- let searchParams = new URLSearchParams({ ...Object.fromEntries(oldSearchParams), ...opts.body });
71326
+ let searchParams = new URLSearchParams({ ...Object.fromEntries(oldSearchParams), ...opts?.params, ...opts?.body });
71288
71327
  url5.search = searchParams.toString();
71289
71328
  } else {
71290
71329
  const params = {
@@ -71309,11 +71348,13 @@ var adapter2 = async (opts = {}, overloadOpts) => {
71309
71348
  } else if (isPostFile) {
71310
71349
  body = opts.body;
71311
71350
  } else {
71312
- headers = {
71313
- "Content-Type": "application/json",
71314
- ...headers
71315
- };
71316
- body = JSON.stringify(opts.body);
71351
+ if (opts.body && typeof opts.body === "object" && !(opts.body instanceof FormData)) {
71352
+ headers = {
71353
+ "Content-Type": "application/json",
71354
+ ...headers
71355
+ };
71356
+ body = JSON.stringify(opts.body);
71357
+ }
71317
71358
  }
71318
71359
  return fetch(url5, {
71319
71360
  method: method.toUpperCase(),
@@ -71383,7 +71424,7 @@ class Query2 {
71383
71424
  "Content-Type": "application/json"
71384
71425
  };
71385
71426
  this.timeout = opts?.timeout || 60000 * 3;
71386
- if (opts.beforeRequest) {
71427
+ if (opts?.beforeRequest) {
71387
71428
  this.beforeRequest = opts.beforeRequest;
71388
71429
  } else {
71389
71430
  this.beforeRequest = async (opts2) => {
@@ -72284,7 +72325,7 @@ var assistantQuery = useContextKey("assistantQuery", () => {
72284
72325
  return new AssistantQuery(assistantConfig2);
72285
72326
  });
72286
72327
  var runtime = useContextKey("runtime", () => {
72287
- console.log("Runtime detected:", manualParse.isDev);
72328
+ console.log("Runtime detected:", "isDev:", manualParse.isDev, "isServer:", manualParse.isServer);
72288
72329
  return {
72289
72330
  type: "client",
72290
72331
  isServer: manualParse.isServer
@@ -87071,10 +87112,10 @@ import os4 from "node:os";
87071
87112
  import path12 from "path";
87072
87113
  import fs14 from "fs";
87073
87114
 
87074
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/key.js
87115
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/key.js
87075
87116
  var isTabKey = (key) => key.name === "tab";
87076
87117
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
87077
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/errors.js
87118
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/errors.js
87078
87119
  class AbortPromptError extends Error {
87079
87120
  name = "AbortPromptError";
87080
87121
  message = "Prompt was aborted";
@@ -87100,10 +87141,10 @@ class HookError extends Error {
87100
87141
  class ValidationError extends Error {
87101
87142
  name = "ValidationError";
87102
87143
  }
87103
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/use-state.js
87144
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-state.js
87104
87145
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
87105
87146
 
87106
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
87147
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/hook-engine.js
87107
87148
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
87108
87149
  var hookStorage = new AsyncLocalStorage;
87109
87150
  function createStore(rl) {
@@ -87208,10 +87249,10 @@ var effectScheduler = {
87208
87249
  }
87209
87250
  };
87210
87251
 
87211
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/use-state.js
87252
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-state.js
87212
87253
  function useState(defaultValue) {
87213
87254
  return withPointer((pointer) => {
87214
- const setState = AsyncResource2.bind(function setState(newValue) {
87255
+ const setState = AsyncResource2.bind(function setState2(newValue) {
87215
87256
  if (pointer.get() !== newValue) {
87216
87257
  pointer.set(newValue);
87217
87258
  handleChange();
@@ -87226,7 +87267,7 @@ function useState(defaultValue) {
87226
87267
  });
87227
87268
  }
87228
87269
 
87229
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/use-effect.js
87270
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-effect.js
87230
87271
  function useEffect(cb, depArray) {
87231
87272
  withPointer((pointer) => {
87232
87273
  const oldDeps = pointer.get();
@@ -87238,7 +87279,7 @@ function useEffect(cb, depArray) {
87238
87279
  });
87239
87280
  }
87240
87281
 
87241
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/theme.js
87282
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/theme.js
87242
87283
  import { styleText } from "node:util";
87243
87284
 
87244
87285
  // ../node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
@@ -87530,7 +87571,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
87530
87571
  var dist_default = figures;
87531
87572
  var replacements = Object.entries(specialMainSymbols);
87532
87573
 
87533
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/theme.js
87574
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/theme.js
87534
87575
  var defaultTheme = {
87535
87576
  prefix: {
87536
87577
  idle: styleText("blue", "?"),
@@ -87551,7 +87592,7 @@ var defaultTheme = {
87551
87592
  }
87552
87593
  };
87553
87594
 
87554
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/make-theme.js
87595
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/make-theme.js
87555
87596
  function isPlainObject7(value) {
87556
87597
  if (typeof value !== "object" || value === null)
87557
87598
  return false;
@@ -87579,7 +87620,7 @@ function makeTheme(...themes) {
87579
87620
  return deepMerge(...themesToMerge);
87580
87621
  }
87581
87622
 
87582
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
87623
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-prefix.js
87583
87624
  function usePrefix({ status = "idle", theme }) {
87584
87625
  const [showLoader, setShowLoader] = useState(false);
87585
87626
  const [tick, setTick] = useState(0);
@@ -87609,12 +87650,12 @@ function usePrefix({ status = "idle", theme }) {
87609
87650
  const iconName = status === "loading" ? "idle" : status;
87610
87651
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
87611
87652
  }
87612
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/use-ref.js
87653
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-ref.js
87613
87654
  function useRef(val) {
87614
87655
  return useState({ current: val })[0];
87615
87656
  }
87616
87657
 
87617
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
87658
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-keypress.js
87618
87659
  function useKeypress(userHandler) {
87619
87660
  const signal = useRef(userHandler);
87620
87661
  signal.current = userHandler;
@@ -87632,309 +87673,196 @@ function useKeypress(userHandler) {
87632
87673
  };
87633
87674
  }, []);
87634
87675
  }
87635
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/utils.js
87676
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/utils.js
87636
87677
  var import_cli_width = __toESM(require_cli_width(), 1);
87637
87678
 
87638
- // ../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
87639
- function ansiRegex({ onlyFirst = false } = {}) {
87640
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
87641
- const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
87642
- const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
87643
- const pattern2 = `${osc}|${csi}`;
87644
- return new RegExp(pattern2, onlyFirst ? undefined : "g");
87645
- }
87646
-
87647
- // ../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
87648
- var regex = ansiRegex();
87649
- function stripAnsi(string7) {
87650
- if (typeof string7 !== "string") {
87651
- throw new TypeError(`Expected a \`string\`, got \`${typeof string7}\``);
87652
- }
87653
- return string7.replace(regex, "");
87654
- }
87655
-
87656
- // ../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js
87657
- function isAmbiguous(x) {
87658
- return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
87659
- }
87660
- function isFullWidth(x) {
87679
+ // ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
87680
+ var getCodePointsLength = (() => {
87681
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
87682
+ return (input) => {
87683
+ let surrogatePairsNr = 0;
87684
+ SURROGATE_PAIR_RE.lastIndex = 0;
87685
+ while (SURROGATE_PAIR_RE.test(input)) {
87686
+ surrogatePairsNr += 1;
87687
+ }
87688
+ return input.length - surrogatePairsNr;
87689
+ };
87690
+ })();
87691
+ var isFullWidth = (x) => {
87661
87692
  return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
87662
- }
87663
- function isWide(x) {
87664
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
87665
- }
87666
-
87667
- // ../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
87668
- function validate(codePoint) {
87669
- if (!Number.isSafeInteger(codePoint)) {
87670
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
87671
- }
87672
- }
87673
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
87674
- validate(codePoint);
87675
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
87676
- return 2;
87677
- }
87678
- return 1;
87679
- }
87693
+ };
87694
+ var isWideNotCJKTNotEmoji = (x) => {
87695
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
87696
+ };
87680
87697
 
87681
- // ../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
87682
- var import_emoji_regex = __toESM(require_emoji_regex(), 1);
87683
- var segmenter = new Intl.Segmenter;
87684
- var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
87685
- function stringWidth(string7, options = {}) {
87686
- if (typeof string7 !== "string" || string7.length === 0) {
87687
- return 0;
87688
- }
87689
- const {
87690
- ambiguousIsNarrow = true,
87691
- countAnsiEscapeCodes = false
87692
- } = options;
87693
- if (!countAnsiEscapeCodes) {
87694
- string7 = stripAnsi(string7);
87695
- }
87696
- if (string7.length === 0) {
87697
- return 0;
87698
- }
87698
+ // ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
87699
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
87700
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
87701
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
87702
+ var TAB_RE = /\t{1,1000}/y;
87703
+ var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
87704
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
87705
+ var MODIFIER_RE = /\p{M}+/gu;
87706
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
87707
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
87708
+ const LIMIT = truncationOptions.limit ?? Infinity;
87709
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
87710
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
87711
+ const ANSI_WIDTH = 0;
87712
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
87713
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
87714
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
87715
+ const FULL_WIDTH_WIDTH = 2;
87716
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
87717
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
87718
+ const PARSE_BLOCKS = [
87719
+ [LATIN_RE, REGULAR_WIDTH],
87720
+ [ANSI_RE, ANSI_WIDTH],
87721
+ [CONTROL_RE, CONTROL_WIDTH],
87722
+ [TAB_RE, TAB_WIDTH],
87723
+ [EMOJI_RE, EMOJI_WIDTH],
87724
+ [CJKT_WIDE_RE, WIDE_WIDTH]
87725
+ ];
87726
+ let indexPrev = 0;
87727
+ let index3 = 0;
87728
+ let length = input.length;
87729
+ let lengthExtra = 0;
87730
+ let truncationEnabled = false;
87731
+ let truncationIndex = length;
87732
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
87733
+ let unmatchedStart = 0;
87734
+ let unmatchedEnd = 0;
87699
87735
  let width = 0;
87700
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
87701
- for (const { segment: character } of segmenter.segment(string7)) {
87702
- const codePoint = character.codePointAt(0);
87703
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
87704
- continue;
87705
- }
87706
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
87707
- continue;
87708
- }
87709
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
87710
- continue;
87711
- }
87712
- if (codePoint >= 55296 && codePoint <= 57343) {
87713
- continue;
87714
- }
87715
- if (codePoint >= 65024 && codePoint <= 65039) {
87716
- continue;
87717
- }
87718
- if (defaultIgnorableCodePointRegex.test(character)) {
87719
- continue;
87720
- }
87721
- if (import_emoji_regex.default().test(character)) {
87722
- width += 2;
87723
- continue;
87724
- }
87725
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
87726
- }
87727
- return width;
87728
- }
87729
-
87730
- // ../node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js
87731
- var ANSI_BACKGROUND_OFFSET2 = 10;
87732
- var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
87733
- var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
87734
- var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
87735
- var styles3 = {
87736
- modifier: {
87737
- reset: [0, 0],
87738
- bold: [1, 22],
87739
- dim: [2, 22],
87740
- italic: [3, 23],
87741
- underline: [4, 24],
87742
- overline: [53, 55],
87743
- inverse: [7, 27],
87744
- hidden: [8, 28],
87745
- strikethrough: [9, 29]
87746
- },
87747
- color: {
87748
- black: [30, 39],
87749
- red: [31, 39],
87750
- green: [32, 39],
87751
- yellow: [33, 39],
87752
- blue: [34, 39],
87753
- magenta: [35, 39],
87754
- cyan: [36, 39],
87755
- white: [37, 39],
87756
- blackBright: [90, 39],
87757
- gray: [90, 39],
87758
- grey: [90, 39],
87759
- redBright: [91, 39],
87760
- greenBright: [92, 39],
87761
- yellowBright: [93, 39],
87762
- blueBright: [94, 39],
87763
- magentaBright: [95, 39],
87764
- cyanBright: [96, 39],
87765
- whiteBright: [97, 39]
87766
- },
87767
- bgColor: {
87768
- bgBlack: [40, 49],
87769
- bgRed: [41, 49],
87770
- bgGreen: [42, 49],
87771
- bgYellow: [43, 49],
87772
- bgBlue: [44, 49],
87773
- bgMagenta: [45, 49],
87774
- bgCyan: [46, 49],
87775
- bgWhite: [47, 49],
87776
- bgBlackBright: [100, 49],
87777
- bgGray: [100, 49],
87778
- bgGrey: [100, 49],
87779
- bgRedBright: [101, 49],
87780
- bgGreenBright: [102, 49],
87781
- bgYellowBright: [103, 49],
87782
- bgBlueBright: [104, 49],
87783
- bgMagentaBright: [105, 49],
87784
- bgCyanBright: [106, 49],
87785
- bgWhiteBright: [107, 49]
87786
- }
87787
- };
87788
- var modifierNames2 = Object.keys(styles3.modifier);
87789
- var foregroundColorNames2 = Object.keys(styles3.color);
87790
- var backgroundColorNames2 = Object.keys(styles3.bgColor);
87791
- var colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
87792
- function assembleStyles2() {
87793
- const codes = new Map;
87794
- for (const [groupName, group] of Object.entries(styles3)) {
87795
- for (const [styleName, style] of Object.entries(group)) {
87796
- styles3[styleName] = {
87797
- open: `\x1B[${style[0]}m`,
87798
- close: `\x1B[${style[1]}m`
87799
- };
87800
- group[styleName] = styles3[styleName];
87801
- codes.set(style[0], style[1]);
87802
- }
87803
- Object.defineProperty(styles3, groupName, {
87804
- value: group,
87805
- enumerable: false
87806
- });
87807
- }
87808
- Object.defineProperty(styles3, "codes", {
87809
- value: codes,
87810
- enumerable: false
87811
- });
87812
- styles3.color.close = "\x1B[39m";
87813
- styles3.bgColor.close = "\x1B[49m";
87814
- styles3.color.ansi = wrapAnsi162();
87815
- styles3.color.ansi256 = wrapAnsi2562();
87816
- styles3.color.ansi16m = wrapAnsi16m2();
87817
- styles3.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
87818
- styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
87819
- styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
87820
- Object.defineProperties(styles3, {
87821
- rgbToAnsi256: {
87822
- value(red, green, blue) {
87823
- if (red === green && green === blue) {
87824
- if (red < 8) {
87825
- return 16;
87736
+ let widthExtra = 0;
87737
+ outer:
87738
+ while (true) {
87739
+ if (unmatchedEnd > unmatchedStart || index3 >= length && index3 > indexPrev) {
87740
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index3);
87741
+ lengthExtra = 0;
87742
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
87743
+ const codePoint = char.codePointAt(0) || 0;
87744
+ if (isFullWidth(codePoint)) {
87745
+ widthExtra = FULL_WIDTH_WIDTH;
87746
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
87747
+ widthExtra = WIDE_WIDTH;
87748
+ } else {
87749
+ widthExtra = REGULAR_WIDTH;
87826
87750
  }
87827
- if (red > 248) {
87828
- return 231;
87751
+ if (width + widthExtra > truncationLimit) {
87752
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
87829
87753
  }
87830
- return Math.round((red - 8) / 247 * 24) + 232;
87831
- }
87832
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
87833
- },
87834
- enumerable: false
87835
- },
87836
- hexToRgb: {
87837
- value(hex6) {
87838
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex6.toString(16));
87839
- if (!matches) {
87840
- return [0, 0, 0];
87841
- }
87842
- let [colorString] = matches;
87843
- if (colorString.length === 3) {
87844
- colorString = [...colorString].map((character) => character + character).join("");
87845
- }
87846
- const integer5 = Number.parseInt(colorString, 16);
87847
- return [
87848
- integer5 >> 16 & 255,
87849
- integer5 >> 8 & 255,
87850
- integer5 & 255
87851
- ];
87852
- },
87853
- enumerable: false
87854
- },
87855
- hexToAnsi256: {
87856
- value: (hex6) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex6)),
87857
- enumerable: false
87858
- },
87859
- ansi256ToAnsi: {
87860
- value(code) {
87861
- if (code < 8) {
87862
- return 30 + code;
87863
- }
87864
- if (code < 16) {
87865
- return 90 + (code - 8);
87866
- }
87867
- let red;
87868
- let green;
87869
- let blue;
87870
- if (code >= 232) {
87871
- red = ((code - 232) * 10 + 8) / 255;
87872
- green = red;
87873
- blue = red;
87874
- } else {
87875
- code -= 16;
87876
- const remainder = code % 36;
87877
- red = Math.floor(code / 36) / 5;
87878
- green = Math.floor(remainder / 6) / 5;
87879
- blue = remainder % 6 / 5;
87880
- }
87881
- const value = Math.max(red, green, blue) * 2;
87882
- if (value === 0) {
87883
- return 30;
87884
- }
87885
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
87886
- if (value === 2) {
87887
- result += 60;
87754
+ if (width + widthExtra > LIMIT) {
87755
+ truncationEnabled = true;
87756
+ break outer;
87757
+ }
87758
+ lengthExtra += char.length;
87759
+ width += widthExtra;
87760
+ }
87761
+ unmatchedStart = unmatchedEnd = 0;
87762
+ }
87763
+ if (index3 >= length) {
87764
+ break outer;
87765
+ }
87766
+ for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
87767
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
87768
+ BLOCK_RE.lastIndex = index3;
87769
+ if (BLOCK_RE.test(input)) {
87770
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index3, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index3;
87771
+ widthExtra = lengthExtra * BLOCK_WIDTH;
87772
+ if (width + widthExtra > truncationLimit) {
87773
+ truncationIndex = Math.min(truncationIndex, index3 + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
87774
+ }
87775
+ if (width + widthExtra > LIMIT) {
87776
+ truncationEnabled = true;
87777
+ break outer;
87778
+ }
87779
+ width += widthExtra;
87780
+ unmatchedStart = indexPrev;
87781
+ unmatchedEnd = index3;
87782
+ index3 = indexPrev = BLOCK_RE.lastIndex;
87783
+ continue outer;
87888
87784
  }
87889
- return result;
87890
- },
87891
- enumerable: false
87892
- },
87893
- rgbToAnsi: {
87894
- value: (red, green, blue) => styles3.ansi256ToAnsi(styles3.rgbToAnsi256(red, green, blue)),
87895
- enumerable: false
87896
- },
87897
- hexToAnsi: {
87898
- value: (hex6) => styles3.ansi256ToAnsi(styles3.hexToAnsi256(hex6)),
87899
- enumerable: false
87785
+ }
87786
+ index3 += 1;
87900
87787
  }
87901
- });
87902
- return styles3;
87903
- }
87904
- var ansiStyles2 = assembleStyles2();
87905
- var ansi_styles_default2 = ansiStyles2;
87788
+ return {
87789
+ width: truncationEnabled ? truncationLimit : width,
87790
+ index: truncationEnabled ? truncationIndex : length,
87791
+ truncated: truncationEnabled,
87792
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
87793
+ };
87794
+ };
87795
+ var dist_default2 = getStringTruncatedWidth;
87906
87796
 
87907
- // ../node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
87908
- var ESCAPES = new Set([
87909
- "\x1B",
87910
- "›"
87911
- ]);
87797
+ // ../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
87798
+ var NO_TRUNCATION2 = {
87799
+ limit: Infinity,
87800
+ ellipsis: "",
87801
+ ellipsisWidth: 0
87802
+ };
87803
+ var fastStringWidth = (input, options = {}) => {
87804
+ return dist_default2(input, NO_TRUNCATION2, options).width;
87805
+ };
87806
+ var dist_default3 = fastStringWidth;
87807
+
87808
+ // ../node_modules/.pnpm/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
87809
+ var ESC = "\x1B";
87810
+ var CSI = "›";
87912
87811
  var END_CODE = 39;
87913
87812
  var ANSI_ESCAPE_BELL = "\x07";
87914
87813
  var ANSI_CSI = "[";
87915
87814
  var ANSI_OSC = "]";
87916
87815
  var ANSI_SGR_TERMINATOR = "m";
87917
87816
  var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
87918
- var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
87919
- var wrapAnsiHyperlink = (url6) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url6}${ANSI_ESCAPE_BELL}`;
87920
- var wordLengths = (string7) => string7.split(" ").map((character) => stringWidth(character));
87817
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
87818
+ var getClosingCode = (openingCode) => {
87819
+ if (openingCode >= 30 && openingCode <= 37)
87820
+ return 39;
87821
+ if (openingCode >= 90 && openingCode <= 97)
87822
+ return 39;
87823
+ if (openingCode >= 40 && openingCode <= 47)
87824
+ return 49;
87825
+ if (openingCode >= 100 && openingCode <= 107)
87826
+ return 49;
87827
+ if (openingCode === 1 || openingCode === 2)
87828
+ return 22;
87829
+ if (openingCode === 3)
87830
+ return 23;
87831
+ if (openingCode === 4)
87832
+ return 24;
87833
+ if (openingCode === 7)
87834
+ return 27;
87835
+ if (openingCode === 8)
87836
+ return 28;
87837
+ if (openingCode === 9)
87838
+ return 29;
87839
+ if (openingCode === 0)
87840
+ return 0;
87841
+ return;
87842
+ };
87843
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
87844
+ var wrapAnsiHyperlink = (url6) => `${ESC}${ANSI_ESCAPE_LINK}${url6}${ANSI_ESCAPE_BELL}`;
87921
87845
  var wrapWord = (rows, word, columns) => {
87922
- const characters = [...word];
87846
+ const characters = word[Symbol.iterator]();
87923
87847
  let isInsideEscape = false;
87924
87848
  let isInsideLinkEscape = false;
87925
- let visible = stringWidth(stripAnsi(rows.at(-1)));
87926
- for (const [index3, character] of characters.entries()) {
87927
- const characterLength = stringWidth(character);
87849
+ let lastRow = rows.at(-1);
87850
+ let visible = lastRow === undefined ? 0 : dist_default3(lastRow);
87851
+ let currentCharacter = characters.next();
87852
+ let nextCharacter = characters.next();
87853
+ let rawCharacterIndex = 0;
87854
+ while (!currentCharacter.done) {
87855
+ const character = currentCharacter.value;
87856
+ const characterLength = dist_default3(character);
87928
87857
  if (visible + characterLength <= columns) {
87929
87858
  rows[rows.length - 1] += character;
87930
87859
  } else {
87931
87860
  rows.push(character);
87932
87861
  visible = 0;
87933
87862
  }
87934
- if (ESCAPES.has(character)) {
87863
+ if (character === ESC || character === CSI) {
87935
87864
  isInsideEscape = true;
87936
- const ansiEscapeLinkCandidate = characters.slice(index3 + 1, index3 + 1 + ANSI_ESCAPE_LINK.length).join("");
87937
- isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
87865
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
87938
87866
  }
87939
87867
  if (isInsideEscape) {
87940
87868
  if (isInsideLinkEscape) {
@@ -87945,23 +87873,27 @@ var wrapWord = (rows, word, columns) => {
87945
87873
  } else if (character === ANSI_SGR_TERMINATOR) {
87946
87874
  isInsideEscape = false;
87947
87875
  }
87948
- continue;
87949
- }
87950
- visible += characterLength;
87951
- if (visible === columns && index3 < characters.length - 1) {
87952
- rows.push("");
87953
- visible = 0;
87876
+ } else {
87877
+ visible += characterLength;
87878
+ if (visible === columns && !nextCharacter.done) {
87879
+ rows.push("");
87880
+ visible = 0;
87881
+ }
87954
87882
  }
87883
+ currentCharacter = nextCharacter;
87884
+ nextCharacter = characters.next();
87885
+ rawCharacterIndex += character.length;
87955
87886
  }
87956
- if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
87887
+ lastRow = rows.at(-1);
87888
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
87957
87889
  rows[rows.length - 2] += rows.pop();
87958
87890
  }
87959
87891
  };
87960
87892
  var stringVisibleTrimSpacesRight = (string7) => {
87961
87893
  const words = string7.split(" ");
87962
87894
  let last = words.length;
87963
- while (last > 0) {
87964
- if (stringWidth(words[last - 1]) > 0) {
87895
+ while (last) {
87896
+ if (dist_default3(words[last - 1])) {
87965
87897
  break;
87966
87898
  }
87967
87899
  last--;
@@ -87978,95 +87910,114 @@ var exec = (string7, columns, options = {}) => {
87978
87910
  let returnValue = "";
87979
87911
  let escapeCode;
87980
87912
  let escapeUrl;
87981
- const lengths = wordLengths(string7);
87913
+ const words = string7.split(" ");
87982
87914
  let rows = [""];
87983
- for (const [index3, word] of string7.split(" ").entries()) {
87915
+ let rowLength = 0;
87916
+ for (let index3 = 0;index3 < words.length; index3++) {
87917
+ const word = words[index3];
87984
87918
  if (options.trim !== false) {
87985
- rows[rows.length - 1] = rows.at(-1).trimStart();
87919
+ const row = rows.at(-1) ?? "";
87920
+ const trimmed = row.trimStart();
87921
+ if (row.length !== trimmed.length) {
87922
+ rows[rows.length - 1] = trimmed;
87923
+ rowLength = dist_default3(trimmed);
87924
+ }
87986
87925
  }
87987
- let rowLength = stringWidth(rows.at(-1));
87988
87926
  if (index3 !== 0) {
87989
87927
  if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
87990
87928
  rows.push("");
87991
87929
  rowLength = 0;
87992
87930
  }
87993
- if (rowLength > 0 || options.trim === false) {
87931
+ if (rowLength || options.trim === false) {
87994
87932
  rows[rows.length - 1] += " ";
87995
87933
  rowLength++;
87996
87934
  }
87997
87935
  }
87998
- if (options.hard && lengths[index3] > columns) {
87936
+ const wordLength = dist_default3(word);
87937
+ if (options.hard && wordLength > columns) {
87999
87938
  const remainingColumns = columns - rowLength;
88000
- const breaksStartingThisLine = 1 + Math.floor((lengths[index3] - remainingColumns - 1) / columns);
88001
- const breaksStartingNextLine = Math.floor((lengths[index3] - 1) / columns);
87939
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
87940
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
88002
87941
  if (breaksStartingNextLine < breaksStartingThisLine) {
88003
87942
  rows.push("");
88004
87943
  }
88005
87944
  wrapWord(rows, word, columns);
87945
+ rowLength = dist_default3(rows.at(-1) ?? "");
88006
87946
  continue;
88007
87947
  }
88008
- if (rowLength + lengths[index3] > columns && rowLength > 0 && lengths[index3] > 0) {
87948
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
88009
87949
  if (options.wordWrap === false && rowLength < columns) {
88010
87950
  wrapWord(rows, word, columns);
87951
+ rowLength = dist_default3(rows.at(-1) ?? "");
88011
87952
  continue;
88012
87953
  }
88013
87954
  rows.push("");
87955
+ rowLength = 0;
88014
87956
  }
88015
- if (rowLength + lengths[index3] > columns && options.wordWrap === false) {
87957
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
88016
87958
  wrapWord(rows, word, columns);
87959
+ rowLength = dist_default3(rows.at(-1) ?? "");
88017
87960
  continue;
88018
87961
  }
88019
87962
  rows[rows.length - 1] += word;
87963
+ rowLength += wordLength;
88020
87964
  }
88021
87965
  if (options.trim !== false) {
88022
87966
  rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
88023
87967
  }
88024
87968
  const preString = rows.join(`
88025
87969
  `);
88026
- const pre = [...preString];
88027
- let preStringIndex = 0;
88028
- for (const [index3, character] of pre.entries()) {
87970
+ let inSurrogate = false;
87971
+ for (let i = 0;i < preString.length; i++) {
87972
+ const character = preString[i];
88029
87973
  returnValue += character;
88030
- if (ESCAPES.has(character)) {
88031
- const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
88032
- if (groups.code !== undefined) {
88033
- const code2 = Number.parseFloat(groups.code);
88034
- escapeCode = code2 === END_CODE ? undefined : code2;
88035
- } else if (groups.uri !== undefined) {
87974
+ if (!inSurrogate) {
87975
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
87976
+ if (inSurrogate) {
87977
+ continue;
87978
+ }
87979
+ } else {
87980
+ inSurrogate = false;
87981
+ }
87982
+ if (character === ESC || character === CSI) {
87983
+ GROUP_REGEX.lastIndex = i + 1;
87984
+ const groupsResult = GROUP_REGEX.exec(preString);
87985
+ const groups = groupsResult?.groups;
87986
+ if (groups?.code !== undefined) {
87987
+ const code = Number.parseFloat(groups.code);
87988
+ escapeCode = code === END_CODE ? undefined : code;
87989
+ } else if (groups?.uri !== undefined) {
88036
87990
  escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
88037
87991
  }
88038
87992
  }
88039
- const code = ansi_styles_default2.codes.get(Number(escapeCode));
88040
- if (pre[index3 + 1] === `
87993
+ if (preString[i + 1] === `
88041
87994
  `) {
88042
87995
  if (escapeUrl) {
88043
87996
  returnValue += wrapAnsiHyperlink("");
88044
87997
  }
88045
- if (escapeCode && code) {
88046
- returnValue += wrapAnsiCode(code);
87998
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
87999
+ if (escapeCode && closingCode) {
88000
+ returnValue += wrapAnsiCode(closingCode);
88047
88001
  }
88048
88002
  } else if (character === `
88049
88003
  `) {
88050
- if (escapeCode && code) {
88004
+ if (escapeCode && getClosingCode(escapeCode)) {
88051
88005
  returnValue += wrapAnsiCode(escapeCode);
88052
88006
  }
88053
88007
  if (escapeUrl) {
88054
88008
  returnValue += wrapAnsiHyperlink(escapeUrl);
88055
88009
  }
88056
88010
  }
88057
- preStringIndex += character.length;
88058
88011
  }
88059
88012
  return returnValue;
88060
88013
  };
88014
+ var CRLF_OR_LF = /\r?\n/;
88061
88015
  function wrapAnsi(string7, columns, options) {
88062
- return String(string7).normalize().replaceAll(`\r
88063
- `, `
88064
- `).split(`
88065
- `).map((line) => exec(line, columns, options)).join(`
88016
+ return String(string7).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
88066
88017
  `);
88067
88018
  }
88068
88019
 
88069
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/utils.js
88020
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/utils.js
88070
88021
  function breakLines(content, width) {
88071
88022
  return content.split(`
88072
88023
  `).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
@@ -88077,7 +88028,7 @@ function readlineWidth() {
88077
88028
  return import_cli_width.default({ defaultWidth: 80, output: readline().output });
88078
88029
  }
88079
88030
 
88080
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88031
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/create-prompt.js
88081
88032
  var import_mute_stream = __toESM(require_lib(), 1);
88082
88033
  import * as readline2 from "node:readline";
88083
88034
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
@@ -88290,26 +88241,26 @@ var {
88290
88241
  unload
88291
88242
  } = signalExitWrap(processOk(process9) ? new SignalExit(process9) : new SignalExitFallback);
88292
88243
 
88293
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88244
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/screen-manager.js
88294
88245
  import { stripVTControlCharacters } from "node:util";
88295
88246
 
88296
88247
  // ../node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
88297
- var ESC = "\x1B[";
88298
- var cursorLeft = ESC + "G";
88299
- var cursorHide = ESC + "?25l";
88300
- var cursorShow = ESC + "?25h";
88301
- var cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
88302
- var cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
88248
+ var ESC2 = "\x1B[";
88249
+ var cursorLeft = ESC2 + "G";
88250
+ var cursorHide = ESC2 + "?25l";
88251
+ var cursorShow = ESC2 + "?25h";
88252
+ var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
88253
+ var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
88303
88254
  var cursorTo = (x, y) => {
88304
88255
  if (typeof y === "number" && !Number.isNaN(y)) {
88305
- return `${ESC}${y + 1};${x + 1}H`;
88256
+ return `${ESC2}${y + 1};${x + 1}H`;
88306
88257
  }
88307
- return `${ESC}${x + 1}G`;
88258
+ return `${ESC2}${x + 1}G`;
88308
88259
  };
88309
- var eraseLine = ESC + "2K";
88260
+ var eraseLine = ESC2 + "2K";
88310
88261
  var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
88311
88262
 
88312
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88263
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/screen-manager.js
88313
88264
  var height = (content) => content.split(`
88314
88265
  `).length;
88315
88266
  var lastLine = (content) => content.split(`
@@ -88374,7 +88325,7 @@ class ScreenManager {
88374
88325
  }
88375
88326
  }
88376
88327
 
88377
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
88328
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
88378
88329
  class PromisePolyfill extends Promise {
88379
88330
  static withResolver() {
88380
88331
  let resolve;
@@ -88387,7 +88338,7 @@ class PromisePolyfill extends Promise {
88387
88338
  }
88388
88339
  }
88389
88340
 
88390
- // ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.2.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88341
+ // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/create-prompt.js
88391
88342
  function getCallSites() {
88392
88343
  const _prepareStackTrace = Error.prepareStackTrace;
88393
88344
  let result = [];
@@ -88473,7 +88424,7 @@ function createPrompt(view) {
88473
88424
  };
88474
88425
  return prompt;
88475
88426
  }
88476
- // ../node_modules/.pnpm/@inquirer+confirm@6.0.4_@types+node@25.2.0/node_modules/@inquirer/confirm/dist/index.js
88427
+ // ../node_modules/.pnpm/@inquirer+confirm@6.0.6_@types+node@25.2.3/node_modules/@inquirer/confirm/dist/index.js
88477
88428
  function getBooleanValue(value, defaultValue) {
88478
88429
  let answer = defaultValue !== false;
88479
88430
  if (/^(y|yes)/i.test(value))
@@ -88485,7 +88436,7 @@ function getBooleanValue(value, defaultValue) {
88485
88436
  function boolToString(value) {
88486
88437
  return value ? "Yes" : "No";
88487
88438
  }
88488
- var dist_default2 = createPrompt((config7, done) => {
88439
+ var dist_default4 = createPrompt((config7, done) => {
88489
88440
  const { transformer = boolToString } = config7;
88490
88441
  const [status, setStatus] = useState("idle");
88491
88442
  const [value, setValue] = useState("");
@@ -88575,7 +88526,7 @@ class AppDownload {
88575
88526
  return runCommand(command, args2);
88576
88527
  }
88577
88528
  async confirm(message) {
88578
- return await dist_default2({
88529
+ return await dist_default4({
88579
88530
  message: message || "是否继续删除应用?",
88580
88531
  default: false
88581
88532
  });
@@ -95469,7 +95420,7 @@ var init_crypto = __esm2(() => {
95469
95420
  } catch (e) {
95470
95421
  errorProto = getProto(getProto(e)), INTRINSICS["%Error.prototype%"] = errorProto;
95471
95422
  }
95472
- var errorProto, doEval = function doEval(name) {
95423
+ var errorProto, doEval = function doEval2(name) {
95473
95424
  var value;
95474
95425
  if (name === "%AsyncFunction%")
95475
95426
  value = getEvalledConstructor("async function () {}");
@@ -95478,11 +95429,11 @@ var init_crypto = __esm2(() => {
95478
95429
  else if (name === "%AsyncGeneratorFunction%")
95479
95430
  value = getEvalledConstructor("async function* () {}");
95480
95431
  else if (name === "%AsyncGenerator%") {
95481
- var fn = doEval("%AsyncGeneratorFunction%");
95432
+ var fn = doEval2("%AsyncGeneratorFunction%");
95482
95433
  if (fn)
95483
95434
  value = fn.prototype;
95484
95435
  } else if (name === "%AsyncIteratorPrototype%") {
95485
- var gen = doEval("%AsyncGenerator%");
95436
+ var gen = doEval2("%AsyncGenerator%");
95486
95437
  if (gen && getProto)
95487
95438
  value = getProto(gen.prototype);
95488
95439
  }
@@ -108319,14 +108270,14 @@ class AIUtils {
108319
108270
  }
108320
108271
  extractCodeFromMarkdown(str, language) {
108321
108272
  if (language) {
108322
- const regex22 = new RegExp(`\`\`\`${language}\\s*([\\s\\S]*?)\\s*\`\`\``, "g");
108323
- const matches2 = str.match(regex22);
108273
+ const regex2 = new RegExp(`\`\`\`${language}\\s*([\\s\\S]*?)\\s*\`\`\``, "g");
108274
+ const matches2 = str.match(regex2);
108324
108275
  if (!matches2)
108325
108276
  return null;
108326
108277
  return matches2.map((m) => m.replace(new RegExp(`\`\`\`${language}\\s*|\\s*\`\`\``, "g"), "").trim());
108327
108278
  }
108328
- const regex2 = /```[\w]*\s*([\s\S]*?)\s*```/g;
108329
- const matches = [...str.matchAll(regex2)];
108279
+ const regex = /```[\w]*\s*([\s\S]*?)\s*```/g;
108280
+ const matches = [...str.matchAll(regex)];
108330
108281
  if (matches.length === 0)
108331
108282
  return null;
108332
108283
  return matches.map((m) => m[1].trim());
@@ -108872,7 +108823,7 @@ app.route({
108872
108823
  }).addTo(app, {
108873
108824
  overwrite: false
108874
108825
  });
108875
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
108826
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
108876
108827
  var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url6, ...options }) => {
108877
108828
  let lastEventId;
108878
108829
  const sleep = sseSleepFn ?? ((ms3) => new Promise((resolve) => setTimeout(resolve, ms3)));
@@ -108981,7 +108932,7 @@ var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseVa
108981
108932
  return { stream: stream3 };
108982
108933
  };
108983
108934
 
108984
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/core/auth.gen.js
108935
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/core/auth.gen.js
108985
108936
  var getAuthToken = async (auth, callback) => {
108986
108937
  const token = typeof callback === "function" ? await callback(auth) : callback;
108987
108938
  if (!token) {
@@ -108996,12 +108947,12 @@ var getAuthToken = async (auth, callback) => {
108996
108947
  return token;
108997
108948
  };
108998
108949
 
108999
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/core/bodySerializer.gen.js
108950
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/core/bodySerializer.gen.js
109000
108951
  var jsonBodySerializer = {
109001
108952
  bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
109002
108953
  };
109003
108954
 
109004
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/core/pathSerializer.gen.js
108955
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/core/pathSerializer.gen.js
109005
108956
  var separatorArrayExplode = (style) => {
109006
108957
  switch (style) {
109007
108958
  case "label":
@@ -109104,7 +109055,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
109104
109055
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
109105
109056
  };
109106
109057
 
109107
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
109058
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
109108
109059
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
109109
109060
  var defaultPathSerializer = ({ path: path13, url: _url5 }) => {
109110
109061
  let url6 = _url5;
@@ -109172,7 +109123,7 @@ var getUrl = ({ baseUrl, path: path13, query: query3, querySerializer, url: _url
109172
109123
  return url6;
109173
109124
  };
109174
109125
 
109175
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js
109126
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js
109176
109127
  var createQuerySerializer = ({ allowReserved, array: array6, object: object5 } = {}) => {
109177
109128
  const querySerializer = (queryParams) => {
109178
109129
  const search = [];
@@ -109380,7 +109331,7 @@ var createConfig = (override = {}) => ({
109380
109331
  ...override
109381
109332
  });
109382
109333
 
109383
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
109334
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
109384
109335
  var createClient = (config7 = {}) => {
109385
109336
  let _config = mergeConfigs(createConfig(), config7);
109386
109337
  const getConfig2 = () => ({ ..._config });
@@ -109527,7 +109478,7 @@ var createClient = (config7 = {}) => {
109527
109478
  trace: makeMethod("TRACE")
109528
109479
  };
109529
109480
  };
109530
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/core/params.gen.js
109481
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/core/params.gen.js
109531
109482
  var extraPrefixesMap = {
109532
109483
  $body_: "body",
109533
109484
  $headers_: "headers",
@@ -109535,12 +109486,12 @@ var extraPrefixesMap = {
109535
109486
  $query_: "query"
109536
109487
  };
109537
109488
  var extraPrefixes = Object.entries(extraPrefixesMap);
109538
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/client.gen.js
109489
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/client.gen.js
109539
109490
  var client = createClient(createConfig({
109540
109491
  baseUrl: "http://localhost:4096"
109541
109492
  }));
109542
109493
 
109543
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/gen/sdk.gen.js
109494
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/gen/sdk.gen.js
109544
109495
  class _HeyApiClient {
109545
109496
  _client = client;
109546
109497
  constructor(args2) {
@@ -110210,7 +110161,7 @@ class OpencodeClient extends _HeyApiClient {
110210
110161
  event = new Event({ client: this._client });
110211
110162
  }
110212
110163
 
110213
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/client.js
110164
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/client.js
110214
110165
  function createOpencodeClient(config7) {
110215
110166
  if (!config7?.fetch) {
110216
110167
  const customFetch = (req) => {
@@ -110225,13 +110176,13 @@ function createOpencodeClient(config7) {
110225
110176
  if (config7?.directory) {
110226
110177
  config7.headers = {
110227
110178
  ...config7.headers,
110228
- "x-opencode-directory": config7.directory
110179
+ "x-opencode-directory": encodeURIComponent(config7.directory)
110229
110180
  };
110230
110181
  }
110231
110182
  const client2 = createClient(config7);
110232
110183
  return new OpencodeClient({ client: client2 });
110233
110184
  }
110234
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/server.js
110185
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/server.js
110235
110186
  import { spawn as spawn3 } from "node:child_process";
110236
110187
  async function createOpencodeServer(options) {
110237
110188
  options = Object.assign({
@@ -110300,7 +110251,7 @@ Server output: ${output}`;
110300
110251
  }
110301
110252
  };
110302
110253
  }
110303
- // ../node_modules/.pnpm/@opencode-ai+sdk@1.1.49/node_modules/@opencode-ai/sdk/dist/index.js
110254
+ // ../node_modules/.pnpm/@opencode-ai+sdk@1.2.4/node_modules/@opencode-ai/sdk/dist/index.js
110304
110255
  async function createOpencode(options) {
110305
110256
  const server2 = await createOpencodeServer({
110306
110257
  ...options
@@ -110678,8 +110629,7 @@ app.route({
110678
110629
  }
110679
110630
  }).addTo(app);
110680
110631
 
110681
- // ../node_modules/.pnpm/@kevisual+context@0.0.4/node_modules/@kevisual/context/dist/app.js
110682
- var isBrowser3 = typeof window !== "undefined" && typeof window.document !== "undefined";
110632
+ // ../node_modules/.pnpm/@kevisual+context@0.0.6/node_modules/@kevisual/context/dist/app.js
110683
110633
  function getDefaultExportFromCjs5(x) {
110684
110634
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
110685
110635
  }
@@ -111212,6 +111162,7 @@ var useConfigKey3 = (key, init, isNew) => {
111212
111162
  }
111213
111163
  return useEnvKey3(key, init, "config");
111214
111164
  };
111165
+
111215
111166
  class InitEnv3 {
111216
111167
  static isInit = false;
111217
111168
  static init(opts) {
@@ -111279,100 +111230,86 @@ app.route({
111279
111230
  });
111280
111231
  }).addTo(app);
111281
111232
 
111282
- // ../node_modules/.pnpm/lru-cache@11.2.5/node_modules/lru-cache/dist/esm/index.js
111283
- var defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
111284
- var warned = new Set;
111285
- var PROCESS = typeof process === "object" && !!process ? process : {};
111286
- var emitWarning = (msg, type, code2, fn) => {
111287
- typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code2, fn) : console.error(`[${code2}] ${type}: ${msg}`);
111288
- };
111289
- var AC = globalThis.AbortController;
111290
- var AS = globalThis.AbortSignal;
111291
- if (typeof AC === "undefined") {
111292
- AS = class AbortSignal {
111233
+ // ../node_modules/.pnpm/lru-cache@11.2.6/node_modules/lru-cache/dist/esm/index.min.js
111234
+ var M = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
111235
+ var I = new Set;
111236
+ var R = typeof process == "object" && process ? process : {};
111237
+ var x = (a, t, e, i2) => {
111238
+ typeof R.emitWarning == "function" ? R.emitWarning(a, t, e, i2) : console.error(`[${e}] ${t}: ${a}`);
111239
+ };
111240
+ var C = globalThis.AbortController;
111241
+ var D = globalThis.AbortSignal;
111242
+ if (typeof C > "u") {
111243
+ D = class {
111293
111244
  onabort;
111294
111245
  _onabort = [];
111295
111246
  reason;
111296
111247
  aborted = false;
111297
- addEventListener(_, fn) {
111298
- this._onabort.push(fn);
111248
+ addEventListener(i2, s) {
111249
+ this._onabort.push(s);
111299
111250
  }
111300
- };
111301
- AC = class AbortController2 {
111251
+ }, C = class {
111302
111252
  constructor() {
111303
- warnACPolyfill();
111253
+ t();
111304
111254
  }
111305
- signal = new AS;
111306
- abort(reason) {
111307
- if (this.signal.aborted)
111308
- return;
111309
- this.signal.reason = reason;
111310
- this.signal.aborted = true;
111311
- for (const fn of this.signal._onabort) {
111312
- fn(reason);
111255
+ signal = new D;
111256
+ abort(i2) {
111257
+ if (!this.signal.aborted) {
111258
+ this.signal.reason = i2, this.signal.aborted = true;
111259
+ for (let s of this.signal._onabort)
111260
+ s(i2);
111261
+ this.signal.onabort?.(i2);
111313
111262
  }
111314
- this.signal.onabort?.(reason);
111315
111263
  }
111316
111264
  };
111317
- let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
111318
- const warnACPolyfill = () => {
111319
- if (!printACPolyfillWarning)
111320
- return;
111321
- printACPolyfillWarning = false;
111322
- emitWarning("AbortController is not defined. If using lru-cache in " + "node 14, load an AbortController polyfill from the " + "`node-abort-controller` package. A minimal polyfill is " + "provided for use by LRUCache.fetch(), but it should not be " + "relied upon in other contexts (eg, passing it to other APIs that " + "use AbortController/AbortSignal might have undesirable effects). " + "You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
111265
+ let a = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
111266
+ a && (a = false, x("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
111323
111267
  };
111324
111268
  }
111325
- var shouldWarn = (code2) => !warned.has(code2);
111326
- var TYPE = Symbol("type");
111327
- var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
111328
- var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
111329
-
111330
- class ZeroArray extends Array {
111331
- constructor(size) {
111332
- super(size);
111333
- this.fill(0);
111269
+ var G = (a) => !I.has(a);
111270
+ var H = Symbol("type");
111271
+ var y = (a) => a && a === Math.floor(a) && a > 0 && isFinite(a);
111272
+ var U = (a) => y(a) ? a <= Math.pow(2, 8) ? Uint8Array : a <= Math.pow(2, 16) ? Uint16Array : a <= Math.pow(2, 32) ? Uint32Array : a <= Number.MAX_SAFE_INTEGER ? z4 : null : null;
111273
+ var z4 = class extends Array {
111274
+ constructor(t) {
111275
+ super(t), this.fill(0);
111334
111276
  }
111335
- }
111336
-
111337
- class Stack2 {
111277
+ };
111278
+ var W = class a {
111338
111279
  heap;
111339
111280
  length;
111340
- static #constructing = false;
111341
- static create(max) {
111342
- const HeapCls = getUintArray(max);
111343
- if (!HeapCls)
111281
+ static #o = false;
111282
+ static create(t) {
111283
+ let e = U(t);
111284
+ if (!e)
111344
111285
  return [];
111345
- Stack2.#constructing = true;
111346
- const s = new Stack2(max, HeapCls);
111347
- Stack2.#constructing = false;
111348
- return s;
111286
+ a.#o = true;
111287
+ let i2 = new a(t, e);
111288
+ return a.#o = false, i2;
111349
111289
  }
111350
- constructor(max, HeapCls) {
111351
- if (!Stack2.#constructing) {
111290
+ constructor(t, e) {
111291
+ if (!a.#o)
111352
111292
  throw new TypeError("instantiate Stack using Stack.create(n)");
111353
- }
111354
- this.heap = new HeapCls(max);
111355
- this.length = 0;
111293
+ this.heap = new e(t), this.length = 0;
111356
111294
  }
111357
- push(n) {
111358
- this.heap[this.length++] = n;
111295
+ push(t) {
111296
+ this.heap[this.length++] = t;
111359
111297
  }
111360
111298
  pop() {
111361
111299
  return this.heap[--this.length];
111362
111300
  }
111363
- }
111364
-
111365
- class LRUCache {
111366
- #max;
111367
- #maxSize;
111368
- #dispose;
111369
- #onInsert;
111370
- #disposeAfter;
111371
- #fetchMethod;
111372
- #memoMethod;
111373
- #perf;
111301
+ };
111302
+ var L = class a2 {
111303
+ #o;
111304
+ #c;
111305
+ #w;
111306
+ #C;
111307
+ #S;
111308
+ #L;
111309
+ #I;
111310
+ #m;
111374
111311
  get perf() {
111375
- return this.#perf;
111312
+ return this.#m;
111376
111313
  }
111377
111314
  ttl;
111378
111315
  ttlResolution;
@@ -111389,1057 +111326,521 @@ class LRUCache {
111389
111326
  allowStaleOnFetchAbort;
111390
111327
  allowStaleOnFetchRejection;
111391
111328
  ignoreFetchAbort;
111392
- #size;
111393
- #calculatedSize;
111394
- #keyMap;
111395
- #keyList;
111396
- #valList;
111397
- #next;
111398
- #prev;
111399
- #head;
111400
- #tail;
111401
- #free;
111402
- #disposed;
111403
- #sizes;
111404
- #starts;
111405
- #ttls;
111406
- #autopurgeTimers;
111407
- #hasDispose;
111408
- #hasFetchMethod;
111409
- #hasDisposeAfter;
111410
- #hasOnInsert;
111411
- static unsafeExposeInternals(c) {
111412
- return {
111413
- starts: c.#starts,
111414
- ttls: c.#ttls,
111415
- autopurgeTimers: c.#autopurgeTimers,
111416
- sizes: c.#sizes,
111417
- keyMap: c.#keyMap,
111418
- keyList: c.#keyList,
111419
- valList: c.#valList,
111420
- next: c.#next,
111421
- prev: c.#prev,
111422
- get head() {
111423
- return c.#head;
111424
- },
111425
- get tail() {
111426
- return c.#tail;
111427
- },
111428
- free: c.#free,
111429
- isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
111430
- backgroundFetch: (k, index3, options, context) => c.#backgroundFetch(k, index3, options, context),
111431
- moveToTail: (index3) => c.#moveToTail(index3),
111432
- indexes: (options) => c.#indexes(options),
111433
- rindexes: (options) => c.#rindexes(options),
111434
- isStale: (index3) => c.#isStale(index3)
111435
- };
111329
+ #n;
111330
+ #_;
111331
+ #s;
111332
+ #i;
111333
+ #t;
111334
+ #a;
111335
+ #u;
111336
+ #l;
111337
+ #h;
111338
+ #b;
111339
+ #r;
111340
+ #y;
111341
+ #A;
111342
+ #d;
111343
+ #g;
111344
+ #T;
111345
+ #v;
111346
+ #f;
111347
+ #x;
111348
+ static unsafeExposeInternals(t) {
111349
+ return { starts: t.#A, ttls: t.#d, autopurgeTimers: t.#g, sizes: t.#y, keyMap: t.#s, keyList: t.#i, valList: t.#t, next: t.#a, prev: t.#u, get head() {
111350
+ return t.#l;
111351
+ }, get tail() {
111352
+ return t.#h;
111353
+ }, free: t.#b, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i2, s, h) => t.#G(e, i2, s, h), moveToTail: (e) => t.#D(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#O(e), isStale: (e) => t.#p(e) };
111436
111354
  }
111437
111355
  get max() {
111438
- return this.#max;
111356
+ return this.#o;
111439
111357
  }
111440
111358
  get maxSize() {
111441
- return this.#maxSize;
111359
+ return this.#c;
111442
111360
  }
111443
111361
  get calculatedSize() {
111444
- return this.#calculatedSize;
111362
+ return this.#_;
111445
111363
  }
111446
111364
  get size() {
111447
- return this.#size;
111365
+ return this.#n;
111448
111366
  }
111449
111367
  get fetchMethod() {
111450
- return this.#fetchMethod;
111368
+ return this.#L;
111451
111369
  }
111452
111370
  get memoMethod() {
111453
- return this.#memoMethod;
111371
+ return this.#I;
111454
111372
  }
111455
111373
  get dispose() {
111456
- return this.#dispose;
111374
+ return this.#w;
111457
111375
  }
111458
111376
  get onInsert() {
111459
- return this.#onInsert;
111377
+ return this.#C;
111460
111378
  }
111461
111379
  get disposeAfter() {
111462
- return this.#disposeAfter;
111380
+ return this.#S;
111463
111381
  }
111464
- constructor(options) {
111465
- const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, perf } = options;
111466
- if (perf !== undefined) {
111467
- if (typeof perf?.now !== "function") {
111468
- throw new TypeError("perf option must have a now() method if specified");
111469
- }
111470
- }
111471
- this.#perf = perf ?? defaultPerf;
111472
- if (max !== 0 && !isPosInt(max)) {
111382
+ constructor(t) {
111383
+ let { max: e = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: h, updateAgeOnGet: n, updateAgeOnHas: o, allowStale: r, dispose: f, onInsert: m, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: g, maxSize: A = 0, maxEntrySize: p = 0, sizeCalculation: _, fetchMethod: l, memoMethod: w, noDeleteOnFetchRejection: b, noDeleteOnStaleGet: S, allowStaleOnFetchRejection: u, allowStaleOnFetchAbort: T, ignoreFetchAbort: F, perf: v } = t;
111384
+ if (v !== undefined && typeof v?.now != "function")
111385
+ throw new TypeError("perf option must have a now() method if specified");
111386
+ if (this.#m = v ?? M, e !== 0 && !y(e))
111473
111387
  throw new TypeError("max option must be a nonnegative integer");
111474
- }
111475
- const UintArray = max ? getUintArray(max) : Array;
111476
- if (!UintArray) {
111477
- throw new Error("invalid max value: " + max);
111478
- }
111479
- this.#max = max;
111480
- this.#maxSize = maxSize;
111481
- this.maxEntrySize = maxEntrySize || this.#maxSize;
111482
- this.sizeCalculation = sizeCalculation;
111483
- if (this.sizeCalculation) {
111484
- if (!this.#maxSize && !this.maxEntrySize) {
111388
+ let O = e ? U(e) : Array;
111389
+ if (!O)
111390
+ throw new Error("invalid max value: " + e);
111391
+ if (this.#o = e, this.#c = A, this.maxEntrySize = p || this.#c, this.sizeCalculation = _, this.sizeCalculation) {
111392
+ if (!this.#c && !this.maxEntrySize)
111485
111393
  throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
111486
- }
111487
- if (typeof this.sizeCalculation !== "function") {
111394
+ if (typeof this.sizeCalculation != "function")
111488
111395
  throw new TypeError("sizeCalculation set to non-function");
111489
- }
111490
111396
  }
111491
- if (memoMethod !== undefined && typeof memoMethod !== "function") {
111397
+ if (w !== undefined && typeof w != "function")
111492
111398
  throw new TypeError("memoMethod must be a function if defined");
111493
- }
111494
- this.#memoMethod = memoMethod;
111495
- if (fetchMethod !== undefined && typeof fetchMethod !== "function") {
111399
+ if (this.#I = w, l !== undefined && typeof l != "function")
111496
111400
  throw new TypeError("fetchMethod must be a function if specified");
111497
- }
111498
- this.#fetchMethod = fetchMethod;
111499
- this.#hasFetchMethod = !!fetchMethod;
111500
- this.#keyMap = new Map;
111501
- this.#keyList = new Array(max).fill(undefined);
111502
- this.#valList = new Array(max).fill(undefined);
111503
- this.#next = new UintArray(max);
111504
- this.#prev = new UintArray(max);
111505
- this.#head = 0;
111506
- this.#tail = 0;
111507
- this.#free = Stack2.create(max);
111508
- this.#size = 0;
111509
- this.#calculatedSize = 0;
111510
- if (typeof dispose === "function") {
111511
- this.#dispose = dispose;
111512
- }
111513
- if (typeof onInsert === "function") {
111514
- this.#onInsert = onInsert;
111515
- }
111516
- if (typeof disposeAfter === "function") {
111517
- this.#disposeAfter = disposeAfter;
111518
- this.#disposed = [];
111519
- } else {
111520
- this.#disposeAfter = undefined;
111521
- this.#disposed = undefined;
111522
- }
111523
- this.#hasDispose = !!this.#dispose;
111524
- this.#hasOnInsert = !!this.#onInsert;
111525
- this.#hasDisposeAfter = !!this.#disposeAfter;
111526
- this.noDisposeOnSet = !!noDisposeOnSet;
111527
- this.noUpdateTTL = !!noUpdateTTL;
111528
- this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
111529
- this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
111530
- this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
111531
- this.ignoreFetchAbort = !!ignoreFetchAbort;
111532
- if (this.maxEntrySize !== 0) {
111533
- if (this.#maxSize !== 0) {
111534
- if (!isPosInt(this.#maxSize)) {
111535
- throw new TypeError("maxSize must be a positive integer if specified");
111536
- }
111537
- }
111538
- if (!isPosInt(this.maxEntrySize)) {
111401
+ if (this.#L = l, this.#v = !!l, this.#s = new Map, this.#i = new Array(e).fill(undefined), this.#t = new Array(e).fill(undefined), this.#a = new O(e), this.#u = new O(e), this.#l = 0, this.#h = 0, this.#b = W.create(e), this.#n = 0, this.#_ = 0, typeof f == "function" && (this.#w = f), typeof m == "function" && (this.#C = m), typeof c == "function" ? (this.#S = c, this.#r = []) : (this.#S = undefined, this.#r = undefined), this.#T = !!this.#w, this.#x = !!this.#C, this.#f = !!this.#S, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!g, this.noDeleteOnFetchRejection = !!b, this.allowStaleOnFetchRejection = !!u, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!F, this.maxEntrySize !== 0) {
111402
+ if (this.#c !== 0 && !y(this.#c))
111403
+ throw new TypeError("maxSize must be a positive integer if specified");
111404
+ if (!y(this.maxEntrySize))
111539
111405
  throw new TypeError("maxEntrySize must be a positive integer if specified");
111540
- }
111541
- this.#initializeSizeTracking();
111542
- }
111543
- this.allowStale = !!allowStale;
111544
- this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
111545
- this.updateAgeOnGet = !!updateAgeOnGet;
111546
- this.updateAgeOnHas = !!updateAgeOnHas;
111547
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
111548
- this.ttlAutopurge = !!ttlAutopurge;
111549
- this.ttl = ttl || 0;
111550
- if (this.ttl) {
111551
- if (!isPosInt(this.ttl)) {
111406
+ this.#B();
111407
+ }
111408
+ if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!S, this.updateAgeOnGet = !!n, this.updateAgeOnHas = !!o, this.ttlResolution = y(s) || s === 0 ? s : 1, this.ttlAutopurge = !!h, this.ttl = i2 || 0, this.ttl) {
111409
+ if (!y(this.ttl))
111552
111410
  throw new TypeError("ttl must be a positive integer if specified");
111553
- }
111554
- this.#initializeTTLTracking();
111411
+ this.#j();
111555
111412
  }
111556
- if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
111413
+ if (this.#o === 0 && this.ttl === 0 && this.#c === 0)
111557
111414
  throw new TypeError("At least one of max, maxSize, or ttl is required");
111558
- }
111559
- if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
111560
- const code2 = "LRU_CACHE_UNBOUNDED";
111561
- if (shouldWarn(code2)) {
111562
- warned.add(code2);
111563
- const msg = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
111564
- emitWarning(msg, "UnboundedCacheWarning", code2, LRUCache);
111565
- }
111566
- }
111567
- }
111568
- getRemainingTTL(key) {
111569
- return this.#keyMap.has(key) ? Infinity : 0;
111570
- }
111571
- #initializeTTLTracking() {
111572
- const ttls = new ZeroArray(this.#max);
111573
- const starts = new ZeroArray(this.#max);
111574
- this.#ttls = ttls;
111575
- this.#starts = starts;
111576
- const purgeTimers = this.ttlAutopurge ? new Array(this.#max) : undefined;
111577
- this.#autopurgeTimers = purgeTimers;
111578
- this.#setItemTTL = (index3, ttl, start4 = this.#perf.now()) => {
111579
- starts[index3] = ttl !== 0 ? start4 : 0;
111580
- ttls[index3] = ttl;
111581
- if (purgeTimers?.[index3]) {
111582
- clearTimeout(purgeTimers[index3]);
111583
- purgeTimers[index3] = undefined;
111584
- }
111585
- if (ttl !== 0 && purgeTimers) {
111586
- const t = setTimeout(() => {
111587
- if (this.#isStale(index3)) {
111588
- this.#delete(this.#keyList[index3], "expire");
111589
- }
111590
- }, ttl + 1);
111591
- if (t.unref) {
111592
- t.unref();
111593
- }
111594
- purgeTimers[index3] = t;
111595
- }
111596
- };
111597
- this.#updateItemAge = (index3) => {
111598
- starts[index3] = ttls[index3] !== 0 ? this.#perf.now() : 0;
111599
- };
111600
- this.#statusTTL = (status, index3) => {
111601
- if (ttls[index3]) {
111602
- const ttl = ttls[index3];
111603
- const start4 = starts[index3];
111604
- if (!ttl || !start4)
111415
+ if (!this.ttlAutopurge && !this.#o && !this.#c) {
111416
+ let E2 = "LRU_CACHE_UNBOUNDED";
111417
+ G(E2) && (I.add(E2), x("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E2, a2));
111418
+ }
111419
+ }
111420
+ getRemainingTTL(t) {
111421
+ return this.#s.has(t) ? 1 / 0 : 0;
111422
+ }
111423
+ #j() {
111424
+ let t = new z4(this.#o), e = new z4(this.#o);
111425
+ this.#d = t, this.#A = e;
111426
+ let i2 = this.ttlAutopurge ? new Array(this.#o) : undefined;
111427
+ this.#g = i2, this.#N = (n, o, r = this.#m.now()) => {
111428
+ if (e[n] = o !== 0 ? r : 0, t[n] = o, i2?.[n] && (clearTimeout(i2[n]), i2[n] = undefined), o !== 0 && i2) {
111429
+ let f = setTimeout(() => {
111430
+ this.#p(n) && this.#E(this.#i[n], "expire");
111431
+ }, o + 1);
111432
+ f.unref && f.unref(), i2[n] = f;
111433
+ }
111434
+ }, this.#R = (n) => {
111435
+ e[n] = t[n] !== 0 ? this.#m.now() : 0;
111436
+ }, this.#z = (n, o) => {
111437
+ if (t[o]) {
111438
+ let r = t[o], f = e[o];
111439
+ if (!r || !f)
111605
111440
  return;
111606
- status.ttl = ttl;
111607
- status.start = start4;
111608
- status.now = cachedNow || getNow();
111609
- const age = status.now - start4;
111610
- status.remainingTTL = ttl - age;
111441
+ n.ttl = r, n.start = f, n.now = s || h();
111442
+ let m = n.now - f;
111443
+ n.remainingTTL = r - m;
111611
111444
  }
111612
111445
  };
111613
- let cachedNow = 0;
111614
- const getNow = () => {
111615
- const n = this.#perf.now();
111446
+ let s = 0, h = () => {
111447
+ let n = this.#m.now();
111616
111448
  if (this.ttlResolution > 0) {
111617
- cachedNow = n;
111618
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
111619
- if (t.unref) {
111620
- t.unref();
111621
- }
111449
+ s = n;
111450
+ let o = setTimeout(() => s = 0, this.ttlResolution);
111451
+ o.unref && o.unref();
111622
111452
  }
111623
111453
  return n;
111624
111454
  };
111625
- this.getRemainingTTL = (key) => {
111626
- const index3 = this.#keyMap.get(key);
111627
- if (index3 === undefined) {
111455
+ this.getRemainingTTL = (n) => {
111456
+ let o = this.#s.get(n);
111457
+ if (o === undefined)
111628
111458
  return 0;
111629
- }
111630
- const ttl = ttls[index3];
111631
- const start4 = starts[index3];
111632
- if (!ttl || !start4) {
111633
- return Infinity;
111634
- }
111635
- const age = (cachedNow || getNow()) - start4;
111636
- return ttl - age;
111637
- };
111638
- this.#isStale = (index3) => {
111639
- const s = starts[index3];
111640
- const t = ttls[index3];
111641
- return !!t && !!s && (cachedNow || getNow()) - s > t;
111642
- };
111643
- }
111644
- #updateItemAge = () => {};
111645
- #statusTTL = () => {};
111646
- #setItemTTL = () => {};
111647
- #isStale = () => false;
111648
- #initializeSizeTracking() {
111649
- const sizes = new ZeroArray(this.#max);
111650
- this.#calculatedSize = 0;
111651
- this.#sizes = sizes;
111652
- this.#removeItemSize = (index3) => {
111653
- this.#calculatedSize -= sizes[index3];
111654
- sizes[index3] = 0;
111655
- };
111656
- this.#requireSize = (k, v, size, sizeCalculation) => {
111657
- if (this.#isBackgroundFetch(v)) {
111459
+ let r = t[o], f = e[o];
111460
+ if (!r || !f)
111461
+ return 1 / 0;
111462
+ let m = (s || h()) - f;
111463
+ return r - m;
111464
+ }, this.#p = (n) => {
111465
+ let o = e[n], r = t[n];
111466
+ return !!r && !!o && (s || h()) - o > r;
111467
+ };
111468
+ }
111469
+ #R = () => {};
111470
+ #z = () => {};
111471
+ #N = () => {};
111472
+ #p = () => false;
111473
+ #B() {
111474
+ let t = new z4(this.#o);
111475
+ this.#_ = 0, this.#y = t, this.#W = (e) => {
111476
+ this.#_ -= t[e], t[e] = 0;
111477
+ }, this.#P = (e, i2, s, h) => {
111478
+ if (this.#e(i2))
111658
111479
  return 0;
111659
- }
111660
- if (!isPosInt(size)) {
111661
- if (sizeCalculation) {
111662
- if (typeof sizeCalculation !== "function") {
111480
+ if (!y(s))
111481
+ if (h) {
111482
+ if (typeof h != "function")
111663
111483
  throw new TypeError("sizeCalculation must be a function");
111664
- }
111665
- size = sizeCalculation(v, k);
111666
- if (!isPosInt(size)) {
111484
+ if (s = h(i2, e), !y(s))
111667
111485
  throw new TypeError("sizeCalculation return invalid (expect positive integer)");
111668
- }
111669
- } else {
111670
- throw new TypeError("invalid size value (must be positive integer). " + "When maxSize or maxEntrySize is used, sizeCalculation " + "or size must be set.");
111671
- }
111672
- }
111673
- return size;
111674
- };
111675
- this.#addItemSize = (index3, size, status) => {
111676
- sizes[index3] = size;
111677
- if (this.#maxSize) {
111678
- const maxSize = this.#maxSize - sizes[index3];
111679
- while (this.#calculatedSize > maxSize) {
111680
- this.#evict(true);
111681
- }
111682
- }
111683
- this.#calculatedSize += sizes[index3];
111684
- if (status) {
111685
- status.entrySize = size;
111686
- status.totalCalculatedSize = this.#calculatedSize;
111486
+ } else
111487
+ throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
111488
+ return s;
111489
+ }, this.#U = (e, i2, s) => {
111490
+ if (t[e] = i2, this.#c) {
111491
+ let h = this.#c - t[e];
111492
+ for (;this.#_ > h; )
111493
+ this.#M(true);
111687
111494
  }
111495
+ this.#_ += t[e], s && (s.entrySize = i2, s.totalCalculatedSize = this.#_);
111688
111496
  };
111689
111497
  }
111690
- #removeItemSize = (_i) => {};
111691
- #addItemSize = (_i, _s, _st) => {};
111692
- #requireSize = (_k, _v, size, sizeCalculation) => {
111693
- if (size || sizeCalculation) {
111498
+ #W = (t) => {};
111499
+ #U = (t, e, i2) => {};
111500
+ #P = (t, e, i2, s) => {
111501
+ if (i2 || s)
111694
111502
  throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
111695
- }
111696
111503
  return 0;
111697
111504
  };
111698
- *#indexes({ allowStale = this.allowStale } = {}) {
111699
- if (this.#size) {
111700
- for (let i2 = this.#tail;; ) {
111701
- if (!this.#isValidIndex(i2)) {
111702
- break;
111703
- }
111704
- if (allowStale || !this.#isStale(i2)) {
111705
- yield i2;
111706
- }
111707
- if (i2 === this.#head) {
111708
- break;
111709
- } else {
111710
- i2 = this.#prev[i2];
111711
- }
111712
- }
111713
- }
111505
+ *#F({ allowStale: t = this.allowStale } = {}) {
111506
+ if (this.#n)
111507
+ for (let e = this.#h;!(!this.#H(e) || ((t || !this.#p(e)) && (yield e), e === this.#l)); )
111508
+ e = this.#u[e];
111714
111509
  }
111715
- *#rindexes({ allowStale = this.allowStale } = {}) {
111716
- if (this.#size) {
111717
- for (let i2 = this.#head;; ) {
111718
- if (!this.#isValidIndex(i2)) {
111719
- break;
111720
- }
111721
- if (allowStale || !this.#isStale(i2)) {
111722
- yield i2;
111723
- }
111724
- if (i2 === this.#tail) {
111725
- break;
111726
- } else {
111727
- i2 = this.#next[i2];
111728
- }
111729
- }
111730
- }
111510
+ *#O({ allowStale: t = this.allowStale } = {}) {
111511
+ if (this.#n)
111512
+ for (let e = this.#l;!(!this.#H(e) || ((t || !this.#p(e)) && (yield e), e === this.#h)); )
111513
+ e = this.#a[e];
111731
111514
  }
111732
- #isValidIndex(index3) {
111733
- return index3 !== undefined && this.#keyMap.get(this.#keyList[index3]) === index3;
111515
+ #H(t) {
111516
+ return t !== undefined && this.#s.get(this.#i[t]) === t;
111734
111517
  }
111735
111518
  *entries() {
111736
- for (const i2 of this.#indexes()) {
111737
- if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
111738
- yield [this.#keyList[i2], this.#valList[i2]];
111739
- }
111740
- }
111519
+ for (let t of this.#F())
111520
+ this.#t[t] !== undefined && this.#i[t] !== undefined && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
111741
111521
  }
111742
111522
  *rentries() {
111743
- for (const i2 of this.#rindexes()) {
111744
- if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
111745
- yield [this.#keyList[i2], this.#valList[i2]];
111746
- }
111747
- }
111523
+ for (let t of this.#O())
111524
+ this.#t[t] !== undefined && this.#i[t] !== undefined && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
111748
111525
  }
111749
111526
  *keys() {
111750
- for (const i2 of this.#indexes()) {
111751
- const k = this.#keyList[i2];
111752
- if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
111753
- yield k;
111754
- }
111527
+ for (let t of this.#F()) {
111528
+ let e = this.#i[t];
111529
+ e !== undefined && !this.#e(this.#t[t]) && (yield e);
111755
111530
  }
111756
111531
  }
111757
111532
  *rkeys() {
111758
- for (const i2 of this.#rindexes()) {
111759
- const k = this.#keyList[i2];
111760
- if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
111761
- yield k;
111762
- }
111533
+ for (let t of this.#O()) {
111534
+ let e = this.#i[t];
111535
+ e !== undefined && !this.#e(this.#t[t]) && (yield e);
111763
111536
  }
111764
111537
  }
111765
111538
  *values() {
111766
- for (const i2 of this.#indexes()) {
111767
- const v = this.#valList[i2];
111768
- if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
111769
- yield this.#valList[i2];
111770
- }
111771
- }
111539
+ for (let t of this.#F())
111540
+ this.#t[t] !== undefined && !this.#e(this.#t[t]) && (yield this.#t[t]);
111772
111541
  }
111773
111542
  *rvalues() {
111774
- for (const i2 of this.#rindexes()) {
111775
- const v = this.#valList[i2];
111776
- if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
111777
- yield this.#valList[i2];
111778
- }
111779
- }
111543
+ for (let t of this.#O())
111544
+ this.#t[t] !== undefined && !this.#e(this.#t[t]) && (yield this.#t[t]);
111780
111545
  }
111781
111546
  [Symbol.iterator]() {
111782
111547
  return this.entries();
111783
111548
  }
111784
111549
  [Symbol.toStringTag] = "LRUCache";
111785
- find(fn, getOptions = {}) {
111786
- for (const i2 of this.#indexes()) {
111787
- const v = this.#valList[i2];
111788
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
111789
- if (value === undefined)
111790
- continue;
111791
- if (fn(value, this.#keyList[i2], this)) {
111792
- return this.get(this.#keyList[i2], getOptions);
111793
- }
111550
+ find(t, e = {}) {
111551
+ for (let i2 of this.#F()) {
111552
+ let s = this.#t[i2], h = this.#e(s) ? s.__staleWhileFetching : s;
111553
+ if (h !== undefined && t(h, this.#i[i2], this))
111554
+ return this.get(this.#i[i2], e);
111794
111555
  }
111795
111556
  }
111796
- forEach(fn, thisp = this) {
111797
- for (const i2 of this.#indexes()) {
111798
- const v = this.#valList[i2];
111799
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
111800
- if (value === undefined)
111801
- continue;
111802
- fn.call(thisp, value, this.#keyList[i2], this);
111557
+ forEach(t, e = this) {
111558
+ for (let i2 of this.#F()) {
111559
+ let s = this.#t[i2], h = this.#e(s) ? s.__staleWhileFetching : s;
111560
+ h !== undefined && t.call(e, h, this.#i[i2], this);
111803
111561
  }
111804
111562
  }
111805
- rforEach(fn, thisp = this) {
111806
- for (const i2 of this.#rindexes()) {
111807
- const v = this.#valList[i2];
111808
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
111809
- if (value === undefined)
111810
- continue;
111811
- fn.call(thisp, value, this.#keyList[i2], this);
111563
+ rforEach(t, e = this) {
111564
+ for (let i2 of this.#O()) {
111565
+ let s = this.#t[i2], h = this.#e(s) ? s.__staleWhileFetching : s;
111566
+ h !== undefined && t.call(e, h, this.#i[i2], this);
111812
111567
  }
111813
111568
  }
111814
111569
  purgeStale() {
111815
- let deleted = false;
111816
- for (const i2 of this.#rindexes({ allowStale: true })) {
111817
- if (this.#isStale(i2)) {
111818
- this.#delete(this.#keyList[i2], "expire");
111819
- deleted = true;
111820
- }
111821
- }
111822
- return deleted;
111823
- }
111824
- info(key) {
111825
- const i2 = this.#keyMap.get(key);
111826
- if (i2 === undefined)
111570
+ let t = false;
111571
+ for (let e of this.#O({ allowStale: true }))
111572
+ this.#p(e) && (this.#E(this.#i[e], "expire"), t = true);
111573
+ return t;
111574
+ }
111575
+ info(t) {
111576
+ let e = this.#s.get(t);
111577
+ if (e === undefined)
111827
111578
  return;
111828
- const v = this.#valList[i2];
111829
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
111830
- if (value === undefined)
111579
+ let i2 = this.#t[e], s = this.#e(i2) ? i2.__staleWhileFetching : i2;
111580
+ if (s === undefined)
111831
111581
  return;
111832
- const entry2 = { value };
111833
- if (this.#ttls && this.#starts) {
111834
- const ttl = this.#ttls[i2];
111835
- const start4 = this.#starts[i2];
111836
- if (ttl && start4) {
111837
- const remain = ttl - (this.#perf.now() - start4);
111838
- entry2.ttl = remain;
111839
- entry2.start = Date.now();
111582
+ let h = { value: s };
111583
+ if (this.#d && this.#A) {
111584
+ let n = this.#d[e], o = this.#A[e];
111585
+ if (n && o) {
111586
+ let r = n - (this.#m.now() - o);
111587
+ h.ttl = r, h.start = Date.now();
111840
111588
  }
111841
111589
  }
111842
- if (this.#sizes) {
111843
- entry2.size = this.#sizes[i2];
111844
- }
111845
- return entry2;
111590
+ return this.#y && (h.size = this.#y[e]), h;
111846
111591
  }
111847
111592
  dump() {
111848
- const arr = [];
111849
- for (const i2 of this.#indexes({ allowStale: true })) {
111850
- const key = this.#keyList[i2];
111851
- const v = this.#valList[i2];
111852
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
111853
- if (value === undefined || key === undefined)
111593
+ let t = [];
111594
+ for (let e of this.#F({ allowStale: true })) {
111595
+ let i2 = this.#i[e], s = this.#t[e], h = this.#e(s) ? s.__staleWhileFetching : s;
111596
+ if (h === undefined || i2 === undefined)
111854
111597
  continue;
111855
- const entry2 = { value };
111856
- if (this.#ttls && this.#starts) {
111857
- entry2.ttl = this.#ttls[i2];
111858
- const age = this.#perf.now() - this.#starts[i2];
111859
- entry2.start = Math.floor(Date.now() - age);
111598
+ let n = { value: h };
111599
+ if (this.#d && this.#A) {
111600
+ n.ttl = this.#d[e];
111601
+ let o = this.#m.now() - this.#A[e];
111602
+ n.start = Math.floor(Date.now() - o);
111860
111603
  }
111861
- if (this.#sizes) {
111862
- entry2.size = this.#sizes[i2];
111863
- }
111864
- arr.unshift([key, entry2]);
111604
+ this.#y && (n.size = this.#y[e]), t.unshift([i2, n]);
111865
111605
  }
111866
- return arr;
111606
+ return t;
111867
111607
  }
111868
- load(arr) {
111608
+ load(t) {
111869
111609
  this.clear();
111870
- for (const [key, entry2] of arr) {
111871
- if (entry2.start) {
111872
- const age = Date.now() - entry2.start;
111873
- entry2.start = this.#perf.now() - age;
111874
- }
111875
- this.set(key, entry2.value, entry2);
111876
- }
111877
- }
111878
- set(k, v, setOptions = {}) {
111879
- if (v === undefined) {
111880
- this.delete(k);
111881
- return this;
111882
- }
111883
- const { ttl = this.ttl, start: start4, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
111884
- let { noUpdateTTL = this.noUpdateTTL } = setOptions;
111885
- const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
111886
- if (this.maxEntrySize && size > this.maxEntrySize) {
111887
- if (status) {
111888
- status.set = "miss";
111889
- status.maxEntrySizeExceeded = true;
111890
- }
111891
- this.#delete(k, "set");
111892
- return this;
111893
- }
111894
- let index3 = this.#size === 0 ? undefined : this.#keyMap.get(k);
111895
- if (index3 === undefined) {
111896
- index3 = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
111897
- this.#keyList[index3] = k;
111898
- this.#valList[index3] = v;
111899
- this.#keyMap.set(k, index3);
111900
- this.#next[this.#tail] = index3;
111901
- this.#prev[index3] = this.#tail;
111902
- this.#tail = index3;
111903
- this.#size++;
111904
- this.#addItemSize(index3, size, status);
111905
- if (status)
111906
- status.set = "add";
111907
- noUpdateTTL = false;
111908
- if (this.#hasOnInsert) {
111909
- this.#onInsert?.(v, k, "add");
111910
- }
111911
- } else {
111912
- this.#moveToTail(index3);
111913
- const oldVal = this.#valList[index3];
111914
- if (v !== oldVal) {
111915
- if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
111916
- oldVal.__abortController.abort(new Error("replaced"));
111917
- const { __staleWhileFetching: s } = oldVal;
111918
- if (s !== undefined && !noDisposeOnSet) {
111919
- if (this.#hasDispose) {
111920
- this.#dispose?.(s, k, "set");
111921
- }
111922
- if (this.#hasDisposeAfter) {
111923
- this.#disposed?.push([s, k, "set"]);
111924
- }
111925
- }
111926
- } else if (!noDisposeOnSet) {
111927
- if (this.#hasDispose) {
111928
- this.#dispose?.(oldVal, k, "set");
111929
- }
111930
- if (this.#hasDisposeAfter) {
111931
- this.#disposed?.push([oldVal, k, "set"]);
111932
- }
111933
- }
111934
- this.#removeItemSize(index3);
111935
- this.#addItemSize(index3, size, status);
111936
- this.#valList[index3] = v;
111937
- if (status) {
111938
- status.set = "replace";
111939
- const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
111940
- if (oldValue !== undefined)
111941
- status.oldValue = oldValue;
111610
+ for (let [e, i2] of t) {
111611
+ if (i2.start) {
111612
+ let s = Date.now() - i2.start;
111613
+ i2.start = this.#m.now() - s;
111614
+ }
111615
+ this.set(e, i2.value, i2);
111616
+ }
111617
+ }
111618
+ set(t, e, i2 = {}) {
111619
+ if (e === undefined)
111620
+ return this.delete(t), this;
111621
+ let { ttl: s = this.ttl, start: h, noDisposeOnSet: n = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: r } = i2, { noUpdateTTL: f = this.noUpdateTTL } = i2, m = this.#P(t, e, i2.size || 0, o);
111622
+ if (this.maxEntrySize && m > this.maxEntrySize)
111623
+ return r && (r.set = "miss", r.maxEntrySizeExceeded = true), this.#E(t, "set"), this;
111624
+ let c = this.#n === 0 ? undefined : this.#s.get(t);
111625
+ if (c === undefined)
111626
+ c = this.#n === 0 ? this.#h : this.#b.length !== 0 ? this.#b.pop() : this.#n === this.#o ? this.#M(false) : this.#n, this.#i[c] = t, this.#t[c] = e, this.#s.set(t, c), this.#a[this.#h] = c, this.#u[c] = this.#h, this.#h = c, this.#n++, this.#U(c, m, r), r && (r.set = "add"), f = false, this.#x && this.#C?.(e, t, "add");
111627
+ else {
111628
+ this.#D(c);
111629
+ let d = this.#t[c];
111630
+ if (e !== d) {
111631
+ if (this.#v && this.#e(d)) {
111632
+ d.__abortController.abort(new Error("replaced"));
111633
+ let { __staleWhileFetching: g } = d;
111634
+ g !== undefined && !n && (this.#T && this.#w?.(g, t, "set"), this.#f && this.#r?.push([g, t, "set"]));
111635
+ } else
111636
+ n || (this.#T && this.#w?.(d, t, "set"), this.#f && this.#r?.push([d, t, "set"]));
111637
+ if (this.#W(c), this.#U(c, m, r), this.#t[c] = e, r) {
111638
+ r.set = "replace";
111639
+ let g = d && this.#e(d) ? d.__staleWhileFetching : d;
111640
+ g !== undefined && (r.oldValue = g);
111942
111641
  }
111943
- } else if (status) {
111944
- status.set = "update";
111945
- }
111946
- if (this.#hasOnInsert) {
111947
- this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
111948
- }
111949
- }
111950
- if (ttl !== 0 && !this.#ttls) {
111951
- this.#initializeTTLTracking();
111952
- }
111953
- if (this.#ttls) {
111954
- if (!noUpdateTTL) {
111955
- this.#setItemTTL(index3, ttl, start4);
111956
- }
111957
- if (status)
111958
- this.#statusTTL(status, index3);
111642
+ } else
111643
+ r && (r.set = "update");
111644
+ this.#x && this.onInsert?.(e, t, e === d ? "update" : "replace");
111959
111645
  }
111960
- if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
111961
- const dt = this.#disposed;
111962
- let task;
111963
- while (task = dt?.shift()) {
111964
- this.#disposeAfter?.(...task);
111965
- }
111646
+ if (s !== 0 && !this.#d && this.#j(), this.#d && (f || this.#N(c, s, h), r && this.#z(r, c)), !n && this.#f && this.#r) {
111647
+ let d = this.#r, g;
111648
+ for (;g = d?.shift(); )
111649
+ this.#S?.(...g);
111966
111650
  }
111967
111651
  return this;
111968
111652
  }
111969
111653
  pop() {
111970
111654
  try {
111971
- while (this.#size) {
111972
- const val = this.#valList[this.#head];
111973
- this.#evict(true);
111974
- if (this.#isBackgroundFetch(val)) {
111975
- if (val.__staleWhileFetching) {
111976
- return val.__staleWhileFetching;
111977
- }
111978
- } else if (val !== undefined) {
111979
- return val;
111980
- }
111655
+ for (;this.#n; ) {
111656
+ let t = this.#t[this.#l];
111657
+ if (this.#M(true), this.#e(t)) {
111658
+ if (t.__staleWhileFetching)
111659
+ return t.__staleWhileFetching;
111660
+ } else if (t !== undefined)
111661
+ return t;
111981
111662
  }
111982
111663
  } finally {
111983
- if (this.#hasDisposeAfter && this.#disposed) {
111984
- const dt = this.#disposed;
111985
- let task;
111986
- while (task = dt?.shift()) {
111987
- this.#disposeAfter?.(...task);
111988
- }
111664
+ if (this.#f && this.#r) {
111665
+ let t = this.#r, e;
111666
+ for (;e = t?.shift(); )
111667
+ this.#S?.(...e);
111989
111668
  }
111990
111669
  }
111991
111670
  }
111992
- #evict(free) {
111993
- const head = this.#head;
111994
- const k = this.#keyList[head];
111995
- const v = this.#valList[head];
111996
- if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
111997
- v.__abortController.abort(new Error("evicted"));
111998
- } else if (this.#hasDispose || this.#hasDisposeAfter) {
111999
- if (this.#hasDispose) {
112000
- this.#dispose?.(v, k, "evict");
112001
- }
112002
- if (this.#hasDisposeAfter) {
112003
- this.#disposed?.push([v, k, "evict"]);
112004
- }
112005
- }
112006
- this.#removeItemSize(head);
112007
- if (this.#autopurgeTimers?.[head]) {
112008
- clearTimeout(this.#autopurgeTimers[head]);
112009
- this.#autopurgeTimers[head] = undefined;
112010
- }
112011
- if (free) {
112012
- this.#keyList[head] = undefined;
112013
- this.#valList[head] = undefined;
112014
- this.#free.push(head);
112015
- }
112016
- if (this.#size === 1) {
112017
- this.#head = this.#tail = 0;
112018
- this.#free.length = 0;
112019
- } else {
112020
- this.#head = this.#next[head];
112021
- }
112022
- this.#keyMap.delete(k);
112023
- this.#size--;
112024
- return head;
112025
- }
112026
- has(k, hasOptions = {}) {
112027
- const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
112028
- const index3 = this.#keyMap.get(k);
112029
- if (index3 !== undefined) {
112030
- const v = this.#valList[index3];
112031
- if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === undefined) {
111671
+ #M(t) {
111672
+ let e = this.#l, i2 = this.#i[e], s = this.#t[e];
111673
+ return this.#v && this.#e(s) ? s.__abortController.abort(new Error("evicted")) : (this.#T || this.#f) && (this.#T && this.#w?.(s, i2, "evict"), this.#f && this.#r?.push([s, i2, "evict"])), this.#W(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = undefined), t && (this.#i[e] = undefined, this.#t[e] = undefined, this.#b.push(e)), this.#n === 1 ? (this.#l = this.#h = 0, this.#b.length = 0) : this.#l = this.#a[e], this.#s.delete(i2), this.#n--, e;
111674
+ }
111675
+ has(t, e = {}) {
111676
+ let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = e, h = this.#s.get(t);
111677
+ if (h !== undefined) {
111678
+ let n = this.#t[h];
111679
+ if (this.#e(n) && n.__staleWhileFetching === undefined)
112032
111680
  return false;
112033
- }
112034
- if (!this.#isStale(index3)) {
112035
- if (updateAgeOnHas) {
112036
- this.#updateItemAge(index3);
112037
- }
112038
- if (status) {
112039
- status.has = "hit";
112040
- this.#statusTTL(status, index3);
112041
- }
112042
- return true;
112043
- } else if (status) {
112044
- status.has = "stale";
112045
- this.#statusTTL(status, index3);
112046
- }
112047
- } else if (status) {
112048
- status.has = "miss";
112049
- }
111681
+ if (this.#p(h))
111682
+ s && (s.has = "stale", this.#z(s, h));
111683
+ else
111684
+ return i2 && this.#R(h), s && (s.has = "hit", this.#z(s, h)), true;
111685
+ } else
111686
+ s && (s.has = "miss");
112050
111687
  return false;
112051
111688
  }
112052
- peek(k, peekOptions = {}) {
112053
- const { allowStale = this.allowStale } = peekOptions;
112054
- const index3 = this.#keyMap.get(k);
112055
- if (index3 === undefined || !allowStale && this.#isStale(index3)) {
111689
+ peek(t, e = {}) {
111690
+ let { allowStale: i2 = this.allowStale } = e, s = this.#s.get(t);
111691
+ if (s === undefined || !i2 && this.#p(s))
112056
111692
  return;
112057
- }
112058
- const v = this.#valList[index3];
112059
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
112060
- }
112061
- #backgroundFetch(k, index3, options, context) {
112062
- const v = index3 === undefined ? undefined : this.#valList[index3];
112063
- if (this.#isBackgroundFetch(v)) {
112064
- return v;
112065
- }
112066
- const ac = new AC;
112067
- const { signal } = options;
112068
- signal?.addEventListener("abort", () => ac.abort(signal.reason), {
112069
- signal: ac.signal
112070
- });
112071
- const fetchOpts = {
112072
- signal: ac.signal,
112073
- options,
112074
- context
112075
- };
112076
- const cb = (v2, updateCache = false) => {
112077
- const { aborted: aborted5 } = ac.signal;
112078
- const ignoreAbort = options.ignoreFetchAbort && v2 !== undefined;
112079
- const proceed = options.ignoreFetchAbort || !!(options.allowStaleOnFetchAbort && v2 !== undefined);
112080
- if (options.status) {
112081
- if (aborted5 && !updateCache) {
112082
- options.status.fetchAborted = true;
112083
- options.status.fetchError = ac.signal.reason;
112084
- if (ignoreAbort)
112085
- options.status.fetchAbortIgnored = true;
112086
- } else {
112087
- options.status.fetchResolved = true;
112088
- }
112089
- }
112090
- if (aborted5 && !ignoreAbort && !updateCache) {
112091
- return fetchFail(ac.signal.reason, proceed);
112092
- }
112093
- const bf2 = p;
112094
- const vl = this.#valList[index3];
112095
- if (vl === p || ignoreAbort && updateCache && vl === undefined) {
112096
- if (v2 === undefined) {
112097
- if (bf2.__staleWhileFetching !== undefined) {
112098
- this.#valList[index3] = bf2.__staleWhileFetching;
112099
- } else {
112100
- this.#delete(k, "fetch");
112101
- }
112102
- } else {
112103
- if (options.status)
112104
- options.status.fetchUpdated = true;
112105
- this.set(k, v2, fetchOpts.options);
112106
- }
112107
- }
112108
- return v2;
112109
- };
112110
- const eb = (er) => {
112111
- if (options.status) {
112112
- options.status.fetchRejected = true;
112113
- options.status.fetchError = er;
112114
- }
112115
- return fetchFail(er, false);
112116
- };
112117
- const fetchFail = (er, proceed) => {
112118
- const { aborted: aborted5 } = ac.signal;
112119
- const allowStaleAborted = aborted5 && options.allowStaleOnFetchAbort;
112120
- const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
112121
- const noDelete = allowStale || options.noDeleteOnFetchRejection;
112122
- const bf2 = p;
112123
- if (this.#valList[index3] === p) {
112124
- const del = !noDelete || !proceed && bf2.__staleWhileFetching === undefined;
112125
- if (del) {
112126
- this.#delete(k, "fetch");
112127
- } else if (!allowStaleAborted) {
112128
- this.#valList[index3] = bf2.__staleWhileFetching;
112129
- }
112130
- }
112131
- if (allowStale) {
112132
- if (options.status && bf2.__staleWhileFetching !== undefined) {
112133
- options.status.returnedStale = true;
112134
- }
112135
- return bf2.__staleWhileFetching;
112136
- } else if (bf2.__returned === bf2) {
112137
- throw er;
112138
- }
112139
- };
112140
- const pcall = (res, rej) => {
112141
- const fmp = this.#fetchMethod?.(k, v, fetchOpts);
112142
- if (fmp && fmp instanceof Promise) {
112143
- fmp.then((v2) => res(v2 === undefined ? undefined : v2), rej);
112144
- }
112145
- ac.signal.addEventListener("abort", () => {
112146
- if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
112147
- res(undefined);
112148
- if (options.allowStaleOnFetchAbort) {
112149
- res = (v2) => cb(v2, true);
112150
- }
112151
- }
111693
+ let h = this.#t[s];
111694
+ return this.#e(h) ? h.__staleWhileFetching : h;
111695
+ }
111696
+ #G(t, e, i2, s) {
111697
+ let h = e === undefined ? undefined : this.#t[e];
111698
+ if (this.#e(h))
111699
+ return h;
111700
+ let n = new C, { signal: o } = i2;
111701
+ o?.addEventListener("abort", () => n.abort(o.reason), { signal: n.signal });
111702
+ let r = { signal: n.signal, options: i2, context: s }, f = (p, _ = false) => {
111703
+ let { aborted: l } = n.signal, w = i2.ignoreFetchAbort && p !== undefined, b = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && p !== undefined);
111704
+ if (i2.status && (l && !_ ? (i2.status.fetchAborted = true, i2.status.fetchError = n.signal.reason, w && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), l && !w && !_)
111705
+ return c(n.signal.reason, b);
111706
+ let S = g, u = this.#t[e];
111707
+ return (u === g || w && _ && u === undefined) && (p === undefined ? S.__staleWhileFetching !== undefined ? this.#t[e] = S.__staleWhileFetching : this.#E(t, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.set(t, p, r.options))), p;
111708
+ }, m = (p) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = p), c(p, false)), c = (p, _) => {
111709
+ let { aborted: l } = n.signal, w = l && i2.allowStaleOnFetchAbort, b = w || i2.allowStaleOnFetchRejection, S = b || i2.noDeleteOnFetchRejection, u = g;
111710
+ if (this.#t[e] === g && (!S || !_ && u.__staleWhileFetching === undefined ? this.#E(t, "fetch") : w || (this.#t[e] = u.__staleWhileFetching)), b)
111711
+ return i2.status && u.__staleWhileFetching !== undefined && (i2.status.returnedStale = true), u.__staleWhileFetching;
111712
+ if (u.__returned === u)
111713
+ throw p;
111714
+ }, d = (p, _) => {
111715
+ let l = this.#L?.(t, h, r);
111716
+ l && l instanceof Promise && l.then((w) => p(w === undefined ? undefined : w), _), n.signal.addEventListener("abort", () => {
111717
+ (!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (p(undefined), i2.allowStaleOnFetchAbort && (p = (w) => f(w, true)));
112152
111718
  });
112153
111719
  };
112154
- if (options.status)
112155
- options.status.fetchDispatched = true;
112156
- const p = new Promise(pcall).then(cb, eb);
112157
- const bf = Object.assign(p, {
112158
- __abortController: ac,
112159
- __staleWhileFetching: v,
112160
- __returned: undefined
112161
- });
112162
- if (index3 === undefined) {
112163
- this.set(k, bf, { ...fetchOpts.options, status: undefined });
112164
- index3 = this.#keyMap.get(k);
112165
- } else {
112166
- this.#valList[index3] = bf;
112167
- }
112168
- return bf;
111720
+ i2.status && (i2.status.fetchDispatched = true);
111721
+ let g = new Promise(d).then(f, m), A = Object.assign(g, { __abortController: n, __staleWhileFetching: h, __returned: undefined });
111722
+ return e === undefined ? (this.set(t, A, { ...r.options, status: undefined }), e = this.#s.get(t)) : this.#t[e] = A, A;
112169
111723
  }
112170
- #isBackgroundFetch(p) {
112171
- if (!this.#hasFetchMethod)
111724
+ #e(t) {
111725
+ if (!this.#v)
112172
111726
  return false;
112173
- const b = p;
112174
- return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
112175
- }
112176
- async fetch(k, fetchOptions = {}) {
112177
- const {
112178
- allowStale = this.allowStale,
112179
- updateAgeOnGet = this.updateAgeOnGet,
112180
- noDeleteOnStaleGet = this.noDeleteOnStaleGet,
112181
- ttl = this.ttl,
112182
- noDisposeOnSet = this.noDisposeOnSet,
112183
- size = 0,
112184
- sizeCalculation = this.sizeCalculation,
112185
- noUpdateTTL = this.noUpdateTTL,
112186
- noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
112187
- allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
112188
- ignoreFetchAbort = this.ignoreFetchAbort,
112189
- allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
112190
- context,
112191
- forceRefresh = false,
112192
- status,
112193
- signal
112194
- } = fetchOptions;
112195
- if (!this.#hasFetchMethod) {
112196
- if (status)
112197
- status.fetch = "get";
112198
- return this.get(k, {
112199
- allowStale,
112200
- updateAgeOnGet,
112201
- noDeleteOnStaleGet,
112202
- status
112203
- });
112204
- }
112205
- const options = {
112206
- allowStale,
112207
- updateAgeOnGet,
112208
- noDeleteOnStaleGet,
112209
- ttl,
112210
- noDisposeOnSet,
112211
- size,
112212
- sizeCalculation,
112213
- noUpdateTTL,
112214
- noDeleteOnFetchRejection,
112215
- allowStaleOnFetchRejection,
112216
- allowStaleOnFetchAbort,
112217
- ignoreFetchAbort,
112218
- status,
112219
- signal
112220
- };
112221
- let index3 = this.#keyMap.get(k);
112222
- if (index3 === undefined) {
112223
- if (status)
112224
- status.fetch = "miss";
112225
- const p = this.#backgroundFetch(k, index3, options, context);
112226
- return p.__returned = p;
111727
+ let e = t;
111728
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof C;
111729
+ }
111730
+ async fetch(t, e = {}) {
111731
+ let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: h = this.noDeleteOnStaleGet, ttl: n = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: r = 0, sizeCalculation: f = this.sizeCalculation, noUpdateTTL: m = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: g = this.ignoreFetchAbort, allowStaleOnFetchAbort: A = this.allowStaleOnFetchAbort, context: p, forceRefresh: _ = false, status: l, signal: w } = e;
111732
+ if (!this.#v)
111733
+ return l && (l.fetch = "get"), this.get(t, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: h, status: l });
111734
+ let b = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: h, ttl: n, noDisposeOnSet: o, size: r, sizeCalculation: f, noUpdateTTL: m, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: A, ignoreFetchAbort: g, status: l, signal: w }, S = this.#s.get(t);
111735
+ if (S === undefined) {
111736
+ l && (l.fetch = "miss");
111737
+ let u = this.#G(t, S, b, p);
111738
+ return u.__returned = u;
112227
111739
  } else {
112228
- const v = this.#valList[index3];
112229
- if (this.#isBackgroundFetch(v)) {
112230
- const stale = allowStale && v.__staleWhileFetching !== undefined;
112231
- if (status) {
112232
- status.fetch = "inflight";
112233
- if (stale)
112234
- status.returnedStale = true;
112235
- }
112236
- return stale ? v.__staleWhileFetching : v.__returned = v;
112237
- }
112238
- const isStale = this.#isStale(index3);
112239
- if (!forceRefresh && !isStale) {
112240
- if (status)
112241
- status.fetch = "hit";
112242
- this.#moveToTail(index3);
112243
- if (updateAgeOnGet) {
112244
- this.#updateItemAge(index3);
112245
- }
112246
- if (status)
112247
- this.#statusTTL(status, index3);
112248
- return v;
112249
- }
112250
- const p = this.#backgroundFetch(k, index3, options, context);
112251
- const hasStale = p.__staleWhileFetching !== undefined;
112252
- const staleVal = hasStale && allowStale;
112253
- if (status) {
112254
- status.fetch = isStale ? "stale" : "refresh";
112255
- if (staleVal && isStale)
112256
- status.returnedStale = true;
112257
- }
112258
- return staleVal ? p.__staleWhileFetching : p.__returned = p;
112259
- }
112260
- }
112261
- async forceFetch(k, fetchOptions = {}) {
112262
- const v = await this.fetch(k, fetchOptions);
112263
- if (v === undefined)
111740
+ let u = this.#t[S];
111741
+ if (this.#e(u)) {
111742
+ let E2 = i2 && u.__staleWhileFetching !== undefined;
111743
+ return l && (l.fetch = "inflight", E2 && (l.returnedStale = true)), E2 ? u.__staleWhileFetching : u.__returned = u;
111744
+ }
111745
+ let T = this.#p(S);
111746
+ if (!_ && !T)
111747
+ return l && (l.fetch = "hit"), this.#D(S), s && this.#R(S), l && this.#z(l, S), u;
111748
+ let F = this.#G(t, S, b, p), O = F.__staleWhileFetching !== undefined && i2;
111749
+ return l && (l.fetch = T ? "stale" : "refresh", O && T && (l.returnedStale = true)), O ? F.__staleWhileFetching : F.__returned = F;
111750
+ }
111751
+ }
111752
+ async forceFetch(t, e = {}) {
111753
+ let i2 = await this.fetch(t, e);
111754
+ if (i2 === undefined)
112264
111755
  throw new Error("fetch() returned undefined");
112265
- return v;
111756
+ return i2;
112266
111757
  }
112267
- memo(k, memoOptions = {}) {
112268
- const memoMethod = this.#memoMethod;
112269
- if (!memoMethod) {
111758
+ memo(t, e = {}) {
111759
+ let i2 = this.#I;
111760
+ if (!i2)
112270
111761
  throw new Error("no memoMethod provided to constructor");
112271
- }
112272
- const { context, forceRefresh, ...options } = memoOptions;
112273
- const v = this.get(k, options);
112274
- if (!forceRefresh && v !== undefined)
112275
- return v;
112276
- const vv = memoMethod(k, v, {
112277
- options,
112278
- context
112279
- });
112280
- this.set(k, vv, options);
112281
- return vv;
112282
- }
112283
- get(k, getOptions = {}) {
112284
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
112285
- const index3 = this.#keyMap.get(k);
112286
- if (index3 !== undefined) {
112287
- const value = this.#valList[index3];
112288
- const fetching = this.#isBackgroundFetch(value);
112289
- if (status)
112290
- this.#statusTTL(status, index3);
112291
- if (this.#isStale(index3)) {
112292
- if (status)
112293
- status.get = "stale";
112294
- if (!fetching) {
112295
- if (!noDeleteOnStaleGet) {
112296
- this.#delete(k, "expire");
112297
- }
112298
- if (status && allowStale)
112299
- status.returnedStale = true;
112300
- return allowStale ? value : undefined;
112301
- } else {
112302
- if (status && allowStale && value.__staleWhileFetching !== undefined) {
112303
- status.returnedStale = true;
112304
- }
112305
- return allowStale ? value.__staleWhileFetching : undefined;
112306
- }
112307
- } else {
112308
- if (status)
112309
- status.get = "hit";
112310
- if (fetching) {
112311
- return value.__staleWhileFetching;
112312
- }
112313
- this.#moveToTail(index3);
112314
- if (updateAgeOnGet) {
112315
- this.#updateItemAge(index3);
112316
- }
112317
- return value;
112318
- }
112319
- } else if (status) {
112320
- status.get = "miss";
112321
- }
111762
+ let { context: s, forceRefresh: h, ...n } = e, o = this.get(t, n);
111763
+ if (!h && o !== undefined)
111764
+ return o;
111765
+ let r = i2(t, o, { options: n, context: s });
111766
+ return this.set(t, r, n), r;
111767
+ }
111768
+ get(t, e = {}) {
111769
+ let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: h = this.noDeleteOnStaleGet, status: n } = e, o = this.#s.get(t);
111770
+ if (o !== undefined) {
111771
+ let r = this.#t[o], f = this.#e(r);
111772
+ return n && this.#z(n, o), this.#p(o) ? (n && (n.get = "stale"), f ? (n && i2 && r.__staleWhileFetching !== undefined && (n.returnedStale = true), i2 ? r.__staleWhileFetching : undefined) : (h || this.#E(t, "expire"), n && i2 && (n.returnedStale = true), i2 ? r : undefined)) : (n && (n.get = "hit"), f ? r.__staleWhileFetching : (this.#D(o), s && this.#R(o), r));
111773
+ } else
111774
+ n && (n.get = "miss");
112322
111775
  }
112323
- #connect(p, n) {
112324
- this.#prev[n] = p;
112325
- this.#next[p] = n;
111776
+ #k(t, e) {
111777
+ this.#u[e] = t, this.#a[t] = e;
112326
111778
  }
112327
- #moveToTail(index3) {
112328
- if (index3 !== this.#tail) {
112329
- if (index3 === this.#head) {
112330
- this.#head = this.#next[index3];
112331
- } else {
112332
- this.#connect(this.#prev[index3], this.#next[index3]);
112333
- }
112334
- this.#connect(this.#tail, index3);
112335
- this.#tail = index3;
112336
- }
111779
+ #D(t) {
111780
+ t !== this.#h && (t === this.#l ? this.#l = this.#a[t] : this.#k(this.#u[t], this.#a[t]), this.#k(this.#h, t), this.#h = t);
112337
111781
  }
112338
- delete(k) {
112339
- return this.#delete(k, "delete");
111782
+ delete(t) {
111783
+ return this.#E(t, "delete");
112340
111784
  }
112341
- #delete(k, reason) {
112342
- let deleted = false;
112343
- if (this.#size !== 0) {
112344
- const index3 = this.#keyMap.get(k);
112345
- if (index3 !== undefined) {
112346
- if (this.#autopurgeTimers?.[index3]) {
112347
- clearTimeout(this.#autopurgeTimers?.[index3]);
112348
- this.#autopurgeTimers[index3] = undefined;
112349
- }
112350
- deleted = true;
112351
- if (this.#size === 1) {
112352
- this.#clear(reason);
112353
- } else {
112354
- this.#removeItemSize(index3);
112355
- const v = this.#valList[index3];
112356
- if (this.#isBackgroundFetch(v)) {
112357
- v.__abortController.abort(new Error("deleted"));
112358
- } else if (this.#hasDispose || this.#hasDisposeAfter) {
112359
- if (this.#hasDispose) {
112360
- this.#dispose?.(v, k, reason);
112361
- }
112362
- if (this.#hasDisposeAfter) {
112363
- this.#disposed?.push([v, k, reason]);
112364
- }
112365
- }
112366
- this.#keyMap.delete(k);
112367
- this.#keyList[index3] = undefined;
112368
- this.#valList[index3] = undefined;
112369
- if (index3 === this.#tail) {
112370
- this.#tail = this.#prev[index3];
112371
- } else if (index3 === this.#head) {
112372
- this.#head = this.#next[index3];
112373
- } else {
112374
- const pi = this.#prev[index3];
112375
- this.#next[pi] = this.#next[index3];
112376
- const ni = this.#next[index3];
112377
- this.#prev[ni] = this.#prev[index3];
111785
+ #E(t, e) {
111786
+ let i2 = false;
111787
+ if (this.#n !== 0) {
111788
+ let s = this.#s.get(t);
111789
+ if (s !== undefined)
111790
+ if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = undefined), i2 = true, this.#n === 1)
111791
+ this.#V(e);
111792
+ else {
111793
+ this.#W(s);
111794
+ let h = this.#t[s];
111795
+ if (this.#e(h) ? h.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#w?.(h, t, e), this.#f && this.#r?.push([h, t, e])), this.#s.delete(t), this.#i[s] = undefined, this.#t[s] = undefined, s === this.#h)
111796
+ this.#h = this.#u[s];
111797
+ else if (s === this.#l)
111798
+ this.#l = this.#a[s];
111799
+ else {
111800
+ let n = this.#u[s];
111801
+ this.#a[n] = this.#a[s];
111802
+ let o = this.#a[s];
111803
+ this.#u[o] = this.#u[s];
112378
111804
  }
112379
- this.#size--;
112380
- this.#free.push(index3);
111805
+ this.#n--, this.#b.push(s);
112381
111806
  }
112382
- }
112383
111807
  }
112384
- if (this.#hasDisposeAfter && this.#disposed?.length) {
112385
- const dt = this.#disposed;
112386
- let task;
112387
- while (task = dt?.shift()) {
112388
- this.#disposeAfter?.(...task);
112389
- }
111808
+ if (this.#f && this.#r?.length) {
111809
+ let s = this.#r, h;
111810
+ for (;h = s?.shift(); )
111811
+ this.#S?.(...h);
112390
111812
  }
112391
- return deleted;
111813
+ return i2;
112392
111814
  }
112393
111815
  clear() {
112394
- return this.#clear("delete");
111816
+ return this.#V("delete");
112395
111817
  }
112396
- #clear(reason) {
112397
- for (const index3 of this.#rindexes({ allowStale: true })) {
112398
- const v = this.#valList[index3];
112399
- if (this.#isBackgroundFetch(v)) {
112400
- v.__abortController.abort(new Error("deleted"));
112401
- } else {
112402
- const k = this.#keyList[index3];
112403
- if (this.#hasDispose) {
112404
- this.#dispose?.(v, k, reason);
112405
- }
112406
- if (this.#hasDisposeAfter) {
112407
- this.#disposed?.push([v, k, reason]);
112408
- }
112409
- }
112410
- }
112411
- this.#keyMap.clear();
112412
- this.#valList.fill(undefined);
112413
- this.#keyList.fill(undefined);
112414
- if (this.#ttls && this.#starts) {
112415
- this.#ttls.fill(0);
112416
- this.#starts.fill(0);
112417
- for (const t of this.#autopurgeTimers ?? []) {
112418
- if (t !== undefined)
112419
- clearTimeout(t);
111818
+ #V(t) {
111819
+ for (let e of this.#O({ allowStale: true })) {
111820
+ let i2 = this.#t[e];
111821
+ if (this.#e(i2))
111822
+ i2.__abortController.abort(new Error("deleted"));
111823
+ else {
111824
+ let s = this.#i[e];
111825
+ this.#T && this.#w?.(i2, s, t), this.#f && this.#r?.push([i2, s, t]);
112420
111826
  }
112421
- this.#autopurgeTimers?.fill(undefined);
112422
111827
  }
112423
- if (this.#sizes) {
112424
- this.#sizes.fill(0);
111828
+ if (this.#s.clear(), this.#t.fill(undefined), this.#i.fill(undefined), this.#d && this.#A) {
111829
+ this.#d.fill(0), this.#A.fill(0);
111830
+ for (let e of this.#g ?? [])
111831
+ e !== undefined && clearTimeout(e);
111832
+ this.#g?.fill(undefined);
112425
111833
  }
112426
- this.#head = 0;
112427
- this.#tail = 0;
112428
- this.#free.length = 0;
112429
- this.#calculatedSize = 0;
112430
- this.#size = 0;
112431
- if (this.#hasDisposeAfter && this.#disposed) {
112432
- const dt = this.#disposed;
112433
- let task;
112434
- while (task = dt?.shift()) {
112435
- this.#disposeAfter?.(...task);
112436
- }
111834
+ if (this.#y && this.#y.fill(0), this.#l = 0, this.#h = 0, this.#b.length = 0, this.#_ = 0, this.#n = 0, this.#f && this.#r) {
111835
+ let e = this.#r, i2;
111836
+ for (;i2 = e?.shift(); )
111837
+ this.#S?.(...i2);
112437
111838
  }
112438
111839
  }
112439
- }
111840
+ };
112440
111841
 
112441
111842
  // src/module/cache/auth.ts
112442
- var authCache = new LRUCache({
111843
+ var authCache = new L({
112443
111844
  max: 1e4,
112444
111845
  ttl: 1000 * 60 * 60 * 24 * 7
112445
111846
  });
@@ -112550,9 +111951,9 @@ import fs17 from "fs";
112550
111951
 
112551
111952
  // ../node_modules/.pnpm/@kevisual+router@0.0.70/node_modules/@kevisual/router/src/server/cookie.ts
112552
111953
  var NullObject2 = /* @__PURE__ */ (() => {
112553
- const C = function() {};
112554
- C.prototype = Object.create(null);
112555
- return C;
111954
+ const C2 = function() {};
111955
+ C2.prototype = Object.create(null);
111956
+ return C2;
112556
111957
  })();
112557
111958
  function parseCookie2(str, options) {
112558
111959
  const obj = new NullObject2;