openfox 2.0.102 → 2.0.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/CHANGELOG.md +23 -0
- package/dist/{ask-TOBEA6KD.js → ask-CJMU6EW7.js} +2 -2
- package/dist/{chat-handler-IBFSBSGV.js → chat-handler-G2ZJNAVB.js} +18 -18
- package/dist/{chunk-AI27N57J.js → chunk-2COWPTSJ.js} +2 -2
- package/dist/{chunk-QL2G5UWE.js → chunk-3NVISPE7.js} +22 -12
- package/dist/chunk-4H427UBV.js +1298 -0
- package/dist/{chunk-W5FTCTGY.js → chunk-5VKT34HE.js} +2 -2
- package/dist/{chunk-FQS7A5M4.js → chunk-6SIX7P6O.js} +2 -2
- package/dist/{chunk-MGKS2NG2.js → chunk-B76OP3OE.js} +3 -3
- package/dist/{chunk-WPCYFH6X.js → chunk-DMI2BXHA.js} +4 -4
- package/dist/{chunk-KKEBXFB3.js → chunk-EF7KGWF6.js} +2 -2
- package/dist/{chunk-QGWS2EBU.js → chunk-EFIC3TUX.js} +16 -16
- package/dist/{chunk-MR7ZEGOF.js → chunk-ERKPMNC7.js} +5 -2
- package/dist/{chunk-ZLCPNTRT.js → chunk-ERTTKKCE.js} +6 -2
- package/dist/{chunk-BJDQPILB.js → chunk-F766OIDT.js} +2 -2
- package/dist/{chunk-K6VVTE6C.js → chunk-HZXWVD5A.js} +29 -19
- package/dist/{chunk-4Z2ARCY3.js → chunk-J27BLIPY.js} +2 -2
- package/dist/{chunk-EU3WWTFH.js → chunk-JAX5OEMM.js} +5 -1
- package/dist/chunk-MLOCSFIW.js +7 -0
- package/dist/{chunk-RZC6DAT2.js → chunk-OUMHR7LR.js} +2 -2
- package/dist/{chunk-DPRJYQ5U.js → chunk-PKLWSTDB.js} +17 -17
- package/dist/{chunk-2EYTYXWN.js → chunk-S5HDT5RQ.js} +2 -2
- package/dist/{chunk-YZSBJUGC.js → chunk-SPA7PQPJ.js} +3 -1
- package/dist/{chunk-KLK5N4OX.js → chunk-TFQSCHVU.js} +3 -3
- package/dist/{chunk-7HIJP4PC.js → chunk-UADZ2LZJ.js} +2 -2
- package/dist/{chunk-Z753S3X7.js → chunk-W2KZ7H55.js} +22 -15
- package/dist/{chunk-W5RC44R6.js → chunk-WHJ67MO2.js} +8 -8
- package/dist/{chunk-6ZV3NYEE.js → chunk-XWW7LOU4.js} +118 -77
- package/dist/{chunk-73EV6QYX.js → chunk-YXIDKMBJ.js} +3 -3
- package/dist/cli/dev.js +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/{client-Q7BHKOCD.js → client-2EAJAGPC.js} +4 -4
- package/dist/{compactor-43P3LGDU.js → compactor-IEYTUHYX.js} +9 -9
- package/dist/{dynamic-context-AMPVZXUU.js → dynamic-context-Z5BU2RVP.js} +7 -7
- package/dist/{events-RCC32JOA.js → events-BGVLDGLK.js} +6 -6
- package/dist/{folding-ZNUXPQUD.js → folding-AJMZBHNR.js} +4 -4
- package/dist/{http-client-WGNBG7PC.js → http-client-A7A4XWNK.js} +3 -3
- package/dist/{manager-HFGJLW7Q.js → manager-GGIIENDX.js} +4 -4
- package/dist/{model-overrides-DQDT5Y7R.js → model-overrides-BLEFI7FQ.js} +3 -3
- package/dist/{orchestrator-QDXKDLOW.js → orchestrator-SYAYO6NS.js} +17 -17
- package/dist/package.json +1 -1
- package/dist/{path-security-SUFEIBTC.js → path-security-JCDBLFIE.js} +7 -7
- package/dist/{platform-2RLL7RAE.js → platform-GZ2WIDS5.js} +3 -3
- package/dist/{processor-YWNLWAZW.js → processor-CBGV2K4E.js} +17 -17
- package/dist/{protocol-BXgdUKgZ.d.ts → protocol-rfiBDoXm.d.ts} +1 -1
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-FX3QCGAF.js → provider-XCVHKXPS.js} +68 -68
- package/dist/{provider-manager-GLG6BA32.js → provider-manager-AUYP3QAM.js} +5 -5
- package/dist/{pwa-SEWCVKZX.js → pwa-XPHP3PY2.js} +35 -35
- package/dist/{registry-GBNLVWYQ.js → registry-M2QVGRNK.js} +3 -3
- package/dist/{serve-RKHLNGEV.js → serve-NPS4GJWH.js} +25 -25
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +24 -24
- package/dist/{server-QGQGSHW6.js → server-FKM4FQKD.js} +20 -20
- package/dist/{session-overrides-MBGBX6TM.js → session-overrides-HA5IQYLI.js} +5 -5
- package/dist/{sessions-FEIFYGH7.js → sessions-ZV2WRC6K.js} +4 -4
- package/dist/{settings-FT7HF7ZB.js → settings-TGCITCVA.js} +2 -2
- package/dist/shared/index.d.ts +3 -3
- package/dist/{tools-M5DKWCJJ.js → tools-KKALZLKX.js} +15 -15
- package/dist/{types-DBftgbfl.d.ts → types-o-YQ3Bfq.d.ts} +1 -1
- package/dist/{types-7idXD8Bq.d.ts → types-o0v5xVxu.d.ts} +1 -1
- package/dist/{update-N4GD5IUX.js → update-7BEZMI4R.js} +2 -2
- package/dist/web/assets/index-B7wjVPjL.css +40 -0
- package/dist/web/assets/index-BoWCT9PC.js +323 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/web/workbox-9c191d2f.js +1 -0
- package/package.json +1 -1
- package/dist/chunk-SV3I2YNO.js +0 -7
- package/dist/chunk-XY3LESVZ.js +0 -1000
- package/dist/web/assets/index-B0CNNl1k.css +0 -32
- package/dist/web/assets/index-FWViKQkM.js +0 -324
- package/dist/web/workbox-8c29f6e4.js +0 -1
|
@@ -0,0 +1,1298 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__toESM
|
|
4
|
+
} from "./chunk-5WRI5ZAA.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/sisteransi/src/index.js
|
|
7
|
+
var require_src = __commonJS({
|
|
8
|
+
"node_modules/sisteransi/src/index.js"(exports, module) {
|
|
9
|
+
"use strict";
|
|
10
|
+
var ESC2 = "\x1B";
|
|
11
|
+
var CSI2 = `${ESC2}[`;
|
|
12
|
+
var beep = "\x07";
|
|
13
|
+
var cursor3 = {
|
|
14
|
+
to(x, y) {
|
|
15
|
+
if (!y) return `${CSI2}${x + 1}G`;
|
|
16
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
17
|
+
},
|
|
18
|
+
move(x, y) {
|
|
19
|
+
let ret = "";
|
|
20
|
+
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
21
|
+
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
22
|
+
if (y < 0) ret += `${CSI2}${-y}A`;
|
|
23
|
+
else if (y > 0) ret += `${CSI2}${y}B`;
|
|
24
|
+
return ret;
|
|
25
|
+
},
|
|
26
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
27
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
28
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
29
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
30
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
31
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
32
|
+
left: `${CSI2}G`,
|
|
33
|
+
hide: `${CSI2}?25l`,
|
|
34
|
+
show: `${CSI2}?25h`,
|
|
35
|
+
save: `${ESC2}7`,
|
|
36
|
+
restore: `${ESC2}8`
|
|
37
|
+
};
|
|
38
|
+
var scroll = {
|
|
39
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
40
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
41
|
+
};
|
|
42
|
+
var erase3 = {
|
|
43
|
+
screen: `${CSI2}2J`,
|
|
44
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
45
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
46
|
+
line: `${CSI2}2K`,
|
|
47
|
+
lineEnd: `${CSI2}K`,
|
|
48
|
+
lineStart: `${CSI2}1K`,
|
|
49
|
+
lines(count) {
|
|
50
|
+
let clear = "";
|
|
51
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
52
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
53
|
+
if (count)
|
|
54
|
+
clear += cursor3.left;
|
|
55
|
+
return clear;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
63
|
+
import { styleText } from "util";
|
|
64
|
+
import { stdout, stdin } from "process";
|
|
65
|
+
import * as l from "readline";
|
|
66
|
+
import l__default from "readline";
|
|
67
|
+
|
|
68
|
+
// node_modules/fast-string-truncated-width/dist/utils.js
|
|
69
|
+
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
70
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
71
|
+
return (input) => {
|
|
72
|
+
let surrogatePairsNr = 0;
|
|
73
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
74
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
75
|
+
surrogatePairsNr += 1;
|
|
76
|
+
}
|
|
77
|
+
return input.length - surrogatePairsNr;
|
|
78
|
+
};
|
|
79
|
+
})();
|
|
80
|
+
var isFullWidth = (x) => {
|
|
81
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
82
|
+
};
|
|
83
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
84
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// node_modules/fast-string-truncated-width/dist/index.js
|
|
88
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
89
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
90
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
91
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
92
|
+
var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
93
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
94
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
95
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
96
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
97
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
98
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
99
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
100
|
+
const ANSI_WIDTH = 0;
|
|
101
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
102
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
103
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
104
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
105
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
106
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
107
|
+
const PARSE_BLOCKS = [
|
|
108
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
109
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
110
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
111
|
+
[TAB_RE, TAB_WIDTH],
|
|
112
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
113
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
114
|
+
];
|
|
115
|
+
let indexPrev = 0;
|
|
116
|
+
let index = 0;
|
|
117
|
+
let length = input.length;
|
|
118
|
+
let lengthExtra = 0;
|
|
119
|
+
let truncationEnabled = false;
|
|
120
|
+
let truncationIndex = length;
|
|
121
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
122
|
+
let unmatchedStart = 0;
|
|
123
|
+
let unmatchedEnd = 0;
|
|
124
|
+
let width = 0;
|
|
125
|
+
let widthExtra = 0;
|
|
126
|
+
outer: while (true) {
|
|
127
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
128
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
129
|
+
lengthExtra = 0;
|
|
130
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
131
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
132
|
+
if (isFullWidth(codePoint)) {
|
|
133
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
134
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
135
|
+
widthExtra = WIDE_WIDTH;
|
|
136
|
+
} else {
|
|
137
|
+
widthExtra = REGULAR_WIDTH;
|
|
138
|
+
}
|
|
139
|
+
if (width + widthExtra > truncationLimit) {
|
|
140
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
141
|
+
}
|
|
142
|
+
if (width + widthExtra > LIMIT) {
|
|
143
|
+
truncationEnabled = true;
|
|
144
|
+
break outer;
|
|
145
|
+
}
|
|
146
|
+
lengthExtra += char.length;
|
|
147
|
+
width += widthExtra;
|
|
148
|
+
}
|
|
149
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
150
|
+
}
|
|
151
|
+
if (index >= length) {
|
|
152
|
+
break outer;
|
|
153
|
+
}
|
|
154
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
155
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
156
|
+
BLOCK_RE.lastIndex = index;
|
|
157
|
+
if (BLOCK_RE.test(input)) {
|
|
158
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
159
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
160
|
+
if (width + widthExtra > truncationLimit) {
|
|
161
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
162
|
+
}
|
|
163
|
+
if (width + widthExtra > LIMIT) {
|
|
164
|
+
truncationEnabled = true;
|
|
165
|
+
break outer;
|
|
166
|
+
}
|
|
167
|
+
width += widthExtra;
|
|
168
|
+
unmatchedStart = indexPrev;
|
|
169
|
+
unmatchedEnd = index;
|
|
170
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
171
|
+
continue outer;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
index += 1;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
178
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
179
|
+
truncated: truncationEnabled,
|
|
180
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
var dist_default = getStringTruncatedWidth;
|
|
184
|
+
|
|
185
|
+
// node_modules/fast-string-width/dist/index.js
|
|
186
|
+
var NO_TRUNCATION2 = {
|
|
187
|
+
limit: Infinity,
|
|
188
|
+
ellipsis: "",
|
|
189
|
+
ellipsisWidth: 0
|
|
190
|
+
};
|
|
191
|
+
var fastStringWidth = (input, options = {}) => {
|
|
192
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
193
|
+
};
|
|
194
|
+
var dist_default2 = fastStringWidth;
|
|
195
|
+
|
|
196
|
+
// node_modules/fast-wrap-ansi/lib/main.js
|
|
197
|
+
var ESC = "\x1B";
|
|
198
|
+
var CSI = "\x9B";
|
|
199
|
+
var END_CODE = 39;
|
|
200
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
201
|
+
var ANSI_CSI = "[";
|
|
202
|
+
var ANSI_OSC = "]";
|
|
203
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
204
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
205
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
206
|
+
var getClosingCode = (openingCode) => {
|
|
207
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
208
|
+
return 39;
|
|
209
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
210
|
+
return 39;
|
|
211
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
212
|
+
return 49;
|
|
213
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
214
|
+
return 49;
|
|
215
|
+
if (openingCode === 1 || openingCode === 2)
|
|
216
|
+
return 22;
|
|
217
|
+
if (openingCode === 3)
|
|
218
|
+
return 23;
|
|
219
|
+
if (openingCode === 4)
|
|
220
|
+
return 24;
|
|
221
|
+
if (openingCode === 7)
|
|
222
|
+
return 27;
|
|
223
|
+
if (openingCode === 8)
|
|
224
|
+
return 28;
|
|
225
|
+
if (openingCode === 9)
|
|
226
|
+
return 29;
|
|
227
|
+
if (openingCode === 0)
|
|
228
|
+
return 0;
|
|
229
|
+
return void 0;
|
|
230
|
+
};
|
|
231
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
232
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
233
|
+
var wrapWord = (rows, word, columns) => {
|
|
234
|
+
const characters = word[Symbol.iterator]();
|
|
235
|
+
let isInsideEscape = false;
|
|
236
|
+
let isInsideLinkEscape = false;
|
|
237
|
+
let lastRow = rows.at(-1);
|
|
238
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
239
|
+
let currentCharacter = characters.next();
|
|
240
|
+
let nextCharacter = characters.next();
|
|
241
|
+
let rawCharacterIndex = 0;
|
|
242
|
+
while (!currentCharacter.done) {
|
|
243
|
+
const character = currentCharacter.value;
|
|
244
|
+
const characterLength = dist_default2(character);
|
|
245
|
+
if (visible + characterLength <= columns) {
|
|
246
|
+
rows[rows.length - 1] += character;
|
|
247
|
+
} else {
|
|
248
|
+
rows.push(character);
|
|
249
|
+
visible = 0;
|
|
250
|
+
}
|
|
251
|
+
if (character === ESC || character === CSI) {
|
|
252
|
+
isInsideEscape = true;
|
|
253
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
254
|
+
}
|
|
255
|
+
if (isInsideEscape) {
|
|
256
|
+
if (isInsideLinkEscape) {
|
|
257
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
258
|
+
isInsideEscape = false;
|
|
259
|
+
isInsideLinkEscape = false;
|
|
260
|
+
}
|
|
261
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
262
|
+
isInsideEscape = false;
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
visible += characterLength;
|
|
266
|
+
if (visible === columns && !nextCharacter.done) {
|
|
267
|
+
rows.push("");
|
|
268
|
+
visible = 0;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
currentCharacter = nextCharacter;
|
|
272
|
+
nextCharacter = characters.next();
|
|
273
|
+
rawCharacterIndex += character.length;
|
|
274
|
+
}
|
|
275
|
+
lastRow = rows.at(-1);
|
|
276
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
277
|
+
rows[rows.length - 2] += rows.pop();
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
281
|
+
const words = string.split(" ");
|
|
282
|
+
let last = words.length;
|
|
283
|
+
while (last) {
|
|
284
|
+
if (dist_default2(words[last - 1])) {
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
last--;
|
|
288
|
+
}
|
|
289
|
+
if (last === words.length) {
|
|
290
|
+
return string;
|
|
291
|
+
}
|
|
292
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
293
|
+
};
|
|
294
|
+
var exec = (string, columns, options = {}) => {
|
|
295
|
+
if (options.trim !== false && string.trim() === "") {
|
|
296
|
+
return "";
|
|
297
|
+
}
|
|
298
|
+
let returnValue = "";
|
|
299
|
+
let escapeCode;
|
|
300
|
+
let escapeUrl;
|
|
301
|
+
const words = string.split(" ");
|
|
302
|
+
let rows = [""];
|
|
303
|
+
let rowLength = 0;
|
|
304
|
+
for (let index = 0; index < words.length; index++) {
|
|
305
|
+
const word = words[index];
|
|
306
|
+
if (options.trim !== false) {
|
|
307
|
+
const row = rows.at(-1) ?? "";
|
|
308
|
+
const trimmed = row.trimStart();
|
|
309
|
+
if (row.length !== trimmed.length) {
|
|
310
|
+
rows[rows.length - 1] = trimmed;
|
|
311
|
+
rowLength = dist_default2(trimmed);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (index !== 0) {
|
|
315
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
316
|
+
rows.push("");
|
|
317
|
+
rowLength = 0;
|
|
318
|
+
}
|
|
319
|
+
if (rowLength || options.trim === false) {
|
|
320
|
+
rows[rows.length - 1] += " ";
|
|
321
|
+
rowLength++;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const wordLength = dist_default2(word);
|
|
325
|
+
if (options.hard && wordLength > columns) {
|
|
326
|
+
const remainingColumns = columns - rowLength;
|
|
327
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
328
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
329
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
330
|
+
rows.push("");
|
|
331
|
+
}
|
|
332
|
+
wrapWord(rows, word, columns);
|
|
333
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
337
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
338
|
+
wrapWord(rows, word, columns);
|
|
339
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
rows.push("");
|
|
343
|
+
rowLength = 0;
|
|
344
|
+
}
|
|
345
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
346
|
+
wrapWord(rows, word, columns);
|
|
347
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
rows[rows.length - 1] += word;
|
|
351
|
+
rowLength += wordLength;
|
|
352
|
+
}
|
|
353
|
+
if (options.trim !== false) {
|
|
354
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
355
|
+
}
|
|
356
|
+
const preString = rows.join("\n");
|
|
357
|
+
let inSurrogate = false;
|
|
358
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
359
|
+
const character = preString[i2];
|
|
360
|
+
returnValue += character;
|
|
361
|
+
if (!inSurrogate) {
|
|
362
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
363
|
+
if (inSurrogate) {
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
inSurrogate = false;
|
|
368
|
+
}
|
|
369
|
+
if (character === ESC || character === CSI) {
|
|
370
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
371
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
372
|
+
const groups = groupsResult?.groups;
|
|
373
|
+
if (groups?.code !== void 0) {
|
|
374
|
+
const code = Number.parseFloat(groups.code);
|
|
375
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
376
|
+
} else if (groups?.uri !== void 0) {
|
|
377
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (preString[i2 + 1] === "\n") {
|
|
381
|
+
if (escapeUrl) {
|
|
382
|
+
returnValue += wrapAnsiHyperlink("");
|
|
383
|
+
}
|
|
384
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
385
|
+
if (escapeCode && closingCode) {
|
|
386
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
387
|
+
}
|
|
388
|
+
} else if (character === "\n") {
|
|
389
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
390
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
391
|
+
}
|
|
392
|
+
if (escapeUrl) {
|
|
393
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return returnValue;
|
|
398
|
+
};
|
|
399
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
400
|
+
function wrapAnsi(string, columns, options) {
|
|
401
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
405
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
406
|
+
import { ReadStream } from "tty";
|
|
407
|
+
function findCursor(s, o, l2) {
|
|
408
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
409
|
+
return s;
|
|
410
|
+
const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
411
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
412
|
+
}
|
|
413
|
+
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
414
|
+
var t = [
|
|
415
|
+
"January",
|
|
416
|
+
"February",
|
|
417
|
+
"March",
|
|
418
|
+
"April",
|
|
419
|
+
"May",
|
|
420
|
+
"June",
|
|
421
|
+
"July",
|
|
422
|
+
"August",
|
|
423
|
+
"September",
|
|
424
|
+
"October",
|
|
425
|
+
"November",
|
|
426
|
+
"December"
|
|
427
|
+
];
|
|
428
|
+
var settings = {
|
|
429
|
+
actions: new Set(a$1),
|
|
430
|
+
aliases: /* @__PURE__ */ new Map([
|
|
431
|
+
// vim support
|
|
432
|
+
["k", "up"],
|
|
433
|
+
["j", "down"],
|
|
434
|
+
["h", "left"],
|
|
435
|
+
["l", "right"],
|
|
436
|
+
["", "cancel"],
|
|
437
|
+
// opinionated defaults!
|
|
438
|
+
["escape", "cancel"]
|
|
439
|
+
]),
|
|
440
|
+
messages: {
|
|
441
|
+
cancel: "Canceled",
|
|
442
|
+
error: "Something went wrong"
|
|
443
|
+
},
|
|
444
|
+
withGuide: true,
|
|
445
|
+
date: {
|
|
446
|
+
monthNames: [...t],
|
|
447
|
+
messages: {
|
|
448
|
+
required: "Please enter a valid date",
|
|
449
|
+
invalidMonth: "There are only 12 months in a year",
|
|
450
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
451
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
452
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
function isActionKey(n3, e) {
|
|
457
|
+
if (typeof n3 == "string")
|
|
458
|
+
return settings.aliases.get(n3) === e;
|
|
459
|
+
for (const s of n3)
|
|
460
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
461
|
+
return true;
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
function diffLines(i2, s) {
|
|
465
|
+
if (i2 === s) return;
|
|
466
|
+
const e = i2.split(`
|
|
467
|
+
`), t2 = s.split(`
|
|
468
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
469
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
470
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
471
|
+
return {
|
|
472
|
+
lines: f,
|
|
473
|
+
numLinesBefore: e.length,
|
|
474
|
+
numLinesAfter: t2.length,
|
|
475
|
+
numLines: r2
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
var R = globalThis.process.platform.startsWith("win");
|
|
479
|
+
var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
480
|
+
function isCancel(e) {
|
|
481
|
+
return e === CANCEL_SYMBOL;
|
|
482
|
+
}
|
|
483
|
+
function setRawMode(e, r2) {
|
|
484
|
+
const o = e;
|
|
485
|
+
o.isTTY && o.setRawMode(r2);
|
|
486
|
+
}
|
|
487
|
+
function block({
|
|
488
|
+
input: e = stdin,
|
|
489
|
+
output: r2 = stdout,
|
|
490
|
+
overwrite: o = true,
|
|
491
|
+
hideCursor: t2 = true
|
|
492
|
+
} = {}) {
|
|
493
|
+
const s = l.createInterface({
|
|
494
|
+
input: e,
|
|
495
|
+
output: r2,
|
|
496
|
+
prompt: "",
|
|
497
|
+
tabSize: 1
|
|
498
|
+
});
|
|
499
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
500
|
+
const n3 = (f, { name: a2, sequence: p }) => {
|
|
501
|
+
const c2 = String(f);
|
|
502
|
+
if (isActionKey([c2, a2, p], "cancel")) {
|
|
503
|
+
t2 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (!o) return;
|
|
507
|
+
const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
|
|
508
|
+
l.moveCursor(r2, i2, m, () => {
|
|
509
|
+
l.clearLine(r2, 1, () => {
|
|
510
|
+
e.once("keypress", n3);
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
return t2 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", n3), () => {
|
|
515
|
+
e.off("keypress", n3), t2 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
519
|
+
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
520
|
+
function wrapTextWithPrefix(e, r2, o, t2 = o, s = o, n3) {
|
|
521
|
+
const f = getColumns(e ?? stdout);
|
|
522
|
+
return wrapAnsi(r2, f - o.length, {
|
|
523
|
+
hard: true,
|
|
524
|
+
trim: false
|
|
525
|
+
}).split(`
|
|
526
|
+
`).map((c2, i2, m) => {
|
|
527
|
+
const d = n3 ? n3(c2, i2) : c2;
|
|
528
|
+
return i2 === 0 ? `${t2}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
529
|
+
}).join(`
|
|
530
|
+
`);
|
|
531
|
+
}
|
|
532
|
+
function runValidation(e, n3) {
|
|
533
|
+
if ("~standard" in e) {
|
|
534
|
+
const a2 = e["~standard"].validate(n3);
|
|
535
|
+
if (a2 instanceof Promise)
|
|
536
|
+
throw new TypeError(
|
|
537
|
+
"Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
|
|
538
|
+
);
|
|
539
|
+
return a2.issues?.at(0)?.message;
|
|
540
|
+
}
|
|
541
|
+
return e(n3);
|
|
542
|
+
}
|
|
543
|
+
var V = class {
|
|
544
|
+
input;
|
|
545
|
+
output;
|
|
546
|
+
_abortSignal;
|
|
547
|
+
rl;
|
|
548
|
+
opts;
|
|
549
|
+
_render;
|
|
550
|
+
_track = false;
|
|
551
|
+
_prevFrame = "";
|
|
552
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
553
|
+
_cursor = 0;
|
|
554
|
+
state = "initial";
|
|
555
|
+
error = "";
|
|
556
|
+
value;
|
|
557
|
+
userInput = "";
|
|
558
|
+
constructor(t2, e = true) {
|
|
559
|
+
const { input: i2 = stdin, output: n3 = stdout, render: s, signal: r2, ...o } = t2;
|
|
560
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r2, this.input = i2, this.output = n3;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Unsubscribe all listeners
|
|
564
|
+
*/
|
|
565
|
+
unsubscribe() {
|
|
566
|
+
this._subscribers.clear();
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Set a subscriber with opts
|
|
570
|
+
* @param event - The event name
|
|
571
|
+
*/
|
|
572
|
+
setSubscriber(t2, e) {
|
|
573
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
574
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Subscribe to an event
|
|
578
|
+
* @param event - The event name
|
|
579
|
+
* @param cb - The callback
|
|
580
|
+
*/
|
|
581
|
+
on(t2, e) {
|
|
582
|
+
this.setSubscriber(t2, { cb: e });
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Subscribe to an event once
|
|
586
|
+
* @param event - The event name
|
|
587
|
+
* @param cb - The callback
|
|
588
|
+
*/
|
|
589
|
+
once(t2, e) {
|
|
590
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Emit an event with data
|
|
594
|
+
* @param event - The event name
|
|
595
|
+
* @param data - The data to pass to the callback
|
|
596
|
+
*/
|
|
597
|
+
emit(t2, ...e) {
|
|
598
|
+
const i2 = this._subscribers.get(t2) ?? [], n3 = [];
|
|
599
|
+
for (const s of i2)
|
|
600
|
+
s.cb(...e), s.once && n3.push(() => i2.splice(i2.indexOf(s), 1));
|
|
601
|
+
for (const s of n3)
|
|
602
|
+
s();
|
|
603
|
+
}
|
|
604
|
+
prompt() {
|
|
605
|
+
return new Promise((t2) => {
|
|
606
|
+
if (this._abortSignal) {
|
|
607
|
+
if (this._abortSignal.aborted)
|
|
608
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
609
|
+
this._abortSignal.addEventListener(
|
|
610
|
+
"abort",
|
|
611
|
+
() => {
|
|
612
|
+
this.state = "cancel", this.close();
|
|
613
|
+
},
|
|
614
|
+
{ once: true }
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
this.rl = l__default.createInterface({
|
|
618
|
+
input: this.input,
|
|
619
|
+
tabSize: 2,
|
|
620
|
+
prompt: "",
|
|
621
|
+
escapeCodeTimeout: 50,
|
|
622
|
+
terminal: true
|
|
623
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
624
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
625
|
+
}), this.once("cancel", () => {
|
|
626
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
_isActionKey(t2, e) {
|
|
631
|
+
return t2 === " ";
|
|
632
|
+
}
|
|
633
|
+
_shouldSubmit(t2, e) {
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
_setValue(t2) {
|
|
637
|
+
this.value = t2, this.emit("value", this.value);
|
|
638
|
+
}
|
|
639
|
+
_setUserInput(t2, e) {
|
|
640
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
641
|
+
}
|
|
642
|
+
_clearUserInput() {
|
|
643
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
644
|
+
}
|
|
645
|
+
onKeypress(t2, e) {
|
|
646
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
647
|
+
if (this.opts.validate) {
|
|
648
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
649
|
+
i2 && (this.error = i2 instanceof Error ? i2.message : i2, this.state = "error", this.rl?.write(this.userInput));
|
|
650
|
+
}
|
|
651
|
+
this.state !== "error" && (this.state = "submit");
|
|
652
|
+
}
|
|
653
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
654
|
+
}
|
|
655
|
+
close() {
|
|
656
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
657
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
658
|
+
}
|
|
659
|
+
restoreCursor() {
|
|
660
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
661
|
+
`).length - 1;
|
|
662
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
663
|
+
}
|
|
664
|
+
render() {
|
|
665
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
666
|
+
hard: true,
|
|
667
|
+
trim: false
|
|
668
|
+
});
|
|
669
|
+
if (t2 !== this._prevFrame) {
|
|
670
|
+
if (this.state === "initial")
|
|
671
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
672
|
+
else {
|
|
673
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
674
|
+
if (this.restoreCursor(), e) {
|
|
675
|
+
const n3 = Math.max(0, e.numLinesAfter - i2), s = Math.max(0, e.numLinesBefore - i2);
|
|
676
|
+
let r2 = e.lines.find((o) => o >= n3);
|
|
677
|
+
if (r2 === void 0) {
|
|
678
|
+
this._prevFrame = t2;
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (e.lines.length === 1) {
|
|
682
|
+
this.output.write(import_sisteransi.cursor.move(0, r2 - s)), this.output.write(import_sisteransi.erase.lines(1));
|
|
683
|
+
const o = t2.split(`
|
|
684
|
+
`);
|
|
685
|
+
this.output.write(o[r2]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - r2 - 1));
|
|
686
|
+
return;
|
|
687
|
+
} else if (e.lines.length > 1) {
|
|
688
|
+
if (n3 < s)
|
|
689
|
+
r2 = n3;
|
|
690
|
+
else {
|
|
691
|
+
const h2 = r2 - s;
|
|
692
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
693
|
+
}
|
|
694
|
+
this.output.write(import_sisteransi.erase.down());
|
|
695
|
+
const f = t2.split(`
|
|
696
|
+
`).slice(r2);
|
|
697
|
+
this.output.write(f.join(`
|
|
698
|
+
`)), this._prevFrame = t2;
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
this.output.write(import_sisteransi.erase.down());
|
|
703
|
+
}
|
|
704
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
var r = class extends V {
|
|
709
|
+
get cursor() {
|
|
710
|
+
return this.value ? 0 : 1;
|
|
711
|
+
}
|
|
712
|
+
get _value() {
|
|
713
|
+
return this.cursor === 0;
|
|
714
|
+
}
|
|
715
|
+
constructor(t2) {
|
|
716
|
+
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
717
|
+
this.value = this._value;
|
|
718
|
+
}), this.on("confirm", (i2) => {
|
|
719
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
720
|
+
}), this.on("cursor", () => {
|
|
721
|
+
this.value = !this.value;
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
var u$1 = class u extends V {
|
|
726
|
+
_mask = "\u2022";
|
|
727
|
+
get cursor() {
|
|
728
|
+
return this._cursor;
|
|
729
|
+
}
|
|
730
|
+
get masked() {
|
|
731
|
+
return this.userInput.replaceAll(/./g, this._mask);
|
|
732
|
+
}
|
|
733
|
+
get userInputWithCursor() {
|
|
734
|
+
if (this.state === "submit" || this.state === "cancel")
|
|
735
|
+
return this.masked;
|
|
736
|
+
const t2 = this.userInput;
|
|
737
|
+
if (this.cursor >= t2.length)
|
|
738
|
+
return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
|
|
739
|
+
const s = this.masked, r2 = s.slice(0, this.cursor), i2 = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
|
|
740
|
+
return `${r2}${styleText("inverse", i2)}${o}`;
|
|
741
|
+
}
|
|
742
|
+
clear() {
|
|
743
|
+
this._clearUserInput();
|
|
744
|
+
}
|
|
745
|
+
constructor({ mask: t2, ...s }) {
|
|
746
|
+
super(s), this._mask = t2 ?? "\u2022", this.on("userInput", (r2) => {
|
|
747
|
+
this._setValue(r2);
|
|
748
|
+
}), this.on("finalize", () => {
|
|
749
|
+
this.value === void 0 && (this.value = "");
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
var n$1 = class n extends V {
|
|
754
|
+
options;
|
|
755
|
+
cursor = 0;
|
|
756
|
+
get _selectedValue() {
|
|
757
|
+
return this.options[this.cursor];
|
|
758
|
+
}
|
|
759
|
+
changeValue() {
|
|
760
|
+
const e = this._selectedValue;
|
|
761
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
762
|
+
}
|
|
763
|
+
constructor(e) {
|
|
764
|
+
super(e, false), this.options = e.options;
|
|
765
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
766
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
767
|
+
switch (s) {
|
|
768
|
+
case "left":
|
|
769
|
+
case "up":
|
|
770
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
771
|
+
break;
|
|
772
|
+
case "down":
|
|
773
|
+
case "right":
|
|
774
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
this.changeValue();
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
var n2 = class extends V {
|
|
782
|
+
get userInputWithCursor() {
|
|
783
|
+
if (this.state === "submit")
|
|
784
|
+
return this.userInput;
|
|
785
|
+
const t2 = this.userInput;
|
|
786
|
+
if (this.cursor >= t2.length)
|
|
787
|
+
return `${this.userInput}\u2588`;
|
|
788
|
+
const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
|
|
789
|
+
return `${r2}${styleText("inverse", s)}${e}`;
|
|
790
|
+
}
|
|
791
|
+
get cursor() {
|
|
792
|
+
return this._cursor;
|
|
793
|
+
}
|
|
794
|
+
constructor(t2) {
|
|
795
|
+
super({
|
|
796
|
+
...t2,
|
|
797
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
798
|
+
}), this.on("userInput", (r2) => {
|
|
799
|
+
this._setValue(r2);
|
|
800
|
+
}), this.on("finalize", () => {
|
|
801
|
+
this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
807
|
+
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
808
|
+
import process$1 from "process";
|
|
809
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
810
|
+
import { existsSync, lstatSync, readdirSync } from "fs";
|
|
811
|
+
import { dirname, join } from "path";
|
|
812
|
+
function isUnicodeSupported() {
|
|
813
|
+
if (process$1.platform !== "win32") {
|
|
814
|
+
return process$1.env.TERM !== "linux";
|
|
815
|
+
}
|
|
816
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
817
|
+
}
|
|
818
|
+
var unicode = isUnicodeSupported();
|
|
819
|
+
var isCI = () => process.env.CI === "true";
|
|
820
|
+
var unicodeOr = (o, e) => unicode ? o : e;
|
|
821
|
+
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
822
|
+
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
823
|
+
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
824
|
+
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
825
|
+
var S_BAR_START = unicodeOr("\u250C", "T");
|
|
826
|
+
var S_BAR = unicodeOr("\u2502", "|");
|
|
827
|
+
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
828
|
+
var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
829
|
+
var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
830
|
+
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
831
|
+
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
832
|
+
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
833
|
+
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
834
|
+
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
835
|
+
var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
836
|
+
var S_BAR_H = unicodeOr("\u2500", "-");
|
|
837
|
+
var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
838
|
+
var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
839
|
+
var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
840
|
+
var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
841
|
+
var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
842
|
+
var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
843
|
+
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
844
|
+
var S_WARN = unicodeOr("\u25B2", "!");
|
|
845
|
+
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
846
|
+
var symbol = (o) => {
|
|
847
|
+
switch (o) {
|
|
848
|
+
case "initial":
|
|
849
|
+
case "active":
|
|
850
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
851
|
+
case "cancel":
|
|
852
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
853
|
+
case "error":
|
|
854
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
855
|
+
case "submit":
|
|
856
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
var symbolBar = (o) => {
|
|
860
|
+
switch (o) {
|
|
861
|
+
case "initial":
|
|
862
|
+
case "active":
|
|
863
|
+
return styleText2("cyan", S_BAR);
|
|
864
|
+
case "cancel":
|
|
865
|
+
return styleText2("red", S_BAR);
|
|
866
|
+
case "error":
|
|
867
|
+
return styleText2("yellow", S_BAR);
|
|
868
|
+
case "submit":
|
|
869
|
+
return styleText2("green", S_BAR);
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
function formatInstructionFooter(o, e) {
|
|
873
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
874
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
875
|
+
}
|
|
876
|
+
var I = (l2, e, w, p, b, C = false) => {
|
|
877
|
+
let r2 = e, O = 0;
|
|
878
|
+
if (C)
|
|
879
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
880
|
+
const m = l2[i2];
|
|
881
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
882
|
+
}
|
|
883
|
+
else
|
|
884
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
885
|
+
const m = l2[i2];
|
|
886
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
887
|
+
}
|
|
888
|
+
return { lineCount: r2, removals: O };
|
|
889
|
+
};
|
|
890
|
+
var limitOptions = ({
|
|
891
|
+
cursor: l2,
|
|
892
|
+
options: e,
|
|
893
|
+
style: w,
|
|
894
|
+
output: p = process.stdout,
|
|
895
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
896
|
+
columnPadding: C = 0,
|
|
897
|
+
rowPadding: r2 = 4
|
|
898
|
+
}) => {
|
|
899
|
+
const i2 = getColumns(p) - C, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
900
|
+
let f = 0;
|
|
901
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
902
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
903
|
+
0
|
|
904
|
+
));
|
|
905
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
906
|
+
const W2 = Math.min(
|
|
907
|
+
f + a2,
|
|
908
|
+
e.length
|
|
909
|
+
), s = [];
|
|
910
|
+
let g = 0;
|
|
911
|
+
d && g++, c2 && g++;
|
|
912
|
+
const T = f + (d ? 1 : 0), y = W2 - (c2 ? 1 : 0);
|
|
913
|
+
for (let t2 = T; t2 < y; t2++) {
|
|
914
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
915
|
+
hard: true,
|
|
916
|
+
trim: false
|
|
917
|
+
}).split(`
|
|
918
|
+
`);
|
|
919
|
+
s.push(h2), g += h2.length;
|
|
920
|
+
}
|
|
921
|
+
if (g > v) {
|
|
922
|
+
let t2 = 0, n3 = 0, o = g;
|
|
923
|
+
const h2 = l2 - T;
|
|
924
|
+
let u4 = v;
|
|
925
|
+
const L = () => I(s, o, 0, h2, u4), E = () => I(
|
|
926
|
+
s,
|
|
927
|
+
o,
|
|
928
|
+
h2 + 1,
|
|
929
|
+
s.length,
|
|
930
|
+
u4,
|
|
931
|
+
true
|
|
932
|
+
);
|
|
933
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u4 && (c2 || (u4 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u4 -= 1), { lineCount: o, removals: n3 } = E(), o > u4 && (u4 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
|
|
934
|
+
}
|
|
935
|
+
const x = [];
|
|
936
|
+
d && x.push(M);
|
|
937
|
+
for (const t2 of s)
|
|
938
|
+
for (const n3 of t2)
|
|
939
|
+
x.push(n3);
|
|
940
|
+
return c2 && x.push(M), x;
|
|
941
|
+
};
|
|
942
|
+
var confirm = (i2) => {
|
|
943
|
+
const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
|
|
944
|
+
return new r({
|
|
945
|
+
active: a2,
|
|
946
|
+
inactive: s,
|
|
947
|
+
signal: i2.signal,
|
|
948
|
+
input: i2.input,
|
|
949
|
+
output: i2.output,
|
|
950
|
+
initialValue: i2.initialValue ?? true,
|
|
951
|
+
render() {
|
|
952
|
+
const e = i2.withGuide ?? settings.withGuide, u4 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
953
|
+
i2.output,
|
|
954
|
+
i2.message,
|
|
955
|
+
l2,
|
|
956
|
+
u4
|
|
957
|
+
), o = `${e ? `${styleText2("gray", S_BAR)}
|
|
958
|
+
` : ""}${f}
|
|
959
|
+
`, c2 = this.value ? a2 : s;
|
|
960
|
+
switch (this.state) {
|
|
961
|
+
case "submit": {
|
|
962
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
963
|
+
return `${o}${r2}${styleText2("dim", c2)}`;
|
|
964
|
+
}
|
|
965
|
+
case "cancel": {
|
|
966
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
967
|
+
return `${o}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
|
|
968
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
969
|
+
}
|
|
970
|
+
default: {
|
|
971
|
+
const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
|
|
972
|
+
return `${o}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i2.vertical ? e ? `
|
|
973
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
974
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
|
|
975
|
+
${g}
|
|
976
|
+
`;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}).prompt();
|
|
981
|
+
};
|
|
982
|
+
var MULTISELECT_INSTRUCTIONS = [
|
|
983
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
984
|
+
`${styleText2("dim", "Space:")} select`,
|
|
985
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
986
|
+
];
|
|
987
|
+
var log = {
|
|
988
|
+
message: (s = [], {
|
|
989
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
990
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
991
|
+
output: m = process.stdout,
|
|
992
|
+
spacing: l2 = 1,
|
|
993
|
+
withGuide: c2
|
|
994
|
+
} = {}) => {
|
|
995
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u4 = o ? `${r2} ` : "";
|
|
996
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
997
|
+
t2.push(f);
|
|
998
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
999
|
+
`);
|
|
1000
|
+
if (g.length > 0) {
|
|
1001
|
+
const [i2, ...y] = g;
|
|
1002
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1003
|
+
for (const p of y)
|
|
1004
|
+
p.length > 0 ? t2.push(`${u4}${p}`) : t2.push(o ? r2 : "");
|
|
1005
|
+
}
|
|
1006
|
+
m.write(`${t2.join(`
|
|
1007
|
+
`)}
|
|
1008
|
+
`);
|
|
1009
|
+
},
|
|
1010
|
+
info: (s, e) => {
|
|
1011
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1012
|
+
},
|
|
1013
|
+
success: (s, e) => {
|
|
1014
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1015
|
+
},
|
|
1016
|
+
step: (s, e) => {
|
|
1017
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1018
|
+
},
|
|
1019
|
+
warn: (s, e) => {
|
|
1020
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1021
|
+
},
|
|
1022
|
+
/** alias for `log.warn()`. */
|
|
1023
|
+
warning: (s, e) => {
|
|
1024
|
+
log.warn(s, e);
|
|
1025
|
+
},
|
|
1026
|
+
error: (s, e) => {
|
|
1027
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
var cancel = (o = "", t2) => {
|
|
1031
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1032
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
1033
|
+
|
|
1034
|
+
`);
|
|
1035
|
+
};
|
|
1036
|
+
var outro = (o = "", t2) => {
|
|
1037
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1038
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1039
|
+
i2.write(`${e}${o}
|
|
1040
|
+
|
|
1041
|
+
`);
|
|
1042
|
+
};
|
|
1043
|
+
var password = (r2) => new u$1({
|
|
1044
|
+
validate: r2.validate,
|
|
1045
|
+
mask: r2.mask ?? S_PASSWORD_MASK,
|
|
1046
|
+
signal: r2.signal,
|
|
1047
|
+
input: r2.input,
|
|
1048
|
+
output: r2.output,
|
|
1049
|
+
render() {
|
|
1050
|
+
const e = r2.withGuide ?? settings.withGuide, o = `${e ? `${styleText2("gray", S_BAR)}
|
|
1051
|
+
` : ""}${symbol(this.state)} ${r2.message}
|
|
1052
|
+
`, c2 = this.userInputWithCursor, i2 = this.masked;
|
|
1053
|
+
switch (this.state) {
|
|
1054
|
+
case "error": {
|
|
1055
|
+
const s = e ? `${styleText2("yellow", S_BAR)} ` : "", n3 = e ? `${styleText2("yellow", S_BAR_END)} ` : "", l2 = i2 ?? "";
|
|
1056
|
+
return r2.clearOnError && this.clear(), `${o.trim()}
|
|
1057
|
+
${s}${l2}
|
|
1058
|
+
${n3}${styleText2("yellow", this.error)}
|
|
1059
|
+
`;
|
|
1060
|
+
}
|
|
1061
|
+
case "submit": {
|
|
1062
|
+
const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2("dim", i2) : "";
|
|
1063
|
+
return `${o}${s}${n3}`;
|
|
1064
|
+
}
|
|
1065
|
+
case "cancel": {
|
|
1066
|
+
const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2(["strikethrough", "dim"], i2) : "";
|
|
1067
|
+
return `${o}${s}${n3}${i2 && e ? `
|
|
1068
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1069
|
+
}
|
|
1070
|
+
default: {
|
|
1071
|
+
const s = e ? `${styleText2("cyan", S_BAR)} ` : "", n3 = e ? styleText2("cyan", S_BAR_END) : "";
|
|
1072
|
+
return `${o}${s}${c2}
|
|
1073
|
+
${n3}
|
|
1074
|
+
`;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}).prompt();
|
|
1079
|
+
var W = (l2) => styleText2("magenta", l2);
|
|
1080
|
+
var spinner = ({
|
|
1081
|
+
indicator: l2 = "dots",
|
|
1082
|
+
onCancel: h2,
|
|
1083
|
+
output: n3 = process.stdout,
|
|
1084
|
+
cancelMessage: G,
|
|
1085
|
+
errorMessage: O,
|
|
1086
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1087
|
+
delay: F = unicode ? 80 : 120,
|
|
1088
|
+
signal: m,
|
|
1089
|
+
...I2
|
|
1090
|
+
} = {}) => {
|
|
1091
|
+
const u4 = isCI();
|
|
1092
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1093
|
+
const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1094
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1095
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1096
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1097
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
|
|
1098
|
+
}, H = () => {
|
|
1099
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
|
|
1100
|
+
}, y = () => {
|
|
1101
|
+
if (p === void 0) return;
|
|
1102
|
+
u4 && n3.write(`
|
|
1103
|
+
`);
|
|
1104
|
+
const r2 = wrapAnsi(p, x, {
|
|
1105
|
+
hard: true,
|
|
1106
|
+
trim: false
|
|
1107
|
+
}).split(`
|
|
1108
|
+
`);
|
|
1109
|
+
r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
|
|
1110
|
+
}, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1111
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1112
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1113
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1114
|
+
d = true, M = block({ output: n3 }), s = C(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
1115
|
+
`);
|
|
1116
|
+
let r2 = 0, t2 = 0;
|
|
1117
|
+
A(), T = setInterval(() => {
|
|
1118
|
+
if (u4 && s === p)
|
|
1119
|
+
return;
|
|
1120
|
+
y(), p = s;
|
|
1121
|
+
const o = k(E[r2]);
|
|
1122
|
+
let v;
|
|
1123
|
+
if (u4)
|
|
1124
|
+
v = `${o} ${s}...`;
|
|
1125
|
+
else if (l2 === "timer")
|
|
1126
|
+
v = `${o} ${s} ${_(w)}`;
|
|
1127
|
+
else {
|
|
1128
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1129
|
+
v = `${o} ${s}${B}`;
|
|
1130
|
+
}
|
|
1131
|
+
const j = wrapAnsi(v, x, {
|
|
1132
|
+
hard: true,
|
|
1133
|
+
trim: false
|
|
1134
|
+
});
|
|
1135
|
+
n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1136
|
+
}, F);
|
|
1137
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1138
|
+
if (!d) return;
|
|
1139
|
+
d = false, clearInterval(T), y();
|
|
1140
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1141
|
+
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1142
|
+
`) : n3.write(`${o} ${s}
|
|
1143
|
+
`)), H(), M();
|
|
1144
|
+
};
|
|
1145
|
+
return {
|
|
1146
|
+
start: P,
|
|
1147
|
+
stop: (e = "") => a2(e, 0),
|
|
1148
|
+
message: (e = "") => {
|
|
1149
|
+
s = C(e ?? s);
|
|
1150
|
+
},
|
|
1151
|
+
cancel: (e = "") => a2(e, 1),
|
|
1152
|
+
error: (e = "") => a2(e, 2),
|
|
1153
|
+
clear: () => a2("", 0, true),
|
|
1154
|
+
get isCancelled() {
|
|
1155
|
+
return S;
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
};
|
|
1159
|
+
var u3 = {
|
|
1160
|
+
light: unicodeOr("\u2500", "-"),
|
|
1161
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1162
|
+
block: unicodeOr("\u2588", "#")
|
|
1163
|
+
};
|
|
1164
|
+
var SELECT_INSTRUCTIONS = [
|
|
1165
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1166
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1167
|
+
];
|
|
1168
|
+
var c = (t2, o) => t2.includes(`
|
|
1169
|
+
`) ? t2.split(`
|
|
1170
|
+
`).map((d) => o(d)).join(`
|
|
1171
|
+
`) : o(t2);
|
|
1172
|
+
var select = (t2) => {
|
|
1173
|
+
const o = (n3, m) => {
|
|
1174
|
+
if (n3 === void 0)
|
|
1175
|
+
return "";
|
|
1176
|
+
const s = n3.label ?? String(n3.value);
|
|
1177
|
+
switch (m) {
|
|
1178
|
+
case "disabled":
|
|
1179
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1180
|
+
case "selected":
|
|
1181
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1182
|
+
case "active":
|
|
1183
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1184
|
+
case "cancelled":
|
|
1185
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1186
|
+
default:
|
|
1187
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1188
|
+
}
|
|
1189
|
+
}, d = t2.showInstructions ?? true;
|
|
1190
|
+
return new n$1({
|
|
1191
|
+
options: t2.options,
|
|
1192
|
+
signal: t2.signal,
|
|
1193
|
+
input: t2.input,
|
|
1194
|
+
output: t2.output,
|
|
1195
|
+
initialValue: t2.initialValue,
|
|
1196
|
+
render() {
|
|
1197
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1198
|
+
t2.output,
|
|
1199
|
+
t2.message,
|
|
1200
|
+
s,
|
|
1201
|
+
m
|
|
1202
|
+
), u4 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1203
|
+
` : ""}${i2}
|
|
1204
|
+
`;
|
|
1205
|
+
switch (this.state) {
|
|
1206
|
+
case "submit": {
|
|
1207
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1208
|
+
t2.output,
|
|
1209
|
+
o(this.options[this.cursor], "selected"),
|
|
1210
|
+
r2
|
|
1211
|
+
);
|
|
1212
|
+
return `${u4}${a2}`;
|
|
1213
|
+
}
|
|
1214
|
+
case "cancel": {
|
|
1215
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1216
|
+
t2.output,
|
|
1217
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1218
|
+
r2
|
|
1219
|
+
);
|
|
1220
|
+
return `${u4}${a2}${n3 ? `
|
|
1221
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1222
|
+
}
|
|
1223
|
+
default: {
|
|
1224
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u4.split(`
|
|
1225
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
1226
|
+
`), f = p.length + 1;
|
|
1227
|
+
return `${u4}${r2}${limitOptions({
|
|
1228
|
+
output: t2.output,
|
|
1229
|
+
cursor: this.cursor,
|
|
1230
|
+
options: this.options,
|
|
1231
|
+
maxItems: t2.maxItems,
|
|
1232
|
+
columnPadding: r2.length,
|
|
1233
|
+
rowPadding: a2 + f,
|
|
1234
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1235
|
+
}).join(`
|
|
1236
|
+
${r2}`)}
|
|
1237
|
+
${b}
|
|
1238
|
+
`;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}).prompt();
|
|
1243
|
+
};
|
|
1244
|
+
var i = `${styleText2("gray", S_BAR)} `;
|
|
1245
|
+
var text = (e) => new n2({
|
|
1246
|
+
validate: e.validate,
|
|
1247
|
+
placeholder: e.placeholder,
|
|
1248
|
+
defaultValue: e.defaultValue,
|
|
1249
|
+
initialValue: e.initialValue,
|
|
1250
|
+
output: e.output,
|
|
1251
|
+
signal: e.signal,
|
|
1252
|
+
input: e.input,
|
|
1253
|
+
render() {
|
|
1254
|
+
const i2 = e?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${styleText2("gray", S_BAR)}
|
|
1255
|
+
` : ""}${symbol(this.state)} `}${e.message}
|
|
1256
|
+
`, c2 = e.placeholder && e.placeholder.length > 0 ? (
|
|
1257
|
+
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
1258
|
+
styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1))
|
|
1259
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : c2, l2 = this.value ?? "";
|
|
1260
|
+
switch (this.state) {
|
|
1261
|
+
case "error": {
|
|
1262
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i2 ? `${styleText2("yellow", S_BAR)} ` : "", d = i2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1263
|
+
return `${s.trim()}
|
|
1264
|
+
${r2}${o}
|
|
1265
|
+
${d}${n3}
|
|
1266
|
+
`;
|
|
1267
|
+
}
|
|
1268
|
+
case "submit": {
|
|
1269
|
+
const n3 = l2 ? ` ${styleText2("dim", l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
|
|
1270
|
+
return `${s}${r2}${n3}`;
|
|
1271
|
+
}
|
|
1272
|
+
case "cancel": {
|
|
1273
|
+
const n3 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
|
|
1274
|
+
return `${s}${r2}${n3}${l2.trim() ? `
|
|
1275
|
+
${r2}` : ""}`;
|
|
1276
|
+
}
|
|
1277
|
+
default: {
|
|
1278
|
+
const n3 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1279
|
+
return `${s}${n3}${o}
|
|
1280
|
+
${r2}
|
|
1281
|
+
`;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}).prompt();
|
|
1286
|
+
|
|
1287
|
+
export {
|
|
1288
|
+
isCancel,
|
|
1289
|
+
confirm,
|
|
1290
|
+
log,
|
|
1291
|
+
cancel,
|
|
1292
|
+
outro,
|
|
1293
|
+
password,
|
|
1294
|
+
spinner,
|
|
1295
|
+
select,
|
|
1296
|
+
text
|
|
1297
|
+
};
|
|
1298
|
+
//# sourceMappingURL=chunk-4H427UBV.js.map
|