@uipath/cli 1.205.0-preview.276 → 1.206.0-preview.279
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/dist/{applicationinsights-s28k1t0d.js → applicationinsights-pwe8sf3y.js} +1269 -1269
- package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-p5fhwxqj.js} +6 -7
- package/dist/cli-q6fp9ccp.js +23 -0
- package/dist/contentStore-c51xqdn2.js +41 -0
- package/dist/environmentInfo-fn0za9jw.js +71 -0
- package/dist/feedbackPrompts-t1enxv1x.js +144 -0
- package/dist/handlers-93z27zrr.js +805 -0
- package/dist/index-16d4evd1.js +1051 -0
- package/dist/index-1vyte4ma.js +14 -0
- package/dist/index-21kns9qg.js +10 -0
- package/dist/{index-yhj4pgvt.js → index-2j7ss97f.js} +331 -2595
- package/dist/index-2k8rhmad.js +274 -0
- package/dist/{index-30618bjs.js → index-2mm750yx.js} +174 -234
- package/dist/{index-622x1qb5.js → index-3fvbddpw.js} +7092 -7092
- package/dist/{index-d3w0wn6k.js → index-5gce5wfd.js} +16 -16
- package/dist/index-5j0bfd3e.js +4744 -0
- package/dist/index-68xmrb9x.js +237 -0
- package/dist/index-6wj58qka.js +59 -0
- package/dist/index-898c4tfz.js +668 -0
- package/dist/index-8gr7ny79.js +365 -0
- package/dist/index-99emfvtm.js +13 -0
- package/dist/{index-pj3g8ftz.js → index-9db5vwx9.js} +2429 -1693
- package/dist/index-ayg25v46.js +151 -0
- package/dist/index-bf0e4evz.js +6180 -0
- package/dist/index-bpqx6f8h.js +92 -0
- package/dist/index-bpxh3fqv.js +392 -0
- package/dist/index-cc653qc1.js +1327 -0
- package/dist/{index-m5nwse9v.js → index-cj4v0jct.js} +21 -69
- package/dist/{index-469jgr1w.js → index-dsj3jrm0.js} +105 -106
- package/dist/{index-1yh8g550.js → index-epsr41wx.js} +8 -12
- package/dist/{index-yb4er9vd.js → index-jjejkkg4.js} +474 -528
- package/dist/index-kg1xrq51.js +171 -0
- package/dist/index-m8vqyv3g.js +72 -0
- package/dist/index-mzqm6xfh.js +45 -0
- package/dist/index-nsrrst23.js +44 -0
- package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
- package/dist/index-p9s0gyrw.js +72 -0
- package/dist/index-qadhm1gn.js +271 -0
- package/dist/index-qwbyt2q5.js +95 -0
- package/dist/index-rbna3w6k.js +200 -0
- package/dist/index-rr5hdtcy.js +95 -0
- package/dist/{index-qa9gftnj.js → index-xd2w5pct.js} +3 -3
- package/dist/index-xpdtagqw.js +30 -0
- package/dist/{index-925304r7.js → index-y085rpen.js} +29 -25
- package/dist/index-y5ncb93a.js +240 -0
- package/dist/index-y7d0cth0.js +93 -0
- package/dist/{index-hdxtgckw.js → index-z070caqq.js} +56 -12
- package/dist/index-zdqbp34f.js +14 -0
- package/dist/index.js +38 -36
- package/dist/install-3gw33jcf.js +558 -0
- package/dist/{jmespath-e4a59c8w.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/js-yaml-0c4svjwq.js +36 -0
- package/dist/{mcp-jssaz3wr.js → mcp-s50h6d56.js} +236 -472
- package/dist/{node-strategy-ggx3nmyj.js → node-strategy-p1n8wr5s.js} +16 -19
- package/dist/project-context-285hydnd.js +94 -0
- package/dist/prompt-hxbzt92e.js +13 -0
- package/dist/{server-nfjr7xrb.js → server-gkr3c7hv.js} +28 -43
- package/dist/skillCatalog-fvw4wgw1.js +22 -0
- package/dist/skillsService-20es18vs.js +29 -0
- package/dist/{stdio-tmngemcz.js → stdio-kpsab5bz.js} +2 -4
- package/dist/{telemetry-drain-r92f0e4r.js → telemetry-drain-bw59e8f5.js} +8 -9
- package/dist/tree-j4w7p0pg.js +17 -0
- package/dist/updateService-pq7pkd42.js +522 -0
- package/dist/updateService.skills-4t1s7z45.js +22 -0
- package/dist/updateService.tools-f7tr6kc6.js +16 -0
- package/package.json +2 -2
- package/dist/cli-r7998zeh.js +0 -19
- package/dist/index-0gctz400.js +0 -17
- package/dist/index-2dp7m4r8.js +0 -9867
- package/dist/index-4cq44eth.js +0 -19427
- package/dist/index-7tshyfxx.js +0 -157
- package/dist/index-g8ck9tv6.js +0 -2
- package/dist/index-ngs0a2he.js +0 -15
- package/dist/index-yc4kw997.js +0 -13
- package/dist/js-yaml-69tsdrrf.js +0 -37
- package/dist/updateService-nrmb1tsc.js +0 -14
|
@@ -0,0 +1,4744 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__toESM,
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require
|
|
5
|
+
} from "./index-epsr41wx.js";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/cli-width/index.js
|
|
8
|
+
var require_cli_width = __commonJS(function(exports, module) {
|
|
9
|
+
module.exports = cliWidth;
|
|
10
|
+
function normalizeOpts(options) {
|
|
11
|
+
const defaultOpts = {
|
|
12
|
+
defaultWidth: 0,
|
|
13
|
+
output: process.stdout,
|
|
14
|
+
tty: __require("tty")
|
|
15
|
+
};
|
|
16
|
+
if (!options) {
|
|
17
|
+
return defaultOpts;
|
|
18
|
+
}
|
|
19
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
20
|
+
if (!options[key]) {
|
|
21
|
+
options[key] = defaultOpts[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return options;
|
|
25
|
+
}
|
|
26
|
+
function cliWidth(options) {
|
|
27
|
+
const opts = normalizeOpts(options);
|
|
28
|
+
if (opts.output.getWindowSize) {
|
|
29
|
+
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
30
|
+
}
|
|
31
|
+
if (opts.tty.getWindowSize) {
|
|
32
|
+
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
33
|
+
}
|
|
34
|
+
if (opts.output.columns) {
|
|
35
|
+
return opts.output.columns;
|
|
36
|
+
}
|
|
37
|
+
if (process.env.CLI_WIDTH) {
|
|
38
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
39
|
+
if (!isNaN(width) && width !== 0) {
|
|
40
|
+
return width;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return opts.defaultWidth;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
48
|
+
var require_lib = __commonJS(function(exports, module) {
|
|
49
|
+
var Stream = __require("stream");
|
|
50
|
+
|
|
51
|
+
class MuteStream extends Stream {
|
|
52
|
+
#isTTY = null;
|
|
53
|
+
constructor(opts = {}) {
|
|
54
|
+
super(opts);
|
|
55
|
+
this.writable = this.readable = true;
|
|
56
|
+
this.muted = false;
|
|
57
|
+
this.on("pipe", this._onpipe);
|
|
58
|
+
this.replace = opts.replace;
|
|
59
|
+
this._prompt = opts.prompt || null;
|
|
60
|
+
this._hadControl = false;
|
|
61
|
+
}
|
|
62
|
+
#destSrc(key, def) {
|
|
63
|
+
if (this._dest) {
|
|
64
|
+
return this._dest[key];
|
|
65
|
+
}
|
|
66
|
+
if (this._src) {
|
|
67
|
+
return this._src[key];
|
|
68
|
+
}
|
|
69
|
+
return def;
|
|
70
|
+
}
|
|
71
|
+
#proxy(method, ...args) {
|
|
72
|
+
if (typeof this._dest?.[method] === "function") {
|
|
73
|
+
this._dest[method](...args);
|
|
74
|
+
}
|
|
75
|
+
if (typeof this._src?.[method] === "function") {
|
|
76
|
+
this._src[method](...args);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
get isTTY() {
|
|
80
|
+
if (this.#isTTY !== null) {
|
|
81
|
+
return this.#isTTY;
|
|
82
|
+
}
|
|
83
|
+
return this.#destSrc("isTTY", false);
|
|
84
|
+
}
|
|
85
|
+
set isTTY(val) {
|
|
86
|
+
this.#isTTY = val;
|
|
87
|
+
}
|
|
88
|
+
get rows() {
|
|
89
|
+
return this.#destSrc("rows");
|
|
90
|
+
}
|
|
91
|
+
get columns() {
|
|
92
|
+
return this.#destSrc("columns");
|
|
93
|
+
}
|
|
94
|
+
mute() {
|
|
95
|
+
this.muted = true;
|
|
96
|
+
}
|
|
97
|
+
unmute() {
|
|
98
|
+
this.muted = false;
|
|
99
|
+
}
|
|
100
|
+
_onpipe(src) {
|
|
101
|
+
this._src = src;
|
|
102
|
+
}
|
|
103
|
+
pipe(dest, options) {
|
|
104
|
+
this._dest = dest;
|
|
105
|
+
return super.pipe(dest, options);
|
|
106
|
+
}
|
|
107
|
+
pause() {
|
|
108
|
+
if (this._src) {
|
|
109
|
+
return this._src.pause();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
resume() {
|
|
113
|
+
if (this._src) {
|
|
114
|
+
return this._src.resume();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
write(c) {
|
|
118
|
+
if (this.muted) {
|
|
119
|
+
if (!this.replace) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (c.match(/^\u001b/)) {
|
|
123
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
124
|
+
c = c.slice(this._prompt.length);
|
|
125
|
+
c = c.replace(/./g, this.replace);
|
|
126
|
+
c = this._prompt + c;
|
|
127
|
+
}
|
|
128
|
+
this._hadControl = true;
|
|
129
|
+
return this.emit("data", c);
|
|
130
|
+
} else {
|
|
131
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
132
|
+
this._hadControl = false;
|
|
133
|
+
this.emit("data", this._prompt);
|
|
134
|
+
c = c.slice(this._prompt.length);
|
|
135
|
+
}
|
|
136
|
+
c = c.toString().replace(/./g, this.replace);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
this.emit("data", c);
|
|
140
|
+
}
|
|
141
|
+
end(c) {
|
|
142
|
+
if (this.muted) {
|
|
143
|
+
if (c && this.replace) {
|
|
144
|
+
c = c.toString().replace(/./g, this.replace);
|
|
145
|
+
} else {
|
|
146
|
+
c = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (c) {
|
|
150
|
+
this.emit("data", c);
|
|
151
|
+
}
|
|
152
|
+
this.emit("end");
|
|
153
|
+
}
|
|
154
|
+
destroy(...args) {
|
|
155
|
+
return this.#proxy("destroy", ...args);
|
|
156
|
+
}
|
|
157
|
+
destroySoon(...args) {
|
|
158
|
+
return this.#proxy("destroySoon", ...args);
|
|
159
|
+
}
|
|
160
|
+
close(...args) {
|
|
161
|
+
return this.#proxy("close", ...args);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
module.exports = MuteStream;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
168
|
+
var require_lib2 = __commonJS(function(exports, module) {
|
|
169
|
+
var Stream = __require("stream");
|
|
170
|
+
|
|
171
|
+
class MuteStream extends Stream {
|
|
172
|
+
#isTTY = null;
|
|
173
|
+
constructor(opts = {}) {
|
|
174
|
+
super(opts);
|
|
175
|
+
this.writable = this.readable = true;
|
|
176
|
+
this.muted = false;
|
|
177
|
+
this.on("pipe", this._onpipe);
|
|
178
|
+
this.replace = opts.replace;
|
|
179
|
+
this._prompt = opts.prompt || null;
|
|
180
|
+
this._hadControl = false;
|
|
181
|
+
}
|
|
182
|
+
#destSrc(key, def) {
|
|
183
|
+
if (this._dest) {
|
|
184
|
+
return this._dest[key];
|
|
185
|
+
}
|
|
186
|
+
if (this._src) {
|
|
187
|
+
return this._src[key];
|
|
188
|
+
}
|
|
189
|
+
return def;
|
|
190
|
+
}
|
|
191
|
+
#proxy(method, ...args) {
|
|
192
|
+
if (typeof this._dest?.[method] === "function") {
|
|
193
|
+
this._dest[method](...args);
|
|
194
|
+
}
|
|
195
|
+
if (typeof this._src?.[method] === "function") {
|
|
196
|
+
this._src[method](...args);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
get isTTY() {
|
|
200
|
+
if (this.#isTTY !== null) {
|
|
201
|
+
return this.#isTTY;
|
|
202
|
+
}
|
|
203
|
+
return this.#destSrc("isTTY", false);
|
|
204
|
+
}
|
|
205
|
+
set isTTY(val) {
|
|
206
|
+
this.#isTTY = val;
|
|
207
|
+
}
|
|
208
|
+
get rows() {
|
|
209
|
+
return this.#destSrc("rows");
|
|
210
|
+
}
|
|
211
|
+
get columns() {
|
|
212
|
+
return this.#destSrc("columns");
|
|
213
|
+
}
|
|
214
|
+
mute() {
|
|
215
|
+
this.muted = true;
|
|
216
|
+
}
|
|
217
|
+
unmute() {
|
|
218
|
+
this.muted = false;
|
|
219
|
+
}
|
|
220
|
+
_onpipe(src) {
|
|
221
|
+
this._src = src;
|
|
222
|
+
}
|
|
223
|
+
pipe(dest, options) {
|
|
224
|
+
this._dest = dest;
|
|
225
|
+
return super.pipe(dest, options);
|
|
226
|
+
}
|
|
227
|
+
pause() {
|
|
228
|
+
if (this._src) {
|
|
229
|
+
return this._src.pause();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
resume() {
|
|
233
|
+
if (this._src) {
|
|
234
|
+
return this._src.resume();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
write(c) {
|
|
238
|
+
if (this.muted) {
|
|
239
|
+
if (!this.replace) {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
if (c.match(/^\u001b/)) {
|
|
243
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
244
|
+
c = c.slice(this._prompt.length);
|
|
245
|
+
c = c.replace(/./g, this.replace);
|
|
246
|
+
c = this._prompt + c;
|
|
247
|
+
}
|
|
248
|
+
this._hadControl = true;
|
|
249
|
+
return this.emit("data", c);
|
|
250
|
+
} else {
|
|
251
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
252
|
+
this._hadControl = false;
|
|
253
|
+
this.emit("data", this._prompt);
|
|
254
|
+
c = c.slice(this._prompt.length);
|
|
255
|
+
}
|
|
256
|
+
c = c.toString().replace(/./g, this.replace);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
this.emit("data", c);
|
|
260
|
+
}
|
|
261
|
+
end(c) {
|
|
262
|
+
if (this.muted) {
|
|
263
|
+
if (c && this.replace) {
|
|
264
|
+
c = c.toString().replace(/./g, this.replace);
|
|
265
|
+
} else {
|
|
266
|
+
c = null;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (c) {
|
|
270
|
+
this.emit("data", c);
|
|
271
|
+
}
|
|
272
|
+
this.emit("end");
|
|
273
|
+
}
|
|
274
|
+
destroy(...args) {
|
|
275
|
+
return this.#proxy("destroy", ...args);
|
|
276
|
+
}
|
|
277
|
+
destroySoon(...args) {
|
|
278
|
+
return this.#proxy("destroySoon", ...args);
|
|
279
|
+
}
|
|
280
|
+
close(...args) {
|
|
281
|
+
return this.#proxy("close", ...args);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
module.exports = MuteStream;
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
288
|
+
var require_lib3 = __commonJS(function(exports, module) {
|
|
289
|
+
var Stream = __require("stream");
|
|
290
|
+
|
|
291
|
+
class MuteStream extends Stream {
|
|
292
|
+
#isTTY = null;
|
|
293
|
+
constructor(opts = {}) {
|
|
294
|
+
super(opts);
|
|
295
|
+
this.writable = this.readable = true;
|
|
296
|
+
this.muted = false;
|
|
297
|
+
this.on("pipe", this._onpipe);
|
|
298
|
+
this.replace = opts.replace;
|
|
299
|
+
this._prompt = opts.prompt || null;
|
|
300
|
+
this._hadControl = false;
|
|
301
|
+
}
|
|
302
|
+
#destSrc(key, def) {
|
|
303
|
+
if (this._dest) {
|
|
304
|
+
return this._dest[key];
|
|
305
|
+
}
|
|
306
|
+
if (this._src) {
|
|
307
|
+
return this._src[key];
|
|
308
|
+
}
|
|
309
|
+
return def;
|
|
310
|
+
}
|
|
311
|
+
#proxy(method, ...args) {
|
|
312
|
+
if (typeof this._dest?.[method] === "function") {
|
|
313
|
+
this._dest[method](...args);
|
|
314
|
+
}
|
|
315
|
+
if (typeof this._src?.[method] === "function") {
|
|
316
|
+
this._src[method](...args);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
get isTTY() {
|
|
320
|
+
if (this.#isTTY !== null) {
|
|
321
|
+
return this.#isTTY;
|
|
322
|
+
}
|
|
323
|
+
return this.#destSrc("isTTY", false);
|
|
324
|
+
}
|
|
325
|
+
set isTTY(val) {
|
|
326
|
+
this.#isTTY = val;
|
|
327
|
+
}
|
|
328
|
+
get rows() {
|
|
329
|
+
return this.#destSrc("rows");
|
|
330
|
+
}
|
|
331
|
+
get columns() {
|
|
332
|
+
return this.#destSrc("columns");
|
|
333
|
+
}
|
|
334
|
+
mute() {
|
|
335
|
+
this.muted = true;
|
|
336
|
+
}
|
|
337
|
+
unmute() {
|
|
338
|
+
this.muted = false;
|
|
339
|
+
}
|
|
340
|
+
_onpipe(src) {
|
|
341
|
+
this._src = src;
|
|
342
|
+
}
|
|
343
|
+
pipe(dest, options) {
|
|
344
|
+
this._dest = dest;
|
|
345
|
+
return super.pipe(dest, options);
|
|
346
|
+
}
|
|
347
|
+
pause() {
|
|
348
|
+
if (this._src) {
|
|
349
|
+
return this._src.pause();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
resume() {
|
|
353
|
+
if (this._src) {
|
|
354
|
+
return this._src.resume();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
write(c) {
|
|
358
|
+
if (this.muted) {
|
|
359
|
+
if (!this.replace) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
if (c.match(/^\u001b/)) {
|
|
363
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
364
|
+
c = c.slice(this._prompt.length);
|
|
365
|
+
c = c.replace(/./g, this.replace);
|
|
366
|
+
c = this._prompt + c;
|
|
367
|
+
}
|
|
368
|
+
this._hadControl = true;
|
|
369
|
+
return this.emit("data", c);
|
|
370
|
+
} else {
|
|
371
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
372
|
+
this._hadControl = false;
|
|
373
|
+
this.emit("data", this._prompt);
|
|
374
|
+
c = c.slice(this._prompt.length);
|
|
375
|
+
}
|
|
376
|
+
c = c.toString().replace(/./g, this.replace);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
this.emit("data", c);
|
|
380
|
+
}
|
|
381
|
+
end(c) {
|
|
382
|
+
if (this.muted) {
|
|
383
|
+
if (c && this.replace) {
|
|
384
|
+
c = c.toString().replace(/./g, this.replace);
|
|
385
|
+
} else {
|
|
386
|
+
c = null;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (c) {
|
|
390
|
+
this.emit("data", c);
|
|
391
|
+
}
|
|
392
|
+
this.emit("end");
|
|
393
|
+
}
|
|
394
|
+
destroy(...args) {
|
|
395
|
+
return this.#proxy("destroy", ...args);
|
|
396
|
+
}
|
|
397
|
+
destroySoon(...args) {
|
|
398
|
+
return this.#proxy("destroySoon", ...args);
|
|
399
|
+
}
|
|
400
|
+
close(...args) {
|
|
401
|
+
return this.#proxy("close", ...args);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
module.exports = MuteStream;
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
408
|
+
var require_lib4 = __commonJS(function(exports, module) {
|
|
409
|
+
var Stream = __require("stream");
|
|
410
|
+
|
|
411
|
+
class MuteStream extends Stream {
|
|
412
|
+
#isTTY = null;
|
|
413
|
+
constructor(opts = {}) {
|
|
414
|
+
super(opts);
|
|
415
|
+
this.writable = this.readable = true;
|
|
416
|
+
this.muted = false;
|
|
417
|
+
this.on("pipe", this._onpipe);
|
|
418
|
+
this.replace = opts.replace;
|
|
419
|
+
this._prompt = opts.prompt || null;
|
|
420
|
+
this._hadControl = false;
|
|
421
|
+
}
|
|
422
|
+
#destSrc(key, def) {
|
|
423
|
+
if (this._dest) {
|
|
424
|
+
return this._dest[key];
|
|
425
|
+
}
|
|
426
|
+
if (this._src) {
|
|
427
|
+
return this._src[key];
|
|
428
|
+
}
|
|
429
|
+
return def;
|
|
430
|
+
}
|
|
431
|
+
#proxy(method, ...args) {
|
|
432
|
+
if (typeof this._dest?.[method] === "function") {
|
|
433
|
+
this._dest[method](...args);
|
|
434
|
+
}
|
|
435
|
+
if (typeof this._src?.[method] === "function") {
|
|
436
|
+
this._src[method](...args);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
get isTTY() {
|
|
440
|
+
if (this.#isTTY !== null) {
|
|
441
|
+
return this.#isTTY;
|
|
442
|
+
}
|
|
443
|
+
return this.#destSrc("isTTY", false);
|
|
444
|
+
}
|
|
445
|
+
set isTTY(val) {
|
|
446
|
+
this.#isTTY = val;
|
|
447
|
+
}
|
|
448
|
+
get rows() {
|
|
449
|
+
return this.#destSrc("rows");
|
|
450
|
+
}
|
|
451
|
+
get columns() {
|
|
452
|
+
return this.#destSrc("columns");
|
|
453
|
+
}
|
|
454
|
+
mute() {
|
|
455
|
+
this.muted = true;
|
|
456
|
+
}
|
|
457
|
+
unmute() {
|
|
458
|
+
this.muted = false;
|
|
459
|
+
}
|
|
460
|
+
_onpipe(src) {
|
|
461
|
+
this._src = src;
|
|
462
|
+
}
|
|
463
|
+
pipe(dest, options) {
|
|
464
|
+
this._dest = dest;
|
|
465
|
+
return super.pipe(dest, options);
|
|
466
|
+
}
|
|
467
|
+
pause() {
|
|
468
|
+
if (this._src) {
|
|
469
|
+
return this._src.pause();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
resume() {
|
|
473
|
+
if (this._src) {
|
|
474
|
+
return this._src.resume();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
write(c) {
|
|
478
|
+
if (this.muted) {
|
|
479
|
+
if (!this.replace) {
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
if (c.match(/^\u001b/)) {
|
|
483
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
484
|
+
c = c.slice(this._prompt.length);
|
|
485
|
+
c = c.replace(/./g, this.replace);
|
|
486
|
+
c = this._prompt + c;
|
|
487
|
+
}
|
|
488
|
+
this._hadControl = true;
|
|
489
|
+
return this.emit("data", c);
|
|
490
|
+
} else {
|
|
491
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
492
|
+
this._hadControl = false;
|
|
493
|
+
this.emit("data", this._prompt);
|
|
494
|
+
c = c.slice(this._prompt.length);
|
|
495
|
+
}
|
|
496
|
+
c = c.toString().replace(/./g, this.replace);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
this.emit("data", c);
|
|
500
|
+
}
|
|
501
|
+
end(c) {
|
|
502
|
+
if (this.muted) {
|
|
503
|
+
if (c && this.replace) {
|
|
504
|
+
c = c.toString().replace(/./g, this.replace);
|
|
505
|
+
} else {
|
|
506
|
+
c = null;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (c) {
|
|
510
|
+
this.emit("data", c);
|
|
511
|
+
}
|
|
512
|
+
this.emit("end");
|
|
513
|
+
}
|
|
514
|
+
destroy(...args) {
|
|
515
|
+
return this.#proxy("destroy", ...args);
|
|
516
|
+
}
|
|
517
|
+
destroySoon(...args) {
|
|
518
|
+
return this.#proxy("destroySoon", ...args);
|
|
519
|
+
}
|
|
520
|
+
close(...args) {
|
|
521
|
+
return this.#proxy("close", ...args);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
module.exports = MuteStream;
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/key.js
|
|
528
|
+
var keybindings = ["emacs", "vim"];
|
|
529
|
+
var keybindingLookup = new Set(keybindings);
|
|
530
|
+
function isKeybinding(value) {
|
|
531
|
+
return keybindingLookup.has(value);
|
|
532
|
+
}
|
|
533
|
+
function getDefaultKeybindings() {
|
|
534
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
535
|
+
if (!env)
|
|
536
|
+
return [];
|
|
537
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding)));
|
|
538
|
+
}
|
|
539
|
+
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
540
|
+
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
541
|
+
var isSpaceKey = (key) => key.name === "space";
|
|
542
|
+
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
543
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
544
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/errors.js
|
|
545
|
+
class AbortPromptError extends Error {
|
|
546
|
+
name = "AbortPromptError";
|
|
547
|
+
message = "Prompt was aborted";
|
|
548
|
+
constructor(options) {
|
|
549
|
+
super();
|
|
550
|
+
this.cause = options?.cause;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
class CancelPromptError extends Error {
|
|
555
|
+
name = "CancelPromptError";
|
|
556
|
+
message = "Prompt was canceled";
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
class ExitPromptError extends Error {
|
|
560
|
+
name = "ExitPromptError";
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
class HookError extends Error {
|
|
564
|
+
name = "HookError";
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
class ValidationError extends Error {
|
|
568
|
+
name = "ValidationError";
|
|
569
|
+
}
|
|
570
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
571
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
572
|
+
|
|
573
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
574
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
575
|
+
var hookStorage = new AsyncLocalStorage;
|
|
576
|
+
function createStore(rl) {
|
|
577
|
+
const store = {
|
|
578
|
+
rl,
|
|
579
|
+
hooks: [],
|
|
580
|
+
hooksCleanup: [],
|
|
581
|
+
hooksEffect: [],
|
|
582
|
+
index: 0,
|
|
583
|
+
handleChange() {}
|
|
584
|
+
};
|
|
585
|
+
return store;
|
|
586
|
+
}
|
|
587
|
+
function withHooks(rl, cb) {
|
|
588
|
+
const store = createStore(rl);
|
|
589
|
+
return hookStorage.run(store, () => {
|
|
590
|
+
function cycle(render) {
|
|
591
|
+
store.handleChange = () => {
|
|
592
|
+
store.index = 0;
|
|
593
|
+
render();
|
|
594
|
+
};
|
|
595
|
+
store.handleChange();
|
|
596
|
+
}
|
|
597
|
+
return cb(cycle);
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
function getStore() {
|
|
601
|
+
const store = hookStorage.getStore();
|
|
602
|
+
if (!store) {
|
|
603
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
604
|
+
}
|
|
605
|
+
return store;
|
|
606
|
+
}
|
|
607
|
+
function readline() {
|
|
608
|
+
return getStore().rl;
|
|
609
|
+
}
|
|
610
|
+
function withUpdates(fn) {
|
|
611
|
+
const wrapped = (...args) => {
|
|
612
|
+
const store = getStore();
|
|
613
|
+
let shouldUpdate = false;
|
|
614
|
+
const oldHandleChange = store.handleChange;
|
|
615
|
+
store.handleChange = () => {
|
|
616
|
+
shouldUpdate = true;
|
|
617
|
+
};
|
|
618
|
+
const returnValue = fn(...args);
|
|
619
|
+
if (shouldUpdate) {
|
|
620
|
+
oldHandleChange();
|
|
621
|
+
}
|
|
622
|
+
store.handleChange = oldHandleChange;
|
|
623
|
+
return returnValue;
|
|
624
|
+
};
|
|
625
|
+
return AsyncResource.bind(wrapped);
|
|
626
|
+
}
|
|
627
|
+
function withPointer(cb) {
|
|
628
|
+
const store = getStore();
|
|
629
|
+
const { index } = store;
|
|
630
|
+
const pointer = {
|
|
631
|
+
get() {
|
|
632
|
+
return store.hooks[index];
|
|
633
|
+
},
|
|
634
|
+
set(value) {
|
|
635
|
+
store.hooks[index] = value;
|
|
636
|
+
},
|
|
637
|
+
initialized: index in store.hooks
|
|
638
|
+
};
|
|
639
|
+
const returnValue = cb(pointer);
|
|
640
|
+
store.index++;
|
|
641
|
+
return returnValue;
|
|
642
|
+
}
|
|
643
|
+
function handleChange() {
|
|
644
|
+
getStore().handleChange();
|
|
645
|
+
}
|
|
646
|
+
var effectScheduler = {
|
|
647
|
+
queue(cb) {
|
|
648
|
+
const store = getStore();
|
|
649
|
+
const { index } = store;
|
|
650
|
+
store.hooksEffect.push(() => {
|
|
651
|
+
store.hooksCleanup[index]?.();
|
|
652
|
+
const cleanFn = cb(readline());
|
|
653
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
654
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
655
|
+
}
|
|
656
|
+
store.hooksCleanup[index] = cleanFn;
|
|
657
|
+
});
|
|
658
|
+
},
|
|
659
|
+
run() {
|
|
660
|
+
const store = getStore();
|
|
661
|
+
withUpdates(() => {
|
|
662
|
+
store.hooksEffect.forEach((effect) => {
|
|
663
|
+
effect();
|
|
664
|
+
});
|
|
665
|
+
store.hooksEffect.length = 0;
|
|
666
|
+
})();
|
|
667
|
+
},
|
|
668
|
+
clearAll() {
|
|
669
|
+
const store = getStore();
|
|
670
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
671
|
+
cleanFn?.();
|
|
672
|
+
});
|
|
673
|
+
store.hooksEffect.length = 0;
|
|
674
|
+
store.hooksCleanup.length = 0;
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
679
|
+
function isFactory(value) {
|
|
680
|
+
return typeof value === "function";
|
|
681
|
+
}
|
|
682
|
+
function useState(defaultValue) {
|
|
683
|
+
return withPointer((pointer) => {
|
|
684
|
+
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
685
|
+
if (pointer.get() !== newValue) {
|
|
686
|
+
pointer.set(newValue);
|
|
687
|
+
handleChange();
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
if (pointer.initialized) {
|
|
691
|
+
return [pointer.get(), setState];
|
|
692
|
+
}
|
|
693
|
+
const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
|
|
694
|
+
pointer.set(value);
|
|
695
|
+
return [value, setState];
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
700
|
+
function useEffect(cb, depArray) {
|
|
701
|
+
withPointer((pointer) => {
|
|
702
|
+
const oldDeps = pointer.get();
|
|
703
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
704
|
+
if (hasChanged) {
|
|
705
|
+
effectScheduler.queue(cb);
|
|
706
|
+
}
|
|
707
|
+
pointer.set(depArray);
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/theme.js
|
|
712
|
+
import { styleText } from "node:util";
|
|
713
|
+
|
|
714
|
+
// ../../node_modules/@inquirer/figures/dist/index.js
|
|
715
|
+
import process2 from "node:process";
|
|
716
|
+
function isUnicodeSupported() {
|
|
717
|
+
if (!process2.platform.startsWith("win")) {
|
|
718
|
+
return process2.env["TERM"] !== "linux";
|
|
719
|
+
}
|
|
720
|
+
return Boolean(process2.env["CI"]) || Boolean(process2.env["WT_SESSION"]) || Boolean(process2.env["TERMINUS_SUBLIME"]) || process2.env["ConEmuTask"] === "{cmd::Cmder}" || process2.env["TERM_PROGRAM"] === "Terminus-Sublime" || process2.env["TERM_PROGRAM"] === "vscode" || process2.env["TERM"] === "xterm-256color" || process2.env["TERM"] === "alacritty" || process2.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
721
|
+
}
|
|
722
|
+
var common = {
|
|
723
|
+
circleQuestionMark: "(?)",
|
|
724
|
+
questionMarkPrefix: "(?)",
|
|
725
|
+
square: "█",
|
|
726
|
+
squareDarkShade: "▓",
|
|
727
|
+
squareMediumShade: "▒",
|
|
728
|
+
squareLightShade: "░",
|
|
729
|
+
squareTop: "▀",
|
|
730
|
+
squareBottom: "▄",
|
|
731
|
+
squareLeft: "▌",
|
|
732
|
+
squareRight: "▐",
|
|
733
|
+
squareCenter: "■",
|
|
734
|
+
bullet: "●",
|
|
735
|
+
dot: "․",
|
|
736
|
+
ellipsis: "…",
|
|
737
|
+
pointerSmall: "›",
|
|
738
|
+
triangleUp: "▲",
|
|
739
|
+
triangleUpSmall: "▴",
|
|
740
|
+
triangleDown: "▼",
|
|
741
|
+
triangleDownSmall: "▾",
|
|
742
|
+
triangleLeftSmall: "◂",
|
|
743
|
+
triangleRightSmall: "▸",
|
|
744
|
+
home: "⌂",
|
|
745
|
+
heart: "♥",
|
|
746
|
+
musicNote: "♪",
|
|
747
|
+
musicNoteBeamed: "♫",
|
|
748
|
+
arrowUp: "↑",
|
|
749
|
+
arrowDown: "↓",
|
|
750
|
+
arrowLeft: "←",
|
|
751
|
+
arrowRight: "→",
|
|
752
|
+
arrowLeftRight: "↔",
|
|
753
|
+
arrowUpDown: "↕",
|
|
754
|
+
almostEqual: "≈",
|
|
755
|
+
notEqual: "≠",
|
|
756
|
+
lessOrEqual: "≤",
|
|
757
|
+
greaterOrEqual: "≥",
|
|
758
|
+
identical: "≡",
|
|
759
|
+
infinity: "∞",
|
|
760
|
+
subscriptZero: "₀",
|
|
761
|
+
subscriptOne: "₁",
|
|
762
|
+
subscriptTwo: "₂",
|
|
763
|
+
subscriptThree: "₃",
|
|
764
|
+
subscriptFour: "₄",
|
|
765
|
+
subscriptFive: "₅",
|
|
766
|
+
subscriptSix: "₆",
|
|
767
|
+
subscriptSeven: "₇",
|
|
768
|
+
subscriptEight: "₈",
|
|
769
|
+
subscriptNine: "₉",
|
|
770
|
+
oneHalf: "½",
|
|
771
|
+
oneThird: "⅓",
|
|
772
|
+
oneQuarter: "¼",
|
|
773
|
+
oneFifth: "⅕",
|
|
774
|
+
oneSixth: "⅙",
|
|
775
|
+
oneEighth: "⅛",
|
|
776
|
+
twoThirds: "⅔",
|
|
777
|
+
twoFifths: "⅖",
|
|
778
|
+
threeQuarters: "¾",
|
|
779
|
+
threeFifths: "⅗",
|
|
780
|
+
threeEighths: "⅜",
|
|
781
|
+
fourFifths: "⅘",
|
|
782
|
+
fiveSixths: "⅚",
|
|
783
|
+
fiveEighths: "⅝",
|
|
784
|
+
sevenEighths: "⅞",
|
|
785
|
+
line: "─",
|
|
786
|
+
lineBold: "━",
|
|
787
|
+
lineDouble: "═",
|
|
788
|
+
lineDashed0: "┄",
|
|
789
|
+
lineDashed1: "┅",
|
|
790
|
+
lineDashed2: "┈",
|
|
791
|
+
lineDashed3: "┉",
|
|
792
|
+
lineDashed4: "╌",
|
|
793
|
+
lineDashed5: "╍",
|
|
794
|
+
lineDashed6: "╴",
|
|
795
|
+
lineDashed7: "╶",
|
|
796
|
+
lineDashed8: "╸",
|
|
797
|
+
lineDashed9: "╺",
|
|
798
|
+
lineDashed10: "╼",
|
|
799
|
+
lineDashed11: "╾",
|
|
800
|
+
lineDashed12: "−",
|
|
801
|
+
lineDashed13: "–",
|
|
802
|
+
lineDashed14: "‐",
|
|
803
|
+
lineDashed15: "⁃",
|
|
804
|
+
lineVertical: "│",
|
|
805
|
+
lineVerticalBold: "┃",
|
|
806
|
+
lineVerticalDouble: "║",
|
|
807
|
+
lineVerticalDashed0: "┆",
|
|
808
|
+
lineVerticalDashed1: "┇",
|
|
809
|
+
lineVerticalDashed2: "┊",
|
|
810
|
+
lineVerticalDashed3: "┋",
|
|
811
|
+
lineVerticalDashed4: "╎",
|
|
812
|
+
lineVerticalDashed5: "╏",
|
|
813
|
+
lineVerticalDashed6: "╵",
|
|
814
|
+
lineVerticalDashed7: "╷",
|
|
815
|
+
lineVerticalDashed8: "╹",
|
|
816
|
+
lineVerticalDashed9: "╻",
|
|
817
|
+
lineVerticalDashed10: "╽",
|
|
818
|
+
lineVerticalDashed11: "╿",
|
|
819
|
+
lineDownLeft: "┐",
|
|
820
|
+
lineDownLeftArc: "╮",
|
|
821
|
+
lineDownBoldLeftBold: "┓",
|
|
822
|
+
lineDownBoldLeft: "┒",
|
|
823
|
+
lineDownLeftBold: "┑",
|
|
824
|
+
lineDownDoubleLeftDouble: "╗",
|
|
825
|
+
lineDownDoubleLeft: "╖",
|
|
826
|
+
lineDownLeftDouble: "╕",
|
|
827
|
+
lineDownRight: "┌",
|
|
828
|
+
lineDownRightArc: "╭",
|
|
829
|
+
lineDownBoldRightBold: "┏",
|
|
830
|
+
lineDownBoldRight: "┎",
|
|
831
|
+
lineDownRightBold: "┍",
|
|
832
|
+
lineDownDoubleRightDouble: "╔",
|
|
833
|
+
lineDownDoubleRight: "╓",
|
|
834
|
+
lineDownRightDouble: "╒",
|
|
835
|
+
lineUpLeft: "┘",
|
|
836
|
+
lineUpLeftArc: "╯",
|
|
837
|
+
lineUpBoldLeftBold: "┛",
|
|
838
|
+
lineUpBoldLeft: "┚",
|
|
839
|
+
lineUpLeftBold: "┙",
|
|
840
|
+
lineUpDoubleLeftDouble: "╝",
|
|
841
|
+
lineUpDoubleLeft: "╜",
|
|
842
|
+
lineUpLeftDouble: "╛",
|
|
843
|
+
lineUpRight: "└",
|
|
844
|
+
lineUpRightArc: "╰",
|
|
845
|
+
lineUpBoldRightBold: "┗",
|
|
846
|
+
lineUpBoldRight: "┖",
|
|
847
|
+
lineUpRightBold: "┕",
|
|
848
|
+
lineUpDoubleRightDouble: "╚",
|
|
849
|
+
lineUpDoubleRight: "╙",
|
|
850
|
+
lineUpRightDouble: "╘",
|
|
851
|
+
lineUpDownLeft: "┤",
|
|
852
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
853
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
854
|
+
lineUpDownLeftBold: "┥",
|
|
855
|
+
lineUpBoldDownLeftBold: "┩",
|
|
856
|
+
lineUpDownBoldLeftBold: "┪",
|
|
857
|
+
lineUpDownBoldLeft: "┧",
|
|
858
|
+
lineUpBoldDownLeft: "┦",
|
|
859
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
860
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
861
|
+
lineUpDownLeftDouble: "╡",
|
|
862
|
+
lineUpDownRight: "├",
|
|
863
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
864
|
+
lineUpBoldDownBoldRight: "┠",
|
|
865
|
+
lineUpDownRightBold: "┝",
|
|
866
|
+
lineUpBoldDownRightBold: "┡",
|
|
867
|
+
lineUpDownBoldRightBold: "┢",
|
|
868
|
+
lineUpDownBoldRight: "┟",
|
|
869
|
+
lineUpBoldDownRight: "┞",
|
|
870
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
871
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
872
|
+
lineUpDownRightDouble: "╞",
|
|
873
|
+
lineDownLeftRight: "┬",
|
|
874
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
875
|
+
lineDownLeftBoldRightBold: "┯",
|
|
876
|
+
lineDownBoldLeftRight: "┰",
|
|
877
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
878
|
+
lineDownBoldLeftRightBold: "┲",
|
|
879
|
+
lineDownLeftRightBold: "┮",
|
|
880
|
+
lineDownLeftBoldRight: "┭",
|
|
881
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
882
|
+
lineDownDoubleLeftRight: "╥",
|
|
883
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
884
|
+
lineUpLeftRight: "┴",
|
|
885
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
886
|
+
lineUpLeftBoldRightBold: "┷",
|
|
887
|
+
lineUpBoldLeftRight: "┸",
|
|
888
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
889
|
+
lineUpBoldLeftRightBold: "┺",
|
|
890
|
+
lineUpLeftRightBold: "┶",
|
|
891
|
+
lineUpLeftBoldRight: "┵",
|
|
892
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
893
|
+
lineUpDoubleLeftRight: "╨",
|
|
894
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
895
|
+
lineUpDownLeftRight: "┼",
|
|
896
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
897
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
898
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
899
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
900
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
901
|
+
lineUpBoldDownLeftRight: "╀",
|
|
902
|
+
lineUpDownBoldLeftRight: "╁",
|
|
903
|
+
lineUpDownLeftBoldRight: "┽",
|
|
904
|
+
lineUpDownLeftRightBold: "┾",
|
|
905
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
906
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
907
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
908
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
909
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
910
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
911
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
912
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
913
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
914
|
+
lineCross: "╳",
|
|
915
|
+
lineBackslash: "╲",
|
|
916
|
+
lineSlash: "╱"
|
|
917
|
+
};
|
|
918
|
+
var specialMainSymbols = {
|
|
919
|
+
tick: "✔",
|
|
920
|
+
info: "ℹ",
|
|
921
|
+
warning: "⚠",
|
|
922
|
+
cross: "✘",
|
|
923
|
+
squareSmall: "◻",
|
|
924
|
+
squareSmallFilled: "◼",
|
|
925
|
+
circle: "◯",
|
|
926
|
+
circleFilled: "◉",
|
|
927
|
+
circleDotted: "◌",
|
|
928
|
+
circleDouble: "◎",
|
|
929
|
+
circleCircle: "ⓞ",
|
|
930
|
+
circleCross: "ⓧ",
|
|
931
|
+
circlePipe: "Ⓘ",
|
|
932
|
+
radioOn: "◉",
|
|
933
|
+
radioOff: "◯",
|
|
934
|
+
checkboxOn: "☒",
|
|
935
|
+
checkboxOff: "☐",
|
|
936
|
+
checkboxCircleOn: "ⓧ",
|
|
937
|
+
checkboxCircleOff: "Ⓘ",
|
|
938
|
+
pointer: "❯",
|
|
939
|
+
triangleUpOutline: "△",
|
|
940
|
+
triangleLeft: "◀",
|
|
941
|
+
triangleRight: "▶",
|
|
942
|
+
lozenge: "◆",
|
|
943
|
+
lozengeOutline: "◇",
|
|
944
|
+
hamburger: "☰",
|
|
945
|
+
smiley: "㋡",
|
|
946
|
+
mustache: "෴",
|
|
947
|
+
star: "★",
|
|
948
|
+
play: "▶",
|
|
949
|
+
nodejs: "⬢",
|
|
950
|
+
oneSeventh: "⅐",
|
|
951
|
+
oneNinth: "⅑",
|
|
952
|
+
oneTenth: "⅒"
|
|
953
|
+
};
|
|
954
|
+
var specialFallbackSymbols = {
|
|
955
|
+
tick: "√",
|
|
956
|
+
info: "i",
|
|
957
|
+
warning: "‼",
|
|
958
|
+
cross: "×",
|
|
959
|
+
squareSmall: "□",
|
|
960
|
+
squareSmallFilled: "■",
|
|
961
|
+
circle: "( )",
|
|
962
|
+
circleFilled: "(*)",
|
|
963
|
+
circleDotted: "( )",
|
|
964
|
+
circleDouble: "( )",
|
|
965
|
+
circleCircle: "(○)",
|
|
966
|
+
circleCross: "(×)",
|
|
967
|
+
circlePipe: "(│)",
|
|
968
|
+
radioOn: "(*)",
|
|
969
|
+
radioOff: "( )",
|
|
970
|
+
checkboxOn: "[×]",
|
|
971
|
+
checkboxOff: "[ ]",
|
|
972
|
+
checkboxCircleOn: "(×)",
|
|
973
|
+
checkboxCircleOff: "( )",
|
|
974
|
+
pointer: ">",
|
|
975
|
+
triangleUpOutline: "∆",
|
|
976
|
+
triangleLeft: "◄",
|
|
977
|
+
triangleRight: "►",
|
|
978
|
+
lozenge: "♦",
|
|
979
|
+
lozengeOutline: "◊",
|
|
980
|
+
hamburger: "≡",
|
|
981
|
+
smiley: "☺",
|
|
982
|
+
mustache: "┌─┐",
|
|
983
|
+
star: "✶",
|
|
984
|
+
play: "►",
|
|
985
|
+
nodejs: "♦",
|
|
986
|
+
oneSeventh: "1/7",
|
|
987
|
+
oneNinth: "1/9",
|
|
988
|
+
oneTenth: "1/10"
|
|
989
|
+
};
|
|
990
|
+
var mainSymbols = {
|
|
991
|
+
...common,
|
|
992
|
+
...specialMainSymbols
|
|
993
|
+
};
|
|
994
|
+
var fallbackSymbols = {
|
|
995
|
+
...common,
|
|
996
|
+
...specialFallbackSymbols
|
|
997
|
+
};
|
|
998
|
+
var shouldUseMain = isUnicodeSupported();
|
|
999
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
1000
|
+
var dist_default5 = figures;
|
|
1001
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
1002
|
+
|
|
1003
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/theme.js
|
|
1004
|
+
var defaultTheme = {
|
|
1005
|
+
prefix: {
|
|
1006
|
+
idle: styleText("blue", "?"),
|
|
1007
|
+
done: styleText("green", dist_default5.tick)
|
|
1008
|
+
},
|
|
1009
|
+
spinner: {
|
|
1010
|
+
interval: 80,
|
|
1011
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
|
|
1012
|
+
},
|
|
1013
|
+
keybindings: [],
|
|
1014
|
+
style: {
|
|
1015
|
+
answer: (text) => styleText("cyan", text),
|
|
1016
|
+
message: (text) => styleText("bold", text),
|
|
1017
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
1018
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
1019
|
+
help: (text) => styleText("dim", text),
|
|
1020
|
+
highlight: (text) => styleText("cyan", text),
|
|
1021
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
function getDefaultTheme() {
|
|
1025
|
+
return {
|
|
1026
|
+
...defaultTheme,
|
|
1027
|
+
keybindings: getDefaultKeybindings()
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
1032
|
+
function isPlainObject(value) {
|
|
1033
|
+
if (typeof value !== "object" || value === null)
|
|
1034
|
+
return false;
|
|
1035
|
+
let proto = value;
|
|
1036
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
1037
|
+
proto = Object.getPrototypeOf(proto);
|
|
1038
|
+
}
|
|
1039
|
+
return Object.getPrototypeOf(value) === proto;
|
|
1040
|
+
}
|
|
1041
|
+
function deepMerge(...objects) {
|
|
1042
|
+
const output = {};
|
|
1043
|
+
for (const obj of objects) {
|
|
1044
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1045
|
+
const prevValue = output[key];
|
|
1046
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
return output;
|
|
1050
|
+
}
|
|
1051
|
+
function makeTheme(...themes) {
|
|
1052
|
+
const themesToMerge = [
|
|
1053
|
+
getDefaultTheme(),
|
|
1054
|
+
...themes.filter((theme) => theme != null)
|
|
1055
|
+
];
|
|
1056
|
+
return deepMerge(...themesToMerge);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
1060
|
+
function usePrefix({ status = "idle", theme }) {
|
|
1061
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
1062
|
+
const [tick, setTick] = useState(0);
|
|
1063
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
1064
|
+
useEffect(() => {
|
|
1065
|
+
if (status === "loading") {
|
|
1066
|
+
let tickInterval;
|
|
1067
|
+
let inc = -1;
|
|
1068
|
+
const delayTimeout = setTimeout(() => {
|
|
1069
|
+
setShowLoader(true);
|
|
1070
|
+
tickInterval = setInterval(() => {
|
|
1071
|
+
inc = inc + 1;
|
|
1072
|
+
setTick(inc % spinner.frames.length);
|
|
1073
|
+
}, spinner.interval);
|
|
1074
|
+
}, 300);
|
|
1075
|
+
return () => {
|
|
1076
|
+
clearTimeout(delayTimeout);
|
|
1077
|
+
clearInterval(tickInterval);
|
|
1078
|
+
};
|
|
1079
|
+
} else {
|
|
1080
|
+
setShowLoader(false);
|
|
1081
|
+
}
|
|
1082
|
+
}, [status]);
|
|
1083
|
+
if (showLoader) {
|
|
1084
|
+
return spinner.frames[tick];
|
|
1085
|
+
}
|
|
1086
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
1087
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
1088
|
+
}
|
|
1089
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
1090
|
+
function useMemo(fn, dependencies) {
|
|
1091
|
+
return withPointer((pointer) => {
|
|
1092
|
+
const prev = pointer.get();
|
|
1093
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
1094
|
+
const value = fn();
|
|
1095
|
+
pointer.set({ value, dependencies });
|
|
1096
|
+
return value;
|
|
1097
|
+
}
|
|
1098
|
+
return prev.value;
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
1102
|
+
function useRef(val) {
|
|
1103
|
+
return useState({ current: val })[0];
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
1107
|
+
function useKeypress(userHandler) {
|
|
1108
|
+
const signal = useRef(userHandler);
|
|
1109
|
+
signal.current = userHandler;
|
|
1110
|
+
useEffect((rl) => {
|
|
1111
|
+
let ignore = false;
|
|
1112
|
+
const handler = withUpdates((_input, event) => {
|
|
1113
|
+
if (ignore)
|
|
1114
|
+
return;
|
|
1115
|
+
signal.current(event, rl);
|
|
1116
|
+
});
|
|
1117
|
+
rl.input.on("keypress", handler);
|
|
1118
|
+
return () => {
|
|
1119
|
+
ignore = true;
|
|
1120
|
+
rl.input.removeListener("keypress", handler);
|
|
1121
|
+
};
|
|
1122
|
+
}, []);
|
|
1123
|
+
}
|
|
1124
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1125
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
1126
|
+
|
|
1127
|
+
// ../../node_modules/fast-string-truncated-width/dist/utils.js
|
|
1128
|
+
var getCodePointsLength = (() => {
|
|
1129
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
1130
|
+
return (input) => {
|
|
1131
|
+
let surrogatePairsNr = 0;
|
|
1132
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
1133
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
1134
|
+
surrogatePairsNr += 1;
|
|
1135
|
+
}
|
|
1136
|
+
return input.length - surrogatePairsNr;
|
|
1137
|
+
};
|
|
1138
|
+
})();
|
|
1139
|
+
var isFullWidth = (x) => {
|
|
1140
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
1141
|
+
};
|
|
1142
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
1143
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
// ../../node_modules/fast-string-truncated-width/dist/index.js
|
|
1147
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
1148
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
1149
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
1150
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
1151
|
+
var EMOJI_RE = /[\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;
|
|
1152
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
1153
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
1154
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
1155
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
1156
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
1157
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
1158
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
1159
|
+
const ANSI_WIDTH = 0;
|
|
1160
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
1161
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
1162
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
1163
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
1164
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
1165
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
1166
|
+
const PARSE_BLOCKS = [
|
|
1167
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
1168
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
1169
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
1170
|
+
[TAB_RE, TAB_WIDTH],
|
|
1171
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
1172
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
1173
|
+
];
|
|
1174
|
+
let indexPrev = 0;
|
|
1175
|
+
let index = 0;
|
|
1176
|
+
let length = input.length;
|
|
1177
|
+
let lengthExtra = 0;
|
|
1178
|
+
let truncationEnabled = false;
|
|
1179
|
+
let truncationIndex = length;
|
|
1180
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
1181
|
+
let unmatchedStart = 0;
|
|
1182
|
+
let unmatchedEnd = 0;
|
|
1183
|
+
let width = 0;
|
|
1184
|
+
let widthExtra = 0;
|
|
1185
|
+
outer:
|
|
1186
|
+
while (true) {
|
|
1187
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
1188
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
1189
|
+
lengthExtra = 0;
|
|
1190
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
1191
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
1192
|
+
if (isFullWidth(codePoint)) {
|
|
1193
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
1194
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
1195
|
+
widthExtra = WIDE_WIDTH;
|
|
1196
|
+
} else {
|
|
1197
|
+
widthExtra = REGULAR_WIDTH;
|
|
1198
|
+
}
|
|
1199
|
+
if (width + widthExtra > truncationLimit) {
|
|
1200
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
1201
|
+
}
|
|
1202
|
+
if (width + widthExtra > LIMIT) {
|
|
1203
|
+
truncationEnabled = true;
|
|
1204
|
+
break outer;
|
|
1205
|
+
}
|
|
1206
|
+
lengthExtra += char.length;
|
|
1207
|
+
width += widthExtra;
|
|
1208
|
+
}
|
|
1209
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
1210
|
+
}
|
|
1211
|
+
if (index >= length) {
|
|
1212
|
+
break outer;
|
|
1213
|
+
}
|
|
1214
|
+
for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
|
|
1215
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
1216
|
+
BLOCK_RE.lastIndex = index;
|
|
1217
|
+
if (BLOCK_RE.test(input)) {
|
|
1218
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
1219
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
1220
|
+
if (width + widthExtra > truncationLimit) {
|
|
1221
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
1222
|
+
}
|
|
1223
|
+
if (width + widthExtra > LIMIT) {
|
|
1224
|
+
truncationEnabled = true;
|
|
1225
|
+
break outer;
|
|
1226
|
+
}
|
|
1227
|
+
width += widthExtra;
|
|
1228
|
+
unmatchedStart = indexPrev;
|
|
1229
|
+
unmatchedEnd = index;
|
|
1230
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
1231
|
+
continue outer;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
index += 1;
|
|
1235
|
+
}
|
|
1236
|
+
return {
|
|
1237
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
1238
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
1239
|
+
truncated: truncationEnabled,
|
|
1240
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
1241
|
+
};
|
|
1242
|
+
};
|
|
1243
|
+
var dist_default6 = getStringTruncatedWidth;
|
|
1244
|
+
|
|
1245
|
+
// ../../node_modules/fast-string-width/dist/index.js
|
|
1246
|
+
var NO_TRUNCATION2 = {
|
|
1247
|
+
limit: Infinity,
|
|
1248
|
+
ellipsis: "",
|
|
1249
|
+
ellipsisWidth: 0
|
|
1250
|
+
};
|
|
1251
|
+
var fastStringWidth = (input, options = {}) => {
|
|
1252
|
+
return dist_default6(input, NO_TRUNCATION2, options).width;
|
|
1253
|
+
};
|
|
1254
|
+
var dist_default7 = fastStringWidth;
|
|
1255
|
+
|
|
1256
|
+
// ../../node_modules/fast-wrap-ansi/lib/main.js
|
|
1257
|
+
var ESC = "\x1B";
|
|
1258
|
+
var CSI = "";
|
|
1259
|
+
var END_CODE = 39;
|
|
1260
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
1261
|
+
var ANSI_CSI = "[";
|
|
1262
|
+
var ANSI_OSC = "]";
|
|
1263
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
1264
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1265
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
1266
|
+
var getClosingCode = (openingCode) => {
|
|
1267
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
1268
|
+
return 39;
|
|
1269
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
1270
|
+
return 39;
|
|
1271
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
1272
|
+
return 49;
|
|
1273
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
1274
|
+
return 49;
|
|
1275
|
+
if (openingCode === 1 || openingCode === 2)
|
|
1276
|
+
return 22;
|
|
1277
|
+
if (openingCode === 3)
|
|
1278
|
+
return 23;
|
|
1279
|
+
if (openingCode === 4)
|
|
1280
|
+
return 24;
|
|
1281
|
+
if (openingCode === 7)
|
|
1282
|
+
return 27;
|
|
1283
|
+
if (openingCode === 8)
|
|
1284
|
+
return 28;
|
|
1285
|
+
if (openingCode === 9)
|
|
1286
|
+
return 29;
|
|
1287
|
+
if (openingCode === 0)
|
|
1288
|
+
return 0;
|
|
1289
|
+
return;
|
|
1290
|
+
};
|
|
1291
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1292
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
1293
|
+
var wrapWord = (rows, word, columns) => {
|
|
1294
|
+
const characters = word[Symbol.iterator]();
|
|
1295
|
+
let isInsideEscape = false;
|
|
1296
|
+
let isInsideLinkEscape = false;
|
|
1297
|
+
let lastRow = rows.at(-1);
|
|
1298
|
+
let visible = lastRow === undefined ? 0 : dist_default7(lastRow);
|
|
1299
|
+
let currentCharacter = characters.next();
|
|
1300
|
+
let nextCharacter = characters.next();
|
|
1301
|
+
let rawCharacterIndex = 0;
|
|
1302
|
+
while (!currentCharacter.done) {
|
|
1303
|
+
const character = currentCharacter.value;
|
|
1304
|
+
const characterLength = dist_default7(character);
|
|
1305
|
+
if (visible + characterLength <= columns) {
|
|
1306
|
+
rows[rows.length - 1] += character;
|
|
1307
|
+
} else {
|
|
1308
|
+
rows.push(character);
|
|
1309
|
+
visible = 0;
|
|
1310
|
+
}
|
|
1311
|
+
if (character === ESC || character === CSI) {
|
|
1312
|
+
isInsideEscape = true;
|
|
1313
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
1314
|
+
}
|
|
1315
|
+
if (isInsideEscape) {
|
|
1316
|
+
if (isInsideLinkEscape) {
|
|
1317
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
1318
|
+
isInsideEscape = false;
|
|
1319
|
+
isInsideLinkEscape = false;
|
|
1320
|
+
}
|
|
1321
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
1322
|
+
isInsideEscape = false;
|
|
1323
|
+
}
|
|
1324
|
+
} else {
|
|
1325
|
+
visible += characterLength;
|
|
1326
|
+
if (visible === columns && !nextCharacter.done) {
|
|
1327
|
+
rows.push("");
|
|
1328
|
+
visible = 0;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
currentCharacter = nextCharacter;
|
|
1332
|
+
nextCharacter = characters.next();
|
|
1333
|
+
rawCharacterIndex += character.length;
|
|
1334
|
+
}
|
|
1335
|
+
lastRow = rows.at(-1);
|
|
1336
|
+
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
|
1337
|
+
rows[rows.length - 2] += rows.pop();
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
1341
|
+
const words = string.split(" ");
|
|
1342
|
+
let last = words.length;
|
|
1343
|
+
while (last) {
|
|
1344
|
+
if (dist_default7(words[last - 1])) {
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
last--;
|
|
1348
|
+
}
|
|
1349
|
+
if (last === words.length) {
|
|
1350
|
+
return string;
|
|
1351
|
+
}
|
|
1352
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1353
|
+
};
|
|
1354
|
+
var exec = (string, columns, options = {}) => {
|
|
1355
|
+
if (options.trim !== false && string.trim() === "") {
|
|
1356
|
+
return "";
|
|
1357
|
+
}
|
|
1358
|
+
let returnValue = "";
|
|
1359
|
+
let escapeCode;
|
|
1360
|
+
let escapeUrl;
|
|
1361
|
+
const words = string.split(" ");
|
|
1362
|
+
let rows = [""];
|
|
1363
|
+
let rowLength = 0;
|
|
1364
|
+
for (let index = 0;index < words.length; index++) {
|
|
1365
|
+
const word = words[index];
|
|
1366
|
+
if (options.trim !== false) {
|
|
1367
|
+
const row = rows.at(-1) ?? "";
|
|
1368
|
+
const trimmed = row.trimStart();
|
|
1369
|
+
if (row.length !== trimmed.length) {
|
|
1370
|
+
rows[rows.length - 1] = trimmed;
|
|
1371
|
+
rowLength = dist_default7(trimmed);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
if (index !== 0) {
|
|
1375
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
1376
|
+
rows.push("");
|
|
1377
|
+
rowLength = 0;
|
|
1378
|
+
}
|
|
1379
|
+
if (rowLength || options.trim === false) {
|
|
1380
|
+
rows[rows.length - 1] += " ";
|
|
1381
|
+
rowLength++;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
const wordLength = dist_default7(word);
|
|
1385
|
+
if (options.hard && wordLength > columns) {
|
|
1386
|
+
const remainingColumns = columns - rowLength;
|
|
1387
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
1388
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
1389
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
1390
|
+
rows.push("");
|
|
1391
|
+
}
|
|
1392
|
+
wrapWord(rows, word, columns);
|
|
1393
|
+
rowLength = dist_default7(rows.at(-1) ?? "");
|
|
1394
|
+
continue;
|
|
1395
|
+
}
|
|
1396
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
1397
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
1398
|
+
wrapWord(rows, word, columns);
|
|
1399
|
+
rowLength = dist_default7(rows.at(-1) ?? "");
|
|
1400
|
+
continue;
|
|
1401
|
+
}
|
|
1402
|
+
rows.push("");
|
|
1403
|
+
rowLength = 0;
|
|
1404
|
+
}
|
|
1405
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
1406
|
+
wrapWord(rows, word, columns);
|
|
1407
|
+
rowLength = dist_default7(rows.at(-1) ?? "");
|
|
1408
|
+
continue;
|
|
1409
|
+
}
|
|
1410
|
+
rows[rows.length - 1] += word;
|
|
1411
|
+
rowLength += wordLength;
|
|
1412
|
+
}
|
|
1413
|
+
if (options.trim !== false) {
|
|
1414
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1415
|
+
}
|
|
1416
|
+
const preString = rows.join(`
|
|
1417
|
+
`);
|
|
1418
|
+
let inSurrogate = false;
|
|
1419
|
+
for (let i = 0;i < preString.length; i++) {
|
|
1420
|
+
const character = preString[i];
|
|
1421
|
+
returnValue += character;
|
|
1422
|
+
if (!inSurrogate) {
|
|
1423
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
1424
|
+
if (inSurrogate) {
|
|
1425
|
+
continue;
|
|
1426
|
+
}
|
|
1427
|
+
} else {
|
|
1428
|
+
inSurrogate = false;
|
|
1429
|
+
}
|
|
1430
|
+
if (character === ESC || character === CSI) {
|
|
1431
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
1432
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
1433
|
+
const groups = groupsResult?.groups;
|
|
1434
|
+
if (groups?.code !== undefined) {
|
|
1435
|
+
const code = Number.parseFloat(groups.code);
|
|
1436
|
+
escapeCode = code === END_CODE ? undefined : code;
|
|
1437
|
+
} else if (groups?.uri !== undefined) {
|
|
1438
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
if (preString[i + 1] === `
|
|
1442
|
+
`) {
|
|
1443
|
+
if (escapeUrl) {
|
|
1444
|
+
returnValue += wrapAnsiHyperlink("");
|
|
1445
|
+
}
|
|
1446
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
|
|
1447
|
+
if (escapeCode && closingCode) {
|
|
1448
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
1449
|
+
}
|
|
1450
|
+
} else if (character === `
|
|
1451
|
+
`) {
|
|
1452
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
1453
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
1454
|
+
}
|
|
1455
|
+
if (escapeUrl) {
|
|
1456
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
return returnValue;
|
|
1461
|
+
};
|
|
1462
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
1463
|
+
function wrapAnsi(string, columns, options) {
|
|
1464
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
|
|
1465
|
+
`);
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1469
|
+
function breakLines(content, width) {
|
|
1470
|
+
return content.split(`
|
|
1471
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split(`
|
|
1472
|
+
`).map((str) => str.trimEnd())).join(`
|
|
1473
|
+
`);
|
|
1474
|
+
}
|
|
1475
|
+
function readlineWidth() {
|
|
1476
|
+
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
1480
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
1481
|
+
const state = useRef({
|
|
1482
|
+
lastPointer: active,
|
|
1483
|
+
lastActive: undefined
|
|
1484
|
+
});
|
|
1485
|
+
const { lastPointer, lastActive } = state.current;
|
|
1486
|
+
const middle = Math.floor(pageSize / 2);
|
|
1487
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1488
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
1489
|
+
let pointer = defaultPointerPosition;
|
|
1490
|
+
if (renderedLength > pageSize) {
|
|
1491
|
+
if (loop) {
|
|
1492
|
+
pointer = lastPointer;
|
|
1493
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
1494
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
1495
|
+
}
|
|
1496
|
+
} else {
|
|
1497
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
1498
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
state.current.lastPointer = pointer;
|
|
1502
|
+
state.current.lastActive = active;
|
|
1503
|
+
return pointer;
|
|
1504
|
+
}
|
|
1505
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
1506
|
+
const width = readlineWidth();
|
|
1507
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
1508
|
+
const renderedItems = items.map((item, index) => {
|
|
1509
|
+
if (item == null)
|
|
1510
|
+
return [];
|
|
1511
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
1512
|
+
`);
|
|
1513
|
+
});
|
|
1514
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
1515
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
1516
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
1517
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
1518
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
1519
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
1520
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
1521
|
+
const itemVisited = new Set([active]);
|
|
1522
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
1523
|
+
let itemPointer = bound(active + 1);
|
|
1524
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
1525
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
1526
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
1527
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
1528
|
+
itemVisited.add(itemPointer);
|
|
1529
|
+
bufferPointer += linesToAdd.length;
|
|
1530
|
+
itemPointer = bound(itemPointer + 1);
|
|
1531
|
+
}
|
|
1532
|
+
bufferPointer = activeItemPosition - 1;
|
|
1533
|
+
itemPointer = bound(active - 1);
|
|
1534
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
1535
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
1536
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
1537
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
1538
|
+
itemVisited.add(itemPointer);
|
|
1539
|
+
bufferPointer -= linesToAdd.length;
|
|
1540
|
+
itemPointer = bound(itemPointer - 1);
|
|
1541
|
+
}
|
|
1542
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
1543
|
+
`);
|
|
1544
|
+
}
|
|
1545
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1546
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
1547
|
+
import * as readline2 from "node:readline";
|
|
1548
|
+
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
1549
|
+
|
|
1550
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/signals.js
|
|
1551
|
+
var signals = [];
|
|
1552
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1553
|
+
if (process.platform !== "win32") {
|
|
1554
|
+
signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1555
|
+
}
|
|
1556
|
+
if (process.platform === "linux") {
|
|
1557
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/index.js
|
|
1561
|
+
var processOk = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
|
|
1562
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1563
|
+
var global = globalThis;
|
|
1564
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1565
|
+
|
|
1566
|
+
class Emitter {
|
|
1567
|
+
emitted = {
|
|
1568
|
+
afterExit: false,
|
|
1569
|
+
exit: false
|
|
1570
|
+
};
|
|
1571
|
+
listeners = {
|
|
1572
|
+
afterExit: [],
|
|
1573
|
+
exit: []
|
|
1574
|
+
};
|
|
1575
|
+
count = 0;
|
|
1576
|
+
id = Math.random();
|
|
1577
|
+
constructor() {
|
|
1578
|
+
if (global[kExitEmitter]) {
|
|
1579
|
+
return global[kExitEmitter];
|
|
1580
|
+
}
|
|
1581
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
1582
|
+
value: this,
|
|
1583
|
+
writable: false,
|
|
1584
|
+
enumerable: false,
|
|
1585
|
+
configurable: false
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
on(ev, fn) {
|
|
1589
|
+
this.listeners[ev].push(fn);
|
|
1590
|
+
}
|
|
1591
|
+
removeListener(ev, fn) {
|
|
1592
|
+
const list = this.listeners[ev];
|
|
1593
|
+
const i = list.indexOf(fn);
|
|
1594
|
+
if (i === -1) {
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
if (i === 0 && list.length === 1) {
|
|
1598
|
+
list.length = 0;
|
|
1599
|
+
} else {
|
|
1600
|
+
list.splice(i, 1);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
emit(ev, code, signal) {
|
|
1604
|
+
if (this.emitted[ev]) {
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
this.emitted[ev] = true;
|
|
1608
|
+
let ret = false;
|
|
1609
|
+
for (const fn of this.listeners[ev]) {
|
|
1610
|
+
ret = fn(code, signal) === true || ret;
|
|
1611
|
+
}
|
|
1612
|
+
if (ev === "exit") {
|
|
1613
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
1614
|
+
}
|
|
1615
|
+
return ret;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
class SignalExitBase {
|
|
1620
|
+
}
|
|
1621
|
+
var signalExitWrap = (handler) => {
|
|
1622
|
+
return {
|
|
1623
|
+
onExit(cb, opts) {
|
|
1624
|
+
return handler.onExit(cb, opts);
|
|
1625
|
+
},
|
|
1626
|
+
load() {
|
|
1627
|
+
return handler.load();
|
|
1628
|
+
},
|
|
1629
|
+
unload() {
|
|
1630
|
+
return handler.unload();
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
};
|
|
1634
|
+
|
|
1635
|
+
class SignalExitFallback extends SignalExitBase {
|
|
1636
|
+
onExit() {
|
|
1637
|
+
return () => {};
|
|
1638
|
+
}
|
|
1639
|
+
load() {}
|
|
1640
|
+
unload() {}
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
class SignalExit extends SignalExitBase {
|
|
1644
|
+
#hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1645
|
+
#emitter = new Emitter;
|
|
1646
|
+
#process;
|
|
1647
|
+
#originalProcessEmit;
|
|
1648
|
+
#originalProcessReallyExit;
|
|
1649
|
+
#sigListeners = {};
|
|
1650
|
+
#loaded = false;
|
|
1651
|
+
constructor(process2) {
|
|
1652
|
+
super();
|
|
1653
|
+
this.#process = process2;
|
|
1654
|
+
this.#sigListeners = {};
|
|
1655
|
+
for (const sig of signals) {
|
|
1656
|
+
this.#sigListeners[sig] = () => {
|
|
1657
|
+
const listeners = this.#process.listeners(sig);
|
|
1658
|
+
let { count } = this.#emitter;
|
|
1659
|
+
const p = process2;
|
|
1660
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
1661
|
+
count += p.__signal_exit_emitter__.count;
|
|
1662
|
+
}
|
|
1663
|
+
if (listeners.length === count) {
|
|
1664
|
+
this.unload();
|
|
1665
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
1666
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1667
|
+
if (!ret)
|
|
1668
|
+
process2.kill(process2.pid, s);
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
this.#originalProcessReallyExit = process2.reallyExit;
|
|
1673
|
+
this.#originalProcessEmit = process2.emit;
|
|
1674
|
+
}
|
|
1675
|
+
onExit(cb, opts) {
|
|
1676
|
+
if (!processOk(this.#process)) {
|
|
1677
|
+
return () => {};
|
|
1678
|
+
}
|
|
1679
|
+
if (this.#loaded === false) {
|
|
1680
|
+
this.load();
|
|
1681
|
+
}
|
|
1682
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1683
|
+
this.#emitter.on(ev, cb);
|
|
1684
|
+
return () => {
|
|
1685
|
+
this.#emitter.removeListener(ev, cb);
|
|
1686
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
1687
|
+
this.unload();
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
load() {
|
|
1692
|
+
if (this.#loaded) {
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
this.#loaded = true;
|
|
1696
|
+
this.#emitter.count += 1;
|
|
1697
|
+
for (const sig of signals) {
|
|
1698
|
+
try {
|
|
1699
|
+
const fn = this.#sigListeners[sig];
|
|
1700
|
+
if (fn)
|
|
1701
|
+
this.#process.on(sig, fn);
|
|
1702
|
+
} catch (_) {}
|
|
1703
|
+
}
|
|
1704
|
+
this.#process.emit = (ev, ...a) => {
|
|
1705
|
+
return this.#processEmit(ev, ...a);
|
|
1706
|
+
};
|
|
1707
|
+
this.#process.reallyExit = (code) => {
|
|
1708
|
+
return this.#processReallyExit(code);
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
unload() {
|
|
1712
|
+
if (!this.#loaded) {
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
this.#loaded = false;
|
|
1716
|
+
signals.forEach((sig) => {
|
|
1717
|
+
const listener = this.#sigListeners[sig];
|
|
1718
|
+
if (!listener) {
|
|
1719
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
1720
|
+
}
|
|
1721
|
+
try {
|
|
1722
|
+
this.#process.removeListener(sig, listener);
|
|
1723
|
+
} catch (_) {}
|
|
1724
|
+
});
|
|
1725
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
1726
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1727
|
+
this.#emitter.count -= 1;
|
|
1728
|
+
}
|
|
1729
|
+
#processReallyExit(code) {
|
|
1730
|
+
if (!processOk(this.#process)) {
|
|
1731
|
+
return 0;
|
|
1732
|
+
}
|
|
1733
|
+
this.#process.exitCode = code || 0;
|
|
1734
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1735
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1736
|
+
}
|
|
1737
|
+
#processEmit(ev, ...args) {
|
|
1738
|
+
const og = this.#originalProcessEmit;
|
|
1739
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
1740
|
+
if (typeof args[0] === "number") {
|
|
1741
|
+
this.#process.exitCode = args[0];
|
|
1742
|
+
}
|
|
1743
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
1744
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1745
|
+
return ret;
|
|
1746
|
+
} else {
|
|
1747
|
+
return og.call(this.#process, ev, ...args);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
var process3 = globalThis.process;
|
|
1752
|
+
var {
|
|
1753
|
+
onExit,
|
|
1754
|
+
load,
|
|
1755
|
+
unload
|
|
1756
|
+
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
1757
|
+
|
|
1758
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1759
|
+
import { stripVTControlCharacters } from "node:util";
|
|
1760
|
+
|
|
1761
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/ansi/dist/index.js
|
|
1762
|
+
var ESC2 = "\x1B[";
|
|
1763
|
+
var cursorLeft = ESC2 + "G";
|
|
1764
|
+
var cursorHide = ESC2 + "?25l";
|
|
1765
|
+
var cursorShow = ESC2 + "?25h";
|
|
1766
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
1767
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
1768
|
+
var cursorTo = (x, y) => {
|
|
1769
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
1770
|
+
return `${ESC2}${y + 1};${x + 1}H`;
|
|
1771
|
+
}
|
|
1772
|
+
return `${ESC2}${x + 1}G`;
|
|
1773
|
+
};
|
|
1774
|
+
var eraseLine = ESC2 + "2K";
|
|
1775
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
1776
|
+
|
|
1777
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1778
|
+
var height = (content) => content.split(`
|
|
1779
|
+
`).length;
|
|
1780
|
+
var lastLine = (content) => content.split(`
|
|
1781
|
+
`).pop() ?? "";
|
|
1782
|
+
|
|
1783
|
+
class ScreenManager {
|
|
1784
|
+
height = 0;
|
|
1785
|
+
extraLinesUnderPrompt = 0;
|
|
1786
|
+
cursorPos;
|
|
1787
|
+
rl;
|
|
1788
|
+
constructor(rl) {
|
|
1789
|
+
this.rl = rl;
|
|
1790
|
+
this.cursorPos = rl.getCursorPos();
|
|
1791
|
+
}
|
|
1792
|
+
write(content) {
|
|
1793
|
+
this.rl.output.unmute();
|
|
1794
|
+
this.rl.output.write(content);
|
|
1795
|
+
this.rl.output.mute();
|
|
1796
|
+
}
|
|
1797
|
+
render(content, bottomContent = "") {
|
|
1798
|
+
const promptLine = lastLine(content);
|
|
1799
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
1800
|
+
let prompt = rawPromptLine;
|
|
1801
|
+
if (this.rl.line.length > 0) {
|
|
1802
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
1803
|
+
}
|
|
1804
|
+
this.rl.setPrompt(prompt);
|
|
1805
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
1806
|
+
const width = readlineWidth();
|
|
1807
|
+
content = breakLines(content, width);
|
|
1808
|
+
bottomContent = breakLines(bottomContent, width);
|
|
1809
|
+
if (rawPromptLine.length % width === 0) {
|
|
1810
|
+
content += `
|
|
1811
|
+
`;
|
|
1812
|
+
}
|
|
1813
|
+
let output = content + (bottomContent ? `
|
|
1814
|
+
` + bottomContent : "");
|
|
1815
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
1816
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
1817
|
+
if (bottomContentHeight > 0)
|
|
1818
|
+
output += cursorUp(bottomContentHeight);
|
|
1819
|
+
output += cursorTo(this.cursorPos.cols);
|
|
1820
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
1821
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
1822
|
+
this.height = height(output);
|
|
1823
|
+
}
|
|
1824
|
+
checkCursorPos() {
|
|
1825
|
+
const cursorPos = this.rl.getCursorPos();
|
|
1826
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
1827
|
+
this.write(cursorTo(cursorPos.cols));
|
|
1828
|
+
this.cursorPos = cursorPos;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
done({ clearContent }) {
|
|
1832
|
+
this.rl.setPrompt("");
|
|
1833
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
1834
|
+
output += clearContent ? eraseLines(this.height) : `
|
|
1835
|
+
`;
|
|
1836
|
+
output += cursorLeft;
|
|
1837
|
+
output += cursorShow;
|
|
1838
|
+
this.write(output);
|
|
1839
|
+
this.rl.close();
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
1844
|
+
class PromisePolyfill extends Promise {
|
|
1845
|
+
static withResolver() {
|
|
1846
|
+
let resolve;
|
|
1847
|
+
let reject;
|
|
1848
|
+
const promise = new Promise((res, rej) => {
|
|
1849
|
+
resolve = res;
|
|
1850
|
+
reject = rej;
|
|
1851
|
+
});
|
|
1852
|
+
return { promise, resolve, reject };
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1857
|
+
import path from "node:path";
|
|
1858
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
1859
|
+
function getCallSites() {
|
|
1860
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
1861
|
+
let result = [];
|
|
1862
|
+
try {
|
|
1863
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
1864
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
1865
|
+
result = callSitesWithoutCurrent;
|
|
1866
|
+
return callSitesWithoutCurrent;
|
|
1867
|
+
};
|
|
1868
|
+
new Error().stack;
|
|
1869
|
+
} catch {
|
|
1870
|
+
return result;
|
|
1871
|
+
}
|
|
1872
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
1873
|
+
return result;
|
|
1874
|
+
}
|
|
1875
|
+
function createPrompt(view) {
|
|
1876
|
+
const callSites = getCallSites();
|
|
1877
|
+
const prompt = (config, context = {}) => {
|
|
1878
|
+
const { input = process.stdin, signal } = context;
|
|
1879
|
+
const cleanups = new Set;
|
|
1880
|
+
const output = new import_mute_stream.default;
|
|
1881
|
+
output.pipe(context.output ?? process.stdout);
|
|
1882
|
+
const rl = readline2.createInterface({
|
|
1883
|
+
terminal: true,
|
|
1884
|
+
input,
|
|
1885
|
+
output
|
|
1886
|
+
});
|
|
1887
|
+
output.mute();
|
|
1888
|
+
const screen = new ScreenManager(rl);
|
|
1889
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
1890
|
+
const cancel = () => reject(new CancelPromptError);
|
|
1891
|
+
if (signal) {
|
|
1892
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
1893
|
+
if (signal.aborted) {
|
|
1894
|
+
abort();
|
|
1895
|
+
return Object.assign(promise, { cancel });
|
|
1896
|
+
}
|
|
1897
|
+
signal.addEventListener("abort", abort);
|
|
1898
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
1899
|
+
}
|
|
1900
|
+
cleanups.add(onExit((code, signal) => {
|
|
1901
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));
|
|
1902
|
+
}));
|
|
1903
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
1904
|
+
rl.on("SIGINT", sigint);
|
|
1905
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
1906
|
+
return withHooks(rl, (cycle) => {
|
|
1907
|
+
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
1908
|
+
rl.on("close", hooksCleanup);
|
|
1909
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
1910
|
+
const startCycle = () => {
|
|
1911
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
1912
|
+
rl.input.on("keypress", checkCursorPos);
|
|
1913
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
1914
|
+
let pendingDone = null;
|
|
1915
|
+
cycle(() => {
|
|
1916
|
+
let effectsSettled = false;
|
|
1917
|
+
try {
|
|
1918
|
+
const nextView = view(config, (value) => {
|
|
1919
|
+
if (effectsSettled) {
|
|
1920
|
+
resolve(value);
|
|
1921
|
+
} else {
|
|
1922
|
+
pendingDone = { value };
|
|
1923
|
+
}
|
|
1924
|
+
});
|
|
1925
|
+
if (nextView === undefined) {
|
|
1926
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
1927
|
+
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
1928
|
+
callerFilename = path.resolve(callerFilename);
|
|
1929
|
+
}
|
|
1930
|
+
throw new Error(`Prompt functions must return a string.
|
|
1931
|
+
at ${callerFilename}`);
|
|
1932
|
+
}
|
|
1933
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
1934
|
+
screen.render(content, bottomContent);
|
|
1935
|
+
effectScheduler.run();
|
|
1936
|
+
} catch (error) {
|
|
1937
|
+
reject(error);
|
|
1938
|
+
}
|
|
1939
|
+
effectsSettled = true;
|
|
1940
|
+
if (pendingDone !== null) {
|
|
1941
|
+
const { value } = pendingDone;
|
|
1942
|
+
pendingDone = null;
|
|
1943
|
+
resolve(value);
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
};
|
|
1947
|
+
if ("readableFlowing" in input) {
|
|
1948
|
+
nativeSetImmediate(startCycle);
|
|
1949
|
+
} else {
|
|
1950
|
+
startCycle();
|
|
1951
|
+
}
|
|
1952
|
+
return Object.assign(promise.then((answer) => {
|
|
1953
|
+
effectScheduler.clearAll();
|
|
1954
|
+
return answer;
|
|
1955
|
+
}, (error) => {
|
|
1956
|
+
effectScheduler.clearAll();
|
|
1957
|
+
throw error;
|
|
1958
|
+
}).finally(() => {
|
|
1959
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
1960
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
1961
|
+
output.end();
|
|
1962
|
+
}).then(() => promise), { cancel });
|
|
1963
|
+
});
|
|
1964
|
+
};
|
|
1965
|
+
return prompt;
|
|
1966
|
+
}
|
|
1967
|
+
// ../../node_modules/@inquirer/checkbox/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
1968
|
+
import { styleText as styleText2 } from "node:util";
|
|
1969
|
+
class Separator {
|
|
1970
|
+
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default5.line));
|
|
1971
|
+
type = "separator";
|
|
1972
|
+
constructor(separator) {
|
|
1973
|
+
if (separator) {
|
|
1974
|
+
this.separator = separator;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
static isSeparator(choice) {
|
|
1978
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
// ../../node_modules/@inquirer/checkbox/dist/index.js
|
|
1982
|
+
import { styleText as styleText3 } from "node:util";
|
|
1983
|
+
var checkboxTheme = {
|
|
1984
|
+
icon: {
|
|
1985
|
+
checked: styleText3("green", dist_default5.circleFilled),
|
|
1986
|
+
unchecked: dist_default5.circle,
|
|
1987
|
+
cursor: dist_default5.pointer,
|
|
1988
|
+
disabledChecked: styleText3("green", dist_default5.circleDouble),
|
|
1989
|
+
disabledUnchecked: "-"
|
|
1990
|
+
},
|
|
1991
|
+
style: {
|
|
1992
|
+
disabled: (text) => styleText3("dim", text),
|
|
1993
|
+
renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
|
|
1994
|
+
description: (text) => styleText3("cyan", text),
|
|
1995
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
|
|
1996
|
+
},
|
|
1997
|
+
i18n: { disabledError: "This option is disabled and cannot be toggled." }
|
|
1998
|
+
};
|
|
1999
|
+
function isSelectable(item) {
|
|
2000
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
2001
|
+
}
|
|
2002
|
+
function isNavigable(item) {
|
|
2003
|
+
return !Separator.isSeparator(item);
|
|
2004
|
+
}
|
|
2005
|
+
function isChecked(item) {
|
|
2006
|
+
return !Separator.isSeparator(item) && item.checked;
|
|
2007
|
+
}
|
|
2008
|
+
function toggle(item) {
|
|
2009
|
+
return isSelectable(item) ? { ...item, checked: !item.checked } : item;
|
|
2010
|
+
}
|
|
2011
|
+
function check(checked) {
|
|
2012
|
+
return function(item) {
|
|
2013
|
+
return isSelectable(item) ? { ...item, checked } : item;
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
function normalizeChoices(choices) {
|
|
2017
|
+
return choices.map((choice) => {
|
|
2018
|
+
if (Separator.isSeparator(choice))
|
|
2019
|
+
return choice;
|
|
2020
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
2021
|
+
const name = String(choice);
|
|
2022
|
+
return {
|
|
2023
|
+
value: choice,
|
|
2024
|
+
name,
|
|
2025
|
+
short: name,
|
|
2026
|
+
checkedName: name,
|
|
2027
|
+
disabled: false,
|
|
2028
|
+
checked: false
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
const name = choice.name ?? String(choice.value);
|
|
2032
|
+
const normalizedChoice = {
|
|
2033
|
+
value: choice.value,
|
|
2034
|
+
name,
|
|
2035
|
+
short: choice.short ?? name,
|
|
2036
|
+
checkedName: choice.checkedName ?? name,
|
|
2037
|
+
disabled: choice.disabled ?? false,
|
|
2038
|
+
checked: choice.checked ?? false
|
|
2039
|
+
};
|
|
2040
|
+
if (choice.description) {
|
|
2041
|
+
normalizedChoice.description = choice.description;
|
|
2042
|
+
}
|
|
2043
|
+
return normalizedChoice;
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
var dist_default = createPrompt((config, done) => {
|
|
2047
|
+
const { pageSize = 7, loop = true, required, validate = () => true } = config;
|
|
2048
|
+
const shortcuts = { all: "a", invert: "i", ...config.shortcuts };
|
|
2049
|
+
const theme = makeTheme(checkboxTheme, config.theme);
|
|
2050
|
+
const { keybindings } = theme;
|
|
2051
|
+
const [status, setStatus] = useState("idle");
|
|
2052
|
+
const prefix = usePrefix({ status, theme });
|
|
2053
|
+
const [items, setItems] = useState(normalizeChoices(config.choices));
|
|
2054
|
+
const bounds = useMemo(() => {
|
|
2055
|
+
const first = items.findIndex(isNavigable);
|
|
2056
|
+
const last = items.findLastIndex(isNavigable);
|
|
2057
|
+
if (first === -1) {
|
|
2058
|
+
throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
|
|
2059
|
+
}
|
|
2060
|
+
return { first, last };
|
|
2061
|
+
}, [items]);
|
|
2062
|
+
const [active, setActive] = useState(bounds.first);
|
|
2063
|
+
const [errorMsg, setError] = useState();
|
|
2064
|
+
useKeypress(async (key) => {
|
|
2065
|
+
if (isEnterKey(key)) {
|
|
2066
|
+
const selection = items.filter(isChecked);
|
|
2067
|
+
const isValid = await validate([...selection]);
|
|
2068
|
+
if (required && !selection.length) {
|
|
2069
|
+
setError("At least one choice must be selected");
|
|
2070
|
+
} else if (isValid === true) {
|
|
2071
|
+
setStatus("done");
|
|
2072
|
+
done(selection.map((choice) => choice.value));
|
|
2073
|
+
} else {
|
|
2074
|
+
setError(isValid || "You must select a valid value");
|
|
2075
|
+
}
|
|
2076
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
2077
|
+
if (errorMsg) {
|
|
2078
|
+
setError(undefined);
|
|
2079
|
+
}
|
|
2080
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
2081
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
2082
|
+
let next = active;
|
|
2083
|
+
do {
|
|
2084
|
+
next = (next + offset + items.length) % items.length;
|
|
2085
|
+
} while (!isNavigable(items[next]));
|
|
2086
|
+
setActive(next);
|
|
2087
|
+
}
|
|
2088
|
+
} else if (isSpaceKey(key)) {
|
|
2089
|
+
const activeItem = items[active];
|
|
2090
|
+
if (activeItem && !Separator.isSeparator(activeItem)) {
|
|
2091
|
+
if (activeItem.disabled) {
|
|
2092
|
+
setError(theme.i18n.disabledError);
|
|
2093
|
+
} else {
|
|
2094
|
+
setError(undefined);
|
|
2095
|
+
setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
} else if (key.name === shortcuts.all) {
|
|
2099
|
+
const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
|
|
2100
|
+
setItems(items.map(check(selectAll)));
|
|
2101
|
+
} else if (key.name === shortcuts.invert) {
|
|
2102
|
+
setItems(items.map(toggle));
|
|
2103
|
+
} else if (isNumberKey(key)) {
|
|
2104
|
+
const selectedIndex = Number(key.name) - 1;
|
|
2105
|
+
let selectableIndex = -1;
|
|
2106
|
+
const position = items.findIndex((item) => {
|
|
2107
|
+
if (Separator.isSeparator(item))
|
|
2108
|
+
return false;
|
|
2109
|
+
selectableIndex++;
|
|
2110
|
+
return selectableIndex === selectedIndex;
|
|
2111
|
+
});
|
|
2112
|
+
const selectedItem = items[position];
|
|
2113
|
+
if (selectedItem && isSelectable(selectedItem)) {
|
|
2114
|
+
setActive(position);
|
|
2115
|
+
setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
});
|
|
2119
|
+
const message = theme.style.message(config.message, status);
|
|
2120
|
+
let description;
|
|
2121
|
+
const page = usePagination({
|
|
2122
|
+
items,
|
|
2123
|
+
active,
|
|
2124
|
+
renderItem({ item, isActive }) {
|
|
2125
|
+
if (Separator.isSeparator(item)) {
|
|
2126
|
+
return ` ${item.separator}`;
|
|
2127
|
+
}
|
|
2128
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
2129
|
+
if (item.disabled) {
|
|
2130
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
2131
|
+
const checkbox = item.checked ? theme.icon.disabledChecked : theme.icon.disabledUnchecked;
|
|
2132
|
+
return theme.style.disabled(`${cursor}${checkbox} ${item.name} ${disabledLabel}`);
|
|
2133
|
+
}
|
|
2134
|
+
if (isActive) {
|
|
2135
|
+
description = item.description;
|
|
2136
|
+
}
|
|
2137
|
+
const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
|
|
2138
|
+
const name = item.checked ? item.checkedName : item.name;
|
|
2139
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
2140
|
+
return color(`${cursor}${checkbox} ${name}`);
|
|
2141
|
+
},
|
|
2142
|
+
pageSize,
|
|
2143
|
+
loop
|
|
2144
|
+
});
|
|
2145
|
+
if (status === "done") {
|
|
2146
|
+
const selection = items.filter(isChecked);
|
|
2147
|
+
const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
|
|
2148
|
+
return [prefix, message, answer].filter(Boolean).join(" ");
|
|
2149
|
+
}
|
|
2150
|
+
const keys = [
|
|
2151
|
+
["↑↓", "navigate"],
|
|
2152
|
+
["space", "select"]
|
|
2153
|
+
];
|
|
2154
|
+
if (shortcuts.all)
|
|
2155
|
+
keys.push([shortcuts.all, "all"]);
|
|
2156
|
+
if (shortcuts.invert)
|
|
2157
|
+
keys.push([shortcuts.invert, "invert"]);
|
|
2158
|
+
keys.push(["⏎", "submit"]);
|
|
2159
|
+
const helpLine = theme.style.keysHelpTip(keys);
|
|
2160
|
+
const lines = [
|
|
2161
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
2162
|
+
page,
|
|
2163
|
+
" ",
|
|
2164
|
+
description ? theme.style.description(description) : "",
|
|
2165
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
2166
|
+
helpLine
|
|
2167
|
+
].filter(Boolean).join(`
|
|
2168
|
+
`).trimEnd();
|
|
2169
|
+
return `${lines}${cursorHide}`;
|
|
2170
|
+
});
|
|
2171
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/key.js
|
|
2172
|
+
var keybindings2 = ["emacs", "vim"];
|
|
2173
|
+
var keybindingLookup2 = new Set(keybindings2);
|
|
2174
|
+
function isKeybinding2(value) {
|
|
2175
|
+
return keybindingLookup2.has(value);
|
|
2176
|
+
}
|
|
2177
|
+
function getDefaultKeybindings2() {
|
|
2178
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
2179
|
+
if (!env)
|
|
2180
|
+
return [];
|
|
2181
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding2)));
|
|
2182
|
+
}
|
|
2183
|
+
var isTabKey2 = (key) => key.name === "tab";
|
|
2184
|
+
var isEnterKey2 = (key) => key.name === "enter" || key.name === "return";
|
|
2185
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/errors.js
|
|
2186
|
+
class AbortPromptError2 extends Error {
|
|
2187
|
+
name = "AbortPromptError";
|
|
2188
|
+
message = "Prompt was aborted";
|
|
2189
|
+
constructor(options) {
|
|
2190
|
+
super();
|
|
2191
|
+
this.cause = options?.cause;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
class CancelPromptError2 extends Error {
|
|
2196
|
+
name = "CancelPromptError";
|
|
2197
|
+
message = "Prompt was canceled";
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
class ExitPromptError2 extends Error {
|
|
2201
|
+
name = "ExitPromptError";
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
class HookError2 extends Error {
|
|
2205
|
+
name = "HookError";
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
class ValidationError2 extends Error {
|
|
2209
|
+
name = "ValidationError";
|
|
2210
|
+
}
|
|
2211
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
2212
|
+
import { AsyncResource as AsyncResource5 } from "node:async_hooks";
|
|
2213
|
+
|
|
2214
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
2215
|
+
import { AsyncLocalStorage as AsyncLocalStorage2, AsyncResource as AsyncResource4 } from "node:async_hooks";
|
|
2216
|
+
var hookStorage2 = new AsyncLocalStorage2;
|
|
2217
|
+
function createStore2(rl) {
|
|
2218
|
+
const store = {
|
|
2219
|
+
rl,
|
|
2220
|
+
hooks: [],
|
|
2221
|
+
hooksCleanup: [],
|
|
2222
|
+
hooksEffect: [],
|
|
2223
|
+
index: 0,
|
|
2224
|
+
handleChange() {}
|
|
2225
|
+
};
|
|
2226
|
+
return store;
|
|
2227
|
+
}
|
|
2228
|
+
function withHooks2(rl, cb) {
|
|
2229
|
+
const store = createStore2(rl);
|
|
2230
|
+
return hookStorage2.run(store, () => {
|
|
2231
|
+
function cycle(render) {
|
|
2232
|
+
store.handleChange = () => {
|
|
2233
|
+
store.index = 0;
|
|
2234
|
+
render();
|
|
2235
|
+
};
|
|
2236
|
+
store.handleChange();
|
|
2237
|
+
}
|
|
2238
|
+
return cb(cycle);
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
function getStore2() {
|
|
2242
|
+
const store = hookStorage2.getStore();
|
|
2243
|
+
if (!store) {
|
|
2244
|
+
throw new HookError2("[Inquirer] Hook functions can only be called from within a prompt");
|
|
2245
|
+
}
|
|
2246
|
+
return store;
|
|
2247
|
+
}
|
|
2248
|
+
function readline3() {
|
|
2249
|
+
return getStore2().rl;
|
|
2250
|
+
}
|
|
2251
|
+
function withUpdates2(fn) {
|
|
2252
|
+
const wrapped = (...args) => {
|
|
2253
|
+
const store = getStore2();
|
|
2254
|
+
let shouldUpdate = false;
|
|
2255
|
+
const oldHandleChange = store.handleChange;
|
|
2256
|
+
store.handleChange = () => {
|
|
2257
|
+
shouldUpdate = true;
|
|
2258
|
+
};
|
|
2259
|
+
const returnValue = fn(...args);
|
|
2260
|
+
if (shouldUpdate) {
|
|
2261
|
+
oldHandleChange();
|
|
2262
|
+
}
|
|
2263
|
+
store.handleChange = oldHandleChange;
|
|
2264
|
+
return returnValue;
|
|
2265
|
+
};
|
|
2266
|
+
return AsyncResource4.bind(wrapped);
|
|
2267
|
+
}
|
|
2268
|
+
function withPointer2(cb) {
|
|
2269
|
+
const store = getStore2();
|
|
2270
|
+
const { index } = store;
|
|
2271
|
+
const pointer = {
|
|
2272
|
+
get() {
|
|
2273
|
+
return store.hooks[index];
|
|
2274
|
+
},
|
|
2275
|
+
set(value) {
|
|
2276
|
+
store.hooks[index] = value;
|
|
2277
|
+
},
|
|
2278
|
+
initialized: index in store.hooks
|
|
2279
|
+
};
|
|
2280
|
+
const returnValue = cb(pointer);
|
|
2281
|
+
store.index++;
|
|
2282
|
+
return returnValue;
|
|
2283
|
+
}
|
|
2284
|
+
function handleChange2() {
|
|
2285
|
+
getStore2().handleChange();
|
|
2286
|
+
}
|
|
2287
|
+
var effectScheduler2 = {
|
|
2288
|
+
queue(cb) {
|
|
2289
|
+
const store = getStore2();
|
|
2290
|
+
const { index } = store;
|
|
2291
|
+
store.hooksEffect.push(() => {
|
|
2292
|
+
store.hooksCleanup[index]?.();
|
|
2293
|
+
const cleanFn = cb(readline3());
|
|
2294
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
2295
|
+
throw new ValidationError2("useEffect return value must be a cleanup function or nothing.");
|
|
2296
|
+
}
|
|
2297
|
+
store.hooksCleanup[index] = cleanFn;
|
|
2298
|
+
});
|
|
2299
|
+
},
|
|
2300
|
+
run() {
|
|
2301
|
+
const store = getStore2();
|
|
2302
|
+
withUpdates2(() => {
|
|
2303
|
+
store.hooksEffect.forEach((effect) => {
|
|
2304
|
+
effect();
|
|
2305
|
+
});
|
|
2306
|
+
store.hooksEffect.length = 0;
|
|
2307
|
+
})();
|
|
2308
|
+
},
|
|
2309
|
+
clearAll() {
|
|
2310
|
+
const store = getStore2();
|
|
2311
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
2312
|
+
cleanFn?.();
|
|
2313
|
+
});
|
|
2314
|
+
store.hooksEffect.length = 0;
|
|
2315
|
+
store.hooksCleanup.length = 0;
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
|
|
2319
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
2320
|
+
function isFactory2(value) {
|
|
2321
|
+
return typeof value === "function";
|
|
2322
|
+
}
|
|
2323
|
+
function useState2(defaultValue) {
|
|
2324
|
+
return withPointer2((pointer) => {
|
|
2325
|
+
const setState = AsyncResource5.bind(function setState(newValue) {
|
|
2326
|
+
if (pointer.get() !== newValue) {
|
|
2327
|
+
pointer.set(newValue);
|
|
2328
|
+
handleChange2();
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2331
|
+
if (pointer.initialized) {
|
|
2332
|
+
return [pointer.get(), setState];
|
|
2333
|
+
}
|
|
2334
|
+
const value = isFactory2(defaultValue) ? defaultValue() : defaultValue;
|
|
2335
|
+
pointer.set(value);
|
|
2336
|
+
return [value, setState];
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
2341
|
+
function useEffect3(cb, depArray) {
|
|
2342
|
+
withPointer2((pointer) => {
|
|
2343
|
+
const oldDeps = pointer.get();
|
|
2344
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
2345
|
+
if (hasChanged) {
|
|
2346
|
+
effectScheduler2.queue(cb);
|
|
2347
|
+
}
|
|
2348
|
+
pointer.set(depArray);
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/theme.js
|
|
2353
|
+
import { styleText as styleText4 } from "node:util";
|
|
2354
|
+
var defaultTheme2 = {
|
|
2355
|
+
prefix: {
|
|
2356
|
+
idle: styleText4("blue", "?"),
|
|
2357
|
+
done: styleText4("green", dist_default5.tick)
|
|
2358
|
+
},
|
|
2359
|
+
spinner: {
|
|
2360
|
+
interval: 80,
|
|
2361
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText4("yellow", frame))
|
|
2362
|
+
},
|
|
2363
|
+
keybindings: [],
|
|
2364
|
+
style: {
|
|
2365
|
+
answer: (text) => styleText4("cyan", text),
|
|
2366
|
+
message: (text) => styleText4("bold", text),
|
|
2367
|
+
error: (text) => styleText4("red", `> ${text}`),
|
|
2368
|
+
defaultAnswer: (text) => styleText4("dim", `(${text})`),
|
|
2369
|
+
help: (text) => styleText4("dim", text),
|
|
2370
|
+
highlight: (text) => styleText4("cyan", text),
|
|
2371
|
+
key: (text) => styleText4("cyan", styleText4("bold", `<${text}>`))
|
|
2372
|
+
}
|
|
2373
|
+
};
|
|
2374
|
+
function getDefaultTheme2() {
|
|
2375
|
+
return {
|
|
2376
|
+
...defaultTheme2,
|
|
2377
|
+
keybindings: getDefaultKeybindings2()
|
|
2378
|
+
};
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
2382
|
+
function isPlainObject2(value) {
|
|
2383
|
+
if (typeof value !== "object" || value === null)
|
|
2384
|
+
return false;
|
|
2385
|
+
let proto = value;
|
|
2386
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2387
|
+
proto = Object.getPrototypeOf(proto);
|
|
2388
|
+
}
|
|
2389
|
+
return Object.getPrototypeOf(value) === proto;
|
|
2390
|
+
}
|
|
2391
|
+
function deepMerge2(...objects) {
|
|
2392
|
+
const output = {};
|
|
2393
|
+
for (const obj of objects) {
|
|
2394
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2395
|
+
const prevValue = output[key];
|
|
2396
|
+
output[key] = isPlainObject2(prevValue) && isPlainObject2(value) ? deepMerge2(prevValue, value) : value;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
return output;
|
|
2400
|
+
}
|
|
2401
|
+
function makeTheme2(...themes) {
|
|
2402
|
+
const themesToMerge = [
|
|
2403
|
+
getDefaultTheme2(),
|
|
2404
|
+
...themes.filter((theme) => theme != null)
|
|
2405
|
+
];
|
|
2406
|
+
return deepMerge2(...themesToMerge);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
2410
|
+
function usePrefix2({ status = "idle", theme }) {
|
|
2411
|
+
const [showLoader, setShowLoader] = useState2(false);
|
|
2412
|
+
const [tick, setTick] = useState2(0);
|
|
2413
|
+
const { prefix, spinner } = makeTheme2(theme);
|
|
2414
|
+
useEffect3(() => {
|
|
2415
|
+
if (status === "loading") {
|
|
2416
|
+
let tickInterval;
|
|
2417
|
+
let inc = -1;
|
|
2418
|
+
const delayTimeout = setTimeout(() => {
|
|
2419
|
+
setShowLoader(true);
|
|
2420
|
+
tickInterval = setInterval(() => {
|
|
2421
|
+
inc = inc + 1;
|
|
2422
|
+
setTick(inc % spinner.frames.length);
|
|
2423
|
+
}, spinner.interval);
|
|
2424
|
+
}, 300);
|
|
2425
|
+
return () => {
|
|
2426
|
+
clearTimeout(delayTimeout);
|
|
2427
|
+
clearInterval(tickInterval);
|
|
2428
|
+
};
|
|
2429
|
+
} else {
|
|
2430
|
+
setShowLoader(false);
|
|
2431
|
+
}
|
|
2432
|
+
}, [status]);
|
|
2433
|
+
if (showLoader) {
|
|
2434
|
+
return spinner.frames[tick];
|
|
2435
|
+
}
|
|
2436
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
2437
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
2438
|
+
}
|
|
2439
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
2440
|
+
function useRef3(val) {
|
|
2441
|
+
return useState2({ current: val })[0];
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
2445
|
+
function useKeypress2(userHandler) {
|
|
2446
|
+
const signal = useRef3(userHandler);
|
|
2447
|
+
signal.current = userHandler;
|
|
2448
|
+
useEffect3((rl) => {
|
|
2449
|
+
let ignore = false;
|
|
2450
|
+
const handler = withUpdates2((_input, event) => {
|
|
2451
|
+
if (ignore)
|
|
2452
|
+
return;
|
|
2453
|
+
signal.current(event, rl);
|
|
2454
|
+
});
|
|
2455
|
+
rl.input.on("keypress", handler);
|
|
2456
|
+
return () => {
|
|
2457
|
+
ignore = true;
|
|
2458
|
+
rl.input.removeListener("keypress", handler);
|
|
2459
|
+
};
|
|
2460
|
+
}, []);
|
|
2461
|
+
}
|
|
2462
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2463
|
+
var import_mute_stream2 = __toESM(require_lib2(), 1);
|
|
2464
|
+
import * as readline4 from "node:readline";
|
|
2465
|
+
import { AsyncResource as AsyncResource6 } from "node:async_hooks";
|
|
2466
|
+
|
|
2467
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/signals.js
|
|
2468
|
+
var signals2 = [];
|
|
2469
|
+
signals2.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
2470
|
+
if (process.platform !== "win32") {
|
|
2471
|
+
signals2.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
2472
|
+
}
|
|
2473
|
+
if (process.platform === "linux") {
|
|
2474
|
+
signals2.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/index.js
|
|
2478
|
+
var processOk2 = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
|
|
2479
|
+
var kExitEmitter2 = Symbol.for("signal-exit emitter");
|
|
2480
|
+
var global2 = globalThis;
|
|
2481
|
+
var ObjectDefineProperty2 = Object.defineProperty.bind(Object);
|
|
2482
|
+
|
|
2483
|
+
class Emitter2 {
|
|
2484
|
+
emitted = {
|
|
2485
|
+
afterExit: false,
|
|
2486
|
+
exit: false
|
|
2487
|
+
};
|
|
2488
|
+
listeners = {
|
|
2489
|
+
afterExit: [],
|
|
2490
|
+
exit: []
|
|
2491
|
+
};
|
|
2492
|
+
count = 0;
|
|
2493
|
+
id = Math.random();
|
|
2494
|
+
constructor() {
|
|
2495
|
+
if (global2[kExitEmitter2]) {
|
|
2496
|
+
return global2[kExitEmitter2];
|
|
2497
|
+
}
|
|
2498
|
+
ObjectDefineProperty2(global2, kExitEmitter2, {
|
|
2499
|
+
value: this,
|
|
2500
|
+
writable: false,
|
|
2501
|
+
enumerable: false,
|
|
2502
|
+
configurable: false
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
on(ev, fn) {
|
|
2506
|
+
this.listeners[ev].push(fn);
|
|
2507
|
+
}
|
|
2508
|
+
removeListener(ev, fn) {
|
|
2509
|
+
const list = this.listeners[ev];
|
|
2510
|
+
const i = list.indexOf(fn);
|
|
2511
|
+
if (i === -1) {
|
|
2512
|
+
return;
|
|
2513
|
+
}
|
|
2514
|
+
if (i === 0 && list.length === 1) {
|
|
2515
|
+
list.length = 0;
|
|
2516
|
+
} else {
|
|
2517
|
+
list.splice(i, 1);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
emit(ev, code, signal) {
|
|
2521
|
+
if (this.emitted[ev]) {
|
|
2522
|
+
return false;
|
|
2523
|
+
}
|
|
2524
|
+
this.emitted[ev] = true;
|
|
2525
|
+
let ret = false;
|
|
2526
|
+
for (const fn of this.listeners[ev]) {
|
|
2527
|
+
ret = fn(code, signal) === true || ret;
|
|
2528
|
+
}
|
|
2529
|
+
if (ev === "exit") {
|
|
2530
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
2531
|
+
}
|
|
2532
|
+
return ret;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
class SignalExitBase2 {
|
|
2537
|
+
}
|
|
2538
|
+
var signalExitWrap2 = (handler) => {
|
|
2539
|
+
return {
|
|
2540
|
+
onExit(cb, opts) {
|
|
2541
|
+
return handler.onExit(cb, opts);
|
|
2542
|
+
},
|
|
2543
|
+
load() {
|
|
2544
|
+
return handler.load();
|
|
2545
|
+
},
|
|
2546
|
+
unload() {
|
|
2547
|
+
return handler.unload();
|
|
2548
|
+
}
|
|
2549
|
+
};
|
|
2550
|
+
};
|
|
2551
|
+
|
|
2552
|
+
class SignalExitFallback2 extends SignalExitBase2 {
|
|
2553
|
+
onExit() {
|
|
2554
|
+
return () => {};
|
|
2555
|
+
}
|
|
2556
|
+
load() {}
|
|
2557
|
+
unload() {}
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
class SignalExit2 extends SignalExitBase2 {
|
|
2561
|
+
#hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
2562
|
+
#emitter = new Emitter2;
|
|
2563
|
+
#process;
|
|
2564
|
+
#originalProcessEmit;
|
|
2565
|
+
#originalProcessReallyExit;
|
|
2566
|
+
#sigListeners = {};
|
|
2567
|
+
#loaded = false;
|
|
2568
|
+
constructor(process2) {
|
|
2569
|
+
super();
|
|
2570
|
+
this.#process = process2;
|
|
2571
|
+
this.#sigListeners = {};
|
|
2572
|
+
for (const sig of signals2) {
|
|
2573
|
+
this.#sigListeners[sig] = () => {
|
|
2574
|
+
const listeners = this.#process.listeners(sig);
|
|
2575
|
+
let { count } = this.#emitter;
|
|
2576
|
+
const p = process2;
|
|
2577
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
2578
|
+
count += p.__signal_exit_emitter__.count;
|
|
2579
|
+
}
|
|
2580
|
+
if (listeners.length === count) {
|
|
2581
|
+
this.unload();
|
|
2582
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
2583
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
2584
|
+
if (!ret)
|
|
2585
|
+
process2.kill(process2.pid, s);
|
|
2586
|
+
}
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
this.#originalProcessReallyExit = process2.reallyExit;
|
|
2590
|
+
this.#originalProcessEmit = process2.emit;
|
|
2591
|
+
}
|
|
2592
|
+
onExit(cb, opts) {
|
|
2593
|
+
if (!processOk2(this.#process)) {
|
|
2594
|
+
return () => {};
|
|
2595
|
+
}
|
|
2596
|
+
if (this.#loaded === false) {
|
|
2597
|
+
this.load();
|
|
2598
|
+
}
|
|
2599
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
2600
|
+
this.#emitter.on(ev, cb);
|
|
2601
|
+
return () => {
|
|
2602
|
+
this.#emitter.removeListener(ev, cb);
|
|
2603
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
2604
|
+
this.unload();
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
}
|
|
2608
|
+
load() {
|
|
2609
|
+
if (this.#loaded) {
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
this.#loaded = true;
|
|
2613
|
+
this.#emitter.count += 1;
|
|
2614
|
+
for (const sig of signals2) {
|
|
2615
|
+
try {
|
|
2616
|
+
const fn = this.#sigListeners[sig];
|
|
2617
|
+
if (fn)
|
|
2618
|
+
this.#process.on(sig, fn);
|
|
2619
|
+
} catch (_) {}
|
|
2620
|
+
}
|
|
2621
|
+
this.#process.emit = (ev, ...a) => {
|
|
2622
|
+
return this.#processEmit(ev, ...a);
|
|
2623
|
+
};
|
|
2624
|
+
this.#process.reallyExit = (code) => {
|
|
2625
|
+
return this.#processReallyExit(code);
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
unload() {
|
|
2629
|
+
if (!this.#loaded) {
|
|
2630
|
+
return;
|
|
2631
|
+
}
|
|
2632
|
+
this.#loaded = false;
|
|
2633
|
+
signals2.forEach((sig) => {
|
|
2634
|
+
const listener = this.#sigListeners[sig];
|
|
2635
|
+
if (!listener) {
|
|
2636
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
2637
|
+
}
|
|
2638
|
+
try {
|
|
2639
|
+
this.#process.removeListener(sig, listener);
|
|
2640
|
+
} catch (_) {}
|
|
2641
|
+
});
|
|
2642
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
2643
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
2644
|
+
this.#emitter.count -= 1;
|
|
2645
|
+
}
|
|
2646
|
+
#processReallyExit(code) {
|
|
2647
|
+
if (!processOk2(this.#process)) {
|
|
2648
|
+
return 0;
|
|
2649
|
+
}
|
|
2650
|
+
this.#process.exitCode = code || 0;
|
|
2651
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
2652
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
2653
|
+
}
|
|
2654
|
+
#processEmit(ev, ...args) {
|
|
2655
|
+
const og = this.#originalProcessEmit;
|
|
2656
|
+
if (ev === "exit" && processOk2(this.#process)) {
|
|
2657
|
+
if (typeof args[0] === "number") {
|
|
2658
|
+
this.#process.exitCode = args[0];
|
|
2659
|
+
}
|
|
2660
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
2661
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
2662
|
+
return ret;
|
|
2663
|
+
} else {
|
|
2664
|
+
return og.call(this.#process, ev, ...args);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
var process4 = globalThis.process;
|
|
2669
|
+
var {
|
|
2670
|
+
onExit: onExit2,
|
|
2671
|
+
load: load2,
|
|
2672
|
+
unload: unload2
|
|
2673
|
+
} = signalExitWrap2(processOk2(process4) ? new SignalExit2(process4) : new SignalExitFallback2);
|
|
2674
|
+
|
|
2675
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2676
|
+
import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
2677
|
+
|
|
2678
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/utils.js
|
|
2679
|
+
var import_cli_width2 = __toESM(require_cli_width(), 1);
|
|
2680
|
+
function breakLines2(content, width) {
|
|
2681
|
+
return content.split(`
|
|
2682
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split(`
|
|
2683
|
+
`).map((str) => str.trimEnd())).join(`
|
|
2684
|
+
`);
|
|
2685
|
+
}
|
|
2686
|
+
function readlineWidth2() {
|
|
2687
|
+
return import_cli_width2.default({ defaultWidth: 80, output: readline3().output });
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/node_modules/@inquirer/ansi/dist/index.js
|
|
2691
|
+
var ESC3 = "\x1B[";
|
|
2692
|
+
var cursorLeft2 = ESC3 + "G";
|
|
2693
|
+
var cursorHide2 = ESC3 + "?25l";
|
|
2694
|
+
var cursorShow2 = ESC3 + "?25h";
|
|
2695
|
+
var cursorUp2 = (rows = 1) => rows > 0 ? `${ESC3}${rows}A` : "";
|
|
2696
|
+
var cursorDown2 = (rows = 1) => rows > 0 ? `${ESC3}${rows}B` : "";
|
|
2697
|
+
var cursorTo2 = (x, y) => {
|
|
2698
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
2699
|
+
return `${ESC3}${y + 1};${x + 1}H`;
|
|
2700
|
+
}
|
|
2701
|
+
return `${ESC3}${x + 1}G`;
|
|
2702
|
+
};
|
|
2703
|
+
var eraseLine2 = ESC3 + "2K";
|
|
2704
|
+
var eraseLines2 = (lines) => lines > 0 ? (eraseLine2 + cursorUp2(1)).repeat(lines - 1) + eraseLine2 + cursorLeft2 : "";
|
|
2705
|
+
|
|
2706
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2707
|
+
var height2 = (content) => content.split(`
|
|
2708
|
+
`).length;
|
|
2709
|
+
var lastLine2 = (content) => content.split(`
|
|
2710
|
+
`).pop() ?? "";
|
|
2711
|
+
|
|
2712
|
+
class ScreenManager2 {
|
|
2713
|
+
height = 0;
|
|
2714
|
+
extraLinesUnderPrompt = 0;
|
|
2715
|
+
cursorPos;
|
|
2716
|
+
rl;
|
|
2717
|
+
constructor(rl) {
|
|
2718
|
+
this.rl = rl;
|
|
2719
|
+
this.cursorPos = rl.getCursorPos();
|
|
2720
|
+
}
|
|
2721
|
+
write(content) {
|
|
2722
|
+
this.rl.output.unmute();
|
|
2723
|
+
this.rl.output.write(content);
|
|
2724
|
+
this.rl.output.mute();
|
|
2725
|
+
}
|
|
2726
|
+
render(content, bottomContent = "") {
|
|
2727
|
+
const promptLine = lastLine2(content);
|
|
2728
|
+
const rawPromptLine = stripVTControlCharacters2(promptLine);
|
|
2729
|
+
let prompt = rawPromptLine;
|
|
2730
|
+
if (this.rl.line.length > 0) {
|
|
2731
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
2732
|
+
}
|
|
2733
|
+
this.rl.setPrompt(prompt);
|
|
2734
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
2735
|
+
const width = readlineWidth2();
|
|
2736
|
+
content = breakLines2(content, width);
|
|
2737
|
+
bottomContent = breakLines2(bottomContent, width);
|
|
2738
|
+
if (rawPromptLine.length % width === 0) {
|
|
2739
|
+
content += `
|
|
2740
|
+
`;
|
|
2741
|
+
}
|
|
2742
|
+
let output = content + (bottomContent ? `
|
|
2743
|
+
` + bottomContent : "");
|
|
2744
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
2745
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height2(bottomContent) : 0);
|
|
2746
|
+
if (bottomContentHeight > 0)
|
|
2747
|
+
output += cursorUp2(bottomContentHeight);
|
|
2748
|
+
output += cursorTo2(this.cursorPos.cols);
|
|
2749
|
+
this.write(cursorDown2(this.extraLinesUnderPrompt) + eraseLines2(this.height) + output);
|
|
2750
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
2751
|
+
this.height = height2(output);
|
|
2752
|
+
}
|
|
2753
|
+
checkCursorPos() {
|
|
2754
|
+
const cursorPos = this.rl.getCursorPos();
|
|
2755
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
2756
|
+
this.write(cursorTo2(cursorPos.cols));
|
|
2757
|
+
this.cursorPos = cursorPos;
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
done({ clearContent }) {
|
|
2761
|
+
this.rl.setPrompt("");
|
|
2762
|
+
let output = cursorDown2(this.extraLinesUnderPrompt);
|
|
2763
|
+
output += clearContent ? eraseLines2(this.height) : `
|
|
2764
|
+
`;
|
|
2765
|
+
output += cursorLeft2;
|
|
2766
|
+
output += cursorShow2;
|
|
2767
|
+
this.write(output);
|
|
2768
|
+
this.rl.close();
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
2773
|
+
class PromisePolyfill2 extends Promise {
|
|
2774
|
+
static withResolver() {
|
|
2775
|
+
let resolve;
|
|
2776
|
+
let reject;
|
|
2777
|
+
const promise = new Promise((res, rej) => {
|
|
2778
|
+
resolve = res;
|
|
2779
|
+
reject = rej;
|
|
2780
|
+
});
|
|
2781
|
+
return { promise, resolve, reject };
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
// ../../node_modules/@inquirer/confirm/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2786
|
+
import path2 from "node:path";
|
|
2787
|
+
var nativeSetImmediate2 = globalThis.setImmediate;
|
|
2788
|
+
function getCallSites2() {
|
|
2789
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
2790
|
+
let result = [];
|
|
2791
|
+
try {
|
|
2792
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
2793
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
2794
|
+
result = callSitesWithoutCurrent;
|
|
2795
|
+
return callSitesWithoutCurrent;
|
|
2796
|
+
};
|
|
2797
|
+
new Error().stack;
|
|
2798
|
+
} catch {
|
|
2799
|
+
return result;
|
|
2800
|
+
}
|
|
2801
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
2802
|
+
return result;
|
|
2803
|
+
}
|
|
2804
|
+
function createPrompt2(view) {
|
|
2805
|
+
const callSites = getCallSites2();
|
|
2806
|
+
const prompt = (config, context = {}) => {
|
|
2807
|
+
const { input = process.stdin, signal } = context;
|
|
2808
|
+
const cleanups = new Set;
|
|
2809
|
+
const output = new import_mute_stream2.default;
|
|
2810
|
+
output.pipe(context.output ?? process.stdout);
|
|
2811
|
+
const rl = readline4.createInterface({
|
|
2812
|
+
terminal: true,
|
|
2813
|
+
input,
|
|
2814
|
+
output
|
|
2815
|
+
});
|
|
2816
|
+
output.mute();
|
|
2817
|
+
const screen = new ScreenManager2(rl);
|
|
2818
|
+
const { promise, resolve, reject } = PromisePolyfill2.withResolver();
|
|
2819
|
+
const cancel = () => reject(new CancelPromptError2);
|
|
2820
|
+
if (signal) {
|
|
2821
|
+
const abort = () => reject(new AbortPromptError2({ cause: signal.reason }));
|
|
2822
|
+
if (signal.aborted) {
|
|
2823
|
+
abort();
|
|
2824
|
+
return Object.assign(promise, { cancel });
|
|
2825
|
+
}
|
|
2826
|
+
signal.addEventListener("abort", abort);
|
|
2827
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
2828
|
+
}
|
|
2829
|
+
cleanups.add(onExit2((code, signal) => {
|
|
2830
|
+
reject(new ExitPromptError2(`User force closed the prompt with ${code} ${signal}`));
|
|
2831
|
+
}));
|
|
2832
|
+
const sigint = () => reject(new ExitPromptError2(`User force closed the prompt with SIGINT`));
|
|
2833
|
+
rl.on("SIGINT", sigint);
|
|
2834
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
2835
|
+
return withHooks2(rl, (cycle) => {
|
|
2836
|
+
const hooksCleanup = AsyncResource6.bind(() => effectScheduler2.clearAll());
|
|
2837
|
+
rl.on("close", hooksCleanup);
|
|
2838
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
2839
|
+
const startCycle = () => {
|
|
2840
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
2841
|
+
rl.input.on("keypress", checkCursorPos);
|
|
2842
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
2843
|
+
let pendingDone = null;
|
|
2844
|
+
cycle(() => {
|
|
2845
|
+
let effectsSettled = false;
|
|
2846
|
+
try {
|
|
2847
|
+
const nextView = view(config, (value) => {
|
|
2848
|
+
if (effectsSettled) {
|
|
2849
|
+
resolve(value);
|
|
2850
|
+
} else {
|
|
2851
|
+
pendingDone = { value };
|
|
2852
|
+
}
|
|
2853
|
+
});
|
|
2854
|
+
if (nextView === undefined) {
|
|
2855
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
2856
|
+
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
2857
|
+
callerFilename = path2.resolve(callerFilename);
|
|
2858
|
+
}
|
|
2859
|
+
throw new Error(`Prompt functions must return a string.
|
|
2860
|
+
at ${callerFilename}`);
|
|
2861
|
+
}
|
|
2862
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
2863
|
+
screen.render(content, bottomContent);
|
|
2864
|
+
effectScheduler2.run();
|
|
2865
|
+
} catch (error) {
|
|
2866
|
+
reject(error);
|
|
2867
|
+
}
|
|
2868
|
+
effectsSettled = true;
|
|
2869
|
+
if (pendingDone !== null) {
|
|
2870
|
+
const { value } = pendingDone;
|
|
2871
|
+
pendingDone = null;
|
|
2872
|
+
resolve(value);
|
|
2873
|
+
}
|
|
2874
|
+
});
|
|
2875
|
+
};
|
|
2876
|
+
if ("readableFlowing" in input) {
|
|
2877
|
+
nativeSetImmediate2(startCycle);
|
|
2878
|
+
} else {
|
|
2879
|
+
startCycle();
|
|
2880
|
+
}
|
|
2881
|
+
return Object.assign(promise.then((answer) => {
|
|
2882
|
+
effectScheduler2.clearAll();
|
|
2883
|
+
return answer;
|
|
2884
|
+
}, (error) => {
|
|
2885
|
+
effectScheduler2.clearAll();
|
|
2886
|
+
throw error;
|
|
2887
|
+
}).finally(() => {
|
|
2888
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
2889
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
2890
|
+
output.end();
|
|
2891
|
+
}).then(() => promise), { cancel });
|
|
2892
|
+
});
|
|
2893
|
+
};
|
|
2894
|
+
return prompt;
|
|
2895
|
+
}
|
|
2896
|
+
// ../../node_modules/@inquirer/confirm/dist/index.js
|
|
2897
|
+
function getBooleanValue(value, defaultValue) {
|
|
2898
|
+
let answer = defaultValue !== false;
|
|
2899
|
+
if (/^(y|yes)/i.test(value))
|
|
2900
|
+
answer = true;
|
|
2901
|
+
else if (/^(n|no)/i.test(value))
|
|
2902
|
+
answer = false;
|
|
2903
|
+
return answer;
|
|
2904
|
+
}
|
|
2905
|
+
function boolToString(value) {
|
|
2906
|
+
return value ? "Yes" : "No";
|
|
2907
|
+
}
|
|
2908
|
+
var dist_default2 = createPrompt2((config, done) => {
|
|
2909
|
+
const { transformer = boolToString } = config;
|
|
2910
|
+
const [status, setStatus] = useState2("idle");
|
|
2911
|
+
const [value, setValue] = useState2("");
|
|
2912
|
+
const theme = makeTheme2(config.theme);
|
|
2913
|
+
const prefix = usePrefix2({ status, theme });
|
|
2914
|
+
useKeypress2((key, rl) => {
|
|
2915
|
+
if (status !== "idle")
|
|
2916
|
+
return;
|
|
2917
|
+
if (isEnterKey2(key)) {
|
|
2918
|
+
const answer = getBooleanValue(value, config.default);
|
|
2919
|
+
setValue(transformer(answer));
|
|
2920
|
+
setStatus("done");
|
|
2921
|
+
done(answer);
|
|
2922
|
+
} else if (isTabKey2(key)) {
|
|
2923
|
+
const answer = boolToString(!getBooleanValue(value, config.default));
|
|
2924
|
+
rl.clearLine(0);
|
|
2925
|
+
rl.write(answer);
|
|
2926
|
+
setValue(answer);
|
|
2927
|
+
} else {
|
|
2928
|
+
setValue(rl.line);
|
|
2929
|
+
}
|
|
2930
|
+
});
|
|
2931
|
+
let formattedValue = value;
|
|
2932
|
+
let defaultValue = "";
|
|
2933
|
+
if (status === "done") {
|
|
2934
|
+
formattedValue = theme.style.answer(value);
|
|
2935
|
+
} else {
|
|
2936
|
+
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
|
|
2937
|
+
}
|
|
2938
|
+
const message = theme.style.message(config.message, status);
|
|
2939
|
+
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
2940
|
+
});
|
|
2941
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/key.js
|
|
2942
|
+
var keybindings3 = ["emacs", "vim"];
|
|
2943
|
+
var keybindingLookup3 = new Set(keybindings3);
|
|
2944
|
+
function isKeybinding3(value) {
|
|
2945
|
+
return keybindingLookup3.has(value);
|
|
2946
|
+
}
|
|
2947
|
+
function getDefaultKeybindings3() {
|
|
2948
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
2949
|
+
if (!env)
|
|
2950
|
+
return [];
|
|
2951
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding3)));
|
|
2952
|
+
}
|
|
2953
|
+
var isBackspaceKey3 = (key) => key.name === "backspace";
|
|
2954
|
+
var isTabKey3 = (key) => key.name === "tab";
|
|
2955
|
+
var isEnterKey3 = (key) => key.name === "enter" || key.name === "return";
|
|
2956
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/errors.js
|
|
2957
|
+
class AbortPromptError3 extends Error {
|
|
2958
|
+
name = "AbortPromptError";
|
|
2959
|
+
message = "Prompt was aborted";
|
|
2960
|
+
constructor(options) {
|
|
2961
|
+
super();
|
|
2962
|
+
this.cause = options?.cause;
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
class CancelPromptError3 extends Error {
|
|
2967
|
+
name = "CancelPromptError";
|
|
2968
|
+
message = "Prompt was canceled";
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
class ExitPromptError3 extends Error {
|
|
2972
|
+
name = "ExitPromptError";
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
class HookError3 extends Error {
|
|
2976
|
+
name = "HookError";
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
class ValidationError3 extends Error {
|
|
2980
|
+
name = "ValidationError";
|
|
2981
|
+
}
|
|
2982
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
2983
|
+
import { AsyncResource as AsyncResource8 } from "node:async_hooks";
|
|
2984
|
+
|
|
2985
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
2986
|
+
import { AsyncLocalStorage as AsyncLocalStorage3, AsyncResource as AsyncResource7 } from "node:async_hooks";
|
|
2987
|
+
var hookStorage3 = new AsyncLocalStorage3;
|
|
2988
|
+
function createStore3(rl) {
|
|
2989
|
+
const store = {
|
|
2990
|
+
rl,
|
|
2991
|
+
hooks: [],
|
|
2992
|
+
hooksCleanup: [],
|
|
2993
|
+
hooksEffect: [],
|
|
2994
|
+
index: 0,
|
|
2995
|
+
handleChange() {}
|
|
2996
|
+
};
|
|
2997
|
+
return store;
|
|
2998
|
+
}
|
|
2999
|
+
function withHooks3(rl, cb) {
|
|
3000
|
+
const store = createStore3(rl);
|
|
3001
|
+
return hookStorage3.run(store, () => {
|
|
3002
|
+
function cycle(render) {
|
|
3003
|
+
store.handleChange = () => {
|
|
3004
|
+
store.index = 0;
|
|
3005
|
+
render();
|
|
3006
|
+
};
|
|
3007
|
+
store.handleChange();
|
|
3008
|
+
}
|
|
3009
|
+
return cb(cycle);
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
function getStore3() {
|
|
3013
|
+
const store = hookStorage3.getStore();
|
|
3014
|
+
if (!store) {
|
|
3015
|
+
throw new HookError3("[Inquirer] Hook functions can only be called from within a prompt");
|
|
3016
|
+
}
|
|
3017
|
+
return store;
|
|
3018
|
+
}
|
|
3019
|
+
function readline5() {
|
|
3020
|
+
return getStore3().rl;
|
|
3021
|
+
}
|
|
3022
|
+
function withUpdates3(fn) {
|
|
3023
|
+
const wrapped = (...args) => {
|
|
3024
|
+
const store = getStore3();
|
|
3025
|
+
let shouldUpdate = false;
|
|
3026
|
+
const oldHandleChange = store.handleChange;
|
|
3027
|
+
store.handleChange = () => {
|
|
3028
|
+
shouldUpdate = true;
|
|
3029
|
+
};
|
|
3030
|
+
const returnValue = fn(...args);
|
|
3031
|
+
if (shouldUpdate) {
|
|
3032
|
+
oldHandleChange();
|
|
3033
|
+
}
|
|
3034
|
+
store.handleChange = oldHandleChange;
|
|
3035
|
+
return returnValue;
|
|
3036
|
+
};
|
|
3037
|
+
return AsyncResource7.bind(wrapped);
|
|
3038
|
+
}
|
|
3039
|
+
function withPointer3(cb) {
|
|
3040
|
+
const store = getStore3();
|
|
3041
|
+
const { index } = store;
|
|
3042
|
+
const pointer = {
|
|
3043
|
+
get() {
|
|
3044
|
+
return store.hooks[index];
|
|
3045
|
+
},
|
|
3046
|
+
set(value) {
|
|
3047
|
+
store.hooks[index] = value;
|
|
3048
|
+
},
|
|
3049
|
+
initialized: index in store.hooks
|
|
3050
|
+
};
|
|
3051
|
+
const returnValue = cb(pointer);
|
|
3052
|
+
store.index++;
|
|
3053
|
+
return returnValue;
|
|
3054
|
+
}
|
|
3055
|
+
function handleChange3() {
|
|
3056
|
+
getStore3().handleChange();
|
|
3057
|
+
}
|
|
3058
|
+
var effectScheduler3 = {
|
|
3059
|
+
queue(cb) {
|
|
3060
|
+
const store = getStore3();
|
|
3061
|
+
const { index } = store;
|
|
3062
|
+
store.hooksEffect.push(() => {
|
|
3063
|
+
store.hooksCleanup[index]?.();
|
|
3064
|
+
const cleanFn = cb(readline5());
|
|
3065
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
3066
|
+
throw new ValidationError3("useEffect return value must be a cleanup function or nothing.");
|
|
3067
|
+
}
|
|
3068
|
+
store.hooksCleanup[index] = cleanFn;
|
|
3069
|
+
});
|
|
3070
|
+
},
|
|
3071
|
+
run() {
|
|
3072
|
+
const store = getStore3();
|
|
3073
|
+
withUpdates3(() => {
|
|
3074
|
+
store.hooksEffect.forEach((effect) => {
|
|
3075
|
+
effect();
|
|
3076
|
+
});
|
|
3077
|
+
store.hooksEffect.length = 0;
|
|
3078
|
+
})();
|
|
3079
|
+
},
|
|
3080
|
+
clearAll() {
|
|
3081
|
+
const store = getStore3();
|
|
3082
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
3083
|
+
cleanFn?.();
|
|
3084
|
+
});
|
|
3085
|
+
store.hooksEffect.length = 0;
|
|
3086
|
+
store.hooksCleanup.length = 0;
|
|
3087
|
+
}
|
|
3088
|
+
};
|
|
3089
|
+
|
|
3090
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
3091
|
+
function isFactory3(value) {
|
|
3092
|
+
return typeof value === "function";
|
|
3093
|
+
}
|
|
3094
|
+
function useState3(defaultValue) {
|
|
3095
|
+
return withPointer3((pointer) => {
|
|
3096
|
+
const setState = AsyncResource8.bind(function setState(newValue) {
|
|
3097
|
+
if (pointer.get() !== newValue) {
|
|
3098
|
+
pointer.set(newValue);
|
|
3099
|
+
handleChange3();
|
|
3100
|
+
}
|
|
3101
|
+
});
|
|
3102
|
+
if (pointer.initialized) {
|
|
3103
|
+
return [pointer.get(), setState];
|
|
3104
|
+
}
|
|
3105
|
+
const value = isFactory3(defaultValue) ? defaultValue() : defaultValue;
|
|
3106
|
+
pointer.set(value);
|
|
3107
|
+
return [value, setState];
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
3112
|
+
function useEffect5(cb, depArray) {
|
|
3113
|
+
withPointer3((pointer) => {
|
|
3114
|
+
const oldDeps = pointer.get();
|
|
3115
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
3116
|
+
if (hasChanged) {
|
|
3117
|
+
effectScheduler3.queue(cb);
|
|
3118
|
+
}
|
|
3119
|
+
pointer.set(depArray);
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/theme.js
|
|
3124
|
+
import { styleText as styleText5 } from "node:util";
|
|
3125
|
+
var defaultTheme3 = {
|
|
3126
|
+
prefix: {
|
|
3127
|
+
idle: styleText5("blue", "?"),
|
|
3128
|
+
done: styleText5("green", dist_default5.tick)
|
|
3129
|
+
},
|
|
3130
|
+
spinner: {
|
|
3131
|
+
interval: 80,
|
|
3132
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText5("yellow", frame))
|
|
3133
|
+
},
|
|
3134
|
+
keybindings: [],
|
|
3135
|
+
style: {
|
|
3136
|
+
answer: (text) => styleText5("cyan", text),
|
|
3137
|
+
message: (text) => styleText5("bold", text),
|
|
3138
|
+
error: (text) => styleText5("red", `> ${text}`),
|
|
3139
|
+
defaultAnswer: (text) => styleText5("dim", `(${text})`),
|
|
3140
|
+
help: (text) => styleText5("dim", text),
|
|
3141
|
+
highlight: (text) => styleText5("cyan", text),
|
|
3142
|
+
key: (text) => styleText5("cyan", styleText5("bold", `<${text}>`))
|
|
3143
|
+
}
|
|
3144
|
+
};
|
|
3145
|
+
function getDefaultTheme3() {
|
|
3146
|
+
return {
|
|
3147
|
+
...defaultTheme3,
|
|
3148
|
+
keybindings: getDefaultKeybindings3()
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
3153
|
+
function isPlainObject3(value) {
|
|
3154
|
+
if (typeof value !== "object" || value === null)
|
|
3155
|
+
return false;
|
|
3156
|
+
let proto = value;
|
|
3157
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
3158
|
+
proto = Object.getPrototypeOf(proto);
|
|
3159
|
+
}
|
|
3160
|
+
return Object.getPrototypeOf(value) === proto;
|
|
3161
|
+
}
|
|
3162
|
+
function deepMerge3(...objects) {
|
|
3163
|
+
const output = {};
|
|
3164
|
+
for (const obj of objects) {
|
|
3165
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
3166
|
+
const prevValue = output[key];
|
|
3167
|
+
output[key] = isPlainObject3(prevValue) && isPlainObject3(value) ? deepMerge3(prevValue, value) : value;
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
return output;
|
|
3171
|
+
}
|
|
3172
|
+
function makeTheme3(...themes) {
|
|
3173
|
+
const themesToMerge = [
|
|
3174
|
+
getDefaultTheme3(),
|
|
3175
|
+
...themes.filter((theme) => theme != null)
|
|
3176
|
+
];
|
|
3177
|
+
return deepMerge3(...themesToMerge);
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
3181
|
+
function usePrefix3({ status = "idle", theme }) {
|
|
3182
|
+
const [showLoader, setShowLoader] = useState3(false);
|
|
3183
|
+
const [tick, setTick] = useState3(0);
|
|
3184
|
+
const { prefix, spinner } = makeTheme3(theme);
|
|
3185
|
+
useEffect5(() => {
|
|
3186
|
+
if (status === "loading") {
|
|
3187
|
+
let tickInterval;
|
|
3188
|
+
let inc = -1;
|
|
3189
|
+
const delayTimeout = setTimeout(() => {
|
|
3190
|
+
setShowLoader(true);
|
|
3191
|
+
tickInterval = setInterval(() => {
|
|
3192
|
+
inc = inc + 1;
|
|
3193
|
+
setTick(inc % spinner.frames.length);
|
|
3194
|
+
}, spinner.interval);
|
|
3195
|
+
}, 300);
|
|
3196
|
+
return () => {
|
|
3197
|
+
clearTimeout(delayTimeout);
|
|
3198
|
+
clearInterval(tickInterval);
|
|
3199
|
+
};
|
|
3200
|
+
} else {
|
|
3201
|
+
setShowLoader(false);
|
|
3202
|
+
}
|
|
3203
|
+
}, [status]);
|
|
3204
|
+
if (showLoader) {
|
|
3205
|
+
return spinner.frames[tick];
|
|
3206
|
+
}
|
|
3207
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
3208
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
3209
|
+
}
|
|
3210
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
3211
|
+
function useRef5(val) {
|
|
3212
|
+
return useState3({ current: val })[0];
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
3216
|
+
function useKeypress3(userHandler) {
|
|
3217
|
+
const signal = useRef5(userHandler);
|
|
3218
|
+
signal.current = userHandler;
|
|
3219
|
+
useEffect5((rl) => {
|
|
3220
|
+
let ignore = false;
|
|
3221
|
+
const handler = withUpdates3((_input, event) => {
|
|
3222
|
+
if (ignore)
|
|
3223
|
+
return;
|
|
3224
|
+
signal.current(event, rl);
|
|
3225
|
+
});
|
|
3226
|
+
rl.input.on("keypress", handler);
|
|
3227
|
+
return () => {
|
|
3228
|
+
ignore = true;
|
|
3229
|
+
rl.input.removeListener("keypress", handler);
|
|
3230
|
+
};
|
|
3231
|
+
}, []);
|
|
3232
|
+
}
|
|
3233
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
3234
|
+
var import_mute_stream3 = __toESM(require_lib3(), 1);
|
|
3235
|
+
import * as readline6 from "node:readline";
|
|
3236
|
+
import { AsyncResource as AsyncResource9 } from "node:async_hooks";
|
|
3237
|
+
|
|
3238
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/signals.js
|
|
3239
|
+
var signals3 = [];
|
|
3240
|
+
signals3.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
3241
|
+
if (process.platform !== "win32") {
|
|
3242
|
+
signals3.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
3243
|
+
}
|
|
3244
|
+
if (process.platform === "linux") {
|
|
3245
|
+
signals3.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/index.js
|
|
3249
|
+
var processOk3 = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
|
|
3250
|
+
var kExitEmitter3 = Symbol.for("signal-exit emitter");
|
|
3251
|
+
var global3 = globalThis;
|
|
3252
|
+
var ObjectDefineProperty3 = Object.defineProperty.bind(Object);
|
|
3253
|
+
|
|
3254
|
+
class Emitter3 {
|
|
3255
|
+
emitted = {
|
|
3256
|
+
afterExit: false,
|
|
3257
|
+
exit: false
|
|
3258
|
+
};
|
|
3259
|
+
listeners = {
|
|
3260
|
+
afterExit: [],
|
|
3261
|
+
exit: []
|
|
3262
|
+
};
|
|
3263
|
+
count = 0;
|
|
3264
|
+
id = Math.random();
|
|
3265
|
+
constructor() {
|
|
3266
|
+
if (global3[kExitEmitter3]) {
|
|
3267
|
+
return global3[kExitEmitter3];
|
|
3268
|
+
}
|
|
3269
|
+
ObjectDefineProperty3(global3, kExitEmitter3, {
|
|
3270
|
+
value: this,
|
|
3271
|
+
writable: false,
|
|
3272
|
+
enumerable: false,
|
|
3273
|
+
configurable: false
|
|
3274
|
+
});
|
|
3275
|
+
}
|
|
3276
|
+
on(ev, fn) {
|
|
3277
|
+
this.listeners[ev].push(fn);
|
|
3278
|
+
}
|
|
3279
|
+
removeListener(ev, fn) {
|
|
3280
|
+
const list = this.listeners[ev];
|
|
3281
|
+
const i = list.indexOf(fn);
|
|
3282
|
+
if (i === -1) {
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
if (i === 0 && list.length === 1) {
|
|
3286
|
+
list.length = 0;
|
|
3287
|
+
} else {
|
|
3288
|
+
list.splice(i, 1);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
emit(ev, code, signal) {
|
|
3292
|
+
if (this.emitted[ev]) {
|
|
3293
|
+
return false;
|
|
3294
|
+
}
|
|
3295
|
+
this.emitted[ev] = true;
|
|
3296
|
+
let ret = false;
|
|
3297
|
+
for (const fn of this.listeners[ev]) {
|
|
3298
|
+
ret = fn(code, signal) === true || ret;
|
|
3299
|
+
}
|
|
3300
|
+
if (ev === "exit") {
|
|
3301
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
3302
|
+
}
|
|
3303
|
+
return ret;
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
class SignalExitBase3 {
|
|
3308
|
+
}
|
|
3309
|
+
var signalExitWrap3 = (handler) => {
|
|
3310
|
+
return {
|
|
3311
|
+
onExit(cb, opts) {
|
|
3312
|
+
return handler.onExit(cb, opts);
|
|
3313
|
+
},
|
|
3314
|
+
load() {
|
|
3315
|
+
return handler.load();
|
|
3316
|
+
},
|
|
3317
|
+
unload() {
|
|
3318
|
+
return handler.unload();
|
|
3319
|
+
}
|
|
3320
|
+
};
|
|
3321
|
+
};
|
|
3322
|
+
|
|
3323
|
+
class SignalExitFallback3 extends SignalExitBase3 {
|
|
3324
|
+
onExit() {
|
|
3325
|
+
return () => {};
|
|
3326
|
+
}
|
|
3327
|
+
load() {}
|
|
3328
|
+
unload() {}
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
class SignalExit3 extends SignalExitBase3 {
|
|
3332
|
+
#hupSig = process5.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
3333
|
+
#emitter = new Emitter3;
|
|
3334
|
+
#process;
|
|
3335
|
+
#originalProcessEmit;
|
|
3336
|
+
#originalProcessReallyExit;
|
|
3337
|
+
#sigListeners = {};
|
|
3338
|
+
#loaded = false;
|
|
3339
|
+
constructor(process2) {
|
|
3340
|
+
super();
|
|
3341
|
+
this.#process = process2;
|
|
3342
|
+
this.#sigListeners = {};
|
|
3343
|
+
for (const sig of signals3) {
|
|
3344
|
+
this.#sigListeners[sig] = () => {
|
|
3345
|
+
const listeners = this.#process.listeners(sig);
|
|
3346
|
+
let { count } = this.#emitter;
|
|
3347
|
+
const p = process2;
|
|
3348
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
3349
|
+
count += p.__signal_exit_emitter__.count;
|
|
3350
|
+
}
|
|
3351
|
+
if (listeners.length === count) {
|
|
3352
|
+
this.unload();
|
|
3353
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
3354
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
3355
|
+
if (!ret)
|
|
3356
|
+
process2.kill(process2.pid, s);
|
|
3357
|
+
}
|
|
3358
|
+
};
|
|
3359
|
+
}
|
|
3360
|
+
this.#originalProcessReallyExit = process2.reallyExit;
|
|
3361
|
+
this.#originalProcessEmit = process2.emit;
|
|
3362
|
+
}
|
|
3363
|
+
onExit(cb, opts) {
|
|
3364
|
+
if (!processOk3(this.#process)) {
|
|
3365
|
+
return () => {};
|
|
3366
|
+
}
|
|
3367
|
+
if (this.#loaded === false) {
|
|
3368
|
+
this.load();
|
|
3369
|
+
}
|
|
3370
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
3371
|
+
this.#emitter.on(ev, cb);
|
|
3372
|
+
return () => {
|
|
3373
|
+
this.#emitter.removeListener(ev, cb);
|
|
3374
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
3375
|
+
this.unload();
|
|
3376
|
+
}
|
|
3377
|
+
};
|
|
3378
|
+
}
|
|
3379
|
+
load() {
|
|
3380
|
+
if (this.#loaded) {
|
|
3381
|
+
return;
|
|
3382
|
+
}
|
|
3383
|
+
this.#loaded = true;
|
|
3384
|
+
this.#emitter.count += 1;
|
|
3385
|
+
for (const sig of signals3) {
|
|
3386
|
+
try {
|
|
3387
|
+
const fn = this.#sigListeners[sig];
|
|
3388
|
+
if (fn)
|
|
3389
|
+
this.#process.on(sig, fn);
|
|
3390
|
+
} catch (_) {}
|
|
3391
|
+
}
|
|
3392
|
+
this.#process.emit = (ev, ...a) => {
|
|
3393
|
+
return this.#processEmit(ev, ...a);
|
|
3394
|
+
};
|
|
3395
|
+
this.#process.reallyExit = (code) => {
|
|
3396
|
+
return this.#processReallyExit(code);
|
|
3397
|
+
};
|
|
3398
|
+
}
|
|
3399
|
+
unload() {
|
|
3400
|
+
if (!this.#loaded) {
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
this.#loaded = false;
|
|
3404
|
+
signals3.forEach((sig) => {
|
|
3405
|
+
const listener = this.#sigListeners[sig];
|
|
3406
|
+
if (!listener) {
|
|
3407
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
3408
|
+
}
|
|
3409
|
+
try {
|
|
3410
|
+
this.#process.removeListener(sig, listener);
|
|
3411
|
+
} catch (_) {}
|
|
3412
|
+
});
|
|
3413
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
3414
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
3415
|
+
this.#emitter.count -= 1;
|
|
3416
|
+
}
|
|
3417
|
+
#processReallyExit(code) {
|
|
3418
|
+
if (!processOk3(this.#process)) {
|
|
3419
|
+
return 0;
|
|
3420
|
+
}
|
|
3421
|
+
this.#process.exitCode = code || 0;
|
|
3422
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
3423
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
3424
|
+
}
|
|
3425
|
+
#processEmit(ev, ...args) {
|
|
3426
|
+
const og = this.#originalProcessEmit;
|
|
3427
|
+
if (ev === "exit" && processOk3(this.#process)) {
|
|
3428
|
+
if (typeof args[0] === "number") {
|
|
3429
|
+
this.#process.exitCode = args[0];
|
|
3430
|
+
}
|
|
3431
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
3432
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
3433
|
+
return ret;
|
|
3434
|
+
} else {
|
|
3435
|
+
return og.call(this.#process, ev, ...args);
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
var process5 = globalThis.process;
|
|
3440
|
+
var {
|
|
3441
|
+
onExit: onExit3,
|
|
3442
|
+
load: load3,
|
|
3443
|
+
unload: unload3
|
|
3444
|
+
} = signalExitWrap3(processOk3(process5) ? new SignalExit3(process5) : new SignalExitFallback3);
|
|
3445
|
+
|
|
3446
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
3447
|
+
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
3448
|
+
|
|
3449
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/utils.js
|
|
3450
|
+
var import_cli_width3 = __toESM(require_cli_width(), 1);
|
|
3451
|
+
function breakLines3(content, width) {
|
|
3452
|
+
return content.split(`
|
|
3453
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split(`
|
|
3454
|
+
`).map((str) => str.trimEnd())).join(`
|
|
3455
|
+
`);
|
|
3456
|
+
}
|
|
3457
|
+
function readlineWidth3() {
|
|
3458
|
+
return import_cli_width3.default({ defaultWidth: 80, output: readline5().output });
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/node_modules/@inquirer/ansi/dist/index.js
|
|
3462
|
+
var ESC4 = "\x1B[";
|
|
3463
|
+
var cursorLeft3 = ESC4 + "G";
|
|
3464
|
+
var cursorHide3 = ESC4 + "?25l";
|
|
3465
|
+
var cursorShow3 = ESC4 + "?25h";
|
|
3466
|
+
var cursorUp3 = (rows = 1) => rows > 0 ? `${ESC4}${rows}A` : "";
|
|
3467
|
+
var cursorDown3 = (rows = 1) => rows > 0 ? `${ESC4}${rows}B` : "";
|
|
3468
|
+
var cursorTo3 = (x, y) => {
|
|
3469
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
3470
|
+
return `${ESC4}${y + 1};${x + 1}H`;
|
|
3471
|
+
}
|
|
3472
|
+
return `${ESC4}${x + 1}G`;
|
|
3473
|
+
};
|
|
3474
|
+
var eraseLine3 = ESC4 + "2K";
|
|
3475
|
+
var eraseLines3 = (lines) => lines > 0 ? (eraseLine3 + cursorUp3(1)).repeat(lines - 1) + eraseLine3 + cursorLeft3 : "";
|
|
3476
|
+
|
|
3477
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
3478
|
+
var height3 = (content) => content.split(`
|
|
3479
|
+
`).length;
|
|
3480
|
+
var lastLine3 = (content) => content.split(`
|
|
3481
|
+
`).pop() ?? "";
|
|
3482
|
+
|
|
3483
|
+
class ScreenManager3 {
|
|
3484
|
+
height = 0;
|
|
3485
|
+
extraLinesUnderPrompt = 0;
|
|
3486
|
+
cursorPos;
|
|
3487
|
+
rl;
|
|
3488
|
+
constructor(rl) {
|
|
3489
|
+
this.rl = rl;
|
|
3490
|
+
this.cursorPos = rl.getCursorPos();
|
|
3491
|
+
}
|
|
3492
|
+
write(content) {
|
|
3493
|
+
this.rl.output.unmute();
|
|
3494
|
+
this.rl.output.write(content);
|
|
3495
|
+
this.rl.output.mute();
|
|
3496
|
+
}
|
|
3497
|
+
render(content, bottomContent = "") {
|
|
3498
|
+
const promptLine = lastLine3(content);
|
|
3499
|
+
const rawPromptLine = stripVTControlCharacters3(promptLine);
|
|
3500
|
+
let prompt = rawPromptLine;
|
|
3501
|
+
if (this.rl.line.length > 0) {
|
|
3502
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
3503
|
+
}
|
|
3504
|
+
this.rl.setPrompt(prompt);
|
|
3505
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
3506
|
+
const width = readlineWidth3();
|
|
3507
|
+
content = breakLines3(content, width);
|
|
3508
|
+
bottomContent = breakLines3(bottomContent, width);
|
|
3509
|
+
if (rawPromptLine.length % width === 0) {
|
|
3510
|
+
content += `
|
|
3511
|
+
`;
|
|
3512
|
+
}
|
|
3513
|
+
let output = content + (bottomContent ? `
|
|
3514
|
+
` + bottomContent : "");
|
|
3515
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
3516
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height3(bottomContent) : 0);
|
|
3517
|
+
if (bottomContentHeight > 0)
|
|
3518
|
+
output += cursorUp3(bottomContentHeight);
|
|
3519
|
+
output += cursorTo3(this.cursorPos.cols);
|
|
3520
|
+
this.write(cursorDown3(this.extraLinesUnderPrompt) + eraseLines3(this.height) + output);
|
|
3521
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
3522
|
+
this.height = height3(output);
|
|
3523
|
+
}
|
|
3524
|
+
checkCursorPos() {
|
|
3525
|
+
const cursorPos = this.rl.getCursorPos();
|
|
3526
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
3527
|
+
this.write(cursorTo3(cursorPos.cols));
|
|
3528
|
+
this.cursorPos = cursorPos;
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
done({ clearContent }) {
|
|
3532
|
+
this.rl.setPrompt("");
|
|
3533
|
+
let output = cursorDown3(this.extraLinesUnderPrompt);
|
|
3534
|
+
output += clearContent ? eraseLines3(this.height) : `
|
|
3535
|
+
`;
|
|
3536
|
+
output += cursorLeft3;
|
|
3537
|
+
output += cursorShow3;
|
|
3538
|
+
this.write(output);
|
|
3539
|
+
this.rl.close();
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
3544
|
+
class PromisePolyfill3 extends Promise {
|
|
3545
|
+
static withResolver() {
|
|
3546
|
+
let resolve;
|
|
3547
|
+
let reject;
|
|
3548
|
+
const promise = new Promise((res, rej) => {
|
|
3549
|
+
resolve = res;
|
|
3550
|
+
reject = rej;
|
|
3551
|
+
});
|
|
3552
|
+
return { promise, resolve, reject };
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
// ../../node_modules/@inquirer/input/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
3557
|
+
import path3 from "node:path";
|
|
3558
|
+
var nativeSetImmediate3 = globalThis.setImmediate;
|
|
3559
|
+
function getCallSites3() {
|
|
3560
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
3561
|
+
let result = [];
|
|
3562
|
+
try {
|
|
3563
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
3564
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
3565
|
+
result = callSitesWithoutCurrent;
|
|
3566
|
+
return callSitesWithoutCurrent;
|
|
3567
|
+
};
|
|
3568
|
+
new Error().stack;
|
|
3569
|
+
} catch {
|
|
3570
|
+
return result;
|
|
3571
|
+
}
|
|
3572
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
3573
|
+
return result;
|
|
3574
|
+
}
|
|
3575
|
+
function createPrompt3(view) {
|
|
3576
|
+
const callSites = getCallSites3();
|
|
3577
|
+
const prompt = (config, context = {}) => {
|
|
3578
|
+
const { input = process.stdin, signal } = context;
|
|
3579
|
+
const cleanups = new Set;
|
|
3580
|
+
const output = new import_mute_stream3.default;
|
|
3581
|
+
output.pipe(context.output ?? process.stdout);
|
|
3582
|
+
const rl = readline6.createInterface({
|
|
3583
|
+
terminal: true,
|
|
3584
|
+
input,
|
|
3585
|
+
output
|
|
3586
|
+
});
|
|
3587
|
+
output.mute();
|
|
3588
|
+
const screen = new ScreenManager3(rl);
|
|
3589
|
+
const { promise, resolve, reject } = PromisePolyfill3.withResolver();
|
|
3590
|
+
const cancel = () => reject(new CancelPromptError3);
|
|
3591
|
+
if (signal) {
|
|
3592
|
+
const abort = () => reject(new AbortPromptError3({ cause: signal.reason }));
|
|
3593
|
+
if (signal.aborted) {
|
|
3594
|
+
abort();
|
|
3595
|
+
return Object.assign(promise, { cancel });
|
|
3596
|
+
}
|
|
3597
|
+
signal.addEventListener("abort", abort);
|
|
3598
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
3599
|
+
}
|
|
3600
|
+
cleanups.add(onExit3((code, signal) => {
|
|
3601
|
+
reject(new ExitPromptError3(`User force closed the prompt with ${code} ${signal}`));
|
|
3602
|
+
}));
|
|
3603
|
+
const sigint = () => reject(new ExitPromptError3(`User force closed the prompt with SIGINT`));
|
|
3604
|
+
rl.on("SIGINT", sigint);
|
|
3605
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
3606
|
+
return withHooks3(rl, (cycle) => {
|
|
3607
|
+
const hooksCleanup = AsyncResource9.bind(() => effectScheduler3.clearAll());
|
|
3608
|
+
rl.on("close", hooksCleanup);
|
|
3609
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
3610
|
+
const startCycle = () => {
|
|
3611
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
3612
|
+
rl.input.on("keypress", checkCursorPos);
|
|
3613
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
3614
|
+
let pendingDone = null;
|
|
3615
|
+
cycle(() => {
|
|
3616
|
+
let effectsSettled = false;
|
|
3617
|
+
try {
|
|
3618
|
+
const nextView = view(config, (value) => {
|
|
3619
|
+
if (effectsSettled) {
|
|
3620
|
+
resolve(value);
|
|
3621
|
+
} else {
|
|
3622
|
+
pendingDone = { value };
|
|
3623
|
+
}
|
|
3624
|
+
});
|
|
3625
|
+
if (nextView === undefined) {
|
|
3626
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
3627
|
+
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
3628
|
+
callerFilename = path3.resolve(callerFilename);
|
|
3629
|
+
}
|
|
3630
|
+
throw new Error(`Prompt functions must return a string.
|
|
3631
|
+
at ${callerFilename}`);
|
|
3632
|
+
}
|
|
3633
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
3634
|
+
screen.render(content, bottomContent);
|
|
3635
|
+
effectScheduler3.run();
|
|
3636
|
+
} catch (error) {
|
|
3637
|
+
reject(error);
|
|
3638
|
+
}
|
|
3639
|
+
effectsSettled = true;
|
|
3640
|
+
if (pendingDone !== null) {
|
|
3641
|
+
const { value } = pendingDone;
|
|
3642
|
+
pendingDone = null;
|
|
3643
|
+
resolve(value);
|
|
3644
|
+
}
|
|
3645
|
+
});
|
|
3646
|
+
};
|
|
3647
|
+
if ("readableFlowing" in input) {
|
|
3648
|
+
nativeSetImmediate3(startCycle);
|
|
3649
|
+
} else {
|
|
3650
|
+
startCycle();
|
|
3651
|
+
}
|
|
3652
|
+
return Object.assign(promise.then((answer) => {
|
|
3653
|
+
effectScheduler3.clearAll();
|
|
3654
|
+
return answer;
|
|
3655
|
+
}, (error) => {
|
|
3656
|
+
effectScheduler3.clearAll();
|
|
3657
|
+
throw error;
|
|
3658
|
+
}).finally(() => {
|
|
3659
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
3660
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
3661
|
+
output.end();
|
|
3662
|
+
}).then(() => promise), { cancel });
|
|
3663
|
+
});
|
|
3664
|
+
};
|
|
3665
|
+
return prompt;
|
|
3666
|
+
}
|
|
3667
|
+
// ../../node_modules/@inquirer/input/dist/index.js
|
|
3668
|
+
var inputTheme = {
|
|
3669
|
+
validationFailureMode: "keep"
|
|
3670
|
+
};
|
|
3671
|
+
var dist_default3 = createPrompt3((config, done) => {
|
|
3672
|
+
const { prefill = "tab" } = config;
|
|
3673
|
+
const theme = makeTheme3(inputTheme, config.theme);
|
|
3674
|
+
const [status, setStatus] = useState3("idle");
|
|
3675
|
+
const [defaultValue, setDefaultValue] = useState3(String(config.default ?? ""));
|
|
3676
|
+
const [errorMsg, setError] = useState3();
|
|
3677
|
+
const [value, setValue] = useState3("");
|
|
3678
|
+
const prefix = usePrefix3({ status, theme });
|
|
3679
|
+
async function validate(value) {
|
|
3680
|
+
const { required, pattern, patternError = "Invalid input" } = config;
|
|
3681
|
+
if (required && !value) {
|
|
3682
|
+
return "You must provide a value";
|
|
3683
|
+
}
|
|
3684
|
+
if (pattern && !pattern.test(value)) {
|
|
3685
|
+
return patternError;
|
|
3686
|
+
}
|
|
3687
|
+
if (typeof config.validate === "function") {
|
|
3688
|
+
return await config.validate(value) || "You must provide a valid value";
|
|
3689
|
+
}
|
|
3690
|
+
return true;
|
|
3691
|
+
}
|
|
3692
|
+
useKeypress3(async (key, rl) => {
|
|
3693
|
+
if (status !== "idle") {
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
if (isEnterKey3(key)) {
|
|
3697
|
+
const answer = value || defaultValue;
|
|
3698
|
+
setStatus("loading");
|
|
3699
|
+
const isValid = await validate(answer);
|
|
3700
|
+
if (isValid === true) {
|
|
3701
|
+
setValue(answer);
|
|
3702
|
+
setStatus("done");
|
|
3703
|
+
done(answer);
|
|
3704
|
+
} else {
|
|
3705
|
+
if (theme.validationFailureMode === "clear") {
|
|
3706
|
+
setValue("");
|
|
3707
|
+
} else {
|
|
3708
|
+
rl.write(value);
|
|
3709
|
+
}
|
|
3710
|
+
setError(isValid);
|
|
3711
|
+
setStatus("idle");
|
|
3712
|
+
}
|
|
3713
|
+
} else if (isBackspaceKey3(key) && !value) {
|
|
3714
|
+
setDefaultValue("");
|
|
3715
|
+
} else if (isTabKey3(key) && !value) {
|
|
3716
|
+
setDefaultValue("");
|
|
3717
|
+
rl.clearLine(0);
|
|
3718
|
+
rl.write(defaultValue);
|
|
3719
|
+
setValue(defaultValue);
|
|
3720
|
+
} else {
|
|
3721
|
+
setValue(rl.line);
|
|
3722
|
+
setError(undefined);
|
|
3723
|
+
}
|
|
3724
|
+
});
|
|
3725
|
+
useEffect5((rl) => {
|
|
3726
|
+
if (prefill === "editable" && defaultValue) {
|
|
3727
|
+
rl.write(defaultValue);
|
|
3728
|
+
setValue(defaultValue);
|
|
3729
|
+
}
|
|
3730
|
+
}, []);
|
|
3731
|
+
const message = theme.style.message(config.message, status);
|
|
3732
|
+
let formattedValue = value;
|
|
3733
|
+
if (typeof config.transformer === "function") {
|
|
3734
|
+
formattedValue = config.transformer(value, { isFinal: status === "done" });
|
|
3735
|
+
} else if (status === "done") {
|
|
3736
|
+
formattedValue = theme.style.answer(value);
|
|
3737
|
+
}
|
|
3738
|
+
let defaultStr;
|
|
3739
|
+
if (defaultValue && status !== "done" && !value) {
|
|
3740
|
+
defaultStr = theme.style.defaultAnswer(defaultValue);
|
|
3741
|
+
}
|
|
3742
|
+
let error = "";
|
|
3743
|
+
if (errorMsg) {
|
|
3744
|
+
error = theme.style.error(errorMsg);
|
|
3745
|
+
}
|
|
3746
|
+
return [
|
|
3747
|
+
[prefix, message, defaultStr, formattedValue].filter((v) => v !== undefined).join(" "),
|
|
3748
|
+
error
|
|
3749
|
+
];
|
|
3750
|
+
});
|
|
3751
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/key.js
|
|
3752
|
+
var keybindings4 = ["emacs", "vim"];
|
|
3753
|
+
var keybindingLookup4 = new Set(keybindings4);
|
|
3754
|
+
function isKeybinding4(value) {
|
|
3755
|
+
return keybindingLookup4.has(value);
|
|
3756
|
+
}
|
|
3757
|
+
function getDefaultKeybindings4() {
|
|
3758
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
3759
|
+
if (!env)
|
|
3760
|
+
return [];
|
|
3761
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding4)));
|
|
3762
|
+
}
|
|
3763
|
+
var isUpKey4 = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
3764
|
+
var isDownKey4 = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
3765
|
+
var isBackspaceKey4 = (key) => key.name === "backspace";
|
|
3766
|
+
var isNumberKey4 = (key) => "1234567890".includes(key.name);
|
|
3767
|
+
var isEnterKey4 = (key) => key.name === "enter" || key.name === "return";
|
|
3768
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/errors.js
|
|
3769
|
+
class AbortPromptError4 extends Error {
|
|
3770
|
+
name = "AbortPromptError";
|
|
3771
|
+
message = "Prompt was aborted";
|
|
3772
|
+
constructor(options) {
|
|
3773
|
+
super();
|
|
3774
|
+
this.cause = options?.cause;
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
class CancelPromptError4 extends Error {
|
|
3779
|
+
name = "CancelPromptError";
|
|
3780
|
+
message = "Prompt was canceled";
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
class ExitPromptError4 extends Error {
|
|
3784
|
+
name = "ExitPromptError";
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
class HookError4 extends Error {
|
|
3788
|
+
name = "HookError";
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
class ValidationError4 extends Error {
|
|
3792
|
+
name = "ValidationError";
|
|
3793
|
+
}
|
|
3794
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
3795
|
+
import { AsyncResource as AsyncResource11 } from "node:async_hooks";
|
|
3796
|
+
|
|
3797
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
3798
|
+
import { AsyncLocalStorage as AsyncLocalStorage4, AsyncResource as AsyncResource10 } from "node:async_hooks";
|
|
3799
|
+
var hookStorage4 = new AsyncLocalStorage4;
|
|
3800
|
+
function createStore4(rl) {
|
|
3801
|
+
const store = {
|
|
3802
|
+
rl,
|
|
3803
|
+
hooks: [],
|
|
3804
|
+
hooksCleanup: [],
|
|
3805
|
+
hooksEffect: [],
|
|
3806
|
+
index: 0,
|
|
3807
|
+
handleChange() {}
|
|
3808
|
+
};
|
|
3809
|
+
return store;
|
|
3810
|
+
}
|
|
3811
|
+
function withHooks4(rl, cb) {
|
|
3812
|
+
const store = createStore4(rl);
|
|
3813
|
+
return hookStorage4.run(store, () => {
|
|
3814
|
+
function cycle(render) {
|
|
3815
|
+
store.handleChange = () => {
|
|
3816
|
+
store.index = 0;
|
|
3817
|
+
render();
|
|
3818
|
+
};
|
|
3819
|
+
store.handleChange();
|
|
3820
|
+
}
|
|
3821
|
+
return cb(cycle);
|
|
3822
|
+
});
|
|
3823
|
+
}
|
|
3824
|
+
function getStore4() {
|
|
3825
|
+
const store = hookStorage4.getStore();
|
|
3826
|
+
if (!store) {
|
|
3827
|
+
throw new HookError4("[Inquirer] Hook functions can only be called from within a prompt");
|
|
3828
|
+
}
|
|
3829
|
+
return store;
|
|
3830
|
+
}
|
|
3831
|
+
function readline7() {
|
|
3832
|
+
return getStore4().rl;
|
|
3833
|
+
}
|
|
3834
|
+
function withUpdates4(fn) {
|
|
3835
|
+
const wrapped = (...args) => {
|
|
3836
|
+
const store = getStore4();
|
|
3837
|
+
let shouldUpdate = false;
|
|
3838
|
+
const oldHandleChange = store.handleChange;
|
|
3839
|
+
store.handleChange = () => {
|
|
3840
|
+
shouldUpdate = true;
|
|
3841
|
+
};
|
|
3842
|
+
const returnValue = fn(...args);
|
|
3843
|
+
if (shouldUpdate) {
|
|
3844
|
+
oldHandleChange();
|
|
3845
|
+
}
|
|
3846
|
+
store.handleChange = oldHandleChange;
|
|
3847
|
+
return returnValue;
|
|
3848
|
+
};
|
|
3849
|
+
return AsyncResource10.bind(wrapped);
|
|
3850
|
+
}
|
|
3851
|
+
function withPointer4(cb) {
|
|
3852
|
+
const store = getStore4();
|
|
3853
|
+
const { index } = store;
|
|
3854
|
+
const pointer = {
|
|
3855
|
+
get() {
|
|
3856
|
+
return store.hooks[index];
|
|
3857
|
+
},
|
|
3858
|
+
set(value) {
|
|
3859
|
+
store.hooks[index] = value;
|
|
3860
|
+
},
|
|
3861
|
+
initialized: index in store.hooks
|
|
3862
|
+
};
|
|
3863
|
+
const returnValue = cb(pointer);
|
|
3864
|
+
store.index++;
|
|
3865
|
+
return returnValue;
|
|
3866
|
+
}
|
|
3867
|
+
function handleChange4() {
|
|
3868
|
+
getStore4().handleChange();
|
|
3869
|
+
}
|
|
3870
|
+
var effectScheduler4 = {
|
|
3871
|
+
queue(cb) {
|
|
3872
|
+
const store = getStore4();
|
|
3873
|
+
const { index } = store;
|
|
3874
|
+
store.hooksEffect.push(() => {
|
|
3875
|
+
store.hooksCleanup[index]?.();
|
|
3876
|
+
const cleanFn = cb(readline7());
|
|
3877
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
3878
|
+
throw new ValidationError4("useEffect return value must be a cleanup function or nothing.");
|
|
3879
|
+
}
|
|
3880
|
+
store.hooksCleanup[index] = cleanFn;
|
|
3881
|
+
});
|
|
3882
|
+
},
|
|
3883
|
+
run() {
|
|
3884
|
+
const store = getStore4();
|
|
3885
|
+
withUpdates4(() => {
|
|
3886
|
+
store.hooksEffect.forEach((effect) => {
|
|
3887
|
+
effect();
|
|
3888
|
+
});
|
|
3889
|
+
store.hooksEffect.length = 0;
|
|
3890
|
+
})();
|
|
3891
|
+
},
|
|
3892
|
+
clearAll() {
|
|
3893
|
+
const store = getStore4();
|
|
3894
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
3895
|
+
cleanFn?.();
|
|
3896
|
+
});
|
|
3897
|
+
store.hooksEffect.length = 0;
|
|
3898
|
+
store.hooksCleanup.length = 0;
|
|
3899
|
+
}
|
|
3900
|
+
};
|
|
3901
|
+
|
|
3902
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
3903
|
+
function isFactory4(value) {
|
|
3904
|
+
return typeof value === "function";
|
|
3905
|
+
}
|
|
3906
|
+
function useState4(defaultValue) {
|
|
3907
|
+
return withPointer4((pointer) => {
|
|
3908
|
+
const setState = AsyncResource11.bind(function setState(newValue) {
|
|
3909
|
+
if (pointer.get() !== newValue) {
|
|
3910
|
+
pointer.set(newValue);
|
|
3911
|
+
handleChange4();
|
|
3912
|
+
}
|
|
3913
|
+
});
|
|
3914
|
+
if (pointer.initialized) {
|
|
3915
|
+
return [pointer.get(), setState];
|
|
3916
|
+
}
|
|
3917
|
+
const value = isFactory4(defaultValue) ? defaultValue() : defaultValue;
|
|
3918
|
+
pointer.set(value);
|
|
3919
|
+
return [value, setState];
|
|
3920
|
+
});
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
3924
|
+
function useEffect6(cb, depArray) {
|
|
3925
|
+
withPointer4((pointer) => {
|
|
3926
|
+
const oldDeps = pointer.get();
|
|
3927
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
3928
|
+
if (hasChanged) {
|
|
3929
|
+
effectScheduler4.queue(cb);
|
|
3930
|
+
}
|
|
3931
|
+
pointer.set(depArray);
|
|
3932
|
+
});
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/theme.js
|
|
3936
|
+
import { styleText as styleText6 } from "node:util";
|
|
3937
|
+
var defaultTheme4 = {
|
|
3938
|
+
prefix: {
|
|
3939
|
+
idle: styleText6("blue", "?"),
|
|
3940
|
+
done: styleText6("green", dist_default5.tick)
|
|
3941
|
+
},
|
|
3942
|
+
spinner: {
|
|
3943
|
+
interval: 80,
|
|
3944
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText6("yellow", frame))
|
|
3945
|
+
},
|
|
3946
|
+
keybindings: [],
|
|
3947
|
+
style: {
|
|
3948
|
+
answer: (text) => styleText6("cyan", text),
|
|
3949
|
+
message: (text) => styleText6("bold", text),
|
|
3950
|
+
error: (text) => styleText6("red", `> ${text}`),
|
|
3951
|
+
defaultAnswer: (text) => styleText6("dim", `(${text})`),
|
|
3952
|
+
help: (text) => styleText6("dim", text),
|
|
3953
|
+
highlight: (text) => styleText6("cyan", text),
|
|
3954
|
+
key: (text) => styleText6("cyan", styleText6("bold", `<${text}>`))
|
|
3955
|
+
}
|
|
3956
|
+
};
|
|
3957
|
+
function getDefaultTheme4() {
|
|
3958
|
+
return {
|
|
3959
|
+
...defaultTheme4,
|
|
3960
|
+
keybindings: getDefaultKeybindings4()
|
|
3961
|
+
};
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
3965
|
+
function isPlainObject4(value) {
|
|
3966
|
+
if (typeof value !== "object" || value === null)
|
|
3967
|
+
return false;
|
|
3968
|
+
let proto = value;
|
|
3969
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
3970
|
+
proto = Object.getPrototypeOf(proto);
|
|
3971
|
+
}
|
|
3972
|
+
return Object.getPrototypeOf(value) === proto;
|
|
3973
|
+
}
|
|
3974
|
+
function deepMerge4(...objects) {
|
|
3975
|
+
const output = {};
|
|
3976
|
+
for (const obj of objects) {
|
|
3977
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
3978
|
+
const prevValue = output[key];
|
|
3979
|
+
output[key] = isPlainObject4(prevValue) && isPlainObject4(value) ? deepMerge4(prevValue, value) : value;
|
|
3980
|
+
}
|
|
3981
|
+
}
|
|
3982
|
+
return output;
|
|
3983
|
+
}
|
|
3984
|
+
function makeTheme4(...themes) {
|
|
3985
|
+
const themesToMerge = [
|
|
3986
|
+
getDefaultTheme4(),
|
|
3987
|
+
...themes.filter((theme) => theme != null)
|
|
3988
|
+
];
|
|
3989
|
+
return deepMerge4(...themesToMerge);
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3992
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
3993
|
+
function usePrefix4({ status = "idle", theme }) {
|
|
3994
|
+
const [showLoader, setShowLoader] = useState4(false);
|
|
3995
|
+
const [tick, setTick] = useState4(0);
|
|
3996
|
+
const { prefix, spinner } = makeTheme4(theme);
|
|
3997
|
+
useEffect6(() => {
|
|
3998
|
+
if (status === "loading") {
|
|
3999
|
+
let tickInterval;
|
|
4000
|
+
let inc = -1;
|
|
4001
|
+
const delayTimeout = setTimeout(() => {
|
|
4002
|
+
setShowLoader(true);
|
|
4003
|
+
tickInterval = setInterval(() => {
|
|
4004
|
+
inc = inc + 1;
|
|
4005
|
+
setTick(inc % spinner.frames.length);
|
|
4006
|
+
}, spinner.interval);
|
|
4007
|
+
}, 300);
|
|
4008
|
+
return () => {
|
|
4009
|
+
clearTimeout(delayTimeout);
|
|
4010
|
+
clearInterval(tickInterval);
|
|
4011
|
+
};
|
|
4012
|
+
} else {
|
|
4013
|
+
setShowLoader(false);
|
|
4014
|
+
}
|
|
4015
|
+
}, [status]);
|
|
4016
|
+
if (showLoader) {
|
|
4017
|
+
return spinner.frames[tick];
|
|
4018
|
+
}
|
|
4019
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
4020
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
4021
|
+
}
|
|
4022
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
4023
|
+
function useMemo4(fn, dependencies) {
|
|
4024
|
+
return withPointer4((pointer) => {
|
|
4025
|
+
const prev = pointer.get();
|
|
4026
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
4027
|
+
const value = fn();
|
|
4028
|
+
pointer.set({ value, dependencies });
|
|
4029
|
+
return value;
|
|
4030
|
+
}
|
|
4031
|
+
return prev.value;
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
4035
|
+
function useRef7(val) {
|
|
4036
|
+
return useState4({ current: val })[0];
|
|
4037
|
+
}
|
|
4038
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
4039
|
+
function useKeypress4(userHandler) {
|
|
4040
|
+
const signal = useRef7(userHandler);
|
|
4041
|
+
signal.current = userHandler;
|
|
4042
|
+
useEffect6((rl) => {
|
|
4043
|
+
let ignore = false;
|
|
4044
|
+
const handler = withUpdates4((_input, event) => {
|
|
4045
|
+
if (ignore)
|
|
4046
|
+
return;
|
|
4047
|
+
signal.current(event, rl);
|
|
4048
|
+
});
|
|
4049
|
+
rl.input.on("keypress", handler);
|
|
4050
|
+
return () => {
|
|
4051
|
+
ignore = true;
|
|
4052
|
+
rl.input.removeListener("keypress", handler);
|
|
4053
|
+
};
|
|
4054
|
+
}, []);
|
|
4055
|
+
}
|
|
4056
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/utils.js
|
|
4057
|
+
var import_cli_width4 = __toESM(require_cli_width(), 1);
|
|
4058
|
+
function breakLines4(content, width) {
|
|
4059
|
+
return content.split(`
|
|
4060
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split(`
|
|
4061
|
+
`).map((str) => str.trimEnd())).join(`
|
|
4062
|
+
`);
|
|
4063
|
+
}
|
|
4064
|
+
function readlineWidth4() {
|
|
4065
|
+
return import_cli_width4.default({ defaultWidth: 80, output: readline7().output });
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4068
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
4069
|
+
function usePointerPosition2({ active, renderedItems, pageSize, loop }) {
|
|
4070
|
+
const state = useRef7({
|
|
4071
|
+
lastPointer: active,
|
|
4072
|
+
lastActive: undefined
|
|
4073
|
+
});
|
|
4074
|
+
const { lastPointer, lastActive } = state.current;
|
|
4075
|
+
const middle = Math.floor(pageSize / 2);
|
|
4076
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
4077
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
4078
|
+
let pointer = defaultPointerPosition;
|
|
4079
|
+
if (renderedLength > pageSize) {
|
|
4080
|
+
if (loop) {
|
|
4081
|
+
pointer = lastPointer;
|
|
4082
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
4083
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
4084
|
+
}
|
|
4085
|
+
} else {
|
|
4086
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
4087
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
state.current.lastPointer = pointer;
|
|
4091
|
+
state.current.lastActive = active;
|
|
4092
|
+
return pointer;
|
|
4093
|
+
}
|
|
4094
|
+
function usePagination4({ items, active, renderItem, pageSize, loop = true }) {
|
|
4095
|
+
const width = readlineWidth4();
|
|
4096
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
4097
|
+
const renderedItems = items.map((item, index) => {
|
|
4098
|
+
if (item == null)
|
|
4099
|
+
return [];
|
|
4100
|
+
return breakLines4(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
4101
|
+
`);
|
|
4102
|
+
});
|
|
4103
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
4104
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
4105
|
+
const pointer = usePointerPosition2({ active, renderedItems, pageSize, loop });
|
|
4106
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
4107
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
4108
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
4109
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
4110
|
+
const itemVisited = new Set([active]);
|
|
4111
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
4112
|
+
let itemPointer = bound(active + 1);
|
|
4113
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
4114
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
4115
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
4116
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
4117
|
+
itemVisited.add(itemPointer);
|
|
4118
|
+
bufferPointer += linesToAdd.length;
|
|
4119
|
+
itemPointer = bound(itemPointer + 1);
|
|
4120
|
+
}
|
|
4121
|
+
bufferPointer = activeItemPosition - 1;
|
|
4122
|
+
itemPointer = bound(active - 1);
|
|
4123
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
4124
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
4125
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
4126
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
4127
|
+
itemVisited.add(itemPointer);
|
|
4128
|
+
bufferPointer -= linesToAdd.length;
|
|
4129
|
+
itemPointer = bound(itemPointer - 1);
|
|
4130
|
+
}
|
|
4131
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
4132
|
+
`);
|
|
4133
|
+
}
|
|
4134
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
4135
|
+
var import_mute_stream4 = __toESM(require_lib4(), 1);
|
|
4136
|
+
import * as readline8 from "node:readline";
|
|
4137
|
+
import { AsyncResource as AsyncResource12 } from "node:async_hooks";
|
|
4138
|
+
|
|
4139
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/signals.js
|
|
4140
|
+
var signals4 = [];
|
|
4141
|
+
signals4.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
4142
|
+
if (process.platform !== "win32") {
|
|
4143
|
+
signals4.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
4144
|
+
}
|
|
4145
|
+
if (process.platform === "linux") {
|
|
4146
|
+
signals4.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/index.js
|
|
4150
|
+
var processOk4 = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
|
|
4151
|
+
var kExitEmitter4 = Symbol.for("signal-exit emitter");
|
|
4152
|
+
var global4 = globalThis;
|
|
4153
|
+
var ObjectDefineProperty4 = Object.defineProperty.bind(Object);
|
|
4154
|
+
|
|
4155
|
+
class Emitter4 {
|
|
4156
|
+
emitted = {
|
|
4157
|
+
afterExit: false,
|
|
4158
|
+
exit: false
|
|
4159
|
+
};
|
|
4160
|
+
listeners = {
|
|
4161
|
+
afterExit: [],
|
|
4162
|
+
exit: []
|
|
4163
|
+
};
|
|
4164
|
+
count = 0;
|
|
4165
|
+
id = Math.random();
|
|
4166
|
+
constructor() {
|
|
4167
|
+
if (global4[kExitEmitter4]) {
|
|
4168
|
+
return global4[kExitEmitter4];
|
|
4169
|
+
}
|
|
4170
|
+
ObjectDefineProperty4(global4, kExitEmitter4, {
|
|
4171
|
+
value: this,
|
|
4172
|
+
writable: false,
|
|
4173
|
+
enumerable: false,
|
|
4174
|
+
configurable: false
|
|
4175
|
+
});
|
|
4176
|
+
}
|
|
4177
|
+
on(ev, fn) {
|
|
4178
|
+
this.listeners[ev].push(fn);
|
|
4179
|
+
}
|
|
4180
|
+
removeListener(ev, fn) {
|
|
4181
|
+
const list = this.listeners[ev];
|
|
4182
|
+
const i = list.indexOf(fn);
|
|
4183
|
+
if (i === -1) {
|
|
4184
|
+
return;
|
|
4185
|
+
}
|
|
4186
|
+
if (i === 0 && list.length === 1) {
|
|
4187
|
+
list.length = 0;
|
|
4188
|
+
} else {
|
|
4189
|
+
list.splice(i, 1);
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
emit(ev, code, signal) {
|
|
4193
|
+
if (this.emitted[ev]) {
|
|
4194
|
+
return false;
|
|
4195
|
+
}
|
|
4196
|
+
this.emitted[ev] = true;
|
|
4197
|
+
let ret = false;
|
|
4198
|
+
for (const fn of this.listeners[ev]) {
|
|
4199
|
+
ret = fn(code, signal) === true || ret;
|
|
4200
|
+
}
|
|
4201
|
+
if (ev === "exit") {
|
|
4202
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
4203
|
+
}
|
|
4204
|
+
return ret;
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4208
|
+
class SignalExitBase4 {
|
|
4209
|
+
}
|
|
4210
|
+
var signalExitWrap4 = (handler) => {
|
|
4211
|
+
return {
|
|
4212
|
+
onExit(cb, opts) {
|
|
4213
|
+
return handler.onExit(cb, opts);
|
|
4214
|
+
},
|
|
4215
|
+
load() {
|
|
4216
|
+
return handler.load();
|
|
4217
|
+
},
|
|
4218
|
+
unload() {
|
|
4219
|
+
return handler.unload();
|
|
4220
|
+
}
|
|
4221
|
+
};
|
|
4222
|
+
};
|
|
4223
|
+
|
|
4224
|
+
class SignalExitFallback4 extends SignalExitBase4 {
|
|
4225
|
+
onExit() {
|
|
4226
|
+
return () => {};
|
|
4227
|
+
}
|
|
4228
|
+
load() {}
|
|
4229
|
+
unload() {}
|
|
4230
|
+
}
|
|
4231
|
+
|
|
4232
|
+
class SignalExit4 extends SignalExitBase4 {
|
|
4233
|
+
#hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
4234
|
+
#emitter = new Emitter4;
|
|
4235
|
+
#process;
|
|
4236
|
+
#originalProcessEmit;
|
|
4237
|
+
#originalProcessReallyExit;
|
|
4238
|
+
#sigListeners = {};
|
|
4239
|
+
#loaded = false;
|
|
4240
|
+
constructor(process2) {
|
|
4241
|
+
super();
|
|
4242
|
+
this.#process = process2;
|
|
4243
|
+
this.#sigListeners = {};
|
|
4244
|
+
for (const sig of signals4) {
|
|
4245
|
+
this.#sigListeners[sig] = () => {
|
|
4246
|
+
const listeners = this.#process.listeners(sig);
|
|
4247
|
+
let { count } = this.#emitter;
|
|
4248
|
+
const p = process2;
|
|
4249
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
4250
|
+
count += p.__signal_exit_emitter__.count;
|
|
4251
|
+
}
|
|
4252
|
+
if (listeners.length === count) {
|
|
4253
|
+
this.unload();
|
|
4254
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
4255
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
4256
|
+
if (!ret)
|
|
4257
|
+
process2.kill(process2.pid, s);
|
|
4258
|
+
}
|
|
4259
|
+
};
|
|
4260
|
+
}
|
|
4261
|
+
this.#originalProcessReallyExit = process2.reallyExit;
|
|
4262
|
+
this.#originalProcessEmit = process2.emit;
|
|
4263
|
+
}
|
|
4264
|
+
onExit(cb, opts) {
|
|
4265
|
+
if (!processOk4(this.#process)) {
|
|
4266
|
+
return () => {};
|
|
4267
|
+
}
|
|
4268
|
+
if (this.#loaded === false) {
|
|
4269
|
+
this.load();
|
|
4270
|
+
}
|
|
4271
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
4272
|
+
this.#emitter.on(ev, cb);
|
|
4273
|
+
return () => {
|
|
4274
|
+
this.#emitter.removeListener(ev, cb);
|
|
4275
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
4276
|
+
this.unload();
|
|
4277
|
+
}
|
|
4278
|
+
};
|
|
4279
|
+
}
|
|
4280
|
+
load() {
|
|
4281
|
+
if (this.#loaded) {
|
|
4282
|
+
return;
|
|
4283
|
+
}
|
|
4284
|
+
this.#loaded = true;
|
|
4285
|
+
this.#emitter.count += 1;
|
|
4286
|
+
for (const sig of signals4) {
|
|
4287
|
+
try {
|
|
4288
|
+
const fn = this.#sigListeners[sig];
|
|
4289
|
+
if (fn)
|
|
4290
|
+
this.#process.on(sig, fn);
|
|
4291
|
+
} catch (_) {}
|
|
4292
|
+
}
|
|
4293
|
+
this.#process.emit = (ev, ...a) => {
|
|
4294
|
+
return this.#processEmit(ev, ...a);
|
|
4295
|
+
};
|
|
4296
|
+
this.#process.reallyExit = (code) => {
|
|
4297
|
+
return this.#processReallyExit(code);
|
|
4298
|
+
};
|
|
4299
|
+
}
|
|
4300
|
+
unload() {
|
|
4301
|
+
if (!this.#loaded) {
|
|
4302
|
+
return;
|
|
4303
|
+
}
|
|
4304
|
+
this.#loaded = false;
|
|
4305
|
+
signals4.forEach((sig) => {
|
|
4306
|
+
const listener = this.#sigListeners[sig];
|
|
4307
|
+
if (!listener) {
|
|
4308
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
4309
|
+
}
|
|
4310
|
+
try {
|
|
4311
|
+
this.#process.removeListener(sig, listener);
|
|
4312
|
+
} catch (_) {}
|
|
4313
|
+
});
|
|
4314
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
4315
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
4316
|
+
this.#emitter.count -= 1;
|
|
4317
|
+
}
|
|
4318
|
+
#processReallyExit(code) {
|
|
4319
|
+
if (!processOk4(this.#process)) {
|
|
4320
|
+
return 0;
|
|
4321
|
+
}
|
|
4322
|
+
this.#process.exitCode = code || 0;
|
|
4323
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4324
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
4325
|
+
}
|
|
4326
|
+
#processEmit(ev, ...args) {
|
|
4327
|
+
const og = this.#originalProcessEmit;
|
|
4328
|
+
if (ev === "exit" && processOk4(this.#process)) {
|
|
4329
|
+
if (typeof args[0] === "number") {
|
|
4330
|
+
this.#process.exitCode = args[0];
|
|
4331
|
+
}
|
|
4332
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
4333
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4334
|
+
return ret;
|
|
4335
|
+
} else {
|
|
4336
|
+
return og.call(this.#process, ev, ...args);
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
var process6 = globalThis.process;
|
|
4341
|
+
var {
|
|
4342
|
+
onExit: onExit4,
|
|
4343
|
+
load: load4,
|
|
4344
|
+
unload: unload4
|
|
4345
|
+
} = signalExitWrap4(processOk4(process6) ? new SignalExit4(process6) : new SignalExitFallback4);
|
|
4346
|
+
|
|
4347
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
4348
|
+
import { stripVTControlCharacters as stripVTControlCharacters4 } from "node:util";
|
|
4349
|
+
|
|
4350
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/ansi/dist/index.js
|
|
4351
|
+
var ESC5 = "\x1B[";
|
|
4352
|
+
var cursorLeft4 = ESC5 + "G";
|
|
4353
|
+
var cursorHide4 = ESC5 + "?25l";
|
|
4354
|
+
var cursorShow4 = ESC5 + "?25h";
|
|
4355
|
+
var cursorUp4 = (rows = 1) => rows > 0 ? `${ESC5}${rows}A` : "";
|
|
4356
|
+
var cursorDown4 = (rows = 1) => rows > 0 ? `${ESC5}${rows}B` : "";
|
|
4357
|
+
var cursorTo4 = (x, y) => {
|
|
4358
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
4359
|
+
return `${ESC5}${y + 1};${x + 1}H`;
|
|
4360
|
+
}
|
|
4361
|
+
return `${ESC5}${x + 1}G`;
|
|
4362
|
+
};
|
|
4363
|
+
var eraseLine4 = ESC5 + "2K";
|
|
4364
|
+
var eraseLines4 = (lines) => lines > 0 ? (eraseLine4 + cursorUp4(1)).repeat(lines - 1) + eraseLine4 + cursorLeft4 : "";
|
|
4365
|
+
|
|
4366
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
4367
|
+
var height4 = (content) => content.split(`
|
|
4368
|
+
`).length;
|
|
4369
|
+
var lastLine4 = (content) => content.split(`
|
|
4370
|
+
`).pop() ?? "";
|
|
4371
|
+
|
|
4372
|
+
class ScreenManager4 {
|
|
4373
|
+
height = 0;
|
|
4374
|
+
extraLinesUnderPrompt = 0;
|
|
4375
|
+
cursorPos;
|
|
4376
|
+
rl;
|
|
4377
|
+
constructor(rl) {
|
|
4378
|
+
this.rl = rl;
|
|
4379
|
+
this.cursorPos = rl.getCursorPos();
|
|
4380
|
+
}
|
|
4381
|
+
write(content) {
|
|
4382
|
+
this.rl.output.unmute();
|
|
4383
|
+
this.rl.output.write(content);
|
|
4384
|
+
this.rl.output.mute();
|
|
4385
|
+
}
|
|
4386
|
+
render(content, bottomContent = "") {
|
|
4387
|
+
const promptLine = lastLine4(content);
|
|
4388
|
+
const rawPromptLine = stripVTControlCharacters4(promptLine);
|
|
4389
|
+
let prompt = rawPromptLine;
|
|
4390
|
+
if (this.rl.line.length > 0) {
|
|
4391
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
4392
|
+
}
|
|
4393
|
+
this.rl.setPrompt(prompt);
|
|
4394
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
4395
|
+
const width = readlineWidth4();
|
|
4396
|
+
content = breakLines4(content, width);
|
|
4397
|
+
bottomContent = breakLines4(bottomContent, width);
|
|
4398
|
+
if (rawPromptLine.length % width === 0) {
|
|
4399
|
+
content += `
|
|
4400
|
+
`;
|
|
4401
|
+
}
|
|
4402
|
+
let output = content + (bottomContent ? `
|
|
4403
|
+
` + bottomContent : "");
|
|
4404
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
4405
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height4(bottomContent) : 0);
|
|
4406
|
+
if (bottomContentHeight > 0)
|
|
4407
|
+
output += cursorUp4(bottomContentHeight);
|
|
4408
|
+
output += cursorTo4(this.cursorPos.cols);
|
|
4409
|
+
this.write(cursorDown4(this.extraLinesUnderPrompt) + eraseLines4(this.height) + output);
|
|
4410
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
4411
|
+
this.height = height4(output);
|
|
4412
|
+
}
|
|
4413
|
+
checkCursorPos() {
|
|
4414
|
+
const cursorPos = this.rl.getCursorPos();
|
|
4415
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
4416
|
+
this.write(cursorTo4(cursorPos.cols));
|
|
4417
|
+
this.cursorPos = cursorPos;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
done({ clearContent }) {
|
|
4421
|
+
this.rl.setPrompt("");
|
|
4422
|
+
let output = cursorDown4(this.extraLinesUnderPrompt);
|
|
4423
|
+
output += clearContent ? eraseLines4(this.height) : `
|
|
4424
|
+
`;
|
|
4425
|
+
output += cursorLeft4;
|
|
4426
|
+
output += cursorShow4;
|
|
4427
|
+
this.write(output);
|
|
4428
|
+
this.rl.close();
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
|
|
4432
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
4433
|
+
class PromisePolyfill4 extends Promise {
|
|
4434
|
+
static withResolver() {
|
|
4435
|
+
let resolve;
|
|
4436
|
+
let reject;
|
|
4437
|
+
const promise = new Promise((res, rej) => {
|
|
4438
|
+
resolve = res;
|
|
4439
|
+
reject = rej;
|
|
4440
|
+
});
|
|
4441
|
+
return { promise, resolve, reject };
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
|
|
4445
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
4446
|
+
import path4 from "node:path";
|
|
4447
|
+
var nativeSetImmediate4 = globalThis.setImmediate;
|
|
4448
|
+
function getCallSites4() {
|
|
4449
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
4450
|
+
let result = [];
|
|
4451
|
+
try {
|
|
4452
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
4453
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
4454
|
+
result = callSitesWithoutCurrent;
|
|
4455
|
+
return callSitesWithoutCurrent;
|
|
4456
|
+
};
|
|
4457
|
+
new Error().stack;
|
|
4458
|
+
} catch {
|
|
4459
|
+
return result;
|
|
4460
|
+
}
|
|
4461
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
4462
|
+
return result;
|
|
4463
|
+
}
|
|
4464
|
+
function createPrompt4(view) {
|
|
4465
|
+
const callSites = getCallSites4();
|
|
4466
|
+
const prompt = (config, context = {}) => {
|
|
4467
|
+
const { input = process.stdin, signal } = context;
|
|
4468
|
+
const cleanups = new Set;
|
|
4469
|
+
const output = new import_mute_stream4.default;
|
|
4470
|
+
output.pipe(context.output ?? process.stdout);
|
|
4471
|
+
const rl = readline8.createInterface({
|
|
4472
|
+
terminal: true,
|
|
4473
|
+
input,
|
|
4474
|
+
output
|
|
4475
|
+
});
|
|
4476
|
+
output.mute();
|
|
4477
|
+
const screen = new ScreenManager4(rl);
|
|
4478
|
+
const { promise, resolve, reject } = PromisePolyfill4.withResolver();
|
|
4479
|
+
const cancel = () => reject(new CancelPromptError4);
|
|
4480
|
+
if (signal) {
|
|
4481
|
+
const abort = () => reject(new AbortPromptError4({ cause: signal.reason }));
|
|
4482
|
+
if (signal.aborted) {
|
|
4483
|
+
abort();
|
|
4484
|
+
return Object.assign(promise, { cancel });
|
|
4485
|
+
}
|
|
4486
|
+
signal.addEventListener("abort", abort);
|
|
4487
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
4488
|
+
}
|
|
4489
|
+
cleanups.add(onExit4((code, signal) => {
|
|
4490
|
+
reject(new ExitPromptError4(`User force closed the prompt with ${code} ${signal}`));
|
|
4491
|
+
}));
|
|
4492
|
+
const sigint = () => reject(new ExitPromptError4(`User force closed the prompt with SIGINT`));
|
|
4493
|
+
rl.on("SIGINT", sigint);
|
|
4494
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
4495
|
+
return withHooks4(rl, (cycle) => {
|
|
4496
|
+
const hooksCleanup = AsyncResource12.bind(() => effectScheduler4.clearAll());
|
|
4497
|
+
rl.on("close", hooksCleanup);
|
|
4498
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
4499
|
+
const startCycle = () => {
|
|
4500
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
4501
|
+
rl.input.on("keypress", checkCursorPos);
|
|
4502
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
4503
|
+
let pendingDone = null;
|
|
4504
|
+
cycle(() => {
|
|
4505
|
+
let effectsSettled = false;
|
|
4506
|
+
try {
|
|
4507
|
+
const nextView = view(config, (value) => {
|
|
4508
|
+
if (effectsSettled) {
|
|
4509
|
+
resolve(value);
|
|
4510
|
+
} else {
|
|
4511
|
+
pendingDone = { value };
|
|
4512
|
+
}
|
|
4513
|
+
});
|
|
4514
|
+
if (nextView === undefined) {
|
|
4515
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
4516
|
+
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
4517
|
+
callerFilename = path4.resolve(callerFilename);
|
|
4518
|
+
}
|
|
4519
|
+
throw new Error(`Prompt functions must return a string.
|
|
4520
|
+
at ${callerFilename}`);
|
|
4521
|
+
}
|
|
4522
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
4523
|
+
screen.render(content, bottomContent);
|
|
4524
|
+
effectScheduler4.run();
|
|
4525
|
+
} catch (error) {
|
|
4526
|
+
reject(error);
|
|
4527
|
+
}
|
|
4528
|
+
effectsSettled = true;
|
|
4529
|
+
if (pendingDone !== null) {
|
|
4530
|
+
const { value } = pendingDone;
|
|
4531
|
+
pendingDone = null;
|
|
4532
|
+
resolve(value);
|
|
4533
|
+
}
|
|
4534
|
+
});
|
|
4535
|
+
};
|
|
4536
|
+
if ("readableFlowing" in input) {
|
|
4537
|
+
nativeSetImmediate4(startCycle);
|
|
4538
|
+
} else {
|
|
4539
|
+
startCycle();
|
|
4540
|
+
}
|
|
4541
|
+
return Object.assign(promise.then((answer) => {
|
|
4542
|
+
effectScheduler4.clearAll();
|
|
4543
|
+
return answer;
|
|
4544
|
+
}, (error) => {
|
|
4545
|
+
effectScheduler4.clearAll();
|
|
4546
|
+
throw error;
|
|
4547
|
+
}).finally(() => {
|
|
4548
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
4549
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
4550
|
+
output.end();
|
|
4551
|
+
}).then(() => promise), { cancel });
|
|
4552
|
+
});
|
|
4553
|
+
};
|
|
4554
|
+
return prompt;
|
|
4555
|
+
}
|
|
4556
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
4557
|
+
import { styleText as styleText7 } from "node:util";
|
|
4558
|
+
class Separator4 {
|
|
4559
|
+
separator = styleText7("dim", Array.from({ length: 15 }).join(dist_default5.line));
|
|
4560
|
+
type = "separator";
|
|
4561
|
+
constructor(separator) {
|
|
4562
|
+
if (separator) {
|
|
4563
|
+
this.separator = separator;
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
static isSeparator(choice) {
|
|
4567
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
// ../../node_modules/@inquirer/prompts/node_modules/@inquirer/select/dist/index.js
|
|
4571
|
+
import { styleText as styleText8 } from "node:util";
|
|
4572
|
+
var selectTheme = {
|
|
4573
|
+
icon: { cursor: dist_default5.pointer },
|
|
4574
|
+
style: {
|
|
4575
|
+
disabled: (text) => styleText8("dim", text),
|
|
4576
|
+
description: (text) => styleText8("cyan", text),
|
|
4577
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText8("bold", key)} ${styleText8("dim", action)}`).join(styleText8("dim", " • "))
|
|
4578
|
+
},
|
|
4579
|
+
i18n: { disabledError: "This option is disabled and cannot be selected." },
|
|
4580
|
+
indexMode: "hidden"
|
|
4581
|
+
};
|
|
4582
|
+
function isSelectable2(item) {
|
|
4583
|
+
return !Separator4.isSeparator(item) && !item.disabled;
|
|
4584
|
+
}
|
|
4585
|
+
function isNavigable2(item) {
|
|
4586
|
+
return !Separator4.isSeparator(item);
|
|
4587
|
+
}
|
|
4588
|
+
function normalizeChoices2(choices) {
|
|
4589
|
+
return choices.map((choice) => {
|
|
4590
|
+
if (Separator4.isSeparator(choice))
|
|
4591
|
+
return choice;
|
|
4592
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
4593
|
+
const name = String(choice);
|
|
4594
|
+
return {
|
|
4595
|
+
value: choice,
|
|
4596
|
+
name,
|
|
4597
|
+
short: name,
|
|
4598
|
+
disabled: false
|
|
4599
|
+
};
|
|
4600
|
+
}
|
|
4601
|
+
const name = choice.name ?? String(choice.value);
|
|
4602
|
+
const normalizedChoice = {
|
|
4603
|
+
value: choice.value,
|
|
4604
|
+
name,
|
|
4605
|
+
short: choice.short ?? name,
|
|
4606
|
+
disabled: choice.disabled ?? false
|
|
4607
|
+
};
|
|
4608
|
+
if (choice.description) {
|
|
4609
|
+
normalizedChoice.description = choice.description;
|
|
4610
|
+
}
|
|
4611
|
+
return normalizedChoice;
|
|
4612
|
+
});
|
|
4613
|
+
}
|
|
4614
|
+
var dist_default4 = createPrompt4((config, done) => {
|
|
4615
|
+
const { loop = true, pageSize = 7 } = config;
|
|
4616
|
+
const theme = makeTheme4(selectTheme, config.theme);
|
|
4617
|
+
const { keybindings } = theme;
|
|
4618
|
+
const [status, setStatus] = useState4("idle");
|
|
4619
|
+
const prefix = usePrefix4({ status, theme });
|
|
4620
|
+
const searchTimeoutRef = useRef7();
|
|
4621
|
+
const searchEnabled = !keybindings.includes("vim");
|
|
4622
|
+
const items = useMemo4(() => normalizeChoices2(config.choices), [config.choices]);
|
|
4623
|
+
const bounds = useMemo4(() => {
|
|
4624
|
+
const first = items.findIndex(isNavigable2);
|
|
4625
|
+
const last = items.findLastIndex(isNavigable2);
|
|
4626
|
+
if (first === -1) {
|
|
4627
|
+
throw new ValidationError4("[select prompt] No selectable choices. All choices are disabled.");
|
|
4628
|
+
}
|
|
4629
|
+
return { first, last };
|
|
4630
|
+
}, [items]);
|
|
4631
|
+
const defaultItemIndex = useMemo4(() => {
|
|
4632
|
+
if (!("default" in config))
|
|
4633
|
+
return -1;
|
|
4634
|
+
return items.findIndex((item) => isSelectable2(item) && item.value === config.default);
|
|
4635
|
+
}, [config.default, items]);
|
|
4636
|
+
const [active, setActive] = useState4(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
4637
|
+
const selectedChoice = items[active];
|
|
4638
|
+
if (selectedChoice == null || Separator4.isSeparator(selectedChoice)) {
|
|
4639
|
+
throw new Error("Active index does not point to a choice");
|
|
4640
|
+
}
|
|
4641
|
+
const [errorMsg, setError] = useState4();
|
|
4642
|
+
useKeypress4((key, rl) => {
|
|
4643
|
+
clearTimeout(searchTimeoutRef.current);
|
|
4644
|
+
if (errorMsg) {
|
|
4645
|
+
setError(undefined);
|
|
4646
|
+
}
|
|
4647
|
+
if (isEnterKey4(key)) {
|
|
4648
|
+
if (selectedChoice.disabled) {
|
|
4649
|
+
setError(theme.i18n.disabledError);
|
|
4650
|
+
} else {
|
|
4651
|
+
setStatus("done");
|
|
4652
|
+
done(selectedChoice.value);
|
|
4653
|
+
}
|
|
4654
|
+
} else if (isUpKey4(key, keybindings) || isDownKey4(key, keybindings)) {
|
|
4655
|
+
rl.clearLine(0);
|
|
4656
|
+
if (loop || isUpKey4(key, keybindings) && active !== bounds.first || isDownKey4(key, keybindings) && active !== bounds.last) {
|
|
4657
|
+
const offset = isUpKey4(key, keybindings) ? -1 : 1;
|
|
4658
|
+
let next = active;
|
|
4659
|
+
do {
|
|
4660
|
+
next = (next + offset + items.length) % items.length;
|
|
4661
|
+
} while (!isNavigable2(items[next]));
|
|
4662
|
+
setActive(next);
|
|
4663
|
+
}
|
|
4664
|
+
} else if (isNumberKey4(key) && !Number.isNaN(Number(rl.line))) {
|
|
4665
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
4666
|
+
let selectableIndex = -1;
|
|
4667
|
+
const position = items.findIndex((item) => {
|
|
4668
|
+
if (Separator4.isSeparator(item))
|
|
4669
|
+
return false;
|
|
4670
|
+
selectableIndex++;
|
|
4671
|
+
return selectableIndex === selectedIndex;
|
|
4672
|
+
});
|
|
4673
|
+
const item = items[position];
|
|
4674
|
+
if (item != null && isSelectable2(item)) {
|
|
4675
|
+
setActive(position);
|
|
4676
|
+
}
|
|
4677
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
4678
|
+
rl.clearLine(0);
|
|
4679
|
+
}, 700);
|
|
4680
|
+
} else if (isBackspaceKey4(key)) {
|
|
4681
|
+
rl.clearLine(0);
|
|
4682
|
+
} else if (searchEnabled) {
|
|
4683
|
+
const searchTerm = rl.line.toLowerCase();
|
|
4684
|
+
const matchIndex = items.findIndex((item) => {
|
|
4685
|
+
if (Separator4.isSeparator(item) || !isSelectable2(item))
|
|
4686
|
+
return false;
|
|
4687
|
+
return item.name.toLowerCase().startsWith(searchTerm);
|
|
4688
|
+
});
|
|
4689
|
+
if (matchIndex !== -1) {
|
|
4690
|
+
setActive(matchIndex);
|
|
4691
|
+
}
|
|
4692
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
4693
|
+
rl.clearLine(0);
|
|
4694
|
+
}, 700);
|
|
4695
|
+
}
|
|
4696
|
+
});
|
|
4697
|
+
useEffect6(() => () => {
|
|
4698
|
+
clearTimeout(searchTimeoutRef.current);
|
|
4699
|
+
}, []);
|
|
4700
|
+
const message = theme.style.message(config.message, status);
|
|
4701
|
+
const helpLine = theme.style.keysHelpTip([
|
|
4702
|
+
["↑↓", "navigate"],
|
|
4703
|
+
["⏎", "select"]
|
|
4704
|
+
]);
|
|
4705
|
+
let separatorCount = 0;
|
|
4706
|
+
const page = usePagination4({
|
|
4707
|
+
items,
|
|
4708
|
+
active,
|
|
4709
|
+
renderItem({ item, isActive, index }) {
|
|
4710
|
+
if (Separator4.isSeparator(item)) {
|
|
4711
|
+
separatorCount++;
|
|
4712
|
+
return ` ${item.separator}`;
|
|
4713
|
+
}
|
|
4714
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
4715
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
4716
|
+
if (item.disabled) {
|
|
4717
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
4718
|
+
const disabledCursor = isActive ? theme.icon.cursor : "-";
|
|
4719
|
+
return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
|
|
4720
|
+
}
|
|
4721
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
4722
|
+
return color(`${cursor} ${indexLabel}${item.name}`);
|
|
4723
|
+
},
|
|
4724
|
+
pageSize,
|
|
4725
|
+
loop
|
|
4726
|
+
});
|
|
4727
|
+
if (status === "done") {
|
|
4728
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
|
|
4729
|
+
}
|
|
4730
|
+
const { description } = selectedChoice;
|
|
4731
|
+
const lines = [
|
|
4732
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
4733
|
+
page,
|
|
4734
|
+
" ",
|
|
4735
|
+
description ? theme.style.description(description) : "",
|
|
4736
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
4737
|
+
helpLine
|
|
4738
|
+
].filter(Boolean).join(`
|
|
4739
|
+
`).trimEnd();
|
|
4740
|
+
return `${lines}${cursorHide4}`;
|
|
4741
|
+
});
|
|
4742
|
+
export { dist_default, dist_default2, dist_default3, dist_default4 };
|
|
4743
|
+
|
|
4744
|
+
//# debugId=DD964B695DD7076664756E2164756E21
|