ccusage 0.4.1 → 0.5.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.
Files changed (46) hide show
  1. package/README.md +68 -0
  2. package/dist/arktype-C-GObzDh-Dj1DVoqC.js +5 -0
  3. package/dist/{calculate-cost-DMC4FhU4.js → calculate-cost-2IwHSzmi.js} +1 -1
  4. package/dist/calculate-cost.d.ts +5 -2
  5. package/dist/calculate-cost.js +1 -1
  6. package/dist/core-BgFXUe_h.js +693 -0
  7. package/dist/data-loader-LMCrJ-lW.d.ts +56 -0
  8. package/dist/{data-loader-BBdPk24U.js → data-loader-r5ZcMQy7.js} +122 -1608
  9. package/dist/data-loader.d.ts +4 -1
  10. package/dist/data-loader.js +4 -1
  11. package/dist/debug-BVxGf4UL.js +142 -0
  12. package/dist/debug.d.ts +39 -0
  13. package/dist/debug.js +7 -0
  14. package/dist/dist-C_i5I27w.js +469 -0
  15. package/dist/dist-FwNhpFrW.js +491 -0
  16. package/dist/effect-WSjEuzC9-BsxP11fz.js +10 -0
  17. package/dist/esm-vjyZjnpZ.js +1090 -0
  18. package/dist/{data-loader-D1LHcGfa.d.ts → index-BurjgCfW.d.ts} +323 -76
  19. package/dist/index-CISmcbXk-BotItq1T.js +23 -0
  20. package/dist/index.js +72 -265
  21. package/dist/logger-Cu4Ir1a5.js +977 -0
  22. package/dist/logger.d.ts +10 -0
  23. package/dist/logger.js +3 -0
  24. package/dist/mcp-DAzj5Pua.js +37580 -0
  25. package/dist/mcp.d.ts +15 -0
  26. package/dist/mcp.js +10 -0
  27. package/dist/pricing-fetcher-B5yPtoTB.js +60 -0
  28. package/dist/pricing-fetcher-DygIroMj.d.ts +21 -0
  29. package/dist/pricing-fetcher.d.ts +3 -0
  30. package/dist/pricing-fetcher.js +5 -0
  31. package/dist/shared-args-DN3jRldX.js +61 -0
  32. package/dist/shared-args.d.ts +94 -0
  33. package/dist/shared-args.js +8 -0
  34. package/dist/sury-DmrZ3_Oj-DhGOjCNc.js +10 -0
  35. package/dist/types-B3ib19os.d.ts +79 -0
  36. package/dist/types-CFnCBr2I.js +3586 -0
  37. package/dist/types-DFrbJmnT.js +41 -0
  38. package/dist/types.d.ts +3 -0
  39. package/dist/types.js +4 -0
  40. package/dist/utils-C7kg8MXN.js +10 -0
  41. package/dist/utils.d.ts +5 -0
  42. package/dist/utils.js +3 -0
  43. package/dist/valibot-CQk-M5rL-Cq5E7F3g.js +10 -0
  44. package/dist/zod-Db63SLXj-BWdcigdx.js +30 -0
  45. package/package.json +8 -1
  46. /package/dist/{prompt-_w55ddDU.js → prompt-IToGuko2.js} +0 -0
@@ -1,11 +1,10 @@
1
+ import { array, number, object, optional, safeParse, string } from "./dist-FwNhpFrW.js";
2
+ import { calculateCostFromTokens, fetchModelPricing, getModelPricing } from "./pricing-fetcher-B5yPtoTB.js";
1
3
  import { createRequire } from "node:module";
2
4
  import { readFile } from "node:fs/promises";
3
5
  import { homedir } from "node:os";
4
- import path, { sep } from "node:path";
6
+ import path from "node:path";
5
7
  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";
9
8
 
10
9
  //#region rolldown:runtime
11
10
  var __create = Object.create;
@@ -18,8 +17,8 @@ var __commonJS = (cb, mod) => function() {
18
17
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
18
  };
