create-rsbuild 1.0.0 → 1.0.1-beta.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.
Files changed (72) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +1267 -67
  3. package/package.json +13 -6
  4. package/template-biome/biome.json +25 -0
  5. package/template-biome/package.json +12 -0
  6. package/template-eslint/common-js/eslint.config.mjs +8 -0
  7. package/template-eslint/common-js/package.json +13 -0
  8. package/template-eslint/common-ts/eslint.config.mjs +10 -0
  9. package/template-eslint/common-ts/package.json +14 -0
  10. package/template-eslint/react-js/eslint.config.mjs +29 -0
  11. package/template-eslint/react-js/package.json +16 -0
  12. package/template-eslint/react-ts/eslint.config.mjs +31 -0
  13. package/template-eslint/react-ts/package.json +17 -0
  14. package/template-eslint/svelte-js/eslint.config.mjs +20 -0
  15. package/template-eslint/svelte-js/package.json +14 -0
  16. package/template-eslint/svelte-ts/eslint.config.mjs +28 -0
  17. package/template-eslint/svelte-ts/package.json +16 -0
  18. package/template-eslint/vue-js/eslint.config.mjs +10 -0
  19. package/template-eslint/vue-js/package.json +14 -0
  20. package/template-eslint/vue-ts/eslint.config.mjs +12 -0
  21. package/template-eslint/vue-ts/package.json +15 -0
  22. package/template-lit-js/package.json +1 -1
  23. package/template-lit-ts/package.json +2 -2
  24. package/template-lit-ts/tsconfig.json +4 -1
  25. package/template-preact-js/package.json +17 -0
  26. package/template-preact-js/rsbuild.config.mjs +6 -0
  27. package/template-preact-js/src/App.css +26 -0
  28. package/template-preact-js/src/App.jsx +12 -0
  29. package/template-preact-js/src/index.jsx +4 -0
  30. package/template-preact-ts/package.json +18 -0
  31. package/template-preact-ts/rsbuild.config.ts +6 -0
  32. package/template-preact-ts/src/App.css +26 -0
  33. package/template-preact-ts/src/App.tsx +12 -0
  34. package/template-preact-ts/src/index.tsx +7 -0
  35. package/template-preact-ts/tsconfig.json +22 -0
  36. package/template-prettier/.prettierignore +4 -0
  37. package/template-prettier/.prettierrc +3 -0
  38. package/template-prettier/package.json +11 -0
  39. package/template-react-js/package.json +2 -2
  40. package/template-react-ts/package.json +5 -5
  41. package/template-react-ts/src/index.tsx +9 -6
  42. package/template-react-ts/tsconfig.json +4 -1
  43. package/template-solid-js/package.json +1 -1
  44. package/template-solid-js/rsbuild.config.mjs +6 -1
  45. package/template-solid-js/src/index.jsx +1 -1
  46. package/template-solid-ts/package.json +2 -2
  47. package/template-solid-ts/rsbuild.config.ts +6 -1
  48. package/template-solid-ts/src/index.tsx +4 -1
  49. package/template-solid-ts/tsconfig.json +4 -1
  50. package/template-svelte-js/package.json +1 -1
  51. package/template-svelte-js/src/index.js +1 -4
  52. package/template-svelte-ts/package.json +5 -3
  53. package/template-svelte-ts/src/index.ts +1 -4
  54. package/template-svelte-ts/tsconfig.json +7 -1
  55. package/template-vanilla-ts/package.json +1 -1
  56. package/template-vanilla-ts/tsconfig.json +4 -1
  57. package/template-vue2-js/src/index.js +1 -1
  58. package/template-vue2-ts/package.json +1 -1
  59. package/template-vue2-ts/src/index.ts +1 -1
  60. package/template-vue2-ts/tsconfig.json +5 -1
  61. package/template-vue3-js/.vscode/extensions.json +3 -0
  62. package/template-vue3-js/package.json +1 -1
  63. package/template-vue3-js/src/index.js +1 -1
  64. package/template-vue3-ts/.vscode/extensions.json +3 -0
  65. package/template-vue3-ts/package.json +2 -2
  66. package/template-vue3-ts/src/env.d.ts +1 -0
  67. package/template-vue3-ts/src/index.ts +1 -1
  68. package/template-vue3-ts/tsconfig.json +6 -1
  69. package/CHANGELOG.md +0 -86
  70. package/dist/index.d.ts +0 -2
  71. package/modern.config.ts +0 -3
  72. package/tsconfig.json +0 -8
package/dist/index.js CHANGED
@@ -1,11 +1,26 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
2
+ import { createRequire } from 'module';
3
+ var require = createRequire(import.meta['url']);
4
+
3
5
  var __create = Object.create;
4
6
  var __defProp = Object.defineProperty;
5
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
8
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
9
  var __getProtoOf = Object.getPrototypeOf;
8
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __require = /* @__PURE__ */ ((x3) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x3, {
12
+ get: (a3, b3) => (typeof require !== "undefined" ? require : a3)[b3]
13
+ }) : x3)(function(x3) {
14
+ if (typeof require !== "undefined")
15
+ return require.apply(this, arguments);
16
+ throw Error('Dynamic require of "' + x3 + '" is not supported');
17
+ });
18
+ var __esm = (fn, res) => function __init() {
19
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
20
+ };
21
+ var __commonJS = (cb, mod) => function __require2() {
22
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
+ };
9
24
  var __copyProps = (to, from, except, desc) => {
10
25
  if (from && typeof from === "object" || typeof from === "function") {
11
26
  for (let key of __getOwnPropNames(from))
@@ -22,18 +37,1115 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
37
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
38
  mod
24
39
  ));
