@lynx-js/qrcode-rsbuild-plugin 0.4.0 → 0.4.2
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.
- package/CHANGELOG.md +12 -0
- package/dist/472.js +940 -0
- package/dist/543.js +45 -0
- package/dist/640.js +24 -933
- package/dist/759.js +2005 -0
- package/dist/generateDevUrls.d.ts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -34
- package/dist/shortcuts.d.ts +3 -0
- package/dist/shortcuts.js +12 -34
- package/package.json +5 -5
- package/dist/204.js +0 -20
- package/dist/441.js +0 -1910
package/dist/759.js
ADDED
|
@@ -0,0 +1,2005 @@
|
|
|
1
|
+
export const __webpack_id__ = "759";
|
|
2
|
+
export const __webpack_ids__ = [
|
|
3
|
+
"759"
|
|
4
|
+
];
|
|
5
|
+
export const __webpack_modules__ = {
|
|
6
|
+
"../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
|
|
7
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
8
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
9
|
+
let formatter = (open, close, replace = open)=>(input)=>{
|
|
10
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
11
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
12
|
+
};
|
|
13
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
14
|
+
let result = "", cursor = 0;
|
|
15
|
+
do {
|
|
16
|
+
result += string.substring(cursor, index) + replace;
|
|
17
|
+
cursor = index + close.length;
|
|
18
|
+
index = string.indexOf(close, cursor);
|
|
19
|
+
}while (~index);
|
|
20
|
+
return result + string.substring(cursor);
|
|
21
|
+
};
|
|
22
|
+
let createColors = (enabled = isColorSupported)=>{
|
|
23
|
+
let f = enabled ? formatter : ()=>String;
|
|
24
|
+
return {
|
|
25
|
+
isColorSupported: enabled,
|
|
26
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
27
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
28
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
29
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
30
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
31
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
32
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
33
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
34
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
35
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
36
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
37
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
38
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
39
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
40
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
41
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
42
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
43
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
44
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
45
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
46
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
47
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
48
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
49
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
50
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
51
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
52
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
53
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
54
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
55
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
56
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
57
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
58
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
59
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
60
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
61
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
62
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
63
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
64
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
65
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
66
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
module.exports = createColors();
|
|
70
|
+
module.exports.createColors = createColors;
|
|
71
|
+
},
|
|
72
|
+
"../../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js": function(module) {
|
|
73
|
+
const ESC = '\x1B';
|
|
74
|
+
const CSI = `${ESC}[`;
|
|
75
|
+
const beep = '\u0007';
|
|
76
|
+
const cursor = {
|
|
77
|
+
to (x, y) {
|
|
78
|
+
if (!y) return `${CSI}${x + 1}G`;
|
|
79
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
80
|
+
},
|
|
81
|
+
move (x, y) {
|
|
82
|
+
let ret = '';
|
|
83
|
+
if (x < 0) ret += `${CSI}${-x}D`;
|
|
84
|
+
else if (x > 0) ret += `${CSI}${x}C`;
|
|
85
|
+
if (y < 0) ret += `${CSI}${-y}A`;
|
|
86
|
+
else if (y > 0) ret += `${CSI}${y}B`;
|
|
87
|
+
return ret;
|
|
88
|
+
},
|
|
89
|
+
up: (count = 1)=>`${CSI}${count}A`,
|
|
90
|
+
down: (count = 1)=>`${CSI}${count}B`,
|
|
91
|
+
forward: (count = 1)=>`${CSI}${count}C`,
|
|
92
|
+
backward: (count = 1)=>`${CSI}${count}D`,
|
|
93
|
+
nextLine: (count = 1)=>`${CSI}E`.repeat(count),
|
|
94
|
+
prevLine: (count = 1)=>`${CSI}F`.repeat(count),
|
|
95
|
+
left: `${CSI}G`,
|
|
96
|
+
hide: `${CSI}?25l`,
|
|
97
|
+
show: `${CSI}?25h`,
|
|
98
|
+
save: `${ESC}7`,
|
|
99
|
+
restore: `${ESC}8`
|
|
100
|
+
};
|
|
101
|
+
const scroll = {
|
|
102
|
+
up: (count = 1)=>`${CSI}S`.repeat(count),
|
|
103
|
+
down: (count = 1)=>`${CSI}T`.repeat(count)
|
|
104
|
+
};
|
|
105
|
+
const erase = {
|
|
106
|
+
screen: `${CSI}2J`,
|
|
107
|
+
up: (count = 1)=>`${CSI}1J`.repeat(count),
|
|
108
|
+
down: (count = 1)=>`${CSI}J`.repeat(count),
|
|
109
|
+
line: `${CSI}2K`,
|
|
110
|
+
lineEnd: `${CSI}K`,
|
|
111
|
+
lineStart: `${CSI}1K`,
|
|
112
|
+
lines (count) {
|
|
113
|
+
let clear = '';
|
|
114
|
+
for(let i = 0; i < count; i++)clear += this.line + (i < count - 1 ? cursor.up() : '');
|
|
115
|
+
if (count) clear += cursor.left;
|
|
116
|
+
return clear;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
module.exports = {
|
|
120
|
+
cursor,
|
|
121
|
+
scroll,
|
|
122
|
+
erase,
|
|
123
|
+
beep
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
"../../../node_modules/.pnpm/@clack+prompts@1.0.0-alpha.5/node_modules/@clack/prompts/dist/index.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
127
|
+
__webpack_require__.r(__webpack_exports__);
|
|
128
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
129
|
+
selectKey: ()=>dist_Vt,
|
|
130
|
+
S_STEP_SUBMIT: ()=>dist_W,
|
|
131
|
+
spinner: ()=>Fe,
|
|
132
|
+
S_INFO: ()=>ue,
|
|
133
|
+
S_CORNER_TOP_RIGHT: ()=>oe,
|
|
134
|
+
S_STEP_ACTIVE: ()=>we,
|
|
135
|
+
log: ()=>dist_O,
|
|
136
|
+
note: ()=>Nt,
|
|
137
|
+
groupMultiselect: ()=>dist_bt,
|
|
138
|
+
password: ()=>dist_Lt,
|
|
139
|
+
S_CORNER_BOTTOM_RIGHT: ()=>le,
|
|
140
|
+
unicode: ()=>dist_J,
|
|
141
|
+
S_WARN: ()=>$e,
|
|
142
|
+
group: ()=>dist_xt,
|
|
143
|
+
S_CHECKBOX_ACTIVE: ()=>dist_X,
|
|
144
|
+
autocomplete: ()=>ke,
|
|
145
|
+
isCI: ()=>re,
|
|
146
|
+
confirm: ()=>dist_Bt,
|
|
147
|
+
S_BAR_END_RIGHT: ()=>xe,
|
|
148
|
+
S_CONNECT_LEFT: ()=>_e,
|
|
149
|
+
S_CHECKBOX_INACTIVE: ()=>Y,
|
|
150
|
+
S_CHECKBOX_SELECTED: ()=>dist_P,
|
|
151
|
+
limitOptions: ()=>dist_G,
|
|
152
|
+
multiselect: ()=>Rt,
|
|
153
|
+
taskLog: ()=>Gt,
|
|
154
|
+
unicodeOr: ()=>dist_S,
|
|
155
|
+
S_STEP_ERROR: ()=>ne,
|
|
156
|
+
S_RADIO_ACTIVE: ()=>dist_U,
|
|
157
|
+
S_BAR_START: ()=>ae,
|
|
158
|
+
S_ERROR: ()=>de,
|
|
159
|
+
settings: ()=>dist_C,
|
|
160
|
+
box: ()=>dist_wt,
|
|
161
|
+
intro: ()=>dist_Dt,
|
|
162
|
+
isTTY: ()=>Se,
|
|
163
|
+
S_STEP_CANCEL: ()=>ie,
|
|
164
|
+
S_BAR_START_RIGHT: ()=>Be,
|
|
165
|
+
S_BAR_H: ()=>z,
|
|
166
|
+
S_CORNER_TOP_LEFT: ()=>Te,
|
|
167
|
+
autocompleteMultiselect: ()=>dist_At,
|
|
168
|
+
S_BAR_END: ()=>dist_b,
|
|
169
|
+
cancel: ()=>dist_t,
|
|
170
|
+
outro: ()=>Tt,
|
|
171
|
+
path: ()=>dist_Wt,
|
|
172
|
+
progress: ()=>Pt,
|
|
173
|
+
select: ()=>jt,
|
|
174
|
+
stream: ()=>dist_j,
|
|
175
|
+
S_BAR: ()=>dist_c,
|
|
176
|
+
symbol: ()=>dist_L,
|
|
177
|
+
tasks: ()=>dist_kt,
|
|
178
|
+
text: ()=>Ht,
|
|
179
|
+
isCancel: ()=>It,
|
|
180
|
+
S_SUCCESS: ()=>ce,
|
|
181
|
+
S_CORNER_BOTTOM_LEFT: ()=>De,
|
|
182
|
+
updateSettings: ()=>Et,
|
|
183
|
+
S_PASSWORD_MASK: ()=>be,
|
|
184
|
+
S_RADIO_INACTIVE: ()=>dist_K
|
|
185
|
+
});
|
|
186
|
+
var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
187
|
+
var external_node_process_ = __webpack_require__("node:process");
|
|
188
|
+
var external_node_readline_ = __webpack_require__("node:readline");
|
|
189
|
+
var src = __webpack_require__("../../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
|
|
190
|
+
var external_node_tty_ = __webpack_require__("node:tty");
|
|
191
|
+
const nt = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 === t || 173 === t || 174 === t || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || 198 === t || 208 === t || 215 === t || 216 === t || t >= 222 && t <= 225 || 230 === t || t >= 232 && t <= 234 || 236 === t || 237 === t || 240 === t || 242 === t || 243 === t || t >= 247 && t <= 250 || 252 === t || 254 === t || 257 === t || 273 === t || 275 === t || 283 === t || 294 === t || 295 === t || 299 === t || t >= 305 && t <= 307 || 312 === t || t >= 319 && t <= 322 || 324 === t || t >= 328 && t <= 331 || 333 === t || 338 === t || 339 === t || 358 === t || 359 === t || 363 === t || 462 === t || 464 === t || 466 === t || 468 === t || 470 === t || 472 === t || 474 === t || 476 === t || 593 === t || 609 === t || 708 === t || 711 === t || t >= 713 && t <= 715 || 717 === t || 720 === t || t >= 728 && t <= 731 || 733 === t || 735 === t || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || 1025 === t || t >= 1040 && t <= 1103 || 1105 === t || 8208 === t || t >= 8211 && t <= 8214 || 8216 === t || 8217 === t || 8220 === t || 8221 === t || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || 8240 === t || 8242 === t || 8243 === t || 8245 === t || 8251 === t || 8254 === t || 8308 === t || 8319 === t || t >= 8321 && t <= 8324 || 8364 === t || 8451 === t || 8453 === t || 8457 === t || 8467 === t || 8470 === t || 8481 === t || 8482 === t || 8486 === t || 8491 === t || 8531 === t || 8532 === t || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || 8585 === t || t >= 8592 && t <= 8601 || 8632 === t || 8633 === t || 8658 === t || 8660 === t || 8679 === t || 8704 === t || 8706 === t || 8707 === t || 8711 === t || 8712 === t || 8715 === t || 8719 === t || 8721 === t || 8725 === t || 8730 === t || t >= 8733 && t <= 8736 || 8739 === t || 8741 === t || t >= 8743 && t <= 8748 || 8750 === t || t >= 8756 && t <= 8759 || 8764 === t || 8765 === t || 8776 === t || 8780 === t || 8786 === t || 8800 === t || 8801 === t || t >= 8804 && t <= 8807 || 8810 === t || 8811 === t || 8814 === t || 8815 === t || 8834 === t || 8835 === t || 8838 === t || 8839 === t || 8853 === t || 8857 === t || 8869 === t || 8895 === t || 8978 === t || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || 9632 === t || 9633 === t || t >= 9635 && t <= 9641 || 9650 === t || 9651 === t || 9654 === t || 9655 === t || 9660 === t || 9661 === t || 9664 === t || 9665 === t || t >= 9670 && t <= 9672 || 9675 === t || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || 9711 === t || 9733 === t || 9734 === t || 9737 === t || 9742 === t || 9743 === t || 9756 === t || 9758 === t || 9792 === t || 9794 === t || 9824 === t || 9825 === t || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || 9836 === t || 9837 === t || 9839 === t || 9886 === t || 9887 === t || 9919 === t || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || 9955 === t || 9960 === t || 9961 === t || t >= 9963 && t <= 9969 || 9972 === t || t >= 9974 && t <= 9977 || 9979 === t || 9980 === t || 9982 === t || 9983 === t || 10045 === t || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || 65533 === t || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || 127375 === t || 127376 === t || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ut = (t)=>12288 === t || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ot = (t)=>t >= 4352 && t <= 4447 || 8986 === t || 8987 === t || 9001 === t || 9002 === t || t >= 9193 && t <= 9196 || 9200 === t || 9203 === t || 9725 === t || 9726 === t || 9748 === t || 9749 === t || t >= 9800 && t <= 9811 || 9855 === t || 9875 === t || 9889 === t || 9898 === t || 9899 === t || 9917 === t || 9918 === t || 9924 === t || 9925 === t || 9934 === t || 9940 === t || 9962 === t || 9970 === t || 9971 === t || 9973 === t || 9978 === t || 9981 === t || 9989 === t || 9994 === t || 9995 === t || 10024 === t || 10060 === t || 10062 === t || t >= 10067 && t <= 10069 || 10071 === t || t >= 10133 && t <= 10135 || 10160 === t || 10175 === t || 11035 === t || 11036 === t || 11088 === t || 11093 === t || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || 94192 === t || 94193 === t || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || 110589 === t || 110590 === t || t >= 110592 && t <= 110882 || 110898 === t || t >= 110928 && t <= 110930 || 110933 === t || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || 126980 === t || 127183 === t || 127374 === t || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || 127568 === t || 127569 === t || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || 127988 === t || t >= 127992 && t <= 128062 || 128064 === t || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || 128378 === t || 128405 === t || 128406 === t || 128420 === t || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || 128716 === t || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || 128747 === t || 128748 === t || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || 129008 === t || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, dist_$ = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, k = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_y = /\t{1,1000}/y, N = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, at = /\p{M}+/gu, lt = {
|
|
192
|
+
limit: 1 / 0,
|
|
193
|
+
ellipsis: ""
|
|
194
|
+
}, dist_q = (t, s = {}, e = {})=>{
|
|
195
|
+
const i = s.limit ?? 1 / 0, r = s.ellipsis ?? "", n = s?.ellipsisWidth ?? (r ? dist_q(r, lt, e).width : 0), F = e.ansiWidth ?? 0, l = e.controlWidth ?? 0, a = e.tabWidth ?? 8, v = e.ambiguousWidth ?? 1, g = e.emojiWidth ?? 2, m = e.fullWidthWidth ?? 2, A = e.regularWidth ?? 1, S = e.wideWidth ?? 2;
|
|
196
|
+
let o = 0, u = 0, p = t.length, E = 0, f = !1, d = p, _ = Math.max(0, i - n), b = 0, x = 0, h = 0, c = 0;
|
|
197
|
+
t: for(;;){
|
|
198
|
+
if (x > b || u >= p && u > o) {
|
|
199
|
+
const it = t.slice(b, x) || t.slice(o, u);
|
|
200
|
+
E = 0;
|
|
201
|
+
for (const K of it.replaceAll(at, "")){
|
|
202
|
+
const T = K.codePointAt(0) || 0;
|
|
203
|
+
if (ut(T) ? c = m : ot(T) ? c = S : v !== A && nt(T) ? c = v : c = A, h + c > _ && (d = Math.min(d, Math.max(b, o) + E)), h + c > i) {
|
|
204
|
+
f = !0;
|
|
205
|
+
break t;
|
|
206
|
+
}
|
|
207
|
+
E += K.length, h += c;
|
|
208
|
+
}
|
|
209
|
+
b = x = 0;
|
|
210
|
+
}
|
|
211
|
+
if (u >= p) break;
|
|
212
|
+
if (M.lastIndex = u, M.test(t)) {
|
|
213
|
+
if (E = M.lastIndex - u, c = E * A, h + c > _ && (d = Math.min(d, u + Math.floor((_ - h) / A))), h + c > i) {
|
|
214
|
+
f = !0;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
h += c, b = o, x = u, u = o = M.lastIndex;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (dist_$.lastIndex = u, dist_$.test(t)) {
|
|
221
|
+
if (h + F > _ && (d = Math.min(d, u)), h + F > i) {
|
|
222
|
+
f = !0;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
h += F, b = o, x = u, u = o = dist_$.lastIndex;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (k.lastIndex = u, k.test(t)) {
|
|
229
|
+
if (E = k.lastIndex - u, c = E * l, h + c > _ && (d = Math.min(d, u + Math.floor((_ - h) / l))), h + c > i) {
|
|
230
|
+
f = !0;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
h += c, b = o, x = u, u = o = k.lastIndex;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (dist_y.lastIndex = u, dist_y.test(t)) {
|
|
237
|
+
if (E = dist_y.lastIndex - u, c = E * a, h + c > _ && (d = Math.min(d, u + Math.floor((_ - h) / a))), h + c > i) {
|
|
238
|
+
f = !0;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
h += c, b = o, x = u, u = o = dist_y.lastIndex;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (N.lastIndex = u, N.test(t)) {
|
|
245
|
+
if (h + g > _ && (d = Math.min(d, u)), h + g > i) {
|
|
246
|
+
f = !0;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
h += g, b = o, x = u, u = o = N.lastIndex;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
u += 1;
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
width: f ? _ : h,
|
|
256
|
+
index: f ? d : p,
|
|
257
|
+
truncated: f,
|
|
258
|
+
ellipsed: f && i >= n
|
|
259
|
+
};
|
|
260
|
+
}, ht = {
|
|
261
|
+
limit: 1 / 0,
|
|
262
|
+
ellipsis: "",
|
|
263
|
+
ellipsisWidth: 0
|
|
264
|
+
}, dist_w = (t, s = {})=>dist_q(t, ht, s).width, L = "\x1B", J = "\x9B", ct = 39, P = "\x07", X = "[", Ft = "]", Z = "m", O = `${Ft}8;;`, Q = new RegExp(`(?:\\${X}(?<code>\\d+)m|\\${O}(?<uri>.*)${P})`, "y"), pt = (t)=>{
|
|
265
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
266
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
267
|
+
if (1 === t || 2 === t) return 22;
|
|
268
|
+
if (3 === t) return 23;
|
|
269
|
+
if (4 === t) return 24;
|
|
270
|
+
if (7 === t) return 27;
|
|
271
|
+
if (8 === t) return 28;
|
|
272
|
+
if (9 === t) return 29;
|
|
273
|
+
if (0 === t) return 0;
|
|
274
|
+
}, tt = (t)=>`${L}${X}${t}${Z}`, st = (t)=>`${L}${O}${t}${P}`, ft = (t)=>t.map((s)=>dist_w(s)), j = (t, s, e)=>{
|
|
275
|
+
const i = s[Symbol.iterator]();
|
|
276
|
+
let r = !1, n = !1, F = t.at(-1), l = void 0 === F ? 0 : dist_w(F), a = i.next(), v = i.next(), g = 0;
|
|
277
|
+
for(; !a.done;){
|
|
278
|
+
const m = a.value, A = dist_w(m);
|
|
279
|
+
l + A <= e ? t[t.length - 1] += m : (t.push(m), l = 0), (m === L || m === J) && (r = !0, n = s.startsWith(O, g + 1)), r ? n ? m === P && (r = !1, n = !1) : m === Z && (r = !1) : (l += A, l !== e || v.done || (t.push(""), l = 0)), a = v, v = i.next(), g += m.length;
|
|
280
|
+
}
|
|
281
|
+
F = t.at(-1), !l && void 0 !== F && F.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
282
|
+
}, dt = (t)=>{
|
|
283
|
+
const s = t.split(" ");
|
|
284
|
+
let e = s.length;
|
|
285
|
+
for(; e > 0 && !(dist_w(s[e - 1]) > 0);)e--;
|
|
286
|
+
return e === s.length ? t : s.slice(0, e).join(" ") + s.slice(e).join("");
|
|
287
|
+
}, mt = (t, s, e = {})=>{
|
|
288
|
+
if (!1 !== e.trim && "" === t.trim()) return "";
|
|
289
|
+
let i = "", r, n;
|
|
290
|
+
const F = t.split(" "), l = ft(F);
|
|
291
|
+
let a = [
|
|
292
|
+
""
|
|
293
|
+
];
|
|
294
|
+
for (const [o, u] of F.entries()){
|
|
295
|
+
!1 !== e.trim && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
|
|
296
|
+
let p = dist_w(a.at(-1) ?? "");
|
|
297
|
+
if (0 !== o && (p >= s && (!1 === e.wordWrap || !1 === e.trim) && (a.push(""), p = 0), (p > 0 || !1 === e.trim) && (a[a.length - 1] += " ", p++)), e.hard && l[o] > s) {
|
|
298
|
+
const E = s - p, f = 1 + Math.floor((l[o] - E - 1) / s);
|
|
299
|
+
Math.floor((l[o] - 1) / s) < f && a.push(""), j(a, u, s);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (p + l[o] > s && p > 0 && l[o] > 0) {
|
|
303
|
+
if (!1 === e.wordWrap && p < s) {
|
|
304
|
+
j(a, u, s);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
a.push("");
|
|
308
|
+
}
|
|
309
|
+
if (p + l[o] > s && !1 === e.wordWrap) {
|
|
310
|
+
j(a, u, s);
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
a[a.length - 1] += u;
|
|
314
|
+
}
|
|
315
|
+
!1 !== e.trim && (a = a.map((o)=>dt(o)));
|
|
316
|
+
const v = a.join(`
|
|
317
|
+
`), g = v[Symbol.iterator]();
|
|
318
|
+
let m = g.next(), A = g.next(), S = 0;
|
|
319
|
+
for(; !m.done;){
|
|
320
|
+
const o = m.value, u = A.value;
|
|
321
|
+
if (i += o, o === L || o === J) {
|
|
322
|
+
Q.lastIndex = S + 1;
|
|
323
|
+
const f = Q.exec(v)?.groups;
|
|
324
|
+
if (f?.code !== void 0) {
|
|
325
|
+
const d = Number.parseFloat(f.code);
|
|
326
|
+
r = d === ct ? void 0 : d;
|
|
327
|
+
} else f?.uri !== void 0 && (n = 0 === f.uri.length ? void 0 : f.uri);
|
|
328
|
+
}
|
|
329
|
+
const p = r ? pt(r) : void 0;
|
|
330
|
+
u === `
|
|
331
|
+
` ? (n && (i += st("")), r && p && (i += tt(p))) : o === `
|
|
332
|
+
` && (r && p && (i += tt(r)), n && (i += st(n))), S += o.length, m = A, A = g.next();
|
|
333
|
+
}
|
|
334
|
+
return i;
|
|
335
|
+
};
|
|
336
|
+
function et(t, s, e) {
|
|
337
|
+
return String(t).normalize().replaceAll(`\r
|
|
338
|
+
`, `
|
|
339
|
+
`).split(`
|
|
340
|
+
`).map((i)=>mt(i, s, e)).join(`
|
|
341
|
+
`);
|
|
342
|
+
}
|
|
343
|
+
const gt = [
|
|
344
|
+
"up",
|
|
345
|
+
"down",
|
|
346
|
+
"left",
|
|
347
|
+
"right",
|
|
348
|
+
"space",
|
|
349
|
+
"enter",
|
|
350
|
+
"cancel"
|
|
351
|
+
], dist_C = {
|
|
352
|
+
actions: new Set(gt),
|
|
353
|
+
aliases: new Map([
|
|
354
|
+
[
|
|
355
|
+
"k",
|
|
356
|
+
"up"
|
|
357
|
+
],
|
|
358
|
+
[
|
|
359
|
+
"j",
|
|
360
|
+
"down"
|
|
361
|
+
],
|
|
362
|
+
[
|
|
363
|
+
"h",
|
|
364
|
+
"left"
|
|
365
|
+
],
|
|
366
|
+
[
|
|
367
|
+
"l",
|
|
368
|
+
"right"
|
|
369
|
+
],
|
|
370
|
+
[
|
|
371
|
+
"",
|
|
372
|
+
"cancel"
|
|
373
|
+
],
|
|
374
|
+
[
|
|
375
|
+
"escape",
|
|
376
|
+
"cancel"
|
|
377
|
+
]
|
|
378
|
+
]),
|
|
379
|
+
messages: {
|
|
380
|
+
cancel: "Canceled",
|
|
381
|
+
error: "Something went wrong"
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
function Et(t) {
|
|
385
|
+
if (void 0 !== t.aliases) {
|
|
386
|
+
const s = t.aliases;
|
|
387
|
+
for(const e in s){
|
|
388
|
+
if (!Object.hasOwn(s, e)) continue;
|
|
389
|
+
const i = s[e];
|
|
390
|
+
dist_C.actions.has(i) && (dist_C.aliases.has(e) || dist_C.aliases.set(e, i));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (void 0 !== t.messages) {
|
|
394
|
+
const s = t.messages;
|
|
395
|
+
void 0 !== s.cancel && (dist_C.messages.cancel = s.cancel), void 0 !== s.error && (dist_C.messages.error = s.error);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function U(t, s) {
|
|
399
|
+
if ("string" == typeof t) return dist_C.aliases.get(t) === s;
|
|
400
|
+
for (const e of t)if (void 0 !== e && U(e, s)) return !0;
|
|
401
|
+
return !1;
|
|
402
|
+
}
|
|
403
|
+
function vt(t, s) {
|
|
404
|
+
if (t === s) return;
|
|
405
|
+
const e = t.split(`
|
|
406
|
+
`), i = s.split(`
|
|
407
|
+
`), r = [];
|
|
408
|
+
for(let n = 0; n < Math.max(e.length, i.length); n++)e[n] !== i[n] && r.push(n);
|
|
409
|
+
return r;
|
|
410
|
+
}
|
|
411
|
+
const At = globalThis.process.platform.startsWith("win"), G = Symbol("clack:cancel");
|
|
412
|
+
function It(t) {
|
|
413
|
+
return t === G;
|
|
414
|
+
}
|
|
415
|
+
function W(t, s) {
|
|
416
|
+
const e = t;
|
|
417
|
+
e.isTTY && e.setRawMode(s);
|
|
418
|
+
}
|
|
419
|
+
function _t({ input: t = external_node_process_.stdin, output: s = external_node_process_.stdout, overwrite: e = !0, hideCursor: i = !0 } = {}) {
|
|
420
|
+
const r = external_node_readline_.createInterface({
|
|
421
|
+
input: t,
|
|
422
|
+
output: s,
|
|
423
|
+
prompt: "",
|
|
424
|
+
tabSize: 1
|
|
425
|
+
});
|
|
426
|
+
external_node_readline_.emitKeypressEvents(t, r), t instanceof external_node_tty_.ReadStream && t.isTTY && t.setRawMode(!0);
|
|
427
|
+
const n = (F, { name: l, sequence: a })=>{
|
|
428
|
+
const v = String(F);
|
|
429
|
+
if (U([
|
|
430
|
+
v,
|
|
431
|
+
l,
|
|
432
|
+
a
|
|
433
|
+
], "cancel")) {
|
|
434
|
+
i && s.write(src.cursor.show), process.exit(0);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (!e) return;
|
|
438
|
+
const g = "return" === l ? 0 : -1, m = "return" === l ? -1 : 0;
|
|
439
|
+
external_node_readline_.moveCursor(s, g, m, ()=>{
|
|
440
|
+
external_node_readline_.clearLine(s, 1, ()=>{
|
|
441
|
+
t.once("keypress", n);
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
return i && s.write(src.cursor.hide), t.once("keypress", n), ()=>{
|
|
446
|
+
t.off("keypress", n), i && s.write(src.cursor.show), t instanceof external_node_tty_.ReadStream && t.isTTY && !At && t.setRawMode(!1), r.terminal = !1, r.close();
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
const Ct = (t)=>"columns" in t && "number" == typeof t.columns ? t.columns : 80, bt = (t)=>"rows" in t && "number" == typeof t.rows ? t.rows : 20;
|
|
450
|
+
class dist_B {
|
|
451
|
+
input;
|
|
452
|
+
output;
|
|
453
|
+
_abortSignal;
|
|
454
|
+
rl;
|
|
455
|
+
opts;
|
|
456
|
+
_render;
|
|
457
|
+
_track = !1;
|
|
458
|
+
_prevFrame = "";
|
|
459
|
+
_subscribers = new Map;
|
|
460
|
+
_cursor = 0;
|
|
461
|
+
state = "initial";
|
|
462
|
+
error = "";
|
|
463
|
+
value;
|
|
464
|
+
userInput = "";
|
|
465
|
+
constructor(s, e = !0){
|
|
466
|
+
const { input: i = external_node_process_.stdin, output: r = external_node_process_.stdout, render: n, signal: F, ...l } = s;
|
|
467
|
+
this.opts = l, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = F, this.input = i, this.output = r;
|
|
468
|
+
}
|
|
469
|
+
unsubscribe() {
|
|
470
|
+
this._subscribers.clear();
|
|
471
|
+
}
|
|
472
|
+
setSubscriber(s, e) {
|
|
473
|
+
const i = this._subscribers.get(s) ?? [];
|
|
474
|
+
i.push(e), this._subscribers.set(s, i);
|
|
475
|
+
}
|
|
476
|
+
on(s, e) {
|
|
477
|
+
this.setSubscriber(s, {
|
|
478
|
+
cb: e
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
once(s, e) {
|
|
482
|
+
this.setSubscriber(s, {
|
|
483
|
+
cb: e,
|
|
484
|
+
once: !0
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
emit(s, ...e) {
|
|
488
|
+
const i = this._subscribers.get(s) ?? [], r = [];
|
|
489
|
+
for (const n of i)n.cb(...e), n.once && r.push(()=>i.splice(i.indexOf(n), 1));
|
|
490
|
+
for (const n of r)n();
|
|
491
|
+
}
|
|
492
|
+
prompt() {
|
|
493
|
+
return new Promise((s)=>{
|
|
494
|
+
if (this._abortSignal) {
|
|
495
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), s(G);
|
|
496
|
+
this._abortSignal.addEventListener("abort", ()=>{
|
|
497
|
+
this.state = "cancel", this.close();
|
|
498
|
+
}, {
|
|
499
|
+
once: !0
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
this.rl = external_node_readline_["default"].createInterface({
|
|
503
|
+
input: this.input,
|
|
504
|
+
tabSize: 2,
|
|
505
|
+
prompt: "",
|
|
506
|
+
escapeCodeTimeout: 50,
|
|
507
|
+
terminal: !0
|
|
508
|
+
}), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
|
|
509
|
+
this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), s(this.value);
|
|
510
|
+
}), this.once("cancel", ()=>{
|
|
511
|
+
this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), s(G);
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
_isActionKey(s, e) {
|
|
516
|
+
return " " === s;
|
|
517
|
+
}
|
|
518
|
+
_setValue(s) {
|
|
519
|
+
this.value = s, this.emit("value", this.value);
|
|
520
|
+
}
|
|
521
|
+
_setUserInput(s, e) {
|
|
522
|
+
this.userInput = s ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
523
|
+
}
|
|
524
|
+
_clearUserInput() {
|
|
525
|
+
this.rl?.write(null, {
|
|
526
|
+
ctrl: !0,
|
|
527
|
+
name: "u"
|
|
528
|
+
}), this._setUserInput("");
|
|
529
|
+
}
|
|
530
|
+
onKeypress(s, e) {
|
|
531
|
+
if (this._track && "return" !== e.name && (e.name && this._isActionKey(s, e) && this.rl?.write(null, {
|
|
532
|
+
ctrl: !0,
|
|
533
|
+
name: "h"
|
|
534
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), e?.name && (!this._track && dist_C.aliases.has(e.name) && this.emit("cursor", dist_C.aliases.get(e.name)), dist_C.actions.has(e.name) && this.emit("cursor", e.name)), s && ("y" === s.toLowerCase() || "n" === s.toLowerCase()) && this.emit("confirm", "y" === s.toLowerCase()), this.emit("key", s?.toLowerCase(), e), e?.name === "return") {
|
|
535
|
+
if (this.opts.validate) {
|
|
536
|
+
const i = this.opts.validate(this.value);
|
|
537
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
538
|
+
}
|
|
539
|
+
"error" !== this.state && (this.state = "submit");
|
|
540
|
+
}
|
|
541
|
+
U([
|
|
542
|
+
s,
|
|
543
|
+
e?.name,
|
|
544
|
+
e?.sequence
|
|
545
|
+
], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
|
|
546
|
+
}
|
|
547
|
+
close() {
|
|
548
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
549
|
+
`), W(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
550
|
+
}
|
|
551
|
+
restoreCursor() {
|
|
552
|
+
const s = et(this._prevFrame, process.stdout.columns, {
|
|
553
|
+
hard: !0,
|
|
554
|
+
trim: !1
|
|
555
|
+
}).split(`
|
|
556
|
+
`).length - 1;
|
|
557
|
+
this.output.write(src.cursor.move(-999, -1 * s));
|
|
558
|
+
}
|
|
559
|
+
render() {
|
|
560
|
+
const s = et(this._render(this) ?? "", process.stdout.columns, {
|
|
561
|
+
hard: !0,
|
|
562
|
+
trim: !1
|
|
563
|
+
});
|
|
564
|
+
if (s !== this._prevFrame) {
|
|
565
|
+
if ("initial" === this.state) this.output.write(src.cursor.hide);
|
|
566
|
+
else {
|
|
567
|
+
const e = vt(this._prevFrame, s);
|
|
568
|
+
if (this.restoreCursor(), e && e?.length === 1) {
|
|
569
|
+
const i = e[0];
|
|
570
|
+
this.output.write(src.cursor.move(0, i)), this.output.write(src.erase.lines(1));
|
|
571
|
+
const r = s.split(`
|
|
572
|
+
`);
|
|
573
|
+
this.output.write(r[i]), this._prevFrame = s, this.output.write(src.cursor.move(0, r.length - i - 1));
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (e && e?.length > 1) {
|
|
577
|
+
const i = e[0];
|
|
578
|
+
this.output.write(src.cursor.move(0, i)), this.output.write(src.erase.down());
|
|
579
|
+
const r = s.split(`
|
|
580
|
+
`).slice(i);
|
|
581
|
+
this.output.write(r.join(`
|
|
582
|
+
`)), this._prevFrame = s;
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
this.output.write(src.erase.down());
|
|
586
|
+
}
|
|
587
|
+
this.output.write(s), "initial" === this.state && (this.state = "active"), this._prevFrame = s;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
function Bt(t, s) {
|
|
592
|
+
if (void 0 === t || 0 === s.length) return 0;
|
|
593
|
+
const e = s.findIndex((i)=>i.value === t);
|
|
594
|
+
return -1 !== e ? e : 0;
|
|
595
|
+
}
|
|
596
|
+
function xt(t, s) {
|
|
597
|
+
return (s.label ?? String(s.value)).toLowerCase().includes(t.toLowerCase());
|
|
598
|
+
}
|
|
599
|
+
function Dt(t, s) {
|
|
600
|
+
if (s) return t ? s : s[0];
|
|
601
|
+
}
|
|
602
|
+
class wt extends dist_B {
|
|
603
|
+
filteredOptions;
|
|
604
|
+
multiple;
|
|
605
|
+
isNavigating = !1;
|
|
606
|
+
selectedValues = [];
|
|
607
|
+
focusedValue;
|
|
608
|
+
#t = 0;
|
|
609
|
+
#e = "";
|
|
610
|
+
#i;
|
|
611
|
+
#s;
|
|
612
|
+
get cursor() {
|
|
613
|
+
return this.#t;
|
|
614
|
+
}
|
|
615
|
+
get userInputWithCursor() {
|
|
616
|
+
if (!this.userInput) return picocolors.inverse(picocolors.hidden("_"));
|
|
617
|
+
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
618
|
+
const s = this.userInput.slice(0, this._cursor), [e, ...i] = this.userInput.slice(this._cursor);
|
|
619
|
+
return `${s}${picocolors.inverse(e)}${i.join("")}`;
|
|
620
|
+
}
|
|
621
|
+
get options() {
|
|
622
|
+
return "function" == typeof this.#s ? this.#s() : this.#s;
|
|
623
|
+
}
|
|
624
|
+
constructor(s){
|
|
625
|
+
super(s), this.#s = s.options;
|
|
626
|
+
const e = this.options;
|
|
627
|
+
this.filteredOptions = [
|
|
628
|
+
...e
|
|
629
|
+
], this.multiple = !0 === s.multiple, this.#i = s.filter ?? xt;
|
|
630
|
+
let i;
|
|
631
|
+
if (s.initialValue && Array.isArray(s.initialValue) ? this.multiple ? i = s.initialValue : i = s.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [
|
|
632
|
+
this.options[0].value
|
|
633
|
+
]), i) for (const r of i){
|
|
634
|
+
const n = e.findIndex((F)=>F.value === r);
|
|
635
|
+
-1 !== n && (this.toggleSelected(r), this.#t = n);
|
|
636
|
+
}
|
|
637
|
+
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n)=>this.#r(r, n)), this.on("userInput", (r)=>this.#n(r));
|
|
638
|
+
}
|
|
639
|
+
_isActionKey(s, e) {
|
|
640
|
+
return " " === s || this.multiple && this.isNavigating && "space" === e.name && void 0 !== s && "" !== s;
|
|
641
|
+
}
|
|
642
|
+
#r(s, e) {
|
|
643
|
+
const i = "up" === e.name, r = "down" === e.name, n = "return" === e.name;
|
|
644
|
+
i || r ? (this.#t = Math.max(0, Math.min(this.#t + (i ? -1 : 1), this.filteredOptions.length - 1)), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [
|
|
645
|
+
this.focusedValue
|
|
646
|
+
]), this.isNavigating = !0) : n ? this.value = Dt(this.multiple, this.selectedValues) : this.multiple ? void 0 !== this.focusedValue && ("tab" === e.name || this.isNavigating && "space" === e.name) ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [
|
|
647
|
+
this.focusedValue
|
|
648
|
+
]), this.isNavigating = !1);
|
|
649
|
+
}
|
|
650
|
+
deselectAll() {
|
|
651
|
+
this.selectedValues = [];
|
|
652
|
+
}
|
|
653
|
+
toggleSelected(s) {
|
|
654
|
+
0 !== this.filteredOptions.length && (this.multiple ? this.selectedValues.includes(s) ? this.selectedValues = this.selectedValues.filter((e)=>e !== s) : this.selectedValues = [
|
|
655
|
+
...this.selectedValues,
|
|
656
|
+
s
|
|
657
|
+
] : this.selectedValues = [
|
|
658
|
+
s
|
|
659
|
+
]);
|
|
660
|
+
}
|
|
661
|
+
#n(s) {
|
|
662
|
+
if (s !== this.#e) {
|
|
663
|
+
this.#e = s;
|
|
664
|
+
const e = this.options;
|
|
665
|
+
s ? this.filteredOptions = e.filter((i)=>this.#i(s, i)) : this.filteredOptions = [
|
|
666
|
+
...e
|
|
667
|
+
], this.#t = Bt(this.focusedValue, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (void 0 !== this.focusedValue ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
let St = class extends dist_B {
|
|
672
|
+
get cursor() {
|
|
673
|
+
return this.value ? 0 : 1;
|
|
674
|
+
}
|
|
675
|
+
get _value() {
|
|
676
|
+
return 0 === this.cursor;
|
|
677
|
+
}
|
|
678
|
+
constructor(s){
|
|
679
|
+
super(s, !1), this.value = !!s.initialValue, this.on("userInput", ()=>{
|
|
680
|
+
this.value = this._value;
|
|
681
|
+
}), this.on("confirm", (e)=>{
|
|
682
|
+
this.output.write(src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
683
|
+
}), this.on("cursor", ()=>{
|
|
684
|
+
this.value = !this.value;
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
class Vt extends dist_B {
|
|
689
|
+
options;
|
|
690
|
+
cursor = 0;
|
|
691
|
+
#t;
|
|
692
|
+
getGroupItems(s) {
|
|
693
|
+
return this.options.filter((e)=>e.group === s);
|
|
694
|
+
}
|
|
695
|
+
isGroupSelected(s) {
|
|
696
|
+
const e = this.getGroupItems(s), i = this.value;
|
|
697
|
+
return void 0 === i ? !1 : e.every((r)=>i.includes(r.value));
|
|
698
|
+
}
|
|
699
|
+
toggleValue() {
|
|
700
|
+
const s = this.options[this.cursor];
|
|
701
|
+
if (void 0 === this.value && (this.value = []), !0 === s.group) {
|
|
702
|
+
const e = s.value, i = this.getGroupItems(e);
|
|
703
|
+
this.isGroupSelected(e) ? this.value = this.value.filter((r)=>-1 === i.findIndex((n)=>n.value === r)) : this.value = [
|
|
704
|
+
...this.value,
|
|
705
|
+
...i.map((r)=>r.value)
|
|
706
|
+
], this.value = Array.from(new Set(this.value));
|
|
707
|
+
} else {
|
|
708
|
+
const e = this.value.includes(s.value);
|
|
709
|
+
this.value = e ? this.value.filter((i)=>i !== s.value) : [
|
|
710
|
+
...this.value,
|
|
711
|
+
s.value
|
|
712
|
+
];
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
constructor(s){
|
|
716
|
+
super(s, !1);
|
|
717
|
+
const { options: e } = s;
|
|
718
|
+
this.#t = !1 !== s.selectableGroups, this.options = Object.entries(e).flatMap(([i, r])=>[
|
|
719
|
+
{
|
|
720
|
+
value: i,
|
|
721
|
+
group: !0,
|
|
722
|
+
label: i
|
|
723
|
+
},
|
|
724
|
+
...r.map((n)=>({
|
|
725
|
+
...n,
|
|
726
|
+
group: i
|
|
727
|
+
}))
|
|
728
|
+
]), this.value = [
|
|
729
|
+
...s.initialValues ?? []
|
|
730
|
+
], this.cursor = Math.max(this.options.findIndex(({ value: i })=>i === s.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i)=>{
|
|
731
|
+
switch(i){
|
|
732
|
+
case "left":
|
|
733
|
+
case "up":
|
|
734
|
+
{
|
|
735
|
+
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
|
|
736
|
+
const r = this.options[this.cursor]?.group === !0;
|
|
737
|
+
!this.#t && r && (this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1);
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
case "down":
|
|
741
|
+
case "right":
|
|
742
|
+
{
|
|
743
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
744
|
+
const r = this.options[this.cursor]?.group === !0;
|
|
745
|
+
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
case "space":
|
|
749
|
+
this.toggleValue();
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
class kt extends dist_B {
|
|
756
|
+
options;
|
|
757
|
+
cursor = 0;
|
|
758
|
+
get _value() {
|
|
759
|
+
return this.options[this.cursor].value;
|
|
760
|
+
}
|
|
761
|
+
toggleAll() {
|
|
762
|
+
const s = void 0 !== this.value && this.value.length === this.options.length;
|
|
763
|
+
this.value = s ? [] : this.options.map((e)=>e.value);
|
|
764
|
+
}
|
|
765
|
+
toggleInvert() {
|
|
766
|
+
const s = this.value;
|
|
767
|
+
if (!s) return;
|
|
768
|
+
const e = this.options.filter((i)=>!s.includes(i.value));
|
|
769
|
+
this.value = e.map((i)=>i.value);
|
|
770
|
+
}
|
|
771
|
+
toggleValue() {
|
|
772
|
+
void 0 === this.value && (this.value = []);
|
|
773
|
+
const s = this.value.includes(this._value);
|
|
774
|
+
this.value = s ? this.value.filter((e)=>e !== this._value) : [
|
|
775
|
+
...this.value,
|
|
776
|
+
this._value
|
|
777
|
+
];
|
|
778
|
+
}
|
|
779
|
+
constructor(s){
|
|
780
|
+
super(s, !1), this.options = s.options, this.value = [
|
|
781
|
+
...s.initialValues ?? []
|
|
782
|
+
], this.cursor = Math.max(this.options.findIndex(({ value: e })=>e === s.cursorAt), 0), this.on("key", (e)=>{
|
|
783
|
+
"a" === e && this.toggleAll(), "i" === e && this.toggleInvert();
|
|
784
|
+
}), this.on("cursor", (e)=>{
|
|
785
|
+
switch(e){
|
|
786
|
+
case "left":
|
|
787
|
+
case "up":
|
|
788
|
+
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
|
|
789
|
+
break;
|
|
790
|
+
case "down":
|
|
791
|
+
case "right":
|
|
792
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
793
|
+
break;
|
|
794
|
+
case "space":
|
|
795
|
+
this.toggleValue();
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
let yt = class extends dist_B {
|
|
802
|
+
_mask = "\u2022";
|
|
803
|
+
get cursor() {
|
|
804
|
+
return this._cursor;
|
|
805
|
+
}
|
|
806
|
+
get masked() {
|
|
807
|
+
return this.userInput.replaceAll(/./g, this._mask);
|
|
808
|
+
}
|
|
809
|
+
get userInputWithCursor() {
|
|
810
|
+
if ("submit" === this.state || "cancel" === this.state) return this.masked;
|
|
811
|
+
const s = this.userInput;
|
|
812
|
+
if (this.cursor >= s.length) return `${this.masked}${picocolors.inverse(picocolors.hidden("_"))}`;
|
|
813
|
+
const e = this.masked, i = e.slice(0, this.cursor), r = e.slice(this.cursor);
|
|
814
|
+
return `${i}${picocolors.inverse(r[0])}${r.slice(1)}`;
|
|
815
|
+
}
|
|
816
|
+
clear() {
|
|
817
|
+
this._clearUserInput();
|
|
818
|
+
}
|
|
819
|
+
constructor({ mask: s, ...e }){
|
|
820
|
+
super(e), this._mask = s ?? "\u2022", this.on("userInput", (i)=>{
|
|
821
|
+
this._setValue(i);
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
class Mt extends dist_B {
|
|
826
|
+
options;
|
|
827
|
+
cursor = 0;
|
|
828
|
+
get _selectedValue() {
|
|
829
|
+
return this.options[this.cursor];
|
|
830
|
+
}
|
|
831
|
+
changeValue() {
|
|
832
|
+
this.value = this._selectedValue.value;
|
|
833
|
+
}
|
|
834
|
+
constructor(s){
|
|
835
|
+
super(s, !1), this.options = s.options, this.cursor = this.options.findIndex(({ value: e })=>e === s.initialValue), -1 === this.cursor && (this.cursor = 0), this.changeValue(), this.on("cursor", (e)=>{
|
|
836
|
+
switch(e){
|
|
837
|
+
case "left":
|
|
838
|
+
case "up":
|
|
839
|
+
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
|
|
840
|
+
break;
|
|
841
|
+
case "down":
|
|
842
|
+
case "right":
|
|
843
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
844
|
+
break;
|
|
845
|
+
}
|
|
846
|
+
this.changeValue();
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
class Lt extends dist_B {
|
|
851
|
+
options;
|
|
852
|
+
cursor = 0;
|
|
853
|
+
constructor(s){
|
|
854
|
+
super(s, !1), this.options = s.options;
|
|
855
|
+
const e = this.options.map(({ value: [i] })=>i?.toLowerCase());
|
|
856
|
+
this.cursor = Math.max(e.indexOf(s.initialValue), 0), this.on("key", (i)=>{
|
|
857
|
+
if (!i || !e.includes(i)) return;
|
|
858
|
+
const r = this.options.find(({ value: [n] })=>n?.toLowerCase() === i);
|
|
859
|
+
r && (this.value = r.value, this.state = "submit", this.emit("submit"));
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
class Wt extends dist_B {
|
|
864
|
+
get userInputWithCursor() {
|
|
865
|
+
if ("submit" === this.state) return this.userInput;
|
|
866
|
+
const s = this.userInput;
|
|
867
|
+
if (this.cursor >= s.length) return `${this.userInput}\u2588`;
|
|
868
|
+
const e = s.slice(0, this.cursor), [i, ...r] = s.slice(this.cursor);
|
|
869
|
+
return `${e}${picocolors.inverse(i)}${r.join("")}`;
|
|
870
|
+
}
|
|
871
|
+
get cursor() {
|
|
872
|
+
return this._cursor;
|
|
873
|
+
}
|
|
874
|
+
constructor(s){
|
|
875
|
+
super({
|
|
876
|
+
...s,
|
|
877
|
+
initialUserInput: s.initialUserInput ?? s.initialValue
|
|
878
|
+
}), this.on("userInput", (e)=>{
|
|
879
|
+
this._setValue(e);
|
|
880
|
+
}), this.on("finalize", ()=>{
|
|
881
|
+
this.value || (this.value = s.defaultValue), void 0 === this.value && (this.value = "");
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
886
|
+
var external_node_path_ = __webpack_require__("node:path");
|
|
887
|
+
var external_node_util_ = __webpack_require__("node:util");
|
|
888
|
+
function dist_ot() {
|
|
889
|
+
return "win32" !== external_node_process_["default"].platform ? "linux" !== external_node_process_["default"].env.TERM : !!external_node_process_["default"].env.CI || !!external_node_process_["default"].env.WT_SESSION || !!external_node_process_["default"].env.TERMINUS_SUBLIME || "{cmd::Cmder}" === external_node_process_["default"].env.ConEmuTask || "Terminus-Sublime" === external_node_process_["default"].env.TERM_PROGRAM || "vscode" === external_node_process_["default"].env.TERM_PROGRAM || "xterm-256color" === external_node_process_["default"].env.TERM || "alacritty" === external_node_process_["default"].env.TERM || "JetBrains-JediTerm" === external_node_process_["default"].env.TERMINAL_EMULATOR;
|
|
890
|
+
}
|
|
891
|
+
const dist_J = dist_ot(), re = ()=>"true" === process.env.CI, Se = (e)=>!0 === e.isTTY, dist_S = (e, r)=>dist_J ? e : r, we = dist_S("\u25C6", "*"), ie = dist_S("\u25A0", "x"), ne = dist_S("\u25B2", "x"), dist_W = dist_S("\u25C7", "o"), ae = dist_S("\u250C", "T"), dist_c = dist_S("\u2502", "|"), dist_b = dist_S("\u2514", "\u2014"), Be = dist_S("\u2510", "T"), xe = dist_S("\u2518", "\u2014"), dist_U = dist_S("\u25CF", ">"), dist_K = dist_S("\u25CB", " "), dist_X = dist_S("\u25FB", "[\u2022]"), dist_P = dist_S("\u25FC", "[+]"), Y = dist_S("\u25FB", "[ ]"), be = dist_S("\u25AA", "\u2022"), z = dist_S("\u2500", "-"), oe = dist_S("\u256E", "+"), _e = dist_S("\u251C", "+"), le = dist_S("\u256F", "+"), De = dist_S("\u2570", "+"), Te = dist_S("\u256D", "+"), ue = dist_S("\u25CF", "\u2022"), ce = dist_S("\u25C6", "*"), $e = dist_S("\u25B2", "!"), de = dist_S("\u25A0", "x"), dist_L = (e)=>{
|
|
892
|
+
switch(e){
|
|
893
|
+
case "initial":
|
|
894
|
+
case "active":
|
|
895
|
+
return picocolors.cyan(we);
|
|
896
|
+
case "cancel":
|
|
897
|
+
return picocolors.red(ie);
|
|
898
|
+
case "error":
|
|
899
|
+
return picocolors.yellow(ne);
|
|
900
|
+
case "submit":
|
|
901
|
+
return picocolors.green(dist_W);
|
|
902
|
+
}
|
|
903
|
+
}, dist_lt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 === e || 240 === e || 242 === e || 243 === e || e >= 247 && e <= 250 || 252 === e || 254 === e || 257 === e || 273 === e || 275 === e || 283 === e || 294 === e || 295 === e || 299 === e || e >= 305 && e <= 307 || 312 === e || e >= 319 && e <= 322 || 324 === e || e >= 328 && e <= 331 || 333 === e || 338 === e || 339 === e || 358 === e || 359 === e || 363 === e || 462 === e || 464 === e || 466 === e || 468 === e || 470 === e || 472 === e || 474 === e || 476 === e || 593 === e || 609 === e || 708 === e || 711 === e || e >= 713 && e <= 715 || 717 === e || 720 === e || e >= 728 && e <= 731 || 733 === e || 735 === e || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || 1025 === e || e >= 1040 && e <= 1103 || 1105 === e || 8208 === e || e >= 8211 && e <= 8214 || 8216 === e || 8217 === e || 8220 === e || 8221 === e || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || 8240 === e || 8242 === e || 8243 === e || 8245 === e || 8251 === e || 8254 === e || 8308 === e || 8319 === e || e >= 8321 && e <= 8324 || 8364 === e || 8451 === e || 8453 === e || 8457 === e || 8467 === e || 8470 === e || 8481 === e || 8482 === e || 8486 === e || 8491 === e || 8531 === e || 8532 === e || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || 8585 === e || e >= 8592 && e <= 8601 || 8632 === e || 8633 === e || 8658 === e || 8660 === e || 8679 === e || 8704 === e || 8706 === e || 8707 === e || 8711 === e || 8712 === e || 8715 === e || 8719 === e || 8721 === e || 8725 === e || 8730 === e || e >= 8733 && e <= 8736 || 8739 === e || 8741 === e || e >= 8743 && e <= 8748 || 8750 === e || e >= 8756 && e <= 8759 || 8764 === e || 8765 === e || 8776 === e || 8780 === e || 8786 === e || 8800 === e || 8801 === e || e >= 8804 && e <= 8807 || 8810 === e || 8811 === e || 8814 === e || 8815 === e || 8834 === e || 8835 === e || 8838 === e || 8839 === e || 8853 === e || 8857 === e || 8869 === e || 8895 === e || 8978 === e || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || 9632 === e || 9633 === e || e >= 9635 && e <= 9641 || 9650 === e || 9651 === e || 9654 === e || 9655 === e || 9660 === e || 9661 === e || 9664 === e || 9665 === e || e >= 9670 && e <= 9672 || 9675 === e || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || 9711 === e || 9733 === e || 9734 === e || 9737 === e || 9742 === e || 9743 === e || 9756 === e || 9758 === e || 9792 === e || 9794 === e || 9824 === e || 9825 === e || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || 9836 === e || 9837 === e || 9839 === e || 9886 === e || 9887 === e || 9919 === e || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || 9955 === e || 9960 === e || 9961 === e || e >= 9963 && e <= 9969 || 9972 === e || e >= 9974 && e <= 9977 || 9979 === e || 9980 === e || 9982 === e || 9983 === e || 10045 === e || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || 65533 === e || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || 127375 === e || 127376 === e || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, dist_ut = (e)=>12288 === e || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, dist_ct = (e)=>e >= 4352 && e <= 4447 || 8986 === e || 8987 === e || 9001 === e || 9002 === e || e >= 9193 && e <= 9196 || 9200 === e || 9203 === e || 9725 === e || 9726 === e || 9748 === e || 9749 === e || e >= 9800 && e <= 9811 || 9855 === e || 9875 === e || 9889 === e || 9898 === e || 9899 === e || 9917 === e || 9918 === e || 9924 === e || 9925 === e || 9934 === e || 9940 === e || 9962 === e || 9970 === e || 9971 === e || 9973 === e || 9978 === e || 9981 === e || 9989 === e || 9994 === e || 9995 === e || 10024 === e || 10060 === e || 10062 === e || e >= 10067 && e <= 10069 || 10071 === e || e >= 10133 && e <= 10135 || 10160 === e || 10175 === e || 11035 === e || 11036 === e || 11088 === e || 11093 === e || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || 94192 === e || 94193 === e || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || 110589 === e || 110590 === e || e >= 110592 && e <= 110882 || 110898 === e || e >= 110928 && e <= 110930 || 110933 === e || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || 126980 === e || 127183 === e || 127374 === e || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || 127568 === e || 127569 === e || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || 127988 === e || e >= 127992 && e <= 128062 || 128064 === e || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || 128378 === e || 128405 === e || 128406 === e || 128420 === e || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || 128716 === e || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || 128747 === e || 128748 === e || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || 129008 === e || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, he = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, dist_Z = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_Q = /\t{1,1000}/y, me = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, ee = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, $t = /\p{M}+/gu, dist_dt = {
|
|
904
|
+
limit: 1 / 0,
|
|
905
|
+
ellipsis: ""
|
|
906
|
+
}, Re = (e, r = {}, s = {})=>{
|
|
907
|
+
const i = r.limit ?? 1 / 0, n = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (n ? Re(n, dist_dt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, a = s.tabWidth ?? 8, m = s.ambiguousWidth ?? 1, E = s.emojiWidth ?? 2, y = s.fullWidthWidth ?? 2, F = s.regularWidth ?? 1, p = s.wideWidth ?? 2;
|
|
908
|
+
let h = 0, d = 0, $ = e.length, g = 0, f = !1, v = $, w = Math.max(0, i - o), B = 0, x = 0, A = 0, C = 0;
|
|
909
|
+
e: for(;;){
|
|
910
|
+
if (x > B || d >= $ && d > h) {
|
|
911
|
+
const _ = e.slice(B, x) || e.slice(h, d);
|
|
912
|
+
g = 0;
|
|
913
|
+
for (const D of _.replaceAll($t, "")){
|
|
914
|
+
const I = D.codePointAt(0) || 0;
|
|
915
|
+
if (dist_ut(I) ? C = y : dist_ct(I) ? C = p : m !== F && dist_lt(I) ? C = m : C = F, A + C > w && (v = Math.min(v, Math.max(B, h) + g)), A + C > i) {
|
|
916
|
+
f = !0;
|
|
917
|
+
break e;
|
|
918
|
+
}
|
|
919
|
+
g += D.length, A += C;
|
|
920
|
+
}
|
|
921
|
+
B = x = 0;
|
|
922
|
+
}
|
|
923
|
+
if (d >= $) break;
|
|
924
|
+
if (ee.lastIndex = d, ee.test(e)) {
|
|
925
|
+
if (g = ee.lastIndex - d, C = g * F, A + C > w && (v = Math.min(v, d + Math.floor((w - A) / F))), A + C > i) {
|
|
926
|
+
f = !0;
|
|
927
|
+
break;
|
|
928
|
+
}
|
|
929
|
+
A += C, B = h, x = d, d = h = ee.lastIndex;
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
if (he.lastIndex = d, he.test(e)) {
|
|
933
|
+
if (A + u > w && (v = Math.min(v, d)), A + u > i) {
|
|
934
|
+
f = !0;
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
A += u, B = h, x = d, d = h = he.lastIndex;
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
if (dist_Z.lastIndex = d, dist_Z.test(e)) {
|
|
941
|
+
if (g = dist_Z.lastIndex - d, C = g * l, A + C > w && (v = Math.min(v, d + Math.floor((w - A) / l))), A + C > i) {
|
|
942
|
+
f = !0;
|
|
943
|
+
break;
|
|
944
|
+
}
|
|
945
|
+
A += C, B = h, x = d, d = h = dist_Z.lastIndex;
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
if (dist_Q.lastIndex = d, dist_Q.test(e)) {
|
|
949
|
+
if (g = dist_Q.lastIndex - d, C = g * a, A + C > w && (v = Math.min(v, d + Math.floor((w - A) / a))), A + C > i) {
|
|
950
|
+
f = !0;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
A += C, B = h, x = d, d = h = dist_Q.lastIndex;
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
if (me.lastIndex = d, me.test(e)) {
|
|
957
|
+
if (A + E > w && (v = Math.min(v, d)), A + E > i) {
|
|
958
|
+
f = !0;
|
|
959
|
+
break;
|
|
960
|
+
}
|
|
961
|
+
A += E, B = h, x = d, d = h = me.lastIndex;
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
d += 1;
|
|
965
|
+
}
|
|
966
|
+
return {
|
|
967
|
+
width: f ? w : A,
|
|
968
|
+
index: f ? v : $,
|
|
969
|
+
truncated: f,
|
|
970
|
+
ellipsed: f && i >= o
|
|
971
|
+
};
|
|
972
|
+
}, dist_ht = {
|
|
973
|
+
limit: 1 / 0,
|
|
974
|
+
ellipsis: "",
|
|
975
|
+
ellipsisWidth: 0
|
|
976
|
+
}, dist_M = (e, r = {})=>Re(e, dist_ht, r).width, te = "\x1B", Me = "\x9B", dist_mt = 39, pe = "\x07", Oe = "[", dist_pt = "]", Ne = "m", ge = `${dist_pt}8;;`, Le = new RegExp(`(?:\\${Oe}(?<code>\\d+)m|\\${ge}(?<uri>.*)${pe})`, "y"), dist_gt = (e)=>{
|
|
977
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
978
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
979
|
+
if (1 === e || 2 === e) return 22;
|
|
980
|
+
if (3 === e) return 23;
|
|
981
|
+
if (4 === e) return 24;
|
|
982
|
+
if (7 === e) return 27;
|
|
983
|
+
if (8 === e) return 28;
|
|
984
|
+
if (9 === e) return 29;
|
|
985
|
+
if (0 === e) return 0;
|
|
986
|
+
}, We = (e)=>`${te}${Oe}${e}${Ne}`, Pe = (e)=>`${te}${ge}${e}${pe}`, dist_ft = (e)=>e.map((r)=>dist_M(r)), fe = (e, r, s)=>{
|
|
987
|
+
const i = r[Symbol.iterator]();
|
|
988
|
+
let n = !1, o = !1, u = e.at(-1), l = void 0 === u ? 0 : dist_M(u), a = i.next(), m = i.next(), E = 0;
|
|
989
|
+
for(; !a.done;){
|
|
990
|
+
const y = a.value, F = dist_M(y);
|
|
991
|
+
l + F <= s ? e[e.length - 1] += y : (e.push(y), l = 0), (y === te || y === Me) && (n = !0, o = r.startsWith(ge, E + 1)), n ? o ? y === pe && (n = !1, o = !1) : y === Ne && (n = !1) : (l += F, l !== s || m.done || (e.push(""), l = 0)), a = m, m = i.next(), E += y.length;
|
|
992
|
+
}
|
|
993
|
+
u = e.at(-1), !l && void 0 !== u && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
994
|
+
}, dist_Ft = (e)=>{
|
|
995
|
+
const r = e.split(" ");
|
|
996
|
+
let s = r.length;
|
|
997
|
+
for(; s > 0 && !(dist_M(r[s - 1]) > 0);)s--;
|
|
998
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
999
|
+
}, dist_yt = (e, r, s = {})=>{
|
|
1000
|
+
if (!1 !== s.trim && "" === e.trim()) return "";
|
|
1001
|
+
let i = "", n, o;
|
|
1002
|
+
const u = e.split(" "), l = dist_ft(u);
|
|
1003
|
+
let a = [
|
|
1004
|
+
""
|
|
1005
|
+
];
|
|
1006
|
+
for (const [h, d] of u.entries()){
|
|
1007
|
+
!1 !== s.trim && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
|
|
1008
|
+
let $ = dist_M(a.at(-1) ?? "");
|
|
1009
|
+
if (0 !== h && ($ >= r && (!1 === s.wordWrap || !1 === s.trim) && (a.push(""), $ = 0), ($ > 0 || !1 === s.trim) && (a[a.length - 1] += " ", $++)), s.hard && l[h] > r) {
|
|
1010
|
+
const g = r - $, f = 1 + Math.floor((l[h] - g - 1) / r);
|
|
1011
|
+
Math.floor((l[h] - 1) / r) < f && a.push(""), fe(a, d, r);
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
if ($ + l[h] > r && $ > 0 && l[h] > 0) {
|
|
1015
|
+
if (!1 === s.wordWrap && $ < r) {
|
|
1016
|
+
fe(a, d, r);
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1019
|
+
a.push("");
|
|
1020
|
+
}
|
|
1021
|
+
if ($ + l[h] > r && !1 === s.wordWrap) {
|
|
1022
|
+
fe(a, d, r);
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
a[a.length - 1] += d;
|
|
1026
|
+
}
|
|
1027
|
+
!1 !== s.trim && (a = a.map((h)=>dist_Ft(h)));
|
|
1028
|
+
const m = a.join(`
|
|
1029
|
+
`), E = m[Symbol.iterator]();
|
|
1030
|
+
let y = E.next(), F = E.next(), p = 0;
|
|
1031
|
+
for(; !y.done;){
|
|
1032
|
+
const h = y.value, d = F.value;
|
|
1033
|
+
if (i += h, h === te || h === Me) {
|
|
1034
|
+
Le.lastIndex = p + 1;
|
|
1035
|
+
const f = Le.exec(m)?.groups;
|
|
1036
|
+
if (f?.code !== void 0) {
|
|
1037
|
+
const v = Number.parseFloat(f.code);
|
|
1038
|
+
n = v === dist_mt ? void 0 : v;
|
|
1039
|
+
} else f?.uri !== void 0 && (o = 0 === f.uri.length ? void 0 : f.uri);
|
|
1040
|
+
}
|
|
1041
|
+
const $ = n ? dist_gt(n) : void 0;
|
|
1042
|
+
d === `
|
|
1043
|
+
` ? (o && (i += Pe("")), n && $ && (i += We($))) : h === `
|
|
1044
|
+
` && (n && $ && (i += We(n)), o && (i += Pe(o))), p += h.length, y = F, F = E.next();
|
|
1045
|
+
}
|
|
1046
|
+
return i;
|
|
1047
|
+
};
|
|
1048
|
+
function dist_k(e, r, s) {
|
|
1049
|
+
return String(e).normalize().replaceAll(`\r
|
|
1050
|
+
`, `
|
|
1051
|
+
`).split(`
|
|
1052
|
+
`).map((i)=>dist_yt(i, r, s)).join(`
|
|
1053
|
+
`);
|
|
1054
|
+
}
|
|
1055
|
+
const dist_Et = (e, r, s, i, n)=>{
|
|
1056
|
+
let o = r, u = 0;
|
|
1057
|
+
for(let l = s; l < i; l++){
|
|
1058
|
+
const a = e[l];
|
|
1059
|
+
if (o -= a.length, u++, o <= n) break;
|
|
1060
|
+
}
|
|
1061
|
+
return {
|
|
1062
|
+
lineCount: o,
|
|
1063
|
+
removals: u
|
|
1064
|
+
};
|
|
1065
|
+
}, dist_G = (e)=>{
|
|
1066
|
+
const { cursor: r, options: s, style: i } = e, n = e.output ?? process.stdout, o = Ct(n), u = e.columnPadding ?? 0, l = e.rowPadding ?? 4, a = o - u, m = bt(n), E = picocolors.dim("..."), y = e.maxItems ?? 1 / 0, F = Math.max(m - l, 0), p = Math.max(y, 5);
|
|
1067
|
+
let h = 0;
|
|
1068
|
+
r >= p - 3 && (h = Math.max(Math.min(r - p + 3, s.length - p), 0));
|
|
1069
|
+
let d = p < s.length && h > 0, $ = p < s.length && h + p < s.length;
|
|
1070
|
+
const g = Math.min(h + p, s.length), f = [];
|
|
1071
|
+
let v = 0;
|
|
1072
|
+
d && v++, $ && v++;
|
|
1073
|
+
const w = h + (d ? 1 : 0), B = g - ($ ? 1 : 0);
|
|
1074
|
+
for(let A = w; A < B; A++){
|
|
1075
|
+
const C = dist_k(i(s[A], A === r), a).split(`
|
|
1076
|
+
`);
|
|
1077
|
+
f.push(C), v += C.length;
|
|
1078
|
+
}
|
|
1079
|
+
if (v > F) {
|
|
1080
|
+
let A = 0, C = 0, _ = v;
|
|
1081
|
+
const D = r - w, I = (T, R)=>dist_Et(f, _, T, R, F);
|
|
1082
|
+
d ? ({ lineCount: _, removals: A } = I(0, D), _ > F && ({ lineCount: _, removals: C } = I(D + 1, f.length))) : ({ lineCount: _, removals: C } = I(D + 1, f.length), _ > F && ({ lineCount: _, removals: A } = I(0, D))), A > 0 && (d = !0, f.splice(0, A)), C > 0 && ($ = !0, f.splice(f.length - C, C));
|
|
1083
|
+
}
|
|
1084
|
+
const x = [];
|
|
1085
|
+
d && x.push(E);
|
|
1086
|
+
for (const A of f)for (const C of A)x.push(C);
|
|
1087
|
+
return $ && x.push(E), x;
|
|
1088
|
+
};
|
|
1089
|
+
function je(e) {
|
|
1090
|
+
return e.label ?? String(e.value ?? "");
|
|
1091
|
+
}
|
|
1092
|
+
function Ve(e, r) {
|
|
1093
|
+
if (!e) return !0;
|
|
1094
|
+
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), n = String(r.value).toLowerCase(), o = e.toLowerCase();
|
|
1095
|
+
return s.includes(o) || i.includes(o) || n.includes(o);
|
|
1096
|
+
}
|
|
1097
|
+
function dist_vt(e, r) {
|
|
1098
|
+
const s = [];
|
|
1099
|
+
for (const i of r)e.includes(i.value) && s.push(i);
|
|
1100
|
+
return s;
|
|
1101
|
+
}
|
|
1102
|
+
const ke = (e)=>new wt({
|
|
1103
|
+
options: e.options,
|
|
1104
|
+
initialValue: e.initialValue ? [
|
|
1105
|
+
e.initialValue
|
|
1106
|
+
] : void 0,
|
|
1107
|
+
initialUserInput: e.initialUserInput,
|
|
1108
|
+
filter: (r, s)=>Ve(r, s),
|
|
1109
|
+
signal: e.signal,
|
|
1110
|
+
input: e.input,
|
|
1111
|
+
output: e.output,
|
|
1112
|
+
validate: e.validate,
|
|
1113
|
+
render () {
|
|
1114
|
+
const r = [
|
|
1115
|
+
`${picocolors.gray(dist_c)}`,
|
|
1116
|
+
`${dist_L(this.state)} ${e.message}`
|
|
1117
|
+
], s = this.userInput, i = String(this.value ?? ""), n = this.options, o = e.placeholder, u = "" === i && void 0 !== o;
|
|
1118
|
+
switch(this.state){
|
|
1119
|
+
case "submit":
|
|
1120
|
+
{
|
|
1121
|
+
const l = dist_vt(this.selectedValues, n), a = l.length > 0 ? ` ${picocolors.dim(l.map(je).join(", "))}` : "";
|
|
1122
|
+
return `${r.join(`
|
|
1123
|
+
`)}
|
|
1124
|
+
${picocolors.gray(dist_c)}${a}`;
|
|
1125
|
+
}
|
|
1126
|
+
case "cancel":
|
|
1127
|
+
{
|
|
1128
|
+
const l = s ? ` ${picocolors.strikethrough(picocolors.dim(s))}` : "";
|
|
1129
|
+
return `${r.join(`
|
|
1130
|
+
`)}
|
|
1131
|
+
${picocolors.gray(dist_c)}${l}`;
|
|
1132
|
+
}
|
|
1133
|
+
default:
|
|
1134
|
+
{
|
|
1135
|
+
let l = "";
|
|
1136
|
+
if (this.isNavigating || u) {
|
|
1137
|
+
const h = u ? o : s;
|
|
1138
|
+
l = "" !== h ? ` ${picocolors.dim(h)}` : "";
|
|
1139
|
+
} else l = ` ${this.userInputWithCursor}`;
|
|
1140
|
+
const a = this.filteredOptions.length !== n.length ? picocolors.dim(` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "", m = 0 === this.filteredOptions.length && s ? [
|
|
1141
|
+
`${picocolors.cyan(dist_c)} ${picocolors.yellow("No matches found")}`
|
|
1142
|
+
] : [], E = "error" === this.state ? [
|
|
1143
|
+
`${picocolors.yellow(dist_c)} ${picocolors.yellow(this.error)}`
|
|
1144
|
+
] : [];
|
|
1145
|
+
r.push(`${picocolors.cyan(dist_c)}`, `${picocolors.cyan(dist_c)} ${picocolors.dim("Search:")}${l}${a}`, ...m, ...E);
|
|
1146
|
+
const y = [
|
|
1147
|
+
`${picocolors.dim("\u2191/\u2193")} to select`,
|
|
1148
|
+
`${picocolors.dim("Enter:")} confirm`,
|
|
1149
|
+
`${picocolors.dim("Type:")} to search`
|
|
1150
|
+
], F = [
|
|
1151
|
+
`${picocolors.cyan(dist_c)} ${picocolors.dim(y.join(" \u2022 "))}`,
|
|
1152
|
+
`${picocolors.cyan(dist_b)}`
|
|
1153
|
+
], p = 0 === this.filteredOptions.length ? [] : dist_G({
|
|
1154
|
+
cursor: this.cursor,
|
|
1155
|
+
options: this.filteredOptions,
|
|
1156
|
+
columnPadding: 3,
|
|
1157
|
+
rowPadding: r.length + F.length,
|
|
1158
|
+
style: (h, d)=>{
|
|
1159
|
+
const $ = je(h), g = h.hint && h.value === this.focusedValue ? picocolors.dim(` (${h.hint})`) : "";
|
|
1160
|
+
return d ? `${picocolors.green(dist_U)} ${$}${g}` : `${picocolors.dim(dist_K)} ${picocolors.dim($)}${g}`;
|
|
1161
|
+
},
|
|
1162
|
+
maxItems: e.maxItems,
|
|
1163
|
+
output: e.output
|
|
1164
|
+
});
|
|
1165
|
+
return [
|
|
1166
|
+
...r,
|
|
1167
|
+
...p.map((h)=>`${picocolors.cyan(dist_c)} ${h}`),
|
|
1168
|
+
...F
|
|
1169
|
+
].join(`
|
|
1170
|
+
`);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}).prompt(), dist_At = (e)=>{
|
|
1175
|
+
const r = (i, n, o, u)=>{
|
|
1176
|
+
const l = o.includes(i.value), a = i.label ?? String(i.value ?? ""), m = i.hint && void 0 !== u && i.value === u ? picocolors.dim(` (${i.hint})`) : "", E = l ? picocolors.green(dist_P) : picocolors.dim(Y);
|
|
1177
|
+
return n ? `${E} ${a}${m}` : `${E} ${picocolors.dim(a)}`;
|
|
1178
|
+
}, s = new wt({
|
|
1179
|
+
options: e.options,
|
|
1180
|
+
multiple: !0,
|
|
1181
|
+
filter: (i, n)=>Ve(i, n),
|
|
1182
|
+
validate: ()=>{
|
|
1183
|
+
if (e.required && 0 === s.selectedValues.length) return "Please select at least one item";
|
|
1184
|
+
},
|
|
1185
|
+
initialValue: e.initialValues,
|
|
1186
|
+
signal: e.signal,
|
|
1187
|
+
input: e.input,
|
|
1188
|
+
output: e.output,
|
|
1189
|
+
render () {
|
|
1190
|
+
const i = `${picocolors.gray(dist_c)}
|
|
1191
|
+
${dist_L(this.state)} ${e.message}
|
|
1192
|
+
`, n = this.userInput, o = e.placeholder, u = "" === n && void 0 !== o, l = this.isNavigating || u ? picocolors.dim(u ? o : n) : this.userInputWithCursor, a = this.options, m = this.filteredOptions.length !== a.length ? picocolors.dim(` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "";
|
|
1193
|
+
switch(this.state){
|
|
1194
|
+
case "submit":
|
|
1195
|
+
return `${i}${picocolors.gray(dist_c)} ${picocolors.dim(`${this.selectedValues.length} items selected`)}`;
|
|
1196
|
+
case "cancel":
|
|
1197
|
+
return `${i}${picocolors.gray(dist_c)} ${picocolors.strikethrough(picocolors.dim(n))}`;
|
|
1198
|
+
default:
|
|
1199
|
+
{
|
|
1200
|
+
const E = [
|
|
1201
|
+
`${picocolors.dim("\u2191/\u2193")} to navigate`,
|
|
1202
|
+
`${picocolors.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
1203
|
+
`${picocolors.dim("Enter:")} confirm`,
|
|
1204
|
+
`${picocolors.dim("Type:")} to search`
|
|
1205
|
+
], y = 0 === this.filteredOptions.length && n ? [
|
|
1206
|
+
`${picocolors.cyan(dist_c)} ${picocolors.yellow("No matches found")}`
|
|
1207
|
+
] : [], F = "error" === this.state ? [
|
|
1208
|
+
`${picocolors.cyan(dist_c)} ${picocolors.yellow(this.error)}`
|
|
1209
|
+
] : [], p = dist_G({
|
|
1210
|
+
cursor: this.cursor,
|
|
1211
|
+
options: this.filteredOptions,
|
|
1212
|
+
style: (h, d)=>r(h, d, this.selectedValues, this.focusedValue),
|
|
1213
|
+
maxItems: e.maxItems,
|
|
1214
|
+
output: e.output
|
|
1215
|
+
});
|
|
1216
|
+
return [
|
|
1217
|
+
i,
|
|
1218
|
+
`${picocolors.cyan(dist_c)} ${picocolors.dim("Search:")} ${l}${m}`,
|
|
1219
|
+
...y,
|
|
1220
|
+
...F,
|
|
1221
|
+
...p.map((h)=>`${picocolors.cyan(dist_c)} ${h}`),
|
|
1222
|
+
`${picocolors.cyan(dist_c)} ${picocolors.dim(E.join(" \u2022 "))}`,
|
|
1223
|
+
`${picocolors.cyan(dist_b)}`
|
|
1224
|
+
].join(`
|
|
1225
|
+
`);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
return s.prompt();
|
|
1231
|
+
}, dist_Ct = [
|
|
1232
|
+
Te,
|
|
1233
|
+
oe,
|
|
1234
|
+
De,
|
|
1235
|
+
le
|
|
1236
|
+
], dist_It = [
|
|
1237
|
+
ae,
|
|
1238
|
+
Be,
|
|
1239
|
+
dist_b,
|
|
1240
|
+
xe
|
|
1241
|
+
];
|
|
1242
|
+
function Ge(e, r, s, i) {
|
|
1243
|
+
let n = s, o = s;
|
|
1244
|
+
return "center" === i ? n = Math.floor((r - e) / 2) : "right" === i && (n = r - e - s), o = r - n - e, [
|
|
1245
|
+
n,
|
|
1246
|
+
o
|
|
1247
|
+
];
|
|
1248
|
+
}
|
|
1249
|
+
const dist_St = (e)=>e, dist_wt = (e = "", r = "", s)=>{
|
|
1250
|
+
const i = s?.output ?? process.stdout, n = Ct(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, a = s?.width === void 0 || "auto" === s.width ? 1 : Math.min(1, s.width), m = s?.includePrefix ? `${dist_c} ` : "", E = s?.formatBorder ?? dist_St, y = (s?.rounded ? dist_Ct : dist_It).map(E), F = E(z), p = E(dist_c), h = dist_M(m), d = dist_M(r), $ = n - h;
|
|
1251
|
+
let g = Math.floor(n * a) - h;
|
|
1252
|
+
if (s?.width === "auto") {
|
|
1253
|
+
const _ = e.split(`
|
|
1254
|
+
`);
|
|
1255
|
+
let D = d + 2 * u;
|
|
1256
|
+
for (const T of _){
|
|
1257
|
+
const R = dist_M(T) + 2 * l;
|
|
1258
|
+
R > D && (D = R);
|
|
1259
|
+
}
|
|
1260
|
+
const I = D + o;
|
|
1261
|
+
I < g && (g = I);
|
|
1262
|
+
}
|
|
1263
|
+
g % 2 !== 0 && (g < $ ? g++ : g--);
|
|
1264
|
+
const f = g - o, v = f - 2 * u, w = d > v ? `${r.slice(0, v - 3)}...` : r, [B, x] = Ge(dist_M(w), f, u, s?.titleAlign), A = dist_k(e, f - 2 * l, {
|
|
1265
|
+
hard: !0,
|
|
1266
|
+
trim: !1
|
|
1267
|
+
});
|
|
1268
|
+
i.write(`${m}${y[0]}${F.repeat(B)}${w}${F.repeat(x)}${y[1]}
|
|
1269
|
+
`);
|
|
1270
|
+
const C = A.split(`
|
|
1271
|
+
`);
|
|
1272
|
+
for (const _ of C){
|
|
1273
|
+
const [D, I] = Ge(dist_M(_), f, l, s?.contentAlign);
|
|
1274
|
+
i.write(`${m}${p}${" ".repeat(D)}${_}${" ".repeat(I)}${p}
|
|
1275
|
+
`);
|
|
1276
|
+
}
|
|
1277
|
+
i.write(`${m}${y[2]}${F.repeat(f)}${y[3]}
|
|
1278
|
+
`);
|
|
1279
|
+
}, dist_Bt = (e)=>{
|
|
1280
|
+
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1281
|
+
return new St({
|
|
1282
|
+
active: r,
|
|
1283
|
+
inactive: s,
|
|
1284
|
+
signal: e.signal,
|
|
1285
|
+
input: e.input,
|
|
1286
|
+
output: e.output,
|
|
1287
|
+
initialValue: e.initialValue ?? !0,
|
|
1288
|
+
render () {
|
|
1289
|
+
const i = `${picocolors.gray(dist_c)}
|
|
1290
|
+
${dist_L(this.state)} ${e.message}
|
|
1291
|
+
`, n = this.value ? r : s;
|
|
1292
|
+
switch(this.state){
|
|
1293
|
+
case "submit":
|
|
1294
|
+
return `${i}${picocolors.gray(dist_c)} ${picocolors.dim(n)}`;
|
|
1295
|
+
case "cancel":
|
|
1296
|
+
return `${i}${picocolors.gray(dist_c)} ${picocolors.strikethrough(picocolors.dim(n))}
|
|
1297
|
+
${picocolors.gray(dist_c)}`;
|
|
1298
|
+
default:
|
|
1299
|
+
return `${i}${picocolors.cyan(dist_c)} ${this.value ? `${picocolors.green(dist_U)} ${r}` : `${picocolors.dim(dist_K)} ${picocolors.dim(r)}`} ${picocolors.dim("/")} ${this.value ? `${picocolors.dim(dist_K)} ${picocolors.dim(s)}` : `${picocolors.green(dist_U)} ${s}`}
|
|
1300
|
+
${picocolors.cyan(dist_b)}
|
|
1301
|
+
`;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}).prompt();
|
|
1305
|
+
}, dist_xt = async (e, r)=>{
|
|
1306
|
+
const s = {}, i = Object.keys(e);
|
|
1307
|
+
for (const n of i){
|
|
1308
|
+
const o = e[n], u = await o({
|
|
1309
|
+
results: s
|
|
1310
|
+
})?.catch((l)=>{
|
|
1311
|
+
throw l;
|
|
1312
|
+
});
|
|
1313
|
+
if ("function" == typeof r?.onCancel && It(u)) {
|
|
1314
|
+
s[n] = "canceled", r.onCancel({
|
|
1315
|
+
results: s
|
|
1316
|
+
});
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
s[n] = u;
|
|
1320
|
+
}
|
|
1321
|
+
return s;
|
|
1322
|
+
}, dist_bt = (e)=>{
|
|
1323
|
+
const { selectableGroups: r = !0, groupSpacing: s = 0 } = e, i = (o, u, l = [])=>{
|
|
1324
|
+
const a = o.label ?? String(o.value), m = "string" == typeof o.group, E = m && (l[l.indexOf(o) + 1] ?? {
|
|
1325
|
+
group: !0
|
|
1326
|
+
}), y = m && E && !0 === E.group, F = m ? r ? `${y ? dist_b : dist_c} ` : " " : "";
|
|
1327
|
+
let p = "";
|
|
1328
|
+
if (s > 0 && !m) {
|
|
1329
|
+
const d = `
|
|
1330
|
+
${picocolors.cyan(dist_c)}`;
|
|
1331
|
+
p = `${d.repeat(s - 1)}${d} `;
|
|
1332
|
+
}
|
|
1333
|
+
if ("active" === u) return `${p}${picocolors.dim(F)}${picocolors.cyan(dist_X)} ${a}${o.hint ? ` ${picocolors.dim(`(${o.hint})`)}` : ""}`;
|
|
1334
|
+
if ("group-active" === u) return `${p}${F}${picocolors.cyan(dist_X)} ${picocolors.dim(a)}`;
|
|
1335
|
+
if ("group-active-selected" === u) return `${p}${F}${picocolors.green(dist_P)} ${picocolors.dim(a)}`;
|
|
1336
|
+
if ("selected" === u) {
|
|
1337
|
+
const d = m || r ? picocolors.green(dist_P) : "";
|
|
1338
|
+
return `${p}${picocolors.dim(F)}${d} ${picocolors.dim(a)}${o.hint ? ` ${picocolors.dim(`(${o.hint})`)}` : ""}`;
|
|
1339
|
+
}
|
|
1340
|
+
if ("cancelled" === u) return `${picocolors.strikethrough(picocolors.dim(a))}`;
|
|
1341
|
+
if ("active-selected" === u) return `${p}${picocolors.dim(F)}${picocolors.green(dist_P)} ${a}${o.hint ? ` ${picocolors.dim(`(${o.hint})`)}` : ""}`;
|
|
1342
|
+
if ("submitted" === u) return `${picocolors.dim(a)}`;
|
|
1343
|
+
const h = m || r ? picocolors.dim(Y) : "";
|
|
1344
|
+
return `${p}${picocolors.dim(F)}${h} ${picocolors.dim(a)}`;
|
|
1345
|
+
}, n = e.required ?? !0;
|
|
1346
|
+
return new Vt({
|
|
1347
|
+
options: e.options,
|
|
1348
|
+
signal: e.signal,
|
|
1349
|
+
input: e.input,
|
|
1350
|
+
output: e.output,
|
|
1351
|
+
initialValues: e.initialValues,
|
|
1352
|
+
required: n,
|
|
1353
|
+
cursorAt: e.cursorAt,
|
|
1354
|
+
selectableGroups: r,
|
|
1355
|
+
validate (o) {
|
|
1356
|
+
if (n && (void 0 === o || 0 === o.length)) return `Please select at least one option.
|
|
1357
|
+
${picocolors.reset(picocolors.dim(`Press ${picocolors.gray(picocolors.bgWhite(picocolors.inverse(" space ")))} to select, ${picocolors.gray(picocolors.bgWhite(picocolors.inverse(" enter ")))} to submit`))}`;
|
|
1358
|
+
},
|
|
1359
|
+
render () {
|
|
1360
|
+
const o = `${picocolors.gray(dist_c)}
|
|
1361
|
+
${dist_L(this.state)} ${e.message}
|
|
1362
|
+
`, u = this.value ?? [];
|
|
1363
|
+
switch(this.state){
|
|
1364
|
+
case "submit":
|
|
1365
|
+
{
|
|
1366
|
+
const l = this.options.filter(({ value: m })=>u.includes(m)).map((m)=>i(m, "submitted")), a = 0 === l.length ? "" : ` ${l.join(picocolors.dim(", "))}`;
|
|
1367
|
+
return `${o}${picocolors.gray(dist_c)}${a}`;
|
|
1368
|
+
}
|
|
1369
|
+
case "cancel":
|
|
1370
|
+
{
|
|
1371
|
+
const l = this.options.filter(({ value: a })=>u.includes(a)).map((a)=>i(a, "cancelled")).join(picocolors.dim(", "));
|
|
1372
|
+
return `${o}${picocolors.gray(dist_c)} ${l.trim() ? `${l}
|
|
1373
|
+
${picocolors.gray(dist_c)}` : ""}`;
|
|
1374
|
+
}
|
|
1375
|
+
case "error":
|
|
1376
|
+
{
|
|
1377
|
+
const l = this.error.split(`
|
|
1378
|
+
`).map((a, m)=>0 === m ? `${picocolors.yellow(dist_b)} ${picocolors.yellow(a)}` : ` ${a}`).join(`
|
|
1379
|
+
`);
|
|
1380
|
+
return `${o}${picocolors.yellow(dist_c)} ${this.options.map((a, m, E)=>{
|
|
1381
|
+
const y = u.includes(a.value) || !0 === a.group && this.isGroupSelected(`${a.value}`), F = m === this.cursor;
|
|
1382
|
+
return F || "string" != typeof a.group || this.options[this.cursor].value !== a.group ? F && y ? i(a, "active-selected", E) : y ? i(a, "selected", E) : i(a, F ? "active" : "inactive", E) : i(a, y ? "group-active-selected" : "group-active", E);
|
|
1383
|
+
}).join(`
|
|
1384
|
+
${picocolors.yellow(dist_c)} `)}
|
|
1385
|
+
${l}
|
|
1386
|
+
`;
|
|
1387
|
+
}
|
|
1388
|
+
default:
|
|
1389
|
+
{
|
|
1390
|
+
const l = this.options.map((m, E, y)=>{
|
|
1391
|
+
const F = u.includes(m.value) || !0 === m.group && this.isGroupSelected(`${m.value}`), p = E === this.cursor, h = !p && "string" == typeof m.group && this.options[this.cursor].value === m.group;
|
|
1392
|
+
let d = "";
|
|
1393
|
+
return h ? d = i(m, F ? "group-active-selected" : "group-active", y) : p && F ? d = i(m, "active-selected", y) : F ? d = i(m, "selected", y) : d = i(m, p ? "active" : "inactive", y), `${0 !== E && !d.startsWith(`
|
|
1394
|
+
`) ? " " : ""}${d}`;
|
|
1395
|
+
}).join(`
|
|
1396
|
+
${picocolors.cyan(dist_c)}`), a = l.startsWith(`
|
|
1397
|
+
`) ? "" : " ";
|
|
1398
|
+
return `${o}${picocolors.cyan(dist_c)}${a}${l}
|
|
1399
|
+
${picocolors.cyan(dist_b)}
|
|
1400
|
+
`;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}).prompt();
|
|
1405
|
+
}, dist_O = {
|
|
1406
|
+
message: (e = [], { symbol: r = picocolors.gray(dist_c), secondarySymbol: s = picocolors.gray(dist_c), output: i = process.stdout, spacing: n = 1 } = {})=>{
|
|
1407
|
+
const o = [];
|
|
1408
|
+
for(let l = 0; l < n; l++)o.push(`${s}`);
|
|
1409
|
+
const u = Array.isArray(e) ? e : e.split(`
|
|
1410
|
+
`);
|
|
1411
|
+
if (u.length > 0) {
|
|
1412
|
+
const [l, ...a] = u;
|
|
1413
|
+
l.length > 0 ? o.push(`${r} ${l}`) : o.push(r);
|
|
1414
|
+
for (const m of a)m.length > 0 ? o.push(`${s} ${m}`) : o.push(s);
|
|
1415
|
+
}
|
|
1416
|
+
i.write(`${o.join(`
|
|
1417
|
+
`)}
|
|
1418
|
+
`);
|
|
1419
|
+
},
|
|
1420
|
+
info: (e, r)=>{
|
|
1421
|
+
dist_O.message(e, {
|
|
1422
|
+
...r,
|
|
1423
|
+
symbol: picocolors.blue(ue)
|
|
1424
|
+
});
|
|
1425
|
+
},
|
|
1426
|
+
success: (e, r)=>{
|
|
1427
|
+
dist_O.message(e, {
|
|
1428
|
+
...r,
|
|
1429
|
+
symbol: picocolors.green(ce)
|
|
1430
|
+
});
|
|
1431
|
+
},
|
|
1432
|
+
step: (e, r)=>{
|
|
1433
|
+
dist_O.message(e, {
|
|
1434
|
+
...r,
|
|
1435
|
+
symbol: picocolors.green(dist_W)
|
|
1436
|
+
});
|
|
1437
|
+
},
|
|
1438
|
+
warn: (e, r)=>{
|
|
1439
|
+
dist_O.message(e, {
|
|
1440
|
+
...r,
|
|
1441
|
+
symbol: picocolors.yellow($e)
|
|
1442
|
+
});
|
|
1443
|
+
},
|
|
1444
|
+
warning: (e, r)=>{
|
|
1445
|
+
dist_O.warn(e, r);
|
|
1446
|
+
},
|
|
1447
|
+
error: (e, r)=>{
|
|
1448
|
+
dist_O.message(e, {
|
|
1449
|
+
...r,
|
|
1450
|
+
symbol: picocolors.red(de)
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
}, dist_t = (e = "", r)=>{
|
|
1454
|
+
(r?.output ?? process.stdout).write(`${picocolors.gray(dist_b)} ${picocolors.red(e)}
|
|
1455
|
+
|
|
1456
|
+
`);
|
|
1457
|
+
}, dist_Dt = (e = "", r)=>{
|
|
1458
|
+
(r?.output ?? process.stdout).write(`${picocolors.gray(ae)} ${e}
|
|
1459
|
+
`);
|
|
1460
|
+
}, Tt = (e = "", r)=>{
|
|
1461
|
+
(r?.output ?? process.stdout).write(`${picocolors.gray(dist_c)}
|
|
1462
|
+
${picocolors.gray(dist_b)} ${e}
|
|
1463
|
+
|
|
1464
|
+
`);
|
|
1465
|
+
}, Rt = (e)=>{
|
|
1466
|
+
const r = (i, n)=>{
|
|
1467
|
+
const o = i.label ?? String(i.value);
|
|
1468
|
+
return "active" === n ? `${picocolors.cyan(dist_X)} ${o}${i.hint ? ` ${picocolors.dim(`(${i.hint})`)}` : ""}` : "selected" === n ? `${picocolors.green(dist_P)} ${picocolors.dim(o)}${i.hint ? ` ${picocolors.dim(`(${i.hint})`)}` : ""}` : "cancelled" === n ? `${picocolors.strikethrough(picocolors.dim(o))}` : "active-selected" === n ? `${picocolors.green(dist_P)} ${o}${i.hint ? ` ${picocolors.dim(`(${i.hint})`)}` : ""}` : "submitted" === n ? `${picocolors.dim(o)}` : `${picocolors.dim(Y)} ${picocolors.dim(o)}`;
|
|
1469
|
+
}, s = e.required ?? !0;
|
|
1470
|
+
return new kt({
|
|
1471
|
+
options: e.options,
|
|
1472
|
+
signal: e.signal,
|
|
1473
|
+
input: e.input,
|
|
1474
|
+
output: e.output,
|
|
1475
|
+
initialValues: e.initialValues,
|
|
1476
|
+
required: s,
|
|
1477
|
+
cursorAt: e.cursorAt,
|
|
1478
|
+
validate (i) {
|
|
1479
|
+
if (s && (void 0 === i || 0 === i.length)) return `Please select at least one option.
|
|
1480
|
+
${picocolors.reset(picocolors.dim(`Press ${picocolors.gray(picocolors.bgWhite(picocolors.inverse(" space ")))} to select, ${picocolors.gray(picocolors.bgWhite(picocolors.inverse(" enter ")))} to submit`))}`;
|
|
1481
|
+
},
|
|
1482
|
+
render () {
|
|
1483
|
+
const i = `${picocolors.gray(dist_c)}
|
|
1484
|
+
${dist_L(this.state)} ${e.message}
|
|
1485
|
+
`, n = this.value ?? [], o = (u, l)=>{
|
|
1486
|
+
const a = n.includes(u.value);
|
|
1487
|
+
return l && a ? r(u, "active-selected") : a ? r(u, "selected") : r(u, l ? "active" : "inactive");
|
|
1488
|
+
};
|
|
1489
|
+
switch(this.state){
|
|
1490
|
+
case "submit":
|
|
1491
|
+
return `${i}${picocolors.gray(dist_c)} ${this.options.filter(({ value: u })=>n.includes(u)).map((u)=>r(u, "submitted")).join(picocolors.dim(", ")) || picocolors.dim("none")}`;
|
|
1492
|
+
case "cancel":
|
|
1493
|
+
{
|
|
1494
|
+
const u = this.options.filter(({ value: l })=>n.includes(l)).map((l)=>r(l, "cancelled")).join(picocolors.dim(", "));
|
|
1495
|
+
return `${i}${picocolors.gray(dist_c)}${u.trim() ? ` ${u}
|
|
1496
|
+
${picocolors.gray(dist_c)}` : ""}`;
|
|
1497
|
+
}
|
|
1498
|
+
case "error":
|
|
1499
|
+
{
|
|
1500
|
+
const u = this.error.split(`
|
|
1501
|
+
`).map((l, a)=>0 === a ? `${picocolors.yellow(dist_b)} ${picocolors.yellow(l)}` : ` ${l}`).join(`
|
|
1502
|
+
`);
|
|
1503
|
+
return `${i + picocolors.yellow(dist_c)} ${dist_G({
|
|
1504
|
+
output: e.output,
|
|
1505
|
+
options: this.options,
|
|
1506
|
+
cursor: this.cursor,
|
|
1507
|
+
maxItems: e.maxItems,
|
|
1508
|
+
style: o
|
|
1509
|
+
}).join(`
|
|
1510
|
+
${picocolors.yellow(dist_c)} `)}
|
|
1511
|
+
${u}
|
|
1512
|
+
`;
|
|
1513
|
+
}
|
|
1514
|
+
default:
|
|
1515
|
+
return `${i}${picocolors.cyan(dist_c)} ${dist_G({
|
|
1516
|
+
output: e.output,
|
|
1517
|
+
options: this.options,
|
|
1518
|
+
cursor: this.cursor,
|
|
1519
|
+
maxItems: e.maxItems,
|
|
1520
|
+
style: o
|
|
1521
|
+
}).join(`
|
|
1522
|
+
${picocolors.cyan(dist_c)} `)}
|
|
1523
|
+
${picocolors.cyan(dist_b)}
|
|
1524
|
+
`;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}).prompt();
|
|
1528
|
+
}, dist_Mt = (e)=>picocolors.dim(e), Ot = (e, r, s)=>{
|
|
1529
|
+
const i = {
|
|
1530
|
+
hard: !0,
|
|
1531
|
+
trim: !1
|
|
1532
|
+
}, n = dist_k(e, r, i).split(`
|
|
1533
|
+
`), o = n.reduce((a, m)=>Math.max(dist_M(m), a), 0), u = n.map(s).reduce((a, m)=>Math.max(dist_M(m), a), 0), l = r - (u - o);
|
|
1534
|
+
return dist_k(e, l, i);
|
|
1535
|
+
}, Nt = (e = "", r = "", s)=>{
|
|
1536
|
+
const i = s?.output ?? external_node_process_["default"].stdout, n = s?.format ?? dist_Mt, o = [
|
|
1537
|
+
"",
|
|
1538
|
+
...Ot(e, Ct(i) - 6, n).split(`
|
|
1539
|
+
`).map(n),
|
|
1540
|
+
""
|
|
1541
|
+
], u = dist_M(r), l = Math.max(o.reduce((m, E)=>{
|
|
1542
|
+
const y = dist_M(E);
|
|
1543
|
+
return y > m ? y : m;
|
|
1544
|
+
}, 0), u) + 2, a = o.map((m)=>`${picocolors.gray(dist_c)} ${m}${" ".repeat(l - dist_M(m))}${picocolors.gray(dist_c)}`).join(`
|
|
1545
|
+
`);
|
|
1546
|
+
i.write(`${picocolors.gray(dist_c)}
|
|
1547
|
+
${picocolors.green(dist_W)} ${picocolors.reset(r)} ${picocolors.gray(z.repeat(Math.max(l - u - 1, 1)) + oe)}
|
|
1548
|
+
${a}
|
|
1549
|
+
${picocolors.gray(_e + z.repeat(l + 2) + le)}
|
|
1550
|
+
`);
|
|
1551
|
+
}, dist_Lt = (e)=>new yt({
|
|
1552
|
+
validate: e.validate,
|
|
1553
|
+
mask: e.mask ?? be,
|
|
1554
|
+
signal: e.signal,
|
|
1555
|
+
input: e.input,
|
|
1556
|
+
output: e.output,
|
|
1557
|
+
render () {
|
|
1558
|
+
const r = `${picocolors.gray(dist_c)}
|
|
1559
|
+
${dist_L(this.state)} ${e.message}
|
|
1560
|
+
`, s = this.userInputWithCursor, i = this.masked;
|
|
1561
|
+
switch(this.state){
|
|
1562
|
+
case "error":
|
|
1563
|
+
{
|
|
1564
|
+
const n = i ? ` ${i}` : "";
|
|
1565
|
+
return e.clearOnError && this.clear(), `${r.trim()}
|
|
1566
|
+
${picocolors.yellow(dist_c)}${n}
|
|
1567
|
+
${picocolors.yellow(dist_b)} ${picocolors.yellow(this.error)}
|
|
1568
|
+
`;
|
|
1569
|
+
}
|
|
1570
|
+
case "submit":
|
|
1571
|
+
{
|
|
1572
|
+
const n = i ? ` ${picocolors.dim(i)}` : "";
|
|
1573
|
+
return `${r}${picocolors.gray(dist_c)}${n}`;
|
|
1574
|
+
}
|
|
1575
|
+
case "cancel":
|
|
1576
|
+
{
|
|
1577
|
+
const n = i ? ` ${picocolors.strikethrough(picocolors.dim(i))}` : "";
|
|
1578
|
+
return `${r}${picocolors.gray(dist_c)}${n}${i ? `
|
|
1579
|
+
${picocolors.gray(dist_c)}` : ""}`;
|
|
1580
|
+
}
|
|
1581
|
+
default:
|
|
1582
|
+
return `${r}${picocolors.cyan(dist_c)} ${s}
|
|
1583
|
+
${picocolors.cyan(dist_b)}
|
|
1584
|
+
`;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}).prompt(), dist_Wt = (e)=>{
|
|
1588
|
+
const r = e.validate;
|
|
1589
|
+
return ke({
|
|
1590
|
+
...e,
|
|
1591
|
+
initialUserInput: e.initialValue ?? e.root ?? process.cwd(),
|
|
1592
|
+
maxItems: 5,
|
|
1593
|
+
validate (s) {
|
|
1594
|
+
if (!Array.isArray(s)) {
|
|
1595
|
+
if (!s) return "Please select a path";
|
|
1596
|
+
if (r) return r(s);
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
options () {
|
|
1600
|
+
const s = this.userInput;
|
|
1601
|
+
if ("" === s) return [];
|
|
1602
|
+
try {
|
|
1603
|
+
let i;
|
|
1604
|
+
return (0, external_node_fs_.existsSync)(s) ? (0, external_node_fs_.lstatSync)(s).isDirectory() ? i = s : i = (0, external_node_path_.dirname)(s) : i = (0, external_node_path_.dirname)(s), (0, external_node_fs_.readdirSync)(i).map((n)=>{
|
|
1605
|
+
const o = (0, external_node_path_.join)(i, n), u = (0, external_node_fs_.lstatSync)(o);
|
|
1606
|
+
return {
|
|
1607
|
+
name: n,
|
|
1608
|
+
path: o,
|
|
1609
|
+
isDirectory: u.isDirectory()
|
|
1610
|
+
};
|
|
1611
|
+
}).filter(({ path: n, isDirectory: o })=>n.startsWith(s) && (e.directory || !o)).map((n)=>({
|
|
1612
|
+
value: n.path
|
|
1613
|
+
}));
|
|
1614
|
+
} catch {
|
|
1615
|
+
return [];
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
}, Fe = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: n, frames: o = dist_J ? [
|
|
1620
|
+
"\u25D2",
|
|
1621
|
+
"\u25D0",
|
|
1622
|
+
"\u25D3",
|
|
1623
|
+
"\u25D1"
|
|
1624
|
+
] : [
|
|
1625
|
+
"\u2022",
|
|
1626
|
+
"o",
|
|
1627
|
+
"O",
|
|
1628
|
+
"0"
|
|
1629
|
+
], delay: u = dist_J ? 80 : 120, signal: l } = {})=>{
|
|
1630
|
+
const a = re();
|
|
1631
|
+
let m, E, y = !1, F = !1, p = "", h, d = performance.now();
|
|
1632
|
+
const $ = Ct(s), g = (I)=>{
|
|
1633
|
+
const T = I > 1 ? n ?? dist_C.messages.error : i ?? dist_C.messages.cancel;
|
|
1634
|
+
F = 1 === I, y && (D(T, I), F && "function" == typeof r && r());
|
|
1635
|
+
}, f = ()=>g(2), v = ()=>g(1), w = ()=>{
|
|
1636
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", v), process.on("SIGTERM", v), process.on("exit", g), l && l.addEventListener("abort", v);
|
|
1637
|
+
}, B = ()=>{
|
|
1638
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", v), process.removeListener("SIGTERM", v), process.removeListener("exit", g), l && l.removeEventListener("abort", v);
|
|
1639
|
+
}, x = ()=>{
|
|
1640
|
+
if (void 0 === h) return;
|
|
1641
|
+
a && s.write(`
|
|
1642
|
+
`);
|
|
1643
|
+
const I = dist_k(h, $, {
|
|
1644
|
+
hard: !0,
|
|
1645
|
+
trim: !1
|
|
1646
|
+
}).split(`
|
|
1647
|
+
`);
|
|
1648
|
+
I.length > 1 && s.write(src.cursor.up(I.length - 1)), s.write(src.cursor.to(0)), s.write(src.erase.down());
|
|
1649
|
+
}, A = (I)=>I.replace(/\.+$/, ""), C = (I)=>{
|
|
1650
|
+
const T = (performance.now() - I) / 1e3, R = Math.floor(T / 60), V = Math.floor(T % 60);
|
|
1651
|
+
return R > 0 ? `[${R}m ${V}s]` : `[${V}s]`;
|
|
1652
|
+
}, _ = (I = "")=>{
|
|
1653
|
+
y = !0, m = _t({
|
|
1654
|
+
output: s
|
|
1655
|
+
}), p = A(I), d = performance.now(), s.write(`${picocolors.gray(dist_c)}
|
|
1656
|
+
`);
|
|
1657
|
+
let T = 0, R = 0;
|
|
1658
|
+
w(), E = setInterval(()=>{
|
|
1659
|
+
if (a && p === h) return;
|
|
1660
|
+
x(), h = p;
|
|
1661
|
+
const V = picocolors.magenta(o[T]);
|
|
1662
|
+
let q;
|
|
1663
|
+
if (a) q = `${V} ${p}...`;
|
|
1664
|
+
else if ("timer" === e) q = `${V} ${p} ${C(d)}`;
|
|
1665
|
+
else {
|
|
1666
|
+
const qe = ".".repeat(Math.floor(R)).slice(0, 3);
|
|
1667
|
+
q = `${V} ${p}${qe}`;
|
|
1668
|
+
}
|
|
1669
|
+
const Ke = dist_k(q, $, {
|
|
1670
|
+
hard: !0,
|
|
1671
|
+
trim: !1
|
|
1672
|
+
});
|
|
1673
|
+
s.write(Ke), T = T + 1 < o.length ? T + 1 : 0, R = R < 4 ? R + .125 : 0;
|
|
1674
|
+
}, u);
|
|
1675
|
+
}, D = (I = "", T = 0)=>{
|
|
1676
|
+
if (!y) return;
|
|
1677
|
+
y = !1, clearInterval(E), x();
|
|
1678
|
+
const R = 0 === T ? picocolors.green(dist_W) : 1 === T ? picocolors.red(ie) : picocolors.red(ne);
|
|
1679
|
+
p = I ?? p, "timer" === e ? s.write(`${R} ${p} ${C(d)}
|
|
1680
|
+
`) : s.write(`${R} ${p}
|
|
1681
|
+
`), B(), m();
|
|
1682
|
+
};
|
|
1683
|
+
return {
|
|
1684
|
+
start: _,
|
|
1685
|
+
stop: D,
|
|
1686
|
+
message: (I = "")=>{
|
|
1687
|
+
p = A(I ?? p);
|
|
1688
|
+
},
|
|
1689
|
+
get isCancelled () {
|
|
1690
|
+
return F;
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
}, He = {
|
|
1694
|
+
light: dist_S("\u2500", "-"),
|
|
1695
|
+
heavy: dist_S("\u2501", "="),
|
|
1696
|
+
block: dist_S("\u2588", "#")
|
|
1697
|
+
};
|
|
1698
|
+
function Pt({ style: e = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
|
|
1699
|
+
const n = Fe(i);
|
|
1700
|
+
let o = 0, u = "";
|
|
1701
|
+
const l = Math.max(1, r), a = Math.max(1, s), m = (p)=>{
|
|
1702
|
+
switch(p){
|
|
1703
|
+
case "initial":
|
|
1704
|
+
case "active":
|
|
1705
|
+
return picocolors.magenta;
|
|
1706
|
+
case "error":
|
|
1707
|
+
case "cancel":
|
|
1708
|
+
return picocolors.red;
|
|
1709
|
+
case "submit":
|
|
1710
|
+
return picocolors.green;
|
|
1711
|
+
default:
|
|
1712
|
+
return picocolors.magenta;
|
|
1713
|
+
}
|
|
1714
|
+
}, E = (p, h)=>{
|
|
1715
|
+
const d = Math.floor(o / l * a);
|
|
1716
|
+
return `${m(p)(He[e].repeat(d))}${picocolors.dim(He[e].repeat(a - d))} ${h}`;
|
|
1717
|
+
}, y = (p = "")=>{
|
|
1718
|
+
u = p, n.start(E("initial", p));
|
|
1719
|
+
}, F = (p = 1, h)=>{
|
|
1720
|
+
o = Math.min(l, p + o), n.message(E("active", h ?? u)), u = h ?? u;
|
|
1721
|
+
};
|
|
1722
|
+
return {
|
|
1723
|
+
start: y,
|
|
1724
|
+
stop: n.stop,
|
|
1725
|
+
advance: F,
|
|
1726
|
+
isCancelled: n.isCancelled,
|
|
1727
|
+
message: (p)=>F(0, p)
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
const jt = (e)=>{
|
|
1731
|
+
const r = (s, i)=>{
|
|
1732
|
+
const n = s.label ?? String(s.value);
|
|
1733
|
+
switch(i){
|
|
1734
|
+
case "selected":
|
|
1735
|
+
return `${picocolors.dim(n)}`;
|
|
1736
|
+
case "active":
|
|
1737
|
+
return `${picocolors.green(dist_U)} ${n}${s.hint ? ` ${picocolors.dim(`(${s.hint})`)}` : ""}`;
|
|
1738
|
+
case "cancelled":
|
|
1739
|
+
return `${picocolors.strikethrough(picocolors.dim(n))}`;
|
|
1740
|
+
default:
|
|
1741
|
+
return `${picocolors.dim(dist_K)} ${picocolors.dim(n)}`;
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
return new Mt({
|
|
1745
|
+
options: e.options,
|
|
1746
|
+
signal: e.signal,
|
|
1747
|
+
input: e.input,
|
|
1748
|
+
output: e.output,
|
|
1749
|
+
initialValue: e.initialValue,
|
|
1750
|
+
render () {
|
|
1751
|
+
const s = `${picocolors.gray(dist_c)}
|
|
1752
|
+
${dist_L(this.state)} ${e.message}
|
|
1753
|
+
`;
|
|
1754
|
+
switch(this.state){
|
|
1755
|
+
case "submit":
|
|
1756
|
+
return `${s}${picocolors.gray(dist_c)} ${r(this.options[this.cursor], "selected")}`;
|
|
1757
|
+
case "cancel":
|
|
1758
|
+
return `${s}${picocolors.gray(dist_c)} ${r(this.options[this.cursor], "cancelled")}
|
|
1759
|
+
${picocolors.gray(dist_c)}`;
|
|
1760
|
+
default:
|
|
1761
|
+
return `${s}${picocolors.cyan(dist_c)} ${dist_G({
|
|
1762
|
+
output: e.output,
|
|
1763
|
+
cursor: this.cursor,
|
|
1764
|
+
options: this.options,
|
|
1765
|
+
maxItems: e.maxItems,
|
|
1766
|
+
style: (i, n)=>r(i, n ? "active" : "inactive")
|
|
1767
|
+
}).join(`
|
|
1768
|
+
${picocolors.cyan(dist_c)} `)}
|
|
1769
|
+
${picocolors.cyan(dist_b)}
|
|
1770
|
+
`;
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
}).prompt();
|
|
1774
|
+
}, dist_Vt = (e)=>{
|
|
1775
|
+
const r = (s, i = "inactive")=>{
|
|
1776
|
+
const n = s.label ?? String(s.value);
|
|
1777
|
+
return "selected" === i ? `${picocolors.dim(n)}` : "cancelled" === i ? `${picocolors.strikethrough(picocolors.dim(n))}` : "active" === i ? `${picocolors.bgCyan(picocolors.gray(` ${s.value} `))} ${n} ${s.hint ? picocolors.dim(`(${s.hint})`) : ""}` : `${picocolors.gray(picocolors.bgWhite(picocolors.inverse(` ${s.value} `)))} ${n} ${s.hint ? picocolors.dim(`(${s.hint})`) : ""}`;
|
|
1778
|
+
};
|
|
1779
|
+
return new Lt({
|
|
1780
|
+
options: e.options,
|
|
1781
|
+
signal: e.signal,
|
|
1782
|
+
input: e.input,
|
|
1783
|
+
output: e.output,
|
|
1784
|
+
initialValue: e.initialValue,
|
|
1785
|
+
render () {
|
|
1786
|
+
const s = `${picocolors.gray(dist_c)}
|
|
1787
|
+
${dist_L(this.state)} ${e.message}
|
|
1788
|
+
`;
|
|
1789
|
+
switch(this.state){
|
|
1790
|
+
case "submit":
|
|
1791
|
+
return `${s}${picocolors.gray(dist_c)} ${r(this.options.find((i)=>i.value === this.value) ?? e.options[0], "selected")}`;
|
|
1792
|
+
case "cancel":
|
|
1793
|
+
return `${s}${picocolors.gray(dist_c)} ${r(this.options[0], "cancelled")}
|
|
1794
|
+
${picocolors.gray(dist_c)}`;
|
|
1795
|
+
default:
|
|
1796
|
+
return `${s}${picocolors.cyan(dist_c)} ${this.options.map((i, n)=>r(i, n === this.cursor ? "active" : "inactive")).join(`
|
|
1797
|
+
${picocolors.cyan(dist_c)} `)}
|
|
1798
|
+
${picocolors.cyan(dist_b)}
|
|
1799
|
+
`;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}).prompt();
|
|
1803
|
+
}, Ue = `${picocolors.gray(dist_c)} `, dist_j = {
|
|
1804
|
+
message: async (e, { symbol: r = picocolors.gray(dist_c) } = {})=>{
|
|
1805
|
+
process.stdout.write(`${picocolors.gray(dist_c)}
|
|
1806
|
+
${r} `);
|
|
1807
|
+
let s = 3;
|
|
1808
|
+
for await (let i of e){
|
|
1809
|
+
i = i.replace(/\n/g, `
|
|
1810
|
+
${Ue}`), i.includes(`
|
|
1811
|
+
`) && (s = 3 + (0, external_node_util_.stripVTControlCharacters)(i.slice(i.lastIndexOf(`
|
|
1812
|
+
`))).length);
|
|
1813
|
+
const n = (0, external_node_util_.stripVTControlCharacters)(i).length;
|
|
1814
|
+
s + n < process.stdout.columns ? (s += n, process.stdout.write(i)) : (process.stdout.write(`
|
|
1815
|
+
${Ue}${i.trimStart()}`), s = 3 + (0, external_node_util_.stripVTControlCharacters)(i.trimStart()).length);
|
|
1816
|
+
}
|
|
1817
|
+
process.stdout.write(`
|
|
1818
|
+
`);
|
|
1819
|
+
},
|
|
1820
|
+
info: (e)=>dist_j.message(e, {
|
|
1821
|
+
symbol: picocolors.blue(ue)
|
|
1822
|
+
}),
|
|
1823
|
+
success: (e)=>dist_j.message(e, {
|
|
1824
|
+
symbol: picocolors.green(ce)
|
|
1825
|
+
}),
|
|
1826
|
+
step: (e)=>dist_j.message(e, {
|
|
1827
|
+
symbol: picocolors.green(dist_W)
|
|
1828
|
+
}),
|
|
1829
|
+
warn: (e)=>dist_j.message(e, {
|
|
1830
|
+
symbol: picocolors.yellow($e)
|
|
1831
|
+
}),
|
|
1832
|
+
warning: (e)=>dist_j.warn(e),
|
|
1833
|
+
error: (e)=>dist_j.message(e, {
|
|
1834
|
+
symbol: picocolors.red(de)
|
|
1835
|
+
})
|
|
1836
|
+
}, dist_kt = async (e, r)=>{
|
|
1837
|
+
for (const s of e){
|
|
1838
|
+
if (!1 === s.enabled) continue;
|
|
1839
|
+
const i = Fe(r);
|
|
1840
|
+
i.start(s.title);
|
|
1841
|
+
const n = await s.task(i.message);
|
|
1842
|
+
i.stop(n || s.title);
|
|
1843
|
+
}
|
|
1844
|
+
}, Gt = (e)=>{
|
|
1845
|
+
const r = e.output ?? process.stdout, s = Ct(r), i = picocolors.gray(dist_c), n = e.spacing ?? 1, o = 3, u = !0 === e.retainLog, l = !re() && Se(r);
|
|
1846
|
+
r.write(`${i}
|
|
1847
|
+
`), r.write(`${picocolors.green(dist_W)} ${e.title}
|
|
1848
|
+
`);
|
|
1849
|
+
for(let $ = 0; $ < n; $++)r.write(`${i}
|
|
1850
|
+
`);
|
|
1851
|
+
const a = [
|
|
1852
|
+
{
|
|
1853
|
+
value: "",
|
|
1854
|
+
full: ""
|
|
1855
|
+
}
|
|
1856
|
+
];
|
|
1857
|
+
let m = !1;
|
|
1858
|
+
const E = ($)=>{
|
|
1859
|
+
if (0 === a.length) return;
|
|
1860
|
+
let g = 0;
|
|
1861
|
+
$ && (g += n + 2);
|
|
1862
|
+
for (const f of a){
|
|
1863
|
+
const { value: v, result: w } = f;
|
|
1864
|
+
let B = w?.message ?? v;
|
|
1865
|
+
if (0 === B.length) continue;
|
|
1866
|
+
void 0 === w && void 0 !== f.header && "" !== f.header && (B += `
|
|
1867
|
+
${f.header}`);
|
|
1868
|
+
const x = B.split(`
|
|
1869
|
+
`).reduce((A, C)=>"" === C ? A + 1 : A + Math.ceil((C.length + o) / s), 0);
|
|
1870
|
+
g += x;
|
|
1871
|
+
}
|
|
1872
|
+
g > 0 && (g += 1, r.write(src.erase.lines(g)));
|
|
1873
|
+
}, y = ($, g, f)=>{
|
|
1874
|
+
const v = f ? `${$.full}
|
|
1875
|
+
${$.value}` : $.value;
|
|
1876
|
+
void 0 !== $.header && "" !== $.header && dist_O.message($.header.split(`
|
|
1877
|
+
`).map(picocolors.bold), {
|
|
1878
|
+
output: r,
|
|
1879
|
+
secondarySymbol: i,
|
|
1880
|
+
symbol: i,
|
|
1881
|
+
spacing: 0
|
|
1882
|
+
}), dist_O.message(v.split(`
|
|
1883
|
+
`).map(picocolors.dim), {
|
|
1884
|
+
output: r,
|
|
1885
|
+
secondarySymbol: i,
|
|
1886
|
+
symbol: i,
|
|
1887
|
+
spacing: g ?? n
|
|
1888
|
+
});
|
|
1889
|
+
}, F = ()=>{
|
|
1890
|
+
for (const $ of a){
|
|
1891
|
+
const { header: g, value: f, full: v } = $;
|
|
1892
|
+
(void 0 === g || 0 === g.length) && 0 === f.length || y($, void 0, !0 === u && v.length > 0);
|
|
1893
|
+
}
|
|
1894
|
+
}, p = ($, g, f)=>{
|
|
1895
|
+
if (E(!1), f?.raw === !0 && m || "" === $.value || ($.value += `
|
|
1896
|
+
`), $.value += g, m = f?.raw === !0, void 0 !== e.limit) {
|
|
1897
|
+
const v = $.value.split(`
|
|
1898
|
+
`), w = v.length - e.limit;
|
|
1899
|
+
if (w > 0) {
|
|
1900
|
+
const B = v.splice(0, w);
|
|
1901
|
+
u && ($.full += ("" === $.full ? "" : `
|
|
1902
|
+
`) + B.join(`
|
|
1903
|
+
`));
|
|
1904
|
+
}
|
|
1905
|
+
$.value = v.join(`
|
|
1906
|
+
`);
|
|
1907
|
+
}
|
|
1908
|
+
l && h();
|
|
1909
|
+
}, h = ()=>{
|
|
1910
|
+
for (const $ of a)$.result ? "error" === $.result.status ? dist_O.error($.result.message, {
|
|
1911
|
+
output: r,
|
|
1912
|
+
secondarySymbol: i,
|
|
1913
|
+
spacing: 0
|
|
1914
|
+
}) : dist_O.success($.result.message, {
|
|
1915
|
+
output: r,
|
|
1916
|
+
secondarySymbol: i,
|
|
1917
|
+
spacing: 0
|
|
1918
|
+
}) : "" !== $.value && y($, 0);
|
|
1919
|
+
}, d = ($, g)=>{
|
|
1920
|
+
E(!1), $.result = g, l && h();
|
|
1921
|
+
};
|
|
1922
|
+
return {
|
|
1923
|
+
message ($, g) {
|
|
1924
|
+
p(a[0], $, g);
|
|
1925
|
+
},
|
|
1926
|
+
group ($) {
|
|
1927
|
+
const g = {
|
|
1928
|
+
header: $,
|
|
1929
|
+
value: "",
|
|
1930
|
+
full: ""
|
|
1931
|
+
};
|
|
1932
|
+
return a.push(g), {
|
|
1933
|
+
message (f, v) {
|
|
1934
|
+
p(g, f, v);
|
|
1935
|
+
},
|
|
1936
|
+
error (f) {
|
|
1937
|
+
d(g, {
|
|
1938
|
+
status: "error",
|
|
1939
|
+
message: f
|
|
1940
|
+
});
|
|
1941
|
+
},
|
|
1942
|
+
success (f) {
|
|
1943
|
+
d(g, {
|
|
1944
|
+
status: "success",
|
|
1945
|
+
message: f
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
1949
|
+
},
|
|
1950
|
+
error ($, g) {
|
|
1951
|
+
E(!0), dist_O.error($, {
|
|
1952
|
+
output: r,
|
|
1953
|
+
secondarySymbol: i,
|
|
1954
|
+
spacing: 1
|
|
1955
|
+
}), g?.showLog !== !1 && F(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1956
|
+
},
|
|
1957
|
+
success ($, g) {
|
|
1958
|
+
E(!0), dist_O.success($, {
|
|
1959
|
+
output: r,
|
|
1960
|
+
secondarySymbol: i,
|
|
1961
|
+
spacing: 1
|
|
1962
|
+
}), g?.showLog === !0 && F(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1965
|
+
}, Ht = (e)=>new Wt({
|
|
1966
|
+
validate: e.validate,
|
|
1967
|
+
placeholder: e.placeholder,
|
|
1968
|
+
defaultValue: e.defaultValue,
|
|
1969
|
+
initialValue: e.initialValue,
|
|
1970
|
+
output: e.output,
|
|
1971
|
+
signal: e.signal,
|
|
1972
|
+
input: e.input,
|
|
1973
|
+
render () {
|
|
1974
|
+
const r = `${picocolors.gray(dist_c)}
|
|
1975
|
+
${dist_L(this.state)} ${e.message}
|
|
1976
|
+
`, s = e.placeholder ? picocolors.inverse(e.placeholder[0]) + picocolors.dim(e.placeholder.slice(1)) : picocolors.inverse(picocolors.hidden("_")), i = this.userInput ? this.userInputWithCursor : s, n = this.value ?? "";
|
|
1977
|
+
switch(this.state){
|
|
1978
|
+
case "error":
|
|
1979
|
+
{
|
|
1980
|
+
const o = this.error ? ` ${picocolors.yellow(this.error)}` : "";
|
|
1981
|
+
return `${r.trim()}
|
|
1982
|
+
${picocolors.yellow(dist_c)} ${i}
|
|
1983
|
+
${picocolors.yellow(dist_b)}${o}
|
|
1984
|
+
`;
|
|
1985
|
+
}
|
|
1986
|
+
case "submit":
|
|
1987
|
+
{
|
|
1988
|
+
const o = n ? ` ${picocolors.dim(n)}` : "";
|
|
1989
|
+
return `${r}${picocolors.gray(dist_c)}${o}`;
|
|
1990
|
+
}
|
|
1991
|
+
case "cancel":
|
|
1992
|
+
{
|
|
1993
|
+
const o = n ? ` ${picocolors.strikethrough(picocolors.dim(n))}` : "";
|
|
1994
|
+
return `${r}${picocolors.gray(dist_c)}${o}${n.trim() ? `
|
|
1995
|
+
${picocolors.gray(dist_c)}` : ""}`;
|
|
1996
|
+
}
|
|
1997
|
+
default:
|
|
1998
|
+
return `${r}${picocolors.cyan(dist_c)} ${i}
|
|
1999
|
+
${picocolors.cyan(dist_b)}
|
|
2000
|
+
`;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}).prompt();
|
|
2004
|
+
}
|
|
2005
|
+
};
|