20
19
  var __copyProps = (to, from, except, desc) => {
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
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
23
22
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
23
  get: ((k) => from[k]).bind(null, key),
25
24
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -36,8 +35,8 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
35
  //#endregion
37
36
  //#region node_modules/fast-sort/dist/sort.mjs
38
37
  var castComparer = function(comparer) {
39
- return function(a$1, b$1, order) {
40
- return comparer(a$1, b$1, order) * order;
38
+ return function(a, b, order) {
39
+ return comparer(a, b, order) * order;
41
40
  };
42
41
  };
43
42
  var throwInvalidConfigErrorIfTrue = function(condition, context) {
@@ -57,41 +56,41 @@ var unpackObjectSorter = function(sortByObj) {
57
56
  };
58
57
  };
59
58
  var multiPropertySorterProvider = function(defaultComparer$1) {
60
- return function multiPropertySorter(sortBy, sortByArr, depth$1, order, comparer, a$1, b$1) {
59
+ return function multiPropertySorter(sortBy, sortByArr, depth$1, order, comparer, a, b) {
61
60
  var valA;
62
61
  var valB;
63
62
  if (typeof sortBy === "string") {
64
- valA = a$1[sortBy];
65
- valB = b$1[sortBy];
63
+ valA = a[sortBy];
64
+ valB = b[sortBy];
66
65
  } else if (typeof sortBy === "function") {
67
- valA = sortBy(a$1);
68
- valB = sortBy(b$1);
66
+ valA = sortBy(a);
67
+ valB = sortBy(b);
69
68
  } else {
70
69
  var objectSorterConfig = unpackObjectSorter(sortBy);
71
- return multiPropertySorter(objectSorterConfig.sortBy, sortByArr, depth$1, objectSorterConfig.order, objectSorterConfig.comparer || defaultComparer$1, a$1, b$1);
70
+ return multiPropertySorter(objectSorterConfig.sortBy, sortByArr, depth$1, objectSorterConfig.order, objectSorterConfig.comparer || defaultComparer$1, a, b);
72
71
  }
73
72
  var equality = comparer(valA, valB, order);
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);
73
+ if ((equality === 0 || valA == null && valB == null) && sortByArr.length > depth$1) return multiPropertySorter(sortByArr[depth$1], sortByArr, depth$1 + 1, order, comparer, a, b);
75
74
  return equality;
76
75
  };
77
76
  };
78
77
  function getSortStrategy(sortBy, comparer, order) {
79
- if (sortBy === void 0 || sortBy === true) return function(a$1, b$1) {
80
- return comparer(a$1, b$1, order);
78
+ if (sortBy === void 0 || sortBy === true) return function(a, b) {
79
+ return comparer(a, b, order);
81
80
  };
82
81
  if (typeof sortBy === "string") {
83
82
  throwInvalidConfigErrorIfTrue(sortBy.includes("."), "String syntax not allowed for nested properties.");
84
- return function(a$1, b$1) {
85
- return comparer(a$1[sortBy], b$1[sortBy], order);
83
+ return function(a, b) {
84
+ return comparer(a[sortBy], b[sortBy], order);
86
85
  };
87
86
  }
88
- if (typeof sortBy === "function") return function(a$1, b$1) {
89
- return comparer(sortBy(a$1), sortBy(b$1), order);
87
+ if (typeof sortBy === "function") return function(a, b) {
88
+ return comparer(sortBy(a), sortBy(b), order);
90
89
  };
91
90
  if (Array.isArray(sortBy)) {
92
91
  var multiPropSorter_1 = multiPropertySorterProvider(comparer);
93
- return function(a$1, b$1) {
94
- return multiPropSorter_1(sortBy[0], sortBy, 1, order, comparer, a$1, b$1);
92
+ return function(a, b) {
93
+ return multiPropSorter_1(sortBy[0], sortBy, 1, order, comparer, a, b);
95
94
  };
96
95
  }
97
96
  var objectSorterConfig = unpackObjectSorter(sortBy);
@@ -120,12 +119,12 @@ function createNewSortInstance(opts) {
120
119
  };
121
120
  };
122
121
  }
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;
122
+ var defaultComparer = function(a, b, order) {
123
+ if (a == null) return order;
124
+ if (b == null) return -order;
125
+ if (typeof a !== typeof b) return typeof a < typeof b ? -1 : 1;
126
+ if (a < b) return -1;
127
+ if (a > b) return 1;
129
128
  return 0;
130
129
  };
131
130
  var sort = createNewSortInstance({ comparer: defaultComparer });
@@ -302,21 +301,21 @@ var require_resolve_symlink = __commonJS({ "node_modules/fdir/dist/api/functions
302
301
  const fs_1$1 = __importDefault$1(__require("fs"));
303
302
  const path_1$2 = __require("path");
304
303
  const resolveSymlinksAsync = function(path$2, state, callback$1) {
305
- const { queue: queue$1, options: { suppressErrors } } = state;
306
- queue$1.enqueue();
304
+ const { queue, options: { suppressErrors } } = state;
305
+ queue.enqueue();
307
306
  fs_1$1.default.realpath(path$2, (error, resolvedPath) => {
308
- if (error) return queue$1.dequeue(suppressErrors ? null : error, state);
307
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
309
308
  fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
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
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
310
+ if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue.dequeue(null, state);
312
311
  callback$1(stat, resolvedPath);
313
- queue$1.dequeue(null, state);
312
+ queue.dequeue(null, state);
314
313
  });
315
314
  });
316
315
  };
317
316
  const resolveSymlinks = function(path$2, state, callback$1) {
318
- const { queue: queue$1, options: { suppressErrors } } = state;
319
- queue$1.enqueue();
317
+ const { queue, options: { suppressErrors } } = state;
318
+ queue.enqueue();
320
319
  try {
321
320
  const resolvedPath = fs_1$1.default.realpathSync(path$2);
322
321
  const stat = fs_1$1.default.statSync(resolvedPath);
@@ -498,7 +497,7 @@ var require_counter = __commonJS({ "node_modules/fdir/dist/api/counter.js"(expor
498
497
  //#endregion
499
498
  //#region node_modules/fdir/dist/api/walker.js
500
499
  var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports) {
501
- var __createBinding$1 = void 0 && (void 0).__createBinding || (Object.create ? function(o$1, m, k, k2) {
500
+ var __createBinding$1 = void 0 && (void 0).__createBinding || (Object.create ? function(o, m, k, k2) {
502
501
  if (k2 === void 0) k2 = k;
503
502
  var desc = Object.getOwnPropertyDescriptor(m, k);
504
503
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
@@ -507,33 +506,33 @@ var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports
507
506
  return m[k];
508
507
  }
509
508
  };
510
- Object.defineProperty(o$1, k2, desc);
511
- } : function(o$1, m, k, k2) {
509
+ Object.defineProperty(o, k2, desc);
510
+ } : function(o, m, k, k2) {
512
511
  if (k2 === void 0) k2 = k;
513
- o$1[k2] = m[k];
512
+ o[k2] = m[k];
514
513
  });
515
- var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o$1, v) {
516
- Object.defineProperty(o$1, "default", {
514
+ var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o, v) {
515
+ Object.defineProperty(o, "default", {
517
516
  enumerable: true,
518
517
  value: v
519
518
  });
520
- } : function(o$1, v) {
521
- o$1["default"] = v;
519
+ } : function(o, v) {
520
+ o["default"] = v;
522
521
  });
523
522
  var __importStar = void 0 && (void 0).__importStar || function() {
524
- var ownKeys = function(o$1) {
525
- ownKeys = Object.getOwnPropertyNames || function(o$2) {
523
+ var ownKeys = function(o) {
524
+ ownKeys = Object.getOwnPropertyNames || function(o$1) {
526
525
  var ar = [];
527
- for (var k in o$2) if (Object.prototype.hasOwnProperty.call(o$2, k)) ar[ar.length] = k;
526
+ for (var k in o$1) if (Object.prototype.hasOwnProperty.call(o$1, k)) ar[ar.length] = k;
528
527
  return ar;
529
528
  };
530
- return ownKeys(o$1);
529
+ return ownKeys(o);
531
530
  };
532
531
  return function(mod) {
533
532
  if (mod && mod.__esModule) return mod;
534
533
  var result = {};
535
534
  if (mod != null) {
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]);
535
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding$1(result, mod, k[i]);
537
536
  }
538
537
  __setModuleDefault(result, mod);
539
538
  return result;
@@ -597,8 +596,8 @@ var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports
597
596
  const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
598
597
  if (controller.signal.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
599
598
  const files = this.getArray(this.state.paths);
600
- for (let i$1 = 0; i$1 < entries.length; ++i$1) {
601
- const entry = entries[i$1];
599
+ for (let i = 0; i < entries.length; ++i) {
600
+ const entry = entries[i];
602
601
  if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
603
602
  const filename = this.joinPath(entry.name, directoryPath);
604
603
  this.pushFile(filename, files, this.state.counts, filters);
@@ -872,8 +871,8 @@ var require_utils = __commonJS({ "node_modules/picomatch/lib/utils.js"(exports)
872
871
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
873
872
  exports.isWindows = () => {
874
873
  if (typeof navigator !== "undefined" && navigator.platform) {
875
- const platform$1 = navigator.platform.toLowerCase();
876
- return platform$1 === "win32" || platform$1 === "windows";
874
+ const platform = navigator.platform.toLowerCase();
875
+ return platform === "win32" || platform === "windows";
877
876
  }
878
877
  if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
879
878
  return false;
@@ -1170,9 +1169,9 @@ var require_scan = __commonJS({ "node_modules/picomatch/lib/scan.js"(exports, mo
1170
1169
  if (opts.parts === true || opts.tokens === true) {
1171
1170
  let prevIndex;
1172
1171
  for (let idx = 0; idx < slashes.length; idx++) {
1173
- const n$1 = prevIndex ? prevIndex + 1 : start;
1174
- const i$1 = slashes[idx];
1175
- const value = input.slice(n$1, i$1);
1172
+ const n = prevIndex ? prevIndex + 1 : start;
1173
+ const i = slashes[idx];
1174
+ const value = input.slice(n, i);
1176
1175
  if (opts.tokens) {
1177
1176
  if (idx === 0 && start !== 0) {
1178
1177
  tokens[idx].isPrefix = true;
@@ -1182,7 +1181,7 @@ var require_scan = __commonJS({ "node_modules/picomatch/lib/scan.js"(exports, mo
1182
1181
  state.maxDepth += tokens[idx].depth;
1183
1182
  }
1184
1183
  if (idx !== 0 || value !== "") parts.push(value);
1185
- prevIndex = i$1;
1184
+ prevIndex = i;
1186
1185
  }
1187
1186
  if (prevIndex && prevIndex + 1 < input.length) {
1188
1187
  const value = input.slice(prevIndex + 1);
@@ -1236,7 +1235,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1236
1235
  * @param {Object} options
1237
1236
  * @return {Object}
1238
1237
  */
1239
- const parse$2 = (input, options) => {
1238
+ const parse$1 = (input, options) => {
1240
1239
  if (typeof input !== "string") throw new TypeError("Expected a string");
1241
1240
  input = REPLACEMENTS[input] || input;
1242
1241
  const opts = { ...options };
@@ -1289,7 +1288,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1289
1288
  * Tokenizing helpers
1290
1289
  */
1291
1290
  const eos = () => state.index === len - 1;
1292
- const peek = state.peek = (n$1 = 1) => input[state.index + n$1];
1291
+ const peek = state.peek = (n = 1) => input[state.index + n];
1293
1292
  const advance = state.advance = () => input[++state.index] || "";
1294
1293
  const remaining = () => input.slice(state.index + 1);
1295
1294
  const consume = (value$1 = "", num = 0) => {
@@ -1382,7 +1381,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1382
1381
  if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
1383
1382
  if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
1384
1383
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
1385
- const expression = parse$2(rest, {
1384
+ const expression = parse$1(rest, {
1386
1385
  ...options,
1387
1386
  fastpaths: false
1388
1387
  }).output;
@@ -1626,10 +1625,10 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1626
1625
  if (brace.dots === true) {
1627
1626
  const arr = tokens.slice();
1628
1627
  const range = [];
1629
- for (let i$1 = arr.length - 1; i$1 >= 0; i$1--) {
1628
+ for (let i = arr.length - 1; i >= 0; i--) {
1630
1629
  tokens.pop();
1631
- if (arr[i$1].type === "brace") break;
1632
- if (arr[i$1].type !== "dots") range.unshift(arr[i$1].value);
1630
+ if (arr[i].type === "brace") break;
1631
+ if (arr[i].type !== "dots") range.unshift(arr[i].value);
1633
1632
  }
1634
1633
  output = expandRange(range, opts);
1635
1634
  state.backtrack = true;
@@ -1640,7 +1639,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1640
1639
  brace.value = brace.output = "\\{";
1641
1640
  value = output = "\\}";
1642
1641
  state.output = out;
1643
- for (const t$1 of toks) state.output += t$1.output || t$1.value;
1642
+ for (const t of toks) state.output += t.output || t.value;
1644
1643
  }
1645
1644
  push({
1646
1645
  type: "brace",
@@ -2019,7 +2018,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
2019
2018
  * This can significantly speed up processing and has very little downside
2020
2019
  * impact when none of the fast paths match.
2021
2020
  */
2022
- parse$2.fastpaths = (input, options) => {
2021
+ parse$1.fastpaths = (input, options) => {
2023
2022
  const opts = { ...options };
2024
2023
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2025
2024
  const len = input.length;
@@ -2063,14 +2062,14 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
2063
2062
  if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
2064
2063
  return source;
2065
2064
  };
2066
- module.exports = parse$2;
2065
+ module.exports = parse$1;
2067
2066
  } });
2068
2067
 
2069
2068
  //#endregion
2070
2069
  //#region node_modules/picomatch/lib/picomatch.js
2071
2070
  var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"(exports, module) {
2072
2071
  const scan = require_scan();
2073
- const parse$1 = require_parse();
2072
+ const parse = require_parse();
2074
2073
  const utils$1 = require_utils();
2075
2074
  const constants = require_constants();
2076
2075
  const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -2111,9 +2110,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2111
2110
  if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2112
2111
  const opts = options || {};
2113
2112
  const posix$1 = opts.windows;
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;
2113
+ const regex = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
2114
+ const state = regex.state;
2115
+ delete regex.state;
2117
2116
  let isIgnored = () => false;
2118
2117
  if (opts.ignore) {
2119
2118
  const ignoreOpts = {
@@ -2125,14 +2124,14 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2125
2124
  isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
2126
2125
  }
2127
2126
  const matcher = (input, returnObject = false) => {
2128
- const { isMatch, match, output } = picomatch$2.test(input, regex$2, options, {
2127
+ const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
2129
2128
  glob: glob$1,
2130
2129
  posix: posix$1
2131
2130
  });
2132
2131
  const result = {
2133
2132
  glob: glob$1,
2134
2133
  state,
2135
- regex: regex$2,
2134
+ regex,
2136
2135
  posix: posix$1,
2137
2136
  input,
2138
2137
  output,
@@ -2171,7 +2170,7 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2171
2170
  * @return {Object} Returns an object with matching info.
2172
2171
  * @api public
2173
2172
  */
2174
- picomatch$2.test = (input, regex$2, options, { glob: glob$1, posix: posix$1 } = {}) => {
2173
+ picomatch$2.test = (input, regex, options, { glob: glob$1, posix: posix$1 } = {}) => {
2175
2174
  if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2176
2175
  if (input === "") return {
2177
2176
  isMatch: false,
@@ -2185,8 +2184,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2185
2184
  output = format ? format(input) : input;
2186
2185
  match = output === glob$1;
2187
2186
  }
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
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
2188
+ else match = regex.exec(output);
2190
2189
  return {
2191
2190
  isMatch: Boolean(match),
2192
2191
  match,
@@ -2207,8 +2206,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2207
2206
  * @api public
2208
2207
  */
2209
2208
  picomatch$2.matchBase = (input, glob$1, options) => {
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
+ const regex = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2210
+ return regex.test(utils$1.basename(input));
2212
2211
  };
2213
2212
  /**
2214
2213
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -2242,7 +2241,7 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2242
2241
  */
2243
2242
  picomatch$2.parse = (pattern, options) => {
2244
2243
  if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
2245
- return parse$1(pattern, {
2244
+ return parse(pattern, {
2246
2245
  ...options,
2247
2246
  fastpaths: false
2248
2247
  });
@@ -2292,9 +2291,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2292
2291
  const append = opts.contains ? "" : "$";
2293
2292
  let source = `${prepend}(?:${state.output})${append}`;
2294
2293
  if (state && state.negated === true) source = `^(?!${source}).*$`;
2295
- const regex$2 = picomatch$2.toRegex(source, options);
2296
- if (returnState === true) regex$2.state = state;
2297
- return regex$2;
2294
+ const regex = picomatch$2.toRegex(source, options);
2295
+ if (returnState === true) regex.state = state;
2296
+ return regex;
2298
2297
  };
2299
2298
  /**
2300
2299
  * Create a regular expression from a parsed glob pattern.
@@ -2320,8 +2319,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2320
2319
  negated: false,
2321
2320
  fastpaths: true
2322
2321
  };
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
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
2323
+ if (!parsed.output) parsed = parse(input, options);
2325
2324
  return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
2326
2325
  };
2327
2326
  /**
@@ -2522,8 +2521,8 @@ var require_types = __commonJS({ "node_modules/fdir/dist/types.js"(exports) {
2522
2521
 
2523
2522
  //#endregion
2524
2523
  //#region node_modules/fdir/dist/index.js
2525
- var require_dist = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
2526
- var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function(o$1, m, k, k2) {
2524
+ var require_dist$1 = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
2525
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function(o, m, k, k2) {
2527
2526
  if (k2 === void 0) k2 = k;
2528
2527
  var desc = Object.getOwnPropertyDescriptor(m, k);
2529
2528
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
@@ -2532,10 +2531,10 @@ var require_dist = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
2532
2531
  return m[k];
2533
2532
  }
2534
2533
  };
2535
- Object.defineProperty(o$1, k2, desc);
2536
- } : function(o$1, m, k, k2) {
2534
+ Object.defineProperty(o, k2, desc);
2535
+ } : function(o, m, k, k2) {
2537
2536
  if (k2 === void 0) k2 = k;
2538
- o$1[k2] = m[k];
2537
+ o[k2] = m[k];
2539
2538
  });
2540
2539
  var __exportStar = void 0 && (void 0).__exportStar || function(m, exports$1) {
2541
2540
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
@@ -2554,34 +2553,34 @@ var require_dist = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
2554
2553
 
2555
2554
  //#endregion
2556
2555
  //#region node_modules/tinyglobby/dist/index.mjs
2557
- var import_dist = __toESM(require_dist(), 1);
2556
+ var import_dist = __toESM(require_dist$1(), 1);
2558
2557
  var import_picomatch = __toESM(require_picomatch(), 1);
2559
2558
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2560
2559
  function getPartialMatcher(patterns, options) {
2561
2560
  const patternsCount = patterns.length;
2562
2561
  const patternsParts = Array(patternsCount);
2563
2562
  const regexes = Array(patternsCount);
2564
- for (let i$1 = 0; i$1 < patternsCount; i$1++) {
2565
- const parts = splitPattern(patterns[i$1]);
2566
- patternsParts[i$1] = parts;
2563
+ for (let i = 0; i < patternsCount; i++) {
2564
+ const parts = splitPattern(patterns[i]);
2565
+ patternsParts[i] = parts;
2567
2566
  const partsCount = parts.length;
2568
2567
  const partRegexes = Array(partsCount);
2569
2568
  for (let j = 0; j < partsCount; j++) partRegexes[j] = import_picomatch.default.makeRe(parts[j], options);
2570
- regexes[i$1] = partRegexes;
2569
+ regexes[i] = partRegexes;
2571
2570
  }
2572
2571
  return (input) => {
2573
2572
  const inputParts = input.split("/");
2574
2573
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
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];
2574
+ for (let i = 0; i < patterns.length; i++) {
2575
+ const patternParts = patternsParts[i];
2576
+ const regex = regexes[i];
2578
2577
  const inputPatternCount = inputParts.length;
2579
2578
  const minParts = Math.min(inputPatternCount, patternParts.length);
2580
2579
  let j = 0;
2581
2580
  while (j < minParts) {
2582
2581
  const part = patternParts[j];
2583
2582
  if (part.includes("/")) return true;
2584
- const match = regex$2[j].test(inputParts[j]);
2583
+ const match = regex[j].test(inputParts[j]);
2585
2584
  if (!match) break;
2586
2585
  if (part === "**") return true;
2587
2586
  j++;
@@ -2608,7 +2607,7 @@ function isDynamicPattern(pattern, options) {
2608
2607
  const scan$2 = import_picomatch.default.scan(pattern);
2609
2608
  return scan$2.isGlob || scan$2.negated;
2610
2609
  }
2611
- function log$1(...tasks) {
2610
+ function log(...tasks) {
2612
2611
  console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`, ...tasks);
2613
2612
  }
2614
2613
  const PARENT_DIRECTORY = /^(\/?\.\.)+/;
@@ -2624,17 +2623,17 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2624
2623
  const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2625
2624
  const parts = splitPattern(result);
2626
2625
  if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
2627
- const n$1 = (parentDirectoryMatch[0].length + 1) / 3;
2628
- let i$1 = 0;
2626
+ const n = (parentDirectoryMatch[0].length + 1) / 3;
2627
+ let i = 0;
2629
2628
  const cwdParts = escapedCwd.split("/");
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++;
2629
+ while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2630
+ result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2631
+ i++;
2633
2632
  }
2634
- const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i$1 * 3));
2633
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
2635
2634
  if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2636
2635
  props.root = potentialRoot;
2637
- props.depthOffset = -n$1 + i$1;
2636
+ props.depthOffset = -n + i;
2638
2637
  }
2639
2638
  }
2640
2639
  if (!isIgnore && props.depthOffset >= 0) {
@@ -2642,13 +2641,13 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2642
2641
  (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
2643
2642
  const newCommonPath = [];
2644
2643
  const length = Math.min(props.commonPath.length, parts.length);
2645
- for (let i$1 = 0; i$1 < length; i$1++) {
2646
- const part = parts[i$1];
2647
- if (part === "**" && !parts[i$1 + 1]) {
2644
+ for (let i = 0; i < length; i++) {
2645
+ const part = parts[i];
2646
+ if (part === "**" && !parts[i + 1]) {
2648
2647
  newCommonPath.pop();
2649
2648
  break;
2650
2649
  }
2651
- if (part !== props.commonPath[i$1] || isDynamicPattern(part) || i$1 === parts.length - 1) break;
2650
+ if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
2652
2651
  newCommonPath.push(part);
2653
2652
  }
2654
2653
  props.depthOffset = newCommonPath.length;
@@ -2686,15 +2685,15 @@ function processPath(path$1$1, cwd, root, isDirectory, absolute) {
2686
2685
  return getRelativePath(relativePath, cwd, root);
2687
2686
  }
2688
2687
  function formatPaths(paths, cwd, root) {
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("/") ? "/" : "");
2688
+ for (let i = paths.length - 1; i >= 0; i--) {
2689
+ const path$1$1 = paths[i];
2690
+ paths[i] = getRelativePath(path$1$1, cwd, root) + (!path$1$1 || path$1$1.endsWith("/") ? "/" : "");
2692
2691
  }
2693
2692
  return paths;
2694
2693
  }
2695
2694
  function crawl(options, cwd, sync$1) {
2696
2695
  if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
2697
- if (options.debug) log$1("globbing with options:", options, "cwd:", cwd);
2696
+ if (options.debug) log("globbing with options:", options, "cwd:", cwd);
2698
2697
  if (Array.isArray(options.patterns) && options.patterns.length === 0) return sync$1 ? [] : Promise.resolve([]);
2699
2698
  const props = {
2700
2699
  root: cwd,
@@ -2703,7 +2702,7 @@ function crawl(options, cwd, sync$1) {
2703
2702
  };
2704
2703
  const processed = processPatterns(options, cwd, props);
2705
2704
  const nocase = options.caseSensitiveMatch === false;
2706
- if (options.debug) log$1("internal processing patterns:", processed);
2705
+ if (options.debug) log("internal processing patterns:", processed);
2707
2706
  const matcher = (0, import_picomatch.default)(processed.match, {
2708
2707
  dot: options.dot,
2709
2708
  nocase,
@@ -2721,16 +2720,16 @@ function crawl(options, cwd, sync$1) {
2721
2720
  filters: [options.debug ? (p, isDirectory) => {
2722
2721
  const path$1$1 = processPath(p, cwd, props.root, isDirectory, options.absolute);
2723
2722
  const matches = matcher(path$1$1);
2724
- if (matches) log$1(`matched ${path$1$1}`);
2723
+ if (matches) log(`matched ${path$1$1}`);
2725
2724
  return matches;
2726
2725
  } : (p, isDirectory) => matcher(processPath(p, cwd, props.root, isDirectory, options.absolute))],
2727
- exclude: options.debug ? (_$1, p) => {
2726
+ exclude: options.debug ? (_, p) => {
2728
2727
  const relativePath = processPath(p, cwd, props.root, true, true);
2729
2728
  const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2730
- if (skipped) log$1(`skipped ${p}`);
2731
- else log$1(`crawling ${p}`);
2729
+ if (skipped) log(`skipped ${p}`);
2730
+ else log(`crawling ${p}`);
2732
2731
  return skipped;
2733
- } : (_$1, p) => {
2732
+ } : (_, p) => {
2734
2733
  const relativePath = processPath(p, cwd, props.root, true, true);
2735
2734
  return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2736
2735
  },
@@ -2754,7 +2753,7 @@ function crawl(options, cwd, sync$1) {
2754
2753
  } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2755
2754
  props.root = props.root.replace(BACKSLASHES, "");
2756
2755
  const root = props.root;
2757
- if (options.debug) log$1("internal properties:", props);
2756
+ if (options.debug) log("internal properties:", props);
2758
2757
  const api = new import_dist.fdir(fdirOptions).crawl(root);
2759
2758
  if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
2760
2759
  return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
@@ -2770,1492 +2769,7 @@ async function glob(patternsOrOptions, options) {
2770
2769
  }
2771
2770
 
2772
2771
  //#endregion
2773
- //#region node_modules/valibot/dist/index.js
2774
- var store;
2775
- /* @__NO_SIDE_EFFECTS__ */
2776
- function getGlobalConfig(config2) {
2777
- return {
2778
- lang: config2?.lang ?? store?.lang,
2779
- message: config2?.message,
2780
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
2781
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
2782
- };
2783
- }
2784
- var store2;
2785
- /* @__NO_SIDE_EFFECTS__ */
2786
- function getGlobalMessage(lang) {
2787
- return store2?.get(lang);
2788
- }
2789
- var store3;
2790
- /* @__NO_SIDE_EFFECTS__ */
2791
- function getSchemaMessage(lang) {
2792
- return store3?.get(lang);
2793
- }
2794
- var store4;
2795
- /* @__NO_SIDE_EFFECTS__ */
2796
- function getSpecificMessage(reference, lang) {
2797
- return store4?.get(reference)?.get(lang);
2798
- }
2799
- /* @__NO_SIDE_EFFECTS__ */
2800
- function _stringify(input) {
2801
- const type = typeof input;
2802
- if (type === "string") return `"${input}"`;
2803
- if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
2804
- if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
2805
- return type;
2806
- }
2807
- function _addIssue(context, label, dataset, config2, other) {
2808
- const input = other && "input" in other ? other.input : dataset.value;
2809
- const expected = other?.expected ?? context.expects ?? null;
2810
- const received = other?.received ?? /* @__PURE__ */ _stringify(input);
2811
- const issue = {
2812
- kind: context.kind,
2813
- type: context.type,
2814
- input,
2815
- expected,
2816
- received,
2817
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
2818
- requirement: context.requirement,
2819
- path: other?.path,
2820
- issues: other?.issues,
2821
- lang: config2.lang,
2822
- abortEarly: config2.abortEarly,
2823
- abortPipeEarly: config2.abortPipeEarly
2824
- };
2825
- const isSchema = context.kind === "schema";
2826
- const message2 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
2827
- if (message2 !== void 0) issue.message = typeof message2 === "function" ? message2(issue) : message2;
2828
- if (isSchema) dataset.typed = false;
2829
- if (dataset.issues) dataset.issues.push(issue);
2830
- else dataset.issues = [issue];
2831
- }
2832
- /* @__NO_SIDE_EFFECTS__ */
2833
- function _getStandardProps(context) {
2834
- return {
2835
- version: 1,
2836
- vendor: "valibot",
2837
- validate(value2) {
2838
- return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
2839
- }
2840
- };
2841
- }
2842
- /* @__NO_SIDE_EFFECTS__ */
2843
- function _isValidObjectKey(object2, key) {
2844
- return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
2845
- }
2846
- /* @__NO_SIDE_EFFECTS__ */
2847
- function _joinExpects(values2, separator) {
2848
- const list = [...new Set(values2)];
2849
- if (list.length > 1) return `(${list.join(` ${separator} `)})`;
2850
- return list[0] ?? "never";
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
- };
2864
- /* @__NO_SIDE_EFFECTS__ */
2865
- function regex$1(requirement, message2) {
2866
- return {
2867
- kind: "validation",
2868
- type: "regex",
2869
- reference: regex$1,
2870
- async: false,
2871
- expects: `${requirement}`,
2872
- requirement,
2873
- message: message2,
2874
- "~run"(dataset, config2) {
2875
- if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config2);
2876
- return dataset;
2877
- }
2878
- };
2879
- }
2880
- /* @__NO_SIDE_EFFECTS__ */
2881
- function getFallback(schema, dataset, config2) {
2882
- return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
2883
- }
2884
- /* @__NO_SIDE_EFFECTS__ */
2885
- function getDefault(schema, dataset, config2) {
2886
- return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
2887
- }
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__ */
2937
- function boolean(message2) {
2938
- return {
2939
- kind: "schema",
2940
- type: "boolean",
2941
- reference: boolean,
2942
- expects: "boolean",
2943
- async: false,
2944
- message: message2,
2945
- get "~standard"() {
2946
- return /* @__PURE__ */ _getStandardProps(this);
2947
- },
2948
- "~run"(dataset, config2) {
2949
- if (typeof dataset.value === "boolean") dataset.typed = true;
2950
- else _addIssue(this, "type", dataset, config2);
2951
- return dataset;
2952
- }
2953
- };
2954
- }
2955
- /* @__NO_SIDE_EFFECTS__ */
2956
- function number(message2) {
2957
- return {
2958
- kind: "schema",
2959
- type: "number",
2960
- reference: number,
2961
- expects: "number",
2962
- async: false,
2963
- message: message2,
2964
- get "~standard"() {
2965
- return /* @__PURE__ */ _getStandardProps(this);
2966
- },
2967
- "~run"(dataset, config2) {
2968
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
2969
- else _addIssue(this, "type", dataset, config2);
2970
- return dataset;
2971
- }
2972
- };
2973
- }
2974
- /* @__NO_SIDE_EFFECTS__ */
2975
- function object(entries2, message2) {
2976
- return {
2977
- kind: "schema",
2978
- type: "object",
2979
- reference: object,
2980
- expects: "Object",
2981
- async: false,
2982
- entries: entries2,
2983
- message: message2,
2984
- get "~standard"() {
2985
- return /* @__PURE__ */ _getStandardProps(this);
2986
- },
2987
- "~run"(dataset, config2) {
2988
- const input = dataset.value;
2989
- if (input && typeof input === "object") {
2990
- dataset.typed = true;
2991
- dataset.value = {};
2992
- for (const key in this.entries) {
2993
- const valueSchema = this.entries[key];
2994
- if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
2995
- const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
2996
- const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
2997
- if (valueDataset.issues) {
2998
- const pathItem = {
2999
- type: "object",
3000
- origin: "value",
3001
- input,
3002
- key,
3003
- value: value2
3004
- };
3005
- for (const issue of valueDataset.issues) {
3006
- if (issue.path) issue.path.unshift(pathItem);
3007
- else issue.path = [pathItem];
3008
- dataset.issues?.push(issue);
3009
- }
3010
- if (!dataset.issues) dataset.issues = valueDataset.issues;
3011
- if (config2.abortEarly) {
3012
- dataset.typed = false;
3013
- break;
3014
- }
3015
- }
3016
- if (!valueDataset.typed) dataset.typed = false;
3017
- dataset.value[key] = valueDataset.value;
3018
- } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
3019
- else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
3020
- _addIssue(this, "key", dataset, config2, {
3021
- input: void 0,
3022
- expected: `"${key}"`,
3023
- path: [{
3024
- type: "object",
3025
- origin: "key",
3026
- input,
3027
- key,
3028
- value: input[key]
3029
- }]
3030
- });
3031
- if (config2.abortEarly) break;
3032
- }
3033
- }
3034
- } else _addIssue(this, "type", dataset, config2);
3035
- return dataset;
3036
- }
3037
- };
3038
- }
3039
- /* @__NO_SIDE_EFFECTS__ */
3040
- function optional(wrapped, default_) {
3041
- return {
3042
- kind: "schema",
3043
- type: "optional",
3044
- reference: optional,
3045
- expects: `(${wrapped.expects} | undefined)`,
3046
- async: false,
3047
- wrapped,
3048
- default: default_,
3049
- get "~standard"() {
3050
- return /* @__PURE__ */ _getStandardProps(this);
3051
- },
3052
- "~run"(dataset, config2) {
3053
- if (dataset.value === void 0) {
3054
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
3055
- if (dataset.value === void 0) {
3056
- dataset.typed = true;
3057
- return dataset;
3058
- }
3059
- }
3060
- return this.wrapped["~run"](dataset, config2);
3061
- }
3062
- };
3063
- }
3064
- /* @__NO_SIDE_EFFECTS__ */
3065
- function record(key, value2, message2) {
3066
- return {
3067
- kind: "schema",
3068
- type: "record",
3069
- reference: record,
3070
- expects: "Object",
3071
- async: false,
3072
- key,
3073
- value: value2,
3074
- message: message2,
3075
- get "~standard"() {
3076
- return /* @__PURE__ */ _getStandardProps(this);
3077
- },
3078
- "~run"(dataset, config2) {
3079
- const input = dataset.value;
3080
- if (input && typeof input === "object") {
3081
- dataset.typed = true;
3082
- dataset.value = {};
3083
- for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
3084
- const entryValue = input[entryKey];
3085
- const keyDataset = this.key["~run"]({ value: entryKey }, config2);
3086
- if (keyDataset.issues) {
3087
- const pathItem = {
3088
- type: "object",
3089
- origin: "key",
3090
- input,
3091
- key: entryKey,
3092
- value: entryValue
3093
- };
3094
- for (const issue of keyDataset.issues) {
3095
- issue.path = [pathItem];
3096
- dataset.issues?.push(issue);
3097
- }
3098
- if (!dataset.issues) dataset.issues = keyDataset.issues;
3099
- if (config2.abortEarly) {
3100
- dataset.typed = false;
3101
- break;
3102
- }
3103
- }
3104
- const valueDataset = this.value["~run"]({ value: entryValue }, config2);
3105
- if (valueDataset.issues) {
3106
- const pathItem = {
3107
- type: "object",
3108
- origin: "value",
3109
- input,
3110
- key: entryKey,
3111
- value: entryValue
3112
- };
3113
- for (const issue of valueDataset.issues) {
3114
- if (issue.path) issue.path.unshift(pathItem);
3115
- else issue.path = [pathItem];
3116
- dataset.issues?.push(issue);
3117
- }
3118
- if (!dataset.issues) dataset.issues = valueDataset.issues;
3119
- if (config2.abortEarly) {
3120
- dataset.typed = false;
3121
- break;
3122
- }
3123
- }
3124
- if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
3125
- if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
3126
- }
3127
- } else _addIssue(this, "type", dataset, config2);
3128
- return dataset;
3129
- }
3130
- };
3131
- }
3132
- /* @__NO_SIDE_EFFECTS__ */
3133
- function string(message2) {
3134
- return {
3135
- kind: "schema",
3136
- type: "string",
3137
- reference: string,
3138
- expects: "string",
3139
- async: false,
3140
- message: message2,
3141
- get "~standard"() {
3142
- return /* @__PURE__ */ _getStandardProps(this);
3143
- },
3144
- "~run"(dataset, config2) {
3145
- if (typeof dataset.value === "string") dataset.typed = true;
3146
- else _addIssue(this, "type", dataset, config2);
3147
- return dataset;
3148
- }
3149
- };
3150
- }
3151
- /* @__NO_SIDE_EFFECTS__ */
3152
- function _subIssues(datasets) {
3153
- let issues;
3154
- if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
3155
- else issues = dataset.issues;
3156
- return issues;
3157
- }
3158
- /* @__NO_SIDE_EFFECTS__ */
3159
- function union(options, message2) {
3160
- return {
3161
- kind: "schema",
3162
- type: "union",
3163
- reference: union,
3164
- expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
3165
- async: false,
3166
- options,
3167
- message: message2,
3168
- get "~standard"() {
3169
- return /* @__PURE__ */ _getStandardProps(this);
3170
- },
3171
- "~run"(dataset, config2) {
3172
- let validDataset;
3173
- let typedDatasets;
3174
- let untypedDatasets;
3175
- for (const schema of this.options) {
3176
- const optionDataset = schema["~run"]({ value: dataset.value }, config2);
3177
- if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
3178
- else typedDatasets = [optionDataset];
3179
- else {
3180
- validDataset = optionDataset;
3181
- break;
3182
- }
3183
- else if (untypedDatasets) untypedDatasets.push(optionDataset);
3184
- else untypedDatasets = [optionDataset];
3185
- }
3186
- if (validDataset) return validDataset;
3187
- if (typedDatasets) {
3188
- if (typedDatasets.length === 1) return typedDatasets[0];
3189
- _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
3190
- dataset.typed = true;
3191
- } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
3192
- else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
3193
- return dataset;
3194
- }
3195
- };
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
- }
3202
- /* @__NO_SIDE_EFFECTS__ */
3203
- function pipe(...pipe2) {
3204
- return {
3205
- ...pipe2[0],
3206
- pipe: pipe2,
3207
- get "~standard"() {
3208
- return /* @__PURE__ */ _getStandardProps(this);
3209
- },
3210
- "~run"(dataset, config2) {
3211
- for (const item of pipe2) if (item.kind !== "metadata") {
3212
- if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
3213
- dataset.typed = false;
3214
- break;
3215
- }
3216
- if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
3217
- }
3218
- return dataset;
3219
- }
3220
- };
3221
- }
3222
- /* @__NO_SIDE_EFFECTS__ */
3223
- function safeParse(schema, input, config2) {
3224
- const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
3225
- return {
3226
- typed: dataset.typed,
3227
- success: !dataset.issues,
3228
- output: dataset.value,
3229
- issues: dataset.issues
3230
- };
3231
- }
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.1";
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 = console.log;
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.warn("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
-
4257
- //#endregion
4258
- //#region data-loader.ts
2772
+ //#region src/data-loader.ts
4259
2773
  const getDefaultClaudePath = () => path.join(homedir(), ".claude");
4260
2774
  const UsageDataSchema = object({
4261
2775
  timestamp: string(),
@@ -4427,4 +2941,4 @@ async function loadSessionData(options) {
4427
2941
  }
4428
2942
 
4429
2943
  //#endregion
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 };
2944
+ export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, calculateCostForEntry, formatDate, getDefaultClaudePath, glob, loadSessionData, loadUsageData };