@vitejs/devtools 0.0.0-alpha.21 → 0.0.0-alpha.22

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.
@@ -1,22 +1,21 @@
1
- import { n as dirDist, t as dirClientStandalone } from "./dirs-C0s1Ghvy.js";
1
+ import { n as __toESM, t as __commonJSMin } from "./chunk-CwIu-FEx.js";
2
+ import { n as dirDist, t as dirClientStandalone } from "./dirs-BJIz1OY5.js";
2
3
  import Debug from "debug";
3
4
  import { debounce } from "perfect-debounce";
4
5
  import { normalizePath, searchForWorkspaceRoot } from "vite";
5
6
  import { toDataURL } from "mlly";
6
7
  import { createEventEmitter } from "@vitejs/devtools-kit/utils/events";
7
8
  import { RpcFunctionsCollectorBase } from "birpc-x";
9
+ import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
8
10
  import process$1, { stdin, stdout } from "node:process";
9
11
  import fs, { existsSync } from "node:fs";
10
12
  import sirv from "sirv";
11
13
  import { stripVTControlCharacters } from "node:util";
12
- import { cursor, erase } from "sisteransi";
13
14
  import * as g from "node:readline";
14
15
  import O from "node:readline";
15
16
  import { Writable } from "node:stream";
16
- import e from "picocolors";
17
17
  import { defineRpcFunction } from "@vitejs/devtools-kit";
18
18
  import { dirname, join } from "pathe";
19
- import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
20
19
  import { join as join$1 } from "node:path";
21
20
  import { AsyncLocalStorage } from "node:async_hooks";
22
21
  import { createRpcServer } from "@vitejs/devtools-rpc";
@@ -25,34 +24,6 @@ import { createServer } from "node:net";
25
24
  import { networkInterfaces } from "node:os";
26
25
  import "node:fs/promises";
27
26
 
28
- //#region rolldown:runtime
29
- var __create = Object.create;
30
- var __defProp = Object.defineProperty;
31
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
32
- var __getOwnPropNames = Object.getOwnPropertyNames;
33
- var __getProtoOf = Object.getPrototypeOf;
34
- var __hasOwnProp = Object.prototype.hasOwnProperty;
35
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36
- var __copyProps = (to, from, except, desc) => {
37
- if (from && typeof from === "object" || typeof from === "function") {
38
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
39
- key = keys[i];
40
- if (!__hasOwnProp.call(to, key) && key !== except) {
41
- __defProp(to, key, {
42
- get: ((k$2) => from[k$2]).bind(null, key),
43
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
- });
45
- }
46
- }
47
- }
48
- return to;
49
- };
50
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
51
- value: mod,
52
- enumerable: true
53
- }) : target, mod));
54
-
55
- //#endregion
56
27
  //#region src/node/context-utils.ts
57
28
  const ContextUtils = { createSimpleClientScript(fn) {
58
29
  return {
@@ -88,6 +59,43 @@ var DevToolsDockHost = class {
88
59
  }
89
60
  };
90
61
 
62
+ //#endregion
63
+ //#region src/node/rpc-shared-state.ts
64
+ function createRpcSharedStateServerHost(rpc) {
65
+ const sharedState = /* @__PURE__ */ new Map();
66
+ function registerSharedState(key, state) {
67
+ const offs = [];
68
+ offs.push(state.on("updated", (_fullState, patches, syncId) => {
69
+ if (patches) rpc.broadcast({
70
+ method: "vite:internal:rpc:client-state:patch",
71
+ args: [
72
+ key,
73
+ patches,
74
+ syncId
75
+ ]
76
+ });
77
+ else rpc.broadcast({
78
+ method: "vite:internal:rpc:client-state:updated",
79
+ args: [key, syncId]
80
+ });
81
+ }));
82
+ return () => {
83
+ for (const off of offs) off();
84
+ };
85
+ }
86
+ return { get: async (key, options) => {
87
+ if (sharedState.has(key)) return sharedState.get(key);
88
+ if (options?.initialValue === void 0) throw new Error(`Shared state of "${key}" is not found, please provide an initial value for the first time`);
89
+ const state = createSharedState({
90
+ initialState: options.initialValue,
91
+ enablePatches: false
92
+ });
93
+ registerSharedState(key, state);
94
+ sharedState.set(key, state);
95
+ return state;
96
+ } };
97
+ }
98
+
91
99
  //#endregion
92
100
  //#region src/node/host-functions.ts
93
101
  var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
@@ -98,10 +106,19 @@ var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
98
106
  _asyncStorage = void 0;
99
107
  constructor(context) {
100
108
  super(context);
109
+ this.sharedState = createRpcSharedStateServerHost(this);
101
110
  }
102
- broadcast(name, ...args) {
111
+ sharedState;
112
+ async broadcast(options) {
103
113
  if (!this._rpcGroup) throw new Error("RpcFunctionsHost] RpcGroup is not set, it likely to be an internal bug of Vite DevTools");
104
- return this._rpcGroup.broadcast.$callOptional(name, ...args);
114
+ await Promise.all(this._rpcGroup.clients.map((client) => {
115
+ if (options.filter?.(client) === false) return void 0;
116
+ return client.$callRaw({
117
+ optional: true,
118
+ event: true,
119
+ ...options
120
+ });
121
+ }));
105
122
  }
106
123
  getCurrentRpcSession() {
107
124
  if (!this._asyncStorage) throw new Error("RpcFunctionsHost] AsyncLocalStorage is not set, it likely to be an internal bug of Vite DevTools");
@@ -233,8 +250,136 @@ var DevToolsViewHost = class {
233
250
  }
234
251
  };
235
252
 
253
+ //#endregion
254
+ //#region ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
255
+ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
256
+ const ESC = "\x1B";
257
+ const CSI = `${ESC}[`;
258
+ const beep = "\x07";
259
+ const cursor = {
260
+ to(x$2, y$1) {
261
+ if (!y$1) return `${CSI}${x$2 + 1}G`;
262
+ return `${CSI}${y$1 + 1};${x$2 + 1}H`;
263
+ },
264
+ move(x$2, y$1) {
265
+ let ret = "";
266
+ if (x$2 < 0) ret += `${CSI}${-x$2}D`;
267
+ else if (x$2 > 0) ret += `${CSI}${x$2}C`;
268
+ if (y$1 < 0) ret += `${CSI}${-y$1}A`;
269
+ else if (y$1 > 0) ret += `${CSI}${y$1}B`;
270
+ return ret;
271
+ },
272
+ up: (count = 1) => `${CSI}${count}A`,
273
+ down: (count = 1) => `${CSI}${count}B`,
274
+ forward: (count = 1) => `${CSI}${count}C`,
275
+ backward: (count = 1) => `${CSI}${count}D`,
276
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
277
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
278
+ left: `${CSI}G`,
279
+ hide: `${CSI}?25l`,
280
+ show: `${CSI}?25h`,
281
+ save: `${ESC}7`,
282
+ restore: `${ESC}8`
283
+ };
284
+ const scroll = {
285
+ up: (count = 1) => `${CSI}S`.repeat(count),
286
+ down: (count = 1) => `${CSI}T`.repeat(count)
287
+ };
288
+ const erase = {
289
+ screen: `${CSI}2J`,
290
+ up: (count = 1) => `${CSI}1J`.repeat(count),
291
+ down: (count = 1) => `${CSI}J`.repeat(count),
292
+ line: `${CSI}2K`,
293
+ lineEnd: `${CSI}K`,
294
+ lineStart: `${CSI}1K`,
295
+ lines(count) {
296
+ let clear = "";
297
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
298
+ if (count) clear += cursor.left;
299
+ return clear;
300
+ }
301
+ };
302
+ module.exports = {
303
+ cursor,
304
+ scroll,
305
+ erase,
306
+ beep
307
+ };
308
+ }));
309
+
310
+ //#endregion
311
+ //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
312
+ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
313
+ let p = process || {}, argv = p.argv || [], env = p.env || {};
314
+ let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
315
+ let formatter = (open, close, replace = open) => (input) => {
316
+ let string = "" + input, index = string.indexOf(close, open.length);
317
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
318
+ };
319
+ let replaceClose = (string, close, replace, index) => {
320
+ let result = "", cursor = 0;
321
+ do {
322
+ result += string.substring(cursor, index) + replace;
323
+ cursor = index + close.length;
324
+ index = string.indexOf(close, cursor);
325
+ } while (~index);
326
+ return result + string.substring(cursor);
327
+ };
328
+ let createColors = (enabled = isColorSupported) => {
329
+ let f = enabled ? formatter : () => String;
330
+ return {
331
+ isColorSupported: enabled,
332
+ reset: f("\x1B[0m", "\x1B[0m"),
333
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
334
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
335
+ italic: f("\x1B[3m", "\x1B[23m"),
336
+ underline: f("\x1B[4m", "\x1B[24m"),
337
+ inverse: f("\x1B[7m", "\x1B[27m"),
338
+ hidden: f("\x1B[8m", "\x1B[28m"),
339
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
340
+ black: f("\x1B[30m", "\x1B[39m"),
341
+ red: f("\x1B[31m", "\x1B[39m"),
342
+ green: f("\x1B[32m", "\x1B[39m"),
343
+ yellow: f("\x1B[33m", "\x1B[39m"),
344
+ blue: f("\x1B[34m", "\x1B[39m"),
345
+ magenta: f("\x1B[35m", "\x1B[39m"),
346
+ cyan: f("\x1B[36m", "\x1B[39m"),
347
+ white: f("\x1B[37m", "\x1B[39m"),
348
+ gray: f("\x1B[90m", "\x1B[39m"),
349
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
350
+ bgRed: f("\x1B[41m", "\x1B[49m"),
351
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
352
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
353
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
354
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
355
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
356
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
357
+ blackBright: f("\x1B[90m", "\x1B[39m"),
358
+ redBright: f("\x1B[91m", "\x1B[39m"),
359
+ greenBright: f("\x1B[92m", "\x1B[39m"),
360
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
361
+ blueBright: f("\x1B[94m", "\x1B[39m"),
362
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
363
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
364
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
365
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
366
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
367
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
368
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
369
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
370
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
371
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
372
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
373
+ };
374
+ };
375
+ module.exports = createColors();
376
+ module.exports.createColors = createColors;
377
+ }));
378
+
236
379
  //#endregion
