UNPKG

failure-lambda

Version:

Failure injection for AWS Lambda - chaos engineering made simple

930 lines (926 loc) 91.1 kB
#!/usr/bin/env node import { __commonJS, __toESM } from "./chunk-UT3JLF3M.js"; // node_modules/picocolors/picocolors.js var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports, module) { "use strict"; var p = process || {}; var argv = p.argv || []; var env = p.env || {}; var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI); var formatter = (open, close, replace = open) => (input) => { let string = "" + input, index = string.indexOf(close, open.length); return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close; }; var replaceClose = (string, close, replace, index) => { let result = "", cursor = 0; do { result += string.substring(cursor, index) + replace; cursor = index + close.length; index = string.indexOf(close, cursor); } while (~index); return result + string.substring(cursor); }; var createColors = (enabled = isColorSupported) => { let f = enabled ? formatter : () => String; return { isColorSupported: enabled, reset: f("\x1B[0m", "\x1B[0m"), bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"), dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"), italic: f("\x1B[3m", "\x1B[23m"), underline: f("\x1B[4m", "\x1B[24m"), inverse: f("\x1B[7m", "\x1B[27m"), hidden: f("\x1B[8m", "\x1B[28m"), strikethrough: f("\x1B[9m", "\x1B[29m"), black: f("\x1B[30m", "\x1B[39m"), red: f("\x1B[31m", "\x1B[39m"), green: f("\x1B[32m", "\x1B[39m"), yellow: f("\x1B[33m", "\x1B[39m"), blue: f("\x1B[34m", "\x1B[39m"), magenta: f("\x1B[35m", "\x1B[39m"), cyan: f("\x1B[36m", "\x1B[39m"), white: f("\x1B[37m", "\x1B[39m"), gray: f("\x1B[90m", "\x1B[39m"), bgBlack: f("\x1B[40m", "\x1B[49m"), bgRed: f("\x1B[41m", "\x1B[49m"), bgGreen: f("\x1B[42m", "\x1B[49m"), bgYellow: f("\x1B[43m", "\x1B[49m"), bgBlue: f("\x1B[44m", "\x1B[49m"), bgMagenta: f("\x1B[45m", "\x1B[49m"), bgCyan: f("\x1B[46m", "\x1B[49m"), bgWhite: f("\x1B[47m", "\x1B[49m"), blackBright: f("\x1B[90m", "\x1B[39m"), redBright: f("\x1B[91m", "\x1B[39m"), greenBright: f("\x1B[92m", "\x1B[39m"), yellowBright: f("\x1B[93m", "\x1B[39m"), blueBright: f("\x1B[94m", "\x1B[39m"), magentaBright: f("\x1B[95m", "\x1B[39m"), cyanBright: f("\x1B[96m", "\x1B[39m"), whiteBright: f("\x1B[97m", "\x1B[39m"), bgBlackBright: f("\x1B[100m", "\x1B[49m"), bgRedBright: f("\x1B[101m", "\x1B[49m"), bgGreenBright: f("\x1B[102m", "\x1B[49m"), bgYellowBright: f("\x1B[103m", "\x1B[49m"), bgBlueBright: f("\x1B[104m", "\x1B[49m"), bgMagentaBright: f("\x1B[105m", "\x1B[49m"), bgCyanBright: f("\x1B[106m", "\x1B[49m"), bgWhiteBright: f("\x1B[107m", "\x1B[49m") }; }; module.exports = createColors(); module.exports.createColors = createColors; } }); // node_modules/sisteransi/src/index.js var require_src = __commonJS({ "node_modules/sisteransi/src/index.js"(exports, module) { "use strict"; var ESC = "\x1B"; var CSI = `${ESC}[`; var beep = "\x07"; var cursor = { to(x3, y2) { if (!y2) return `${CSI}${x3 + 1}G`; return `${CSI}${y2 + 1};${x3 + 1}H`; }, move(x3, y2) { let ret = ""; if (x3 < 0) ret += `${CSI}${-x3}D`; else if (x3 > 0) ret += `${CSI}${x3}C`; if (y2 < 0) ret += `${CSI}${-y2}A`; else if (y2 > 0) ret += `${CSI}${y2}B`; return ret; }, up: (count = 1) => `${CSI}${count}A`, down: (count = 1) => `${CSI}${count}B`, forward: (count = 1) => `${CSI}${count}C`, backward: (count = 1) => `${CSI}${count}D`, nextLine: (count = 1) => `${CSI}E`.repeat(count), prevLine: (count = 1) => `${CSI}F`.repeat(count), left: `${CSI}G`, hide: `${CSI}?25l`, show: `${CSI}?25h`, save: `${ESC}7`, restore: `${ESC}8` }; var scroll = { up: (count = 1) => `${CSI}S`.repeat(count), down: (count = 1) => `${CSI}T`.repeat(count) }; var erase = { screen: `${CSI}2J`, up: (count = 1) => `${CSI}1J`.repeat(count), down: (count = 1) => `${CSI}J`.repeat(count), line: `${CSI}2K`, lineEnd: `${CSI}K`, lineStart: `${CSI}1K`, lines(count) { let clear = ""; for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : ""); if (count) clear += cursor.left; return clear; } }; module.exports = { cursor, scroll, erase, beep }; } }); // node_modules/@clack/core/dist/index.mjs var import_picocolors = __toESM(require_picocolors(), 1); var import_sisteransi = __toESM(require_src(), 1); import { stdout as R, stdin as q } from "process"; import * as k from "readline"; import ot from "readline"; import { ReadStream as J } from "tty"; function B(t, e2, s) { if (!s.some((u) => !u.disabled)) return t; const i = t + e2, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i; return s[n].disabled ? B(n, e2 < 0 ? -1 : 1, s) : n; } var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109; var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510; var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141; var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y; var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y; var L = /\t{1,1000}/y; var P = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu"); var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y; var ct = new RegExp("\\p{M}+", "gu"); var ft = { limit: 1 / 0, ellipsis: "" }; var X = (t, e2 = {}, s = {}) => { const i = e2.limit ?? 1 / 0, r = e2.ellipsis ?? "", n = e2?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V2 = s.wideWidth ?? 2; let h = 0, o = 0, p = t.length, v = 0, F = false, d2 = p, b = Math.max(0, i - n), C2 = 0, w = 0, c = 0, f = 0; t: for (; ; ) { if (w > C2 || o >= p && o > h) { const ut2 = t.slice(C2, w) || t.slice(h, o); v = 0; for (const Y of ut2.replaceAll(ct, "")) { const $ = Y.codePointAt(0) || 0; if (lt($) ? f = m : ht($) ? f = V2 : E !== A && at($) ? f = E : f = A, c + f > b && (d2 = Math.min(d2, Math.max(C2, h) + v)), c + f > i) { F = true; break t; } v += Y.length, c += f; } C2 = w = 0; } if (o >= p) break; if (M.lastIndex = o, M.test(t)) { if (v = M.lastIndex - o, f = v * A, c + f > b && (d2 = Math.min(d2, o + Math.floor((b - c) / A))), c + f > i) { F = true; break; } c += f, C2 = h, w = o, o = h = M.lastIndex; continue; } if (O.lastIndex = o, O.test(t)) { if (c + u > b && (d2 = Math.min(d2, o)), c + u > i) { F = true; break; } c += u, C2 = h, w = o, o = h = O.lastIndex; continue; } if (y.lastIndex = o, y.test(t)) { if (v = y.lastIndex - o, f = v * a, c + f > b && (d2 = Math.min(d2, o + Math.floor((b - c) / a))), c + f > i) { F = true; break; } c += f, C2 = h, w = o, o = h = y.lastIndex; continue; } if (L.lastIndex = o, L.test(t)) { if (v = L.lastIndex - o, f = v * l, c + f > b && (d2 = Math.min(d2, o + Math.floor((b - c) / l))), c + f > i) { F = true; break; } c += f, C2 = h, w = o, o = h = L.lastIndex; continue; } if (P.lastIndex = o, P.test(t)) { if (c + g > b && (d2 = Math.min(d2, o)), c + g > i) { F = true; break; } c += g, C2 = h, w = o, o = h = P.lastIndex; continue; } o += 1; } return { width: F ? b : c, index: F ? d2 : p, truncated: F, ellipsed: F && i >= n }; }; var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 }; var S = (t, e2 = {}) => X(t, pt, e2).width; var W = "\x1B"; var Z = "\x9B"; var Ft = 39; var j = "\x07"; var Q = "["; var dt = "]"; var tt = "m"; var U = `${dt}8;;`; var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y"); var mt = (t) => { if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39; if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49; if (t === 1 || t === 2) return 22; if (t === 3) return 23; if (t === 4) return 24; if (t === 7) return 27; if (t === 8) return 28; if (t === 9) return 29; if (t === 0) return 0; }; var st = (t) => `${W}${Q}${t}${tt}`; var it = (t) => `${W}${U}${t}${j}`; var gt = (t) => t.map((e2) => S(e2)); var G = (t, e2, s) => { const i = e2[Symbol.iterator](); let r = false, n = false, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0; for (; !l.done; ) { const m = l.value, A = S(m); a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e2.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length; } u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop()); }; var vt = (t) => { const e2 = t.split(" "); let s = e2.length; for (; s > 0 && !(S(e2[s - 1]) > 0); ) s--; return s === e2.length ? t : e2.slice(0, s).join(" ") + e2.slice(s).join(""); }; var Et = (t, e2, s = {}) => { if (s.trim !== false && t.trim() === "") return ""; let i = "", r, n; const u = t.split(" "), a = gt(u); let l = [""]; for (const [h, o] of u.entries()) { s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart()); let p = S(l.at(-1) ?? ""); if (h !== 0 && (p >= e2 && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e2) { const v = e2 - p, F = 1 + Math.floor((a[h] - v - 1) / e2); Math.floor((a[h] - 1) / e2) < F && l.push(""), G(l, o, e2); continue; } if (p + a[h] > e2 && p > 0 && a[h] > 0) { if (s.wordWrap === false && p < e2) { G(l, o, e2); continue; } l.push(""); } if (p + a[h] > e2 && s.wordWrap === false) { G(l, o, e2); continue; } l[l.length - 1] += o; } s.trim !== false && (l = l.map((h) => vt(h))); const E = l.join(` `), g = E[Symbol.iterator](); let m = g.next(), A = g.next(), V2 = 0; for (; !m.done; ) { const h = m.value, o = A.value; if (i += h, h === W || h === Z) { et.lastIndex = V2 + 1; const F = et.exec(E)?.groups; if (F?.code !== void 0) { const d2 = Number.parseFloat(F.code); r = d2 === Ft ? void 0 : d2; } else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri); } const p = r ? mt(r) : void 0; o === ` ` ? (n && (i += it("")), r && p && (i += st(p))) : h === ` ` && (r && p && (i += st(r)), n && (i += it(n))), V2 += h.length, m = A, A = g.next(); } return i; }; function K(t, e2, s) { return String(t).normalize().replaceAll(`\r `, ` `).split(` `).map((i) => Et(i, e2, s)).join(` `); } var At = ["up", "down", "left", "right", "space", "enter", "cancel"]; var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true }; function It(t) { if (t.aliases !== void 0) { const e2 = t.aliases; for (const s in e2) { if (!Object.hasOwn(e2, s)) continue; const i = e2[s]; _.actions.has(i) && (_.aliases.has(s) || _.aliases.set(s, i)); } } if (t.messages !== void 0) { const e2 = t.messages; e2.cancel !== void 0 && (_.messages.cancel = e2.cancel), e2.error !== void 0 && (_.messages.error = e2.error); } t.withGuide !== void 0 && (_.withGuide = t.withGuide !== false); } function H(t, e2) { if (typeof t == "string") return _.aliases.get(t) === e2; for (const s of t) if (s !== void 0 && H(s, e2)) return true; return false; } function _t(t, e2) { if (t === e2) return; const s = t.split(` `), i = e2.split(` `), r = Math.max(s.length, i.length), n = []; for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u); return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r }; } var bt = globalThis.process.platform.startsWith("win"); var z = /* @__PURE__ */ Symbol("clack:cancel"); function Ct(t) { return t === z; } function T(t, e2) { const s = t; s.isTTY && s.setRawMode(e2); } function Bt({ input: t = q, output: e2 = R, overwrite: s = true, hideCursor: i = true } = {}) { const r = k.createInterface({ input: t, output: e2, prompt: "", tabSize: 1 }); k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true); const n = (u, { name: a, sequence: l }) => { const E = String(u); if (H([E, a, l], "cancel")) { i && e2.write(import_sisteransi.cursor.show), process.exit(0); return; } if (!s) return; const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0; k.moveCursor(e2, g, m, () => { k.clearLine(e2, 1, () => { t.once("keypress", n); }); }); }; return i && e2.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => { t.off("keypress", n), i && e2.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close(); }; } var rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80; var nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20; function xt(t, e2, s, i = s) { const r = rt(t ?? R); return K(e2, r - s.length, { hard: true, trim: false }).split(` `).map((n, u) => `${u === 0 ? i : s}${n}`).join(` `); } var x = class { input; output; _abortSignal; rl; opts; _render; _track = false; _prevFrame = ""; _subscribers = /* @__PURE__ */ new Map(); _cursor = 0; state = "initial"; error = ""; value; userInput = ""; constructor(e2, s = true) { const { input: i = q, output: r = R, render: n, signal: u, ...a } = e2; this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r; } unsubscribe() { this._subscribers.clear(); } setSubscriber(e2, s) { const i = this._subscribers.get(e2) ?? []; i.push(s), this._subscribers.set(e2, i); } on(e2, s) { this.setSubscriber(e2, { cb: s }); } once(e2, s) { this.setSubscriber(e2, { cb: s, once: true }); } emit(e2, ...s) { const i = this._subscribers.get(e2) ?? [], r = []; for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1)); for (const n of r) n(); } prompt() { return new Promise((e2) => { if (this._abortSignal) { if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e2(z); this._abortSignal.addEventListener("abort", () => { this.state = "cancel", this.close(); }, { once: true }); } this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => { this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e2(this.value); }), this.once("cancel", () => { this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e2(z); }); }); } _isActionKey(e2, s) { return e2 === " "; } _setValue(e2) { this.value = e2, this.emit("value", this.value); } _setUserInput(e2, s) { this.userInput = e2 ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor); } _clearUserInput() { this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput(""); } onKeypress(e2, s) { if (this._track && s.name !== "return" && (s.name && this._isActionKey(e2, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e2 && (e2.toLowerCase() === "y" || e2.toLowerCase() === "n") && this.emit("confirm", e2.toLowerCase() === "y"), this.emit("key", e2?.toLowerCase(), s), s?.name === "return") { if (this.opts.validate) { const i = this.opts.validate(this.value); i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput)); } this.state !== "error" && (this.state = "submit"); } H([e2, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close(); } close() { this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(` `), T(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe(); } restoreCursor() { const e2 = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(` `).length - 1; this.output.write(import_sisteransi.cursor.move(-999, e2 * -1)); } render() { const e2 = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false }); if (e2 !== this._prevFrame) { if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide); else { const s = _t(this._prevFrame, e2), i = nt(this.output); if (this.restoreCursor(), s) { const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i); let u = s.lines.find((a) => a >= r); if (u === void 0) { this._prevFrame = e2; return; } if (s.lines.length === 1) { this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1)); const a = e2.split(` `); this.output.write(a[u]), this._prevFrame = e2, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1)); return; } else if (s.lines.length > 1) { if (r < n) u = r; else { const l = u - n; l > 0 && this.output.write(import_sisteransi.cursor.move(0, l)); } this.output.write(import_sisteransi.erase.down()); const a = e2.split(` `).slice(u); this.output.write(a.join(` `)), this._prevFrame = e2; return; } } this.output.write(import_sisteransi.erase.down()); } this.output.write(e2), this.state === "initial" && (this.state = "active"), this._prevFrame = e2; } } }; function wt(t, e2) { if (t === void 0 || e2.length === 0) return 0; const s = e2.findIndex((i) => i.value === t); return s !== -1 ? s : 0; } function Dt(t, e2) { return (e2.label ?? String(e2.value)).toLowerCase().includes(t.toLowerCase()); } function St(t, e2) { if (e2) return t ? e2 : e2[0]; } var Vt = class extends x { filteredOptions; multiple; isNavigating = false; selectedValues = []; focusedValue; #t = 0; #s = ""; #i; #e; get cursor() { return this.#t; } get userInputWithCursor() { if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_")); if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`; const e2 = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor); return `${e2}${import_picocolors.default.inverse(s)}${i.join("")}`; } get options() { return typeof this.#e == "function" ? this.#e() : this.#e; } constructor(e2) { super(e2), this.#e = e2.options; const s = this.options; this.filteredOptions = [...s], this.multiple = e2.multiple === true, this.#i = e2.filter ?? Dt; let i; if (e2.initialValue && Array.isArray(e2.initialValue) ? this.multiple ? i = e2.initialValue : i = e2.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) { const n = s.findIndex((u) => u.value === r); n !== -1 && (this.toggleSelected(r), this.#t = n); } this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r)); } _isActionKey(e2, s) { return e2 === " " || this.multiple && this.isNavigating && s.name === "space" && e2 !== void 0 && e2 !== ""; } #r(e2, s) { const i = s.name === "up", r = s.name === "down", n = s.name === "return"; i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false); } deselectAll() { this.selectedValues = []; } toggleSelected(e2) { this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e2) ? this.selectedValues = this.selectedValues.filter((s) => s !== e2) : this.selectedValues = [...this.selectedValues, e2] : this.selectedValues = [e2]); } #n(e2) { if (e2 !== this.#s) { this.#s = e2; const s = this.options; e2 ? this.filteredOptions = s.filter((n) => this.#i(e2, n)) : this.filteredOptions = [...s]; const i = wt(this.focusedValue, this.filteredOptions); this.#t = B(i, 0, this.filteredOptions); const r = this.filteredOptions[this.#t]; r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll()); } } }; var kt = class extends x { get cursor() { return this.value ? 0 : 1; } get _value() { return this.cursor === 0; } constructor(e2) { super(e2, false), this.value = !!e2.initialValue, this.on("userInput", () => { this.value = this._value; }), this.on("confirm", (s) => { this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close(); }), this.on("cursor", () => { this.value = !this.value; }); } }; var yt = class extends x { options; cursor = 0; #t; getGroupItems(e2) { return this.options.filter((s) => s.group === e2); } isGroupSelected(e2) { const s = this.getGroupItems(e2), i = this.value; return i === void 0 ? false : s.every((r) => i.includes(r.value)); } toggleValue() { const e2 = this.options[this.cursor]; if (this.value === void 0 && (this.value = []), e2.group === true) { const s = e2.value, i = this.getGroupItems(s); this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value)); } else { const s = this.value.includes(e2.value); this.value = s ? this.value.filter((i) => i !== e2.value) : [...this.value, e2.value]; } } constructor(e2) { super(e2, false); const { options: s } = e2; this.#t = e2.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => { switch (i) { case "left": case "up": { this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1; const r = this.options[this.cursor]?.group === true; !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1); break; } case "down": case "right": { this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1; const r = this.options[this.cursor]?.group === true; !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1); break; } case "space": this.toggleValue(); break; } }); } }; var Lt = class extends x { options; cursor = 0; get _value() { return this.options[this.cursor].value; } get _enabledOptions() { return this.options.filter((e2) => e2.disabled !== true); } toggleAll() { const e2 = this._enabledOptions, s = this.value !== void 0 && this.value.length === e2.length; this.value = s ? [] : e2.map((i) => i.value); } toggleInvert() { const e2 = this.value; if (!e2) return; const s = this._enabledOptions.filter((i) => !e2.includes(i.value)); this.value = s.map((i) => i.value); } toggleValue() { this.value === void 0 && (this.value = []); const e2 = this.value.includes(this._value); this.value = e2 ? this.value.filter((s) => s !== this._value) : [...this.value, this._value]; } constructor(e2) { super(e2, false), this.options = e2.options, this.value = [...e2.initialValues ?? []]; const s = Math.max(this.options.findIndex(({ value: i }) => i === e2.cursorAt), 0); this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => { i === "a" && this.toggleAll(), i === "i" && this.toggleInvert(); }), this.on("cursor", (i) => { switch (i) { case "left": case "up": this.cursor = B(this.cursor, -1, this.options); break; case "down": case "right": this.cursor = B(this.cursor, 1, this.options); break; case "space": this.toggleValue(); break; } }); } }; var Mt = class extends x { _mask = "\u2022"; get cursor() { return this._cursor; } get masked() { return this.userInput.replaceAll(/./g, this._mask); } get userInputWithCursor() { if (this.state === "submit" || this.state === "cancel") return this.masked; const e2 = this.userInput; if (this.cursor >= e2.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`; const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor); return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`; } clear() { this._clearUserInput(); } constructor({ mask: e2, ...s }) { super(s), this._mask = e2 ?? "\u2022", this.on("userInput", (i) => { this._setValue(i); }); } }; var Wt = class extends x { options; cursor = 0; get _selectedValue() { return this.options[this.cursor]; } changeValue() { this.value = this._selectedValue.value; } constructor(e2) { super(e2, false), this.options = e2.options; const s = this.options.findIndex(({ value: r }) => r === e2.initialValue), i = s === -1 ? 0 : s; this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => { switch (r) { case "left": case "up": this.cursor = B(this.cursor, -1, this.options); break; case "down": case "right": this.cursor = B(this.cursor, 1, this.options); break; } this.changeValue(); }); } }; var Tt = class extends x { options; cursor = 0; constructor(e2) { super(e2, false), this.options = e2.options; const s = e2.caseSensitive === true, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase()); this.cursor = Math.max(i.indexOf(e2.initialValue), 0), this.on("key", (r, n) => { if (!r) return; const u = s && n.shift ? r.toUpperCase() : r; if (!i.includes(u)) return; const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r); a && (this.value = a.value, this.state = "submit", this.emit("submit")); }); } }; var $t = class extends x { get userInputWithCursor() { if (this.state === "submit") return this.userInput; const e2 = this.userInput; if (this.cursor >= e2.length) return `${this.userInput}\u2588`; const s = e2.slice(0, this.cursor), [i, ...r] = e2.slice(this.cursor); return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`; } get cursor() { return this._cursor; } constructor(e2) { super({ ...e2, initialUserInput: e2.initialUserInput ?? e2.initialValue }), this.on("userInput", (s) => { this._setValue(s); }), this.on("finalize", () => { this.value || (this.value = e2.defaultValue), this.value === void 0 && (this.value = ""); }); } }; // node_modules/@clack/prompts/dist/index.mjs var import_picocolors2 = __toESM(require_picocolors(), 1); var import_sisteransi2 = __toESM(require_src(), 1); import N2 from "process"; import { readdirSync as de, existsSync as $e, lstatSync as xt2 } from "fs"; import { dirname as _t2, join as he } from "path"; import { stripVTControlCharacters as ut } from "util"; function me() { return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm"; } var et2 = me(); var ct2 = () => process.env.CI === "true"; var Mt2 = (t) => t.isTTY === true; var C = (t, r) => et2 ? t : r; var Rt = C("\u25C6", "*"); var dt2 = C("\u25A0", "x"); var $t2 = C("\u25B2", "x"); var V = C("\u25C7", "o"); var ht2 = C("\u250C", "T"); var d = C("\u2502", "|"); var x2 = C("\u2514", "\u2014"); var Ot = C("\u2510", "T"); var Pt = C("\u2518", "\u2014"); var Q2 = C("\u25CF", ">"); var H2 = C("\u25CB", " "); var st2 = C("\u25FB", "[\u2022]"); var U2 = C("\u25FC", "[+]"); var q2 = C("\u25FB", "[ ]"); var Nt = C("\u25AA", "\u2022"); var rt2 = C("\u2500", "-"); var mt2 = C("\u256E", "+"); var Wt2 = C("\u251C", "+"); var pt2 = C("\u256F", "+"); var gt2 = C("\u2570", "+"); var Lt2 = C("\u256D", "+"); var ft2 = C("\u25CF", "\u2022"); var Ft2 = C("\u25C6", "*"); var yt2 = C("\u25B2", "!"); var Et2 = C("\u25A0", "x"); var W2 = (t) => { switch (t) { case "initial": case "active": return import_picocolors2.default.cyan(Rt); case "cancel": return import_picocolors2.default.red(dt2); case "error": return import_picocolors2.default.yellow($t2); case "submit": return import_picocolors2.default.green(V); } }; var vt2 = (t) => { switch (t) { case "initial": case "active": return import_picocolors2.default.cyan(d); case "cancel": return import_picocolors2.default.red(d); case "error": return import_picocolors2.default.yellow(d); case "submit": return import_picocolors2.default.green(d); } }; var pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109; var ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510; var fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141; var At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y; var it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y; var nt2 = /\t{1,1000}/y; var wt2 = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu"); var at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y; var Fe = new RegExp("\\p{M}+", "gu"); var ye = { limit: 1 / 0, ellipsis: "" }; var jt = (t, r = {}, s = {}) => { const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2; let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0; t: for (; ; ) { if (B2 > I2 || m >= h && m > $) { const _2 = t.slice(I2, B2) || t.slice($, m); y2 = 0; for (const D2 of _2.replaceAll(Fe, "")) { const T2 = D2.codePointAt(0) || 0; if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) { f = true; break t; } y2 += D2.length, A += w; } I2 = B2 = 0; } if (m >= h) break; if (at2.lastIndex = m, at2.test(t)) { if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) { f = true; break; } A += w, I2 = $, B2 = m, m = $ = at2.lastIndex; continue; } if (At2.lastIndex = m, At2.test(t)) { if (A + u > S2 && (v = Math.min(v, m)), A + u > i) { f = true; break; } A += u, I2 = $, B2 = m, m = $ = At2.lastIndex; continue; } if (it2.lastIndex = m, it2.test(t)) { if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) { f = true; break; } A += w, I2 = $, B2 = m, m = $ = it2.lastIndex; continue; } if (nt2.lastIndex = m, nt2.test(t)) { if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) { f = true; break; } A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex; continue; } if (wt2.lastIndex = m, wt2.test(t)) { if (A + g > S2 && (v = Math.min(v, m)), A + g > i) { f = true; break; } A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex; continue; } m += 1; } return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o }; }; var Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 }; var M2 = (t, r = {}) => jt(t, Ee, r).width; var ot2 = "\x1B"; var Gt = "\x9B"; var ve = 39; var Ct2 = "\x07"; var kt2 = "["; var Ae = "]"; var Vt2 = "m"; var St2 = `${Ae}8;;`; var Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y"); var we = (t) => { if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39; if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49; if (t === 1 || t === 2) return 22; if (t === 3) return 23; if (t === 4) return 24; if (t === 7) return 27; if (t === 8) return 28; if (t === 9) return 29; if (t === 0) return 0; }; var Ut = (t) => `${ot2}${kt2}${t}${Vt2}`; var Kt = (t) => `${ot2}${St2}${t}${Ct2}`; var Ce = (t) => t.map((r) => M2(r