ccusage 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,11 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
- import path from "node:path";
4
+ import path, { sep } from "node:path";
5
5
  import path$1, { posix } from "path";
6
+ import { formatWithOptions } from "node:util";
7
+ import process$1 from "node:process";
8
+ import * as tty from "node:tty";
6
9
 
7
10
  //#region rolldown:runtime
8
11
  var __create = Object.create;
@@ -15,8 +18,8 @@ var __commonJS = (cb, mod) => function() {
15
18
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
19
  };
17
20
  var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
- key = keys[i];
21
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$1 = 0, n$1 = keys.length, key; i$1 < n$1; i$1++) {
22
+ key = keys[i$1];
20
23
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
24
  get: ((k) => from[k]).bind(null, key),
22
25
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -33,8 +36,8 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
33
36
  //#endregion
34
37
  //#region node_modules/fast-sort/dist/sort.mjs
35
38
  var castComparer = function(comparer) {
36
- return function(a, b, order) {
37
- return comparer(a, b, order) * order;
39
+ return function(a$1, b$1, order) {
40
+ return comparer(a$1, b$1, order) * order;
38
41
  };
39
42
  };
40
43
  var throwInvalidConfigErrorIfTrue = function(condition, context) {
@@ -54,41 +57,41 @@ var unpackObjectSorter = function(sortByObj) {
54
57
  };
55
58
  };
56
59
  var multiPropertySorterProvider = function(defaultComparer$1) {
57
- return function multiPropertySorter(sortBy, sortByArr, depth$1, order, comparer, a, b) {
60
+ return function multiPropertySorter(sortBy, sortByArr, depth$1, order, comparer, a$1, b$1) {
58
61
  var valA;
59
62
  var valB;
60
63
  if (typeof sortBy === "string") {
61
- valA = a[sortBy];
62
- valB = b[sortBy];
64
+ valA = a$1[sortBy];
65
+ valB = b$1[sortBy];
63
66
  } else if (typeof sortBy === "function") {
64
- valA = sortBy(a);
65
- valB = sortBy(b);
67
+ valA = sortBy(a$1);
68
+ valB = sortBy(b$1);
66
69
  } else {
67
70
  var objectSorterConfig = unpackObjectSorter(sortBy);
68
- return multiPropertySorter(objectSorterConfig.sortBy, sortByArr, depth$1, objectSorterConfig.order, objectSorterConfig.comparer || defaultComparer$1, a, b);
71
+ return multiPropertySorter(objectSorterConfig.sortBy, sortByArr, depth$1, objectSorterConfig.order, objectSorterConfig.comparer || defaultComparer$1, a$1, b$1);
69
72
  }
70
73
  var equality = comparer(valA, valB, order);
71
- if ((equality === 0 || valA == null && valB == null) && sortByArr.length > depth$1) return multiPropertySorter(sortByArr[depth$1], sortByArr, depth$1 + 1, order, comparer, a, b);
74
+ if ((equality === 0 || valA == null && valB == null) && sortByArr.length > depth$1) return multiPropertySorter(sortByArr[depth$1], sortByArr, depth$1 + 1, order, comparer, a$1, b$1);
72
75
  return equality;
73
76
  };
74
77
  };
75
78
  function getSortStrategy(sortBy, comparer, order) {
76
- if (sortBy === void 0 || sortBy === true) return function(a, b) {
77
- return comparer(a, b, order);
79
+ if (sortBy === void 0 || sortBy === true) return function(a$1, b$1) {
80
+ return comparer(a$1, b$1, order);
78
81
  };
79
82
  if (typeof sortBy === "string") {
80
83
  throwInvalidConfigErrorIfTrue(sortBy.includes("."), "String syntax not allowed for nested properties.");
81
- return function(a, b) {
82
- return comparer(a[sortBy], b[sortBy], order);
84
+ return function(a$1, b$1) {
85
+ return comparer(a$1[sortBy], b$1[sortBy], order);
83
86
  };
84
87
  }
85
- if (typeof sortBy === "function") return function(a, b) {
86
- return comparer(sortBy(a), sortBy(b), order);
88
+ if (typeof sortBy === "function") return function(a$1, b$1) {
89
+ return comparer(sortBy(a$1), sortBy(b$1), order);
87
90
  };
88
91
  if (Array.isArray(sortBy)) {
89
92
  var multiPropSorter_1 = multiPropertySorterProvider(comparer);
90
- return function(a, b) {
91
- return multiPropSorter_1(sortBy[0], sortBy, 1, order, comparer, a, b);
93
+ return function(a$1, b$1) {
94
+ return multiPropSorter_1(sortBy[0], sortBy, 1, order, comparer, a$1, b$1);
92
95
  };
93
96
  }
94
97
  var objectSorterConfig = unpackObjectSorter(sortBy);
@@ -117,12 +120,12 @@ function createNewSortInstance(opts) {
117
120
  };
118
121
  };
119
122
  }
120
- var defaultComparer = function(a, b, order) {
121
- if (a == null) return order;
122
- if (b == null) return -order;
123
- if (typeof a !== typeof b) return typeof a < typeof b ? -1 : 1;
124
- if (a < b) return -1;
125
- if (a > b) return 1;
123
+ var defaultComparer = function(a$1, b$1, order) {
124
+ if (a$1 == null) return order;
125
+ if (b$1 == null) return -order;
126
+ if (typeof a$1 !== typeof b$1) return typeof a$1 < typeof b$1 ? -1 : 1;
127
+ if (a$1 < b$1) return -1;
128
+ if (a$1 > b$1) return 1;
126
129
  return 0;
127
130
  };
128
131
  var sort = createNewSortInstance({ comparer: defaultComparer });
@@ -299,21 +302,21 @@ var require_resolve_symlink = __commonJS({ "node_modules/fdir/dist/api/functions
299
302
  const fs_1$1 = __importDefault$1(__require("fs"));
300
303
  const path_1$2 = __require("path");
301
304
  const resolveSymlinksAsync = function(path$2, state, callback$1) {
302
- const { queue, options: { suppressErrors } } = state;
303
- queue.enqueue();
305
+ const { queue: queue$1, options: { suppressErrors } } = state;
306
+ queue$1.enqueue();
304
307
  fs_1$1.default.realpath(path$2, (error, resolvedPath) => {
305
- if (error) return queue.dequeue(suppressErrors ? null : error, state);
308
+ if (error) return queue$1.dequeue(suppressErrors ? null : error, state);
306
309
  fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
307
- if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
308
- if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue.dequeue(null, state);
310
+ if (error$1) return queue$1.dequeue(suppressErrors ? null : error$1, state);
311
+ if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue$1.dequeue(null, state);
309
312
  callback$1(stat, resolvedPath);
310
- queue.dequeue(null, state);
313
+ queue$1.dequeue(null, state);
311
314
  });
312
315
  });
313
316
  };
314
317
  const resolveSymlinks = function(path$2, state, callback$1) {
315
- const { queue, options: { suppressErrors } } = state;
316
- queue.enqueue();
318
+ const { queue: queue$1, options: { suppressErrors } } = state;
319
+ queue$1.enqueue();
317
320
  try {
318
321
  const resolvedPath = fs_1$1.default.realpathSync(path$2);
319
322
  const stat = fs_1$1.default.statSync(resolvedPath);
@@ -495,7 +498,7 @@ var require_counter = __commonJS({ "node_modules/fdir/dist/api/counter.js"(expor
495
498
  //#endregion
496
499
  //#region node_modules/fdir/dist/api/walker.js
497
500
  var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports) {
498
- var __createBinding$1 = void 0 && (void 0).__createBinding || (Object.create ? function(o, m, k, k2) {
501
+ var __createBinding$1 = void 0 && (void 0).__createBinding || (Object.create ? function(o$1, m, k, k2) {
499
502
  if (k2 === void 0) k2 = k;
500
503
  var desc = Object.getOwnPropertyDescriptor(m, k);
501
504
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
@@ -504,33 +507,33 @@ var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports
504
507
  return m[k];
505
508
  }
506
509
  };
507
- Object.defineProperty(o, k2, desc);
508
- } : function(o, m, k, k2) {
510
+ Object.defineProperty(o$1, k2, desc);
511
+ } : function(o$1, m, k, k2) {
509
512
  if (k2 === void 0) k2 = k;
510
- o[k2] = m[k];
513
+ o$1[k2] = m[k];
511
514
  });
512
- var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o, v) {
513
- Object.defineProperty(o, "default", {
515
+ var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o$1, v) {
516
+ Object.defineProperty(o$1, "default", {
514
517
  enumerable: true,
515
518
  value: v
516
519
  });
517
- } : function(o, v) {
518
- o["default"] = v;
520
+ } : function(o$1, v) {
521
+ o$1["default"] = v;
519
522
  });
520
523
  var __importStar = void 0 && (void 0).__importStar || function() {
521
- var ownKeys = function(o) {
522
- ownKeys = Object.getOwnPropertyNames || function(o$1) {
524
+ var ownKeys = function(o$1) {
525
+ ownKeys = Object.getOwnPropertyNames || function(o$2) {
523
526
  var ar = [];
524
- for (var k in o$1) if (Object.prototype.hasOwnProperty.call(o$1, k)) ar[ar.length] = k;
527
+ for (var k in o$2) if (Object.prototype.hasOwnProperty.call(o$2, k)) ar[ar.length] = k;
525
528
  return ar;
526
529
  };
527
- return ownKeys(o);
530
+ return ownKeys(o$1);
528
531
  };
529
532
  return function(mod) {
530
533
  if (mod && mod.__esModule) return mod;
531
534
  var result = {};
532
535
  if (mod != null) {
533
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding$1(result, mod, k[i]);
536
+ for (var k = ownKeys(mod), i$1 = 0; i$1 < k.length; i$1++) if (k[i$1] !== "default") __createBinding$1(result, mod, k[i$1]);
534
537
  }
535
538
  __setModuleDefault(result, mod);
536
539
  return result;
@@ -594,8 +597,8 @@ var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports
594
597
  const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
595
598
  if (controller.signal.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
596
599
  const files = this.getArray(this.state.paths);
597
- for (let i = 0; i < entries.length; ++i) {
598
- const entry = entries[i];
600
+ for (let i$1 = 0; i$1 < entries.length; ++i$1) {
601
+ const entry = entries[i$1];
599
602
  if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
600
603
  const filename = this.joinPath(entry.name, directoryPath);
601
604
  this.pushFile(filename, files, this.state.counts, filters);
@@ -869,8 +872,8 @@ var require_utils = __commonJS({ "node_modules/picomatch/lib/utils.js"(exports)
869
872
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
870
873
  exports.isWindows = () => {
871
874
  if (typeof navigator !== "undefined" && navigator.platform) {
872
- const platform = navigator.platform.toLowerCase();
873
- return platform === "win32" || platform === "windows";
875
+ const platform$1 = navigator.platform.toLowerCase();
876
+ return platform$1 === "win32" || platform$1 === "windows";
874
877
  }
875
878
  if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
876
879
  return false;
@@ -1167,9 +1170,9 @@ var require_scan = __commonJS({ "node_modules/picomatch/lib/scan.js"(exports, mo
1167
1170
  if (opts.parts === true || opts.tokens === true) {
1168
1171
  let prevIndex;
1169
1172
  for (let idx = 0; idx < slashes.length; idx++) {
1170
- const n = prevIndex ? prevIndex + 1 : start;
1171
- const i = slashes[idx];
1172
- const value = input.slice(n, i);
1173
+ const n$1 = prevIndex ? prevIndex + 1 : start;
1174
+ const i$1 = slashes[idx];
1175
+ const value = input.slice(n$1, i$1);
1173
1176
  if (opts.tokens) {
1174
1177
  if (idx === 0 && start !== 0) {
1175
1178
  tokens[idx].isPrefix = true;
@@ -1179,7 +1182,7 @@ var require_scan = __commonJS({ "node_modules/picomatch/lib/scan.js"(exports, mo
1179
1182
  state.maxDepth += tokens[idx].depth;
1180
1183
  }
1181
1184
  if (idx !== 0 || value !== "") parts.push(value);
1182
- prevIndex = i;
1185
+ prevIndex = i$1;
1183
1186
  }
1184
1187
  if (prevIndex && prevIndex + 1 < input.length) {
1185
1188
  const value = input.slice(prevIndex + 1);
@@ -1233,7 +1236,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1233
1236
  * @param {Object} options
1234
1237
  * @return {Object}
1235
1238
  */
1236
- const parse$1 = (input, options) => {
1239
+ const parse$2 = (input, options) => {
1237
1240
  if (typeof input !== "string") throw new TypeError("Expected a string");
1238
1241
  input = REPLACEMENTS[input] || input;
1239
1242
  const opts = { ...options };
@@ -1286,7 +1289,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1286
1289
  * Tokenizing helpers
1287
1290
  */
1288
1291
  const eos = () => state.index === len - 1;
1289
- const peek = state.peek = (n = 1) => input[state.index + n];
1292
+ const peek = state.peek = (n$1 = 1) => input[state.index + n$1];
1290
1293
  const advance = state.advance = () => input[++state.index] || "";
1291
1294
  const remaining = () => input.slice(state.index + 1);
1292
1295
  const consume = (value$1 = "", num = 0) => {
@@ -1379,7 +1382,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1379
1382
  if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
1380
1383
  if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
1381
1384
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
1382
- const expression = parse$1(rest, {
1385
+ const expression = parse$2(rest, {
1383
1386
  ...options,
1384
1387
  fastpaths: false
1385
1388
  }).output;
@@ -1623,10 +1626,10 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1623
1626
  if (brace.dots === true) {
1624
1627
  const arr = tokens.slice();
1625
1628
  const range = [];
1626
- for (let i = arr.length - 1; i >= 0; i--) {
1629
+ for (let i$1 = arr.length - 1; i$1 >= 0; i$1--) {
1627
1630
  tokens.pop();
1628
- if (arr[i].type === "brace") break;
1629
- if (arr[i].type !== "dots") range.unshift(arr[i].value);
1631
+ if (arr[i$1].type === "brace") break;
1632
+ if (arr[i$1].type !== "dots") range.unshift(arr[i$1].value);
1630
1633
  }
1631
1634
  output = expandRange(range, opts);
1632
1635
  state.backtrack = true;
@@ -1637,7 +1640,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1637
1640
  brace.value = brace.output = "\\{";
1638
1641
  value = output = "\\}";
1639
1642
  state.output = out;
1640
- for (const t of toks) state.output += t.output || t.value;
1643
+ for (const t$1 of toks) state.output += t$1.output || t$1.value;
1641
1644
  }
1642
1645
  push({
1643
1646
  type: "brace",
@@ -2016,7 +2019,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
2016
2019
  * This can significantly speed up processing and has very little downside
2017
2020
  * impact when none of the fast paths match.
2018
2021
  */
2019
- parse$1.fastpaths = (input, options) => {
2022
+ parse$2.fastpaths = (input, options) => {
2020
2023
  const opts = { ...options };
2021
2024
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2022
2025
  const len = input.length;
@@ -2060,14 +2063,14 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
2060
2063
  if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
2061
2064
  return source;
2062
2065
  };
2063
- module.exports = parse$1;
2066
+ module.exports = parse$2;
2064
2067
  } });
2065
2068
 
2066
2069
  //#endregion
2067
2070
  //#region node_modules/picomatch/lib/picomatch.js
2068
2071
  var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"(exports, module) {
2069
2072
  const scan = require_scan();
2070
- const parse = require_parse();
2073
+ const parse$1 = require_parse();
2071
2074
  const utils$1 = require_utils();
2072
2075
  const constants = require_constants();
2073
2076
  const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -2108,9 +2111,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2108
2111
  if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2109
2112
  const opts = options || {};
2110
2113
  const posix$1 = opts.windows;
2111
- const regex$1 = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
2112
- const state = regex$1.state;
2113
- delete regex$1.state;
2114
+ const regex$2 = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
2115
+ const state = regex$2.state;
2116
+ delete regex$2.state;
2114
2117
  let isIgnored = () => false;
2115
2118
  if (opts.ignore) {
2116
2119
  const ignoreOpts = {
@@ -2122,14 +2125,14 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2122
2125
  isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
2123
2126
  }
2124
2127
  const matcher = (input, returnObject = false) => {
2125
- const { isMatch, match, output } = picomatch$2.test(input, regex$1, options, {
2128
+ const { isMatch, match, output } = picomatch$2.test(input, regex$2, options, {
2126
2129
  glob: glob$1,
2127
2130
  posix: posix$1
2128
2131
  });
2129
2132
  const result = {
2130
2133
  glob: glob$1,
2131
2134
  state,
2132
- regex: regex$1,
2135
+ regex: regex$2,
2133
2136
  posix: posix$1,
2134
2137
  input,
2135
2138
  output,
@@ -2168,7 +2171,7 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2168
2171
  * @return {Object} Returns an object with matching info.
2169
2172
  * @api public
2170
2173
  */
2171
- picomatch$2.test = (input, regex$1, options, { glob: glob$1, posix: posix$1 } = {}) => {
2174
+ picomatch$2.test = (input, regex$2, options, { glob: glob$1, posix: posix$1 } = {}) => {
2172
2175
  if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2173
2176
  if (input === "") return {
2174
2177
  isMatch: false,
@@ -2182,8 +2185,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2182
2185
  output = format ? format(input) : input;
2183
2186
  match = output === glob$1;
2184
2187
  }
2185
- if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex$1, options, posix$1);
2186
- else match = regex$1.exec(output);
2188
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex$2, options, posix$1);
2189
+ else match = regex$2.exec(output);
2187
2190
  return {
2188
2191
  isMatch: Boolean(match),
2189
2192
  match,
@@ -2204,8 +2207,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2204
2207
  * @api public
2205
2208
  */
2206
2209
  picomatch$2.matchBase = (input, glob$1, options) => {
2207
- const regex$1 = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2208
- return regex$1.test(utils$1.basename(input));
2210
+ const regex$2 = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2211
+ return regex$2.test(utils$1.basename(input));
2209
2212
  };
2210
2213
  /**
2211
2214
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -2239,7 +2242,7 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2239
2242
  */
2240
2243
  picomatch$2.parse = (pattern, options) => {
2241
2244
  if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
2242
- return parse(pattern, {
2245
+ return parse$1(pattern, {
2243
2246
  ...options,
2244
2247
  fastpaths: false
2245
2248
  });
@@ -2289,9 +2292,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2289
2292
  const append = opts.contains ? "" : "$";
2290
2293
  let source = `${prepend}(?:${state.output})${append}`;
2291
2294
  if (state && state.negated === true) source = `^(?!${source}).*$`;
2292
- const regex$1 = picomatch$2.toRegex(source, options);
2293
- if (returnState === true) regex$1.state = state;
2294
- return regex$1;
2295
+ const regex$2 = picomatch$2.toRegex(source, options);
2296
+ if (returnState === true) regex$2.state = state;
2297
+ return regex$2;
2295
2298
  };
2296
2299
  /**
2297
2300
  * Create a regular expression from a parsed glob pattern.
@@ -2317,8 +2320,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2317
2320
  negated: false,
2318
2321
  fastpaths: true
2319
2322
  };
2320
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
2321
- if (!parsed.output) parsed = parse(input, options);
2323
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse$1.fastpaths(input, options);
2324
+ if (!parsed.output) parsed = parse$1(input, options);
2322
2325
  return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
2323
2326
  };
2324
2327
  /**
@@ -2520,7 +2523,7 @@ var require_types = __commonJS({ "node_modules/fdir/dist/types.js"(exports) {
2520
2523
  //#endregion
2521
2524
  //#region node_modules/fdir/dist/index.js
2522
2525
  var require_dist = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
2523
- var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function(o, m, k, k2) {
2526
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function(o$1, m, k, k2) {
2524
2527
  if (k2 === void 0) k2 = k;
2525
2528
  var desc = Object.getOwnPropertyDescriptor(m, k);
2526
2529
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
@@ -2529,10 +2532,10 @@ var require_dist = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
2529
2532
  return m[k];
2530
2533
  }
2531
2534
  };
2532
- Object.defineProperty(o, k2, desc);
2533
- } : function(o, m, k, k2) {
2535
+ Object.defineProperty(o$1, k2, desc);
2536
+ } : function(o$1, m, k, k2) {
2534
2537
  if (k2 === void 0) k2 = k;
2535
- o[k2] = m[k];
2538
+ o$1[k2] = m[k];
2536
2539
  });
2537
2540
  var __exportStar = void 0 && (void 0).__exportStar || function(m, exports$1) {
2538
2541
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
@@ -2558,27 +2561,27 @@ function getPartialMatcher(patterns, options) {
2558
2561
  const patternsCount = patterns.length;
2559
2562
  const patternsParts = Array(patternsCount);
2560
2563
  const regexes = Array(patternsCount);
2561
- for (let i = 0; i < patternsCount; i++) {
2562
- const parts = splitPattern(patterns[i]);
2563
- patternsParts[i] = parts;
2564
+ for (let i$1 = 0; i$1 < patternsCount; i$1++) {
2565
+ const parts = splitPattern(patterns[i$1]);
2566
+ patternsParts[i$1] = parts;
2564
2567
  const partsCount = parts.length;
2565
2568
  const partRegexes = Array(partsCount);
2566
2569
  for (let j = 0; j < partsCount; j++) partRegexes[j] = import_picomatch.default.makeRe(parts[j], options);
2567
- regexes[i] = partRegexes;
2570
+ regexes[i$1] = partRegexes;
2568
2571
  }
2569
2572
  return (input) => {
2570
2573
  const inputParts = input.split("/");
2571
2574
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2572
- for (let i = 0; i < patterns.length; i++) {
2573
- const patternParts = patternsParts[i];
2574
- const regex$1 = regexes[i];
2575
+ for (let i$1 = 0; i$1 < patterns.length; i$1++) {
2576
+ const patternParts = patternsParts[i$1];
2577
+ const regex$2 = regexes[i$1];
2575
2578
  const inputPatternCount = inputParts.length;
2576
2579
  const minParts = Math.min(inputPatternCount, patternParts.length);
2577
2580
  let j = 0;
2578
2581
  while (j < minParts) {
2579
2582
  const part = patternParts[j];
2580
2583
  if (part.includes("/")) return true;
2581
- const match = regex$1[j].test(inputParts[j]);
2584
+ const match = regex$2[j].test(inputParts[j]);
2582
2585
  if (!match) break;
2583
2586
  if (part === "**") return true;
2584
2587
  j++;
@@ -2605,7 +2608,7 @@ function isDynamicPattern(pattern, options) {
2605
2608
  const scan$2 = import_picomatch.default.scan(pattern);
2606
2609
  return scan$2.isGlob || scan$2.negated;
2607
2610
  }
2608
- function log(...tasks) {
2611
+ function log$1(...tasks) {
2609
2612
  console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`, ...tasks);
2610
2613
  }
2611
2614
  const PARENT_DIRECTORY = /^(\/?\.\.)+/;
@@ -2621,17 +2624,17 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2621
2624
  const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2622
2625
  const parts = splitPattern(result);
2623
2626
  if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
2624
- const n = (parentDirectoryMatch[0].length + 1) / 3;
2625
- let i = 0;
2627
+ const n$1 = (parentDirectoryMatch[0].length + 1) / 3;
2628
+ let i$1 = 0;
2626
2629
  const cwdParts = escapedCwd.split("/");
2627
- while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2628
- result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2629
- i++;
2630
+ while (i$1 < n$1 && parts[i$1 + n$1] === cwdParts[cwdParts.length + i$1 - n$1]) {
2631
+ result = result.slice(0, (n$1 - i$1 - 1) * 3) + result.slice((n$1 - i$1) * 3 + parts[i$1 + n$1].length + 1) || ".";
2632
+ i$1++;
2630
2633
  }
2631
- const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
2634
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i$1 * 3));
2632
2635
  if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2633
2636
  props.root = potentialRoot;
2634
- props.depthOffset = -n + i;
2637
+ props.depthOffset = -n$1 + i$1;
2635
2638
  }
2636
2639
  }
2637
2640
  if (!isIgnore && props.depthOffset >= 0) {
@@ -2639,13 +2642,13 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2639
2642
  (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
2640
2643
  const newCommonPath = [];
2641
2644
  const length = Math.min(props.commonPath.length, parts.length);
2642
- for (let i = 0; i < length; i++) {
2643
- const part = parts[i];
2644
- if (part === "**" && !parts[i + 1]) {
2645
+ for (let i$1 = 0; i$1 < length; i$1++) {
2646
+ const part = parts[i$1];
2647
+ if (part === "**" && !parts[i$1 + 1]) {
2645
2648
  newCommonPath.pop();
2646
2649
  break;
2647
2650
  }
2648
- if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
2651
+ if (part !== props.commonPath[i$1] || isDynamicPattern(part) || i$1 === parts.length - 1) break;
2649
2652
  newCommonPath.push(part);
2650
2653
  }
2651
2654
  props.depthOffset = newCommonPath.length;
@@ -2683,15 +2686,15 @@ function processPath(path$1$1, cwd, root, isDirectory, absolute) {
2683
2686
  return getRelativePath(relativePath, cwd, root);
2684
2687
  }
2685
2688
  function formatPaths(paths, cwd, root) {
2686
- for (let i = paths.length - 1; i >= 0; i--) {
2687
- const path$1$1 = paths[i];
2688
- paths[i] = getRelativePath(path$1$1, cwd, root) + (!path$1$1 || path$1$1.endsWith("/") ? "/" : "");
2689
+ for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
2690
+ const path$1$1 = paths[i$1];
2691
+ paths[i$1] = getRelativePath(path$1$1, cwd, root) + (!path$1$1 || path$1$1.endsWith("/") ? "/" : "");
2689
2692
  }
2690
2693
  return paths;
2691
2694
  }
2692
2695
  function crawl(options, cwd, sync$1) {
2693
2696
  if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
2694
- if (options.debug) log("globbing with options:", options, "cwd:", cwd);
2697
+ if (options.debug) log$1("globbing with options:", options, "cwd:", cwd);
2695
2698
  if (Array.isArray(options.patterns) && options.patterns.length === 0) return sync$1 ? [] : Promise.resolve([]);
2696
2699
  const props = {
2697
2700
  root: cwd,
@@ -2700,7 +2703,7 @@ function crawl(options, cwd, sync$1) {
2700
2703
  };
2701
2704
  const processed = processPatterns(options, cwd, props);
2702
2705
  const nocase = options.caseSensitiveMatch === false;
2703
- if (options.debug) log("internal processing patterns:", processed);
2706
+ if (options.debug) log$1("internal processing patterns:", processed);
2704
2707
  const matcher = (0, import_picomatch.default)(processed.match, {
2705
2708
  dot: options.dot,
2706
2709
  nocase,
@@ -2718,16 +2721,16 @@ function crawl(options, cwd, sync$1) {
2718
2721
  filters: [options.debug ? (p, isDirectory) => {
2719
2722
  const path$1$1 = processPath(p, cwd, props.root, isDirectory, options.absolute);
2720
2723
  const matches = matcher(path$1$1);
2721
- if (matches) log(`matched ${path$1$1}`);
2724
+ if (matches) log$1(`matched ${path$1$1}`);
2722
2725
  return matches;
2723
2726
  } : (p, isDirectory) => matcher(processPath(p, cwd, props.root, isDirectory, options.absolute))],
2724
- exclude: options.debug ? (_, p) => {
2727
+ exclude: options.debug ? (_$1, p) => {
2725
2728
  const relativePath = processPath(p, cwd, props.root, true, true);
2726
2729
  const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2727
- if (skipped) log(`skipped ${p}`);
2728
- else log(`crawling ${p}`);
2730
+ if (skipped) log$1(`skipped ${p}`);
2731
+ else log$1(`crawling ${p}`);
2729
2732
  return skipped;
2730
- } : (_, p) => {
2733
+ } : (_$1, p) => {
2731
2734
  const relativePath = processPath(p, cwd, props.root, true, true);
2732
2735
  return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2733
2736
  },
@@ -2751,7 +2754,7 @@ function crawl(options, cwd, sync$1) {
2751
2754
  } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2752
2755
  props.root = props.root.replace(BACKSLASHES, "");
2753
2756
  const root = props.root;
2754
- if (options.debug) log("internal properties:", props);
2757
+ if (options.debug) log$1("internal properties:", props);
2755
2758
  const api = new import_dist.fdir(fdirOptions).crawl(root);
2756
2759
  if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
2757
2760
  return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
@@ -2846,12 +2849,24 @@ function _joinExpects(values2, separator) {
2846
2849
  if (list.length > 1) return `(${list.join(` ${separator} `)})`;
2847
2850
  return list[0] ?? "never";
2848
2851
  }
2852
+ var ValiError = class extends Error {
2853
+ /**
2854
+ * Creates a Valibot error with useful information.
2855
+ *
2856
+ * @param issues The error issues.
2857
+ */
2858
+ constructor(issues) {
2859
+ super(issues[0].message);
2860
+ this.name = "ValiError";
2861
+ this.issues = issues;
2862
+ }
2863
+ };
2849
2864
  /* @__NO_SIDE_EFFECTS__ */
2850
- function regex(requirement, message2) {
2865
+ function regex$1(requirement, message2) {
2851
2866
  return {
2852
2867
  kind: "validation",
2853
2868
  type: "regex",
2854
- reference: regex,
2869
+ reference: regex$1,
2855
2870
  async: false,
2856
2871
  expects: `${requirement}`,
2857
2872
  requirement,
@@ -2871,6 +2886,54 @@ function getDefault(schema, dataset, config2) {
2871
2886
  return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
2872
2887
  }
2873
2888
  /* @__NO_SIDE_EFFECTS__ */
2889
+ function array(item, message2) {
2890
+ return {
2891
+ kind: "schema",
2892
+ type: "array",
2893
+ reference: array,
2894
+ expects: "Array",
2895
+ async: false,
2896
+ item,
2897
+ message: message2,
2898
+ get "~standard"() {
2899
+ return /* @__PURE__ */ _getStandardProps(this);
2900
+ },
2901
+ "~run"(dataset, config2) {
2902
+ const input = dataset.value;
2903
+ if (Array.isArray(input)) {
2904
+ dataset.typed = true;
2905
+ dataset.value = [];
2906
+ for (let key = 0; key < input.length; key++) {
2907
+ const value2 = input[key];
2908
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
2909
+ if (itemDataset.issues) {
2910
+ const pathItem = {
2911
+ type: "array",
2912
+ origin: "value",
2913
+ input,
2914
+ key,
2915
+ value: value2
2916
+ };
2917
+ for (const issue of itemDataset.issues) {
2918
+ if (issue.path) issue.path.unshift(pathItem);
2919
+ else issue.path = [pathItem];
2920
+ dataset.issues?.push(issue);
2921
+ }
2922
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
2923
+ if (config2.abortEarly) {
2924
+ dataset.typed = false;
2925
+ break;
2926
+ }
2927
+ }
2928
+ if (!itemDataset.typed) dataset.typed = false;
2929
+ dataset.value.push(itemDataset.value);
2930
+ }
2931
+ } else _addIssue(this, "type", dataset, config2);
2932
+ return dataset;
2933
+ }
2934
+ };
2935
+ }
2936
+ /* @__NO_SIDE_EFFECTS__ */
2874
2937
  function boolean(message2) {
2875
2938
  return {
2876
2939
  kind: "schema",
@@ -3131,6 +3194,11 @@ function union(options, message2) {
3131
3194
  }
3132
3195
  };
3133
3196
  }
3197
+ function parse(schema, input, config2) {
3198
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
3199
+ if (dataset.issues) throw new ValiError(dataset.issues);
3200
+ return dataset.value;
3201
+ }
3134
3202
  /* @__NO_SIDE_EFFECTS__ */
3135
3203
  function pipe(...pipe2) {
3136
3204
  return {
@@ -3162,18 +3230,1046 @@ function safeParse(schema, input, config2) {
3162
3230
  };
3163
3231
  }
3164
3232
 
3233
+ //#endregion
3234
+ //#region node_modules/consola/dist/core.mjs
3235
+ const LogLevels = {
3236
+ silent: Number.NEGATIVE_INFINITY,
3237
+ fatal: 0,
3238
+ error: 0,
3239
+ warn: 1,
3240
+ log: 2,
3241
+ info: 3,
3242
+ success: 3,
3243
+ fail: 3,
3244
+ ready: 3,
3245
+ start: 3,
3246
+ box: 3,
3247
+ debug: 4,
3248
+ trace: 5,
3249
+ verbose: Number.POSITIVE_INFINITY
3250
+ };
3251
+ const LogTypes = {
3252
+ silent: { level: -1 },
3253
+ fatal: { level: LogLevels.fatal },
3254
+ error: { level: LogLevels.error },
3255
+ warn: { level: LogLevels.warn },
3256
+ log: { level: LogLevels.log },
3257
+ info: { level: LogLevels.info },
3258
+ success: { level: LogLevels.success },
3259
+ fail: { level: LogLevels.fail },
3260
+ ready: { level: LogLevels.info },
3261
+ start: { level: LogLevels.info },
3262
+ box: { level: LogLevels.info },
3263
+ debug: { level: LogLevels.debug },
3264
+ trace: { level: LogLevels.trace },
3265
+ verbose: { level: LogLevels.verbose }
3266
+ };
3267
+ function isPlainObject$1(value) {
3268
+ if (value === null || typeof value !== "object") return false;
3269
+ const prototype = Object.getPrototypeOf(value);
3270
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
3271
+ if (Symbol.iterator in value) return false;
3272
+ if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
3273
+ return true;
3274
+ }
3275
+ function _defu(baseObject, defaults, namespace = ".", merger) {
3276
+ if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
3277
+ const object$1 = Object.assign({}, defaults);
3278
+ for (const key in baseObject) {
3279
+ if (key === "__proto__" || key === "constructor") continue;
3280
+ const value = baseObject[key];
3281
+ if (value === null || value === void 0) continue;
3282
+ if (merger && merger(object$1, key, value, namespace)) continue;
3283
+ if (Array.isArray(value) && Array.isArray(object$1[key])) object$1[key] = [...value, ...object$1[key]];
3284
+ else if (isPlainObject$1(value) && isPlainObject$1(object$1[key])) object$1[key] = _defu(value, object$1[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
3285
+ else object$1[key] = value;
3286
+ }
3287
+ return object$1;
3288
+ }
3289
+ function createDefu(merger) {
3290
+ return (...arguments_) => arguments_.reduce((p, c$1) => _defu(p, c$1, "", merger), {});
3291
+ }
3292
+ const defu = createDefu();
3293
+ function isPlainObject(obj) {
3294
+ return Object.prototype.toString.call(obj) === "[object Object]";
3295
+ }
3296
+ function isLogObj(arg) {
3297
+ if (!isPlainObject(arg)) return false;
3298
+ if (!arg.message && !arg.args) return false;
3299
+ if (arg.stack) return false;
3300
+ return true;
3301
+ }
3302
+ let paused = false;
3303
+ const queue = [];
3304
+ var Consola = class Consola {
3305
+ options;
3306
+ _lastLog;
3307
+ _mockFn;
3308
+ /**
3309
+ * Creates an instance of Consola with specified options or defaults.
3310
+ *
3311
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
3312
+ */
3313
+ constructor(options = {}) {
3314
+ const types = options.types || LogTypes;
3315
+ this.options = defu({
3316
+ ...options,
3317
+ defaults: { ...options.defaults },
3318
+ level: _normalizeLogLevel(options.level, types),
3319
+ reporters: [...options.reporters || []]
3320
+ }, {
3321
+ types: LogTypes,
3322
+ throttle: 1e3,
3323
+ throttleMin: 5,
3324
+ formatOptions: {
3325
+ date: true,
3326
+ colors: false,
3327
+ compact: true
3328
+ }
3329
+ });
3330
+ for (const type in types) {
3331
+ const defaults = {
3332
+ type,
3333
+ ...this.options.defaults,
3334
+ ...types[type]
3335
+ };
3336
+ this[type] = this._wrapLogFn(defaults);
3337
+ this[type].raw = this._wrapLogFn(defaults, true);
3338
+ }
3339
+ if (this.options.mockFn) this.mockTypes();
3340
+ this._lastLog = {};
3341
+ }
3342
+ /**
3343
+ * Gets the current log level of the Consola instance.
3344
+ *
3345
+ * @returns {number} The current log level.
3346
+ */
3347
+ get level() {
3348
+ return this.options.level;
3349
+ }
3350
+ /**
3351
+ * Sets the minimum log level that will be output by the instance.
3352
+ *
3353
+ * @param {number} level - The new log level to set.
3354
+ */
3355
+ set level(level) {
3356
+ this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
3357
+ }
3358
+ /**
3359
+ * Displays a prompt to the user and returns the response.
3360
+ * Throw an error if `prompt` is not supported by the current configuration.
3361
+ *
3362
+ * @template T
3363
+ * @param {string} message - The message to display in the prompt.
3364
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
3365
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
3366
+ */
3367
+ prompt(message, opts) {
3368
+ if (!this.options.prompt) throw new Error("prompt is not supported!");
3369
+ return this.options.prompt(message, opts);
3370
+ }
3371
+ /**
3372
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
3373
+ *
3374
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
3375
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3376
+ */
3377
+ create(options) {
3378
+ const instance = new Consola({
3379
+ ...this.options,
3380
+ ...options
3381
+ });
3382
+ if (this._mockFn) instance.mockTypes(this._mockFn);
3383
+ return instance;
3384
+ }
3385
+ /**
3386
+ * Creates a new Consola instance with the specified default log object properties.
3387
+ *
3388
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
3389
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3390
+ */
3391
+ withDefaults(defaults) {
3392
+ return this.create({
3393
+ ...this.options,
3394
+ defaults: {
3395
+ ...this.options.defaults,
3396
+ ...defaults
3397
+ }
3398
+ });
3399
+ }
3400
+ /**
3401
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
3402
+ *
3403
+ * @param {string} tag - The tag to include in each log of the new instance.
3404
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
3405
+ */
3406
+ withTag(tag) {
3407
+ return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
3408
+ }
3409
+ /**
3410
+ * Adds a custom reporter to the Consola instance.
3411
+ * Reporters will be called for each log message, depending on their implementation and log level.
3412
+ *
3413
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
3414
+ * @returns {Consola} The current Consola instance.
3415
+ */
3416
+ addReporter(reporter) {
3417
+ this.options.reporters.push(reporter);
3418
+ return this;
3419
+ }
3420
+ /**
3421
+ * Removes a custom reporter from the Consola instance.
3422
+ * If no reporter is specified, all reporters will be removed.
3423
+ *
3424
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
3425
+ * @returns {Consola} The current Consola instance.
3426
+ */
3427
+ removeReporter(reporter) {
3428
+ if (reporter) {
3429
+ const i$1 = this.options.reporters.indexOf(reporter);
3430
+ if (i$1 !== -1) return this.options.reporters.splice(i$1, 1);
3431
+ } else this.options.reporters.splice(0);
3432
+ return this;
3433
+ }
3434
+ /**
3435
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
3436
+ *
3437
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
3438
+ * @returns {Consola} The current Consola instance.
3439
+ */
3440
+ setReporters(reporters) {
3441
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
3442
+ return this;
3443
+ }
3444
+ wrapAll() {
3445
+ this.wrapConsole();
3446
+ this.wrapStd();
3447
+ }
3448
+ restoreAll() {
3449
+ this.restoreConsole();
3450
+ this.restoreStd();
3451
+ }
3452
+ /**
3453
+ * Overrides console methods with Consola logging methods for consistent logging.
3454
+ */
3455
+ wrapConsole() {
3456
+ for (const type in this.options.types) {
3457
+ if (!console["__" + type]) console["__" + type] = console[type];
3458
+ console[type] = this[type].raw;
3459
+ }
3460
+ }
3461
+ /**
3462
+ * Restores the original console methods, removing Consola overrides.
3463
+ */
3464
+ restoreConsole() {
3465
+ for (const type in this.options.types) if (console["__" + type]) {
3466
+ console[type] = console["__" + type];
3467
+ delete console["__" + type];
3468
+ }
3469
+ }
3470
+ /**
3471
+ * Overrides standard output and error streams to redirect them through Consola.
3472
+ */
3473
+ wrapStd() {
3474
+ this._wrapStream(this.options.stdout, "log");
3475
+ this._wrapStream(this.options.stderr, "log");
3476
+ }
3477
+ _wrapStream(stream, type) {
3478
+ if (!stream) return;
3479
+ if (!stream.__write) stream.__write = stream.write;
3480
+ stream.write = (data) => {
3481
+ this[type].raw(String(data).trim());
3482
+ };
3483
+ }
3484
+ /**
3485
+ * Restores the original standard output and error streams, removing the Consola redirection.
3486
+ */
3487
+ restoreStd() {
3488
+ this._restoreStream(this.options.stdout);
3489
+ this._restoreStream(this.options.stderr);
3490
+ }
3491
+ _restoreStream(stream) {
3492
+ if (!stream) return;
3493
+ if (stream.__write) {
3494
+ stream.write = stream.__write;
3495
+ delete stream.__write;
3496
+ }
3497
+ }
3498
+ /**
3499
+ * Pauses logging, queues incoming logs until resumed.
3500
+ */
3501
+ pauseLogs() {
3502
+ paused = true;
3503
+ }
3504
+ /**
3505
+ * Resumes logging, processing any queued logs.
3506
+ */
3507
+ resumeLogs() {
3508
+ paused = false;
3509
+ const _queue = queue.splice(0);
3510
+ for (const item of _queue) item[0]._logFn(item[1], item[2]);
3511
+ }
3512
+ /**
3513
+ * Replaces logging methods with mocks if a mock function is provided.
3514
+ *
3515
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
3516
+ */
3517
+ mockTypes(mockFn) {
3518
+ const _mockFn = mockFn || this.options.mockFn;
3519
+ this._mockFn = _mockFn;
3520
+ if (typeof _mockFn !== "function") return;
3521
+ for (const type in this.options.types) {
3522
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
3523
+ this[type].raw = this[type];
3524
+ }
3525
+ }
3526
+ _wrapLogFn(defaults, isRaw) {
3527
+ return (...args) => {
3528
+ if (paused) {
3529
+ queue.push([
3530
+ this,
3531
+ defaults,
3532
+ args,
3533
+ isRaw
3534
+ ]);
3535
+ return;
3536
+ }
3537
+ return this._logFn(defaults, args, isRaw);
3538
+ };
3539
+ }
3540
+ _logFn(defaults, args, isRaw) {
3541
+ if ((defaults.level || 0) > this.level) return false;
3542
+ const logObj = {
3543
+ date: /* @__PURE__ */ new Date(),
3544
+ args: [],
3545
+ ...defaults,
3546
+ level: _normalizeLogLevel(defaults.level, this.options.types)
3547
+ };
3548
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
3549
+ else logObj.args = [...args];
3550
+ if (logObj.message) {
3551
+ logObj.args.unshift(logObj.message);
3552
+ delete logObj.message;
3553
+ }
3554
+ if (logObj.additional) {
3555
+ if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
3556
+ logObj.args.push("\n" + logObj.additional.join("\n"));
3557
+ delete logObj.additional;
3558
+ }
3559
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
3560
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
3561
+ const resolveLog = (newLog = false) => {
3562
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
3563
+ if (this._lastLog.object && repeated > 0) {
3564
+ const args2 = [...this._lastLog.object.args];
3565
+ if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
3566
+ this._log({
3567
+ ...this._lastLog.object,
3568
+ args: args2
3569
+ });
3570
+ this._lastLog.count = 1;
3571
+ }
3572
+ if (newLog) {
3573
+ this._lastLog.object = logObj;
3574
+ this._log(logObj);
3575
+ }
3576
+ };
3577
+ clearTimeout(this._lastLog.timeout);
3578
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
3579
+ this._lastLog.time = logObj.date;
3580
+ if (diffTime < this.options.throttle) try {
3581
+ const serializedLog = JSON.stringify([
3582
+ logObj.type,
3583
+ logObj.tag,
3584
+ logObj.args
3585
+ ]);
3586
+ const isSameLog = this._lastLog.serialized === serializedLog;
3587
+ this._lastLog.serialized = serializedLog;
3588
+ if (isSameLog) {
3589
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
3590
+ if (this._lastLog.count > this.options.throttleMin) {
3591
+ this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
3592
+ return;
3593
+ }
3594
+ }
3595
+ } catch {}
3596
+ resolveLog(true);
3597
+ }
3598
+ _log(logObj) {
3599
+ for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
3600
+ }
3601
+ };
3602
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
3603
+ if (input === void 0) return defaultLevel;
3604
+ if (typeof input === "number") return input;
3605
+ if (types[input] && types[input].level !== void 0) return types[input].level;
3606
+ return defaultLevel;
3607
+ }
3608
+ Consola.prototype.add = Consola.prototype.addReporter;
3609
+ Consola.prototype.remove = Consola.prototype.removeReporter;
3610
+ Consola.prototype.clear = Consola.prototype.removeReporter;
3611
+ Consola.prototype.withScope = Consola.prototype.withTag;
3612
+ Consola.prototype.mock = Consola.prototype.mockTypes;
3613
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
3614
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
3615
+ function createConsola$1(options = {}) {
3616
+ return new Consola(options);
3617
+ }
3618
+
3619
+ //#endregion
3620
+ //#region node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
3621
+ function parseStack(stack, message) {
3622
+ const cwd = process.cwd() + sep;
3623
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd, ""));
3624
+ return lines;
3625
+ }
3626
+ function writeStream(data, stream) {
3627
+ const write = stream.__write || stream.write;
3628
+ return write.call(stream, data);
3629
+ }
3630
+ const bracket = (x) => x ? `[${x}]` : "";
3631
+ var BasicReporter = class {
3632
+ formatStack(stack, message, opts) {
3633
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
3634
+ return indent + parseStack(stack, message).join(`
3635
+ ${indent}`);
3636
+ }
3637
+ formatError(err, opts) {
3638
+ const message = err.message ?? formatWithOptions(opts, err);
3639
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
3640
+ const level = opts?.errorLevel || 0;
3641
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
3642
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
3643
+ ...opts,
3644
+ errorLevel: level + 1
3645
+ }) : "";
3646
+ return causedPrefix + message + "\n" + stack + causedError;
3647
+ }
3648
+ formatArgs(args, opts) {
3649
+ const _args = args.map((arg) => {
3650
+ if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
3651
+ return arg;
3652
+ });
3653
+ return formatWithOptions(opts, ..._args);
3654
+ }
3655
+ formatDate(date, opts) {
3656
+ return opts.date ? date.toLocaleTimeString() : "";
3657
+ }
3658
+ filterAndJoin(arr) {
3659
+ return arr.filter(Boolean).join(" ");
3660
+ }
3661
+ formatLogObj(logObj, opts) {
3662
+ const message = this.formatArgs(logObj.args, opts);
3663
+ if (logObj.type === "box") return "\n" + [
3664
+ bracket(logObj.tag),
3665
+ logObj.title && logObj.title,
3666
+ ...message.split("\n")
3667
+ ].filter(Boolean).map((l$1) => " > " + l$1).join("\n") + "\n";
3668
+ return this.filterAndJoin([
3669
+ bracket(logObj.type),
3670
+ bracket(logObj.tag),
3671
+ message
3672
+ ]);
3673
+ }
3674
+ log(logObj, ctx) {
3675
+ const line = this.formatLogObj(logObj, {
3676
+ columns: ctx.options.stdout.columns || 0,
3677
+ ...ctx.options.formatOptions
3678
+ });
3679
+ return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
3680
+ }
3681
+ };
3682
+
3683
+ //#endregion
3684
+ //#region node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
3685
+ const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
3686
+ const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
3687
+ const isForced = "FORCE_COLOR" in env || argv.includes("--color");
3688
+ const isWindows = platform === "win32";
3689
+ const isDumbTerminal = env.TERM === "dumb";
3690
+ const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
3691
+ const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
3692
+ const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
3693
+ function replaceClose(index, string$1, close, replace, head = string$1.slice(0, Math.max(0, index)) + replace, tail = string$1.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
3694
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
3695
+ }
3696
+ function clearBleed(index, string$1, open, close, replace) {
3697
+ return index < 0 ? open + string$1 + close : open + replaceClose(index, string$1, close, replace) + close;
3698
+ }
3699
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
3700
+ return (string$1) => string$1 || !(string$1 === "" || string$1 === void 0) ? clearBleed(("" + string$1).indexOf(close, at), string$1, open, close, replace) : "";
3701
+ }
3702
+ function init(open, close, replace) {
3703
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
3704
+ }
3705
+ const colorDefs = {
3706
+ reset: init(0, 0),
3707
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
3708
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
3709
+ italic: init(3, 23),
3710
+ underline: init(4, 24),
3711
+ inverse: init(7, 27),
3712
+ hidden: init(8, 28),
3713
+ strikethrough: init(9, 29),
3714
+ black: init(30, 39),
3715
+ red: init(31, 39),
3716
+ green: init(32, 39),
3717
+ yellow: init(33, 39),
3718
+ blue: init(34, 39),
3719
+ magenta: init(35, 39),
3720
+ cyan: init(36, 39),
3721
+ white: init(37, 39),
3722
+ gray: init(90, 39),
3723
+ bgBlack: init(40, 49),
3724
+ bgRed: init(41, 49),
3725
+ bgGreen: init(42, 49),
3726
+ bgYellow: init(43, 49),
3727
+ bgBlue: init(44, 49),
3728
+ bgMagenta: init(45, 49),
3729
+ bgCyan: init(46, 49),
3730
+ bgWhite: init(47, 49),
3731
+ blackBright: init(90, 39),
3732
+ redBright: init(91, 39),
3733
+ greenBright: init(92, 39),
3734
+ yellowBright: init(93, 39),
3735
+ blueBright: init(94, 39),
3736
+ magentaBright: init(95, 39),
3737
+ cyanBright: init(96, 39),
3738
+ whiteBright: init(97, 39),
3739
+ bgBlackBright: init(100, 49),
3740
+ bgRedBright: init(101, 49),
3741
+ bgGreenBright: init(102, 49),
3742
+ bgYellowBright: init(103, 49),
3743
+ bgBlueBright: init(104, 49),
3744
+ bgMagentaBright: init(105, 49),
3745
+ bgCyanBright: init(106, 49),
3746
+ bgWhiteBright: init(107, 49)
3747
+ };
3748
+ function createColors(useColor = isColorSupported) {
3749
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
3750
+ }
3751
+ const colors = createColors();
3752
+ function getColor$1(color, fallback = "reset") {
3753
+ return colors[color] || colors[fallback];
3754
+ }
3755
+ const ansiRegex$1 = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
3756
+ function stripAnsi$1(text) {
3757
+ return text.replace(new RegExp(ansiRegex$1, "g"), "");
3758
+ }
3759
+ const boxStylePresets = {
3760
+ solid: {
3761
+ tl: "┌",
3762
+ tr: "┐",
3763
+ bl: "└",
3764
+ br: "┘",
3765
+ h: "─",
3766
+ v: "│"
3767
+ },
3768
+ double: {
3769
+ tl: "╔",
3770
+ tr: "╗",
3771
+ bl: "╚",
3772
+ br: "╝",
3773
+ h: "═",
3774
+ v: "║"
3775
+ },
3776
+ doubleSingle: {
3777
+ tl: "╓",
3778
+ tr: "╖",
3779
+ bl: "╙",
3780
+ br: "╜",
3781
+ h: "─",
3782
+ v: "║"
3783
+ },
3784
+ doubleSingleRounded: {
3785
+ tl: "╭",
3786
+ tr: "╮",
3787
+ bl: "╰",
3788
+ br: "╯",
3789
+ h: "─",
3790
+ v: "║"
3791
+ },
3792
+ singleThick: {
3793
+ tl: "┏",
3794
+ tr: "┓",
3795
+ bl: "┗",
3796
+ br: "┛",
3797
+ h: "━",
3798
+ v: "┃"
3799
+ },
3800
+ singleDouble: {
3801
+ tl: "╒",
3802
+ tr: "╕",
3803
+ bl: "╘",
3804
+ br: "╛",
3805
+ h: "═",
3806
+ v: "│"
3807
+ },
3808
+ singleDoubleRounded: {
3809
+ tl: "╭",
3810
+ tr: "╮",
3811
+ bl: "╰",
3812
+ br: "╯",
3813
+ h: "═",
3814
+ v: "│"
3815
+ },
3816
+ rounded: {
3817
+ tl: "╭",
3818
+ tr: "╮",
3819
+ bl: "╰",
3820
+ br: "╯",
3821
+ h: "─",
3822
+ v: "│"
3823
+ }
3824
+ };
3825
+ const defaultStyle = {
3826
+ borderColor: "white",
3827
+ borderStyle: "rounded",
3828
+ valign: "center",
3829
+ padding: 2,
3830
+ marginLeft: 1,
3831
+ marginTop: 1,
3832
+ marginBottom: 1
3833
+ };
3834
+ function box(text, _opts = {}) {
3835
+ const opts = {
3836
+ ..._opts,
3837
+ style: {
3838
+ ...defaultStyle,
3839
+ ..._opts.style
3840
+ }
3841
+ };
3842
+ const textLines = text.split("\n");
3843
+ const boxLines = [];
3844
+ const _color = getColor$1(opts.style.borderColor);
3845
+ const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
3846
+ if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
3847
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
3848
+ const height = textLines.length + paddingOffset;
3849
+ const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length), opts.title ? stripAnsi$1(opts.title).length : 0) + paddingOffset;
3850
+ const widthOffset = width + paddingOffset;
3851
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
3852
+ if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
3853
+ if (opts.title) {
3854
+ const title = _color ? _color(opts.title) : opts.title;
3855
+ const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
3856
+ const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
3857
+ boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
3858
+ } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
3859
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
3860
+ for (let i$1 = 0; i$1 < height; i$1++) if (i$1 < valignOffset || i$1 >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
3861
+ else {
3862
+ const line = textLines[i$1 - valignOffset];
3863
+ const left = " ".repeat(paddingOffset);
3864
+ const right = " ".repeat(width - stripAnsi$1(line).length);
3865
+ boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
3866
+ }
3867
+ boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
3868
+ if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
3869
+ return boxLines.join("\n");
3870
+ }
3871
+
3872
+ //#endregion
3873
+ //#region node_modules/consola/dist/index.mjs
3874
+ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
3875
+ get(e, s$1) {
3876
+ return i()[s$1] ?? r[s$1];
3877
+ },
3878
+ has(e, s$1) {
3879
+ const E = i();
3880
+ return s$1 in E || s$1 in r;
3881
+ },
3882
+ set(e, s$1, E) {
3883
+ const B = i(true);
3884
+ return B[s$1] = E, true;
3885
+ },
3886
+ deleteProperty(e, s$1) {
3887
+ if (!s$1) return false;
3888
+ const E = i(true);
3889
+ return delete E[s$1], true;
3890
+ },
3891
+ ownKeys() {
3892
+ const e = i(true);
3893
+ return Object.keys(e);
3894
+ }
3895
+ }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
3896
+ ["APPVEYOR"],
3897
+ [
3898
+ "AWS_AMPLIFY",
3899
+ "AWS_APP_ID",
3900
+ { ci: true }
3901
+ ],
3902
+ ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
3903
+ ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
3904
+ ["APPCIRCLE", "AC_APPCIRCLE"],
3905
+ ["BAMBOO", "bamboo_planKey"],
3906
+ ["BITBUCKET", "BITBUCKET_COMMIT"],
3907
+ ["BITRISE", "BITRISE_IO"],
3908
+ ["BUDDY", "BUDDY_WORKSPACE_ID"],
3909
+ ["BUILDKITE"],
3910
+ ["CIRCLE", "CIRCLECI"],
3911
+ ["CIRRUS", "CIRRUS_CI"],
3912
+ [
3913
+ "CLOUDFLARE_PAGES",
3914
+ "CF_PAGES",
3915
+ { ci: true }
3916
+ ],
3917
+ ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
3918
+ ["CODEFRESH", "CF_BUILD_ID"],
3919
+ ["DRONE"],
3920
+ ["DRONE", "DRONE_BUILD_EVENT"],
3921
+ ["DSARI"],
3922
+ ["GITHUB_ACTIONS"],
3923
+ ["GITLAB", "GITLAB_CI"],
3924
+ ["GITLAB", "CI_MERGE_REQUEST_ID"],
3925
+ ["GOCD", "GO_PIPELINE_LABEL"],
3926
+ ["LAYERCI"],
3927
+ ["HUDSON", "HUDSON_URL"],
3928
+ ["JENKINS", "JENKINS_URL"],
3929
+ ["MAGNUM"],
3930
+ ["NETLIFY"],
3931
+ [
3932
+ "NETLIFY",
3933
+ "NETLIFY_LOCAL",
3934
+ { ci: false }
3935
+ ],
3936
+ ["NEVERCODE"],
3937
+ ["RENDER"],
3938
+ ["SAIL", "SAILCI"],
3939
+ ["SEMAPHORE"],
3940
+ ["SCREWDRIVER"],
3941
+ ["SHIPPABLE"],
3942
+ ["SOLANO", "TDDIUM"],
3943
+ ["STRIDER"],
3944
+ ["TEAMCITY", "TEAMCITY_VERSION"],
3945
+ ["TRAVIS"],
3946
+ ["VERCEL", "NOW_BUILDER"],
3947
+ [
3948
+ "VERCEL",
3949
+ "VERCEL",
3950
+ { ci: false }
3951
+ ],
3952
+ [
3953
+ "VERCEL",
3954
+ "VERCEL_ENV",
3955
+ { ci: false }
3956
+ ],
3957
+ ["APPCENTER", "APPCENTER_BUILD_ID"],
3958
+ [
3959
+ "CODESANDBOX",
3960
+ "CODESANDBOX_SSE",
3961
+ { ci: false }
3962
+ ],
3963
+ [
3964
+ "CODESANDBOX",
3965
+ "CODESANDBOX_HOST",
3966
+ { ci: false }
3967
+ ],
3968
+ ["STACKBLITZ"],
3969
+ ["STORMKIT"],
3970
+ ["CLEAVR"],
3971
+ ["ZEABUR"],
3972
+ [
3973
+ "CODESPHERE",
3974
+ "CODESPHERE_APP_ID",
3975
+ { ci: true }
3976
+ ],
3977
+ ["RAILWAY", "RAILWAY_PROJECT_ID"],
3978
+ ["RAILWAY", "RAILWAY_SERVICE_ID"],
3979
+ ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
3980
+ [
3981
+ "FIREBASE_APP_HOSTING",
3982
+ "FIREBASE_APP_HOSTING",
3983
+ { ci: true }
3984
+ ]
3985
+ ];
3986
+ function b() {
3987
+ if (globalThis.process?.env) for (const e of f) {
3988
+ const s$1 = e[1] || e[0];
3989
+ if (globalThis.process?.env[s$1]) return {
3990
+ name: e[0].toLowerCase(),
3991
+ ...e[2]
3992
+ };
3993
+ }
3994
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
3995
+ name: "stackblitz",
3996
+ ci: false
3997
+ } : {
3998
+ name: "",
3999
+ ci: false
4000
+ };
4001
+ }
4002
+ const l = b();
4003
+ l.name;
4004
+ function n(e) {
4005
+ return e ? e !== "false" : false;
4006
+ }
4007
+ const I = globalThis.process?.platform || "", T = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R = t === "test" || n(o.TEST);
4008
+ n(o.MINIMAL);
4009
+ const A = /^win/i.test(I);
4010
+ !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
4011
+ const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
4012
+ Number(C?.split(".")[0]);
4013
+ const y = globalThis.process || Object.create(null), _ = { versions: {} };
4014
+ new Proxy(y, { get(e, s$1) {
4015
+ if (s$1 === "env") return o;
4016
+ if (s$1 in e) return e[s$1];
4017
+ if (s$1 in _) return _[s$1];
4018
+ } });
4019
+ const c = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
4020
+ [S, "netlify"],
4021
+ [u, "edge-light"],
4022
+ [N, "workerd"],
4023
+ [L, "fastly"],
4024
+ [D, "deno"],
4025
+ [O, "bun"],
4026
+ [c, "node"]
4027
+ ];
4028
+ function G() {
4029
+ const e = F.find((s$1) => s$1[0]);
4030
+ if (e) return { name: e[1] };
4031
+ }
4032
+ const P = G();
4033
+ P?.name;
4034
+ function ansiRegex({ onlyFirst = false } = {}) {
4035
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
4036
+ const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
4037
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
4038
+ }
4039
+ const regex = ansiRegex();
4040
+ function stripAnsi(string$1) {
4041
+ if (typeof string$1 !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string$1}\``);
4042
+ return string$1.replace(regex, "");
4043
+ }
4044
+ function isAmbiguous(x) {
4045
+ 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;
4046
+ }
4047
+ function isFullWidth(x) {
4048
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
4049
+ }
4050
+ function isWide(x) {
4051
+ 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 === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || 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 <= 128727 || 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 <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
4052
+ }
4053
+ function validate(codePoint) {
4054
+ if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
4055
+ }
4056
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
4057
+ validate(codePoint);
4058
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
4059
+ return 1;
4060
+ }
4061
+ const emojiRegex = () => {
4062
+ 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\uDC70\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-\uDED7\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\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\uDD3D\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-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\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]|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\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;
4063
+ };
4064
+ const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
4065
+ const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
4066
+ function stringWidth$1(string$1, options = {}) {
4067
+ if (typeof string$1 !== "string" || string$1.length === 0) return 0;
4068
+ const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
4069
+ if (!countAnsiEscapeCodes) string$1 = stripAnsi(string$1);
4070
+ if (string$1.length === 0) return 0;
4071
+ let width = 0;
4072
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
4073
+ for (const { segment: character } of segmenter.segment(string$1)) {
4074
+ const codePoint = character.codePointAt(0);
4075
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
4076
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
4077
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
4078
+ if (codePoint >= 55296 && codePoint <= 57343) continue;
4079
+ if (codePoint >= 65024 && codePoint <= 65039) continue;
4080
+ if (defaultIgnorableCodePointRegex.test(character)) continue;
4081
+ if (emojiRegex().test(character)) {
4082
+ width += 2;
4083
+ continue;
4084
+ }
4085
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
4086
+ }
4087
+ return width;
4088
+ }
4089
+ function isUnicodeSupported() {
4090
+ const { env: env$1 } = process$1;
4091
+ const { TERM, TERM_PROGRAM } = env$1;
4092
+ if (process$1.platform !== "win32") return TERM !== "linux";
4093
+ return Boolean(env$1.WT_SESSION) || Boolean(env$1.TERMINUS_SUBLIME) || env$1.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env$1.TERMINAL_EMULATOR === "JetBrains-JediTerm";
4094
+ }
4095
+ const TYPE_COLOR_MAP = {
4096
+ info: "cyan",
4097
+ fail: "red",
4098
+ success: "green",
4099
+ ready: "green",
4100
+ start: "magenta"
4101
+ };
4102
+ const LEVEL_COLOR_MAP = {
4103
+ 0: "red",
4104
+ 1: "yellow"
4105
+ };
4106
+ const unicode = isUnicodeSupported();
4107
+ const s = (c$1, fallback) => unicode ? c$1 : fallback;
4108
+ const TYPE_ICONS = {
4109
+ error: s("✖", "×"),
4110
+ fatal: s("✖", "×"),
4111
+ ready: s("✔", "√"),
4112
+ warn: s("⚠", "‼"),
4113
+ info: s("ℹ", "i"),
4114
+ success: s("✔", "√"),
4115
+ debug: s("⚙", "D"),
4116
+ trace: s("→", "→"),
4117
+ fail: s("✖", "×"),
4118
+ start: s("◐", "o"),
4119
+ log: ""
4120
+ };
4121
+ function stringWidth(str) {
4122
+ const hasICU = typeof Intl === "object";
4123
+ if (!hasICU || !Intl.Segmenter) return stripAnsi$1(str).length;
4124
+ return stringWidth$1(str);
4125
+ }
4126
+ var FancyReporter = class extends BasicReporter {
4127
+ formatStack(stack, message, opts) {
4128
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
4129
+ return `
4130
+ ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors.cyan(m)})`)).join(`
4131
+ ${indent}`);
4132
+ }
4133
+ formatType(logObj, isBadge, opts) {
4134
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
4135
+ if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
4136
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
4137
+ return _type ? getColor(typeColor)(_type) : "";
4138
+ }
4139
+ formatLogObj(logObj, opts) {
4140
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
4141
+ if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
4142
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
4143
+ style: logObj.style
4144
+ });
4145
+ const date = this.formatDate(logObj.date, opts);
4146
+ const coloredDate = date && colors.gray(date);
4147
+ const isBadge = logObj.badge ?? logObj.level < 2;
4148
+ const type = this.formatType(logObj, isBadge, opts);
4149
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
4150
+ let line;
4151
+ const left = this.filterAndJoin([type, characterFormat(message)]);
4152
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
4153
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
4154
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
4155
+ line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
4156
+ if (logObj.type === "trace") {
4157
+ const _err = new Error("Trace: " + logObj.message);
4158
+ line += this.formatStack(_err.stack || "", _err.message);
4159
+ }
4160
+ return isBadge ? "\n" + line + "\n" : line;
4161
+ }
4162
+ };
4163
+ function characterFormat(str) {
4164
+ return str.replace(/`([^`]+)`/gm, (_$1, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors.underline(m)} `);
4165
+ }
4166
+ function getColor(color = "white") {
4167
+ return colors[color] || colors.white;
4168
+ }
4169
+ function getBgColor(color = "bgWhite") {
4170
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
4171
+ }
4172
+ function createConsola(options = {}) {
4173
+ let level = _getDefaultLogLevel();
4174
+ if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
4175
+ const consola2 = createConsola$1({
4176
+ level,
4177
+ defaults: { level },
4178
+ stdout: process.stdout,
4179
+ stderr: process.stderr,
4180
+ prompt: (...args) => import("./prompt-_w55ddDU.js").then((m) => m.prompt(...args)),
4181
+ reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
4182
+ ...options
4183
+ });
4184
+ return consola2;
4185
+ }
4186
+ function _getDefaultLogLevel() {
4187
+ if (g) return LogLevels.debug;
4188
+ if (R) return LogLevels.warn;
4189
+ return LogLevels.info;
4190
+ }
4191
+ const consola = createConsola();
4192
+
4193
+ //#endregion
4194
+ //#region package.json
4195
+ var name = "ccusage";
4196
+ var version = "0.4.0";
4197
+ var description = "Usage analysis tool for Claude Code";
4198
+
4199
+ //#endregion
4200
+ //#region logger.ts
4201
+ const logger = consola.withTag(name);
4202
+ const log = (...args) => logger.log(...args);
4203
+
4204
+ //#endregion
4205
+ //#region pricing-fetcher.ts
4206
+ const ModelPricingSchema = object({
4207
+ input_cost_per_token: optional(number()),
4208
+ output_cost_per_token: optional(number()),
4209
+ cache_creation_input_token_cost: optional(number()),
4210
+ cache_read_input_token_cost: optional(number())
4211
+ });
4212
+ const LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
4213
+ let cachedPricing = null;
4214
+ async function fetchModelPricing() {
4215
+ if (cachedPricing) return cachedPricing;
4216
+ try {
4217
+ logger.info("Fetching latest model pricing from LiteLLM...");
4218
+ const response = await fetch(LITELLM_PRICING_URL);
4219
+ if (!response.ok) throw new Error(`Failed to fetch pricing data: ${response.statusText}`);
4220
+ const data = await response.json();
4221
+ const pricing = {};
4222
+ for (const [modelName, modelData] of Object.entries(data)) if (typeof modelData === "object" && modelData !== null) try {
4223
+ const parsed = parse(ModelPricingSchema, modelData);
4224
+ pricing[modelName] = parsed;
4225
+ } catch {}
4226
+ cachedPricing = pricing;
4227
+ logger.info(`Loaded pricing for ${Object.keys(pricing).length} models`);
4228
+ return pricing;
4229
+ } catch (error) {
4230
+ logger.error("Failed to fetch model pricing:", error);
4231
+ throw new Error("Could not fetch model pricing data");
4232
+ }
4233
+ }
4234
+ function getModelPricing(modelName, pricing) {
4235
+ if (pricing[modelName]) return pricing[modelName];
4236
+ const variations = [
4237
+ modelName,
4238
+ `anthropic/${modelName}`,
4239
+ `claude-3-5-${modelName}`,
4240
+ `claude-3-${modelName}`,
4241
+ `claude-${modelName}`
4242
+ ];
4243
+ for (const variant of variations) if (pricing[variant]) return pricing[variant];
4244
+ const lowerModel = modelName.toLowerCase();
4245
+ for (const [key, value] of Object.entries(pricing)) if (key.toLowerCase().includes(lowerModel) || lowerModel.includes(key.toLowerCase())) return value;
4246
+ return null;
4247
+ }
4248
+ function calculateCostFromTokens(tokens, pricing) {
4249
+ let cost = 0;
4250
+ if (pricing.input_cost_per_token) cost += tokens.input_tokens * pricing.input_cost_per_token;
4251
+ if (pricing.output_cost_per_token) cost += tokens.output_tokens * pricing.output_cost_per_token;
4252
+ if (tokens.cache_creation_input_tokens && pricing.cache_creation_input_token_cost) cost += tokens.cache_creation_input_tokens * pricing.cache_creation_input_token_cost;
4253
+ if (tokens.cache_read_input_tokens && pricing.cache_read_input_token_cost) cost += tokens.cache_read_input_tokens * pricing.cache_read_input_token_cost;
4254
+ return cost;
4255
+ }
4256
+
3165
4257
  //#endregion
3166
4258
  //#region data-loader.ts
3167
4259
  const getDefaultClaudePath = () => path.join(homedir(), ".claude");
3168
4260
  const UsageDataSchema = object({
3169
4261
  timestamp: string(),
3170
- message: object({ usage: object({
3171
- input_tokens: number(),
3172
- output_tokens: number(),
3173
- cache_creation_input_tokens: optional(number()),
3174
- cache_read_input_tokens: optional(number())
3175
- }) }),
3176
- costUSD: number()
4262
+ version: optional(string()),
4263
+ message: object({
4264
+ usage: object({
4265
+ input_tokens: number(),
4266
+ output_tokens: number(),
4267
+ cache_creation_input_tokens: optional(number()),
4268
+ cache_read_input_tokens: optional(number())
4269
+ }),
4270
+ model: optional(string())
4271
+ }),
4272
+ costUSD: optional(number())
3177
4273
  });
3178
4274
  const DailyUsageSchema = object({
3179
4275
  date: string(),
@@ -3191,7 +4287,8 @@ const SessionUsageSchema = object({
3191
4287
  cacheCreationTokens: number(),
3192
4288
  cacheReadTokens: number(),
3193
4289
  totalCost: number(),
3194
- lastActivity: string()
4290
+ lastActivity: string(),
4291
+ versions: array(string())
3195
4292
  });
3196
4293
  const formatDate = (dateStr) => {
3197
4294
  const date = new Date(dateStr);
@@ -3200,6 +4297,22 @@ const formatDate = (dateStr) => {
3200
4297
  const day = String(date.getDate()).padStart(2, "0");
3201
4298
  return `${year}-${month}-${day}`;
3202
4299
  };
4300
+ const calculateCostForEntry = (data, mode, modelPricing) => {
4301
+ if (mode === "display") return data.costUSD ?? 0;
4302
+ if (mode === "calculate") {
4303
+ if (data.message.model) {
4304
+ const pricing = getModelPricing(data.message.model, modelPricing);
4305
+ if (pricing) return calculateCostFromTokens(data.message.usage, pricing);
4306
+ }
4307
+ return 0;
4308
+ }
4309
+ if (data.costUSD !== void 0) return data.costUSD;
4310
+ if (data.message.model) {
4311
+ const pricing = getModelPricing(data.message.model, modelPricing);
4312
+ if (pricing) return calculateCostFromTokens(data.message.usage, pricing);
4313
+ }
4314
+ return 0;
4315
+ };
3203
4316
  async function loadUsageData(options) {
3204
4317
  const claudePath = options?.claudePath ?? getDefaultClaudePath();
3205
4318
  const claudeDir = path.join(claudePath, "projects");
@@ -3208,6 +4321,8 @@ async function loadUsageData(options) {
3208
4321
  absolute: true
3209
4322
  });
3210
4323
  if (files.length === 0) return [];
4324
+ const mode = options?.mode || "auto";
4325
+ const modelPricing = mode === "display" ? {} : await fetchModelPricing();
3211
4326
  const dailyMap = new Map();
3212
4327
  for (const file of files) {
3213
4328
  const content = await readFile(file, "utf-8");
@@ -3226,11 +4341,12 @@ async function loadUsageData(options) {
3226
4341
  cacheReadTokens: 0,
3227
4342
  totalCost: 0
3228
4343
  };
3229
- existing.inputTokens += data.message.usage.input_tokens || 0;
3230
- existing.outputTokens += data.message.usage.output_tokens || 0;
3231
- existing.cacheCreationTokens += data.message.usage.cache_creation_input_tokens || 0;
3232
- existing.cacheReadTokens += data.message.usage.cache_read_input_tokens || 0;
3233
- existing.totalCost += data.costUSD || 0;
4344
+ existing.inputTokens += data.message.usage.input_tokens ?? 0;
4345
+ existing.outputTokens += data.message.usage.output_tokens ?? 0;
4346
+ existing.cacheCreationTokens += data.message.usage.cache_creation_input_tokens ?? 0;
4347
+ existing.cacheReadTokens += data.message.usage.cache_read_input_tokens ?? 0;
4348
+ const cost = calculateCostForEntry(data, mode, modelPricing);
4349
+ existing.totalCost += cost;
3234
4350
  dailyMap.set(date, existing);
3235
4351
  } catch (e) {}
3236
4352
  }
@@ -3251,6 +4367,8 @@ async function loadSessionData(options) {
3251
4367
  absolute: true
3252
4368
  });
3253
4369
  if (files.length === 0) return [];
4370
+ const mode = options?.mode || "auto";
4371
+ const modelPricing = mode === "display" ? {} : await fetchModelPricing();
3254
4372
  const sessionMap = new Map();
3255
4373
  for (const file of files) {
3256
4374
  const relativePath = path.relative(claudeDir, file);
@@ -3274,29 +4392,39 @@ async function loadSessionData(options) {
3274
4392
  cacheCreationTokens: 0,
3275
4393
  cacheReadTokens: 0,
3276
4394
  totalCost: 0,
3277
- lastActivity: ""
4395
+ lastActivity: "",
4396
+ versions: [],
4397
+ versionSet: new Set()
3278
4398
  };
3279
- existing.inputTokens += data.message.usage.input_tokens || 0;
3280
- existing.outputTokens += data.message.usage.output_tokens || 0;
3281
- existing.cacheCreationTokens += data.message.usage.cache_creation_input_tokens || 0;
3282
- existing.cacheReadTokens += data.message.usage.cache_read_input_tokens || 0;
3283
- existing.totalCost += data.costUSD || 0;
4399
+ existing.inputTokens += data.message.usage.input_tokens ?? 0;
4400
+ existing.outputTokens += data.message.usage.output_tokens ?? 0;
4401
+ existing.cacheCreationTokens += data.message.usage.cache_creation_input_tokens ?? 0;
4402
+ existing.cacheReadTokens += data.message.usage.cache_read_input_tokens ?? 0;
4403
+ const cost = calculateCostForEntry(data, mode, modelPricing);
4404
+ existing.totalCost += cost;
3284
4405
  if (data.timestamp > lastTimestamp) {
3285
4406
  lastTimestamp = data.timestamp;
3286
4407
  existing.lastActivity = formatDate(data.timestamp);
3287
4408
  }
4409
+ if (data.version) existing.versionSet.add(data.version);
3288
4410
  sessionMap.set(key, existing);
3289
4411
  } catch (e) {}
3290
4412
  }
3291
- let results = Array.from(sessionMap.values());
4413
+ let results = Array.from(sessionMap.values()).map((session) => {
4414
+ const { versionSet,...sessionData } = session;
4415
+ return {
4416
+ ...sessionData,
4417
+ versions: Array.from(versionSet).sort()
4418
+ };
4419
+ });
3292
4420
  if (options?.since || options?.until) results = results.filter((session) => {
3293
4421
  const dateStr = session.lastActivity.replace(/-/g, "");
3294
4422
  if (options.since && dateStr < options.since) return false;
3295
4423
  if (options.until && dateStr > options.until) return false;
3296
4424
  return true;
3297
4425
  });
3298
- return sort(results).desc((item) => item.totalCost);
4426
+ return sort(results).desc((item) => new Date(item.lastActivity).getTime());
3299
4427
  }
3300
4428
 
3301
4429
  //#endregion
3302
- export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, boolean, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union };
4430
+ export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, boolean, calculateCostForEntry, calculateCostFromTokens, description, fetchModelPricing, formatDate, getDefaultClaudePath, getModelPricing, glob, loadSessionData, loadUsageData, log, logger, name, number, object, optional, pipe, record, regex$1 as regex, safeParse, string, union, version };