237
380
  //#region ../../node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
381
+ var import_src = require_src();
382
+ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
238
383
  function DD({ onlyFirst: e$1 = !1 } = {}) {
239
384
  const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
240
385
  return new RegExp(t, e$1 ? void 0 : "g");
@@ -552,7 +697,7 @@ function fD({ input: e$1 = stdin, output: u$1 = stdout, overwrite: t = !0, hideC
552
697
  C$1,
553
698
  n
554
699
  ], "cancel")) {
555
- F$1 && u$1.write(cursor.show), process.exit(0);
700
+ F$1 && u$1.write(import_src.cursor.show), process.exit(0);
556
701
  return;
557
702
  }
558
703
  if (!t) return;
@@ -563,8 +708,8 @@ function fD({ input: e$1 = stdin, output: u$1 = stdout, overwrite: t = !0, hideC
563
708
  });
564
709
  });
565
710
  };
566
- return F$1 && u$1.write(cursor.hide), e$1.once("keypress", i), () => {
567
- e$1.off("keypress", i), F$1 && u$1.write(cursor.show), e$1.isTTY && !AD && e$1.setRawMode(!1), s.terminal = !1, s.close();
711
+ return F$1 && u$1.write(import_src.cursor.hide), e$1.once("keypress", i), () => {
712
+ e$1.off("keypress", i), F$1 && u$1.write(import_src.cursor.show), e$1.isTTY && !AD && e$1.setRawMode(!1), s.terminal = !1, s.close();
568
713
  };
569
714
  }
570
715
  var gD = Object.defineProperty, vD = (e$1, u$1, t) => u$1 in e$1 ? gD(e$1, u$1, {
@@ -619,9 +764,9 @@ var x$1 = class {
619
764
  escapeCodeTimeout: 50,
620
765
  terminal: !0
621
766
  }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
622
- this.output.write(cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(this.value);
767
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(this.value);
623
768
  }), this.once("cancel", () => {
624
- this.output.write(cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(S);
769
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(S);
625
770
  });
626
771
  });
627
772
  }
