poof 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs ADDED
@@ -0,0 +1,842 @@
1
+ #!/usr/bin/env node
2
+ import path from 'node:path';
3
+ import N$1 from 'tty';
4
+ import poof from './index.mjs';
5
+ import 'node:fs/promises';
6
+ import 'node:os';
7
+ import 'node:child_process';
8
+ import 'node:url';
9
+ import 'node:timers/promises';
10
+
11
+ const V$2 = "known-flag", k$2 = "unknown-flag", C$1 = "argument", { stringify: h } = JSON, O$1 = /\B([A-Z])/g, v$1 = (t) => t.replace(O$1, "-$1").toLowerCase(), { hasOwnProperty: D$1 } = Object.prototype, w$2 = (t, n) => D$1.call(t, n), L$2 = (t) => Array.isArray(t), b$2 = (t) => typeof t == "function" ? [t, false] : L$2(t) ? [t[0], true] : b$2(t.type), d$2 = (t, n) => t === Boolean ? n !== "false" : n, m$1 = (t, n) => typeof n == "boolean" ? n : t === Number && n === "" ? Number.NaN : t(n), R$2 = /[\s.:=]/, B = (t) => {
12
+ const n = `Flag name ${h(t)}`;
13
+ if (t.length === 0) throw new Error(`${n} cannot be empty`);
14
+ if (t.length === 1) throw new Error(`${n} must be longer than a character`);
15
+ const r = t.match(R$2);
16
+ if (r) throw new Error(`${n} cannot contain ${h(r?.[0])}`);
17
+ }, K$1 = (t) => {
18
+ const n = {}, r = (e, o) => {
19
+ if (w$2(n, e)) throw new Error(`Duplicate flags named ${h(e)}`);
20
+ n[e] = o;
21
+ };
22
+ for (const e in t) {
23
+ if (!w$2(t, e)) continue;
24
+ B(e);
25
+ const o = t[e], s = [[], ...b$2(o), o];
26
+ r(e, s);
27
+ const i = v$1(e);
28
+ if (e !== i && r(i, s), "alias" in o && typeof o.alias == "string") {
29
+ const { alias: a } = o, l = `Flag alias ${h(a)} for flag ${h(e)}`;
30
+ if (a.length === 0) throw new Error(`${l} cannot be empty`);
31
+ if (a.length > 1) throw new Error(`${l} must be a single character`);
32
+ r(a, s);
33
+ }
34
+ }
35
+ return n;
36
+ }, _$2 = (t, n) => {
37
+ const r = {};
38
+ for (const e in t) {
39
+ if (!w$2(t, e)) continue;
40
+ const [o, , s, i] = n[e];
41
+ if (o.length === 0 && "default" in i) {
42
+ let { default: a } = i;
43
+ typeof a == "function" && (a = a()), r[e] = a;
44
+ } else r[e] = s ? o : o.pop();
45
+ }
46
+ return r;
47
+ }, F$1 = "--", G$1 = /[.:=]/, T$2 = /^-{1,2}\w/, N = (t) => {
48
+ if (!T$2.test(t)) return;
49
+ const n = !t.startsWith(F$1);
50
+ let r = t.slice(n ? 1 : 2), e;
51
+ const o = r.match(G$1);
52
+ if (o) {
53
+ const { index: s } = o;
54
+ e = r.slice(s + 1), r = r.slice(0, s);
55
+ }
56
+ return [r, e, n];
57
+ }, $$1 = (t, { onFlag: n, onArgument: r }) => {
58
+ let e;
59
+ const o = (s, i) => {
60
+ if (typeof e != "function") return true;
61
+ e(s, i), e = void 0;
62
+ };
63
+ for (let s = 0; s < t.length; s += 1) {
64
+ const i = t[s];
65
+ if (i === F$1) {
66
+ o();
67
+ const l = t.slice(s + 1);
68
+ r?.(l, [s], true);
69
+ break;
70
+ }
71
+ const a = N(i);
72
+ if (a) {
73
+ if (o(), !n) continue;
74
+ const [l, f, g] = a;
75
+ if (g) for (let c = 0; c < l.length; c += 1) {
76
+ o();
77
+ const u = c === l.length - 1;
78
+ e = n(l[c], u ? f : void 0, [s, c + 1, u]);
79
+ }
80
+ else e = n(l, f, [s]);
81
+ } else o(i, [s]) && r?.([i], [s]);
82
+ }
83
+ o();
84
+ }, E = (t, n) => {
85
+ for (const [r, e, o] of n.reverse()) {
86
+ if (e) {
87
+ const s = t[r];
88
+ let i = s.slice(0, e);
89
+ if (o || (i += s.slice(e + 1)), i !== "-") {
90
+ t[r] = i;
91
+ continue;
92
+ }
93
+ }
94
+ t.splice(r, 1);
95
+ }
96
+ }, U$2 = (t, n = process.argv.slice(2), { ignore: r } = {}) => {
97
+ const e = [], o = K$1(t), s = {}, i = [];
98
+ return i[F$1] = [], $$1(n, { onFlag(a, l, f) {
99
+ const g = w$2(o, a);
100
+ if (!r?.(g ? V$2 : k$2, a, l)) {
101
+ if (g) {
102
+ const [c, u] = o[a], y = d$2(u, l), p = (P, A) => {
103
+ e.push(f), A && e.push(A), c.push(m$1(u, P || ""));
104
+ };
105
+ return y === void 0 ? p : p(y);
106
+ }
107
+ w$2(s, a) || (s[a] = []), s[a].push(l === void 0 ? true : l), e.push(f);
108
+ }
109
+ }, onArgument(a, l, f) {
110
+ r?.(C$1, n[l[0]]) || (i.push(...a), f ? (i[F$1] = a, n.splice(l[0])) : e.push(l));
111
+ } }), E(n, e), { flags: _$2(t, o), unknownFlags: s, _: i };
112
+ };
113
+
114
+ var DD = Object.create;
115
+ var m = Object.defineProperty, uD = Object.defineProperties, FD = Object.getOwnPropertyDescriptor, CD = Object.getOwnPropertyDescriptors, tD = Object.getOwnPropertyNames, I$1 = Object.getOwnPropertySymbols, ED = Object.getPrototypeOf, L$1 = Object.prototype.hasOwnProperty, eD = Object.prototype.propertyIsEnumerable;
116
+ var W$1 = (D, F, u) => F in D ? m(D, F, { enumerable: true, configurable: true, writable: true, value: u }) : D[F] = u, p = (D, F) => {
117
+ for (var u in F || (F = {})) L$1.call(F, u) && W$1(D, u, F[u]);
118
+ if (I$1) for (var u of I$1(F)) eD.call(F, u) && W$1(D, u, F[u]);
119
+ return D;
120
+ }, c = (D, F) => uD(D, CD(F)), nD = (D) => m(D, "__esModule", { value: true });
121
+ var rD = (D, F) => () => (D && (F = D(D = 0)), F);
122
+ var iD = (D, F) => () => (F || D((F = { exports: {} }).exports, F), F.exports);
123
+ var oD = (D, F, u, C) => {
124
+ if (F && typeof F == "object" || typeof F == "function") for (let t of tD(F)) !L$1.call(D, t) && (t !== "default") && m(D, t, { get: () => F[t], enumerable: !(C = FD(F, t)) || C.enumerable });
125
+ return D;
126
+ }, BD = (D, F) => oD(nD(m(D != null ? DD(ED(D)) : {}, "default", { value: D, enumerable: true })), D);
127
+ var i = rD(() => {
128
+ });
129
+ var $ = iD((LD, N) => {
130
+ i();
131
+ N.exports = function() {
132
+ 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;
133
+ };
134
+ });
135
+ i();
136
+ i();
137
+ i();
138
+ var v = (D) => {
139
+ var u, C, t;
140
+ let F = (u = process.stdout.columns) != null ? u : Number.POSITIVE_INFINITY;
141
+ return typeof D == "function" && (D = D(F)), D || (D = {}), Array.isArray(D) ? { columns: D, stdoutColumns: F } : { columns: (C = D.columns) != null ? C : [], stdoutColumns: (t = D.stdoutColumns) != null ? t : F };
142
+ };
143
+ i();
144
+ i();
145
+ i();
146
+ i();
147
+ i();
148
+ function w$1({ onlyFirst: D = false } = {}) {
149
+ let F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
150
+ return new RegExp(F, D ? void 0 : "g");
151
+ }
152
+ function d$1(D) {
153
+ if (typeof D != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);
154
+ return D.replace(w$1(), "");
155
+ }
156
+ i();
157
+ function y$1(D) {
158
+ return Number.isInteger(D) ? D >= 4352 && (D <= 4447 || D === 9001 || D === 9002 || 11904 <= D && D <= 12871 && D !== 12351 || 12880 <= D && D <= 19903 || 19968 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65131 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127569 || 131072 <= D && D <= 262141) : false;
159
+ }
160
+ var j = BD($());
161
+ function g(D) {
162
+ if (typeof D != "string" || D.length === 0 || (D = d$1(D), D.length === 0)) return 0;
163
+ D = D.replace((0, j.default)(), " ");
164
+ let F = 0;
165
+ for (let u = 0; u < D.length; u++) {
166
+ let C = D.codePointAt(u);
167
+ C <= 31 || C >= 127 && C <= 159 || C >= 768 && C <= 879 || (C > 65535 && u++, F += y$1(C) ? 2 : 1);
168
+ }
169
+ return F;
170
+ }
171
+ var b$1 = (D) => Math.max(...D.split(`
172
+ `).map(g));
173
+ var k$1 = (D) => {
174
+ let F = [];
175
+ for (let u of D) {
176
+ let { length: C } = u, t = C - F.length;
177
+ for (let E = 0; E < t; E += 1) F.push(0);
178
+ for (let E = 0; E < C; E += 1) {
179
+ let e = b$1(u[E]);
180
+ e > F[E] && (F[E] = e);
181
+ }
182
+ }
183
+ return F;
184
+ };
185
+ i();
186
+ var _$1 = /^\d+%$/, z$1 = { width: "auto", align: "left", contentWidth: 0, paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0, horizontalPadding: 0, paddingLeftString: "", paddingRightString: "" }, sD = (D, F) => {
187
+ var C;
188
+ let u = [];
189
+ for (let t = 0; t < D.length; t += 1) {
190
+ let E = (C = F[t]) != null ? C : "auto";
191
+ if (typeof E == "number" || E === "auto" || E === "content-width" || typeof E == "string" && _$1.test(E)) {
192
+ u.push(c(p({}, z$1), { width: E, contentWidth: D[t] }));
193
+ continue;
194
+ }
195
+ if (E && typeof E == "object") {
196
+ let e = c(p(p({}, z$1), E), { contentWidth: D[t] });
197
+ e.horizontalPadding = e.paddingLeft + e.paddingRight, u.push(e);
198
+ continue;
199
+ }
200
+ throw new Error(`Invalid column width: ${JSON.stringify(E)}`);
201
+ }
202
+ return u;
203
+ };
204
+ function aD(D, F) {
205
+ for (let u of D) {
206
+ let { width: C } = u;
207
+ if (C === "content-width" && (u.width = u.contentWidth), C === "auto") {
208
+ let n = Math.min(20, u.contentWidth);
209
+ u.width = n, u.autoOverflow = u.contentWidth - n;
210
+ }
211
+ if (typeof C == "string" && _$1.test(C)) {
212
+ let n = Number.parseFloat(C.slice(0, -1)) / 100;
213
+ u.width = Math.floor(F * n) - (u.paddingLeft + u.paddingRight);
214
+ }
215
+ let { horizontalPadding: t } = u, E = 1, e = E + t;
216
+ if (e >= F) {
217
+ let n = e - F, o = Math.ceil(u.paddingLeft / t * n), B = n - o;
218
+ u.paddingLeft -= o, u.paddingRight -= B, u.horizontalPadding = u.paddingLeft + u.paddingRight;
219
+ }
220
+ u.paddingLeftString = u.paddingLeft ? " ".repeat(u.paddingLeft) : "", u.paddingRightString = u.paddingRight ? " ".repeat(u.paddingRight) : "";
221
+ let r = F - u.horizontalPadding;
222
+ u.width = Math.max(Math.min(u.width, r), E);
223
+ }
224
+ }
225
+ var G = () => Object.assign([], { columns: 0 });
226
+ function lD(D, F) {
227
+ let u = [G()], [C] = u;
228
+ for (let t of D) {
229
+ let E = t.width + t.horizontalPadding;
230
+ C.columns + E > F && (C = G(), u.push(C)), C.push(t), C.columns += E;
231
+ }
232
+ for (let t of u) {
233
+ let E = t.reduce((s, l) => s + l.width + l.horizontalPadding, 0), e = F - E;
234
+ if (e === 0) continue;
235
+ let r = t.filter((s) => "autoOverflow" in s), n = r.filter((s) => s.autoOverflow > 0), o = n.reduce((s, l) => s + l.autoOverflow, 0), B = Math.min(o, e);
236
+ for (let s of n) {
237
+ let l = Math.floor(s.autoOverflow / o * B);
238
+ s.width += l, e -= l;
239
+ }
240
+ let a = Math.floor(e / r.length);
241
+ for (let s = 0; s < r.length; s += 1) {
242
+ let l = r[s];
243
+ s === r.length - 1 ? l.width += e : l.width += a, e -= a;
244
+ }
245
+ }
246
+ return u;
247
+ }
248
+ function Z$1(D, F, u) {
249
+ let C = sD(u, F);
250
+ return aD(C, D), lD(C, D);
251
+ }
252
+ i();
253
+ i();
254
+ i();
255
+ var O = 10, U$1 = (D = 0) => (F) => `\x1B[${F + D}m`, V$1 = (D = 0) => (F) => `\x1B[${38 + D};5;${F}m`, Y = (D = 0) => (F, u, C) => `\x1B[${38 + D};2;${F};${u};${C}m`;
256
+ function AD() {
257
+ let D = /* @__PURE__ */ new Map(), F = { 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], 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], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
258
+ F.color.gray = F.color.blackBright, F.bgColor.bgGray = F.bgColor.bgBlackBright, F.color.grey = F.color.blackBright, F.bgColor.bgGrey = F.bgColor.bgBlackBright;
259
+ for (let [u, C] of Object.entries(F)) {
260
+ for (let [t, E] of Object.entries(C)) F[t] = { open: `\x1B[${E[0]}m`, close: `\x1B[${E[1]}m` }, C[t] = F[t], D.set(E[0], E[1]);
261
+ Object.defineProperty(F, u, { value: C, enumerable: false });
262
+ }
263
+ return Object.defineProperty(F, "codes", { value: D, enumerable: false }), F.color.close = "\x1B[39m", F.bgColor.close = "\x1B[49m", F.color.ansi = U$1(), F.color.ansi256 = V$1(), F.color.ansi16m = Y(), F.bgColor.ansi = U$1(O), F.bgColor.ansi256 = V$1(O), F.bgColor.ansi16m = Y(O), Object.defineProperties(F, { rgbToAnsi256: { value: (u, C, t) => u === C && C === t ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(C / 255 * 5) + Math.round(t / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
264
+ let C = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(u.toString(16));
265
+ if (!C) return [0, 0, 0];
266
+ let { colorString: t } = C.groups;
267
+ t.length === 3 && (t = t.split("").map((e) => e + e).join(""));
268
+ let E = Number.parseInt(t, 16);
269
+ return [E >> 16 & 255, E >> 8 & 255, E & 255];
270
+ }, enumerable: false }, hexToAnsi256: { value: (u) => F.rgbToAnsi256(...F.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
271
+ if (u < 8) return 30 + u;
272
+ if (u < 16) return 90 + (u - 8);
273
+ let C, t, E;
274
+ if (u >= 232) C = ((u - 232) * 10 + 8) / 255, t = C, E = C;
275
+ else {
276
+ u -= 16;
277
+ let n = u % 36;
278
+ C = Math.floor(u / 36) / 5, t = Math.floor(n / 6) / 5, E = n % 6 / 5;
279
+ }
280
+ let e = Math.max(C, t, E) * 2;
281
+ if (e === 0) return 30;
282
+ let r = 30 + (Math.round(E) << 2 | Math.round(t) << 1 | Math.round(C));
283
+ return e === 2 && (r += 60), r;
284
+ }, enumerable: false }, rgbToAnsi: { value: (u, C, t) => F.ansi256ToAnsi(F.rgbToAnsi256(u, C, t)), enumerable: false }, hexToAnsi: { value: (u) => F.ansi256ToAnsi(F.hexToAnsi256(u)), enumerable: false } }), F;
285
+ }
286
+ var fD = AD(), K = fD;
287
+ var x$1 = /* @__PURE__ */ new Set(["\x1B", "\x9B"]), gD = 39, R$1 = "\x07", q$1 = "[", pD = "]", H$1 = "m", M$1 = `${pD}8;;`, J$1 = (D) => `${x$1.values().next().value}${q$1}${D}${H$1}`, Q = (D) => `${x$1.values().next().value}${M$1}${D}${R$1}`, hD = (D) => D.split(" ").map((F) => g(F)), S = (D, F, u) => {
288
+ let C = [...F], t = false, E = false, e = g(d$1(D[D.length - 1]));
289
+ for (let [r, n] of C.entries()) {
290
+ let o = g(n);
291
+ if (e + o <= u ? D[D.length - 1] += n : (D.push(n), e = 0), x$1.has(n) && (t = true, E = C.slice(r + 1).join("").startsWith(M$1)), t) {
292
+ E ? n === R$1 && (t = false, E = false) : n === H$1 && (t = false);
293
+ continue;
294
+ }
295
+ e += o, e === u && r < C.length - 1 && (D.push(""), e = 0);
296
+ }
297
+ !e && D[D.length - 1].length > 0 && D.length > 1 && (D[D.length - 2] += D.pop());
298
+ }, cD = (D) => {
299
+ let F = D.split(" "), u = F.length;
300
+ for (; u > 0 && !(g(F[u - 1]) > 0); ) u--;
301
+ return u === F.length ? D : F.slice(0, u).join(" ") + F.slice(u).join("");
302
+ }, dD = (D, F, u = {}) => {
303
+ if (u.trim !== false && D.trim() === "") return "";
304
+ let C = "", t, E, e = hD(D), r = [""];
305
+ for (let [o, B] of D.split(" ").entries()) {
306
+ u.trim !== false && (r[r.length - 1] = r[r.length - 1].trimStart());
307
+ let a = g(r[r.length - 1]);
308
+ if (o !== 0 && (a >= F && (u.wordWrap === false || u.trim === false) && (r.push(""), a = 0), (a > 0 || u.trim === false) && (r[r.length - 1] += " ", a++)), u.hard && e[o] > F) {
309
+ let s = F - a, l = 1 + Math.floor((e[o] - s - 1) / F);
310
+ Math.floor((e[o] - 1) / F) < l && r.push(""), S(r, B, F);
311
+ continue;
312
+ }
313
+ if (a + e[o] > F && a > 0 && e[o] > 0) {
314
+ if (u.wordWrap === false && a < F) {
315
+ S(r, B, F);
316
+ continue;
317
+ }
318
+ r.push("");
319
+ }
320
+ if (a + e[o] > F && u.wordWrap === false) {
321
+ S(r, B, F);
322
+ continue;
323
+ }
324
+ r[r.length - 1] += B;
325
+ }
326
+ u.trim !== false && (r = r.map((o) => cD(o)));
327
+ let n = [...r.join(`
328
+ `)];
329
+ for (let [o, B] of n.entries()) {
330
+ if (C += B, x$1.has(B)) {
331
+ let { groups: s } = new RegExp(`(?:\\${q$1}(?<code>\\d+)m|\\${M$1}(?<uri>.*)${R$1})`).exec(n.slice(o).join("")) || { groups: {} };
332
+ if (s.code !== void 0) {
333
+ let l = Number.parseFloat(s.code);
334
+ t = l === gD ? void 0 : l;
335
+ } else s.uri !== void 0 && (E = s.uri.length === 0 ? void 0 : s.uri);
336
+ }
337
+ let a = K.codes.get(Number(t));
338
+ n[o + 1] === `
339
+ ` ? (E && (C += Q("")), t && a && (C += J$1(a))) : B === `
340
+ ` && (t && a && (C += J$1(t)), E && (C += Q(E)));
341
+ }
342
+ return C;
343
+ };
344
+ function T$1(D, F, u) {
345
+ return String(D).normalize().replace(/\r\n/g, `
346
+ `).split(`
347
+ `).map((C) => dD(C, F, u)).join(`
348
+ `);
349
+ }
350
+ var X = (D) => Array.from({ length: D }).fill("");
351
+ function P$1(D, F) {
352
+ let u = [], C = 0;
353
+ for (let t of D) {
354
+ let E = 0, e = t.map((n) => {
355
+ var a;
356
+ let o = (a = F[C]) != null ? a : "";
357
+ C += 1, n.preprocess && (o = n.preprocess(o)), b$1(o) > n.width && (o = T$1(o, n.width, { hard: true }));
358
+ let B = o.split(`
359
+ `);
360
+ if (n.postprocess) {
361
+ let { postprocess: s } = n;
362
+ B = B.map((l, h) => s.call(n, l, h));
363
+ }
364
+ return n.paddingTop && B.unshift(...X(n.paddingTop)), n.paddingBottom && B.push(...X(n.paddingBottom)), B.length > E && (E = B.length), c(p({}, n), { lines: B });
365
+ }), r = [];
366
+ for (let n = 0; n < E; n += 1) {
367
+ let o = e.map((B) => {
368
+ var h;
369
+ let a = (h = B.lines[n]) != null ? h : "", s = Number.isFinite(B.width) ? " ".repeat(B.width - g(a)) : "", l = B.paddingLeftString;
370
+ return B.align === "right" && (l += s), l += a, B.align === "left" && (l += s), l + B.paddingRightString;
371
+ }).join("");
372
+ r.push(o);
373
+ }
374
+ u.push(r.join(`
375
+ `));
376
+ }
377
+ return u.join(`
378
+ `);
379
+ }
380
+ function mD(D, F) {
381
+ if (!D || D.length === 0) return "";
382
+ let u = k$1(D), C = u.length;
383
+ if (C === 0) return "";
384
+ let { stdoutColumns: t, columns: E } = v(F);
385
+ if (E.length > C) throw new Error(`${E.length} columns defined, but only ${C} columns found`);
386
+ let e = Z$1(t, E, u);
387
+ return D.map((r) => P$1(e, r)).join(`
388
+ `);
389
+ }
390
+ i();
391
+ var bD = ["<", ">", "=", ">=", "<="];
392
+ function xD(D) {
393
+ if (!bD.includes(D)) throw new TypeError(`Invalid breakpoint operator: ${D}`);
394
+ }
395
+ function wD(D) {
396
+ let F = Object.keys(D).map((u) => {
397
+ let [C, t] = u.split(" ");
398
+ xD(C);
399
+ let E = Number.parseInt(t, 10);
400
+ if (Number.isNaN(E)) throw new TypeError(`Invalid breakpoint value: ${t}`);
401
+ let e = D[u];
402
+ return { operator: C, breakpoint: E, value: e };
403
+ }).sort((u, C) => C.breakpoint - u.breakpoint);
404
+ return (u) => {
405
+ var C;
406
+ return (C = F.find(({ operator: t, breakpoint: E }) => t === "=" && u === E || t === ">" && u > E || t === "<" && u < E || t === ">=" && u >= E || t === "<=" && u <= E)) == null ? void 0 : C.value;
407
+ };
408
+ }
409
+
410
+ const P = (t) => t.replace(/[\W_]([a-z\d])?/gi, (e, r) => r ? r.toUpperCase() : ""), q = (t) => t.replace(/\B([A-Z])/g, "-$1").toLowerCase(), I = { "> 80": [{ width: "content-width", paddingLeft: 2, paddingRight: 8 }, { width: "auto" }], "> 40": [{ width: "auto", paddingLeft: 2, paddingRight: 8, preprocess: (t) => t.trim() }, { width: "100%", paddingLeft: 2, paddingBottom: 1 }], "> 0": { stdoutColumns: 1e3, columns: [{ width: "content-width", paddingLeft: 2, paddingRight: 8 }, { width: "content-width" }] } };
411
+ function D(t) {
412
+ let e = false;
413
+ return { type: "table", data: { tableData: Object.keys(t).sort((a, i) => a.localeCompare(i)).map((a) => {
414
+ const i = t[a], s = "alias" in i;
415
+ return s && (e = true), { name: a, flag: i, flagFormatted: `--${q(a)}`, aliasesEnabled: e, aliasFormatted: s ? `-${i.alias}` : void 0 };
416
+ }).map((a) => (a.aliasesEnabled = e, [{ type: "flagName", data: a }, { type: "flagDescription", data: a }])), tableBreakpoints: I } };
417
+ }
418
+ const A = (t) => !t || (t.version ?? (t.help ? t.help.version : void 0)), C = (t) => {
419
+ const e = "parent" in t && t.parent?.name;
420
+ return (e ? `${e} ` : "") + t.name;
421
+ };
422
+ function R(t) {
423
+ const e = [];
424
+ t.name && e.push(C(t));
425
+ const r = A(t) ?? ("parent" in t && A(t.parent));
426
+ if (r && e.push(`v${r}`), e.length !== 0) return { id: "name", type: "text", data: `${e.join(" ")}
427
+ ` };
428
+ }
429
+ function L(t) {
430
+ const { help: e } = t;
431
+ if (!(!e || !e.description)) return { id: "description", type: "text", data: `${e.description}
432
+ ` };
433
+ }
434
+ function T(t) {
435
+ const e = t.help || {};
436
+ if ("usage" in e) return e.usage ? { id: "usage", type: "section", data: { title: "Usage:", body: Array.isArray(e.usage) ? e.usage.join(`
437
+ `) : e.usage } } : void 0;
438
+ if (t.name) {
439
+ const r = [], n = [C(t)];
440
+ if (t.flags && Object.keys(t.flags).length > 0 && n.push("[flags...]"), t.parameters && t.parameters.length > 0) {
441
+ const { parameters: a } = t, i = a.indexOf("--"), s = i > -1 && a.slice(i + 1).some((o) => o.startsWith("<"));
442
+ n.push(a.map((o) => o !== "--" ? o : s ? "--" : "[--]").join(" "));
443
+ }
444
+ if (n.length > 1 && r.push(n.join(" ")), "commands" in t && t.commands?.length && r.push(`${t.name} <command>`), r.length > 0) return { id: "usage", type: "section", data: { title: "Usage:", body: r.join(`
445
+ `) } };
446
+ }
447
+ }
448
+ function _(t) {
449
+ return !("commands" in t) || !t.commands?.length ? void 0 : { id: "commands", type: "section", data: { title: "Commands:", body: { type: "table", data: { tableData: t.commands.map((n) => [n.options.name, n.options.help ? n.options.help.description : ""]), tableOptions: [{ width: "content-width", paddingLeft: 2, paddingRight: 8 }] } }, indentBody: 0 } };
450
+ }
451
+ function k(t) {
452
+ if (!(!t.flags || Object.keys(t.flags).length === 0)) return { id: "flags", type: "section", data: { title: "Flags:", body: D(t.flags), indentBody: 0 } };
453
+ }
454
+ function F(t) {
455
+ const { help: e } = t;
456
+ if (!e || !e.examples || e.examples.length === 0) return;
457
+ let { examples: r } = e;
458
+ if (Array.isArray(r) && (r = r.join(`
459
+ `)), r) return { id: "examples", type: "section", data: { title: "Examples:", body: r } };
460
+ }
461
+ function H(t) {
462
+ if (!("alias" in t) || !t.alias) return;
463
+ const { alias: e } = t;
464
+ return { id: "aliases", type: "section", data: { title: "Aliases:", body: Array.isArray(e) ? e.join(", ") : e } };
465
+ }
466
+ const U = (t) => [R, L, T, _, k, F, H].map((e) => e(t)).filter(Boolean), V = N$1.WriteStream.prototype.hasColors();
467
+ class J {
468
+ text(e) {
469
+ return e;
470
+ }
471
+ bold(e) {
472
+ return V ? `\x1B[1m${e}\x1B[22m` : e.toLocaleUpperCase();
473
+ }
474
+ indentText({ text: e, spaces: r }) {
475
+ return e.replace(/^/gm, " ".repeat(r));
476
+ }
477
+ heading(e) {
478
+ return this.bold(e);
479
+ }
480
+ section({ title: e, body: r, indentBody: n = 2 }) {
481
+ return `${(e ? `${this.heading(e)}
482
+ ` : "") + (r ? this.indentText({ text: this.render(r), spaces: n }) : "")}
483
+ `;
484
+ }
485
+ table({ tableData: e, tableOptions: r, tableBreakpoints: n }) {
486
+ return mD(e.map((a) => a.map((i) => this.render(i))), n ? wD(n) : r);
487
+ }
488
+ flagParameter(e) {
489
+ return e === Boolean ? "" : e === String ? "<string>" : e === Number ? "<number>" : Array.isArray(e) ? this.flagParameter(e[0]) : "<value>";
490
+ }
491
+ flagOperator(e) {
492
+ return " ";
493
+ }
494
+ flagName(e) {
495
+ const { flag: r, flagFormatted: n, aliasesEnabled: a, aliasFormatted: i } = e;
496
+ let s = "";
497
+ if (i ? s += `${i}, ` : a && (s += " "), s += n, "placeholder" in r && typeof r.placeholder == "string") s += `${this.flagOperator(e)}${r.placeholder}`;
498
+ else {
499
+ const o = this.flagParameter("type" in r ? r.type : r);
500
+ o && (s += `${this.flagOperator(e)}${o}`);
501
+ }
502
+ return s;
503
+ }
504
+ flagDefault(e) {
505
+ return JSON.stringify(e);
506
+ }
507
+ flagDescription({ flag: e }) {
508
+ let r = "description" in e ? e.description ?? "" : "";
509
+ if ("default" in e) {
510
+ let { default: n } = e;
511
+ typeof n == "function" && (n = n()), n && (r += ` (default: ${this.flagDefault(n)})`);
512
+ }
513
+ return r;
514
+ }
515
+ render(e) {
516
+ if (typeof e == "string") return e;
517
+ if (Array.isArray(e)) return e.map((r) => this.render(r)).join(`
518
+ `);
519
+ if ("type" in e && this[e.type]) {
520
+ const r = this[e.type];
521
+ if (typeof r == "function") return r.call(this, e.data);
522
+ }
523
+ throw new Error(`Invalid node type: ${JSON.stringify(e)}`);
524
+ }
525
+ }
526
+ const y = (t) => t.length > 0 && !t.includes(" "), { stringify: d } = JSON, M = /[|\\{}()[\]^$+*?.]/;
527
+ function w(t) {
528
+ const e = [];
529
+ let r, n;
530
+ for (const a of t) {
531
+ if (n) throw new Error(`Invalid parameter: Spread parameter ${d(n)} must be last`);
532
+ const i = a[0], s = a[a.length - 1];
533
+ let o;
534
+ if (i === "<" && s === ">" && (o = true, r)) throw new Error(`Invalid parameter: Required parameter ${d(a)} cannot come after optional parameter ${d(r)}`);
535
+ if (i === "[" && s === "]" && (o = false, r = a), o === void 0) throw new Error(`Invalid parameter: ${d(a)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);
536
+ let l = a.slice(1, -1);
537
+ const f = l.slice(-3) === "...";
538
+ f && (n = a, l = l.slice(0, -3));
539
+ const p = l.match(M);
540
+ if (p) throw new Error(`Invalid parameter: ${d(a)}. Invalid character found ${d(p[0])}`);
541
+ e.push({ name: l, required: o, spread: f });
542
+ }
543
+ return e;
544
+ }
545
+ function b(t, e, r, n) {
546
+ for (let a = 0; a < e.length; a += 1) {
547
+ const { name: i, required: s, spread: o } = e[a], l = P(i);
548
+ if (l in t) throw new Error(`Invalid parameter: ${d(i)} is used more than once.`);
549
+ const f = o ? r.slice(a) : r[a];
550
+ if (o && (a = e.length), s && (!f || o && f.length === 0)) return console.error(`Error: Missing required parameter ${d(i)}
551
+ `), n(), process.exit(1);
552
+ t[l] = f;
553
+ }
554
+ }
555
+ function W(t) {
556
+ return t === void 0 || t !== false;
557
+ }
558
+ function x(t, e, r, n) {
559
+ const a = { ...e.flags }, i = e.version;
560
+ i && (a.version = { type: Boolean, description: "Show version" });
561
+ const { help: s } = e, o = W(s);
562
+ o && !("help" in a) && (a.help = { type: Boolean, alias: "h", description: "Show help" });
563
+ const l = U$2(a, n, { ignore: e.ignoreArgv }), f = () => {
564
+ console.log(e.version);
565
+ };
566
+ if (i && l.flags.version === true) return f(), process.exit(0);
567
+ const p = new J(), O = o && s?.render ? s.render : (c) => p.render(c), u = (c) => {
568
+ const m = U({ ...e, ...c ? { help: c } : {}, flags: a });
569
+ console.log(O(m, p));
570
+ };
571
+ if (o && l.flags.help === true) return u(), process.exit(0);
572
+ if (e.parameters) {
573
+ let { parameters: c } = e, m = l._;
574
+ const g = c.indexOf("--"), v = c.slice(g + 1), h = /* @__PURE__ */ Object.create(null);
575
+ if (g > -1 && v.length > 0) {
576
+ c = c.slice(0, g);
577
+ const E = l._["--"];
578
+ m = m.slice(0, -E.length || void 0), b(h, w(c), m, u), b(h, w(v), E, u);
579
+ } else b(h, w(c), m, u);
580
+ Object.assign(l._, h);
581
+ }
582
+ const $ = { ...l, showVersion: f, showHelp: u };
583
+ return typeof r == "function" && r($), { command: t, ...$ };
584
+ }
585
+ function z(t, e) {
586
+ const r = /* @__PURE__ */ new Map();
587
+ for (const n of e) {
588
+ const a = [n.options.name], { alias: i } = n.options;
589
+ i && (Array.isArray(i) ? a.push(...i) : a.push(i));
590
+ for (const s of a) {
591
+ if (r.has(s)) throw new Error(`Duplicate command name found: ${d(s)}`);
592
+ r.set(s, n);
593
+ }
594
+ }
595
+ return r.get(t);
596
+ }
597
+ function Z(t, e, r = process.argv.slice(2)) {
598
+ if (!t) throw new Error("Options is required");
599
+ if ("name" in t && (!t.name || !y(t.name))) throw new Error(`Invalid script name: ${d(t.name)}`);
600
+ const n = r[0];
601
+ if (t.commands && n && y(n)) {
602
+ const a = z(n, t.commands);
603
+ if (a) return x(a.options.name, { ...a.options, parent: t }, a.callback, r.slice(1));
604
+ }
605
+ return x(void 0, t, e, r);
606
+ }
607
+
608
+ const peq = new Uint32Array(65536);
609
+ const myers_32 = (a, b) => {
610
+ const n = a.length;
611
+ const m = b.length;
612
+ const lst = 1 << n - 1;
613
+ let pv = -1;
614
+ let mv = 0;
615
+ let sc = n;
616
+ let i = n;
617
+ while (i--) {
618
+ peq[a.charCodeAt(i)] |= 1 << i;
619
+ }
620
+ for (i = 0; i < m; i++) {
621
+ let eq = peq[b.charCodeAt(i)];
622
+ const xv = eq | mv;
623
+ eq |= (eq & pv) + pv ^ pv;
624
+ mv |= ~(eq | pv);
625
+ pv &= eq;
626
+ if (mv & lst) {
627
+ sc++;
628
+ }
629
+ if (pv & lst) {
630
+ sc--;
631
+ }
632
+ mv = mv << 1 | 1;
633
+ pv = pv << 1 | ~(xv | mv);
634
+ mv &= xv;
635
+ }
636
+ i = n;
637
+ while (i--) {
638
+ peq[a.charCodeAt(i)] = 0;
639
+ }
640
+ return sc;
641
+ };
642
+ const myers_x = (b, a) => {
643
+ const n = a.length;
644
+ const m = b.length;
645
+ const mhc = [];
646
+ const phc = [];
647
+ const hsize = Math.ceil(n / 32);
648
+ const vsize = Math.ceil(m / 32);
649
+ for (let i = 0; i < hsize; i++) {
650
+ phc[i] = -1;
651
+ mhc[i] = 0;
652
+ }
653
+ let j = 0;
654
+ for (; j < vsize - 1; j++) {
655
+ let mv2 = 0;
656
+ let pv2 = -1;
657
+ const start2 = j * 32;
658
+ const vlen2 = Math.min(32, m) + start2;
659
+ for (let k = start2; k < vlen2; k++) {
660
+ peq[b.charCodeAt(k)] |= 1 << k;
661
+ }
662
+ for (let i = 0; i < n; i++) {
663
+ const eq = peq[a.charCodeAt(i)];
664
+ const pb = phc[i / 32 | 0] >>> i & 1;
665
+ const mb = mhc[i / 32 | 0] >>> i & 1;
666
+ const xv = eq | mv2;
667
+ const xh = ((eq | mb) & pv2) + pv2 ^ pv2 | eq | mb;
668
+ let ph = mv2 | ~(xh | pv2);
669
+ let mh = pv2 & xh;
670
+ if (ph >>> 31 ^ pb) {
671
+ phc[i / 32 | 0] ^= 1 << i;
672
+ }
673
+ if (mh >>> 31 ^ mb) {
674
+ mhc[i / 32 | 0] ^= 1 << i;
675
+ }
676
+ ph = ph << 1 | pb;
677
+ mh = mh << 1 | mb;
678
+ pv2 = mh | ~(xv | ph);
679
+ mv2 = ph & xv;
680
+ }
681
+ for (let k = start2; k < vlen2; k++) {
682
+ peq[b.charCodeAt(k)] = 0;
683
+ }
684
+ }
685
+ let mv = 0;
686
+ let pv = -1;
687
+ const start = j * 32;
688
+ const vlen = Math.min(32, m - start) + start;
689
+ for (let k = start; k < vlen; k++) {
690
+ peq[b.charCodeAt(k)] |= 1 << k;
691
+ }
692
+ let score = m;
693
+ for (let i = 0; i < n; i++) {
694
+ const eq = peq[a.charCodeAt(i)];
695
+ const pb = phc[i / 32 | 0] >>> i & 1;
696
+ const mb = mhc[i / 32 | 0] >>> i & 1;
697
+ const xv = eq | mv;
698
+ const xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
699
+ let ph = mv | ~(xh | pv);
700
+ let mh = pv & xh;
701
+ score += ph >>> m - 1 & 1;
702
+ score -= mh >>> m - 1 & 1;
703
+ if (ph >>> 31 ^ pb) {
704
+ phc[i / 32 | 0] ^= 1 << i;
705
+ }
706
+ if (mh >>> 31 ^ mb) {
707
+ mhc[i / 32 | 0] ^= 1 << i;
708
+ }
709
+ ph = ph << 1 | pb;
710
+ mh = mh << 1 | mb;
711
+ pv = mh | ~(xv | ph);
712
+ mv = ph & xv;
713
+ }
714
+ for (let k = start; k < vlen; k++) {
715
+ peq[b.charCodeAt(k)] = 0;
716
+ }
717
+ return score;
718
+ };
719
+ const distance = (a, b) => {
720
+ if (a.length < b.length) {
721
+ const tmp = b;
722
+ b = a;
723
+ a = tmp;
724
+ }
725
+ if (b.length === 0) {
726
+ return a.length;
727
+ }
728
+ if (a.length <= 32) {
729
+ return myers_32(a, b);
730
+ }
731
+ return myers_x(a, b);
732
+ };
733
+ const closest = (str, arr) => {
734
+ let min_distance = Infinity;
735
+ let min_index = 0;
736
+ for (let i = 0; i < arr.length; i++) {
737
+ const dist = distance(str, arr[i]);
738
+ if (dist < min_distance) {
739
+ min_distance = dist;
740
+ min_index = i;
741
+ }
742
+ }
743
+ return arr[min_index];
744
+ };
745
+
746
+ var name = "poof";
747
+ var version = "3.0.0";
748
+ var description = "Fast, non-blocking rm -rf alternative. Deletes files instantly while cleanup runs in the background.";
749
+ var packageJson = {
750
+ name: name,
751
+ version: version,
752
+ description: description};
753
+
754
+ const knownFlags = ["dry", "verbose", "dangerous", "version", "help"];
755
+ const findClosestFlag = (unknown) => {
756
+ const match = closest(unknown, knownFlags);
757
+ return distance(unknown, match) <= 2 ? match : void 0;
758
+ };
759
+ const friendlyMessages = {
760
+ EBUSY: "Resource busy or locked",
761
+ EPERM: "Operation not permitted",
762
+ ENOENT: "File not found"
763
+ };
764
+ const formatError = ({ error }) => {
765
+ const { code, message } = error;
766
+ if (code && code in friendlyMessages) {
767
+ return friendlyMessages[code];
768
+ }
769
+ return message;
770
+ };
771
+ const argv = Z({
772
+ name: packageJson.name,
773
+ version: packageJson.version,
774
+ description: packageJson.description,
775
+ parameters: ["[globs...]"],
776
+ flags: {
777
+ dry: {
778
+ type: Boolean,
779
+ alias: "d",
780
+ description: "Simulate the deletion"
781
+ },
782
+ verbose: {
783
+ type: Boolean,
784
+ alias: "v",
785
+ description: "Log removed files"
786
+ },
787
+ dangerous: {
788
+ type: Boolean,
789
+ description: "Allow deleting paths outside current directory"
790
+ }
791
+ }
792
+ });
793
+ const unknownFlags = Object.keys(argv.unknownFlags);
794
+ if (unknownFlags.length > 0) {
795
+ for (const flag of unknownFlags) {
796
+ const closestMatch = findClosestFlag(flag);
797
+ const suggestion = closestMatch ? ` (Did you mean --${closestMatch}?)` : "";
798
+ console.error(`Unknown flag: --${flag}.${suggestion}`);
799
+ }
800
+ process.exit(1);
801
+ }
802
+ (async () => {
803
+ const { globs } = argv._;
804
+ if (globs.length === 0) {
805
+ argv.showHelp();
806
+ return;
807
+ }
808
+ const cwd = process.cwd();
809
+ const { deleted, errors } = await poof(globs, {
810
+ dry: argv.flags.dry,
811
+ dangerous: argv.flags.dangerous
812
+ });
813
+ if (deleted.length === 0 && errors.length === 0) {
814
+ console.warn("No matches found");
815
+ }
816
+ if (argv.flags.dry) {
817
+ console.log("Dry run (no files deleted)");
818
+ if (deleted.length > 0) {
819
+ console.log("Would delete:");
820
+ for (const file of deleted) {
821
+ console.log(` - ${path.relative(cwd, file)}`);
822
+ }
823
+ }
824
+ return;
825
+ }
826
+ if (argv.flags.verbose) {
827
+ for (const file of deleted) {
828
+ console.log(`Removed: ${path.relative(cwd, file)}`);
829
+ }
830
+ }
831
+ if (errors.length > 0) {
832
+ console.error("Errors:");
833
+ for (const error of errors) {
834
+ const displayPath = path.isAbsolute(error.path) ? path.relative(cwd, error.path) : error.path;
835
+ console.error(` - ${displayPath}: ${formatError(error)}`);
836
+ }
837
+ process.exit(1);
838
+ }
839
+ })().catch((error) => {
840
+ console.error(error);
841
+ process.exit(1);
842
+ });