@arcgis/create 5.0.0-next.113 → 5.0.0-next.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/init.js +770 -772
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -69,7 +69,7 @@ function yt() {
|
|
|
69
69
|
this.required = !0, this._name = i;
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
|
-
this._name.
|
|
72
|
+
this._name.endsWith("...") && (this.variadic = !0, this._name = this._name.slice(0, -3));
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Return argument name.
|
|
@@ -82,8 +82,8 @@ function yt() {
|
|
|
82
82
|
/**
|
|
83
83
|
* @package
|
|
84
84
|
*/
|
|
85
|
-
|
|
86
|
-
return r === this.defaultValue || !Array.isArray(r) ? [i] : r.
|
|
85
|
+
_collectValue(i, r) {
|
|
86
|
+
return r === this.defaultValue || !Array.isArray(r) ? [i] : (r.push(i), r);
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Set the default value, and optionally supply the description to be displayed in the help.
|
|
@@ -116,7 +116,7 @@ function yt() {
|
|
|
116
116
|
throw new s(
|
|
117
117
|
`Allowed choices are ${this.argChoices.join(", ")}.`
|
|
118
118
|
);
|
|
119
|
-
return this.variadic ? this.
|
|
119
|
+
return this.variadic ? this._collectValue(r, e) : r;
|
|
120
120
|
}, this;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -423,52 +423,52 @@ function Ir() {
|
|
|
423
423
|
*/
|
|
424
424
|
formatHelp(i, r) {
|
|
425
425
|
const e = r.padWidth(i, r), a = r.helpWidth ?? 80;
|
|
426
|
-
function l(
|
|
427
|
-
return r.formatItem(
|
|
426
|
+
function l(p, f) {
|
|
427
|
+
return r.formatItem(p, e, f, r);
|
|
428
428
|
}
|
|
429
429
|
let C = [
|
|
430
430
|
`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(i))}`,
|
|
431
431
|
""
|
|
432
432
|
];
|
|
433
|
-
const
|
|
434
|
-
|
|
433
|
+
const d = r.commandDescription(i);
|
|
434
|
+
d.length > 0 && (C = C.concat([
|
|
435
435
|
r.boxWrap(
|
|
436
|
-
r.styleCommandDescription(
|
|
436
|
+
r.styleCommandDescription(d),
|
|
437
437
|
a
|
|
438
438
|
),
|
|
439
439
|
""
|
|
440
440
|
]));
|
|
441
|
-
const v = r.visibleArguments(i).map((
|
|
442
|
-
r.styleArgumentTerm(r.argumentTerm(
|
|
443
|
-
r.styleArgumentDescription(r.argumentDescription(
|
|
441
|
+
const v = r.visibleArguments(i).map((p) => l(
|
|
442
|
+
r.styleArgumentTerm(r.argumentTerm(p)),
|
|
443
|
+
r.styleArgumentDescription(r.argumentDescription(p))
|
|
444
444
|
));
|
|
445
445
|
if (C = C.concat(
|
|
446
446
|
this.formatItemList("Arguments:", v, r)
|
|
447
447
|
), this.groupItems(
|
|
448
448
|
i.options,
|
|
449
449
|
r.visibleOptions(i),
|
|
450
|
-
(
|
|
451
|
-
).forEach((
|
|
452
|
-
const A =
|
|
450
|
+
(p) => p.helpGroupHeading ?? "Options:"
|
|
451
|
+
).forEach((p, f) => {
|
|
452
|
+
const A = p.map((t) => l(
|
|
453
453
|
r.styleOptionTerm(r.optionTerm(t)),
|
|
454
454
|
r.styleOptionDescription(r.optionDescription(t))
|
|
455
455
|
));
|
|
456
456
|
C = C.concat(this.formatItemList(f, A, r));
|
|
457
457
|
}), r.showGlobalOptions) {
|
|
458
|
-
const
|
|
458
|
+
const p = r.visibleGlobalOptions(i).map((f) => l(
|
|
459
459
|
r.styleOptionTerm(r.optionTerm(f)),
|
|
460
460
|
r.styleOptionDescription(r.optionDescription(f))
|
|
461
461
|
));
|
|
462
462
|
C = C.concat(
|
|
463
|
-
this.formatItemList("Global Options:",
|
|
463
|
+
this.formatItemList("Global Options:", p, r)
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
return this.groupItems(
|
|
467
467
|
i.commands,
|
|
468
468
|
r.visibleCommands(i),
|
|
469
|
-
(
|
|
470
|
-
).forEach((
|
|
471
|
-
const A =
|
|
469
|
+
(p) => p.helpGroup() || "Commands:"
|
|
470
|
+
).forEach((p, f) => {
|
|
471
|
+
const A = p.map((t) => l(
|
|
472
472
|
r.styleSubcommandTerm(r.subcommandTerm(t)),
|
|
473
473
|
r.styleSubcommandDescription(r.subcommandDescription(t))
|
|
474
474
|
));
|
|
@@ -573,15 +573,15 @@ function Ir() {
|
|
|
573
573
|
formatItem(i, r, e, a) {
|
|
574
574
|
const C = " ".repeat(2);
|
|
575
575
|
if (!e) return C + i;
|
|
576
|
-
const
|
|
576
|
+
const d = i.padEnd(
|
|
577
577
|
r + i.length - a.displayWidth(i)
|
|
578
578
|
), v = 2, D = (this.helpWidth ?? 80) - r - v - 2;
|
|
579
|
-
let
|
|
580
|
-
return D < this.minWidthToWrap || a.preformatted(e) ?
|
|
579
|
+
let p;
|
|
580
|
+
return D < this.minWidthToWrap || a.preformatted(e) ? p = e : p = a.boxWrap(e, D).replace(
|
|
581
581
|
/\n/g,
|
|
582
582
|
`
|
|
583
583
|
` + " ".repeat(r + v)
|
|
584
|
-
), C +
|
|
584
|
+
), C + d + " ".repeat(v) + p.replace(/\n/g, `
|
|
585
585
|
${C}`);
|
|
586
586
|
}
|
|
587
587
|
/**
|
|
@@ -596,16 +596,16 @@ ${C}`);
|
|
|
596
596
|
if (r < this.minWidthToWrap) return i;
|
|
597
597
|
const e = i.split(/\r\n|\n/), a = /[\s]*[^\s]+/g, l = [];
|
|
598
598
|
return e.forEach((C) => {
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
599
|
+
const d = C.match(a);
|
|
600
|
+
if (d === null) {
|
|
601
601
|
l.push("");
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
604
|
-
let v = [
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
if (w +
|
|
608
|
-
v.push(D), w +=
|
|
604
|
+
let v = [d.shift()], w = this.displayWidth(v[0]);
|
|
605
|
+
d.forEach((D) => {
|
|
606
|
+
const p = this.displayWidth(D);
|
|
607
|
+
if (w + p <= r) {
|
|
608
|
+
v.push(D), w += p;
|
|
609
609
|
return;
|
|
610
610
|
}
|
|
611
611
|
l.push(v.join(""));
|
|
@@ -736,8 +736,8 @@ function Nr() {
|
|
|
736
736
|
/**
|
|
737
737
|
* @package
|
|
738
738
|
*/
|
|
739
|
-
|
|
740
|
-
return a === this.defaultValue || !Array.isArray(a) ? [e] : a.
|
|
739
|
+
_collectValue(e, a) {
|
|
740
|
+
return a === this.defaultValue || !Array.isArray(a) ? [e] : (a.push(e), a);
|
|
741
741
|
}
|
|
742
742
|
/**
|
|
743
743
|
* Only allow option value to be one of choices.
|
|
@@ -751,7 +751,7 @@ function Nr() {
|
|
|
751
751
|
throw new s(
|
|
752
752
|
`Allowed choices are ${this.argChoices.join(", ")}.`
|
|
753
753
|
);
|
|
754
|
-
return this.variadic ? this.
|
|
754
|
+
return this.variadic ? this._collectValue(a, l) : a;
|
|
755
755
|
}, this;
|
|
756
756
|
}
|
|
757
757
|
/**
|
|
@@ -823,8 +823,8 @@ function Nr() {
|
|
|
823
823
|
valueFromOption(e, a) {
|
|
824
824
|
const l = a.attributeName();
|
|
825
825
|
if (!this.dualOptions.has(l)) return !0;
|
|
826
|
-
const C = this.negativeOptions.get(l).presetArg,
|
|
827
|
-
return a.negate === (
|
|
826
|
+
const C = this.negativeOptions.get(l).presetArg, d = C !== void 0 ? C : !1;
|
|
827
|
+
return a.negate === (d === e);
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
830
|
function h(r) {
|
|
@@ -832,9 +832,9 @@ function Nr() {
|
|
|
832
832
|
}
|
|
833
833
|
function i(r) {
|
|
834
834
|
let e, a;
|
|
835
|
-
const l = /^-[^-]$/, C = /^--[^-]/,
|
|
836
|
-
if (l.test(
|
|
837
|
-
const v =
|
|
835
|
+
const l = /^-[^-]$/, C = /^--[^-]/, d = r.split(/[ |,]+/).concat("guard");
|
|
836
|
+
if (l.test(d[0]) && (e = d.shift()), C.test(d[0]) && (a = d.shift()), !e && l.test(d[0]) && (e = d.shift()), !e && C.test(d[0]) && (e = a, a = d.shift()), d[0].startsWith("-")) {
|
|
837
|
+
const v = d[0], w = `option creation failed due to '${v}' in option flags '${r}'`;
|
|
838
838
|
throw /^-[^-][^-]/.test(v) ? new Error(
|
|
839
839
|
`${w}
|
|
840
840
|
- a short flag is a single dash and a single character
|
|
@@ -889,9 +889,9 @@ function Li() {
|
|
|
889
889
|
const l = 0.4;
|
|
890
890
|
return i.forEach((C) => {
|
|
891
891
|
if (C.length <= 1) return;
|
|
892
|
-
const
|
|
893
|
-
(v -
|
|
894
|
-
}), e.sort((C,
|
|
892
|
+
const d = n(h, C), v = Math.max(h.length, C.length);
|
|
893
|
+
(v - d) / v > l && (d < a ? (a = d, e = [C]) : d === a && e.push(C));
|
|
894
|
+
}), e.sort((C, d) => C.localeCompare(d)), r && (e = e.map((C) => `--${C}`)), e.length > 1 ? `
|
|
895
895
|
(Did you mean one of ${e.join(", ")}?)` : e.length === 1 ? `
|
|
896
896
|
(Did you mean ${e[0]}?)` : "";
|
|
897
897
|
}
|
|
@@ -901,7 +901,7 @@ var Gt;
|
|
|
901
901
|
function Si() {
|
|
902
902
|
if (Gt) return $e;
|
|
903
903
|
Gt = 1;
|
|
904
|
-
const s = mi.EventEmitter, n = gi, o = Ci, h = Ei, i = J, { Argument: r, humanReadableArgName: e } = yt(), { CommanderError: a } = je(), { Help: l, stripColor: C } = Ir(), { Option:
|
|
904
|
+
const s = mi.EventEmitter, n = gi, o = Ci, h = Ei, i = J, { Argument: r, humanReadableArgName: e } = yt(), { CommanderError: a } = je(), { Help: l, stripColor: C } = Ir(), { Option: d, DualOptions: v } = Nr(), { suggestSimilar: w } = Li();
|
|
905
905
|
class D extends s {
|
|
906
906
|
/**
|
|
907
907
|
* Initialize a new `Command`.
|
|
@@ -966,10 +966,10 @@ function Si() {
|
|
|
966
966
|
* @return {Command} returns new command for action handler, or `this` for executable command
|
|
967
967
|
*/
|
|
968
968
|
command(t, c, g) {
|
|
969
|
-
let u = c,
|
|
970
|
-
typeof u == "object" && u !== null && (
|
|
969
|
+
let u = c, m = g;
|
|
970
|
+
typeof u == "object" && u !== null && (m = u, u = null), m = m || {};
|
|
971
971
|
const [, y, L] = t.match(/([^ ]+) *(.*)/), O = this.createCommand(y);
|
|
972
|
-
return u && (O.description(u), O._executableHandler = !0),
|
|
972
|
+
return u && (O.description(u), O._executableHandler = !0), m.isDefault && (this._defaultCommandName = O._name), O._hidden = !!(m.noHelp || m.hidden), O._executableFile = m.executableFile || null, L && O.arguments(L), this._registerCommand(O), O.parent = this, O.copyInheritedSettings(this), u ? this : O;
|
|
973
973
|
}
|
|
974
974
|
/**
|
|
975
975
|
* Factory routine to create a new unattached command.
|
|
@@ -1025,11 +1025,10 @@ function Si() {
|
|
|
1025
1025
|
* @return {(Command | object)} `this` command for chaining, or stored configuration
|
|
1026
1026
|
*/
|
|
1027
1027
|
configureOutput(t) {
|
|
1028
|
-
return t === void 0 ? this._outputConfiguration : (this._outputConfiguration =
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
), this);
|
|
1028
|
+
return t === void 0 ? this._outputConfiguration : (this._outputConfiguration = {
|
|
1029
|
+
...this._outputConfiguration,
|
|
1030
|
+
...t
|
|
1031
|
+
}, this);
|
|
1033
1032
|
}
|
|
1034
1033
|
/**
|
|
1035
1034
|
* Display the help or a custom message after an error occurs.
|
|
@@ -1094,8 +1093,8 @@ function Si() {
|
|
|
1094
1093
|
* @return {Command} `this` command for chaining
|
|
1095
1094
|
*/
|
|
1096
1095
|
argument(t, c, g, u) {
|
|
1097
|
-
const
|
|
1098
|
-
return typeof g == "function" ?
|
|
1096
|
+
const m = this.createArgument(t, c);
|
|
1097
|
+
return typeof g == "function" ? m.default(u).argParser(g) : m.default(g), this.addArgument(m), this;
|
|
1099
1098
|
}
|
|
1100
1099
|
/**
|
|
1101
1100
|
* Define argument syntax for command, adding multiple at once (without descriptions).
|
|
@@ -1121,7 +1120,7 @@ function Si() {
|
|
|
1121
1120
|
*/
|
|
1122
1121
|
addArgument(t) {
|
|
1123
1122
|
const c = this.registeredArguments.slice(-1)[0];
|
|
1124
|
-
if (c
|
|
1123
|
+
if (c?.variadic)
|
|
1125
1124
|
throw new Error(
|
|
1126
1125
|
`only the last argument can be variadic '${c.name()}'`
|
|
1127
1126
|
);
|
|
@@ -1147,8 +1146,8 @@ function Si() {
|
|
|
1147
1146
|
helpCommand(t, c) {
|
|
1148
1147
|
if (typeof t == "boolean")
|
|
1149
1148
|
return this._addImplicitHelpCommand = t, t && this._defaultCommandGroup && this._initCommandGroup(this._getHelpCommand()), this;
|
|
1150
|
-
const g = t ?? "help [command]", [, u,
|
|
1151
|
-
return L.helpOption(!1),
|
|
1149
|
+
const g = t ?? "help [command]", [, u, m] = g.match(/([^ ]+) *(.*)/), y = c ?? "display help for command", L = this.createCommand(u);
|
|
1150
|
+
return L.helpOption(!1), m && L.arguments(m), y && L.description(y), this._addImplicitHelpCommand = !0, this._helpCommand = L, (t || c) && this._initCommandGroup(L), this;
|
|
1152
1151
|
}
|
|
1153
1152
|
/**
|
|
1154
1153
|
* Add prepared custom help command.
|
|
@@ -1223,8 +1222,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1223
1222
|
*/
|
|
1224
1223
|
action(t) {
|
|
1225
1224
|
const c = (g) => {
|
|
1226
|
-
const u = this.registeredArguments.length,
|
|
1227
|
-
return this._storeOptionsAsProperties ?
|
|
1225
|
+
const u = this.registeredArguments.length, m = g.slice(0, u);
|
|
1226
|
+
return this._storeOptionsAsProperties ? m[u] = this : m[u] = this.opts(), m.push(this), t.apply(this, m);
|
|
1228
1227
|
};
|
|
1229
1228
|
return this._actionHandler = c, this;
|
|
1230
1229
|
}
|
|
@@ -1239,7 +1238,7 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1239
1238
|
* @return {Option} new option
|
|
1240
1239
|
*/
|
|
1241
1240
|
createOption(t, c) {
|
|
1242
|
-
return new
|
|
1241
|
+
return new d(t, c);
|
|
1243
1242
|
}
|
|
1244
1243
|
/**
|
|
1245
1244
|
* Wrap parseArgs to catch 'commander.invalidArgument'.
|
|
@@ -1253,12 +1252,12 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1253
1252
|
_callParseArg(t, c, g, u) {
|
|
1254
1253
|
try {
|
|
1255
1254
|
return t.parseArg(c, g);
|
|
1256
|
-
} catch (
|
|
1257
|
-
if (
|
|
1258
|
-
const y = `${u} ${
|
|
1259
|
-
this.error(y, { exitCode:
|
|
1255
|
+
} catch (m) {
|
|
1256
|
+
if (m.code === "commander.invalidArgument") {
|
|
1257
|
+
const y = `${u} ${m.message}`;
|
|
1258
|
+
this.error(y, { exitCode: m.exitCode, code: m.code });
|
|
1260
1259
|
}
|
|
1261
|
-
throw
|
|
1260
|
+
throw m;
|
|
1262
1261
|
}
|
|
1263
1262
|
}
|
|
1264
1263
|
/**
|
|
@@ -1289,9 +1288,9 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1289
1288
|
(u) => this._findCommand(u)
|
|
1290
1289
|
);
|
|
1291
1290
|
if (g) {
|
|
1292
|
-
const u = c(this._findCommand(g)).join("|"),
|
|
1291
|
+
const u = c(this._findCommand(g)).join("|"), m = c(t).join("|");
|
|
1293
1292
|
throw new Error(
|
|
1294
|
-
`cannot add command '${
|
|
1293
|
+
`cannot add command '${m}' as already have command '${u}'`
|
|
1295
1294
|
);
|
|
1296
1295
|
}
|
|
1297
1296
|
this._initCommandGroup(t), this.commands.push(t);
|
|
@@ -1306,24 +1305,24 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1306
1305
|
this._registerOption(t);
|
|
1307
1306
|
const c = t.name(), g = t.attributeName();
|
|
1308
1307
|
if (t.negate) {
|
|
1309
|
-
const
|
|
1310
|
-
this._findOption(
|
|
1308
|
+
const m = t.long.replace(/^--no-/, "--");
|
|
1309
|
+
this._findOption(m) || this.setOptionValueWithSource(
|
|
1311
1310
|
g,
|
|
1312
1311
|
t.defaultValue === void 0 ? !0 : t.defaultValue,
|
|
1313
1312
|
"default"
|
|
1314
1313
|
);
|
|
1315
1314
|
} else t.defaultValue !== void 0 && this.setOptionValueWithSource(g, t.defaultValue, "default");
|
|
1316
|
-
const u = (
|
|
1317
|
-
|
|
1315
|
+
const u = (m, y, L) => {
|
|
1316
|
+
m == null && t.presetArg !== void 0 && (m = t.presetArg);
|
|
1318
1317
|
const O = this.getOptionValue(g);
|
|
1319
|
-
|
|
1318
|
+
m !== null && t.parseArg ? m = this._callParseArg(t, m, O, y) : m !== null && t.variadic && (m = t._collectValue(m, O)), m == null && (t.negate ? m = !1 : t.isBoolean() || t.optional ? m = !0 : m = ""), this.setOptionValueWithSource(g, m, L);
|
|
1320
1319
|
};
|
|
1321
|
-
return this.on("option:" + c, (
|
|
1322
|
-
const y = `error: option '${t.flags}' argument '${
|
|
1323
|
-
u(
|
|
1324
|
-
}), t.envVar && this.on("optionEnv:" + c, (
|
|
1325
|
-
const y = `error: option '${t.flags}' value '${
|
|
1326
|
-
u(
|
|
1320
|
+
return this.on("option:" + c, (m) => {
|
|
1321
|
+
const y = `error: option '${t.flags}' argument '${m}' is invalid.`;
|
|
1322
|
+
u(m, y, "cli");
|
|
1323
|
+
}), t.envVar && this.on("optionEnv:" + c, (m) => {
|
|
1324
|
+
const y = `error: option '${t.flags}' value '${m}' from env '${t.envVar}' is invalid.`;
|
|
1325
|
+
u(m, y, "env");
|
|
1327
1326
|
}), this;
|
|
1328
1327
|
}
|
|
1329
1328
|
/**
|
|
@@ -1332,20 +1331,20 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1332
1331
|
* @return {Command} `this` command for chaining
|
|
1333
1332
|
* @private
|
|
1334
1333
|
*/
|
|
1335
|
-
_optionEx(t, c, g, u,
|
|
1336
|
-
if (typeof c == "object" && c instanceof
|
|
1334
|
+
_optionEx(t, c, g, u, m) {
|
|
1335
|
+
if (typeof c == "object" && c instanceof d)
|
|
1337
1336
|
throw new Error(
|
|
1338
1337
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
1339
1338
|
);
|
|
1340
1339
|
const y = this.createOption(c, g);
|
|
1341
1340
|
if (y.makeOptionMandatory(!!t.mandatory), typeof u == "function")
|
|
1342
|
-
y.default(
|
|
1341
|
+
y.default(m).argParser(u);
|
|
1343
1342
|
else if (u instanceof RegExp) {
|
|
1344
1343
|
const L = u;
|
|
1345
|
-
u = (O,
|
|
1346
|
-
const
|
|
1347
|
-
return
|
|
1348
|
-
}, y.default(
|
|
1344
|
+
u = (O, R) => {
|
|
1345
|
+
const x = L.exec(O);
|
|
1346
|
+
return x ? x[0] : R;
|
|
1347
|
+
}, y.default(m).argParser(u);
|
|
1349
1348
|
} else
|
|
1350
1349
|
y.default(u);
|
|
1351
1350
|
return this.addOption(y);
|
|
@@ -1657,11 +1656,11 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1657
1656
|
*/
|
|
1658
1657
|
_checkForMissingExecutable(t, c, g) {
|
|
1659
1658
|
if (h.existsSync(t)) return;
|
|
1660
|
-
const u = c ? `searched for local subcommand relative to directory '${c}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory",
|
|
1659
|
+
const u = c ? `searched for local subcommand relative to directory '${c}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory", m = `'${t}' does not exist
|
|
1661
1660
|
- if '${g}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
1662
1661
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
1663
1662
|
- ${u}`;
|
|
1664
|
-
throw new Error(
|
|
1663
|
+
throw new Error(m);
|
|
1665
1664
|
}
|
|
1666
1665
|
/**
|
|
1667
1666
|
* Execute a sub-command executable.
|
|
@@ -1672,81 +1671,81 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1672
1671
|
c = c.slice();
|
|
1673
1672
|
let g = !1;
|
|
1674
1673
|
const u = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1675
|
-
function
|
|
1676
|
-
const
|
|
1677
|
-
if (h.existsSync(
|
|
1678
|
-
if (u.includes(o.extname(
|
|
1679
|
-
const
|
|
1680
|
-
(Y) => h.existsSync(`${
|
|
1674
|
+
function m(x, P) {
|
|
1675
|
+
const I = o.resolve(x, P);
|
|
1676
|
+
if (h.existsSync(I)) return I;
|
|
1677
|
+
if (u.includes(o.extname(P))) return;
|
|
1678
|
+
const N = u.find(
|
|
1679
|
+
(Y) => h.existsSync(`${I}${Y}`)
|
|
1681
1680
|
);
|
|
1682
|
-
if (
|
|
1681
|
+
if (N) return `${I}${N}`;
|
|
1683
1682
|
}
|
|
1684
1683
|
this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1685
1684
|
let y = t._executableFile || `${this._name}-${t._name}`, L = this._executableDir || "";
|
|
1686
1685
|
if (this._scriptPath) {
|
|
1687
|
-
let
|
|
1686
|
+
let x;
|
|
1688
1687
|
try {
|
|
1689
|
-
|
|
1688
|
+
x = h.realpathSync(this._scriptPath);
|
|
1690
1689
|
} catch {
|
|
1691
|
-
|
|
1690
|
+
x = this._scriptPath;
|
|
1692
1691
|
}
|
|
1693
1692
|
L = o.resolve(
|
|
1694
|
-
o.dirname(
|
|
1693
|
+
o.dirname(x),
|
|
1695
1694
|
L
|
|
1696
1695
|
);
|
|
1697
1696
|
}
|
|
1698
1697
|
if (L) {
|
|
1699
|
-
let
|
|
1700
|
-
if (!
|
|
1701
|
-
const
|
|
1698
|
+
let x = m(L, y);
|
|
1699
|
+
if (!x && !t._executableFile && this._scriptPath) {
|
|
1700
|
+
const P = o.basename(
|
|
1702
1701
|
this._scriptPath,
|
|
1703
1702
|
o.extname(this._scriptPath)
|
|
1704
1703
|
);
|
|
1705
|
-
|
|
1704
|
+
P !== this._name && (x = m(
|
|
1706
1705
|
L,
|
|
1707
|
-
`${
|
|
1706
|
+
`${P}-${t._name}`
|
|
1708
1707
|
));
|
|
1709
1708
|
}
|
|
1710
|
-
y =
|
|
1709
|
+
y = x || y;
|
|
1711
1710
|
}
|
|
1712
1711
|
g = u.includes(o.extname(y));
|
|
1713
1712
|
let O;
|
|
1714
|
-
i.platform !== "win32" ? g ? (c.unshift(y), c =
|
|
1713
|
+
i.platform !== "win32" ? g ? (c.unshift(y), c = p(i.execArgv).concat(c), O = n.spawn(i.argv[0], c, { stdio: "inherit" })) : O = n.spawn(y, c, { stdio: "inherit" }) : (this._checkForMissingExecutable(
|
|
1715
1714
|
y,
|
|
1716
1715
|
L,
|
|
1717
1716
|
t._name
|
|
1718
|
-
), c.unshift(y), c =
|
|
1719
|
-
i.on(
|
|
1720
|
-
O.killed === !1 && O.exitCode === null && O.kill(
|
|
1717
|
+
), c.unshift(y), c = p(i.execArgv).concat(c), O = n.spawn(i.execPath, c, { stdio: "inherit" })), O.killed || ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"].forEach((P) => {
|
|
1718
|
+
i.on(P, () => {
|
|
1719
|
+
O.killed === !1 && O.exitCode === null && O.kill(P);
|
|
1721
1720
|
});
|
|
1722
1721
|
});
|
|
1723
|
-
const
|
|
1724
|
-
O.on("close", (
|
|
1725
|
-
|
|
1722
|
+
const R = this._exitCallback;
|
|
1723
|
+
O.on("close", (x) => {
|
|
1724
|
+
x = x ?? 1, R ? R(
|
|
1726
1725
|
new a(
|
|
1727
|
-
|
|
1726
|
+
x,
|
|
1728
1727
|
"commander.executeSubCommandAsync",
|
|
1729
1728
|
"(close)"
|
|
1730
1729
|
)
|
|
1731
|
-
) : i.exit(
|
|
1732
|
-
}), O.on("error", (
|
|
1733
|
-
if (
|
|
1730
|
+
) : i.exit(x);
|
|
1731
|
+
}), O.on("error", (x) => {
|
|
1732
|
+
if (x.code === "ENOENT")
|
|
1734
1733
|
this._checkForMissingExecutable(
|
|
1735
1734
|
y,
|
|
1736
1735
|
L,
|
|
1737
1736
|
t._name
|
|
1738
1737
|
);
|
|
1739
|
-
else if (
|
|
1738
|
+
else if (x.code === "EACCES")
|
|
1740
1739
|
throw new Error(`'${y}' not executable`);
|
|
1741
|
-
if (
|
|
1740
|
+
if (!R)
|
|
1742
1741
|
i.exit(1);
|
|
1743
1742
|
else {
|
|
1744
|
-
const
|
|
1743
|
+
const P = new a(
|
|
1745
1744
|
1,
|
|
1746
1745
|
"commander.executeSubCommandAsync",
|
|
1747
1746
|
"(error)"
|
|
1748
1747
|
);
|
|
1749
|
-
|
|
1748
|
+
P.nestedError = x, R(P);
|
|
1750
1749
|
}
|
|
1751
1750
|
}), this.runningCommand = O;
|
|
1752
1751
|
}
|
|
@@ -1756,17 +1755,17 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1756
1755
|
_dispatchSubcommand(t, c, g) {
|
|
1757
1756
|
const u = this._findCommand(t);
|
|
1758
1757
|
u || this.help({ error: !0 }), u._prepareForParse();
|
|
1759
|
-
let
|
|
1760
|
-
return
|
|
1761
|
-
|
|
1758
|
+
let m;
|
|
1759
|
+
return m = this._chainOrCallSubCommandHook(
|
|
1760
|
+
m,
|
|
1762
1761
|
u,
|
|
1763
1762
|
"preSubcommand"
|
|
1764
|
-
),
|
|
1763
|
+
), m = this._chainOrCall(m, () => {
|
|
1765
1764
|
if (u._executableHandler)
|
|
1766
1765
|
this._executeSubCommand(u, c.concat(g));
|
|
1767
1766
|
else
|
|
1768
1767
|
return u._parseCommand(c, g);
|
|
1769
|
-
}),
|
|
1768
|
+
}), m;
|
|
1770
1769
|
}
|
|
1771
1770
|
/**
|
|
1772
1771
|
* Invoke help directly if possible, or dispatch if necessary.
|
|
@@ -1799,14 +1798,14 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1799
1798
|
* @private
|
|
1800
1799
|
*/
|
|
1801
1800
|
_processArguments() {
|
|
1802
|
-
const t = (g, u,
|
|
1801
|
+
const t = (g, u, m) => {
|
|
1803
1802
|
let y = u;
|
|
1804
1803
|
if (u !== null && g.parseArg) {
|
|
1805
1804
|
const L = `error: command-argument value '${u}' is invalid for argument '${g.name()}'.`;
|
|
1806
1805
|
y = this._callParseArg(
|
|
1807
1806
|
g,
|
|
1808
1807
|
u,
|
|
1809
|
-
|
|
1808
|
+
m,
|
|
1810
1809
|
L
|
|
1811
1810
|
);
|
|
1812
1811
|
}
|
|
@@ -1815,8 +1814,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1815
1814
|
this._checkNumberOfArguments();
|
|
1816
1815
|
const c = [];
|
|
1817
1816
|
this.registeredArguments.forEach((g, u) => {
|
|
1818
|
-
let
|
|
1819
|
-
g.variadic ? u < this.args.length ? (
|
|
1817
|
+
let m = g.defaultValue;
|
|
1818
|
+
g.variadic ? u < this.args.length ? (m = this.args.slice(u), g.parseArg && (m = m.reduce((y, L) => t(g, L, y), g.defaultValue))) : m === void 0 && (m = []) : u < this.args.length && (m = this.args[u], g.parseArg && (m = t(g, m, g.defaultValue))), c[u] = m;
|
|
1820
1819
|
}), this.processedArgs = c;
|
|
1821
1820
|
}
|
|
1822
1821
|
/**
|
|
@@ -1828,7 +1827,7 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1828
1827
|
* @private
|
|
1829
1828
|
*/
|
|
1830
1829
|
_chainOrCall(t, c) {
|
|
1831
|
-
return t
|
|
1830
|
+
return t?.then && typeof t.then == "function" ? t.then(() => c()) : c();
|
|
1832
1831
|
}
|
|
1833
1832
|
/**
|
|
1834
1833
|
*
|
|
@@ -1840,12 +1839,12 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1840
1839
|
_chainOrCallHooks(t, c) {
|
|
1841
1840
|
let g = t;
|
|
1842
1841
|
const u = [];
|
|
1843
|
-
return this._getCommandAndAncestors().reverse().filter((
|
|
1844
|
-
|
|
1845
|
-
u.push({ hookedCommand:
|
|
1842
|
+
return this._getCommandAndAncestors().reverse().filter((m) => m._lifeCycleHooks[c] !== void 0).forEach((m) => {
|
|
1843
|
+
m._lifeCycleHooks[c].forEach((y) => {
|
|
1844
|
+
u.push({ hookedCommand: m, callback: y });
|
|
1846
1845
|
});
|
|
1847
|
-
}), c === "postAction" && u.reverse(), u.forEach((
|
|
1848
|
-
g = this._chainOrCall(g, () =>
|
|
1846
|
+
}), c === "postAction" && u.reverse(), u.forEach((m) => {
|
|
1847
|
+
g = this._chainOrCall(g, () => m.callback(m.hookedCommand, this));
|
|
1849
1848
|
}), g;
|
|
1850
1849
|
}
|
|
1851
1850
|
/**
|
|
@@ -1858,8 +1857,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1858
1857
|
*/
|
|
1859
1858
|
_chainOrCallSubCommandHook(t, c, g) {
|
|
1860
1859
|
let u = t;
|
|
1861
|
-
return this._lifeCycleHooks[g] !== void 0 && this._lifeCycleHooks[g].forEach((
|
|
1862
|
-
u = this._chainOrCall(u, () =>
|
|
1860
|
+
return this._lifeCycleHooks[g] !== void 0 && this._lifeCycleHooks[g].forEach((m) => {
|
|
1861
|
+
u = this._chainOrCall(u, () => m(this, c));
|
|
1863
1862
|
}), u;
|
|
1864
1863
|
}
|
|
1865
1864
|
/**
|
|
@@ -1883,7 +1882,7 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1883
1882
|
this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName && this.help({ error: !0 }), this._outputHelpIfRequested(g.unknown), this._checkForMissingMandatoryOptions(), this._checkForConflictingOptions();
|
|
1884
1883
|
const u = () => {
|
|
1885
1884
|
g.unknown.length > 0 && this.unknownOption(g.unknown[0]);
|
|
1886
|
-
},
|
|
1885
|
+
}, m = `command:${this.name()}`;
|
|
1887
1886
|
if (this._actionHandler) {
|
|
1888
1887
|
u(), this._processArguments();
|
|
1889
1888
|
let y;
|
|
@@ -1891,11 +1890,11 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1891
1890
|
y,
|
|
1892
1891
|
() => this._actionHandler(this.processedArgs)
|
|
1893
1892
|
), this.parent && (y = this._chainOrCall(y, () => {
|
|
1894
|
-
this.parent.emit(
|
|
1893
|
+
this.parent.emit(m, t, c);
|
|
1895
1894
|
})), y = this._chainOrCallHooks(y, "postAction"), y;
|
|
1896
1895
|
}
|
|
1897
|
-
if (this.parent
|
|
1898
|
-
u(), this._processArguments(), this.parent.emit(
|
|
1896
|
+
if (this.parent?.listenerCount(m))
|
|
1897
|
+
u(), this._processArguments(), this.parent.emit(m, t, c);
|
|
1899
1898
|
else if (t.length) {
|
|
1900
1899
|
if (this._findCommand("*"))
|
|
1901
1900
|
return this._dispatchSubcommand("*", t, c);
|
|
@@ -1951,7 +1950,7 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1951
1950
|
(g) => g.conflictsWith.length > 0
|
|
1952
1951
|
).forEach((g) => {
|
|
1953
1952
|
const u = t.find(
|
|
1954
|
-
(
|
|
1953
|
+
(m) => g.conflictsWith.includes(m.attributeName())
|
|
1955
1954
|
);
|
|
1956
1955
|
u && this._conflictingOption(g, u);
|
|
1957
1956
|
});
|
|
@@ -1981,76 +1980,75 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
1981
1980
|
* sub --unknown uuu op => [sub], [--unknown uuu op]
|
|
1982
1981
|
* sub -- --unknown uuu op => [sub --unknown uuu op], []
|
|
1983
1982
|
*
|
|
1984
|
-
* @param {string[]}
|
|
1983
|
+
* @param {string[]} args
|
|
1985
1984
|
* @return {{operands: string[], unknown: string[]}}
|
|
1986
1985
|
*/
|
|
1987
1986
|
parseOptions(t) {
|
|
1988
1987
|
const c = [], g = [];
|
|
1989
1988
|
let u = c;
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
return $.length > 1 && $[0] === "-";
|
|
1989
|
+
function m(x) {
|
|
1990
|
+
return x.length > 1 && x[0] === "-";
|
|
1993
1991
|
}
|
|
1994
|
-
const
|
|
1995
|
-
(P) => P.options.map((
|
|
1992
|
+
const y = (x) => /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(x) ? !this._getCommandAndAncestors().some(
|
|
1993
|
+
(P) => P.options.map((I) => I.short).some((I) => /^-\d$/.test(I))
|
|
1996
1994
|
) : !1;
|
|
1997
|
-
let O = null;
|
|
1998
|
-
for (;
|
|
1999
|
-
const
|
|
2000
|
-
if (
|
|
2001
|
-
u === g && u.push(
|
|
1995
|
+
let L = null, O = null, R = 0;
|
|
1996
|
+
for (; R < t.length || O; ) {
|
|
1997
|
+
const x = O ?? t[R++];
|
|
1998
|
+
if (O = null, x === "--") {
|
|
1999
|
+
u === g && u.push(x), u.push(...t.slice(R));
|
|
2002
2000
|
break;
|
|
2003
2001
|
}
|
|
2004
|
-
if (
|
|
2005
|
-
this.emit(`option:${
|
|
2002
|
+
if (L && (!m(x) || y(x))) {
|
|
2003
|
+
this.emit(`option:${L.name()}`, x);
|
|
2006
2004
|
continue;
|
|
2007
2005
|
}
|
|
2008
|
-
if (
|
|
2009
|
-
const P = this._findOption(
|
|
2006
|
+
if (L = null, m(x)) {
|
|
2007
|
+
const P = this._findOption(x);
|
|
2010
2008
|
if (P) {
|
|
2011
2009
|
if (P.required) {
|
|
2012
|
-
const
|
|
2013
|
-
|
|
2010
|
+
const I = t[R++];
|
|
2011
|
+
I === void 0 && this.optionMissingArgument(P), this.emit(`option:${P.name()}`, I);
|
|
2014
2012
|
} else if (P.optional) {
|
|
2015
|
-
let
|
|
2016
|
-
|
|
2013
|
+
let I = null;
|
|
2014
|
+
R < t.length && (!m(t[R]) || y(t[R])) && (I = t[R++]), this.emit(`option:${P.name()}`, I);
|
|
2017
2015
|
} else
|
|
2018
2016
|
this.emit(`option:${P.name()}`);
|
|
2019
|
-
|
|
2017
|
+
L = P.variadic ? P : null;
|
|
2020
2018
|
continue;
|
|
2021
2019
|
}
|
|
2022
2020
|
}
|
|
2023
|
-
if (
|
|
2024
|
-
const P = this._findOption(`-${
|
|
2021
|
+
if (x.length > 2 && x[0] === "-" && x[1] !== "-") {
|
|
2022
|
+
const P = this._findOption(`-${x[1]}`);
|
|
2025
2023
|
if (P) {
|
|
2026
|
-
P.required || P.optional && this._combineFlagAndOptionalValue ? this.emit(`option:${P.name()}`,
|
|
2024
|
+
P.required || P.optional && this._combineFlagAndOptionalValue ? this.emit(`option:${P.name()}`, x.slice(2)) : (this.emit(`option:${P.name()}`), O = `-${x.slice(2)}`);
|
|
2027
2025
|
continue;
|
|
2028
2026
|
}
|
|
2029
2027
|
}
|
|
2030
|
-
if (/^--[^=]+=/.test(
|
|
2031
|
-
const P =
|
|
2032
|
-
if (
|
|
2033
|
-
this.emit(`option:${
|
|
2028
|
+
if (/^--[^=]+=/.test(x)) {
|
|
2029
|
+
const P = x.indexOf("="), I = this._findOption(x.slice(0, P));
|
|
2030
|
+
if (I && (I.required || I.optional)) {
|
|
2031
|
+
this.emit(`option:${I.name()}`, x.slice(P + 1));
|
|
2034
2032
|
continue;
|
|
2035
2033
|
}
|
|
2036
2034
|
}
|
|
2037
|
-
if (u === c &&
|
|
2038
|
-
if (this._findCommand(
|
|
2039
|
-
c.push(
|
|
2035
|
+
if (u === c && m(x) && !(this.commands.length === 0 && y(x)) && (u = g), (this._enablePositionalOptions || this._passThroughOptions) && c.length === 0 && g.length === 0) {
|
|
2036
|
+
if (this._findCommand(x)) {
|
|
2037
|
+
c.push(x), g.push(...t.slice(R));
|
|
2040
2038
|
break;
|
|
2041
|
-
} else if (this._getHelpCommand() &&
|
|
2042
|
-
c.push(
|
|
2039
|
+
} else if (this._getHelpCommand() && x === this._getHelpCommand().name()) {
|
|
2040
|
+
c.push(x, ...t.slice(R));
|
|
2043
2041
|
break;
|
|
2044
2042
|
} else if (this._defaultCommandName) {
|
|
2045
|
-
g.push(
|
|
2043
|
+
g.push(x, ...t.slice(R));
|
|
2046
2044
|
break;
|
|
2047
2045
|
}
|
|
2048
2046
|
}
|
|
2049
2047
|
if (this._passThroughOptions) {
|
|
2050
|
-
u.push(
|
|
2048
|
+
u.push(x, ...t.slice(R));
|
|
2051
2049
|
break;
|
|
2052
2050
|
}
|
|
2053
|
-
u.push(
|
|
2051
|
+
u.push(x);
|
|
2054
2052
|
}
|
|
2055
2053
|
return { operands: c, unknown: g };
|
|
2056
2054
|
}
|
|
@@ -2097,8 +2095,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2097
2095
|
), typeof this._showHelpAfterError == "string" ? this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
2098
2096
|
`) : this._showHelpAfterError && (this._outputConfiguration.writeErr(`
|
|
2099
2097
|
`), this.outputHelp({ error: !0 }));
|
|
2100
|
-
const g = c || {}, u = g.exitCode || 1,
|
|
2101
|
-
this._exit(u,
|
|
2098
|
+
const g = c || {}, u = g.exitCode || 1, m = g.code || "commander.error";
|
|
2099
|
+
this._exit(u, m, t);
|
|
2102
2100
|
}
|
|
2103
2101
|
/**
|
|
2104
2102
|
* Apply any option related environment variables, if option does
|
|
@@ -2177,17 +2175,17 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2177
2175
|
*/
|
|
2178
2176
|
_conflictingOption(t, c) {
|
|
2179
2177
|
const g = (y) => {
|
|
2180
|
-
const L = y.attributeName(), O = this.getOptionValue(L),
|
|
2181
|
-
(
|
|
2182
|
-
),
|
|
2183
|
-
(
|
|
2178
|
+
const L = y.attributeName(), O = this.getOptionValue(L), R = this.options.find(
|
|
2179
|
+
(P) => P.negate && L === P.attributeName()
|
|
2180
|
+
), x = this.options.find(
|
|
2181
|
+
(P) => !P.negate && L === P.attributeName()
|
|
2184
2182
|
);
|
|
2185
|
-
return
|
|
2183
|
+
return R && (R.presetArg === void 0 && O === !1 || R.presetArg !== void 0 && O === R.presetArg) ? R : x || y;
|
|
2186
2184
|
}, u = (y) => {
|
|
2187
2185
|
const L = g(y), O = L.attributeName();
|
|
2188
2186
|
return this.getOptionValueSource(O) === "env" ? `environment variable '${L.envVar}'` : `option '${L.flags}'`;
|
|
2189
|
-
},
|
|
2190
|
-
this.error(
|
|
2187
|
+
}, m = `error: ${u(t)} cannot be used with ${u(c)}`;
|
|
2188
|
+
this.error(m, { code: "commander.conflictingOption" });
|
|
2191
2189
|
}
|
|
2192
2190
|
/**
|
|
2193
2191
|
* Unknown option `flag`.
|
|
@@ -2199,11 +2197,11 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2199
2197
|
if (this._allowUnknownOption) return;
|
|
2200
2198
|
let c = "";
|
|
2201
2199
|
if (t.startsWith("--") && this._showSuggestionAfterError) {
|
|
2202
|
-
let u = [],
|
|
2200
|
+
let u = [], m = this;
|
|
2203
2201
|
do {
|
|
2204
|
-
const y =
|
|
2205
|
-
u = u.concat(y),
|
|
2206
|
-
} while (
|
|
2202
|
+
const y = m.createHelp().visibleOptions(m).filter((L) => L.long).map((L) => L.long);
|
|
2203
|
+
u = u.concat(y), m = m.parent;
|
|
2204
|
+
} while (m && !m._enablePositionalOptions);
|
|
2207
2205
|
c = w(t, u);
|
|
2208
2206
|
}
|
|
2209
2207
|
const g = `error: unknown option '${t}'${c}`;
|
|
@@ -2217,8 +2215,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2217
2215
|
*/
|
|
2218
2216
|
_excessArguments(t) {
|
|
2219
2217
|
if (this._allowExcessArguments) return;
|
|
2220
|
-
const c = this.registeredArguments.length, g = c === 1 ? "" : "s",
|
|
2221
|
-
this.error(
|
|
2218
|
+
const c = this.registeredArguments.length, g = c === 1 ? "" : "s", m = `error: too many arguments${this.parent ? ` for '${this.name()}'` : ""}. Expected ${c} argument${g} but got ${t.length}.`;
|
|
2219
|
+
this.error(m, { code: "commander.excessArguments" });
|
|
2222
2220
|
}
|
|
2223
2221
|
/**
|
|
2224
2222
|
* Unknown command.
|
|
@@ -2230,8 +2228,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2230
2228
|
let c = "";
|
|
2231
2229
|
if (this._showSuggestionAfterError) {
|
|
2232
2230
|
const u = [];
|
|
2233
|
-
this.createHelp().visibleCommands(this).forEach((
|
|
2234
|
-
u.push(
|
|
2231
|
+
this.createHelp().visibleCommands(this).forEach((m) => {
|
|
2232
|
+
u.push(m.name()), m.alias() && u.push(m.alias());
|
|
2235
2233
|
}), c = w(t, u);
|
|
2236
2234
|
}
|
|
2237
2235
|
const g = `error: unknown command '${t}'${c}`;
|
|
@@ -2451,8 +2449,8 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2451
2449
|
_getOutputContext(t) {
|
|
2452
2450
|
t = t || {};
|
|
2453
2451
|
const c = !!t.error;
|
|
2454
|
-
let g, u,
|
|
2455
|
-
return c ? (g = (L) => this._outputConfiguration.writeErr(L), u = this._outputConfiguration.getErrHasColors(),
|
|
2452
|
+
let g, u, m;
|
|
2453
|
+
return c ? (g = (L) => this._outputConfiguration.writeErr(L), u = this._outputConfiguration.getErrHasColors(), m = this._outputConfiguration.getErrHelpWidth()) : (g = (L) => this._outputConfiguration.writeOut(L), u = this._outputConfiguration.getOutHasColors(), m = this._outputConfiguration.getOutHelpWidth()), { error: c, write: (L) => (u || (L = this._outputConfiguration.stripColor(L)), g(L)), hasColors: u, helpWidth: m };
|
|
2456
2454
|
}
|
|
2457
2455
|
/**
|
|
2458
2456
|
* Output help information for this command.
|
|
@@ -2470,10 +2468,10 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2470
2468
|
command: this
|
|
2471
2469
|
};
|
|
2472
2470
|
this._getCommandAndAncestors().reverse().forEach((y) => y.emit("beforeAllHelp", u)), this.emit("beforeHelp", u);
|
|
2473
|
-
let
|
|
2474
|
-
if (c && (
|
|
2471
|
+
let m = this.helpInformation({ error: g.error });
|
|
2472
|
+
if (c && (m = c(m), typeof m != "string" && !Buffer.isBuffer(m)))
|
|
2475
2473
|
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
2476
|
-
g.write(
|
|
2474
|
+
g.write(m), this._getHelpOption()?.long && this.emit(this._getHelpOption().long), this.emit("afterHelp", u), this._getCommandAndAncestors().forEach(
|
|
2477
2475
|
(y) => y.emit("afterAllHelp", u)
|
|
2478
2476
|
);
|
|
2479
2477
|
}
|
|
@@ -2551,9 +2549,9 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2551
2549
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
2552
2550
|
Expecting one of '${g.join("', '")}'`);
|
|
2553
2551
|
const u = `${t}Help`;
|
|
2554
|
-
return this.on(u, (
|
|
2552
|
+
return this.on(u, (m) => {
|
|
2555
2553
|
let y;
|
|
2556
|
-
typeof c == "function" ? y = c({ error:
|
|
2554
|
+
typeof c == "function" ? y = c({ error: m.error, command: m.command }) : y = c, y && m.write(`${y}
|
|
2557
2555
|
`);
|
|
2558
2556
|
}), this;
|
|
2559
2557
|
}
|
|
@@ -2568,12 +2566,12 @@ Expecting one of '${g.join("', '")}'`);
|
|
|
2568
2566
|
c && t.find((u) => c.is(u)) && (this.outputHelp(), this._exit(0, "commander.helpDisplayed", "(outputHelp)"));
|
|
2569
2567
|
}
|
|
2570
2568
|
}
|
|
2571
|
-
function
|
|
2569
|
+
function p(A) {
|
|
2572
2570
|
return A.map((t) => {
|
|
2573
2571
|
if (!t.startsWith("--inspect"))
|
|
2574
2572
|
return t;
|
|
2575
|
-
let c, g = "127.0.0.1", u = "9229",
|
|
2576
|
-
return (
|
|
2573
|
+
let c, g = "127.0.0.1", u = "9229", m;
|
|
2574
|
+
return (m = t.match(/^(--inspect(-brk)?)$/)) !== null ? c = m[1] : (m = t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null ? (c = m[1], /^\d+$/.test(m[3]) ? u = m[3] : g = m[3]) : (m = t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null && (c = m[1], g = m[3], u = m[4]), c && u !== "0" ? `${c}=${g}:${parseInt(u) + 1}` : t;
|
|
2577
2575
|
});
|
|
2578
2576
|
}
|
|
2579
2577
|
function f() {
|
|
@@ -2612,7 +2610,7 @@ const $i = /* @__PURE__ */ Ue(xi), {
|
|
|
2612
2610
|
Argument: Ju,
|
|
2613
2611
|
Option: Zu,
|
|
2614
2612
|
Help: Qu
|
|
2615
|
-
} = $i, Pi = "5.0.0-next.
|
|
2613
|
+
} = $i, Pi = "5.0.0-next.115";
|
|
2616
2614
|
var ve = /* @__PURE__ */ ((s) => (s.VANILLA = "vanilla JS", s.REACT = "react", s.ANGULAR = "angular", s.VITE = "vite", s.VUE = "vue", s.WEBPACK = "webpack", s.LUMINA_COMPONENTS = "lumina-components", s.TYPESCRIPT = "typescript", s))(ve || {}), Ge = /* @__PURE__ */ ((s) => (s.MAPS_WITH_CHARTS = "map-with-charts-components", s))(Ge || {});
|
|
2617
2615
|
const Ri = {
|
|
2618
2616
|
"map-with-charts-components": {
|
|
@@ -2698,21 +2696,21 @@ function Mi() {
|
|
|
2698
2696
|
MAX_LENGTH: i
|
|
2699
2697
|
} = Ur(), r = Hr();
|
|
2700
2698
|
n = s.exports = {};
|
|
2701
|
-
const e = n.re = [], a = n.safeRe = [], l = n.src = [], C = n.safeSrc = [],
|
|
2699
|
+
const e = n.re = [], a = n.safeRe = [], l = n.src = [], C = n.safeSrc = [], d = n.t = {};
|
|
2702
2700
|
let v = 0;
|
|
2703
2701
|
const w = "[a-zA-Z0-9-]", D = [
|
|
2704
2702
|
["\\s", 1],
|
|
2705
2703
|
["\\d", i],
|
|
2706
2704
|
[w, h]
|
|
2707
|
-
],
|
|
2705
|
+
], p = (A) => {
|
|
2708
2706
|
for (const [t, c] of D)
|
|
2709
2707
|
A = A.split(`${t}*`).join(`${t}{0,${c}}`).split(`${t}+`).join(`${t}{1,${c}}`);
|
|
2710
2708
|
return A;
|
|
2711
2709
|
}, f = (A, t, c) => {
|
|
2712
|
-
const g =
|
|
2713
|
-
r(A, u, t),
|
|
2710
|
+
const g = p(t), u = v++;
|
|
2711
|
+
r(A, u, t), d[A] = u, l[u] = t, C[u] = g, e[u] = new RegExp(t, c ? "g" : void 0), a[u] = new RegExp(g, c ? "g" : void 0);
|
|
2714
2712
|
};
|
|
2715
|
-
f("NUMERICIDENTIFIER", "0|[1-9]\\d*"), f("NUMERICIDENTIFIERLOOSE", "\\d+"), f("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${w}*`), f("MAINVERSION", `(${l[
|
|
2713
|
+
f("NUMERICIDENTIFIER", "0|[1-9]\\d*"), f("NUMERICIDENTIFIERLOOSE", "\\d+"), f("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${w}*`), f("MAINVERSION", `(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})`), f("MAINVERSIONLOOSE", `(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})`), f("PRERELEASEIDENTIFIER", `(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIER]})`), f("PRERELEASEIDENTIFIERLOOSE", `(?:${l[d.NONNUMERICIDENTIFIER]}|${l[d.NUMERICIDENTIFIERLOOSE]})`), f("PRERELEASE", `(?:-(${l[d.PRERELEASEIDENTIFIER]}(?:\\.${l[d.PRERELEASEIDENTIFIER]})*))`), f("PRERELEASELOOSE", `(?:-?(${l[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[d.PRERELEASEIDENTIFIERLOOSE]})*))`), f("BUILDIDENTIFIER", `${w}+`), f("BUILD", `(?:\\+(${l[d.BUILDIDENTIFIER]}(?:\\.${l[d.BUILDIDENTIFIER]})*))`), f("FULLPLAIN", `v?${l[d.MAINVERSION]}${l[d.PRERELEASE]}?${l[d.BUILD]}?`), f("FULL", `^${l[d.FULLPLAIN]}$`), f("LOOSEPLAIN", `[v=\\s]*${l[d.MAINVERSIONLOOSE]}${l[d.PRERELEASELOOSE]}?${l[d.BUILD]}?`), f("LOOSE", `^${l[d.LOOSEPLAIN]}$`), f("GTLT", "((?:<|>)?=?)"), f("XRANGEIDENTIFIERLOOSE", `${l[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), f("XRANGEIDENTIFIER", `${l[d.NUMERICIDENTIFIER]}|x|X|\\*`), f("XRANGEPLAIN", `[v=\\s]*(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:${l[d.PRERELEASE]})?${l[d.BUILD]}?)?)?`), f("XRANGEPLAINLOOSE", `[v=\\s]*(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:${l[d.PRERELEASELOOSE]})?${l[d.BUILD]}?)?)?`), f("XRANGE", `^${l[d.GTLT]}\\s*${l[d.XRANGEPLAIN]}$`), f("XRANGELOOSE", `^${l[d.GTLT]}\\s*${l[d.XRANGEPLAINLOOSE]}$`), f("COERCEPLAIN", `(^|[^\\d])(\\d{1,${o}})(?:\\.(\\d{1,${o}}))?(?:\\.(\\d{1,${o}}))?`), f("COERCE", `${l[d.COERCEPLAIN]}(?:$|[^\\d])`), f("COERCEFULL", l[d.COERCEPLAIN] + `(?:${l[d.PRERELEASE]})?(?:${l[d.BUILD]})?(?:$|[^\\d])`), f("COERCERTL", l[d.COERCE], !0), f("COERCERTLFULL", l[d.COERCEFULL], !0), f("LONETILDE", "(?:~>?)"), f("TILDETRIM", `(\\s*)${l[d.LONETILDE]}\\s+`, !0), n.tildeTrimReplace = "$1~", f("TILDE", `^${l[d.LONETILDE]}${l[d.XRANGEPLAIN]}$`), f("TILDELOOSE", `^${l[d.LONETILDE]}${l[d.XRANGEPLAINLOOSE]}$`), f("LONECARET", "(?:\\^)"), f("CARETTRIM", `(\\s*)${l[d.LONECARET]}\\s+`, !0), n.caretTrimReplace = "$1^", f("CARET", `^${l[d.LONECARET]}${l[d.XRANGEPLAIN]}$`), f("CARETLOOSE", `^${l[d.LONECARET]}${l[d.XRANGEPLAINLOOSE]}$`), f("COMPARATORLOOSE", `^${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]})$|^$`), f("COMPARATOR", `^${l[d.GTLT]}\\s*(${l[d.FULLPLAIN]})$|^$`), f("COMPARATORTRIM", `(\\s*)${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]}|${l[d.XRANGEPLAIN]})`, !0), n.comparatorTrimReplace = "$1$2$3", f("HYPHENRANGE", `^\\s*(${l[d.XRANGEPLAIN]})\\s+-\\s+(${l[d.XRANGEPLAIN]})\\s*$`), f("HYPHENRANGELOOSE", `^\\s*(${l[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[d.XRANGEPLAINLOOSE]})\\s*$`), f("STAR", "(<|>)?=?\\s*\\*"), f("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), f("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
2716
2714
|
})(Re, Re.exports)), Re.exports;
|
|
2717
2715
|
}
|
|
2718
2716
|
var Xe, Vt;
|
|
@@ -2743,9 +2741,9 @@ function Hi() {
|
|
|
2743
2741
|
zt = 1;
|
|
2744
2742
|
const s = Hr(), { MAX_LENGTH: n, MAX_SAFE_INTEGER: o } = Ur(), { safeRe: h, t: i } = Mi(), r = Gi(), { compareIdentifiers: e } = ki();
|
|
2745
2743
|
class a {
|
|
2746
|
-
constructor(C,
|
|
2747
|
-
if (
|
|
2748
|
-
if (C.loose === !!
|
|
2744
|
+
constructor(C, d) {
|
|
2745
|
+
if (d = r(d), C instanceof a) {
|
|
2746
|
+
if (C.loose === !!d.loose && C.includePrerelease === !!d.includePrerelease)
|
|
2749
2747
|
return C;
|
|
2750
2748
|
C = C.version;
|
|
2751
2749
|
} else if (typeof C != "string")
|
|
@@ -2754,8 +2752,8 @@ function Hi() {
|
|
|
2754
2752
|
throw new TypeError(
|
|
2755
2753
|
`version is longer than ${n} characters`
|
|
2756
2754
|
);
|
|
2757
|
-
s("SemVer", C,
|
|
2758
|
-
const v = C.trim().match(
|
|
2755
|
+
s("SemVer", C, d), this.options = d, this.loose = !!d.loose, this.includePrerelease = !!d.includePrerelease;
|
|
2756
|
+
const v = C.trim().match(d.loose ? h[i.LOOSE] : h[i.FULL]);
|
|
2759
2757
|
if (!v)
|
|
2760
2758
|
throw new TypeError(`Invalid Version: ${C}`);
|
|
2761
2759
|
if (this.raw = C, this.major = +v[1], this.minor = +v[2], this.patch = +v[3], this.major > o || this.major < 0)
|
|
@@ -2797,10 +2795,10 @@ function Hi() {
|
|
|
2797
2795
|
return 1;
|
|
2798
2796
|
if (!this.prerelease.length && !C.prerelease.length)
|
|
2799
2797
|
return 0;
|
|
2800
|
-
let
|
|
2798
|
+
let d = 0;
|
|
2801
2799
|
do {
|
|
2802
|
-
const v = this.prerelease[
|
|
2803
|
-
if (s("prerelease compare",
|
|
2800
|
+
const v = this.prerelease[d], w = C.prerelease[d];
|
|
2801
|
+
if (s("prerelease compare", d, v, w), v === void 0 && w === void 0)
|
|
2804
2802
|
return 0;
|
|
2805
2803
|
if (w === void 0)
|
|
2806
2804
|
return 1;
|
|
@@ -2809,14 +2807,14 @@ function Hi() {
|
|
|
2809
2807
|
if (v === w)
|
|
2810
2808
|
continue;
|
|
2811
2809
|
return e(v, w);
|
|
2812
|
-
} while (++
|
|
2810
|
+
} while (++d);
|
|
2813
2811
|
}
|
|
2814
2812
|
compareBuild(C) {
|
|
2815
2813
|
C instanceof a || (C = new a(C, this.options));
|
|
2816
|
-
let
|
|
2814
|
+
let d = 0;
|
|
2817
2815
|
do {
|
|
2818
|
-
const v = this.build[
|
|
2819
|
-
if (s("build compare",
|
|
2816
|
+
const v = this.build[d], w = C.build[d];
|
|
2817
|
+
if (s("build compare", d, v, w), v === void 0 && w === void 0)
|
|
2820
2818
|
return 0;
|
|
2821
2819
|
if (w === void 0)
|
|
2822
2820
|
return 1;
|
|
@@ -2825,34 +2823,34 @@ function Hi() {
|
|
|
2825
2823
|
if (v === w)
|
|
2826
2824
|
continue;
|
|
2827
2825
|
return e(v, w);
|
|
2828
|
-
} while (++
|
|
2826
|
+
} while (++d);
|
|
2829
2827
|
}
|
|
2830
2828
|
// preminor will bump the version up to the next minor release, and immediately
|
|
2831
2829
|
// down to pre-release. premajor and prepatch work the same way.
|
|
2832
|
-
inc(C,
|
|
2830
|
+
inc(C, d, v) {
|
|
2833
2831
|
if (C.startsWith("pre")) {
|
|
2834
|
-
if (!
|
|
2832
|
+
if (!d && v === !1)
|
|
2835
2833
|
throw new Error("invalid increment argument: identifier is empty");
|
|
2836
|
-
if (
|
|
2837
|
-
const w = `-${
|
|
2838
|
-
if (!w || w[1] !==
|
|
2839
|
-
throw new Error(`invalid identifier: ${
|
|
2834
|
+
if (d) {
|
|
2835
|
+
const w = `-${d}`.match(this.options.loose ? h[i.PRERELEASELOOSE] : h[i.PRERELEASE]);
|
|
2836
|
+
if (!w || w[1] !== d)
|
|
2837
|
+
throw new Error(`invalid identifier: ${d}`);
|
|
2840
2838
|
}
|
|
2841
2839
|
}
|
|
2842
2840
|
switch (C) {
|
|
2843
2841
|
case "premajor":
|
|
2844
|
-
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre",
|
|
2842
|
+
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", d, v);
|
|
2845
2843
|
break;
|
|
2846
2844
|
case "preminor":
|
|
2847
|
-
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre",
|
|
2845
|
+
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", d, v);
|
|
2848
2846
|
break;
|
|
2849
2847
|
case "prepatch":
|
|
2850
|
-
this.prerelease.length = 0, this.inc("patch",
|
|
2848
|
+
this.prerelease.length = 0, this.inc("patch", d, v), this.inc("pre", d, v);
|
|
2851
2849
|
break;
|
|
2852
2850
|
// If the input is a non-prerelease version, this acts the same as
|
|
2853
2851
|
// prepatch.
|
|
2854
2852
|
case "prerelease":
|
|
2855
|
-
this.prerelease.length === 0 && this.inc("patch",
|
|
2853
|
+
this.prerelease.length === 0 && this.inc("patch", d, v), this.inc("pre", d, v);
|
|
2856
2854
|
break;
|
|
2857
2855
|
case "release":
|
|
2858
2856
|
if (this.prerelease.length === 0)
|
|
@@ -2879,14 +2877,14 @@ function Hi() {
|
|
|
2879
2877
|
for (; --D >= 0; )
|
|
2880
2878
|
typeof this.prerelease[D] == "number" && (this.prerelease[D]++, D = -2);
|
|
2881
2879
|
if (D === -1) {
|
|
2882
|
-
if (
|
|
2880
|
+
if (d === this.prerelease.join(".") && v === !1)
|
|
2883
2881
|
throw new Error("invalid increment argument: identifier already exists");
|
|
2884
2882
|
this.prerelease.push(w);
|
|
2885
2883
|
}
|
|
2886
2884
|
}
|
|
2887
|
-
if (
|
|
2888
|
-
let D = [
|
|
2889
|
-
v === !1 && (D = [
|
|
2885
|
+
if (d) {
|
|
2886
|
+
let D = [d, w];
|
|
2887
|
+
v === !1 && (D = [d]), e(this.prerelease[0], d) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = D) : this.prerelease = D;
|
|
2890
2888
|
}
|
|
2891
2889
|
break;
|
|
2892
2890
|
}
|
|
@@ -3070,7 +3068,7 @@ function qi() {
|
|
|
3070
3068
|
throw new Error("Expected idstring at offset " + h);
|
|
3071
3069
|
return A;
|
|
3072
3070
|
}
|
|
3073
|
-
function
|
|
3071
|
+
function d() {
|
|
3074
3072
|
if (r("DocumentRef-")) {
|
|
3075
3073
|
var A = C();
|
|
3076
3074
|
return { type: "DOCUMENTREF", string: A };
|
|
@@ -3097,15 +3095,15 @@ function qi() {
|
|
|
3097
3095
|
h = A;
|
|
3098
3096
|
}
|
|
3099
3097
|
function D() {
|
|
3100
|
-
return a() ||
|
|
3098
|
+
return a() || d() || v() || w();
|
|
3101
3099
|
}
|
|
3102
|
-
for (var
|
|
3100
|
+
for (var p = []; i() && (e(), !!i()); ) {
|
|
3103
3101
|
var f = D();
|
|
3104
3102
|
if (!f)
|
|
3105
3103
|
throw new Error("Unexpected `" + o[h] + "` at offset " + h);
|
|
3106
|
-
|
|
3104
|
+
p.push(f);
|
|
3107
3105
|
}
|
|
3108
|
-
return
|
|
3106
|
+
return p;
|
|
3109
3107
|
}, tt;
|
|
3110
3108
|
}
|
|
3111
3109
|
var rt, Zt;
|
|
@@ -3163,7 +3161,7 @@ function zi() {
|
|
|
3163
3161
|
return A;
|
|
3164
3162
|
}
|
|
3165
3163
|
}
|
|
3166
|
-
function
|
|
3164
|
+
function d() {
|
|
3167
3165
|
return C() || a() || l();
|
|
3168
3166
|
}
|
|
3169
3167
|
function v(f, A) {
|
|
@@ -3183,10 +3181,10 @@ function zi() {
|
|
|
3183
3181
|
}
|
|
3184
3182
|
};
|
|
3185
3183
|
}
|
|
3186
|
-
var w = v("AND",
|
|
3187
|
-
if (!
|
|
3184
|
+
var w = v("AND", d), D = v("OR", w), p = D();
|
|
3185
|
+
if (!p || o())
|
|
3188
3186
|
throw new Error("Syntax error");
|
|
3189
|
-
return
|
|
3187
|
+
return p;
|
|
3190
3188
|
}), rt;
|
|
3191
3189
|
}
|
|
3192
3190
|
var it, Qt;
|
|
@@ -3377,7 +3375,7 @@ function Yi() {
|
|
|
3377
3375
|
return [c[0], c[1][0]];
|
|
3378
3376
|
});
|
|
3379
3377
|
l = void 0;
|
|
3380
|
-
var
|
|
3378
|
+
var d = [
|
|
3381
3379
|
["UNLI", "Unlicense"],
|
|
3382
3380
|
["WTF", "WTFPL"],
|
|
3383
3381
|
["2 CLAUSE", "BSD-2-Clause"],
|
|
@@ -3414,19 +3412,19 @@ function Yi() {
|
|
|
3414
3412
|
return g;
|
|
3415
3413
|
}
|
|
3416
3414
|
return null;
|
|
3417
|
-
},
|
|
3418
|
-
for (var c = t.toUpperCase(), g = 0; g <
|
|
3419
|
-
var u =
|
|
3415
|
+
}, p = function(t) {
|
|
3416
|
+
for (var c = t.toUpperCase(), g = 0; g < d.length; g++) {
|
|
3417
|
+
var u = d[g];
|
|
3420
3418
|
if (c.indexOf(u[v]) > -1)
|
|
3421
3419
|
return u[w];
|
|
3422
3420
|
}
|
|
3423
3421
|
return null;
|
|
3424
3422
|
}, f = function(t, c) {
|
|
3425
3423
|
for (var g = 0; g < i.length; g++) {
|
|
3426
|
-
var u = i[g],
|
|
3427
|
-
if (t.indexOf(
|
|
3424
|
+
var u = i[g], m = u[r];
|
|
3425
|
+
if (t.indexOf(m) > -1) {
|
|
3428
3426
|
var y = t.replace(
|
|
3429
|
-
|
|
3427
|
+
m,
|
|
3430
3428
|
u[e]
|
|
3431
3429
|
), L = c(y);
|
|
3432
3430
|
if (L !== null)
|
|
@@ -3441,8 +3439,8 @@ function Yi() {
|
|
|
3441
3439
|
function u(O) {
|
|
3442
3440
|
return g ? A(O) : O;
|
|
3443
3441
|
}
|
|
3444
|
-
var
|
|
3445
|
-
if (!
|
|
3442
|
+
var m = typeof t == "string" && t.trim().length !== 0;
|
|
3443
|
+
if (!m)
|
|
3446
3444
|
throw Error("Invalid argument. Expected non-empty string.");
|
|
3447
3445
|
if (t = t.trim(), o(t))
|
|
3448
3446
|
return u(t);
|
|
@@ -3452,7 +3450,7 @@ function Yi() {
|
|
|
3452
3450
|
var L = D(t);
|
|
3453
3451
|
return L !== null || (L = f(t, function(O) {
|
|
3454
3452
|
return o(O) ? O : D(O);
|
|
3455
|
-
}), L !== null) || (L =
|
|
3453
|
+
}), L !== null) || (L = p(t), L !== null) || (L = f(t, p), L !== null) ? u(L) : null;
|
|
3456
3454
|
};
|
|
3457
3455
|
function A(t) {
|
|
3458
3456
|
return [
|
|
@@ -3515,9 +3513,9 @@ function Xi() {
|
|
|
3515
3513
|
warnings: [o]
|
|
3516
3514
|
};
|
|
3517
3515
|
if (e.trim().length !== 0) {
|
|
3518
|
-
var
|
|
3519
|
-
|
|
3520
|
-
'license is similar to the valid expression "' +
|
|
3516
|
+
var d = n(e);
|
|
3517
|
+
d && C.warnings.push(
|
|
3518
|
+
'license is similar to the valid expression "' + d + '"'
|
|
3521
3519
|
);
|
|
3522
3520
|
}
|
|
3523
3521
|
return C;
|
|
@@ -3538,8 +3536,8 @@ var Ae = {}, rr;
|
|
|
3538
3536
|
function Ki() {
|
|
3539
3537
|
if (rr) return Ae;
|
|
3540
3538
|
rr = 1, Object.defineProperty(Ae, "__esModule", { value: !0 }), Ae.LRUCache = void 0;
|
|
3541
|
-
const s = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, n = /* @__PURE__ */ new Set(), o = typeof process == "object" && process ? process : {}, h = (w, D,
|
|
3542
|
-
typeof o.emitWarning == "function" ? o.emitWarning(w, D,
|
|
3539
|
+
const s = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, n = /* @__PURE__ */ new Set(), o = typeof process == "object" && process ? process : {}, h = (w, D, p, f) => {
|
|
3540
|
+
typeof o.emitWarning == "function" ? o.emitWarning(w, D, p, f) : console.error(`[${p}] ${D}: ${w}`);
|
|
3543
3541
|
};
|
|
3544
3542
|
let i = globalThis.AbortController, r = globalThis.AbortSignal;
|
|
3545
3543
|
if (typeof i > "u") {
|
|
@@ -3576,23 +3574,23 @@ function Ki() {
|
|
|
3576
3574
|
super(D), this.fill(0);
|
|
3577
3575
|
}
|
|
3578
3576
|
}
|
|
3579
|
-
class
|
|
3577
|
+
class d {
|
|
3580
3578
|
heap;
|
|
3581
3579
|
length;
|
|
3582
3580
|
// private constructor
|
|
3583
3581
|
static #n = !1;
|
|
3584
3582
|
static create(D) {
|
|
3585
|
-
const
|
|
3586
|
-
if (!
|
|
3583
|
+
const p = l(D);
|
|
3584
|
+
if (!p)
|
|
3587
3585
|
return [];
|
|
3588
|
-
|
|
3589
|
-
const f = new
|
|
3590
|
-
return
|
|
3586
|
+
d.#n = !0;
|
|
3587
|
+
const f = new d(D, p);
|
|
3588
|
+
return d.#n = !1, f;
|
|
3591
3589
|
}
|
|
3592
|
-
constructor(D,
|
|
3593
|
-
if (!
|
|
3590
|
+
constructor(D, p) {
|
|
3591
|
+
if (!d.#n)
|
|
3594
3592
|
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
3595
|
-
this.heap = new
|
|
3593
|
+
this.heap = new p(D), this.length = 0;
|
|
3596
3594
|
}
|
|
3597
3595
|
push(D) {
|
|
3598
3596
|
this.heap[this.length++] = D;
|
|
@@ -3715,12 +3713,12 @@ function Ki() {
|
|
|
3715
3713
|
},
|
|
3716
3714
|
free: D.#C,
|
|
3717
3715
|
// methods
|
|
3718
|
-
isBackgroundFetch: (
|
|
3719
|
-
backgroundFetch: (
|
|
3720
|
-
moveToTail: (
|
|
3721
|
-
indexes: (
|
|
3722
|
-
rindexes: (
|
|
3723
|
-
isStale: (
|
|
3716
|
+
isBackgroundFetch: (p) => D.#r(p),
|
|
3717
|
+
backgroundFetch: (p, f, A, t) => D.#R(p, f, A, t),
|
|
3718
|
+
moveToTail: (p) => D.#_(p),
|
|
3719
|
+
indexes: (p) => D.#A(p),
|
|
3720
|
+
rindexes: (p) => D.#v(p),
|
|
3721
|
+
isStale: (p) => D.#d(p)
|
|
3724
3722
|
};
|
|
3725
3723
|
}
|
|
3726
3724
|
// Protected read-only members
|
|
@@ -3770,30 +3768,30 @@ function Ki() {
|
|
|
3770
3768
|
return this.#m;
|
|
3771
3769
|
}
|
|
3772
3770
|
constructor(D) {
|
|
3773
|
-
const { max:
|
|
3774
|
-
if (
|
|
3771
|
+
const { max: p = 0, ttl: f, ttlResolution: A = 1, ttlAutopurge: t, updateAgeOnGet: c, updateAgeOnHas: g, allowStale: u, dispose: m, disposeAfter: y, noDisposeOnSet: L, noUpdateTTL: O, maxSize: R = 0, maxEntrySize: x = 0, sizeCalculation: P, fetchMethod: I, memoMethod: N, noDeleteOnFetchRejection: Y, noDeleteOnStaleGet: T, allowStaleOnFetchRejection: W, allowStaleOnFetchAbort: k, ignoreFetchAbort: fe } = D;
|
|
3772
|
+
if (p !== 0 && !a(p))
|
|
3775
3773
|
throw new TypeError("max option must be a nonnegative integer");
|
|
3776
|
-
const ae =
|
|
3774
|
+
const ae = p ? l(p) : Array;
|
|
3777
3775
|
if (!ae)
|
|
3778
|
-
throw new Error("invalid max value: " +
|
|
3779
|
-
if (this.#n =
|
|
3776
|
+
throw new Error("invalid max value: " + p);
|
|
3777
|
+
if (this.#n = p, this.#l = R, this.maxEntrySize = x || this.#l, this.sizeCalculation = P, this.sizeCalculation) {
|
|
3780
3778
|
if (!this.#l && !this.maxEntrySize)
|
|
3781
3779
|
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
3782
3780
|
if (typeof this.sizeCalculation != "function")
|
|
3783
3781
|
throw new TypeError("sizeCalculation set to non-function");
|
|
3784
3782
|
}
|
|
3785
|
-
if (
|
|
3783
|
+
if (N !== void 0 && typeof N != "function")
|
|
3786
3784
|
throw new TypeError("memoMethod must be a function if defined");
|
|
3787
|
-
if (this.#$ =
|
|
3785
|
+
if (this.#$ = N, I !== void 0 && typeof I != "function")
|
|
3788
3786
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
3789
|
-
if (this.#x =
|
|
3787
|
+
if (this.#x = I, this.#L = !!I, this.#s = /* @__PURE__ */ new Map(), this.#i = new Array(p).fill(void 0), this.#e = new Array(p).fill(void 0), this.#h = new ae(p), this.#f = new ae(p), this.#c = 0, this.#o = 0, this.#C = d.create(p), this.#u = 0, this.#g = 0, typeof m == "function" && (this.#t = m), typeof y == "function" ? (this.#m = y, this.#a = []) : (this.#m = void 0, this.#a = void 0), this.#b = !!this.#t, this.#D = !!this.#m, this.noDisposeOnSet = !!L, this.noUpdateTTL = !!O, this.noDeleteOnFetchRejection = !!Y, this.allowStaleOnFetchRejection = !!W, this.allowStaleOnFetchAbort = !!k, this.ignoreFetchAbort = !!fe, this.maxEntrySize !== 0) {
|
|
3790
3788
|
if (this.#l !== 0 && !a(this.#l))
|
|
3791
3789
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
3792
3790
|
if (!a(this.maxEntrySize))
|
|
3793
3791
|
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
3794
3792
|
this.#H();
|
|
3795
3793
|
}
|
|
3796
|
-
if (this.allowStale = !!u, this.noDeleteOnStaleGet = !!
|
|
3794
|
+
if (this.allowStale = !!u, this.noDeleteOnStaleGet = !!T, this.updateAgeOnGet = !!c, this.updateAgeOnHas = !!g, this.ttlResolution = a(A) || A === 0 ? A : 1, this.ttlAutopurge = !!t, this.ttl = f || 0, this.ttl) {
|
|
3797
3795
|
if (!a(this.ttl))
|
|
3798
3796
|
throw new TypeError("ttl must be a positive integer if specified");
|
|
3799
3797
|
this.#I();
|
|
@@ -3813,24 +3811,24 @@ function Ki() {
|
|
|
3813
3811
|
return this.#s.has(D) ? 1 / 0 : 0;
|
|
3814
3812
|
}
|
|
3815
3813
|
#I() {
|
|
3816
|
-
const D = new C(this.#n),
|
|
3817
|
-
this.#p = D, this.#F =
|
|
3818
|
-
if (
|
|
3814
|
+
const D = new C(this.#n), p = new C(this.#n);
|
|
3815
|
+
this.#p = D, this.#F = p, this.#N = (t, c, g = s.now()) => {
|
|
3816
|
+
if (p[t] = c !== 0 ? g : 0, D[t] = c, c !== 0 && this.ttlAutopurge) {
|
|
3819
3817
|
const u = setTimeout(() => {
|
|
3820
3818
|
this.#d(t) && this.#y(this.#i[t], "expire");
|
|
3821
3819
|
}, c + 1);
|
|
3822
3820
|
u.unref && u.unref();
|
|
3823
3821
|
}
|
|
3824
3822
|
}, this.#S = (t) => {
|
|
3825
|
-
|
|
3823
|
+
p[t] = D[t] !== 0 ? s.now() : 0;
|
|
3826
3824
|
}, this.#w = (t, c) => {
|
|
3827
3825
|
if (D[c]) {
|
|
3828
|
-
const g = D[c], u =
|
|
3826
|
+
const g = D[c], u = p[c];
|
|
3829
3827
|
if (!g || !u)
|
|
3830
3828
|
return;
|
|
3831
3829
|
t.ttl = g, t.start = u, t.now = f || A();
|
|
3832
|
-
const
|
|
3833
|
-
t.remainingTTL = g -
|
|
3830
|
+
const m = t.now - u;
|
|
3831
|
+
t.remainingTTL = g - m;
|
|
3834
3832
|
}
|
|
3835
3833
|
};
|
|
3836
3834
|
let f = 0;
|
|
@@ -3847,13 +3845,13 @@ function Ki() {
|
|
|
3847
3845
|
const c = this.#s.get(t);
|
|
3848
3846
|
if (c === void 0)
|
|
3849
3847
|
return 0;
|
|
3850
|
-
const g = D[c], u =
|
|
3848
|
+
const g = D[c], u = p[c];
|
|
3851
3849
|
if (!g || !u)
|
|
3852
3850
|
return 1 / 0;
|
|
3853
|
-
const
|
|
3854
|
-
return g -
|
|
3851
|
+
const m = (f || A()) - u;
|
|
3852
|
+
return g - m;
|
|
3855
3853
|
}, this.#d = (t) => {
|
|
3856
|
-
const c =
|
|
3854
|
+
const c = p[t], g = D[t];
|
|
3857
3855
|
return !!g && !!c && (f || A()) - c > g;
|
|
3858
3856
|
};
|
|
3859
3857
|
}
|
|
@@ -3868,47 +3866,47 @@ function Ki() {
|
|
|
3868
3866
|
#d = () => !1;
|
|
3869
3867
|
#H() {
|
|
3870
3868
|
const D = new C(this.#n);
|
|
3871
|
-
this.#g = 0, this.#E = D, this.#O = (
|
|
3872
|
-
this.#g -= D[
|
|
3873
|
-
}, this.#T = (
|
|
3869
|
+
this.#g = 0, this.#E = D, this.#O = (p) => {
|
|
3870
|
+
this.#g -= D[p], D[p] = 0;
|
|
3871
|
+
}, this.#T = (p, f, A, t) => {
|
|
3874
3872
|
if (this.#r(f))
|
|
3875
3873
|
return 0;
|
|
3876
3874
|
if (!a(A))
|
|
3877
3875
|
if (t) {
|
|
3878
3876
|
if (typeof t != "function")
|
|
3879
3877
|
throw new TypeError("sizeCalculation must be a function");
|
|
3880
|
-
if (A = t(f,
|
|
3878
|
+
if (A = t(f, p), !a(A))
|
|
3881
3879
|
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
3882
3880
|
} else
|
|
3883
3881
|
throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
3884
3882
|
return A;
|
|
3885
|
-
}, this.#B = (
|
|
3886
|
-
if (D[
|
|
3887
|
-
const t = this.#l - D[
|
|
3883
|
+
}, this.#B = (p, f, A) => {
|
|
3884
|
+
if (D[p] = f, this.#l) {
|
|
3885
|
+
const t = this.#l - D[p];
|
|
3888
3886
|
for (; this.#g > t; )
|
|
3889
3887
|
this.#P(!0);
|
|
3890
3888
|
}
|
|
3891
|
-
this.#g += D[
|
|
3889
|
+
this.#g += D[p], A && (A.entrySize = f, A.totalCalculatedSize = this.#g);
|
|
3892
3890
|
};
|
|
3893
3891
|
}
|
|
3894
3892
|
#O = (D) => {
|
|
3895
3893
|
};
|
|
3896
|
-
#B = (D,
|
|
3894
|
+
#B = (D, p, f) => {
|
|
3897
3895
|
};
|
|
3898
|
-
#T = (D,
|
|
3896
|
+
#T = (D, p, f, A) => {
|
|
3899
3897
|
if (f || A)
|
|
3900
3898
|
throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
3901
3899
|
return 0;
|
|
3902
3900
|
};
|
|
3903
3901
|
*#A({ allowStale: D = this.allowStale } = {}) {
|
|
3904
3902
|
if (this.#u)
|
|
3905
|
-
for (let
|
|
3906
|
-
|
|
3903
|
+
for (let p = this.#o; !(!this.#M(p) || ((D || !this.#d(p)) && (yield p), p === this.#c)); )
|
|
3904
|
+
p = this.#f[p];
|
|
3907
3905
|
}
|
|
3908
3906
|
*#v({ allowStale: D = this.allowStale } = {}) {
|
|
3909
3907
|
if (this.#u)
|
|
3910
|
-
for (let
|
|
3911
|
-
|
|
3908
|
+
for (let p = this.#c; !(!this.#M(p) || ((D || !this.#d(p)) && (yield p), p === this.#o)); )
|
|
3909
|
+
p = this.#h[p];
|
|
3912
3910
|
}
|
|
3913
3911
|
#M(D) {
|
|
3914
3912
|
return D !== void 0 && this.#s.get(this.#i[D]) === D;
|
|
@@ -3937,8 +3935,8 @@ function Ki() {
|
|
|
3937
3935
|
*/
|
|
3938
3936
|
*keys() {
|
|
3939
3937
|
for (const D of this.#A()) {
|
|
3940
|
-
const
|
|
3941
|
-
|
|
3938
|
+
const p = this.#i[D];
|
|
3939
|
+
p !== void 0 && !this.#r(this.#e[D]) && (yield p);
|
|
3942
3940
|
}
|
|
3943
3941
|
}
|
|
3944
3942
|
/**
|
|
@@ -3949,8 +3947,8 @@ function Ki() {
|
|
|
3949
3947
|
*/
|
|
3950
3948
|
*rkeys() {
|
|
3951
3949
|
for (const D of this.#v()) {
|
|
3952
|
-
const
|
|
3953
|
-
|
|
3950
|
+
const p = this.#i[D];
|
|
3951
|
+
p !== void 0 && !this.#r(this.#e[D]) && (yield p);
|
|
3954
3952
|
}
|
|
3955
3953
|
}
|
|
3956
3954
|
/**
|
|
@@ -3988,11 +3986,11 @@ function Ki() {
|
|
|
3988
3986
|
* Find a value for which the supplied fn method returns a truthy value,
|
|
3989
3987
|
* similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
|
|
3990
3988
|
*/
|
|
3991
|
-
find(D,
|
|
3989
|
+
find(D, p = {}) {
|
|
3992
3990
|
for (const f of this.#A()) {
|
|
3993
3991
|
const A = this.#e[f], t = this.#r(A) ? A.__staleWhileFetching : A;
|
|
3994
3992
|
if (t !== void 0 && D(t, this.#i[f], this))
|
|
3995
|
-
return this.get(this.#i[f],
|
|
3993
|
+
return this.get(this.#i[f], p);
|
|
3996
3994
|
}
|
|
3997
3995
|
}
|
|
3998
3996
|
/**
|
|
@@ -4006,20 +4004,20 @@ function Ki() {
|
|
|
4006
4004
|
*
|
|
4007
4005
|
* Does not update age or recenty of use, or iterate over stale values.
|
|
4008
4006
|
*/
|
|
4009
|
-
forEach(D,
|
|
4007
|
+
forEach(D, p = this) {
|
|
4010
4008
|
for (const f of this.#A()) {
|
|
4011
4009
|
const A = this.#e[f], t = this.#r(A) ? A.__staleWhileFetching : A;
|
|
4012
|
-
t !== void 0 && D.call(
|
|
4010
|
+
t !== void 0 && D.call(p, t, this.#i[f], this);
|
|
4013
4011
|
}
|
|
4014
4012
|
}
|
|
4015
4013
|
/**
|
|
4016
4014
|
* The same as {@link LRUCache.forEach} but items are iterated over in
|
|
4017
4015
|
* reverse order. (ie, less recently used items are iterated over first.)
|
|
4018
4016
|
*/
|
|
4019
|
-
rforEach(D,
|
|
4017
|
+
rforEach(D, p = this) {
|
|
4020
4018
|
for (const f of this.#v()) {
|
|
4021
4019
|
const A = this.#e[f], t = this.#r(A) ? A.__staleWhileFetching : A;
|
|
4022
|
-
t !== void 0 && D.call(
|
|
4020
|
+
t !== void 0 && D.call(p, t, this.#i[f], this);
|
|
4023
4021
|
}
|
|
4024
4022
|
}
|
|
4025
4023
|
/**
|
|
@@ -4028,8 +4026,8 @@ function Ki() {
|
|
|
4028
4026
|
*/
|
|
4029
4027
|
purgeStale() {
|
|
4030
4028
|
let D = !1;
|
|
4031
|
-
for (const
|
|
4032
|
-
this.#d(
|
|
4029
|
+
for (const p of this.#v({ allowStale: !0 }))
|
|
4030
|
+
this.#d(p) && (this.#y(this.#i[p], "expire"), D = !0);
|
|
4033
4031
|
return D;
|
|
4034
4032
|
}
|
|
4035
4033
|
/**
|
|
@@ -4045,21 +4043,21 @@ function Ki() {
|
|
|
4045
4043
|
* if relevant.
|
|
4046
4044
|
*/
|
|
4047
4045
|
info(D) {
|
|
4048
|
-
const
|
|
4049
|
-
if (
|
|
4046
|
+
const p = this.#s.get(D);
|
|
4047
|
+
if (p === void 0)
|
|
4050
4048
|
return;
|
|
4051
|
-
const f = this.#e[
|
|
4049
|
+
const f = this.#e[p], A = this.#r(f) ? f.__staleWhileFetching : f;
|
|
4052
4050
|
if (A === void 0)
|
|
4053
4051
|
return;
|
|
4054
4052
|
const t = { value: A };
|
|
4055
4053
|
if (this.#p && this.#F) {
|
|
4056
|
-
const c = this.#p[
|
|
4054
|
+
const c = this.#p[p], g = this.#F[p];
|
|
4057
4055
|
if (c && g) {
|
|
4058
4056
|
const u = c - (s.now() - g);
|
|
4059
4057
|
t.ttl = u, t.start = Date.now();
|
|
4060
4058
|
}
|
|
4061
4059
|
}
|
|
4062
|
-
return this.#E && (t.size = this.#E[
|
|
4060
|
+
return this.#E && (t.size = this.#E[p]), t;
|
|
4063
4061
|
}
|
|
4064
4062
|
/**
|
|
4065
4063
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
@@ -4076,17 +4074,17 @@ function Ki() {
|
|
|
4076
4074
|
*/
|
|
4077
4075
|
dump() {
|
|
4078
4076
|
const D = [];
|
|
4079
|
-
for (const
|
|
4080
|
-
const f = this.#i[
|
|
4077
|
+
for (const p of this.#A({ allowStale: !0 })) {
|
|
4078
|
+
const f = this.#i[p], A = this.#e[p], t = this.#r(A) ? A.__staleWhileFetching : A;
|
|
4081
4079
|
if (t === void 0 || f === void 0)
|
|
4082
4080
|
continue;
|
|
4083
4081
|
const c = { value: t };
|
|
4084
4082
|
if (this.#p && this.#F) {
|
|
4085
|
-
c.ttl = this.#p[
|
|
4086
|
-
const g = s.now() - this.#F[
|
|
4083
|
+
c.ttl = this.#p[p];
|
|
4084
|
+
const g = s.now() - this.#F[p];
|
|
4087
4085
|
c.start = Math.floor(Date.now() - g);
|
|
4088
4086
|
}
|
|
4089
|
-
this.#E && (c.size = this.#E[
|
|
4087
|
+
this.#E && (c.size = this.#E[p]), D.unshift([f, c]);
|
|
4090
4088
|
}
|
|
4091
4089
|
return D;
|
|
4092
4090
|
}
|
|
@@ -4101,12 +4099,12 @@ function Ki() {
|
|
|
4101
4099
|
*/
|
|
4102
4100
|
load(D) {
|
|
4103
4101
|
this.clear();
|
|
4104
|
-
for (const [
|
|
4102
|
+
for (const [p, f] of D) {
|
|
4105
4103
|
if (f.start) {
|
|
4106
4104
|
const A = Date.now() - f.start;
|
|
4107
4105
|
f.start = s.now() - A;
|
|
4108
4106
|
}
|
|
4109
|
-
this.set(
|
|
4107
|
+
this.set(p, f.value, f);
|
|
4110
4108
|
}
|
|
4111
4109
|
}
|
|
4112
4110
|
/**
|
|
@@ -4139,38 +4137,38 @@ function Ki() {
|
|
|
4139
4137
|
* If the value is `undefined`, then this is an alias for
|
|
4140
4138
|
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
|
4141
4139
|
*/
|
|
4142
|
-
set(D,
|
|
4143
|
-
if (
|
|
4140
|
+
set(D, p, f = {}) {
|
|
4141
|
+
if (p === void 0)
|
|
4144
4142
|
return this.delete(D), this;
|
|
4145
4143
|
const { ttl: A = this.ttl, start: t, noDisposeOnSet: c = this.noDisposeOnSet, sizeCalculation: g = this.sizeCalculation, status: u } = f;
|
|
4146
|
-
let { noUpdateTTL:
|
|
4147
|
-
const y = this.#T(D,
|
|
4144
|
+
let { noUpdateTTL: m = this.noUpdateTTL } = f;
|
|
4145
|
+
const y = this.#T(D, p, f.size || 0, g);
|
|
4148
4146
|
if (this.maxEntrySize && y > this.maxEntrySize)
|
|
4149
4147
|
return u && (u.set = "miss", u.maxEntrySizeExceeded = !0), this.#y(D, "set"), this;
|
|
4150
4148
|
let L = this.#u === 0 ? void 0 : this.#s.get(D);
|
|
4151
4149
|
if (L === void 0)
|
|
4152
|
-
L = this.#u === 0 ? this.#o : this.#C.length !== 0 ? this.#C.pop() : this.#u === this.#n ? this.#P(!1) : this.#u, this.#i[L] = D, this.#e[L] =
|
|
4150
|
+
L = this.#u === 0 ? this.#o : this.#C.length !== 0 ? this.#C.pop() : this.#u === this.#n ? this.#P(!1) : this.#u, this.#i[L] = D, this.#e[L] = p, this.#s.set(D, L), this.#h[this.#o] = L, this.#f[L] = this.#o, this.#o = L, this.#u++, this.#B(L, y, u), u && (u.set = "add"), m = !1;
|
|
4153
4151
|
else {
|
|
4154
4152
|
this.#_(L);
|
|
4155
4153
|
const O = this.#e[L];
|
|
4156
|
-
if (
|
|
4154
|
+
if (p !== O) {
|
|
4157
4155
|
if (this.#L && this.#r(O)) {
|
|
4158
4156
|
O.__abortController.abort(new Error("replaced"));
|
|
4159
|
-
const { __staleWhileFetching:
|
|
4160
|
-
|
|
4157
|
+
const { __staleWhileFetching: R } = O;
|
|
4158
|
+
R !== void 0 && !c && (this.#b && this.#t?.(R, D, "set"), this.#D && this.#a?.push([R, D, "set"]));
|
|
4161
4159
|
} else c || (this.#b && this.#t?.(O, D, "set"), this.#D && this.#a?.push([O, D, "set"]));
|
|
4162
|
-
if (this.#O(L), this.#B(L, y, u), this.#e[L] =
|
|
4160
|
+
if (this.#O(L), this.#B(L, y, u), this.#e[L] = p, u) {
|
|
4163
4161
|
u.set = "replace";
|
|
4164
|
-
const
|
|
4165
|
-
|
|
4162
|
+
const R = O && this.#r(O) ? O.__staleWhileFetching : O;
|
|
4163
|
+
R !== void 0 && (u.oldValue = R);
|
|
4166
4164
|
}
|
|
4167
4165
|
} else u && (u.set = "update");
|
|
4168
4166
|
}
|
|
4169
|
-
if (A !== 0 && !this.#p && this.#I(), this.#p && (
|
|
4167
|
+
if (A !== 0 && !this.#p && this.#I(), this.#p && (m || this.#N(L, A, t), u && this.#w(u, L)), !c && this.#D && this.#a) {
|
|
4170
4168
|
const O = this.#a;
|
|
4171
|
-
let
|
|
4172
|
-
for (;
|
|
4173
|
-
this.#m?.(
|
|
4169
|
+
let R;
|
|
4170
|
+
for (; R = O?.shift(); )
|
|
4171
|
+
this.#m?.(...R);
|
|
4174
4172
|
}
|
|
4175
4173
|
return this;
|
|
4176
4174
|
}
|
|
@@ -4191,15 +4189,15 @@ function Ki() {
|
|
|
4191
4189
|
} finally {
|
|
4192
4190
|
if (this.#D && this.#a) {
|
|
4193
4191
|
const D = this.#a;
|
|
4194
|
-
let
|
|
4195
|
-
for (;
|
|
4196
|
-
this.#m?.(...
|
|
4192
|
+
let p;
|
|
4193
|
+
for (; p = D?.shift(); )
|
|
4194
|
+
this.#m?.(...p);
|
|
4197
4195
|
}
|
|
4198
4196
|
}
|
|
4199
4197
|
}
|
|
4200
4198
|
#P(D) {
|
|
4201
|
-
const
|
|
4202
|
-
return this.#L && this.#r(A) ? A.__abortController.abort(new Error("evicted")) : (this.#b || this.#D) && (this.#b && this.#t?.(A, f, "evict"), this.#D && this.#a?.push([A, f, "evict"])), this.#O(
|
|
4199
|
+
const p = this.#c, f = this.#i[p], A = this.#e[p];
|
|
4200
|
+
return this.#L && this.#r(A) ? A.__abortController.abort(new Error("evicted")) : (this.#b || this.#D) && (this.#b && this.#t?.(A, f, "evict"), this.#D && this.#a?.push([A, f, "evict"])), this.#O(p), D && (this.#i[p] = void 0, this.#e[p] = void 0, this.#C.push(p)), this.#u === 1 ? (this.#c = this.#o = 0, this.#C.length = 0) : this.#c = this.#h[p], this.#s.delete(f), this.#u--, p;
|
|
4203
4201
|
}
|
|
4204
4202
|
/**
|
|
4205
4203
|
* Check if a key is in the cache, without updating the recency of use.
|
|
@@ -4217,8 +4215,8 @@ function Ki() {
|
|
|
4217
4215
|
* Will not update item age unless
|
|
4218
4216
|
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
4219
4217
|
*/
|
|
4220
|
-
has(D,
|
|
4221
|
-
const { updateAgeOnHas: f = this.updateAgeOnHas, status: A } =
|
|
4218
|
+
has(D, p = {}) {
|
|
4219
|
+
const { updateAgeOnHas: f = this.updateAgeOnHas, status: A } = p, t = this.#s.get(D);
|
|
4222
4220
|
if (t !== void 0) {
|
|
4223
4221
|
const c = this.#e[t];
|
|
4224
4222
|
if (this.#r(c) && c.__staleWhileFetching === void 0)
|
|
@@ -4236,15 +4234,15 @@ function Ki() {
|
|
|
4236
4234
|
* Returns `undefined` if the item is stale, unless
|
|
4237
4235
|
* {@link LRUCache.OptionsBase.allowStale} is set.
|
|
4238
4236
|
*/
|
|
4239
|
-
peek(D,
|
|
4240
|
-
const { allowStale: f = this.allowStale } =
|
|
4237
|
+
peek(D, p = {}) {
|
|
4238
|
+
const { allowStale: f = this.allowStale } = p, A = this.#s.get(D);
|
|
4241
4239
|
if (A === void 0 || !f && this.#d(A))
|
|
4242
4240
|
return;
|
|
4243
4241
|
const t = this.#e[A];
|
|
4244
4242
|
return this.#r(t) ? t.__staleWhileFetching : t;
|
|
4245
4243
|
}
|
|
4246
|
-
#R(D,
|
|
4247
|
-
const t =
|
|
4244
|
+
#R(D, p, f, A) {
|
|
4245
|
+
const t = p === void 0 ? void 0 : this.#e[p];
|
|
4248
4246
|
if (this.#r(t))
|
|
4249
4247
|
return t;
|
|
4250
4248
|
const c = new i(), { signal: g } = f;
|
|
@@ -4255,39 +4253,39 @@ function Ki() {
|
|
|
4255
4253
|
signal: c.signal,
|
|
4256
4254
|
options: f,
|
|
4257
4255
|
context: A
|
|
4258
|
-
},
|
|
4259
|
-
const { aborted:
|
|
4260
|
-
if (f.status && (
|
|
4256
|
+
}, m = (P, I = !1) => {
|
|
4257
|
+
const { aborted: N } = c.signal, Y = f.ignoreFetchAbort && P !== void 0;
|
|
4258
|
+
if (f.status && (N && !I ? (f.status.fetchAborted = !0, f.status.fetchError = c.signal.reason, Y && (f.status.fetchAbortIgnored = !0)) : f.status.fetchResolved = !0), N && !Y && !I)
|
|
4261
4259
|
return L(c.signal.reason);
|
|
4262
|
-
const
|
|
4263
|
-
return this.#e[
|
|
4264
|
-
}, y = (
|
|
4265
|
-
const { aborted:
|
|
4266
|
-
if (this.#e[
|
|
4267
|
-
return f.status &&
|
|
4268
|
-
if (
|
|
4269
|
-
throw
|
|
4270
|
-
}, O = (
|
|
4271
|
-
const
|
|
4272
|
-
|
|
4273
|
-
(!f.ignoreFetchAbort || f.allowStaleOnFetchAbort) && (
|
|
4260
|
+
const T = R;
|
|
4261
|
+
return this.#e[p] === R && (P === void 0 ? T.__staleWhileFetching ? this.#e[p] = T.__staleWhileFetching : this.#y(D, "fetch") : (f.status && (f.status.fetchUpdated = !0), this.set(D, P, u.options))), P;
|
|
4262
|
+
}, y = (P) => (f.status && (f.status.fetchRejected = !0, f.status.fetchError = P), L(P)), L = (P) => {
|
|
4263
|
+
const { aborted: I } = c.signal, N = I && f.allowStaleOnFetchAbort, Y = N || f.allowStaleOnFetchRejection, T = Y || f.noDeleteOnFetchRejection, W = R;
|
|
4264
|
+
if (this.#e[p] === R && (!T || W.__staleWhileFetching === void 0 ? this.#y(D, "fetch") : N || (this.#e[p] = W.__staleWhileFetching)), Y)
|
|
4265
|
+
return f.status && W.__staleWhileFetching !== void 0 && (f.status.returnedStale = !0), W.__staleWhileFetching;
|
|
4266
|
+
if (W.__returned === W)
|
|
4267
|
+
throw P;
|
|
4268
|
+
}, O = (P, I) => {
|
|
4269
|
+
const N = this.#x?.(D, t, u);
|
|
4270
|
+
N && N instanceof Promise && N.then((Y) => P(Y === void 0 ? void 0 : Y), I), c.signal.addEventListener("abort", () => {
|
|
4271
|
+
(!f.ignoreFetchAbort || f.allowStaleOnFetchAbort) && (P(void 0), f.allowStaleOnFetchAbort && (P = (Y) => m(Y, !0)));
|
|
4274
4272
|
});
|
|
4275
4273
|
};
|
|
4276
4274
|
f.status && (f.status.fetchDispatched = !0);
|
|
4277
|
-
const
|
|
4275
|
+
const R = new Promise(O).then(m, y), x = Object.assign(R, {
|
|
4278
4276
|
__abortController: c,
|
|
4279
4277
|
__staleWhileFetching: t,
|
|
4280
4278
|
__returned: void 0
|
|
4281
4279
|
});
|
|
4282
|
-
return
|
|
4280
|
+
return p === void 0 ? (this.set(D, x, { ...u.options, status: void 0 }), p = this.#s.get(D)) : this.#e[p] = x, x;
|
|
4283
4281
|
}
|
|
4284
4282
|
#r(D) {
|
|
4285
4283
|
if (!this.#L)
|
|
4286
4284
|
return !1;
|
|
4287
|
-
const
|
|
4288
|
-
return !!
|
|
4285
|
+
const p = D;
|
|
4286
|
+
return !!p && p instanceof Promise && p.hasOwnProperty("__staleWhileFetching") && p.__abortController instanceof i;
|
|
4289
4287
|
}
|
|
4290
|
-
async fetch(D,
|
|
4288
|
+
async fetch(D, p = {}) {
|
|
4291
4289
|
const {
|
|
4292
4290
|
// get options
|
|
4293
4291
|
allowStale: f = this.allowStale,
|
|
@@ -4297,70 +4295,70 @@ function Ki() {
|
|
|
4297
4295
|
ttl: c = this.ttl,
|
|
4298
4296
|
noDisposeOnSet: g = this.noDisposeOnSet,
|
|
4299
4297
|
size: u = 0,
|
|
4300
|
-
sizeCalculation:
|
|
4298
|
+
sizeCalculation: m = this.sizeCalculation,
|
|
4301
4299
|
noUpdateTTL: y = this.noUpdateTTL,
|
|
4302
4300
|
// fetch exclusive options
|
|
4303
4301
|
noDeleteOnFetchRejection: L = this.noDeleteOnFetchRejection,
|
|
4304
4302
|
allowStaleOnFetchRejection: O = this.allowStaleOnFetchRejection,
|
|
4305
|
-
ignoreFetchAbort:
|
|
4306
|
-
allowStaleOnFetchAbort:
|
|
4307
|
-
context:
|
|
4308
|
-
forceRefresh:
|
|
4309
|
-
status:
|
|
4303
|
+
ignoreFetchAbort: R = this.ignoreFetchAbort,
|
|
4304
|
+
allowStaleOnFetchAbort: x = this.allowStaleOnFetchAbort,
|
|
4305
|
+
context: P,
|
|
4306
|
+
forceRefresh: I = !1,
|
|
4307
|
+
status: N,
|
|
4310
4308
|
signal: Y
|
|
4311
|
-
} =
|
|
4309
|
+
} = p;
|
|
4312
4310
|
if (!this.#L)
|
|
4313
|
-
return
|
|
4311
|
+
return N && (N.fetch = "get"), this.get(D, {
|
|
4314
4312
|
allowStale: f,
|
|
4315
4313
|
updateAgeOnGet: A,
|
|
4316
4314
|
noDeleteOnStaleGet: t,
|
|
4317
|
-
status:
|
|
4315
|
+
status: N
|
|
4318
4316
|
});
|
|
4319
|
-
const
|
|
4317
|
+
const T = {
|
|
4320
4318
|
allowStale: f,
|
|
4321
4319
|
updateAgeOnGet: A,
|
|
4322
4320
|
noDeleteOnStaleGet: t,
|
|
4323
4321
|
ttl: c,
|
|
4324
4322
|
noDisposeOnSet: g,
|
|
4325
4323
|
size: u,
|
|
4326
|
-
sizeCalculation:
|
|
4324
|
+
sizeCalculation: m,
|
|
4327
4325
|
noUpdateTTL: y,
|
|
4328
4326
|
noDeleteOnFetchRejection: L,
|
|
4329
4327
|
allowStaleOnFetchRejection: O,
|
|
4330
|
-
allowStaleOnFetchAbort:
|
|
4331
|
-
ignoreFetchAbort:
|
|
4332
|
-
status:
|
|
4328
|
+
allowStaleOnFetchAbort: x,
|
|
4329
|
+
ignoreFetchAbort: R,
|
|
4330
|
+
status: N,
|
|
4333
4331
|
signal: Y
|
|
4334
4332
|
};
|
|
4335
|
-
let
|
|
4336
|
-
if (
|
|
4337
|
-
|
|
4338
|
-
const
|
|
4339
|
-
return
|
|
4333
|
+
let W = this.#s.get(D);
|
|
4334
|
+
if (W === void 0) {
|
|
4335
|
+
N && (N.fetch = "miss");
|
|
4336
|
+
const k = this.#R(D, W, T, P);
|
|
4337
|
+
return k.__returned = k;
|
|
4340
4338
|
} else {
|
|
4341
|
-
const
|
|
4342
|
-
if (this.#r(
|
|
4343
|
-
const Fe = f &&
|
|
4344
|
-
return
|
|
4339
|
+
const k = this.#e[W];
|
|
4340
|
+
if (this.#r(k)) {
|
|
4341
|
+
const Fe = f && k.__staleWhileFetching !== void 0;
|
|
4342
|
+
return N && (N.fetch = "inflight", Fe && (N.returnedStale = !0)), Fe ? k.__staleWhileFetching : k.__returned = k;
|
|
4345
4343
|
}
|
|
4346
|
-
const fe = this.#d(
|
|
4347
|
-
if (!
|
|
4348
|
-
return
|
|
4349
|
-
const ae = this.#R(D,
|
|
4350
|
-
return
|
|
4344
|
+
const fe = this.#d(W);
|
|
4345
|
+
if (!I && !fe)
|
|
4346
|
+
return N && (N.fetch = "hit"), this.#_(W), A && this.#S(W), N && this.#w(N, W), k;
|
|
4347
|
+
const ae = this.#R(D, W, T, P), ce = ae.__staleWhileFetching !== void 0 && f;
|
|
4348
|
+
return N && (N.fetch = fe ? "stale" : "refresh", ce && fe && (N.returnedStale = !0)), ce ? ae.__staleWhileFetching : ae.__returned = ae;
|
|
4351
4349
|
}
|
|
4352
4350
|
}
|
|
4353
|
-
async forceFetch(D,
|
|
4354
|
-
const f = await this.fetch(D,
|
|
4351
|
+
async forceFetch(D, p = {}) {
|
|
4352
|
+
const f = await this.fetch(D, p);
|
|
4355
4353
|
if (f === void 0)
|
|
4356
4354
|
throw new Error("fetch() returned undefined");
|
|
4357
4355
|
return f;
|
|
4358
4356
|
}
|
|
4359
|
-
memo(D,
|
|
4357
|
+
memo(D, p = {}) {
|
|
4360
4358
|
const f = this.#$;
|
|
4361
4359
|
if (!f)
|
|
4362
4360
|
throw new Error("no memoMethod provided to constructor");
|
|
4363
|
-
const { context: A, forceRefresh: t, ...c } =
|
|
4361
|
+
const { context: A, forceRefresh: t, ...c } = p, g = this.get(D, c);
|
|
4364
4362
|
if (!t && g !== void 0)
|
|
4365
4363
|
return g;
|
|
4366
4364
|
const u = f(D, g, {
|
|
@@ -4375,15 +4373,15 @@ function Ki() {
|
|
|
4375
4373
|
*
|
|
4376
4374
|
* If the key is not found, get() will return `undefined`.
|
|
4377
4375
|
*/
|
|
4378
|
-
get(D,
|
|
4379
|
-
const { allowStale: f = this.allowStale, updateAgeOnGet: A = this.updateAgeOnGet, noDeleteOnStaleGet: t = this.noDeleteOnStaleGet, status: c } =
|
|
4376
|
+
get(D, p = {}) {
|
|
4377
|
+
const { allowStale: f = this.allowStale, updateAgeOnGet: A = this.updateAgeOnGet, noDeleteOnStaleGet: t = this.noDeleteOnStaleGet, status: c } = p, g = this.#s.get(D);
|
|
4380
4378
|
if (g !== void 0) {
|
|
4381
|
-
const u = this.#e[g],
|
|
4382
|
-
return c && this.#w(c, g), this.#d(g) ? (c && (c.get = "stale"),
|
|
4379
|
+
const u = this.#e[g], m = this.#r(u);
|
|
4380
|
+
return c && this.#w(c, g), this.#d(g) ? (c && (c.get = "stale"), m ? (c && f && u.__staleWhileFetching !== void 0 && (c.returnedStale = !0), f ? u.__staleWhileFetching : void 0) : (t || this.#y(D, "expire"), c && f && (c.returnedStale = !0), f ? u : void 0)) : (c && (c.get = "hit"), m ? u.__staleWhileFetching : (this.#_(g), A && this.#S(g), u));
|
|
4383
4381
|
} else c && (c.get = "miss");
|
|
4384
4382
|
}
|
|
4385
|
-
#G(D,
|
|
4386
|
-
this.#f[
|
|
4383
|
+
#G(D, p) {
|
|
4384
|
+
this.#f[p] = D, this.#h[D] = p;
|
|
4387
4385
|
}
|
|
4388
4386
|
#_(D) {
|
|
4389
4387
|
D !== this.#o && (D === this.#c ? this.#c = this.#h[D] : this.#G(this.#f[D], this.#h[D]), this.#G(this.#o, D), this.#o = D);
|
|
@@ -4396,17 +4394,17 @@ function Ki() {
|
|
|
4396
4394
|
delete(D) {
|
|
4397
4395
|
return this.#y(D, "delete");
|
|
4398
4396
|
}
|
|
4399
|
-
#y(D,
|
|
4397
|
+
#y(D, p) {
|
|
4400
4398
|
let f = !1;
|
|
4401
4399
|
if (this.#u !== 0) {
|
|
4402
4400
|
const A = this.#s.get(D);
|
|
4403
4401
|
if (A !== void 0)
|
|
4404
4402
|
if (f = !0, this.#u === 1)
|
|
4405
|
-
this.#k(
|
|
4403
|
+
this.#k(p);
|
|
4406
4404
|
else {
|
|
4407
4405
|
this.#O(A);
|
|
4408
4406
|
const t = this.#e[A];
|
|
4409
|
-
if (this.#r(t) ? t.__abortController.abort(new Error("deleted")) : (this.#b || this.#D) && (this.#b && this.#t?.(t, D,
|
|
4407
|
+
if (this.#r(t) ? t.__abortController.abort(new Error("deleted")) : (this.#b || this.#D) && (this.#b && this.#t?.(t, D, p), this.#D && this.#a?.push([t, D, p])), this.#s.delete(D), this.#i[A] = void 0, this.#e[A] = void 0, A === this.#o)
|
|
4410
4408
|
this.#o = this.#f[A];
|
|
4411
4409
|
else if (A === this.#c)
|
|
4412
4410
|
this.#c = this.#h[A];
|
|
@@ -4434,19 +4432,19 @@ function Ki() {
|
|
|
4434
4432
|
return this.#k("delete");
|
|
4435
4433
|
}
|
|
4436
4434
|
#k(D) {
|
|
4437
|
-
for (const
|
|
4438
|
-
const f = this.#e[
|
|
4435
|
+
for (const p of this.#v({ allowStale: !0 })) {
|
|
4436
|
+
const f = this.#e[p];
|
|
4439
4437
|
if (this.#r(f))
|
|
4440
4438
|
f.__abortController.abort(new Error("deleted"));
|
|
4441
4439
|
else {
|
|
4442
|
-
const A = this.#i[
|
|
4440
|
+
const A = this.#i[p];
|
|
4443
4441
|
this.#b && this.#t?.(f, A, D), this.#D && this.#a?.push([f, A, D]);
|
|
4444
4442
|
}
|
|
4445
4443
|
}
|
|
4446
4444
|
if (this.#s.clear(), this.#e.fill(void 0), this.#i.fill(void 0), this.#p && this.#F && (this.#p.fill(0), this.#F.fill(0)), this.#E && this.#E.fill(0), this.#c = 0, this.#o = 0, this.#C.length = 0, this.#g = 0, this.#u = 0, this.#D && this.#a) {
|
|
4447
|
-
const
|
|
4445
|
+
const p = this.#a;
|
|
4448
4446
|
let f;
|
|
4449
|
-
for (; f =
|
|
4447
|
+
for (; f = p?.shift(); )
|
|
4450
4448
|
this.#m?.(...f);
|
|
4451
4449
|
}
|
|
4452
4450
|
}
|
|
@@ -4460,10 +4458,10 @@ function Ji() {
|
|
|
4460
4458
|
const s = (...r) => r.every((e) => e) ? r.join("") : "", n = (r) => r ? encodeURIComponent(r) : "", o = (r) => r.toLowerCase().replace(/^\W+/g, "").replace(/(?<!\W)\W+$/, "").replace(/\//g, "").replace(/\W+/g, "-"), h = {
|
|
4461
4459
|
sshtemplate: ({ domain: r, user: e, project: a, committish: l }) => `git@${r}:${e}/${a}.git${s("#", l)}`,
|
|
4462
4460
|
sshurltemplate: ({ domain: r, user: e, project: a, committish: l }) => `git+ssh://git@${r}/${e}/${a}.git${s("#", l)}`,
|
|
4463
|
-
edittemplate: ({ domain: r, user: e, project: a, committish: l, editpath: C, path:
|
|
4461
|
+
edittemplate: ({ domain: r, user: e, project: a, committish: l, editpath: C, path: d }) => `https://${r}/${e}/${a}${s("/", C, "/", n(l || "HEAD"), "/", d)}`,
|
|
4464
4462
|
browsetemplate: ({ domain: r, user: e, project: a, committish: l, treepath: C }) => `https://${r}/${e}/${a}${s("/", C, "/", n(l))}`,
|
|
4465
|
-
browsetreetemplate: ({ domain: r, user: e, project: a, committish: l, treepath: C, path:
|
|
4466
|
-
browseblobtemplate: ({ domain: r, user: e, project: a, committish: l, blobpath: C, path:
|
|
4463
|
+
browsetreetemplate: ({ domain: r, user: e, project: a, committish: l, treepath: C, path: d, fragment: v, hashformat: w }) => `https://${r}/${e}/${a}/${C}/${n(l || "HEAD")}/${d}${s("#", w(v || ""))}`,
|
|
4464
|
+
browseblobtemplate: ({ domain: r, user: e, project: a, committish: l, blobpath: C, path: d, fragment: v, hashformat: w }) => `https://${r}/${e}/${a}/${C}/${n(l || "HEAD")}/${d}${s("#", w(v || ""))}`,
|
|
4467
4465
|
docstemplate: ({ domain: r, user: e, project: a, treepath: l, committish: C }) => `https://${r}/${e}/${a}${s("/", l, "/", n(C))}#readme`,
|
|
4468
4466
|
httpstemplate: ({ auth: r, domain: e, user: a, project: l, committish: C }) => `git+https://${s(r, "@")}${e}/${a}/${l}.git${s("#", C)}`,
|
|
4469
4467
|
filetemplate: ({ domain: r, user: e, project: a, committish: l, path: C }) => `https://${r}/${e}/${a}/raw/${n(l || "HEAD")}/${C}`,
|
|
@@ -4494,7 +4492,7 @@ function Ji() {
|
|
|
4494
4492
|
treepath: "src",
|
|
4495
4493
|
blobpath: "src",
|
|
4496
4494
|
editpath: "?mode=edit",
|
|
4497
|
-
edittemplate: ({ domain: r, user: e, project: a, committish: l, treepath: C, path:
|
|
4495
|
+
edittemplate: ({ domain: r, user: e, project: a, committish: l, treepath: C, path: d, editpath: v }) => `https://${r}/${e}/${a}${s("/", C, "/", n(l || "HEAD"), "/", d, v)}`,
|
|
4498
4496
|
tarballtemplate: ({ domain: r, user: e, project: a, committish: l }) => `https://${r}/${e}/${a}/get/${n(l || "HEAD")}.tar.gz`,
|
|
4499
4497
|
extract: (r) => {
|
|
4500
4498
|
let [, e, a, l] = r.pathname.split("/", 4);
|
|
@@ -4603,8 +4601,8 @@ function Zi() {
|
|
|
4603
4601
|
if (sr) return at;
|
|
4604
4602
|
sr = 1;
|
|
4605
4603
|
const s = qr(), n = (o) => {
|
|
4606
|
-
const h = o.indexOf("#"), i = o.indexOf("/"), r = o.indexOf("/", i + 1), e = o.indexOf(":"), a = /\s/.exec(o), l = o.indexOf("@"), C = !a || h > -1 && a.index > h,
|
|
4607
|
-
return C && D &&
|
|
4604
|
+
const h = o.indexOf("#"), i = o.indexOf("/"), r = o.indexOf("/", i + 1), e = o.indexOf(":"), a = /\s/.exec(o), l = o.indexOf("@"), C = !a || h > -1 && a.index > h, d = l === -1 || h > -1 && l > h, v = e === -1 || h > -1 && e > h, w = r === -1 || h > -1 && r > h, D = i > 0, p = h > -1 ? o[h - 1] !== "/" : !o.endsWith("/"), f = !o.startsWith(".");
|
|
4605
|
+
return C && D && p && f && d && v && w;
|
|
4608
4606
|
};
|
|
4609
4607
|
return at = (o, h, { gitHosts: i, protocols: r }) => {
|
|
4610
4608
|
if (!o)
|
|
@@ -4612,34 +4610,34 @@ function Zi() {
|
|
|
4612
4610
|
const e = n(o) ? `github:${o}` : o, a = s(e, r);
|
|
4613
4611
|
if (!a)
|
|
4614
4612
|
return;
|
|
4615
|
-
const l = i.byShortcut[a.protocol], C = i.byDomain[a.hostname.startsWith("www.") ? a.hostname.slice(4) : a.hostname],
|
|
4616
|
-
if (!
|
|
4613
|
+
const l = i.byShortcut[a.protocol], C = i.byDomain[a.hostname.startsWith("www.") ? a.hostname.slice(4) : a.hostname], d = l || C;
|
|
4614
|
+
if (!d)
|
|
4617
4615
|
return;
|
|
4618
4616
|
const v = i[l || C];
|
|
4619
4617
|
let w = null;
|
|
4620
4618
|
r[a.protocol]?.auth && (a.username || a.password) && (w = `${a.username}${a.password ? ":" + a.password : ""}`);
|
|
4621
|
-
let D = null,
|
|
4619
|
+
let D = null, p = null, f = null, A = null;
|
|
4622
4620
|
try {
|
|
4623
4621
|
if (l) {
|
|
4624
4622
|
let t = a.pathname.startsWith("/") ? a.pathname.slice(1) : a.pathname;
|
|
4625
4623
|
const c = t.indexOf("@");
|
|
4626
4624
|
c > -1 && (t = t.slice(c + 1));
|
|
4627
4625
|
const g = t.lastIndexOf("/");
|
|
4628
|
-
g > -1 ? (
|
|
4626
|
+
g > -1 ? (p = decodeURIComponent(t.slice(0, g)), p || (p = null), f = decodeURIComponent(t.slice(g + 1))) : f = decodeURIComponent(t), f.endsWith(".git") && (f = f.slice(0, -4)), a.hash && (D = decodeURIComponent(a.hash.slice(1))), A = "shortcut";
|
|
4629
4627
|
} else {
|
|
4630
4628
|
if (!v.protocols.includes(a.protocol))
|
|
4631
4629
|
return;
|
|
4632
4630
|
const t = v.extract(a);
|
|
4633
4631
|
if (!t)
|
|
4634
4632
|
return;
|
|
4635
|
-
|
|
4633
|
+
p = t.user && decodeURIComponent(t.user), f = decodeURIComponent(t.project), D = decodeURIComponent(t.committish), A = r[a.protocol]?.name || a.protocol.slice(0, -1);
|
|
4636
4634
|
}
|
|
4637
4635
|
} catch (t) {
|
|
4638
4636
|
if (t instanceof URIError)
|
|
4639
4637
|
return;
|
|
4640
4638
|
throw t;
|
|
4641
4639
|
}
|
|
4642
|
-
return [
|
|
4640
|
+
return [d, p, w, f, D, A, h];
|
|
4643
4641
|
}, at;
|
|
4644
4642
|
}
|
|
4645
4643
|
var lt, ur;
|
|
@@ -4652,26 +4650,26 @@ function Qi() {
|
|
|
4652
4650
|
const {
|
|
4653
4651
|
protocol: l,
|
|
4654
4652
|
hostname: C,
|
|
4655
|
-
pathname:
|
|
4653
|
+
pathname: d
|
|
4656
4654
|
} = new URL(a);
|
|
4657
4655
|
if (!C)
|
|
4658
4656
|
return null;
|
|
4659
|
-
const v = /(?:git\+)http:$/.test(l) ? "http:" : "https:", w =
|
|
4657
|
+
const v = /(?:git\+)http:$/.test(l) ? "http:" : "https:", w = d.replace(/\.git$/, "");
|
|
4660
4658
|
return `${v}//${C}${w}`;
|
|
4661
4659
|
} catch {
|
|
4662
4660
|
return null;
|
|
4663
4661
|
}
|
|
4664
4662
|
}
|
|
4665
4663
|
class e {
|
|
4666
|
-
constructor(l, C,
|
|
4664
|
+
constructor(l, C, d, v, w, D, p = {}) {
|
|
4667
4665
|
Object.assign(this, e.#n[l], {
|
|
4668
4666
|
type: l,
|
|
4669
4667
|
user: C,
|
|
4670
|
-
auth:
|
|
4668
|
+
auth: d,
|
|
4671
4669
|
project: v,
|
|
4672
4670
|
committish: w,
|
|
4673
4671
|
default: D,
|
|
4674
|
-
opts:
|
|
4672
|
+
opts: p
|
|
4675
4673
|
});
|
|
4676
4674
|
}
|
|
4677
4675
|
static #n = { byShortcut: {}, byDomain: {} };
|
|
@@ -4690,20 +4688,20 @@ function Qi() {
|
|
|
4690
4688
|
static fromUrl(l, C) {
|
|
4691
4689
|
if (typeof l != "string")
|
|
4692
4690
|
return;
|
|
4693
|
-
const
|
|
4694
|
-
if (!i.has(
|
|
4691
|
+
const d = l + JSON.stringify(C || {});
|
|
4692
|
+
if (!i.has(d)) {
|
|
4695
4693
|
const v = o(l, C, {
|
|
4696
4694
|
gitHosts: e.#n,
|
|
4697
4695
|
protocols: e.#l
|
|
4698
4696
|
});
|
|
4699
|
-
i.set(
|
|
4697
|
+
i.set(d, v ? new e(...v) : void 0);
|
|
4700
4698
|
}
|
|
4701
|
-
return i.get(
|
|
4699
|
+
return i.get(d);
|
|
4702
4700
|
}
|
|
4703
4701
|
static fromManifest(l, C = {}) {
|
|
4704
4702
|
if (!l || typeof l != "object")
|
|
4705
4703
|
return;
|
|
4706
|
-
const
|
|
4704
|
+
const d = l.repository, v = d && (typeof d == "string" ? d : typeof d == "object" && typeof d.url == "string" ? d.url : null);
|
|
4707
4705
|
if (!v)
|
|
4708
4706
|
throw new Error("no repository");
|
|
4709
4707
|
const w = v && e.fromUrl(v.replace(/^git\+/, ""), C) || null;
|
|
@@ -4718,10 +4716,10 @@ function Qi() {
|
|
|
4718
4716
|
#t(l, C) {
|
|
4719
4717
|
if (typeof l != "function")
|
|
4720
4718
|
return null;
|
|
4721
|
-
const
|
|
4722
|
-
|
|
4723
|
-
const v = l(
|
|
4724
|
-
return
|
|
4719
|
+
const d = { ...this, ...this.opts, ...C };
|
|
4720
|
+
d.path || (d.path = ""), d.path.startsWith("/") && (d.path = d.path.slice(1)), d.noCommittish && (d.committish = null);
|
|
4721
|
+
const v = l(d);
|
|
4722
|
+
return d.noGitPlus && v.startsWith("git+") ? v.slice(4) : v;
|
|
4725
4723
|
}
|
|
4726
4724
|
hash() {
|
|
4727
4725
|
return this.committish ? `#${this.committish}` : "";
|
|
@@ -4822,16 +4820,16 @@ function un() {
|
|
|
4822
4820
|
type: "git",
|
|
4823
4821
|
url: u.repository
|
|
4824
4822
|
});
|
|
4825
|
-
var
|
|
4826
|
-
if (
|
|
4827
|
-
var y = h.fromUrl(
|
|
4828
|
-
y && (
|
|
4823
|
+
var m = u.repository.url || "";
|
|
4824
|
+
if (m) {
|
|
4825
|
+
var y = h.fromUrl(m);
|
|
4826
|
+
y && (m = u.repository.url = y.getDefaultRepresentation() === "shortcut" ? y.https() : y.toString());
|
|
4829
4827
|
}
|
|
4830
|
-
|
|
4828
|
+
m.match(/github.com\/[^/]+\/[^/]+\.git\.git$/) && this.warn("brokenGitUrl", m);
|
|
4831
4829
|
},
|
|
4832
4830
|
fixTypos: function(u) {
|
|
4833
|
-
Object.keys(l.topLevel).forEach(function(
|
|
4834
|
-
Object.prototype.hasOwnProperty.call(u,
|
|
4831
|
+
Object.keys(l.topLevel).forEach(function(m) {
|
|
4832
|
+
Object.prototype.hasOwnProperty.call(u, m) && this.warn("typo", m, l.topLevel[m]);
|
|
4835
4833
|
}, this);
|
|
4836
4834
|
},
|
|
4837
4835
|
fixScriptsField: function(u) {
|
|
@@ -4840,44 +4838,44 @@ function un() {
|
|
|
4840
4838
|
this.warn("nonObjectScripts"), delete u.scripts;
|
|
4841
4839
|
return;
|
|
4842
4840
|
}
|
|
4843
|
-
Object.keys(u.scripts).forEach(function(
|
|
4844
|
-
typeof u.scripts[
|
|
4841
|
+
Object.keys(u.scripts).forEach(function(m) {
|
|
4842
|
+
typeof u.scripts[m] != "string" ? (this.warn("nonStringScript"), delete u.scripts[m]) : l.script[m] && !u.scripts[l.script[m]] && this.warn("typo", m, l.script[m], "scripts");
|
|
4845
4843
|
}, this);
|
|
4846
4844
|
}
|
|
4847
4845
|
},
|
|
4848
4846
|
fixFilesField: function(u) {
|
|
4849
|
-
var
|
|
4850
|
-
|
|
4847
|
+
var m = u.files;
|
|
4848
|
+
m && !Array.isArray(m) ? (this.warn("nonArrayFiles"), delete u.files) : u.files && (u.files = u.files.filter(function(y) {
|
|
4851
4849
|
return !y || typeof y != "string" ? (this.warn("invalidFilename", y), !1) : !0;
|
|
4852
4850
|
}, this));
|
|
4853
4851
|
},
|
|
4854
4852
|
fixBinField: function(u) {
|
|
4855
4853
|
if (u.bin && typeof u.bin == "string") {
|
|
4856
|
-
var
|
|
4857
|
-
(y = u.name.match(/^@[^/]+[/](.*)$/)) ?
|
|
4854
|
+
var m = {}, y;
|
|
4855
|
+
(y = u.name.match(/^@[^/]+[/](.*)$/)) ? m[y[1]] = u.bin : m[u.name] = u.bin, u.bin = m;
|
|
4858
4856
|
}
|
|
4859
4857
|
},
|
|
4860
4858
|
fixManField: function(u) {
|
|
4861
4859
|
u.man && typeof u.man == "string" && (u.man = [u.man]);
|
|
4862
4860
|
},
|
|
4863
4861
|
fixBundleDependenciesField: function(u) {
|
|
4864
|
-
var
|
|
4865
|
-
u[
|
|
4862
|
+
var m = "bundledDependencies", y = "bundleDependencies";
|
|
4863
|
+
u[m] && !u[y] && (u[y] = u[m], delete u[m]), u[y] && !Array.isArray(u[y]) ? (this.warn("nonArrayBundleDependencies"), delete u[y]) : u[y] && (u[y] = u[y].filter(function(L) {
|
|
4866
4864
|
return !L || typeof L != "string" ? (this.warn("nonStringBundleDependency", L), !1) : (u.dependencies || (u.dependencies = {}), Object.prototype.hasOwnProperty.call(u.dependencies, L) || (this.warn("nonDependencyBundleDependency", L), u.dependencies[L] = "*"), !0);
|
|
4867
4865
|
}, this));
|
|
4868
4866
|
},
|
|
4869
4867
|
fixDependencies: function(u) {
|
|
4870
|
-
c(u, this.warn), A(u, this.warn), this.fixBundleDependenciesField(u), ["dependencies", "devDependencies"].forEach(function(
|
|
4871
|
-
if (
|
|
4872
|
-
if (!u[
|
|
4873
|
-
this.warn("nonObjectDependencies",
|
|
4868
|
+
c(u, this.warn), A(u, this.warn), this.fixBundleDependenciesField(u), ["dependencies", "devDependencies"].forEach(function(m) {
|
|
4869
|
+
if (m in u) {
|
|
4870
|
+
if (!u[m] || typeof u[m] != "object") {
|
|
4871
|
+
this.warn("nonObjectDependencies", m), delete u[m];
|
|
4874
4872
|
return;
|
|
4875
4873
|
}
|
|
4876
|
-
Object.keys(u[
|
|
4877
|
-
var L = u[
|
|
4878
|
-
typeof L != "string" && (this.warn("nonStringDependency", y, JSON.stringify(L)), delete u[
|
|
4879
|
-
var O = h.fromUrl(u[
|
|
4880
|
-
O && (u[
|
|
4874
|
+
Object.keys(u[m]).forEach(function(y) {
|
|
4875
|
+
var L = u[m][y];
|
|
4876
|
+
typeof L != "string" && (this.warn("nonStringDependency", y, JSON.stringify(L)), delete u[m][y]);
|
|
4877
|
+
var O = h.fromUrl(u[m][y]);
|
|
4878
|
+
O && (u[m][y] = O.toString());
|
|
4881
4879
|
}, this);
|
|
4882
4880
|
}
|
|
4883
4881
|
}, this);
|
|
@@ -4886,12 +4884,12 @@ function un() {
|
|
|
4886
4884
|
u.modules && (this.warn("deprecatedModules"), delete u.modules);
|
|
4887
4885
|
},
|
|
4888
4886
|
fixKeywordsField: function(u) {
|
|
4889
|
-
typeof u.keywords == "string" && (u.keywords = u.keywords.split(/,\s+/)), u.keywords && !Array.isArray(u.keywords) ? (delete u.keywords, this.warn("nonArrayKeywords")) : u.keywords && (u.keywords = u.keywords.filter(function(
|
|
4890
|
-
return typeof
|
|
4887
|
+
typeof u.keywords == "string" && (u.keywords = u.keywords.split(/,\s+/)), u.keywords && !Array.isArray(u.keywords) ? (delete u.keywords, this.warn("nonArrayKeywords")) : u.keywords && (u.keywords = u.keywords.filter(function(m) {
|
|
4888
|
+
return typeof m != "string" || !m ? (this.warn("nonStringKeyword"), !1) : !0;
|
|
4891
4889
|
}, this));
|
|
4892
4890
|
},
|
|
4893
|
-
fixVersionField: function(u,
|
|
4894
|
-
var y = !
|
|
4891
|
+
fixVersionField: function(u, m) {
|
|
4892
|
+
var y = !m;
|
|
4895
4893
|
if (!u.version)
|
|
4896
4894
|
return u.version = "", !0;
|
|
4897
4895
|
if (!s(u.version, y))
|
|
@@ -4899,18 +4897,18 @@ function un() {
|
|
|
4899
4897
|
return u.version = n(u.version, y), !0;
|
|
4900
4898
|
},
|
|
4901
4899
|
fixPeople: function(u) {
|
|
4902
|
-
D(u,
|
|
4900
|
+
D(u, p), D(u, f);
|
|
4903
4901
|
},
|
|
4904
|
-
fixNameField: function(u,
|
|
4905
|
-
typeof
|
|
4906
|
-
var y =
|
|
4902
|
+
fixNameField: function(u, m) {
|
|
4903
|
+
typeof m == "boolean" ? m = { strict: m } : typeof m > "u" && (m = {});
|
|
4904
|
+
var y = m.strict;
|
|
4907
4905
|
if (!u.name && !y) {
|
|
4908
4906
|
u.name = "";
|
|
4909
4907
|
return;
|
|
4910
4908
|
}
|
|
4911
4909
|
if (typeof u.name != "string")
|
|
4912
4910
|
throw new Error("name field must be a string.");
|
|
4913
|
-
y || (u.name = u.name.trim()), w(u.name, y,
|
|
4911
|
+
y || (u.name = u.name.trim()), w(u.name, y, m.allowLegacyCase), i.builtinModules.includes(u.name) && this.warn("conflictingName", u.name);
|
|
4914
4912
|
},
|
|
4915
4913
|
fixDescriptionField: function(u) {
|
|
4916
4914
|
u.description && typeof u.description != "string" && (this.warn("nonStringDescription"), delete u.description), u.readme && !u.description && (u.description = e(u.readme)), u.description === void 0 && delete u.description, u.description || this.warn("missingDescription");
|
|
@@ -4920,8 +4918,8 @@ function un() {
|
|
|
4920
4918
|
},
|
|
4921
4919
|
fixBugsField: function(u) {
|
|
4922
4920
|
if (!u.bugs && u.repository && u.repository.url) {
|
|
4923
|
-
var
|
|
4924
|
-
|
|
4921
|
+
var m = h.fromUrl(u.repository.url);
|
|
4922
|
+
m && m.bugs() && (u.bugs = { url: m.bugs() });
|
|
4925
4923
|
} else if (u.bugs) {
|
|
4926
4924
|
if (typeof u.bugs == "string")
|
|
4927
4925
|
C(u.bugs) ? u.bugs = { email: u.bugs } : a.parse(u.bugs).protocol ? u.bugs = { url: u.bugs } : this.warn("nonEmailUrlBugsString");
|
|
@@ -4935,8 +4933,8 @@ function un() {
|
|
|
4935
4933
|
},
|
|
4936
4934
|
fixHomepageField: function(u) {
|
|
4937
4935
|
if (!u.homepage && u.repository && u.repository.url) {
|
|
4938
|
-
var
|
|
4939
|
-
|
|
4936
|
+
var m = h.fromUrl(u.repository.url);
|
|
4937
|
+
m && m.docs() && (u.homepage = m.docs());
|
|
4940
4938
|
}
|
|
4941
4939
|
if (u.homepage) {
|
|
4942
4940
|
if (typeof u.homepage != "string")
|
|
@@ -4945,77 +4943,77 @@ function un() {
|
|
|
4945
4943
|
}
|
|
4946
4944
|
},
|
|
4947
4945
|
fixLicenseField: function(u) {
|
|
4948
|
-
const
|
|
4949
|
-
if (!
|
|
4946
|
+
const m = u.license || u.licence;
|
|
4947
|
+
if (!m)
|
|
4950
4948
|
return this.warn("missingLicense");
|
|
4951
|
-
if (typeof
|
|
4949
|
+
if (typeof m != "string" || m.length < 1 || m.trim() === "")
|
|
4952
4950
|
return this.warn("invalidLicense");
|
|
4953
|
-
if (!o(
|
|
4951
|
+
if (!o(m).validForNewPackages)
|
|
4954
4952
|
return this.warn("invalidLicense");
|
|
4955
4953
|
}
|
|
4956
4954
|
};
|
|
4957
|
-
function
|
|
4955
|
+
function d(u) {
|
|
4958
4956
|
if (u.charAt(0) !== "@")
|
|
4959
4957
|
return !1;
|
|
4960
|
-
var
|
|
4961
|
-
return
|
|
4958
|
+
var m = u.slice(1).split("/");
|
|
4959
|
+
return m.length !== 2 ? !1 : m[0] && m[1] && m[0] === encodeURIComponent(m[0]) && m[1] === encodeURIComponent(m[1]);
|
|
4962
4960
|
}
|
|
4963
4961
|
function v(u) {
|
|
4964
4962
|
return !u.match(/[/@\s+%:]/) && u === encodeURIComponent(u);
|
|
4965
4963
|
}
|
|
4966
|
-
function w(u,
|
|
4967
|
-
if (u.charAt(0) === "." || !(
|
|
4964
|
+
function w(u, m, y) {
|
|
4965
|
+
if (u.charAt(0) === "." || !(d(u) || v(u)) || m && !y && u !== u.toLowerCase() || u.toLowerCase() === "node_modules" || u.toLowerCase() === "favicon.ico")
|
|
4968
4966
|
throw new Error("Invalid name: " + JSON.stringify(u));
|
|
4969
4967
|
}
|
|
4970
|
-
function D(u,
|
|
4971
|
-
return u.author && (u.author =
|
|
4972
|
-
Array.isArray(u[y]) && (u[y] = u[y].map(
|
|
4968
|
+
function D(u, m) {
|
|
4969
|
+
return u.author && (u.author = m(u.author)), ["maintainers", "contributors"].forEach(function(y) {
|
|
4970
|
+
Array.isArray(u[y]) && (u[y] = u[y].map(m));
|
|
4973
4971
|
}), u;
|
|
4974
4972
|
}
|
|
4975
|
-
function
|
|
4973
|
+
function p(u) {
|
|
4976
4974
|
if (typeof u == "string")
|
|
4977
4975
|
return u;
|
|
4978
|
-
var
|
|
4979
|
-
return
|
|
4976
|
+
var m = u.name || "", y = u.url || u.web, L = y ? " (" + y + ")" : "", O = u.email || u.mail, R = O ? " <" + O + ">" : "";
|
|
4977
|
+
return m + R + L;
|
|
4980
4978
|
}
|
|
4981
4979
|
function f(u) {
|
|
4982
4980
|
if (typeof u != "string")
|
|
4983
4981
|
return u;
|
|
4984
|
-
var
|
|
4985
|
-
return
|
|
4982
|
+
var m = u.match(/^([^(<]+)/), y = u.match(/\(([^()]+)\)/), L = u.match(/<([^<>]+)>/), O = {};
|
|
4983
|
+
return m && m[0].trim() && (O.name = m[0].trim()), L && (O.email = L[1]), y && (O.url = y[1]), O;
|
|
4986
4984
|
}
|
|
4987
4985
|
function A(u) {
|
|
4988
|
-
var
|
|
4989
|
-
if (
|
|
4986
|
+
var m = u.optionalDependencies;
|
|
4987
|
+
if (m) {
|
|
4990
4988
|
var y = u.dependencies || {};
|
|
4991
|
-
Object.keys(
|
|
4992
|
-
y[L] =
|
|
4989
|
+
Object.keys(m).forEach(function(L) {
|
|
4990
|
+
y[L] = m[L];
|
|
4993
4991
|
}), u.dependencies = y;
|
|
4994
4992
|
}
|
|
4995
4993
|
}
|
|
4996
|
-
function t(u,
|
|
4994
|
+
function t(u, m, y) {
|
|
4997
4995
|
if (!u)
|
|
4998
4996
|
return {};
|
|
4999
4997
|
if (typeof u == "string" && (u = u.trim().split(/[\n\r\s\t ,]+/)), !Array.isArray(u))
|
|
5000
4998
|
return u;
|
|
5001
|
-
y("deprecatedArrayDependencies",
|
|
4999
|
+
y("deprecatedArrayDependencies", m);
|
|
5002
5000
|
var L = {};
|
|
5003
5001
|
return u.filter(function(O) {
|
|
5004
5002
|
return typeof O == "string";
|
|
5005
5003
|
}).forEach(function(O) {
|
|
5006
5004
|
O = O.trim().split(/(:?[@\s><=])/);
|
|
5007
|
-
var
|
|
5008
|
-
|
|
5005
|
+
var R = O.shift(), x = O.join("");
|
|
5006
|
+
x = x.trim(), x = x.replace(/^@/, ""), L[R] = x;
|
|
5009
5007
|
}), L;
|
|
5010
5008
|
}
|
|
5011
|
-
function c(u,
|
|
5009
|
+
function c(u, m) {
|
|
5012
5010
|
r.forEach(function(y) {
|
|
5013
|
-
u[y] && (u[y] = t(u[y], y,
|
|
5011
|
+
u[y] && (u[y] = t(u[y], y, m));
|
|
5014
5012
|
});
|
|
5015
5013
|
}
|
|
5016
|
-
function g(u,
|
|
5014
|
+
function g(u, m) {
|
|
5017
5015
|
u && Object.keys(u).forEach(function(y) {
|
|
5018
|
-
l.bugs[y] && (
|
|
5016
|
+
l.bugs[y] && (m("typo", y, l.bugs[y], "bugs"), u[l.bugs[y]] = u[y], delete u[y]);
|
|
5019
5017
|
});
|
|
5020
5018
|
}
|
|
5021
5019
|
return ht;
|
|
@@ -5096,8 +5094,8 @@ function Tn() {
|
|
|
5096
5094
|
l === !0 && (l = null, C = !0), C || (C = !1), (!l || a.private) && (l = function() {
|
|
5097
5095
|
}), a.scripts && a.scripts.install === "node-gyp rebuild" && !a.scripts.preinstall && (a.gypfile = !0), s.warn = function() {
|
|
5098
5096
|
l(n.apply(null, arguments));
|
|
5099
|
-
}, i.forEach(function(
|
|
5100
|
-
s["fix" + e(
|
|
5097
|
+
}, i.forEach(function(d) {
|
|
5098
|
+
s["fix" + e(d)](a, C);
|
|
5101
5099
|
}), a._id = a.name + "@" + a.version;
|
|
5102
5100
|
}
|
|
5103
5101
|
function e(a) {
|
|
@@ -5271,14 +5269,14 @@ var X = Yn(), Ie = { exports: {} }, Dr;
|
|
|
5271
5269
|
function Xn() {
|
|
5272
5270
|
if (Dr) return Ie.exports;
|
|
5273
5271
|
Dr = 1;
|
|
5274
|
-
let s = process || {}, n = s.argv || [], o = s.env || {}, h = !(o.NO_COLOR || n.includes("--no-color")) && (!!o.FORCE_COLOR || n.includes("--color") || s.platform === "win32" || (s.stdout || {}).isTTY && o.TERM !== "dumb" || !!o.CI), i = (a, l, C = a) => (
|
|
5275
|
-
let v = "" +
|
|
5272
|
+
let s = process || {}, n = s.argv || [], o = s.env || {}, h = !(o.NO_COLOR || n.includes("--no-color")) && (!!o.FORCE_COLOR || n.includes("--color") || s.platform === "win32" || (s.stdout || {}).isTTY && o.TERM !== "dumb" || !!o.CI), i = (a, l, C = a) => (d) => {
|
|
5273
|
+
let v = "" + d, w = v.indexOf(l, a.length);
|
|
5276
5274
|
return ~w ? a + r(v, l, C, w) + l : a + v + l;
|
|
5277
|
-
}, r = (a, l, C,
|
|
5275
|
+
}, r = (a, l, C, d) => {
|
|
5278
5276
|
let v = "", w = 0;
|
|
5279
5277
|
do
|
|
5280
|
-
v += a.substring(w,
|
|
5281
|
-
while (~
|
|
5278
|
+
v += a.substring(w, d) + C, w = d + l.length, d = a.indexOf(l, w);
|
|
5279
|
+
while (~d);
|
|
5282
5280
|
return v + a.substring(w);
|
|
5283
5281
|
}, e = (a = h) => {
|
|
5284
5282
|
let l = a ? i : () => String;
|
|
@@ -5330,7 +5328,7 @@ function Xn() {
|
|
|
5330
5328
|
return Ie.exports = e(), Ie.exports.createColors = e, Ie.exports;
|
|
5331
5329
|
}
|
|
5332
5330
|
var Kn = /* @__PURE__ */ Xn();
|
|
5333
|
-
const
|
|
5331
|
+
const $ = /* @__PURE__ */ Ue(Kn);
|
|
5334
5332
|
function Jn({ onlyFirst: s = !1 } = {}) {
|
|
5335
5333
|
const n = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
5336
5334
|
return new RegExp(n, s ? void 0 : "g");
|
|
@@ -5362,8 +5360,8 @@ var Zr = { exports: {} };
|
|
|
5362
5360
|
}, n.slice = function(h, i, r) {
|
|
5363
5361
|
textLen = n.length(h), i = i || 0, r = r || 1, i < 0 && (i = textLen + i), r < 0 && (r = textLen + r);
|
|
5364
5362
|
for (var e = "", a = 0, l = o(h), C = 0; C < l.length; C++) {
|
|
5365
|
-
var
|
|
5366
|
-
if (a >= i - (v == 2 ? 1 : 0)) if (a + v <= r) e +=
|
|
5363
|
+
var d = l[C], v = n.length(d);
|
|
5364
|
+
if (a >= i - (v == 2 ? 1 : 0)) if (a + v <= r) e += d;
|
|
5367
5365
|
else break;
|
|
5368
5366
|
a += v;
|
|
5369
5367
|
}
|
|
@@ -5398,24 +5396,24 @@ function ye(s, n = {}) {
|
|
|
5398
5396
|
}
|
|
5399
5397
|
return h;
|
|
5400
5398
|
}
|
|
5401
|
-
const dt = 10, fr = (s = 0) => (n) => `\x1B[${n + s}m`, pr = (s = 0) => (n) => `\x1B[${38 + s};5;${n}m`, dr = (s = 0) => (n, o, h) => `\x1B[${38 + s};2;${n};${o};${h}m`,
|
|
5402
|
-
Object.keys(
|
|
5403
|
-
const is = Object.keys(
|
|
5399
|
+
const dt = 10, fr = (s = 0) => (n) => `\x1B[${n + s}m`, pr = (s = 0) => (n) => `\x1B[${38 + s};5;${n}m`, dr = (s = 0) => (n, o, h) => `\x1B[${38 + s};2;${n};${o};${h}m`, H = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
5400
|
+
Object.keys(H.modifier);
|
|
5401
|
+
const is = Object.keys(H.color), ns = Object.keys(H.bgColor);
|
|
5404
5402
|
[...is, ...ns];
|
|
5405
5403
|
function ss() {
|
|
5406
5404
|
const s = /* @__PURE__ */ new Map();
|
|
5407
|
-
for (const [n, o] of Object.entries(
|
|
5408
|
-
for (const [h, i] of Object.entries(o))
|
|
5409
|
-
Object.defineProperty(
|
|
5405
|
+
for (const [n, o] of Object.entries(H)) {
|
|
5406
|
+
for (const [h, i] of Object.entries(o)) H[h] = { open: `\x1B[${i[0]}m`, close: `\x1B[${i[1]}m` }, o[h] = H[h], s.set(i[0], i[1]);
|
|
5407
|
+
Object.defineProperty(H, n, { value: o, enumerable: !1 });
|
|
5410
5408
|
}
|
|
5411
|
-
return Object.defineProperty(
|
|
5409
|
+
return Object.defineProperty(H, "codes", { value: s, enumerable: !1 }), H.color.close = "\x1B[39m", H.bgColor.close = "\x1B[49m", H.color.ansi = fr(), H.color.ansi256 = pr(), H.color.ansi16m = dr(), H.bgColor.ansi = fr(dt), H.bgColor.ansi256 = pr(dt), H.bgColor.ansi16m = dr(dt), Object.defineProperties(H, { rgbToAnsi256: { value: (n, o, h) => n === o && o === h ? n < 8 ? 16 : n > 248 ? 231 : Math.round((n - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(n / 255 * 5) + 6 * Math.round(o / 255 * 5) + Math.round(h / 255 * 5), enumerable: !1 }, hexToRgb: { value: (n) => {
|
|
5412
5410
|
const o = /[a-f\d]{6}|[a-f\d]{3}/i.exec(n.toString(16));
|
|
5413
5411
|
if (!o) return [0, 0, 0];
|
|
5414
5412
|
let [h] = o;
|
|
5415
5413
|
h.length === 3 && (h = [...h].map((r) => r + r).join(""));
|
|
5416
5414
|
const i = Number.parseInt(h, 16);
|
|
5417
5415
|
return [i >> 16 & 255, i >> 8 & 255, i & 255];
|
|
5418
|
-
}, enumerable: !1 }, hexToAnsi256: { value: (n) =>
|
|
5416
|
+
}, enumerable: !1 }, hexToAnsi256: { value: (n) => H.rgbToAnsi256(...H.hexToRgb(n)), enumerable: !1 }, ansi256ToAnsi: { value: (n) => {
|
|
5419
5417
|
if (n < 8) return 30 + n;
|
|
5420
5418
|
if (n < 16) return 90 + (n - 8);
|
|
5421
5419
|
let o, h, i;
|
|
@@ -5429,7 +5427,7 @@ function ss() {
|
|
|
5429
5427
|
if (r === 0) return 30;
|
|
5430
5428
|
let e = 30 + (Math.round(i) << 2 | Math.round(h) << 1 | Math.round(o));
|
|
5431
5429
|
return r === 2 && (e += 60), e;
|
|
5432
|
-
}, enumerable: !1 }, rgbToAnsi: { value: (n, o, h) =>
|
|
5430
|
+
}, enumerable: !1 }, rgbToAnsi: { value: (n, o, h) => H.ansi256ToAnsi(H.rgbToAnsi256(n, o, h)), enumerable: !1 }, hexToAnsi: { value: (n) => H.ansi256ToAnsi(H.hexToAnsi256(n)), enumerable: !1 } }), H;
|
|
5433
5431
|
}
|
|
5434
5432
|
const us = ss(), We = /* @__PURE__ */ new Set(["\x1B", ""]), os = 39, wt = "\x07", Qr = "[", as = "]", ei = "m", Lt = `${as}8;;`, mr = (s) => `${We.values().next().value}${Qr}${s}${ei}`, gr = (s) => `${We.values().next().value}${Lt}${s}${wt}`, ls = (s) => s.split(" ").map((n) => ye(n)), mt = (s, n, o) => {
|
|
5435
5433
|
const h = [...n];
|
|
@@ -5453,32 +5451,32 @@ const us = ss(), We = /* @__PURE__ */ new Set(["\x1B", ""]), os = 39, wt = "\x
|
|
|
5453
5451
|
let h = "", i, r;
|
|
5454
5452
|
const e = ls(s);
|
|
5455
5453
|
let a = [""];
|
|
5456
|
-
for (const [C,
|
|
5454
|
+
for (const [C, d] of s.split(" ").entries()) {
|
|
5457
5455
|
o.trim !== !1 && (a[a.length - 1] = a[a.length - 1].trimStart());
|
|
5458
5456
|
let v = ye(a[a.length - 1]);
|
|
5459
5457
|
if (C !== 0 && (v >= n && (o.wordWrap === !1 || o.trim === !1) && (a.push(""), v = 0), (v > 0 || o.trim === !1) && (a[a.length - 1] += " ", v++)), o.hard && e[C] > n) {
|
|
5460
5458
|
const w = n - v, D = 1 + Math.floor((e[C] - w - 1) / n);
|
|
5461
|
-
Math.floor((e[C] - 1) / n) < D && a.push(""), mt(a,
|
|
5459
|
+
Math.floor((e[C] - 1) / n) < D && a.push(""), mt(a, d, n);
|
|
5462
5460
|
continue;
|
|
5463
5461
|
}
|
|
5464
5462
|
if (v + e[C] > n && v > 0 && e[C] > 0) {
|
|
5465
5463
|
if (o.wordWrap === !1 && v < n) {
|
|
5466
|
-
mt(a,
|
|
5464
|
+
mt(a, d, n);
|
|
5467
5465
|
continue;
|
|
5468
5466
|
}
|
|
5469
5467
|
a.push("");
|
|
5470
5468
|
}
|
|
5471
5469
|
if (v + e[C] > n && o.wordWrap === !1) {
|
|
5472
|
-
mt(a,
|
|
5470
|
+
mt(a, d, n);
|
|
5473
5471
|
continue;
|
|
5474
5472
|
}
|
|
5475
|
-
a[a.length - 1] +=
|
|
5473
|
+
a[a.length - 1] += d;
|
|
5476
5474
|
}
|
|
5477
5475
|
o.trim !== !1 && (a = a.map((C) => cs(C)));
|
|
5478
5476
|
const l = [...a.join(`
|
|
5479
5477
|
`)];
|
|
5480
|
-
for (const [C,
|
|
5481
|
-
if (h +=
|
|
5478
|
+
for (const [C, d] of l.entries()) {
|
|
5479
|
+
if (h += d, We.has(d)) {
|
|
5482
5480
|
const { groups: w } = new RegExp(`(?:\\${Qr}(?<code>\\d+)m|\\${Lt}(?<uri>.*)${wt})`).exec(l.slice(C).join("")) || { groups: {} };
|
|
5483
5481
|
if (w.code !== void 0) {
|
|
5484
5482
|
const D = Number.parseFloat(w.code);
|
|
@@ -5487,7 +5485,7 @@ const us = ss(), We = /* @__PURE__ */ new Set(["\x1B", ""]), os = 39, wt = "\x
|
|
|
5487
5485
|
}
|
|
5488
5486
|
const v = us.codes.get(Number(i));
|
|
5489
5487
|
l[C + 1] === `
|
|
5490
|
-
` ? (r && (h += gr("")), i && v && (h += mr(v))) :
|
|
5488
|
+
` ? (r && (h += gr("")), i && v && (h += mr(v))) : d === `
|
|
5491
5489
|
` && (i && v && (h += mr(i)), r && (h += gr(r)));
|
|
5492
5490
|
}
|
|
5493
5491
|
return h;
|
|
@@ -5600,10 +5598,10 @@ class Cs extends St {
|
|
|
5600
5598
|
super(o), Fr(this, "valueWithCursor", ""), Fr(this, "_mask", "•"), this._mask = n ?? "•", this.on("finalize", () => {
|
|
5601
5599
|
this.valueWithCursor = this.masked;
|
|
5602
5600
|
}), this.on("value", () => {
|
|
5603
|
-
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${
|
|
5601
|
+
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${$.inverse($.hidden("_"))}`;
|
|
5604
5602
|
else {
|
|
5605
5603
|
const h = this.masked.slice(0, this.cursor), i = this.masked.slice(this.cursor);
|
|
5606
|
-
this.valueWithCursor = `${h}${
|
|
5604
|
+
this.valueWithCursor = `${h}${$.inverse(i[0])}${i.slice(1)}`;
|
|
5607
5605
|
}
|
|
5608
5606
|
});
|
|
5609
5607
|
}
|
|
@@ -5644,10 +5642,10 @@ class ws extends St {
|
|
|
5644
5642
|
super(n), ys(this, "valueWithCursor", ""), this.on("finalize", () => {
|
|
5645
5643
|
this.value || (this.value = n.defaultValue), this.valueWithCursor = this.value;
|
|
5646
5644
|
}), this.on("value", () => {
|
|
5647
|
-
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.value}${
|
|
5645
|
+
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.value}${$.inverse($.hidden("_"))}`;
|
|
5648
5646
|
else {
|
|
5649
5647
|
const o = this.value.slice(0, this.cursor), h = this.value.slice(this.cursor);
|
|
5650
|
-
this.valueWithCursor = `${o}${
|
|
5648
|
+
this.valueWithCursor = `${o}${$.inverse(h[0])}${h.slice(1)}`;
|
|
5651
5649
|
}
|
|
5652
5650
|
});
|
|
5653
5651
|
}
|
|
@@ -5679,140 +5677,140 @@ function Ss({ input: s = Br, output: n = Pr, overwrite: o = !0, hideCursor: h =
|
|
|
5679
5677
|
function Os() {
|
|
5680
5678
|
return J.platform !== "win32" ? J.env.TERM !== "linux" : !!J.env.CI || !!J.env.WT_SESSION || !!J.env.TERMINUS_SUBLIME || J.env.ConEmuTask === "{cmd::Cmder}" || J.env.TERM_PROGRAM === "Terminus-Sublime" || J.env.TERM_PROGRAM === "vscode" || J.env.TERM === "xterm-256color" || J.env.TERM === "alacritty" || J.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
5681
5679
|
}
|
|
5682
|
-
const Ft = Os(), Q = (s, n) => Ft ? s : n, _s = Q("◆", "*"), ii = Q("■", "x"), ni = Q("▲", "x"), Ot = Q("◇", "o"), xs = Q("┌", "T"),
|
|
5680
|
+
const Ft = Os(), Q = (s, n) => Ft ? s : n, _s = Q("◆", "*"), ii = Q("■", "x"), ni = Q("▲", "x"), Ot = Q("◇", "o"), xs = Q("┌", "T"), j = Q("│", "|"), de = Q("└", "—"), $s = Q("●", ">"), Bs = Q("○", " "), Ps = Q("▪", "•"), Rs = Q("●", "•"), Is = Q("◆", "*"), Ns = Q("▲", "!"), Ts = Q("■", "x"), _t = (s) => {
|
|
5683
5681
|
switch (s) {
|
|
5684
5682
|
case "initial":
|
|
5685
5683
|
case "active":
|
|
5686
|
-
return
|
|
5684
|
+
return $.cyan(_s);
|
|
5687
5685
|
case "cancel":
|
|
5688
|
-
return
|
|
5686
|
+
return $.red(ii);
|
|
5689
5687
|
case "error":
|
|
5690
|
-
return
|
|
5688
|
+
return $.yellow(ni);
|
|
5691
5689
|
case "submit":
|
|
5692
|
-
return
|
|
5690
|
+
return $.green(Ot);
|
|
5693
5691
|
}
|
|
5694
5692
|
}, Ms = (s) => new ws({ validate: s.validate, placeholder: s.placeholder, defaultValue: s.defaultValue, initialValue: s.initialValue, render() {
|
|
5695
|
-
const n = `${
|
|
5693
|
+
const n = `${$.gray(j)}
|
|
5696
5694
|
${_t(this.state)} ${s.message}
|
|
5697
|
-
`, o = s.placeholder ?
|
|
5695
|
+
`, o = s.placeholder ? $.inverse(s.placeholder[0]) + $.dim(s.placeholder.slice(1)) : $.inverse($.hidden("_")), h = this.value ? this.valueWithCursor : o;
|
|
5698
5696
|
switch (this.state) {
|
|
5699
5697
|
case "error":
|
|
5700
5698
|
return `${n.trim()}
|
|
5701
|
-
${
|
|
5702
|
-
${
|
|
5699
|
+
${$.yellow(j)} ${h}
|
|
5700
|
+
${$.yellow(de)} ${$.yellow(this.error)}
|
|
5703
5701
|
`;
|
|
5704
5702
|
case "submit":
|
|
5705
|
-
return `${n}${
|
|
5703
|
+
return `${n}${$.gray(j)} ${$.dim(this.value || s.placeholder)}`;
|
|
5706
5704
|
case "cancel":
|
|
5707
|
-
return `${n}${
|
|
5708
|
-
` +
|
|
5705
|
+
return `${n}${$.gray(j)} ${$.strikethrough($.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
5706
|
+
` + $.gray(j) : ""}`;
|
|
5709
5707
|
default:
|
|
5710
|
-
return `${n}${
|
|
5711
|
-
${
|
|
5708
|
+
return `${n}${$.cyan(j)} ${h}
|
|
5709
|
+
${$.cyan(de)}
|
|
5712
5710
|
`;
|
|
5713
5711
|
}
|
|
5714
5712
|
} }).prompt(), Gs = (s) => new Cs({ validate: s.validate, mask: s.mask ?? Ps, render() {
|
|
5715
|
-
const n = `${
|
|
5713
|
+
const n = `${$.gray(j)}
|
|
5716
5714
|
${_t(this.state)} ${s.message}
|
|
5717
5715
|
`, o = this.valueWithCursor, h = this.masked;
|
|
5718
5716
|
switch (this.state) {
|
|
5719
5717
|
case "error":
|
|
5720
5718
|
return `${n.trim()}
|
|
5721
|
-
${
|
|
5722
|
-
${
|
|
5719
|
+
${$.yellow(j)} ${h}
|
|
5720
|
+
${$.yellow(de)} ${$.yellow(this.error)}
|
|
5723
5721
|
`;
|
|
5724
5722
|
case "submit":
|
|
5725
|
-
return `${n}${
|
|
5723
|
+
return `${n}${$.gray(j)} ${$.dim(h)}`;
|
|
5726
5724
|
case "cancel":
|
|
5727
|
-
return `${n}${
|
|
5728
|
-
` +
|
|
5725
|
+
return `${n}${$.gray(j)} ${$.strikethrough($.dim(h ?? ""))}${h ? `
|
|
5726
|
+
` + $.gray(j) : ""}`;
|
|
5729
5727
|
default:
|
|
5730
|
-
return `${n}${
|
|
5731
|
-
${
|
|
5728
|
+
return `${n}${$.cyan(j)} ${o}
|
|
5729
|
+
${$.cyan(de)}
|
|
5732
5730
|
`;
|
|
5733
5731
|
}
|
|
5734
5732
|
} }).prompt(), ks = (s) => {
|
|
5735
5733
|
const n = (h, i) => {
|
|
5736
5734
|
const r = h.label ?? String(h.value);
|
|
5737
|
-
return i === "active" ? `${
|
|
5735
|
+
return i === "active" ? `${$.green($s)} ${r} ${h.hint ? $.dim(`(${h.hint})`) : ""}` : i === "selected" ? `${$.dim(r)}` : i === "cancelled" ? `${$.strikethrough($.dim(r))}` : `${$.dim(Bs)} ${$.dim(r)}`;
|
|
5738
5736
|
};
|
|
5739
5737
|
let o = 0;
|
|
5740
5738
|
return new bs({ options: s.options, initialValue: s.initialValue, render() {
|
|
5741
|
-
const h = `${
|
|
5739
|
+
const h = `${$.gray(j)}
|
|
5742
5740
|
${_t(this.state)} ${s.message}
|
|
5743
5741
|
`;
|
|
5744
5742
|
switch (this.state) {
|
|
5745
5743
|
case "submit":
|
|
5746
|
-
return `${h}${
|
|
5744
|
+
return `${h}${$.gray(j)} ${n(this.options[this.cursor], "selected")}`;
|
|
5747
5745
|
case "cancel":
|
|
5748
|
-
return `${h}${
|
|
5749
|
-
${
|
|
5746
|
+
return `${h}${$.gray(j)} ${n(this.options[this.cursor], "cancelled")}
|
|
5747
|
+
${$.gray(j)}`;
|
|
5750
5748
|
default: {
|
|
5751
5749
|
const i = s.maxItems === void 0 ? 1 / 0 : Math.max(s.maxItems, 5);
|
|
5752
5750
|
this.cursor >= o + i - 3 ? o = Math.max(Math.min(this.cursor - i + 3, this.options.length - i), 0) : this.cursor < o + 2 && (o = Math.max(this.cursor - 2, 0));
|
|
5753
5751
|
const r = i < this.options.length && o > 0, e = i < this.options.length && o + i < this.options.length;
|
|
5754
|
-
return `${h}${
|
|
5755
|
-
${
|
|
5756
|
-
${
|
|
5752
|
+
return `${h}${$.cyan(j)} ${this.options.slice(o, o + i).map((a, l, C) => l === 0 && r || l === C.length - 1 && e ? $.dim("...") : n(a, l + o === this.cursor ? "active" : "inactive")).join(`
|
|
5753
|
+
${$.cyan(j)} `)}
|
|
5754
|
+
${$.cyan(de)}
|
|
5757
5755
|
`;
|
|
5758
5756
|
}
|
|
5759
5757
|
}
|
|
5760
5758
|
} }).prompt();
|
|
5761
5759
|
}, si = (s = "") => {
|
|
5762
|
-
process.stdout.write(`${
|
|
5760
|
+
process.stdout.write(`${$.gray(de)} ${$.red(s)}
|
|
5763
5761
|
|
|
5764
5762
|
`);
|
|
5765
5763
|
}, Hs = (s = "") => {
|
|
5766
|
-
process.stdout.write(`${
|
|
5764
|
+
process.stdout.write(`${$.gray(xs)} ${s}
|
|
5767
5765
|
`);
|
|
5768
5766
|
}, ge = (s = "") => {
|
|
5769
|
-
process.stdout.write(`${
|
|
5770
|
-
${
|
|
5767
|
+
process.stdout.write(`${$.gray(j)}
|
|
5768
|
+
${$.gray(de)} ${s}
|
|
5771
5769
|
|
|
5772
5770
|
`);
|
|
5773
|
-
}, pe = { message: (s = "", { symbol: n =
|
|
5774
|
-
const o = [`${
|
|
5771
|
+
}, pe = { message: (s = "", { symbol: n = $.gray(j) } = {}) => {
|
|
5772
|
+
const o = [`${$.gray(j)}`];
|
|
5775
5773
|
if (s) {
|
|
5776
5774
|
const [h, ...i] = s.split(`
|
|
5777
5775
|
`);
|
|
5778
|
-
o.push(`${n} ${h}`, ...i.map((r) => `${
|
|
5776
|
+
o.push(`${n} ${h}`, ...i.map((r) => `${$.gray(j)} ${r}`));
|
|
5779
5777
|
}
|
|
5780
5778
|
process.stdout.write(`${o.join(`
|
|
5781
5779
|
`)}
|
|
5782
5780
|
`);
|
|
5783
5781
|
}, info: (s) => {
|
|
5784
|
-
pe.message(s, { symbol:
|
|
5782
|
+
pe.message(s, { symbol: $.blue(Rs) });
|
|
5785
5783
|
}, success: (s) => {
|
|
5786
|
-
pe.message(s, { symbol:
|
|
5784
|
+
pe.message(s, { symbol: $.green(Is) });
|
|
5787
5785
|
}, step: (s) => {
|
|
5788
|
-
pe.message(s, { symbol:
|
|
5786
|
+
pe.message(s, { symbol: $.green(Ot) });
|
|
5789
5787
|
}, warn: (s) => {
|
|
5790
|
-
pe.message(s, { symbol:
|
|
5788
|
+
pe.message(s, { symbol: $.yellow(Ns) });
|
|
5791
5789
|
}, warning: (s) => {
|
|
5792
5790
|
pe.warn(s);
|
|
5793
5791
|
}, error: (s) => {
|
|
5794
|
-
pe.message(s, { symbol:
|
|
5792
|
+
pe.message(s, { symbol: $.red(Ts) });
|
|
5795
5793
|
} }, Us = () => {
|
|
5796
5794
|
const s = Ft ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], n = Ft ? 80 : 120;
|
|
5797
5795
|
let o, h, i = !1, r = "";
|
|
5798
|
-
const e = (
|
|
5799
|
-
i = !0, o = Ss(), r =
|
|
5796
|
+
const e = (d = "") => {
|
|
5797
|
+
i = !0, o = Ss(), r = d.replace(/\.+$/, ""), process.stdout.write(`${$.gray(j)}
|
|
5800
5798
|
`);
|
|
5801
5799
|
let v = 0, w = 0;
|
|
5802
5800
|
h = setInterval(() => {
|
|
5803
|
-
const D =
|
|
5804
|
-
process.stdout.write(X.cursor.move(-999, 0)), process.stdout.write(X.erase.down(1)), process.stdout.write(`${D} ${r}${
|
|
5801
|
+
const D = $.magenta(s[v]), p = ".".repeat(Math.floor(w)).slice(0, 3);
|
|
5802
|
+
process.stdout.write(X.cursor.move(-999, 0)), process.stdout.write(X.erase.down(1)), process.stdout.write(`${D} ${r}${p}`), v = v + 1 < s.length ? v + 1 : 0, w = w < s.length ? w + 0.125 : 0;
|
|
5805
5803
|
}, n);
|
|
5806
|
-
}, a = (
|
|
5807
|
-
r =
|
|
5808
|
-
const w = v === 0 ?
|
|
5804
|
+
}, a = (d = "", v = 0) => {
|
|
5805
|
+
r = d ?? r, i = !1, clearInterval(h);
|
|
5806
|
+
const w = v === 0 ? $.green(Ot) : v === 1 ? $.red(ii) : $.red(ni);
|
|
5809
5807
|
process.stdout.write(X.cursor.move(-999, 0)), process.stdout.write(X.erase.down(1)), process.stdout.write(`${w} ${r}
|
|
5810
5808
|
`), o();
|
|
5811
|
-
}, l = (
|
|
5812
|
-
r =
|
|
5813
|
-
}, C = (
|
|
5814
|
-
const v =
|
|
5815
|
-
i && a(v,
|
|
5809
|
+
}, l = (d = "") => {
|
|
5810
|
+
r = d ?? r;
|
|
5811
|
+
}, C = (d) => {
|
|
5812
|
+
const v = d > 1 ? "Something went wrong" : "Canceled";
|
|
5813
|
+
i && a(v, d);
|
|
5816
5814
|
};
|
|
5817
5815
|
return process.on("uncaughtExceptionMonitor", () => C(2)), process.on("unhandledRejection", () => C(2)), process.on("SIGINT", () => C(1)), process.on("SIGTERM", () => C(1)), process.on("exit", C), { start: e, stop: a, message: l };
|
|
5818
5816
|
}, js = async (s, n) => {
|
|
@@ -5828,7 +5826,7 @@ ${x.gray(de)} ${s}
|
|
|
5828
5826
|
o[i] = e;
|
|
5829
5827
|
}
|
|
5830
5828
|
return o;
|
|
5831
|
-
}, gt = 10, Ar = (s = 0) => (n) => `\x1B[${n + s}m`, vr = (s = 0) => (n) => `\x1B[${38 + s};5;${n}m`, yr = (s = 0) => (n, o, h) => `\x1B[${38 + s};2;${n};${o};${h}m`,
|
|
5829
|
+
}, gt = 10, Ar = (s = 0) => (n) => `\x1B[${n + s}m`, vr = (s = 0) => (n) => `\x1B[${38 + s};5;${n}m`, yr = (s = 0) => (n, o, h) => `\x1B[${38 + s};2;${n};${o};${h}m`, U = {
|
|
5832
5830
|
modifier: {
|
|
5833
5831
|
reset: [0, 0],
|
|
5834
5832
|
// 21 isn't widely supported and 22 does the same thing
|
|
@@ -5888,26 +5886,26 @@ ${x.gray(de)} ${s}
|
|
|
5888
5886
|
bgWhiteBright: [107, 49]
|
|
5889
5887
|
}
|
|
5890
5888
|
};
|
|
5891
|
-
Object.keys(
|
|
5892
|
-
const Ws = Object.keys(
|
|
5889
|
+
Object.keys(U.modifier);
|
|
5890
|
+
const Ws = Object.keys(U.color), Vs = Object.keys(U.bgColor);
|
|
5893
5891
|
[...Ws, ...Vs];
|
|
5894
5892
|
function qs() {
|
|
5895
5893
|
const s = /* @__PURE__ */ new Map();
|
|
5896
|
-
for (const [n, o] of Object.entries(
|
|
5894
|
+
for (const [n, o] of Object.entries(U)) {
|
|
5897
5895
|
for (const [h, i] of Object.entries(o))
|
|
5898
|
-
|
|
5896
|
+
U[h] = {
|
|
5899
5897
|
open: `\x1B[${i[0]}m`,
|
|
5900
5898
|
close: `\x1B[${i[1]}m`
|
|
5901
|
-
}, o[h] =
|
|
5902
|
-
Object.defineProperty(
|
|
5899
|
+
}, o[h] = U[h], s.set(i[0], i[1]);
|
|
5900
|
+
Object.defineProperty(U, n, {
|
|
5903
5901
|
value: o,
|
|
5904
5902
|
enumerable: !1
|
|
5905
5903
|
});
|
|
5906
5904
|
}
|
|
5907
|
-
return Object.defineProperty(
|
|
5905
|
+
return Object.defineProperty(U, "codes", {
|
|
5908
5906
|
value: s,
|
|
5909
5907
|
enumerable: !1
|
|
5910
|
-
}),
|
|
5908
|
+
}), U.color.close = "\x1B[39m", U.bgColor.close = "\x1B[49m", U.color.ansi = Ar(), U.color.ansi256 = vr(), U.color.ansi16m = yr(), U.bgColor.ansi = Ar(gt), U.bgColor.ansi256 = vr(gt), U.bgColor.ansi16m = yr(gt), Object.defineProperties(U, {
|
|
5911
5909
|
rgbToAnsi256: {
|
|
5912
5910
|
value(n, o, h) {
|
|
5913
5911
|
return n === o && o === h ? n < 8 ? 16 : n > 248 ? 231 : Math.round((n - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(n / 255 * 5) + 6 * Math.round(o / 255 * 5) + Math.round(h / 255 * 5);
|
|
@@ -5933,7 +5931,7 @@ function qs() {
|
|
|
5933
5931
|
enumerable: !1
|
|
5934
5932
|
},
|
|
5935
5933
|
hexToAnsi256: {
|
|
5936
|
-
value: (n) =>
|
|
5934
|
+
value: (n) => U.rgbToAnsi256(...U.hexToRgb(n)),
|
|
5937
5935
|
enumerable: !1
|
|
5938
5936
|
},
|
|
5939
5937
|
ansi256ToAnsi: {
|
|
@@ -5959,26 +5957,26 @@ function qs() {
|
|
|
5959
5957
|
enumerable: !1
|
|
5960
5958
|
},
|
|
5961
5959
|
rgbToAnsi: {
|
|
5962
|
-
value: (n, o, h) =>
|
|
5960
|
+
value: (n, o, h) => U.ansi256ToAnsi(U.rgbToAnsi256(n, o, h)),
|
|
5963
5961
|
enumerable: !1
|
|
5964
5962
|
},
|
|
5965
5963
|
hexToAnsi: {
|
|
5966
|
-
value: (n) =>
|
|
5964
|
+
value: (n) => U.ansi256ToAnsi(U.hexToAnsi256(n)),
|
|
5967
5965
|
enumerable: !1
|
|
5968
5966
|
}
|
|
5969
|
-
}),
|
|
5967
|
+
}), U;
|
|
5970
5968
|
}
|
|
5971
5969
|
const le = qs();
|
|
5972
5970
|
function se(s, n = globalThis.Deno ? globalThis.Deno.args : J.argv) {
|
|
5973
5971
|
const o = s.startsWith("-") ? "" : s.length === 1 ? "-" : "--", h = n.indexOf(o + s), i = n.indexOf("--");
|
|
5974
5972
|
return h !== -1 && (i === -1 || h < i);
|
|
5975
5973
|
}
|
|
5976
|
-
const { env:
|
|
5974
|
+
const { env: V } = J;
|
|
5977
5975
|
let ke;
|
|
5978
5976
|
se("no-color") || se("no-colors") || se("color=false") || se("color=never") ? ke = 0 : (se("color") || se("colors") || se("color=true") || se("color=always")) && (ke = 1);
|
|
5979
5977
|
function zs() {
|
|
5980
|
-
if ("FORCE_COLOR" in
|
|
5981
|
-
return
|
|
5978
|
+
if ("FORCE_COLOR" in V)
|
|
5979
|
+
return V.FORCE_COLOR === "true" ? 1 : V.FORCE_COLOR === "false" ? 0 : V.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(V.FORCE_COLOR, 10), 3);
|
|
5982
5980
|
}
|
|
5983
5981
|
function Ys(s) {
|
|
5984
5982
|
return s === 0 ? !1 : {
|
|
@@ -6000,33 +5998,33 @@ function Xs(s, { streamIsTTY: n, sniffFlags: o = !0 } = {}) {
|
|
|
6000
5998
|
if (se("color=256"))
|
|
6001
5999
|
return 2;
|
|
6002
6000
|
}
|
|
6003
|
-
if ("TF_BUILD" in
|
|
6001
|
+
if ("TF_BUILD" in V && "AGENT_NAME" in V)
|
|
6004
6002
|
return 1;
|
|
6005
6003
|
if (s && !n && i === void 0)
|
|
6006
6004
|
return 0;
|
|
6007
6005
|
const r = i || 0;
|
|
6008
|
-
if (
|
|
6006
|
+
if (V.TERM === "dumb")
|
|
6009
6007
|
return r;
|
|
6010
6008
|
if (J.platform === "win32") {
|
|
6011
6009
|
const e = wi.release().split(".");
|
|
6012
6010
|
return Number(e[0]) >= 10 && Number(e[2]) >= 10586 ? Number(e[2]) >= 14931 ? 3 : 2 : 1;
|
|
6013
6011
|
}
|
|
6014
|
-
if ("CI" in
|
|
6015
|
-
return ["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((e) => e in
|
|
6016
|
-
if ("TEAMCITY_VERSION" in
|
|
6017
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(
|
|
6018
|
-
if (
|
|
6012
|
+
if ("CI" in V)
|
|
6013
|
+
return ["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((e) => e in V) ? 3 : ["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((e) => e in V) || V.CI_NAME === "codeship" ? 1 : r;
|
|
6014
|
+
if ("TEAMCITY_VERSION" in V)
|
|
6015
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(V.TEAMCITY_VERSION) ? 1 : 0;
|
|
6016
|
+
if (V.COLORTERM === "truecolor" || V.TERM === "xterm-kitty")
|
|
6019
6017
|
return 3;
|
|
6020
|
-
if ("TERM_PROGRAM" in
|
|
6021
|
-
const e = Number.parseInt((
|
|
6022
|
-
switch (
|
|
6018
|
+
if ("TERM_PROGRAM" in V) {
|
|
6019
|
+
const e = Number.parseInt((V.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
6020
|
+
switch (V.TERM_PROGRAM) {
|
|
6023
6021
|
case "iTerm.app":
|
|
6024
6022
|
return e >= 3 ? 3 : 2;
|
|
6025
6023
|
case "Apple_Terminal":
|
|
6026
6024
|
return 2;
|
|
6027
6025
|
}
|
|
6028
6026
|
}
|
|
6029
|
-
return /-256(color)?$/i.test(
|
|
6027
|
+
return /-256(color)?$/i.test(V.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(V.TERM) || "COLORTERM" in V ? 1 : r;
|
|
6030
6028
|
}
|
|
6031
6029
|
function wr(s, n = {}) {
|
|
6032
6030
|
const o = Xs(s, {
|
|
@@ -6202,14 +6200,14 @@ function su() {
|
|
|
6202
6200
|
return (b.r * 299 + b.g * 587 + b.b * 114) / 1e3;
|
|
6203
6201
|
},
|
|
6204
6202
|
getLuminance: function() {
|
|
6205
|
-
var b = this.toRgb(), F, S, B, _,
|
|
6206
|
-
return F = b.r / 255, S = b.g / 255, B = b.b / 255, F <= 0.03928 ? _ = F / 12.92 : _ = Math.pow((F + 0.055) / 1.055, 2.4), S <= 0.03928 ?
|
|
6203
|
+
var b = this.toRgb(), F, S, B, _, M, G;
|
|
6204
|
+
return F = b.r / 255, S = b.g / 255, B = b.b / 255, F <= 0.03928 ? _ = F / 12.92 : _ = Math.pow((F + 0.055) / 1.055, 2.4), S <= 0.03928 ? M = S / 12.92 : M = Math.pow((S + 0.055) / 1.055, 2.4), B <= 0.03928 ? G = B / 12.92 : G = Math.pow((B + 0.055) / 1.055, 2.4), 0.2126 * _ + 0.7152 * M + 0.0722 * G;
|
|
6207
6205
|
},
|
|
6208
6206
|
setAlpha: function(b) {
|
|
6209
6207
|
return this._a = Y(b), this._roundA = Math.round(100 * this._a) / 100, this;
|
|
6210
6208
|
},
|
|
6211
6209
|
toHsv: function() {
|
|
6212
|
-
var b =
|
|
6210
|
+
var b = d(this._r, this._g, this._b);
|
|
6213
6211
|
return {
|
|
6214
6212
|
h: b.h * 360,
|
|
6215
6213
|
s: b.s,
|
|
@@ -6218,7 +6216,7 @@ function su() {
|
|
|
6218
6216
|
};
|
|
6219
6217
|
},
|
|
6220
6218
|
toHsvString: function() {
|
|
6221
|
-
var b =
|
|
6219
|
+
var b = d(this._r, this._g, this._b), F = Math.round(b.h * 360), S = Math.round(b.s * 100), B = Math.round(b.v * 100);
|
|
6222
6220
|
return this._a == 1 ? "hsv(" + F + ", " + S + "%, " + B + "%)" : "hsva(" + F + ", " + S + "%, " + B + "%, " + this._roundA + ")";
|
|
6223
6221
|
},
|
|
6224
6222
|
toHsl: function() {
|
|
@@ -6259,23 +6257,23 @@ function su() {
|
|
|
6259
6257
|
},
|
|
6260
6258
|
toPercentageRgb: function() {
|
|
6261
6259
|
return {
|
|
6262
|
-
r: Math.round(
|
|
6263
|
-
g: Math.round(
|
|
6264
|
-
b: Math.round(
|
|
6260
|
+
r: Math.round(T(this._r, 255) * 100) + "%",
|
|
6261
|
+
g: Math.round(T(this._g, 255) * 100) + "%",
|
|
6262
|
+
b: Math.round(T(this._b, 255) * 100) + "%",
|
|
6265
6263
|
a: this._a
|
|
6266
6264
|
};
|
|
6267
6265
|
},
|
|
6268
6266
|
toPercentageRgbString: function() {
|
|
6269
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
6267
|
+
return this._a == 1 ? "rgb(" + Math.round(T(this._r, 255) * 100) + "%, " + Math.round(T(this._g, 255) * 100) + "%, " + Math.round(T(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(T(this._r, 255) * 100) + "%, " + Math.round(T(this._g, 255) * 100) + "%, " + Math.round(T(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
6270
6268
|
},
|
|
6271
6269
|
toName: function() {
|
|
6272
|
-
return this._a === 0 ? "transparent" : this._a < 1 ? !1 :
|
|
6270
|
+
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : I[w(this._r, this._g, this._b, !0)] || !1;
|
|
6273
6271
|
},
|
|
6274
6272
|
toFilter: function(b) {
|
|
6275
|
-
var F = "#" +
|
|
6273
|
+
var F = "#" + p(this._r, this._g, this._b, this._a), S = F, B = this._gradientType ? "GradientType = 1, " : "";
|
|
6276
6274
|
if (b) {
|
|
6277
6275
|
var _ = r(b);
|
|
6278
|
-
S = "#" +
|
|
6276
|
+
S = "#" + p(_._r, _._g, _._b, _._a);
|
|
6279
6277
|
}
|
|
6280
6278
|
return "progid:DXImageTransform.Microsoft.gradient(" + B + "startColorstr=" + F + ",endColorstr=" + S + ")";
|
|
6281
6279
|
},
|
|
@@ -6311,19 +6309,19 @@ function su() {
|
|
|
6311
6309
|
return this._applyModification(t, arguments);
|
|
6312
6310
|
},
|
|
6313
6311
|
spin: function() {
|
|
6314
|
-
return this._applyModification(
|
|
6312
|
+
return this._applyModification(m, arguments);
|
|
6315
6313
|
},
|
|
6316
6314
|
_applyCombination: function(b, F) {
|
|
6317
6315
|
return b.apply(null, [this].concat([].slice.call(F)));
|
|
6318
6316
|
},
|
|
6319
6317
|
analogous: function() {
|
|
6320
|
-
return this._applyCombination(
|
|
6318
|
+
return this._applyCombination(R, arguments);
|
|
6321
6319
|
},
|
|
6322
6320
|
complement: function() {
|
|
6323
6321
|
return this._applyCombination(y, arguments);
|
|
6324
6322
|
},
|
|
6325
6323
|
monochromatic: function() {
|
|
6326
|
-
return this._applyCombination(
|
|
6324
|
+
return this._applyCombination(x, arguments);
|
|
6327
6325
|
},
|
|
6328
6326
|
splitcomplement: function() {
|
|
6329
6327
|
return this._applyCombination(O, arguments);
|
|
@@ -6352,10 +6350,10 @@ function su() {
|
|
|
6352
6350
|
r: 0,
|
|
6353
6351
|
g: 0,
|
|
6354
6352
|
b: 0
|
|
6355
|
-
}, F = 1, S = null, B = null, _ = null,
|
|
6356
|
-
return typeof E == "string" && (E = pi(E)), o(E) == "object" && (he(E.r) && he(E.g) && he(E.b) ? (b = a(E.r, E.g, E.b),
|
|
6357
|
-
ok:
|
|
6358
|
-
format: E.format ||
|
|
6353
|
+
}, F = 1, S = null, B = null, _ = null, M = !1, G = !1;
|
|
6354
|
+
return typeof E == "string" && (E = pi(E)), o(E) == "object" && (he(E.r) && he(E.g) && he(E.b) ? (b = a(E.r, E.g, E.b), M = !0, G = String(E.r).substr(-1) === "%" ? "prgb" : "rgb") : he(E.h) && he(E.s) && he(E.v) ? (S = ce(E.s), B = ce(E.v), b = v(E.h, S, B), M = !0, G = "hsv") : he(E.h) && he(E.s) && he(E.l) && (S = ce(E.s), _ = ce(E.l), b = C(E.h, S, _), M = !0, G = "hsl"), E.hasOwnProperty("a") && (F = E.a)), F = Y(F), {
|
|
6355
|
+
ok: M,
|
|
6356
|
+
format: E.format || G,
|
|
6359
6357
|
r: Math.min(255, Math.max(b.r, 0)),
|
|
6360
6358
|
g: Math.min(255, Math.max(b.g, 0)),
|
|
6361
6359
|
b: Math.min(255, Math.max(b.b, 0)),
|
|
@@ -6364,48 +6362,48 @@ function su() {
|
|
|
6364
6362
|
}
|
|
6365
6363
|
function a(E, b, F) {
|
|
6366
6364
|
return {
|
|
6367
|
-
r:
|
|
6368
|
-
g:
|
|
6369
|
-
b:
|
|
6365
|
+
r: T(E, 255) * 255,
|
|
6366
|
+
g: T(b, 255) * 255,
|
|
6367
|
+
b: T(F, 255) * 255
|
|
6370
6368
|
};
|
|
6371
6369
|
}
|
|
6372
6370
|
function l(E, b, F) {
|
|
6373
|
-
E =
|
|
6374
|
-
var S = Math.max(E, b, F), B = Math.min(E, b, F), _,
|
|
6371
|
+
E = T(E, 255), b = T(b, 255), F = T(F, 255);
|
|
6372
|
+
var S = Math.max(E, b, F), B = Math.min(E, b, F), _, M, G = (S + B) / 2;
|
|
6375
6373
|
if (S == B)
|
|
6376
|
-
_ =
|
|
6374
|
+
_ = M = 0;
|
|
6377
6375
|
else {
|
|
6378
|
-
var
|
|
6379
|
-
switch (
|
|
6376
|
+
var q = S - B;
|
|
6377
|
+
switch (M = G > 0.5 ? q / (2 - S - B) : q / (S + B), S) {
|
|
6380
6378
|
case E:
|
|
6381
|
-
_ = (b - F) /
|
|
6379
|
+
_ = (b - F) / q + (b < F ? 6 : 0);
|
|
6382
6380
|
break;
|
|
6383
6381
|
case b:
|
|
6384
|
-
_ = (F - E) /
|
|
6382
|
+
_ = (F - E) / q + 2;
|
|
6385
6383
|
break;
|
|
6386
6384
|
case F:
|
|
6387
|
-
_ = (E - b) /
|
|
6385
|
+
_ = (E - b) / q + 4;
|
|
6388
6386
|
break;
|
|
6389
6387
|
}
|
|
6390
6388
|
_ /= 6;
|
|
6391
6389
|
}
|
|
6392
6390
|
return {
|
|
6393
6391
|
h: _,
|
|
6394
|
-
s:
|
|
6395
|
-
l:
|
|
6392
|
+
s: M,
|
|
6393
|
+
l: G
|
|
6396
6394
|
};
|
|
6397
6395
|
}
|
|
6398
6396
|
function C(E, b, F) {
|
|
6399
6397
|
var S, B, _;
|
|
6400
|
-
E =
|
|
6401
|
-
function
|
|
6398
|
+
E = T(E, 360), b = T(b, 100), F = T(F, 100);
|
|
6399
|
+
function M(ie, be, oe) {
|
|
6402
6400
|
return oe < 0 && (oe += 1), oe > 1 && (oe -= 1), oe < 1 / 6 ? ie + (be - ie) * 6 * oe : oe < 1 / 2 ? be : oe < 2 / 3 ? ie + (be - ie) * (2 / 3 - oe) * 6 : ie;
|
|
6403
6401
|
}
|
|
6404
6402
|
if (b === 0)
|
|
6405
6403
|
S = B = _ = F;
|
|
6406
6404
|
else {
|
|
6407
|
-
var
|
|
6408
|
-
S =
|
|
6405
|
+
var G = F < 0.5 ? F * (1 + b) : F + b - F * b, q = 2 * F - G;
|
|
6406
|
+
S = M(q, G, E + 1 / 3), B = M(q, G, E), _ = M(q, G, E - 1 / 3);
|
|
6409
6407
|
}
|
|
6410
6408
|
return {
|
|
6411
6409
|
r: S * 255,
|
|
@@ -6413,34 +6411,34 @@ function su() {
|
|
|
6413
6411
|
b: _ * 255
|
|
6414
6412
|
};
|
|
6415
6413
|
}
|
|
6416
|
-
function
|
|
6417
|
-
E =
|
|
6418
|
-
var S = Math.max(E, b, F), B = Math.min(E, b, F), _,
|
|
6419
|
-
if (
|
|
6414
|
+
function d(E, b, F) {
|
|
6415
|
+
E = T(E, 255), b = T(b, 255), F = T(F, 255);
|
|
6416
|
+
var S = Math.max(E, b, F), B = Math.min(E, b, F), _, M, G = S, q = S - B;
|
|
6417
|
+
if (M = S === 0 ? 0 : q / S, S == B)
|
|
6420
6418
|
_ = 0;
|
|
6421
6419
|
else {
|
|
6422
6420
|
switch (S) {
|
|
6423
6421
|
case E:
|
|
6424
|
-
_ = (b - F) /
|
|
6422
|
+
_ = (b - F) / q + (b < F ? 6 : 0);
|
|
6425
6423
|
break;
|
|
6426
6424
|
case b:
|
|
6427
|
-
_ = (F - E) /
|
|
6425
|
+
_ = (F - E) / q + 2;
|
|
6428
6426
|
break;
|
|
6429
6427
|
case F:
|
|
6430
|
-
_ = (E - b) /
|
|
6428
|
+
_ = (E - b) / q + 4;
|
|
6431
6429
|
break;
|
|
6432
6430
|
}
|
|
6433
6431
|
_ /= 6;
|
|
6434
6432
|
}
|
|
6435
6433
|
return {
|
|
6436
6434
|
h: _,
|
|
6437
|
-
s:
|
|
6438
|
-
v:
|
|
6435
|
+
s: M,
|
|
6436
|
+
v: G
|
|
6439
6437
|
};
|
|
6440
6438
|
}
|
|
6441
6439
|
function v(E, b, F) {
|
|
6442
|
-
E =
|
|
6443
|
-
var S = Math.floor(E), B = E - S, _ = F * (1 - b),
|
|
6440
|
+
E = T(E, 360) * 6, b = T(b, 100), F = T(F, 100);
|
|
6441
|
+
var S = Math.floor(E), B = E - S, _ = F * (1 - b), M = F * (1 - B * b), G = F * (1 - (1 - B) * b), q = S % 6, ie = [F, M, _, _, G, F][q], be = [G, F, F, M, _, _][q], oe = [_, _, G, F, F, M][q];
|
|
6444
6442
|
return {
|
|
6445
6443
|
r: ie * 255,
|
|
6446
6444
|
g: be * 255,
|
|
@@ -6455,7 +6453,7 @@ function su() {
|
|
|
6455
6453
|
var _ = [K(Math.round(E).toString(16)), K(Math.round(b).toString(16)), K(Math.round(F).toString(16)), K(Fe(S))];
|
|
6456
6454
|
return B && _[0].charAt(0) == _[0].charAt(1) && _[1].charAt(0) == _[1].charAt(1) && _[2].charAt(0) == _[2].charAt(1) && _[3].charAt(0) == _[3].charAt(1) ? _[0].charAt(0) + _[1].charAt(0) + _[2].charAt(0) + _[3].charAt(0) : _.join("");
|
|
6457
6455
|
}
|
|
6458
|
-
function
|
|
6456
|
+
function p(E, b, F, S) {
|
|
6459
6457
|
var B = [K(Fe(S)), K(Math.round(E).toString(16)), K(Math.round(b).toString(16)), K(Math.round(F).toString(16))];
|
|
6460
6458
|
return B.join("");
|
|
6461
6459
|
}
|
|
@@ -6471,12 +6469,12 @@ function su() {
|
|
|
6471
6469
|
function f(E, b) {
|
|
6472
6470
|
b = b === 0 ? 0 : b || 10;
|
|
6473
6471
|
var F = r(E).toHsl();
|
|
6474
|
-
return F.s -= b / 100, F.s =
|
|
6472
|
+
return F.s -= b / 100, F.s = W(F.s), r(F);
|
|
6475
6473
|
}
|
|
6476
6474
|
function A(E, b) {
|
|
6477
6475
|
b = b === 0 ? 0 : b || 10;
|
|
6478
6476
|
var F = r(E).toHsl();
|
|
6479
|
-
return F.s += b / 100, F.s =
|
|
6477
|
+
return F.s += b / 100, F.s = W(F.s), r(F);
|
|
6480
6478
|
}
|
|
6481
6479
|
function t(E) {
|
|
6482
6480
|
return r(E).desaturate(100);
|
|
@@ -6484,7 +6482,7 @@ function su() {
|
|
|
6484
6482
|
function c(E, b) {
|
|
6485
6483
|
b = b === 0 ? 0 : b || 10;
|
|
6486
6484
|
var F = r(E).toHsl();
|
|
6487
|
-
return F.l += b / 100, F.l =
|
|
6485
|
+
return F.l += b / 100, F.l = W(F.l), r(F);
|
|
6488
6486
|
}
|
|
6489
6487
|
function g(E, b) {
|
|
6490
6488
|
b = b === 0 ? 0 : b || 10;
|
|
@@ -6494,9 +6492,9 @@ function su() {
|
|
|
6494
6492
|
function u(E, b) {
|
|
6495
6493
|
b = b === 0 ? 0 : b || 10;
|
|
6496
6494
|
var F = r(E).toHsl();
|
|
6497
|
-
return F.l -= b / 100, F.l =
|
|
6495
|
+
return F.l -= b / 100, F.l = W(F.l), r(F);
|
|
6498
6496
|
}
|
|
6499
|
-
function
|
|
6497
|
+
function m(E, b) {
|
|
6500
6498
|
var F = r(E).toHsl(), S = (F.h + b) % 360;
|
|
6501
6499
|
return F.h = S < 0 ? 360 + S : S, r(F);
|
|
6502
6500
|
}
|
|
@@ -6527,32 +6525,32 @@ function su() {
|
|
|
6527
6525
|
l: b.l
|
|
6528
6526
|
})];
|
|
6529
6527
|
}
|
|
6530
|
-
function
|
|
6528
|
+
function R(E, b, F) {
|
|
6531
6529
|
b = b || 6, F = F || 30;
|
|
6532
6530
|
var S = r(E).toHsl(), B = 360 / F, _ = [r(E)];
|
|
6533
6531
|
for (S.h = (S.h - (B * b >> 1) + 720) % 360; --b; )
|
|
6534
6532
|
S.h = (S.h + B) % 360, _.push(r(S));
|
|
6535
6533
|
return _;
|
|
6536
6534
|
}
|
|
6537
|
-
function
|
|
6535
|
+
function x(E, b) {
|
|
6538
6536
|
b = b || 6;
|
|
6539
|
-
for (var F = r(E).toHsv(), S = F.h, B = F.s, _ = F.v,
|
|
6540
|
-
|
|
6537
|
+
for (var F = r(E).toHsv(), S = F.h, B = F.s, _ = F.v, M = [], G = 1 / b; b--; )
|
|
6538
|
+
M.push(r({
|
|
6541
6539
|
h: S,
|
|
6542
6540
|
s: B,
|
|
6543
6541
|
v: _
|
|
6544
|
-
})), _ = (_ +
|
|
6545
|
-
return
|
|
6542
|
+
})), _ = (_ + G) % 1;
|
|
6543
|
+
return M;
|
|
6546
6544
|
}
|
|
6547
6545
|
r.mix = function(E, b, F) {
|
|
6548
6546
|
F = F === 0 ? 0 : F || 50;
|
|
6549
|
-
var S = r(E).toRgb(), B = r(b).toRgb(), _ = F / 100,
|
|
6547
|
+
var S = r(E).toRgb(), B = r(b).toRgb(), _ = F / 100, M = {
|
|
6550
6548
|
r: (B.r - S.r) * _ + S.r,
|
|
6551
6549
|
g: (B.g - S.g) * _ + S.g,
|
|
6552
6550
|
b: (B.b - S.b) * _ + S.b,
|
|
6553
6551
|
a: (B.a - S.a) * _ + S.a
|
|
6554
6552
|
};
|
|
6555
|
-
return r(
|
|
6553
|
+
return r(M);
|
|
6556
6554
|
}, r.readability = function(E, b) {
|
|
6557
6555
|
var F = r(E), S = r(b);
|
|
6558
6556
|
return (Math.max(F.getLuminance(), S.getLuminance()) + 0.05) / (Math.min(F.getLuminance(), S.getLuminance()) + 0.05);
|
|
@@ -6572,16 +6570,16 @@ function su() {
|
|
|
6572
6570
|
}
|
|
6573
6571
|
return _;
|
|
6574
6572
|
}, r.mostReadable = function(E, b, F) {
|
|
6575
|
-
var S = null, B = 0, _,
|
|
6576
|
-
F = F || {},
|
|
6573
|
+
var S = null, B = 0, _, M, G, q;
|
|
6574
|
+
F = F || {}, M = F.includeFallbackColors, G = F.level, q = F.size;
|
|
6577
6575
|
for (var ie = 0; ie < b.length; ie++)
|
|
6578
6576
|
_ = r.readability(E, b[ie]), _ > B && (B = _, S = r(b[ie]));
|
|
6579
6577
|
return r.isReadable(E, S, {
|
|
6580
|
-
level:
|
|
6581
|
-
size:
|
|
6582
|
-
}) || !
|
|
6578
|
+
level: G,
|
|
6579
|
+
size: q
|
|
6580
|
+
}) || !M ? S : (F.includeFallbackColors = !1, r.mostReadable(E, ["#fff", "#000"], F));
|
|
6583
6581
|
};
|
|
6584
|
-
var
|
|
6582
|
+
var P = r.names = {
|
|
6585
6583
|
aliceblue: "f0f8ff",
|
|
6586
6584
|
antiquewhite: "faebd7",
|
|
6587
6585
|
aqua: "0ff",
|
|
@@ -6731,8 +6729,8 @@ function su() {
|
|
|
6731
6729
|
whitesmoke: "f5f5f5",
|
|
6732
6730
|
yellow: "ff0",
|
|
6733
6731
|
yellowgreen: "9acd32"
|
|
6734
|
-
},
|
|
6735
|
-
function
|
|
6732
|
+
}, I = r.hexNames = N(P);
|
|
6733
|
+
function N(E) {
|
|
6736
6734
|
var b = {};
|
|
6737
6735
|
for (var F in E)
|
|
6738
6736
|
E.hasOwnProperty(F) && (b[E[F]] = F);
|
|
@@ -6741,15 +6739,15 @@ function su() {
|
|
|
6741
6739
|
function Y(E) {
|
|
6742
6740
|
return E = parseFloat(E), (isNaN(E) || E < 0 || E > 1) && (E = 1), E;
|
|
6743
6741
|
}
|
|
6744
|
-
function
|
|
6742
|
+
function T(E, b) {
|
|
6745
6743
|
fe(E) && (E = "100%");
|
|
6746
6744
|
var F = ae(E);
|
|
6747
6745
|
return E = Math.min(b, Math.max(0, parseFloat(E))), F && (E = parseInt(E * b, 10) / 100), Math.abs(E - b) < 1e-6 ? 1 : E % b / parseFloat(b);
|
|
6748
6746
|
}
|
|
6749
|
-
function
|
|
6747
|
+
function W(E) {
|
|
6750
6748
|
return Math.min(1, Math.max(0, E));
|
|
6751
6749
|
}
|
|
6752
|
-
function
|
|
6750
|
+
function k(E) {
|
|
6753
6751
|
return parseInt(E, 16);
|
|
6754
6752
|
}
|
|
6755
6753
|
function fe(E) {
|
|
@@ -6768,7 +6766,7 @@ function su() {
|
|
|
6768
6766
|
return Math.round(parseFloat(E) * 255).toString(16);
|
|
6769
6767
|
}
|
|
6770
6768
|
function $t(E) {
|
|
6771
|
-
return
|
|
6769
|
+
return k(E) / 255;
|
|
6772
6770
|
}
|
|
6773
6771
|
var ue = (function() {
|
|
6774
6772
|
var E = "[-\\+]?\\d+%?", b = "[-\\+]?\\d*\\.\\d+%?", F = "(?:" + b + ")|(?:" + E + ")", S = "[\\s|\\(]+(" + F + ")[,|\\s]+(" + F + ")[,|\\s]+(" + F + ")\\s*\\)?", B = "[\\s|\\(]+(" + F + ")[,|\\s]+(" + F + ")[,|\\s]+(" + F + ")[,|\\s]+(" + F + ")\\s*\\)?";
|
|
@@ -6792,8 +6790,8 @@ function su() {
|
|
|
6792
6790
|
function pi(E) {
|
|
6793
6791
|
E = E.replace(h, "").replace(i, "").toLowerCase();
|
|
6794
6792
|
var b = !1;
|
|
6795
|
-
if (
|
|
6796
|
-
E =
|
|
6793
|
+
if (P[E])
|
|
6794
|
+
E = P[E], b = !0;
|
|
6797
6795
|
else if (E == "transparent")
|
|
6798
6796
|
return {
|
|
6799
6797
|
r: 0,
|
|
@@ -6831,26 +6829,26 @@ function su() {
|
|
|
6831
6829
|
v: F[3],
|
|
6832
6830
|
a: F[4]
|
|
6833
6831
|
} : (F = ue.hex8.exec(E)) ? {
|
|
6834
|
-
r:
|
|
6835
|
-
g:
|
|
6836
|
-
b:
|
|
6832
|
+
r: k(F[1]),
|
|
6833
|
+
g: k(F[2]),
|
|
6834
|
+
b: k(F[3]),
|
|
6837
6835
|
a: $t(F[4]),
|
|
6838
6836
|
format: b ? "name" : "hex8"
|
|
6839
6837
|
} : (F = ue.hex6.exec(E)) ? {
|
|
6840
|
-
r:
|
|
6841
|
-
g:
|
|
6842
|
-
b:
|
|
6838
|
+
r: k(F[1]),
|
|
6839
|
+
g: k(F[2]),
|
|
6840
|
+
b: k(F[3]),
|
|
6843
6841
|
format: b ? "name" : "hex"
|
|
6844
6842
|
} : (F = ue.hex4.exec(E)) ? {
|
|
6845
|
-
r:
|
|
6846
|
-
g:
|
|
6847
|
-
b:
|
|
6843
|
+
r: k(F[1] + "" + F[1]),
|
|
6844
|
+
g: k(F[2] + "" + F[2]),
|
|
6845
|
+
b: k(F[3] + "" + F[3]),
|
|
6848
6846
|
a: $t(F[4] + "" + F[4]),
|
|
6849
6847
|
format: b ? "name" : "hex8"
|
|
6850
6848
|
} : (F = ue.hex3.exec(E)) ? {
|
|
6851
|
-
r:
|
|
6852
|
-
g:
|
|
6853
|
-
b:
|
|
6849
|
+
r: k(F[1] + "" + F[1]),
|
|
6850
|
+
g: k(F[2] + "" + F[2]),
|
|
6851
|
+
b: k(F[3] + "" + F[3]),
|
|
6854
6852
|
format: b ? "name" : "hex"
|
|
6855
6853
|
} : !1;
|
|
6856
6854
|
}
|
|
@@ -6873,81 +6871,81 @@ function uu() {
|
|
|
6873
6871
|
if (xr) return Ct;
|
|
6874
6872
|
xr = 1;
|
|
6875
6873
|
const s = su(), n = { r: 256, g: 256, b: 256, a: 1 }, o = { h: 360, s: 1, v: 1, a: 1 };
|
|
6876
|
-
function h(
|
|
6874
|
+
function h(d, v, w) {
|
|
6877
6875
|
let D = {};
|
|
6878
|
-
for (let
|
|
6879
|
-
|
|
6876
|
+
for (let p in d)
|
|
6877
|
+
d.hasOwnProperty(p) && (D[p] = w === 0 ? 0 : (v[p] - d[p]) / w);
|
|
6880
6878
|
return D;
|
|
6881
6879
|
}
|
|
6882
|
-
function i(
|
|
6883
|
-
let
|
|
6880
|
+
function i(d, v, w, D) {
|
|
6881
|
+
let p = {};
|
|
6884
6882
|
for (let f in v)
|
|
6885
|
-
v.hasOwnProperty(f) && (
|
|
6886
|
-
return
|
|
6883
|
+
v.hasOwnProperty(f) && (p[f] = d[f] * w + v[f], p[f] = p[f] < 0 ? p[f] + D[f] : D[f] !== 1 ? p[f] % D[f] : p[f]);
|
|
6884
|
+
return p;
|
|
6887
6885
|
}
|
|
6888
|
-
function r(
|
|
6889
|
-
const D =
|
|
6890
|
-
let A = [
|
|
6886
|
+
function r(d, v, w) {
|
|
6887
|
+
const D = d.color.toRgb(), p = v.color.toRgb(), f = h(D, p, w);
|
|
6888
|
+
let A = [d.color];
|
|
6891
6889
|
for (let t = 1; t < w; t++) {
|
|
6892
6890
|
const c = i(f, D, t, n);
|
|
6893
6891
|
A.push(s(c));
|
|
6894
6892
|
}
|
|
6895
6893
|
return A;
|
|
6896
6894
|
}
|
|
6897
|
-
function e(
|
|
6898
|
-
const
|
|
6899
|
-
if (
|
|
6900
|
-
return r(
|
|
6895
|
+
function e(d, v, w, D) {
|
|
6896
|
+
const p = d.color.toHsv(), f = v.color.toHsv();
|
|
6897
|
+
if (p.s === 0 || f.s === 0)
|
|
6898
|
+
return r(d, v, w);
|
|
6901
6899
|
let A;
|
|
6902
6900
|
if (typeof D == "boolean")
|
|
6903
6901
|
A = D;
|
|
6904
6902
|
else {
|
|
6905
|
-
const u =
|
|
6903
|
+
const u = p.h < f.h && f.h - p.h < 180 || p.h > f.h && p.h - f.h > 180;
|
|
6906
6904
|
A = D === "long" && u || D === "short" && !u;
|
|
6907
6905
|
}
|
|
6908
|
-
const t = h(
|
|
6909
|
-
let c = [
|
|
6910
|
-
|
|
6906
|
+
const t = h(p, f, w);
|
|
6907
|
+
let c = [d.color], g;
|
|
6908
|
+
p.h <= f.h && !A || p.h >= f.h && A ? g = f.h - p.h : A ? g = 360 - f.h + p.h : g = 360 - p.h + f.h, t.h = Math.pow(-1, A ? 1 : 0) * Math.abs(g) / w;
|
|
6911
6909
|
for (let u = 1; u < w; u++) {
|
|
6912
|
-
const
|
|
6913
|
-
c.push(s(
|
|
6910
|
+
const m = i(t, p, u, o);
|
|
6911
|
+
c.push(s(m));
|
|
6914
6912
|
}
|
|
6915
6913
|
return c;
|
|
6916
6914
|
}
|
|
6917
|
-
function a(
|
|
6918
|
-
const w =
|
|
6915
|
+
function a(d, v) {
|
|
6916
|
+
const w = d.length;
|
|
6919
6917
|
if (v = parseInt(v, 10), isNaN(v) || v < 2)
|
|
6920
6918
|
throw new Error("Invalid number of steps (< 2)");
|
|
6921
6919
|
if (v < w)
|
|
6922
6920
|
throw new Error("Number of steps cannot be inferior to number of stops");
|
|
6923
6921
|
let D = [];
|
|
6924
6922
|
for (let f = 1; f < w; f++) {
|
|
6925
|
-
const A = (v - 1) * (
|
|
6923
|
+
const A = (v - 1) * (d[f].pos - d[f - 1].pos);
|
|
6926
6924
|
D.push(Math.max(1, Math.round(A)));
|
|
6927
6925
|
}
|
|
6928
|
-
let
|
|
6929
|
-
for (let f = w - 1; f--; )
|
|
6930
|
-
for (;
|
|
6931
|
-
if (
|
|
6926
|
+
let p = 1;
|
|
6927
|
+
for (let f = w - 1; f--; ) p += D[f];
|
|
6928
|
+
for (; p !== v; )
|
|
6929
|
+
if (p < v) {
|
|
6932
6930
|
const f = Math.min.apply(null, D);
|
|
6933
|
-
D[D.indexOf(f)]++,
|
|
6931
|
+
D[D.indexOf(f)]++, p++;
|
|
6934
6932
|
} else {
|
|
6935
6933
|
const f = Math.max.apply(null, D);
|
|
6936
|
-
D[D.indexOf(f)]--,
|
|
6934
|
+
D[D.indexOf(f)]--, p--;
|
|
6937
6935
|
}
|
|
6938
6936
|
return D;
|
|
6939
6937
|
}
|
|
6940
|
-
function l(
|
|
6938
|
+
function l(d, v, w, D) {
|
|
6941
6939
|
if (v < 0 || v > 1)
|
|
6942
6940
|
throw new Error("Position must be between 0 and 1");
|
|
6943
|
-
let
|
|
6944
|
-
for (let c = 0, g =
|
|
6945
|
-
if (v >=
|
|
6946
|
-
|
|
6941
|
+
let p, f;
|
|
6942
|
+
for (let c = 0, g = d.length; c < g - 1; c++)
|
|
6943
|
+
if (v >= d[c].pos && v < d[c + 1].pos) {
|
|
6944
|
+
p = d[c], f = d[c + 1];
|
|
6947
6945
|
break;
|
|
6948
6946
|
}
|
|
6949
|
-
|
|
6950
|
-
const A = h(
|
|
6947
|
+
p || (p = f = d[d.length - 1]);
|
|
6948
|
+
const A = h(p.color[w](), f.color[w](), (f.pos - p.pos) * 100), t = i(A, p.color[w](), (v - p.pos) * 100, D);
|
|
6951
6949
|
return s(t);
|
|
6952
6950
|
}
|
|
6953
6951
|
class C {
|
|
@@ -6959,7 +6957,7 @@ function uu() {
|
|
|
6959
6957
|
if (v.length < 2)
|
|
6960
6958
|
throw new Error("Invalid number of stops (< 2)");
|
|
6961
6959
|
const w = v[0].pos !== void 0;
|
|
6962
|
-
let D = v.length,
|
|
6960
|
+
let D = v.length, p = -1, f = !1;
|
|
6963
6961
|
this.stops = v.map((A, t) => {
|
|
6964
6962
|
const c = A.pos !== void 0;
|
|
6965
6963
|
if (w ^ c)
|
|
@@ -6974,9 +6972,9 @@ function uu() {
|
|
|
6974
6972
|
pos: A.pos
|
|
6975
6973
|
}, A.pos < 0 || A.pos > 1)
|
|
6976
6974
|
throw new Error("Color stops positions must be between 0 and 1");
|
|
6977
|
-
if (A.pos <
|
|
6975
|
+
if (A.pos < p)
|
|
6978
6976
|
throw new Error("Color stops positions are not ordered");
|
|
6979
|
-
|
|
6977
|
+
p = A.pos;
|
|
6980
6978
|
} else
|
|
6981
6979
|
A = {
|
|
6982
6980
|
color: s(A.color !== void 0 ? A.color : A),
|
|
@@ -7030,11 +7028,11 @@ function uu() {
|
|
|
7030
7028
|
rgb(v) {
|
|
7031
7029
|
const w = a(this.stops, v);
|
|
7032
7030
|
let D = [];
|
|
7033
|
-
this.stops.forEach((
|
|
7034
|
-
|
|
7031
|
+
this.stops.forEach((p, f) => {
|
|
7032
|
+
p.colorLess && (p.color = r(this.stops[f - 1], this.stops[f + 1], 2)[1]);
|
|
7035
7033
|
});
|
|
7036
|
-
for (let
|
|
7037
|
-
const A = r(this.stops[
|
|
7034
|
+
for (let p = 0, f = this.stops.length; p < f - 1; p++) {
|
|
7035
|
+
const A = r(this.stops[p], this.stops[p + 1], w[p]);
|
|
7038
7036
|
D.splice(D.length, 0, ...A);
|
|
7039
7037
|
}
|
|
7040
7038
|
return D.push(this.stops[this.stops.length - 1].color), D;
|
|
@@ -7051,15 +7049,15 @@ function uu() {
|
|
|
7051
7049
|
*/
|
|
7052
7050
|
hsv(v, w) {
|
|
7053
7051
|
const D = a(this.stops, v);
|
|
7054
|
-
let
|
|
7052
|
+
let p = [];
|
|
7055
7053
|
this.stops.forEach((f, A) => {
|
|
7056
7054
|
f.colorLess && (f.color = e(this.stops[A - 1], this.stops[A + 1], 2, w)[1]);
|
|
7057
7055
|
});
|
|
7058
7056
|
for (let f = 0, A = this.stops.length; f < A - 1; f++) {
|
|
7059
7057
|
const t = e(this.stops[f], this.stops[f + 1], D[f], w);
|
|
7060
|
-
|
|
7058
|
+
p.splice(p.length, 0, ...t);
|
|
7061
7059
|
}
|
|
7062
|
-
return
|
|
7060
|
+
return p.push(this.stops[this.stops.length - 1].color), p;
|
|
7063
7061
|
}
|
|
7064
7062
|
/**
|
|
7065
7063
|
* Generate CSS3 command (no prefix) for this gradient
|
|
@@ -7070,8 +7068,8 @@ function uu() {
|
|
|
7070
7068
|
css(v, w) {
|
|
7071
7069
|
v = v || "linear", w = w || (v === "linear" ? "to right" : "ellipse at center");
|
|
7072
7070
|
let D = v + "-gradient(" + w;
|
|
7073
|
-
return this.stops.forEach(function(
|
|
7074
|
-
D += ", " + (
|
|
7071
|
+
return this.stops.forEach(function(p) {
|
|
7072
|
+
D += ", " + (p.colorLess ? "" : p.color.toRgbString() + " ") + p.pos * 100 + "%";
|
|
7075
7073
|
}), D += ")", D;
|
|
7076
7074
|
}
|
|
7077
7075
|
/**
|
|
@@ -7091,14 +7089,14 @@ function uu() {
|
|
|
7091
7089
|
return l(this.stops, v, "toHsv", o);
|
|
7092
7090
|
}
|
|
7093
7091
|
}
|
|
7094
|
-
return Ct = function(
|
|
7092
|
+
return Ct = function(d) {
|
|
7095
7093
|
if (arguments.length === 1) {
|
|
7096
7094
|
if (!Array.isArray(arguments[0]))
|
|
7097
7095
|
throw new Error('"stops" is not an array');
|
|
7098
|
-
|
|
7096
|
+
d = arguments[0];
|
|
7099
7097
|
} else
|
|
7100
|
-
|
|
7101
|
-
return new C(
|
|
7098
|
+
d = Array.prototype.slice.call(arguments);
|
|
7099
|
+
return new C(d);
|
|
7102
7100
|
}, Ct;
|
|
7103
7101
|
}
|
|
7104
7102
|
var ou = uu();
|
|
@@ -7128,10 +7126,10 @@ function lu(s, n, o) {
|
|
|
7128
7126
|
`), r = Math.max(...i.map((l) => l.length), n.stops.length), e = ui(n, h, r), a = [];
|
|
7129
7127
|
for (const l of i) {
|
|
7130
7128
|
const C = e.slice(0);
|
|
7131
|
-
let
|
|
7129
|
+
let d = "";
|
|
7132
7130
|
for (const v of l)
|
|
7133
|
-
|
|
7134
|
-
a.push(
|
|
7131
|
+
d += z.hex(C.shift()?.toHex() || "#000")(v);
|
|
7132
|
+
a.push(d);
|
|
7135
7133
|
}
|
|
7136
7134
|
return a.join(`
|
|
7137
7135
|
`);
|
|
@@ -7319,12 +7317,12 @@ async function Su(s) {
|
|
|
7319
7317
|
);
|
|
7320
7318
|
const {
|
|
7321
7319
|
name: C,
|
|
7322
|
-
version:
|
|
7320
|
+
version: d,
|
|
7323
7321
|
"acme:scripts": v,
|
|
7324
7322
|
...w
|
|
7325
|
-
} = await Yr(i), D =
|
|
7323
|
+
} = await Yr(i), D = d.split(".").slice(0, 2), p = o.includes("release"), f = p ? `~${D.join(".")}.0` : `>=${D.join(".")}.0-next <${D[0]}.${Number.parseInt(D[1]) + 1}.0`, A = w.files?.filter(
|
|
7326
7324
|
(g) => g !== "*" && !g.includes("Publishing source code for demo purposes only")
|
|
7327
|
-
), t =
|
|
7325
|
+
), t = p ? void 0 : {
|
|
7328
7326
|
"@esri/calcite-components/@arcgis/lumina": f,
|
|
7329
7327
|
"@esri/calcite-components/@arcgis/toolkit": f
|
|
7330
7328
|
}, c = {
|