@@ -646,32 +791,32 @@ var x$1 = class {
646
791
  restoreCursor() {
647
792
  const u$1 = Y$1(this._prevFrame, process.stdout.columns, { hard: !0 }).split(`
648
793
  `).length - 1;
649
- this.output.write(cursor.move(-999, u$1 * -1));
794
+ this.output.write(import_src.cursor.move(-999, u$1 * -1));
650
795
  }
651
796
  render() {
652
797
  const u$1 = Y$1(this._render(this) ?? "", process.stdout.columns, { hard: !0 });
653
798
  if (u$1 !== this._prevFrame) {
654
- if (this.state === "initial") this.output.write(cursor.hide);
799
+ if (this.state === "initial") this.output.write(import_src.cursor.hide);
655
800
  else {
656
801
  const t = BD(this._prevFrame, u$1);
657
802
  if (this.restoreCursor(), t && t?.length === 1) {
658
803
  const F$1 = t[0];
659
- this.output.write(cursor.move(0, F$1)), this.output.write(erase.lines(1));
804
+ this.output.write(import_src.cursor.move(0, F$1)), this.output.write(import_src.erase.lines(1));
660
805
  const s = u$1.split(`
661
806
  `);
662
- this.output.write(s[F$1]), this._prevFrame = u$1, this.output.write(cursor.move(0, s.length - F$1 - 1));
807
+ this.output.write(s[F$1]), this._prevFrame = u$1, this.output.write(import_src.cursor.move(0, s.length - F$1 - 1));
663
808
  return;
664
809
  }
665
810
  if (t && t?.length > 1) {
666
811
  const F$1 = t[0];
667
- this.output.write(cursor.move(0, F$1)), this.output.write(erase.down());
812
+ this.output.write(import_src.cursor.move(0, F$1)), this.output.write(import_src.erase.down());
668
813
  const s = u$1.split(`
669
814
  `).slice(F$1);
670
815
  this.output.write(s.join(`
671
816
  `)), this._prevFrame = u$1;
672
817
  return;
673
818
  }
674
- this.output.write(erase.down());
819
+ this.output.write(import_src.erase.down());
675
820
  }
676
821
  this.output.write(u$1), this.state === "initial" && (this.state = "active"), this._prevFrame = u$1;
677
822
  }
@@ -688,7 +833,7 @@ var dD = class extends x$1 {
688
833
  super(u$1, !1), this.value = !!u$1.initialValue, this.on("value", () => {
689
834
  this.value = this._value;
690
835
  }), this.on("confirm", (t) => {
691
- this.output.write(cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
836
+ this.output.write(import_src.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
692
837
  }), this.on("cursor", () => {
693
838
  this.value = !this.value;
694
839
  });
@@ -800,10 +945,10 @@ var MD = class extends x$1 {
800
945
  super(t), U$1(this, "valueWithCursor", ""), U$1(this, "_mask", "•"), this._mask = u$1 ?? "•", this.on("finalize", () => {
801
946
  this.valueWithCursor = this.masked;
802
947
  }), this.on("value", () => {
803
- if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${e.inverse(e.hidden("_"))}`;
948
+ if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
804
949
  else {
805
950
  const F$1 = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
806
- this.valueWithCursor = `${F$1}${e.inverse(s[0])}${s.slice(1)}`;
951
+ this.valueWithCursor = `${F$1}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
807
952
  }
808
953
  });
809
954
  }
@@ -865,7 +1010,7 @@ var RD = class extends x$1 {
865
1010
  if (this.state === "submit") return this.value;
866
1011
  if (this.cursor >= this.value.length) return `${this.value}\u2588`;
867
1012
  const u$1 = this.value.slice(0, this.cursor), [t, ...F$1] = this.value.slice(this.cursor);
868
- return `${u$1}${e.inverse(t)}${F$1.join("")}`;
1013
+ return `${u$1}${import_picocolors.default.inverse(t)}${F$1.join("")}`;
869
1014
  }
870
1015
  get cursor() {
871
1016
  return this._cursor;
@@ -885,19 +1030,19 @@ function ce() {
885
1030
  const V = ce(), u = (t, n) => V ? t : n, le = u("◆", "*"), L = u("■", "x"), W = u("▲", "x"), C = u("◇", "o"), ue = u("┌", "T"), o = u("│", "|"), d = u("└", "—"), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), $e = u("▪", "•"), _ = u("─", "-"), me = u("╮", "+"), de = u("├", "+"), pe = u("╯", "+"), q = u("●", "•"), D = u("◆", "*"), U = u("▲", "!"), K = u("■", "x"), b = (t) => {
886
1031
  switch (t) {
887
1032
  case "initial":
888
- case "active": return e.cyan(le);
889
- case "cancel": return e.red(L);
890
- case "error": return e.yellow(W);
891
- case "submit": return e.green(C);
1033
+ case "active": return import_picocolors.default.cyan(le);
1034
+ case "cancel": return import_picocolors.default.red(L);
1035
+ case "error": return import_picocolors.default.yellow(W);
1036
+ case "submit": return import_picocolors.default.green(C);
892
1037
  }
893
1038
  }, G = (t) => {
894
1039
  const { cursor: n, options: r$2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a$1 = Math.min(c, Math.max(s, 5));
895
- let l = 0;
896
- n >= l + a$1 - 3 ? l = Math.max(Math.min(n - a$1 + 3, r$2.length - a$1), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
897
- const $$1 = a$1 < r$2.length && l > 0, g$1 = a$1 < r$2.length && l + a$1 < r$2.length;
898
- return r$2.slice(l, l + a$1).map((p$1, v, f) => {
899
- const j = v === 0 && $$1, E = v === f.length - 1 && g$1;
900
- return j || E ? e.dim("...") : i(p$1, v + l === n);
1040
+ let l$1 = 0;
1041
+ n >= l$1 + a$1 - 3 ? l$1 = Math.max(Math.min(n - a$1 + 3, r$2.length - a$1), 0) : n < l$1 + 2 && (l$1 = Math.max(n - 2, 0));
1042
+ const $$1 = a$1 < r$2.length && l$1 > 0, g$1 = a$1 < r$2.length && l$1 + a$1 < r$2.length;
1043
+ return r$2.slice(l$1, l$1 + a$1).map((p$1, v$1, f) => {
1044
+ const j = v$1 === 0 && $$1, E = v$1 === f.length - 1 && g$1;
1045
+ return j || E ? import_picocolors.default.dim("...") : i(p$1, v$1 + l$1 === n);
901
1046
  });
902
1047
  }, he = (t) => new RD({
903
1048
  validate: t.validate,
@@ -905,19 +1050,19 @@ const V = ce(), u = (t, n) => V ? t : n, le = u("◆", "*"), L = u("■", "x"),
905
1050
  defaultValue: t.defaultValue,
906
1051
  initialValue: t.initialValue,
907
1052
  render() {
908
- const n = `${e.gray(o)}
1053
+ const n = `${import_picocolors.default.gray(o)}
909
1054
  ${b(this.state)} ${t.message}
910
- `, r$2 = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), i = this.value ? this.valueWithCursor : r$2;
1055
+ `, r$2 = t.placeholder ? import_picocolors.default.inverse(t.placeholder[0]) + import_picocolors.default.dim(t.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), i = this.value ? this.valueWithCursor : r$2;
911
1056
  switch (this.state) {
912
1057
  case "error": return `${n.trim()}
913
- ${e.yellow(o)} ${i}
914
- ${e.yellow(d)} ${e.yellow(this.error)}
1058
+ ${import_picocolors.default.yellow(o)} ${i}
1059
+ ${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
915
1060
  `;
916
- case "submit": return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`;
917
- case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
918
- ${e.gray(o)}` : ""}`;
919
- default: return `${n}${e.cyan(o)} ${i}
920
- ${e.cyan(d)}
1061
+ case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(this.value || t.placeholder)}`;
1062
+ case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(this.value ?? ""))}${this.value?.trim() ? `
1063
+ ${import_picocolors.default.gray(o)}` : ""}`;
1064
+ default: return `${n}${import_picocolors.default.cyan(o)} ${i}
1065
+ ${import_picocolors.default.cyan(d)}
921
1066
  `;
922
1067
  }
923
1068
  }
@@ -925,19 +1070,19 @@ ${e.cyan(d)}
925
1070
  validate: t.validate,
926
1071
  mask: t.mask ?? $e,
927
1072
  render() {
928
- const n = `${e.gray(o)}
1073
+ const n = `${import_picocolors.default.gray(o)}
929
1074
  ${b(this.state)} ${t.message}
930
1075
  `, r$2 = this.valueWithCursor, i = this.masked;
931
1076
  switch (this.state) {
932
1077
  case "error": return `${n.trim()}
933
- ${e.yellow(o)} ${i}
934
- ${e.yellow(d)} ${e.yellow(this.error)}
1078
+ ${import_picocolors.default.yellow(o)} ${i}
1079
+ ${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
935
1080
  `;
936
- case "submit": return `${n}${e.gray(o)} ${e.dim(i)}`;
937
- case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(i ?? ""))}${i ? `
938
- ${e.gray(o)}` : ""}`;
939
- default: return `${n}${e.cyan(o)} ${r$2}
940
- ${e.cyan(d)}
1081
+ case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(i)}`;
1082
+ case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i ?? ""))}${i ? `
1083
+ ${import_picocolors.default.gray(o)}` : ""}`;
1084
+ default: return `${n}${import_picocolors.default.cyan(o)} ${r$2}
1085
+ ${import_picocolors.default.cyan(d)}
941
1086
  `;
942
1087
  }
943
1088
  }
@@ -948,15 +1093,15 @@ ${e.cyan(d)}
948
1093
  inactive: r$2,
949
1094
  initialValue: t.initialValue ?? !0,
950
1095
  render() {
951
- const i = `${e.gray(o)}
1096
+ const i = `${import_picocolors.default.gray(o)}
952
1097
  ${b(this.state)} ${t.message}
953
1098
  `, s = this.value ? n : r$2;
954
1099
  switch (this.state) {
955
- case "submit": return `${i}${e.gray(o)} ${e.dim(s)}`;
956
- case "cancel": return `${i}${e.gray(o)} ${e.strikethrough(e.dim(s))}
957
- ${e.gray(o)}`;
958
- default: return `${i}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(r$2)}` : `${e.green(k)} ${r$2}`}
959
- ${e.cyan(d)}
1100
+ case "submit": return `${i}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(s)}`;
1101
+ case "cancel": return `${i}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}
1102
+ ${import_picocolors.default.gray(o)}`;
1103
+ default: return `${i}${import_picocolors.default.cyan(o)} ${this.value ? `${import_picocolors.default.green(k)} ${n}` : `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(n)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(r$2)}` : `${import_picocolors.default.green(k)} ${r$2}`}
1104
+ ${import_picocolors.default.cyan(d)}
960
1105
  `;
961
1106
  }
962
1107
  }
@@ -965,31 +1110,31 @@ ${e.cyan(d)}
965
1110
  const n = (r$2, i) => {
966
1111
  const s = r$2.label ?? String(r$2.value);
967
1112
  switch (i) {
968
- case "selected": return `${e.dim(s)}`;
969
- case "active": return `${e.green(k)} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}`;
970
- case "cancelled": return `${e.strikethrough(e.dim(s))}`;
971
- default: return `${e.dim(P)} ${e.dim(s)}`;
1113
+ case "selected": return `${import_picocolors.default.dim(s)}`;
1114
+ case "active": return `${import_picocolors.default.green(k)} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}`;
1115
+ case "cancelled": return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
1116
+ default: return `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(s)}`;
972
1117
  }
973
1118
  };
974
1119
  return new LD({
975
1120
  options: t.options,
976
1121
  initialValue: t.initialValue,
977
1122
  render() {
978
- const r$2 = `${e.gray(o)}
1123
+ const r$2 = `${import_picocolors.default.gray(o)}
979
1124
  ${b(this.state)} ${t.message}
980
1125
  `;
981
1126
  switch (this.state) {
982
- case "submit": return `${r$2}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`;
983
- case "cancel": return `${r$2}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")}
984
- ${e.gray(o)}`;
985
- default: return `${r$2}${e.cyan(o)} ${G({
1127
+ case "submit": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
1128
+ case "cancel": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
1129
+ ${import_picocolors.default.gray(o)}`;
1130
+ default: return `${r$2}${import_picocolors.default.cyan(o)} ${G({
986
1131
  cursor: this.cursor,
987
1132
  options: this.options,
988
1133
  maxItems: t.maxItems,
989
1134
  style: (i, s) => n(i, s ? "active" : "inactive")
990
1135
  }).join(`
991
- ${e.cyan(o)} `)}
992
- ${e.cyan(d)}
1136
+ ${import_picocolors.default.cyan(o)} `)}
1137
+ ${import_picocolors.default.cyan(d)}
993
1138
  `;
994
1139
  }
995
1140
  }
@@ -997,22 +1142,22 @@ ${e.cyan(d)}
997
1142
  }, we = (t) => {
998
1143
  const n = (r$2, i = "inactive") => {
999
1144
  const s = r$2.label ?? String(r$2.value);
1000
- return i === "selected" ? `${e.dim(s)}` : i === "cancelled" ? `${e.strikethrough(e.dim(s))}` : i === "active" ? `${e.bgCyan(e.gray(` ${r$2.value} `))} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : `${e.gray(e.bgWhite(e.inverse(` ${r$2.value} `)))} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}`;
1145
+ return i === "selected" ? `${import_picocolors.default.dim(s)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${r$2.value} `))} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${r$2.value} `)))} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}`;
1001
1146
  };
1002
1147
  return new ID({
1003
1148
  options: t.options,
1004
1149
  initialValue: t.initialValue,
1005
1150
  render() {
1006
- const r$2 = `${e.gray(o)}
1151
+ const r$2 = `${import_picocolors.default.gray(o)}
1007
1152
  ${b(this.state)} ${t.message}
1008
1153
  `;
1009
1154
  switch (this.state) {
1010
- case "submit": return `${r$2}${e.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
1011
- case "cancel": return `${r$2}${e.gray(o)} ${n(this.options[0], "cancelled")}
1012
- ${e.gray(o)}`;
1013
- default: return `${r$2}${e.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
1014
- ${e.cyan(o)} `)}
1015
- ${e.cyan(d)}
1155
+ case "submit": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
1156
+ case "cancel": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options[0], "cancelled")}
1157
+ ${import_picocolors.default.gray(o)}`;
1158
+ default: return `${r$2}${import_picocolors.default.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
1159
+ ${import_picocolors.default.cyan(o)} `)}
1160
+ ${import_picocolors.default.cyan(d)}
1016
1161
  `;
1017
1162
  }
1018
1163
  }
@@ -1020,7 +1165,7 @@ ${e.cyan(d)}
1020
1165
  }, fe = (t) => {
1021
1166
  const n = (r$2, i) => {
1022
1167
  const s = r$2.label ?? String(r$2.value);
1023
- return i === "active" ? `${e.cyan(A)} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : i === "selected" ? `${e.green(T)} ${e.dim(s)} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : i === "cancelled" ? `${e.strikethrough(e.dim(s))}` : i === "active-selected" ? `${e.green(T)} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : i === "submitted" ? `${e.dim(s)}` : `${e.dim(F)} ${e.dim(s)}`;
1168
+ return i === "active" ? `${import_picocolors.default.cyan(A)} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : i === "selected" ? `${import_picocolors.default.green(T)} ${import_picocolors.default.dim(s)} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active-selected" ? `${import_picocolors.default.green(T)} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors.default.dim(s)}` : `${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(s)}`;
1024
1169
  };
1025
1170
  return new SD({
1026
1171
  options: t.options,
@@ -1029,63 +1174,63 @@ ${e.cyan(d)}
1029
1174
  cursorAt: t.cursorAt,
1030
1175
  validate(r$2) {
1031
1176
  if (this.required && r$2.length === 0) return `Please select at least one option.
1032
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
1177
+ ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
1033
1178
  },
1034
1179
  render() {
1035
- const r$2 = `${e.gray(o)}
1180
+ const r$2 = `${import_picocolors.default.gray(o)}
1036
1181
  ${b(this.state)} ${t.message}
1037
1182
  `, i = (s, c) => {
1038
1183
  const a$1 = this.value.includes(s.value);
1039
1184
  return c && a$1 ? n(s, "active-selected") : a$1 ? n(s, "selected") : n(s, c ? "active" : "inactive");
1040
1185
  };
1041
1186
  switch (this.state) {
1042
- case "submit": return `${r$2}${e.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
1187
+ case "submit": return `${r$2}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none")}`;
1043
1188
  case "cancel": {
1044
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(e.dim(", "));
1045
- return `${r$2}${e.gray(o)} ${s.trim() ? `${s}
1046
- ${e.gray(o)}` : ""}`;
1189
+ const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors.default.dim(", "));
1190
+ return `${r$2}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
1191
+ ${import_picocolors.default.gray(o)}` : ""}`;
1047
1192
  }
1048
1193
  case "error": {
1049
1194
  const s = this.error.split(`
1050
- `).map((c, a$1) => a$1 === 0 ? `${e.yellow(d)} ${e.yellow(c)}` : ` ${c}`).join(`
1195
+ `).map((c, a$1) => a$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
1051
1196
  `);
1052
- return `${r$2 + e.yellow(o)} ${G({
1197
+ return `${r$2 + import_picocolors.default.yellow(o)} ${G({
1053
1198
  options: this.options,
1054
1199
  cursor: this.cursor,
1055
1200
  maxItems: t.maxItems,
1056
1201
  style: i
1057
1202
  }).join(`
1058
- ${e.yellow(o)} `)}
1203
+ ${import_picocolors.default.yellow(o)} `)}
1059
1204
  ${s}
1060
1205
  `;
1061
1206
  }
1062
- default: return `${r$2}${e.cyan(o)} ${G({
1207
+ default: return `${r$2}${import_picocolors.default.cyan(o)} ${G({
1063
1208
  options: this.options,
1064
1209
  cursor: this.cursor,
1065
1210
  maxItems: t.maxItems,
1066
1211
  style: i
1067
1212
  }).join(`
1068
- ${e.cyan(o)} `)}
1069
- ${e.cyan(d)}
1213
+ ${import_picocolors.default.cyan(o)} `)}
1214
+ ${import_picocolors.default.cyan(d)}
1070
1215
  `;
1071
1216
  }
1072
1217
  }
1073
1218
  }).prompt();
1074
1219
  }, be = (t) => {
1075
1220
  const { selectableGroups: n = !0 } = t, r$2 = (i, s, c = []) => {
1076
- const a$1 = i.label ?? String(i.value), l = typeof i.group == "string", $$1 = l && (c[c.indexOf(i) + 1] ?? { group: !0 }), g$1 = l && $$1.group === !0, p$1 = l ? n ? `${g$1 ? d : o} ` : " " : "";
1077
- if (s === "active") return `${e.dim(p$1)}${e.cyan(A)} ${a$1} ${i.hint ? e.dim(`(${i.hint})`) : ""}`;
1078
- if (s === "group-active") return `${p$1}${e.cyan(A)} ${e.dim(a$1)}`;
1079
- if (s === "group-active-selected") return `${p$1}${e.green(T)} ${e.dim(a$1)}`;
1221
+ const a$1 = i.label ?? String(i.value), l$1 = typeof i.group == "string", $$1 = l$1 && (c[c.indexOf(i) + 1] ?? { group: !0 }), g$1 = l$1 && $$1.group === !0, p$1 = l$1 ? n ? `${g$1 ? d : o} ` : " " : "";
1222
+ if (s === "active") return `${import_picocolors.default.dim(p$1)}${import_picocolors.default.cyan(A)} ${a$1} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1223
+ if (s === "group-active") return `${p$1}${import_picocolors.default.cyan(A)} ${import_picocolors.default.dim(a$1)}`;
1224
+ if (s === "group-active-selected") return `${p$1}${import_picocolors.default.green(T)} ${import_picocolors.default.dim(a$1)}`;
1080
1225
  if (s === "selected") {
1081
- const f = l || n ? e.green(T) : "";
1082
- return `${e.dim(p$1)}${f} ${e.dim(a$1)} ${i.hint ? e.dim(`(${i.hint})`) : ""}`;
1226
+ const f = l$1 || n ? import_picocolors.default.green(T) : "";
1227
+ return `${import_picocolors.default.dim(p$1)}${f} ${import_picocolors.default.dim(a$1)} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1083
1228
  }
1084
- if (s === "cancelled") return `${e.strikethrough(e.dim(a$1))}`;
1085
- if (s === "active-selected") return `${e.dim(p$1)}${e.green(T)} ${a$1} ${i.hint ? e.dim(`(${i.hint})`) : ""}`;
1086
- if (s === "submitted") return `${e.dim(a$1)}`;
1087
- const v = l || n ? e.dim(F) : "";
1088
- return `${e.dim(p$1)}${v} ${e.dim(a$1)}`;
1229
+ if (s === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a$1))}`;
1230
+ if (s === "active-selected") return `${import_picocolors.default.dim(p$1)}${import_picocolors.default.green(T)} ${a$1} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1231
+ if (s === "submitted") return `${import_picocolors.default.dim(a$1)}`;
1232
+ const v$1 = l$1 || n ? import_picocolors.default.dim(F) : "";
1233
+ return `${import_picocolors.default.dim(p$1)}${v$1} ${import_picocolors.default.dim(a$1)}`;
1089
1234
  };
