@opendata-ai/openchart-core 2.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -101,8 +101,355 @@ function isRefLineAnnotation(annotation) {
101
101
  return annotation.type === "refline";
102
102
  }
103
103
 
104
+ // ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/define.js
105
+ function define_default(constructor, factory, prototype) {
106
+ constructor.prototype = factory.prototype = prototype;
107
+ prototype.constructor = constructor;
108
+ }
109
+ function extend(parent, definition) {
110
+ var prototype = Object.create(parent.prototype);
111
+ for (var key in definition) prototype[key] = definition[key];
112
+ return prototype;
113
+ }
114
+
115
+ // ../../node_modules/.bun/d3-color@3.1.0/node_modules/d3-color/src/color.js
116
+ function Color() {
117
+ }
118
+ var darker = 0.7;
119
+ var brighter = 1 / darker;
120
+ var reI = "\\s*([+-]?\\d+)\\s*";
121
+ var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
122
+ var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
123
+ var reHex = /^#([0-9a-f]{3,8})$/;
124
+ var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
125
+ var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
126
+ var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
127
+ var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
128
+ var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
129
+ var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
130
+ var named = {
131
+ aliceblue: 15792383,
132
+ antiquewhite: 16444375,
133
+ aqua: 65535,
134
+ aquamarine: 8388564,
135
+ azure: 15794175,
136
+ beige: 16119260,
137
+ bisque: 16770244,
138
+ black: 0,
139
+ blanchedalmond: 16772045,
140
+ blue: 255,
141
+ blueviolet: 9055202,
142
+ brown: 10824234,
143
+ burlywood: 14596231,
144
+ cadetblue: 6266528,
145
+ chartreuse: 8388352,
146
+ chocolate: 13789470,
147
+ coral: 16744272,
148
+ cornflowerblue: 6591981,
149
+ cornsilk: 16775388,
150
+ crimson: 14423100,
151
+ cyan: 65535,
152
+ darkblue: 139,
153
+ darkcyan: 35723,
154
+ darkgoldenrod: 12092939,
155
+ darkgray: 11119017,
156
+ darkgreen: 25600,
157
+ darkgrey: 11119017,
158
+ darkkhaki: 12433259,
159
+ darkmagenta: 9109643,
160
+ darkolivegreen: 5597999,
161
+ darkorange: 16747520,
162
+ darkorchid: 10040012,
163
+ darkred: 9109504,
164
+ darksalmon: 15308410,
165
+ darkseagreen: 9419919,
166
+ darkslateblue: 4734347,
167
+ darkslategray: 3100495,
168
+ darkslategrey: 3100495,
169
+ darkturquoise: 52945,
170
+ darkviolet: 9699539,
171
+ deeppink: 16716947,
172
+ deepskyblue: 49151,
173
+ dimgray: 6908265,
174
+ dimgrey: 6908265,
175
+ dodgerblue: 2003199,
176
+ firebrick: 11674146,
177
+ floralwhite: 16775920,
178
+ forestgreen: 2263842,
179
+ fuchsia: 16711935,
180
+ gainsboro: 14474460,
181
+ ghostwhite: 16316671,
182
+ gold: 16766720,
183
+ goldenrod: 14329120,
184
+ gray: 8421504,
185
+ green: 32768,
186
+ greenyellow: 11403055,
187
+ grey: 8421504,
188
+ honeydew: 15794160,
189
+ hotpink: 16738740,
190
+ indianred: 13458524,
191
+ indigo: 4915330,
192
+ ivory: 16777200,
193
+ khaki: 15787660,
194
+ lavender: 15132410,
195
+ lavenderblush: 16773365,
196
+ lawngreen: 8190976,
197
+ lemonchiffon: 16775885,
198
+ lightblue: 11393254,
199
+ lightcoral: 15761536,
200
+ lightcyan: 14745599,
201
+ lightgoldenrodyellow: 16448210,
202
+ lightgray: 13882323,
203
+ lightgreen: 9498256,
204
+ lightgrey: 13882323,
205
+ lightpink: 16758465,
206
+ lightsalmon: 16752762,
207
+ lightseagreen: 2142890,
208
+ lightskyblue: 8900346,
209
+ lightslategray: 7833753,
210
+ lightslategrey: 7833753,
211
+ lightsteelblue: 11584734,
212
+ lightyellow: 16777184,
213
+ lime: 65280,
214
+ limegreen: 3329330,
215
+ linen: 16445670,
216
+ magenta: 16711935,
217
+ maroon: 8388608,
218
+ mediumaquamarine: 6737322,
219
+ mediumblue: 205,
220
+ mediumorchid: 12211667,
221
+ mediumpurple: 9662683,
222
+ mediumseagreen: 3978097,
223
+ mediumslateblue: 8087790,
224
+ mediumspringgreen: 64154,
225
+ mediumturquoise: 4772300,
226
+ mediumvioletred: 13047173,
227
+ midnightblue: 1644912,
228
+ mintcream: 16121850,
229
+ mistyrose: 16770273,
230
+ moccasin: 16770229,
231
+ navajowhite: 16768685,
232
+ navy: 128,
233
+ oldlace: 16643558,
234
+ olive: 8421376,
235
+ olivedrab: 7048739,
236
+ orange: 16753920,
237
+ orangered: 16729344,
238
+ orchid: 14315734,
239
+ palegoldenrod: 15657130,
240
+ palegreen: 10025880,
241
+ paleturquoise: 11529966,
242
+ palevioletred: 14381203,
243
+ papayawhip: 16773077,
244
+ peachpuff: 16767673,
245
+ peru: 13468991,
246
+ pink: 16761035,
247
+ plum: 14524637,
248
+ powderblue: 11591910,
249
+ purple: 8388736,
250
+ rebeccapurple: 6697881,
251
+ red: 16711680,
252
+ rosybrown: 12357519,
253
+ royalblue: 4286945,
254
+ saddlebrown: 9127187,
255
+ salmon: 16416882,
256
+ sandybrown: 16032864,
257
+ seagreen: 3050327,
258
+ seashell: 16774638,
259
+ sienna: 10506797,
260
+ silver: 12632256,
261
+ skyblue: 8900331,
262
+ slateblue: 6970061,
263
+ slategray: 7372944,
264
+ slategrey: 7372944,
265
+ snow: 16775930,
266
+ springgreen: 65407,
267
+ steelblue: 4620980,
268
+ tan: 13808780,
269
+ teal: 32896,
270
+ thistle: 14204888,
271
+ tomato: 16737095,
272
+ turquoise: 4251856,
273
+ violet: 15631086,
274
+ wheat: 16113331,
275
+ white: 16777215,
276
+ whitesmoke: 16119285,
277
+ yellow: 16776960,
278
+ yellowgreen: 10145074
279
+ };
280
+ define_default(Color, color, {
281
+ copy(channels) {
282
+ return Object.assign(new this.constructor(), this, channels);
283
+ },
284
+ displayable() {
285
+ return this.rgb().displayable();
286
+ },
287
+ hex: color_formatHex,
288
+ // Deprecated! Use color.formatHex.
289
+ formatHex: color_formatHex,
290
+ formatHex8: color_formatHex8,
291
+ formatHsl: color_formatHsl,
292
+ formatRgb: color_formatRgb,
293
+ toString: color_formatRgb
294
+ });
295
+ function color_formatHex() {
296
+ return this.rgb().formatHex();
297
+ }
298
+ function color_formatHex8() {
299
+ return this.rgb().formatHex8();
300
+ }
301
+ function color_formatHsl() {
302
+ return hslConvert(this).formatHsl();
303
+ }
304
+ function color_formatRgb() {
305
+ return this.rgb().formatRgb();
306
+ }
307
+ function color(format2) {
308
+ var m, l;
309
+ format2 = (format2 + "").trim().toLowerCase();
310
+ 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;
311
+ }
312
+ function rgbn(n) {
313
+ return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
314
+ }
315
+ function rgba(r, g, b, a) {
316
+ if (a <= 0) r = g = b = NaN;
317
+ return new Rgb(r, g, b, a);
318
+ }
319
+ function rgbConvert(o) {
320
+ if (!(o instanceof Color)) o = color(o);
321
+ if (!o) return new Rgb();
322
+ o = o.rgb();
323
+ return new Rgb(o.r, o.g, o.b, o.opacity);
324
+ }
325
+ function rgb(r, g, b, opacity) {
326
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
327
+ }
328
+ function Rgb(r, g, b, opacity) {
329
+ this.r = +r;
330
+ this.g = +g;
331
+ this.b = +b;
332
+ this.opacity = +opacity;
333
+ }
334
+ define_default(Rgb, rgb, extend(Color, {
335
+ brighter(k) {
336
+ k = k == null ? brighter : Math.pow(brighter, k);
337
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
338
+ },
339
+ darker(k) {
340
+ k = k == null ? darker : Math.pow(darker, k);
341
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
342
+ },
343
+ rgb() {
344
+ return this;
345
+ },
346
+ clamp() {
347
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
348
+ },
349
+ displayable() {
350
+ 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);
351
+ },
352
+ hex: rgb_formatHex,
353
+ // Deprecated! Use color.formatHex.
354
+ formatHex: rgb_formatHex,
355
+ formatHex8: rgb_formatHex8,
356
+ formatRgb: rgb_formatRgb,
357
+ toString: rgb_formatRgb
358
+ }));
359
+ function rgb_formatHex() {
360
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
361
+ }
362
+ function rgb_formatHex8() {
363
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
364
+ }
365
+ function rgb_formatRgb() {
366
+ const a = clampa(this.opacity);
367
+ return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
368
+ }
369
+ function clampa(opacity) {
370
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
371
+ }
372
+ function clampi(value) {
373
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
374
+ }
375
+ function hex(value) {
376
+ value = clampi(value);
377
+ return (value < 16 ? "0" : "") + value.toString(16);
378
+ }
379
+ function hsla(h, s, l, a) {
380
+ if (a <= 0) h = s = l = NaN;
381
+ else if (l <= 0 || l >= 1) h = s = NaN;
382
+ else if (s <= 0) h = NaN;
383
+ return new Hsl(h, s, l, a);
384
+ }
385
+ function hslConvert(o) {
386
+ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
387
+ if (!(o instanceof Color)) o = color(o);
388
+ if (!o) return new Hsl();
389
+ if (o instanceof Hsl) return o;
390
+ o = o.rgb();
391
+ 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;
392
+ if (s) {
393
+ if (r === max) h = (g - b) / s + (g < b) * 6;
394
+ else if (g === max) h = (b - r) / s + 2;
395
+ else h = (r - g) / s + 4;
396
+ s /= l < 0.5 ? max + min : 2 - max - min;
397
+ h *= 60;
398
+ } else {
399
+ s = l > 0 && l < 1 ? 0 : h;
400
+ }
401
+ return new Hsl(h, s, l, o.opacity);
402
+ }
403
+ function hsl(h, s, l, opacity) {
404
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
405
+ }
406
+ function Hsl(h, s, l, opacity) {
407
+ this.h = +h;
408
+ this.s = +s;
409
+ this.l = +l;
410
+ this.opacity = +opacity;
411
+ }
412
+ define_default(Hsl, hsl, extend(Color, {
413
+ brighter(k) {
414
+ k = k == null ? brighter : Math.pow(brighter, k);
415
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
416
+ },
417
+ darker(k) {
418
+ k = k == null ? darker : Math.pow(darker, k);
419
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
420
+ },
421
+ rgb() {
422
+ 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;
423
+ return new Rgb(
424
+ hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
425
+ hsl2rgb(h, m1, m2),
426
+ hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
427
+ this.opacity
428
+ );
429
+ },
430
+ clamp() {
431
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
432
+ },
433
+ displayable() {
434
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
435
+ },
436
+ formatHsl() {
437
+ const a = clampa(this.opacity);
438
+ return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
439
+ }
440
+ }));
441
+ function clamph(value) {
442
+ value = (value || 0) % 360;
443
+ return value < 0 ? value + 360 : value;
444
+ }
445
+ function clampt(value) {
446
+ return Math.max(0, Math.min(1, value || 0));
447
+ }
448
+ function hsl2rgb(h, m1, m2) {
449
+ return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
450
+ }
451
+
104
452
  // src/colors/colorblind.ts