25
- var import_fs = __toESM(require("fs"));
26
- var import_path = __toESM(require("path"));
27
- var import_rslog = require("rslog");
28
- var import_prompts = require("@clack/prompts");
40
+
41
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.54.6_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
42
+ import { fileURLToPath } from "url";
43
+ import path from "path";
44
+ var getFilename, getDirname, __dirname;
45
+ var init_esm = __esm({
46
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.54.6_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js"() {
47
+ "use strict";
48
+ getFilename = () => fileURLToPath(import.meta.url);
49
+ getDirname = () => path.dirname(getFilename());
50
+ __dirname = /* @__PURE__ */ getDirname();
51
+ }
52
+ });
53
+
54
+ // ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
55
+ var require_src = __commonJS({
56
+ "../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
57
+ "use strict";
58
+ init_esm();
59
+ var ESC = "\x1B";
60
+ var CSI = `${ESC}[`;
61
+ var beep = "\x07";
62
+ var cursor = {
63
+ to(x3, y3) {
64
+ if (!y3)
65
+ return `${CSI}${x3 + 1}G`;
66
+ return `${CSI}${y3 + 1};${x3 + 1}H`;
67
+ },
68
+ move(x3, y3) {
69
+ let ret = "";
70
+ if (x3 < 0)
71
+ ret += `${CSI}${-x3}D`;
72
+ else if (x3 > 0)
73
+ ret += `${CSI}${x3}C`;
74
+ if (y3 < 0)
75
+ ret += `${CSI}${-y3}A`;
76
+ else if (y3 > 0)
77
+ ret += `${CSI}${y3}B`;
78
+ return ret;
79
+ },
80
+ up: (count = 1) => `${CSI}${count}A`,
81
+ down: (count = 1) => `${CSI}${count}B`,
82
+ forward: (count = 1) => `${CSI}${count}C`,
83
+ backward: (count = 1) => `${CSI}${count}D`,
84
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
85
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
86
+ left: `${CSI}G`,
87
+ hide: `${CSI}?25l`,
88
+ show: `${CSI}?25h`,
89
+ save: `${ESC}7`,
90
+ restore: `${ESC}8`
91
+ };
92
+ var scroll = {
93
+ up: (count = 1) => `${CSI}S`.repeat(count),
94
+ down: (count = 1) => `${CSI}T`.repeat(count)
95
+ };
96
+ var erase = {
97
+ screen: `${CSI}2J`,
98
+ up: (count = 1) => `${CSI}1J`.repeat(count),
99
+ down: (count = 1) => `${CSI}J`.repeat(count),
100
+ line: `${CSI}2K`,
101
+ lineEnd: `${CSI}K`,
102
+ lineStart: `${CSI}1K`,
103
+ lines(count) {
104
+ let clear = "";
105
+ for (let i = 0; i < count; i++)
106
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
107
+ if (count)
108
+ clear += cursor.left;
109
+ return clear;
110
+ }
111
+ };
112
+ module.exports = { cursor, scroll, erase, beep };
113
+ }
114
+ });
115
+
116
+ // ../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
117
+ var require_picocolors = __commonJS({
118
+ "../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports, module) {
119
+ "use strict";
120
+ init_esm();
121
+ var argv = process.argv || [];
122
+ var env2 = process.env;
123
+ var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
124
+ var formatter2 = (open, close, replace = open) => (input) => {
125
+ let string = "" + input;
126
+ let index = string.indexOf(close, open.length);
127
+ return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
128
+ };
129
+ var replaceClose2 = (string, close, replace, index) => {
130
+ let result = "";
131
+ let cursor = 0;
132
+ do {
133
+ result += string.substring(cursor, index) + replace;
134
+ cursor = index + close.length;
135
+ index = string.indexOf(close, cursor);
136
+ } while (~index);
137
+ return result + string.substring(cursor);
138
+ };
139
+ var createColors = (enabled = isColorSupported) => {
140
+ let init = enabled ? formatter2 : () => String;
141
+ return {
142
+ isColorSupported: enabled,
143
+ reset: init("\x1B[0m", "\x1B[0m"),
144
+ bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
145
+ dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
146
+ italic: init("\x1B[3m", "\x1B[23m"),
147
+ underline: init("\x1B[4m", "\x1B[24m"),
148
+ inverse: init("\x1B[7m", "\x1B[27m"),
149
+ hidden: init("\x1B[8m", "\x1B[28m"),
150
+ strikethrough: init("\x1B[9m", "\x1B[29m"),
151
+ black: init("\x1B[30m", "\x1B[39m"),
152
+ red: init("\x1B[31m", "\x1B[39m"),
153
+ green: init("\x1B[32m", "\x1B[39m"),
154
+ yellow: init("\x1B[33m", "\x1B[39m"),
155
+ blue: init("\x1B[34m", "\x1B[39m"),
156
+ magenta: init("\x1B[35m", "\x1B[39m"),
157
+ cyan: init("\x1B[36m", "\x1B[39m"),
158
+ white: init("\x1B[37m", "\x1B[39m"),
159
+ gray: init("\x1B[90m", "\x1B[39m"),
160
+ bgBlack: init("\x1B[40m", "\x1B[49m"),
161
+ bgRed: init("\x1B[41m", "\x1B[49m"),
162
+ bgGreen: init("\x1B[42m", "\x1B[49m"),
163
+ bgYellow: init("\x1B[43m", "\x1B[49m"),
164
+ bgBlue: init("\x1B[44m", "\x1B[49m"),
165
+ bgMagenta: init("\x1B[45m", "\x1B[49m"),
166
+ bgCyan: init("\x1B[46m", "\x1B[49m"),
167
+ bgWhite: init("\x1B[47m", "\x1B[49m")
168
+ };
169
+ };
170
+ module.exports = createColors();
171
+ module.exports.createColors = createColors;
172
+ }
173
+ });
174
+
175
+ // ../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
176
+ var require_cjs = __commonJS({
177
+ "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"(exports, module) {
178
+ "use strict";
179
+ init_esm();
180
+ var isMergeableObject = function isMergeableObject2(value) {
181
+ return isNonNullObject(value) && !isSpecial(value);
182
+ };
183
+ function isNonNullObject(value) {
184
+ return !!value && typeof value === "object";
185
+ }
186
+ function isSpecial(value) {
187
+ var stringValue = Object.prototype.toString.call(value);
188
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
189
+ }
190
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
191
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
192
+ function isReactElement(value) {
193
+ return value.$$typeof === REACT_ELEMENT_TYPE;
194
+ }
195
+ function emptyTarget(val) {
196
+ return Array.isArray(val) ? [] : {};
197
+ }
198
+ function cloneUnlessOtherwiseSpecified(value, options) {
199
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
200
+ }
201
+ function defaultArrayMerge(target, source, options) {
202
+ return target.concat(source).map(function(element) {
203
+ return cloneUnlessOtherwiseSpecified(element, options);
204
+ });
205
+ }
206
+ function getMergeFunction(key, options) {
207
+ if (!options.customMerge) {
208
+ return deepmerge2;
209
+ }
210
+ var customMerge = options.customMerge(key);
211
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
212
+ }
213
+ function getEnumerableOwnPropertySymbols(target) {
214
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
215
+ return Object.propertyIsEnumerable.call(target, symbol);
216
+ }) : [];
217
+ }
218
+ function getKeys(target) {
219
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
220
+ }
221
+ function propertyIsOnObject(object, property) {
222
+ try {
223
+ return property in object;
224
+ } catch (_3) {
225
+ return false;
226
+ }
227
+ }
228
+ function propertyIsUnsafe(target, key) {
229
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
230
+ }
231
+ function mergeObject(target, source, options) {
232
+ var destination = {};
233
+ if (options.isMergeableObject(target)) {
234
+ getKeys(target).forEach(function(key) {
235
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
236
+ });
237
+ }
238
+ getKeys(source).forEach(function(key) {
239
+ if (propertyIsUnsafe(target, key)) {
240
+ return;
241
+ }
242
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
243
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
244
+ } else {
245
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
246
+ }
247
+ });
248
+ return destination;
249
+ }
250
+ function deepmerge2(target, source, options) {
251
+ options = options || {};
252
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
253
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
254
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
255
+ var sourceIsArray = Array.isArray(source);
256
+ var targetIsArray = Array.isArray(target);
257
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
258
+ if (!sourceAndTargetTypesMatch) {
259
+ return cloneUnlessOtherwiseSpecified(source, options);
260
+ } else if (sourceIsArray) {
261
+ return options.arrayMerge(target, source, options);
262
+ } else {
263
+ return mergeObject(target, source, options);
264
+ }
265
+ }
266
+ deepmerge2.all = function deepmergeAll(array, options) {
267
+ if (!Array.isArray(array)) {
268
+ throw new Error("first argument should be an array");
269
+ }
270
+ return array.reduce(function(prev, next) {
271
+ return deepmerge2(prev, next, options);
272
+ }, {});
273
+ };
274
+ var deepmerge_1 = deepmerge2;
275
+ module.exports = deepmerge_1;
276
+ }
277
+ });
278
+
279
+ // src/index.ts
280
+ init_esm();
281
+ import fs from "fs";
282
+ import path2 from "path";
283
+
284
+ // ../../node_modules/.pnpm/@clack+prompts@0.7.0/node_modules/@clack/prompts/dist/index.mjs
285
+ init_esm();
286
+
287
+ // ../../node_modules/.pnpm/@clack+core@0.3.4/node_modules/@clack/core/dist/index.mjs
288
+ init_esm();
289
+ var import_sisteransi = __toESM(require_src(), 1);
290
+ var import_picocolors = __toESM(require_picocolors(), 1);
291
+ import { stdin as $, stdout as k } from "process";
292
+ import * as f from "readline";
293
+ import _ from "readline";
294
+ import { WriteStream as U } from "tty";
295
+ function q({ onlyFirst: t = false } = {}) {
296
+ const u = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
297
+ return new RegExp(u, t ? void 0 : "g");
298
+ }
299
+ function S(t) {
300
+ if (typeof t != "string")
301
+ throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
302
+ return t.replace(q(), "");
303
+ }
304
+ function j(t) {
305
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
306
+ }
307
+ var M = { exports: {} };
308
+ (function(t) {
309
+ var u = {};
310
+ t.exports = u, u.eastAsianWidth = function(e2) {
311
+ var s = e2.charCodeAt(0), C2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D = s;
312
+ return 55296 <= s && s <= 56319 && 56320 <= C2 && C2 <= 57343 && (s &= 1023, C2 &= 1023, D = s << 10 | C2, 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";
313
+ }, u.characterLength = function(e2) {
314
+ var s = this.eastAsianWidth(e2);
315
+ return s == "F" || s == "W" || s == "A" ? 2 : 1;
316
+ };
317
+ function F(e2) {
318
+ return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
319
+ }
320
+ u.length = function(e2) {
321
+ for (var s = F(e2), C2 = 0, D = 0; D < s.length; D++)
322
+ C2 = C2 + this.characterLength(s[D]);
323
+ return C2;
324
+ }, u.slice = function(e2, s, C2) {
325
+ textLen = u.length(e2), s = s || 0, C2 = C2 || 1, s < 0 && (s = textLen + s), C2 < 0 && (C2 = textLen + C2);
326
+ for (var D = "", i = 0, n = F(e2), E2 = 0; E2 < n.length; E2++) {
327
+ var h2 = n[E2], o2 = u.length(h2);
328
+ if (i >= s - (o2 == 2 ? 1 : 0))
329
+ if (i + o2 <= C2)
330
+ D += h2;
331
+ else
332
+ break;
333
+ i += o2;
334
+ }
335
+ return D;
336
+ };
337
+ })(M);
338
+ var J = M.exports;
339
+ var Q = j(J);
340
+ var X = function() {
341
+ 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;
342
+ };
343
+ var DD = j(X);
344
+ function A(t, u = {}) {
345
+ if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = S(t), t.length === 0))
346
+ return 0;
347
+ t = t.replace(DD(), " ");
348
+ const F = u.ambiguousIsNarrow ? 1 : 2;
349
+ let e2 = 0;
350
+ for (const s of t) {
351
+ const C2 = s.codePointAt(0);
352
+ if (C2 <= 31 || C2 >= 127 && C2 <= 159 || C2 >= 768 && C2 <= 879)
353
+ continue;
354
+ switch (Q.eastAsianWidth(s)) {
355
+ case "F":
356
+ case "W":
357
+ e2 += 2;
358
+ break;
359
+ case "A":
360
+ e2 += F;
361
+ break;
362
+ default:
363
+ e2 += 1;
364
+ }
365
+ }
366
+ return e2;
367
+ }
368
+ var m = 10;
369
+ var T = (t = 0) => (u) => `\x1B[${u + t}m`;
370
+ var P = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
371
+ var W = (t = 0) => (u, F, e2) => `\x1B[${38 + t};2;${u};${F};${e2}m`;
372
+ var 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] } };
373
+ Object.keys(r.modifier);
374
+ var uD = Object.keys(r.color);
375
+ var FD = Object.keys(r.bgColor);
376
+ [...uD, ...FD];
377
+ function tD() {
378
+ const t = /* @__PURE__ */ new Map();
379
+ for (const [u, F] of Object.entries(r)) {
380
+ for (const [e2, s] of Object.entries(F))
381
+ r[e2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[e2] = r[e2], t.set(s[0], s[1]);
382
+ Object.defineProperty(r, u, { value: F, enumerable: false });
383
+ }
384
+ return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = T(), r.color.ansi256 = P(), r.color.ansi16m = W(), r.bgColor.ansi = T(m), r.bgColor.ansi256 = P(m), r.bgColor.ansi16m = W(m), Object.defineProperties(r, { rgbToAnsi256: { value: (u, F, e2) => u === F && F === e2 ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
385
+ const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
386
+ if (!F)
387
+ return [0, 0, 0];
388
+ let [e2] = F;
389
+ e2.length === 3 && (e2 = [...e2].map((C2) => C2 + C2).join(""));
390
+ const s = Number.parseInt(e2, 16);
391
+ return [s >> 16 & 255, s >> 8 & 255, s & 255];
392
+ }, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
393
+ if (u < 8)
394
+ return 30 + u;
395
+ if (u < 16)
396
+ return 90 + (u - 8);
397
+ let F, e2, s;
398
+ if (u >= 232)
399
+ F = ((u - 232) * 10 + 8) / 255, e2 = F, s = F;
400
+ else {
401
+ u -= 16;
402
+ const i = u % 36;
403
+ F = Math.floor(u / 36) / 5, e2 = Math.floor(i / 6) / 5, s = i % 6 / 5;
404
+ }
405
+ const C2 = Math.max(F, e2, s) * 2;
406
+ if (C2 === 0)
407
+ return 30;
408
+ let D = 30 + (Math.round(s) << 2 | Math.round(e2) << 1 | Math.round(F));
409
+ return C2 === 2 && (D += 60), D;
410
+ }, enumerable: false }, rgbToAnsi: { value: (u, F, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e2)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
411
+ }
412
+ var eD = tD();
413
+ var g = /* @__PURE__ */ new Set(["\x1B", "›"]);
414
+ var sD = 39;
415
+ var b = "\x07";
416
+ var O = "[";
417
+ var CD = "]";
418
+ var I = "m";
419
+ var w = `${CD}8;;`;
420
+ var N = (t) => `${g.values().next().value}${O}${t}${I}`;
421
+ var L = (t) => `${g.values().next().value}${w}${t}${b}`;
422
+ var iD = (t) => t.split(" ").map((u) => A(u));
423
+ var y = (t, u, F) => {
424
+ const e2 = [...u];
425
+ let s = false, C2 = false, D = A(S(t[t.length - 1]));
426
+ for (const [i, n] of e2.entries()) {
427
+ const E2 = A(n);
428
+ if (D + E2 <= F ? t[t.length - 1] += n : (t.push(n), D = 0), g.has(n) && (s = true, C2 = e2.slice(i + 1).join("").startsWith(w)), s) {
429
+ C2 ? n === b && (s = false, C2 = false) : n === I && (s = false);
430
+ continue;
431
+ }
432
+ D += E2, D === F && i < e2.length - 1 && (t.push(""), D = 0);
433
+ }
434
+ !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
435
+ };
436
+ var rD = (t) => {
437
+ const u = t.split(" ");
438
+ let F = u.length;
439
+ for (; F > 0 && !(A(u[F - 1]) > 0); )
440
+ F--;
441
+ return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
442
+ };
443
+ var ED = (t, u, F = {}) => {
444
+ if (F.trim !== false && t.trim() === "")
445
+ return "";
446
+ let e2 = "", s, C2;
447
+ const D = iD(t);
448
+ let i = [""];
449
+ for (const [E2, h2] of t.split(" ").entries()) {
450
+ F.trim !== false && (i[i.length - 1] = i[i.length - 1].trimStart());
451
+ let o2 = A(i[i.length - 1]);
452
+ if (E2 !== 0 && (o2 >= u && (F.wordWrap === false || F.trim === false) && (i.push(""), o2 = 0), (o2 > 0 || F.trim === false) && (i[i.length - 1] += " ", o2++)), F.hard && D[E2] > u) {
453
+ const B2 = u - o2, p = 1 + Math.floor((D[E2] - B2 - 1) / u);
454
+ Math.floor((D[E2] - 1) / u) < p && i.push(""), y(i, h2, u);
455
+ continue;
456
+ }
457
+ if (o2 + D[E2] > u && o2 > 0 && D[E2] > 0) {
458
+ if (F.wordWrap === false && o2 < u) {
459
+ y(i, h2, u);
460
+ continue;
461
+ }
462
+ i.push("");
463
+ }
464
+ if (o2 + D[E2] > u && F.wordWrap === false) {
465
+ y(i, h2, u);
466
+ continue;
467
+ }
468
+ i[i.length - 1] += h2;
469
+ }
470
+ F.trim !== false && (i = i.map((E2) => rD(E2)));
471
+ const n = [...i.join(`
472
+ `)];
473
+ for (const [E2, h2] of n.entries()) {
474
+ if (e2 += h2, g.has(h2)) {
475
+ const { groups: B2 } = new RegExp(`(?:\\${O}(?<code>\\d+)m|\\${w}(?<uri>.*)${b})`).exec(n.slice(E2).join("")) || { groups: {} };
476
+ if (B2.code !== void 0) {
477
+ const p = Number.parseFloat(B2.code);
478
+ s = p === sD ? void 0 : p;
479
+ } else
480
+ B2.uri !== void 0 && (C2 = B2.uri.length === 0 ? void 0 : B2.uri);
481
+ }
482
+ const o2 = eD.codes.get(Number(s));
483
+ n[E2 + 1] === `
484
+ ` ? (C2 && (e2 += L("")), s && o2 && (e2 += N(o2))) : h2 === `
485
+ ` && (s && o2 && (e2 += N(s)), C2 && (e2 += L(C2)));
486
+ }
487
+ return e2;
488
+ };
489
+ function R(t, u, F) {
490
+ return String(t).normalize().replace(/\r\n/g, `
491
+ `).split(`
492
+ `).map((e2) => ED(e2, u, F)).join(`
493
+ `);
494
+ }
495
+ var oD = Object.defineProperty;
496
+ var nD = (t, u, F) => u in t ? oD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
497
+ var a = (t, u, F) => (nD(t, typeof u != "symbol" ? u + "" : u, F), F);
498
+ function aD(t, u) {
499
+ if (t === u)
500
+ return;
501
+ const F = t.split(`
502
+ `), e2 = u.split(`
503
+ `), s = [];
504
+ for (let C2 = 0; C2 < Math.max(F.length, e2.length); C2++)
505
+ F[C2] !== e2[C2] && s.push(C2);
506
+ return s;
507
+ }
508
+ var V = Symbol("clack:cancel");
509
+ function hD(t) {
510
+ return t === V;
511
+ }
512
+ function v(t, u) {
513
+ t.isTTY && t.setRawMode(u);
514
+ }
515
+ var z = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
516
+ var lD = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
517
+ var x = class {
518
+ constructor({ render: u, input: F = $, output: e2 = k, ...s }, C2 = true) {
519
+ a(this, "input"), a(this, "output"), a(this, "rl"), a(this, "opts"), a(this, "_track", false), a(this, "_render"), a(this, "_cursor", 0), a(this, "state", "initial"), a(this, "value"), a(this, "error", ""), a(this, "subscribers", /* @__PURE__ */ new Map()), a(this, "_prevFrame", ""), this.opts = s, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = u.bind(this), this._track = C2, this.input = F, this.output = e2;
520
+ }
521
+ prompt() {
522
+ const u = new U(0);
523
+ return u._write = (F, e2, s) => {
524
+ this._track && (this.value = this.rl.line.replace(/\t/g, ""), this._cursor = this.rl.cursor, this.emit("value", this.value)), s();
525
+ }, this.input.pipe(u), this.rl = _.createInterface({ input: this.input, output: u, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), _.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), v(this.input, true), this.output.on("resize", this.render), this.render(), new Promise((F, e2) => {
526
+ this.once("submit", () => {
527
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(this.value);
528
+ }), this.once("cancel", () => {
529
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(V);
530
+ });
531
+ });
532
+ }
533
+ on(u, F) {
534
+ const e2 = this.subscribers.get(u) ?? [];
535
+ e2.push({ cb: F }), this.subscribers.set(u, e2);
536
+ }
537
+ once(u, F) {
538
+ const e2 = this.subscribers.get(u) ?? [];
539
+ e2.push({ cb: F, once: true }), this.subscribers.set(u, e2);
540
+ }
541
+ emit(u, ...F) {
542
+ const e2 = this.subscribers.get(u) ?? [], s = [];
543
+ for (const C2 of e2)
544
+ C2.cb(...F), C2.once && s.push(() => e2.splice(e2.indexOf(C2), 1));
545
+ for (const C2 of s)
546
+ C2();
547
+ }
548
+ unsubscribe() {
549
+ this.subscribers.clear();
550
+ }
551
+ onKeypress(u, F) {
552
+ if (this.state === "error" && (this.state = "active"), F?.name && !this._track && z.has(F.name) && this.emit("cursor", z.get(F.name)), F?.name && lD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
553
+ if (this.opts.validate) {
554
+ const e2 = this.opts.validate(this.value);
555
+ e2 && (this.error = e2, this.state = "error", this.rl.write(this.value));
556
+ }
557
+ this.state !== "error" && (this.state = "submit");
558
+ }
559
+ u === "" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
560
+ }
561
+ close() {
562
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
563
+ `), v(this.input, false), this.rl.close(), this.emit(`${this.state}`, this.value), this.unsubscribe();
564
+ }
565
+ restoreCursor() {
566
+ const u = R(this._prevFrame, process.stdout.columns, { hard: true }).split(`
567
+ `).length - 1;
568
+ this.output.write(import_sisteransi.cursor.move(-999, u * -1));
569
+ }
570
+ render() {
571
+ const u = R(this._render(this) ?? "", process.stdout.columns, { hard: true });
572
+ if (u !== this._prevFrame) {
573
+ if (this.state === "initial")
574
+ this.output.write(import_sisteransi.cursor.hide);
575
+ else {
576
+ const F = aD(this._prevFrame, u);
577
+ if (this.restoreCursor(), F && F?.length === 1) {
578
+ const e2 = F[0];
579
+ this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.lines(1));
580
+ const s = u.split(`
581
+ `);
582
+ this.output.write(s[e2]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - e2 - 1));
583
+ return;
584
+ } else if (F && F?.length > 1) {
585
+ const e2 = F[0];
586
+ this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.down());
587
+ const s = u.split(`
588
+ `).slice(e2);
589
+ this.output.write(s.join(`
590
+ `)), this._prevFrame = u;
591
+ return;
592
+ }
593
+ this.output.write(import_sisteransi.erase.down());
594
+ }
595
+ this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
596
+ }
597
+ }
598
+ };
599
+ var pD = Object.defineProperty;
600
+ var fD = (t, u, F) => u in t ? pD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
601
+ var K = (t, u, F) => (fD(t, typeof u != "symbol" ? u + "" : u, F), F);
602
+ var gD = class extends x {
603
+ constructor(u) {
604
+ super(u, false), K(this, "options"), K(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
605
+ F === "a" && this.toggleAll();
606
+ }), this.on("cursor", (F) => {
607
+ switch (F) {
608
+ case "left":
609
+ case "up":
610
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
611
+ break;
612
+ case "down":
613
+ case "right":
614
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
615
+ break;
616
+ case "space":
617
+ this.toggleValue();
618
+ break;
619
+ }
620
+ });
621
+ }
622
+ get _value() {
623
+ return this.options[this.cursor].value;
624
+ }
625
+ toggleAll() {
626
+ const u = this.value.length === this.options.length;
627
+ this.value = u ? [] : this.options.map((F) => F.value);
628
+ }
629
+ toggleValue() {
630
+ const u = this.value.includes(this._value);
631
+ this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
632
+ }
633
+ };
634
+ var bD = Object.defineProperty;
635
+ var wD = (t, u, F) => u in t ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
636
+ var Z = (t, u, F) => (wD(t, typeof u != "symbol" ? u + "" : u, F), F);
637
+ var yD = class extends x {
638
+ constructor(u) {
639
+ super(u, false), Z(this, "options"), Z(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
640
+ switch (F) {
641
+ case "left":
642
+ case "up":
643
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
644
+ break;
645
+ case "down":
646
+ case "right":
647
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
648
+ break;
649
+ }
650
+ this.changeValue();
651
+ });
652
+ }
653
+ get _value() {
654
+ return this.options[this.cursor];
655
+ }
656
+ changeValue() {
657
+ this.value = this._value.value;
658
+ }
659
+ };
660
+ var SD = Object.defineProperty;
661
+ var jD = (t, u, F) => u in t ? SD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
662
+ var MD = (t, u, F) => (jD(t, typeof u != "symbol" ? u + "" : u, F), F);
663
+ var TD = class extends x {
664
+ constructor(u) {
665
+ super(u), MD(this, "valueWithCursor", ""), this.on("finalize", () => {
666
+ this.value || (this.value = u.defaultValue), this.valueWithCursor = this.value;
667
+ }), this.on("value", () => {
668
+ if (this.cursor >= this.value.length)
669
+ this.valueWithCursor = `${this.value}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
670
+ else {
671
+ const F = this.value.slice(0, this.cursor), e2 = this.value.slice(this.cursor);
672
+ this.valueWithCursor = `${F}${import_picocolors.default.inverse(e2[0])}${e2.slice(1)}`;
673
+ }
674
+ });
675
+ }
676
+ get cursor() {
677
+ return this._cursor;
678
+ }
679
+ };
680
+ var PD = globalThis.process.platform.startsWith("win");
681
+
682
+ // ../../node_modules/.pnpm/@clack+prompts@0.7.0/node_modules/@clack/prompts/dist/index.mjs
683
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
684
+ var import_sisteransi2 = __toESM(require_src(), 1);
685
+ import h from "process";
686
+ function q2() {
687
+ return h.platform !== "win32" ? h.env.TERM !== "linux" : Boolean(h.env.CI) || Boolean(h.env.WT_SESSION) || Boolean(h.env.TERMINUS_SUBLIME) || h.env.ConEmuTask === "{cmd::Cmder}" || h.env.TERM_PROGRAM === "Terminus-Sublime" || h.env.TERM_PROGRAM === "vscode" || h.env.TERM === "xterm-256color" || h.env.TERM === "alacritty" || h.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
688
+ }
689
+ var _2 = q2();
690
+ var o = (r2, n) => _2 ? r2 : n;
691
+ var H = o("◆", "*");
692
+ var I2 = o("■", "x");
693
+ var x2 = o("▲", "x");
694
+ var S2 = o("◇", "o");
695
+ var K2 = o("┌", "T");
696
+ var a2 = o("│", "|");
697
+ var d2 = o("└", "—");
698
+ var b2 = o("●", ">");
699
+ var E = o("○", " ");
700
+ var C = o("◻", "[•]");
701
+ var w2 = o("◼", "[+]");
702
+ var M2 = o("◻", "[ ]");
703
+ var U2 = o("▪", "•");
704
+ var B = o("─", "-");
705
+ var Z2 = o("╮", "+");
706
+ var z2 = o("├", "+");
707
+ var X2 = o("╯", "+");
708
+ var J2 = o("●", "•");
709
+ var Y = o("◆", "*");
710
+ var Q2 = o("▲", "!");
711
+ var ee = o("■", "x");
712
+ var y2 = (r2) => {
713
+ switch (r2) {
714
+ case "initial":
715
+ case "active":
716
+ return import_picocolors2.default.cyan(H);
717
+ case "cancel":
718
+ return import_picocolors2.default.red(I2);
719
+ case "error":
720
+ return import_picocolors2.default.yellow(x2);
721
+ case "submit":
722
+ return import_picocolors2.default.green(S2);
723
+ }
724
+ };
725
+ var te = (r2) => new TD({ validate: r2.validate, placeholder: r2.placeholder, defaultValue: r2.defaultValue, initialValue: r2.initialValue, render() {
726
+ const n = `${import_picocolors2.default.gray(a2)}
727
+ ${y2(this.state)} ${r2.message}
728
+ `, i = r2.placeholder ? import_picocolors2.default.inverse(r2.placeholder[0]) + import_picocolors2.default.dim(r2.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), t = this.value ? this.valueWithCursor : i;
729
+ switch (this.state) {
730
+ case "error":
731
+ return `${n.trim()}
732
+ ${import_picocolors2.default.yellow(a2)} ${t}
733
+ ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
734
+ `;
735
+ case "submit":
736
+ return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(this.value || r2.placeholder)}`;
737
+ case "cancel":
738
+ return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
739
+ ` + import_picocolors2.default.gray(a2) : ""}`;
740
+ default:
741
+ return `${n}${import_picocolors2.default.cyan(a2)} ${t}
742
+ ${import_picocolors2.default.cyan(d2)}
743
+ `;
744
+ }
745
+ } }).prompt();
746
+ var ie = (r2) => {
747
+ const n = (t, s) => {
748
+ const c2 = t.label ?? String(t.value);
749
+ return s === "active" ? `${import_picocolors2.default.green(b2)} ${c2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}` : s === "selected" ? `${import_picocolors2.default.dim(c2)}` : s === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(c2))}` : `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(c2)}`;
750
+ };
751
+ let i = 0;
752
+ return new yD({ options: r2.options, initialValue: r2.initialValue, render() {
753
+ const t = `${import_picocolors2.default.gray(a2)}
754
+ ${y2(this.state)} ${r2.message}
755
+ `;
756
+ switch (this.state) {
757
+ case "submit":
758
+ return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "selected")}`;
759
+ case "cancel":
760
+ return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "cancelled")}
761
+ ${import_picocolors2.default.gray(a2)}`;
762
+ default: {
763
+ const s = r2.maxItems === void 0 ? 1 / 0 : Math.max(r2.maxItems, 5);
764
+ this.cursor >= i + s - 3 ? i = Math.max(Math.min(this.cursor - s + 3, this.options.length - s), 0) : this.cursor < i + 2 && (i = Math.max(this.cursor - 2, 0));
765
+ const c2 = s < this.options.length && i > 0, l2 = s < this.options.length && i + s < this.options.length;
766
+ return `${t}${import_picocolors2.default.cyan(a2)} ${this.options.slice(i, i + s).map((u, m2, $2) => m2 === 0 && c2 ? import_picocolors2.default.dim("...") : m2 === $2.length - 1 && l2 ? import_picocolors2.default.dim("...") : n(u, m2 + i === this.cursor ? "active" : "inactive")).join(`
767
+ ${import_picocolors2.default.cyan(a2)} `)}
768
+ ${import_picocolors2.default.cyan(d2)}
769
+ `;
770
+ }
771
+ }
772
+ } }).prompt();
773
+ };
774
+ var ae = (r2) => {
775
+ const n = (i, t) => {
776
+ const s = i.label ?? String(i.value);
777
+ return t === "active" ? `${import_picocolors2.default.cyan(C)} ${s} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}` : t === "selected" ? `${import_picocolors2.default.green(w2)} ${import_picocolors2.default.dim(s)}` : t === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : t === "active-selected" ? `${import_picocolors2.default.green(w2)} ${s} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}` : t === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(M2)} ${import_picocolors2.default.dim(s)}`;
778
+ };
779
+ return new gD({ options: r2.options, initialValues: r2.initialValues, required: r2.required ?? true, cursorAt: r2.cursorAt, validate(i) {
780
+ if (this.required && i.length === 0)
781
+ return `Please select at least one option.
782
+ ${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`))}`;
783
+ }, render() {
784
+ let i = `${import_picocolors2.default.gray(a2)}
785
+ ${y2(this.state)} ${r2.message}
786
+ `;
787
+ switch (this.state) {
788
+ case "submit":
789
+ return `${i}${import_picocolors2.default.gray(a2)} ${this.options.filter(({ value: t }) => this.value.includes(t)).map((t) => n(t, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
790
+ case "cancel": {
791
+ const t = this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "cancelled")).join(import_picocolors2.default.dim(", "));
792
+ return `${i}${import_picocolors2.default.gray(a2)} ${t.trim() ? `${t}
793
+ ${import_picocolors2.default.gray(a2)}` : ""}`;
794
+ }
795
+ case "error": {
796
+ const t = this.error.split(`
797
+ `).map((s, c2) => c2 === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(s)}` : ` ${s}`).join(`
798
+ `);
799
+ return i + import_picocolors2.default.yellow(a2) + " " + this.options.map((s, c2) => {
800
+ const l2 = this.value.includes(s.value), u = c2 === this.cursor;
801
+ return u && l2 ? n(s, "active-selected") : l2 ? n(s, "selected") : n(s, u ? "active" : "inactive");
802
+ }).join(`
803
+ ${import_picocolors2.default.yellow(a2)} `) + `
804
+ ` + t + `
805
+ `;
806
+ }
807
+ default:
808
+ return `${i}${import_picocolors2.default.cyan(a2)} ${this.options.map((t, s) => {
809
+ const c2 = this.value.includes(t.value), l2 = s === this.cursor;
810
+ return l2 && c2 ? n(t, "active-selected") : c2 ? n(t, "selected") : n(t, l2 ? "active" : "inactive");
811
+ }).join(`
812
+ ${import_picocolors2.default.cyan(a2)} `)}
813
+ ${import_picocolors2.default.cyan(d2)}
814
+ `;
815
+ }
816
+ } }).prompt();
817
+ };
818
+ var R2 = (r2) => r2.replace(me(), "");
819
+ var le = (r2 = "", n = "") => {
820
+ const i = `
821
+ ${r2}
822
+ `.split(`
823
+ `), t = R2(n).length, s = Math.max(i.reduce((l2, u) => (u = R2(u), u.length > l2 ? u.length : l2), 0), t) + 2, c2 = i.map((l2) => `${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(l2)}${" ".repeat(s - R2(l2).length)}${import_picocolors2.default.gray(a2)}`).join(`
824
+ `);
825
+ process.stdout.write(`${import_picocolors2.default.gray(a2)}
826
+ ${import_picocolors2.default.green(S2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(B.repeat(Math.max(s - t - 1, 1)) + Z2)}
827
+ ${c2}
828
+ ${import_picocolors2.default.gray(z2 + B.repeat(s + 2) + X2)}
829
+ `);
830
+ };
831
+ var ue = (r2 = "") => {
832
+ process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(r2)}
833
+
834
+ `);
835
+ };
836
+ var $e = (r2 = "") => {
837
+ process.stdout.write(`${import_picocolors2.default.gray(a2)}
838
+ ${import_picocolors2.default.gray(d2)} ${r2}
839
+
840
+ `);
841
+ };
842
+ function me() {
843
+ const r2 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
844
+ return new RegExp(r2, "g");
845
+ }
846
+
847
+ // src/index.ts
848
+ var import_deepmerge = __toESM(require_cjs());
849
+
850
+ // ../../node_modules/.pnpm/rslog@1.2.2/node_modules/rslog/dist/index.mjs
851
+ init_esm();
852
+ import process2 from "process";
853
+ import os from "os";
854
+ import tty from "tty";
855
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
856
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
857
+ const position = argv.indexOf(prefix + flag);
858
+ const terminatorPosition = argv.indexOf("--");
859
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
860
+ }
861
+ var { env } = process2;
862
+ var flagForceColor;
863
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
864
+ flagForceColor = 0;
865
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
866
+ flagForceColor = 1;
867
+ }
868
+ function envForceColor() {
869
+ if ("FORCE_COLOR" in env) {
870
+ if (env.FORCE_COLOR === "true") {
871
+ return 1;
872
+ }
873
+ if (env.FORCE_COLOR === "false") {
874
+ return 0;
875
+ }
876
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
877
+ }
878
+ }
879
+ function translateLevel(level) {
880
+ if (level === 0) {
881
+ return false;
882
+ }
883
+ return {
884
+ level,
885
+ hasBasic: true,
886
+ has256: level >= 2,
887
+ has16m: level >= 3
888
+ };
889
+ }
890
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
891
+ const noFlagForceColor = envForceColor();
892
+ if (noFlagForceColor !== void 0) {
893
+ flagForceColor = noFlagForceColor;
894
+ }
895
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
896
+ if (forceColor === 0) {
897
+ return 0;
898
+ }
899
+ if (sniffFlags) {
900
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
901
+ return 3;
902
+ }
903
+ if (hasFlag("color=256")) {
904
+ return 2;
905
+ }
906
+ }
907
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
908
+ return 1;
909
+ }
910
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
911
+ return 0;
912
+ }
913
+ const min = forceColor || 0;
914
+ if (env.TERM === "dumb") {
915
+ return min;
916
+ }
917
+ if (process2.platform === "win32") {
918
+ const osRelease = os.release().split(".");
919
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
920
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
921
+ }
922
+ return 1;
923
+ }
924
+ if ("CI" in env) {
925
+ if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
926
+ return 3;
927
+ }
928
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
929
+ return 1;
930
+ }
931
+ return min;
932
+ }
933
+ if ("TEAMCITY_VERSION" in env) {
934
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
935
+ }
936
+ if (env.COLORTERM === "truecolor") {
937
+ return 3;
938
+ }
939
+ if (env.TERM === "xterm-kitty") {
940
+ return 3;
941
+ }
942
+ if ("TERM_PROGRAM" in env) {
943
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
944
+ switch (env.TERM_PROGRAM) {
945
+ case "iTerm.app": {
946
+ return version >= 3 ? 3 : 2;
947
+ }
948
+ case "Apple_Terminal": {
949
+ return 2;
950
+ }
951
+ }
952
+ }
953
+ if (/-256(color)?$/i.test(env.TERM)) {
954
+ return 2;
955
+ }
956
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
957
+ return 1;
958
+ }
959
+ if ("COLORTERM" in env) {
960
+ return 1;
961
+ }
962
+ return min;
963
+ }
964
+ function createSupportsColor(stream, options = {}) {
965
+ const level = _supportsColor(stream, {
966
+ streamIsTTY: stream && stream.isTTY,
967
+ ...options
968
+ });
969
+ return translateLevel(level);
970
+ }
971
+ var supportsColor = {
972
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
973
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
974
+ };
975
+ var supports_color_default = supportsColor;
976
+ var colorLevel = supports_color_default.stdout ? supports_color_default.stdout.level : 0;
977
+ var errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
978
+ var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
979
+ var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
980
+ var formatter = (open, close, replace = open) => colorLevel >= 2 ? (input) => {
981
+ let string = "" + input;
982
+ let index = string.indexOf(close, open.length);
983
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
984
+ } : String;
985
+ var replaceClose = (string, close, replace, index) => {
986
+ let start = string.substring(0, index) + replace;
987
+ let end = string.substring(index + close.length);
988
+ let nextIndex = end.indexOf(close);
989
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
990
+ };
991
+ var bold = formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m");
992
+ var red = formatter("\x1B[31m", "\x1B[39m");
993
+ var green = formatter("\x1B[32m", "\x1B[39m");
994
+ var yellow = formatter("\x1B[33m", "\x1B[39m");
995
+ var magenta = formatter("\x1B[35m", "\x1B[39m");
996
+ var cyan = formatter("\x1B[36m", "\x1B[39m");
997
+ var gray = formatter("\x1B[90m", "\x1B[39m");
998
+ var startColor = [189, 255, 243];
999
+ var endColor = [74, 194, 154];
1000
+ var isWord = (char) => !/[\s\n]/.test(char);
1001
+ var gradient = (message) => {
1002
+ if (colorLevel < 3) {
1003
+ return colorLevel === 2 ? bold(cyan(message)) : message;
1004
+ }
1005
+ let chars = [...message];
1006
+ let steps = chars.filter(isWord).length;
1007
+ let r2 = startColor[0];
1008
+ let g2 = startColor[1];
1009
+ let b3 = startColor[2];
1010
+ let rStep = (endColor[0] - r2) / steps;
1011
+ let gStep = (endColor[1] - g2) / steps;
1012
+ let bStep = (endColor[2] - b3) / steps;
1013
+ let output = "";
1014
+ for (let char of chars) {
1015
+ if (isWord(char)) {
1016
+ r2 += rStep;
1017
+ g2 += gStep;
1018
+ b3 += bStep;
1019
+ }
1020
+ output += `\x1B[38;2;${Math.round(r2)};${Math.round(g2)};${Math.round(
1021
+ b3
1022
+ )}m${char}\x1B[39m`;
1023
+ }
1024
+ return bold(output);
1025
+ };
1026
+ var LOG_LEVEL = {
1027
+ error: 0,
1028
+ warn: 1,
1029
+ info: 2,
1030
+ log: 3,
1031
+ verbose: 4
1032
+ };
1033
+ var LOG_TYPES = {
1034
+ // Level error
1035
+ error: {
1036
+ label: "error",
1037
+ level: "error",
1038
+ color: red
1039
+ },
1040
+ // Level warn
1041
+ warn: {
1042
+ label: "warn",
1043
+ level: "warn",
1044
+ color: yellow
1045
+ },
1046
+ // Level info
1047
+ info: {
1048
+ label: "info",
1049
+ level: "info",
1050
+ color: cyan
1051
+ },
1052
+ start: {
1053
+ label: "start",
1054
+ level: "info",
1055
+ color: cyan
1056
+ },
1057
+ ready: {
1058
+ label: "ready",
1059
+ level: "info",
1060
+ color: green
1061
+ },
1062
+ success: {
1063
+ label: "success",
1064
+ level: "info",
1065
+ color: green
1066
+ },
1067
+ // Level log
1068
+ log: {
1069
+ level: "log"
1070
+ },
1071
+ // Level debug
1072
+ debug: {
1073
+ label: "debug",
1074
+ level: "verbose",
1075
+ color: magenta
1076
+ }
1077
+ };
1078
+ var createLogger = (options = {}) => {
1079
+ let maxLevel = options.level || "log";
1080
+ let log = (type, message, ...args) => {
1081
+ if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) {
1082
+ return;
1083
+ }
1084
+ if (message === void 0 || message === null) {
1085
+ return console.log();
1086
+ }
1087
+ let logType = LOG_TYPES[type];
1088
+ let label = "";
1089
+ let text = "";
1090
+ if ("label" in logType) {
1091
+ label = (logType.label || "").padEnd(7);
1092
+ label = bold(logType.color ? logType.color(label) : label);
1093
+ }
1094
+ if (message instanceof Error) {
1095
+ if (message.stack) {
1096
+ let [name, ...rest] = message.stack.split("\n");
1097
+ if (name.startsWith("Error: ")) {
1098
+ name = name.slice(7);
1099
+ }
1100
+ text = `${name}
1101
+ ${gray(rest.join("\n"))}`;
1102
+ } else {
1103
+ text = message.message;
1104
+ }
1105
+ } else if (logType.level === "error" && typeof message === "string") {
1106
+ let lines = message.split("\n");
1107
+ text = lines.map((line) => isErrorStackMessage(line) ? gray(line) : line).join("\n");
1108
+ } else {
1109
+ text = `${message}`;
1110
+ }
1111
+ console.log(label.length ? `${label} ${text}` : text, ...args);
1112
+ };
1113
+ let logger2 = {
1114
+ greet: (message) => log("log", gradient(message))
1115
+ };
1116
+ Object.keys(LOG_TYPES).forEach((key) => {
1117
+ logger2[key] = (...args) => log(key, ...args);
1118
+ });
1119
+ Object.defineProperty(logger2, "level", {
1120
+ get: () => maxLevel,
1121
+ set(val) {
1122
+ maxLevel = val;
1123
+ }
1124
+ });
1125
+ logger2.override = (customLogger) => {
1126
+ Object.assign(logger2, customLogger);
1127
+ };
1128
+ return logger2;
1129
+ };
1130
+ var logger = createLogger();
1131
+
1132
+ // src/index.ts
1133
+ function cancelAndExit() {
1134
+ ue("Operation cancelled.");
1135
+ process.exit(0);
1136
+ }
29
1137
  function checkCancel(value) {
30
- if ((0, import_prompts.isCancel)(value)) {
31
- (0, import_prompts.cancel)("Operation cancelled.");
32
- process.exit(0);
1138
+ if (hD(value)) {
1139
+ cancelAndExit();
33
1140
  }
1141
+ return value;
34
1142
  }
35
- function formatTargetDir(targetDir) {
36
- return targetDir.trim().replace(/\/+$/g, "");
1143
+ function formatProjectName(input) {
1144
+ const formatted = input.trim().replace(/\/+$/g, "");
1145
+ return {
1146
+ packageName: formatted.startsWith("@") ? formatted : path2.basename(formatted),
1147
+ targetDir: formatted
1148
+ };
37
1149
  }
38
1150
  function pkgFromUserAgent(userAgent) {
39
1151
  if (!userAgent)
@@ -45,89 +1157,177 @@ function pkgFromUserAgent(userAgent) {
45
1157
  version: pkgSpecArr[1]
46
1158
  };
47
1159
  }
1160
+ function isEmptyDir(path3) {
1161
+ const files = fs.readdirSync(path3);
1162
+ return files.length === 0 || files.length === 1 && files[0] === ".git";
1163
+ }
48
1164
  async function main() {
49
1165
  console.log("");
50
- import_rslog.logger.greet("◆ Create Rsbuild Project");
1166
+ logger.greet("◆ Create Rsbuild Project");
51
1167
  const cwd = process.cwd();
52
1168
  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
53
1169
  const pkgManager = pkgInfo ? pkgInfo.name : "npm";
54
- const packageRoot = import_path.default.resolve(__dirname, "..");
55
- const packageJsonPath = import_path.default.join(packageRoot, "package.json");
56
- const { version } = require(packageJsonPath);
57
- let targetDir = await (0, import_prompts.text)({
58
- message: "Input target folder",
59
- placeholder: "my-project",
60
- validate(value) {
61
- if (value.length === 0) {
62
- return `Target folder is required`;
63
- }
64
- if (import_fs.default.existsSync(import_path.default.join(cwd, value))) {
65
- return `"${value}" is not empty, please input another folder`;
1170
+ const packageRoot = path2.resolve(__dirname, "..");
1171
+ const packageJsonPath = path2.join(packageRoot, "package.json");
1172
+ const { version } = __require(packageJsonPath);
1173
+ const projectName = checkCancel(
1174
+ await te({
1175
+ message: "Project name or path",
1176
+ placeholder: "rsbuild-project",
1177
+ defaultValue: "rsbuild-project",
1178
+ validate(value) {
1179
+ if (value.length === 0) {
1180
+ return "Project name is required";
1181
+ }
66
1182
  }
1183
+ })
1184
+ );
1185
+ const { targetDir, packageName } = formatProjectName(projectName);
1186
+ const distFolder = path2.isAbsolute(targetDir) ? targetDir : path2.join(cwd, targetDir);
1187
+ if (fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
1188
+ const option = checkCancel(
1189
+ await ie({
1190
+ message: `"${targetDir}" is not empty, please choose:`,
1191
+ options: [
1192
+ { value: "yes", label: "Continue and override files" },
1193
+ { value: "no", label: "Cancel operation" }
1194
+ ]
1195
+ })
1196
+ );
1197
+ if (option === "no") {
1198
+ cancelAndExit();
67
1199
  }
68
- });
69
- checkCancel(targetDir);
70
- targetDir = formatTargetDir(targetDir);
71
- const framework = await (0, import_prompts.select)({
72
- message: "Select framework",
73
- options: [
74
- { value: "react", label: "React" },
75
- { value: "vue3", label: "Vue 3" },
76
- { value: "vue2", label: "Vue 2" },
77
- { value: "lit", label: "Lit" },
78
- { value: "svelte", label: "Svelte" },
79
- { value: "solid", label: "Solid" },
80
- { value: "vanilla", label: "Vanilla" }
81
- ]
82
- });
83
- checkCancel(framework);
84
- const language = await (0, import_prompts.select)({
85
- message: "Select language",
86
- options: [
87
- { value: "ts", label: "TypeScript" },
88
- { value: "js", label: "JavaScript" }
89
- ]
90
- });
91
- checkCancel(language);
92
- const srcFolder = import_path.default.join(packageRoot, `template-${framework}-${language}`);
93
- const commonFolder = import_path.default.join(packageRoot, `template-common`);
94
- const distFolder = import_path.default.join(cwd, targetDir);
1200
+ }
1201
+ const framework = checkCancel(
1202
+ await ie({
1203
+ message: "Select framework",
1204
+ options: [
1205
+ { value: "react", label: "React" },
1206
+ { value: "vue3", label: "Vue 3" },
1207
+ { value: "vue2", label: "Vue 2" },
1208
+ { value: "lit", label: "Lit" },
1209
+ { value: "preact", label: "Preact" },
1210
+ { value: "svelte", label: "Svelte" },
1211
+ { value: "solid", label: "Solid" },
1212
+ { value: "vanilla", label: "Vanilla" }
1213
+ ]
1214
+ })
1215
+ );
1216
+ const language = checkCancel(
1217
+ await ie({
1218
+ message: "Select language",
1219
+ options: [
1220
+ { value: "ts", label: "TypeScript" },
1221
+ { value: "js", label: "JavaScript" }
1222
+ ]
1223
+ })
1224
+ );
1225
+ const tools = checkCancel(
1226
+ await ae({
1227
+ message: "Select additional tools (press enter to continue)",
1228
+ options: [
1229
+ { value: "biome", label: "Add Biome for code linting and formatting" },
1230
+ { value: "eslint", label: "Add ESLint for code linting" },
1231
+ { value: "prettier", label: "Add Prettier for code formatting" }
1232
+ ],
1233
+ required: false
1234
+ })
1235
+ );
1236
+ const srcFolder = path2.join(packageRoot, `template-${framework}-${language}`);
1237
+ const commonFolder = path2.join(packageRoot, "template-common");
95
1238
  copyFolder(commonFolder, distFolder, version);
96
- copyFolder(srcFolder, distFolder, version);
1239
+ copyFolder(srcFolder, distFolder, version, packageName);
1240
+ for (const tool of tools) {
1241
+ const toolFolder = path2.join(packageRoot, `template-${tool}`);
1242
+ if (tool === "eslint") {
1243
+ let subFolder = path2.join(toolFolder, `${framework}-${language}`);
1244
+ if (!fs.existsSync(subFolder)) {
1245
+ subFolder = path2.join(toolFolder, `common-${language}`);
1246
+ }
1247
+ copyFolder(subFolder, distFolder, version);
1248
+ } else {
1249
+ copyFolder(toolFolder, distFolder, version);
1250
+ }
1251
+ }
97
1252
  const nextSteps = [
98
1253
  `cd ${targetDir}`,
99
1254
  `${pkgManager} i`,
100
1255
  `${pkgManager} run dev`
101
1256
  ];
102
- (0, import_prompts.note)(nextSteps.join("\n"), "Next steps");
103
- (0, import_prompts.outro)("Done.");
1257
+ le(nextSteps.join("\n"), "Next steps");
1258
+ $e("Done.");
104
1259
  }
105
- function copyFolder(src, dist, version) {
1260
+ function sortObjectKeys(obj) {
1261
+ const sortedKeys = Object.keys(obj).sort();
1262
+ const sortedObj = {};
1263
+ for (const key of sortedKeys) {
1264
+ sortedObj[key] = obj[key];
1265
+ }
1266
+ return sortedObj;
1267
+ }
1268
+ function mergePackageJson(targetPackage, extraPackage) {
1269
+ if (!fs.existsSync(targetPackage)) {
1270
+ return;
1271
+ }
1272
+ const targetJson = JSON.parse(fs.readFileSync(targetPackage, "utf-8"));
1273
+ const extraJson = JSON.parse(fs.readFileSync(extraPackage, "utf-8"));
1274
+ const mergedJson = (0, import_deepmerge.default)(targetJson, extraJson);
1275
+ mergedJson.name = targetJson.name || extraJson.name;
1276
+ for (const key of ["scripts", "dependencies", "devDependencies"]) {
1277
+ if (!(key in mergedJson)) {
1278
+ continue;
1279
+ }
1280
+ mergedJson[key] = sortObjectKeys(
1281
+ mergedJson[key]
1282
+ );
1283
+ }
1284
+ fs.writeFileSync(targetPackage, `${JSON.stringify(mergedJson, null, 2)}
1285
+ `);
1286
+ }
1287
+ function copyFolder(src, dist, version, name) {
106
1288
  const renameFiles = {
107
1289
  gitignore: ".gitignore"
108
1290
  };
109
1291
  const skipFiles = ["node_modules", "dist"];
110
- import_fs.default.mkdirSync(dist, { recursive: true });
111
- for (const file of import_fs.default.readdirSync(src)) {
1292
+ fs.mkdirSync(dist, { recursive: true });
1293
+ for (const file of fs.readdirSync(src)) {
112
1294
  if (skipFiles.includes(file)) {
113
1295
  continue;
114
1296
  }
115
- const srcFile = import_path.default.resolve(src, file);
116
- const distFile = renameFiles[file] ? import_path.default.resolve(dist, renameFiles[file]) : import_path.default.resolve(dist, file);
117
- const stat = import_fs.default.statSync(srcFile);
1297
+ const srcFile = path2.resolve(src, file);
1298
+ const distFile = renameFiles[file] ? path2.resolve(dist, renameFiles[file]) : path2.resolve(dist, file);
1299
+ const stat = fs.statSync(srcFile);
118
1300
  if (stat.isDirectory()) {
119
1301
  copyFolder(srcFile, distFile, version);
120
- } else {
121
- import_fs.default.copyFileSync(srcFile, distFile);
122
- if (file === "package.json") {
123
- replaceVersion(distFile, version);
1302
+ } else if (file === "package.json") {
1303
+ const targetPackage = path2.resolve(dist, "package.json");
1304
+ if (fs.existsSync(targetPackage)) {
1305
+ mergePackageJson(targetPackage, srcFile);
1306
+ } else {
1307
+ fs.copyFileSync(srcFile, distFile);
1308
+ updatePackageJson(distFile, version, name);
124
1309
  }
1310
+ } else {
1311
+ fs.copyFileSync(srcFile, distFile);
125
1312
  }
126
1313
  }
127
1314
  }
128
- const replaceVersion = (pkgJsonPath, version) => {
129
- let content = import_fs.default.readFileSync(pkgJsonPath, "utf-8");
130
- content = content.replace(/workspace:\*/g, `^${version}`);
131
- import_fs.default.writeFileSync(pkgJsonPath, content);
1315
+ var isStableVersion = (version) => {
1316
+ return ["alpha", "beta", "rc", "canary", "nightly"].every(
1317
+ (tag) => !version.includes(tag)
1318
+ );
1319
+ };
1320
+ var updatePackageJson = (pkgJsonPath, version, name) => {
1321
+ let content = fs.readFileSync(pkgJsonPath, "utf-8");
1322
+ const targetVersion = isStableVersion(version) ? `^${version}` : version;
1323
+ content = content.replace(/workspace:\*/g, targetVersion);
1324
+ const pkg = JSON.parse(content);
1325
+ if (name && name !== ".") {
1326
+ pkg.name = name;
1327
+ }
1328
+ fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2));
132
1329
  };
133
1330
  main();
1331
+ export {
1332
+ main
1333
+ };