1090
1235
  return new _D({
1091
1236
  options: t.options,
@@ -1095,37 +1240,37 @@ ${e.cyan(d)}
1095
1240
  selectableGroups: n,
1096
1241
  validate(i) {
1097
1242
  if (this.required && i.length === 0) return `Please select at least one option.
1098
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
1243
+ ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
1099
1244
  },
1100
1245
  render() {
1101
- const i = `${e.gray(o)}
1246
+ const i = `${import_picocolors.default.gray(o)}
1102
1247
  ${b(this.state)} ${t.message}
1103
1248
  `;
1104
1249
  switch (this.state) {
1105
- case "submit": return `${i}${e.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => r$2(s, "submitted")).join(e.dim(", "))}`;
1250
+ case "submit": return `${i}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => r$2(s, "submitted")).join(import_picocolors.default.dim(", "))}`;
1106
1251
  case "cancel": {
1107
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => r$2(c, "cancelled")).join(e.dim(", "));
1108
- return `${i}${e.gray(o)} ${s.trim() ? `${s}
1109
- ${e.gray(o)}` : ""}`;
1252
+ const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => r$2(c, "cancelled")).join(import_picocolors.default.dim(", "));
1253
+ return `${i}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
1254
+ ${import_picocolors.default.gray(o)}` : ""}`;
1110
1255
  }
1111
1256
  case "error": {
1112
1257
  const s = this.error.split(`
1113
- `).map((c, a$1) => a$1 === 0 ? `${e.yellow(d)} ${e.yellow(c)}` : ` ${c}`).join(`
1258
+ `).map((c, a$1) => a$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
1114
1259
  `);
1115
- return `${i}${e.yellow(o)} ${this.options.map((c, a$1, l) => {
1260
+ return `${i}${import_picocolors.default.yellow(o)} ${this.options.map((c, a$1, l$1) => {
1116
1261
  const $$1 = this.value.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), g$1 = a$1 === this.cursor;
1117
- return !g$1 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? r$2(c, $$1 ? "group-active-selected" : "group-active", l) : g$1 && $$1 ? r$2(c, "active-selected", l) : $$1 ? r$2(c, "selected", l) : r$2(c, g$1 ? "active" : "inactive", l);
1262
+ return !g$1 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? r$2(c, $$1 ? "group-active-selected" : "group-active", l$1) : g$1 && $$1 ? r$2(c, "active-selected", l$1) : $$1 ? r$2(c, "selected", l$1) : r$2(c, g$1 ? "active" : "inactive", l$1);
1118
1263
  }).join(`
1119
- ${e.yellow(o)} `)}
1264
+ ${import_picocolors.default.yellow(o)} `)}
1120
1265
  ${s}
1121
1266
  `;