105
- import { rgb } from "d3-color";
106
453
  var PROTAN_MATRIX = [
107
454
  [0.567, 0.433, 0],
108
455
  [0.558, 0.442, 0],
@@ -131,9 +478,9 @@ function delinearize(v) {
131
478
  const s = v <= 31308e-7 ? v * 12.92 : 1.055 * v ** (1 / 2.4) - 0.055;
132
479
  return Math.round(Math.max(0, Math.min(255, s * 255)));
133
480
  }
134
- function simulateColorBlindness(color, type) {
135
- const c = rgb(color);
136
- if (c == null) return color;
481
+ function simulateColorBlindness(color2, type) {
482
+ const c = rgb(color2);
483
+ if (c == null) return color2;
137
484
  const lin = [linearize(c.r), linearize(c.g), linearize(c.b)];
138
485
  const m = MATRICES[type];
139
486
  const r = m[0][0] * lin[0] + m[0][1] * lin[1] + m[0][2] * lin[2];
@@ -159,9 +506,8 @@ function checkPaletteDistinguishability(colors, type, minDistance = 30) {
159
506
  }
160
507
 
161
508
  // src/colors/contrast.ts
162
- import { rgb as rgb2 } from "d3-color";
163
- function relativeLuminance(color) {
164
- const c = rgb2(color);
509
+ function relativeLuminance(color2) {
510
+ const c = rgb(color2);
165
511
  if (c == null) return 0;
166
512
  const srgb = [c.r / 255, c.g / 255, c.b / 255];
167
513
  const linear = srgb.map((v) => v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);
@@ -171,8 +517,8 @@ function contrastRatio(fg, bg) {
171
517
  const l1 = relativeLuminance(fg);
172
518
  const l2 = relativeLuminance(bg);
173
519
  const lighter = Math.max(l1, l2);
174
- const darker = Math.min(l1, l2);
175
- return (lighter + 0.05) / (darker + 0.05);
520
+ const darker2 = Math.min(l1, l2);
521
+ return (lighter + 0.05) / (darker2 + 0.05);
176
522
  }
177
523
  function meetsAA(fg, bg, largeText = false) {
178
524
  const ratio = contrastRatio(fg, bg);
@@ -182,7 +528,7 @@ function findAccessibleColor(baseColor, bg, targetRatio = 4.5) {
182
528
  if (contrastRatio(baseColor, bg) >= targetRatio) {
183
529
  return baseColor;
184
530
  }
185
- const c = rgb2(baseColor);
531
+ const c = rgb(baseColor);
186
532
  if (c == null) return baseColor;
187
533
  const bgLum = relativeLuminance(bg);
188
534
  const bgIsLight = bgLum > 0.5;
@@ -191,11 +537,11 @@ function findAccessibleColor(baseColor, bg, targetRatio = 4.5) {
191
537
  let best = baseColor;
192
538
  for (let i = 0; i < 20; i++) {
193
539
  const mid = (lo + hi) / 2;
194
- const adjusted = bgIsLight ? 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);
195
- const hex = adjusted.formatHex();
196
- const ratio = contrastRatio(hex, bg);
540
+ const adjusted = bgIsLight ? rgb(c.r * (1 - mid), c.g * (1 - mid), c.b * (1 - mid)) : rgb(c.r + (255 - c.r) * mid, c.g + (255 - c.g) * mid, c.b + (255 - c.b) * mid);
541
+ const hex2 = adjusted.formatHex();
542
+ const ratio = contrastRatio(hex2, bg);
197
543
  if (ratio >= targetRatio) {
198
- best = hex;
544
+ best = hex2;
199
545
  hi = mid;
200
546
  } else {
201
547
  lo = mid;
@@ -293,36 +639,35 @@ var DIVERGING_PALETTES = {
293
639
  };
294
640
 
295
641
  // src/theme/dark-mode.ts
296
- import { hsl, rgb as rgb3 } from "d3-color";
297
642
  var DARK_BG = "#1a1a2e";
298
643
  var DARK_TEXT = "#e0e0e0";
299
- function adaptColorForDarkMode(color, lightBg, darkBg) {
300
- const originalRatio = contrastRatio(color, lightBg);
301
- const c = hsl(color);
644
+ function adaptColorForDarkMode(color2, lightBg, darkBg) {
645
+ const originalRatio = contrastRatio(color2, lightBg);
646
+ const c = hsl(color2);
302
647
  if (c == null || Number.isNaN(c.h)) {
303
- const r = rgb3(color);
304
- if (r == null) return color;
648
+ const r = rgb(color2);
649
+ if (r == null) return color2;
305
650
  const darkBgLum = _luminanceFromHex(darkBg);
306
651
  const isLight = darkBgLum < 0.5;
307
- if (isLight) return color;
308
- const inverted = hsl(color);
309
- if (inverted == null) return color;
652
+ if (isLight) return color2;
653
+ const inverted = hsl(color2);
654
+ if (inverted == null) return color2;
310
655
  inverted.l = 1 - inverted.l;
311
656
  return inverted.formatHex();
312
657
  }
313
658
  let lo = 0;
314
659
  let hi = 1;
315
- let bestColor = color;
660
+ let bestColor = color2;
316
661
  let bestDiff = Infinity;
317
662
  for (let i = 0; i < 20; i++) {
318
663
  const mid = (lo + hi) / 2;
319
664
  const candidate = hsl(c.h, c.s, mid);
320
- const hex = candidate.formatHex();
321
- const ratio = contrastRatio(hex, darkBg);
665
+ const hex2 = candidate.formatHex();
666
+ const ratio = contrastRatio(hex2, darkBg);
322
667
  const diff = Math.abs(ratio - originalRatio);
323
668
  if (diff < bestDiff) {
324
669
  bestDiff = diff;
325
- bestColor = hex;
670
+ bestColor = hex2;
326
671
  }
327
672
  if (ratio < originalRatio) {
328
673
  lo = mid;
@@ -332,8 +677,8 @@ function adaptColorForDarkMode(color, lightBg, darkBg) {
332
677
  }
333
678
  return bestColor;
334
679
  }
335
- function _luminanceFromHex(color) {
336
- const c = rgb3(color);
680
+ function _luminanceFromHex(color2) {
681
+ const c = rgb(color2);
337
682
  if (c == null) return 0;
338
683
  return (0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b) / 255;
339
684
  }
@@ -488,8 +833,8 @@ function themeConfigToPartial(config) {
488
833
  }
489
834
  return partial;
490
835
  }
491
- function relativeLuminance2(hex) {
492
- const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
836
+ function relativeLuminance2(hex2) {
837
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex2.trim());
493
838
  if (!m) return 0;
494
839
  const r = parseInt(m[1].slice(0, 2), 16) / 255;
495
840
  const g = parseInt(m[1].slice(2, 4), 16) / 255;
@@ -497,8 +842,8 @@ function relativeLuminance2(hex) {
497
842
  const toLinear = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
498
843
  return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
499
844
  }
500
- function isDarkBackground(hex) {
501
- return relativeLuminance2(hex) < 0.2;
845
+ function isDarkBackground(hex2) {
846
+ return relativeLuminance2(hex2) < 0.2;
502
847
  }
503
848
  function adaptChromeForDarkBg(theme, textColor) {
504
849
  const light = DEFAULT_THEME.chrome;
@@ -528,9 +873,9 @@ function adaptChromeForDarkBg(theme, textColor) {
528
873
  }
529
874
  };
530
875
  }
531
- function adjustOpacity(hex, opacity) {
532
- const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
533
- if (!m) return hex;
876
+ function adjustOpacity(hex2, opacity) {
877
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex2.trim());
878
+ if (!m) return hex2;
534
879
  const r = parseInt(m[1].slice(0, 2), 16);
535
880
  const g = parseInt(m[1].slice(2, 4), 16);
536
881
  const b = parseInt(m[1].slice(4, 6), 16);
@@ -822,15 +1167,995 @@ function resolveCollisions(labels) {
822
1167
  return results;
823
1168
  }
824
1169
 
1170
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatDecimal.js
1171
+ function formatDecimal_default(x) {
1172
+ return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
1173
+ }
1174
+ function formatDecimalParts(x, p) {
1175
+ if (!isFinite(x) || x === 0) return null;
1176
+ var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
1177
+ return [
1178
+ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
1179
+ +x.slice(i + 1)
1180
+ ];
1181
+ }
1182
+
1183
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/exponent.js
1184
+ function exponent_default(x) {
1185
+ return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
1186
+ }
1187
+
1188
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatGroup.js
1189
+ function formatGroup_default(grouping, thousands) {
1190
+ return function(value, width) {
1191
+ var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
1192
+ while (i > 0 && g > 0) {
1193
+ if (length + g + 1 > width) g = Math.max(1, width - length);
1194
+ t.push(value.substring(i -= g, i + g));
1195
+ if ((length += g + 1) > width) break;
1196
+ g = grouping[j = (j + 1) % grouping.length];
1197
+ }
1198
+ return t.reverse().join(thousands);
1199
+ };
1200
+ }
1201
+
1202
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatNumerals.js
1203
+ function formatNumerals_default(numerals) {
1204
+ return function(value) {
1205
+ return value.replace(/[0-9]/g, function(i) {
1206
+ return numerals[+i];
1207
+ });
1208
+ };
1209
+ }
1210
+
1211
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatSpecifier.js
1212
+ var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
1213
+ function formatSpecifier(specifier) {
1214
+ if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
1215
+ var match;
1216
+ return new FormatSpecifier({
1217
+ fill: match[1],
1218
+ align: match[2],
1219
+ sign: match[3],
1220
+ symbol: match[4],
1221
+ zero: match[5],
1222
+ width: match[6],
1223
+ comma: match[7],
1224
+ precision: match[8] && match[8].slice(1),
1225
+ trim: match[9],
1226
+ type: match[10]
1227
+ });
1228
+ }
1229
+ formatSpecifier.prototype = FormatSpecifier.prototype;
1230
+ function FormatSpecifier(specifier) {
1231
+ this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
1232
+ this.align = specifier.align === void 0 ? ">" : specifier.align + "";
1233
+ this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
1234
+ this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
1235
+ this.zero = !!specifier.zero;
1236
+ this.width = specifier.width === void 0 ? void 0 : +specifier.width;
1237
+ this.comma = !!specifier.comma;
1238
+ this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
1239
+ this.trim = !!specifier.trim;
1240
+ this.type = specifier.type === void 0 ? "" : specifier.type + "";
1241
+ }
1242
+ FormatSpecifier.prototype.toString = function() {
1243
+ 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;
1244
+ };
1245
+
1246
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatTrim.js
1247
+ function formatTrim_default(s) {
1248
+ out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
1249
+ switch (s[i]) {
1250
+ case ".":
1251
+ i0 = i1 = i;
1252
+ break;
1253
+ case "0":
1254
+ if (i0 === 0) i0 = i;
1255
+ i1 = i;
1256
+ break;
1257
+ default:
1258
+ if (!+s[i]) break out;
1259
+ if (i0 > 0) i0 = 0;
1260
+ break;
1261
+ }
1262
+ }
1263
+ return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
1264
+ }
1265
+
1266
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatPrefixAuto.js
1267
+ var prefixExponent;
1268
+ function formatPrefixAuto_default(x, p) {
1269
+ var d = formatDecimalParts(x, p);
1270
+ if (!d) return prefixExponent = void 0, x.toPrecision(p);
1271
+ 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;
1272
+ 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];
1273
+ }
1274
+
1275
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatRounded.js
1276
+ function formatRounded_default(x, p) {
1277
+ var d = formatDecimalParts(x, p);
1278
+ if (!d) return x + "";
1279
+ var coefficient = d[0], exponent = d[1];
1280
+ 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");
1281
+ }
1282
+
1283
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/formatTypes.js
1284
+ var formatTypes_default = {
1285
+ "%": (x, p) => (x * 100).toFixed(p),
1286
+ "b": (x) => Math.round(x).toString(2),
1287
+ "c": (x) => x + "",
1288
+ "d": formatDecimal_default,
1289
+ "e": (x, p) => x.toExponential(p),
1290
+ "f": (x, p) => x.toFixed(p),
1291
+ "g": (x, p) => x.toPrecision(p),
1292
+ "o": (x) => Math.round(x).toString(8),
1293
+ "p": (x, p) => formatRounded_default(x * 100, p),
1294
+ "r": formatRounded_default,
1295
+ "s": formatPrefixAuto_default,
1296
+ "X": (x) => Math.round(x).toString(16).toUpperCase(),
1297
+ "x": (x) => Math.round(x).toString(16)
1298
+ };
1299
+
1300
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/identity.js
1301
+ function identity_default(x) {
1302
+ return x;
1303
+ }
1304
+
1305
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/locale.js
1306
+ var map = Array.prototype.map;
1307
+ var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
1308
+ function locale_default(locale3) {
1309
+ 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 + "";
1310
+ function newFormat(specifier, options) {
1311
+ specifier = formatSpecifier(specifier);
1312
+ 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;
1313
+ if (type === "n") comma = true, type = "g";
1314
+ else if (!formatTypes_default[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
1315
+ if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
1316
+ 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 : "");
1317
+ var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type);
1318
+ precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
1319
+ function format2(value) {
1320
+ var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
1321
+ if (type === "c") {
1322
+ valueSuffix = formatType(value) + valueSuffix;
1323
+ value = "";
1324
+ } else {
1325
+ value = +value;
1326
+ var valueNegative = value < 0 || 1 / value < 0;
1327
+ value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
1328
+ if (trim) value = formatTrim_default(value);
1329
+ if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
1330
+ valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
1331
+ valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
1332
+ if (maybeSuffix) {
1333
+ i = -1, n = value.length;
1334
+ while (++i < n) {
1335
+ if (c = value.charCodeAt(i), 48 > c || c > 57) {
1336
+ valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
1337
+ value = value.slice(0, i);
1338
+ break;
1339
+ }
1340
+ }
1341
+ }
1342
+ }
1343
+ if (comma && !zero) value = group(value, Infinity);
1344
+ var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
1345
+ if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
1346
+ switch (align) {
1347
+ case "<":
1348
+ value = valuePrefix + value + valueSuffix + padding;
1349
+ break;
1350
+ case "=":
1351
+ value = valuePrefix + padding + value + valueSuffix;
1352
+ break;
1353
+ case "^":
1354
+ value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
1355
+ break;
1356
+ default:
1357
+ value = padding + valuePrefix + value + valueSuffix;
1358
+ break;
1359
+ }
1360
+ return numerals(value);
1361
+ }
1362
+ format2.toString = function() {
1363
+ return specifier + "";
1364
+ };
1365
+ return format2;
1366
+ }
1367
+ function formatPrefix2(specifier, value) {
1368
+ 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] });
1369
+ return function(value2) {
1370
+ return f(k * value2);
1371
+ };
1372
+ }
1373
+ return {
1374
+ format: newFormat,
1375
+ formatPrefix: formatPrefix2
1376
+ };
1377
+ }
1378
+
1379
+ // ../../node_modules/.bun/d3-format@3.1.2/node_modules/d3-format/src/defaultLocale.js
1380
+ var locale;
1381
+ var format;
1382
+ var formatPrefix;
1383
+ defaultLocale({
1384
+ thousands: ",",
1385
+ grouping: [3],
1386
+ currency: ["$", ""]
1387
+ });
1388
+ function defaultLocale(definition) {
1389
+ locale = locale_default(definition);
1390
+ format = locale.format;
1391
+ formatPrefix = locale.formatPrefix;
1392
+ return locale;
1393
+ }
1394
+
1395
+ // ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/interval.js
1396
+ var t0 = /* @__PURE__ */ new Date();
1397
+ var t1 = /* @__PURE__ */ new Date();
1398
+ function timeInterval(floori, offseti, count, field) {
1399
+ function interval(date) {
1400
+ return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;
1401
+ }
1402
+ interval.floor = (date) => {
1403
+ return floori(date = /* @__PURE__ */ new Date(+date)), date;
1404
+ };
1405
+ interval.ceil = (date) => {
1406
+ return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
1407
+ };
1408
+ interval.round = (date) => {
1409
+ const d0 = interval(date), d1 = interval.ceil(date);
1410
+ return date - d0 < d1 - date ? d0 : d1;
1411
+ };
1412
+ interval.offset = (date, step) => {
1413
+ return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;
1414
+ };
1415
+ interval.range = (start, stop, step) => {
1416
+ const range = [];
1417
+ start = interval.ceil(start);
1418
+ step = step == null ? 1 : Math.floor(step);
1419
+ if (!(start < stop) || !(step > 0)) return range;
1420
+ let previous;
1421
+ do
1422
+ range.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start);
1423
+ while (previous < start && start < stop);
1424
+ return range;
1425
+ };
1426
+ interval.filter = (test) => {
1427
+ return timeInterval((date) => {
1428
+ if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
1429
+ }, (date, step) => {
1430
+ if (date >= date) {
1431
+ if (step < 0) while (++step <= 0) {
1432
+ while (offseti(date, -1), !test(date)) {
1433
+ }
1434
+ }
1435
+ else while (--step >= 0) {
1436
+ while (offseti(date, 1), !test(date)) {
1437
+ }
1438
+ }
1439
+ }
1440
+ });
1441
+ };
1442
+ if (count) {
1443
+ interval.count = (start, end) => {
1444
+ t0.setTime(+start), t1.setTime(+end);
1445
+ floori(t0), floori(t1);
1446
+ return Math.floor(count(t0, t1));
1447
+ };
1448
+ interval.every = (step) => {
1449
+ step = Math.floor(step);
1450
+ return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d) => field(d) % step === 0 : (d) => interval.count(0, d) % step === 0);
1451
+ };
1452
+ }
1453
+ return interval;
1454
+ }
1455
+
1456
+ // ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/duration.js
1457
+ var durationSecond = 1e3;
1458
+ var durationMinute = durationSecond * 60;
1459
+ var durationHour = durationMinute * 60;
1460
+ var durationDay = durationHour * 24;
1461
+ var durationWeek = durationDay * 7;
1462
+ var durationMonth = durationDay * 30;
1463
+ var durationYear = durationDay * 365;
1464
+
1465
+ // ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/day.js
1466
+ var timeDay = timeInterval(
1467
+ (date) => date.setHours(0, 0, 0, 0),
1468
+ (date, step) => date.setDate(date.getDate() + step),
1469
+ (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
1470
+ (date) => date.getDate() - 1
1471
+ );
1472
+ var timeDays = timeDay.range;
1473
+ var utcDay = timeInterval((date) => {
1474
+ date.setUTCHours(0, 0, 0, 0);
1475
+ }, (date, step) => {
1476
+ date.setUTCDate(date.getUTCDate() + step);
1477
+ }, (start, end) => {
1478
+ return (end - start) / durationDay;
1479
+ }, (date) => {
1480
+ return date.getUTCDate() - 1;
1481
+ });
1482
+ var utcDays = utcDay.range;
1483
+ var unixDay = timeInterval((date) => {
1484
+ date.setUTCHours(0, 0, 0, 0);
1485
+ }, (date, step) => {
1486
+ date.setUTCDate(date.getUTCDate() + step);
1487
+ }, (start, end) => {
1488
+ return (end - start) / durationDay;
1489
+ }, (date) => {
1490
+ return Math.floor(date / durationDay);
1491
+ });
1492
+ var unixDays = unixDay.range;
1493
+
1494
+ // ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/week.js
1495
+ function timeWeekday(i) {
1496
+ return timeInterval((date) => {
1497
+ date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
1498
+ date.setHours(0, 0, 0, 0);
1499
+ }, (date, step) => {
1500
+ date.setDate(date.getDate() + step * 7);
1501
+ }, (start, end) => {
1502
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
1503
+ });
1504
+ }
1505
+ var timeSunday = timeWeekday(0);
1506
+ var timeMonday = timeWeekday(1);
1507
+ var timeTuesday = timeWeekday(2);
1508
+ var timeWednesday = timeWeekday(3);
1509
+ var timeThursday = timeWeekday(4);
1510
+ var timeFriday = timeWeekday(5);
1511
+ var timeSaturday = timeWeekday(6);
1512
+ var timeSundays = timeSunday.range;
1513
+ var timeMondays = timeMonday.range;
1514
+ var timeTuesdays = timeTuesday.range;
1515
+ var timeWednesdays = timeWednesday.range;
1516
+ var timeThursdays = timeThursday.range;
1517
+ var timeFridays = timeFriday.range;
1518
+ var timeSaturdays = timeSaturday.range;
1519
+ function utcWeekday(i) {
1520
+ return timeInterval((date) => {
1521
+ date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
1522
+ date.setUTCHours(0, 0, 0, 0);
1523
+ }, (date, step) => {
1524
+ date.setUTCDate(date.getUTCDate() + step * 7);
1525
+ }, (start, end) => {
1526
+ return (end - start) / durationWeek;
1527
+ });
1528
+ }
1529
+ var utcSunday = utcWeekday(0);
1530
+ var utcMonday = utcWeekday(1);
1531
+ var utcTuesday = utcWeekday(2);
1532
+ var utcWednesday = utcWeekday(3);
1533
+ var utcThursday = utcWeekday(4);
1534
+ var utcFriday = utcWeekday(5);
1535
+ var utcSaturday = utcWeekday(6);
1536
+ var utcSundays = utcSunday.range;
1537
+ var utcMondays = utcMonday.range;
1538
+ var utcTuesdays = utcTuesday.range;
1539
+ var utcWednesdays = utcWednesday.range;
1540
+ var utcThursdays = utcThursday.range;
1541
+ var utcFridays = utcFriday.range;
1542
+ var utcSaturdays = utcSaturday.range;
1543
+
1544
+ // ../../node_modules/.bun/d3-time@3.1.0/node_modules/d3-time/src/year.js
1545
+ var timeYear = timeInterval((date) => {
1546
+ date.setMonth(0, 1);
1547
+ date.setHours(0, 0, 0, 0);
1548
+ }, (date, step) => {
1549
+ date.setFullYear(date.getFullYear() + step);
1550
+ }, (start, end) => {
1551
+ return end.getFullYear() - start.getFullYear();
1552
+ }, (date) => {
1553
+ return date.getFullYear();
1554
+ });
1555
+ timeYear.every = (k) => {
1556
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
1557
+ date.setFullYear(Math.floor(date.getFullYear() / k) * k);
1558
+ date.setMonth(0, 1);
1559
+ date.setHours(0, 0, 0, 0);
1560
+ }, (date, step) => {
1561
+ date.setFullYear(date.getFullYear() + step * k);
1562
+ });
1563
+ };
1564
+ var timeYears = timeYear.range;
1565
+ var utcYear = timeInterval((date) => {
1566
+ date.setUTCMonth(0, 1);
1567
+ date.setUTCHours(0, 0, 0, 0);
1568
+ }, (date, step) => {
1569
+ date.setUTCFullYear(date.getUTCFullYear() + step);
1570
+ }, (start, end) => {
1571
+ return end.getUTCFullYear() - start.getUTCFullYear();
1572
+ }, (date) => {
1573
+ return date.getUTCFullYear();
1574
+ });
1575
+ utcYear.every = (k) => {
1576
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
1577
+ date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
1578
+ date.setUTCMonth(0, 1);
1579
+ date.setUTCHours(0, 0, 0, 0);
1580
+ }, (date, step) => {
1581
+ date.setUTCFullYear(date.getUTCFullYear() + step * k);
1582
+ });
1583
+ };
1584
+ var utcYears = utcYear.range;
1585
+
1586
+ // ../../node_modules/.bun/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js
1587
+ function localDate(d) {
1588
+ if (0 <= d.y && d.y < 100) {
1589
+ var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
1590
+ date.setFullYear(d.y);
1591
+ return date;
1592
+ }
1593
+ return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
1594
+ }
1595
+ function utcDate(d) {
1596
+ if (0 <= d.y && d.y < 100) {
1597
+ var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
1598
+ date.setUTCFullYear(d.y);
1599
+ return date;
1600
+ }
1601
+ return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
1602
+ }
1603
+ function newDate(y, m, d) {
1604
+ return { y, m, d, H: 0, M: 0, S: 0, L: 0 };
1605
+ }
1606
+ function formatLocale(locale3) {
1607
+ 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;
1608
+ 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);
1609
+ var formats = {
1610
+ "a": formatShortWeekday,
1611
+ "A": formatWeekday,
1612
+ "b": formatShortMonth,
1613
+ "B": formatMonth,
1614
+ "c": null,
1615
+ "d": formatDayOfMonth,
1616
+ "e": formatDayOfMonth,
1617
+ "f": formatMicroseconds,
1618
+ "g": formatYearISO,
1619
+ "G": formatFullYearISO,
1620
+ "H": formatHour24,
1621
+ "I": formatHour12,
1622
+ "j": formatDayOfYear,
1623
+ "L": formatMilliseconds,
1624
+ "m": formatMonthNumber,
1625
+ "M": formatMinutes,
1626
+ "p": formatPeriod,
1627
+ "q": formatQuarter,
1628
+ "Q": formatUnixTimestamp,
1629
+ "s": formatUnixTimestampSeconds,
1630
+ "S": formatSeconds,
1631
+ "u": formatWeekdayNumberMonday,
1632
+ "U": formatWeekNumberSunday,
1633
+ "V": formatWeekNumberISO,
1634
+ "w": formatWeekdayNumberSunday,
1635
+ "W": formatWeekNumberMonday,
1636
+ "x": null,
1637
+ "X": null,
1638
+ "y": formatYear,
1639
+ "Y": formatFullYear,
1640
+ "Z": formatZone,
1641
+ "%": formatLiteralPercent
1642
+ };
1643
+ var utcFormats = {
1644
+ "a": formatUTCShortWeekday,
1645
+ "A": formatUTCWeekday,
1646
+ "b": formatUTCShortMonth,
1647
+ "B": formatUTCMonth,
1648
+ "c": null,
1649
+ "d": formatUTCDayOfMonth,
1650
+ "e": formatUTCDayOfMonth,
1651
+ "f": formatUTCMicroseconds,
1652
+ "g": formatUTCYearISO,
1653
+ "G": formatUTCFullYearISO,
1654
+ "H": formatUTCHour24,
1655
+ "I": formatUTCHour12,
1656
+ "j": formatUTCDayOfYear,
1657
+ "L": formatUTCMilliseconds,
1658
+ "m": formatUTCMonthNumber,
1659
+ "M": formatUTCMinutes,
1660
+ "p": formatUTCPeriod,
1661
+ "q": formatUTCQuarter,
1662
+ "Q": formatUnixTimestamp,
1663
+ "s": formatUnixTimestampSeconds,
1664
+ "S": formatUTCSeconds,
1665
+ "u": formatUTCWeekdayNumberMonday,
1666
+ "U": formatUTCWeekNumberSunday,
1667
+ "V": formatUTCWeekNumberISO,
1668
+ "w": formatUTCWeekdayNumberSunday,
1669
+ "W": formatUTCWeekNumberMonday,
1670
+ "x": null,
1671
+ "X": null,
1672
+ "y": formatUTCYear,
1673
+ "Y": formatUTCFullYear,
1674
+ "Z": formatUTCZone,
1675
+ "%": formatLiteralPercent
1676
+ };
1677
+ var parses = {
1678
+ "a": parseShortWeekday,
1679
+ "A": parseWeekday,
1680
+ "b": parseShortMonth,
1681
+ "B": parseMonth,
1682
+ "c": parseLocaleDateTime,
1683
+ "d": parseDayOfMonth,
1684
+ "e": parseDayOfMonth,
1685
+ "f": parseMicroseconds,
1686
+ "g": parseYear,
1687
+ "G": parseFullYear,
1688
+ "H": parseHour24,
1689
+ "I": parseHour24,
1690
+ "j": parseDayOfYear,
1691
+ "L": parseMilliseconds,
1692
+ "m": parseMonthNumber,
1693
+ "M": parseMinutes,
1694
+ "p": parsePeriod,
1695
+ "q": parseQuarter,
1696
+ "Q": parseUnixTimestamp,
1697
+ "s": parseUnixTimestampSeconds,
1698
+ "S": parseSeconds,
1699
+ "u": parseWeekdayNumberMonday,
1700
+ "U": parseWeekNumberSunday,
1701
+ "V": parseWeekNumberISO,
1702
+ "w": parseWeekdayNumberSunday,
1703
+ "W": parseWeekNumberMonday,
1704
+ "x": parseLocaleDate,
1705
+ "X": parseLocaleTime,
1706
+ "y": parseYear,
1707
+ "Y": parseFullYear,
1708
+ "Z": parseZone,
1709
+ "%": parseLiteralPercent
1710
+ };
1711
+ formats.x = newFormat(locale_date, formats);
1712
+ formats.X = newFormat(locale_time, formats);
1713
+ formats.c = newFormat(locale_dateTime, formats);
1714
+ utcFormats.x = newFormat(locale_date, utcFormats);
1715
+ utcFormats.X = newFormat(locale_time, utcFormats);
1716
+ utcFormats.c = newFormat(locale_dateTime, utcFormats);
1717
+ function newFormat(specifier, formats2) {
1718
+ return function(date) {
1719
+ var string = [], i = -1, j = 0, n = specifier.length, c, pad2, format2;
1720
+ if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);
1721
+ while (++i < n) {
1722
+ if (specifier.charCodeAt(i) === 37) {
1723
+ string.push(specifier.slice(j, i));
1724
+ if ((pad2 = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
1725
+ else pad2 = c === "e" ? " " : "0";
1726
+ if (format2 = formats2[c]) c = format2(date, pad2);
1727
+ string.push(c);
1728
+ j = i + 1;
1729
+ }
1730
+ }
1731
+ string.push(specifier.slice(j, i));
1732
+ return string.join("");
1733
+ };
1734
+ }
1735
+ function newParse(specifier, Z) {
1736
+ return function(string) {
1737
+ var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day;
1738
+ if (i != string.length) return null;
1739
+ if ("Q" in d) return new Date(d.Q);
1740
+ if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0));
1741
+ if (Z && !("Z" in d)) d.Z = 0;
1742
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
1743
+ if (d.m === void 0) d.m = "q" in d ? d.q : 0;
1744
+ if ("V" in d) {
1745
+ if (d.V < 1 || d.V > 53) return null;
1746
+ if (!("w" in d)) d.w = 1;
1747
+ if ("Z" in d) {
1748
+ week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
1749
+ week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
1750
+ week = utcDay.offset(week, (d.V - 1) * 7);
1751
+ d.y = week.getUTCFullYear();
1752
+ d.m = week.getUTCMonth();
1753
+ d.d = week.getUTCDate() + (d.w + 6) % 7;
1754
+ } else {
1755
+ week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
1756
+ week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
1757
+ week = timeDay.offset(week, (d.V - 1) * 7);
1758
+ d.y = week.getFullYear();
1759
+ d.m = week.getMonth();
1760
+ d.d = week.getDate() + (d.w + 6) % 7;
1761
+ }
1762
+ } else if ("W" in d || "U" in d) {
1763
+ if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
1764
+ day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
1765
+ d.m = 0;
1766
+ d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
1767
+ }
1768
+ if ("Z" in d) {
1769
+ d.H += d.Z / 100 | 0;
1770
+ d.M += d.Z % 100;
1771
+ return utcDate(d);
1772
+ }
1773
+ return localDate(d);
1774
+ };
1775
+ }
1776
+ function parseSpecifier(d, specifier, string, j) {
1777
+ var i = 0, n = specifier.length, m = string.length, c, parse;
1778
+ while (i < n) {
1779
+ if (j >= m) return -1;
1780
+ c = specifier.charCodeAt(i++);
1781
+ if (c === 37) {
1782
+ c = specifier.charAt(i++);
1783
+ parse = parses[c in pads ? specifier.charAt(i++) : c];
1784
+ if (!parse || (j = parse(d, string, j)) < 0) return -1;
1785
+ } else if (c != string.charCodeAt(j++)) {
1786
+ return -1;
1787
+ }
1788
+ }
1789
+ return j;
1790
+ }
1791
+ function parsePeriod(d, string, i) {
1792
+ var n = periodRe.exec(string.slice(i));
1793
+ return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
1794
+ }
1795
+ function parseShortWeekday(d, string, i) {
1796
+ var n = shortWeekdayRe.exec(string.slice(i));
1797
+ return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
1798
+ }
1799
+ function parseWeekday(d, string, i) {
1800
+ var n = weekdayRe.exec(string.slice(i));
1801
+ return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
1802
+ }
1803
+ function parseShortMonth(d, string, i) {
1804
+ var n = shortMonthRe.exec(string.slice(i));
1805
+ return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
1806
+ }
1807
+ function parseMonth(d, string, i) {
1808
+ var n = monthRe.exec(string.slice(i));
1809
+ return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
1810
+ }
1811
+ function parseLocaleDateTime(d, string, i) {
1812
+ return parseSpecifier(d, locale_dateTime, string, i);
1813
+ }
1814
+ function parseLocaleDate(d, string, i) {
1815
+ return parseSpecifier(d, locale_date, string, i);
1816
+ }
1817
+ function parseLocaleTime(d, string, i) {
1818
+ return parseSpecifier(d, locale_time, string, i);
1819
+ }
1820
+ function formatShortWeekday(d) {
1821
+ return locale_shortWeekdays[d.getDay()];
1822
+ }
1823
+ function formatWeekday(d) {
1824
+ return locale_weekdays[d.getDay()];
1825
+ }
1826
+ function formatShortMonth(d) {
1827
+ return locale_shortMonths[d.getMonth()];
1828
+ }
1829
+ function formatMonth(d) {
1830
+ return locale_months[d.getMonth()];
1831
+ }
1832
+ function formatPeriod(d) {
1833
+ return locale_periods[+(d.getHours() >= 12)];
1834
+ }
1835
+ function formatQuarter(d) {
1836
+ return 1 + ~~(d.getMonth() / 3);
1837
+ }
1838
+ function formatUTCShortWeekday(d) {
1839
+ return locale_shortWeekdays[d.getUTCDay()];
1840
+ }
1841
+ function formatUTCWeekday(d) {
1842
+ return locale_weekdays[d.getUTCDay()];
1843
+ }
1844
+ function formatUTCShortMonth(d) {
1845
+ return locale_shortMonths[d.getUTCMonth()];
1846
+ }
1847
+ function formatUTCMonth(d) {
1848
+ return locale_months[d.getUTCMonth()];
1849
+ }
1850
+ function formatUTCPeriod(d) {
1851
+ return locale_periods[+(d.getUTCHours() >= 12)];
1852
+ }
1853
+ function formatUTCQuarter(d) {
1854
+ return 1 + ~~(d.getUTCMonth() / 3);
1855
+ }
1856
+ return {
1857
+ format: function(specifier) {
1858
+ var f = newFormat(specifier += "", formats);
1859
+ f.toString = function() {
1860
+ return specifier;
1861
+ };
1862
+ return f;
1863
+ },
1864
+ parse: function(specifier) {
1865
+ var p = newParse(specifier += "", false);
1866
+ p.toString = function() {
1867
+ return specifier;
1868
+ };
1869
+ return p;
1870
+ },
1871
+ utcFormat: function(specifier) {
1872
+ var f = newFormat(specifier += "", utcFormats);
1873
+ f.toString = function() {
1874
+ return specifier;
1875
+ };
1876
+ return f;
1877
+ },
1878
+ utcParse: function(specifier) {
1879
+ var p = newParse(specifier += "", true);
1880
+ p.toString = function() {
1881
+ return specifier;
1882
+ };
1883
+ return p;
1884
+ }
1885
+ };
1886
+ }
1887
+ var pads = { "-": "", "_": " ", "0": "0" };
1888
+ var numberRe = /^\s*\d+/;
1889
+ var percentRe = /^%/;
1890
+ var requoteRe = /[\\^$*+?|[\]().{}]/g;
1891
+ function pad(value, fill, width) {
1892
+ var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
1893
+ return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
1894
+ }
1895
+ function requote(s) {
1896
+ return s.replace(requoteRe, "\\$&");
1897
+ }
1898
+ function formatRe(names) {
1899
+ return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
1900
+ }
1901
+ function formatLookup(names) {
1902
+ return new Map(names.map((name, i) => [name.toLowerCase(), i]));
1903
+ }
1904
+ function parseWeekdayNumberSunday(d, string, i) {
1905
+ var n = numberRe.exec(string.slice(i, i + 1));
1906
+ return n ? (d.w = +n[0], i + n[0].length) : -1;
1907
+ }
1908
+ function parseWeekdayNumberMonday(d, string, i) {
1909
+ var n = numberRe.exec(string.slice(i, i + 1));
1910
+ return n ? (d.u = +n[0], i + n[0].length) : -1;
1911
+ }
1912
+ function parseWeekNumberSunday(d, string, i) {
1913
+ var n = numberRe.exec(string.slice(i, i + 2));
1914
+ return n ? (d.U = +n[0], i + n[0].length) : -1;
1915
+ }
1916
+ function parseWeekNumberISO(d, string, i) {
1917
+ var n = numberRe.exec(string.slice(i, i + 2));
1918
+ return n ? (d.V = +n[0], i + n[0].length) : -1;
1919
+ }
1920
+ function parseWeekNumberMonday(d, string, i) {
1921
+ var n = numberRe.exec(string.slice(i, i + 2));
1922
+ return n ? (d.W = +n[0], i + n[0].length) : -1;
1923
+ }
1924
+ function parseFullYear(d, string, i) {
1925
+ var n = numberRe.exec(string.slice(i, i + 4));
1926
+ return n ? (d.y = +n[0], i + n[0].length) : -1;
1927
+ }
1928
+ function parseYear(d, string, i) {
1929
+ var n = numberRe.exec(string.slice(i, i + 2));
1930
+ return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1;
1931
+ }
1932
+ function parseZone(d, string, i) {
1933
+ var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
1934
+ return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
1935
+ }
1936
+ function parseQuarter(d, string, i) {
1937
+ var n = numberRe.exec(string.slice(i, i + 1));
1938
+ return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
1939
+ }
1940
+ function parseMonthNumber(d, string, i) {
1941
+ var n = numberRe.exec(string.slice(i, i + 2));
1942
+ return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
1943
+ }
1944
+ function parseDayOfMonth(d, string, i) {
1945
+ var n = numberRe.exec(string.slice(i, i + 2));
1946
+ return n ? (d.d = +n[0], i + n[0].length) : -1;
1947
+ }
1948
+ function parseDayOfYear(d, string, i) {
1949
+ var n = numberRe.exec(string.slice(i, i + 3));
1950
+ return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
1951
+ }
1952
+ function parseHour24(d, string, i) {
1953
+ var n = numberRe.exec(string.slice(i, i + 2));
1954
+ return n ? (d.H = +n[0], i + n[0].length) : -1;
1955
+ }
1956
+ function parseMinutes(d, string, i) {
1957
+ var n = numberRe.exec(string.slice(i, i + 2));
1958
+ return n ? (d.M = +n[0], i + n[0].length) : -1;
1959
+ }
1960
+ function parseSeconds(d, string, i) {
1961
+ var n = numberRe.exec(string.slice(i, i + 2));
1962
+ return n ? (d.S = +n[0], i + n[0].length) : -1;
1963
+ }
1964
+ function parseMilliseconds(d, string, i) {
1965
+ var n = numberRe.exec(string.slice(i, i + 3));
1966
+ return n ? (d.L = +n[0], i + n[0].length) : -1;
1967
+ }
1968
+ function parseMicroseconds(d, string, i) {
1969
+ var n = numberRe.exec(string.slice(i, i + 6));
1970
+ return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1;
1971
+ }
1972
+ function parseLiteralPercent(d, string, i) {
1973
+ var n = percentRe.exec(string.slice(i, i + 1));
1974
+ return n ? i + n[0].length : -1;
1975
+ }
1976
+ function parseUnixTimestamp(d, string, i) {
1977
+ var n = numberRe.exec(string.slice(i));
1978
+ return n ? (d.Q = +n[0], i + n[0].length) : -1;
1979
+ }
1980
+ function parseUnixTimestampSeconds(d, string, i) {
1981
+ var n = numberRe.exec(string.slice(i));
1982
+ return n ? (d.s = +n[0], i + n[0].length) : -1;
1983
+ }
1984
+ function formatDayOfMonth(d, p) {
1985
+ return pad(d.getDate(), p, 2);
1986
+ }
1987
+ function formatHour24(d, p) {
1988
+ return pad(d.getHours(), p, 2);
1989
+ }
1990
+ function formatHour12(d, p) {
1991
+ return pad(d.getHours() % 12 || 12, p, 2);
1992
+ }
1993
+ function formatDayOfYear(d, p) {
1994
+ return pad(1 + timeDay.count(timeYear(d), d), p, 3);
1995
+ }
1996
+ function formatMilliseconds(d, p) {
1997
+ return pad(d.getMilliseconds(), p, 3);
1998
+ }
1999
+ function formatMicroseconds(d, p) {
2000
+ return formatMilliseconds(d, p) + "000";
2001
+ }
2002
+ function formatMonthNumber(d, p) {
2003
+ return pad(d.getMonth() + 1, p, 2);
2004
+ }
2005
+ function formatMinutes(d, p) {
2006
+ return pad(d.getMinutes(), p, 2);
2007
+ }
2008
+ function formatSeconds(d, p) {
2009
+ return pad(d.getSeconds(), p, 2);
2010
+ }
2011
+ function formatWeekdayNumberMonday(d) {
2012
+ var day = d.getDay();
2013
+ return day === 0 ? 7 : day;
2014
+ }
2015
+ function formatWeekNumberSunday(d, p) {
2016
+ return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);
2017
+ }
2018
+ function dISO(d) {
2019
+ var day = d.getDay();
2020
+ return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
2021
+ }
2022
+ function formatWeekNumberISO(d, p) {
2023
+ d = dISO(d);
2024
+ return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
2025
+ }
2026
+ function formatWeekdayNumberSunday(d) {
2027
+ return d.getDay();
2028
+ }
2029
+ function formatWeekNumberMonday(d, p) {
2030
+ return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);
2031
+ }
2032
+ function formatYear(d, p) {
2033
+ return pad(d.getFullYear() % 100, p, 2);
2034
+ }
2035
+ function formatYearISO(d, p) {
2036
+ d = dISO(d);
2037
+ return pad(d.getFullYear() % 100, p, 2);
2038
+ }
2039
+ function formatFullYear(d, p) {
2040
+ return pad(d.getFullYear() % 1e4, p, 4);
2041
+ }
2042
+ function formatFullYearISO(d, p) {
2043
+ var day = d.getDay();
2044
+ d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d);
2045
+ return pad(d.getFullYear() % 1e4, p, 4);
2046
+ }
2047
+ function formatZone(d) {
2048
+ var z = d.getTimezoneOffset();
2049
+ return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2);
2050
+ }
2051
+ function formatUTCDayOfMonth(d, p) {
2052
+ return pad(d.getUTCDate(), p, 2);
2053
+ }
2054
+ function formatUTCHour24(d, p) {
2055
+ return pad(d.getUTCHours(), p, 2);
2056
+ }
2057
+ function formatUTCHour12(d, p) {
2058
+ return pad(d.getUTCHours() % 12 || 12, p, 2);
2059
+ }
2060
+ function formatUTCDayOfYear(d, p) {
2061
+ return pad(1 + utcDay.count(utcYear(d), d), p, 3);
2062
+ }
2063
+ function formatUTCMilliseconds(d, p) {
2064
+ return pad(d.getUTCMilliseconds(), p, 3);
2065
+ }
2066
+ function formatUTCMicroseconds(d, p) {
2067
+ return formatUTCMilliseconds(d, p) + "000";
2068
+ }
2069
+ function formatUTCMonthNumber(d, p) {
2070
+ return pad(d.getUTCMonth() + 1, p, 2);
2071
+ }
2072
+ function formatUTCMinutes(d, p) {
2073
+ return pad(d.getUTCMinutes(), p, 2);
2074
+ }
2075
+ function formatUTCSeconds(d, p) {
2076
+ return pad(d.getUTCSeconds(), p, 2);
2077
+ }
2078
+ function formatUTCWeekdayNumberMonday(d) {
2079
+ var dow = d.getUTCDay();
2080
+ return dow === 0 ? 7 : dow;
2081
+ }
2082
+ function formatUTCWeekNumberSunday(d, p) {
2083
+ return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
2084
+ }
2085
+ function UTCdISO(d) {
2086
+ var day = d.getUTCDay();
2087
+ return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
2088
+ }
2089
+ function formatUTCWeekNumberISO(d, p) {
2090
+ d = UTCdISO(d);
2091
+ return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
2092
+ }
2093
+ function formatUTCWeekdayNumberSunday(d) {
2094
+ return d.getUTCDay();
2095
+ }
2096
+ function formatUTCWeekNumberMonday(d, p) {
2097
+ return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
2098
+ }
2099
+ function formatUTCYear(d, p) {
2100
+ return pad(d.getUTCFullYear() % 100, p, 2);
2101
+ }
2102
+ function formatUTCYearISO(d, p) {
2103
+ d = UTCdISO(d);
2104
+ return pad(d.getUTCFullYear() % 100, p, 2);
2105
+ }
2106
+ function formatUTCFullYear(d, p) {
2107
+ return pad(d.getUTCFullYear() % 1e4, p, 4);
2108
+ }
2109
+ function formatUTCFullYearISO(d, p) {
2110
+ var day = d.getUTCDay();
2111
+ d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
2112
+ return pad(d.getUTCFullYear() % 1e4, p, 4);
2113
+ }
2114
+ function formatUTCZone() {
2115
+ return "+0000";
2116
+ }
2117
+ function formatLiteralPercent() {
2118
+ return "%";
2119
+ }
2120
+ function formatUnixTimestamp(d) {
2121
+ return +d;
2122
+ }
2123
+ function formatUnixTimestampSeconds(d) {
2124
+ return Math.floor(+d / 1e3);
2125
+ }
2126
+
2127
+ // ../../node_modules/.bun/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js
2128
+ var locale2;
2129
+ var timeFormat;
2130
+ var timeParse;
2131
+ var utcFormat;
2132
+ var utcParse;
2133
+ defaultLocale2({
2134
+ dateTime: "%x, %X",
2135
+ date: "%-m/%-d/%Y",
2136
+ time: "%-I:%M:%S %p",
2137
+ periods: ["AM", "PM"],
2138
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
2139
+ shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
2140
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
2141
+ shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
2142
+ });
2143
+ function defaultLocale2(definition) {
2144
+ locale2 = formatLocale(definition);
2145
+ timeFormat = locale2.format;
2146
+ timeParse = locale2.parse;
2147
+ utcFormat = locale2.utcFormat;
2148
+ utcParse = locale2.utcParse;
2149
+ return locale2;
2150
+ }
2151
+
825
2152
  // src/locale/format.ts
