vlt 0.0.0-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.
@@ -0,0 +1,2158 @@
1
+ import process from 'node:process'
2
+ import {Buffer} from 'node:buffer'
3
+ import {setImmediate,clearImmediate} from 'node:timers'
4
+ import {createRequire as createRequire_055fdfe7bd7e} from 'node:module'
5
+ const require = createRequire_055fdfe7bd7e(import.meta.filename)
6
+ const global = globalThis
7
+ var __create = Object.create;
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __commonJS = (cb, mod) => function __require() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // ../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js
34
+ var require_eastasianwidth = __commonJS({
35
+ "../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js"(exports, module) {
36
+ var eaw = {};
37
+ if ("undefined" == typeof module) {
38
+ window.eastasianwidth = eaw;
39
+ } else {
40
+ module.exports = eaw;
41
+ }
42
+ eaw.eastAsianWidth = function(character) {
43
+ var x = character.charCodeAt(0);
44
+ var y = character.length == 2 ? character.charCodeAt(1) : 0;
45
+ var codePoint = x;
46
+ if (55296 <= x && x <= 56319 && (56320 <= y && y <= 57343)) {
47
+ x &= 1023;
48
+ y &= 1023;
49
+ codePoint = x << 10 | y;
50
+ codePoint += 65536;
51
+ }
52
+ if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
53
+ return "F";
54
+ }
55
+ if (8361 == codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518) {
56
+ return "H";
57
+ }
58
+ if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
59
+ return "W";
60
+ }
61
+ if (32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 == codePoint || 175 == codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630) {
62
+ return "Na";
63
+ }
64
+ if (161 == codePoint || 164 == codePoint || 167 <= codePoint && codePoint <= 168 || 170 == codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 == codePoint || 208 == codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 == codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 == codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 == codePoint || 254 == codePoint || 257 == codePoint || 273 == codePoint || 275 == codePoint || 283 == codePoint || 294 <= codePoint && codePoint <= 295 || 299 == codePoint || 305 <= codePoint && codePoint <= 307 || 312 == codePoint || 319 <= codePoint && codePoint <= 322 || 324 == codePoint || 328 <= codePoint && codePoint <= 331 || 333 == codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 == codePoint || 462 == codePoint || 464 == codePoint || 466 == codePoint || 468 == codePoint || 470 == codePoint || 472 == codePoint || 474 == codePoint || 476 == codePoint || 593 == codePoint || 609 == codePoint || 708 == codePoint || 711 == codePoint || 713 <= codePoint && codePoint <= 715 || 717 == codePoint || 720 == codePoint || 728 <= codePoint && codePoint <= 731 || 733 == codePoint || 735 == codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 == codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 == codePoint || 8208 == codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 == codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 == codePoint || 8251 == codePoint || 8254 == codePoint || 8308 == codePoint || 8319 == codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 == codePoint || 8451 == codePoint || 8453 == codePoint || 8457 == codePoint || 8467 == codePoint || 8470 == codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 == codePoint || 8491 == codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 == codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 == codePoint || 8660 == codePoint || 8679 == codePoint || 8704 == codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 == codePoint || 8719 == codePoint || 8721 == codePoint || 8725 == codePoint || 8730 == codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 == codePoint || 8741 == codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 == codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 == codePoint || 8780 == codePoint || 8786 == codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 == codePoint || 8857 == codePoint || 8869 == codePoint || 8895 == codePoint || 8978 == codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 == codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 == codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 == codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 == codePoint || 9758 == codePoint || 9792 == codePoint || 9794 == codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 == codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 == codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 == codePoint || 10071 == codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 == codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109) {
65
+ return "A";
66
+ }
67
+ return "N";
68
+ };
69
+ eaw.characterLength = function(character) {
70
+ var code = this.eastAsianWidth(character);
71
+ if (code == "F" || code == "W" || code == "A") {
72
+ return 2;
73
+ } else {
74
+ return 1;
75
+ }
76
+ };
77
+ function stringToArray(string) {
78
+ return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
79
+ }
80
+ eaw.length = function(string) {
81
+ var characters = stringToArray(string);
82
+ var len = 0;
83
+ for (var i = 0; i < characters.length; i++) {
84
+ len = len + this.characterLength(characters[i]);
85
+ }
86
+ return len;
87
+ };
88
+ eaw.slice = function(text, start, end) {
89
+ textLen = eaw.length(text);
90
+ start = start ? start : 0;
91
+ end = end ? end : 1;
92
+ if (start < 0) {
93
+ start = textLen + start;
94
+ }
95
+ if (end < 0) {
96
+ end = textLen + end;
97
+ }
98
+ var result = "";
99
+ var eawLen = 0;
100
+ var chars = stringToArray(text);
101
+ for (var i = 0; i < chars.length; i++) {
102
+ var char = chars[i];
103
+ var charLen = eaw.length(char);
104
+ if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
105
+ if (eawLen + charLen <= end) {
106
+ result += char;
107
+ } else {
108
+ break;
109
+ }
110
+ }
111
+ eawLen += charLen;
112
+ }
113
+ return result;
114
+ };
115
+ }
116
+ });
117
+
118
+ // ../../node_modules/.pnpm/emoji-regex@9.2.2/node_modules/emoji-regex/index.js
119
+ var require_emoji_regex = __commonJS({
120
+ "../../node_modules/.pnpm/emoji-regex@9.2.2/node_modules/emoji-regex/index.js"(exports, module) {
121
+ "use strict";
122
+ module.exports = function() {
123
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
124
+ };
125
+ }
126
+ });
127
+
128
+ // ../../src/error-cause/dist/esm/index.js
129
+ var create = (cls, defaultFrom, message, cause, from = defaultFrom) => {
130
+ const er = new cls(message, cause ? { cause } : void 0);
131
+ Error.captureStackTrace?.(er, from);
132
+ return er;
133
+ };
134
+ var error = (message, cause, from) => create(Error, error, message, cause, from);
135
+
136
+ // ../../src/vlt/dist/esm/commands/config.js
137
+ import { spawnSync } from "node:child_process";
138
+
139
+ // ../../src/xdg/dist/esm/index.js
140
+ import { homedir, tmpdir } from "node:os";
141
+ import { resolve } from "node:path";
142
+ var root = homedir();
143
+ var path = (p) => resolve(root, p);
144
+ var defaults = process.platform === "darwin" ? (which) => {
145
+ switch (which) {
146
+ case "config":
147
+ return path("Library/Preferences");
148
+ case "cache":
149
+ return path("Library/Caches");
150
+ case "data":
151
+ return path("Library/Application Support");
152
+ case "state":
153
+ return path("Library/State");
154
+ case "runtime":
155
+ return resolve(
156
+ tmpdir(),
157
+ /* c8 ignore next */
158
+ String(process.getuid?.() ?? ""),
159
+ ".run"
160
+ );
161
+ }
162
+ } : process.platform === "win32" ? (which) => {
163
+ const ad = process.env.APPDATA ?? path("AppData/Roaming");
164
+ const lad = process.env.LOCALAPPDATA ?? path("AppData/Local");
165
+ switch (which) {
166
+ case "config":
167
+ return resolve(ad, "xdg.config");
168
+ case "cache":
169
+ return resolve(lad, "xdg.cache");
170
+ case "data":
171
+ return resolve(ad, "xdg.data");
172
+ case "state":
173
+ return resolve(lad, "xdg.state");
174
+ case "runtime":
175
+ return resolve(tmpdir(), "xdg.run");
176
+ }
177
+ } : (which) => {
178
+ switch (which) {
179
+ case "config":
180
+ return path(".config");
181
+ case "cache":
182
+ return path(".cache");
183
+ case "data":
184
+ return path(".local/data");
185
+ case "state":
186
+ return path(".local/state");
187
+ case "runtime":
188
+ return resolve(
189
+ tmpdir(),
190
+ /* c8 ignore next */
191
+ String(process.getuid?.() ?? ""),
192
+ ".run"
193
+ );
194
+ }
195
+ };
196
+ var { XDG_CONFIG_HOME = defaults("config"), XDG_CACHE_HOME = defaults("cache"), XDG_DATA_HOME = defaults("data"), XDG_STATE_HOME = defaults("state"), XDG_RUNTIME_DIR = defaults("runtime") } = process.env;
197
+ var XDG = class {
198
+ name;
199
+ base = {
200
+ config: XDG_CONFIG_HOME,
201
+ cache: XDG_CACHE_HOME,
202
+ data: XDG_DATA_HOME,
203
+ state: XDG_STATE_HOME,
204
+ runtime: XDG_RUNTIME_DIR
205
+ };
206
+ constructor(name) {
207
+ this.name = name;
208
+ }
209
+ config(p = "") {
210
+ return resolve(this.base.config, this.name, p);
211
+ }
212
+ cache(p = "") {
213
+ return resolve(this.base.cache, this.name, p);
214
+ }
215
+ data(p = "") {
216
+ return resolve(this.base.data, this.name, p);
217
+ }
218
+ state(p = "") {
219
+ return resolve(this.base.state, this.name, p);
220
+ }
221
+ runtime(p = "") {
222
+ return resolve(this.base.runtime, this.name, p);
223
+ }
224
+ };
225
+
226
+ // ../../src/vlt/dist/esm/config/index.js
227
+ import { readFileSync, rmSync, writeFileSync } from "node:fs";
228
+ import { lstat, mkdir, readFile, writeFile } from "node:fs/promises";
229
+ import { homedir as homedir3 } from "node:os";
230
+ import { dirname as dirname2, resolve as resolve3 } from "node:path";
231
+
232
+ // ../../node_modules/.pnpm/polite-json@5.0.0/node_modules/polite-json/dist/esm/index.js
233
+ var kIndent = Symbol.for("indent");
234
+ var kNewline = Symbol.for("newline");
235
+
236
+ // ../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/esm/index.js
237
+ import { dirname, resolve as resolve2 } from "node:path";
238
+
239
+ // ../../node_modules/.pnpm/jackspeak@4.0.2/node_modules/jackspeak/dist/esm/index.js
240
+ import { inspect, parseArgs } from "node:util";
241
+
242
+ // ../../node_modules/.pnpm/@isaacs+cliui@8.0.2/node_modules/@isaacs/cliui/build/lib/index.js
243
+ var align = {
244
+ right: alignRight,
245
+ center: alignCenter
246
+ };
247
+ var top = 0;
248
+ var right = 1;
249
+ var bottom = 2;
250
+ var left = 3;
251
+ var UI = class {
252
+ constructor(opts) {
253
+ var _a;
254
+ this.width = opts.width;
255
+ this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
256
+ this.rows = [];
257
+ }
258
+ span(...args) {
259
+ const cols = this.div(...args);
260
+ cols.span = true;
261
+ }
262
+ resetOutput() {
263
+ this.rows = [];
264
+ }
265
+ div(...args) {
266
+ if (args.length === 0) {
267
+ this.div("");
268
+ }
269
+ if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === "string") {
270
+ return this.applyLayoutDSL(args[0]);
271
+ }
272
+ const cols = args.map((arg) => {
273
+ if (typeof arg === "string") {
274
+ return this.colFromString(arg);
275
+ }
276
+ return arg;
277
+ });
278
+ this.rows.push(cols);
279
+ return cols;
280
+ }
281
+ shouldApplyLayoutDSL(...args) {
282
+ return args.length === 1 && typeof args[0] === "string" && /[\t\n]/.test(args[0]);
283
+ }
284
+ applyLayoutDSL(str) {
285
+ const rows = str.split("\n").map((row) => row.split(" "));
286
+ let leftColumnWidth = 0;
287
+ rows.forEach((columns) => {
288
+ if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
289
+ leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
290
+ }
291
+ });
292
+ rows.forEach((columns) => {
293
+ this.div(...columns.map((r, i) => {
294
+ return {
295
+ text: r.trim(),
296
+ padding: this.measurePadding(r),
297
+ width: i === 0 && columns.length > 1 ? leftColumnWidth : void 0
298
+ };
299
+ }));
300
+ });
301
+ return this.rows[this.rows.length - 1];
302
+ }
303
+ colFromString(text) {
304
+ return {
305
+ text,
306
+ padding: this.measurePadding(text)
307
+ };
308
+ }
309
+ measurePadding(str) {
310
+ const noAnsi = mixin.stripAnsi(str);
311
+ return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
312
+ }
313
+ toString() {
314
+ const lines = [];
315
+ this.rows.forEach((row) => {
316
+ this.rowToString(row, lines);
317
+ });
318
+ return lines.filter((line) => !line.hidden).map((line) => line.text).join("\n");
319
+ }
320
+ rowToString(row, lines) {
321
+ this.rasterize(row).forEach((rrow, r) => {
322
+ let str = "";
323
+ rrow.forEach((col, c) => {
324
+ const { width: width2 } = row[c];
325
+ const wrapWidth = this.negatePadding(row[c]);
326
+ let ts = col;
327
+ if (wrapWidth > mixin.stringWidth(col)) {
328
+ ts += " ".repeat(wrapWidth - mixin.stringWidth(col));
329
+ }
330
+ if (row[c].align && row[c].align !== "left" && this.wrap) {
331
+ const fn = align[row[c].align];
332
+ ts = fn(ts, wrapWidth);
333
+ if (mixin.stringWidth(ts) < wrapWidth) {
334
+ const w = width2 || 0;
335
+ ts += " ".repeat(w - mixin.stringWidth(ts) - 1);
336
+ }
337
+ }
338
+ const padding = row[c].padding || [0, 0, 0, 0];
339
+ if (padding[left]) {
340
+ str += " ".repeat(padding[left]);
341
+ }
342
+ str += addBorder(row[c], ts, "| ");
343
+ str += ts;
344
+ str += addBorder(row[c], ts, " |");
345
+ if (padding[right]) {
346
+ str += " ".repeat(padding[right]);
347
+ }
348
+ if (r === 0 && lines.length > 0) {
349
+ str = this.renderInline(str, lines[lines.length - 1]);
350
+ }
351
+ });
352
+ lines.push({
353
+ text: str.replace(/ +$/, ""),
354
+ span: row.span
355
+ });
356
+ });
357
+ return lines;
358
+ }
359
+ // if the full 'source' can render in
360
+ // the target line, do so.
361
+ renderInline(source, previousLine) {
362
+ const match = source.match(/^ */);
363
+ const leadingWhitespace = match ? match[0].length : 0;
364
+ const target = previousLine.text;
365
+ const targetTextWidth = mixin.stringWidth(target.trimEnd());
366
+ if (!previousLine.span) {
367
+ return source;
368
+ }
369
+ if (!this.wrap) {
370
+ previousLine.hidden = true;
371
+ return target + source;
372
+ }
373
+ if (leadingWhitespace < targetTextWidth) {
374
+ return source;
375
+ }
376
+ previousLine.hidden = true;
377
+ return target.trimEnd() + " ".repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
378
+ }
379
+ rasterize(row) {
380
+ const rrows = [];
381
+ const widths = this.columnWidths(row);
382
+ let wrapped;
383
+ row.forEach((col, c) => {
384
+ col.width = widths[c];
385
+ if (this.wrap) {
386
+ wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split("\n");
387
+ } else {
388
+ wrapped = col.text.split("\n");
389
+ }
390
+ if (col.border) {
391
+ wrapped.unshift("." + "-".repeat(this.negatePadding(col) + 2) + ".");
392
+ wrapped.push("'" + "-".repeat(this.negatePadding(col) + 2) + "'");
393
+ }
394
+ if (col.padding) {
395
+ wrapped.unshift(...new Array(col.padding[top] || 0).fill(""));
396
+ wrapped.push(...new Array(col.padding[bottom] || 0).fill(""));
397
+ }
398
+ wrapped.forEach((str, r) => {
399
+ if (!rrows[r]) {
400
+ rrows.push([]);
401
+ }
402
+ const rrow = rrows[r];
403
+ for (let i = 0; i < c; i++) {
404
+ if (rrow[i] === void 0) {
405
+ rrow.push("");
406
+ }
407
+ }
408
+ rrow.push(str);
409
+ });
410
+ });
411
+ return rrows;
412
+ }
413
+ negatePadding(col) {
414
+ let wrapWidth = col.width || 0;
415
+ if (col.padding) {
416
+ wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
417
+ }
418
+ if (col.border) {
419
+ wrapWidth -= 4;
420
+ }
421
+ return wrapWidth;
422
+ }
423
+ columnWidths(row) {
424
+ if (!this.wrap) {
425
+ return row.map((col) => {
426
+ return col.width || mixin.stringWidth(col.text);
427
+ });
428
+ }
429
+ let unset = row.length;
430
+ let remainingWidth = this.width;
431
+ const widths = row.map((col) => {
432
+ if (col.width) {
433
+ unset--;
434
+ remainingWidth -= col.width;
435
+ return col.width;
436
+ }
437
+ return void 0;
438
+ });
439
+ const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
440
+ return widths.map((w, i) => {
441
+ if (w === void 0) {
442
+ return Math.max(unsetWidth, _minWidth(row[i]));
443
+ }
444
+ return w;
445
+ });
446
+ }
447
+ };
448
+ function addBorder(col, ts, style) {
449
+ if (col.border) {
450
+ if (/[.']-+[.']/.test(ts)) {
451
+ return "";
452
+ }
453
+ if (ts.trim().length !== 0) {
454
+ return style;
455
+ }
456
+ return " ";
457
+ }
458
+ return "";
459
+ }
460
+ function _minWidth(col) {
461
+ const padding = col.padding || [];
462
+ const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
463
+ if (col.border) {
464
+ return minWidth + 4;
465
+ }
466
+ return minWidth;
467
+ }
468
+ function getWindowWidth() {
469
+ if (typeof process === "object" && process.stdout && process.stdout.columns) {
470
+ return process.stdout.columns;
471
+ }
472
+ return 80;
473
+ }
474
+ function alignRight(str, width2) {
475
+ str = str.trim();
476
+ const strWidth = mixin.stringWidth(str);
477
+ if (strWidth < width2) {
478
+ return " ".repeat(width2 - strWidth) + str;
479
+ }
480
+ return str;
481
+ }
482
+ function alignCenter(str, width2) {
483
+ str = str.trim();
484
+ const strWidth = mixin.stringWidth(str);
485
+ if (strWidth >= width2) {
486
+ return str;
487
+ }
488
+ return " ".repeat(width2 - strWidth >> 1) + str;
489
+ }
490
+ var mixin;
491
+ function cliui(opts, _mixin) {
492
+ mixin = _mixin;
493
+ return new UI({
494
+ /* c8 ignore start */
495
+ width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
496
+ wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
497
+ /* c8 ignore stop */
498
+ });
499
+ }
500
+
501
+ // ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
502
+ function ansiRegex({ onlyFirst = false } = {}) {
503
+ const pattern = [
504
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
505
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
506
+ ].join("|");
507
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
508
+ }
509
+
510
+ // ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
511
+ var regex = ansiRegex();
512
+ function stripAnsi(string) {
513
+ if (typeof string !== "string") {
514
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
515
+ }
516
+ return string.replace(regex, "");
517
+ }
518
+
519
+ // ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
520
+ var import_eastasianwidth = __toESM(require_eastasianwidth(), 1);
521
+ var import_emoji_regex = __toESM(require_emoji_regex(), 1);
522
+ function stringWidth(string, options = {}) {
523
+ if (typeof string !== "string" || string.length === 0) {
524
+ return 0;
525
+ }
526
+ options = {
527
+ ambiguousIsNarrow: true,
528
+ ...options
529
+ };
530
+ string = stripAnsi(string);
531
+ if (string.length === 0) {
532
+ return 0;
533
+ }
534
+ string = string.replace((0, import_emoji_regex.default)(), " ");
535
+ const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
536
+ let width2 = 0;
537
+ for (const character of string) {
538
+ const codePoint = character.codePointAt(0);
539
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
540
+ continue;
541
+ }
542
+ if (codePoint >= 768 && codePoint <= 879) {
543
+ continue;
544
+ }
545
+ const code = import_eastasianwidth.default.eastAsianWidth(character);
546
+ switch (code) {
547
+ case "F":
548
+ case "W":
549
+ width2 += 2;
550
+ break;
551
+ case "A":
552
+ width2 += ambiguousCharacterWidth;
553
+ break;
554
+ default:
555
+ width2 += 1;
556
+ }
557
+ }
558
+ return width2;
559
+ }
560
+
561
+ // ../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
562
+ var ANSI_BACKGROUND_OFFSET = 10;
563
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
564
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
565
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
566
+ var styles = {
567
+ modifier: {
568
+ reset: [0, 0],
569
+ // 21 isn't widely supported and 22 does the same thing
570
+ bold: [1, 22],
571
+ dim: [2, 22],
572
+ italic: [3, 23],
573
+ underline: [4, 24],
574
+ overline: [53, 55],
575
+ inverse: [7, 27],
576
+ hidden: [8, 28],
577
+ strikethrough: [9, 29]
578
+ },
579
+ color: {
580
+ black: [30, 39],
581
+ red: [31, 39],
582
+ green: [32, 39],
583
+ yellow: [33, 39],
584
+ blue: [34, 39],
585
+ magenta: [35, 39],
586
+ cyan: [36, 39],
587
+ white: [37, 39],
588
+ // Bright color
589
+ blackBright: [90, 39],
590
+ gray: [90, 39],
591
+ // Alias of `blackBright`
592
+ grey: [90, 39],
593
+ // Alias of `blackBright`
594
+ redBright: [91, 39],
595
+ greenBright: [92, 39],
596
+ yellowBright: [93, 39],
597
+ blueBright: [94, 39],
598
+ magentaBright: [95, 39],
599
+ cyanBright: [96, 39],
600
+ whiteBright: [97, 39]
601
+ },
602
+ bgColor: {
603
+ bgBlack: [40, 49],
604
+ bgRed: [41, 49],
605
+ bgGreen: [42, 49],
606
+ bgYellow: [43, 49],
607
+ bgBlue: [44, 49],
608
+ bgMagenta: [45, 49],
609
+ bgCyan: [46, 49],
610
+ bgWhite: [47, 49],
611
+ // Bright color
612
+ bgBlackBright: [100, 49],
613
+ bgGray: [100, 49],
614
+ // Alias of `bgBlackBright`
615
+ bgGrey: [100, 49],
616
+ // Alias of `bgBlackBright`
617
+ bgRedBright: [101, 49],
618
+ bgGreenBright: [102, 49],
619
+ bgYellowBright: [103, 49],
620
+ bgBlueBright: [104, 49],
621
+ bgMagentaBright: [105, 49],
622
+ bgCyanBright: [106, 49],
623
+ bgWhiteBright: [107, 49]
624
+ }
625
+ };
626
+ var modifierNames = Object.keys(styles.modifier);
627
+ var foregroundColorNames = Object.keys(styles.color);
628
+ var backgroundColorNames = Object.keys(styles.bgColor);
629
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
630
+ function assembleStyles() {
631
+ const codes = /* @__PURE__ */ new Map();
632
+ for (const [groupName, group] of Object.entries(styles)) {
633
+ for (const [styleName, style] of Object.entries(group)) {
634
+ styles[styleName] = {
635
+ open: `\x1B[${style[0]}m`,
636
+ close: `\x1B[${style[1]}m`
637
+ };
638
+ group[styleName] = styles[styleName];
639
+ codes.set(style[0], style[1]);
640
+ }
641
+ Object.defineProperty(styles, groupName, {
642
+ value: group,
643
+ enumerable: false
644
+ });
645
+ }
646
+ Object.defineProperty(styles, "codes", {
647
+ value: codes,
648
+ enumerable: false
649
+ });
650
+ styles.color.close = "\x1B[39m";
651
+ styles.bgColor.close = "\x1B[49m";
652
+ styles.color.ansi = wrapAnsi16();
653
+ styles.color.ansi256 = wrapAnsi256();
654
+ styles.color.ansi16m = wrapAnsi16m();
655
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
656
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
657
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
658
+ Object.defineProperties(styles, {
659
+ rgbToAnsi256: {
660
+ value: (red, green, blue) => {
661
+ if (red === green && green === blue) {
662
+ if (red < 8) {
663
+ return 16;
664
+ }
665
+ if (red > 248) {
666
+ return 231;
667
+ }
668
+ return Math.round((red - 8) / 247 * 24) + 232;
669
+ }
670
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
671
+ },
672
+ enumerable: false
673
+ },
674
+ hexToRgb: {
675
+ value: (hex) => {
676
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
677
+ if (!matches) {
678
+ return [0, 0, 0];
679
+ }
680
+ let [colorString] = matches;
681
+ if (colorString.length === 3) {
682
+ colorString = [...colorString].map((character) => character + character).join("");
683
+ }
684
+ const integer = Number.parseInt(colorString, 16);
685
+ return [
686
+ /* eslint-disable no-bitwise */
687
+ integer >> 16 & 255,
688
+ integer >> 8 & 255,
689
+ integer & 255
690
+ /* eslint-enable no-bitwise */
691
+ ];
692
+ },
693
+ enumerable: false
694
+ },
695
+ hexToAnsi256: {
696
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
697
+ enumerable: false
698
+ },
699
+ ansi256ToAnsi: {
700
+ value: (code) => {
701
+ if (code < 8) {
702
+ return 30 + code;
703
+ }
704
+ if (code < 16) {
705
+ return 90 + (code - 8);
706
+ }
707
+ let red;
708
+ let green;
709
+ let blue;
710
+ if (code >= 232) {
711
+ red = ((code - 232) * 10 + 8) / 255;
712
+ green = red;
713
+ blue = red;
714
+ } else {
715
+ code -= 16;
716
+ const remainder = code % 36;
717
+ red = Math.floor(code / 36) / 5;
718
+ green = Math.floor(remainder / 6) / 5;
719
+ blue = remainder % 6 / 5;
720
+ }
721
+ const value = Math.max(red, green, blue) * 2;
722
+ if (value === 0) {
723
+ return 30;
724
+ }
725
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
726
+ if (value === 2) {
727
+ result += 60;
728
+ }
729
+ return result;
730
+ },
731
+ enumerable: false
732
+ },
733
+ rgbToAnsi: {
734
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
735
+ enumerable: false
736
+ },
737
+ hexToAnsi: {
738
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
739
+ enumerable: false
740
+ }
741
+ });
742
+ return styles;
743
+ }
744
+ var ansiStyles = assembleStyles();
745
+ var ansi_styles_default = ansiStyles;
746
+
747
+ // ../../node_modules/.pnpm/wrap-ansi@8.1.0/node_modules/wrap-ansi/index.js
748
+ var ESCAPES = /* @__PURE__ */ new Set([
749
+ "\x1B",
750
+ "\x9B"
751
+ ]);
752
+ var END_CODE = 39;
753
+ var ANSI_ESCAPE_BELL = "\x07";
754
+ var ANSI_CSI = "[";
755
+ var ANSI_OSC = "]";
756
+ var ANSI_SGR_TERMINATOR = "m";
757
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
758
+ var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
759
+ var wrapAnsiHyperlink = (uri) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
760
+ var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
761
+ var wrapWord = (rows, word, columns) => {
762
+ const characters = [...word];
763
+ let isInsideEscape = false;
764
+ let isInsideLinkEscape = false;
765
+ let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
766
+ for (const [index, character] of characters.entries()) {
767
+ const characterLength = stringWidth(character);
768
+ if (visible + characterLength <= columns) {
769
+ rows[rows.length - 1] += character;
770
+ } else {
771
+ rows.push(character);
772
+ visible = 0;
773
+ }
774
+ if (ESCAPES.has(character)) {
775
+ isInsideEscape = true;
776
+ isInsideLinkEscape = characters.slice(index + 1).join("").startsWith(ANSI_ESCAPE_LINK);
777
+ }
778
+ if (isInsideEscape) {
779
+ if (isInsideLinkEscape) {
780
+ if (character === ANSI_ESCAPE_BELL) {
781
+ isInsideEscape = false;
782
+ isInsideLinkEscape = false;
783
+ }
784
+ } else if (character === ANSI_SGR_TERMINATOR) {
785
+ isInsideEscape = false;
786
+ }
787
+ continue;
788
+ }
789
+ visible += characterLength;
790
+ if (visible === columns && index < characters.length - 1) {
791
+ rows.push("");
792
+ visible = 0;
793
+ }
794
+ }
795
+ if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
796
+ rows[rows.length - 2] += rows.pop();
797
+ }
798
+ };
799
+ var stringVisibleTrimSpacesRight = (string) => {
800
+ const words = string.split(" ");
801
+ let last = words.length;
802
+ while (last > 0) {
803
+ if (stringWidth(words[last - 1]) > 0) {
804
+ break;
805
+ }
806
+ last--;
807
+ }
808
+ if (last === words.length) {
809
+ return string;
810
+ }
811
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
812
+ };
813
+ var exec = (string, columns, options = {}) => {
814
+ if (options.trim !== false && string.trim() === "") {
815
+ return "";
816
+ }
817
+ let returnValue = "";
818
+ let escapeCode;
819
+ let escapeUrl;
820
+ const lengths = wordLengths(string);
821
+ let rows = [""];
822
+ for (const [index, word] of string.split(" ").entries()) {
823
+ if (options.trim !== false) {
824
+ rows[rows.length - 1] = rows[rows.length - 1].trimStart();
825
+ }
826
+ let rowLength = stringWidth(rows[rows.length - 1]);
827
+ if (index !== 0) {
828
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
829
+ rows.push("");
830
+ rowLength = 0;
831
+ }
832
+ if (rowLength > 0 || options.trim === false) {
833
+ rows[rows.length - 1] += " ";
834
+ rowLength++;
835
+ }
836
+ }
837
+ if (options.hard && lengths[index] > columns) {
838
+ const remainingColumns = columns - rowLength;
839
+ const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
840
+ const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
841
+ if (breaksStartingNextLine < breaksStartingThisLine) {
842
+ rows.push("");
843
+ }
844
+ wrapWord(rows, word, columns);
845
+ continue;
846
+ }
847
+ if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
848
+ if (options.wordWrap === false && rowLength < columns) {
849
+ wrapWord(rows, word, columns);
850
+ continue;
851
+ }
852
+ rows.push("");
853
+ }
854
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
855
+ wrapWord(rows, word, columns);
856
+ continue;
857
+ }
858
+ rows[rows.length - 1] += word;
859
+ }
860
+ if (options.trim !== false) {
861
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
862
+ }
863
+ const pre = [...rows.join("\n")];
864
+ for (const [index, character] of pre.entries()) {
865
+ returnValue += character;
866
+ if (ESCAPES.has(character)) {
867
+ const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join("")) || { groups: {} };
868
+ if (groups.code !== void 0) {
869
+ const code2 = Number.parseFloat(groups.code);
870
+ escapeCode = code2 === END_CODE ? void 0 : code2;
871
+ } else if (groups.uri !== void 0) {
872
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
873
+ }
874
+ }
875
+ const code = ansi_styles_default.codes.get(Number(escapeCode));
876
+ if (pre[index + 1] === "\n") {
877
+ if (escapeUrl) {
878
+ returnValue += wrapAnsiHyperlink("");
879
+ }
880
+ if (escapeCode && code) {
881
+ returnValue += wrapAnsiCode(code);
882
+ }
883
+ } else if (character === "\n") {
884
+ if (escapeCode && code) {
885
+ returnValue += wrapAnsiCode(escapeCode);
886
+ }
887
+ if (escapeUrl) {
888
+ returnValue += wrapAnsiHyperlink(escapeUrl);
889
+ }
890
+ }
891
+ }
892
+ return returnValue;
893
+ };
894
+ function wrapAnsi(string, columns, options) {
895
+ return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
896
+ }
897
+
898
+ // ../../node_modules/.pnpm/@isaacs+cliui@8.0.2/node_modules/@isaacs/cliui/index.mjs
899
+ function ui(opts) {
900
+ return cliui(opts, {
901
+ stringWidth,
902
+ stripAnsi,
903
+ wrap: wrapAnsi
904
+ });
905
+ }
906
+
907
+ // ../../node_modules/.pnpm/jackspeak@4.0.2/node_modules/jackspeak/dist/esm/index.js
908
+ import { basename } from "node:path";
909
+ var isConfigType = (t) => typeof t === "string" && (t === "string" || t === "number" || t === "boolean");
910
+ var isValidValue = (v, type, multi) => {
911
+ if (multi) {
912
+ if (!Array.isArray(v))
913
+ return false;
914
+ return !v.some((v2) => !isValidValue(v2, type, false));
915
+ }
916
+ if (Array.isArray(v))
917
+ return false;
918
+ return typeof v === type;
919
+ };
920
+ var isValidOption = (v, vo) => !!vo && (Array.isArray(v) ? v.every((x) => isValidOption(x, vo)) : vo.includes(v));
921
+ var isConfigOptionOfType = (o, type, multi) => !!o && typeof o === "object" && isConfigType(o.type) && o.type === type && !!o.multiple === multi;
922
+ var isConfigOption = (o, type, multi) => isConfigOptionOfType(o, type, multi) && undefOrType(o.short, "string") && undefOrType(o.description, "string") && undefOrType(o.hint, "string") && undefOrType(o.validate, "function") && (o.type === "boolean" ? o.validOptions === void 0 : undefOrTypeArray(o.validOptions, o.type)) && (o.default === void 0 || isValidValue(o.default, type, multi));
923
+ var isHeading = (r) => r.type === "heading";
924
+ var isDescription = (r) => r.type === "description";
925
+ var width = Math.min(process?.stdout?.columns ?? 80, 80);
926
+ var indent = (n) => (n - 1) * 2;
927
+ var toEnvKey = (pref, key) => [pref, key.replace(/[^a-zA-Z0-9]+/g, " ")].join(" ").trim().toUpperCase().replace(/ /g, "_");
928
+ var toEnvVal = (value, delim = "\n") => {
929
+ const str = typeof value === "string" ? value : typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? String(value) : Array.isArray(value) ? value.map((v) => toEnvVal(v)).join(delim) : (
930
+ /* c8 ignore start */
931
+ void 0
932
+ );
933
+ if (typeof str !== "string") {
934
+ throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`);
935
+ }
936
+ return str;
937
+ };
938
+ var fromEnvVal = (env, type, multiple, delim = "\n") => multiple ? env ? env.split(delim).map((v) => fromEnvVal(v, type, false)) : [] : type === "string" ? env : type === "boolean" ? env === "1" : +env.trim();
939
+ var undefOrType = (v, t) => v === void 0 || typeof v === t;
940
+ var undefOrTypeArray = (v, t) => v === void 0 || Array.isArray(v) && v.every((x) => typeof x === t);
941
+ var valueType = (v) => typeof v === "string" ? "string" : typeof v === "boolean" ? "boolean" : typeof v === "number" ? "number" : Array.isArray(v) ? `${joinTypes([...new Set(v.map((v2) => valueType(v2)))])}[]` : `${v.type}${v.multiple ? "[]" : ""}`;
942
+ var joinTypes = (types) => types.length === 1 && typeof types[0] === "string" ? types[0] : `(${types.join("|")})`;
943
+ var validateFieldMeta = (field, fieldMeta) => {
944
+ if (fieldMeta) {
945
+ if (field.type !== void 0 && field.type !== fieldMeta.type) {
946
+ throw new TypeError(`invalid type`, {
947
+ cause: {
948
+ found: field.type,
949
+ wanted: [fieldMeta.type, void 0]
950
+ }
951
+ });
952
+ }
953
+ if (field.multiple !== void 0 && !!field.multiple !== fieldMeta.multiple) {
954
+ throw new TypeError(`invalid multiple`, {
955
+ cause: {
956
+ found: field.multiple,
957
+ wanted: [fieldMeta.multiple, void 0]
958
+ }
959
+ });
960
+ }
961
+ return fieldMeta;
962
+ }
963
+ if (!isConfigType(field.type)) {
964
+ throw new TypeError(`invalid type`, {
965
+ cause: {
966
+ found: field.type,
967
+ wanted: ["string", "number", "boolean"]
968
+ }
969
+ });
970
+ }
971
+ return {
972
+ type: field.type,
973
+ multiple: !!field.multiple
974
+ };
975
+ };
976
+ var validateField = (o, type, multiple) => {
977
+ const validateValidOptions = (def, validOptions) => {
978
+ if (!undefOrTypeArray(validOptions, type)) {
979
+ throw new TypeError("invalid validOptions", {
980
+ cause: {
981
+ found: validOptions,
982
+ wanted: valueType({ type, multiple: true })
983
+ }
984
+ });
985
+ }
986
+ if (def !== void 0 && validOptions !== void 0) {
987
+ const valid = Array.isArray(def) ? def.every((v) => validOptions.includes(v)) : validOptions.includes(def);
988
+ if (!valid) {
989
+ throw new TypeError("invalid default value not in validOptions", {
990
+ cause: {
991
+ found: def,
992
+ wanted: validOptions
993
+ }
994
+ });
995
+ }
996
+ }
997
+ };
998
+ if (o.default !== void 0 && !isValidValue(o.default, type, multiple)) {
999
+ throw new TypeError("invalid default value", {
1000
+ cause: {
1001
+ found: o.default,
1002
+ wanted: valueType({ type, multiple })
1003
+ }
1004
+ });
1005
+ }
1006
+ if (isConfigOptionOfType(o, "number", false) || isConfigOptionOfType(o, "number", true)) {
1007
+ validateValidOptions(o.default, o.validOptions);
1008
+ } else if (isConfigOptionOfType(o, "string", false) || isConfigOptionOfType(o, "string", true)) {
1009
+ validateValidOptions(o.default, o.validOptions);
1010
+ } else if (isConfigOptionOfType(o, "boolean", false) || isConfigOptionOfType(o, "boolean", true)) {
1011
+ if (o.hint !== void 0) {
1012
+ throw new TypeError("cannot provide hint for flag");
1013
+ }
1014
+ if (o.validOptions !== void 0) {
1015
+ throw new TypeError("cannot provide validOptions for flag");
1016
+ }
1017
+ }
1018
+ return o;
1019
+ };
1020
+ var toParseArgsOptionsConfig = (options) => {
1021
+ return Object.entries(options).reduce((acc, [longOption, o]) => {
1022
+ const p = {
1023
+ type: "string",
1024
+ multiple: !!o.multiple,
1025
+ ...typeof o.short === "string" ? { short: o.short } : void 0
1026
+ };
1027
+ const setNoBool = () => {
1028
+ if (!longOption.startsWith("no-") && !options[`no-${longOption}`]) {
1029
+ acc[`no-${longOption}`] = {
1030
+ type: "boolean",
1031
+ multiple: !!o.multiple
1032
+ };
1033
+ }
1034
+ };
1035
+ const setDefault = (def, fn) => {
1036
+ if (def !== void 0) {
1037
+ p.default = fn(def);
1038
+ }
1039
+ };
1040
+ if (isConfigOption(o, "number", false)) {
1041
+ setDefault(o.default, String);
1042
+ } else if (isConfigOption(o, "number", true)) {
1043
+ setDefault(o.default, (d) => d.map((v) => String(v)));
1044
+ } else if (isConfigOption(o, "string", false) || isConfigOption(o, "string", true)) {
1045
+ setDefault(o.default, (v) => v);
1046
+ } else if (isConfigOption(o, "boolean", false) || isConfigOption(o, "boolean", true)) {
1047
+ p.type = "boolean";
1048
+ setDefault(o.default, (v) => v);
1049
+ setNoBool();
1050
+ }
1051
+ acc[longOption] = p;
1052
+ return acc;
1053
+ }, {});
1054
+ };
1055
+ var Jack = class {
1056
+ #configSet;
1057
+ #shorts;
1058
+ #options;
1059
+ #fields = [];
1060
+ #env;
1061
+ #envPrefix;
1062
+ #allowPositionals;
1063
+ #usage;
1064
+ #usageMarkdown;
1065
+ constructor(options = {}) {
1066
+ this.#options = options;
1067
+ this.#allowPositionals = options.allowPositionals !== false;
1068
+ this.#env = this.#options.env === void 0 ? process.env : this.#options.env;
1069
+ this.#envPrefix = options.envPrefix;
1070
+ this.#configSet = /* @__PURE__ */ Object.create(null);
1071
+ this.#shorts = /* @__PURE__ */ Object.create(null);
1072
+ }
1073
+ /**
1074
+ * Set the default value (which will still be overridden by env or cli)
1075
+ * as if from a parsed config file. The optional `source` param, if
1076
+ * provided, will be included in error messages if a value is invalid or
1077
+ * unknown.
1078
+ */
1079
+ setConfigValues(values, source = "") {
1080
+ try {
1081
+ this.validate(values);
1082
+ } catch (er) {
1083
+ if (source && er instanceof Error) {
1084
+ const cause = typeof er.cause === "object" ? er.cause : {};
1085
+ er.cause = { ...cause, path: source };
1086
+ }
1087
+ throw er;
1088
+ }
1089
+ for (const [field, value] of Object.entries(values)) {
1090
+ const my = this.#configSet[field];
1091
+ if (!my) {
1092
+ throw new Error("unexpected field in config set: " + field, {
1093
+ cause: { found: field }
1094
+ });
1095
+ }
1096
+ my.default = value;
1097
+ }
1098
+ return this;
1099
+ }
1100
+ /**
1101
+ * Parse a string of arguments, and return the resulting
1102
+ * `{ values, positionals }` object.
1103
+ *
1104
+ * If an {@link JackOptions#envPrefix} is set, then it will read default
1105
+ * values from the environment, and write the resulting values back
1106
+ * to the environment as well.
1107
+ *
1108
+ * Environment values always take precedence over any other value, except
1109
+ * an explicit CLI setting.
1110
+ */
1111
+ parse(args = process.argv) {
1112
+ this.loadEnvDefaults();
1113
+ const p = this.parseRaw(args);
1114
+ this.applyDefaults(p);
1115
+ this.writeEnv(p);
1116
+ return p;
1117
+ }
1118
+ loadEnvDefaults() {
1119
+ if (this.#envPrefix) {
1120
+ for (const [field, my] of Object.entries(this.#configSet)) {
1121
+ const ek = toEnvKey(this.#envPrefix, field);
1122
+ const env = this.#env[ek];
1123
+ if (env !== void 0) {
1124
+ my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim);
1125
+ }
1126
+ }
1127
+ }
1128
+ }
1129
+ applyDefaults(p) {
1130
+ for (const [field, c] of Object.entries(this.#configSet)) {
1131
+ if (c.default !== void 0 && !(field in p.values)) {
1132
+ p.values[field] = c.default;
1133
+ }
1134
+ }
1135
+ }
1136
+ /**
1137
+ * Only parse the command line arguments passed in.
1138
+ * Does not strip off the `node script.js` bits, so it must be just the
1139
+ * arguments you wish to have parsed.
1140
+ * Does not read from or write to the environment, or set defaults.
1141
+ */
1142
+ parseRaw(args) {
1143
+ if (args === process.argv) {
1144
+ args = args.slice(process._eval !== void 0 ? 1 : 2);
1145
+ }
1146
+ const result = parseArgs({
1147
+ args,
1148
+ options: toParseArgsOptionsConfig(this.#configSet),
1149
+ // always strict, but using our own logic
1150
+ strict: false,
1151
+ allowPositionals: this.#allowPositionals,
1152
+ tokens: true
1153
+ });
1154
+ const p = {
1155
+ values: {},
1156
+ positionals: []
1157
+ };
1158
+ for (const token of result.tokens) {
1159
+ if (token.kind === "positional") {
1160
+ p.positionals.push(token.value);
1161
+ if (this.#options.stopAtPositional || this.#options.stopAtPositionalTest?.(token.value)) {
1162
+ p.positionals.push(...args.slice(token.index + 1));
1163
+ break;
1164
+ }
1165
+ } else if (token.kind === "option") {
1166
+ let value = void 0;
1167
+ if (token.name.startsWith("no-")) {
1168
+ const my2 = this.#configSet[token.name];
1169
+ const pname = token.name.substring("no-".length);
1170
+ const pos = this.#configSet[pname];
1171
+ if (pos && pos.type === "boolean" && (!my2 || my2.type === "boolean" && !!my2.multiple === !!pos.multiple)) {
1172
+ value = false;
1173
+ token.name = pname;
1174
+ }
1175
+ }
1176
+ const my = this.#configSet[token.name];
1177
+ if (!my) {
1178
+ throw new Error(`Unknown option '${token.rawName}'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${token.rawName}'`, {
1179
+ cause: {
1180
+ found: token.rawName + (token.value ? `=${token.value}` : "")
1181
+ }
1182
+ });
1183
+ }
1184
+ if (value === void 0) {
1185
+ if (token.value === void 0) {
1186
+ if (my.type !== "boolean") {
1187
+ throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, {
1188
+ cause: {
1189
+ name: token.rawName,
1190
+ wanted: valueType(my)
1191
+ }
1192
+ });
1193
+ }
1194
+ value = true;
1195
+ } else {
1196
+ if (my.type === "boolean") {
1197
+ throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { found: token } });
1198
+ }
1199
+ if (my.type === "string") {
1200
+ value = token.value;
1201
+ } else {
1202
+ value = +token.value;
1203
+ if (value !== value) {
1204
+ throw new Error(`Invalid value '${token.value}' provided for '${token.rawName}' option, expected number`, {
1205
+ cause: {
1206
+ name: token.rawName,
1207
+ found: token.value,
1208
+ wanted: "number"
1209
+ }
1210
+ });
1211
+ }
1212
+ }
1213
+ }
1214
+ }
1215
+ if (my.multiple) {
1216
+ const pv = p.values;
1217
+ const tn = pv[token.name] ?? [];
1218
+ pv[token.name] = tn;
1219
+ tn.push(value);
1220
+ } else {
1221
+ const pv = p.values;
1222
+ pv[token.name] = value;
1223
+ }
1224
+ }
1225
+ }
1226
+ for (const [field, value] of Object.entries(p.values)) {
1227
+ const valid = this.#configSet[field]?.validate;
1228
+ const validOptions = this.#configSet[field]?.validOptions;
1229
+ const cause = validOptions && !isValidOption(value, validOptions) ? { name: field, found: value, validOptions } : valid && !valid(value) ? { name: field, found: value } : void 0;
1230
+ if (cause) {
1231
+ throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause });
1232
+ }
1233
+ }
1234
+ return p;
1235
+ }
1236
+ /**
1237
+ * do not set fields as 'no-foo' if 'foo' exists and both are bools
1238
+ * just set foo.
1239
+ */
1240
+ #noNoFields(f, val, s = f) {
1241
+ if (!f.startsWith("no-") || typeof val !== "boolean")
1242
+ return;
1243
+ const yes = f.substring("no-".length);
1244
+ this.#noNoFields(yes, val, s);
1245
+ if (this.#configSet[yes]?.type === "boolean") {
1246
+ throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { found: s, wanted: yes } });
1247
+ }
1248
+ }
1249
+ /**
1250
+ * Validate that any arbitrary object is a valid configuration `values`
1251
+ * object. Useful when loading config files or other sources.
1252
+ */
1253
+ validate(o) {
1254
+ if (!o || typeof o !== "object") {
1255
+ throw new Error("Invalid config: not an object", {
1256
+ cause: { found: o }
1257
+ });
1258
+ }
1259
+ const opts = o;
1260
+ for (const field in o) {
1261
+ const value = opts[field];
1262
+ if (value === void 0)
1263
+ continue;
1264
+ this.#noNoFields(field, value);
1265
+ const config = this.#configSet[field];
1266
+ if (!config) {
1267
+ throw new Error(`Unknown config option: ${field}`, {
1268
+ cause: { found: field }
1269
+ });
1270
+ }
1271
+ if (!isValidValue(value, config.type, !!config.multiple)) {
1272
+ throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, {
1273
+ cause: {
1274
+ name: field,
1275
+ found: value,
1276
+ wanted: valueType(config)
1277
+ }
1278
+ });
1279
+ }
1280
+ const cause = config.validOptions && !isValidOption(value, config.validOptions) ? { name: field, found: value, validOptions: config.validOptions } : config.validate && !config.validate(value) ? { name: field, found: value } : void 0;
1281
+ if (cause) {
1282
+ throw new Error(`Invalid config value for ${field}: ${value}`, {
1283
+ cause
1284
+ });
1285
+ }
1286
+ }
1287
+ }
1288
+ writeEnv(p) {
1289
+ if (!this.#env || !this.#envPrefix)
1290
+ return;
1291
+ for (const [field, value] of Object.entries(p.values)) {
1292
+ const my = this.#configSet[field];
1293
+ this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim);
1294
+ }
1295
+ }
1296
+ /**
1297
+ * Add a heading to the usage output banner
1298
+ */
1299
+ heading(text, level, { pre = false } = {}) {
1300
+ if (level === void 0) {
1301
+ level = this.#fields.some((r) => isHeading(r)) ? 2 : 1;
1302
+ }
1303
+ this.#fields.push({ type: "heading", text, level, pre });
1304
+ return this;
1305
+ }
1306
+ /**
1307
+ * Add a long-form description to the usage output at this position.
1308
+ */
1309
+ description(text, { pre } = {}) {
1310
+ this.#fields.push({ type: "description", text, pre });
1311
+ return this;
1312
+ }
1313
+ /**
1314
+ * Add one or more number fields.
1315
+ */
1316
+ num(fields) {
1317
+ return this.#addFieldsWith(fields, "number", false);
1318
+ }
1319
+ /**
1320
+ * Add one or more multiple number fields.
1321
+ */
1322
+ numList(fields) {
1323
+ return this.#addFieldsWith(fields, "number", true);
1324
+ }
1325
+ /**
1326
+ * Add one or more string option fields.
1327
+ */
1328
+ opt(fields) {
1329
+ return this.#addFieldsWith(fields, "string", false);
1330
+ }
1331
+ /**
1332
+ * Add one or more multiple string option fields.
1333
+ */
1334
+ optList(fields) {
1335
+ return this.#addFieldsWith(fields, "string", true);
1336
+ }
1337
+ /**
1338
+ * Add one or more flag fields.
1339
+ */
1340
+ flag(fields) {
1341
+ return this.#addFieldsWith(fields, "boolean", false);
1342
+ }
1343
+ /**
1344
+ * Add one or more multiple flag fields.
1345
+ */
1346
+ flagList(fields) {
1347
+ return this.#addFieldsWith(fields, "boolean", true);
1348
+ }
1349
+ /**
1350
+ * Generic field definition method. Similar to flag/flagList/number/etc,
1351
+ * but you must specify the `type` (and optionally `multiple` and `delim`)
1352
+ * fields on each one, or Jack won't know how to define them.
1353
+ */
1354
+ addFields(fields) {
1355
+ return this.#addFields(this, fields);
1356
+ }
1357
+ #addFieldsWith(fields, type, multiple) {
1358
+ return this.#addFields(this, fields, {
1359
+ type,
1360
+ multiple
1361
+ });
1362
+ }
1363
+ #addFields(next, fields, opt) {
1364
+ Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => {
1365
+ this.#validateName(name, field);
1366
+ const { type, multiple } = validateFieldMeta(field, opt);
1367
+ const value = { ...field, type, multiple };
1368
+ validateField(value, type, multiple);
1369
+ next.#fields.push({ type: "config", name, value });
1370
+ return [name, value];
1371
+ })));
1372
+ return next;
1373
+ }
1374
+ #validateName(name, field) {
1375
+ if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {
1376
+ throw new TypeError(`Invalid option name: ${name}, must be '-' delimited ASCII alphanumeric`);
1377
+ }
1378
+ if (this.#configSet[name]) {
1379
+ throw new TypeError(`Cannot redefine option ${field}`);
1380
+ }
1381
+ if (this.#shorts[name]) {
1382
+ throw new TypeError(`Cannot redefine option ${name}, already in use for ${this.#shorts[name]}`);
1383
+ }
1384
+ if (field.short) {
1385
+ if (!/^[a-zA-Z0-9]$/.test(field.short)) {
1386
+ throw new TypeError(`Invalid ${name} short option: ${field.short}, must be 1 ASCII alphanumeric character`);
1387
+ }
1388
+ if (this.#shorts[field.short]) {
1389
+ throw new TypeError(`Invalid ${name} short option: ${field.short}, already in use for ${this.#shorts[field.short]}`);
1390
+ }
1391
+ this.#shorts[field.short] = name;
1392
+ this.#shorts[name] = name;
1393
+ }
1394
+ }
1395
+ /**
1396
+ * Return the usage banner for the given configuration
1397
+ */
1398
+ usage() {
1399
+ if (this.#usage)
1400
+ return this.#usage;
1401
+ let headingLevel = 1;
1402
+ const ui2 = ui({ width });
1403
+ const first = this.#fields[0];
1404
+ let start = first?.type === "heading" ? 1 : 0;
1405
+ if (first?.type === "heading") {
1406
+ ui2.div({
1407
+ padding: [0, 0, 0, 0],
1408
+ text: normalize(first.text)
1409
+ });
1410
+ }
1411
+ ui2.div({ padding: [0, 0, 0, 0], text: "Usage:" });
1412
+ if (this.#options.usage) {
1413
+ ui2.div({
1414
+ text: this.#options.usage,
1415
+ padding: [0, 0, 0, 2]
1416
+ });
1417
+ } else {
1418
+ const cmd = basename(String(process.argv[1]));
1419
+ const shortFlags = [];
1420
+ const shorts = [];
1421
+ const flags = [];
1422
+ const opts = [];
1423
+ for (const [field, config] of Object.entries(this.#configSet)) {
1424
+ if (config.short) {
1425
+ if (config.type === "boolean")
1426
+ shortFlags.push(config.short);
1427
+ else
1428
+ shorts.push([config.short, config.hint || field]);
1429
+ } else {
1430
+ if (config.type === "boolean")
1431
+ flags.push(field);
1432
+ else
1433
+ opts.push([field, config.hint || field]);
1434
+ }
1435
+ }
1436
+ const sf = shortFlags.length ? " -" + shortFlags.join("") : "";
1437
+ const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join("");
1438
+ const lf = flags.map((k) => ` --${k}`).join("");
1439
+ const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join("");
1440
+ const usage2 = `${cmd}${sf}${so}${lf}${lo}`.trim();
1441
+ ui2.div({
1442
+ text: usage2,
1443
+ padding: [0, 0, 0, 2]
1444
+ });
1445
+ }
1446
+ ui2.div({ padding: [0, 0, 0, 0], text: "" });
1447
+ const maybeDesc = this.#fields[start];
1448
+ if (maybeDesc && isDescription(maybeDesc)) {
1449
+ const print = normalize(maybeDesc.text, maybeDesc.pre);
1450
+ start++;
1451
+ ui2.div({ padding: [0, 0, 0, 0], text: print });
1452
+ ui2.div({ padding: [0, 0, 0, 0], text: "" });
1453
+ }
1454
+ const { rows, maxWidth } = this.#usageRows(start);
1455
+ for (const row of rows) {
1456
+ if (row.left) {
1457
+ const configIndent = indent(Math.max(headingLevel, 2));
1458
+ if (row.left.length > maxWidth - 3) {
1459
+ ui2.div({ text: row.left, padding: [0, 0, 0, configIndent] });
1460
+ ui2.div({ text: row.text, padding: [0, 0, 0, maxWidth] });
1461
+ } else {
1462
+ ui2.div({
1463
+ text: row.left,
1464
+ padding: [0, 1, 0, configIndent],
1465
+ width: maxWidth
1466
+ }, { padding: [0, 0, 0, 0], text: row.text });
1467
+ }
1468
+ if (row.skipLine) {
1469
+ ui2.div({ padding: [0, 0, 0, 0], text: "" });
1470
+ }
1471
+ } else {
1472
+ if (isHeading(row)) {
1473
+ const { level } = row;
1474
+ headingLevel = level;
1475
+ const b = level <= 2 ? 1 : 0;
1476
+ ui2.div({ ...row, padding: [0, 0, b, indent(level)] });
1477
+ } else {
1478
+ ui2.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] });
1479
+ }
1480
+ }
1481
+ }
1482
+ return this.#usage = ui2.toString();
1483
+ }
1484
+ /**
1485
+ * Return the usage banner markdown for the given configuration
1486
+ */
1487
+ usageMarkdown() {
1488
+ if (this.#usageMarkdown)
1489
+ return this.#usageMarkdown;
1490
+ const out = [];
1491
+ let headingLevel = 1;
1492
+ const first = this.#fields[0];
1493
+ let start = first?.type === "heading" ? 1 : 0;
1494
+ if (first?.type === "heading") {
1495
+ out.push(`# ${normalizeOneLine(first.text)}`);
1496
+ }
1497
+ out.push("Usage:");
1498
+ if (this.#options.usage) {
1499
+ out.push(normalizeMarkdown(this.#options.usage, true));
1500
+ } else {
1501
+ const cmd = basename(String(process.argv[1]));
1502
+ const shortFlags = [];
1503
+ const shorts = [];
1504
+ const flags = [];
1505
+ const opts = [];
1506
+ for (const [field, config] of Object.entries(this.#configSet)) {
1507
+ if (config.short) {
1508
+ if (config.type === "boolean")
1509
+ shortFlags.push(config.short);
1510
+ else
1511
+ shorts.push([config.short, config.hint || field]);
1512
+ } else {
1513
+ if (config.type === "boolean")
1514
+ flags.push(field);
1515
+ else
1516
+ opts.push([field, config.hint || field]);
1517
+ }
1518
+ }
1519
+ const sf = shortFlags.length ? " -" + shortFlags.join("") : "";
1520
+ const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join("");
1521
+ const lf = flags.map((k) => ` --${k}`).join("");
1522
+ const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join("");
1523
+ const usage2 = `${cmd}${sf}${so}${lf}${lo}`.trim();
1524
+ out.push(normalizeMarkdown(usage2, true));
1525
+ }
1526
+ const maybeDesc = this.#fields[start];
1527
+ if (maybeDesc && isDescription(maybeDesc)) {
1528
+ out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre));
1529
+ start++;
1530
+ }
1531
+ const { rows } = this.#usageRows(start);
1532
+ for (const row of rows) {
1533
+ if (row.left) {
1534
+ out.push("#".repeat(headingLevel + 1) + " " + normalizeOneLine(row.left, true));
1535
+ if (row.text)
1536
+ out.push(normalizeMarkdown(row.text));
1537
+ } else if (isHeading(row)) {
1538
+ const { level } = row;
1539
+ headingLevel = level;
1540
+ out.push(`${"#".repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`);
1541
+ } else {
1542
+ out.push(normalizeMarkdown(row.text, !!row.pre));
1543
+ }
1544
+ }
1545
+ return this.#usageMarkdown = out.join("\n\n") + "\n";
1546
+ }
1547
+ #usageRows(start) {
1548
+ let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)));
1549
+ let maxWidth = 8;
1550
+ let prev = void 0;
1551
+ const rows = [];
1552
+ for (const field of this.#fields.slice(start)) {
1553
+ if (field.type !== "config") {
1554
+ if (prev?.type === "config")
1555
+ prev.skipLine = true;
1556
+ prev = void 0;
1557
+ field.text = normalize(field.text, !!field.pre);
1558
+ rows.push(field);
1559
+ continue;
1560
+ }
1561
+ const { value } = field;
1562
+ const desc = value.description || "";
1563
+ const mult = value.multiple ? "Can be set multiple times" : "";
1564
+ const opts = value.validOptions?.length ? `Valid options:${value.validOptions.map((v) => ` ${JSON.stringify(v)}`)}` : "";
1565
+ const dmDelim = desc.includes("\n") ? "\n\n" : "\n";
1566
+ const extra = [opts, mult].join(dmDelim).trim();
1567
+ const text = (normalize(desc) + dmDelim + extra).trim();
1568
+ const hint = value.hint || (value.type === "number" ? "n" : value.type === "string" ? field.name : void 0);
1569
+ const short = !value.short ? "" : value.type === "boolean" ? `-${value.short} ` : `-${value.short}<${hint}> `;
1570
+ const left2 = value.type === "boolean" ? `${short}--${field.name}` : `${short}--${field.name}=<${hint}>`;
1571
+ const row = { text, left: left2, type: "config" };
1572
+ if (text.length > width - maxMax) {
1573
+ row.skipLine = true;
1574
+ }
1575
+ if (prev && left2.length > maxMax)
1576
+ prev.skipLine = true;
1577
+ prev = row;
1578
+ const len = left2.length + 4;
1579
+ if (len > maxWidth && len < maxMax) {
1580
+ maxWidth = len;
1581
+ }
1582
+ rows.push(row);
1583
+ }
1584
+ return { rows, maxWidth };
1585
+ }
1586
+ /**
1587
+ * Return the configuration options as a plain object
1588
+ */
1589
+ toJSON() {
1590
+ return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [
1591
+ field,
1592
+ {
1593
+ type: def.type,
1594
+ ...def.multiple ? { multiple: true } : {},
1595
+ ...def.delim ? { delim: def.delim } : {},
1596
+ ...def.short ? { short: def.short } : {},
1597
+ ...def.description ? { description: normalize(def.description) } : {},
1598
+ ...def.validate ? { validate: def.validate } : {},
1599
+ ...def.validOptions ? { validOptions: def.validOptions } : {},
1600
+ ...def.default !== void 0 ? { default: def.default } : {},
1601
+ ...def.hint ? { hint: def.hint } : {}
1602
+ }
1603
+ ]));
1604
+ }
1605
+ /**
1606
+ * Custom printer for `util.inspect`
1607
+ */
1608
+ [inspect.custom](_, options) {
1609
+ return `Jack ${inspect(this.toJSON(), options)}`;
1610
+ }
1611
+ };
1612
+ var jack = (options = {}) => new Jack(options);
1613
+ var normalize = (s, pre = false) => {
1614
+ if (pre)
1615
+ return s.split("\n").map((l) => `\u200B${l}`).join("\n");
1616
+ return s.split(/^\s*```\s*$/gm).map((s2, i) => {
1617
+ if (i % 2 === 1) {
1618
+ if (!s2.trim()) {
1619
+ return `\`\`\`
1620
+ \`\`\`
1621
+ `;
1622
+ }
1623
+ const split = s2.split("\n");
1624
+ split.pop();
1625
+ split.shift();
1626
+ const si = split.reduce((shortest, l) => {
1627
+ const ind = l.match(/^\s*/)?.[0] ?? "";
1628
+ if (ind.length)
1629
+ return Math.min(ind.length, shortest);
1630
+ else
1631
+ return shortest;
1632
+ }, Infinity);
1633
+ const i2 = isFinite(si) ? si : 0;
1634
+ return "\n```\n" + split.map((s3) => `\u200B${s3.substring(i2)}`).join("\n") + "\n```\n";
1635
+ }
1636
+ return s2.replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}
1637
+ ${$2}`).replace(/([^\n])[ \t]+([^\n])/g, "$1 $2").replace(/\n{3,}/g, "\n\n").replace(/\n[ \t]+/g, "\n").trim();
1638
+ }).join("\n");
1639
+ };
1640
+ var normalizeMarkdown = (s, pre = false) => {
1641
+ const n = normalize(s, pre).replace(/\\/g, "\\\\");
1642
+ return pre ? `\`\`\`
1643
+ ${n.replace(/\u200b/g, "")}
1644
+ \`\`\`` : n.replace(/\n +/g, "\n").trim();
1645
+ };
1646
+ var normalizeOneLine = (s, pre = false) => {
1647
+ const n = normalize(s, pre).replace(/[\s\u200b]+/g, " ").trim();
1648
+ return pre ? `\`${n}\`` : n;
1649
+ };
1650
+
1651
+ // ../../src/vlt/dist/esm/config/definition.js
1652
+ import { homedir as homedir2 } from "node:os";
1653
+ import { relative, sep } from "node:path";
1654
+ var commands = {
1655
+ i: "install",
1656
+ add: "install",
1657
+ install: "install",
1658
+ rm: "uninstall",
1659
+ u: "uninstall",
1660
+ uninstall: "uninstall",
1661
+ r: "run",
1662
+ "run-script": "run",
1663
+ run: "run",
1664
+ rx: "run-exec",
1665
+ "run-exec": "run-exec",
1666
+ x: "exec",
1667
+ exec: "exec",
1668
+ h: "help",
1669
+ "?": "help",
1670
+ help: "help",
1671
+ conf: "config",
1672
+ config: "config",
1673
+ ix: "install-exec",
1674
+ "install-exec": "install-exec",
1675
+ pkg: "pkg"
1676
+ };
1677
+ var xdg = new XDG("vlt");
1678
+ var home = homedir2();
1679
+ var confDir = xdg.config("vlt.json");
1680
+ var cacheDir = xdg.cache();
1681
+ var recordFields = [
1682
+ "git-hosts",
1683
+ "registries",
1684
+ "git-host-archives",
1685
+ "scope-registries"
1686
+ ];
1687
+ var isRecordField = (s) => recordFields.includes(s);
1688
+ var stopParsingCommands = [
1689
+ "run",
1690
+ "run-exec",
1691
+ "exec",
1692
+ "install-exec"
1693
+ ];
1694
+ var stopParsing = void 0;
1695
+ var definition = jack({
1696
+ envPrefix: "VLT",
1697
+ allowPositionals: true,
1698
+ usage: `vlt [<options>] [<cmd> [<args> ...]]`,
1699
+ stopAtPositionalTest: (arg) => {
1700
+ if (stopParsing)
1701
+ return true;
1702
+ const a = arg;
1703
+ if (stopParsingCommands.includes(commands[a])) {
1704
+ stopParsing = true;
1705
+ }
1706
+ return false;
1707
+ }
1708
+ }).heading("vlt - A New Home for JavaScript").description(`Here goes a short description of the vlt command line client.
1709
+
1710
+ Much more documentation available at <https://docs.vlt.sh>`).heading("Subcommands").heading("vlt install [packages ...]", 3, { pre: true }).description(`Install the specified packages, updating package.json and vlt-lock.json
1711
+ appropriately.`).heading("vlt uninstall [packages ...]", 3, { pre: true }).description(`The opposite of \`vlt install\`. Removes deps and updates vlt-lock.json
1712
+ and package.json appropriately.`).heading("vlt run <script> [args ...]", 3, { pre: true }).description(`Run a script defined in 'package.json', passing along any extra
1713
+ arguments. Note that vlt config values must be specified *before*
1714
+ the script name, because everything after that is handed off to
1715
+ the script process.`).heading("vlt exec [args ...]", 3, { pre: true }).description(`Run an arbitrary command, with the local installed packages first in the
1716
+ PATH. Ie, this will run your locally installed package bins.
1717
+
1718
+ If no command is provided, then a shell is spawned in the current working
1719
+ directory, with the locally installed package bins first in the PATH.
1720
+
1721
+ Note that any vlt configs must be specified *before* the command,
1722
+ as the remainder of the command line options are provided to the exec
1723
+ process.`).heading("vlt run-exec [args ...]", 3, { pre: true }).description(`If the first argument is a defined script in package.json, then this is
1724
+ equivalent to \`vlt run\`.
1725
+
1726
+ If not, then this is equivalent to \`vlt exec\`.`).heading("vlt config <subcommand>", 3, { pre: true }).description("Work with vlt configuration").heading("vlt config get <key>", 4, { pre: true }).description("Print the named config value").heading("vlt config list", 4, { pre: true }).description("Print all configuration settings currently in effect").heading("vlt config set <key=value> [<key=value> ...]", 4, {
1727
+ pre: true
1728
+ }).description(`Set config values. By default, these are written to the project config
1729
+ file, \`vlt.json\` in the root of the project. To set things for all
1730
+ projects, run with \`--config=user\``).heading("vlt config del <key> [<key> ...]", 4, { pre: true }).description(`Delete the named config fields. If no values remain in the config file,
1731
+ delete the file as well. By default, operates on the \`vlt.json\` file
1732
+ in the root of the current project. To delete a config field from the
1733
+ user config file, specify \`--config=user\`.`).heading("vlt config help [field ...]", 4, { pre: true }).description(`Get information about a config field, or show a list of known
1734
+ config field names.`).heading("Configuration").description(`If a \`vlt.json\` file is present in the root of the current project,
1735
+ then that will be used as a source of configuration information.
1736
+
1737
+ Next, the file at \`$HOME${sep}${relative(home, confDir)}\`
1738
+ will be checked, and loaded for any fields not set in the local project.
1739
+
1740
+ Object type values will be merged together. Set a field to \`null\` in
1741
+ the JSON configuration to explicitly remove it.
1742
+
1743
+ Command-specific fields may be set in a nested \`command\` object that
1744
+ overrides any options defined at the top level.
1745
+ `).flag({
1746
+ color: {
1747
+ short: "c",
1748
+ description: "Use colors (Default for TTY)"
1749
+ },
1750
+ "no-color": {
1751
+ short: "C",
1752
+ description: "Do not use colors (Default for non-TTY)"
1753
+ }
1754
+ }).opt({
1755
+ registry: {
1756
+ hint: "url",
1757
+ default: "https://registry.npmjs.org/",
1758
+ description: `Sets the registry for fetching packages, when no registry
1759
+ is explicitly set on a specifier.
1760
+
1761
+ For example, \`express@latest\` will be resolved by looking
1762
+ up the metadata from this registry.
1763
+
1764
+ Note that alias specifiers starting with \`npm:\` will
1765
+ still map to \`https://registry.npmjs.org\` if this is
1766
+ changed, unless the a new mapping is created via the
1767
+ \`--registries\` option.
1768
+ `
1769
+ }
1770
+ }).optList({
1771
+ registries: {
1772
+ hint: "name=url",
1773
+ description: `Specify named registry hosts by their prefix. To set the
1774
+ default registry used for non-namespaced specifiers,
1775
+ use the \`--registry\` option.
1776
+
1777
+ Prefixes can be used as a package alias. For example:
1778
+
1779
+ \`\`\`
1780
+ vlt --registries loc=http://reg.local install foo@loc:foo@1.x
1781
+ \`\`\`
1782
+
1783
+ By default, the public npm registry is registered to the
1784
+ \`npm:\` prefix. It is not recommended to change this
1785
+ mapping in most cases.
1786
+ `
1787
+ },
1788
+ "scope-registries": {
1789
+ hint: "@scope=url",
1790
+ description: `Map package name scopes to registry URLs.
1791
+
1792
+ For example,
1793
+ \`--scope-registries @acme=https://registry.acme/\`
1794
+ would tell vlt to fetch any packages named
1795
+ \`@acme/...\` from the \`https://registry.acme/\`
1796
+ registry.
1797
+
1798
+ Note: this way of specifying registries is more ambiguous,
1799
+ compared with using the \`--registries\` field and explicit
1800
+ prefixes, because instead of failing when the configuration
1801
+ is absent, it will instead attempt to fetch from the
1802
+ default registry.
1803
+
1804
+ By comparison, using
1805
+ \`--registries acme=https://registry.acme/\` and then
1806
+ specifying dependencies such as \`"foo": "acme:foo@1.x"\`
1807
+ means that regardless of the name, the package will be
1808
+ fetched from the explicitly named registry, or fail if
1809
+ no registry is defined with that name.
1810
+
1811
+ However, custom registry aliases are not supported by other
1812
+ package managers.`
1813
+ },
1814
+ "git-hosts": {
1815
+ hint: `name=template`,
1816
+ short: "G",
1817
+ description: `Map a shorthand name to a git remote URL template.
1818
+
1819
+ The \`template\` may contain placeholders, which will be
1820
+ swapped with the relevant values.
1821
+
1822
+ \`$1\`, \`$2\`, etc. are replaced with the appropriate
1823
+ n-th path portion. For example, \`github:user/project\`
1824
+ would replace the \`$1\` in the template with \`user\`,
1825
+ and \`$2\` with \`project\`.`
1826
+ },
1827
+ "git-host-archives": {
1828
+ hint: `name=template`,
1829
+ short: "A",
1830
+ description: `Similar to the \`--git-host <name>=<template>\` option,
1831
+ this option can define a template string that will be
1832
+ expanded to provide the URL to download a pre-built
1833
+ tarball of the git repository.
1834
+
1835
+ In addition to the n-th path portion expansions performed
1836
+ by \`--git-host\`, this field will also expand the
1837
+ string \`$committish\` in the template, replacing it with
1838
+ the resolved git committish value to be fetched.`
1839
+ }
1840
+ }).opt({
1841
+ cache: {
1842
+ hint: "path",
1843
+ description: `
1844
+ Location of the vlt on-disk cache. Defaults to the platform-specific
1845
+ directory recommended by the XDG specification.
1846
+ `,
1847
+ default: cacheDir
1848
+ },
1849
+ tag: {
1850
+ description: `Default \`dist-tag\` to install`,
1851
+ default: "latest"
1852
+ },
1853
+ before: {
1854
+ hint: "date",
1855
+ description: `Do not install any packages published after this date`
1856
+ },
1857
+ os: {
1858
+ description: `The operating system to use as the selector when choosing
1859
+ packages based on their \`os\` value.`,
1860
+ default: process.platform
1861
+ },
1862
+ arch: {
1863
+ description: `CPU architecture to use as the selector when choosing
1864
+ packages based on their \`cpu\` value.`,
1865
+ default: process.arch
1866
+ },
1867
+ "node-version": {
1868
+ hint: "version",
1869
+ description: `Node version to use when choosing packages based on
1870
+ their \`engines.node\` value.`,
1871
+ default: process.version
1872
+ }
1873
+ }).flag({
1874
+ "git-shallow": {
1875
+ description: `Set to force \`--depth=1\` on all git clone actions.
1876
+ When set explicitly to false with --no-git-shallow,
1877
+ then \`--depth=1\` will not be used.
1878
+
1879
+ When not set explicitly, \`--depth=1\` will be used for
1880
+ git hosts known to support this behavior.`
1881
+ }
1882
+ }).num({
1883
+ "fetch-retries": {
1884
+ hint: "n",
1885
+ description: `Number of retries to perform when encountering network
1886
+ or other likely-transient errors from git hosts.`,
1887
+ default: 3
1888
+ },
1889
+ "fetch-retry-factor": {
1890
+ hint: "n",
1891
+ description: `The exponential factor to use when retrying`,
1892
+ default: 2
1893
+ },
1894
+ "fetch-retry-mintimeout": {
1895
+ hint: "n",
1896
+ description: `Number of milliseconds before starting first retry`,
1897
+ default: 6e4
1898
+ },
1899
+ "fetch-retry-maxtimeout": {
1900
+ hint: "n",
1901
+ description: `Maximum number of milliseconds between two retries`,
1902
+ default: 1e3
1903
+ }
1904
+ }).optList({
1905
+ workspace: {
1906
+ hint: "ws",
1907
+ short: "w",
1908
+ description: `Set to limit the spaces being worked on when working on
1909
+ workspaces.
1910
+
1911
+ Can be paths or glob patterns matching paths.
1912
+
1913
+ Specifying workspaces by package.json name is not
1914
+ supported.`
1915
+ },
1916
+ "workspace-group": {
1917
+ short: "g",
1918
+ description: `Specify named workspace group names to load and operate on
1919
+ when doing recursive operations on workspaces.`
1920
+ }
1921
+ }).flag({
1922
+ recursive: {
1923
+ short: "r",
1924
+ description: `Run an operation across multiple workspaces.
1925
+
1926
+ No effect when used in non-monorepo projects.
1927
+
1928
+ Implied by setting --workspace or --workspace-group. If
1929
+ not set, then the action is run on the project root.`
1930
+ },
1931
+ bail: {
1932
+ short: "b",
1933
+ description: `When running scripts across multiple workspaces, stop
1934
+ on the first failure.`,
1935
+ default: true
1936
+ },
1937
+ "no-bail": {
1938
+ short: "B",
1939
+ description: `When running scripts across multiple workspaces, continue
1940
+ on failure, running the script for all workspaces.`
1941
+ }
1942
+ }).opt({
1943
+ config: {
1944
+ hint: "user | project",
1945
+ description: `Specify whether to operate on user-level or project-level
1946
+ configuration files when running \`vlt config\` commands.`,
1947
+ validOptions: ["user", "project"],
1948
+ default: "project"
1949
+ },
1950
+ editor: {
1951
+ hint: "program",
1952
+ description: `The blocking editor to use for \`vlt config edit\` and
1953
+ any other cases where a file should be opened for
1954
+ editing.
1955
+
1956
+ Defaults to the \`EDITOR\` or \`VISUAL\` env if set, or
1957
+ \`notepad.exe\` on Windows, or \`vi\` elsewhere.`,
1958
+ default: process.env.EDITOR || process.env.VISUAL || (process.platform === "win32" ? `${process.env.SYSTEMROOT}\\notepad.exe` : "vi")
1959
+ },
1960
+ "script-shell": {
1961
+ hint: "program",
1962
+ description: `The shell to use when executing \`package.json#scripts\`
1963
+ (either as lifecycle scripts or explicitly with
1964
+ \`vlt run\`) and \`vlt exec\`.
1965
+
1966
+ If not set, defaults to \`/bin/sh\` on POSIX systems,
1967
+ and \`cmd.exe\` on Windows.
1968
+
1969
+ When no argument is provided to \`vlt exec\`, the \`SHELL\`
1970
+ environment variable takes precedence if set.`
1971
+ },
1972
+ "fallback-command": {
1973
+ hint: "command",
1974
+ description: `The command to run when the first argument doesn't
1975
+ match any known commands.
1976
+
1977
+ For pnpm-style behavior, set this to 'run-exec'. e.g:
1978
+ \`\`\`
1979
+ vlt config set fallback-command=run-exec
1980
+ \`\`\``,
1981
+ default: "help",
1982
+ validOptions: [...new Set(Object.values(commands))]
1983
+ }
1984
+ }).opt({
1985
+ package: {
1986
+ hint: "p",
1987
+ description: `When running \`vlt install-exec\`, this allows you to
1988
+ explicitly set the package to search for bins. If not
1989
+ provided, then vlt will interpret the first argument as
1990
+ the package, and attempt to run the default executable.`
1991
+ }
1992
+ }).flag({
1993
+ "save-dev": {
1994
+ short: "D",
1995
+ description: `Save installed packages to a package.json file as
1996
+ devDependencies`
1997
+ },
1998
+ "save-optional": {
1999
+ short: "O",
2000
+ description: `Save installed packages to a package.json file as
2001
+ optionalDependencies`
2002
+ },
2003
+ "save-peer": {
2004
+ description: `Save installed packages to a package.json file as
2005
+ peerDependencies`
2006
+ },
2007
+ "save-prod": {
2008
+ short: "P",
2009
+ description: `Save installed packages into dependencies specifically.
2010
+ This is useful if a package already exists in
2011
+ devDependencies or optionalDependencies, but you want to
2012
+ move it to be a non-optional production dependency.`
2013
+ }
2014
+ }).flag({
2015
+ help: {
2016
+ short: "h",
2017
+ description: "Print helpful information"
2018
+ }
2019
+ });
2020
+
2021
+ // ../../src/vlt/dist/esm/config/index.js
2022
+ var reducePairs = (pairs) => {
2023
+ const record = {};
2024
+ for (const kv of pairs) {
2025
+ const eq = kv.indexOf("=");
2026
+ if (eq === -1)
2027
+ record[kv] = "";
2028
+ else {
2029
+ const key = kv.substring(0, eq);
2030
+ const val = kv.substring(eq + 1);
2031
+ record[key] = val;
2032
+ }
2033
+ }
2034
+ return record;
2035
+ };
2036
+ var isRecordFieldValue = (k, v) => Array.isArray(v) && recordFields.includes(k);
2037
+ var pairsToRecords = (obj) => {
2038
+ return Object.fromEntries(Object.entries(obj).map(([k, v]) => [
2039
+ k,
2040
+ k === "command" && v && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k2, v2]) => [
2041
+ k2,
2042
+ pairsToRecords(v2)
2043
+ ])) : isRecordFieldValue(k, v) ? reducePairs(v) : v
2044
+ ]));
2045
+ };
2046
+ var recordsToPairs = (obj) => {
2047
+ return Object.fromEntries(Object.entries(obj).map(([k, v]) => [
2048
+ k,
2049
+ k === "command" && v && typeof v === "object" ? recordsToPairs(v) : !v || typeof v !== "object" || Array.isArray(v) || !isRecordField(k) ? v : Object.entries(v).map(([k2, v2]) => `${k2}=${v2}`)
2050
+ ]));
2051
+ };
2052
+ var kRecord = Symbol("parsed key=value record");
2053
+ var home2 = homedir3();
2054
+ var xdg2 = new XDG("vlt");
2055
+
2056
+ // ../../src/vlt/dist/esm/commands/config.js
2057
+ var usage = `Usage:
2058
+ vlt config get <key> [<key> ...]
2059
+ vlt config ls
2060
+ vlt config set <key>=<value> [<key>=<value> ...] [--config=<user | project>]
2061
+ vlt config del <key> [<key> ...] [--config=<user | project>]
2062
+ vlt config edit [--config=<user | project>]
2063
+ vlt config help [field ...]`;
2064
+ var command = async (conf) => {
2065
+ const sub = conf.positionals[0];
2066
+ if (conf.get("help") || !sub) {
2067
+ console.log(usage);
2068
+ return;
2069
+ }
2070
+ switch (sub) {
2071
+ case "set":
2072
+ return set(conf);
2073
+ case "get":
2074
+ return get(conf);
2075
+ case "ls":
2076
+ case "list":
2077
+ return list(conf);
2078
+ case "edit":
2079
+ return edit(conf);
2080
+ case "help":
2081
+ return help(conf);
2082
+ case "del":
2083
+ return del(conf);
2084
+ default: {
2085
+ console.error(usage);
2086
+ throw error("Unrecognized config command", {
2087
+ found: conf.positionals[0],
2088
+ validOptions: ["set", "get", "list", "edit", "help", "del"]
2089
+ });
2090
+ }
2091
+ }
2092
+ };
2093
+ var help = (conf) => {
2094
+ const j = definition.toJSON();
2095
+ const fields = conf.positionals.slice(1);
2096
+ if (!fields.length) {
2097
+ console.log("Specify one or more options to see information:");
2098
+ console.log(Object.keys(j).sort((a, b) => a.localeCompare(b, "en")).map((c) => ` ${c}`).join("\n"));
2099
+ return;
2100
+ }
2101
+ for (const f of fields) {
2102
+ const def = j[f];
2103
+ if (!def) {
2104
+ console.log(`unknown config field: ${f}`);
2105
+ } else {
2106
+ console.log(`--${f}${def.hint ? `=<${def.hint}>` : ""}
2107
+ type: ${isRecordField(f) ? "Record<string, string>" : def.type + (def.multiple ? "[]" : "")}${def.default ? `
2108
+ default: ${JSON.stringify(def.default)}
2109
+ ` : ""}
2110
+ ${def.description}
2111
+ `);
2112
+ }
2113
+ }
2114
+ };
2115
+ var list = (conf) => {
2116
+ console.log(JSON.stringify(recordsToPairs(conf.options), null, 2));
2117
+ };
2118
+ var del = async (conf) => {
2119
+ const fields = conf.positionals.slice(1);
2120
+ if (!fields.length) {
2121
+ console.error(usage);
2122
+ throw error("At least one key is required");
2123
+ }
2124
+ await conf.deleteConfigKeys(conf.get("config"), fields);
2125
+ };
2126
+ var get = (conf) => {
2127
+ const keys = conf.positionals.slice(1);
2128
+ const k = keys[0];
2129
+ if (!k || keys.length > 1) {
2130
+ console.error(usage);
2131
+ throw error("Exactly one key is required");
2132
+ }
2133
+ console.log(JSON.stringify(conf.get(k), null, 2));
2134
+ };
2135
+ var edit = async (conf) => {
2136
+ const editor = conf.get("editor");
2137
+ if (!editor) {
2138
+ throw error("no editor set in config");
2139
+ }
2140
+ await conf.editConfigFile(conf.get("config"), async (file) => {
2141
+ spawnSync(editor, [file], { stdio: "inherit" });
2142
+ });
2143
+ };
2144
+ var set = async (conf) => {
2145
+ const pairs = conf.positionals.slice(1);
2146
+ if (!pairs.length) {
2147
+ console.error(usage);
2148
+ throw error("At least one key=value pair is required");
2149
+ }
2150
+ const { values } = conf.jack.parseRaw(pairs.map((kv) => `--${kv}`));
2151
+ const which = conf.get("config");
2152
+ await conf.addConfigToFile(which, pairsToRecords(values));
2153
+ };
2154
+ export {
2155
+ command,
2156
+ usage
2157
+ };
2158
+ //# sourceMappingURL=config.js.map