1122
1267
  }
1123
- default: return `${i}${e.cyan(o)} ${this.options.map((s, c, a$1) => {
1124
- const l = this.value.includes(s.value) || s.group === !0 && this.isGroupSelected(`${s.value}`), $$1 = c === this.cursor;
1125
- return !$$1 && typeof s.group == "string" && this.options[this.cursor].value === s.group ? r$2(s, l ? "group-active-selected" : "group-active", a$1) : $$1 && l ? r$2(s, "active-selected", a$1) : l ? r$2(s, "selected", a$1) : r$2(s, $$1 ? "active" : "inactive", a$1);
1268
+ default: return `${i}${import_picocolors.default.cyan(o)} ${this.options.map((s, c, a$1) => {
1269
+ const l$1 = this.value.includes(s.value) || s.group === !0 && this.isGroupSelected(`${s.value}`), $$1 = c === this.cursor;
1270
+ return !$$1 && typeof s.group == "string" && this.options[this.cursor].value === s.group ? r$2(s, l$1 ? "group-active-selected" : "group-active", a$1) : $$1 && l$1 ? r$2(s, "active-selected", a$1) : l$1 ? r$2(s, "selected", a$1) : r$2(s, $$1 ? "active" : "inactive", a$1);
1126
1271
  }).join(`
1127
- ${e.cyan(o)} `)}
1128
- ${e.cyan(d)}
1272
+ ${import_picocolors.default.cyan(o)} `)}
1273
+ ${import_picocolors.default.cyan(d)}
1129
1274
  `;
1130
1275
  }
1131
1276
  }
@@ -1134,61 +1279,61 @@ ${e.cyan(d)}
1134
1279
  const r$2 = `
1135
1280
  ${t}
1136
1281
  `.split(`
1137
- `), i = stripVTControlCharacters(n).length, s = Math.max(r$2.reduce((a$1, l) => {
1138
- const $$1 = stripVTControlCharacters(l);
1282
+ `), i = stripVTControlCharacters(n).length, s = Math.max(r$2.reduce((a$1, l$1) => {
1283
+ const $$1 = stripVTControlCharacters(l$1);
1139
1284
  return $$1.length > a$1 ? $$1.length : a$1;
1140
- }, 0), i) + 2, c = r$2.map((a$1) => `${e.gray(o)} ${e.dim(a$1)}${" ".repeat(s - stripVTControlCharacters(a$1).length)}${e.gray(o)}`).join(`
1285
+ }, 0), i) + 2, c = r$2.map((a$1) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a$1)}${" ".repeat(s - stripVTControlCharacters(a$1).length)}${import_picocolors.default.gray(o)}`).join(`
1141
1286
  `);
1142
- process.stdout.write(`${e.gray(o)}
1143
- ${e.green(C)} ${e.reset(n)} ${e.gray(_.repeat(Math.max(s - i - 1, 1)) + me)}
1287
+ process.stdout.write(`${import_picocolors.default.gray(o)}
1288
+ ${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_.repeat(Math.max(s - i - 1, 1)) + me)}
1144
1289
  ${c}
1145
- ${e.gray(de + _.repeat(s + 2) + pe)}
1290
+ ${import_picocolors.default.gray(de + _.repeat(s + 2) + pe)}
1146
1291
  `);
1147
1292
  }, xe = (t = "") => {
1148
- process.stdout.write(`${e.gray(d)} ${e.red(t)}
1293
+ process.stdout.write(`${import_picocolors.default.gray(d)} ${import_picocolors.default.red(t)}
1149
1294
 
1150
1295
  `);
1151
1296
  }, Ie = (t = "") => {
1152
- process.stdout.write(`${e.gray(ue)} ${t}
1297
+ process.stdout.write(`${import_picocolors.default.gray(ue)} ${t}
1153
1298
  `);
1154
1299
  }, Se = (t = "") => {
1155
- process.stdout.write(`${e.gray(o)}
1156
- ${e.gray(d)} ${t}
1300
+ process.stdout.write(`${import_picocolors.default.gray(o)}
1301
+ ${import_picocolors.default.gray(d)} ${t}
1157
1302
 
1158
1303
  `);
1159
1304
  }, M = {
1160
- message: (t = "", { symbol: n = e.gray(o) } = {}) => {
1161
- const r$2 = [`${e.gray(o)}`];
1305
+ message: (t = "", { symbol: n = import_picocolors.default.gray(o) } = {}) => {
1306
+ const r$2 = [`${import_picocolors.default.gray(o)}`];
1162
1307
  if (t) {
1163
1308
  const [i, ...s] = t.split(`
1164
1309
  `);
1165
- r$2.push(`${n} ${i}`, ...s.map((c) => `${e.gray(o)} ${c}`));
1310
+ r$2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors.default.gray(o)} ${c}`));
1166
1311
  }
1167
1312
  process.stdout.write(`${r$2.join(`
1168
1313
  `)}
1169
1314
  `);
1170
1315
  },
1171
1316
  info: (t) => {
1172
- M.message(t, { symbol: e.blue(q) });
1317
+ M.message(t, { symbol: import_picocolors.default.blue(q) });
1173
1318
  },
1174
1319
  success: (t) => {
1175
- M.message(t, { symbol: e.green(D) });
1320
+ M.message(t, { symbol: import_picocolors.default.green(D) });
1176
1321
  },
1177
1322
  step: (t) => {
1178
- M.message(t, { symbol: e.green(C) });
1323
+ M.message(t, { symbol: import_picocolors.default.green(C) });
1179
1324
  },
1180
1325
  warn: (t) => {
1181
- M.message(t, { symbol: e.yellow(U) });
1326
+ M.message(t, { symbol: import_picocolors.default.yellow(U) });
1182
1327
  },
1183
1328
  warning: (t) => {
1184
1329
  M.warn(t);
1185
1330
  },
1186
1331
  error: (t) => {
1187
- M.message(t, { symbol: e.red(K) });
1332
+ M.message(t, { symbol: import_picocolors.default.red(K) });
1188
1333
  }
