varlock 0.2.0 → 0.2.2
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/README.md +2 -0
- package/dist/auto-load.js +8 -8
- package/dist/{chunk-RZT65DRA.js → chunk-35SAMS66.js} +4 -4
- package/dist/{chunk-RZT65DRA.js.map → chunk-35SAMS66.js.map} +1 -1
- package/dist/{chunk-XVVLI2E7.js → chunk-3FLO3UFZ.js} +17 -11
- package/dist/chunk-3FLO3UFZ.js.map +1 -0
- package/dist/{chunk-FPQYEKFF.js → chunk-4N3YR2QQ.js} +4 -4
- package/dist/{chunk-FPQYEKFF.js.map → chunk-4N3YR2QQ.js.map} +1 -1
- package/dist/{chunk-XN24GZXQ.js → chunk-6PEHRAEP.js} +3 -8
- package/dist/{chunk-XN24GZXQ.js.map → chunk-6PEHRAEP.js.map} +1 -1
- package/dist/chunk-BHHYQ7SH.js +18 -0
- package/dist/{chunk-7SH6C6WJ.js.map → chunk-BHHYQ7SH.js.map} +1 -1
- package/dist/{chunk-RD44SH5U.js → chunk-FETFVFG5.js} +117 -23
- package/dist/chunk-FETFVFG5.js.map +1 -0
- package/dist/{chunk-RFRTLWK3.js → chunk-HPUQ2CCN.js} +6 -6
- package/dist/{chunk-RFRTLWK3.js.map → chunk-HPUQ2CCN.js.map} +1 -1
- package/dist/{chunk-FGMXIEFA.js → chunk-MIBOBKI4.js} +3 -3
- package/dist/{chunk-FGMXIEFA.js.map → chunk-MIBOBKI4.js.map} +1 -1
- package/dist/chunk-N2HZMIGS.js +1532 -0
- package/dist/chunk-N2HZMIGS.js.map +1 -0
- package/dist/{chunk-NDRSG3XS.js → chunk-N4REMPVX.js} +23 -14
- package/dist/chunk-N4REMPVX.js.map +1 -0
- package/dist/{chunk-FUDH2TTI.js → chunk-TVFOIGJP.js} +3 -3
- package/dist/{chunk-FUDH2TTI.js.map → chunk-TVFOIGJP.js.map} +1 -1
- package/dist/{chunk-5IMCRQTM.js → chunk-TYIS6T2T.js} +4 -4
- package/dist/{chunk-5IMCRQTM.js.map → chunk-TYIS6T2T.js.map} +1 -1
- package/dist/chunk-UDXNNRWI.js +1386 -0
- package/dist/chunk-UDXNNRWI.js.map +1 -0
- package/dist/{chunk-HPNRKYVF.js → chunk-UIOEEWG5.js} +4 -4
- package/dist/{chunk-HPNRKYVF.js.map → chunk-UIOEEWG5.js.map} +1 -1
- package/dist/{chunk-MSRPV5WH.js → chunk-WAMBVZL2.js} +4 -4
- package/dist/{chunk-MSRPV5WH.js.map → chunk-WAMBVZL2.js.map} +1 -1
- package/dist/{chunk-L5REVVXG.js → chunk-ZUNB52KY.js} +9 -4
- package/dist/chunk-ZUNB52KY.js.map +1 -0
- package/dist/{chunk-NSY7JMFV.js → chunk-ZXJ4CEDK.js} +4 -4
- package/dist/{chunk-NSY7JMFV.js.map → chunk-ZXJ4CEDK.js.map} +1 -1
- package/dist/cli/cli-executable.js +18 -18
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/dotenv-compat.js +8 -8
- package/dist/help.command-MLH2WA5Y.js +5 -0
- package/dist/{help.command-B7VWA53B.js.map → help.command-MLH2WA5Y.js.map} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -9
- package/dist/init.command-DLPZ3R4T.js +8 -0
- package/dist/{init.command-AVNYY5CK.js.map → init.command-DLPZ3R4T.js.map} +1 -1
- package/dist/lib/exec-sync-varlock.js +2 -2
- package/dist/load.command-4G5POJYR.js +8 -0
- package/dist/{load.command-7CCTFAYS.js.map → load.command-4G5POJYR.js.map} +1 -1
- package/dist/run.command-L5LLHOW3.js +9 -0
- package/dist/{run.command-NGRKCLWP.js.map → run.command-L5LLHOW3.js.map} +1 -1
- package/dist/runtime/env.js +3 -3
- package/dist/runtime/patch-console.js +4 -4
- package/dist/runtime/patch-response.js +4 -4
- package/dist/runtime/patch-server-response.js +4 -4
- package/dist/telemetry.command-JF72FOYJ.js +8 -0
- package/dist/{telemetry.command-756WXWYK.js.map → telemetry.command-JF72FOYJ.js.map} +1 -1
- package/package.json +34 -15
- package/dist/chunk-33ROL4J5.js +0 -1013
- package/dist/chunk-33ROL4J5.js.map +0 -1
- package/dist/chunk-7SH6C6WJ.js +0 -18
- package/dist/chunk-L5REVVXG.js.map +0 -1
- package/dist/chunk-L5USEQO6.js +0 -1281
- package/dist/chunk-L5USEQO6.js.map +0 -1
- package/dist/chunk-NDRSG3XS.js.map +0 -1
- package/dist/chunk-RD44SH5U.js.map +0 -1
- package/dist/chunk-XVVLI2E7.js.map +0 -1
- package/dist/en-US-TSGNDI2P.js +0 -22
- package/dist/en-US-TSGNDI2P.js.map +0 -1
- package/dist/help.command-B7VWA53B.js +0 -5
- package/dist/init.command-AVNYY5CK.js +0 -8
- package/dist/ja-JP-UBPCQAAD.js +0 -22
- package/dist/ja-JP-UBPCQAAD.js.map +0 -1
- package/dist/load.command-7CCTFAYS.js +0 -8
- package/dist/run.command-NGRKCLWP.js +0 -9
- package/dist/telemetry.command-756WXWYK.js +0 -8
package/dist/chunk-L5USEQO6.js
DELETED
|
@@ -1,1281 +0,0 @@
|
|
|
1
|
-
import { detectJsPackageManager, logLines, fmt, installJsDependency } from './chunk-FPQYEKFF.js';
|
|
2
|
-
import { define } from './chunk-33ROL4J5.js';
|
|
3
|
-
import { tryCatch, gracefulExit, ansis_default, pathExists } from './chunk-RD44SH5U.js';
|
|
4
|
-
import { __commonJS, __name, __toESM } from './chunk-XN24GZXQ.js';
|
|
5
|
-
import path2, { dirname } from 'path';
|
|
6
|
-
import fs3 from 'fs/promises';
|
|
7
|
-
import { promisify } from 'util';
|
|
8
|
-
import y2, { stdin, stdout } from 'process';
|
|
9
|
-
import O from 'readline';
|
|
10
|
-
import { Writable } from 'stream';
|
|
11
|
-
import { envSpecUpdater, ParsedEnvSpecStaticValue, parseEnvSpecDotEnvFile } from '@env-spec/parser';
|
|
12
|
-
import { exec, spawn } from 'child_process';
|
|
13
|
-
import { WriteStream } from 'tty';
|
|
14
|
-
|
|
15
|
-
// ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
16
|
-
var require_src = __commonJS({
|
|
17
|
-
"../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
18
|
-
var ESC = "\x1B";
|
|
19
|
-
var CSI = `${ESC}[`;
|
|
20
|
-
var beep = "\x07";
|
|
21
|
-
var cursor = {
|
|
22
|
-
to(x2, y3) {
|
|
23
|
-
if (!y3) return `${CSI}${x2 + 1}G`;
|
|
24
|
-
return `${CSI}${y3 + 1};${x2 + 1}H`;
|
|
25
|
-
},
|
|
26
|
-
move(x2, y3) {
|
|
27
|
-
let ret = "";
|
|
28
|
-
if (x2 < 0) ret += `${CSI}${-x2}D`;
|
|
29
|
-
else if (x2 > 0) ret += `${CSI}${x2}C`;
|
|
30
|
-
if (y3 < 0) ret += `${CSI}${-y3}A`;
|
|
31
|
-
else if (y3 > 0) ret += `${CSI}${y3}B`;
|
|
32
|
-
return ret;
|
|
33
|
-
},
|
|
34
|
-
up: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}A`, "up"),
|
|
35
|
-
down: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}B`, "down"),
|
|
36
|
-
forward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}C`, "forward"),
|
|
37
|
-
backward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}D`, "backward"),
|
|
38
|
-
nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI}E`.repeat(count), "nextLine"),
|
|
39
|
-
prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI}F`.repeat(count), "prevLine"),
|
|
40
|
-
left: `${CSI}G`,
|
|
41
|
-
hide: `${CSI}?25l`,
|
|
42
|
-
show: `${CSI}?25h`,
|
|
43
|
-
save: `${ESC}7`,
|
|
44
|
-
restore: `${ESC}8`
|
|
45
|
-
};
|
|
46
|
-
var scroll = {
|
|
47
|
-
up: /* @__PURE__ */ __name((count = 1) => `${CSI}S`.repeat(count), "up"),
|
|
48
|
-
down: /* @__PURE__ */ __name((count = 1) => `${CSI}T`.repeat(count), "down")
|
|
49
|
-
};
|
|
50
|
-
var erase = {
|
|
51
|
-
screen: `${CSI}2J`,
|
|
52
|
-
up: /* @__PURE__ */ __name((count = 1) => `${CSI}1J`.repeat(count), "up"),
|
|
53
|
-
down: /* @__PURE__ */ __name((count = 1) => `${CSI}J`.repeat(count), "down"),
|
|
54
|
-
line: `${CSI}2K`,
|
|
55
|
-
lineEnd: `${CSI}K`,
|
|
56
|
-
lineStart: `${CSI}1K`,
|
|
57
|
-
lines(count) {
|
|
58
|
-
let clear = "";
|
|
59
|
-
for (let i = 0; i < count; i++)
|
|
60
|
-
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
61
|
-
if (count)
|
|
62
|
-
clear += cursor.left;
|
|
63
|
-
return clear;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
71
|
-
var require_picocolors = __commonJS({
|
|
72
|
-
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
73
|
-
var p2 = process || {};
|
|
74
|
-
var argv = p2.argv || [];
|
|
75
|
-
var env = p2.env || {};
|
|
76
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
77
|
-
var formatter = /* @__PURE__ */ __name((open, close, replace = open) => (input) => {
|
|
78
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
79
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
80
|
-
}, "formatter");
|
|
81
|
-
var replaceClose = /* @__PURE__ */ __name((string, close, replace, index) => {
|
|
82
|
-
let result = "", cursor = 0;
|
|
83
|
-
do {
|
|
84
|
-
result += string.substring(cursor, index) + replace;
|
|
85
|
-
cursor = index + close.length;
|
|
86
|
-
index = string.indexOf(close, cursor);
|
|
87
|
-
} while (~index);
|
|
88
|
-
return result + string.substring(cursor);
|
|
89
|
-
}, "replaceClose");
|
|
90
|
-
var createColors = /* @__PURE__ */ __name((enabled = isColorSupported) => {
|
|
91
|
-
let f = enabled ? formatter : () => String;
|
|
92
|
-
return {
|
|
93
|
-
isColorSupported: enabled,
|
|
94
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
95
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
96
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
97
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
98
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
99
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
100
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
101
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
102
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
103
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
104
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
105
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
106
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
107
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
108
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
109
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
110
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
111
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
112
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
113
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
114
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
115
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
116
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
117
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
118
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
119
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
120
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
121
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
122
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
123
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
124
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
125
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
126
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
127
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
128
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
129
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
130
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
131
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
132
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
133
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
134
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
135
|
-
};
|
|
136
|
-
}, "createColors");
|
|
137
|
-
module.exports = createColors();
|
|
138
|
-
module.exports.createColors = createColors;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// ../../node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
|
|
143
|
-
var import_sisteransi = __toESM(require_src(), 1);
|
|
144
|
-
function DD({ onlyFirst: e2 = false } = {}) {
|
|
145
|
-
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("|");
|
|
146
|
-
return new RegExp(t, e2 ? void 0 : "g");
|
|
147
|
-
}
|
|
148
|
-
__name(DD, "DD");
|
|
149
|
-
var uD = DD();
|
|
150
|
-
function P(e2) {
|
|
151
|
-
if (typeof e2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
|
|
152
|
-
return e2.replace(uD, "");
|
|
153
|
-
}
|
|
154
|
-
__name(P, "P");
|
|
155
|
-
function L(e2) {
|
|
156
|
-
return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
|
|
157
|
-
}
|
|
158
|
-
__name(L, "L");
|
|
159
|
-
var W = { exports: {} };
|
|
160
|
-
(function(e2) {
|
|
161
|
-
var u2 = {};
|
|
162
|
-
e2.exports = u2, u2.eastAsianWidth = function(F2) {
|
|
163
|
-
var s = F2.charCodeAt(0), i = F2.length == 2 ? F2.charCodeAt(1) : 0, D2 = s;
|
|
164
|
-
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D2 = s << 10 | i, D2 += 65536), D2 == 12288 || 65281 <= D2 && D2 <= 65376 || 65504 <= D2 && D2 <= 65510 ? "F" : D2 == 8361 || 65377 <= D2 && D2 <= 65470 || 65474 <= D2 && D2 <= 65479 || 65482 <= D2 && D2 <= 65487 || 65490 <= D2 && D2 <= 65495 || 65498 <= D2 && D2 <= 65500 || 65512 <= D2 && D2 <= 65518 ? "H" : 4352 <= D2 && D2 <= 4447 || 4515 <= D2 && D2 <= 4519 || 4602 <= D2 && D2 <= 4607 || 9001 <= D2 && D2 <= 9002 || 11904 <= D2 && D2 <= 11929 || 11931 <= D2 && D2 <= 12019 || 12032 <= D2 && D2 <= 12245 || 12272 <= D2 && D2 <= 12283 || 12289 <= D2 && D2 <= 12350 || 12353 <= D2 && D2 <= 12438 || 12441 <= D2 && D2 <= 12543 || 12549 <= D2 && D2 <= 12589 || 12593 <= D2 && D2 <= 12686 || 12688 <= D2 && D2 <= 12730 || 12736 <= D2 && D2 <= 12771 || 12784 <= D2 && D2 <= 12830 || 12832 <= D2 && D2 <= 12871 || 12880 <= D2 && D2 <= 13054 || 13056 <= D2 && D2 <= 19903 || 19968 <= D2 && D2 <= 42124 || 42128 <= D2 && D2 <= 42182 || 43360 <= D2 && D2 <= 43388 || 44032 <= D2 && D2 <= 55203 || 55216 <= D2 && D2 <= 55238 || 55243 <= D2 && D2 <= 55291 || 63744 <= D2 && D2 <= 64255 || 65040 <= D2 && D2 <= 65049 || 65072 <= D2 && D2 <= 65106 || 65108 <= D2 && D2 <= 65126 || 65128 <= D2 && D2 <= 65131 || 110592 <= D2 && D2 <= 110593 || 127488 <= D2 && D2 <= 127490 || 127504 <= D2 && D2 <= 127546 || 127552 <= D2 && D2 <= 127560 || 127568 <= D2 && D2 <= 127569 || 131072 <= D2 && D2 <= 194367 || 177984 <= D2 && D2 <= 196605 || 196608 <= D2 && D2 <= 262141 ? "W" : 32 <= D2 && D2 <= 126 || 162 <= D2 && D2 <= 163 || 165 <= D2 && D2 <= 166 || D2 == 172 || D2 == 175 || 10214 <= D2 && D2 <= 10221 || 10629 <= D2 && D2 <= 10630 ? "Na" : D2 == 161 || D2 == 164 || 167 <= D2 && D2 <= 168 || D2 == 170 || 173 <= D2 && D2 <= 174 || 176 <= D2 && D2 <= 180 || 182 <= D2 && D2 <= 186 || 188 <= D2 && D2 <= 191 || D2 == 198 || D2 == 208 || 215 <= D2 && D2 <= 216 || 222 <= D2 && D2 <= 225 || D2 == 230 || 232 <= D2 && D2 <= 234 || 236 <= D2 && D2 <= 237 || D2 == 240 || 242 <= D2 && D2 <= 243 || 247 <= D2 && D2 <= 250 || D2 == 252 || D2 == 254 || D2 == 257 || D2 == 273 || D2 == 275 || D2 == 283 || 294 <= D2 && D2 <= 295 || D2 == 299 || 305 <= D2 && D2 <= 307 || D2 == 312 || 319 <= D2 && D2 <= 322 || D2 == 324 || 328 <= D2 && D2 <= 331 || D2 == 333 || 338 <= D2 && D2 <= 339 || 358 <= D2 && D2 <= 359 || D2 == 363 || D2 == 462 || D2 == 464 || D2 == 466 || D2 == 468 || D2 == 470 || D2 == 472 || D2 == 474 || D2 == 476 || D2 == 593 || D2 == 609 || D2 == 708 || D2 == 711 || 713 <= D2 && D2 <= 715 || D2 == 717 || D2 == 720 || 728 <= D2 && D2 <= 731 || D2 == 733 || D2 == 735 || 768 <= D2 && D2 <= 879 || 913 <= D2 && D2 <= 929 || 931 <= D2 && D2 <= 937 || 945 <= D2 && D2 <= 961 || 963 <= D2 && D2 <= 969 || D2 == 1025 || 1040 <= D2 && D2 <= 1103 || D2 == 1105 || D2 == 8208 || 8211 <= D2 && D2 <= 8214 || 8216 <= D2 && D2 <= 8217 || 8220 <= D2 && D2 <= 8221 || 8224 <= D2 && D2 <= 8226 || 8228 <= D2 && D2 <= 8231 || D2 == 8240 || 8242 <= D2 && D2 <= 8243 || D2 == 8245 || D2 == 8251 || D2 == 8254 || D2 == 8308 || D2 == 8319 || 8321 <= D2 && D2 <= 8324 || D2 == 8364 || D2 == 8451 || D2 == 8453 || D2 == 8457 || D2 == 8467 || D2 == 8470 || 8481 <= D2 && D2 <= 8482 || D2 == 8486 || D2 == 8491 || 8531 <= D2 && D2 <= 8532 || 8539 <= D2 && D2 <= 8542 || 8544 <= D2 && D2 <= 8555 || 8560 <= D2 && D2 <= 8569 || D2 == 8585 || 8592 <= D2 && D2 <= 8601 || 8632 <= D2 && D2 <= 8633 || D2 == 8658 || D2 == 8660 || D2 == 8679 || D2 == 8704 || 8706 <= D2 && D2 <= 8707 || 8711 <= D2 && D2 <= 8712 || D2 == 8715 || D2 == 8719 || D2 == 8721 || D2 == 8725 || D2 == 8730 || 8733 <= D2 && D2 <= 8736 || D2 == 8739 || D2 == 8741 || 8743 <= D2 && D2 <= 8748 || D2 == 8750 || 8756 <= D2 && D2 <= 8759 || 8764 <= D2 && D2 <= 8765 || D2 == 8776 || D2 == 8780 || D2 == 8786 || 8800 <= D2 && D2 <= 8801 || 8804 <= D2 && D2 <= 8807 || 8810 <= D2 && D2 <= 8811 || 8814 <= D2 && D2 <= 8815 || 8834 <= D2 && D2 <= 8835 || 8838 <= D2 && D2 <= 8839 || D2 == 8853 || D2 == 8857 || D2 == 8869 || D2 == 8895 || D2 == 8978 || 9312 <= D2 && D2 <= 9449 || 9451 <= D2 && D2 <= 9547 || 9552 <= D2 && D2 <= 9587 || 9600 <= D2 && D2 <= 9615 || 9618 <= D2 && D2 <= 9621 || 9632 <= D2 && D2 <= 9633 || 9635 <= D2 && D2 <= 9641 || 9650 <= D2 && D2 <= 9651 || 9654 <= D2 && D2 <= 9655 || 9660 <= D2 && D2 <= 9661 || 9664 <= D2 && D2 <= 9665 || 9670 <= D2 && D2 <= 9672 || D2 == 9675 || 9678 <= D2 && D2 <= 9681 || 9698 <= D2 && D2 <= 9701 || D2 == 9711 || 9733 <= D2 && D2 <= 9734 || D2 == 9737 || 9742 <= D2 && D2 <= 9743 || 9748 <= D2 && D2 <= 9749 || D2 == 9756 || D2 == 9758 || D2 == 9792 || D2 == 9794 || 9824 <= D2 && D2 <= 9825 || 9827 <= D2 && D2 <= 9829 || 9831 <= D2 && D2 <= 9834 || 9836 <= D2 && D2 <= 9837 || D2 == 9839 || 9886 <= D2 && D2 <= 9887 || 9918 <= D2 && D2 <= 9919 || 9924 <= D2 && D2 <= 9933 || 9935 <= D2 && D2 <= 9953 || D2 == 9955 || 9960 <= D2 && D2 <= 9983 || D2 == 10045 || D2 == 10071 || 10102 <= D2 && D2 <= 10111 || 11093 <= D2 && D2 <= 11097 || 12872 <= D2 && D2 <= 12879 || 57344 <= D2 && D2 <= 63743 || 65024 <= D2 && D2 <= 65039 || D2 == 65533 || 127232 <= D2 && D2 <= 127242 || 127248 <= D2 && D2 <= 127277 || 127280 <= D2 && D2 <= 127337 || 127344 <= D2 && D2 <= 127386 || 917760 <= D2 && D2 <= 917999 || 983040 <= D2 && D2 <= 1048573 || 1048576 <= D2 && D2 <= 1114109 ? "A" : "N";
|
|
165
|
-
}, u2.characterLength = function(F2) {
|
|
166
|
-
var s = this.eastAsianWidth(F2);
|
|
167
|
-
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
168
|
-
};
|
|
169
|
-
function t(F2) {
|
|
170
|
-
return F2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
171
|
-
}
|
|
172
|
-
__name(t, "t");
|
|
173
|
-
u2.length = function(F2) {
|
|
174
|
-
for (var s = t(F2), i = 0, D2 = 0; D2 < s.length; D2++) i = i + this.characterLength(s[D2]);
|
|
175
|
-
return i;
|
|
176
|
-
}, u2.slice = function(F2, s, i) {
|
|
177
|
-
textLen = u2.length(F2), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
178
|
-
for (var D2 = "", C2 = 0, n = t(F2), E = 0; E < n.length; E++) {
|
|
179
|
-
var a = n[E], o2 = u2.length(a);
|
|
180
|
-
if (C2 >= s - (o2 == 2 ? 1 : 0)) if (C2 + o2 <= i) D2 += a;
|
|
181
|
-
else break;
|
|
182
|
-
C2 += o2;
|
|
183
|
-
}
|
|
184
|
-
return D2;
|
|
185
|
-
};
|
|
186
|
-
})(W);
|
|
187
|
-
var tD = W.exports;
|
|
188
|
-
var eD = L(tD);
|
|
189
|
-
var FD = /* @__PURE__ */ __name(function() {
|
|
190
|
-
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;
|
|
191
|
-
}, "FD");
|
|
192
|
-
var sD = L(FD);
|
|
193
|
-
function p(e2, u2 = {}) {
|
|
194
|
-
if (typeof e2 != "string" || e2.length === 0 || (u2 = { ambiguousIsNarrow: true, ...u2 }, e2 = P(e2), e2.length === 0)) return 0;
|
|
195
|
-
e2 = e2.replace(sD(), " ");
|
|
196
|
-
const t = u2.ambiguousIsNarrow ? 1 : 2;
|
|
197
|
-
let F2 = 0;
|
|
198
|
-
for (const s of e2) {
|
|
199
|
-
const i = s.codePointAt(0);
|
|
200
|
-
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
|
|
201
|
-
switch (eD.eastAsianWidth(s)) {
|
|
202
|
-
case "F":
|
|
203
|
-
case "W":
|
|
204
|
-
F2 += 2;
|
|
205
|
-
break;
|
|
206
|
-
case "A":
|
|
207
|
-
F2 += t;
|
|
208
|
-
break;
|
|
209
|
-
default:
|
|
210
|
-
F2 += 1;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return F2;
|
|
214
|
-
}
|
|
215
|
-
__name(p, "p");
|
|
216
|
-
var w = 10;
|
|
217
|
-
var N = /* @__PURE__ */ __name((e2 = 0) => (u2) => `\x1B[${u2 + e2}m`, "N");
|
|
218
|
-
var I = /* @__PURE__ */ __name((e2 = 0) => (u2) => `\x1B[${38 + e2};5;${u2}m`, "I");
|
|
219
|
-
var R = /* @__PURE__ */ __name((e2 = 0) => (u2, t, F2) => `\x1B[${38 + e2};2;${u2};${t};${F2}m`, "R");
|
|
220
|
-
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] } };
|
|
221
|
-
Object.keys(r.modifier);
|
|
222
|
-
var iD = Object.keys(r.color);
|
|
223
|
-
var CD = Object.keys(r.bgColor);
|
|
224
|
-
[...iD, ...CD];
|
|
225
|
-
function rD() {
|
|
226
|
-
const e2 = /* @__PURE__ */ new Map();
|
|
227
|
-
for (const [u2, t] of Object.entries(r)) {
|
|
228
|
-
for (const [F2, s] of Object.entries(t)) r[F2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F2] = r[F2], e2.set(s[0], s[1]);
|
|
229
|
-
Object.defineProperty(r, u2, { value: t, enumerable: false });
|
|
230
|
-
}
|
|
231
|
-
return Object.defineProperty(r, "codes", { value: e2, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: /* @__PURE__ */ __name((u2, t, F2) => u2 === t && t === F2 ? u2 < 8 ? 16 : u2 > 248 ? 231 : Math.round((u2 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u2 / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F2 / 255 * 5), "value"), enumerable: false }, hexToRgb: { value: /* @__PURE__ */ __name((u2) => {
|
|
232
|
-
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u2.toString(16));
|
|
233
|
-
if (!t) return [0, 0, 0];
|
|
234
|
-
let [F2] = t;
|
|
235
|
-
F2.length === 3 && (F2 = [...F2].map((i) => i + i).join(""));
|
|
236
|
-
const s = Number.parseInt(F2, 16);
|
|
237
|
-
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
238
|
-
}, "value"), enumerable: false }, hexToAnsi256: { value: /* @__PURE__ */ __name((u2) => r.rgbToAnsi256(...r.hexToRgb(u2)), "value"), enumerable: false }, ansi256ToAnsi: { value: /* @__PURE__ */ __name((u2) => {
|
|
239
|
-
if (u2 < 8) return 30 + u2;
|
|
240
|
-
if (u2 < 16) return 90 + (u2 - 8);
|
|
241
|
-
let t, F2, s;
|
|
242
|
-
if (u2 >= 232) t = ((u2 - 232) * 10 + 8) / 255, F2 = t, s = t;
|
|
243
|
-
else {
|
|
244
|
-
u2 -= 16;
|
|
245
|
-
const C2 = u2 % 36;
|
|
246
|
-
t = Math.floor(u2 / 36) / 5, F2 = Math.floor(C2 / 6) / 5, s = C2 % 6 / 5;
|
|
247
|
-
}
|
|
248
|
-
const i = Math.max(t, F2, s) * 2;
|
|
249
|
-
if (i === 0) return 30;
|
|
250
|
-
let D2 = 30 + (Math.round(s) << 2 | Math.round(F2) << 1 | Math.round(t));
|
|
251
|
-
return i === 2 && (D2 += 60), D2;
|
|
252
|
-
}, "value"), enumerable: false }, rgbToAnsi: { value: /* @__PURE__ */ __name((u2, t, F2) => r.ansi256ToAnsi(r.rgbToAnsi256(u2, t, F2)), "value"), enumerable: false }, hexToAnsi: { value: /* @__PURE__ */ __name((u2) => r.ansi256ToAnsi(r.hexToAnsi256(u2)), "value"), enumerable: false } }), r;
|
|
253
|
-
}
|
|
254
|
-
__name(rD, "rD");
|
|
255
|
-
var ED = rD();
|
|
256
|
-
var d = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
257
|
-
var oD = 39;
|
|
258
|
-
var y = "\x07";
|
|
259
|
-
var V = "[";
|
|
260
|
-
var nD = "]";
|
|
261
|
-
var G = "m";
|
|
262
|
-
var _ = `${nD}8;;`;
|
|
263
|
-
var z = /* @__PURE__ */ __name((e2) => `${d.values().next().value}${V}${e2}${G}`, "z");
|
|
264
|
-
var K = /* @__PURE__ */ __name((e2) => `${d.values().next().value}${_}${e2}${y}`, "K");
|
|
265
|
-
var aD = /* @__PURE__ */ __name((e2) => e2.split(" ").map((u2) => p(u2)), "aD");
|
|
266
|
-
var k = /* @__PURE__ */ __name((e2, u2, t) => {
|
|
267
|
-
const F2 = [...u2];
|
|
268
|
-
let s = false, i = false, D2 = p(P(e2[e2.length - 1]));
|
|
269
|
-
for (const [C2, n] of F2.entries()) {
|
|
270
|
-
const E = p(n);
|
|
271
|
-
if (D2 + E <= t ? e2[e2.length - 1] += n : (e2.push(n), D2 = 0), d.has(n) && (s = true, i = F2.slice(C2 + 1).join("").startsWith(_)), s) {
|
|
272
|
-
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
D2 += E, D2 === t && C2 < F2.length - 1 && (e2.push(""), D2 = 0);
|
|
276
|
-
}
|
|
277
|
-
!D2 && e2[e2.length - 1].length > 0 && e2.length > 1 && (e2[e2.length - 2] += e2.pop());
|
|
278
|
-
}, "k");
|
|
279
|
-
var hD = /* @__PURE__ */ __name((e2) => {
|
|
280
|
-
const u2 = e2.split(" ");
|
|
281
|
-
let t = u2.length;
|
|
282
|
-
for (; t > 0 && !(p(u2[t - 1]) > 0); ) t--;
|
|
283
|
-
return t === u2.length ? e2 : u2.slice(0, t).join(" ") + u2.slice(t).join("");
|
|
284
|
-
}, "hD");
|
|
285
|
-
var lD = /* @__PURE__ */ __name((e2, u2, t = {}) => {
|
|
286
|
-
if (t.trim !== false && e2.trim() === "") return "";
|
|
287
|
-
let F2 = "", s, i;
|
|
288
|
-
const D2 = aD(e2);
|
|
289
|
-
let C2 = [""];
|
|
290
|
-
for (const [E, a] of e2.split(" ").entries()) {
|
|
291
|
-
t.trim !== false && (C2[C2.length - 1] = C2[C2.length - 1].trimStart());
|
|
292
|
-
let o2 = p(C2[C2.length - 1]);
|
|
293
|
-
if (E !== 0 && (o2 >= u2 && (t.wordWrap === false || t.trim === false) && (C2.push(""), o2 = 0), (o2 > 0 || t.trim === false) && (C2[C2.length - 1] += " ", o2++)), t.hard && D2[E] > u2) {
|
|
294
|
-
const c = u2 - o2, f = 1 + Math.floor((D2[E] - c - 1) / u2);
|
|
295
|
-
Math.floor((D2[E] - 1) / u2) < f && C2.push(""), k(C2, a, u2);
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
if (o2 + D2[E] > u2 && o2 > 0 && D2[E] > 0) {
|
|
299
|
-
if (t.wordWrap === false && o2 < u2) {
|
|
300
|
-
k(C2, a, u2);
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
C2.push("");
|
|
304
|
-
}
|
|
305
|
-
if (o2 + D2[E] > u2 && t.wordWrap === false) {
|
|
306
|
-
k(C2, a, u2);
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
C2[C2.length - 1] += a;
|
|
310
|
-
}
|
|
311
|
-
t.trim !== false && (C2 = C2.map((E) => hD(E)));
|
|
312
|
-
const n = [...C2.join(`
|
|
313
|
-
`)];
|
|
314
|
-
for (const [E, a] of n.entries()) {
|
|
315
|
-
if (F2 += a, d.has(a)) {
|
|
316
|
-
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
317
|
-
if (c.code !== void 0) {
|
|
318
|
-
const f = Number.parseFloat(c.code);
|
|
319
|
-
s = f === oD ? void 0 : f;
|
|
320
|
-
} else c.uri !== void 0 && (i = c.uri.length === 0 ? void 0 : c.uri);
|
|
321
|
-
}
|
|
322
|
-
const o2 = ED.codes.get(Number(s));
|
|
323
|
-
n[E + 1] === `
|
|
324
|
-
` ? (i && (F2 += K("")), s && o2 && (F2 += z(o2))) : a === `
|
|
325
|
-
` && (s && o2 && (F2 += z(s)), i && (F2 += K(i)));
|
|
326
|
-
}
|
|
327
|
-
return F2;
|
|
328
|
-
}, "lD");
|
|
329
|
-
function Y(e2, u2, t) {
|
|
330
|
-
return String(e2).normalize().replace(/\r\n/g, `
|
|
331
|
-
`).split(`
|
|
332
|
-
`).map((F2) => lD(F2, u2, t)).join(`
|
|
333
|
-
`);
|
|
334
|
-
}
|
|
335
|
-
__name(Y, "Y");
|
|
336
|
-
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
337
|
-
var B = { actions: new Set(xD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
|
|
338
|
-
function $(e2, u2) {
|
|
339
|
-
if (typeof e2 == "string") return B.aliases.get(e2) === u2;
|
|
340
|
-
for (const t of e2) if (t !== void 0 && $(t, u2)) return true;
|
|
341
|
-
return false;
|
|
342
|
-
}
|
|
343
|
-
__name($, "$");
|
|
344
|
-
function BD(e2, u2) {
|
|
345
|
-
if (e2 === u2) return;
|
|
346
|
-
const t = e2.split(`
|
|
347
|
-
`), F2 = u2.split(`
|
|
348
|
-
`), s = [];
|
|
349
|
-
for (let i = 0; i < Math.max(t.length, F2.length); i++) t[i] !== F2[i] && s.push(i);
|
|
350
|
-
return s;
|
|
351
|
-
}
|
|
352
|
-
__name(BD, "BD");
|
|
353
|
-
globalThis.process.platform.startsWith("win");
|
|
354
|
-
var S = Symbol("clack:cancel");
|
|
355
|
-
function pD(e2) {
|
|
356
|
-
return e2 === S;
|
|
357
|
-
}
|
|
358
|
-
__name(pD, "pD");
|
|
359
|
-
function m(e2, u2) {
|
|
360
|
-
const t = e2;
|
|
361
|
-
t.isTTY && t.setRawMode(u2);
|
|
362
|
-
}
|
|
363
|
-
__name(m, "m");
|
|
364
|
-
var gD = Object.defineProperty;
|
|
365
|
-
var vD = /* @__PURE__ */ __name((e2, u2, t) => u2 in e2 ? gD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t, "vD");
|
|
366
|
-
var h = /* @__PURE__ */ __name((e2, u2, t) => (vD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t), "h");
|
|
367
|
-
var x = class {
|
|
368
|
-
static {
|
|
369
|
-
__name(this, "x");
|
|
370
|
-
}
|
|
371
|
-
constructor(u2, t = true) {
|
|
372
|
-
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
373
|
-
const { input: F2 = stdin, output: s = stdout, render: i, signal: D2, ...C2 } = u2;
|
|
374
|
-
this.opts = C2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D2, this.input = F2, this.output = s;
|
|
375
|
-
}
|
|
376
|
-
unsubscribe() {
|
|
377
|
-
this._subscribers.clear();
|
|
378
|
-
}
|
|
379
|
-
setSubscriber(u2, t) {
|
|
380
|
-
const F2 = this._subscribers.get(u2) ?? [];
|
|
381
|
-
F2.push(t), this._subscribers.set(u2, F2);
|
|
382
|
-
}
|
|
383
|
-
on(u2, t) {
|
|
384
|
-
this.setSubscriber(u2, { cb: t });
|
|
385
|
-
}
|
|
386
|
-
once(u2, t) {
|
|
387
|
-
this.setSubscriber(u2, { cb: t, once: true });
|
|
388
|
-
}
|
|
389
|
-
emit(u2, ...t) {
|
|
390
|
-
const F2 = this._subscribers.get(u2) ?? [], s = [];
|
|
391
|
-
for (const i of F2) i.cb(...t), i.once && s.push(() => F2.splice(F2.indexOf(i), 1));
|
|
392
|
-
for (const i of s) i();
|
|
393
|
-
}
|
|
394
|
-
prompt() {
|
|
395
|
-
return new Promise((u2, t) => {
|
|
396
|
-
if (this._abortSignal) {
|
|
397
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u2(S);
|
|
398
|
-
this._abortSignal.addEventListener("abort", () => {
|
|
399
|
-
this.state = "cancel", this.close();
|
|
400
|
-
}, { once: true });
|
|
401
|
-
}
|
|
402
|
-
const F2 = new Writable();
|
|
403
|
-
F2._write = (s, i, D2) => {
|
|
404
|
-
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
|
|
405
|
-
}, this.input.pipe(F2), this.rl = O.createInterface({ input: this.input, output: F2, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
406
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(this.value);
|
|
407
|
-
}), this.once("cancel", () => {
|
|
408
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(S);
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
onKeypress(u2, t) {
|
|
413
|
-
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u2 && (u2.toLowerCase() === "y" || u2.toLowerCase() === "n") && this.emit("confirm", u2.toLowerCase() === "y"), u2 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u2 && this.emit("key", u2.toLowerCase()), t?.name === "return") {
|
|
414
|
-
if (this.opts.validate) {
|
|
415
|
-
const F2 = this.opts.validate(this.value);
|
|
416
|
-
F2 && (this.error = F2 instanceof Error ? F2.message : F2, this.state = "error", this.rl?.write(this.value));
|
|
417
|
-
}
|
|
418
|
-
this.state !== "error" && (this.state = "submit");
|
|
419
|
-
}
|
|
420
|
-
$([u2, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
421
|
-
}
|
|
422
|
-
close() {
|
|
423
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
424
|
-
`), m(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
425
|
-
}
|
|
426
|
-
restoreCursor() {
|
|
427
|
-
const u2 = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
428
|
-
`).length - 1;
|
|
429
|
-
this.output.write(import_sisteransi.cursor.move(-999, u2 * -1));
|
|
430
|
-
}
|
|
431
|
-
render() {
|
|
432
|
-
const u2 = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
433
|
-
if (u2 !== this._prevFrame) {
|
|
434
|
-
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
435
|
-
else {
|
|
436
|
-
const t = BD(this._prevFrame, u2);
|
|
437
|
-
if (this.restoreCursor(), t && t?.length === 1) {
|
|
438
|
-
const F2 = t[0];
|
|
439
|
-
this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
440
|
-
const s = u2.split(`
|
|
441
|
-
`);
|
|
442
|
-
this.output.write(s[F2]), this._prevFrame = u2, this.output.write(import_sisteransi.cursor.move(0, s.length - F2 - 1));
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
if (t && t?.length > 1) {
|
|
446
|
-
const F2 = t[0];
|
|
447
|
-
this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.down());
|
|
448
|
-
const s = u2.split(`
|
|
449
|
-
`).slice(F2);
|
|
450
|
-
this.output.write(s.join(`
|
|
451
|
-
`)), this._prevFrame = u2;
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
this.output.write(import_sisteransi.erase.down());
|
|
455
|
-
}
|
|
456
|
-
this.output.write(u2), this.state === "initial" && (this.state = "active"), this._prevFrame = u2;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
var dD = class extends x {
|
|
461
|
-
static {
|
|
462
|
-
__name(this, "dD");
|
|
463
|
-
}
|
|
464
|
-
get cursor() {
|
|
465
|
-
return this.value ? 0 : 1;
|
|
466
|
-
}
|
|
467
|
-
get _value() {
|
|
468
|
-
return this.cursor === 0;
|
|
469
|
-
}
|
|
470
|
-
constructor(u2) {
|
|
471
|
-
super(u2, false), this.value = !!u2.initialValue, this.on("value", () => {
|
|
472
|
-
this.value = this._value;
|
|
473
|
-
}), this.on("confirm", (t) => {
|
|
474
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
475
|
-
}), this.on("cursor", () => {
|
|
476
|
-
this.value = !this.value;
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
var kD = Object.defineProperty;
|
|
481
|
-
var $D = /* @__PURE__ */ __name((e2, u2, t) => u2 in e2 ? kD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t, "$D");
|
|
482
|
-
var H = /* @__PURE__ */ __name((e2, u2, t) => ($D(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t), "H");
|
|
483
|
-
var SD = class extends x {
|
|
484
|
-
static {
|
|
485
|
-
__name(this, "SD");
|
|
486
|
-
}
|
|
487
|
-
constructor(u2) {
|
|
488
|
-
super(u2, false), H(this, "options"), H(this, "cursor", 0), this.options = u2.options, this.value = [...u2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u2.cursorAt), 0), this.on("key", (t) => {
|
|
489
|
-
t === "a" && this.toggleAll();
|
|
490
|
-
}), this.on("cursor", (t) => {
|
|
491
|
-
switch (t) {
|
|
492
|
-
case "left":
|
|
493
|
-
case "up":
|
|
494
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
495
|
-
break;
|
|
496
|
-
case "down":
|
|
497
|
-
case "right":
|
|
498
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
499
|
-
break;
|
|
500
|
-
case "space":
|
|
501
|
-
this.toggleValue();
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
get _value() {
|
|
507
|
-
return this.options[this.cursor].value;
|
|
508
|
-
}
|
|
509
|
-
toggleAll() {
|
|
510
|
-
const u2 = this.value.length === this.options.length;
|
|
511
|
-
this.value = u2 ? [] : this.options.map((t) => t.value);
|
|
512
|
-
}
|
|
513
|
-
toggleValue() {
|
|
514
|
-
const u2 = this.value.includes(this._value);
|
|
515
|
-
this.value = u2 ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
var OD = Object.defineProperty;
|
|
519
|
-
var PD = /* @__PURE__ */ __name((e2, u2, t) => u2 in e2 ? OD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t, "PD");
|
|
520
|
-
var J = /* @__PURE__ */ __name((e2, u2, t) => (PD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t), "J");
|
|
521
|
-
var LD = class extends x {
|
|
522
|
-
static {
|
|
523
|
-
__name(this, "LD");
|
|
524
|
-
}
|
|
525
|
-
constructor(u2) {
|
|
526
|
-
super(u2, false), J(this, "options"), J(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: t }) => t === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
527
|
-
switch (t) {
|
|
528
|
-
case "left":
|
|
529
|
-
case "up":
|
|
530
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
531
|
-
break;
|
|
532
|
-
case "down":
|
|
533
|
-
case "right":
|
|
534
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
this.changeValue();
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
get _value() {
|
|
541
|
-
return this.options[this.cursor];
|
|
542
|
-
}
|
|
543
|
-
changeValue() {
|
|
544
|
-
this.value = this._value.value;
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
// ../../node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
|
|
549
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
550
|
-
__toESM(require_src(), 1);
|
|
551
|
-
function ce() {
|
|
552
|
-
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";
|
|
553
|
-
}
|
|
554
|
-
__name(ce, "ce");
|
|
555
|
-
var V2 = ce();
|
|
556
|
-
var u = /* @__PURE__ */ __name((t, n) => V2 ? t : n, "u");
|
|
557
|
-
var le = u("\u25C6", "*");
|
|
558
|
-
var L2 = u("\u25A0", "x");
|
|
559
|
-
var W2 = u("\u25B2", "x");
|
|
560
|
-
var C = u("\u25C7", "o");
|
|
561
|
-
u("\u250C", "T");
|
|
562
|
-
var o = u("\u2502", "|");
|
|
563
|
-
var d2 = u("\u2514", "\u2014");
|
|
564
|
-
var k2 = u("\u25CF", ">");
|
|
565
|
-
var P2 = u("\u25CB", " ");
|
|
566
|
-
u("\u25FB", "[\u2022]");
|
|
567
|
-
u("\u25FC", "[+]");
|
|
568
|
-
u("\u25FB", "[ ]");
|
|
569
|
-
u("\u25AA", "\u2022");
|
|
570
|
-
u("\u2500", "-");
|
|
571
|
-
u("\u256E", "+");
|
|
572
|
-
u("\u251C", "+");
|
|
573
|
-
u("\u256F", "+");
|
|
574
|
-
u("\u25CF", "\u2022");
|
|
575
|
-
u("\u25C6", "*");
|
|
576
|
-
u("\u25B2", "!");
|
|
577
|
-
u("\u25A0", "x");
|
|
578
|
-
var b2 = /* @__PURE__ */ __name((t) => {
|
|
579
|
-
switch (t) {
|
|
580
|
-
case "initial":
|
|
581
|
-
case "active":
|
|
582
|
-
return import_picocolors.default.cyan(le);
|
|
583
|
-
case "cancel":
|
|
584
|
-
return import_picocolors.default.red(L2);
|
|
585
|
-
case "error":
|
|
586
|
-
return import_picocolors.default.yellow(W2);
|
|
587
|
-
case "submit":
|
|
588
|
-
return import_picocolors.default.green(C);
|
|
589
|
-
}
|
|
590
|
-
}, "b");
|
|
591
|
-
var G2 = /* @__PURE__ */ __name((t) => {
|
|
592
|
-
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
593
|
-
let l2 = 0;
|
|
594
|
-
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
595
|
-
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
596
|
-
return r2.slice(l2, l2 + a).map((p2, v, f) => {
|
|
597
|
-
const j2 = v === 0 && $2, E = v === f.length - 1 && g2;
|
|
598
|
-
return j2 || E ? import_picocolors.default.dim("...") : i(p2, v + l2 === n);
|
|
599
|
-
});
|
|
600
|
-
}, "G");
|
|
601
|
-
var ve = /* @__PURE__ */ __name((t) => {
|
|
602
|
-
const n = /* @__PURE__ */ __name((r2, i) => {
|
|
603
|
-
const s = r2.label ?? String(r2.value);
|
|
604
|
-
switch (i) {
|
|
605
|
-
case "selected":
|
|
606
|
-
return `${import_picocolors.default.dim(s)}`;
|
|
607
|
-
case "active":
|
|
608
|
-
return `${import_picocolors.default.green(k2)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}`;
|
|
609
|
-
case "cancelled":
|
|
610
|
-
return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
|
|
611
|
-
default:
|
|
612
|
-
return `${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(s)}`;
|
|
613
|
-
}
|
|
614
|
-
}, "n");
|
|
615
|
-
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
616
|
-
const r2 = `${import_picocolors.default.gray(o)}
|
|
617
|
-
${b2(this.state)} ${t.message}
|
|
618
|
-
`;
|
|
619
|
-
switch (this.state) {
|
|
620
|
-
case "submit":
|
|
621
|
-
return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
622
|
-
case "cancel":
|
|
623
|
-
return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
624
|
-
${import_picocolors.default.gray(o)}`;
|
|
625
|
-
default:
|
|
626
|
-
return `${r2}${import_picocolors.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: /* @__PURE__ */ __name((i, s) => n(i, s ? "active" : "inactive"), "style") }).join(`
|
|
627
|
-
${import_picocolors.default.cyan(o)} `)}
|
|
628
|
-
${import_picocolors.default.cyan(d2)}
|
|
629
|
-
`;
|
|
630
|
-
}
|
|
631
|
-
} }).prompt();
|
|
632
|
-
}, "ve");
|
|
633
|
-
`${import_picocolors.default.gray(o)} `;
|
|
634
|
-
var ExecError = class extends Error {
|
|
635
|
-
constructor(exitCode, signal, data = "command gave no output") {
|
|
636
|
-
super(data);
|
|
637
|
-
this.exitCode = exitCode;
|
|
638
|
-
this.signal = signal;
|
|
639
|
-
this.data = data;
|
|
640
|
-
}
|
|
641
|
-
static {
|
|
642
|
-
__name(this, "ExecError");
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
function spawnAsyncHelper(command, args, spawnOptions) {
|
|
646
|
-
const childProcess = spawn(command, args, spawnOptions || {});
|
|
647
|
-
const deferred = new Promise((resolve, reject) => {
|
|
648
|
-
let stdoutData = "";
|
|
649
|
-
let stderrData = "";
|
|
650
|
-
childProcess.stdout?.on("data", (data) => {
|
|
651
|
-
stdoutData += data.toString();
|
|
652
|
-
});
|
|
653
|
-
childProcess.stderr?.on("data", (data) => {
|
|
654
|
-
stderrData += data.toString();
|
|
655
|
-
});
|
|
656
|
-
childProcess.stdout?.on("error", (err) => {
|
|
657
|
-
reject(err);
|
|
658
|
-
});
|
|
659
|
-
childProcess.stderr?.on("error", (err) => {
|
|
660
|
-
reject(err);
|
|
661
|
-
});
|
|
662
|
-
childProcess.on("error", (err) => {
|
|
663
|
-
reject(err);
|
|
664
|
-
});
|
|
665
|
-
childProcess.on("exit", (exitCode, signal) => {
|
|
666
|
-
if (!exitCode) {
|
|
667
|
-
resolve(stdoutData);
|
|
668
|
-
} else {
|
|
669
|
-
reject(
|
|
670
|
-
new ExecError(exitCode, signal, stderrData)
|
|
671
|
-
);
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
});
|
|
675
|
-
return { childProcess, execResult: deferred };
|
|
676
|
-
}
|
|
677
|
-
__name(spawnAsyncHelper, "spawnAsyncHelper");
|
|
678
|
-
async function spawnAsync(command, args, opts) {
|
|
679
|
-
const { execResult } = spawnAsyncHelper(command, args, opts);
|
|
680
|
-
return execResult;
|
|
681
|
-
}
|
|
682
|
-
__name(spawnAsync, "spawnAsync");
|
|
683
|
-
promisify(exec);
|
|
684
|
-
async function checkIsFileGitIgnored(path3, warnIfNotGitRepo = false) {
|
|
685
|
-
try {
|
|
686
|
-
await spawnAsync("git", ["check-ignore", path3, "-q"], { cwd: dirname(path3) });
|
|
687
|
-
return true;
|
|
688
|
-
} catch (err) {
|
|
689
|
-
const errorOutput = err.data;
|
|
690
|
-
if (err.exitCode === 127 || errorOutput.includes("not found") || errorOutput.includes("not recognized")) {
|
|
691
|
-
return void 0;
|
|
692
|
-
}
|
|
693
|
-
if (err.code === "ENOENT") return void 0;
|
|
694
|
-
if (errorOutput === "") return false;
|
|
695
|
-
if (errorOutput.includes("not a git repository")) {
|
|
696
|
-
if (warnIfNotGitRepo) {
|
|
697
|
-
console.log("\u{1F536} Your code is not currently in a git repository - run `git init` to initialize a new repo.");
|
|
698
|
-
}
|
|
699
|
-
return false;
|
|
700
|
-
}
|
|
701
|
-
if (stderr.includes("is outside repository")) {
|
|
702
|
-
return void 0;
|
|
703
|
-
}
|
|
704
|
-
throw err;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
__name(checkIsFileGitIgnored, "checkIsFileGitIgnored");
|
|
708
|
-
function isUnicodeSupported() {
|
|
709
|
-
const { env } = y2;
|
|
710
|
-
const { TERM, TERM_PROGRAM } = env;
|
|
711
|
-
if (y2.platform !== "win32") {
|
|
712
|
-
return TERM !== "linux";
|
|
713
|
-
}
|
|
714
|
-
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
715
|
-
}
|
|
716
|
-
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
717
|
-
|
|
718
|
-
// src/cli/helpers/prompts.ts
|
|
719
|
-
var unicode = isUnicodeSupported();
|
|
720
|
-
var unicodeOr = /* @__PURE__ */ __name((c, fallback) => unicode ? c : fallback, "unicodeOr");
|
|
721
|
-
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
722
|
-
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
723
|
-
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
724
|
-
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
725
|
-
unicodeOr("\u250C", "T");
|
|
726
|
-
var S_BAR = unicodeOr("\u2502", "|");
|
|
727
|
-
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
728
|
-
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
729
|
-
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
730
|
-
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
731
|
-
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
732
|
-
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
733
|
-
unicodeOr("\u25AA", "\u2022");
|
|
734
|
-
unicodeOr("\u2500", "-");
|
|
735
|
-
unicodeOr("\u256E", "+");
|
|
736
|
-
unicodeOr("\u251C", "+");
|
|
737
|
-
unicodeOr("\u256F", "+");
|
|
738
|
-
unicodeOr("\u25CF", "\u2022");
|
|
739
|
-
unicodeOr("\u25C6", "*");
|
|
740
|
-
unicodeOr("\u25B2", "!");
|
|
741
|
-
unicodeOr("\u25A0", "x");
|
|
742
|
-
var symbol = /* @__PURE__ */ __name((state) => {
|
|
743
|
-
switch (state) {
|
|
744
|
-
case "initial":
|
|
745
|
-
case "active":
|
|
746
|
-
return ansis_default.cyan(S_STEP_ACTIVE);
|
|
747
|
-
case "cancel":
|
|
748
|
-
return ansis_default.red(S_STEP_CANCEL);
|
|
749
|
-
case "error":
|
|
750
|
-
return ansis_default.yellow(S_STEP_ERROR);
|
|
751
|
-
case "submit":
|
|
752
|
-
return ansis_default.green(S_STEP_SUBMIT);
|
|
753
|
-
}
|
|
754
|
-
}, "symbol");
|
|
755
|
-
var limitOptions = /* @__PURE__ */ __name((params) => {
|
|
756
|
-
const { cursor, options, style } = params;
|
|
757
|
-
const output = params.output ?? process.stdout;
|
|
758
|
-
const rows = output instanceof WriteStream && output.rows !== void 0 ? output.rows : 10;
|
|
759
|
-
const paramMaxItems = params.maxItems ?? Number.POSITIVE_INFINITY;
|
|
760
|
-
const outputMaxItems = Math.max(rows - 4, 0);
|
|
761
|
-
const maxItems = Math.min(outputMaxItems, Math.max(paramMaxItems, 5));
|
|
762
|
-
let slidingWindowLocation = 0;
|
|
763
|
-
if (cursor >= slidingWindowLocation + maxItems - 3) {
|
|
764
|
-
slidingWindowLocation = Math.max(Math.min(cursor - maxItems + 3, options.length - maxItems), 0);
|
|
765
|
-
} else if (cursor < slidingWindowLocation + 2) {
|
|
766
|
-
slidingWindowLocation = Math.max(cursor - 2, 0);
|
|
767
|
-
}
|
|
768
|
-
const shouldRenderTopEllipsis = maxItems < options.length && slidingWindowLocation > 0;
|
|
769
|
-
const shouldRenderBottomEllipsis = maxItems < options.length && slidingWindowLocation + maxItems < options.length;
|
|
770
|
-
return options.slice(slidingWindowLocation, slidingWindowLocation + maxItems).map((option, i, arr) => {
|
|
771
|
-
const isTopLimit = i === 0 && shouldRenderTopEllipsis;
|
|
772
|
-
const isBottomLimit = i === arr.length - 1 && shouldRenderBottomEllipsis;
|
|
773
|
-
return isTopLimit || isBottomLimit ? ansis_default.dim("...") : style(option, i + slidingWindowLocation === cursor);
|
|
774
|
-
});
|
|
775
|
-
}, "limitOptions");
|
|
776
|
-
var confirm = /* @__PURE__ */ __name((opts) => {
|
|
777
|
-
const active = opts.active ?? "Yes";
|
|
778
|
-
const inactive = opts.inactive ?? "No";
|
|
779
|
-
return new dD({
|
|
780
|
-
active,
|
|
781
|
-
inactive,
|
|
782
|
-
input: opts.input,
|
|
783
|
-
output: opts.output,
|
|
784
|
-
initialValue: opts.initialValue ?? true,
|
|
785
|
-
render() {
|
|
786
|
-
const title = `
|
|
787
|
-
${symbol(this.state)} ${opts.message}
|
|
788
|
-
`;
|
|
789
|
-
const value = this.value ? active : inactive;
|
|
790
|
-
switch (this.state) {
|
|
791
|
-
case "submit":
|
|
792
|
-
return `${title}\u200E ${ansis_default.dim(value)}`;
|
|
793
|
-
case "cancel":
|
|
794
|
-
return `${title}\u200E ${ansis_default.strikethrough(
|
|
795
|
-
ansis_default.dim(value)
|
|
796
|
-
)}
|
|
797
|
-
`;
|
|
798
|
-
default: {
|
|
799
|
-
return `${title}\u200E ${this.value ? `${ansis_default.green(S_RADIO_ACTIVE)} ${active}` : `${ansis_default.dim(S_RADIO_INACTIVE)} ${ansis_default.dim(active)}`} ${ansis_default.dim("/")} ${!this.value ? `${ansis_default.green(S_RADIO_ACTIVE)} ${inactive}` : `${ansis_default.dim(S_RADIO_INACTIVE)} ${ansis_default.dim(inactive)}`}
|
|
800
|
-
`;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}).prompt();
|
|
805
|
-
}, "confirm");
|
|
806
|
-
var select = /* @__PURE__ */ __name((opts) => {
|
|
807
|
-
const opt = /* @__PURE__ */ __name((option, state) => {
|
|
808
|
-
const label = option.label ?? String(option.value);
|
|
809
|
-
switch (state) {
|
|
810
|
-
case "selected":
|
|
811
|
-
return `${ansis_default.dim(label)}`;
|
|
812
|
-
case "active":
|
|
813
|
-
return `${ansis_default.green(S_RADIO_ACTIVE)} ${label} ${option.hint ? ansis_default.dim(`(${option.hint})`) : ""}`;
|
|
814
|
-
case "cancelled":
|
|
815
|
-
return `${ansis_default.strikethrough(ansis_default.dim(label))}`;
|
|
816
|
-
default:
|
|
817
|
-
return `${ansis_default.dim(S_RADIO_INACTIVE)} ${ansis_default.dim(label)}`;
|
|
818
|
-
}
|
|
819
|
-
}, "opt");
|
|
820
|
-
return new LD({
|
|
821
|
-
options: opts.options,
|
|
822
|
-
input: opts.input,
|
|
823
|
-
output: opts.output,
|
|
824
|
-
initialValue: opts.initialValue,
|
|
825
|
-
render() {
|
|
826
|
-
const title = `${ansis_default.gray(S_BAR)}
|
|
827
|
-
${symbol(this.state)} ${opts.message}
|
|
828
|
-
`;
|
|
829
|
-
switch (this.state) {
|
|
830
|
-
case "submit":
|
|
831
|
-
return `${title}${ansis_default.gray(S_BAR)} ${opt(this.options[this.cursor], "selected")}`;
|
|
832
|
-
case "cancel":
|
|
833
|
-
return `${title}${ansis_default.gray(S_BAR)} ${opt(
|
|
834
|
-
this.options[this.cursor],
|
|
835
|
-
"cancelled"
|
|
836
|
-
)}
|
|
837
|
-
${ansis_default.gray(S_BAR)}`;
|
|
838
|
-
default: {
|
|
839
|
-
return `${title}${ansis_default.cyan(S_BAR)} ${limitOptions({
|
|
840
|
-
output: opts.output,
|
|
841
|
-
cursor: this.cursor,
|
|
842
|
-
options: this.options,
|
|
843
|
-
maxItems: opts.maxItems,
|
|
844
|
-
style: /* @__PURE__ */ __name((item, active) => opt(item, active ? "active" : "inactive"), "style")
|
|
845
|
-
}).join(`
|
|
846
|
-
${ansis_default.cyan(S_BAR)} `)}
|
|
847
|
-
${ansis_default.cyan(S_BAR_END)}
|
|
848
|
-
`;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}).prompt();
|
|
853
|
-
}, "select");
|
|
854
|
-
var multiselect = /* @__PURE__ */ __name((opts) => {
|
|
855
|
-
const opt = /* @__PURE__ */ __name((option, state) => {
|
|
856
|
-
const label = option.label ?? String(option.value);
|
|
857
|
-
if (state === "active") {
|
|
858
|
-
return `${ansis_default.cyan(S_CHECKBOX_ACTIVE)} ${label} ${option.hint ? ansis_default.dim(`(${option.hint})`) : ""}`;
|
|
859
|
-
}
|
|
860
|
-
if (state === "selected") {
|
|
861
|
-
return `${ansis_default.green(S_CHECKBOX_SELECTED)} ${ansis_default.dim(label)} ${option.hint ? ansis_default.dim(`(${option.hint})`) : ""}`;
|
|
862
|
-
}
|
|
863
|
-
if (state === "cancelled") {
|
|
864
|
-
return `${ansis_default.strikethrough(ansis_default.dim(label))}`;
|
|
865
|
-
}
|
|
866
|
-
if (state === "active-selected") {
|
|
867
|
-
return `${ansis_default.green(S_CHECKBOX_SELECTED)} ${label} ${option.hint ? ansis_default.dim(`(${option.hint})`) : ""}`;
|
|
868
|
-
}
|
|
869
|
-
if (state === "submitted") {
|
|
870
|
-
return `${ansis_default.dim(label)}`;
|
|
871
|
-
}
|
|
872
|
-
return `${ansis_default.dim(S_CHECKBOX_INACTIVE)} ${ansis_default.dim(label)}`;
|
|
873
|
-
}, "opt");
|
|
874
|
-
return new SD({
|
|
875
|
-
options: opts.options,
|
|
876
|
-
input: opts.input,
|
|
877
|
-
output: opts.output,
|
|
878
|
-
initialValues: opts.initialValues,
|
|
879
|
-
required: opts.required ?? true,
|
|
880
|
-
cursorAt: opts.cursorAt,
|
|
881
|
-
validate(selected) {
|
|
882
|
-
if (this.required && selected.length === 0) {
|
|
883
|
-
return `Please select at least one option.
|
|
884
|
-
${ansis_default.reset(
|
|
885
|
-
ansis_default.dim(
|
|
886
|
-
`Press ${ansis_default.gray(ansis_default.bgWhite(ansis_default.inverse(" space ")))} to select, ${ansis_default.gray(
|
|
887
|
-
ansis_default.bgWhite(ansis_default.inverse(" enter "))
|
|
888
|
-
)} to submit`
|
|
889
|
-
)
|
|
890
|
-
)}`;
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
render() {
|
|
894
|
-
let title = `${ansis_default.gray(S_BAR)}
|
|
895
|
-
${symbol(this.state)} ${opts.message}
|
|
896
|
-
`;
|
|
897
|
-
if (opts.details) title += `${ansis_default.gray(S_BAR)} ${opts.details}
|
|
898
|
-
`;
|
|
899
|
-
const styleOption = /* @__PURE__ */ __name((option, active) => {
|
|
900
|
-
const selected = this.value.includes(option.value);
|
|
901
|
-
if (active && selected) {
|
|
902
|
-
return opt(option, "active-selected");
|
|
903
|
-
}
|
|
904
|
-
if (selected) {
|
|
905
|
-
return opt(option, "selected");
|
|
906
|
-
}
|
|
907
|
-
return opt(option, active ? "active" : "inactive");
|
|
908
|
-
}, "styleOption");
|
|
909
|
-
switch (this.state) {
|
|
910
|
-
case "submit": {
|
|
911
|
-
return `${title}${ansis_default.gray(S_BAR)} ${this.options.filter(({ value }) => this.value.includes(value)).map((option) => opt(option, "submitted")).join(ansis_default.dim(", ")) || ansis_default.dim("none")}`;
|
|
912
|
-
}
|
|
913
|
-
case "cancel": {
|
|
914
|
-
const label = this.options.filter(({ value }) => this.value.includes(value)).map((option) => opt(option, "cancelled")).join(ansis_default.dim(", "));
|
|
915
|
-
return `${title}${ansis_default.gray(S_BAR)} ${label.trim() ? `${label}
|
|
916
|
-
${ansis_default.gray(S_BAR)}` : ""}`;
|
|
917
|
-
}
|
|
918
|
-
case "error": {
|
|
919
|
-
const footer = this.error.split("\n").map((ln, i) => i === 0 ? `${ansis_default.yellow(S_BAR_END)} ${ansis_default.yellow(ln)}` : ` ${ln}`).join("\n");
|
|
920
|
-
return `${title + ansis_default.yellow(S_BAR)} ${limitOptions({
|
|
921
|
-
output: opts.output,
|
|
922
|
-
options: this.options,
|
|
923
|
-
cursor: this.cursor,
|
|
924
|
-
maxItems: opts.maxItems,
|
|
925
|
-
style: styleOption
|
|
926
|
-
}).join(`
|
|
927
|
-
${ansis_default.yellow(S_BAR)} `)}
|
|
928
|
-
${footer}
|
|
929
|
-
`;
|
|
930
|
-
}
|
|
931
|
-
default: {
|
|
932
|
-
return `${title}${ansis_default.cyan(S_BAR)} ${limitOptions({
|
|
933
|
-
output: opts.output,
|
|
934
|
-
options: this.options,
|
|
935
|
-
cursor: this.cursor,
|
|
936
|
-
maxItems: opts.maxItems,
|
|
937
|
-
style: styleOption
|
|
938
|
-
}).join(`
|
|
939
|
-
${ansis_default.cyan(S_BAR)} `)}
|
|
940
|
-
${ansis_default.cyan(S_BAR_END)}
|
|
941
|
-
`;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
}).prompt();
|
|
946
|
-
}, "multiselect");
|
|
947
|
-
var prompts = {
|
|
948
|
-
confirm,
|
|
949
|
-
select,
|
|
950
|
-
multiselect
|
|
951
|
-
};
|
|
952
|
-
var prompts_default = prompts;
|
|
953
|
-
var PUBLIC_PREFIXES = [
|
|
954
|
-
"PUBLIC",
|
|
955
|
-
"VITE",
|
|
956
|
-
"NEXT_PUBLIC",
|
|
957
|
-
"NUXT_PUBLIC"
|
|
958
|
-
];
|
|
959
|
-
var PUBLIC_KEYWORDS = ["PUBLIC"];
|
|
960
|
-
var SENSITIVE_KEYWORDS = [
|
|
961
|
-
"SECRET",
|
|
962
|
-
"API_KEY",
|
|
963
|
-
"PASSWORD",
|
|
964
|
-
"TOKEN",
|
|
965
|
-
"PRIVATE",
|
|
966
|
-
"CREDENTIALS"
|
|
967
|
-
];
|
|
968
|
-
function isValidUrl(val) {
|
|
969
|
-
try {
|
|
970
|
-
const u2 = new URL(val);
|
|
971
|
-
return true;
|
|
972
|
-
} catch (err) {
|
|
973
|
-
return false;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
__name(isValidUrl, "isValidUrl");
|
|
977
|
-
var EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
978
|
-
var VALID_NUMBER_REGEX = /^(0|([1-9][0-9]*))?(\.[0-9]+)?$/;
|
|
979
|
-
function inferItemDecorators(file, itemKey, valueStr) {
|
|
980
|
-
let itemIsPublic = false;
|
|
981
|
-
if (PUBLIC_PREFIXES.some((prefix) => itemKey.startsWith(prefix))) itemIsPublic = true;
|
|
982
|
-
if (PUBLIC_KEYWORDS.some((keyword) => itemKey.includes(keyword))) itemIsPublic = true;
|
|
983
|
-
let itemIsSensitive = false;
|
|
984
|
-
if (SENSITIVE_KEYWORDS.some((keyword) => itemKey.includes(keyword))) itemIsSensitive = true;
|
|
985
|
-
if (itemIsPublic) ; else if (itemIsSensitive) {
|
|
986
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "sensitive", "true");
|
|
987
|
-
}
|
|
988
|
-
if (itemKey === "PORT" || itemKey.endsWith("_PORT")) {
|
|
989
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "port");
|
|
990
|
-
} else if (itemKey.endsWith("_EMAIL")) {
|
|
991
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "email");
|
|
992
|
-
} else if (itemKey.endsWith("_URL") || itemKey.endsWith("_URI")) {
|
|
993
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "url");
|
|
994
|
-
} else if (valueStr) {
|
|
995
|
-
if (valueStr.startsWith("<") && valueStr.endsWith(">")) {
|
|
996
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "example", valueStr);
|
|
997
|
-
}
|
|
998
|
-
if (valueStr === "true" || valueStr === "false") {
|
|
999
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "boolean");
|
|
1000
|
-
} else if (EMAIL_REGEX.test(valueStr)) {
|
|
1001
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "email");
|
|
1002
|
-
} else if (valueStr !== "0" && valueStr !== "1" && VALID_NUMBER_REGEX.test(valueStr)) {
|
|
1003
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "number");
|
|
1004
|
-
} else if (isValidUrl(valueStr)) {
|
|
1005
|
-
envSpecUpdater.setItemDecorator(file, itemKey, "type", "url");
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
__name(inferItemDecorators, "inferItemDecorators");
|
|
1010
|
-
function inferSchemaUpdates(file) {
|
|
1011
|
-
for (const item of file.configItems) {
|
|
1012
|
-
const valueStr = item.value instanceof ParsedEnvSpecStaticValue && item.value.value?.toString() || "";
|
|
1013
|
-
inferItemDecorators(file, item.key, valueStr);
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
__name(inferSchemaUpdates, "inferSchemaUpdates");
|
|
1017
|
-
function ensureAllItemsExist(schemaFile, otherFiles) {
|
|
1018
|
-
const addedItemKeys = [];
|
|
1019
|
-
for (const otherFile of otherFiles) {
|
|
1020
|
-
for (const item of otherFile.parsedFile.configItems) {
|
|
1021
|
-
const itemInSchema = schemaFile.configItems.find((i) => i.key === item.key);
|
|
1022
|
-
if (itemInSchema) continue;
|
|
1023
|
-
if (addedItemKeys.length === 0) {
|
|
1024
|
-
envSpecUpdater.injectFromStr(schemaFile, [
|
|
1025
|
-
"",
|
|
1026
|
-
"# items added to schema by `varlock init`",
|
|
1027
|
-
"# that were missing in example, but detected in other .env files",
|
|
1028
|
-
"# PLEASE REVIEW THESE!",
|
|
1029
|
-
"# ---",
|
|
1030
|
-
""
|
|
1031
|
-
].join("\n"), { location: "end" });
|
|
1032
|
-
}
|
|
1033
|
-
addedItemKeys.push(item.key);
|
|
1034
|
-
envSpecUpdater.injectFromStr(schemaFile, `${item.key}=`);
|
|
1035
|
-
const itemValue = item.value instanceof ParsedEnvSpecStaticValue && item.value.value?.toString() || "";
|
|
1036
|
-
inferItemDecorators(schemaFile, item.key, String(itemValue));
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
__name(ensureAllItemsExist, "ensureAllItemsExist");
|
|
1041
|
-
async function detectRedundantValues(schemaFile, otherFiles, opts = {}) {
|
|
1042
|
-
const redundantItemsBySourcePath = {};
|
|
1043
|
-
const schemaValues = schemaFile.toSimpleObj();
|
|
1044
|
-
for (const otherFile of Object.values(otherFiles)) {
|
|
1045
|
-
if (otherFile.fileName.startsWith(".env.schema") || otherFile.fileName.startsWith(".env.example") || otherFile.fileName.startsWith(".env.sample") || otherFile.fileName.startsWith(".env.default")) continue;
|
|
1046
|
-
const otherFileValues = otherFile.parsedFile.toSimpleObj();
|
|
1047
|
-
for (const itemKey in otherFileValues) {
|
|
1048
|
-
if (!(itemKey in schemaValues)) continue;
|
|
1049
|
-
if (otherFileValues[itemKey] !== schemaValues[itemKey]) continue;
|
|
1050
|
-
redundantItemsBySourcePath[otherFile.fullPath] ||= [];
|
|
1051
|
-
redundantItemsBySourcePath[otherFile.fullPath].push(itemKey);
|
|
1052
|
-
if (opts.delete) {
|
|
1053
|
-
envSpecUpdater.deleteItem(otherFile.parsedFile, itemKey);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
if (opts.delete) {
|
|
1057
|
-
await fs3.writeFile(otherFile.fullPath, otherFile.parsedFile.toString(), "utf8");
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
return redundantItemsBySourcePath;
|
|
1061
|
-
}
|
|
1062
|
-
__name(detectRedundantValues, "detectRedundantValues");
|
|
1063
|
-
var SKIP_FILE_TYPES = [".md", ".d.ts"];
|
|
1064
|
-
async function findEnvFiles(opts) {
|
|
1065
|
-
const cwd = opts?.cwd || process.cwd();
|
|
1066
|
-
const envFiles = [];
|
|
1067
|
-
const filesWithinDir = await fs3.readdir(cwd);
|
|
1068
|
-
for (const fileName of filesWithinDir) {
|
|
1069
|
-
if (fileName === ".env" || fileName.startsWith(".env.")) {
|
|
1070
|
-
let skip = false;
|
|
1071
|
-
for (const fileType of SKIP_FILE_TYPES) {
|
|
1072
|
-
if (fileName.endsWith(fileType)) skip = true;
|
|
1073
|
-
}
|
|
1074
|
-
if (skip) continue;
|
|
1075
|
-
envFiles.push(path2.join(cwd, fileName));
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
return envFiles;
|
|
1079
|
-
}
|
|
1080
|
-
__name(findEnvFiles, "findEnvFiles");
|
|
1081
|
-
|
|
1082
|
-
// src/cli/commands/init.command.ts
|
|
1083
|
-
var commandSpec = define({
|
|
1084
|
-
name: "init",
|
|
1085
|
-
description: "Set up varlock in the current project",
|
|
1086
|
-
args: {},
|
|
1087
|
-
examples: `
|
|
1088
|
-
This command starts an interactive onboarding process to help you get started with Varlock.
|
|
1089
|
-
It will:
|
|
1090
|
-
- Scan for existing .env files in your project
|
|
1091
|
-
- Help create a .env.schema file from your .env.example or .env.sample file
|
|
1092
|
-
- Install varlock as a dependency in package.json (if applicable)
|
|
1093
|
-
|
|
1094
|
-
\u{1F4CD} Run this command in directories that contain .env or .env.* files
|
|
1095
|
-
|
|
1096
|
-
Examples:
|
|
1097
|
-
varlock init # Run in the current directory
|
|
1098
|
-
cd path/to/your/project && varlock init
|
|
1099
|
-
|
|
1100
|
-
For more information, visit https://varlock.dev/getting-started/installation
|
|
1101
|
-
`.trim()
|
|
1102
|
-
});
|
|
1103
|
-
var commandFn = /* @__PURE__ */ __name(async (ctx) => {
|
|
1104
|
-
const jsPackageManager = detectJsPackageManager();
|
|
1105
|
-
console.log("\u{1F9D9} Hello and welcome to Varlock \u{1F512}\u{1F525}\u2728");
|
|
1106
|
-
const envFilePaths = await findEnvFiles();
|
|
1107
|
-
const parsedEnvFiles = {};
|
|
1108
|
-
for (const filePath of envFilePaths) {
|
|
1109
|
-
const fileContents = await fs3.readFile(filePath, "utf-8");
|
|
1110
|
-
const fileName = path2.basename(filePath);
|
|
1111
|
-
const parsedFile = await tryCatch(async () => parseEnvSpecDotEnvFile(fileContents), () => {
|
|
1112
|
-
logLines([
|
|
1113
|
-
"",
|
|
1114
|
-
`Unable to parse ${fmt.filePath(filePath)}`,
|
|
1115
|
-
"This file will be skipped."
|
|
1116
|
-
]);
|
|
1117
|
-
});
|
|
1118
|
-
if (!parsedFile) {
|
|
1119
|
-
continue;
|
|
1120
|
-
}
|
|
1121
|
-
parsedEnvFiles[fileName] = {
|
|
1122
|
-
fileName,
|
|
1123
|
-
fullPath: filePath,
|
|
1124
|
-
parsedFile
|
|
1125
|
-
};
|
|
1126
|
-
}
|
|
1127
|
-
const existingSchemaFile = parsedEnvFiles[".env.schema"];
|
|
1128
|
-
if (existingSchemaFile) {
|
|
1129
|
-
logLines([
|
|
1130
|
-
`It looks like you already have a ${fmt.fileName(".env.schema")} file \u{1F389}`,
|
|
1131
|
-
"This init helper is meant to help you get a new project set up.",
|
|
1132
|
-
"If you need to make changes to your schema or values, you can update your files directly.",
|
|
1133
|
-
"See more docs at https://varlock.dev/guides/schema"
|
|
1134
|
-
]);
|
|
1135
|
-
} else {
|
|
1136
|
-
const allExampleFileNames = Object.keys(parsedEnvFiles).filter((fileName) => {
|
|
1137
|
-
return fileName.startsWith(".env.example") || fileName.startsWith(".env.sample");
|
|
1138
|
-
});
|
|
1139
|
-
let exampleFileToConvert;
|
|
1140
|
-
if (allExampleFileNames.length === 1) {
|
|
1141
|
-
exampleFileToConvert = parsedEnvFiles[allExampleFileNames[0]];
|
|
1142
|
-
} else if (allExampleFileNames.length > 1) {
|
|
1143
|
-
console.log("");
|
|
1144
|
-
const selectedExample = await ve({
|
|
1145
|
-
message: `We detected more than one example .env file. Which one should we use to create your new ${fmt.fileName(".env.schema")}?`,
|
|
1146
|
-
options: allExampleFileNames.map((fileName) => ({
|
|
1147
|
-
label: fileName,
|
|
1148
|
-
value: parsedEnvFiles[fileName]
|
|
1149
|
-
}))
|
|
1150
|
-
});
|
|
1151
|
-
if (pD(selectedExample)) return gracefulExit(0);
|
|
1152
|
-
exampleFileToConvert = selectedExample;
|
|
1153
|
-
}
|
|
1154
|
-
const parsedEnvSchemaFile = exampleFileToConvert?.parsedFile || parseEnvSpecDotEnvFile("");
|
|
1155
|
-
if (!parsedEnvSchemaFile) throw new Error("expected parsed .env example file");
|
|
1156
|
-
envSpecUpdater.ensureHeader(parsedEnvSchemaFile, [
|
|
1157
|
-
"This env file uses @env-spec - see https://varlock.dev/env-spec for more info",
|
|
1158
|
-
""
|
|
1159
|
-
// TODO: add env spec version? real links?
|
|
1160
|
-
].join("\n"));
|
|
1161
|
-
envSpecUpdater.setRootDecorator(parsedEnvSchemaFile, "defaultRequired", "infer", { explicitTrue: true });
|
|
1162
|
-
envSpecUpdater.setRootDecorator(parsedEnvSchemaFile, "defaultSensitive", "false", { explicitTrue: true });
|
|
1163
|
-
envSpecUpdater.setRootDecorator(parsedEnvSchemaFile, "generateTypes", "lang=ts, path=env.d.ts", { bareFnArgs: true });
|
|
1164
|
-
envSpecUpdater.injectFromStr(parsedEnvSchemaFile, [
|
|
1165
|
-
"",
|
|
1166
|
-
"# example env variable injected by `varlock init` \u26A0\uFE0F DELETE THIS ITEM! \u26A0\uFE0F",
|
|
1167
|
-
'# @required @sensitive @example="example value"',
|
|
1168
|
-
'EXAMPLE_ITEM="delete me!"',
|
|
1169
|
-
""
|
|
1170
|
-
].join("\n"), { location: "after_header" });
|
|
1171
|
-
inferSchemaUpdates(parsedEnvSchemaFile);
|
|
1172
|
-
ensureAllItemsExist(parsedEnvSchemaFile, Object.values(parsedEnvFiles));
|
|
1173
|
-
const schemaFilePath = path2.join(process.cwd(), ".env.schema");
|
|
1174
|
-
await fs3.writeFile(schemaFilePath, parsedEnvSchemaFile.toString());
|
|
1175
|
-
if (exampleFileToConvert) {
|
|
1176
|
-
logLines([
|
|
1177
|
-
"",
|
|
1178
|
-
`Your ${fmt.fileName(exampleFileToConvert.fileName)} has been used to generate your new ${fmt.fileName(".env.schema")}:`,
|
|
1179
|
-
fmt.filePath(schemaFilePath)
|
|
1180
|
-
]);
|
|
1181
|
-
} else {
|
|
1182
|
-
logLines([
|
|
1183
|
-
"",
|
|
1184
|
-
`Your new ${fmt.fileName(".env.schema")} file has been created:`,
|
|
1185
|
-
fmt.filePath(schemaFilePath)
|
|
1186
|
-
]);
|
|
1187
|
-
}
|
|
1188
|
-
if (await checkIsFileGitIgnored(schemaFilePath)) {
|
|
1189
|
-
logLines([ansis_default.dim(`(and updated ${fmt.fileName(".gitignore")} to ensure it will be tracked by git)`)]);
|
|
1190
|
-
await fs3.appendFile(".gitignore", "\n!.env.schema");
|
|
1191
|
-
}
|
|
1192
|
-
logLines([
|
|
1193
|
-
"",
|
|
1194
|
-
ansis_default.bold(`\u{1F6A7} Please review and update your new ${fmt.fileName(".env.schema")} file! \u{1F6A7}`),
|
|
1195
|
-
`We've done our best to get you started, but you must review and make sure it is correct!`,
|
|
1196
|
-
"",
|
|
1197
|
-
`\u{1F449} Some helpful pointers to get you started:`,
|
|
1198
|
-
`- add a description to each item when the name is not self explanitory - it will come through in generated types`,
|
|
1199
|
-
`- use ${fmt.decorator("@required")} (or ${fmt.decorator("@optional")}) to tag items that should fail validation when empty`,
|
|
1200
|
-
`- use ${fmt.decorator("@sensitive")} to tag items that contain sensitive secrets, and must be handled accordingly`,
|
|
1201
|
-
`- use ${fmt.decorator("@type")} to set an item's data type (if not a basic string), which affects validation and coercion logic`,
|
|
1202
|
-
`- if an item value is a ${ansis_default.italic("useful example")} rather than a default, use ${fmt.decorator("@example")}`,
|
|
1203
|
-
`- if an item value is just a dummy placeholder, delete it`
|
|
1204
|
-
]);
|
|
1205
|
-
const confirmReviewed = await prompts_default.confirm({
|
|
1206
|
-
message: `Have you reviewed and updated your new ${fmt.fileName(".env.schema")} file?`
|
|
1207
|
-
});
|
|
1208
|
-
if (pD(confirmReviewed)) return gracefulExit(0);
|
|
1209
|
-
const reloadedSchemaFile = await parseEnvSpecDotEnvFile(await fs3.readFile(schemaFilePath, "utf-8"));
|
|
1210
|
-
if (reloadedSchemaFile.configItems.find((i) => i.key === "EXAMPLE_ITEM")) {
|
|
1211
|
-
logLines([
|
|
1212
|
-
"",
|
|
1213
|
-
ansis_default.bold(`\u{1F6A8} Really? ${ansis_default.red("You didn't remove the EXAMPLE_ITEM!")}`),
|
|
1214
|
-
`Please make sure your schema is all correct before using it...`
|
|
1215
|
-
]);
|
|
1216
|
-
}
|
|
1217
|
-
if (exampleFileToConvert) {
|
|
1218
|
-
const confirmDeleteExample = await prompts_default.confirm({
|
|
1219
|
-
message: `Should we delete your ${fmt.fileName(exampleFileToConvert.fileName)} file? ${ansis_default.italic.gray("(you can always do this yourself later)")}`
|
|
1220
|
-
});
|
|
1221
|
-
if (pD(confirmDeleteExample)) return gracefulExit(0);
|
|
1222
|
-
if (confirmDeleteExample) {
|
|
1223
|
-
await fs3.unlink(exampleFileToConvert.fullPath);
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
const defaultsFile = Object.values(parsedEnvFiles).find((f) => {
|
|
1227
|
-
return f.fileName.startsWith(".env.default");
|
|
1228
|
-
});
|
|
1229
|
-
if (defaultsFile) {
|
|
1230
|
-
logLines([
|
|
1231
|
-
"",
|
|
1232
|
-
`\u{1F6A7} We detected a ${fmt.fileName(defaultsFile.fileName)} file in your project`,
|
|
1233
|
-
`You should migrate these default values into ${fmt.fileName(".env.schema")} and delete it.`
|
|
1234
|
-
]);
|
|
1235
|
-
}
|
|
1236
|
-
const redundantInfo = await detectRedundantValues(parsedEnvSchemaFile, parsedEnvFiles);
|
|
1237
|
-
if (Object.keys(redundantInfo).length > 0) {
|
|
1238
|
-
logLines([
|
|
1239
|
-
"",
|
|
1240
|
-
ansis_default.bold("\u203C\uFE0F Now that your schema contains defaults, some values in your other .env files are redundant:")
|
|
1241
|
-
]);
|
|
1242
|
-
for (const [sourcePath, itemKeys] of Object.entries(redundantInfo)) {
|
|
1243
|
-
console.log(fmt.filePath(sourcePath));
|
|
1244
|
-
console.log(" ", itemKeys.map((k3) => ansis_default.italic(k3)).join(", "));
|
|
1245
|
-
}
|
|
1246
|
-
const confirmDeleteRedundant = await prompts_default.confirm({
|
|
1247
|
-
message: "Should we delete these redundant values from your other .env files?"
|
|
1248
|
-
});
|
|
1249
|
-
if (pD(confirmDeleteRedundant)) return gracefulExit(0);
|
|
1250
|
-
if (confirmDeleteRedundant) {
|
|
1251
|
-
await detectRedundantValues(parsedEnvSchemaFile, parsedEnvFiles, { delete: true });
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
logLines([
|
|
1255
|
-
"",
|
|
1256
|
-
ansis_default.bold("\u{1F389} Great!"),
|
|
1257
|
-
`You can run ${fmt.command("varlock load", { jsPackageManager })} to attempt loading your env vars validate against your new schema.`,
|
|
1258
|
-
"",
|
|
1259
|
-
"Check out our docs for more info about integrating into your application.",
|
|
1260
|
-
"",
|
|
1261
|
-
"\u{1F4D6} https://varlock.dev \u{1F448}",
|
|
1262
|
-
""
|
|
1263
|
-
]);
|
|
1264
|
-
}
|
|
1265
|
-
if (jsPackageManager && await pathExists(path2.join(process.cwd(), "package.json"))) {
|
|
1266
|
-
const installResult = installJsDependency({
|
|
1267
|
-
packageManager: jsPackageManager.name,
|
|
1268
|
-
packageName: "varlock"
|
|
1269
|
-
});
|
|
1270
|
-
if (installResult) {
|
|
1271
|
-
logLines([
|
|
1272
|
-
"",
|
|
1273
|
-
`\u2705 Added ${fmt.packageName("varlock")} as a dependency in your package.json`
|
|
1274
|
-
]);
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}, "commandFn");
|
|
1278
|
-
|
|
1279
|
-
export { commandFn, commandSpec };
|
|
1280
|
-
//# sourceMappingURL=chunk-L5USEQO6.js.map
|
|
1281
|
-
//# sourceMappingURL=chunk-L5USEQO6.js.map
|