@tscircuit/cli 0.1.2261 → 0.1.2262

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.
@@ -3322,6 +3322,336 @@ var require_svgson_cjs = __commonJS(function(exports) {
3322
3322
  exports.stringify = stringify;
3323
3323
  });
3324
3324
 
3325
+ // node_modules/color-name/index.js
3326
+ var colors, color_name_default;
3327
+ var init_color_name = __esm(() => {
3328
+ colors = {
3329
+ aliceblue: [240, 248, 255],
3330
+ antiquewhite: [250, 235, 215],
3331
+ aqua: [0, 255, 255],
3332
+ aquamarine: [127, 255, 212],
3333
+ azure: [240, 255, 255],
3334
+ beige: [245, 245, 220],
3335
+ bisque: [255, 228, 196],
3336
+ black: [0, 0, 0],
3337
+ blanchedalmond: [255, 235, 205],
3338
+ blue: [0, 0, 255],
3339
+ blueviolet: [138, 43, 226],
3340
+ brown: [165, 42, 42],
3341
+ burlywood: [222, 184, 135],
3342
+ cadetblue: [95, 158, 160],
3343
+ chartreuse: [127, 255, 0],
3344
+ chocolate: [210, 105, 30],
3345
+ coral: [255, 127, 80],
3346
+ cornflowerblue: [100, 149, 237],
3347
+ cornsilk: [255, 248, 220],
3348
+ crimson: [220, 20, 60],
3349
+ cyan: [0, 255, 255],
3350
+ darkblue: [0, 0, 139],
3351
+ darkcyan: [0, 139, 139],
3352
+ darkgoldenrod: [184, 134, 11],
3353
+ darkgray: [169, 169, 169],
3354
+ darkgreen: [0, 100, 0],
3355
+ darkgrey: [169, 169, 169],
3356
+ darkkhaki: [189, 183, 107],
3357
+ darkmagenta: [139, 0, 139],
3358
+ darkolivegreen: [85, 107, 47],
3359
+ darkorange: [255, 140, 0],
3360
+ darkorchid: [153, 50, 204],
3361
+ darkred: [139, 0, 0],
3362
+ darksalmon: [233, 150, 122],
3363
+ darkseagreen: [143, 188, 143],
3364
+ darkslateblue: [72, 61, 139],
3365
+ darkslategray: [47, 79, 79],
3366
+ darkslategrey: [47, 79, 79],
3367
+ darkturquoise: [0, 206, 209],
3368
+ darkviolet: [148, 0, 211],
3369
+ deeppink: [255, 20, 147],
3370
+ deepskyblue: [0, 191, 255],
3371
+ dimgray: [105, 105, 105],
3372
+ dimgrey: [105, 105, 105],
3373
+ dodgerblue: [30, 144, 255],
3374
+ firebrick: [178, 34, 34],
3375
+ floralwhite: [255, 250, 240],
3376
+ forestgreen: [34, 139, 34],
3377
+ fuchsia: [255, 0, 255],
3378
+ gainsboro: [220, 220, 220],
3379
+ ghostwhite: [248, 248, 255],
3380
+ gold: [255, 215, 0],
3381
+ goldenrod: [218, 165, 32],
3382
+ gray: [128, 128, 128],
3383
+ green: [0, 128, 0],
3384
+ greenyellow: [173, 255, 47],
3385
+ grey: [128, 128, 128],
3386
+ honeydew: [240, 255, 240],
3387
+ hotpink: [255, 105, 180],
3388
+ indianred: [205, 92, 92],
3389
+ indigo: [75, 0, 130],
3390
+ ivory: [255, 255, 240],
3391
+ khaki: [240, 230, 140],
3392
+ lavender: [230, 230, 250],
3393
+ lavenderblush: [255, 240, 245],
3394
+ lawngreen: [124, 252, 0],
3395
+ lemonchiffon: [255, 250, 205],
3396
+ lightblue: [173, 216, 230],
3397
+ lightcoral: [240, 128, 128],
3398
+ lightcyan: [224, 255, 255],
3399
+ lightgoldenrodyellow: [250, 250, 210],
3400
+ lightgray: [211, 211, 211],
3401
+ lightgreen: [144, 238, 144],
3402
+ lightgrey: [211, 211, 211],
3403
+ lightpink: [255, 182, 193],
3404
+ lightsalmon: [255, 160, 122],
3405
+ lightseagreen: [32, 178, 170],
3406
+ lightskyblue: [135, 206, 250],
3407
+ lightslategray: [119, 136, 153],
3408
+ lightslategrey: [119, 136, 153],
3409
+ lightsteelblue: [176, 196, 222],
3410
+ lightyellow: [255, 255, 224],
3411
+ lime: [0, 255, 0],
3412
+ limegreen: [50, 205, 50],
3413
+ linen: [250, 240, 230],
3414
+ magenta: [255, 0, 255],
3415
+ maroon: [128, 0, 0],
3416
+ mediumaquamarine: [102, 205, 170],
3417
+ mediumblue: [0, 0, 205],
3418
+ mediumorchid: [186, 85, 211],
3419
+ mediumpurple: [147, 112, 219],
3420
+ mediumseagreen: [60, 179, 113],
3421
+ mediumslateblue: [123, 104, 238],
3422
+ mediumspringgreen: [0, 250, 154],
3423
+ mediumturquoise: [72, 209, 204],
3424
+ mediumvioletred: [199, 21, 133],
3425
+ midnightblue: [25, 25, 112],
3426
+ mintcream: [245, 255, 250],
3427
+ mistyrose: [255, 228, 225],
3428
+ moccasin: [255, 228, 181],
3429
+ navajowhite: [255, 222, 173],
3430
+ navy: [0, 0, 128],
3431
+ oldlace: [253, 245, 230],
3432
+ olive: [128, 128, 0],
3433
+ olivedrab: [107, 142, 35],
3434
+ orange: [255, 165, 0],
3435
+ orangered: [255, 69, 0],
3436
+ orchid: [218, 112, 214],
3437
+ palegoldenrod: [238, 232, 170],
3438
+ palegreen: [152, 251, 152],
3439
+ paleturquoise: [175, 238, 238],
3440
+ palevioletred: [219, 112, 147],
3441
+ papayawhip: [255, 239, 213],
3442
+ peachpuff: [255, 218, 185],
3443
+ peru: [205, 133, 63],
3444
+ pink: [255, 192, 203],
3445
+ plum: [221, 160, 221],
3446
+ powderblue: [176, 224, 230],
3447
+ purple: [128, 0, 128],
3448
+ rebeccapurple: [102, 51, 153],
3449
+ red: [255, 0, 0],
3450
+ rosybrown: [188, 143, 143],
3451
+ royalblue: [65, 105, 225],
3452
+ saddlebrown: [139, 69, 19],
3453
+ salmon: [250, 128, 114],
3454
+ sandybrown: [244, 164, 96],
3455
+ seagreen: [46, 139, 87],
3456
+ seashell: [255, 245, 238],
3457
+ sienna: [160, 82, 45],
3458
+ silver: [192, 192, 192],
3459
+ skyblue: [135, 206, 235],
3460
+ slateblue: [106, 90, 205],
3461
+ slategray: [112, 128, 144],
3462
+ slategrey: [112, 128, 144],
3463
+ snow: [255, 250, 250],
3464
+ springgreen: [0, 255, 127],
3465
+ steelblue: [70, 130, 180],
3466
+ tan: [210, 180, 140],
3467
+ teal: [0, 128, 128],
3468
+ thistle: [216, 191, 216],
3469
+ tomato: [255, 99, 71],
3470
+ turquoise: [64, 224, 208],
3471
+ violet: [238, 130, 238],
3472
+ wheat: [245, 222, 179],
3473
+ white: [255, 255, 255],
3474
+ whitesmoke: [245, 245, 245],
3475
+ yellow: [255, 255, 0],
3476
+ yellowgreen: [154, 205, 50]
3477
+ };
3478
+ for (const key in colors)
3479
+ Object.freeze(colors[key]);
3480
+ color_name_default = Object.freeze(colors);
3481
+ });
3482
+
3483
+ // node_modules/color-string/index.js
3484
+ function clamp(number_, min, max) {
3485
+ return Math.min(Math.max(min, number_), max);
3486
+ }
3487
+ function hexDouble(number_) {
3488
+ const string_ = Math.round(number_).toString(16).toUpperCase();
3489
+ return string_.length < 2 ? "0" + string_ : string_;
3490
+ }
3491
+ var reverseNames, cs, color_string_default;
3492
+ var init_color_string = __esm(() => {
3493
+ init_color_name();
3494
+ reverseNames = Object.create(null);
3495
+ for (const name in color_name_default) {
3496
+ if (Object.hasOwn(color_name_default, name)) {
3497
+ reverseNames[color_name_default[name]] = name;
3498
+ }
3499
+ }
3500
+ cs = {
3501
+ to: {},
3502
+ get: {}
3503
+ };
3504
+ cs.get = function(string) {
3505
+ const prefix = string.slice(0, 3).toLowerCase();
3506
+ let value;
3507
+ let model;
3508
+ switch (prefix) {
3509
+ case "hsl": {
3510
+ value = cs.get.hsl(string);
3511
+ model = "hsl";
3512
+ break;
3513
+ }
3514
+ case "hwb": {
3515
+ value = cs.get.hwb(string);
3516
+ model = "hwb";
3517
+ break;
3518
+ }
3519
+ default: {
3520
+ value = cs.get.rgb(string);
3521
+ model = "rgb";
3522
+ break;
3523
+ }
3524
+ }
3525
+ if (!value) {
3526
+ return null;
3527
+ }
3528
+ return { model, value };
3529
+ };
3530
+ cs.get.rgb = function(string) {
3531
+ if (!string) {
3532
+ return null;
3533
+ }
3534
+ const abbr = /^#([a-f\d]{3,4})$/i;
3535
+ const hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
3536
+ const rgba = /^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i;
3537
+ const per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i;
3538
+ const keyword = /^(\w+)$/;
3539
+ let rgb = [0, 0, 0, 1];
3540
+ let match;
3541
+ let i;
3542
+ let hexAlpha;
3543
+ if (match = string.match(hex)) {
3544
+ hexAlpha = match[2];
3545
+ match = match[1];
3546
+ for (i = 0;i < 3; i++) {
3547
+ const i2 = i * 2;
3548
+ rgb[i] = Number.parseInt(match.slice(i2, i2 + 2), 16);
3549
+ }
3550
+ if (hexAlpha) {
3551
+ rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
3552
+ }
3553
+ } else if (match = string.match(abbr)) {
3554
+ match = match[1];
3555
+ hexAlpha = match[3];
3556
+ for (i = 0;i < 3; i++) {
3557
+ rgb[i] = Number.parseInt(match[i] + match[i], 16);
3558
+ }
3559
+ if (hexAlpha) {
3560
+ rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
3561
+ }
3562
+ } else if (match = string.match(rgba)) {
3563
+ for (i = 0;i < 3; i++) {
3564
+ rgb[i] = Number.parseFloat(match[i + 1]);
3565
+ }
3566
+ if (match[4]) {
3567
+ rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
3568
+ }
3569
+ } else if (match = string.match(per)) {
3570
+ for (i = 0;i < 3; i++) {
3571
+ rgb[i] = Math.round(Number.parseFloat(match[i + 1]) * 2.55);
3572
+ }
3573
+ if (match[4]) {
3574
+ rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
3575
+ }
3576
+ } else if (match = string.toLowerCase().match(keyword)) {
3577
+ if (match[1] === "transparent") {
3578
+ return [0, 0, 0, 0];
3579
+ }
3580
+ if (!Object.hasOwn(color_name_default, match[1])) {
3581
+ return null;
3582
+ }
3583
+ rgb = color_name_default[match[1]].slice();
3584
+ rgb[3] = 1;
3585
+ return rgb;
3586
+ } else {
3587
+ return null;
3588
+ }
3589
+ for (i = 0;i < 3; i++) {
3590
+ rgb[i] = clamp(rgb[i], 0, 255);
3591
+ }
3592
+ rgb[3] = clamp(rgb[3], 0, 1);
3593
+ return rgb;
3594
+ };
3595
+ cs.get.hsl = function(string) {
3596
+ if (!string) {
3597
+ return null;
3598
+ }
3599
+ const hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
3600
+ const match = string.match(hsl);
3601
+ if (match) {
3602
+ const alpha = Number.parseFloat(match[4]);
3603
+ const h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
3604
+ const s = clamp(Number.parseFloat(match[2]), 0, 100);
3605
+ const l = clamp(Number.parseFloat(match[3]), 0, 100);
3606
+ const a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
3607
+ return [h, s, l, a];
3608
+ }
3609
+ return null;
3610
+ };
3611
+ cs.get.hwb = function(string) {
3612
+ if (!string) {
3613
+ return null;
3614
+ }
3615
+ const hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
3616
+ const match = string.match(hwb);
3617
+ if (match) {
3618
+ const alpha = Number.parseFloat(match[4]);
3619
+ const h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
3620
+ const w = clamp(Number.parseFloat(match[2]), 0, 100);
3621
+ const b = clamp(Number.parseFloat(match[3]), 0, 100);
3622
+ const a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
3623
+ return [h, w, b, a];
3624
+ }
3625
+ return null;
3626
+ };
3627
+ cs.to.hex = function(...rgba) {
3628
+ return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
3629
+ };
3630
+ cs.to.rgb = function(...rgba) {
3631
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
3632
+ };
3633
+ cs.to.rgb.percent = function(...rgba) {
3634
+ const r = Math.round(rgba[0] / 255 * 100);
3635
+ const g = Math.round(rgba[1] / 255 * 100);
3636
+ const b = Math.round(rgba[2] / 255 * 100);
3637
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r + "%, " + g + "%, " + b + "%)" : "rgba(" + r + "%, " + g + "%, " + b + "%, " + rgba[3] + ")";
3638
+ };
3639
+ cs.to.hsl = function(...hsla) {
3640
+ return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
3641
+ };
3642
+ cs.to.hwb = function(...hwba) {
3643
+ let a = "";
3644
+ if (hwba.length >= 4 && hwba[3] !== 1) {
3645
+ a = ", " + hwba[3];
3646
+ }
3647
+ return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")";
3648
+ };
3649
+ cs.to.keyword = function(...rgb) {
3650
+ return reverseNames[rgb.slice(0, 3)];
3651
+ };
3652
+ color_string_default = cs;
3653
+ });
3654
+
3325
3655
  // node_modules/gl-matrix/cjs/common.js