1189
- }, J = `${e.gray(o)} `, x = {
1190
- message: async (t, { symbol: n = e.gray(o) } = {}) => {
1191
- process.stdout.write(`${e.gray(o)}
1334
+ }, J = `${import_picocolors.default.gray(o)} `, x = {
1335
+ message: async (t, { symbol: n = import_picocolors.default.gray(o) } = {}) => {
1336
+ process.stdout.write(`${import_picocolors.default.gray(o)}
1192
1337
  ${n} `);
1193
1338
  let r$2 = 3;
1194
1339
  for await (let i of t) {
@@ -1203,12 +1348,12 @@ ${J}${i.trimStart()}`), r$2 = 3 + stripVTControlCharacters(i.trimStart()).length
1203
1348
  process.stdout.write(`
1204
1349
  `);
1205
1350
  },
1206
- info: (t) => x.message(t, { symbol: e.blue(q) }),
1207
- success: (t) => x.message(t, { symbol: e.green(D) }),
1208
- step: (t) => x.message(t, { symbol: e.green(C) }),
1209
- warn: (t) => x.message(t, { symbol: e.yellow(U) }),
1351
+ info: (t) => x.message(t, { symbol: import_picocolors.default.blue(q) }),
1352
+ success: (t) => x.message(t, { symbol: import_picocolors.default.green(D) }),
1353
+ step: (t) => x.message(t, { symbol: import_picocolors.default.green(C) }),
1354
+ warn: (t) => x.message(t, { symbol: import_picocolors.default.yellow(U) }),
1210
1355
  warning: (t) => x.warn(t),
1211
- error: (t) => x.message(t, { symbol: e.red(K) })
1356
+ error: (t) => x.message(t, { symbol: import_picocolors.default.red(K) })
1212
1357
  }, Y = ({ indicator: t = "dots" } = {}) => {
1213
1358
  const n = V ? [
1214
1359
  "◒",
@@ -1221,58 +1366,58 @@ ${J}${i.trimStart()}`), r$2 = 3 + stripVTControlCharacters(i.trimStart()).length
1221
1366
  "O",
1222
1367
  "0"
1223
1368
  ], r$2 = V ? 80 : 120, i = process.env.CI === "true";
1224
- let s, c, a$1 = !1, l = "", $$1, g$1 = performance.now();
1369
+ let s, c, a$1 = !1, l$1 = "", $$1, g$1 = performance.now();
1225
1370
  const p$1 = (m$1) => {
1226
1371
  a$1 && N$1(m$1 > 1 ? "Something went wrong" : "Canceled", m$1);
1227
- }, v = () => p$1(2), f = () => p$1(1), j = () => {
1228
- process.on("uncaughtExceptionMonitor", v), process.on("unhandledRejection", v), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p$1);
1372
+ }, v$1 = () => p$1(2), f = () => p$1(1), j = () => {
1373
+ process.on("uncaughtExceptionMonitor", v$1), process.on("unhandledRejection", v$1), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p$1);
1229
1374
  }, E = () => {
1230
- process.removeListener("uncaughtExceptionMonitor", v), process.removeListener("unhandledRejection", v), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p$1);
1375
+ process.removeListener("uncaughtExceptionMonitor", v$1), process.removeListener("unhandledRejection", v$1), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p$1);
1231
1376
  }, B$1 = () => {
1232
1377
  if ($$1 === void 0) return;
1233
1378
  i && process.stdout.write(`
1234
1379
  `);
1235
1380
  const m$1 = $$1.split(`
1236
1381
  `);
1237
- process.stdout.write(cursor.move(-999, m$1.length - 1)), process.stdout.write(erase.down(m$1.length));
1382
+ process.stdout.write(import_src.cursor.move(-999, m$1.length - 1)), process.stdout.write(import_src.erase.down(m$1.length));
1238
1383
  }, R$1 = (m$1) => m$1.replace(/\.+$/, ""), O$1 = (m$1) => {
1239
1384
  const h$1 = (performance.now() - m$1) / 1e3, w$1 = Math.floor(h$1 / 60), I$1 = Math.floor(h$1 % 60);
1240
1385
  return w$1 > 0 ? `[${w$1}m ${I$1}s]` : `[${I$1}s]`;
1241
1386
  }, H$1 = (m$1 = "") => {
1242
- a$1 = !0, s = fD(), l = R$1(m$1), g$1 = performance.now(), process.stdout.write(`${e.gray(o)}
1387
+ a$1 = !0, s = fD(), l$1 = R$1(m$1), g$1 = performance.now(), process.stdout.write(`${import_picocolors.default.gray(o)}
1243
1388
  `);
1244
1389
  let h$1 = 0, w$1 = 0;
1245
1390
  j(), c = setInterval(() => {
1246
- if (i && l === $$1) return;
1247
- B$1(), $$1 = l;
1248
- const I$1 = e.magenta(n[h$1]);
1249
- if (i) process.stdout.write(`${I$1} ${l}...`);
1250
- else if (t === "timer") process.stdout.write(`${I$1} ${l} ${O$1(g$1)}`);
1391
+ if (i && l$1 === $$1) return;
1392
+ B$1(), $$1 = l$1;
1393
+ const I$1 = import_picocolors.default.magenta(n[h$1]);
1394
+ if (i) process.stdout.write(`${I$1} ${l$1}...`);
1395
+ else if (t === "timer") process.stdout.write(`${I$1} ${l$1} ${O$1(g$1)}`);
1251
1396
  else {
1252
1397
  const z$1 = ".".repeat(Math.floor(w$1)).slice(0, 3);
1253
- process.stdout.write(`${I$1} ${l}${z$1}`);
1398
+ process.stdout.write(`${I$1} ${l$1}${z$1}`);
1254
1399
  }
1255
1400
  h$1 = h$1 + 1 < n.length ? h$1 + 1 : 0, w$1 = w$1 < n.length ? w$1 + .125 : 0;
1256
1401
  }, r$2);
1257
1402
  }, N$1 = (m$1 = "", h$1 = 0) => {
1258
1403
  a$1 = !1, clearInterval(c), B$1();
1259
- const w$1 = h$1 === 0 ? e.green(C) : h$1 === 1 ? e.red(L) : e.red(W);
1260
- l = R$1(m$1 ?? l), t === "timer" ? process.stdout.write(`${w$1} ${l} ${O$1(g$1)}
1261
- `) : process.stdout.write(`${w$1} ${l}
1404
+ const w$1 = h$1 === 0 ? import_picocolors.default.green(C) : h$1 === 1 ? import_picocolors.default.red(L) : import_picocolors.default.red(W);
1405
+ l$1 = R$1(m$1 ?? l$1), t === "timer" ? process.stdout.write(`${w$1} ${l$1} ${O$1(g$1)}
1406
+ `) : process.stdout.write(`${w$1} ${l$1}
1262
1407
  `), E(), s();
1263
1408
  };
1264
1409
  return {
1265
1410
  start: H$1,
1266
1411
  stop: N$1,
1267
1412
  message: (m$1 = "") => {
1268
- l = R$1(m$1 ?? l);
1413
+ l$1 = R$1(m$1 ?? l$1);
1269
1414
  }
1270
1415
  };
1271
1416
  }, Ce = async (t, n) => {
1272
1417
  const r$2 = {}, i = Object.keys(t);
1273
1418
  for (const s of i) {
1274
- const c = t[s], a$1 = await c({ results: r$2 })?.catch((l) => {
1275
- throw l;
1419
+ const c = t[s], a$1 = await c({ results: r$2 })?.catch((l$1) => {
1420
+ throw l$1;
1276
1421
  });
1277
1422
  if (typeof n?.onCancel == "function" && pD(a$1)) {
1278
1423
  r$2[s] = "canceled", n.onCancel({ results: r$2 });
@@ -1295,17 +1440,17 @@ ${J}${i.trimStart()}`), r$2 = 3 + stripVTControlCharacters(i.trimStart()).length
1295
1440
  //#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs
1296
1441
  var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1297
1442
  let e, t, r, { defineProperty: l, setPrototypeOf: n, create: o, keys: s } = Object, i = "", { round: c, max: a } = Math, p = (e$1) => {
1298
- let t = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$2 = t?.length, l = parseInt(6 ^ r$2 ? 3 ^ r$2 ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
1443
+ let t = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$2 = t?.length, l$1 = parseInt(6 ^ r$2 ? 3 ^ r$2 ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
1299
1444
  return [
1300
- l >> 16 & 255,
1301
- l >> 8 & 255,
1302
- 255 & l
1445
+ l$1 >> 16 & 255,
1446
+ l$1 >> 8 & 255,
1447
+ 255 & l$1
1303
1448
  ];
1304
1449
  }, u = (e$1, t, r$2) => e$1 ^ t || t ^ r$2 ? 16 + 36 * c(e$1 / 51) + 6 * c(t / 51) + c(r$2 / 51) : 8 > e$1 ? 16 : e$1 > 248 ? 231 : c(24 * (e$1 - 8) / 247) + 232, d = (e$1) => {
1305
- let t, r$2, l, n, o$1;
1306
- return 8 > e$1 ? 30 + e$1 : 16 > e$1 ? e$1 - 8 + 90 : (232 > e$1 ? (o$1 = (e$1 -= 16) % 36, t = (e$1 / 36 | 0) / 5, r$2 = (o$1 / 6 | 0) / 5, l = o$1 % 6 / 5) : t = r$2 = l = (10 * (e$1 - 232) + 8) / 255, n = 2 * a(t, r$2, l), n ? 30 + (c(l) << 2 | c(r$2) << 1 | c(t)) + (2 ^ n ? 0 : 60) : 30);
1450
+ let t, r$2, l$1, n, o$1;
1451
+ return 8 > e$1 ? 30 + e$1 : 16 > e$1 ? e$1 - 8 + 90 : (232 > e$1 ? (o$1 = (e$1 -= 16) % 36, t = (e$1 / 36 | 0) / 5, r$2 = (o$1 / 6 | 0) / 5, l$1 = o$1 % 6 / 5) : t = r$2 = l$1 = (10 * (e$1 - 232) + 8) / 255, n = 2 * a(t, r$2, l$1), n ? 30 + (c(l$1) << 2 | c(r$2) << 1 | c(t)) + (2 ^ n ? 0 : 60) : 30);
1307
1452
  }, f = (() => {
1308
- let r$2 = (e$1) => o$1.some(((t) => e$1.test(t))), l = globalThis, n = l.process ?? {}, o$1 = n.argv ?? [], i = n.env ?? {}, c = -1;
1453
+ let r$2 = (e$1) => o$1.some(((t) => e$1.test(t))), l$1 = globalThis, n = l$1.process ?? {}, o$1 = n.argv ?? [], i = n.env ?? {}, c = -1;
1309
1454
  try {
1310
1455
  e = "," + s(i).join(",");
1311
1456
  } catch (e$1) {
@@ -1318,32 +1463,32 @@ var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1318
1463
  2: 2,
1319
1464
  3: 3
1320
1465
  }[i[a$1]] ?? -1, u$1 = a$1 in i && p$1 || r$2(/^--color=?(true|always)?$/);
1321
- return u$1 && (c = p$1), ~c || (c = ((r$3, l$1, n$1) => (t = r$3.TERM, {
1466
+ return u$1 && (c = p$1), ~c || (c = ((r$3, l$2, n$1) => (t = r$3.TERM, {
1322
1467
  "24bit": 3,
1323
1468
  truecolor: 3,
1324
1469
  ansi256: 2,
1325
1470
  ansi: 1
1326
- }[r$3.COLORTERM] || (r$3.CI ? /,GITHUB/.test(e) ? 3 : 1 : l$1 && "dumb" !== t ? n$1 ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i, !!i.PM2_HOME || i.NEXT_RUNTIME?.includes("edge") || !!n.stdout?.isTTY, "win32" === n.platform)), !p$1 || i.NO_COLOR || r$2(/^--(no-color|color=(false|never))$/) ? 0 : l.window?.chrome || u$1 && !c ? 3 : c;
1471
+ }[r$3.COLORTERM] || (r$3.CI ? /,GITHUB/.test(e) ? 3 : 1 : l$2 && "dumb" !== t ? n$1 ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i, !!i.PM2_HOME || i.NEXT_RUNTIME?.includes("edge") || !!n.stdout?.isTTY, "win32" === n.platform)), !p$1 || i.NO_COLOR || r$2(/^--(no-color|color=(false|never))$/) ? 0 : l$1.window?.chrome || u$1 && !c ? 3 : c;
1327
1472
  })(), g = {
1328
1473
  open: i,
1329
1474
  close: i
1330
- }, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t, close: l }) => {
1475
+ }, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t, close: l$1 }) => {
1331
1476
  let o$1 = (e$2, ...r$2) => {
1332
1477
  if (!e$2) {
1333
- if (t && t === l) return t;
1478
+ if (t && t === l$1) return t;
1334
1479
  if ((e$2 ?? i) === i) return i;
1335
1480
  }
1336
1481
  let n, s$1 = e$2.raw ? String.raw({ raw: e$2 }, ...r$2) : i + e$2, c$1 = o$1.p, a$1 = c$1.o, p$1 = c$1.c;
1337
1482
  if (s$1.includes("\x1B")) for (; c$1; c$1 = c$1.p) {
1338
- let { open: e$3, close: t$1 } = c$1, r$3 = t$1.length, l$1 = i, o$2 = 0;
1339
- if (r$3) for (; ~(n = s$1.indexOf(t$1, o$2)); o$2 = n + r$3) l$1 += s$1.slice(o$2, n) + e$3;
1340
- s$1 = l$1 + s$1.slice(o$2);
1483
+ let { open: e$3, close: t$1 } = c$1, r$3 = t$1.length, l$2 = i, o$2 = 0;
1484
+ if (r$3) for (; ~(n = s$1.indexOf(t$1, o$2)); o$2 = n + r$3) l$2 += s$1.slice(o$2, n) + e$3;
1485
+ s$1 = l$2 + s$1.slice(o$2);
1341
1486
  }
1342
1487
  return a$1 + (s$1.includes("\n") ? s$1.replace(/(\r?\n)/g, p$1 + "$1" + a$1) : s$1) + p$1;
1343
- }, s = t, c = l;
1344
- return e$1 && (s = e$1.o + t, c = l + e$1.c), n(o$1, r), o$1.p = {
1488
+ }, s = t, c = l$1;
1489
+ return e$1 && (s = e$1.o + t, c = l$1 + e$1.c), n(o$1, r), o$1.p = {
1345
1490
  open: t,
1346
- close: l,
1491
+ close: l$1,
1347
1492
  o: s,
1348
1493
  c,
1349
1494
  p: e$1
@@ -1357,8 +1502,8 @@ var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1357
1502
  strip: (e$2) => e$2.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
1358
1503
  extend(e$2) {
1359
1504
  for (let t$1 in e$2) {
1360
- let r$2 = e$2[t$1], l = (typeof r$2)[0];
1361
- "s" === l ? (c(t$1, T$2(...p(r$2))), c(_$2(t$1), v(...p(r$2)))) : c(t$1, r$2, "f" === l);
1505
+ let r$2 = e$2[t$1], l$1 = (typeof r$2)[0];
1506
+ "s" === l$1 ? (c(t$1, T$2(...p(r$2))), c(_$2(t$1), v$1(...p(r$2)))) : c(t$1, r$2, "f" === l$1);
1362
1507
  }
1363
1508
  return r = o({}, O), n(s, r), s;
1364
1509
  }
@@ -1370,15 +1515,15 @@ var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1370
1515
  }, a$1 = t > 0, w$1 = (e$2, t$1) => a$1 ? {
1371
1516
  open: `[${e$2}m`,
1372
1517
  close: `[${t$1}m`
1373
- } : g, y$1 = (e$2) => (t$1) => e$2(...p(t$1)), R$1 = (e$2, t$1) => (r$2, l, n) => w$1(`${e$2}8;2;${r$2};${l};${n}`, t$1), $$1 = (e$2, t$1) => (r$2, l, n) => w$1(((e$3, t$2, r$3) => d(u(e$3, t$2, r$3)))(r$2, l, n) + e$2, t$1), x$2 = (e$2) => (t$1, r$2, l) => e$2(u(t$1, r$2, l)), T$2 = R$1(3, h), v = R$1(4, b), C$1 = (e$2) => w$1("38;5;" + e$2, h), E = (e$2) => w$1("48;5;" + e$2, b);
1374
- 2 === t ? (T$2 = x$2(C$1), v = x$2(E)) : 1 === t && (T$2 = $$1(0, h), v = $$1(10, b), C$1 = (e$2) => w$1(d(e$2), h), E = (e$2) => w$1(d(e$2) + 10, b));
1518
+ } : g, y$1 = (e$2) => (t$1) => e$2(...p(t$1)), R$1 = (e$2, t$1) => (r$2, l$1, n) => w$1(`${e$2}8;2;${r$2};${l$1};${n}`, t$1), $$1 = (e$2, t$1) => (r$2, l$1, n) => w$1(((e$3, t$2, r$3) => d(u(e$3, t$2, r$3)))(r$2, l$1, n) + e$2, t$1), x$2 = (e$2) => (t$1, r$2, l$1) => e$2(u(t$1, r$2, l$1)), T$2 = R$1(3, h), v$1 = R$1(4, b), C$1 = (e$2) => w$1("38;5;" + e$2, h), E = (e$2) => w$1("48;5;" + e$2, b);
1519
+ 2 === t ? (T$2 = x$2(C$1), v$1 = x$2(E)) : 1 === t && (T$2 = $$1(0, h), v$1 = $$1(10, b), C$1 = (e$2) => w$1(d(e$2), h), E = (e$2) => w$1(d(e$2) + 10, b));
1375
1520
  let M$1, I$1 = {
1376
1521
  fg: C$1,
1377
1522
  bg: E,
1378
1523
  rgb: T$2,
1379
- bgRgb: v,
1524
+ bgRgb: v$1,
1380
1525
  hex: y$1(T$2),
1381
- bgHex: y$1(v),
1526
+ bgHex: y$1(v$1),
1382
1527
  visible: g,
1383
1528
  reset: w$1(0, 0),
1384
1529
  bold: w$1(1, 22),
@@ -1440,12 +1585,10 @@ const anonymousAuth = defineRpcFunction({
1440
1585
  type: "action",
1441
1586
  setup: (context) => {
1442
1587
  const storage = getInternalContext(context).storage.auth;
1443
- const isClientAuthDisabled = context.mode === "build" || context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
1444
- if (isClientAuthDisabled) console.warn("[Vite DevTools] Client authentication is disabled. Any browser can connect to the devtools and access to your server and filesystem.");
1445
1588
  return { handler: async (query) => {
1446
1589
  const session = context.rpc.getCurrentRpcSession();
1447
1590
  if (!session) throw new Error("Failed to retrieve the current RPC session");
1448
- if (isClientAuthDisabled || storage.get().trusted[query.authId]) {
1591
+ if (session.meta.isTrusted || storage.value().trusted[query.authId]) {
1449
1592
  session.meta.clientAuthId = query.authId;
1450
1593
  session.meta.isTrusted = true;
1451
1594
  return { isTrusted: true };
@@ -1564,6 +1707,42 @@ const rpcServerList = defineRpcFunction({
1564
1707
  }
1565
1708
  });
1566
1709
 
1710
+ //#endregion
1711
+ //#region src/node/rpc/internal/state/get.ts
1712
+ const sharedStateGet = defineRpcFunction({
1713
+ name: "vite:internal:rpc:server-state:get",
1714
+ type: "query",
1715
+ setup: (context) => {
1716
+ return { handler: async (key) => {
1717
+ return (await context.rpc.sharedState.get(key)).value();
1718
+ } };
1719
+ }
1720
+ });
1721
+
1722
+ //#endregion
1723
+ //#region src/node/rpc/internal/state/patch.ts
1724
+ const sharedStatePatch = defineRpcFunction({
1725
+ name: "vite:internal:rpc:server-state:patch",
1726
+ type: "query",
1727
+ setup: (context) => {
1728
+ return { handler: async (key, patches, syncId) => {
1729
+ (await context.rpc.sharedState.get(key)).patch(patches, syncId);
1730
+ } };
1731
+ }
1732
+ });
1733
+
1734
+ //#endregion
1735
+ //#region src/node/rpc/internal/state/set.ts
1736
+ const sharedStateSet = defineRpcFunction({
1737
+ name: "vite:internal:rpc:server-state:set",
1738
+ type: "query",
1739
+ setup: (context) => {
1740
+ return { handler: async (key, value, syncId) => {
1741
+ (await context.rpc.sharedState.get(key)).mutate(() => value, syncId);
1742
+ } };
1743
+ }
1744
+ });
1745
+
1567
1746
  //#endregion
1568
1747
  //#region src/node/rpc/internal/terminals-list.ts
1569
1748
  const terminalsList = defineRpcFunction({
@@ -1632,6 +1811,9 @@ const builtinInternalRpcDecalrations = [
1632
1811
  docksList,
1633
1812
  docksOnLaunch,
1634
1813
  rpcServerList,
1814
+ sharedStateGet,
1815
+ sharedStatePatch,
1816
+ sharedStateSet,
1635
1817
  terminalsList,
1636
1818
  terminalsRead
1637
1819
  ];
@@ -1668,14 +1850,26 @@ async function createDevToolsContext(viteConfig, viteServer) {
1668
1850
  context.terminals = terminalsHost;
1669
1851
  for (const fn of builtinRpcDecalrations) rpcHost.register(fn);
1670
1852
  docksHost.events.on("dock:entry:updated", debounce(() => {
1671
- rpcHost.broadcast("vite:internal:docks:updated");
1853
+ rpcHost.broadcast({
1854
+ method: "vite:internal:docks:updated",
1855
+ args: []
1856
+ });
1672
1857
  }, 10));
1673
1858
  terminalsHost.events.on("terminal:session:updated", debounce(() => {
1674
- rpcHost.broadcast("vite:internal:terminals:updated");
1675
- rpcHost.broadcast("vite:internal:docks:updated");
1859
+ rpcHost.broadcast({
1860
+ method: "vite:internal:terminals:updated",
1861
+ args: []
1862
+ });
1863
+ rpcHost.broadcast({
1864
+ method: "vite:internal:docks:updated",
1865
+ args: []
1866
+ });
1676
1867
  }, 10));
1677
1868
  terminalsHost.events.on("terminal:session:stream-chunk", (data) => {
1678
- rpcHost.broadcast("vite:internal:terminals:stream-chunk", data);
1869
+ rpcHost.broadcast({
1870
+ method: "vite:internal:terminals:stream-chunk",
1871
+ args: [data]
1872
+ });
1679
1873
  });
1680
1874
  const plugins = viteConfig.plugins.filter((plugin) => "devtools" in plugin);
1681
1875
  for (const plugin of plugins) {
@@ -1911,7 +2105,7 @@ function sendError(event, error, debug$1) {
1911
2105
  stack: [],
1912
2106
  data: h3Error.data
1913
2107
  };
1914
- if (debug$1) responseBody.stack = (h3Error.stack || "").split("\n").map((l) => l.trim());
2108
+ if (debug$1) responseBody.stack = (h3Error.stack || "").split("\n").map((l$1) => l$1.trim());
1915
2109
  if (event.handled) return;
1916
2110
  setResponseStatus(event, Number.parseInt(h3Error.statusCode), h3Error.statusMessage);
1917
2111
  event.node.res.setHeader("content-type", MIMES.json);
@@ -2619,20 +2813,30 @@ async function createWsServer(options) {
2619
2813
  });
2620
2814
  const host = options.hostWebSocket ?? "localhost";
2621
2815
  const wsClients = /* @__PURE__ */ new Set();
2816
+ const context = options.context;
2817
+ const contextInternal = getInternalContext(context);
2818
+ const isClientAuthDisabled = context.mode === "build" || context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
2819
+ if (isClientAuthDisabled) console.warn("[Vite DevTools] Client authentication is disabled. Any browser can connect to the devtools and access to your server and filesystem.");
2622
2820
  const preset = createWsRpcPreset({
2623
2821
  port,
2624
2822
  host,
2625
- onConnected: (ws, meta) => {
2823
+ onConnected: (ws, req, meta) => {
2824
+ const authId = new URL(req.url ?? "", "http://localhost").searchParams.get("vite_devtools_auth_id") ?? void 0;
2825
+ if (isClientAuthDisabled) meta.isTrusted = true;
2826
+ else if (authId && contextInternal.storage.auth.value().trusted[authId]) {
2827
+ meta.isTrusted = true;
2828
+ meta.clientAuthId = authId;
2829
+ }
2626
2830
  wsClients.add(ws);
2627
- console.log(ansis_default.green`${MARK_CHECK} Websocket client [${meta.id}] connected`);
2831
+ const color = meta.isTrusted ? ansis_default.green : ansis_default.yellow;
2832
+ console.log(color`${MARK_INFO} Websocket client connected. [${meta.id}] [${meta.clientAuthId}] (${meta.isTrusted ? "trusted" : "untrusted"})`);
2628
2833
  },
2629
2834
  onDisconnected: (ws, meta) => {
2630
2835
  wsClients.delete(ws);
2631
- console.log(ansis_default.red`${MARK_CHECK} Websocket client [${meta.id}] disconnected`);
2836
+ console.log(ansis_default.red`${MARK_INFO} Websocket client disconnected. [${meta.id}]`);
2632
2837
  }
2633
2838
  });
2634
2839
  const asyncStorage = new AsyncLocalStorage();
2635
- const isClientAuthDisabled = options.context.mode === "build" || options.context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
2636
2840
  const rpcGroup = createRpcServer(rpcHost.functions, {
2637
2841
  preset,
2638
2842
  rpcOptions: {
@@ -2646,7 +2850,7 @@ async function createWsServer(options) {
2646
2850
  },
2647
2851
  resolver(name, fn) {
2648
2852
  const rpc = this;
2649
- if (!name.startsWith(ANONYMOUS_SCOPE) && !rpc.$meta.isTrusted && !isClientAuthDisabled) return () => {
2853
+ if (!name.startsWith(ANONYMOUS_SCOPE) && !rpc.$meta.isTrusted) return () => {
2650
2854
  throw new Error(`Unauthorized access to method ${JSON.stringify(name)} from client [${rpc.$meta.id}]`);
2651
2855
  };
2652
2856
  if (!fn) return void 0;