@dforge-core/dforge-cli 0.1.0-test.5 → 0.1.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/dist/cli.js ADDED
@@ -0,0 +1,1424 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esm = (fn, res) => function __init() {
10
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ };
12
+ var __commonJS = (cb, mod) => function __require() {
13
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
+ };
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
35
+
36
+ // node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
37
+ var require_src = __commonJS({
38
+ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports2, module2) {
39
+ "use strict";
40
+ var ESC = "\x1B";
41
+ var CSI = `${ESC}[`;
42
+ var beep = "\x07";
43
+ var cursor = {
44
+ to(x2, y3) {
45
+ if (!y3) return `${CSI}${x2 + 1}G`;
46
+ return `${CSI}${y3 + 1};${x2 + 1}H`;
47
+ },
48
+ move(x2, y3) {
49
+ let ret = "";
50
+ if (x2 < 0) ret += `${CSI}${-x2}D`;
51
+ else if (x2 > 0) ret += `${CSI}${x2}C`;
52
+ if (y3 < 0) ret += `${CSI}${-y3}A`;
53
+ else if (y3 > 0) ret += `${CSI}${y3}B`;
54
+ return ret;
55
+ },
56
+ up: (count = 1) => `${CSI}${count}A`,
57
+ down: (count = 1) => `${CSI}${count}B`,
58
+ forward: (count = 1) => `${CSI}${count}C`,
59
+ backward: (count = 1) => `${CSI}${count}D`,
60
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
61
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
62
+ left: `${CSI}G`,
63
+ hide: `${CSI}?25l`,
64
+ show: `${CSI}?25h`,
65
+ save: `${ESC}7`,
66
+ restore: `${ESC}8`
67
+ };
68
+ var scroll = {
69
+ up: (count = 1) => `${CSI}S`.repeat(count),
70
+ down: (count = 1) => `${CSI}T`.repeat(count)
71
+ };
72
+ var erase = {
73
+ screen: `${CSI}2J`,
74
+ up: (count = 1) => `${CSI}1J`.repeat(count),
75
+ down: (count = 1) => `${CSI}J`.repeat(count),
76
+ line: `${CSI}2K`,
77
+ lineEnd: `${CSI}K`,
78
+ lineStart: `${CSI}1K`,
79
+ lines(count) {
80
+ let clear = "";
81
+ for (let i = 0; i < count; i++)
82
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
83
+ if (count)
84
+ clear += cursor.left;
85
+ return clear;
86
+ }
87
+ };
88
+ module2.exports = { cursor, scroll, erase, beep };
89
+ }
90
+ });
91
+
92
+ // node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
93
+ var require_picocolors = __commonJS({
94
+ "node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports2, module2) {
95
+ "use strict";
96
+ var p2 = process || {};
97
+ var argv2 = p2.argv || [];
98
+ var env = p2.env || {};
99
+ var isColorSupported = !(!!env.NO_COLOR || argv2.includes("--no-color")) && (!!env.FORCE_COLOR || argv2.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
100
+ var formatter = (open, close, replace = open) => (input) => {
101
+ let string = "" + input, index = string.indexOf(close, open.length);
102
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
103
+ };
104
+ var replaceClose = (string, close, replace, index) => {
105
+ let result = "", cursor = 0;
106
+ do {
107
+ result += string.substring(cursor, index) + replace;
108
+ cursor = index + close.length;
109
+ index = string.indexOf(close, cursor);
110
+ } while (~index);
111
+ return result + string.substring(cursor);
112
+ };
113
+ var createColors = (enabled = isColorSupported) => {
114
+ let f = enabled ? formatter : () => String;
115
+ return {
116
+ isColorSupported: enabled,
117
+ reset: f("\x1B[0m", "\x1B[0m"),
118
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
119
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
120
+ italic: f("\x1B[3m", "\x1B[23m"),
121
+ underline: f("\x1B[4m", "\x1B[24m"),
122
+ inverse: f("\x1B[7m", "\x1B[27m"),
123
+ hidden: f("\x1B[8m", "\x1B[28m"),
124
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
125
+ black: f("\x1B[30m", "\x1B[39m"),
126
+ red: f("\x1B[31m", "\x1B[39m"),
127
+ green: f("\x1B[32m", "\x1B[39m"),
128
+ yellow: f("\x1B[33m", "\x1B[39m"),
129
+ blue: f("\x1B[34m", "\x1B[39m"),
130
+ magenta: f("\x1B[35m", "\x1B[39m"),
131
+ cyan: f("\x1B[36m", "\x1B[39m"),
132
+ white: f("\x1B[37m", "\x1B[39m"),
133
+ gray: f("\x1B[90m", "\x1B[39m"),
134
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
135
+ bgRed: f("\x1B[41m", "\x1B[49m"),
136
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
137
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
138
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
139
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
140
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
141
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
142
+ blackBright: f("\x1B[90m", "\x1B[39m"),
143
+ redBright: f("\x1B[91m", "\x1B[39m"),
144
+ greenBright: f("\x1B[92m", "\x1B[39m"),
145
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
146
+ blueBright: f("\x1B[94m", "\x1B[39m"),
147
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
148
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
149
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
150
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
151
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
152
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
153
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
154
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
155
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
156
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
157
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
158
+ };
159
+ };
160
+ module2.exports = createColors();
161
+ module2.exports.createColors = createColors;
162
+ }
163
+ });
164
+
165
+ // node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
166
+ function DD({ onlyFirst: e2 = false } = {}) {
167
+ 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("|");
168
+ return new RegExp(t, e2 ? void 0 : "g");
169
+ }
170
+ function P(e2) {
171
+ if (typeof e2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
172
+ return e2.replace(uD, "");
173
+ }
174
+ function L(e2) {
175
+ return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
176
+ }
177
+ function p(e2, u2 = {}) {
178
+ if (typeof e2 != "string" || e2.length === 0 || (u2 = { ambiguousIsNarrow: true, ...u2 }, e2 = P(e2), e2.length === 0)) return 0;
179
+ e2 = e2.replace(sD(), " ");
180
+ const t = u2.ambiguousIsNarrow ? 1 : 2;
181
+ let F2 = 0;
182
+ for (const s of e2) {
183
+ const i = s.codePointAt(0);
184
+ if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
185
+ switch (eD.eastAsianWidth(s)) {
186
+ case "F":
187
+ case "W":
188
+ F2 += 2;
189
+ break;
190
+ case "A":
191
+ F2 += t;
192
+ break;
193
+ default:
194
+ F2 += 1;
195
+ }
196
+ }
197
+ return F2;
198
+ }
199
+ function rD() {
200
+ const e2 = /* @__PURE__ */ new Map();
201
+ for (const [u2, t] of Object.entries(r)) {
202
+ for (const [F2, s] of Object.entries(t)) r[F2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F2] = r[F2], e2.set(s[0], s[1]);
203
+ Object.defineProperty(r, u2, { value: t, enumerable: false });
204
+ }
205
+ return Object.defineProperty(r, "codes", { value: e2, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u2, t, F2) => u2 === t && t === F2 ? u2 < 8 ? 16 : u2 > 248 ? 231 : Math.round((u2 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u2 / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u2) => {
206
+ const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u2.toString(16));
207
+ if (!t) return [0, 0, 0];
208
+ let [F2] = t;
209
+ F2.length === 3 && (F2 = [...F2].map((i) => i + i).join(""));
210
+ const s = Number.parseInt(F2, 16);
211
+ return [s >> 16 & 255, s >> 8 & 255, s & 255];
212
+ }, enumerable: false }, hexToAnsi256: { value: (u2) => r.rgbToAnsi256(...r.hexToRgb(u2)), enumerable: false }, ansi256ToAnsi: { value: (u2) => {
213
+ if (u2 < 8) return 30 + u2;
214
+ if (u2 < 16) return 90 + (u2 - 8);
215
+ let t, F2, s;
216
+ if (u2 >= 232) t = ((u2 - 232) * 10 + 8) / 255, F2 = t, s = t;
217
+ else {
218
+ u2 -= 16;
219
+ const C2 = u2 % 36;
220
+ t = Math.floor(u2 / 36) / 5, F2 = Math.floor(C2 / 6) / 5, s = C2 % 6 / 5;
221
+ }
222
+ const i = Math.max(t, F2, s) * 2;
223
+ if (i === 0) return 30;
224
+ let D2 = 30 + (Math.round(s) << 2 | Math.round(F2) << 1 | Math.round(t));
225
+ return i === 2 && (D2 += 60), D2;
226
+ }, enumerable: false }, rgbToAnsi: { value: (u2, t, F2) => r.ansi256ToAnsi(r.rgbToAnsi256(u2, t, F2)), enumerable: false }, hexToAnsi: { value: (u2) => r.ansi256ToAnsi(r.hexToAnsi256(u2)), enumerable: false } }), r;
227
+ }
228
+ function Y(e2, u2, t) {
229
+ return String(e2).normalize().replace(/\r\n/g, `
230
+ `).split(`
231
+ `).map((F2) => lD(F2, u2, t)).join(`
232
+ `);
233
+ }
234
+ function $(e2, u2) {
235
+ if (typeof e2 == "string") return B.aliases.get(e2) === u2;
236
+ for (const t of e2) if (t !== void 0 && $(t, u2)) return true;
237
+ return false;
238
+ }
239
+ function BD(e2, u2) {
240
+ if (e2 === u2) return;
241
+ const t = e2.split(`
242
+ `), F2 = u2.split(`
243
+ `), s = [];
244
+ for (let i = 0; i < Math.max(t.length, F2.length); i++) t[i] !== F2[i] && s.push(i);
245
+ return s;
246
+ }
247
+ function pD(e2) {
248
+ return e2 === S;
249
+ }
250
+ function m(e2, u2) {
251
+ const t = e2;
252
+ t.isTTY && t.setRawMode(u2);
253
+ }
254
+ function fD({ input: e2 = import_node_process.stdin, output: u2 = import_node_process.stdout, overwrite: t = true, hideCursor: F2 = true } = {}) {
255
+ const s = g.createInterface({ input: e2, output: u2, prompt: "", tabSize: 1 });
256
+ g.emitKeypressEvents(e2, s), e2.isTTY && e2.setRawMode(true);
257
+ const i = (D2, { name: C2, sequence: n }) => {
258
+ const E = String(D2);
259
+ if ($([E, C2, n], "cancel")) {
260
+ F2 && u2.write(import_sisteransi.cursor.show), process.exit(0);
261
+ return;
262
+ }
263
+ if (!t) return;
264
+ const a = C2 === "return" ? 0 : -1, o2 = C2 === "return" ? -1 : 0;
265
+ g.moveCursor(u2, a, o2, () => {
266
+ g.clearLine(u2, 1, () => {
267
+ e2.once("keypress", i);
268
+ });
269
+ });
270
+ };
271
+ return F2 && u2.write(import_sisteransi.cursor.hide), e2.once("keypress", i), () => {
272
+ e2.off("keypress", i), F2 && u2.write(import_sisteransi.cursor.show), e2.isTTY && !AD && e2.setRawMode(false), s.terminal = false, s.close();
273
+ };
274
+ }
275
+ var import_sisteransi, import_node_process, g, import_node_readline, import_node_stream, import_picocolors, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A, kD, $D, H, SD, OD, PD, J, LD, RD;
276
+ var init_dist = __esm({
277
+ "node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs"() {
278
+ "use strict";
279
+ import_sisteransi = __toESM(require_src(), 1);
280
+ import_node_process = require("process");
281
+ g = __toESM(require("readline"), 1);
282
+ import_node_readline = __toESM(require("readline"), 1);
283
+ import_node_stream = require("stream");
284
+ import_picocolors = __toESM(require_picocolors(), 1);
285
+ uD = DD();
286
+ W = { exports: {} };
287
+ (function(e2) {
288
+ var u2 = {};
289
+ e2.exports = u2, u2.eastAsianWidth = function(F2) {
290
+ var s = F2.charCodeAt(0), i = F2.length == 2 ? F2.charCodeAt(1) : 0, D2 = s;
291
+ return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D2 = s << 10 | i, D2 += 65536), D2 == 12288 || 65281 <= D2 && D2 <= 65376 || 65504 <= D2 && D2 <= 65510 ? "F" : D2 == 8361 || 65377 <= D2 && D2 <= 65470 || 65474 <= D2 && D2 <= 65479 || 65482 <= D2 && D2 <= 65487 || 65490 <= D2 && D2 <= 65495 || 65498 <= D2 && D2 <= 65500 || 65512 <= D2 && D2 <= 65518 ? "H" : 4352 <= D2 && D2 <= 4447 || 4515 <= D2 && D2 <= 4519 || 4602 <= D2 && D2 <= 4607 || 9001 <= D2 && D2 <= 9002 || 11904 <= D2 && D2 <= 11929 || 11931 <= D2 && D2 <= 12019 || 12032 <= D2 && D2 <= 12245 || 12272 <= D2 && D2 <= 12283 || 12289 <= D2 && D2 <= 12350 || 12353 <= D2 && D2 <= 12438 || 12441 <= D2 && D2 <= 12543 || 12549 <= D2 && D2 <= 12589 || 12593 <= D2 && D2 <= 12686 || 12688 <= D2 && D2 <= 12730 || 12736 <= D2 && D2 <= 12771 || 12784 <= D2 && D2 <= 12830 || 12832 <= D2 && D2 <= 12871 || 12880 <= D2 && D2 <= 13054 || 13056 <= D2 && D2 <= 19903 || 19968 <= D2 && D2 <= 42124 || 42128 <= D2 && D2 <= 42182 || 43360 <= D2 && D2 <= 43388 || 44032 <= D2 && D2 <= 55203 || 55216 <= D2 && D2 <= 55238 || 55243 <= D2 && D2 <= 55291 || 63744 <= D2 && D2 <= 64255 || 65040 <= D2 && D2 <= 65049 || 65072 <= D2 && D2 <= 65106 || 65108 <= D2 && D2 <= 65126 || 65128 <= D2 && D2 <= 65131 || 110592 <= D2 && D2 <= 110593 || 127488 <= D2 && D2 <= 127490 || 127504 <= D2 && D2 <= 127546 || 127552 <= D2 && D2 <= 127560 || 127568 <= D2 && D2 <= 127569 || 131072 <= D2 && D2 <= 194367 || 177984 <= D2 && D2 <= 196605 || 196608 <= D2 && D2 <= 262141 ? "W" : 32 <= D2 && D2 <= 126 || 162 <= D2 && D2 <= 163 || 165 <= D2 && D2 <= 166 || D2 == 172 || D2 == 175 || 10214 <= D2 && D2 <= 10221 || 10629 <= D2 && D2 <= 10630 ? "Na" : D2 == 161 || D2 == 164 || 167 <= D2 && D2 <= 168 || D2 == 170 || 173 <= D2 && D2 <= 174 || 176 <= D2 && D2 <= 180 || 182 <= D2 && D2 <= 186 || 188 <= D2 && D2 <= 191 || D2 == 198 || D2 == 208 || 215 <= D2 && D2 <= 216 || 222 <= D2 && D2 <= 225 || D2 == 230 || 232 <= D2 && D2 <= 234 || 236 <= D2 && D2 <= 237 || D2 == 240 || 242 <= D2 && D2 <= 243 || 247 <= D2 && D2 <= 250 || D2 == 252 || D2 == 254 || D2 == 257 || D2 == 273 || D2 == 275 || D2 == 283 || 294 <= D2 && D2 <= 295 || D2 == 299 || 305 <= D2 && D2 <= 307 || D2 == 312 || 319 <= D2 && D2 <= 322 || D2 == 324 || 328 <= D2 && D2 <= 331 || D2 == 333 || 338 <= D2 && D2 <= 339 || 358 <= D2 && D2 <= 359 || D2 == 363 || D2 == 462 || D2 == 464 || D2 == 466 || D2 == 468 || D2 == 470 || D2 == 472 || D2 == 474 || D2 == 476 || D2 == 593 || D2 == 609 || D2 == 708 || D2 == 711 || 713 <= D2 && D2 <= 715 || D2 == 717 || D2 == 720 || 728 <= D2 && D2 <= 731 || D2 == 733 || D2 == 735 || 768 <= D2 && D2 <= 879 || 913 <= D2 && D2 <= 929 || 931 <= D2 && D2 <= 937 || 945 <= D2 && D2 <= 961 || 963 <= D2 && D2 <= 969 || D2 == 1025 || 1040 <= D2 && D2 <= 1103 || D2 == 1105 || D2 == 8208 || 8211 <= D2 && D2 <= 8214 || 8216 <= D2 && D2 <= 8217 || 8220 <= D2 && D2 <= 8221 || 8224 <= D2 && D2 <= 8226 || 8228 <= D2 && D2 <= 8231 || D2 == 8240 || 8242 <= D2 && D2 <= 8243 || D2 == 8245 || D2 == 8251 || D2 == 8254 || D2 == 8308 || D2 == 8319 || 8321 <= D2 && D2 <= 8324 || D2 == 8364 || D2 == 8451 || D2 == 8453 || D2 == 8457 || D2 == 8467 || D2 == 8470 || 8481 <= D2 && D2 <= 8482 || D2 == 8486 || D2 == 8491 || 8531 <= D2 && D2 <= 8532 || 8539 <= D2 && D2 <= 8542 || 8544 <= D2 && D2 <= 8555 || 8560 <= D2 && D2 <= 8569 || D2 == 8585 || 8592 <= D2 && D2 <= 8601 || 8632 <= D2 && D2 <= 8633 || D2 == 8658 || D2 == 8660 || D2 == 8679 || D2 == 8704 || 8706 <= D2 && D2 <= 8707 || 8711 <= D2 && D2 <= 8712 || D2 == 8715 || D2 == 8719 || D2 == 8721 || D2 == 8725 || D2 == 8730 || 8733 <= D2 && D2 <= 8736 || D2 == 8739 || D2 == 8741 || 8743 <= D2 && D2 <= 8748 || D2 == 8750 || 8756 <= D2 && D2 <= 8759 || 8764 <= D2 && D2 <= 8765 || D2 == 8776 || D2 == 8780 || D2 == 8786 || 8800 <= D2 && D2 <= 8801 || 8804 <= D2 && D2 <= 8807 || 8810 <= D2 && D2 <= 8811 || 8814 <= D2 && D2 <= 8815 || 8834 <= D2 && D2 <= 8835 || 8838 <= D2 && D2 <= 8839 || D2 == 8853 || D2 == 8857 || D2 == 8869 || D2 == 8895 || D2 == 8978 || 9312 <= D2 && D2 <= 9449 || 9451 <= D2 && D2 <= 9547 || 9552 <= D2 && D2 <= 9587 || 9600 <= D2 && D2 <= 9615 || 9618 <= D2 && D2 <= 9621 || 9632 <= D2 && D2 <= 9633 || 9635 <= D2 && D2 <= 9641 || 9650 <= D2 && D2 <= 9651 || 9654 <= D2 && D2 <= 9655 || 9660 <= D2 && D2 <= 9661 || 9664 <= D2 && D2 <= 9665 || 9670 <= D2 && D2 <= 9672 || D2 == 9675 || 9678 <= D2 && D2 <= 9681 || 9698 <= D2 && D2 <= 9701 || D2 == 9711 || 9733 <= D2 && D2 <= 9734 || D2 == 9737 || 9742 <= D2 && D2 <= 9743 || 9748 <= D2 && D2 <= 9749 || D2 == 9756 || D2 == 9758 || D2 == 9792 || D2 == 9794 || 9824 <= D2 && D2 <= 9825 || 9827 <= D2 && D2 <= 9829 || 9831 <= D2 && D2 <= 9834 || 9836 <= D2 && D2 <= 9837 || D2 == 9839 || 9886 <= D2 && D2 <= 9887 || 9918 <= D2 && D2 <= 9919 || 9924 <= D2 && D2 <= 9933 || 9935 <= D2 && D2 <= 9953 || D2 == 9955 || 9960 <= D2 && D2 <= 9983 || D2 == 10045 || D2 == 10071 || 10102 <= D2 && D2 <= 10111 || 11093 <= D2 && D2 <= 11097 || 12872 <= D2 && D2 <= 12879 || 57344 <= D2 && D2 <= 63743 || 65024 <= D2 && D2 <= 65039 || D2 == 65533 || 127232 <= D2 && D2 <= 127242 || 127248 <= D2 && D2 <= 127277 || 127280 <= D2 && D2 <= 127337 || 127344 <= D2 && D2 <= 127386 || 917760 <= D2 && D2 <= 917999 || 983040 <= D2 && D2 <= 1048573 || 1048576 <= D2 && D2 <= 1114109 ? "A" : "N";
292
+ }, u2.characterLength = function(F2) {
293
+ var s = this.eastAsianWidth(F2);
294
+ return s == "F" || s == "W" || s == "A" ? 2 : 1;
295
+ };
296
+ function t(F2) {
297
+ return F2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
298
+ }
299
+ u2.length = function(F2) {
300
+ for (var s = t(F2), i = 0, D2 = 0; D2 < s.length; D2++) i = i + this.characterLength(s[D2]);
301
+ return i;
302
+ }, u2.slice = function(F2, s, i) {
303
+ textLen = u2.length(F2), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
304
+ for (var D2 = "", C2 = 0, n = t(F2), E = 0; E < n.length; E++) {
305
+ var a = n[E], o2 = u2.length(a);
306
+ if (C2 >= s - (o2 == 2 ? 1 : 0)) if (C2 + o2 <= i) D2 += a;
307
+ else break;
308
+ C2 += o2;
309
+ }
310
+ return D2;
311
+ };
312
+ })(W);
313
+ tD = W.exports;
314
+ eD = L(tD);
315
+ FD = function() {
316
+ 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;
317
+ };
318
+ sD = L(FD);
319
+ w = 10;
320
+ N = (e2 = 0) => (u2) => `\x1B[${u2 + e2}m`;
321
+ I = (e2 = 0) => (u2) => `\x1B[${38 + e2};5;${u2}m`;
322
+ R = (e2 = 0) => (u2, t, F2) => `\x1B[${38 + e2};2;${u2};${t};${F2}m`;
323
+ r = { 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] } };
324
+ Object.keys(r.modifier);
325
+ iD = Object.keys(r.color);
326
+ CD = Object.keys(r.bgColor);
327
+ [...iD, ...CD];
328
+ ED = rD();
329
+ d = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
330
+ oD = 39;
331
+ y = "\x07";
332
+ V = "[";
333
+ nD = "]";
334
+ G = "m";
335
+ _ = `${nD}8;;`;
336
+ z = (e2) => `${d.values().next().value}${V}${e2}${G}`;
337
+ K = (e2) => `${d.values().next().value}${_}${e2}${y}`;
338
+ aD = (e2) => e2.split(" ").map((u2) => p(u2));
339
+ k = (e2, u2, t) => {
340
+ const F2 = [...u2];
341
+ let s = false, i = false, D2 = p(P(e2[e2.length - 1]));
342
+ for (const [C2, n] of F2.entries()) {
343
+ const E = p(n);
344
+ if (D2 + E <= t ? e2[e2.length - 1] += n : (e2.push(n), D2 = 0), d.has(n) && (s = true, i = F2.slice(C2 + 1).join("").startsWith(_)), s) {
345
+ i ? n === y && (s = false, i = false) : n === G && (s = false);
346
+ continue;
347
+ }
348
+ D2 += E, D2 === t && C2 < F2.length - 1 && (e2.push(""), D2 = 0);
349
+ }
350
+ !D2 && e2[e2.length - 1].length > 0 && e2.length > 1 && (e2[e2.length - 2] += e2.pop());
351
+ };
352
+ hD = (e2) => {
353
+ const u2 = e2.split(" ");
354
+ let t = u2.length;
355
+ for (; t > 0 && !(p(u2[t - 1]) > 0); ) t--;
356
+ return t === u2.length ? e2 : u2.slice(0, t).join(" ") + u2.slice(t).join("");
357
+ };
358
+ lD = (e2, u2, t = {}) => {
359
+ if (t.trim !== false && e2.trim() === "") return "";
360
+ let F2 = "", s, i;
361
+ const D2 = aD(e2);
362
+ let C2 = [""];
363
+ for (const [E, a] of e2.split(" ").entries()) {
364
+ t.trim !== false && (C2[C2.length - 1] = C2[C2.length - 1].trimStart());
365
+ let o2 = p(C2[C2.length - 1]);
366
+ if (E !== 0 && (o2 >= u2 && (t.wordWrap === false || t.trim === false) && (C2.push(""), o2 = 0), (o2 > 0 || t.trim === false) && (C2[C2.length - 1] += " ", o2++)), t.hard && D2[E] > u2) {
367
+ const c = u2 - o2, f = 1 + Math.floor((D2[E] - c - 1) / u2);
368
+ Math.floor((D2[E] - 1) / u2) < f && C2.push(""), k(C2, a, u2);
369
+ continue;
370
+ }
371
+ if (o2 + D2[E] > u2 && o2 > 0 && D2[E] > 0) {
372
+ if (t.wordWrap === false && o2 < u2) {
373
+ k(C2, a, u2);
374
+ continue;
375
+ }
376
+ C2.push("");
377
+ }
378
+ if (o2 + D2[E] > u2 && t.wordWrap === false) {
379
+ k(C2, a, u2);
380
+ continue;
381
+ }
382
+ C2[C2.length - 1] += a;
383
+ }
384
+ t.trim !== false && (C2 = C2.map((E) => hD(E)));
385
+ const n = [...C2.join(`
386
+ `)];
387
+ for (const [E, a] of n.entries()) {
388
+ if (F2 += a, d.has(a)) {
389
+ const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
390
+ if (c.code !== void 0) {
391
+ const f = Number.parseFloat(c.code);
392
+ s = f === oD ? void 0 : f;
393
+ } else c.uri !== void 0 && (i = c.uri.length === 0 ? void 0 : c.uri);
394
+ }
395
+ const o2 = ED.codes.get(Number(s));
396
+ n[E + 1] === `
397
+ ` ? (i && (F2 += K("")), s && o2 && (F2 += z(o2))) : a === `
398
+ ` && (s && o2 && (F2 += z(s)), i && (F2 += K(i)));
399
+ }
400
+ return F2;
401
+ };
402
+ xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
403
+ B = { actions: new Set(xD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
404
+ AD = globalThis.process.platform.startsWith("win");
405
+ S = /* @__PURE__ */ Symbol("clack:cancel");
406
+ gD = Object.defineProperty;
407
+ vD = (e2, u2, t) => u2 in e2 ? gD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
408
+ h = (e2, u2, t) => (vD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
409
+ x = class {
410
+ constructor(u2, t = true) {
411
+ 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", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
412
+ const { input: F2 = import_node_process.stdin, output: s = import_node_process.stdout, render: i, signal: D2, ...C2 } = u2;
413
+ this.opts = C2, 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 = D2, this.input = F2, this.output = s;
414
+ }
415
+ unsubscribe() {
416
+ this._subscribers.clear();
417
+ }
418
+ setSubscriber(u2, t) {
419
+ const F2 = this._subscribers.get(u2) ?? [];
420
+ F2.push(t), this._subscribers.set(u2, F2);
421
+ }
422
+ on(u2, t) {
423
+ this.setSubscriber(u2, { cb: t });
424
+ }
425
+ once(u2, t) {
426
+ this.setSubscriber(u2, { cb: t, once: true });
427
+ }
428
+ emit(u2, ...t) {
429
+ const F2 = this._subscribers.get(u2) ?? [], s = [];
430
+ for (const i of F2) i.cb(...t), i.once && s.push(() => F2.splice(F2.indexOf(i), 1));
431
+ for (const i of s) i();
432
+ }
433
+ prompt() {
434
+ return new Promise((u2, t) => {
435
+ if (this._abortSignal) {
436
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u2(S);
437
+ this._abortSignal.addEventListener("abort", () => {
438
+ this.state = "cancel", this.close();
439
+ }, { once: true });
440
+ }
441
+ const F2 = new import_node_stream.Writable();
442
+ F2._write = (s, i, D2) => {
443
+ this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
444
+ }, this.input.pipe(F2), this.rl = import_node_readline.default.createInterface({ input: this.input, output: F2, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), import_node_readline.default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && 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", () => {
445
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(this.value);
446
+ }), this.once("cancel", () => {
447
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(S);
448
+ });
449
+ });
450
+ }
451
+ onKeypress(u2, t) {
452
+ 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)), u2 && (u2.toLowerCase() === "y" || u2.toLowerCase() === "n") && this.emit("confirm", u2.toLowerCase() === "y"), u2 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u2 && this.emit("key", u2.toLowerCase()), t?.name === "return") {
453
+ if (this.opts.validate) {
454
+ const F2 = this.opts.validate(this.value);
455
+ F2 && (this.error = F2 instanceof Error ? F2.message : F2, this.state = "error", this.rl?.write(this.value));
456
+ }
457
+ this.state !== "error" && (this.state = "submit");
458
+ }
459
+ $([u2, 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();
460
+ }
461
+ close() {
462
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
463
+ `), m(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
464
+ }
465
+ restoreCursor() {
466
+ const u2 = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
467
+ `).length - 1;
468
+ this.output.write(import_sisteransi.cursor.move(-999, u2 * -1));
469
+ }
470
+ render() {
471
+ const u2 = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
472
+ if (u2 !== this._prevFrame) {
473
+ if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
474
+ else {
475
+ const t = BD(this._prevFrame, u2);
476
+ if (this.restoreCursor(), t && t?.length === 1) {
477
+ const F2 = t[0];
478
+ this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.lines(1));
479
+ const s = u2.split(`
480
+ `);
481
+ this.output.write(s[F2]), this._prevFrame = u2, this.output.write(import_sisteransi.cursor.move(0, s.length - F2 - 1));
482
+ return;
483
+ }
484
+ if (t && t?.length > 1) {
485
+ const F2 = t[0];
486
+ this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.down());
487
+ const s = u2.split(`
488
+ `).slice(F2);
489
+ this.output.write(s.join(`
490
+ `)), this._prevFrame = u2;
491
+ return;
492
+ }
493
+ this.output.write(import_sisteransi.erase.down());
494
+ }
495
+ this.output.write(u2), this.state === "initial" && (this.state = "active"), this._prevFrame = u2;
496
+ }
497
+ }
498
+ };
499
+ dD = class extends x {
500
+ get cursor() {
501
+ return this.value ? 0 : 1;
502
+ }
503
+ get _value() {
504
+ return this.cursor === 0;
505
+ }
506
+ constructor(u2) {
507
+ super(u2, false), this.value = !!u2.initialValue, this.on("value", () => {
508
+ this.value = this._value;
509
+ }), this.on("confirm", (t) => {
510
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
511
+ }), this.on("cursor", () => {
512
+ this.value = !this.value;
513
+ });
514
+ }
515
+ };
516
+ A = /* @__PURE__ */ new WeakMap();
517
+ kD = Object.defineProperty;
518
+ $D = (e2, u2, t) => u2 in e2 ? kD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
519
+ H = (e2, u2, t) => ($D(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
520
+ SD = class extends x {
521
+ constructor(u2) {
522
+ super(u2, false), H(this, "options"), H(this, "cursor", 0), this.options = u2.options, this.value = [...u2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u2.cursorAt), 0), this.on("key", (t) => {
523
+ t === "a" && this.toggleAll();
524
+ }), this.on("cursor", (t) => {
525
+ switch (t) {
526
+ case "left":
527
+ case "up":
528
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
529
+ break;
530
+ case "down":
531
+ case "right":
532
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
533
+ break;
534
+ case "space":
535
+ this.toggleValue();
536
+ break;
537
+ }
538
+ });
539
+ }
540
+ get _value() {
541
+ return this.options[this.cursor].value;
542
+ }
543
+ toggleAll() {
544
+ const u2 = this.value.length === this.options.length;
545
+ this.value = u2 ? [] : this.options.map((t) => t.value);
546
+ }
547
+ toggleValue() {
548
+ const u2 = this.value.includes(this._value);
549
+ this.value = u2 ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
550
+ }
551
+ };
552
+ OD = Object.defineProperty;
553
+ PD = (e2, u2, t) => u2 in e2 ? OD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
554
+ J = (e2, u2, t) => (PD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
555
+ LD = class extends x {
556
+ constructor(u2) {
557
+ super(u2, false), J(this, "options"), J(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: t }) => t === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
558
+ switch (t) {
559
+ case "left":
560
+ case "up":
561
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
562
+ break;
563
+ case "down":
564
+ case "right":
565
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
566
+ break;
567
+ }
568
+ this.changeValue();
569
+ });
570
+ }
571
+ get _value() {
572
+ return this.options[this.cursor];
573
+ }
574
+ changeValue() {
575
+ this.value = this._value.value;
576
+ }
577
+ };
578
+ RD = class extends x {
579
+ get valueWithCursor() {
580
+ if (this.state === "submit") return this.value;
581
+ if (this.cursor >= this.value.length) return `${this.value}\u2588`;
582
+ const u2 = this.value.slice(0, this.cursor), [t, ...F2] = this.value.slice(this.cursor);
583
+ return `${u2}${import_picocolors.default.inverse(t)}${F2.join("")}`;
584
+ }
585
+ get cursor() {
586
+ return this._cursor;
587
+ }
588
+ constructor(u2) {
589
+ super(u2), this.on("finalize", () => {
590
+ this.value || (this.value = u2.defaultValue);
591
+ });
592
+ }
593
+ };
594
+ }
595
+ });
596
+
597
+ // node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
598
+ function ce() {
599
+ return import_node_process2.default.platform !== "win32" ? import_node_process2.default.env.TERM !== "linux" : !!import_node_process2.default.env.CI || !!import_node_process2.default.env.WT_SESSION || !!import_node_process2.default.env.TERMINUS_SUBLIME || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
600
+ }
601
+ var import_node_util, import_node_process2, import_picocolors2, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, he, ye, ve, fe, xe, Ie, Se, J2, Y2, Ce;
602
+ var init_dist2 = __esm({
603
+ "node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs"() {
604
+ "use strict";
605
+ import_node_util = require("util");
606
+ init_dist();
607
+ init_dist();
608
+ import_node_process2 = __toESM(require("process"), 1);
609
+ import_picocolors2 = __toESM(require_picocolors(), 1);
610
+ import_sisteransi2 = __toESM(require_src(), 1);
611
+ V2 = ce();
612
+ u = (t, n) => V2 ? t : n;
613
+ le = u("\u25C6", "*");
614
+ L2 = u("\u25A0", "x");
615
+ W2 = u("\u25B2", "x");
616
+ C = u("\u25C7", "o");
617
+ ue = u("\u250C", "T");
618
+ o = u("\u2502", "|");
619
+ d2 = u("\u2514", "\u2014");
620
+ k2 = u("\u25CF", ">");
621
+ P2 = u("\u25CB", " ");
622
+ A2 = u("\u25FB", "[\u2022]");
623
+ T = u("\u25FC", "[+]");
624
+ F = u("\u25FB", "[ ]");
625
+ $e = u("\u25AA", "\u2022");
626
+ _2 = u("\u2500", "-");
627
+ me = u("\u256E", "+");
628
+ de = u("\u251C", "+");
629
+ pe = u("\u256F", "+");
630
+ q = u("\u25CF", "\u2022");
631
+ D = u("\u25C6", "*");
632
+ U = u("\u25B2", "!");
633
+ K2 = u("\u25A0", "x");
634
+ b2 = (t) => {
635
+ switch (t) {
636
+ case "initial":
637
+ case "active":
638
+ return import_picocolors2.default.cyan(le);
639
+ case "cancel":
640
+ return import_picocolors2.default.red(L2);
641
+ case "error":
642
+ return import_picocolors2.default.yellow(W2);
643
+ case "submit":
644
+ return import_picocolors2.default.green(C);
645
+ }
646
+ };
647
+ G2 = (t) => {
648
+ const { cursor: n, options: r2, 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));
649
+ let l2 = 0;
650
+ n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
651
+ const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
652
+ return r2.slice(l2, l2 + a).map((p2, v2, f) => {
653
+ const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
654
+ return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
655
+ });
656
+ };
657
+ he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
658
+ const n = `${import_picocolors2.default.gray(o)}
659
+ ${b2(this.state)} ${t.message}
660
+ `, r2 = 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 : r2;
661
+ switch (this.state) {
662
+ case "error":
663
+ return `${n.trim()}
664
+ ${import_picocolors2.default.yellow(o)} ${i}
665
+ ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
666
+ `;
667
+ case "submit":
668
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
669
+ case "cancel":
670
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
671
+ ${import_picocolors2.default.gray(o)}` : ""}`;
672
+ default:
673
+ return `${n}${import_picocolors2.default.cyan(o)} ${i}
674
+ ${import_picocolors2.default.cyan(d2)}
675
+ `;
676
+ }
677
+ } }).prompt();
678
+ ye = (t) => {
679
+ const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
680
+ return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
681
+ const i = `${import_picocolors2.default.gray(o)}
682
+ ${b2(this.state)} ${t.message}
683
+ `, s = this.value ? n : r2;
684
+ switch (this.state) {
685
+ case "submit":
686
+ return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
687
+ case "cancel":
688
+ return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
689
+ ${import_picocolors2.default.gray(o)}`;
690
+ default:
691
+ 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(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
692
+ ${import_picocolors2.default.cyan(d2)}
693
+ `;
694
+ }
695
+ } }).prompt();
696
+ };
697
+ ve = (t) => {
698
+ const n = (r2, i) => {
699
+ const s = r2.label ?? String(r2.value);
700
+ switch (i) {
701
+ case "selected":
702
+ return `${import_picocolors2.default.dim(s)}`;
703
+ case "active":
704
+ return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
705
+ case "cancelled":
706
+ return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
707
+ default:
708
+ return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
709
+ }
710
+ };
711
+ return new LD({ options: t.options, initialValue: t.initialValue, render() {
712
+ const r2 = `${import_picocolors2.default.gray(o)}
713
+ ${b2(this.state)} ${t.message}
714
+ `;
715
+ switch (this.state) {
716
+ case "submit":
717
+ return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
718
+ case "cancel":
719
+ return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
720
+ ${import_picocolors2.default.gray(o)}`;
721
+ default:
722
+ return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
723
+ ${import_picocolors2.default.cyan(o)} `)}
724
+ ${import_picocolors2.default.cyan(d2)}
725
+ `;
726
+ }
727
+ } }).prompt();
728
+ };
729
+ fe = (t) => {
730
+ const n = (r2, i) => {
731
+ const s = r2.label ?? String(r2.value);
732
+ return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
733
+ };
734
+ return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
735
+ if (this.required && r2.length === 0) return `Please select at least one option.
736
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
737
+ }, render() {
738
+ const r2 = `${import_picocolors2.default.gray(o)}
739
+ ${b2(this.state)} ${t.message}
740
+ `, i = (s, c) => {
741
+ const a = this.value.includes(s.value);
742
+ return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
743
+ };
744
+ switch (this.state) {
745
+ case "submit":
746
+ return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
747
+ case "cancel": {
748
+ const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
749
+ return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
750
+ ${import_picocolors2.default.gray(o)}` : ""}`;
751
+ }
752
+ case "error": {
753
+ const s = this.error.split(`
754
+ `).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
755
+ `);
756
+ return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
757
+ ${import_picocolors2.default.yellow(o)} `)}
758
+ ${s}
759
+ `;
760
+ }
761
+ default:
762
+ return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
763
+ ${import_picocolors2.default.cyan(o)} `)}
764
+ ${import_picocolors2.default.cyan(d2)}
765
+ `;
766
+ }
767
+ } }).prompt();
768
+ };
769
+ xe = (t = "") => {
770
+ process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
771
+
772
+ `);
773
+ };
774
+ Ie = (t = "") => {
775
+ process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
776
+ `);
777
+ };
778
+ Se = (t = "") => {
779
+ process.stdout.write(`${import_picocolors2.default.gray(o)}
780
+ ${import_picocolors2.default.gray(d2)} ${t}
781
+
782
+ `);
783
+ };
784
+ J2 = `${import_picocolors2.default.gray(o)} `;
785
+ Y2 = ({ indicator: t = "dots" } = {}) => {
786
+ const n = V2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
787
+ let s, c, a = false, l2 = "", $2, g2 = performance.now();
788
+ const p2 = (m2) => {
789
+ const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
790
+ a && N2(h2, m2);
791
+ }, v2 = () => p2(2), f = () => p2(1), j2 = () => {
792
+ process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
793
+ }, E = () => {
794
+ process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
795
+ }, B2 = () => {
796
+ if ($2 === void 0) return;
797
+ i && process.stdout.write(`
798
+ `);
799
+ const m2 = $2.split(`
800
+ `);
801
+ process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
802
+ }, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
803
+ const h2 = (performance.now() - m2) / 1e3, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
804
+ return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
805
+ }, H2 = (m2 = "") => {
806
+ a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
807
+ `);
808
+ let h2 = 0, w2 = 0;
809
+ j2(), c = setInterval(() => {
810
+ if (i && l2 === $2) return;
811
+ B2(), $2 = l2;
812
+ const I2 = import_picocolors2.default.magenta(n[h2]);
813
+ if (i) process.stdout.write(`${I2} ${l2}...`);
814
+ else if (t === "timer") process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
815
+ else {
816
+ const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
817
+ process.stdout.write(`${I2} ${l2}${z2}`);
818
+ }
819
+ h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
820
+ }, r2);
821
+ }, N2 = (m2 = "", h2 = 0) => {
822
+ a = false, clearInterval(c), B2();
823
+ const w2 = h2 === 0 ? import_picocolors2.default.green(C) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
824
+ l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
825
+ `) : process.stdout.write(`${w2} ${l2}
826
+ `), E(), s();
827
+ };
828
+ return { start: H2, stop: N2, message: (m2 = "") => {
829
+ l2 = R2(m2 ?? l2);
830
+ } };
831
+ };
832
+ Ce = async (t, n) => {
833
+ const r2 = {}, i = Object.keys(t);
834
+ for (const s of i) {
835
+ const c = t[s], a = await c({ results: r2 })?.catch((l2) => {
836
+ throw l2;
837
+ });
838
+ if (typeof n?.onCancel == "function" && pD(a)) {
839
+ r2[s] = "canceled", n.onCancel({ results: r2 });
840
+ continue;
841
+ }
842
+ r2[s] = a;
843
+ }
844
+ return r2;
845
+ };
846
+ }
847
+ });
848
+
849
+ // src/init/prompts.ts
850
+ function validateCode(v2) {
851
+ if (!v2) return "Module code is required.";
852
+ if (!CODE_RE.test(v2)) {
853
+ return "Must match ^[a-z][a-z0-9_-]*$ (lowercase, digits, underscore, hyphen; first char a letter).";
854
+ }
855
+ }
856
+ function validateEntityName(v2) {
857
+ if (!v2) return "Entity name is required.";
858
+ if (!ENTITY_RE.test(v2)) {
859
+ return "Must match ^[a-z][a-z0-9_]*$ (lowercase, digits, underscore; first char a letter).";
860
+ }
861
+ }
862
+ function validateNonEmpty(v2) {
863
+ if (!v2 || !v2.trim()) return "Required.";
864
+ }
865
+ function validateSemver(v2) {
866
+ if (!v2) return "Required.";
867
+ if (!SEMVER_RE.test(v2)) {
868
+ return "Must be semver, e.g. 0.1.0 or 1.0.0-rc.1.";
869
+ }
870
+ }
871
+ function titlecase(code) {
872
+ return code.split(/[-_]/).filter(Boolean).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
873
+ }
874
+ var CODE_RE, ENTITY_RE, SEMVER_RE;
875
+ var init_prompts = __esm({
876
+ "src/init/prompts.ts"() {
877
+ "use strict";
878
+ CODE_RE = /^[a-z][a-z0-9_-]*$/;
879
+ ENTITY_RE = /^[a-z][a-z0-9_]*$/;
880
+ SEMVER_RE = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
881
+ }
882
+ });
883
+
884
+ // src/init/templates.ts
885
+ function buildManifest(opts, moduleId) {
886
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
887
+ const manifest = {
888
+ packageFormat: 1,
889
+ moduleId,
890
+ code: opts.code,
891
+ version: opts.version,
892
+ dbSchemaVersion: opts.dbSchemaVersion,
893
+ displayName: opts.displayName,
894
+ entities: Object.fromEntries(
895
+ opts.entities.map((e2) => [e2.name, `./entities/${e2.name}.json`])
896
+ ),
897
+ created: today,
898
+ updated: today
899
+ };
900
+ if (opts.description) manifest.description = opts.description;
901
+ if (opts.author) manifest.author = { name: opts.author };
902
+ if (opts.license) manifest.license = opts.license;
903
+ if (opts.dependencies.length > 0) {
904
+ manifest.dependencies = Object.fromEntries(
905
+ opts.dependencies.map((d3) => [d3, ">=0.0.1"])
906
+ );
907
+ }
908
+ return manifest;
909
+ }
910
+ function buildEntity(entity) {
911
+ const traits = entity.traits === "identity+audit" ? ["identity", "audit"] : ["identity"];
912
+ return {
913
+ description: entity.label,
914
+ dbObject: entity.name,
915
+ toString: "{id}",
916
+ traits,
917
+ fields: {}
918
+ };
919
+ }
920
+ function buildDataViews(entities) {
921
+ const views = {};
922
+ for (const e2 of entities) {
923
+ views[e2.name] = {
924
+ viewType: "grid",
925
+ label: e2.label,
926
+ dataSources: [
927
+ {
928
+ entityCode: e2.name,
929
+ columns: []
930
+ }
931
+ ]
932
+ };
933
+ }
934
+ return views;
935
+ }
936
+ function buildFolders(opts) {
937
+ return {
938
+ [opts.code]: {
939
+ label: opts.displayName,
940
+ description: opts.description || opts.displayName,
941
+ icon: "bi-folder",
942
+ color: "#2196F3",
943
+ entities: Object.fromEntries(
944
+ opts.entities.map((e2) => [
945
+ e2.name,
946
+ { viewName: e2.name, quickAdd: true }
947
+ ])
948
+ )
949
+ }
950
+ };
951
+ }
952
+ function buildMenus(opts) {
953
+ return {
954
+ [`${opts.code}_menu`]: {
955
+ label: opts.displayName,
956
+ items: Object.fromEntries(
957
+ opts.entities.map((e2, idx) => [
958
+ e2.name,
959
+ {
960
+ itemType: "V",
961
+ label: e2.label,
962
+ dataViewCode: e2.name,
963
+ orderNum: idx + 1,
964
+ icon: "table"
965
+ }
966
+ ])
967
+ )
968
+ }
969
+ };
970
+ }
971
+ function buildRoles(opts) {
972
+ const rights = {};
973
+ for (const e2 of opts.entities) rights[e2.name] = "SIUDC";
974
+ return {
975
+ [`${opts.code}.admin`]: {
976
+ description: `${opts.displayName} administrators`,
977
+ rights
978
+ }
979
+ };
980
+ }
981
+ function buildActions() {
982
+ return {};
983
+ }
984
+ function buildSettings() {
985
+ return {};
986
+ }
987
+ function buildTranslations(opts) {
988
+ const t = {};
989
+ t[`module.${opts.code}.label`] = opts.displayName;
990
+ if (opts.description) t[`module.${opts.code}.description`] = opts.description;
991
+ for (const e2 of opts.entities) {
992
+ t[`entity.${e2.name}.label`] = e2.label;
993
+ t[`view.${e2.name}.label`] = e2.label;
994
+ t[`menu.${e2.name}.label`] = e2.label;
995
+ }
996
+ return t;
997
+ }
998
+ function buildSeedData() {
999
+ return [];
1000
+ }
1001
+ function buildGitignore() {
1002
+ return [
1003
+ "# Built module package archives",
1004
+ "*.dforge",
1005
+ "",
1006
+ "# Editor / OS noise",
1007
+ "node_modules/",
1008
+ ".DS_Store",
1009
+ "*.swp",
1010
+ ""
1011
+ ].join("\n");
1012
+ }
1013
+ function buildVscodeSettings() {
1014
+ return {
1015
+ "json.schemas": SCHEMA_BINDINGS.map((b3) => ({
1016
+ fileMatch: b3.fileMatch,
1017
+ url: `${SCHEMA_BASE}/${b3.schema}.schema.json`
1018
+ }))
1019
+ };
1020
+ }
1021
+ function buildZedSettings() {
1022
+ return {
1023
+ languages: {
1024
+ JSON: {
1025
+ "json.schemas": SCHEMA_BINDINGS.map((b3) => ({
1026
+ fileMatch: b3.fileMatch,
1027
+ url: `${SCHEMA_BASE}/${b3.schema}.schema.json`
1028
+ }))
1029
+ }
1030
+ }
1031
+ };
1032
+ }
1033
+ var SCHEMA_BASE, SCHEMA_BINDINGS;
1034
+ var init_templates = __esm({
1035
+ "src/init/templates.ts"() {
1036
+ "use strict";
1037
+ SCHEMA_BASE = "https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas";
1038
+ SCHEMA_BINDINGS = [
1039
+ { fileMatch: ["manifest.json"], schema: "manifest" },
1040
+ { fileMatch: ["entities/*.json"], schema: "entity" },
1041
+ { fileMatch: ["ui/data_views.json"], schema: "data-views" },
1042
+ { fileMatch: ["ui/folders.json"], schema: "folders" },
1043
+ { fileMatch: ["ui/menus.json"], schema: "menus" },
1044
+ { fileMatch: ["ui/reports.json"], schema: "reports" },
1045
+ { fileMatch: ["security/roles.json"], schema: "roles" },
1046
+ { fileMatch: ["logic/jobs.json"], schema: "jobs" },
1047
+ { fileMatch: ["seed-data/*.json"], schema: "seed-data" },
1048
+ { fileMatch: ["settings.json"], schema: "settings" }
1049
+ ];
1050
+ }
1051
+ });
1052
+
1053
+ // src/init/module.ts
1054
+ async function runInitModule(argv2) {
1055
+ const rawPath = argv2[0];
1056
+ if (!rawPath) {
1057
+ console.error("Usage: dforge-cli init module <path>");
1058
+ return 2;
1059
+ }
1060
+ const absPath = path2.resolve(rawPath);
1061
+ if (fs2.existsSync(absPath)) {
1062
+ const stat = fs2.statSync(absPath);
1063
+ if (!stat.isDirectory()) {
1064
+ console.error(`dforge-cli: ${absPath} exists and is not a directory.`);
1065
+ return 1;
1066
+ }
1067
+ if (fs2.readdirSync(absPath).length > 0) {
1068
+ console.error(`dforge-cli: ${absPath} exists and is not empty.`);
1069
+ return 1;
1070
+ }
1071
+ }
1072
+ Ie("dforge-cli init module");
1073
+ const opts = await collectOpts(absPath);
1074
+ if (opts === null) {
1075
+ xe("Aborted.");
1076
+ return CANCEL_EXIT;
1077
+ }
1078
+ const s = Y2();
1079
+ s.start("Writing files");
1080
+ try {
1081
+ writeAll(opts);
1082
+ s.stop("Files written.");
1083
+ } catch (err) {
1084
+ s.stop("Write failed.");
1085
+ console.error(err.message);
1086
+ return 1;
1087
+ }
1088
+ Se(`Created module ${opts.code} at ${opts.path}`);
1089
+ console.log("");
1090
+ console.log("Next steps:");
1091
+ console.log(` cd ${path2.relative(process.cwd(), opts.path) || "."}`);
1092
+ console.log(` dforge-cli module install --path . --code <tenant>`);
1093
+ return 0;
1094
+ }
1095
+ async function collectOpts(absPath) {
1096
+ const gitName = tryGitUserName();
1097
+ const meta = await Ce(
1098
+ {
1099
+ code: () => he({
1100
+ message: "Module code (e.g. crm, hr-admin)",
1101
+ placeholder: "my-module",
1102
+ validate: validateCode
1103
+ }),
1104
+ displayName: ({ results }) => he({
1105
+ message: "Display name",
1106
+ initialValue: titlecase(results.code),
1107
+ validate: validateNonEmpty
1108
+ }),
1109
+ description: () => he({
1110
+ message: "Description (optional)",
1111
+ placeholder: "(empty)"
1112
+ }),
1113
+ author: () => he({
1114
+ message: "Author name (optional)",
1115
+ initialValue: gitName ?? ""
1116
+ }),
1117
+ license: () => he({
1118
+ message: "License",
1119
+ initialValue: "MIT"
1120
+ }),
1121
+ version: () => he({
1122
+ message: "Initial version",
1123
+ initialValue: "0.1.0",
1124
+ validate: validateSemver
1125
+ }),
1126
+ dbSchemaVersion: () => he({
1127
+ message: "Initial DB schema version",
1128
+ initialValue: "0.0.1",
1129
+ validate: validateSemver
1130
+ }),
1131
+ dependencies: () => fe({
1132
+ message: "Depend on system modules (space to toggle)",
1133
+ options: [
1134
+ { value: "admin", label: "admin (required for most modules)" },
1135
+ { value: "metadata", label: "metadata (required for most modules)" }
1136
+ ],
1137
+ initialValues: ["admin", "metadata"],
1138
+ required: false
1139
+ }),
1140
+ preset: () => ve({
1141
+ message: "Scaffold preset",
1142
+ options: [
1143
+ {
1144
+ value: "minimal",
1145
+ label: "Minimal",
1146
+ hint: "manifest + one entity + minimal UI/security"
1147
+ },
1148
+ {
1149
+ value: "minimal-plus",
1150
+ label: "Minimal + add more entities interactively",
1151
+ hint: "loop to add multiple entities now"
1152
+ },
1153
+ {
1154
+ value: "full",
1155
+ label: "Full template",
1156
+ hint: "+ settings, translations, seed-data, logic/actions"
1157
+ }
1158
+ ],
1159
+ initialValue: "minimal"
1160
+ })
1161
+ },
1162
+ { onCancel: () => process.exit(CANCEL_EXIT) }
1163
+ );
1164
+ const firstEntity = await promptEntity("First entity name");
1165
+ if (firstEntity === null) return null;
1166
+ const entities = [firstEntity];
1167
+ if (meta.preset === "minimal-plus") {
1168
+ while (true) {
1169
+ const more = await ye({
1170
+ message: "Add another entity?",
1171
+ initialValue: false
1172
+ });
1173
+ if (pD(more)) return null;
1174
+ if (!more) break;
1175
+ const next = await promptEntity("Entity name");
1176
+ if (next === null) return null;
1177
+ entities.push(next);
1178
+ }
1179
+ }
1180
+ return {
1181
+ path: absPath,
1182
+ code: meta.code,
1183
+ displayName: meta.displayName,
1184
+ description: meta.description ?? "",
1185
+ author: meta.author ?? "",
1186
+ license: meta.license ?? "MIT",
1187
+ version: meta.version,
1188
+ dbSchemaVersion: meta.dbSchemaVersion,
1189
+ dependencies: meta.dependencies ?? [],
1190
+ preset: meta.preset,
1191
+ entities
1192
+ };
1193
+ }
1194
+ async function promptEntity(message) {
1195
+ const grp = await Ce(
1196
+ {
1197
+ name: () => he({
1198
+ message,
1199
+ placeholder: "thing",
1200
+ validate: validateEntityName
1201
+ }),
1202
+ label: ({ results }) => he({
1203
+ message: "Entity label",
1204
+ initialValue: titlecase(results.name),
1205
+ validate: validateNonEmpty
1206
+ }),
1207
+ traits: () => ve({
1208
+ message: "Built-in traits",
1209
+ options: [
1210
+ {
1211
+ value: "identity+audit",
1212
+ label: "identity + audit",
1213
+ hint: "PK + created/updated timestamps + created_by/updated_by (recommended)"
1214
+ },
1215
+ {
1216
+ value: "identity",
1217
+ label: "identity only",
1218
+ hint: "PK only"
1219
+ }
1220
+ ],
1221
+ initialValue: "identity+audit"
1222
+ })
1223
+ },
1224
+ { onCancel: () => process.exit(CANCEL_EXIT) }
1225
+ );
1226
+ return {
1227
+ name: grp.name,
1228
+ label: grp.label,
1229
+ traits: grp.traits
1230
+ };
1231
+ }
1232
+ function writeAll(opts) {
1233
+ const moduleId = (0, import_node_crypto.randomUUID)();
1234
+ const root = opts.path;
1235
+ fs2.mkdirSync(root, { recursive: true });
1236
+ writeJson(path2.join(root, "manifest.json"), buildManifest(opts, moduleId));
1237
+ for (const e2 of opts.entities) {
1238
+ writeJson(path2.join(root, "entities", `${e2.name}.json`), buildEntity(e2));
1239
+ }
1240
+ writeJson(path2.join(root, "ui", "data_views.json"), buildDataViews(opts.entities));
1241
+ writeJson(path2.join(root, "ui", "folders.json"), buildFolders(opts));
1242
+ writeJson(path2.join(root, "ui", "menus.json"), buildMenus(opts));
1243
+ writeJson(path2.join(root, "ui", "actions.json"), buildActions());
1244
+ writeJson(path2.join(root, "security", "roles.json"), buildRoles(opts));
1245
+ writeText(path2.join(root, ".gitignore"), buildGitignore());
1246
+ writeJson(path2.join(root, ".vscode", "settings.json"), buildVscodeSettings());
1247
+ writeJson(path2.join(root, ".zed", "settings.json"), buildZedSettings());
1248
+ if (opts.preset === "full") {
1249
+ writeJson(path2.join(root, "settings.json"), buildSettings());
1250
+ writeJson(path2.join(root, "translations", "en-US.json"), buildTranslations(opts));
1251
+ for (const e2 of opts.entities) {
1252
+ writeJson(
1253
+ path2.join(root, "seed-data", `01-${e2.name}.json`),
1254
+ buildSeedData()
1255
+ );
1256
+ }
1257
+ ensureDir(path2.join(root, "logic", "actions"));
1258
+ writeText(path2.join(root, "logic", "actions", ".gitkeep"), "");
1259
+ }
1260
+ }
1261
+ function writeJson(file, obj) {
1262
+ ensureDir(path2.dirname(file));
1263
+ fs2.writeFileSync(file, JSON.stringify(obj, null, " ") + "\n", "utf8");
1264
+ }
1265
+ function writeText(file, content) {
1266
+ ensureDir(path2.dirname(file));
1267
+ fs2.writeFileSync(file, content, "utf8");
1268
+ }
1269
+ function ensureDir(dir) {
1270
+ fs2.mkdirSync(dir, { recursive: true });
1271
+ }
1272
+ function tryGitUserName() {
1273
+ try {
1274
+ const out = (0, import_node_child_process2.execSync)("git config user.name", {
1275
+ encoding: "utf8",
1276
+ stdio: ["ignore", "pipe", "ignore"]
1277
+ }).trim();
1278
+ return out || void 0;
1279
+ } catch {
1280
+ return void 0;
1281
+ }
1282
+ }
1283
+ var fs2, path2, import_node_child_process2, import_node_crypto, CANCEL_EXIT;
1284
+ var init_module = __esm({
1285
+ "src/init/module.ts"() {
1286
+ "use strict";
1287
+ init_dist2();
1288
+ fs2 = __toESM(require("fs"));
1289
+ path2 = __toESM(require("path"));
1290
+ import_node_child_process2 = require("child_process");
1291
+ import_node_crypto = require("crypto");
1292
+ init_prompts();
1293
+ init_templates();
1294
+ CANCEL_EXIT = 130;
1295
+ }
1296
+ });
1297
+
1298
+ // src/init/index.ts
1299
+ var init_exports = {};
1300
+ __export(init_exports, {
1301
+ runInit: () => runInit
1302
+ });
1303
+ async function runInit(argv2) {
1304
+ const sub = argv2[0];
1305
+ switch (sub) {
1306
+ case "module":
1307
+ return runInitModule(argv2.slice(1));
1308
+ case void 0:
1309
+ case "--help":
1310
+ case "-h":
1311
+ printHelp();
1312
+ return sub === void 0 ? 2 : 0;
1313
+ default:
1314
+ console.error(`dforge-cli init: unknown subcommand "${sub}"`);
1315
+ printHelp();
1316
+ return 2;
1317
+ }
1318
+ }
1319
+ function printHelp() {
1320
+ console.log("Usage: dforge-cli init <subcommand>");
1321
+ console.log("");
1322
+ console.log("Subcommands:");
1323
+ console.log(" module <path> Scaffold a new dForge module (interactive)");
1324
+ }
1325
+ var init_init = __esm({
1326
+ "src/init/index.ts"() {
1327
+ "use strict";
1328
+ init_module();
1329
+ }
1330
+ });
1331
+
1332
+ // src/native.ts
1333
+ var import_node_child_process = require("child_process");
1334
+ var path = __toESM(require("path"));
1335
+ var fs = __toESM(require("fs"));
1336
+ var platformMap = {
1337
+ "darwin-arm64": "@dforge-core/dforge-cli-darwin-arm64",
1338
+ "darwin-x64": "@dforge-core/dforge-cli-darwin-x64",
1339
+ "linux-x64": "@dforge-core/dforge-cli-linux-x64",
1340
+ "linux-arm64": "@dforge-core/dforge-cli-linux-arm64",
1341
+ "win32-x64": "@dforge-core/dforge-cli-win32-x64",
1342
+ "win32-arm64": "@dforge-core/dforge-cli-win32-arm64"
1343
+ };
1344
+ function resolveBinary() {
1345
+ const override = process.env.DFORGE_CLI_BINARY;
1346
+ if (override) {
1347
+ if (!fs.existsSync(override)) {
1348
+ console.error(
1349
+ `dforge-cli: DFORGE_CLI_BINARY points at non-existent path: ${override}`
1350
+ );
1351
+ process.exit(1);
1352
+ }
1353
+ return override;
1354
+ }
1355
+ const key = `${process.platform}-${process.arch}`;
1356
+ const pkg = platformMap[key];
1357
+ if (!pkg) {
1358
+ console.error(
1359
+ `dforge-cli: unsupported platform "${key}". Supported: ${Object.keys(platformMap).join(", ")}.`
1360
+ );
1361
+ process.exit(1);
1362
+ }
1363
+ let pkgJsonPath;
1364
+ try {
1365
+ pkgJsonPath = require.resolve(`${pkg}/package.json`);
1366
+ } catch {
1367
+ const shortName = pkg.split("/").pop();
1368
+ const siblingPkgJson = path.join(
1369
+ __dirname,
1370
+ "..",
1371
+ "packages",
1372
+ shortName,
1373
+ "package.json"
1374
+ );
1375
+ if (fs.existsSync(siblingPkgJson)) {
1376
+ pkgJsonPath = siblingPkgJson;
1377
+ } else {
1378
+ console.error(
1379
+ `dforge-cli: platform package "${pkg}" not installed. Re-run \`npm install\` without --no-optional, or install it explicitly.`
1380
+ );
1381
+ process.exit(1);
1382
+ }
1383
+ }
1384
+ const pkgDir = path.dirname(pkgJsonPath);
1385
+ const binName = process.platform === "win32" ? "dforge-cli.exe" : "dforge-cli";
1386
+ const binPath = path.join(pkgDir, "bin", binName);
1387
+ if (!fs.existsSync(binPath)) {
1388
+ console.error(`dforge-cli: binary missing at ${binPath}`);
1389
+ process.exit(1);
1390
+ }
1391
+ if (process.platform !== "win32") {
1392
+ try {
1393
+ const mode = fs.statSync(binPath).mode;
1394
+ if ((mode & 73) === 0) fs.chmodSync(binPath, mode | 493);
1395
+ } catch {
1396
+ }
1397
+ }
1398
+ return binPath;
1399
+ }
1400
+ function spawnNative(argv2) {
1401
+ const result = (0, import_node_child_process.spawnSync)(resolveBinary(), argv2, {
1402
+ stdio: "inherit",
1403
+ shell: false
1404
+ });
1405
+ if (result.error) {
1406
+ console.error(`dforge-cli: failed to exec binary: ${result.error.message}`);
1407
+ process.exit(1);
1408
+ }
1409
+ process.exit(result.status ?? 1);
1410
+ }
1411
+
1412
+ // src/cli.ts
1413
+ var argv = process.argv.slice(2);
1414
+ if (argv[0] === "init") {
1415
+ Promise.resolve().then(() => (init_init(), init_exports)).then(({ runInit: runInit2 }) => runInit2(argv.slice(1))).then(
1416
+ (code) => process.exit(code ?? 0),
1417
+ (err) => {
1418
+ console.error(err.message ?? err);
1419
+ process.exit(1);
1420
+ }
1421
+ );
1422
+ } else {
1423
+ spawnNative(argv);
1424
+ }