@opendata-ai/openchart-core 8.2.0 → 8.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +136 -1423
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -317,355 +317,8 @@ var MARK_DISPLAY_NAMES = {
|
|
|
317
317
|
parliament: "Parliament chart"
|
|
318
318
|
};
|
|
319
319
|
|
|
320
|
-
// ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/define.js
|
|
321
|
-
function define_default(constructor, factory, prototype) {
|
|
322
|
-
constructor.prototype = factory.prototype = prototype;
|
|
323
|
-
prototype.constructor = constructor;
|
|
324
|
-
}
|
|
325
|
-
function extend(parent, definition) {
|
|
326
|
-
var prototype = Object.create(parent.prototype);
|
|
327
|
-
for (var key in definition) prototype[key] = definition[key];
|
|
328
|
-
return prototype;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/color.js
|
|
332
|
-
function Color() {
|
|
333
|
-
}
|
|
334
|
-
var darker = 0.7;
|
|
335
|
-
var brighter = 1 / darker;
|
|
336
|
-
var reI = "\\s*([+-]?\\d+)\\s*";
|
|
337
|
-
var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
|
|
338
|
-
var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
|
|
339
|
-
var reHex = /^#([0-9a-f]{3,8})$/;
|
|
340
|
-
var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
|
|
341
|
-
var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
|
|
342
|
-
var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
|
|
343
|
-
var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
|
|
344
|
-
var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
|
|
345
|
-
var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
346
|
-
var named = {
|
|
347
|
-
aliceblue: 15792383,
|
|
348
|
-
antiquewhite: 16444375,
|
|
349
|
-
aqua: 65535,
|
|
350
|
-
aquamarine: 8388564,
|
|
351
|
-
azure: 15794175,
|
|
352
|
-
beige: 16119260,
|
|
353
|
-
bisque: 16770244,
|
|
354
|
-
black: 0,
|
|
355
|
-
blanchedalmond: 16772045,
|
|
356
|
-
blue: 255,
|
|
357
|
-
blueviolet: 9055202,
|
|
358
|
-
brown: 10824234,
|
|
359
|
-
burlywood: 14596231,
|
|
360
|
-
cadetblue: 6266528,
|
|
361
|
-
chartreuse: 8388352,
|
|
362
|
-
chocolate: 13789470,
|
|
363
|
-
coral: 16744272,
|
|
364
|
-
cornflowerblue: 6591981,
|
|
365
|
-
cornsilk: 16775388,
|
|
366
|
-
crimson: 14423100,
|
|
367
|
-
cyan: 65535,
|
|
368
|
-
darkblue: 139,
|
|
369
|
-
darkcyan: 35723,
|
|
370
|
-
darkgoldenrod: 12092939,
|
|
371
|
-
darkgray: 11119017,
|
|
372
|
-
darkgreen: 25600,
|
|
373
|
-
darkgrey: 11119017,
|
|
374
|
-
darkkhaki: 12433259,
|
|
375
|
-
darkmagenta: 9109643,
|
|
376
|
-
darkolivegreen: 5597999,
|
|
377
|
-
darkorange: 16747520,
|
|
378
|
-
darkorchid: 10040012,
|
|
379
|
-
darkred: 9109504,
|
|
380
|
-
darksalmon: 15308410,
|
|
381
|
-
darkseagreen: 9419919,
|
|
382
|
-
darkslateblue: 4734347,
|
|
383
|
-
darkslategray: 3100495,
|
|
384
|
-
darkslategrey: 3100495,
|
|
385
|
-
darkturquoise: 52945,
|
|
386
|
-
darkviolet: 9699539,
|
|
387
|
-
deeppink: 16716947,
|
|
388
|
-
deepskyblue: 49151,
|
|
389
|
-
dimgray: 6908265,
|
|
390
|
-
dimgrey: 6908265,
|
|
391
|
-
dodgerblue: 2003199,
|
|
392
|
-
firebrick: 11674146,
|
|
393
|
-
floralwhite: 16775920,
|
|
394
|
-
forestgreen: 2263842,
|
|
395
|
-
fuchsia: 16711935,
|
|
396
|
-
gainsboro: 14474460,
|
|
397
|
-
ghostwhite: 16316671,
|
|
398
|
-
gold: 16766720,
|
|
399
|
-
goldenrod: 14329120,
|
|
400
|
-
gray: 8421504,
|
|
401
|
-
green: 32768,
|
|
402
|
-
greenyellow: 11403055,
|
|
403
|
-
grey: 8421504,
|
|
404
|
-
honeydew: 15794160,
|
|
405
|
-
hotpink: 16738740,
|
|
406
|
-
indianred: 13458524,
|
|
407
|
-
indigo: 4915330,
|
|
408
|
-
ivory: 16777200,
|
|
409
|
-
khaki: 15787660,
|
|
410
|
-
lavender: 15132410,
|
|
411
|
-
lavenderblush: 16773365,
|
|
412
|
-
lawngreen: 8190976,
|
|
413
|
-
lemonchiffon: 16775885,
|
|
414
|
-
lightblue: 11393254,
|
|
415
|
-
lightcoral: 15761536,
|
|
416
|
-
lightcyan: 14745599,
|
|
417
|
-
lightgoldenrodyellow: 16448210,
|
|
418
|
-
lightgray: 13882323,
|
|
419
|
-
lightgreen: 9498256,
|
|
420
|
-
lightgrey: 13882323,
|
|
421
|
-
lightpink: 16758465,
|
|
422
|
-
lightsalmon: 16752762,
|
|
423
|
-
lightseagreen: 2142890,
|
|
424
|
-
lightskyblue: 8900346,
|
|
425
|
-
lightslategray: 7833753,
|
|
426
|
-
lightslategrey: 7833753,
|
|
427
|
-
lightsteelblue: 11584734,
|
|
428
|
-
lightyellow: 16777184,
|
|
429
|
-
lime: 65280,
|
|
430
|
-
limegreen: 3329330,
|
|
431
|
-
linen: 16445670,
|
|
432
|
-
magenta: 16711935,
|
|
433
|
-
maroon: 8388608,
|
|
434
|
-
mediumaquamarine: 6737322,
|
|
435
|
-
mediumblue: 205,
|
|
436
|
-
mediumorchid: 12211667,
|
|
437
|
-
mediumpurple: 9662683,
|
|
438
|
-
mediumseagreen: 3978097,
|
|
439
|
-
mediumslateblue: 8087790,
|
|
440
|
-
mediumspringgreen: 64154,
|
|
441
|
-
mediumturquoise: 4772300,
|
|
442
|
-
mediumvioletred: 13047173,
|
|
443
|
-
midnightblue: 1644912,
|
|
444
|
-
mintcream: 16121850,
|
|
445
|
-
mistyrose: 16770273,
|
|
446
|
-
moccasin: 16770229,
|
|
447
|
-
navajowhite: 16768685,
|
|
448
|
-
navy: 128,
|
|
449
|
-
oldlace: 16643558,
|
|
450
|
-
olive: 8421376,
|
|
451
|
-
olivedrab: 7048739,
|
|
452
|
-
orange: 16753920,
|
|
453
|
-
orangered: 16729344,
|
|
454
|
-
orchid: 14315734,
|
|
455
|
-
palegoldenrod: 15657130,
|
|
456
|
-
palegreen: 10025880,
|
|
457
|
-
paleturquoise: 11529966,
|
|
458
|
-
palevioletred: 14381203,
|
|
459
|
-
papayawhip: 16773077,
|
|
460
|
-
peachpuff: 16767673,
|
|
461
|
-
peru: 13468991,
|
|
462
|
-
pink: 16761035,
|
|
463
|
-
plum: 14524637,
|
|
464
|
-
powderblue: 11591910,
|
|
465
|
-
purple: 8388736,
|
|
466
|
-
rebeccapurple: 6697881,
|
|
467
|
-
red: 16711680,
|
|
468
|
-
rosybrown: 12357519,
|
|
469
|
-
royalblue: 4286945,
|
|
470
|
-
saddlebrown: 9127187,
|
|
471
|
-
salmon: 16416882,
|
|
472
|
-
sandybrown: 16032864,
|
|
473
|
-
seagreen: 3050327,
|
|
474
|
-
seashell: 16774638,
|
|
475
|
-
sienna: 10506797,
|
|
476
|
-
silver: 12632256,
|
|
477
|
-
skyblue: 8900331,
|
|
478
|
-
slateblue: 6970061,
|
|
479
|
-
slategray: 7372944,
|
|
480
|
-
slategrey: 7372944,
|
|
481
|
-
snow: 16775930,
|
|
482
|
-
springgreen: 65407,
|
|
483
|
-
steelblue: 4620980,
|
|
484
|
-
tan: 13808780,
|
|
485
|
-
teal: 32896,
|
|
486
|
-
thistle: 14204888,
|
|
487
|
-
tomato: 16737095,
|
|
488
|
-
turquoise: 4251856,
|
|
489
|
-
violet: 15631086,
|
|
490
|
-
wheat: 16113331,
|
|
491
|
-
white: 16777215,
|
|
492
|
-
whitesmoke: 16119285,
|
|
493
|
-
yellow: 16776960,
|
|
494
|
-
yellowgreen: 10145074
|
|
495
|
-
};
|
|
496
|
-
define_default(Color, color, {
|
|
497
|
-
copy(channels) {
|
|
498
|
-
return Object.assign(new this.constructor(), this, channels);
|
|
499
|
-
},
|
|
500
|
-
displayable() {
|
|
501
|
-
return this.rgb().displayable();
|
|
502
|
-
},
|
|
503
|
-
hex: color_formatHex,
|
|
504
|
-
// Deprecated! Use color.formatHex.
|
|
505
|
-
formatHex: color_formatHex,
|
|
506
|
-
formatHex8: color_formatHex8,
|
|
507
|
-
formatHsl: color_formatHsl,
|
|
508
|
-
formatRgb: color_formatRgb,
|
|
509
|
-
toString: color_formatRgb
|
|
510
|
-
});
|
|
511
|
-
function color_formatHex() {
|
|
512
|
-
return this.rgb().formatHex();
|
|
513
|
-
}
|
|
514
|
-
function color_formatHex8() {
|
|
515
|
-
return this.rgb().formatHex8();
|
|
516
|
-
}
|
|
517
|
-
function color_formatHsl() {
|
|
518
|
-
return hslConvert(this).formatHsl();
|
|
519
|
-
}
|
|
520
|
-
function color_formatRgb() {
|
|
521
|
-
return this.rgb().formatRgb();
|
|
522
|
-
}
|
|
523
|
-
function color(format2) {
|
|
524
|
-
var m, l;
|
|
525
|
-
format2 = (format2 + "").trim().toLowerCase();
|
|
526
|
-
return (m = reHex.exec(format2)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format2)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format2)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format2)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format2)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
|
527
|
-
}
|
|
528
|
-
function rgbn(n) {
|
|
529
|
-
return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
|
|
530
|
-
}
|
|
531
|
-
function rgba(r, g, b, a) {
|
|
532
|
-
if (a <= 0) r = g = b = NaN;
|
|
533
|
-
return new Rgb(r, g, b, a);
|
|
534
|
-
}
|
|
535
|
-
function rgbConvert(o) {
|
|
536
|
-
if (!(o instanceof Color)) o = color(o);
|
|
537
|
-
if (!o) return new Rgb();
|
|
538
|
-
o = o.rgb();
|
|
539
|
-
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
540
|
-
}
|
|
541
|
-
function rgb(r, g, b, opacity) {
|
|
542
|
-
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
543
|
-
}
|
|
544
|
-
function Rgb(r, g, b, opacity) {
|
|
545
|
-
this.r = +r;
|
|
546
|
-
this.g = +g;
|
|
547
|
-
this.b = +b;
|
|
548
|
-
this.opacity = +opacity;
|
|
549
|
-
}
|
|
550
|
-
define_default(Rgb, rgb, extend(Color, {
|
|
551
|
-
brighter(k) {
|
|
552
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
553
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
554
|
-
},
|
|
555
|
-
darker(k) {
|
|
556
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
557
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
558
|
-
},
|
|
559
|
-
rgb() {
|
|
560
|
-
return this;
|
|
561
|
-
},
|
|
562
|
-
clamp() {
|
|
563
|
-
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
564
|
-
},
|
|
565
|
-
displayable() {
|
|
566
|
-
return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
|
|
567
|
-
},
|
|
568
|
-
hex: rgb_formatHex,
|
|
569
|
-
// Deprecated! Use color.formatHex.
|
|
570
|
-
formatHex: rgb_formatHex,
|
|
571
|
-
formatHex8: rgb_formatHex8,
|
|
572
|
-
formatRgb: rgb_formatRgb,
|
|
573
|
-
toString: rgb_formatRgb
|
|
574
|
-
}));
|
|
575
|
-
function rgb_formatHex() {
|
|
576
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
577
|
-
}
|
|
578
|
-
function rgb_formatHex8() {
|
|
579
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
580
|
-
}
|
|
581
|
-
function rgb_formatRgb() {
|
|
582
|
-
const a = clampa(this.opacity);
|
|
583
|
-
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
584
|
-
}
|
|
585
|
-
function clampa(opacity) {
|
|
586
|
-
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
587
|
-
}
|
|
588
|
-
function clampi(value) {
|
|
589
|
-
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
590
|
-
}
|
|
591
|
-
function hex(value) {
|
|
592
|
-
value = clampi(value);
|
|
593
|
-
return (value < 16 ? "0" : "") + value.toString(16);
|
|
594
|
-
}
|
|
595
|
-
function hsla(h, s, l, a) {
|
|
596
|
-
if (a <= 0) h = s = l = NaN;
|
|
597
|
-
else if (l <= 0 || l >= 1) h = s = NaN;
|
|
598
|
-
else if (s <= 0) h = NaN;
|
|
599
|
-
return new Hsl(h, s, l, a);
|
|
600
|
-
}
|
|
601
|
-
function hslConvert(o) {
|
|
602
|
-
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
603
|
-
if (!(o instanceof Color)) o = color(o);
|
|
604
|
-
if (!o) return new Hsl();
|
|
605
|
-
if (o instanceof Hsl) return o;
|
|
606
|
-
o = o.rgb();
|
|
607
|
-
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
|
|
608
|
-
if (s) {
|
|
609
|
-
if (r === max) h = (g - b) / s + (g < b) * 6;
|
|
610
|
-
else if (g === max) h = (b - r) / s + 2;
|
|
611
|
-
else h = (r - g) / s + 4;
|
|
612
|
-
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
613
|
-
h *= 60;
|
|
614
|
-
} else {
|
|
615
|
-
s = l > 0 && l < 1 ? 0 : h;
|
|
616
|
-
}
|
|
617
|
-
return new Hsl(h, s, l, o.opacity);
|
|
618
|
-
}
|
|
619
|
-
function hsl(h, s, l, opacity) {
|
|
620
|
-
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
621
|
-
}
|
|
622
|
-
function Hsl(h, s, l, opacity) {
|
|
623
|
-
this.h = +h;
|
|
624
|
-
this.s = +s;
|
|
625
|
-
this.l = +l;
|
|
626
|
-
this.opacity = +opacity;
|
|
627
|
-
}
|
|
628
|
-
define_default(Hsl, hsl, extend(Color, {
|
|
629
|
-
brighter(k) {
|
|
630
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
631
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
632
|
-
},
|
|
633
|
-
darker(k) {
|
|
634
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
635
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
636
|
-
},
|
|
637
|
-
rgb() {
|
|
638
|
-
var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
|
|
639
|
-
return new Rgb(
|
|
640
|
-
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
641
|
-
hsl2rgb(h, m1, m2),
|
|
642
|
-
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
643
|
-
this.opacity
|
|
644
|
-
);
|
|
645
|
-
},
|
|
646
|
-
clamp() {
|
|
647
|
-
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
648
|
-
},
|
|
649
|
-
displayable() {
|
|
650
|
-
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
|
|
651
|
-
},
|
|
652
|
-
formatHsl() {
|
|
653
|
-
const a = clampa(this.opacity);
|
|
654
|
-
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
655
|
-
}
|
|
656
|
-
}));
|
|
657
|
-
function clamph(value) {
|
|
658
|
-
value = (value || 0) % 360;
|
|
659
|
-
return value < 0 ? value + 360 : value;
|
|
660
|
-
}
|
|
661
|
-
function clampt(value) {
|
|
662
|
-
return Math.max(0, Math.min(1, value || 0));
|
|
663
|
-
}
|
|
664
|
-
function hsl2rgb(h, m1, m2) {
|
|
665
|
-
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
320
|
// src/colors/colorblind.ts
|
|
321
|
+
import { rgb } from "d3-color";
|
|
669
322
|
var PROTAN_MATRIX = [
|
|
670
323
|
[0.567, 0.433, 0],
|
|
671
324
|
[0.558, 0.442, 0],
|
|
@@ -700,9 +353,9 @@ function delinearize(v) {
|
|
|
700
353
|
const s = v <= 31308e-7 ? v * 12.92 : 1.055 * v ** (1 / 2.4) - 0.055;
|
|
701
354
|
return Math.round(Math.max(0, Math.min(255, s * 255)));
|
|
702
355
|
}
|
|
703
|
-
function simulateColorBlindness(
|
|
704
|
-
const c = rgb(
|
|
705
|
-
if (c == null) return
|
|
356
|
+
function simulateColorBlindness(color, type) {
|
|
357
|
+
const c = rgb(color);
|
|
358
|
+
if (c == null) return color;
|
|
706
359
|
const lin = [linearize(c.r), linearize(c.g), linearize(c.b)];
|
|
707
360
|
const m = MATRICES[type];
|
|
708
361
|
const r = m[0][0] * lin[0] + m[0][1] * lin[1] + m[0][2] * lin[2];
|
|
@@ -728,23 +381,24 @@ function checkPaletteDistinguishability(colors, type, minDistance = 30) {
|
|
|
728
381
|
}
|
|
729
382
|
|
|
730
383
|
// src/colors/contrast.ts
|
|
731
|
-
|
|
732
|
-
|
|
384
|
+
import { rgb as rgb2 } from "d3-color";
|
|
385
|
+
function relativeLuminance(color) {
|
|
386
|
+
const c = rgb2(color);
|
|
733
387
|
if (c == null) return 0;
|
|
734
388
|
const srgb = [c.r / 255, c.g / 255, c.b / 255];
|
|
735
389
|
const linear = srgb.map((v) => v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);
|
|
736
390
|
return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2];
|
|
737
391
|
}
|
|
738
|
-
function isOpaqueColor(
|
|
739
|
-
const c =
|
|
392
|
+
function isOpaqueColor(color) {
|
|
393
|
+
const c = rgb2(color);
|
|
740
394
|
return c != null && !Number.isNaN(c.r) && c.opacity === 1;
|
|
741
395
|
}
|
|
742
396
|
function contrastRatio(fg, bg) {
|
|
743
397
|
const l1 = relativeLuminance(fg);
|
|
744
398
|
const l2 = relativeLuminance(bg);
|
|
745
399
|
const lighter = Math.max(l1, l2);
|
|
746
|
-
const
|
|
747
|
-
return (lighter + 0.05) / (
|
|
400
|
+
const darker = Math.min(l1, l2);
|
|
401
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
748
402
|
}
|
|
749
403
|
function pickLabelColor(bg, darkMode = false) {
|
|
750
404
|
const WHITE = "#ffffff";
|
|
@@ -760,7 +414,7 @@ function findAccessibleColor(baseColor, bg, targetRatio = 4.5) {
|
|
|
760
414
|
if (contrastRatio(baseColor, bg) >= targetRatio) {
|
|
761
415
|
return baseColor;
|
|
762
416
|
}
|
|
763
|
-
const c =
|
|
417
|
+
const c = rgb2(baseColor);
|
|
764
418
|
if (c == null) return baseColor;
|
|
765
419
|
const bgLum = relativeLuminance(bg);
|
|
766
420
|
const baseLum = relativeLuminance(baseColor);
|
|
@@ -774,11 +428,11 @@ function findAccessibleColor(baseColor, bg, targetRatio = 4.5) {
|
|
|
774
428
|
let best = null;
|
|
775
429
|
for (let i = 0; i < 20; i++) {
|
|
776
430
|
const mid = (lo + hi) / 2;
|
|
777
|
-
const adjusted = darken ?
|
|
778
|
-
const
|
|
779
|
-
const ratio = contrastRatio(
|
|
431
|
+
const adjusted = darken ? rgb2(c.r * (1 - mid), c.g * (1 - mid), c.b * (1 - mid)) : rgb2(c.r + (255 - c.r) * mid, c.g + (255 - c.g) * mid, c.b + (255 - c.b) * mid);
|
|
432
|
+
const hex = adjusted.formatHex();
|
|
433
|
+
const ratio = contrastRatio(hex, bg);
|
|
780
434
|
if (ratio >= targetRatio) {
|
|
781
|
-
best =
|
|
435
|
+
best = hex;
|
|
782
436
|
hi = mid;
|
|
783
437
|
} else {
|
|
784
438
|
lo = mid;
|
|
@@ -922,6 +576,9 @@ var SUPPORTED_SCHEME_NAMES = [
|
|
|
922
576
|
...Object.keys(VL_SCHEME_ALIASES)
|
|
923
577
|
];
|
|
924
578
|
|
|
579
|
+
// src/theme/dark-mode.ts
|
|
580
|
+
import { hsl, rgb as rgb3 } from "d3-color";
|
|
581
|
+
|
|
925
582
|
// src/layout/text-measure.ts
|
|
926
583
|
var CHAR_WIDTHS_400 = {
|
|
927
584
|
" ": 0.278,
|
|
@@ -1175,19 +832,28 @@ var WEIGHT_ADJUSTMENT = {
|
|
|
1175
832
|
800: 1.1,
|
|
1176
833
|
900: 1.12
|
|
1177
834
|
};
|
|
835
|
+
var RESOLVED_TABLE_400_DEFAULT = {
|
|
836
|
+
table: CHAR_WIDTHS_400,
|
|
837
|
+
avg: AVG_CHAR_WIDTH_400,
|
|
838
|
+
scale: 1
|
|
839
|
+
};
|
|
840
|
+
var RESOLVED_TABLE_700_DEFAULT = {
|
|
841
|
+
table: CHAR_WIDTHS_700,
|
|
842
|
+
avg: AVG_CHAR_WIDTH_700,
|
|
843
|
+
scale: 1
|
|
844
|
+
};
|
|
845
|
+
var RESOLVED_TABLE_CACHE = /* @__PURE__ */ new Map();
|
|
846
|
+
for (const [weightStr, scale] of Object.entries(WEIGHT_ADJUSTMENT)) {
|
|
847
|
+
const weight = Number(weightStr);
|
|
848
|
+
RESOLVED_TABLE_CACHE.set(
|
|
849
|
+
weight,
|
|
850
|
+
weight >= 650 ? { table: CHAR_WIDTHS_700, avg: AVG_CHAR_WIDTH_700, scale } : { table: CHAR_WIDTHS_400, avg: AVG_CHAR_WIDTH_400, scale }
|
|
851
|
+
);
|
|
852
|
+
}
|
|
1178
853
|
function resolveTable(fontWeight) {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
avg: AVG_CHAR_WIDTH_700,
|
|
1183
|
-
scale: WEIGHT_ADJUSTMENT[fontWeight] ?? 1
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
return {
|
|
1187
|
-
table: CHAR_WIDTHS_400,
|
|
1188
|
-
avg: AVG_CHAR_WIDTH_400,
|
|
1189
|
-
scale: WEIGHT_ADJUSTMENT[fontWeight] ?? 1
|
|
1190
|
-
};
|
|
854
|
+
const cached = RESOLVED_TABLE_CACHE.get(fontWeight);
|
|
855
|
+
if (cached) return cached;
|
|
856
|
+
return fontWeight >= 650 ? RESOLVED_TABLE_700_DEFAULT : RESOLVED_TABLE_400_DEFAULT;
|
|
1191
857
|
}
|
|
1192
858
|
function charWidthRatio(ch, table, avg) {
|
|
1193
859
|
const direct = table[ch];
|
|
@@ -1202,24 +868,24 @@ function estimateCharWidth(fontSize, fontWeight = 400) {
|
|
|
1202
868
|
const { avg, scale } = resolveTable(fontWeight);
|
|
1203
869
|
return fontSize * avg * scale;
|
|
1204
870
|
}
|
|
871
|
+
function measureLine(line, table, avg, scale, fontSize) {
|
|
872
|
+
let sum = 0;
|
|
873
|
+
for (const ch of line) {
|
|
874
|
+
sum += charWidthRatio(ch, table, avg);
|
|
875
|
+
}
|
|
876
|
+
return sum * fontSize * scale;
|
|
877
|
+
}
|
|
1205
878
|
function estimateTextWidth(text, fontSize, fontWeight = 400) {
|
|
1206
879
|
const { table, avg, scale } = resolveTable(fontWeight);
|
|
1207
|
-
const measureLine = (line) => {
|
|
1208
|
-
let sum = 0;
|
|
1209
|
-
for (const ch of line) {
|
|
1210
|
-
sum += charWidthRatio(ch, table, avg);
|
|
1211
|
-
}
|
|
1212
|
-
return sum * fontSize * scale;
|
|
1213
|
-
};
|
|
1214
880
|
if (text.includes("\n")) {
|
|
1215
881
|
let maxWidth = 0;
|
|
1216
882
|
for (const line of text.split("\n")) {
|
|
1217
|
-
const w = measureLine(line);
|
|
883
|
+
const w = measureLine(line, table, avg, scale, fontSize);
|
|
1218
884
|
if (w > maxWidth) maxWidth = w;
|
|
1219
885
|
}
|
|
1220
886
|
return maxWidth;
|
|
1221
887
|
}
|
|
1222
|
-
return measureLine(text);
|
|
888
|
+
return measureLine(text, table, avg, scale, fontSize);
|
|
1223
889
|
}
|
|
1224
890
|
var BRAND_RESERVE_WIDTH = 130;
|
|
1225
891
|
var BRAND_FONT_SIZE = 12;
|
|
@@ -1489,41 +1155,41 @@ var DEFAULT_THEME = {
|
|
|
1489
1155
|
// src/theme/dark-mode.ts
|
|
1490
1156
|
var DARK_BG = ACHROMATIC_RAMP.bg;
|
|
1491
1157
|
var DARK_TEXT = ACHROMATIC_RAMP.fg;
|
|
1492
|
-
function adaptColorForDarkMode(
|
|
1493
|
-
if (
|
|
1158
|
+
function adaptColorForDarkMode(color, lightBg, darkBg) {
|
|
1159
|
+
if (rgb3(color) == null) {
|
|
1494
1160
|
if (typeof console !== "undefined" && console.warn) {
|
|
1495
1161
|
console.warn(
|
|
1496
|
-
`[openchart] adaptColorForDarkMode: unparseable color "${
|
|
1162
|
+
`[openchart] adaptColorForDarkMode: unparseable color "${color}", returning unchanged. Use precomputed sRGB hex.`
|
|
1497
1163
|
);
|
|
1498
1164
|
}
|
|
1499
|
-
return
|
|
1165
|
+
return color;
|
|
1500
1166
|
}
|
|
1501
|
-
const originalRatio = contrastRatio(
|
|
1502
|
-
const c = hsl(
|
|
1167
|
+
const originalRatio = contrastRatio(color, lightBg);
|
|
1168
|
+
const c = hsl(color);
|
|
1503
1169
|
if (c == null || Number.isNaN(c.h)) {
|
|
1504
|
-
const r =
|
|
1505
|
-
if (r == null) return
|
|
1170
|
+
const r = rgb3(color);
|
|
1171
|
+
if (r == null) return color;
|
|
1506
1172
|
const darkBgLum = _luminanceFromHex(darkBg);
|
|
1507
1173
|
const isLight = darkBgLum < 0.5;
|
|
1508
|
-
if (isLight) return
|
|
1509
|
-
const inverted = hsl(
|
|
1510
|
-
if (inverted == null) return
|
|
1174
|
+
if (isLight) return color;
|
|
1175
|
+
const inverted = hsl(color);
|
|
1176
|
+
if (inverted == null) return color;
|
|
1511
1177
|
inverted.l = 1 - inverted.l;
|
|
1512
1178
|
return inverted.formatHex();
|
|
1513
1179
|
}
|
|
1514
1180
|
let lo = 0;
|
|
1515
1181
|
let hi = 1;
|
|
1516
|
-
let bestColor =
|
|
1182
|
+
let bestColor = color;
|
|
1517
1183
|
let bestDiff = Infinity;
|
|
1518
1184
|
for (let i = 0; i < 20; i++) {
|
|
1519
1185
|
const mid = (lo + hi) / 2;
|
|
1520
1186
|
const candidate = hsl(c.h, c.s, mid);
|
|
1521
|
-
const
|
|
1522
|
-
const ratio = contrastRatio(
|
|
1187
|
+
const hex = candidate.formatHex();
|
|
1188
|
+
const ratio = contrastRatio(hex, darkBg);
|
|
1523
1189
|
const diff = Math.abs(ratio - originalRatio);
|
|
1524
1190
|
if (diff < bestDiff) {
|
|
1525
1191
|
bestDiff = diff;
|
|
1526
|
-
bestColor =
|
|
1192
|
+
bestColor = hex;
|
|
1527
1193
|
}
|
|
1528
1194
|
if (ratio < originalRatio) {
|
|
1529
1195
|
lo = mid;
|
|
@@ -1533,8 +1199,8 @@ function adaptColorForDarkMode(color2, lightBg, darkBg) {
|
|
|
1533
1199
|
}
|
|
1534
1200
|
return bestColor;
|
|
1535
1201
|
}
|
|
1536
|
-
function _luminanceFromHex(
|
|
1537
|
-
const c =
|
|
1202
|
+
function _luminanceFromHex(color) {
|
|
1203
|
+
const c = rgb3(color);
|
|
1538
1204
|
if (c == null) return 0;
|
|
1539
1205
|
return (0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b) / 255;
|
|
1540
1206
|
}
|
|
@@ -1598,12 +1264,12 @@ function adaptTheme(theme) {
|
|
|
1598
1264
|
}
|
|
1599
1265
|
};
|
|
1600
1266
|
}
|
|
1601
|
-
function adaptForLightLineStroke(
|
|
1602
|
-
if (
|
|
1603
|
-
const c = hsl(
|
|
1604
|
-
if (c == null) return
|
|
1605
|
-
if (Number.isNaN(c.h) || c.s < 0.1) return
|
|
1606
|
-
if (c.l <= 0.4) return
|
|
1267
|
+
function adaptForLightLineStroke(color) {
|
|
1268
|
+
if (rgb3(color) == null) return color;
|
|
1269
|
+
const c = hsl(color);
|
|
1270
|
+
if (c == null) return color;
|
|
1271
|
+
if (Number.isNaN(c.h) || c.s < 0.1) return color;
|
|
1272
|
+
if (c.l <= 0.4) return color;
|
|
1607
1273
|
c.l = Math.max(0, c.l - 0.12);
|
|
1608
1274
|
return c.formatHex();
|
|
1609
1275
|
}
|
|
@@ -1776,8 +1442,8 @@ function collectTokenPairs(config) {
|
|
|
1776
1442
|
}
|
|
1777
1443
|
return Object.keys(pairs).length > 0 ? pairs : void 0;
|
|
1778
1444
|
}
|
|
1779
|
-
function relativeLuminance2(
|
|
1780
|
-
const m = /^#?([0-9a-f]{6})$/i.exec(
|
|
1445
|
+
function relativeLuminance2(hex) {
|
|
1446
|
+
const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
|
|
1781
1447
|
if (!m) return 0;
|
|
1782
1448
|
const r = parseInt(m[1].slice(0, 2), 16) / 255;
|
|
1783
1449
|
const g = parseInt(m[1].slice(2, 4), 16) / 255;
|
|
@@ -1785,9 +1451,9 @@ function relativeLuminance2(hex2) {
|
|
|
1785
1451
|
const toLinear = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
1786
1452
|
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
1787
1453
|
}
|
|
1788
|
-
function isDarkBackground(
|
|
1789
|
-
if (!isOpaqueColor(
|
|
1790
|
-
return relativeLuminance2(
|
|
1454
|
+
function isDarkBackground(hex) {
|
|
1455
|
+
if (!isOpaqueColor(hex)) return false;
|
|
1456
|
+
return relativeLuminance2(hex) < 0.2;
|
|
1791
1457
|
}
|
|
1792
1458
|
function adaptChromeForDarkBg(theme, textColor) {
|
|
1793
1459
|
const light = DEFAULT_THEME.chrome;
|
|
@@ -1819,9 +1485,9 @@ function adaptChromeForDarkBg(theme, textColor) {
|
|
|
1819
1485
|
}
|
|
1820
1486
|
};
|
|
1821
1487
|
}
|
|
1822
|
-
function adjustOpacity(
|
|
1823
|
-
const m = /^#?([0-9a-f]{6})$/i.exec(
|
|
1824
|
-
if (!m) return
|
|
1488
|
+
function adjustOpacity(hex, opacity) {
|
|
1489
|
+
const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
|
|
1490
|
+
if (!m) return hex;
|
|
1825
1491
|
const r = parseInt(m[1].slice(0, 2), 16);
|
|
1826
1492
|
const g = parseInt(m[1].slice(2, 4), 16);
|
|
1827
1493
|
const b = parseInt(m[1].slice(4, 6), 16);
|
|
@@ -1952,12 +1618,12 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1952
1618
|
}
|
|
1953
1619
|
return { topHeight: 0, bottomHeight: 0 };
|
|
1954
1620
|
}
|
|
1955
|
-
const
|
|
1621
|
+
const pad = padding ?? theme.spacing.padding;
|
|
1956
1622
|
const chromeGap = theme.spacing.chromeGap;
|
|
1957
1623
|
const WRAP_SAFETY_BUFFER = 5;
|
|
1958
|
-
const maxWidth = width -
|
|
1624
|
+
const maxWidth = width - pad * 2 - WRAP_SAFETY_BUFFER;
|
|
1959
1625
|
const fontFamily = theme.fonts.family;
|
|
1960
|
-
let topY =
|
|
1626
|
+
let topY = pad;
|
|
1961
1627
|
const topElements = {};
|
|
1962
1628
|
const eyebrowNorm = chromeMode === "compact" ? null : normalizeChromeText(chrome.eyebrow);
|
|
1963
1629
|
if (eyebrowNorm) {
|
|
@@ -1972,7 +1638,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1972
1638
|
const lineCount = estimateLineCount(eyebrowNorm.text, style, maxWidth, measureText, maxLines);
|
|
1973
1639
|
const element = {
|
|
1974
1640
|
text: eyebrowNorm.text,
|
|
1975
|
-
x:
|
|
1641
|
+
x: pad + (eyebrowNorm.offset?.dx ?? 0),
|
|
1976
1642
|
y: topY + (eyebrowNorm.offset?.dy ?? 0),
|
|
1977
1643
|
maxWidth,
|
|
1978
1644
|
...maxLines != null ? { maxLines } : {},
|
|
@@ -1994,7 +1660,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1994
1660
|
const lineCount = estimateLineCount(titleNorm.text, style, maxWidth, measureText, maxLines);
|
|
1995
1661
|
const element = {
|
|
1996
1662
|
text: titleNorm.text,
|
|
1997
|
-
x:
|
|
1663
|
+
x: pad + (titleNorm.offset?.dx ?? 0),
|
|
1998
1664
|
y: topY + (titleNorm.offset?.dy ?? 0),
|
|
1999
1665
|
maxWidth,
|
|
2000
1666
|
...maxLines != null ? { maxLines } : {},
|
|
@@ -2016,7 +1682,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2016
1682
|
const lineCount = estimateLineCount(subtitleNorm.text, style, maxWidth, measureText, maxLines);
|
|
2017
1683
|
const element = {
|
|
2018
1684
|
text: subtitleNorm.text,
|
|
2019
|
-
x:
|
|
1685
|
+
x: pad + (subtitleNorm.offset?.dx ?? 0),
|
|
2020
1686
|
y: topY + (subtitleNorm.offset?.dy ?? 0),
|
|
2021
1687
|
maxWidth,
|
|
2022
1688
|
...maxLines != null ? { maxLines } : {},
|
|
@@ -2027,12 +1693,12 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2027
1693
|
}
|
|
2028
1694
|
const hasTopChrome = eyebrowNorm || titleNorm || subtitleNorm;
|
|
2029
1695
|
const chromeToChart = width < COMPACT_WIDTH ? Math.min(theme.spacing.chromeToChart, 2) : theme.spacing.chromeToChart;
|
|
2030
|
-
const topHeight = hasTopChrome ? topY -
|
|
1696
|
+
const topHeight = hasTopChrome ? topY - pad + chromeToChart - chromeGap : 0;
|
|
2031
1697
|
if (chromeMode === "compact") {
|
|
2032
1698
|
let compactBottom = 0;
|
|
2033
1699
|
if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
2034
1700
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
2035
|
-
compactBottom = theme.spacing.chartToFooter + brandHeight +
|
|
1701
|
+
compactBottom = theme.spacing.chartToFooter + brandHeight + pad + bottomLegendHeight;
|
|
2036
1702
|
} else if (bottomLegendHeight > 0) {
|
|
2037
1703
|
compactBottom = bottomLegendHeight;
|
|
2038
1704
|
}
|
|
@@ -2095,7 +1761,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2095
1761
|
const height = estimateTextHeight(style.fontSize, lineCount, style.lineHeight);
|
|
2096
1762
|
bottomElements[item.key] = {
|
|
2097
1763
|
text: item.norm.text,
|
|
2098
|
-
x:
|
|
1764
|
+
x: pad + (item.norm.offset?.dx ?? 0),
|
|
2099
1765
|
y: bottomHeight + (item.norm.offset?.dy ?? 0),
|
|
2100
1766
|
// offset from where bottom chrome starts
|
|
2101
1767
|
maxWidth: bottomMaxWidth,
|
|
@@ -2112,10 +1778,10 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2112
1778
|
bottomHeight += brandHeight - contentBelowFirstItem;
|
|
2113
1779
|
}
|
|
2114
1780
|
}
|
|
2115
|
-
bottomHeight +=
|
|
1781
|
+
bottomHeight += pad;
|
|
2116
1782
|
} else if (showWatermark && width >= BRAND_MIN_WIDTH) {
|
|
2117
1783
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
2118
|
-
bottomHeight = theme.spacing.chartToFooter + brandHeight +
|
|
1784
|
+
bottomHeight = theme.spacing.chartToFooter + brandHeight + pad + bottomLegendHeight;
|
|
2119
1785
|
} else if (bottomLegendHeight > 0) {
|
|
2120
1786
|
bottomHeight = bottomLegendHeight;
|
|
2121
1787
|
}
|
|
@@ -2132,14 +1798,14 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
2132
1798
|
const brandY = bottomItems.length > 0 ? theme.spacing.chartToFooter : theme.spacing.chartToFooter;
|
|
2133
1799
|
brandElement = {
|
|
2134
1800
|
text: brandNorm.text,
|
|
2135
|
-
x: width -
|
|
1801
|
+
x: width - pad + (brandNorm.offset?.dx ?? 0),
|
|
2136
1802
|
y: brandY + (brandNorm.offset?.dy ?? 0),
|
|
2137
1803
|
maxWidth: BRAND_RESERVE_WIDTH,
|
|
2138
1804
|
style: brandStyle
|
|
2139
1805
|
};
|
|
2140
1806
|
if (bottomItems.length === 0) {
|
|
2141
1807
|
const brandHeight = estimateTextHeight(brandStyle.fontSize, 1, brandStyle.lineHeight);
|
|
2142
|
-
bottomHeight = theme.spacing.chartToFooter + brandHeight +
|
|
1808
|
+
bottomHeight = theme.spacing.chartToFooter + brandHeight + pad;
|
|
2143
1809
|
}
|
|
2144
1810
|
}
|
|
2145
1811
|
return {
|
|
@@ -2330,998 +1996,27 @@ function computeLabelBounds(label) {
|
|
|
2330
1996
|
return { x, y, width, height };
|
|
2331
1997
|
}
|
|
2332
1998
|
|
|
2333
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatDecimal.js
|
|
2334
|
-
function formatDecimal_default(x) {
|
|
2335
|
-
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
|
|
2336
|
-
}
|
|
2337
|
-
function formatDecimalParts(x, p) {
|
|
2338
|
-
if (!isFinite(x) || x === 0) return null;
|
|
2339
|
-
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
|
2340
|
-
return [
|
|
2341
|
-
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
2342
|
-
+x.slice(i + 1)
|
|
2343
|
-
];
|
|
2344
|
-
}
|
|
2345
|
-
|
|
2346
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/exponent.js
|
|
2347
|
-
function exponent_default(x) {
|
|
2348
|
-
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatGroup.js
|
|
2352
|
-
function formatGroup_default(grouping, thousands) {
|
|
2353
|
-
return function(value, width) {
|
|
2354
|
-
var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
|
|
2355
|
-
while (i > 0 && g > 0) {
|
|
2356
|
-
if (length + g + 1 > width) g = Math.max(1, width - length);
|
|
2357
|
-
t.push(value.substring(i -= g, i + g));
|
|
2358
|
-
if ((length += g + 1) > width) break;
|
|
2359
|
-
g = grouping[j = (j + 1) % grouping.length];
|
|
2360
|
-
}
|
|
2361
|
-
return t.reverse().join(thousands);
|
|
2362
|
-
};
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatNumerals.js
|
|
2366
|
-
function formatNumerals_default(numerals) {
|
|
2367
|
-
return function(value) {
|
|
2368
|
-
return value.replace(/[0-9]/g, function(i) {
|
|
2369
|
-
return numerals[+i];
|
|
2370
|
-
});
|
|
2371
|
-
};
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatSpecifier.js
|
|
2375
|
-
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
2376
|
-
function formatSpecifier(specifier) {
|
|
2377
|
-
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
|
2378
|
-
var match;
|
|
2379
|
-
return new FormatSpecifier({
|
|
2380
|
-
fill: match[1],
|
|
2381
|
-
align: match[2],
|
|
2382
|
-
sign: match[3],
|
|
2383
|
-
symbol: match[4],
|
|
2384
|
-
zero: match[5],
|
|
2385
|
-
width: match[6],
|
|
2386
|
-
comma: match[7],
|
|
2387
|
-
precision: match[8] && match[8].slice(1),
|
|
2388
|
-
trim: match[9],
|
|
2389
|
-
type: match[10]
|
|
2390
|
-
});
|
|
2391
|
-
}
|
|
2392
|
-
formatSpecifier.prototype = FormatSpecifier.prototype;
|
|
2393
|
-
function FormatSpecifier(specifier) {
|
|
2394
|
-
this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
|
|
2395
|
-
this.align = specifier.align === void 0 ? ">" : specifier.align + "";
|
|
2396
|
-
this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
|
|
2397
|
-
this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
|
|
2398
|
-
this.zero = !!specifier.zero;
|
|
2399
|
-
this.width = specifier.width === void 0 ? void 0 : +specifier.width;
|
|
2400
|
-
this.comma = !!specifier.comma;
|
|
2401
|
-
this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
|
|
2402
|
-
this.trim = !!specifier.trim;
|
|
2403
|
-
this.type = specifier.type === void 0 ? "" : specifier.type + "";
|
|
2404
|
-
}
|
|
2405
|
-
FormatSpecifier.prototype.toString = function() {
|
|
2406
|
-
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
2407
|
-
};
|
|
2408
|
-
|
|
2409
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatTrim.js
|
|
2410
|
-
function formatTrim_default(s) {
|
|
2411
|
-
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
|
2412
|
-
switch (s[i]) {
|
|
2413
|
-
case ".":
|
|
2414
|
-
i0 = i1 = i;
|
|
2415
|
-
break;
|
|
2416
|
-
case "0":
|
|
2417
|
-
if (i0 === 0) i0 = i;
|
|
2418
|
-
i1 = i;
|
|
2419
|
-
break;
|
|
2420
|
-
default:
|
|
2421
|
-
if (!+s[i]) break out;
|
|
2422
|
-
if (i0 > 0) i0 = 0;
|
|
2423
|
-
break;
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2429
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatPrefixAuto.js
|
|
2430
|
-
var prefixExponent;
|
|
2431
|
-
function formatPrefixAuto_default(x, p) {
|
|
2432
|
-
var d = formatDecimalParts(x, p);
|
|
2433
|
-
if (!d) return prefixExponent = void 0, x.toPrecision(p);
|
|
2434
|
-
var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
|
|
2435
|
-
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatRounded.js
|
|
2439
|
-
function formatRounded_default(x, p) {
|
|
2440
|
-
var d = formatDecimalParts(x, p);
|
|
2441
|
-
if (!d) return x + "";
|
|
2442
|
-
var coefficient = d[0], exponent = d[1];
|
|
2443
|
-
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatTypes.js
|
|
2447
|
-
var formatTypes_default = {
|
|
2448
|
-
"%": (x, p) => (x * 100).toFixed(p),
|
|
2449
|
-
"b": (x) => Math.round(x).toString(2),
|
|
2450
|
-
"c": (x) => x + "",
|
|
2451
|
-
"d": formatDecimal_default,
|
|
2452
|
-
"e": (x, p) => x.toExponential(p),
|
|
2453
|
-
"f": (x, p) => x.toFixed(p),
|
|
2454
|
-
"g": (x, p) => x.toPrecision(p),
|
|
2455
|
-
"o": (x) => Math.round(x).toString(8),
|
|
2456
|
-
"p": (x, p) => formatRounded_default(x * 100, p),
|
|
2457
|
-
"r": formatRounded_default,
|
|
2458
|
-
"s": formatPrefixAuto_default,
|
|
2459
|
-
"X": (x) => Math.round(x).toString(16).toUpperCase(),
|
|
2460
|
-
"x": (x) => Math.round(x).toString(16)
|
|
2461
|
-
};
|
|
2462
|
-
|
|
2463
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/identity.js
|
|
2464
|
-
function identity_default(x) {
|
|
2465
|
-
return x;
|
|
2466
|
-
}
|
|
2467
|
-
|
|
2468
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/locale.js
|
|
2469
|
-
var map = Array.prototype.map;
|
|
2470
|
-
var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
2471
|
-
function locale_default(locale3) {
|
|
2472
|
-
var group = locale3.grouping === void 0 || locale3.thousands === void 0 ? identity_default : formatGroup_default(map.call(locale3.grouping, Number), locale3.thousands + ""), currencyPrefix = locale3.currency === void 0 ? "" : locale3.currency[0] + "", currencySuffix = locale3.currency === void 0 ? "" : locale3.currency[1] + "", decimal = locale3.decimal === void 0 ? "." : locale3.decimal + "", numerals = locale3.numerals === void 0 ? identity_default : formatNumerals_default(map.call(locale3.numerals, String)), percent = locale3.percent === void 0 ? "%" : locale3.percent + "", minus = locale3.minus === void 0 ? "\u2212" : locale3.minus + "", nan = locale3.nan === void 0 ? "NaN" : locale3.nan + "";
|
|
2473
|
-
function newFormat(specifier, options) {
|
|
2474
|
-
specifier = formatSpecifier(specifier);
|
|
2475
|
-
var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
|
|
2476
|
-
if (type === "n") comma = true, type = "g";
|
|
2477
|
-
else if (!formatTypes_default[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
|
|
2478
|
-
if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
|
|
2479
|
-
var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : "");
|
|
2480
|
-
var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type);
|
|
2481
|
-
precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
|
|
2482
|
-
function format2(value) {
|
|
2483
|
-
var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
|
|
2484
|
-
if (type === "c") {
|
|
2485
|
-
valueSuffix = formatType(value) + valueSuffix;
|
|
2486
|
-
value = "";
|
|
2487
|
-
} else {
|
|
2488
|
-
value = +value;
|
|
2489
|
-
var valueNegative = value < 0 || 1 / value < 0;
|
|
2490
|
-
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
2491
|
-
if (trim) value = formatTrim_default(value);
|
|
2492
|
-
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
2493
|
-
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
2494
|
-
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
2495
|
-
if (maybeSuffix) {
|
|
2496
|
-
i = -1, n = value.length;
|
|
2497
|
-
while (++i < n) {
|
|
2498
|
-
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
2499
|
-
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
2500
|
-
value = value.slice(0, i);
|
|
2501
|
-
break;
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
if (comma && !zero) value = group(value, Infinity);
|
|
2507
|
-
var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
2508
|
-
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
2509
|
-
switch (align) {
|
|
2510
|
-
case "<":
|
|
2511
|
-
value = valuePrefix + value + valueSuffix + padding;
|
|
2512
|
-
break;
|
|
2513
|
-
case "=":
|
|
2514
|
-
value = valuePrefix + padding + value + valueSuffix;
|
|
2515
|
-
break;
|
|
2516
|
-
case "^":
|
|
2517
|
-
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
|
|
2518
|
-
break;
|
|
2519
|
-
default:
|
|
2520
|
-
value = padding + valuePrefix + value + valueSuffix;
|
|
2521
|
-
break;
|
|
2522
|
-
}
|
|
2523
|
-
return numerals(value);
|
|
2524
|
-
}
|
|
2525
|
-
format2.toString = function() {
|
|
2526
|
-
return specifier + "";
|
|
2527
|
-
};
|
|
2528
|
-
return format2;
|
|
2529
|
-
}
|
|
2530
|
-
function formatPrefix2(specifier, value) {
|
|
2531
|
-
var e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
|
|
2532
|
-
return function(value2) {
|
|
2533
|
-
return f(k * value2);
|
|
2534
|
-
};
|
|
2535
|
-
}
|
|
2536
|
-
return {
|
|
2537
|
-
format: newFormat,
|
|
2538
|
-
formatPrefix: formatPrefix2
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
|
|
2542
|
-
// ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/defaultLocale.js
|
|
2543
|
-
var locale;
|
|
2544
|
-
var format;
|
|
2545
|
-
var formatPrefix;
|
|
2546
|
-
defaultLocale({
|
|
2547
|
-
thousands: ",",
|
|
2548
|
-
grouping: [3],
|
|
2549
|
-
currency: ["$", ""]
|
|
2550
|
-
});
|
|
2551
|
-
function defaultLocale(definition) {
|
|
2552
|
-
locale = locale_default(definition);
|
|
2553
|
-
format = locale.format;
|
|
2554
|
-
formatPrefix = locale.formatPrefix;
|
|
2555
|
-
return locale;
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
// ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/interval.js
|
|
2559
|
-
var t0 = /* @__PURE__ */ new Date();
|
|
2560
|
-
var t1 = /* @__PURE__ */ new Date();
|
|
2561
|
-
function timeInterval(floori, offseti, count, field) {
|
|
2562
|
-
function interval(date) {
|
|
2563
|
-
return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;
|
|
2564
|
-
}
|
|
2565
|
-
interval.floor = (date) => {
|
|
2566
|
-
return floori(date = /* @__PURE__ */ new Date(+date)), date;
|
|
2567
|
-
};
|
|
2568
|
-
interval.ceil = (date) => {
|
|
2569
|
-
return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
|
|
2570
|
-
};
|
|
2571
|
-
interval.round = (date) => {
|
|
2572
|
-
const d0 = interval(date), d1 = interval.ceil(date);
|
|
2573
|
-
return date - d0 < d1 - date ? d0 : d1;
|
|
2574
|
-
};
|
|
2575
|
-
interval.offset = (date, step) => {
|
|
2576
|
-
return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;
|
|
2577
|
-
};
|
|
2578
|
-
interval.range = (start, stop, step) => {
|
|
2579
|
-
const range = [];
|
|
2580
|
-
start = interval.ceil(start);
|
|
2581
|
-
step = step == null ? 1 : Math.floor(step);
|
|
2582
|
-
if (!(start < stop) || !(step > 0)) return range;
|
|
2583
|
-
let previous;
|
|
2584
|
-
do
|
|
2585
|
-
range.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start);
|
|
2586
|
-
while (previous < start && start < stop);
|
|
2587
|
-
return range;
|
|
2588
|
-
};
|
|
2589
|
-
interval.filter = (test) => {
|
|
2590
|
-
return timeInterval((date) => {
|
|
2591
|
-
if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
|
|
2592
|
-
}, (date, step) => {
|
|
2593
|
-
if (date >= date) {
|
|
2594
|
-
if (step < 0) while (++step <= 0) {
|
|
2595
|
-
while (offseti(date, -1), !test(date)) {
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
else while (--step >= 0) {
|
|
2599
|
-
while (offseti(date, 1), !test(date)) {
|
|
2600
|
-
}
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
});
|
|
2604
|
-
};
|
|
2605
|
-
if (count) {
|
|
2606
|
-
interval.count = (start, end) => {
|
|
2607
|
-
t0.setTime(+start), t1.setTime(+end);
|
|
2608
|
-
floori(t0), floori(t1);
|
|
2609
|
-
return Math.floor(count(t0, t1));
|
|
2610
|
-
};
|
|
2611
|
-
interval.every = (step) => {
|
|
2612
|
-
step = Math.floor(step);
|
|
2613
|
-
return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d) => field(d) % step === 0 : (d) => interval.count(0, d) % step === 0);
|
|
2614
|
-
};
|
|
2615
|
-
}
|
|
2616
|
-
return interval;
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
// ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/duration.js
|
|
2620
|
-
var durationSecond = 1e3;
|
|
2621
|
-
var durationMinute = durationSecond * 60;
|
|
2622
|
-
var durationHour = durationMinute * 60;
|
|
2623
|
-
var durationDay = durationHour * 24;
|
|
2624
|
-
var durationWeek = durationDay * 7;
|
|
2625
|
-
var durationMonth = durationDay * 30;
|
|
2626
|
-
var durationYear = durationDay * 365;
|
|
2627
|
-
|
|
2628
|
-
// ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/day.js
|
|
2629
|
-
var timeDay = timeInterval(
|
|
2630
|
-
(date) => date.setHours(0, 0, 0, 0),
|
|
2631
|
-
(date, step) => date.setDate(date.getDate() + step),
|
|
2632
|
-
(start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
|
|
2633
|
-
(date) => date.getDate() - 1
|
|
2634
|
-
);
|
|
2635
|
-
var timeDays = timeDay.range;
|
|
2636
|
-
var utcDay = timeInterval((date) => {
|
|
2637
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2638
|
-
}, (date, step) => {
|
|
2639
|
-
date.setUTCDate(date.getUTCDate() + step);
|
|
2640
|
-
}, (start, end) => {
|
|
2641
|
-
return (end - start) / durationDay;
|
|
2642
|
-
}, (date) => {
|
|
2643
|
-
return date.getUTCDate() - 1;
|
|
2644
|
-
});
|
|
2645
|
-
var utcDays = utcDay.range;
|
|
2646
|
-
var unixDay = timeInterval((date) => {
|
|
2647
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2648
|
-
}, (date, step) => {
|
|
2649
|
-
date.setUTCDate(date.getUTCDate() + step);
|
|
2650
|
-
}, (start, end) => {
|
|
2651
|
-
return (end - start) / durationDay;
|
|
2652
|
-
}, (date) => {
|
|
2653
|
-
return Math.floor(date / durationDay);
|
|
2654
|
-
});
|
|
2655
|
-
var unixDays = unixDay.range;
|
|
2656
|
-
|
|
2657
|
-
// ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/week.js
|
|
2658
|
-
function timeWeekday(i) {
|
|
2659
|
-
return timeInterval((date) => {
|
|
2660
|
-
date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
|
|
2661
|
-
date.setHours(0, 0, 0, 0);
|
|
2662
|
-
}, (date, step) => {
|
|
2663
|
-
date.setDate(date.getDate() + step * 7);
|
|
2664
|
-
}, (start, end) => {
|
|
2665
|
-
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
|
|
2666
|
-
});
|
|
2667
|
-
}
|
|
2668
|
-
var timeSunday = timeWeekday(0);
|
|
2669
|
-
var timeMonday = timeWeekday(1);
|
|
2670
|
-
var timeTuesday = timeWeekday(2);
|
|
2671
|
-
var timeWednesday = timeWeekday(3);
|
|
2672
|
-
var timeThursday = timeWeekday(4);
|
|
2673
|
-
var timeFriday = timeWeekday(5);
|
|
2674
|
-
var timeSaturday = timeWeekday(6);
|
|
2675
|
-
var timeSundays = timeSunday.range;
|
|
2676
|
-
var timeMondays = timeMonday.range;
|
|
2677
|
-
var timeTuesdays = timeTuesday.range;
|
|
2678
|
-
var timeWednesdays = timeWednesday.range;
|
|
2679
|
-
var timeThursdays = timeThursday.range;
|
|
2680
|
-
var timeFridays = timeFriday.range;
|
|
2681
|
-
var timeSaturdays = timeSaturday.range;
|
|
2682
|
-
function utcWeekday(i) {
|
|
2683
|
-
return timeInterval((date) => {
|
|
2684
|
-
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
|
|
2685
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2686
|
-
}, (date, step) => {
|
|
2687
|
-
date.setUTCDate(date.getUTCDate() + step * 7);
|
|
2688
|
-
}, (start, end) => {
|
|
2689
|
-
return (end - start) / durationWeek;
|
|
2690
|
-
});
|
|
2691
|
-
}
|
|
2692
|
-
var utcSunday = utcWeekday(0);
|
|
2693
|
-
var utcMonday = utcWeekday(1);
|
|
2694
|
-
var utcTuesday = utcWeekday(2);
|
|
2695
|
-
var utcWednesday = utcWeekday(3);
|
|
2696
|
-
var utcThursday = utcWeekday(4);
|
|
2697
|
-
var utcFriday = utcWeekday(5);
|
|
2698
|
-
var utcSaturday = utcWeekday(6);
|
|
2699
|
-
var utcSundays = utcSunday.range;
|
|
2700
|
-
var utcMondays = utcMonday.range;
|
|
2701
|
-
var utcTuesdays = utcTuesday.range;
|
|
2702
|
-
var utcWednesdays = utcWednesday.range;
|
|
2703
|
-
var utcThursdays = utcThursday.range;
|
|
2704
|
-
var utcFridays = utcFriday.range;
|
|
2705
|
-
var utcSaturdays = utcSaturday.range;
|
|
2706
|
-
|
|
2707
|
-
// ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/year.js
|
|
2708
|
-
var timeYear = timeInterval((date) => {
|
|
2709
|
-
date.setMonth(0, 1);
|
|
2710
|
-
date.setHours(0, 0, 0, 0);
|
|
2711
|
-
}, (date, step) => {
|
|
2712
|
-
date.setFullYear(date.getFullYear() + step);
|
|
2713
|
-
}, (start, end) => {
|
|
2714
|
-
return end.getFullYear() - start.getFullYear();
|
|
2715
|
-
}, (date) => {
|
|
2716
|
-
return date.getFullYear();
|
|
2717
|
-
});
|
|
2718
|
-
timeYear.every = (k) => {
|
|
2719
|
-
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
|
|
2720
|
-
date.setFullYear(Math.floor(date.getFullYear() / k) * k);
|
|
2721
|
-
date.setMonth(0, 1);
|
|
2722
|
-
date.setHours(0, 0, 0, 0);
|
|
2723
|
-
}, (date, step) => {
|
|
2724
|
-
date.setFullYear(date.getFullYear() + step * k);
|
|
2725
|
-
});
|
|
2726
|
-
};
|
|
2727
|
-
var timeYears = timeYear.range;
|
|
2728
|
-
var utcYear = timeInterval((date) => {
|
|
2729
|
-
date.setUTCMonth(0, 1);
|
|
2730
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2731
|
-
}, (date, step) => {
|
|
2732
|
-
date.setUTCFullYear(date.getUTCFullYear() + step);
|
|
2733
|
-
}, (start, end) => {
|
|
2734
|
-
return end.getUTCFullYear() - start.getUTCFullYear();
|
|
2735
|
-
}, (date) => {
|
|
2736
|
-
return date.getUTCFullYear();
|
|
2737
|
-
});
|
|
2738
|
-
utcYear.every = (k) => {
|
|
2739
|
-
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
|
|
2740
|
-
date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
|
|
2741
|
-
date.setUTCMonth(0, 1);
|
|
2742
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2743
|
-
}, (date, step) => {
|
|
2744
|
-
date.setUTCFullYear(date.getUTCFullYear() + step * k);
|
|
2745
|
-
});
|
|
2746
|
-
};
|
|
2747
|
-
var utcYears = utcYear.range;
|
|
2748
|
-
|
|
2749
|
-
// ../../node_modules/.bun/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js
|
|
2750
|
-
function localDate(d) {
|
|
2751
|
-
if (0 <= d.y && d.y < 100) {
|
|
2752
|
-
var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
|
|
2753
|
-
date.setFullYear(d.y);
|
|
2754
|
-
return date;
|
|
2755
|
-
}
|
|
2756
|
-
return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
|
|
2757
|
-
}
|
|
2758
|
-
function utcDate(d) {
|
|
2759
|
-
if (0 <= d.y && d.y < 100) {
|
|
2760
|
-
var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
|
|
2761
|
-
date.setUTCFullYear(d.y);
|
|
2762
|
-
return date;
|
|
2763
|
-
}
|
|
2764
|
-
return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
|
|
2765
|
-
}
|
|
2766
|
-
function newDate(y, m, d) {
|
|
2767
|
-
return { y, m, d, H: 0, M: 0, S: 0, L: 0 };
|
|
2768
|
-
}
|
|
2769
|
-
function formatLocale(locale3) {
|
|
2770
|
-
var locale_dateTime = locale3.dateTime, locale_date = locale3.date, locale_time = locale3.time, locale_periods = locale3.periods, locale_weekdays = locale3.days, locale_shortWeekdays = locale3.shortDays, locale_months = locale3.months, locale_shortMonths = locale3.shortMonths;
|
|
2771
|
-
var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);
|
|
2772
|
-
var formats = {
|
|
2773
|
-
"a": formatShortWeekday,
|
|
2774
|
-
"A": formatWeekday,
|
|
2775
|
-
"b": formatShortMonth,
|
|
2776
|
-
"B": formatMonth,
|
|
2777
|
-
"c": null,
|
|
2778
|
-
"d": formatDayOfMonth,
|
|
2779
|
-
"e": formatDayOfMonth,
|
|
2780
|
-
"f": formatMicroseconds,
|
|
2781
|
-
"g": formatYearISO,
|
|
2782
|
-
"G": formatFullYearISO,
|
|
2783
|
-
"H": formatHour24,
|
|
2784
|
-
"I": formatHour12,
|
|
2785
|
-
"j": formatDayOfYear,
|
|
2786
|
-
"L": formatMilliseconds,
|
|
2787
|
-
"m": formatMonthNumber,
|
|
2788
|
-
"M": formatMinutes,
|
|
2789
|
-
"p": formatPeriod,
|
|
2790
|
-
"q": formatQuarter,
|
|
2791
|
-
"Q": formatUnixTimestamp,
|
|
2792
|
-
"s": formatUnixTimestampSeconds,
|
|
2793
|
-
"S": formatSeconds,
|
|
2794
|
-
"u": formatWeekdayNumberMonday,
|
|
2795
|
-
"U": formatWeekNumberSunday,
|
|
2796
|
-
"V": formatWeekNumberISO,
|
|
2797
|
-
"w": formatWeekdayNumberSunday,
|
|
2798
|
-
"W": formatWeekNumberMonday,
|
|
2799
|
-
"x": null,
|
|
2800
|
-
"X": null,
|
|
2801
|
-
"y": formatYear,
|
|
2802
|
-
"Y": formatFullYear,
|
|
2803
|
-
"Z": formatZone,
|
|
2804
|
-
"%": formatLiteralPercent
|
|
2805
|
-
};
|
|
2806
|
-
var utcFormats = {
|
|
2807
|
-
"a": formatUTCShortWeekday,
|
|
2808
|
-
"A": formatUTCWeekday,
|
|
2809
|
-
"b": formatUTCShortMonth,
|
|
2810
|
-
"B": formatUTCMonth,
|
|
2811
|
-
"c": null,
|
|
2812
|
-
"d": formatUTCDayOfMonth,
|
|
2813
|
-
"e": formatUTCDayOfMonth,
|
|
2814
|
-
"f": formatUTCMicroseconds,
|
|
2815
|
-
"g": formatUTCYearISO,
|
|
2816
|
-
"G": formatUTCFullYearISO,
|
|
2817
|
-
"H": formatUTCHour24,
|
|
2818
|
-
"I": formatUTCHour12,
|
|
2819
|
-
"j": formatUTCDayOfYear,
|
|
2820
|
-
"L": formatUTCMilliseconds,
|
|
2821
|
-
"m": formatUTCMonthNumber,
|
|
2822
|
-
"M": formatUTCMinutes,
|
|
2823
|
-
"p": formatUTCPeriod,
|
|
2824
|
-
"q": formatUTCQuarter,
|
|
2825
|
-
"Q": formatUnixTimestamp,
|
|
2826
|
-
"s": formatUnixTimestampSeconds,
|
|
2827
|
-
"S": formatUTCSeconds,
|
|
2828
|
-
"u": formatUTCWeekdayNumberMonday,
|
|
2829
|
-
"U": formatUTCWeekNumberSunday,
|
|
2830
|
-
"V": formatUTCWeekNumberISO,
|
|
2831
|
-
"w": formatUTCWeekdayNumberSunday,
|
|
2832
|
-
"W": formatUTCWeekNumberMonday,
|
|
2833
|
-
"x": null,
|
|
2834
|
-
"X": null,
|
|
2835
|
-
"y": formatUTCYear,
|
|
2836
|
-
"Y": formatUTCFullYear,
|
|
2837
|
-
"Z": formatUTCZone,
|
|
2838
|
-
"%": formatLiteralPercent
|
|
2839
|
-
};
|
|
2840
|
-
var parses = {
|
|
2841
|
-
"a": parseShortWeekday,
|
|
2842
|
-
"A": parseWeekday,
|
|
2843
|
-
"b": parseShortMonth,
|
|
2844
|
-
"B": parseMonth,
|
|
2845
|
-
"c": parseLocaleDateTime,
|
|
2846
|
-
"d": parseDayOfMonth,
|
|
2847
|
-
"e": parseDayOfMonth,
|
|
2848
|
-
"f": parseMicroseconds,
|
|
2849
|
-
"g": parseYear,
|
|
2850
|
-
"G": parseFullYear,
|
|
2851
|
-
"H": parseHour24,
|
|
2852
|
-
"I": parseHour24,
|
|
2853
|
-
"j": parseDayOfYear,
|
|
2854
|
-
"L": parseMilliseconds,
|
|
2855
|
-
"m": parseMonthNumber,
|
|
2856
|
-
"M": parseMinutes,
|
|
2857
|
-
"p": parsePeriod,
|
|
2858
|
-
"q": parseQuarter,
|
|
2859
|
-
"Q": parseUnixTimestamp,
|
|
2860
|
-
"s": parseUnixTimestampSeconds,
|
|
2861
|
-
"S": parseSeconds,
|
|
2862
|
-
"u": parseWeekdayNumberMonday,
|
|
2863
|
-
"U": parseWeekNumberSunday,
|
|
2864
|
-
"V": parseWeekNumberISO,
|
|
2865
|
-
"w": parseWeekdayNumberSunday,
|
|
2866
|
-
"W": parseWeekNumberMonday,
|
|
2867
|
-
"x": parseLocaleDate,
|
|
2868
|
-
"X": parseLocaleTime,
|
|
2869
|
-
"y": parseYear,
|
|
2870
|
-
"Y": parseFullYear,
|
|
2871
|
-
"Z": parseZone,
|
|
2872
|
-
"%": parseLiteralPercent
|
|
2873
|
-
};
|
|
2874
|
-
formats.x = newFormat(locale_date, formats);
|
|
2875
|
-
formats.X = newFormat(locale_time, formats);
|
|
2876
|
-
formats.c = newFormat(locale_dateTime, formats);
|
|
2877
|
-
utcFormats.x = newFormat(locale_date, utcFormats);
|
|
2878
|
-
utcFormats.X = newFormat(locale_time, utcFormats);
|
|
2879
|
-
utcFormats.c = newFormat(locale_dateTime, utcFormats);
|
|
2880
|
-
function newFormat(specifier, formats2) {
|
|
2881
|
-
return function(date) {
|
|
2882
|
-
var string = [], i = -1, j = 0, n = specifier.length, c, pad2, format2;
|
|
2883
|
-
if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);
|
|
2884
|
-
while (++i < n) {
|
|
2885
|
-
if (specifier.charCodeAt(i) === 37) {
|
|
2886
|
-
string.push(specifier.slice(j, i));
|
|
2887
|
-
if ((pad2 = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
|
|
2888
|
-
else pad2 = c === "e" ? " " : "0";
|
|
2889
|
-
if (format2 = formats2[c]) c = format2(date, pad2);
|
|
2890
|
-
string.push(c);
|
|
2891
|
-
j = i + 1;
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2894
|
-
string.push(specifier.slice(j, i));
|
|
2895
|
-
return string.join("");
|
|
2896
|
-
};
|
|
2897
|
-
}
|
|
2898
|
-
function newParse(specifier, Z) {
|
|
2899
|
-
return function(string) {
|
|
2900
|
-
var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day;
|
|
2901
|
-
if (i != string.length) return null;
|
|
2902
|
-
if ("Q" in d) return new Date(d.Q);
|
|
2903
|
-
if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0));
|
|
2904
|
-
if (Z && !("Z" in d)) d.Z = 0;
|
|
2905
|
-
if ("p" in d) d.H = d.H % 12 + d.p * 12;
|
|
2906
|
-
if (d.m === void 0) d.m = "q" in d ? d.q : 0;
|
|
2907
|
-
if ("V" in d) {
|
|
2908
|
-
if (d.V < 1 || d.V > 53) return null;
|
|
2909
|
-
if (!("w" in d)) d.w = 1;
|
|
2910
|
-
if ("Z" in d) {
|
|
2911
|
-
week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
|
|
2912
|
-
week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
|
|
2913
|
-
week = utcDay.offset(week, (d.V - 1) * 7);
|
|
2914
|
-
d.y = week.getUTCFullYear();
|
|
2915
|
-
d.m = week.getUTCMonth();
|
|
2916
|
-
d.d = week.getUTCDate() + (d.w + 6) % 7;
|
|
2917
|
-
} else {
|
|
2918
|
-
week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
|
|
2919
|
-
week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
|
|
2920
|
-
week = timeDay.offset(week, (d.V - 1) * 7);
|
|
2921
|
-
d.y = week.getFullYear();
|
|
2922
|
-
d.m = week.getMonth();
|
|
2923
|
-
d.d = week.getDate() + (d.w + 6) % 7;
|
|
2924
|
-
}
|
|
2925
|
-
} else if ("W" in d || "U" in d) {
|
|
2926
|
-
if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
|
|
2927
|
-
day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
|
|
2928
|
-
d.m = 0;
|
|
2929
|
-
d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
|
|
2930
|
-
}
|
|
2931
|
-
if ("Z" in d) {
|
|
2932
|
-
d.H += d.Z / 100 | 0;
|
|
2933
|
-
d.M += d.Z % 100;
|
|
2934
|
-
return utcDate(d);
|
|
2935
|
-
}
|
|
2936
|
-
return localDate(d);
|
|
2937
|
-
};
|
|
2938
|
-
}
|
|
2939
|
-
function parseSpecifier(d, specifier, string, j) {
|
|
2940
|
-
var i = 0, n = specifier.length, m = string.length, c, parse;
|
|
2941
|
-
while (i < n) {
|
|
2942
|
-
if (j >= m) return -1;
|
|
2943
|
-
c = specifier.charCodeAt(i++);
|
|
2944
|
-
if (c === 37) {
|
|
2945
|
-
c = specifier.charAt(i++);
|
|
2946
|
-
parse = parses[c in pads ? specifier.charAt(i++) : c];
|
|
2947
|
-
if (!parse || (j = parse(d, string, j)) < 0) return -1;
|
|
2948
|
-
} else if (c != string.charCodeAt(j++)) {
|
|
2949
|
-
return -1;
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
return j;
|
|
2953
|
-
}
|
|
2954
|
-
function parsePeriod(d, string, i) {
|
|
2955
|
-
var n = periodRe.exec(string.slice(i));
|
|
2956
|
-
return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
|
2957
|
-
}
|
|
2958
|
-
function parseShortWeekday(d, string, i) {
|
|
2959
|
-
var n = shortWeekdayRe.exec(string.slice(i));
|
|
2960
|
-
return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
|
2961
|
-
}
|
|
2962
|
-
function parseWeekday(d, string, i) {
|
|
2963
|
-
var n = weekdayRe.exec(string.slice(i));
|
|
2964
|
-
return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
|
2965
|
-
}
|
|
2966
|
-
function parseShortMonth(d, string, i) {
|
|
2967
|
-
var n = shortMonthRe.exec(string.slice(i));
|
|
2968
|
-
return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
|
2969
|
-
}
|
|
2970
|
-
function parseMonth(d, string, i) {
|
|
2971
|
-
var n = monthRe.exec(string.slice(i));
|
|
2972
|
-
return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
|
2973
|
-
}
|
|
2974
|
-
function parseLocaleDateTime(d, string, i) {
|
|
2975
|
-
return parseSpecifier(d, locale_dateTime, string, i);
|
|
2976
|
-
}
|
|
2977
|
-
function parseLocaleDate(d, string, i) {
|
|
2978
|
-
return parseSpecifier(d, locale_date, string, i);
|
|
2979
|
-
}
|
|
2980
|
-
function parseLocaleTime(d, string, i) {
|
|
2981
|
-
return parseSpecifier(d, locale_time, string, i);
|
|
2982
|
-
}
|
|
2983
|
-
function formatShortWeekday(d) {
|
|
2984
|
-
return locale_shortWeekdays[d.getDay()];
|
|
2985
|
-
}
|
|
2986
|
-
function formatWeekday(d) {
|
|
2987
|
-
return locale_weekdays[d.getDay()];
|
|
2988
|
-
}
|
|
2989
|
-
function formatShortMonth(d) {
|
|
2990
|
-
return locale_shortMonths[d.getMonth()];
|
|
2991
|
-
}
|
|
2992
|
-
function formatMonth(d) {
|
|
2993
|
-
return locale_months[d.getMonth()];
|
|
2994
|
-
}
|
|
2995
|
-
function formatPeriod(d) {
|
|
2996
|
-
return locale_periods[+(d.getHours() >= 12)];
|
|
2997
|
-
}
|
|
2998
|
-
function formatQuarter(d) {
|
|
2999
|
-
return 1 + ~~(d.getMonth() / 3);
|
|
3000
|
-
}
|
|
3001
|
-
function formatUTCShortWeekday(d) {
|
|
3002
|
-
return locale_shortWeekdays[d.getUTCDay()];
|
|
3003
|
-
}
|
|
3004
|
-
function formatUTCWeekday(d) {
|
|
3005
|
-
return locale_weekdays[d.getUTCDay()];
|
|
3006
|
-
}
|
|
3007
|
-
function formatUTCShortMonth(d) {
|
|
3008
|
-
return locale_shortMonths[d.getUTCMonth()];
|
|
3009
|
-
}
|
|
3010
|
-
function formatUTCMonth(d) {
|
|
3011
|
-
return locale_months[d.getUTCMonth()];
|
|
3012
|
-
}
|
|
3013
|
-
function formatUTCPeriod(d) {
|
|
3014
|
-
return locale_periods[+(d.getUTCHours() >= 12)];
|
|
3015
|
-
}
|
|
3016
|
-
function formatUTCQuarter(d) {
|
|
3017
|
-
return 1 + ~~(d.getUTCMonth() / 3);
|
|
3018
|
-
}
|
|
3019
|
-
return {
|
|
3020
|
-
format: function(specifier) {
|
|
3021
|
-
var f = newFormat(specifier += "", formats);
|
|
3022
|
-
f.toString = function() {
|
|
3023
|
-
return specifier;
|
|
3024
|
-
};
|
|
3025
|
-
return f;
|
|
3026
|
-
},
|
|
3027
|
-
parse: function(specifier) {
|
|
3028
|
-
var p = newParse(specifier += "", false);
|
|
3029
|
-
p.toString = function() {
|
|
3030
|
-
return specifier;
|
|
3031
|
-
};
|
|
3032
|
-
return p;
|
|
3033
|
-
},
|
|
3034
|
-
utcFormat: function(specifier) {
|
|
3035
|
-
var f = newFormat(specifier += "", utcFormats);
|
|
3036
|
-
f.toString = function() {
|
|
3037
|
-
return specifier;
|
|
3038
|
-
};
|
|
3039
|
-
return f;
|
|
3040
|
-
},
|
|
3041
|
-
utcParse: function(specifier) {
|
|
3042
|
-
var p = newParse(specifier += "", true);
|
|
3043
|
-
p.toString = function() {
|
|
3044
|
-
return specifier;
|
|
3045
|
-
};
|
|
3046
|
-
return p;
|
|
3047
|
-
}
|
|
3048
|
-
};
|
|
3049
|
-
}
|
|
3050
|
-
var pads = { "-": "", "_": " ", "0": "0" };
|
|
3051
|
-
var numberRe = /^\s*\d+/;
|
|
3052
|
-
var percentRe = /^%/;
|
|
3053
|
-
var requoteRe = /[\\^$*+?|[\]().{}]/g;
|
|
3054
|
-
function pad(value, fill, width) {
|
|
3055
|
-
var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
|
|
3056
|
-
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
|
|
3057
|
-
}
|
|
3058
|
-
function requote(s) {
|
|
3059
|
-
return s.replace(requoteRe, "\\$&");
|
|
3060
|
-
}
|
|
3061
|
-
function formatRe(names) {
|
|
3062
|
-
return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
|
|
3063
|
-
}
|
|
3064
|
-
function formatLookup(names) {
|
|
3065
|
-
return new Map(names.map((name, i) => [name.toLowerCase(), i]));
|
|
3066
|
-
}
|
|
3067
|
-
function parseWeekdayNumberSunday(d, string, i) {
|
|
3068
|
-
var n = numberRe.exec(string.slice(i, i + 1));
|
|
3069
|
-
return n ? (d.w = +n[0], i + n[0].length) : -1;
|
|
3070
|
-
}
|
|
3071
|
-
function parseWeekdayNumberMonday(d, string, i) {
|
|
3072
|
-
var n = numberRe.exec(string.slice(i, i + 1));
|
|
3073
|
-
return n ? (d.u = +n[0], i + n[0].length) : -1;
|
|
3074
|
-
}
|
|
3075
|
-
function parseWeekNumberSunday(d, string, i) {
|
|
3076
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3077
|
-
return n ? (d.U = +n[0], i + n[0].length) : -1;
|
|
3078
|
-
}
|
|
3079
|
-
function parseWeekNumberISO(d, string, i) {
|
|
3080
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3081
|
-
return n ? (d.V = +n[0], i + n[0].length) : -1;
|
|
3082
|
-
}
|
|
3083
|
-
function parseWeekNumberMonday(d, string, i) {
|
|
3084
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3085
|
-
return n ? (d.W = +n[0], i + n[0].length) : -1;
|
|
3086
|
-
}
|
|
3087
|
-
function parseFullYear(d, string, i) {
|
|
3088
|
-
var n = numberRe.exec(string.slice(i, i + 4));
|
|
3089
|
-
return n ? (d.y = +n[0], i + n[0].length) : -1;
|
|
3090
|
-
}
|
|
3091
|
-
function parseYear(d, string, i) {
|
|
3092
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3093
|
-
return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1;
|
|
3094
|
-
}
|
|
3095
|
-
function parseZone(d, string, i) {
|
|
3096
|
-
var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
|
|
3097
|
-
return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
|
|
3098
|
-
}
|
|
3099
|
-
function parseQuarter(d, string, i) {
|
|
3100
|
-
var n = numberRe.exec(string.slice(i, i + 1));
|
|
3101
|
-
return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
|
|
3102
|
-
}
|
|
3103
|
-
function parseMonthNumber(d, string, i) {
|
|
3104
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3105
|
-
return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
|
|
3106
|
-
}
|
|
3107
|
-
function parseDayOfMonth(d, string, i) {
|
|
3108
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3109
|
-
return n ? (d.d = +n[0], i + n[0].length) : -1;
|
|
3110
|
-
}
|
|
3111
|
-
function parseDayOfYear(d, string, i) {
|
|
3112
|
-
var n = numberRe.exec(string.slice(i, i + 3));
|
|
3113
|
-
return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
|
|
3114
|
-
}
|
|
3115
|
-
function parseHour24(d, string, i) {
|
|
3116
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3117
|
-
return n ? (d.H = +n[0], i + n[0].length) : -1;
|
|
3118
|
-
}
|
|
3119
|
-
function parseMinutes(d, string, i) {
|
|
3120
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3121
|
-
return n ? (d.M = +n[0], i + n[0].length) : -1;
|
|
3122
|
-
}
|
|
3123
|
-
function parseSeconds(d, string, i) {
|
|
3124
|
-
var n = numberRe.exec(string.slice(i, i + 2));
|
|
3125
|
-
return n ? (d.S = +n[0], i + n[0].length) : -1;
|
|
3126
|
-
}
|
|
3127
|
-
function parseMilliseconds(d, string, i) {
|
|
3128
|
-
var n = numberRe.exec(string.slice(i, i + 3));
|
|
3129
|
-
return n ? (d.L = +n[0], i + n[0].length) : -1;
|
|
3130
|
-
}
|
|
3131
|
-
function parseMicroseconds(d, string, i) {
|
|
3132
|
-
var n = numberRe.exec(string.slice(i, i + 6));
|
|
3133
|
-
return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1;
|
|
3134
|
-
}
|
|
3135
|
-
function parseLiteralPercent(d, string, i) {
|
|
3136
|
-
var n = percentRe.exec(string.slice(i, i + 1));
|
|
3137
|
-
return n ? i + n[0].length : -1;
|
|
3138
|
-
}
|
|
3139
|
-
function parseUnixTimestamp(d, string, i) {
|
|
3140
|
-
var n = numberRe.exec(string.slice(i));
|
|
3141
|
-
return n ? (d.Q = +n[0], i + n[0].length) : -1;
|
|
3142
|
-
}
|
|
3143
|
-
function parseUnixTimestampSeconds(d, string, i) {
|
|
3144
|
-
var n = numberRe.exec(string.slice(i));
|
|
3145
|
-
return n ? (d.s = +n[0], i + n[0].length) : -1;
|
|
3146
|
-
}
|
|
3147
|
-
function formatDayOfMonth(d, p) {
|
|
3148
|
-
return pad(d.getDate(), p, 2);
|
|
3149
|
-
}
|
|
3150
|
-
function formatHour24(d, p) {
|
|
3151
|
-
return pad(d.getHours(), p, 2);
|
|
3152
|
-
}
|
|
3153
|
-
function formatHour12(d, p) {
|
|
3154
|
-
return pad(d.getHours() % 12 || 12, p, 2);
|
|
3155
|
-
}
|
|
3156
|
-
function formatDayOfYear(d, p) {
|
|
3157
|
-
return pad(1 + timeDay.count(timeYear(d), d), p, 3);
|
|
3158
|
-
}
|
|
3159
|
-
function formatMilliseconds(d, p) {
|
|
3160
|
-
return pad(d.getMilliseconds(), p, 3);
|
|
3161
|
-
}
|
|
3162
|
-
function formatMicroseconds(d, p) {
|
|
3163
|
-
return formatMilliseconds(d, p) + "000";
|
|
3164
|
-
}
|
|
3165
|
-
function formatMonthNumber(d, p) {
|
|
3166
|
-
return pad(d.getMonth() + 1, p, 2);
|
|
3167
|
-
}
|
|
3168
|
-
function formatMinutes(d, p) {
|
|
3169
|
-
return pad(d.getMinutes(), p, 2);
|
|
3170
|
-
}
|
|
3171
|
-
function formatSeconds(d, p) {
|
|
3172
|
-
return pad(d.getSeconds(), p, 2);
|
|
3173
|
-
}
|
|
3174
|
-
function formatWeekdayNumberMonday(d) {
|
|
3175
|
-
var day = d.getDay();
|
|
3176
|
-
return day === 0 ? 7 : day;
|
|
3177
|
-
}
|
|
3178
|
-
function formatWeekNumberSunday(d, p) {
|
|
3179
|
-
return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);
|
|
3180
|
-
}
|
|
3181
|
-
function dISO(d) {
|
|
3182
|
-
var day = d.getDay();
|
|
3183
|
-
return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
|
|
3184
|
-
}
|
|
3185
|
-
function formatWeekNumberISO(d, p) {
|
|
3186
|
-
d = dISO(d);
|
|
3187
|
-
return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
|
|
3188
|
-
}
|
|
3189
|
-
function formatWeekdayNumberSunday(d) {
|
|
3190
|
-
return d.getDay();
|
|
3191
|
-
}
|
|
3192
|
-
function formatWeekNumberMonday(d, p) {
|
|
3193
|
-
return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);
|
|
3194
|
-
}
|
|
3195
|
-
function formatYear(d, p) {
|
|
3196
|
-
return pad(d.getFullYear() % 100, p, 2);
|
|
3197
|
-
}
|
|
3198
|
-
function formatYearISO(d, p) {
|
|
3199
|
-
d = dISO(d);
|
|
3200
|
-
return pad(d.getFullYear() % 100, p, 2);
|
|
3201
|
-
}
|
|
3202
|
-
function formatFullYear(d, p) {
|
|
3203
|
-
return pad(d.getFullYear() % 1e4, p, 4);
|
|
3204
|
-
}
|
|
3205
|
-
function formatFullYearISO(d, p) {
|
|
3206
|
-
var day = d.getDay();
|
|
3207
|
-
d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
|
|
3208
|
-
return pad(d.getFullYear() % 1e4, p, 4);
|
|
3209
|
-
}
|
|
3210
|
-
function formatZone(d) {
|
|
3211
|
-
var z = d.getTimezoneOffset();
|
|
3212
|
-
return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2);
|
|
3213
|
-
}
|
|
3214
|
-
function formatUTCDayOfMonth(d, p) {
|
|
3215
|
-
return pad(d.getUTCDate(), p, 2);
|
|
3216
|
-
}
|
|
3217
|
-
function formatUTCHour24(d, p) {
|
|
3218
|
-
return pad(d.getUTCHours(), p, 2);
|
|
3219
|
-
}
|
|
3220
|
-
function formatUTCHour12(d, p) {
|
|
3221
|
-
return pad(d.getUTCHours() % 12 || 12, p, 2);
|
|
3222
|
-
}
|
|
3223
|
-
function formatUTCDayOfYear(d, p) {
|
|
3224
|
-
return pad(1 + utcDay.count(utcYear(d), d), p, 3);
|
|
3225
|
-
}
|
|
3226
|
-
function formatUTCMilliseconds(d, p) {
|
|
3227
|
-
return pad(d.getUTCMilliseconds(), p, 3);
|
|
3228
|
-
}
|
|
3229
|
-
function formatUTCMicroseconds(d, p) {
|
|
3230
|
-
return formatUTCMilliseconds(d, p) + "000";
|
|
3231
|
-
}
|
|
3232
|
-
function formatUTCMonthNumber(d, p) {
|
|
3233
|
-
return pad(d.getUTCMonth() + 1, p, 2);
|
|
3234
|
-
}
|
|
3235
|
-
function formatUTCMinutes(d, p) {
|
|
3236
|
-
return pad(d.getUTCMinutes(), p, 2);
|
|
3237
|
-
}
|
|
3238
|
-
function formatUTCSeconds(d, p) {
|
|
3239
|
-
return pad(d.getUTCSeconds(), p, 2);
|
|
3240
|
-
}
|
|
3241
|
-
function formatUTCWeekdayNumberMonday(d) {
|
|
3242
|
-
var dow = d.getUTCDay();
|
|
3243
|
-
return dow === 0 ? 7 : dow;
|
|
3244
|
-
}
|
|
3245
|
-
function formatUTCWeekNumberSunday(d, p) {
|
|
3246
|
-
return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
|
|
3247
|
-
}
|
|
3248
|
-
function UTCdISO(d) {
|
|
3249
|
-
var day = d.getUTCDay();
|
|
3250
|
-
return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
|
|
3251
|
-
}
|
|
3252
|
-
function formatUTCWeekNumberISO(d, p) {
|
|
3253
|
-
d = UTCdISO(d);
|
|
3254
|
-
return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
|
|
3255
|
-
}
|
|
3256
|
-
function formatUTCWeekdayNumberSunday(d) {
|
|
3257
|
-
return d.getUTCDay();
|
|
3258
|
-
}
|
|
3259
|
-
function formatUTCWeekNumberMonday(d, p) {
|
|
3260
|
-
return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
|
|
3261
|
-
}
|
|
3262
|
-
function formatUTCYear(d, p) {
|
|
3263
|
-
return pad(d.getUTCFullYear() % 100, p, 2);
|
|
3264
|
-
}
|
|
3265
|
-
function formatUTCYearISO(d, p) {
|
|
3266
|
-
d = UTCdISO(d);
|
|
3267
|
-
return pad(d.getUTCFullYear() % 100, p, 2);
|
|
3268
|
-
}
|
|
3269
|
-
function formatUTCFullYear(d, p) {
|
|
3270
|
-
return pad(d.getUTCFullYear() % 1e4, p, 4);
|
|
3271
|
-
}
|
|
3272
|
-
function formatUTCFullYearISO(d, p) {
|
|
3273
|
-
var day = d.getUTCDay();
|
|
3274
|
-
d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
|
|
3275
|
-
return pad(d.getUTCFullYear() % 1e4, p, 4);
|
|
3276
|
-
}
|
|
3277
|
-
function formatUTCZone() {
|
|
3278
|
-
return "+0000";
|
|
3279
|
-
}
|
|
3280
|
-
function formatLiteralPercent() {
|
|
3281
|
-
return "%";
|
|
3282
|
-
}
|
|
3283
|
-
function formatUnixTimestamp(d) {
|
|
3284
|
-
return +d;
|
|
3285
|
-
}
|
|
3286
|
-
function formatUnixTimestampSeconds(d) {
|
|
3287
|
-
return Math.floor(+d / 1e3);
|
|
3288
|
-
}
|
|
3289
|
-
|
|
3290
|
-
// ../../node_modules/.bun/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js
|
|
3291
|
-
var locale2;
|
|
3292
|
-
var timeFormat;
|
|
3293
|
-
var timeParse;
|
|
3294
|
-
var utcFormat;
|
|
3295
|
-
var utcParse;
|
|
3296
|
-
defaultLocale2({
|
|
3297
|
-
dateTime: "%x, %X",
|
|
3298
|
-
date: "%-m/%-d/%Y",
|
|
3299
|
-
time: "%-I:%M:%S %p",
|
|
3300
|
-
periods: ["AM", "PM"],
|
|
3301
|
-
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
3302
|
-
shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
3303
|
-
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
3304
|
-
shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
|
3305
|
-
});
|
|
3306
|
-
function defaultLocale2(definition) {
|
|
3307
|
-
locale2 = formatLocale(definition);
|
|
3308
|
-
timeFormat = locale2.format;
|
|
3309
|
-
timeParse = locale2.parse;
|
|
3310
|
-
utcFormat = locale2.utcFormat;
|
|
3311
|
-
utcParse = locale2.utcParse;
|
|
3312
|
-
return locale2;
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
1999
|
// src/locale/format.ts
|
|
2000
|
+
import { format as d3Format } from "d3-format";
|
|
2001
|
+
import { timeFormat, utcFormat } from "d3-time-format";
|
|
2002
|
+
var FORMAT_INTEGER = d3Format(",");
|
|
2003
|
+
var FORMAT_TINY = d3Format(".2~r");
|
|
2004
|
+
var FORMAT_DECIMAL = d3Format(",.2f");
|
|
2005
|
+
var FORMAT_ABBREV_MANTISSA = d3Format(".1~f");
|
|
2006
|
+
var FORMAT_PERCENT_FRACTION = d3Format(".1~%");
|
|
2007
|
+
var FORMAT_PERCENT_RAW = d3Format(",.1~f");
|
|
2008
|
+
var FORMAT_CURRENCY_INTEGER = d3Format("$,");
|
|
2009
|
+
var FORMAT_CURRENCY_DECIMAL = d3Format("$,.2f");
|
|
2010
|
+
var FORMAT_STEP_FRACTION = [d3Format(".0~f"), d3Format(".1~f"), d3Format(".2~f")];
|
|
3316
2011
|
function formatNumber(value, _locale) {
|
|
3317
2012
|
if (!Number.isFinite(value)) return String(value);
|
|
3318
2013
|
if (Number.isInteger(value)) {
|
|
3319
|
-
return
|
|
2014
|
+
return FORMAT_INTEGER(value);
|
|
3320
2015
|
}
|
|
3321
2016
|
if (Math.abs(value) < 5e-3) {
|
|
3322
|
-
return
|
|
2017
|
+
return FORMAT_TINY(value);
|
|
3323
2018
|
}
|
|
3324
|
-
return
|
|
2019
|
+
return FORMAT_DECIMAL(value);
|
|
3325
2020
|
}
|
|
3326
2021
|
var UNIT_TABLE = [
|
|
3327
2022
|
{ threshold: 1e12, suffix: "T", divisor: 1e12 },
|
|
@@ -3350,7 +2045,7 @@ function abbreviateNumber(value) {
|
|
|
3350
2045
|
for (let i = 0; i < UNIT_TABLE.length; i++) {
|
|
3351
2046
|
const { threshold, suffix, divisor } = UNIT_TABLE[i];
|
|
3352
2047
|
if (absValue >= threshold) {
|
|
3353
|
-
const mantissa =
|
|
2048
|
+
const mantissa = FORMAT_ABBREV_MANTISSA(absValue / divisor);
|
|
3354
2049
|
if (mantissa === "1000" && i > 0) {
|
|
3355
2050
|
return `${sign}1${UNIT_TABLE[i - 1].suffix}`;
|
|
3356
2051
|
}
|
|
@@ -3378,7 +2073,7 @@ function buildD3Formatter(formatStr) {
|
|
|
3378
2073
|
if (!formatStr) return null;
|
|
3379
2074
|
if (formatStr === "ordinal") return formatOrdinal;
|
|
3380
2075
|
try {
|
|
3381
|
-
const fmt =
|
|
2076
|
+
const fmt = d3Format(formatStr);
|
|
3382
2077
|
if (formatStr.includes("s")) {
|
|
3383
2078
|
return (v) => fmt(v).replace(/G$/, "B");
|
|
3384
2079
|
}
|
|
@@ -3387,7 +2082,7 @@ function buildD3Formatter(formatStr) {
|
|
|
3387
2082
|
const m = formatStr.match(D3_FORMAT_SUFFIX_RE);
|
|
3388
2083
|
if (m) {
|
|
3389
2084
|
try {
|
|
3390
|
-
const fmt =
|
|
2085
|
+
const fmt = d3Format(m[1]);
|
|
3391
2086
|
const suffix = m[2];
|
|
3392
2087
|
return (v) => fmt(v) + suffix;
|
|
3393
2088
|
} catch {
|
|
@@ -3399,9 +2094,9 @@ function buildD3Formatter(formatStr) {
|
|
|
3399
2094
|
function formatPercent(value, options) {
|
|
3400
2095
|
const fraction = options?.fraction ?? true;
|
|
3401
2096
|
if (fraction) {
|
|
3402
|
-
return
|
|
2097
|
+
return FORMAT_PERCENT_FRACTION(value);
|
|
3403
2098
|
}
|
|
3404
|
-
return `${
|
|
2099
|
+
return `${FORMAT_PERCENT_RAW(value)}%`;
|
|
3405
2100
|
}
|
|
3406
2101
|
function formatCurrency(value, options) {
|
|
3407
2102
|
const compact = options?.compact ?? false;
|
|
@@ -3414,9 +2109,9 @@ function formatCurrency(value, options) {
|
|
|
3414
2109
|
return `${sign}$${formatNumber(abs)}`;
|
|
3415
2110
|
}
|
|
3416
2111
|
if (Number.isInteger(value)) {
|
|
3417
|
-
return sign +
|
|
2112
|
+
return sign + FORMAT_CURRENCY_INTEGER(abs);
|
|
3418
2113
|
}
|
|
3419
|
-
return sign +
|
|
2114
|
+
return sign + FORMAT_CURRENCY_DECIMAL(abs);
|
|
3420
2115
|
}
|
|
3421
2116
|
function computeFieldFormatContext(values, surface) {
|
|
3422
2117
|
let min = Infinity;
|
|
@@ -3495,10 +2190,10 @@ function buildCompactStepFormatter(step) {
|
|
|
3495
2190
|
const { suffix, divisor } = unitFor(abs);
|
|
3496
2191
|
const p = fractionDigits(step / divisor);
|
|
3497
2192
|
if (p > 2) {
|
|
3498
|
-
return Number.isInteger(v) ?
|
|
2193
|
+
return Number.isInteger(v) ? FORMAT_INTEGER(v) : FORMAT_DECIMAL(v);
|
|
3499
2194
|
}
|
|
3500
2195
|
const sign = v < 0 ? "-" : "";
|
|
3501
|
-
return sign +
|
|
2196
|
+
return sign + FORMAT_STEP_FRACTION[p](abs / divisor) + suffix;
|
|
3502
2197
|
};
|
|
3503
2198
|
}
|
|
3504
2199
|
var GRANULARITY_FORMATS = {
|
|
@@ -3535,9 +2230,27 @@ function formatDate(value, _locale, granularity, useUtc = true, compact = false)
|
|
|
3535
2230
|
}
|
|
3536
2231
|
const formatStr = (compact ? GRANULARITY_FORMATS_COMPACT : GRANULARITY_FORMATS)[gran];
|
|
3537
2232
|
if (useUtc) {
|
|
3538
|
-
return
|
|
2233
|
+
return getUtcFormatter(formatStr)(date);
|
|
2234
|
+
}
|
|
2235
|
+
return getTimeFormatter(formatStr)(date);
|
|
2236
|
+
}
|
|
2237
|
+
var TIME_FORMAT_CACHE = /* @__PURE__ */ new Map();
|
|
2238
|
+
var UTC_FORMAT_CACHE = /* @__PURE__ */ new Map();
|
|
2239
|
+
function getTimeFormatter(formatStr) {
|
|
2240
|
+
let fmt = TIME_FORMAT_CACHE.get(formatStr);
|
|
2241
|
+
if (!fmt) {
|
|
2242
|
+
fmt = timeFormat(formatStr);
|
|
2243
|
+
TIME_FORMAT_CACHE.set(formatStr, fmt);
|
|
2244
|
+
}
|
|
2245
|
+
return fmt;
|
|
2246
|
+
}
|
|
2247
|
+
function getUtcFormatter(formatStr) {
|
|
2248
|
+
let fmt = UTC_FORMAT_CACHE.get(formatStr);
|
|
2249
|
+
if (!fmt) {
|
|
2250
|
+
fmt = utcFormat(formatStr);
|
|
2251
|
+
UTC_FORMAT_CACHE.set(formatStr, fmt);
|
|
3539
2252
|
}
|
|
3540
|
-
return
|
|
2253
|
+
return fmt;
|
|
3541
2254
|
}
|
|
3542
2255
|
function buildTemporalFormatter(formatStr) {
|
|
3543
2256
|
if (!formatStr) return null;
|