3326
3656
  var require_common = __commonJS(function(exports) {
3327
3657
  Object.defineProperty(exports, "__esModule", {
@@ -21548,13 +21878,13 @@ function drawInfiniteGrid(software_renderer, params) {
21548
21878
  let out_g = final_g;
21549
21879
  let out_b = final_b;
21550
21880
  if (gamma_out) {
21551
- out_r = srgbEncodeLinear01(clamp(out_r, 0, 1));
21552
- out_g = srgbEncodeLinear01(clamp(out_g, 0, 1));
21553
- out_b = srgbEncodeLinear01(clamp(out_b, 0, 1));
21881
+ out_r = srgbEncodeLinear01(clamp2(out_r, 0, 1));
21882
+ out_g = srgbEncodeLinear01(clamp2(out_g, 0, 1));
21883
+ out_b = srgbEncodeLinear01(clamp2(out_b, 0, 1));
21554
21884
  } else {
21555
- out_r = clamp(out_r, 0, 1);
21556
- out_g = clamp(out_g, 0, 1);
21557
- out_b = clamp(out_b, 0, 1);
21885
+ out_r = clamp2(out_r, 0, 1);
21886
+ out_g = clamp2(out_g, 0, 1);
21887
+ out_b = clamp2(out_b, 0, 1);
21558
21888
  }
21559
21889
  const dst_idx = (y * software_renderer.width + x) * 4;
21560
21890
  const dst_r = (software_renderer.buffer[dst_idx + 0] ?? 0) / 255;
@@ -21566,7 +21896,7 @@ function drawInfiniteGrid(software_renderer, params) {
21566
21896
  const blend_g = out_g * final_alpha + dst_g * one_minus_a;
21567
21897
  const blend_b = out_b * final_alpha + dst_b * one_minus_a;
21568
21898
  const blend_a = final_alpha + dst_a * one_minus_a;
21569
- software_renderer.setPixel(x, y, clamp(blend_r, 0, 1) * 255 | 0, clamp(blend_g, 0, 1) * 255 | 0, clamp(blend_b, 0, 1) * 255 | 0, clamp(blend_a, 0, 1) * 255 | 0);
21899
+ software_renderer.setPixel(x, y, clamp2(blend_r, 0, 1) * 255 | 0, clamp2(blend_g, 0, 1) * 255 | 0, clamp2(blend_b, 0, 1) * 255 | 0, clamp2(blend_a, 0, 1) * 255 | 0);
21570
21900
  }
21571
21901
  }
21572
21902
  }
@@ -22419,7 +22749,7 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
22419
22749
  width,
22420
22750
  height,
22421
22751
  data: new Uint8ClampedArray(width * height * 4)
22422
- }), DEFAULT_LIGHT_DIR, DEFAULT_RENDER_OPTIONS, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), GeometryDenoiser = class {
22752
+ }), DEFAULT_LIGHT_DIR, DEFAULT_RENDER_OPTIONS, clamp2 = (value, min, max) => Math.max(min, Math.min(max, value)), GeometryDenoiser = class {
22423
22753
  constructor(width, height) {
22424
22754
  this.width = width;
22425
22755
  this.height = height;
@@ -22584,19 +22914,19 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
22584
22914
  }
22585
22915
  let [r, g, b, a] = material.baseColorFactor;
22586
22916
  if (gammaOut) {
22587
- r = srgbEncodeLinear01(clamp(r, 0, 1));
22588
- g = srgbEncodeLinear01(clamp(g, 0, 1));
22589
- b = srgbEncodeLinear01(clamp(b, 0, 1));
22917
+ r = srgbEncodeLinear01(clamp2(r, 0, 1));
22918
+ g = srgbEncodeLinear01(clamp2(g, 0, 1));
22919
+ b = srgbEncodeLinear01(clamp2(b, 0, 1));
22590
22920
  } else {
22591
- r = clamp(r, 0, 1);
22592
- g = clamp(g, 0, 1);
22593
- b = clamp(b, 0, 1);
22921
+ r = clamp2(r, 0, 1);
22922
+ g = clamp2(g, 0, 1);
22923
+ b = clamp2(b, 0, 1);
22594
22924
  }
22595
22925
  const r255 = r * 255 | 0;
22596
22926
  const g255 = g * 255 | 0;
22597
22927
  const b255 = b * 255 | 0;
22598
- const opacity = clamp(options.opacity ?? 1, 0, 1);
22599
- const sourceAlpha = clamp(a, 0, 1) * opacity;
22928
+ const opacity = clamp2(options.opacity ?? 1, 0, 1);
22929
+ const sourceAlpha = clamp2(a, 0, 1) * opacity;
22600
22930
  const depthCompare = options.depthCompare ?? "less";
22601
22931
  const depthWrite = options.depthWrite ?? true;
22602
22932
  const depthBias = options.depthBias ?? 0;
@@ -22664,8 +22994,8 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
22664
22994
  sampleTextureNearest(img, u, v) {
22665
22995
  if (!img)
22666
22996
  return [1, 1, 1, 1];
22667
- const x = clamp(Math.floor(u * (img.width - 1)), 0, img.width - 1);
22668
- const y = clamp(Math.floor(v * (img.height - 1)), 0, img.height - 1);
22997
+ const x = clamp2(Math.floor(u * (img.width - 1)), 0, img.width - 1);
22998
+ const y = clamp2(Math.floor(v * (img.height - 1)), 0, img.height - 1);
22669
22999
  const idx = (y * img.width + x) * 4;
22670
23000
  const d = img.data;
22671
23001
  return [
@@ -22691,7 +23021,7 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
22691
23021
  let { positions, normals, uvs, indices, model, colors } = mesh;
22692
23022
  const materialId = this.denoiser?.materialId(material) ?? 0;
22693
23023
  const lightDir = light.dir ?? DEFAULT_LIGHT_DIR;
22694
- const ambient = clamp(light.ambient ?? DEFAULT_RENDER_OPTIONS.ambient, 0, 1);
23024
+ const ambient = clamp2(light.ambient ?? DEFAULT_RENDER_OPTIONS.ambient, 0, 1);
22695
23025
  const L = studio ? null : import_gl_matrix5.vec3.normalize(import_gl_matrix5.vec3.create(), import_gl_matrix5.vec3.fromValues(lightDir[0], lightDir[1], lightDir[2]));
22696
23026
  const view = camera.view;
22697
23027
  const proj = camera.proj;
@@ -22896,13 +23226,13 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
22896
23226
  depth[di] = z01;
22897
23227
  }
22898
23228
  if (gammaOut) {
22899
- r = srgbEncodeLinear01(clamp(r, 0, 1));
22900
- g = srgbEncodeLinear01(clamp(g, 0, 1));
22901
- b = srgbEncodeLinear01(clamp(b, 0, 1));
23229
+ r = srgbEncodeLinear01(clamp2(r, 0, 1));
23230
+ g = srgbEncodeLinear01(clamp2(g, 0, 1));
23231
+ b = srgbEncodeLinear01(clamp2(b, 0, 1));
22902
23232
  } else {
22903
- r = clamp(r, 0, 1);
22904
- g = clamp(g, 0, 1);
22905
- b = clamp(b, 0, 1);
23233
+ r = clamp2(r, 0, 1);
23234
+ g = clamp2(g, 0, 1);
23235
+ b = clamp2(b, 0, 1);
22906
23236
  }
22907
23237
  const dstIdx = (y * this.width + x) * 4;
22908
23238
  const dstR = (this.buffer[dstIdx + 0] ?? 0) / 255;
@@ -22920,7 +23250,7 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
22920
23250
  outB = b * a + dstB * oneMinusA;
22921
23251
  outA = a + dstA * oneMinusA;
22922
23252
  }
22923
- this.setPixel(x, y, clamp(outR, 0, 1) * 255 | 0, clamp(outG, 0, 1) * 255 | 0, clamp(outB, 0, 1) * 255 | 0, clamp(outA, 0, 1) * 255 | 0, true);
23253
+ this.setPixel(x, y, clamp2(outR, 0, 1) * 255 | 0, clamp2(outG, 0, 1) * 255 | 0, clamp2(outB, 0, 1) * 255 | 0, clamp2(outA, 0, 1) * 255 | 0, true);
22924
23254
  if (this.denoiser) {
22925
23255
  if (alphaMode !== "BLEND") {
22926
23256
  const distance = 1 / (l0 * invW[0] + l1 * invW[1] + l2 * invW[2]);
@@ -34554,6 +34884,1251 @@ import { applyToPoint as applyToPoint5 } from "transformation-matrix";
34554
34884
  import { applyToPoint as applyToPoint6 } from "transformation-matrix";
34555
34885
  import { applyToPoint as applyToPoint7 } from "transformation-matrix";
34556
34886
  import { applyToPoint as applyToPoint8 } from "transformation-matrix";
34887
+
34888
+ // node_modules/color/index.js
34889
+ init_color_string();
34890
+
34891
+ // node_modules/color-convert/conversions.js
34892
+ init_color_name();
34893
+ var reverseKeywords = {};
34894
+ for (const key of Object.keys(color_name_default)) {
34895
+ reverseKeywords[color_name_default[key]] = key;
34896
+ }
34897
+ var convert = {
34898
+ rgb: { channels: 3, labels: "rgb" },
34899
+ hsl: { channels: 3, labels: "hsl" },
34900
+ hsv: { channels: 3, labels: "hsv" },
34901
+ hwb: { channels: 3, labels: "hwb" },
34902
+ cmyk: { channels: 4, labels: "cmyk" },
34903
+ xyz: { channels: 3, labels: "xyz" },
34904
+ lab: { channels: 3, labels: "lab" },
34905
+ oklab: { channels: 3, labels: ["okl", "oka", "okb"] },
34906
+ lch: { channels: 3, labels: "lch" },
34907
+ oklch: { channels: 3, labels: ["okl", "okc", "okh"] },
34908
+ hex: { channels: 1, labels: ["hex"] },
34909
+ keyword: { channels: 1, labels: ["keyword"] },
34910
+ ansi16: { channels: 1, labels: ["ansi16"] },
34911
+ ansi256: { channels: 1, labels: ["ansi256"] },
34912
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
34913
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
34914
+ gray: { channels: 1, labels: ["gray"] }
34915
+ };
34916
+ var conversions_default = convert;
34917
+ var LAB_FT = (6 / 29) ** 3;
34918
+ function srgbNonlinearTransform(c) {
34919
+ const cc = c > 0.0031308 ? 1.055 * c ** (1 / 2.4) - 0.055 : c * 12.92;
34920
+ return Math.min(Math.max(0, cc), 1);
34921
+ }
34922
+ function srgbNonlinearTransformInv(c) {
34923
+ return c > 0.04045 ? ((c + 0.055) / 1.055) ** 2.4 : c / 12.92;
34924
+ }
34925
+ for (const model of Object.keys(convert)) {
34926
+ if (!("channels" in convert[model])) {
34927
+ throw new Error("missing channels property: " + model);
34928
+ }
34929
+ if (!("labels" in convert[model])) {
34930
+ throw new Error("missing channel labels property: " + model);
34931
+ }
34932
+ if (convert[model].labels.length !== convert[model].channels) {
34933
+ throw new Error("channel and label counts mismatch: " + model);
34934
+ }
34935
+ const { channels, labels } = convert[model];
34936
+ delete convert[model].channels;
34937
+ delete convert[model].labels;
34938
+ Object.defineProperty(convert[model], "channels", { value: channels });
34939
+ Object.defineProperty(convert[model], "labels", { value: labels });
34940
+ }
34941
+ convert.rgb.hsl = function(rgb) {
34942
+ const r = rgb[0] / 255;
34943
+ const g = rgb[1] / 255;
34944
+ const b = rgb[2] / 255;
34945
+ const min = Math.min(r, g, b);
34946
+ const max = Math.max(r, g, b);
34947
+ const delta = max - min;
34948
+ let h;
34949
+ let s;
34950
+ switch (max) {
34951
+ case min: {
34952
+ h = 0;
34953
+ break;
34954
+ }
34955
+ case r: {
34956
+ h = (g - b) / delta;
34957
+ break;
34958
+ }
34959
+ case g: {
34960
+ h = 2 + (b - r) / delta;
34961
+ break;
34962
+ }
34963
+ case b: {
34964
+ h = 4 + (r - g) / delta;
34965
+ break;
34966
+ }
34967
+ }
34968
+ h = Math.min(h * 60, 360);
34969
+ if (h < 0) {
34970
+ h += 360;
34971
+ }
34972
+ const l = (min + max) / 2;
34973
+ if (max === min) {
34974
+ s = 0;
34975
+ } else if (l <= 0.5) {
34976
+ s = delta / (max + min);
34977
+ } else {
34978
+ s = delta / (2 - max - min);
34979
+ }
34980
+ return [h, s * 100, l * 100];
34981
+ };
34982
+ convert.rgb.hsv = function(rgb) {
34983
+ let rdif;
34984
+ let gdif;
34985
+ let bdif;
34986
+ let h;
34987
+ let s;
34988
+ const r = rgb[0] / 255;
34989
+ const g = rgb[1] / 255;
34990
+ const b = rgb[2] / 255;
34991
+ const v = Math.max(r, g, b);
34992
+ const diff = v - Math.min(r, g, b);
34993
+ const diffc = function(c) {
34994
+ return (v - c) / 6 / diff + 1 / 2;
34995
+ };
34996
+ if (diff === 0) {
34997
+ h = 0;
34998
+ s = 0;
34999
+ } else {
35000
+ s = diff / v;
35001
+ rdif = diffc(r);
35002
+ gdif = diffc(g);
35003
+ bdif = diffc(b);
35004
+ switch (v) {
35005
+ case r: {
35006
+ h = bdif - gdif;
35007
+ break;
35008
+ }
35009
+ case g: {
35010
+ h = 1 / 3 + rdif - bdif;
35011
+ break;
35012
+ }
35013
+ case b: {
35014
+ h = 2 / 3 + gdif - rdif;
35015
+ break;
35016
+ }
35017
+ }
35018
+ if (h < 0) {
35019
+ h += 1;
35020
+ } else if (h > 1) {
35021
+ h -= 1;
35022
+ }
35023
+ }
35024
+ return [
35025
+ h * 360,
35026
+ s * 100,
35027
+ v * 100
35028
+ ];
35029
+ };
35030
+ convert.rgb.hwb = function(rgb) {
35031
+ const r = rgb[0];
35032
+ const g = rgb[1];
35033
+ let b = rgb[2];
35034
+ const h = convert.rgb.hsl(rgb)[0];
35035
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
35036
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
35037
+ return [h, w * 100, b * 100];
35038
+ };
35039
+ convert.rgb.oklab = function(rgb) {
35040
+ const r = srgbNonlinearTransformInv(rgb[0] / 255);
35041
+ const g = srgbNonlinearTransformInv(rgb[1] / 255);
35042
+ const b = srgbNonlinearTransformInv(rgb[2] / 255);
35043
+ const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
35044
+ const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
35045
+ const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
35046
+ const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
35047
+ const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
35048
+ const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
35049
+ return [l * 100, aa * 100, bb * 100];
35050
+ };
35051
+ convert.rgb.cmyk = function(rgb) {
35052
+ const r = rgb[0] / 255;
35053
+ const g = rgb[1] / 255;
35054
+ const b = rgb[2] / 255;
35055
+ const k = Math.min(1 - r, 1 - g, 1 - b);
35056
+ const c = (1 - r - k) / (1 - k) || 0;
35057
+ const m = (1 - g - k) / (1 - k) || 0;
35058
+ const y = (1 - b - k) / (1 - k) || 0;
35059
+ return [c * 100, m * 100, y * 100, k * 100];
35060
+ };
35061
+ function comparativeDistance(x, y) {
35062
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
35063
+ }
35064
+ convert.rgb.keyword = function(rgb) {
35065
+ const reversed = reverseKeywords[rgb];
35066
+ if (reversed) {
35067
+ return reversed;
35068
+ }
35069
+ let currentClosestDistance = Number.POSITIVE_INFINITY;
35070
+ let currentClosestKeyword;
35071
+ for (const keyword of Object.keys(color_name_default)) {
35072
+ const value = color_name_default[keyword];
35073
+ const distance = comparativeDistance(rgb, value);
35074
+ if (distance < currentClosestDistance) {
35075
+ currentClosestDistance = distance;
35076
+ currentClosestKeyword = keyword;
35077
+ }
35078
+ }
35079
+ return currentClosestKeyword;
35080
+ };
35081
+ convert.keyword.rgb = function(keyword) {
35082
+ return [...color_name_default[keyword]];
35083
+ };
35084
+ convert.rgb.xyz = function(rgb) {
35085
+ const r = srgbNonlinearTransformInv(rgb[0] / 255);
35086
+ const g = srgbNonlinearTransformInv(rgb[1] / 255);
35087
+ const b = srgbNonlinearTransformInv(rgb[2] / 255);
35088
+ const x = r * 0.4124564 + g * 0.3575761 + b * 0.1804375;
35089
+ const y = r * 0.2126729 + g * 0.7151522 + b * 0.072175;
35090
+ const z = r * 0.0193339 + g * 0.119192 + b * 0.9503041;
35091
+ return [x * 100, y * 100, z * 100];
35092
+ };
35093
+ convert.rgb.lab = function(rgb) {
35094
+ const xyz = convert.rgb.xyz(rgb);
35095
+ let x = xyz[0];
35096
+ let y = xyz[1];
35097
+ let z = xyz[2];
35098
+ x /= 95.047;
35099
+ y /= 100;
35100
+ z /= 108.883;
35101
+ x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
35102
+ y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
35103
+ z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
35104
+ const l = 116 * y - 16;
35105
+ const a = 500 * (x - y);
35106
+ const b = 200 * (y - z);
35107
+ return [l, a, b];
35108
+ };
35109
+ convert.hsl.rgb = function(hsl) {
35110
+ const h = hsl[0] / 360;
35111
+ const s = hsl[1] / 100;
35112
+ const l = hsl[2] / 100;
35113
+ let t3;
35114
+ let value;
35115
+ if (s === 0) {
35116
+ value = l * 255;
35117
+ return [value, value, value];
35118
+ }
35119
+ const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
35120
+ const t1 = 2 * l - t2;
35121
+ const rgb = [0, 0, 0];
35122
+ for (let i = 0;i < 3; i++) {
35123
+ t3 = h + 1 / 3 * -(i - 1);
35124
+ if (t3 < 0) {
35125
+ t3++;
35126
+ }
35127
+ if (t3 > 1) {
35128
+ t3--;
35129
+ }
35130
+ if (6 * t3 < 1) {
35131
+ value = t1 + (t2 - t1) * 6 * t3;
35132
+ } else if (2 * t3 < 1) {
35133
+ value = t2;
35134
+ } else if (3 * t3 < 2) {
35135
+ value = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
35136
+ } else {
35137
+ value = t1;
35138
+ }
35139
+ rgb[i] = value * 255;
35140
+ }
35141
+ return rgb;
35142
+ };
35143
+ convert.hsl.hsv = function(hsl) {
35144
+ const h = hsl[0];
35145
+ let s = hsl[1] / 100;
35146
+ let l = hsl[2] / 100;
35147
+ let smin = s;
35148
+ const lmin = Math.max(l, 0.01);
35149
+ l *= 2;
35150
+ s *= l <= 1 ? l : 2 - l;
35151
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
35152
+ const v = (l + s) / 2;
35153
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
35154
+ return [h, sv * 100, v * 100];
35155
+ };
35156
+ convert.hsv.rgb = function(hsv) {
35157
+ const h = hsv[0] / 60;
35158
+ const s = hsv[1] / 100;
35159
+ let v = hsv[2] / 100;
35160
+ const hi = Math.floor(h) % 6;
35161
+ const f = h - Math.floor(h);
35162
+ const p = 255 * v * (1 - s);
35163
+ const q = 255 * v * (1 - s * f);
35164
+ const t = 255 * v * (1 - s * (1 - f));
35165
+ v *= 255;
35166
+ switch (hi) {
35167
+ case 0: {
35168
+ return [v, t, p];
35169
+ }
35170
+ case 1: {
35171
+ return [q, v, p];
35172
+ }
35173
+ case 2: {
35174
+ return [p, v, t];
35175
+ }
35176
+ case 3: {
35177
+ return [p, q, v];
35178
+ }
35179
+ case 4: {
35180
+ return [t, p, v];
35181
+ }
35182
+ case 5: {
35183
+ return [v, p, q];
35184
+ }
35185
+ }
35186
+ };
35187
+ convert.hsv.hsl = function(hsv) {
35188
+ const h = hsv[0];
35189
+ const s = hsv[1] / 100;
35190
+ const v = hsv[2] / 100;
35191
+ const vmin = Math.max(v, 0.01);
35192
+ let sl;
35193
+ let l;
35194
+ l = (2 - s) * v;
35195
+ const lmin = (2 - s) * vmin;
35196
+ sl = s * vmin;
35197
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
35198
+ sl = sl || 0;
35199
+ l /= 2;
35200
+ return [h, sl * 100, l * 100];
35201
+ };
35202
+ convert.hwb.rgb = function(hwb) {
35203
+ const h = hwb[0] / 360;
35204
+ let wh = hwb[1] / 100;
35205
+ let bl = hwb[2] / 100;
35206
+ const ratio = wh + bl;
35207
+ let f;
35208
+ if (ratio > 1) {
35209
+ wh /= ratio;
35210
+ bl /= ratio;
35211
+ }
35212
+ const i = Math.floor(6 * h);
35213
+ const v = 1 - bl;
35214
+ f = 6 * h - i;
35215
+ if ((i & 1) !== 0) {
35216
+ f = 1 - f;
35217
+ }
35218
+ const n = wh + f * (v - wh);
35219
+ let r;
35220
+ let g;
35221
+ let b;
35222
+ switch (i) {
35223
+ default:
35224
+ case 6:
35225
+ case 0: {
35226
+ r = v;
35227
+ g = n;
35228
+ b = wh;
35229
+ break;
35230
+ }
35231
+ case 1: {
35232
+ r = n;
35233
+ g = v;
35234
+ b = wh;
35235
+ break;
35236
+ }
35237
+ case 2: {
35238
+ r = wh;
35239
+ g = v;
35240
+ b = n;
35241
+ break;
35242
+ }
35243
+ case 3: {
35244
+ r = wh;
35245
+ g = n;
35246
+ b = v;
35247
+ break;
35248
+ }
35249
+ case 4: {
35250
+ r = n;
35251
+ g = wh;
35252
+ b = v;
35253
+ break;
35254
+ }
35255
+ case 5: {
35256
+ r = v;
35257
+ g = wh;
35258
+ b = n;
35259
+ break;
35260
+ }
35261
+ }
35262
+ return [r * 255, g * 255, b * 255];
35263
+ };
35264
+ convert.cmyk.rgb = function(cmyk) {
35265
+ const c = cmyk[0] / 100;
35266
+ const m = cmyk[1] / 100;
35267
+ const y = cmyk[2] / 100;
35268
+ const k = cmyk[3] / 100;
35269
+ const r = 1 - Math.min(1, c * (1 - k) + k);
35270
+ const g = 1 - Math.min(1, m * (1 - k) + k);
35271
+ const b = 1 - Math.min(1, y * (1 - k) + k);
35272
+ return [r * 255, g * 255, b * 255];
35273
+ };
35274
+ convert.xyz.rgb = function(xyz) {
35275
+ const x = xyz[0] / 100;
35276
+ const y = xyz[1] / 100;
35277
+ const z = xyz[2] / 100;
35278
+ let r;
35279
+ let g;
35280
+ let b;
35281
+ r = x * 3.2404542 + y * -1.5371385 + z * -0.4985314;
35282
+ g = x * -0.969266 + y * 1.8760108 + z * 0.041556;
35283
+ b = x * 0.0556434 + y * -0.2040259 + z * 1.0572252;
35284
+ r = srgbNonlinearTransform(r);
35285
+ g = srgbNonlinearTransform(g);
35286
+ b = srgbNonlinearTransform(b);
35287
+ return [r * 255, g * 255, b * 255];
35288
+ };
35289
+ convert.xyz.lab = function(xyz) {
35290
+ let x = xyz[0];
35291
+ let y = xyz[1];
35292
+ let z = xyz[2];
35293
+ x /= 95.047;
35294
+ y /= 100;
35295
+ z /= 108.883;
35296
+ x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
35297
+ y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
35298
+ z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
35299
+ const l = 116 * y - 16;
35300
+ const a = 500 * (x - y);
35301
+ const b = 200 * (y - z);
35302
+ return [l, a, b];
35303
+ };
35304
+ convert.xyz.oklab = function(xyz) {
35305
+ const x = xyz[0] / 100;
35306
+ const y = xyz[1] / 100;
35307
+ const z = xyz[2] / 100;
35308
+ const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z);
35309
+ const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z);
35310
+ const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z);
35311
+ const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
35312
+ const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
35313
+ const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
35314
+ return [l * 100, a * 100, b * 100];
35315
+ };
35316
+ convert.oklab.oklch = function(oklab) {
35317
+ return convert.lab.lch(oklab);
35318
+ };
35319
+ convert.oklab.xyz = function(oklab) {
35320
+ const ll = oklab[0] / 100;
35321
+ const a = oklab[1] / 100;
35322
+ const b = oklab[2] / 100;
35323
+ const l = (0.999999998 * ll + 0.396337792 * a + 0.215803758 * b) ** 3;
35324
+ const m = (1.000000008 * ll - 0.105561342 * a - 0.063854175 * b) ** 3;
35325
+ const s = (1.000000055 * ll - 0.089484182 * a - 1.291485538 * b) ** 3;
35326
+ const x = 1.227013851 * l - 0.55779998 * m + 0.281256149 * s;
35327
+ const y = -0.040580178 * l + 1.11225687 * m - 0.071676679 * s;
35328
+ const z = -0.076381285 * l - 0.421481978 * m + 1.58616322 * s;
35329
+ return [x * 100, y * 100, z * 100];
35330
+ };
35331
+ convert.oklab.rgb = function(oklab) {
35332
+ const ll = oklab[0] / 100;
35333
+ const aa = oklab[1] / 100;
35334
+ const bb = oklab[2] / 100;
35335
+ const l = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
35336
+ const m = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
35337
+ const s = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
35338
+ const r = srgbNonlinearTransform(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s);
35339
+ const g = srgbNonlinearTransform(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s);
35340
+ const b = srgbNonlinearTransform(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s);
35341
+ return [r * 255, g * 255, b * 255];
35342
+ };
35343
+ convert.oklch.oklab = function(oklch) {
35344
+ return convert.lch.lab(oklch);
35345
+ };
35346
+ convert.lab.xyz = function(lab) {
35347
+ const l = lab[0];
35348
+ const a = lab[1];
35349
+ const b = lab[2];
35350
+ let x;
35351
+ let y;
35352
+ let z;
35353
+ y = (l + 16) / 116;
35354
+ x = a / 500 + y;
35355
+ z = y - b / 200;
35356
+ const y2 = y ** 3;
35357
+ const x2 = x ** 3;
35358
+ const z2 = z ** 3;
35359
+ y = y2 > LAB_FT ? y2 : (y - 16 / 116) / 7.787;
35360
+ x = x2 > LAB_FT ? x2 : (x - 16 / 116) / 7.787;
35361
+ z = z2 > LAB_FT ? z2 : (z - 16 / 116) / 7.787;
35362
+ x *= 95.047;
35363
+ y *= 100;
35364
+ z *= 108.883;
35365
+ return [x, y, z];
35366
+ };
35367
+ convert.lab.lch = function(lab) {
35368
+ const l = lab[0];
35369
+ const a = lab[1];
35370
+ const b = lab[2];
35371
+ let h;
35372
+ const hr = Math.atan2(b, a);
35373
+ h = hr * 360 / 2 / Math.PI;
35374
+ if (h < 0) {
35375
+ h += 360;
35376
+ }
35377
+ const c = Math.sqrt(a * a + b * b);
35378
+ return [l, c, h];
35379
+ };
35380
+ convert.lch.lab = function(lch) {
35381
+ const l = lch[0];
35382
+ const c = lch[1];
35383
+ const h = lch[2];
35384
+ const hr = h / 360 * 2 * Math.PI;
35385
+ const a = c * Math.cos(hr);
35386
+ const b = c * Math.sin(hr);
35387
+ return [l, a, b];
35388
+ };
35389
+ convert.rgb.ansi16 = function(args, saturation = null) {
35390
+ const [r, g, b] = args;
35391
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
35392
+ value = Math.round(value / 50);
35393
+ if (value === 0) {
35394
+ return 30;
35395
+ }
35396
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
35397
+ if (value === 2) {
35398
+ ansi += 60;
35399
+ }
35400
+ return ansi;
35401
+ };
35402
+ convert.hsv.ansi16 = function(args) {
35403
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
35404
+ };
35405
+ convert.rgb.ansi256 = function(args) {
35406
+ const r = args[0];
35407
+ const g = args[1];
35408
+ const b = args[2];
35409
+ if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
35410
+ if (r < 8) {
35411
+ return 16;
35412
+ }
35413
+ if (r > 248) {
35414
+ return 231;
35415
+ }
35416
+ return Math.round((r - 8) / 247 * 24) + 232;
35417
+ }
35418
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
35419
+ return ansi;
35420
+ };
35421
+ convert.ansi16.rgb = function(args) {
35422
+ args = args[0];
35423
+ let color = args % 10;
35424
+ if (color === 0 || color === 7) {
35425
+ if (args > 50) {
35426
+ color += 3.5;
35427
+ }
35428
+ color = color / 10.5 * 255;
35429
+ return [color, color, color];
35430
+ }
35431
+ const mult = (Math.trunc(args > 50) + 1) * 0.5;
35432
+ const r = (color & 1) * mult * 255;
35433
+ const g = (color >> 1 & 1) * mult * 255;
35434
+ const b = (color >> 2 & 1) * mult * 255;
35435
+ return [r, g, b];
35436
+ };
35437
+ convert.ansi256.rgb = function(args) {
35438
+ args = args[0];
35439
+ if (args >= 232) {
35440
+ const c = (args - 232) * 10 + 8;
35441
+ return [c, c, c];
35442
+ }
35443
+ args -= 16;
35444
+ let rem;
35445
+ const r = Math.floor(args / 36) / 5 * 255;
35446
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
35447
+ const b = rem % 6 / 5 * 255;
35448
+ return [r, g, b];
35449
+ };
35450
+ convert.rgb.hex = function(args) {
35451
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
35452
+ const string = integer.toString(16).toUpperCase();
35453
+ return "000000".slice(string.length) + string;
35454
+ };
35455
+ convert.hex.rgb = function(args) {
35456
+ const match = args.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
35457
+ if (!match) {
35458
+ return [0, 0, 0];
35459
+ }
35460
+ let colorString = match[0];
35461
+ if (match[0].length === 3) {
35462
+ colorString = [...colorString].map((char) => char + char).join("");
35463
+ }
35464
+ const integer = Number.parseInt(colorString, 16);
35465
+ const r = integer >> 16 & 255;
35466
+ const g = integer >> 8 & 255;
35467
+ const b = integer & 255;
35468
+ return [r, g, b];
35469
+ };
35470
+ convert.rgb.hcg = function(rgb) {
35471
+ const r = rgb[0] / 255;
35472
+ const g = rgb[1] / 255;
35473
+ const b = rgb[2] / 255;
35474
+ const max = Math.max(Math.max(r, g), b);
35475
+ const min = Math.min(Math.min(r, g), b);
35476
+ const chroma = max - min;
35477
+ let hue;
35478
+ const grayscale = chroma < 1 ? min / (1 - chroma) : 0;
35479
+ if (chroma <= 0) {
35480
+ hue = 0;
35481
+ } else if (max === r) {
35482
+ hue = (g - b) / chroma % 6;
35483
+ } else if (max === g) {
35484
+ hue = 2 + (b - r) / chroma;
35485
+ } else {
35486
+ hue = 4 + (r - g) / chroma;
35487
+ }
35488
+ hue /= 6;
35489
+ hue %= 1;
35490
+ return [hue * 360, chroma * 100, grayscale * 100];
35491
+ };
35492
+ convert.hsl.hcg = function(hsl) {
35493
+ const s = hsl[1] / 100;
35494
+ const l = hsl[2] / 100;
35495
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
35496
+ let f = 0;
35497
+ if (c < 1) {
35498
+ f = (l - 0.5 * c) / (1 - c);
35499
+ }
35500
+ return [hsl[0], c * 100, f * 100];
35501
+ };
35502
+ convert.hsv.hcg = function(hsv) {
35503
+ const s = hsv[1] / 100;
35504
+ const v = hsv[2] / 100;
35505
+ const c = s * v;
35506
+ let f = 0;
35507
+ if (c < 1) {
35508
+ f = (v - c) / (1 - c);
35509
+ }
35510
+ return [hsv[0], c * 100, f * 100];
35511
+ };
35512
+ convert.hcg.rgb = function(hcg) {
35513
+ const h = hcg[0] / 360;
35514
+ const c = hcg[1] / 100;
35515
+ const g = hcg[2] / 100;
35516
+ if (c === 0) {
35517
+ return [g * 255, g * 255, g * 255];
35518
+ }
35519
+ const pure = [0, 0, 0];
35520
+ const hi = h % 1 * 6;
35521
+ const v = hi % 1;
35522
+ const w = 1 - v;
35523
+ let mg = 0;
35524
+ switch (Math.floor(hi)) {
35525
+ case 0: {
35526
+ pure[0] = 1;
35527
+ pure[1] = v;
35528
+ pure[2] = 0;
35529
+ break;
35530
+ }
35531
+ case 1: {
35532
+ pure[0] = w;
35533
+ pure[1] = 1;
35534
+ pure[2] = 0;
35535
+ break;
35536
+ }
35537
+ case 2: {
35538
+ pure[0] = 0;
35539
+ pure[1] = 1;
35540
+ pure[2] = v;
35541
+ break;
35542
+ }
35543
+ case 3: {
35544
+ pure[0] = 0;
35545
+ pure[1] = w;
35546
+ pure[2] = 1;
35547
+ break;
35548
+ }
35549
+ case 4: {
35550
+ pure[0] = v;
35551
+ pure[1] = 0;
35552
+ pure[2] = 1;
35553
+ break;
35554
+ }
35555
+ default: {
35556
+ pure[0] = 1;
35557
+ pure[1] = 0;
35558
+ pure[2] = w;
35559
+ }
35560
+ }
35561
+ mg = (1 - c) * g;
35562
+ return [
35563
+ (c * pure[0] + mg) * 255,
35564
+ (c * pure[1] + mg) * 255,
35565
+ (c * pure[2] + mg) * 255
35566
+ ];
35567
+ };
35568
+ convert.hcg.hsv = function(hcg) {
35569
+ const c = hcg[1] / 100;
35570
+ const g = hcg[2] / 100;
35571
+ const v = c + g * (1 - c);
35572
+ let f = 0;
35573
+ if (v > 0) {
35574
+ f = c / v;
35575
+ }
35576
+ return [hcg[0], f * 100, v * 100];
35577
+ };
35578
+ convert.hcg.hsl = function(hcg) {
35579
+ const c = hcg[1] / 100;
35580
+ const g = hcg[2] / 100;
35581
+ const l = g * (1 - c) + 0.5 * c;
35582
+ let s = 0;
35583
+ if (l > 0 && l < 0.5) {
35584
+ s = c / (2 * l);
35585
+ } else if (l >= 0.5 && l < 1) {
35586
+ s = c / (2 * (1 - l));
35587
+ }
35588
+ return [hcg[0], s * 100, l * 100];
35589
+ };
35590
+ convert.hcg.hwb = function(hcg) {
35591
+ const c = hcg[1] / 100;
35592
+ const g = hcg[2] / 100;
35593
+ const v = c + g * (1 - c);
35594
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
35595
+ };
35596
+ convert.hwb.hcg = function(hwb) {
35597
+ const w = hwb[1] / 100;
35598
+ const b = hwb[2] / 100;
35599
+ const v = 1 - b;
35600
+ const c = v - w;
35601
+ let g = 0;
35602
+ if (c < 1) {
35603
+ g = (v - c) / (1 - c);
35604
+ }
35605
+ return [hwb[0], c * 100, g * 100];
35606
+ };
35607
+ convert.apple.rgb = function(apple) {
35608
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
35609
+ };
35610
+ convert.rgb.apple = function(rgb) {
35611
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
35612
+ };
35613
+ convert.gray.rgb = function(args) {
35614
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
35615
+ };
35616
+ convert.gray.hsl = function(args) {
35617
+ return [0, 0, args[0]];
35618
+ };
35619
+ convert.gray.hsv = convert.gray.hsl;
35620
+ convert.gray.hwb = function(gray) {
35621
+ return [0, 100, gray[0]];
35622
+ };
35623
+ convert.gray.cmyk = function(gray) {
35624
+ return [0, 0, 0, gray[0]];
35625
+ };
35626
+ convert.gray.lab = function(gray) {
35627
+ return [gray[0], 0, 0];
35628
+ };
35629
+ convert.gray.hex = function(gray) {
35630
+ const value = Math.round(gray[0] / 100 * 255) & 255;
35631
+ const integer = (value << 16) + (value << 8) + value;
35632
+ const string = integer.toString(16).toUpperCase();
35633
+ return "000000".slice(string.length) + string;
35634
+ };
35635
+ convert.rgb.gray = function(rgb) {
35636
+ const value = (rgb[0] + rgb[1] + rgb[2]) / 3;
35637
+ return [value / 255 * 100];
35638
+ };
35639
+
35640
+ // node_modules/color-convert/route.js
35641
+ function buildGraph() {
35642
+ const graph = {};
35643
+ const models = Object.keys(conversions_default);
35644
+ for (let { length } = models, i = 0;i < length; i++) {
35645
+ graph[models[i]] = {
35646
+ distance: -1,
35647
+ parent: null
35648
+ };
35649
+ }
35650
+ return graph;
35651
+ }
35652
+ function deriveBFS(fromModel) {
35653
+ const graph = buildGraph();
35654
+ const queue = [fromModel];
35655
+ graph[fromModel].distance = 0;
35656
+ while (queue.length > 0) {
35657
+ const current = queue.pop();
35658
+ const adjacents = Object.keys(conversions_default[current]);
35659
+ for (let { length } = adjacents, i = 0;i < length; i++) {
35660
+ const adjacent = adjacents[i];
35661
+ const node = graph[adjacent];
35662
+ if (node.distance === -1) {
35663
+ node.distance = graph[current].distance + 1;
35664
+ node.parent = current;
35665
+ queue.unshift(adjacent);
35666
+ }
35667
+ }
35668
+ }
35669
+ return graph;
35670
+ }
35671
+ function link(from, to) {
35672
+ return function(args) {
35673
+ return to(from(args));
35674
+ };
35675
+ }
35676
+ function wrapConversion(toModel, graph) {
35677
+ const path = [graph[toModel].parent, toModel];
35678
+ let fn = conversions_default[graph[toModel].parent][toModel];
35679
+ let cur = graph[toModel].parent;
35680
+ while (graph[cur].parent) {
35681
+ path.unshift(graph[cur].parent);
35682
+ fn = link(conversions_default[graph[cur].parent][cur], fn);
35683
+ cur = graph[cur].parent;
35684
+ }
35685
+ fn.conversion = path;
35686
+ return fn;
35687
+ }
35688
+ function route(fromModel) {
35689
+ const graph = deriveBFS(fromModel);
35690
+ const conversion = {};
35691
+ const models = Object.keys(graph);
35692
+ for (let { length } = models, i = 0;i < length; i++) {
35693
+ const toModel = models[i];
35694
+ const node = graph[toModel];
35695
+ if (node.parent === null) {
35696
+ continue;
35697
+ }
35698
+ conversion[toModel] = wrapConversion(toModel, graph);
35699
+ }
35700
+ return conversion;
35701
+ }
35702
+ var route_default = route;
35703
+
35704
+ // node_modules/color-convert/index.js
35705
+ var convert2 = {};
35706
+ var models = Object.keys(conversions_default);
35707
+ function wrapRaw(fn) {
35708
+ const wrappedFn = function(...args) {
35709
+ const arg0 = args[0];
35710
+ if (arg0 === undefined || arg0 === null) {
35711
+ return arg0;
35712
+ }
35713
+ if (arg0.length > 1) {
35714
+ args = arg0;
35715
+ }
35716
+ return fn(args);
35717
+ };
35718
+ if ("conversion" in fn) {
35719
+ wrappedFn.conversion = fn.conversion;
35720
+ }
35721
+ return wrappedFn;
35722
+ }
35723
+ function wrapRounded(fn) {
35724
+ const wrappedFn = function(...args) {
35725
+ const arg0 = args[0];
35726
+ if (arg0 === undefined || arg0 === null) {
35727
+ return arg0;
35728
+ }
35729
+ if (arg0.length > 1) {
35730
+ args = arg0;
35731
+ }
35732
+ const result = fn(args);
35733
+ if (typeof result === "object") {
35734
+ for (let { length } = result, i = 0;i < length; i++) {
35735
+ result[i] = Math.round(result[i]);
35736
+ }
35737
+ }
35738
+ return result;
35739
+ };
35740
+ if ("conversion" in fn) {
35741
+ wrappedFn.conversion = fn.conversion;
35742
+ }
35743
+ return wrappedFn;
35744
+ }
35745
+ for (const fromModel of models) {
35746
+ convert2[fromModel] = {};
35747
+ Object.defineProperty(convert2[fromModel], "channels", { value: conversions_default[fromModel].channels });
35748
+ Object.defineProperty(convert2[fromModel], "labels", { value: conversions_default[fromModel].labels });
35749
+ const routes = route_default(fromModel);
35750
+ const routeModels = Object.keys(routes);
35751
+ for (const toModel of routeModels) {
35752
+ const fn = routes[toModel];
35753
+ convert2[fromModel][toModel] = wrapRounded(fn);
35754
+ convert2[fromModel][toModel].raw = wrapRaw(fn);
35755
+ }
35756
+ }
35757
+ var color_convert_default = convert2;
35758
+
35759
+ // node_modules/color/index.js
35760
+ var skippedModels = [
35761
+ "keyword",
35762
+ "gray",
35763
+ "hex"
35764
+ ];
35765
+ var hashedModelKeys = {};
35766
+ for (const model of Object.keys(color_convert_default)) {
35767
+ hashedModelKeys[[...color_convert_default[model].labels].sort().join("")] = model;
35768
+ }
35769
+ var limiters = {};
35770
+ function Color(object, model) {
35771
+ if (!(this instanceof Color)) {
35772
+ return new Color(object, model);
35773
+ }
35774
+ if (model && model in skippedModels) {
35775
+ model = null;
35776
+ }
35777
+ if (model && !(model in color_convert_default)) {
35778
+ throw new Error("Unknown model: " + model);
35779
+ }
35780
+ let i;
35781
+ let channels;
35782
+ if (object == null) {
35783
+ this.model = "rgb";
35784
+ this.color = [0, 0, 0];
35785
+ this.valpha = 1;
35786
+ } else if (object instanceof Color) {
35787
+ this.model = object.model;
35788
+ this.color = [...object.color];
35789
+ this.valpha = object.valpha;
35790
+ } else if (typeof object === "string") {
35791
+ const result = color_string_default.get(object);
35792
+ if (result === null) {
35793
+ throw new Error("Unable to parse color from string: " + object);
35794
+ }
35795
+ this.model = result.model;
35796
+ channels = color_convert_default[this.model].channels;
35797
+ this.color = result.value.slice(0, channels);
35798
+ this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
35799
+ } else if (object.length > 0) {
35800
+ this.model = model || "rgb";
35801
+ channels = color_convert_default[this.model].channels;
35802
+ const newArray = Array.prototype.slice.call(object, 0, channels);
35803
+ this.color = zeroArray(newArray, channels);
35804
+ this.valpha = typeof object[channels] === "number" ? object[channels] : 1;
35805
+ } else if (typeof object === "number") {
35806
+ this.model = "rgb";
35807
+ this.color = [
35808
+ object >> 16 & 255,
35809
+ object >> 8 & 255,
35810
+ object & 255
35811
+ ];
35812
+ this.valpha = 1;
35813
+ } else {
35814
+ this.valpha = 1;
35815
+ const keys = Object.keys(object);
35816
+ if ("alpha" in object) {
35817
+ keys.splice(keys.indexOf("alpha"), 1);
35818
+ this.valpha = typeof object.alpha === "number" ? object.alpha : 0;
35819
+ }
35820
+ const hashedKeys = keys.sort().join("");
35821
+ if (!(hashedKeys in hashedModelKeys)) {
35822
+ throw new Error("Unable to parse color from object: " + JSON.stringify(object));
35823
+ }
35824
+ this.model = hashedModelKeys[hashedKeys];
35825
+ const { labels } = color_convert_default[this.model];
35826
+ const color = [];
35827
+ for (i = 0;i < labels.length; i++) {
35828
+ color.push(object[labels[i]]);
35829
+ }
35830
+ this.color = zeroArray(color);
35831
+ }
35832
+ if (limiters[this.model]) {
35833
+ channels = color_convert_default[this.model].channels;
35834
+ for (i = 0;i < channels; i++) {
35835
+ const limit = limiters[this.model][i];
35836
+ if (limit) {
35837
+ this.color[i] = limit(this.color[i]);
35838
+ }
35839
+ }
35840
+ }
35841
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
35842
+ if (Object.freeze) {
35843
+ Object.freeze(this);
35844
+ }
35845
+ }
35846
+ Color.prototype = {
35847
+ toString() {
35848
+ return this.string();
35849
+ },
35850
+ toJSON() {
35851
+ return this[this.model]();
35852
+ },
35853
+ string(places) {
35854
+ let self = this.model in color_string_default.to ? this : this.rgb();
35855
+ self = self.round(typeof places === "number" ? places : 1);
35856
+ const arguments_ = self.valpha === 1 ? self.color : [...self.color, this.valpha];
35857
+ return color_string_default.to[self.model](...arguments_);
35858
+ },
35859
+ percentString(places) {
35860
+ const self = this.rgb().round(typeof places === "number" ? places : 1);
35861
+ const arguments_ = self.valpha === 1 ? self.color : [...self.color, this.valpha];
35862
+ return color_string_default.to.rgb.percent(...arguments_);
35863
+ },
35864
+ array() {
35865
+ return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
35866
+ },
35867
+ object() {
35868
+ const result = {};
35869
+ const { channels } = color_convert_default[this.model];
35870
+ const { labels } = color_convert_default[this.model];
35871
+ for (let i = 0;i < channels; i++) {
35872
+ result[labels[i]] = this.color[i];
35873
+ }
35874
+ if (this.valpha !== 1) {
35875
+ result.alpha = this.valpha;
35876
+ }
35877
+ return result;
35878
+ },
35879
+ unitArray() {
35880
+ const rgb = this.rgb().color;
35881
+ rgb[0] /= 255;
35882
+ rgb[1] /= 255;
35883
+ rgb[2] /= 255;
35884
+ if (this.valpha !== 1) {
35885
+ rgb.push(this.valpha);
35886
+ }
35887
+ return rgb;
35888
+ },
35889
+ unitObject() {
35890
+ const rgb = this.rgb().object();
35891
+ rgb.r /= 255;
35892
+ rgb.g /= 255;
35893
+ rgb.b /= 255;
35894
+ if (this.valpha !== 1) {
35895
+ rgb.alpha = this.valpha;
35896
+ }
35897
+ return rgb;
35898
+ },
35899
+ round(places) {
35900
+ places = Math.max(places || 0, 0);
35901
+ return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
35902
+ },
35903
+ alpha(value) {
35904
+ if (value !== undefined) {
35905
+ return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
35906
+ }
35907
+ return this.valpha;
35908
+ },
35909
+ red: getset("rgb", 0, maxfn(255)),
35910
+ green: getset("rgb", 1, maxfn(255)),
35911
+ blue: getset("rgb", 2, maxfn(255)),
35912
+ hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360),
35913
+ saturationl: getset("hsl", 1, maxfn(100)),
35914
+ lightness: getset("hsl", 2, maxfn(100)),
35915
+ saturationv: getset("hsv", 1, maxfn(100)),
35916
+ value: getset("hsv", 2, maxfn(100)),
35917
+ chroma: getset("hcg", 1, maxfn(100)),
35918
+ gray: getset("hcg", 2, maxfn(100)),
35919
+ white: getset("hwb", 1, maxfn(100)),
35920
+ wblack: getset("hwb", 2, maxfn(100)),
35921
+ cyan: getset("cmyk", 0, maxfn(100)),
35922
+ magenta: getset("cmyk", 1, maxfn(100)),
35923
+ yellow: getset("cmyk", 2, maxfn(100)),
35924
+ black: getset("cmyk", 3, maxfn(100)),
35925
+ x: getset("xyz", 0, maxfn(95.047)),
35926
+ y: getset("xyz", 1, maxfn(100)),
35927
+ z: getset("xyz", 2, maxfn(108.833)),
35928
+ l: getset("lab", 0, maxfn(100)),
35929
+ a: getset("lab", 1),
35930
+ b: getset("lab", 2),
35931
+ keyword(value) {
35932
+ if (value !== undefined) {
35933
+ return new Color(value);
35934
+ }
35935
+ return color_convert_default[this.model].keyword(this.color);
35936
+ },
35937
+ hex(value) {
35938
+ if (value !== undefined) {
35939
+ return new Color(value);
35940
+ }
35941
+ return color_string_default.to.hex(...this.rgb().round().color);
35942
+ },
35943
+ hexa(value) {
35944
+ if (value !== undefined) {
35945
+ return new Color(value);
35946
+ }
35947
+ const rgbArray = this.rgb().round().color;
35948
+ let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
35949
+ if (alphaHex.length === 1) {
35950
+ alphaHex = "0" + alphaHex;
35951
+ }
35952
+ return color_string_default.to.hex(...rgbArray) + alphaHex;
35953
+ },
35954
+ rgbNumber() {
35955
+ const rgb = this.rgb().color;
35956
+ return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
35957
+ },
35958
+ luminosity() {
35959
+ const rgb = this.rgb().color;
35960
+ const lum = [];
35961
+ for (const [i, element] of rgb.entries()) {
35962
+ const chan = element / 255;
35963
+ lum[i] = chan <= 0.04045 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
35964
+ }
35965
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
35966
+ },
35967
+ contrast(color2) {
35968
+ const lum1 = this.luminosity();
35969
+ const lum2 = color2.luminosity();
35970
+ if (lum1 > lum2) {
35971
+ return (lum1 + 0.05) / (lum2 + 0.05);
35972
+ }
35973
+ return (lum2 + 0.05) / (lum1 + 0.05);
35974
+ },
35975
+ level(color2) {
35976
+ const contrastRatio = this.contrast(color2);
35977
+ if (contrastRatio >= 7) {
35978
+ return "AAA";
35979
+ }
35980
+ return contrastRatio >= 4.5 ? "AA" : "";
35981
+ },
35982
+ isDark() {
35983
+ const rgb = this.rgb().color;
35984
+ const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4;
35985
+ return yiq < 128;
35986
+ },
35987
+ isLight() {
35988
+ return !this.isDark();
35989
+ },
35990
+ negate() {
35991
+ const rgb = this.rgb();
35992
+ for (let i = 0;i < 3; i++) {
35993
+ rgb.color[i] = 255 - rgb.color[i];
35994
+ }
35995
+ return rgb;
35996
+ },
35997
+ lighten(ratio) {
35998
+ const hsl = this.hsl();
35999
+ hsl.color[2] += hsl.color[2] * ratio;
36000
+ return hsl;
36001
+ },
36002
+ darken(ratio) {
36003
+ const hsl = this.hsl();
36004
+ hsl.color[2] -= hsl.color[2] * ratio;
36005
+ return hsl;
36006
+ },
36007
+ saturate(ratio) {
36008
+ const hsl = this.hsl();
36009
+ hsl.color[1] += hsl.color[1] * ratio;
36010
+ return hsl;
36011
+ },
36012
+ desaturate(ratio) {
36013
+ const hsl = this.hsl();
36014
+ hsl.color[1] -= hsl.color[1] * ratio;
36015
+ return hsl;
36016
+ },
36017
+ whiten(ratio) {
36018
+ const hwb = this.hwb();
36019
+ hwb.color[1] += hwb.color[1] * ratio;
36020
+ return hwb;
36021
+ },
36022
+ blacken(ratio) {
36023
+ const hwb = this.hwb();
36024
+ hwb.color[2] += hwb.color[2] * ratio;
36025
+ return hwb;
36026
+ },
36027
+ grayscale() {
36028
+ const rgb = this.rgb().color;
36029
+ const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
36030
+ return Color.rgb(value, value, value);
36031
+ },
36032
+ fade(ratio) {
36033
+ return this.alpha(this.valpha - this.valpha * ratio);
36034
+ },
36035
+ opaquer(ratio) {
36036
+ return this.alpha(this.valpha + this.valpha * ratio);
36037
+ },
36038
+ rotate(degrees) {
36039
+ const hsl = this.hsl();
36040
+ let hue = hsl.color[0];
36041
+ hue = (hue + degrees) % 360;
36042
+ hue = hue < 0 ? 360 + hue : hue;
36043
+ hsl.color[0] = hue;
36044
+ return hsl;
36045
+ },
36046
+ mix(mixinColor, weight) {
36047
+ if (!mixinColor || !mixinColor.rgb) {
36048
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
36049
+ }
36050
+ const color1 = mixinColor.rgb();
36051
+ const color2 = this.rgb();
36052
+ const p = weight === undefined ? 0.5 : weight;
36053
+ const w = 2 * p - 1;
36054
+ const a = color1.alpha() - color2.alpha();
36055
+ const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
36056
+ const w2 = 1 - w1;
36057
+ return Color.rgb(w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue(), color1.alpha() * p + color2.alpha() * (1 - p));
36058
+ }
36059
+ };
36060
+ for (const model of Object.keys(color_convert_default)) {
36061
+ if (skippedModels.includes(model)) {
36062
+ continue;
36063
+ }
36064
+ const { channels } = color_convert_default[model];
36065
+ Color.prototype[model] = function(...arguments_) {
36066
+ if (this.model === model) {
36067
+ return new Color(this);
36068
+ }
36069
+ if (arguments_.length > 0) {
36070
+ return new Color(arguments_, model);
36071
+ }
36072
+ return new Color([...assertArray(color_convert_default[this.model][model].raw(this.color)), this.valpha], model);
36073
+ };
36074
+ Color[model] = function(...arguments_) {
36075
+ let color = arguments_[0];
36076
+ if (typeof color === "number") {
36077
+ color = zeroArray(arguments_, channels);
36078
+ }
36079
+ return new Color(color, model);
36080
+ };
36081
+ }
36082
+ function roundTo(number, places) {
36083
+ return Number(number.toFixed(places));
36084
+ }
36085
+ function roundToPlace(places) {
36086
+ return function(number) {
36087
+ return roundTo(number, places);
36088
+ };
36089
+ }
36090
+ function getset(model, channel, modifier) {
36091
+ model = Array.isArray(model) ? model : [model];
36092
+ for (const m of model) {
36093
+ (limiters[m] ||= [])[channel] = modifier;
36094
+ }
36095
+ model = model[0];
36096
+ return function(value) {
36097
+ let result;
36098
+ if (value !== undefined) {
36099
+ if (modifier) {
36100
+ value = modifier(value);
36101
+ }
36102
+ result = this[model]();
36103
+ result.color[channel] = value;
36104
+ return result;
36105
+ }
36106
+ result = this[model]().color[channel];
36107
+ if (modifier) {
36108
+ result = modifier(result);
36109
+ }
36110
+ return result;
36111
+ };
36112
+ }
36113
+ function maxfn(max) {
36114
+ return function(v) {
36115
+ return Math.max(0, Math.min(max, v));
36116
+ };
36117
+ }
36118
+ function assertArray(value) {
36119
+ return Array.isArray(value) ? value : [value];
36120
+ }
36121
+ function zeroArray(array, length) {
36122
+ for (let i = 0;i < length; i++) {
36123
+ if (typeof array[i] !== "number") {
36124
+ array[i] = 0;
36125
+ }
36126
+ }
36127
+ return array;
36128
+ }
36129
+ var color_default = Color;
36130
+
36131
+ // node_modules/circuit-to-svg-xray/dist/index.js
34557
36132
  import { applyToPoint as applyToPoint9 } from "transformation-matrix";
