@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.
@@ -0,0 +1,1044 @@
1
+ import "node:module";
2
+ import { styleText } from "node:util";
3
+ import node_process, { stdin, stdout } from "node:process";
4
+ import { ReadStream } from "node:tty";
5
+ import "node:fs";
6
+ import "node:path";
7
+ import { __webpack_require__ } from "../0~rslib-runtime.js";
8
+ import * as __rspack_external_node_readline_91c31510 from "node:readline";
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 isAmbiguous = (x)=>0xA1 === x || 0xA4 === x || 0xA7 === x || 0xA8 === x || 0xAA === x || 0xAD === x || 0xAE === x || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || 0xC6 === x || 0xD0 === x || 0xD7 === x || 0xD8 === x || x >= 0xDE && x <= 0xE1 || 0xE6 === x || x >= 0xE8 && x <= 0xEA || 0xEC === x || 0xED === x || 0xF0 === x || 0xF2 === x || 0xF3 === x || x >= 0xF7 && x <= 0xFA || 0xFC === x || 0xFE === x || 0x101 === x || 0x111 === x || 0x113 === x || 0x11B === x || 0x126 === x || 0x127 === x || 0x12B === x || x >= 0x131 && x <= 0x133 || 0x138 === x || x >= 0x13F && x <= 0x142 || 0x144 === x || x >= 0x148 && x <= 0x14B || 0x14D === x || 0x152 === x || 0x153 === x || 0x166 === x || 0x167 === x || 0x16B === x || 0x1CE === x || 0x1D0 === x || 0x1D2 === x || 0x1D4 === x || 0x1D6 === x || 0x1D8 === x || 0x1DA === x || 0x1DC === x || 0x251 === x || 0x261 === x || 0x2C4 === x || 0x2C7 === x || x >= 0x2C9 && x <= 0x2CB || 0x2CD === x || 0x2D0 === x || x >= 0x2D8 && x <= 0x2DB || 0x2DD === x || 0x2DF === x || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || 0x401 === x || x >= 0x410 && x <= 0x44F || 0x451 === x || 0x2010 === x || x >= 0x2013 && x <= 0x2016 || 0x2018 === x || 0x2019 === x || 0x201C === x || 0x201D === x || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || 0x2030 === x || 0x2032 === x || 0x2033 === x || 0x2035 === x || 0x203B === x || 0x203E === x || 0x2074 === x || 0x207F === x || x >= 0x2081 && x <= 0x2084 || 0x20AC === x || 0x2103 === x || 0x2105 === x || 0x2109 === x || 0x2113 === x || 0x2116 === x || 0x2121 === x || 0x2122 === x || 0x2126 === x || 0x212B === x || 0x2153 === x || 0x2154 === x || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || 0x2189 === x || x >= 0x2190 && x <= 0x2199 || 0x21B8 === x || 0x21B9 === x || 0x21D2 === x || 0x21D4 === x || 0x21E7 === x || 0x2200 === x || 0x2202 === x || 0x2203 === x || 0x2207 === x || 0x2208 === x || 0x220B === x || 0x220F === x || 0x2211 === x || 0x2215 === x || 0x221A === x || x >= 0x221D && x <= 0x2220 || 0x2223 === x || 0x2225 === x || x >= 0x2227 && x <= 0x222C || 0x222E === x || x >= 0x2234 && x <= 0x2237 || 0x223C === x || 0x223D === x || 0x2248 === x || 0x224C === x || 0x2252 === x || 0x2260 === x || 0x2261 === x || x >= 0x2264 && x <= 0x2267 || 0x226A === x || 0x226B === x || 0x226E === x || 0x226F === x || 0x2282 === x || 0x2283 === x || 0x2286 === x || 0x2287 === x || 0x2295 === x || 0x2299 === x || 0x22A5 === x || 0x22BF === x || 0x2312 === x || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || 0x25A0 === x || 0x25A1 === x || x >= 0x25A3 && x <= 0x25A9 || 0x25B2 === x || 0x25B3 === x || 0x25B6 === x || 0x25B7 === x || 0x25BC === x || 0x25BD === x || 0x25C0 === x || 0x25C1 === x || x >= 0x25C6 && x <= 0x25C8 || 0x25CB === x || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || 0x25EF === x || 0x2605 === x || 0x2606 === x || 0x2609 === x || 0x260E === x || 0x260F === x || 0x261C === x || 0x261E === x || 0x2640 === x || 0x2642 === x || 0x2660 === x || 0x2661 === x || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || 0x266C === x || 0x266D === x || 0x266F === x || 0x269E === x || 0x269F === x || 0x26BF === x || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || 0x26E3 === x || 0x26E8 === x || 0x26E9 === x || x >= 0x26EB && x <= 0x26F1 || 0x26F4 === x || x >= 0x26F6 && x <= 0x26F9 || 0x26FB === x || 0x26FC === x || 0x26FE === x || 0x26FF === x || 0x273D === x || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || 0xFFFD === x || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || 0x1F18F === x || 0x1F190 === x || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;
66
+ const isFullWidth = (x)=>0x3000 === x || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;
67
+ const isWide = (x)=>x >= 0x1100 && x <= 0x115F || 0x231A === x || 0x231B === x || 0x2329 === x || 0x232A === x || x >= 0x23E9 && x <= 0x23EC || 0x23F0 === x || 0x23F3 === x || 0x25FD === x || 0x25FE === x || 0x2614 === x || 0x2615 === x || x >= 0x2648 && x <= 0x2653 || 0x267F === x || 0x2693 === x || 0x26A1 === x || 0x26AA === x || 0x26AB === x || 0x26BD === x || 0x26BE === x || 0x26C4 === x || 0x26C5 === x || 0x26CE === x || 0x26D4 === x || 0x26EA === x || 0x26F2 === x || 0x26F3 === x || 0x26F5 === x || 0x26FA === x || 0x26FD === x || 0x2705 === x || 0x270A === x || 0x270B === x || 0x2728 === x || 0x274C === x || 0x274E === x || x >= 0x2753 && x <= 0x2755 || 0x2757 === x || x >= 0x2795 && x <= 0x2797 || 0x27B0 === x || 0x27BF === x || 0x2B1B === x || 0x2B1C === x || 0x2B50 === x || 0x2B55 === x || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || 0x16FF0 === x || 0x16FF1 === x || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || 0x1AFFD === x || 0x1AFFE === x || x >= 0x1B000 && x <= 0x1B122 || 0x1B132 === x || x >= 0x1B150 && x <= 0x1B152 || 0x1B155 === x || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || 0x1F004 === x || 0x1F0CF === x || 0x1F18E === x || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || 0x1F250 === x || 0x1F251 === x || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || 0x1F3F4 === x || x >= 0x1F3F8 && x <= 0x1F43E || 0x1F440 === x || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || 0x1F57A === x || 0x1F595 === x || 0x1F596 === x || 0x1F5A4 === x || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || 0x1F6CC === x || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || 0x1F6EB === x || 0x1F6EC === x || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || 0x1F7F0 === x || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;
68
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
69
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
70
+ const TAB_RE = /\t{1,1000}/y;
71
+ const 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;
72
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
73
+ const MODIFIER_RE = /\p{M}+/gu;
74
+ const NO_TRUNCATION = {
75
+ limit: 1 / 0,
76
+ ellipsis: ''
77
+ };
78
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})=>{
79
+ const LIMIT = truncationOptions.limit ?? 1 / 0;
80
+ const ELLIPSIS = truncationOptions.ellipsis ?? '';
81
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
82
+ const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
83
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
84
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
85
+ const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
86
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
87
+ const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
88
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
89
+ const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
90
+ let indexPrev = 0;
91
+ let index = 0;
92
+ let length = input.length;
93
+ let lengthExtra = 0;
94
+ let truncationEnabled = false;
95
+ let truncationIndex = length;
96
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
97
+ let unmatchedStart = 0;
98
+ let unmatchedEnd = 0;
99
+ let width = 0;
100
+ let widthExtra = 0;
101
+ outer: while(true){
102
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
103
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
104
+ lengthExtra = 0;
105
+ for (const char of unmatched.replaceAll(MODIFIER_RE, '')){
106
+ const codePoint = char.codePointAt(0) || 0;
107
+ widthExtra = isFullWidth(codePoint) ? FULL_WIDTH_WIDTH : isWide(codePoint) ? WIDE_WIDTH : AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint) ? AMBIGUOUS_WIDTH : REGULAR_WIDTH;
108
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
109
+ if (width + widthExtra > LIMIT) {
110
+ truncationEnabled = true;
111
+ break outer;
112
+ }
113
+ lengthExtra += char.length;
114
+ width += widthExtra;
115
+ }
116
+ unmatchedStart = unmatchedEnd = 0;
117
+ }
118
+ if (index >= length) break;
119
+ LATIN_RE.lastIndex = index;
120
+ if (LATIN_RE.test(input)) {
121
+ lengthExtra = LATIN_RE.lastIndex - index;
122
+ widthExtra = lengthExtra * REGULAR_WIDTH;
123
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
124
+ if (width + widthExtra > LIMIT) {
125
+ truncationEnabled = true;
126
+ break;
127
+ }
128
+ width += widthExtra;
129
+ unmatchedStart = indexPrev;
130
+ unmatchedEnd = index;
131
+ index = indexPrev = LATIN_RE.lastIndex;
132
+ continue;
133
+ }
134
+ ANSI_RE.lastIndex = index;
135
+ if (ANSI_RE.test(input)) {
136
+ if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
137
+ if (width + ANSI_WIDTH > LIMIT) {
138
+ truncationEnabled = true;
139
+ break;
140
+ }
141
+ width += ANSI_WIDTH;
142
+ unmatchedStart = indexPrev;
143
+ unmatchedEnd = index;
144
+ index = indexPrev = ANSI_RE.lastIndex;
145
+ continue;
146
+ }
147
+ CONTROL_RE.lastIndex = index;
148
+ if (CONTROL_RE.test(input)) {
149
+ lengthExtra = CONTROL_RE.lastIndex - index;
150
+ widthExtra = lengthExtra * CONTROL_WIDTH;
151
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
152
+ if (width + widthExtra > LIMIT) {
153
+ truncationEnabled = true;
154
+ break;
155
+ }
156
+ width += widthExtra;
157
+ unmatchedStart = indexPrev;
158
+ unmatchedEnd = index;
159
+ index = indexPrev = CONTROL_RE.lastIndex;
160
+ continue;
161
+ }
162
+ TAB_RE.lastIndex = index;
163
+ if (TAB_RE.test(input)) {
164
+ lengthExtra = TAB_RE.lastIndex - index;
165
+ widthExtra = lengthExtra * TAB_WIDTH;
166
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
167
+ if (width + widthExtra > LIMIT) {
168
+ truncationEnabled = true;
169
+ break;
170
+ }
171
+ width += widthExtra;
172
+ unmatchedStart = indexPrev;
173
+ unmatchedEnd = index;
174
+ index = indexPrev = TAB_RE.lastIndex;
175
+ continue;
176
+ }
177
+ EMOJI_RE.lastIndex = index;
178
+ if (EMOJI_RE.test(input)) {
179
+ if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
180
+ if (width + EMOJI_WIDTH > LIMIT) {
181
+ truncationEnabled = true;
182
+ break;
183
+ }
184
+ width += EMOJI_WIDTH;
185
+ unmatchedStart = indexPrev;
186
+ unmatchedEnd = index;
187
+ index = indexPrev = EMOJI_RE.lastIndex;
188
+ continue;
189
+ }
190
+ index += 1;
191
+ }
192
+ return {
193
+ width: truncationEnabled ? truncationLimit : width,
194
+ index: truncationEnabled ? truncationIndex : length,
195
+ truncated: truncationEnabled,
196
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
197
+ };
198
+ };
199
+ const dist = getStringTruncatedWidth;
200
+ const dist_NO_TRUNCATION = {
201
+ limit: 1 / 0,
202
+ ellipsis: '',
203
+ ellipsisWidth: 0
204
+ };
205
+ const fastStringWidth = (input, options = {})=>dist(input, dist_NO_TRUNCATION, options).width;
206
+ const fast_string_width_dist = fastStringWidth;
207
+ const ESC = '\x1B';
208
+ const CSI = '\x9B';
209
+ const END_CODE = 39;
210
+ const ANSI_ESCAPE_BELL = '\u0007';
211
+ const ANSI_CSI = '[';
212
+ const ANSI_OSC = ']';
213
+ const ANSI_SGR_TERMINATOR = 'm';
214
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
215
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
216
+ const getClosingCode = (openingCode)=>{
217
+ if (openingCode >= 30 && openingCode <= 37) return 39;
218
+ if (openingCode >= 90 && openingCode <= 97) return 39;
219
+ if (openingCode >= 40 && openingCode <= 47) return 49;
220
+ if (openingCode >= 100 && openingCode <= 107) return 49;
221
+ if (1 === openingCode || 2 === openingCode) return 22;
222
+ if (3 === openingCode) return 23;
223
+ if (4 === openingCode) return 24;
224
+ if (7 === openingCode) return 27;
225
+ if (8 === openingCode) return 28;
226
+ if (9 === openingCode) return 29;
227
+ if (0 === openingCode) return 0;
228
+ };
229
+ const wrapAnsiCode = (code)=>`${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
230
+ const wrapAnsiHyperlink = (url)=>`${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
231
+ const wrapWord = (rows, word, columns)=>{
232
+ const characters = word[Symbol.iterator]();
233
+ let isInsideEscape = false;
234
+ let isInsideLinkEscape = false;
235
+ let lastRow = rows.at(-1);
236
+ let visible = void 0 === lastRow ? 0 : fast_string_width_dist(lastRow);
237
+ let currentCharacter = characters.next();
238
+ let nextCharacter = characters.next();
239
+ let rawCharacterIndex = 0;
240
+ while(!currentCharacter.done){
241
+ const character = currentCharacter.value;
242
+ const characterLength = fast_string_width_dist(character);
243
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
244
+ else {
245
+ rows.push(character);
246
+ visible = 0;
247
+ }
248
+ if (character === ESC || character === CSI) {
249
+ isInsideEscape = true;
250
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
251
+ }
252
+ if (isInsideEscape) {
253
+ if (isInsideLinkEscape) {
254
+ if (character === ANSI_ESCAPE_BELL) {
255
+ isInsideEscape = false;
256
+ isInsideLinkEscape = false;
257
+ }
258
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
259
+ } else {
260
+ visible += characterLength;
261
+ if (visible === columns && !nextCharacter.done) {
262
+ rows.push('');
263
+ visible = 0;
264
+ }
265
+ }
266
+ currentCharacter = nextCharacter;
267
+ nextCharacter = characters.next();
268
+ rawCharacterIndex += character.length;
269
+ }
270
+ lastRow = rows.at(-1);
271
+ if (!visible && void 0 !== lastRow && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
272
+ };
273
+ const stringVisibleTrimSpacesRight = (string)=>{
274
+ const words = string.split(' ');
275
+ let last = words.length;
276
+ while(last){
277
+ if (fast_string_width_dist(words[last - 1])) break;
278
+ last--;
279
+ }
280
+ if (last === words.length) return string;
281
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
282
+ };
283
+ const exec = (string, columns, options = {})=>{
284
+ if (false !== options.trim && '' === string.trim()) return '';
285
+ let returnValue = '';
286
+ let escapeCode;
287
+ let escapeUrl;
288
+ const words = string.split(' ');
289
+ let rows = [
290
+ ''
291
+ ];
292
+ let rowLength = 0;
293
+ for(let index = 0; index < words.length; index++){
294
+ const word = words[index];
295
+ if (false !== options.trim) {
296
+ const row = rows.at(-1) ?? '';
297
+ const trimmed = row.trimStart();
298
+ if (row.length !== trimmed.length) {
299
+ rows[rows.length - 1] = trimmed;
300
+ rowLength = fast_string_width_dist(trimmed);
301
+ }
302
+ }
303
+ if (0 !== index) {
304
+ if (rowLength >= columns && (false === options.wordWrap || false === options.trim)) {
305
+ rows.push('');
306
+ rowLength = 0;
307
+ }
308
+ if (rowLength || false === options.trim) {
309
+ rows[rows.length - 1] += ' ';
310
+ rowLength++;
311
+ }
312
+ }
313
+ const wordLength = fast_string_width_dist(word);
314
+ if (options.hard && wordLength > columns) {
315
+ const remainingColumns = columns - rowLength;
316
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
317
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
318
+ if (breaksStartingNextLine < breaksStartingThisLine) rows.push('');
319
+ wrapWord(rows, word, columns);
320
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
321
+ continue;
322
+ }
323
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
324
+ if (false === options.wordWrap && rowLength < columns) {
325
+ wrapWord(rows, word, columns);
326
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
327
+ continue;
328
+ }
329
+ rows.push('');
330
+ rowLength = 0;
331
+ }
332
+ if (rowLength + wordLength > columns && false === options.wordWrap) {
333
+ wrapWord(rows, word, columns);
334
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
335
+ continue;
336
+ }
337
+ rows[rows.length - 1] += word;
338
+ rowLength += wordLength;
339
+ }
340
+ if (false !== options.trim) rows = rows.map((row)=>stringVisibleTrimSpacesRight(row));
341
+ const preString = rows.join('\n');
342
+ let inSurrogate = false;
343
+ for(let i = 0; i < preString.length; i++){
344
+ const character = preString[i];
345
+ returnValue += character;
346
+ if (!inSurrogate) {
347
+ inSurrogate = character >= '\ud800' && character <= '\udbff';
348
+ if (character === ESC || character === CSI) {
349
+ GROUP_REGEX.lastIndex = i + 1;
350
+ const groupsResult = GROUP_REGEX.exec(preString);
351
+ const groups = groupsResult?.groups;
352
+ if (groups?.code !== void 0) {
353
+ const code = Number.parseFloat(groups.code);
354
+ escapeCode = code === END_CODE ? void 0 : code;
355
+ } else if (groups?.uri !== void 0) escapeUrl = 0 === groups.uri.length ? void 0 : groups.uri;
356
+ }
357
+ if ('\n' === preString[i + 1]) {
358
+ if (escapeUrl) returnValue += wrapAnsiHyperlink('');
359
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
360
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
361
+ } else if ('\n' === character) {
362
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
363
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
364
+ }
365
+ }
366
+ }
367
+ return returnValue;
368
+ };
369
+ const CRLF_OR_LF = /\r?\n/;
370
+ function wrapAnsi(string, columns, options) {
371
+ return String(string).normalize().split(CRLF_OR_LF).map((line)=>exec(line, columns, options)).join('\n');
372
+ }
373
+ const src = __webpack_require__("../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
374
+ function d(r, t, e) {
375
+ if (!e.some((o)=>!o.disabled)) return r;
376
+ const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
377
+ return e[n].disabled ? d(n, t < 0 ? -1 : 1, e) : n;
378
+ }
379
+ const E = [
380
+ "up",
381
+ "down",
382
+ "left",
383
+ "right",
384
+ "space",
385
+ "enter",
386
+ "cancel"
387
+ ], dist_G = [
388
+ "January",
389
+ "February",
390
+ "March",
391
+ "April",
392
+ "May",
393
+ "June",
394
+ "July",
395
+ "August",
396
+ "September",
397
+ "October",
398
+ "November",
399
+ "December"
400
+ ], dist_u = {
401
+ actions: new Set(E),
402
+ aliases: new Map([
403
+ [
404
+ "k",
405
+ "up"
406
+ ],
407
+ [
408
+ "j",
409
+ "down"
410
+ ],
411
+ [
412
+ "h",
413
+ "left"
414
+ ],
415
+ [
416
+ "l",
417
+ "right"
418
+ ],
419
+ [
420
+ "",
421
+ "cancel"
422
+ ],
423
+ [
424
+ "escape",
425
+ "cancel"
426
+ ]
427
+ ]),
428
+ messages: {
429
+ cancel: "Canceled",
430
+ error: "Something went wrong"
431
+ },
432
+ withGuide: !0,
433
+ date: {
434
+ monthNames: [
435
+ ...dist_G
436
+ ],
437
+ messages: {
438
+ required: "Please enter a valid date",
439
+ invalidMonth: "There are only 12 months in a year",
440
+ invalidDay: (r, t)=>`There are only ${r} days in ${t}`,
441
+ afterMin: (r)=>`Date must be on or after ${r.toISOString().slice(0, 10)}`,
442
+ beforeMax: (r)=>`Date must be on or before ${r.toISOString().slice(0, 10)}`
443
+ }
444
+ }
445
+ };
446
+ function V(r, t) {
447
+ if ("string" == typeof r) return dist_u.aliases.get(r) === t;
448
+ for (const e of r)if (void 0 !== e && V(e, t)) return !0;
449
+ return !1;
450
+ }
451
+ function dist_j(r, t) {
452
+ if (r === t) return;
453
+ const e = r.split(`
454
+ `), s = t.split(`
455
+ `), i = Math.max(e.length, s.length), n = [];
456
+ for(let o = 0; o < i; o++)e[o] !== s[o] && n.push(o);
457
+ return {
458
+ lines: n,
459
+ numLinesBefore: e.length,
460
+ numLinesAfter: s.length,
461
+ numLines: i
462
+ };
463
+ }
464
+ const Y = globalThis.process.platform.startsWith("win"), dist_C = Symbol("clack:cancel");
465
+ function dist_q(r) {
466
+ return r === dist_C;
467
+ }
468
+ function w(r, t) {
469
+ const e = r;
470
+ e.isTTY && e.setRawMode(t);
471
+ }
472
+ function z({ input: r = stdin, output: t = stdout, overwrite: e = !0, hideCursor: s = !0 } = {}) {
473
+ const i = __rspack_external_node_readline_91c31510.createInterface({
474
+ input: r,
475
+ output: t,
476
+ prompt: "",
477
+ tabSize: 1
478
+ });
479
+ __rspack_external_node_readline_91c31510.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(!0);
480
+ const n = (o, { name: a, sequence: h })=>{
481
+ const l = String(o);
482
+ if (V([
483
+ l,
484
+ a,
485
+ h
486
+ ], "cancel")) {
487
+ s && t.write(src.cursor.show), process.exit(0);
488
+ return;
489
+ }
490
+ if (!e) return;
491
+ const f = "return" === a ? 0 : -1, v = "return" === a ? -1 : 0;
492
+ __rspack_external_node_readline_91c31510.moveCursor(t, f, v, ()=>{
493
+ __rspack_external_node_readline_91c31510.clearLine(t, 1, ()=>{
494
+ r.once("keypress", n);
495
+ });
496
+ });
497
+ };
498
+ return s && t.write(src.cursor.hide), r.once("keypress", n), ()=>{
499
+ r.off("keypress", n), s && t.write(src.cursor.show), r instanceof ReadStream && r.isTTY && !Y && r.setRawMode(!1), i.terminal = !1, i.close();
500
+ };
501
+ }
502
+ const O = (r)=>"columns" in r && "number" == typeof r.columns ? r.columns : 80, dist_A = (r)=>"rows" in r && "number" == typeof r.rows ? r.rows : 20;
503
+ function dist_R(r, t, e, s = e) {
504
+ const i = O(r ?? stdout);
505
+ return wrapAnsi(t, i - e.length, {
506
+ hard: !0,
507
+ trim: !1
508
+ }).split(`
509
+ `).map((n, o)=>`${0 === o ? s : e}${n}`).join(`
510
+ `);
511
+ }
512
+ let dist_p = class {
513
+ input;
514
+ output;
515
+ _abortSignal;
516
+ rl;
517
+ opts;
518
+ _render;
519
+ _track = !1;
520
+ _prevFrame = "";
521
+ _subscribers = new Map;
522
+ _cursor = 0;
523
+ state = "initial";
524
+ error = "";
525
+ value;
526
+ userInput = "";
527
+ constructor(t, e = !0){
528
+ const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
529
+ 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 = e, this._abortSignal = o, this.input = s, this.output = i;
530
+ }
531
+ unsubscribe() {
532
+ this._subscribers.clear();
533
+ }
534
+ setSubscriber(t, e) {
535
+ const s = this._subscribers.get(t) ?? [];
536
+ s.push(e), this._subscribers.set(t, s);
537
+ }
538
+ on(t, e) {
539
+ this.setSubscriber(t, {
540
+ cb: e
541
+ });
542
+ }
543
+ once(t, e) {
544
+ this.setSubscriber(t, {
545
+ cb: e,
546
+ once: !0
547
+ });
548
+ }
549
+ emit(t, ...e) {
550
+ const s = this._subscribers.get(t) ?? [], i = [];
551
+ for (const n of s)n.cb(...e), n.once && i.push(()=>s.splice(s.indexOf(n), 1));
552
+ for (const n of i)n();
553
+ }
554
+ prompt() {
555
+ return new Promise((t)=>{
556
+ if (this._abortSignal) {
557
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(dist_C);
558
+ this._abortSignal.addEventListener("abort", ()=>{
559
+ this.state = "cancel", this.close();
560
+ }, {
561
+ once: !0
562
+ });
563
+ }
564
+ this.rl = __rspack_external_node_readline_91c31510["default"].createInterface({
565
+ input: this.input,
566
+ tabSize: 2,
567
+ prompt: "",
568
+ escapeCodeTimeout: 50,
569
+ terminal: !0
570
+ }), 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", ()=>{
571
+ this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(this.value);
572
+ }), this.once("cancel", ()=>{
573
+ this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(dist_C);
574
+ });
575
+ });
576
+ }
577
+ _isActionKey(t, e) {
578
+ return " " === t;
579
+ }
580
+ _setValue(t) {
581
+ this.value = t, this.emit("value", this.value);
582
+ }
583
+ _setUserInput(t, e) {
584
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
585
+ }
586
+ _clearUserInput() {
587
+ this.rl?.write(null, {
588
+ ctrl: !0,
589
+ name: "u"
590
+ }), this._setUserInput("");
591
+ }
592
+ onKeypress(t, e) {
593
+ if (this._track && "return" !== e.name && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
594
+ ctrl: !0,
595
+ name: "h"
596
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), e?.name && (!this._track && dist_u.aliases.has(e.name) && this.emit("cursor", dist_u.aliases.get(e.name)), dist_u.actions.has(e.name) && this.emit("cursor", e.name)), t && ("y" === t.toLowerCase() || "n" === t.toLowerCase()) && this.emit("confirm", "y" === t.toLowerCase()), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
597
+ if (this.opts.validate) {
598
+ const s = this.opts.validate(this.value);
599
+ s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
600
+ }
601
+ "error" !== this.state && (this.state = "submit");
602
+ }
603
+ V([
604
+ t,
605
+ e?.name,
606
+ e?.sequence
607
+ ], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
608
+ }
609
+ close() {
610
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
611
+ `), w(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
612
+ }
613
+ restoreCursor() {
614
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
615
+ hard: !0,
616
+ trim: !1
617
+ }).split(`
618
+ `).length - 1;
619
+ this.output.write(src.cursor.move(-999, -1 * t));
620
+ }
621
+ render() {
622
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
623
+ hard: !0,
624
+ trim: !1
625
+ });
626
+ if (t !== this._prevFrame) {
627
+ if ("initial" === this.state) this.output.write(src.cursor.hide);
628
+ else {
629
+ const e = dist_j(this._prevFrame, t), s = dist_A(this.output);
630
+ if (this.restoreCursor(), e) {
631
+ const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
632
+ let o = e.lines.find((a)=>a >= i);
633
+ if (void 0 === o) {
634
+ this._prevFrame = t;
635
+ return;
636
+ }
637
+ if (1 === e.lines.length) {
638
+ this.output.write(src.cursor.move(0, o - n)), this.output.write(src.erase.lines(1));
639
+ const a = t.split(`
640
+ `);
641
+ this.output.write(a[o]), this._prevFrame = t, this.output.write(src.cursor.move(0, a.length - o - 1));
642
+ return;
643
+ }
644
+ if (e.lines.length > 1) {
645
+ if (i < n) o = i;
646
+ else {
647
+ const h = o - n;
648
+ h > 0 && this.output.write(src.cursor.move(0, h));
649
+ }
650
+ this.output.write(src.erase.down());
651
+ const a = t.split(`
652
+ `).slice(o);
653
+ this.output.write(a.join(`
654
+ `)), this._prevFrame = t;
655
+ return;
656
+ }
657
+ }
658
+ this.output.write(src.erase.down());
659
+ }
660
+ this.output.write(t), "initial" === this.state && (this.state = "active"), this._prevFrame = t;
661
+ }
662
+ }
663
+ };
664
+ class Q extends dist_p {
665
+ get cursor() {
666
+ return this.value ? 0 : 1;
667
+ }
668
+ get _value() {
669
+ return 0 === this.cursor;
670
+ }
671
+ constructor(t){
672
+ super(t, !1), this.value = !!t.initialValue, this.on("userInput", ()=>{
673
+ this.value = this._value;
674
+ }), this.on("confirm", (e)=>{
675
+ this.output.write(src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
676
+ }), this.on("cursor", ()=>{
677
+ this.value = !this.value;
678
+ });
679
+ }
680
+ }
681
+ class nt extends dist_p {
682
+ options;
683
+ cursor = 0;
684
+ get _selectedValue() {
685
+ return this.options[this.cursor];
686
+ }
687
+ changeValue() {
688
+ this.value = this._selectedValue.value;
689
+ }
690
+ constructor(t){
691
+ super(t, !1), this.options = t.options;
692
+ const e = this.options.findIndex(({ value: i })=>i === t.initialValue), s = -1 === e ? 0 : e;
693
+ this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i)=>{
694
+ switch(i){
695
+ case "left":
696
+ case "up":
697
+ this.cursor = d(this.cursor, -1, this.options);
698
+ break;
699
+ case "down":
700
+ case "right":
701
+ this.cursor = d(this.cursor, 1, this.options);
702
+ break;
703
+ }
704
+ this.changeValue();
705
+ });
706
+ }
707
+ }
708
+ function Ze() {
709
+ 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;
710
+ }
711
+ const ee = Ze(), ae = ()=>"true" === process.env.CI, dist_w = (e, i)=>ee ? e : i, _e = dist_w("\u25C6", "*"), oe = dist_w("\u25A0", "x"), ue = dist_w("\u25B2", "x"), dist_F = dist_w("\u25C7", "o"), le = dist_w("\u250C", "T"), dist_d = dist_w("\u2502", "|"), dist_E = dist_w("\u2514", "\u2014"), dist_z = (dist_w("\u2510", "T"), dist_w("\u2518", "\u2014"), dist_w("\u25CF", ">")), dist_H = dist_w("\u25CB", " "), se = (dist_w("\u25FB", "[\u2022]"), dist_w("\u25FC", "[+]"), dist_w("\u25FB", "[ ]"), dist_w("\u25AA", "\u2022"), dist_w("\u2500", "-")), ce = dist_w("\u256E", "+"), Ge = dist_w("\u251C", "+"), $e = dist_w("\u256F", "+"), de = dist_w("\u2570", "+"), he = (dist_w("\u256D", "+"), dist_w("\u25CF", "\u2022")), pe = dist_w("\u25C6", "*"), me = dist_w("\u25B2", "!"), ge = dist_w("\u25A0", "x"), dist_V = (e)=>{
712
+ switch(e){
713
+ case "initial":
714
+ case "active":
715
+ return styleText("cyan", _e);
716
+ case "cancel":
717
+ return styleText("red", oe);
718
+ case "error":
719
+ return styleText("yellow", ue);
720
+ case "submit":
721
+ return styleText("green", dist_F);
722
+ }
723
+ }, ye = (e)=>{
724
+ switch(e){
725
+ case "initial":
726
+ case "active":
727
+ return styleText("cyan", dist_d);
728
+ case "cancel":
729
+ return styleText("red", dist_d);
730
+ case "error":
731
+ return styleText("yellow", dist_d);
732
+ case "submit":
733
+ return styleText("green", dist_d);
734
+ }
735
+ }, dist_et = (e, i, s, r, u)=>{
736
+ let n = i, o = 0;
737
+ for(let c = s; c < r; c++){
738
+ const a = e[c];
739
+ if (n -= a.length, o++, n <= u) break;
740
+ }
741
+ return {
742
+ lineCount: n,
743
+ removals: o
744
+ };
745
+ }, dist_Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = 1 / 0, columnPadding: n = 0, rowPadding: o = 4 })=>{
746
+ const c = O(r) - n, a = dist_A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
747
+ let p = 0;
748
+ e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
749
+ let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
750
+ const S = Math.min(p + y, i.length), h = [];
751
+ let f = 0;
752
+ m && f++, g && f++;
753
+ const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
754
+ for(let b = v; b < T; b++){
755
+ const x = wrapAnsi(s(i[b], b === e), c, {
756
+ hard: !0,
757
+ trim: !1
758
+ }).split(`
759
+ `);
760
+ h.push(x), f += x.length;
761
+ }
762
+ if (f > $) {
763
+ let b = 0, x = 0, G = f;
764
+ const M = e - v, R = (j, D)=>dist_et(h, G, j, D, $);
765
+ m ? ({ lineCount: G, removals: b } = R(0, M), G > $ && ({ lineCount: G, removals: x } = R(M + 1, h.length))) : ({ lineCount: G, removals: x } = R(M + 1, h.length), G > $ && ({ lineCount: G, removals: b } = R(0, M))), b > 0 && (m = !0, h.splice(0, b)), x > 0 && (g = !0, h.splice(h.length - x, x));
766
+ }
767
+ const C = [];
768
+ m && C.push(l);
769
+ for (const b of h)for (const x of b)C.push(x);
770
+ return g && C.push(l), C;
771
+ };
772
+ const dist_ot = (e)=>{
773
+ const i = e.active ?? "Yes", s = e.inactive ?? "No";
774
+ return new Q({
775
+ active: i,
776
+ inactive: s,
777
+ signal: e.signal,
778
+ input: e.input,
779
+ output: e.output,
780
+ initialValue: e.initialValue ?? !0,
781
+ render () {
782
+ const r = e.withGuide ?? dist_u.withGuide, u = `${dist_V(this.state)} `, n = r ? `${styleText("gray", dist_d)} ` : "", o = dist_R(e.output, e.message, n, u), c = `${r ? `${styleText("gray", dist_d)}
783
+ ` : ""}${o}
784
+ `, a = this.value ? i : s;
785
+ switch(this.state){
786
+ case "submit":
787
+ {
788
+ const l = r ? `${styleText("gray", dist_d)} ` : "";
789
+ return `${c}${l}${styleText("dim", a)}`;
790
+ }
791
+ case "cancel":
792
+ {
793
+ const l = r ? `${styleText("gray", dist_d)} ` : "";
794
+ return `${c}${l}${styleText([
795
+ "strikethrough",
796
+ "dim"
797
+ ], a)}${r ? `
798
+ ${styleText("gray", dist_d)}` : ""}`;
799
+ }
800
+ default:
801
+ {
802
+ const l = r ? `${styleText("cyan", dist_d)} ` : "", $ = r ? styleText("cyan", dist_E) : "";
803
+ return `${c}${l}${this.value ? `${styleText("green", dist_z)} ${i}` : `${styleText("dim", dist_H)} ${styleText("dim", i)}`}${e.vertical ? r ? `
804
+ ${styleText("cyan", dist_d)} ` : `
805
+ ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", dist_H)} ${styleText("dim", s)}` : `${styleText("green", dist_z)} ${s}`}
806
+ ${$}
807
+ `;
808
+ }
809
+ }
810
+ }
811
+ }).prompt();
812
+ };
813
+ const dist_O = {
814
+ message: (e = [], { symbol: i = styleText("gray", dist_d), secondarySymbol: s = styleText("gray", dist_d), output: r = process.stdout, spacing: u = 1, withGuide: n } = {})=>{
815
+ const o = [], c = n ?? dist_u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
816
+ for(let p = 0; p < u; p++)o.push(a);
817
+ const y = Array.isArray(e) ? e : e.split(`
818
+ `);
819
+ if (y.length > 0) {
820
+ const [p, ...m] = y;
821
+ p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
822
+ for (const g of m)g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
823
+ }
824
+ r.write(`${o.join(`
825
+ `)}
826
+ `);
827
+ },
828
+ info: (e, i)=>{
829
+ dist_O.message(e, {
830
+ ...i,
831
+ symbol: styleText("blue", he)
832
+ });
833
+ },
834
+ success: (e, i)=>{
835
+ dist_O.message(e, {
836
+ ...i,
837
+ symbol: styleText("green", pe)
838
+ });
839
+ },
840
+ step: (e, i)=>{
841
+ dist_O.message(e, {
842
+ ...i,
843
+ symbol: styleText("green", dist_F)
844
+ });
845
+ },
846
+ warn: (e, i)=>{
847
+ dist_O.message(e, {
848
+ ...i,
849
+ symbol: styleText("yellow", me)
850
+ });
851
+ },
852
+ warning: (e, i)=>{
853
+ dist_O.warn(e, i);
854
+ },
855
+ error: (e, i)=>{
856
+ dist_O.message(e, {
857
+ ...i,
858
+ symbol: styleText("red", ge)
859
+ });
860
+ }
861
+ }, pt = (e = "", i)=>{
862
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", dist_E)} ` : "";
863
+ s.write(`${r}${styleText("red", e)}
864
+
865
+ `);
866
+ }, mt = (e = "", i)=>{
867
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", le)} ` : "";
868
+ s.write(`${r}${e}
869
+ `);
870
+ }, gt = (e = "", i)=>{
871
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", dist_d)}
872
+ ${styleText("gray", dist_E)} ` : "";
873
+ s.write(`${r}${e}
874
+
875
+ `);
876
+ }, ft = (e)=>styleText("dim", e), vt = (e, i, s)=>{
877
+ const r = {
878
+ hard: !0,
879
+ trim: !1
880
+ }, u = wrapAnsi(e, i, r).split(`
881
+ `), n = u.reduce((a, l)=>Math.max(fast_string_width_dist(l), a), 0), o = u.map(s).reduce((a, l)=>Math.max(fast_string_width_dist(l), a), 0), c = i - (o - n);
882
+ return wrapAnsi(e, c, r);
883
+ }, wt = (e = "", i = "", s)=>{
884
+ const r = s?.output ?? node_process.stdout, u = s?.withGuide ?? dist_u.withGuide, n = s?.format ?? ft, o = [
885
+ "",
886
+ ...vt(e, O(r) - 6, n).split(`
887
+ `).map(n),
888
+ ""
889
+ ], c = fast_string_width_dist(i), a = Math.max(o.reduce((p, m)=>{
890
+ const g = fast_string_width_dist(m);
891
+ return g > p ? g : p;
892
+ }, 0), c) + 2, l = o.map((p)=>`${styleText("gray", dist_d)} ${p}${" ".repeat(a - fast_string_width_dist(p))}${styleText("gray", dist_d)}`).join(`
893
+ `), $ = u ? `${styleText("gray", dist_d)}
894
+ ` : "", y = u ? Ge : de;
895
+ r.write(`${$}${styleText("green", dist_F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
896
+ ${l}
897
+ ${styleText("gray", y + se.repeat(a + 2) + $e)}
898
+ `);
899
+ }, Ct = (e)=>styleText("magenta", e), fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u, frames: n = ee ? [
900
+ "\u25D2",
901
+ "\u25D0",
902
+ "\u25D3",
903
+ "\u25D1"
904
+ ] : [
905
+ "\u2022",
906
+ "o",
907
+ "O",
908
+ "0"
909
+ ], delay: o = ee ? 80 : 120, signal: c, ...a } = {})=>{
910
+ const l = ae();
911
+ let $, y, p = !1, m = !1, g = "", S, h = performance.now();
912
+ const f = O(s), v = a?.styleFrame ?? Ct, T = (_)=>{
913
+ const A = _ > 1 ? u ?? dist_u.messages.error : r ?? dist_u.messages.cancel;
914
+ m = 1 === _, p && (W(A, _), m && "function" == typeof i && i());
915
+ }, C = ()=>T(2), b = ()=>T(1), x = ()=>{
916
+ process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T), c && c.addEventListener("abort", b);
917
+ }, G = ()=>{
918
+ process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T), c && c.removeEventListener("abort", b);
919
+ }, M = ()=>{
920
+ if (void 0 === S) return;
921
+ l && s.write(`
922
+ `);
923
+ const _ = wrapAnsi(S, f, {
924
+ hard: !0,
925
+ trim: !1
926
+ }).split(`
927
+ `);
928
+ _.length > 1 && s.write(src.cursor.up(_.length - 1)), s.write(src.cursor.to(0)), s.write(src.erase.down());
929
+ }, R = (_)=>_.replace(/\.+$/, ""), j = (_)=>{
930
+ const A = (performance.now() - _) / 1e3, k = Math.floor(A / 60), L = Math.floor(A % 60);
931
+ return k > 0 ? `[${k}m ${L}s]` : `[${L}s]`;
932
+ }, D = a.withGuide ?? dist_u.withGuide, ie = (_ = "")=>{
933
+ p = !0, $ = z({
934
+ output: s
935
+ }), g = R(_), h = performance.now(), D && s.write(`${styleText("gray", dist_d)}
936
+ `);
937
+ let A = 0, k = 0;
938
+ x(), y = setInterval(()=>{
939
+ if (l && g === S) return;
940
+ M(), S = g;
941
+ const L = v(n[A]);
942
+ let Z;
943
+ if (l) Z = `${L} ${g}...`;
944
+ else if ("timer" === e) Z = `${L} ${g} ${j(h)}`;
945
+ else {
946
+ const Be = ".".repeat(Math.floor(k)).slice(0, 3);
947
+ Z = `${L} ${g}${Be}`;
948
+ }
949
+ const Ne = wrapAnsi(Z, f, {
950
+ hard: !0,
951
+ trim: !1
952
+ });
953
+ s.write(Ne), A = A + 1 < n.length ? A + 1 : 0, k = k < 4 ? k + .125 : 0;
954
+ }, o);
955
+ }, W = (_ = "", A = 0, k = !1)=>{
956
+ if (!p) return;
957
+ p = !1, clearInterval(y), M();
958
+ const L = 0 === A ? styleText("green", dist_F) : 1 === A ? styleText("red", oe) : styleText("red", ue);
959
+ g = _ ?? g, k || ("timer" === e ? s.write(`${L} ${g} ${j(h)}
960
+ `) : s.write(`${L} ${g}
961
+ `)), G(), $();
962
+ };
963
+ return {
964
+ start: ie,
965
+ stop: (_ = "")=>W(_, 0),
966
+ message: (_ = "")=>{
967
+ g = R(_ ?? g);
968
+ },
969
+ cancel: (_ = "")=>W(_, 1),
970
+ error: (_ = "")=>W(_, 2),
971
+ clear: ()=>W("", 0, !0),
972
+ get isCancelled () {
973
+ return m;
974
+ }
975
+ };
976
+ };
977
+ dist_w("\u2500", "-"), dist_w("\u2501", "="), dist_w("\u2588", "#");
978
+ const re = (e, i)=>e.includes(`
979
+ `) ? e.split(`
980
+ `).map((s)=>i(s)).join(`
981
+ `) : i(e), _t = (e)=>{
982
+ const i = (s, r)=>{
983
+ const u = s.label ?? String(s.value);
984
+ switch(r){
985
+ case "disabled":
986
+ return `${styleText("gray", dist_H)} ${re(u, (n)=>styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
987
+ case "selected":
988
+ return `${re(u, (n)=>styleText("dim", n))}`;
989
+ case "active":
990
+ return `${styleText("green", dist_z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
991
+ case "cancelled":
992
+ return `${re(u, (n)=>styleText([
993
+ "strikethrough",
994
+ "dim"
995
+ ], n))}`;
996
+ default:
997
+ return `${styleText("dim", dist_H)} ${re(u, (n)=>styleText("dim", n))}`;
998
+ }
999
+ };
1000
+ return new nt({
1001
+ options: e.options,
1002
+ signal: e.signal,
1003
+ input: e.input,
1004
+ output: e.output,
1005
+ initialValue: e.initialValue,
1006
+ render () {
1007
+ const s = e.withGuide ?? dist_u.withGuide, r = `${dist_V(this.state)} `, u = `${ye(this.state)} `, n = dist_R(e.output, e.message, u, r), o = `${s ? `${styleText("gray", dist_d)}
1008
+ ` : ""}${n}
1009
+ `;
1010
+ switch(this.state){
1011
+ case "submit":
1012
+ {
1013
+ const c = s ? `${styleText("gray", dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "selected"), c);
1014
+ return `${o}${a}`;
1015
+ }
1016
+ case "cancel":
1017
+ {
1018
+ const c = s ? `${styleText("gray", dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "cancelled"), c);
1019
+ return `${o}${a}${s ? `
1020
+ ${styleText("gray", dist_d)}` : ""}`;
1021
+ }
1022
+ default:
1023
+ {
1024
+ const c = s ? `${styleText("cyan", dist_d)} ` : "", a = s ? styleText("cyan", dist_E) : "", l = o.split(`
1025
+ `).length, $ = s ? 2 : 1;
1026
+ return `${o}${c}${dist_Y({
1027
+ output: e.output,
1028
+ cursor: this.cursor,
1029
+ options: this.options,
1030
+ maxItems: e.maxItems,
1031
+ columnPadding: c.length,
1032
+ rowPadding: l + $,
1033
+ style: (y, p)=>i(y, y.disabled ? "disabled" : p ? "active" : "inactive")
1034
+ }).join(`
1035
+ ${c}`)}
1036
+ ${a}
1037
+ `;
1038
+ }
1039
+ }
1040
+ }
1041
+ }).prompt();
1042
+ };
1043
+ styleText("gray", dist_d);
1044
+ export { _t as select, dist_O as log, dist_ot as confirm, dist_q as isCancel, fe as spinner, gt as outro, mt as intro, pt as cancel, wt as note };