enact-cli 1.0.0
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/LICENSE +19 -0
- package/README.md +154 -0
- package/dist/enact +0 -0
- package/dist/index.js +1250 -0
- package/package.json +62 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
10
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
11
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
12
|
+
for (let key of __getOwnPropNames(mod))
|
|
13
|
+
if (!__hasOwnProp.call(to, key))
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: () => mod[key],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
21
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
22
|
+
|
|
23
|
+
// node_modules/picocolors/picocolors.js
|
|
24
|
+
var require_picocolors = __commonJS((exports, module) => {
|
|
25
|
+
var p = process || {};
|
|
26
|
+
var argv = p.argv || [];
|
|
27
|
+
var env = p.env || {};
|
|
28
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
29
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
30
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
31
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
32
|
+
};
|
|
33
|
+
var replaceClose = (string, close, replace, index) => {
|
|
34
|
+
let result = "", cursor = 0;
|
|
35
|
+
do {
|
|
36
|
+
result += string.substring(cursor, index) + replace;
|
|
37
|
+
cursor = index + close.length;
|
|
38
|
+
index = string.indexOf(close, cursor);
|
|
39
|
+
} while (~index);
|
|
40
|
+
return result + string.substring(cursor);
|
|
41
|
+
};
|
|
42
|
+
var createColors = (enabled = isColorSupported) => {
|
|
43
|
+
let f = enabled ? formatter : () => String;
|
|
44
|
+
return {
|
|
45
|
+
isColorSupported: enabled,
|
|
46
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
47
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
48
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
49
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
50
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
51
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
52
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
53
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
54
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
55
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
56
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
57
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
58
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
59
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
60
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
61
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
62
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
63
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
64
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
65
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
66
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
67
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
68
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
69
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
70
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
71
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
72
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
73
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
74
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
75
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
76
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
77
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
78
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
79
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
80
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
81
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
82
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
83
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
84
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
85
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
86
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
module.exports = createColors();
|
|
90
|
+
module.exports.createColors = createColors;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// node_modules/sisteransi/src/index.js
|
|
94
|
+
var require_src = __commonJS((exports, module) => {
|
|
95
|
+
var ESC = "\x1B";
|
|
96
|
+
var CSI = `${ESC}[`;
|
|
97
|
+
var beep = "\x07";
|
|
98
|
+
var cursor = {
|
|
99
|
+
to(x, y) {
|
|
100
|
+
if (!y)
|
|
101
|
+
return `${CSI}${x + 1}G`;
|
|
102
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
103
|
+
},
|
|
104
|
+
move(x, y) {
|
|
105
|
+
let ret = "";
|
|
106
|
+
if (x < 0)
|
|
107
|
+
ret += `${CSI}${-x}D`;
|
|
108
|
+
else if (x > 0)
|
|
109
|
+
ret += `${CSI}${x}C`;
|
|
110
|
+
if (y < 0)
|
|
111
|
+
ret += `${CSI}${-y}A`;
|
|
112
|
+
else if (y > 0)
|
|
113
|
+
ret += `${CSI}${y}B`;
|
|
114
|
+
return ret;
|
|
115
|
+
},
|
|
116
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
117
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
118
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
119
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
120
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
121
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
122
|
+
left: `${CSI}G`,
|
|
123
|
+
hide: `${CSI}?25l`,
|
|
124
|
+
show: `${CSI}?25h`,
|
|
125
|
+
save: `${ESC}7`,
|
|
126
|
+
restore: `${ESC}8`
|
|
127
|
+
};
|
|
128
|
+
var scroll = {
|
|
129
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
130
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
131
|
+
};
|
|
132
|
+
var erase = {
|
|
133
|
+
screen: `${CSI}2J`,
|
|
134
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
135
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
136
|
+
line: `${CSI}2K`,
|
|
137
|
+
lineEnd: `${CSI}K`,
|
|
138
|
+
lineStart: `${CSI}1K`,
|
|
139
|
+
lines(count) {
|
|
140
|
+
let clear = "";
|
|
141
|
+
for (let i = 0;i < count; i++)
|
|
142
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
143
|
+
if (count)
|
|
144
|
+
clear += cursor.left;
|
|
145
|
+
return clear;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// src/index.ts
|
|
152
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
153
|
+
import { parseArgs } from "node:util";
|
|
154
|
+
|
|
155
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
156
|
+
import { stripVTControlCharacters as S2 } from "node:util";
|
|
157
|
+
|
|
158
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
159
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
160
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
161
|
+
import { stdin as j, stdout as M } from "node:process";
|
|
162
|
+
import * as g from "node:readline";
|
|
163
|
+
import O from "node:readline";
|
|
164
|
+
import { Writable as X } from "node:stream";
|
|
165
|
+
function DD({ onlyFirst: e = false } = {}) {
|
|
166
|
+
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
167
|
+
return new RegExp(t, e ? undefined : "g");
|
|
168
|
+
}
|
|
169
|
+
var uD = DD();
|
|
170
|
+
function P(e) {
|
|
171
|
+
if (typeof e != "string")
|
|
172
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
173
|
+
return e.replace(uD, "");
|
|
174
|
+
}
|
|
175
|
+
function L(e) {
|
|
176
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
177
|
+
}
|
|
178
|
+
var W = { exports: {} };
|
|
179
|
+
(function(e) {
|
|
180
|
+
var u = {};
|
|
181
|
+
e.exports = u, u.eastAsianWidth = function(F) {
|
|
182
|
+
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
183
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
184
|
+
}, u.characterLength = function(F) {
|
|
185
|
+
var s = this.eastAsianWidth(F);
|
|
186
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
187
|
+
};
|
|
188
|
+
function t(F) {
|
|
189
|
+
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
190
|
+
}
|
|
191
|
+
u.length = function(F) {
|
|
192
|
+
for (var s = t(F), i = 0, D = 0;D < s.length; D++)
|
|
193
|
+
i = i + this.characterLength(s[D]);
|
|
194
|
+
return i;
|
|
195
|
+
}, u.slice = function(F, s, i) {
|
|
196
|
+
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
197
|
+
for (var D = "", r = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
198
|
+
var a = n[E], o = u.length(a);
|
|
199
|
+
if (r >= s - (o == 2 ? 1 : 0))
|
|
200
|
+
if (r + o <= i)
|
|
201
|
+
D += a;
|
|
202
|
+
else
|
|
203
|
+
break;
|
|
204
|
+
r += o;
|
|
205
|
+
}
|
|
206
|
+
return D;
|
|
207
|
+
};
|
|
208
|
+
})(W);
|
|
209
|
+
var tD = W.exports;
|
|
210
|
+
var eD = L(tD);
|
|
211
|
+
var FD = function() {
|
|
212
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
213
|
+
};
|
|
214
|
+
var sD = L(FD);
|
|
215
|
+
function p(e, u = {}) {
|
|
216
|
+
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
217
|
+
return 0;
|
|
218
|
+
e = e.replace(sD(), " ");
|
|
219
|
+
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
220
|
+
let F = 0;
|
|
221
|
+
for (const s of e) {
|
|
222
|
+
const i = s.codePointAt(0);
|
|
223
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
224
|
+
continue;
|
|
225
|
+
switch (eD.eastAsianWidth(s)) {
|
|
226
|
+
case "F":
|
|
227
|
+
case "W":
|
|
228
|
+
F += 2;
|
|
229
|
+
break;
|
|
230
|
+
case "A":
|
|
231
|
+
F += t;
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
F += 1;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return F;
|
|
238
|
+
}
|
|
239
|
+
var w = 10;
|
|
240
|
+
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
241
|
+
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
242
|
+
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
243
|
+
var C = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
244
|
+
Object.keys(C.modifier);
|
|
245
|
+
var iD = Object.keys(C.color);
|
|
246
|
+
var rD = Object.keys(C.bgColor);
|
|
247
|
+
[...iD];
|
|
248
|
+
function CD() {
|
|
249
|
+
const e = new Map;
|
|
250
|
+
for (const [u, t] of Object.entries(C)) {
|
|
251
|
+
for (const [F, s] of Object.entries(t))
|
|
252
|
+
C[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = C[F], e.set(s[0], s[1]);
|
|
253
|
+
Object.defineProperty(C, u, { value: t, enumerable: false });
|
|
254
|
+
}
|
|
255
|
+
return Object.defineProperty(C, "codes", { value: e, enumerable: false }), C.color.close = "\x1B[39m", C.bgColor.close = "\x1B[49m", C.color.ansi = N(), C.color.ansi256 = I(), C.color.ansi16m = R(), C.bgColor.ansi = N(w), C.bgColor.ansi256 = I(w), C.bgColor.ansi16m = R(w), Object.defineProperties(C, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
256
|
+
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
257
|
+
if (!t)
|
|
258
|
+
return [0, 0, 0];
|
|
259
|
+
let [F] = t;
|
|
260
|
+
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
261
|
+
const s = Number.parseInt(F, 16);
|
|
262
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
263
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => C.rgbToAnsi256(...C.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
264
|
+
if (u < 8)
|
|
265
|
+
return 30 + u;
|
|
266
|
+
if (u < 16)
|
|
267
|
+
return 90 + (u - 8);
|
|
268
|
+
let t, F, s;
|
|
269
|
+
if (u >= 232)
|
|
270
|
+
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
271
|
+
else {
|
|
272
|
+
u -= 16;
|
|
273
|
+
const r = u % 36;
|
|
274
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(r / 6) / 5, s = r % 6 / 5;
|
|
275
|
+
}
|
|
276
|
+
const i = Math.max(t, F, s) * 2;
|
|
277
|
+
if (i === 0)
|
|
278
|
+
return 30;
|
|
279
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
280
|
+
return i === 2 && (D += 60), D;
|
|
281
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => C.ansi256ToAnsi(C.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => C.ansi256ToAnsi(C.hexToAnsi256(u)), enumerable: false } }), C;
|
|
282
|
+
}
|
|
283
|
+
var ED = CD();
|
|
284
|
+
var d = new Set(["\x1B", ""]);
|
|
285
|
+
var oD = 39;
|
|
286
|
+
var y = "\x07";
|
|
287
|
+
var V = "[";
|
|
288
|
+
var nD = "]";
|
|
289
|
+
var G = "m";
|
|
290
|
+
var _ = `${nD}8;;`;
|
|
291
|
+
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
|
|
292
|
+
var K = (e) => `${d.values().next().value}${_}${e}${y}`;
|
|
293
|
+
var aD = (e) => e.split(" ").map((u) => p(u));
|
|
294
|
+
var k = (e, u, t) => {
|
|
295
|
+
const F = [...u];
|
|
296
|
+
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
297
|
+
for (const [r, n] of F.entries()) {
|
|
298
|
+
const E = p(n);
|
|
299
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(r + 1).join("").startsWith(_)), s) {
|
|
300
|
+
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
D += E, D === t && r < F.length - 1 && (e.push(""), D = 0);
|
|
304
|
+
}
|
|
305
|
+
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
306
|
+
};
|
|
307
|
+
var hD = (e) => {
|
|
308
|
+
const u = e.split(" ");
|
|
309
|
+
let t = u.length;
|
|
310
|
+
for (;t > 0 && !(p(u[t - 1]) > 0); )
|
|
311
|
+
t--;
|
|
312
|
+
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
313
|
+
};
|
|
314
|
+
var lD = (e, u, t = {}) => {
|
|
315
|
+
if (t.trim !== false && e.trim() === "")
|
|
316
|
+
return "";
|
|
317
|
+
let F = "", s, i;
|
|
318
|
+
const D = aD(e);
|
|
319
|
+
let r = [""];
|
|
320
|
+
for (const [E, a] of e.split(" ").entries()) {
|
|
321
|
+
t.trim !== false && (r[r.length - 1] = r[r.length - 1].trimStart());
|
|
322
|
+
let o = p(r[r.length - 1]);
|
|
323
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (r.push(""), o = 0), (o > 0 || t.trim === false) && (r[r.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
324
|
+
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
325
|
+
Math.floor((D[E] - 1) / u) < f && r.push(""), k(r, a, u);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
329
|
+
if (t.wordWrap === false && o < u) {
|
|
330
|
+
k(r, a, u);
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
r.push("");
|
|
334
|
+
}
|
|
335
|
+
if (o + D[E] > u && t.wordWrap === false) {
|
|
336
|
+
k(r, a, u);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
r[r.length - 1] += a;
|
|
340
|
+
}
|
|
341
|
+
t.trim !== false && (r = r.map((E) => hD(E)));
|
|
342
|
+
const n = [...r.join(`
|
|
343
|
+
`)];
|
|
344
|
+
for (const [E, a] of n.entries()) {
|
|
345
|
+
if (F += a, d.has(a)) {
|
|
346
|
+
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
347
|
+
if (c.code !== undefined) {
|
|
348
|
+
const f = Number.parseFloat(c.code);
|
|
349
|
+
s = f === oD ? undefined : f;
|
|
350
|
+
} else
|
|
351
|
+
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
352
|
+
}
|
|
353
|
+
const o = ED.codes.get(Number(s));
|
|
354
|
+
n[E + 1] === `
|
|
355
|
+
` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
|
|
356
|
+
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
357
|
+
}
|
|
358
|
+
return F;
|
|
359
|
+
};
|
|
360
|
+
function Y(e, u, t) {
|
|
361
|
+
return String(e).normalize().replace(/\r\n/g, `
|
|
362
|
+
`).split(`
|
|
363
|
+
`).map((F) => lD(F, u, t)).join(`
|
|
364
|
+
`);
|
|
365
|
+
}
|
|
366
|
+
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
367
|
+
var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
368
|
+
function $(e, u) {
|
|
369
|
+
if (typeof e == "string")
|
|
370
|
+
return B.aliases.get(e) === u;
|
|
371
|
+
for (const t of e)
|
|
372
|
+
if (t !== undefined && $(t, u))
|
|
373
|
+
return true;
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
function BD(e, u) {
|
|
377
|
+
if (e === u)
|
|
378
|
+
return;
|
|
379
|
+
const t = e.split(`
|
|
380
|
+
`), F = u.split(`
|
|
381
|
+
`), s = [];
|
|
382
|
+
for (let i = 0;i < Math.max(t.length, F.length); i++)
|
|
383
|
+
t[i] !== F[i] && s.push(i);
|
|
384
|
+
return s;
|
|
385
|
+
}
|
|
386
|
+
var AD = globalThis.process.platform.startsWith("win");
|
|
387
|
+
var S = Symbol("clack:cancel");
|
|
388
|
+
function m(e, u) {
|
|
389
|
+
const t = e;
|
|
390
|
+
t.isTTY && t.setRawMode(u);
|
|
391
|
+
}
|
|
392
|
+
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
|
|
393
|
+
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
|
|
394
|
+
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
|
|
395
|
+
const i = (D, { name: r, sequence: n }) => {
|
|
396
|
+
const E = String(D);
|
|
397
|
+
if ($([E, r, n], "cancel")) {
|
|
398
|
+
F && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (!t)
|
|
402
|
+
return;
|
|
403
|
+
const a = r === "return" ? 0 : -1, o = r === "return" ? -1 : 0;
|
|
404
|
+
g.moveCursor(u, a, o, () => {
|
|
405
|
+
g.clearLine(u, 1, () => {
|
|
406
|
+
e.once("keypress", i);
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
return F && u.write(import_sisteransi.cursor.hide), e.once("keypress", i), () => {
|
|
411
|
+
e.off("keypress", i), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
var gD = Object.defineProperty;
|
|
415
|
+
var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
416
|
+
var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
417
|
+
|
|
418
|
+
class x {
|
|
419
|
+
constructor(u, t = true) {
|
|
420
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
421
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...r } = u;
|
|
422
|
+
this.opts = r, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
423
|
+
}
|
|
424
|
+
unsubscribe() {
|
|
425
|
+
this._subscribers.clear();
|
|
426
|
+
}
|
|
427
|
+
setSubscriber(u, t) {
|
|
428
|
+
const F = this._subscribers.get(u) ?? [];
|
|
429
|
+
F.push(t), this._subscribers.set(u, F);
|
|
430
|
+
}
|
|
431
|
+
on(u, t) {
|
|
432
|
+
this.setSubscriber(u, { cb: t });
|
|
433
|
+
}
|
|
434
|
+
once(u, t) {
|
|
435
|
+
this.setSubscriber(u, { cb: t, once: true });
|
|
436
|
+
}
|
|
437
|
+
emit(u, ...t) {
|
|
438
|
+
const F = this._subscribers.get(u) ?? [], s = [];
|
|
439
|
+
for (const i of F)
|
|
440
|
+
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
441
|
+
for (const i of s)
|
|
442
|
+
i();
|
|
443
|
+
}
|
|
444
|
+
prompt() {
|
|
445
|
+
return new Promise((u, t) => {
|
|
446
|
+
if (this._abortSignal) {
|
|
447
|
+
if (this._abortSignal.aborted)
|
|
448
|
+
return this.state = "cancel", this.close(), u(S);
|
|
449
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
450
|
+
this.state = "cancel", this.close();
|
|
451
|
+
}, { once: true });
|
|
452
|
+
}
|
|
453
|
+
const F = new X;
|
|
454
|
+
F._write = (s, i, D) => {
|
|
455
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
456
|
+
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
457
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
|
|
458
|
+
}), this.once("cancel", () => {
|
|
459
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
onKeypress(u, t) {
|
|
464
|
+
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
465
|
+
if (!this.value && this.opts.placeholder && (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder)), this.opts.validate) {
|
|
466
|
+
const F = this.opts.validate(this.value);
|
|
467
|
+
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
468
|
+
}
|
|
469
|
+
this.state !== "error" && (this.state = "submit");
|
|
470
|
+
}
|
|
471
|
+
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
472
|
+
}
|
|
473
|
+
close() {
|
|
474
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
475
|
+
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
476
|
+
}
|
|
477
|
+
restoreCursor() {
|
|
478
|
+
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
479
|
+
`).length - 1;
|
|
480
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
481
|
+
}
|
|
482
|
+
render() {
|
|
483
|
+
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
484
|
+
if (u !== this._prevFrame) {
|
|
485
|
+
if (this.state === "initial")
|
|
486
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
487
|
+
else {
|
|
488
|
+
const t = BD(this._prevFrame, u);
|
|
489
|
+
if (this.restoreCursor(), t && t?.length === 1) {
|
|
490
|
+
const F = t[0];
|
|
491
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
492
|
+
const s = u.split(`
|
|
493
|
+
`);
|
|
494
|
+
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
if (t && t?.length > 1) {
|
|
498
|
+
const F = t[0];
|
|
499
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
500
|
+
const s = u.split(`
|
|
501
|
+
`).slice(F);
|
|
502
|
+
this.output.write(s.join(`
|
|
503
|
+
`)), this._prevFrame = u;
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.output.write(import_sisteransi.erase.down());
|
|
507
|
+
}
|
|
508
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
class dD extends x {
|
|
514
|
+
get cursor() {
|
|
515
|
+
return this.value ? 0 : 1;
|
|
516
|
+
}
|
|
517
|
+
get _value() {
|
|
518
|
+
return this.cursor === 0;
|
|
519
|
+
}
|
|
520
|
+
constructor(u) {
|
|
521
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
522
|
+
this.value = this._value;
|
|
523
|
+
}), this.on("confirm", (t) => {
|
|
524
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
525
|
+
}), this.on("cursor", () => {
|
|
526
|
+
this.value = !this.value;
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
var A;
|
|
531
|
+
A = new WeakMap;
|
|
532
|
+
var OD = Object.defineProperty;
|
|
533
|
+
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
534
|
+
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
535
|
+
|
|
536
|
+
class LD extends x {
|
|
537
|
+
constructor(u) {
|
|
538
|
+
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
539
|
+
switch (t) {
|
|
540
|
+
case "left":
|
|
541
|
+
case "up":
|
|
542
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
543
|
+
break;
|
|
544
|
+
case "down":
|
|
545
|
+
case "right":
|
|
546
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
this.changeValue();
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
get _value() {
|
|
553
|
+
return this.options[this.cursor];
|
|
554
|
+
}
|
|
555
|
+
changeValue() {
|
|
556
|
+
this.value = this._value.value;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
class RD extends x {
|
|
560
|
+
get valueWithCursor() {
|
|
561
|
+
if (this.state === "submit")
|
|
562
|
+
return this.value;
|
|
563
|
+
if (this.cursor >= this.value.length)
|
|
564
|
+
return `${this.value}█`;
|
|
565
|
+
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
566
|
+
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
567
|
+
}
|
|
568
|
+
get cursor() {
|
|
569
|
+
return this._cursor;
|
|
570
|
+
}
|
|
571
|
+
constructor(u) {
|
|
572
|
+
super(u), this.on("finalize", () => {
|
|
573
|
+
this.value || (this.value = u.defaultValue);
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
579
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
580
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
581
|
+
import y2 from "node:process";
|
|
582
|
+
function ce() {
|
|
583
|
+
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
584
|
+
}
|
|
585
|
+
var V2 = ce();
|
|
586
|
+
var u = (t, n) => V2 ? t : n;
|
|
587
|
+
var le = u("◆", "*");
|
|
588
|
+
var L2 = u("■", "x");
|
|
589
|
+
var W2 = u("▲", "x");
|
|
590
|
+
var C2 = u("◇", "o");
|
|
591
|
+
var ue = u("┌", "T");
|
|
592
|
+
var o = u("│", "|");
|
|
593
|
+
var d2 = u("└", "—");
|
|
594
|
+
var k2 = u("●", ">");
|
|
595
|
+
var P2 = u("○", " ");
|
|
596
|
+
var A2 = u("◻", "[•]");
|
|
597
|
+
var T = u("◼", "[+]");
|
|
598
|
+
var F = u("◻", "[ ]");
|
|
599
|
+
var $e = u("▪", "•");
|
|
600
|
+
var _2 = u("─", "-");
|
|
601
|
+
var me = u("╮", "+");
|
|
602
|
+
var de = u("├", "+");
|
|
603
|
+
var pe = u("╯", "+");
|
|
604
|
+
var q = u("●", "•");
|
|
605
|
+
var D = u("◆", "*");
|
|
606
|
+
var U = u("▲", "!");
|
|
607
|
+
var K2 = u("■", "x");
|
|
608
|
+
var b2 = (t) => {
|
|
609
|
+
switch (t) {
|
|
610
|
+
case "initial":
|
|
611
|
+
case "active":
|
|
612
|
+
return import_picocolors2.default.cyan(le);
|
|
613
|
+
case "cancel":
|
|
614
|
+
return import_picocolors2.default.red(L2);
|
|
615
|
+
case "error":
|
|
616
|
+
return import_picocolors2.default.yellow(W2);
|
|
617
|
+
case "submit":
|
|
618
|
+
return import_picocolors2.default.green(C2);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
var G2 = (t) => {
|
|
622
|
+
const { cursor: n, options: r, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
623
|
+
let l2 = 0;
|
|
624
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
625
|
+
const $2 = a < r.length && l2 > 0, g2 = a < r.length && l2 + a < r.length;
|
|
626
|
+
return r.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
627
|
+
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
628
|
+
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
632
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
633
|
+
${b2(this.state)} ${t.message}
|
|
634
|
+
`, r = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r;
|
|
635
|
+
switch (this.state) {
|
|
636
|
+
case "error":
|
|
637
|
+
return `${n.trim()}
|
|
638
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
639
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
640
|
+
`;
|
|
641
|
+
case "submit":
|
|
642
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
643
|
+
case "cancel":
|
|
644
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
645
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
646
|
+
default:
|
|
647
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
648
|
+
${import_picocolors2.default.cyan(d2)}
|
|
649
|
+
`;
|
|
650
|
+
}
|
|
651
|
+
} }).prompt();
|
|
652
|
+
var ye = (t) => {
|
|
653
|
+
const n = t.active ?? "Yes", r = t.inactive ?? "No";
|
|
654
|
+
return new dD({ active: n, inactive: r, initialValue: t.initialValue ?? true, render() {
|
|
655
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
656
|
+
${b2(this.state)} ${t.message}
|
|
657
|
+
`, s = this.value ? n : r;
|
|
658
|
+
switch (this.state) {
|
|
659
|
+
case "submit":
|
|
660
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
661
|
+
case "cancel":
|
|
662
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
663
|
+
${import_picocolors2.default.gray(o)}`;
|
|
664
|
+
default:
|
|
665
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r)}` : `${import_picocolors2.default.green(k2)} ${r}`}
|
|
666
|
+
${import_picocolors2.default.cyan(d2)}
|
|
667
|
+
`;
|
|
668
|
+
}
|
|
669
|
+
} }).prompt();
|
|
670
|
+
};
|
|
671
|
+
var ve = (t) => {
|
|
672
|
+
const n = (r, i) => {
|
|
673
|
+
const s = r.label ?? String(r.value);
|
|
674
|
+
switch (i) {
|
|
675
|
+
case "selected":
|
|
676
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
677
|
+
case "active":
|
|
678
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r.hint ? import_picocolors2.default.dim(`(${r.hint})`) : ""}`;
|
|
679
|
+
case "cancelled":
|
|
680
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
681
|
+
default:
|
|
682
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
686
|
+
const r = `${import_picocolors2.default.gray(o)}
|
|
687
|
+
${b2(this.state)} ${t.message}
|
|
688
|
+
`;
|
|
689
|
+
switch (this.state) {
|
|
690
|
+
case "submit":
|
|
691
|
+
return `${r}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
692
|
+
case "cancel":
|
|
693
|
+
return `${r}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
694
|
+
${import_picocolors2.default.gray(o)}`;
|
|
695
|
+
default:
|
|
696
|
+
return `${r}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
697
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
698
|
+
${import_picocolors2.default.cyan(d2)}
|
|
699
|
+
`;
|
|
700
|
+
}
|
|
701
|
+
} }).prompt();
|
|
702
|
+
};
|
|
703
|
+
var Me = (t = "", n = "") => {
|
|
704
|
+
const r = `
|
|
705
|
+
${t}
|
|
706
|
+
`.split(`
|
|
707
|
+
`), i = S2(n).length, s = Math.max(r.reduce((a, l2) => {
|
|
708
|
+
const $2 = S2(l2);
|
|
709
|
+
return $2.length > a ? $2.length : a;
|
|
710
|
+
}, 0), i) + 2, c = r.map((a) => `${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors2.default.gray(o)}`).join(`
|
|
711
|
+
`);
|
|
712
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
713
|
+
${import_picocolors2.default.green(C2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
714
|
+
${c}
|
|
715
|
+
${import_picocolors2.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
716
|
+
`);
|
|
717
|
+
};
|
|
718
|
+
var Ie = (t = "") => {
|
|
719
|
+
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
720
|
+
`);
|
|
721
|
+
};
|
|
722
|
+
var Se = (t = "") => {
|
|
723
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
724
|
+
${import_picocolors2.default.gray(d2)} ${t}
|
|
725
|
+
|
|
726
|
+
`);
|
|
727
|
+
};
|
|
728
|
+
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
729
|
+
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
730
|
+
const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
731
|
+
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
732
|
+
const p2 = (m2) => {
|
|
733
|
+
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
734
|
+
a && N2(h2, m2);
|
|
735
|
+
}, v2 = () => p2(2), f = () => p2(1), j2 = () => {
|
|
736
|
+
process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
|
|
737
|
+
}, E = () => {
|
|
738
|
+
process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
|
|
739
|
+
}, B2 = () => {
|
|
740
|
+
if ($2 === undefined)
|
|
741
|
+
return;
|
|
742
|
+
i && process.stdout.write(`
|
|
743
|
+
`);
|
|
744
|
+
const m2 = $2.split(`
|
|
745
|
+
`);
|
|
746
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
|
|
747
|
+
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
|
|
748
|
+
const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
749
|
+
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
750
|
+
}, H = (m2 = "") => {
|
|
751
|
+
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
752
|
+
`);
|
|
753
|
+
let h2 = 0, w2 = 0;
|
|
754
|
+
j2(), c = setInterval(() => {
|
|
755
|
+
if (i && l2 === $2)
|
|
756
|
+
return;
|
|
757
|
+
B2(), $2 = l2;
|
|
758
|
+
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
759
|
+
if (i)
|
|
760
|
+
process.stdout.write(`${I2} ${l2}...`);
|
|
761
|
+
else if (t === "timer")
|
|
762
|
+
process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
763
|
+
else {
|
|
764
|
+
const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
765
|
+
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
766
|
+
}
|
|
767
|
+
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
768
|
+
}, r);
|
|
769
|
+
}, N2 = (m2 = "", h2 = 0) => {
|
|
770
|
+
a = false, clearInterval(c), B2();
|
|
771
|
+
const w2 = h2 === 0 ? import_picocolors2.default.green(C2) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
|
|
772
|
+
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
773
|
+
`) : process.stdout.write(`${w2} ${l2}
|
|
774
|
+
`), E(), s();
|
|
775
|
+
};
|
|
776
|
+
return { start: H, stop: N2, message: (m2 = "") => {
|
|
777
|
+
l2 = R2(m2 ?? l2);
|
|
778
|
+
} };
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
// src/commands/publish.ts
|
|
782
|
+
import { existsSync as existsSync2 } from "fs";
|
|
783
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
784
|
+
import { basename } from "path";
|
|
785
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
786
|
+
|
|
787
|
+
// src/utils/help.ts
|
|
788
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
789
|
+
function showHelp() {
|
|
790
|
+
console.log(`
|
|
791
|
+
${import_picocolors3.default.bold("Enact CLI")} ${import_picocolors3.default.dim("v0.1.0")}
|
|
792
|
+
${import_picocolors3.default.dim("A simple CLI tool to publish documents")}
|
|
793
|
+
|
|
794
|
+
${import_picocolors3.default.bold("Usage:")}
|
|
795
|
+
${import_picocolors3.default.cyan("enact")} ${import_picocolors3.default.green("<command>")} [options]
|
|
796
|
+
|
|
797
|
+
${import_picocolors3.default.bold("Commands:")}
|
|
798
|
+
${import_picocolors3.default.green("publish")} Publishes a document to a server
|
|
799
|
+
|
|
800
|
+
${import_picocolors3.default.bold("Options:")}
|
|
801
|
+
${import_picocolors3.default.yellow("--help, -h")} Show this help message
|
|
802
|
+
${import_picocolors3.default.yellow("--version, -v")} Show version information
|
|
803
|
+
|
|
804
|
+
${import_picocolors3.default.bold("Examples:")}
|
|
805
|
+
${import_picocolors3.default.cyan("enact")} ${import_picocolors3.default.green("publish")} document.md
|
|
806
|
+
${import_picocolors3.default.cyan("enact")} ${import_picocolors3.default.green("publish")} ${import_picocolors3.default.yellow("--url")} https://example.com/api document.md
|
|
807
|
+
`);
|
|
808
|
+
}
|
|
809
|
+
function showVersion() {
|
|
810
|
+
console.log(`enact-cli v0.1.0`);
|
|
811
|
+
}
|
|
812
|
+
function showPublishHelp() {
|
|
813
|
+
console.log(`
|
|
814
|
+
${import_picocolors3.default.bold("Usage:")} ${import_picocolors3.default.cyan("enact")} ${import_picocolors3.default.green("publish")} [options] [file]
|
|
815
|
+
|
|
816
|
+
${import_picocolors3.default.bold("Publishes a document to a server")}
|
|
817
|
+
|
|
818
|
+
${import_picocolors3.default.bold("Arguments:")}
|
|
819
|
+
${import_picocolors3.default.green("file")} The file to publish. If not provided, will prompt for a file.
|
|
820
|
+
|
|
821
|
+
${import_picocolors3.default.bold("Options:")}
|
|
822
|
+
${import_picocolors3.default.yellow("--help, -h")} Show this help message
|
|
823
|
+
${import_picocolors3.default.yellow("--url")} Specify the server URL to publish to
|
|
824
|
+
|
|
825
|
+
${import_picocolors3.default.bold("Examples:")}
|
|
826
|
+
${import_picocolors3.default.cyan("enact")} ${import_picocolors3.default.green("publish")} document.md
|
|
827
|
+
${import_picocolors3.default.cyan("enact")} ${import_picocolors3.default.green("publish")} ${import_picocolors3.default.yellow("--url")} https://example.com/api document.md
|
|
828
|
+
`);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// src/utils/config.ts
|
|
832
|
+
import { homedir } from "os";
|
|
833
|
+
import { join } from "path";
|
|
834
|
+
import { existsSync } from "fs";
|
|
835
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
836
|
+
var CONFIG_DIR = join(homedir(), ".enact");
|
|
837
|
+
var CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
838
|
+
async function ensureConfig() {
|
|
839
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
840
|
+
await mkdir(CONFIG_DIR, { recursive: true });
|
|
841
|
+
}
|
|
842
|
+
if (!existsSync(CONFIG_FILE)) {
|
|
843
|
+
await writeConfig({ history: [] });
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
async function readConfig() {
|
|
847
|
+
await ensureConfig();
|
|
848
|
+
try {
|
|
849
|
+
const data = await readFile(CONFIG_FILE, "utf8");
|
|
850
|
+
return JSON.parse(data);
|
|
851
|
+
} catch (error) {
|
|
852
|
+
console.error("Failed to read config:", error.message);
|
|
853
|
+
return { history: [] };
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
async function writeConfig(config) {
|
|
857
|
+
await ensureConfig();
|
|
858
|
+
await writeFile(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
859
|
+
}
|
|
860
|
+
async function addToHistory(filePath) {
|
|
861
|
+
const config = await readConfig();
|
|
862
|
+
if (!config.history) {
|
|
863
|
+
config.history = [];
|
|
864
|
+
}
|
|
865
|
+
if (!config.history.includes(filePath)) {
|
|
866
|
+
config.history.unshift(filePath);
|
|
867
|
+
config.history = config.history.slice(0, 10);
|
|
868
|
+
await writeConfig(config);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
async function getHistory() {
|
|
872
|
+
const config = await readConfig();
|
|
873
|
+
return config.history || [];
|
|
874
|
+
}
|
|
875
|
+
async function setDefaultUrl(url) {
|
|
876
|
+
const config = await readConfig();
|
|
877
|
+
config.defaultUrl = url;
|
|
878
|
+
await writeConfig(config);
|
|
879
|
+
}
|
|
880
|
+
async function getDefaultUrl() {
|
|
881
|
+
const config = await readConfig();
|
|
882
|
+
return config.defaultUrl;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// src/commands/publish.ts
|
|
886
|
+
async function handlePublishCommand(args, options) {
|
|
887
|
+
if (options.help) {
|
|
888
|
+
showPublishHelp();
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
Ie(import_picocolors4.default.bgBlue(import_picocolors4.default.white(" Publish Document ")));
|
|
892
|
+
let filePath = args[0];
|
|
893
|
+
if (!filePath) {
|
|
894
|
+
const history = await getHistory();
|
|
895
|
+
if (history.length > 0) {
|
|
896
|
+
const action = await ve({
|
|
897
|
+
message: "Select a file to publish:",
|
|
898
|
+
options: [
|
|
899
|
+
{ value: "select", label: "Choose from recent files" },
|
|
900
|
+
{ value: "new", label: "Specify a new file" }
|
|
901
|
+
]
|
|
902
|
+
});
|
|
903
|
+
if (action === "select") {
|
|
904
|
+
const fileOptions = history.filter((file) => existsSync2(file)).map((file) => ({
|
|
905
|
+
value: file,
|
|
906
|
+
label: file
|
|
907
|
+
}));
|
|
908
|
+
if (fileOptions.length > 0) {
|
|
909
|
+
filePath = await ve({
|
|
910
|
+
message: "Select a file:",
|
|
911
|
+
options: fileOptions
|
|
912
|
+
});
|
|
913
|
+
} else {
|
|
914
|
+
Me("No recent files found.", "History");
|
|
915
|
+
filePath = await he({
|
|
916
|
+
message: "Enter the path to the file:",
|
|
917
|
+
validate: validateFile
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
} else {
|
|
921
|
+
filePath = await he({
|
|
922
|
+
message: "Enter the path to the file:",
|
|
923
|
+
validate: validateFile
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
} else {
|
|
927
|
+
filePath = await he({
|
|
928
|
+
message: "Enter the path to the file:",
|
|
929
|
+
validate: validateFile
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
if (filePath === null) {
|
|
933
|
+
Se(import_picocolors4.default.yellow("Operation cancelled"));
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
} else {
|
|
937
|
+
if (!existsSync2(filePath)) {
|
|
938
|
+
Se(import_picocolors4.default.red(`Error: File not found: ${filePath}`));
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
let url = options.url;
|
|
943
|
+
if (!url) {
|
|
944
|
+
const defaultUrl = await getDefaultUrl();
|
|
945
|
+
if (defaultUrl) {
|
|
946
|
+
const useDefault = await ye({
|
|
947
|
+
message: `Use default URL (${defaultUrl})?`
|
|
948
|
+
});
|
|
949
|
+
if (useDefault === null) {
|
|
950
|
+
Se(import_picocolors4.default.yellow("Operation cancelled"));
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (useDefault) {
|
|
954
|
+
url = defaultUrl;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
if (!url) {
|
|
958
|
+
url = await he({
|
|
959
|
+
message: "Enter the server URL:",
|
|
960
|
+
placeholder: "https://example.com/api",
|
|
961
|
+
validate: (value) => {
|
|
962
|
+
if (!value)
|
|
963
|
+
return "URL is required";
|
|
964
|
+
if (!value.startsWith("http"))
|
|
965
|
+
return "URL must start with http:// or https://";
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
if (url === null) {
|
|
970
|
+
Se(import_picocolors4.default.yellow("Operation cancelled"));
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
const saveAsDefault = await ye({
|
|
974
|
+
message: "Save as default URL?"
|
|
975
|
+
});
|
|
976
|
+
if (saveAsDefault) {
|
|
977
|
+
await setDefaultUrl(url);
|
|
978
|
+
Me("URL saved as default.", "Config");
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
const shouldPublish = await ye({
|
|
983
|
+
message: `Publish ${import_picocolors4.default.cyan(basename(filePath))} to ${import_picocolors4.default.green(url)}?`
|
|
984
|
+
});
|
|
985
|
+
if (!shouldPublish) {
|
|
986
|
+
Se(import_picocolors4.default.yellow("Publish cancelled"));
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
const spinner = Y2();
|
|
990
|
+
spinner.start("Publishing document");
|
|
991
|
+
try {
|
|
992
|
+
const content = await readFile2(filePath, "utf8");
|
|
993
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
994
|
+
await addToHistory(filePath);
|
|
995
|
+
spinner.stop("Document published successfully");
|
|
996
|
+
Se(import_picocolors4.default.green(`✓ ${import_picocolors4.default.bold(basename(filePath))} published to ${import_picocolors4.default.bold(url)}`));
|
|
997
|
+
} catch (error) {
|
|
998
|
+
spinner.stop("Failed to publish document");
|
|
999
|
+
Me(error.message, "Error");
|
|
1000
|
+
Se(import_picocolors4.default.red("Publish failed"));
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function validateFile(value) {
|
|
1004
|
+
if (!value)
|
|
1005
|
+
return "File path is required";
|
|
1006
|
+
if (!existsSync2(value))
|
|
1007
|
+
return "File does not exist";
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// src/commands/remote.ts
|
|
1012
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
1013
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1014
|
+
import { join as join2 } from "path";
|
|
1015
|
+
import { homedir as homedir2 } from "os";
|
|
1016
|
+
var CONFIG_DIR2 = join2(homedir2(), ".enact");
|
|
1017
|
+
var CONFIG_FILE2 = join2(CONFIG_DIR2, "config.json");
|
|
1018
|
+
async function handleRemoteCommand(args, options) {
|
|
1019
|
+
if (options.help || !args[0]) {
|
|
1020
|
+
console.log(`
|
|
1021
|
+
Usage: enact remote <subcommand> [options]
|
|
1022
|
+
|
|
1023
|
+
Manages remote server configurations for publishing enact documents.
|
|
1024
|
+
|
|
1025
|
+
Subcommands:
|
|
1026
|
+
add <name> <url> Adds a new remote server.
|
|
1027
|
+
remove <name> Removes an existing remote server.
|
|
1028
|
+
list Lists all configured remote servers.
|
|
1029
|
+
ls Alias for list.
|
|
1030
|
+
|
|
1031
|
+
Options:
|
|
1032
|
+
--help, -h Show this help message
|
|
1033
|
+
`);
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
const subCommand = args[0];
|
|
1037
|
+
const subCommandArgs = args.slice(1);
|
|
1038
|
+
await ensureConfig2();
|
|
1039
|
+
Ie(import_picocolors5.default.bgMagenta(import_picocolors5.default.black(" Remote Server Management ")));
|
|
1040
|
+
switch (subCommand) {
|
|
1041
|
+
case "add": {
|
|
1042
|
+
let name = subCommandArgs[0];
|
|
1043
|
+
let url = subCommandArgs[1];
|
|
1044
|
+
if (!name) {
|
|
1045
|
+
name = await he({
|
|
1046
|
+
message: "Remote name:",
|
|
1047
|
+
placeholder: "production",
|
|
1048
|
+
validate(value) {
|
|
1049
|
+
if (!value)
|
|
1050
|
+
return "Name is required";
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
if (name === null) {
|
|
1054
|
+
Se(import_picocolors5.default.yellow("Operation cancelled"));
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
if (!url) {
|
|
1059
|
+
url = await he({
|
|
1060
|
+
message: "Remote URL:",
|
|
1061
|
+
placeholder: "https://api.example.com/publish",
|
|
1062
|
+
validate(value) {
|
|
1063
|
+
if (!value)
|
|
1064
|
+
return "URL is required";
|
|
1065
|
+
if (!value.startsWith("http"))
|
|
1066
|
+
return "URL must start with http:// or https://";
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
if (url === null) {
|
|
1070
|
+
Se(import_picocolors5.default.yellow("Operation cancelled"));
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
const config = await readConfig2();
|
|
1075
|
+
if (config.remotes[name]) {
|
|
1076
|
+
const overwrite = await ye({
|
|
1077
|
+
message: `Remote "${name}" already exists. Overwrite?`
|
|
1078
|
+
});
|
|
1079
|
+
if (!overwrite) {
|
|
1080
|
+
Se(import_picocolors5.default.yellow("Operation cancelled"));
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
const s = Y2();
|
|
1085
|
+
s.start(`Adding remote "${name}"`);
|
|
1086
|
+
config.remotes[name] = { url };
|
|
1087
|
+
await writeConfig2(config);
|
|
1088
|
+
s.stop(`Remote "${name}" added`);
|
|
1089
|
+
Se(import_picocolors5.default.green(`✓ Remote ${import_picocolors5.default.bold(name)} configured with URL ${import_picocolors5.default.bold(url)}`));
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
case "remove": {
|
|
1093
|
+
let name = subCommandArgs[0];
|
|
1094
|
+
const config = await readConfig2();
|
|
1095
|
+
if (!name) {
|
|
1096
|
+
if (Object.keys(config.remotes).length === 0) {
|
|
1097
|
+
Me("No remotes configured yet", "Info");
|
|
1098
|
+
Se("");
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
name = await ve({
|
|
1102
|
+
message: "Select remote to remove:",
|
|
1103
|
+
options: Object.keys(config.remotes).map((remoteName) => ({
|
|
1104
|
+
value: remoteName,
|
|
1105
|
+
label: `${remoteName} (${config.remotes[remoteName].url})`
|
|
1106
|
+
}))
|
|
1107
|
+
});
|
|
1108
|
+
if (name === null) {
|
|
1109
|
+
Se(import_picocolors5.default.yellow("Operation cancelled"));
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (!config.remotes[name]) {
|
|
1114
|
+
Se(import_picocolors5.default.red(`✗ Remote "${name}" does not exist`));
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
const shouldRemove = await ye({
|
|
1118
|
+
message: `Are you sure you want to remove remote "${name}"?`
|
|
1119
|
+
});
|
|
1120
|
+
if (!shouldRemove) {
|
|
1121
|
+
Se(import_picocolors5.default.yellow("Operation cancelled"));
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
const s = Y2();
|
|
1125
|
+
s.start(`Removing remote "${name}"`);
|
|
1126
|
+
delete config.remotes[name];
|
|
1127
|
+
await writeConfig2(config);
|
|
1128
|
+
s.stop(`Remote "${name}" removed`);
|
|
1129
|
+
Se(import_picocolors5.default.green(`✓ Remote ${import_picocolors5.default.bold(name)} has been removed`));
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
case "list":
|
|
1133
|
+
case "ls": {
|
|
1134
|
+
const config = await readConfig2();
|
|
1135
|
+
const remotes = Object.entries(config.remotes);
|
|
1136
|
+
if (remotes.length === 0) {
|
|
1137
|
+
Me("No remotes configured yet", "Info");
|
|
1138
|
+
Se("");
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
Me(remotes.map(([name, data]) => `${import_picocolors5.default.bold(name)}: ${data.url}`).join(`
|
|
1142
|
+
`), "Configured Remotes");
|
|
1143
|
+
Se("");
|
|
1144
|
+
break;
|
|
1145
|
+
}
|
|
1146
|
+
default:
|
|
1147
|
+
Se(import_picocolors5.default.red(`✗ Unknown remote subcommand "${subCommand}"`));
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
async function ensureConfig2() {
|
|
1152
|
+
if (!existsSync3(CONFIG_DIR2)) {
|
|
1153
|
+
await import("fs/promises").then((fs) => fs.mkdir(CONFIG_DIR2, { recursive: true }));
|
|
1154
|
+
}
|
|
1155
|
+
if (!existsSync3(CONFIG_FILE2)) {
|
|
1156
|
+
await writeConfig2({ remotes: {} });
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
async function readConfig2() {
|
|
1160
|
+
const text = await Bun.file(CONFIG_FILE2).text();
|
|
1161
|
+
try {
|
|
1162
|
+
return JSON.parse(text);
|
|
1163
|
+
} catch (e2) {
|
|
1164
|
+
return { remotes: {} };
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
async function writeConfig2(config) {
|
|
1168
|
+
await Bun.write(CONFIG_FILE2, JSON.stringify(config, null, 2));
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// src/index.ts
|
|
1172
|
+
var { values, positionals } = parseArgs({
|
|
1173
|
+
args: Bun.argv,
|
|
1174
|
+
options: {
|
|
1175
|
+
help: {
|
|
1176
|
+
type: "boolean",
|
|
1177
|
+
short: "h"
|
|
1178
|
+
},
|
|
1179
|
+
version: {
|
|
1180
|
+
type: "boolean",
|
|
1181
|
+
short: "v"
|
|
1182
|
+
},
|
|
1183
|
+
url: {
|
|
1184
|
+
type: "string"
|
|
1185
|
+
}
|
|
1186
|
+
},
|
|
1187
|
+
allowPositionals: true,
|
|
1188
|
+
strict: false
|
|
1189
|
+
});
|
|
1190
|
+
var command = positionals[2];
|
|
1191
|
+
var commandArgs = positionals.slice(3);
|
|
1192
|
+
if (values.version) {
|
|
1193
|
+
showVersion();
|
|
1194
|
+
process.exit(0);
|
|
1195
|
+
}
|
|
1196
|
+
if (values.help && !command) {
|
|
1197
|
+
showHelp();
|
|
1198
|
+
process.exit(0);
|
|
1199
|
+
}
|
|
1200
|
+
async function main() {
|
|
1201
|
+
try {
|
|
1202
|
+
switch (command) {
|
|
1203
|
+
case "publish":
|
|
1204
|
+
await handlePublishCommand(commandArgs, {
|
|
1205
|
+
help: values.help,
|
|
1206
|
+
url: values.url
|
|
1207
|
+
});
|
|
1208
|
+
break;
|
|
1209
|
+
case "remote":
|
|
1210
|
+
await handleRemoteCommand(commandArgs, {
|
|
1211
|
+
help: values.help
|
|
1212
|
+
});
|
|
1213
|
+
break;
|
|
1214
|
+
case undefined:
|
|
1215
|
+
if (values.help) {
|
|
1216
|
+
showHelp();
|
|
1217
|
+
} else {
|
|
1218
|
+
Ie(import_picocolors6.default.bgCyan(import_picocolors6.default.black(" Enact CLI ")));
|
|
1219
|
+
const action = await ve({
|
|
1220
|
+
message: "What would you like to do?",
|
|
1221
|
+
options: [
|
|
1222
|
+
{ value: "publish", label: "Publish a document" },
|
|
1223
|
+
{ value: "help", label: "Show help" },
|
|
1224
|
+
{ value: "exit", label: "Exit" }
|
|
1225
|
+
]
|
|
1226
|
+
});
|
|
1227
|
+
if (action === null || action === "exit") {
|
|
1228
|
+
Se("Goodbye!");
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
if (action === "help") {
|
|
1232
|
+
showHelp();
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
if (action === "publish") {
|
|
1236
|
+
await handlePublishCommand([], {});
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
break;
|
|
1240
|
+
default:
|
|
1241
|
+
console.error(import_picocolors6.default.red(`Unknown command: ${command}`));
|
|
1242
|
+
showHelp();
|
|
1243
|
+
process.exit(1);
|
|
1244
|
+
}
|
|
1245
|
+
} catch (error) {
|
|
1246
|
+
console.error(import_picocolors6.default.red(`Error: ${error.message}`));
|
|
1247
|
+
process.exit(1);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
main();
|