storybook
Version:
Storybook framework-agnostic API
1,439 lines (1,409 loc) • 2.95 MB
JavaScript
import ESM_COMPAT_Module from "node:module";
import { fileURLToPath as ESM_COMPAT_fileURLToPath } from 'node:url';
import { dirname as ESM_COMPAT_dirname } from 'node:path';
const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
const __dirname = ESM_COMPAT_dirname(__filename);
const require = ESM_COMPAT_Module.createRequire(import.meta.url);
var dJ = Object.create;
var Lb = Object.defineProperty;
var pJ = Object.getOwnPropertyDescriptor;
var hJ = Object.getOwnPropertyNames;
var mJ = Object.getPrototypeOf, yJ = Object.prototype.hasOwnProperty;
var s = (e, t) => Lb(e, "name", { value: t, configurable: !0 }), V = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
"u" ? new Proxy(e, {
get: (t, r) => (typeof require < "u" ? require : t)[r]
}) : e)(function(e) {
if (typeof require < "u") return require.apply(this, arguments);
throw Error('Dynamic require of "' + e + '" is not supported');
});
var E = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
var gJ = (e, t, r, i) => {
if (t && typeof t == "object" || typeof t == "function")
for (let n of hJ(t))
!yJ.call(e, n) && n !== r && Lb(e, n, { get: () => t[n], enumerable: !(i = pJ(t, n)) || i.enumerable });
return e;
};
var Rt = (e, t, r) => (r = e != null ? dJ(mJ(e)) : {}, gJ(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
t || !e || !e.__esModule ? Lb(r, "default", { value: e, enumerable: !0 }) : r,
e
));
// ../node_modules/kleur/index.js
var sr = E((AYe, hF) => {
"use strict";
var { FORCE_COLOR: TJ, NODE_DISABLE_COLORS: CJ, TERM: wJ } = process.env, Ot = {
enabled: !CJ && wJ !== "dumb" && TJ !== "0",
// modifiers
reset: jt(0, 0),
bold: jt(1, 22),
dim: jt(2, 22),
italic: jt(3, 23),
underline: jt(4, 24),
inverse: jt(7, 27),
hidden: jt(8, 28),
strikethrough: jt(9, 29),
// colors
black: jt(30, 39),
red: jt(31, 39),
green: jt(32, 39),
yellow: jt(33, 39),
blue: jt(34, 39),
magenta: jt(35, 39),
cyan: jt(36, 39),
white: jt(37, 39),
gray: jt(90, 39),
grey: jt(90, 39),
// background colors
bgBlack: jt(40, 49),
bgRed: jt(41, 49),
bgGreen: jt(42, 49),
bgYellow: jt(43, 49),
bgBlue: jt(44, 49),
bgMagenta: jt(45, 49),
bgCyan: jt(46, 49),
bgWhite: jt(47, 49)
};
function pF(e, t) {
let r = 0, i, n = "", a = "";
for (; r < e.length; r++)
i = e[r], n += i.open, a += i.close, t.includes(i.close) && (t = t.replace(i.rgx, i.close + i.open));
return n + t + a;
}
s(pF, "run");
function AJ(e, t) {
let r = { has: e, keys: t };
return r.reset = Ot.reset.bind(r), r.bold = Ot.bold.bind(r), r.dim = Ot.dim.bind(r), r.italic = Ot.italic.bind(r), r.underline = Ot.underline.
bind(r), r.inverse = Ot.inverse.bind(r), r.hidden = Ot.hidden.bind(r), r.strikethrough = Ot.strikethrough.bind(r), r.black = Ot.black.bind(
r), r.red = Ot.red.bind(r), r.green = Ot.green.bind(r), r.yellow = Ot.yellow.bind(r), r.blue = Ot.blue.bind(r), r.magenta = Ot.magenta.bind(
r), r.cyan = Ot.cyan.bind(r), r.white = Ot.white.bind(r), r.gray = Ot.gray.bind(r), r.grey = Ot.grey.bind(r), r.bgBlack = Ot.bgBlack.bind(
r), r.bgRed = Ot.bgRed.bind(r), r.bgGreen = Ot.bgGreen.bind(r), r.bgYellow = Ot.bgYellow.bind(r), r.bgBlue = Ot.bgBlue.bind(r), r.bgMagenta =
Ot.bgMagenta.bind(r), r.bgCyan = Ot.bgCyan.bind(r), r.bgWhite = Ot.bgWhite.bind(r), r;
}
s(AJ, "chain");
function jt(e, t) {
let r = {
open: `\x1B[${e}m`,
close: `\x1B[${t}m`,
rgx: new RegExp(`\\x1b\\[${t}m`, "g")
};
return function(i) {
return this !== void 0 && this.has !== void 0 ? (this.has.includes(e) || (this.has.push(e), this.keys.push(r)), i === void 0 ? this : Ot.
enabled ? pF(this.keys, i + "") : i + "") : i === void 0 ? AJ([e], [r]) : Ot.enabled ? pF([r], i + "") : i + "";
};
}
s(jt, "init");
hF.exports = Ot;
});
// ../node_modules/prompts/dist/util/action.js
var yF = E((PYe, mF) => {
"use strict";
mF.exports = (e, t) => {
if (!(e.meta && e.name !== "escape")) {
if (e.ctrl) {
if (e.name === "a") return "first";
if (e.name === "c" || e.name === "d") return "abort";
if (e.name === "e") return "last";
if (e.name === "g") return "reset";
}
if (t) {
if (e.name === "j") return "down";
if (e.name === "k") return "up";
}
return e.name === "return" || e.name === "enter" ? "submit" : e.name === "backspace" ? "delete" : e.name === "delete" ? "deleteForward" :
e.name === "abort" ? "abort" : e.name === "escape" ? "exit" : e.name === "tab" ? "next" : e.name === "pagedown" ? "nextPage" : e.name ===
"pageup" ? "prevPage" : e.name === "home" ? "home" : e.name === "end" ? "end" : e.name === "up" ? "up" : e.name === "down" ? "down" : e.
name === "right" ? "right" : e.name === "left" ? "left" : !1;
}
};
});
// ../node_modules/prompts/dist/util/strip.js
var zp = E((FYe, gF) => {
"use strict";
gF.exports = (e) => {
let t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"), r = new RegExp(t, "g");
return typeof e == "string" ? e.replace(r, "") : e;
};
});
// ../node_modules/sisteransi/src/index.js
var or = E((IYe, bF) => {
"use strict";
var Hb = "\x1B", ar = `${Hb}[`, _J = "\x07", Kb = {
to(e, t) {
return t ? `${ar}${t + 1};${e + 1}H` : `${ar}${e + 1}G`;
},
move(e, t) {
let r = "";
return e < 0 ? r += `${ar}${-e}D` : e > 0 && (r += `${ar}${e}C`), t < 0 ? r += `${ar}${-t}A` : t > 0 && (r += `${ar}${t}B`), r;
},
up: /* @__PURE__ */ s((e = 1) => `${ar}${e}A`, "up"),
down: /* @__PURE__ */ s((e = 1) => `${ar}${e}B`, "down"),
forward: /* @__PURE__ */ s((e = 1) => `${ar}${e}C`, "forward"),
backward: /* @__PURE__ */ s((e = 1) => `${ar}${e}D`, "backward"),
nextLine: /* @__PURE__ */ s((e = 1) => `${ar}E`.repeat(e), "nextLine"),
prevLine: /* @__PURE__ */ s((e = 1) => `${ar}F`.repeat(e), "prevLine"),
left: `${ar}G`,
hide: `${ar}?25l`,
show: `${ar}?25h`,
save: `${Hb}7`,
restore: `${Hb}8`
}, PJ = {
up: /* @__PURE__ */ s((e = 1) => `${ar}S`.repeat(e), "up"),
down: /* @__PURE__ */ s((e = 1) => `${ar}T`.repeat(e), "down")
}, FJ = {
screen: `${ar}2J`,
up: /* @__PURE__ */ s((e = 1) => `${ar}1J`.repeat(e), "up"),
down: /* @__PURE__ */ s((e = 1) => `${ar}J`.repeat(e), "down"),
line: `${ar}2K`,
lineEnd: `${ar}K`,
lineStart: `${ar}1K`,
lines(e) {
let t = "";
for (let r = 0; r < e; r++)
t += this.line + (r < e - 1 ? Kb.up() : "");
return e && (t += Kb.left), t;
}
};
bF.exports = { cursor: Kb, scroll: PJ, erase: FJ, beep: _J };
});
// ../node_modules/prompts/dist/util/clear.js
var SF = E((kYe, xF) => {
"use strict";
function IJ(e, t) {
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
if (!r) {
if (Array.isArray(e) || (r = OJ(e)) || t && e && typeof e.length == "number") {
r && (e = r);
var i = 0, n = /* @__PURE__ */ s(function() {
}, "F");
return { s: n, n: /* @__PURE__ */ s(function() {
return i >= e.length ? { done: !0 } : { done: !1, value: e[i++] };
}, "n"), e: /* @__PURE__ */ s(function(c) {
throw c;
}, "e"), f: n };
}
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var a = !0, o = !1, u;
return { s: /* @__PURE__ */ s(function() {
r = r.call(e);
}, "s"), n: /* @__PURE__ */ s(function() {
var c = r.next();
return a = c.done, c;
}, "n"), e: /* @__PURE__ */ s(function(c) {
o = !0, u = c;
}, "e"), f: /* @__PURE__ */ s(function() {
try {
!a && r.return != null && r.return();
} finally {
if (o) throw u;
}
}, "f") };
}
s(IJ, "_createForOfIteratorHelper");
function OJ(e, t) {
if (e) {
if (typeof e == "string") return DF(e, t);
var r = Object.prototype.toString.call(e).slice(8, -1);
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return DF(e, t);
}
}
s(OJ, "_unsupportedIterableToArray");
function DF(e, t) {
(t == null || t > e.length) && (t = e.length);
for (var r = 0, i = new Array(t); r < t; r++) i[r] = e[r];
return i;
}
s(DF, "_arrayLikeToArray");
var kJ = zp(), EF = or(), vF = EF.erase, BJ = EF.cursor, NJ = /* @__PURE__ */ s((e) => [...kJ(e)].length, "width");
xF.exports = function(e, t) {
if (!t) return vF.line + BJ.to(0);
let r = 0, i = e.split(/\r?\n/);
var n = IJ(i), a;
try {
for (n.s(); !(a = n.n()).done; ) {
let o = a.value;
r += 1 + Math.floor(Math.max(NJ(o) - 1, 0) / t);
}
} catch (o) {
n.e(o);
} finally {
n.f();
}
return vF.lines(r);
};
});
// ../node_modules/prompts/dist/util/figures.js
var zb = E((NYe, TF) => {
"use strict";
var Lc = {
arrowUp: "\u2191",
arrowDown: "\u2193",
arrowLeft: "\u2190",
arrowRight: "\u2192",
radioOn: "\u25C9",
radioOff: "\u25EF",
tick: "\u2714",
cross: "\u2716",
ellipsis: "\u2026",
pointerSmall: "\u203A",
line: "\u2500",
pointer: "\u276F"
}, MJ = {
arrowUp: Lc.arrowUp,
arrowDown: Lc.arrowDown,
arrowLeft: Lc.arrowLeft,
arrowRight: Lc.arrowRight,
radioOn: "(*)",
radioOff: "( )",
tick: "\u221A",
cross: "\xD7",
ellipsis: "...",
pointerSmall: "\xBB",
line: "\u2500",
pointer: ">"
}, RJ = process.platform === "win32" ? MJ : Lc;
TF.exports = RJ;
});
// ../node_modules/prompts/dist/util/style.js
var wF = E((MYe, CF) => {
"use strict";
var $u = sr(), go = zb(), Gb = Object.freeze({
password: {
scale: 1,
render: /* @__PURE__ */ s((e) => "*".repeat(e.length), "render")
},
emoji: {
scale: 2,
render: /* @__PURE__ */ s((e) => "\u{1F603}".repeat(e.length), "render")
},
invisible: {
scale: 0,
render: /* @__PURE__ */ s((e) => "", "render")
},
default: {
scale: 1,
render: /* @__PURE__ */ s((e) => `${e}`, "render")
}
}), jJ = /* @__PURE__ */ s((e) => Gb[e] || Gb.default, "render"), qc = Object.freeze({
aborted: $u.red(go.cross),
done: $u.green(go.tick),
exited: $u.yellow(go.cross),
default: $u.cyan("?")
}), LJ = /* @__PURE__ */ s((e, t, r) => t ? qc.aborted : r ? qc.exited : e ? qc.done : qc.default, "symbol"), qJ = /* @__PURE__ */ s((e) => $u.
gray(e ? go.ellipsis : go.pointerSmall), "delimiter"), UJ = /* @__PURE__ */ s((e, t) => $u.gray(e ? t ? go.pointerSmall : "+" : go.line), "\
item");
CF.exports = {
styles: Gb,
render: jJ,
symbols: qc,
symbol: LJ,
delimiter: qJ,
item: UJ
};
});
// ../node_modules/prompts/dist/util/lines.js
var _F = E((jYe, AF) => {
"use strict";
var WJ = zp();
AF.exports = function(e, t) {
let r = String(WJ(e) || "").split(/\r?\n/);
return t ? r.map((i) => Math.ceil(i.length / t)).reduce((i, n) => i + n) : r.length;
};
});
// ../node_modules/prompts/dist/util/wrap.js
var FF = E((LYe, PF) => {
"use strict";
PF.exports = (e, t = {}) => {
let r = Number.isSafeInteger(parseInt(t.margin)) ? new Array(parseInt(t.margin)).fill(" ").join("") : t.margin || "", i = t.width;
return (e || "").split(/\r?\n/g).map((n) => n.split(/\s+/g).reduce((a, o) => (o.length + r.length >= i || a[a.length - 1].length + o.length +
1 < i ? a[a.length - 1] += ` ${o}` : a.push(`${r}${o}`), a), [r]).join(`
`)).join(`
`);
};
});
// ../node_modules/prompts/dist/util/entriesToDisplay.js
var OF = E((qYe, IF) => {
"use strict";
IF.exports = (e, t, r) => {
r = r || t;
let i = Math.min(t - r, e - Math.floor(r / 2));
i < 0 && (i = 0);
let n = Math.min(i + r, t);
return {
startIndex: i,
endIndex: n
};
};
});
// ../node_modules/prompts/dist/util/index.js
var bn = E((UYe, kF) => {
"use strict";
kF.exports = {
action: yF(),
clear: SF(),
style: wF(),
strip: zp(),
figures: zb(),
lines: _F(),
wrap: FF(),
entriesToDisplay: OF()
};
});
// ../node_modules/prompts/dist/elements/prompt.js
var ys = E((WYe, MF) => {
"use strict";
var BF = V("readline"), $J = bn(), VJ = $J.action, HJ = V("events"), NF = or(), KJ = NF.beep, zJ = NF.cursor, GJ = sr(), Jb = class extends HJ {
static {
s(this, "Prompt");
}
constructor(t = {}) {
super(), this.firstRender = !0, this.in = t.stdin || process.stdin, this.out = t.stdout || process.stdout, this.onRender = (t.onRender ||
(() => {
})).bind(this);
let r = BF.createInterface({
input: this.in,
escapeCodeTimeout: 50
});
BF.emitKeypressEvents(this.in, r), this.in.isTTY && this.in.setRawMode(!0);
let i = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1, n = /* @__PURE__ */ s((a, o) => {
let u = VJ(o, i);
u === !1 ? this._ && this._(a, o) : typeof this[u] == "function" ? this[u](o) : this.bell();
}, "keypress");
this.close = () => {
this.out.write(zJ.show), this.in.removeListener("keypress", n), this.in.isTTY && this.in.setRawMode(!1), r.close(), this.emit(this.aborted ?
"abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0;
}, this.in.on("keypress", n);
}
fire() {
this.emit("state", {
value: this.value,
aborted: !!this.aborted,
exited: !!this.exited
});
}
bell() {
this.out.write(KJ);
}
render() {
this.onRender(GJ), this.firstRender && (this.firstRender = !1);
}
};
MF.exports = Jb;
});
// ../node_modules/prompts/dist/elements/text.js
var UF = E((VYe, qF) => {
"use strict";
function RF(e, t, r, i, n, a, o) {
try {
var u = e[a](o), l = u.value;
} catch (c) {
r(c);
return;
}
u.done ? t(l) : Promise.resolve(l).then(i, n);
}
s(RF, "asyncGeneratorStep");
function jF(e) {
return function() {
var t = this, r = arguments;
return new Promise(function(i, n) {
var a = e.apply(t, r);
function o(l) {
RF(a, i, n, o, u, "next", l);
}
s(o, "_next");
function u(l) {
RF(a, i, n, o, u, "throw", l);
}
s(u, "_throw"), o(void 0);
});
};
}
s(jF, "_asyncToGenerator");
var Gp = sr(), JJ = ys(), LF = or(), XJ = LF.erase, Uc = LF.cursor, Jp = bn(), Xb = Jp.style, Yb = Jp.clear, YJ = Jp.lines, ZJ = Jp.figures,
Zb = class extends JJ {
static {
s(this, "TextPrompt");
}
constructor(t = {}) {
super(t), this.transform = Xb.render(t.style), this.scale = this.transform.scale, this.msg = t.message, this.initial = t.initial || "",
this.validator = t.validate || (() => !0), this.value = "", this.errorMsg = t.error || "Please Enter A Valid Value", this.cursor = +!!this.
initial, this.cursorOffset = 0, this.clear = Yb("", this.out.columns), this.render();
}
set value(t) {
!t && this.initial ? (this.placeholder = !0, this.rendered = Gp.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.
rendered = this.transform.render(t)), this._value = t, this.fire();
}
get value() {
return this._value;
}
reset() {
this.value = "", this.cursor = +!!this.initial, this.cursorOffset = 0, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.value = this.value || this.initial, this.done = this.aborted = !0, this.error = !1, this.red = !1, this.fire(), this.render(), this.
out.write(`
`), this.close();
}
validate() {
var t = this;
return jF(function* () {
let r = yield t.validator(t.value);
typeof r == "string" && (t.errorMsg = r, r = !1), t.error = !r;
})();
}
submit() {
var t = this;
return jF(function* () {
if (t.value = t.value || t.initial, t.cursorOffset = 0, t.cursor = t.rendered.length, yield t.validate(), t.error) {
t.red = !0, t.fire(), t.render();
return;
}
t.done = !0, t.aborted = !1, t.fire(), t.render(), t.out.write(`
`), t.close();
})();
}
next() {
if (!this.placeholder) return this.bell();
this.value = this.initial, this.cursor = this.rendered.length, this.fire(), this.render();
}
moveCursor(t) {
this.placeholder || (this.cursor = this.cursor + t, this.cursorOffset += t);
}
_(t, r) {
let i = this.value.slice(0, this.cursor), n = this.value.slice(this.cursor);
this.value = `${i}${t}${n}`, this.red = !1, this.cursor = this.placeholder ? 0 : i.length + 1, this.render();
}
delete() {
if (this.isCursorAtStart()) return this.bell();
let t = this.value.slice(0, this.cursor - 1), r = this.value.slice(this.cursor);
this.value = `${t}${r}`, this.red = !1, this.isCursorAtStart() ? this.cursorOffset = 0 : (this.cursorOffset++, this.moveCursor(-1)), this.
render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
let t = this.value.slice(0, this.cursor), r = this.value.slice(this.cursor + 1);
this.value = `${t}${r}`, this.red = !1, this.isCursorAtEnd() ? this.cursorOffset = 0 : this.cursorOffset++, this.render();
}
first() {
this.cursor = 0, this.render();
}
last() {
this.cursor = this.value.length, this.render();
}
left() {
if (this.cursor <= 0 || this.placeholder) return this.bell();
this.moveCursor(-1), this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
this.moveCursor(1), this.render();
}
isCursorAtStart() {
return this.cursor === 0 || this.placeholder && this.cursor === 1;
}
isCursorAtEnd() {
return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
}
render() {
this.closed || (this.firstRender || (this.outputError && this.out.write(Uc.down(YJ(this.outputError, this.out.columns) - 1) + Yb(this.
outputError, this.out.columns)), this.out.write(Yb(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText =
[Xb.symbol(this.done, this.aborted), Gp.bold(this.msg), Xb.delimiter(this.done), this.red ? Gp.red(this.rendered) : this.rendered].join(
" "), this.error && (this.outputError += this.errorMsg.split(`
`).reduce((t, r, i) => t + `
${i ? " " : ZJ.pointerSmall} ${Gp.red().italic(r)}`, "")), this.out.write(XJ.line + Uc.to(0) + this.outputText + Uc.save + this.outputError +
Uc.restore + Uc.move(this.cursorOffset, 0)));
}
};
qF.exports = Zb;
});
// ../node_modules/prompts/dist/elements/select.js
var HF = E((KYe, VF) => {
"use strict";
var gs = sr(), QJ = ys(), Wc = bn(), WF = Wc.style, $F = Wc.clear, Xp = Wc.figures, eX = Wc.wrap, tX = Wc.entriesToDisplay, rX = or(), iX = rX.
cursor, Qb = class extends QJ {
static {
s(this, "SelectPrompt");
}
constructor(t = {}) {
super(t), this.msg = t.message, this.hint = t.hint || "- Use arrow-keys. Return to submit.", this.warn = t.warn || "- This option is d\
isabled", this.cursor = t.initial || 0, this.choices = t.choices.map((r, i) => (typeof r == "string" && (r = {
title: r,
value: i
}), {
title: r && (r.title || r.value || r),
value: r && (r.value === void 0 ? i : r.value),
description: r && r.description,
selected: r && r.selected,
disabled: r && r.disabled
})), this.optionsPerPage = t.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = $F("", this.out.
columns), this.render();
}
moveCursor(t) {
this.cursor = t, this.value = this.choices[t].value, this.fire();
}
reset() {
this.moveCursor(0), this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.selection.disabled ? this.bell() : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
first() {
this.moveCursor(0), this.render();
}
last() {
this.moveCursor(this.choices.length - 1), this.render();
}
up() {
this.cursor === 0 ? this.moveCursor(this.choices.length - 1) : this.moveCursor(this.cursor - 1), this.render();
}
down() {
this.cursor === this.choices.length - 1 ? this.moveCursor(0) : this.moveCursor(this.cursor + 1), this.render();
}
next() {
this.moveCursor((this.cursor + 1) % this.choices.length), this.render();
}
_(t, r) {
if (t === " ") return this.submit();
}
get selection() {
return this.choices[this.cursor];
}
render() {
if (this.closed) return;
this.firstRender ? this.out.write(iX.hide) : this.out.write($F(this.outputText, this.out.columns)), super.render();
let t = tX(this.cursor, this.choices.length, this.optionsPerPage), r = t.startIndex, i = t.endIndex;
if (this.outputText = [WF.symbol(this.done, this.aborted), gs.bold(this.msg), WF.delimiter(!1), this.done ? this.selection.title : this.
selection.disabled ? gs.yellow(this.warn) : gs.gray(this.hint)].join(" "), !this.done) {
this.outputText += `
`;
for (let n = r; n < i; n++) {
let a, o, u = "", l = this.choices[n];
n === r && r > 0 ? o = Xp.arrowUp : n === i - 1 && i < this.choices.length ? o = Xp.arrowDown : o = " ", l.disabled ? (a = this.cursor ===
n ? gs.gray().underline(l.title) : gs.strikethrough().gray(l.title), o = (this.cursor === n ? gs.bold().gray(Xp.pointer) + " " : "\
") + o) : (a = this.cursor === n ? gs.cyan().underline(l.title) : l.title, o = (this.cursor === n ? gs.cyan(Xp.pointer) + " " : " ") + o,
l.description && this.cursor === n && (u = ` - ${l.description}`, (o.length + a.length + u.length >= this.out.columns || l.description.
split(/\r?\n/).length > 1) && (u = `
` + eX(l.description, {
margin: 3,
width: this.out.columns
})))), this.outputText += `${o} ${a}${gs.gray(u)}
`;
}
}
this.out.write(this.outputText);
}
};
VF.exports = Qb;
});
// ../node_modules/prompts/dist/elements/toggle.js
var YF = E((GYe, XF) => {
"use strict";
var Yp = sr(), nX = ys(), GF = bn(), KF = GF.style, sX = GF.clear, JF = or(), zF = JF.cursor, aX = JF.erase, eD = class extends nX {
static {
s(this, "TogglePrompt");
}
constructor(t = {}) {
super(t), this.msg = t.message, this.value = !!t.initial, this.active = t.active || "on", this.inactive = t.inactive || "off", this.initialValue =
this.value, this.render();
}
reset() {
this.value = this.initialValue, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
deactivate() {
if (this.value === !1) return this.bell();
this.value = !1, this.render();
}
activate() {
if (this.value === !0) return this.bell();
this.value = !0, this.render();
}
delete() {
this.deactivate();
}
left() {
this.deactivate();
}
right() {
this.activate();
}
down() {
this.deactivate();
}
up() {
this.activate();
}
next() {
this.value = !this.value, this.fire(), this.render();
}
_(t, r) {
if (t === " ")
this.value = !this.value;
else if (t === "1")
this.value = !0;
else if (t === "0")
this.value = !1;
else return this.bell();
this.render();
}
render() {
this.closed || (this.firstRender ? this.out.write(zF.hide) : this.out.write(sX(this.outputText, this.out.columns)), super.render(), this.
outputText = [KF.symbol(this.done, this.aborted), Yp.bold(this.msg), KF.delimiter(this.done), this.value ? this.inactive : Yp.cyan().underline(
this.inactive), Yp.gray("/"), this.value ? Yp.cyan().underline(this.active) : this.active].join(" "), this.out.write(aX.line + zF.to(0) +
this.outputText));
}
};
XF.exports = eD;
});
// ../node_modules/prompts/dist/dateparts/datepart.js
var jn = E((XYe, ZF) => {
"use strict";
var tD = class e {
static {
s(this, "DatePart");
}
constructor({
token: t,
date: r,
parts: i,
locales: n
}) {
this.token = t, this.date = r || /* @__PURE__ */ new Date(), this.parts = i || [this], this.locales = n || {};
}
up() {
}
down() {
}
next() {
let t = this.parts.indexOf(this);
return this.parts.find((r, i) => i > t && r instanceof e);
}
setTo(t) {
}
prev() {
let t = [].concat(this.parts).reverse(), r = t.indexOf(this);
return t.find((i, n) => n > r && i instanceof e);
}
toString() {
return String(this.date);
}
};
ZF.exports = tD;
});
// ../node_modules/prompts/dist/dateparts/meridiem.js
var eI = E((ZYe, QF) => {
"use strict";
var oX = jn(), rD = class extends oX {
static {
s(this, "Meridiem");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setHours((this.date.getHours() + 12) % 24);
}
down() {
this.up();
}
toString() {
let t = this.date.getHours() > 12 ? "pm" : "am";
return /\A/.test(this.token) ? t.toUpperCase() : t;
}
};
QF.exports = rD;
});
// ../node_modules/prompts/dist/dateparts/day.js
var rI = E((eZe, tI) => {
"use strict";
var uX = jn(), lX = /* @__PURE__ */ s((e) => (e = e % 10, e === 1 ? "st" : e === 2 ? "nd" : e === 3 ? "rd" : "th"), "pos"), iD = class extends uX {
static {
s(this, "Day");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setDate(this.date.getDate() + 1);
}
down() {
this.date.setDate(this.date.getDate() - 1);
}
setTo(t) {
this.date.setDate(parseInt(t.substr(-2)));
}
toString() {
let t = this.date.getDate(), r = this.date.getDay();
return this.token === "DD" ? String(t).padStart(2, "0") : this.token === "Do" ? t + lX(t) : this.token === "d" ? r + 1 : this.token ===
"ddd" ? this.locales.weekdaysShort[r] : this.token === "dddd" ? this.locales.weekdays[r] : t;
}
};
tI.exports = iD;
});
// ../node_modules/prompts/dist/dateparts/hours.js
var nI = E((rZe, iI) => {
"use strict";
var cX = jn(), nD = class extends cX {
static {
s(this, "Hours");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setHours(this.date.getHours() + 1);
}
down() {
this.date.setHours(this.date.getHours() - 1);
}
setTo(t) {
this.date.setHours(parseInt(t.substr(-2)));
}
toString() {
let t = this.date.getHours();
return /h/.test(this.token) && (t = t % 12 || 12), this.token.length > 1 ? String(t).padStart(2, "0") : t;
}
};
iI.exports = nD;
});
// ../node_modules/prompts/dist/dateparts/milliseconds.js
var aI = E((nZe, sI) => {
"use strict";
var fX = jn(), sD = class extends fX {
static {
s(this, "Milliseconds");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
}
down() {
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
}
setTo(t) {
this.date.setMilliseconds(parseInt(t.substr(-this.token.length)));
}
toString() {
return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
}
};
sI.exports = sD;
});
// ../node_modules/prompts/dist/dateparts/minutes.js
var uI = E((aZe, oI) => {
"use strict";
var dX = jn(), aD = class extends dX {
static {
s(this, "Minutes");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setMinutes(this.date.getMinutes() + 1);
}
down() {
this.date.setMinutes(this.date.getMinutes() - 1);
}
setTo(t) {
this.date.setMinutes(parseInt(t.substr(-2)));
}
toString() {
let t = this.date.getMinutes();
return this.token.length > 1 ? String(t).padStart(2, "0") : t;
}
};
oI.exports = aD;
});
// ../node_modules/prompts/dist/dateparts/month.js
var cI = E((uZe, lI) => {
"use strict";
var pX = jn(), oD = class extends pX {
static {
s(this, "Month");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setMonth(this.date.getMonth() + 1);
}
down() {
this.date.setMonth(this.date.getMonth() - 1);
}
setTo(t) {
t = parseInt(t.substr(-2)) - 1, this.date.setMonth(t < 0 ? 0 : t);
}
toString() {
let t = this.date.getMonth(), r = this.token.length;
return r === 2 ? String(t + 1).padStart(2, "0") : r === 3 ? this.locales.monthsShort[t] : r === 4 ? this.locales.months[t] : String(t +
1);
}
};
lI.exports = oD;
});
// ../node_modules/prompts/dist/dateparts/seconds.js
var dI = E((cZe, fI) => {
"use strict";
var hX = jn(), uD = class extends hX {
static {
s(this, "Seconds");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setSeconds(this.date.getSeconds() + 1);
}
down() {
this.date.setSeconds(this.date.getSeconds() - 1);
}
setTo(t) {
this.date.setSeconds(parseInt(t.substr(-2)));
}
toString() {
let t = this.date.getSeconds();
return this.token.length > 1 ? String(t).padStart(2, "0") : t;
}
};
fI.exports = uD;
});
// ../node_modules/prompts/dist/dateparts/year.js
var hI = E((dZe, pI) => {
"use strict";
var mX = jn(), lD = class extends mX {
static {
s(this, "Year");
}
constructor(t = {}) {
super(t);
}
up() {
this.date.setFullYear(this.date.getFullYear() + 1);
}
down() {
this.date.setFullYear(this.date.getFullYear() - 1);
}
setTo(t) {
this.date.setFullYear(t.substr(-4));
}
toString() {
let t = String(this.date.getFullYear()).padStart(4, "0");
return this.token.length === 2 ? t.substr(-2) : t;
}
};
pI.exports = lD;
});
// ../node_modules/prompts/dist/dateparts/index.js
var yI = E((hZe, mI) => {
"use strict";
mI.exports = {
DatePart: jn(),
Meridiem: eI(),
Day: rI(),
Hours: nI(),
Milliseconds: aI(),
Minutes: uI(),
Month: cI(),
Seconds: dI(),
Year: hI()
};
});
// ../node_modules/prompts/dist/elements/date.js
var wI = E((mZe, CI) => {
"use strict";
function gI(e, t, r, i, n, a, o) {
try {
var u = e[a](o), l = u.value;
} catch (c) {
r(c);
return;
}
u.done ? t(l) : Promise.resolve(l).then(i, n);
}
s(gI, "asyncGeneratorStep");
function bI(e) {
return function() {
var t = this, r = arguments;
return new Promise(function(i, n) {
var a = e.apply(t, r);
function o(l) {
gI(a, i, n, o, u, "next", l);
}
s(o, "_next");
function u(l) {
gI(a, i, n, o, u, "throw", l);
}
s(u, "_throw"), o(void 0);
});
};
}
s(bI, "_asyncToGenerator");
var cD = sr(), yX = ys(), dD = bn(), DI = dD.style, vI = dD.clear, gX = dD.figures, TI = or(), bX = TI.erase, EI = TI.cursor, bs = yI(), xI = bs.
DatePart, DX = bs.Meridiem, vX = bs.Day, EX = bs.Hours, xX = bs.Milliseconds, SX = bs.Minutes, TX = bs.Month, CX = bs.Seconds, wX = bs.Year,
AX = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g, SI = {
1: ({
token: e
}) => e.replace(/\\(.)/g, "$1"),
2: (e) => new vX(e),
// Day // TODO
3: (e) => new TX(e),
// Month
4: (e) => new wX(e),
// Year
5: (e) => new DX(e),
// AM/PM // TODO (special)
6: (e) => new EX(e),
// Hours
7: (e) => new SX(e),
// Minutes
8: (e) => new CX(e),
// Seconds
9: (e) => new xX(e)
// Fractional seconds
}, _X = {
months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
}, fD = class extends yX {
static {
s(this, "DatePrompt");
}
constructor(t = {}) {
super(t), this.msg = t.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(_X, t.locales), this._date = t.initial ||
/* @__PURE__ */ new Date(), this.errorMsg = t.error || "Please Enter A Valid Value", this.validator = t.validate || (() => !0), this.mask =
t.mask || "YYYY-MM-DD HH:mm:ss", this.clear = vI("", this.out.columns), this.render();
}
get value() {
return this.date;
}
get date() {
return this._date;
}
set date(t) {
t && this._date.setTime(t.getTime());
}
set mask(t) {
let r;
for (this.parts = []; r = AX.exec(t); ) {
let n = r.shift(), a = r.findIndex((o) => o != null);
this.parts.push(a in SI ? SI[a]({
token: r[a] || n,
date: this.date,
parts: this.parts,
locales: this.locales
}) : r[a] || n);
}
let i = this.parts.reduce((n, a) => (typeof a == "string" && typeof n[n.length - 1] == "string" ? n[n.length - 1] += a : n.push(a), n),
[]);
this.parts.splice(0), this.parts.push(...i), this.reset();
}
moveCursor(t) {
this.typed = "", this.cursor = t, this.fire();
}
reset() {
this.moveCursor(this.parts.findIndex((t) => t instanceof xI)), this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
validate() {
var t = this;
return bI(function* () {
let r = yield t.validator(t.value);
typeof r == "string" && (t.errorMsg = r, r = !1), t.error = !r;
})();
}
submit() {
var t = this;
return bI(function* () {
if (yield t.validate(), t.error) {
t.color = "red", t.fire(), t.render();
return;
}
t.done = !0, t.aborted = !1, t.fire(), t.render(), t.out.write(`
`), t.close();
})();
}
up() {
this.typed = "", this.parts[this.cursor].up(), this.render();
}
down() {
this.typed = "", this.parts[this.cursor].down(), this.render();
}
left() {
let t = this.parts[this.cursor].prev();
if (t == null) return this.bell();
this.moveCursor(this.parts.indexOf(t)), this.render();
}
right() {
let t = this.parts[this.cursor].next();
if (t == null) return this.bell();
this.moveCursor(this.parts.indexOf(t)), this.render();
}
next() {
let t = this.parts[this.cursor].next();
this.moveCursor(t ? this.parts.indexOf(t) : this.parts.findIndex((r) => r instanceof xI)), this.render();
}
_(t) {
/\d/.test(t) && (this.typed += t, this.parts[this.cursor].setTo(this.typed), this.render());
}
render() {
this.closed || (this.firstRender ? this.out.write(EI.hide) : this.out.write(vI(this.outputText, this.out.columns)), super.render(), this.
outputText = [DI.symbol(this.done, this.aborted), cD.bold(this.msg), DI.delimiter(!1), this.parts.reduce((t, r, i) => t.concat(i === this.
cursor && !this.done ? cD.cyan().underline(r.toString()) : r), []).join("")].join(" "), this.error && (this.outputText += this.errorMsg.
split(`
`).reduce((t, r, i) => t + `
${i ? " " : gX.pointerSmall} ${cD.red().italic(r)}`, "")), this.out.write(bX.line + EI.to(0) + this.outputText));
}
};
CI.exports = fD;
});
// ../node_modules/prompts/dist/elements/number.js
var kI = E((gZe, OI) => {
"use strict";
function AI(e, t, r, i, n, a, o) {
try {
var u = e[a](o), l = u.value;
} catch (c) {
r(c);
return;
}
u.done ? t(l) : Promise.resolve(l).then(i, n);
}
s(AI, "asyncGeneratorStep");
function _I(e) {
return function() {
var t = this, r = arguments;
return new Promise(function(i, n) {
var a = e.apply(t, r);
function o(l) {
AI(a, i, n, o, u, "next", l);
}
s(o, "_next");
function u(l) {
AI(a, i, n, o, u, "throw", l);
}
s(u, "_throw"), o(void 0);
});
};
}
s(_I, "_asyncToGenerator");
var Zp = sr(), PX = ys(), II = or(), Qp = II.cursor, FX = II.erase, eh = bn(), pD = eh.style, IX = eh.figures, PI = eh.clear, OX = eh.lines,
kX = /[0-9]/, hD = /* @__PURE__ */ s((e) => e !== void 0, "isDef"), FI = /* @__PURE__ */ s((e, t) => {
let r = Math.pow(10, t);
return Math.round(e * r) / r;
}, "round"), mD = class extends PX {
static {
s(this, "NumberPrompt");
}
constructor(t = {}) {
super(t), this.transform = pD.render(t.style), this.msg = t.message, this.initial = hD(t.initial) ? t.initial : "", this.float = !!t.float,
this.round = t.round || 2, this.inc = t.increment || 1, this.min = hD(t.min) ? t.min : -1 / 0, this.max = hD(t.max) ? t.max : 1 / 0, this.
errorMsg = t.error || "Please Enter A Valid Value", this.validator = t.validate || (() => !0), this.color = "cyan", this.value = "", this.
typed = "", this.lastHit = 0, this.render();
}
set value(t) {
!t && t !== 0 ? (this.placeholder = !0, this.rendered = Zp.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder =
!1, this.rendered = this.transform.render(`${FI(t, this.round)}`), this._value = FI(t, this.round)), this.fire();
}
get value() {
return this._value;
}
parse(t) {
return this.float ? parseFloat(t) : parseInt(t);
}
valid(t) {
return t === "-" || t === "." && this.float || kX.test(t);
}
reset() {
this.typed = "", this.value = "", this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
let t = this.value;
this.value = t !== "" ? t : this.initial, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`\
`), this.close();
}
validate() {
var t = this;
return _I(function* () {
let r = yield t.validator(t.value);
typeof r == "string" && (t.errorMsg = r, r = !1), t.error = !r;
})();
}
submit() {
var t = this;
return _I(function* () {
if (yield t.validate(), t.error) {
t.color = "red", t.fire(), t.render();
return;
}
let r = t.value;
t.value = r !== "" ? r : t.initial, t.done = !0, t.aborted = !1, t.error = !1, t.fire(), t.render(), t.out.write(`
`), t.close();
})();
}
up() {
if (this.typed = "", this.value === "" && (this.value = this.min - this.inc), this.value >= this.max) return this.bell();
this.value += this.inc, this.color = "cyan", this.fire(), this.render();
}
down() {
if (this.typed = "", this.value === "" && (this.value = this.min + this.inc), this.value <= this.min) return this.bell();
this.value -= this.inc, this.color = "cyan", this.fire(), this.render();
}
delete() {
let t = this.value.toString();
if (t.length === 0) return this.bell();
this.value = this.parse(t = t.slice(0, -1)) || "", this.value !== "" && this.value < this.min && (this.value = this.min), this.color =
"cyan", this.fire(), this.render();
}
next() {
this.value = this.initial, this.fire(), this.render();
}
_(t, r) {
if (!this.valid(t)) return this.bell();
let i = Date.now();
if (i - this.lastHit > 1e3 && (this.typed = ""), this.typed += t, this.lastHit = i, this.color = "cyan", t === ".") return this.fire();
this.value = Math.min(this.parse(this.typed), this.max), this.value > this.max && (this.value = this.max), this.value < this.min && (this.
value = this.min), this.fire(), this.render();
}
render() {
this.closed || (this.firstRender || (this.outputError && this.out.write(Qp.down(OX(this.outputError, this.out.columns) - 1) + PI(this.
outputError, this.out.columns)), this.out.write(PI(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText =
[pD.symbol(this.done, this.aborted), Zp.bold(this.msg), pD.delimiter(this.done), !this.done || !this.done && !this.placeholder ? Zp[this.
color]().underline(this.rendered) : this.rendered].join(" "), this.error && (this.outputError += this.errorMsg.split(`
`).reduce((t, r, i) => t + `
${i ? " " : IX.pointerSmall} ${Zp.red().italic(r)}`, "")), this.out.write(FX.line + Qp.to(0) + this.outputText + Qp.save + this.outputError +
Qp.restore));
}
};
OI.exports = mD;
});
// ../node_modules/prompts/dist/elements/multiselect.js
var gD = E((DZe, MI) => {
"use strict";
var Ln = sr(), BX = or(), NX = BX.cursor, MX = ys(), $c = bn(), BI = $c.clear, ma = $c.figures, NI = $c.style, RX = $c.wrap, jX = $c.entriesToDisplay,
yD = class extends MX {
static {
s(this, "MultiselectPrompt");
}
constructor(t = {}) {
super(t), this.msg = t.message, this.cursor = t.cursor || 0, this.scrollIndex = t.cursor || 0, this.hint = t.hint || "", this.warn = t.
warn || "- This option is disabled -", this.minSelected = t.min, this.showMinError = !1, this.maxChoices = t.max, this.instructions = t.
instructions, this.optionsPerPage = t.optionsPerPage || 10, this.value = t.choices.map((r, i) => (typeof r == "string" && (r = {
title: r,
value: i
}), {
title: r && (r.title || r.value || r),
description: r && r.description,
value: r && (r.value === void 0 ? i : r.value),
selected: r && r.selected,
disabled: r && r.disabled
})), this.clear = BI("", this.out.columns), t.overrideRender || this.render();
}
reset() {
this.value.map((t) => !t.selected), this.cursor = 0, this.fire(), this.render();
}
selected() {
return this.value.filter((t) => t.selected);
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
let t = this.value.filter((r) => r.selected);
this.minSelected && t.length < this.minSelected ? (this.showMinError = !0, this.render()) : (this.done = !0, this.aborted = !1, this.fire(),
this.render(), this.out.write(`
`), this.close());
}
first() {
this.cursor = 0, this.render();
}
last() {
this.cursor = this.value.length - 1, this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.value.length, this.render();
}
up() {
this.cursor === 0 ? this.cursor = this.value.length - 1 : this.cursor--, this.render();
}
down() {
this.cursor === this.value.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
}
left() {
this.value[this.cursor].selected = !1, this.render();
}
right() {
if (this.value.filter((t) => t.selected).length >= this.maxChoices) return this.bell();
this.value[this.cursor].selected = !0, this.render();
}
handleSpaceToggle() {
let t = this.value[this.cursor];
if (t.selected)
t.selected = !1, this.render();
else {
if (t.disabled || this.value.filter((r) => r.selected).length >= this.maxChoices)
return this.bell();
t.selected = !0, this.render();
}
}
toggleAll() {
if (this.maxChoices !== void 0 || this.value[this.cursor].disabled)
return this.bell();
let t = !this.value[this.cursor].selected;
this.value.filter((r) => !r.disabled).forEach((r) => r.selected = t), this.render();
}
_(t, r) {
if (t === " ")
this.handleSpaceToggle();
else if (t === "a")
this.toggleAll();
else
return this.bell();
}
renderInstructions() {
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
Instructions:
${ma.arrowUp}/${ma.arrowDown}: Highlight option
${ma.arrowLeft}/${ma.arrowRight}/[space]: Toggle selection
` + (this.maxChoices === void 0 ? ` a: Toggle all
` : "") + " enter/return: Complete answer" : "";
}
renderOption(t, r, i, n) {
let a = (r.selected ? Ln.green(ma.radioOn) : ma.radioOff) + " " + n + " ", o, u;
return r.disabled ? o = t === i ? Ln.gray().underline(r.title) : Ln.strikethrough().gray(r.title) : (o = t === i ? Ln.cyan().underline(
r.title) : r.title, t === i && r.description && (u = ` - ${r.description}`, (a.length + o.length + u.length >= this.out.columns || r.description.
split(/\r?\n/).length > 1) && (u = `
` + RX(r.description, {
margin: a.length,
width: this.out.columns
})))), a + o + Ln.gray(u || "");
}
// shared with autocompleteMultiselect
paginateOptions(t) {
if (t.length === 0)
return Ln.red("No matches for this query.");
let r = jX(this.cursor, t.length, this.optionsPerPage), i = r.startIndex, n = r.endIndex, a, o = [];
for (let u = i; u < n; u++)
u === i && i > 0 ? a = ma.arrowUp : u === n - 1 && n < t.length ? a = ma.arrowDown : a = " ", o.push(this.renderOption(this.cursor, t[u],
u, a));
return `
` + o.join(`
`);
}
// shared with autocomleteMultiselect
renderOptions(t) {
return this.done ? "" : this.paginateOptions(t);
}
renderDoneOrInstructions() {
if (this.done)
return this.value.filter((r) => r.selected).map((r) => r.title).join(", ");
let t = [Ln.gray(this.hint), this.renderInstructions()];
return this.value[this.cursor].disabled && t.push(Ln.yellow(this.warn)), t.join(" ");
}
render() {
if (this.closed) return;
this.firstRender && this.out.write(NX.hide), super.render();
let t = [NI.symbol(this.done, this.aborted), Ln.bold(this.msg), NI.delimiter(!1), this.renderDoneOrInstructions()].join(" ");
this.showMinError && (t += Ln.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), t += this.renderOptions(
this.value), this.out.write(this.clear + t), this.clear = BI(t, this.out.columns);
}
};
MI.exports = yD;
});
// ../node_modules/prompts/dist/elements/autocomplete.js
var $I = E((EZe, WI) => {
"use strict";
function RI(e, t, r, i, n, a, o) {
try {
var u = e[a](o), l = u.value;
} catch (c) {
r(c);
return;
}
u.done ? t(l) : Promise.resolve(l).then(i, n);
}
s(RI, "asyncGeneratorStep");
function LX(e) {
return function() {
var t = this, r = arguments;
return new Promise(function(i, n) {
var a = e.apply(t, r);
function o(l) {
RI(a, i, n, o, u, "next", l);
}
s(o, "_next");
function u(l) {
RI(a, i, n, o, u, "throw", l);
}
s(u, "_throw"), o(void 0);
});
};
}
s(LX, "_asyncToGenerator");
var Vc = sr(), qX = ys(), UI = or(), UX = UI.erase, jI = UI.cursor, Hc = bn(), bD = Hc.style, LI = Hc.clear, DD = Hc.figures, WX = Hc.wrap,
$X = Hc.entriesToDisplay, qI = /* @__PURE__ */ s((e, t) => e[t] && (e[t].value || e[t].title || e[t]), "getVal"), VX = /* @__PURE__ */ s((e, t) => e[t] &&
(e[t].title || e[t].value || e[t]), "getTitle"), HX = /* @__PURE__ */ s((e, t) => {
let r = e.findIndex((i) => i.value === t || i.title === t);
return r > -1 ? r : void 0;
}, "getIndex"), vD = class extends qX {
static {
s(this, "AutocompletePrompt");
}
constructor(t = {}) {
super(t), this.msg = t.message, this.suggest = t.suggest, this.choices = t.choices, this.initial = typeof t.initial == "number" ? t.initial :
HX(t.choices, t.initial), this.select = this.initial || t.cursor || 0, this.i18n = {
noMatches: t.noMatches || "no matches found"
}, this.fallback = t.fallback || this.initial, this.clearFirst = t.clearFirst || !1, this.suggestions = [], this.input = "", this.limit =
t.limit || 10, this.cursor = 0, this.transform = bD.render(t.style), this.scale = this.transform.scale, this.render = this.render.bind(
this), this.complete = this.complete.bind(this), this.clear = LI("", this.out.columns), this.complete(this.render), this.render();
}
set fallback(t) {
this._fb = Number.isSafeInteger(parseInt(t)) ? parseInt(t) : t;
}
get fallback() {
let t;
return typeof this._fb == "number" ? t = this.choices[this.