@mbsi/mkcmd 0.2.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/index.js ADDED
@@ -0,0 +1,2308 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var __create = Object.create;
4
+ var __getProtoOf = Object.getPrototypeOf;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __toESM = (mod, isNodeMode, target) => {
9
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
10
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
+ for (let key of __getOwnPropNames(mod))
12
+ if (!__hasOwnProp.call(to, key))
13
+ __defProp(to, key, {
14
+ get: () => mod[key],
15
+ enumerable: true
16
+ });
17
+ return to;
18
+ };
19
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
20
+
21
+ // node_modules/sisteransi/src/index.js
22
+ var require_src = __commonJS((exports, module) => {
23
+ var ESC = "\x1B";
24
+ var CSI = `${ESC}[`;
25
+ var beep = "\x07";
26
+ var cursor = {
27
+ to(x, y) {
28
+ if (!y)
29
+ return `${CSI}${x + 1}G`;
30
+ return `${CSI}${y + 1};${x + 1}H`;
31
+ },
32
+ move(x, y) {
33
+ let ret = "";
34
+ if (x < 0)
35
+ ret += `${CSI}${-x}D`;
36
+ else if (x > 0)
37
+ ret += `${CSI}${x}C`;
38
+ if (y < 0)
39
+ ret += `${CSI}${-y}A`;
40
+ else if (y > 0)
41
+ ret += `${CSI}${y}B`;
42
+ return ret;
43
+ },
44
+ up: (count = 1) => `${CSI}${count}A`,
45
+ down: (count = 1) => `${CSI}${count}B`,
46
+ forward: (count = 1) => `${CSI}${count}C`,
47
+ backward: (count = 1) => `${CSI}${count}D`,
48
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
49
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
50
+ left: `${CSI}G`,
51
+ hide: `${CSI}?25l`,
52
+ show: `${CSI}?25h`,
53
+ save: `${ESC}7`,
54
+ restore: `${ESC}8`
55
+ };
56
+ var scroll = {
57
+ up: (count = 1) => `${CSI}S`.repeat(count),
58
+ down: (count = 1) => `${CSI}T`.repeat(count)
59
+ };
60
+ var erase = {
61
+ screen: `${CSI}2J`,
62
+ up: (count = 1) => `${CSI}1J`.repeat(count),
63
+ down: (count = 1) => `${CSI}J`.repeat(count),
64
+ line: `${CSI}2K`,
65
+ lineEnd: `${CSI}K`,
66
+ lineStart: `${CSI}1K`,
67
+ lines(count) {
68
+ let clear = "";
69
+ for (let i = 0;i < count; i++)
70
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
71
+ if (count)
72
+ clear += cursor.left;
73
+ return clear;
74
+ }
75
+ };
76
+ module.exports = { cursor, scroll, erase, beep };
77
+ });
78
+
79
+ // node_modules/picocolors/picocolors.js
80
+ var require_picocolors = __commonJS((exports, module) => {
81
+ var p = process || {};
82
+ var argv = p.argv || [];
83
+ var env = p.env || {};
84
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
85
+ var formatter = (open, close, replace = open) => (input) => {
86
+ let string = "" + input, index = string.indexOf(close, open.length);
87
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
88
+ };
89
+ var replaceClose = (string, close, replace, index) => {
90
+ let result = "", cursor = 0;
91
+ do {
92
+ result += string.substring(cursor, index) + replace;
93
+ cursor = index + close.length;
94
+ index = string.indexOf(close, cursor);
95
+ } while (~index);
96
+ return result + string.substring(cursor);
97
+ };
98
+ var createColors = (enabled = isColorSupported) => {
99
+ let f = enabled ? formatter : () => String;
100
+ return {
101
+ isColorSupported: enabled,
102
+ reset: f("\x1B[0m", "\x1B[0m"),
103
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
104
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
105
+ italic: f("\x1B[3m", "\x1B[23m"),
106
+ underline: f("\x1B[4m", "\x1B[24m"),
107
+ inverse: f("\x1B[7m", "\x1B[27m"),
108
+ hidden: f("\x1B[8m", "\x1B[28m"),
109
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
110
+ black: f("\x1B[30m", "\x1B[39m"),
111
+ red: f("\x1B[31m", "\x1B[39m"),
112
+ green: f("\x1B[32m", "\x1B[39m"),
113
+ yellow: f("\x1B[33m", "\x1B[39m"),
114
+ blue: f("\x1B[34m", "\x1B[39m"),
115
+ magenta: f("\x1B[35m", "\x1B[39m"),
116
+ cyan: f("\x1B[36m", "\x1B[39m"),
117
+ white: f("\x1B[37m", "\x1B[39m"),
118
+ gray: f("\x1B[90m", "\x1B[39m"),
119
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
120
+ bgRed: f("\x1B[41m", "\x1B[49m"),
121
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
122
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
123
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
124
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
125
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
126
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
127
+ blackBright: f("\x1B[90m", "\x1B[39m"),
128
+ redBright: f("\x1B[91m", "\x1B[39m"),
129
+ greenBright: f("\x1B[92m", "\x1B[39m"),
130
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
131
+ blueBright: f("\x1B[94m", "\x1B[39m"),
132
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
133
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
134
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
135
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
136
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
137
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
138
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
139
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
140
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
141
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
142
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
143
+ };
144
+ };
145
+ module.exports = createColors();
146
+ module.exports.createColors = createColors;
147
+ });
148
+
149
+ // node_modules/figlet/dist/node-figlet.mjs
150
+ import * as fs from "fs";
151
+ import * as path from "path";
152
+
153
+ // node_modules/figlet/dist/figlet.mjs
154
+ var LAYOUT = {
155
+ FULL_WIDTH: 0,
156
+ FITTING: 1,
157
+ SMUSHING: 2,
158
+ CONTROLLED_SMUSHING: 3
159
+ };
160
+
161
+ class FigletFont {
162
+ constructor() {
163
+ this.comment = "";
164
+ this.numChars = 0;
165
+ this.options = {};
166
+ }
167
+ }
168
+ var fontList = [
169
+ "1Row",
170
+ "3-D",
171
+ "3D Diagonal",
172
+ "3D-ASCII",
173
+ "3x5",
174
+ "4Max",
175
+ "5 Line Oblique",
176
+ "AMC 3 Line",
177
+ "AMC 3 Liv1",
178
+ "AMC AAA01",
179
+ "AMC Neko",
180
+ "AMC Razor",
181
+ "AMC Razor2",
182
+ "AMC Slash",
183
+ "AMC Slider",
184
+ "AMC Thin",
185
+ "AMC Tubes",
186
+ "AMC Untitled",
187
+ "ANSI Regular",
188
+ "ANSI Shadow",
189
+ "ANSI-Compact",
190
+ "ASCII 12",
191
+ "ASCII 9",
192
+ "ASCII New Roman",
193
+ "Acrobatic",
194
+ "Alligator",
195
+ "Alligator2",
196
+ "Alpha",
197
+ "Alphabet",
198
+ "Arrows",
199
+ "Avatar",
200
+ "B1FF",
201
+ "Babyface Lame",
202
+ "Babyface Leet",
203
+ "Banner",
204
+ "Banner3-D",
205
+ "Banner3",
206
+ "Banner4",
207
+ "Barbwire",
208
+ "Basic",
209
+ "Bear",
210
+ "Bell",
211
+ "Benjamin",
212
+ "Big ASCII 12",
213
+ "Big ASCII 9",
214
+ "Big Chief",
215
+ "Big Money-ne",
216
+ "Big Money-nw",
217
+ "Big Money-se",
218
+ "Big Money-sw",
219
+ "Big Mono 12",
220
+ "Big Mono 9",
221
+ "Big",
222
+ "Bigfig",
223
+ "Binary",
224
+ "Block",
225
+ "Blocks",
226
+ "Bloody",
227
+ "BlurVision ASCII",
228
+ "Bolger",
229
+ "Braced",
230
+ "Bright",
231
+ "Broadway KB",
232
+ "Broadway",
233
+ "Bubble",
234
+ "Bulbhead",
235
+ "Caligraphy",
236
+ "Caligraphy2",
237
+ "Calvin S",
238
+ "Cards",
239
+ "Catwalk",
240
+ "Chiseled",
241
+ "Chunky",
242
+ "Circle",
243
+ "Coinstak",
244
+ "Cola",
245
+ "Colossal",
246
+ "Computer",
247
+ "Contessa",
248
+ "Contrast",
249
+ "Cosmike",
250
+ "Cosmike2",
251
+ "Crawford",
252
+ "Crawford2",
253
+ "Crazy",
254
+ "Cricket",
255
+ "Cursive",
256
+ "Cyberlarge",
257
+ "Cybermedium",
258
+ "Cybersmall",
259
+ "Cygnet",
260
+ "DANC4",
261
+ "DOS Rebel",
262
+ "DWhistled",
263
+ "Dancing Font",
264
+ "Decimal",
265
+ "Def Leppard",
266
+ "Delta Corps Priest 1",
267
+ "DiamFont",
268
+ "Diamond",
269
+ "Diet Cola",
270
+ "Digital",
271
+ "Doh",
272
+ "Doom",
273
+ "Dot Matrix",
274
+ "Double Shorts",
275
+ "Double",
276
+ "Dr Pepper",
277
+ "Efti Chess",
278
+ "Efti Font",
279
+ "Efti Italic",
280
+ "Efti Piti",
281
+ "Efti Robot",
282
+ "Efti Wall",
283
+ "Efti Water",
284
+ "Electronic",
285
+ "Elite",
286
+ "Emboss 2",
287
+ "Emboss",
288
+ "Epic",
289
+ "Fender",
290
+ "Filter",
291
+ "Fire Font-k",
292
+ "Fire Font-s",
293
+ "Flipped",
294
+ "Flower Power",
295
+ "Four Tops",
296
+ "Fraktur",
297
+ "Fun Face",
298
+ "Fun Faces",
299
+ "Future",
300
+ "Fuzzy",
301
+ "Georgi16",
302
+ "Georgia11",
303
+ "Ghost",
304
+ "Ghoulish",
305
+ "Glenyn",
306
+ "Goofy",
307
+ "Gothic",
308
+ "Graceful",
309
+ "Gradient",
310
+ "Graffiti",
311
+ "Greek",
312
+ "Heart Left",
313
+ "Heart Right",
314
+ "Henry 3D",
315
+ "Hex",
316
+ "Hieroglyphs",
317
+ "Hollywood",
318
+ "Horizontal Left",
319
+ "Horizontal Right",
320
+ "ICL-1900",
321
+ "Impossible",
322
+ "Invita",
323
+ "Isometric1",
324
+ "Isometric2",
325
+ "Isometric3",
326
+ "Isometric4",
327
+ "Italic",
328
+ "Ivrit",
329
+ "JS Block Letters",
330
+ "JS Bracket Letters",
331
+ "JS Capital Curves",
332
+ "JS Cursive",
333
+ "JS Stick Letters",
334
+ "Jacky",
335
+ "Jazmine",
336
+ "Jerusalem",
337
+ "Katakana",
338
+ "Kban",
339
+ "Keyboard",
340
+ "Knob",
341
+ "Konto Slant",
342
+ "Konto",
343
+ "LCD",
344
+ "Larry 3D 2",
345
+ "Larry 3D",
346
+ "Lean",
347
+ "Letter",
348
+ "Letters",
349
+ "Lil Devil",
350
+ "Line Blocks",
351
+ "Linux",
352
+ "Lockergnome",
353
+ "Madrid",
354
+ "Marquee",
355
+ "Maxfour",
356
+ "Merlin1",
357
+ "Merlin2",
358
+ "Mike",
359
+ "Mini",
360
+ "Mirror",
361
+ "Mnemonic",
362
+ "Modular",
363
+ "Mono 12",
364
+ "Mono 9",
365
+ "Morse",
366
+ "Morse2",
367
+ "Moscow",
368
+ "Mshebrew210",
369
+ "Muzzle",
370
+ "NScript",
371
+ "NT Greek",
372
+ "NV Script",
373
+ "Nancyj-Fancy",
374
+ "Nancyj-Improved",
375
+ "Nancyj-Underlined",
376
+ "Nancyj",
377
+ "Nipples",
378
+ "O8",
379
+ "OS2",
380
+ "Octal",
381
+ "Ogre",
382
+ "Old Banner",
383
+ "Pagga",
384
+ "Patorjk's Cheese",
385
+ "Patorjk-HeX",
386
+ "Pawp",
387
+ "Peaks Slant",
388
+ "Peaks",
389
+ "Pebbles",
390
+ "Pepper",
391
+ "Poison",
392
+ "Puffy",
393
+ "Puzzle",
394
+ "Pyramid",
395
+ "Rammstein",
396
+ "Rebel",
397
+ "Rectangles",
398
+ "Red Phoenix",
399
+ "Relief",
400
+ "Relief2",
401
+ "Reverse",
402
+ "Roman",
403
+ "Rot13",
404
+ "Rotated",
405
+ "Rounded",
406
+ "Rowan Cap",
407
+ "Rozzo",
408
+ "RubiFont",
409
+ "Runic",
410
+ "Runyc",
411
+ "S Blood",
412
+ "SL Script",
413
+ "Santa Clara",
414
+ "Script",
415
+ "Serifcap",
416
+ "Shaded Blocky",
417
+ "Shadow",
418
+ "Shimrod",
419
+ "Short",
420
+ "Slant Relief",
421
+ "Slant",
422
+ "Slide",
423
+ "Small ASCII 12",
424
+ "Small ASCII 9",
425
+ "Small Block",
426
+ "Small Braille",
427
+ "Small Caps",
428
+ "Small Isometric1",
429
+ "Small Keyboard",
430
+ "Small Mono 12",
431
+ "Small Mono 9",
432
+ "Small Poison",
433
+ "Small Script",
434
+ "Small Shadow",
435
+ "Small Slant",
436
+ "Small Tengwar",
437
+ "Small",
438
+ "Soft",
439
+ "Speed",
440
+ "Spliff",
441
+ "Stacey",
442
+ "Stampate",
443
+ "Stampatello",
444
+ "Standard",
445
+ "Star Strips",
446
+ "Star Wars",
447
+ "Stellar",
448
+ "Stforek",
449
+ "Stick Letters",
450
+ "Stop",
451
+ "Straight",
452
+ "Stronger Than All",
453
+ "Sub-Zero",
454
+ "Swamp Land",
455
+ "Swan",
456
+ "Sweet",
457
+ "THIS",
458
+ "Tanja",
459
+ "Tengwar",
460
+ "Term",
461
+ "Terrace",
462
+ "Test1",
463
+ "The Edge",
464
+ "Thick",
465
+ "Thin",
466
+ "Thorned",
467
+ "Three Point",
468
+ "Ticks Slant",
469
+ "Ticks",
470
+ "Tiles",
471
+ "Tinker-Toy",
472
+ "Tmplr",
473
+ "Tombstone",
474
+ "Train",
475
+ "Trek",
476
+ "Tsalagi",
477
+ "Tubular",
478
+ "Twisted",
479
+ "Two Point",
480
+ "USA Flag",
481
+ "Univers",
482
+ "Upside Down Text",
483
+ "Varsity",
484
+ "Wavescape",
485
+ "Wavy",
486
+ "Weird",
487
+ "Wet Letter",
488
+ "Whimsy",
489
+ "WideTerm",
490
+ "Wow",
491
+ "miniwi"
492
+ ];
493
+ function escapeRegExpChar(char) {
494
+ const specialChars = /[.*+?^${}()|[\]\\]/;
495
+ return specialChars.test(char) ? "\\" + char : char;
496
+ }
497
+ var figlet = (() => {
498
+ const { FULL_WIDTH = 0, FITTING, SMUSHING, CONTROLLED_SMUSHING } = LAYOUT;
499
+ const figFonts = {};
500
+ const figDefaults = {
501
+ font: "Standard",
502
+ fontPath: "./fonts",
503
+ fetchFontIfMissing: true
504
+ };
505
+ function removeEndChar(line, lineNum, fontHeight) {
506
+ const endChar = escapeRegExpChar(line.trim().slice(-1)) || "@";
507
+ const endCharRegEx = lineNum === fontHeight - 1 ? new RegExp(endChar + endChar + "?\\s*$") : new RegExp(endChar + "\\s*$");
508
+ return line.replace(endCharRegEx, "");
509
+ }
510
+ function getSmushingRules(oldLayout = -1, newLayout = null) {
511
+ let rules = {};
512
+ let val;
513
+ let codes = [
514
+ [16384, "vLayout", SMUSHING],
515
+ [8192, "vLayout", FITTING],
516
+ [4096, "vRule5", true],
517
+ [2048, "vRule4", true],
518
+ [1024, "vRule3", true],
519
+ [512, "vRule2", true],
520
+ [256, "vRule1", true],
521
+ [128, "hLayout", SMUSHING],
522
+ [64, "hLayout", FITTING],
523
+ [32, "hRule6", true],
524
+ [16, "hRule5", true],
525
+ [8, "hRule4", true],
526
+ [4, "hRule3", true],
527
+ [2, "hRule2", true],
528
+ [1, "hRule1", true]
529
+ ];
530
+ val = newLayout !== null ? newLayout : oldLayout;
531
+ for (const [code, rule, value] of codes) {
532
+ if (val >= code) {
533
+ val -= code;
534
+ if (rules[rule] === undefined) {
535
+ rules[rule] = value;
536
+ }
537
+ } else if (rule !== "vLayout" && rule !== "hLayout") {
538
+ rules[rule] = false;
539
+ }
540
+ }
541
+ if (typeof rules["hLayout"] === "undefined") {
542
+ if (oldLayout === 0) {
543
+ rules["hLayout"] = FITTING;
544
+ } else if (oldLayout === -1) {
545
+ rules["hLayout"] = FULL_WIDTH;
546
+ } else {
547
+ if (rules["hRule1"] || rules["hRule2"] || rules["hRule3"] || rules["hRule4"] || rules["hRule5"] || rules["hRule6"]) {
548
+ rules["hLayout"] = CONTROLLED_SMUSHING;
549
+ } else {
550
+ rules["hLayout"] = SMUSHING;
551
+ }
552
+ }
553
+ } else if (rules["hLayout"] === SMUSHING) {
554
+ if (rules["hRule1"] || rules["hRule2"] || rules["hRule3"] || rules["hRule4"] || rules["hRule5"] || rules["hRule6"]) {
555
+ rules["hLayout"] = CONTROLLED_SMUSHING;
556
+ }
557
+ }
558
+ if (typeof rules["vLayout"] === "undefined") {
559
+ if (rules["vRule1"] || rules["vRule2"] || rules["vRule3"] || rules["vRule4"] || rules["vRule5"]) {
560
+ rules["vLayout"] = CONTROLLED_SMUSHING;
561
+ } else {
562
+ rules["vLayout"] = FULL_WIDTH;
563
+ }
564
+ } else if (rules["vLayout"] === SMUSHING) {
565
+ if (rules["vRule1"] || rules["vRule2"] || rules["vRule3"] || rules["vRule4"] || rules["vRule5"]) {
566
+ rules["vLayout"] = CONTROLLED_SMUSHING;
567
+ }
568
+ }
569
+ return rules;
570
+ }
571
+ function hRule1_Smush(ch1, ch2, hardBlank = "") {
572
+ if (ch1 === ch2 && ch1 !== hardBlank) {
573
+ return ch1;
574
+ }
575
+ return false;
576
+ }
577
+ function hRule2_Smush(ch1, ch2) {
578
+ let rule2Str = "|/\\[]{}()<>";
579
+ if (ch1 === "_") {
580
+ if (rule2Str.indexOf(ch2) !== -1) {
581
+ return ch2;
582
+ }
583
+ } else if (ch2 === "_") {
584
+ if (rule2Str.indexOf(ch1) !== -1) {
585
+ return ch1;
586
+ }
587
+ }
588
+ return false;
589
+ }
590
+ function hRule3_Smush(ch1, ch2) {
591
+ let rule3Classes = "| /\\ [] {} () <>";
592
+ let r3_pos1 = rule3Classes.indexOf(ch1);
593
+ let r3_pos2 = rule3Classes.indexOf(ch2);
594
+ if (r3_pos1 !== -1 && r3_pos2 !== -1) {
595
+ if (r3_pos1 !== r3_pos2 && Math.abs(r3_pos1 - r3_pos2) !== 1) {
596
+ const startPos = Math.max(r3_pos1, r3_pos2);
597
+ const endPos = startPos + 1;
598
+ return rule3Classes.substring(startPos, endPos);
599
+ }
600
+ }
601
+ return false;
602
+ }
603
+ function hRule4_Smush(ch1, ch2) {
604
+ let rule4Str = "[] {} ()";
605
+ let r4_pos1 = rule4Str.indexOf(ch1);
606
+ let r4_pos2 = rule4Str.indexOf(ch2);
607
+ if (r4_pos1 !== -1 && r4_pos2 !== -1) {
608
+ if (Math.abs(r4_pos1 - r4_pos2) <= 1) {
609
+ return "|";
610
+ }
611
+ }
612
+ return false;
613
+ }
614
+ function hRule5_Smush(ch1, ch2) {
615
+ const patterns = {
616
+ "/\\": "|",
617
+ "\\/": "Y",
618
+ "><": "X"
619
+ };
620
+ return patterns[ch1 + ch2] || false;
621
+ }
622
+ function hRule6_Smush(ch1, ch2, hardBlank = "") {
623
+ if (ch1 === hardBlank && ch2 === hardBlank) {
624
+ return hardBlank;
625
+ }
626
+ return false;
627
+ }
628
+ function vRule1_Smush(ch1, ch2) {
629
+ if (ch1 === ch2) {
630
+ return ch1;
631
+ }
632
+ return false;
633
+ }
634
+ function vRule2_Smush(ch1, ch2) {
635
+ return hRule2_Smush(ch1, ch2);
636
+ }
637
+ function vRule3_Smush(ch1, ch2) {
638
+ return hRule3_Smush(ch1, ch2);
639
+ }
640
+ function vRule4_Smush(ch1, ch2) {
641
+ if (ch1 === "-" && ch2 === "_" || ch1 === "_" && ch2 === "-") {
642
+ return "=";
643
+ }
644
+ return false;
645
+ }
646
+ function vRule5_Smush(ch1, ch2) {
647
+ if (ch1 === "|" && ch2 === "|") {
648
+ return "|";
649
+ }
650
+ return false;
651
+ }
652
+ function uni_Smush(ch1, ch2, hardBlank) {
653
+ if (ch2 === " " || ch2 === "") {
654
+ return ch1;
655
+ } else if (ch2 === hardBlank && ch1 !== " ") {
656
+ return ch1;
657
+ } else {
658
+ return ch2;
659
+ }
660
+ }
661
+ function canVerticalSmush(txt1, txt2, opts) {
662
+ if (opts.fittingRules && opts.fittingRules.vLayout === FULL_WIDTH) {
663
+ return "invalid";
664
+ }
665
+ let ii, len = Math.min(txt1.length, txt2.length), ch1, ch2, endSmush = false, validSmush;
666
+ if (len === 0) {
667
+ return "invalid";
668
+ }
669
+ for (ii = 0;ii < len; ii++) {
670
+ ch1 = txt1.substring(ii, ii + 1);
671
+ ch2 = txt2.substring(ii, ii + 1);
672
+ if (ch1 !== " " && ch2 !== " ") {
673
+ if (opts.fittingRules && opts.fittingRules.vLayout === FITTING) {
674
+ return "invalid";
675
+ } else if (opts.fittingRules && opts.fittingRules.vLayout === SMUSHING) {
676
+ return "end";
677
+ } else {
678
+ if (vRule5_Smush(ch1, ch2)) {
679
+ endSmush = endSmush || false;
680
+ continue;
681
+ }
682
+ validSmush = false;
683
+ validSmush = opts.fittingRules && opts.fittingRules.vRule1 ? vRule1_Smush(ch1, ch2) : validSmush;
684
+ validSmush = !validSmush && opts.fittingRules && opts.fittingRules.vRule2 ? vRule2_Smush(ch1, ch2) : validSmush;
685
+ validSmush = !validSmush && opts.fittingRules && opts.fittingRules.vRule3 ? vRule3_Smush(ch1, ch2) : validSmush;
686
+ validSmush = !validSmush && opts.fittingRules && opts.fittingRules.vRule4 ? vRule4_Smush(ch1, ch2) : validSmush;
687
+ endSmush = true;
688
+ if (!validSmush) {
689
+ return "invalid";
690
+ }
691
+ }
692
+ }
693
+ }
694
+ if (endSmush) {
695
+ return "end";
696
+ } else {
697
+ return "valid";
698
+ }
699
+ }
700
+ function getVerticalSmushDist(lines1, lines2, opts) {
701
+ let maxDist = lines1.length;
702
+ let len1 = lines1.length;
703
+ let subLines1, subLines2, slen;
704
+ let curDist = 1;
705
+ let ii, ret, result;
706
+ while (curDist <= maxDist) {
707
+ subLines1 = lines1.slice(Math.max(0, len1 - curDist), len1);
708
+ subLines2 = lines2.slice(0, Math.min(maxDist, curDist));
709
+ slen = subLines2.length;
710
+ result = "";
711
+ for (ii = 0;ii < slen; ii++) {
712
+ ret = canVerticalSmush(subLines1[ii], subLines2[ii], opts);
713
+ if (ret === "end") {
714
+ result = ret;
715
+ } else if (ret === "invalid") {
716
+ result = ret;
717
+ break;
718
+ } else {
719
+ if (result === "") {
720
+ result = "valid";
721
+ }
722
+ }
723
+ }
724
+ if (result === "invalid") {
725
+ curDist--;
726
+ break;
727
+ }
728
+ if (result === "end") {
729
+ break;
730
+ }
731
+ if (result === "valid") {
732
+ curDist++;
733
+ }
734
+ }
735
+ return Math.min(maxDist, curDist);
736
+ }
737
+ function verticallySmushLines(line1, line2, opts) {
738
+ let ii, len = Math.min(line1.length, line2.length);
739
+ let ch1, ch2, result = "", validSmush;
740
+ const fittingRules = opts.fittingRules || {};
741
+ for (ii = 0;ii < len; ii++) {
742
+ ch1 = line1.substring(ii, ii + 1);
743
+ ch2 = line2.substring(ii, ii + 1);
744
+ if (ch1 !== " " && ch2 !== " ") {
745
+ if (fittingRules.vLayout === FITTING) {
746
+ result += uni_Smush(ch1, ch2);
747
+ } else if (fittingRules.vLayout === SMUSHING) {
748
+ result += uni_Smush(ch1, ch2);
749
+ } else {
750
+ validSmush = false;
751
+ validSmush = fittingRules.vRule5 ? vRule5_Smush(ch1, ch2) : validSmush;
752
+ validSmush = !validSmush && fittingRules.vRule1 ? vRule1_Smush(ch1, ch2) : validSmush;
753
+ validSmush = !validSmush && fittingRules.vRule2 ? vRule2_Smush(ch1, ch2) : validSmush;
754
+ validSmush = !validSmush && fittingRules.vRule3 ? vRule3_Smush(ch1, ch2) : validSmush;
755
+ validSmush = !validSmush && fittingRules.vRule4 ? vRule4_Smush(ch1, ch2) : validSmush;
756
+ result += validSmush;
757
+ }
758
+ } else {
759
+ result += uni_Smush(ch1, ch2);
760
+ }
761
+ }
762
+ return result;
763
+ }
764
+ function verticalSmush(lines1, lines2, overlap, opts) {
765
+ let len1 = lines1.length;
766
+ let len2 = lines2.length;
767
+ let piece1 = lines1.slice(0, Math.max(0, len1 - overlap));
768
+ let piece2_1 = lines1.slice(Math.max(0, len1 - overlap), len1);
769
+ let piece2_2 = lines2.slice(0, Math.min(overlap, len2));
770
+ let ii, len, line, piece2 = [], piece3;
771
+ len = piece2_1.length;
772
+ for (ii = 0;ii < len; ii++) {
773
+ if (ii >= len2) {
774
+ line = piece2_1[ii];
775
+ } else {
776
+ line = verticallySmushLines(piece2_1[ii], piece2_2[ii], opts);
777
+ }
778
+ piece2.push(line);
779
+ }
780
+ piece3 = lines2.slice(Math.min(overlap, len2), len2);
781
+ return [...piece1, ...piece2, ...piece3];
782
+ }
783
+ function padLines(lines, numSpaces) {
784
+ const padding = " ".repeat(numSpaces);
785
+ return lines.map((line) => line + padding);
786
+ }
787
+ function smushVerticalFigLines(output, lines, opts) {
788
+ let len1 = output[0].length;
789
+ let len2 = lines[0].length;
790
+ let overlap;
791
+ if (len1 > len2) {
792
+ lines = padLines(lines, len1 - len2);
793
+ } else if (len2 > len1) {
794
+ output = padLines(output, len2 - len1);
795
+ }
796
+ overlap = getVerticalSmushDist(output, lines, opts);
797
+ return verticalSmush(output, lines, overlap, opts);
798
+ }
799
+ function getHorizontalSmushLength(txt1, txt2, opts) {
800
+ const fittingRules = opts.fittingRules || {};
801
+ if (fittingRules.hLayout === FULL_WIDTH) {
802
+ return 0;
803
+ }
804
+ let ii, len1 = txt1.length, len2 = txt2.length;
805
+ let maxDist = len1;
806
+ let curDist = 1;
807
+ let breakAfter = false;
808
+ let seg1, seg2, ch1, ch2;
809
+ if (len1 === 0) {
810
+ return 0;
811
+ }
812
+ distCal:
813
+ while (curDist <= maxDist) {
814
+ const seg1StartPos = len1 - curDist;
815
+ seg1 = txt1.substring(seg1StartPos, seg1StartPos + curDist);
816
+ seg2 = txt2.substring(0, Math.min(curDist, len2));
817
+ for (ii = 0;ii < Math.min(curDist, len2); ii++) {
818
+ ch1 = seg1.substring(ii, ii + 1);
819
+ ch2 = seg2.substring(ii, ii + 1);
820
+ if (ch1 !== " " && ch2 !== " ") {
821
+ if (fittingRules.hLayout === FITTING) {
822
+ curDist = curDist - 1;
823
+ break distCal;
824
+ } else if (fittingRules.hLayout === SMUSHING) {
825
+ if (ch1 === opts.hardBlank || ch2 === opts.hardBlank) {
826
+ curDist = curDist - 1;
827
+ }
828
+ break distCal;
829
+ } else {
830
+ breakAfter = true;
831
+ const validSmush = fittingRules.hRule1 && hRule1_Smush(ch1, ch2, opts.hardBlank) || fittingRules.hRule2 && hRule2_Smush(ch1, ch2) || fittingRules.hRule3 && hRule3_Smush(ch1, ch2) || fittingRules.hRule4 && hRule4_Smush(ch1, ch2) || fittingRules.hRule5 && hRule5_Smush(ch1, ch2) || fittingRules.hRule6 && hRule6_Smush(ch1, ch2, opts.hardBlank);
832
+ if (!validSmush) {
833
+ curDist = curDist - 1;
834
+ break distCal;
835
+ }
836
+ }
837
+ }
838
+ }
839
+ if (breakAfter) {
840
+ break;
841
+ }
842
+ curDist++;
843
+ }
844
+ return Math.min(maxDist, curDist);
845
+ }
846
+ function horizontalSmush(textBlock1, textBlock2, overlap, opts) {
847
+ let ii, jj, outputFig = [], overlapStart, piece1, piece2, piece3, len1, len2, txt1, txt2;
848
+ const fittingRules = opts.fittingRules || {};
849
+ if (typeof opts.height !== "number") {
850
+ throw new Error("height is not defined.");
851
+ }
852
+ for (ii = 0;ii < opts.height; ii++) {
853
+ txt1 = textBlock1[ii];
854
+ txt2 = textBlock2[ii];
855
+ len1 = txt1.length;
856
+ len2 = txt2.length;
857
+ overlapStart = len1 - overlap;
858
+ piece1 = txt1.slice(0, Math.max(0, overlapStart));
859
+ piece2 = "";
860
+ const seg1StartPos = Math.max(0, len1 - overlap);
861
+ let seg1 = txt1.substring(seg1StartPos, seg1StartPos + overlap);
862
+ let seg2 = txt2.substring(0, Math.min(overlap, len2));
863
+ for (jj = 0;jj < overlap; jj++) {
864
+ let ch1 = jj < len1 ? seg1.substring(jj, jj + 1) : " ";
865
+ let ch2 = jj < len2 ? seg2.substring(jj, jj + 1) : " ";
866
+ if (ch1 !== " " && ch2 !== " ") {
867
+ if (fittingRules.hLayout === FITTING || fittingRules.hLayout === SMUSHING) {
868
+ piece2 += uni_Smush(ch1, ch2, opts.hardBlank);
869
+ } else {
870
+ const nextCh = fittingRules.hRule1 && hRule1_Smush(ch1, ch2, opts.hardBlank) || fittingRules.hRule2 && hRule2_Smush(ch1, ch2) || fittingRules.hRule3 && hRule3_Smush(ch1, ch2) || fittingRules.hRule4 && hRule4_Smush(ch1, ch2) || fittingRules.hRule5 && hRule5_Smush(ch1, ch2) || fittingRules.hRule6 && hRule6_Smush(ch1, ch2, opts.hardBlank) || uni_Smush(ch1, ch2, opts.hardBlank);
871
+ piece2 += nextCh;
872
+ }
873
+ } else {
874
+ piece2 += uni_Smush(ch1, ch2, opts.hardBlank);
875
+ }
876
+ }
877
+ if (overlap >= len2) {
878
+ piece3 = "";
879
+ } else {
880
+ piece3 = txt2.substring(overlap, overlap + Math.max(0, len2 - overlap));
881
+ }
882
+ outputFig[ii] = piece1 + piece2 + piece3;
883
+ }
884
+ return outputFig;
885
+ }
886
+ function newFigChar(len) {
887
+ return new Array(len).fill("");
888
+ }
889
+ const figLinesWidth = function(textLines) {
890
+ return Math.max(...textLines.map((line) => line.length));
891
+ };
892
+ function joinFigArray(array, len, opts) {
893
+ return array.reduce(function(acc, data) {
894
+ return horizontalSmush(acc, data.fig, data.overlap || 0, opts);
895
+ }, newFigChar(len));
896
+ }
897
+ function breakWord(figChars, len, opts) {
898
+ for (let i = figChars.length - 1;i > 0; i--) {
899
+ const w = joinFigArray(figChars.slice(0, i), len, opts);
900
+ if (figLinesWidth(w) <= opts.width) {
901
+ return {
902
+ outputFigText: w,
903
+ chars: figChars.slice(i)
904
+ };
905
+ }
906
+ }
907
+ return { outputFigText: newFigChar(len), chars: figChars };
908
+ }
909
+ function generateFigTextLines(txt, figChars, opts) {
910
+ let charIndex, figChar, overlap = 0, row, outputFigText, len, height = opts.height, outputFigLines = [], maxWidth, nextFigChars = {
911
+ chars: [],
912
+ overlap
913
+ }, figWords = [], char, isSpace, textFigWord, textFigLine, tmpBreak;
914
+ if (typeof height !== "number") {
915
+ throw new Error("height is not defined.");
916
+ }
917
+ outputFigText = newFigChar(height);
918
+ const fittingRules = opts.fittingRules || {};
919
+ if (opts.printDirection === 1) {
920
+ txt = txt.split("").reverse().join("");
921
+ }
922
+ len = txt.length;
923
+ for (charIndex = 0;charIndex < len; charIndex++) {
924
+ char = txt.substring(charIndex, charIndex + 1);
925
+ isSpace = char.match(/\s/);
926
+ figChar = figChars[char.charCodeAt(0)];
927
+ textFigLine = null;
928
+ if (figChar) {
929
+ if (fittingRules.hLayout !== FULL_WIDTH) {
930
+ overlap = 1e4;
931
+ for (row = 0;row < height; row++) {
932
+ overlap = Math.min(overlap, getHorizontalSmushLength(outputFigText[row], figChar[row], opts));
933
+ }
934
+ overlap = overlap === 1e4 ? 0 : overlap;
935
+ }
936
+ if (opts.width > 0) {
937
+ if (opts.whitespaceBreak) {
938
+ textFigWord = joinFigArray(nextFigChars.chars.concat([
939
+ {
940
+ fig: figChar,
941
+ overlap
942
+ }
943
+ ]), height, opts);
944
+ textFigLine = joinFigArray(figWords.concat([
945
+ {
946
+ fig: textFigWord,
947
+ overlap: nextFigChars.overlap
948
+ }
949
+ ]), height, opts);
950
+ maxWidth = figLinesWidth(textFigLine);
951
+ } else {
952
+ textFigLine = horizontalSmush(outputFigText, figChar, overlap, opts);
953
+ maxWidth = figLinesWidth(textFigLine);
954
+ }
955
+ if (maxWidth >= opts.width && charIndex > 0) {
956
+ if (opts.whitespaceBreak) {
957
+ outputFigText = joinFigArray(figWords.slice(0, -1), height, opts);
958
+ if (figWords.length > 1) {
959
+ outputFigLines.push(outputFigText);
960
+ outputFigText = newFigChar(height);
961
+ }
962
+ figWords = [];
963
+ } else {
964
+ outputFigLines.push(outputFigText);
965
+ outputFigText = newFigChar(height);
966
+ }
967
+ }
968
+ }
969
+ if (opts.width > 0 && opts.whitespaceBreak) {
970
+ if (!isSpace || charIndex === len - 1) {
971
+ nextFigChars.chars.push({ fig: figChar, overlap });
972
+ }
973
+ if (isSpace || charIndex === len - 1) {
974
+ tmpBreak = null;
975
+ while (true) {
976
+ textFigLine = joinFigArray(nextFigChars.chars, height, opts);
977
+ maxWidth = figLinesWidth(textFigLine);
978
+ if (maxWidth >= opts.width) {
979
+ tmpBreak = breakWord(nextFigChars.chars, height, opts);
980
+ nextFigChars = { chars: tmpBreak.chars };
981
+ outputFigLines.push(tmpBreak.outputFigText);
982
+ } else {
983
+ break;
984
+ }
985
+ }
986
+ if (maxWidth > 0) {
987
+ if (tmpBreak) {
988
+ figWords.push({ fig: textFigLine, overlap: 1 });
989
+ } else {
990
+ figWords.push({
991
+ fig: textFigLine,
992
+ overlap: nextFigChars.overlap
993
+ });
994
+ }
995
+ }
996
+ if (isSpace) {
997
+ figWords.push({ fig: figChar, overlap });
998
+ outputFigText = newFigChar(height);
999
+ }
1000
+ if (charIndex === len - 1) {
1001
+ outputFigText = joinFigArray(figWords, height, opts);
1002
+ }
1003
+ nextFigChars = {
1004
+ chars: [],
1005
+ overlap
1006
+ };
1007
+ continue;
1008
+ }
1009
+ }
1010
+ outputFigText = horizontalSmush(outputFigText, figChar, overlap, opts);
1011
+ }
1012
+ }
1013
+ if (figLinesWidth(outputFigText) > 0) {
1014
+ outputFigLines.push(outputFigText);
1015
+ }
1016
+ if (!opts.showHardBlanks) {
1017
+ outputFigLines.forEach(function(outputFigText2) {
1018
+ len = outputFigText2.length;
1019
+ for (row = 0;row < len; row++) {
1020
+ outputFigText2[row] = outputFigText2[row].replace(new RegExp("\\" + opts.hardBlank, "g"), " ");
1021
+ }
1022
+ });
1023
+ }
1024
+ if (txt === "" && outputFigLines.length === 0) {
1025
+ outputFigLines.push(new Array(height).fill(""));
1026
+ }
1027
+ return outputFigLines;
1028
+ }
1029
+ const getHorizontalFittingRules = function(layout, options) {
1030
+ let params;
1031
+ const fittingRules = options.fittingRules || {};
1032
+ if (layout === "default") {
1033
+ params = {
1034
+ hLayout: fittingRules.hLayout,
1035
+ hRule1: fittingRules.hRule1,
1036
+ hRule2: fittingRules.hRule2,
1037
+ hRule3: fittingRules.hRule3,
1038
+ hRule4: fittingRules.hRule4,
1039
+ hRule5: fittingRules.hRule5,
1040
+ hRule6: fittingRules.hRule6
1041
+ };
1042
+ } else if (layout === "full") {
1043
+ params = {
1044
+ hLayout: FULL_WIDTH,
1045
+ hRule1: false,
1046
+ hRule2: false,
1047
+ hRule3: false,
1048
+ hRule4: false,
1049
+ hRule5: false,
1050
+ hRule6: false
1051
+ };
1052
+ } else if (layout === "fitted") {
1053
+ params = {
1054
+ hLayout: FITTING,
1055
+ hRule1: false,
1056
+ hRule2: false,
1057
+ hRule3: false,
1058
+ hRule4: false,
1059
+ hRule5: false,
1060
+ hRule6: false
1061
+ };
1062
+ } else if (layout === "controlled smushing") {
1063
+ params = {
1064
+ hLayout: CONTROLLED_SMUSHING,
1065
+ hRule1: true,
1066
+ hRule2: true,
1067
+ hRule3: true,
1068
+ hRule4: true,
1069
+ hRule5: true,
1070
+ hRule6: true
1071
+ };
1072
+ } else if (layout === "universal smushing") {
1073
+ params = {
1074
+ hLayout: SMUSHING,
1075
+ hRule1: false,
1076
+ hRule2: false,
1077
+ hRule3: false,
1078
+ hRule4: false,
1079
+ hRule5: false,
1080
+ hRule6: false
1081
+ };
1082
+ } else {
1083
+ return;
1084
+ }
1085
+ return params;
1086
+ };
1087
+ const getVerticalFittingRules = function(layout, options) {
1088
+ let params = {};
1089
+ const fittingRules = options.fittingRules || {};
1090
+ if (layout === "default") {
1091
+ params = {
1092
+ vLayout: fittingRules.vLayout,
1093
+ vRule1: fittingRules.vRule1,
1094
+ vRule2: fittingRules.vRule2,
1095
+ vRule3: fittingRules.vRule3,
1096
+ vRule4: fittingRules.vRule4,
1097
+ vRule5: fittingRules.vRule5
1098
+ };
1099
+ } else if (layout === "full") {
1100
+ params = {
1101
+ vLayout: FULL_WIDTH,
1102
+ vRule1: false,
1103
+ vRule2: false,
1104
+ vRule3: false,
1105
+ vRule4: false,
1106
+ vRule5: false
1107
+ };
1108
+ } else if (layout === "fitted") {
1109
+ params = {
1110
+ vLayout: FITTING,
1111
+ vRule1: false,
1112
+ vRule2: false,
1113
+ vRule3: false,
1114
+ vRule4: false,
1115
+ vRule5: false
1116
+ };
1117
+ } else if (layout === "controlled smushing") {
1118
+ params = {
1119
+ vLayout: CONTROLLED_SMUSHING,
1120
+ vRule1: true,
1121
+ vRule2: true,
1122
+ vRule3: true,
1123
+ vRule4: true,
1124
+ vRule5: true
1125
+ };
1126
+ } else if (layout === "universal smushing") {
1127
+ params = {
1128
+ vLayout: SMUSHING,
1129
+ vRule1: false,
1130
+ vRule2: false,
1131
+ vRule3: false,
1132
+ vRule4: false,
1133
+ vRule5: false
1134
+ };
1135
+ } else {
1136
+ return;
1137
+ }
1138
+ return params;
1139
+ };
1140
+ const generateText = function(fontName, options, txt) {
1141
+ txt = txt.replace(/\r\n/g, `
1142
+ `).replace(/\r/g, `
1143
+ `);
1144
+ let lines = txt.split(`
1145
+ `);
1146
+ let figLines = [];
1147
+ let ii, len, output;
1148
+ len = lines.length;
1149
+ for (ii = 0;ii < len; ii++) {
1150
+ figLines = figLines.concat(generateFigTextLines(lines[ii], figFonts[fontName], options));
1151
+ }
1152
+ len = figLines.length;
1153
+ output = figLines[0];
1154
+ for (ii = 1;ii < len; ii++) {
1155
+ output = smushVerticalFigLines(output, figLines[ii], options);
1156
+ }
1157
+ return output ? output.join(`
1158
+ `) : "";
1159
+ };
1160
+ function _reworkFontOpts(fontMeta, options) {
1161
+ let myOpts;
1162
+ if (typeof structuredClone !== "undefined") {
1163
+ myOpts = structuredClone(fontMeta);
1164
+ } else {
1165
+ myOpts = JSON.parse(JSON.stringify(fontMeta));
1166
+ }
1167
+ myOpts.showHardBlanks = options.showHardBlanks || false;
1168
+ myOpts.width = options.width || -1;
1169
+ myOpts.whitespaceBreak = options.whitespaceBreak || false;
1170
+ if (options.horizontalLayout) {
1171
+ const params = getHorizontalFittingRules(options.horizontalLayout, fontMeta);
1172
+ if (params) {
1173
+ Object.assign(myOpts.fittingRules, params);
1174
+ }
1175
+ }
1176
+ if (options.verticalLayout) {
1177
+ const params = getVerticalFittingRules(options.verticalLayout, fontMeta);
1178
+ if (params) {
1179
+ Object.assign(myOpts.fittingRules, params);
1180
+ }
1181
+ }
1182
+ myOpts.printDirection = options.printDirection !== null && options.printDirection !== undefined ? options.printDirection : fontMeta.printDirection;
1183
+ return myOpts;
1184
+ }
1185
+ const me = async function(txt, optionsOrFontOrCallback, callback) {
1186
+ return me.text(txt, optionsOrFontOrCallback, callback);
1187
+ };
1188
+ me.text = async function(txt, optionsOrFontOrCallback, callback) {
1189
+ txt = txt + "";
1190
+ let options, next;
1191
+ if (typeof optionsOrFontOrCallback === "function") {
1192
+ next = optionsOrFontOrCallback;
1193
+ options = { font: figDefaults.font };
1194
+ } else if (typeof optionsOrFontOrCallback === "string") {
1195
+ options = { font: optionsOrFontOrCallback };
1196
+ next = callback;
1197
+ } else if (optionsOrFontOrCallback) {
1198
+ options = optionsOrFontOrCallback;
1199
+ next = callback;
1200
+ } else {
1201
+ options = { font: figDefaults.font };
1202
+ next = callback;
1203
+ }
1204
+ const fontName = options.font || figDefaults.font;
1205
+ try {
1206
+ const fontOpts = await me.loadFont(fontName);
1207
+ const generatedTxt = fontOpts ? generateText(fontName, _reworkFontOpts(fontOpts, options), txt) : "";
1208
+ if (next) {
1209
+ next(null, generatedTxt);
1210
+ }
1211
+ return generatedTxt;
1212
+ } catch (err) {
1213
+ const error = err instanceof Error ? err : new Error(String(err));
1214
+ if (next) {
1215
+ next(error);
1216
+ return "";
1217
+ }
1218
+ throw error;
1219
+ }
1220
+ };
1221
+ me.textSync = function(txt, options) {
1222
+ txt = txt + "";
1223
+ if (typeof options === "string") {
1224
+ options = { font: options };
1225
+ } else {
1226
+ options = options || {};
1227
+ }
1228
+ const fontName = options.font || figDefaults.font;
1229
+ let fontOpts = _reworkFontOpts(me.loadFontSync(fontName), options);
1230
+ return generateText(fontName, fontOpts, txt);
1231
+ };
1232
+ me.metadata = async function(fontName, callback) {
1233
+ fontName = fontName + "";
1234
+ try {
1235
+ const fontOpts = await me.loadFont(fontName);
1236
+ if (!fontOpts) {
1237
+ throw new Error("Error loading font.");
1238
+ }
1239
+ const font = figFonts[fontName] || {};
1240
+ const result = [fontOpts, font.comment || ""];
1241
+ if (callback) {
1242
+ callback(null, fontOpts, font.comment);
1243
+ }
1244
+ return result;
1245
+ } catch (err) {
1246
+ const error = err instanceof Error ? err : new Error(String(err));
1247
+ if (callback) {
1248
+ callback(error);
1249
+ return null;
1250
+ }
1251
+ throw error;
1252
+ }
1253
+ };
1254
+ me.defaults = function(opts) {
1255
+ if (opts && typeof opts === "object") {
1256
+ Object.assign(figDefaults, opts);
1257
+ }
1258
+ if (typeof structuredClone !== "undefined") {
1259
+ return structuredClone(figDefaults);
1260
+ } else {
1261
+ return JSON.parse(JSON.stringify(figDefaults));
1262
+ }
1263
+ };
1264
+ me.parseFont = function(fontName, data, override = true) {
1265
+ if (figFonts[fontName] && !override) {
1266
+ return figFonts[fontName].options;
1267
+ }
1268
+ data = data.replace(/\r\n/g, `
1269
+ `).replace(/\r/g, `
1270
+ `);
1271
+ const font = new FigletFont;
1272
+ const lines = data.split(`
1273
+ `);
1274
+ const headerLine = lines.shift();
1275
+ if (!headerLine) {
1276
+ throw new Error("Invalid font file: missing header");
1277
+ }
1278
+ const headerData = headerLine.split(" ");
1279
+ const opts = {
1280
+ hardBlank: headerData[0].substring(5, 6),
1281
+ height: parseInt(headerData[1], 10),
1282
+ baseline: parseInt(headerData[2], 10),
1283
+ maxLength: parseInt(headerData[3], 10),
1284
+ oldLayout: parseInt(headerData[4], 10),
1285
+ numCommentLines: parseInt(headerData[5], 10),
1286
+ printDirection: headerData[6] ? parseInt(headerData[6], 10) : 0,
1287
+ fullLayout: headerData[7] ? parseInt(headerData[7], 10) : null,
1288
+ codeTagCount: headerData[8] ? parseInt(headerData[8], 10) : null
1289
+ };
1290
+ const hardBlank = opts.hardBlank || "";
1291
+ if (hardBlank.length !== 1 || [
1292
+ opts.height,
1293
+ opts.baseline,
1294
+ opts.maxLength,
1295
+ opts.oldLayout,
1296
+ opts.numCommentLines
1297
+ ].some((val) => val === null || val === undefined || isNaN(val))) {
1298
+ throw new Error("FIGlet header contains invalid values.");
1299
+ }
1300
+ if (opts.height == null || opts.numCommentLines == null) {
1301
+ throw new Error("FIGlet header contains invalid values.");
1302
+ }
1303
+ opts.fittingRules = getSmushingRules(opts.oldLayout, opts.fullLayout);
1304
+ font.options = opts;
1305
+ const charNums = [];
1306
+ for (let i = 32;i <= 126; i++) {
1307
+ charNums.push(i);
1308
+ }
1309
+ charNums.push(196, 214, 220, 228, 246, 252, 223);
1310
+ if (lines.length < opts.numCommentLines + opts.height * charNums.length) {
1311
+ throw new Error(`FIGlet file is missing data. Line length: ${lines.length}. Comment lines: ${opts.numCommentLines}. Height: ${opts.height}. Num chars: ${charNums.length}.`);
1312
+ }
1313
+ font.comment = lines.splice(0, opts.numCommentLines).join(`
1314
+ `);
1315
+ font.numChars = 0;
1316
+ while (lines.length > 0 && font.numChars < charNums.length) {
1317
+ const cNum = charNums[font.numChars];
1318
+ font[cNum] = lines.splice(0, opts.height);
1319
+ for (let i = 0;i < opts.height; i++) {
1320
+ if (typeof font[cNum][i] === "undefined") {
1321
+ font[cNum][i] = "";
1322
+ } else {
1323
+ font[cNum][i] = removeEndChar(font[cNum][i], i, opts.height);
1324
+ }
1325
+ }
1326
+ font.numChars++;
1327
+ }
1328
+ while (lines.length > 0) {
1329
+ const cNumLine = lines.shift();
1330
+ if (!cNumLine || cNumLine.trim() === "")
1331
+ break;
1332
+ let cNum = cNumLine.split(" ")[0];
1333
+ let parsedNum;
1334
+ if (/^-?0[xX][0-9a-fA-F]+$/.test(cNum)) {
1335
+ parsedNum = parseInt(cNum, 16);
1336
+ } else if (/^-?0[0-7]+$/.test(cNum)) {
1337
+ parsedNum = parseInt(cNum, 8);
1338
+ } else if (/^-?[0-9]+$/.test(cNum)) {
1339
+ parsedNum = parseInt(cNum, 10);
1340
+ } else {
1341
+ throw new Error(`Error parsing data. Invalid data: ${cNum}`);
1342
+ }
1343
+ if (parsedNum === -1 || parsedNum < -2147483648 || parsedNum > 2147483647) {
1344
+ const msg = parsedNum === -1 ? "The char code -1 is not permitted." : `The char code cannot be ${parsedNum < -2147483648 ? "less than -2147483648" : "greater than 2147483647"}.`;
1345
+ throw new Error(`Error parsing data. ${msg}`);
1346
+ }
1347
+ font[parsedNum] = lines.splice(0, opts.height);
1348
+ for (let i = 0;i < opts.height; i++) {
1349
+ if (typeof font[parsedNum][i] === "undefined") {
1350
+ font[parsedNum][i] = "";
1351
+ } else {
1352
+ font[parsedNum][i] = removeEndChar(font[parsedNum][i], i, opts.height);
1353
+ }
1354
+ }
1355
+ font.numChars++;
1356
+ }
1357
+ figFonts[fontName] = font;
1358
+ return opts;
1359
+ };
1360
+ me.loadedFonts = () => {
1361
+ return Object.keys(figFonts);
1362
+ };
1363
+ me.clearLoadedFonts = () => {
1364
+ Object.keys(figFonts).forEach((key) => {
1365
+ delete figFonts[key];
1366
+ });
1367
+ };
1368
+ me.loadFont = async function(fontName, callback) {
1369
+ if (figFonts[fontName]) {
1370
+ const result = figFonts[fontName].options;
1371
+ if (callback) {
1372
+ callback(null, result);
1373
+ }
1374
+ return Promise.resolve(result);
1375
+ }
1376
+ try {
1377
+ if (!figDefaults.fetchFontIfMissing) {
1378
+ throw new Error(`Font is not loaded: ${fontName}`);
1379
+ }
1380
+ const response = await fetch(`${figDefaults.fontPath}/${fontName}.flf`);
1381
+ if (!response.ok) {
1382
+ throw new Error(`Network response was not ok: ${response.status}`);
1383
+ }
1384
+ const text = await response.text();
1385
+ const result = me.parseFont(fontName, text);
1386
+ if (callback) {
1387
+ callback(null, result);
1388
+ }
1389
+ return result;
1390
+ } catch (error) {
1391
+ const err = error instanceof Error ? error : new Error(String(error));
1392
+ if (callback) {
1393
+ callback(err);
1394
+ return null;
1395
+ }
1396
+ throw err;
1397
+ }
1398
+ };
1399
+ me.loadFontSync = function(name) {
1400
+ if (figFonts[name]) {
1401
+ return figFonts[name].options;
1402
+ }
1403
+ throw new Error("Synchronous font loading is not implemented for the browser, it will only work for fonts already loaded.");
1404
+ };
1405
+ me.preloadFonts = async function(fonts, callback) {
1406
+ try {
1407
+ for (const name of fonts) {
1408
+ const response = await fetch(`${figDefaults.fontPath}/${name}.flf`);
1409
+ if (!response.ok) {
1410
+ throw new Error(`Failed to preload fonts. Error fetching font: ${name}, status code: ${response.statusText}`);
1411
+ }
1412
+ const data = await response.text();
1413
+ me.parseFont(name, data);
1414
+ }
1415
+ if (callback) {
1416
+ callback();
1417
+ }
1418
+ } catch (error) {
1419
+ const err = error instanceof Error ? error : new Error(String(error));
1420
+ if (callback) {
1421
+ callback(err);
1422
+ return;
1423
+ }
1424
+ throw error;
1425
+ }
1426
+ };
1427
+ me.fonts = function(callback) {
1428
+ return new Promise(function(resolve, reject) {
1429
+ resolve(fontList);
1430
+ if (callback) {
1431
+ callback(null, fontList);
1432
+ }
1433
+ });
1434
+ };
1435
+ me.fontsSync = function() {
1436
+ return fontList;
1437
+ };
1438
+ me.figFonts = figFonts;
1439
+ return me;
1440
+ })();
1441
+
1442
+ // node_modules/figlet/dist/node-figlet.mjs
1443
+ import { fileURLToPath } from "url";
1444
+ var __filename2 = fileURLToPath(import.meta.url);
1445
+ var __dirname2 = path.dirname(__filename2);
1446
+ var fontPath = path.join(__dirname2, "/../fonts/");
1447
+ var nodeFiglet = figlet;
1448
+ nodeFiglet.defaults({ fontPath });
1449
+ nodeFiglet.loadFont = function(name, callback) {
1450
+ return new Promise((resolve, reject) => {
1451
+ if (nodeFiglet.figFonts[name]) {
1452
+ if (callback) {
1453
+ callback(null, nodeFiglet.figFonts[name].options);
1454
+ }
1455
+ resolve(nodeFiglet.figFonts[name].options);
1456
+ return;
1457
+ }
1458
+ fs.readFile(path.join(nodeFiglet.defaults().fontPath, name + ".flf"), { encoding: "utf-8" }, (err, fontData) => {
1459
+ if (err) {
1460
+ if (callback) {
1461
+ callback(err);
1462
+ }
1463
+ reject(err);
1464
+ return;
1465
+ }
1466
+ fontData = fontData + "";
1467
+ try {
1468
+ const font = nodeFiglet.parseFont(name, fontData);
1469
+ if (callback) {
1470
+ callback(null, font);
1471
+ }
1472
+ resolve(font);
1473
+ } catch (error) {
1474
+ const typedError = error instanceof Error ? error : new Error(String(error));
1475
+ if (callback) {
1476
+ callback(typedError);
1477
+ }
1478
+ reject(typedError);
1479
+ }
1480
+ });
1481
+ });
1482
+ };
1483
+ nodeFiglet.loadFontSync = function(font) {
1484
+ if (nodeFiglet.figFonts[font]) {
1485
+ return nodeFiglet.figFonts[font].options;
1486
+ }
1487
+ const fontData = fs.readFileSync(path.join(nodeFiglet.defaults().fontPath, font + ".flf"), {
1488
+ encoding: "utf-8"
1489
+ }) + "";
1490
+ return nodeFiglet.parseFont(font, fontData);
1491
+ };
1492
+ nodeFiglet.fonts = function(next) {
1493
+ return new Promise((resolve, reject) => {
1494
+ const fontList2 = [];
1495
+ fs.readdir(nodeFiglet.defaults().fontPath, (err, files) => {
1496
+ if (err) {
1497
+ next && next(err);
1498
+ reject(err);
1499
+ return;
1500
+ }
1501
+ files.forEach((file) => {
1502
+ if (/\.flf$/.test(file)) {
1503
+ fontList2.push(file.replace(/\.flf$/, ""));
1504
+ }
1505
+ });
1506
+ next && next(null, fontList2);
1507
+ resolve(fontList2);
1508
+ });
1509
+ });
1510
+ };
1511
+ nodeFiglet.fontsSync = function() {
1512
+ const fontList2 = [];
1513
+ fs.readdirSync(nodeFiglet.defaults().fontPath).forEach((file) => {
1514
+ if (/\.flf$/.test(file)) {
1515
+ fontList2.push(file.replace(/\.flf$/, ""));
1516
+ }
1517
+ });
1518
+ return fontList2;
1519
+ };
1520
+
1521
+ // src/core/log.ts
1522
+ var infoLogSingle = (title, message) => {
1523
+ console.log("");
1524
+ console.info(" [INFO]");
1525
+ console.info(` [${title}]: ${message}`);
1526
+ console.log("");
1527
+ };
1528
+ var infoLogMulti = (args) => {
1529
+ console.log("");
1530
+ console.info(" [INFO]");
1531
+ for (const arg of args) {
1532
+ console.info(` [${arg.t}]: ${arg.m}`);
1533
+ }
1534
+ console.log("");
1535
+ };
1536
+ var warnLogSingle = (title, message) => {
1537
+ console.log("");
1538
+ console.warn(" [WARNING]");
1539
+ console.warn(` [${title}]: ${message}`);
1540
+ console.log("");
1541
+ };
1542
+ var warnLogMulti = (args) => {
1543
+ console.log("");
1544
+ console.warn(" [WARNING]");
1545
+ for (const arg of args) {
1546
+ console.warn(` [${arg.t}]: ${arg.m}`);
1547
+ }
1548
+ console.log("");
1549
+ };
1550
+ var errLogSingle = (title, message) => {
1551
+ console.log("");
1552
+ console.error(" [ERROR]");
1553
+ console.error(` [${title}]: ${message}`);
1554
+ console.log("");
1555
+ };
1556
+ var errLogMulti = (args) => {
1557
+ console.log("");
1558
+ console.error(" [ERROR]");
1559
+ for (const arg of args) {
1560
+ console.error(` [${arg.t}]: ${arg.m}`);
1561
+ }
1562
+ console.log("");
1563
+ };
1564
+ var title = (title2, subtitle) => {
1565
+ console.clear();
1566
+ console.log();
1567
+ console.log(nodeFiglet.textSync(title2, {
1568
+ font: "ANSI Regular"
1569
+ }));
1570
+ console.log(` [${subtitle}]`);
1571
+ console.log();
1572
+ };
1573
+ var log = {
1574
+ single: {
1575
+ info: infoLogSingle,
1576
+ warn: warnLogSingle,
1577
+ err: errLogSingle
1578
+ },
1579
+ multi: {
1580
+ info: infoLogMulti,
1581
+ warn: warnLogMulti,
1582
+ err: errLogMulti
1583
+ },
1584
+ title
1585
+ };
1586
+ var log_default = log;
1587
+
1588
+ // src/core/cli.ts
1589
+ import { join as join2 } from "path";
1590
+
1591
+ // src/config.ts
1592
+ var config = {
1593
+ about_text: "mkcmd is a remote node executable for scaffolding other remote node executables with sensible defaults.",
1594
+ more_info_text: "See https://github.com/mackenziebowes/mkcmd for more details."
1595
+ };
1596
+
1597
+ // src/core/cli.ts
1598
+ var commands = new Map;
1599
+ function registerCommand(cmd) {
1600
+ commands.set(cmd.name, cmd);
1601
+ }
1602
+ async function runCLI(argv = Bun.argv.slice(2)) {
1603
+ const [name, ...args] = argv;
1604
+ if (!name) {
1605
+ log_default.single.err("ARGS", "No Argument Supplied");
1606
+ return;
1607
+ }
1608
+ if (["-h", "--help"].includes(name)) {
1609
+ const multiLog = [];
1610
+ multiLog.push({
1611
+ t: "About",
1612
+ m: config.about_text
1613
+ });
1614
+ multiLog.push({
1615
+ t: "Commands",
1616
+ m: "Available Commands"
1617
+ });
1618
+ for (const cmd of commands.values()) {
1619
+ multiLog.push({
1620
+ t: cmd.name,
1621
+ m: `${cmd.description}
1622
+ |-> [Instructions]: ${cmd.instructions}
1623
+ `
1624
+ });
1625
+ }
1626
+ multiLog.push({
1627
+ t: "More Info",
1628
+ m: config.more_info_text
1629
+ });
1630
+ log_default.multi.info(multiLog);
1631
+ return;
1632
+ }
1633
+ if (["-v", "--version"].includes(name)) {
1634
+ const pkgText = await Bun.file(join2(process.cwd(), "package.json")).text();
1635
+ const pkg = JSON.parse(pkgText);
1636
+ log_default.multi.info([
1637
+ {
1638
+ t: "Package Name",
1639
+ m: pkg.name
1640
+ },
1641
+ {
1642
+ t: "Package Version",
1643
+ m: pkg.version
1644
+ }
1645
+ ]);
1646
+ return;
1647
+ }
1648
+ const command = commands.get(name);
1649
+ if (!command) {
1650
+ log_default.single.err("Command", "No Command Supplied");
1651
+ process.exit(1);
1652
+ }
1653
+ try {
1654
+ await command.run(args);
1655
+ } catch (err) {
1656
+ const multilog = [];
1657
+ multilog.push({
1658
+ t: "Panic",
1659
+ m: `Failed to run ${name}`
1660
+ });
1661
+ if (err instanceof Error) {
1662
+ multilog.push({
1663
+ t: "Error",
1664
+ m: err.message
1665
+ });
1666
+ } else {
1667
+ multilog.push({
1668
+ t: "Unknown Error",
1669
+ m: JSON.stringify(err)
1670
+ });
1671
+ }
1672
+ log_default.multi.err(multilog);
1673
+ process.exit(1);
1674
+ }
1675
+ }
1676
+
1677
+ // node_modules/@clack/core/dist/index.mjs
1678
+ var import_sisteransi = __toESM(require_src(), 1);
1679
+ import { stdin as j, stdout as M } from "process";
1680
+ var import_picocolors = __toESM(require_picocolors(), 1);
1681
+ import O from "readline";
1682
+ import { Writable as X } from "stream";
1683
+ function DD({ onlyFirst: e = false } = {}) {
1684
+ 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("|");
1685
+ return new RegExp(t, e ? undefined : "g");
1686
+ }
1687
+ var uD = DD();
1688
+ function P(e) {
1689
+ if (typeof e != "string")
1690
+ throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
1691
+ return e.replace(uD, "");
1692
+ }
1693
+ function L(e) {
1694
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1695
+ }
1696
+ var W = { exports: {} };
1697
+ (function(e) {
1698
+ var u = {};
1699
+ e.exports = u, u.eastAsianWidth = function(F) {
1700
+ var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
1701
+ return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
1702
+ }, u.characterLength = function(F) {
1703
+ var s = this.eastAsianWidth(F);
1704
+ return s == "F" || s == "W" || s == "A" ? 2 : 1;
1705
+ };
1706
+ function t(F) {
1707
+ return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
1708
+ }
1709
+ u.length = function(F) {
1710
+ for (var s = t(F), i = 0, D = 0;D < s.length; D++)
1711
+ i = i + this.characterLength(s[D]);
1712
+ return i;
1713
+ }, u.slice = function(F, s, i) {
1714
+ textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
1715
+ for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
1716
+ var a = n[E], o = u.length(a);
1717
+ if (C >= s - (o == 2 ? 1 : 0))
1718
+ if (C + o <= i)
1719
+ D += a;
1720
+ else
1721
+ break;
1722
+ C += o;
1723
+ }
1724
+ return D;
1725
+ };
1726
+ })(W);
1727
+ var tD = W.exports;
1728
+ var eD = L(tD);
1729
+ var FD = function() {
1730
+ 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;
1731
+ };
1732
+ var sD = L(FD);
1733
+ function p(e, u = {}) {
1734
+ if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
1735
+ return 0;
1736
+ e = e.replace(sD(), " ");
1737
+ const t = u.ambiguousIsNarrow ? 1 : 2;
1738
+ let F = 0;
1739
+ for (const s of e) {
1740
+ const i = s.codePointAt(0);
1741
+ if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
1742
+ continue;
1743
+ switch (eD.eastAsianWidth(s)) {
1744
+ case "F":
1745
+ case "W":
1746
+ F += 2;
1747
+ break;
1748
+ case "A":
1749
+ F += t;
1750
+ break;
1751
+ default:
1752
+ F += 1;
1753
+ }
1754
+ }
1755
+ return F;
1756
+ }
1757
+ var w = 10;
1758
+ var N = (e = 0) => (u) => `\x1B[${u + e}m`;
1759
+ var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
1760
+ var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
1761
+ 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] } };
1762
+ Object.keys(r.modifier);
1763
+ var iD = Object.keys(r.color);
1764
+ var CD = Object.keys(r.bgColor);
1765
+ [...iD];
1766
+ function rD() {
1767
+ const e = new Map;
1768
+ for (const [u, t] of Object.entries(r)) {
1769
+ for (const [F, s] of Object.entries(t))
1770
+ r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
1771
+ Object.defineProperty(r, u, { value: t, enumerable: false });
1772
+ }
1773
+ return Object.defineProperty(r, "codes", { value: e, 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: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
1774
+ const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
1775
+ if (!t)
1776
+ return [0, 0, 0];
1777
+ let [F] = t;
1778
+ F.length === 3 && (F = [...F].map((i) => i + i).join(""));
1779
+ const s = Number.parseInt(F, 16);
1780
+ return [s >> 16 & 255, s >> 8 & 255, s & 255];
1781
+ }, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
1782
+ if (u < 8)
1783
+ return 30 + u;
1784
+ if (u < 16)
1785
+ return 90 + (u - 8);
1786
+ let t, F, s;
1787
+ if (u >= 232)
1788
+ t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
1789
+ else {
1790
+ u -= 16;
1791
+ const C = u % 36;
1792
+ t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
1793
+ }
1794
+ const i = Math.max(t, F, s) * 2;
1795
+ if (i === 0)
1796
+ return 30;
1797
+ let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
1798
+ return i === 2 && (D += 60), D;
1799
+ }, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
1800
+ }
1801
+ var ED = rD();
1802
+ var d = new Set(["\x1B", "\x9B"]);
1803
+ var oD = 39;
1804
+ var y = "\x07";
1805
+ var V = "[";
1806
+ var nD = "]";
1807
+ var G = "m";
1808
+ var _ = `${nD}8;;`;
1809
+ var z = (e) => `${d.values().next().value}${V}${e}${G}`;
1810
+ var K = (e) => `${d.values().next().value}${_}${e}${y}`;
1811
+ var aD = (e) => e.split(" ").map((u) => p(u));
1812
+ var k = (e, u, t) => {
1813
+ const F = [...u];
1814
+ let s = false, i = false, D = p(P(e[e.length - 1]));
1815
+ for (const [C, n] of F.entries()) {
1816
+ const E = p(n);
1817
+ if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
1818
+ i ? n === y && (s = false, i = false) : n === G && (s = false);
1819
+ continue;
1820
+ }
1821
+ D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
1822
+ }
1823
+ !D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
1824
+ };
1825
+ var hD = (e) => {
1826
+ const u = e.split(" ");
1827
+ let t = u.length;
1828
+ for (;t > 0 && !(p(u[t - 1]) > 0); )
1829
+ t--;
1830
+ return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
1831
+ };
1832
+ var lD = (e, u, t = {}) => {
1833
+ if (t.trim !== false && e.trim() === "")
1834
+ return "";
1835
+ let F = "", s, i;
1836
+ const D = aD(e);
1837
+ let C = [""];
1838
+ for (const [E, a] of e.split(" ").entries()) {
1839
+ t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
1840
+ let o = p(C[C.length - 1]);
1841
+ if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
1842
+ const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
1843
+ Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
1844
+ continue;
1845
+ }
1846
+ if (o + D[E] > u && o > 0 && D[E] > 0) {
1847
+ if (t.wordWrap === false && o < u) {
1848
+ k(C, a, u);
1849
+ continue;
1850
+ }
1851
+ C.push("");
1852
+ }
1853
+ if (o + D[E] > u && t.wordWrap === false) {
1854
+ k(C, a, u);
1855
+ continue;
1856
+ }
1857
+ C[C.length - 1] += a;
1858
+ }
1859
+ t.trim !== false && (C = C.map((E) => hD(E)));
1860
+ const n = [...C.join(`
1861
+ `)];
1862
+ for (const [E, a] of n.entries()) {
1863
+ if (F += a, d.has(a)) {
1864
+ const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
1865
+ if (c.code !== undefined) {
1866
+ const f = Number.parseFloat(c.code);
1867
+ s = f === oD ? undefined : f;
1868
+ } else
1869
+ c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
1870
+ }
1871
+ const o = ED.codes.get(Number(s));
1872
+ n[E + 1] === `
1873
+ ` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
1874
+ ` && (s && o && (F += z(s)), i && (F += K(i)));
1875
+ }
1876
+ return F;
1877
+ };
1878
+ function Y(e, u, t) {
1879
+ return String(e).normalize().replace(/\r\n/g, `
1880
+ `).split(`
1881
+ `).map((F) => lD(F, u, t)).join(`
1882
+ `);
1883
+ }
1884
+ var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
1885
+ var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
1886
+ function $(e, u) {
1887
+ if (typeof e == "string")
1888
+ return B.aliases.get(e) === u;
1889
+ for (const t of e)
1890
+ if (t !== undefined && $(t, u))
1891
+ return true;
1892
+ return false;
1893
+ }
1894
+ function BD(e, u) {
1895
+ if (e === u)
1896
+ return;
1897
+ const t = e.split(`
1898
+ `), F = u.split(`
1899
+ `), s = [];
1900
+ for (let i = 0;i < Math.max(t.length, F.length); i++)
1901
+ t[i] !== F[i] && s.push(i);
1902
+ return s;
1903
+ }
1904
+ var AD = globalThis.process.platform.startsWith("win");
1905
+ var S = Symbol("clack:cancel");
1906
+ function m(e, u) {
1907
+ const t = e;
1908
+ t.isTTY && t.setRawMode(u);
1909
+ }
1910
+ var gD = Object.defineProperty;
1911
+ var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
1912
+ var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
1913
+
1914
+ class x {
1915
+ constructor(u, t = true) {
1916
+ h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
1917
+ const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
1918
+ this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
1919
+ }
1920
+ unsubscribe() {
1921
+ this._subscribers.clear();
1922
+ }
1923
+ setSubscriber(u, t) {
1924
+ const F = this._subscribers.get(u) ?? [];
1925
+ F.push(t), this._subscribers.set(u, F);
1926
+ }
1927
+ on(u, t) {
1928
+ this.setSubscriber(u, { cb: t });
1929
+ }
1930
+ once(u, t) {
1931
+ this.setSubscriber(u, { cb: t, once: true });
1932
+ }
1933
+ emit(u, ...t) {
1934
+ const F = this._subscribers.get(u) ?? [], s = [];
1935
+ for (const i of F)
1936
+ i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
1937
+ for (const i of s)
1938
+ i();
1939
+ }
1940
+ prompt() {
1941
+ return new Promise((u, t) => {
1942
+ if (this._abortSignal) {
1943
+ if (this._abortSignal.aborted)
1944
+ return this.state = "cancel", this.close(), u(S);
1945
+ this._abortSignal.addEventListener("abort", () => {
1946
+ this.state = "cancel", this.close();
1947
+ }, { once: true });
1948
+ }
1949
+ const F = new X;
1950
+ F._write = (s, i, D) => {
1951
+ this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
1952
+ }, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
1953
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
1954
+ }), this.once("cancel", () => {
1955
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
1956
+ });
1957
+ });
1958
+ }
1959
+ onKeypress(u, t) {
1960
+ if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
1961
+ if (this.opts.validate) {
1962
+ const F = this.opts.validate(this.value);
1963
+ F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
1964
+ }
1965
+ this.state !== "error" && (this.state = "submit");
1966
+ }
1967
+ $([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
1968
+ }
1969
+ close() {
1970
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
1971
+ `), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
1972
+ }
1973
+ restoreCursor() {
1974
+ const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
1975
+ `).length - 1;
1976
+ this.output.write(import_sisteransi.cursor.move(-999, u * -1));
1977
+ }
1978
+ render() {
1979
+ const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
1980
+ if (u !== this._prevFrame) {
1981
+ if (this.state === "initial")
1982
+ this.output.write(import_sisteransi.cursor.hide);
1983
+ else {
1984
+ const t = BD(this._prevFrame, u);
1985
+ if (this.restoreCursor(), t && t?.length === 1) {
1986
+ const F = t[0];
1987
+ this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
1988
+ const s = u.split(`
1989
+ `);
1990
+ this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
1991
+ return;
1992
+ }
1993
+ if (t && t?.length > 1) {
1994
+ const F = t[0];
1995
+ this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
1996
+ const s = u.split(`
1997
+ `).slice(F);
1998
+ this.output.write(s.join(`
1999
+ `)), this._prevFrame = u;
2000
+ return;
2001
+ }
2002
+ this.output.write(import_sisteransi.erase.down());
2003
+ }
2004
+ this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
2005
+ }
2006
+ }
2007
+ }
2008
+ var A;
2009
+ A = new WeakMap;
2010
+ class RD extends x {
2011
+ get valueWithCursor() {
2012
+ if (this.state === "submit")
2013
+ return this.value;
2014
+ if (this.cursor >= this.value.length)
2015
+ return `${this.value}\u2588`;
2016
+ const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
2017
+ return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
2018
+ }
2019
+ get cursor() {
2020
+ return this._cursor;
2021
+ }
2022
+ constructor(u) {
2023
+ super(u), this.on("finalize", () => {
2024
+ this.value || (this.value = u.defaultValue);
2025
+ });
2026
+ }
2027
+ }
2028
+
2029
+ // node_modules/@clack/prompts/dist/index.mjs
2030
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
2031
+ var import_sisteransi2 = __toESM(require_src(), 1);
2032
+ import y2 from "process";
2033
+ function ce() {
2034
+ return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
2035
+ }
2036
+ var V2 = ce();
2037
+ var u = (t, n) => V2 ? t : n;
2038
+ var le = u("\u25C6", "*");
2039
+ var L2 = u("\u25A0", "x");
2040
+ var W2 = u("\u25B2", "x");
2041
+ var C = u("\u25C7", "o");
2042
+ var ue = u("\u250C", "T");
2043
+ var o = u("\u2502", "|");
2044
+ var d2 = u("\u2514", "\u2014");
2045
+ var k2 = u("\u25CF", ">");
2046
+ var P2 = u("\u25CB", " ");
2047
+ var A2 = u("\u25FB", "[\u2022]");
2048
+ var T = u("\u25FC", "[+]");
2049
+ var F = u("\u25FB", "[ ]");
2050
+ var $e = u("\u25AA", "\u2022");
2051
+ var _2 = u("\u2500", "-");
2052
+ var me = u("\u256E", "+");
2053
+ var de = u("\u251C", "+");
2054
+ var pe = u("\u256F", "+");
2055
+ var q = u("\u25CF", "\u2022");
2056
+ var D = u("\u25C6", "*");
2057
+ var U = u("\u25B2", "!");
2058
+ var K2 = u("\u25A0", "x");
2059
+ var b2 = (t) => {
2060
+ switch (t) {
2061
+ case "initial":
2062
+ case "active":
2063
+ return import_picocolors2.default.cyan(le);
2064
+ case "cancel":
2065
+ return import_picocolors2.default.red(L2);
2066
+ case "error":
2067
+ return import_picocolors2.default.yellow(W2);
2068
+ case "submit":
2069
+ return import_picocolors2.default.green(C);
2070
+ }
2071
+ };
2072
+ var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
2073
+ const n = `${import_picocolors2.default.gray(o)}
2074
+ ${b2(this.state)} ${t.message}
2075
+ `, 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;
2076
+ switch (this.state) {
2077
+ case "error":
2078
+ return `${n.trim()}
2079
+ ${import_picocolors2.default.yellow(o)} ${i}
2080
+ ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
2081
+ `;
2082
+ case "submit":
2083
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
2084
+ case "cancel":
2085
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
2086
+ ${import_picocolors2.default.gray(o)}` : ""}`;
2087
+ default:
2088
+ return `${n}${import_picocolors2.default.cyan(o)} ${i}
2089
+ ${import_picocolors2.default.cyan(d2)}
2090
+ `;
2091
+ }
2092
+ } }).prompt();
2093
+ var Ie = (t = "") => {
2094
+ process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
2095
+ `);
2096
+ };
2097
+ var Se = (t = "") => {
2098
+ process.stdout.write(`${import_picocolors2.default.gray(o)}
2099
+ ${import_picocolors2.default.gray(d2)} ${t}
2100
+
2101
+ `);
2102
+ };
2103
+ var J = `${import_picocolors2.default.gray(o)} `;
2104
+
2105
+ // src/functions/prompt-project.ts
2106
+ async function promptProjectDetails() {
2107
+ Ie("mkcmd - Scaffold a new CLI project");
2108
+ const projectName = await he({
2109
+ message: "What is your project name?",
2110
+ placeholder: "my-cli"
2111
+ });
2112
+ const targetDir = await he({
2113
+ message: "Where should the project be created?",
2114
+ placeholder: "./my-cli",
2115
+ initialValue: `./${projectName}`
2116
+ });
2117
+ const description = await he({
2118
+ message: "What does this project do?",
2119
+ placeholder: "A CLI tool that does amazing things"
2120
+ });
2121
+ Se("Project details collected!");
2122
+ return { projectName, targetDir, description };
2123
+ }
2124
+
2125
+ // src/core/helpers/file-utils.ts
2126
+ import { mkdir, realpath } from "fs/promises";
2127
+ import { join as join3 } from "path";
2128
+ var pathCache = new Map;
2129
+ async function getRealPath(dir) {
2130
+ if (!pathCache.has(dir)) {
2131
+ const real = await realpath(dir);
2132
+ pathCache.set(dir, real);
2133
+ }
2134
+ return pathCache.get(dir);
2135
+ }
2136
+ async function writeFileTuple([targetDir, relativePath, content]) {
2137
+ const realDir = await getRealPath(targetDir);
2138
+ const fullPath = join3(realDir, relativePath);
2139
+ await mkdir(join3(fullPath, ".."), { recursive: true });
2140
+ await Bun.write(fullPath, content);
2141
+ }
2142
+
2143
+ // src/core/helpers/file-builder.ts
2144
+ class FileBuilder {
2145
+ lines = [];
2146
+ addLine(content, depth = 0) {
2147
+ this.lines.push(`${"\t".repeat(depth)}${content}`);
2148
+ }
2149
+ addEmptyLine() {
2150
+ this.lines.push("");
2151
+ }
2152
+ build() {
2153
+ return this.lines.join(`
2154
+ `);
2155
+ }
2156
+ }
2157
+
2158
+ // src/data/init.ts
2159
+ var commands_init = () => {
2160
+ const file = new FileBuilder;
2161
+ file.addLine(`import { registerCommand } from "../core/cli";`, 0);
2162
+ file.addEmptyLine();
2163
+ file.addLine(`export function registerCommands() {}`, 0);
2164
+ return file.build();
2165
+ };
2166
+ var config_init = (about) => {
2167
+ const file = new FileBuilder;
2168
+ file.addLine(`export const config = {`, 0);
2169
+ file.addLine(`about_text:`, 2);
2170
+ file.addLine(`"${about}",`, 1);
2171
+ file.addLine(`more_info_text:`, 2);
2172
+ file.addLine(`"See https://github.com/mackenziebowes/mkcmd for more details.",`, 1);
2173
+ file.addLine(`};`, 0);
2174
+ return file.build();
2175
+ };
2176
+ var package_init = (name) => {
2177
+ const file = new FileBuilder;
2178
+ file.addLine(`{`, 0);
2179
+ file.addLine(`"name": "${name}",`, 1);
2180
+ file.addLine(`"module": "index.ts",`, 1);
2181
+ file.addLine(`"type": "module",`, 1);
2182
+ file.addLine(`"private": true,`, 1);
2183
+ file.addLine(`"bin": {`, 1);
2184
+ file.addLine(`"${name.split(" ").join("")}": "./src/index.ts"`, 2);
2185
+ file.addLine(`},`, 1);
2186
+ file.addLine(`"devDependencies": {`, 1);
2187
+ file.addLine(`"@types/bun": "latest"`, 2);
2188
+ file.addLine(`},`, 1);
2189
+ file.addLine(`"peerDependencies": {`, 1);
2190
+ file.addLine(`"typescript": "^5"`, 2);
2191
+ file.addLine(`},`, 1);
2192
+ file.addLine(`"dependencies": {`, 1);
2193
+ file.addLine(`"@clack/prompts": "^0.11.0",`, 2);
2194
+ file.addLine(`"@types/figlet": "^1.7.0",`, 2);
2195
+ file.addLine(`"figlet": "^1.9.4"`, 2);
2196
+ file.addLine(`}`, 1);
2197
+ file.addLine(`}`, 0);
2198
+ return file.build();
2199
+ };
2200
+ var readme_init = (name) => {
2201
+ const file = new FileBuilder;
2202
+ file.addLine(`# ${name}`);
2203
+ file.addEmptyLine();
2204
+ file.addLine(`To install dependencies:`);
2205
+ file.addEmptyLine();
2206
+ file.addLine("```bash");
2207
+ file.addLine("bun install");
2208
+ file.addLine("```");
2209
+ file.addEmptyLine();
2210
+ file.addLine("To run:");
2211
+ file.addLine("```bash");
2212
+ file.addLine("bun run index.ts");
2213
+ file.addLine("```");
2214
+ file.addLine("This project was created using `bun init` in bun v1.2.13. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.");
2215
+ return file.build();
2216
+ };
2217
+ var tsconfig_init = () => {
2218
+ const file = new FileBuilder;
2219
+ file.addLine(`{`, 0);
2220
+ file.addLine(`"compilerOptions": {`, 1);
2221
+ file.addEmptyLine();
2222
+ file.addLine(`// Environment setup & latest features`, 1);
2223
+ file.addLine(`"lib": ["ESNext"],`, 1);
2224
+ file.addLine(`"target": "ESNext",`, 1);
2225
+ file.addLine(`"module": "ESNext",`, 1);
2226
+ file.addLine(`"moduleDetection": "force",`, 1);
2227
+ file.addLine(`"jsx": "react-jsx",`, 1);
2228
+ file.addLine(`"allowJs": true,`, 1);
2229
+ file.addEmptyLine();
2230
+ file.addLine(`// Bundler mode`, 1);
2231
+ file.addLine(`"moduleResolution": "bundler",`, 1);
2232
+ file.addLine(`"allowImportingTsExtensions": true,`, 1);
2233
+ file.addLine(`"verbatimModuleSyntax": true,`, 1);
2234
+ file.addLine(`"noEmit": true,`, 1);
2235
+ file.addEmptyLine();
2236
+ file.addLine(`// Best practices`, 1);
2237
+ file.addLine(`"strict": true,`, 1);
2238
+ file.addLine(`"skipLibCheck": true,`, 1);
2239
+ file.addLine(`"noFallthroughCasesInSwitch": true,`, 1);
2240
+ file.addLine(`"noUncheckedIndexedAccess": true,`, 1);
2241
+ file.addEmptyLine();
2242
+ file.addLine(`// Some stricter flags (disabled by default)`, 1);
2243
+ file.addLine(`"noUnusedLocals": false,`, 1);
2244
+ file.addLine(`"noUnusedParameters": false,`, 1);
2245
+ file.addLine(`"noPropertyAccessFromIndexSignature": false`, 1);
2246
+ file.addLine(`}`, 1);
2247
+ file.addLine(`}`, 0);
2248
+ return file.build();
2249
+ };
2250
+
2251
+ // src/functions/scaffold-project.ts
2252
+ async function scaffoldProject(prompts) {
2253
+ const { projectName, targetDir, description } = prompts;
2254
+ await writeFileTuple([targetDir, "src/commands/index.ts", commands_init()]);
2255
+ await writeFileTuple([targetDir, "src/config.ts", config_init(description)]);
2256
+ await writeFileTuple([targetDir, "package.json", package_init(projectName)]);
2257
+ await writeFileTuple([targetDir, "README.md", readme_init(projectName)]);
2258
+ await writeFileTuple([targetDir, "tsconfig.json", tsconfig_init()]);
2259
+ }
2260
+
2261
+ // src/functions/scaffold-core.ts
2262
+ import { join as join4 } from "path";
2263
+ import { readdir as readdir2 } from "fs/promises";
2264
+ import { fileURLToPath as fileURLToPath2 } from "url";
2265
+ var currentDir = join4(fileURLToPath2(import.meta.url), "../..");
2266
+ var sourceCoreDir = join4(currentDir, "src", "core");
2267
+ async function scaffoldCore(targetDir) {
2268
+ const files = await readdir2(sourceCoreDir);
2269
+ for (const file of files) {
2270
+ if (file.endsWith(".ts")) {
2271
+ const content = await Bun.file(join4(sourceCoreDir, file)).text();
2272
+ await writeFileTuple([targetDir, `src/core/${file}`, content]);
2273
+ }
2274
+ }
2275
+ }
2276
+
2277
+ // src/functions/orchestrate-scaffold.ts
2278
+ async function orchestrateScaffold() {
2279
+ const prompts = await promptProjectDetails();
2280
+ await scaffoldProject(prompts);
2281
+ log_default.single.info("Project", "Project files created");
2282
+ await scaffoldCore(prompts.targetDir);
2283
+ log_default.single.info("Core", "Core files copied");
2284
+ log_default.multi.info([
2285
+ { t: "Success", m: "Project scaffolded successfully!" },
2286
+ { t: "Location", m: prompts.targetDir },
2287
+ { t: "Next", m: `cd ${prompts.targetDir} && bun install` }
2288
+ ]);
2289
+ }
2290
+
2291
+ // src/commands/index.ts
2292
+ function registerCommands() {
2293
+ registerCommand({
2294
+ name: "init",
2295
+ description: "Initialize a new CLI project",
2296
+ instructions: "You will be prompted for project details",
2297
+ run: async () => {
2298
+ await orchestrateScaffold();
2299
+ }
2300
+ });
2301
+ }
2302
+
2303
+ // src/index.ts
2304
+ async function main() {
2305
+ registerCommands();
2306
+ runCLI();
2307
+ }
2308
+ main();