create-zenith-plugin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -0
- package/dist/cli.js +2864 -0
- package/dist/index.js +2864 -0
- package/package.json +25 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,2864 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
|
|
20
|
+
// node_modules/sisteransi/src/index.js
|
|
21
|
+
var require_src = __commonJS((exports, module) => {
|
|
22
|
+
var ESC = "\x1B";
|
|
23
|
+
var CSI = `${ESC}[`;
|
|
24
|
+
var beep = "\x07";
|
|
25
|
+
var cursor = {
|
|
26
|
+
to(x, y) {
|
|
27
|
+
if (!y)
|
|
28
|
+
return `${CSI}${x + 1}G`;
|
|
29
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
30
|
+
},
|
|
31
|
+
move(x, y) {
|
|
32
|
+
let ret = "";
|
|
33
|
+
if (x < 0)
|
|
34
|
+
ret += `${CSI}${-x}D`;
|
|
35
|
+
else if (x > 0)
|
|
36
|
+
ret += `${CSI}${x}C`;
|
|
37
|
+
if (y < 0)
|
|
38
|
+
ret += `${CSI}${-y}A`;
|
|
39
|
+
else if (y > 0)
|
|
40
|
+
ret += `${CSI}${y}B`;
|
|
41
|
+
return ret;
|
|
42
|
+
},
|
|
43
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
44
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
45
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
46
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
47
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
48
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
49
|
+
left: `${CSI}G`,
|
|
50
|
+
hide: `${CSI}?25l`,
|
|
51
|
+
show: `${CSI}?25h`,
|
|
52
|
+
save: `${ESC}7`,
|
|
53
|
+
restore: `${ESC}8`
|
|
54
|
+
};
|
|
55
|
+
var scroll = {
|
|
56
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
57
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
58
|
+
};
|
|
59
|
+
var erase = {
|
|
60
|
+
screen: `${CSI}2J`,
|
|
61
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
62
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
63
|
+
line: `${CSI}2K`,
|
|
64
|
+
lineEnd: `${CSI}K`,
|
|
65
|
+
lineStart: `${CSI}1K`,
|
|
66
|
+
lines(count) {
|
|
67
|
+
let clear = "";
|
|
68
|
+
for (let i = 0;i < count; i++)
|
|
69
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
70
|
+
if (count)
|
|
71
|
+
clear += cursor.left;
|
|
72
|
+
return clear;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// node_modules/picocolors/picocolors.js
|
|
79
|
+
var require_picocolors = __commonJS((exports, module) => {
|
|
80
|
+
var p = process || {};
|
|
81
|
+
var argv = p.argv || [];
|
|
82
|
+
var env = p.env || {};
|
|
83
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
84
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
85
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
86
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
87
|
+
};
|
|
88
|
+
var replaceClose = (string, close, replace, index) => {
|
|
89
|
+
let result = "", cursor = 0;
|
|
90
|
+
do {
|
|
91
|
+
result += string.substring(cursor, index) + replace;
|
|
92
|
+
cursor = index + close.length;
|
|
93
|
+
index = string.indexOf(close, cursor);
|
|
94
|
+
} while (~index);
|
|
95
|
+
return result + string.substring(cursor);
|
|
96
|
+
};
|
|
97
|
+
var createColors = (enabled = isColorSupported) => {
|
|
98
|
+
let f = enabled ? formatter : () => String;
|
|
99
|
+
return {
|
|
100
|
+
isColorSupported: enabled,
|
|
101
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
102
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
103
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
104
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
105
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
106
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
107
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
108
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
109
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
110
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
111
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
112
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
113
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
114
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
115
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
116
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
117
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
118
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
119
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
120
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
121
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
122
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
123
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
124
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
125
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
126
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
127
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
128
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
129
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
130
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
131
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
132
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
133
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
134
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
135
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
136
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
137
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
138
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
139
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
140
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
141
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
module.exports = createColors();
|
|
145
|
+
module.exports.createColors = createColors;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// node_modules/tinycolor2/cjs/tinycolor.js
|
|
149
|
+
var require_tinycolor = __commonJS((exports, module) => {
|
|
150
|
+
(function(global, factory) {
|
|
151
|
+
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.tinycolor = factory());
|
|
152
|
+
})(exports, function() {
|
|
153
|
+
function _typeof(obj) {
|
|
154
|
+
"@babel/helpers - typeof";
|
|
155
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
|
|
156
|
+
return typeof obj2;
|
|
157
|
+
} : function(obj2) {
|
|
158
|
+
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
159
|
+
}, _typeof(obj);
|
|
160
|
+
}
|
|
161
|
+
var trimLeft = /^\s+/;
|
|
162
|
+
var trimRight = /\s+$/;
|
|
163
|
+
function tinycolor(color, opts) {
|
|
164
|
+
color = color ? color : "";
|
|
165
|
+
opts = opts || {};
|
|
166
|
+
if (color instanceof tinycolor) {
|
|
167
|
+
return color;
|
|
168
|
+
}
|
|
169
|
+
if (!(this instanceof tinycolor)) {
|
|
170
|
+
return new tinycolor(color, opts);
|
|
171
|
+
}
|
|
172
|
+
var rgb = inputToRGB(color);
|
|
173
|
+
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
174
|
+
this._gradientType = opts.gradientType;
|
|
175
|
+
if (this._r < 1)
|
|
176
|
+
this._r = Math.round(this._r);
|
|
177
|
+
if (this._g < 1)
|
|
178
|
+
this._g = Math.round(this._g);
|
|
179
|
+
if (this._b < 1)
|
|
180
|
+
this._b = Math.round(this._b);
|
|
181
|
+
this._ok = rgb.ok;
|
|
182
|
+
}
|
|
183
|
+
tinycolor.prototype = {
|
|
184
|
+
isDark: function isDark() {
|
|
185
|
+
return this.getBrightness() < 128;
|
|
186
|
+
},
|
|
187
|
+
isLight: function isLight() {
|
|
188
|
+
return !this.isDark();
|
|
189
|
+
},
|
|
190
|
+
isValid: function isValid() {
|
|
191
|
+
return this._ok;
|
|
192
|
+
},
|
|
193
|
+
getOriginalInput: function getOriginalInput() {
|
|
194
|
+
return this._originalInput;
|
|
195
|
+
},
|
|
196
|
+
getFormat: function getFormat() {
|
|
197
|
+
return this._format;
|
|
198
|
+
},
|
|
199
|
+
getAlpha: function getAlpha() {
|
|
200
|
+
return this._a;
|
|
201
|
+
},
|
|
202
|
+
getBrightness: function getBrightness() {
|
|
203
|
+
var rgb = this.toRgb();
|
|
204
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
205
|
+
},
|
|
206
|
+
getLuminance: function getLuminance() {
|
|
207
|
+
var rgb = this.toRgb();
|
|
208
|
+
var RsRGB, GsRGB, BsRGB, R2, G3, B2;
|
|
209
|
+
RsRGB = rgb.r / 255;
|
|
210
|
+
GsRGB = rgb.g / 255;
|
|
211
|
+
BsRGB = rgb.b / 255;
|
|
212
|
+
if (RsRGB <= 0.03928)
|
|
213
|
+
R2 = RsRGB / 12.92;
|
|
214
|
+
else
|
|
215
|
+
R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
216
|
+
if (GsRGB <= 0.03928)
|
|
217
|
+
G3 = GsRGB / 12.92;
|
|
218
|
+
else
|
|
219
|
+
G3 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
220
|
+
if (BsRGB <= 0.03928)
|
|
221
|
+
B2 = BsRGB / 12.92;
|
|
222
|
+
else
|
|
223
|
+
B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
224
|
+
return 0.2126 * R2 + 0.7152 * G3 + 0.0722 * B2;
|
|
225
|
+
},
|
|
226
|
+
setAlpha: function setAlpha(value) {
|
|
227
|
+
this._a = boundAlpha(value);
|
|
228
|
+
this._roundA = Math.round(100 * this._a) / 100;
|
|
229
|
+
return this;
|
|
230
|
+
},
|
|
231
|
+
toHsv: function toHsv() {
|
|
232
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
233
|
+
return {
|
|
234
|
+
h: hsv.h * 360,
|
|
235
|
+
s: hsv.s,
|
|
236
|
+
v: hsv.v,
|
|
237
|
+
a: this._a
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
toHsvString: function toHsvString() {
|
|
241
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
242
|
+
var h2 = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v2 = Math.round(hsv.v * 100);
|
|
243
|
+
return this._a == 1 ? "hsv(" + h2 + ", " + s + "%, " + v2 + "%)" : "hsva(" + h2 + ", " + s + "%, " + v2 + "%, " + this._roundA + ")";
|
|
244
|
+
},
|
|
245
|
+
toHsl: function toHsl() {
|
|
246
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
247
|
+
return {
|
|
248
|
+
h: hsl.h * 360,
|
|
249
|
+
s: hsl.s,
|
|
250
|
+
l: hsl.l,
|
|
251
|
+
a: this._a
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
toHslString: function toHslString() {
|
|
255
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
256
|
+
var h2 = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l2 = Math.round(hsl.l * 100);
|
|
257
|
+
return this._a == 1 ? "hsl(" + h2 + ", " + s + "%, " + l2 + "%)" : "hsla(" + h2 + ", " + s + "%, " + l2 + "%, " + this._roundA + ")";
|
|
258
|
+
},
|
|
259
|
+
toHex: function toHex(allow3Char) {
|
|
260
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
261
|
+
},
|
|
262
|
+
toHexString: function toHexString(allow3Char) {
|
|
263
|
+
return "#" + this.toHex(allow3Char);
|
|
264
|
+
},
|
|
265
|
+
toHex8: function toHex8(allow4Char) {
|
|
266
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
267
|
+
},
|
|
268
|
+
toHex8String: function toHex8String(allow4Char) {
|
|
269
|
+
return "#" + this.toHex8(allow4Char);
|
|
270
|
+
},
|
|
271
|
+
toRgb: function toRgb() {
|
|
272
|
+
return {
|
|
273
|
+
r: Math.round(this._r),
|
|
274
|
+
g: Math.round(this._g),
|
|
275
|
+
b: Math.round(this._b),
|
|
276
|
+
a: this._a
|
|
277
|
+
};
|
|
278
|
+
},
|
|
279
|
+
toRgbString: function toRgbString() {
|
|
280
|
+
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
281
|
+
},
|
|
282
|
+
toPercentageRgb: function toPercentageRgb() {
|
|
283
|
+
return {
|
|
284
|
+
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
285
|
+
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
286
|
+
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
287
|
+
a: this._a
|
|
288
|
+
};
|
|
289
|
+
},
|
|
290
|
+
toPercentageRgbString: function toPercentageRgbString() {
|
|
291
|
+
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
292
|
+
},
|
|
293
|
+
toName: function toName() {
|
|
294
|
+
if (this._a === 0) {
|
|
295
|
+
return "transparent";
|
|
296
|
+
}
|
|
297
|
+
if (this._a < 1) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
301
|
+
},
|
|
302
|
+
toFilter: function toFilter(secondColor) {
|
|
303
|
+
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
304
|
+
var secondHex8String = hex8String;
|
|
305
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
306
|
+
if (secondColor) {
|
|
307
|
+
var s = tinycolor(secondColor);
|
|
308
|
+
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
309
|
+
}
|
|
310
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
311
|
+
},
|
|
312
|
+
toString: function toString(format) {
|
|
313
|
+
var formatSet = !!format;
|
|
314
|
+
format = format || this._format;
|
|
315
|
+
var formattedString = false;
|
|
316
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
317
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
318
|
+
if (needsAlphaFormat) {
|
|
319
|
+
if (format === "name" && this._a === 0) {
|
|
320
|
+
return this.toName();
|
|
321
|
+
}
|
|
322
|
+
return this.toRgbString();
|
|
323
|
+
}
|
|
324
|
+
if (format === "rgb") {
|
|
325
|
+
formattedString = this.toRgbString();
|
|
326
|
+
}
|
|
327
|
+
if (format === "prgb") {
|
|
328
|
+
formattedString = this.toPercentageRgbString();
|
|
329
|
+
}
|
|
330
|
+
if (format === "hex" || format === "hex6") {
|
|
331
|
+
formattedString = this.toHexString();
|
|
332
|
+
}
|
|
333
|
+
if (format === "hex3") {
|
|
334
|
+
formattedString = this.toHexString(true);
|
|
335
|
+
}
|
|
336
|
+
if (format === "hex4") {
|
|
337
|
+
formattedString = this.toHex8String(true);
|
|
338
|
+
}
|
|
339
|
+
if (format === "hex8") {
|
|
340
|
+
formattedString = this.toHex8String();
|
|
341
|
+
}
|
|
342
|
+
if (format === "name") {
|
|
343
|
+
formattedString = this.toName();
|
|
344
|
+
}
|
|
345
|
+
if (format === "hsl") {
|
|
346
|
+
formattedString = this.toHslString();
|
|
347
|
+
}
|
|
348
|
+
if (format === "hsv") {
|
|
349
|
+
formattedString = this.toHsvString();
|
|
350
|
+
}
|
|
351
|
+
return formattedString || this.toHexString();
|
|
352
|
+
},
|
|
353
|
+
clone: function clone() {
|
|
354
|
+
return tinycolor(this.toString());
|
|
355
|
+
},
|
|
356
|
+
_applyModification: function _applyModification(fn, args) {
|
|
357
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
358
|
+
this._r = color._r;
|
|
359
|
+
this._g = color._g;
|
|
360
|
+
this._b = color._b;
|
|
361
|
+
this.setAlpha(color._a);
|
|
362
|
+
return this;
|
|
363
|
+
},
|
|
364
|
+
lighten: function lighten() {
|
|
365
|
+
return this._applyModification(_lighten, arguments);
|
|
366
|
+
},
|
|
367
|
+
brighten: function brighten() {
|
|
368
|
+
return this._applyModification(_brighten, arguments);
|
|
369
|
+
},
|
|
370
|
+
darken: function darken() {
|
|
371
|
+
return this._applyModification(_darken, arguments);
|
|
372
|
+
},
|
|
373
|
+
desaturate: function desaturate() {
|
|
374
|
+
return this._applyModification(_desaturate, arguments);
|
|
375
|
+
},
|
|
376
|
+
saturate: function saturate() {
|
|
377
|
+
return this._applyModification(_saturate, arguments);
|
|
378
|
+
},
|
|
379
|
+
greyscale: function greyscale() {
|
|
380
|
+
return this._applyModification(_greyscale, arguments);
|
|
381
|
+
},
|
|
382
|
+
spin: function spin() {
|
|
383
|
+
return this._applyModification(_spin, arguments);
|
|
384
|
+
},
|
|
385
|
+
_applyCombination: function _applyCombination(fn, args) {
|
|
386
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
387
|
+
},
|
|
388
|
+
analogous: function analogous() {
|
|
389
|
+
return this._applyCombination(_analogous, arguments);
|
|
390
|
+
},
|
|
391
|
+
complement: function complement() {
|
|
392
|
+
return this._applyCombination(_complement, arguments);
|
|
393
|
+
},
|
|
394
|
+
monochromatic: function monochromatic() {
|
|
395
|
+
return this._applyCombination(_monochromatic, arguments);
|
|
396
|
+
},
|
|
397
|
+
splitcomplement: function splitcomplement() {
|
|
398
|
+
return this._applyCombination(_splitcomplement, arguments);
|
|
399
|
+
},
|
|
400
|
+
triad: function triad() {
|
|
401
|
+
return this._applyCombination(polyad, [3]);
|
|
402
|
+
},
|
|
403
|
+
tetrad: function tetrad() {
|
|
404
|
+
return this._applyCombination(polyad, [4]);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
408
|
+
if (_typeof(color) == "object") {
|
|
409
|
+
var newColor = {};
|
|
410
|
+
for (var i in color) {
|
|
411
|
+
if (color.hasOwnProperty(i)) {
|
|
412
|
+
if (i === "a") {
|
|
413
|
+
newColor[i] = color[i];
|
|
414
|
+
} else {
|
|
415
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
color = newColor;
|
|
420
|
+
}
|
|
421
|
+
return tinycolor(color, opts);
|
|
422
|
+
};
|
|
423
|
+
function inputToRGB(color) {
|
|
424
|
+
var rgb = {
|
|
425
|
+
r: 0,
|
|
426
|
+
g: 0,
|
|
427
|
+
b: 0
|
|
428
|
+
};
|
|
429
|
+
var a = 1;
|
|
430
|
+
var s = null;
|
|
431
|
+
var v2 = null;
|
|
432
|
+
var l2 = null;
|
|
433
|
+
var ok = false;
|
|
434
|
+
var format = false;
|
|
435
|
+
if (typeof color == "string") {
|
|
436
|
+
color = stringInputToObject(color);
|
|
437
|
+
}
|
|
438
|
+
if (_typeof(color) == "object") {
|
|
439
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
440
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
441
|
+
ok = true;
|
|
442
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
443
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
444
|
+
s = convertToPercentage(color.s);
|
|
445
|
+
v2 = convertToPercentage(color.v);
|
|
446
|
+
rgb = hsvToRgb(color.h, s, v2);
|
|
447
|
+
ok = true;
|
|
448
|
+
format = "hsv";
|
|
449
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
450
|
+
s = convertToPercentage(color.s);
|
|
451
|
+
l2 = convertToPercentage(color.l);
|
|
452
|
+
rgb = hslToRgb(color.h, s, l2);
|
|
453
|
+
ok = true;
|
|
454
|
+
format = "hsl";
|
|
455
|
+
}
|
|
456
|
+
if (color.hasOwnProperty("a")) {
|
|
457
|
+
a = color.a;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
a = boundAlpha(a);
|
|
461
|
+
return {
|
|
462
|
+
ok,
|
|
463
|
+
format: color.format || format,
|
|
464
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
465
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
466
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
467
|
+
a
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function rgbToRgb(r2, g2, b3) {
|
|
471
|
+
return {
|
|
472
|
+
r: bound01(r2, 255) * 255,
|
|
473
|
+
g: bound01(g2, 255) * 255,
|
|
474
|
+
b: bound01(b3, 255) * 255
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function rgbToHsl(r2, g2, b3) {
|
|
478
|
+
r2 = bound01(r2, 255);
|
|
479
|
+
g2 = bound01(g2, 255);
|
|
480
|
+
b3 = bound01(b3, 255);
|
|
481
|
+
var max = Math.max(r2, g2, b3), min = Math.min(r2, g2, b3);
|
|
482
|
+
var h2, s, l2 = (max + min) / 2;
|
|
483
|
+
if (max == min) {
|
|
484
|
+
h2 = s = 0;
|
|
485
|
+
} else {
|
|
486
|
+
var d3 = max - min;
|
|
487
|
+
s = l2 > 0.5 ? d3 / (2 - max - min) : d3 / (max + min);
|
|
488
|
+
switch (max) {
|
|
489
|
+
case r2:
|
|
490
|
+
h2 = (g2 - b3) / d3 + (g2 < b3 ? 6 : 0);
|
|
491
|
+
break;
|
|
492
|
+
case g2:
|
|
493
|
+
h2 = (b3 - r2) / d3 + 2;
|
|
494
|
+
break;
|
|
495
|
+
case b3:
|
|
496
|
+
h2 = (r2 - g2) / d3 + 4;
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
h2 /= 6;
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
h: h2,
|
|
503
|
+
s,
|
|
504
|
+
l: l2
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function hslToRgb(h2, s, l2) {
|
|
508
|
+
var r2, g2, b3;
|
|
509
|
+
h2 = bound01(h2, 360);
|
|
510
|
+
s = bound01(s, 100);
|
|
511
|
+
l2 = bound01(l2, 100);
|
|
512
|
+
function hue2rgb(p3, q3, t) {
|
|
513
|
+
if (t < 0)
|
|
514
|
+
t += 1;
|
|
515
|
+
if (t > 1)
|
|
516
|
+
t -= 1;
|
|
517
|
+
if (t < 1 / 6)
|
|
518
|
+
return p3 + (q3 - p3) * 6 * t;
|
|
519
|
+
if (t < 1 / 2)
|
|
520
|
+
return q3;
|
|
521
|
+
if (t < 2 / 3)
|
|
522
|
+
return p3 + (q3 - p3) * (2 / 3 - t) * 6;
|
|
523
|
+
return p3;
|
|
524
|
+
}
|
|
525
|
+
if (s === 0) {
|
|
526
|
+
r2 = g2 = b3 = l2;
|
|
527
|
+
} else {
|
|
528
|
+
var q2 = l2 < 0.5 ? l2 * (1 + s) : l2 + s - l2 * s;
|
|
529
|
+
var p2 = 2 * l2 - q2;
|
|
530
|
+
r2 = hue2rgb(p2, q2, h2 + 1 / 3);
|
|
531
|
+
g2 = hue2rgb(p2, q2, h2);
|
|
532
|
+
b3 = hue2rgb(p2, q2, h2 - 1 / 3);
|
|
533
|
+
}
|
|
534
|
+
return {
|
|
535
|
+
r: r2 * 255,
|
|
536
|
+
g: g2 * 255,
|
|
537
|
+
b: b3 * 255
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function rgbToHsv(r2, g2, b3) {
|
|
541
|
+
r2 = bound01(r2, 255);
|
|
542
|
+
g2 = bound01(g2, 255);
|
|
543
|
+
b3 = bound01(b3, 255);
|
|
544
|
+
var max = Math.max(r2, g2, b3), min = Math.min(r2, g2, b3);
|
|
545
|
+
var h2, s, v2 = max;
|
|
546
|
+
var d3 = max - min;
|
|
547
|
+
s = max === 0 ? 0 : d3 / max;
|
|
548
|
+
if (max == min) {
|
|
549
|
+
h2 = 0;
|
|
550
|
+
} else {
|
|
551
|
+
switch (max) {
|
|
552
|
+
case r2:
|
|
553
|
+
h2 = (g2 - b3) / d3 + (g2 < b3 ? 6 : 0);
|
|
554
|
+
break;
|
|
555
|
+
case g2:
|
|
556
|
+
h2 = (b3 - r2) / d3 + 2;
|
|
557
|
+
break;
|
|
558
|
+
case b3:
|
|
559
|
+
h2 = (r2 - g2) / d3 + 4;
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
h2 /= 6;
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
h: h2,
|
|
566
|
+
s,
|
|
567
|
+
v: v2
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function hsvToRgb(h2, s, v2) {
|
|
571
|
+
h2 = bound01(h2, 360) * 6;
|
|
572
|
+
s = bound01(s, 100);
|
|
573
|
+
v2 = bound01(v2, 100);
|
|
574
|
+
var i = Math.floor(h2), f = h2 - i, p2 = v2 * (1 - s), q2 = v2 * (1 - f * s), t = v2 * (1 - (1 - f) * s), mod = i % 6, r2 = [v2, q2, p2, p2, t, v2][mod], g2 = [t, v2, v2, q2, p2, p2][mod], b3 = [p2, p2, t, v2, v2, q2][mod];
|
|
575
|
+
return {
|
|
576
|
+
r: r2 * 255,
|
|
577
|
+
g: g2 * 255,
|
|
578
|
+
b: b3 * 255
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function rgbToHex(r2, g2, b3, allow3Char) {
|
|
582
|
+
var hex = [pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b3).toString(16))];
|
|
583
|
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
584
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
585
|
+
}
|
|
586
|
+
return hex.join("");
|
|
587
|
+
}
|
|
588
|
+
function rgbaToHex(r2, g2, b3, a, allow4Char) {
|
|
589
|
+
var hex = [pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b3).toString(16)), pad2(convertDecimalToHex(a))];
|
|
590
|
+
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
591
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
592
|
+
}
|
|
593
|
+
return hex.join("");
|
|
594
|
+
}
|
|
595
|
+
function rgbaToArgbHex(r2, g2, b3, a) {
|
|
596
|
+
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b3).toString(16))];
|
|
597
|
+
return hex.join("");
|
|
598
|
+
}
|
|
599
|
+
tinycolor.equals = function(color1, color2) {
|
|
600
|
+
if (!color1 || !color2)
|
|
601
|
+
return false;
|
|
602
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
603
|
+
};
|
|
604
|
+
tinycolor.random = function() {
|
|
605
|
+
return tinycolor.fromRatio({
|
|
606
|
+
r: Math.random(),
|
|
607
|
+
g: Math.random(),
|
|
608
|
+
b: Math.random()
|
|
609
|
+
});
|
|
610
|
+
};
|
|
611
|
+
function _desaturate(color, amount) {
|
|
612
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
613
|
+
var hsl = tinycolor(color).toHsl();
|
|
614
|
+
hsl.s -= amount / 100;
|
|
615
|
+
hsl.s = clamp01(hsl.s);
|
|
616
|
+
return tinycolor(hsl);
|
|
617
|
+
}
|
|
618
|
+
function _saturate(color, amount) {
|
|
619
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
620
|
+
var hsl = tinycolor(color).toHsl();
|
|
621
|
+
hsl.s += amount / 100;
|
|
622
|
+
hsl.s = clamp01(hsl.s);
|
|
623
|
+
return tinycolor(hsl);
|
|
624
|
+
}
|
|
625
|
+
function _greyscale(color) {
|
|
626
|
+
return tinycolor(color).desaturate(100);
|
|
627
|
+
}
|
|
628
|
+
function _lighten(color, amount) {
|
|
629
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
630
|
+
var hsl = tinycolor(color).toHsl();
|
|
631
|
+
hsl.l += amount / 100;
|
|
632
|
+
hsl.l = clamp01(hsl.l);
|
|
633
|
+
return tinycolor(hsl);
|
|
634
|
+
}
|
|
635
|
+
function _brighten(color, amount) {
|
|
636
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
637
|
+
var rgb = tinycolor(color).toRgb();
|
|
638
|
+
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
639
|
+
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
640
|
+
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
641
|
+
return tinycolor(rgb);
|
|
642
|
+
}
|
|
643
|
+
function _darken(color, amount) {
|
|
644
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
645
|
+
var hsl = tinycolor(color).toHsl();
|
|
646
|
+
hsl.l -= amount / 100;
|
|
647
|
+
hsl.l = clamp01(hsl.l);
|
|
648
|
+
return tinycolor(hsl);
|
|
649
|
+
}
|
|
650
|
+
function _spin(color, amount) {
|
|
651
|
+
var hsl = tinycolor(color).toHsl();
|
|
652
|
+
var hue = (hsl.h + amount) % 360;
|
|
653
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
654
|
+
return tinycolor(hsl);
|
|
655
|
+
}
|
|
656
|
+
function _complement(color) {
|
|
657
|
+
var hsl = tinycolor(color).toHsl();
|
|
658
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
659
|
+
return tinycolor(hsl);
|
|
660
|
+
}
|
|
661
|
+
function polyad(color, number) {
|
|
662
|
+
if (isNaN(number) || number <= 0) {
|
|
663
|
+
throw new Error("Argument to polyad must be a positive number");
|
|
664
|
+
}
|
|
665
|
+
var hsl = tinycolor(color).toHsl();
|
|
666
|
+
var result = [tinycolor(color)];
|
|
667
|
+
var step = 360 / number;
|
|
668
|
+
for (var i = 1;i < number; i++) {
|
|
669
|
+
result.push(tinycolor({
|
|
670
|
+
h: (hsl.h + i * step) % 360,
|
|
671
|
+
s: hsl.s,
|
|
672
|
+
l: hsl.l
|
|
673
|
+
}));
|
|
674
|
+
}
|
|
675
|
+
return result;
|
|
676
|
+
}
|
|
677
|
+
function _splitcomplement(color) {
|
|
678
|
+
var hsl = tinycolor(color).toHsl();
|
|
679
|
+
var h2 = hsl.h;
|
|
680
|
+
return [tinycolor(color), tinycolor({
|
|
681
|
+
h: (h2 + 72) % 360,
|
|
682
|
+
s: hsl.s,
|
|
683
|
+
l: hsl.l
|
|
684
|
+
}), tinycolor({
|
|
685
|
+
h: (h2 + 216) % 360,
|
|
686
|
+
s: hsl.s,
|
|
687
|
+
l: hsl.l
|
|
688
|
+
})];
|
|
689
|
+
}
|
|
690
|
+
function _analogous(color, results, slices) {
|
|
691
|
+
results = results || 6;
|
|
692
|
+
slices = slices || 30;
|
|
693
|
+
var hsl = tinycolor(color).toHsl();
|
|
694
|
+
var part = 360 / slices;
|
|
695
|
+
var ret = [tinycolor(color)];
|
|
696
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360;--results; ) {
|
|
697
|
+
hsl.h = (hsl.h + part) % 360;
|
|
698
|
+
ret.push(tinycolor(hsl));
|
|
699
|
+
}
|
|
700
|
+
return ret;
|
|
701
|
+
}
|
|
702
|
+
function _monochromatic(color, results) {
|
|
703
|
+
results = results || 6;
|
|
704
|
+
var hsv = tinycolor(color).toHsv();
|
|
705
|
+
var { h: h2, s, v: v2 } = hsv;
|
|
706
|
+
var ret = [];
|
|
707
|
+
var modification = 1 / results;
|
|
708
|
+
while (results--) {
|
|
709
|
+
ret.push(tinycolor({
|
|
710
|
+
h: h2,
|
|
711
|
+
s,
|
|
712
|
+
v: v2
|
|
713
|
+
}));
|
|
714
|
+
v2 = (v2 + modification) % 1;
|
|
715
|
+
}
|
|
716
|
+
return ret;
|
|
717
|
+
}
|
|
718
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
719
|
+
amount = amount === 0 ? 0 : amount || 50;
|
|
720
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
721
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
722
|
+
var p2 = amount / 100;
|
|
723
|
+
var rgba = {
|
|
724
|
+
r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
|
|
725
|
+
g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
|
|
726
|
+
b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
|
|
727
|
+
a: (rgb2.a - rgb1.a) * p2 + rgb1.a
|
|
728
|
+
};
|
|
729
|
+
return tinycolor(rgba);
|
|
730
|
+
};
|
|
731
|
+
tinycolor.readability = function(color1, color2) {
|
|
732
|
+
var c1 = tinycolor(color1);
|
|
733
|
+
var c2 = tinycolor(color2);
|
|
734
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
735
|
+
};
|
|
736
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
737
|
+
var readability = tinycolor.readability(color1, color2);
|
|
738
|
+
var wcag2Parms, out;
|
|
739
|
+
out = false;
|
|
740
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
741
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
742
|
+
case "AAsmall":
|
|
743
|
+
case "AAAlarge":
|
|
744
|
+
out = readability >= 4.5;
|
|
745
|
+
break;
|
|
746
|
+
case "AAlarge":
|
|
747
|
+
out = readability >= 3;
|
|
748
|
+
break;
|
|
749
|
+
case "AAAsmall":
|
|
750
|
+
out = readability >= 7;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
return out;
|
|
754
|
+
};
|
|
755
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
756
|
+
var bestColor = null;
|
|
757
|
+
var bestScore = 0;
|
|
758
|
+
var readability;
|
|
759
|
+
var includeFallbackColors, level, size;
|
|
760
|
+
args = args || {};
|
|
761
|
+
includeFallbackColors = args.includeFallbackColors;
|
|
762
|
+
level = args.level;
|
|
763
|
+
size = args.size;
|
|
764
|
+
for (var i = 0;i < colorList.length; i++) {
|
|
765
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
766
|
+
if (readability > bestScore) {
|
|
767
|
+
bestScore = readability;
|
|
768
|
+
bestColor = tinycolor(colorList[i]);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
772
|
+
level,
|
|
773
|
+
size
|
|
774
|
+
}) || !includeFallbackColors) {
|
|
775
|
+
return bestColor;
|
|
776
|
+
} else {
|
|
777
|
+
args.includeFallbackColors = false;
|
|
778
|
+
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
var names = tinycolor.names = {
|
|
782
|
+
aliceblue: "f0f8ff",
|
|
783
|
+
antiquewhite: "faebd7",
|
|
784
|
+
aqua: "0ff",
|
|
785
|
+
aquamarine: "7fffd4",
|
|
786
|
+
azure: "f0ffff",
|
|
787
|
+
beige: "f5f5dc",
|
|
788
|
+
bisque: "ffe4c4",
|
|
789
|
+
black: "000",
|
|
790
|
+
blanchedalmond: "ffebcd",
|
|
791
|
+
blue: "00f",
|
|
792
|
+
blueviolet: "8a2be2",
|
|
793
|
+
brown: "a52a2a",
|
|
794
|
+
burlywood: "deb887",
|
|
795
|
+
burntsienna: "ea7e5d",
|
|
796
|
+
cadetblue: "5f9ea0",
|
|
797
|
+
chartreuse: "7fff00",
|
|
798
|
+
chocolate: "d2691e",
|
|
799
|
+
coral: "ff7f50",
|
|
800
|
+
cornflowerblue: "6495ed",
|
|
801
|
+
cornsilk: "fff8dc",
|
|
802
|
+
crimson: "dc143c",
|
|
803
|
+
cyan: "0ff",
|
|
804
|
+
darkblue: "00008b",
|
|
805
|
+
darkcyan: "008b8b",
|
|
806
|
+
darkgoldenrod: "b8860b",
|
|
807
|
+
darkgray: "a9a9a9",
|
|
808
|
+
darkgreen: "006400",
|
|
809
|
+
darkgrey: "a9a9a9",
|
|
810
|
+
darkkhaki: "bdb76b",
|
|
811
|
+
darkmagenta: "8b008b",
|
|
812
|
+
darkolivegreen: "556b2f",
|
|
813
|
+
darkorange: "ff8c00",
|
|
814
|
+
darkorchid: "9932cc",
|
|
815
|
+
darkred: "8b0000",
|
|
816
|
+
darksalmon: "e9967a",
|
|
817
|
+
darkseagreen: "8fbc8f",
|
|
818
|
+
darkslateblue: "483d8b",
|
|
819
|
+
darkslategray: "2f4f4f",
|
|
820
|
+
darkslategrey: "2f4f4f",
|
|
821
|
+
darkturquoise: "00ced1",
|
|
822
|
+
darkviolet: "9400d3",
|
|
823
|
+
deeppink: "ff1493",
|
|
824
|
+
deepskyblue: "00bfff",
|
|
825
|
+
dimgray: "696969",
|
|
826
|
+
dimgrey: "696969",
|
|
827
|
+
dodgerblue: "1e90ff",
|
|
828
|
+
firebrick: "b22222",
|
|
829
|
+
floralwhite: "fffaf0",
|
|
830
|
+
forestgreen: "228b22",
|
|
831
|
+
fuchsia: "f0f",
|
|
832
|
+
gainsboro: "dcdcdc",
|
|
833
|
+
ghostwhite: "f8f8ff",
|
|
834
|
+
gold: "ffd700",
|
|
835
|
+
goldenrod: "daa520",
|
|
836
|
+
gray: "808080",
|
|
837
|
+
green: "008000",
|
|
838
|
+
greenyellow: "adff2f",
|
|
839
|
+
grey: "808080",
|
|
840
|
+
honeydew: "f0fff0",
|
|
841
|
+
hotpink: "ff69b4",
|
|
842
|
+
indianred: "cd5c5c",
|
|
843
|
+
indigo: "4b0082",
|
|
844
|
+
ivory: "fffff0",
|
|
845
|
+
khaki: "f0e68c",
|
|
846
|
+
lavender: "e6e6fa",
|
|
847
|
+
lavenderblush: "fff0f5",
|
|
848
|
+
lawngreen: "7cfc00",
|
|
849
|
+
lemonchiffon: "fffacd",
|
|
850
|
+
lightblue: "add8e6",
|
|
851
|
+
lightcoral: "f08080",
|
|
852
|
+
lightcyan: "e0ffff",
|
|
853
|
+
lightgoldenrodyellow: "fafad2",
|
|
854
|
+
lightgray: "d3d3d3",
|
|
855
|
+
lightgreen: "90ee90",
|
|
856
|
+
lightgrey: "d3d3d3",
|
|
857
|
+
lightpink: "ffb6c1",
|
|
858
|
+
lightsalmon: "ffa07a",
|
|
859
|
+
lightseagreen: "20b2aa",
|
|
860
|
+
lightskyblue: "87cefa",
|
|
861
|
+
lightslategray: "789",
|
|
862
|
+
lightslategrey: "789",
|
|
863
|
+
lightsteelblue: "b0c4de",
|
|
864
|
+
lightyellow: "ffffe0",
|
|
865
|
+
lime: "0f0",
|
|
866
|
+
limegreen: "32cd32",
|
|
867
|
+
linen: "faf0e6",
|
|
868
|
+
magenta: "f0f",
|
|
869
|
+
maroon: "800000",
|
|
870
|
+
mediumaquamarine: "66cdaa",
|
|
871
|
+
mediumblue: "0000cd",
|
|
872
|
+
mediumorchid: "ba55d3",
|
|
873
|
+
mediumpurple: "9370db",
|
|
874
|
+
mediumseagreen: "3cb371",
|
|
875
|
+
mediumslateblue: "7b68ee",
|
|
876
|
+
mediumspringgreen: "00fa9a",
|
|
877
|
+
mediumturquoise: "48d1cc",
|
|
878
|
+
mediumvioletred: "c71585",
|
|
879
|
+
midnightblue: "191970",
|
|
880
|
+
mintcream: "f5fffa",
|
|
881
|
+
mistyrose: "ffe4e1",
|
|
882
|
+
moccasin: "ffe4b5",
|
|
883
|
+
navajowhite: "ffdead",
|
|
884
|
+
navy: "000080",
|
|
885
|
+
oldlace: "fdf5e6",
|
|
886
|
+
olive: "808000",
|
|
887
|
+
olivedrab: "6b8e23",
|
|
888
|
+
orange: "ffa500",
|
|
889
|
+
orangered: "ff4500",
|
|
890
|
+
orchid: "da70d6",
|
|
891
|
+
palegoldenrod: "eee8aa",
|
|
892
|
+
palegreen: "98fb98",
|
|
893
|
+
paleturquoise: "afeeee",
|
|
894
|
+
palevioletred: "db7093",
|
|
895
|
+
papayawhip: "ffefd5",
|
|
896
|
+
peachpuff: "ffdab9",
|
|
897
|
+
peru: "cd853f",
|
|
898
|
+
pink: "ffc0cb",
|
|
899
|
+
plum: "dda0dd",
|
|
900
|
+
powderblue: "b0e0e6",
|
|
901
|
+
purple: "800080",
|
|
902
|
+
rebeccapurple: "663399",
|
|
903
|
+
red: "f00",
|
|
904
|
+
rosybrown: "bc8f8f",
|
|
905
|
+
royalblue: "4169e1",
|
|
906
|
+
saddlebrown: "8b4513",
|
|
907
|
+
salmon: "fa8072",
|
|
908
|
+
sandybrown: "f4a460",
|
|
909
|
+
seagreen: "2e8b57",
|
|
910
|
+
seashell: "fff5ee",
|
|
911
|
+
sienna: "a0522d",
|
|
912
|
+
silver: "c0c0c0",
|
|
913
|
+
skyblue: "87ceeb",
|
|
914
|
+
slateblue: "6a5acd",
|
|
915
|
+
slategray: "708090",
|
|
916
|
+
slategrey: "708090",
|
|
917
|
+
snow: "fffafa",
|
|
918
|
+
springgreen: "00ff7f",
|
|
919
|
+
steelblue: "4682b4",
|
|
920
|
+
tan: "d2b48c",
|
|
921
|
+
teal: "008080",
|
|
922
|
+
thistle: "d8bfd8",
|
|
923
|
+
tomato: "ff6347",
|
|
924
|
+
turquoise: "40e0d0",
|
|
925
|
+
violet: "ee82ee",
|
|
926
|
+
wheat: "f5deb3",
|
|
927
|
+
white: "fff",
|
|
928
|
+
whitesmoke: "f5f5f5",
|
|
929
|
+
yellow: "ff0",
|
|
930
|
+
yellowgreen: "9acd32"
|
|
931
|
+
};
|
|
932
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
933
|
+
function flip(o2) {
|
|
934
|
+
var flipped = {};
|
|
935
|
+
for (var i in o2) {
|
|
936
|
+
if (o2.hasOwnProperty(i)) {
|
|
937
|
+
flipped[o2[i]] = i;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return flipped;
|
|
941
|
+
}
|
|
942
|
+
function boundAlpha(a) {
|
|
943
|
+
a = parseFloat(a);
|
|
944
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
945
|
+
a = 1;
|
|
946
|
+
}
|
|
947
|
+
return a;
|
|
948
|
+
}
|
|
949
|
+
function bound01(n, max) {
|
|
950
|
+
if (isOnePointZero(n))
|
|
951
|
+
n = "100%";
|
|
952
|
+
var processPercent = isPercentage(n);
|
|
953
|
+
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
954
|
+
if (processPercent) {
|
|
955
|
+
n = parseInt(n * max, 10) / 100;
|
|
956
|
+
}
|
|
957
|
+
if (Math.abs(n - max) < 0.000001) {
|
|
958
|
+
return 1;
|
|
959
|
+
}
|
|
960
|
+
return n % max / parseFloat(max);
|
|
961
|
+
}
|
|
962
|
+
function clamp01(val) {
|
|
963
|
+
return Math.min(1, Math.max(0, val));
|
|
964
|
+
}
|
|
965
|
+
function parseIntFromHex(val) {
|
|
966
|
+
return parseInt(val, 16);
|
|
967
|
+
}
|
|
968
|
+
function isOnePointZero(n) {
|
|
969
|
+
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
970
|
+
}
|
|
971
|
+
function isPercentage(n) {
|
|
972
|
+
return typeof n === "string" && n.indexOf("%") != -1;
|
|
973
|
+
}
|
|
974
|
+
function pad2(c) {
|
|
975
|
+
return c.length == 1 ? "0" + c : "" + c;
|
|
976
|
+
}
|
|
977
|
+
function convertToPercentage(n) {
|
|
978
|
+
if (n <= 1) {
|
|
979
|
+
n = n * 100 + "%";
|
|
980
|
+
}
|
|
981
|
+
return n;
|
|
982
|
+
}
|
|
983
|
+
function convertDecimalToHex(d3) {
|
|
984
|
+
return Math.round(parseFloat(d3) * 255).toString(16);
|
|
985
|
+
}
|
|
986
|
+
function convertHexToDecimal(h2) {
|
|
987
|
+
return parseIntFromHex(h2) / 255;
|
|
988
|
+
}
|
|
989
|
+
var matchers = function() {
|
|
990
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
991
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
992
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
993
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
994
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
995
|
+
return {
|
|
996
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
997
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
998
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
999
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
1000
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
1001
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
1002
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
1003
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1004
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1005
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1006
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1007
|
+
};
|
|
1008
|
+
}();
|
|
1009
|
+
function isValidCSSUnit(color) {
|
|
1010
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
1011
|
+
}
|
|
1012
|
+
function stringInputToObject(color) {
|
|
1013
|
+
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
1014
|
+
var named = false;
|
|
1015
|
+
if (names[color]) {
|
|
1016
|
+
color = names[color];
|
|
1017
|
+
named = true;
|
|
1018
|
+
} else if (color == "transparent") {
|
|
1019
|
+
return {
|
|
1020
|
+
r: 0,
|
|
1021
|
+
g: 0,
|
|
1022
|
+
b: 0,
|
|
1023
|
+
a: 0,
|
|
1024
|
+
format: "name"
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
var match;
|
|
1028
|
+
if (match = matchers.rgb.exec(color)) {
|
|
1029
|
+
return {
|
|
1030
|
+
r: match[1],
|
|
1031
|
+
g: match[2],
|
|
1032
|
+
b: match[3]
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
if (match = matchers.rgba.exec(color)) {
|
|
1036
|
+
return {
|
|
1037
|
+
r: match[1],
|
|
1038
|
+
g: match[2],
|
|
1039
|
+
b: match[3],
|
|
1040
|
+
a: match[4]
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
if (match = matchers.hsl.exec(color)) {
|
|
1044
|
+
return {
|
|
1045
|
+
h: match[1],
|
|
1046
|
+
s: match[2],
|
|
1047
|
+
l: match[3]
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
if (match = matchers.hsla.exec(color)) {
|
|
1051
|
+
return {
|
|
1052
|
+
h: match[1],
|
|
1053
|
+
s: match[2],
|
|
1054
|
+
l: match[3],
|
|
1055
|
+
a: match[4]
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
if (match = matchers.hsv.exec(color)) {
|
|
1059
|
+
return {
|
|
1060
|
+
h: match[1],
|
|
1061
|
+
s: match[2],
|
|
1062
|
+
v: match[3]
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
if (match = matchers.hsva.exec(color)) {
|
|
1066
|
+
return {
|
|
1067
|
+
h: match[1],
|
|
1068
|
+
s: match[2],
|
|
1069
|
+
v: match[3],
|
|
1070
|
+
a: match[4]
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
if (match = matchers.hex8.exec(color)) {
|
|
1074
|
+
return {
|
|
1075
|
+
r: parseIntFromHex(match[1]),
|
|
1076
|
+
g: parseIntFromHex(match[2]),
|
|
1077
|
+
b: parseIntFromHex(match[3]),
|
|
1078
|
+
a: convertHexToDecimal(match[4]),
|
|
1079
|
+
format: named ? "name" : "hex8"
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
if (match = matchers.hex6.exec(color)) {
|
|
1083
|
+
return {
|
|
1084
|
+
r: parseIntFromHex(match[1]),
|
|
1085
|
+
g: parseIntFromHex(match[2]),
|
|
1086
|
+
b: parseIntFromHex(match[3]),
|
|
1087
|
+
format: named ? "name" : "hex"
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
if (match = matchers.hex4.exec(color)) {
|
|
1091
|
+
return {
|
|
1092
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1093
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1094
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1095
|
+
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
1096
|
+
format: named ? "name" : "hex8"
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
if (match = matchers.hex3.exec(color)) {
|
|
1100
|
+
return {
|
|
1101
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1102
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1103
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1104
|
+
format: named ? "name" : "hex"
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
return false;
|
|
1108
|
+
}
|
|
1109
|
+
function validateWCAG2Parms(parms) {
|
|
1110
|
+
var level, size;
|
|
1111
|
+
parms = parms || {
|
|
1112
|
+
level: "AA",
|
|
1113
|
+
size: "small"
|
|
1114
|
+
};
|
|
1115
|
+
level = (parms.level || "AA").toUpperCase();
|
|
1116
|
+
size = (parms.size || "small").toLowerCase();
|
|
1117
|
+
if (level !== "AA" && level !== "AAA") {
|
|
1118
|
+
level = "AA";
|
|
1119
|
+
}
|
|
1120
|
+
if (size !== "small" && size !== "large") {
|
|
1121
|
+
size = "small";
|
|
1122
|
+
}
|
|
1123
|
+
return {
|
|
1124
|
+
level,
|
|
1125
|
+
size
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
return tinycolor;
|
|
1129
|
+
});
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
// node_modules/tinygradient/index.js
|
|
1133
|
+
var require_tinygradient = __commonJS((exports, module) => {
|
|
1134
|
+
var tinycolor = require_tinycolor();
|
|
1135
|
+
var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
|
|
1136
|
+
var HSVA_MAX = { h: 360, s: 1, v: 1, a: 1 };
|
|
1137
|
+
function stepize(start, end, steps) {
|
|
1138
|
+
let step = {};
|
|
1139
|
+
for (let k3 in start) {
|
|
1140
|
+
if (start.hasOwnProperty(k3)) {
|
|
1141
|
+
step[k3] = steps === 0 ? 0 : (end[k3] - start[k3]) / steps;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
return step;
|
|
1145
|
+
}
|
|
1146
|
+
function interpolate(step, start, i, max) {
|
|
1147
|
+
let color = {};
|
|
1148
|
+
for (let k3 in start) {
|
|
1149
|
+
if (start.hasOwnProperty(k3)) {
|
|
1150
|
+
color[k3] = step[k3] * i + start[k3];
|
|
1151
|
+
color[k3] = color[k3] < 0 ? color[k3] + max[k3] : max[k3] !== 1 ? color[k3] % max[k3] : color[k3];
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return color;
|
|
1155
|
+
}
|
|
1156
|
+
function interpolateRgb(stop1, stop2, steps) {
|
|
1157
|
+
const start = stop1.color.toRgb();
|
|
1158
|
+
const end = stop2.color.toRgb();
|
|
1159
|
+
const step = stepize(start, end, steps);
|
|
1160
|
+
let gradient = [stop1.color];
|
|
1161
|
+
for (let i = 1;i < steps; i++) {
|
|
1162
|
+
const color = interpolate(step, start, i, RGBA_MAX);
|
|
1163
|
+
gradient.push(tinycolor(color));
|
|
1164
|
+
}
|
|
1165
|
+
return gradient;
|
|
1166
|
+
}
|
|
1167
|
+
function interpolateHsv(stop1, stop2, steps, mode) {
|
|
1168
|
+
const start = stop1.color.toHsv();
|
|
1169
|
+
const end = stop2.color.toHsv();
|
|
1170
|
+
if (start.s === 0 || end.s === 0) {
|
|
1171
|
+
return interpolateRgb(stop1, stop2, steps);
|
|
1172
|
+
}
|
|
1173
|
+
let trigonometric;
|
|
1174
|
+
if (typeof mode === "boolean") {
|
|
1175
|
+
trigonometric = mode;
|
|
1176
|
+
} else {
|
|
1177
|
+
const trigShortest = start.h < end.h && end.h - start.h < 180 || start.h > end.h && start.h - end.h > 180;
|
|
1178
|
+
trigonometric = mode === "long" && trigShortest || mode === "short" && !trigShortest;
|
|
1179
|
+
}
|
|
1180
|
+
const step = stepize(start, end, steps);
|
|
1181
|
+
let gradient = [stop1.color];
|
|
1182
|
+
let diff;
|
|
1183
|
+
if (start.h <= end.h && !trigonometric || start.h >= end.h && trigonometric) {
|
|
1184
|
+
diff = end.h - start.h;
|
|
1185
|
+
} else if (trigonometric) {
|
|
1186
|
+
diff = 360 - end.h + start.h;
|
|
1187
|
+
} else {
|
|
1188
|
+
diff = 360 - start.h + end.h;
|
|
1189
|
+
}
|
|
1190
|
+
step.h = Math.pow(-1, trigonometric ? 1 : 0) * Math.abs(diff) / steps;
|
|
1191
|
+
for (let i = 1;i < steps; i++) {
|
|
1192
|
+
const color = interpolate(step, start, i, HSVA_MAX);
|
|
1193
|
+
gradient.push(tinycolor(color));
|
|
1194
|
+
}
|
|
1195
|
+
return gradient;
|
|
1196
|
+
}
|
|
1197
|
+
function computeSubsteps(stops, steps) {
|
|
1198
|
+
const l2 = stops.length;
|
|
1199
|
+
steps = parseInt(steps, 10);
|
|
1200
|
+
if (isNaN(steps) || steps < 2) {
|
|
1201
|
+
throw new Error("Invalid number of steps (< 2)");
|
|
1202
|
+
}
|
|
1203
|
+
if (steps < l2) {
|
|
1204
|
+
throw new Error("Number of steps cannot be inferior to number of stops");
|
|
1205
|
+
}
|
|
1206
|
+
let substeps = [];
|
|
1207
|
+
for (let i = 1;i < l2; i++) {
|
|
1208
|
+
const step = (steps - 1) * (stops[i].pos - stops[i - 1].pos);
|
|
1209
|
+
substeps.push(Math.max(1, Math.round(step)));
|
|
1210
|
+
}
|
|
1211
|
+
let totalSubsteps = 1;
|
|
1212
|
+
for (let n = l2 - 1;n--; )
|
|
1213
|
+
totalSubsteps += substeps[n];
|
|
1214
|
+
while (totalSubsteps !== steps) {
|
|
1215
|
+
if (totalSubsteps < steps) {
|
|
1216
|
+
const min = Math.min.apply(null, substeps);
|
|
1217
|
+
substeps[substeps.indexOf(min)]++;
|
|
1218
|
+
totalSubsteps++;
|
|
1219
|
+
} else {
|
|
1220
|
+
const max = Math.max.apply(null, substeps);
|
|
1221
|
+
substeps[substeps.indexOf(max)]--;
|
|
1222
|
+
totalSubsteps--;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return substeps;
|
|
1226
|
+
}
|
|
1227
|
+
function computeAt(stops, pos, method, max) {
|
|
1228
|
+
if (pos < 0 || pos > 1) {
|
|
1229
|
+
throw new Error("Position must be between 0 and 1");
|
|
1230
|
+
}
|
|
1231
|
+
let start, end;
|
|
1232
|
+
for (let i = 0, l2 = stops.length;i < l2 - 1; i++) {
|
|
1233
|
+
if (pos >= stops[i].pos && pos < stops[i + 1].pos) {
|
|
1234
|
+
start = stops[i];
|
|
1235
|
+
end = stops[i + 1];
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (!start) {
|
|
1240
|
+
start = end = stops[stops.length - 1];
|
|
1241
|
+
}
|
|
1242
|
+
const step = stepize(start.color[method](), end.color[method](), (end.pos - start.pos) * 100);
|
|
1243
|
+
const color = interpolate(step, start.color[method](), (pos - start.pos) * 100, max);
|
|
1244
|
+
return tinycolor(color);
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
class TinyGradient {
|
|
1248
|
+
constructor(stops) {
|
|
1249
|
+
if (stops.length < 2) {
|
|
1250
|
+
throw new Error("Invalid number of stops (< 2)");
|
|
1251
|
+
}
|
|
1252
|
+
const havingPositions = stops[0].pos !== undefined;
|
|
1253
|
+
let l2 = stops.length;
|
|
1254
|
+
let p2 = -1;
|
|
1255
|
+
let lastColorLess = false;
|
|
1256
|
+
this.stops = stops.map((stop, i) => {
|
|
1257
|
+
const hasPosition = stop.pos !== undefined;
|
|
1258
|
+
if (havingPositions ^ hasPosition) {
|
|
1259
|
+
throw new Error("Cannot mix positionned and not posionned color stops");
|
|
1260
|
+
}
|
|
1261
|
+
if (hasPosition) {
|
|
1262
|
+
const hasColor = stop.color !== undefined;
|
|
1263
|
+
if (!hasColor && (lastColorLess || i === 0 || i === l2 - 1)) {
|
|
1264
|
+
throw new Error("Cannot define two consecutive position-only stops");
|
|
1265
|
+
}
|
|
1266
|
+
lastColorLess = !hasColor;
|
|
1267
|
+
stop = {
|
|
1268
|
+
color: hasColor ? tinycolor(stop.color) : null,
|
|
1269
|
+
colorLess: !hasColor,
|
|
1270
|
+
pos: stop.pos
|
|
1271
|
+
};
|
|
1272
|
+
if (stop.pos < 0 || stop.pos > 1) {
|
|
1273
|
+
throw new Error("Color stops positions must be between 0 and 1");
|
|
1274
|
+
} else if (stop.pos < p2) {
|
|
1275
|
+
throw new Error("Color stops positions are not ordered");
|
|
1276
|
+
}
|
|
1277
|
+
p2 = stop.pos;
|
|
1278
|
+
} else {
|
|
1279
|
+
stop = {
|
|
1280
|
+
color: tinycolor(stop.color !== undefined ? stop.color : stop),
|
|
1281
|
+
pos: i / (l2 - 1)
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
return stop;
|
|
1285
|
+
});
|
|
1286
|
+
if (this.stops[0].pos !== 0) {
|
|
1287
|
+
this.stops.unshift({
|
|
1288
|
+
color: this.stops[0].color,
|
|
1289
|
+
pos: 0
|
|
1290
|
+
});
|
|
1291
|
+
l2++;
|
|
1292
|
+
}
|
|
1293
|
+
if (this.stops[l2 - 1].pos !== 1) {
|
|
1294
|
+
this.stops.push({
|
|
1295
|
+
color: this.stops[l2 - 1].color,
|
|
1296
|
+
pos: 1
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
reverse() {
|
|
1301
|
+
let stops = [];
|
|
1302
|
+
this.stops.forEach(function(stop) {
|
|
1303
|
+
stops.push({
|
|
1304
|
+
color: stop.color,
|
|
1305
|
+
pos: 1 - stop.pos
|
|
1306
|
+
});
|
|
1307
|
+
});
|
|
1308
|
+
return new TinyGradient(stops.reverse());
|
|
1309
|
+
}
|
|
1310
|
+
loop() {
|
|
1311
|
+
let stops1 = [];
|
|
1312
|
+
let stops2 = [];
|
|
1313
|
+
this.stops.forEach((stop) => {
|
|
1314
|
+
stops1.push({
|
|
1315
|
+
color: stop.color,
|
|
1316
|
+
pos: stop.pos / 2
|
|
1317
|
+
});
|
|
1318
|
+
});
|
|
1319
|
+
this.stops.slice(0, -1).forEach((stop) => {
|
|
1320
|
+
stops2.push({
|
|
1321
|
+
color: stop.color,
|
|
1322
|
+
pos: 1 - stop.pos / 2
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
return new TinyGradient(stops1.concat(stops2.reverse()));
|
|
1326
|
+
}
|
|
1327
|
+
rgb(steps) {
|
|
1328
|
+
const substeps = computeSubsteps(this.stops, steps);
|
|
1329
|
+
let gradient = [];
|
|
1330
|
+
this.stops.forEach((stop, i) => {
|
|
1331
|
+
if (stop.colorLess) {
|
|
1332
|
+
stop.color = interpolateRgb(this.stops[i - 1], this.stops[i + 1], 2)[1];
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
for (let i = 0, l2 = this.stops.length;i < l2 - 1; i++) {
|
|
1336
|
+
const rgb = interpolateRgb(this.stops[i], this.stops[i + 1], substeps[i]);
|
|
1337
|
+
gradient.splice(gradient.length, 0, ...rgb);
|
|
1338
|
+
}
|
|
1339
|
+
gradient.push(this.stops[this.stops.length - 1].color);
|
|
1340
|
+
return gradient;
|
|
1341
|
+
}
|
|
1342
|
+
hsv(steps, mode) {
|
|
1343
|
+
const substeps = computeSubsteps(this.stops, steps);
|
|
1344
|
+
let gradient = [];
|
|
1345
|
+
this.stops.forEach((stop, i) => {
|
|
1346
|
+
if (stop.colorLess) {
|
|
1347
|
+
stop.color = interpolateHsv(this.stops[i - 1], this.stops[i + 1], 2, mode)[1];
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
for (let i = 0, l2 = this.stops.length;i < l2 - 1; i++) {
|
|
1351
|
+
const hsv = interpolateHsv(this.stops[i], this.stops[i + 1], substeps[i], mode);
|
|
1352
|
+
gradient.splice(gradient.length, 0, ...hsv);
|
|
1353
|
+
}
|
|
1354
|
+
gradient.push(this.stops[this.stops.length - 1].color);
|
|
1355
|
+
return gradient;
|
|
1356
|
+
}
|
|
1357
|
+
css(mode, direction) {
|
|
1358
|
+
mode = mode || "linear";
|
|
1359
|
+
direction = direction || (mode === "linear" ? "to right" : "ellipse at center");
|
|
1360
|
+
let css = mode + "-gradient(" + direction;
|
|
1361
|
+
this.stops.forEach(function(stop) {
|
|
1362
|
+
css += ", " + (stop.colorLess ? "" : stop.color.toRgbString() + " ") + stop.pos * 100 + "%";
|
|
1363
|
+
});
|
|
1364
|
+
css += ")";
|
|
1365
|
+
return css;
|
|
1366
|
+
}
|
|
1367
|
+
rgbAt(pos) {
|
|
1368
|
+
return computeAt(this.stops, pos, "toRgb", RGBA_MAX);
|
|
1369
|
+
}
|
|
1370
|
+
hsvAt(pos) {
|
|
1371
|
+
return computeAt(this.stops, pos, "toHsv", HSVA_MAX);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
module.exports = function(stops) {
|
|
1375
|
+
if (arguments.length === 1) {
|
|
1376
|
+
if (!Array.isArray(arguments[0])) {
|
|
1377
|
+
throw new Error('"stops" is not an array');
|
|
1378
|
+
}
|
|
1379
|
+
stops = arguments[0];
|
|
1380
|
+
} else {
|
|
1381
|
+
stops = Array.prototype.slice.call(arguments);
|
|
1382
|
+
}
|
|
1383
|
+
return new TinyGradient(stops);
|
|
1384
|
+
};
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
// src/index.ts
|
|
1388
|
+
import * as fs from "node:fs";
|
|
1389
|
+
import * as path from "node:path";
|
|
1390
|
+
|
|
1391
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
1392
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
1393
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
1394
|
+
import { stdin as j, stdout as M } from "node:process";
|
|
1395
|
+
import * as g from "node:readline";
|
|
1396
|
+
import O from "node:readline";
|
|
1397
|
+
import { Writable as X } from "node:stream";
|
|
1398
|
+
function DD({ onlyFirst: e = false } = {}) {
|
|
1399
|
+
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
1400
|
+
return new RegExp(t, e ? undefined : "g");
|
|
1401
|
+
}
|
|
1402
|
+
var uD = DD();
|
|
1403
|
+
function P(e) {
|
|
1404
|
+
if (typeof e != "string")
|
|
1405
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
1406
|
+
return e.replace(uD, "");
|
|
1407
|
+
}
|
|
1408
|
+
function L(e) {
|
|
1409
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1410
|
+
}
|
|
1411
|
+
var W = { exports: {} };
|
|
1412
|
+
(function(e) {
|
|
1413
|
+
var u = {};
|
|
1414
|
+
e.exports = u, u.eastAsianWidth = function(F) {
|
|
1415
|
+
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
1416
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
1417
|
+
}, u.characterLength = function(F) {
|
|
1418
|
+
var s = this.eastAsianWidth(F);
|
|
1419
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
1420
|
+
};
|
|
1421
|
+
function t(F) {
|
|
1422
|
+
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
1423
|
+
}
|
|
1424
|
+
u.length = function(F) {
|
|
1425
|
+
for (var s = t(F), i = 0, D = 0;D < s.length; D++)
|
|
1426
|
+
i = i + this.characterLength(s[D]);
|
|
1427
|
+
return i;
|
|
1428
|
+
}, u.slice = function(F, s, i) {
|
|
1429
|
+
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
1430
|
+
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
1431
|
+
var a = n[E], o = u.length(a);
|
|
1432
|
+
if (C >= s - (o == 2 ? 1 : 0))
|
|
1433
|
+
if (C + o <= i)
|
|
1434
|
+
D += a;
|
|
1435
|
+
else
|
|
1436
|
+
break;
|
|
1437
|
+
C += o;
|
|
1438
|
+
}
|
|
1439
|
+
return D;
|
|
1440
|
+
};
|
|
1441
|
+
})(W);
|
|
1442
|
+
var tD = W.exports;
|
|
1443
|
+
var eD = L(tD);
|
|
1444
|
+
var FD = function() {
|
|
1445
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
1446
|
+
};
|
|
1447
|
+
var sD = L(FD);
|
|
1448
|
+
function p(e, u = {}) {
|
|
1449
|
+
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
1450
|
+
return 0;
|
|
1451
|
+
e = e.replace(sD(), " ");
|
|
1452
|
+
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
1453
|
+
let F = 0;
|
|
1454
|
+
for (const s of e) {
|
|
1455
|
+
const i = s.codePointAt(0);
|
|
1456
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
1457
|
+
continue;
|
|
1458
|
+
switch (eD.eastAsianWidth(s)) {
|
|
1459
|
+
case "F":
|
|
1460
|
+
case "W":
|
|
1461
|
+
F += 2;
|
|
1462
|
+
break;
|
|
1463
|
+
case "A":
|
|
1464
|
+
F += t;
|
|
1465
|
+
break;
|
|
1466
|
+
default:
|
|
1467
|
+
F += 1;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return F;
|
|
1471
|
+
}
|
|
1472
|
+
var w = 10;
|
|
1473
|
+
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
1474
|
+
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
1475
|
+
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
1476
|
+
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
1477
|
+
Object.keys(r.modifier);
|
|
1478
|
+
var iD = Object.keys(r.color);
|
|
1479
|
+
var CD = Object.keys(r.bgColor);
|
|
1480
|
+
[...iD, ...CD];
|
|
1481
|
+
function rD() {
|
|
1482
|
+
const e = new Map;
|
|
1483
|
+
for (const [u, t] of Object.entries(r)) {
|
|
1484
|
+
for (const [F, s] of Object.entries(t))
|
|
1485
|
+
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
1486
|
+
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
1487
|
+
}
|
|
1488
|
+
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
1489
|
+
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
1490
|
+
if (!t)
|
|
1491
|
+
return [0, 0, 0];
|
|
1492
|
+
let [F] = t;
|
|
1493
|
+
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
1494
|
+
const s = Number.parseInt(F, 16);
|
|
1495
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
1496
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
1497
|
+
if (u < 8)
|
|
1498
|
+
return 30 + u;
|
|
1499
|
+
if (u < 16)
|
|
1500
|
+
return 90 + (u - 8);
|
|
1501
|
+
let t, F, s;
|
|
1502
|
+
if (u >= 232)
|
|
1503
|
+
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
1504
|
+
else {
|
|
1505
|
+
u -= 16;
|
|
1506
|
+
const C = u % 36;
|
|
1507
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
1508
|
+
}
|
|
1509
|
+
const i = Math.max(t, F, s) * 2;
|
|
1510
|
+
if (i === 0)
|
|
1511
|
+
return 30;
|
|
1512
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
1513
|
+
return i === 2 && (D += 60), D;
|
|
1514
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
1515
|
+
}
|
|
1516
|
+
var ED = rD();
|
|
1517
|
+
var d = new Set(["\x1B", ""]);
|
|
1518
|
+
var oD = 39;
|
|
1519
|
+
var y = "\x07";
|
|
1520
|
+
var V = "[";
|
|
1521
|
+
var nD = "]";
|
|
1522
|
+
var G = "m";
|
|
1523
|
+
var _ = `${nD}8;;`;
|
|
1524
|
+
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
|
|
1525
|
+
var K = (e) => `${d.values().next().value}${_}${e}${y}`;
|
|
1526
|
+
var aD = (e) => e.split(" ").map((u) => p(u));
|
|
1527
|
+
var k = (e, u, t) => {
|
|
1528
|
+
const F = [...u];
|
|
1529
|
+
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
1530
|
+
for (const [C, n] of F.entries()) {
|
|
1531
|
+
const E = p(n);
|
|
1532
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
1533
|
+
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
1534
|
+
continue;
|
|
1535
|
+
}
|
|
1536
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
1537
|
+
}
|
|
1538
|
+
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
1539
|
+
};
|
|
1540
|
+
var hD = (e) => {
|
|
1541
|
+
const u = e.split(" ");
|
|
1542
|
+
let t = u.length;
|
|
1543
|
+
for (;t > 0 && !(p(u[t - 1]) > 0); )
|
|
1544
|
+
t--;
|
|
1545
|
+
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
1546
|
+
};
|
|
1547
|
+
var lD = (e, u, t = {}) => {
|
|
1548
|
+
if (t.trim !== false && e.trim() === "")
|
|
1549
|
+
return "";
|
|
1550
|
+
let F = "", s, i;
|
|
1551
|
+
const D = aD(e);
|
|
1552
|
+
let C = [""];
|
|
1553
|
+
for (const [E, a] of e.split(" ").entries()) {
|
|
1554
|
+
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
1555
|
+
let o = p(C[C.length - 1]);
|
|
1556
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
1557
|
+
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
1558
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
1559
|
+
continue;
|
|
1560
|
+
}
|
|
1561
|
+
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
1562
|
+
if (t.wordWrap === false && o < u) {
|
|
1563
|
+
k(C, a, u);
|
|
1564
|
+
continue;
|
|
1565
|
+
}
|
|
1566
|
+
C.push("");
|
|
1567
|
+
}
|
|
1568
|
+
if (o + D[E] > u && t.wordWrap === false) {
|
|
1569
|
+
k(C, a, u);
|
|
1570
|
+
continue;
|
|
1571
|
+
}
|
|
1572
|
+
C[C.length - 1] += a;
|
|
1573
|
+
}
|
|
1574
|
+
t.trim !== false && (C = C.map((E) => hD(E)));
|
|
1575
|
+
const n = [...C.join(`
|
|
1576
|
+
`)];
|
|
1577
|
+
for (const [E, a] of n.entries()) {
|
|
1578
|
+
if (F += a, d.has(a)) {
|
|
1579
|
+
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
1580
|
+
if (c.code !== undefined) {
|
|
1581
|
+
const f = Number.parseFloat(c.code);
|
|
1582
|
+
s = f === oD ? undefined : f;
|
|
1583
|
+
} else
|
|
1584
|
+
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
1585
|
+
}
|
|
1586
|
+
const o = ED.codes.get(Number(s));
|
|
1587
|
+
n[E + 1] === `
|
|
1588
|
+
` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
|
|
1589
|
+
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
1590
|
+
}
|
|
1591
|
+
return F;
|
|
1592
|
+
};
|
|
1593
|
+
function Y(e, u, t) {
|
|
1594
|
+
return String(e).normalize().replace(/\r\n/g, `
|
|
1595
|
+
`).split(`
|
|
1596
|
+
`).map((F) => lD(F, u, t)).join(`
|
|
1597
|
+
`);
|
|
1598
|
+
}
|
|
1599
|
+
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
1600
|
+
var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
1601
|
+
function $(e, u) {
|
|
1602
|
+
if (typeof e == "string")
|
|
1603
|
+
return B.aliases.get(e) === u;
|
|
1604
|
+
for (const t of e)
|
|
1605
|
+
if (t !== undefined && $(t, u))
|
|
1606
|
+
return true;
|
|
1607
|
+
return false;
|
|
1608
|
+
}
|
|
1609
|
+
function BD(e, u) {
|
|
1610
|
+
if (e === u)
|
|
1611
|
+
return;
|
|
1612
|
+
const t = e.split(`
|
|
1613
|
+
`), F = u.split(`
|
|
1614
|
+
`), s = [];
|
|
1615
|
+
for (let i = 0;i < Math.max(t.length, F.length); i++)
|
|
1616
|
+
t[i] !== F[i] && s.push(i);
|
|
1617
|
+
return s;
|
|
1618
|
+
}
|
|
1619
|
+
var AD = globalThis.process.platform.startsWith("win");
|
|
1620
|
+
var S = Symbol("clack:cancel");
|
|
1621
|
+
function pD(e) {
|
|
1622
|
+
return e === S;
|
|
1623
|
+
}
|
|
1624
|
+
function m(e, u) {
|
|
1625
|
+
const t = e;
|
|
1626
|
+
t.isTTY && t.setRawMode(u);
|
|
1627
|
+
}
|
|
1628
|
+
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
|
|
1629
|
+
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
|
|
1630
|
+
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
|
|
1631
|
+
const i = (D, { name: C, sequence: n }) => {
|
|
1632
|
+
const E = String(D);
|
|
1633
|
+
if ($([E, C, n], "cancel")) {
|
|
1634
|
+
F && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
if (!t)
|
|
1638
|
+
return;
|
|
1639
|
+
const a = C === "return" ? 0 : -1, o = C === "return" ? -1 : 0;
|
|
1640
|
+
g.moveCursor(u, a, o, () => {
|
|
1641
|
+
g.clearLine(u, 1, () => {
|
|
1642
|
+
e.once("keypress", i);
|
|
1643
|
+
});
|
|
1644
|
+
});
|
|
1645
|
+
};
|
|
1646
|
+
return F && u.write(import_sisteransi.cursor.hide), e.once("keypress", i), () => {
|
|
1647
|
+
e.off("keypress", i), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
var gD = Object.defineProperty;
|
|
1651
|
+
var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
1652
|
+
var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
1653
|
+
|
|
1654
|
+
class x {
|
|
1655
|
+
constructor(u, t = true) {
|
|
1656
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
1657
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
|
|
1658
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
1659
|
+
}
|
|
1660
|
+
unsubscribe() {
|
|
1661
|
+
this._subscribers.clear();
|
|
1662
|
+
}
|
|
1663
|
+
setSubscriber(u, t) {
|
|
1664
|
+
const F = this._subscribers.get(u) ?? [];
|
|
1665
|
+
F.push(t), this._subscribers.set(u, F);
|
|
1666
|
+
}
|
|
1667
|
+
on(u, t) {
|
|
1668
|
+
this.setSubscriber(u, { cb: t });
|
|
1669
|
+
}
|
|
1670
|
+
once(u, t) {
|
|
1671
|
+
this.setSubscriber(u, { cb: t, once: true });
|
|
1672
|
+
}
|
|
1673
|
+
emit(u, ...t) {
|
|
1674
|
+
const F = this._subscribers.get(u) ?? [], s = [];
|
|
1675
|
+
for (const i of F)
|
|
1676
|
+
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
1677
|
+
for (const i of s)
|
|
1678
|
+
i();
|
|
1679
|
+
}
|
|
1680
|
+
prompt() {
|
|
1681
|
+
return new Promise((u, t) => {
|
|
1682
|
+
if (this._abortSignal) {
|
|
1683
|
+
if (this._abortSignal.aborted)
|
|
1684
|
+
return this.state = "cancel", this.close(), u(S);
|
|
1685
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
1686
|
+
this.state = "cancel", this.close();
|
|
1687
|
+
}, { once: true });
|
|
1688
|
+
}
|
|
1689
|
+
const F = new X;
|
|
1690
|
+
F._write = (s, i, D) => {
|
|
1691
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
1692
|
+
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
1693
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
|
|
1694
|
+
}), this.once("cancel", () => {
|
|
1695
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
|
|
1696
|
+
});
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
onKeypress(u, t) {
|
|
1700
|
+
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
1701
|
+
if (this.opts.validate) {
|
|
1702
|
+
const F = this.opts.validate(this.value);
|
|
1703
|
+
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
1704
|
+
}
|
|
1705
|
+
this.state !== "error" && (this.state = "submit");
|
|
1706
|
+
}
|
|
1707
|
+
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
1708
|
+
}
|
|
1709
|
+
close() {
|
|
1710
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
1711
|
+
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
1712
|
+
}
|
|
1713
|
+
restoreCursor() {
|
|
1714
|
+
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
1715
|
+
`).length - 1;
|
|
1716
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
1717
|
+
}
|
|
1718
|
+
render() {
|
|
1719
|
+
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
1720
|
+
if (u !== this._prevFrame) {
|
|
1721
|
+
if (this.state === "initial")
|
|
1722
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
1723
|
+
else {
|
|
1724
|
+
const t = BD(this._prevFrame, u);
|
|
1725
|
+
if (this.restoreCursor(), t && t?.length === 1) {
|
|
1726
|
+
const F = t[0];
|
|
1727
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
1728
|
+
const s = u.split(`
|
|
1729
|
+
`);
|
|
1730
|
+
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
if (t && t?.length > 1) {
|
|
1734
|
+
const F = t[0];
|
|
1735
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
1736
|
+
const s = u.split(`
|
|
1737
|
+
`).slice(F);
|
|
1738
|
+
this.output.write(s.join(`
|
|
1739
|
+
`)), this._prevFrame = u;
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
this.output.write(import_sisteransi.erase.down());
|
|
1743
|
+
}
|
|
1744
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
class dD extends x {
|
|
1750
|
+
get cursor() {
|
|
1751
|
+
return this.value ? 0 : 1;
|
|
1752
|
+
}
|
|
1753
|
+
get _value() {
|
|
1754
|
+
return this.cursor === 0;
|
|
1755
|
+
}
|
|
1756
|
+
constructor(u) {
|
|
1757
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
1758
|
+
this.value = this._value;
|
|
1759
|
+
}), this.on("confirm", (t) => {
|
|
1760
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
1761
|
+
}), this.on("cursor", () => {
|
|
1762
|
+
this.value = !this.value;
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
var A;
|
|
1767
|
+
A = new WeakMap;
|
|
1768
|
+
var OD = Object.defineProperty;
|
|
1769
|
+
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
1770
|
+
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
1771
|
+
|
|
1772
|
+
class LD extends x {
|
|
1773
|
+
constructor(u) {
|
|
1774
|
+
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
1775
|
+
switch (t) {
|
|
1776
|
+
case "left":
|
|
1777
|
+
case "up":
|
|
1778
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1779
|
+
break;
|
|
1780
|
+
case "down":
|
|
1781
|
+
case "right":
|
|
1782
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1783
|
+
break;
|
|
1784
|
+
}
|
|
1785
|
+
this.changeValue();
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
get _value() {
|
|
1789
|
+
return this.options[this.cursor];
|
|
1790
|
+
}
|
|
1791
|
+
changeValue() {
|
|
1792
|
+
this.value = this._value.value;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
class RD extends x {
|
|
1796
|
+
get valueWithCursor() {
|
|
1797
|
+
if (this.state === "submit")
|
|
1798
|
+
return this.value;
|
|
1799
|
+
if (this.cursor >= this.value.length)
|
|
1800
|
+
return `${this.value}█`;
|
|
1801
|
+
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
1802
|
+
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
1803
|
+
}
|
|
1804
|
+
get cursor() {
|
|
1805
|
+
return this._cursor;
|
|
1806
|
+
}
|
|
1807
|
+
constructor(u) {
|
|
1808
|
+
super(u), this.on("finalize", () => {
|
|
1809
|
+
this.value || (this.value = u.defaultValue);
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
1815
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1816
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
1817
|
+
import y2 from "node:process";
|
|
1818
|
+
function ce() {
|
|
1819
|
+
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1820
|
+
}
|
|
1821
|
+
var V2 = ce();
|
|
1822
|
+
var u = (t, n) => V2 ? t : n;
|
|
1823
|
+
var le = u("◆", "*");
|
|
1824
|
+
var L2 = u("■", "x");
|
|
1825
|
+
var W2 = u("▲", "x");
|
|
1826
|
+
var C = u("◇", "o");
|
|
1827
|
+
var ue = u("┌", "T");
|
|
1828
|
+
var o = u("│", "|");
|
|
1829
|
+
var d2 = u("└", "—");
|
|
1830
|
+
var k2 = u("●", ">");
|
|
1831
|
+
var P2 = u("○", " ");
|
|
1832
|
+
var A2 = u("◻", "[•]");
|
|
1833
|
+
var T = u("◼", "[+]");
|
|
1834
|
+
var F = u("◻", "[ ]");
|
|
1835
|
+
var $e = u("▪", "•");
|
|
1836
|
+
var _2 = u("─", "-");
|
|
1837
|
+
var me = u("╮", "+");
|
|
1838
|
+
var de = u("├", "+");
|
|
1839
|
+
var pe = u("╯", "+");
|
|
1840
|
+
var q = u("●", "•");
|
|
1841
|
+
var D = u("◆", "*");
|
|
1842
|
+
var U = u("▲", "!");
|
|
1843
|
+
var K2 = u("■", "x");
|
|
1844
|
+
var b2 = (t) => {
|
|
1845
|
+
switch (t) {
|
|
1846
|
+
case "initial":
|
|
1847
|
+
case "active":
|
|
1848
|
+
return import_picocolors2.default.cyan(le);
|
|
1849
|
+
case "cancel":
|
|
1850
|
+
return import_picocolors2.default.red(L2);
|
|
1851
|
+
case "error":
|
|
1852
|
+
return import_picocolors2.default.yellow(W2);
|
|
1853
|
+
case "submit":
|
|
1854
|
+
return import_picocolors2.default.green(C);
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
var G2 = (t) => {
|
|
1858
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
1859
|
+
let l2 = 0;
|
|
1860
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
1861
|
+
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
1862
|
+
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
1863
|
+
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
1864
|
+
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
1865
|
+
});
|
|
1866
|
+
};
|
|
1867
|
+
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
1868
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
1869
|
+
${b2(this.state)} ${t.message}
|
|
1870
|
+
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
1871
|
+
switch (this.state) {
|
|
1872
|
+
case "error":
|
|
1873
|
+
return `${n.trim()}
|
|
1874
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
1875
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
1876
|
+
`;
|
|
1877
|
+
case "submit":
|
|
1878
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
1879
|
+
case "cancel":
|
|
1880
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
1881
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
1882
|
+
default:
|
|
1883
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
1884
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1885
|
+
`;
|
|
1886
|
+
}
|
|
1887
|
+
} }).prompt();
|
|
1888
|
+
var ye = (t) => {
|
|
1889
|
+
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
1890
|
+
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
1891
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
1892
|
+
${b2(this.state)} ${t.message}
|
|
1893
|
+
`, s = this.value ? n : r2;
|
|
1894
|
+
switch (this.state) {
|
|
1895
|
+
case "submit":
|
|
1896
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
1897
|
+
case "cancel":
|
|
1898
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
1899
|
+
${import_picocolors2.default.gray(o)}`;
|
|
1900
|
+
default:
|
|
1901
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
1902
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1903
|
+
`;
|
|
1904
|
+
}
|
|
1905
|
+
} }).prompt();
|
|
1906
|
+
};
|
|
1907
|
+
var ve = (t) => {
|
|
1908
|
+
const n = (r2, i) => {
|
|
1909
|
+
const s = r2.label ?? String(r2.value);
|
|
1910
|
+
switch (i) {
|
|
1911
|
+
case "selected":
|
|
1912
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
1913
|
+
case "active":
|
|
1914
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
1915
|
+
case "cancelled":
|
|
1916
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
1917
|
+
default:
|
|
1918
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
1922
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
1923
|
+
${b2(this.state)} ${t.message}
|
|
1924
|
+
`;
|
|
1925
|
+
switch (this.state) {
|
|
1926
|
+
case "submit":
|
|
1927
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
1928
|
+
case "cancel":
|
|
1929
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
1930
|
+
${import_picocolors2.default.gray(o)}`;
|
|
1931
|
+
default:
|
|
1932
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
1933
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
1934
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1935
|
+
`;
|
|
1936
|
+
}
|
|
1937
|
+
} }).prompt();
|
|
1938
|
+
};
|
|
1939
|
+
var xe = (t = "") => {
|
|
1940
|
+
process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
|
|
1941
|
+
|
|
1942
|
+
`);
|
|
1943
|
+
};
|
|
1944
|
+
var Ie = (t = "") => {
|
|
1945
|
+
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
1946
|
+
`);
|
|
1947
|
+
};
|
|
1948
|
+
var Se = (t = "") => {
|
|
1949
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
1950
|
+
${import_picocolors2.default.gray(d2)} ${t}
|
|
1951
|
+
|
|
1952
|
+
`);
|
|
1953
|
+
};
|
|
1954
|
+
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
1955
|
+
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
1956
|
+
const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
1957
|
+
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
1958
|
+
const p2 = (m2) => {
|
|
1959
|
+
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
1960
|
+
a && N2(h2, m2);
|
|
1961
|
+
}, v2 = () => p2(2), f = () => p2(1), j2 = () => {
|
|
1962
|
+
process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
|
|
1963
|
+
}, E = () => {
|
|
1964
|
+
process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
|
|
1965
|
+
}, B2 = () => {
|
|
1966
|
+
if ($2 === undefined)
|
|
1967
|
+
return;
|
|
1968
|
+
i && process.stdout.write(`
|
|
1969
|
+
`);
|
|
1970
|
+
const m2 = $2.split(`
|
|
1971
|
+
`);
|
|
1972
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
|
|
1973
|
+
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
|
|
1974
|
+
const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
1975
|
+
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
1976
|
+
}, H = (m2 = "") => {
|
|
1977
|
+
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
1978
|
+
`);
|
|
1979
|
+
let h2 = 0, w2 = 0;
|
|
1980
|
+
j2(), c = setInterval(() => {
|
|
1981
|
+
if (i && l2 === $2)
|
|
1982
|
+
return;
|
|
1983
|
+
B2(), $2 = l2;
|
|
1984
|
+
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
1985
|
+
if (i)
|
|
1986
|
+
process.stdout.write(`${I2} ${l2}...`);
|
|
1987
|
+
else if (t === "timer")
|
|
1988
|
+
process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
1989
|
+
else {
|
|
1990
|
+
const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
1991
|
+
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
1992
|
+
}
|
|
1993
|
+
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
1994
|
+
}, r2);
|
|
1995
|
+
}, N2 = (m2 = "", h2 = 0) => {
|
|
1996
|
+
a = false, clearInterval(c), B2();
|
|
1997
|
+
const w2 = h2 === 0 ? import_picocolors2.default.green(C) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
|
|
1998
|
+
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
1999
|
+
`) : process.stdout.write(`${w2} ${l2}
|
|
2000
|
+
`), E(), s();
|
|
2001
|
+
};
|
|
2002
|
+
return { start: H, stop: N2, message: (m2 = "") => {
|
|
2003
|
+
l2 = R2(m2 ?? l2);
|
|
2004
|
+
} };
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
// src/index.ts
|
|
2008
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
2009
|
+
|
|
2010
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
2011
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
2012
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
2013
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
2014
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
2015
|
+
var styles = {
|
|
2016
|
+
modifier: {
|
|
2017
|
+
reset: [0, 0],
|
|
2018
|
+
bold: [1, 22],
|
|
2019
|
+
dim: [2, 22],
|
|
2020
|
+
italic: [3, 23],
|
|
2021
|
+
underline: [4, 24],
|
|
2022
|
+
overline: [53, 55],
|
|
2023
|
+
inverse: [7, 27],
|
|
2024
|
+
hidden: [8, 28],
|
|
2025
|
+
strikethrough: [9, 29]
|
|
2026
|
+
},
|
|
2027
|
+
color: {
|
|
2028
|
+
black: [30, 39],
|
|
2029
|
+
red: [31, 39],
|
|
2030
|
+
green: [32, 39],
|
|
2031
|
+
yellow: [33, 39],
|
|
2032
|
+
blue: [34, 39],
|
|
2033
|
+
magenta: [35, 39],
|
|
2034
|
+
cyan: [36, 39],
|
|
2035
|
+
white: [37, 39],
|
|
2036
|
+
blackBright: [90, 39],
|
|
2037
|
+
gray: [90, 39],
|
|
2038
|
+
grey: [90, 39],
|
|
2039
|
+
redBright: [91, 39],
|
|
2040
|
+
greenBright: [92, 39],
|
|
2041
|
+
yellowBright: [93, 39],
|
|
2042
|
+
blueBright: [94, 39],
|
|
2043
|
+
magentaBright: [95, 39],
|
|
2044
|
+
cyanBright: [96, 39],
|
|
2045
|
+
whiteBright: [97, 39]
|
|
2046
|
+
},
|
|
2047
|
+
bgColor: {
|
|
2048
|
+
bgBlack: [40, 49],
|
|
2049
|
+
bgRed: [41, 49],
|
|
2050
|
+
bgGreen: [42, 49],
|
|
2051
|
+
bgYellow: [43, 49],
|
|
2052
|
+
bgBlue: [44, 49],
|
|
2053
|
+
bgMagenta: [45, 49],
|
|
2054
|
+
bgCyan: [46, 49],
|
|
2055
|
+
bgWhite: [47, 49],
|
|
2056
|
+
bgBlackBright: [100, 49],
|
|
2057
|
+
bgGray: [100, 49],
|
|
2058
|
+
bgGrey: [100, 49],
|
|
2059
|
+
bgRedBright: [101, 49],
|
|
2060
|
+
bgGreenBright: [102, 49],
|
|
2061
|
+
bgYellowBright: [103, 49],
|
|
2062
|
+
bgBlueBright: [104, 49],
|
|
2063
|
+
bgMagentaBright: [105, 49],
|
|
2064
|
+
bgCyanBright: [106, 49],
|
|
2065
|
+
bgWhiteBright: [107, 49]
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
2069
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
2070
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
2071
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
2072
|
+
function assembleStyles() {
|
|
2073
|
+
const codes = new Map;
|
|
2074
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
2075
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
2076
|
+
styles[styleName] = {
|
|
2077
|
+
open: `\x1B[${style[0]}m`,
|
|
2078
|
+
close: `\x1B[${style[1]}m`
|
|
2079
|
+
};
|
|
2080
|
+
group[styleName] = styles[styleName];
|
|
2081
|
+
codes.set(style[0], style[1]);
|
|
2082
|
+
}
|
|
2083
|
+
Object.defineProperty(styles, groupName, {
|
|
2084
|
+
value: group,
|
|
2085
|
+
enumerable: false
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
Object.defineProperty(styles, "codes", {
|
|
2089
|
+
value: codes,
|
|
2090
|
+
enumerable: false
|
|
2091
|
+
});
|
|
2092
|
+
styles.color.close = "\x1B[39m";
|
|
2093
|
+
styles.bgColor.close = "\x1B[49m";
|
|
2094
|
+
styles.color.ansi = wrapAnsi16();
|
|
2095
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
2096
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
2097
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
2098
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
2099
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
2100
|
+
Object.defineProperties(styles, {
|
|
2101
|
+
rgbToAnsi256: {
|
|
2102
|
+
value(red, green, blue) {
|
|
2103
|
+
if (red === green && green === blue) {
|
|
2104
|
+
if (red < 8) {
|
|
2105
|
+
return 16;
|
|
2106
|
+
}
|
|
2107
|
+
if (red > 248) {
|
|
2108
|
+
return 231;
|
|
2109
|
+
}
|
|
2110
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
2111
|
+
}
|
|
2112
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
2113
|
+
},
|
|
2114
|
+
enumerable: false
|
|
2115
|
+
},
|
|
2116
|
+
hexToRgb: {
|
|
2117
|
+
value(hex) {
|
|
2118
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
2119
|
+
if (!matches) {
|
|
2120
|
+
return [0, 0, 0];
|
|
2121
|
+
}
|
|
2122
|
+
let [colorString] = matches;
|
|
2123
|
+
if (colorString.length === 3) {
|
|
2124
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
2125
|
+
}
|
|
2126
|
+
const integer = Number.parseInt(colorString, 16);
|
|
2127
|
+
return [
|
|
2128
|
+
integer >> 16 & 255,
|
|
2129
|
+
integer >> 8 & 255,
|
|
2130
|
+
integer & 255
|
|
2131
|
+
];
|
|
2132
|
+
},
|
|
2133
|
+
enumerable: false
|
|
2134
|
+
},
|
|
2135
|
+
hexToAnsi256: {
|
|
2136
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
2137
|
+
enumerable: false
|
|
2138
|
+
},
|
|
2139
|
+
ansi256ToAnsi: {
|
|
2140
|
+
value(code) {
|
|
2141
|
+
if (code < 8) {
|
|
2142
|
+
return 30 + code;
|
|
2143
|
+
}
|
|
2144
|
+
if (code < 16) {
|
|
2145
|
+
return 90 + (code - 8);
|
|
2146
|
+
}
|
|
2147
|
+
let red;
|
|
2148
|
+
let green;
|
|
2149
|
+
let blue;
|
|
2150
|
+
if (code >= 232) {
|
|
2151
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
2152
|
+
green = red;
|
|
2153
|
+
blue = red;
|
|
2154
|
+
} else {
|
|
2155
|
+
code -= 16;
|
|
2156
|
+
const remainder = code % 36;
|
|
2157
|
+
red = Math.floor(code / 36) / 5;
|
|
2158
|
+
green = Math.floor(remainder / 6) / 5;
|
|
2159
|
+
blue = remainder % 6 / 5;
|
|
2160
|
+
}
|
|
2161
|
+
const value = Math.max(red, green, blue) * 2;
|
|
2162
|
+
if (value === 0) {
|
|
2163
|
+
return 30;
|
|
2164
|
+
}
|
|
2165
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
2166
|
+
if (value === 2) {
|
|
2167
|
+
result += 60;
|
|
2168
|
+
}
|
|
2169
|
+
return result;
|
|
2170
|
+
},
|
|
2171
|
+
enumerable: false
|
|
2172
|
+
},
|
|
2173
|
+
rgbToAnsi: {
|
|
2174
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
2175
|
+
enumerable: false
|
|
2176
|
+
},
|
|
2177
|
+
hexToAnsi: {
|
|
2178
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
2179
|
+
enumerable: false
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
return styles;
|
|
2183
|
+
}
|
|
2184
|
+
var ansiStyles = assembleStyles();
|
|
2185
|
+
var ansi_styles_default = ansiStyles;
|
|
2186
|
+
|
|
2187
|
+
// node_modules/chalk/source/vendor/supports-color/index.js
|
|
2188
|
+
import process2 from "node:process";
|
|
2189
|
+
import os from "node:os";
|
|
2190
|
+
import tty from "node:tty";
|
|
2191
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
2192
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
2193
|
+
const position = argv.indexOf(prefix + flag);
|
|
2194
|
+
const terminatorPosition = argv.indexOf("--");
|
|
2195
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
2196
|
+
}
|
|
2197
|
+
var { env } = process2;
|
|
2198
|
+
var flagForceColor;
|
|
2199
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
2200
|
+
flagForceColor = 0;
|
|
2201
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
2202
|
+
flagForceColor = 1;
|
|
2203
|
+
}
|
|
2204
|
+
function envForceColor() {
|
|
2205
|
+
if ("FORCE_COLOR" in env) {
|
|
2206
|
+
if (env.FORCE_COLOR === "true") {
|
|
2207
|
+
return 1;
|
|
2208
|
+
}
|
|
2209
|
+
if (env.FORCE_COLOR === "false") {
|
|
2210
|
+
return 0;
|
|
2211
|
+
}
|
|
2212
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
function translateLevel(level) {
|
|
2216
|
+
if (level === 0) {
|
|
2217
|
+
return false;
|
|
2218
|
+
}
|
|
2219
|
+
return {
|
|
2220
|
+
level,
|
|
2221
|
+
hasBasic: true,
|
|
2222
|
+
has256: level >= 2,
|
|
2223
|
+
has16m: level >= 3
|
|
2224
|
+
};
|
|
2225
|
+
}
|
|
2226
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
2227
|
+
const noFlagForceColor = envForceColor();
|
|
2228
|
+
if (noFlagForceColor !== undefined) {
|
|
2229
|
+
flagForceColor = noFlagForceColor;
|
|
2230
|
+
}
|
|
2231
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
2232
|
+
if (forceColor === 0) {
|
|
2233
|
+
return 0;
|
|
2234
|
+
}
|
|
2235
|
+
if (sniffFlags) {
|
|
2236
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
2237
|
+
return 3;
|
|
2238
|
+
}
|
|
2239
|
+
if (hasFlag("color=256")) {
|
|
2240
|
+
return 2;
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
2244
|
+
return 1;
|
|
2245
|
+
}
|
|
2246
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
2247
|
+
return 0;
|
|
2248
|
+
}
|
|
2249
|
+
const min = forceColor || 0;
|
|
2250
|
+
if (env.TERM === "dumb") {
|
|
2251
|
+
return min;
|
|
2252
|
+
}
|
|
2253
|
+
if (process2.platform === "win32") {
|
|
2254
|
+
const osRelease = os.release().split(".");
|
|
2255
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
2256
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2257
|
+
}
|
|
2258
|
+
return 1;
|
|
2259
|
+
}
|
|
2260
|
+
if ("CI" in env) {
|
|
2261
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
|
|
2262
|
+
return 3;
|
|
2263
|
+
}
|
|
2264
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
2265
|
+
return 1;
|
|
2266
|
+
}
|
|
2267
|
+
return min;
|
|
2268
|
+
}
|
|
2269
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
2270
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
2271
|
+
}
|
|
2272
|
+
if (env.COLORTERM === "truecolor") {
|
|
2273
|
+
return 3;
|
|
2274
|
+
}
|
|
2275
|
+
if (env.TERM === "xterm-kitty") {
|
|
2276
|
+
return 3;
|
|
2277
|
+
}
|
|
2278
|
+
if (env.TERM === "xterm-ghostty") {
|
|
2279
|
+
return 3;
|
|
2280
|
+
}
|
|
2281
|
+
if (env.TERM === "wezterm") {
|
|
2282
|
+
return 3;
|
|
2283
|
+
}
|
|
2284
|
+
if ("TERM_PROGRAM" in env) {
|
|
2285
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
2286
|
+
switch (env.TERM_PROGRAM) {
|
|
2287
|
+
case "iTerm.app": {
|
|
2288
|
+
return version >= 3 ? 3 : 2;
|
|
2289
|
+
}
|
|
2290
|
+
case "Apple_Terminal": {
|
|
2291
|
+
return 2;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
2296
|
+
return 2;
|
|
2297
|
+
}
|
|
2298
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
2299
|
+
return 1;
|
|
2300
|
+
}
|
|
2301
|
+
if ("COLORTERM" in env) {
|
|
2302
|
+
return 1;
|
|
2303
|
+
}
|
|
2304
|
+
return min;
|
|
2305
|
+
}
|
|
2306
|
+
function createSupportsColor(stream, options = {}) {
|
|
2307
|
+
const level = _supportsColor(stream, {
|
|
2308
|
+
streamIsTTY: stream && stream.isTTY,
|
|
2309
|
+
...options
|
|
2310
|
+
});
|
|
2311
|
+
return translateLevel(level);
|
|
2312
|
+
}
|
|
2313
|
+
var supportsColor = {
|
|
2314
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
2315
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
2316
|
+
};
|
|
2317
|
+
var supports_color_default = supportsColor;
|
|
2318
|
+
|
|
2319
|
+
// node_modules/chalk/source/utilities.js
|
|
2320
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
2321
|
+
let index = string.indexOf(substring);
|
|
2322
|
+
if (index === -1) {
|
|
2323
|
+
return string;
|
|
2324
|
+
}
|
|
2325
|
+
const substringLength = substring.length;
|
|
2326
|
+
let endIndex = 0;
|
|
2327
|
+
let returnValue = "";
|
|
2328
|
+
do {
|
|
2329
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
2330
|
+
endIndex = index + substringLength;
|
|
2331
|
+
index = string.indexOf(substring, endIndex);
|
|
2332
|
+
} while (index !== -1);
|
|
2333
|
+
returnValue += string.slice(endIndex);
|
|
2334
|
+
return returnValue;
|
|
2335
|
+
}
|
|
2336
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
2337
|
+
let endIndex = 0;
|
|
2338
|
+
let returnValue = "";
|
|
2339
|
+
do {
|
|
2340
|
+
const gotCR = string[index - 1] === "\r";
|
|
2341
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
2342
|
+
` : `
|
|
2343
|
+
`) + postfix;
|
|
2344
|
+
endIndex = index + 1;
|
|
2345
|
+
index = string.indexOf(`
|
|
2346
|
+
`, endIndex);
|
|
2347
|
+
} while (index !== -1);
|
|
2348
|
+
returnValue += string.slice(endIndex);
|
|
2349
|
+
return returnValue;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// node_modules/chalk/source/index.js
|
|
2353
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
2354
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
2355
|
+
var STYLER = Symbol("STYLER");
|
|
2356
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
2357
|
+
var levelMapping = [
|
|
2358
|
+
"ansi",
|
|
2359
|
+
"ansi",
|
|
2360
|
+
"ansi256",
|
|
2361
|
+
"ansi16m"
|
|
2362
|
+
];
|
|
2363
|
+
var styles2 = Object.create(null);
|
|
2364
|
+
var applyOptions = (object, options = {}) => {
|
|
2365
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
2366
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
2367
|
+
}
|
|
2368
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
2369
|
+
object.level = options.level === undefined ? colorLevel : options.level;
|
|
2370
|
+
};
|
|
2371
|
+
var chalkFactory = (options) => {
|
|
2372
|
+
const chalk = (...strings) => strings.join(" ");
|
|
2373
|
+
applyOptions(chalk, options);
|
|
2374
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
2375
|
+
return chalk;
|
|
2376
|
+
};
|
|
2377
|
+
function createChalk(options) {
|
|
2378
|
+
return chalkFactory(options);
|
|
2379
|
+
}
|
|
2380
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
2381
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
2382
|
+
styles2[styleName] = {
|
|
2383
|
+
get() {
|
|
2384
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
2385
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
2386
|
+
return builder;
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
styles2.visible = {
|
|
2391
|
+
get() {
|
|
2392
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
2393
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
2394
|
+
return builder;
|
|
2395
|
+
}
|
|
2396
|
+
};
|
|
2397
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
2398
|
+
if (model === "rgb") {
|
|
2399
|
+
if (level === "ansi16m") {
|
|
2400
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
2401
|
+
}
|
|
2402
|
+
if (level === "ansi256") {
|
|
2403
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
2404
|
+
}
|
|
2405
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
2406
|
+
}
|
|
2407
|
+
if (model === "hex") {
|
|
2408
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
2409
|
+
}
|
|
2410
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
2411
|
+
};
|
|
2412
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
2413
|
+
for (const model of usedModels) {
|
|
2414
|
+
styles2[model] = {
|
|
2415
|
+
get() {
|
|
2416
|
+
const { level } = this;
|
|
2417
|
+
return function(...arguments_) {
|
|
2418
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
2419
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
};
|
|
2423
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
2424
|
+
styles2[bgModel] = {
|
|
2425
|
+
get() {
|
|
2426
|
+
const { level } = this;
|
|
2427
|
+
return function(...arguments_) {
|
|
2428
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
2429
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
var proto = Object.defineProperties(() => {}, {
|
|
2435
|
+
...styles2,
|
|
2436
|
+
level: {
|
|
2437
|
+
enumerable: true,
|
|
2438
|
+
get() {
|
|
2439
|
+
return this[GENERATOR].level;
|
|
2440
|
+
},
|
|
2441
|
+
set(level) {
|
|
2442
|
+
this[GENERATOR].level = level;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
var createStyler = (open, close, parent) => {
|
|
2447
|
+
let openAll;
|
|
2448
|
+
let closeAll;
|
|
2449
|
+
if (parent === undefined) {
|
|
2450
|
+
openAll = open;
|
|
2451
|
+
closeAll = close;
|
|
2452
|
+
} else {
|
|
2453
|
+
openAll = parent.openAll + open;
|
|
2454
|
+
closeAll = close + parent.closeAll;
|
|
2455
|
+
}
|
|
2456
|
+
return {
|
|
2457
|
+
open,
|
|
2458
|
+
close,
|
|
2459
|
+
openAll,
|
|
2460
|
+
closeAll,
|
|
2461
|
+
parent
|
|
2462
|
+
};
|
|
2463
|
+
};
|
|
2464
|
+
var createBuilder = (self2, _styler, _isEmpty) => {
|
|
2465
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
2466
|
+
Object.setPrototypeOf(builder, proto);
|
|
2467
|
+
builder[GENERATOR] = self2;
|
|
2468
|
+
builder[STYLER] = _styler;
|
|
2469
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
2470
|
+
return builder;
|
|
2471
|
+
};
|
|
2472
|
+
var applyStyle = (self2, string) => {
|
|
2473
|
+
if (self2.level <= 0 || !string) {
|
|
2474
|
+
return self2[IS_EMPTY] ? "" : string;
|
|
2475
|
+
}
|
|
2476
|
+
let styler = self2[STYLER];
|
|
2477
|
+
if (styler === undefined) {
|
|
2478
|
+
return string;
|
|
2479
|
+
}
|
|
2480
|
+
const { openAll, closeAll } = styler;
|
|
2481
|
+
if (string.includes("\x1B")) {
|
|
2482
|
+
while (styler !== undefined) {
|
|
2483
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
2484
|
+
styler = styler.parent;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
const lfIndex = string.indexOf(`
|
|
2488
|
+
`);
|
|
2489
|
+
if (lfIndex !== -1) {
|
|
2490
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
2491
|
+
}
|
|
2492
|
+
return openAll + string + closeAll;
|
|
2493
|
+
};
|
|
2494
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
2495
|
+
var chalk = createChalk();
|
|
2496
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
2497
|
+
var source_default = chalk;
|
|
2498
|
+
|
|
2499
|
+
// node_modules/gradient-string/dist/index.js
|
|
2500
|
+
var import_tinygradient = __toESM(require_tinygradient(), 1);
|
|
2501
|
+
var gradient = (...colors) => {
|
|
2502
|
+
let gradient2;
|
|
2503
|
+
let options;
|
|
2504
|
+
if (colors.length === 0) {
|
|
2505
|
+
throw new Error("Missing gradient colors");
|
|
2506
|
+
}
|
|
2507
|
+
if (!Array.isArray(colors[0])) {
|
|
2508
|
+
if (colors.length === 1) {
|
|
2509
|
+
throw new Error(`Expected an array of colors, received ${JSON.stringify(colors[0])}`);
|
|
2510
|
+
}
|
|
2511
|
+
gradient2 = import_tinygradient.default(...colors);
|
|
2512
|
+
} else {
|
|
2513
|
+
gradient2 = import_tinygradient.default(colors[0]);
|
|
2514
|
+
options = validateOptions(colors[1]);
|
|
2515
|
+
}
|
|
2516
|
+
const fn = (str, deprecatedOptions) => {
|
|
2517
|
+
return applyGradient(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
|
|
2518
|
+
};
|
|
2519
|
+
fn.multiline = (str, deprecatedOptions) => multiline(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
|
|
2520
|
+
return fn;
|
|
2521
|
+
};
|
|
2522
|
+
var getColors = (gradient2, options, count) => {
|
|
2523
|
+
return options.interpolation?.toLowerCase() === "hsv" ? gradient2.hsv(count, options.hsvSpin?.toLowerCase() || false) : gradient2.rgb(count);
|
|
2524
|
+
};
|
|
2525
|
+
function applyGradient(str, gradient2, opts) {
|
|
2526
|
+
const options = validateOptions(opts);
|
|
2527
|
+
const colorsCount = Math.max(str.replace(/\s/g, "").length, gradient2.stops.length);
|
|
2528
|
+
const colors = getColors(gradient2, options, colorsCount);
|
|
2529
|
+
let result = "";
|
|
2530
|
+
for (const s of str) {
|
|
2531
|
+
result += s.match(/\s/g) ? s : source_default.hex(colors.shift()?.toHex() || "#000")(s);
|
|
2532
|
+
}
|
|
2533
|
+
return result;
|
|
2534
|
+
}
|
|
2535
|
+
function multiline(str, gradient2, opts) {
|
|
2536
|
+
const options = validateOptions(opts);
|
|
2537
|
+
const lines = str.split(`
|
|
2538
|
+
`);
|
|
2539
|
+
const maxLength = Math.max(...lines.map((l2) => l2.length), gradient2.stops.length);
|
|
2540
|
+
const colors = getColors(gradient2, options, maxLength);
|
|
2541
|
+
const results = [];
|
|
2542
|
+
for (const line of lines) {
|
|
2543
|
+
const lineColors = colors.slice(0);
|
|
2544
|
+
let lineResult = "";
|
|
2545
|
+
for (const l2 of line) {
|
|
2546
|
+
lineResult += source_default.hex(lineColors.shift()?.toHex() || "#000")(l2);
|
|
2547
|
+
}
|
|
2548
|
+
results.push(lineResult);
|
|
2549
|
+
}
|
|
2550
|
+
return results.join(`
|
|
2551
|
+
`);
|
|
2552
|
+
}
|
|
2553
|
+
function validateOptions(opts) {
|
|
2554
|
+
const options = { interpolation: "rgb", hsvSpin: "short", ...opts };
|
|
2555
|
+
if (opts !== undefined && typeof opts !== "object") {
|
|
2556
|
+
throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof opts}\``);
|
|
2557
|
+
}
|
|
2558
|
+
if (typeof options.interpolation !== "string") {
|
|
2559
|
+
throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof options.interpolation}\``);
|
|
2560
|
+
}
|
|
2561
|
+
if (options.interpolation.toLowerCase() === "hsv" && typeof options.hsvSpin !== "string") {
|
|
2562
|
+
throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof options.hsvSpin}\``);
|
|
2563
|
+
}
|
|
2564
|
+
return options;
|
|
2565
|
+
}
|
|
2566
|
+
var aliases = {
|
|
2567
|
+
atlas: { colors: ["#feac5e", "#c779d0", "#4bc0c8"], options: {} },
|
|
2568
|
+
cristal: { colors: ["#bdfff3", "#4ac29a"], options: {} },
|
|
2569
|
+
teen: { colors: ["#77a1d3", "#79cbca", "#e684ae"], options: {} },
|
|
2570
|
+
mind: { colors: ["#473b7b", "#3584a7", "#30d2be"], options: {} },
|
|
2571
|
+
morning: { colors: ["#ff5f6d", "#ffc371"], options: { interpolation: "hsv" } },
|
|
2572
|
+
vice: { colors: ["#5ee7df", "#b490ca"], options: { interpolation: "hsv" } },
|
|
2573
|
+
passion: { colors: ["#f43b47", "#453a94"], options: {} },
|
|
2574
|
+
fruit: { colors: ["#ff4e50", "#f9d423"], options: {} },
|
|
2575
|
+
instagram: { colors: ["#833ab4", "#fd1d1d", "#fcb045"], options: {} },
|
|
2576
|
+
retro: {
|
|
2577
|
+
colors: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
|
|
2578
|
+
options: {}
|
|
2579
|
+
},
|
|
2580
|
+
summer: { colors: ["#fdbb2d", "#22c1c3"], options: {} },
|
|
2581
|
+
rainbow: { colors: ["#ff0000", "#ff0100"], options: { interpolation: "hsv", hsvSpin: "long" } },
|
|
2582
|
+
pastel: { colors: ["#74ebd5", "#74ecd5"], options: { interpolation: "hsv", hsvSpin: "long" } }
|
|
2583
|
+
};
|
|
2584
|
+
function gradientAlias(alias) {
|
|
2585
|
+
const result = (str) => gradient(...alias.colors)(str, alias.options);
|
|
2586
|
+
result.multiline = (str = "") => gradient(...alias.colors).multiline(str, alias.options);
|
|
2587
|
+
return result;
|
|
2588
|
+
}
|
|
2589
|
+
var dist_default = gradient;
|
|
2590
|
+
var atlas = gradientAlias(aliases.atlas);
|
|
2591
|
+
var cristal = gradientAlias(aliases.cristal);
|
|
2592
|
+
var teen = gradientAlias(aliases.teen);
|
|
2593
|
+
var mind = gradientAlias(aliases.mind);
|
|
2594
|
+
var morning = gradientAlias(aliases.morning);
|
|
2595
|
+
var vice = gradientAlias(aliases.vice);
|
|
2596
|
+
var passion = gradientAlias(aliases.passion);
|
|
2597
|
+
var fruit = gradientAlias(aliases.fruit);
|
|
2598
|
+
var instagram = gradientAlias(aliases.instagram);
|
|
2599
|
+
var retro = gradientAlias(aliases.retro);
|
|
2600
|
+
var summer = gradientAlias(aliases.summer);
|
|
2601
|
+
var rainbow = gradientAlias(aliases.rainbow);
|
|
2602
|
+
var pastel = gradientAlias(aliases.pastel);
|
|
2603
|
+
gradient.atlas = atlas;
|
|
2604
|
+
gradient.cristal = cristal;
|
|
2605
|
+
gradient.teen = teen;
|
|
2606
|
+
gradient.mind = mind;
|
|
2607
|
+
gradient.morning = morning;
|
|
2608
|
+
gradient.vice = vice;
|
|
2609
|
+
gradient.passion = passion;
|
|
2610
|
+
gradient.fruit = fruit;
|
|
2611
|
+
gradient.instagram = instagram;
|
|
2612
|
+
gradient.retro = retro;
|
|
2613
|
+
gradient.summer = summer;
|
|
2614
|
+
gradient.rainbow = rainbow;
|
|
2615
|
+
gradient.pastel = pastel;
|
|
2616
|
+
|
|
2617
|
+
// src/templates.ts
|
|
2618
|
+
var templates = {
|
|
2619
|
+
index: (name, template) => `import { ZenithPlugin } from "@zenith/core";
|
|
2620
|
+
|
|
2621
|
+
export const plugin: ZenithPlugin = {
|
|
2622
|
+
name: "${name}",
|
|
2623
|
+
template: "${template}", // scaffolding hint, not restrictive
|
|
2624
|
+
options: {},
|
|
2625
|
+
setup(ctx) {
|
|
2626
|
+
// Stub only; user implements plugin functionality here
|
|
2627
|
+
console.log("Setup called for ${name} of template ${template}");
|
|
2628
|
+
}
|
|
2629
|
+
};
|
|
2630
|
+
`,
|
|
2631
|
+
types: () => `export interface PluginOptions {
|
|
2632
|
+
// scaffold options for plugin, to be implemented by contributor
|
|
2633
|
+
}
|
|
2634
|
+
`,
|
|
2635
|
+
readme: (name, template) => {
|
|
2636
|
+
const camelName = name.replace(/-([a-z])/g, (g2) => g2[1].toUpperCase());
|
|
2637
|
+
const capitalizedName = name.charAt(0).toUpperCase() + name.slice(1);
|
|
2638
|
+
return `# ⚡ Zenith ${capitalizedName} Plugin
|
|
2639
|
+
|
|
2640
|
+
<div align="center">
|
|
2641
|
+
<img src="https://raw.githubusercontent.com/zenithbuild/zenith/main/assets/logos/logo.png" alt="Zenith Logo" width="120" />
|
|
2642
|
+
<h3>Scale your Zenith experience with ${capitalizedName}</h3>
|
|
2643
|
+
|
|
2644
|
+
[](https://github.com/zenithbuild/zenith)
|
|
2645
|
+
[](https://github.com/zenithbuild/create-zenith-plugin)
|
|
2646
|
+
</div>
|
|
2647
|
+
|
|
2648
|
+
---
|
|
2649
|
+
|
|
2650
|
+
## \uD83D\uDCD6 Introduction
|
|
2651
|
+
|
|
2652
|
+
Welcome to the **${name}** plugin! \uD83C\uDFAF
|
|
2653
|
+
|
|
2654
|
+
This plugin exists to [Enter specific purpose here: e.g., integrate with Firebase, provide custom theming utilities, etc.]. It has been scaffolded using the **${template}** pattern, ensuring it integrates seamlessly with the Zenith core while staying flexible for your needs.
|
|
2655
|
+
|
|
2656
|
+
### Why use this?
|
|
2657
|
+
- **Seamless Integration**: Designed specifically for the Zenith runtime.
|
|
2658
|
+
- **Type Safe**: Built with TypeScript from the ground up.
|
|
2659
|
+
- **DX Focused**: Includes example stubs to get you running in seconds.
|
|
2660
|
+
|
|
2661
|
+
---
|
|
2662
|
+
|
|
2663
|
+
## ⚙️ Installation
|
|
2664
|
+
|
|
2665
|
+
To enable the **${name}** plugin in your Zenith project:
|
|
2666
|
+
|
|
2667
|
+
1. Import the plugin in your \`zenith.config.ts\`:
|
|
2668
|
+
|
|
2669
|
+
\`\`\`ts
|
|
2670
|
+
import { plugin as ${camelName} } from "./plugins/${name}";
|
|
2671
|
+
|
|
2672
|
+
export default {
|
|
2673
|
+
// ... other config
|
|
2674
|
+
plugins: [
|
|
2675
|
+
${camelName}({
|
|
2676
|
+
/* options */
|
|
2677
|
+
})
|
|
2678
|
+
]
|
|
2679
|
+
};
|
|
2680
|
+
\`\`\`
|
|
2681
|
+
|
|
2682
|
+
2. Zenith will automatically call the \`setup\` hook during the initialization phase.
|
|
2683
|
+
|
|
2684
|
+
---
|
|
2685
|
+
|
|
2686
|
+
## \uD83D\uDEE0️ Configuration
|
|
2687
|
+
|
|
2688
|
+
The plugin accepts an options object. Define your parameters in \`types.ts\` and handle them in \`index.ts\`.
|
|
2689
|
+
|
|
2690
|
+
| Option | Type | Default | Description |
|
|
2691
|
+
| :--- | :--- | :--- | :--- |
|
|
2692
|
+
| \`enabled\` | \`boolean\` | \`true\` | Toggle the plugin functionality |
|
|
2693
|
+
| \`apiKey\` | \`string\` | \`undefined\` | Required for service-based plugins |
|
|
2694
|
+
|
|
2695
|
+
> [!TIP]
|
|
2696
|
+
> **Pro Tip**: Always use environment variables for sensitive options like \`apiKey\`. Use \`process.env.MY_PLUGIN_KEY\` in your config!
|
|
2697
|
+
|
|
2698
|
+
---
|
|
2699
|
+
|
|
2700
|
+
## \uD83D\uDE80 Usage
|
|
2701
|
+
|
|
2702
|
+
Once configured, the plugin interacts with the Zenith lifecycle via the \`setup(ctx)\` function.
|
|
2703
|
+
|
|
2704
|
+
### Runtime Hooks
|
|
2705
|
+
You can access the Zenith context (\`ctx\`) to:
|
|
2706
|
+
- Access the component registry.
|
|
2707
|
+
- Inject global styles.
|
|
2708
|
+
- Listen to lifecycle events.
|
|
2709
|
+
|
|
2710
|
+
\`\`\`ts
|
|
2711
|
+
// Example: Implementation inside index.ts
|
|
2712
|
+
setup(ctx) {
|
|
2713
|
+
ctx.on('mount', () => {
|
|
2714
|
+
console.log("${capitalizedName} is active!");
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
\`\`\`
|
|
2718
|
+
|
|
2719
|
+
---
|
|
2720
|
+
|
|
2721
|
+
## \uD83C\uDFA8 Examples
|
|
2722
|
+
|
|
2723
|
+
### Basic Setup
|
|
2724
|
+
[Provide a simple use case here]
|
|
2725
|
+
|
|
2726
|
+
### Advanced Customization
|
|
2727
|
+
[Demonstrate complex logic or hooks interaction here]
|
|
2728
|
+
|
|
2729
|
+
---
|
|
2730
|
+
|
|
2731
|
+
## \uD83E\uDE7A Troubleshooting & FAQ
|
|
2732
|
+
|
|
2733
|
+
> [!CAUTION]
|
|
2734
|
+
> **Common Pitfall**: If your plugin isn't firing, ensure it's added to the \`plugins\` array in the *correct* environment config.
|
|
2735
|
+
|
|
2736
|
+
**Q: Can I use this with other plugins?**
|
|
2737
|
+
A: Yes! Zenith plugins are composable. Just be mindful of hook execution order.
|
|
2738
|
+
|
|
2739
|
+
**Q: Where do my logs go?**
|
|
2740
|
+
A: By default, logs from the \`setup\` hook appear in your dev server console.
|
|
2741
|
+
|
|
2742
|
+
---
|
|
2743
|
+
|
|
2744
|
+
## \uD83E\uDD1D Contributing
|
|
2745
|
+
|
|
2746
|
+
We welcome all contributions to the Zenith ecosystem!
|
|
2747
|
+
- **Submit a Bug**: Open an issue describing the behavior.
|
|
2748
|
+
- **Request a Feature**: Let us know what's missing.
|
|
2749
|
+
- **PRs**: Point your PRs to the \`main\` branch.
|
|
2750
|
+
|
|
2751
|
+
---
|
|
2752
|
+
|
|
2753
|
+
*Generated with [create-zenith-plugin](https://github.com/zenithbuild/create-zenith-plugin)*
|
|
2754
|
+
`;
|
|
2755
|
+
},
|
|
2756
|
+
example: (name, template) => `// Example usage of the ${name} plugin (${template} template)
|
|
2757
|
+
// This file is purely for demonstration.
|
|
2758
|
+
`
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
// src/index.ts
|
|
2762
|
+
var VERSION = "0.1.0";
|
|
2763
|
+
var zenithGradient = dist_default(["#3b82f6", "#06b6d4", "#22d3ee"]);
|
|
2764
|
+
var LOGO_COMPACT = ` ${import_picocolors3.default.bold(zenithGradient("⚡ ZENITH"))} ${import_picocolors3.default.dim("- Create Plugin")}`;
|
|
2765
|
+
function showHelp() {
|
|
2766
|
+
console.log(`
|
|
2767
|
+
${LOGO_COMPACT}
|
|
2768
|
+
|
|
2769
|
+
Usage:
|
|
2770
|
+
create-zenith-plugin <plugin-name> [options]
|
|
2771
|
+
|
|
2772
|
+
Options:
|
|
2773
|
+
--template <type> Scaffold template (theme, content, utility) [default: utility]
|
|
2774
|
+
--include-example Include example files [default: false]
|
|
2775
|
+
--overwrite Overwrite existing directory [default: false]
|
|
2776
|
+
--help, -h Show help
|
|
2777
|
+
--version, -v Show version
|
|
2778
|
+
`);
|
|
2779
|
+
}
|
|
2780
|
+
async function main() {
|
|
2781
|
+
const args = process.argv.slice(2);
|
|
2782
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
2783
|
+
showHelp();
|
|
2784
|
+
process.exit(0);
|
|
2785
|
+
}
|
|
2786
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
2787
|
+
console.log(`zenith-create-plugin v${VERSION}`);
|
|
2788
|
+
process.exit(0);
|
|
2789
|
+
}
|
|
2790
|
+
Ie(zenithGradient("Zenith Plugin Creator"));
|
|
2791
|
+
let pluginName = args.find((a) => !a.startsWith("-"));
|
|
2792
|
+
const templateArg = args.find((a) => a.startsWith("--template="))?.split("=")[1] || (args.indexOf("--template") !== -1 ? args[args.indexOf("--template") + 1] : undefined);
|
|
2793
|
+
const includeExample = args.includes("--include-example");
|
|
2794
|
+
const overwrite = args.includes("--overwrite");
|
|
2795
|
+
if (!pluginName) {
|
|
2796
|
+
const name = await he({
|
|
2797
|
+
message: "What is the name of your plugin?",
|
|
2798
|
+
placeholder: "firebase",
|
|
2799
|
+
validate: (value) => {
|
|
2800
|
+
if (!value)
|
|
2801
|
+
return "Plugin name is required";
|
|
2802
|
+
if (/[^a-zA-Z0-9_-]/.test(value))
|
|
2803
|
+
return "Invalid characters in plugin name";
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
if (pD(name))
|
|
2807
|
+
return handleCancel();
|
|
2808
|
+
pluginName = name;
|
|
2809
|
+
}
|
|
2810
|
+
let template = templateArg;
|
|
2811
|
+
if (!template || !["theme", "content", "utility"].includes(template)) {
|
|
2812
|
+
const selected = await ve({
|
|
2813
|
+
message: "Select a scaffolding template:",
|
|
2814
|
+
options: [
|
|
2815
|
+
{ value: "utility", label: "Utility (Generic stub)", hint: "Recommended for most plugins" },
|
|
2816
|
+
{ value: "theme", label: "Theme (TailwindCSS / theming examples)" },
|
|
2817
|
+
{ value: "content", label: "Content (Markdown / CMS examples)" }
|
|
2818
|
+
]
|
|
2819
|
+
});
|
|
2820
|
+
if (pD(selected))
|
|
2821
|
+
return handleCancel();
|
|
2822
|
+
template = selected;
|
|
2823
|
+
}
|
|
2824
|
+
const targetDir = path.resolve(process.cwd(), pluginName);
|
|
2825
|
+
if (fs.existsSync(targetDir) && !overwrite) {
|
|
2826
|
+
const shouldOverwrite = await ye({
|
|
2827
|
+
message: `Directory "${pluginName}" already exists. Overwrite?`,
|
|
2828
|
+
initialValue: false
|
|
2829
|
+
});
|
|
2830
|
+
if (pD(shouldOverwrite) || !shouldOverwrite)
|
|
2831
|
+
return handleCancel();
|
|
2832
|
+
}
|
|
2833
|
+
const s = Y2();
|
|
2834
|
+
s.start(`Scaffolding ${import_picocolors3.default.cyan(pluginName)}...`);
|
|
2835
|
+
try {
|
|
2836
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
2837
|
+
fs.mkdirSync(path.join(targetDir, "utils"), { recursive: true });
|
|
2838
|
+
fs.writeFileSync(path.join(targetDir, "index.ts"), templates.index(pluginName, template));
|
|
2839
|
+
fs.writeFileSync(path.join(targetDir, "types.ts"), templates.types());
|
|
2840
|
+
fs.writeFileSync(path.join(targetDir, "README.md"), templates.readme(pluginName, template));
|
|
2841
|
+
if (includeExample) {
|
|
2842
|
+
const exampleDir = path.join(targetDir, "example", template);
|
|
2843
|
+
fs.mkdirSync(exampleDir, { recursive: true });
|
|
2844
|
+
fs.writeFileSync(path.join(exampleDir, "demo.ts"), templates.example(pluginName, template));
|
|
2845
|
+
}
|
|
2846
|
+
s.stop(`Plugin ${import_picocolors3.default.green(pluginName)} scaffolded successfully!`);
|
|
2847
|
+
Se(`Next steps:
|
|
2848
|
+
1. cd ${pluginName}
|
|
2849
|
+
2. Implement your logic in setup(ctx)
|
|
2850
|
+
3. Import and use in zenith.config.ts`);
|
|
2851
|
+
} catch (err) {
|
|
2852
|
+
s.stop("Failed to scaffold plugin");
|
|
2853
|
+
console.error(import_picocolors3.default.red(err instanceof Error ? err.message : String(err)));
|
|
2854
|
+
process.exit(1);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
function handleCancel() {
|
|
2858
|
+
xe("Operation cancelled.");
|
|
2859
|
+
process.exit(0);
|
|
2860
|
+
}
|
|
2861
|
+
main().catch((err) => {
|
|
2862
|
+
console.error(import_picocolors3.default.red(err instanceof Error ? err.message : String(err)));
|
|
2863
|
+
process.exit(1);
|
|
2864
|
+
});
|