gh-issue-kit 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +224 -0
- package/dist/index.mjs +3338 -0
- package/dist/index.mjs.map +1 -0
- package/dist/template/en/bug_report_en.yml +64 -0
- package/dist/template/en/feature_request_en.yml +53 -0
- package/dist/template/ja/bug_report_ja.yml +66 -0
- package/dist/template/ja/feature_request_ja.yml +53 -0
- package/package.json +36 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3338 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command as e } from "commander";
|
|
3
|
+
import { copyFile as t, mkdir as n, readFile as r, unlink as i, writeFile as a } from "node:fs/promises";
|
|
4
|
+
import { existsSync as o, readFileSync as s, readdirSync as c, rmSync as l } from "node:fs";
|
|
5
|
+
import { basename as u, dirname as d, join as f, resolve as p } from "node:path";
|
|
6
|
+
import { fileURLToPath as m } from "node:url";
|
|
7
|
+
import h from "fast-glob";
|
|
8
|
+
import { stripVTControlCharacters as g, styleText as _ } from "node:util";
|
|
9
|
+
import v, { stdin as y, stdout as b } from "node:process";
|
|
10
|
+
import * as x from "node:readline";
|
|
11
|
+
import S from "node:readline";
|
|
12
|
+
import { ReadStream as ee } from "node:tty";
|
|
13
|
+
import { execFileSync as te, spawnSync as ne } from "node:child_process";
|
|
14
|
+
import { dirname as re, join as C } from "path";
|
|
15
|
+
import { randomInt as ie, randomUUID as ae } from "node:crypto";
|
|
16
|
+
import { tmpdir as oe } from "node:os";
|
|
17
|
+
import { fileURLToPath as se } from "url";
|
|
18
|
+
//#region \0rolldown/runtime.js
|
|
19
|
+
var ce = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), le = {
|
|
20
|
+
OPTION_SOME: "some",
|
|
21
|
+
OPTION_NONE: "none"
|
|
22
|
+
}, ue = (function() {
|
|
23
|
+
let { OPTION_SOME: e, OPTION_NONE: t } = le, n = (t) => Object.freeze({
|
|
24
|
+
kind: e,
|
|
25
|
+
isSome: !0,
|
|
26
|
+
isNone: !1,
|
|
27
|
+
value: t
|
|
28
|
+
}), r = () => Object.freeze({
|
|
29
|
+
kind: t,
|
|
30
|
+
isSome: !1,
|
|
31
|
+
isNone: !0
|
|
32
|
+
});
|
|
33
|
+
return Object.freeze({
|
|
34
|
+
createSome: n,
|
|
35
|
+
createNone: r,
|
|
36
|
+
optionConversion: (e) => e == null ? r() : n(e)
|
|
37
|
+
});
|
|
38
|
+
})(), de = {
|
|
39
|
+
RESULT_OK: "ok",
|
|
40
|
+
RESULT_NG: "ng"
|
|
41
|
+
}, fe = Symbol("UNIT_SYMBOL"), w = (function() {
|
|
42
|
+
let { RESULT_NG: e, RESULT_OK: t } = de, n = Object.freeze({ _unit: fe }), r = async ({ fn: e, err: t, finalFn: n = () => {} }) => {
|
|
43
|
+
try {
|
|
44
|
+
return s(await e());
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return t(e);
|
|
47
|
+
} finally {
|
|
48
|
+
n();
|
|
49
|
+
}
|
|
50
|
+
}, i = async ({ fn: e, err: t, finalFn: r = () => {} }) => {
|
|
51
|
+
try {
|
|
52
|
+
return await e(), s(n);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
return t(e);
|
|
55
|
+
} finally {
|
|
56
|
+
r();
|
|
57
|
+
}
|
|
58
|
+
}, a = ({ fn: e, err: t, finalFn: n = () => {} }) => {
|
|
59
|
+
try {
|
|
60
|
+
return s(e());
|
|
61
|
+
} catch (e) {
|
|
62
|
+
return t(e);
|
|
63
|
+
} finally {
|
|
64
|
+
n();
|
|
65
|
+
}
|
|
66
|
+
}, o = ({ fn: e, err: t, finalFn: r = () => {} }) => {
|
|
67
|
+
try {
|
|
68
|
+
return e(), s(n);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
return t(e);
|
|
71
|
+
} finally {
|
|
72
|
+
r();
|
|
73
|
+
}
|
|
74
|
+
}, s = (e) => Object.freeze({
|
|
75
|
+
kind: t,
|
|
76
|
+
isOk: !0,
|
|
77
|
+
isErr: !1,
|
|
78
|
+
value: e
|
|
79
|
+
});
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
UNIT: n,
|
|
82
|
+
checkResultReturn: a,
|
|
83
|
+
checkResultVoid: o,
|
|
84
|
+
checkPromiseReturn: r,
|
|
85
|
+
checkPromiseVoid: i,
|
|
86
|
+
createOk: s,
|
|
87
|
+
createNg: (t) => Object.freeze({
|
|
88
|
+
kind: e,
|
|
89
|
+
isOk: !1,
|
|
90
|
+
isErr: !0,
|
|
91
|
+
err: t
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
})(), pe = (e) => e, me = h.async;
|
|
95
|
+
async function he(e, r, { cwd: i, rename: a = pe, parents: o = !0 }) {
|
|
96
|
+
let { createNg: s, createOk: c, checkPromiseReturn: l } = w, m = typeof e == "string" ? [e] : e;
|
|
97
|
+
if (m.length === 0 || r === "") return s(/* @__PURE__ */ Error("src or dest is empty"));
|
|
98
|
+
let h = await l({
|
|
99
|
+
fn: () => me(m, {
|
|
100
|
+
cwd: i,
|
|
101
|
+
dot: !0,
|
|
102
|
+
absolute: !1,
|
|
103
|
+
stats: !1,
|
|
104
|
+
onlyFiles: !0
|
|
105
|
+
}),
|
|
106
|
+
err: () => s(/* @__PURE__ */ Error("Failed to glob source files"))
|
|
107
|
+
});
|
|
108
|
+
if (h.isErr) return h;
|
|
109
|
+
let g = i ? p(i, r) : r;
|
|
110
|
+
for (let e of h.value) {
|
|
111
|
+
let r = d(e), s = a(u(e)), c = i ? p(i, e) : e, l = o ? f(g, r, s) : f(g, s);
|
|
112
|
+
await n(d(l), { recursive: !0 }), await t(c, l);
|
|
113
|
+
}
|
|
114
|
+
return c(() => {});
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/shared/error.ts
|
|
118
|
+
function ge(e, t) {
|
|
119
|
+
return t instanceof Error ? /* @__PURE__ */ Error(`${e}: ${t.message}`) : /* @__PURE__ */ Error(`${e}: ${String(t)}`);
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
123
|
+
var _e = (() => {
|
|
124
|
+
let e = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
125
|
+
return (t) => {
|
|
126
|
+
let n = 0;
|
|
127
|
+
for (e.lastIndex = 0; e.test(t);) n += 1;
|
|
128
|
+
return t.length - n;
|
|
129
|
+
};
|
|
130
|
+
})(), ve = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ye = (e) => e === 8987 || e === 9001 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, be = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y, xe = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, Se = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy, Ce = /\t{1,1000}/y, we = /[\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?))*/uy, Te = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Ee = /\p{M}+/gu, De = {
|
|
131
|
+
limit: Infinity,
|
|
132
|
+
ellipsis: ""
|
|
133
|
+
}, Oe = (e, t = {}, n = {}) => {
|
|
134
|
+
let r = t.limit ?? Infinity, i = t.ellipsis ?? "", a = t?.ellipsisWidth ?? (i ? Oe(i, De, n).width : 0), o = n.controlWidth ?? 0, s = n.tabWidth ?? 8, c = n.emojiWidth ?? 2, l = n.regularWidth ?? 1, u = n.wideWidth ?? 2, d = [
|
|
135
|
+
[Te, l],
|
|
136
|
+
[be, 0],
|
|
137
|
+
[xe, o],
|
|
138
|
+
[Ce, s],
|
|
139
|
+
[we, c],
|
|
140
|
+
[Se, u]
|
|
141
|
+
], f = 0, p = 0, m = e.length, h = 0, g = !1, _ = m, v = Math.max(0, r - a), y = 0, b = 0, x = 0, S = 0;
|
|
142
|
+
outer: for (;;) {
|
|
143
|
+
if (b > y || p >= m && p > f) {
|
|
144
|
+
let t = e.slice(y, b) || e.slice(f, p);
|
|
145
|
+
h = 0;
|
|
146
|
+
for (let e of t.replaceAll(Ee, "")) {
|
|
147
|
+
let t = e.codePointAt(0) || 0;
|
|
148
|
+
if (S = ve(t) ? 2 : ye(t) ? u : l, x + S > v && (_ = Math.min(_, Math.max(y, f) + h)), x + S > r) {
|
|
149
|
+
g = !0;
|
|
150
|
+
break outer;
|
|
151
|
+
}
|
|
152
|
+
h += e.length, x += S;
|
|
153
|
+
}
|
|
154
|
+
y = b = 0;
|
|
155
|
+
}
|
|
156
|
+
if (p >= m) break outer;
|
|
157
|
+
for (let t = 0, n = d.length; t < n; t++) {
|
|
158
|
+
let [n, i] = d[t];
|
|
159
|
+
if (n.lastIndex = p, n.test(e)) {
|
|
160
|
+
if (h = n === Se ? _e(e.slice(p, n.lastIndex)) : n === we ? 1 : n.lastIndex - p, S = h * i, x + S > v && (_ = Math.min(_, p + Math.floor((v - x) / i))), x + S > r) {
|
|
161
|
+
g = !0;
|
|
162
|
+
break outer;
|
|
163
|
+
}
|
|
164
|
+
x += S, y = f, b = p, p = f = n.lastIndex;
|
|
165
|
+
continue outer;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
p += 1;
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
width: g ? v : x,
|
|
172
|
+
index: g ? _ : m,
|
|
173
|
+
truncated: g,
|
|
174
|
+
ellipsed: g && r >= a
|
|
175
|
+
};
|
|
176
|
+
}, ke = {
|
|
177
|
+
limit: Infinity,
|
|
178
|
+
ellipsis: "",
|
|
179
|
+
ellipsisWidth: 0
|
|
180
|
+
}, T = (e, t = {}) => Oe(e, ke, t).width, Ae = "\x1B", je = "", Me = 39, Ne = "\x07", Pe = "[", Fe = "]", Ie = "m", Le = `${Fe}8;;`, Re = RegExp(`(?:\\${Pe}(?<code>\\d+)m|\\${Le}(?<uri>.*)${Ne})`, "y"), ze = (e) => {
|
|
181
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
182
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
183
|
+
if (e === 1 || e === 2) return 22;
|
|
184
|
+
if (e === 3) return 23;
|
|
185
|
+
if (e === 4) return 24;
|
|
186
|
+
if (e === 7) return 27;
|
|
187
|
+
if (e === 8) return 28;
|
|
188
|
+
if (e === 9) return 29;
|
|
189
|
+
if (e === 0) return 0;
|
|
190
|
+
}, Be = (e) => `${Ae}${Pe}${e}${Ie}`, Ve = (e) => `${Ae}${Le}${e}${Ne}`, He = (e, t, n) => {
|
|
191
|
+
let r = t[Symbol.iterator](), i = !1, a = !1, o = e.at(-1), s = o === void 0 ? 0 : T(o), c = r.next(), l = r.next(), u = 0;
|
|
192
|
+
for (; !c.done;) {
|
|
193
|
+
let o = c.value, d = T(o);
|
|
194
|
+
s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o === Ae || o === je) && (i = !0, a = t.startsWith(Le, u + 1)), i ? a ? o === Ne && (i = !1, a = !1) : o === Ie && (i = !1) : (s += d, s === n && !l.done && (e.push(""), s = 0)), c = l, l = r.next(), u += o.length;
|
|
195
|
+
}
|
|
196
|
+
o = e.at(-1), !s && o !== void 0 && o.length && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
197
|
+
}, Ue = (e) => {
|
|
198
|
+
let t = e.split(" "), n = t.length;
|
|
199
|
+
for (; n && !T(t[n - 1]);) n--;
|
|
200
|
+
return n === t.length ? e : t.slice(0, n).join(" ") + t.slice(n).join("");
|
|
201
|
+
}, We = (e, t, n = {}) => {
|
|
202
|
+
if (n.trim !== !1 && e.trim() === "") return "";
|
|
203
|
+
let r = "", i, a, o = e.split(" "), s = [""], c = 0;
|
|
204
|
+
for (let e = 0; e < o.length; e++) {
|
|
205
|
+
let r = o[e];
|
|
206
|
+
if (n.trim !== !1) {
|
|
207
|
+
let e = s.at(-1) ?? "", t = e.trimStart();
|
|
208
|
+
e.length !== t.length && (s[s.length - 1] = t, c = T(t));
|
|
209
|
+
}
|
|
210
|
+
e !== 0 && (c >= t && (n.wordWrap === !1 || n.trim === !1) && (s.push(""), c = 0), (c || n.trim === !1) && (s[s.length - 1] += " ", c++));
|
|
211
|
+
let i = T(r);
|
|
212
|
+
if (n.hard && i > t) {
|
|
213
|
+
let e = t - c, n = 1 + Math.floor((i - e - 1) / t);
|
|
214
|
+
Math.floor((i - 1) / t) < n && s.push(""), He(s, r, t), c = T(s.at(-1) ?? "");
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (c + i > t && c && i) {
|
|
218
|
+
if (n.wordWrap === !1 && c < t) {
|
|
219
|
+
He(s, r, t), c = T(s.at(-1) ?? "");
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
s.push(""), c = 0;
|
|
223
|
+
}
|
|
224
|
+
if (c + i > t && n.wordWrap === !1) {
|
|
225
|
+
He(s, r, t), c = T(s.at(-1) ?? "");
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
s[s.length - 1] += r, c += i;
|
|
229
|
+
}
|
|
230
|
+
n.trim !== !1 && (s = s.map((e) => Ue(e)));
|
|
231
|
+
let l = s.join("\n"), u = !1;
|
|
232
|
+
for (let e = 0; e < l.length; e++) {
|
|
233
|
+
let t = l[e];
|
|
234
|
+
if (r += t, u) u = !1;
|
|
235
|
+
else if (u = t >= "\ud800" && t <= "\udbff", u) continue;
|
|
236
|
+
if (t === Ae || t === je) {
|
|
237
|
+
Re.lastIndex = e + 1;
|
|
238
|
+
let t = Re.exec(l)?.groups;
|
|
239
|
+
if (t?.code !== void 0) {
|
|
240
|
+
let e = Number.parseFloat(t.code);
|
|
241
|
+
i = e === Me ? void 0 : e;
|
|
242
|
+
} else t?.uri !== void 0 && (a = t.uri.length === 0 ? void 0 : t.uri);
|
|
243
|
+
}
|
|
244
|
+
if (l[e + 1] === "\n") {
|
|
245
|
+
a && (r += Ve(""));
|
|
246
|
+
let e = i ? ze(i) : void 0;
|
|
247
|
+
i && e && (r += Be(e));
|
|
248
|
+
} else t === "\n" && (i && ze(i) && (r += Be(i)), a && (r += Ve(a)));
|
|
249
|
+
}
|
|
250
|
+
return r;
|
|
251
|
+
}, Ge = /\r?\n/;
|
|
252
|
+
function Ke(e, t, n) {
|
|
253
|
+
return String(e).normalize().split(Ge).map((e) => We(e, t, n)).join("\n");
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region node_modules/.pnpm/@clack+core@1.3.1/node_modules/@clack/core/dist/index.mjs
|
|
257
|
+
var E = (/* @__PURE__ */ ce(((e, t) => {
|
|
258
|
+
var n = "\x1B", r = `${n}[`, i = "\x07", a = {
|
|
259
|
+
to(e, t) {
|
|
260
|
+
return t ? `${r}${t + 1};${e + 1}H` : `${r}${e + 1}G`;
|
|
261
|
+
},
|
|
262
|
+
move(e, t) {
|
|
263
|
+
let n = "";
|
|
264
|
+
return e < 0 ? n += `${r}${-e}D` : e > 0 && (n += `${r}${e}C`), t < 0 ? n += `${r}${-t}A` : t > 0 && (n += `${r}${t}B`), n;
|
|
265
|
+
},
|
|
266
|
+
up: (e = 1) => `${r}${e}A`,
|
|
267
|
+
down: (e = 1) => `${r}${e}B`,
|
|
268
|
+
forward: (e = 1) => `${r}${e}C`,
|
|
269
|
+
backward: (e = 1) => `${r}${e}D`,
|
|
270
|
+
nextLine: (e = 1) => `${r}E`.repeat(e),
|
|
271
|
+
prevLine: (e = 1) => `${r}F`.repeat(e),
|
|
272
|
+
left: `${r}G`,
|
|
273
|
+
hide: `${r}?25l`,
|
|
274
|
+
show: `${r}?25h`,
|
|
275
|
+
save: `${n}7`,
|
|
276
|
+
restore: `${n}8`
|
|
277
|
+
};
|
|
278
|
+
t.exports = {
|
|
279
|
+
cursor: a,
|
|
280
|
+
scroll: {
|
|
281
|
+
up: (e = 1) => `${r}S`.repeat(e),
|
|
282
|
+
down: (e = 1) => `${r}T`.repeat(e)
|
|
283
|
+
},
|
|
284
|
+
erase: {
|
|
285
|
+
screen: `${r}2J`,
|
|
286
|
+
up: (e = 1) => `${r}1J`.repeat(e),
|
|
287
|
+
down: (e = 1) => `${r}J`.repeat(e),
|
|
288
|
+
line: `${r}2K`,
|
|
289
|
+
lineEnd: `${r}K`,
|
|
290
|
+
lineStart: `${r}1K`,
|
|
291
|
+
lines(e) {
|
|
292
|
+
let t = "";
|
|
293
|
+
for (let n = 0; n < e; n++) t += this.line + (n < e - 1 ? a.up() : "");
|
|
294
|
+
return e && (t += a.left), t;
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
beep: i
|
|
298
|
+
};
|
|
299
|
+
})))();
|
|
300
|
+
function qe(e, t, n) {
|
|
301
|
+
if (!n.some((e) => !e.disabled)) return e;
|
|
302
|
+
let r = e + t, i = Math.max(n.length - 1, 0), a = r < 0 ? i : r > i ? 0 : r;
|
|
303
|
+
return n[a].disabled ? qe(a, t < 0 ? -1 : 1, n) : a;
|
|
304
|
+
}
|
|
305
|
+
function Je(e, t, n, r) {
|
|
306
|
+
let i = r.split("\n"), a = 0, o = e;
|
|
307
|
+
for (let e of i) {
|
|
308
|
+
if (o <= e.length) break;
|
|
309
|
+
o -= e.length + 1, a++;
|
|
310
|
+
}
|
|
311
|
+
for (a = Math.max(0, Math.min(i.length - 1, a + n)), o = Math.min(o, i[a].length) + t; o < 0 && a > 0;) a--, o += i[a].length + 1;
|
|
312
|
+
for (; o > i[a].length && a < i.length - 1;) o -= i[a].length + 1, a++;
|
|
313
|
+
o = Math.max(0, Math.min(i[a].length, o));
|
|
314
|
+
let s = 0;
|
|
315
|
+
for (let e = 0; e < a; e++) s += i[e].length + 1;
|
|
316
|
+
return s + o;
|
|
317
|
+
}
|
|
318
|
+
var D = {
|
|
319
|
+
actions: new Set([
|
|
320
|
+
"up",
|
|
321
|
+
"down",
|
|
322
|
+
"left",
|
|
323
|
+
"right",
|
|
324
|
+
"space",
|
|
325
|
+
"enter",
|
|
326
|
+
"cancel"
|
|
327
|
+
]),
|
|
328
|
+
aliases: new Map([
|
|
329
|
+
["k", "up"],
|
|
330
|
+
["j", "down"],
|
|
331
|
+
["h", "left"],
|
|
332
|
+
["l", "right"],
|
|
333
|
+
["", "cancel"],
|
|
334
|
+
["escape", "cancel"]
|
|
335
|
+
]),
|
|
336
|
+
messages: {
|
|
337
|
+
cancel: "Canceled",
|
|
338
|
+
error: "Something went wrong"
|
|
339
|
+
},
|
|
340
|
+
withGuide: !0,
|
|
341
|
+
date: {
|
|
342
|
+
monthNames: [...[
|
|
343
|
+
"January",
|
|
344
|
+
"February",
|
|
345
|
+
"March",
|
|
346
|
+
"April",
|
|
347
|
+
"May",
|
|
348
|
+
"June",
|
|
349
|
+
"July",
|
|
350
|
+
"August",
|
|
351
|
+
"September",
|
|
352
|
+
"October",
|
|
353
|
+
"November",
|
|
354
|
+
"December"
|
|
355
|
+
]],
|
|
356
|
+
messages: {
|
|
357
|
+
required: "Please enter a valid date",
|
|
358
|
+
invalidMonth: "There are only 12 months in a year",
|
|
359
|
+
invalidDay: (e, t) => `There are only ${e} days in ${t}`,
|
|
360
|
+
afterMin: (e) => `Date must be on or after ${e.toISOString().slice(0, 10)}`,
|
|
361
|
+
beforeMax: (e) => `Date must be on or before ${e.toISOString().slice(0, 10)}`
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
function Ye(e, t) {
|
|
366
|
+
if (typeof e == "string") return D.aliases.get(e) === t;
|
|
367
|
+
for (let n of e) if (n !== void 0 && Ye(n, t)) return !0;
|
|
368
|
+
return !1;
|
|
369
|
+
}
|
|
370
|
+
function Xe(e, t) {
|
|
371
|
+
if (e === t) return;
|
|
372
|
+
let n = e.split("\n"), r = t.split("\n"), i = Math.max(n.length, r.length), a = [];
|
|
373
|
+
for (let e = 0; e < i; e++) n[e] !== r[e] && a.push(e);
|
|
374
|
+
return {
|
|
375
|
+
lines: a,
|
|
376
|
+
numLinesBefore: n.length,
|
|
377
|
+
numLinesAfter: r.length,
|
|
378
|
+
numLines: i
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
var Ze = globalThis.process.platform.startsWith("win"), Qe = Symbol("clack:cancel");
|
|
382
|
+
function $e(e) {
|
|
383
|
+
return e === Qe;
|
|
384
|
+
}
|
|
385
|
+
function et(e, t) {
|
|
386
|
+
let n = e;
|
|
387
|
+
n.isTTY && n.setRawMode(t);
|
|
388
|
+
}
|
|
389
|
+
function tt({ input: e = y, output: t = b, overwrite: n = !0, hideCursor: r = !0 } = {}) {
|
|
390
|
+
let i = x.createInterface({
|
|
391
|
+
input: e,
|
|
392
|
+
output: t,
|
|
393
|
+
prompt: "",
|
|
394
|
+
tabSize: 1
|
|
395
|
+
});
|
|
396
|
+
x.emitKeypressEvents(e, i), e instanceof ee && e.isTTY && e.setRawMode(!0);
|
|
397
|
+
let a = (i, { name: o, sequence: s }) => {
|
|
398
|
+
if (Ye([
|
|
399
|
+
String(i),
|
|
400
|
+
o,
|
|
401
|
+
s
|
|
402
|
+
], "cancel")) {
|
|
403
|
+
r && t.write(E.cursor.show), process.exit(0);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
if (!n) return;
|
|
407
|
+
let c = o === "return" ? 0 : -1, l = o === "return" ? -1 : 0;
|
|
408
|
+
x.moveCursor(t, c, l, () => {
|
|
409
|
+
x.clearLine(t, 1, () => {
|
|
410
|
+
e.once("keypress", a);
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
return r && t.write(E.cursor.hide), e.once("keypress", a), () => {
|
|
415
|
+
e.off("keypress", a), r && t.write(E.cursor.show), e instanceof ee && e.isTTY && !Ze && e.setRawMode(!1), i.terminal = !1, i.close();
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
var nt = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, rt = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
419
|
+
function O(e, t, n, r = n, i = n, a) {
|
|
420
|
+
return Ke(t, nt(e ?? b) - n.length, {
|
|
421
|
+
hard: !0,
|
|
422
|
+
trim: !1
|
|
423
|
+
}).split("\n").map((e, t, o) => {
|
|
424
|
+
let s = a ? a(e, t) : e;
|
|
425
|
+
return t === 0 ? `${r}${s}` : t === o.length - 1 ? `${i}${s}` : `${n}${s}`;
|
|
426
|
+
}).join("\n");
|
|
427
|
+
}
|
|
428
|
+
var it = class {
|
|
429
|
+
input;
|
|
430
|
+
output;
|
|
431
|
+
_abortSignal;
|
|
432
|
+
rl;
|
|
433
|
+
opts;
|
|
434
|
+
_render;
|
|
435
|
+
_track = !1;
|
|
436
|
+
_prevFrame = "";
|
|
437
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
438
|
+
_cursor = 0;
|
|
439
|
+
state = "initial";
|
|
440
|
+
error = "";
|
|
441
|
+
value;
|
|
442
|
+
userInput = "";
|
|
443
|
+
constructor(e, t = !0) {
|
|
444
|
+
let { input: n = y, output: r = b, render: i, signal: a, ...o } = e;
|
|
445
|
+
this.opts = o, 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 = a, this.input = n, this.output = r;
|
|
446
|
+
}
|
|
447
|
+
unsubscribe() {
|
|
448
|
+
this._subscribers.clear();
|
|
449
|
+
}
|
|
450
|
+
setSubscriber(e, t) {
|
|
451
|
+
let n = this._subscribers.get(e) ?? [];
|
|
452
|
+
n.push(t), this._subscribers.set(e, n);
|
|
453
|
+
}
|
|
454
|
+
on(e, t) {
|
|
455
|
+
this.setSubscriber(e, { cb: t });
|
|
456
|
+
}
|
|
457
|
+
once(e, t) {
|
|
458
|
+
this.setSubscriber(e, {
|
|
459
|
+
cb: t,
|
|
460
|
+
once: !0
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
emit(e, ...t) {
|
|
464
|
+
let n = this._subscribers.get(e) ?? [], r = [];
|
|
465
|
+
for (let e of n) e.cb(...t), e.once && r.push(() => n.splice(n.indexOf(e), 1));
|
|
466
|
+
for (let e of r) e();
|
|
467
|
+
}
|
|
468
|
+
prompt() {
|
|
469
|
+
return new Promise((e) => {
|
|
470
|
+
if (this._abortSignal) {
|
|
471
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(Qe);
|
|
472
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
473
|
+
this.state = "cancel", this.close();
|
|
474
|
+
}, { once: !0 });
|
|
475
|
+
}
|
|
476
|
+
this.rl = S.createInterface({
|
|
477
|
+
input: this.input,
|
|
478
|
+
tabSize: 2,
|
|
479
|
+
prompt: "",
|
|
480
|
+
escapeCodeTimeout: 50,
|
|
481
|
+
terminal: !0
|
|
482
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), et(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
483
|
+
this.output.write(E.cursor.show), this.output.off("resize", this.render), et(this.input, !1), e(this.value);
|
|
484
|
+
}), this.once("cancel", () => {
|
|
485
|
+
this.output.write(E.cursor.show), this.output.off("resize", this.render), et(this.input, !1), e(Qe);
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
_isActionKey(e, t) {
|
|
490
|
+
return e === " ";
|
|
491
|
+
}
|
|
492
|
+
_shouldSubmit(e, t) {
|
|
493
|
+
return !0;
|
|
494
|
+
}
|
|
495
|
+
_setValue(e) {
|
|
496
|
+
this.value = e, this.emit("value", this.value);
|
|
497
|
+
}
|
|
498
|
+
_setUserInput(e, t) {
|
|
499
|
+
this.userInput = e ?? "", this.emit("userInput", this.userInput), t && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
500
|
+
}
|
|
501
|
+
_clearUserInput() {
|
|
502
|
+
this.rl?.write(null, {
|
|
503
|
+
ctrl: !0,
|
|
504
|
+
name: "u"
|
|
505
|
+
}), this._setUserInput("");
|
|
506
|
+
}
|
|
507
|
+
onKeypress(e, t) {
|
|
508
|
+
if (this._track && t.name !== "return" && (t.name && this._isActionKey(e, t) && this.rl?.write(null, {
|
|
509
|
+
ctrl: !0,
|
|
510
|
+
name: "h"
|
|
511
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), t?.name && (!this._track && D.aliases.has(t.name) && this.emit("cursor", D.aliases.get(t.name)), D.actions.has(t.name) && this.emit("cursor", t.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), t), t?.name === "return" && this._shouldSubmit(e, t)) {
|
|
512
|
+
if (this.opts.validate) {
|
|
513
|
+
let e = this.opts.validate(this.value);
|
|
514
|
+
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
|
|
515
|
+
}
|
|
516
|
+
this.state !== "error" && (this.state = "submit");
|
|
517
|
+
}
|
|
518
|
+
Ye([
|
|
519
|
+
e,
|
|
520
|
+
t?.name,
|
|
521
|
+
t?.sequence
|
|
522
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
523
|
+
}
|
|
524
|
+
close() {
|
|
525
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"), et(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
526
|
+
}
|
|
527
|
+
restoreCursor() {
|
|
528
|
+
let e = Ke(this._prevFrame, process.stdout.columns, {
|
|
529
|
+
hard: !0,
|
|
530
|
+
trim: !1
|
|
531
|
+
}).split("\n").length - 1;
|
|
532
|
+
this.output.write(E.cursor.move(-999, e * -1));
|
|
533
|
+
}
|
|
534
|
+
render() {
|
|
535
|
+
let e = Ke(this._render(this) ?? "", process.stdout.columns, {
|
|
536
|
+
hard: !0,
|
|
537
|
+
trim: !1
|
|
538
|
+
});
|
|
539
|
+
if (e !== this._prevFrame) {
|
|
540
|
+
if (this.state === "initial") this.output.write(E.cursor.hide);
|
|
541
|
+
else {
|
|
542
|
+
let t = Xe(this._prevFrame, e), n = rt(this.output);
|
|
543
|
+
if (this.restoreCursor(), t) {
|
|
544
|
+
let r = Math.max(0, t.numLinesAfter - n), i = Math.max(0, t.numLinesBefore - n), a = t.lines.find((e) => e >= r);
|
|
545
|
+
if (a === void 0) {
|
|
546
|
+
this._prevFrame = e;
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (t.lines.length === 1) {
|
|
550
|
+
this.output.write(E.cursor.move(0, a - i)), this.output.write(E.erase.lines(1));
|
|
551
|
+
let t = e.split("\n");
|
|
552
|
+
this.output.write(t[a]), this._prevFrame = e, this.output.write(E.cursor.move(0, t.length - a - 1));
|
|
553
|
+
return;
|
|
554
|
+
} else if (t.lines.length > 1) {
|
|
555
|
+
if (r < i) a = r;
|
|
556
|
+
else {
|
|
557
|
+
let e = a - i;
|
|
558
|
+
e > 0 && this.output.write(E.cursor.move(0, e));
|
|
559
|
+
}
|
|
560
|
+
this.output.write(E.erase.down());
|
|
561
|
+
let t = e.split("\n").slice(a);
|
|
562
|
+
this.output.write(t.join("\n")), this._prevFrame = e;
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
this.output.write(E.erase.down());
|
|
567
|
+
}
|
|
568
|
+
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}, at = class extends it {
|
|
572
|
+
get cursor() {
|
|
573
|
+
return +!this.value;
|
|
574
|
+
}
|
|
575
|
+
get _value() {
|
|
576
|
+
return this.cursor === 0;
|
|
577
|
+
}
|
|
578
|
+
constructor(e) {
|
|
579
|
+
super(e, !1), this.value = !!e.initialValue, this.on("userInput", () => {
|
|
580
|
+
this.value = this._value;
|
|
581
|
+
}), this.on("confirm", (e) => {
|
|
582
|
+
this.output.write(E.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
583
|
+
}), this.on("cursor", () => {
|
|
584
|
+
this.value = !this.value;
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
}, ot = class extends it {
|
|
588
|
+
#e = !1;
|
|
589
|
+
#t;
|
|
590
|
+
focused = "editor";
|
|
591
|
+
get userInputWithCursor() {
|
|
592
|
+
if (this.state === "submit") return this.userInput;
|
|
593
|
+
let e = this.userInput;
|
|
594
|
+
if (this.cursor >= e.length) return `${e}\u2588`;
|
|
595
|
+
let t = e.slice(0, this.cursor), n = e[this.cursor], r = e.slice(this.cursor + 1);
|
|
596
|
+
return n === "\n" ? `${t}\u2588
|
|
597
|
+
${r}` : `${t}${_("inverse", n)}${r}`;
|
|
598
|
+
}
|
|
599
|
+
get cursor() {
|
|
600
|
+
return this._cursor;
|
|
601
|
+
}
|
|
602
|
+
#n(e) {
|
|
603
|
+
if (this.userInput.length === 0) {
|
|
604
|
+
this._setUserInput(e);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + e + this.userInput.slice(this.cursor));
|
|
608
|
+
}
|
|
609
|
+
#r(e) {
|
|
610
|
+
let t = this.value ?? "";
|
|
611
|
+
switch (e) {
|
|
612
|
+
case "up":
|
|
613
|
+
this._cursor = Je(this._cursor, 0, -1, t);
|
|
614
|
+
return;
|
|
615
|
+
case "down":
|
|
616
|
+
this._cursor = Je(this._cursor, 0, 1, t);
|
|
617
|
+
return;
|
|
618
|
+
case "left":
|
|
619
|
+
this._cursor = Je(this._cursor, -1, 0, t);
|
|
620
|
+
return;
|
|
621
|
+
case "right":
|
|
622
|
+
this._cursor = Je(this._cursor, 1, 0, t);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
_shouldSubmit(e, t) {
|
|
627
|
+
if (this.#t) return this.focused === "submit" ? !0 : (this.#n("\n"), this._cursor++, !1);
|
|
628
|
+
let n = this.#e;
|
|
629
|
+
return this.#e = !0, n ? (this.userInput[this.cursor - 1] === "\n" && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), !0) : (this.#n("\n"), this._cursor++, !1);
|
|
630
|
+
}
|
|
631
|
+
constructor(e) {
|
|
632
|
+
super(e, !1), this.#t = e.showSubmit ?? !1, this.on("key", (e, t) => {
|
|
633
|
+
if (t?.name && D.actions.has(t.name)) {
|
|
634
|
+
this.#r(t.name);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
if (e === " " && this.#t) {
|
|
638
|
+
this.focused = this.focused === "editor" ? "submit" : "editor";
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (t?.name !== "return") {
|
|
642
|
+
if (this.#e = !1, t?.name === "backspace" && this.cursor > 0) {
|
|
643
|
+
this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (t?.name === "delete" && this.cursor < this.userInput.length) {
|
|
647
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
e && (this.#t && this.focused === "submit" && (this.focused = "editor"), this.#n(e ?? ""), this._cursor++);
|
|
651
|
+
}
|
|
652
|
+
}), this.on("userInput", (e) => {
|
|
653
|
+
this._setValue(e);
|
|
654
|
+
}), this.on("finalize", () => {
|
|
655
|
+
this.value ||= e.defaultValue, this.value === void 0 && (this.value = "");
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}, st = class extends it {
|
|
659
|
+
options;
|
|
660
|
+
cursor = 0;
|
|
661
|
+
get _value() {
|
|
662
|
+
return this.options[this.cursor].value;
|
|
663
|
+
}
|
|
664
|
+
get _enabledOptions() {
|
|
665
|
+
return this.options.filter((e) => e.disabled !== !0);
|
|
666
|
+
}
|
|
667
|
+
toggleAll() {
|
|
668
|
+
let e = this._enabledOptions, t = this.value !== void 0 && this.value.length === e.length;
|
|
669
|
+
this.value = t ? [] : e.map((e) => e.value);
|
|
670
|
+
}
|
|
671
|
+
toggleInvert() {
|
|
672
|
+
let e = this.value;
|
|
673
|
+
if (!e) return;
|
|
674
|
+
let t = this._enabledOptions.filter((t) => !e.includes(t.value));
|
|
675
|
+
this.value = t.map((e) => e.value);
|
|
676
|
+
}
|
|
677
|
+
toggleValue() {
|
|
678
|
+
this.value === void 0 && (this.value = []);
|
|
679
|
+
let e = this.value.includes(this._value);
|
|
680
|
+
this.value = e ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
|
|
681
|
+
}
|
|
682
|
+
constructor(e) {
|
|
683
|
+
super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
684
|
+
let t = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
|
|
685
|
+
this.cursor = this.options[t].disabled ? qe(t, 1, this.options) : t, this.on("key", (e) => {
|
|
686
|
+
e === "a" && this.toggleAll(), e === "i" && this.toggleInvert();
|
|
687
|
+
}), this.on("cursor", (e) => {
|
|
688
|
+
switch (e) {
|
|
689
|
+
case "left":
|
|
690
|
+
case "up":
|
|
691
|
+
this.cursor = qe(this.cursor, -1, this.options);
|
|
692
|
+
break;
|
|
693
|
+
case "down":
|
|
694
|
+
case "right":
|
|
695
|
+
this.cursor = qe(this.cursor, 1, this.options);
|
|
696
|
+
break;
|
|
697
|
+
case "space":
|
|
698
|
+
this.toggleValue();
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}, ct = class extends it {
|
|
704
|
+
options;
|
|
705
|
+
cursor = 0;
|
|
706
|
+
get _selectedValue() {
|
|
707
|
+
return this.options[this.cursor];
|
|
708
|
+
}
|
|
709
|
+
changeValue() {
|
|
710
|
+
this.value = this._selectedValue.value;
|
|
711
|
+
}
|
|
712
|
+
constructor(e) {
|
|
713
|
+
super(e, !1), this.options = e.options;
|
|
714
|
+
let t = this.options.findIndex(({ value: t }) => t === e.initialValue), n = t === -1 ? 0 : t;
|
|
715
|
+
this.cursor = this.options[n].disabled ? qe(n, 1, this.options) : n, this.changeValue(), this.on("cursor", (e) => {
|
|
716
|
+
switch (e) {
|
|
717
|
+
case "left":
|
|
718
|
+
case "up":
|
|
719
|
+
this.cursor = qe(this.cursor, -1, this.options);
|
|
720
|
+
break;
|
|
721
|
+
case "down":
|
|
722
|
+
case "right":
|
|
723
|
+
this.cursor = qe(this.cursor, 1, this.options);
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
this.changeValue();
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}, lt = class extends it {
|
|
730
|
+
get userInputWithCursor() {
|
|
731
|
+
if (this.state === "submit") return this.userInput;
|
|
732
|
+
let e = this.userInput;
|
|
733
|
+
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
734
|
+
let t = e.slice(0, this.cursor), [n, ...r] = e.slice(this.cursor);
|
|
735
|
+
return `${t}${_("inverse", n)}${r.join("")}`;
|
|
736
|
+
}
|
|
737
|
+
get cursor() {
|
|
738
|
+
return this._cursor;
|
|
739
|
+
}
|
|
740
|
+
constructor(e) {
|
|
741
|
+
super({
|
|
742
|
+
...e,
|
|
743
|
+
initialUserInput: e.initialUserInput ?? e.initialValue
|
|
744
|
+
}), this.on("userInput", (e) => {
|
|
745
|
+
this._setValue(e);
|
|
746
|
+
}), this.on("finalize", () => {
|
|
747
|
+
this.value ||= e.defaultValue, this.value === void 0 && (this.value = "");
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region node_modules/.pnpm/@clack+prompts@1.4.0/node_modules/@clack/prompts/dist/index.mjs
|
|
753
|
+
function ut() {
|
|
754
|
+
return v.platform === "win32" ? !!v.env.CI || !!v.env.WT_SESSION || !!v.env.TERMINUS_SUBLIME || v.env.ConEmuTask === "{cmd::Cmder}" || v.env.TERM_PROGRAM === "Terminus-Sublime" || v.env.TERM_PROGRAM === "vscode" || v.env.TERM === "xterm-256color" || v.env.TERM === "alacritty" || v.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" : v.env.TERM !== "linux";
|
|
755
|
+
}
|
|
756
|
+
var dt = ut(), ft = () => process.env.CI === "true", k = (e, t) => dt ? e : t, pt = k("◆", "*"), mt = k("■", "x"), ht = k("▲", "x"), gt = k("◇", "o"), A = k("│", "|"), j = k("└", "—"), _t = k("●", ">"), vt = k("○", " "), yt = k("◻", "[•]"), bt = k("◼", "[+]"), xt = k("◻", "[ ]"), St = k("●", "•"), Ct = k("◆", "*"), wt = k("▲", "!"), Tt = k("■", "x"), Et = (e) => {
|
|
757
|
+
switch (e) {
|
|
758
|
+
case "initial":
|
|
759
|
+
case "active": return _("cyan", pt);
|
|
760
|
+
case "cancel": return _("red", mt);
|
|
761
|
+
case "error": return _("yellow", ht);
|
|
762
|
+
case "submit": return _("green", gt);
|
|
763
|
+
}
|
|
764
|
+
}, Dt = (e) => {
|
|
765
|
+
switch (e) {
|
|
766
|
+
case "initial":
|
|
767
|
+
case "active": return _("cyan", A);
|
|
768
|
+
case "cancel": return _("red", A);
|
|
769
|
+
case "error": return _("yellow", A);
|
|
770
|
+
case "submit": return _("green", A);
|
|
771
|
+
}
|
|
772
|
+
}, Ot = (e, t, n, r, i, a = !1) => {
|
|
773
|
+
let o = t, s = 0;
|
|
774
|
+
if (a) for (let t = r - 1; t >= n && (o -= e[t].length, s++, !(o <= i)); t--);
|
|
775
|
+
else for (let t = n; t < r && (o -= e[t].length, s++, !(o <= i)); t++);
|
|
776
|
+
return {
|
|
777
|
+
lineCount: o,
|
|
778
|
+
removals: s
|
|
779
|
+
};
|
|
780
|
+
}, kt = ({ cursor: e, options: t, style: n, output: r = process.stdout, maxItems: i = Infinity, columnPadding: a = 0, rowPadding: o = 4 }) => {
|
|
781
|
+
let s = nt(r) - a, c = rt(r), l = _("dim", "..."), u = Math.max(c - o, 0), d = Math.max(Math.min(i, u), 5), f = 0;
|
|
782
|
+
e >= d - 3 && (f = Math.max(Math.min(e - d + 3, t.length - d), 0));
|
|
783
|
+
let p = d < t.length && f > 0, m = d < t.length && f + d < t.length, h = Math.min(f + d, t.length), g = [], v = 0;
|
|
784
|
+
p && v++, m && v++;
|
|
785
|
+
let y = f + +!!p, b = h - +!!m;
|
|
786
|
+
for (let r = y; r < b; r++) {
|
|
787
|
+
let i = Ke(n(t[r], r === e), s, {
|
|
788
|
+
hard: !0,
|
|
789
|
+
trim: !1
|
|
790
|
+
}).split("\n");
|
|
791
|
+
g.push(i), v += i.length;
|
|
792
|
+
}
|
|
793
|
+
if (v > u) {
|
|
794
|
+
let t = 0, n = 0, r = v, i = e - y, a = u, o = () => Ot(g, r, 0, i, a), s = () => Ot(g, r, i + 1, g.length, a, !0);
|
|
795
|
+
p ? ({lineCount: r, removals: t} = o(), r > a && (m || --a, {lineCount: r, removals: n} = s())) : (m || --a, {lineCount: r, removals: n} = s(), r > a && (--a, {lineCount: r, removals: t} = o())), t > 0 && (p = !0, g.splice(0, t)), n > 0 && (m = !0, g.splice(g.length - n, n));
|
|
796
|
+
}
|
|
797
|
+
let x = [];
|
|
798
|
+
p && x.push(l);
|
|
799
|
+
for (let e of g) for (let t of e) x.push(t);
|
|
800
|
+
return m && x.push(l), x;
|
|
801
|
+
}, At = (e) => {
|
|
802
|
+
let t = e.active ?? "Yes", n = e.inactive ?? "No";
|
|
803
|
+
return new at({
|
|
804
|
+
active: t,
|
|
805
|
+
inactive: n,
|
|
806
|
+
signal: e.signal,
|
|
807
|
+
input: e.input,
|
|
808
|
+
output: e.output,
|
|
809
|
+
initialValue: e.initialValue ?? !0,
|
|
810
|
+
render() {
|
|
811
|
+
let r = e.withGuide ?? D.withGuide, i = `${Et(this.state)} `, a = r ? `${_("gray", A)} ` : "", o = O(e.output, e.message, a, i), s = `${r ? `${_("gray", A)}
|
|
812
|
+
` : ""}${o}
|
|
813
|
+
`, c = this.value ? t : n;
|
|
814
|
+
switch (this.state) {
|
|
815
|
+
case "submit": return `${s}${r ? `${_("gray", A)} ` : ""}${_("dim", c)}`;
|
|
816
|
+
case "cancel": return `${s}${r ? `${_("gray", A)} ` : ""}${_(["strikethrough", "dim"], c)}${r ? `
|
|
817
|
+
${_("gray", A)}` : ""}`;
|
|
818
|
+
default: {
|
|
819
|
+
let i = r ? `${_("cyan", A)} ` : "", a = r ? _("cyan", j) : "";
|
|
820
|
+
return `${s}${i}${this.value ? `${_("green", _t)} ${t}` : `${_("dim", vt)} ${_("dim", t)}`}${e.vertical ? r ? `
|
|
821
|
+
${_("cyan", A)} ` : "\n" : ` ${_("dim", "/")} `}${this.value ? `${_("dim", vt)} ${_("dim", n)}` : `${_("green", _t)} ${n}`}
|
|
822
|
+
${a}
|
|
823
|
+
`;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}).prompt();
|
|
828
|
+
}, M = {
|
|
829
|
+
message: (e = [], { symbol: t = _("gray", A), secondarySymbol: n = _("gray", A), output: r = process.stdout, spacing: i = 1, withGuide: a } = {}) => {
|
|
830
|
+
let o = [], s = a ?? D.withGuide, c = s ? n : "", l = s ? `${t} ` : "", u = s ? `${n} ` : "";
|
|
831
|
+
for (let e = 0; e < i; e++) o.push(c);
|
|
832
|
+
let d = Array.isArray(e) ? e : e.split("\n");
|
|
833
|
+
if (d.length > 0) {
|
|
834
|
+
let [e, ...r] = d;
|
|
835
|
+
e.length > 0 ? o.push(`${l}${e}`) : o.push(s ? t : "");
|
|
836
|
+
for (let e of r) e.length > 0 ? o.push(`${u}${e}`) : o.push(s ? n : "");
|
|
837
|
+
}
|
|
838
|
+
r.write(`${o.join("\n")}
|
|
839
|
+
`);
|
|
840
|
+
},
|
|
841
|
+
info: (e, t) => {
|
|
842
|
+
M.message(e, {
|
|
843
|
+
...t,
|
|
844
|
+
symbol: _("blue", St)
|
|
845
|
+
});
|
|
846
|
+
},
|
|
847
|
+
success: (e, t) => {
|
|
848
|
+
M.message(e, {
|
|
849
|
+
...t,
|
|
850
|
+
symbol: _("green", Ct)
|
|
851
|
+
});
|
|
852
|
+
},
|
|
853
|
+
step: (e, t) => {
|
|
854
|
+
M.message(e, {
|
|
855
|
+
...t,
|
|
856
|
+
symbol: _("green", gt)
|
|
857
|
+
});
|
|
858
|
+
},
|
|
859
|
+
warn: (e, t) => {
|
|
860
|
+
M.message(e, {
|
|
861
|
+
...t,
|
|
862
|
+
symbol: _("yellow", wt)
|
|
863
|
+
});
|
|
864
|
+
},
|
|
865
|
+
warning: (e, t) => {
|
|
866
|
+
M.warn(e, t);
|
|
867
|
+
},
|
|
868
|
+
error: (e, t) => {
|
|
869
|
+
M.message(e, {
|
|
870
|
+
...t,
|
|
871
|
+
symbol: _("red", Tt)
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
}, N = (e = "", t) => {
|
|
875
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? D.withGuide ? `${_("gray", j)} ` : "";
|
|
876
|
+
n.write(`${r}${_("red", e)}
|
|
877
|
+
|
|
878
|
+
`);
|
|
879
|
+
}, jt = (e = "", t) => {
|
|
880
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? D.withGuide ? `${_("gray", A)}
|
|
881
|
+
${_("gray", j)} ` : "";
|
|
882
|
+
n.write(`${r}${e}
|
|
883
|
+
|
|
884
|
+
`);
|
|
885
|
+
}, Mt = (e) => new ot({
|
|
886
|
+
validate: e.validate,
|
|
887
|
+
placeholder: e.placeholder,
|
|
888
|
+
defaultValue: e.defaultValue,
|
|
889
|
+
initialValue: e.initialValue,
|
|
890
|
+
showSubmit: e.showSubmit,
|
|
891
|
+
output: e.output,
|
|
892
|
+
signal: e.signal,
|
|
893
|
+
input: e.input,
|
|
894
|
+
render() {
|
|
895
|
+
let t = e?.withGuide ?? D.withGuide, n = `${`${t ? `${_("gray", A)}
|
|
896
|
+
` : ""}${Et(this.state)} `}${e.message}
|
|
897
|
+
`, r = e.placeholder ? _("inverse", e.placeholder[0]) + _("dim", e.placeholder.slice(1)) : _(["inverse", "hidden"], "_"), i = this.userInput ? this.userInputWithCursor : r, a = this.value ?? "", o = e.showSubmit ? `
|
|
898
|
+
${_(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
|
|
899
|
+
switch (this.state) {
|
|
900
|
+
case "error": {
|
|
901
|
+
let r = `${_("yellow", A)} `;
|
|
902
|
+
return `${n}${t ? O(e.output, i, r, void 0) : i}
|
|
903
|
+
${_("yellow", j)} ${_("yellow", this.error)}${o}
|
|
904
|
+
`;
|
|
905
|
+
}
|
|
906
|
+
case "submit": {
|
|
907
|
+
let r = `${_("gray", A)} `;
|
|
908
|
+
return `${n}${t ? O(e.output, a, r, void 0, void 0, (e) => _("dim", e)) : a ? _("dim", a) : ""}`;
|
|
909
|
+
}
|
|
910
|
+
case "cancel": {
|
|
911
|
+
let r = `${_("gray", A)} `;
|
|
912
|
+
return `${n}${t ? O(e.output, a, r, void 0, void 0, (e) => _(["strikethrough", "dim"], e)) : a ? _(["strikethrough", "dim"], a) : ""}`;
|
|
913
|
+
}
|
|
914
|
+
default: {
|
|
915
|
+
let r = t ? `${_("cyan", A)} ` : "", a = t ? _("cyan", j) : "";
|
|
916
|
+
return `${n}${t ? O(e.output, i, r) : i}
|
|
917
|
+
${a}${o}
|
|
918
|
+
`;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}).prompt(), Nt = (e, t) => e.split("\n").map((e) => t(e)).join("\n"), Pt = (e) => {
|
|
923
|
+
let t = (e, t) => {
|
|
924
|
+
let n = e.label ?? String(e.value);
|
|
925
|
+
return t === "disabled" ? `${_("gray", xt)} ${Nt(n, (e) => _(["strikethrough", "gray"], e))}${e.hint ? ` ${_("dim", `(${e.hint ?? "disabled"})`)}` : ""}` : t === "active" ? `${_("cyan", yt)} ${n}${e.hint ? ` ${_("dim", `(${e.hint})`)}` : ""}` : t === "selected" ? `${_("green", bt)} ${Nt(n, (e) => _("dim", e))}${e.hint ? ` ${_("dim", `(${e.hint})`)}` : ""}` : t === "cancelled" ? `${Nt(n, (e) => _(["strikethrough", "dim"], e))}` : t === "active-selected" ? `${_("green", bt)} ${n}${e.hint ? ` ${_("dim", `(${e.hint})`)}` : ""}` : t === "submitted" ? `${Nt(n, (e) => _("dim", e))}` : `${_("dim", xt)} ${Nt(n, (e) => _("dim", e))}`;
|
|
926
|
+
}, n = e.required ?? !0;
|
|
927
|
+
return new st({
|
|
928
|
+
options: e.options,
|
|
929
|
+
signal: e.signal,
|
|
930
|
+
input: e.input,
|
|
931
|
+
output: e.output,
|
|
932
|
+
initialValues: e.initialValues,
|
|
933
|
+
required: n,
|
|
934
|
+
cursorAt: e.cursorAt,
|
|
935
|
+
validate(e) {
|
|
936
|
+
if (n && (e === void 0 || e.length === 0)) return `Please select at least one option.
|
|
937
|
+
${_("reset", _("dim", `Press ${_([
|
|
938
|
+
"gray",
|
|
939
|
+
"bgWhite",
|
|
940
|
+
"inverse"
|
|
941
|
+
], " space ")} to select, ${_("gray", _("bgWhite", _("inverse", " enter ")))} to submit`))}`;
|
|
942
|
+
},
|
|
943
|
+
render() {
|
|
944
|
+
let n = e.withGuide ?? D.withGuide, r = O(e.output, e.message, n ? `${Dt(this.state)} ` : "", `${Et(this.state)} `), i = `${n ? `${_("gray", A)}
|
|
945
|
+
` : ""}${r}
|
|
946
|
+
`, a = this.value ?? [], o = (e, n) => {
|
|
947
|
+
if (e.disabled) return t(e, "disabled");
|
|
948
|
+
let r = a.includes(e.value);
|
|
949
|
+
return n && r ? t(e, "active-selected") : r ? t(e, "selected") : t(e, n ? "active" : "inactive");
|
|
950
|
+
};
|
|
951
|
+
switch (this.state) {
|
|
952
|
+
case "submit": {
|
|
953
|
+
let r = this.options.filter(({ value: e }) => a.includes(e)).map((e) => t(e, "submitted")).join(_("dim", ", ")) || _("dim", "none");
|
|
954
|
+
return `${i}${O(e.output, r, n ? `${_("gray", A)} ` : "")}`;
|
|
955
|
+
}
|
|
956
|
+
case "cancel": {
|
|
957
|
+
let r = this.options.filter(({ value: e }) => a.includes(e)).map((e) => t(e, "cancelled")).join(_("dim", ", "));
|
|
958
|
+
return r.trim() === "" ? `${i}${_("gray", A)}` : `${i}${O(e.output, r, n ? `${_("gray", A)} ` : "")}${n ? `
|
|
959
|
+
${_("gray", A)}` : ""}`;
|
|
960
|
+
}
|
|
961
|
+
case "error": {
|
|
962
|
+
let t = n ? `${_("yellow", A)} ` : "", r = this.error.split("\n").map((e, t) => t === 0 ? `${n ? `${_("yellow", j)} ` : ""}${_("yellow", e)}` : ` ${e}`).join("\n"), a = i.split("\n").length, s = r.split("\n").length + 1;
|
|
963
|
+
return `${i}${t}${kt({
|
|
964
|
+
output: e.output,
|
|
965
|
+
options: this.options,
|
|
966
|
+
cursor: this.cursor,
|
|
967
|
+
maxItems: e.maxItems,
|
|
968
|
+
columnPadding: t.length,
|
|
969
|
+
rowPadding: a + s,
|
|
970
|
+
style: o
|
|
971
|
+
}).join(`
|
|
972
|
+
${t}`)}
|
|
973
|
+
${r}
|
|
974
|
+
`;
|
|
975
|
+
}
|
|
976
|
+
default: {
|
|
977
|
+
let t = n ? `${_("cyan", A)} ` : "", r = i.split("\n").length, a = n ? 2 : 1;
|
|
978
|
+
return `${i}${t}${kt({
|
|
979
|
+
output: e.output,
|
|
980
|
+
options: this.options,
|
|
981
|
+
cursor: this.cursor,
|
|
982
|
+
maxItems: e.maxItems,
|
|
983
|
+
columnPadding: t.length,
|
|
984
|
+
rowPadding: r + a,
|
|
985
|
+
style: o
|
|
986
|
+
}).join(`
|
|
987
|
+
${t}`)}
|
|
988
|
+
${n ? _("cyan", j) : ""}
|
|
989
|
+
`;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}).prompt();
|
|
994
|
+
}, Ft = (e) => _("magenta", e), It = ({ indicator: e = "dots", onCancel: t, output: n = process.stdout, cancelMessage: r, errorMessage: i, frames: a = dt ? [
|
|
995
|
+
"◒",
|
|
996
|
+
"◐",
|
|
997
|
+
"◓",
|
|
998
|
+
"◑"
|
|
999
|
+
] : [
|
|
1000
|
+
"•",
|
|
1001
|
+
"o",
|
|
1002
|
+
"O",
|
|
1003
|
+
"0"
|
|
1004
|
+
], delay: o = dt ? 80 : 120, signal: s, ...c } = {}) => {
|
|
1005
|
+
let l = ft(), u, d, f = !1, p = !1, m = "", h, g = performance.now(), v = nt(n), y = c?.styleFrame ?? Ft, b = (e) => {
|
|
1006
|
+
let n = e > 1 ? i ?? D.messages.error : r ?? D.messages.cancel;
|
|
1007
|
+
p = e === 1, f && (oe(n, e), p && typeof t == "function" && t());
|
|
1008
|
+
}, x = () => b(2), S = () => b(1), ee = () => {
|
|
1009
|
+
process.on("uncaughtExceptionMonitor", x), process.on("unhandledRejection", x), process.on("SIGINT", S), process.on("SIGTERM", S), process.on("exit", b), s && s.addEventListener("abort", S);
|
|
1010
|
+
}, te = () => {
|
|
1011
|
+
process.removeListener("uncaughtExceptionMonitor", x), process.removeListener("unhandledRejection", x), process.removeListener("SIGINT", S), process.removeListener("SIGTERM", S), process.removeListener("exit", b), s && s.removeEventListener("abort", S);
|
|
1012
|
+
}, ne = () => {
|
|
1013
|
+
if (h === void 0) return;
|
|
1014
|
+
l && n.write("\n");
|
|
1015
|
+
let e = Ke(h, v, {
|
|
1016
|
+
hard: !0,
|
|
1017
|
+
trim: !1
|
|
1018
|
+
}).split("\n");
|
|
1019
|
+
e.length > 1 && n.write(E.cursor.up(e.length - 1)), n.write(E.cursor.to(0)), n.write(E.erase.down());
|
|
1020
|
+
}, re = (e) => e.replace(/\.+$/, ""), C = (e) => {
|
|
1021
|
+
let t = (performance.now() - e) / 1e3, n = Math.floor(t / 60), r = Math.floor(t % 60);
|
|
1022
|
+
return n > 0 ? `[${n}m ${r}s]` : `[${r}s]`;
|
|
1023
|
+
}, ie = c.withGuide ?? D.withGuide, ae = (t = "") => {
|
|
1024
|
+
f = !0, u = tt({ output: n }), m = re(t), g = performance.now(), ie && n.write(`${_("gray", A)}
|
|
1025
|
+
`);
|
|
1026
|
+
let r = 0, i = 0;
|
|
1027
|
+
ee(), d = setInterval(() => {
|
|
1028
|
+
if (l && m === h) return;
|
|
1029
|
+
ne(), h = m;
|
|
1030
|
+
let t = y(a[r]), o;
|
|
1031
|
+
if (l) o = `${t} ${m}...`;
|
|
1032
|
+
else if (e === "timer") o = `${t} ${m} ${C(g)}`;
|
|
1033
|
+
else {
|
|
1034
|
+
let e = ".".repeat(Math.floor(i)).slice(0, 3);
|
|
1035
|
+
o = `${t} ${m}${e}`;
|
|
1036
|
+
}
|
|
1037
|
+
let s = Ke(o, v, {
|
|
1038
|
+
hard: !0,
|
|
1039
|
+
trim: !1
|
|
1040
|
+
});
|
|
1041
|
+
n.write(s), r = r + 1 < a.length ? r + 1 : 0, i = i < 4 ? i + .125 : 0;
|
|
1042
|
+
}, o);
|
|
1043
|
+
}, oe = (t = "", r = 0, i = !1) => {
|
|
1044
|
+
if (!f) return;
|
|
1045
|
+
f = !1, clearInterval(d), ne();
|
|
1046
|
+
let a = r === 0 ? _("green", gt) : r === 1 ? _("red", mt) : _("red", ht);
|
|
1047
|
+
m = t ?? m, i || (e === "timer" ? n.write(`${a} ${m} ${C(g)}
|
|
1048
|
+
`) : n.write(`${a} ${m}
|
|
1049
|
+
`)), te(), u();
|
|
1050
|
+
};
|
|
1051
|
+
return {
|
|
1052
|
+
start: ae,
|
|
1053
|
+
stop: (e = "") => oe(e, 0),
|
|
1054
|
+
message: (e = "") => {
|
|
1055
|
+
m = re(e ?? m);
|
|
1056
|
+
},
|
|
1057
|
+
cancel: (e = "") => oe(e, 1),
|
|
1058
|
+
error: (e = "") => oe(e, 2),
|
|
1059
|
+
clear: () => oe("", 0, !0),
|
|
1060
|
+
get isCancelled() {
|
|
1061
|
+
return p;
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
}, Lt = (e, t) => e.includes("\n") ? e.split("\n").map((e) => t(e)).join("\n") : t(e), Rt = (e) => {
|
|
1065
|
+
let t = (e, t) => {
|
|
1066
|
+
let n = e.label ?? String(e.value);
|
|
1067
|
+
switch (t) {
|
|
1068
|
+
case "disabled": return `${_("gray", vt)} ${Lt(n, (e) => _("gray", e))}${e.hint ? ` ${_("dim", `(${e.hint ?? "disabled"})`)}` : ""}`;
|
|
1069
|
+
case "selected": return `${Lt(n, (e) => _("dim", e))}`;
|
|
1070
|
+
case "active": return `${_("green", _t)} ${n}${e.hint ? ` ${_("dim", `(${e.hint})`)}` : ""}`;
|
|
1071
|
+
case "cancelled": return `${Lt(n, (e) => _(["strikethrough", "dim"], e))}`;
|
|
1072
|
+
default: return `${_("dim", vt)} ${Lt(n, (e) => _("dim", e))}`;
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
return new ct({
|
|
1076
|
+
options: e.options,
|
|
1077
|
+
signal: e.signal,
|
|
1078
|
+
input: e.input,
|
|
1079
|
+
output: e.output,
|
|
1080
|
+
initialValue: e.initialValue,
|
|
1081
|
+
render() {
|
|
1082
|
+
let n = e.withGuide ?? D.withGuide, r = `${Et(this.state)} `, i = `${Dt(this.state)} `, a = O(e.output, e.message, i, r), o = `${n ? `${_("gray", A)}
|
|
1083
|
+
` : ""}${a}
|
|
1084
|
+
`;
|
|
1085
|
+
switch (this.state) {
|
|
1086
|
+
case "submit": {
|
|
1087
|
+
let r = n ? `${_("gray", A)} ` : "";
|
|
1088
|
+
return `${o}${O(e.output, t(this.options[this.cursor], "selected"), r)}`;
|
|
1089
|
+
}
|
|
1090
|
+
case "cancel": {
|
|
1091
|
+
let r = n ? `${_("gray", A)} ` : "";
|
|
1092
|
+
return `${o}${O(e.output, t(this.options[this.cursor], "cancelled"), r)}${n ? `
|
|
1093
|
+
${_("gray", A)}` : ""}`;
|
|
1094
|
+
}
|
|
1095
|
+
default: {
|
|
1096
|
+
let r = n ? `${_("cyan", A)} ` : "", i = n ? _("cyan", j) : "", a = o.split("\n").length, s = n ? 2 : 1;
|
|
1097
|
+
return `${o}${r}${kt({
|
|
1098
|
+
output: e.output,
|
|
1099
|
+
cursor: this.cursor,
|
|
1100
|
+
options: this.options,
|
|
1101
|
+
maxItems: e.maxItems,
|
|
1102
|
+
columnPadding: r.length,
|
|
1103
|
+
rowPadding: a + s,
|
|
1104
|
+
style: (e, n) => t(e, e.disabled ? "disabled" : n ? "active" : "inactive")
|
|
1105
|
+
}).join(`
|
|
1106
|
+
${r}`)}
|
|
1107
|
+
${i}
|
|
1108
|
+
`;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}).prompt();
|
|
1113
|
+
}, zt = `${_("gray", A)} `, Bt = {
|
|
1114
|
+
message: async (e, { symbol: t = _("gray", A) } = {}) => {
|
|
1115
|
+
process.stdout.write(`${_("gray", A)}
|
|
1116
|
+
${t} `);
|
|
1117
|
+
let n = 3;
|
|
1118
|
+
for await (let t of e) {
|
|
1119
|
+
t = t.replace(/\n/g, `
|
|
1120
|
+
${zt}`), t.includes("\n") && (n = 3 + g(t.slice(t.lastIndexOf("\n"))).length);
|
|
1121
|
+
let e = g(t).length;
|
|
1122
|
+
n + e < process.stdout.columns ? (n += e, process.stdout.write(t)) : (process.stdout.write(`
|
|
1123
|
+
${zt}${t.trimStart()}`), n = 3 + g(t.trimStart()).length);
|
|
1124
|
+
}
|
|
1125
|
+
process.stdout.write("\n");
|
|
1126
|
+
},
|
|
1127
|
+
info: (e) => Bt.message(e, { symbol: _("blue", St) }),
|
|
1128
|
+
success: (e) => Bt.message(e, { symbol: _("green", Ct) }),
|
|
1129
|
+
step: (e) => Bt.message(e, { symbol: _("green", gt) }),
|
|
1130
|
+
warn: (e) => Bt.message(e, { symbol: _("yellow", wt) }),
|
|
1131
|
+
warning: (e) => Bt.warn(e),
|
|
1132
|
+
error: (e) => Bt.message(e, { symbol: _("red", Tt) })
|
|
1133
|
+
}, Vt = (e) => new lt({
|
|
1134
|
+
validate: e.validate,
|
|
1135
|
+
placeholder: e.placeholder,
|
|
1136
|
+
defaultValue: e.defaultValue,
|
|
1137
|
+
initialValue: e.initialValue,
|
|
1138
|
+
output: e.output,
|
|
1139
|
+
signal: e.signal,
|
|
1140
|
+
input: e.input,
|
|
1141
|
+
render() {
|
|
1142
|
+
let t = e?.withGuide ?? D.withGuide, n = `${`${t ? `${_("gray", A)}
|
|
1143
|
+
` : ""}${Et(this.state)} `}${e.message}
|
|
1144
|
+
`, r = e.placeholder ? _("inverse", e.placeholder[0]) + _("dim", e.placeholder.slice(1)) : _(["inverse", "hidden"], "_"), i = this.userInput ? this.userInputWithCursor : r, a = this.value ?? "";
|
|
1145
|
+
switch (this.state) {
|
|
1146
|
+
case "error": {
|
|
1147
|
+
let e = this.error ? ` ${_("yellow", this.error)}` : "", r = t ? `${_("yellow", A)} ` : "", a = t ? _("yellow", j) : "";
|
|
1148
|
+
return `${n.trim()}
|
|
1149
|
+
${r}${i}
|
|
1150
|
+
${a}${e}
|
|
1151
|
+
`;
|
|
1152
|
+
}
|
|
1153
|
+
case "submit": {
|
|
1154
|
+
let e = a ? ` ${_("dim", a)}` : "";
|
|
1155
|
+
return `${n}${t ? _("gray", A) : ""}${e}`;
|
|
1156
|
+
}
|
|
1157
|
+
case "cancel": {
|
|
1158
|
+
let e = a ? ` ${_(["strikethrough", "dim"], a)}` : "", r = t ? _("gray", A) : "";
|
|
1159
|
+
return `${n}${r}${e}${a.trim() ? `
|
|
1160
|
+
${r}` : ""}`;
|
|
1161
|
+
}
|
|
1162
|
+
default: return `${n}${t ? `${_("cyan", A)} ` : ""}${i}
|
|
1163
|
+
${t ? _("cyan", j) : ""}
|
|
1164
|
+
`;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}).prompt(), P = (/* @__PURE__ */ ce(((e, t) => {
|
|
1168
|
+
var n = String, r = function() {
|
|
1169
|
+
return {
|
|
1170
|
+
isColorSupported: !1,
|
|
1171
|
+
reset: n,
|
|
1172
|
+
bold: n,
|
|
1173
|
+
dim: n,
|
|
1174
|
+
italic: n,
|
|
1175
|
+
underline: n,
|
|
1176
|
+
inverse: n,
|
|
1177
|
+
hidden: n,
|
|
1178
|
+
strikethrough: n,
|
|
1179
|
+
black: n,
|
|
1180
|
+
red: n,
|
|
1181
|
+
green: n,
|
|
1182
|
+
yellow: n,
|
|
1183
|
+
blue: n,
|
|
1184
|
+
magenta: n,
|
|
1185
|
+
cyan: n,
|
|
1186
|
+
white: n,
|
|
1187
|
+
gray: n,
|
|
1188
|
+
bgBlack: n,
|
|
1189
|
+
bgRed: n,
|
|
1190
|
+
bgGreen: n,
|
|
1191
|
+
bgYellow: n,
|
|
1192
|
+
bgBlue: n,
|
|
1193
|
+
bgMagenta: n,
|
|
1194
|
+
bgCyan: n,
|
|
1195
|
+
bgWhite: n,
|
|
1196
|
+
blackBright: n,
|
|
1197
|
+
redBright: n,
|
|
1198
|
+
greenBright: n,
|
|
1199
|
+
yellowBright: n,
|
|
1200
|
+
blueBright: n,
|
|
1201
|
+
magentaBright: n,
|
|
1202
|
+
cyanBright: n,
|
|
1203
|
+
whiteBright: n,
|
|
1204
|
+
bgBlackBright: n,
|
|
1205
|
+
bgRedBright: n,
|
|
1206
|
+
bgGreenBright: n,
|
|
1207
|
+
bgYellowBright: n,
|
|
1208
|
+
bgBlueBright: n,
|
|
1209
|
+
bgMagentaBright: n,
|
|
1210
|
+
bgCyanBright: n,
|
|
1211
|
+
bgWhiteBright: n
|
|
1212
|
+
};
|
|
1213
|
+
};
|
|
1214
|
+
t.exports = r(), t.exports.createColors = r;
|
|
1215
|
+
})))();
|
|
1216
|
+
function Ht(e) {
|
|
1217
|
+
return e.hint ? {
|
|
1218
|
+
label: e.title,
|
|
1219
|
+
value: e.value,
|
|
1220
|
+
hint: e.hint
|
|
1221
|
+
} : {
|
|
1222
|
+
label: e.title,
|
|
1223
|
+
value: e.value
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
async function Ut({ message: e, placeholder: t, cancelMessage: n = "Selection canceled.", errorMessage: r = "Failed to select an option" }) {
|
|
1227
|
+
let { checkPromiseReturn: i, createNg: a } = w, o = await i({
|
|
1228
|
+
fn: async () => await Vt({
|
|
1229
|
+
message: e,
|
|
1230
|
+
placeholder: t
|
|
1231
|
+
}),
|
|
1232
|
+
err: (e) => a(ge(r, e))
|
|
1233
|
+
});
|
|
1234
|
+
return o.isErr || $e(o.value) && (N(n), process.exit(0)), o;
|
|
1235
|
+
}
|
|
1236
|
+
async function Wt({ message: e, placeholder: t, cancelMessage: n = "Selection canceled.", errorMessage: r = "Failed to select an option" }) {
|
|
1237
|
+
let { checkPromiseReturn: i, createNg: a } = w;
|
|
1238
|
+
M.message(`${(0, P.bold)("To send, press the Tab key and then press Enter.")}\n`), D.actions.delete("space");
|
|
1239
|
+
let o = await i({
|
|
1240
|
+
fn: async () => await Mt({
|
|
1241
|
+
message: e,
|
|
1242
|
+
placeholder: t,
|
|
1243
|
+
showSubmit: !0
|
|
1244
|
+
}),
|
|
1245
|
+
err: (e) => a(ge(r, e))
|
|
1246
|
+
});
|
|
1247
|
+
return D.actions.add("space"), o.isErr || $e(o.value) && (N(n), process.exit(0)), o;
|
|
1248
|
+
}
|
|
1249
|
+
async function Gt({ message: e, options: t, cancelMessage: n = "Selection canceled.", errorMessage: r = "Failed to select an option" }) {
|
|
1250
|
+
let { createNg: i, createOk: a, checkPromiseReturn: o } = w, s = t.find((e) => e.selected)?.value, c = await o({
|
|
1251
|
+
fn: async () => await Rt({
|
|
1252
|
+
message: e,
|
|
1253
|
+
initialValue: s,
|
|
1254
|
+
options: t.map((e) => Ht(e))
|
|
1255
|
+
}),
|
|
1256
|
+
err: (e) => i(ge(r, e))
|
|
1257
|
+
});
|
|
1258
|
+
return c.isErr ? c : ($e(c.value) && (N(n), process.exit(0)), a(c.value));
|
|
1259
|
+
}
|
|
1260
|
+
async function Kt({ message: e, options: t, required: n, cancelMessage: r = "Selection canceled.", errorMessage: i = "Failed to select options" }) {
|
|
1261
|
+
let { createNg: a, createOk: o, checkPromiseReturn: s } = w, c = t.filter((e) => e.selected).map((e) => e.value), l = await s({
|
|
1262
|
+
fn: async () => await Pt({
|
|
1263
|
+
message: e,
|
|
1264
|
+
required: n,
|
|
1265
|
+
initialValues: c,
|
|
1266
|
+
options: t.map((e) => Ht(e))
|
|
1267
|
+
}),
|
|
1268
|
+
err: (e) => a(ge(i, e))
|
|
1269
|
+
});
|
|
1270
|
+
return l.isErr ? l : ($e(l.value) && (N(r), process.exit(0)), o(l.value));
|
|
1271
|
+
}
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region src/command/init.ts
|
|
1274
|
+
var qt = [{
|
|
1275
|
+
title: "Bug report",
|
|
1276
|
+
value: "bug_report",
|
|
1277
|
+
selected: !0
|
|
1278
|
+
}, {
|
|
1279
|
+
title: "Feature request",
|
|
1280
|
+
value: "feature_request",
|
|
1281
|
+
selected: !0
|
|
1282
|
+
}], Jt = [{
|
|
1283
|
+
title: "English",
|
|
1284
|
+
value: "en",
|
|
1285
|
+
selected: !0
|
|
1286
|
+
}, {
|
|
1287
|
+
title: "Japanese",
|
|
1288
|
+
value: "ja",
|
|
1289
|
+
selected: !1
|
|
1290
|
+
}];
|
|
1291
|
+
async function Yt() {
|
|
1292
|
+
return await Kt({
|
|
1293
|
+
message: "Select issue template types",
|
|
1294
|
+
options: qt,
|
|
1295
|
+
cancelMessage: "No template types selected. Canceled.",
|
|
1296
|
+
errorMessage: "Failed to select issue template types"
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
async function Xt() {
|
|
1300
|
+
return await Kt({
|
|
1301
|
+
message: "Select template languages",
|
|
1302
|
+
options: Jt,
|
|
1303
|
+
cancelMessage: "No languages selected. Canceled.",
|
|
1304
|
+
errorMessage: "Failed to select template languages"
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
async function Zt() {
|
|
1308
|
+
let { checkPromiseReturn: e, createNg: t, createOk: n } = w, r = await e({
|
|
1309
|
+
fn: async () => await At({ message: "This will create issue templates in .github/ISSUE_TEMPLATE. Do you want to continue?" }),
|
|
1310
|
+
err: (e) => t(ge("Failed to get user confirmation", e))
|
|
1311
|
+
});
|
|
1312
|
+
return r.isErr ? r : ($e(r.value) && (N("Initialization canceled."), process.exit(0)), n(r.value));
|
|
1313
|
+
}
|
|
1314
|
+
async function Qt() {
|
|
1315
|
+
let { checkPromiseReturn: e, createNg: t, createOk: n } = w, r = await e({
|
|
1316
|
+
fn: async () => await At({ message: "Do you want to create issue templates in .github/ISSUE_TEMPLATE?" }),
|
|
1317
|
+
err: (e) => t(ge("Failed to get user confirmation", e))
|
|
1318
|
+
});
|
|
1319
|
+
return r.isErr ? r : ($e(r.value) && (N("Initialization canceled."), process.exit(0)), n(r.value));
|
|
1320
|
+
}
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region src/action/init.ts
|
|
1323
|
+
async function $t() {
|
|
1324
|
+
let e = f(process.cwd(), ".gh-issue"), t = f(e, "README.md"), r = It();
|
|
1325
|
+
o(e) && (N(".gh-issue already exists. Initialization has already been completed."), process.exit(0));
|
|
1326
|
+
let i = await Qt();
|
|
1327
|
+
i.isErr && (M.error(`Error: ${i.err.message}`), process.exit(1)), i.value || (await n(e, { recursive: !0 }), o(t) || await a(t, "# gh-issue-kit\n\nThis directory is managed by gh-issue-kit."), jt("All done!"), process.exit(0));
|
|
1328
|
+
let s = await Yt();
|
|
1329
|
+
s.isErr && (M.error(`Error: ${s.err.message}`), process.exit(1)), s.value.length === 0 && (N("No template types selected. Canceled."), process.exit(0));
|
|
1330
|
+
let c = await Xt();
|
|
1331
|
+
c.isErr && (M.error(`Error: ${c.err.message}`), process.exit(1)), c.value.length === 0 && (N("No languages selected. Canceled."), process.exit(0));
|
|
1332
|
+
let l = await Zt();
|
|
1333
|
+
l.isErr && (M.error(`Error: ${l.err.message}`), process.exit(1)), l.value || (N("Canceled."), process.exit(0));
|
|
1334
|
+
let u = [];
|
|
1335
|
+
for (let e of c.value) for (let t of s.value) u.push({
|
|
1336
|
+
lang: e,
|
|
1337
|
+
file: `${t}_${e}.yml`
|
|
1338
|
+
});
|
|
1339
|
+
let p = f(process.cwd(), ".github"), h = f(p, "ISSUE_TEMPLATE"), g = f(d(m(import.meta.url)), "template");
|
|
1340
|
+
await n(p, { recursive: !0 }), await n(h, { recursive: !0 }), r.start("Creating issue templates...");
|
|
1341
|
+
for (let e of u) {
|
|
1342
|
+
let t = f(h, e.file);
|
|
1343
|
+
if (o(t)) {
|
|
1344
|
+
r.error(`Already exists ${t}. Skipped.`);
|
|
1345
|
+
continue;
|
|
1346
|
+
}
|
|
1347
|
+
let n = f(g, e.lang);
|
|
1348
|
+
r.message(`Creating ${e.file}...`);
|
|
1349
|
+
let i = await he(e.file, h, {
|
|
1350
|
+
parents: !1,
|
|
1351
|
+
cwd: n
|
|
1352
|
+
});
|
|
1353
|
+
i.isErr && (r.error(`Error: ${i.err.message}`), process.exit(1)), r.message(`Created ${t}\n`);
|
|
1354
|
+
}
|
|
1355
|
+
r.stop(), await n(e, { recursive: !0 }), o(t) || await a(t, "# gh-issue-kit\n\nThis directory is managed by gh-issue-kit."), jt("All done!");
|
|
1356
|
+
}
|
|
1357
|
+
//#endregion
|
|
1358
|
+
//#region src/helper/find-template.ts
|
|
1359
|
+
function en() {
|
|
1360
|
+
let { createNg: e, createOk: t } = w, n = C(process.cwd(), ".github", "ISSUE_TEMPLATE");
|
|
1361
|
+
if (!o(n)) return e(/* @__PURE__ */ Error(".github/ISSUE_TEMPLATE directory does not exist"));
|
|
1362
|
+
let r = c(n, { withFileTypes: !0 }).filter((e) => e.isFile()).map((e) => e.name);
|
|
1363
|
+
return r.length === 0 ? e(/* @__PURE__ */ Error("No issue templates found in .github/ISSUE_TEMPLATE")) : t(r);
|
|
1364
|
+
}
|
|
1365
|
+
//#endregion
|
|
1366
|
+
//#region node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
1367
|
+
function tn(e) {
|
|
1368
|
+
return e == null;
|
|
1369
|
+
}
|
|
1370
|
+
function nn(e) {
|
|
1371
|
+
return typeof e == "object" && !!e;
|
|
1372
|
+
}
|
|
1373
|
+
function rn(e) {
|
|
1374
|
+
return Array.isArray(e) ? e : tn(e) ? [] : [e];
|
|
1375
|
+
}
|
|
1376
|
+
function an(e, t) {
|
|
1377
|
+
var n, r, i, a;
|
|
1378
|
+
if (t) for (a = Object.keys(t), n = 0, r = a.length; n < r; n += 1) i = a[n], e[i] = t[i];
|
|
1379
|
+
return e;
|
|
1380
|
+
}
|
|
1381
|
+
function on(e, t) {
|
|
1382
|
+
var n = "", r;
|
|
1383
|
+
for (r = 0; r < t; r += 1) n += e;
|
|
1384
|
+
return n;
|
|
1385
|
+
}
|
|
1386
|
+
function sn(e) {
|
|
1387
|
+
return e === 0 && 1 / e == -Infinity;
|
|
1388
|
+
}
|
|
1389
|
+
var F = {
|
|
1390
|
+
isNothing: tn,
|
|
1391
|
+
isObject: nn,
|
|
1392
|
+
toArray: rn,
|
|
1393
|
+
repeat: on,
|
|
1394
|
+
isNegativeZero: sn,
|
|
1395
|
+
extend: an
|
|
1396
|
+
};
|
|
1397
|
+
function cn(e, t) {
|
|
1398
|
+
var n = "", r = e.reason || "(unknown reason)";
|
|
1399
|
+
return e.mark ? (e.mark.name && (n += "in \"" + e.mark.name + "\" "), n += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !t && e.mark.snippet && (n += "\n\n" + e.mark.snippet), r + " " + n) : r;
|
|
1400
|
+
}
|
|
1401
|
+
function ln(e, t) {
|
|
1402
|
+
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = t, this.message = cn(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = (/* @__PURE__ */ Error()).stack || "";
|
|
1403
|
+
}
|
|
1404
|
+
ln.prototype = Object.create(Error.prototype), ln.prototype.constructor = ln, ln.prototype.toString = function(e) {
|
|
1405
|
+
return this.name + ": " + cn(this, e);
|
|
1406
|
+
};
|
|
1407
|
+
var I = ln;
|
|
1408
|
+
function un(e, t, n, r, i) {
|
|
1409
|
+
var a = "", o = "", s = Math.floor(i / 2) - 1;
|
|
1410
|
+
return r - t > s && (a = " ... ", t = r - s + a.length), n - r > s && (o = " ...", n = r + s - o.length), {
|
|
1411
|
+
str: a + e.slice(t, n).replace(/\t/g, "→") + o,
|
|
1412
|
+
pos: r - t + a.length
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function dn(e, t) {
|
|
1416
|
+
return F.repeat(" ", t - e.length) + e;
|
|
1417
|
+
}
|
|
1418
|
+
function fn(e, t) {
|
|
1419
|
+
if (t = Object.create(t || null), !e.buffer) return null;
|
|
1420
|
+
t.maxLength ||= 79, typeof t.indent != "number" && (t.indent = 1), typeof t.linesBefore != "number" && (t.linesBefore = 3), typeof t.linesAfter != "number" && (t.linesAfter = 2);
|
|
1421
|
+
for (var n = /\r?\n|\r|\0/g, r = [0], i = [], a, o = -1; a = n.exec(e.buffer);) i.push(a.index), r.push(a.index + a[0].length), e.position <= a.index && o < 0 && (o = r.length - 2);
|
|
1422
|
+
o < 0 && (o = r.length - 1);
|
|
1423
|
+
var s = "", c, l, u = Math.min(e.line + t.linesAfter, i.length).toString().length, d = t.maxLength - (t.indent + u + 3);
|
|
1424
|
+
for (c = 1; c <= t.linesBefore && !(o - c < 0); c++) l = un(e.buffer, r[o - c], i[o - c], e.position - (r[o] - r[o - c]), d), s = F.repeat(" ", t.indent) + dn((e.line - c + 1).toString(), u) + " | " + l.str + "\n" + s;
|
|
1425
|
+
for (l = un(e.buffer, r[o], i[o], e.position, d), s += F.repeat(" ", t.indent) + dn((e.line + 1).toString(), u) + " | " + l.str + "\n", s += F.repeat("-", t.indent + u + 3 + l.pos) + "^\n", c = 1; c <= t.linesAfter && !(o + c >= i.length); c++) l = un(e.buffer, r[o + c], i[o + c], e.position - (r[o] - r[o + c]), d), s += F.repeat(" ", t.indent) + dn((e.line + c + 1).toString(), u) + " | " + l.str + "\n";
|
|
1426
|
+
return s.replace(/\n$/, "");
|
|
1427
|
+
}
|
|
1428
|
+
var pn = fn, mn = [
|
|
1429
|
+
"kind",
|
|
1430
|
+
"multi",
|
|
1431
|
+
"resolve",
|
|
1432
|
+
"construct",
|
|
1433
|
+
"instanceOf",
|
|
1434
|
+
"predicate",
|
|
1435
|
+
"represent",
|
|
1436
|
+
"representName",
|
|
1437
|
+
"defaultStyle",
|
|
1438
|
+
"styleAliases"
|
|
1439
|
+
], hn = [
|
|
1440
|
+
"scalar",
|
|
1441
|
+
"sequence",
|
|
1442
|
+
"mapping"
|
|
1443
|
+
];
|
|
1444
|
+
function gn(e) {
|
|
1445
|
+
var t = {};
|
|
1446
|
+
return e !== null && Object.keys(e).forEach(function(n) {
|
|
1447
|
+
e[n].forEach(function(e) {
|
|
1448
|
+
t[String(e)] = n;
|
|
1449
|
+
});
|
|
1450
|
+
}), t;
|
|
1451
|
+
}
|
|
1452
|
+
function _n(e, t) {
|
|
1453
|
+
if (t ||= {}, Object.keys(t).forEach(function(t) {
|
|
1454
|
+
if (mn.indexOf(t) === -1) throw new I("Unknown option \"" + t + "\" is met in definition of \"" + e + "\" YAML type.");
|
|
1455
|
+
}), this.options = t, this.tag = e, this.kind = t.kind || null, this.resolve = t.resolve || function() {
|
|
1456
|
+
return !0;
|
|
1457
|
+
}, this.construct = t.construct || function(e) {
|
|
1458
|
+
return e;
|
|
1459
|
+
}, this.instanceOf = t.instanceOf || null, this.predicate = t.predicate || null, this.represent = t.represent || null, this.representName = t.representName || null, this.defaultStyle = t.defaultStyle || null, this.multi = t.multi || !1, this.styleAliases = gn(t.styleAliases || null), hn.indexOf(this.kind) === -1) throw new I("Unknown kind \"" + this.kind + "\" is specified for \"" + e + "\" YAML type.");
|
|
1460
|
+
}
|
|
1461
|
+
var L = _n;
|
|
1462
|
+
function vn(e, t) {
|
|
1463
|
+
var n = [];
|
|
1464
|
+
return e[t].forEach(function(e) {
|
|
1465
|
+
var t = n.length;
|
|
1466
|
+
n.forEach(function(n, r) {
|
|
1467
|
+
n.tag === e.tag && n.kind === e.kind && n.multi === e.multi && (t = r);
|
|
1468
|
+
}), n[t] = e;
|
|
1469
|
+
}), n;
|
|
1470
|
+
}
|
|
1471
|
+
function yn() {
|
|
1472
|
+
var e = {
|
|
1473
|
+
scalar: {},
|
|
1474
|
+
sequence: {},
|
|
1475
|
+
mapping: {},
|
|
1476
|
+
fallback: {},
|
|
1477
|
+
multi: {
|
|
1478
|
+
scalar: [],
|
|
1479
|
+
sequence: [],
|
|
1480
|
+
mapping: [],
|
|
1481
|
+
fallback: []
|
|
1482
|
+
}
|
|
1483
|
+
}, t, n;
|
|
1484
|
+
function r(t) {
|
|
1485
|
+
t.multi ? (e.multi[t.kind].push(t), e.multi.fallback.push(t)) : e[t.kind][t.tag] = e.fallback[t.tag] = t;
|
|
1486
|
+
}
|
|
1487
|
+
for (t = 0, n = arguments.length; t < n; t += 1) arguments[t].forEach(r);
|
|
1488
|
+
return e;
|
|
1489
|
+
}
|
|
1490
|
+
function bn(e) {
|
|
1491
|
+
return this.extend(e);
|
|
1492
|
+
}
|
|
1493
|
+
bn.prototype.extend = function(e) {
|
|
1494
|
+
var t = [], n = [];
|
|
1495
|
+
if (e instanceof L) n.push(e);
|
|
1496
|
+
else if (Array.isArray(e)) n = n.concat(e);
|
|
1497
|
+
else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit))) e.implicit && (t = t.concat(e.implicit)), e.explicit && (n = n.concat(e.explicit));
|
|
1498
|
+
else throw new I("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
1499
|
+
t.forEach(function(e) {
|
|
1500
|
+
if (!(e instanceof L)) throw new I("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
1501
|
+
if (e.loadKind && e.loadKind !== "scalar") throw new I("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
1502
|
+
if (e.multi) throw new I("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
1503
|
+
}), n.forEach(function(e) {
|
|
1504
|
+
if (!(e instanceof L)) throw new I("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
1505
|
+
});
|
|
1506
|
+
var r = Object.create(bn.prototype);
|
|
1507
|
+
return r.implicit = (this.implicit || []).concat(t), r.explicit = (this.explicit || []).concat(n), r.compiledImplicit = vn(r, "implicit"), r.compiledExplicit = vn(r, "explicit"), r.compiledTypeMap = yn(r.compiledImplicit, r.compiledExplicit), r;
|
|
1508
|
+
};
|
|
1509
|
+
var xn = new bn({ explicit: [
|
|
1510
|
+
new L("tag:yaml.org,2002:str", {
|
|
1511
|
+
kind: "scalar",
|
|
1512
|
+
construct: function(e) {
|
|
1513
|
+
return e === null ? "" : e;
|
|
1514
|
+
}
|
|
1515
|
+
}),
|
|
1516
|
+
new L("tag:yaml.org,2002:seq", {
|
|
1517
|
+
kind: "sequence",
|
|
1518
|
+
construct: function(e) {
|
|
1519
|
+
return e === null ? [] : e;
|
|
1520
|
+
}
|
|
1521
|
+
}),
|
|
1522
|
+
new L("tag:yaml.org,2002:map", {
|
|
1523
|
+
kind: "mapping",
|
|
1524
|
+
construct: function(e) {
|
|
1525
|
+
return e === null ? {} : e;
|
|
1526
|
+
}
|
|
1527
|
+
})
|
|
1528
|
+
] });
|
|
1529
|
+
function Sn(e) {
|
|
1530
|
+
if (e === null) return !0;
|
|
1531
|
+
var t = e.length;
|
|
1532
|
+
return t === 1 && e === "~" || t === 4 && (e === "null" || e === "Null" || e === "NULL");
|
|
1533
|
+
}
|
|
1534
|
+
function Cn() {
|
|
1535
|
+
return null;
|
|
1536
|
+
}
|
|
1537
|
+
function wn(e) {
|
|
1538
|
+
return e === null;
|
|
1539
|
+
}
|
|
1540
|
+
var Tn = new L("tag:yaml.org,2002:null", {
|
|
1541
|
+
kind: "scalar",
|
|
1542
|
+
resolve: Sn,
|
|
1543
|
+
construct: Cn,
|
|
1544
|
+
predicate: wn,
|
|
1545
|
+
represent: {
|
|
1546
|
+
canonical: function() {
|
|
1547
|
+
return "~";
|
|
1548
|
+
},
|
|
1549
|
+
lowercase: function() {
|
|
1550
|
+
return "null";
|
|
1551
|
+
},
|
|
1552
|
+
uppercase: function() {
|
|
1553
|
+
return "NULL";
|
|
1554
|
+
},
|
|
1555
|
+
camelcase: function() {
|
|
1556
|
+
return "Null";
|
|
1557
|
+
},
|
|
1558
|
+
empty: function() {
|
|
1559
|
+
return "";
|
|
1560
|
+
}
|
|
1561
|
+
},
|
|
1562
|
+
defaultStyle: "lowercase"
|
|
1563
|
+
});
|
|
1564
|
+
function En(e) {
|
|
1565
|
+
if (e === null) return !1;
|
|
1566
|
+
var t = e.length;
|
|
1567
|
+
return t === 4 && (e === "true" || e === "True" || e === "TRUE") || t === 5 && (e === "false" || e === "False" || e === "FALSE");
|
|
1568
|
+
}
|
|
1569
|
+
function Dn(e) {
|
|
1570
|
+
return e === "true" || e === "True" || e === "TRUE";
|
|
1571
|
+
}
|
|
1572
|
+
function On(e) {
|
|
1573
|
+
return Object.prototype.toString.call(e) === "[object Boolean]";
|
|
1574
|
+
}
|
|
1575
|
+
var kn = new L("tag:yaml.org,2002:bool", {
|
|
1576
|
+
kind: "scalar",
|
|
1577
|
+
resolve: En,
|
|
1578
|
+
construct: Dn,
|
|
1579
|
+
predicate: On,
|
|
1580
|
+
represent: {
|
|
1581
|
+
lowercase: function(e) {
|
|
1582
|
+
return e ? "true" : "false";
|
|
1583
|
+
},
|
|
1584
|
+
uppercase: function(e) {
|
|
1585
|
+
return e ? "TRUE" : "FALSE";
|
|
1586
|
+
},
|
|
1587
|
+
camelcase: function(e) {
|
|
1588
|
+
return e ? "True" : "False";
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
defaultStyle: "lowercase"
|
|
1592
|
+
});
|
|
1593
|
+
function An(e) {
|
|
1594
|
+
return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
|
|
1595
|
+
}
|
|
1596
|
+
function jn(e) {
|
|
1597
|
+
return 48 <= e && e <= 55;
|
|
1598
|
+
}
|
|
1599
|
+
function Mn(e) {
|
|
1600
|
+
return 48 <= e && e <= 57;
|
|
1601
|
+
}
|
|
1602
|
+
function Nn(e) {
|
|
1603
|
+
if (e === null) return !1;
|
|
1604
|
+
var t = e.length, n = 0, r = !1, i;
|
|
1605
|
+
if (!t) return !1;
|
|
1606
|
+
if (i = e[n], (i === "-" || i === "+") && (i = e[++n]), i === "0") {
|
|
1607
|
+
if (n + 1 === t) return !0;
|
|
1608
|
+
if (i = e[++n], i === "b") {
|
|
1609
|
+
for (n++; n < t; n++) if (i = e[n], i !== "_") {
|
|
1610
|
+
if (i !== "0" && i !== "1") return !1;
|
|
1611
|
+
r = !0;
|
|
1612
|
+
}
|
|
1613
|
+
return r && i !== "_";
|
|
1614
|
+
}
|
|
1615
|
+
if (i === "x") {
|
|
1616
|
+
for (n++; n < t; n++) if (i = e[n], i !== "_") {
|
|
1617
|
+
if (!An(e.charCodeAt(n))) return !1;
|
|
1618
|
+
r = !0;
|
|
1619
|
+
}
|
|
1620
|
+
return r && i !== "_";
|
|
1621
|
+
}
|
|
1622
|
+
if (i === "o") {
|
|
1623
|
+
for (n++; n < t; n++) if (i = e[n], i !== "_") {
|
|
1624
|
+
if (!jn(e.charCodeAt(n))) return !1;
|
|
1625
|
+
r = !0;
|
|
1626
|
+
}
|
|
1627
|
+
return r && i !== "_";
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
if (i === "_") return !1;
|
|
1631
|
+
for (; n < t; n++) if (i = e[n], i !== "_") {
|
|
1632
|
+
if (!Mn(e.charCodeAt(n))) return !1;
|
|
1633
|
+
r = !0;
|
|
1634
|
+
}
|
|
1635
|
+
return !(!r || i === "_");
|
|
1636
|
+
}
|
|
1637
|
+
function Pn(e) {
|
|
1638
|
+
var t = e, n = 1, r;
|
|
1639
|
+
if (t.indexOf("_") !== -1 && (t = t.replace(/_/g, "")), r = t[0], (r === "-" || r === "+") && (r === "-" && (n = -1), t = t.slice(1), r = t[0]), t === "0") return 0;
|
|
1640
|
+
if (r === "0") {
|
|
1641
|
+
if (t[1] === "b") return n * parseInt(t.slice(2), 2);
|
|
1642
|
+
if (t[1] === "x") return n * parseInt(t.slice(2), 16);
|
|
1643
|
+
if (t[1] === "o") return n * parseInt(t.slice(2), 8);
|
|
1644
|
+
}
|
|
1645
|
+
return n * parseInt(t, 10);
|
|
1646
|
+
}
|
|
1647
|
+
function Fn(e) {
|
|
1648
|
+
return Object.prototype.toString.call(e) === "[object Number]" && e % 1 == 0 && !F.isNegativeZero(e);
|
|
1649
|
+
}
|
|
1650
|
+
var In = new L("tag:yaml.org,2002:int", {
|
|
1651
|
+
kind: "scalar",
|
|
1652
|
+
resolve: Nn,
|
|
1653
|
+
construct: Pn,
|
|
1654
|
+
predicate: Fn,
|
|
1655
|
+
represent: {
|
|
1656
|
+
binary: function(e) {
|
|
1657
|
+
return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1);
|
|
1658
|
+
},
|
|
1659
|
+
octal: function(e) {
|
|
1660
|
+
return e >= 0 ? "0o" + e.toString(8) : "-0o" + e.toString(8).slice(1);
|
|
1661
|
+
},
|
|
1662
|
+
decimal: function(e) {
|
|
1663
|
+
return e.toString(10);
|
|
1664
|
+
},
|
|
1665
|
+
hexadecimal: function(e) {
|
|
1666
|
+
return e >= 0 ? "0x" + e.toString(16).toUpperCase() : "-0x" + e.toString(16).toUpperCase().slice(1);
|
|
1667
|
+
}
|
|
1668
|
+
},
|
|
1669
|
+
defaultStyle: "decimal",
|
|
1670
|
+
styleAliases: {
|
|
1671
|
+
binary: [2, "bin"],
|
|
1672
|
+
octal: [8, "oct"],
|
|
1673
|
+
decimal: [10, "dec"],
|
|
1674
|
+
hexadecimal: [16, "hex"]
|
|
1675
|
+
}
|
|
1676
|
+
}), Ln = /* @__PURE__ */ RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
1677
|
+
function Rn(e) {
|
|
1678
|
+
return !(e === null || !Ln.test(e) || e[e.length - 1] === "_");
|
|
1679
|
+
}
|
|
1680
|
+
function zn(e) {
|
|
1681
|
+
var t = e.replace(/_/g, "").toLowerCase(), n = t[0] === "-" ? -1 : 1;
|
|
1682
|
+
return "+-".indexOf(t[0]) >= 0 && (t = t.slice(1)), t === ".inf" ? n === 1 ? Infinity : -Infinity : t === ".nan" ? NaN : n * parseFloat(t, 10);
|
|
1683
|
+
}
|
|
1684
|
+
var Bn = /^[-+]?[0-9]+e/;
|
|
1685
|
+
function Vn(e, t) {
|
|
1686
|
+
var n;
|
|
1687
|
+
if (isNaN(e)) switch (t) {
|
|
1688
|
+
case "lowercase": return ".nan";
|
|
1689
|
+
case "uppercase": return ".NAN";
|
|
1690
|
+
case "camelcase": return ".NaN";
|
|
1691
|
+
}
|
|
1692
|
+
else if (e === Infinity) switch (t) {
|
|
1693
|
+
case "lowercase": return ".inf";
|
|
1694
|
+
case "uppercase": return ".INF";
|
|
1695
|
+
case "camelcase": return ".Inf";
|
|
1696
|
+
}
|
|
1697
|
+
else if (e === -Infinity) switch (t) {
|
|
1698
|
+
case "lowercase": return "-.inf";
|
|
1699
|
+
case "uppercase": return "-.INF";
|
|
1700
|
+
case "camelcase": return "-.Inf";
|
|
1701
|
+
}
|
|
1702
|
+
else if (F.isNegativeZero(e)) return "-0.0";
|
|
1703
|
+
return n = e.toString(10), Bn.test(n) ? n.replace("e", ".e") : n;
|
|
1704
|
+
}
|
|
1705
|
+
function Hn(e) {
|
|
1706
|
+
return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 != 0 || F.isNegativeZero(e));
|
|
1707
|
+
}
|
|
1708
|
+
var Un = new L("tag:yaml.org,2002:float", {
|
|
1709
|
+
kind: "scalar",
|
|
1710
|
+
resolve: Rn,
|
|
1711
|
+
construct: zn,
|
|
1712
|
+
predicate: Hn,
|
|
1713
|
+
represent: Vn,
|
|
1714
|
+
defaultStyle: "lowercase"
|
|
1715
|
+
}), Wn = xn.extend({ implicit: [
|
|
1716
|
+
Tn,
|
|
1717
|
+
kn,
|
|
1718
|
+
In,
|
|
1719
|
+
Un
|
|
1720
|
+
] }), Gn = /* @__PURE__ */ RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"), Kn = /* @__PURE__ */ RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
1721
|
+
function qn(e) {
|
|
1722
|
+
return e === null ? !1 : Gn.exec(e) !== null || Kn.exec(e) !== null;
|
|
1723
|
+
}
|
|
1724
|
+
function Jn(e) {
|
|
1725
|
+
var t, n, r, i, a, o, s, c = 0, l = null, u, d, f;
|
|
1726
|
+
if (t = Gn.exec(e), t === null && (t = Kn.exec(e)), t === null) throw Error("Date resolve error");
|
|
1727
|
+
if (n = +t[1], r = t[2] - 1, i = +t[3], !t[4]) return new Date(Date.UTC(n, r, i));
|
|
1728
|
+
if (a = +t[4], o = +t[5], s = +t[6], t[7]) {
|
|
1729
|
+
for (c = t[7].slice(0, 3); c.length < 3;) c += "0";
|
|
1730
|
+
c = +c;
|
|
1731
|
+
}
|
|
1732
|
+
return t[9] && (u = +t[10], d = +(t[11] || 0), l = (u * 60 + d) * 6e4, t[9] === "-" && (l = -l)), f = new Date(Date.UTC(n, r, i, a, o, s, c)), l && f.setTime(f.getTime() - l), f;
|
|
1733
|
+
}
|
|
1734
|
+
function Yn(e) {
|
|
1735
|
+
return e.toISOString();
|
|
1736
|
+
}
|
|
1737
|
+
var Xn = new L("tag:yaml.org,2002:timestamp", {
|
|
1738
|
+
kind: "scalar",
|
|
1739
|
+
resolve: qn,
|
|
1740
|
+
construct: Jn,
|
|
1741
|
+
instanceOf: Date,
|
|
1742
|
+
represent: Yn
|
|
1743
|
+
});
|
|
1744
|
+
function Zn(e) {
|
|
1745
|
+
return e === "<<" || e === null;
|
|
1746
|
+
}
|
|
1747
|
+
var Qn = new L("tag:yaml.org,2002:merge", {
|
|
1748
|
+
kind: "scalar",
|
|
1749
|
+
resolve: Zn
|
|
1750
|
+
}), $n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
1751
|
+
function er(e) {
|
|
1752
|
+
if (e === null) return !1;
|
|
1753
|
+
var t, n, r = 0, i = e.length, a = $n;
|
|
1754
|
+
for (n = 0; n < i; n++) if (t = a.indexOf(e.charAt(n)), !(t > 64)) {
|
|
1755
|
+
if (t < 0) return !1;
|
|
1756
|
+
r += 6;
|
|
1757
|
+
}
|
|
1758
|
+
return r % 8 == 0;
|
|
1759
|
+
}
|
|
1760
|
+
function tr(e) {
|
|
1761
|
+
var t, n, r = e.replace(/[\r\n=]/g, ""), i = r.length, a = $n, o = 0, s = [];
|
|
1762
|
+
for (t = 0; t < i; t++) t % 4 == 0 && t && (s.push(o >> 16 & 255), s.push(o >> 8 & 255), s.push(o & 255)), o = o << 6 | a.indexOf(r.charAt(t));
|
|
1763
|
+
return n = i % 4 * 6, n === 0 ? (s.push(o >> 16 & 255), s.push(o >> 8 & 255), s.push(o & 255)) : n === 18 ? (s.push(o >> 10 & 255), s.push(o >> 2 & 255)) : n === 12 && s.push(o >> 4 & 255), new Uint8Array(s);
|
|
1764
|
+
}
|
|
1765
|
+
function nr(e) {
|
|
1766
|
+
var t = "", n = 0, r, i, a = e.length, o = $n;
|
|
1767
|
+
for (r = 0; r < a; r++) r % 3 == 0 && r && (t += o[n >> 18 & 63], t += o[n >> 12 & 63], t += o[n >> 6 & 63], t += o[n & 63]), n = (n << 8) + e[r];
|
|
1768
|
+
return i = a % 3, i === 0 ? (t += o[n >> 18 & 63], t += o[n >> 12 & 63], t += o[n >> 6 & 63], t += o[n & 63]) : i === 2 ? (t += o[n >> 10 & 63], t += o[n >> 4 & 63], t += o[n << 2 & 63], t += o[64]) : i === 1 && (t += o[n >> 2 & 63], t += o[n << 4 & 63], t += o[64], t += o[64]), t;
|
|
1769
|
+
}
|
|
1770
|
+
function rr(e) {
|
|
1771
|
+
return Object.prototype.toString.call(e) === "[object Uint8Array]";
|
|
1772
|
+
}
|
|
1773
|
+
var ir = new L("tag:yaml.org,2002:binary", {
|
|
1774
|
+
kind: "scalar",
|
|
1775
|
+
resolve: er,
|
|
1776
|
+
construct: tr,
|
|
1777
|
+
predicate: rr,
|
|
1778
|
+
represent: nr
|
|
1779
|
+
}), ar = Object.prototype.hasOwnProperty, or = Object.prototype.toString;
|
|
1780
|
+
function sr(e) {
|
|
1781
|
+
if (e === null) return !0;
|
|
1782
|
+
var t = [], n, r, i, a, o, s = e;
|
|
1783
|
+
for (n = 0, r = s.length; n < r; n += 1) {
|
|
1784
|
+
if (i = s[n], o = !1, or.call(i) !== "[object Object]") return !1;
|
|
1785
|
+
for (a in i) if (ar.call(i, a)) if (!o) o = !0;
|
|
1786
|
+
else return !1;
|
|
1787
|
+
if (!o) return !1;
|
|
1788
|
+
if (t.indexOf(a) === -1) t.push(a);
|
|
1789
|
+
else return !1;
|
|
1790
|
+
}
|
|
1791
|
+
return !0;
|
|
1792
|
+
}
|
|
1793
|
+
function cr(e) {
|
|
1794
|
+
return e === null ? [] : e;
|
|
1795
|
+
}
|
|
1796
|
+
var lr = new L("tag:yaml.org,2002:omap", {
|
|
1797
|
+
kind: "sequence",
|
|
1798
|
+
resolve: sr,
|
|
1799
|
+
construct: cr
|
|
1800
|
+
}), ur = Object.prototype.toString;
|
|
1801
|
+
function dr(e) {
|
|
1802
|
+
if (e === null) return !0;
|
|
1803
|
+
var t, n, r, i, a, o = e;
|
|
1804
|
+
for (a = Array(o.length), t = 0, n = o.length; t < n; t += 1) {
|
|
1805
|
+
if (r = o[t], ur.call(r) !== "[object Object]" || (i = Object.keys(r), i.length !== 1)) return !1;
|
|
1806
|
+
a[t] = [i[0], r[i[0]]];
|
|
1807
|
+
}
|
|
1808
|
+
return !0;
|
|
1809
|
+
}
|
|
1810
|
+
function fr(e) {
|
|
1811
|
+
if (e === null) return [];
|
|
1812
|
+
var t, n, r, i, a, o = e;
|
|
1813
|
+
for (a = Array(o.length), t = 0, n = o.length; t < n; t += 1) r = o[t], i = Object.keys(r), a[t] = [i[0], r[i[0]]];
|
|
1814
|
+
return a;
|
|
1815
|
+
}
|
|
1816
|
+
var pr = new L("tag:yaml.org,2002:pairs", {
|
|
1817
|
+
kind: "sequence",
|
|
1818
|
+
resolve: dr,
|
|
1819
|
+
construct: fr
|
|
1820
|
+
}), mr = Object.prototype.hasOwnProperty;
|
|
1821
|
+
function hr(e) {
|
|
1822
|
+
if (e === null) return !0;
|
|
1823
|
+
var t, n = e;
|
|
1824
|
+
for (t in n) if (mr.call(n, t) && n[t] !== null) return !1;
|
|
1825
|
+
return !0;
|
|
1826
|
+
}
|
|
1827
|
+
function gr(e) {
|
|
1828
|
+
return e === null ? {} : e;
|
|
1829
|
+
}
|
|
1830
|
+
var _r = new L("tag:yaml.org,2002:set", {
|
|
1831
|
+
kind: "mapping",
|
|
1832
|
+
resolve: hr,
|
|
1833
|
+
construct: gr
|
|
1834
|
+
}), vr = Wn.extend({
|
|
1835
|
+
implicit: [Xn, Qn],
|
|
1836
|
+
explicit: [
|
|
1837
|
+
ir,
|
|
1838
|
+
lr,
|
|
1839
|
+
pr,
|
|
1840
|
+
_r
|
|
1841
|
+
]
|
|
1842
|
+
}), R = Object.prototype.hasOwnProperty, yr = 1, br = 2, xr = 3, Sr = 4, Cr = 1, wr = 2, Tr = 3, Er = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, Dr = /[\x85\u2028\u2029]/, Or = /[,\[\]\{\}]/, kr = /^(?:!|!!|![a-z\-]+!)$/i, Ar = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1843
|
+
function jr(e) {
|
|
1844
|
+
return Object.prototype.toString.call(e);
|
|
1845
|
+
}
|
|
1846
|
+
function z(e) {
|
|
1847
|
+
return e === 10 || e === 13;
|
|
1848
|
+
}
|
|
1849
|
+
function B(e) {
|
|
1850
|
+
return e === 9 || e === 32;
|
|
1851
|
+
}
|
|
1852
|
+
function V(e) {
|
|
1853
|
+
return e === 9 || e === 32 || e === 10 || e === 13;
|
|
1854
|
+
}
|
|
1855
|
+
function Mr(e) {
|
|
1856
|
+
return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
|
|
1857
|
+
}
|
|
1858
|
+
function Nr(e) {
|
|
1859
|
+
var t;
|
|
1860
|
+
return 48 <= e && e <= 57 ? e - 48 : (t = e | 32, 97 <= t && t <= 102 ? t - 97 + 10 : -1);
|
|
1861
|
+
}
|
|
1862
|
+
function Pr(e) {
|
|
1863
|
+
return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
|
|
1864
|
+
}
|
|
1865
|
+
function Fr(e) {
|
|
1866
|
+
return 48 <= e && e <= 57 ? e - 48 : -1;
|
|
1867
|
+
}
|
|
1868
|
+
function Ir(e) {
|
|
1869
|
+
return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? "\n" : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? "\"" : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "
" : e === 95 ? "\xA0" : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
|
|
1870
|
+
}
|
|
1871
|
+
function Lr(e) {
|
|
1872
|
+
return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode((e - 65536 >> 10) + 55296, (e - 65536 & 1023) + 56320);
|
|
1873
|
+
}
|
|
1874
|
+
function Rr(e, t, n) {
|
|
1875
|
+
t === "__proto__" ? Object.defineProperty(e, t, {
|
|
1876
|
+
configurable: !0,
|
|
1877
|
+
enumerable: !0,
|
|
1878
|
+
writable: !0,
|
|
1879
|
+
value: n
|
|
1880
|
+
}) : e[t] = n;
|
|
1881
|
+
}
|
|
1882
|
+
for (var zr = Array(256), Br = Array(256), Vr = 0; Vr < 256; Vr++) zr[Vr] = +!!Ir(Vr), Br[Vr] = Ir(Vr);
|
|
1883
|
+
function Hr(e, t) {
|
|
1884
|
+
this.input = e, this.filename = t.filename || null, this.schema = t.schema || vr, this.onWarning = t.onWarning || null, this.legacy = t.legacy || !1, this.json = t.json || !1, this.listener = t.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = e.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
|
|
1885
|
+
}
|
|
1886
|
+
function Ur(e, t) {
|
|
1887
|
+
var n = {
|
|
1888
|
+
name: e.filename,
|
|
1889
|
+
buffer: e.input.slice(0, -1),
|
|
1890
|
+
position: e.position,
|
|
1891
|
+
line: e.line,
|
|
1892
|
+
column: e.position - e.lineStart
|
|
1893
|
+
};
|
|
1894
|
+
return n.snippet = pn(n), new I(t, n);
|
|
1895
|
+
}
|
|
1896
|
+
function H(e, t) {
|
|
1897
|
+
throw Ur(e, t);
|
|
1898
|
+
}
|
|
1899
|
+
function Wr(e, t) {
|
|
1900
|
+
e.onWarning && e.onWarning.call(null, Ur(e, t));
|
|
1901
|
+
}
|
|
1902
|
+
var Gr = {
|
|
1903
|
+
YAML: function(e, t, n) {
|
|
1904
|
+
var r, i, a;
|
|
1905
|
+
e.version !== null && H(e, "duplication of %YAML directive"), n.length !== 1 && H(e, "YAML directive accepts exactly one argument"), r = /^([0-9]+)\.([0-9]+)$/.exec(n[0]), r === null && H(e, "ill-formed argument of the YAML directive"), i = parseInt(r[1], 10), a = parseInt(r[2], 10), i !== 1 && H(e, "unacceptable YAML version of the document"), e.version = n[0], e.checkLineBreaks = a < 2, a !== 1 && a !== 2 && Wr(e, "unsupported YAML version of the document");
|
|
1906
|
+
},
|
|
1907
|
+
TAG: function(e, t, n) {
|
|
1908
|
+
var r, i;
|
|
1909
|
+
n.length !== 2 && H(e, "TAG directive accepts exactly two arguments"), r = n[0], i = n[1], kr.test(r) || H(e, "ill-formed tag handle (first argument) of the TAG directive"), R.call(e.tagMap, r) && H(e, "there is a previously declared suffix for \"" + r + "\" tag handle"), Ar.test(i) || H(e, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1910
|
+
try {
|
|
1911
|
+
i = decodeURIComponent(i);
|
|
1912
|
+
} catch {
|
|
1913
|
+
H(e, "tag prefix is malformed: " + i);
|
|
1914
|
+
}
|
|
1915
|
+
e.tagMap[r] = i;
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
function U(e, t, n, r) {
|
|
1919
|
+
var i, a, o, s;
|
|
1920
|
+
if (t < n) {
|
|
1921
|
+
if (s = e.input.slice(t, n), r) for (i = 0, a = s.length; i < a; i += 1) o = s.charCodeAt(i), o === 9 || 32 <= o && o <= 1114111 || H(e, "expected valid JSON character");
|
|
1922
|
+
else Er.test(s) && H(e, "the stream contains non-printable characters");
|
|
1923
|
+
e.result += s;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
function Kr(e, t, n, r) {
|
|
1927
|
+
var i, a, o, s;
|
|
1928
|
+
for (F.isObject(n) || H(e, "cannot merge mappings; the provided source object is unacceptable"), i = Object.keys(n), o = 0, s = i.length; o < s; o += 1) a = i[o], R.call(t, a) || (Rr(t, a, n[a]), r[a] = !0);
|
|
1929
|
+
}
|
|
1930
|
+
function qr(e, t, n, r, i, a, o, s, c) {
|
|
1931
|
+
var l, u;
|
|
1932
|
+
if (Array.isArray(i)) for (i = Array.prototype.slice.call(i), l = 0, u = i.length; l < u; l += 1) Array.isArray(i[l]) && H(e, "nested arrays are not supported inside keys"), typeof i == "object" && jr(i[l]) === "[object Object]" && (i[l] = "[object Object]");
|
|
1933
|
+
if (typeof i == "object" && jr(i) === "[object Object]" && (i = "[object Object]"), i = String(i), t === null && (t = {}), r === "tag:yaml.org,2002:merge") if (Array.isArray(a)) for (l = 0, u = a.length; l < u; l += 1) Kr(e, t, a[l], n);
|
|
1934
|
+
else Kr(e, t, a, n);
|
|
1935
|
+
else !e.json && !R.call(n, i) && R.call(t, i) && (e.line = o || e.line, e.lineStart = s || e.lineStart, e.position = c || e.position, H(e, "duplicated mapping key")), Rr(t, i, a), delete n[i];
|
|
1936
|
+
return t;
|
|
1937
|
+
}
|
|
1938
|
+
function Jr(e) {
|
|
1939
|
+
var t = e.input.charCodeAt(e.position);
|
|
1940
|
+
t === 10 ? e.position++ : t === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : H(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
|
|
1941
|
+
}
|
|
1942
|
+
function W(e, t, n) {
|
|
1943
|
+
for (var r = 0, i = e.input.charCodeAt(e.position); i !== 0;) {
|
|
1944
|
+
for (; B(i);) i === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), i = e.input.charCodeAt(++e.position);
|
|
1945
|
+
if (t && i === 35) do
|
|
1946
|
+
i = e.input.charCodeAt(++e.position);
|
|
1947
|
+
while (i !== 10 && i !== 13 && i !== 0);
|
|
1948
|
+
if (z(i)) for (Jr(e), i = e.input.charCodeAt(e.position), r++, e.lineIndent = 0; i === 32;) e.lineIndent++, i = e.input.charCodeAt(++e.position);
|
|
1949
|
+
else break;
|
|
1950
|
+
}
|
|
1951
|
+
return n !== -1 && r !== 0 && e.lineIndent < n && Wr(e, "deficient indentation"), r;
|
|
1952
|
+
}
|
|
1953
|
+
function Yr(e) {
|
|
1954
|
+
var t = e.position, n = e.input.charCodeAt(t);
|
|
1955
|
+
return !!((n === 45 || n === 46) && n === e.input.charCodeAt(t + 1) && n === e.input.charCodeAt(t + 2) && (t += 3, n = e.input.charCodeAt(t), n === 0 || V(n)));
|
|
1956
|
+
}
|
|
1957
|
+
function Xr(e, t) {
|
|
1958
|
+
t === 1 ? e.result += " " : t > 1 && (e.result += F.repeat("\n", t - 1));
|
|
1959
|
+
}
|
|
1960
|
+
function Zr(e, t, n) {
|
|
1961
|
+
var r, i, a, o, s, c, l, u, d = e.kind, f = e.result, p = e.input.charCodeAt(e.position);
|
|
1962
|
+
if (V(p) || Mr(p) || p === 35 || p === 38 || p === 42 || p === 33 || p === 124 || p === 62 || p === 39 || p === 34 || p === 37 || p === 64 || p === 96 || (p === 63 || p === 45) && (i = e.input.charCodeAt(e.position + 1), V(i) || n && Mr(i))) return !1;
|
|
1963
|
+
for (e.kind = "scalar", e.result = "", a = o = e.position, s = !1; p !== 0;) {
|
|
1964
|
+
if (p === 58) {
|
|
1965
|
+
if (i = e.input.charCodeAt(e.position + 1), V(i) || n && Mr(i)) break;
|
|
1966
|
+
} else if (p === 35) {
|
|
1967
|
+
if (r = e.input.charCodeAt(e.position - 1), V(r)) break;
|
|
1968
|
+
} else if (e.position === e.lineStart && Yr(e) || n && Mr(p)) break;
|
|
1969
|
+
else if (z(p)) if (c = e.line, l = e.lineStart, u = e.lineIndent, W(e, !1, -1), e.lineIndent >= t) {
|
|
1970
|
+
s = !0, p = e.input.charCodeAt(e.position);
|
|
1971
|
+
continue;
|
|
1972
|
+
} else {
|
|
1973
|
+
e.position = o, e.line = c, e.lineStart = l, e.lineIndent = u;
|
|
1974
|
+
break;
|
|
1975
|
+
}
|
|
1976
|
+
s &&= (U(e, a, o, !1), Xr(e, e.line - c), a = o = e.position, !1), B(p) || (o = e.position + 1), p = e.input.charCodeAt(++e.position);
|
|
1977
|
+
}
|
|
1978
|
+
return U(e, a, o, !1), e.result ? !0 : (e.kind = d, e.result = f, !1);
|
|
1979
|
+
}
|
|
1980
|
+
function Qr(e, t) {
|
|
1981
|
+
var n = e.input.charCodeAt(e.position), r, i;
|
|
1982
|
+
if (n !== 39) return !1;
|
|
1983
|
+
for (e.kind = "scalar", e.result = "", e.position++, r = i = e.position; (n = e.input.charCodeAt(e.position)) !== 0;) if (n === 39) if (U(e, r, e.position, !0), n = e.input.charCodeAt(++e.position), n === 39) r = e.position, e.position++, i = e.position;
|
|
1984
|
+
else return !0;
|
|
1985
|
+
else z(n) ? (U(e, r, i, !0), Xr(e, W(e, !1, t)), r = i = e.position) : e.position === e.lineStart && Yr(e) ? H(e, "unexpected end of the document within a single quoted scalar") : (e.position++, i = e.position);
|
|
1986
|
+
H(e, "unexpected end of the stream within a single quoted scalar");
|
|
1987
|
+
}
|
|
1988
|
+
function $r(e, t) {
|
|
1989
|
+
var n, r, i, a, o, s = e.input.charCodeAt(e.position);
|
|
1990
|
+
if (s !== 34) return !1;
|
|
1991
|
+
for (e.kind = "scalar", e.result = "", e.position++, n = r = e.position; (s = e.input.charCodeAt(e.position)) !== 0;) if (s === 34) return U(e, n, e.position, !0), e.position++, !0;
|
|
1992
|
+
else if (s === 92) {
|
|
1993
|
+
if (U(e, n, e.position, !0), s = e.input.charCodeAt(++e.position), z(s)) W(e, !1, t);
|
|
1994
|
+
else if (s < 256 && zr[s]) e.result += Br[s], e.position++;
|
|
1995
|
+
else if ((o = Pr(s)) > 0) {
|
|
1996
|
+
for (i = o, a = 0; i > 0; i--) s = e.input.charCodeAt(++e.position), (o = Nr(s)) >= 0 ? a = (a << 4) + o : H(e, "expected hexadecimal character");
|
|
1997
|
+
e.result += Lr(a), e.position++;
|
|
1998
|
+
} else H(e, "unknown escape sequence");
|
|
1999
|
+
n = r = e.position;
|
|
2000
|
+
} else z(s) ? (U(e, n, r, !0), Xr(e, W(e, !1, t)), n = r = e.position) : e.position === e.lineStart && Yr(e) ? H(e, "unexpected end of the document within a double quoted scalar") : (e.position++, r = e.position);
|
|
2001
|
+
H(e, "unexpected end of the stream within a double quoted scalar");
|
|
2002
|
+
}
|
|
2003
|
+
function ei(e, t) {
|
|
2004
|
+
var n = !0, r, i, a, o = e.tag, s, c = e.anchor, l, u, d, f, p, m = Object.create(null), h, g, _, v = e.input.charCodeAt(e.position);
|
|
2005
|
+
if (v === 91) u = 93, p = !1, s = [];
|
|
2006
|
+
else if (v === 123) u = 125, p = !0, s = {};
|
|
2007
|
+
else return !1;
|
|
2008
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = s), v = e.input.charCodeAt(++e.position); v !== 0;) {
|
|
2009
|
+
if (W(e, !0, t), v = e.input.charCodeAt(e.position), v === u) return e.position++, e.tag = o, e.anchor = c, e.kind = p ? "mapping" : "sequence", e.result = s, !0;
|
|
2010
|
+
n ? v === 44 && H(e, "expected the node content, but found ','") : H(e, "missed comma between flow collection entries"), g = h = _ = null, d = f = !1, v === 63 && (l = e.input.charCodeAt(e.position + 1), V(l) && (d = f = !0, e.position++, W(e, !0, t))), r = e.line, i = e.lineStart, a = e.position, si(e, t, yr, !1, !0), g = e.tag, h = e.result, W(e, !0, t), v = e.input.charCodeAt(e.position), (f || e.line === r) && v === 58 && (d = !0, v = e.input.charCodeAt(++e.position), W(e, !0, t), si(e, t, yr, !1, !0), _ = e.result), p ? qr(e, s, m, g, h, _, r, i, a) : d ? s.push(qr(e, null, m, g, h, _, r, i, a)) : s.push(h), W(e, !0, t), v = e.input.charCodeAt(e.position), v === 44 ? (n = !0, v = e.input.charCodeAt(++e.position)) : n = !1;
|
|
2011
|
+
}
|
|
2012
|
+
H(e, "unexpected end of the stream within a flow collection");
|
|
2013
|
+
}
|
|
2014
|
+
function ti(e, t) {
|
|
2015
|
+
var n, r, i = Cr, a = !1, o = !1, s = t, c = 0, l = !1, u, d = e.input.charCodeAt(e.position);
|
|
2016
|
+
if (d === 124) r = !1;
|
|
2017
|
+
else if (d === 62) r = !0;
|
|
2018
|
+
else return !1;
|
|
2019
|
+
for (e.kind = "scalar", e.result = ""; d !== 0;) if (d = e.input.charCodeAt(++e.position), d === 43 || d === 45) Cr === i ? i = d === 43 ? Tr : wr : H(e, "repeat of a chomping mode identifier");
|
|
2020
|
+
else if ((u = Fr(d)) >= 0) u === 0 ? H(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : o ? H(e, "repeat of an indentation width identifier") : (s = t + u - 1, o = !0);
|
|
2021
|
+
else break;
|
|
2022
|
+
if (B(d)) {
|
|
2023
|
+
do
|
|
2024
|
+
d = e.input.charCodeAt(++e.position);
|
|
2025
|
+
while (B(d));
|
|
2026
|
+
if (d === 35) do
|
|
2027
|
+
d = e.input.charCodeAt(++e.position);
|
|
2028
|
+
while (!z(d) && d !== 0);
|
|
2029
|
+
}
|
|
2030
|
+
for (; d !== 0;) {
|
|
2031
|
+
for (Jr(e), e.lineIndent = 0, d = e.input.charCodeAt(e.position); (!o || e.lineIndent < s) && d === 32;) e.lineIndent++, d = e.input.charCodeAt(++e.position);
|
|
2032
|
+
if (!o && e.lineIndent > s && (s = e.lineIndent), z(d)) {
|
|
2033
|
+
c++;
|
|
2034
|
+
continue;
|
|
2035
|
+
}
|
|
2036
|
+
if (e.lineIndent < s) {
|
|
2037
|
+
i === Tr ? e.result += F.repeat("\n", a ? 1 + c : c) : i === Cr && a && (e.result += "\n");
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2040
|
+
for (r ? B(d) ? (l = !0, e.result += F.repeat("\n", a ? 1 + c : c)) : l ? (l = !1, e.result += F.repeat("\n", c + 1)) : c === 0 ? a && (e.result += " ") : e.result += F.repeat("\n", c) : e.result += F.repeat("\n", a ? 1 + c : c), a = !0, o = !0, c = 0, n = e.position; !z(d) && d !== 0;) d = e.input.charCodeAt(++e.position);
|
|
2041
|
+
U(e, n, e.position, !1);
|
|
2042
|
+
}
|
|
2043
|
+
return !0;
|
|
2044
|
+
}
|
|
2045
|
+
function ni(e, t) {
|
|
2046
|
+
var n, r = e.tag, i = e.anchor, a = [], o, s = !1, c;
|
|
2047
|
+
if (e.firstTabInLine !== -1) return !1;
|
|
2048
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = a), c = e.input.charCodeAt(e.position); c !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, H(e, "tab characters must not be used in indentation")), !(c !== 45 || (o = e.input.charCodeAt(e.position + 1), !V(o))));) {
|
|
2049
|
+
if (s = !0, e.position++, W(e, !0, -1) && e.lineIndent <= t) {
|
|
2050
|
+
a.push(null), c = e.input.charCodeAt(e.position);
|
|
2051
|
+
continue;
|
|
2052
|
+
}
|
|
2053
|
+
if (n = e.line, si(e, t, xr, !1, !0), a.push(e.result), W(e, !0, -1), c = e.input.charCodeAt(e.position), (e.line === n || e.lineIndent > t) && c !== 0) H(e, "bad indentation of a sequence entry");
|
|
2054
|
+
else if (e.lineIndent < t) break;
|
|
2055
|
+
}
|
|
2056
|
+
return s ? (e.tag = r, e.anchor = i, e.kind = "sequence", e.result = a, !0) : !1;
|
|
2057
|
+
}
|
|
2058
|
+
function ri(e, t, n) {
|
|
2059
|
+
var r, i, a, o, s, c, l = e.tag, u = e.anchor, d = {}, f = Object.create(null), p = null, m = null, h = null, g = !1, _ = !1, v;
|
|
2060
|
+
if (e.firstTabInLine !== -1) return !1;
|
|
2061
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = d), v = e.input.charCodeAt(e.position); v !== 0;) {
|
|
2062
|
+
if (!g && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, H(e, "tab characters must not be used in indentation")), r = e.input.charCodeAt(e.position + 1), a = e.line, (v === 63 || v === 58) && V(r)) v === 63 ? (g && (qr(e, d, f, p, m, null, o, s, c), p = m = h = null), _ = !0, g = !0, i = !0) : g ? (g = !1, i = !0) : H(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, v = r;
|
|
2063
|
+
else {
|
|
2064
|
+
if (o = e.line, s = e.lineStart, c = e.position, !si(e, n, br, !1, !0)) break;
|
|
2065
|
+
if (e.line === a) {
|
|
2066
|
+
for (v = e.input.charCodeAt(e.position); B(v);) v = e.input.charCodeAt(++e.position);
|
|
2067
|
+
if (v === 58) v = e.input.charCodeAt(++e.position), V(v) || H(e, "a whitespace character is expected after the key-value separator within a block mapping"), g && (qr(e, d, f, p, m, null, o, s, c), p = m = h = null), _ = !0, g = !1, i = !1, p = e.tag, m = e.result;
|
|
2068
|
+
else if (_) H(e, "can not read an implicit mapping pair; a colon is missed");
|
|
2069
|
+
else return e.tag = l, e.anchor = u, !0;
|
|
2070
|
+
} else if (_) H(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
2071
|
+
else return e.tag = l, e.anchor = u, !0;
|
|
2072
|
+
}
|
|
2073
|
+
if ((e.line === a || e.lineIndent > t) && (g && (o = e.line, s = e.lineStart, c = e.position), si(e, t, Sr, !0, i) && (g ? m = e.result : h = e.result), g || (qr(e, d, f, p, m, h, o, s, c), p = m = h = null), W(e, !0, -1), v = e.input.charCodeAt(e.position)), (e.line === a || e.lineIndent > t) && v !== 0) H(e, "bad indentation of a mapping entry");
|
|
2074
|
+
else if (e.lineIndent < t) break;
|
|
2075
|
+
}
|
|
2076
|
+
return g && qr(e, d, f, p, m, null, o, s, c), _ && (e.tag = l, e.anchor = u, e.kind = "mapping", e.result = d), _;
|
|
2077
|
+
}
|
|
2078
|
+
function ii(e) {
|
|
2079
|
+
var t, n = !1, r = !1, i, a, o = e.input.charCodeAt(e.position);
|
|
2080
|
+
if (o !== 33) return !1;
|
|
2081
|
+
if (e.tag !== null && H(e, "duplication of a tag property"), o = e.input.charCodeAt(++e.position), o === 60 ? (n = !0, o = e.input.charCodeAt(++e.position)) : o === 33 ? (r = !0, i = "!!", o = e.input.charCodeAt(++e.position)) : i = "!", t = e.position, n) {
|
|
2082
|
+
do
|
|
2083
|
+
o = e.input.charCodeAt(++e.position);
|
|
2084
|
+
while (o !== 0 && o !== 62);
|
|
2085
|
+
e.position < e.length ? (a = e.input.slice(t, e.position), o = e.input.charCodeAt(++e.position)) : H(e, "unexpected end of the stream within a verbatim tag");
|
|
2086
|
+
} else {
|
|
2087
|
+
for (; o !== 0 && !V(o);) o === 33 && (r ? H(e, "tag suffix cannot contain exclamation marks") : (i = e.input.slice(t - 1, e.position + 1), kr.test(i) || H(e, "named tag handle cannot contain such characters"), r = !0, t = e.position + 1)), o = e.input.charCodeAt(++e.position);
|
|
2088
|
+
a = e.input.slice(t, e.position), Or.test(a) && H(e, "tag suffix cannot contain flow indicator characters");
|
|
2089
|
+
}
|
|
2090
|
+
a && !Ar.test(a) && H(e, "tag name cannot contain such characters: " + a);
|
|
2091
|
+
try {
|
|
2092
|
+
a = decodeURIComponent(a);
|
|
2093
|
+
} catch {
|
|
2094
|
+
H(e, "tag name is malformed: " + a);
|
|
2095
|
+
}
|
|
2096
|
+
return n ? e.tag = a : R.call(e.tagMap, i) ? e.tag = e.tagMap[i] + a : i === "!" ? e.tag = "!" + a : i === "!!" ? e.tag = "tag:yaml.org,2002:" + a : H(e, "undeclared tag handle \"" + i + "\""), !0;
|
|
2097
|
+
}
|
|
2098
|
+
function ai(e) {
|
|
2099
|
+
var t, n = e.input.charCodeAt(e.position);
|
|
2100
|
+
if (n !== 38) return !1;
|
|
2101
|
+
for (e.anchor !== null && H(e, "duplication of an anchor property"), n = e.input.charCodeAt(++e.position), t = e.position; n !== 0 && !V(n) && !Mr(n);) n = e.input.charCodeAt(++e.position);
|
|
2102
|
+
return e.position === t && H(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(t, e.position), !0;
|
|
2103
|
+
}
|
|
2104
|
+
function oi(e) {
|
|
2105
|
+
var t, n, r = e.input.charCodeAt(e.position);
|
|
2106
|
+
if (r !== 42) return !1;
|
|
2107
|
+
for (r = e.input.charCodeAt(++e.position), t = e.position; r !== 0 && !V(r) && !Mr(r);) r = e.input.charCodeAt(++e.position);
|
|
2108
|
+
return e.position === t && H(e, "name of an alias node must contain at least one character"), n = e.input.slice(t, e.position), R.call(e.anchorMap, n) || H(e, "unidentified alias \"" + n + "\""), e.result = e.anchorMap[n], W(e, !0, -1), !0;
|
|
2109
|
+
}
|
|
2110
|
+
function si(e, t, n, r, i) {
|
|
2111
|
+
var a, o, s, c = 1, l = !1, u = !1, d, f, p, m, h, g;
|
|
2112
|
+
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, a = o = s = Sr === n || xr === n, r && W(e, !0, -1) && (l = !0, e.lineIndent > t ? c = 1 : e.lineIndent === t ? c = 0 : e.lineIndent < t && (c = -1)), c === 1) for (; ii(e) || ai(e);) W(e, !0, -1) ? (l = !0, s = a, e.lineIndent > t ? c = 1 : e.lineIndent === t ? c = 0 : e.lineIndent < t && (c = -1)) : s = !1;
|
|
2113
|
+
if (s &&= l || i, (c === 1 || Sr === n) && (h = yr === n || br === n ? t : t + 1, g = e.position - e.lineStart, c === 1 ? s && (ni(e, g) || ri(e, g, h)) || ei(e, h) ? u = !0 : (o && ti(e, h) || Qr(e, h) || $r(e, h) ? u = !0 : oi(e) ? (u = !0, (e.tag !== null || e.anchor !== null) && H(e, "alias node should not have any properties")) : Zr(e, h, yr === n) && (u = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : c === 0 && (u = s && ni(e, g))), e.tag === null) e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
2114
|
+
else if (e.tag === "?") {
|
|
2115
|
+
for (e.result !== null && e.kind !== "scalar" && H(e, "unacceptable node kind for !<?> tag; it should be \"scalar\", not \"" + e.kind + "\""), d = 0, f = e.implicitTypes.length; d < f; d += 1) if (m = e.implicitTypes[d], m.resolve(e.result)) {
|
|
2116
|
+
e.result = m.construct(e.result), e.tag = m.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
2117
|
+
break;
|
|
2118
|
+
}
|
|
2119
|
+
} else if (e.tag !== "!") {
|
|
2120
|
+
if (R.call(e.typeMap[e.kind || "fallback"], e.tag)) m = e.typeMap[e.kind || "fallback"][e.tag];
|
|
2121
|
+
else for (m = null, p = e.typeMap.multi[e.kind || "fallback"], d = 0, f = p.length; d < f; d += 1) if (e.tag.slice(0, p[d].tag.length) === p[d].tag) {
|
|
2122
|
+
m = p[d];
|
|
2123
|
+
break;
|
|
2124
|
+
}
|
|
2125
|
+
m || H(e, "unknown tag !<" + e.tag + ">"), e.result !== null && m.kind !== e.kind && H(e, "unacceptable node kind for !<" + e.tag + "> tag; it should be \"" + m.kind + "\", not \"" + e.kind + "\""), m.resolve(e.result, e.tag) ? (e.result = m.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : H(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
|
|
2126
|
+
}
|
|
2127
|
+
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || u;
|
|
2128
|
+
}
|
|
2129
|
+
function ci(e) {
|
|
2130
|
+
var t = e.position, n, r, i, a = !1, o;
|
|
2131
|
+
for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = Object.create(null), e.anchorMap = Object.create(null); (o = e.input.charCodeAt(e.position)) !== 0 && (W(e, !0, -1), o = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || o !== 37));) {
|
|
2132
|
+
for (a = !0, o = e.input.charCodeAt(++e.position), n = e.position; o !== 0 && !V(o);) o = e.input.charCodeAt(++e.position);
|
|
2133
|
+
for (r = e.input.slice(n, e.position), i = [], r.length < 1 && H(e, "directive name must not be less than one character in length"); o !== 0;) {
|
|
2134
|
+
for (; B(o);) o = e.input.charCodeAt(++e.position);
|
|
2135
|
+
if (o === 35) {
|
|
2136
|
+
do
|
|
2137
|
+
o = e.input.charCodeAt(++e.position);
|
|
2138
|
+
while (o !== 0 && !z(o));
|
|
2139
|
+
break;
|
|
2140
|
+
}
|
|
2141
|
+
if (z(o)) break;
|
|
2142
|
+
for (n = e.position; o !== 0 && !V(o);) o = e.input.charCodeAt(++e.position);
|
|
2143
|
+
i.push(e.input.slice(n, e.position));
|
|
2144
|
+
}
|
|
2145
|
+
o !== 0 && Jr(e), R.call(Gr, r) ? Gr[r](e, r, i) : Wr(e, "unknown document directive \"" + r + "\"");
|
|
2146
|
+
}
|
|
2147
|
+
if (W(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, W(e, !0, -1)) : a && H(e, "directives end mark is expected"), si(e, e.lineIndent - 1, Sr, !1, !0), W(e, !0, -1), e.checkLineBreaks && Dr.test(e.input.slice(t, e.position)) && Wr(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Yr(e)) {
|
|
2148
|
+
e.input.charCodeAt(e.position) === 46 && (e.position += 3, W(e, !0, -1));
|
|
2149
|
+
return;
|
|
2150
|
+
}
|
|
2151
|
+
if (e.position < e.length - 1) H(e, "end of the stream or a document separator is expected");
|
|
2152
|
+
else return;
|
|
2153
|
+
}
|
|
2154
|
+
function li(e, t) {
|
|
2155
|
+
e = String(e), t ||= {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += "\n"), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
|
|
2156
|
+
var n = new Hr(e, t), r = e.indexOf("\0");
|
|
2157
|
+
for (r !== -1 && (n.position = r, H(n, "null byte is not allowed in input")), n.input += "\0"; n.input.charCodeAt(n.position) === 32;) n.lineIndent += 1, n.position += 1;
|
|
2158
|
+
for (; n.position < n.length - 1;) ci(n);
|
|
2159
|
+
return n.documents;
|
|
2160
|
+
}
|
|
2161
|
+
function ui(e, t, n) {
|
|
2162
|
+
typeof t == "object" && t && n === void 0 && (n = t, t = null);
|
|
2163
|
+
var r = li(e, n);
|
|
2164
|
+
if (typeof t != "function") return r;
|
|
2165
|
+
for (var i = 0, a = r.length; i < a; i += 1) t(r[i]);
|
|
2166
|
+
}
|
|
2167
|
+
function di(e, t) {
|
|
2168
|
+
var n = li(e, t);
|
|
2169
|
+
if (n.length !== 0) {
|
|
2170
|
+
if (n.length === 1) return n[0];
|
|
2171
|
+
throw new I("expected a single document in the stream, but found more");
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
var fi = {
|
|
2175
|
+
loadAll: ui,
|
|
2176
|
+
load: di
|
|
2177
|
+
}, pi = Object.prototype.toString, mi = Object.prototype.hasOwnProperty, hi = 65279, gi = 9, _i = 10, vi = 13, yi = 32, bi = 33, xi = 34, Si = 35, Ci = 37, wi = 38, Ti = 39, Ei = 42, Di = 44, Oi = 45, ki = 58, Ai = 61, ji = 62, Mi = 63, Ni = 64, Pi = 91, Fi = 93, Ii = 96, Li = 123, Ri = 124, zi = 125, G = {};
|
|
2178
|
+
G[0] = "\\0", G[7] = "\\a", G[8] = "\\b", G[9] = "\\t", G[10] = "\\n", G[11] = "\\v", G[12] = "\\f", G[13] = "\\r", G[27] = "\\e", G[34] = "\\\"", G[92] = "\\\\", G[133] = "\\N", G[160] = "\\_", G[8232] = "\\L", G[8233] = "\\P";
|
|
2179
|
+
var Bi = [
|
|
2180
|
+
"y",
|
|
2181
|
+
"Y",
|
|
2182
|
+
"yes",
|
|
2183
|
+
"Yes",
|
|
2184
|
+
"YES",
|
|
2185
|
+
"on",
|
|
2186
|
+
"On",
|
|
2187
|
+
"ON",
|
|
2188
|
+
"n",
|
|
2189
|
+
"N",
|
|
2190
|
+
"no",
|
|
2191
|
+
"No",
|
|
2192
|
+
"NO",
|
|
2193
|
+
"off",
|
|
2194
|
+
"Off",
|
|
2195
|
+
"OFF"
|
|
2196
|
+
], Vi = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
2197
|
+
function Hi(e, t) {
|
|
2198
|
+
var n, r, i, a, o, s, c;
|
|
2199
|
+
if (t === null) return {};
|
|
2200
|
+
for (n = {}, r = Object.keys(t), i = 0, a = r.length; i < a; i += 1) o = r[i], s = String(t[o]), o.slice(0, 2) === "!!" && (o = "tag:yaml.org,2002:" + o.slice(2)), c = e.compiledTypeMap.fallback[o], c && mi.call(c.styleAliases, s) && (s = c.styleAliases[s]), n[o] = s;
|
|
2201
|
+
return n;
|
|
2202
|
+
}
|
|
2203
|
+
function Ui(e) {
|
|
2204
|
+
var t = e.toString(16).toUpperCase(), n, r;
|
|
2205
|
+
if (e <= 255) n = "x", r = 2;
|
|
2206
|
+
else if (e <= 65535) n = "u", r = 4;
|
|
2207
|
+
else if (e <= 4294967295) n = "U", r = 8;
|
|
2208
|
+
else throw new I("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2209
|
+
return "\\" + n + F.repeat("0", r - t.length) + t;
|
|
2210
|
+
}
|
|
2211
|
+
var Wi = 1, Gi = 2;
|
|
2212
|
+
function Ki(e) {
|
|
2213
|
+
this.schema = e.schema || vr, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = F.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Hi(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === "\"" ? Gi : Wi, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
|
2214
|
+
}
|
|
2215
|
+
function qi(e, t) {
|
|
2216
|
+
for (var n = F.repeat(" ", t), r = 0, i = -1, a = "", o, s = e.length; r < s;) i = e.indexOf("\n", r), i === -1 ? (o = e.slice(r), r = s) : (o = e.slice(r, i + 1), r = i + 1), o.length && o !== "\n" && (a += n), a += o;
|
|
2217
|
+
return a;
|
|
2218
|
+
}
|
|
2219
|
+
function Ji(e, t) {
|
|
2220
|
+
return "\n" + F.repeat(" ", e.indent * t);
|
|
2221
|
+
}
|
|
2222
|
+
function Yi(e, t) {
|
|
2223
|
+
var n, r, i;
|
|
2224
|
+
for (n = 0, r = e.implicitTypes.length; n < r; n += 1) if (i = e.implicitTypes[n], i.resolve(t)) return !0;
|
|
2225
|
+
return !1;
|
|
2226
|
+
}
|
|
2227
|
+
function Xi(e) {
|
|
2228
|
+
return e === yi || e === gi;
|
|
2229
|
+
}
|
|
2230
|
+
function Zi(e) {
|
|
2231
|
+
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== hi || 65536 <= e && e <= 1114111;
|
|
2232
|
+
}
|
|
2233
|
+
function Qi(e) {
|
|
2234
|
+
return Zi(e) && e !== hi && e !== vi && e !== _i;
|
|
2235
|
+
}
|
|
2236
|
+
function $i(e, t, n) {
|
|
2237
|
+
var r = Qi(e), i = r && !Xi(e);
|
|
2238
|
+
return (n ? r : r && e !== Di && e !== Pi && e !== Fi && e !== Li && e !== zi) && e !== Si && !(t === ki && !i) || Qi(t) && !Xi(t) && e === Si || t === ki && i;
|
|
2239
|
+
}
|
|
2240
|
+
function ea(e) {
|
|
2241
|
+
return Zi(e) && e !== hi && !Xi(e) && e !== Oi && e !== Mi && e !== ki && e !== Di && e !== Pi && e !== Fi && e !== Li && e !== zi && e !== Si && e !== wi && e !== Ei && e !== bi && e !== Ri && e !== Ai && e !== ji && e !== Ti && e !== xi && e !== Ci && e !== Ni && e !== Ii;
|
|
2242
|
+
}
|
|
2243
|
+
function ta(e) {
|
|
2244
|
+
return !Xi(e) && e !== ki;
|
|
2245
|
+
}
|
|
2246
|
+
function na(e, t) {
|
|
2247
|
+
var n = e.charCodeAt(t), r;
|
|
2248
|
+
return n >= 55296 && n <= 56319 && t + 1 < e.length && (r = e.charCodeAt(t + 1), r >= 56320 && r <= 57343) ? (n - 55296) * 1024 + r - 56320 + 65536 : n;
|
|
2249
|
+
}
|
|
2250
|
+
function ra(e) {
|
|
2251
|
+
return /^\n* /.test(e);
|
|
2252
|
+
}
|
|
2253
|
+
var ia = 1, aa = 2, oa = 3, sa = 4, ca = 5;
|
|
2254
|
+
function la(e, t, n, r, i, a, o, s) {
|
|
2255
|
+
var c, l = 0, u = null, d = !1, f = !1, p = r !== -1, m = -1, h = ea(na(e, 0)) && ta(na(e, e.length - 1));
|
|
2256
|
+
if (t || o) for (c = 0; c < e.length; l >= 65536 ? c += 2 : c++) {
|
|
2257
|
+
if (l = na(e, c), !Zi(l)) return ca;
|
|
2258
|
+
h &&= $i(l, u, s), u = l;
|
|
2259
|
+
}
|
|
2260
|
+
else {
|
|
2261
|
+
for (c = 0; c < e.length; l >= 65536 ? c += 2 : c++) {
|
|
2262
|
+
if (l = na(e, c), l === _i) d = !0, p && (f ||= c - m - 1 > r && e[m + 1] !== " ", m = c);
|
|
2263
|
+
else if (!Zi(l)) return ca;
|
|
2264
|
+
h &&= $i(l, u, s), u = l;
|
|
2265
|
+
}
|
|
2266
|
+
f ||= p && c - m - 1 > r && e[m + 1] !== " ";
|
|
2267
|
+
}
|
|
2268
|
+
return !d && !f ? h && !o && !i(e) ? ia : a === Gi ? ca : aa : n > 9 && ra(e) ? ca : o ? a === Gi ? ca : aa : f ? sa : oa;
|
|
2269
|
+
}
|
|
2270
|
+
function ua(e, t, n, r, i) {
|
|
2271
|
+
e.dump = function() {
|
|
2272
|
+
if (t.length === 0) return e.quotingType === Gi ? "\"\"" : "''";
|
|
2273
|
+
if (!e.noCompatMode && (Bi.indexOf(t) !== -1 || Vi.test(t))) return e.quotingType === Gi ? "\"" + t + "\"" : "'" + t + "'";
|
|
2274
|
+
var a = e.indent * Math.max(1, n), o = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - a), s = r || e.flowLevel > -1 && n >= e.flowLevel;
|
|
2275
|
+
function c(t) {
|
|
2276
|
+
return Yi(e, t);
|
|
2277
|
+
}
|
|
2278
|
+
switch (la(t, s, e.indent, o, c, e.quotingType, e.forceQuotes && !r, i)) {
|
|
2279
|
+
case ia: return t;
|
|
2280
|
+
case aa: return "'" + t.replace(/'/g, "''") + "'";
|
|
2281
|
+
case oa: return "|" + da(t, e.indent) + fa(qi(t, a));
|
|
2282
|
+
case sa: return ">" + da(t, e.indent) + fa(qi(pa(t, o), a));
|
|
2283
|
+
case ca: return "\"" + ha(t) + "\"";
|
|
2284
|
+
default: throw new I("impossible error: invalid scalar style");
|
|
2285
|
+
}
|
|
2286
|
+
}();
|
|
2287
|
+
}
|
|
2288
|
+
function da(e, t) {
|
|
2289
|
+
var n = ra(e) ? String(t) : "", r = e[e.length - 1] === "\n";
|
|
2290
|
+
return n + (r && (e[e.length - 2] === "\n" || e === "\n") ? "+" : r ? "" : "-") + "\n";
|
|
2291
|
+
}
|
|
2292
|
+
function fa(e) {
|
|
2293
|
+
return e[e.length - 1] === "\n" ? e.slice(0, -1) : e;
|
|
2294
|
+
}
|
|
2295
|
+
function pa(e, t) {
|
|
2296
|
+
for (var n = /(\n+)([^\n]*)/g, r = function() {
|
|
2297
|
+
var r = e.indexOf("\n");
|
|
2298
|
+
return r = r === -1 ? e.length : r, n.lastIndex = r, ma(e.slice(0, r), t);
|
|
2299
|
+
}(), i = e[0] === "\n" || e[0] === " ", a, o; o = n.exec(e);) {
|
|
2300
|
+
var s = o[1], c = o[2];
|
|
2301
|
+
a = c[0] === " ", r += s + (!i && !a && c !== "" ? "\n" : "") + ma(c, t), i = a;
|
|
2302
|
+
}
|
|
2303
|
+
return r;
|
|
2304
|
+
}
|
|
2305
|
+
function ma(e, t) {
|
|
2306
|
+
if (e === "" || e[0] === " ") return e;
|
|
2307
|
+
for (var n = / [^ ]/g, r, i = 0, a, o = 0, s = 0, c = ""; r = n.exec(e);) s = r.index, s - i > t && (a = o > i ? o : s, c += "\n" + e.slice(i, a), i = a + 1), o = s;
|
|
2308
|
+
return c += "\n", e.length - i > t && o > i ? c += e.slice(i, o) + "\n" + e.slice(o + 1) : c += e.slice(i), c.slice(1);
|
|
2309
|
+
}
|
|
2310
|
+
function ha(e) {
|
|
2311
|
+
for (var t = "", n = 0, r, i = 0; i < e.length; n >= 65536 ? i += 2 : i++) n = na(e, i), r = G[n], !r && Zi(n) ? (t += e[i], n >= 65536 && (t += e[i + 1])) : t += r || Ui(n);
|
|
2312
|
+
return t;
|
|
2313
|
+
}
|
|
2314
|
+
function ga(e, t, n) {
|
|
2315
|
+
var r = "", i = e.tag, a, o, s;
|
|
2316
|
+
for (a = 0, o = n.length; a < o; a += 1) s = n[a], e.replacer && (s = e.replacer.call(n, String(a), s)), (K(e, t, s, !1, !1) || s === void 0 && K(e, t, null, !1, !1)) && (r !== "" && (r += "," + (e.condenseFlow ? "" : " ")), r += e.dump);
|
|
2317
|
+
e.tag = i, e.dump = "[" + r + "]";
|
|
2318
|
+
}
|
|
2319
|
+
function _a(e, t, n, r) {
|
|
2320
|
+
var i = "", a = e.tag, o, s, c;
|
|
2321
|
+
for (o = 0, s = n.length; o < s; o += 1) c = n[o], e.replacer && (c = e.replacer.call(n, String(o), c)), (K(e, t + 1, c, !0, !0, !1, !0) || c === void 0 && K(e, t + 1, null, !0, !0, !1, !0)) && ((!r || i !== "") && (i += Ji(e, t)), e.dump && _i === e.dump.charCodeAt(0) ? i += "-" : i += "- ", i += e.dump);
|
|
2322
|
+
e.tag = a, e.dump = i || "[]";
|
|
2323
|
+
}
|
|
2324
|
+
function va(e, t, n) {
|
|
2325
|
+
var r = "", i = e.tag, a = Object.keys(n), o, s, c, l, u;
|
|
2326
|
+
for (o = 0, s = a.length; o < s; o += 1) u = "", r !== "" && (u += ", "), e.condenseFlow && (u += "\""), c = a[o], l = n[c], e.replacer && (l = e.replacer.call(n, c, l)), K(e, t, c, !1, !1) && (e.dump.length > 1024 && (u += "? "), u += e.dump + (e.condenseFlow ? "\"" : "") + ":" + (e.condenseFlow ? "" : " "), K(e, t, l, !1, !1) && (u += e.dump, r += u));
|
|
2327
|
+
e.tag = i, e.dump = "{" + r + "}";
|
|
2328
|
+
}
|
|
2329
|
+
function ya(e, t, n, r) {
|
|
2330
|
+
var i = "", a = e.tag, o = Object.keys(n), s, c, l, u, d, f;
|
|
2331
|
+
if (e.sortKeys === !0) o.sort();
|
|
2332
|
+
else if (typeof e.sortKeys == "function") o.sort(e.sortKeys);
|
|
2333
|
+
else if (e.sortKeys) throw new I("sortKeys must be a boolean or a function");
|
|
2334
|
+
for (s = 0, c = o.length; s < c; s += 1) f = "", (!r || i !== "") && (f += Ji(e, t)), l = o[s], u = n[l], e.replacer && (u = e.replacer.call(n, l, u)), K(e, t + 1, l, !0, !0, !0) && (d = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, d && (e.dump && _i === e.dump.charCodeAt(0) ? f += "?" : f += "? "), f += e.dump, d && (f += Ji(e, t)), K(e, t + 1, u, !0, d) && (e.dump && _i === e.dump.charCodeAt(0) ? f += ":" : f += ": ", f += e.dump, i += f));
|
|
2335
|
+
e.tag = a, e.dump = i || "{}";
|
|
2336
|
+
}
|
|
2337
|
+
function ba(e, t, n) {
|
|
2338
|
+
var r, i = n ? e.explicitTypes : e.implicitTypes, a, o, s, c;
|
|
2339
|
+
for (a = 0, o = i.length; a < o; a += 1) if (s = i[a], (s.instanceOf || s.predicate) && (!s.instanceOf || typeof t == "object" && t instanceof s.instanceOf) && (!s.predicate || s.predicate(t))) {
|
|
2340
|
+
if (n ? s.multi && s.representName ? e.tag = s.representName(t) : e.tag = s.tag : e.tag = "?", s.represent) {
|
|
2341
|
+
if (c = e.styleMap[s.tag] || s.defaultStyle, pi.call(s.represent) === "[object Function]") r = s.represent(t, c);
|
|
2342
|
+
else if (mi.call(s.represent, c)) r = s.represent[c](t, c);
|
|
2343
|
+
else throw new I("!<" + s.tag + "> tag resolver accepts not \"" + c + "\" style");
|
|
2344
|
+
e.dump = r;
|
|
2345
|
+
}
|
|
2346
|
+
return !0;
|
|
2347
|
+
}
|
|
2348
|
+
return !1;
|
|
2349
|
+
}
|
|
2350
|
+
function K(e, t, n, r, i, a, o) {
|
|
2351
|
+
e.tag = null, e.dump = n, ba(e, n, !1) || ba(e, n, !0);
|
|
2352
|
+
var s = pi.call(e.dump), c = r, l;
|
|
2353
|
+
r &&= e.flowLevel < 0 || e.flowLevel > t;
|
|
2354
|
+
var u = s === "[object Object]" || s === "[object Array]", d, f;
|
|
2355
|
+
if (u && (d = e.duplicates.indexOf(n), f = d !== -1), (e.tag !== null && e.tag !== "?" || f || e.indent !== 2 && t > 0) && (i = !1), f && e.usedDuplicates[d]) e.dump = "*ref_" + d;
|
|
2356
|
+
else {
|
|
2357
|
+
if (u && f && !e.usedDuplicates[d] && (e.usedDuplicates[d] = !0), s === "[object Object]") r && Object.keys(e.dump).length !== 0 ? (ya(e, t, e.dump, i), f && (e.dump = "&ref_" + d + e.dump)) : (va(e, t, e.dump), f && (e.dump = "&ref_" + d + " " + e.dump));
|
|
2358
|
+
else if (s === "[object Array]") r && e.dump.length !== 0 ? (e.noArrayIndent && !o && t > 0 ? _a(e, t - 1, e.dump, i) : _a(e, t, e.dump, i), f && (e.dump = "&ref_" + d + e.dump)) : (ga(e, t, e.dump), f && (e.dump = "&ref_" + d + " " + e.dump));
|
|
2359
|
+
else if (s === "[object String]") e.tag !== "?" && ua(e, e.dump, t, a, c);
|
|
2360
|
+
else if (s === "[object Undefined]") return !1;
|
|
2361
|
+
else {
|
|
2362
|
+
if (e.skipInvalid) return !1;
|
|
2363
|
+
throw new I("unacceptable kind of an object to dump " + s);
|
|
2364
|
+
}
|
|
2365
|
+
e.tag !== null && e.tag !== "?" && (l = encodeURI(e.tag[0] === "!" ? e.tag.slice(1) : e.tag).replace(/!/g, "%21"), l = e.tag[0] === "!" ? "!" + l : l.slice(0, 18) === "tag:yaml.org,2002:" ? "!!" + l.slice(18) : "!<" + l + ">", e.dump = l + " " + e.dump);
|
|
2366
|
+
}
|
|
2367
|
+
return !0;
|
|
2368
|
+
}
|
|
2369
|
+
function xa(e, t) {
|
|
2370
|
+
var n = [], r = [], i, a;
|
|
2371
|
+
for (Sa(e, n, r), i = 0, a = r.length; i < a; i += 1) t.duplicates.push(n[r[i]]);
|
|
2372
|
+
t.usedDuplicates = Array(a);
|
|
2373
|
+
}
|
|
2374
|
+
function Sa(e, t, n) {
|
|
2375
|
+
var r, i, a;
|
|
2376
|
+
if (typeof e == "object" && e) if (i = t.indexOf(e), i !== -1) n.indexOf(i) === -1 && n.push(i);
|
|
2377
|
+
else if (t.push(e), Array.isArray(e)) for (i = 0, a = e.length; i < a; i += 1) Sa(e[i], t, n);
|
|
2378
|
+
else for (r = Object.keys(e), i = 0, a = r.length; i < a; i += 1) Sa(e[r[i]], t, n);
|
|
2379
|
+
}
|
|
2380
|
+
function Ca(e, t) {
|
|
2381
|
+
t ||= {};
|
|
2382
|
+
var n = new Ki(t);
|
|
2383
|
+
n.noRefs || xa(e, n);
|
|
2384
|
+
var r = e;
|
|
2385
|
+
return n.replacer && (r = n.replacer.call({ "": r }, "", r)), K(n, 0, r, !0, !0) ? n.dump + "\n" : "";
|
|
2386
|
+
}
|
|
2387
|
+
var wa = { dump: Ca }, Ta = fi.load;
|
|
2388
|
+
fi.loadAll, wa.dump;
|
|
2389
|
+
//#endregion
|
|
2390
|
+
//#region node_modules/.pnpm/valibot@1.4.0_typescript@6.0.3/node_modules/valibot/dist/index.mjs
|
|
2391
|
+
var Ea, Da = {
|
|
2392
|
+
lang: void 0,
|
|
2393
|
+
message: void 0,
|
|
2394
|
+
abortEarly: void 0,
|
|
2395
|
+
abortPipeEarly: void 0
|
|
2396
|
+
};
|
|
2397
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2398
|
+
function Oa(e) {
|
|
2399
|
+
return !e && !Ea ? Da : {
|
|
2400
|
+
lang: e?.lang ?? Ea?.lang,
|
|
2401
|
+
message: e?.message,
|
|
2402
|
+
abortEarly: e?.abortEarly ?? Ea?.abortEarly,
|
|
2403
|
+
abortPipeEarly: e?.abortPipeEarly ?? Ea?.abortPipeEarly
|
|
2404
|
+
};
|
|
2405
|
+
}
|
|
2406
|
+
var ka;
|
|
2407
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2408
|
+
function Aa(e) {
|
|
2409
|
+
return ka?.get(e);
|
|
2410
|
+
}
|
|
2411
|
+
var ja;
|
|
2412
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2413
|
+
function Ma(e) {
|
|
2414
|
+
return ja?.get(e);
|
|
2415
|
+
}
|
|
2416
|
+
var Na;
|
|
2417
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2418
|
+
function Pa(e, t) {
|
|
2419
|
+
return Na?.get(e)?.get(t);
|
|
2420
|
+
}
|
|
2421
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2422
|
+
function Fa(e) {
|
|
2423
|
+
let t = typeof e;
|
|
2424
|
+
return t === "string" ? `"${e}"` : t === "number" || t === "bigint" || t === "boolean" ? `${e}` : t === "object" || t === "function" ? (e && Object.getPrototypeOf(e)?.constructor?.name) ?? "null" : t;
|
|
2425
|
+
}
|
|
2426
|
+
function q(e, t, n, r, i) {
|
|
2427
|
+
let a = i && "input" in i ? i.input : n.value, o = i?.expected ?? e.expects ?? null, s = i?.received ?? /* @__PURE__ */ Fa(a), c = {
|
|
2428
|
+
kind: e.kind,
|
|
2429
|
+
type: e.type,
|
|
2430
|
+
input: a,
|
|
2431
|
+
expected: o,
|
|
2432
|
+
received: s,
|
|
2433
|
+
message: `Invalid ${t}: ${o ? `Expected ${o} but r` : "R"}eceived ${s}`,
|
|
2434
|
+
requirement: e.requirement,
|
|
2435
|
+
path: i?.path,
|
|
2436
|
+
issues: i?.issues,
|
|
2437
|
+
lang: r.lang,
|
|
2438
|
+
abortEarly: r.abortEarly,
|
|
2439
|
+
abortPipeEarly: r.abortPipeEarly
|
|
2440
|
+
}, l = e.kind === "schema", u = i?.message ?? e.message ?? /* @__PURE__ */ Pa(e.reference, c.lang) ?? (l ? /* @__PURE__ */ Ma(c.lang) : null) ?? r.message ?? /* @__PURE__ */ Aa(c.lang);
|
|
2441
|
+
u !== void 0 && (c.message = typeof u == "function" ? u(c) : u), l && (n.typed = !1), n.issues ? n.issues.push(c) : n.issues = [c];
|
|
2442
|
+
}
|
|
2443
|
+
var Ia = /* @__PURE__ */ new WeakMap();
|
|
2444
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2445
|
+
function J(e) {
|
|
2446
|
+
let t = Ia.get(e);
|
|
2447
|
+
return t || (t = {
|
|
2448
|
+
version: 1,
|
|
2449
|
+
vendor: "valibot",
|
|
2450
|
+
validate(t) {
|
|
2451
|
+
return e["~run"]({ value: t }, /* @__PURE__ */ Oa());
|
|
2452
|
+
}
|
|
2453
|
+
}, Ia.set(e, t)), t;
|
|
2454
|
+
}
|
|
2455
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2456
|
+
function La(e, t) {
|
|
2457
|
+
let n = [...new Set(e)];
|
|
2458
|
+
return n.length > 1 ? `(${n.join(` ${t} `)})` : n[0] ?? "never";
|
|
2459
|
+
}
|
|
2460
|
+
var Ra = { abortEarly: !0 };
|
|
2461
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2462
|
+
function za(e, t, n) {
|
|
2463
|
+
return typeof e.fallback == "function" ? e.fallback(t, n) : e.fallback;
|
|
2464
|
+
}
|
|
2465
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2466
|
+
function Ba(e, t, n) {
|
|
2467
|
+
return typeof e.default == "function" ? e.default(t, n) : e.default;
|
|
2468
|
+
}
|
|
2469
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2470
|
+
function Y(e, t) {
|
|
2471
|
+
return {
|
|
2472
|
+
kind: "schema",
|
|
2473
|
+
type: "array",
|
|
2474
|
+
reference: Y,
|
|
2475
|
+
expects: "Array",
|
|
2476
|
+
async: !1,
|
|
2477
|
+
item: e,
|
|
2478
|
+
message: t,
|
|
2479
|
+
get "~standard"() {
|
|
2480
|
+
return /* @__PURE__ */ J(this);
|
|
2481
|
+
},
|
|
2482
|
+
"~run"(e, t) {
|
|
2483
|
+
let n = e.value;
|
|
2484
|
+
if (Array.isArray(n)) {
|
|
2485
|
+
e.typed = !0, e.value = [];
|
|
2486
|
+
for (let r = 0; r < n.length; r++) {
|
|
2487
|
+
let i = n[r], a = this.item["~run"]({ value: i }, t);
|
|
2488
|
+
if (a.issues) {
|
|
2489
|
+
let o = {
|
|
2490
|
+
type: "array",
|
|
2491
|
+
origin: "value",
|
|
2492
|
+
input: n,
|
|
2493
|
+
key: r,
|
|
2494
|
+
value: i
|
|
2495
|
+
};
|
|
2496
|
+
for (let t of a.issues) t.path ? t.path.unshift(o) : t.path = [o], e.issues?.push(t);
|
|
2497
|
+
if (e.issues ||= a.issues, t.abortEarly) {
|
|
2498
|
+
e.typed = !1;
|
|
2499
|
+
break;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
a.typed || (e.typed = !1), e.value.push(a.value);
|
|
2503
|
+
}
|
|
2504
|
+
} else q(this, "type", e, t);
|
|
2505
|
+
return e;
|
|
2506
|
+
}
|
|
2507
|
+
};
|
|
2508
|
+
}
|
|
2509
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2510
|
+
function Va(e) {
|
|
2511
|
+
return {
|
|
2512
|
+
kind: "schema",
|
|
2513
|
+
type: "boolean",
|
|
2514
|
+
reference: Va,
|
|
2515
|
+
expects: "boolean",
|
|
2516
|
+
async: !1,
|
|
2517
|
+
message: e,
|
|
2518
|
+
get "~standard"() {
|
|
2519
|
+
return /* @__PURE__ */ J(this);
|
|
2520
|
+
},
|
|
2521
|
+
"~run"(e, t) {
|
|
2522
|
+
return typeof e.value == "boolean" ? e.typed = !0 : q(this, "type", e, t), e;
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
}
|
|
2526
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2527
|
+
function X(e, t) {
|
|
2528
|
+
return {
|
|
2529
|
+
kind: "schema",
|
|
2530
|
+
type: "literal",
|
|
2531
|
+
reference: X,
|
|
2532
|
+
expects: /* @__PURE__ */ Fa(e),
|
|
2533
|
+
async: !1,
|
|
2534
|
+
literal: e,
|
|
2535
|
+
message: t,
|
|
2536
|
+
get "~standard"() {
|
|
2537
|
+
return /* @__PURE__ */ J(this);
|
|
2538
|
+
},
|
|
2539
|
+
"~run"(e, t) {
|
|
2540
|
+
return e.value === this.literal ? e.typed = !0 : q(this, "type", e, t), e;
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2545
|
+
function Ha(e) {
|
|
2546
|
+
return {
|
|
2547
|
+
kind: "schema",
|
|
2548
|
+
type: "number",
|
|
2549
|
+
reference: Ha,
|
|
2550
|
+
expects: "number",
|
|
2551
|
+
async: !1,
|
|
2552
|
+
message: e,
|
|
2553
|
+
get "~standard"() {
|
|
2554
|
+
return /* @__PURE__ */ J(this);
|
|
2555
|
+
},
|
|
2556
|
+
"~run"(e, t) {
|
|
2557
|
+
return typeof e.value == "number" && !isNaN(e.value) ? e.typed = !0 : q(this, "type", e, t), e;
|
|
2558
|
+
}
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2562
|
+
function Z(e, t) {
|
|
2563
|
+
return {
|
|
2564
|
+
kind: "schema",
|
|
2565
|
+
type: "object",
|
|
2566
|
+
reference: Z,
|
|
2567
|
+
expects: "Object",
|
|
2568
|
+
async: !1,
|
|
2569
|
+
entries: e,
|
|
2570
|
+
message: t,
|
|
2571
|
+
get "~standard"() {
|
|
2572
|
+
return /* @__PURE__ */ J(this);
|
|
2573
|
+
},
|
|
2574
|
+
"~run"(e, t) {
|
|
2575
|
+
let n = e.value;
|
|
2576
|
+
if (n && typeof n == "object") {
|
|
2577
|
+
e.typed = !0, e.value = {};
|
|
2578
|
+
for (let r in this.entries) {
|
|
2579
|
+
let i = this.entries[r];
|
|
2580
|
+
if (r in n || (i.type === "exact_optional" || i.type === "optional" || i.type === "nullish") && i.default !== void 0) {
|
|
2581
|
+
let a = r in n ? n[r] : /* @__PURE__ */ Ba(i), o = i["~run"]({ value: a }, t);
|
|
2582
|
+
if (o.issues) {
|
|
2583
|
+
let i = {
|
|
2584
|
+
type: "object",
|
|
2585
|
+
origin: "value",
|
|
2586
|
+
input: n,
|
|
2587
|
+
key: r,
|
|
2588
|
+
value: a
|
|
2589
|
+
};
|
|
2590
|
+
for (let t of o.issues) t.path ? t.path.unshift(i) : t.path = [i], e.issues?.push(t);
|
|
2591
|
+
if (e.issues ||= o.issues, t.abortEarly) {
|
|
2592
|
+
e.typed = !1;
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
o.typed || (e.typed = !1), e.value[r] = o.value;
|
|
2597
|
+
} else if (i.fallback !== void 0) e.value[r] = /* @__PURE__ */ za(i);
|
|
2598
|
+
else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (q(this, "key", e, t, {
|
|
2599
|
+
input: void 0,
|
|
2600
|
+
expected: `"${r}"`,
|
|
2601
|
+
path: [{
|
|
2602
|
+
type: "object",
|
|
2603
|
+
origin: "key",
|
|
2604
|
+
input: n,
|
|
2605
|
+
key: r,
|
|
2606
|
+
value: n[r]
|
|
2607
|
+
}]
|
|
2608
|
+
}), t.abortEarly)) break;
|
|
2609
|
+
}
|
|
2610
|
+
} else q(this, "type", e, t);
|
|
2611
|
+
return e;
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2615
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2616
|
+
function Q(e, t) {
|
|
2617
|
+
return {
|
|
2618
|
+
kind: "schema",
|
|
2619
|
+
type: "optional",
|
|
2620
|
+
reference: Q,
|
|
2621
|
+
expects: `(${e.expects} | undefined)`,
|
|
2622
|
+
async: !1,
|
|
2623
|
+
wrapped: e,
|
|
2624
|
+
default: t,
|
|
2625
|
+
get "~standard"() {
|
|
2626
|
+
return /* @__PURE__ */ J(this);
|
|
2627
|
+
},
|
|
2628
|
+
"~run"(e, t) {
|
|
2629
|
+
return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ Ba(this, e, t)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
|
|
2630
|
+
}
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2634
|
+
function $(e) {
|
|
2635
|
+
return {
|
|
2636
|
+
kind: "schema",
|
|
2637
|
+
type: "string",
|
|
2638
|
+
reference: $,
|
|
2639
|
+
expects: "string",
|
|
2640
|
+
async: !1,
|
|
2641
|
+
message: e,
|
|
2642
|
+
get "~standard"() {
|
|
2643
|
+
return /* @__PURE__ */ J(this);
|
|
2644
|
+
},
|
|
2645
|
+
"~run"(e, t) {
|
|
2646
|
+
return typeof e.value == "string" ? e.typed = !0 : q(this, "type", e, t), e;
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2651
|
+
function Ua(e, t, n) {
|
|
2652
|
+
return {
|
|
2653
|
+
kind: "schema",
|
|
2654
|
+
type: "variant",
|
|
2655
|
+
reference: Ua,
|
|
2656
|
+
expects: "Object",
|
|
2657
|
+
async: !1,
|
|
2658
|
+
key: e,
|
|
2659
|
+
options: t,
|
|
2660
|
+
message: n,
|
|
2661
|
+
get "~standard"() {
|
|
2662
|
+
return /* @__PURE__ */ J(this);
|
|
2663
|
+
},
|
|
2664
|
+
"~run"(e, t) {
|
|
2665
|
+
let n = e.value;
|
|
2666
|
+
if (n && typeof n == "object") {
|
|
2667
|
+
let r, i = 0, a = this.key, o = [], s = (e, c) => {
|
|
2668
|
+
for (let l of e.options) {
|
|
2669
|
+
if (l.type === "variant") s(l, new Set(c).add(l.key));
|
|
2670
|
+
else {
|
|
2671
|
+
let e = !0, s = 0;
|
|
2672
|
+
for (let t of c) {
|
|
2673
|
+
let r = l.entries[t];
|
|
2674
|
+
if (t in n ? r["~run"]({
|
|
2675
|
+
typed: !1,
|
|
2676
|
+
value: n[t]
|
|
2677
|
+
}, Ra).issues : r.type !== "exact_optional" && r.type !== "optional" && r.type !== "nullish") {
|
|
2678
|
+
e = !1, a !== t && (i < s || i === s && t in n && !(a in n)) && (i = s, a = t, o = []), a === t && o.push(l.entries[t].expects);
|
|
2679
|
+
break;
|
|
2680
|
+
}
|
|
2681
|
+
s++;
|
|
2682
|
+
}
|
|
2683
|
+
if (e) {
|
|
2684
|
+
let e = l["~run"]({ value: n }, t);
|
|
2685
|
+
(!r || !r.typed && e.typed) && (r = e);
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
if (r && !r.issues) break;
|
|
2689
|
+
}
|
|
2690
|
+
};
|
|
2691
|
+
if (s(this, new Set([this.key])), r) return r;
|
|
2692
|
+
q(this, "type", e, t, {
|
|
2693
|
+
input: n[a],
|
|
2694
|
+
expected: /* @__PURE__ */ La(o, "|"),
|
|
2695
|
+
path: [{
|
|
2696
|
+
type: "object",
|
|
2697
|
+
origin: "value",
|
|
2698
|
+
input: n,
|
|
2699
|
+
key: a,
|
|
2700
|
+
value: n[a]
|
|
2701
|
+
}]
|
|
2702
|
+
});
|
|
2703
|
+
} else q(this, "type", e, t);
|
|
2704
|
+
return e;
|
|
2705
|
+
}
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2709
|
+
function Wa(e, t, n) {
|
|
2710
|
+
let r = e["~run"]({ value: t }, /* @__PURE__ */ Oa(n));
|
|
2711
|
+
return {
|
|
2712
|
+
typed: r.typed,
|
|
2713
|
+
success: !r.issues,
|
|
2714
|
+
output: r.value,
|
|
2715
|
+
issues: r.issues
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
//#endregion
|
|
2719
|
+
//#region src/helper/issue-tyepe.ts
|
|
2720
|
+
var Ga = /* @__PURE__ */ Z({ required: /* @__PURE__ */ Q(/* @__PURE__ */ Va()) }), Ka = /* @__PURE__ */ Z({
|
|
2721
|
+
name: /* @__PURE__ */ $(),
|
|
2722
|
+
description: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2723
|
+
title: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2724
|
+
labels: /* @__PURE__ */ Q(/* @__PURE__ */ Y(/* @__PURE__ */ $())),
|
|
2725
|
+
projects: /* @__PURE__ */ Q(/* @__PURE__ */ Y(/* @__PURE__ */ $())),
|
|
2726
|
+
assignees: /* @__PURE__ */ Q(/* @__PURE__ */ Y(/* @__PURE__ */ $())),
|
|
2727
|
+
type: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2728
|
+
body: /* @__PURE__ */ Y(/* @__PURE__ */ Ua("type", [
|
|
2729
|
+
/* @__PURE__ */ Z({
|
|
2730
|
+
type: /* @__PURE__ */ X("markdown"),
|
|
2731
|
+
attributes: /* @__PURE__ */ Z({ value: /* @__PURE__ */ $() })
|
|
2732
|
+
}),
|
|
2733
|
+
/* @__PURE__ */ Z({
|
|
2734
|
+
type: /* @__PURE__ */ X("input"),
|
|
2735
|
+
id: /* @__PURE__ */ $(),
|
|
2736
|
+
attributes: /* @__PURE__ */ Z({
|
|
2737
|
+
label: /* @__PURE__ */ $(),
|
|
2738
|
+
description: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2739
|
+
placeholder: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2740
|
+
value: /* @__PURE__ */ Q(/* @__PURE__ */ $())
|
|
2741
|
+
}),
|
|
2742
|
+
validations: /* @__PURE__ */ Q(Ga)
|
|
2743
|
+
}),
|
|
2744
|
+
/* @__PURE__ */ Z({
|
|
2745
|
+
type: /* @__PURE__ */ X("textarea"),
|
|
2746
|
+
id: /* @__PURE__ */ $(),
|
|
2747
|
+
attributes: /* @__PURE__ */ Z({
|
|
2748
|
+
label: /* @__PURE__ */ $(),
|
|
2749
|
+
description: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2750
|
+
placeholder: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2751
|
+
value: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2752
|
+
render: /* @__PURE__ */ Q(/* @__PURE__ */ $())
|
|
2753
|
+
}),
|
|
2754
|
+
validations: /* @__PURE__ */ Q(Ga)
|
|
2755
|
+
}),
|
|
2756
|
+
/* @__PURE__ */ Z({
|
|
2757
|
+
type: /* @__PURE__ */ X("dropdown"),
|
|
2758
|
+
id: /* @__PURE__ */ $(),
|
|
2759
|
+
attributes: /* @__PURE__ */ Z({
|
|
2760
|
+
label: /* @__PURE__ */ $(),
|
|
2761
|
+
description: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2762
|
+
multiple: /* @__PURE__ */ Q(/* @__PURE__ */ Va()),
|
|
2763
|
+
options: /* @__PURE__ */ Y(/* @__PURE__ */ $()),
|
|
2764
|
+
default: /* @__PURE__ */ Q(/* @__PURE__ */ Ha())
|
|
2765
|
+
}),
|
|
2766
|
+
validations: /* @__PURE__ */ Q(Ga)
|
|
2767
|
+
}),
|
|
2768
|
+
/* @__PURE__ */ Z({
|
|
2769
|
+
type: /* @__PURE__ */ X("checkboxes"),
|
|
2770
|
+
id: /* @__PURE__ */ $(),
|
|
2771
|
+
attributes: /* @__PURE__ */ Z({
|
|
2772
|
+
label: /* @__PURE__ */ $(),
|
|
2773
|
+
description: /* @__PURE__ */ Q(/* @__PURE__ */ $()),
|
|
2774
|
+
options: /* @__PURE__ */ Y(/* @__PURE__ */ Z({
|
|
2775
|
+
label: /* @__PURE__ */ $(),
|
|
2776
|
+
required: /* @__PURE__ */ Q(/* @__PURE__ */ Va())
|
|
2777
|
+
}))
|
|
2778
|
+
}),
|
|
2779
|
+
validations: /* @__PURE__ */ Q(Ga)
|
|
2780
|
+
}),
|
|
2781
|
+
/* @__PURE__ */ Z({
|
|
2782
|
+
type: /* @__PURE__ */ X("upload"),
|
|
2783
|
+
id: /* @__PURE__ */ $(),
|
|
2784
|
+
attributes: /* @__PURE__ */ Z({
|
|
2785
|
+
label: /* @__PURE__ */ $(),
|
|
2786
|
+
description: /* @__PURE__ */ Q(/* @__PURE__ */ $())
|
|
2787
|
+
}),
|
|
2788
|
+
validations: /* @__PURE__ */ Q(Ga)
|
|
2789
|
+
})
|
|
2790
|
+
]))
|
|
2791
|
+
});
|
|
2792
|
+
//#endregion
|
|
2793
|
+
//#region src/helper/yml.ts
|
|
2794
|
+
function qa(e) {
|
|
2795
|
+
let t = f(process.cwd(), ".github", "ISSUE_TEMPLATE");
|
|
2796
|
+
return e.map((e) => {
|
|
2797
|
+
let n = /* @__PURE__ */ Wa(Ka, Ta(s(f(t, e), "utf8")));
|
|
2798
|
+
if (!n.success) throw Error(`Invalid issue template: ${e}`);
|
|
2799
|
+
return {
|
|
2800
|
+
fileName: e,
|
|
2801
|
+
name: n.output.name,
|
|
2802
|
+
contents: n.output
|
|
2803
|
+
};
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
//#endregion
|
|
2807
|
+
//#region src/command/create.ts
|
|
2808
|
+
async function Ja(e) {
|
|
2809
|
+
return await Gt({
|
|
2810
|
+
message: "Select an issue template",
|
|
2811
|
+
options: e.map((e) => ({
|
|
2812
|
+
title: e.name,
|
|
2813
|
+
value: e.fileName
|
|
2814
|
+
})),
|
|
2815
|
+
cancelMessage: "No template selected. Canceled.",
|
|
2816
|
+
errorMessage: "Failed to select an issue template"
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
//#endregion
|
|
2820
|
+
//#region src/helper/checkboxes-parser.ts
|
|
2821
|
+
function Ya({ items: e, selectedItems: t, title: n }) {
|
|
2822
|
+
let r = new Set(t);
|
|
2823
|
+
return {
|
|
2824
|
+
title: n,
|
|
2825
|
+
contents: `${e.map((e) => `- [${r.has(e) ? "x" : " "}] ${e}`).join("\n")}\n`
|
|
2826
|
+
};
|
|
2827
|
+
}
|
|
2828
|
+
//#endregion
|
|
2829
|
+
//#region src/helper/textarea-editor.ts
|
|
2830
|
+
var Xa = "<!-- gh-issue:", Za = "-->";
|
|
2831
|
+
function Qa() {
|
|
2832
|
+
return f(oe(), `.gh-issue-${ae()}.md`);
|
|
2833
|
+
}
|
|
2834
|
+
function $a({ title: e, description: t, initialValue: n }) {
|
|
2835
|
+
let r = [
|
|
2836
|
+
e ? `${Xa} Title: ${e} ${Za}` : `${Xa} Title: Enter content below ${Za}`,
|
|
2837
|
+
t ? `${Xa} Details: ${t} ${Za}` : `${Xa} Details: The guide comments at the top are not included ${Za}`,
|
|
2838
|
+
`${Xa} Write your content below this line. ${Za}\n`,
|
|
2839
|
+
""
|
|
2840
|
+
];
|
|
2841
|
+
return n.length === 0 ? r.join("\n") : `${r.join("\n")}${n}`;
|
|
2842
|
+
}
|
|
2843
|
+
function eo(e) {
|
|
2844
|
+
return e.replace(/^(?:<!-- gh-issue:[\s\S]*?-->\s*)+/, "").trim();
|
|
2845
|
+
}
|
|
2846
|
+
function to(e) {
|
|
2847
|
+
let t = ne("vim", [e], { stdio: "inherit" });
|
|
2848
|
+
if (t.error) throw t.error;
|
|
2849
|
+
if (t.status !== 0) throw Error(`vim exited with status ${t.status ?? "unknown"}`);
|
|
2850
|
+
}
|
|
2851
|
+
async function no({ initialValue: e = "", title: t, description: n }) {
|
|
2852
|
+
let { checkPromiseReturn: o, checkPromiseVoid: s, createNg: c, createOk: l, checkResultVoid: u } = w, d = Qa();
|
|
2853
|
+
try {
|
|
2854
|
+
let i = await s({
|
|
2855
|
+
fn: async () => {
|
|
2856
|
+
await a(d, $a({
|
|
2857
|
+
title: t,
|
|
2858
|
+
description: n,
|
|
2859
|
+
initialValue: e
|
|
2860
|
+
}), { flag: "wx" });
|
|
2861
|
+
},
|
|
2862
|
+
err: (e) => c(e)
|
|
2863
|
+
});
|
|
2864
|
+
if (i.isErr) return i;
|
|
2865
|
+
let f = u({
|
|
2866
|
+
fn: () => to(d),
|
|
2867
|
+
err: (e) => c(e)
|
|
2868
|
+
});
|
|
2869
|
+
if (f.isErr) return f;
|
|
2870
|
+
let p = await o({
|
|
2871
|
+
fn: async () => await r(d, "utf8"),
|
|
2872
|
+
err: (e) => c(e)
|
|
2873
|
+
});
|
|
2874
|
+
return p.isErr ? p : l(eo(p.value));
|
|
2875
|
+
} finally {
|
|
2876
|
+
await i(d).catch(() => void 0);
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
//#endregion
|
|
2880
|
+
//#region src/helper/textarea-options.ts
|
|
2881
|
+
function ro(e) {
|
|
2882
|
+
let { createNone: t, createSome: n } = ue;
|
|
2883
|
+
return e?.vim === !0 ? n("vim") : e?.vim === !1 || e?.noVim === !0 ? n("direct") : t();
|
|
2884
|
+
}
|
|
2885
|
+
//#endregion
|
|
2886
|
+
//#region src/helper/create-contents.ts
|
|
2887
|
+
async function io(e, t) {
|
|
2888
|
+
let { createOk: n, createNg: r } = w, { createNone: i, createSome: a } = ue;
|
|
2889
|
+
switch (e.type) {
|
|
2890
|
+
case "markdown": return M.message((0, P.blue)(e.attributes.value)), n(i());
|
|
2891
|
+
case "input": {
|
|
2892
|
+
M.message(`${(0, P.bold)((0, P.blue)(e.attributes.label))} ${e.validations?.required ? (0, P.red)("*") : ""}\n\n`), M.message((0, P.blue)(e.attributes.description || "No description") + "\n");
|
|
2893
|
+
let t = await Ut({
|
|
2894
|
+
message: e.attributes.label,
|
|
2895
|
+
placeholder: e.attributes.placeholder
|
|
2896
|
+
});
|
|
2897
|
+
return t.isErr ? r(t.err) : e.validations?.required && t.value.trim().length === 0 ? r(/* @__PURE__ */ Error("This field is required")) : n(a({
|
|
2898
|
+
title: e.attributes.label,
|
|
2899
|
+
contents: t.value
|
|
2900
|
+
}));
|
|
2901
|
+
}
|
|
2902
|
+
case "textarea": {
|
|
2903
|
+
M.message(`${(0, P.bold)((0, P.blue)(e.attributes.label))} ${e.validations?.required ? (0, P.red)("*") : ""}\n\n`), M.message((0, P.blue)(e.attributes.description || "No description") + "\n");
|
|
2904
|
+
let i = e.validations?.required === !0, o = ro(t), s;
|
|
2905
|
+
if (o.isNone) {
|
|
2906
|
+
let t = [{
|
|
2907
|
+
title: "Open in vim",
|
|
2908
|
+
value: "vim",
|
|
2909
|
+
hint: "Edit in a temporary hidden file",
|
|
2910
|
+
selected: !0
|
|
2911
|
+
}, {
|
|
2912
|
+
title: "Enter directly",
|
|
2913
|
+
value: "direct",
|
|
2914
|
+
hint: "Use the current multiline prompt"
|
|
2915
|
+
}];
|
|
2916
|
+
i || t.push({
|
|
2917
|
+
title: "Do not enter content",
|
|
2918
|
+
value: "skip",
|
|
2919
|
+
hint: "Store an empty string for this field"
|
|
2920
|
+
});
|
|
2921
|
+
let n = await Gt({
|
|
2922
|
+
message: `${e.attributes.label}\nChoose how to enter the textarea content`,
|
|
2923
|
+
options: t
|
|
2924
|
+
});
|
|
2925
|
+
if (n.isErr) return r(n.err);
|
|
2926
|
+
s = n.value;
|
|
2927
|
+
} else if (i) s = o.value;
|
|
2928
|
+
else {
|
|
2929
|
+
let t = await Gt({
|
|
2930
|
+
message: `${e.attributes.label}\nChoose whether to edit this textarea content`,
|
|
2931
|
+
options: [{
|
|
2932
|
+
title: o.value === "vim" ? "Edit in vim" : "Enter directly",
|
|
2933
|
+
value: "edit",
|
|
2934
|
+
selected: !0
|
|
2935
|
+
}, {
|
|
2936
|
+
title: "Do not enter content",
|
|
2937
|
+
value: "skip",
|
|
2938
|
+
hint: "Store an empty string for this field"
|
|
2939
|
+
}]
|
|
2940
|
+
});
|
|
2941
|
+
if (t.isErr) return r(t.err);
|
|
2942
|
+
s = t.value === "skip" ? "skip" : o.value;
|
|
2943
|
+
}
|
|
2944
|
+
let c = s === "skip" ? w.createOk("") : s === "vim" ? await no({
|
|
2945
|
+
initialValue: e.attributes.value,
|
|
2946
|
+
title: e.attributes.label,
|
|
2947
|
+
description: e.attributes.description
|
|
2948
|
+
}) : await Wt({
|
|
2949
|
+
message: e.attributes.label,
|
|
2950
|
+
placeholder: e.attributes.placeholder
|
|
2951
|
+
});
|
|
2952
|
+
return c.isErr ? r(c.err) : i && c.value.trim().length === 0 ? r(/* @__PURE__ */ Error("This field is required")) : n(a({
|
|
2953
|
+
title: e.attributes.label,
|
|
2954
|
+
contents: c.value
|
|
2955
|
+
}));
|
|
2956
|
+
}
|
|
2957
|
+
case "checkboxes": {
|
|
2958
|
+
M.message(`${(0, P.bold)((0, P.blue)(e.attributes.label))} ${e.validations?.required ? (0, P.red)("*") : ""}\n\n`), M.message((0, P.blue)(e.attributes.description || "No description") + "\n");
|
|
2959
|
+
let t = e.attributes.options.map((e) => ({
|
|
2960
|
+
title: e.label,
|
|
2961
|
+
value: e.label,
|
|
2962
|
+
selected: e.required || !1
|
|
2963
|
+
})), i = await Kt({
|
|
2964
|
+
message: e.attributes.label,
|
|
2965
|
+
options: t
|
|
2966
|
+
});
|
|
2967
|
+
if (i.isErr) return r(i.err);
|
|
2968
|
+
if (e.validations?.required && i.value.length === 0) return r(/* @__PURE__ */ Error("At least one option must be selected"));
|
|
2969
|
+
for (let t of e.attributes.options) if (t.required && !i.value.includes(t.label)) return r(/* @__PURE__ */ Error(`The option "${t.label}" is required`));
|
|
2970
|
+
return n(a(Ya({
|
|
2971
|
+
items: e.attributes.options.map((e) => e.label),
|
|
2972
|
+
selectedItems: i.value,
|
|
2973
|
+
title: e.attributes.label
|
|
2974
|
+
})));
|
|
2975
|
+
}
|
|
2976
|
+
case "dropdown": {
|
|
2977
|
+
M.message(`${(0, P.bold)((0, P.blue)(e.attributes.label))} ${e.validations?.required ? (0, P.red)("*") : ""}\n\n`), M.message((0, P.blue)(e.attributes.description || "No description") + "\n");
|
|
2978
|
+
let t = e.attributes.options.map((t, n) => ({
|
|
2979
|
+
title: t,
|
|
2980
|
+
value: t,
|
|
2981
|
+
selected: e.attributes.default === n
|
|
2982
|
+
})), i = await Gt({
|
|
2983
|
+
message: e.attributes.label,
|
|
2984
|
+
options: t
|
|
2985
|
+
});
|
|
2986
|
+
return i.isErr ? r(i.err) : e.validations?.required && i.value === "" ? r(/* @__PURE__ */ Error("This field is required")) : n(a({
|
|
2987
|
+
title: e.attributes.label,
|
|
2988
|
+
contents: i.value
|
|
2989
|
+
}));
|
|
2990
|
+
}
|
|
2991
|
+
case "upload": return M.message(`${(0, P.bold)((0, P.blue)(e.attributes.label))} ${e.validations?.required ? (0, P.red)("*") : ""}\n\n`), M.message((0, P.blue)(e.attributes.description || "No description") + "\n"), M.message((0, P.blue)("File upload is not supported in this version") + "\n"), n(i());
|
|
2992
|
+
default: return r(/* @__PURE__ */ Error(`Unsupported content type: ${e.type}`));
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
//#endregion
|
|
2996
|
+
//#region src/helper/write-issue-markdown.ts
|
|
2997
|
+
var ao = "title", oo = "assign", so = [
|
|
2998
|
+
"ancient",
|
|
2999
|
+
"blue",
|
|
3000
|
+
"brave",
|
|
3001
|
+
"calm",
|
|
3002
|
+
"cool",
|
|
3003
|
+
"fancy",
|
|
3004
|
+
"gentle",
|
|
3005
|
+
"golden",
|
|
3006
|
+
"quiet",
|
|
3007
|
+
"swift"
|
|
3008
|
+
], co = [
|
|
3009
|
+
"cloud",
|
|
3010
|
+
"field",
|
|
3011
|
+
"forest",
|
|
3012
|
+
"moon",
|
|
3013
|
+
"ocean",
|
|
3014
|
+
"river",
|
|
3015
|
+
"shadow",
|
|
3016
|
+
"smoke",
|
|
3017
|
+
"stone",
|
|
3018
|
+
"wind"
|
|
3019
|
+
];
|
|
3020
|
+
function lo(e) {
|
|
3021
|
+
let { createNg: t, createOk: n } = w, r = e.find((e) => e.title === ao), i = e.find((e) => e.title === oo);
|
|
3022
|
+
if (!r) return t(/* @__PURE__ */ Error("Title content is required"));
|
|
3023
|
+
let a = e.filter((e) => e.title !== ao && e.title !== oo), o = ["---", `title: ${r.contents}`];
|
|
3024
|
+
i && i.contents.trim().length > 0 && o.push(`assign: ${i.contents}`), o.push("---", "");
|
|
3025
|
+
for (let e of a) o.push(`## ${e.title}`, "", e.contents, "");
|
|
3026
|
+
return n(o.join("\n"));
|
|
3027
|
+
}
|
|
3028
|
+
function uo() {
|
|
3029
|
+
return `${so[ie(0, so.length)]}-${co[ie(0, co.length)]}-${ie(1e3, 1e4)}.md`;
|
|
3030
|
+
}
|
|
3031
|
+
async function fo(e, t = process.cwd()) {
|
|
3032
|
+
let { checkPromiseReturn: r, createNg: i, createOk: o } = w, { optionConversion: s } = ue, c = f(t, ".gh-issue"), l = lo(e);
|
|
3033
|
+
if (l.isErr) return l;
|
|
3034
|
+
let u = await r({
|
|
3035
|
+
fn: async () => s(await n(c, { recursive: !0 })),
|
|
3036
|
+
err: (e) => i(e)
|
|
3037
|
+
});
|
|
3038
|
+
if (u.isErr) return u;
|
|
3039
|
+
for (let e = 0; e < 10; e++) {
|
|
3040
|
+
let e = f(c, uo()), t = await r({
|
|
3041
|
+
fn: async () => s(await a(e, l.value, { flag: "wx" })),
|
|
3042
|
+
err: (e) => i(e)
|
|
3043
|
+
});
|
|
3044
|
+
if (t.isOk) return o(e);
|
|
3045
|
+
if (!(t.err instanceof Error && "code" in t.err && t.err.code === "EEXIST")) return t;
|
|
3046
|
+
}
|
|
3047
|
+
return i(/* @__PURE__ */ Error("Failed to generate a unique markdown file name"));
|
|
3048
|
+
}
|
|
3049
|
+
//#endregion
|
|
3050
|
+
//#region src/action/create.ts
|
|
3051
|
+
function po() {
|
|
3052
|
+
let { checkResultReturn: e, createNg: t, createOk: n } = w, r = e({
|
|
3053
|
+
fn: () => te("gh", [
|
|
3054
|
+
"repo",
|
|
3055
|
+
"view",
|
|
3056
|
+
"--json",
|
|
3057
|
+
"nameWithOwner",
|
|
3058
|
+
"--jq",
|
|
3059
|
+
".nameWithOwner"
|
|
3060
|
+
], {
|
|
3061
|
+
encoding: "utf8",
|
|
3062
|
+
stdio: [
|
|
3063
|
+
"ignore",
|
|
3064
|
+
"pipe",
|
|
3065
|
+
"pipe"
|
|
3066
|
+
]
|
|
3067
|
+
}).trim(),
|
|
3068
|
+
err: (e) => t(/* @__PURE__ */ Error(`error:${e}`))
|
|
3069
|
+
});
|
|
3070
|
+
return r.isErr ? r : r.value.length === 0 ? n([]) : e({
|
|
3071
|
+
fn: () => te("gh", [
|
|
3072
|
+
"api",
|
|
3073
|
+
`repos/${r.value}/assignees`,
|
|
3074
|
+
"--jq",
|
|
3075
|
+
".[].login"
|
|
3076
|
+
], {
|
|
3077
|
+
encoding: "utf8",
|
|
3078
|
+
stdio: [
|
|
3079
|
+
"ignore",
|
|
3080
|
+
"pipe",
|
|
3081
|
+
"pipe"
|
|
3082
|
+
]
|
|
3083
|
+
}).trim().split("\n").filter(Boolean),
|
|
3084
|
+
err: (e) => t(`error: ${e}`)
|
|
3085
|
+
});
|
|
3086
|
+
}
|
|
3087
|
+
async function mo(e = {}) {
|
|
3088
|
+
let { checkResultReturn: t, createNg: n } = w, { optionConversion: r } = ue;
|
|
3089
|
+
o(f(process.cwd(), ".gh-issue")) || (M.error(".gh-issue directory does not exist. Please run `gh-issue-kit init` first."), process.exit(1));
|
|
3090
|
+
let i = en(), a = [];
|
|
3091
|
+
i.isErr && (M.error(`Error: ${i.err.message}`), process.exit(1));
|
|
3092
|
+
let s = t({
|
|
3093
|
+
fn: () => qa(i.value),
|
|
3094
|
+
err: (e) => n(e)
|
|
3095
|
+
});
|
|
3096
|
+
s.isErr && (M.error(`Error: ${s.err.message}`), process.exit(1));
|
|
3097
|
+
let c = await Ja(s.value.map((e) => ({
|
|
3098
|
+
name: e.name,
|
|
3099
|
+
fileName: e.fileName
|
|
3100
|
+
})));
|
|
3101
|
+
c.isErr && (M.error(`Error: ${c.err.message}`), process.exit(1));
|
|
3102
|
+
let l = r(s.value.find((e) => e.fileName === c.value));
|
|
3103
|
+
l.isNone && (M.error("Error: Selected template not found"), process.exit(1)), M.message(`${(0, P.bold)((0, P.green)(l.value.name))}\n`), M.message(l.value.contents.description ? `${l.value.contents.description}\n` : "No contents provided.\n");
|
|
3104
|
+
let u = await Ut({
|
|
3105
|
+
message: "Enter the issue title",
|
|
3106
|
+
placeholder: "Issue title"
|
|
3107
|
+
});
|
|
3108
|
+
u.isErr && (M.error(`Error: ${u.err.message}`), process.exit(1)), a.push({
|
|
3109
|
+
title: "title",
|
|
3110
|
+
contents: u.value
|
|
3111
|
+
});
|
|
3112
|
+
for (let t of l.value.contents.body) {
|
|
3113
|
+
let n = await io(t, e);
|
|
3114
|
+
n.isErr && (M.error(`Error: ${n.err.message}`), process.exit(1)), n.value.isSome && a.push(n.value.value);
|
|
3115
|
+
}
|
|
3116
|
+
let d = po();
|
|
3117
|
+
if (d.isErr) throw d.err;
|
|
3118
|
+
if (d.value.length > 0) {
|
|
3119
|
+
let e = await Kt({
|
|
3120
|
+
message: "Select assignees",
|
|
3121
|
+
required: !1,
|
|
3122
|
+
options: d.value.map((e) => ({
|
|
3123
|
+
title: e,
|
|
3124
|
+
value: e
|
|
3125
|
+
}))
|
|
3126
|
+
});
|
|
3127
|
+
e.isErr && (M.error(`Error: ${e.err.message}`), process.exit(1)), e.value.length > 0 && a.push({
|
|
3128
|
+
title: "assign",
|
|
3129
|
+
contents: e.value.join(",")
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
let p = await fo(a);
|
|
3133
|
+
p.isErr && (M.error(`Error: ${p.err.message}`), process.exit(1)), M.success(`Saved issue draft: ${p.value}`);
|
|
3134
|
+
}
|
|
3135
|
+
//#endregion
|
|
3136
|
+
//#region src/helper/draft-issue.ts
|
|
3137
|
+
var ho = ".gh-issue", go = `${ho}/README.md`;
|
|
3138
|
+
async function _o(e = process.cwd()) {
|
|
3139
|
+
let { checkPromiseReturn: t, createNg: n, createOk: r } = w, i = await t({
|
|
3140
|
+
fn: () => h(`${ho}/**/*.md`, {
|
|
3141
|
+
cwd: e,
|
|
3142
|
+
onlyFiles: !0,
|
|
3143
|
+
dot: !0
|
|
3144
|
+
}),
|
|
3145
|
+
err: (e) => n(e)
|
|
3146
|
+
});
|
|
3147
|
+
return i.isErr ? i : r(i.value.filter((e) => e !== go));
|
|
3148
|
+
}
|
|
3149
|
+
function vo(e, t = process.cwd()) {
|
|
3150
|
+
let n = s(f(t, e), "utf8").match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
3151
|
+
if (!n) throw Error(`Missing front matter in ${e}`);
|
|
3152
|
+
let [, r, i] = n, a = r.match(/^title:\s*(.+)$/m), o = r.match(/^assign:\s*(.+)$/m);
|
|
3153
|
+
if (!a) throw Error(`Missing title in front matter: ${e}`);
|
|
3154
|
+
return {
|
|
3155
|
+
filePath: e,
|
|
3156
|
+
title: a[1].trim(),
|
|
3157
|
+
body: i.trim(),
|
|
3158
|
+
assignees: o?.[1]?.split(",").map((e) => e.trim()).filter(Boolean)
|
|
3159
|
+
};
|
|
3160
|
+
}
|
|
3161
|
+
//#endregion
|
|
3162
|
+
//#region src/command/send.ts
|
|
3163
|
+
async function yo(e) {
|
|
3164
|
+
return await Kt({
|
|
3165
|
+
message: "Select issue drafts to send",
|
|
3166
|
+
options: e.map((e) => ({
|
|
3167
|
+
title: e,
|
|
3168
|
+
value: e
|
|
3169
|
+
})),
|
|
3170
|
+
cancelMessage: "No issue drafts selected. Canceled.",
|
|
3171
|
+
errorMessage: "Failed to select issue drafts"
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
//#endregion
|
|
3175
|
+
//#region src/action/send.ts
|
|
3176
|
+
function bo(e) {
|
|
3177
|
+
return te("gh", e, {
|
|
3178
|
+
encoding: "utf8",
|
|
3179
|
+
stdio: [
|
|
3180
|
+
"ignore",
|
|
3181
|
+
"pipe",
|
|
3182
|
+
"pipe"
|
|
3183
|
+
]
|
|
3184
|
+
}).trim();
|
|
3185
|
+
}
|
|
3186
|
+
function xo() {
|
|
3187
|
+
bo(["auth", "status"]);
|
|
3188
|
+
}
|
|
3189
|
+
function So() {
|
|
3190
|
+
return bo([
|
|
3191
|
+
"repo",
|
|
3192
|
+
"view",
|
|
3193
|
+
"--json",
|
|
3194
|
+
"nameWithOwner",
|
|
3195
|
+
"--jq",
|
|
3196
|
+
".nameWithOwner"
|
|
3197
|
+
]);
|
|
3198
|
+
}
|
|
3199
|
+
function Co(e) {
|
|
3200
|
+
let t = [
|
|
3201
|
+
"issue",
|
|
3202
|
+
"create",
|
|
3203
|
+
"--title",
|
|
3204
|
+
e.title,
|
|
3205
|
+
"--body",
|
|
3206
|
+
e.body
|
|
3207
|
+
];
|
|
3208
|
+
return e.assignees && e.assignees.length > 0 && t.push("--assignee", e.assignees.join(",")), bo(t);
|
|
3209
|
+
}
|
|
3210
|
+
async function wo(e = {}) {
|
|
3211
|
+
let t = e.all || process.env.npm_config_all === "true", { checkResultReturn: n, checkResultVoid: r, createNg: i, createOk: a } = w, o = await _o();
|
|
3212
|
+
o.isErr && (M.error(`Error: ${o.err.message}`), process.exit(1)), o.value.length === 0 && (M.error("No issue drafts found in .gh-issue."), process.exit(1));
|
|
3213
|
+
let s = t ? a(o.value) : await yo(o.value);
|
|
3214
|
+
s.isErr && (M.error(`Error: ${s.err.message}`), process.exit(1));
|
|
3215
|
+
let c = r({
|
|
3216
|
+
fn: () => xo(),
|
|
3217
|
+
err: (e) => i(/* @__PURE__ */ Error(`gh authentication check failed. Please run \`gh auth login\`: ${e instanceof Error ? e.message : "Unknown error"}`))
|
|
3218
|
+
});
|
|
3219
|
+
c.isErr && (M.error(`Error: ${c.err.message}`), process.exit(1));
|
|
3220
|
+
let u = n({
|
|
3221
|
+
fn: () => So(),
|
|
3222
|
+
err: (e) => i(/* @__PURE__ */ Error(`Failed to resolve the current GitHub repository. Please check the git remote and gh repository access: ${e instanceof Error ? e.message : "Unknown error"}`))
|
|
3223
|
+
});
|
|
3224
|
+
u.isErr && (M.error(`Error: ${u.err.message}`), process.exit(1));
|
|
3225
|
+
let d = It();
|
|
3226
|
+
d.start(`${(0, P.bold)((0, P.green)("Repository"))}\n${u.value}\n`);
|
|
3227
|
+
for (let e of s.value) {
|
|
3228
|
+
d.message(`Sending ${e}...`);
|
|
3229
|
+
let t = vo(e), r = n({
|
|
3230
|
+
fn: () => Co(t),
|
|
3231
|
+
err: (t) => i(/* @__PURE__ */ Error(`Failed to create issue for ${e} with gh CLI: ${t instanceof Error ? t.message : "Unknown error"}`))
|
|
3232
|
+
});
|
|
3233
|
+
r.isErr && (d.cancel(`Failed to send issue draft: ${e}\nError: ${r.err.message}`), process.exit(1)), l(f(process.cwd(), e)), d.message(`Sent ${e}`), M.success(`${(0, P.bold)((0, P.green)("Issue created successfully"))}\n${r.value}\n`), M.success(`${(0, P.bold)((0, P.green)("Removed draft"))}\n${e}\n`);
|
|
3234
|
+
}
|
|
3235
|
+
d.stop("All selected drafts were sent.");
|
|
3236
|
+
}
|
|
3237
|
+
//#endregion
|
|
3238
|
+
//#region src/action/add.ts
|
|
3239
|
+
async function To() {
|
|
3240
|
+
let e = await Yt(), t = It();
|
|
3241
|
+
e.isErr && (M.error(`Error: ${e.err.message}`), process.exit(1)), e.value.length === 0 && (N("No template types selected. Canceled."), process.exit(0));
|
|
3242
|
+
let r = await Xt();
|
|
3243
|
+
r.isErr && (M.error(`Error: ${r.err.message}`), process.exit(1)), r.value.length === 0 && (N("No languages selected. Canceled."), process.exit(0));
|
|
3244
|
+
let i = [];
|
|
3245
|
+
for (let t of r.value) for (let n of e.value) i.push({
|
|
3246
|
+
lang: t,
|
|
3247
|
+
file: `${n}_${t}.yml`
|
|
3248
|
+
});
|
|
3249
|
+
let a = C(process.cwd(), ".github"), s = C(a, "ISSUE_TEMPLATE"), c = C(re(se(import.meta.url)), "template");
|
|
3250
|
+
await n(a, { recursive: !0 }), await n(s, { recursive: !0 }), t.start("Creating issue templates...");
|
|
3251
|
+
for (let e of i) {
|
|
3252
|
+
let n = C(s, e.file);
|
|
3253
|
+
if (o(n)) {
|
|
3254
|
+
t.error(`Already exists ${n}. Skipped.`);
|
|
3255
|
+
continue;
|
|
3256
|
+
}
|
|
3257
|
+
let r = C(c, e.lang);
|
|
3258
|
+
t.message(`Creating ${e.file}...`);
|
|
3259
|
+
let i = await he(e.file, s, {
|
|
3260
|
+
parents: !1,
|
|
3261
|
+
cwd: r
|
|
3262
|
+
});
|
|
3263
|
+
i.isErr && (t.error(`Error: ${i.err.message}`), process.exit(1)), t.message(`Created ${n}\n`);
|
|
3264
|
+
}
|
|
3265
|
+
t.stop(), jt("All done!");
|
|
3266
|
+
}
|
|
3267
|
+
//#endregion
|
|
3268
|
+
//#region src/command/core.ts
|
|
3269
|
+
function Eo() {
|
|
3270
|
+
let t = new e().description("Create GitHub issue templates").version("0.0.0");
|
|
3271
|
+
return t.command("init").description("Create bug report and feature request issue templates").action($t), t.command("create").description("Create an issue template").option("--vim", "Use Vim editor for textarea").option("--no-vim", "Use default editor for textarea").action((e) => mo(e)), t.command("send").description("Send an issue draft to GitHub").option("--all", "Send all issue drafts without selection prompt").action((e) => wo(e)), t.command("add").description("Add a new issue template to .gh-issue").action(To), t;
|
|
3272
|
+
}
|
|
3273
|
+
async function Do(e = process.argv) {
|
|
3274
|
+
await Eo().parseAsync(e);
|
|
3275
|
+
}
|
|
3276
|
+
//#endregion
|
|
3277
|
+
//#region src/run.ts
|
|
3278
|
+
var Oo = () => process.exit(0);
|
|
3279
|
+
process.on("SIGTERM", Oo), process.on("SIGINT", Oo);
|
|
3280
|
+
async function ko(e = process.argv) {
|
|
3281
|
+
await Do(e);
|
|
3282
|
+
}
|
|
3283
|
+
//#endregion
|
|
3284
|
+
//#region src/templates.ts
|
|
3285
|
+
var Ao = "issue", jo = "en", Mo = ["bug_report", "feature_request"], No = new Map([["bug", "bug_report"], ["feature", "feature_request"]]);
|
|
3286
|
+
function Po(e, t) {
|
|
3287
|
+
let n = zo(e), r = t === "ja" ? `${n}_ja` : n, i = d(m(import.meta.url));
|
|
3288
|
+
return [f(i, "template", t, `${r}.yml`), f(i, "..", "template", t, `${r}.yml`)];
|
|
3289
|
+
}
|
|
3290
|
+
function Fo(e) {
|
|
3291
|
+
let t = e.findIndex((e) => e === "--lang" || e === "-l");
|
|
3292
|
+
return t === -1 ? jo : e[t + 1] ?? jo;
|
|
3293
|
+
}
|
|
3294
|
+
function Io(e, t) {
|
|
3295
|
+
return e[t - 1] === "--lang" || e[t - 1] === "-l";
|
|
3296
|
+
}
|
|
3297
|
+
async function Lo(e, t = jo) {
|
|
3298
|
+
let [n, i] = Po(e, t);
|
|
3299
|
+
try {
|
|
3300
|
+
return await r(n, "utf8");
|
|
3301
|
+
} catch (e) {
|
|
3302
|
+
if (e instanceof Error && "code" in e && e.code === "ENOENT") return r(i, "utf8");
|
|
3303
|
+
throw e;
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
function Ro(e) {
|
|
3307
|
+
let t = e.includes("--force") || e.includes("-f"), n = Fo(e), r = e.find((t, n) => !t.startsWith("-") && !Io(e, n)) ?? Ao;
|
|
3308
|
+
return {
|
|
3309
|
+
force: t,
|
|
3310
|
+
language: n,
|
|
3311
|
+
name: zo(r.endsWith(".yml") ? r.slice(0, -4) : r)
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
function zo(e) {
|
|
3315
|
+
return No.get(e) ?? e;
|
|
3316
|
+
}
|
|
3317
|
+
async function Bo(e, t = process.cwd()) {
|
|
3318
|
+
let { force: n, language: r, name: i } = Ro(e);
|
|
3319
|
+
return Vo(i, n, r, t);
|
|
3320
|
+
}
|
|
3321
|
+
async function Vo(e, t, r, i) {
|
|
3322
|
+
let o = f(i, ".github", "ISSUE_TEMPLATE"), s = f(o, `${e}.yml`), c = await Lo(e, r);
|
|
3323
|
+
return await n(o, { recursive: !0 }), await a(s, c, { flag: t ? "w" : "wx" }), s;
|
|
3324
|
+
}
|
|
3325
|
+
async function Ho(e, t = process.cwd()) {
|
|
3326
|
+
let n = e.includes("--force") || e.includes("-f"), r = Fo(e);
|
|
3327
|
+
return Promise.all(Mo.map((e) => Vo(e, n, r, t)));
|
|
3328
|
+
}
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region src/index.ts
|
|
3331
|
+
async function Uo(e = process.argv) {
|
|
3332
|
+
await ko(e);
|
|
3333
|
+
}
|
|
3334
|
+
await Uo();
|
|
3335
|
+
//#endregion
|
|
3336
|
+
export { Bo as createIssueTemplate, Lo as createIssueTemplateYaml, Ho as initIssueTemplates, Uo as main };
|
|
3337
|
+
|
|
3338
|
+
//# sourceMappingURL=index.mjs.map
|