@prisma/internals 6.5.0-integration-feat-prisma-config-without-new-package.5 → 6.5.0-integration-feat-prisma-config-without-new-package.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Generator.js +2 -2
- package/dist/WasmPanicRegistry.js +2 -2
- package/dist/{chunk-TQCAD4LB.js → chunk-2CLHVJN7.js} +12 -12
- package/dist/{chunk-CHELWBGJ.js → chunk-3BUJ76XG.js} +5 -5
- package/dist/{chunk-DPFQAPWU.js → chunk-4BIM67DA.js} +24 -24
- package/dist/{chunk-SSELI7X6.js → chunk-6CEU2T4S.js} +11 -11
- package/dist/{chunk-TUSGJ6GU.js → chunk-AGQLNLYE.js} +5 -5
- package/dist/{chunk-A4QWQE3W.js → chunk-ATFQZVBS.js} +11 -4
- package/dist/{chunk-IZB6DOJJ.js → chunk-BOSKBIEW.js} +5 -5
- package/dist/{chunk-HOZFIXMD.js → chunk-BPZFDGKN.js} +5 -4
- package/dist/{chunk-NUGMMPL2.js → chunk-DQGTDMKZ.js} +12 -12
- package/dist/{chunk-GABO6IUE.js → chunk-EPF2VC52.js} +5 -5
- package/dist/{chunk-WMCSNHUF.js → chunk-FIAOONJQ.js} +11 -11
- package/dist/{chunk-HRNIB5ZF.js → chunk-HKQAB33T.js} +6 -6
- package/dist/{chunk-V2VT4B4O.js → chunk-KJTSTIRI.js} +12 -12
- package/dist/chunk-KKGIKPIK.js +573 -0
- package/dist/{chunk-Q7TE2TEB.js → chunk-M546VQV7.js} +7 -7
- package/dist/{chunk-A7RZQY5A.js → chunk-O37OFT3W.js} +7 -7
- package/dist/{chunk-OSFD4434.js → chunk-OIJ3DLA7.js} +12 -12
- package/dist/{chunk-ZOBZBU6K.js → chunk-PYW3KPIO.js} +8 -8
- package/dist/{chunk-XVEU6UM7.js → chunk-TILVPSCV.js} +12 -12
- package/dist/{chunk-BGRRWLCY.js → chunk-UB7B3VT4.js} +8 -8
- package/dist/{chunk-QUX3H4X5.js → chunk-WJFWR7QP.js} +24 -24
- package/dist/{chunk-HGEWBHJ5.js → chunk-YFBVJSFY.js} +5 -5
- package/dist/{chunk-TDG5WQHD.js → chunk-ZP5B4U6D.js} +12 -12
- package/dist/{chunk-635TMBAP.js → chunk-ZYW3HGSH.js} +8 -4
- package/dist/cli/checkUnsupportedDataProxy.js +16 -16
- package/dist/cli/getSchema.js +20 -20
- package/dist/cli/hashes.js +16 -16
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +15 -15
- package/dist/engine-commands/getConfig.js +12 -12
- package/dist/engine-commands/getDmmf.js +9 -9
- package/dist/engine-commands/index.js +24 -24
- package/dist/engine-commands/lintSchema.js +10 -10
- package/dist/engine-commands/mergeSchemas.js +9 -9
- package/dist/engine-commands/validate.js +9 -9
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +15 -15
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +15 -15
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +16 -16
- package/dist/get-generators/getGenerators.js +18 -18
- package/dist/index.js +48 -48
- package/dist/panic.js +6 -6
- package/dist/sendPanic.js +15 -15
- package/dist/utils/drawBox.js +2 -2
- package/dist/utils/getEnvPaths.js +15 -15
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +15 -15
- package/dist/utils/loadEnvFile.js +15 -15
- package/dist/wasm.js +5 -5
- package/package.json +10 -10
- package/dist/chunk-F3SIWK3J.js +0 -1404
package/dist/chunk-F3SIWK3J.js
DELETED
@@ -1,1404 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var chunk_F3SIWK3J_exports = {};
|
20
|
-
__export(chunk_F3SIWK3J_exports, {
|
21
|
-
drawBox: () => drawBox
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(chunk_F3SIWK3J_exports);
|
24
|
-
var import_chunk_ODI3VNBD = require("./chunk-ODI3VNBD.js");
|
25
|
-
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
26
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
27
|
-
var require_is_fullwidth_code_point = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
28
|
-
"../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js"(exports, module2) {
|
29
|
-
"use strict";
|
30
|
-
var isFullwidthCodePoint = (codePoint) => {
|
31
|
-
if (Number.isNaN(codePoint)) {
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
|
35
|
-
codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
|
36
|
-
codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
|
37
|
-
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
38
|
-
11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
39
|
-
12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
|
40
|
-
19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
|
41
|
-
43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
|
42
|
-
44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
|
43
|
-
63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
|
44
|
-
65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
|
45
|
-
65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
|
46
|
-
65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
|
47
|
-
110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
|
48
|
-
127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
49
|
-
131072 <= codePoint && codePoint <= 262141)) {
|
50
|
-
return true;
|
51
|
-
}
|
52
|
-
return false;
|
53
|
-
};
|
54
|
-
module2.exports = isFullwidthCodePoint;
|
55
|
-
module2.exports.default = isFullwidthCodePoint;
|
56
|
-
}
|
57
|
-
});
|
58
|
-
var require_astral_regex = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
59
|
-
"../../node_modules/.pnpm/astral-regex@2.0.0/node_modules/astral-regex/index.js"(exports, module2) {
|
60
|
-
"use strict";
|
61
|
-
var regex = "[\uD800-\uDBFF][\uDC00-\uDFFF]";
|
62
|
-
var astralRegex = (options) => options && options.exact ? new RegExp(`^${regex}$`) : new RegExp(regex, "g");
|
63
|
-
module2.exports = astralRegex;
|
64
|
-
}
|
65
|
-
});
|
66
|
-
var require_color_name = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
67
|
-
"../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js"(exports, module2) {
|
68
|
-
"use strict";
|
69
|
-
module2.exports = {
|
70
|
-
"aliceblue": [240, 248, 255],
|
71
|
-
"antiquewhite": [250, 235, 215],
|
72
|
-
"aqua": [0, 255, 255],
|
73
|
-
"aquamarine": [127, 255, 212],
|
74
|
-
"azure": [240, 255, 255],
|
75
|
-
"beige": [245, 245, 220],
|
76
|
-
"bisque": [255, 228, 196],
|
77
|
-
"black": [0, 0, 0],
|
78
|
-
"blanchedalmond": [255, 235, 205],
|
79
|
-
"blue": [0, 0, 255],
|
80
|
-
"blueviolet": [138, 43, 226],
|
81
|
-
"brown": [165, 42, 42],
|
82
|
-
"burlywood": [222, 184, 135],
|
83
|
-
"cadetblue": [95, 158, 160],
|
84
|
-
"chartreuse": [127, 255, 0],
|
85
|
-
"chocolate": [210, 105, 30],
|
86
|
-
"coral": [255, 127, 80],
|
87
|
-
"cornflowerblue": [100, 149, 237],
|
88
|
-
"cornsilk": [255, 248, 220],
|
89
|
-
"crimson": [220, 20, 60],
|
90
|
-
"cyan": [0, 255, 255],
|
91
|
-
"darkblue": [0, 0, 139],
|
92
|
-
"darkcyan": [0, 139, 139],
|
93
|
-
"darkgoldenrod": [184, 134, 11],
|
94
|
-
"darkgray": [169, 169, 169],
|
95
|
-
"darkgreen": [0, 100, 0],
|
96
|
-
"darkgrey": [169, 169, 169],
|
97
|
-
"darkkhaki": [189, 183, 107],
|
98
|
-
"darkmagenta": [139, 0, 139],
|
99
|
-
"darkolivegreen": [85, 107, 47],
|
100
|
-
"darkorange": [255, 140, 0],
|
101
|
-
"darkorchid": [153, 50, 204],
|
102
|
-
"darkred": [139, 0, 0],
|
103
|
-
"darksalmon": [233, 150, 122],
|
104
|
-
"darkseagreen": [143, 188, 143],
|
105
|
-
"darkslateblue": [72, 61, 139],
|
106
|
-
"darkslategray": [47, 79, 79],
|
107
|
-
"darkslategrey": [47, 79, 79],
|
108
|
-
"darkturquoise": [0, 206, 209],
|
109
|
-
"darkviolet": [148, 0, 211],
|
110
|
-
"deeppink": [255, 20, 147],
|
111
|
-
"deepskyblue": [0, 191, 255],
|
112
|
-
"dimgray": [105, 105, 105],
|
113
|
-
"dimgrey": [105, 105, 105],
|
114
|
-
"dodgerblue": [30, 144, 255],
|
115
|
-
"firebrick": [178, 34, 34],
|
116
|
-
"floralwhite": [255, 250, 240],
|
117
|
-
"forestgreen": [34, 139, 34],
|
118
|
-
"fuchsia": [255, 0, 255],
|
119
|
-
"gainsboro": [220, 220, 220],
|
120
|
-
"ghostwhite": [248, 248, 255],
|
121
|
-
"gold": [255, 215, 0],
|
122
|
-
"goldenrod": [218, 165, 32],
|
123
|
-
"gray": [128, 128, 128],
|
124
|
-
"green": [0, 128, 0],
|
125
|
-
"greenyellow": [173, 255, 47],
|
126
|
-
"grey": [128, 128, 128],
|
127
|
-
"honeydew": [240, 255, 240],
|
128
|
-
"hotpink": [255, 105, 180],
|
129
|
-
"indianred": [205, 92, 92],
|
130
|
-
"indigo": [75, 0, 130],
|
131
|
-
"ivory": [255, 255, 240],
|
132
|
-
"khaki": [240, 230, 140],
|
133
|
-
"lavender": [230, 230, 250],
|
134
|
-
"lavenderblush": [255, 240, 245],
|
135
|
-
"lawngreen": [124, 252, 0],
|
136
|
-
"lemonchiffon": [255, 250, 205],
|
137
|
-
"lightblue": [173, 216, 230],
|
138
|
-
"lightcoral": [240, 128, 128],
|
139
|
-
"lightcyan": [224, 255, 255],
|
140
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
141
|
-
"lightgray": [211, 211, 211],
|
142
|
-
"lightgreen": [144, 238, 144],
|
143
|
-
"lightgrey": [211, 211, 211],
|
144
|
-
"lightpink": [255, 182, 193],
|
145
|
-
"lightsalmon": [255, 160, 122],
|
146
|
-
"lightseagreen": [32, 178, 170],
|
147
|
-
"lightskyblue": [135, 206, 250],
|
148
|
-
"lightslategray": [119, 136, 153],
|
149
|
-
"lightslategrey": [119, 136, 153],
|
150
|
-
"lightsteelblue": [176, 196, 222],
|
151
|
-
"lightyellow": [255, 255, 224],
|
152
|
-
"lime": [0, 255, 0],
|
153
|
-
"limegreen": [50, 205, 50],
|
154
|
-
"linen": [250, 240, 230],
|
155
|
-
"magenta": [255, 0, 255],
|
156
|
-
"maroon": [128, 0, 0],
|
157
|
-
"mediumaquamarine": [102, 205, 170],
|
158
|
-
"mediumblue": [0, 0, 205],
|
159
|
-
"mediumorchid": [186, 85, 211],
|
160
|
-
"mediumpurple": [147, 112, 219],
|
161
|
-
"mediumseagreen": [60, 179, 113],
|
162
|
-
"mediumslateblue": [123, 104, 238],
|
163
|
-
"mediumspringgreen": [0, 250, 154],
|
164
|
-
"mediumturquoise": [72, 209, 204],
|
165
|
-
"mediumvioletred": [199, 21, 133],
|
166
|
-
"midnightblue": [25, 25, 112],
|
167
|
-
"mintcream": [245, 255, 250],
|
168
|
-
"mistyrose": [255, 228, 225],
|
169
|
-
"moccasin": [255, 228, 181],
|
170
|
-
"navajowhite": [255, 222, 173],
|
171
|
-
"navy": [0, 0, 128],
|
172
|
-
"oldlace": [253, 245, 230],
|
173
|
-
"olive": [128, 128, 0],
|
174
|
-
"olivedrab": [107, 142, 35],
|
175
|
-
"orange": [255, 165, 0],
|
176
|
-
"orangered": [255, 69, 0],
|
177
|
-
"orchid": [218, 112, 214],
|
178
|
-
"palegoldenrod": [238, 232, 170],
|
179
|
-
"palegreen": [152, 251, 152],
|
180
|
-
"paleturquoise": [175, 238, 238],
|
181
|
-
"palevioletred": [219, 112, 147],
|
182
|
-
"papayawhip": [255, 239, 213],
|
183
|
-
"peachpuff": [255, 218, 185],
|
184
|
-
"peru": [205, 133, 63],
|
185
|
-
"pink": [255, 192, 203],
|
186
|
-
"plum": [221, 160, 221],
|
187
|
-
"powderblue": [176, 224, 230],
|
188
|
-
"purple": [128, 0, 128],
|
189
|
-
"rebeccapurple": [102, 51, 153],
|
190
|
-
"red": [255, 0, 0],
|
191
|
-
"rosybrown": [188, 143, 143],
|
192
|
-
"royalblue": [65, 105, 225],
|
193
|
-
"saddlebrown": [139, 69, 19],
|
194
|
-
"salmon": [250, 128, 114],
|
195
|
-
"sandybrown": [244, 164, 96],
|
196
|
-
"seagreen": [46, 139, 87],
|
197
|
-
"seashell": [255, 245, 238],
|
198
|
-
"sienna": [160, 82, 45],
|
199
|
-
"silver": [192, 192, 192],
|
200
|
-
"skyblue": [135, 206, 235],
|
201
|
-
"slateblue": [106, 90, 205],
|
202
|
-
"slategray": [112, 128, 144],
|
203
|
-
"slategrey": [112, 128, 144],
|
204
|
-
"snow": [255, 250, 250],
|
205
|
-
"springgreen": [0, 255, 127],
|
206
|
-
"steelblue": [70, 130, 180],
|
207
|
-
"tan": [210, 180, 140],
|
208
|
-
"teal": [0, 128, 128],
|
209
|
-
"thistle": [216, 191, 216],
|
210
|
-
"tomato": [255, 99, 71],
|
211
|
-
"turquoise": [64, 224, 208],
|
212
|
-
"violet": [238, 130, 238],
|
213
|
-
"wheat": [245, 222, 179],
|
214
|
-
"white": [255, 255, 255],
|
215
|
-
"whitesmoke": [245, 245, 245],
|
216
|
-
"yellow": [255, 255, 0],
|
217
|
-
"yellowgreen": [154, 205, 50]
|
218
|
-
};
|
219
|
-
}
|
220
|
-
});
|
221
|
-
var require_conversions = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
222
|
-
"../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js"(exports, module2) {
|
223
|
-
"use strict";
|
224
|
-
var cssKeywords = require_color_name();
|
225
|
-
var reverseKeywords = {};
|
226
|
-
for (const key of Object.keys(cssKeywords)) {
|
227
|
-
reverseKeywords[cssKeywords[key]] = key;
|
228
|
-
}
|
229
|
-
var convert = {
|
230
|
-
rgb: { channels: 3, labels: "rgb" },
|
231
|
-
hsl: { channels: 3, labels: "hsl" },
|
232
|
-
hsv: { channels: 3, labels: "hsv" },
|
233
|
-
hwb: { channels: 3, labels: "hwb" },
|
234
|
-
cmyk: { channels: 4, labels: "cmyk" },
|
235
|
-
xyz: { channels: 3, labels: "xyz" },
|
236
|
-
lab: { channels: 3, labels: "lab" },
|
237
|
-
lch: { channels: 3, labels: "lch" },
|
238
|
-
hex: { channels: 1, labels: ["hex"] },
|
239
|
-
keyword: { channels: 1, labels: ["keyword"] },
|
240
|
-
ansi16: { channels: 1, labels: ["ansi16"] },
|
241
|
-
ansi256: { channels: 1, labels: ["ansi256"] },
|
242
|
-
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
243
|
-
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
244
|
-
gray: { channels: 1, labels: ["gray"] }
|
245
|
-
};
|
246
|
-
module2.exports = convert;
|
247
|
-
for (const model of Object.keys(convert)) {
|
248
|
-
if (!("channels" in convert[model])) {
|
249
|
-
throw new Error("missing channels property: " + model);
|
250
|
-
}
|
251
|
-
if (!("labels" in convert[model])) {
|
252
|
-
throw new Error("missing channel labels property: " + model);
|
253
|
-
}
|
254
|
-
if (convert[model].labels.length !== convert[model].channels) {
|
255
|
-
throw new Error("channel and label counts mismatch: " + model);
|
256
|
-
}
|
257
|
-
const { channels, labels } = convert[model];
|
258
|
-
delete convert[model].channels;
|
259
|
-
delete convert[model].labels;
|
260
|
-
Object.defineProperty(convert[model], "channels", { value: channels });
|
261
|
-
Object.defineProperty(convert[model], "labels", { value: labels });
|
262
|
-
}
|
263
|
-
convert.rgb.hsl = function(rgb) {
|
264
|
-
const r = rgb[0] / 255;
|
265
|
-
const g = rgb[1] / 255;
|
266
|
-
const b = rgb[2] / 255;
|
267
|
-
const min = Math.min(r, g, b);
|
268
|
-
const max = Math.max(r, g, b);
|
269
|
-
const delta = max - min;
|
270
|
-
let h;
|
271
|
-
let s;
|
272
|
-
if (max === min) {
|
273
|
-
h = 0;
|
274
|
-
} else if (r === max) {
|
275
|
-
h = (g - b) / delta;
|
276
|
-
} else if (g === max) {
|
277
|
-
h = 2 + (b - r) / delta;
|
278
|
-
} else if (b === max) {
|
279
|
-
h = 4 + (r - g) / delta;
|
280
|
-
}
|
281
|
-
h = Math.min(h * 60, 360);
|
282
|
-
if (h < 0) {
|
283
|
-
h += 360;
|
284
|
-
}
|
285
|
-
const l = (min + max) / 2;
|
286
|
-
if (max === min) {
|
287
|
-
s = 0;
|
288
|
-
} else if (l <= 0.5) {
|
289
|
-
s = delta / (max + min);
|
290
|
-
} else {
|
291
|
-
s = delta / (2 - max - min);
|
292
|
-
}
|
293
|
-
return [h, s * 100, l * 100];
|
294
|
-
};
|
295
|
-
convert.rgb.hsv = function(rgb) {
|
296
|
-
let rdif;
|
297
|
-
let gdif;
|
298
|
-
let bdif;
|
299
|
-
let h;
|
300
|
-
let s;
|
301
|
-
const r = rgb[0] / 255;
|
302
|
-
const g = rgb[1] / 255;
|
303
|
-
const b = rgb[2] / 255;
|
304
|
-
const v = Math.max(r, g, b);
|
305
|
-
const diff = v - Math.min(r, g, b);
|
306
|
-
const diffc = function(c) {
|
307
|
-
return (v - c) / 6 / diff + 1 / 2;
|
308
|
-
};
|
309
|
-
if (diff === 0) {
|
310
|
-
h = 0;
|
311
|
-
s = 0;
|
312
|
-
} else {
|
313
|
-
s = diff / v;
|
314
|
-
rdif = diffc(r);
|
315
|
-
gdif = diffc(g);
|
316
|
-
bdif = diffc(b);
|
317
|
-
if (r === v) {
|
318
|
-
h = bdif - gdif;
|
319
|
-
} else if (g === v) {
|
320
|
-
h = 1 / 3 + rdif - bdif;
|
321
|
-
} else if (b === v) {
|
322
|
-
h = 2 / 3 + gdif - rdif;
|
323
|
-
}
|
324
|
-
if (h < 0) {
|
325
|
-
h += 1;
|
326
|
-
} else if (h > 1) {
|
327
|
-
h -= 1;
|
328
|
-
}
|
329
|
-
}
|
330
|
-
return [
|
331
|
-
h * 360,
|
332
|
-
s * 100,
|
333
|
-
v * 100
|
334
|
-
];
|
335
|
-
};
|
336
|
-
convert.rgb.hwb = function(rgb) {
|
337
|
-
const r = rgb[0];
|
338
|
-
const g = rgb[1];
|
339
|
-
let b = rgb[2];
|
340
|
-
const h = convert.rgb.hsl(rgb)[0];
|
341
|
-
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
342
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
343
|
-
return [h, w * 100, b * 100];
|
344
|
-
};
|
345
|
-
convert.rgb.cmyk = function(rgb) {
|
346
|
-
const r = rgb[0] / 255;
|
347
|
-
const g = rgb[1] / 255;
|
348
|
-
const b = rgb[2] / 255;
|
349
|
-
const k = Math.min(1 - r, 1 - g, 1 - b);
|
350
|
-
const c = (1 - r - k) / (1 - k) || 0;
|
351
|
-
const m = (1 - g - k) / (1 - k) || 0;
|
352
|
-
const y = (1 - b - k) / (1 - k) || 0;
|
353
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
354
|
-
};
|
355
|
-
function comparativeDistance(x, y) {
|
356
|
-
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
357
|
-
}
|
358
|
-
convert.rgb.keyword = function(rgb) {
|
359
|
-
const reversed = reverseKeywords[rgb];
|
360
|
-
if (reversed) {
|
361
|
-
return reversed;
|
362
|
-
}
|
363
|
-
let currentClosestDistance = Infinity;
|
364
|
-
let currentClosestKeyword;
|
365
|
-
for (const keyword of Object.keys(cssKeywords)) {
|
366
|
-
const value = cssKeywords[keyword];
|
367
|
-
const distance = comparativeDistance(rgb, value);
|
368
|
-
if (distance < currentClosestDistance) {
|
369
|
-
currentClosestDistance = distance;
|
370
|
-
currentClosestKeyword = keyword;
|
371
|
-
}
|
372
|
-
}
|
373
|
-
return currentClosestKeyword;
|
374
|
-
};
|
375
|
-
convert.keyword.rgb = function(keyword) {
|
376
|
-
return cssKeywords[keyword];
|
377
|
-
};
|
378
|
-
convert.rgb.xyz = function(rgb) {
|
379
|
-
let r = rgb[0] / 255;
|
380
|
-
let g = rgb[1] / 255;
|
381
|
-
let b = rgb[2] / 255;
|
382
|
-
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
383
|
-
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
384
|
-
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
385
|
-
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
386
|
-
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
387
|
-
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
388
|
-
return [x * 100, y * 100, z * 100];
|
389
|
-
};
|
390
|
-
convert.rgb.lab = function(rgb) {
|
391
|
-
const xyz = convert.rgb.xyz(rgb);
|
392
|
-
let x = xyz[0];
|
393
|
-
let y = xyz[1];
|
394
|
-
let z = xyz[2];
|
395
|
-
x /= 95.047;
|
396
|
-
y /= 100;
|
397
|
-
z /= 108.883;
|
398
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
399
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
400
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
401
|
-
const l = 116 * y - 16;
|
402
|
-
const a = 500 * (x - y);
|
403
|
-
const b = 200 * (y - z);
|
404
|
-
return [l, a, b];
|
405
|
-
};
|
406
|
-
convert.hsl.rgb = function(hsl) {
|
407
|
-
const h = hsl[0] / 360;
|
408
|
-
const s = hsl[1] / 100;
|
409
|
-
const l = hsl[2] / 100;
|
410
|
-
let t2;
|
411
|
-
let t3;
|
412
|
-
let val;
|
413
|
-
if (s === 0) {
|
414
|
-
val = l * 255;
|
415
|
-
return [val, val, val];
|
416
|
-
}
|
417
|
-
if (l < 0.5) {
|
418
|
-
t2 = l * (1 + s);
|
419
|
-
} else {
|
420
|
-
t2 = l + s - l * s;
|
421
|
-
}
|
422
|
-
const t1 = 2 * l - t2;
|
423
|
-
const rgb = [0, 0, 0];
|
424
|
-
for (let i = 0; i < 3; i++) {
|
425
|
-
t3 = h + 1 / 3 * -(i - 1);
|
426
|
-
if (t3 < 0) {
|
427
|
-
t3++;
|
428
|
-
}
|
429
|
-
if (t3 > 1) {
|
430
|
-
t3--;
|
431
|
-
}
|
432
|
-
if (6 * t3 < 1) {
|
433
|
-
val = t1 + (t2 - t1) * 6 * t3;
|
434
|
-
} else if (2 * t3 < 1) {
|
435
|
-
val = t2;
|
436
|
-
} else if (3 * t3 < 2) {
|
437
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
438
|
-
} else {
|
439
|
-
val = t1;
|
440
|
-
}
|
441
|
-
rgb[i] = val * 255;
|
442
|
-
}
|
443
|
-
return rgb;
|
444
|
-
};
|
445
|
-
convert.hsl.hsv = function(hsl) {
|
446
|
-
const h = hsl[0];
|
447
|
-
let s = hsl[1] / 100;
|
448
|
-
let l = hsl[2] / 100;
|
449
|
-
let smin = s;
|
450
|
-
const lmin = Math.max(l, 0.01);
|
451
|
-
l *= 2;
|
452
|
-
s *= l <= 1 ? l : 2 - l;
|
453
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
454
|
-
const v = (l + s) / 2;
|
455
|
-
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
456
|
-
return [h, sv * 100, v * 100];
|
457
|
-
};
|
458
|
-
convert.hsv.rgb = function(hsv) {
|
459
|
-
const h = hsv[0] / 60;
|
460
|
-
const s = hsv[1] / 100;
|
461
|
-
let v = hsv[2] / 100;
|
462
|
-
const hi = Math.floor(h) % 6;
|
463
|
-
const f = h - Math.floor(h);
|
464
|
-
const p = 255 * v * (1 - s);
|
465
|
-
const q = 255 * v * (1 - s * f);
|
466
|
-
const t = 255 * v * (1 - s * (1 - f));
|
467
|
-
v *= 255;
|
468
|
-
switch (hi) {
|
469
|
-
case 0:
|
470
|
-
return [v, t, p];
|
471
|
-
case 1:
|
472
|
-
return [q, v, p];
|
473
|
-
case 2:
|
474
|
-
return [p, v, t];
|
475
|
-
case 3:
|
476
|
-
return [p, q, v];
|
477
|
-
case 4:
|
478
|
-
return [t, p, v];
|
479
|
-
case 5:
|
480
|
-
return [v, p, q];
|
481
|
-
}
|
482
|
-
};
|
483
|
-
convert.hsv.hsl = function(hsv) {
|
484
|
-
const h = hsv[0];
|
485
|
-
const s = hsv[1] / 100;
|
486
|
-
const v = hsv[2] / 100;
|
487
|
-
const vmin = Math.max(v, 0.01);
|
488
|
-
let sl;
|
489
|
-
let l;
|
490
|
-
l = (2 - s) * v;
|
491
|
-
const lmin = (2 - s) * vmin;
|
492
|
-
sl = s * vmin;
|
493
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
494
|
-
sl = sl || 0;
|
495
|
-
l /= 2;
|
496
|
-
return [h, sl * 100, l * 100];
|
497
|
-
};
|
498
|
-
convert.hwb.rgb = function(hwb) {
|
499
|
-
const h = hwb[0] / 360;
|
500
|
-
let wh = hwb[1] / 100;
|
501
|
-
let bl = hwb[2] / 100;
|
502
|
-
const ratio = wh + bl;
|
503
|
-
let f;
|
504
|
-
if (ratio > 1) {
|
505
|
-
wh /= ratio;
|
506
|
-
bl /= ratio;
|
507
|
-
}
|
508
|
-
const i = Math.floor(6 * h);
|
509
|
-
const v = 1 - bl;
|
510
|
-
f = 6 * h - i;
|
511
|
-
if ((i & 1) !== 0) {
|
512
|
-
f = 1 - f;
|
513
|
-
}
|
514
|
-
const n = wh + f * (v - wh);
|
515
|
-
let r;
|
516
|
-
let g;
|
517
|
-
let b;
|
518
|
-
switch (i) {
|
519
|
-
default:
|
520
|
-
case 6:
|
521
|
-
case 0:
|
522
|
-
r = v;
|
523
|
-
g = n;
|
524
|
-
b = wh;
|
525
|
-
break;
|
526
|
-
case 1:
|
527
|
-
r = n;
|
528
|
-
g = v;
|
529
|
-
b = wh;
|
530
|
-
break;
|
531
|
-
case 2:
|
532
|
-
r = wh;
|
533
|
-
g = v;
|
534
|
-
b = n;
|
535
|
-
break;
|
536
|
-
case 3:
|
537
|
-
r = wh;
|
538
|
-
g = n;
|
539
|
-
b = v;
|
540
|
-
break;
|
541
|
-
case 4:
|
542
|
-
r = n;
|
543
|
-
g = wh;
|
544
|
-
b = v;
|
545
|
-
break;
|
546
|
-
case 5:
|
547
|
-
r = v;
|
548
|
-
g = wh;
|
549
|
-
b = n;
|
550
|
-
break;
|
551
|
-
}
|
552
|
-
return [r * 255, g * 255, b * 255];
|
553
|
-
};
|
554
|
-
convert.cmyk.rgb = function(cmyk) {
|
555
|
-
const c = cmyk[0] / 100;
|
556
|
-
const m = cmyk[1] / 100;
|
557
|
-
const y = cmyk[2] / 100;
|
558
|
-
const k = cmyk[3] / 100;
|
559
|
-
const r = 1 - Math.min(1, c * (1 - k) + k);
|
560
|
-
const g = 1 - Math.min(1, m * (1 - k) + k);
|
561
|
-
const b = 1 - Math.min(1, y * (1 - k) + k);
|
562
|
-
return [r * 255, g * 255, b * 255];
|
563
|
-
};
|
564
|
-
convert.xyz.rgb = function(xyz) {
|
565
|
-
const x = xyz[0] / 100;
|
566
|
-
const y = xyz[1] / 100;
|
567
|
-
const z = xyz[2] / 100;
|
568
|
-
let r;
|
569
|
-
let g;
|
570
|
-
let b;
|
571
|
-
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
572
|
-
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
573
|
-
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
574
|
-
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
575
|
-
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
576
|
-
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
577
|
-
r = Math.min(Math.max(0, r), 1);
|
578
|
-
g = Math.min(Math.max(0, g), 1);
|
579
|
-
b = Math.min(Math.max(0, b), 1);
|
580
|
-
return [r * 255, g * 255, b * 255];
|
581
|
-
};
|
582
|
-
convert.xyz.lab = function(xyz) {
|
583
|
-
let x = xyz[0];
|
584
|
-
let y = xyz[1];
|
585
|
-
let z = xyz[2];
|
586
|
-
x /= 95.047;
|
587
|
-
y /= 100;
|
588
|
-
z /= 108.883;
|
589
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
590
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
591
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
592
|
-
const l = 116 * y - 16;
|
593
|
-
const a = 500 * (x - y);
|
594
|
-
const b = 200 * (y - z);
|
595
|
-
return [l, a, b];
|
596
|
-
};
|
597
|
-
convert.lab.xyz = function(lab) {
|
598
|
-
const l = lab[0];
|
599
|
-
const a = lab[1];
|
600
|
-
const b = lab[2];
|
601
|
-
let x;
|
602
|
-
let y;
|
603
|
-
let z;
|
604
|
-
y = (l + 16) / 116;
|
605
|
-
x = a / 500 + y;
|
606
|
-
z = y - b / 200;
|
607
|
-
const y2 = y ** 3;
|
608
|
-
const x2 = x ** 3;
|
609
|
-
const z2 = z ** 3;
|
610
|
-
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
611
|
-
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
612
|
-
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
613
|
-
x *= 95.047;
|
614
|
-
y *= 100;
|
615
|
-
z *= 108.883;
|
616
|
-
return [x, y, z];
|
617
|
-
};
|
618
|
-
convert.lab.lch = function(lab) {
|
619
|
-
const l = lab[0];
|
620
|
-
const a = lab[1];
|
621
|
-
const b = lab[2];
|
622
|
-
let h;
|
623
|
-
const hr = Math.atan2(b, a);
|
624
|
-
h = hr * 360 / 2 / Math.PI;
|
625
|
-
if (h < 0) {
|
626
|
-
h += 360;
|
627
|
-
}
|
628
|
-
const c = Math.sqrt(a * a + b * b);
|
629
|
-
return [l, c, h];
|
630
|
-
};
|
631
|
-
convert.lch.lab = function(lch) {
|
632
|
-
const l = lch[0];
|
633
|
-
const c = lch[1];
|
634
|
-
const h = lch[2];
|
635
|
-
const hr = h / 360 * 2 * Math.PI;
|
636
|
-
const a = c * Math.cos(hr);
|
637
|
-
const b = c * Math.sin(hr);
|
638
|
-
return [l, a, b];
|
639
|
-
};
|
640
|
-
convert.rgb.ansi16 = function(args, saturation = null) {
|
641
|
-
const [r, g, b] = args;
|
642
|
-
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
643
|
-
value = Math.round(value / 50);
|
644
|
-
if (value === 0) {
|
645
|
-
return 30;
|
646
|
-
}
|
647
|
-
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
648
|
-
if (value === 2) {
|
649
|
-
ansi += 60;
|
650
|
-
}
|
651
|
-
return ansi;
|
652
|
-
};
|
653
|
-
convert.hsv.ansi16 = function(args) {
|
654
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
655
|
-
};
|
656
|
-
convert.rgb.ansi256 = function(args) {
|
657
|
-
const r = args[0];
|
658
|
-
const g = args[1];
|
659
|
-
const b = args[2];
|
660
|
-
if (r === g && g === b) {
|
661
|
-
if (r < 8) {
|
662
|
-
return 16;
|
663
|
-
}
|
664
|
-
if (r > 248) {
|
665
|
-
return 231;
|
666
|
-
}
|
667
|
-
return Math.round((r - 8) / 247 * 24) + 232;
|
668
|
-
}
|
669
|
-
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
670
|
-
return ansi;
|
671
|
-
};
|
672
|
-
convert.ansi16.rgb = function(args) {
|
673
|
-
let color = args % 10;
|
674
|
-
if (color === 0 || color === 7) {
|
675
|
-
if (args > 50) {
|
676
|
-
color += 3.5;
|
677
|
-
}
|
678
|
-
color = color / 10.5 * 255;
|
679
|
-
return [color, color, color];
|
680
|
-
}
|
681
|
-
const mult = (~~(args > 50) + 1) * 0.5;
|
682
|
-
const r = (color & 1) * mult * 255;
|
683
|
-
const g = (color >> 1 & 1) * mult * 255;
|
684
|
-
const b = (color >> 2 & 1) * mult * 255;
|
685
|
-
return [r, g, b];
|
686
|
-
};
|
687
|
-
convert.ansi256.rgb = function(args) {
|
688
|
-
if (args >= 232) {
|
689
|
-
const c = (args - 232) * 10 + 8;
|
690
|
-
return [c, c, c];
|
691
|
-
}
|
692
|
-
args -= 16;
|
693
|
-
let rem;
|
694
|
-
const r = Math.floor(args / 36) / 5 * 255;
|
695
|
-
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
696
|
-
const b = rem % 6 / 5 * 255;
|
697
|
-
return [r, g, b];
|
698
|
-
};
|
699
|
-
convert.rgb.hex = function(args) {
|
700
|
-
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
701
|
-
const string = integer.toString(16).toUpperCase();
|
702
|
-
return "000000".substring(string.length) + string;
|
703
|
-
};
|
704
|
-
convert.hex.rgb = function(args) {
|
705
|
-
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
706
|
-
if (!match) {
|
707
|
-
return [0, 0, 0];
|
708
|
-
}
|
709
|
-
let colorString = match[0];
|
710
|
-
if (match[0].length === 3) {
|
711
|
-
colorString = colorString.split("").map((char) => {
|
712
|
-
return char + char;
|
713
|
-
}).join("");
|
714
|
-
}
|
715
|
-
const integer = parseInt(colorString, 16);
|
716
|
-
const r = integer >> 16 & 255;
|
717
|
-
const g = integer >> 8 & 255;
|
718
|
-
const b = integer & 255;
|
719
|
-
return [r, g, b];
|
720
|
-
};
|
721
|
-
convert.rgb.hcg = function(rgb) {
|
722
|
-
const r = rgb[0] / 255;
|
723
|
-
const g = rgb[1] / 255;
|
724
|
-
const b = rgb[2] / 255;
|
725
|
-
const max = Math.max(Math.max(r, g), b);
|
726
|
-
const min = Math.min(Math.min(r, g), b);
|
727
|
-
const chroma = max - min;
|
728
|
-
let grayscale;
|
729
|
-
let hue;
|
730
|
-
if (chroma < 1) {
|
731
|
-
grayscale = min / (1 - chroma);
|
732
|
-
} else {
|
733
|
-
grayscale = 0;
|
734
|
-
}
|
735
|
-
if (chroma <= 0) {
|
736
|
-
hue = 0;
|
737
|
-
} else if (max === r) {
|
738
|
-
hue = (g - b) / chroma % 6;
|
739
|
-
} else if (max === g) {
|
740
|
-
hue = 2 + (b - r) / chroma;
|
741
|
-
} else {
|
742
|
-
hue = 4 + (r - g) / chroma;
|
743
|
-
}
|
744
|
-
hue /= 6;
|
745
|
-
hue %= 1;
|
746
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
747
|
-
};
|
748
|
-
convert.hsl.hcg = function(hsl) {
|
749
|
-
const s = hsl[1] / 100;
|
750
|
-
const l = hsl[2] / 100;
|
751
|
-
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
752
|
-
let f = 0;
|
753
|
-
if (c < 1) {
|
754
|
-
f = (l - 0.5 * c) / (1 - c);
|
755
|
-
}
|
756
|
-
return [hsl[0], c * 100, f * 100];
|
757
|
-
};
|
758
|
-
convert.hsv.hcg = function(hsv) {
|
759
|
-
const s = hsv[1] / 100;
|
760
|
-
const v = hsv[2] / 100;
|
761
|
-
const c = s * v;
|
762
|
-
let f = 0;
|
763
|
-
if (c < 1) {
|
764
|
-
f = (v - c) / (1 - c);
|
765
|
-
}
|
766
|
-
return [hsv[0], c * 100, f * 100];
|
767
|
-
};
|
768
|
-
convert.hcg.rgb = function(hcg) {
|
769
|
-
const h = hcg[0] / 360;
|
770
|
-
const c = hcg[1] / 100;
|
771
|
-
const g = hcg[2] / 100;
|
772
|
-
if (c === 0) {
|
773
|
-
return [g * 255, g * 255, g * 255];
|
774
|
-
}
|
775
|
-
const pure = [0, 0, 0];
|
776
|
-
const hi = h % 1 * 6;
|
777
|
-
const v = hi % 1;
|
778
|
-
const w = 1 - v;
|
779
|
-
let mg = 0;
|
780
|
-
switch (Math.floor(hi)) {
|
781
|
-
case 0:
|
782
|
-
pure[0] = 1;
|
783
|
-
pure[1] = v;
|
784
|
-
pure[2] = 0;
|
785
|
-
break;
|
786
|
-
case 1:
|
787
|
-
pure[0] = w;
|
788
|
-
pure[1] = 1;
|
789
|
-
pure[2] = 0;
|
790
|
-
break;
|
791
|
-
case 2:
|
792
|
-
pure[0] = 0;
|
793
|
-
pure[1] = 1;
|
794
|
-
pure[2] = v;
|
795
|
-
break;
|
796
|
-
case 3:
|
797
|
-
pure[0] = 0;
|
798
|
-
pure[1] = w;
|
799
|
-
pure[2] = 1;
|
800
|
-
break;
|
801
|
-
case 4:
|
802
|
-
pure[0] = v;
|
803
|
-
pure[1] = 0;
|
804
|
-
pure[2] = 1;
|
805
|
-
break;
|
806
|
-
default:
|
807
|
-
pure[0] = 1;
|
808
|
-
pure[1] = 0;
|
809
|
-
pure[2] = w;
|
810
|
-
}
|
811
|
-
mg = (1 - c) * g;
|
812
|
-
return [
|
813
|
-
(c * pure[0] + mg) * 255,
|
814
|
-
(c * pure[1] + mg) * 255,
|
815
|
-
(c * pure[2] + mg) * 255
|
816
|
-
];
|
817
|
-
};
|
818
|
-
convert.hcg.hsv = function(hcg) {
|
819
|
-
const c = hcg[1] / 100;
|
820
|
-
const g = hcg[2] / 100;
|
821
|
-
const v = c + g * (1 - c);
|
822
|
-
let f = 0;
|
823
|
-
if (v > 0) {
|
824
|
-
f = c / v;
|
825
|
-
}
|
826
|
-
return [hcg[0], f * 100, v * 100];
|
827
|
-
};
|
828
|
-
convert.hcg.hsl = function(hcg) {
|
829
|
-
const c = hcg[1] / 100;
|
830
|
-
const g = hcg[2] / 100;
|
831
|
-
const l = g * (1 - c) + 0.5 * c;
|
832
|
-
let s = 0;
|
833
|
-
if (l > 0 && l < 0.5) {
|
834
|
-
s = c / (2 * l);
|
835
|
-
} else if (l >= 0.5 && l < 1) {
|
836
|
-
s = c / (2 * (1 - l));
|
837
|
-
}
|
838
|
-
return [hcg[0], s * 100, l * 100];
|
839
|
-
};
|
840
|
-
convert.hcg.hwb = function(hcg) {
|
841
|
-
const c = hcg[1] / 100;
|
842
|
-
const g = hcg[2] / 100;
|
843
|
-
const v = c + g * (1 - c);
|
844
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
845
|
-
};
|
846
|
-
convert.hwb.hcg = function(hwb) {
|
847
|
-
const w = hwb[1] / 100;
|
848
|
-
const b = hwb[2] / 100;
|
849
|
-
const v = 1 - b;
|
850
|
-
const c = v - w;
|
851
|
-
let g = 0;
|
852
|
-
if (c < 1) {
|
853
|
-
g = (v - c) / (1 - c);
|
854
|
-
}
|
855
|
-
return [hwb[0], c * 100, g * 100];
|
856
|
-
};
|
857
|
-
convert.apple.rgb = function(apple) {
|
858
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
859
|
-
};
|
860
|
-
convert.rgb.apple = function(rgb) {
|
861
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
862
|
-
};
|
863
|
-
convert.gray.rgb = function(args) {
|
864
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
865
|
-
};
|
866
|
-
convert.gray.hsl = function(args) {
|
867
|
-
return [0, 0, args[0]];
|
868
|
-
};
|
869
|
-
convert.gray.hsv = convert.gray.hsl;
|
870
|
-
convert.gray.hwb = function(gray) {
|
871
|
-
return [0, 100, gray[0]];
|
872
|
-
};
|
873
|
-
convert.gray.cmyk = function(gray) {
|
874
|
-
return [0, 0, 0, gray[0]];
|
875
|
-
};
|
876
|
-
convert.gray.lab = function(gray) {
|
877
|
-
return [gray[0], 0, 0];
|
878
|
-
};
|
879
|
-
convert.gray.hex = function(gray) {
|
880
|
-
const val = Math.round(gray[0] / 100 * 255) & 255;
|
881
|
-
const integer = (val << 16) + (val << 8) + val;
|
882
|
-
const string = integer.toString(16).toUpperCase();
|
883
|
-
return "000000".substring(string.length) + string;
|
884
|
-
};
|
885
|
-
convert.rgb.gray = function(rgb) {
|
886
|
-
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
887
|
-
return [val / 255 * 100];
|
888
|
-
};
|
889
|
-
}
|
890
|
-
});
|
891
|
-
var require_route = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
892
|
-
"../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js"(exports, module2) {
|
893
|
-
"use strict";
|
894
|
-
var conversions = require_conversions();
|
895
|
-
function buildGraph() {
|
896
|
-
const graph = {};
|
897
|
-
const models = Object.keys(conversions);
|
898
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
899
|
-
graph[models[i]] = {
|
900
|
-
// http://jsperf.com/1-vs-infinity
|
901
|
-
// micro-opt, but this is simple.
|
902
|
-
distance: -1,
|
903
|
-
parent: null
|
904
|
-
};
|
905
|
-
}
|
906
|
-
return graph;
|
907
|
-
}
|
908
|
-
function deriveBFS(fromModel) {
|
909
|
-
const graph = buildGraph();
|
910
|
-
const queue = [fromModel];
|
911
|
-
graph[fromModel].distance = 0;
|
912
|
-
while (queue.length) {
|
913
|
-
const current = queue.pop();
|
914
|
-
const adjacents = Object.keys(conversions[current]);
|
915
|
-
for (let len = adjacents.length, i = 0; i < len; i++) {
|
916
|
-
const adjacent = adjacents[i];
|
917
|
-
const node = graph[adjacent];
|
918
|
-
if (node.distance === -1) {
|
919
|
-
node.distance = graph[current].distance + 1;
|
920
|
-
node.parent = current;
|
921
|
-
queue.unshift(adjacent);
|
922
|
-
}
|
923
|
-
}
|
924
|
-
}
|
925
|
-
return graph;
|
926
|
-
}
|
927
|
-
function link(from, to) {
|
928
|
-
return function(args) {
|
929
|
-
return to(from(args));
|
930
|
-
};
|
931
|
-
}
|
932
|
-
function wrapConversion(toModel, graph) {
|
933
|
-
const path = [graph[toModel].parent, toModel];
|
934
|
-
let fn = conversions[graph[toModel].parent][toModel];
|
935
|
-
let cur = graph[toModel].parent;
|
936
|
-
while (graph[cur].parent) {
|
937
|
-
path.unshift(graph[cur].parent);
|
938
|
-
fn = link(conversions[graph[cur].parent][cur], fn);
|
939
|
-
cur = graph[cur].parent;
|
940
|
-
}
|
941
|
-
fn.conversion = path;
|
942
|
-
return fn;
|
943
|
-
}
|
944
|
-
module2.exports = function(fromModel) {
|
945
|
-
const graph = deriveBFS(fromModel);
|
946
|
-
const conversion = {};
|
947
|
-
const models = Object.keys(graph);
|
948
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
949
|
-
const toModel = models[i];
|
950
|
-
const node = graph[toModel];
|
951
|
-
if (node.parent === null) {
|
952
|
-
continue;
|
953
|
-
}
|
954
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
955
|
-
}
|
956
|
-
return conversion;
|
957
|
-
};
|
958
|
-
}
|
959
|
-
});
|
960
|
-
var require_color_convert = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
961
|
-
"../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js"(exports, module2) {
|
962
|
-
"use strict";
|
963
|
-
var conversions = require_conversions();
|
964
|
-
var route = require_route();
|
965
|
-
var convert = {};
|
966
|
-
var models = Object.keys(conversions);
|
967
|
-
function wrapRaw(fn) {
|
968
|
-
const wrappedFn = function(...args) {
|
969
|
-
const arg0 = args[0];
|
970
|
-
if (arg0 === void 0 || arg0 === null) {
|
971
|
-
return arg0;
|
972
|
-
}
|
973
|
-
if (arg0.length > 1) {
|
974
|
-
args = arg0;
|
975
|
-
}
|
976
|
-
return fn(args);
|
977
|
-
};
|
978
|
-
if ("conversion" in fn) {
|
979
|
-
wrappedFn.conversion = fn.conversion;
|
980
|
-
}
|
981
|
-
return wrappedFn;
|
982
|
-
}
|
983
|
-
function wrapRounded(fn) {
|
984
|
-
const wrappedFn = function(...args) {
|
985
|
-
const arg0 = args[0];
|
986
|
-
if (arg0 === void 0 || arg0 === null) {
|
987
|
-
return arg0;
|
988
|
-
}
|
989
|
-
if (arg0.length > 1) {
|
990
|
-
args = arg0;
|
991
|
-
}
|
992
|
-
const result = fn(args);
|
993
|
-
if (typeof result === "object") {
|
994
|
-
for (let len = result.length, i = 0; i < len; i++) {
|
995
|
-
result[i] = Math.round(result[i]);
|
996
|
-
}
|
997
|
-
}
|
998
|
-
return result;
|
999
|
-
};
|
1000
|
-
if ("conversion" in fn) {
|
1001
|
-
wrappedFn.conversion = fn.conversion;
|
1002
|
-
}
|
1003
|
-
return wrappedFn;
|
1004
|
-
}
|
1005
|
-
models.forEach((fromModel) => {
|
1006
|
-
convert[fromModel] = {};
|
1007
|
-
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
1008
|
-
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
1009
|
-
const routes = route(fromModel);
|
1010
|
-
const routeModels = Object.keys(routes);
|
1011
|
-
routeModels.forEach((toModel) => {
|
1012
|
-
const fn = routes[toModel];
|
1013
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
1014
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
1015
|
-
});
|
1016
|
-
});
|
1017
|
-
module2.exports = convert;
|
1018
|
-
}
|
1019
|
-
});
|
1020
|
-
var require_ansi_styles = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
1021
|
-
"../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports, module2) {
|
1022
|
-
"use strict";
|
1023
|
-
var wrapAnsi16 = (fn, offset) => (...args) => {
|
1024
|
-
const code = fn(...args);
|
1025
|
-
return `\x1B[${code + offset}m`;
|
1026
|
-
};
|
1027
|
-
var wrapAnsi256 = (fn, offset) => (...args) => {
|
1028
|
-
const code = fn(...args);
|
1029
|
-
return `\x1B[${38 + offset};5;${code}m`;
|
1030
|
-
};
|
1031
|
-
var wrapAnsi16m = (fn, offset) => (...args) => {
|
1032
|
-
const rgb = fn(...args);
|
1033
|
-
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
1034
|
-
};
|
1035
|
-
var ansi2ansi = (n) => n;
|
1036
|
-
var rgb2rgb = (r, g, b) => [r, g, b];
|
1037
|
-
var setLazyProperty = (object, property, get) => {
|
1038
|
-
Object.defineProperty(object, property, {
|
1039
|
-
get: () => {
|
1040
|
-
const value = get();
|
1041
|
-
Object.defineProperty(object, property, {
|
1042
|
-
value,
|
1043
|
-
enumerable: true,
|
1044
|
-
configurable: true
|
1045
|
-
});
|
1046
|
-
return value;
|
1047
|
-
},
|
1048
|
-
enumerable: true,
|
1049
|
-
configurable: true
|
1050
|
-
});
|
1051
|
-
};
|
1052
|
-
var colorConvert;
|
1053
|
-
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
1054
|
-
if (colorConvert === void 0) {
|
1055
|
-
colorConvert = require_color_convert();
|
1056
|
-
}
|
1057
|
-
const offset = isBackground ? 10 : 0;
|
1058
|
-
const styles = {};
|
1059
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
1060
|
-
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
1061
|
-
if (sourceSpace === targetSpace) {
|
1062
|
-
styles[name] = wrap(identity, offset);
|
1063
|
-
} else if (typeof suite === "object") {
|
1064
|
-
styles[name] = wrap(suite[targetSpace], offset);
|
1065
|
-
}
|
1066
|
-
}
|
1067
|
-
return styles;
|
1068
|
-
};
|
1069
|
-
function assembleStyles() {
|
1070
|
-
const codes = /* @__PURE__ */ new Map();
|
1071
|
-
const styles = {
|
1072
|
-
modifier: {
|
1073
|
-
reset: [0, 0],
|
1074
|
-
// 21 isn't widely supported and 22 does the same thing
|
1075
|
-
bold: [1, 22],
|
1076
|
-
dim: [2, 22],
|
1077
|
-
italic: [3, 23],
|
1078
|
-
underline: [4, 24],
|
1079
|
-
inverse: [7, 27],
|
1080
|
-
hidden: [8, 28],
|
1081
|
-
strikethrough: [9, 29]
|
1082
|
-
},
|
1083
|
-
color: {
|
1084
|
-
black: [30, 39],
|
1085
|
-
red: [31, 39],
|
1086
|
-
green: [32, 39],
|
1087
|
-
yellow: [33, 39],
|
1088
|
-
blue: [34, 39],
|
1089
|
-
magenta: [35, 39],
|
1090
|
-
cyan: [36, 39],
|
1091
|
-
white: [37, 39],
|
1092
|
-
// Bright color
|
1093
|
-
blackBright: [90, 39],
|
1094
|
-
redBright: [91, 39],
|
1095
|
-
greenBright: [92, 39],
|
1096
|
-
yellowBright: [93, 39],
|
1097
|
-
blueBright: [94, 39],
|
1098
|
-
magentaBright: [95, 39],
|
1099
|
-
cyanBright: [96, 39],
|
1100
|
-
whiteBright: [97, 39]
|
1101
|
-
},
|
1102
|
-
bgColor: {
|
1103
|
-
bgBlack: [40, 49],
|
1104
|
-
bgRed: [41, 49],
|
1105
|
-
bgGreen: [42, 49],
|
1106
|
-
bgYellow: [43, 49],
|
1107
|
-
bgBlue: [44, 49],
|
1108
|
-
bgMagenta: [45, 49],
|
1109
|
-
bgCyan: [46, 49],
|
1110
|
-
bgWhite: [47, 49],
|
1111
|
-
// Bright color
|
1112
|
-
bgBlackBright: [100, 49],
|
1113
|
-
bgRedBright: [101, 49],
|
1114
|
-
bgGreenBright: [102, 49],
|
1115
|
-
bgYellowBright: [103, 49],
|
1116
|
-
bgBlueBright: [104, 49],
|
1117
|
-
bgMagentaBright: [105, 49],
|
1118
|
-
bgCyanBright: [106, 49],
|
1119
|
-
bgWhiteBright: [107, 49]
|
1120
|
-
}
|
1121
|
-
};
|
1122
|
-
styles.color.gray = styles.color.blackBright;
|
1123
|
-
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
1124
|
-
styles.color.grey = styles.color.blackBright;
|
1125
|
-
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
1126
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
1127
|
-
for (const [styleName, style] of Object.entries(group)) {
|
1128
|
-
styles[styleName] = {
|
1129
|
-
open: `\x1B[${style[0]}m`,
|
1130
|
-
close: `\x1B[${style[1]}m`
|
1131
|
-
};
|
1132
|
-
group[styleName] = styles[styleName];
|
1133
|
-
codes.set(style[0], style[1]);
|
1134
|
-
}
|
1135
|
-
Object.defineProperty(styles, groupName, {
|
1136
|
-
value: group,
|
1137
|
-
enumerable: false
|
1138
|
-
});
|
1139
|
-
}
|
1140
|
-
Object.defineProperty(styles, "codes", {
|
1141
|
-
value: codes,
|
1142
|
-
enumerable: false
|
1143
|
-
});
|
1144
|
-
styles.color.close = "\x1B[39m";
|
1145
|
-
styles.bgColor.close = "\x1B[49m";
|
1146
|
-
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
1147
|
-
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
1148
|
-
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
1149
|
-
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
1150
|
-
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
1151
|
-
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
1152
|
-
return styles;
|
1153
|
-
}
|
1154
|
-
Object.defineProperty(module2, "exports", {
|
1155
|
-
enumerable: true,
|
1156
|
-
get: assembleStyles
|
1157
|
-
});
|
1158
|
-
}
|
1159
|
-
});
|
1160
|
-
var require_slice_ansi = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
1161
|
-
"../../node_modules/.pnpm/slice-ansi@3.0.0/node_modules/slice-ansi/index.js"(exports, module2) {
|
1162
|
-
"use strict";
|
1163
|
-
var isFullwidthCodePoint = require_is_fullwidth_code_point();
|
1164
|
-
var astralRegex = require_astral_regex();
|
1165
|
-
var ansiStyles = require_ansi_styles();
|
1166
|
-
var ESCAPES = [
|
1167
|
-
"\x1B",
|
1168
|
-
"\x9B"
|
1169
|
-
];
|
1170
|
-
var wrapAnsi = (code) => `${ESCAPES[0]}[${code}m`;
|
1171
|
-
var checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
|
1172
|
-
let output = [];
|
1173
|
-
ansiCodes = [...ansiCodes];
|
1174
|
-
for (let ansiCode of ansiCodes) {
|
1175
|
-
const ansiCodeOrigin = ansiCode;
|
1176
|
-
if (ansiCode.match(";")) {
|
1177
|
-
ansiCode = ansiCode.split(";")[0][0] + "0";
|
1178
|
-
}
|
1179
|
-
const item = ansiStyles.codes.get(parseInt(ansiCode, 10));
|
1180
|
-
if (item) {
|
1181
|
-
const indexEscape = ansiCodes.indexOf(item.toString());
|
1182
|
-
if (indexEscape >= 0) {
|
1183
|
-
ansiCodes.splice(indexEscape, 1);
|
1184
|
-
} else {
|
1185
|
-
output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
|
1186
|
-
}
|
1187
|
-
} else if (isEscapes) {
|
1188
|
-
output.push(wrapAnsi(0));
|
1189
|
-
break;
|
1190
|
-
} else {
|
1191
|
-
output.push(wrapAnsi(ansiCodeOrigin));
|
1192
|
-
}
|
1193
|
-
}
|
1194
|
-
if (isEscapes) {
|
1195
|
-
output = output.filter((element, index) => output.indexOf(element) === index);
|
1196
|
-
if (endAnsiCode !== void 0) {
|
1197
|
-
const fistEscapeCode = wrapAnsi(ansiStyles.codes.get(parseInt(endAnsiCode, 10)));
|
1198
|
-
output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
|
1199
|
-
}
|
1200
|
-
}
|
1201
|
-
return output.join("");
|
1202
|
-
};
|
1203
|
-
module2.exports = (string, begin, end) => {
|
1204
|
-
const characters = [...string.normalize()];
|
1205
|
-
const ansiCodes = [];
|
1206
|
-
end = typeof end === "number" ? end : characters.length;
|
1207
|
-
let isInsideEscape = false;
|
1208
|
-
let ansiCode;
|
1209
|
-
let visible = 0;
|
1210
|
-
let output = "";
|
1211
|
-
for (const [index, character] of characters.entries()) {
|
1212
|
-
let leftEscape = false;
|
1213
|
-
if (ESCAPES.includes(character)) {
|
1214
|
-
const code = /\d[^m]*/.exec(string.slice(index, index + 18));
|
1215
|
-
ansiCode = code && code.length > 0 ? code[0] : void 0;
|
1216
|
-
if (visible < end) {
|
1217
|
-
isInsideEscape = true;
|
1218
|
-
if (ansiCode !== void 0) {
|
1219
|
-
ansiCodes.push(ansiCode);
|
1220
|
-
}
|
1221
|
-
}
|
1222
|
-
} else if (isInsideEscape && character === "m") {
|
1223
|
-
isInsideEscape = false;
|
1224
|
-
leftEscape = true;
|
1225
|
-
}
|
1226
|
-
if (!isInsideEscape && !leftEscape) {
|
1227
|
-
++visible;
|
1228
|
-
}
|
1229
|
-
if (!astralRegex({ exact: true }).test(character) && isFullwidthCodePoint(character.codePointAt())) {
|
1230
|
-
++visible;
|
1231
|
-
}
|
1232
|
-
if (visible > begin && visible <= end) {
|
1233
|
-
output += character;
|
1234
|
-
} else if (visible === begin && !isInsideEscape && ansiCode !== void 0) {
|
1235
|
-
output = checkAnsi(ansiCodes);
|
1236
|
-
} else if (visible >= end) {
|
1237
|
-
output += checkAnsi(ansiCodes, true, ansiCode);
|
1238
|
-
break;
|
1239
|
-
}
|
1240
|
-
}
|
1241
|
-
return output;
|
1242
|
-
};
|
1243
|
-
}
|
1244
|
-
});
|
1245
|
-
var require_emoji_regex = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
1246
|
-
"../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js"(exports, module2) {
|
1247
|
-
"use strict";
|
1248
|
-
module2.exports = function() {
|
1249
|
-
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
1250
|
-
};
|
1251
|
-
}
|
1252
|
-
});
|
1253
|
-
var require_string_width = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
1254
|
-
"../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports, module2) {
|
1255
|
-
"use strict";
|
1256
|
-
var stripAnsi = (0, import_chunk_ODI3VNBD.require_strip_ansi)();
|
1257
|
-
var isFullwidthCodePoint = require_is_fullwidth_code_point();
|
1258
|
-
var emojiRegex = require_emoji_regex();
|
1259
|
-
var stringWidth2 = (string) => {
|
1260
|
-
if (typeof string !== "string" || string.length === 0) {
|
1261
|
-
return 0;
|
1262
|
-
}
|
1263
|
-
string = stripAnsi(string);
|
1264
|
-
if (string.length === 0) {
|
1265
|
-
return 0;
|
1266
|
-
}
|
1267
|
-
string = string.replace(emojiRegex(), " ");
|
1268
|
-
let width = 0;
|
1269
|
-
for (let i = 0; i < string.length; i++) {
|
1270
|
-
const code = string.codePointAt(i);
|
1271
|
-
if (code <= 31 || code >= 127 && code <= 159) {
|
1272
|
-
continue;
|
1273
|
-
}
|
1274
|
-
if (code >= 768 && code <= 879) {
|
1275
|
-
continue;
|
1276
|
-
}
|
1277
|
-
if (code > 65535) {
|
1278
|
-
i++;
|
1279
|
-
}
|
1280
|
-
width += isFullwidthCodePoint(code) ? 2 : 1;
|
1281
|
-
}
|
1282
|
-
return width;
|
1283
|
-
};
|
1284
|
-
module2.exports = stringWidth2;
|
1285
|
-
module2.exports.default = stringWidth2;
|
1286
|
-
}
|
1287
|
-
});
|
1288
|
-
var require_cli_truncate = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
1289
|
-
"../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"(exports, module2) {
|
1290
|
-
"use strict";
|
1291
|
-
var sliceAnsi = require_slice_ansi();
|
1292
|
-
var stringWidth2 = require_string_width();
|
1293
|
-
function getIndexOfNearestSpace(string, index, shouldSearchRight) {
|
1294
|
-
if (string.charAt(index) === " ") {
|
1295
|
-
return index;
|
1296
|
-
}
|
1297
|
-
for (let i = 1; i <= 3; i++) {
|
1298
|
-
if (shouldSearchRight) {
|
1299
|
-
if (string.charAt(index + i) === " ") {
|
1300
|
-
return index + i;
|
1301
|
-
}
|
1302
|
-
} else if (string.charAt(index - i) === " ") {
|
1303
|
-
return index - i;
|
1304
|
-
}
|
1305
|
-
}
|
1306
|
-
return index;
|
1307
|
-
}
|
1308
|
-
module2.exports = (text, columns, options) => {
|
1309
|
-
options = {
|
1310
|
-
position: "end",
|
1311
|
-
preferTruncationOnSpace: false,
|
1312
|
-
...options
|
1313
|
-
};
|
1314
|
-
const { position, space, preferTruncationOnSpace } = options;
|
1315
|
-
let ellipsis = "\u2026";
|
1316
|
-
let ellipsisWidth = 1;
|
1317
|
-
if (typeof text !== "string") {
|
1318
|
-
throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
|
1319
|
-
}
|
1320
|
-
if (typeof columns !== "number") {
|
1321
|
-
throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
|
1322
|
-
}
|
1323
|
-
if (columns < 1) {
|
1324
|
-
return "";
|
1325
|
-
}
|
1326
|
-
if (columns === 1) {
|
1327
|
-
return ellipsis;
|
1328
|
-
}
|
1329
|
-
const length = stringWidth2(text);
|
1330
|
-
if (length <= columns) {
|
1331
|
-
return text;
|
1332
|
-
}
|
1333
|
-
if (position === "start") {
|
1334
|
-
if (preferTruncationOnSpace) {
|
1335
|
-
const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
|
1336
|
-
return ellipsis + sliceAnsi(text, nearestSpace, length).trim();
|
1337
|
-
}
|
1338
|
-
if (space === true) {
|
1339
|
-
ellipsis += " ";
|
1340
|
-
ellipsisWidth = 2;
|
1341
|
-
}
|
1342
|
-
return ellipsis + sliceAnsi(text, length - columns + ellipsisWidth, length);
|
1343
|
-
}
|
1344
|
-
if (position === "middle") {
|
1345
|
-
if (space === true) {
|
1346
|
-
ellipsis = " " + ellipsis + " ";
|
1347
|
-
ellipsisWidth = 3;
|
1348
|
-
}
|
1349
|
-
const half = Math.floor(columns / 2);
|
1350
|
-
if (preferTruncationOnSpace) {
|
1351
|
-
const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
|
1352
|
-
const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
|
1353
|
-
return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + ellipsis + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
|
1354
|
-
}
|
1355
|
-
return sliceAnsi(text, 0, half) + ellipsis + sliceAnsi(text, length - (columns - half) + ellipsisWidth, length);
|
1356
|
-
}
|
1357
|
-
if (position === "end") {
|
1358
|
-
if (preferTruncationOnSpace) {
|
1359
|
-
const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
|
1360
|
-
return sliceAnsi(text, 0, nearestSpace) + ellipsis;
|
1361
|
-
}
|
1362
|
-
if (space === true) {
|
1363
|
-
ellipsis = " " + ellipsis;
|
1364
|
-
ellipsisWidth = 2;
|
1365
|
-
}
|
1366
|
-
return sliceAnsi(text, 0, columns - ellipsisWidth) + ellipsis;
|
1367
|
-
}
|
1368
|
-
throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
|
1369
|
-
};
|
1370
|
-
}
|
1371
|
-
});
|
1372
|
-
var import_cli_truncate = (0, import_chunk_WWAWV7DQ.__toESM)(require_cli_truncate());
|
1373
|
-
var import_string_width = (0, import_chunk_WWAWV7DQ.__toESM)(require_string_width());
|
1374
|
-
var chars = {
|
1375
|
-
topLeft: "\u250C",
|
1376
|
-
topRight: "\u2510",
|
1377
|
-
bottomRight: "\u2518",
|
1378
|
-
bottomLeft: "\u2514",
|
1379
|
-
vertical: "\u2502",
|
1380
|
-
horizontal: "\u2500"
|
1381
|
-
};
|
1382
|
-
function maxLineLength(str) {
|
1383
|
-
return str.split("\n").reduce((max, curr) => Math.max(max, (0, import_string_width.default)(curr)), 0) + 2;
|
1384
|
-
}
|
1385
|
-
function drawBox({ title, width, height, str, horizontalPadding }) {
|
1386
|
-
horizontalPadding = horizontalPadding || 0;
|
1387
|
-
width = width || 0;
|
1388
|
-
height = height || 0;
|
1389
|
-
width = Math.max(width, maxLineLength(str) + horizontalPadding * 2);
|
1390
|
-
const topLine = title ? (0, import_chunk_PG5FDKSF.grey)(chars.topLeft + chars.horizontal) + " " + (0, import_chunk_PG5FDKSF.reset)((0, import_chunk_PG5FDKSF.bold)(title)) + " " + (0, import_chunk_PG5FDKSF.grey)(chars.horizontal.repeat(width - title.length - 2 - 3) + chars.topRight) + (0, import_chunk_PG5FDKSF.reset)() : (0, import_chunk_PG5FDKSF.grey)(chars.topLeft + chars.horizontal) + (0, import_chunk_PG5FDKSF.grey)(chars.horizontal.repeat(width - 3) + chars.topRight);
|
1391
|
-
const bottomLine = chars.bottomLeft + chars.horizontal.repeat(width - 2) + chars.bottomRight;
|
1392
|
-
const lines = str.split("\n");
|
1393
|
-
if (lines.length < height) {
|
1394
|
-
lines.push(...new Array(height - lines.length).fill(""));
|
1395
|
-
}
|
1396
|
-
const mappedLines = lines.slice(-height).map((l) => {
|
1397
|
-
const lineWidth = Math.min((0, import_string_width.default)(l), width);
|
1398
|
-
const paddingRight = Math.max(width - lineWidth - 2, 0);
|
1399
|
-
return `${(0, import_chunk_PG5FDKSF.grey)(chars.vertical)}${" ".repeat(horizontalPadding)}${(0, import_chunk_PG5FDKSF.reset)((0, import_cli_truncate.default)(l, width - 2))}${" ".repeat(
|
1400
|
-
paddingRight - horizontalPadding
|
1401
|
-
)}${(0, import_chunk_PG5FDKSF.grey)(chars.vertical)}`;
|
1402
|
-
}).join("\n");
|
1403
|
-
return (0, import_chunk_PG5FDKSF.grey)(topLine + "\n" + mappedLines + "\n" + bottomLine);
|
1404
|
-
}
|