@blazediff/cli 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.js +717 -624
- package/dist/commands/core-wasm.js +9376 -0
- package/dist/commands/core.js +370 -363
- package/dist/commands/gmsd.js +199 -199
- package/dist/commands/hitchhikers-ssim.js +192 -192
- package/dist/commands/msssim.js +205 -205
- package/dist/commands/ssim.js +228 -228
- package/dist/index.d.ts +2 -0
- package/package.json +3 -2
package/dist/commands/core.js
CHANGED
|
@@ -2129,20 +2129,20 @@ __export(dist_exports, {
|
|
|
2129
2129
|
default: () => m
|
|
2130
2130
|
});
|
|
2131
2131
|
async function d(r) {
|
|
2132
|
-
return new Promise((i3,
|
|
2132
|
+
return new Promise((i3, n2) => {
|
|
2133
2133
|
try {
|
|
2134
2134
|
let t = typeof r == "string" ? (0, import_fs.readFileSync)(r) : r, e = import_pngjs.PNG.sync.read(t);
|
|
2135
2135
|
i3({ data: e.data, width: e.width, height: e.height });
|
|
2136
2136
|
} catch (t) {
|
|
2137
|
-
|
|
2137
|
+
n2(new Error(`Failed to read PNG file ${r}: ${t}`));
|
|
2138
2138
|
}
|
|
2139
2139
|
});
|
|
2140
2140
|
}
|
|
2141
2141
|
async function c(r, i3) {
|
|
2142
|
-
return new Promise((
|
|
2142
|
+
return new Promise((n2, t) => {
|
|
2143
2143
|
try {
|
|
2144
2144
|
let e = new import_pngjs.PNG({ width: r.width, height: r.height });
|
|
2145
|
-
e.data = Buffer.isBuffer(r.data) ? r.data : Buffer.from(r.data.buffer), (0, import_fs.writeFileSync)(i3, import_pngjs.PNG.sync.write(e)),
|
|
2145
|
+
e.data = Buffer.isBuffer(r.data) ? r.data : Buffer.from(r.data.buffer), (0, import_fs.writeFileSync)(i3, import_pngjs.PNG.sync.write(e)), n2();
|
|
2146
2146
|
} catch (e) {
|
|
2147
2147
|
t(new Error(`Failed to write PNG file ${i3}: ${e}`));
|
|
2148
2148
|
}
|
|
@@ -2355,7 +2355,7 @@ var require_detect_libc = __commonJS({
|
|
|
2355
2355
|
var GLIBC = "glibc";
|
|
2356
2356
|
var RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i;
|
|
2357
2357
|
var MUSL = "musl";
|
|
2358
|
-
var isFileMusl = (
|
|
2358
|
+
var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
2359
2359
|
var familyFromReport = () => {
|
|
2360
2360
|
const report = getReport();
|
|
2361
2361
|
if (report.header && report.header.glibcVersionRuntime) {
|
|
@@ -6241,11 +6241,11 @@ var require_color = __commonJS({
|
|
|
6241
6241
|
const match = string.match(hsl);
|
|
6242
6242
|
if (match) {
|
|
6243
6243
|
const alpha = Number.parseFloat(match[4]);
|
|
6244
|
-
const
|
|
6244
|
+
const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6245
6245
|
const s = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6246
|
-
const
|
|
6246
|
+
const l = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6247
6247
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6248
|
-
return [
|
|
6248
|
+
return [h4, s, l, a2];
|
|
6249
6249
|
}
|
|
6250
6250
|
return null;
|
|
6251
6251
|
};
|
|
@@ -6257,11 +6257,11 @@ var require_color = __commonJS({
|
|
|
6257
6257
|
const match = string.match(hwb);
|
|
6258
6258
|
if (match) {
|
|
6259
6259
|
const alpha = Number.parseFloat(match[4]);
|
|
6260
|
-
const
|
|
6261
|
-
const
|
|
6260
|
+
const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6261
|
+
const w2 = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6262
6262
|
const b = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6263
6263
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6264
|
-
return [
|
|
6264
|
+
return [h4, w2, b, a2];
|
|
6265
6265
|
}
|
|
6266
6266
|
return null;
|
|
6267
6267
|
};
|
|
@@ -6353,45 +6353,45 @@ var require_color = __commonJS({
|
|
|
6353
6353
|
const min = Math.min(r, g2, b);
|
|
6354
6354
|
const max = Math.max(r, g2, b);
|
|
6355
6355
|
const delta = max - min;
|
|
6356
|
-
let
|
|
6356
|
+
let h4;
|
|
6357
6357
|
let s;
|
|
6358
6358
|
switch (max) {
|
|
6359
6359
|
case min: {
|
|
6360
|
-
|
|
6360
|
+
h4 = 0;
|
|
6361
6361
|
break;
|
|
6362
6362
|
}
|
|
6363
6363
|
case r: {
|
|
6364
|
-
|
|
6364
|
+
h4 = (g2 - b) / delta;
|
|
6365
6365
|
break;
|
|
6366
6366
|
}
|
|
6367
6367
|
case g2: {
|
|
6368
|
-
|
|
6368
|
+
h4 = 2 + (b - r) / delta;
|
|
6369
6369
|
break;
|
|
6370
6370
|
}
|
|
6371
6371
|
case b: {
|
|
6372
|
-
|
|
6372
|
+
h4 = 4 + (r - g2) / delta;
|
|
6373
6373
|
break;
|
|
6374
6374
|
}
|
|
6375
6375
|
}
|
|
6376
|
-
|
|
6377
|
-
if (
|
|
6378
|
-
|
|
6376
|
+
h4 = Math.min(h4 * 60, 360);
|
|
6377
|
+
if (h4 < 0) {
|
|
6378
|
+
h4 += 360;
|
|
6379
6379
|
}
|
|
6380
|
-
const
|
|
6380
|
+
const l = (min + max) / 2;
|
|
6381
6381
|
if (max === min) {
|
|
6382
6382
|
s = 0;
|
|
6383
|
-
} else if (
|
|
6383
|
+
} else if (l <= 0.5) {
|
|
6384
6384
|
s = delta / (max + min);
|
|
6385
6385
|
} else {
|
|
6386
6386
|
s = delta / (2 - max - min);
|
|
6387
6387
|
}
|
|
6388
|
-
return [
|
|
6388
|
+
return [h4, s * 100, l * 100];
|
|
6389
6389
|
};
|
|
6390
6390
|
convert.rgb.hsv = function(rgb) {
|
|
6391
6391
|
let rdif;
|
|
6392
6392
|
let gdif;
|
|
6393
6393
|
let bdif;
|
|
6394
|
-
let
|
|
6394
|
+
let h4;
|
|
6395
6395
|
let s;
|
|
6396
6396
|
const r = rgb[0] / 255;
|
|
6397
6397
|
const g2 = rgb[1] / 255;
|
|
@@ -6402,7 +6402,7 @@ var require_color = __commonJS({
|
|
|
6402
6402
|
return (v - c3) / 6 / diff + 1 / 2;
|
|
6403
6403
|
};
|
|
6404
6404
|
if (diff === 0) {
|
|
6405
|
-
|
|
6405
|
+
h4 = 0;
|
|
6406
6406
|
s = 0;
|
|
6407
6407
|
} else {
|
|
6408
6408
|
s = diff / v;
|
|
@@ -6411,26 +6411,26 @@ var require_color = __commonJS({
|
|
|
6411
6411
|
bdif = diffc(b);
|
|
6412
6412
|
switch (v) {
|
|
6413
6413
|
case r: {
|
|
6414
|
-
|
|
6414
|
+
h4 = bdif - gdif;
|
|
6415
6415
|
break;
|
|
6416
6416
|
}
|
|
6417
6417
|
case g2: {
|
|
6418
|
-
|
|
6418
|
+
h4 = 1 / 3 + rdif - bdif;
|
|
6419
6419
|
break;
|
|
6420
6420
|
}
|
|
6421
6421
|
case b: {
|
|
6422
|
-
|
|
6422
|
+
h4 = 2 / 3 + gdif - rdif;
|
|
6423
6423
|
break;
|
|
6424
6424
|
}
|
|
6425
6425
|
}
|
|
6426
|
-
if (
|
|
6427
|
-
|
|
6428
|
-
} else if (
|
|
6429
|
-
|
|
6426
|
+
if (h4 < 0) {
|
|
6427
|
+
h4 += 1;
|
|
6428
|
+
} else if (h4 > 1) {
|
|
6429
|
+
h4 -= 1;
|
|
6430
6430
|
}
|
|
6431
6431
|
}
|
|
6432
6432
|
return [
|
|
6433
|
-
|
|
6433
|
+
h4 * 360,
|
|
6434
6434
|
s * 100,
|
|
6435
6435
|
v * 100
|
|
6436
6436
|
];
|
|
@@ -6439,10 +6439,10 @@ var require_color = __commonJS({
|
|
|
6439
6439
|
const r = rgb[0];
|
|
6440
6440
|
const g2 = rgb[1];
|
|
6441
6441
|
let b = rgb[2];
|
|
6442
|
-
const
|
|
6443
|
-
const
|
|
6442
|
+
const h4 = convert.rgb.hsl(rgb)[0];
|
|
6443
|
+
const w2 = 1 / 255 * Math.min(r, Math.min(g2, b));
|
|
6444
6444
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g2, b));
|
|
6445
|
-
return [
|
|
6445
|
+
return [h4, w2 * 100, b * 100];
|
|
6446
6446
|
};
|
|
6447
6447
|
convert.rgb.oklab = function(rgb) {
|
|
6448
6448
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
@@ -6451,10 +6451,10 @@ var require_color = __commonJS({
|
|
|
6451
6451
|
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g2 + 0.0514459929 * b);
|
|
6452
6452
|
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g2 + 0.1073969566 * b);
|
|
6453
6453
|
const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g2 + 0.6299787005 * b);
|
|
6454
|
-
const
|
|
6454
|
+
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6455
6455
|
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6456
6456
|
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
6457
|
-
return [
|
|
6457
|
+
return [l * 100, aa * 100, bb * 100];
|
|
6458
6458
|
};
|
|
6459
6459
|
convert.rgb.cmyk = function(rgb) {
|
|
6460
6460
|
const r = rgb[0] / 255;
|
|
@@ -6509,26 +6509,26 @@ var require_color = __commonJS({
|
|
|
6509
6509
|
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6510
6510
|
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6511
6511
|
z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
6512
|
-
const
|
|
6512
|
+
const l = 116 * y - 16;
|
|
6513
6513
|
const a2 = 500 * (x - y);
|
|
6514
6514
|
const b = 200 * (y - z);
|
|
6515
|
-
return [
|
|
6515
|
+
return [l, a2, b];
|
|
6516
6516
|
};
|
|
6517
6517
|
convert.hsl.rgb = function(hsl) {
|
|
6518
|
-
const
|
|
6518
|
+
const h4 = hsl[0] / 360;
|
|
6519
6519
|
const s = hsl[1] / 100;
|
|
6520
|
-
const
|
|
6520
|
+
const l = hsl[2] / 100;
|
|
6521
6521
|
let t3;
|
|
6522
6522
|
let value;
|
|
6523
6523
|
if (s === 0) {
|
|
6524
|
-
value =
|
|
6524
|
+
value = l * 255;
|
|
6525
6525
|
return [value, value, value];
|
|
6526
6526
|
}
|
|
6527
|
-
const t2 =
|
|
6528
|
-
const t1 = 2 *
|
|
6527
|
+
const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
6528
|
+
const t1 = 2 * l - t2;
|
|
6529
6529
|
const rgb = [0, 0, 0];
|
|
6530
6530
|
for (let i3 = 0; i3 < 3; i3++) {
|
|
6531
|
-
t3 =
|
|
6531
|
+
t3 = h4 + 1 / 3 * -(i3 - 1);
|
|
6532
6532
|
if (t3 < 0) {
|
|
6533
6533
|
t3++;
|
|
6534
6534
|
}
|
|
@@ -6549,27 +6549,27 @@ var require_color = __commonJS({
|
|
|
6549
6549
|
return rgb;
|
|
6550
6550
|
};
|
|
6551
6551
|
convert.hsl.hsv = function(hsl) {
|
|
6552
|
-
const
|
|
6552
|
+
const h4 = hsl[0];
|
|
6553
6553
|
let s = hsl[1] / 100;
|
|
6554
|
-
let
|
|
6554
|
+
let l = hsl[2] / 100;
|
|
6555
6555
|
let smin = s;
|
|
6556
|
-
const lmin = Math.max(
|
|
6557
|
-
|
|
6558
|
-
s *=
|
|
6556
|
+
const lmin = Math.max(l, 0.01);
|
|
6557
|
+
l *= 2;
|
|
6558
|
+
s *= l <= 1 ? l : 2 - l;
|
|
6559
6559
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
6560
|
-
const v = (
|
|
6561
|
-
const sv =
|
|
6562
|
-
return [
|
|
6560
|
+
const v = (l + s) / 2;
|
|
6561
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
6562
|
+
return [h4, sv * 100, v * 100];
|
|
6563
6563
|
};
|
|
6564
6564
|
convert.hsv.rgb = function(hsv) {
|
|
6565
|
-
const
|
|
6565
|
+
const h4 = hsv[0] / 60;
|
|
6566
6566
|
const s = hsv[1] / 100;
|
|
6567
6567
|
let v = hsv[2] / 100;
|
|
6568
|
-
const hi = Math.floor(
|
|
6569
|
-
const
|
|
6568
|
+
const hi = Math.floor(h4) % 6;
|
|
6569
|
+
const f = h4 - Math.floor(h4);
|
|
6570
6570
|
const p2 = 255 * v * (1 - s);
|
|
6571
|
-
const q2 = 255 * v * (1 - s *
|
|
6572
|
-
const t = 255 * v * (1 - s * (1 -
|
|
6571
|
+
const q2 = 255 * v * (1 - s * f);
|
|
6572
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
6573
6573
|
v *= 255;
|
|
6574
6574
|
switch (hi) {
|
|
6575
6575
|
case 0: {
|
|
@@ -6593,37 +6593,37 @@ var require_color = __commonJS({
|
|
|
6593
6593
|
}
|
|
6594
6594
|
};
|
|
6595
6595
|
convert.hsv.hsl = function(hsv) {
|
|
6596
|
-
const
|
|
6596
|
+
const h4 = hsv[0];
|
|
6597
6597
|
const s = hsv[1] / 100;
|
|
6598
6598
|
const v = hsv[2] / 100;
|
|
6599
6599
|
const vmin = Math.max(v, 0.01);
|
|
6600
6600
|
let sl;
|
|
6601
|
-
let
|
|
6602
|
-
|
|
6601
|
+
let l;
|
|
6602
|
+
l = (2 - s) * v;
|
|
6603
6603
|
const lmin = (2 - s) * vmin;
|
|
6604
6604
|
sl = s * vmin;
|
|
6605
6605
|
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
6606
6606
|
sl = sl || 0;
|
|
6607
|
-
|
|
6608
|
-
return [
|
|
6607
|
+
l /= 2;
|
|
6608
|
+
return [h4, sl * 100, l * 100];
|
|
6609
6609
|
};
|
|
6610
6610
|
convert.hwb.rgb = function(hwb) {
|
|
6611
|
-
const
|
|
6611
|
+
const h4 = hwb[0] / 360;
|
|
6612
6612
|
let wh = hwb[1] / 100;
|
|
6613
6613
|
let bl = hwb[2] / 100;
|
|
6614
6614
|
const ratio = wh + bl;
|
|
6615
|
-
let
|
|
6615
|
+
let f;
|
|
6616
6616
|
if (ratio > 1) {
|
|
6617
6617
|
wh /= ratio;
|
|
6618
6618
|
bl /= ratio;
|
|
6619
6619
|
}
|
|
6620
|
-
const i3 = Math.floor(6 *
|
|
6620
|
+
const i3 = Math.floor(6 * h4);
|
|
6621
6621
|
const v = 1 - bl;
|
|
6622
|
-
|
|
6622
|
+
f = 6 * h4 - i3;
|
|
6623
6623
|
if ((i3 & 1) !== 0) {
|
|
6624
|
-
|
|
6624
|
+
f = 1 - f;
|
|
6625
6625
|
}
|
|
6626
|
-
const
|
|
6626
|
+
const n2 = wh + f * (v - wh);
|
|
6627
6627
|
let r;
|
|
6628
6628
|
let g2;
|
|
6629
6629
|
let b;
|
|
@@ -6632,12 +6632,12 @@ var require_color = __commonJS({
|
|
|
6632
6632
|
case 6:
|
|
6633
6633
|
case 0: {
|
|
6634
6634
|
r = v;
|
|
6635
|
-
g2 =
|
|
6635
|
+
g2 = n2;
|
|
6636
6636
|
b = wh;
|
|
6637
6637
|
break;
|
|
6638
6638
|
}
|
|
6639
6639
|
case 1: {
|
|
6640
|
-
r =
|
|
6640
|
+
r = n2;
|
|
6641
6641
|
g2 = v;
|
|
6642
6642
|
b = wh;
|
|
6643
6643
|
break;
|
|
@@ -6645,17 +6645,17 @@ var require_color = __commonJS({
|
|
|
6645
6645
|
case 2: {
|
|
6646
6646
|
r = wh;
|
|
6647
6647
|
g2 = v;
|
|
6648
|
-
b =
|
|
6648
|
+
b = n2;
|
|
6649
6649
|
break;
|
|
6650
6650
|
}
|
|
6651
6651
|
case 3: {
|
|
6652
6652
|
r = wh;
|
|
6653
|
-
g2 =
|
|
6653
|
+
g2 = n2;
|
|
6654
6654
|
b = v;
|
|
6655
6655
|
break;
|
|
6656
6656
|
}
|
|
6657
6657
|
case 4: {
|
|
6658
|
-
r =
|
|
6658
|
+
r = n2;
|
|
6659
6659
|
g2 = wh;
|
|
6660
6660
|
b = v;
|
|
6661
6661
|
break;
|
|
@@ -6663,7 +6663,7 @@ var require_color = __commonJS({
|
|
|
6663
6663
|
case 5: {
|
|
6664
6664
|
r = v;
|
|
6665
6665
|
g2 = wh;
|
|
6666
|
-
b =
|
|
6666
|
+
b = n2;
|
|
6667
6667
|
break;
|
|
6668
6668
|
}
|
|
6669
6669
|
}
|
|
@@ -6704,10 +6704,10 @@ var require_color = __commonJS({
|
|
|
6704
6704
|
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6705
6705
|
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6706
6706
|
z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
6707
|
-
const
|
|
6707
|
+
const l = 116 * y - 16;
|
|
6708
6708
|
const a2 = 500 * (x - y);
|
|
6709
6709
|
const b = 200 * (y - z);
|
|
6710
|
-
return [
|
|
6710
|
+
return [l, a2, b];
|
|
6711
6711
|
};
|
|
6712
6712
|
convert.xyz.oklab = function(xyz) {
|
|
6713
6713
|
const x = xyz[0] / 100;
|
|
@@ -6716,10 +6716,10 @@ var require_color = __commonJS({
|
|
|
6716
6716
|
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z);
|
|
6717
6717
|
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z);
|
|
6718
6718
|
const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z);
|
|
6719
|
-
const
|
|
6719
|
+
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6720
6720
|
const a2 = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6721
6721
|
const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
6722
|
-
return [
|
|
6722
|
+
return [l * 100, a2 * 100, b * 100];
|
|
6723
6723
|
};
|
|
6724
6724
|
convert.oklab.oklch = function(oklab) {
|
|
6725
6725
|
return convert.lab.lch(oklab);
|
|
@@ -6728,37 +6728,37 @@ var require_color = __commonJS({
|
|
|
6728
6728
|
const ll = oklab[0] / 100;
|
|
6729
6729
|
const a2 = oklab[1] / 100;
|
|
6730
6730
|
const b = oklab[2] / 100;
|
|
6731
|
-
const
|
|
6731
|
+
const l = (0.999999998 * ll + 0.396337792 * a2 + 0.215803758 * b) ** 3;
|
|
6732
6732
|
const m3 = (1.000000008 * ll - 0.105561342 * a2 - 0.063854175 * b) ** 3;
|
|
6733
6733
|
const s = (1.000000055 * ll - 0.089484182 * a2 - 1.291485538 * b) ** 3;
|
|
6734
|
-
const x = 1.227013851 *
|
|
6735
|
-
const y = -0.040580178 *
|
|
6736
|
-
const z = -0.076381285 *
|
|
6734
|
+
const x = 1.227013851 * l - 0.55779998 * m3 + 0.281256149 * s;
|
|
6735
|
+
const y = -0.040580178 * l + 1.11225687 * m3 - 0.071676679 * s;
|
|
6736
|
+
const z = -0.076381285 * l - 0.421481978 * m3 + 1.58616322 * s;
|
|
6737
6737
|
return [x * 100, y * 100, z * 100];
|
|
6738
6738
|
};
|
|
6739
6739
|
convert.oklab.rgb = function(oklab) {
|
|
6740
6740
|
const ll = oklab[0] / 100;
|
|
6741
6741
|
const aa = oklab[1] / 100;
|
|
6742
6742
|
const bb = oklab[2] / 100;
|
|
6743
|
-
const
|
|
6743
|
+
const l = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
|
|
6744
6744
|
const m3 = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
|
|
6745
6745
|
const s = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
|
|
6746
|
-
const r = srgbNonlinearTransform(4.0767416621 *
|
|
6747
|
-
const g2 = srgbNonlinearTransform(-1.2684380046 *
|
|
6748
|
-
const b = srgbNonlinearTransform(-0.0041960863 *
|
|
6746
|
+
const r = srgbNonlinearTransform(4.0767416621 * l - 3.3077115913 * m3 + 0.2309699292 * s);
|
|
6747
|
+
const g2 = srgbNonlinearTransform(-1.2684380046 * l + 2.6097574011 * m3 - 0.3413193965 * s);
|
|
6748
|
+
const b = srgbNonlinearTransform(-0.0041960863 * l - 0.7034186147 * m3 + 1.707614701 * s);
|
|
6749
6749
|
return [r * 255, g2 * 255, b * 255];
|
|
6750
6750
|
};
|
|
6751
6751
|
convert.oklch.oklab = function(oklch) {
|
|
6752
6752
|
return convert.lch.lab(oklch);
|
|
6753
6753
|
};
|
|
6754
6754
|
convert.lab.xyz = function(lab) {
|
|
6755
|
-
const
|
|
6755
|
+
const l = lab[0];
|
|
6756
6756
|
const a2 = lab[1];
|
|
6757
6757
|
const b = lab[2];
|
|
6758
6758
|
let x;
|
|
6759
6759
|
let y;
|
|
6760
6760
|
let z;
|
|
6761
|
-
y = (
|
|
6761
|
+
y = (l + 16) / 116;
|
|
6762
6762
|
x = a2 / 500 + y;
|
|
6763
6763
|
z = y - b / 200;
|
|
6764
6764
|
const y2 = y ** 3;
|
|
@@ -6773,26 +6773,26 @@ var require_color = __commonJS({
|
|
|
6773
6773
|
return [x, y, z];
|
|
6774
6774
|
};
|
|
6775
6775
|
convert.lab.lch = function(lab) {
|
|
6776
|
-
const
|
|
6776
|
+
const l = lab[0];
|
|
6777
6777
|
const a2 = lab[1];
|
|
6778
6778
|
const b = lab[2];
|
|
6779
|
-
let
|
|
6779
|
+
let h4;
|
|
6780
6780
|
const hr = Math.atan2(b, a2);
|
|
6781
|
-
|
|
6782
|
-
if (
|
|
6783
|
-
|
|
6781
|
+
h4 = hr * 360 / 2 / Math.PI;
|
|
6782
|
+
if (h4 < 0) {
|
|
6783
|
+
h4 += 360;
|
|
6784
6784
|
}
|
|
6785
6785
|
const c3 = Math.sqrt(a2 * a2 + b * b);
|
|
6786
|
-
return [
|
|
6786
|
+
return [l, c3, h4];
|
|
6787
6787
|
};
|
|
6788
6788
|
convert.lch.lab = function(lch) {
|
|
6789
|
-
const
|
|
6789
|
+
const l = lch[0];
|
|
6790
6790
|
const c3 = lch[1];
|
|
6791
|
-
const
|
|
6792
|
-
const hr =
|
|
6791
|
+
const h4 = lch[2];
|
|
6792
|
+
const hr = h4 / 360 * 2 * Math.PI;
|
|
6793
6793
|
const a2 = c3 * Math.cos(hr);
|
|
6794
6794
|
const b = c3 * Math.sin(hr);
|
|
6795
|
-
return [
|
|
6795
|
+
return [l, a2, b];
|
|
6796
6796
|
};
|
|
6797
6797
|
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
6798
6798
|
const [r, g2, b] = args;
|
|
@@ -6899,35 +6899,35 @@ var require_color = __commonJS({
|
|
|
6899
6899
|
};
|
|
6900
6900
|
convert.hsl.hcg = function(hsl) {
|
|
6901
6901
|
const s = hsl[1] / 100;
|
|
6902
|
-
const
|
|
6903
|
-
const c3 =
|
|
6904
|
-
let
|
|
6902
|
+
const l = hsl[2] / 100;
|
|
6903
|
+
const c3 = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
6904
|
+
let f = 0;
|
|
6905
6905
|
if (c3 < 1) {
|
|
6906
|
-
|
|
6906
|
+
f = (l - 0.5 * c3) / (1 - c3);
|
|
6907
6907
|
}
|
|
6908
|
-
return [hsl[0], c3 * 100,
|
|
6908
|
+
return [hsl[0], c3 * 100, f * 100];
|
|
6909
6909
|
};
|
|
6910
6910
|
convert.hsv.hcg = function(hsv) {
|
|
6911
6911
|
const s = hsv[1] / 100;
|
|
6912
6912
|
const v = hsv[2] / 100;
|
|
6913
6913
|
const c3 = s * v;
|
|
6914
|
-
let
|
|
6914
|
+
let f = 0;
|
|
6915
6915
|
if (c3 < 1) {
|
|
6916
|
-
|
|
6916
|
+
f = (v - c3) / (1 - c3);
|
|
6917
6917
|
}
|
|
6918
|
-
return [hsv[0], c3 * 100,
|
|
6918
|
+
return [hsv[0], c3 * 100, f * 100];
|
|
6919
6919
|
};
|
|
6920
6920
|
convert.hcg.rgb = function(hcg) {
|
|
6921
|
-
const
|
|
6921
|
+
const h4 = hcg[0] / 360;
|
|
6922
6922
|
const c3 = hcg[1] / 100;
|
|
6923
6923
|
const g2 = hcg[2] / 100;
|
|
6924
6924
|
if (c3 === 0) {
|
|
6925
6925
|
return [g2 * 255, g2 * 255, g2 * 255];
|
|
6926
6926
|
}
|
|
6927
6927
|
const pure = [0, 0, 0];
|
|
6928
|
-
const hi =
|
|
6928
|
+
const hi = h4 % 1 * 6;
|
|
6929
6929
|
const v = hi % 1;
|
|
6930
|
-
const
|
|
6930
|
+
const w2 = 1 - v;
|
|
6931
6931
|
let mg = 0;
|
|
6932
6932
|
switch (Math.floor(hi)) {
|
|
6933
6933
|
case 0: {
|
|
@@ -6937,7 +6937,7 @@ var require_color = __commonJS({
|
|
|
6937
6937
|
break;
|
|
6938
6938
|
}
|
|
6939
6939
|
case 1: {
|
|
6940
|
-
pure[0] =
|
|
6940
|
+
pure[0] = w2;
|
|
6941
6941
|
pure[1] = 1;
|
|
6942
6942
|
pure[2] = 0;
|
|
6943
6943
|
break;
|
|
@@ -6950,7 +6950,7 @@ var require_color = __commonJS({
|
|
|
6950
6950
|
}
|
|
6951
6951
|
case 3: {
|
|
6952
6952
|
pure[0] = 0;
|
|
6953
|
-
pure[1] =
|
|
6953
|
+
pure[1] = w2;
|
|
6954
6954
|
pure[2] = 1;
|
|
6955
6955
|
break;
|
|
6956
6956
|
}
|
|
@@ -6963,7 +6963,7 @@ var require_color = __commonJS({
|
|
|
6963
6963
|
default: {
|
|
6964
6964
|
pure[0] = 1;
|
|
6965
6965
|
pure[1] = 0;
|
|
6966
|
-
pure[2] =
|
|
6966
|
+
pure[2] = w2;
|
|
6967
6967
|
}
|
|
6968
6968
|
}
|
|
6969
6969
|
mg = (1 - c3) * g2;
|
|
@@ -6977,23 +6977,23 @@ var require_color = __commonJS({
|
|
|
6977
6977
|
const c3 = hcg[1] / 100;
|
|
6978
6978
|
const g2 = hcg[2] / 100;
|
|
6979
6979
|
const v = c3 + g2 * (1 - c3);
|
|
6980
|
-
let
|
|
6980
|
+
let f = 0;
|
|
6981
6981
|
if (v > 0) {
|
|
6982
|
-
|
|
6982
|
+
f = c3 / v;
|
|
6983
6983
|
}
|
|
6984
|
-
return [hcg[0],
|
|
6984
|
+
return [hcg[0], f * 100, v * 100];
|
|
6985
6985
|
};
|
|
6986
6986
|
convert.hcg.hsl = function(hcg) {
|
|
6987
6987
|
const c3 = hcg[1] / 100;
|
|
6988
6988
|
const g2 = hcg[2] / 100;
|
|
6989
|
-
const
|
|
6989
|
+
const l = g2 * (1 - c3) + 0.5 * c3;
|
|
6990
6990
|
let s = 0;
|
|
6991
|
-
if (
|
|
6992
|
-
s = c3 / (2 *
|
|
6993
|
-
} else if (
|
|
6994
|
-
s = c3 / (2 * (1 -
|
|
6991
|
+
if (l > 0 && l < 0.5) {
|
|
6992
|
+
s = c3 / (2 * l);
|
|
6993
|
+
} else if (l >= 0.5 && l < 1) {
|
|
6994
|
+
s = c3 / (2 * (1 - l));
|
|
6995
6995
|
}
|
|
6996
|
-
return [hcg[0], s * 100,
|
|
6996
|
+
return [hcg[0], s * 100, l * 100];
|
|
6997
6997
|
};
|
|
6998
6998
|
convert.hcg.hwb = function(hcg) {
|
|
6999
6999
|
const c3 = hcg[1] / 100;
|
|
@@ -7002,10 +7002,10 @@ var require_color = __commonJS({
|
|
|
7002
7002
|
return [hcg[0], (v - c3) * 100, (1 - v) * 100];
|
|
7003
7003
|
};
|
|
7004
7004
|
convert.hwb.hcg = function(hwb) {
|
|
7005
|
-
const
|
|
7005
|
+
const w2 = hwb[1] / 100;
|
|
7006
7006
|
const b = hwb[2] / 100;
|
|
7007
7007
|
const v = 1 - b;
|
|
7008
|
-
const c3 = v -
|
|
7008
|
+
const c3 = v - w2;
|
|
7009
7009
|
let g2 = 0;
|
|
7010
7010
|
if (c3 < 1) {
|
|
7011
7011
|
g2 = (v - c3) / (1 - c3);
|
|
@@ -7458,14 +7458,14 @@ var require_color = __commonJS({
|
|
|
7458
7458
|
const color1 = mixinColor.rgb();
|
|
7459
7459
|
const color2 = this.rgb();
|
|
7460
7460
|
const p2 = weight === void 0 ? 0.5 : weight;
|
|
7461
|
-
const
|
|
7461
|
+
const w2 = 2 * p2 - 1;
|
|
7462
7462
|
const a2 = color1.alpha() - color2.alpha();
|
|
7463
|
-
const w1 = ((
|
|
7464
|
-
const
|
|
7463
|
+
const w1 = ((w2 * a2 === -1 ? w2 : (w2 + a2) / (1 + w2 * a2)) + 1) / 2;
|
|
7464
|
+
const w22 = 1 - w1;
|
|
7465
7465
|
return Color.rgb(
|
|
7466
|
-
w1 * color1.red() +
|
|
7467
|
-
w1 * color1.green() +
|
|
7468
|
-
w1 * color1.blue() +
|
|
7466
|
+
w1 * color1.red() + w22 * color2.red(),
|
|
7467
|
+
w1 * color1.green() + w22 * color2.green(),
|
|
7468
|
+
w1 * color1.blue() + w22 * color2.blue(),
|
|
7469
7469
|
color1.alpha() * p2 + color2.alpha() * (1 - p2)
|
|
7470
7470
|
);
|
|
7471
7471
|
}
|
|
@@ -8723,8 +8723,8 @@ var require_lib = __commonJS({
|
|
|
8723
8723
|
// ../codec-sharp/dist/index.mjs
|
|
8724
8724
|
var dist_exports2 = {};
|
|
8725
8725
|
__export(dist_exports2, {
|
|
8726
|
-
codecSharp: () =>
|
|
8727
|
-
default: () =>
|
|
8726
|
+
codecSharp: () => n,
|
|
8727
|
+
default: () => h2
|
|
8728
8728
|
});
|
|
8729
8729
|
async function a(r) {
|
|
8730
8730
|
try {
|
|
@@ -8735,7 +8735,7 @@ async function a(r) {
|
|
|
8735
8735
|
throw new Error(`Failed to read image file ${r}: ${e}`);
|
|
8736
8736
|
}
|
|
8737
8737
|
}
|
|
8738
|
-
async function
|
|
8738
|
+
async function o(r, e) {
|
|
8739
8739
|
try {
|
|
8740
8740
|
let t = (0, import_sharp.default)(r.data, { raw: { width: r.width, height: r.height, channels: 4 } });
|
|
8741
8741
|
typeof e == "string" ? await t.png().toFile(e) : e.set(await t.png().toBuffer());
|
|
@@ -8743,13 +8743,13 @@ async function n(r, e) {
|
|
|
8743
8743
|
throw new Error(`Failed to write image file ${e}: ${t}`);
|
|
8744
8744
|
}
|
|
8745
8745
|
}
|
|
8746
|
-
var import_sharp,
|
|
8746
|
+
var import_sharp, n, h2;
|
|
8747
8747
|
var init_dist2 = __esm({
|
|
8748
8748
|
"../codec-sharp/dist/index.mjs"() {
|
|
8749
8749
|
"use strict";
|
|
8750
8750
|
import_sharp = __toESM(require_lib(), 1);
|
|
8751
|
-
|
|
8752
|
-
|
|
8751
|
+
n = { read: a, write: o };
|
|
8752
|
+
h2 = n;
|
|
8753
8753
|
}
|
|
8754
8754
|
});
|
|
8755
8755
|
|
|
@@ -9072,44 +9072,44 @@ var init_encode = __esm({
|
|
|
9072
9072
|
// ../codec-jsquash-png/dist/index.mjs
|
|
9073
9073
|
var dist_exports3 = {};
|
|
9074
9074
|
__export(dist_exports3, {
|
|
9075
|
-
codecJsquashPng: () =>
|
|
9075
|
+
codecJsquashPng: () => w,
|
|
9076
9076
|
default: () => p
|
|
9077
9077
|
});
|
|
9078
9078
|
function c2() {
|
|
9079
|
-
return
|
|
9080
|
-
let e = (0, import_path.dirname)(i2.resolve("@jsquash/png")),
|
|
9081
|
-
return await Promise.all([
|
|
9082
|
-
})(),
|
|
9079
|
+
return o2 || (o2 = (async () => {
|
|
9080
|
+
let e = (0, import_path.dirname)(i2.resolve("@jsquash/png")), a2 = (0, import_path.join)(e, "codec", "pkg", "squoosh_png_bg.wasm"), t = (0, import_fs2.readFileSync)(a2), n2 = await Promise.resolve().then(() => (init_decode(), decode_exports)), r = await Promise.resolve().then(() => (init_encode(), encode_exports));
|
|
9081
|
+
return await Promise.all([n2.init(t), r.init(t)]), { decode: n2.default, encode: r.default };
|
|
9082
|
+
})(), o2);
|
|
9083
9083
|
}
|
|
9084
|
-
async function
|
|
9084
|
+
async function h3(e) {
|
|
9085
9085
|
try {
|
|
9086
|
-
let { decode:
|
|
9086
|
+
let { decode: a2 } = await c2(), t = typeof e == "string" ? (0, import_fs2.readFileSync)(e) : e, n2 = new Uint8Array(t).buffer, r = await a2(n2);
|
|
9087
9087
|
return { data: r.data, width: r.width, height: r.height };
|
|
9088
|
-
} catch (
|
|
9089
|
-
throw new Error(`Failed to read PNG file ${e}: ${
|
|
9088
|
+
} catch (a2) {
|
|
9089
|
+
throw new Error(`Failed to read PNG file ${e}: ${a2}`);
|
|
9090
9090
|
}
|
|
9091
9091
|
}
|
|
9092
|
-
async function m2(e,
|
|
9092
|
+
async function m2(e, a2) {
|
|
9093
9093
|
try {
|
|
9094
|
-
let { encode:
|
|
9095
|
-
(0, import_fs2.writeFileSync)(
|
|
9096
|
-
} catch (
|
|
9097
|
-
throw new Error(`Failed to write PNG file ${
|
|
9094
|
+
let { encode: t } = await c2(), n2 = { data: new Uint8ClampedArray(e.data.buffer, e.data.byteOffset, e.data.byteLength), width: e.width, height: e.height, colorSpace: "srgb" }, r = await t(n2);
|
|
9095
|
+
(0, import_fs2.writeFileSync)(a2, Buffer.from(r));
|
|
9096
|
+
} catch (t) {
|
|
9097
|
+
throw new Error(`Failed to write PNG file ${a2}: ${t}`);
|
|
9098
9098
|
}
|
|
9099
9099
|
}
|
|
9100
|
-
var import_fs2, import_path, i2,
|
|
9100
|
+
var import_fs2, import_path, i2, o2, w, p;
|
|
9101
9101
|
var init_dist3 = __esm({
|
|
9102
9102
|
"../codec-jsquash-png/dist/index.mjs"() {
|
|
9103
9103
|
"use strict";
|
|
9104
9104
|
import_fs2 = require("fs");
|
|
9105
9105
|
import_path = require("path");
|
|
9106
|
-
i2 = ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (
|
|
9106
|
+
i2 = ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (a2, t) => (typeof require < "u" ? require : a2)[t] }) : e)(function(e) {
|
|
9107
9107
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
9108
9108
|
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
9109
9109
|
});
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
p =
|
|
9110
|
+
o2 = null;
|
|
9111
|
+
w = { read: h3, write: m2 };
|
|
9112
|
+
p = w;
|
|
9113
9113
|
}
|
|
9114
9114
|
});
|
|
9115
9115
|
|
|
@@ -9121,23 +9121,23 @@ __export(core_exports, {
|
|
|
9121
9121
|
module.exports = __toCommonJS(core_exports);
|
|
9122
9122
|
|
|
9123
9123
|
// ../core/dist/index.mjs
|
|
9124
|
-
function g(
|
|
9125
|
-
if (!_(
|
|
9126
|
-
if (
|
|
9127
|
-
if (
|
|
9128
|
-
if (y && typeof Buffer < "u" && Buffer.compare &&
|
|
9129
|
-
if (t && !b) for (let A = 0; A < e *
|
|
9124
|
+
function g(n2, r, t, e, o3, { threshold: f = 0.1, alpha: c3 = 0.1, aaColor: s = [255, 255, 0], diffColor: a2 = [255, 0, 0], includeAA: U, diffColorAlt: O, diffMask: b, fastBufferCheck: y = true } = {}) {
|
|
9125
|
+
if (!_(n2) || !_(r) || t && !_(t)) throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");
|
|
9126
|
+
if (n2.length !== r.length || t && t.length !== n2.length) throw new Error(`Image sizes do not match. Image 1 size: ${n2.length}, image 2 size: ${r.length}`);
|
|
9127
|
+
if (n2.length !== e * o3 * 4) throw new Error(`Image data size does not match width/height. Expecting ${e * o3 * 4}. Got ${n2.length}`);
|
|
9128
|
+
if (y && typeof Buffer < "u" && Buffer.compare && n2 instanceof Uint8Array && r instanceof Uint8Array && Buffer.compare(n2, r) === 0) {
|
|
9129
|
+
if (t && !b) for (let A = 0; A < e * o3; A++) L(n2, A * 4, c3, t);
|
|
9130
9130
|
return 0;
|
|
9131
9131
|
}
|
|
9132
|
-
let m3 = e *
|
|
9132
|
+
let m3 = e * o3, u = new Uint32Array(n2.buffer, n2.byteOffset, m3), d2 = new Uint32Array(r.buffer, r.byteOffset, m3), l = tn(e, o3), i3 = Math.ceil(e / l), I = Math.ceil(o3 / l), z = i3 * I, x = new Uint16Array(z), M = 35215 * f * f, B = 0;
|
|
9133
9133
|
for (let A = 0; A < I; A++) for (let R = 0; R < i3; R++) {
|
|
9134
|
-
let p2 = R *
|
|
9134
|
+
let p2 = R * l, v = A * l, D = Math.min(p2 + l, e), P = Math.min(v + l, o3), $ = false;
|
|
9135
9135
|
n: for (let C = v; C < P; C++) {
|
|
9136
9136
|
let Y = C * e;
|
|
9137
9137
|
for (let G = p2; G < D; G++) {
|
|
9138
9138
|
let E = Y + G;
|
|
9139
9139
|
if (u[E] === d2[E]) continue;
|
|
9140
|
-
let S = E * 4, X = N(
|
|
9140
|
+
let S = E * 4, X = N(n2, r, S, S);
|
|
9141
9141
|
if (Math.abs(X) > M) {
|
|
9142
9142
|
$ = true;
|
|
9143
9143
|
break n;
|
|
@@ -9149,89 +9149,89 @@ function g(n3, r, t, e, o2, { threshold: f2 = 0.1, alpha: c3 = 0.1, aaColor: s =
|
|
|
9149
9149
|
let Y = C * e;
|
|
9150
9150
|
for (let G = p2; G < D; G++) {
|
|
9151
9151
|
let E = Y + G;
|
|
9152
|
-
L(
|
|
9152
|
+
L(n2, E * 4, c3, t);
|
|
9153
9153
|
}
|
|
9154
9154
|
}
|
|
9155
9155
|
}
|
|
9156
9156
|
if (B === 0) return 0;
|
|
9157
|
-
let [F, J, K] = s, [Q, W, Z] = a2, [k,
|
|
9157
|
+
let [F, J, K] = s, [Q, W, Z] = a2, [k, w2, h4] = O || a2, T = 0;
|
|
9158
9158
|
for (let A = 0; A < B; A++) {
|
|
9159
|
-
let R = x[A], p2 = R % i3, v = R / i3 | 0, D = p2 *
|
|
9159
|
+
let R = x[A], p2 = R % i3, v = R / i3 | 0, D = p2 * l, P = v * l, $ = Math.min(D + l, e), C = Math.min(P + l, o3);
|
|
9160
9160
|
for (let Y = P; Y < C; Y++) {
|
|
9161
9161
|
let G = Y * e;
|
|
9162
9162
|
for (let E = D; E < $; E++) {
|
|
9163
9163
|
let S = G + E, X = S * 4;
|
|
9164
9164
|
if (u[S] === d2[S]) {
|
|
9165
|
-
t && !b && L(
|
|
9165
|
+
t && !b && L(n2, X, c3, t);
|
|
9166
9166
|
continue;
|
|
9167
9167
|
}
|
|
9168
|
-
let H = N(
|
|
9169
|
-
Math.abs(H) > M ? !U && (j(
|
|
9168
|
+
let H = N(n2, r, X, X);
|
|
9169
|
+
Math.abs(H) > M ? !U && (j(n2, E, Y, e, o3, u, d2) || j(r, E, Y, e, o3, d2, u)) ? t && !b && V(t, X, F, J, K) : (t && (H < 0 ? V(t, X, k, w2, h4) : V(t, X, Q, W, Z)), T++) : t && !b && L(n2, X, c3, t);
|
|
9170
9170
|
}
|
|
9171
9171
|
}
|
|
9172
9172
|
}
|
|
9173
9173
|
return T;
|
|
9174
9174
|
}
|
|
9175
|
-
function _(
|
|
9176
|
-
return ArrayBuffer.isView(
|
|
9175
|
+
function _(n2) {
|
|
9176
|
+
return ArrayBuffer.isView(n2) && n2.BYTES_PER_ELEMENT === 1;
|
|
9177
9177
|
}
|
|
9178
9178
|
var nn = Math.LOG2E;
|
|
9179
|
-
function tn(
|
|
9180
|
-
let t =
|
|
9181
|
-
return 1 << Math.round(
|
|
9179
|
+
function tn(n2, r) {
|
|
9180
|
+
let t = n2 * r, e = Math.sqrt(t) / 100, o3 = 16 * Math.sqrt(e), f = Math.log(o3) * nn;
|
|
9181
|
+
return 1 << Math.round(f);
|
|
9182
9182
|
}
|
|
9183
|
-
function N(
|
|
9184
|
-
let
|
|
9183
|
+
function N(n2, r, t, e) {
|
|
9184
|
+
let o3 = n2[t], f = n2[t + 1], c3 = n2[t + 2], s = n2[t + 3], a2 = r[e], U = r[e + 1], O = r[e + 2], b = r[e + 3], y = o3 - a2, m3 = f - U, u = c3 - O, d2 = s - b;
|
|
9185
9185
|
if (!y && !m3 && !u && !d2) return 0;
|
|
9186
9186
|
if (s < 255 || b < 255) {
|
|
9187
9187
|
let x = 48 + 159 * (t % 2), M = 48 + 159 * ((t / 1.618033988749895 | 0) & 1), B = 48 + 159 * ((t / 2.618033988749895 | 0) & 1);
|
|
9188
|
-
y = (
|
|
9188
|
+
y = (o3 * s - a2 * b - x * d2) / 255, m3 = (f * s - U * b - M * d2) / 255, u = (c3 * s - O * b - B * d2) / 255;
|
|
9189
9189
|
}
|
|
9190
|
-
let
|
|
9191
|
-
return
|
|
9190
|
+
let l = y * 0.29889531 + m3 * 0.58662247 + u * 0.11448223, i3 = y * 0.59597799 - m3 * 0.2741761 - u * 0.32180189, I = y * 0.21147017 - m3 * 0.52261711 + u * 0.31114694, z = 0.5053 * l * l + 0.299 * i3 * i3 + 0.1957 * I * I;
|
|
9191
|
+
return l > 0 ? -z : z;
|
|
9192
9192
|
}
|
|
9193
|
-
function rn(
|
|
9194
|
-
let
|
|
9193
|
+
function rn(n2, r, t, e) {
|
|
9194
|
+
let o3 = n2[t], f = n2[t + 1], c3 = n2[t + 2], s = n2[t + 3], a2 = r[e], U = r[e + 1], O = r[e + 2], b = r[e + 3], y = o3 - a2, m3 = f - U, u = c3 - O, d2 = s - b;
|
|
9195
9195
|
if (!y && !m3 && !u && !d2) return 0;
|
|
9196
9196
|
if (s < 255 || b < 255) {
|
|
9197
9197
|
let i3 = 48 + 159 * (t % 2), I = 48 + 159 * ((t / 1.618033988749895 | 0) & 1), z = 48 + 159 * ((t / 2.618033988749895 | 0) & 1);
|
|
9198
|
-
y = (
|
|
9198
|
+
y = (o3 * s - a2 * b - i3 * d2) / 255, m3 = (f * s - U * b - I * d2) / 255, u = (c3 * s - O * b - z * d2) / 255;
|
|
9199
9199
|
}
|
|
9200
9200
|
return y * 0.29889531 + m3 * 0.58662247 + u * 0.11448223;
|
|
9201
9201
|
}
|
|
9202
|
-
function j(
|
|
9203
|
-
let s = Math.max(r - 1, 0), a2 = Math.max(t - 1, 0), U = Math.min(r + 1, e - 1), O = Math.min(t + 1,
|
|
9202
|
+
function j(n2, r, t, e, o3, f, c3) {
|
|
9203
|
+
let s = Math.max(r - 1, 0), a2 = Math.max(t - 1, 0), U = Math.min(r + 1, e - 1), O = Math.min(t + 1, o3 - 1), y = (t * e + r) * 4, m3 = r === s || r === U || t === a2 || t === O ? 1 : 0, u = 0, d2 = 0, l = 0, i3 = 0, I = 0, z = 0;
|
|
9204
9204
|
for (let x = s; x <= U; x++) for (let M = a2; M <= O; M++) {
|
|
9205
9205
|
if (x === r && M === t) continue;
|
|
9206
|
-
let B = rn(
|
|
9206
|
+
let B = rn(n2, n2, y, (M * e + x) * 4);
|
|
9207
9207
|
if (B === 0) {
|
|
9208
9208
|
if (m3++, m3 > 2) return false;
|
|
9209
|
-
} else B < u ? (u = B,
|
|
9209
|
+
} else B < u ? (u = B, l = x, i3 = M) : B > d2 && (d2 = B, I = x, z = M);
|
|
9210
9210
|
}
|
|
9211
|
-
return u === 0 || d2 === 0 ? false : q(
|
|
9211
|
+
return u === 0 || d2 === 0 ? false : q(f, l, i3, e, o3) && q(c3, l, i3, e, o3) || q(f, I, z, e, o3) && q(c3, I, z, e, o3);
|
|
9212
9212
|
}
|
|
9213
|
-
function q(
|
|
9214
|
-
let
|
|
9213
|
+
function q(n2, r, t, e, o3) {
|
|
9214
|
+
let f = t * e + r, c3 = n2[f], s = r === 0 || r === e - 1 || t === 0 || t === o3 - 1 ? 1 : 0;
|
|
9215
9215
|
if (t > 0) {
|
|
9216
|
-
let a2 =
|
|
9217
|
-
r > 0 &&
|
|
9216
|
+
let a2 = f - e;
|
|
9217
|
+
r > 0 && n2[a2 - 1] === c3 && s++, n2[a2] === c3 && s++, r < e - 1 && n2[a2 + 1] === c3 && s++;
|
|
9218
9218
|
}
|
|
9219
|
-
if (r > 0 &&
|
|
9220
|
-
let a2 =
|
|
9221
|
-
r > 0 &&
|
|
9219
|
+
if (r > 0 && n2[f - 1] === c3 && s++, r < e - 1 && n2[f + 1] === c3 && s++, t < o3 - 1) {
|
|
9220
|
+
let a2 = f + e;
|
|
9221
|
+
r > 0 && n2[a2 - 1] === c3 && s++, n2[a2] === c3 && s++, r < e - 1 && n2[a2 + 1] === c3 && s++;
|
|
9222
9222
|
}
|
|
9223
9223
|
return s > 2;
|
|
9224
9224
|
}
|
|
9225
|
-
function L(
|
|
9226
|
-
let
|
|
9227
|
-
V(e, r,
|
|
9225
|
+
function L(n2, r, t, e) {
|
|
9226
|
+
let o3 = 255 + (n2[r] * 0.29889531 + n2[r + 1] * 0.58662247 + n2[r + 2] * 0.11448223 - 255) * t * n2[r + 3] / 255;
|
|
9227
|
+
V(e, r, o3, o3, o3);
|
|
9228
9228
|
}
|
|
9229
|
-
function V(
|
|
9230
|
-
|
|
9229
|
+
function V(n2, r, t, e, o3) {
|
|
9230
|
+
n2[r + 0] = t, n2[r + 1] = e, n2[r + 2] = o3, n2[r + 3] = 255;
|
|
9231
9231
|
}
|
|
9232
9232
|
var on = g;
|
|
9233
9233
|
|
|
9234
|
-
// src/commands/
|
|
9234
|
+
// src/commands/_core-shared.ts
|
|
9235
9235
|
function parseRGB(colorStr) {
|
|
9236
9236
|
const parts = colorStr.split(",").map((s) => parseInt(s.trim(), 10));
|
|
9237
9237
|
if (parts.length !== 3 || parts.some((p2) => Number.isNaN(p2) || p2 < 0 || p2 > 255)) {
|
|
@@ -9241,6 +9241,168 @@ function parseRGB(colorStr) {
|
|
|
9241
9241
|
}
|
|
9242
9242
|
return [parts[0], parts[1], parts[2]];
|
|
9243
9243
|
}
|
|
9244
|
+
var getCodec = async (codec) => {
|
|
9245
|
+
if (!codec || codec === "pngjs") {
|
|
9246
|
+
const { default: c3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
9247
|
+
return c3;
|
|
9248
|
+
}
|
|
9249
|
+
if (codec === "sharp") {
|
|
9250
|
+
const { default: c3 } = await Promise.resolve().then(() => (init_dist2(), dist_exports2));
|
|
9251
|
+
return c3;
|
|
9252
|
+
}
|
|
9253
|
+
if (codec === "jsquash-png") {
|
|
9254
|
+
const { default: c3 } = await Promise.resolve().then(() => (init_dist3(), dist_exports3));
|
|
9255
|
+
return c3;
|
|
9256
|
+
}
|
|
9257
|
+
throw new Error(`Unknown codec: ${codec}`);
|
|
9258
|
+
};
|
|
9259
|
+
function parseCoreArgs(args, printUsage2) {
|
|
9260
|
+
if (args.length < 2) {
|
|
9261
|
+
console.error("Error: Two image paths are required");
|
|
9262
|
+
printUsage2();
|
|
9263
|
+
process.exit(1);
|
|
9264
|
+
}
|
|
9265
|
+
const parsed = {
|
|
9266
|
+
image1: args[0],
|
|
9267
|
+
image2: args[1]
|
|
9268
|
+
};
|
|
9269
|
+
for (let i3 = 2; i3 < args.length; i3++) {
|
|
9270
|
+
const arg = args[i3];
|
|
9271
|
+
const nextArg = args[i3 + 1];
|
|
9272
|
+
switch (arg) {
|
|
9273
|
+
case "-o":
|
|
9274
|
+
case "--output":
|
|
9275
|
+
if (nextArg) {
|
|
9276
|
+
parsed.outputPath = nextArg;
|
|
9277
|
+
i3++;
|
|
9278
|
+
}
|
|
9279
|
+
break;
|
|
9280
|
+
case "-t":
|
|
9281
|
+
case "--threshold":
|
|
9282
|
+
if (nextArg) {
|
|
9283
|
+
const threshold = parseFloat(nextArg);
|
|
9284
|
+
if (Number.isNaN(threshold) || threshold < 0 || threshold > 1) {
|
|
9285
|
+
throw new Error(
|
|
9286
|
+
`Invalid threshold: ${nextArg}. Must be between 0 and 1`
|
|
9287
|
+
);
|
|
9288
|
+
}
|
|
9289
|
+
parsed.threshold = threshold;
|
|
9290
|
+
i3++;
|
|
9291
|
+
}
|
|
9292
|
+
break;
|
|
9293
|
+
case "-a":
|
|
9294
|
+
case "--alpha":
|
|
9295
|
+
if (nextArg) {
|
|
9296
|
+
const alpha = parseFloat(nextArg);
|
|
9297
|
+
if (Number.isNaN(alpha) || alpha < 0 || alpha > 1) {
|
|
9298
|
+
throw new Error(
|
|
9299
|
+
`Invalid alpha: ${nextArg}. Must be between 0 and 1`
|
|
9300
|
+
);
|
|
9301
|
+
}
|
|
9302
|
+
parsed.alpha = alpha;
|
|
9303
|
+
i3++;
|
|
9304
|
+
}
|
|
9305
|
+
break;
|
|
9306
|
+
case "--aa-color":
|
|
9307
|
+
if (nextArg) {
|
|
9308
|
+
parsed.aaColor = parseRGB(nextArg);
|
|
9309
|
+
i3++;
|
|
9310
|
+
}
|
|
9311
|
+
break;
|
|
9312
|
+
case "--diff-color":
|
|
9313
|
+
if (nextArg) {
|
|
9314
|
+
parsed.diffColor = parseRGB(nextArg);
|
|
9315
|
+
i3++;
|
|
9316
|
+
}
|
|
9317
|
+
break;
|
|
9318
|
+
case "--diff-color-alt":
|
|
9319
|
+
if (nextArg) {
|
|
9320
|
+
parsed.diffColorAlt = parseRGB(nextArg);
|
|
9321
|
+
i3++;
|
|
9322
|
+
}
|
|
9323
|
+
break;
|
|
9324
|
+
case "--include-aa":
|
|
9325
|
+
parsed.includeAA = true;
|
|
9326
|
+
break;
|
|
9327
|
+
case "--diff-mask":
|
|
9328
|
+
parsed.diffMask = true;
|
|
9329
|
+
break;
|
|
9330
|
+
case "--codec":
|
|
9331
|
+
if (nextArg) {
|
|
9332
|
+
parsed.codec = nextArg;
|
|
9333
|
+
i3++;
|
|
9334
|
+
}
|
|
9335
|
+
break;
|
|
9336
|
+
default:
|
|
9337
|
+
console.error(`Unknown option: ${arg}`);
|
|
9338
|
+
printUsage2();
|
|
9339
|
+
process.exit(1);
|
|
9340
|
+
}
|
|
9341
|
+
}
|
|
9342
|
+
return parsed;
|
|
9343
|
+
}
|
|
9344
|
+
async function runCoreDiff(parsed, diffFn) {
|
|
9345
|
+
const codec = await getCodec(parsed.codec);
|
|
9346
|
+
const [img1, img2] = await Promise.all([
|
|
9347
|
+
codec.read(parsed.image1),
|
|
9348
|
+
codec.read(parsed.image2)
|
|
9349
|
+
]);
|
|
9350
|
+
if (img1.width !== img2.width || img1.height !== img2.height) {
|
|
9351
|
+
throw new Error(
|
|
9352
|
+
`Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
|
|
9353
|
+
);
|
|
9354
|
+
}
|
|
9355
|
+
let outputData;
|
|
9356
|
+
if (parsed.outputPath) {
|
|
9357
|
+
outputData = new Uint8Array(img1.data.length);
|
|
9358
|
+
}
|
|
9359
|
+
const coreOptions = {
|
|
9360
|
+
threshold: parsed.threshold,
|
|
9361
|
+
alpha: parsed.alpha,
|
|
9362
|
+
aaColor: parsed.aaColor,
|
|
9363
|
+
diffColor: parsed.diffColor,
|
|
9364
|
+
diffColorAlt: parsed.diffColorAlt,
|
|
9365
|
+
includeAA: parsed.includeAA,
|
|
9366
|
+
diffMask: parsed.diffMask
|
|
9367
|
+
};
|
|
9368
|
+
const startTime = performance.now();
|
|
9369
|
+
const diffCount = await diffFn(
|
|
9370
|
+
img1.data,
|
|
9371
|
+
img2.data,
|
|
9372
|
+
img1.width,
|
|
9373
|
+
img1.height,
|
|
9374
|
+
outputData,
|
|
9375
|
+
coreOptions
|
|
9376
|
+
);
|
|
9377
|
+
const duration = performance.now() - startTime;
|
|
9378
|
+
if (diffCount > 0 && parsed.outputPath && outputData) {
|
|
9379
|
+
await codec.write(
|
|
9380
|
+
{
|
|
9381
|
+
data: outputData,
|
|
9382
|
+
width: img1.width,
|
|
9383
|
+
height: img1.height
|
|
9384
|
+
},
|
|
9385
|
+
parsed.outputPath
|
|
9386
|
+
);
|
|
9387
|
+
}
|
|
9388
|
+
console.log(`completed in: ${duration.toFixed(2)}ms`);
|
|
9389
|
+
console.log(`dimensions: ${img1.width}x${img1.height}`);
|
|
9390
|
+
console.log(`different pixels: ${diffCount}`);
|
|
9391
|
+
console.log(
|
|
9392
|
+
`error: ${(diffCount / (img1.width * img1.height) * 100).toFixed(2)}%`
|
|
9393
|
+
);
|
|
9394
|
+
if (diffCount > 0 && outputData && parsed.outputPath) {
|
|
9395
|
+
console.log(`diff image: ${parsed.outputPath}`);
|
|
9396
|
+
}
|
|
9397
|
+
if (diffCount > 0) {
|
|
9398
|
+
process.exit(1);
|
|
9399
|
+
} else {
|
|
9400
|
+
console.log(`Images are identical!`);
|
|
9401
|
+
process.exit(0);
|
|
9402
|
+
}
|
|
9403
|
+
}
|
|
9404
|
+
|
|
9405
|
+
// src/commands/core.ts
|
|
9244
9406
|
function printUsage() {
|
|
9245
9407
|
console.log(`
|
|
9246
9408
|
Usage: blazediff-cli core <image1> <image2> [options]
|
|
@@ -9262,26 +9424,11 @@ Options:
|
|
|
9262
9424
|
-h, --help Show this help message
|
|
9263
9425
|
|
|
9264
9426
|
Examples:
|
|
9265
|
-
blazediff
|
|
9266
|
-
blazediff
|
|
9267
|
-
blazediff
|
|
9427
|
+
blazediff-cli core image1.png image2.png
|
|
9428
|
+
blazediff-cli core image1.png image2.png -o diff.png -t 0.05
|
|
9429
|
+
blazediff-cli core image1.png image2.png --threshold 0.2 --alpha 0.3
|
|
9268
9430
|
`);
|
|
9269
9431
|
}
|
|
9270
|
-
var getCodec = async (codec) => {
|
|
9271
|
-
if (!codec || codec === "pngjs") {
|
|
9272
|
-
const { default: c3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
9273
|
-
return c3;
|
|
9274
|
-
}
|
|
9275
|
-
if (codec === "sharp") {
|
|
9276
|
-
const { default: c3 } = await Promise.resolve().then(() => (init_dist2(), dist_exports2));
|
|
9277
|
-
return c3;
|
|
9278
|
-
}
|
|
9279
|
-
if (codec === "jsquash-png") {
|
|
9280
|
-
const { default: c3 } = await Promise.resolve().then(() => (init_dist3(), dist_exports3));
|
|
9281
|
-
return c3;
|
|
9282
|
-
}
|
|
9283
|
-
throw new Error(`Unknown codec: ${codec}`);
|
|
9284
|
-
};
|
|
9285
9432
|
async function main() {
|
|
9286
9433
|
try {
|
|
9287
9434
|
const args = process.argv.slice(2);
|
|
@@ -9289,151 +9436,11 @@ async function main() {
|
|
|
9289
9436
|
printUsage();
|
|
9290
9437
|
process.exit(0);
|
|
9291
9438
|
}
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
}
|
|
9297
|
-
const image1 = args[0];
|
|
9298
|
-
const image2 = args[1];
|
|
9299
|
-
const options = {};
|
|
9300
|
-
for (let i3 = 2; i3 < args.length; i3++) {
|
|
9301
|
-
const arg = args[i3];
|
|
9302
|
-
const nextArg = args[i3 + 1];
|
|
9303
|
-
switch (arg) {
|
|
9304
|
-
case "-o":
|
|
9305
|
-
case "--output":
|
|
9306
|
-
if (nextArg) {
|
|
9307
|
-
options.outputPath = nextArg;
|
|
9308
|
-
i3++;
|
|
9309
|
-
}
|
|
9310
|
-
break;
|
|
9311
|
-
case "-t":
|
|
9312
|
-
case "--threshold":
|
|
9313
|
-
if (nextArg) {
|
|
9314
|
-
const threshold = parseFloat(nextArg);
|
|
9315
|
-
if (Number.isNaN(threshold) || threshold < 0 || threshold > 1) {
|
|
9316
|
-
throw new Error(
|
|
9317
|
-
`Invalid threshold: ${nextArg}. Must be between 0 and 1`
|
|
9318
|
-
);
|
|
9319
|
-
}
|
|
9320
|
-
options.threshold = threshold;
|
|
9321
|
-
i3++;
|
|
9322
|
-
}
|
|
9323
|
-
break;
|
|
9324
|
-
case "-a":
|
|
9325
|
-
case "--alpha":
|
|
9326
|
-
if (nextArg) {
|
|
9327
|
-
const alpha = parseFloat(nextArg);
|
|
9328
|
-
if (Number.isNaN(alpha) || alpha < 0 || alpha > 1) {
|
|
9329
|
-
throw new Error(
|
|
9330
|
-
`Invalid alpha: ${nextArg}. Must be between 0 and 1`
|
|
9331
|
-
);
|
|
9332
|
-
}
|
|
9333
|
-
options.alpha = alpha;
|
|
9334
|
-
i3++;
|
|
9335
|
-
}
|
|
9336
|
-
break;
|
|
9337
|
-
case "--aa-color":
|
|
9338
|
-
if (nextArg) {
|
|
9339
|
-
options.aaColor = parseRGB(nextArg);
|
|
9340
|
-
i3++;
|
|
9341
|
-
}
|
|
9342
|
-
break;
|
|
9343
|
-
case "--diff-color":
|
|
9344
|
-
if (nextArg) {
|
|
9345
|
-
options.diffColor = parseRGB(nextArg);
|
|
9346
|
-
i3++;
|
|
9347
|
-
}
|
|
9348
|
-
break;
|
|
9349
|
-
case "--diff-color-alt":
|
|
9350
|
-
if (nextArg) {
|
|
9351
|
-
options.diffColorAlt = parseRGB(nextArg);
|
|
9352
|
-
i3++;
|
|
9353
|
-
}
|
|
9354
|
-
break;
|
|
9355
|
-
case "--include-aa":
|
|
9356
|
-
options.includeAA = true;
|
|
9357
|
-
break;
|
|
9358
|
-
case "--diff-mask":
|
|
9359
|
-
options.diffMask = true;
|
|
9360
|
-
break;
|
|
9361
|
-
case "--codec":
|
|
9362
|
-
if (nextArg) {
|
|
9363
|
-
options.codec = nextArg;
|
|
9364
|
-
i3++;
|
|
9365
|
-
}
|
|
9366
|
-
break;
|
|
9367
|
-
default:
|
|
9368
|
-
console.error(`Unknown option: ${arg}`);
|
|
9369
|
-
printUsage();
|
|
9370
|
-
process.exit(1);
|
|
9371
|
-
}
|
|
9372
|
-
}
|
|
9373
|
-
const codec = await getCodec(options.codec);
|
|
9374
|
-
const [img1, img2] = await Promise.all([
|
|
9375
|
-
codec.read(image1),
|
|
9376
|
-
codec.read(image2)
|
|
9377
|
-
]);
|
|
9378
|
-
if (img1.width !== img2.width || img1.height !== img2.height) {
|
|
9379
|
-
throw new Error(
|
|
9380
|
-
`Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
|
|
9381
|
-
);
|
|
9382
|
-
}
|
|
9383
|
-
let outputData;
|
|
9384
|
-
if (options.outputPath) {
|
|
9385
|
-
outputData = new Uint8Array(img1.data.length);
|
|
9386
|
-
}
|
|
9387
|
-
const coreOptions = {
|
|
9388
|
-
threshold: options.threshold,
|
|
9389
|
-
alpha: options.alpha,
|
|
9390
|
-
aaColor: options.aaColor,
|
|
9391
|
-
diffColor: options.diffColor,
|
|
9392
|
-
diffColorAlt: options.diffColorAlt,
|
|
9393
|
-
includeAA: options.includeAA,
|
|
9394
|
-
diffMask: options.diffMask
|
|
9395
|
-
};
|
|
9396
|
-
const startTime = performance.now();
|
|
9397
|
-
const diffCount = on(
|
|
9398
|
-
img1.data,
|
|
9399
|
-
img2.data,
|
|
9400
|
-
outputData,
|
|
9401
|
-
img1.width,
|
|
9402
|
-
img1.height,
|
|
9403
|
-
coreOptions
|
|
9404
|
-
);
|
|
9405
|
-
const duration = performance.now() - startTime;
|
|
9406
|
-
if (diffCount > 0 && options.outputPath && outputData) {
|
|
9407
|
-
await codec.write(
|
|
9408
|
-
{
|
|
9409
|
-
data: outputData,
|
|
9410
|
-
width: img1.width,
|
|
9411
|
-
height: img1.height
|
|
9412
|
-
},
|
|
9413
|
-
options.outputPath
|
|
9414
|
-
);
|
|
9415
|
-
}
|
|
9416
|
-
const result = {
|
|
9417
|
-
diffCount,
|
|
9418
|
-
width: img1.width,
|
|
9419
|
-
height: img1.height,
|
|
9420
|
-
duration
|
|
9421
|
-
};
|
|
9422
|
-
console.log(`completed in: ${result.duration.toFixed(2)}ms`);
|
|
9423
|
-
console.log(`dimensions: ${result.width}x${result.height}`);
|
|
9424
|
-
console.log(`different pixels: ${result.diffCount}`);
|
|
9425
|
-
console.log(
|
|
9426
|
-
`error: ${(result.diffCount / (result.width * result.height) * 100).toFixed(2)}%`
|
|
9439
|
+
const parsed = parseCoreArgs(args, printUsage);
|
|
9440
|
+
await runCoreDiff(
|
|
9441
|
+
parsed,
|
|
9442
|
+
(a2, b, width, height, output, options) => on(a2, b, output, width, height, options)
|
|
9427
9443
|
);
|
|
9428
|
-
if (result.diffCount > 0 && outputData && options.outputPath) {
|
|
9429
|
-
console.log(`diff image: ${options.outputPath}`);
|
|
9430
|
-
}
|
|
9431
|
-
if (result.diffCount > 0) {
|
|
9432
|
-
process.exit(1);
|
|
9433
|
-
} else {
|
|
9434
|
-
console.log(`Images are identical!`);
|
|
9435
|
-
process.exit(0);
|
|
9436
|
-
}
|
|
9437
9444
|
} catch (error) {
|
|
9438
9445
|
console.error(
|
|
9439
9446
|
"Error:",
|