@orval/query 6.24.0 → 6.26.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 +1 -0
- package/dist/index.js +537 -1544
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,1574 +27,514 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
//
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"beige": [245, 245, 220],
|
|
44
|
-
"bisque": [255, 228, 196],
|
|
45
|
-
"black": [0, 0, 0],
|
|
46
|
-
"blanchedalmond": [255, 235, 205],
|
|
47
|
-
"blue": [0, 0, 255],
|
|
48
|
-
"blueviolet": [138, 43, 226],
|
|
49
|
-
"brown": [165, 42, 42],
|
|
50
|
-
"burlywood": [222, 184, 135],
|
|
51
|
-
"cadetblue": [95, 158, 160],
|
|
52
|
-
"chartreuse": [127, 255, 0],
|
|
53
|
-
"chocolate": [210, 105, 30],
|
|
54
|
-
"coral": [255, 127, 80],
|
|
55
|
-
"cornflowerblue": [100, 149, 237],
|
|
56
|
-
"cornsilk": [255, 248, 220],
|
|
57
|
-
"crimson": [220, 20, 60],
|
|
58
|
-
"cyan": [0, 255, 255],
|
|
59
|
-
"darkblue": [0, 0, 139],
|
|
60
|
-
"darkcyan": [0, 139, 139],
|
|
61
|
-
"darkgoldenrod": [184, 134, 11],
|
|
62
|
-
"darkgray": [169, 169, 169],
|
|
63
|
-
"darkgreen": [0, 100, 0],
|
|
64
|
-
"darkgrey": [169, 169, 169],
|
|
65
|
-
"darkkhaki": [189, 183, 107],
|
|
66
|
-
"darkmagenta": [139, 0, 139],
|
|
67
|
-
"darkolivegreen": [85, 107, 47],
|
|
68
|
-
"darkorange": [255, 140, 0],
|
|
69
|
-
"darkorchid": [153, 50, 204],
|
|
70
|
-
"darkred": [139, 0, 0],
|
|
71
|
-
"darksalmon": [233, 150, 122],
|
|
72
|
-
"darkseagreen": [143, 188, 143],
|
|
73
|
-
"darkslateblue": [72, 61, 139],
|
|
74
|
-
"darkslategray": [47, 79, 79],
|
|
75
|
-
"darkslategrey": [47, 79, 79],
|
|
76
|
-
"darkturquoise": [0, 206, 209],
|
|
77
|
-
"darkviolet": [148, 0, 211],
|
|
78
|
-
"deeppink": [255, 20, 147],
|
|
79
|
-
"deepskyblue": [0, 191, 255],
|
|
80
|
-
"dimgray": [105, 105, 105],
|
|
81
|
-
"dimgrey": [105, 105, 105],
|
|
82
|
-
"dodgerblue": [30, 144, 255],
|
|
83
|
-
"firebrick": [178, 34, 34],
|
|
84
|
-
"floralwhite": [255, 250, 240],
|
|
85
|
-
"forestgreen": [34, 139, 34],
|
|
86
|
-
"fuchsia": [255, 0, 255],
|
|
87
|
-
"gainsboro": [220, 220, 220],
|
|
88
|
-
"ghostwhite": [248, 248, 255],
|
|
89
|
-
"gold": [255, 215, 0],
|
|
90
|
-
"goldenrod": [218, 165, 32],
|
|
91
|
-
"gray": [128, 128, 128],
|
|
92
|
-
"green": [0, 128, 0],
|
|
93
|
-
"greenyellow": [173, 255, 47],
|
|
94
|
-
"grey": [128, 128, 128],
|
|
95
|
-
"honeydew": [240, 255, 240],
|
|
96
|
-
"hotpink": [255, 105, 180],
|
|
97
|
-
"indianred": [205, 92, 92],
|
|
98
|
-
"indigo": [75, 0, 130],
|
|
99
|
-
"ivory": [255, 255, 240],
|
|
100
|
-
"khaki": [240, 230, 140],
|
|
101
|
-
"lavender": [230, 230, 250],
|
|
102
|
-
"lavenderblush": [255, 240, 245],
|
|
103
|
-
"lawngreen": [124, 252, 0],
|
|
104
|
-
"lemonchiffon": [255, 250, 205],
|
|
105
|
-
"lightblue": [173, 216, 230],
|
|
106
|
-
"lightcoral": [240, 128, 128],
|
|
107
|
-
"lightcyan": [224, 255, 255],
|
|
108
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
109
|
-
"lightgray": [211, 211, 211],
|
|
110
|
-
"lightgreen": [144, 238, 144],
|
|
111
|
-
"lightgrey": [211, 211, 211],
|
|
112
|
-
"lightpink": [255, 182, 193],
|
|
113
|
-
"lightsalmon": [255, 160, 122],
|
|
114
|
-
"lightseagreen": [32, 178, 170],
|
|
115
|
-
"lightskyblue": [135, 206, 250],
|
|
116
|
-
"lightslategray": [119, 136, 153],
|
|
117
|
-
"lightslategrey": [119, 136, 153],
|
|
118
|
-
"lightsteelblue": [176, 196, 222],
|
|
119
|
-
"lightyellow": [255, 255, 224],
|
|
120
|
-
"lime": [0, 255, 0],
|
|
121
|
-
"limegreen": [50, 205, 50],
|
|
122
|
-
"linen": [250, 240, 230],
|
|
123
|
-
"magenta": [255, 0, 255],
|
|
124
|
-
"maroon": [128, 0, 0],
|
|
125
|
-
"mediumaquamarine": [102, 205, 170],
|
|
126
|
-
"mediumblue": [0, 0, 205],
|
|
127
|
-
"mediumorchid": [186, 85, 211],
|
|
128
|
-
"mediumpurple": [147, 112, 219],
|
|
129
|
-
"mediumseagreen": [60, 179, 113],
|
|
130
|
-
"mediumslateblue": [123, 104, 238],
|
|
131
|
-
"mediumspringgreen": [0, 250, 154],
|
|
132
|
-
"mediumturquoise": [72, 209, 204],
|
|
133
|
-
"mediumvioletred": [199, 21, 133],
|
|
134
|
-
"midnightblue": [25, 25, 112],
|
|
135
|
-
"mintcream": [245, 255, 250],
|
|
136
|
-
"mistyrose": [255, 228, 225],
|
|
137
|
-
"moccasin": [255, 228, 181],
|
|
138
|
-
"navajowhite": [255, 222, 173],
|
|
139
|
-
"navy": [0, 0, 128],
|
|
140
|
-
"oldlace": [253, 245, 230],
|
|
141
|
-
"olive": [128, 128, 0],
|
|
142
|
-
"olivedrab": [107, 142, 35],
|
|
143
|
-
"orange": [255, 165, 0],
|
|
144
|
-
"orangered": [255, 69, 0],
|
|
145
|
-
"orchid": [218, 112, 214],
|
|
146
|
-
"palegoldenrod": [238, 232, 170],
|
|
147
|
-
"palegreen": [152, 251, 152],
|
|
148
|
-
"paleturquoise": [175, 238, 238],
|
|
149
|
-
"palevioletred": [219, 112, 147],
|
|
150
|
-
"papayawhip": [255, 239, 213],
|
|
151
|
-
"peachpuff": [255, 218, 185],
|
|
152
|
-
"peru": [205, 133, 63],
|
|
153
|
-
"pink": [255, 192, 203],
|
|
154
|
-
"plum": [221, 160, 221],
|
|
155
|
-
"powderblue": [176, 224, 230],
|
|
156
|
-
"purple": [128, 0, 128],
|
|
157
|
-
"rebeccapurple": [102, 51, 153],
|
|
158
|
-
"red": [255, 0, 0],
|
|
159
|
-
"rosybrown": [188, 143, 143],
|
|
160
|
-
"royalblue": [65, 105, 225],
|
|
161
|
-
"saddlebrown": [139, 69, 19],
|
|
162
|
-
"salmon": [250, 128, 114],
|
|
163
|
-
"sandybrown": [244, 164, 96],
|
|
164
|
-
"seagreen": [46, 139, 87],
|
|
165
|
-
"seashell": [255, 245, 238],
|
|
166
|
-
"sienna": [160, 82, 45],
|
|
167
|
-
"silver": [192, 192, 192],
|
|
168
|
-
"skyblue": [135, 206, 235],
|
|
169
|
-
"slateblue": [106, 90, 205],
|
|
170
|
-
"slategray": [112, 128, 144],
|
|
171
|
-
"slategrey": [112, 128, 144],
|
|
172
|
-
"snow": [255, 250, 250],
|
|
173
|
-
"springgreen": [0, 255, 127],
|
|
174
|
-
"steelblue": [70, 130, 180],
|
|
175
|
-
"tan": [210, 180, 140],
|
|
176
|
-
"teal": [0, 128, 128],
|
|
177
|
-
"thistle": [216, 191, 216],
|
|
178
|
-
"tomato": [255, 99, 71],
|
|
179
|
-
"turquoise": [64, 224, 208],
|
|
180
|
-
"violet": [238, 130, 238],
|
|
181
|
-
"wheat": [245, 222, 179],
|
|
182
|
-
"white": [255, 255, 255],
|
|
183
|
-
"whitesmoke": [245, 245, 245],
|
|
184
|
-
"yellow": [255, 255, 0],
|
|
185
|
-
"yellowgreen": [154, 205, 50]
|
|
186
|
-
};
|
|
187
|
-
}
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
builder: () => builder,
|
|
34
|
+
default: () => src_default,
|
|
35
|
+
generateQuery: () => generateQuery,
|
|
36
|
+
generateQueryHeader: () => generateQueryHeader,
|
|
37
|
+
getReactQueryDependencies: () => getReactQueryDependencies,
|
|
38
|
+
getSvelteQueryDependencies: () => getSvelteQueryDependencies,
|
|
39
|
+
getVueQueryDependencies: () => getVueQueryDependencies
|
|
188
40
|
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
var import_core2 = require("@orval/core");
|
|
43
|
+
var import_lodash = __toESM(require("lodash.omitby"));
|
|
189
44
|
|
|
190
|
-
//
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
let h;
|
|
270
|
-
let s;
|
|
271
|
-
const r = rgb[0] / 255;
|
|
272
|
-
const g = rgb[1] / 255;
|
|
273
|
-
const b = rgb[2] / 255;
|
|
274
|
-
const v = Math.max(r, g, b);
|
|
275
|
-
const diff = v - Math.min(r, g, b);
|
|
276
|
-
const diffc = function(c) {
|
|
277
|
-
return (v - c) / 6 / diff + 1 / 2;
|
|
45
|
+
// src/utils.ts
|
|
46
|
+
var import_core = require("@orval/core");
|
|
47
|
+
|
|
48
|
+
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
49
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
50
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
51
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
52
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
53
|
+
var styles = {
|
|
54
|
+
modifier: {
|
|
55
|
+
reset: [0, 0],
|
|
56
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
57
|
+
bold: [1, 22],
|
|
58
|
+
dim: [2, 22],
|
|
59
|
+
italic: [3, 23],
|
|
60
|
+
underline: [4, 24],
|
|
61
|
+
overline: [53, 55],
|
|
62
|
+
inverse: [7, 27],
|
|
63
|
+
hidden: [8, 28],
|
|
64
|
+
strikethrough: [9, 29]
|
|
65
|
+
},
|
|
66
|
+
color: {
|
|
67
|
+
black: [30, 39],
|
|
68
|
+
red: [31, 39],
|
|
69
|
+
green: [32, 39],
|
|
70
|
+
yellow: [33, 39],
|
|
71
|
+
blue: [34, 39],
|
|
72
|
+
magenta: [35, 39],
|
|
73
|
+
cyan: [36, 39],
|
|
74
|
+
white: [37, 39],
|
|
75
|
+
// Bright color
|
|
76
|
+
blackBright: [90, 39],
|
|
77
|
+
gray: [90, 39],
|
|
78
|
+
// Alias of `blackBright`
|
|
79
|
+
grey: [90, 39],
|
|
80
|
+
// Alias of `blackBright`
|
|
81
|
+
redBright: [91, 39],
|
|
82
|
+
greenBright: [92, 39],
|
|
83
|
+
yellowBright: [93, 39],
|
|
84
|
+
blueBright: [94, 39],
|
|
85
|
+
magentaBright: [95, 39],
|
|
86
|
+
cyanBright: [96, 39],
|
|
87
|
+
whiteBright: [97, 39]
|
|
88
|
+
},
|
|
89
|
+
bgColor: {
|
|
90
|
+
bgBlack: [40, 49],
|
|
91
|
+
bgRed: [41, 49],
|
|
92
|
+
bgGreen: [42, 49],
|
|
93
|
+
bgYellow: [43, 49],
|
|
94
|
+
bgBlue: [44, 49],
|
|
95
|
+
bgMagenta: [45, 49],
|
|
96
|
+
bgCyan: [46, 49],
|
|
97
|
+
bgWhite: [47, 49],
|
|
98
|
+
// Bright color
|
|
99
|
+
bgBlackBright: [100, 49],
|
|
100
|
+
bgGray: [100, 49],
|
|
101
|
+
// Alias of `bgBlackBright`
|
|
102
|
+
bgGrey: [100, 49],
|
|
103
|
+
// Alias of `bgBlackBright`
|
|
104
|
+
bgRedBright: [101, 49],
|
|
105
|
+
bgGreenBright: [102, 49],
|
|
106
|
+
bgYellowBright: [103, 49],
|
|
107
|
+
bgBlueBright: [104, 49],
|
|
108
|
+
bgMagentaBright: [105, 49],
|
|
109
|
+
bgCyanBright: [106, 49],
|
|
110
|
+
bgWhiteBright: [107, 49]
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
114
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
115
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
116
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
117
|
+
function assembleStyles() {
|
|
118
|
+
const codes = /* @__PURE__ */ new Map();
|
|
119
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
120
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
121
|
+
styles[styleName] = {
|
|
122
|
+
open: `\x1B[${style[0]}m`,
|
|
123
|
+
close: `\x1B[${style[1]}m`
|
|
278
124
|
};
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
s = 0;
|
|
282
|
-
} else {
|
|
283
|
-
s = diff / v;
|
|
284
|
-
rdif = diffc(r);
|
|
285
|
-
gdif = diffc(g);
|
|
286
|
-
bdif = diffc(b);
|
|
287
|
-
if (r === v) {
|
|
288
|
-
h = bdif - gdif;
|
|
289
|
-
} else if (g === v) {
|
|
290
|
-
h = 1 / 3 + rdif - bdif;
|
|
291
|
-
} else if (b === v) {
|
|
292
|
-
h = 2 / 3 + gdif - rdif;
|
|
293
|
-
}
|
|
294
|
-
if (h < 0) {
|
|
295
|
-
h += 1;
|
|
296
|
-
} else if (h > 1) {
|
|
297
|
-
h -= 1;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return [
|
|
301
|
-
h * 360,
|
|
302
|
-
s * 100,
|
|
303
|
-
v * 100
|
|
304
|
-
];
|
|
305
|
-
};
|
|
306
|
-
convert.rgb.hwb = function(rgb) {
|
|
307
|
-
const r = rgb[0];
|
|
308
|
-
const g = rgb[1];
|
|
309
|
-
let b = rgb[2];
|
|
310
|
-
const h = convert.rgb.hsl(rgb)[0];
|
|
311
|
-
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
312
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
313
|
-
return [h, w * 100, b * 100];
|
|
314
|
-
};
|
|
315
|
-
convert.rgb.cmyk = function(rgb) {
|
|
316
|
-
const r = rgb[0] / 255;
|
|
317
|
-
const g = rgb[1] / 255;
|
|
318
|
-
const b = rgb[2] / 255;
|
|
319
|
-
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
320
|
-
const c = (1 - r - k) / (1 - k) || 0;
|
|
321
|
-
const m = (1 - g - k) / (1 - k) || 0;
|
|
322
|
-
const y = (1 - b - k) / (1 - k) || 0;
|
|
323
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
|
324
|
-
};
|
|
325
|
-
function comparativeDistance(x, y) {
|
|
326
|
-
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
125
|
+
group[styleName] = styles[styleName];
|
|
126
|
+
codes.set(style[0], style[1]);
|
|
327
127
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
128
|
+
Object.defineProperty(styles, groupName, {
|
|
129
|
+
value: group,
|
|
130
|
+
enumerable: false
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
Object.defineProperty(styles, "codes", {
|
|
134
|
+
value: codes,
|
|
135
|
+
enumerable: false
|
|
136
|
+
});
|
|
137
|
+
styles.color.close = "\x1B[39m";
|
|
138
|
+
styles.bgColor.close = "\x1B[49m";
|
|
139
|
+
styles.color.ansi = wrapAnsi16();
|
|
140
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
141
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
142
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
143
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
144
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
145
|
+
Object.defineProperties(styles, {
|
|
146
|
+
rgbToAnsi256: {
|
|
147
|
+
value(red, green, blue) {
|
|
148
|
+
if (red === green && green === blue) {
|
|
149
|
+
if (red < 8) {
|
|
150
|
+
return 16;
|
|
151
|
+
}
|
|
152
|
+
if (red > 248) {
|
|
153
|
+
return 231;
|
|
154
|
+
}
|
|
155
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
341
156
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
let b = rgb[2] / 255;
|
|
352
|
-
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
353
|
-
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
354
|
-
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
355
|
-
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
356
|
-
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
357
|
-
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
358
|
-
return [x * 100, y * 100, z * 100];
|
|
359
|
-
};
|
|
360
|
-
convert.rgb.lab = function(rgb) {
|
|
361
|
-
const xyz = convert.rgb.xyz(rgb);
|
|
362
|
-
let x = xyz[0];
|
|
363
|
-
let y = xyz[1];
|
|
364
|
-
let z = xyz[2];
|
|
365
|
-
x /= 95.047;
|
|
366
|
-
y /= 100;
|
|
367
|
-
z /= 108.883;
|
|
368
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
369
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
370
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
371
|
-
const l = 116 * y - 16;
|
|
372
|
-
const a = 500 * (x - y);
|
|
373
|
-
const b = 200 * (y - z);
|
|
374
|
-
return [l, a, b];
|
|
375
|
-
};
|
|
376
|
-
convert.hsl.rgb = function(hsl) {
|
|
377
|
-
const h = hsl[0] / 360;
|
|
378
|
-
const s = hsl[1] / 100;
|
|
379
|
-
const l = hsl[2] / 100;
|
|
380
|
-
let t2;
|
|
381
|
-
let t3;
|
|
382
|
-
let val;
|
|
383
|
-
if (s === 0) {
|
|
384
|
-
val = l * 255;
|
|
385
|
-
return [val, val, val];
|
|
386
|
-
}
|
|
387
|
-
if (l < 0.5) {
|
|
388
|
-
t2 = l * (1 + s);
|
|
389
|
-
} else {
|
|
390
|
-
t2 = l + s - l * s;
|
|
391
|
-
}
|
|
392
|
-
const t1 = 2 * l - t2;
|
|
393
|
-
const rgb = [0, 0, 0];
|
|
394
|
-
for (let i = 0; i < 3; i++) {
|
|
395
|
-
t3 = h + 1 / 3 * -(i - 1);
|
|
396
|
-
if (t3 < 0) {
|
|
397
|
-
t3++;
|
|
157
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
158
|
+
},
|
|
159
|
+
enumerable: false
|
|
160
|
+
},
|
|
161
|
+
hexToRgb: {
|
|
162
|
+
value(hex) {
|
|
163
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
164
|
+
if (!matches) {
|
|
165
|
+
return [0, 0, 0];
|
|
398
166
|
}
|
|
399
|
-
|
|
400
|
-
|
|
167
|
+
let [colorString] = matches;
|
|
168
|
+
if (colorString.length === 3) {
|
|
169
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
401
170
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
171
|
+
const integer = Number.parseInt(colorString, 16);
|
|
172
|
+
return [
|
|
173
|
+
/* eslint-disable no-bitwise */
|
|
174
|
+
integer >> 16 & 255,
|
|
175
|
+
integer >> 8 & 255,
|
|
176
|
+
integer & 255
|
|
177
|
+
/* eslint-enable no-bitwise */
|
|
178
|
+
];
|
|
179
|
+
},
|
|
180
|
+
enumerable: false
|
|
181
|
+
},
|
|
182
|
+
hexToAnsi256: {
|
|
183
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
184
|
+
enumerable: false
|
|
185
|
+
},
|
|
186
|
+
ansi256ToAnsi: {
|
|
187
|
+
value(code) {
|
|
188
|
+
if (code < 8) {
|
|
189
|
+
return 30 + code;
|
|
410
190
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
return rgb;
|
|
414
|
-
};
|
|
415
|
-
convert.hsl.hsv = function(hsl) {
|
|
416
|
-
const h = hsl[0];
|
|
417
|
-
let s = hsl[1] / 100;
|
|
418
|
-
let l = hsl[2] / 100;
|
|
419
|
-
let smin = s;
|
|
420
|
-
const lmin = Math.max(l, 0.01);
|
|
421
|
-
l *= 2;
|
|
422
|
-
s *= l <= 1 ? l : 2 - l;
|
|
423
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
424
|
-
const v = (l + s) / 2;
|
|
425
|
-
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
426
|
-
return [h, sv * 100, v * 100];
|
|
427
|
-
};
|
|
428
|
-
convert.hsv.rgb = function(hsv) {
|
|
429
|
-
const h = hsv[0] / 60;
|
|
430
|
-
const s = hsv[1] / 100;
|
|
431
|
-
let v = hsv[2] / 100;
|
|
432
|
-
const hi = Math.floor(h) % 6;
|
|
433
|
-
const f = h - Math.floor(h);
|
|
434
|
-
const p = 255 * v * (1 - s);
|
|
435
|
-
const q = 255 * v * (1 - s * f);
|
|
436
|
-
const t = 255 * v * (1 - s * (1 - f));
|
|
437
|
-
v *= 255;
|
|
438
|
-
switch (hi) {
|
|
439
|
-
case 0:
|
|
440
|
-
return [v, t, p];
|
|
441
|
-
case 1:
|
|
442
|
-
return [q, v, p];
|
|
443
|
-
case 2:
|
|
444
|
-
return [p, v, t];
|
|
445
|
-
case 3:
|
|
446
|
-
return [p, q, v];
|
|
447
|
-
case 4:
|
|
448
|
-
return [t, p, v];
|
|
449
|
-
case 5:
|
|
450
|
-
return [v, p, q];
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
convert.hsv.hsl = function(hsv) {
|
|
454
|
-
const h = hsv[0];
|
|
455
|
-
const s = hsv[1] / 100;
|
|
456
|
-
const v = hsv[2] / 100;
|
|
457
|
-
const vmin = Math.max(v, 0.01);
|
|
458
|
-
let sl;
|
|
459
|
-
let l;
|
|
460
|
-
l = (2 - s) * v;
|
|
461
|
-
const lmin = (2 - s) * vmin;
|
|
462
|
-
sl = s * vmin;
|
|
463
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
464
|
-
sl = sl || 0;
|
|
465
|
-
l /= 2;
|
|
466
|
-
return [h, sl * 100, l * 100];
|
|
467
|
-
};
|
|
468
|
-
convert.hwb.rgb = function(hwb) {
|
|
469
|
-
const h = hwb[0] / 360;
|
|
470
|
-
let wh = hwb[1] / 100;
|
|
471
|
-
let bl = hwb[2] / 100;
|
|
472
|
-
const ratio = wh + bl;
|
|
473
|
-
let f;
|
|
474
|
-
if (ratio > 1) {
|
|
475
|
-
wh /= ratio;
|
|
476
|
-
bl /= ratio;
|
|
477
|
-
}
|
|
478
|
-
const i = Math.floor(6 * h);
|
|
479
|
-
const v = 1 - bl;
|
|
480
|
-
f = 6 * h - i;
|
|
481
|
-
if ((i & 1) !== 0) {
|
|
482
|
-
f = 1 - f;
|
|
483
|
-
}
|
|
484
|
-
const n = wh + f * (v - wh);
|
|
485
|
-
let r;
|
|
486
|
-
let g;
|
|
487
|
-
let b;
|
|
488
|
-
switch (i) {
|
|
489
|
-
default:
|
|
490
|
-
case 6:
|
|
491
|
-
case 0:
|
|
492
|
-
r = v;
|
|
493
|
-
g = n;
|
|
494
|
-
b = wh;
|
|
495
|
-
break;
|
|
496
|
-
case 1:
|
|
497
|
-
r = n;
|
|
498
|
-
g = v;
|
|
499
|
-
b = wh;
|
|
500
|
-
break;
|
|
501
|
-
case 2:
|
|
502
|
-
r = wh;
|
|
503
|
-
g = v;
|
|
504
|
-
b = n;
|
|
505
|
-
break;
|
|
506
|
-
case 3:
|
|
507
|
-
r = wh;
|
|
508
|
-
g = n;
|
|
509
|
-
b = v;
|
|
510
|
-
break;
|
|
511
|
-
case 4:
|
|
512
|
-
r = n;
|
|
513
|
-
g = wh;
|
|
514
|
-
b = v;
|
|
515
|
-
break;
|
|
516
|
-
case 5:
|
|
517
|
-
r = v;
|
|
518
|
-
g = wh;
|
|
519
|
-
b = n;
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
return [r * 255, g * 255, b * 255];
|
|
523
|
-
};
|
|
524
|
-
convert.cmyk.rgb = function(cmyk) {
|
|
525
|
-
const c = cmyk[0] / 100;
|
|
526
|
-
const m = cmyk[1] / 100;
|
|
527
|
-
const y = cmyk[2] / 100;
|
|
528
|
-
const k = cmyk[3] / 100;
|
|
529
|
-
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
530
|
-
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
531
|
-
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
532
|
-
return [r * 255, g * 255, b * 255];
|
|
533
|
-
};
|
|
534
|
-
convert.xyz.rgb = function(xyz) {
|
|
535
|
-
const x = xyz[0] / 100;
|
|
536
|
-
const y = xyz[1] / 100;
|
|
537
|
-
const z = xyz[2] / 100;
|
|
538
|
-
let r;
|
|
539
|
-
let g;
|
|
540
|
-
let b;
|
|
541
|
-
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
542
|
-
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
543
|
-
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
544
|
-
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
545
|
-
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
546
|
-
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
547
|
-
r = Math.min(Math.max(0, r), 1);
|
|
548
|
-
g = Math.min(Math.max(0, g), 1);
|
|
549
|
-
b = Math.min(Math.max(0, b), 1);
|
|
550
|
-
return [r * 255, g * 255, b * 255];
|
|
551
|
-
};
|
|
552
|
-
convert.xyz.lab = function(xyz) {
|
|
553
|
-
let x = xyz[0];
|
|
554
|
-
let y = xyz[1];
|
|
555
|
-
let z = xyz[2];
|
|
556
|
-
x /= 95.047;
|
|
557
|
-
y /= 100;
|
|
558
|
-
z /= 108.883;
|
|
559
|
-
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
560
|
-
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
561
|
-
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
562
|
-
const l = 116 * y - 16;
|
|
563
|
-
const a = 500 * (x - y);
|
|
564
|
-
const b = 200 * (y - z);
|
|
565
|
-
return [l, a, b];
|
|
566
|
-
};
|
|
567
|
-
convert.lab.xyz = function(lab) {
|
|
568
|
-
const l = lab[0];
|
|
569
|
-
const a = lab[1];
|
|
570
|
-
const b = lab[2];
|
|
571
|
-
let x;
|
|
572
|
-
let y;
|
|
573
|
-
let z;
|
|
574
|
-
y = (l + 16) / 116;
|
|
575
|
-
x = a / 500 + y;
|
|
576
|
-
z = y - b / 200;
|
|
577
|
-
const y2 = y ** 3;
|
|
578
|
-
const x2 = x ** 3;
|
|
579
|
-
const z2 = z ** 3;
|
|
580
|
-
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
581
|
-
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
582
|
-
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
583
|
-
x *= 95.047;
|
|
584
|
-
y *= 100;
|
|
585
|
-
z *= 108.883;
|
|
586
|
-
return [x, y, z];
|
|
587
|
-
};
|
|
588
|
-
convert.lab.lch = function(lab) {
|
|
589
|
-
const l = lab[0];
|
|
590
|
-
const a = lab[1];
|
|
591
|
-
const b = lab[2];
|
|
592
|
-
let h;
|
|
593
|
-
const hr = Math.atan2(b, a);
|
|
594
|
-
h = hr * 360 / 2 / Math.PI;
|
|
595
|
-
if (h < 0) {
|
|
596
|
-
h += 360;
|
|
597
|
-
}
|
|
598
|
-
const c = Math.sqrt(a * a + b * b);
|
|
599
|
-
return [l, c, h];
|
|
600
|
-
};
|
|
601
|
-
convert.lch.lab = function(lch) {
|
|
602
|
-
const l = lch[0];
|
|
603
|
-
const c = lch[1];
|
|
604
|
-
const h = lch[2];
|
|
605
|
-
const hr = h / 360 * 2 * Math.PI;
|
|
606
|
-
const a = c * Math.cos(hr);
|
|
607
|
-
const b = c * Math.sin(hr);
|
|
608
|
-
return [l, a, b];
|
|
609
|
-
};
|
|
610
|
-
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
611
|
-
const [r, g, b] = args;
|
|
612
|
-
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
613
|
-
value = Math.round(value / 50);
|
|
614
|
-
if (value === 0) {
|
|
615
|
-
return 30;
|
|
616
|
-
}
|
|
617
|
-
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
618
|
-
if (value === 2) {
|
|
619
|
-
ansi += 60;
|
|
620
|
-
}
|
|
621
|
-
return ansi;
|
|
622
|
-
};
|
|
623
|
-
convert.hsv.ansi16 = function(args) {
|
|
624
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
625
|
-
};
|
|
626
|
-
convert.rgb.ansi256 = function(args) {
|
|
627
|
-
const r = args[0];
|
|
628
|
-
const g = args[1];
|
|
629
|
-
const b = args[2];
|
|
630
|
-
if (r === g && g === b) {
|
|
631
|
-
if (r < 8) {
|
|
632
|
-
return 16;
|
|
191
|
+
if (code < 16) {
|
|
192
|
+
return 90 + (code - 8);
|
|
633
193
|
}
|
|
634
|
-
|
|
635
|
-
|
|
194
|
+
let red;
|
|
195
|
+
let green;
|
|
196
|
+
let blue;
|
|
197
|
+
if (code >= 232) {
|
|
198
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
199
|
+
green = red;
|
|
200
|
+
blue = red;
|
|
201
|
+
} else {
|
|
202
|
+
code -= 16;
|
|
203
|
+
const remainder = code % 36;
|
|
204
|
+
red = Math.floor(code / 36) / 5;
|
|
205
|
+
green = Math.floor(remainder / 6) / 5;
|
|
206
|
+
blue = remainder % 6 / 5;
|
|
636
207
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
return ansi;
|
|
641
|
-
};
|
|
642
|
-
convert.ansi16.rgb = function(args) {
|
|
643
|
-
let color = args % 10;
|
|
644
|
-
if (color === 0 || color === 7) {
|
|
645
|
-
if (args > 50) {
|
|
646
|
-
color += 3.5;
|
|
208
|
+
const value = Math.max(red, green, blue) * 2;
|
|
209
|
+
if (value === 0) {
|
|
210
|
+
return 30;
|
|
647
211
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
const mult = (~~(args > 50) + 1) * 0.5;
|
|
652
|
-
const r = (color & 1) * mult * 255;
|
|
653
|
-
const g = (color >> 1 & 1) * mult * 255;
|
|
654
|
-
const b = (color >> 2 & 1) * mult * 255;
|
|
655
|
-
return [r, g, b];
|
|
656
|
-
};
|
|
657
|
-
convert.ansi256.rgb = function(args) {
|
|
658
|
-
if (args >= 232) {
|
|
659
|
-
const c = (args - 232) * 10 + 8;
|
|
660
|
-
return [c, c, c];
|
|
661
|
-
}
|
|
662
|
-
args -= 16;
|
|
663
|
-
let rem;
|
|
664
|
-
const r = Math.floor(args / 36) / 5 * 255;
|
|
665
|
-
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
666
|
-
const b = rem % 6 / 5 * 255;
|
|
667
|
-
return [r, g, b];
|
|
668
|
-
};
|
|
669
|
-
convert.rgb.hex = function(args) {
|
|
670
|
-
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
671
|
-
const string = integer.toString(16).toUpperCase();
|
|
672
|
-
return "000000".substring(string.length) + string;
|
|
673
|
-
};
|
|
674
|
-
convert.hex.rgb = function(args) {
|
|
675
|
-
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
676
|
-
if (!match) {
|
|
677
|
-
return [0, 0, 0];
|
|
678
|
-
}
|
|
679
|
-
let colorString = match[0];
|
|
680
|
-
if (match[0].length === 3) {
|
|
681
|
-
colorString = colorString.split("").map((char) => {
|
|
682
|
-
return char + char;
|
|
683
|
-
}).join("");
|
|
684
|
-
}
|
|
685
|
-
const integer = parseInt(colorString, 16);
|
|
686
|
-
const r = integer >> 16 & 255;
|
|
687
|
-
const g = integer >> 8 & 255;
|
|
688
|
-
const b = integer & 255;
|
|
689
|
-
return [r, g, b];
|
|
690
|
-
};
|
|
691
|
-
convert.rgb.hcg = function(rgb) {
|
|
692
|
-
const r = rgb[0] / 255;
|
|
693
|
-
const g = rgb[1] / 255;
|
|
694
|
-
const b = rgb[2] / 255;
|
|
695
|
-
const max = Math.max(Math.max(r, g), b);
|
|
696
|
-
const min = Math.min(Math.min(r, g), b);
|
|
697
|
-
const chroma = max - min;
|
|
698
|
-
let grayscale;
|
|
699
|
-
let hue;
|
|
700
|
-
if (chroma < 1) {
|
|
701
|
-
grayscale = min / (1 - chroma);
|
|
702
|
-
} else {
|
|
703
|
-
grayscale = 0;
|
|
704
|
-
}
|
|
705
|
-
if (chroma <= 0) {
|
|
706
|
-
hue = 0;
|
|
707
|
-
} else if (max === r) {
|
|
708
|
-
hue = (g - b) / chroma % 6;
|
|
709
|
-
} else if (max === g) {
|
|
710
|
-
hue = 2 + (b - r) / chroma;
|
|
711
|
-
} else {
|
|
712
|
-
hue = 4 + (r - g) / chroma;
|
|
713
|
-
}
|
|
714
|
-
hue /= 6;
|
|
715
|
-
hue %= 1;
|
|
716
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
|
717
|
-
};
|
|
718
|
-
convert.hsl.hcg = function(hsl) {
|
|
719
|
-
const s = hsl[1] / 100;
|
|
720
|
-
const l = hsl[2] / 100;
|
|
721
|
-
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
722
|
-
let f = 0;
|
|
723
|
-
if (c < 1) {
|
|
724
|
-
f = (l - 0.5 * c) / (1 - c);
|
|
725
|
-
}
|
|
726
|
-
return [hsl[0], c * 100, f * 100];
|
|
727
|
-
};
|
|
728
|
-
convert.hsv.hcg = function(hsv) {
|
|
729
|
-
const s = hsv[1] / 100;
|
|
730
|
-
const v = hsv[2] / 100;
|
|
731
|
-
const c = s * v;
|
|
732
|
-
let f = 0;
|
|
733
|
-
if (c < 1) {
|
|
734
|
-
f = (v - c) / (1 - c);
|
|
735
|
-
}
|
|
736
|
-
return [hsv[0], c * 100, f * 100];
|
|
737
|
-
};
|
|
738
|
-
convert.hcg.rgb = function(hcg) {
|
|
739
|
-
const h = hcg[0] / 360;
|
|
740
|
-
const c = hcg[1] / 100;
|
|
741
|
-
const g = hcg[2] / 100;
|
|
742
|
-
if (c === 0) {
|
|
743
|
-
return [g * 255, g * 255, g * 255];
|
|
744
|
-
}
|
|
745
|
-
const pure = [0, 0, 0];
|
|
746
|
-
const hi = h % 1 * 6;
|
|
747
|
-
const v = hi % 1;
|
|
748
|
-
const w = 1 - v;
|
|
749
|
-
let mg = 0;
|
|
750
|
-
switch (Math.floor(hi)) {
|
|
751
|
-
case 0:
|
|
752
|
-
pure[0] = 1;
|
|
753
|
-
pure[1] = v;
|
|
754
|
-
pure[2] = 0;
|
|
755
|
-
break;
|
|
756
|
-
case 1:
|
|
757
|
-
pure[0] = w;
|
|
758
|
-
pure[1] = 1;
|
|
759
|
-
pure[2] = 0;
|
|
760
|
-
break;
|
|
761
|
-
case 2:
|
|
762
|
-
pure[0] = 0;
|
|
763
|
-
pure[1] = 1;
|
|
764
|
-
pure[2] = v;
|
|
765
|
-
break;
|
|
766
|
-
case 3:
|
|
767
|
-
pure[0] = 0;
|
|
768
|
-
pure[1] = w;
|
|
769
|
-
pure[2] = 1;
|
|
770
|
-
break;
|
|
771
|
-
case 4:
|
|
772
|
-
pure[0] = v;
|
|
773
|
-
pure[1] = 0;
|
|
774
|
-
pure[2] = 1;
|
|
775
|
-
break;
|
|
776
|
-
default:
|
|
777
|
-
pure[0] = 1;
|
|
778
|
-
pure[1] = 0;
|
|
779
|
-
pure[2] = w;
|
|
780
|
-
}
|
|
781
|
-
mg = (1 - c) * g;
|
|
782
|
-
return [
|
|
783
|
-
(c * pure[0] + mg) * 255,
|
|
784
|
-
(c * pure[1] + mg) * 255,
|
|
785
|
-
(c * pure[2] + mg) * 255
|
|
786
|
-
];
|
|
787
|
-
};
|
|
788
|
-
convert.hcg.hsv = function(hcg) {
|
|
789
|
-
const c = hcg[1] / 100;
|
|
790
|
-
const g = hcg[2] / 100;
|
|
791
|
-
const v = c + g * (1 - c);
|
|
792
|
-
let f = 0;
|
|
793
|
-
if (v > 0) {
|
|
794
|
-
f = c / v;
|
|
795
|
-
}
|
|
796
|
-
return [hcg[0], f * 100, v * 100];
|
|
797
|
-
};
|
|
798
|
-
convert.hcg.hsl = function(hcg) {
|
|
799
|
-
const c = hcg[1] / 100;
|
|
800
|
-
const g = hcg[2] / 100;
|
|
801
|
-
const l = g * (1 - c) + 0.5 * c;
|
|
802
|
-
let s = 0;
|
|
803
|
-
if (l > 0 && l < 0.5) {
|
|
804
|
-
s = c / (2 * l);
|
|
805
|
-
} else if (l >= 0.5 && l < 1) {
|
|
806
|
-
s = c / (2 * (1 - l));
|
|
807
|
-
}
|
|
808
|
-
return [hcg[0], s * 100, l * 100];
|
|
809
|
-
};
|
|
810
|
-
convert.hcg.hwb = function(hcg) {
|
|
811
|
-
const c = hcg[1] / 100;
|
|
812
|
-
const g = hcg[2] / 100;
|
|
813
|
-
const v = c + g * (1 - c);
|
|
814
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
815
|
-
};
|
|
816
|
-
convert.hwb.hcg = function(hwb) {
|
|
817
|
-
const w = hwb[1] / 100;
|
|
818
|
-
const b = hwb[2] / 100;
|
|
819
|
-
const v = 1 - b;
|
|
820
|
-
const c = v - w;
|
|
821
|
-
let g = 0;
|
|
822
|
-
if (c < 1) {
|
|
823
|
-
g = (v - c) / (1 - c);
|
|
824
|
-
}
|
|
825
|
-
return [hwb[0], c * 100, g * 100];
|
|
826
|
-
};
|
|
827
|
-
convert.apple.rgb = function(apple) {
|
|
828
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
829
|
-
};
|
|
830
|
-
convert.rgb.apple = function(rgb) {
|
|
831
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
832
|
-
};
|
|
833
|
-
convert.gray.rgb = function(args) {
|
|
834
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
835
|
-
};
|
|
836
|
-
convert.gray.hsl = function(args) {
|
|
837
|
-
return [0, 0, args[0]];
|
|
838
|
-
};
|
|
839
|
-
convert.gray.hsv = convert.gray.hsl;
|
|
840
|
-
convert.gray.hwb = function(gray) {
|
|
841
|
-
return [0, 100, gray[0]];
|
|
842
|
-
};
|
|
843
|
-
convert.gray.cmyk = function(gray) {
|
|
844
|
-
return [0, 0, 0, gray[0]];
|
|
845
|
-
};
|
|
846
|
-
convert.gray.lab = function(gray) {
|
|
847
|
-
return [gray[0], 0, 0];
|
|
848
|
-
};
|
|
849
|
-
convert.gray.hex = function(gray) {
|
|
850
|
-
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
851
|
-
const integer = (val << 16) + (val << 8) + val;
|
|
852
|
-
const string = integer.toString(16).toUpperCase();
|
|
853
|
-
return "000000".substring(string.length) + string;
|
|
854
|
-
};
|
|
855
|
-
convert.rgb.gray = function(rgb) {
|
|
856
|
-
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
857
|
-
return [val / 255 * 100];
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
});
|
|
861
|
-
|
|
862
|
-
// ../../node_modules/color-convert/route.js
|
|
863
|
-
var require_route = __commonJS({
|
|
864
|
-
"../../node_modules/color-convert/route.js"(exports2, module2) {
|
|
865
|
-
"use strict";
|
|
866
|
-
var conversions = require_conversions();
|
|
867
|
-
function buildGraph() {
|
|
868
|
-
const graph = {};
|
|
869
|
-
const models = Object.keys(conversions);
|
|
870
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
871
|
-
graph[models[i]] = {
|
|
872
|
-
// http://jsperf.com/1-vs-infinity
|
|
873
|
-
// micro-opt, but this is simple.
|
|
874
|
-
distance: -1,
|
|
875
|
-
parent: null
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
return graph;
|
|
879
|
-
}
|
|
880
|
-
function deriveBFS(fromModel) {
|
|
881
|
-
const graph = buildGraph();
|
|
882
|
-
const queue = [fromModel];
|
|
883
|
-
graph[fromModel].distance = 0;
|
|
884
|
-
while (queue.length) {
|
|
885
|
-
const current = queue.pop();
|
|
886
|
-
const adjacents = Object.keys(conversions[current]);
|
|
887
|
-
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
888
|
-
const adjacent = adjacents[i];
|
|
889
|
-
const node = graph[adjacent];
|
|
890
|
-
if (node.distance === -1) {
|
|
891
|
-
node.distance = graph[current].distance + 1;
|
|
892
|
-
node.parent = current;
|
|
893
|
-
queue.unshift(adjacent);
|
|
894
|
-
}
|
|
212
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
213
|
+
if (value === 2) {
|
|
214
|
+
result += 60;
|
|
895
215
|
}
|
|
896
|
-
|
|
897
|
-
|
|
216
|
+
return result;
|
|
217
|
+
},
|
|
218
|
+
enumerable: false
|
|
219
|
+
},
|
|
220
|
+
rgbToAnsi: {
|
|
221
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
222
|
+
enumerable: false
|
|
223
|
+
},
|
|
224
|
+
hexToAnsi: {
|
|
225
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
226
|
+
enumerable: false
|
|
898
227
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
228
|
+
});
|
|
229
|
+
return styles;
|
|
230
|
+
}
|
|
231
|
+
var ansiStyles = assembleStyles();
|
|
232
|
+
var ansi_styles_default = ansiStyles;
|
|
233
|
+
|
|
234
|
+
// ../../node_modules/chalk/source/vendor/supports-color/index.js
|
|
235
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
236
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
237
|
+
var import_node_tty = __toESM(require("tty"), 1);
|
|
238
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
|
239
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
240
|
+
const position = argv.indexOf(prefix + flag);
|
|
241
|
+
const terminatorPosition = argv.indexOf("--");
|
|
242
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
243
|
+
}
|
|
244
|
+
var { env } = import_node_process.default;
|
|
245
|
+
var flagForceColor;
|
|
246
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
247
|
+
flagForceColor = 0;
|
|
248
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
249
|
+
flagForceColor = 1;
|
|
250
|
+
}
|
|
251
|
+
function envForceColor() {
|
|
252
|
+
if ("FORCE_COLOR" in env) {
|
|
253
|
+
if (env.FORCE_COLOR === "true") {
|
|
254
|
+
return 1;
|
|
903
255
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
let fn = conversions[graph[toModel].parent][toModel];
|
|
907
|
-
let cur = graph[toModel].parent;
|
|
908
|
-
while (graph[cur].parent) {
|
|
909
|
-
path.unshift(graph[cur].parent);
|
|
910
|
-
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
911
|
-
cur = graph[cur].parent;
|
|
912
|
-
}
|
|
913
|
-
fn.conversion = path;
|
|
914
|
-
return fn;
|
|
256
|
+
if (env.FORCE_COLOR === "false") {
|
|
257
|
+
return 0;
|
|
915
258
|
}
|
|
916
|
-
|
|
917
|
-
const graph = deriveBFS(fromModel);
|
|
918
|
-
const conversion = {};
|
|
919
|
-
const models = Object.keys(graph);
|
|
920
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
921
|
-
const toModel = models[i];
|
|
922
|
-
const node = graph[toModel];
|
|
923
|
-
if (node.parent === null) {
|
|
924
|
-
continue;
|
|
925
|
-
}
|
|
926
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
|
927
|
-
}
|
|
928
|
-
return conversion;
|
|
929
|
-
};
|
|
259
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
930
260
|
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
return wrappedFn;
|
|
261
|
+
}
|
|
262
|
+
function translateLevel(level) {
|
|
263
|
+
if (level === 0) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
level,
|
|
268
|
+
hasBasic: true,
|
|
269
|
+
has256: level >= 2,
|
|
270
|
+
has16m: level >= 3
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
274
|
+
const noFlagForceColor = envForceColor();
|
|
275
|
+
if (noFlagForceColor !== void 0) {
|
|
276
|
+
flagForceColor = noFlagForceColor;
|
|
277
|
+
}
|
|
278
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
279
|
+
if (forceColor === 0) {
|
|
280
|
+
return 0;
|
|
281
|
+
}
|
|
282
|
+
if (sniffFlags) {
|
|
283
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
284
|
+
return 3;
|
|
956
285
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
const arg0 = args[0];
|
|
960
|
-
if (arg0 === void 0 || arg0 === null) {
|
|
961
|
-
return arg0;
|
|
962
|
-
}
|
|
963
|
-
if (arg0.length > 1) {
|
|
964
|
-
args = arg0;
|
|
965
|
-
}
|
|
966
|
-
const result = fn(args);
|
|
967
|
-
if (typeof result === "object") {
|
|
968
|
-
for (let len = result.length, i = 0; i < len; i++) {
|
|
969
|
-
result[i] = Math.round(result[i]);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
return result;
|
|
973
|
-
};
|
|
974
|
-
if ("conversion" in fn) {
|
|
975
|
-
wrappedFn.conversion = fn.conversion;
|
|
976
|
-
}
|
|
977
|
-
return wrappedFn;
|
|
286
|
+
if (hasFlag("color=256")) {
|
|
287
|
+
return 2;
|
|
978
288
|
}
|
|
979
|
-
models.forEach((fromModel) => {
|
|
980
|
-
convert[fromModel] = {};
|
|
981
|
-
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
982
|
-
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
983
|
-
const routes = route(fromModel);
|
|
984
|
-
const routeModels = Object.keys(routes);
|
|
985
|
-
routeModels.forEach((toModel) => {
|
|
986
|
-
const fn = routes[toModel];
|
|
987
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
|
988
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
989
|
-
});
|
|
990
|
-
});
|
|
991
|
-
module2.exports = convert;
|
|
992
289
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
// ../../node_modules/ansi-styles/index.js
|
|
996
|
-
var require_ansi_styles = __commonJS({
|
|
997
|
-
"../../node_modules/ansi-styles/index.js"(exports2, module2) {
|
|
998
|
-
"use strict";
|
|
999
|
-
var wrapAnsi16 = (fn, offset) => (...args) => {
|
|
1000
|
-
const code = fn(...args);
|
|
1001
|
-
return `\x1B[${code + offset}m`;
|
|
1002
|
-
};
|
|
1003
|
-
var wrapAnsi256 = (fn, offset) => (...args) => {
|
|
1004
|
-
const code = fn(...args);
|
|
1005
|
-
return `\x1B[${38 + offset};5;${code}m`;
|
|
1006
|
-
};
|
|
1007
|
-
var wrapAnsi16m = (fn, offset) => (...args) => {
|
|
1008
|
-
const rgb = fn(...args);
|
|
1009
|
-
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
1010
|
-
};
|
|
1011
|
-
var ansi2ansi = (n) => n;
|
|
1012
|
-
var rgb2rgb = (r, g, b) => [r, g, b];
|
|
1013
|
-
var setLazyProperty = (object, property, get) => {
|
|
1014
|
-
Object.defineProperty(object, property, {
|
|
1015
|
-
get: () => {
|
|
1016
|
-
const value = get();
|
|
1017
|
-
Object.defineProperty(object, property, {
|
|
1018
|
-
value,
|
|
1019
|
-
enumerable: true,
|
|
1020
|
-
configurable: true
|
|
1021
|
-
});
|
|
1022
|
-
return value;
|
|
1023
|
-
},
|
|
1024
|
-
enumerable: true,
|
|
1025
|
-
configurable: true
|
|
1026
|
-
});
|
|
1027
|
-
};
|
|
1028
|
-
var colorConvert;
|
|
1029
|
-
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
1030
|
-
if (colorConvert === void 0) {
|
|
1031
|
-
colorConvert = require_color_convert();
|
|
1032
|
-
}
|
|
1033
|
-
const offset = isBackground ? 10 : 0;
|
|
1034
|
-
const styles = {};
|
|
1035
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
1036
|
-
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1037
|
-
if (sourceSpace === targetSpace) {
|
|
1038
|
-
styles[name] = wrap(identity, offset);
|
|
1039
|
-
} else if (typeof suite === "object") {
|
|
1040
|
-
styles[name] = wrap(suite[targetSpace], offset);
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
return styles;
|
|
1044
|
-
};
|
|
1045
|
-
function assembleStyles() {
|
|
1046
|
-
const codes = /* @__PURE__ */ new Map();
|
|
1047
|
-
const styles = {
|
|
1048
|
-
modifier: {
|
|
1049
|
-
reset: [0, 0],
|
|
1050
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
1051
|
-
bold: [1, 22],
|
|
1052
|
-
dim: [2, 22],
|
|
1053
|
-
italic: [3, 23],
|
|
1054
|
-
underline: [4, 24],
|
|
1055
|
-
inverse: [7, 27],
|
|
1056
|
-
hidden: [8, 28],
|
|
1057
|
-
strikethrough: [9, 29]
|
|
1058
|
-
},
|
|
1059
|
-
color: {
|
|
1060
|
-
black: [30, 39],
|
|
1061
|
-
red: [31, 39],
|
|
1062
|
-
green: [32, 39],
|
|
1063
|
-
yellow: [33, 39],
|
|
1064
|
-
blue: [34, 39],
|
|
1065
|
-
magenta: [35, 39],
|
|
1066
|
-
cyan: [36, 39],
|
|
1067
|
-
white: [37, 39],
|
|
1068
|
-
// Bright color
|
|
1069
|
-
blackBright: [90, 39],
|
|
1070
|
-
redBright: [91, 39],
|
|
1071
|
-
greenBright: [92, 39],
|
|
1072
|
-
yellowBright: [93, 39],
|
|
1073
|
-
blueBright: [94, 39],
|
|
1074
|
-
magentaBright: [95, 39],
|
|
1075
|
-
cyanBright: [96, 39],
|
|
1076
|
-
whiteBright: [97, 39]
|
|
1077
|
-
},
|
|
1078
|
-
bgColor: {
|
|
1079
|
-
bgBlack: [40, 49],
|
|
1080
|
-
bgRed: [41, 49],
|
|
1081
|
-
bgGreen: [42, 49],
|
|
1082
|
-
bgYellow: [43, 49],
|
|
1083
|
-
bgBlue: [44, 49],
|
|
1084
|
-
bgMagenta: [45, 49],
|
|
1085
|
-
bgCyan: [46, 49],
|
|
1086
|
-
bgWhite: [47, 49],
|
|
1087
|
-
// Bright color
|
|
1088
|
-
bgBlackBright: [100, 49],
|
|
1089
|
-
bgRedBright: [101, 49],
|
|
1090
|
-
bgGreenBright: [102, 49],
|
|
1091
|
-
bgYellowBright: [103, 49],
|
|
1092
|
-
bgBlueBright: [104, 49],
|
|
1093
|
-
bgMagentaBright: [105, 49],
|
|
1094
|
-
bgCyanBright: [106, 49],
|
|
1095
|
-
bgWhiteBright: [107, 49]
|
|
1096
|
-
}
|
|
1097
|
-
};
|
|
1098
|
-
styles.color.gray = styles.color.blackBright;
|
|
1099
|
-
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
1100
|
-
styles.color.grey = styles.color.blackBright;
|
|
1101
|
-
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
1102
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
1103
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
1104
|
-
styles[styleName] = {
|
|
1105
|
-
open: `\x1B[${style[0]}m`,
|
|
1106
|
-
close: `\x1B[${style[1]}m`
|
|
1107
|
-
};
|
|
1108
|
-
group[styleName] = styles[styleName];
|
|
1109
|
-
codes.set(style[0], style[1]);
|
|
1110
|
-
}
|
|
1111
|
-
Object.defineProperty(styles, groupName, {
|
|
1112
|
-
value: group,
|
|
1113
|
-
enumerable: false
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
Object.defineProperty(styles, "codes", {
|
|
1117
|
-
value: codes,
|
|
1118
|
-
enumerable: false
|
|
1119
|
-
});
|
|
1120
|
-
styles.color.close = "\x1B[39m";
|
|
1121
|
-
styles.bgColor.close = "\x1B[49m";
|
|
1122
|
-
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
1123
|
-
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
1124
|
-
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
1125
|
-
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
1126
|
-
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
1127
|
-
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
1128
|
-
return styles;
|
|
1129
|
-
}
|
|
1130
|
-
Object.defineProperty(module2, "exports", {
|
|
1131
|
-
enumerable: true,
|
|
1132
|
-
get: assembleStyles
|
|
1133
|
-
});
|
|
290
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
291
|
+
return 1;
|
|
1134
292
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
// ../../node_modules/has-flag/index.js
|
|
1138
|
-
var require_has_flag = __commonJS({
|
|
1139
|
-
"../../node_modules/has-flag/index.js"(exports2, module2) {
|
|
1140
|
-
"use strict";
|
|
1141
|
-
module2.exports = (flag, argv = process.argv) => {
|
|
1142
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
1143
|
-
const position = argv.indexOf(prefix + flag);
|
|
1144
|
-
const terminatorPosition = argv.indexOf("--");
|
|
1145
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
1146
|
-
};
|
|
293
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
294
|
+
return 0;
|
|
1147
295
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
var hasFlag = require_has_flag();
|
|
1157
|
-
var { env } = process;
|
|
1158
|
-
var forceColor;
|
|
1159
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
1160
|
-
forceColor = 0;
|
|
1161
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
1162
|
-
forceColor = 1;
|
|
296
|
+
const min = forceColor || 0;
|
|
297
|
+
if (env.TERM === "dumb") {
|
|
298
|
+
return min;
|
|
299
|
+
}
|
|
300
|
+
if (import_node_process.default.platform === "win32") {
|
|
301
|
+
const osRelease = import_node_os.default.release().split(".");
|
|
302
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
303
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1163
304
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
} else {
|
|
1170
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
1171
|
-
}
|
|
305
|
+
return 1;
|
|
306
|
+
}
|
|
307
|
+
if ("CI" in env) {
|
|
308
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
309
|
+
return 3;
|
|
1172
310
|
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
return false;
|
|
1176
|
-
}
|
|
1177
|
-
return {
|
|
1178
|
-
level,
|
|
1179
|
-
hasBasic: true,
|
|
1180
|
-
has256: level >= 2,
|
|
1181
|
-
has16m: level >= 3
|
|
1182
|
-
};
|
|
311
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
312
|
+
return 1;
|
|
1183
313
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
return
|
|
1200
|
-
}
|
|
1201
|
-
if (process.platform === "win32") {
|
|
1202
|
-
const osRelease = os.release().split(".");
|
|
1203
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
1204
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1205
|
-
}
|
|
1206
|
-
return 1;
|
|
1207
|
-
}
|
|
1208
|
-
if ("CI" in env) {
|
|
1209
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
1210
|
-
return 1;
|
|
1211
|
-
}
|
|
1212
|
-
return min;
|
|
1213
|
-
}
|
|
1214
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
1215
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1216
|
-
}
|
|
1217
|
-
if (env.COLORTERM === "truecolor") {
|
|
1218
|
-
return 3;
|
|
1219
|
-
}
|
|
1220
|
-
if ("TERM_PROGRAM" in env) {
|
|
1221
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1222
|
-
switch (env.TERM_PROGRAM) {
|
|
1223
|
-
case "iTerm.app":
|
|
1224
|
-
return version >= 3 ? 3 : 2;
|
|
1225
|
-
case "Apple_Terminal":
|
|
1226
|
-
return 2;
|
|
1227
|
-
}
|
|
314
|
+
return min;
|
|
315
|
+
}
|
|
316
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
317
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
318
|
+
}
|
|
319
|
+
if (env.COLORTERM === "truecolor") {
|
|
320
|
+
return 3;
|
|
321
|
+
}
|
|
322
|
+
if (env.TERM === "xterm-kitty") {
|
|
323
|
+
return 3;
|
|
324
|
+
}
|
|
325
|
+
if ("TERM_PROGRAM" in env) {
|
|
326
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
327
|
+
switch (env.TERM_PROGRAM) {
|
|
328
|
+
case "iTerm.app": {
|
|
329
|
+
return version >= 3 ? 3 : 2;
|
|
1228
330
|
}
|
|
1229
|
-
|
|
331
|
+
case "Apple_Terminal": {
|
|
1230
332
|
return 2;
|
|
1231
333
|
}
|
|
1232
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
1233
|
-
return 1;
|
|
1234
|
-
}
|
|
1235
|
-
if ("COLORTERM" in env) {
|
|
1236
|
-
return 1;
|
|
1237
|
-
}
|
|
1238
|
-
return min;
|
|
1239
|
-
}
|
|
1240
|
-
function getSupportLevel(stream) {
|
|
1241
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
1242
|
-
return translateLevel(level);
|
|
1243
334
|
}
|
|
1244
|
-
module2.exports = {
|
|
1245
|
-
supportsColor: getSupportLevel,
|
|
1246
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
1247
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
1248
|
-
};
|
|
1249
335
|
}
|
|
1250
|
-
|
|
336
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
337
|
+
return 2;
|
|
338
|
+
}
|
|
339
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
340
|
+
return 1;
|
|
341
|
+
}
|
|
342
|
+
if ("COLORTERM" in env) {
|
|
343
|
+
return 1;
|
|
344
|
+
}
|
|
345
|
+
return min;
|
|
346
|
+
}
|
|
347
|
+
function createSupportsColor(stream, options = {}) {
|
|
348
|
+
const level = _supportsColor(stream, {
|
|
349
|
+
streamIsTTY: stream && stream.isTTY,
|
|
350
|
+
...options
|
|
351
|
+
});
|
|
352
|
+
return translateLevel(level);
|
|
353
|
+
}
|
|
354
|
+
var supportsColor = {
|
|
355
|
+
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
|
|
356
|
+
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
|
|
357
|
+
};
|
|
358
|
+
var supports_color_default = supportsColor;
|
|
1251
359
|
|
|
1252
|
-
// ../../node_modules/chalk/source/
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
let index = string.indexOf(substring);
|
|
1258
|
-
if (index === -1) {
|
|
1259
|
-
return string;
|
|
1260
|
-
}
|
|
1261
|
-
const substringLength = substring.length;
|
|
1262
|
-
let endIndex = 0;
|
|
1263
|
-
let returnValue = "";
|
|
1264
|
-
do {
|
|
1265
|
-
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
1266
|
-
endIndex = index + substringLength;
|
|
1267
|
-
index = string.indexOf(substring, endIndex);
|
|
1268
|
-
} while (index !== -1);
|
|
1269
|
-
returnValue += string.substr(endIndex);
|
|
1270
|
-
return returnValue;
|
|
1271
|
-
};
|
|
1272
|
-
var stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
|
1273
|
-
let endIndex = 0;
|
|
1274
|
-
let returnValue = "";
|
|
1275
|
-
do {
|
|
1276
|
-
const gotCR = string[index - 1] === "\r";
|
|
1277
|
-
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1278
|
-
endIndex = index + 1;
|
|
1279
|
-
index = string.indexOf("\n", endIndex);
|
|
1280
|
-
} while (index !== -1);
|
|
1281
|
-
returnValue += string.substr(endIndex);
|
|
1282
|
-
return returnValue;
|
|
1283
|
-
};
|
|
1284
|
-
module2.exports = {
|
|
1285
|
-
stringReplaceAll,
|
|
1286
|
-
stringEncaseCRLFWithFirstIndex
|
|
1287
|
-
};
|
|
360
|
+
// ../../node_modules/chalk/source/utilities.js
|
|
361
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
362
|
+
let index = string.indexOf(substring);
|
|
363
|
+
if (index === -1) {
|
|
364
|
+
return string;
|
|
1288
365
|
}
|
|
1289
|
-
|
|
366
|
+
const substringLength = substring.length;
|
|
367
|
+
let endIndex = 0;
|
|
368
|
+
let returnValue = "";
|
|
369
|
+
do {
|
|
370
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
371
|
+
endIndex = index + substringLength;
|
|
372
|
+
index = string.indexOf(substring, endIndex);
|
|
373
|
+
} while (index !== -1);
|
|
374
|
+
returnValue += string.slice(endIndex);
|
|
375
|
+
return returnValue;
|
|
376
|
+
}
|
|
377
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
378
|
+
let endIndex = 0;
|
|
379
|
+
let returnValue = "";
|
|
380
|
+
do {
|
|
381
|
+
const gotCR = string[index - 1] === "\r";
|
|
382
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
383
|
+
endIndex = index + 1;
|
|
384
|
+
index = string.indexOf("\n", endIndex);
|
|
385
|
+
} while (index !== -1);
|
|
386
|
+
returnValue += string.slice(endIndex);
|
|
387
|
+
return returnValue;
|
|
388
|
+
}
|
|
1290
389
|
|
|
1291
|
-
// ../../node_modules/chalk/source/
|
|
1292
|
-
var
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
for (const chunk of chunks) {
|
|
1327
|
-
const number = Number(chunk);
|
|
1328
|
-
if (!Number.isNaN(number)) {
|
|
1329
|
-
results.push(number);
|
|
1330
|
-
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1331
|
-
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
1332
|
-
} else {
|
|
1333
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
return results;
|
|
390
|
+
// ../../node_modules/chalk/source/index.js
|
|
391
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
392
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
393
|
+
var STYLER = Symbol("STYLER");
|
|
394
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
395
|
+
var levelMapping = [
|
|
396
|
+
"ansi",
|
|
397
|
+
"ansi",
|
|
398
|
+
"ansi256",
|
|
399
|
+
"ansi16m"
|
|
400
|
+
];
|
|
401
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
402
|
+
var applyOptions = (object, options = {}) => {
|
|
403
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
404
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
405
|
+
}
|
|
406
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
407
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
408
|
+
};
|
|
409
|
+
var chalkFactory = (options) => {
|
|
410
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
411
|
+
applyOptions(chalk2, options);
|
|
412
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
413
|
+
return chalk2;
|
|
414
|
+
};
|
|
415
|
+
function createChalk(options) {
|
|
416
|
+
return chalkFactory(options);
|
|
417
|
+
}
|
|
418
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
419
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
420
|
+
styles2[styleName] = {
|
|
421
|
+
get() {
|
|
422
|
+
const builder2 = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
423
|
+
Object.defineProperty(this, styleName, { value: builder2 });
|
|
424
|
+
return builder2;
|
|
1337
425
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
return results;
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
styles2.visible = {
|
|
429
|
+
get() {
|
|
430
|
+
const builder2 = createBuilder(this, this[STYLER], true);
|
|
431
|
+
Object.defineProperty(this, "visible", { value: builder2 });
|
|
432
|
+
return builder2;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
436
|
+
if (model === "rgb") {
|
|
437
|
+
if (level === "ansi16m") {
|
|
438
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
1352
439
|
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
for (const layer of styles) {
|
|
1356
|
-
for (const style of layer.styles) {
|
|
1357
|
-
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
let current = chalk2;
|
|
1361
|
-
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
1362
|
-
if (!Array.isArray(styles2)) {
|
|
1363
|
-
continue;
|
|
1364
|
-
}
|
|
1365
|
-
if (!(styleName in current)) {
|
|
1366
|
-
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
1367
|
-
}
|
|
1368
|
-
current = styles2.length > 0 ? current[styleName](...styles2) : current[styleName];
|
|
1369
|
-
}
|
|
1370
|
-
return current;
|
|
440
|
+
if (level === "ansi256") {
|
|
441
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
1371
442
|
}
|
|
1372
|
-
|
|
1373
|
-
const styles = [];
|
|
1374
|
-
const chunks = [];
|
|
1375
|
-
let chunk = [];
|
|
1376
|
-
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
1377
|
-
if (escapeCharacter) {
|
|
1378
|
-
chunk.push(unescape(escapeCharacter));
|
|
1379
|
-
} else if (style) {
|
|
1380
|
-
const string = chunk.join("");
|
|
1381
|
-
chunk = [];
|
|
1382
|
-
chunks.push(styles.length === 0 ? string : buildStyle(chalk2, styles)(string));
|
|
1383
|
-
styles.push({ inverse, styles: parseStyle(style) });
|
|
1384
|
-
} else if (close) {
|
|
1385
|
-
if (styles.length === 0) {
|
|
1386
|
-
throw new Error("Found extraneous } in Chalk template literal");
|
|
1387
|
-
}
|
|
1388
|
-
chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
|
|
1389
|
-
chunk = [];
|
|
1390
|
-
styles.pop();
|
|
1391
|
-
} else {
|
|
1392
|
-
chunk.push(character);
|
|
1393
|
-
}
|
|
1394
|
-
});
|
|
1395
|
-
chunks.push(chunk.join(""));
|
|
1396
|
-
if (styles.length > 0) {
|
|
1397
|
-
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
|
1398
|
-
throw new Error(errMessage);
|
|
1399
|
-
}
|
|
1400
|
-
return chunks.join("");
|
|
1401
|
-
};
|
|
443
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
1402
444
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
var levelMapping = [
|
|
1417
|
-
"ansi",
|
|
1418
|
-
"ansi",
|
|
1419
|
-
"ansi256",
|
|
1420
|
-
"ansi16m"
|
|
1421
|
-
];
|
|
1422
|
-
var styles = /* @__PURE__ */ Object.create(null);
|
|
1423
|
-
var applyOptions = (object, options = {}) => {
|
|
1424
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
1425
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
1426
|
-
}
|
|
1427
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
1428
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
1429
|
-
};
|
|
1430
|
-
var ChalkClass = class {
|
|
1431
|
-
constructor(options) {
|
|
1432
|
-
return chalkFactory(options);
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
var chalkFactory = (options) => {
|
|
1436
|
-
const chalk3 = {};
|
|
1437
|
-
applyOptions(chalk3, options);
|
|
1438
|
-
chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
|
|
1439
|
-
Object.setPrototypeOf(chalk3, Chalk.prototype);
|
|
1440
|
-
Object.setPrototypeOf(chalk3.template, chalk3);
|
|
1441
|
-
chalk3.template.constructor = () => {
|
|
1442
|
-
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
1443
|
-
};
|
|
1444
|
-
chalk3.template.Instance = ChalkClass;
|
|
1445
|
-
return chalk3.template;
|
|
1446
|
-
};
|
|
1447
|
-
function Chalk(options) {
|
|
1448
|
-
return chalkFactory(options);
|
|
1449
|
-
}
|
|
1450
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
1451
|
-
styles[styleName] = {
|
|
1452
|
-
get() {
|
|
1453
|
-
const builder2 = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
1454
|
-
Object.defineProperty(this, styleName, { value: builder2 });
|
|
1455
|
-
return builder2;
|
|
1456
|
-
}
|
|
445
|
+
if (model === "hex") {
|
|
446
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
447
|
+
}
|
|
448
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
449
|
+
};
|
|
450
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
451
|
+
for (const model of usedModels) {
|
|
452
|
+
styles2[model] = {
|
|
453
|
+
get() {
|
|
454
|
+
const { level } = this;
|
|
455
|
+
return function(...arguments_) {
|
|
456
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
457
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
1457
458
|
};
|
|
1458
459
|
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
for (const model of usedModels) {
|
|
1468
|
-
styles[model] = {
|
|
1469
|
-
get() {
|
|
1470
|
-
const { level } = this;
|
|
1471
|
-
return function(...arguments_) {
|
|
1472
|
-
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
1473
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
460
|
+
};
|
|
461
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
462
|
+
styles2[bgModel] = {
|
|
463
|
+
get() {
|
|
464
|
+
const { level } = this;
|
|
465
|
+
return function(...arguments_) {
|
|
466
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
467
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
1476
468
|
};
|
|
1477
469
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
var proto = Object.defineProperties(() => {
|
|
473
|
+
}, {
|
|
474
|
+
...styles2,
|
|
475
|
+
level: {
|
|
476
|
+
enumerable: true,
|
|
477
|
+
get() {
|
|
478
|
+
return this[GENERATOR].level;
|
|
479
|
+
},
|
|
480
|
+
set(level) {
|
|
481
|
+
this[GENERATOR].level = level;
|
|
1489
482
|
}
|
|
1490
|
-
var proto = Object.defineProperties(() => {
|
|
1491
|
-
}, {
|
|
1492
|
-
...styles,
|
|
1493
|
-
level: {
|
|
1494
|
-
enumerable: true,
|
|
1495
|
-
get() {
|
|
1496
|
-
return this._generator.level;
|
|
1497
|
-
},
|
|
1498
|
-
set(level) {
|
|
1499
|
-
this._generator.level = level;
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
});
|
|
1503
|
-
var createStyler = (open, close, parent) => {
|
|
1504
|
-
let openAll;
|
|
1505
|
-
let closeAll;
|
|
1506
|
-
if (parent === void 0) {
|
|
1507
|
-
openAll = open;
|
|
1508
|
-
closeAll = close;
|
|
1509
|
-
} else {
|
|
1510
|
-
openAll = parent.openAll + open;
|
|
1511
|
-
closeAll = close + parent.closeAll;
|
|
1512
|
-
}
|
|
1513
|
-
return {
|
|
1514
|
-
open,
|
|
1515
|
-
close,
|
|
1516
|
-
openAll,
|
|
1517
|
-
closeAll,
|
|
1518
|
-
parent
|
|
1519
|
-
};
|
|
1520
|
-
};
|
|
1521
|
-
var createBuilder = (self, _styler, _isEmpty) => {
|
|
1522
|
-
const builder2 = (...arguments_) => {
|
|
1523
|
-
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
1524
|
-
return applyStyle(builder2, chalkTag(builder2, ...arguments_));
|
|
1525
|
-
}
|
|
1526
|
-
return applyStyle(builder2, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1527
|
-
};
|
|
1528
|
-
Object.setPrototypeOf(builder2, proto);
|
|
1529
|
-
builder2._generator = self;
|
|
1530
|
-
builder2._styler = _styler;
|
|
1531
|
-
builder2._isEmpty = _isEmpty;
|
|
1532
|
-
return builder2;
|
|
1533
|
-
};
|
|
1534
|
-
var applyStyle = (self, string) => {
|
|
1535
|
-
if (self.level <= 0 || !string) {
|
|
1536
|
-
return self._isEmpty ? "" : string;
|
|
1537
|
-
}
|
|
1538
|
-
let styler = self._styler;
|
|
1539
|
-
if (styler === void 0) {
|
|
1540
|
-
return string;
|
|
1541
|
-
}
|
|
1542
|
-
const { openAll, closeAll } = styler;
|
|
1543
|
-
if (string.indexOf("\x1B") !== -1) {
|
|
1544
|
-
while (styler !== void 0) {
|
|
1545
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
1546
|
-
styler = styler.parent;
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
const lfIndex = string.indexOf("\n");
|
|
1550
|
-
if (lfIndex !== -1) {
|
|
1551
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
1552
|
-
}
|
|
1553
|
-
return openAll + string + closeAll;
|
|
1554
|
-
};
|
|
1555
|
-
var template;
|
|
1556
|
-
var chalkTag = (chalk3, ...strings) => {
|
|
1557
|
-
const [firstString] = strings;
|
|
1558
|
-
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
1559
|
-
return strings.join(" ");
|
|
1560
|
-
}
|
|
1561
|
-
const arguments_ = strings.slice(1);
|
|
1562
|
-
const parts = [firstString.raw[0]];
|
|
1563
|
-
for (let i = 1; i < firstString.length; i++) {
|
|
1564
|
-
parts.push(
|
|
1565
|
-
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
1566
|
-
String(firstString.raw[i])
|
|
1567
|
-
);
|
|
1568
|
-
}
|
|
1569
|
-
if (template === void 0) {
|
|
1570
|
-
template = require_templates();
|
|
1571
|
-
}
|
|
1572
|
-
return template(chalk3, parts.join(""));
|
|
1573
|
-
};
|
|
1574
|
-
Object.defineProperties(Chalk.prototype, styles);
|
|
1575
|
-
var chalk2 = Chalk();
|
|
1576
|
-
chalk2.supportsColor = stdoutColor;
|
|
1577
|
-
chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1578
|
-
chalk2.stderr.supportsColor = stderrColor;
|
|
1579
|
-
module2.exports = chalk2;
|
|
1580
483
|
}
|
|
1581
484
|
});
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
485
|
+
var createStyler = (open, close, parent) => {
|
|
486
|
+
let openAll;
|
|
487
|
+
let closeAll;
|
|
488
|
+
if (parent === void 0) {
|
|
489
|
+
openAll = open;
|
|
490
|
+
closeAll = close;
|
|
491
|
+
} else {
|
|
492
|
+
openAll = parent.openAll + open;
|
|
493
|
+
closeAll = close + parent.closeAll;
|
|
494
|
+
}
|
|
495
|
+
return {
|
|
496
|
+
open,
|
|
497
|
+
close,
|
|
498
|
+
openAll,
|
|
499
|
+
closeAll,
|
|
500
|
+
parent
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
504
|
+
const builder2 = (...arguments_) => applyStyle(builder2, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
505
|
+
Object.setPrototypeOf(builder2, proto);
|
|
506
|
+
builder2[GENERATOR] = self;
|
|
507
|
+
builder2[STYLER] = _styler;
|
|
508
|
+
builder2[IS_EMPTY] = _isEmpty;
|
|
509
|
+
return builder2;
|
|
510
|
+
};
|
|
511
|
+
var applyStyle = (self, string) => {
|
|
512
|
+
if (self.level <= 0 || !string) {
|
|
513
|
+
return self[IS_EMPTY] ? "" : string;
|
|
514
|
+
}
|
|
515
|
+
let styler = self[STYLER];
|
|
516
|
+
if (styler === void 0) {
|
|
517
|
+
return string;
|
|
518
|
+
}
|
|
519
|
+
const { openAll, closeAll } = styler;
|
|
520
|
+
if (string.includes("\x1B")) {
|
|
521
|
+
while (styler !== void 0) {
|
|
522
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
523
|
+
styler = styler.parent;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const lfIndex = string.indexOf("\n");
|
|
527
|
+
if (lfIndex !== -1) {
|
|
528
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
529
|
+
}
|
|
530
|
+
return openAll + string + closeAll;
|
|
531
|
+
};
|
|
532
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
533
|
+
var chalk = createChalk();
|
|
534
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
535
|
+
var source_default = chalk;
|
|
1597
536
|
|
|
1598
537
|
// src/utils.ts
|
|
1599
|
-
var import_core = require("@orval/core");
|
|
1600
|
-
var import_chalk = __toESM(require_source());
|
|
1601
538
|
var normalizeQueryOptions = (queryOptions = {}, outputWorkspace) => {
|
|
1602
539
|
return {
|
|
1603
540
|
...queryOptions.usePrefetch ? { usePrefetch: true } : {},
|
|
@@ -1628,7 +565,7 @@ var normalizeMutator = (workspace, mutator) => {
|
|
|
1628
565
|
var _a;
|
|
1629
566
|
if ((0, import_core.isObject)(mutator)) {
|
|
1630
567
|
if (!mutator.path) {
|
|
1631
|
-
(0, import_core.createLogger)().error(
|
|
568
|
+
(0, import_core.createLogger)().error(source_default.red(`Mutator need a path`));
|
|
1632
569
|
process.exit(1);
|
|
1633
570
|
}
|
|
1634
571
|
return {
|
|
@@ -1715,7 +652,8 @@ var SVELTE_QUERY_DEPENDENCIES_V3 = [
|
|
|
1715
652
|
{ name: "MutationFunction" },
|
|
1716
653
|
{ name: "UseQueryStoreResult" },
|
|
1717
654
|
{ name: "UseInfiniteQueryStoreResult" },
|
|
1718
|
-
{ name: "QueryKey" }
|
|
655
|
+
{ name: "QueryKey" },
|
|
656
|
+
{ name: "CreateMutationResult" }
|
|
1719
657
|
],
|
|
1720
658
|
dependency: "@sveltestack/svelte-query"
|
|
1721
659
|
}
|
|
@@ -1736,7 +674,8 @@ var SVELTE_QUERY_DEPENDENCIES = [
|
|
|
1736
674
|
{ name: "CreateQueryResult" },
|
|
1737
675
|
{ name: "CreateInfiniteQueryResult" },
|
|
1738
676
|
{ name: "QueryKey" },
|
|
1739
|
-
{ name: "InfiniteData" }
|
|
677
|
+
{ name: "InfiniteData" },
|
|
678
|
+
{ name: "CreateMutationResult" }
|
|
1740
679
|
],
|
|
1741
680
|
dependency: "@tanstack/svelte-query"
|
|
1742
681
|
}
|
|
@@ -1769,7 +708,8 @@ var REACT_QUERY_DEPENDENCIES_V3 = [
|
|
|
1769
708
|
{ name: "UseQueryResult" },
|
|
1770
709
|
{ name: "UseInfiniteQueryResult" },
|
|
1771
710
|
{ name: "QueryKey" },
|
|
1772
|
-
{ name: "QueryClient" }
|
|
711
|
+
{ name: "QueryClient" },
|
|
712
|
+
{ name: "UseMutationResult" }
|
|
1773
713
|
],
|
|
1774
714
|
dependency: "react-query"
|
|
1775
715
|
}
|
|
@@ -1795,7 +735,8 @@ var REACT_QUERY_DEPENDENCIES = [
|
|
|
1795
735
|
{ name: "UseSuspenseInfiniteQueryResult" },
|
|
1796
736
|
{ name: "QueryKey" },
|
|
1797
737
|
{ name: "QueryClient" },
|
|
1798
|
-
{ name: "InfiniteData" }
|
|
738
|
+
{ name: "InfiniteData" },
|
|
739
|
+
{ name: "UseMutationResult" }
|
|
1799
740
|
],
|
|
1800
741
|
dependency: "@tanstack/react-query"
|
|
1801
742
|
}
|
|
@@ -1828,7 +769,8 @@ var VUE_QUERY_DEPENDENCIES_V3 = [
|
|
|
1828
769
|
{ name: "MutationFunction" },
|
|
1829
770
|
{ name: "UseQueryResult" },
|
|
1830
771
|
{ name: "UseInfiniteQueryResult" },
|
|
1831
|
-
{ name: "QueryKey" }
|
|
772
|
+
{ name: "QueryKey" },
|
|
773
|
+
{ name: "UseMutationReturnType" }
|
|
1832
774
|
],
|
|
1833
775
|
dependency: "vue-query/types"
|
|
1834
776
|
},
|
|
@@ -1858,7 +800,8 @@ var VUE_QUERY_DEPENDENCIES = [
|
|
|
1858
800
|
{ name: "QueryKey" },
|
|
1859
801
|
{ name: "UseQueryReturnType" },
|
|
1860
802
|
{ name: "UseInfiniteQueryReturnType" },
|
|
1861
|
-
{ name: "InfiniteData" }
|
|
803
|
+
{ name: "InfiniteData" },
|
|
804
|
+
{ name: "UseMutationReturnType" }
|
|
1862
805
|
],
|
|
1863
806
|
dependency: "@tanstack/vue-query"
|
|
1864
807
|
},
|
|
@@ -2162,6 +1105,37 @@ var generateQueryReturnType = ({
|
|
|
2162
1105
|
}
|
|
2163
1106
|
}
|
|
2164
1107
|
};
|
|
1108
|
+
var generateMutatorReturnType = ({
|
|
1109
|
+
outputClient,
|
|
1110
|
+
dataType,
|
|
1111
|
+
variableType
|
|
1112
|
+
}) => {
|
|
1113
|
+
if (outputClient === import_core2.OutputClient.REACT_QUERY) {
|
|
1114
|
+
return `: UseMutationResult<
|
|
1115
|
+
Awaited<ReturnType<${dataType}>>,
|
|
1116
|
+
TError,
|
|
1117
|
+
${variableType},
|
|
1118
|
+
TContext
|
|
1119
|
+
>`;
|
|
1120
|
+
}
|
|
1121
|
+
if (outputClient === import_core2.OutputClient.SVELTE_QUERY) {
|
|
1122
|
+
return `: CreateMutationResult<
|
|
1123
|
+
Awaited<ReturnType<${dataType}>>,
|
|
1124
|
+
TError,
|
|
1125
|
+
${variableType},
|
|
1126
|
+
TContext
|
|
1127
|
+
>`;
|
|
1128
|
+
}
|
|
1129
|
+
if (outputClient === import_core2.OutputClient.VUE_QUERY) {
|
|
1130
|
+
return `: UseMutationReturnType<
|
|
1131
|
+
Awaited<ReturnType<${dataType}>>,
|
|
1132
|
+
TError,
|
|
1133
|
+
${variableType},
|
|
1134
|
+
TContext
|
|
1135
|
+
>`;
|
|
1136
|
+
}
|
|
1137
|
+
return "";
|
|
1138
|
+
};
|
|
2165
1139
|
var getQueryOptions = ({
|
|
2166
1140
|
isRequestOptions,
|
|
2167
1141
|
mutator,
|
|
@@ -2354,12 +1328,12 @@ ${doc}export const ${(0, import_core2.camel)(
|
|
|
2354
1328
|
`${operationPrefix}-${type}`
|
|
2355
1329
|
)}(${queryOptionsVarName}) as ${returnType};
|
|
2356
1330
|
|
|
2357
|
-
${queryResultVarName}.queryKey = ${queryOptionsVarName}.queryKey ${isVue(outputClient) ? "as QueryKey" : ""};
|
|
1331
|
+
${queryResultVarName}.queryKey = ${isVue(outputClient) ? `unref(${queryOptionsVarName})` : queryOptionsVarName}.queryKey ${isVue(outputClient) ? "as QueryKey" : ""};
|
|
2358
1332
|
|
|
2359
1333
|
return ${queryResultVarName};
|
|
2360
1334
|
}
|
|
2361
1335
|
|
|
2362
|
-
${usePrefetch ? `${doc}export const ${(0, import_core2.camel)(
|
|
1336
|
+
${usePrefetch && (type === QueryType.QUERY || type === QueryType.INFINITE) ? `${doc}export const ${(0, import_core2.camel)(
|
|
2363
1337
|
`prefetch-${name}`
|
|
2364
1338
|
)} = async <TData = Awaited<ReturnType<${dataType}>>, TError = ${errorType}>(
|
|
2365
1339
|
queryClient: QueryClient, ${queryProps} ${queryArguments}
|
|
@@ -2406,7 +1380,19 @@ var generateQueryHook = async ({
|
|
|
2406
1380
|
const doc = (0, import_core2.jsDoc)({ summary, deprecated });
|
|
2407
1381
|
let implementation = "";
|
|
2408
1382
|
let mutators = void 0;
|
|
2409
|
-
|
|
1383
|
+
let isQuery = import_core2.Verbs.GET === verb && (override.query.useQuery || override.query.useSuspenseQuery || override.query.useInfinite || override.query.useSuspenseInfiniteQuery);
|
|
1384
|
+
if ((operationQueryOptions == null ? void 0 : operationQueryOptions.useInfinite) !== void 0) {
|
|
1385
|
+
isQuery = operationQueryOptions.useInfinite;
|
|
1386
|
+
}
|
|
1387
|
+
if ((operationQueryOptions == null ? void 0 : operationQueryOptions.useSuspenseInfiniteQuery) !== void 0) {
|
|
1388
|
+
isQuery = operationQueryOptions.useSuspenseInfiniteQuery;
|
|
1389
|
+
}
|
|
1390
|
+
if ((operationQueryOptions == null ? void 0 : operationQueryOptions.useQuery) !== void 0) {
|
|
1391
|
+
isQuery = operationQueryOptions.useQuery;
|
|
1392
|
+
}
|
|
1393
|
+
if ((operationQueryOptions == null ? void 0 : operationQueryOptions.useSuspenseQuery) !== void 0) {
|
|
1394
|
+
isQuery = operationQueryOptions.useSuspenseQuery;
|
|
1395
|
+
}
|
|
2410
1396
|
if (isQuery) {
|
|
2411
1397
|
const queryKeyMutator = query.queryKey ? await (0, import_core2.generateMutator)({
|
|
2412
1398
|
output,
|
|
@@ -2433,7 +1419,7 @@ var generateQueryHook = async ({
|
|
|
2433
1419
|
return param.type === import_core2.GetterPropType.BODY ? body.implementation : param.name;
|
|
2434
1420
|
}).join(",");
|
|
2435
1421
|
const queries = [
|
|
2436
|
-
...(query == null ? void 0 : query.useInfinite) ? [
|
|
1422
|
+
...(query == null ? void 0 : query.useInfinite) || (operationQueryOptions == null ? void 0 : operationQueryOptions.useInfinite) ? [
|
|
2437
1423
|
{
|
|
2438
1424
|
name: (0, import_core2.camel)(`${operationName}-infinite`),
|
|
2439
1425
|
options: query == null ? void 0 : query.options,
|
|
@@ -2441,21 +1427,21 @@ var generateQueryHook = async ({
|
|
|
2441
1427
|
queryParam: query == null ? void 0 : query.useInfiniteQueryParam
|
|
2442
1428
|
}
|
|
2443
1429
|
] : [],
|
|
2444
|
-
...(query == null ? void 0 : query.useQuery) ? [
|
|
1430
|
+
...(query == null ? void 0 : query.useQuery) || (operationQueryOptions == null ? void 0 : operationQueryOptions.useQuery) ? [
|
|
2445
1431
|
{
|
|
2446
1432
|
name: operationName,
|
|
2447
1433
|
options: query == null ? void 0 : query.options,
|
|
2448
1434
|
type: QueryType.QUERY
|
|
2449
1435
|
}
|
|
2450
1436
|
] : [],
|
|
2451
|
-
...(query == null ? void 0 : query.useSuspenseQuery) ? [
|
|
1437
|
+
...(query == null ? void 0 : query.useSuspenseQuery) || (operationQueryOptions == null ? void 0 : operationQueryOptions.useSuspenseQuery) ? [
|
|
2452
1438
|
{
|
|
2453
1439
|
name: (0, import_core2.camel)(`${operationName}-suspense`),
|
|
2454
1440
|
options: query == null ? void 0 : query.options,
|
|
2455
1441
|
type: QueryType.SUSPENSE_QUERY
|
|
2456
1442
|
}
|
|
2457
1443
|
] : [],
|
|
2458
|
-
...(query == null ? void 0 : query.useSuspenseInfiniteQuery) ? [
|
|
1444
|
+
...(query == null ? void 0 : query.useSuspenseInfiniteQuery) || (operationQueryOptions == null ? void 0 : operationQueryOptions.useSuspenseInfiniteQuery) ? [
|
|
2459
1445
|
{
|
|
2460
1446
|
name: (0, import_core2.camel)(`${operationName}-suspense-infinite`),
|
|
2461
1447
|
options: query == null ? void 0 : query.options,
|
|
@@ -2508,7 +1494,10 @@ var generateQueryHook = async ({
|
|
|
2508
1494
|
...queryKeyMutator ? [queryKeyMutator] : []
|
|
2509
1495
|
] : void 0;
|
|
2510
1496
|
}
|
|
2511
|
-
|
|
1497
|
+
let isMutation = verb !== import_core2.Verbs.GET && override.query.useMutation;
|
|
1498
|
+
if ((operationQueryOptions == null ? void 0 : operationQueryOptions.useMutation) !== void 0) {
|
|
1499
|
+
isMutation = operationQueryOptions.useMutation;
|
|
1500
|
+
}
|
|
2512
1501
|
if (isMutation) {
|
|
2513
1502
|
const mutationOptionsMutator = query.mutationOptions ? await (0, import_core2.generateMutator)({
|
|
2514
1503
|
output,
|
|
@@ -2548,7 +1537,7 @@ var generateQueryHook = async ({
|
|
|
2548
1537
|
const mutationOptionsVarName = isRequestOptions ? "mutationOptions" : "options";
|
|
2549
1538
|
const mutationOptionsFn = `export const ${mutationOptionsFnName} = <TError = ${errorType},
|
|
2550
1539
|
TContext = unknown>(${mutationArguments}): ${mutationOptionFnReturnType} => {
|
|
2551
|
-
|
|
1540
|
+
${isRequestOptions ? `const {mutation: mutationOptions${!mutator ? `, axios: axiosOptions` : (mutator == null ? void 0 : mutator.hasSecondArg) ? ", request: requestOptions" : ""}} = options ?? {};` : ""}
|
|
2552
1541
|
|
|
2553
1542
|
${(mutator == null ? void 0 : mutator.isHook) ? `const ${operationName} = use${(0, import_core2.pascal)(operationName)}Hook()` : ""}
|
|
2554
1543
|
|
|
@@ -2562,7 +1551,7 @@ var generateQueryHook = async ({
|
|
|
2562
1551
|
${mutationOptionsMutator ? `const customOptions = ${mutationOptionsMutator.name}({...mutationOptions, mutationFn}${mutationOptionsMutator.hasThirdArg ? `, { url: \`${route}\` }` : ""});` : ""}
|
|
2563
1552
|
|
|
2564
1553
|
|
|
2565
|
-
|
|
1554
|
+
return ${!mutationOptionsMutator ? "{ mutationFn, ...mutationOptions }" : "customOptions"}}`;
|
|
2566
1555
|
const operationPrefix = hasSvelteQueryV4 ? "create" : "use";
|
|
2567
1556
|
implementation += `
|
|
2568
1557
|
${mutationOptionsFn}
|
|
@@ -2576,7 +1565,11 @@ ${mutationOptionsFn}
|
|
|
2576
1565
|
${doc}export const ${(0, import_core2.camel)(
|
|
2577
1566
|
`${operationPrefix}-${operationName}`
|
|
2578
1567
|
)} = <TError = ${errorType},
|
|
2579
|
-
TContext = unknown>(${mutationArguments})
|
|
1568
|
+
TContext = unknown>(${mutationArguments})${generateMutatorReturnType({
|
|
1569
|
+
outputClient,
|
|
1570
|
+
dataType,
|
|
1571
|
+
variableType: definitions ? `{${definitions}}` : "void"
|
|
1572
|
+
})} => {
|
|
2580
1573
|
|
|
2581
1574
|
const ${mutationOptionsVarName} = ${mutationOptionsFnName}(${isRequestOptions ? "options" : "mutationOptions"});
|
|
2582
1575
|
|