34558
36133
  import Debug2 from "debug";
34559
36134
  import { toString as matrixToString2 } from "transformation-matrix";
@@ -34585,8 +36160,6 @@ import {
34585
36160
  } from "transformation-matrix";
34586
36161
  import { lineAlphabet } from "@tscircuit/alphabet";
34587
36162
  import { lineAlphabet as lineAlphabet2 } from "@tscircuit/alphabet";
34588
- var import_svgson3 = __toESM(require_svgson_cjs(), 1);
34589
- var import_svgson4 = __toESM(require_svgson_cjs(), 1);
34590
36163
  import { applyToPoint as applyToPoint22 } from "transformation-matrix";
34591
36164
  import {
34592
36165
  applyToPoint as applyToPoint23,
@@ -34613,6 +36186,8 @@ import { distance as distance2 } from "circuit-json";
34613
36186
  import {
34614
36187
  distance as distance3
34615
36188
  } from "circuit-json";
36189
+ var import_svgson3 = __toESM(require_svgson_cjs(), 1);
36190
+ var import_svgson4 = __toESM(require_svgson_cjs(), 1);
34616
36191
  import { applyToPoint as applyToPoint32 } from "transformation-matrix";
34617
36192
  import { applyToPoint as applyToPoint34 } from "transformation-matrix";
34618
36193
  import { applyToPoint as applyToPoint36 } from "transformation-matrix";
@@ -34641,12 +36216,12 @@ import {
34641
36216
  translate as translate7
34642
36217
  } from "transformation-matrix";
34643
36218
  import { applyToPoint as applyToPoint43 } from "transformation-matrix";
34644
- var import_svgson5 = __toESM(require_svgson_cjs(), 1);
34645
- var import_svgson6 = __toESM(require_svgson_cjs(), 1);
34646
36219
  import { applyToPoint as applyToPoint44 } from "transformation-matrix";
34647
36220
  import { applyToPoint as applyToPoint45 } from "transformation-matrix";
34648
36221
  import { distance as distance5 } from "circuit-json";
34649
36222
  import { distance as distance6 } from "circuit-json";
36223
+ var import_svgson5 = __toESM(require_svgson_cjs(), 1);
36224
+ var import_svgson6 = __toESM(require_svgson_cjs(), 1);
34650
36225
  import { applyToPoint as applyToPoint46 } from "transformation-matrix";
34651
36226
  import { applyToPoint as applyToPoint47 } from "transformation-matrix";
34652
36227
  import { applyToPoint as applyToPoint48 } from "transformation-matrix";
@@ -34678,8 +36253,6 @@ import { applyToPoint as applyToPoint61 } from "transformation-matrix";
34678
36253
  import { applyToPoint as applyToPoint62 } from "transformation-matrix";
34679
36254
  import { calculateElbow } from "calculate-elbow";
34680
36255
  import { applyToPoint as applyToPoint63 } from "transformation-matrix";
34681
- var import_svgson7 = __toESM(require_svgson_cjs(), 1);
34682
- var import_svgson8 = __toESM(require_svgson_cjs(), 1);
34683
36256
  import { su as su6 } from "@tscircuit/circuit-json-util";
34684
36257
  import {
34685
36258
  applyToPoint as applyToPoint93,
@@ -34693,6 +36266,10 @@ import"schematic-symbols";
34693
36266
  import { compose as compose11, scale as scale5, translate as translate11 } from "transformation-matrix";
34694
36267
  import { symbols } from "schematic-symbols";
34695
36268
  import { applyToPoint as applyToPoint66 } from "transformation-matrix";
36269
+ var import_svgson7 = __toESM(require_svgson_cjs(), 1);
36270
+ var import_svgson8 = __toESM(require_svgson_cjs(), 1);
36271
+ var import_svgson9 = __toESM(require_svgson_cjs(), 1);
36272
+ var import_svgson10 = __toESM(require_svgson_cjs(), 1);
34696
36273
  import {
34697
36274
  applyToPoint as applyToPoint69,
34698
36275
  compose as compose13,
@@ -34739,13 +36316,11 @@ import { applyToPoint as applyToPoint86 } from "transformation-matrix";
34739
36316
  import { applyToPoint as applyToPoint87 } from "transformation-matrix";
34740
36317
  import { applyToPoint as applyToPoint88 } from "transformation-matrix";
34741
36318
  import { applyToPoint as applyToPoint89 } from "transformation-matrix";
34742
- var import_svgson9 = __toESM(require_svgson_cjs(), 1);
34743
- var import_svgson10 = __toESM(require_svgson_cjs(), 1);
34744
- var import_svgson11 = __toESM(require_svgson_cjs(), 1);
34745
36319
  import { applyToPoint as applyToPoint90 } from "transformation-matrix";
34746
36320
  import { applyToPoint as applyToPoint91 } from "transformation-matrix";
34747
36321
  import { applyToPoint as applyToPoint92 } from "transformation-matrix";
34748
36322
  import { applyToPoint as applyToPoint94, fromString } from "transformation-matrix";
36323
+ var import_svgson11 = __toESM(require_svgson_cjs(), 1);
34749
36324
  import { distance as distance8 } from "circuit-json";
34750
36325
  import {
34751
36326
  applyToPoint as applyToPoint95,
@@ -36130,25 +37705,38 @@ function createSvgObjectsFromPcbTraceClearanceError(error, circuitJson, ctx) {
36130
37705
  return annotateError2(svgObjects, error.type);
36131
37706
  }
36132
37707
  function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
36133
- const { transform, layer: layerFilter } = ctx;
36134
- if (!fabNotePath.route || !Array.isArray(fabNotePath.route))
37708
+ const { transform } = ctx;
37709
+ if (!Array.isArray(fabNotePath.route) || fabNotePath.route.length < 2)
36135
37710
  return [];
36136
37711
  const firstPoint = fabNotePath.route[0];
36137
37712
  const lastPoint = fabNotePath.route[fabNotePath.route.length - 1];
36138
- const isClosed = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
36139
- const path = fabNotePath.route.slice(0, isClosed ? -1 : undefined).map((point, index) => {
37713
+ const repeatsFirstPoint = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
37714
+ const path = fabNotePath.route.slice(0, repeatsFirstPoint ? -1 : undefined).map((point, index) => {
36140
37715
  const [x, y] = applyToPoint9(transform, [point.x, point.y]);
36141
37716
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
36142
- }).join(" ") + (isClosed ? " Z" : "");
37717
+ }).join(" ") + (repeatsFirstPoint || fabNotePath.is_filled ? " Z" : "");
37718
+ const color = fabNotePath.color || "rgba(255,255,255,0.5)";
37719
+ let paint = color;
37720
+ let opacity;
37721
+ if (fabNotePath.is_filled && fabNotePath.has_stroke !== false && fabNotePath.stroke_width > 0) {
37722
+ try {
37723
+ const parsedColor = color_default(color);
37724
+ if (parsedColor.alpha() < 1) {
37725
+ paint = parsedColor.alpha(1).rgb().string();
37726
+ opacity = parsedColor.alpha().toString();
37727
+ }
37728
+ } catch {}
37729
+ }
36143
37730
  return [
36144
37731
  {
36145
37732
  name: "path",
36146
37733
  type: "element",
36147
37734
  attributes: {
36148
37735
  class: "pcb-fabrication-note-path",
36149
- stroke: fabNotePath.color || "rgba(255,255,255,0.5)",
36150
- fill: "none",
37736
+ stroke: fabNotePath.has_stroke === false ? "none" : paint,
37737
+ fill: fabNotePath.is_filled ? paint : "none",
36151
37738
  d: path,
37739
+ ...opacity === undefined ? {} : { opacity },
36152
37740
  "stroke-width": (fabNotePath.stroke_width * Math.abs(transform.a)).toString(),
36153
37741
  "data-pcb-component-id": fabNotePath.pcb_component_id,
36154
37742
  "data-pcb-fabrication-note-path-id": fabNotePath.pcb_fabrication_note_path_id,
@@ -42709,7 +44297,7 @@ var package_default = {
42709
44297
  engines: {
42710
44298
  node: "24.x"
42711
44299
  },
42712
- version: "0.0.440",
44300
+ version: "0.0.443",
42713
44301
  repository: {
42714
44302
  type: "git",
42715
44303
  url: "https://github.com/tscircuit/circuit-to-svg.git"
@@ -42741,7 +44329,7 @@ var package_default = {
42741
44329
  "@vitejs/plugin-react": "5.0.0",
42742
44330
  biome: "^0.3.3",
42743
44331
  "bun-match-svg": "^0.0.12",
42744
- "circuit-json": "^0.0.513",
44332
+ "circuit-json": "^0.0.518",
42745
44333
  "circuit-json-to-connectivity-map": "^0.0.23",
42746
44334
  esbuild: "^0.20.2",
42747
44335
  "format-si-unit": "^0.0.12",
@@ -42767,6 +44355,7 @@ var package_default = {
42767
44355
  "@types/node": "^22.5.5",
42768
44356
  "bun-types": "^1.1.40",
42769
44357
  "calculate-elbow": "0.0.12",
44358
+ color: "^5.0.3",
42770
44359
  debug: "^4.4.3",
42771
44360
  "svg-path-commander": "^2.1.11",
42772
44361
  svgson: "^5.3.1",