nekos 1.2.1 → 2.0.1
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 +4 -0
- package/aa/sleeping.txt +2 -0
- package/dist/index.cjs +101 -0
- package/dist/index.d.ts +13 -0
- package/{index.js → dist/index.js} +11 -26
- package/package.json +17 -9
- package/index.cjs +0 -4306
- package/index.d.ts +0 -32
package/index.cjs
DELETED
|
@@ -1,4306 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __glob = (map) => (path2) => {
|
|
8
|
-
var fn = map[path2];
|
|
9
|
-
if (fn) return fn();
|
|
10
|
-
throw new Error("Module not found in bundle: " + path2);
|
|
11
|
-
};
|
|
12
|
-
var __esm = (fn, res) => function __init() {
|
|
13
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
14
|
-
};
|
|
15
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
-
};
|
|
18
|
-
var __export = (target, all) => {
|
|
19
|
-
for (var name in all)
|
|
20
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
21
|
-
};
|
|
22
|
-
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (let key of __getOwnPropNames(from))
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
-
}
|
|
28
|
-
return to;
|
|
29
|
-
};
|
|
30
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
-
mod
|
|
37
|
-
));
|
|
38
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
-
|
|
40
|
-
// node_modules/@randplus/color/src/rgb.js
|
|
41
|
-
var require_rgb = __commonJS({
|
|
42
|
-
"node_modules/@randplus/color/src/rgb.js"(exports2, module2) {
|
|
43
|
-
function rgb() {
|
|
44
|
-
const r = Math.floor(Math.random() * 256);
|
|
45
|
-
const g = Math.floor(Math.random() * 256);
|
|
46
|
-
const b = Math.floor(Math.random() * 256);
|
|
47
|
-
return [r, g, b];
|
|
48
|
-
}
|
|
49
|
-
module2.exports = rgb;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// node_modules/@randplus/color/src/hex.js
|
|
54
|
-
var require_hex = __commonJS({
|
|
55
|
-
"node_modules/@randplus/color/src/hex.js"(exports2, module2) {
|
|
56
|
-
function hex2(prefix = "") {
|
|
57
|
-
if (typeof prefix !== "string") throw new Error("prefix must be string.");
|
|
58
|
-
const [r, g, b] = require_rgb()();
|
|
59
|
-
return prefix + r.toString(16).padStart(2, "0") + g.toString(16).padStart(2, "0") + b.toString(16).padStart(2, "0");
|
|
60
|
-
}
|
|
61
|
-
module2.exports = hex2;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// node_modules/@randplus/color/src/conv/chex.js
|
|
66
|
-
var require_chex = __commonJS({
|
|
67
|
-
"node_modules/@randplus/color/src/conv/chex.js"(exports2, module2) {
|
|
68
|
-
function convHex(options = {}) {
|
|
69
|
-
if (typeof options !== "object") throw new Error("options must be object.");
|
|
70
|
-
return require_hex()(options.prefix);
|
|
71
|
-
}
|
|
72
|
-
module2.exports = convHex;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// node_modules/@randplus/color/src/conv/crgb.js
|
|
77
|
-
var require_crgb = __commonJS({
|
|
78
|
-
"node_modules/@randplus/color/src/conv/crgb.js"(exports2, module2) {
|
|
79
|
-
function convRgb(options = {}) {
|
|
80
|
-
if (typeof options !== "object") throw new Error("options must be object.");
|
|
81
|
-
return require_rgb()();
|
|
82
|
-
}
|
|
83
|
-
module2.exports = convRgb;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// node_modules/universalify/index.js
|
|
88
|
-
var require_universalify = __commonJS({
|
|
89
|
-
"node_modules/universalify/index.js"(exports2) {
|
|
90
|
-
"use strict";
|
|
91
|
-
exports2.fromCallback = function(fn) {
|
|
92
|
-
return Object.defineProperty(function(...args) {
|
|
93
|
-
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
|
|
94
|
-
else {
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
97
|
-
fn.apply(this, args);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}, "name", { value: fn.name });
|
|
101
|
-
};
|
|
102
|
-
exports2.fromPromise = function(fn) {
|
|
103
|
-
return Object.defineProperty(function(...args) {
|
|
104
|
-
const cb = args[args.length - 1];
|
|
105
|
-
if (typeof cb !== "function") return fn.apply(this, args);
|
|
106
|
-
else {
|
|
107
|
-
args.pop();
|
|
108
|
-
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
109
|
-
}
|
|
110
|
-
}, "name", { value: fn.name });
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// node_modules/graceful-fs/polyfills.js
|
|
116
|
-
var require_polyfills = __commonJS({
|
|
117
|
-
"node_modules/graceful-fs/polyfills.js"(exports2, module2) {
|
|
118
|
-
var constants = require("constants");
|
|
119
|
-
var origCwd = process.cwd;
|
|
120
|
-
var cwd = null;
|
|
121
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
122
|
-
process.cwd = function() {
|
|
123
|
-
if (!cwd)
|
|
124
|
-
cwd = origCwd.call(process);
|
|
125
|
-
return cwd;
|
|
126
|
-
};
|
|
127
|
-
try {
|
|
128
|
-
process.cwd();
|
|
129
|
-
} catch (er) {
|
|
130
|
-
}
|
|
131
|
-
if (typeof process.chdir === "function") {
|
|
132
|
-
chdir = process.chdir;
|
|
133
|
-
process.chdir = function(d) {
|
|
134
|
-
cwd = null;
|
|
135
|
-
chdir.call(process, d);
|
|
136
|
-
};
|
|
137
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
138
|
-
}
|
|
139
|
-
var chdir;
|
|
140
|
-
module2.exports = patch;
|
|
141
|
-
function patch(fs2) {
|
|
142
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
143
|
-
patchLchmod(fs2);
|
|
144
|
-
}
|
|
145
|
-
if (!fs2.lutimes) {
|
|
146
|
-
patchLutimes(fs2);
|
|
147
|
-
}
|
|
148
|
-
fs2.chown = chownFix(fs2.chown);
|
|
149
|
-
fs2.fchown = chownFix(fs2.fchown);
|
|
150
|
-
fs2.lchown = chownFix(fs2.lchown);
|
|
151
|
-
fs2.chmod = chmodFix(fs2.chmod);
|
|
152
|
-
fs2.fchmod = chmodFix(fs2.fchmod);
|
|
153
|
-
fs2.lchmod = chmodFix(fs2.lchmod);
|
|
154
|
-
fs2.chownSync = chownFixSync(fs2.chownSync);
|
|
155
|
-
fs2.fchownSync = chownFixSync(fs2.fchownSync);
|
|
156
|
-
fs2.lchownSync = chownFixSync(fs2.lchownSync);
|
|
157
|
-
fs2.chmodSync = chmodFixSync(fs2.chmodSync);
|
|
158
|
-
fs2.fchmodSync = chmodFixSync(fs2.fchmodSync);
|
|
159
|
-
fs2.lchmodSync = chmodFixSync(fs2.lchmodSync);
|
|
160
|
-
fs2.stat = statFix(fs2.stat);
|
|
161
|
-
fs2.fstat = statFix(fs2.fstat);
|
|
162
|
-
fs2.lstat = statFix(fs2.lstat);
|
|
163
|
-
fs2.statSync = statFixSync(fs2.statSync);
|
|
164
|
-
fs2.fstatSync = statFixSync(fs2.fstatSync);
|
|
165
|
-
fs2.lstatSync = statFixSync(fs2.lstatSync);
|
|
166
|
-
if (fs2.chmod && !fs2.lchmod) {
|
|
167
|
-
fs2.lchmod = function(path2, mode, cb) {
|
|
168
|
-
if (cb) process.nextTick(cb);
|
|
169
|
-
};
|
|
170
|
-
fs2.lchmodSync = function() {
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
if (fs2.chown && !fs2.lchown) {
|
|
174
|
-
fs2.lchown = function(path2, uid, gid, cb) {
|
|
175
|
-
if (cb) process.nextTick(cb);
|
|
176
|
-
};
|
|
177
|
-
fs2.lchownSync = function() {
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
if (platform === "win32") {
|
|
181
|
-
fs2.rename = typeof fs2.rename !== "function" ? fs2.rename : (function(fs$rename) {
|
|
182
|
-
function rename(from, to, cb) {
|
|
183
|
-
var start = Date.now();
|
|
184
|
-
var backoff = 0;
|
|
185
|
-
fs$rename(from, to, function CB(er) {
|
|
186
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
187
|
-
setTimeout(function() {
|
|
188
|
-
fs2.stat(to, function(stater, st) {
|
|
189
|
-
if (stater && stater.code === "ENOENT")
|
|
190
|
-
fs$rename(from, to, CB);
|
|
191
|
-
else
|
|
192
|
-
cb(er);
|
|
193
|
-
});
|
|
194
|
-
}, backoff);
|
|
195
|
-
if (backoff < 100)
|
|
196
|
-
backoff += 10;
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if (cb) cb(er);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
203
|
-
return rename;
|
|
204
|
-
})(fs2.rename);
|
|
205
|
-
}
|
|
206
|
-
fs2.read = typeof fs2.read !== "function" ? fs2.read : (function(fs$read) {
|
|
207
|
-
function read(fd, buffer, offset, length, position, callback_) {
|
|
208
|
-
var callback;
|
|
209
|
-
if (callback_ && typeof callback_ === "function") {
|
|
210
|
-
var eagCounter = 0;
|
|
211
|
-
callback = function(er, _, __) {
|
|
212
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
213
|
-
eagCounter++;
|
|
214
|
-
return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
|
|
215
|
-
}
|
|
216
|
-
callback_.apply(this, arguments);
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
|
|
220
|
-
}
|
|
221
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
222
|
-
return read;
|
|
223
|
-
})(fs2.read);
|
|
224
|
-
fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
225
|
-
return function(fd, buffer, offset, length, position) {
|
|
226
|
-
var eagCounter = 0;
|
|
227
|
-
while (true) {
|
|
228
|
-
try {
|
|
229
|
-
return fs$readSync.call(fs2, fd, buffer, offset, length, position);
|
|
230
|
-
} catch (er) {
|
|
231
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
232
|
-
eagCounter++;
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
throw er;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
})(fs2.readSync);
|
|
240
|
-
function patchLchmod(fs3) {
|
|
241
|
-
fs3.lchmod = function(path2, mode, callback) {
|
|
242
|
-
fs3.open(
|
|
243
|
-
path2,
|
|
244
|
-
constants.O_WRONLY | constants.O_SYMLINK,
|
|
245
|
-
mode,
|
|
246
|
-
function(err, fd) {
|
|
247
|
-
if (err) {
|
|
248
|
-
if (callback) callback(err);
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
fs3.fchmod(fd, mode, function(err2) {
|
|
252
|
-
fs3.close(fd, function(err22) {
|
|
253
|
-
if (callback) callback(err2 || err22);
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
);
|
|
258
|
-
};
|
|
259
|
-
fs3.lchmodSync = function(path2, mode) {
|
|
260
|
-
var fd = fs3.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
261
|
-
var threw = true;
|
|
262
|
-
var ret;
|
|
263
|
-
try {
|
|
264
|
-
ret = fs3.fchmodSync(fd, mode);
|
|
265
|
-
threw = false;
|
|
266
|
-
} finally {
|
|
267
|
-
if (threw) {
|
|
268
|
-
try {
|
|
269
|
-
fs3.closeSync(fd);
|
|
270
|
-
} catch (er) {
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
fs3.closeSync(fd);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return ret;
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function patchLutimes(fs3) {
|
|
280
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
|
|
281
|
-
fs3.lutimes = function(path2, at, mt, cb) {
|
|
282
|
-
fs3.open(path2, constants.O_SYMLINK, function(er, fd) {
|
|
283
|
-
if (er) {
|
|
284
|
-
if (cb) cb(er);
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
fs3.futimes(fd, at, mt, function(er2) {
|
|
288
|
-
fs3.close(fd, function(er22) {
|
|
289
|
-
if (cb) cb(er2 || er22);
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
fs3.lutimesSync = function(path2, at, mt) {
|
|
295
|
-
var fd = fs3.openSync(path2, constants.O_SYMLINK);
|
|
296
|
-
var ret;
|
|
297
|
-
var threw = true;
|
|
298
|
-
try {
|
|
299
|
-
ret = fs3.futimesSync(fd, at, mt);
|
|
300
|
-
threw = false;
|
|
301
|
-
} finally {
|
|
302
|
-
if (threw) {
|
|
303
|
-
try {
|
|
304
|
-
fs3.closeSync(fd);
|
|
305
|
-
} catch (er) {
|
|
306
|
-
}
|
|
307
|
-
} else {
|
|
308
|
-
fs3.closeSync(fd);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return ret;
|
|
312
|
-
};
|
|
313
|
-
} else if (fs3.futimes) {
|
|
314
|
-
fs3.lutimes = function(_a, _b, _c, cb) {
|
|
315
|
-
if (cb) process.nextTick(cb);
|
|
316
|
-
};
|
|
317
|
-
fs3.lutimesSync = function() {
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
function chmodFix(orig) {
|
|
322
|
-
if (!orig) return orig;
|
|
323
|
-
return function(target, mode, cb) {
|
|
324
|
-
return orig.call(fs2, target, mode, function(er) {
|
|
325
|
-
if (chownErOk(er)) er = null;
|
|
326
|
-
if (cb) cb.apply(this, arguments);
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
function chmodFixSync(orig) {
|
|
331
|
-
if (!orig) return orig;
|
|
332
|
-
return function(target, mode) {
|
|
333
|
-
try {
|
|
334
|
-
return orig.call(fs2, target, mode);
|
|
335
|
-
} catch (er) {
|
|
336
|
-
if (!chownErOk(er)) throw er;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function chownFix(orig) {
|
|
341
|
-
if (!orig) return orig;
|
|
342
|
-
return function(target, uid, gid, cb) {
|
|
343
|
-
return orig.call(fs2, target, uid, gid, function(er) {
|
|
344
|
-
if (chownErOk(er)) er = null;
|
|
345
|
-
if (cb) cb.apply(this, arguments);
|
|
346
|
-
});
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
function chownFixSync(orig) {
|
|
350
|
-
if (!orig) return orig;
|
|
351
|
-
return function(target, uid, gid) {
|
|
352
|
-
try {
|
|
353
|
-
return orig.call(fs2, target, uid, gid);
|
|
354
|
-
} catch (er) {
|
|
355
|
-
if (!chownErOk(er)) throw er;
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
function statFix(orig) {
|
|
360
|
-
if (!orig) return orig;
|
|
361
|
-
return function(target, options, cb) {
|
|
362
|
-
if (typeof options === "function") {
|
|
363
|
-
cb = options;
|
|
364
|
-
options = null;
|
|
365
|
-
}
|
|
366
|
-
function callback(er, stats) {
|
|
367
|
-
if (stats) {
|
|
368
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
369
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
370
|
-
}
|
|
371
|
-
if (cb) cb.apply(this, arguments);
|
|
372
|
-
}
|
|
373
|
-
return options ? orig.call(fs2, target, options, callback) : orig.call(fs2, target, callback);
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function statFixSync(orig) {
|
|
377
|
-
if (!orig) return orig;
|
|
378
|
-
return function(target, options) {
|
|
379
|
-
var stats = options ? orig.call(fs2, target, options) : orig.call(fs2, target);
|
|
380
|
-
if (stats) {
|
|
381
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
382
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
383
|
-
}
|
|
384
|
-
return stats;
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
function chownErOk(er) {
|
|
388
|
-
if (!er)
|
|
389
|
-
return true;
|
|
390
|
-
if (er.code === "ENOSYS")
|
|
391
|
-
return true;
|
|
392
|
-
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
393
|
-
if (nonroot) {
|
|
394
|
-
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
395
|
-
return true;
|
|
396
|
-
}
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
// node_modules/graceful-fs/legacy-streams.js
|
|
404
|
-
var require_legacy_streams = __commonJS({
|
|
405
|
-
"node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
|
|
406
|
-
var Stream = require("stream").Stream;
|
|
407
|
-
module2.exports = legacy;
|
|
408
|
-
function legacy(fs2) {
|
|
409
|
-
return {
|
|
410
|
-
ReadStream,
|
|
411
|
-
WriteStream
|
|
412
|
-
};
|
|
413
|
-
function ReadStream(path2, options) {
|
|
414
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path2, options);
|
|
415
|
-
Stream.call(this);
|
|
416
|
-
var self2 = this;
|
|
417
|
-
this.path = path2;
|
|
418
|
-
this.fd = null;
|
|
419
|
-
this.readable = true;
|
|
420
|
-
this.paused = false;
|
|
421
|
-
this.flags = "r";
|
|
422
|
-
this.mode = 438;
|
|
423
|
-
this.bufferSize = 64 * 1024;
|
|
424
|
-
options = options || {};
|
|
425
|
-
var keys = Object.keys(options);
|
|
426
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
427
|
-
var key = keys[index];
|
|
428
|
-
this[key] = options[key];
|
|
429
|
-
}
|
|
430
|
-
if (this.encoding) this.setEncoding(this.encoding);
|
|
431
|
-
if (this.start !== void 0) {
|
|
432
|
-
if ("number" !== typeof this.start) {
|
|
433
|
-
throw TypeError("start must be a Number");
|
|
434
|
-
}
|
|
435
|
-
if (this.end === void 0) {
|
|
436
|
-
this.end = Infinity;
|
|
437
|
-
} else if ("number" !== typeof this.end) {
|
|
438
|
-
throw TypeError("end must be a Number");
|
|
439
|
-
}
|
|
440
|
-
if (this.start > this.end) {
|
|
441
|
-
throw new Error("start must be <= end");
|
|
442
|
-
}
|
|
443
|
-
this.pos = this.start;
|
|
444
|
-
}
|
|
445
|
-
if (this.fd !== null) {
|
|
446
|
-
process.nextTick(function() {
|
|
447
|
-
self2._read();
|
|
448
|
-
});
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
fs2.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
452
|
-
if (err) {
|
|
453
|
-
self2.emit("error", err);
|
|
454
|
-
self2.readable = false;
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
self2.fd = fd;
|
|
458
|
-
self2.emit("open", fd);
|
|
459
|
-
self2._read();
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
function WriteStream(path2, options) {
|
|
463
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path2, options);
|
|
464
|
-
Stream.call(this);
|
|
465
|
-
this.path = path2;
|
|
466
|
-
this.fd = null;
|
|
467
|
-
this.writable = true;
|
|
468
|
-
this.flags = "w";
|
|
469
|
-
this.encoding = "binary";
|
|
470
|
-
this.mode = 438;
|
|
471
|
-
this.bytesWritten = 0;
|
|
472
|
-
options = options || {};
|
|
473
|
-
var keys = Object.keys(options);
|
|
474
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
475
|
-
var key = keys[index];
|
|
476
|
-
this[key] = options[key];
|
|
477
|
-
}
|
|
478
|
-
if (this.start !== void 0) {
|
|
479
|
-
if ("number" !== typeof this.start) {
|
|
480
|
-
throw TypeError("start must be a Number");
|
|
481
|
-
}
|
|
482
|
-
if (this.start < 0) {
|
|
483
|
-
throw new Error("start must be >= zero");
|
|
484
|
-
}
|
|
485
|
-
this.pos = this.start;
|
|
486
|
-
}
|
|
487
|
-
this.busy = false;
|
|
488
|
-
this._queue = [];
|
|
489
|
-
if (this.fd === null) {
|
|
490
|
-
this._open = fs2.open;
|
|
491
|
-
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
492
|
-
this.flush();
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
// node_modules/graceful-fs/clone.js
|
|
500
|
-
var require_clone = __commonJS({
|
|
501
|
-
"node_modules/graceful-fs/clone.js"(exports2, module2) {
|
|
502
|
-
"use strict";
|
|
503
|
-
module2.exports = clone;
|
|
504
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
505
|
-
return obj.__proto__;
|
|
506
|
-
};
|
|
507
|
-
function clone(obj) {
|
|
508
|
-
if (obj === null || typeof obj !== "object")
|
|
509
|
-
return obj;
|
|
510
|
-
if (obj instanceof Object)
|
|
511
|
-
var copy = { __proto__: getPrototypeOf(obj) };
|
|
512
|
-
else
|
|
513
|
-
var copy = /* @__PURE__ */ Object.create(null);
|
|
514
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
515
|
-
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
516
|
-
});
|
|
517
|
-
return copy;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
// node_modules/graceful-fs/graceful-fs.js
|
|
523
|
-
var require_graceful_fs = __commonJS({
|
|
524
|
-
"node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
|
|
525
|
-
var fs2 = require("fs");
|
|
526
|
-
var polyfills = require_polyfills();
|
|
527
|
-
var legacy = require_legacy_streams();
|
|
528
|
-
var clone = require_clone();
|
|
529
|
-
var util = require("util");
|
|
530
|
-
var gracefulQueue;
|
|
531
|
-
var previousSymbol;
|
|
532
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
533
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
534
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
535
|
-
} else {
|
|
536
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
537
|
-
previousSymbol = "___graceful-fs.previous";
|
|
538
|
-
}
|
|
539
|
-
function noop() {
|
|
540
|
-
}
|
|
541
|
-
function publishQueue(context, queue2) {
|
|
542
|
-
Object.defineProperty(context, gracefulQueue, {
|
|
543
|
-
get: function() {
|
|
544
|
-
return queue2;
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
var debug = noop;
|
|
549
|
-
if (util.debuglog)
|
|
550
|
-
debug = util.debuglog("gfs4");
|
|
551
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
552
|
-
debug = function() {
|
|
553
|
-
var m = util.format.apply(util, arguments);
|
|
554
|
-
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
555
|
-
console.error(m);
|
|
556
|
-
};
|
|
557
|
-
if (!fs2[gracefulQueue]) {
|
|
558
|
-
queue = global[gracefulQueue] || [];
|
|
559
|
-
publishQueue(fs2, queue);
|
|
560
|
-
fs2.close = (function(fs$close) {
|
|
561
|
-
function close(fd, cb) {
|
|
562
|
-
return fs$close.call(fs2, fd, function(err) {
|
|
563
|
-
if (!err) {
|
|
564
|
-
resetQueue();
|
|
565
|
-
}
|
|
566
|
-
if (typeof cb === "function")
|
|
567
|
-
cb.apply(this, arguments);
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
Object.defineProperty(close, previousSymbol, {
|
|
571
|
-
value: fs$close
|
|
572
|
-
});
|
|
573
|
-
return close;
|
|
574
|
-
})(fs2.close);
|
|
575
|
-
fs2.closeSync = (function(fs$closeSync) {
|
|
576
|
-
function closeSync(fd) {
|
|
577
|
-
fs$closeSync.apply(fs2, arguments);
|
|
578
|
-
resetQueue();
|
|
579
|
-
}
|
|
580
|
-
Object.defineProperty(closeSync, previousSymbol, {
|
|
581
|
-
value: fs$closeSync
|
|
582
|
-
});
|
|
583
|
-
return closeSync;
|
|
584
|
-
})(fs2.closeSync);
|
|
585
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
586
|
-
process.on("exit", function() {
|
|
587
|
-
debug(fs2[gracefulQueue]);
|
|
588
|
-
require("assert").equal(fs2[gracefulQueue].length, 0);
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
var queue;
|
|
593
|
-
if (!global[gracefulQueue]) {
|
|
594
|
-
publishQueue(global, fs2[gracefulQueue]);
|
|
595
|
-
}
|
|
596
|
-
module2.exports = patch(clone(fs2));
|
|
597
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs2.__patched) {
|
|
598
|
-
module2.exports = patch(fs2);
|
|
599
|
-
fs2.__patched = true;
|
|
600
|
-
}
|
|
601
|
-
function patch(fs3) {
|
|
602
|
-
polyfills(fs3);
|
|
603
|
-
fs3.gracefulify = patch;
|
|
604
|
-
fs3.createReadStream = createReadStream;
|
|
605
|
-
fs3.createWriteStream = createWriteStream;
|
|
606
|
-
var fs$readFile = fs3.readFile;
|
|
607
|
-
fs3.readFile = readFile;
|
|
608
|
-
function readFile(path2, options, cb) {
|
|
609
|
-
if (typeof options === "function")
|
|
610
|
-
cb = options, options = null;
|
|
611
|
-
return go$readFile(path2, options, cb);
|
|
612
|
-
function go$readFile(path3, options2, cb2, startTime) {
|
|
613
|
-
return fs$readFile(path3, options2, function(err) {
|
|
614
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
615
|
-
enqueue([go$readFile, [path3, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
616
|
-
else {
|
|
617
|
-
if (typeof cb2 === "function")
|
|
618
|
-
cb2.apply(this, arguments);
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
var fs$writeFile = fs3.writeFile;
|
|
624
|
-
fs3.writeFile = writeFile;
|
|
625
|
-
function writeFile(path2, data, options, cb) {
|
|
626
|
-
if (typeof options === "function")
|
|
627
|
-
cb = options, options = null;
|
|
628
|
-
return go$writeFile(path2, data, options, cb);
|
|
629
|
-
function go$writeFile(path3, data2, options2, cb2, startTime) {
|
|
630
|
-
return fs$writeFile(path3, data2, options2, function(err) {
|
|
631
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
632
|
-
enqueue([go$writeFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
633
|
-
else {
|
|
634
|
-
if (typeof cb2 === "function")
|
|
635
|
-
cb2.apply(this, arguments);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
var fs$appendFile = fs3.appendFile;
|
|
641
|
-
if (fs$appendFile)
|
|
642
|
-
fs3.appendFile = appendFile;
|
|
643
|
-
function appendFile(path2, data, options, cb) {
|
|
644
|
-
if (typeof options === "function")
|
|
645
|
-
cb = options, options = null;
|
|
646
|
-
return go$appendFile(path2, data, options, cb);
|
|
647
|
-
function go$appendFile(path3, data2, options2, cb2, startTime) {
|
|
648
|
-
return fs$appendFile(path3, data2, options2, function(err) {
|
|
649
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
650
|
-
enqueue([go$appendFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
651
|
-
else {
|
|
652
|
-
if (typeof cb2 === "function")
|
|
653
|
-
cb2.apply(this, arguments);
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
var fs$copyFile = fs3.copyFile;
|
|
659
|
-
if (fs$copyFile)
|
|
660
|
-
fs3.copyFile = copyFile;
|
|
661
|
-
function copyFile(src, dest, flags, cb) {
|
|
662
|
-
if (typeof flags === "function") {
|
|
663
|
-
cb = flags;
|
|
664
|
-
flags = 0;
|
|
665
|
-
}
|
|
666
|
-
return go$copyFile(src, dest, flags, cb);
|
|
667
|
-
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
668
|
-
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
669
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
670
|
-
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
671
|
-
else {
|
|
672
|
-
if (typeof cb2 === "function")
|
|
673
|
-
cb2.apply(this, arguments);
|
|
674
|
-
}
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
var fs$readdir = fs3.readdir;
|
|
679
|
-
fs3.readdir = readdir;
|
|
680
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
681
|
-
function readdir(path2, options, cb) {
|
|
682
|
-
if (typeof options === "function")
|
|
683
|
-
cb = options, options = null;
|
|
684
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options2, cb2, startTime) {
|
|
685
|
-
return fs$readdir(path3, fs$readdirCallback(
|
|
686
|
-
path3,
|
|
687
|
-
options2,
|
|
688
|
-
cb2,
|
|
689
|
-
startTime
|
|
690
|
-
));
|
|
691
|
-
} : function go$readdir2(path3, options2, cb2, startTime) {
|
|
692
|
-
return fs$readdir(path3, options2, fs$readdirCallback(
|
|
693
|
-
path3,
|
|
694
|
-
options2,
|
|
695
|
-
cb2,
|
|
696
|
-
startTime
|
|
697
|
-
));
|
|
698
|
-
};
|
|
699
|
-
return go$readdir(path2, options, cb);
|
|
700
|
-
function fs$readdirCallback(path3, options2, cb2, startTime) {
|
|
701
|
-
return function(err, files) {
|
|
702
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
703
|
-
enqueue([
|
|
704
|
-
go$readdir,
|
|
705
|
-
[path3, options2, cb2],
|
|
706
|
-
err,
|
|
707
|
-
startTime || Date.now(),
|
|
708
|
-
Date.now()
|
|
709
|
-
]);
|
|
710
|
-
else {
|
|
711
|
-
if (files && files.sort)
|
|
712
|
-
files.sort();
|
|
713
|
-
if (typeof cb2 === "function")
|
|
714
|
-
cb2.call(this, err, files);
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
720
|
-
var legStreams = legacy(fs3);
|
|
721
|
-
ReadStream = legStreams.ReadStream;
|
|
722
|
-
WriteStream = legStreams.WriteStream;
|
|
723
|
-
}
|
|
724
|
-
var fs$ReadStream = fs3.ReadStream;
|
|
725
|
-
if (fs$ReadStream) {
|
|
726
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
727
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
728
|
-
}
|
|
729
|
-
var fs$WriteStream = fs3.WriteStream;
|
|
730
|
-
if (fs$WriteStream) {
|
|
731
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
732
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
733
|
-
}
|
|
734
|
-
Object.defineProperty(fs3, "ReadStream", {
|
|
735
|
-
get: function() {
|
|
736
|
-
return ReadStream;
|
|
737
|
-
},
|
|
738
|
-
set: function(val) {
|
|
739
|
-
ReadStream = val;
|
|
740
|
-
},
|
|
741
|
-
enumerable: true,
|
|
742
|
-
configurable: true
|
|
743
|
-
});
|
|
744
|
-
Object.defineProperty(fs3, "WriteStream", {
|
|
745
|
-
get: function() {
|
|
746
|
-
return WriteStream;
|
|
747
|
-
},
|
|
748
|
-
set: function(val) {
|
|
749
|
-
WriteStream = val;
|
|
750
|
-
},
|
|
751
|
-
enumerable: true,
|
|
752
|
-
configurable: true
|
|
753
|
-
});
|
|
754
|
-
var FileReadStream = ReadStream;
|
|
755
|
-
Object.defineProperty(fs3, "FileReadStream", {
|
|
756
|
-
get: function() {
|
|
757
|
-
return FileReadStream;
|
|
758
|
-
},
|
|
759
|
-
set: function(val) {
|
|
760
|
-
FileReadStream = val;
|
|
761
|
-
},
|
|
762
|
-
enumerable: true,
|
|
763
|
-
configurable: true
|
|
764
|
-
});
|
|
765
|
-
var FileWriteStream = WriteStream;
|
|
766
|
-
Object.defineProperty(fs3, "FileWriteStream", {
|
|
767
|
-
get: function() {
|
|
768
|
-
return FileWriteStream;
|
|
769
|
-
},
|
|
770
|
-
set: function(val) {
|
|
771
|
-
FileWriteStream = val;
|
|
772
|
-
},
|
|
773
|
-
enumerable: true,
|
|
774
|
-
configurable: true
|
|
775
|
-
});
|
|
776
|
-
function ReadStream(path2, options) {
|
|
777
|
-
if (this instanceof ReadStream)
|
|
778
|
-
return fs$ReadStream.apply(this, arguments), this;
|
|
779
|
-
else
|
|
780
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
781
|
-
}
|
|
782
|
-
function ReadStream$open() {
|
|
783
|
-
var that = this;
|
|
784
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
785
|
-
if (err) {
|
|
786
|
-
if (that.autoClose)
|
|
787
|
-
that.destroy();
|
|
788
|
-
that.emit("error", err);
|
|
789
|
-
} else {
|
|
790
|
-
that.fd = fd;
|
|
791
|
-
that.emit("open", fd);
|
|
792
|
-
that.read();
|
|
793
|
-
}
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
function WriteStream(path2, options) {
|
|
797
|
-
if (this instanceof WriteStream)
|
|
798
|
-
return fs$WriteStream.apply(this, arguments), this;
|
|
799
|
-
else
|
|
800
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
801
|
-
}
|
|
802
|
-
function WriteStream$open() {
|
|
803
|
-
var that = this;
|
|
804
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
805
|
-
if (err) {
|
|
806
|
-
that.destroy();
|
|
807
|
-
that.emit("error", err);
|
|
808
|
-
} else {
|
|
809
|
-
that.fd = fd;
|
|
810
|
-
that.emit("open", fd);
|
|
811
|
-
}
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
function createReadStream(path2, options) {
|
|
815
|
-
return new fs3.ReadStream(path2, options);
|
|
816
|
-
}
|
|
817
|
-
function createWriteStream(path2, options) {
|
|
818
|
-
return new fs3.WriteStream(path2, options);
|
|
819
|
-
}
|
|
820
|
-
var fs$open = fs3.open;
|
|
821
|
-
fs3.open = open;
|
|
822
|
-
function open(path2, flags, mode, cb) {
|
|
823
|
-
if (typeof mode === "function")
|
|
824
|
-
cb = mode, mode = null;
|
|
825
|
-
return go$open(path2, flags, mode, cb);
|
|
826
|
-
function go$open(path3, flags2, mode2, cb2, startTime) {
|
|
827
|
-
return fs$open(path3, flags2, mode2, function(err, fd) {
|
|
828
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
829
|
-
enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
830
|
-
else {
|
|
831
|
-
if (typeof cb2 === "function")
|
|
832
|
-
cb2.apply(this, arguments);
|
|
833
|
-
}
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
return fs3;
|
|
838
|
-
}
|
|
839
|
-
function enqueue(elem) {
|
|
840
|
-
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
841
|
-
fs2[gracefulQueue].push(elem);
|
|
842
|
-
retry();
|
|
843
|
-
}
|
|
844
|
-
var retryTimer;
|
|
845
|
-
function resetQueue() {
|
|
846
|
-
var now = Date.now();
|
|
847
|
-
for (var i = 0; i < fs2[gracefulQueue].length; ++i) {
|
|
848
|
-
if (fs2[gracefulQueue][i].length > 2) {
|
|
849
|
-
fs2[gracefulQueue][i][3] = now;
|
|
850
|
-
fs2[gracefulQueue][i][4] = now;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
retry();
|
|
854
|
-
}
|
|
855
|
-
function retry() {
|
|
856
|
-
clearTimeout(retryTimer);
|
|
857
|
-
retryTimer = void 0;
|
|
858
|
-
if (fs2[gracefulQueue].length === 0)
|
|
859
|
-
return;
|
|
860
|
-
var elem = fs2[gracefulQueue].shift();
|
|
861
|
-
var fn = elem[0];
|
|
862
|
-
var args = elem[1];
|
|
863
|
-
var err = elem[2];
|
|
864
|
-
var startTime = elem[3];
|
|
865
|
-
var lastTime = elem[4];
|
|
866
|
-
if (startTime === void 0) {
|
|
867
|
-
debug("RETRY", fn.name, args);
|
|
868
|
-
fn.apply(null, args);
|
|
869
|
-
} else if (Date.now() - startTime >= 6e4) {
|
|
870
|
-
debug("TIMEOUT", fn.name, args);
|
|
871
|
-
var cb = args.pop();
|
|
872
|
-
if (typeof cb === "function")
|
|
873
|
-
cb.call(null, err);
|
|
874
|
-
} else {
|
|
875
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
876
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
877
|
-
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
878
|
-
if (sinceAttempt >= desiredDelay) {
|
|
879
|
-
debug("RETRY", fn.name, args);
|
|
880
|
-
fn.apply(null, args.concat([startTime]));
|
|
881
|
-
} else {
|
|
882
|
-
fs2[gracefulQueue].push(elem);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
if (retryTimer === void 0) {
|
|
886
|
-
retryTimer = setTimeout(retry, 0);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
|
|
892
|
-
// node_modules/fs-extra/lib/fs/index.js
|
|
893
|
-
var require_fs = __commonJS({
|
|
894
|
-
"node_modules/fs-extra/lib/fs/index.js"(exports2) {
|
|
895
|
-
"use strict";
|
|
896
|
-
var u = require_universalify().fromCallback;
|
|
897
|
-
var fs2 = require_graceful_fs();
|
|
898
|
-
var api = [
|
|
899
|
-
"access",
|
|
900
|
-
"appendFile",
|
|
901
|
-
"chmod",
|
|
902
|
-
"chown",
|
|
903
|
-
"close",
|
|
904
|
-
"copyFile",
|
|
905
|
-
"cp",
|
|
906
|
-
"fchmod",
|
|
907
|
-
"fchown",
|
|
908
|
-
"fdatasync",
|
|
909
|
-
"fstat",
|
|
910
|
-
"fsync",
|
|
911
|
-
"ftruncate",
|
|
912
|
-
"futimes",
|
|
913
|
-
"glob",
|
|
914
|
-
"lchmod",
|
|
915
|
-
"lchown",
|
|
916
|
-
"lutimes",
|
|
917
|
-
"link",
|
|
918
|
-
"lstat",
|
|
919
|
-
"mkdir",
|
|
920
|
-
"mkdtemp",
|
|
921
|
-
"open",
|
|
922
|
-
"opendir",
|
|
923
|
-
"readdir",
|
|
924
|
-
"readFile",
|
|
925
|
-
"readlink",
|
|
926
|
-
"realpath",
|
|
927
|
-
"rename",
|
|
928
|
-
"rm",
|
|
929
|
-
"rmdir",
|
|
930
|
-
"stat",
|
|
931
|
-
"statfs",
|
|
932
|
-
"symlink",
|
|
933
|
-
"truncate",
|
|
934
|
-
"unlink",
|
|
935
|
-
"utimes",
|
|
936
|
-
"writeFile"
|
|
937
|
-
].filter((key) => {
|
|
938
|
-
return typeof fs2[key] === "function";
|
|
939
|
-
});
|
|
940
|
-
Object.assign(exports2, fs2);
|
|
941
|
-
api.forEach((method) => {
|
|
942
|
-
exports2[method] = u(fs2[method]);
|
|
943
|
-
});
|
|
944
|
-
exports2.exists = function(filename, callback) {
|
|
945
|
-
if (typeof callback === "function") {
|
|
946
|
-
return fs2.exists(filename, callback);
|
|
947
|
-
}
|
|
948
|
-
return new Promise((resolve) => {
|
|
949
|
-
return fs2.exists(filename, resolve);
|
|
950
|
-
});
|
|
951
|
-
};
|
|
952
|
-
exports2.read = function(fd, buffer, offset, length, position, callback) {
|
|
953
|
-
if (typeof callback === "function") {
|
|
954
|
-
return fs2.read(fd, buffer, offset, length, position, callback);
|
|
955
|
-
}
|
|
956
|
-
return new Promise((resolve, reject) => {
|
|
957
|
-
fs2.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
958
|
-
if (err) return reject(err);
|
|
959
|
-
resolve({ bytesRead, buffer: buffer2 });
|
|
960
|
-
});
|
|
961
|
-
});
|
|
962
|
-
};
|
|
963
|
-
exports2.write = function(fd, buffer, ...args) {
|
|
964
|
-
if (typeof args[args.length - 1] === "function") {
|
|
965
|
-
return fs2.write(fd, buffer, ...args);
|
|
966
|
-
}
|
|
967
|
-
return new Promise((resolve, reject) => {
|
|
968
|
-
fs2.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
969
|
-
if (err) return reject(err);
|
|
970
|
-
resolve({ bytesWritten, buffer: buffer2 });
|
|
971
|
-
});
|
|
972
|
-
});
|
|
973
|
-
};
|
|
974
|
-
exports2.readv = function(fd, buffers, ...args) {
|
|
975
|
-
if (typeof args[args.length - 1] === "function") {
|
|
976
|
-
return fs2.readv(fd, buffers, ...args);
|
|
977
|
-
}
|
|
978
|
-
return new Promise((resolve, reject) => {
|
|
979
|
-
fs2.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
980
|
-
if (err) return reject(err);
|
|
981
|
-
resolve({ bytesRead, buffers: buffers2 });
|
|
982
|
-
});
|
|
983
|
-
});
|
|
984
|
-
};
|
|
985
|
-
exports2.writev = function(fd, buffers, ...args) {
|
|
986
|
-
if (typeof args[args.length - 1] === "function") {
|
|
987
|
-
return fs2.writev(fd, buffers, ...args);
|
|
988
|
-
}
|
|
989
|
-
return new Promise((resolve, reject) => {
|
|
990
|
-
fs2.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
991
|
-
if (err) return reject(err);
|
|
992
|
-
resolve({ bytesWritten, buffers: buffers2 });
|
|
993
|
-
});
|
|
994
|
-
});
|
|
995
|
-
};
|
|
996
|
-
if (typeof fs2.realpath.native === "function") {
|
|
997
|
-
exports2.realpath.native = u(fs2.realpath.native);
|
|
998
|
-
} else {
|
|
999
|
-
process.emitWarning(
|
|
1000
|
-
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
1001
|
-
"Warning",
|
|
1002
|
-
"fs-extra-WARN0003"
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
1007
|
-
|
|
1008
|
-
// node_modules/fs-extra/lib/mkdirs/utils.js
|
|
1009
|
-
var require_utils = __commonJS({
|
|
1010
|
-
"node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
|
|
1011
|
-
"use strict";
|
|
1012
|
-
var path2 = require("path");
|
|
1013
|
-
module2.exports.checkPath = function checkPath(pth) {
|
|
1014
|
-
if (process.platform === "win32") {
|
|
1015
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path2.parse(pth).root, ""));
|
|
1016
|
-
if (pathHasInvalidWinCharacters) {
|
|
1017
|
-
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
1018
|
-
error.code = "EINVAL";
|
|
1019
|
-
throw error;
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
// node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
1027
|
-
var require_make_dir = __commonJS({
|
|
1028
|
-
"node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
|
|
1029
|
-
"use strict";
|
|
1030
|
-
var fs2 = require_fs();
|
|
1031
|
-
var { checkPath } = require_utils();
|
|
1032
|
-
var getMode = (options) => {
|
|
1033
|
-
const defaults = { mode: 511 };
|
|
1034
|
-
if (typeof options === "number") return options;
|
|
1035
|
-
return { ...defaults, ...options }.mode;
|
|
1036
|
-
};
|
|
1037
|
-
module2.exports.makeDir = async (dir, options) => {
|
|
1038
|
-
checkPath(dir);
|
|
1039
|
-
return fs2.mkdir(dir, {
|
|
1040
|
-
mode: getMode(options),
|
|
1041
|
-
recursive: true
|
|
1042
|
-
});
|
|
1043
|
-
};
|
|
1044
|
-
module2.exports.makeDirSync = (dir, options) => {
|
|
1045
|
-
checkPath(dir);
|
|
1046
|
-
return fs2.mkdirSync(dir, {
|
|
1047
|
-
mode: getMode(options),
|
|
1048
|
-
recursive: true
|
|
1049
|
-
});
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
// node_modules/fs-extra/lib/mkdirs/index.js
|
|
1055
|
-
var require_mkdirs = __commonJS({
|
|
1056
|
-
"node_modules/fs-extra/lib/mkdirs/index.js"(exports2, module2) {
|
|
1057
|
-
"use strict";
|
|
1058
|
-
var u = require_universalify().fromPromise;
|
|
1059
|
-
var { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
1060
|
-
var makeDir = u(_makeDir);
|
|
1061
|
-
module2.exports = {
|
|
1062
|
-
mkdirs: makeDir,
|
|
1063
|
-
mkdirsSync: makeDirSync,
|
|
1064
|
-
// alias
|
|
1065
|
-
mkdirp: makeDir,
|
|
1066
|
-
mkdirpSync: makeDirSync,
|
|
1067
|
-
ensureDir: makeDir,
|
|
1068
|
-
ensureDirSync: makeDirSync
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
});
|
|
1072
|
-
|
|
1073
|
-
// node_modules/fs-extra/lib/path-exists/index.js
|
|
1074
|
-
var require_path_exists = __commonJS({
|
|
1075
|
-
"node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
|
|
1076
|
-
"use strict";
|
|
1077
|
-
var u = require_universalify().fromPromise;
|
|
1078
|
-
var fs2 = require_fs();
|
|
1079
|
-
function pathExists(path2) {
|
|
1080
|
-
return fs2.access(path2).then(() => true).catch(() => false);
|
|
1081
|
-
}
|
|
1082
|
-
module2.exports = {
|
|
1083
|
-
pathExists: u(pathExists),
|
|
1084
|
-
pathExistsSync: fs2.existsSync
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
// node_modules/fs-extra/lib/util/utimes.js
|
|
1090
|
-
var require_utimes = __commonJS({
|
|
1091
|
-
"node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
|
|
1092
|
-
"use strict";
|
|
1093
|
-
var fs2 = require_fs();
|
|
1094
|
-
var u = require_universalify().fromPromise;
|
|
1095
|
-
async function utimesMillis(path2, atime, mtime) {
|
|
1096
|
-
const fd = await fs2.open(path2, "r+");
|
|
1097
|
-
let closeErr = null;
|
|
1098
|
-
try {
|
|
1099
|
-
await fs2.futimes(fd, atime, mtime);
|
|
1100
|
-
} finally {
|
|
1101
|
-
try {
|
|
1102
|
-
await fs2.close(fd);
|
|
1103
|
-
} catch (e) {
|
|
1104
|
-
closeErr = e;
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
if (closeErr) {
|
|
1108
|
-
throw closeErr;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
function utimesMillisSync(path2, atime, mtime) {
|
|
1112
|
-
const fd = fs2.openSync(path2, "r+");
|
|
1113
|
-
fs2.futimesSync(fd, atime, mtime);
|
|
1114
|
-
return fs2.closeSync(fd);
|
|
1115
|
-
}
|
|
1116
|
-
module2.exports = {
|
|
1117
|
-
utimesMillis: u(utimesMillis),
|
|
1118
|
-
utimesMillisSync
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
|
|
1123
|
-
// node_modules/fs-extra/lib/util/stat.js
|
|
1124
|
-
var require_stat = __commonJS({
|
|
1125
|
-
"node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
|
|
1126
|
-
"use strict";
|
|
1127
|
-
var fs2 = require_fs();
|
|
1128
|
-
var path2 = require("path");
|
|
1129
|
-
var u = require_universalify().fromPromise;
|
|
1130
|
-
function getStats(src, dest, opts) {
|
|
1131
|
-
const statFunc = opts.dereference ? (file) => fs2.stat(file, { bigint: true }) : (file) => fs2.lstat(file, { bigint: true });
|
|
1132
|
-
return Promise.all([
|
|
1133
|
-
statFunc(src),
|
|
1134
|
-
statFunc(dest).catch((err) => {
|
|
1135
|
-
if (err.code === "ENOENT") return null;
|
|
1136
|
-
throw err;
|
|
1137
|
-
})
|
|
1138
|
-
]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
|
|
1139
|
-
}
|
|
1140
|
-
function getStatsSync(src, dest, opts) {
|
|
1141
|
-
let destStat;
|
|
1142
|
-
const statFunc = opts.dereference ? (file) => fs2.statSync(file, { bigint: true }) : (file) => fs2.lstatSync(file, { bigint: true });
|
|
1143
|
-
const srcStat = statFunc(src);
|
|
1144
|
-
try {
|
|
1145
|
-
destStat = statFunc(dest);
|
|
1146
|
-
} catch (err) {
|
|
1147
|
-
if (err.code === "ENOENT") return { srcStat, destStat: null };
|
|
1148
|
-
throw err;
|
|
1149
|
-
}
|
|
1150
|
-
return { srcStat, destStat };
|
|
1151
|
-
}
|
|
1152
|
-
async function checkPaths(src, dest, funcName, opts) {
|
|
1153
|
-
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
1154
|
-
if (destStat) {
|
|
1155
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1156
|
-
const srcBaseName = path2.basename(src);
|
|
1157
|
-
const destBaseName = path2.basename(dest);
|
|
1158
|
-
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1159
|
-
return { srcStat, destStat, isChangingCase: true };
|
|
1160
|
-
}
|
|
1161
|
-
throw new Error("Source and destination must not be the same.");
|
|
1162
|
-
}
|
|
1163
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1164
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1165
|
-
}
|
|
1166
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1167
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1171
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1172
|
-
}
|
|
1173
|
-
return { srcStat, destStat };
|
|
1174
|
-
}
|
|
1175
|
-
function checkPathsSync(src, dest, funcName, opts) {
|
|
1176
|
-
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1177
|
-
if (destStat) {
|
|
1178
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1179
|
-
const srcBaseName = path2.basename(src);
|
|
1180
|
-
const destBaseName = path2.basename(dest);
|
|
1181
|
-
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1182
|
-
return { srcStat, destStat, isChangingCase: true };
|
|
1183
|
-
}
|
|
1184
|
-
throw new Error("Source and destination must not be the same.");
|
|
1185
|
-
}
|
|
1186
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1187
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1188
|
-
}
|
|
1189
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1190
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1194
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1195
|
-
}
|
|
1196
|
-
return { srcStat, destStat };
|
|
1197
|
-
}
|
|
1198
|
-
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
1199
|
-
const srcParent = path2.resolve(path2.dirname(src));
|
|
1200
|
-
const destParent = path2.resolve(path2.dirname(dest));
|
|
1201
|
-
if (destParent === srcParent || destParent === path2.parse(destParent).root) return;
|
|
1202
|
-
let destStat;
|
|
1203
|
-
try {
|
|
1204
|
-
destStat = await fs2.stat(destParent, { bigint: true });
|
|
1205
|
-
} catch (err) {
|
|
1206
|
-
if (err.code === "ENOENT") return;
|
|
1207
|
-
throw err;
|
|
1208
|
-
}
|
|
1209
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1210
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1211
|
-
}
|
|
1212
|
-
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
1213
|
-
}
|
|
1214
|
-
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1215
|
-
const srcParent = path2.resolve(path2.dirname(src));
|
|
1216
|
-
const destParent = path2.resolve(path2.dirname(dest));
|
|
1217
|
-
if (destParent === srcParent || destParent === path2.parse(destParent).root) return;
|
|
1218
|
-
let destStat;
|
|
1219
|
-
try {
|
|
1220
|
-
destStat = fs2.statSync(destParent, { bigint: true });
|
|
1221
|
-
} catch (err) {
|
|
1222
|
-
if (err.code === "ENOENT") return;
|
|
1223
|
-
throw err;
|
|
1224
|
-
}
|
|
1225
|
-
if (areIdentical(srcStat, destStat)) {
|
|
1226
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
1227
|
-
}
|
|
1228
|
-
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1229
|
-
}
|
|
1230
|
-
function areIdentical(srcStat, destStat) {
|
|
1231
|
-
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1232
|
-
}
|
|
1233
|
-
function isSrcSubdir(src, dest) {
|
|
1234
|
-
const srcArr = path2.resolve(src).split(path2.sep).filter((i) => i);
|
|
1235
|
-
const destArr = path2.resolve(dest).split(path2.sep).filter((i) => i);
|
|
1236
|
-
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1237
|
-
}
|
|
1238
|
-
function errMsg(src, dest, funcName) {
|
|
1239
|
-
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1240
|
-
}
|
|
1241
|
-
module2.exports = {
|
|
1242
|
-
// checkPaths
|
|
1243
|
-
checkPaths: u(checkPaths),
|
|
1244
|
-
checkPathsSync,
|
|
1245
|
-
// checkParent
|
|
1246
|
-
checkParentPaths: u(checkParentPaths),
|
|
1247
|
-
checkParentPathsSync,
|
|
1248
|
-
// Misc
|
|
1249
|
-
isSrcSubdir,
|
|
1250
|
-
areIdentical
|
|
1251
|
-
};
|
|
1252
|
-
}
|
|
1253
|
-
});
|
|
1254
|
-
|
|
1255
|
-
// node_modules/fs-extra/lib/copy/copy.js
|
|
1256
|
-
var require_copy = __commonJS({
|
|
1257
|
-
"node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
|
|
1258
|
-
"use strict";
|
|
1259
|
-
var fs2 = require_fs();
|
|
1260
|
-
var path2 = require("path");
|
|
1261
|
-
var { mkdirs } = require_mkdirs();
|
|
1262
|
-
var { pathExists } = require_path_exists();
|
|
1263
|
-
var { utimesMillis } = require_utimes();
|
|
1264
|
-
var stat = require_stat();
|
|
1265
|
-
async function copy(src, dest, opts = {}) {
|
|
1266
|
-
if (typeof opts === "function") {
|
|
1267
|
-
opts = { filter: opts };
|
|
1268
|
-
}
|
|
1269
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1270
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1271
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1272
|
-
process.emitWarning(
|
|
1273
|
-
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
|
|
1274
|
-
"Warning",
|
|
1275
|
-
"fs-extra-WARN0001"
|
|
1276
|
-
);
|
|
1277
|
-
}
|
|
1278
|
-
const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
|
|
1279
|
-
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
1280
|
-
const include = await runFilter(src, dest, opts);
|
|
1281
|
-
if (!include) return;
|
|
1282
|
-
const destParent = path2.dirname(dest);
|
|
1283
|
-
const dirExists = await pathExists(destParent);
|
|
1284
|
-
if (!dirExists) {
|
|
1285
|
-
await mkdirs(destParent);
|
|
1286
|
-
}
|
|
1287
|
-
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
1288
|
-
}
|
|
1289
|
-
async function runFilter(src, dest, opts) {
|
|
1290
|
-
if (!opts.filter) return true;
|
|
1291
|
-
return opts.filter(src, dest);
|
|
1292
|
-
}
|
|
1293
|
-
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
1294
|
-
const statFn = opts.dereference ? fs2.stat : fs2.lstat;
|
|
1295
|
-
const srcStat = await statFn(src);
|
|
1296
|
-
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1297
|
-
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1298
|
-
if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1299
|
-
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1300
|
-
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1301
|
-
throw new Error(`Unknown file: ${src}`);
|
|
1302
|
-
}
|
|
1303
|
-
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
1304
|
-
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1305
|
-
if (opts.overwrite) {
|
|
1306
|
-
await fs2.unlink(dest);
|
|
1307
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1308
|
-
}
|
|
1309
|
-
if (opts.errorOnExist) {
|
|
1310
|
-
throw new Error(`'${dest}' already exists`);
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
async function copyFile(srcStat, src, dest, opts) {
|
|
1314
|
-
await fs2.copyFile(src, dest);
|
|
1315
|
-
if (opts.preserveTimestamps) {
|
|
1316
|
-
if (fileIsNotWritable(srcStat.mode)) {
|
|
1317
|
-
await makeFileWritable(dest, srcStat.mode);
|
|
1318
|
-
}
|
|
1319
|
-
const updatedSrcStat = await fs2.stat(src);
|
|
1320
|
-
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1321
|
-
}
|
|
1322
|
-
return fs2.chmod(dest, srcStat.mode);
|
|
1323
|
-
}
|
|
1324
|
-
function fileIsNotWritable(srcMode) {
|
|
1325
|
-
return (srcMode & 128) === 0;
|
|
1326
|
-
}
|
|
1327
|
-
function makeFileWritable(dest, srcMode) {
|
|
1328
|
-
return fs2.chmod(dest, srcMode | 128);
|
|
1329
|
-
}
|
|
1330
|
-
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
1331
|
-
if (!destStat) {
|
|
1332
|
-
await fs2.mkdir(dest);
|
|
1333
|
-
}
|
|
1334
|
-
const promises = [];
|
|
1335
|
-
for await (const item of await fs2.opendir(src)) {
|
|
1336
|
-
const srcItem = path2.join(src, item.name);
|
|
1337
|
-
const destItem = path2.join(dest, item.name);
|
|
1338
|
-
promises.push(
|
|
1339
|
-
runFilter(srcItem, destItem, opts).then((include) => {
|
|
1340
|
-
if (include) {
|
|
1341
|
-
return stat.checkPaths(srcItem, destItem, "copy", opts).then(({ destStat: destStat2 }) => {
|
|
1342
|
-
return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
})
|
|
1346
|
-
);
|
|
1347
|
-
}
|
|
1348
|
-
await Promise.all(promises);
|
|
1349
|
-
if (!destStat) {
|
|
1350
|
-
await fs2.chmod(dest, srcStat.mode);
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
async function onLink(destStat, src, dest, opts) {
|
|
1354
|
-
let resolvedSrc = await fs2.readlink(src);
|
|
1355
|
-
if (opts.dereference) {
|
|
1356
|
-
resolvedSrc = path2.resolve(process.cwd(), resolvedSrc);
|
|
1357
|
-
}
|
|
1358
|
-
if (!destStat) {
|
|
1359
|
-
return fs2.symlink(resolvedSrc, dest);
|
|
1360
|
-
}
|
|
1361
|
-
let resolvedDest = null;
|
|
1362
|
-
try {
|
|
1363
|
-
resolvedDest = await fs2.readlink(dest);
|
|
1364
|
-
} catch (e) {
|
|
1365
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs2.symlink(resolvedSrc, dest);
|
|
1366
|
-
throw e;
|
|
1367
|
-
}
|
|
1368
|
-
if (opts.dereference) {
|
|
1369
|
-
resolvedDest = path2.resolve(process.cwd(), resolvedDest);
|
|
1370
|
-
}
|
|
1371
|
-
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1372
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1373
|
-
}
|
|
1374
|
-
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1375
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1376
|
-
}
|
|
1377
|
-
await fs2.unlink(dest);
|
|
1378
|
-
return fs2.symlink(resolvedSrc, dest);
|
|
1379
|
-
}
|
|
1380
|
-
module2.exports = copy;
|
|
1381
|
-
}
|
|
1382
|
-
});
|
|
1383
|
-
|
|
1384
|
-
// node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1385
|
-
var require_copy_sync = __commonJS({
|
|
1386
|
-
"node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
|
|
1387
|
-
"use strict";
|
|
1388
|
-
var fs2 = require_graceful_fs();
|
|
1389
|
-
var path2 = require("path");
|
|
1390
|
-
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
1391
|
-
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
1392
|
-
var stat = require_stat();
|
|
1393
|
-
function copySync(src, dest, opts) {
|
|
1394
|
-
if (typeof opts === "function") {
|
|
1395
|
-
opts = { filter: opts };
|
|
1396
|
-
}
|
|
1397
|
-
opts = opts || {};
|
|
1398
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1399
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1400
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1401
|
-
process.emitWarning(
|
|
1402
|
-
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
|
|
1403
|
-
"Warning",
|
|
1404
|
-
"fs-extra-WARN0002"
|
|
1405
|
-
);
|
|
1406
|
-
}
|
|
1407
|
-
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
1408
|
-
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1409
|
-
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1410
|
-
const destParent = path2.dirname(dest);
|
|
1411
|
-
if (!fs2.existsSync(destParent)) mkdirsSync(destParent);
|
|
1412
|
-
return getStats(destStat, src, dest, opts);
|
|
1413
|
-
}
|
|
1414
|
-
function getStats(destStat, src, dest, opts) {
|
|
1415
|
-
const statSync = opts.dereference ? fs2.statSync : fs2.lstatSync;
|
|
1416
|
-
const srcStat = statSync(src);
|
|
1417
|
-
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1418
|
-
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1419
|
-
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1420
|
-
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1421
|
-
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1422
|
-
throw new Error(`Unknown file: ${src}`);
|
|
1423
|
-
}
|
|
1424
|
-
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1425
|
-
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1426
|
-
return mayCopyFile(srcStat, src, dest, opts);
|
|
1427
|
-
}
|
|
1428
|
-
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1429
|
-
if (opts.overwrite) {
|
|
1430
|
-
fs2.unlinkSync(dest);
|
|
1431
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1432
|
-
} else if (opts.errorOnExist) {
|
|
1433
|
-
throw new Error(`'${dest}' already exists`);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
function copyFile(srcStat, src, dest, opts) {
|
|
1437
|
-
fs2.copyFileSync(src, dest);
|
|
1438
|
-
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
1439
|
-
return setDestMode(dest, srcStat.mode);
|
|
1440
|
-
}
|
|
1441
|
-
function handleTimestamps(srcMode, src, dest) {
|
|
1442
|
-
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
|
|
1443
|
-
return setDestTimestamps(src, dest);
|
|
1444
|
-
}
|
|
1445
|
-
function fileIsNotWritable(srcMode) {
|
|
1446
|
-
return (srcMode & 128) === 0;
|
|
1447
|
-
}
|
|
1448
|
-
function makeFileWritable(dest, srcMode) {
|
|
1449
|
-
return setDestMode(dest, srcMode | 128);
|
|
1450
|
-
}
|
|
1451
|
-
function setDestMode(dest, srcMode) {
|
|
1452
|
-
return fs2.chmodSync(dest, srcMode);
|
|
1453
|
-
}
|
|
1454
|
-
function setDestTimestamps(src, dest) {
|
|
1455
|
-
const updatedSrcStat = fs2.statSync(src);
|
|
1456
|
-
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1457
|
-
}
|
|
1458
|
-
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1459
|
-
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1460
|
-
return copyDir(src, dest, opts);
|
|
1461
|
-
}
|
|
1462
|
-
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1463
|
-
fs2.mkdirSync(dest);
|
|
1464
|
-
copyDir(src, dest, opts);
|
|
1465
|
-
return setDestMode(dest, srcMode);
|
|
1466
|
-
}
|
|
1467
|
-
function copyDir(src, dest, opts) {
|
|
1468
|
-
const dir = fs2.opendirSync(src);
|
|
1469
|
-
try {
|
|
1470
|
-
let dirent;
|
|
1471
|
-
while ((dirent = dir.readSync()) !== null) {
|
|
1472
|
-
copyDirItem(dirent.name, src, dest, opts);
|
|
1473
|
-
}
|
|
1474
|
-
} finally {
|
|
1475
|
-
dir.closeSync();
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
function copyDirItem(item, src, dest, opts) {
|
|
1479
|
-
const srcItem = path2.join(src, item);
|
|
1480
|
-
const destItem = path2.join(dest, item);
|
|
1481
|
-
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
1482
|
-
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1483
|
-
return getStats(destStat, srcItem, destItem, opts);
|
|
1484
|
-
}
|
|
1485
|
-
function onLink(destStat, src, dest, opts) {
|
|
1486
|
-
let resolvedSrc = fs2.readlinkSync(src);
|
|
1487
|
-
if (opts.dereference) {
|
|
1488
|
-
resolvedSrc = path2.resolve(process.cwd(), resolvedSrc);
|
|
1489
|
-
}
|
|
1490
|
-
if (!destStat) {
|
|
1491
|
-
return fs2.symlinkSync(resolvedSrc, dest);
|
|
1492
|
-
} else {
|
|
1493
|
-
let resolvedDest;
|
|
1494
|
-
try {
|
|
1495
|
-
resolvedDest = fs2.readlinkSync(dest);
|
|
1496
|
-
} catch (err) {
|
|
1497
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs2.symlinkSync(resolvedSrc, dest);
|
|
1498
|
-
throw err;
|
|
1499
|
-
}
|
|
1500
|
-
if (opts.dereference) {
|
|
1501
|
-
resolvedDest = path2.resolve(process.cwd(), resolvedDest);
|
|
1502
|
-
}
|
|
1503
|
-
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1504
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1505
|
-
}
|
|
1506
|
-
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1507
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1508
|
-
}
|
|
1509
|
-
return copyLink(resolvedSrc, dest);
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
function copyLink(resolvedSrc, dest) {
|
|
1513
|
-
fs2.unlinkSync(dest);
|
|
1514
|
-
return fs2.symlinkSync(resolvedSrc, dest);
|
|
1515
|
-
}
|
|
1516
|
-
module2.exports = copySync;
|
|
1517
|
-
}
|
|
1518
|
-
});
|
|
1519
|
-
|
|
1520
|
-
// node_modules/fs-extra/lib/copy/index.js
|
|
1521
|
-
var require_copy2 = __commonJS({
|
|
1522
|
-
"node_modules/fs-extra/lib/copy/index.js"(exports2, module2) {
|
|
1523
|
-
"use strict";
|
|
1524
|
-
var u = require_universalify().fromPromise;
|
|
1525
|
-
module2.exports = {
|
|
1526
|
-
copy: u(require_copy()),
|
|
1527
|
-
copySync: require_copy_sync()
|
|
1528
|
-
};
|
|
1529
|
-
}
|
|
1530
|
-
});
|
|
1531
|
-
|
|
1532
|
-
// node_modules/fs-extra/lib/remove/index.js
|
|
1533
|
-
var require_remove = __commonJS({
|
|
1534
|
-
"node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
|
|
1535
|
-
"use strict";
|
|
1536
|
-
var fs2 = require_graceful_fs();
|
|
1537
|
-
var u = require_universalify().fromCallback;
|
|
1538
|
-
function remove(path2, callback) {
|
|
1539
|
-
fs2.rm(path2, { recursive: true, force: true }, callback);
|
|
1540
|
-
}
|
|
1541
|
-
function removeSync(path2) {
|
|
1542
|
-
fs2.rmSync(path2, { recursive: true, force: true });
|
|
1543
|
-
}
|
|
1544
|
-
module2.exports = {
|
|
1545
|
-
remove: u(remove),
|
|
1546
|
-
removeSync
|
|
1547
|
-
};
|
|
1548
|
-
}
|
|
1549
|
-
});
|
|
1550
|
-
|
|
1551
|
-
// node_modules/fs-extra/lib/empty/index.js
|
|
1552
|
-
var require_empty = __commonJS({
|
|
1553
|
-
"node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
|
|
1554
|
-
"use strict";
|
|
1555
|
-
var u = require_universalify().fromPromise;
|
|
1556
|
-
var fs2 = require_fs();
|
|
1557
|
-
var path2 = require("path");
|
|
1558
|
-
var mkdir = require_mkdirs();
|
|
1559
|
-
var remove = require_remove();
|
|
1560
|
-
var emptyDir = u(async function emptyDir2(dir) {
|
|
1561
|
-
let items;
|
|
1562
|
-
try {
|
|
1563
|
-
items = await fs2.readdir(dir);
|
|
1564
|
-
} catch {
|
|
1565
|
-
return mkdir.mkdirs(dir);
|
|
1566
|
-
}
|
|
1567
|
-
return Promise.all(items.map((item) => remove.remove(path2.join(dir, item))));
|
|
1568
|
-
});
|
|
1569
|
-
function emptyDirSync(dir) {
|
|
1570
|
-
let items;
|
|
1571
|
-
try {
|
|
1572
|
-
items = fs2.readdirSync(dir);
|
|
1573
|
-
} catch {
|
|
1574
|
-
return mkdir.mkdirsSync(dir);
|
|
1575
|
-
}
|
|
1576
|
-
items.forEach((item) => {
|
|
1577
|
-
item = path2.join(dir, item);
|
|
1578
|
-
remove.removeSync(item);
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
module2.exports = {
|
|
1582
|
-
emptyDirSync,
|
|
1583
|
-
emptydirSync: emptyDirSync,
|
|
1584
|
-
emptyDir,
|
|
1585
|
-
emptydir: emptyDir
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1588
|
-
});
|
|
1589
|
-
|
|
1590
|
-
// node_modules/fs-extra/lib/ensure/file.js
|
|
1591
|
-
var require_file = __commonJS({
|
|
1592
|
-
"node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
|
|
1593
|
-
"use strict";
|
|
1594
|
-
var u = require_universalify().fromPromise;
|
|
1595
|
-
var path2 = require("path");
|
|
1596
|
-
var fs2 = require_fs();
|
|
1597
|
-
var mkdir = require_mkdirs();
|
|
1598
|
-
async function createFile(file) {
|
|
1599
|
-
let stats;
|
|
1600
|
-
try {
|
|
1601
|
-
stats = await fs2.stat(file);
|
|
1602
|
-
} catch {
|
|
1603
|
-
}
|
|
1604
|
-
if (stats && stats.isFile()) return;
|
|
1605
|
-
const dir = path2.dirname(file);
|
|
1606
|
-
let dirStats = null;
|
|
1607
|
-
try {
|
|
1608
|
-
dirStats = await fs2.stat(dir);
|
|
1609
|
-
} catch (err) {
|
|
1610
|
-
if (err.code === "ENOENT") {
|
|
1611
|
-
await mkdir.mkdirs(dir);
|
|
1612
|
-
await fs2.writeFile(file, "");
|
|
1613
|
-
return;
|
|
1614
|
-
} else {
|
|
1615
|
-
throw err;
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
if (dirStats.isDirectory()) {
|
|
1619
|
-
await fs2.writeFile(file, "");
|
|
1620
|
-
} else {
|
|
1621
|
-
await fs2.readdir(dir);
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
function createFileSync(file) {
|
|
1625
|
-
let stats;
|
|
1626
|
-
try {
|
|
1627
|
-
stats = fs2.statSync(file);
|
|
1628
|
-
} catch {
|
|
1629
|
-
}
|
|
1630
|
-
if (stats && stats.isFile()) return;
|
|
1631
|
-
const dir = path2.dirname(file);
|
|
1632
|
-
try {
|
|
1633
|
-
if (!fs2.statSync(dir).isDirectory()) {
|
|
1634
|
-
fs2.readdirSync(dir);
|
|
1635
|
-
}
|
|
1636
|
-
} catch (err) {
|
|
1637
|
-
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
|
|
1638
|
-
else throw err;
|
|
1639
|
-
}
|
|
1640
|
-
fs2.writeFileSync(file, "");
|
|
1641
|
-
}
|
|
1642
|
-
module2.exports = {
|
|
1643
|
-
createFile: u(createFile),
|
|
1644
|
-
createFileSync
|
|
1645
|
-
};
|
|
1646
|
-
}
|
|
1647
|
-
});
|
|
1648
|
-
|
|
1649
|
-
// node_modules/fs-extra/lib/ensure/link.js
|
|
1650
|
-
var require_link = __commonJS({
|
|
1651
|
-
"node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
|
|
1652
|
-
"use strict";
|
|
1653
|
-
var u = require_universalify().fromPromise;
|
|
1654
|
-
var path2 = require("path");
|
|
1655
|
-
var fs2 = require_fs();
|
|
1656
|
-
var mkdir = require_mkdirs();
|
|
1657
|
-
var { pathExists } = require_path_exists();
|
|
1658
|
-
var { areIdentical } = require_stat();
|
|
1659
|
-
async function createLink(srcpath, dstpath) {
|
|
1660
|
-
let dstStat;
|
|
1661
|
-
try {
|
|
1662
|
-
dstStat = await fs2.lstat(dstpath);
|
|
1663
|
-
} catch {
|
|
1664
|
-
}
|
|
1665
|
-
let srcStat;
|
|
1666
|
-
try {
|
|
1667
|
-
srcStat = await fs2.lstat(srcpath);
|
|
1668
|
-
} catch (err) {
|
|
1669
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
1670
|
-
throw err;
|
|
1671
|
-
}
|
|
1672
|
-
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
1673
|
-
const dir = path2.dirname(dstpath);
|
|
1674
|
-
const dirExists = await pathExists(dir);
|
|
1675
|
-
if (!dirExists) {
|
|
1676
|
-
await mkdir.mkdirs(dir);
|
|
1677
|
-
}
|
|
1678
|
-
await fs2.link(srcpath, dstpath);
|
|
1679
|
-
}
|
|
1680
|
-
function createLinkSync(srcpath, dstpath) {
|
|
1681
|
-
let dstStat;
|
|
1682
|
-
try {
|
|
1683
|
-
dstStat = fs2.lstatSync(dstpath);
|
|
1684
|
-
} catch {
|
|
1685
|
-
}
|
|
1686
|
-
try {
|
|
1687
|
-
const srcStat = fs2.lstatSync(srcpath);
|
|
1688
|
-
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
1689
|
-
} catch (err) {
|
|
1690
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
1691
|
-
throw err;
|
|
1692
|
-
}
|
|
1693
|
-
const dir = path2.dirname(dstpath);
|
|
1694
|
-
const dirExists = fs2.existsSync(dir);
|
|
1695
|
-
if (dirExists) return fs2.linkSync(srcpath, dstpath);
|
|
1696
|
-
mkdir.mkdirsSync(dir);
|
|
1697
|
-
return fs2.linkSync(srcpath, dstpath);
|
|
1698
|
-
}
|
|
1699
|
-
module2.exports = {
|
|
1700
|
-
createLink: u(createLink),
|
|
1701
|
-
createLinkSync
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
|
|
1706
|
-
// node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
1707
|
-
var require_symlink_paths = __commonJS({
|
|
1708
|
-
"node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
|
|
1709
|
-
"use strict";
|
|
1710
|
-
var path2 = require("path");
|
|
1711
|
-
var fs2 = require_fs();
|
|
1712
|
-
var { pathExists } = require_path_exists();
|
|
1713
|
-
var u = require_universalify().fromPromise;
|
|
1714
|
-
async function symlinkPaths(srcpath, dstpath) {
|
|
1715
|
-
if (path2.isAbsolute(srcpath)) {
|
|
1716
|
-
try {
|
|
1717
|
-
await fs2.lstat(srcpath);
|
|
1718
|
-
} catch (err) {
|
|
1719
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1720
|
-
throw err;
|
|
1721
|
-
}
|
|
1722
|
-
return {
|
|
1723
|
-
toCwd: srcpath,
|
|
1724
|
-
toDst: srcpath
|
|
1725
|
-
};
|
|
1726
|
-
}
|
|
1727
|
-
const dstdir = path2.dirname(dstpath);
|
|
1728
|
-
const relativeToDst = path2.join(dstdir, srcpath);
|
|
1729
|
-
const exists = await pathExists(relativeToDst);
|
|
1730
|
-
if (exists) {
|
|
1731
|
-
return {
|
|
1732
|
-
toCwd: relativeToDst,
|
|
1733
|
-
toDst: srcpath
|
|
1734
|
-
};
|
|
1735
|
-
}
|
|
1736
|
-
try {
|
|
1737
|
-
await fs2.lstat(srcpath);
|
|
1738
|
-
} catch (err) {
|
|
1739
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1740
|
-
throw err;
|
|
1741
|
-
}
|
|
1742
|
-
return {
|
|
1743
|
-
toCwd: srcpath,
|
|
1744
|
-
toDst: path2.relative(dstdir, srcpath)
|
|
1745
|
-
};
|
|
1746
|
-
}
|
|
1747
|
-
function symlinkPathsSync(srcpath, dstpath) {
|
|
1748
|
-
if (path2.isAbsolute(srcpath)) {
|
|
1749
|
-
const exists2 = fs2.existsSync(srcpath);
|
|
1750
|
-
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
1751
|
-
return {
|
|
1752
|
-
toCwd: srcpath,
|
|
1753
|
-
toDst: srcpath
|
|
1754
|
-
};
|
|
1755
|
-
}
|
|
1756
|
-
const dstdir = path2.dirname(dstpath);
|
|
1757
|
-
const relativeToDst = path2.join(dstdir, srcpath);
|
|
1758
|
-
const exists = fs2.existsSync(relativeToDst);
|
|
1759
|
-
if (exists) {
|
|
1760
|
-
return {
|
|
1761
|
-
toCwd: relativeToDst,
|
|
1762
|
-
toDst: srcpath
|
|
1763
|
-
};
|
|
1764
|
-
}
|
|
1765
|
-
const srcExists = fs2.existsSync(srcpath);
|
|
1766
|
-
if (!srcExists) throw new Error("relative srcpath does not exist");
|
|
1767
|
-
return {
|
|
1768
|
-
toCwd: srcpath,
|
|
1769
|
-
toDst: path2.relative(dstdir, srcpath)
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
|
-
module2.exports = {
|
|
1773
|
-
symlinkPaths: u(symlinkPaths),
|
|
1774
|
-
symlinkPathsSync
|
|
1775
|
-
};
|
|
1776
|
-
}
|
|
1777
|
-
});
|
|
1778
|
-
|
|
1779
|
-
// node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
1780
|
-
var require_symlink_type = __commonJS({
|
|
1781
|
-
"node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
|
|
1782
|
-
"use strict";
|
|
1783
|
-
var fs2 = require_fs();
|
|
1784
|
-
var u = require_universalify().fromPromise;
|
|
1785
|
-
async function symlinkType(srcpath, type) {
|
|
1786
|
-
if (type) return type;
|
|
1787
|
-
let stats;
|
|
1788
|
-
try {
|
|
1789
|
-
stats = await fs2.lstat(srcpath);
|
|
1790
|
-
} catch {
|
|
1791
|
-
return "file";
|
|
1792
|
-
}
|
|
1793
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1794
|
-
}
|
|
1795
|
-
function symlinkTypeSync(srcpath, type) {
|
|
1796
|
-
if (type) return type;
|
|
1797
|
-
let stats;
|
|
1798
|
-
try {
|
|
1799
|
-
stats = fs2.lstatSync(srcpath);
|
|
1800
|
-
} catch {
|
|
1801
|
-
return "file";
|
|
1802
|
-
}
|
|
1803
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1804
|
-
}
|
|
1805
|
-
module2.exports = {
|
|
1806
|
-
symlinkType: u(symlinkType),
|
|
1807
|
-
symlinkTypeSync
|
|
1808
|
-
};
|
|
1809
|
-
}
|
|
1810
|
-
});
|
|
1811
|
-
|
|
1812
|
-
// node_modules/fs-extra/lib/ensure/symlink.js
|
|
1813
|
-
var require_symlink = __commonJS({
|
|
1814
|
-
"node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
|
|
1815
|
-
"use strict";
|
|
1816
|
-
var u = require_universalify().fromPromise;
|
|
1817
|
-
var path2 = require("path");
|
|
1818
|
-
var fs2 = require_fs();
|
|
1819
|
-
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
1820
|
-
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
1821
|
-
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
1822
|
-
var { pathExists } = require_path_exists();
|
|
1823
|
-
var { areIdentical } = require_stat();
|
|
1824
|
-
async function createSymlink(srcpath, dstpath, type) {
|
|
1825
|
-
let stats;
|
|
1826
|
-
try {
|
|
1827
|
-
stats = await fs2.lstat(dstpath);
|
|
1828
|
-
} catch {
|
|
1829
|
-
}
|
|
1830
|
-
if (stats && stats.isSymbolicLink()) {
|
|
1831
|
-
const [srcStat, dstStat] = await Promise.all([
|
|
1832
|
-
fs2.stat(srcpath),
|
|
1833
|
-
fs2.stat(dstpath)
|
|
1834
|
-
]);
|
|
1835
|
-
if (areIdentical(srcStat, dstStat)) return;
|
|
1836
|
-
}
|
|
1837
|
-
const relative = await symlinkPaths(srcpath, dstpath);
|
|
1838
|
-
srcpath = relative.toDst;
|
|
1839
|
-
const toType = await symlinkType(relative.toCwd, type);
|
|
1840
|
-
const dir = path2.dirname(dstpath);
|
|
1841
|
-
if (!await pathExists(dir)) {
|
|
1842
|
-
await mkdirs(dir);
|
|
1843
|
-
}
|
|
1844
|
-
return fs2.symlink(srcpath, dstpath, toType);
|
|
1845
|
-
}
|
|
1846
|
-
function createSymlinkSync(srcpath, dstpath, type) {
|
|
1847
|
-
let stats;
|
|
1848
|
-
try {
|
|
1849
|
-
stats = fs2.lstatSync(dstpath);
|
|
1850
|
-
} catch {
|
|
1851
|
-
}
|
|
1852
|
-
if (stats && stats.isSymbolicLink()) {
|
|
1853
|
-
const srcStat = fs2.statSync(srcpath);
|
|
1854
|
-
const dstStat = fs2.statSync(dstpath);
|
|
1855
|
-
if (areIdentical(srcStat, dstStat)) return;
|
|
1856
|
-
}
|
|
1857
|
-
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
1858
|
-
srcpath = relative.toDst;
|
|
1859
|
-
type = symlinkTypeSync(relative.toCwd, type);
|
|
1860
|
-
const dir = path2.dirname(dstpath);
|
|
1861
|
-
const exists = fs2.existsSync(dir);
|
|
1862
|
-
if (exists) return fs2.symlinkSync(srcpath, dstpath, type);
|
|
1863
|
-
mkdirsSync(dir);
|
|
1864
|
-
return fs2.symlinkSync(srcpath, dstpath, type);
|
|
1865
|
-
}
|
|
1866
|
-
module2.exports = {
|
|
1867
|
-
createSymlink: u(createSymlink),
|
|
1868
|
-
createSymlinkSync
|
|
1869
|
-
};
|
|
1870
|
-
}
|
|
1871
|
-
});
|
|
1872
|
-
|
|
1873
|
-
// node_modules/fs-extra/lib/ensure/index.js
|
|
1874
|
-
var require_ensure = __commonJS({
|
|
1875
|
-
"node_modules/fs-extra/lib/ensure/index.js"(exports2, module2) {
|
|
1876
|
-
"use strict";
|
|
1877
|
-
var { createFile, createFileSync } = require_file();
|
|
1878
|
-
var { createLink, createLinkSync } = require_link();
|
|
1879
|
-
var { createSymlink, createSymlinkSync } = require_symlink();
|
|
1880
|
-
module2.exports = {
|
|
1881
|
-
// file
|
|
1882
|
-
createFile,
|
|
1883
|
-
createFileSync,
|
|
1884
|
-
ensureFile: createFile,
|
|
1885
|
-
ensureFileSync: createFileSync,
|
|
1886
|
-
// link
|
|
1887
|
-
createLink,
|
|
1888
|
-
createLinkSync,
|
|
1889
|
-
ensureLink: createLink,
|
|
1890
|
-
ensureLinkSync: createLinkSync,
|
|
1891
|
-
// symlink
|
|
1892
|
-
createSymlink,
|
|
1893
|
-
createSymlinkSync,
|
|
1894
|
-
ensureSymlink: createSymlink,
|
|
1895
|
-
ensureSymlinkSync: createSymlinkSync
|
|
1896
|
-
};
|
|
1897
|
-
}
|
|
1898
|
-
});
|
|
1899
|
-
|
|
1900
|
-
// node_modules/jsonfile/utils.js
|
|
1901
|
-
var require_utils2 = __commonJS({
|
|
1902
|
-
"node_modules/jsonfile/utils.js"(exports2, module2) {
|
|
1903
|
-
function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
1904
|
-
const EOF = finalEOL ? EOL : "";
|
|
1905
|
-
const str = JSON.stringify(obj, replacer, spaces);
|
|
1906
|
-
return str.replace(/\n/g, EOL) + EOF;
|
|
1907
|
-
}
|
|
1908
|
-
function stripBom(content) {
|
|
1909
|
-
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
1910
|
-
return content.replace(/^\uFEFF/, "");
|
|
1911
|
-
}
|
|
1912
|
-
module2.exports = { stringify, stripBom };
|
|
1913
|
-
}
|
|
1914
|
-
});
|
|
1915
|
-
|
|
1916
|
-
// node_modules/jsonfile/index.js
|
|
1917
|
-
var require_jsonfile = __commonJS({
|
|
1918
|
-
"node_modules/jsonfile/index.js"(exports2, module2) {
|
|
1919
|
-
var _fs;
|
|
1920
|
-
try {
|
|
1921
|
-
_fs = require_graceful_fs();
|
|
1922
|
-
} catch (_) {
|
|
1923
|
-
_fs = require("fs");
|
|
1924
|
-
}
|
|
1925
|
-
var universalify = require_universalify();
|
|
1926
|
-
var { stringify, stripBom } = require_utils2();
|
|
1927
|
-
async function _readFile(file, options = {}) {
|
|
1928
|
-
if (typeof options === "string") {
|
|
1929
|
-
options = { encoding: options };
|
|
1930
|
-
}
|
|
1931
|
-
const fs2 = options.fs || _fs;
|
|
1932
|
-
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1933
|
-
let data = await universalify.fromCallback(fs2.readFile)(file, options);
|
|
1934
|
-
data = stripBom(data);
|
|
1935
|
-
let obj;
|
|
1936
|
-
try {
|
|
1937
|
-
obj = JSON.parse(data, options ? options.reviver : null);
|
|
1938
|
-
} catch (err) {
|
|
1939
|
-
if (shouldThrow) {
|
|
1940
|
-
err.message = `${file}: ${err.message}`;
|
|
1941
|
-
throw err;
|
|
1942
|
-
} else {
|
|
1943
|
-
return null;
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
return obj;
|
|
1947
|
-
}
|
|
1948
|
-
var readFile = universalify.fromPromise(_readFile);
|
|
1949
|
-
function readFileSync(file, options = {}) {
|
|
1950
|
-
if (typeof options === "string") {
|
|
1951
|
-
options = { encoding: options };
|
|
1952
|
-
}
|
|
1953
|
-
const fs2 = options.fs || _fs;
|
|
1954
|
-
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1955
|
-
try {
|
|
1956
|
-
let content = fs2.readFileSync(file, options);
|
|
1957
|
-
content = stripBom(content);
|
|
1958
|
-
return JSON.parse(content, options.reviver);
|
|
1959
|
-
} catch (err) {
|
|
1960
|
-
if (shouldThrow) {
|
|
1961
|
-
err.message = `${file}: ${err.message}`;
|
|
1962
|
-
throw err;
|
|
1963
|
-
} else {
|
|
1964
|
-
return null;
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
async function _writeFile(file, obj, options = {}) {
|
|
1969
|
-
const fs2 = options.fs || _fs;
|
|
1970
|
-
const str = stringify(obj, options);
|
|
1971
|
-
await universalify.fromCallback(fs2.writeFile)(file, str, options);
|
|
1972
|
-
}
|
|
1973
|
-
var writeFile = universalify.fromPromise(_writeFile);
|
|
1974
|
-
function writeFileSync(file, obj, options = {}) {
|
|
1975
|
-
const fs2 = options.fs || _fs;
|
|
1976
|
-
const str = stringify(obj, options);
|
|
1977
|
-
return fs2.writeFileSync(file, str, options);
|
|
1978
|
-
}
|
|
1979
|
-
module2.exports = {
|
|
1980
|
-
readFile,
|
|
1981
|
-
readFileSync,
|
|
1982
|
-
writeFile,
|
|
1983
|
-
writeFileSync
|
|
1984
|
-
};
|
|
1985
|
-
}
|
|
1986
|
-
});
|
|
1987
|
-
|
|
1988
|
-
// node_modules/fs-extra/lib/json/jsonfile.js
|
|
1989
|
-
var require_jsonfile2 = __commonJS({
|
|
1990
|
-
"node_modules/fs-extra/lib/json/jsonfile.js"(exports2, module2) {
|
|
1991
|
-
"use strict";
|
|
1992
|
-
var jsonFile = require_jsonfile();
|
|
1993
|
-
module2.exports = {
|
|
1994
|
-
// jsonfile exports
|
|
1995
|
-
readJson: jsonFile.readFile,
|
|
1996
|
-
readJsonSync: jsonFile.readFileSync,
|
|
1997
|
-
writeJson: jsonFile.writeFile,
|
|
1998
|
-
writeJsonSync: jsonFile.writeFileSync
|
|
1999
|
-
};
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
|
|
2003
|
-
// node_modules/fs-extra/lib/output-file/index.js
|
|
2004
|
-
var require_output_file = __commonJS({
|
|
2005
|
-
"node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
|
|
2006
|
-
"use strict";
|
|
2007
|
-
var u = require_universalify().fromPromise;
|
|
2008
|
-
var fs2 = require_fs();
|
|
2009
|
-
var path2 = require("path");
|
|
2010
|
-
var mkdir = require_mkdirs();
|
|
2011
|
-
var pathExists = require_path_exists().pathExists;
|
|
2012
|
-
async function outputFile(file, data, encoding = "utf-8") {
|
|
2013
|
-
const dir = path2.dirname(file);
|
|
2014
|
-
if (!await pathExists(dir)) {
|
|
2015
|
-
await mkdir.mkdirs(dir);
|
|
2016
|
-
}
|
|
2017
|
-
return fs2.writeFile(file, data, encoding);
|
|
2018
|
-
}
|
|
2019
|
-
function outputFileSync(file, ...args) {
|
|
2020
|
-
const dir = path2.dirname(file);
|
|
2021
|
-
if (!fs2.existsSync(dir)) {
|
|
2022
|
-
mkdir.mkdirsSync(dir);
|
|
2023
|
-
}
|
|
2024
|
-
fs2.writeFileSync(file, ...args);
|
|
2025
|
-
}
|
|
2026
|
-
module2.exports = {
|
|
2027
|
-
outputFile: u(outputFile),
|
|
2028
|
-
outputFileSync
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
});
|
|
2032
|
-
|
|
2033
|
-
// node_modules/fs-extra/lib/json/output-json.js
|
|
2034
|
-
var require_output_json = __commonJS({
|
|
2035
|
-
"node_modules/fs-extra/lib/json/output-json.js"(exports2, module2) {
|
|
2036
|
-
"use strict";
|
|
2037
|
-
var { stringify } = require_utils2();
|
|
2038
|
-
var { outputFile } = require_output_file();
|
|
2039
|
-
async function outputJson(file, data, options = {}) {
|
|
2040
|
-
const str = stringify(data, options);
|
|
2041
|
-
await outputFile(file, str, options);
|
|
2042
|
-
}
|
|
2043
|
-
module2.exports = outputJson;
|
|
2044
|
-
}
|
|
2045
|
-
});
|
|
2046
|
-
|
|
2047
|
-
// node_modules/fs-extra/lib/json/output-json-sync.js
|
|
2048
|
-
var require_output_json_sync = __commonJS({
|
|
2049
|
-
"node_modules/fs-extra/lib/json/output-json-sync.js"(exports2, module2) {
|
|
2050
|
-
"use strict";
|
|
2051
|
-
var { stringify } = require_utils2();
|
|
2052
|
-
var { outputFileSync } = require_output_file();
|
|
2053
|
-
function outputJsonSync(file, data, options) {
|
|
2054
|
-
const str = stringify(data, options);
|
|
2055
|
-
outputFileSync(file, str, options);
|
|
2056
|
-
}
|
|
2057
|
-
module2.exports = outputJsonSync;
|
|
2058
|
-
}
|
|
2059
|
-
});
|
|
2060
|
-
|
|
2061
|
-
// node_modules/fs-extra/lib/json/index.js
|
|
2062
|
-
var require_json = __commonJS({
|
|
2063
|
-
"node_modules/fs-extra/lib/json/index.js"(exports2, module2) {
|
|
2064
|
-
"use strict";
|
|
2065
|
-
var u = require_universalify().fromPromise;
|
|
2066
|
-
var jsonFile = require_jsonfile2();
|
|
2067
|
-
jsonFile.outputJson = u(require_output_json());
|
|
2068
|
-
jsonFile.outputJsonSync = require_output_json_sync();
|
|
2069
|
-
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2070
|
-
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2071
|
-
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2072
|
-
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2073
|
-
jsonFile.readJSON = jsonFile.readJson;
|
|
2074
|
-
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2075
|
-
module2.exports = jsonFile;
|
|
2076
|
-
}
|
|
2077
|
-
});
|
|
2078
|
-
|
|
2079
|
-
// node_modules/fs-extra/lib/move/move.js
|
|
2080
|
-
var require_move = __commonJS({
|
|
2081
|
-
"node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
|
|
2082
|
-
"use strict";
|
|
2083
|
-
var fs2 = require_fs();
|
|
2084
|
-
var path2 = require("path");
|
|
2085
|
-
var { copy } = require_copy2();
|
|
2086
|
-
var { remove } = require_remove();
|
|
2087
|
-
var { mkdirp } = require_mkdirs();
|
|
2088
|
-
var { pathExists } = require_path_exists();
|
|
2089
|
-
var stat = require_stat();
|
|
2090
|
-
async function move(src, dest, opts = {}) {
|
|
2091
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2092
|
-
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
2093
|
-
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
2094
|
-
const destParent = path2.dirname(dest);
|
|
2095
|
-
const parsedParentPath = path2.parse(destParent);
|
|
2096
|
-
if (parsedParentPath.root !== destParent) {
|
|
2097
|
-
await mkdirp(destParent);
|
|
2098
|
-
}
|
|
2099
|
-
return doRename(src, dest, overwrite, isChangingCase);
|
|
2100
|
-
}
|
|
2101
|
-
async function doRename(src, dest, overwrite, isChangingCase) {
|
|
2102
|
-
if (!isChangingCase) {
|
|
2103
|
-
if (overwrite) {
|
|
2104
|
-
await remove(dest);
|
|
2105
|
-
} else if (await pathExists(dest)) {
|
|
2106
|
-
throw new Error("dest already exists.");
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
try {
|
|
2110
|
-
await fs2.rename(src, dest);
|
|
2111
|
-
} catch (err) {
|
|
2112
|
-
if (err.code !== "EXDEV") {
|
|
2113
|
-
throw err;
|
|
2114
|
-
}
|
|
2115
|
-
await moveAcrossDevice(src, dest, overwrite);
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
async function moveAcrossDevice(src, dest, overwrite) {
|
|
2119
|
-
const opts = {
|
|
2120
|
-
overwrite,
|
|
2121
|
-
errorOnExist: true,
|
|
2122
|
-
preserveTimestamps: true
|
|
2123
|
-
};
|
|
2124
|
-
await copy(src, dest, opts);
|
|
2125
|
-
return remove(src);
|
|
2126
|
-
}
|
|
2127
|
-
module2.exports = move;
|
|
2128
|
-
}
|
|
2129
|
-
});
|
|
2130
|
-
|
|
2131
|
-
// node_modules/fs-extra/lib/move/move-sync.js
|
|
2132
|
-
var require_move_sync = __commonJS({
|
|
2133
|
-
"node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
|
|
2134
|
-
"use strict";
|
|
2135
|
-
var fs2 = require_graceful_fs();
|
|
2136
|
-
var path2 = require("path");
|
|
2137
|
-
var copySync = require_copy2().copySync;
|
|
2138
|
-
var removeSync = require_remove().removeSync;
|
|
2139
|
-
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
2140
|
-
var stat = require_stat();
|
|
2141
|
-
function moveSync(src, dest, opts) {
|
|
2142
|
-
opts = opts || {};
|
|
2143
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2144
|
-
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
2145
|
-
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
2146
|
-
if (!isParentRoot(dest)) mkdirpSync(path2.dirname(dest));
|
|
2147
|
-
return doRename(src, dest, overwrite, isChangingCase);
|
|
2148
|
-
}
|
|
2149
|
-
function isParentRoot(dest) {
|
|
2150
|
-
const parent = path2.dirname(dest);
|
|
2151
|
-
const parsedPath = path2.parse(parent);
|
|
2152
|
-
return parsedPath.root === parent;
|
|
2153
|
-
}
|
|
2154
|
-
function doRename(src, dest, overwrite, isChangingCase) {
|
|
2155
|
-
if (isChangingCase) return rename(src, dest, overwrite);
|
|
2156
|
-
if (overwrite) {
|
|
2157
|
-
removeSync(dest);
|
|
2158
|
-
return rename(src, dest, overwrite);
|
|
2159
|
-
}
|
|
2160
|
-
if (fs2.existsSync(dest)) throw new Error("dest already exists.");
|
|
2161
|
-
return rename(src, dest, overwrite);
|
|
2162
|
-
}
|
|
2163
|
-
function rename(src, dest, overwrite) {
|
|
2164
|
-
try {
|
|
2165
|
-
fs2.renameSync(src, dest);
|
|
2166
|
-
} catch (err) {
|
|
2167
|
-
if (err.code !== "EXDEV") throw err;
|
|
2168
|
-
return moveAcrossDevice(src, dest, overwrite);
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
function moveAcrossDevice(src, dest, overwrite) {
|
|
2172
|
-
const opts = {
|
|
2173
|
-
overwrite,
|
|
2174
|
-
errorOnExist: true,
|
|
2175
|
-
preserveTimestamps: true
|
|
2176
|
-
};
|
|
2177
|
-
copySync(src, dest, opts);
|
|
2178
|
-
return removeSync(src);
|
|
2179
|
-
}
|
|
2180
|
-
module2.exports = moveSync;
|
|
2181
|
-
}
|
|
2182
|
-
});
|
|
2183
|
-
|
|
2184
|
-
// node_modules/fs-extra/lib/move/index.js
|
|
2185
|
-
var require_move2 = __commonJS({
|
|
2186
|
-
"node_modules/fs-extra/lib/move/index.js"(exports2, module2) {
|
|
2187
|
-
"use strict";
|
|
2188
|
-
var u = require_universalify().fromPromise;
|
|
2189
|
-
module2.exports = {
|
|
2190
|
-
move: u(require_move()),
|
|
2191
|
-
moveSync: require_move_sync()
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
});
|
|
2195
|
-
|
|
2196
|
-
// node_modules/fs-extra/lib/index.js
|
|
2197
|
-
var require_lib = __commonJS({
|
|
2198
|
-
"node_modules/fs-extra/lib/index.js"(exports2, module2) {
|
|
2199
|
-
"use strict";
|
|
2200
|
-
module2.exports = {
|
|
2201
|
-
// Export promiseified graceful-fs:
|
|
2202
|
-
...require_fs(),
|
|
2203
|
-
// Export extra methods:
|
|
2204
|
-
...require_copy2(),
|
|
2205
|
-
...require_empty(),
|
|
2206
|
-
...require_ensure(),
|
|
2207
|
-
...require_json(),
|
|
2208
|
-
...require_mkdirs(),
|
|
2209
|
-
...require_move2(),
|
|
2210
|
-
...require_output_file(),
|
|
2211
|
-
...require_path_exists(),
|
|
2212
|
-
...require_remove()
|
|
2213
|
-
};
|
|
2214
|
-
}
|
|
2215
|
-
});
|
|
2216
|
-
|
|
2217
|
-
// node_modules/color-name-lib/index.js
|
|
2218
|
-
var require_color_name_lib = __commonJS({
|
|
2219
|
-
"node_modules/color-name-lib/index.js"(exports2, module2) {
|
|
2220
|
-
var fs2 = require_lib();
|
|
2221
|
-
var path2 = require("path");
|
|
2222
|
-
var colorDataCache = {};
|
|
2223
|
-
function toRgb(color) {
|
|
2224
|
-
if (typeof color === "string") {
|
|
2225
|
-
const hex2 = color.startsWith("#") ? color.slice(1) : color;
|
|
2226
|
-
if (hex2.length !== 6 || !/^[0-9A-Fa-f]{6}$/.test(hex2)) {
|
|
2227
|
-
throw new Error(`Invalid color format: ${color}`);
|
|
2228
|
-
}
|
|
2229
|
-
const bigint = parseInt(hex2, 16);
|
|
2230
|
-
return {
|
|
2231
|
-
r: bigint >> 16 & 255,
|
|
2232
|
-
g: bigint >> 8 & 255,
|
|
2233
|
-
b: bigint & 255
|
|
2234
|
-
};
|
|
2235
|
-
}
|
|
2236
|
-
if (Array.isArray(color) && color.length === 3 && color.every((c) => Number.isInteger(c) && c >= 0 && c <= 255)) {
|
|
2237
|
-
return { r: color[0], g: color[1], b: color[2] };
|
|
2238
|
-
}
|
|
2239
|
-
if (typeof color === "object" && color !== null && Number.isInteger(color.r) && color.r >= 0 && color.r <= 255 && Number.isInteger(color.g) && color.g >= 0 && color.g <= 255 && Number.isInteger(color.b) && color.b >= 0 && color.b <= 255) {
|
|
2240
|
-
return color;
|
|
2241
|
-
}
|
|
2242
|
-
throw new Error(`Invalid color format: ${color}`);
|
|
2243
|
-
}
|
|
2244
|
-
function colorDistance(color1, color2) {
|
|
2245
|
-
const rMean = (color1.r + color2.r) / 2;
|
|
2246
|
-
const rDiff = color1.r - color2.r;
|
|
2247
|
-
const gDiff = color1.g - color2.g;
|
|
2248
|
-
const bDiff = color1.b - color2.b;
|
|
2249
|
-
return Math.sqrt(
|
|
2250
|
-
(2 + rMean / 256) * rDiff ** 2 + 4 * gDiff ** 2 + (2 + (255 - rMean) / 256) * bDiff ** 2
|
|
2251
|
-
);
|
|
2252
|
-
}
|
|
2253
|
-
function getClosestColor(color, language) {
|
|
2254
|
-
if (!colorDataCache[language]) {
|
|
2255
|
-
const filePath = path2.join(__dirname, `./data/${language}.json`);
|
|
2256
|
-
if (!fs2.existsSync(filePath)) {
|
|
2257
|
-
throw new Error(`Language data file not found: ${language}.json`);
|
|
2258
|
-
}
|
|
2259
|
-
colorDataCache[language] = fs2.readJsonSync(filePath);
|
|
2260
|
-
}
|
|
2261
|
-
const colors = colorDataCache[language];
|
|
2262
|
-
const targetColor = toRgb(color);
|
|
2263
|
-
let closestColor = null;
|
|
2264
|
-
let minDistance = Infinity;
|
|
2265
|
-
for (const [colorHex, colorName] of Object.entries(colors)) {
|
|
2266
|
-
const currentColor = toRgb(colorHex);
|
|
2267
|
-
const distance = colorDistance(targetColor, currentColor);
|
|
2268
|
-
if (distance < minDistance) {
|
|
2269
|
-
minDistance = distance;
|
|
2270
|
-
closestColor = colorName;
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
return closestColor;
|
|
2274
|
-
}
|
|
2275
|
-
function name(color, language = "en") {
|
|
2276
|
-
if (!color) throw new Error("Color input is required.");
|
|
2277
|
-
const supportedLanguages = ["en", "ja", "cn"];
|
|
2278
|
-
if (!supportedLanguages.includes(language)) {
|
|
2279
|
-
throw new Error(`Unsupported language: ${language}`);
|
|
2280
|
-
}
|
|
2281
|
-
return getClosestColor(color, language);
|
|
2282
|
-
}
|
|
2283
|
-
module2.exports = name;
|
|
2284
|
-
}
|
|
2285
|
-
});
|
|
2286
|
-
|
|
2287
|
-
// node_modules/@randplus/color/src/word.js
|
|
2288
|
-
var require_word = __commonJS({
|
|
2289
|
-
"node_modules/@randplus/color/src/word.js"(exports2, module2) {
|
|
2290
|
-
var colorName = require_color_name_lib();
|
|
2291
|
-
function word(language = "en") {
|
|
2292
|
-
const langList = ["en", "ja", "cn"];
|
|
2293
|
-
if (!langList.includes(language)) throw new Error("invalid language.");
|
|
2294
|
-
const color = require_hex()();
|
|
2295
|
-
return colorName(color, language);
|
|
2296
|
-
}
|
|
2297
|
-
module2.exports = word;
|
|
2298
|
-
}
|
|
2299
|
-
});
|
|
2300
|
-
|
|
2301
|
-
// node_modules/@randplus/color/src/conv/cword.js
|
|
2302
|
-
var require_cword = __commonJS({
|
|
2303
|
-
"node_modules/@randplus/color/src/conv/cword.js"(exports2, module2) {
|
|
2304
|
-
function convWord(options = {}) {
|
|
2305
|
-
if (typeof options !== "object") throw new Error("options must be object.");
|
|
2306
|
-
return require_word()(options.language);
|
|
2307
|
-
}
|
|
2308
|
-
module2.exports = convWord;
|
|
2309
|
-
}
|
|
2310
|
-
});
|
|
2311
|
-
|
|
2312
|
-
// require("./src/conv/c*") in node_modules/@randplus/color/index.js
|
|
2313
|
-
var globRequire_src_conv_c;
|
|
2314
|
-
var init_ = __esm({
|
|
2315
|
-
'require("./src/conv/c*") in node_modules/@randplus/color/index.js'() {
|
|
2316
|
-
globRequire_src_conv_c = __glob({
|
|
2317
|
-
"./src/conv/chex.js": () => require_chex(),
|
|
2318
|
-
"./src/conv/crgb.js": () => require_crgb(),
|
|
2319
|
-
"./src/conv/cword.js": () => require_cword()
|
|
2320
|
-
});
|
|
2321
|
-
}
|
|
2322
|
-
});
|
|
2323
|
-
|
|
2324
|
-
// node_modules/@randplus/color/index.js
|
|
2325
|
-
var require_color = __commonJS({
|
|
2326
|
-
"node_modules/@randplus/color/index.js"(exports2, module2) {
|
|
2327
|
-
init_();
|
|
2328
|
-
function color(format = "hex", options = {}) {
|
|
2329
|
-
const type = ["hex", "rgb", "word"];
|
|
2330
|
-
if (!type.includes(format)) throw new Error("invalid format.");
|
|
2331
|
-
const content = `\`color()\` is deprecated. Please use \`color.${format}()\` instead.`;
|
|
2332
|
-
process.emitWarning(
|
|
2333
|
-
content,
|
|
2334
|
-
{
|
|
2335
|
-
code: "DeprecationWarning",
|
|
2336
|
-
detail: "This function may be deleted in the future."
|
|
2337
|
-
}
|
|
2338
|
-
);
|
|
2339
|
-
if (typeof options !== "object") throw new Error("options must be object.");
|
|
2340
|
-
return globRequire_src_conv_c(`./src/conv/c${format}`)(options);
|
|
2341
|
-
}
|
|
2342
|
-
module2.exports = color;
|
|
2343
|
-
module2.exports.hex = require_hex();
|
|
2344
|
-
module2.exports.rgb = require_rgb();
|
|
2345
|
-
module2.exports.word = require_word();
|
|
2346
|
-
}
|
|
2347
|
-
});
|
|
2348
|
-
|
|
2349
|
-
// node_modules/tinycolor2/cjs/tinycolor.js
|
|
2350
|
-
var require_tinycolor = __commonJS({
|
|
2351
|
-
"node_modules/tinycolor2/cjs/tinycolor.js"(exports2, module2) {
|
|
2352
|
-
(function(global2, factory) {
|
|
2353
|
-
typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.tinycolor = factory());
|
|
2354
|
-
})(exports2, (function() {
|
|
2355
|
-
"use strict";
|
|
2356
|
-
function _typeof(obj) {
|
|
2357
|
-
"@babel/helpers - typeof";
|
|
2358
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
2359
|
-
return typeof obj2;
|
|
2360
|
-
} : function(obj2) {
|
|
2361
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
2362
|
-
}, _typeof(obj);
|
|
2363
|
-
}
|
|
2364
|
-
var trimLeft = /^\s+/;
|
|
2365
|
-
var trimRight = /\s+$/;
|
|
2366
|
-
function tinycolor(color, opts) {
|
|
2367
|
-
color = color ? color : "";
|
|
2368
|
-
opts = opts || {};
|
|
2369
|
-
if (color instanceof tinycolor) {
|
|
2370
|
-
return color;
|
|
2371
|
-
}
|
|
2372
|
-
if (!(this instanceof tinycolor)) {
|
|
2373
|
-
return new tinycolor(color, opts);
|
|
2374
|
-
}
|
|
2375
|
-
var rgb = inputToRGB(color);
|
|
2376
|
-
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
2377
|
-
this._gradientType = opts.gradientType;
|
|
2378
|
-
if (this._r < 1) this._r = Math.round(this._r);
|
|
2379
|
-
if (this._g < 1) this._g = Math.round(this._g);
|
|
2380
|
-
if (this._b < 1) this._b = Math.round(this._b);
|
|
2381
|
-
this._ok = rgb.ok;
|
|
2382
|
-
}
|
|
2383
|
-
tinycolor.prototype = {
|
|
2384
|
-
isDark: function isDark() {
|
|
2385
|
-
return this.getBrightness() < 128;
|
|
2386
|
-
},
|
|
2387
|
-
isLight: function isLight() {
|
|
2388
|
-
return !this.isDark();
|
|
2389
|
-
},
|
|
2390
|
-
isValid: function isValid() {
|
|
2391
|
-
return this._ok;
|
|
2392
|
-
},
|
|
2393
|
-
getOriginalInput: function getOriginalInput() {
|
|
2394
|
-
return this._originalInput;
|
|
2395
|
-
},
|
|
2396
|
-
getFormat: function getFormat() {
|
|
2397
|
-
return this._format;
|
|
2398
|
-
},
|
|
2399
|
-
getAlpha: function getAlpha() {
|
|
2400
|
-
return this._a;
|
|
2401
|
-
},
|
|
2402
|
-
getBrightness: function getBrightness() {
|
|
2403
|
-
var rgb = this.toRgb();
|
|
2404
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
2405
|
-
},
|
|
2406
|
-
getLuminance: function getLuminance() {
|
|
2407
|
-
var rgb = this.toRgb();
|
|
2408
|
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
2409
|
-
RsRGB = rgb.r / 255;
|
|
2410
|
-
GsRGB = rgb.g / 255;
|
|
2411
|
-
BsRGB = rgb.b / 255;
|
|
2412
|
-
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
|
|
2413
|
-
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
2414
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
|
|
2415
|
-
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
2416
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
|
|
2417
|
-
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
2418
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
2419
|
-
},
|
|
2420
|
-
setAlpha: function setAlpha(value) {
|
|
2421
|
-
this._a = boundAlpha(value);
|
|
2422
|
-
this._roundA = Math.round(100 * this._a) / 100;
|
|
2423
|
-
return this;
|
|
2424
|
-
},
|
|
2425
|
-
toHsv: function toHsv() {
|
|
2426
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
2427
|
-
return {
|
|
2428
|
-
h: hsv.h * 360,
|
|
2429
|
-
s: hsv.s,
|
|
2430
|
-
v: hsv.v,
|
|
2431
|
-
a: this._a
|
|
2432
|
-
};
|
|
2433
|
-
},
|
|
2434
|
-
toHsvString: function toHsvString() {
|
|
2435
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
2436
|
-
var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
|
|
2437
|
-
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
2438
|
-
},
|
|
2439
|
-
toHsl: function toHsl() {
|
|
2440
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
2441
|
-
return {
|
|
2442
|
-
h: hsl.h * 360,
|
|
2443
|
-
s: hsl.s,
|
|
2444
|
-
l: hsl.l,
|
|
2445
|
-
a: this._a
|
|
2446
|
-
};
|
|
2447
|
-
},
|
|
2448
|
-
toHslString: function toHslString() {
|
|
2449
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
2450
|
-
var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
|
|
2451
|
-
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
2452
|
-
},
|
|
2453
|
-
toHex: function toHex(allow3Char) {
|
|
2454
|
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
2455
|
-
},
|
|
2456
|
-
toHexString: function toHexString(allow3Char) {
|
|
2457
|
-
return "#" + this.toHex(allow3Char);
|
|
2458
|
-
},
|
|
2459
|
-
toHex8: function toHex8(allow4Char) {
|
|
2460
|
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
2461
|
-
},
|
|
2462
|
-
toHex8String: function toHex8String(allow4Char) {
|
|
2463
|
-
return "#" + this.toHex8(allow4Char);
|
|
2464
|
-
},
|
|
2465
|
-
toRgb: function toRgb() {
|
|
2466
|
-
return {
|
|
2467
|
-
r: Math.round(this._r),
|
|
2468
|
-
g: Math.round(this._g),
|
|
2469
|
-
b: Math.round(this._b),
|
|
2470
|
-
a: this._a
|
|
2471
|
-
};
|
|
2472
|
-
},
|
|
2473
|
-
toRgbString: function toRgbString() {
|
|
2474
|
-
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
2475
|
-
},
|
|
2476
|
-
toPercentageRgb: function toPercentageRgb() {
|
|
2477
|
-
return {
|
|
2478
|
-
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
2479
|
-
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
2480
|
-
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
2481
|
-
a: this._a
|
|
2482
|
-
};
|
|
2483
|
-
},
|
|
2484
|
-
toPercentageRgbString: function toPercentageRgbString() {
|
|
2485
|
-
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2486
|
-
},
|
|
2487
|
-
toName: function toName() {
|
|
2488
|
-
if (this._a === 0) {
|
|
2489
|
-
return "transparent";
|
|
2490
|
-
}
|
|
2491
|
-
if (this._a < 1) {
|
|
2492
|
-
return false;
|
|
2493
|
-
}
|
|
2494
|
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
2495
|
-
},
|
|
2496
|
-
toFilter: function toFilter(secondColor) {
|
|
2497
|
-
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
2498
|
-
var secondHex8String = hex8String;
|
|
2499
|
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
2500
|
-
if (secondColor) {
|
|
2501
|
-
var s = tinycolor(secondColor);
|
|
2502
|
-
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
2503
|
-
}
|
|
2504
|
-
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
2505
|
-
},
|
|
2506
|
-
toString: function toString(format) {
|
|
2507
|
-
var formatSet = !!format;
|
|
2508
|
-
format = format || this._format;
|
|
2509
|
-
var formattedString = false;
|
|
2510
|
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
2511
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
2512
|
-
if (needsAlphaFormat) {
|
|
2513
|
-
if (format === "name" && this._a === 0) {
|
|
2514
|
-
return this.toName();
|
|
2515
|
-
}
|
|
2516
|
-
return this.toRgbString();
|
|
2517
|
-
}
|
|
2518
|
-
if (format === "rgb") {
|
|
2519
|
-
formattedString = this.toRgbString();
|
|
2520
|
-
}
|
|
2521
|
-
if (format === "prgb") {
|
|
2522
|
-
formattedString = this.toPercentageRgbString();
|
|
2523
|
-
}
|
|
2524
|
-
if (format === "hex" || format === "hex6") {
|
|
2525
|
-
formattedString = this.toHexString();
|
|
2526
|
-
}
|
|
2527
|
-
if (format === "hex3") {
|
|
2528
|
-
formattedString = this.toHexString(true);
|
|
2529
|
-
}
|
|
2530
|
-
if (format === "hex4") {
|
|
2531
|
-
formattedString = this.toHex8String(true);
|
|
2532
|
-
}
|
|
2533
|
-
if (format === "hex8") {
|
|
2534
|
-
formattedString = this.toHex8String();
|
|
2535
|
-
}
|
|
2536
|
-
if (format === "name") {
|
|
2537
|
-
formattedString = this.toName();
|
|
2538
|
-
}
|
|
2539
|
-
if (format === "hsl") {
|
|
2540
|
-
formattedString = this.toHslString();
|
|
2541
|
-
}
|
|
2542
|
-
if (format === "hsv") {
|
|
2543
|
-
formattedString = this.toHsvString();
|
|
2544
|
-
}
|
|
2545
|
-
return formattedString || this.toHexString();
|
|
2546
|
-
},
|
|
2547
|
-
clone: function clone() {
|
|
2548
|
-
return tinycolor(this.toString());
|
|
2549
|
-
},
|
|
2550
|
-
_applyModification: function _applyModification(fn, args) {
|
|
2551
|
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
2552
|
-
this._r = color._r;
|
|
2553
|
-
this._g = color._g;
|
|
2554
|
-
this._b = color._b;
|
|
2555
|
-
this.setAlpha(color._a);
|
|
2556
|
-
return this;
|
|
2557
|
-
},
|
|
2558
|
-
lighten: function lighten() {
|
|
2559
|
-
return this._applyModification(_lighten, arguments);
|
|
2560
|
-
},
|
|
2561
|
-
brighten: function brighten() {
|
|
2562
|
-
return this._applyModification(_brighten, arguments);
|
|
2563
|
-
},
|
|
2564
|
-
darken: function darken() {
|
|
2565
|
-
return this._applyModification(_darken, arguments);
|
|
2566
|
-
},
|
|
2567
|
-
desaturate: function desaturate() {
|
|
2568
|
-
return this._applyModification(_desaturate, arguments);
|
|
2569
|
-
},
|
|
2570
|
-
saturate: function saturate() {
|
|
2571
|
-
return this._applyModification(_saturate, arguments);
|
|
2572
|
-
},
|
|
2573
|
-
greyscale: function greyscale() {
|
|
2574
|
-
return this._applyModification(_greyscale, arguments);
|
|
2575
|
-
},
|
|
2576
|
-
spin: function spin() {
|
|
2577
|
-
return this._applyModification(_spin, arguments);
|
|
2578
|
-
},
|
|
2579
|
-
_applyCombination: function _applyCombination(fn, args) {
|
|
2580
|
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
2581
|
-
},
|
|
2582
|
-
analogous: function analogous() {
|
|
2583
|
-
return this._applyCombination(_analogous, arguments);
|
|
2584
|
-
},
|
|
2585
|
-
complement: function complement() {
|
|
2586
|
-
return this._applyCombination(_complement, arguments);
|
|
2587
|
-
},
|
|
2588
|
-
monochromatic: function monochromatic() {
|
|
2589
|
-
return this._applyCombination(_monochromatic, arguments);
|
|
2590
|
-
},
|
|
2591
|
-
splitcomplement: function splitcomplement() {
|
|
2592
|
-
return this._applyCombination(_splitcomplement, arguments);
|
|
2593
|
-
},
|
|
2594
|
-
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
2595
|
-
// polyad: function (number) {
|
|
2596
|
-
// return this._applyCombination(polyad, [number]);
|
|
2597
|
-
// },
|
|
2598
|
-
triad: function triad() {
|
|
2599
|
-
return this._applyCombination(polyad, [3]);
|
|
2600
|
-
},
|
|
2601
|
-
tetrad: function tetrad() {
|
|
2602
|
-
return this._applyCombination(polyad, [4]);
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
2605
|
-
tinycolor.fromRatio = function(color, opts) {
|
|
2606
|
-
if (_typeof(color) == "object") {
|
|
2607
|
-
var newColor = {};
|
|
2608
|
-
for (var i in color) {
|
|
2609
|
-
if (color.hasOwnProperty(i)) {
|
|
2610
|
-
if (i === "a") {
|
|
2611
|
-
newColor[i] = color[i];
|
|
2612
|
-
} else {
|
|
2613
|
-
newColor[i] = convertToPercentage(color[i]);
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
color = newColor;
|
|
2618
|
-
}
|
|
2619
|
-
return tinycolor(color, opts);
|
|
2620
|
-
};
|
|
2621
|
-
function inputToRGB(color) {
|
|
2622
|
-
var rgb = {
|
|
2623
|
-
r: 0,
|
|
2624
|
-
g: 0,
|
|
2625
|
-
b: 0
|
|
2626
|
-
};
|
|
2627
|
-
var a = 1;
|
|
2628
|
-
var s = null;
|
|
2629
|
-
var v = null;
|
|
2630
|
-
var l = null;
|
|
2631
|
-
var ok = false;
|
|
2632
|
-
var format = false;
|
|
2633
|
-
if (typeof color == "string") {
|
|
2634
|
-
color = stringInputToObject(color);
|
|
2635
|
-
}
|
|
2636
|
-
if (_typeof(color) == "object") {
|
|
2637
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
2638
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
2639
|
-
ok = true;
|
|
2640
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
2641
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
2642
|
-
s = convertToPercentage(color.s);
|
|
2643
|
-
v = convertToPercentage(color.v);
|
|
2644
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
2645
|
-
ok = true;
|
|
2646
|
-
format = "hsv";
|
|
2647
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
2648
|
-
s = convertToPercentage(color.s);
|
|
2649
|
-
l = convertToPercentage(color.l);
|
|
2650
|
-
rgb = hslToRgb(color.h, s, l);
|
|
2651
|
-
ok = true;
|
|
2652
|
-
format = "hsl";
|
|
2653
|
-
}
|
|
2654
|
-
if (color.hasOwnProperty("a")) {
|
|
2655
|
-
a = color.a;
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
a = boundAlpha(a);
|
|
2659
|
-
return {
|
|
2660
|
-
ok,
|
|
2661
|
-
format: color.format || format,
|
|
2662
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
2663
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
2664
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
2665
|
-
a
|
|
2666
|
-
};
|
|
2667
|
-
}
|
|
2668
|
-
function rgbToRgb(r, g, b) {
|
|
2669
|
-
return {
|
|
2670
|
-
r: bound01(r, 255) * 255,
|
|
2671
|
-
g: bound01(g, 255) * 255,
|
|
2672
|
-
b: bound01(b, 255) * 255
|
|
2673
|
-
};
|
|
2674
|
-
}
|
|
2675
|
-
function rgbToHsl(r, g, b) {
|
|
2676
|
-
r = bound01(r, 255);
|
|
2677
|
-
g = bound01(g, 255);
|
|
2678
|
-
b = bound01(b, 255);
|
|
2679
|
-
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
2680
|
-
var h, s, l = (max + min) / 2;
|
|
2681
|
-
if (max == min) {
|
|
2682
|
-
h = s = 0;
|
|
2683
|
-
} else {
|
|
2684
|
-
var d = max - min;
|
|
2685
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
2686
|
-
switch (max) {
|
|
2687
|
-
case r:
|
|
2688
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2689
|
-
break;
|
|
2690
|
-
case g:
|
|
2691
|
-
h = (b - r) / d + 2;
|
|
2692
|
-
break;
|
|
2693
|
-
case b:
|
|
2694
|
-
h = (r - g) / d + 4;
|
|
2695
|
-
break;
|
|
2696
|
-
}
|
|
2697
|
-
h /= 6;
|
|
2698
|
-
}
|
|
2699
|
-
return {
|
|
2700
|
-
h,
|
|
2701
|
-
s,
|
|
2702
|
-
l
|
|
2703
|
-
};
|
|
2704
|
-
}
|
|
2705
|
-
function hslToRgb(h, s, l) {
|
|
2706
|
-
var r, g, b;
|
|
2707
|
-
h = bound01(h, 360);
|
|
2708
|
-
s = bound01(s, 100);
|
|
2709
|
-
l = bound01(l, 100);
|
|
2710
|
-
function hue2rgb(p2, q2, t) {
|
|
2711
|
-
if (t < 0) t += 1;
|
|
2712
|
-
if (t > 1) t -= 1;
|
|
2713
|
-
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
2714
|
-
if (t < 1 / 2) return q2;
|
|
2715
|
-
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
2716
|
-
return p2;
|
|
2717
|
-
}
|
|
2718
|
-
if (s === 0) {
|
|
2719
|
-
r = g = b = l;
|
|
2720
|
-
} else {
|
|
2721
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
2722
|
-
var p = 2 * l - q;
|
|
2723
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
2724
|
-
g = hue2rgb(p, q, h);
|
|
2725
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
2726
|
-
}
|
|
2727
|
-
return {
|
|
2728
|
-
r: r * 255,
|
|
2729
|
-
g: g * 255,
|
|
2730
|
-
b: b * 255
|
|
2731
|
-
};
|
|
2732
|
-
}
|
|
2733
|
-
function rgbToHsv(r, g, b) {
|
|
2734
|
-
r = bound01(r, 255);
|
|
2735
|
-
g = bound01(g, 255);
|
|
2736
|
-
b = bound01(b, 255);
|
|
2737
|
-
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
2738
|
-
var h, s, v = max;
|
|
2739
|
-
var d = max - min;
|
|
2740
|
-
s = max === 0 ? 0 : d / max;
|
|
2741
|
-
if (max == min) {
|
|
2742
|
-
h = 0;
|
|
2743
|
-
} else {
|
|
2744
|
-
switch (max) {
|
|
2745
|
-
case r:
|
|
2746
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2747
|
-
break;
|
|
2748
|
-
case g:
|
|
2749
|
-
h = (b - r) / d + 2;
|
|
2750
|
-
break;
|
|
2751
|
-
case b:
|
|
2752
|
-
h = (r - g) / d + 4;
|
|
2753
|
-
break;
|
|
2754
|
-
}
|
|
2755
|
-
h /= 6;
|
|
2756
|
-
}
|
|
2757
|
-
return {
|
|
2758
|
-
h,
|
|
2759
|
-
s,
|
|
2760
|
-
v
|
|
2761
|
-
};
|
|
2762
|
-
}
|
|
2763
|
-
function hsvToRgb(h, s, v) {
|
|
2764
|
-
h = bound01(h, 360) * 6;
|
|
2765
|
-
s = bound01(s, 100);
|
|
2766
|
-
v = bound01(v, 100);
|
|
2767
|
-
var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
|
|
2768
|
-
return {
|
|
2769
|
-
r: r * 255,
|
|
2770
|
-
g: g * 255,
|
|
2771
|
-
b: b * 255
|
|
2772
|
-
};
|
|
2773
|
-
}
|
|
2774
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
2775
|
-
var hex2 = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
2776
|
-
if (allow3Char && hex2[0].charAt(0) == hex2[0].charAt(1) && hex2[1].charAt(0) == hex2[1].charAt(1) && hex2[2].charAt(0) == hex2[2].charAt(1)) {
|
|
2777
|
-
return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
|
|
2778
|
-
}
|
|
2779
|
-
return hex2.join("");
|
|
2780
|
-
}
|
|
2781
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
2782
|
-
var hex2 = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
2783
|
-
if (allow4Char && hex2[0].charAt(0) == hex2[0].charAt(1) && hex2[1].charAt(0) == hex2[1].charAt(1) && hex2[2].charAt(0) == hex2[2].charAt(1) && hex2[3].charAt(0) == hex2[3].charAt(1)) {
|
|
2784
|
-
return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
|
|
2785
|
-
}
|
|
2786
|
-
return hex2.join("");
|
|
2787
|
-
}
|
|
2788
|
-
function rgbaToArgbHex(r, g, b, a) {
|
|
2789
|
-
var hex2 = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
2790
|
-
return hex2.join("");
|
|
2791
|
-
}
|
|
2792
|
-
tinycolor.equals = function(color1, color2) {
|
|
2793
|
-
if (!color1 || !color2) return false;
|
|
2794
|
-
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
2795
|
-
};
|
|
2796
|
-
tinycolor.random = function() {
|
|
2797
|
-
return tinycolor.fromRatio({
|
|
2798
|
-
r: Math.random(),
|
|
2799
|
-
g: Math.random(),
|
|
2800
|
-
b: Math.random()
|
|
2801
|
-
});
|
|
2802
|
-
};
|
|
2803
|
-
function _desaturate(color, amount) {
|
|
2804
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
2805
|
-
var hsl = tinycolor(color).toHsl();
|
|
2806
|
-
hsl.s -= amount / 100;
|
|
2807
|
-
hsl.s = clamp01(hsl.s);
|
|
2808
|
-
return tinycolor(hsl);
|
|
2809
|
-
}
|
|
2810
|
-
function _saturate(color, amount) {
|
|
2811
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
2812
|
-
var hsl = tinycolor(color).toHsl();
|
|
2813
|
-
hsl.s += amount / 100;
|
|
2814
|
-
hsl.s = clamp01(hsl.s);
|
|
2815
|
-
return tinycolor(hsl);
|
|
2816
|
-
}
|
|
2817
|
-
function _greyscale(color) {
|
|
2818
|
-
return tinycolor(color).desaturate(100);
|
|
2819
|
-
}
|
|
2820
|
-
function _lighten(color, amount) {
|
|
2821
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
2822
|
-
var hsl = tinycolor(color).toHsl();
|
|
2823
|
-
hsl.l += amount / 100;
|
|
2824
|
-
hsl.l = clamp01(hsl.l);
|
|
2825
|
-
return tinycolor(hsl);
|
|
2826
|
-
}
|
|
2827
|
-
function _brighten(color, amount) {
|
|
2828
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
2829
|
-
var rgb = tinycolor(color).toRgb();
|
|
2830
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
2831
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
2832
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
2833
|
-
return tinycolor(rgb);
|
|
2834
|
-
}
|
|
2835
|
-
function _darken(color, amount) {
|
|
2836
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
2837
|
-
var hsl = tinycolor(color).toHsl();
|
|
2838
|
-
hsl.l -= amount / 100;
|
|
2839
|
-
hsl.l = clamp01(hsl.l);
|
|
2840
|
-
return tinycolor(hsl);
|
|
2841
|
-
}
|
|
2842
|
-
function _spin(color, amount) {
|
|
2843
|
-
var hsl = tinycolor(color).toHsl();
|
|
2844
|
-
var hue = (hsl.h + amount) % 360;
|
|
2845
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
2846
|
-
return tinycolor(hsl);
|
|
2847
|
-
}
|
|
2848
|
-
function _complement(color) {
|
|
2849
|
-
var hsl = tinycolor(color).toHsl();
|
|
2850
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
2851
|
-
return tinycolor(hsl);
|
|
2852
|
-
}
|
|
2853
|
-
function polyad(color, number) {
|
|
2854
|
-
if (isNaN(number) || number <= 0) {
|
|
2855
|
-
throw new Error("Argument to polyad must be a positive number");
|
|
2856
|
-
}
|
|
2857
|
-
var hsl = tinycolor(color).toHsl();
|
|
2858
|
-
var result = [tinycolor(color)];
|
|
2859
|
-
var step = 360 / number;
|
|
2860
|
-
for (var i = 1; i < number; i++) {
|
|
2861
|
-
result.push(tinycolor({
|
|
2862
|
-
h: (hsl.h + i * step) % 360,
|
|
2863
|
-
s: hsl.s,
|
|
2864
|
-
l: hsl.l
|
|
2865
|
-
}));
|
|
2866
|
-
}
|
|
2867
|
-
return result;
|
|
2868
|
-
}
|
|
2869
|
-
function _splitcomplement(color) {
|
|
2870
|
-
var hsl = tinycolor(color).toHsl();
|
|
2871
|
-
var h = hsl.h;
|
|
2872
|
-
return [tinycolor(color), tinycolor({
|
|
2873
|
-
h: (h + 72) % 360,
|
|
2874
|
-
s: hsl.s,
|
|
2875
|
-
l: hsl.l
|
|
2876
|
-
}), tinycolor({
|
|
2877
|
-
h: (h + 216) % 360,
|
|
2878
|
-
s: hsl.s,
|
|
2879
|
-
l: hsl.l
|
|
2880
|
-
})];
|
|
2881
|
-
}
|
|
2882
|
-
function _analogous(color, results, slices) {
|
|
2883
|
-
results = results || 6;
|
|
2884
|
-
slices = slices || 30;
|
|
2885
|
-
var hsl = tinycolor(color).toHsl();
|
|
2886
|
-
var part = 360 / slices;
|
|
2887
|
-
var ret = [tinycolor(color)];
|
|
2888
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
2889
|
-
hsl.h = (hsl.h + part) % 360;
|
|
2890
|
-
ret.push(tinycolor(hsl));
|
|
2891
|
-
}
|
|
2892
|
-
return ret;
|
|
2893
|
-
}
|
|
2894
|
-
function _monochromatic(color, results) {
|
|
2895
|
-
results = results || 6;
|
|
2896
|
-
var hsv = tinycolor(color).toHsv();
|
|
2897
|
-
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
2898
|
-
var ret = [];
|
|
2899
|
-
var modification = 1 / results;
|
|
2900
|
-
while (results--) {
|
|
2901
|
-
ret.push(tinycolor({
|
|
2902
|
-
h,
|
|
2903
|
-
s,
|
|
2904
|
-
v
|
|
2905
|
-
}));
|
|
2906
|
-
v = (v + modification) % 1;
|
|
2907
|
-
}
|
|
2908
|
-
return ret;
|
|
2909
|
-
}
|
|
2910
|
-
tinycolor.mix = function(color1, color2, amount) {
|
|
2911
|
-
amount = amount === 0 ? 0 : amount || 50;
|
|
2912
|
-
var rgb1 = tinycolor(color1).toRgb();
|
|
2913
|
-
var rgb2 = tinycolor(color2).toRgb();
|
|
2914
|
-
var p = amount / 100;
|
|
2915
|
-
var rgba = {
|
|
2916
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
2917
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
2918
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
2919
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
2920
|
-
};
|
|
2921
|
-
return tinycolor(rgba);
|
|
2922
|
-
};
|
|
2923
|
-
tinycolor.readability = function(color1, color2) {
|
|
2924
|
-
var c1 = tinycolor(color1);
|
|
2925
|
-
var c2 = tinycolor(color2);
|
|
2926
|
-
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
2927
|
-
};
|
|
2928
|
-
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
2929
|
-
var readability = tinycolor.readability(color1, color2);
|
|
2930
|
-
var wcag2Parms, out;
|
|
2931
|
-
out = false;
|
|
2932
|
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
2933
|
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
2934
|
-
case "AAsmall":
|
|
2935
|
-
case "AAAlarge":
|
|
2936
|
-
out = readability >= 4.5;
|
|
2937
|
-
break;
|
|
2938
|
-
case "AAlarge":
|
|
2939
|
-
out = readability >= 3;
|
|
2940
|
-
break;
|
|
2941
|
-
case "AAAsmall":
|
|
2942
|
-
out = readability >= 7;
|
|
2943
|
-
break;
|
|
2944
|
-
}
|
|
2945
|
-
return out;
|
|
2946
|
-
};
|
|
2947
|
-
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
2948
|
-
var bestColor = null;
|
|
2949
|
-
var bestScore = 0;
|
|
2950
|
-
var readability;
|
|
2951
|
-
var includeFallbackColors, level, size;
|
|
2952
|
-
args = args || {};
|
|
2953
|
-
includeFallbackColors = args.includeFallbackColors;
|
|
2954
|
-
level = args.level;
|
|
2955
|
-
size = args.size;
|
|
2956
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
2957
|
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
2958
|
-
if (readability > bestScore) {
|
|
2959
|
-
bestScore = readability;
|
|
2960
|
-
bestColor = tinycolor(colorList[i]);
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
2964
|
-
level,
|
|
2965
|
-
size
|
|
2966
|
-
}) || !includeFallbackColors) {
|
|
2967
|
-
return bestColor;
|
|
2968
|
-
} else {
|
|
2969
|
-
args.includeFallbackColors = false;
|
|
2970
|
-
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
2971
|
-
}
|
|
2972
|
-
};
|
|
2973
|
-
var names = tinycolor.names = {
|
|
2974
|
-
aliceblue: "f0f8ff",
|
|
2975
|
-
antiquewhite: "faebd7",
|
|
2976
|
-
aqua: "0ff",
|
|
2977
|
-
aquamarine: "7fffd4",
|
|
2978
|
-
azure: "f0ffff",
|
|
2979
|
-
beige: "f5f5dc",
|
|
2980
|
-
bisque: "ffe4c4",
|
|
2981
|
-
black: "000",
|
|
2982
|
-
blanchedalmond: "ffebcd",
|
|
2983
|
-
blue: "00f",
|
|
2984
|
-
blueviolet: "8a2be2",
|
|
2985
|
-
brown: "a52a2a",
|
|
2986
|
-
burlywood: "deb887",
|
|
2987
|
-
burntsienna: "ea7e5d",
|
|
2988
|
-
cadetblue: "5f9ea0",
|
|
2989
|
-
chartreuse: "7fff00",
|
|
2990
|
-
chocolate: "d2691e",
|
|
2991
|
-
coral: "ff7f50",
|
|
2992
|
-
cornflowerblue: "6495ed",
|
|
2993
|
-
cornsilk: "fff8dc",
|
|
2994
|
-
crimson: "dc143c",
|
|
2995
|
-
cyan: "0ff",
|
|
2996
|
-
darkblue: "00008b",
|
|
2997
|
-
darkcyan: "008b8b",
|
|
2998
|
-
darkgoldenrod: "b8860b",
|
|
2999
|
-
darkgray: "a9a9a9",
|
|
3000
|
-
darkgreen: "006400",
|
|
3001
|
-
darkgrey: "a9a9a9",
|
|
3002
|
-
darkkhaki: "bdb76b",
|
|
3003
|
-
darkmagenta: "8b008b",
|
|
3004
|
-
darkolivegreen: "556b2f",
|
|
3005
|
-
darkorange: "ff8c00",
|
|
3006
|
-
darkorchid: "9932cc",
|
|
3007
|
-
darkred: "8b0000",
|
|
3008
|
-
darksalmon: "e9967a",
|
|
3009
|
-
darkseagreen: "8fbc8f",
|
|
3010
|
-
darkslateblue: "483d8b",
|
|
3011
|
-
darkslategray: "2f4f4f",
|
|
3012
|
-
darkslategrey: "2f4f4f",
|
|
3013
|
-
darkturquoise: "00ced1",
|
|
3014
|
-
darkviolet: "9400d3",
|
|
3015
|
-
deeppink: "ff1493",
|
|
3016
|
-
deepskyblue: "00bfff",
|
|
3017
|
-
dimgray: "696969",
|
|
3018
|
-
dimgrey: "696969",
|
|
3019
|
-
dodgerblue: "1e90ff",
|
|
3020
|
-
firebrick: "b22222",
|
|
3021
|
-
floralwhite: "fffaf0",
|
|
3022
|
-
forestgreen: "228b22",
|
|
3023
|
-
fuchsia: "f0f",
|
|
3024
|
-
gainsboro: "dcdcdc",
|
|
3025
|
-
ghostwhite: "f8f8ff",
|
|
3026
|
-
gold: "ffd700",
|
|
3027
|
-
goldenrod: "daa520",
|
|
3028
|
-
gray: "808080",
|
|
3029
|
-
green: "008000",
|
|
3030
|
-
greenyellow: "adff2f",
|
|
3031
|
-
grey: "808080",
|
|
3032
|
-
honeydew: "f0fff0",
|
|
3033
|
-
hotpink: "ff69b4",
|
|
3034
|
-
indianred: "cd5c5c",
|
|
3035
|
-
indigo: "4b0082",
|
|
3036
|
-
ivory: "fffff0",
|
|
3037
|
-
khaki: "f0e68c",
|
|
3038
|
-
lavender: "e6e6fa",
|
|
3039
|
-
lavenderblush: "fff0f5",
|
|
3040
|
-
lawngreen: "7cfc00",
|
|
3041
|
-
lemonchiffon: "fffacd",
|
|
3042
|
-
lightblue: "add8e6",
|
|
3043
|
-
lightcoral: "f08080",
|
|
3044
|
-
lightcyan: "e0ffff",
|
|
3045
|
-
lightgoldenrodyellow: "fafad2",
|
|
3046
|
-
lightgray: "d3d3d3",
|
|
3047
|
-
lightgreen: "90ee90",
|
|
3048
|
-
lightgrey: "d3d3d3",
|
|
3049
|
-
lightpink: "ffb6c1",
|
|
3050
|
-
lightsalmon: "ffa07a",
|
|
3051
|
-
lightseagreen: "20b2aa",
|
|
3052
|
-
lightskyblue: "87cefa",
|
|
3053
|
-
lightslategray: "789",
|
|
3054
|
-
lightslategrey: "789",
|
|
3055
|
-
lightsteelblue: "b0c4de",
|
|
3056
|
-
lightyellow: "ffffe0",
|
|
3057
|
-
lime: "0f0",
|
|
3058
|
-
limegreen: "32cd32",
|
|
3059
|
-
linen: "faf0e6",
|
|
3060
|
-
magenta: "f0f",
|
|
3061
|
-
maroon: "800000",
|
|
3062
|
-
mediumaquamarine: "66cdaa",
|
|
3063
|
-
mediumblue: "0000cd",
|
|
3064
|
-
mediumorchid: "ba55d3",
|
|
3065
|
-
mediumpurple: "9370db",
|
|
3066
|
-
mediumseagreen: "3cb371",
|
|
3067
|
-
mediumslateblue: "7b68ee",
|
|
3068
|
-
mediumspringgreen: "00fa9a",
|
|
3069
|
-
mediumturquoise: "48d1cc",
|
|
3070
|
-
mediumvioletred: "c71585",
|
|
3071
|
-
midnightblue: "191970",
|
|
3072
|
-
mintcream: "f5fffa",
|
|
3073
|
-
mistyrose: "ffe4e1",
|
|
3074
|
-
moccasin: "ffe4b5",
|
|
3075
|
-
navajowhite: "ffdead",
|
|
3076
|
-
navy: "000080",
|
|
3077
|
-
oldlace: "fdf5e6",
|
|
3078
|
-
olive: "808000",
|
|
3079
|
-
olivedrab: "6b8e23",
|
|
3080
|
-
orange: "ffa500",
|
|
3081
|
-
orangered: "ff4500",
|
|
3082
|
-
orchid: "da70d6",
|
|
3083
|
-
palegoldenrod: "eee8aa",
|
|
3084
|
-
palegreen: "98fb98",
|
|
3085
|
-
paleturquoise: "afeeee",
|
|
3086
|
-
palevioletred: "db7093",
|
|
3087
|
-
papayawhip: "ffefd5",
|
|
3088
|
-
peachpuff: "ffdab9",
|
|
3089
|
-
peru: "cd853f",
|
|
3090
|
-
pink: "ffc0cb",
|
|
3091
|
-
plum: "dda0dd",
|
|
3092
|
-
powderblue: "b0e0e6",
|
|
3093
|
-
purple: "800080",
|
|
3094
|
-
rebeccapurple: "663399",
|
|
3095
|
-
red: "f00",
|
|
3096
|
-
rosybrown: "bc8f8f",
|
|
3097
|
-
royalblue: "4169e1",
|
|
3098
|
-
saddlebrown: "8b4513",
|
|
3099
|
-
salmon: "fa8072",
|
|
3100
|
-
sandybrown: "f4a460",
|
|
3101
|
-
seagreen: "2e8b57",
|
|
3102
|
-
seashell: "fff5ee",
|
|
3103
|
-
sienna: "a0522d",
|
|
3104
|
-
silver: "c0c0c0",
|
|
3105
|
-
skyblue: "87ceeb",
|
|
3106
|
-
slateblue: "6a5acd",
|
|
3107
|
-
slategray: "708090",
|
|
3108
|
-
slategrey: "708090",
|
|
3109
|
-
snow: "fffafa",
|
|
3110
|
-
springgreen: "00ff7f",
|
|
3111
|
-
steelblue: "4682b4",
|
|
3112
|
-
tan: "d2b48c",
|
|
3113
|
-
teal: "008080",
|
|
3114
|
-
thistle: "d8bfd8",
|
|
3115
|
-
tomato: "ff6347",
|
|
3116
|
-
turquoise: "40e0d0",
|
|
3117
|
-
violet: "ee82ee",
|
|
3118
|
-
wheat: "f5deb3",
|
|
3119
|
-
white: "fff",
|
|
3120
|
-
whitesmoke: "f5f5f5",
|
|
3121
|
-
yellow: "ff0",
|
|
3122
|
-
yellowgreen: "9acd32"
|
|
3123
|
-
};
|
|
3124
|
-
var hexNames = tinycolor.hexNames = flip(names);
|
|
3125
|
-
function flip(o) {
|
|
3126
|
-
var flipped = {};
|
|
3127
|
-
for (var i in o) {
|
|
3128
|
-
if (o.hasOwnProperty(i)) {
|
|
3129
|
-
flipped[o[i]] = i;
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
return flipped;
|
|
3133
|
-
}
|
|
3134
|
-
function boundAlpha(a) {
|
|
3135
|
-
a = parseFloat(a);
|
|
3136
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
3137
|
-
a = 1;
|
|
3138
|
-
}
|
|
3139
|
-
return a;
|
|
3140
|
-
}
|
|
3141
|
-
function bound01(n, max) {
|
|
3142
|
-
if (isOnePointZero(n)) n = "100%";
|
|
3143
|
-
var processPercent = isPercentage(n);
|
|
3144
|
-
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
3145
|
-
if (processPercent) {
|
|
3146
|
-
n = parseInt(n * max, 10) / 100;
|
|
3147
|
-
}
|
|
3148
|
-
if (Math.abs(n - max) < 1e-6) {
|
|
3149
|
-
return 1;
|
|
3150
|
-
}
|
|
3151
|
-
return n % max / parseFloat(max);
|
|
3152
|
-
}
|
|
3153
|
-
function clamp01(val) {
|
|
3154
|
-
return Math.min(1, Math.max(0, val));
|
|
3155
|
-
}
|
|
3156
|
-
function parseIntFromHex(val) {
|
|
3157
|
-
return parseInt(val, 16);
|
|
3158
|
-
}
|
|
3159
|
-
function isOnePointZero(n) {
|
|
3160
|
-
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
3161
|
-
}
|
|
3162
|
-
function isPercentage(n) {
|
|
3163
|
-
return typeof n === "string" && n.indexOf("%") != -1;
|
|
3164
|
-
}
|
|
3165
|
-
function pad2(c) {
|
|
3166
|
-
return c.length == 1 ? "0" + c : "" + c;
|
|
3167
|
-
}
|
|
3168
|
-
function convertToPercentage(n) {
|
|
3169
|
-
if (n <= 1) {
|
|
3170
|
-
n = n * 100 + "%";
|
|
3171
|
-
}
|
|
3172
|
-
return n;
|
|
3173
|
-
}
|
|
3174
|
-
function convertDecimalToHex(d) {
|
|
3175
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
3176
|
-
}
|
|
3177
|
-
function convertHexToDecimal(h) {
|
|
3178
|
-
return parseIntFromHex(h) / 255;
|
|
3179
|
-
}
|
|
3180
|
-
var matchers = (function() {
|
|
3181
|
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
3182
|
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
3183
|
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
3184
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
3185
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
3186
|
-
return {
|
|
3187
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
3188
|
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
3189
|
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
3190
|
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
3191
|
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
3192
|
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
3193
|
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
3194
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
3195
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
3196
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
3197
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
3198
|
-
};
|
|
3199
|
-
})();
|
|
3200
|
-
function isValidCSSUnit(color) {
|
|
3201
|
-
return !!matchers.CSS_UNIT.exec(color);
|
|
3202
|
-
}
|
|
3203
|
-
function stringInputToObject(color) {
|
|
3204
|
-
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
3205
|
-
var named = false;
|
|
3206
|
-
if (names[color]) {
|
|
3207
|
-
color = names[color];
|
|
3208
|
-
named = true;
|
|
3209
|
-
} else if (color == "transparent") {
|
|
3210
|
-
return {
|
|
3211
|
-
r: 0,
|
|
3212
|
-
g: 0,
|
|
3213
|
-
b: 0,
|
|
3214
|
-
a: 0,
|
|
3215
|
-
format: "name"
|
|
3216
|
-
};
|
|
3217
|
-
}
|
|
3218
|
-
var match;
|
|
3219
|
-
if (match = matchers.rgb.exec(color)) {
|
|
3220
|
-
return {
|
|
3221
|
-
r: match[1],
|
|
3222
|
-
g: match[2],
|
|
3223
|
-
b: match[3]
|
|
3224
|
-
};
|
|
3225
|
-
}
|
|
3226
|
-
if (match = matchers.rgba.exec(color)) {
|
|
3227
|
-
return {
|
|
3228
|
-
r: match[1],
|
|
3229
|
-
g: match[2],
|
|
3230
|
-
b: match[3],
|
|
3231
|
-
a: match[4]
|
|
3232
|
-
};
|
|
3233
|
-
}
|
|
3234
|
-
if (match = matchers.hsl.exec(color)) {
|
|
3235
|
-
return {
|
|
3236
|
-
h: match[1],
|
|
3237
|
-
s: match[2],
|
|
3238
|
-
l: match[3]
|
|
3239
|
-
};
|
|
3240
|
-
}
|
|
3241
|
-
if (match = matchers.hsla.exec(color)) {
|
|
3242
|
-
return {
|
|
3243
|
-
h: match[1],
|
|
3244
|
-
s: match[2],
|
|
3245
|
-
l: match[3],
|
|
3246
|
-
a: match[4]
|
|
3247
|
-
};
|
|
3248
|
-
}
|
|
3249
|
-
if (match = matchers.hsv.exec(color)) {
|
|
3250
|
-
return {
|
|
3251
|
-
h: match[1],
|
|
3252
|
-
s: match[2],
|
|
3253
|
-
v: match[3]
|
|
3254
|
-
};
|
|
3255
|
-
}
|
|
3256
|
-
if (match = matchers.hsva.exec(color)) {
|
|
3257
|
-
return {
|
|
3258
|
-
h: match[1],
|
|
3259
|
-
s: match[2],
|
|
3260
|
-
v: match[3],
|
|
3261
|
-
a: match[4]
|
|
3262
|
-
};
|
|
3263
|
-
}
|
|
3264
|
-
if (match = matchers.hex8.exec(color)) {
|
|
3265
|
-
return {
|
|
3266
|
-
r: parseIntFromHex(match[1]),
|
|
3267
|
-
g: parseIntFromHex(match[2]),
|
|
3268
|
-
b: parseIntFromHex(match[3]),
|
|
3269
|
-
a: convertHexToDecimal(match[4]),
|
|
3270
|
-
format: named ? "name" : "hex8"
|
|
3271
|
-
};
|
|
3272
|
-
}
|
|
3273
|
-
if (match = matchers.hex6.exec(color)) {
|
|
3274
|
-
return {
|
|
3275
|
-
r: parseIntFromHex(match[1]),
|
|
3276
|
-
g: parseIntFromHex(match[2]),
|
|
3277
|
-
b: parseIntFromHex(match[3]),
|
|
3278
|
-
format: named ? "name" : "hex"
|
|
3279
|
-
};
|
|
3280
|
-
}
|
|
3281
|
-
if (match = matchers.hex4.exec(color)) {
|
|
3282
|
-
return {
|
|
3283
|
-
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
3284
|
-
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
3285
|
-
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
3286
|
-
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
3287
|
-
format: named ? "name" : "hex8"
|
|
3288
|
-
};
|
|
3289
|
-
}
|
|
3290
|
-
if (match = matchers.hex3.exec(color)) {
|
|
3291
|
-
return {
|
|
3292
|
-
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
3293
|
-
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
3294
|
-
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
3295
|
-
format: named ? "name" : "hex"
|
|
3296
|
-
};
|
|
3297
|
-
}
|
|
3298
|
-
return false;
|
|
3299
|
-
}
|
|
3300
|
-
function validateWCAG2Parms(parms) {
|
|
3301
|
-
var level, size;
|
|
3302
|
-
parms = parms || {
|
|
3303
|
-
level: "AA",
|
|
3304
|
-
size: "small"
|
|
3305
|
-
};
|
|
3306
|
-
level = (parms.level || "AA").toUpperCase();
|
|
3307
|
-
size = (parms.size || "small").toLowerCase();
|
|
3308
|
-
if (level !== "AA" && level !== "AAA") {
|
|
3309
|
-
level = "AA";
|
|
3310
|
-
}
|
|
3311
|
-
if (size !== "small" && size !== "large") {
|
|
3312
|
-
size = "small";
|
|
3313
|
-
}
|
|
3314
|
-
return {
|
|
3315
|
-
level,
|
|
3316
|
-
size
|
|
3317
|
-
};
|
|
3318
|
-
}
|
|
3319
|
-
return tinycolor;
|
|
3320
|
-
}));
|
|
3321
|
-
}
|
|
3322
|
-
});
|
|
3323
|
-
|
|
3324
|
-
// node_modules/tinygradient/index.js
|
|
3325
|
-
var require_tinygradient = __commonJS({
|
|
3326
|
-
"node_modules/tinygradient/index.js"(exports2, module2) {
|
|
3327
|
-
var tinycolor = require_tinycolor();
|
|
3328
|
-
var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
|
|
3329
|
-
var HSVA_MAX = { h: 360, s: 1, v: 1, a: 1 };
|
|
3330
|
-
function stepize(start, end, steps) {
|
|
3331
|
-
let step = {};
|
|
3332
|
-
for (let k in start) {
|
|
3333
|
-
if (start.hasOwnProperty(k)) {
|
|
3334
|
-
step[k] = steps === 0 ? 0 : (end[k] - start[k]) / steps;
|
|
3335
|
-
}
|
|
3336
|
-
}
|
|
3337
|
-
return step;
|
|
3338
|
-
}
|
|
3339
|
-
function interpolate(step, start, i, max) {
|
|
3340
|
-
let color = {};
|
|
3341
|
-
for (let k in start) {
|
|
3342
|
-
if (start.hasOwnProperty(k)) {
|
|
3343
|
-
color[k] = step[k] * i + start[k];
|
|
3344
|
-
color[k] = color[k] < 0 ? color[k] + max[k] : max[k] !== 1 ? color[k] % max[k] : color[k];
|
|
3345
|
-
}
|
|
3346
|
-
}
|
|
3347
|
-
return color;
|
|
3348
|
-
}
|
|
3349
|
-
function interpolateRgb(stop1, stop2, steps) {
|
|
3350
|
-
const start = stop1.color.toRgb();
|
|
3351
|
-
const end = stop2.color.toRgb();
|
|
3352
|
-
const step = stepize(start, end, steps);
|
|
3353
|
-
let gradient2 = [stop1.color];
|
|
3354
|
-
for (let i = 1; i < steps; i++) {
|
|
3355
|
-
const color = interpolate(step, start, i, RGBA_MAX);
|
|
3356
|
-
gradient2.push(tinycolor(color));
|
|
3357
|
-
}
|
|
3358
|
-
return gradient2;
|
|
3359
|
-
}
|
|
3360
|
-
function interpolateHsv(stop1, stop2, steps, mode) {
|
|
3361
|
-
const start = stop1.color.toHsv();
|
|
3362
|
-
const end = stop2.color.toHsv();
|
|
3363
|
-
if (start.s === 0 || end.s === 0) {
|
|
3364
|
-
return interpolateRgb(stop1, stop2, steps);
|
|
3365
|
-
}
|
|
3366
|
-
let trigonometric;
|
|
3367
|
-
if (typeof mode === "boolean") {
|
|
3368
|
-
trigonometric = mode;
|
|
3369
|
-
} else {
|
|
3370
|
-
const trigShortest = start.h < end.h && end.h - start.h < 180 || start.h > end.h && start.h - end.h > 180;
|
|
3371
|
-
trigonometric = mode === "long" && trigShortest || mode === "short" && !trigShortest;
|
|
3372
|
-
}
|
|
3373
|
-
const step = stepize(start, end, steps);
|
|
3374
|
-
let gradient2 = [stop1.color];
|
|
3375
|
-
let diff;
|
|
3376
|
-
if (start.h <= end.h && !trigonometric || start.h >= end.h && trigonometric) {
|
|
3377
|
-
diff = end.h - start.h;
|
|
3378
|
-
} else if (trigonometric) {
|
|
3379
|
-
diff = 360 - end.h + start.h;
|
|
3380
|
-
} else {
|
|
3381
|
-
diff = 360 - start.h + end.h;
|
|
3382
|
-
}
|
|
3383
|
-
step.h = Math.pow(-1, trigonometric ? 1 : 0) * Math.abs(diff) / steps;
|
|
3384
|
-
for (let i = 1; i < steps; i++) {
|
|
3385
|
-
const color = interpolate(step, start, i, HSVA_MAX);
|
|
3386
|
-
gradient2.push(tinycolor(color));
|
|
3387
|
-
}
|
|
3388
|
-
return gradient2;
|
|
3389
|
-
}
|
|
3390
|
-
function computeSubsteps(stops, steps) {
|
|
3391
|
-
const l = stops.length;
|
|
3392
|
-
steps = parseInt(steps, 10);
|
|
3393
|
-
if (isNaN(steps) || steps < 2) {
|
|
3394
|
-
throw new Error("Invalid number of steps (< 2)");
|
|
3395
|
-
}
|
|
3396
|
-
if (steps < l) {
|
|
3397
|
-
throw new Error("Number of steps cannot be inferior to number of stops");
|
|
3398
|
-
}
|
|
3399
|
-
let substeps = [];
|
|
3400
|
-
for (let i = 1; i < l; i++) {
|
|
3401
|
-
const step = (steps - 1) * (stops[i].pos - stops[i - 1].pos);
|
|
3402
|
-
substeps.push(Math.max(1, Math.round(step)));
|
|
3403
|
-
}
|
|
3404
|
-
let totalSubsteps = 1;
|
|
3405
|
-
for (let n = l - 1; n--; ) totalSubsteps += substeps[n];
|
|
3406
|
-
while (totalSubsteps !== steps) {
|
|
3407
|
-
if (totalSubsteps < steps) {
|
|
3408
|
-
const min = Math.min.apply(null, substeps);
|
|
3409
|
-
substeps[substeps.indexOf(min)]++;
|
|
3410
|
-
totalSubsteps++;
|
|
3411
|
-
} else {
|
|
3412
|
-
const max = Math.max.apply(null, substeps);
|
|
3413
|
-
substeps[substeps.indexOf(max)]--;
|
|
3414
|
-
totalSubsteps--;
|
|
3415
|
-
}
|
|
3416
|
-
}
|
|
3417
|
-
return substeps;
|
|
3418
|
-
}
|
|
3419
|
-
function computeAt(stops, pos, method, max) {
|
|
3420
|
-
if (pos < 0 || pos > 1) {
|
|
3421
|
-
throw new Error("Position must be between 0 and 1");
|
|
3422
|
-
}
|
|
3423
|
-
let start, end;
|
|
3424
|
-
for (let i = 0, l = stops.length; i < l - 1; i++) {
|
|
3425
|
-
if (pos >= stops[i].pos && pos < stops[i + 1].pos) {
|
|
3426
|
-
start = stops[i];
|
|
3427
|
-
end = stops[i + 1];
|
|
3428
|
-
break;
|
|
3429
|
-
}
|
|
3430
|
-
}
|
|
3431
|
-
if (!start) {
|
|
3432
|
-
start = end = stops[stops.length - 1];
|
|
3433
|
-
}
|
|
3434
|
-
const step = stepize(start.color[method](), end.color[method](), (end.pos - start.pos) * 100);
|
|
3435
|
-
const color = interpolate(step, start.color[method](), (pos - start.pos) * 100, max);
|
|
3436
|
-
return tinycolor(color);
|
|
3437
|
-
}
|
|
3438
|
-
var TinyGradient = class _TinyGradient {
|
|
3439
|
-
/**
|
|
3440
|
-
* @param {StopInput[]|ColorInput[]} stops
|
|
3441
|
-
* @returns {TinyGradient}
|
|
3442
|
-
*/
|
|
3443
|
-
constructor(stops) {
|
|
3444
|
-
if (stops.length < 2) {
|
|
3445
|
-
throw new Error("Invalid number of stops (< 2)");
|
|
3446
|
-
}
|
|
3447
|
-
const havingPositions = stops[0].pos !== void 0;
|
|
3448
|
-
let l = stops.length;
|
|
3449
|
-
let p = -1;
|
|
3450
|
-
let lastColorLess = false;
|
|
3451
|
-
this.stops = stops.map((stop, i) => {
|
|
3452
|
-
const hasPosition = stop.pos !== void 0;
|
|
3453
|
-
if (havingPositions ^ hasPosition) {
|
|
3454
|
-
throw new Error("Cannot mix positionned and not posionned color stops");
|
|
3455
|
-
}
|
|
3456
|
-
if (hasPosition) {
|
|
3457
|
-
const hasColor = stop.color !== void 0;
|
|
3458
|
-
if (!hasColor && (lastColorLess || i === 0 || i === l - 1)) {
|
|
3459
|
-
throw new Error("Cannot define two consecutive position-only stops");
|
|
3460
|
-
}
|
|
3461
|
-
lastColorLess = !hasColor;
|
|
3462
|
-
stop = {
|
|
3463
|
-
color: hasColor ? tinycolor(stop.color) : null,
|
|
3464
|
-
colorLess: !hasColor,
|
|
3465
|
-
pos: stop.pos
|
|
3466
|
-
};
|
|
3467
|
-
if (stop.pos < 0 || stop.pos > 1) {
|
|
3468
|
-
throw new Error("Color stops positions must be between 0 and 1");
|
|
3469
|
-
} else if (stop.pos < p) {
|
|
3470
|
-
throw new Error("Color stops positions are not ordered");
|
|
3471
|
-
}
|
|
3472
|
-
p = stop.pos;
|
|
3473
|
-
} else {
|
|
3474
|
-
stop = {
|
|
3475
|
-
color: tinycolor(stop.color !== void 0 ? stop.color : stop),
|
|
3476
|
-
pos: i / (l - 1)
|
|
3477
|
-
};
|
|
3478
|
-
}
|
|
3479
|
-
return stop;
|
|
3480
|
-
});
|
|
3481
|
-
if (this.stops[0].pos !== 0) {
|
|
3482
|
-
this.stops.unshift({
|
|
3483
|
-
color: this.stops[0].color,
|
|
3484
|
-
pos: 0
|
|
3485
|
-
});
|
|
3486
|
-
l++;
|
|
3487
|
-
}
|
|
3488
|
-
if (this.stops[l - 1].pos !== 1) {
|
|
3489
|
-
this.stops.push({
|
|
3490
|
-
color: this.stops[l - 1].color,
|
|
3491
|
-
pos: 1
|
|
3492
|
-
});
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3495
|
-
/**
|
|
3496
|
-
* Return new instance with reversed stops
|
|
3497
|
-
* @return {TinyGradient}
|
|
3498
|
-
*/
|
|
3499
|
-
reverse() {
|
|
3500
|
-
let stops = [];
|
|
3501
|
-
this.stops.forEach(function(stop) {
|
|
3502
|
-
stops.push({
|
|
3503
|
-
color: stop.color,
|
|
3504
|
-
pos: 1 - stop.pos
|
|
3505
|
-
});
|
|
3506
|
-
});
|
|
3507
|
-
return new _TinyGradient(stops.reverse());
|
|
3508
|
-
}
|
|
3509
|
-
/**
|
|
3510
|
-
* Return new instance with looped stops
|
|
3511
|
-
* @return {TinyGradient}
|
|
3512
|
-
*/
|
|
3513
|
-
loop() {
|
|
3514
|
-
let stops1 = [];
|
|
3515
|
-
let stops2 = [];
|
|
3516
|
-
this.stops.forEach((stop) => {
|
|
3517
|
-
stops1.push({
|
|
3518
|
-
color: stop.color,
|
|
3519
|
-
pos: stop.pos / 2
|
|
3520
|
-
});
|
|
3521
|
-
});
|
|
3522
|
-
this.stops.slice(0, -1).forEach((stop) => {
|
|
3523
|
-
stops2.push({
|
|
3524
|
-
color: stop.color,
|
|
3525
|
-
pos: 1 - stop.pos / 2
|
|
3526
|
-
});
|
|
3527
|
-
});
|
|
3528
|
-
return new _TinyGradient(stops1.concat(stops2.reverse()));
|
|
3529
|
-
}
|
|
3530
|
-
/**
|
|
3531
|
-
* Generate gradient with RGBa interpolation
|
|
3532
|
-
* @param {number} steps
|
|
3533
|
-
* @return {tinycolor[]}
|
|
3534
|
-
*/
|
|
3535
|
-
rgb(steps) {
|
|
3536
|
-
const substeps = computeSubsteps(this.stops, steps);
|
|
3537
|
-
let gradient2 = [];
|
|
3538
|
-
this.stops.forEach((stop, i) => {
|
|
3539
|
-
if (stop.colorLess) {
|
|
3540
|
-
stop.color = interpolateRgb(this.stops[i - 1], this.stops[i + 1], 2)[1];
|
|
3541
|
-
}
|
|
3542
|
-
});
|
|
3543
|
-
for (let i = 0, l = this.stops.length; i < l - 1; i++) {
|
|
3544
|
-
const rgb = interpolateRgb(this.stops[i], this.stops[i + 1], substeps[i]);
|
|
3545
|
-
gradient2.splice(gradient2.length, 0, ...rgb);
|
|
3546
|
-
}
|
|
3547
|
-
gradient2.push(this.stops[this.stops.length - 1].color);
|
|
3548
|
-
return gradient2;
|
|
3549
|
-
}
|
|
3550
|
-
/**
|
|
3551
|
-
* Generate gradient with HSVa interpolation
|
|
3552
|
-
* @param {number} steps
|
|
3553
|
-
* @param {boolean|'long'|'short'} [mode=false]
|
|
3554
|
-
* - false to step in clockwise
|
|
3555
|
-
* - true to step in trigonometric order
|
|
3556
|
-
* - 'short' to use the shortest way
|
|
3557
|
-
* - 'long' to use the longest way
|
|
3558
|
-
* @return {tinycolor[]}
|
|
3559
|
-
*/
|
|
3560
|
-
hsv(steps, mode) {
|
|
3561
|
-
const substeps = computeSubsteps(this.stops, steps);
|
|
3562
|
-
let gradient2 = [];
|
|
3563
|
-
this.stops.forEach((stop, i) => {
|
|
3564
|
-
if (stop.colorLess) {
|
|
3565
|
-
stop.color = interpolateHsv(this.stops[i - 1], this.stops[i + 1], 2, mode)[1];
|
|
3566
|
-
}
|
|
3567
|
-
});
|
|
3568
|
-
for (let i = 0, l = this.stops.length; i < l - 1; i++) {
|
|
3569
|
-
const hsv = interpolateHsv(this.stops[i], this.stops[i + 1], substeps[i], mode);
|
|
3570
|
-
gradient2.splice(gradient2.length, 0, ...hsv);
|
|
3571
|
-
}
|
|
3572
|
-
gradient2.push(this.stops[this.stops.length - 1].color);
|
|
3573
|
-
return gradient2;
|
|
3574
|
-
}
|
|
3575
|
-
/**
|
|
3576
|
-
* Generate CSS3 command (no prefix) for this gradient
|
|
3577
|
-
* @param {String} [mode=linear] - 'linear' or 'radial'
|
|
3578
|
-
* @param {String} [direction] - default is 'to right' or 'ellipse at center'
|
|
3579
|
-
* @return {String}
|
|
3580
|
-
*/
|
|
3581
|
-
css(mode, direction) {
|
|
3582
|
-
mode = mode || "linear";
|
|
3583
|
-
direction = direction || (mode === "linear" ? "to right" : "ellipse at center");
|
|
3584
|
-
let css = mode + "-gradient(" + direction;
|
|
3585
|
-
this.stops.forEach(function(stop) {
|
|
3586
|
-
css += ", " + (stop.colorLess ? "" : stop.color.toRgbString() + " ") + stop.pos * 100 + "%";
|
|
3587
|
-
});
|
|
3588
|
-
css += ")";
|
|
3589
|
-
return css;
|
|
3590
|
-
}
|
|
3591
|
-
/**
|
|
3592
|
-
* Returns the color at specific position with RGBa interpolation
|
|
3593
|
-
* @param {number} pos, between 0 and 1
|
|
3594
|
-
* @return {tinycolor}
|
|
3595
|
-
*/
|
|
3596
|
-
rgbAt(pos) {
|
|
3597
|
-
return computeAt(this.stops, pos, "toRgb", RGBA_MAX);
|
|
3598
|
-
}
|
|
3599
|
-
/**
|
|
3600
|
-
* Returns the color at specific position with HSVa interpolation
|
|
3601
|
-
* @param {number} pos, between 0 and 1
|
|
3602
|
-
* @return {tinycolor}
|
|
3603
|
-
*/
|
|
3604
|
-
hsvAt(pos) {
|
|
3605
|
-
return computeAt(this.stops, pos, "toHsv", HSVA_MAX);
|
|
3606
|
-
}
|
|
3607
|
-
};
|
|
3608
|
-
module2.exports = function(stops) {
|
|
3609
|
-
if (arguments.length === 1) {
|
|
3610
|
-
if (!Array.isArray(arguments[0])) {
|
|
3611
|
-
throw new Error('"stops" is not an array');
|
|
3612
|
-
}
|
|
3613
|
-
stops = arguments[0];
|
|
3614
|
-
} else {
|
|
3615
|
-
stops = Array.prototype.slice.call(arguments);
|
|
3616
|
-
}
|
|
3617
|
-
return new TinyGradient(stops);
|
|
3618
|
-
};
|
|
3619
|
-
}
|
|
3620
|
-
});
|
|
3621
|
-
|
|
3622
|
-
// index.js
|
|
3623
|
-
var index_exports = {};
|
|
3624
|
-
__export(index_exports, {
|
|
3625
|
-
default: () => index_default
|
|
3626
|
-
});
|
|
3627
|
-
module.exports = __toCommonJS(index_exports);
|
|
3628
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
3629
|
-
var import_path = __toESM(require("path"), 1);
|
|
3630
|
-
var import_color = __toESM(require_color(), 1);
|
|
3631
|
-
|
|
3632
|
-
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
3633
|
-
var ANSI_BACKGROUND_OFFSET = 10;
|
|
3634
|
-
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
3635
|
-
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
3636
|
-
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
3637
|
-
var styles = {
|
|
3638
|
-
modifier: {
|
|
3639
|
-
reset: [0, 0],
|
|
3640
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
3641
|
-
bold: [1, 22],
|
|
3642
|
-
dim: [2, 22],
|
|
3643
|
-
italic: [3, 23],
|
|
3644
|
-
underline: [4, 24],
|
|
3645
|
-
overline: [53, 55],
|
|
3646
|
-
inverse: [7, 27],
|
|
3647
|
-
hidden: [8, 28],
|
|
3648
|
-
strikethrough: [9, 29]
|
|
3649
|
-
},
|
|
3650
|
-
color: {
|
|
3651
|
-
black: [30, 39],
|
|
3652
|
-
red: [31, 39],
|
|
3653
|
-
green: [32, 39],
|
|
3654
|
-
yellow: [33, 39],
|
|
3655
|
-
blue: [34, 39],
|
|
3656
|
-
magenta: [35, 39],
|
|
3657
|
-
cyan: [36, 39],
|
|
3658
|
-
white: [37, 39],
|
|
3659
|
-
// Bright color
|
|
3660
|
-
blackBright: [90, 39],
|
|
3661
|
-
gray: [90, 39],
|
|
3662
|
-
// Alias of `blackBright`
|
|
3663
|
-
grey: [90, 39],
|
|
3664
|
-
// Alias of `blackBright`
|
|
3665
|
-
redBright: [91, 39],
|
|
3666
|
-
greenBright: [92, 39],
|
|
3667
|
-
yellowBright: [93, 39],
|
|
3668
|
-
blueBright: [94, 39],
|
|
3669
|
-
magentaBright: [95, 39],
|
|
3670
|
-
cyanBright: [96, 39],
|
|
3671
|
-
whiteBright: [97, 39]
|
|
3672
|
-
},
|
|
3673
|
-
bgColor: {
|
|
3674
|
-
bgBlack: [40, 49],
|
|
3675
|
-
bgRed: [41, 49],
|
|
3676
|
-
bgGreen: [42, 49],
|
|
3677
|
-
bgYellow: [43, 49],
|
|
3678
|
-
bgBlue: [44, 49],
|
|
3679
|
-
bgMagenta: [45, 49],
|
|
3680
|
-
bgCyan: [46, 49],
|
|
3681
|
-
bgWhite: [47, 49],
|
|
3682
|
-
// Bright color
|
|
3683
|
-
bgBlackBright: [100, 49],
|
|
3684
|
-
bgGray: [100, 49],
|
|
3685
|
-
// Alias of `bgBlackBright`
|
|
3686
|
-
bgGrey: [100, 49],
|
|
3687
|
-
// Alias of `bgBlackBright`
|
|
3688
|
-
bgRedBright: [101, 49],
|
|
3689
|
-
bgGreenBright: [102, 49],
|
|
3690
|
-
bgYellowBright: [103, 49],
|
|
3691
|
-
bgBlueBright: [104, 49],
|
|
3692
|
-
bgMagentaBright: [105, 49],
|
|
3693
|
-
bgCyanBright: [106, 49],
|
|
3694
|
-
bgWhiteBright: [107, 49]
|
|
3695
|
-
}
|
|
3696
|
-
};
|
|
3697
|
-
var modifierNames = Object.keys(styles.modifier);
|
|
3698
|
-
var foregroundColorNames = Object.keys(styles.color);
|
|
3699
|
-
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
3700
|
-
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
3701
|
-
function assembleStyles() {
|
|
3702
|
-
const codes = /* @__PURE__ */ new Map();
|
|
3703
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
3704
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
3705
|
-
styles[styleName] = {
|
|
3706
|
-
open: `\x1B[${style[0]}m`,
|
|
3707
|
-
close: `\x1B[${style[1]}m`
|
|
3708
|
-
};
|
|
3709
|
-
group[styleName] = styles[styleName];
|
|
3710
|
-
codes.set(style[0], style[1]);
|
|
3711
|
-
}
|
|
3712
|
-
Object.defineProperty(styles, groupName, {
|
|
3713
|
-
value: group,
|
|
3714
|
-
enumerable: false
|
|
3715
|
-
});
|
|
3716
|
-
}
|
|
3717
|
-
Object.defineProperty(styles, "codes", {
|
|
3718
|
-
value: codes,
|
|
3719
|
-
enumerable: false
|
|
3720
|
-
});
|
|
3721
|
-
styles.color.close = "\x1B[39m";
|
|
3722
|
-
styles.bgColor.close = "\x1B[49m";
|
|
3723
|
-
styles.color.ansi = wrapAnsi16();
|
|
3724
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
3725
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
3726
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
3727
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
3728
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
3729
|
-
Object.defineProperties(styles, {
|
|
3730
|
-
rgbToAnsi256: {
|
|
3731
|
-
value(red, green, blue) {
|
|
3732
|
-
if (red === green && green === blue) {
|
|
3733
|
-
if (red < 8) {
|
|
3734
|
-
return 16;
|
|
3735
|
-
}
|
|
3736
|
-
if (red > 248) {
|
|
3737
|
-
return 231;
|
|
3738
|
-
}
|
|
3739
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
3740
|
-
}
|
|
3741
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
3742
|
-
},
|
|
3743
|
-
enumerable: false
|
|
3744
|
-
},
|
|
3745
|
-
hexToRgb: {
|
|
3746
|
-
value(hex2) {
|
|
3747
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex2.toString(16));
|
|
3748
|
-
if (!matches) {
|
|
3749
|
-
return [0, 0, 0];
|
|
3750
|
-
}
|
|
3751
|
-
let [colorString] = matches;
|
|
3752
|
-
if (colorString.length === 3) {
|
|
3753
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
3754
|
-
}
|
|
3755
|
-
const integer = Number.parseInt(colorString, 16);
|
|
3756
|
-
return [
|
|
3757
|
-
/* eslint-disable no-bitwise */
|
|
3758
|
-
integer >> 16 & 255,
|
|
3759
|
-
integer >> 8 & 255,
|
|
3760
|
-
integer & 255
|
|
3761
|
-
/* eslint-enable no-bitwise */
|
|
3762
|
-
];
|
|
3763
|
-
},
|
|
3764
|
-
enumerable: false
|
|
3765
|
-
},
|
|
3766
|
-
hexToAnsi256: {
|
|
3767
|
-
value: (hex2) => styles.rgbToAnsi256(...styles.hexToRgb(hex2)),
|
|
3768
|
-
enumerable: false
|
|
3769
|
-
},
|
|
3770
|
-
ansi256ToAnsi: {
|
|
3771
|
-
value(code) {
|
|
3772
|
-
if (code < 8) {
|
|
3773
|
-
return 30 + code;
|
|
3774
|
-
}
|
|
3775
|
-
if (code < 16) {
|
|
3776
|
-
return 90 + (code - 8);
|
|
3777
|
-
}
|
|
3778
|
-
let red;
|
|
3779
|
-
let green;
|
|
3780
|
-
let blue;
|
|
3781
|
-
if (code >= 232) {
|
|
3782
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
3783
|
-
green = red;
|
|
3784
|
-
blue = red;
|
|
3785
|
-
} else {
|
|
3786
|
-
code -= 16;
|
|
3787
|
-
const remainder = code % 36;
|
|
3788
|
-
red = Math.floor(code / 36) / 5;
|
|
3789
|
-
green = Math.floor(remainder / 6) / 5;
|
|
3790
|
-
blue = remainder % 6 / 5;
|
|
3791
|
-
}
|
|
3792
|
-
const value = Math.max(red, green, blue) * 2;
|
|
3793
|
-
if (value === 0) {
|
|
3794
|
-
return 30;
|
|
3795
|
-
}
|
|
3796
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
3797
|
-
if (value === 2) {
|
|
3798
|
-
result += 60;
|
|
3799
|
-
}
|
|
3800
|
-
return result;
|
|
3801
|
-
},
|
|
3802
|
-
enumerable: false
|
|
3803
|
-
},
|
|
3804
|
-
rgbToAnsi: {
|
|
3805
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
3806
|
-
enumerable: false
|
|
3807
|
-
},
|
|
3808
|
-
hexToAnsi: {
|
|
3809
|
-
value: (hex2) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex2)),
|
|
3810
|
-
enumerable: false
|
|
3811
|
-
}
|
|
3812
|
-
});
|
|
3813
|
-
return styles;
|
|
3814
|
-
}
|
|
3815
|
-
var ansiStyles = assembleStyles();
|
|
3816
|
-
var ansi_styles_default = ansiStyles;
|
|
3817
|
-
|
|
3818
|
-
// node_modules/chalk/source/vendor/supports-color/index.js
|
|
3819
|
-
var import_node_process = __toESM(require("node:process"), 1);
|
|
3820
|
-
var import_node_os = __toESM(require("node:os"), 1);
|
|
3821
|
-
var import_node_tty = __toESM(require("node:tty"), 1);
|
|
3822
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
|
3823
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
3824
|
-
const position = argv.indexOf(prefix + flag);
|
|
3825
|
-
const terminatorPosition = argv.indexOf("--");
|
|
3826
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
3827
|
-
}
|
|
3828
|
-
var { env } = import_node_process.default;
|
|
3829
|
-
var flagForceColor;
|
|
3830
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
3831
|
-
flagForceColor = 0;
|
|
3832
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
3833
|
-
flagForceColor = 1;
|
|
3834
|
-
}
|
|
3835
|
-
function envForceColor() {
|
|
3836
|
-
if ("FORCE_COLOR" in env) {
|
|
3837
|
-
if (env.FORCE_COLOR === "true") {
|
|
3838
|
-
return 1;
|
|
3839
|
-
}
|
|
3840
|
-
if (env.FORCE_COLOR === "false") {
|
|
3841
|
-
return 0;
|
|
3842
|
-
}
|
|
3843
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
3844
|
-
}
|
|
3845
|
-
}
|
|
3846
|
-
function translateLevel(level) {
|
|
3847
|
-
if (level === 0) {
|
|
3848
|
-
return false;
|
|
3849
|
-
}
|
|
3850
|
-
return {
|
|
3851
|
-
level,
|
|
3852
|
-
hasBasic: true,
|
|
3853
|
-
has256: level >= 2,
|
|
3854
|
-
has16m: level >= 3
|
|
3855
|
-
};
|
|
3856
|
-
}
|
|
3857
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
3858
|
-
const noFlagForceColor = envForceColor();
|
|
3859
|
-
if (noFlagForceColor !== void 0) {
|
|
3860
|
-
flagForceColor = noFlagForceColor;
|
|
3861
|
-
}
|
|
3862
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
3863
|
-
if (forceColor === 0) {
|
|
3864
|
-
return 0;
|
|
3865
|
-
}
|
|
3866
|
-
if (sniffFlags) {
|
|
3867
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
3868
|
-
return 3;
|
|
3869
|
-
}
|
|
3870
|
-
if (hasFlag("color=256")) {
|
|
3871
|
-
return 2;
|
|
3872
|
-
}
|
|
3873
|
-
}
|
|
3874
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
3875
|
-
return 1;
|
|
3876
|
-
}
|
|
3877
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
3878
|
-
return 0;
|
|
3879
|
-
}
|
|
3880
|
-
const min = forceColor || 0;
|
|
3881
|
-
if (env.TERM === "dumb") {
|
|
3882
|
-
return min;
|
|
3883
|
-
}
|
|
3884
|
-
if (import_node_process.default.platform === "win32") {
|
|
3885
|
-
const osRelease = import_node_os.default.release().split(".");
|
|
3886
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
3887
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
3888
|
-
}
|
|
3889
|
-
return 1;
|
|
3890
|
-
}
|
|
3891
|
-
if ("CI" in env) {
|
|
3892
|
-
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
3893
|
-
return 3;
|
|
3894
|
-
}
|
|
3895
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
3896
|
-
return 1;
|
|
3897
|
-
}
|
|
3898
|
-
return min;
|
|
3899
|
-
}
|
|
3900
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
3901
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
3902
|
-
}
|
|
3903
|
-
if (env.COLORTERM === "truecolor") {
|
|
3904
|
-
return 3;
|
|
3905
|
-
}
|
|
3906
|
-
if (env.TERM === "xterm-kitty") {
|
|
3907
|
-
return 3;
|
|
3908
|
-
}
|
|
3909
|
-
if (env.TERM === "xterm-ghostty") {
|
|
3910
|
-
return 3;
|
|
3911
|
-
}
|
|
3912
|
-
if (env.TERM === "wezterm") {
|
|
3913
|
-
return 3;
|
|
3914
|
-
}
|
|
3915
|
-
if ("TERM_PROGRAM" in env) {
|
|
3916
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
3917
|
-
switch (env.TERM_PROGRAM) {
|
|
3918
|
-
case "iTerm.app": {
|
|
3919
|
-
return version >= 3 ? 3 : 2;
|
|
3920
|
-
}
|
|
3921
|
-
case "Apple_Terminal": {
|
|
3922
|
-
return 2;
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
|
-
}
|
|
3926
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
3927
|
-
return 2;
|
|
3928
|
-
}
|
|
3929
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
3930
|
-
return 1;
|
|
3931
|
-
}
|
|
3932
|
-
if ("COLORTERM" in env) {
|
|
3933
|
-
return 1;
|
|
3934
|
-
}
|
|
3935
|
-
return min;
|
|
3936
|
-
}
|
|
3937
|
-
function createSupportsColor(stream, options = {}) {
|
|
3938
|
-
const level = _supportsColor(stream, {
|
|
3939
|
-
streamIsTTY: stream && stream.isTTY,
|
|
3940
|
-
...options
|
|
3941
|
-
});
|
|
3942
|
-
return translateLevel(level);
|
|
3943
|
-
}
|
|
3944
|
-
var supportsColor = {
|
|
3945
|
-
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
|
|
3946
|
-
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
|
|
3947
|
-
};
|
|
3948
|
-
var supports_color_default = supportsColor;
|
|
3949
|
-
|
|
3950
|
-
// node_modules/chalk/source/utilities.js
|
|
3951
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
3952
|
-
let index = string.indexOf(substring);
|
|
3953
|
-
if (index === -1) {
|
|
3954
|
-
return string;
|
|
3955
|
-
}
|
|
3956
|
-
const substringLength = substring.length;
|
|
3957
|
-
let endIndex = 0;
|
|
3958
|
-
let returnValue = "";
|
|
3959
|
-
do {
|
|
3960
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
3961
|
-
endIndex = index + substringLength;
|
|
3962
|
-
index = string.indexOf(substring, endIndex);
|
|
3963
|
-
} while (index !== -1);
|
|
3964
|
-
returnValue += string.slice(endIndex);
|
|
3965
|
-
return returnValue;
|
|
3966
|
-
}
|
|
3967
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
3968
|
-
let endIndex = 0;
|
|
3969
|
-
let returnValue = "";
|
|
3970
|
-
do {
|
|
3971
|
-
const gotCR = string[index - 1] === "\r";
|
|
3972
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
3973
|
-
endIndex = index + 1;
|
|
3974
|
-
index = string.indexOf("\n", endIndex);
|
|
3975
|
-
} while (index !== -1);
|
|
3976
|
-
returnValue += string.slice(endIndex);
|
|
3977
|
-
return returnValue;
|
|
3978
|
-
}
|
|
3979
|
-
|
|
3980
|
-
// node_modules/chalk/source/index.js
|
|
3981
|
-
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
3982
|
-
var GENERATOR = Symbol("GENERATOR");
|
|
3983
|
-
var STYLER = Symbol("STYLER");
|
|
3984
|
-
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
3985
|
-
var levelMapping = [
|
|
3986
|
-
"ansi",
|
|
3987
|
-
"ansi",
|
|
3988
|
-
"ansi256",
|
|
3989
|
-
"ansi16m"
|
|
3990
|
-
];
|
|
3991
|
-
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
3992
|
-
var applyOptions = (object, options = {}) => {
|
|
3993
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
3994
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3995
|
-
}
|
|
3996
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3997
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
3998
|
-
};
|
|
3999
|
-
var chalkFactory = (options) => {
|
|
4000
|
-
const chalk2 = (...strings) => strings.join(" ");
|
|
4001
|
-
applyOptions(chalk2, options);
|
|
4002
|
-
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
4003
|
-
return chalk2;
|
|
4004
|
-
};
|
|
4005
|
-
function createChalk(options) {
|
|
4006
|
-
return chalkFactory(options);
|
|
4007
|
-
}
|
|
4008
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
4009
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
4010
|
-
styles2[styleName] = {
|
|
4011
|
-
get() {
|
|
4012
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
4013
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
4014
|
-
return builder;
|
|
4015
|
-
}
|
|
4016
|
-
};
|
|
4017
|
-
}
|
|
4018
|
-
styles2.visible = {
|
|
4019
|
-
get() {
|
|
4020
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
4021
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
4022
|
-
return builder;
|
|
4023
|
-
}
|
|
4024
|
-
};
|
|
4025
|
-
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
4026
|
-
if (model === "rgb") {
|
|
4027
|
-
if (level === "ansi16m") {
|
|
4028
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
4029
|
-
}
|
|
4030
|
-
if (level === "ansi256") {
|
|
4031
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
4032
|
-
}
|
|
4033
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
4034
|
-
}
|
|
4035
|
-
if (model === "hex") {
|
|
4036
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
4037
|
-
}
|
|
4038
|
-
return ansi_styles_default[type][model](...arguments_);
|
|
4039
|
-
};
|
|
4040
|
-
var usedModels = ["rgb", "hex", "ansi256"];
|
|
4041
|
-
for (const model of usedModels) {
|
|
4042
|
-
styles2[model] = {
|
|
4043
|
-
get() {
|
|
4044
|
-
const { level } = this;
|
|
4045
|
-
return function(...arguments_) {
|
|
4046
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
4047
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
4048
|
-
};
|
|
4049
|
-
}
|
|
4050
|
-
};
|
|
4051
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
4052
|
-
styles2[bgModel] = {
|
|
4053
|
-
get() {
|
|
4054
|
-
const { level } = this;
|
|
4055
|
-
return function(...arguments_) {
|
|
4056
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
4057
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
4058
|
-
};
|
|
4059
|
-
}
|
|
4060
|
-
};
|
|
4061
|
-
}
|
|
4062
|
-
var proto = Object.defineProperties(() => {
|
|
4063
|
-
}, {
|
|
4064
|
-
...styles2,
|
|
4065
|
-
level: {
|
|
4066
|
-
enumerable: true,
|
|
4067
|
-
get() {
|
|
4068
|
-
return this[GENERATOR].level;
|
|
4069
|
-
},
|
|
4070
|
-
set(level) {
|
|
4071
|
-
this[GENERATOR].level = level;
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
});
|
|
4075
|
-
var createStyler = (open, close, parent) => {
|
|
4076
|
-
let openAll;
|
|
4077
|
-
let closeAll;
|
|
4078
|
-
if (parent === void 0) {
|
|
4079
|
-
openAll = open;
|
|
4080
|
-
closeAll = close;
|
|
4081
|
-
} else {
|
|
4082
|
-
openAll = parent.openAll + open;
|
|
4083
|
-
closeAll = close + parent.closeAll;
|
|
4084
|
-
}
|
|
4085
|
-
return {
|
|
4086
|
-
open,
|
|
4087
|
-
close,
|
|
4088
|
-
openAll,
|
|
4089
|
-
closeAll,
|
|
4090
|
-
parent
|
|
4091
|
-
};
|
|
4092
|
-
};
|
|
4093
|
-
var createBuilder = (self2, _styler, _isEmpty) => {
|
|
4094
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
4095
|
-
Object.setPrototypeOf(builder, proto);
|
|
4096
|
-
builder[GENERATOR] = self2;
|
|
4097
|
-
builder[STYLER] = _styler;
|
|
4098
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
4099
|
-
return builder;
|
|
4100
|
-
};
|
|
4101
|
-
var applyStyle = (self2, string) => {
|
|
4102
|
-
if (self2.level <= 0 || !string) {
|
|
4103
|
-
return self2[IS_EMPTY] ? "" : string;
|
|
4104
|
-
}
|
|
4105
|
-
let styler = self2[STYLER];
|
|
4106
|
-
if (styler === void 0) {
|
|
4107
|
-
return string;
|
|
4108
|
-
}
|
|
4109
|
-
const { openAll, closeAll } = styler;
|
|
4110
|
-
if (string.includes("\x1B")) {
|
|
4111
|
-
while (styler !== void 0) {
|
|
4112
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
4113
|
-
styler = styler.parent;
|
|
4114
|
-
}
|
|
4115
|
-
}
|
|
4116
|
-
const lfIndex = string.indexOf("\n");
|
|
4117
|
-
if (lfIndex !== -1) {
|
|
4118
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
4119
|
-
}
|
|
4120
|
-
return openAll + string + closeAll;
|
|
4121
|
-
};
|
|
4122
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
4123
|
-
var chalk = createChalk();
|
|
4124
|
-
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
4125
|
-
var source_default = chalk;
|
|
4126
|
-
|
|
4127
|
-
// node_modules/gradient-string/dist/index.js
|
|
4128
|
-
var import_tinygradient = __toESM(require_tinygradient(), 1);
|
|
4129
|
-
var gradient = (...colors) => {
|
|
4130
|
-
let gradient2;
|
|
4131
|
-
let options;
|
|
4132
|
-
if (colors.length === 0) {
|
|
4133
|
-
throw new Error("Missing gradient colors");
|
|
4134
|
-
}
|
|
4135
|
-
if (!Array.isArray(colors[0])) {
|
|
4136
|
-
if (colors.length === 1) {
|
|
4137
|
-
throw new Error(`Expected an array of colors, received ${JSON.stringify(colors[0])}`);
|
|
4138
|
-
}
|
|
4139
|
-
gradient2 = (0, import_tinygradient.default)(...colors);
|
|
4140
|
-
} else {
|
|
4141
|
-
gradient2 = (0, import_tinygradient.default)(colors[0]);
|
|
4142
|
-
options = validateOptions(colors[1]);
|
|
4143
|
-
}
|
|
4144
|
-
const fn = (str, deprecatedOptions) => {
|
|
4145
|
-
return applyGradient(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
|
|
4146
|
-
};
|
|
4147
|
-
fn.multiline = (str, deprecatedOptions) => multiline(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
|
|
4148
|
-
return fn;
|
|
4149
|
-
};
|
|
4150
|
-
var getColors = (gradient2, options, count) => {
|
|
4151
|
-
return options.interpolation?.toLowerCase() === "hsv" ? gradient2.hsv(count, options.hsvSpin?.toLowerCase() || false) : gradient2.rgb(count);
|
|
4152
|
-
};
|
|
4153
|
-
function applyGradient(str, gradient2, opts) {
|
|
4154
|
-
const options = validateOptions(opts);
|
|
4155
|
-
const colorsCount = Math.max(str.replace(/\s/g, "").length, gradient2.stops.length);
|
|
4156
|
-
const colors = getColors(gradient2, options, colorsCount);
|
|
4157
|
-
let result = "";
|
|
4158
|
-
for (const s of str) {
|
|
4159
|
-
result += s.match(/\s/g) ? s : source_default.hex(colors.shift()?.toHex() || "#000")(s);
|
|
4160
|
-
}
|
|
4161
|
-
return result;
|
|
4162
|
-
}
|
|
4163
|
-
function multiline(str, gradient2, opts) {
|
|
4164
|
-
const options = validateOptions(opts);
|
|
4165
|
-
const lines = str.split("\n");
|
|
4166
|
-
const maxLength = Math.max(...lines.map((l) => l.length), gradient2.stops.length);
|
|
4167
|
-
const colors = getColors(gradient2, options, maxLength);
|
|
4168
|
-
const results = [];
|
|
4169
|
-
for (const line of lines) {
|
|
4170
|
-
const lineColors = colors.slice(0);
|
|
4171
|
-
let lineResult = "";
|
|
4172
|
-
for (const l of line) {
|
|
4173
|
-
lineResult += source_default.hex(lineColors.shift()?.toHex() || "#000")(l);
|
|
4174
|
-
}
|
|
4175
|
-
results.push(lineResult);
|
|
4176
|
-
}
|
|
4177
|
-
return results.join("\n");
|
|
4178
|
-
}
|
|
4179
|
-
function validateOptions(opts) {
|
|
4180
|
-
const options = { interpolation: "rgb", hsvSpin: "short", ...opts };
|
|
4181
|
-
if (opts !== void 0 && typeof opts !== "object") {
|
|
4182
|
-
throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof opts}\``);
|
|
4183
|
-
}
|
|
4184
|
-
if (typeof options.interpolation !== "string") {
|
|
4185
|
-
throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof options.interpolation}\``);
|
|
4186
|
-
}
|
|
4187
|
-
if (options.interpolation.toLowerCase() === "hsv" && typeof options.hsvSpin !== "string") {
|
|
4188
|
-
throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof options.hsvSpin}\``);
|
|
4189
|
-
}
|
|
4190
|
-
return options;
|
|
4191
|
-
}
|
|
4192
|
-
var aliases = {
|
|
4193
|
-
atlas: { colors: ["#feac5e", "#c779d0", "#4bc0c8"], options: {} },
|
|
4194
|
-
cristal: { colors: ["#bdfff3", "#4ac29a"], options: {} },
|
|
4195
|
-
teen: { colors: ["#77a1d3", "#79cbca", "#e684ae"], options: {} },
|
|
4196
|
-
mind: { colors: ["#473b7b", "#3584a7", "#30d2be"], options: {} },
|
|
4197
|
-
morning: { colors: ["#ff5f6d", "#ffc371"], options: { interpolation: "hsv" } },
|
|
4198
|
-
vice: { colors: ["#5ee7df", "#b490ca"], options: { interpolation: "hsv" } },
|
|
4199
|
-
passion: { colors: ["#f43b47", "#453a94"], options: {} },
|
|
4200
|
-
fruit: { colors: ["#ff4e50", "#f9d423"], options: {} },
|
|
4201
|
-
instagram: { colors: ["#833ab4", "#fd1d1d", "#fcb045"], options: {} },
|
|
4202
|
-
retro: {
|
|
4203
|
-
colors: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
|
|
4204
|
-
options: {}
|
|
4205
|
-
},
|
|
4206
|
-
summer: { colors: ["#fdbb2d", "#22c1c3"], options: {} },
|
|
4207
|
-
rainbow: { colors: ["#ff0000", "#ff0100"], options: { interpolation: "hsv", hsvSpin: "long" } },
|
|
4208
|
-
pastel: { colors: ["#74ebd5", "#74ecd5"], options: { interpolation: "hsv", hsvSpin: "long" } }
|
|
4209
|
-
};
|
|
4210
|
-
function gradientAlias(alias) {
|
|
4211
|
-
const result = (str) => gradient(...alias.colors)(str, alias.options);
|
|
4212
|
-
result.multiline = (str = "") => gradient(...alias.colors).multiline(str, alias.options);
|
|
4213
|
-
return result;
|
|
4214
|
-
}
|
|
4215
|
-
var dist_default = gradient;
|
|
4216
|
-
var atlas = gradientAlias(aliases.atlas);
|
|
4217
|
-
var cristal = gradientAlias(aliases.cristal);
|
|
4218
|
-
var teen = gradientAlias(aliases.teen);
|
|
4219
|
-
var mind = gradientAlias(aliases.mind);
|
|
4220
|
-
var morning = gradientAlias(aliases.morning);
|
|
4221
|
-
var vice = gradientAlias(aliases.vice);
|
|
4222
|
-
var passion = gradientAlias(aliases.passion);
|
|
4223
|
-
var fruit = gradientAlias(aliases.fruit);
|
|
4224
|
-
var instagram = gradientAlias(aliases.instagram);
|
|
4225
|
-
var retro = gradientAlias(aliases.retro);
|
|
4226
|
-
var summer = gradientAlias(aliases.summer);
|
|
4227
|
-
var rainbow = gradientAlias(aliases.rainbow);
|
|
4228
|
-
var pastel = gradientAlias(aliases.pastel);
|
|
4229
|
-
gradient.atlas = atlas;
|
|
4230
|
-
gradient.cristal = cristal;
|
|
4231
|
-
gradient.teen = teen;
|
|
4232
|
-
gradient.mind = mind;
|
|
4233
|
-
gradient.morning = morning;
|
|
4234
|
-
gradient.vice = vice;
|
|
4235
|
-
gradient.passion = passion;
|
|
4236
|
-
gradient.fruit = fruit;
|
|
4237
|
-
gradient.instagram = instagram;
|
|
4238
|
-
gradient.retro = retro;
|
|
4239
|
-
gradient.summer = summer;
|
|
4240
|
-
gradient.rainbow = rainbow;
|
|
4241
|
-
gradient.pastel = pastel;
|
|
4242
|
-
|
|
4243
|
-
// index.js
|
|
4244
|
-
var aaDir = import_path.default.join(__dirname, "aa");
|
|
4245
|
-
function nekos(options = {}) {
|
|
4246
|
-
const { id } = options;
|
|
4247
|
-
let { colors } = options;
|
|
4248
|
-
let catAscii = "";
|
|
4249
|
-
try {
|
|
4250
|
-
const files = import_fs.default.readdirSync(aaDir);
|
|
4251
|
-
if (files.length === 0) {
|
|
4252
|
-
console.error("Error: 'aa' directory is empty or does not exist.");
|
|
4253
|
-
return;
|
|
4254
|
-
}
|
|
4255
|
-
let targetFile;
|
|
4256
|
-
if (id && files.includes(`${id}.txt`)) {
|
|
4257
|
-
targetFile = `${id}.txt`;
|
|
4258
|
-
} else {
|
|
4259
|
-
const randomIndex = Math.floor(Math.random() * files.length);
|
|
4260
|
-
targetFile = files[randomIndex];
|
|
4261
|
-
}
|
|
4262
|
-
const filePath = import_path.default.join(aaDir, targetFile);
|
|
4263
|
-
catAscii = import_fs.default.readFileSync(filePath, "utf-8");
|
|
4264
|
-
} catch (error) {
|
|
4265
|
-
console.error("Error reading ascii art file:", error);
|
|
4266
|
-
return;
|
|
4267
|
-
}
|
|
4268
|
-
if (colors) {
|
|
4269
|
-
let processedColors;
|
|
4270
|
-
const rainbowColors = [
|
|
4271
|
-
"red",
|
|
4272
|
-
"orange",
|
|
4273
|
-
"yellow",
|
|
4274
|
-
"green",
|
|
4275
|
-
"blue",
|
|
4276
|
-
"violet"
|
|
4277
|
-
];
|
|
4278
|
-
if (typeof colors === "string") {
|
|
4279
|
-
const upperCaseColor = colors.toUpperCase();
|
|
4280
|
-
if (upperCaseColor === "RAINBOW") {
|
|
4281
|
-
processedColors = rainbowColors;
|
|
4282
|
-
} else if (upperCaseColor === "RANDOM") {
|
|
4283
|
-
processedColors = [(0, import_color.hex)("#")];
|
|
4284
|
-
} else {
|
|
4285
|
-
processedColors = [colors];
|
|
4286
|
-
}
|
|
4287
|
-
} else if (Array.isArray(colors)) {
|
|
4288
|
-
processedColors = colors.map(
|
|
4289
|
-
(color) => typeof color === "string" && color.toUpperCase() === "RANDOM" ? (0, import_color.hex)("#") : color
|
|
4290
|
-
);
|
|
4291
|
-
} else {
|
|
4292
|
-
processedColors = colors;
|
|
4293
|
-
}
|
|
4294
|
-
if (Array.isArray(processedColors) && processedColors.length === 1) {
|
|
4295
|
-
processedColors.push(processedColors[0]);
|
|
4296
|
-
}
|
|
4297
|
-
if (processedColors && processedColors.length > 0) {
|
|
4298
|
-
console.log(dist_default(processedColors)(catAscii));
|
|
4299
|
-
} else {
|
|
4300
|
-
console.log(catAscii);
|
|
4301
|
-
}
|
|
4302
|
-
} else {
|
|
4303
|
-
console.log(catAscii);
|
|
4304
|
-
}
|
|
4305
|
-
}
|
|
4306
|
-
var index_default = nekos;
|