826
- import { format as d3Format } from "d3-format";
827
- import { timeFormat, utcFormat } from "d3-time-format";
828
2153
  function formatNumber(value, _locale) {
829
2154
  if (!Number.isFinite(value)) return String(value);
830
2155
  if (Number.isInteger(value)) {
831
- return d3Format(",")(value);
2156
+ return format(",")(value);
832
2157
  }
833
- return d3Format(",.2f")(value);
2158
+ return format(",.2f")(value);
834
2159
  }
835
2160
  var ABBREVIATIONS = [
836
2161
  { threshold: 1e12, suffix: "T", divisor: 1e12 },
@@ -845,12 +2170,30 @@ function abbreviateNumber(value) {
845
2170
  for (const { threshold, suffix, divisor } of ABBREVIATIONS) {
846
2171
  if (absValue >= threshold) {
847
2172
  const abbreviated = absValue / divisor;
848
- const formatted = abbreviated % 1 === 0 ? String(abbreviated) : d3Format(".1f")(abbreviated);
2173
+ const formatted = abbreviated % 1 === 0 ? String(abbreviated) : format(".1f")(abbreviated);
849
2174
  return `${sign}${formatted}${suffix}`;
850
2175
  }
851
2176
  }
852
2177
  return formatNumber(value);
853
2178
  }
2179
+ var D3_FORMAT_SUFFIX_RE = /^(.*~?[efgsrdxXobcnp%])(.+)$/;
2180
+ function buildD3Formatter(formatStr) {
2181
+ if (!formatStr) return null;
2182
+ try {
2183
+ return format(formatStr);
2184
+ } catch {
2185
+ const m = formatStr.match(D3_FORMAT_SUFFIX_RE);
2186
+ if (m) {
2187
+ try {
2188
+ const fmt = format(m[1]);
2189
+ const suffix = m[2];
2190
+ return (v) => fmt(v) + suffix;
2191
+ } catch {
2192
+ }
2193
+ }
2194
+ }
2195
+ return null;
2196
+ }
854
2197
  var GRANULARITY_FORMATS = {
855
2198
  year: "%Y",
856
2199
  quarter: "",
@@ -1152,6 +2495,7 @@ export {
1152
2495
  adaptTheme,
1153
2496
  areaChart,
1154
2497
  barChart,
2498
+ buildD3Formatter,
1155
2499
  checkPaletteDistinguishability,
1156
2500
  columnChart,
1157
2501
  computeChrome,