@rstest/core 0.9.5 → 0.9.6

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/0~dist.js DELETED
@@ -1,1014 +0,0 @@
1
- import "node:module";
2
- import { __webpack_require__ } from "./rslib-runtime.js";
3
- import { styleText } from "node:util";
4
- import node_process, { stdin, stdout } from "node:process";
5
- import node_readline, { clearLine, createInterface, emitKeypressEvents, moveCursor } from "node:readline";
6
- import { ReadStream } from "node:tty";
7
- import "node:fs";
8
- import "node:path";
9
- __webpack_require__.add({
10
- "../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js" (module) {
11
- const ESC = '\x1B';
12
- const CSI = `${ESC}[`;
13
- const beep = '\u0007';
14
- const cursor = {
15
- to (x, y) {
16
- if (!y) return `${CSI}${x + 1}G`;
17
- return `${CSI}${y + 1};${x + 1}H`;
18
- },
19
- move (x, y) {
20
- let ret = '';
21
- if (x < 0) ret += `${CSI}${-x}D`;
22
- else if (x > 0) ret += `${CSI}${x}C`;
23
- if (y < 0) ret += `${CSI}${-y}A`;
24
- else if (y > 0) ret += `${CSI}${y}B`;
25
- return ret;
26
- },
27
- up: (count = 1)=>`${CSI}${count}A`,
28
- down: (count = 1)=>`${CSI}${count}B`,
29
- forward: (count = 1)=>`${CSI}${count}C`,
30
- backward: (count = 1)=>`${CSI}${count}D`,
31
- nextLine: (count = 1)=>`${CSI}E`.repeat(count),
32
- prevLine: (count = 1)=>`${CSI}F`.repeat(count),
33
- left: `${CSI}G`,
34
- hide: `${CSI}?25l`,
35
- show: `${CSI}?25h`,
36
- save: `${ESC}7`,
37
- restore: `${ESC}8`
38
- };
39
- const scroll = {
40
- up: (count = 1)=>`${CSI}S`.repeat(count),
41
- down: (count = 1)=>`${CSI}T`.repeat(count)
42
- };
43
- const erase = {
44
- screen: `${CSI}2J`,
45
- up: (count = 1)=>`${CSI}1J`.repeat(count),
46
- down: (count = 1)=>`${CSI}J`.repeat(count),
47
- line: `${CSI}2K`,
48
- lineEnd: `${CSI}K`,
49
- lineStart: `${CSI}1K`,
50
- lines (count) {
51
- let clear = '';
52
- for(let i = 0; i < count; i++)clear += this.line + (i < count - 1 ? cursor.up() : '');
53
- if (count) clear += cursor.left;
54
- return clear;
55
- }
56
- };
57
- module.exports = {
58
- cursor,
59
- scroll,
60
- erase,
61
- beep
62
- };
63
- }
64
- });
65
- const src = __webpack_require__("../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
66
- function x(t, e, s) {
67
- if (!s.some((u)=>!u.disabled)) return t;
68
- const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
69
- return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
70
- }
71
- const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 === t || 173 === t || 174 === t || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || 198 === t || 208 === t || 215 === t || 216 === t || t >= 222 && t <= 225 || 230 === t || t >= 232 && t <= 234 || 236 === t || 237 === t || 240 === t || 242 === t || 243 === t || t >= 247 && t <= 250 || 252 === t || 254 === t || 257 === t || 273 === t || 275 === t || 283 === t || 294 === t || 295 === t || 299 === t || t >= 305 && t <= 307 || 312 === t || t >= 319 && t <= 322 || 324 === t || t >= 328 && t <= 331 || 333 === t || 338 === t || 339 === t || 358 === t || 359 === t || 363 === t || 462 === t || 464 === t || 466 === t || 468 === t || 470 === t || 472 === t || 474 === t || 476 === t || 593 === t || 609 === t || 708 === t || 711 === t || t >= 713 && t <= 715 || 717 === t || 720 === t || t >= 728 && t <= 731 || 733 === t || 735 === t || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || 1025 === t || t >= 1040 && t <= 1103 || 1105 === t || 8208 === t || t >= 8211 && t <= 8214 || 8216 === t || 8217 === t || 8220 === t || 8221 === t || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || 8240 === t || 8242 === t || 8243 === t || 8245 === t || 8251 === t || 8254 === t || 8308 === t || 8319 === t || t >= 8321 && t <= 8324 || 8364 === t || 8451 === t || 8453 === t || 8457 === t || 8467 === t || 8470 === t || 8481 === t || 8482 === t || 8486 === t || 8491 === t || 8531 === t || 8532 === t || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || 8585 === t || t >= 8592 && t <= 8601 || 8632 === t || 8633 === t || 8658 === t || 8660 === t || 8679 === t || 8704 === t || 8706 === t || 8707 === t || 8711 === t || 8712 === t || 8715 === t || 8719 === t || 8721 === t || 8725 === t || 8730 === t || t >= 8733 && t <= 8736 || 8739 === t || 8741 === t || t >= 8743 && t <= 8748 || 8750 === t || t >= 8756 && t <= 8759 || 8764 === t || 8765 === t || 8776 === t || 8780 === t || 8786 === t || 8800 === t || 8801 === t || t >= 8804 && t <= 8807 || 8810 === t || 8811 === t || 8814 === t || 8815 === t || 8834 === t || 8835 === t || 8838 === t || 8839 === t || 8853 === t || 8857 === t || 8869 === t || 8895 === t || 8978 === t || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || 9632 === t || 9633 === t || t >= 9635 && t <= 9641 || 9650 === t || 9651 === t || 9654 === t || 9655 === t || 9660 === t || 9661 === t || 9664 === t || 9665 === t || t >= 9670 && t <= 9672 || 9675 === t || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || 9711 === t || 9733 === t || 9734 === t || 9737 === t || 9742 === t || 9743 === t || 9756 === t || 9758 === t || 9792 === t || 9794 === t || 9824 === t || 9825 === t || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || 9836 === t || 9837 === t || 9839 === t || 9886 === t || 9887 === t || 9919 === t || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || 9955 === t || 9960 === t || 9961 === t || t >= 9963 && t <= 9969 || 9972 === t || t >= 9974 && t <= 9977 || 9979 === t || 9980 === t || 9982 === t || 9983 === t || 10045 === t || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || 65533 === t || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || 127375 === t || 127376 === t || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t)=>12288 === t || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, dist_ht = (t)=>t >= 4352 && t <= 4447 || 8986 === t || 8987 === t || 9001 === t || 9002 === t || t >= 9193 && t <= 9196 || 9200 === t || 9203 === t || 9725 === t || 9726 === t || 9748 === t || 9749 === t || t >= 9800 && t <= 9811 || 9855 === t || 9875 === t || 9889 === t || 9898 === t || 9899 === t || 9917 === t || 9918 === t || 9924 === t || 9925 === t || 9934 === t || 9940 === t || 9962 === t || 9970 === t || 9971 === t || 9973 === t || 9978 === t || 9981 === t || 9989 === t || 9994 === t || 9995 === t || 10024 === t || 10060 === t || 10062 === t || t >= 10067 && t <= 10069 || 10071 === t || t >= 10133 && t <= 10135 || 10160 === t || 10175 === t || 11035 === t || 11036 === t || 11088 === t || 11093 === t || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || 94192 === t || 94193 === t || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || 110589 === t || 110590 === t || t >= 110592 && t <= 110882 || 110898 === t || t >= 110928 && t <= 110930 || 110933 === t || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || 126980 === t || 127183 === t || 127374 === t || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || 127568 === t || 127569 === t || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || 127988 === t || t >= 127992 && t <= 128062 || 128064 === t || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || 128378 === t || 128405 === t || 128406 === t || 128420 === t || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || 128716 === t || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || 128747 === t || 128748 === t || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || 129008 === t || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, dist_O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, dist_y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_L = /\t{1,1000}/y, dist_P = /[\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, dist_M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, dist_ct = /\p{M}+/gu, ft = {
72
- limit: 1 / 0,
73
- ellipsis: ""
74
- }, X = (t, e = {}, s = {})=>{
75
- const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
76
- let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
77
- t: for(;;){
78
- if (w > C || o >= p && o > h) {
79
- const ut = t.slice(C, w) || t.slice(h, o);
80
- v = 0;
81
- for (const Y of ut.replaceAll(dist_ct, "")){
82
- const $ = Y.codePointAt(0) || 0;
83
- if (lt($) ? f = m : dist_ht($) ? f = V : E !== A && dist_at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
84
- F = !0;
85
- break t;
86
- }
87
- v += Y.length, c += f;
88
- }
89
- C = w = 0;
90
- }
91
- if (o >= p) break;
92
- if (dist_M.lastIndex = o, dist_M.test(t)) {
93
- if (v = dist_M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
94
- F = !0;
95
- break;
96
- }
97
- c += f, C = h, w = o, o = h = dist_M.lastIndex;
98
- continue;
99
- }
100
- if (dist_O.lastIndex = o, dist_O.test(t)) {
101
- if (c + u > b && (d = Math.min(d, o)), c + u > i) {
102
- F = !0;
103
- break;
104
- }
105
- c += u, C = h, w = o, o = h = dist_O.lastIndex;
106
- continue;
107
- }
108
- if (dist_y.lastIndex = o, dist_y.test(t)) {
109
- if (v = dist_y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
110
- F = !0;
111
- break;
112
- }
113
- c += f, C = h, w = o, o = h = dist_y.lastIndex;
114
- continue;
115
- }
116
- if (dist_L.lastIndex = o, dist_L.test(t)) {
117
- if (v = dist_L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
118
- F = !0;
119
- break;
120
- }
121
- c += f, C = h, w = o, o = h = dist_L.lastIndex;
122
- continue;
123
- }
124
- if (dist_P.lastIndex = o, dist_P.test(t)) {
125
- if (c + g > b && (d = Math.min(d, o)), c + g > i) {
126
- F = !0;
127
- break;
128
- }
129
- c += g, C = h, w = o, o = h = dist_P.lastIndex;
130
- continue;
131
- }
132
- o += 1;
133
- }
134
- return {
135
- width: F ? b : c,
136
- index: F ? d : p,
137
- truncated: F,
138
- ellipsed: F && i >= n
139
- };
140
- }, pt = {
141
- limit: 1 / 0,
142
- ellipsis: "",
143
- ellipsisWidth: 0
144
- }, dist_S = (t, e = {})=>X(t, pt, e).width, dist_T = "\x1B", dist_Z = "\x9B", Ft = 39, dist_j = "\x07", Q = "[", dist_dt = "]", tt = "m", U = `${dist_dt}8;;`, dist_et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${dist_j})`, "y"), mt = (t)=>{
145
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
146
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
147
- if (1 === t || 2 === t) return 22;
148
- if (3 === t) return 23;
149
- if (4 === t) return 24;
150
- if (7 === t) return 27;
151
- if (8 === t) return 28;
152
- if (9 === t) return 29;
153
- if (0 === t) return 0;
154
- }, st = (t)=>`${dist_T}${Q}${t}${tt}`, dist_it = (t)=>`${dist_T}${U}${t}${dist_j}`, gt = (t)=>t.map((e)=>dist_S(e)), dist_G = (t, e, s)=>{
155
- const i = e[Symbol.iterator]();
156
- let r = !1, n = !1, u = t.at(-1), a = void 0 === u ? 0 : dist_S(u), l = i.next(), E = i.next(), g = 0;
157
- for(; !l.done;){
158
- const m = l.value, A = dist_S(m);
159
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === dist_T || m === dist_Z) && (r = !0, n = e.startsWith(U, g + 1)), r ? n ? m === dist_j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a !== s || E.done || (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
160
- }
161
- u = t.at(-1), !a && void 0 !== u && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
162
- }, vt = (t)=>{
163
- const e = t.split(" ");
164
- let s = e.length;
165
- for(; s > 0 && !(dist_S(e[s - 1]) > 0);)s--;
166
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
167
- }, Et = (t, e, s = {})=>{
168
- if (!1 !== s.trim && "" === t.trim()) return "";
169
- let i = "", r, n;
170
- const u = t.split(" "), a = gt(u);
171
- let l = [
172
- ""
173
- ];
174
- for (const [h, o] of u.entries()){
175
- !1 !== s.trim && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
176
- let p = dist_S(l.at(-1) ?? "");
177
- if (0 !== h && (p >= e && (!1 === s.wordWrap || !1 === s.trim) && (l.push(""), p = 0), (p > 0 || !1 === s.trim) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
178
- const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
179
- Math.floor((a[h] - 1) / e) < F && l.push(""), dist_G(l, o, e);
180
- continue;
181
- }
182
- if (p + a[h] > e && p > 0 && a[h] > 0) {
183
- if (!1 === s.wordWrap && p < e) {
184
- dist_G(l, o, e);
185
- continue;
186
- }
187
- l.push("");
188
- }
189
- if (p + a[h] > e && !1 === s.wordWrap) {
190
- dist_G(l, o, e);
191
- continue;
192
- }
193
- l[l.length - 1] += o;
194
- }
195
- !1 !== s.trim && (l = l.map((h)=>vt(h)));
196
- const E = l.join(`
197
- `), g = E[Symbol.iterator]();
198
- let m = g.next(), A = g.next(), V = 0;
199
- for(; !m.done;){
200
- const h = m.value, o = A.value;
201
- if (i += h, h === dist_T || h === dist_Z) {
202
- dist_et.lastIndex = V + 1;
203
- const F = dist_et.exec(E)?.groups;
204
- if (F?.code !== void 0) {
205
- const d = Number.parseFloat(F.code);
206
- r = d === Ft ? void 0 : d;
207
- } else F?.uri !== void 0 && (n = 0 === F.uri.length ? void 0 : F.uri);
208
- }
209
- const p = r ? mt(r) : void 0;
210
- o === `
211
- ` ? (n && (i += dist_it("")), r && p && (i += st(p))) : h === `
212
- ` && (r && p && (i += st(r)), n && (i += dist_it(n))), V += h.length, m = A, A = g.next();
213
- }
214
- return i;
215
- };
216
- function K(t, e, s) {
217
- return String(t).normalize().replaceAll(`\r
218
- `, `
219
- `).split(`
220
- `).map((i)=>Et(i, e, s)).join(`
221
- `);
222
- }
223
- const At = [
224
- "up",
225
- "down",
226
- "left",
227
- "right",
228
- "space",
229
- "enter",
230
- "cancel"
231
- ], dist_ = {
232
- actions: new Set(At),
233
- aliases: new Map([
234
- [
235
- "k",
236
- "up"
237
- ],
238
- [
239
- "j",
240
- "down"
241
- ],
242
- [
243
- "h",
244
- "left"
245
- ],
246
- [
247
- "l",
248
- "right"
249
- ],
250
- [
251
- "",
252
- "cancel"
253
- ],
254
- [
255
- "escape",
256
- "cancel"
257
- ]
258
- ]),
259
- messages: {
260
- cancel: "Canceled",
261
- error: "Something went wrong"
262
- },
263
- withGuide: !0
264
- };
265
- function H(t, e) {
266
- if ("string" == typeof t) return dist_.aliases.get(t) === e;
267
- for (const s of t)if (void 0 !== s && H(s, e)) return !0;
268
- return !1;
269
- }
270
- function _t(t, e) {
271
- if (t === e) return;
272
- const s = t.split(`
273
- `), i = e.split(`
274
- `), r = Math.max(s.length, i.length), n = [];
275
- for(let u = 0; u < r; u++)s[u] !== i[u] && n.push(u);
276
- return {
277
- lines: n,
278
- numLinesBefore: s.length,
279
- numLinesAfter: i.length,
280
- numLines: r
281
- };
282
- }
283
- const bt = globalThis.process.platform.startsWith("win"), z = Symbol("clack:cancel");
284
- function Ct(t) {
285
- return t === z;
286
- }
287
- function W(t, e) {
288
- const s = t;
289
- s.isTTY && s.setRawMode(e);
290
- }
291
- function xt({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
292
- const r = createInterface({
293
- input: t,
294
- output: e,
295
- prompt: "",
296
- tabSize: 1
297
- });
298
- emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
299
- const n = (u, { name: a, sequence: l })=>{
300
- const E = String(u);
301
- if (H([
302
- E,
303
- a,
304
- l
305
- ], "cancel")) {
306
- i && e.write(src.cursor.show), process.exit(0);
307
- return;
308
- }
309
- if (!s) return;
310
- const g = "return" === a ? 0 : -1, m = "return" === a ? -1 : 0;
311
- moveCursor(e, g, m, ()=>{
312
- clearLine(e, 1, ()=>{
313
- t.once("keypress", n);
314
- });
315
- });
316
- };
317
- return i && e.write(src.cursor.hide), t.once("keypress", n), ()=>{
318
- t.off("keypress", n), i && e.write(src.cursor.show), t instanceof ReadStream && t.isTTY && !bt && t.setRawMode(!1), r.terminal = !1, r.close();
319
- };
320
- }
321
- const dist_rt = (t)=>"columns" in t && "number" == typeof t.columns ? t.columns : 80, dist_nt = (t)=>"rows" in t && "number" == typeof t.rows ? t.rows : 20;
322
- function Bt(t, e, s, i = s) {
323
- const r = dist_rt(t ?? stdout);
324
- return K(e, r - s.length, {
325
- hard: !0,
326
- trim: !1
327
- }).split(`
328
- `).map((n, u)=>`${0 === u ? i : s}${n}`).join(`
329
- `);
330
- }
331
- class dist_B {
332
- input;
333
- output;
334
- _abortSignal;
335
- rl;
336
- opts;
337
- _render;
338
- _track = !1;
339
- _prevFrame = "";
340
- _subscribers = new Map;
341
- _cursor = 0;
342
- state = "initial";
343
- error = "";
344
- value;
345
- userInput = "";
346
- constructor(e, s = !0){
347
- const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
348
- this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
349
- }
350
- unsubscribe() {
351
- this._subscribers.clear();
352
- }
353
- setSubscriber(e, s) {
354
- const i = this._subscribers.get(e) ?? [];
355
- i.push(s), this._subscribers.set(e, i);
356
- }
357
- on(e, s) {
358
- this.setSubscriber(e, {
359
- cb: s
360
- });
361
- }
362
- once(e, s) {
363
- this.setSubscriber(e, {
364
- cb: s,
365
- once: !0
366
- });
367
- }
368
- emit(e, ...s) {
369
- const i = this._subscribers.get(e) ?? [], r = [];
370
- for (const n of i)n.cb(...s), n.once && r.push(()=>i.splice(i.indexOf(n), 1));
371
- for (const n of r)n();
372
- }
373
- prompt() {
374
- return new Promise((e)=>{
375
- if (this._abortSignal) {
376
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
377
- this._abortSignal.addEventListener("abort", ()=>{
378
- this.state = "cancel", this.close();
379
- }, {
380
- once: !0
381
- });
382
- }
383
- this.rl = node_readline.createInterface({
384
- input: this.input,
385
- tabSize: 2,
386
- prompt: "",
387
- escapeCodeTimeout: 50,
388
- terminal: !0
389
- }), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
390
- this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(this.value);
391
- }), this.once("cancel", ()=>{
392
- this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(z);
393
- });
394
- });
395
- }
396
- _isActionKey(e, s) {
397
- return " " === e;
398
- }
399
- _setValue(e) {
400
- this.value = e, this.emit("value", this.value);
401
- }
402
- _setUserInput(e, s) {
403
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
404
- }
405
- _clearUserInput() {
406
- this.rl?.write(null, {
407
- ctrl: !0,
408
- name: "u"
409
- }), this._setUserInput("");
410
- }
411
- onKeypress(e, s) {
412
- if (this._track && "return" !== s.name && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
413
- ctrl: !0,
414
- name: "h"
415
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), s?.name && (!this._track && dist_.aliases.has(s.name) && this.emit("cursor", dist_.aliases.get(s.name)), dist_.actions.has(s.name) && this.emit("cursor", s.name)), e && ("y" === e.toLowerCase() || "n" === e.toLowerCase()) && this.emit("confirm", "y" === e.toLowerCase()), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
416
- if (this.opts.validate) {
417
- const i = this.opts.validate(this.value);
418
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
419
- }
420
- "error" !== this.state && (this.state = "submit");
421
- }
422
- H([
423
- e,
424
- s?.name,
425
- s?.sequence
426
- ], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
427
- }
428
- close() {
429
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
430
- `), W(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
431
- }
432
- restoreCursor() {
433
- const e = K(this._prevFrame, process.stdout.columns, {
434
- hard: !0,
435
- trim: !1
436
- }).split(`
437
- `).length - 1;
438
- this.output.write(src.cursor.move(-999, -1 * e));
439
- }
440
- render() {
441
- const e = K(this._render(this) ?? "", process.stdout.columns, {
442
- hard: !0,
443
- trim: !1
444
- });
445
- if (e !== this._prevFrame) {
446
- if ("initial" === this.state) this.output.write(src.cursor.hide);
447
- else {
448
- const s = _t(this._prevFrame, e), i = dist_nt(this.output);
449
- if (this.restoreCursor(), s) {
450
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
451
- let u = s.lines.find((a)=>a >= r);
452
- if (void 0 === u) {
453
- this._prevFrame = e;
454
- return;
455
- }
456
- if (1 === s.lines.length) {
457
- this.output.write(src.cursor.move(0, u - n)), this.output.write(src.erase.lines(1));
458
- const a = e.split(`
459
- `);
460
- this.output.write(a[u]), this._prevFrame = e, this.output.write(src.cursor.move(0, a.length - u - 1));
461
- return;
462
- }
463
- if (s.lines.length > 1) {
464
- if (r < n) u = r;
465
- else {
466
- const l = u - n;
467
- l > 0 && this.output.write(src.cursor.move(0, l));
468
- }
469
- this.output.write(src.erase.down());
470
- const a = e.split(`
471
- `).slice(u);
472
- this.output.write(a.join(`
473
- `)), this._prevFrame = e;
474
- return;
475
- }
476
- }
477
- this.output.write(src.erase.down());
478
- }
479
- this.output.write(e), "initial" === this.state && (this.state = "active"), this._prevFrame = e;
480
- }
481
- }
482
- }
483
- class kt extends dist_B {
484
- get cursor() {
485
- return this.value ? 0 : 1;
486
- }
487
- get _value() {
488
- return 0 === this.cursor;
489
- }
490
- constructor(e){
491
- super(e, !1), this.value = !!e.initialValue, this.on("userInput", ()=>{
492
- this.value = this._value;
493
- }), this.on("confirm", (s)=>{
494
- this.output.write(src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
495
- }), this.on("cursor", ()=>{
496
- this.value = !this.value;
497
- });
498
- }
499
- }
500
- class Tt extends dist_B {
501
- options;
502
- cursor = 0;
503
- get _selectedValue() {
504
- return this.options[this.cursor];
505
- }
506
- changeValue() {
507
- this.value = this._selectedValue.value;
508
- }
509
- constructor(e){
510
- super(e, !1), this.options = e.options;
511
- const s = this.options.findIndex(({ value: r })=>r === e.initialValue), i = -1 === s ? 0 : s;
512
- this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r)=>{
513
- switch(r){
514
- case "left":
515
- case "up":
516
- this.cursor = x(this.cursor, -1, this.options);
517
- break;
518
- case "down":
519
- case "right":
520
- this.cursor = x(this.cursor, 1, this.options);
521
- break;
522
- }
523
- this.changeValue();
524
- });
525
- }
526
- }
527
- function dist_pt() {
528
- return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
529
- }
530
- const ee = dist_pt(), ce = ()=>"true" === process.env.CI, I = (e, r)=>ee ? e : r, Re = I("\u25C6", "*"), $e = I("\u25A0", "x"), de = I("\u25B2", "x"), dist_V = I("\u25C7", "o"), he = I("\u250C", "T"), dist_h = I("\u2502", "|"), dist_x = I("\u2514", "\u2014"), dist_z = (I("\u2510", "T"), I("\u2518", "\u2014"), I("\u25CF", ">")), dist_H = I("\u25CB", " "), se = (I("\u25FB", "[\u2022]"), I("\u25FC", "[+]"), I("\u25FB", "[ ]"), I("\u25AA", "\u2022"), I("\u2500", "-")), pe = I("\u256E", "+"), We = I("\u251C", "+"), me = I("\u256F", "+"), ge = I("\u2570", "+"), fe = (I("\u256D", "+"), I("\u25CF", "\u2022")), Fe = I("\u25C6", "*"), ye = I("\u25B2", "!"), Ee = I("\u25A0", "x"), dist_W = (e)=>{
531
- switch(e){
532
- case "initial":
533
- case "active":
534
- return styleText("cyan", Re);
535
- case "cancel":
536
- return styleText("red", $e);
537
- case "error":
538
- return styleText("yellow", de);
539
- case "submit":
540
- return styleText("green", dist_V);
541
- }
542
- }, ve = (e)=>{
543
- switch(e){
544
- case "initial":
545
- case "active":
546
- return styleText("cyan", dist_h);
547
- case "cancel":
548
- return styleText("red", dist_h);
549
- case "error":
550
- return styleText("yellow", dist_h);
551
- case "submit":
552
- return styleText("green", dist_h);
553
- }
554
- }, dist_mt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 === e || 240 === e || 242 === e || 243 === e || e >= 247 && e <= 250 || 252 === e || 254 === e || 257 === e || 273 === e || 275 === e || 283 === e || 294 === e || 295 === e || 299 === e || e >= 305 && e <= 307 || 312 === e || e >= 319 && e <= 322 || 324 === e || e >= 328 && e <= 331 || 333 === e || 338 === e || 339 === e || 358 === e || 359 === e || 363 === e || 462 === e || 464 === e || 466 === e || 468 === e || 470 === e || 472 === e || 474 === e || 476 === e || 593 === e || 609 === e || 708 === e || 711 === e || e >= 713 && e <= 715 || 717 === e || 720 === e || e >= 728 && e <= 731 || 733 === e || 735 === e || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || 1025 === e || e >= 1040 && e <= 1103 || 1105 === e || 8208 === e || e >= 8211 && e <= 8214 || 8216 === e || 8217 === e || 8220 === e || 8221 === e || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || 8240 === e || 8242 === e || 8243 === e || 8245 === e || 8251 === e || 8254 === e || 8308 === e || 8319 === e || e >= 8321 && e <= 8324 || 8364 === e || 8451 === e || 8453 === e || 8457 === e || 8467 === e || 8470 === e || 8481 === e || 8482 === e || 8486 === e || 8491 === e || 8531 === e || 8532 === e || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || 8585 === e || e >= 8592 && e <= 8601 || 8632 === e || 8633 === e || 8658 === e || 8660 === e || 8679 === e || 8704 === e || 8706 === e || 8707 === e || 8711 === e || 8712 === e || 8715 === e || 8719 === e || 8721 === e || 8725 === e || 8730 === e || e >= 8733 && e <= 8736 || 8739 === e || 8741 === e || e >= 8743 && e <= 8748 || 8750 === e || e >= 8756 && e <= 8759 || 8764 === e || 8765 === e || 8776 === e || 8780 === e || 8786 === e || 8800 === e || 8801 === e || e >= 8804 && e <= 8807 || 8810 === e || 8811 === e || 8814 === e || 8815 === e || 8834 === e || 8835 === e || 8838 === e || 8839 === e || 8853 === e || 8857 === e || 8869 === e || 8895 === e || 8978 === e || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || 9632 === e || 9633 === e || e >= 9635 && e <= 9641 || 9650 === e || 9651 === e || 9654 === e || 9655 === e || 9660 === e || 9661 === e || 9664 === e || 9665 === e || e >= 9670 && e <= 9672 || 9675 === e || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || 9711 === e || 9733 === e || 9734 === e || 9737 === e || 9742 === e || 9743 === e || 9756 === e || 9758 === e || 9792 === e || 9794 === e || 9824 === e || 9825 === e || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || 9836 === e || 9837 === e || 9839 === e || 9886 === e || 9887 === e || 9919 === e || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || 9955 === e || 9960 === e || 9961 === e || e >= 9963 && e <= 9969 || 9972 === e || e >= 9974 && e <= 9977 || 9979 === e || 9980 === e || 9982 === e || 9983 === e || 10045 === e || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || 65533 === e || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || 127375 === e || 127376 === e || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, dist_gt = (e)=>12288 === e || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, dist_ft = (e)=>e >= 4352 && e <= 4447 || 8986 === e || 8987 === e || 9001 === e || 9002 === e || e >= 9193 && e <= 9196 || 9200 === e || 9203 === e || 9725 === e || 9726 === e || 9748 === e || 9749 === e || e >= 9800 && e <= 9811 || 9855 === e || 9875 === e || 9889 === e || 9898 === e || 9899 === e || 9917 === e || 9918 === e || 9924 === e || 9925 === e || 9934 === e || 9940 === e || 9962 === e || 9970 === e || 9971 === e || 9973 === e || 9978 === e || 9981 === e || 9989 === e || 9994 === e || 9995 === e || 10024 === e || 10060 === e || 10062 === e || e >= 10067 && e <= 10069 || 10071 === e || e >= 10133 && e <= 10135 || 10160 === e || 10175 === e || 11035 === e || 11036 === e || 11088 === e || 11093 === e || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || 94192 === e || 94193 === e || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || 110589 === e || 110590 === e || e >= 110592 && e <= 110882 || 110898 === e || e >= 110928 && e <= 110930 || 110933 === e || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || 126980 === e || 127183 === e || 127374 === e || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || 127568 === e || 127569 === e || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || 127988 === e || e >= 127992 && e <= 128062 || 128064 === e || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || 128378 === e || 128405 === e || 128406 === e || 128420 === e || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || 128716 === e || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || 128747 === e || 128748 === e || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || 129008 === e || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\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, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, dist_Ft = /\p{M}+/gu, dist_yt = {
555
- limit: 1 / 0,
556
- ellipsis: ""
557
- }, Le = (e, r = {}, s = {})=>{
558
- const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, dist_yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
559
- let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
560
- e: for(;;){
561
- if (b > A || m >= d && m > $) {
562
- const T = e.slice(A, b) || e.slice($, m);
563
- F = 0;
564
- for (const M of T.replaceAll(dist_Ft, "")){
565
- const O = M.codePointAt(0) || 0;
566
- if (dist_gt(O) ? S = f : dist_ft(O) ? S = E : c !== g && dist_mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
567
- y = !0;
568
- break e;
569
- }
570
- F += M.length, w += S;
571
- }
572
- A = b = 0;
573
- }
574
- if (m >= d) break;
575
- if (ne.lastIndex = m, ne.test(e)) {
576
- if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
577
- y = !0;
578
- break;
579
- }
580
- w += S, A = $, b = m, m = $ = ne.lastIndex;
581
- continue;
582
- }
583
- if (we.lastIndex = m, we.test(e)) {
584
- if (w + u > C && (v = Math.min(v, m)), w + u > i) {
585
- y = !0;
586
- break;
587
- }
588
- w += u, A = $, b = m, m = $ = we.lastIndex;
589
- continue;
590
- }
591
- if (re.lastIndex = m, re.test(e)) {
592
- if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
593
- y = !0;
594
- break;
595
- }
596
- w += S, A = $, b = m, m = $ = re.lastIndex;
597
- continue;
598
- }
599
- if (ie.lastIndex = m, ie.test(e)) {
600
- if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
601
- y = !0;
602
- break;
603
- }
604
- w += S, A = $, b = m, m = $ = ie.lastIndex;
605
- continue;
606
- }
607
- if (Ae.lastIndex = m, Ae.test(e)) {
608
- if (w + p > C && (v = Math.min(v, m)), w + p > i) {
609
- y = !0;
610
- break;
611
- }
612
- w += p, A = $, b = m, m = $ = Ae.lastIndex;
613
- continue;
614
- }
615
- m += 1;
616
- }
617
- return {
618
- width: y ? C : w,
619
- index: y ? v : d,
620
- truncated: y,
621
- ellipsed: y && i >= o
622
- };
623
- }, dist_Et = {
624
- limit: 1 / 0,
625
- ellipsis: "",
626
- ellipsisWidth: 0
627
- }, D = (e, r = {})=>Le(e, dist_Et, r).width, ae = "\x1B", je = "\x9B", dist_vt = 39, Ce = "\x07", ke = "[", dist_wt = "]", Ve = "m", Se = `${dist_wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), dist_At = (e)=>{
628
- if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
629
- if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
630
- if (1 === e || 2 === e) return 22;
631
- if (3 === e) return 23;
632
- if (4 === e) return 24;
633
- if (7 === e) return 27;
634
- if (8 === e) return 28;
635
- if (9 === e) return 29;
636
- if (0 === e) return 0;
637
- }, Ue = (e)=>`${ae}${ke}${e}${Ve}`, Ke = (e)=>`${ae}${Se}${e}${Ce}`, dist_Ct = (e)=>e.map((r)=>D(r)), Ie = (e, r, s)=>{
638
- const i = r[Symbol.iterator]();
639
- let a = !1, o = !1, u = e.at(-1), l = void 0 === u ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
640
- for(; !n.done;){
641
- const f = n.value, g = D(f);
642
- l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l !== s || c.done || (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
643
- }
644
- u = e.at(-1), !l && void 0 !== u && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
645
- }, dist_St = (e)=>{
646
- const r = e.split(" ");
647
- let s = r.length;
648
- for(; s > 0 && !(D(r[s - 1]) > 0);)s--;
649
- return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
650
- }, dist_It = (e, r, s = {})=>{
651
- if (!1 !== s.trim && "" === e.trim()) return "";
652
- let i = "", a, o;
653
- const u = e.split(" "), l = dist_Ct(u);
654
- let n = [
655
- ""
656
- ];
657
- for (const [$, m] of u.entries()){
658
- !1 !== s.trim && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
659
- let d = D(n.at(-1) ?? "");
660
- if (0 !== $ && (d >= r && (!1 === s.wordWrap || !1 === s.trim) && (n.push(""), d = 0), (d > 0 || !1 === s.trim) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
661
- const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
662
- Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
663
- continue;
664
- }
665
- if (d + l[$] > r && d > 0 && l[$] > 0) {
666
- if (!1 === s.wordWrap && d < r) {
667
- Ie(n, m, r);
668
- continue;
669
- }
670
- n.push("");
671
- }
672
- if (d + l[$] > r && !1 === s.wordWrap) {
673
- Ie(n, m, r);
674
- continue;
675
- }
676
- n[n.length - 1] += m;
677
- }
678
- !1 !== s.trim && (n = n.map(($)=>dist_St($)));
679
- const c = n.join(`
680
- `), p = c[Symbol.iterator]();
681
- let f = p.next(), g = p.next(), E = 0;
682
- for(; !f.done;){
683
- const $ = f.value, m = g.value;
684
- if (i += $, $ === ae || $ === je) {
685
- He.lastIndex = E + 1;
686
- const y = He.exec(c)?.groups;
687
- if (y?.code !== void 0) {
688
- const v = Number.parseFloat(y.code);
689
- a = v === dist_vt ? void 0 : v;
690
- } else y?.uri !== void 0 && (o = 0 === y.uri.length ? void 0 : y.uri);
691
- }
692
- const d = a ? dist_At(a) : void 0;
693
- m === `
694
- ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
695
- ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
696
- }
697
- return i;
698
- };
699
- function J(e, r, s) {
700
- return String(e).normalize().replaceAll(`\r
701
- `, `
702
- `).split(`
703
- `).map((i)=>dist_It(i, r, s)).join(`
704
- `);
705
- }
706
- const dist_bt = (e, r, s, i, a)=>{
707
- let o = r, u = 0;
708
- for(let l = s; l < i; l++){
709
- const n = e[l];
710
- if (o -= n.length, u++, o <= a) break;
711
- }
712
- return {
713
- lineCount: o,
714
- removals: u
715
- };
716
- }, dist_X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = 1 / 0, columnPadding: o = 0, rowPadding: u = 4 })=>{
717
- const l = dist_rt(i) - o, n = dist_nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
718
- let g = 0;
719
- e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
720
- let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
721
- const m = Math.min(g + f, r.length), d = [];
722
- let F = 0;
723
- E && F++, $ && F++;
724
- const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
725
- for(let A = y; A < v; A++){
726
- const b = J(s(r[A], A === e), l, {
727
- hard: !0,
728
- trim: !1
729
- }).split(`
730
- `);
731
- d.push(b), F += b.length;
732
- }
733
- if (F > p) {
734
- let A = 0, b = 0, w = F;
735
- const S = e - y, T = (M, O)=>dist_bt(d, w, M, O, p);
736
- E ? ({ lineCount: w, removals: A } = T(0, S), w > p && ({ lineCount: w, removals: b } = T(S + 1, d.length))) : ({ lineCount: w, removals: b } = T(S + 1, d.length), w > p && ({ lineCount: w, removals: A } = T(0, S))), A > 0 && (E = !0, d.splice(0, A)), b > 0 && ($ = !0, d.splice(d.length - b, b));
737
- }
738
- const C = [];
739
- E && C.push(c);
740
- for (const A of d)for (const b of A)C.push(b);
741
- return $ && C.push(c), C;
742
- };
743
- const Rt = (e)=>{
744
- const r = e.active ?? "Yes", s = e.inactive ?? "No";
745
- return new kt({
746
- active: r,
747
- inactive: s,
748
- signal: e.signal,
749
- input: e.input,
750
- output: e.output,
751
- initialValue: e.initialValue ?? !0,
752
- render () {
753
- const i = e.withGuide ?? dist_.withGuide, a = `${i ? `${styleText("gray", dist_h)}
754
- ` : ""}${dist_W(this.state)} ${e.message}
755
- `, o = this.value ? r : s;
756
- switch(this.state){
757
- case "submit":
758
- {
759
- const u = i ? `${styleText("gray", dist_h)} ` : "";
760
- return `${a}${u}${styleText("dim", o)}`;
761
- }
762
- case "cancel":
763
- {
764
- const u = i ? `${styleText("gray", dist_h)} ` : "";
765
- return `${a}${u}${styleText([
766
- "strikethrough",
767
- "dim"
768
- ], o)}${i ? `
769
- ${styleText("gray", dist_h)}` : ""}`;
770
- }
771
- default:
772
- {
773
- const u = i ? `${styleText("cyan", dist_h)} ` : "", l = i ? styleText("cyan", dist_x) : "";
774
- return `${a}${u}${this.value ? `${styleText("green", dist_z)} ${r}` : `${styleText("dim", dist_H)} ${styleText("dim", r)}`}${e.vertical ? i ? `
775
- ${styleText("cyan", dist_h)} ` : `
776
- ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", dist_H)} ${styleText("dim", s)}` : `${styleText("green", dist_z)} ${s}`}
777
- ${l}
778
- `;
779
- }
780
- }
781
- }
782
- }).prompt();
783
- }, R = {
784
- message: (e = [], { symbol: r = styleText("gray", dist_h), secondarySymbol: s = styleText("gray", dist_h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {})=>{
785
- const u = [], l = o ?? dist_.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
786
- for(let g = 0; g < a; g++)u.push(n);
787
- const f = Array.isArray(e) ? e : e.split(`
788
- `);
789
- if (f.length > 0) {
790
- const [g, ...E] = f;
791
- g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
792
- for (const $ of E)$.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
793
- }
794
- i.write(`${u.join(`
795
- `)}
796
- `);
797
- },
798
- info: (e, r)=>{
799
- R.message(e, {
800
- ...r,
801
- symbol: styleText("blue", fe)
802
- });
803
- },
804
- success: (e, r)=>{
805
- R.message(e, {
806
- ...r,
807
- symbol: styleText("green", Fe)
808
- });
809
- },
810
- step: (e, r)=>{
811
- R.message(e, {
812
- ...r,
813
- symbol: styleText("green", dist_V)
814
- });
815
- },
816
- warn: (e, r)=>{
817
- R.message(e, {
818
- ...r,
819
- symbol: styleText("yellow", ye)
820
- });
821
- },
822
- warning: (e, r)=>{
823
- R.warn(e, r);
824
- },
825
- error: (e, r)=>{
826
- R.message(e, {
827
- ...r,
828
- symbol: styleText("red", Ee)
829
- });
830
- }
831
- }, Nt = (e = "", r)=>{
832
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_x)} ` : "";
833
- s.write(`${i}${styleText("red", e)}
834
-
835
- `);
836
- }, dist_Wt = (e = "", r)=>{
837
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", he)} ` : "";
838
- s.write(`${i}${e}
839
- `);
840
- }, Gt = (e = "", r)=>{
841
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_h)}
842
- ${styleText("gray", dist_x)} ` : "";
843
- s.write(`${i}${e}
844
-
845
- `);
846
- }, jt = (e)=>styleText("dim", e), dist_kt = (e, r, s)=>{
847
- const i = {
848
- hard: !0,
849
- trim: !1
850
- }, a = J(e, r, i).split(`
851
- `), o = a.reduce((n, c)=>Math.max(D(c), n), 0), u = a.map(s).reduce((n, c)=>Math.max(D(c), n), 0), l = r - (u - o);
852
- return J(e, l, i);
853
- }, dist_Vt = (e = "", r = "", s)=>{
854
- const i = s?.output ?? node_process.stdout, a = s?.withGuide ?? dist_.withGuide, o = s?.format ?? jt, u = [
855
- "",
856
- ...dist_kt(e, dist_rt(i) - 6, o).split(`
857
- `).map(o),
858
- ""
859
- ], l = D(r), n = Math.max(u.reduce((g, E)=>{
860
- const $ = D(E);
861
- return $ > g ? $ : g;
862
- }, 0), l) + 2, c = u.map((g)=>`${styleText("gray", dist_h)} ${g}${" ".repeat(n - D(g))}${styleText("gray", dist_h)}`).join(`
863
- `), p = a ? `${styleText("gray", dist_h)}
864
- ` : "", f = a ? We : ge;
865
- i.write(`${p}${styleText("green", dist_V)} ${styleText("reset", r)} ${styleText("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
866
- ${c}
867
- ${styleText("gray", f + se.repeat(n + 2) + me)}
868
- `);
869
- }, Kt = (e)=>styleText("magenta", e), be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? [
870
- "\u25D2",
871
- "\u25D0",
872
- "\u25D3",
873
- "\u25D1"
874
- ] : [
875
- "\u2022",
876
- "o",
877
- "O",
878
- "0"
879
- ], delay: u = ee ? 80 : 120, signal: l, ...n } = {})=>{
880
- const c = ce();
881
- let p, f, g = !1, E = !1, $ = "", m, d = performance.now();
882
- const F = dist_rt(s), y = n?.styleFrame ?? Kt, v = (B)=>{
883
- const P = B > 1 ? a ?? dist_.messages.error : i ?? dist_.messages.cancel;
884
- E = 1 === B, g && (k(P, B), E && "function" == typeof r && r());
885
- }, C = ()=>v(2), A = ()=>v(1), b = ()=>{
886
- process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
887
- }, w = ()=>{
888
- process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
889
- }, S = ()=>{
890
- if (void 0 === m) return;
891
- c && s.write(`
892
- `);
893
- const B = J(m, F, {
894
- hard: !0,
895
- trim: !1
896
- }).split(`
897
- `);
898
- B.length > 1 && s.write(src.cursor.up(B.length - 1)), s.write(src.cursor.to(0)), s.write(src.erase.down());
899
- }, T = (B)=>B.replace(/\.+$/, ""), M = (B)=>{
900
- const P = (performance.now() - B) / 1e3, G = Math.floor(P / 60), L = Math.floor(P % 60);
901
- return G > 0 ? `[${G}m ${L}s]` : `[${L}s]`;
902
- }, O = n.withGuide ?? dist_.withGuide, le = (B = "")=>{
903
- g = !0, p = xt({
904
- output: s
905
- }), $ = T(B), d = performance.now(), O && s.write(`${styleText("gray", dist_h)}
906
- `);
907
- let P = 0, G = 0;
908
- b(), f = setInterval(()=>{
909
- if (c && $ === m) return;
910
- S(), m = $;
911
- const L = y(o[P]);
912
- let Z;
913
- if (c) Z = `${L} ${$}...`;
914
- else if ("timer" === e) Z = `${L} ${$} ${M(d)}`;
915
- else {
916
- const et = ".".repeat(Math.floor(G)).slice(0, 3);
917
- Z = `${L} ${$}${et}`;
918
- }
919
- const Ze = J(Z, F, {
920
- hard: !0,
921
- trim: !1
922
- });
923
- s.write(Ze), P = P + 1 < o.length ? P + 1 : 0, G = G < 4 ? G + .125 : 0;
924
- }, u);
925
- }, k = (B = "", P = 0, G = !1)=>{
926
- if (!g) return;
927
- g = !1, clearInterval(f), S();
928
- const L = 0 === P ? styleText("green", dist_V) : 1 === P ? styleText("red", $e) : styleText("red", de);
929
- $ = B ?? $, G || ("timer" === e ? s.write(`${L} ${$} ${M(d)}
930
- `) : s.write(`${L} ${$}
931
- `)), w(), p();
932
- };
933
- return {
934
- start: le,
935
- stop: (B = "")=>k(B, 0),
936
- message: (B = "")=>{
937
- $ = T(B ?? $);
938
- },
939
- cancel: (B = "")=>k(B, 1),
940
- error: (B = "")=>k(B, 2),
941
- clear: ()=>k("", 0, !0),
942
- get isCancelled () {
943
- return E;
944
- }
945
- };
946
- };
947
- I("\u2500", "-"), I("\u2501", "="), I("\u2588", "#");
948
- const oe = (e, r)=>e.includes(`
949
- `) ? e.split(`
950
- `).map((s)=>r(s)).join(`
951
- `) : r(e), Jt = (e)=>{
952
- const r = (s, i)=>{
953
- const a = s.label ?? String(s.value);
954
- switch(i){
955
- case "disabled":
956
- return `${styleText("gray", dist_H)} ${oe(a, (o)=>styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
957
- case "selected":
958
- return `${oe(a, (o)=>styleText("dim", o))}`;
959
- case "active":
960
- return `${styleText("green", dist_z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
961
- case "cancelled":
962
- return `${oe(a, (o)=>styleText([
963
- "strikethrough",
964
- "dim"
965
- ], o))}`;
966
- default:
967
- return `${styleText("dim", dist_H)} ${oe(a, (o)=>styleText("dim", o))}`;
968
- }
969
- };
970
- return new Tt({
971
- options: e.options,
972
- signal: e.signal,
973
- input: e.input,
974
- output: e.output,
975
- initialValue: e.initialValue,
976
- render () {
977
- const s = e.withGuide ?? dist_.withGuide, i = `${dist_W(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${styleText("gray", dist_h)}
978
- ` : ""}${o}
979
- `;
980
- switch(this.state){
981
- case "submit":
982
- {
983
- const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
984
- return `${u}${n}`;
985
- }
986
- case "cancel":
987
- {
988
- const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
989
- return `${u}${n}${s ? `
990
- ${styleText("gray", dist_h)}` : ""}`;
991
- }
992
- default:
993
- {
994
- const l = s ? `${styleText("cyan", dist_h)} ` : "", n = s ? styleText("cyan", dist_x) : "", c = u.split(`
995
- `).length, p = s ? 2 : 1;
996
- return `${u}${l}${dist_X({
997
- output: e.output,
998
- cursor: this.cursor,
999
- options: this.options,
1000
- maxItems: e.maxItems,
1001
- columnPadding: l.length,
1002
- rowPadding: c + p,
1003
- style: (f, g)=>r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
1004
- }).join(`
1005
- ${l}`)}
1006
- ${n}
1007
- `;
1008
- }
1009
- }
1010
- }
1011
- }).prompt();
1012
- };
1013
- styleText("gray", dist_h);
1014
- export { Ct as isCancel, Gt as outro, Jt as select, Nt as cancel, R as log, Rt as confirm, be as spinner, dist_Vt as note, dist_Wt as intro };