bfi-cli 0.1.97 → 0.1.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,293 @@
1
+ # Licenses of Bundled Dependencies
2
+
3
+ The published artifact additionally contains code with the following licenses:
4
+ ISC, MIT
5
+
6
+ # Bundled Dependencies
7
+
8
+ ## @clack/core, @clack/prompts
9
+
10
+ License: MIT
11
+ By: Nate Moore
12
+ Repositories: https://github.com/bombshell-dev/clack, https://github.com/bombshell-dev/clack
13
+
14
+ > MIT License
15
+ >
16
+ > MIT License Copyright (c) 2025-Present [Bombshell contributors](https://bomb.sh/team)
17
+ >
18
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
19
+ >
20
+ > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
21
+ >
22
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ ---------------------------------------
25
+
26
+ ## @kwsites/file-exists
27
+
28
+ License: MIT
29
+ By: Steve King <steve@mydev.co>, Steve King
30
+ Repository: https://github.com/kwsites/file-exists
31
+
32
+ > The MIT License (MIT)
33
+ >
34
+ > Copyright (c) 2015 Steve King
35
+ >
36
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of
37
+ > this software and associated documentation files (the "Software"), to deal in
38
+ > the Software without restriction, including without limitation the rights to
39
+ > use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
40
+ > the Software, and to permit persons to whom the Software is furnished to do so,
41
+ > subject to the following conditions:
42
+ >
43
+ > The above copyright notice and this permission notice shall be included in all
44
+ > copies or substantial portions of the Software.
45
+ >
46
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
48
+ > FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
49
+ > COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
50
+ > IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
51
+ > CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52
+
53
+ ---------------------------------------
54
+
55
+ ## @kwsites/promise-deferred
56
+
57
+ License: MIT
58
+ By: Steve King <steve@mydev.co>, Steve King
59
+ Repository: https://github.com/kwsites/promise-deferred
60
+
61
+ > MIT License
62
+ >
63
+ > Copyright (c) 2018 kwsites
64
+ >
65
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
66
+ > of this software and associated documentation files (the "Software"), to deal
67
+ > in the Software without restriction, including without limitation the rights
68
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
69
+ > copies of the Software, and to permit persons to whom the Software is
70
+ > furnished to do so, subject to the following conditions:
71
+ >
72
+ > The above copyright notice and this permission notice shall be included in all
73
+ > copies or substantial portions of the Software.
74
+ >
75
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
78
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
80
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
81
+ > SOFTWARE.
82
+
83
+ ---------------------------------------
84
+
85
+ ## @simple-git/args-pathspec
86
+
87
+ License: MIT
88
+ Repository: https://github.com/steveukx/git-js
89
+
90
+ ---------------------------------------
91
+
92
+ ## @simple-git/argv-parser
93
+
94
+ License: MIT
95
+ Repository: https://github.com/steveukx/git-js
96
+
97
+ ---------------------------------------
98
+
99
+ ## debug
100
+
101
+ License: MIT
102
+ By: Josh Junon (https://github.com/qix-), TJ Holowaychuk <tj@vision-media.ca>, Nathan Rajlich <nathan@tootallnate.net> (http://n8.io), Andrew Rhyne <rhyneandrew@gmail.com>
103
+ Repository: https://github.com/debug-js/debug
104
+
105
+ > (The MIT License)
106
+ >
107
+ > Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
108
+ > Copyright (c) 2018-2021 Josh Junon
109
+ >
110
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of this software
111
+ > and associated documentation files (the 'Software'), to deal in the Software without restriction,
112
+ > including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
113
+ > and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
114
+ > subject to the following conditions:
115
+ >
116
+ > The above copyright notice and this permission notice shall be included in all copies or substantial
117
+ > portions of the Software.
118
+ >
119
+ > THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
120
+ > LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
121
+ > IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
122
+ > WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
123
+ > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
124
+
125
+ ---------------------------------------
126
+
127
+ ## fast-string-truncated-width, fast-string-width
128
+
129
+ License: MIT
130
+ Repositories: https://github.com/fabiospampinato/fast-string-truncated-width, https://github.com/fabiospampinato/fast-string-width
131
+
132
+ > The MIT License (MIT)
133
+ >
134
+ > Copyright (c) 2024-present Fabio Spampinato
135
+ >
136
+ > Permission is hereby granted, free of charge, to any person obtaining a
137
+ > copy of this software and associated documentation files (the "Software"),
138
+ > to deal in the Software without restriction, including without limitation
139
+ > the rights to use, copy, modify, merge, publish, distribute, sublicense,
140
+ > and/or sell copies of the Software, and to permit persons to whom the
141
+ > Software is furnished to do so, subject to the following conditions:
142
+ >
143
+ > The above copyright notice and this permission notice shall be included in
144
+ > all copies or substantial portions of the Software.
145
+ >
146
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
147
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
148
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
149
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
150
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
151
+ > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
152
+ > DEALINGS IN THE SOFTWARE.
153
+
154
+ ---------------------------------------
155
+
156
+ ## fast-wrap-ansi
157
+
158
+ License: MIT
159
+ By: James Garbutt (https://github.com/43081j)
160
+ Repository: https://github.com/43081j/fast-wrap-ansi
161
+
162
+ > MIT License
163
+ >
164
+ > Copyright (c) 2025 James Garbutt
165
+ >
166
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
167
+ >
168
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
169
+ > of this software and associated documentation files (the "Software"), to deal
170
+ > in the Software without restriction, including without limitation the rights
171
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
172
+ > copies of the Software, and to permit persons to whom the Software is
173
+ > furnished to do so, subject to the following conditions:
174
+ >
175
+ > The above copyright notice and this permission notice shall be included in all
176
+ > copies or substantial portions of the Software.
177
+ >
178
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
179
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
180
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
181
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
182
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
183
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
184
+ > SOFTWARE.
185
+
186
+ ---------------------------------------
187
+
188
+ ## ms
189
+
190
+ License: MIT
191
+ Repository: https://github.com/vercel/ms
192
+
193
+ > The MIT License (MIT)
194
+ >
195
+ > Copyright (c) 2020 Vercel, Inc.
196
+ >
197
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
198
+ > of this software and associated documentation files (the "Software"), to deal
199
+ > in the Software without restriction, including without limitation the rights
200
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
201
+ > copies of the Software, and to permit persons to whom the Software is
202
+ > furnished to do so, subject to the following conditions:
203
+ >
204
+ > The above copyright notice and this permission notice shall be included in all
205
+ > copies or substantial portions of the Software.
206
+ >
207
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
208
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
209
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
210
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
211
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
212
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
213
+ > SOFTWARE.
214
+
215
+ ---------------------------------------
216
+
217
+ ## picocolors
218
+
219
+ License: ISC
220
+ By: Alexey Raspopov
221
+ Repository: https://github.com/alexeyraspopov/picocolors
222
+
223
+ > ISC License
224
+ >
225
+ > Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
226
+ >
227
+ > Permission to use, copy, modify, and/or distribute this software for any
228
+ > purpose with or without fee is hereby granted, provided that the above
229
+ > copyright notice and this permission notice appear in all copies.
230
+ >
231
+ > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
232
+ > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
233
+ > MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
234
+ > ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
235
+ > WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
236
+ > ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
237
+ > OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
238
+
239
+ ---------------------------------------
240
+
241
+ ## simple-git
242
+
243
+ License: MIT
244
+ By: Steve King <steve@mydev.co>, Steve King
245
+ Repository: https://github.com/steveukx/git-js
246
+
247
+ ---------------------------------------
248
+
249
+ ## sisteransi
250
+
251
+ License: MIT
252
+ By: Terkel Gjervig
253
+ Repository: https://github.com/terkelg/sisteransi
254
+
255
+ > MIT License
256
+ >
257
+ > Copyright (c) 2018 Terkel Gjervig Nielsen
258
+ >
259
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
260
+ > of this software and associated documentation files (the "Software"), to deal
261
+ > in the Software without restriction, including without limitation the rights
262
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
263
+ > copies of the Software, and to permit persons to whom the Software is
264
+ > furnished to do so, subject to the following conditions:
265
+ >
266
+ > The above copyright notice and this permission notice shall be included in all
267
+ > copies or substantial portions of the Software.
268
+ >
269
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
270
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
271
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
272
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
273
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
274
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
275
+ > SOFTWARE.
276
+
277
+ ---------------------------------------
278
+
279
+ ## xdg-basedir
280
+
281
+ License: MIT
282
+ By: Sindre Sorhus
283
+ Repository: https://github.com/sindresorhus/xdg-basedir
284
+
285
+ > MIT License
286
+ >
287
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
288
+ >
289
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
290
+ >
291
+ > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
292
+ >
293
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,7 +1,8 @@
1
1
  import { __commonJSMin } from "../../rolldown-runtime.mjs";
2
2
  import "node:util";
3
3
  import { stdin, stdout } from "node:process";
4
- import l__default, * as l from "node:readline";
4
+ import * as l from "node:readline";
5
+ import l__default from "node:readline";
5
6
  import { ReadStream } from "node:tty";
6
7
  const getCodePointsLength = (() => {
7
8
  const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
@@ -358,7 +359,6 @@ const settings = {
358
359
  error: "Something went wrong"
359
360
  },
360
361
  withGuide: true,
361
- accessible: void 0,
362
362
  date: {
363
363
  monthNames: [...[
364
364
  "January",
@@ -383,12 +383,6 @@ const settings = {
383
383
  }
384
384
  }
385
385
  };
386
- function isAccessible(n) {
387
- if (n !== void 0) return n;
388
- if (settings.accessible !== void 0) return settings.accessible;
389
- const e = process.env.ACCESSIBLE;
390
- return e !== void 0 && e !== "" && e !== "0" && e !== "false";
391
- }
392
386
  function isActionKey(n, e) {
393
387
  if (typeof n == "string") return settings.aliases.get(n) === e;
394
388
  for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
@@ -416,7 +410,7 @@ function setRawMode(e, r) {
416
410
  const o = e;
417
411
  o.isTTY && o.setRawMode(r);
418
412
  }
419
- function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: n = true } = {}) {
413
+ function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: t = true } = {}) {
420
414
  const s = l.createInterface({
421
415
  input: e,
422
416
  output: r,
@@ -424,48 +418,49 @@ function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hide
424
418
  tabSize: 1
425
419
  });
426
420
  l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
427
- const t = (f, { name: a, sequence: w }) => {
421
+ const n = (f, { name: a, sequence: p }) => {
428
422
  if (isActionKey([
429
423
  String(f),
430
424
  a,
431
- w
425
+ p
432
426
  ], "cancel")) {
433
- n && r.write(import_src.cursor.show), process.exit(0);
427
+ t && r.write(import_src.cursor.show), process.exit(0);
434
428
  return;
435
429
  }
436
430
  if (!o) return;
437
431
  const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
438
432
  l.moveCursor(r, i, m, () => {
439
433
  l.clearLine(r, 1, () => {
440
- e.once("keypress", t);
434
+ e.once("keypress", n);
441
435
  });
442
436
  });
443
437
  };
444
- return n && r.write(import_src.cursor.hide), e.once("keypress", t), () => {
445
- e.off("keypress", t), n && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
438
+ return t && r.write(import_src.cursor.hide), e.once("keypress", n), () => {
439
+ e.off("keypress", n), t && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
446
440
  };
447
441
  }
448
442
  const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
449
443
  const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
450
- function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
444
+ function wrapTextWithPrefix(e, r, o, t = o, s = o, n) {
451
445
  return wrapAnsi(r, getColumns(e ?? stdout) - o.length, {
452
446
  hard: true,
453
447
  trim: false
454
448
  }).split(`
455
449
  `).map((c, i, m) => {
456
- const d = t ? t(c, i) : c;
457
- return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
450
+ const d = n ? n(c, i) : c;
451
+ return i === 0 ? `${t}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
458
452
  }).join(`
459
453
  `);
460
454
  }
461
- function runValidation(e, a) {
455
+ function runValidation(e, n) {
462
456
  if ("~standard" in e) {
463
- const n = e["~standard"].validate(a);
464
- return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
457
+ const a = e["~standard"].validate(n);
458
+ if (a instanceof Promise) throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
459
+ return a.issues?.at(0)?.message;
465
460
  }
466
- return e(a);
461
+ return e(n);
467
462
  }
468
- var y = class {
463
+ var V = class {
469
464
  input;
470
465
  output;
471
466
  _abortSignal;
@@ -480,12 +475,9 @@ var y = class {
480
475
  error = "";
481
476
  value;
482
477
  userInput = "";
483
- get accessible() {
484
- return isAccessible(this.opts.accessible);
485
- }
486
478
  constructor(t, e = true) {
487
- const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
488
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
479
+ const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t;
480
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
489
481
  }
490
482
  unsubscribe() {
491
483
  this._subscribers.clear();
@@ -504,9 +496,9 @@ var y = class {
504
496
  });
505
497
  }
506
498
  emit(t, ...e) {
507
- const i = this._subscribers.get(t) ?? [], s = [];
508
- for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
509
- for (const r of s) r();
499
+ const i = this._subscribers.get(t) ?? [], n = [];
500
+ for (const s of i) s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
501
+ for (const s of n) s();
510
502
  }
511
503
  prompt() {
512
504
  return new Promise((t) => {
@@ -547,25 +539,22 @@ var y = class {
547
539
  name: "u"
548
540
  }), this._setUserInput("");
549
541
  }
550
- async onKeypress(t, e) {
551
- if (this.state !== "validating") {
552
- if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
553
- ctrl: true,
554
- name: "h"
555
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
556
- if (this.opts.validate) {
557
- const i = runValidation(this.opts.validate, this.value);
558
- let s;
559
- i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
560
- }
561
- this.state !== "error" && (this.state = "submit");
542
+ onKeypress(t, e) {
543
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
544
+ ctrl: true,
545
+ name: "h"
546
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
547
+ if (this.opts.validate) {
548
+ const i = runValidation(this.opts.validate, this.value);
549
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
562
550
  }
563
- isActionKey([
564
- t,
565
- e?.name,
566
- e?.sequence
567
- ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
551
+ this.state !== "error" && (this.state = "submit");
568
552
  }
553
+ isActionKey([
554
+ t,
555
+ e?.name,
556
+ e?.sequence
557
+ ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
569
558
  }
570
559
  close() {
571
560
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
@@ -589,27 +578,27 @@ var y = class {
589
578
  else {
590
579
  const e = diffLines(this._prevFrame, t), i = getRows(this.output);
591
580
  if (this.restoreCursor(), e) {
592
- const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
593
- let n = e.lines.find((o) => o >= s);
594
- if (n === void 0) {
581
+ const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
582
+ let r = e.lines.find((o) => o >= n);
583
+ if (r === void 0) {
595
584
  this._prevFrame = t;
596
585
  return;
597
586
  }
598
587
  if (e.lines.length === 1) {
599
- this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
588
+ this.output.write(import_src.cursor.move(0, r - s)), this.output.write(import_src.erase.lines(1));
600
589
  const o = t.split(`
601
590
  `);
602
- this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
591
+ this.output.write(o[r]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - r - 1));
603
592
  return;
604
593
  } else if (e.lines.length > 1) {
605
- if (s < r) n = s;
594
+ if (n < s) r = n;
606
595
  else {
607
- const h = n - r;
596
+ const h = r - s;
608
597
  h > 0 && this.output.write(import_src.cursor.move(0, h));
609
598
  }
610
599
  this.output.write(import_src.erase.down());
611
600
  const f = t.split(`
612
- `).slice(n);
601
+ `).slice(r);
613
602
  this.output.write(f.join(`
614
603
  `)), this._prevFrame = t;
615
604
  return;
@@ -621,7 +610,7 @@ var y = class {
621
610
  }
622
611
  }
623
612
  };
624
- var r = class extends y {
613
+ var r = class extends V {
625
614
  get cursor() {
626
615
  return this.value ? 0 : 1;
627
616
  }
@@ -638,7 +627,7 @@ var r = class extends y {
638
627
  });
639
628
  }
640
629
  };
641
- let u$2 = class u extends y {
630
+ let u$2 = class u extends V {
642
631
  options;
643
632
  cursor = 0;
644
633
  #t;
@@ -685,12 +674,14 @@ let u$2 = class u extends y {
685
674
  !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
686
675
  break;
687
676
  }
688
- case "space": this.toggleValue();
677
+ case "space":
678
+ this.toggleValue();
679
+ break;
689
680
  }
690
681
  });
691
682
  }
692
683
  };
693
- var a = class extends y {
684
+ var a = class extends V {
694
685
  options;
695
686
  cursor = 0;
696
687
  get _value() {
@@ -729,12 +720,14 @@ var a = class extends y {
729
720
  case "right":
730
721
  this.cursor = findCursor(this.cursor, 1, this.options);
731
722
  break;
732
- case "space": this.toggleValue();
723
+ case "space":
724
+ this.toggleValue();
725
+ break;
733
726
  }
734
727
  });
735
728
  }
736
729
  };
737
- let n$1 = class n extends y {
730
+ let n$1 = class n extends V {
738
731
  options;
739
732
  cursor = 0;
740
733
  get _selectedValue() {
@@ -754,7 +747,9 @@ let n$1 = class n extends y {
754
747
  this.cursor = findCursor(this.cursor, -1, this.options);
755
748
  break;
756
749
  case "down":
757
- case "right": this.cursor = findCursor(this.cursor, 1, this.options);
750
+ case "right":
751
+ this.cursor = findCursor(this.cursor, 1, this.options);
752
+ break;
758
753
  }
759
754
  this.changeValue();
760
755
  });